<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="接箍公共信息">
	<query id="FrmOutManagJg.queryInventory" desc="查询接箍材料信息">		
        <![CDATA[
SELECT T.MAT_NO,
       T.RESULT_NO,
       T.ZY_PLAN_ID,
       T1.PRO_PLAN_ID,
       T.PLINE_NAME,
       T.PLINE_CODE,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BL_WL_DESC,
       T.MIN_D,
       T.MIN_H,
       T.GRADENAME,
       T.STEELNAME,
       T.MODEL_DESC,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.SPEC_JG_DESC,
       NVL(T.AIMLENGTH, 0) AIMLENGTH,
       NVL(T.SINGLEWEIGHT, 0) SINGLEWEIGHT,
       NVL(T.PRO_NUM, 0) PRO_NUM,
       NVL(T.PRO_WT, 0) PRO_WT,
       TO_CHAR(T.RRO_TIME, 'YYYY-MM-DD HH24:MI:SS') RRO_TIME,
       DECODE(T.PRO_GROUP, '1', '甲', '2', '乙', '3', '丙', '4', '丁') PRO_GROUP,
       DECODE(T.PRO_SHIFT, '0', '常白', '1', '早', '2', '中', '3', '晚') PRO_SHIFT,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T1.KEP_NO,
       T1.STORAGE_NO,
       (SELECT B.STORAGE_NAME
          FROM YDM_BS_STORAGE B
         WHERE B.STORAGE_NO = T1.STORAGE_NO
           AND B.VALIDFLAG = '1') STORAGE_NAME,
       T1.LOCATION_NO,
       T.WO_ID,
       T1.MAT_NO_XH,
       T.CODE_JG,
       T2.ORDER_NO,
       T2.ORDER_SEQ,
       T2.ORD_LN_DLY_PK
  FROM COUPLING_MAT_M T, COUPLING_MAT_BUTTRESS T1,COUPLING_MAT_DEAL T2
 WHERE T.MAT_NO = T1.MAT_NO AND T.MAT_NO = T2.MAT_NO
   AND T.QCM_STAUS NOT IN ('11', '22', '12')  and t2.DEAL_TYPE_CODE in ('800702','800703','800704','800709')
        ]]>
	</query>
	<query id="FrmOutManagJg.queryInventoryBF" desc="查询接箍材料信息">		
        <![CDATA[
  SELECT T.MAT_NO,
       T.RESULT_NO,
       T.ZY_PLAN_ID,
       T1.PRO_PLAN_ID,
       T.PLINE_NAME,
       T.PLINE_CODE,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BL_WL_DESC,
       T.MIN_D,
       T.MIN_H,
       T.GRADENAME,
       T.STEELNAME,
       T.MODEL_DESC,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.SPEC_JG_DESC,
       NVL(T.AIMLENGTH, 0) AIMLENGTH,
       NVL(T.SINGLEWEIGHT, 0) SINGLEWEIGHT,
       NVL(T.PRO_NUM, 0) PRO_NUM,
       NVL(T.PRO_WT, 0) PRO_WT,
       NVL(T2.PLAN_NUM, 0) PLA_COUNT,
       NVL(T2.PLAN_WT, 0) PLA_WEIGHT,
       TO_CHAR(T.RRO_TIME, 'YYYY-MM-DD HH24:MI:SS') RRO_TIME,
       DECODE(T.PRO_GROUP, '1', '甲', '2', '乙', '3', '丙', '4', '丁') PRO_GROUP,
       DECODE(T.PRO_SHIFT, '0', '常白', '1', '早', '2', '中', '3', '晚') PRO_SHIFT,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T1.KEP_NO,
       T1.STORAGE_NO,
       (SELECT B.STORAGE_NAME
          FROM YDM_BS_STORAGE B
         WHERE B.STORAGE_NO = T1.STORAGE_NO
           AND B.VALIDFLAG = '1') STORAGE_NAME,
       T1.LOCATION_NO,
       T.WO_ID,
       T1.MAT_NO_XH,
       T2.JG_ORDERNO,
       T2.GUID,
       T2.ORDER_NO || '/' || T2.ORDER_SEQ ORDER_NO,
       T2.ORDER_SEQ_NO,
       T.CODE_JG,
       (SELECT MIN(S.PLINE_NAME)
          FROM PLN_ORDER_JGX_S S
         WHERE S.ORD_LN_DLY_PK = T2.ORD_LN_DLY_PK) GOWHERE_NAME,
       t2.ORD_LN_DLY_PK
  FROM COUPLING_MAT_M T, COUPLING_MAT_BUTTRESS T1, PLN_ZY_JG_MIDDLE T2
 WHERE T.MAT_NO = T1.MAT_NO
   AND T.MAT_NO = T2.MAT_NO
   AND T1.MAT_NO_XH = T2.MAT_NO_XH
   AND T.QCM_STAUS NOT IN ('11', '22', '12')
        ]]>
	</query>
	<query id="FrmOutManagJg.queryOutPerfo" desc="查询交易表倒库实绩">		
        <![CDATA[
 SELECT 
       T.DEAL_ORDE,
       T.DEAL_TYPE_CODE,
       T.DEAL_TYPE_NAME,
       T.SOURCE_CODE,
       T.SOURCE_NAME,
       T.TAR_CODE,
       T.TAR_NAME,
       T.KEP_NO,
       T.MAT_NO,
       T.RESULT_NO,
       T.ZY_PLAN_ID,
       T.WO_ID,
       T.PRO_PLAN_ID,
       T.JG_GROUP_ID,
       T.PRO_PLAN_ID1,
       T.JG_GROUP_ID1,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.MAT_ORIGIN_CODE,
       T.MAT_ORIGIN_NAME,
       T.SOURE_CODE,
       T.SOURE_NAME,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BL_WL_ID,
       T.BL_WL_DESC,
       T.MIN_D,
       T.MIN_H,
       T.CODE_JG,
       T.GRADECODE,
       T.GRADENAME,
       T.STEELCODE,
       T.STEELNAME,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.SPEC_JG,
       T.SPEC_JG_DESC,
      (SELECT B.BASENAME
          FROM COM_BASE_INFO B
         WHERE B.BASECODE = T.STYLE_JG
           AND B.VALIDFLAG = '1') STYLE_JG,
       T.DIAMETER,
       T.CHECK_J_VAL,
       T.AIMLENGTH,
       T.SINGLEWEIGHT,
       T.MONITORDEMAND,
       T.IF_MONITOR_JG,
       T.PRDCR_NO,
       T.PRODUCER,
       TO_CHAR(T.PRODUCER_TIME, 'YYYY-MM-DD HH24:MI:SS') PRODUCER_TIME,
       T.MACH_NO,
       T.MACH_NM,
       NVL(T.DEAL_NUM,0) DEAL_NUM,
       NVL(T.DEAL_WT,0) DEAL_WT,
       T.BAL_YEAR_MONTH,
       TO_CHAR(T.F_IN_TIME, 'YYYY-MM-DD HH24:MI:SS') F_IN_TIME,
       TO_CHAR(T.DEAL_TIME, 'YYYY-MM-DD HH24:MI:SS') DEAL_TIME,
       (SELECT B.STORAGE_NAME FROM YDM_BS_STORAGE B WHERE B.STORAGE_NO=T.STORAGE_NO AND B.VALIDFLAG='1') STORAGE_NO,
       T.LOCATION_NO,
       T.STORAGE_ATTR,
       T.STORAGE_ATTR_NAME,
       T.STORAGE_TYPE_NO,
       T.STORAGE_TYPE_NAME,
       T.TAR_STORAGE_NO,
       T.TAR_LOCATION_NO,
       T.TAR_KEP_NO,
       T.TAR_STORAGE_ATTR,
       T.TAR_STORAGE_ATTR_NAME,
       T.TAR_STORAGE_TYPE_NO,
       T.TAR_STORAGE_TYPE_NAME,
       DECODE(TAR_REC_FLAG, '0', '未接收', '1', '已接收') TAR_REC_FLAG,
       DECODE(HAND_FLAG, '0', '自动', '1', '人工') HAND_FL,
       (SELECT B.BASENAME
          FROM COM_BASE_INFO B
         WHERE B.BASECODE = T.DEMAND_DETECTION
           AND B.VALIDFLAG = '1') DEMAND_DETECTION,
       (SELECT B.BASENAME
          FROM COM_BASE_INFO B
         WHERE B.BASECODE = T.DEMAND_BONDERIZING
           AND B.VALIDFLAG = '1') DEMAND_BONDERIZING,
       (SELECT B.BASENAME
          FROM COM_BASE_INFO B
         WHERE B.BASECODE = T.DEMAND_COPPER
           AND B.VALIDFLAG = '1') DEMAND_COPPER,
       (SELECT B.BASENAME
          FROM COM_BASE_INFO B
         WHERE B.BASECODE = T.DEMAND_BLAST
           AND B.VALIDFLAG = '1') DEMAND_BLAST,
       T.CUST_ALPHA_NO,
       T.ORDER_SPECIAL_DESC,
       T.ALPHA_CODE,
       T.DETER_NO,
        (SELECT C.BASENAME FROM COM_BASE_INFO C WHERE C.BASECODE=T.DETER_RESULTS) DETER_RESULTS,
       T.COL_OPERATOR,
       T.MEMO,
       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,
       (SELECT B.BASENAME FROM COM_BASE_INFO B WHERE B.BASECODE=T.PRODUCT_FLAG AND B.VALIDFLAG='1') PRODUCT_FLAG,
       (SELECT B.BASENAME FROM COM_BASE_INFO B WHERE B.BASECODE=T.MAT_STATUS AND B.VALIDFLAG='1') MAT_STATUS,
       T.DETER_STATUS,
       T.CODE_JG_BL,
       T.CRAFT_FILE_NO,
       T.CRAFT_SEQ,
       T.BELONG_CODE,
       T.BELONG_NAME,
       DECODE(T.COAT_TYPE,'1','镀铜','2','磷化','/') COAT_TYPE,
       DECODE(T.QCM_STAUS,'00','合格','10','废品','11','待处理','/') QCM_STAUS,
       NVL(T.USED_NUM,0) USED_NUM,
       NVL(T.USED_WT,0) USED_WT,
       T.JG_ORDERNO,
       T.ORDER_NO || '/' || T.ORDER_SEQ ORDER_NO,
       T.DELIVERY_NO,
       DECODE(T.OUT_FLAG, '1', '补录出库', '2','领用出库','正常出库') OUT_FLAG,
       NVL(T.FAILL_NUM,0) FAILL_NUM,
       NVL(T.BACK_NUM,0) BACK_NUM,
       T.MAT_NO_XH,
       T.GOWHERE_NAME,
       T.ORD_LN_DLY_PK,
       TO_NUMBER(NVL(T.DEAL_NUM,0))-TO_NUMBER(NVL(T.USED_NUM,0))-TO_NUMBER(NVL(T.FAILL_NUM,0))-TO_NUMBER(NVL(T.BACK_NUM,0)) But_Back_Num,
       CASE
         WHEN TO_NUMBER(NVL(T.DEAL_NUM, 0)) - TO_NUMBER(NVL(T.USED_NUM, 0)) -
              TO_NUMBER(NVL(T.FAILL_NUM, 0)) - TO_NUMBER(NVL(T.BACK_NUM, 0)) <> '0' THEN
          '机旁'
         WHEN (SELECT MAX(S.EXE_STATUS)
                 FROM PLN_ORDER_JGX_S S
                WHERE S.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK) = '3' THEN
          '关闭'
         ELSE
          '使用'
       END Manage_State,
       DECODE(T.HANDLE_FLAG,'0','未处理','1','OK') HANDLE_FLAG,
       T.HANDLE_NAME,
       T.HANDLE_TIME
 FROM COUPLING_MAT_DEAL T
 WHERE 1=1 
       ]]>
	</query>
	<query id="FrmInformation.getQueryGX" desc="查询工序">
		<![CDATA[
		SELECT
          T.BASECODE,
       T.BASENAME
  FROM COM_BASE_INFO T
 WHERE T.SORTCODE = '7003'
   AND T.VALIDFLAG = '1'
		]]>
	</query>
	<query id="FrmOutManagJg.QUERYMatButterResult" desc="查询新增信息">
		<![CDATA[
	SELECT T.MAT_NO,
       T.RESULT_NO,
       T.WO_ID,
       T.ZY_PLAN_ID,
       B.PRO_PLAN_ID,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BL_WL_ID,
       T.BL_WL_DESC,
       T.MIN_D,
       T.MIN_H,
       T.CODE_JG,
       T.GRADECODE,
       T.GRADENAME,
       T.STEELCODE,
       T.STEELNAME,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.SPEC_JG,
       T.SPEC_JG_DESC,
       T.STYLE_JG,
       T.DIAMETER,
       T.CHECK_J_VAL,
       T.AIMLENGTH,
       T.SINGLEWEIGHT,
       T.MONITORDEMAND,
       T.IF_MONITOR_JG,
       T.PRDCR_NO,
       T.PRODUCER,
       B.MACH_NO,
       B.MACH_NM,
       t.PRO_NUM,
       t.PRO_WT,
       T.RRO_TIME,
       T.PRO_SHIFT,
       T.PRO_GROUP,
       '' DEMAND_COPPER,
       '' DEMAND_DETECTION,
       '' DEMAND_BLAST,
       '' DEMAND_BONDERIZING,
       B.CUST_ALPHA_NO,
       B.ORDER_SPECIAL_DESC,
       B.ALPHA_CODE,
       T.COL_OPERATOR,
       B.KEP_NO,
       B.STORAGE_NO,
       B.LOCATION_NO,
       B.STORAGE_ATTR,
       B.STORAGE_ATTR_NAME,
       B.STORAGE_TYPE_NO,
       B.STORAGE_TYPE_NAME,
       B.MANAGEMENT_NO,
       B.MANAGEMENT_NAME,
       B.PRODUCT_FLAG,
       B.MAT_STATUS,
       T.DETER_STATUS,
       T.CODE_JG_BL,
       T.CRAFT_FILE_NO,
       T.CRAFT_SEQ,
       T.BELONG_CODE,
       T.BELONG_NAME,
       T.COAT_TYPE,
       '' JG_ORDERNO,
       T2.ORDER_NO,
       T2.ORDER_SEQ,
       '' ORDER_SEQ_NO,
       T2.ORD_PK,
       T2.ORD_LN_PK,
       T2.ORD_LN_DLY_PK,
       T.QCM_STAUS,
       (SELECT NVL(SUM(M.PRO_NUM),0) FROM COUPLING_MAT_M M WHERE M.MAT_NO=T.MAT_NO) PRO_NUM_ALL,
       NVL(B.PIECES,0) PIECES,'' CRAFT_SEQ_ORD,'' CRAFT_FILE_NO_ORD,
       T.FLAG_STOVE_NO,T.STOVE_NO,T.MEMO,
       (SELECT C.BASENAME FROM COM_BASE_INFO C WHERE C.BASECODE=T.DETER_RESULTS) DETER_RESULTS
  FROM COUPLING_MAT_M T, COUPLING_MAT_BUTTRESS B,COUPLING_MAT_DEAL T2
 WHERE T.MAT_NO = B.MAT_NO and T.MAT_NO = T2.MAT_NO  and t2.DEAL_TYPE_CODE in ('800702','800703','800704','800709')
   AND B.MAT_NO_XH = ?
   AND T.MAT_NO = ?
		]]>
	</query>
	<query id="FrmOutManagJg.QUERYMatButterResultBF" desc="查询新增信息">
		<![CDATA[
	SELECT T.MAT_NO,
       T.RESULT_NO,
       T.WO_ID,
       T.ZY_PLAN_ID,
       B.PRO_PLAN_ID,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BL_WL_ID,
       T.BL_WL_DESC,
       T.MIN_D,
       T.MIN_H,
       T.CODE_JG,
       T.GRADECODE,
       T.GRADENAME,
       T.STEELCODE,
       T.STEELNAME,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.SPEC_JG,
       T.SPEC_JG_DESC,
       T.STYLE_JG,
       T.DIAMETER,
       T.CHECK_J_VAL,
       T.AIMLENGTH,
       T.SINGLEWEIGHT,
       T.MONITORDEMAND,
       T.IF_MONITOR_JG,
       T.PRDCR_NO,
       T.PRODUCER,
       B.MACH_NO,
       B.MACH_NM,
       NVL(T1.PLAN_NUM, 0) PRO_NUM,
       NVL(T1.PLAN_WT, 0) PRO_WT,
       T.RRO_TIME,
       T.PRO_SHIFT,
       T.PRO_GROUP,
       T1.DEMAND_COPPER,
       T1.DEMAND_DETECTION,
       T1.DEMAND_BLAST,
       T1.DEMAND_BONDERIZING,
       B.CUST_ALPHA_NO,
       B.ORDER_SPECIAL_DESC,
       B.ALPHA_CODE,
       T.COL_OPERATOR,
       B.KEP_NO,
       B.STORAGE_NO,
       B.LOCATION_NO,
       B.STORAGE_ATTR,
       B.STORAGE_ATTR_NAME,
       B.STORAGE_TYPE_NO,
       B.STORAGE_TYPE_NAME,
       B.MANAGEMENT_NO,
       B.MANAGEMENT_NAME,
       B.PRODUCT_FLAG,
       B.MAT_STATUS,
       T.DETER_STATUS,
       T.CODE_JG_BL,
       T.CRAFT_FILE_NO,
       T.CRAFT_SEQ,
       T.BELONG_CODE,
       T.BELONG_NAME,
       T.COAT_TYPE,
       T1.JG_ORDERNO,
       T1.ORDER_NO,
       T1.ORDER_SEQ,
       T1.ORDER_SEQ_NO,
       T1.ORD_PK,
       T1.ORD_LN_PK,
       T1.ORD_LN_DLY_PK,
       T.QCM_STAUS,
       (SELECT NVL(SUM(M.PRO_NUM),0) FROM COUPLING_MAT_M M WHERE M.MAT_NO=T.MAT_NO) PRO_NUM_ALL,
       NVL(B.PIECES,0) PIECES,T1.CRAFT_SEQ_ORD,T1.CRAFT_FILE_NO_ORD,
       T.FLAG_STOVE_NO,T.STOVE_NO,T.MEMO,
       (SELECT C.BASENAME FROM COM_BASE_INFO C WHERE C.BASECODE=T.DETER_RESULTS) DETER_RESULTS
  FROM COUPLING_MAT_M T, COUPLING_MAT_BUTTRESS B, PLN_ZY_JG_MIDDLE T1
 WHERE T.MAT_NO = B.MAT_NO
   AND T.MAT_NO = T1.MAT_NO
   AND B.MAT_NO_XH=T1.MAT_NO_XH
   AND T1.GUID = ?
   AND B.MAT_NO_XH = ?
   AND T.MAT_NO = ?
		]]>
	</query>
	<query id="FrmOutManagJg.AddDealResult" desc="新增交易信息">
		<![CDATA[ INSERT INTO COUPLING_MAT_DEAL(
        DEAL_ORDE,
        DEAL_TYPE_CODE,
        DEAL_TYPE_NAME,
        SOURCE_CODE,
        SOURCE_NAME,
        TAR_CODE,
        TAR_NAME,
        KEP_NO,
        MAT_NO,
        RESULT_NO,
        ZY_PLAN_ID,
        WO_ID,
        PRO_PLAN_ID,
        JG_GROUP_ID,
        PRO_PLAN_ID1,
        JG_GROUP_ID1,
        PLINE_CODE,
        PLINE_NAME,
        MAT_ORIGIN_CODE,
        MAT_ORIGIN_NAME,
        SOURE_CODE,
        SOURE_NAME,
        JUDGE_STOVE_NO,
        BATCH_NO,
        BL_WL_ID,
        BL_WL_DESC,
        MIN_D,
        MIN_H,
        CODE_JG,
        GRADECODE,
        GRADENAME,
        STEELCODE,
        STEELNAME,
        MODEL_CODE,
        MODEL_DESC,
        OUTDIAMETER,
        WALLTHICK,
        SPEC_JG,
        SPEC_JG_DESC,
        STYLE_JG,
        DIAMETER,
        CHECK_J_VAL,
        AIMLENGTH,
        SINGLEWEIGHT,
        MONITORDEMAND,
        IF_MONITOR_JG,
        PRDCR_NO,
        PRODUCER,
        PRODUCER_TIME,
        MACH_NO,
        MACH_NM,
        DEAL_NUM,
        DEAL_WT,
        BAL_YEAR_MONTH,
        F_IN_TIME,
        DEAL_TIME,
        STORAGE_NO,
        LOCATION_NO,
        STORAGE_ATTR,
        STORAGE_ATTR_NAME,
        STORAGE_TYPE_NO,
        STORAGE_TYPE_NAME,
        TAR_STORAGE_NO,
        TAR_LOCATION_NO,
        TAR_KEP_NO,
        TAR_STORAGE_ATTR,
        TAR_STORAGE_ATTR_NAME,
        TAR_STORAGE_TYPE_NO,
        TAR_STORAGE_TYPE_NAME,
        TAR_REC_FLAG,
        HAND_FLAG,
        DEMAND_COPPER,
        DEMAND_DETECTION,
        DEMAND_BLAST,
        DEMAND_BONDERIZING,
        CUST_ALPHA_NO,
        ORDER_SPECIAL_DESC,
        ALPHA_CODE,
        DETER_NO,
        DETER_RESULTS,
        COL_OPERATOR,
        MEMO,
        CREATE_NAME,
        CREATE_TIME,
        PRODUCT_FLAG,
        MAT_STATUS,
        DETER_STATUS,
        CODE_JG_BL,
        CRAFT_FILE_NO,
        CRAFT_SEQ,
        BELONG_CODE,
        BELONG_NAME,
        COAT_TYPE,MAT_NO_XH,QCM_STAUS,
        OUT_FLAG,JG_ORDERNO,ORDER_NO,
        ORDER_SEQ,DELIVERY_NO,ORD_PK,
        ORD_LN_PK,ORD_LN_DLY_PK, CRAFT_SEQ_ORD,CRAFT_FILE_NO_ORD,STOVE_NO,FLAG_STOVE_NO,GOWHERE_NAME)
 VALUES( 
        '#DEAL_ORDE#',
        '#DEAL_TYPE_CODE#',
        '#DEAL_TYPE_NAME#',
        '#SOURCE_CODE#',
        '#SOURCE_NAME#',
        '#TAR_CODE#',
        '#TAR_NAME#',
        '#KEP_NO#',
        '#MAT_NO#',
        '#RESULT_NO#',
        '#ZY_PLAN_ID#',
        '#WO_ID#',
        '#PRO_PLAN_ID#',
        '#JG_GROUP_ID#',
        '#PRO_PLAN_ID1#',
        '#JG_GROUP_ID1#',
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#MAT_ORIGIN_CODE#',
        '#MAT_ORIGIN_NAME#',
        '#SOURE_CODE#',
        '#SOURE_NAME#',
        '#JUDGE_STOVE_NO#',
        '#BATCH_NO#',
        '#BL_WL_ID#',
        '#BL_WL_DESC#',
        '#MIN_D#',
        '#MIN_H#',
        '#CODE_JG#',
        '#GRADECODE#',
        '#GRADENAME#',
        '#STEELCODE#',
        '#STEELNAME#',
        '#MODEL_CODE#',
        '#MODEL_DESC#',
        '#OUTDIAMETER#',
        '#WALLTHICK#',
        '#SPEC_JG#',
        '#SPEC_JG_DESC#',
        '#STYLE_JG#',
        '#DIAMETER#',
        '#CHECK_J_VAL#',
        '#AIMLENGTH#',
        '#SINGLEWEIGHT#',
        '#MONITORDEMAND#',
        '#IF_MONITOR_JG#',
        '#PRDCR_NO#',
        '#PRODUCER#',
        SYSDATE,
        '#MACH_NO#',
        '#MACH_NM#',
        '#DEAL_NUM#',
        '#DEAL_WT#',
        '#BAL_YEAR_MONTH#',
        SYSDATE,
        SYSDATE,
        '#STORAGE_NO#',
        '#LOCATION_NO#',
        '#STORAGE_ATTR#',
        '#STORAGE_ATTR_NAME#',
        '#STORAGE_TYPE_NO#',
        '#STORAGE_TYPE_NAME#',
        '#TAR_STORAGE_NO#',
        '#TAR_LOCATION_NO#',
        '#TAR_KEP_NO#',
        '#TAR_STORAGE_ATTR#',
        '#TAR_STORAGE_ATTR_NAME#',
        '#TAR_STORAGE_TYPE_NO#',
        '#TAR_STORAGE_TYPE_NAME#',
        '#TAR_REC_FLAG#',
        '#HAND_FLAG#',
        '#DEMAND_COPPER#',
        '#DEMAND_DETECTION#',
        '#DEMAND_BLAST#',
        '#DEMAND_BONDERIZING#',
        '#CUST_ALPHA_NO#',
        '#ORDER_SPECIAL_DESC#',
        '#ALPHA_CODE#',
        '#DETER_NO#',
        '#DETER_RESULTS#',
        '#COL_OPERATOR#',
        '#MEMO#',
        '#CREATE_NAME#',
        TO_DATE('#CREATE_TIME#','YYYY-MM-DD HH24:MI:SS'),
        '#PRODUCT_FLAG#',
        '#MAT_STATUS#',
        '#DETER_STATUS#',
        '#CODE_JG_BL#',
        '#CRAFT_FILE_NO#',
        '#CRAFT_SEQ#',
        '#BELONG_CODE#',
        '#BELONG_NAME#',
        '#COAT_TYPE#','#MAT_NO_XH#','#QCM_STAUS#',
        '#OUT_FLAG#','#JG_ORDERNO#','#ORDER_NO#',
        '#ORDER_SEQ#','#DELIVERY_NO#','#ORD_PK#',
        '#ORD_LN_PK#','#ORD_LN_DLY_PK#',
        '#CRAFT_SEQ_ORD#','#CRAFT_FILE_NO_ORD#','#STOVE_NO#','#FLAG_STOVE_NO#','#GOWHERE_NAME#')
		]]>
	</query>
	<query id="FrmOutManagJg.AddButterResult" desc="新增位置表">
		<![CDATA[
INSERT INTO COUPLING_MAT_BUTTRESS
  (MAT_NO,
   MAT_NO_XH,
   PRODUCT_FLAG,
   MAT_STATUS,
   PRO_PLAN_ID,
   JG_GROUP_ID,
   PRO_PLAN_ID1,
   JG_GROUP_ID1,
   MACH_NO,
   MACH_NM,
   MAT_ORIGIN_CODE,
   MAT_ORIGIN_NAME,
   SOURE_CODE,
   SOURE_NAME,
   PIECES,
   WEIGHT,
   CUST_ALPHA_NO,
   ORDER_SPECIAL_DESC,
   ALPHA_CODE,
   DEAL_ORDE,
   KEP_NO,
   STORAGE_NO,
   LOCATION_NO,
   STORAGE_ATTR,
   STORAGE_ATTR_NAME,
   STORAGE_TYPE_NO,
   STORAGE_TYPE_NAME,
   MANAGEMENT_NO,
   MANAGEMENT_NAME,
   MEMO,
   CREATE_NAME,
   CREATE_TIME)
VALUES
  ('#MAT_NO#',
   '#MAT_NO_XH#',
   '#PRODUCT_FLAG#',
   '#MAT_STATUS#',
   '#PRO_PLAN_ID#',
   '#JG_GROUP_ID#',
   '#PRO_PLAN_ID1#',
   '#JG_GROUP_ID1#',
   '#MACH_NO#',
   '#MACH_NM#',
   '#MAT_ORIGIN_CODE#',
   '#MAT_ORIGIN_NAME#',
   '#SOURE_CODE#',
   '#SOURE_NAME#',
   '#PIECES#',
   '#WEIGHT#',
   '#CUST_ALPHA_NO#',
   '#ORDER_SPECIAL_DESC#',
   '#ALPHA_CODE#',
   '#DEAL_ORDE#',
   '#KEP_NO#',
   '#STORAGE_NO#',
   '#LOCATION_NO#',
   '#STORAGE_ATTR#',
   '#STORAGE_ATTR_NAME#',
   '#STORAGE_TYPE_NO#',
   '#STORAGE_TYPE_NAME#',
   '#MANAGEMENT_NO#',
   '#MANAGEMENT_NAME#',
   '#MEMO#',
   '#CREATE_NAME#',
   TO_DATE('#CREATE_TIME#','YYYY-MM-DD HH24:MI:SS'))

	]]>
	</query>
	<query id="FrmOutManagJg.AddMatResult" desc="新增材料表">
		<![CDATA[
		INSERT INTO COUPLING_MAT_M
  (MAT_NO,
   RESULT_NO,
   ZY_PLAN_ID,
   WO_ID,
   PLINE_CODE,
   PLINE_NAME,
   JUDGE_STOVE_NO,
   BATCH_NO,
   BL_WL_ID,
   MIN_D,
   MIN_H,
   CODE_JG,
   GRADECODE,
   GRADENAME,
   STEELCODE,
   STEELNAME,
   MODEL_CODE,
   MODEL_DESC,
   OUTDIAMETER,
   WALLTHICK,
   SPEC_JG,
   SPEC_JG_DESC,
   STYLE_JG,
   DIAMETER,
   CHECK_J_VAL,
   AIMLENGTH,
   SINGLEWEIGHT,
   MONITORDEMAND,
   IF_MONITOR_JG,
   PRDCR_NO,
   PRODUCER,
   PRO_NUM,
   PRO_WT,
   COL_OPERATOR,
   RRO_TIME,
   PRO_SHIFT,
   PRO_GROUP,
   CREATE_NAME,
   CREATE_TIME,
   F_IN_TIME,
   BL_WL_DESC,
   MEMO,
   DEMAND_DETECTION,
   DEMAND_BLAST,
   DEMAND_BONDERIZING,
   DEMAND_COPPER,
   COAT_TYPE,
   BELONG_CODE,
   BELONG_NAME,
   CODE_JG_BL,
   CRAFT_FILE_NO,
   CRAFT_SEQ,
   LOCK_FLAG,
   MNG_LOCK_FLAG,
   MNG_LOCK_REMARK,
   LOCK_REMARK,
   DETER_STATUS,
   DETER_NO,
   DETER_RESULTS,
   FINAL_USER_DESC,
   MAT_ORIGIN_CODE,
   MAT_ORIGIN_NAME,
   SOURE_CODE,
   SOURE_NAME,
   JUDGE_STD_NAME,
   LOCK_LIKU,
   DETER_NO_SEQ,
   QCM_STAUS,
   FAIL_NUM,
   FAIL_WT,
   ORD_LN_DLY_PK,
   ORDER_NO,
   ORDER_SEQ,
   DELIVERY_NO,
   STOVE_NO,
   FLAG_STOVE_NO,JUDGE_RESULT,JUDGE_RESULT_TIME,JUDGE_MAKER,JUDGE_TOLRESULT_CODE,JUDGE_TOLRESULT,JUDGE_TOLRESULT_TIME,
   JUDGE_TOLMAKER,JUGDE_TOLCONVICTED,JUGDE_CONVICTED,ZBS_ID,ZBS_FLAG,JUDGE_RESULT_CODE,PRODUCCODE_JG,PRODUCCODE_JG_DESC)
  SELECT MAT_NO,
         RESULT_NO,
         ZY_PLAN_ID,
         WO_ID,
         PLINE_CODE,
         PLINE_NAME,
         JUDGE_STOVE_NO,
         BATCH_NO,
         BL_WL_ID,
         MIN_D,
         MIN_H,
         CODE_JG,
         GRADECODE,
         GRADENAME,
         STEELCODE,
         STEELNAME,
         MODEL_CODE,
         MODEL_DESC,
         OUTDIAMETER,
         WALLTHICK,
         SPEC_JG,
         SPEC_JG_DESC,
         STYLE_JG,
         DIAMETER,
         CHECK_J_VAL,
         AIMLENGTH,
         SINGLEWEIGHT,
         MONITORDEMAND,
         IF_MONITOR_JG,
         PRDCR_NO,
         PRODUCER,
         ?,
         ?,
         COL_OPERATOR,
         RRO_TIME,
         PRO_SHIFT,
         PRO_GROUP,
         CREATE_NAME,
         CREATE_TIME,
         F_IN_TIME,
         BL_WL_DESC,
         MEMO,
         DEMAND_DETECTION,
         DEMAND_BLAST,
         DEMAND_BONDERIZING,
         DEMAND_COPPER,
         COAT_TYPE,
         BELONG_CODE,
         BELONG_NAME,
         CODE_JG_BL,
         CRAFT_FILE_NO,
         CRAFT_SEQ,
         LOCK_FLAG,
         MNG_LOCK_FLAG,
         MNG_LOCK_REMARK,
         LOCK_REMARK,
         DETER_STATUS,
         DETER_NO,
         DETER_RESULTS,
         FINAL_USER_DESC,
         MAT_ORIGIN_CODE,
         MAT_ORIGIN_NAME,
         SOURE_CODE,
         SOURE_NAME,
         JUDGE_STD_NAME,
         LOCK_LIKU,
         DETER_NO_SEQ,
         QCM_STAUS,
         FAIL_NUM,
         FAIL_WT,
         ORD_LN_DLY_PK,
         ORDER_NO,
         ORDER_SEQ,
         DELIVERY_NO,
         STOVE_NO,
         FLAG_STOVE_NO,JUDGE_RESULT,JUDGE_RESULT_TIME,JUDGE_MAKER,JUDGE_TOLRESULT_CODE,JUDGE_TOLRESULT,JUDGE_TOLRESULT_TIME,
   JUDGE_TOLMAKER,JUGDE_TOLCONVICTED,JUGDE_CONVICTED,ZBS_ID,ZBS_FLAG,JUDGE_RESULT_CODE,PRODUCCODE_JG,PRODUCCODE_JG_DESC
    FROM COUPLING_MAT_BACKUP
   WHERE MAT_NO =?
		]]>
	</query>
	<query id="FrmOutManagJg.queryRecFalg" desc="查询交易表该数据接收状态">
		<![CDATA[
		SELECT T.TAR_REC_FLAG FROM COUPLING_MAT_DEAL T WHERE T.DEAL_ORDE = ?
			]]>
	</query>

		<query id="FrmOutManagJg.queryMaxDealOrde" desc="查询最大交易单号">
	 <![CDATA[  
SELECT ? || ? ||
       LPAD(SUBSTR(NVL(MAX(T.DEAL_ORDE), '000'), -3, 3) + 1, 3, '0') AS DEAL_ORDE
  FROM COUPLING_MAT_DEAL T
 WHERE  TO_CHAR(T.CREATE_TIME,'YYYY-MM-DD')=?
 AND T.DEAL_TYPE_CODE=?
   ]]>
	</query>
		<query id="FrmOutManagJg.queryMaxButter" desc="查询最大交易单号">
	 <![CDATA[  
SELECT LPAD(SUBSTR(NVL(MAX(T.MAT_NO_XH), '000'), -3, 3) + 1, 3, '0') AS MAT_NO_XH
  FROM COUPLING_MAT_BUTTRESS T
 WHERE T.MAT_NO = ?
   ]]>
	</query>
		<query id="FrmOutManagJg.queryStorageType" desc="查询库位信息">
	 <![CDATA[ 
SELECT T.STORAGE_ATTR,
       T.STORAGE_ATTR_NAME,
       T.STORAGE_TYPE_NO,
       T.STORAGE_TYPE_NAME,
       T.MANAGEMENT_NO,
       T.MANAGEMENT_NAME,
       T.STORAGE_NO,
       T.LOCATION_NO
  FROM COUPLING_MAT_BUTTRESS T
 WHERE T.MAT_NO = ?
   AND T.MAT_NO_XH = ?
	  ]]>
	</query>
	<query id="FrmOutManagJg.AddPlnZyJgMidd" desc="新增接箍工单详细表">
	  <![CDATA[
	INSERT INTO PLN_ZY_JG_MIDDLE
  (WO_ID,
   JG_ORDERNO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   BATCH_GROUD_NO,
   PLINE_CODE,
   PLINE_NAME,
   DEMAND_COPPER,
   DEMAND_DETECTION,
   DEMAND_BLAST,
   DEMAND_BONDERIZING,
   PLAN_NUM,
   PLAN_WT,
   STOVE_NO,
   FLAG_STOVE_NO,
   STEELCODE,
   STEELNAME,
   GRADECODE,
   GRADENAME,
   SPEC_JG_DESC,
   SPEC_JG,
   STYLE_JG,
   STD_CODE,
   STD_NAME,
   STD_STYLE,
   STD_STYLE_DESC,
   PRODUCCODE_JG,
   PRODUCCODE_JG_DESC,
   CODE_JG,
   MODEL_CODE,
   MODEL_DESC,
   IF_MONITOR_JG,
   PRDCR_NO,
   STATUS,
   MEMO,
   CREATE_NAME,
   CREATE_TIME,
   ORDER_NO,
   ORDER_SEQ,
   ORDER_SEQ_NO,
   ORD_PK,
   ORD_LN_PK,
   ORD_LN_DLY_PK,
   MAT_NO,
   CRAFT_SEQ_ORD,
   CRAFT_FILE_NO_ORD,MAT_NO_XH)
  SELECT T.WO_ID,
         ?,
         T.JUDGE_STOVE_NO,
         T.BATCH_NO,
         '',
         T.PLINE_CODE,
         T.PLINE_NAME,
         T.DEMAND_COPPER,
         T.DEMAND_DETECTION,
         T.DEMAND_BLAST,
         T.DEMAND_BONDERIZING,
         ?,
         ?,
         T.STOVE_NO,
         T.FLAG_STOVE_NO,
         T.STEELCODE,
         T.STEELNAME,
         T.GRADECODE,
         T.GRADENAME,
         T.SPEC_JG_DESC,
         T.SPEC_JG,
         T.STYLE_JG,
         T1.STD_CODE,
         T1.STD_NAME,
         T1.STD_STYLE,
         T1.STD_STYLE_DESC,
         T1.PRODUCCODE_JG,
         T1.PRODUCCODE_JG_DESC,
         T.CODE_JG,
         T.MODEL_CODE,
         T.MODEL_DESC,
         T.IF_MONITOR_JG,
         T.PRDCR_NO,
         '0',
         ?,
         ?,
         SYSDATE,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         T.MAT_NO,
         ?,
         ?,?
    FROM COUPLING_MAT_M T, COM_MSC_JG T1
   WHERE T.CODE_JG = T1.CODE_JG(+)
     AND T.MAT_NO = ?
	   ]]>
	</query>
	<query id="FrmOutManagJg.AddMatBack" desc="新增库存备份表">
		<![CDATA[
		INSERT INTO COUPLING_MAT_BACKUP
  (MAT_NO,
   RESULT_NO,
   ZY_PLAN_ID,
   WO_ID,
   PLINE_CODE,
   PLINE_NAME,
   JUDGE_STOVE_NO,
   BATCH_NO,
   BL_WL_ID,
   MIN_D,
   MIN_H,
   CODE_JG,
   GRADECODE,
   GRADENAME,
   STEELCODE,
   STEELNAME,
   MODEL_CODE,
   MODEL_DESC,
   OUTDIAMETER,
   WALLTHICK,
   SPEC_JG,
   SPEC_JG_DESC,
   STYLE_JG,
   DIAMETER,
   CHECK_J_VAL,
   AIMLENGTH,
   SINGLEWEIGHT,
   MONITORDEMAND,
   IF_MONITOR_JG,
   PRDCR_NO,
   PRODUCER,
   PRO_NUM,
   PRO_WT,
   COL_OPERATOR,
   RRO_TIME,
   PRO_SHIFT,
   PRO_GROUP,
   CREATE_NAME,
   CREATE_TIME,
   F_IN_TIME,
   BL_WL_DESC,
   MEMO,
   DEMAND_DETECTION,
   DEMAND_BLAST,
   DEMAND_BONDERIZING,
   DEMAND_COPPER,
   COAT_TYPE,
   BELONG_CODE,
   BELONG_NAME,
   CODE_JG_BL,
   CRAFT_FILE_NO,
   CRAFT_SEQ,
   LOCK_FLAG,
   MNG_LOCK_FLAG,
   MNG_LOCK_REMARK,
   LOCK_REMARK,
   DETER_STATUS,
   DETER_NO,
   DETER_RESULTS,
   FINAL_USER_DESC,
   MAT_ORIGIN_CODE,
   MAT_ORIGIN_NAME,
   SOURE_CODE,
   SOURE_NAME,
   JUDGE_STD_NAME,
   LOCK_LIKU,
   DETER_NO_SEQ,
   QCM_STAUS,
   FAIL_NUM,
   FAIL_WT,
   ORD_LN_DLY_PK,
   ORDER_NO,
   ORDER_SEQ,
   DELIVERY_NO,
   STOVE_NO,
   FLAG_STOVE_NO,JUDGE_RESULT,JUDGE_RESULT_TIME,JUDGE_MAKER,JUDGE_TOLRESULT_CODE,JUDGE_TOLRESULT,JUDGE_TOLRESULT_TIME,
   JUDGE_TOLMAKER,JUGDE_TOLCONVICTED,JUGDE_CONVICTED,ZBS_ID,ZBS_FLAG,JUDGE_RESULT_CODE,PRODUCCODE_JG,PRODUCCODE_JG_DESC
   )
  SELECT MAT_NO,
         RESULT_NO,
         ZY_PLAN_ID,
         WO_ID,
         PLINE_CODE,
         PLINE_NAME,
         JUDGE_STOVE_NO,
         BATCH_NO,
         BL_WL_ID,
         MIN_D,
         MIN_H,
         CODE_JG,
         GRADECODE,
         GRADENAME,
         STEELCODE,
         STEELNAME,
         MODEL_CODE,
         MODEL_DESC,
         OUTDIAMETER,
         WALLTHICK,
         SPEC_JG,
         SPEC_JG_DESC,
         STYLE_JG,
         DIAMETER,
         CHECK_J_VAL,
         AIMLENGTH,
         SINGLEWEIGHT,
         MONITORDEMAND,
         IF_MONITOR_JG,
         PRDCR_NO,
         PRODUCER,
         ?,
         ?,
         COL_OPERATOR,
         RRO_TIME,
         PRO_SHIFT,
         PRO_GROUP,
         CREATE_NAME,
         CREATE_TIME,
         F_IN_TIME,
         BL_WL_DESC,
         MEMO,
         DEMAND_DETECTION,
         DEMAND_BLAST,
         DEMAND_BONDERIZING,
         DEMAND_COPPER,
         COAT_TYPE,
         BELONG_CODE,
         BELONG_NAME,
         CODE_JG_BL,
         CRAFT_FILE_NO,
         CRAFT_SEQ,
         LOCK_FLAG,
         MNG_LOCK_FLAG,
         MNG_LOCK_REMARK,
         LOCK_REMARK,
         DETER_STATUS,
         DETER_NO,
         DETER_RESULTS,
         FINAL_USER_DESC,
         MAT_ORIGIN_CODE,
         MAT_ORIGIN_NAME,
         SOURE_CODE,
         SOURE_NAME,
         JUDGE_STD_NAME,
         LOCK_LIKU,
         DETER_NO_SEQ,
         QCM_STAUS,
         FAIL_NUM,
         FAIL_WT,
         ORD_LN_DLY_PK,
         ORDER_NO,
         ORDER_SEQ,
         DELIVERY_NO,
         STOVE_NO,
         FLAG_STOVE_NO,JUDGE_RESULT,JUDGE_RESULT_TIME,JUDGE_MAKER,JUDGE_TOLRESULT_CODE,JUDGE_TOLRESULT,JUDGE_TOLRESULT_TIME,
   JUDGE_TOLMAKER,JUGDE_TOLCONVICTED,JUGDE_CONVICTED,ZBS_ID,ZBS_FLAG,JUDGE_RESULT_CODE,PRODUCCODE_JG,PRODUCCODE_JG_DESC
    FROM COUPLING_MAT_M
   WHERE MAT_NO = ?
		  ]]>
	</query>
	<query id="FrmOutManagJg.getGoWhereName" desc="查询成品去向">
		<![CDATA[
		SELECT T.PLINE_CODE,T.PLINE_NAME FROM PLN_ORDER_JGX_S T WHERE T.ORD_LN_DLY_PK =?  GROUP BY T.PLINE_CODE,T.PLINE_NAME   ORDER BY T.PLINE_CODE ASC
		  ]]>
	</query>
	<query id="FrmOutManagJg.getQureyJgOrder" desc="查询工单对应接箍成品合同">
	  <![CDATA[
	  
SELECT T.JG_ORDERNO,
       T.ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.BUYER_ID,
       T.BUYER_NAME,
       TO_CHAR(T.DELVRY_BDATE, 'YYYY-MM-DD HH24:MI:SS') DELVRY_BDATE,
       TO_CHAR(T.DELVRY_EDATE, 'YYYY-MM-DD HH24:MI:SS') DELVRY_EDATE,
       T.ORDERCONTACT,
       T.MONITORDEMAND,
       T.IF_MONITOR_JG,
       T.PRDCR_NO,
       T.PSC,
       T.MSC,
       T.INDEX_SEQ,
       T.CODE_JG,
       T.STEELCODE,
       T.STEELNAME,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.AIMWALLTHICK,
       T.MODEL_CODE,
       T.AIMLENGTH,
       T.SINGLEWEIGHT,
       T.ORDERWEIGHT,
       T.ORDERNUM,
       TO_CHAR(T.LATEST_PROD_DATE, 'YYYY-MM-DD HH24:MI:SS') LATEST_PROD_DATE,
       T.MATCHWEIGHT,
       T.MATCHNUM,
       T.IFBUYPLAN,
       T.BUYPLANID,
       T.BUYPLANWEIGHT,
       T.BUYPLANNUM,
       T.JGORDERSTATUS,
       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.GROUP_JGX,
       T.JGWT_BLREQ,
       TO_CHAR(T.ISSUED_TIME, 'YYYY-MM-DD HH24:MI:SS') ISSUED_TIME,
       T.SPEC_JG,
       T.SPEC_JG_DESC,
       T.MODEL_DESC,
       T.STYLE_JG,
       T.DIAMETER,
       T.CHECK_J_VAL,
       T.ORD_LN_DLY_PK,
       T.DEMAND_DETECTION,
       T.DEMAND_BONDERIZING,
       T.DEMAND_COPPER,
       T.DEMAND_BLAST,
       T.PRO_PLAN_ID,
       T.KEY_JG,
       T.JG_GROUP_ID,
       T.FINAL_USER,
       T.FINAL_USER_DESC,
       T.IF_JG_SALEORD,
       T.PRO_PLAN_ID_S,
       T.WO_ID,
       T.KEY,
       T.STATUS,
       NVL(T.HANGKC_NUM, 0) HANGKC_NUM,
      (SELECT MAX(T1.CRAFT_FILE_NO) FROM PLN_SALEORD_PROC T1 WHERE T1.ORD_LN_DLY_PK=T.ORD_LN_DLY_PK) CRAFT_FILE_NO,
      (SELECT MAX(T1.CRAFT_SEQ) FROM PLN_SALEORD_PROC T1 WHERE T1.ORD_LN_DLY_PK=T.ORD_LN_DLY_PK) CRAFT_SEQ
  FROM PLN_ORDER_JG T
 WHERE T.JG_ORDERNO=?
	    ]]>
	</query>
	<query id="FrmOutManagJg.UpdateDeal" desc="修改交易表原名FrmInformation前缀，应该有问题修改">
		<![CDATA[
	UPDATE COUPLING_MAT_DEAL T
   SET T.JG_ORDERNO        =  '#JG_ORDERNO#',
       T.ORDER_NO          =  '#ORDER_NO#',
       T.ORDER_SEQ         =  '#ORDER_SEQ#',
       T.DELIVERY_NO       =  '#DELIVERY_NO#',
       T.ORD_PK            =  '#ORD_PK#',
       T.ORD_LN_PK         =  '#ORD_LN_PK#',
       T.ORD_LN_DLY_PK     =  '#ORD_LN_DLY_PK#',
       T.CRAFT_SEQ_ORD     =  '#CRAFT_SEQ_ORD#',
       T.CRAFT_FILE_NO_ORD =  '#CRAFT_FILE_NO_ORD#',
       T.GOWHERE_NAME      =  '#GOWHERE_NAME#'
 WHERE T.DEAL_ORDE = ?
		]]>
	</query>
	<query id="FrmOutManagJg.UpdateCouplingDeal" desc="更新接箍领用出库">
		<![CDATA[
	UPDATE COUPLING_MAT_DEAL T
   SET T.BACK_NUM    = TO_NUMBER(NVL(T.BACK_NUM，0)) + TO_NUMBER(?),
       T.BACK_WT     = TO_NUMBER(NVL(T.BACK_WT, 0)) + TO_NUMBER(?),
       T.HANDLE_FLAG = CASE
                         WHEN NVL(T.DEAL_NUM, 0) - NVL(T.USED_NUM, 0) -
                              NVL(T.FAILL_NUM, 0) - NVL(T.BACK_NUM, 0) -
                              NVL(?, 0) = 0 THEN
                          '1'
                         ELSE
                          '0'
                       END
 WHERE T.DEAL_ORDE = ?
		]]>
	</query>
	<query id="FrmOutManagJg.UpdateHandleflag" desc="修改处理标识">
		<![CDATA[
	UPDATE COUPLING_MAT_DEAL T
   SET T.HANDLE_NAME = ?, T.HANDLE_TIME = SYSDATE, T.HANDLE_FLAG = ?
 WHERE T.DEAL_ORDE = ?
		]]>
	</query>
</queryMap>