window.document.write("");
SELECT T3.FDATE 生产订单日期,T2.F_BAHSCDDH 生产订单编号,T3.FDATAVALUE 工作令,T3.CPBM 对应产品编码,T3.FNUMBER 物料编码,T3.WLMC 物料名称,T3.FSPECIFICATION 规格型号,
       T3.FQTY 数量,T1.F_BAH_DATE 开工时间,T5.WGRQ 完工时间,T4.FNAME 工序名称 FROM BAH_t_Cust100002 T1
	LEFT JOIN BAH_t_Cust_Entry100046 T2 ON T1.FID=T2.FID
	LEFT JOIN (SELECT T1.FBILLNO,T1.FDATE,T3.FNUMBER,T3.FNAME WLMC,T3.FSPECIFICATION,T4.FNUMBER CPBM,T5.FDATAVALUE,T2.FQTY FROM T_PRD_MO T1
					LEFT JOIN T_PRD_MOENTRY T2 ON T1.FID=T2.FID
					LEFT JOIN (SELECT A.FMATERIALID,A.FNUMBER,B.FNAME,B.FSPECIFICATION,A.FBAHTEXTURE FROM T_BD_MATERIAL A
									LEFT JOIN T_BD_MATERIAL_L B ON A.FMATERIALID=B.FMATERIALID) T3 ON T2.FMATERIALID=T3.FMATERIALID
					LEFT JOIN T_BD_MATERIAL T4 ON T2.FBAHSCDDCPMC=T4.FMATERIALID
					LEFT JOIN (select T1.FENTRYID,T2.FDATAVALUE from T_BAS_ASSISTANTDATAENTRY T1
									LEFT JOIN T_BAS_ASSISTANTDATAENTRY_L T2 ON T1.FENTRYID=T2.FENTRYID) T5 ON T2.FBAHWORK=T5.FENTRYID) T3 ON T2.F_BAHSCDDH=T3.FBILLNO
	LEFT JOIN T_ENG_PROCESS_L T4 ON T1.F_BAHGYMC=T4.FID
	LEFT JOIN (SELECT T1.F_BAH_DATE WGRQ,T1.F_BAHGXMC,T2.F_BAHSCDDH FROM BAH_t_Cust100004 T1
				  LEFT JOIN BAH_t_Cust_Entry100049 T2 ON T1.FID=T2.FID
				UNION ALL
			   SELECT T1.F_BAH_DATE,T1.F_BAHGYMC,T2.F_BAHSCDDH FROM BAH_t_Cust100003 T1
				  LEFT JOIN BAH_t_Cust_Entry100047 T2 ON T1.FID=T2.FID) T5 ON T1.F_BAHGYMC=T5.F_BAHGXMC AND T2.F_BAHSCDDH=T5.F_BAHSCDDH