<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc = "手工入库">
<query id = "FrmPipeEnter.queryEnterInList" desc = "查询手动入库数据">
<![CDATA[
 SELECT 
       t.INSTOCK_DOC,
       t.JUDGE_STOVE_NO,
       t.BATCH_NO,
       t.BATCH_GROUD_NO,
       t.PRODUCCODE,
       t.PRODUCNAME,
       t.STD_CODE,
       t.STD_NAME,
       t.STEELCODE,
       t.STEELNAME,
       t.STD_STYLE,
       t.STD_STYLE_DESC,
       t.SPEC_CODE,
       t.SPEC_NAME,
       t.MODEL_CODE,
       t.MODEL_DESC,
       t.ACT_DIMATER,
       t.ACT_HEIGHT,
       to_char(t.ACT_LEN_MIN,'FM999990.00') AS ACT_LEN_MIN,
       to_char(t.ACT_LEN_MAX,'FM999990.00') AS ACT_LEN_MAX,
       to_char(t.ACT_LEN_MIN,'FM999990.00')||'-'||to_char(t.ACT_LEN_MAX,'FM999990.00') as LEN,
       sum(t.ACT_COUNT) as ACT_COUNT,
       to_char(sum(t.ACT_WEIGHT),'FM999999990.000') as ACT_WEIGHT,
       sum(nvl(t.ACT_LEN,0)) as ACT_LEN,
       t.BELONG_CODE,
       t.BELONG_NAME,
       s.STORAGE_NAME,
       t.PIPMEMO,
       t.CREATE_NAME,
       max(to_char(t.INSTOCK_TIME,'YYYY-MM-DD HH24:MI:SS')) as INSTOCK_TIME,
       max(to_char(t.IN_TIME_F,'YYYY-MM-DD HH24:MI:SS')) AS IN_TIME_F,
       to_char(to_date(t.BAL_YEAR_MONTH,'YYYY-MM'),'yyyy-MM') as BAL_YEAR_MONTH,
       t.ORDER_NO,
     t.ORDER_SEQ,
     t.DELIVERY_NO,
     t.JUDGE_STD_CODE,
     t.JUDGE_STD_NAME,
     t.PLINE_CODE,
     t.PLINE_NAME,
     t.GRADECODE,
     t.GRADENAME,
     t.SUPPLY_UNIT_CODE,
     DECODE(t.PRODUCT_FLAG,'801401','在制品','801402','成品','801403','商品')PRODUCT_FLAG,
     t.ZB_RCDID,
     t.ORD_LN_PK,
     d.SALE_AREA_DESC,
       d.create_name AS ordercreatename
 FROM YDM_ZC_INLIST t
  left join  ydm_bs_storage s
  on t.STORAGE_NO = s.STORAGE_NO
  left join  SLM_ORDER_HEAD d on 
   t.ord_pk = d.ord_pk
 where t.INSTOCK_TYPE_CODE ='800701'
   AND t.HAND_FLAG = '1'
   AND t.JUDGE_STOVE_NO || '&' LIKE ('%' || upper(?) || '%')
   AND t.STORAGE_NO || '&' LIKE ('%' || upper(?) || '%')
   ]]>      
</query>
<query id = "FrmPipeEnter.getGrade" desc = "获取钢种">
SELECT T.GRADECODE,T.GRADENAME FROM COM_BASE_GRADE T WHERE T.VALIDFLAG = '1'
</query>
<query id = "FrmPipeEnter.getSpec" desc = "获取规格">
SELECT T.SPEC_CODE,T.SPEC_NAME FROM COM_BASE_SPEC T WHERE T.VALIDFLAG = '1'
</query>
<query id = "FrmPipeEnter.getModel" desc= "获取扣型">
SELECT T.MODEL_CODE,T.MODEL_DESC FROM COM_BASE_MODEL T WHERE T.VALIDFLAG = '1'
</query>
<query id = "FrmPipeEnter.getDimHeig" desc = "外径壁厚">
SELECT T.DIMATER,T.HEIGHT FROM COM_BASE_SPEC T WHERE T.VALIDFLAG = '1' AND T.SPEC_CODE = ?
</query>
<query id = "FrmPipeEnter.getOrderPk" desc = "查询合同号是否存在">
<![CDATA[
SELECT T2.SALE_ORG,
       T2.SALE_ORG_DESC,
       T1.STD_CODE,
       T1.STD_NAME,
       T1.LEN_NO,
       T1.LEN_DESC,
       T1.LEN_UNIT,
       T2.ORDER_NO,
       T1.ORDER_SEQ,
       T3.DELIVERY_NO,
        T2.ORD_PK,      
        T1.ORD_LN_PK,
        T3.ORD_LN_DLY_PK
  FROM SLM_ORDER_LINE T1
  LEFT JOIN SLM_ORDER_HEAD T2
    ON T1.ORD_PK = T2.ORD_PK
  LEFT JOIN SLM_ORDER_LINE_DELIVERY T3
    ON T1.ORD_LN_PK = T3.ORD_LN_PK
  LEFT JOIN SLM_BASE_SALE_AREA_TYP A ON A.DEPARTID=T2.CREATE_DEPT
 WHERE T1.VALIDFLAG = '1'
 --AND ((A.VALIDFLAG = '1' AND T2.CREATE_DEPT IS NOT NULL) OR (T2.CREATE_DEPT IS NULL AND T2.Create_Name is NULL))
 AND T2.VALIDFLAG = '1'
 AND T3.VALIDFLAG = '1'
   AND  upper(T2.ORDER_NO) = upper(?) 
   AND lpad(T1.ORDER_SEQ,4,'0') = lpad(nvl(trim(?),'999'),4,'0')
   AND lpad(T3.DELIVERY_NO,4,'0') = lpad(nvl(trim(?),'999'),4,'0')
   ]]>
