<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="权限功能表查询">
	<query id="CoreOrderCraft.getMscPlSti" desc="获取全制程工序点信息">
		<![CDATA[
SELECT T.DESGIN_KEY,
       T.MSC_PLINE,
       T.WHOLE_BACKLOG,
       T.WHOLE_BACKLOG_DESC,
       T.BACKLOG_SEQ,
       T.PROCESS_CODE,
       T.PROCESS_DESC,
       T.PROCESS_SEQ,
       T.PROCESS_CODE_C,
       T.PROCESS_DESC_C,
       T.STATION_ID,
       T.STATION_CODE,
       T.STATION_DESC,
       A.BASENAME STATION_TYPE,
       T.CRAFTITEM_CODE,
       T.CRAFTITEM_DESC
  FROM SLM_ORD_DESIGN_MSC_PL_STI T
  LEFT JOIN COM_BASE_INFO A
    ON T.STATION_TYPE = A.BASECODE
 WHERE DECODE('#MSC_PLINE#', NULL, '1', MSC_PLINE) =
       DECODE('#MSC_PLINE#', NULL, '1', '#MSC_PLINE#')
       AND T.DESGIN_KEY = '#DESGIN_KEY#'
       ORDER BY T.BACKLOG_SEQ, T.PROCESS_SEQ, T.STATION_ID
		]]>
	</query>
	
	<query id="CoreOrderCraft.getMscPlStiTc" desc="获取全制程工序点-工艺参数信息(MPS)">
		<![CDATA[
SELECT DECODE(T.CRAFTITEM_CODE, NULL, 'False', 'True') CHK,  A.CRAFTITEM_CODE, A.CRAFTITEM_DESC
  FROM COM_BASE_STATION_R_CRAFT A
  LEFT JOIN SLM_ORD_DESIGN_MSC_PL_STI_TC T
    ON T.CRAFTITEM_CODE = A.CRAFTITEM_CODE
   AND T.DESGIN_KEY = '#DESGIN_KEY#'
   AND T.MSC_PLINE = '#MSC_PLINE#'
   AND T.WHOLE_BACKLOG = '#WHOLE_BACKLOG#'
   AND T.BACKLOG_SEQ = '#BACKLOG_SEQ#'
   AND T.PROCESS_CODE = '#PROCESS_CODE#'
   AND T.PROCESS_SEQ = '#PROCESS_SEQ#'
   AND T.PROCESS_CODE_C = '#PROCESS_CODE_C#'
   AND T.STATION_ID = '#STATION_ID#'
   AND T.STATION_CODE = '#STATION_CODE#'
 WHERE A.PROCESS_CODE = '#PROCESS_CODE#'
   AND A.STATION_CODE = '#STATION_CODE#'
		]]>
	</query>
	
	<query id="CoreOrderCraft.setMscPlStiTc" desc="新增全制程工序点-工艺参数信息(MPS)">
		<![CDATA[
INSERT INTO SLM_ORD_DESIGN_MSC_PL_STI_TC
  (DESGIN_KEY,
   MSC_PLINE,
   WHOLE_BACKLOG,
   WHOLE_BACKLOG_DESC,
   BACKLOG_SEQ,
   PROCESS_CODE,
   PROCESS_DESC,
   PROCESS_SEQ,
   PROCESS_CODE_C,
   PROCESS_DESC_C,
   STATION_ID,
   STATION_CODE,
   STATION_DESC,
   STATION_TYPE,
   CRAFTITEM_CODE,
   CRAFTITEM_DESC,
   ORD_PK,
   ORD_LN_PK,
   USER_NAME)
VALUES
  ('#DESGIN_KEY#',
   '#MSC_PLINE#',
   '#WHOLE_BACKLOG#',
   '#WHOLE_BACKLOG_DESC#',
   '#BACKLOG_SEQ#',
   '#PROCESS_CODE#',
   '#PROCESS_DESC#',
   '#PROCESS_SEQ#',
   '#PROCESS_CODE_C#',
   '#PROCESS_DESC_C#',
   '#STATION_ID#',
   '#STATION_CODE#',
   '#STATION_DESC#',
   '#STATION_TYPE#',
   '#CRAFTITEM_CODE#',
   '#CRAFTITEM_DESC#',
   '#ORD_PK#',
   '#ORD_LN_PK#',
   '#USER_NAME#')
		]]>
	</query>
	
	<query id="CoreOrderCraft.delMscPlStiTc" desc="删除全制程工序点-工艺参数信息(MPS)">
		<![CDATA[
DELETE FROM SLM_ORD_DESIGN_MSC_PL_STI_TC T
 WHERE T.DESGIN_KEY = '#DESGIN_KEY#'
   AND T.MSC_PLINE = '#MSC_PLINE#'
   AND T.WHOLE_BACKLOG = '#WHOLE_BACKLOG#'
   AND T.BACKLOG_SEQ = '#BACKLOG_SEQ#'
   AND T.PROCESS_CODE = '#PROCESS_CODE#'
   AND T.PROCESS_SEQ = '#PROCESS_SEQ#'
   AND T.PROCESS_CODE_C = '#PROCESS_CODE_C#'
   AND T.STATION_ID = '#STATION_ID#'
   AND T.STATION_CODE = '#STATION_CODE#'
		]]>
	</query>
	
	<query id="CoreOrderCraft.getMscPline" desc="获取产线">
		<![CDATA[
SELECT T.MSC_PLINE
  FROM SLM_ORD_DESIGN_MSC_PL_STI T
 WHERE T.DESGIN_KEY = '#DESGIN_KEY#'
 GROUP BY T.MSC_PLINE
 ORDER BY MSC_PLINE
		]]>
	</query>
	
	<query id="CoreOrderCraft.getCraftCount" desc="获取维护的工艺参数">
		<![CDATA[
SELECT COUNT(1)
  FROM SLM_ORD_DESIGN_MSC_PL_STI_TC T
 WHERE T.DESGIN_KEY = '#DESGIN_KEY#'
		]]>
	</query>
	
	<query id="CoreOrderCraft.getMpsNo" desc="获取MPS编号">
		<![CDATA[
SELECT T.MPS_NO FROM SLM_ORDER_LINE T WHERE T.ORD_LN_PK = '#ORD_LN_PK#'
		]]>
	</query>
	
	<query id="CoreOrderCraft.setMpsNo" desc="设置MPS编号">
		<![CDATA[
UPDATE SLM_ORDER_LINE T SET T.MPS_NO = '#MPS_NO#' WHERE T.ORD_LN_PK = '#ORD_LN_PK#'
		]]>
	</query>
</queryMap>
