<?xml version="1.0" encoding="UTF-8"?>
 <queryMap desc="合同产品生产监制要求界面">
 
  <query id="CoreOrderProducer.CoreOrderProducerHeadQuery" desc="合同产品生产监制界面头信息">
        <![CDATA[
    SELECT R.*,
       DECODE(R.PRDCR_STS,
              'L',
              '监制待维护',
              'M',
              '监制已维护',
              'W',
              '监制待确认',
              'S',
              '监制已生效',
              'F',
              '监制回退') PRDCR_STS_DESC
  FROM (SELECT T.ORDER_SEQ,
               ROUND(TO_NUMBER(T.PRDCT_WGT), 3) PRDCT_WGT,
               T.ORDER_UNIT,
               T.ORD_LN_PK,
               T1.ORDER_NO,
               S.APPROVER,
               T.FINAL_USER_DESC,
               T.PRODUCNAME,
               T.ORDER_SPEC_DESC,
               T.MODEL_DESC,
               T.LEN_DESC,
               T.ORDER_QTY,
               T.LEN_UNIT,
               T.ORD_ENSU_TOTL_LEN,
               T.ORDER_ADD_DESC,
               T.ORDER_SPECIAL_DESC,
               (SELECT BASENAME
                  FROM COM_BASE_INFO
                 WHERE T.OUTS_STL_PIPE_FL = BASECODE
                   AND VALIDFLAG = '1') OUTS_STL_PIPE_FL,
               (SELECT BASENAME
                  FROM COM_BASE_INFO
                 WHERE T.OUTS_BILLET_FL = BASECODE
                   AND VALIDFLAG = '1') OUTS_BILLET_FL,
               DECODE(T.ASSEL_FL, '1', 'TRUE', 'FALSE') ASSEL_FL,
               T.PRDCR_DESC,
               T.PRDCR_NO,
               T.PSC,
               DECODE(T.PRODUCER_FL, '1', '有', '无') PRODUCER_FL,
               T.PSC_DESC,
               T.STD_CODE,
               T.STD_NAME,
               T.MPS_NO,
               T.MPS_FL,
               T.FINAL_USER,
           (  SELECT CASE
               WHEN INSTR(TO_CHAR(WM_CONCAT(PRDCR_STS)), 'F') > 0 THEN
               'F'
               WHEN INSTR(TO_CHAR(WM_CONCAT(PRDCR_STS)), 'L') > 0 THEN
               'L'
               WHEN INSTR(TO_CHAR(WM_CONCAT(PRDCR_STS)), 'M') > 0 AND
               INSTR(TO_CHAR(WM_CONCAT(PRDCR_STS)), 'L') <= 0 THEN
               'M'
               WHEN INSTR(TO_CHAR(WM_CONCAT(PRDCR_STS)), 'W') > 0 AND
               INSTR(TO_CHAR(WM_CONCAT(PRDCR_STS)), 'M') <= 0 THEN
               'W'
               WHEN INSTR(TO_CHAR(WM_CONCAT(PRDCR_STS)), 'S') > 0 THEN
               'S'
               END
               FROM SLM_ORDER_LINE_PRDCR A
              WHERE T.PRDCR_NO = A.PRDCR_NO) PRDCR_STS,
               TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME
          FROM SLM_ORDER_LINE T, SLM_ORDER_HEAD T1,(SELECT PRDCR_NO,max(APPROVER) APPROVER from SLM_ORDER_LINE_PRDCR GROUP by PRDCR_NO) S
        
         WHERE T.ORD_PK = T1.ORD_PK
            AND  T.PRDCR_NO = S.PRDCR_NO
           -- AND T.ORDER_LN_STATUS >= '12020202'
           -- AND T.ORDER_LN_STATUS < '12020401'
           -- AND T.ORDER_LN_STATUS !='12020203'
           AND T.PRODUCER_FL = '1'
           AND T.PRDCR_NO IS NOT NULL
           AND T.VALIDFLAG = '1'
           AND T1.VALIDFLAG = '1'
           #TIMECON#
           AND '&'||T1.ORDER_NO LIKE '&'||'%'||'#ORDER_NO#'||'%'
           --#DATAACCESS#
           ) R

        ]]>
    </query>
    
      <query id="CoreOrderProducer.CoreOrderProducerHeadQueryView" desc="合同产品生产监制界面头信息">
        <![CDATA[
    SELECT R.*,
       DECODE(R.PRDCR_STS,
              'L',
              '监制待维护',
              'M',
              '监制已维护',
              'W',
              '监制待确认',
              'S',
              '监制已生效',
              'F',
              '监制回退') PRDCR_STS_DESC
  FROM (SELECT T.ORDER_SEQ,
               ROUND(TO_NUMBER(T.PRDCT_WGT), 3) PRDCT_WGT,
               T.ORDER_UNIT,
               T.ORD_LN_PK,
               T1.ORDER_NO,
               T.FINAL_USER_DESC,
               T.PRODUCNAME,
               T.ORDER_SPEC_DESC,
               T.MODEL_DESC,
               T.LEN_DESC,
               S.APPROVER,
               T.ORDER_QTY,
               T.LEN_UNIT,
               T.ORD_ENSU_TOTL_LEN,
               T.ORDER_ADD_DESC,
               T.ORDER_SPECIAL_DESC,
               (SELECT BASENAME
                  FROM COM_BASE_INFO
                 WHERE T.OUTS_STL_PIPE_FL = BASECODE
                   AND VALIDFLAG = '1') OUTS_STL_PIPE_FL,
               (SELECT BASENAME
                  FROM COM_BASE_INFO
                 WHERE T.OUTS_BILLET_FL = BASECODE
                   AND VALIDFLAG = '1') OUTS_BILLET_FL,
               DECODE(T.ASSEL_FL, '1', 'TRUE', 'FALSE') ASSEL_FL,
               T.PRDCR_DESC,
               T.PRDCR_NO,
               T.PSC,
               DECODE(T.PRODUCER_FL, '1', '有', '无') PRODUCER_FL,
               T.PSC_DESC,
               T.STD_CODE,
               T.STD_NAME,
               T.MPS_NO,
               T.MPS_FL,
               T.FINAL_USER,
           (  SELECT CASE
               WHEN INSTR(TO_CHAR(WM_CONCAT(PRDCR_STS)), 'F') > 0 THEN
               'F'
               WHEN INSTR(TO_CHAR(WM_CONCAT(PRDCR_STS)), 'L') > 0 THEN
               'L'
               WHEN INSTR(TO_CHAR(WM_CONCAT(PRDCR_STS)), 'M') > 0 AND
               INSTR(TO_CHAR(WM_CONCAT(PRDCR_STS)), 'L') <= 0 THEN
               'M'
               WHEN INSTR(TO_CHAR(WM_CONCAT(PRDCR_STS)), 'W') > 0 AND
               INSTR(TO_CHAR(WM_CONCAT(PRDCR_STS)), 'M') <= 0 THEN
               'W'
               WHEN INSTR(TO_CHAR(WM_CONCAT(PRDCR_STS)), 'S') > 0 THEN
               'S'
               END
               FROM SLM_ORDER_LINE_PRDCR A
              WHERE T.PRDCR_NO = A.PRDCR_NO) PRDCR_STS,
               TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME
          FROM SLM_ORDER_LINE T, SLM_ORDER_HEAD T1,SLM_ORDER_LINE_PRDCR S
        
         WHERE T.ORD_PK = T1.ORD_PK
         AND  T.PRDCR_NO = S.PRDCR_NO
           AND T.ORDER_LN_STATUS >= '12020202'
           AND T.ORDER_LN_STATUS !='12020203'  
           AND T.PRODUCER_FL = '1'
           AND T.PRDCR_NO IS NOT NULL
           AND T.VALIDFLAG = '1'
           AND T1.VALIDFLAG = '1'
           #TIMECON#
           AND '&'||T1.ORDER_NO LIKE '&'||'%'||'#ORDER_NO#'||'%'
           --#DATAACCESS#
           ) R

        ]]>
    </query>
    
     
    <query id="CoreOrderProducer.SelectOrderLineProdcr" desc="合同产品生产监制界面监制主表信息">
        <![CDATA[
         SELECT PRDCR_NO,
       PRDCR_DESC,
       PSC,
       PSC_DESC,
       STD_CODE,
       STD_NAME,
       MPS,
       PRDCR_FILE_PATH,
       DECODE(PRDCR_STS,
              'L',
              '监制待维护',
              'M',
              '监制已维护',
              'W',
              '监制待确认',
              'S',
              '监制已生效',
              'F',
              '监制退回') PRDCR_STS,
       FAIL_MAN,
       FINAL_USER,
       FAIL_RSN,
       MSC_PLINE,
       CODE_JG,
       CODE_BL,
       APPROVER,
       MSC_PLINE_DESC,
       PRDCR_INDEX
    FROM SLM_ORDER_LINE_PRDCR T
    WHERE T.PRDCR_NO = ?
         
        ]]>
    </query>
 

    <query id="CoreOrderProducer.SelectOrderLinePrdcrLst" desc="合同产品生产监制界面监制从表信息">
        <![CDATA[
     SELECT DECODE(T.PRDCR_PRC_FL,'1','TRUE','FALSE') XZ,ROWNUM,
		       T.PRDCR_NO,
		       T.PROCESS_CODE,
		       T.PROCESS_DESC,
		       T.PROCESS_DESC_C,
		       T.STATION_DESC,
		       T.STATION_CODE,
		       T.PRDCR_PRC_FL,
		       T.PRDCR_PRC_DESC,
		       T.PRDCR_ADVC_DAY,
		       T.PDEPT_NO,
		       T.PDEPT_NAME,
		       T.PDEPT_NO2,
		       T.PDEPT_NAME2,
		       T.PDEPT_NO3,
		       T.PDEPT_NAME3,
		       T.PHONE,
		       T.PHONE2,
		       T.PHONE3,
               T.PRDCR_MAN,
               T.PRDCR_MAN_PHONE,
               T.PRDCR_MAN2,
               T.PRDCR_MAN_PHONE2,
               T.PRDCR_MAN3,
               T.PRDCR_MAN_PHONE3,
		       T.MEMO,
		       T.PRDCR_INDEX
         FROM SLM_ORDER_LINE_PRDCR_LST T 
         WHERE T.PRDCR_NO = ? 
        ]]>
    </query>
    

    <query id="CoreOrderProducer.CoreOrderProducerPdeptBase" desc="合同产品生产监制要求监制从表信息单位绑定">
        <![CDATA[
         SELECT T.PDEPT_NO, T.PDEPT_NAME FROM SLM_BASE_PRDCR_DEPT T  
        ]]>
    </query>
    
    <query id="CoreOrderProducer.CoreOrderProducerPrcBase" desc="合同产品生产监制要求监制从表信息监制类型绑定">
        <![CDATA[
         SELECT BASECODE,BASENAME FROM COM_BASE_INFO WHERE BASECODE LIKE '1220%' AND BASECODE <> '1220'
        ]]>
    </query>
    
    <query id="CoreOrderProducer.CoreOrderProducerPhoneQuery" desc="合同产品生产监制要求监制从表信息根据单位找出电话">
        <![CDATA[
         SELECT PHONE FROM SLM_BASE_PRDCR_DEPT WHERE PDEPT_NO = ? 
        ]]>
    </query>
    
    <query id="CoreOrderProducer.UpdateOrderLinePrdcr" desc="合同产品生产监制要求监制从表信息根据单位找出电话">
        <![CDATA[
        	UPDATE SLM_ORDER_LINE_PRDCR
       SET PRDCR_DESC  = ?,
       PRDCR_FILE_PATH = ?,
       PRDCR_STS       = 'M',
       UPDATE_NAME     = ?,
       UPDATE_TIME     = SYSDATE,
       FAIL_MAN        = '',
       FAIL_RSN        = ''
       WHERE PRDCR_NO  = ?
       AND PRDCR_INDEX = ?
        	
        ]]>
    </query>


    <query id="CoreOrderProducer.UpdateOrderLinePrdcrHT" desc="合同产品生产监制要求监制从表信息根据单位找出电话">
        <![CDATA[
        	UPDATE SLM_ORDER_LINE_PRDCR
       SET PRDCR_DESC  = ?,
       PRDCR_FILE_PATH = ?,
       PRDCR_STS       = 'M',
       UPDATE_NAME     = ?,
       UPDATE_TIME     = SYSDATE,
       FAIL_MAN        = '',
       FAIL_RSN        = ''
       WHERE PRDCR_NO LIKE ? || '%'

        ]]>
    </query>
    
    <query id="CoreOrderProducer.UpdateOrderLinePrdcrLst" desc="更新监制主表信息">
        <![CDATA[
	          UPDATE SLM_ORDER_LINE_PRDCR_LST T
   SET T.PRDCR_PRC_FL     = ?,
       T.PRDCR_PRC_DESC   = ?,
       T.PRDCR_ADVC_DAY   = ?,
       T.PDEPT_NO         = ?,
       T.PDEPT_NAME       = ?,
       T.PHONE            = ?,
       T.PRDCR_MAN        = ?,
       T.PRDCR_MAN_PHONE  = ?,
       T.PDEPT_NO2        = ?,
       T.PDEPT_NAME2      = ?,
       T.PHONE2           = ?,
       T.PRDCR_MAN2       = ?,
       T.PRDCR_MAN_PHONE2 = ?,
       T.PDEPT_NO3        = ?,
       T.PDEPT_NAME3      = ?,
       T.PHONE3           = ?,
       T.PRDCR_MAN3       = ?,
       T.PRDCR_MAN_PHONE3 = ?,
       T.MEMO             = ?
       
   WHERE T.PRDCR_NO = ?
   AND T.PRDCR_INDEX = ?
   AND T.STATION_CODE = ?

        ]]>
    </query>

    <query id="CoreOrderProducer.UpdateOrderLinePrdcrLstHT" desc="更新监制主表信息">
        <![CDATA[
	          UPDATE SLM_ORDER_LINE_PRDCR_LST T
   SET T.PRDCR_PRC_FL     = ?,
       T.PRDCR_PRC_DESC   = ?,
       T.PRDCR_ADVC_DAY   = ?,
       T.PDEPT_NO         = ?,
       T.PDEPT_NAME       = ?,
       T.PHONE            = ?,
       T.PRDCR_MAN        = ?,
       T.PRDCR_MAN_PHONE  = ?,
       T.PDEPT_NO2        = ?,
       T.PDEPT_NAME2      = ?,
       T.PHONE2           = ?,
       T.PRDCR_MAN2       = ?,
       T.PRDCR_MAN_PHONE2 = ?,
       T.PDEPT_NO3        = ?,
       T.PDEPT_NAME3      = ?,
       T.PHONE3           = ?,
       T.PRDCR_MAN3       = ?,
       T.PRDCR_MAN_PHONE3 = ?,
       T.MEMO             = ?

   WHERE T.PRDCR_NO LIKE ? || '%'

        ]]>
    </query>
    
   <query id="CoreOrderProducer.ClearOrderLinePrdcrLst" desc="更新监制主表信息">
        <![CDATA[
	          UPDATE SLM_ORDER_LINE_PRDCR_LST T
   SET T.PRDCR_PRC_FL     = '0',
       T.PRDCR_PRC_DESC   = '',
       T.PRDCR_ADVC_DAY   = '',
       T.PDEPT_NO         = '',
       T.PDEPT_NAME       = '',
       T.PHONE            = '',
       T.PRDCR_MAN        = '',
       T.PRDCR_MAN_PHONE  = '',
       T.PDEPT_NO2        = '',
       T.PDEPT_NAME2      = '',
       T.PHONE2           = '',
       T.PRDCR_MAN2       = '',
       T.PRDCR_MAN_PHONE2 = '',
       T.PDEPT_NO3        = '',
       T.PDEPT_NAME3      = '',
       T.PHONE3           = '',
       T.PRDCR_MAN3       = '',
       T.PRDCR_MAN_PHONE3 = '',
       T.MEMO             = ''
      
   WHERE T.PRDCR_NO = ?
   AND T.PRDCR_INDEX = ?
   AND T.STATION_CODE = ?

        ]]>
    </query>
    
    
    
    <query id="CoreOrderProducer.CoreOrderProducerDeleteHead" desc="合同产品生产监制主表删除">
        <![CDATA[
                 DELETE SLM_ORDER_LINE_PRDCR t
                 where t.PRDCR_NO = ? 
        ]]>
    </query>
    
     <query id="CoreOrderProducer.CoreOrderProducerDeptProFe" desc="合同产品生产监制要求监制审批提报功能">
        <![CDATA[
           UPDATE SLM_ORDER_LINE_PRDCR
             SET PRDCR_STS = 'W'
            WHERE  PRDCR_NO = ?
             
        ]]>
    </query>
    
    <query id="CoreOrderProducer.CoreOrderProducerDeptProBa" desc="合同产品生产监制要求监制审批退回功能">
        <![CDATA[
             UPDATE SLM_ORDER_LINE_PRDCR
              SET PRDCR_STS = 'F',FAIL_MAN= ?,FAIL_RSN=?
            WHERE  PRDCR_INDEX = ? AND PRDCR_NO = ? 
				 
        ]]>
    </query>
    
    <query id="CoreOrderProducer.CoreOrderProducerDeptProsu" desc="合同产品生产监制要求监制审批通过功能">
        <![CDATA[
           UPDATE SLM_ORDER_LINE_PRDCR
              SET PRDCR_STS = 'S',
              APPROVER= ?
            WHERE  PRDCR_NO = ?
				 
        ]]>
    </query>
    
    <query id="CoreOrderProducer.CoreOrderProducerOrderPrdcrLine" desc="合同产品生产监制要求监制修改">
        <![CDATA[
                  UPDATE SLM_ORDER_LINE_PRDCR SET PRDCR_FILE_PATH = ?,PRDCR_DESC = ? ,PRDCR_STS = 'M'
                  WHERE PRDCR_NO = ? AND MSC_PLINE = ?
        ]]>
    </query>
    
     <query id="CoreOrderProducer.GetPrdCrDesc" desc="合同产品生产监制要求监制修改">
        <![CDATA[
              SELECT BASECODE,BASENAME FROM COM_BASE_INFO 
              WHERE VALIDFLAG = '1' AND SORTCODE = '1222'
        ]]>
    </query>
    
    <query id="CoreOrderProducer.GetPrdcrStatus" desc="获取监制状态">
        <![CDATA[
              SELECT PRDCR_STS
         FROM SLM_ORDER_LINE_PRDCR T
         WHERE T.PRDCR_NO = ? AND T.PRDCR_INDEX = ?
              
        ]]>
    </query>
    
    <query id="CoreOrderProducer.GetPrdcrAllStatus" desc="获取监制状态">
        <![CDATA[
              SELECT PRDCR_STS
         FROM SLM_ORDER_LINE_PRDCR T
         WHERE T.PRDCR_NO = ?  
              
        ]]>
    </query>
    
    <query id="CoreOrderProducer.GetOrderStatus" desc="获取监制状态">
        <![CDATA[
              SELECT ORDER_STS
           FROM SLM_ORDER_HEAD
          WHERE  ORDER_NO = ?
          AND VALIDFLAG = '1'
              
        ]]>
    </query>
    
     
    <query id="CoreOrderProducer.GetDeptPerson" desc="获取监制状态">
        <![CDATA[
           SELECT NAME_,PHONE FROM SLM_BASE_PRDCR_DEPT_MAN 
           WHERE PDEPT_NO = ?
        ]]>
    </query>
    
     <query id="CoreOrderProducer.getPrdcrStationCode" desc="获取监制状态">
        <![CDATA[
            SELECT STATION_CODE  FROM COM_BASE_PRDCR_R_STATION 
            WHERE BASECODE = ?
        ]]>
    </query>
    
     <query id="CoreOrderProducer.IsExistPrdcrNo" desc="获取监制状态">
        <![CDATA[
             SELECT PRDCR_NO FROM SLM_ORDER_LINE_PRDCR T
             WHERE INSTR(?,T.PRDCR_NO)>0 AND T.MSC_PLINE = ?
             AND T.VALIDFLAG = '1'
        ]]>
    </query>
    
     <query id="CoreOrderProducer.SelectPrdCrNoArr" desc="获取监制状态">
        <![CDATA[
             SELECT PRDCR_NO FROM SLM_ORDER_LINE T
             WHERE T.ORD_LN_PK = ?
             AND T.VALIDFLAG = '1'
        ]]>
    </query>
    
    
    </queryMap>