</query>
<query id = "FrmPipeEnter.insertMat" desc = "插入材料表">
<![CDATA[
	   INSERT INTO MAT_ZC_M
     (
     JUDGE_STOVE_NO,
     BATCH_NO,
     BATCH_GROUD_NO,
     PRODUCCODE,
     PRODUCNAME,
     STEELCODE,
     STEELNAME,
     SPEC_CODE,
     SPEC_NAME,
     MODEL_CODE,
     MODEL_DESC,
     STD_CODE,
     STD_NAME,
     BELONG_CODE,
     BELONG_NAME,
     STD_STYLE,
     STD_STYLE_DESC,
     ORDER_NO,
     ORDER_SEQ,
     ORDER_SEQ_NO,
     ORD_PK,
     ORD_LN_PK,
     ORD_LN_DLY_PK,
     ACT_DIMATER,
     ACT_HEIGHT,
     LEN_NO,
     LEN_DESC,
     LEN_UNIT,
     ACT_LEN_MIN,
     ACT_LEN_MAX,
     CREATE_NAME,
 	 
     ACT_COUNT,		 
     ACT_WEIGHT,
     CREATE_TIME, 
     INSTOCK_TIME,  
     MAT_NO,
     MEMO,
     JUGDE_APPLY_FLAG,
     INSTOCK_FLAG,
     PRODUCT_FLAG,
     MAT_STATUS,
     ACT_LEN,
     JUDGE_STD_NAME,
     BAL_YEAR_MONTH,
     PLINE_CODE,
     PLINE_NAME,
     GRADECODE,
     GRADENAME,
     PIPMEMO,
     MAT_ORIGIN_CODE,
     MAT_ORIGIN_NAME,
     SOURE_CODE,
     SOURE_NAME,
     MATERIAL_NO,
     MATERIAL_NAME,
     PACK_NO,
     IN_MOLD,
     JUDGE_RESULT_CODE,
     JUDGE_RESULT,
     ZBS_FLAG,
     SUPPLY_UNIT_CODE,
     SUPPLY_UNIT,
     FLAG_STOVE_NO_ZG,
     IS_DEALER,
     PROCESS_CDOE,
     PROCESS_DESC,IN_TYPE
     ) VALUES  (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,
             ?,?,?,?,?,?,?,?,?,?,?,?,
             TO_NUMBER(?),ROUND(TO_NUMBER(?),4),TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'),TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'),
             ?,?,'1','1',?,?,TO_NUMBER(?),?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,'40740701','合格','2',?,?,?,?,?,?,'802205')
		]]>
</query>
<query id = "FrmPipeEnter.insertButress" desc = "插入位置表">
<![CDATA[
       INSERT INTO YDM_ZC_BUTTRESS
    (
     JUDGE_STOVE_NO,
     BATCH_NO,
     BATCH_GROUD_NO,
     STORAGE_NO,
     LOCATION_NO,
     STORAGE_TYPE_NO,
     STORAGE_TYPE_NAME,
     
     CREATE_NAME,
     MAT_NO,
     CREATE_TIME,
     MANAGEMENT_NO,
     MANAGEMENT_NAME,
     DEPARTMENT_CODE,
     DEPARTMENT_DESC
     )
    VALUES ( ?,?,?,?,?,?,?,?,?,to_date(?,'YYYY-MM-DD HH24:MI:SS'),?,?,?,?)
		]]>
