<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc = "对基础信息实绩操作">
	<query id = "ComSaleCostCountZG.query" desc = "查询工序">
	<![CDATA[

SELECT T.ORDER_NO || '/'|| T.ORDER_SEQ || '/'|| T.DELIVERY_NO DELIVERY_NO,T.ORD_LN_DLY_PK,T.PLN_DIVIDE_ID,TS.PRO_MONTH,
                  T.ORDERWEIGHT,T.INDEX_SEQ,T.STATION_ROAD,T.BOM,CASE P.IFBUYPLAN WHEN '1' THEN '是' WHEN '0' THEN '否' ELSE NULL END AS IFBUYPLAN ,
                  CASE TS.PLINE_CODE WHEN 'CO65' THEN '是' WHEN 'CO66' THEN '是' ELSE '否' END AS OUTBUY,TS.WEIGTH_S,
                  TS.PLINE_CODE,TS.PLINE_NAME,TS.INWL_ID,TS.INWL_DESC,TS.OUTWL_ID,TS.OUTWL_DESC,PD.HR_CAPCTY,PD.PRD_RATE,#MONTH# MONTH
FROM PLN_ORDER_ZG_S TS
JOIN  PLN_ORDER_ZG T 
ON T.PRO_ORDER_NO=TS.PRO_ORDER_NO
LEFT JOIN PLN_REQINF_GP P ON TS.INWL_ID=P.MATERIAL_NO
LEFT JOIN COM_BASE_PLINE CP ON CP.PLINE_CODE=TS.PLINE_CODE 
LEFT JOIN SLM_BASE_MATERIAL_D_PL PD ON  PD.IN_MATERIAL_NO = TS.INWL_ID AND PD.OUT_MATERIAL_NO=TS.OUTWL_ID AND PD.PLINE_CODE=TS.PLINE_CODE
LEFT JOIN COST_BASE_PROCESSCOST CBT ON CBT.PLINE_CODE=TS.PLINE_CODE AND CBT.YEAR={1}
WHERE TS.PRO_MONTH= {0}
	]]>
	</query>
	<query id = "ComSaleCostCountZG.query2" desc = "查询工序">
	<![CDATA[
select t.ROLL_MONTH,t.ord_ln_dly_pk,t.order_no||'/'||t.order_seq||'/'||t.DELIVERY_NO  交货行号,t.bom,t.PROCESS_SEQ,
       t.PLAN_WT_D,v.Outs_Billet_Fl,v.Outs_Stl_Pipe_Fl
 from PLN_SALEORD_PROC t,PLN_SALEORD v 
 where t.ORDER_SOURCE = '销售合同' and  t.ord_ln_dly_pk = v.ord_ln_dly_pk(+)and t.Planstatus between 2 and 5 and t.Roll_Month = '2015-11'
	]]>
	</query>
	<query id = "ComSaleCostCountZG.querychanghui" desc = "查询工序">
	<![CDATA[
select CK.PERCENT,T.*
from COST_BASE_PRICE t 
LEFT JOIN COST_BASE_PLINE_REBACK CK ON CK.ITEM_CODE=T.ITEM_CODE AND CK.PLINE_CODE={1} AND CK.VALIDFLAG='1'
where t.year={0} and t.arc_code='111004' AND T.VALIDFLAG='1'
	]]>
	</query>
</queryMap>