<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="墩拔扩管理">

	<query id="IRollUpsetDao.getRollSpec" desc="查询轧管规格">
         <![CDATA[
        SELECT PLINE_CODE,
               PLINE_NAME,
               INDEX_SEQ,
               GRADECODE,
               GRADENAME,
               MIN_D,
               MIN_H,
               MAX_D,
               MAX_H
          FROM COM_MSC_ROLL_R_UPSET A
         WHERE A.PLINE_CODE = ?
           AND A.GRADECODE = ?
           AND TO_NUMBER(A.MAX_D) = TO_NUMBER(?)
           AND TO_NUMBER(A.MAX_H) = TO_NUMBER(?)
           AND A.VALIDFLAG = 1
         ]]>
	</query>

	<query id="IRollUpsetDao.savePipeRoll" desc="保存轧管规格">
         <![CDATA[
       INSERT INTO SLM_ORD_DESIGN_MSC_GZ_GG
  (DESGIN_KEY,
   MSC_PLINE,
   GRADECODE,
   GRADENAME,
   SPEC_CODE,
   SPEC_NAME,
   DIMATER,
   HEIGHT)
VALUES
  (?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?)
         ]]>
	</query>

	<query id="IRollUpsetDao.getBaseProLine" desc="查询基础产线">
         <![CDATA[
     SELECT PLINE_CODE,
       PLINE_NAME,
       DEPARTMENT_CODE,
       DEPARTMENT_DESC,
       PROCESS_CODE,
       PROCESS_DESC,
       PLINE_CODE_OLD,
       LENGTH_MIN,
       LENGTH_MAX,
       LENGTH_COLDBED,
       LENGTH_MAX_RING,
       LENGTH_MIN_RING,
       LENGTH_MIN_TUBE,
       LENGTH_MAX_TUBE
  FROM COM_BASE_PLINE T
 WHERE T.PROCESS_CODE = ?
   AND T.VALIDFLAG = 1
         ]]>
	</query>

	<query id="IRollUpsetDao.getrollRUpsetProLine" desc="查询墩拔扩产线">
         <![CDATA[
SELECT PLINE_CODE,
       PLINE_NAME,
       PASS_CODE,
       PASS_NAME,
       MODEL_CODE,
       MODEL_DESC,
       INDEX_SEQ,
       MIN_D,
       MAX_D,
       MIN_H,
       MAX_H,
       SPEC_JG,
       SPEC_JG_DESC,
       WELL_CODE,
       WELL_NAME,
       SPEC_CODE,
       SPEC_NAME,
       PROCESS_STYLE,
       PROCESS_CDOE_C,
       PROCESS_DESC_C,
       MODEL_STYLE
  FROM COM_MSC_PLINE_R_SPEC T
 WHERE T.PLINE_CODE in
       (SELECT Q.PLINE_CODE FROM COM_BASE_PLINE Q WHERE Q.PROCESS_CODE = ? AND Q.VALIDFLAG=1)
   AND TO_NUMBER(T.MIN_D) <= TO_NUMBER(?)
   AND TO_NUMBER(T.MAX_D) >= TO_NUMBER(?)
   AND TO_NUMBER(T.MIN_H) <= TO_NUMBER(?)
   AND TO_NUMBER(T.MAX_H) >= TO_NUMBER(?)
   AND T.VALIDFLAG = 1
   AND INSTR(T.Process_Cdoe_c, ?) > 0
         ]]>
	</query>

	<query id="IRollUpsetDao.getBiltProLine" desc="查询铸造产线">
         <![CDATA[
SELECT PLINE_CODE,
       PLINE_NAME,
       PASS_CODE,
       PASS_NAME,
       MODEL_CODE,
       MODEL_DESC,
       INDEX_SEQ,
       MIN_D,
       MAX_D,
       MIN_H,
       MAX_H,
       SPEC_JG,
       SPEC_JG_DESC,
       WELL_CODE,
       WELL_NAME,
       SPEC_CODE,
       SPEC_NAME,
       PROCESS_STYLE,
       PROCESS_CDOE_C,
       PROCESS_DESC_C,
       MODEL_STYLE
  FROM COM_MSC_PLINE_R_SPEC T
 WHERE T.PLINE_CODE IN (SELECT Q.PLINE_CODE
                          FROM COM_BASE_PLINE Q
                         WHERE Q.PROCESS_CODE = ?
                           AND Q.VALIDFLAG = 1)
   AND T.Spec_Code = ?
   AND T.VALIDFLAG = 1
         ]]>
	</query>
	
		<query id="IRollUpsetDao.getBiltCProLine" desc="查询锻造产线">
         <![CDATA[
SELECT PLINE_CODE,
       PLINE_NAME,
       PASS_CODE,
       PASS_NAME,
       MODEL_CODE,
       MODEL_DESC,
       INDEX_SEQ,
       MIN_D,
       MAX_D,
       MIN_H,
       MAX_H,
       SPEC_JG,
       SPEC_JG_DESC,
       WELL_CODE,
       WELL_NAME,
       SPEC_CODE,
       SPEC_NAME,
       PROCESS_STYLE,
       PROCESS_CDOE_C,
       PROCESS_DESC_C,
       MODEL_STYLE
  FROM COM_MSC_PLINE_R_SPEC T
 WHERE T.PLINE_CODE IN (SELECT Q.PLINE_CODE
                          FROM COM_BASE_PLINE Q
                         WHERE Q.PROCESS_CODE = ?
                           AND Q.VALIDFLAG = 1)
   AND T.Spec_Code = ?
   AND T.VALIDFLAG = 1
   AND INSTR(T.Process_Cdoe_c, ?) > 0
         ]]>
	</query>

	<query id="IRollUpsetDao.getSection" desc="查询轧管断面">
         <![CDATA[
  SELECT DISTINCT SPEC_CODE, SPEC_NAME
  FROM COM_MSC_PLINE_R_SPEC T
 WHERE T.PLINE_CODE IN
       (SELECT Q.PLINE_CODE FROM COM_BASE_PLINE Q WHERE Q.PROCESS_CODE = 'D')
   AND TO_NUMBER(T.MIN_D) <= TO_NUMBER(?)
   AND TO_NUMBER(T.MAX_D) >= TO_NUMBER(?)
   AND TO_NUMBER(T.MIN_H) <= TO_NUMBER(?)
   AND TO_NUMBER(T.MAX_H) >= TO_NUMBER(?)
   AND T.VALIDFLAG = 1
         ]]>
	</query>

	<query id="IRollUpsetDao.saveBlankSection" desc="保存轧管坯料断面">
         <![CDATA[
       INSERT INTO SLM_ORD_DESIGN_MSC_BILT
  (DESGIN_KEY, MSC_PLINE, SPEC_CODE, B_SPEC_CODE, B_SPEC_NAME)
VALUES
  (?, ?, ?, ?, ?)
         ]]>
	</query>

	<query id="IRollUpsetDao.saveBiltCSpec" desc="保存轧管坯料规格">
         <![CDATA[
        INSERT INTO SLM_ORD_DESIGN_MSC_BILT_C
  (DESGIN_KEY, MSC_PLINE, SPEC_CODE, B_SPEC_CODE, C_SPEC_CODE, C_SPEC_NAME,SPEC_CODE_S)
VALUES
  (?, ?, ?, ?, ?, ?, ?)
         ]]>
	</query>





	<query id="IRollUpsetDao.getStockSpecificA" desc="查询坯料连铸坯规格">
         <![CDATA[
    SELECT ID_,
       SPEC_CODE_FORG,
       SPEC_NAME_FORG,
       SPEC_CODE_INGOT,
       SPEC_NAME_INGOT,
       SPEC_CODE,
       SPEC_NAME
  FROM COM_MSC_CAST_R_FORG A
 WHERE A.SPEC_CODE_FORG = ?
   and TRIM(a.SPEC_CODE_INGOT) IS NULL
   AND A.VALIDFLAG = 1
         ]]>
	</query>

	<query id="IRollUpsetDao.getStockSpecificB" desc="查询坯料钢锭规格">
         <![CDATA[
      SELECT ID_,
       SPEC_CODE_FORG,
       SPEC_NAME_FORG,
       SPEC_CODE_INGOT,
       SPEC_NAME_INGOT,
       SPEC_CODE,
       SPEC_NAME
  FROM COM_MSC_CAST_R_FORG A
 WHERE A.SPEC_CODE_FORG = ?
   AND TRIM(A.SPEC_CODE) IS NULL
   AND A.VALIDFLAG = 1
         ]]>
	</query>



	<query id="IRollUpsetDao.getBaseSpec" desc="查询基础规格">
         <![CDATA[
   SELECT SPEC_CODE, SPEC_NAME, DIMATER, HEIGHT, WEIGHT, MSC_STYLE
  FROM COM_BASE_SPEC T
 WHERE T.SPEC_CODE = ?
   AND T.VALIDFLAG = 1
         ]]>
	</query>

	<query id="IRollUpsetDao.getBaseSpecCode" desc="查询基础规格根据外径、壁厚">
         <![CDATA[
   SELECT SPEC_CODE, SPEC_NAME, DIMATER, HEIGHT, WEIGHT, MSC_STYLE
  FROM COM_BASE_SPEC T
  WHERE TO_NUMBER(T.DIMATER) = TO_NUMBER(?)
    AND TO_NUMBER(T.HEIGHT) = TO_NUMBER(?)
    AND T.MSC_STYLE='A'
    AND T.VALIDFLAG = 1
         ]]>
	</query>

	<query id="IRollUpsetDao.saveProLine" desc="保存产线">
         <![CDATA[
    INSERT INTO SLM_ORD_DESIGN_MSC_PL_GX_PRL(
        DESGIN_KEY,
        MSC_PLINE,
        BACKLOG_SEQ,
        PROCESS_CODE,
        PLINE_CODE,
        PLINE_NAME,
        WELL_CODE,
        WELL_NAME,
        WARN_FL,
        WARN_DESC)
 VALUES( 
        '#DESGIN_KEY#',
        '#MSC_PLINE#',
        '#BACKLOG_SEQ#',
        '#PROCESS_CODE#',
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#WELL_CODE#',
        '#WELL_NAME#',
        '#WARN_FL#',
        '#WARN_DESC#')
         ]]>
	</query>

	<query id="IRollUpsetDao.getStationRPline" desc="查询产线与工序点对应关系">
         <![CDATA[
        SELECT PLINE_CODE, PLINE_NAME, STATION_CODE, STATION_DESC, STATION_ID
          FROM COM_MSC_STATION_R_PLINE T
         WHERE T.PLINE_CODE = ? AND T.VALIDFLAG = 1
         ]]>
	</query>

	<query id="IRollUpsetDao.saveInnerStd" desc="新增內控标准">
         <![CDATA[
     INSERT INTO SLM_ORD_DESIGN_MSC_PL_PRC(
        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)
 VALUES( 
        '#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#')
         ]]>
	</query>

	<query id="IRollUpsetDao.getJGProlineA" desc="查询接箍适用产线">
         <![CDATA[
SELECT PLINE_CODE,
       PLINE_NAME,
       PASS_CODE,
       PASS_NAME,
       MODEL_CODE,
       MODEL_DESC,
       INDEX_SEQ,
       MIN_D,
       MAX_D,
       MIN_H,
       MAX_H,
       SPEC_JG,
       SPEC_JG_DESC,
       WELL_CODE,
       WELL_NAME,
       SPEC_CODE,
       SPEC_NAME,
       PROCESS_STYLE,
       PROCESS_CDOE_C,
       PROCESS_DESC_C,
       MODEL_STYLE
  FROM COM_MSC_PLINE_R_SPEC T
 WHERE T.PLINE_CODE IN (SELECT Q.PLINE_CODE
                          FROM COM_BASE_PLINE Q
                         WHERE Q.PROCESS_CODE = ?
                           AND Q.VALIDFLAG = 1)
   AND INSTR(T.MODEL_CODE, ?) > 0
   AND TO_NUMBER(T.MIN_D) <= TO_NUMBER(?)
   AND TO_NUMBER(T.MAX_D) >= TO_NUMBER(?)
   AND TO_NUMBER(T.MIN_H) <= TO_NUMBER(?)
   AND TO_NUMBER(T.MAX_H) >= TO_NUMBER(?)
   AND T.VALIDFLAG = 1
         ]]>
	</query>
	
	<query id="IRollUpsetDao.getJGProlineB" desc="查询接箍适用产线">
         <![CDATA[
SELECT PLINE_CODE,
       PLINE_NAME,
       PASS_CODE,
       PASS_NAME,
       MODEL_CODE,
       MODEL_DESC,
       INDEX_SEQ,
       MIN_D,
       MAX_D,
       MIN_H,
       MAX_H,
       SPEC_JG,
       SPEC_JG_DESC,
       WELL_CODE,
       WELL_NAME,
       SPEC_CODE,
       SPEC_NAME,
       PROCESS_STYLE,
       PROCESS_CDOE_C,
       PROCESS_DESC_C,
       MODEL_STYLE
  FROM COM_MSC_PLINE_R_SPEC T
 WHERE T.PLINE_CODE IN (SELECT Q.PLINE_CODE
                          FROM COM_BASE_PLINE Q
                         WHERE Q.PROCESS_CODE = ?
                           AND Q.VALIDFLAG = 1)
   AND INSTR(T.MODEL_CODE, ?) > 0
   AND T.VALIDFLAG = 1
         ]]>
	</query>

	<query id="IRollUpsetDao.getHeatProline" desc="查询热处理适用产线">
         <![CDATA[
     SELECT PLINE_CODE,
       PLINE_NAME,
       PASS_CODE,
       PASS_NAME,
       MODEL_CODE,
       MODEL_DESC,
       INDEX_SEQ,
       MIN_D,
       MAX_D,
       MIN_H,
       MAX_H,
       SPEC_JG,
       SPEC_JG_DESC,
       WELL_CODE,
       WELL_NAME,
       SPEC_CODE,
       SPEC_NAME,
       PROCESS_STYLE,
       PROCESS_CDOE_C,
       PROCESS_DESC_C,
       MODEL_STYLE
  FROM COM_MSC_PLINE_R_SPEC T
 WHERE T.PLINE_CODE IN (SELECT Q.PLINE_CODE
                          FROM COM_BASE_PLINE Q
                         WHERE Q.PROCESS_CODE = 'F'
                           AND Q.VALIDFLAG = 1)
   AND INSTR(T.Process_Cdoe_c, ?) > 0
   AND TO_NUMBER(T.MIN_D) <= TO_NUMBER(?)
   AND TO_NUMBER(T.MAX_D) >= TO_NUMBER(?)
   AND TO_NUMBER(T.MIN_H) <= TO_NUMBER(?)
   AND TO_NUMBER(T.MAX_H) >= TO_NUMBER(?)
   AND T.VALIDFLAG = 1
         ]]>
	</query>


</queryMap>