<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="PLN_ORDER_ZG_S （生成工具：代码生成工具4.0   访问地址：http://172.16.2.128/tool/）">
    <query id="PlnOrderZgSDAL.Query" desc="查询">
        <![CDATA[
SELECT TT.*, C.CRAFT_NO_LV2, C.CRAFT_PATH
  FROM (SELECT T.PLINE_CODE,
               T.PLINE_NAME,
               T.GX_PRO_SEQ,
               DECODE(T.EXE_STATUS,
                      '0',
                      '计划',
                      '1',
                      '生产中',
                      '2',
                      '已生产',
                      '3',
                      '关闭A') EXE_STATUS,
               T.PRO_PLAN_ID,
               T.CRAFT_FILE_NO,
               B.CRAFT_FILE_LV2_D,
               T.GRADECODE,
               T.GRADENAME,
               T.PLAN_GROUP_ID,
               B.DESGIN_KEY,
               T.CIC,
               T.PIC,
               T.SIC,
               T.DIC,
               T.WIC,
               T.GIC
          FROM PLN_ORDER_ZG_S T, PLN_SALEORD A, CRAFT_ORD_DESIGN B
         WHERE A.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
           AND B.ORD_LN_PK = A.ORD_LN_PK
           AND B.Craft_Seq = t.craft_seq
           AND DECODE({0}, NULL, SYSDATE, T.PLAN_TIME_B) >=
               NVL(TO_DATE({0}, 'YYYY-MM-DD HH24:MI:SS'), SYSDATE)
           AND DECODE({1}, NULL, SYSDATE, T.PLAN_TIME_B) <=
               NVL(TO_DATE({1}, 'YYYY-MM-DD HH24:MI:SS'), SYSDATE)
           AND DECODE({2}, NULL, SYSDATE, T.PLAN_TIME_E) >=
               NVL(TO_DATE({2}, 'YYYY-MM-DD HH24:MI:SS'), SYSDATE)
           AND DECODE({3}, NULL, SYSDATE, T.PLAN_TIME_E) <=
               NVL(TO_DATE({3}, 'YYYY-MM-DD HH24:MI:SS'), SYSDATE)
           AND DECODE({4}, NULL, '1', T.PLINE_CODE) LIKE
               DECODE({4}, NULL, '1', '%' || {4} || '%')
           AND DECODE({5}, NULL, '1', T.PRO_PLAN_ID) LIKE
               DECODE({5}, NULL, '1', '%' || {5} || '%')
           AND DECODE({6}, NULL, '1', T.ORDER_NO) LIKE
               DECODE({6}, NULL, '1', '%' || {6} || '%')
           AND T.EXE_STATUS IN ({7}, {8}, {9}, {10})) TT
  LEFT JOIN CRAFT_FILE_LV2 C
    ON INSTR(TT.CRAFT_FILE_LV2_D, C.PK) > 0
   AND C.PLINE_CODE = TT.PLINE_CODE
        ]]>
    </query>
    <query id="PlnOrderZgSDAL.QueryByPk" desc="通过主键查询">
        <![CDATA[
 SELECT 
       T.PRO_ORDER_NO,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.PLAN_GROUP_ID,
       T.ORDER_SOURCE,
       T.ORD_LN_DLY_PK,
       T.PLN_DIVIDE_ID,
       T.ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.REQ_BL_ID,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.STEELCODE,
       T.STEELNAME,
       T.GRADECODE,
       T.GRADENAME,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.LENGTHDISC,
       T.INWL_ID,
       T.INWL_DESC,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.LEN_ROLL_MAX,
       T.LEN_ROLL_MIN,
       T.AIMOUTDIAMETER,
       T.AIMWALLTHICK,
       T.AIMLENGTH,
       T.DIAMETER_GP,
       T.LEN_GP_SINGLE,
       T.ROLL_LENGTH,
       T.LEN_CUTHEAD,
       T.LEN_CUTEND,
       T.OUTNUM_CUT,
       T.DIAMETER_MANDREL,
       T.PASS_CODE,
       T.PASS_NAME,
       T.IN_WEIGHT_S,
       T.IN_NUM_S,
       T.WEIGTH_S,
       T.NUM_S,
       T.ADD_WT_IN,
       T.ADD_NUM_IN,
       T.MATCH_WT_IN,
       T.MATCH_NUM_IN,
       T.ISENDGX,
       T.IF_MONITOR_ZG,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T.CRAFT_FILE_NO,
       T.CRAFT_FILE_MAN,
       T.CRAFT_SEQ,
       T.STATION_ROAD,
       T.PRO_MONTH,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.WIC,
       T.GIC,
       T.GX_PRO_SEQ,
       T.PLAN_USETIME,
       TO_CHAR(T.PLAN_TIME_B, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_B,
       TO_CHAR(T.PLAN_TIME_E, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_E,
       T.BATCHED_WT,
       T.BATCHED_NUM,
       T.FINISHWEIGHT,
       T.FINISHNUM,
       T.EXE_STATUS,
       T.IS_REPAIR_PLN,
       T.REPAIR_TYPE,
       T.IS_PLAN_OK,
       T.GPREQ_IF_OK,
       T.GPREQ_ID,
       T.ZY_BATCH_ID,
       T.CIC_GROUP_GP,
       T.PIC_GROUP_GP,
       T.SIC_GROUP_GP,
       T.DIC_GROUP_GP,
       T.WIC_GROUP_GP,
       T.GIC_GROUP_GP,
       T.CIC_GP,
       T.PIC_GP,
       T.SIC_GP,
       T.DIC_GP,
       T.WIC_GP,
       T.GIC_GP,
       TO_CHAR(T.ISSUED_TIME, 'YYYY-MM-DD HH24:MI:SS') ISSUED_TIME,
       T.ISSUED_MAN,
       TO_CHAR(T.LAST_UNDOWN_TIME, 'YYYY-MM-DD HH24:MI:SS') LAST_UNDOWN_TIME,
       T.LAST_UNDOWN_MAN,
       T.VERSION_NO,
       T.PROCESSING_COST,
       T.TOTAL_COST
 FROM PLN_ORDER_ZG_S T
 WHERE
       T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
       AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
        ]]>
    </query>
    <query id="PlnOrderZgSDAL.Insert" desc="新增">
        <![CDATA[
 INSERT INTO PLN_ORDER_ZG_S(
        PRO_ORDER_NO,
        PRO_PLAN_ID,
        GX_PLAN_NO,
        PLAN_GROUP_ID,
        ORDER_SOURCE,
        ORD_LN_DLY_PK,
        PLN_DIVIDE_ID,
        ORDER_NO,
        ORDER_SEQ,
        DELIVERY_NO,
        REQ_BL_ID,
        PLINE_CODE,
        PLINE_NAME,
        STEELCODE,
        STEELNAME,
        GRADECODE,
        GRADENAME,
        OUTDIAMETER,
        WALLTHICK,
        LENGTHDISC,
        INWL_ID,
        INWL_DESC,
        OUTWL_ID,
        OUTWL_DESC,
        LEN_ROLL_MAX,
        LEN_ROLL_MIN,
        AIMOUTDIAMETER,
        AIMWALLTHICK,
        AIMLENGTH,
        DIAMETER_GP,
        LEN_GP_SINGLE,
        ROLL_LENGTH,
        LEN_CUTHEAD,
        LEN_CUTEND,
        OUTNUM_CUT,
        DIAMETER_MANDREL,
        PASS_CODE,
        PASS_NAME,
        IN_WEIGHT_S,
        IN_NUM_S,
        WEIGTH_S,
        NUM_S,
        ADD_WT_IN,
        ADD_NUM_IN,
        MATCH_WT_IN,
        MATCH_NUM_IN,
        ISENDGX,
        IF_MONITOR_ZG,
        PRDCR_NO,
        MONITOR_POINT,
        CRAFT_FILE_NO,
        CRAFT_FILE_MAN,
        CRAFT_SEQ,
        STATION_ROAD,
        PRO_MONTH,
        CIC,
        PIC,
        SIC,
        DIC,
        WIC,
        GIC,
        GX_PRO_SEQ,
        PLAN_USETIME,
        PLAN_TIME_B,
        PLAN_TIME_E,
        BATCHED_WT,
        BATCHED_NUM,
        FINISHWEIGHT,
        FINISHNUM,
        EXE_STATUS,
        IS_REPAIR_PLN,
        REPAIR_TYPE,
        IS_PLAN_OK,
        GPREQ_IF_OK,
        GPREQ_ID,
        ZY_BATCH_ID,
        CIC_GROUP_GP,
        PIC_GROUP_GP,
        SIC_GROUP_GP,
        DIC_GROUP_GP,
        WIC_GROUP_GP,
        GIC_GROUP_GP,
        CIC_GP,
        PIC_GP,
        SIC_GP,
        DIC_GP,
        WIC_GP,
        GIC_GP,
        ISSUED_TIME,
        ISSUED_MAN,
        LAST_UNDOWN_TIME,
        LAST_UNDOWN_MAN,
        VERSION_NO,
        PROCESSING_COST,
        TOTAL_COST)
 VALUES( 
        '#PRO_ORDER_NO#',
        '#PRO_PLAN_ID#',
        '#GX_PLAN_NO#',
        '#PLAN_GROUP_ID#',
        '#ORDER_SOURCE#',
        '#ORD_LN_DLY_PK#',
        '#PLN_DIVIDE_ID#',
        '#ORDER_NO#',
        '#ORDER_SEQ#',
        '#DELIVERY_NO#',
        '#REQ_BL_ID#',
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#STEELCODE#',
        '#STEELNAME#',
        '#GRADECODE#',
        '#GRADENAME#',
        '#OUTDIAMETER#',
        '#WALLTHICK#',
        '#LENGTHDISC#',
        '#INWL_ID#',
        '#INWL_DESC#',
        '#OUTWL_ID#',
        '#OUTWL_DESC#',
        '#LEN_ROLL_MAX#',
        '#LEN_ROLL_MIN#',
        '#AIMOUTDIAMETER#',
        '#AIMWALLTHICK#',
        '#AIMLENGTH#',
        DECODE('#PLINE_CODE#','C072',
              DECODE('#PASS_NAME#','383','380','454','450','#DIAMETER_GP#'),
        '#DIAMETER_GP#'),
        '#LEN_GP_SINGLE#',
        '#ROLL_LENGTH#',
        '#LEN_CUTHEAD#',
        '#LEN_CUTEND#',
        '#OUTNUM_CUT#',
        '#DIAMETER_MANDREL#',
        '#PASS_CODE#',
        '#PASS_NAME#',
        '#IN_WEIGHT_S#',
        '#IN_NUM_S#',
        '#WEIGTH_S#',
        '#NUM_S#',
        '#ADD_WT_IN#',
        '#ADD_NUM_IN#',
        '#MATCH_WT_IN#',
        '#MATCH_NUM_IN#',
        '#ISENDGX#',
        '#IF_MONITOR_ZG#',
        '#PRDCR_NO#',
        '#MONITOR_POINT#',
        '#CRAFT_FILE_NO#',
        '#CRAFT_FILE_MAN#',
        '#CRAFT_SEQ#',
        '#STATION_ROAD#',
        '#PRO_MONTH#',
        '#CIC#',
        '#PIC#',
        '#SIC#',
        '#DIC#',
        '#WIC#',
        '#GIC#',
        '#GX_PRO_SEQ#',
        '#PLAN_USETIME#',
        SYSDATE,
        SYSDATE,
        '#BATCHED_WT#',
        '#BATCHED_NUM#',
        '#FINISHWEIGHT#',
        '#FINISHNUM#',
        '#EXE_STATUS#',
        '#IS_REPAIR_PLN#',
        '#REPAIR_TYPE#',
        '#IS_PLAN_OK#',
        '#GPREQ_IF_OK#',
        '#GPREQ_ID#',
        '#ZY_BATCH_ID#',
        '#CIC_GROUP_GP#',
        '#PIC_GROUP_GP#',
        '#SIC_GROUP_GP#',
        '#DIC_GROUP_GP#',
        '#WIC_GROUP_GP#',
        '#GIC_GROUP_GP#',
        '#CIC_GP#',
        '#PIC_GP#',
        '#SIC_GP#',
        '#DIC_GP#',
        '#WIC_GP#',
        '#GIC_GP#',
        SYSDATE,
        '#ISSUED_MAN#',
        SYSDATE,
        '#LAST_UNDOWN_MAN#',
        '#VERSION_NO#',
        '#PROCESSING_COST#',
        '#TOTAL_COST#')
        ]]>
    </query>
    <query id="PlnOrderZgSDAL.Update" desc="修改">
        <![CDATA[
 UPDATE PLN_ORDER_ZG_S T
   SET 
        T.PRO_ORDER_NO = '#PRO_ORDER_NO#',
        T.PRO_PLAN_ID = '#PRO_PLAN_ID#',
        T.GX_PLAN_NO = '#GX_PLAN_NO#',
        T.PLAN_GROUP_ID = '#PLAN_GROUP_ID#',
        T.ORDER_SOURCE = '#ORDER_SOURCE#',
        T.ORD_LN_DLY_PK = '#ORD_LN_DLY_PK#',
        T.PLN_DIVIDE_ID = '#PLN_DIVIDE_ID#',
        T.ORDER_NO = '#ORDER_NO#',
        T.ORDER_SEQ = '#ORDER_SEQ#',
        T.DELIVERY_NO = '#DELIVERY_NO#',
        T.REQ_BL_ID = '#REQ_BL_ID#',
        T.PLINE_CODE = '#PLINE_CODE#',
        T.PLINE_NAME = '#PLINE_NAME#',
        T.STEELCODE = '#STEELCODE#',
        T.STEELNAME = '#STEELNAME#',
        T.GRADECODE = '#GRADECODE#',
        T.GRADENAME = '#GRADENAME#',
        T.OUTDIAMETER = '#OUTDIAMETER#',
        T.WALLTHICK = '#WALLTHICK#',
        T.LENGTHDISC = '#LENGTHDISC#',
        T.INWL_ID = '#INWL_ID#',
        T.INWL_DESC = '#INWL_DESC#',
        T.OUTWL_ID = '#OUTWL_ID#',
        T.OUTWL_DESC = '#OUTWL_DESC#',
        T.LEN_ROLL_MAX = '#LEN_ROLL_MAX#',
        T.LEN_ROLL_MIN = '#LEN_ROLL_MIN#',
        T.AIMOUTDIAMETER = '#AIMOUTDIAMETER#',
        T.AIMWALLTHICK = '#AIMWALLTHICK#',
        T.AIMLENGTH = '#AIMLENGTH#',
        T.DIAMETER_GP = '#DIAMETER_GP#',
        T.LEN_GP_SINGLE = '#LEN_GP_SINGLE#',
        T.ROLL_LENGTH = '#ROLL_LENGTH#',
        T.LEN_CUTHEAD = '#LEN_CUTHEAD#',
        T.LEN_CUTEND = '#LEN_CUTEND#',
        T.OUTNUM_CUT = '#OUTNUM_CUT#',
        T.DIAMETER_MANDREL = '#DIAMETER_MANDREL#',
        T.PASS_CODE = '#PASS_CODE#',
        T.PASS_NAME = '#PASS_NAME#',
        T.IN_WEIGHT_S = '#IN_WEIGHT_S#',
        T.IN_NUM_S = '#IN_NUM_S#',
        T.WEIGTH_S = '#WEIGTH_S#',
        T.NUM_S = '#NUM_S#',
        T.ADD_WT_IN = '#ADD_WT_IN#',
        T.ADD_NUM_IN = '#ADD_NUM_IN#',
        T.MATCH_WT_IN = '#MATCH_WT_IN#',
        T.MATCH_NUM_IN = '#MATCH_NUM_IN#',
        T.ISENDGX = '#ISENDGX#',
        T.IF_MONITOR_ZG = '#IF_MONITOR_ZG#',
        T.PRDCR_NO = '#PRDCR_NO#',
        T.MONITOR_POINT = '#MONITOR_POINT#',
        T.CRAFT_FILE_NO = '#CRAFT_FILE_NO#',
        T.CRAFT_FILE_MAN = '#CRAFT_FILE_MAN#',
        T.CRAFT_SEQ = '#CRAFT_SEQ#',
        T.STATION_ROAD = '#STATION_ROAD#',
        T.PRO_MONTH = '#PRO_MONTH#',
        T.CIC = '#CIC#',
        T.PIC = '#PIC#',
        T.SIC = '#SIC#',
        T.DIC = '#DIC#',
        T.WIC = '#WIC#',
        T.GIC = '#GIC#',
        T.GX_PRO_SEQ = '#GX_PRO_SEQ#',
        T.PLAN_USETIME = '#PLAN_USETIME#',
        T.PLAN_TIME_B = SYSDATE,
        T.PLAN_TIME_E = SYSDATE,
        T.BATCHED_WT = '#BATCHED_WT#',
        T.BATCHED_NUM = '#BATCHED_NUM#',
        T.FINISHWEIGHT = '#FINISHWEIGHT#',
        T.FINISHNUM = '#FINISHNUM#',
        T.EXE_STATUS = '#EXE_STATUS#',
        T.IS_REPAIR_PLN = '#IS_REPAIR_PLN#',
        T.REPAIR_TYPE = '#REPAIR_TYPE#',
        T.IS_PLAN_OK = '#IS_PLAN_OK#',
        T.GPREQ_IF_OK = '#GPREQ_IF_OK#',
        T.GPREQ_ID = '#GPREQ_ID#',
        T.ZY_BATCH_ID = '#ZY_BATCH_ID#',
        T.CIC_GROUP_GP = '#CIC_GROUP_GP#',
        T.PIC_GROUP_GP = '#PIC_GROUP_GP#',
        T.SIC_GROUP_GP = '#SIC_GROUP_GP#',
        T.DIC_GROUP_GP = '#DIC_GROUP_GP#',
        T.WIC_GROUP_GP = '#WIC_GROUP_GP#',
        T.GIC_GROUP_GP = '#GIC_GROUP_GP#',
        T.CIC_GP = '#CIC_GP#',
        T.PIC_GP = '#PIC_GP#',
        T.SIC_GP = '#SIC_GP#',
        T.DIC_GP = '#DIC_GP#',
        T.WIC_GP = '#WIC_GP#',
        T.GIC_GP = '#GIC_GP#',
        T.ISSUED_TIME = SYSDATE,
        T.ISSUED_MAN = '#ISSUED_MAN#',
        T.LAST_UNDOWN_TIME = SYSDATE,
        T.LAST_UNDOWN_MAN = '#LAST_UNDOWN_MAN#',
        T.VERSION_NO = '#VERSION_NO#',
        T.PROCESSING_COST = '#PROCESSING_COST#',
        T.TOTAL_COST = '#TOTAL_COST#'
 WHERE
       T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
       AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
        ]]>
    </query>
    <query id="PlnOrderZgSDAL.GetMaxPk" desc="获取最大主键">
        <![CDATA[
SELECT NVL(MAX(PRO_PLAN_ID), 0) + 1 MAX_VALUE FROM PLN_ORDER_ZG_S T
        ]]>
    </query>
    <query id="PlnOrderZgSDAL.Delete" desc="作废">
        <![CDATA[
UPDATE PLN_ORDER_ZG_S T
   SET
       T.VALIDFLAG = '0',
       T.DELETE_NAME = '#DELETE_NAME#',
       T.DELETE_TIME = SYSDATE
WHERE
       T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
       AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
        ]]>
    </query>
    <query id="PlnOrderZgSDAL.Resume" desc="恢复">
        <![CDATA[
UPDATE PLN_ORDER_ZG_S T
   SET
       T.VALIDFLAG = '1',
       T.DELETE_NAME = NULL,
       T.DELETE_TIME = NULL,
       T.UPDATE_NAME = '#UPDATE_NAME#',
       T.UPDATE_TIME = SYSDATE
WHERE
       T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
       AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
        ]]>
    </query>
</queryMap>