</query>
<query id = "FrmPipeEnter.insertInList" desc = "插入入库表">
INSERT INTO YDM_ZC_INLIST
  (MANAGEMENT_NO,
   MANAGEMENT_NAME,
   INSTOCK_SQE,
   INSTOCK_DOC,
   INSTOCK_TYPE_CODE,
   INSTOCK_TYPE_NAME,
   MAT_NO,
   LOT_NO,
   STOVE_NO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   BATCH_GROUD_NO,
   
   PRODUCCODE,
   PRODUCNAME,
   STD_CODE,
   STD_NAME,
   
   STEELCODE,
   STEELNAME,
   STD_STYLE,
   STD_STYLE_DESC,
   SPEC_CODE,
   SPEC_NAME,
   MODEL_CODE,
   MODEL_DESC,
   ACT_DIMATER,
   ACT_HEIGHT,
   ACT_LEN_MIN,
   ACT_LEN_MAX,
   ACT_COUNT,
   ACT_WEIGHT,
   ACT_THEORY_WEIGHT,
   BELONG_CODE,
   BELONG_NAME,
   STORAGE_NO,
   
   MEMO,
   VALIDFLAG,
   CREATE_NAME,
   CREATE_TIME,
   ORDER_NO,
     ORDER_SEQ,
     DELIVERY_NO,
     ORD_PK,
     ORD_LN_PK,
     ORD_LN_DLY_PK,
     PRODUCT_FLAG,
     MAT_STATUS,
     INSTOCK_TIME,ZB_RCDID,ACT_LEN,DEPARTMENT_CODE,DEPARTMENT_DESC,JUDGE_STD_NAME,PLINE_CODE,PLINE_NAME,GRADECODE,GRADENAME,BAL_YEAR_MONTH,IN_TIME_F,LEN_NO,LEN_DESC,LEN_UNIT,PIPMEMO,HAND_FLAG,MAT_ORIGIN_CODE,MAT_ORIGIN_NAME,SOURE_CODE,SOURE_NAME,MATERIAL_NO,
    MATERIAL_NAME,IN_MOLD,SUPPLY_UNIT_CODE,SUPPLY_UNIT,IS_DEALER,PROCESS_CDOE,PROCESS_DESC,LOCATION_NO,IN_TYPE)
VALUES
  (?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   to_date(?,'YYYY-MM-DD HH24:MI:SS'),?,?,?,?,?,?,?,?,to_date(?,'YYYY-MM-DD HH24:MI:SS'),?,?,?,?,?,?,?,?,?,?,to_date(?,'YYYY-MM-DD HH24:MI:SS'),?,?,?,?,'1',?,?,?,?,?,?,?,?,?,?,?,?,?,'802205')
