<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="接箍公共信息">
	<query id="FrmCollarOutventory.queryInventory" desc="查询接箍材料信息">		
        <![CDATA[
 SELECT J.MAT_NO,
       J.RESULT_NO,
       J.ZY_PLAN_ID,
       J.PRO_PLAN_ID,
       J.PLINE_NAME,
       J.PLINE_CODE,
       J.JUDGE_STOVE_NO,
       J.BATCH_NO,
       J.BL_WL_DESC,
       J.MIN_D,
       J.MIN_H,
       J.CODE_JG,
       J.GRADENAME,
       J.STEELNAME,
       J.MODEL_DESC,
       J.OUTDIAMETER,
       J.WALLTHICK,
       J.SPEC_JG_DESC,
       J.AIMLENGTH,
       J.SINGLEWEIGHT,
       TO_CHAR(J.RRO_TIME, 'YYYY-MM-DD HH24:MI:SS') RRO_TIME,
       DECODE(J.PRO_GROUP, '1', '甲', '2', '乙', '3', '丙', '4', '丁') PRO_GROUP,
       DECODE(J.PRO_SHIFT, '0', '常白', '1', '早', '2', '中', '3', '晚') PRO_SHIFT,
       J.CREATE_NAME,
       TO_CHAR(J.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       J.KEP_NO,
       J.STORAGE_NO,
       (SELECT B.STORAGE_NAME
          FROM YDM_BS_STORAGE B
         WHERE B.STORAGE_NO = J.STORAGE_NO
           AND B.VALIDFLAG = '1') STORAGE_NAME,
       J.LOCATION_NO,
       J.WO_ID,
       J.MAT_NO_XH,
       J.JG_ORDERNO,
       J.GUID,
       J.ORDER_NO,
       J.ORDER_SEQ_NO,
       (SELECT B.BASENAME
          FROM COM_BASE_INFO B
         WHERE B.BASECODE = J.PRODUCT_FLAG) PRODUCT_FLAG,
       (SELECT B.BASENAME
          FROM COM_BASE_INFO B
         WHERE B.BASECODE = J.MAT_STATUS) MAT_STATUS,
       J.PRO_NUM,
       J.PRO_WT,
       NVL(J.PRO_NUM, 0) PLA_COUNT,
       NVL(J.PRO_WT, 0) PLA_WEIGHT
  FROM (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.CODE_JG,
               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,
               T.RRO_TIME,
               T.PRO_GROUP,
               T.PRO_SHIFT,
               T.CREATE_NAME,
               T.CREATE_TIME,
               T1.KEP_NO,
               T1.STORAGE_NO,
               T1.LOCATION_NO,
               T.WO_ID,
               T1.MAT_NO_XH,
               '' JG_ORDERNO,
               '' GUID,
               '' ORDER_NO,
               '' ORDER_SEQ_NO,
               T1.PRODUCT_FLAG,
               T1.MAT_STATUS,
               TO_NUMBER(NVL(T1.PIECES, 0)) -
               (SELECT NVL(SUM(JG.PLAN_NUM), 0)
                  FROM PLN_ZY_JG_MIDDLE JG
                 WHERE JG.MAT_NO = T1.MAT_NO
                   AND JG.MAT_NO_XH = T1.MAT_NO_XH) PRO_NUM,
               TO_NUMBER(NVL(T1.WEIGHT, 0)) -
               (SELECT NVL(SUM(JG.PLAN_WT), 0)
                  FROM PLN_ZY_JG_MIDDLE JG
                 WHERE JG.MAT_NO = T1.MAT_NO
                   AND JG.MAT_NO_XH = T1.MAT_NO_XH) PRO_WT
          FROM COUPLING_MAT_M T, COUPLING_MAT_BUTTRESS T1
         WHERE T.MAT_NO = T1.MAT_NO
           AND 1 = 1
        UNION ALL
        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.CODE_JG,
               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,
               T.RRO_TIME,
               T.PRO_GROUP,
               T.PRO_SHIFT,
               T.CREATE_NAME,
               T.CREATE_TIME,
               T1.KEP_NO,
               T1.STORAGE_NO,
               T1.LOCATION_NO,
               T.WO_ID,
               T1.MAT_NO_XH,
               M.JG_ORDERNO,
               M.GUID,
               M.ORDER_NO || '/' || M.ORDER_SEQ ORDER_NO,
               M.ORDER_SEQ_NO,
               T1.PRODUCT_FLAG,
               T1.MAT_STATUS,
               NVL(M.PLAN_NUM, 0) PRO_NUM,
               NVL(M.PLAN_WT, 0) PRO_WT
          FROM COUPLING_MAT_M        T,
               COUPLING_MAT_BUTTRESS T1,
               PLN_ZY_JG_MIDDLE      M
         WHERE T.MAT_NO = T1.MAT_NO
           AND T1.MAT_NO = M.MAT_NO
           AND T1.MAT_NO_XH = M.MAT_NO_XH
           AND 1 = 1) J
 WHERE J.PRO_NUM > 0
        ]]>
	</query>
	<query id="FrmCollarOutventory.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,
       T.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,
       T.DEAL_NUM,
       T.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,
       T.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(T.TAR_REC_FLAG, '0', '未接收', '1', '已接收') TAR_REC_FLAG,
        DECODE(T.HAND_FLAG, '0', '自动', '1', '人工') HAND_FLAG,
       T.DEMAND_COPPER,
       T.DEMAND_DETECTION,
       T.DEMAND_BLAST,
       T.DEMAND_BONDERIZING,
       T.CUST_ALPHA_NO,
       T.ORDER_SPECIAL_DESC,
       T.ALPHA_CODE,
       T.DETER_NO,
       T.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,
       T.PRODUCT_FLAG,
       T.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,
       T.MAT_NO_XH,
       T.QCM_STAUS,
       T.USED_NUM,
       T.USED_WT,
       T.FAILL_NUM,
       T.FAILL_WT,
       T.BACK_NUM,
       T.BACK_WT,
       T.OUT_FLAG,
       T.JG_ORDERNO,
       T.ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.ORD_PK,
       T.ORD_LN_PK,
       T.ORD_LN_DLY_PK,
       T.CRAFT_SEQ_ORD,
       T.CRAFT_FILE_NO_ORD,
       T.STOVE_NO,
       T.FLAG_STOVE_NO
 FROM COUPLING_MAT_DEAL T
 WHERE 1=1
       ]]>
	</query>
	<query id="FrmInformation.getQueryGX" desc="查询工序">
		<![CDATA[
		SELECT 
          T.BASECODE,   
       END BASECODE,
       T.BASENAME
  FROM COM_BASE_INFO T
 WHERE T.SORTCODE = '7003'
   AND T.VALIDFLAG = '1'
		]]>
	</query>
	<query id="FrmCollarOutventory.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,
       nvl(B.PIECES,0) PRO_NUM,
       nvl(B.WEIGHT,0) PRO_WT,
       T.RRO_TIME,
       T.PRO_SHIFT,
       T.PRO_GROUP,
       T.DEMAND_COPPER,
       T.DEMAND_DETECTION,
       T.DEMAND_BLAST,
       T.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,
       T.FLAG_STOVE_NO,
       T.STOVE_NO,
       T.MEMO,
       T.DETER_RESULTS,
       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
  FROM COUPLING_MAT_M T, COUPLING_MAT_BUTTRESS B
 WHERE T.MAT_NO = B.MAT_NO
   AND B.MAT_NO_XH = ?
   AND T.MAT_NO=?
		]]>
	</query>
	<query id="FrmCollarOutventory.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)
 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#')
    ]]>
	</query>
	<query id="FrmCollarOutventory.updateButterResult" desc="修改位置表">
		<![CDATA[
UPDATE COUPLING_MAT_BUTTRESS
   SET PIECES      = TO_NUMBER(NVL(PIECES,0)) - TO_NUMBER(?),
       WEIGHT      = TO_NUMBER(NVL(WEIGHT,0)) - TO_NUMBER(?),
       UPDATE_NAME = ?,
       UPDATE_TIME = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS')
 WHERE MAT_NO = ?
   AND MAT_NO_XH=?

	]]>
	</query>
	<query id="FrmCollarOutventory.deleteButter" desc="删除位置表">
		<![CDATA[
DELETE COUPLING_MAT_BUTTRESS
 WHERE  MAT_NO = ?
   AND MAT_NO_XH=?
	]]>
	</query>
	<query id="FrmCollarOutventory.deleteDealResult" desc="删除交易信息">
		<![CDATA[
		DELETE COUPLING_MAT_DEAL WHERE DEAL_ORDE = ?
		]]>
	</query>
	<query id="FrmCollarOutventory.AddButterResult" desc="新增位置表">
		<![CDATA[
INSERT INTO COUPLING_MAT_BUTTRESS
  (KEP_NO,
   MAT_NO,
   PIECES,
   WEIGHT,
   STORAGE_NO,
   LOCATION_NO,
   STORAGE_ATTR,
   STORAGE_ATTR_NAME,
   STORAGE_TYPE_NO,
   STORAGE_TYPE_NAME,
   MANAGEMENT_NO,
   MANAGEMENT_NAME,
   CREATE_NAME,
   CREATE_TIME,
   PRODUCT_FLAG,
   MAT_STATUS,
   MACH_NO,
   MACH_NM,
   MAT_ORIGIN_CODE,
   MAT_ORIGIN_NAME,
   SOURE_CODE,
   SOURE_NAME,
   CUST_ALPHA_NO,
   ORDER_SPECIAL_DESC,
   ALPHA_CODE,
   MAT_NO_XH)
  SELECT T.KEP_NO,
         T.MAT_NO,
         T.DEAL_NUM,
         T.DEAL_WT,
         T.STORAGE_NO,
         T.LOCATION_NO,
         T.STORAGE_ATTR,
         T.STORAGE_ATTR_NAME,
         T.STORAGE_TYPE_NO,
         T.STORAGE_TYPE_NAME,
         T.SOURCE_CODE,
         T.SOURCE_NAME,
         ?,
         TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
         T.PRODUCT_FLAG,
         T.MAT_STATUS,
         T.MACH_NO,
         T.MACH_NM,
         T.MAT_ORIGIN_CODE,
         T.MAT_ORIGIN_NAME,
         T.SOURE_CODE,
         T.SOURE_NAME,
         T.CUST_ALPHA_NO,
         T.ORDER_SPECIAL_DESC,
         T.ALPHA_CODE,
         ?
    FROM COUPLING_MAT_DEAL T
   WHERE T.DEAL_ORDE = ?


	]]>
	</query>
	<query id="FrmCollarOutventory.queryRecFalg" desc="查询交易表该数据接收状态">
		<![CDATA[
		SELECT T.TAR_REC_FLAG FROM COUPLING_MAT_DEAL T WHERE T.DEAL_ORDE = ?
			]]>
	</query>
	<query id="FrmCollarOutventory.updateButter" desc="修改位置表">
		<![CDATA[
UPDATE COUPLING_MAT_BUTTRESS
   SET PIECES      = TO_NUMBER(NVL(PIECES,0)) + TO_NUMBER(?),
       WEIGHT      = TO_NUMBER(NVL(WEIGHT,0)) + TO_NUMBER(?),
       UPDATE_NAME = ?,
       UPDATE_TIME = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS')
 WHERE  MAT_NO = ?
   AND STORAGE_NO=?
	]]>
	</query>
	<query id="FrmCollarOutventory.queryButterResult" desc="查询位置表">
		<![CDATA[
		SELECT COUNT(*) COUNT
  FROM COUPLING_MAT_BUTTRESS T
 WHERE T.MAT_NO = ?
   AND T.STORAGE_NO = ?	
		]]>
	</query>
	<query id="FrmCollarOutventory.deleteMat" desc="删除材料表">
		<![CDATA[
DELETE COUPLING_MAT_M WHERE MAT_NO = ?
			]]>
	</query>
	<query id="FrmCollarOutventory.updateMat" desc="修改材料表">
		<![CDATA[
UPDATE COUPLING_MAT_M T
   SET T.PRO_NUM = TO_NUMBER(?),
       T.PRO_WT  = TO_NUMBER(?),
       T.UPDATE_NAME=?,
       T.UPDATE_TIME=TO_DATE(?,'YYYY-MM-DD HH24:MI;SS')
 WHERE MAT_NO = ?
			]]>
	</query>
		<query id="FrmCollarOutventory.AddMat" desc="新增材料表">
		<![CDATA[
		 INSERT INTO COUPLING_MAT_M(
        MAT_NO,
        RESULT_NO,
        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,h
        DETER_STATUS,
        DETER_NO,
        DETER_RESULTS,
        FINAL_USER_DESC,
        MAT_ORIGIN_CODE,
        MAT_ORIGIN_NAME,
        SOURE_CODE,
        SOURE_NAME,
        JUDGE_STD_NAME)
  SELECT T.MAT_NO,
       T.RESULT_NO,
       T.WO_ID,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BL_WL_ID,
       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,
       T.DEAL_NUM,
       T.DEAL_WT,
       ?,
       SYSDATE,
       ?,
       ?,
       ?,
       SYSDATE,
       SYSDATE,
       T.BL_WL_DESC,
       T.MEMO,
       T.DEMAND_DETECTION,
       T.DEMAND_BLAST,
       T.DEMAND_BONDERIZING,
       T.DEMAND_COPPER,
       T.COAT_TYPE,
       T.BELONG_CODE,
       T.BELONG_NAME,
       T.CODE_JG_BL,
       T.CRAFT_FILE_NO,
       T.CRAFT_SEQ,
       T.DETER_STATUS,
       T.DETER_NO,
       T.DETER_RESULTS,
      '',
       T.MAT_ORIGIN_CODE,
       T.MAT_ORIGIN_NAME,
       T.SOURE_CODE,
       T.SOURE_NAME,
       ''
  FROM COUPLING_MAT_DEAL T WHERE T.DEAL_ORDE=?
		
		]]>
	</query>
	<query id="FrmCollarOutventory.updateMat1" desc="修改材料表">
		<![CDATA[
UPDATE COUPLING_MAT_M T
   SET T.PRO_NUM = (SELECT SUM(NVL(PIECES,0)) FROM COUPLING_MAT_BUTTRESS WHERE MAT_NO=? ),
       T.PRO_WT  = (SELECT SUM(NVL(WEIGHT,0)) FROM COUPLING_MAT_BUTTRESS WHERE MAT_NO=? ),
       T.UPDATE_NAME=?,
       T.UPDATE_TIME=TO_DATE(?,'YYYY-MM-DD HH24:MI;SS')
 WHERE MAT_NO = ?
			]]>
	</query>
	<query id="FrmCollarOutventory.getPlnMiddOrder" desc="查询工单详情">		
        <![CDATA[
        SELECT T.GUID,
       T.WO_ID,
       T.JG_ORDERNO,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.DEMAND_COPPER,
       T.DEMAND_DETECTION,
       T.DEMAND_BLAST,
       T.DEMAND_BONDERIZING,
       T.PLAN_NUM,
       T.PLAN_WT,
       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,
       T.STD_CODE,
       T.STD_NAME,
       T.STD_STYLE,
       T.STD_STYLE_DESC,
       T.PRODUCCODE_JG,
       T.PRODUCCODE_JG_DESC,
       T.CODE_JG,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.IF_MONITOR_JG,
       T.PRDCR_NO,
       T.STATUS,
       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,
       T.ORDER_NO,
       T.ORDER_SEQ,
       T.ORDER_SEQ_NO,
       T.ORD_PK,
       T.ORD_LN_PK,
       T.ORD_LN_DLY_PK,
       T.MAT_NO,
       T.CRAFT_SEQ_ORD,
       T.CRAFT_FILE_NO_ORD,
       T.MAT_NO_XH
  FROM PLN_ZY_JG_MIDDLE T
 WHERE T.GUID = ? 
        	]]>
	</query>
</queryMap>