<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="生产周期">

     <query id="IProCycleDao.getValidZC" desc="生产周期  查询有效制程">
         <![CDATA[
       SELECT DESGIN_KEY, MSC_PLINE, WHOLE_BACKLOG, WHOLE_BACKLOG_DESC, SET_FL
  FROM SLM_ORD_DESIGN_MSC_PL T
 WHERE T.DESGIN_KEY = ?
         ]]>
	</query>
	
	 <query id="IProCycleDao.getValidJG" desc="生产周期  查询有效接箍码">
         <![CDATA[
      SELECT DESGIN_KEY, CODE_JG
  FROM SLM_ORD_DESIGN_MSC_JG T
 WHERE T.DESGIN_KEY = ?
         ]]>
	</query>

    <query id="IProCycleDao.getPscByCode" desc="生产周期  通过标准代码等查询产品码">
         <![CDATA[
          SELECT T.PSC, T.PSC_DESC
  FROM COM_PSC T
 WHERE T.PRODUCCODE = ?
   AND T.STD_CODE = ?
   AND T.STEELCODE = ?
   AND DECODE(?, NULL, '1', T.STD_STYLE) = DECODE(?, NULL, '1', ?)
   AND DECODE(?, NULL, T.STD_STYLE,NULL) IS NULL
   AND T.VALIDFLAG = 1
         ]]>
	</query>
	
	 <query id="IProCycleDao.getMscByPsc" desc="生产周期  通过产品码和客户ALPHA查询冶金规范码">
         <![CDATA[
         SELECT PSC, PSC_DESC, MSC, MSC_DES
  FROM COM_PSC_R_MSC T
 WHERE T.PSC = ?
   AND DECODE(?, NULL, '1', T.USE_CODE) = DECODE(?, NULL, '1', ?)
   AND DECODE(?, NULL, T.USE_CODE, NULL) IS NULL
   AND T.VALIDFLAG = 1
         ]]>
	</query>
	
	 <query id="IProCycleDao.getLineDelivery" desc="生产周期  查询交货行信息">
         <![CDATA[
         SELECT ORD_PK,
       ORD_LN_PK,
       ORD_LN_DLY_PK,
       DELIVERY_NO,
       TO_CHAR(DELVRY_BDATE, 'YYYY-MM-DD') DELVRY_BDATE,
       TO_CHAR(DELVRY_EDATE, 'YYYY-MM-DD') DELVRY_EDATE,
       DELVRY_QTY,
       ORDER_UNIT,
       WGT_ESTMT,
       ENSU_TOTL_LEN,
       RECEIV_NO,
       RECEIV_NM,
       DELVRY_ADDR,
       AGENCY_FL,
       RECEIV_ADDR,
       TRANSIT_PLAN,
       TRANSIT_MNY,
       DELIVERY_STATUS
  FROM SLM_ORDER_LINE_DELIVERY T
 WHERE T.ORD_LN_PK = ?
   AND T.VALIDFLAG = 1
         ]]>
	</query>
	
	
	 <query id="IProCycleDao.getLineDeliveryByPk" desc="生产周期  根据交货行号查询交货行信息">
         <![CDATA[
      SELECT ORD_PK,
       ORD_LN_PK,
       ORD_LN_DLY_PK,
       DELIVERY_NO,
       DELVRY_BDATE,
       DELVRY_EDATE,
       DELVRY_QTY,
       ORDER_UNIT,
       WGT_ESTMT,
       ENSU_TOTL_LEN,
       RECEIV_NO,
       RECEIV_NM,
       DELVRY_ADDR,
       AGENCY_FL,
       RECEIV_ADDR,
       TRANSIT_PLAN,
       TRANSIT_MNY,
       BE_DELIVERY_STATUS,
       BE_OBJ_STS_OP,
       DELIVERY_STATUS
  FROM SLM_ORDER_LINE_DELIVERY T
 WHERE T.ORD_LN_PK = ?
   AND T.ORD_LN_DLY_PK = ?
   AND T.VALIDFLAG = 1
         ]]>
	</query>
	
	 <query id="IProCycleDao.saveMSCPLPC" desc="生产周期  保存生产周期主表">
         <![CDATA[
     INSERT INTO SLM_ORD_DESIGN_MSC_PL_PC
  (DESGIN_KEY,
   ORD_LN_DLY_PK,
   MSC_PLINE,
   DELVRY_EDATE,
   DELVRY_QTY,
   ORDER_UNIT,
   RECEIV_NO,
   RECEIV_NM,
   RCMD_DELVRY_EDATE,
   PRD_CYC,
   N_MATERIAL_FL,
   CYC_EDIT,
   CREATE_NAME,
   CREATE_TIME,
   UPDATE_NAME,
   UPDATE_TIME,
   PRD_CYC_BTCH)
VALUES
  (?,
   ?,
   ?,
   TO_DATE(?, 'YYYY-MM-DD'),
   ?,
   ?,
   ?,
   ?,
   TO_DATE(?, 'YYYY-MM-DD'),
   ROUND(?,38),
   ?,
   TO_NUMBER(?),
   ?,
   SYSDATE,
   NULL,
   NULL,
   ROUND(?,38))
         ]]>
	</query>
	
	 
	 <query id="IProCycleDao.saveMSCPLPCLST" desc="生产周期  保存生产周期从表">
         <![CDATA[
       INSERT INTO SLM_ORD_DESIGN_MSC_PL_PC_LST
  (DESGIN_KEY,
   ORD_LN_DLY_PK,
   MSC_PLINE,
   BACKLOG_SEQ,
   PROCESS_CODE,
   PROCESS_DESC,
   REVIEW_ASK,
   LST_PRD_DATE,
   PRD_CYC,
   PRD_CYC_BTCH)
VALUES
  (?, ?, ?, ?, ?, ?, ?, ?,ROUND( ?,38),ROUND(?,38))
         ]]>
	</query>
	
	
	
	 <query id="IProCycleDao.deleteMSCPLPCLST" desc="生产周期  保存生产周期从表">
         <![CDATA[
       DELETE FROM  SLM_ORD_DESIGN_MSC_PL_PC_LST
       WHERE  ORD_LN_DLY_PK = ?
   
         ]]>
	</query>
	
	 <query id="IProCycleDao.deleteMSCPLPC" desc="生产周期  保存生产周期主表">
         <![CDATA[
     DELETE FROM  SLM_ORD_DESIGN_MSC_PL_PC
     WHERE     ORD_LN_DLY_PK = ?
  
         ]]>
	</query>
	
	<query id="IProCycleDao.getPhyCode" desc="获取检验项代码">
         <![CDATA[
     SELECT PHY_CODE FROM SLM_ORD_DESIGN_STD_PIC T 
     WHERE T.DESGIN_KEY = ?
     
         ]]>
	</query>
	
	 <query id="IProCycleDao.getPhyItemTime" desc="获取检验项准备、试验时间">
         <![CDATA[
     SELECT MAX(NVL(T.HOUR_READY,'0')+NVL(T.HOUR_TEST,'0')) FROM COM_BASE_PHY T 
     WHERE 1=1

         ]]>
	</query>
	
	<query id="IProCycleDao.getCycEdit" desc="获取周期修正值">
         <![CDATA[
     SELECT CYC_EDIT FROM SLM_ORD_DESIGN_MSC_PL_PC T 
     WHERE T.ORD_LN_DLY_PK = ?
     
         ]]>
	</query>
	
	<query id="IProCycleDao.getComBaseProcess" desc="获取周期修正值">
         <![CDATA[
       SELECT 
       MINUTE_PRODUCT_OUT,
       MINUTE_WAITE_OUT,
       BATCH_WAITE,
       BATCH_WAITE_OUT,
       PROCESS_CODE,
       PROCESS_DESC,
       STYLE,
       PROCESS_ID,
       COST,
       MINUTE_PRODUCT,
       MINUTE_WAITE,
       CREATE_NAME,
       TO_CHAR(CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       UPDATE_NAME,
       TO_CHAR(UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       DELETE_NAME,
       TO_CHAR(DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       VALIDFLAG,
       MEMO,
       ICOUNT,
       PROCESS_CODE_OLD
       FROM COM_BASE_PROCESS
       WHERE
 	   PROCESS_CODE = ?
       AND VALIDFLAG = '1'
     	    
     	 
         ]]>
	</query>
	
	<query id="IProCycleDao.getPlStationHourAllProcess" desc="获取周期修正值">
         <![CDATA[
           SELECT SUM(STATION_HOUR) STATION_HOUR
      FROM COM_BASE_STATION A
      WHERE A.STATION_CODE IN (SELECT STATION_CODE
                            FROM COM_MSC_STATION Q
                           WHERE Q.MSC = ?
                             AND Q.MSC_PLINE = ?
                             AND Q.VALIDFLAG = '1')
      AND A.VALIDFLAG = '1'
     
         ]]>
	</query>
	
	<query id="IProCycleDao.getPlStationHourOnlyProcess" desc="获取周期修正值">
         <![CDATA[
                SELECT SUM(STATION_HOUR) STATION_HOUR
       FROM COM_BASE_STATION A
       WHERE A.STATION_CODE IN (SELECT STATION_CODE
                            FROM COM_MSC_STATION Q
                           WHERE Q.MSC = ?
                             AND Q.MSC_PLINE = ?
                             AND Q.PROCESS_CODE = ?
                             AND Q.VALIDFLAG = '1')
       AND A.VALIDFLAG = '1'
      
         ]]>
	</query>
	
	<query id="IProCycleDao.getProcessCodeCEntity" 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,
       MINUTE_PRODUCT,
       MINUTE_PRODUCT_OUT,
       MINUTE_WAITE,
       MINUTE_WAITE_OUT,
       BATCH_WAITE,
       BATCH_WAITE_OUT,
       CIC,
       PIC,
       SIC,
       DIC,
       WIC,
       GIC
  FROM SLM_ORD_DESIGN_MSC_PL_PRC T
  WHERE T.DESGIN_KEY = ?
  AND T.MSC_PLINE = ?
      
         ]]>
	</query>
	
	<query id="IProCycleDao.getComProcessCodeCEntity" desc="获取周期修正值">
         <![CDATA[
     SELECT T.PROCESS_CDOE_C,
       T.PROCESS_DESC_C,
       T.PROCESS_CDOE,
       T.PROCESS_DESC,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.UPDATE_NAME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       T.DELETE_NAME,
       TO_CHAR(T.DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       T.VALIDFLAG,
       T.MEMO,
       T.PROCESS_ID_C,
       T.PROCESS_CDOE_C_OLD,
       T.PROCESS_STYLE,
       T.MINUTE_PRODUCT,
       T.MINUTE_WAITE,
       T.MINUTE_PRODUCT_OUT,
       T.MINUTE_WAITE_OUT,
       T.BATCH_WAITE,
       T.BATCH_WAITE_OUT
  FROM COM_BASE_PROCESS_C T
 WHERE T.PROCESS_CDOE = ?
   AND T.PROCESS_CDOE_C = ?
         ]]>
	</query>
	
	
</queryMap>