<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="加工组、热处理组默认原则">
	<query id="CoreDefGourp.queryProcessStyle" desc="查询二级工序分类">
		<![CDATA[
			SELECT T.PROCESS_STYLE
			  FROM COM_BASE_PROCESS_C T
			 WHERE T.PROCESS_CDOE_C = ?
		]]>
	</query>
	
	<query id="CoreDefGourp.queryModelStyle" desc="查询扣型分类">
		<![CDATA[
			SELECT T.MODEL_STYLE, T.MODEL_STYLE_DESC
			  FROM COM_BASE_MODEL T
			 WHERE T.MODEL_CODE = ?
		]]>
	</query>
	
	<query id="CoreDefGourp.queryProcessPlineGroup" desc="查询工序评审产线分组">
		<![CDATA[
			SELECT B.GROUP_PLAN, B2.BASENAME
			  FROM CRAFT_ORD_DESIGN_MSC_PL_GX_PRL T, COM_BASE_PLINE B
			  LEFT JOIN COM_BASE_INFO B2
			    ON B2.BASECODE = B.GROUP_PLAN
			 WHERE B.PLINE_CODE = T.PLINE_CODE
			   AND B.VALIDFLAG = '1'
			   AND T.VALIDFLAG = '1'
			   AND T.DESGIN_KEY = ?
			   AND T.MSC_PLINE = ?
			   AND T.PROCESS_CODE = ?
			 GROUP BY B.GROUP_PLAN, B2.BASENAME
			HAVING COUNT(B.GROUP_PLAN) >= 1
			 ORDER BY B.GROUP_PLAN
		]]>
	</query>
	
	<query id="CoreDefGourp.selectJgxDefGroup" desc="查询加工优先分组">
		<![CDATA[
			SELECT P.GROUP_PLAN,
			       T.PLINE_CODE,
			       T.PLINE_NAME,
			       T.HR_CAPCTY,
			       T.PRD_RATE,
			       T.WASTE_RATE
			  FROM SLM_BASE_MATERIAL_K_PL T
			  LEFT JOIN COM_BASE_PLINE P
			    ON P.PLINE_CODE = T.PLINE_CODE
			 WHERE T.IN_MATERIAL_NO = ?
			   AND T.OUT_MATERIAL_NO = ?
			   AND (T.DISABLE_FL != '1' OR T.DISABLE_FL IS NULL)
			   AND T.PLINE_CODE IN (SELECT B.PLINE_CODE
			                          FROM CRAFT_ORD_DESIGN_MSC_PL_GX_PRL B
			                         WHERE B.PROCESS_CODE = 'G'
			                           AND B.VALIDFLAG = '1'
			                           AND B.DESGIN_KEY = ?
			                           AND B.MSC_PLINE = ?)
			 ORDER BY T.PLINE_LEVEL ASC, T.PRD_RATE DESC
		]]>
	</query>
	
	<query id="CoreDefGourp.selectRclDefGroup" desc="查询热处理优先分组">
		<![CDATA[
			SELECT P.GROUP_PLAN,
			       T.PLINE_CODE,
			       T.PLINE_NAME,
			       T.HR_CAPCTY,
			       T.PRD_RATE,
			       T.DISABLE_FL,
			       T.WASTE_RATE
			  FROM SLM_BASE_MATERIAL_F_PL T
			  LEFT JOIN COM_BASE_PLINE P
			    ON P.PLINE_CODE = T.PLINE_CODE
			 WHERE T.IN_MATERIAL_NO = ?
			   AND T.OUT_MATERIAL_NO = ?
			   AND (T.DISABLE_FL != '1' OR T.DISABLE_FL IS NULL)
			   AND T.PLINE_CODE IN (SELECT B.PLINE_CODE
			                          FROM CRAFT_ORD_DESIGN_MSC_PL_GX_PRL B
			                         WHERE B.PROCESS_CODE = 'F'
			                           AND B.VALIDFLAG = '1'
			                           AND B.DESGIN_KEY = ?
			                           AND B.MSC_PLINE = ?)
			 ORDER BY T.PLINE_LEVEL ASC, T.PRD_RATE DESC
		]]>
	</query>
	
	
	<query id="CoreDefGourp.queryDesginBomI" desc="查询加工投入查出物料">
		<![CDATA[
			SELECT T.IN_MATERIAL_NO,
			       T.IN_MATERIAL_DESC,
			       T.OUT_MATERIAL_NO,
			       T.OUT_MATERIAL_DESC
			  FROM SLM_ORD_DESIGN_BOM_K T
			 WHERE T.BOM = ?
			   AND T.MARK = '1'
		]]>
	</query>
	
	<query id="CoreDefGourp.queryDesginBomF" desc="查询各工序投入查出物料">
		<![CDATA[
			SELECT T.F_IN_MATERIAL_NO,
			       T.F_IN_MATERIAL_DESC,
			       T.F_OUT_MATERIAL_NO,
			       T.F_OUT_MATERIAL_DESC
			  FROM SLM_ORD_DESIGN_BOM T
			 WHERE T.BOM = ?
		]]>
	</query>
	
	<query id="CoreDefGourp.queryDesignMscplprc" desc="销售合同查询制程工序">
		<![CDATA[
			SELECT DESGIN_KEY,
			       MSC_PLINE,
			       WHOLE_BACKLOG,
			       WHOLE_BACKLOG_DESC,
			       BACKLOG_SEQ,
			       PROCESS_CODE,
			       PROCESS_DESC,
			       PROCESS_SEQ,
			       PROCESS_CODE_C,
			       PROCESS_DESC_C,
			       PROCESS_SEQ
			  FROM CRAFT_ORD_DESIGN_MSC_PL_PRC T
			 WHERE T.DESGIN_KEY = ?
			   AND T.MSC_PLINE = ?
			   AND T.PROCESS_CODE = ?
		]]>
	</query>
	
	
</queryMap>