</query>
    <query id = "FrmPipeEnter.insertCrmMat" desc = "插入CRM库存表">
        INSERT INTO CRM_MAT_ZC(
        MAT_NO,
        PRODUCT_FLAG,
        MAT_STATUS,
        LOT_NO,
        STOVE_NO,
        JUDGE_STOVE_NO,
        BATCH_NO,
        BATCH_GROUD_NO,
        MATERIAL_NO,
        MATERIAL_NAME,
        PRODUCCODE,
        PRODUCNAME,
        STEELCODE,
        STEELNAME,
        GRADECODE,
        GRADENAME,
        SPEC_CODE,
        SPEC_NAME,
        MODEL_CODE,
        MODEL_DESC,
        STD_CODE,
        STD_NAME,
        STD_STYLE,
        STD_STYLE_DESC,
        PRO_ORDER_NO,
        ORDER_NO,
        ORDER_SEQ,
        ORDER_SEQ_NO,
        ORD_PK,
        ORD_LN_PK,
        ORD_LN_DLY_PK,
        PLINE_CODE,
        PLINE_NAME,
        ACT_DIMATER,
        ACT_HEIGHT,
        ACT_LEN,
        ACT_LEN_MIN,
        ACT_LEN_MAX,
        ACT_COUNT,
        ACT_WEIGHT,
        BELONG_CODE,
        BELONG_NAME,
        IN_MOLD,
        INSTOCK_TIME,
        STORAGE_NO,
        LOCATION_NO,
        STORAGE_NAME,
        LOCATION_NAME,
        SUPPLY_UNIT_CODE,
        SUPPLY_UNIT,
        CREATE_TIME)
        VALUES(
        '#MAT_NO#',
        (SELECT F.BASENAME FROM COM_BASE_INFO F WHERE F.BASECODE = '#PRODUCT_FLAG#'),
        (SELECT F.BASENAME FROM COM_BASE_INFO F WHERE F.BASECODE = '#MAT_STATUS#'),
        '#LOT_NO#',
        '#STOVE_NO#',
        '#JUDGE_STOVE_NO#',
        '#BATCH_NO#',
        '#BATCH_GROUD_NO#',
        '#MATERIAL_NO#',
        '#MATERIAL_NAME#',
        '#PRODUCCODE#',
        '#PRODUCNAME#',
        '#STEELCODE#',
        '#STEELNAME#',
        '#GRADECODE#',
        '#GRADENAME#',
        '#SPEC_CODE#',
        '#SPEC_NAME#',
        '#MODEL_CODE#',
        '#MODEL_DESC#',
        '#STD_CODE#',
        '#STD_NAME#',
        '#STD_STYLE#',
        '#STD_STYLE_DESC#',
        '#PRO_ORDER_NO#',
        '#ORDER_NO#',
        '#ORDER_SEQ#',
        '#ORDER_SEQ_NO#',
        '#ORD_PK#',
        '#ORD_LN_PK#',
        '#ORD_LN_DLY_PK#',
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#ACT_DIMATER#',
        '#ACT_HEIGHT#',
        '#ACT_LEN#',
        '#ACT_LEN_MIN#',
        '#ACT_LEN_MAX#',
        '#ACT_COUNT#',
        '#ACT_WEIGHT#',
        '#BELONG_CODE#',
        '#BELONG_NAME#',
        (SELECT F.BASENAME FROM COM_BASE_INFO F WHERE F.BASECODE = '#IN_MOLD#'),
        TO_DATE('#CREATE_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
        '#STORAGE_NO#',
        '#LOCATION_NO#',
        (SELECT S1.STORAGE_NAME FROM YDM_BS_STORAGE S1 WHERE S1.STORAGE_NO = '#STORAGE_NO#'),
        (SELECT S2.LOCATION_NAME FROM YDM_BS_LOCATION S2 WHERE S2.LOCATION_NO = '#LOCATION_NO#'),
        '#SUPPLY_UNIT_CODE#',
        '#SUPPLY_UNIT#',
        TO_DATE('#CREATE_TIME#', 'YYYY-MM-DD HH24:MI:SS'))
    </query>
    <query id = "FrmPipeEnter.insertCrmInList" desc = "插入CRM入库表">
        INSERT INTO CRM_ZC_INLIST(
        STORAGE_NAME,
        MAT_NO,
        INSTOCK_SQE,
        INSTOCK_DOC,
        ORDER_NO,
        ORDER_SEQ,
        DELIVERY_NO,
        ORD_PK,
        ORD_LN_PK,
        ORD_LN_DLY_PK,
        PRODUCT_FLAG,
        JUDGE_STOVE_NO,
        BATCH_NO,
        BATCH_GROUD_NO,
        MATERIAL_NO,
        MATERIAL_NAME,
        PRODUCCODE,
        PRODUCNAME,
        STD_CODE,
        STD_NAME,
        GRADECODE,
        GRADENAME,
        STEELCODE,
        STEELNAME,
        STD_STYLE,
        STD_STYLE_DESC,
        SPEC_CODE,
        SPEC_NAME,
        MODEL_CODE,
        MODEL_DESC,
        PLINE_CODE,
        PLINE_NAME,
        ACT_LEN,
        ACT_LEN_MIN,
        ACT_LEN_MAX,
        ACT_COUNT,
        ACT_WEIGHT,
        STORAGE_NO,
        IN_MOLD,
        PACK_NO,
        INSTOCK_TIME,
        CREATE_TIME,
        SUPPLY_UNIT_CODE,
        SUPPLY_UNIT,
        BAL_YEAR_MONTH,
        ACT_DIMATER,
        ACT_HEIGHT,
        BELONG_CODE,
        BELONG_NAME,
        INSTOCK_TYPE_CODE,
        INSTOCK_TYPE_NAME
        )
        VALUES(
        (SELECT S1.STORAGE_NAME FROM YDM_BS_STORAGE S1 WHERE S1.STORAGE_NO = '#STORAGE_NO#'),
        '#MAT_NO#',
        '#INSTOCK_SQE#',
        '#INSTOCK_DOC#',
        '#ORDER_NO#',
        '#ORDER_SEQ#',
        '#ORDER_SEQ_NO#',
        '#ORD_PK#',
        '#ORD_LN_PK#',
        '#ORD_LN_DLY_PK#',
        (SELECT F.BASENAME FROM COM_BASE_INFO F WHERE F.BASECODE = '#PRODUCT_FLAG#'),
        '#JUDGE_STOVE_NO#',
        '#BATCH_NO#',
        '#BATCH_GROUD_NO#',
        '#MATERIAL_NO#',
        '#MATERIAL_NAME#',
        '#PRODUCCODE#',
        '#PRODUCNAME#',
        '#STD_CODE#',
        '#STD_NAME#',
        '#GRADECODE#',
        '#GRADENAME#',
        '#STEELCODE#',
        '#STEELNAME#',
        '#STD_STYLE#',
        '#STD_STYLE_DESC#',
        '#SPEC_CODE#',
        '#SPEC_NAME#',
        '#MODEL_CODE#',
        '#MODEL_DESC#',
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#ACT_LEN#',
        '#ACT_LEN_MIN#',
        '#ACT_LEN_MAX#',
        '#ACT_COUNT#',
        '#ACT_WEIGHT#',
        '#STORAGE_NO#',
        (SELECT F.BASENAME FROM COM_BASE_INFO F WHERE F.BASECODE = '#IN_MOLD#'),
        '',
        TO_DATE('#CREATE_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
        TO_DATE('#CREATE_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
        '#SUPPLY_UNIT_CODE#',
        '#SUPPLY_UNIT#',
        '#BAL_YEAR_MONTH#',
        '#ACT_DIMATER#',
        '#ACT_HEIGHT#',
        '#BELONG_CODE#',
        '#BELONG_NAME#',
        '800701',
        '产出入库'
        )
    </query>
<query id = "FrmPipeEnter.updatePlan" desc = "修改计划表">
<![CDATA[
	UPDATE PLN_SALEORD
   SET PAYDOWN_NUM  =
       to_number(nvl((SELECT T.PAYDOWN_NUM
          FROM PLN_SALEORD T
         WHERE T.ORDER_NO = ?
           AND T.ORDER_SEQ = ?
           AND T.DELIVERY_NO = ?),0)) + to_number(?),
       PAYDOWNWEIGHT =
       to_number(nvl((SELECT T.PAYDOWNWEIGHT
          FROM PLN_SALEORD T
         WHERE T.ORDER_NO = ?
           AND T.ORDER_SEQ = ?
           AND T.DELIVERY_NO = ?),0)) + to_number(?)
 WHERE ORDER_NO = ?
   AND ORDER_SEQ = ?
   AND DELIVERY_NO = ?
   ]]>
</query>
<query id = "FrmPipeEnter.updateProcess" desc = "写进程表">
UPDATE PROCESS_ORDER_M T
   SET T.PAY_NUM = TO_NUMBER(NVL(T.PAY_NUM,0)) + TO_NUMBER(?),
       T.PAY_WGT = TO_NUMBER(NVL(T.PAY_WGT,0)) + TO_NUMBER(?),
       T.PAY_LEN = TO_NUMBER(NVL(T.PAY_LEN,0)) + TO_NUMBER(?)
   WHERE ORD_LN_DLY_PK = ?
</query>
<query id = "FrmPipeEnter.getOrderPk_" desc = "获取合同键值">
SELECT T1.SALE_ORG,
       T1.SALE_ORG_DESC,
       T1.ORD_PK,
       T2.ORD_LN_PK,
       T3.ORD_LN_DLY_PK,
       T2.STD_CODE,
       T2.STD_NAME,
       T2.LEN_NO,
       T2.LEN_DESC,
       T2.LEN_UNIT,
       T3.DELIVERY_NO
  from SLM_ORDER_HEAD t1, SLM_ORDER_LINE T2, SLM_ORDER_LINE_DELIVERY T3,
  YDM_ZC_INITIAL T

 where T1.ORD_PK = T2.ORD_PK
   AND T1.ORD_PK = T3.ORD_PK
   AND T1.ORD_PK = T.ORD_PK(+)
   AND t1.order_no = ?
   AND LPAD(T2.ORDER_SEQ, 4, '0') = LPAD(?, 4, '0')
   AND LPAD(T3.DELIVERY_NO,3,'0') = LPAD(?,3,'0')
   AND T1.VALIDFLAG = '1'
   AND T2.VALIDFLAG = '1'
   AND T3.VALIDFLAG = '1'
</query>
<query id = "cancelPipData.SelectMatNo" desc = "查询所有物料号">
SELECT T.MAT_NO FROM YDM_ZC_INLIST T WHERE T.INSTOCK_DOC = ? AND T.JUDGE_STOVE_NO = ? AND T.BATCH_NO = ? AND T.BATCH_GROUD_NO = ?
</query>
<query id = "cancelPipData.deleteMat" desc = "删除物料表">
DELETE FROM MAT_ZC_M T WHERE T.MAT_NO = ?
</query>
<query id = "cancelPipData.deleteButress" desc = "删除位置表">
DELETE FROM YDM_ZC_BUTTRESS T WHERE T.MAT_NO = ?
</query>
<query id = "cancelPipData.deleteInList" desc = "删除入库表">
DELETE FROM YDM_ZC_INLIST T WHERE T.MAT_NO = ? AND T.INSTOCK_TYPE_CODE = '800701'
</query>
    <query id = "cancelPipData.deleteCrm" desc = "新增CRM删除数据">
        DECLARE

        BEGIN
        FOR MYROW IN(SELECT * FROM YDM_ZC_INLIST T WHERE T.MAT_NO = ?)LOOP
        INSERT INTO CRM_ZC_INLIST(
        STORAGE_NAME,
        MAT_NO,
        INSTOCK_SQE,
        INSTOCK_DOC,
        ORDER_NO,
        ORDER_SEQ,
        DELIVERY_NO,
        ORD_PK,
        ORD_LN_PK,
        ORD_LN_DLY_PK,
        PRODUCT_FLAG,
        JUDGE_STOVE_NO,
        BATCH_NO,
        BATCH_GROUD_NO,
        MATERIAL_NO,
        MATERIAL_NAME,
        PRODUCCODE,
        PRODUCNAME,
        STD_CODE,
        STD_NAME,
        GRADECODE,
        GRADENAME,
        STEELCODE,
        STEELNAME,
        STD_STYLE,
        STD_STYLE_DESC,
        SPEC_CODE,
        SPEC_NAME,
        MODEL_CODE,
        MODEL_DESC,
        PLINE_CODE,
        PLINE_NAME,
        ACT_LEN,
        ACT_LEN_MIN,
        ACT_LEN_MAX,
        ACT_COUNT,
        ACT_WEIGHT,
        STORAGE_NO,
        IN_MOLD,
        PACK_NO,
        INSTOCK_TIME,
        CREATE_TIME,
        DATA_STATUS,
        SUPPLY_UNIT_CODE,
        SUPPLY_UNIT,
        BAL_YEAR_MONTH,
        ACT_DIMATER,
        ACT_HEIGHT,
        BELONG_CODE,
        BELONG_NAME,
        INSTOCK_TYPE_CODE,
        INSTOCK_TYPE_NAME
        )
        VALUES(
        (SELECT S1.STORAGE_NAME FROM YDM_BS_STORAGE S1 WHERE S1.STORAGE_NO = MYROW.STORAGE_NO),
        MYROW.MAT_NO,
        MYROW.INSTOCK_SQE,
        MYROW.INSTOCK_DOC,
        MYROW.ORDER_NO,
        MYROW.ORDER_SEQ,
        MYROW.DELIVERY_NO,
        MYROW.ORD_PK,
        MYROW.ORD_LN_PK,
        MYROW.ORD_LN_DLY_PK,
        (SELECT F.BASENAME FROM COM_BASE_INFO F WHERE F.BASECODE = MYROW.PRODUCT_FLAG),
        MYROW.JUDGE_STOVE_NO,
        MYROW.BATCH_NO,
        MYROW.BATCH_GROUD_NO,
        MYROW.MATERIAL_NO,
        MYROW.MATERIAL_NAME,
        MYROW.PRODUCCODE,
        MYROW.PRODUCNAME,
        MYROW.STD_CODE,
        MYROW.STD_NAME,
        MYROW.GRADECODE,
        MYROW.GRADENAME,
        MYROW.STEELCODE,
        MYROW.STEELNAME,
        MYROW.STD_STYLE,
        MYROW.STD_STYLE_DESC,
        MYROW.SPEC_CODE,
        MYROW.SPEC_NAME,
        MYROW.MODEL_CODE,
        MYROW.MODEL_DESC,
        MYROW.PLINE_CODE,
        MYROW.PLINE_NAME,
        MYROW.ACT_LEN,
        MYROW.ACT_LEN_MIN,
        MYROW.ACT_LEN_MAX,
        MYROW.ACT_COUNT,
        MYROW.ACT_WEIGHT,
        MYROW.STORAGE_NO,
        (SELECT F.BASENAME FROM COM_BASE_INFO F WHERE F.BASECODE = MYROW.IN_MOLD),
        MYROW.PACK_NO,
        MYROW.INSTOCK_TIME,
        TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
        '2',
        MYROW.SUPPLY_UNIT_CODE,
        MYROW.SUPPLY_UNIT,
        MYROW.BAL_YEAR_MONTH,
        MYROW.ACT_DIMATER,
        MYROW.ACT_HEIGHT,
        MYROW.BELONG_CODE,
        MYROW.BELONG_NAME,
        MYROW.INSTOCK_TYPE_CODE,
        MYROW.INSTOCK_TYPE_NAME
        );
        INSERT INTO CRM_MAT_ZC(
        MAT_NO,
        PRODUCT_FLAG,
        MAT_STATUS,
        LOT_NO,
        STOVE_NO,
        JUDGE_STOVE_NO,
        BATCH_NO,
        BATCH_GROUD_NO,
        MATERIAL_NO,
        MATERIAL_NAME,
        PRODUCCODE,
        PRODUCNAME,
        STEELCODE,
        STEELNAME,
        GRADECODE,
        GRADENAME,
        SPEC_CODE,
        SPEC_NAME,
        MODEL_CODE,
        MODEL_DESC,
        STD_CODE,
        STD_NAME,
        STD_STYLE,
        STD_STYLE_DESC,
        PRO_ORDER_NO,
        ORDER_NO,
        ORDER_SEQ,
        ORDER_SEQ_NO,
        ORD_PK,
        ORD_LN_PK,
        ORD_LN_DLY_PK,
        PLINE_CODE,
        PLINE_NAME,
        ACT_DIMATER,
        ACT_HEIGHT,
        ACT_LEN,
        ACT_LEN_MIN,
        ACT_LEN_MAX,
        ACT_COUNT,
        ACT_WEIGHT,
        BELONG_CODE,
        BELONG_NAME,
        IN_MOLD,
        INSTOCK_TIME,
        STORAGE_NO,
        LOCATION_NO,
        STORAGE_NAME,
        LOCATION_NAME,
        SUPPLY_UNIT_CODE,
        SUPPLY_UNIT,
        CREATE_TIME,
        DATA_STATUS)
        VALUES(
        MYROW.MAT_NO,
        (SELECT F.BASENAME FROM COM_BASE_INFO F WHERE F.BASECODE = MYROW.PRODUCT_FLAG),
        (SELECT F.BASENAME FROM COM_BASE_INFO F WHERE F.BASECODE = MYROW.MAT_STATUS),
        MYROW.LOT_NO,
        MYROW.STOVE_NO,
        MYROW.JUDGE_STOVE_NO,
        MYROW.BATCH_NO,
        MYROW.BATCH_GROUD_NO,
        MYROW.MATERIAL_NO,
        MYROW.MATERIAL_NAME,
        MYROW.PRODUCCODE,
        MYROW.PRODUCNAME,
        MYROW.STEELCODE,
        MYROW.STEELNAME,
        MYROW.GRADECODE,
        MYROW.GRADENAME,
        MYROW.SPEC_CODE,
        MYROW.SPEC_NAME,
        MYROW.MODEL_CODE,
        MYROW.MODEL_DESC,
        MYROW.STD_CODE,
        MYROW.STD_NAME,
        MYROW.STD_STYLE,
        MYROW.STD_STYLE_DESC,
        MYROW.PRO_ORDER_NO,
        MYROW.ORDER_NO,
        MYROW.ORDER_SEQ,
        MYROW.DELIVERY_NO,
        MYROW.ORD_PK,
        MYROW.ORD_LN_PK,
        MYROW.ORD_LN_DLY_PK,
        MYROW.PLINE_CODE,
        MYROW.PLINE_NAME,
        MYROW.ACT_DIMATER,
        MYROW.ACT_HEIGHT,
        MYROW.ACT_LEN,
        MYROW.ACT_LEN_MIN,
        MYROW.ACT_LEN_MAX,
        MYROW.ACT_COUNT,
        MYROW.ACT_WEIGHT,
        MYROW.BELONG_CODE,
        MYROW.BELONG_NAME,
        (SELECT F.BASENAME FROM COM_BASE_INFO F WHERE F.BASECODE = MYROW.IN_MOLD),
        MYROW.INSTOCK_TIME,
        MYROW.STORAGE_NO,
        MYROW.LOCATION_NO,
        (SELECT S1.STORAGE_NAME FROM YDM_BS_STORAGE S1 WHERE S1.STORAGE_NO = MYROW.STORAGE_NO),
        (SELECT S2.LOCATION_NAME FROM YDM_BS_LOCATION S2 WHERE S2.LOCATION_NO = MYROW.LOCATION_NO),
        MYROW.SUPPLY_UNIT_CODE,
        MYROW.SUPPLY_UNIT,
        TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
        '2');
        END LOOP;
        END;
    </query>
<query id = "cancelPipData.updatePlan" desc = "修改计划表">
<![CDATA[
	UPDATE PLN_SALEORD
   SET PAYDOWN_NUM  =
       to_number(nvl((SELECT T.PAYDOWN_NUM
          FROM PLN_SALEORD T
         WHERE T.ORDER_NO = ?
           AND T.ORDER_SEQ = ?
           AND T.DELIVERY_NO = ?),0)) - to_number(?),
       PAYDOWNWEIGHT =
       to_number(nvl((SELECT T.PAYDOWNWEIGHT
          FROM PLN_SALEORD T
         WHERE T.ORDER_NO = ?
           AND T.ORDER_SEQ = ?
           AND T.DELIVERY_NO = ?),0)) - to_number(?)
 WHERE ORDER_NO = ?
   AND ORDER_SEQ = ?
   AND DELIVERY_NO = ?
   ]]>
</query>
<query id = "cancelPipData.updateProcess" desc = "写进程表">
UPDATE PROCESS_ORDER_M T
   SET T.PAY_NUM = TO_NUMBER(NVL(T.PAY_NUM,0)) - TO_NUMBER(?),
       T.PAY_WGT = TO_NUMBER(NVL(T.PAY_WGT,0)) - TO_NUMBER(?),
       T.PAY_LEN = TO_NUMBER(NVL(T.PAY_LEN,0)) - TO_NUMBER(?)
   WHERE ORD_LN_DLY_PK = ?
</query>
<query id = "FrmPipeEnter.getCount" desc = "查询已有支数">
<![CDATA[
SELECT SUM(ACOUNT) ACOUNT
  FROM (SELECT SUM(T.ACT_COUNT) ACOUNT
          FROM MAT_ZC_M T
         WHERE T.JUDGE_STOVE_NO = ?
           AND T.BATCH_NO = ?
        UNION ALL
        SELECT SUM(T.ACT_COUNT) ACOUNT
          FROM MAT_ZC_BACKUP T
         WHERE T.JUDGE_STOVE_NO = ?
           AND T.BATCH_NO = ?)
]]>
</query>
<query id = "cancelPipData.selectMat" desc = "查询材料状态">
<![CDATA[
select t.MAT_NO from mat_zc_m t where t.judge_stove_no = ? and t.batch_no = ? and t.BATCH_GROUD_NO = ? and t.MAT_STATUS not in ('80150301','80150202')
]]>
</query>
<query id = "FrmPipeEnter.getOrder" desc = "查询合同信息">
<![CDATA[
SELECT T1.PRODUCCODE,
T1.PRODUCNAME,
T1.STD_STYLE,
T1.STD_STYLE_DESC,
T1.STEELCODE,
T1.STEELNAME,
T1.SPEC_CODE,
T1.SPEC_NAME,
T1.MODEL_CODE,
T1.MODEL_DESC,
       T1.STD_CODE,
       T1.STD_NAME,
       T1.LEN_MIN,
       T1.LEN_MAX,
       T1.Dimater,
       T1.Height,
       T2.ORDER_NO,
       T1.ORDER_SEQ,
       T3.DELIVERY_NO,
        T2.ORD_PK,      
        T1.ORD_LN_PK,
        T3.ORD_LN_DLY_PK
  FROM SLM_ORDER_LINE T1
  LEFT JOIN SLM_ORDER_HEAD T2
    ON T1.ORD_PK = T2.ORD_PK
  LEFT JOIN SLM_ORDER_LINE_DELIVERY T3
    ON T1.ORD_LN_PK = T3.ORD_LN_PK
 WHERE T1.VALIDFLAG = '1'
 AND T2.VALIDFLAG = '1'
 AND T3.VALIDFLAG = '1'
   AND  UPPER(T2.ORDER_NO) || '&' LIKE ('%' || upper(?) || '%')
   ]]>
</query>
<query id = "FrmPipeEnter.getOrderNo" desc = "查询合同行信息">
<![CDATA[
SELECT T1.PRODUCCODE,
T1.PRODUCNAME,
T1.STD_STYLE,
T1.STD_STYLE_DESC,
T1.STEELCODE,
T1.STEELNAME,
T1.SPEC_CODE,
T1.SPEC_NAME,
T1.MODEL_CODE,
T1.MODEL_DESC,
       T1.STD_CODE,
       T1.STD_NAME,
       T1.LEN_MIN,
       T1.LEN_MAX,
       T1.Dimater,
       T1.Height,
       T2.ORDER_NO,
       T1.ORDER_SEQ,
       T3.DELIVERY_NO,
        T2.ORD_PK,      
        T1.ORD_LN_PK,
        T3.ORD_LN_DLY_PK
  FROM SLM_ORDER_LINE T1
  LEFT JOIN SLM_ORDER_HEAD T2
    ON T1.ORD_PK = T2.ORD_PK
  LEFT JOIN SLM_ORDER_LINE_DELIVERY T3
    ON T1.ORD_LN_PK = T3.ORD_LN_PK
 WHERE T1.VALIDFLAG = '1'
 AND T2.VALIDFLAG = '1'
 AND T3.VALIDFLAG = '1'
   AND UPPER(T2.ORDER_NO) || '&' LIKE (upper(?) || '%')
   AND UPPER(T1.ORDER_SEQ) || '&' LIKE ('%' || upper(?) || '%')
   AND UPPER(T3.DELIVERY_NO) || '&' LIKE ('%' || upper(?) || '%')
   ]]>
</query>
<query id = "FrmPipeEnter.selectYearMoth" desc = "查询是否结转">
SELECT COUNT(1) ACOUNT
  FROM YDM_ZC_INITIAL T
 WHERE 
 --T.JUDGE_STOVE_NO = ?
   --AND T.BATCH_NO = ?
   --AND T.BATCH_GROUD_NO = ?
   T.BAL_YEAR_MONTH = ?
   AND 
   T.SUPPLY_UNIT_CODE = ?
</query>
<query id = "FrmPipeEnter.updateYear" desc = "调整结转年月">
<![CDATA[
UPDATE YDM_ZC_INLIST T SET T.BAL_YEAR_MONTH = ?,T.INSTOCK_TIME = to_date(?,'yyyy-MM-dd HH24:mi:ss') WHERE T.INSTOCK_DOC = ?
]]>
</query>
    <query id = "FrmPipeEnter.selectProcess" desc = "查询工序">
        SELECT T.PROCESS_CODE,T.PROCESS_DESC FROM COM_BASE_PLINE T WHERE T.PLINE_CODE = ?
    </query>
    <query id = "FrmPipeEnter.SelectSyncFlag" desc = "查询财务系统同步状态">
SELECT T.*
  FROM FMIS_ZC_INLIST T
 WHERE T.INSTOCK_DOC = ?
   AND T.JUDGE_STOVE_NO = ?
   AND T.BATCH_NO = ?
   AND T.BATCH_GROUD_NO = ?
</query>
<query id = "FrmPipeEnter.deleteFmis" desc = "删除财务系统接口数据">
DELETE FROM FMIS_ZC_INLIST T
 WHERE T.INSTOCK_DOC = ?
   AND T.JUDGE_STOVE_NO = ?
   AND T.BATCH_NO = ?
   AND T.BATCH_GROUD_NO = ?
</query>
</queryMap>