<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="提单退货红冲">
	<query id="FrmReturnDashed.QueryBillM" desc="查询装车主表信息">
<![CDATA[	      
  SELECT T.BILL_NO,
       DECODE(CASE
                WHEN T.BILL_TICKET_STATUS = 0 AND T.OUTSTOCK_TICKET_STATUS = 0 AND
                     T.TRANSMNY_TICKET_STATUS = 0 THEN
                 0
                WHEN T.BILL_TICKET_STATUS = 2 AND T.OUTSTOCK_TICKET_STATUS = 2 AND
                     T.TRANSMNY_TICKET_STATUS = 2 THEN
                 2
                ELSE
                 (CASE
                   WHEN T.BILL_STATUS >= 4 THEN
                    1
                   ELSE
                    4
                 END)
              END,
              '1',
              '票据对齐('||T.BILL_TICKET_STATUS || T.OUTSTOCK_TICKET_STATUS ||
              T.TRANSMNY_TICKET_STATUS
              ||')',
              '2',
              '提单结束',            
              DECODE(T.BILL_STATUS,
                     '0',
                     '提单编制',
                     '1',
                     '提单下发',                
                     '3',
                     '提单执行',
                     '4',
                     '提单关闭',
                     '5',
                     '结算接收')) AS BILL_STATUS,
       DECODE(T.LOADVEHICLE_TYPE, '1', '实际', '2', '虚拟', '异常') LOADVEHICLE_TYPE,
       DECODE(T.LOADVEHICLE_TYPE,
              '2',
              DECODE(T.ISPRECLOSE,
                     '0',
                     '未关闭',
                     '1',
                     '一次关闭',
                     '2',
                     '票据接收'),
              '') ISPRECLOSE,
       B.BASENAME AS TRANS_TYPE,
       MAX(T.PRD_CLS) PRD_CLS
  FROM YDM_ZC_BILL_M T, COM_BASE_INFO B
 WHERE T.PLAN_TRANS_TYPE = B.BASECODE
   AND T.BILL_NO LIKE '%'||?||'%' 
   AND T.CREATE_TIME BETWEEN TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS') AND
       TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS')
   AND T.BILL_STATUS IN ('4','5')
   AND T.VALIDFLAG = '1'
   AND T.RETURN_FLAG='0'
	]]>
	</query>
	<query id="FrmReturnDashed.getQueryOutBillNo" desc="通过销售组织查询退货提单号">
 <![CDATA[
SELECT DISTINCT T.M_BILL_NO
  FROM YDM_ZC_OUTLIST T
 WHERE T.HAND_FLAG = '1'
   AND T.BELONG_CODE =?
 ORDER BY T.M_BILL_NO DESC

 ]]>
	</query>
	<query id="FrmReturnDashed.QueryBillC" desc="查询装车材料表数据">
	<![CDATA[ 
SELECT T1.REALINVOICENO,
       T1.PRD_CLS,
       T1.PRD_CLS_NAME,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.GROUP_NO,
       T.ORDER_NO || '/' || T.ORDER_SEQ AS ORDER_SEQ_NO1,
       T.ORDER_NO,
       T.ORDER_SEQ,
       T.ORDER_SEQ_NO,
       T.BILL_NO,
       T.MATERIAL_NAME,
       T.PRODUCNAME,
       T.GRADENAME,
       T.STEELNAME,
       T.SPEC_NAME,
       T.MODEL_DESC,
       T.STORAGE_NO,
       (SELECT B.STORAGE_NAME
          FROM YDM_BS_STORAGE B
         WHERE B.STORAGE_NO = T.STORAGE_NO) STORAGE_NAME,
       T.STD_NAME,
       T.STD_STYLE_DESC,
       T.ORD_LN_DLY_PK,
       TO_CHAR(T.ACT_LEN_MIN, 'FM990.00') || '-' ||
       TO_CHAR(T.ACT_LEN_MAX, 'FM990.00') AS LENFW,
       DECODE((SELECT MAX(B.PRT_FLAG)
                FROM YDM_ZC_BILL_C B
               WHERE B.BILL_NO = T.BILL_NO
                 AND B.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                 AND NVL(B.BATCH_NO, '/') = NVL(T.BATCH_NO, '/')
                 AND B.GROUP_NO = T.GROUP_NO
                 AND B.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
                 AND B.VALIDFLAG = '1'),
              '0',
              '否',
              '1',
              '是') AS WEIGH_FLAG,
       TO_CHAR(NVL(SUM(T.ACT_LEN), 0), 'FM999999990.00') AS ACT_LEN,
       NVL(SUM(T.ACT_COUNT), 0) AS ACT_COUNT,
       CASE
         WHEN MAX(T.PONDER_NO) IS NOT NULL  and (SELECT LOADVEHICLE_TYPE FROM YDM_ZC_LOADVEHICLE WHERE BILL_NO = T.BILL_NO AND ROWNUM = 1) = '1'  THEN
          TO_CHAR(NVL(SUM(T.PONDER_GROSS_WT), '0'), 'FM999999990.000')
         ELSE
          TO_CHAR(NVL(SUM(T.ACT_WEIGHT), 0), 'FM999999990.000')
       END AS ACT_WEIGHT,
       NVL(SUM(T.SEND_NUM), 0) AS SEND_NUM,
       (SELECT NVL(SUM(T2.ACT_COUNT), 0)
          FROM YDM_ZC_LOADVEHICLE_MAT T2
         WHERE T.JUDGE_STOVE_NO = T2.JUDGE_STOVE_NO
           AND NVL(T.BATCH_NO, '/') = NVL(T2.BATCH_NO, '/')
           AND T.GROUP_NO = T2.GROUP_NO
            AND T.STORAGE_NO=T2.STORAGE_NO
           AND T.ORD_LN_DLY_PK = T2.ORD_LN_DLY_PK
           AND T2.RETURN_FLAG = '1'
           AND T2.ORG_BILL_NO=T.BILL_NO
           AND DECODE(T2.STD_NAME,NULL,'1',T2.STD_NAME)=DECODE(T2.STD_NAME,NULL,'1',T.STD_NAME)) AS OUTACTCOUNT,
       (SELECT NVL(SUM(T2.ACT_WEIGHT), 0)
          FROM YDM_ZC_LOADVEHICLE_MAT T2
         WHERE T.JUDGE_STOVE_NO = T2.JUDGE_STOVE_NO
           AND NVL(T.BATCH_NO, '/') = NVL(T2.BATCH_NO, '/')
           AND T.GROUP_NO = T2.GROUP_NO
            AND T.STORAGE_NO=T2.STORAGE_NO
           AND T.ORD_LN_DLY_PK = T2.ORD_LN_DLY_PK
           AND T2.RETURN_FLAG = '1'
           AND T2.ORG_BILL_NO=T.BILL_NO
           AND DECODE(T2.STD_NAME,NULL,'1',T2.STD_NAME)=DECODE(T2.STD_NAME,NULL,'1',T.STD_NAME)) AS OUTACTWT,
       (SELECT NVL(SUM(T2.PONDER_GROSS_WT), 0)
          FROM YDM_ZC_LOADVEHICLE_MAT T2
         WHERE T.JUDGE_STOVE_NO = T2.JUDGE_STOVE_NO
           AND NVL(T.BATCH_NO, '/') = NVL(T2.BATCH_NO, '/')
           AND T.GROUP_NO = T2.GROUP_NO
            AND T.STORAGE_NO=T2.STORAGE_NO
           AND T.ORD_LN_DLY_PK = T2.ORD_LN_DLY_PK
           AND T2.RETURN_FLAG = '1'
           AND T2.ORG_BILL_NO=T.BILL_NO
           AND DECODE(T2.STD_NAME,NULL,'1',T2.STD_NAME)=DECODE(T2.STD_NAME,NULL,'1',T.STD_NAME)) AS OUTPONDER_GROSS_WT,
       (SELECT NVL(SUM(T2.SEND_NUM), 0)
          FROM YDM_ZC_LOADVEHICLE_MAT T2
         WHERE T.JUDGE_STOVE_NO = T2.JUDGE_STOVE_NO
           AND NVL(T.BATCH_NO, '/') = NVL(T2.BATCH_NO, '/')
           AND T.GROUP_NO = T2.GROUP_NO
            AND T.STORAGE_NO=T2.STORAGE_NO
           AND T.ORD_LN_DLY_PK = T2.ORD_LN_DLY_PK
           AND T2.RETURN_FLAG = '1'
           AND T2.ORG_BILL_NO=T.BILL_NO
           AND DECODE(T2.STD_NAME,NULL,'1',T2.STD_NAME)=DECODE(T2.STD_NAME,NULL,'1',T.STD_NAME)) AS OUTSENDNUM
  FROM (SELECT M.ORD_LN_DLY_PK,
               M.BILL_NO,
               M.PRD_CLS,
               (SELECT C.BASENAME FROM COM_BASE_INFO C WHERE C.BASECODE=M.PRD_CLS) PRD_CLS_NAME,
               CASE
                 WHEN M.REALINVOICENO IS NOT NULL AND
                      M.REALINVOICENO1 IS NOT NULL THEN
                  M.REALINVOICENO || '/' || M.REALINVOICENO1
                 WHEN M.REALINVOICENO IS NULL THEN
                  M.REALINVOICENO1
                 WHEN M.REALINVOICENO1 IS NULL THEN
                  M.REALINVOICENO
               END AS REALINVOICENO
          FROM YDM_ZC_BILL_M M
         WHERE M.RETURN_FLAG = '0'
         GROUP BY M.ORD_LN_DLY_PK,
                  M.REALINVOICENO,
                  M.REALINVOICENO1,
                  M.BILL_NO,
                  M.PRD_CLS) T1,
       YDM_ZC_LOADVEHICLE_MAT T
 WHERE T.ORD_LN_DLY_PK = T1.ORD_LN_DLY_PK
   AND T.BILL_NO = T1.BILL_NO
   AND T.BILL_NO = ?
   AND T.RETURN_FLAG = '0'
 GROUP BY T1.REALINVOICENO,
          T1.PRD_CLS,
          T1.PRD_CLS_NAME,
          T.JUDGE_STOVE_NO,
          T.BATCH_NO,
          T.GROUP_NO,
          T.ORDER_NO,
          T.ORDER_SEQ,
          T.ORDER_SEQ_NO,
          T.BILL_NO,
          T.MATERIAL_NAME,
          T.PRODUCNAME,
          T.GRADENAME,
          T.STEELNAME,
          T.SPEC_NAME,
          T.MODEL_DESC,
          T.STORAGE_NO,
          T.STD_NAME,
          T.STD_STYLE_DESC,
          T.ORD_LN_DLY_PK,
          T.ACT_LEN_MIN,
          T.ACT_LEN_MAX

	]]>
	</query>
	<query id="FrmReturnDashed.QueryLoadC" desc="查询发货材料表信息">
		<![CDATA[
SELECT T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       T.ORDER_NO || '/' || T.ORDER_SEQ AS ORDER_SEQ_NO1,
       T.ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.M_BILL_NO,
       --T.VEHICLE_NO,
       T.MATERIAL_NAME,
       T.PRODUCNAME,
       T.GRADENAME,
       T.STEELNAME,
       T.SPEC_NAME,
       T.MODEL_DESC,
       T.STORAGE_NO,
       B.STORAGE_NAME,
       T.STD_NAME,
       T.STD_STYLE_DESC,
       T.BELONG_CODE,
       T.BELONG_NAME,
       T.CREATE_NAME,
       T.RECEIV_NM,
       T.MEMO,
       TO_CHAR(MAX(T.CREATE_TIME), 'YYYY-MM-DD HH24:MI:SS') AS CREATE_TIME,
       --MAX(T.PONDER_NO) AS PONDER_NO,
       T.ORD_LN_DLY_PK,
       TO_CHAR(T.ACT_LEN_MIN, 'FM990.00') || '-' ||
       TO_CHAR(T.ACT_LEN_MAX, 'FM990.00') AS LENFW,
       DECODE((SELECT MAX(B.PRT_FLAG)
                FROM YDM_ZC_BILL_C B
               WHERE B.BILL_NO = T.M_BILL_NO
                 AND B.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                 AND B.BATCH_NO = T.BATCH_NO
                 AND B.GROUP_NO = T.BATCH_GROUD_NO
                 AND B.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
                 AND B.VALIDFLAG = '1'),
              '0',
              '否',
              '1',
              '是') AS WEIGH_FLAG,
       TO_CHAR(NVL(SUM(T.ACT_LEN), 0), 'FM999999990.00') AS ACT_LEN,
       NVL(SUM(T.ACT_COUNT), 0) AS ACT_COUNT,    
       CASE
         WHEN MAX(T.PONDER_NO) IS NOT NULL AND (SELECT MAX(B.PRT_FLAG)
                FROM YDM_ZC_BILL_C B
               WHERE B.BILL_NO = T.M_BILL_NO
                 AND B.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                 AND B.BATCH_NO = T.BATCH_NO
                 AND B.GROUP_NO = T.BATCH_GROUD_NO
                 AND B.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
                 AND B.VALIDFLAG = '1') = '1' THEN
          TO_CHAR(NVL(SUM(T.PONDER_GROSS_WT), '0'), 'FM999999990.000')
         ELSE
          TO_CHAR(NVL(SUM(T.ACT_WEIGHT), 0), 'FM999999990.000')
       END AS ACT_WEIGHT,
       TO_CHAR(NVL(SUM(T.PONDER_GROSS_WT), '0'), 'FM999999990.000') AS PONDER_GROSS_WT,
       Nvl(SUM(T.SEND_NUM),0) AS SEND_NUM,
       MAX((SELECT BASENAME FROM COM_BASE_INFO  WHERE BASECODE = T.RETURN_TYPE AND ROWNUM = 1)) RETURN_TYPE,
       MAX(T.RETURN_CODE) RETURN_CODE
  FROM YDM_ZC_OUTLIST T
  LEFT JOIN YDM_BS_STORAGE B
    ON B.STORAGE_NO = T.STORAGE_NO
 WHERE T.M_BILL_NO= ?
   AND T.OUTSTOCK_TYPE_CODE = '800806' 
     	]]>
	</query>
	<query id="FrmReturnDashed.checkMatWeight" desc="验证数据">
	<![CDATA[
  SELECT SUM(NVL(T1.ACT_COUNT, 0)) AS ACT_COUNT, SUM(NVL(T1.ACT_WEIGHT, 0)) AS ACT_WEIGHT,SUM(NVL(T1.ACT_LEN, 0)) AS ACT_LEN,
  SUM(NVL(T1.PONDER_GROSS_WT,0)) AS PONDER_GROSS_WT FROM (
SELECT T.MAT_NO, T.ACT_COUNT,
       T.ACT_WEIGHT,
       T.ACT_LEN,
       T.PONDER_GROSS_WT
  FROM YDM_ZC_LOADVEHICLE_MAT T
 WHERE T.BILL_NO = ?
 AND T.TALLYSHEET_NO=?
 AND T.LOADVEHICLE_NO=?
 AND T.VEHICLE_NO=?
 AND NVL(T.ORD_LN_DLY_PK,'/')=NVL(?,'/')
 AND T.STORAGE_NO=?
 AND T.LOCATION_NO=?
 AND T.JUDGE_STOVE_NO=?
 AND T.BATCH_NO=?
 AND T.GROUP_NO=?
 ORDER BY T.MAT_NO ASC) T1
 WHERE ROWNUM< ?
		]]>
	</query>
	<query id="FrmReturnDashed.queryLoadReturn" desc="查询要退货的装车材料记录">
	<![CDATA[
  SELECT T1.LOADVEHICLE_NO,
       T1.BILL_NO,
       T1.TALLYSHEET_NO,
       T1.VEHICLE_NO,
       T1.ORDER_NO,
       T1.ORDER_SEQ,
       T1.ORDER_SEQ_NO,
       T1.PRO_ORDER_NO,
       T1.MAT_NO,
       T1.LOT_NO,
       T1.JUDGE_STOVE_NO,
       T1.BATCH_NO,
       T1.GROUP_NO,
       T1.STOVE_NO,
       T1.MATERIAL_NO,
       T1.MATERIAL_NAME,
       T1.PRODUCCODE,
       T1.PRODUCNAME,
       T1.STD_CODE,
       T1.STD_NAME,
       T1.GRADECODE,
       T1.GRADENAME,
       T1.STEELCODE,
       T1.STEELNAME,
       T1.STD_STYLE,
       T1.STD_STYLE_DESC,
       T1.SPEC_CODE,
       T1.SPEC_NAME,
       T1.MODEL_CODE,
       T1.MODEL_DESC,
       T1.PROCESS_CDOE,
       T1.PROCESS_DESC,
       T1.PLINE_CODE,
       T1.PLINE_NAME,
       T1.ACT_DIMATER,
       T1.ACT_HEIGHT,
       NVL(T1.ACT_LEN, 0) ACT_LEN,
        T1.ACT_LEN_MIN,
       T1.ACT_LEN_MAX,
       NVL(T1.ACT_COUNT, 0) ACT_COUNT,
       NVL(T1.ACT_WEIGHT, 0) ACT_WEIGHT,
       NVL(T1.ACT_THEORY_WEIGHT, 0) ACT_THEORY_WEIGHT,
       NVL(T1.SEND_NUM,0) AS SEND_NUM,
       T1.JUDGE_RESULT_CODE,
       T1.PRO_BC,
       T1.PRO_BZ,
       T1.RPO_TIME,      
       T1.SALE_ORG,
       T1.SALE_ORG_DESC,
       T1.SALE_AREA,
       T1.STORAGE_TYPE_NO,
       T1.STORAGE_TYPE_NAME,
       T1.MANAGEMENT_NO,
       T1.MANAGEMENT_NAME,
       T1.UPLOAD_WEB_FLAG,
       T1.STORAGE_NO,
       T1.LOCATION_NO,
       T1.LARY_NO,
       T1.LOC_NO,
       T1.TRANS_TPE,
       T1.RECEIV_NO,
       T1.RECEIV_NM,
       T1.STATION_NO,
       T1.STATION_NM,
       T1.SPCL_LN_NO,
       T1.SPCL_LN_NM,
       T1.PORT_NO,
       T1.PLANT,
       T1.PLANT_DESC,
       T1.VSTEL,
       T1.VSTEL_DESC,
       T1.CARRY_COMPANY_CODE,
       T1.CARRY_COMPANY_NAME,
       T1.OUT_STOCK_CODE,
       T1.DELIVY_PLACE_CODE,
       T1.DELIVY_PLACE_NAME,
       T1.STLMT_UNIT_NO,
       T1.STLMT_UNIT_NM,
       T1.DELIVY_TIME,
       T1.VALIDFLAG,
       T1.ORD_PK,
       T1.ORD_LN_PK,
       T1.ORD_LN_DLY_PK,
       T1.DEPARTMENT_CODE,
       T1.DEPARTMENT_DESC,
       T1.PONDER_NO,
       NVL(T1.PONDER_GROSS_WT, 0) PONDER_GROSS_WT,
       T1.JUDGE_STD_NAME,
       T1.JUDGE_STD_CODE,
       T1.FINISHPRO_MOLD,
       T1.IN_MOLD,
       T1.LOADVEHICLE_SQE
  FROM (SELECT T.*
          FROM YDM_ZC_LOADVEHICLE_MAT T ,
               (SELECT T.MAT_NO, COUNT(*)
                  FROM YDM_ZC_LOADVEHICLE_MAT T
                 WHERE T.JUDGE_STOVE_NO = ?
                   and T.BILL_NO like ? || '%'
                   AND T.BATCH_NO =?
                   AND T.GROUP_NO = ?
                 GROUP BY T.MAT_NO
                HAVING COUNT(*) = 1) T3
         WHERE T.MAT_NO(+) = T3.MAT_NO
           AND T.BILL_NO = ?
           AND NVL(T.ORD_LN_DLY_PK,'/')=NVL(?,'/')
           AND T.STORAGE_NO = ?
           AND T.JUDGE_STOVE_NO = ?
           AND T.BATCH_NO = ?
           AND T.GROUP_NO = ?
           AND DECODE(T.STD_NAME,NULL,'1',T.STD_NAME) = DECODE(T.STD_NAME,NULL,'1',?)
           AND EXISTS (SELECT 1 FROM MAT_ZC_BACKUP T0 WHERE T0.MAT_NO=T.MAT_NO)
         ORDER BY T.MAT_NO ASC) T1
 WHERE ROWNUM < #RUMCONT#
		]]>
	</query>
	<query id="FrmReturnDashed.addOutReturn" desc="插入到出库表">
	<![CDATA[
	INSERT INTO YDM_ZC_OUTLIST (OUTSTOCK_SQE, OUTSTOCK_DOC, 
		OUTSTOCK_TYPE_CODE, OUTSTOCK_TYPE_NAME, VEHICLE_NO, MAT_NO, LOT_NO, STOVE_NO, 
		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_DIMATER, ACT_HEIGHT, 
		ACT_LEN, ACT_LEN_MIN, ACT_LEN_MAX, ACT_COUNT, ACT_WEIGHT, ACT_THEORY_WEIGHT, 
		STORAGE_NO, LOCATION_NO, LARY_NO, LOC_NO, 
		STORAGE_ATTR, STORAGE_ATTR_NAME, STORAGE_TYPE_NO, STORAGE_TYPE_NAME, 
		MANAGEMENT_NO, MANAGEMENT_NAME, RPO_TIME, PRO_BC, PRO_BZ, OUTSTOCK_TIME, OUT_BC, 
		OUT_BZ, CREATE_NAME, CREATE_TIME, ORD_PK, ORD_LN_PK, ORD_LN_DLY_PK,ORDER_NO,ORDER_SEQ,DELIVERY_NO,DEPARTMENT_CODE,DEPARTMENT_DESC,
		BELONG_CODE,BELONG_NAME,PONDER_NO,PONDER_GROSS_WT,M_BILL_NO,SEND_NUM,
		VSTEL,VSTEL_DESC,HAND_FLAG,PRODUCT_FLAG,MAT_STATUS,RECEIV_NO,RECEIV_NM,MEMO,FINISHPRO_MOLD,IN_MOLD,
		SUPPLY_UNIT_CODE,SUPPLY_UNIT,IS_DEALER,PROCESS_CDOE,PROCESS_DESC,BAL_YEAR_MONTH,PRO_ORDER_NO,
		RETURN_TYPE,RETURN_CODE) VALUES (?,
		?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
		?, ?, ?, ?, ?, ?, ?, TO_NUMBER(?), ?, ?, ?, TO_NUMBER(?), TO_NUMBER(?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 
		TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'), ?, ?, TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'), ?, 
		?, ?, TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'), ?, ?, ?,?,?,?,?,?,?,?,?,TO_NUMBER(?),
		?,TO_NUMBER(?),?,?,?,?,?,?,?,?,?,?,
		?,(SELECT T1.BASENAME FROM COM_BASE_INFO T1 WHERE T1.BASECODE=?),(SELECT IS_DEALER FROM MAT_ZC_M T0 WHERE T0.MAT_NO=?),
		(SELECT T0.PROCESS_CDOE FROM MAT_ZC_M T0 WHERE T0.MAT_NO=?),(SELECT T0.PROCESS_DESC FROM MAT_ZC_M T0 WHERE T0.MAT_NO=?),
		?,(SELECT T0.PRO_ORDER_NO FROM MAT_ZC_M T0 WHERE T0.MAT_NO=?),?,?
		)
		]]>
	</query>
	
		<query id="FrmReturnDashed.addOutReturn1" desc="插入到出库表">
	<![CDATA[
	INSERT INTO YDM_ZC_OUTLIST (OUTSTOCK_SQE, OUTSTOCK_DOC, 
		OUTSTOCK_TYPE_CODE, OUTSTOCK_TYPE_NAME, VEHICLE_NO, MAT_NO, LOT_NO, STOVE_NO, 
		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_DIMATER, ACT_HEIGHT, 
		ACT_LEN, ACT_LEN_MIN, ACT_LEN_MAX, ACT_COUNT, ACT_WEIGHT, ACT_THEORY_WEIGHT, 
		STORAGE_NO, LOCATION_NO, LARY_NO, LOC_NO, 
		STORAGE_ATTR, STORAGE_ATTR_NAME, STORAGE_TYPE_NO, STORAGE_TYPE_NAME, 
		MANAGEMENT_NO, MANAGEMENT_NAME, RPO_TIME, PRO_BC, PRO_BZ, OUTSTOCK_TIME, OUT_BC, 
		OUT_BZ, CREATE_NAME, CREATE_TIME, ORD_PK, ORD_LN_PK, ORD_LN_DLY_PK,ORDER_NO,ORDER_SEQ,DELIVERY_NO,DEPARTMENT_CODE,DEPARTMENT_DESC,
		BELONG_CODE,BELONG_NAME,PONDER_NO,PONDER_GROSS_WT,M_BILL_NO,SEND_NUM,
		VSTEL,VSTEL_DESC,HAND_FLAG,PRODUCT_FLAG,MAT_STATUS,RECEIV_NO,RECEIV_NM,MEMO,FINISHPRO_MOLD,IN_MOLD,
		SUPPLY_UNIT_CODE,SUPPLY_UNIT,IS_DEALER,PROCESS_CDOE,PROCESS_DESC,BAL_YEAR_MONTH) VALUES (?, 
		?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
		?, ?, ?, ?, ?, ?, ?, TO_NUMBER(?), ?, ?, ?, TO_NUMBER(?), TO_NUMBER(?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 
		TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'), ?, ?, TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'), ?, 
		?, ?, TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'), ?, ?, ?,?,?,?,?,?,?,?,?,TO_NUMBER(?),
		?,TO_NUMBER(?),?,?,?,?,?,?,?,?,?,?,
		?,(SELECT T1.BASENAME FROM COM_BASE_INFO T1 WHERE T1.BASECODE=?),?,
		(SELECT T1.PROCESS_CODE FROM COM_BASE_PLINE T1 WHERE T1.PLINE_CODE=?),
		(SELECT T1.PROCESS_DESC FROM COM_BASE_PLINE T1 WHERE T1.PLINE_CODE=?),
		?)
		]]>
	</query>
	
	<query id="FrmReturnDashed.updateLoadReturn" desc="修改装车实绩表量">
	<![CDATA[
	UPDATE YDM_ZC_LOADVEHICLE T
   SET T.STACKING_PIECE    = TO_NUMBER(NVL(T.STACKING_PIECE, 0)) +
                             TO_NUMBER(?),
       T.STACKING_WT       = TO_NUMBER(NVL(T.STACKING_WT, 0)) + TO_NUMBER(?),
       T.STACKING_TOTL_LEN = TO_NUMBER(NVL(T.STACKING_TOTL_LEN, 0)) +
                             TO_NUMBER(?)
 WHERE T.LOADVEHICLE_NO = ?
		]]>
	</query>
	<query id="FrmReturnDashed.qureyFlag" desc="查询提单状态">
	<![CDATA[
	SELECT T.BILL_STATUS,
       T.ISPRECLOSE,
       T.LOADVEHICLE_TYPE,
       T.REALINVOICENO,
       T.REALINVOICENO1
  FROM YDM_ZC_BILL_M T
 WHERE T.BILL_NO = ?
AND NVL(T.ORD_LN_DLY_PK,'/')=NVL(?,'/')
 GROUP BY T.BILL_STATUS,
          T.ISPRECLOSE,
          T.LOADVEHICLE_TYPE,
          T.REALINVOICENO,
          T.REALINVOICENO1
		]]>
	</query>
	<query id="FrmReturnDashed.queryOutList" desc="查询出库单号">
	<![CDATA[
   SELECT MAX(OUTSTOCK_DOC) AS OUTSTOCK_DOC
    FROM YDM_ZC_OUTLIST
   WHERE OUTSTOCK_TYPE_CODE = ?
    AND TO_CHAR(CREATE_TIME,'YYYY-MM-DD') =?
	]]>
	</query>
	<query id="FrmReturnDashed.queryMatNoMax" desc="查询出最大材料号">
	<![CDATA[
	SELECT ? || ? ||
       LPAD(NVL(MAX(SUBSTR(T2.MAT_NO, LENGTH(T2.MAT_NO) - 3)), 0) + 1, 4, 0) MAT_NO
  FROM (SELECT MAX(T.MAT_NO) MAT_NO
          FROM MAT_ZC_M T
         WHERE T.JUDGE_STOVE_NO = ?
           AND T.BATCH_NO = ?
        UNION ALL
        SELECT MAX(T1.MAT_NO) MAT_NO
          FROM YDM_ZC_INLIST T1
         WHERE T1.JUDGE_STOVE_NO = ?
           AND T1.BATCH_NO = ?
        UNION ALL
        SELECT MAX(T3.MAT_NO) MAT_NO
          FROM MAT_ZC_BACKUP T3
         WHERE T3.JUDGE_STOVE_NO = ?
           AND T3.BATCH_NO = ?) T2
	]]>
	</query>
	<query id="FrmReturnDashed.addMatNoReturn" desc="新增材料表">
	<![CDATA[
	INSERT INTO MAT_ZC_M (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, PROCESS_CDOE, 
PROCESS_DESC, PLINE_CODE, PLINE_NAME, ACT_DIMATER, ACT_HEIGHT, ACT_LEN, 
ACT_LEN_MIN, ACT_LEN_MAX, ACT_COUNT, ACT_WEIGHT, ACT_THEORY_WEIGHT, BELONG_CODE, 
BELONG_NAME, INSTOCK_TIME, INSTOCK_FLAG, PRO_BC, PRO_BZ, RPO_TIME, CREATE_NAME, 
CREATE_TIME, ORD_PK, ORD_LN_PK, ORD_LN_DLY_PK ,JUDGE_STD_NAME, JUDGE_STD_CODE, 
PONDER_NO, PONDER_GROSS_WT,PIPMEMO,FINISHPRO_MOLD,IN_MOLD,
SUPPLY_UNIT_CODE,SUPPLY_UNIT,IS_DEALER,JUDGE_RESULT_CODE,JUDGE_RESULT)
VALUES (?, ?, ?, ?, ?, 
 ?, ?, ?, ?, ?, 
 ?, ?, ?, ?, ?, 
 ?, ?, ?, ?, ?, 
 ?, ?, ?, ?, ?, 
 ?, ?, ?, ?, ?, 
 ?, ?, ?, ?, TO_NUMBER(?), 
 ?, ?, TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), 
 ?, (SELECT T1.BASENAME FROM COM_BASE_INFO T1 WHERE T1.BASECODE=?), TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),?, ?, 
 ?, TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'), ?, TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'), ?, 
 ?, ?, ?, ?, ?, 
 TO_NUMBER(?),?,?,?,?,
 (SELECT T1.BASENAME FROM COM_BASE_INFO T1 WHERE T1.BASECODE=?),?,
 '40740701',(SELECT T1.BASENAME FROM COM_BASE_INFO T1 WHERE T1.BASECODE='40740701'))
	]]>
	</query>
	<query id="FrmReturnDashed.addMatNoReturn1" desc="新增材料表">
	<![CDATA[
	INSERT INTO MAT_ZC_M (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, OLD_ORDER_NO, OLD_ORDER_SEQ, OLD_ORDER_SEQ_NO, PROCESS_CDOE, 
PROCESS_DESC, PLINE_CODE, PLINE_NAME, ACT_DIMATER, ACT_HEIGHT, ACT_LEN, 
ACT_LEN_MIN, ACT_LEN_MAX, ACT_COUNT, ACT_WEIGHT, ACT_THEORY_WEIGHT, BELONG_CODE, 
BELONG_NAME, INSTOCK_TIME, INSTOCK_FLAG, PRO_BC, PRO_BZ, RPO_TIME, CREATE_NAME, 
CREATE_TIME, ORD_PK, ORD_LN_PK, ORD_LN_DLY_PK ,JUDGE_STD_NAME, JUDGE_STD_CODE, 
PONDER_NO, PONDER_GROSS_WT,PIPMEMO,FINISHPRO_MOLD,IN_MOLD,
SUPPLY_UNIT_CODE,SUPPLY_UNIT,IS_DEALER,JUDGE_RESULT_CODE,JUDGE_RESULT)
VALUES (?, ?, ?, ?, ?,
  ?, ?, ?, ?, ?,
  ?, ?, ?, ?, ?, 
  ?, ?, ?, ?, ?,
  ?, ?, ?, ?, ?, 
  ?, ?, ?, ?, ?, 
  ?, ?, ?, ?, TO_NUMBER(?), 
  ?, ?, TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), 
  ?, (SELECT T1.BASENAME FROM COM_BASE_INFO T1 WHERE T1.BASECODE=?), TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),?, ?, 
  ?, TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'), ?, TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'), ?, 
  ?, ?, ?, ?, ?, 
  TO_NUMBER(?),?,?,?,?,
  (SELECT T1.BASENAME FROM COM_BASE_INFO T1 WHERE T1.BASECODE=?),?,'40740701',(SELECT T1.BASENAME FROM COM_BASE_INFO T1 WHERE T1.BASECODE='40740701'))
	]]>
	</query>
	<query id="FrmReturnDashed.addButterReturn" desc="新增位置表">
	<![CDATA[
	INSERT INTO YDM_ZC_BUTTRESS
  (MAT_NO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   BATCH_GROUD_NO,
   STORAGE_NO,
   LOCATION_NO,
   LARY_NO,
   LOC_NO,
   STORAGE_ATTR,
   STORAGE_ATTR_NAME,
   STORAGE_TYPE_NO,
   STORAGE_TYPE_NAME,
   MANAGEMENT_NO,
   MANAGEMENT_NAME,
   CREATE_NAME,
   CREATE_TIME,
   DEPARTMENT_CODE,
   DEPARTMENT_DESC)
VALUES
  (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'), ?, ?)
	]]>
	</query>
	<query id="FrmReturnDashed.addInReturn" desc="新增入库表">
	<![CDATA[
	INSERT INTO YDM_ZC_INLIST (INSTOCK_SQE, INSTOCK_DOC, INSTOCK_TYPE_CODE, 
INSTOCK_TYPE_NAME, VEHICLE_NO, MAT_NO, LOT_NO, STOVE_NO, 
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, PRO_ORDER_NO, PLINE_CODE, PLINE_NAME, ACT_DIMATER, ACT_HEIGHT, 
ACT_LEN, ACT_LEN_MIN, ACT_LEN_MAX, ACT_COUNT, ACT_WEIGHT, ACT_THEORY_WEIGHT, 
BELONG_CODE, BELONG_NAME, STORAGE_NO, LOCATION_NO, LARY_NO, LOC_NO, 
STORAGE_ATTR, STORAGE_ATTR_NAME, STORAGE_TYPE_NO, STORAGE_TYPE_NAME, 
MANAGEMENT_NO, MANAGEMENT_NAME, RPO_TIME, PRO_BC, PRO_BZ, INSTOCK_TIME, IN_BC, 
IN_BZ, CREATE_NAME, CREATE_TIME, ORD_PK, ORD_LN_PK, ORD_LN_DLY_PK, 
DEPARTMENT_CODE, DEPARTMENT_DESC, ORDER_NO, ORDER_SEQ, DELIVERY_NO, 
PRODUCT_FLAG, MAT_STATUS, JUDGE_STD_NAME, JUDGE_STD_CODE, IN_TIME_F,FINISHPRO_MOLD,IN_MOLD) 
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, TO_NUMBER(?), ?, ?, TO_NUMBER(?),
 TO_NUMBER(?), TO_NUMBER(?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 
 TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'), ?, ?, TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'), 
 ?, ?, ?, TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'), ?, ?, ?, ?, ?, ?, ?, ?, 
 ?, ?, ?, ?, TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),?,?)
	]]>
	</query>
	<query id="FrmReturnDashed.queryIn" desc="查询入库流水号">
	<![CDATA[
    SELECT ? ||
         LPAD(SUBSTR(NVL(MAX(T.INSTOCK_SQE), '0000'), -4, 4) + 1, 4, '0') AS INSTOCK_SQE
    FROM YDM_ZC_INLIST T
   WHERE TO_CHAR(T.CREATE_TIME,'YYYY-MM-DD') =?
     AND T.INSTOCK_TYPE_CODE =?
     AND T.INSTOCK_DOC = ?
	]]>
	</query>
	<query id="FrmReturnDashed.queryInList" desc="查询入库单号">
	<![CDATA[
    SELECT 'IT' || ? ||
        LPAD(SUBSTR(NVL(MAX(T.INSTOCK_DOC), '00000'), -5, 5) + 1, 5, '0') AS INSTOCK_DOC
   FROM YDM_ZC_INLIST T
  WHERE T.INSTOCK_TYPE_CODE = ?
     AND TO_CHAR(CREATE_TIME,'YYYY-MM-DD') =?
	]]>
	</query>
	<query id="FrmReturnDashed.queryLoadMat" desc="查询装车材料号">
	<![CDATA[
 SELECT SUM(T.ACT_COUNT) AS ACT_COUNT,
        SUM(T.ACT_LEN) AS ACT_LEN,
        SUM(T.ACT_WEIGHT) AS ACT_WEIGHT
   FROM YDM_ZC_LOADVEHICLE_MAT T
  WHERE T.BILL_NO = ?
    AND T.LOADVEHICLE_NO = ?
    AND T.JUDGE_STOVE_NO = ?
    AND T.BATCH_NO = ?
    AND T.GROUP_NO = ?
    AND NVL(T.ORD_LN_DLY_PK,'/')=NVL(?,'/')
    AND T.RETURN_FLAG = '1'
 
	]]>
	</query>
	<query id="FrmReturnDashed.deleteOutReturn" desc="删除出库表">
	<![CDATA[
	DELETE YDM_ZC_OUTLIST T
 WHERE T.M_BILL_NO = ?
   AND T.JUDGE_STOVE_NO = ?
   AND T.BATCH_NO = ?
   AND T.BATCH_GROUD_NO = ?
   AND NVL(T.ORD_LN_DLY_PK,'/')=NVL(?,'/')
   AND T.OUTSTOCK_TYPE_CODE = '800806'
	]]>
	</query>

	<query id="FrmReturnDashed.getFmisZcOutlist" desc="查询是否被财务系统接收">
		<![CDATA[
	SELECT * FROM FMIS_ZC_OUTLIST T
	 WHERE T.M_BILL_NO = ?
	   AND T.JUDGE_STOVE_NO = ?
	   AND T.BATCH_NO = ?
	   AND T.BATCH_GROUD_NO = ?
	   AND NVL(T.ORD_LN_DLY_PK,'/')=NVL(?,'/')
	   AND T.OUTSTOCK_TYPE_CODE = '800806'
	   AND T.SYNC_FLAG = '1'
	]]>
	</query>

	<query id="FrmReturnDashed.delFmisZcOutlist" desc="删除财务系统中间表">
		<![CDATA[
	DELETE FROM FMIS_ZC_OUTLIST T
	 WHERE T.M_BILL_NO = ?
	   AND T.JUDGE_STOVE_NO = ?
	   AND T.BATCH_NO = ?
	   AND T.BATCH_GROUD_NO = ?
	   AND NVL(T.ORD_LN_DLY_PK,'/')=NVL(?,'/')
	   AND T.OUTSTOCK_TYPE_CODE = '800806'
	   AND T.SYNC_FLAG = '0'
	]]>
	</query>

	<query id="FrmReturnDashed.updateLoadReturn1" desc="修改装车实绩表支数，重量">
	<![CDATA[
		UPDATE YDM_ZC_LOADVEHICLE T
   SET T.STACKING_PIECE    = TO_NUMBER(NVL(T.STACKING_PIECE, 0)) -
                             TO_NUMBER(?),
       T.STACKING_WT       = TO_NUMBER(NVL(T.STACKING_WT, 0)) - TO_NUMBER(?),
       T.STACKING_TOTL_LEN = TO_NUMBER(NVL(T.STACKING_TOTL_LEN, 0)) -
                             TO_NUMBER(?)
 WHERE T.LOADVEHICLE_NO = ?
	]]>
	</query>
	<query id="FrmReturnDashed.deleteMatNoReturn" desc="删除材料表">
	<![CDATA[
	DELETE MAT_ZC_M T
 WHERE T.MAT_NO IN (SELECT L.MAT_NO
                      FROM YDM_ZC_OUTLIST L
                     WHERE L.M_BILL_NO = ?
                       AND L.JUDGE_STOVE_NO = ?
                       AND L.BATCH_NO = ?
                       AND L.BATCH_GROUD_NO = ?
                       AND NVL(L.ORD_LN_DLY_PK,'/')=NVL(?,'/')
                       AND L.MAT_NO = T.MAT_NO
                       AND L.OUTSTOCK_TYPE_CODE = '800806')
        AND T.MAT_STATUS='80150301'
	]]>
	</query>
	<query id="FrmReturnDashed.deleteButterReturn" desc="删除位置表">
	<![CDATA[
	   DELETE YDM_ZC_BUTTRESS T
    WHERE T.MAT_NO IN (SELECT L.MAT_NO
                      FROM YDM_ZC_OUTLIST L
                     WHERE L.M_BILL_NO = ?
                       AND L.JUDGE_STOVE_NO = ?
                       AND L.BATCH_NO = ?
                       AND L.BATCH_GROUD_NO = ?
                       AND NVL(L.ORD_LN_DLY_PK,'/')=NVL(?,'/')
                       AND L.MAT_NO = T.MAT_NO
                       AND L.OUTSTOCK_TYPE_CODE = '800806')
	]]>
	</query>
	<query id="FrmReturnDashed.queryYdmLoadMat" desc="查询装车表剩余退货数">
	<![CDATA[
 SELECT NVL(SUM(T.ACT_COUNT), 0) AS ACT_COUNT,
          NVL(SUM(T.ACT_WEIGHT), 0) AS ACT_WEIGHT,
          NVL(SUM(T.PONDER_GROSS_WT), 0) AS PONDER_GROSS_WT
     FROM YDM_ZC_LOADVEHICLE_MAT T
    WHERE T.BILL_NO = ?
      AND T.JUDGE_STOVE_NO = ?
      AND T.BATCH_NO = ?
      AND T.GROUP_NO = ?
      AND NVL(T.ORD_LN_DLY_PK,'/')=NVL(?,'/')
     -- AND T.VEHICLE_NO = ?
	]]>
	</query>
	<query id="FrmReturnDashed.queryOutLoadMat" desc="查询装车表已退货数">
	<![CDATA[
    SELECT COUNT(1) AS COUNNUM,NVL(SUM(T.ACT_COUNT), 0) AS ACT_COUNT,
          NVL(SUM(T.ACT_WEIGHT), 0) AS ACT_WEIGHT,
          NVL(SUM(T.PONDER_GROSS_WT), 0) AS PONDER_GROSS_WT,
          NVL(SUM(T.SEND_NUM),0) AS SEND_NUM,
          NVL(SUM(T.ACT_LEN),0) AS ACT_LEN
     FROM YDM_ZC_OUTLIST T
    WHERE T.M_BILL_NO = ?
      AND T.JUDGE_STOVE_NO = ?
      AND T.BATCH_NO = ?
      AND T.Batch_Groud_No = ?
      AND NVL(T.ORD_LN_DLY_PK,'/') = NVL(?,'/')
     -- AND T.VEHICLE_NO = ?
      AND T.OUTSTOCK_TYPE_CODE = '800806'
	]]>
	</query>
	<query id="FrmReturnDashed.updateProOrd" desc="退货回写进程表">
	<![CDATA[
	UPDATE PROCESS_ORDER_M T
   SET T.NEG_OUT_NUM = NVL(TO_NUMBER(T.NEG_OUT_NUM), 0) + TO_NUMBER(?),
       T.NEG_OUT_WGT = NVL(TO_NUMBER(T.NEG_OUT_WGT), 0) + TO_NUMBER(?),
       T.NEG_OUT_LEN = NVL(TO_NUMBER(T.NEG_OUT_LEN), 0) + TO_NUMBER(?)
 WHERE  NVL(T.ORD_LN_DLY_PK,'/')=NVL(?,'/')
	]]>
	</query>
	<query id="FrmReturnDashed.deleteProOrd" desc="退货回写进程表">
	<![CDATA[
	UPDATE PROCESS_ORDER_M T
   SET T.NEG_OUT_NUM = NVL(TO_NUMBER(T.NEG_OUT_NUM), 0) - TO_NUMBER(?),
       T.NEG_OUT_WGT = NVL(TO_NUMBER(T.NEG_OUT_WGT), 0) - TO_NUMBER(?),
       T.NEG_OUT_LEN = NVL(TO_NUMBER(T.NEG_OUT_LEN), 0) - TO_NUMBER(?)
 WHERE  NVL(T.ORD_LN_DLY_PK,'/')=NVL(?,'/')
	]]>
	</query>
	<query id="FrmReturnDashed.queryOutListBill" desc="查询退货提单号">
	<![CDATA[
SELECT T.M_BILL_NO,MAX(T.CREATE_TIME) AS CREATE_TIME,T.HAND_FLAG,MAX(RETURN_TYPE) RETURN_TYPE,MAX(RETURN_CODE) RETURN_CODE
  FROM YDM_ZC_OUTLIST T
 WHERE T.M_BILL_NO LIKE '%'||?||'%'
   AND T.CREATE_TIME BETWEEN TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS') AND
       TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS')
   AND T.JUDGE_STOVE_NO LIKE '%'||?||'%'
   AND T.OUTSTOCK_TYPE_CODE = '800806'
	]]>
	</query>
	<query id="FrmReturnDashed.createBillNo" desc="生成提单号">
 <![CDATA[
SELECT 'B'||'TH' || ? || TO_CHAR(SYSDATE, 'YYMMDD') ||
       LPAD(TO_CHAR(NVL(SUBSTR(MAX(T.BILL_NO), 11), 0) + 1), 4, 0) BILL_NO
  FROM YDM_ZC_BILL_NO T
 WHERE INSTR(T.BILL_NO, ? || TO_CHAR(SYSDATE, 'YYMMDD')) > 0
  AND T.BILL_NO LIKE '#BILLNO#%'
 ]]>
	</query>
	<query id="FrmReturnDashed.getQueryProduct" desc="通过品名查询是否坯子">
 <![CDATA[
SELECT T.PRODUC_STYLE FROM COM_BASE_PRODUCT T WHERE T.PRODUCCODE=? AND T.VALIDFLAG='1'
 ]]>
	</query>
	<query id="FrmReturnDashed.queryMatZcNo" desc="查询材料表材料状态">
 <![CDATA[
SELECT  COUNT(*) COUNT,
         MAX(T.MAT_STATUS) MAT_STATUS,
         MAX(T.LOCK_FLAG) LOCK_FLAG,
         MAX(T.MNG_LOCK_FLAG) MNG_LOCK_FLAG
        FROM MAT_ZC_M T WHERE T.MAT_NO IN (SELECT L.MAT_NO
                      FROM YDM_ZC_OUTLIST L
                     WHERE L.M_BILL_NO = ?
                       AND L.JUDGE_STOVE_NO = ?
                       AND NVL(L.BATCH_NO,'/') = NVL(?,'/')
                       AND L.BATCH_GROUD_NO = ?
                       AND NVL(L.ORD_LN_DLY_PK,'/')=NVL(?,'/')
                       AND L.MAT_NO = T.MAT_NO
                       AND L.OUTSTOCK_TYPE_CODE = '800806')
 ]]>
	</query>
	<query id="FrmReturnDashed.addBillMReturn" desc="新增到提单主表">
 <![CDATA[
INSERT INTO YDM_ZC_BILL_M (BILL_NO_SEQ, BILL_NO, ORDER_NO, ORDER_SEQ, 
 DELIVERY_NO, SEND_PLAN_NO, PLAN_TRANS_TYPE, STATION_NO, STATION_NM, SPCL_LN_NO, 
 SPCL_LN_NM, PORT_NO, PORT_DESC, SALE_ORG, SALE_ORG_DESC, CUSTOMER_NO, 
 CUSTOMER_NM, RECEIV_NO, RECEIV_NM, STLMT_UNIT_NO, STLMT_UNIT_NM, ZBS_SOURCE,
CARRY_COMPANY_CODE, CARRY_COMPANY_NAME, PRD_CLS, PRODUCCODE, PRODUCNAME, 
STD_CODE, STD_NAME, STEELCODE, STEELNAME, PLAN_WT, PLAN_NUM, PLAN_TOTL_LEN, 
ACT_WT, ACT_NUM, ACT_TOTL_LEN, SPEC_CODE, SPEC_NAME, BILL_STATUS, CREATE_NAME, 
CREATE_TIME,PRINT_FLAG, LOADVEHICLE_TYPE, ORD_PK, ORD_LN_PK, ORD_LN_DLY_PK, AGENCY_FL, 
RECEIV_ADDR, PICKUP_FLAG, DEPARTMENT_CODE, DEPARTMENT_DESC, 
MANAGEMENT_NO, MANAGEMENT_NAME, ZOUT_FLAG, CREDIT_NO,RETURN_FLAG,ITEM_NO,LICENSE_NO,SINGLE_NO,SUPPLY_UNIT,SUPPLY_UNIT_DESC) SELECT ?,?,ORDER_NO, ORDER_SEQ,
DELIVERY_NO, SEND_PLAN_NO, PLAN_TRANS_TYPE, STATION_NO, STATION_NM, SPCL_LN_NO, 
SPCL_LN_NM, PORT_NO, PORT_DESC, SALE_ORG, SALE_ORG_DESC, CUSTOMER_NO, 
CUSTOMER_NM, RECEIV_NO, RECEIV_NM, STLMT_UNIT_NO, STLMT_UNIT_NM, ZBS_SOURCE,
CARRY_COMPANY_CODE, CARRY_COMPANY_NAME, PRD_CLS, PRODUCCODE, PRODUCNAME, 
STD_CODE, STD_NAME, STEELCODE, STEELNAME,TO_NUMBER(?),TO_NUMBER(?),TO_NUMBER(?),TO_NUMBER(?),TO_NUMBER(?),
TO_NUMBER(?),SPEC_CODE, SPEC_NAME, '4', ?, 
TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'), TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'),'1', ORD_PK, ORD_LN_PK, ORD_LN_DLY_PK, AGENCY_FL, 
RECEIV_ADDR, PICKUP_FLAG, DEPARTMENT_CODE, DEPARTMENT_DESC, 
MANAGEMENT_NO, MANAGEMENT_NAME, ZOUT_FLAG,CREDIT_NO,'1',ITEM_NO,LICENSE_NO,SINGLE_NO,SUPPLY_UNIT,SUPPLY_UNIT_DESC FROM YDM_ZC_BILL_M WHERE BILL_NO=? AND ORD_LN_DLY_PK=?
 ]]>
	</query>
	<query id="FrmReturnDashed.addBillCReturn" desc="新增到提单从表">
 <![CDATA[
INSERT INTO YDM_ZC_BILL_C (BILL_SQE, BILL_NO, ORDER_NO, ORDER_SEQ, MAT_NO, 
LOT_NO, JUDGE_STOVE_NO, BATCH_NO, GROUP_NO, STOVE_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_DIMATER, ACT_HEIGHT, 
ACT_LEN, ACT_LEN_MIN, ACT_LEN_MAX, ACT_COUNT, ACT_WEIGHT, ACT_THEORY_WEIGHT, 
JUDGE_RESULT_CODE, PRO_BC, PRO_BZ, RPO_TIME, EDIT_FLAG, STORAGE_NO, LOCATION_NO, 
CREATE_NAME, CREATE_TIME, DELIVERY_NO, ORD_PK, ORD_LN_PK, ORD_LN_DLY_PK, 
LOADVEHICLE_FLAG, PRT_FLAG, VSTEL, VSTEL_DESC, SEND_NUM, ACT_FIX_NUM, 
ACT_FIX_LEN, RETURN_FLAG,FINISHPRO_MOLD,IN_MOLD,ZBS_ID,JG_ZBS_ID)
 SELECT ?, ?, ORDER_NO, ORDER_SEQ, ?, 
LOT_NO, JUDGE_STOVE_NO, BATCH_NO, GROUP_NO, STOVE_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_DIMATER, ACT_HEIGHT, 
TO_NUMBER(?), ACT_LEN_MIN, ACT_LEN_MAX, TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), 
JUDGE_RESULT_CODE, PRO_BC, PRO_BZ, RPO_TIME, '1', STORAGE_NO, LOCATION_NO, 
?, TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'), DELIVERY_NO, ORD_PK, ORD_LN_PK, ORD_LN_DLY_PK, 
'1', PRT_FLAG, VSTEL, VSTEL_DESC, TO_NUMBER(?), ACT_FIX_NUM, 
ACT_FIX_LEN, '1',FINISHPRO_MOLD,?,ZBS_ID,JG_ZBS_ID FROM YDM_ZC_BILL_C WHERE MAT_NO=? AND BILL_NO=? AND RETURN_FLAG='0'
 ]]>
	</query>
	<query id="FrmReturnDashed.addLoadReturn" desc="新增到装车主表">
 <![CDATA[
INSERT INTO YDM_ZC_LOADVEHICLE (LOADVEHICLE_NO, BILL_NO, LOADVEHICLE_TYPE, 
AFFIRM_FLAG, TRANS_TYPE, RECEIV_NO, RECEIV_NM, STATION_NO, STATION_NM, 
SPCL_LN_NO, SPCL_LN_NM, STACKING_WT, STACKING_PIECE, 
STACKING_TOTL_LEN, OUT_STOCK_CODE, 
STLMT_UNIT_NO, STLMT_UNIT_NM, LOAD_TIME, MANAGEMENT_NO, MANAGEMENT_NAME, 
CREATE_NAME, CREATE_TIME, DEPARTMENT_CODE, DEPARTMENT_DESC, ZOUT_FLAG, PRD_CLS,RETURN_FLAG)
SELECT DISTINCT  ?,?, '1', 
AFFIRM_FLAG, TRANS_TYPE, RECEIV_NO, RECEIV_NM, STATION_NO, STATION_NM, 
SPCL_LN_NO, SPCL_LN_NM, TO_NUMBER(?), TO_NUMBER(?), 
TO_NUMBER(?), '', 
STLMT_UNIT_NO, STLMT_UNIT_NM, TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'), ?, ?, 
?, TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'), ?, ?, ZOUT_FLAG, PRD_CLS,? FROM YDM_ZC_LOADVEHICLE WHERE BILL_NO= ? AND NVL(PRD_CLS,'/')=NVL(?,'/')
 ]]>
	</query>
	<query id="FrmReturnDashed.addLoadMatReturn" desc="新增到装车从表">
 <![CDATA[
INSERT INTO YDM_ZC_LOADVEHICLE_MAT (LOADVEHICLE_SQE, LOADVEHICLE_NO, BILL_NO,
ORDER_NO, ORDER_SEQ, ORDER_SEQ_NO, PRO_ORDER_NO, 
MAT_NO, LOT_NO, JUDGE_STOVE_NO, BATCH_NO, GROUP_NO, STOVE_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, PROCESS_CDOE, PROCESS_DESC, PLINE_CODE, PLINE_NAME, 
ACT_DIMATER, ACT_HEIGHT, ACT_LEN, ACT_LEN_MIN, ACT_LEN_MAX, ACT_COUNT, 
ACT_WEIGHT, ACT_THEORY_WEIGHT, JUDGE_RESULT_CODE, PRO_BC, PRO_BZ, RPO_TIME, 
SEN_BC, SEN_BZ, SEN_TIME, ZBS_BH, SALE_ORG, SALE_ORG_DESC, SALE_AREA, 
STORAGE_TYPE_NO, STORAGE_TYPE_NAME, MANAGEMENT_NO, MANAGEMENT_NAME, 
UPLOAD_WEB_FLAG, STORAGE_NO, LOCATION_NO, LARY_NO, LOC_NO, TRANS_TPE, RECEIV_NO, 
RECEIV_NM, STATION_NO, STATION_NM, SPCL_LN_NO, SPCL_LN_NM, PORT_NO, PLANT, 
PLANT_DESC, VSTEL, VSTEL_DESC, CARRY_COMPANY_CODE, CARRY_COMPANY_NAME, 
OUT_STOCK_CODE, DELIVY_PLACE_CODE, DELIVY_PLACE_NAME, STLMT_UNIT_NO, 
STLMT_UNIT_NM, DELIVY_TIME, VALIDFLAG, CREATE_NAME, CREATE_TIME, ORD_PK, 
ORD_LN_PK, ORD_LN_DLY_PK, DEPARTMENT_CODE, DEPARTMENT_DESC, PONDER_NO, 
PONDER_GROSS_WT, JUDGE_STD_NAME, JUDGE_STD_CODE, SEND_NUM, ZOUT_FLAG, 
RETURN_FLAG, CREDIT_NO, PORT_DESC, ACT_FIX_NUM, ACT_FIX_LEN,FINISHPRO_MOLD,IN_MOLD,in_type,ORG_BILL_NO,MEASURING_SEQ,bal_year_month) SELECT ?,?,?,ORDER_NO, ORDER_SEQ, ORDER_SEQ_NO, PRO_ORDER_NO,
?, LOT_NO, JUDGE_STOVE_NO, BATCH_NO, GROUP_NO, STOVE_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, PROCESS_CDOE, PROCESS_DESC, PLINE_CODE, PLINE_NAME, 
ACT_DIMATER, ACT_HEIGHT, TO_NUMBER(?), ACT_LEN_MIN, ACT_LEN_MAX, TO_NUMBER(?), 
TO_NUMBER(?), TO_NUMBER(?), JUDGE_RESULT_CODE, PRO_BC, PRO_BZ, RPO_TIME, 
SEN_BC, SEN_BZ, SEN_TIME, ZBS_BH, SALE_ORG, SALE_ORG_DESC, SALE_AREA, 
STORAGE_TYPE_NO, STORAGE_TYPE_NAME, MANAGEMENT_NO, MANAGEMENT_NAME, 
UPLOAD_WEB_FLAG, STORAGE_NO, LOCATION_NO, LARY_NO, LOC_NO, TRANS_TPE, RECEIV_NO, 
RECEIV_NM, STATION_NO, STATION_NM, SPCL_LN_NO, SPCL_LN_NM, PORT_NO, PLANT, 
PLANT_DESC, VSTEL, VSTEL_DESC, CARRY_COMPANY_CODE, CARRY_COMPANY_NAME, 
OUT_STOCK_CODE, DELIVY_PLACE_CODE, DELIVY_PLACE_NAME, STLMT_UNIT_NO, 
STLMT_UNIT_NM, TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'), '2', ?, TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'), ORD_PK, 
ORD_LN_PK, ORD_LN_DLY_PK, DEPARTMENT_CODE, DEPARTMENT_DESC, PONDER_NO, 
TO_NUMBER(?), JUDGE_STD_NAME, JUDGE_STD_CODE, TO_NUMBER(?), ZOUT_FLAG, 
'1', CREDIT_NO, PORT_DESC, ACT_FIX_NUM, ACT_FIX_LEN,FINISHPRO_MOLD,?,in_type,BILL_NO,MEASURING_SEQ,? from ydm_zc_loadvehicle_mat where MAT_NO=? AND BILL_NO=? AND RETURN_FLAG='0'
 ]]>
	</query>
	<query id="FrmReturnDashed.queryBillMReturn" desc="查询提单主表是否有信息">
 <![CDATA[
SELECT COUNT(*) COUNT,MAX(T.BILL_NO_SEQ) BILL_NO_SEQ FROM YDM_ZC_BILL_M T WHERE T.BILL_NO=? AND T.ORD_LN_DLY_PK=?  AND T.RETURN_FLAG='1'
 ]]>
	</query>
	<query id="FrmReturnDashed.queryBillMMax" desc="查询最大提单号">
 <![CDATA[
 SELECT ? ||'-'||
             LPAD(NVL(TO_NUMBER(SUBSTR(MAX(BILL_NO), 16, 2)), 0) + 1, 2, 0) BILL_NO
        FROM YDM_ZC_BILL_M
       WHERE BILL_NO LIKE '#BillNO#' AND LENGTH(BILL_NO)!=15 
]]>
	</query>
	<query id="FrmReturnDashed.queryBillMMaxseq" desc="查询最大提单号序号">
 <![CDATA[
   SELECT ? ||
       LPAD(SUBSTR(NVL(MAX(T.BILL_NO_SEQ), '0000'), -4, 4) + 1, 4, '0') AS MAT_NO
  FROM YDM_ZC_BILL_M T
  WHERE BILL_NO =?
]]>
	</query>
	<query id = "FrmReturnDashed.selectYearMoth" desc = "查询期初中是否存在">
 SELECT COUNT(1) ACOUNT
   FROM YDM_ZC_INITIAL T
  WHERE (T.BAL_YEAR_MONTH ,T.SUPPLY_UNIT_CODE) in
        ( SELECT TO_CHAR(ADD_MONTHS(TO_DATE(MIN(L.BAL_YEAR_MONTH), 'YYYY-MM'), 1),
               'YYYYMM') BAL_YEAR_MONTH,M.SUPPLY_UNIT
  FROM YDM_ZC_LOADVEHICLE_MAT L LEFT JOIN YDM_ZC_BILL_M M ON M.BILL_NO = L.BILL_NO
          WHERE L.BILL_NO= ? GROUP BY M.SUPPLY_UNIT)
	</query>
	<query id="FrmReturnDashed.queryBillCseq" desc="查询最大提单材料表序号">
 <![CDATA[
  SELECT ? ||
       LPAD(SUBSTR(NVL(MAX(T.BILL_SQE), '0000'), -4, 4) + 1, 4, '0') AS BILL_SQE
  FROM YDM_ZC_BILL_C T
 WHERE T.Mat_No=?
]]>
	</query>
	<query id="FrmReturnDashed.queryLoadNo" desc="查询装车单号">
 <![CDATA[
    SELECT ? ||
       LPAD(SUBSTR(NVL(MAX(T.LOADVEHICLE_NO), '00'), -2, 2) + 1, 2, '0') AS LOADVEHICLE_NO
  FROM YDM_ZC_LOADVEHICLE T
 WHERE T.BILL_NO=?
]]>
	</query>
	<query id="FrmReturnDashed.queryLoadMatSeqNo" desc="生成装车序号">
 <![CDATA[
       SELECT ? ||
       LPAD(SUBSTR(NVL(MAX(T.LOADVEHICLE_SQE), '00000'), -5, 5) + 1, 5, '0') AS LOADVEHICLE_SQE
  FROM YDM_ZC_LOADVEHICLE_MAT T
 WHERE T.LOADVEHICLE_NO=?
]]>
	</query>
	<query id="FrmReturnDashed.deleteBillMReturn" desc="删除提单主表">
 <![CDATA[
DELETE YDM_ZC_BILL_M T WHERE T.BILL_NO =?  AND T.ORD_LN_DLY_PK=? AND T.RETURN_FLAG='1'
]]>
	</query>
	<query id="FrmReturnDashed.deleteBillCReturn" desc="删除提单从表">
 <![CDATA[
DELETE YDM_ZC_BILL_C T
 WHERE T.BILL_NO = ?
   AND T.ORD_LN_DLY_PK = ?
   AND T.JUDGE_STOVE_NO = ?
   AND NVL(T.BATCH_NO, '/') = NVL(?, '/')
   AND T.GROUP_NO = ?
   AND T.RETURN_FLAG = '1'
]]>
	</query>
	<query id="FrmReturnDashed.deleteLoadReturn" desc="删除装车主表">
 <![CDATA[
DELETE YDM_ZC_LOADVEHICLE T WHERE T.BILL_NO =?  AND T.RETURN_FLAG='1'
]]>
	</query>
	<query id="FrmReturnDashed.deleteLoadMatReturn" desc="删除装车从表">
 <![CDATA[
DELETE YDM_ZC_LOADVEHICLE_MAT T
 WHERE T.BILL_NO = ?
   AND T.ORD_LN_DLY_PK = ?
   AND T.JUDGE_STOVE_NO = ?
   AND NVL(T.BATCH_NO, '/') = NVL(?, '/')
   AND T.GROUP_NO = ? 
   AND T.RETURN_FLAG = '1'
]]>
	</query>
	<query id="FrmReturnDashed.queryBillCRtrun" desc="查询提单从表是否还存在退货提单">
 <![CDATA[
SELECT *
  FROM YDM_ZC_BILL_C T
  WHERE T.BILL_NO = ? 
         AND T.JUDGE_STOVE_NO = ?
         AND NVL(T.BATCH_NO, '/') = NVL(?, '/')
         AND T.GROUP_NO = ?
         AND T.ORD_LN_DLY_PK = ?
         AND T.RETURN_FLAG = '1'
]]>
	</query>
	<query id="FrmReturnDashed.queryLoadMatRtrun" desc="查询装车从表是否还存在提单">
 <![CDATA[
SELECT *
  FROM YDM_ZC_LOADVEHICLE_MAT T
  WHERE T.BILL_NO = ? 
         AND T.JUDGE_STOVE_NO = ?
         AND NVL(T.BATCH_NO, '/') = NVL(?, '/')
         AND T.GROUP_NO = ?
         AND T.ORD_LN_DLY_PK = ?
         AND T.RETURN_FLAG = '1'
]]>
	</query>
		<query id="FrmReturnDashed.queryBillMRtrun" desc="查询提单主表是否可退货">
 <![CDATA[
SELECT MAX(T.BILL_TICKET_STATUS) BILL_TICKET_STATUS
  FROM YDM_ZC_BILL_M T
 WHERE T.BILL_NO = ?
   AND T.RETURN_FLAG = '1'
]]>
	</query>
		<query id="FrmReturnDashed.queryLoadMatNo" desc="查询每只装车材料信息">
 <![CDATA[
SELECT * FROM (SELECT T2.MAT_NO,
       T2.JUDGE_STOVE_NO,
       T2.BATCH_NO,
       T2.BATCH_GROUD_NO,
       T2.ACT_COUNT,
       T2.ACT_WEIGHT,
       T2.SEND_NUM,
       T2.ACT_LEN
  FROM (SELECT MAT_NO,
               JUDGE_STOVE_NO,
               BATCH_NO,
               BATCH_GROUD_NO,
               SUM(ACT_COUNT) ACT_COUNT,
               SUM(ACT_WEIGHT) ACT_WEIGHT,
               SUM(SEND_NUM) SEND_NUM,
               SUM(ACT_LEN) ACT_LEN
          FROM (SELECT T.MEASURING_SEQ,
                       T.MAT_NO,
                       T.JUDGE_STOVE_NO,
                       T.BATCH_NO,
                       T.GROUP_NO BATCH_GROUD_NO,
                       T.ACT_COUNT,
                       CASE
                         WHEN T.PONDER_NO IS NOT NULL  and (SELECT LOADVEHICLE_TYPE FROM YDM_ZC_LOADVEHICLE WHERE BILL_NO = T.BILL_NO AND ROWNUM = 1) = '1'   THEN
                          TO_CHAR(NVL(T.PONDER_GROSS_WT, '0'),
                                  'FM999999990.000')
                         ELSE
                          TO_CHAR(NVL(T.ACT_WEIGHT, 0), 'FM999999990.000')
                       END AS ACT_WEIGHT,
                       NVL(T.SEND_NUM, 0) AS SEND_NUM,
                       T.ACT_LEN
                  FROM YDM_ZC_LOADVEHICLE_MAT T
                 WHERE T.BILL_NO= ?
                   AND T.JUDGE_STOVE_NO = ?
                   AND T.BATCH_NO = ?
                   AND T.GROUP_NO = ?
                   AND T.RETURN_FLAG = '0'
                UNION ALL
                SELECT T.MEASURING_SEQ,
                       T.MAT_NO,
                       T.JUDGE_STOVE_NO,
                       T.BATCH_NO,
                       T.GROUP_NO BATCH_GROUD_NO,
                       T.ACT_COUNT,
                       CASE
                         WHEN T.PONDER_NO IS NOT NULL THEN
                          TO_CHAR(NVL(T.PONDER_GROSS_WT, '0'),
                                  'FM999999990.000')
                         ELSE
                          TO_CHAR(NVL(T.ACT_WEIGHT, 0), 'FM999999990.000')
                       END AS ACT_WEIGHT,
                       NVL(T.SEND_NUM, 0) AS SEND_NUM,
                       T.ACT_LEN
                  FROM YDM_ZC_LOADVEHICLE_MAT T
                 WHERE T.BILL_NO LIKE '%'||?||'%'
                   AND T.JUDGE_STOVE_NO = ?
                   AND T.BATCH_NO = ?
                   AND T.GROUP_NO = ?
                   AND T.RETURN_FLAG = '1')
         GROUP BY MAT_NO, JUDGE_STOVE_NO, BATCH_NO, BATCH_GROUD_NO) T2
 WHERE T2.ACT_COUNT > '0'
 ORDER BY T2.MAT_NO DESC) WHERE ROWNUM<=? ORDER BY MAT_NO ASC
]]>
	</query>
	<query id="FrmReturnDashed.AddMatNoZc" desc="新增材料表（删除材料表MAT_ZC_BACKUP）">
	<![CDATA[  
DECLARE 
BEGIN
 INSERT INTO MAT_ZC_M (MAT_NO, PRODUCT_FLAG, MAT_STATUS, 
LOT_NO, STOVE_NO, JUDGE_STOVE_NO, BATCH_NO, BATCH_GROUD_NO, MAT_SQE_NO, 
SAMPLE_FLAG, CUTTING_FLAG, ORIGIN_MAT_NO, MATERIAL_NO, MATERIAL_NAME, 
INPUT_MATERIAL_NAME, INPUT_MATERIAL_NO, INPUT_ORIGIN_CODE, 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, PRO_ORDER_NO1, PRO_ORDER_ID, PRO_ORDER_ID1, ORDER_NO, ORDER_SEQ, 
ORDER_SEQ_NO, CRAF_NO, PROCESS_CDOE, PROCESS_DESC, NEXT_PROCESS_CDOE, 
NEXT_PROCESS_DESC, PLINE_CODE, PLINE_NAME, MAT_ORIGIN_CODE, MAT_ORIGIN_NAME, 
DIMATER, HEIGHT, LEN_NO, LEN_DESC, LEN_UNIT, LEN_MIN, LEN_MAX, TARG_DIMATER, 
TARG_HEIGHT, TARG_LEN_MIN, TARG_LEN_MAX, ACT_DIMATER, ACT_HEIGHT, ACT_LEN, 
ACT_LEN_MIN, ACT_LEN_MAX, ACT_COUNT, ACT_WEIGHT, ACT_THEORY_WEIGHT, 
MEASURE_FLAG, BELONG_CODE, BELONG_NAME, PACK_FLAG, PACK_TYPE_CODE, 
PACK_TYPE_NAME, PACK_NO, PACK_TIME, PACK_MAT_WT, MAT_GROSS_WT, MAT_GOWHERE_CODE, 
MAT_GOWHERE_NAME, COOL_HOT_FLAG, MAT_RETURN_FLAG, HEAT_TREAT_NO, POST_FLAG, 
LOCK_FLAG, MNG_LOCK_RSN_CODE, MNG_LOCK_TIME, MNG_LOCK_MAKER, MNG_LOCK_REMARK, 
LOCK_RSN_CODE, LOCK_TIME, LOCK_MAKER, LOCK_REMARK, UNLOCK_TIME, UNLOCK_MAKER, 
UNLOCK_REMARK, OLD_ORDER_NO, OLD_ORDER_SEQ, OLD_ORDER_SEQ_NO, OLD_MATERIAL_NO, 
OLD_MATERIAL_NAME, REMAIN_RSN_CODE, REMAIN_JUGDE_TIME, REMAIN_JUGDE_MAKER, 
REMAIN_JUGDE_CODE, REMAIN_REMARK, JUGDE_APPLY_FLAG, JUGDE_APPLY_CODE, 
JUGDE_APPLY_TIME, JUGDE_SCAN_TIME, FACE_RESULT_CODE, FACE_RESULT_TIME, 
FACE_MAKER, SPEC_RESULT_CODE, SPEC_RESULT_TIME, SPEC_MAKER, CHEM_RESULT_CODE, 
CHEM_RESULT_TIME, CHEM_MAKER, PHY_RESULT_CODE, PHY_RESULT_TIME, PHY_MAKER, 
DETECT_REPORT_NO, DETECT_RESULT_CODE, WPRESSURE_REPORT_NO, 
WPRESSURE_RESULT_CODE, JUDGE_RESULT_CODE, JUDGE_RESULT, JUDGE_RESULT_TIME, 
JUDGE_MAKER, BUG_NO, BUG_DEAL, REPAIR_FLAG, REPAIR_REMARK, SAMPLING_FLAG, 
SAMPLING_TYPE, SAMPLING_NO, CHECKOUT_NO, CHEM_STCHECK_NO, CHEM_PROCHECK_NO, 
SH_CHECK_NO, COME_PROC_FLAG, CONFM_FLAG, INSTOCK_FLAG, INSTOCK_TIME, 
OUTSTOCK_TIME, PRO_BC, PRO_BZ, RPO_TIME, BAR_CODE, BEGINNING_FLAG, MEMO, 
CREATE_NAME, CREATE_TIME, UPDATE_NAME, UPDATE_TIME, REQ_BL_ID, IF_BATCHED_JG, 
COUPCUT_BATCH_ID, ORD_PK, ORD_LN_PK, ORD_LN_DLY_PK, OLD_ORD_PK, OLD_ORD_LN_PK, 
OLD_ORD_LN_DLY_PK, BAL_YEAR_MONTH, JUDGE_STD_NAME, JUDGE_STD_CODE, JUDGE_GRADE, 
PIPMEMO, TEST, SOURE_CODE, SOURE_NAME, PONDER_NO, PONDER_GROSS_WT, MEMO1, 
JUDGE_ID, MNG_LOCK_FLAG, LOCK_ID, PRO_NO, LOCK_LIKU, PLN_GRADECODE, 
PLN_GRADENAME, PLN_STEELCODE, PLN_STEELNAME, QCM_STAUS, OUTSTOCK_DOC, 
HEAT_PLAN_NO, ZG_STOVE_SQE, GX_PLAN_NO, ZG_MAT_NO, FINISHPRO_MOLD, IN_MOLD, in_type,
TARGET, PROCESS_STATUS, JUGDE_CONVICTED, GX_PLAN_NO1, FIXTYPE_CODE, 
QUALITY_GROUP_ZG, FLAG_STOVE_NO_ZG, ZG_PHY_RESULT_PATH, ZG_FACE_RESULT_PATH, 
ZG_SPEC_RESULT_PATH, VRP_HEAT_PLAN_NO, VRP_LOT_NO, VRP_SAMPLE_FLAG, 
VRP_PRO_ORDER_NO, VRP_PRO_ORDER_NO1, VRP_PRO_ORDER_ID, VRP_PRO_ORDER_ID1, 
VRP_ACT_DIMATER, VRP_ACT_HEIGHT, VRP_JUGDE_APPLY_FLAG, VRP_JUGDE_APPLY_CODE, 
VRP_JUGDE_APPLY_TIME, VRP_FACE_RESULT_CODE, VRP_FACE_RESULT_TIME, 
VRP_FACE_MAKER, VRP_FACE_RESULT_PATH, VRP_SPEC_RESULT_CODE, 
VRP_SPEC_RESULT_TIME, VRP_SPEC_MAKER, VRP_SPEC_RESULT_PATH, VRP_PHY_RESULT_CODE, 
VRP_PHY_RESULT_TIME, VRP_PHY_MAKER, VRP_PHY_RESULT_PATH, VRP_JUDGE_RESULT_CODE, 
VRP_JUDGE_RESULT_TIME, VRP_JUDGE_MAKER, VRP_GX_PLAN_NO, VRP_GX_PLAN_NO1, 
VPR_JUGDE_CONVICTED, VPR_QUALITY_GROUP_ZG, VPR_FLAG_STOVE_NO_ZG, 
HTT_HEAT_PLAN_NO, HTT_LOT_NO, HTT_SAMPLE_FLAG, HTT_PRO_ORDER_NO, 
HTT_PRO_ORDER_NO1, HTT_PRO_ORDER_ID, HTT_PRO_ORDER_ID1, HTT_GX_PLAN_NO, 
HTT_GX_PLAN_NO1, HTT_JUGDE_APPLY_FLAG, HTT_JUGDE_APPLY_CODE, 
HTT_JUGDE_APPLY_TIME, HTT_FACE_RESULT_CODE, HTT_FACE_RESULT_TIME, 
HTT_FACE_MAKER, HTT_FACE_RESULT_PATH, HTT_SPEC_RESULT_CODE, 
HTT_SPEC_RESULT_TIME, HTT_SPEC_MAKER, HTT_SPEC_RESULT_PATH, HTT_PHY_RESULT_CODE, 
HTT_PHY_RESULT_TIME, HTT_PHY_MAKER, HTT_PHY_RESULT_PATH, HTT_JUDGE_RESULT_CODE, 
HTT_JUDGE_RESULT_TIME, HTT_JUDGE_MAKER, HTT_JUGDE_CONVICTED, 
HTT_QUALITY_GROUP_ZG, HTT_FLAG_STOVE_NO_ZG, PRC_LOT_NO, PRC_SAMPLE_FLAG, 
PRC_PRO_ORDER_NO, PRC_PRO_ORDER_NO1, PRC_PRO_ORDER_ID, PRC_PRO_ORDER_ID1, 
PRC_GX_PLAN_NO, PRC_GX_PLAN_NO1, PRC_JUGDE_APPLY_FLAG, PRC_JUGDE_APPLY_CODE, 
PRC_JUGDE_APPLY_TIME, PRC_FACE_RESULT_CODE, PRC_FACE_RESULT_TIME, 
PRC_FACE_MAKER, PRC_FACE_RESULT_PATH, PRC_SPEC_RESULT_CODE, 
PRC_SPEC_RESULT_TIME, PRC_SPEC_MAKER, PRC_SPEC_RESULT_PATH, PRC_PHY_RESULT_CODE, 
PRC_PHY_RESULT_TIME, PRC_PHY_MAKER, PRC_PHY_RESULT_PATH, PRC_JUDGE_RESULT_CODE, 
PRC_JUDGE_RESULT_TIME, PRC_JUDGE_MAKER, PRC_JUGDE_CONVICTED, 
PRC_QUALITY_GROUP_ZG, PRC_FLAG_STOVE_NO_ZG, PRC_HEAT_PLAN_NO, 
VRP_JUDGE_STD_NAME, VRP_JUDGE_STD_CODE, HTT_JUDGE_STD_NAME, HTT_JUDGE_STD_CODE, 
PRC_JUDGE_STD_NAME, PRC_JUDGE_STD_CODE, VRP_CRAF_NO, HTT_CRAF_NO, PRC_CRAF_NO, 
VRP_CHEM_RESULT_CODE, VRP_CHEM_RESULT_TIME, VRP_CHEM_MAKER, 
HTT_CHEM_RESULT_CODE, HTT_CHEM_RESULT_TIME, HTT_CHEM_MAKER, 
PRC_CHEM_RESULT_CODE, PRC_CHEM_RESULT_TIME, PRC_CHEM_MAKER, DETECT_REPORT_NO1, 
DETECT_RESULT_CODE1, TESTING_GRADE, TESTING_TYPE, TESTING_GRADE1, TESTING_TYPE1, 
ZG_PLINE_CODE, ZG_PLINE_NAME, VRP_PLINE_CODE, VRP_PLINE_NAME, HTT_PLINE_CODE, 
HTT_PLINE_NAME, PRC_PLINE_CODE, PRC_PLINE_NAME,VRP_QCM_STAUS,HTT_QCM_STAUS,PRC_QCM_STAUS,ZG_MEMO,ZBS_FLAG,ZBS_ID,JG_ZBS_ID,
SUPPLY_UNIT_CODE,SUPPLY_UNIT,IS_DEALER) 
SELECT MAT_NO, PRODUCT_FLAG, 
'80150301', LOT_NO, STOVE_NO, JUDGE_STOVE_NO, BATCH_NO, BATCH_GROUD_NO, 
MAT_SQE_NO, SAMPLE_FLAG, CUTTING_FLAG, ORIGIN_MAT_NO, MATERIAL_NO, 
MATERIAL_NAME, INPUT_MATERIAL_NAME, INPUT_MATERIAL_NO, INPUT_ORIGIN_CODE, 
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, PRO_ORDER_NO1, PRO_ORDER_ID, PRO_ORDER_ID1, 
ORDER_NO, ORDER_SEQ, ORDER_SEQ_NO, CRAF_NO,
(CASE WHEN T.PROCESS_CDOE IS NULL  THEN (SELECT T1.PROCESS_CODE FROM COM_BASE_PLINE T1 WHERE T1.PLINE_CODE=T.PLINE_CODE)
ELSE T.PROCESS_CDOE END
),
(CASE WHEN T.PROCESS_DESC IS NULL  THEN (SELECT T1.PROCESS_DESC FROM COM_BASE_PLINE T1 WHERE T1.PLINE_CODE=T.PLINE_CODE)
ELSE T.PROCESS_DESC END
),
NEXT_PROCESS_CDOE, NEXT_PROCESS_DESC, PLINE_CODE, PLINE_NAME, MAT_ORIGIN_CODE, 
MAT_ORIGIN_NAME, DIMATER, HEIGHT, LEN_NO, LEN_DESC, LEN_UNIT, LEN_MIN, LEN_MAX, 
TARG_DIMATER, TARG_HEIGHT, TARG_LEN_MIN, TARG_LEN_MAX, ACT_DIMATER, ACT_HEIGHT, 
ACT_LEN, ACT_LEN_MIN, ACT_LEN_MAX, ACT_COUNT, ?, ACT_THEORY_WEIGHT, 
MEASURE_FLAG,
(CASE WHEN BELONG_CODE = '100103'  THEN '100101'ELSE BELONG_CODE END),
(SELECT T1.BASENAME FROM COM_BASE_INFO T1 WHERE T1.BASECODE=(CASE WHEN BELONG_CODE = '100103'  THEN '100101' ELSE BELONG_CODE END)),
PACK_FLAG, PACK_TYPE_CODE,
PACK_TYPE_NAME, PACK_NO, PACK_TIME, PACK_MAT_WT, MAT_GROSS_WT, MAT_GOWHERE_CODE, 
MAT_GOWHERE_NAME, COOL_HOT_FLAG, MAT_RETURN_FLAG, HEAT_TREAT_NO, POST_FLAG, 
LOCK_FLAG, MNG_LOCK_RSN_CODE, MNG_LOCK_TIME, MNG_LOCK_MAKER, MNG_LOCK_REMARK, 
LOCK_RSN_CODE, LOCK_TIME, LOCK_MAKER, LOCK_REMARK, UNLOCK_TIME, UNLOCK_MAKER, 
UNLOCK_REMARK, OLD_ORDER_NO, OLD_ORDER_SEQ, OLD_ORDER_SEQ_NO, OLD_MATERIAL_NO, 
OLD_MATERIAL_NAME, REMAIN_RSN_CODE, REMAIN_JUGDE_TIME, REMAIN_JUGDE_MAKER, 
REMAIN_JUGDE_CODE, REMAIN_REMARK, JUGDE_APPLY_FLAG, JUGDE_APPLY_CODE, 
JUGDE_APPLY_TIME, JUGDE_SCAN_TIME, FACE_RESULT_CODE, FACE_RESULT_TIME, 
FACE_MAKER, SPEC_RESULT_CODE, SPEC_RESULT_TIME, SPEC_MAKER, CHEM_RESULT_CODE, 
CHEM_RESULT_TIME, CHEM_MAKER, PHY_RESULT_CODE, PHY_RESULT_TIME, PHY_MAKER, 
DETECT_REPORT_NO, DETECT_RESULT_CODE, WPRESSURE_REPORT_NO, 
WPRESSURE_RESULT_CODE, JUDGE_RESULT_CODE, JUDGE_RESULT, JUDGE_RESULT_TIME, 
JUDGE_MAKER, BUG_NO, BUG_DEAL, REPAIR_FLAG, REPAIR_REMARK, SAMPLING_FLAG, 
SAMPLING_TYPE, SAMPLING_NO, CHECKOUT_NO, CHEM_STCHECK_NO, CHEM_PROCHECK_NO, 
SH_CHECK_NO, COME_PROC_FLAG, CONFM_FLAG, INSTOCK_FLAG, INSTOCK_TIME, 
OUTSTOCK_TIME, PRO_BC, PRO_BZ, RPO_TIME, BAR_CODE, BEGINNING_FLAG, MEMO, 
CREATE_NAME, CREATE_TIME, UPDATE_NAME, UPDATE_TIME, REQ_BL_ID, IF_BATCHED_JG, 
COUPCUT_BATCH_ID, ORD_PK, ORD_LN_PK, ORD_LN_DLY_PK, OLD_ORD_PK, OLD_ORD_LN_PK, 
OLD_ORD_LN_DLY_PK, BAL_YEAR_MONTH, JUDGE_STD_NAME, JUDGE_STD_CODE, JUDGE_GRADE, 
?, TEST, SOURE_CODE, SOURE_NAME, PONDER_NO, PONDER_GROSS_WT, '', JUDGE_ID,
MNG_LOCK_FLAG, LOCK_ID, PRO_NO, LOCK_LIKU, PLN_GRADECODE, PLN_GRADENAME, 
PLN_STEELCODE, PLN_STEELNAME, QCM_STAUS, OUTSTOCK_DOC, HEAT_PLAN_NO, 
ZG_STOVE_SQE, GX_PLAN_NO, ZG_MAT_NO, ?, ?, in_type,TARGET,
PROCESS_STATUS, JUGDE_CONVICTED, GX_PLAN_NO1, FIXTYPE_CODE, QUALITY_GROUP_ZG, 
FLAG_STOVE_NO_ZG, ZG_PHY_RESULT_PATH, ZG_FACE_RESULT_PATH, ZG_SPEC_RESULT_PATH, 
VRP_HEAT_PLAN_NO, VRP_LOT_NO, VRP_SAMPLE_FLAG, VRP_PRO_ORDER_NO, 
VRP_PRO_ORDER_NO1, VRP_PRO_ORDER_ID, VRP_PRO_ORDER_ID1, VRP_ACT_DIMATER, 
VRP_ACT_HEIGHT, VRP_JUGDE_APPLY_FLAG, VRP_JUGDE_APPLY_CODE, 
VRP_JUGDE_APPLY_TIME, VRP_FACE_RESULT_CODE, VRP_FACE_RESULT_TIME, 
VRP_FACE_MAKER, VRP_FACE_RESULT_PATH, VRP_SPEC_RESULT_CODE, 
VRP_SPEC_RESULT_TIME, VRP_SPEC_MAKER, VRP_SPEC_RESULT_PATH, VRP_PHY_RESULT_CODE, 
VRP_PHY_RESULT_TIME, VRP_PHY_MAKER, VRP_PHY_RESULT_PATH, VRP_JUDGE_RESULT_CODE, 
VRP_JUDGE_RESULT_TIME, VRP_JUDGE_MAKER, VRP_GX_PLAN_NO, VRP_GX_PLAN_NO1, 
VPR_JUGDE_CONVICTED, VPR_QUALITY_GROUP_ZG, VPR_FLAG_STOVE_NO_ZG, 
HTT_HEAT_PLAN_NO, HTT_LOT_NO, HTT_SAMPLE_FLAG, HTT_PRO_ORDER_NO, 
HTT_PRO_ORDER_NO1, HTT_PRO_ORDER_ID, HTT_PRO_ORDER_ID1, HTT_GX_PLAN_NO, 
HTT_GX_PLAN_NO1, HTT_JUGDE_APPLY_FLAG, HTT_JUGDE_APPLY_CODE, 
HTT_JUGDE_APPLY_TIME, HTT_FACE_RESULT_CODE, HTT_FACE_RESULT_TIME, 
HTT_FACE_MAKER, HTT_FACE_RESULT_PATH, HTT_SPEC_RESULT_CODE, 
HTT_SPEC_RESULT_TIME, HTT_SPEC_MAKER, HTT_SPEC_RESULT_PATH, HTT_PHY_RESULT_CODE, 
HTT_PHY_RESULT_TIME, HTT_PHY_MAKER, HTT_PHY_RESULT_PATH, HTT_JUDGE_RESULT_CODE, 
HTT_JUDGE_RESULT_TIME, HTT_JUDGE_MAKER, HTT_JUGDE_CONVICTED, 
HTT_QUALITY_GROUP_ZG, HTT_FLAG_STOVE_NO_ZG, PRC_LOT_NO, PRC_SAMPLE_FLAG, 
PRC_PRO_ORDER_NO, PRC_PRO_ORDER_NO1, PRC_PRO_ORDER_ID, PRC_PRO_ORDER_ID1, 
PRC_GX_PLAN_NO, PRC_GX_PLAN_NO1, PRC_JUGDE_APPLY_FLAG, PRC_JUGDE_APPLY_CODE, 
PRC_JUGDE_APPLY_TIME, PRC_FACE_RESULT_CODE, PRC_FACE_RESULT_TIME, 
PRC_FACE_MAKER, PRC_FACE_RESULT_PATH, PRC_SPEC_RESULT_CODE, 
PRC_SPEC_RESULT_TIME, PRC_SPEC_MAKER, PRC_SPEC_RESULT_PATH, PRC_PHY_RESULT_CODE, 
PRC_PHY_RESULT_TIME, PRC_PHY_MAKER, PRC_PHY_RESULT_PATH, PRC_JUDGE_RESULT_CODE, 
PRC_JUDGE_RESULT_TIME, PRC_JUDGE_MAKER, PRC_JUGDE_CONVICTED, 
PRC_QUALITY_GROUP_ZG, PRC_FLAG_STOVE_NO_ZG, PRC_HEAT_PLAN_NO, 
VRP_JUDGE_STD_NAME, VRP_JUDGE_STD_CODE, HTT_JUDGE_STD_NAME, HTT_JUDGE_STD_CODE, 
PRC_JUDGE_STD_NAME, PRC_JUDGE_STD_CODE, VRP_CRAF_NO, HTT_CRAF_NO, PRC_CRAF_NO, 
VRP_CHEM_RESULT_CODE, VRP_CHEM_RESULT_TIME, VRP_CHEM_MAKER, 
HTT_CHEM_RESULT_CODE, HTT_CHEM_RESULT_TIME, HTT_CHEM_MAKER, 
PRC_CHEM_RESULT_CODE, PRC_CHEM_RESULT_TIME, PRC_CHEM_MAKER, DETECT_REPORT_NO1, 
DETECT_RESULT_CODE1, TESTING_GRADE, TESTING_TYPE, TESTING_GRADE1, TESTING_TYPE1, 
ZG_PLINE_CODE, ZG_PLINE_NAME, VRP_PLINE_CODE, VRP_PLINE_NAME, HTT_PLINE_CODE, 
HTT_PLINE_NAME, PRC_PLINE_CODE, PRC_PLINE_NAME,VRP_QCM_STAUS,HTT_QCM_STAUS,PRC_QCM_STAUS,
ZG_MEMO,ZBS_FLAG,ZBS_ID,JG_ZBS_ID,DECODE(SUPPLY_UNIT_CODE,NULL,'120501',SUPPLY_UNIT_CODE),DECODE(SUPPLY_UNIT,NULL,'天津钢管制造有限公司',SUPPLY_UNIT),
IS_DEALER
 FROM MAT_ZC_BACKUP T WHERE MAT_NO = ?; 
 
 INSERT INTO MAT_ZC_M_XS (MAT_NO, PRODUCT_FLAG, MAT_STATUS, 
LOT_NO, STOVE_NO, JUDGE_STOVE_NO, BATCH_NO, BATCH_GROUD_NO, MAT_SQE_NO, 
SAMPLE_FLAG, CUTTING_FLAG, ORIGIN_MAT_NO, MATERIAL_NO, MATERIAL_NAME, 
INPUT_MATERIAL_NAME, INPUT_MATERIAL_NO, INPUT_ORIGIN_CODE, 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, PRO_ORDER_NO1, PRO_ORDER_ID, PRO_ORDER_ID1, ORDER_NO, ORDER_SEQ, 
ORDER_SEQ_NO, CRAF_NO, PROCESS_CDOE, PROCESS_DESC, NEXT_PROCESS_CDOE, 
NEXT_PROCESS_DESC, PLINE_CODE, PLINE_NAME, MAT_ORIGIN_CODE, MAT_ORIGIN_NAME, 
DIMATER, HEIGHT, LEN_NO, LEN_DESC, LEN_UNIT, LEN_MIN, LEN_MAX, TARG_DIMATER, 
TARG_HEIGHT, TARG_LEN_MIN, TARG_LEN_MAX, ACT_DIMATER, ACT_HEIGHT, ACT_LEN, 
ACT_LEN_MIN, ACT_LEN_MAX, ACT_COUNT, ACT_WEIGHT, ACT_THEORY_WEIGHT, 
MEASURE_FLAG, BELONG_CODE, BELONG_NAME, PACK_FLAG, PACK_TYPE_CODE, 
PACK_TYPE_NAME, PACK_NO, PACK_TIME, PACK_MAT_WT, MAT_GROSS_WT, MAT_GOWHERE_CODE, 
MAT_GOWHERE_NAME, COOL_HOT_FLAG, MAT_RETURN_FLAG, HEAT_TREAT_NO, POST_FLAG, 
LOCK_FLAG, MNG_LOCK_RSN_CODE, MNG_LOCK_TIME, MNG_LOCK_MAKER, MNG_LOCK_REMARK, 
LOCK_RSN_CODE, LOCK_TIME, LOCK_MAKER, LOCK_REMARK, UNLOCK_TIME, UNLOCK_MAKER, 
UNLOCK_REMARK, OLD_ORDER_NO, OLD_ORDER_SEQ, OLD_ORDER_SEQ_NO, OLD_MATERIAL_NO, 
OLD_MATERIAL_NAME, REMAIN_RSN_CODE, REMAIN_JUGDE_TIME, REMAIN_JUGDE_MAKER, 
REMAIN_JUGDE_CODE, REMAIN_REMARK, JUGDE_APPLY_FLAG, JUGDE_APPLY_CODE, 
JUGDE_APPLY_TIME, JUGDE_SCAN_TIME, FACE_RESULT_CODE, FACE_RESULT_TIME, 
FACE_MAKER, SPEC_RESULT_CODE, SPEC_RESULT_TIME, SPEC_MAKER, CHEM_RESULT_CODE, 
CHEM_RESULT_TIME, CHEM_MAKER, PHY_RESULT_CODE, PHY_RESULT_TIME, PHY_MAKER, 
DETECT_REPORT_NO, DETECT_RESULT_CODE, WPRESSURE_REPORT_NO, 
WPRESSURE_RESULT_CODE, JUDGE_RESULT_CODE, JUDGE_RESULT, JUDGE_RESULT_TIME, 
JUDGE_MAKER, BUG_NO, BUG_DEAL, REPAIR_FLAG, REPAIR_REMARK, SAMPLING_FLAG, 
SAMPLING_TYPE, SAMPLING_NO, CHECKOUT_NO, CHEM_STCHECK_NO, CHEM_PROCHECK_NO, 
SH_CHECK_NO, COME_PROC_FLAG, CONFM_FLAG, INSTOCK_FLAG, INSTOCK_TIME, 
OUTSTOCK_TIME, PRO_BC, PRO_BZ, RPO_TIME, BAR_CODE, BEGINNING_FLAG, MEMO, 
CREATE_NAME, CREATE_TIME, UPDATE_NAME, UPDATE_TIME, REQ_BL_ID, IF_BATCHED_JG, 
COUPCUT_BATCH_ID, ORD_PK, ORD_LN_PK, ORD_LN_DLY_PK, OLD_ORD_PK, OLD_ORD_LN_PK, 
OLD_ORD_LN_DLY_PK, BAL_YEAR_MONTH, JUDGE_STD_NAME, JUDGE_STD_CODE, JUDGE_GRADE, 
PIPMEMO, TEST, SOURE_CODE, SOURE_NAME, PONDER_NO, PONDER_GROSS_WT, MEMO1, 
JUDGE_ID, MNG_LOCK_FLAG, LOCK_ID, PRO_NO, LOCK_LIKU, PLN_GRADECODE, 
PLN_GRADENAME, PLN_STEELCODE, PLN_STEELNAME, QCM_STAUS, OUTSTOCK_DOC, 
HEAT_PLAN_NO, ZG_STOVE_SQE, GX_PLAN_NO, ZG_MAT_NO, FINISHPRO_MOLD, IN_MOLD, in_type,
TARGET, PROCESS_STATUS, JUGDE_CONVICTED, GX_PLAN_NO1, FIXTYPE_CODE, 
QUALITY_GROUP_ZG, FLAG_STOVE_NO_ZG, ZG_PHY_RESULT_PATH, ZG_FACE_RESULT_PATH, 
ZG_SPEC_RESULT_PATH, VRP_HEAT_PLAN_NO, VRP_LOT_NO, VRP_SAMPLE_FLAG, 
VRP_PRO_ORDER_NO, VRP_PRO_ORDER_NO1, VRP_PRO_ORDER_ID, VRP_PRO_ORDER_ID1, 
VRP_ACT_DIMATER, VRP_ACT_HEIGHT, VRP_JUGDE_APPLY_FLAG, VRP_JUGDE_APPLY_CODE, 
VRP_JUGDE_APPLY_TIME, VRP_FACE_RESULT_CODE, VRP_FACE_RESULT_TIME, 
VRP_FACE_MAKER, VRP_FACE_RESULT_PATH, VRP_SPEC_RESULT_CODE, 
VRP_SPEC_RESULT_TIME, VRP_SPEC_MAKER, VRP_SPEC_RESULT_PATH, VRP_PHY_RESULT_CODE, 
VRP_PHY_RESULT_TIME, VRP_PHY_MAKER, VRP_PHY_RESULT_PATH, VRP_JUDGE_RESULT_CODE, 
VRP_JUDGE_RESULT_TIME, VRP_JUDGE_MAKER, VRP_GX_PLAN_NO, VRP_GX_PLAN_NO1, 
VPR_JUGDE_CONVICTED, VPR_QUALITY_GROUP_ZG, VPR_FLAG_STOVE_NO_ZG, 
HTT_HEAT_PLAN_NO, HTT_LOT_NO, HTT_SAMPLE_FLAG, HTT_PRO_ORDER_NO, 
HTT_PRO_ORDER_NO1, HTT_PRO_ORDER_ID, HTT_PRO_ORDER_ID1, HTT_GX_PLAN_NO, 
HTT_GX_PLAN_NO1, HTT_JUGDE_APPLY_FLAG, HTT_JUGDE_APPLY_CODE, 
HTT_JUGDE_APPLY_TIME, HTT_FACE_RESULT_CODE, HTT_FACE_RESULT_TIME, 
HTT_FACE_MAKER, HTT_FACE_RESULT_PATH, HTT_SPEC_RESULT_CODE, 
HTT_SPEC_RESULT_TIME, HTT_SPEC_MAKER, HTT_SPEC_RESULT_PATH, HTT_PHY_RESULT_CODE, 
HTT_PHY_RESULT_TIME, HTT_PHY_MAKER, HTT_PHY_RESULT_PATH, HTT_JUDGE_RESULT_CODE, 
HTT_JUDGE_RESULT_TIME, HTT_JUDGE_MAKER, HTT_JUGDE_CONVICTED, 
HTT_QUALITY_GROUP_ZG, HTT_FLAG_STOVE_NO_ZG, PRC_LOT_NO, PRC_SAMPLE_FLAG, 
PRC_PRO_ORDER_NO, PRC_PRO_ORDER_NO1, PRC_PRO_ORDER_ID, PRC_PRO_ORDER_ID1, 
PRC_GX_PLAN_NO, PRC_GX_PLAN_NO1, PRC_JUGDE_APPLY_FLAG, PRC_JUGDE_APPLY_CODE, 
PRC_JUGDE_APPLY_TIME, PRC_FACE_RESULT_CODE, PRC_FACE_RESULT_TIME, 
PRC_FACE_MAKER, PRC_FACE_RESULT_PATH, PRC_SPEC_RESULT_CODE, 
PRC_SPEC_RESULT_TIME, PRC_SPEC_MAKER, PRC_SPEC_RESULT_PATH, PRC_PHY_RESULT_CODE, 
PRC_PHY_RESULT_TIME, PRC_PHY_MAKER, PRC_PHY_RESULT_PATH, PRC_JUDGE_RESULT_CODE, 
PRC_JUDGE_RESULT_TIME, PRC_JUDGE_MAKER, PRC_JUGDE_CONVICTED, 
PRC_QUALITY_GROUP_ZG, PRC_FLAG_STOVE_NO_ZG, PRC_HEAT_PLAN_NO, 
VRP_JUDGE_STD_NAME, VRP_JUDGE_STD_CODE, HTT_JUDGE_STD_NAME, HTT_JUDGE_STD_CODE, 
PRC_JUDGE_STD_NAME, PRC_JUDGE_STD_CODE, VRP_CRAF_NO, HTT_CRAF_NO, PRC_CRAF_NO, 
VRP_CHEM_RESULT_CODE, VRP_CHEM_RESULT_TIME, VRP_CHEM_MAKER, 
HTT_CHEM_RESULT_CODE, HTT_CHEM_RESULT_TIME, HTT_CHEM_MAKER, 
PRC_CHEM_RESULT_CODE, PRC_CHEM_RESULT_TIME, PRC_CHEM_MAKER, DETECT_REPORT_NO1, 
DETECT_RESULT_CODE1, TESTING_GRADE, TESTING_TYPE, TESTING_GRADE1, TESTING_TYPE1, 
ZG_PLINE_CODE, ZG_PLINE_NAME, VRP_PLINE_CODE, VRP_PLINE_NAME, HTT_PLINE_CODE, 
HTT_PLINE_NAME, PRC_PLINE_CODE, PRC_PLINE_NAME,VRP_QCM_STAUS,HTT_QCM_STAUS,PRC_QCM_STAUS,ZG_MEMO,ZBS_FLAG,ZBS_ID,JG_ZBS_ID,
SUPPLY_UNIT_CODE,SUPPLY_UNIT,IS_DEALER) 
SELECT MAT_NO, PRODUCT_FLAG, 
'80150301', LOT_NO, STOVE_NO, JUDGE_STOVE_NO, BATCH_NO, BATCH_GROUD_NO, 
MAT_SQE_NO, SAMPLE_FLAG, CUTTING_FLAG, ORIGIN_MAT_NO, MATERIAL_NO, 
MATERIAL_NAME, INPUT_MATERIAL_NAME, INPUT_MATERIAL_NO, INPUT_ORIGIN_CODE, 
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, PRO_ORDER_NO1, PRO_ORDER_ID, PRO_ORDER_ID1, 
ORDER_NO, ORDER_SEQ, ORDER_SEQ_NO, CRAF_NO,
(CASE WHEN T.PROCESS_CDOE IS NULL  THEN (SELECT T1.PROCESS_CODE FROM COM_BASE_PLINE T1 WHERE T1.PLINE_CODE=T.PLINE_CODE)
ELSE T.PROCESS_CDOE END
),
(CASE WHEN T.PROCESS_DESC IS NULL  THEN (SELECT T1.PROCESS_DESC FROM COM_BASE_PLINE T1 WHERE T1.PLINE_CODE=T.PLINE_CODE)
ELSE T.PROCESS_DESC END
),
NEXT_PROCESS_CDOE, NEXT_PROCESS_DESC, PLINE_CODE, PLINE_NAME, MAT_ORIGIN_CODE, 
MAT_ORIGIN_NAME, DIMATER, HEIGHT, LEN_NO, LEN_DESC, LEN_UNIT, LEN_MIN, LEN_MAX, 
TARG_DIMATER, TARG_HEIGHT, TARG_LEN_MIN, TARG_LEN_MAX, ACT_DIMATER, ACT_HEIGHT, 
ACT_LEN, ACT_LEN_MIN, ACT_LEN_MAX, ACT_COUNT, ?, ACT_THEORY_WEIGHT, 
MEASURE_FLAG,
(CASE WHEN BELONG_CODE = '100103'  THEN '100101'ELSE BELONG_CODE END),
(SELECT T1.BASENAME FROM COM_BASE_INFO T1 WHERE T1.BASECODE=(CASE WHEN BELONG_CODE = '100103'  THEN '100101' ELSE BELONG_CODE END)),
PACK_FLAG, PACK_TYPE_CODE,
PACK_TYPE_NAME, PACK_NO, PACK_TIME, PACK_MAT_WT, MAT_GROSS_WT, MAT_GOWHERE_CODE, 
MAT_GOWHERE_NAME, COOL_HOT_FLAG, MAT_RETURN_FLAG, HEAT_TREAT_NO, POST_FLAG, 
LOCK_FLAG, MNG_LOCK_RSN_CODE, MNG_LOCK_TIME, MNG_LOCK_MAKER, MNG_LOCK_REMARK, 
LOCK_RSN_CODE, LOCK_TIME, LOCK_MAKER, LOCK_REMARK, UNLOCK_TIME, UNLOCK_MAKER, 
UNLOCK_REMARK, OLD_ORDER_NO, OLD_ORDER_SEQ, OLD_ORDER_SEQ_NO, OLD_MATERIAL_NO, 
OLD_MATERIAL_NAME, REMAIN_RSN_CODE, REMAIN_JUGDE_TIME, REMAIN_JUGDE_MAKER, 
REMAIN_JUGDE_CODE, REMAIN_REMARK, JUGDE_APPLY_FLAG, JUGDE_APPLY_CODE, 
JUGDE_APPLY_TIME, JUGDE_SCAN_TIME, FACE_RESULT_CODE, FACE_RESULT_TIME, 
FACE_MAKER, SPEC_RESULT_CODE, SPEC_RESULT_TIME, SPEC_MAKER, CHEM_RESULT_CODE, 
CHEM_RESULT_TIME, CHEM_MAKER, PHY_RESULT_CODE, PHY_RESULT_TIME, PHY_MAKER, 
DETECT_REPORT_NO, DETECT_RESULT_CODE, WPRESSURE_REPORT_NO, 
WPRESSURE_RESULT_CODE, JUDGE_RESULT_CODE, JUDGE_RESULT, JUDGE_RESULT_TIME, 
JUDGE_MAKER, BUG_NO, BUG_DEAL, REPAIR_FLAG, REPAIR_REMARK, SAMPLING_FLAG, 
SAMPLING_TYPE, SAMPLING_NO, CHECKOUT_NO, CHEM_STCHECK_NO, CHEM_PROCHECK_NO, 
SH_CHECK_NO, COME_PROC_FLAG, CONFM_FLAG, INSTOCK_FLAG, INSTOCK_TIME, 
OUTSTOCK_TIME, PRO_BC, PRO_BZ, RPO_TIME, BAR_CODE, BEGINNING_FLAG, MEMO, 
CREATE_NAME, CREATE_TIME, UPDATE_NAME, UPDATE_TIME, REQ_BL_ID, IF_BATCHED_JG, 
COUPCUT_BATCH_ID, ORD_PK, ORD_LN_PK, ORD_LN_DLY_PK, OLD_ORD_PK, OLD_ORD_LN_PK, 
OLD_ORD_LN_DLY_PK, BAL_YEAR_MONTH, JUDGE_STD_NAME, JUDGE_STD_CODE, JUDGE_GRADE, 
?, TEST, SOURE_CODE, SOURE_NAME, PONDER_NO, PONDER_GROSS_WT, '', JUDGE_ID,
MNG_LOCK_FLAG, LOCK_ID, PRO_NO, LOCK_LIKU, PLN_GRADECODE, PLN_GRADENAME, 
PLN_STEELCODE, PLN_STEELNAME, QCM_STAUS, OUTSTOCK_DOC, HEAT_PLAN_NO, 
ZG_STOVE_SQE, GX_PLAN_NO, ZG_MAT_NO, ?, ?, in_type,TARGET,
PROCESS_STATUS, JUGDE_CONVICTED, GX_PLAN_NO1, FIXTYPE_CODE, QUALITY_GROUP_ZG, 
FLAG_STOVE_NO_ZG, ZG_PHY_RESULT_PATH, ZG_FACE_RESULT_PATH, ZG_SPEC_RESULT_PATH, 
VRP_HEAT_PLAN_NO, VRP_LOT_NO, VRP_SAMPLE_FLAG, VRP_PRO_ORDER_NO, 
VRP_PRO_ORDER_NO1, VRP_PRO_ORDER_ID, VRP_PRO_ORDER_ID1, VRP_ACT_DIMATER, 
VRP_ACT_HEIGHT, VRP_JUGDE_APPLY_FLAG, VRP_JUGDE_APPLY_CODE, 
VRP_JUGDE_APPLY_TIME, VRP_FACE_RESULT_CODE, VRP_FACE_RESULT_TIME, 
VRP_FACE_MAKER, VRP_FACE_RESULT_PATH, VRP_SPEC_RESULT_CODE, 
VRP_SPEC_RESULT_TIME, VRP_SPEC_MAKER, VRP_SPEC_RESULT_PATH, VRP_PHY_RESULT_CODE, 
VRP_PHY_RESULT_TIME, VRP_PHY_MAKER, VRP_PHY_RESULT_PATH, VRP_JUDGE_RESULT_CODE, 
VRP_JUDGE_RESULT_TIME, VRP_JUDGE_MAKER, VRP_GX_PLAN_NO, VRP_GX_PLAN_NO1, 
VPR_JUGDE_CONVICTED, VPR_QUALITY_GROUP_ZG, VPR_FLAG_STOVE_NO_ZG, 
HTT_HEAT_PLAN_NO, HTT_LOT_NO, HTT_SAMPLE_FLAG, HTT_PRO_ORDER_NO, 
HTT_PRO_ORDER_NO1, HTT_PRO_ORDER_ID, HTT_PRO_ORDER_ID1, HTT_GX_PLAN_NO, 
HTT_GX_PLAN_NO1, HTT_JUGDE_APPLY_FLAG, HTT_JUGDE_APPLY_CODE, 
HTT_JUGDE_APPLY_TIME, HTT_FACE_RESULT_CODE, HTT_FACE_RESULT_TIME, 
HTT_FACE_MAKER, HTT_FACE_RESULT_PATH, HTT_SPEC_RESULT_CODE, 
HTT_SPEC_RESULT_TIME, HTT_SPEC_MAKER, HTT_SPEC_RESULT_PATH, HTT_PHY_RESULT_CODE, 
HTT_PHY_RESULT_TIME, HTT_PHY_MAKER, HTT_PHY_RESULT_PATH, HTT_JUDGE_RESULT_CODE, 
HTT_JUDGE_RESULT_TIME, HTT_JUDGE_MAKER, HTT_JUGDE_CONVICTED, 
HTT_QUALITY_GROUP_ZG, HTT_FLAG_STOVE_NO_ZG, PRC_LOT_NO, PRC_SAMPLE_FLAG, 
PRC_PRO_ORDER_NO, PRC_PRO_ORDER_NO1, PRC_PRO_ORDER_ID, PRC_PRO_ORDER_ID1, 
PRC_GX_PLAN_NO, PRC_GX_PLAN_NO1, PRC_JUGDE_APPLY_FLAG, PRC_JUGDE_APPLY_CODE, 
PRC_JUGDE_APPLY_TIME, PRC_FACE_RESULT_CODE, PRC_FACE_RESULT_TIME, 
PRC_FACE_MAKER, PRC_FACE_RESULT_PATH, PRC_SPEC_RESULT_CODE, 
PRC_SPEC_RESULT_TIME, PRC_SPEC_MAKER, PRC_SPEC_RESULT_PATH, PRC_PHY_RESULT_CODE, 
PRC_PHY_RESULT_TIME, PRC_PHY_MAKER, PRC_PHY_RESULT_PATH, PRC_JUDGE_RESULT_CODE, 
PRC_JUDGE_RESULT_TIME, PRC_JUDGE_MAKER, PRC_JUGDE_CONVICTED, 
PRC_QUALITY_GROUP_ZG, PRC_FLAG_STOVE_NO_ZG, PRC_HEAT_PLAN_NO, 
VRP_JUDGE_STD_NAME, VRP_JUDGE_STD_CODE, HTT_JUDGE_STD_NAME, HTT_JUDGE_STD_CODE, 
PRC_JUDGE_STD_NAME, PRC_JUDGE_STD_CODE, VRP_CRAF_NO, HTT_CRAF_NO, PRC_CRAF_NO, 
VRP_CHEM_RESULT_CODE, VRP_CHEM_RESULT_TIME, VRP_CHEM_MAKER, 
HTT_CHEM_RESULT_CODE, HTT_CHEM_RESULT_TIME, HTT_CHEM_MAKER, 
PRC_CHEM_RESULT_CODE, PRC_CHEM_RESULT_TIME, PRC_CHEM_MAKER, DETECT_REPORT_NO1, 
DETECT_RESULT_CODE1, TESTING_GRADE, TESTING_TYPE, TESTING_GRADE1, TESTING_TYPE1, 
ZG_PLINE_CODE, ZG_PLINE_NAME, VRP_PLINE_CODE, VRP_PLINE_NAME, HTT_PLINE_CODE, 
HTT_PLINE_NAME, PRC_PLINE_CODE, PRC_PLINE_NAME,VRP_QCM_STAUS,HTT_QCM_STAUS,PRC_QCM_STAUS,
ZG_MEMO,ZBS_FLAG,ZBS_ID,JG_ZBS_ID,DECODE(SUPPLY_UNIT_CODE,NULL,'120501',SUPPLY_UNIT_CODE),DECODE(SUPPLY_UNIT,NULL,'天津钢管制造有限公司',SUPPLY_UNIT),
IS_DEALER
 FROM MAT_ZC_BACKUP T WHERE MAT_NO = ?; 
 
DELETE MAT_ZC_BACKUP WHERE MAT_NO = ?;
 END;
 ]]>
	</query>
	<query id="FrmReturnDashed.AddMatZcBackup" desc="新增材料表MAT_ZC_BACKUP">
	<![CDATA[  
DECLARE 
BEGIN
 INSERT INTO MAT_ZC_BACKUP (MAT_NO, PRODUCT_FLAG, MAT_STATUS, 
LOT_NO, STOVE_NO, JUDGE_STOVE_NO, BATCH_NO, BATCH_GROUD_NO, MAT_SQE_NO, 
SAMPLE_FLAG, CUTTING_FLAG, ORIGIN_MAT_NO, MATERIAL_NO, MATERIAL_NAME, 
INPUT_MATERIAL_NAME, INPUT_MATERIAL_NO, INPUT_ORIGIN_CODE, 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, PRO_ORDER_NO1, PRO_ORDER_ID, PRO_ORDER_ID1, ORDER_NO, ORDER_SEQ, 
ORDER_SEQ_NO, CRAF_NO, PROCESS_CDOE, PROCESS_DESC, NEXT_PROCESS_CDOE, 
NEXT_PROCESS_DESC, PLINE_CODE, PLINE_NAME, MAT_ORIGIN_CODE, MAT_ORIGIN_NAME, 
DIMATER, HEIGHT, LEN_NO, LEN_DESC, LEN_UNIT, LEN_MIN, LEN_MAX, TARG_DIMATER, 
TARG_HEIGHT, TARG_LEN_MIN, TARG_LEN_MAX, ACT_DIMATER, ACT_HEIGHT, ACT_LEN, 
ACT_LEN_MIN, ACT_LEN_MAX, ACT_COUNT, ACT_WEIGHT, ACT_THEORY_WEIGHT, 
MEASURE_FLAG, BELONG_CODE, BELONG_NAME, PACK_FLAG, PACK_TYPE_CODE, 
PACK_TYPE_NAME, PACK_NO, PACK_TIME, PACK_MAT_WT, MAT_GROSS_WT, MAT_GOWHERE_CODE, 
MAT_GOWHERE_NAME, COOL_HOT_FLAG, MAT_RETURN_FLAG, HEAT_TREAT_NO, POST_FLAG, 
LOCK_FLAG, MNG_LOCK_RSN_CODE, MNG_LOCK_TIME, MNG_LOCK_MAKER, MNG_LOCK_REMARK, 
LOCK_RSN_CODE, LOCK_TIME, LOCK_MAKER, LOCK_REMARK, UNLOCK_TIME, UNLOCK_MAKER, 
UNLOCK_REMARK, OLD_ORDER_NO, OLD_ORDER_SEQ, OLD_ORDER_SEQ_NO, OLD_MATERIAL_NO, 
OLD_MATERIAL_NAME, REMAIN_RSN_CODE, REMAIN_JUGDE_TIME, REMAIN_JUGDE_MAKER, 
REMAIN_JUGDE_CODE, REMAIN_REMARK, JUGDE_APPLY_FLAG, JUGDE_APPLY_CODE, 
JUGDE_APPLY_TIME, JUGDE_SCAN_TIME, FACE_RESULT_CODE, FACE_RESULT_TIME, 
FACE_MAKER, SPEC_RESULT_CODE, SPEC_RESULT_TIME, SPEC_MAKER, CHEM_RESULT_CODE, 
CHEM_RESULT_TIME, CHEM_MAKER, PHY_RESULT_CODE, PHY_RESULT_TIME, PHY_MAKER, 
DETECT_REPORT_NO, DETECT_RESULT_CODE, WPRESSURE_REPORT_NO, 
WPRESSURE_RESULT_CODE, JUDGE_RESULT_CODE, JUDGE_RESULT, JUDGE_RESULT_TIME, 
JUDGE_MAKER, BUG_NO, BUG_DEAL, REPAIR_FLAG, REPAIR_REMARK, SAMPLING_FLAG, 
SAMPLING_TYPE, SAMPLING_NO, CHECKOUT_NO, CHEM_STCHECK_NO, CHEM_PROCHECK_NO, 
SH_CHECK_NO, COME_PROC_FLAG, CONFM_FLAG, INSTOCK_FLAG, INSTOCK_TIME, 
OUTSTOCK_TIME, PRO_BC, PRO_BZ, RPO_TIME, BAR_CODE, BEGINNING_FLAG, MEMO, 
CREATE_NAME, CREATE_TIME, UPDATE_NAME, UPDATE_TIME, REQ_BL_ID, IF_BATCHED_JG, 
COUPCUT_BATCH_ID, ORD_PK, ORD_LN_PK, ORD_LN_DLY_PK, OLD_ORD_PK, OLD_ORD_LN_PK, 
OLD_ORD_LN_DLY_PK, BAL_YEAR_MONTH, JUDGE_STD_NAME, JUDGE_STD_CODE, JUDGE_GRADE, 
PIPMEMO, TEST, SOURE_CODE, SOURE_NAME, PONDER_NO, PONDER_GROSS_WT, MEMO1, 
JUDGE_ID, MNG_LOCK_FLAG, LOCK_ID, PRO_NO, LOCK_LIKU, PLN_GRADECODE, 
PLN_GRADENAME, PLN_STEELCODE, PLN_STEELNAME, QCM_STAUS, OUTSTOCK_DOC, 
HEAT_PLAN_NO, ZG_STOVE_SQE, GX_PLAN_NO, ZG_MAT_NO, FINISHPRO_MOLD, IN_MOLD, IN_TYPE,
TARGET, PROCESS_STATUS, JUGDE_CONVICTED, GX_PLAN_NO1, FIXTYPE_CODE, 
QUALITY_GROUP_ZG, FLAG_STOVE_NO_ZG, ZG_PHY_RESULT_PATH, ZG_FACE_RESULT_PATH, 
ZG_SPEC_RESULT_PATH, VRP_HEAT_PLAN_NO, VRP_LOT_NO, VRP_SAMPLE_FLAG, 
VRP_PRO_ORDER_NO, VRP_PRO_ORDER_NO1, VRP_PRO_ORDER_ID, VRP_PRO_ORDER_ID1, 
VRP_ACT_DIMATER, VRP_ACT_HEIGHT, VRP_JUGDE_APPLY_FLAG, VRP_JUGDE_APPLY_CODE, 
VRP_JUGDE_APPLY_TIME, VRP_FACE_RESULT_CODE, VRP_FACE_RESULT_TIME, 
VRP_FACE_MAKER, VRP_FACE_RESULT_PATH, VRP_SPEC_RESULT_CODE, 
VRP_SPEC_RESULT_TIME, VRP_SPEC_MAKER, VRP_SPEC_RESULT_PATH, VRP_PHY_RESULT_CODE, 
VRP_PHY_RESULT_TIME, VRP_PHY_MAKER, VRP_PHY_RESULT_PATH, VRP_JUDGE_RESULT_CODE, 
VRP_JUDGE_RESULT_TIME, VRP_JUDGE_MAKER, VRP_GX_PLAN_NO, VRP_GX_PLAN_NO1, 
VPR_JUGDE_CONVICTED, VPR_QUALITY_GROUP_ZG, VPR_FLAG_STOVE_NO_ZG, 
HTT_HEAT_PLAN_NO, HTT_LOT_NO, HTT_SAMPLE_FLAG, HTT_PRO_ORDER_NO, 
HTT_PRO_ORDER_NO1, HTT_PRO_ORDER_ID, HTT_PRO_ORDER_ID1, HTT_GX_PLAN_NO, 
HTT_GX_PLAN_NO1, HTT_JUGDE_APPLY_FLAG, HTT_JUGDE_APPLY_CODE, 
HTT_JUGDE_APPLY_TIME, HTT_FACE_RESULT_CODE, HTT_FACE_RESULT_TIME, 
HTT_FACE_MAKER, HTT_FACE_RESULT_PATH, HTT_SPEC_RESULT_CODE, 
HTT_SPEC_RESULT_TIME, HTT_SPEC_MAKER, HTT_SPEC_RESULT_PATH, HTT_PHY_RESULT_CODE, 
HTT_PHY_RESULT_TIME, HTT_PHY_MAKER, HTT_PHY_RESULT_PATH, HTT_JUDGE_RESULT_CODE, 
HTT_JUDGE_RESULT_TIME, HTT_JUDGE_MAKER, HTT_JUGDE_CONVICTED, 
HTT_QUALITY_GROUP_ZG, HTT_FLAG_STOVE_NO_ZG, PRC_LOT_NO, PRC_SAMPLE_FLAG, 
PRC_PRO_ORDER_NO, PRC_PRO_ORDER_NO1, PRC_PRO_ORDER_ID, PRC_PRO_ORDER_ID1, 
PRC_GX_PLAN_NO, PRC_GX_PLAN_NO1, PRC_JUGDE_APPLY_FLAG, PRC_JUGDE_APPLY_CODE, 
PRC_JUGDE_APPLY_TIME, PRC_FACE_RESULT_CODE, PRC_FACE_RESULT_TIME, 
PRC_FACE_MAKER, PRC_FACE_RESULT_PATH, PRC_SPEC_RESULT_CODE, 
PRC_SPEC_RESULT_TIME, PRC_SPEC_MAKER, PRC_SPEC_RESULT_PATH, PRC_PHY_RESULT_CODE, 
PRC_PHY_RESULT_TIME, PRC_PHY_MAKER, PRC_PHY_RESULT_PATH, PRC_JUDGE_RESULT_CODE, 
PRC_JUDGE_RESULT_TIME, PRC_JUDGE_MAKER, PRC_JUGDE_CONVICTED, 
PRC_QUALITY_GROUP_ZG, PRC_FLAG_STOVE_NO_ZG, PRC_HEAT_PLAN_NO, 
VRP_JUDGE_STD_NAME, VRP_JUDGE_STD_CODE, HTT_JUDGE_STD_NAME, HTT_JUDGE_STD_CODE, 
PRC_JUDGE_STD_NAME, PRC_JUDGE_STD_CODE, VRP_CRAF_NO, HTT_CRAF_NO, PRC_CRAF_NO, 
VRP_CHEM_RESULT_CODE, VRP_CHEM_RESULT_TIME, VRP_CHEM_MAKER, 
HTT_CHEM_RESULT_CODE, HTT_CHEM_RESULT_TIME, HTT_CHEM_MAKER, 
PRC_CHEM_RESULT_CODE, PRC_CHEM_RESULT_TIME, PRC_CHEM_MAKER, DETECT_REPORT_NO1, 
DETECT_RESULT_CODE1, TESTING_GRADE, TESTING_TYPE, TESTING_GRADE1, TESTING_TYPE1, 
ZG_PLINE_CODE, ZG_PLINE_NAME, VRP_PLINE_CODE, VRP_PLINE_NAME, HTT_PLINE_CODE, 
HTT_PLINE_NAME, PRC_PLINE_CODE, PRC_PLINE_NAME,VRP_QCM_STAUS,HTT_QCM_STAUS,PRC_QCM_STAUS,ZG_MEMO,ZBS_FLAG,ZBS_ID,JG_ZBS_ID,MEASURING_SEQ,
SUPPLY_UNIT_CODE,SUPPLY_UNIT,IS_DEALER)

SELECT MAT_NO, PRODUCT_FLAG, 
'80150303', LOT_NO, STOVE_NO, JUDGE_STOVE_NO, BATCH_NO, BATCH_GROUD_NO, 
MAT_SQE_NO, SAMPLE_FLAG, CUTTING_FLAG, ORIGIN_MAT_NO, MATERIAL_NO, 
MATERIAL_NAME, INPUT_MATERIAL_NAME, INPUT_MATERIAL_NO, INPUT_ORIGIN_CODE, 
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, PRO_ORDER_NO1, PRO_ORDER_ID, PRO_ORDER_ID1, 
ORDER_NO, ORDER_SEQ, ORDER_SEQ_NO, CRAF_NO, PROCESS_CDOE, PROCESS_DESC, 
NEXT_PROCESS_CDOE, NEXT_PROCESS_DESC, PLINE_CODE, PLINE_NAME, MAT_ORIGIN_CODE, 
MAT_ORIGIN_NAME, DIMATER, HEIGHT, LEN_NO, LEN_DESC, LEN_UNIT, LEN_MIN, LEN_MAX, 
TARG_DIMATER, TARG_HEIGHT, TARG_LEN_MIN, TARG_LEN_MAX, ACT_DIMATER, ACT_HEIGHT, 
ACT_LEN, ACT_LEN_MIN, ACT_LEN_MAX, ACT_COUNT, ACT_WEIGHT, ACT_THEORY_WEIGHT, 
MEASURE_FLAG, BELONG_CODE, BELONG_NAME, PACK_FLAG, PACK_TYPE_CODE, 
PACK_TYPE_NAME, PACK_NO, PACK_TIME, PACK_MAT_WT, MAT_GROSS_WT, MAT_GOWHERE_CODE, 
MAT_GOWHERE_NAME, COOL_HOT_FLAG, MAT_RETURN_FLAG, HEAT_TREAT_NO, POST_FLAG, 
LOCK_FLAG, MNG_LOCK_RSN_CODE, MNG_LOCK_TIME, MNG_LOCK_MAKER, MNG_LOCK_REMARK, 
LOCK_RSN_CODE, LOCK_TIME, LOCK_MAKER, LOCK_REMARK, UNLOCK_TIME, UNLOCK_MAKER, 
UNLOCK_REMARK, OLD_ORDER_NO, OLD_ORDER_SEQ, OLD_ORDER_SEQ_NO, OLD_MATERIAL_NO, 
OLD_MATERIAL_NAME, REMAIN_RSN_CODE, REMAIN_JUGDE_TIME, REMAIN_JUGDE_MAKER, 
REMAIN_JUGDE_CODE, REMAIN_REMARK, JUGDE_APPLY_FLAG, JUGDE_APPLY_CODE, 
JUGDE_APPLY_TIME, JUGDE_SCAN_TIME, FACE_RESULT_CODE, FACE_RESULT_TIME, 
FACE_MAKER, SPEC_RESULT_CODE, SPEC_RESULT_TIME, SPEC_MAKER, CHEM_RESULT_CODE, 
CHEM_RESULT_TIME, CHEM_MAKER, PHY_RESULT_CODE, PHY_RESULT_TIME, PHY_MAKER, 
DETECT_REPORT_NO, DETECT_RESULT_CODE, WPRESSURE_REPORT_NO, 
WPRESSURE_RESULT_CODE, JUDGE_RESULT_CODE, JUDGE_RESULT, JUDGE_RESULT_TIME, 
JUDGE_MAKER, BUG_NO, BUG_DEAL, REPAIR_FLAG, REPAIR_REMARK, SAMPLING_FLAG, 
SAMPLING_TYPE, SAMPLING_NO, CHECKOUT_NO, CHEM_STCHECK_NO, CHEM_PROCHECK_NO, 
SH_CHECK_NO, COME_PROC_FLAG, CONFM_FLAG, INSTOCK_FLAG, INSTOCK_TIME, 
OUTSTOCK_TIME, PRO_BC, PRO_BZ, RPO_TIME, BAR_CODE, BEGINNING_FLAG, MEMO, 
CREATE_NAME, CREATE_TIME, UPDATE_NAME, UPDATE_TIME, REQ_BL_ID, IF_BATCHED_JG, 
COUPCUT_BATCH_ID, ORD_PK, ORD_LN_PK, ORD_LN_DLY_PK, OLD_ORD_PK, OLD_ORD_LN_PK, 
OLD_ORD_LN_DLY_PK, BAL_YEAR_MONTH, JUDGE_STD_NAME, JUDGE_STD_CODE, JUDGE_GRADE, 
PIPMEMO, TEST, SOURE_CODE, SOURE_NAME, PONDER_NO, PONDER_GROSS_WT, MEMO1, JUDGE_ID, 
MNG_LOCK_FLAG, LOCK_ID, PRO_NO, LOCK_LIKU, PLN_GRADECODE, PLN_GRADENAME, 
PLN_STEELCODE, PLN_STEELNAME, QCM_STAUS, OUTSTOCK_DOC, HEAT_PLAN_NO, 
ZG_STOVE_SQE, GX_PLAN_NO, ZG_MAT_NO, FINISHPRO_MOLD, IN_MOLD, IN_TYPE,TARGET,
PROCESS_STATUS, JUGDE_CONVICTED, GX_PLAN_NO1, FIXTYPE_CODE, QUALITY_GROUP_ZG, 
FLAG_STOVE_NO_ZG, ZG_PHY_RESULT_PATH, ZG_FACE_RESULT_PATH, ZG_SPEC_RESULT_PATH, 
VRP_HEAT_PLAN_NO, VRP_LOT_NO, VRP_SAMPLE_FLAG, VRP_PRO_ORDER_NO, 
VRP_PRO_ORDER_NO1, VRP_PRO_ORDER_ID, VRP_PRO_ORDER_ID1, VRP_ACT_DIMATER, 
VRP_ACT_HEIGHT, VRP_JUGDE_APPLY_FLAG, VRP_JUGDE_APPLY_CODE, 
VRP_JUGDE_APPLY_TIME, VRP_FACE_RESULT_CODE, VRP_FACE_RESULT_TIME, 
VRP_FACE_MAKER, VRP_FACE_RESULT_PATH, VRP_SPEC_RESULT_CODE, 
VRP_SPEC_RESULT_TIME, VRP_SPEC_MAKER, VRP_SPEC_RESULT_PATH, VRP_PHY_RESULT_CODE, 
VRP_PHY_RESULT_TIME, VRP_PHY_MAKER, VRP_PHY_RESULT_PATH, VRP_JUDGE_RESULT_CODE, 
VRP_JUDGE_RESULT_TIME, VRP_JUDGE_MAKER, VRP_GX_PLAN_NO, VRP_GX_PLAN_NO1, 
VPR_JUGDE_CONVICTED, VPR_QUALITY_GROUP_ZG, VPR_FLAG_STOVE_NO_ZG, 
HTT_HEAT_PLAN_NO, HTT_LOT_NO, HTT_SAMPLE_FLAG, HTT_PRO_ORDER_NO, 
HTT_PRO_ORDER_NO1, HTT_PRO_ORDER_ID, HTT_PRO_ORDER_ID1, HTT_GX_PLAN_NO, 
HTT_GX_PLAN_NO1, HTT_JUGDE_APPLY_FLAG, HTT_JUGDE_APPLY_CODE, 
HTT_JUGDE_APPLY_TIME, HTT_FACE_RESULT_CODE, HTT_FACE_RESULT_TIME, 
HTT_FACE_MAKER, HTT_FACE_RESULT_PATH, HTT_SPEC_RESULT_CODE, 
HTT_SPEC_RESULT_TIME, HTT_SPEC_MAKER, HTT_SPEC_RESULT_PATH, HTT_PHY_RESULT_CODE, 
HTT_PHY_RESULT_TIME, HTT_PHY_MAKER, HTT_PHY_RESULT_PATH, HTT_JUDGE_RESULT_CODE, 
HTT_JUDGE_RESULT_TIME, HTT_JUDGE_MAKER, HTT_JUGDE_CONVICTED, 
HTT_QUALITY_GROUP_ZG, HTT_FLAG_STOVE_NO_ZG, PRC_LOT_NO, PRC_SAMPLE_FLAG, 
PRC_PRO_ORDER_NO, PRC_PRO_ORDER_NO1, PRC_PRO_ORDER_ID, PRC_PRO_ORDER_ID1, 
PRC_GX_PLAN_NO, PRC_GX_PLAN_NO1, PRC_JUGDE_APPLY_FLAG, PRC_JUGDE_APPLY_CODE, 
PRC_JUGDE_APPLY_TIME, PRC_FACE_RESULT_CODE, PRC_FACE_RESULT_TIME, 
PRC_FACE_MAKER, PRC_FACE_RESULT_PATH, PRC_SPEC_RESULT_CODE, 
PRC_SPEC_RESULT_TIME, PRC_SPEC_MAKER, PRC_SPEC_RESULT_PATH, PRC_PHY_RESULT_CODE, 
PRC_PHY_RESULT_TIME, PRC_PHY_MAKER, PRC_PHY_RESULT_PATH, PRC_JUDGE_RESULT_CODE, 
PRC_JUDGE_RESULT_TIME, PRC_JUDGE_MAKER, PRC_JUGDE_CONVICTED, 
PRC_QUALITY_GROUP_ZG, PRC_FLAG_STOVE_NO_ZG, PRC_HEAT_PLAN_NO, 
VRP_JUDGE_STD_NAME, VRP_JUDGE_STD_CODE, HTT_JUDGE_STD_NAME, HTT_JUDGE_STD_CODE, 
PRC_JUDGE_STD_NAME, PRC_JUDGE_STD_CODE, VRP_CRAF_NO, HTT_CRAF_NO, PRC_CRAF_NO, 
VRP_CHEM_RESULT_CODE, VRP_CHEM_RESULT_TIME, VRP_CHEM_MAKER, 
HTT_CHEM_RESULT_CODE, HTT_CHEM_RESULT_TIME, HTT_CHEM_MAKER, 
PRC_CHEM_RESULT_CODE, PRC_CHEM_RESULT_TIME, PRC_CHEM_MAKER, DETECT_REPORT_NO1, 
DETECT_RESULT_CODE1, TESTING_GRADE, TESTING_TYPE, TESTING_GRADE1, TESTING_TYPE1, 
ZG_PLINE_CODE, ZG_PLINE_NAME, VRP_PLINE_CODE, VRP_PLINE_NAME, HTT_PLINE_CODE, 
HTT_PLINE_NAME, PRC_PLINE_CODE, PRC_PLINE_NAME,VRP_QCM_STAUS,HTT_QCM_STAUS,PRC_QCM_STAUS,ZG_MEMO,ZBS_FLAG,ZBS_ID,JG_ZBS_ID,MEASURING_SEQ,
DECODE(SUPPLY_UNIT_CODE,NULL,'120501',SUPPLY_UNIT_CODE),DECODE(SUPPLY_UNIT,NULL,'天津钢管制造有限公司',SUPPLY_UNIT),IS_DEALER
 FROM MAT_ZC_M WHERE MAT_NO  IN (SELECT L.MAT_NO
                      FROM YDM_ZC_OUTLIST L
                     WHERE L.M_BILL_NO = ?
                       AND L.JUDGE_STOVE_NO = ?
                       AND L.BATCH_NO = ?
                       AND L.BATCH_GROUD_NO = ?
                       AND NVL(L.ORD_LN_DLY_PK,'/')=NVL(?,'/')
                       AND L.MAT_NO = MAT_NO
                       AND L.OUTSTOCK_TYPE_CODE = '800806');
DELETE YDM_ZC_BUTTRESS WHERE MAT_NO IN (SELECT L.MAT_NO
                      FROM YDM_ZC_OUTLIST L
                     WHERE L.M_BILL_NO = ?
                       AND L.JUDGE_STOVE_NO = ?
                       AND L.BATCH_NO = ?
                       AND L.BATCH_GROUD_NO = ?
                       AND NVL(L.ORD_LN_DLY_PK,'/')=NVL(?,'/')
                       AND L.MAT_NO = MAT_NO
                       AND L.OUTSTOCK_TYPE_CODE = '800806');
DELETE MAT_ZC_M WHERE MAT_NO IN (SELECT L.MAT_NO
                      FROM YDM_ZC_OUTLIST L
                     WHERE L.M_BILL_NO = ?
                       AND L.JUDGE_STOVE_NO = ?
                       AND L.BATCH_NO = ?
                       AND L.BATCH_GROUD_NO = ?
                       AND NVL(L.ORD_LN_DLY_PK,'/')=NVL(?,'/')
                       AND L.MAT_NO = MAT_NO
                       AND L.OUTSTOCK_TYPE_CODE = '800806');
DELETE MAT_ZC_M_XS WHERE MAT_NO IN (SELECT L.MAT_NO
                      FROM YDM_ZC_OUTLIST_XS L
                     WHERE L.M_BILL_NO = ?
                       AND L.JUDGE_STOVE_NO = ?
                       AND L.BATCH_NO = ?
                       AND L.BATCH_GROUD_NO = ?
                       AND NVL(L.ORD_LN_DLY_PK,'/')=NVL(?,'/')
                       AND L.MAT_NO = MAT_NO
                       AND L.OUTSTOCK_TYPE_CODE = '800806');
                       
 END;
 ]]>
 </query>
 	<query id="FrmReturnDashed.queryLoadReturn1" desc="查询要退货的装车材料记录">
	<![CDATA[
  SELECT T1.LOADVEHICLE_SQE,T1.LOADVEHICLE_NO,
       T1.BILL_NO,
       T1.TALLYSHEET_NO,
       T1.VEHICLE_NO,
       T1.ORDER_NO,
       T1.ORDER_SEQ,
       T1.ORDER_SEQ_NO,
       T1.PRO_ORDER_NO,
       T1.MAT_NO,
       T1.LOT_NO,
       T1.JUDGE_STOVE_NO,
       T1.BATCH_NO,
       T1.GROUP_NO,
       T1.STOVE_NO,
       T1.MATERIAL_NO,
       T1.MATERIAL_NAME,
       T1.PRODUCCODE,
       T1.PRODUCNAME,
       T1.STD_CODE,
       T1.STD_NAME,
       T1.GRADECODE,
       T1.GRADENAME,
       T1.STEELCODE,
       T1.STEELNAME,
       T1.STD_STYLE,
       T1.STD_STYLE_DESC,
       T1.SPEC_CODE,
       T1.SPEC_NAME,
       T1.MODEL_CODE,
       T1.MODEL_DESC,
       T1.PROCESS_CDOE,
       T1.PROCESS_DESC,
       T1.PLINE_CODE,
       T1.PLINE_NAME,
       T1.ACT_DIMATER,
       T1.ACT_HEIGHT,
       NVL(T1.ACT_LEN, 0) ACT_LEN,
        T1.ACT_LEN_MIN,
       T1.ACT_LEN_MAX,
       NVL(T1.ACT_COUNT, 0) ACT_COUNT,
       NVL(T1.ACT_WEIGHT, 0) ACT_WEIGHT,
       NVL(T1.ACT_THEORY_WEIGHT, 0) ACT_THEORY_WEIGHT,
       NVL(T1.SEND_NUM,0) AS SEND_NUM,
       T1.JUDGE_RESULT_CODE,
       T1.PRO_BC,
       T1.PRO_BZ,
       T1.RPO_TIME,      
       T1.SALE_ORG,
       T1.SALE_ORG_DESC,
       T1.SALE_AREA,
       T1.STORAGE_TYPE_NO,
       T1.STORAGE_TYPE_NAME,
       T1.MANAGEMENT_NO,
       T1.MANAGEMENT_NAME,
       T1.UPLOAD_WEB_FLAG,
       T1.STORAGE_NO,
       T1.LOCATION_NO,
       T1.LARY_NO,
       T1.LOC_NO,
       T1.TRANS_TPE,
       T1.RECEIV_NO,
       T1.RECEIV_NM,
       T1.STATION_NO,
       T1.STATION_NM,
       T1.SPCL_LN_NO,
       T1.SPCL_LN_NM,
       T1.PORT_NO,
       T1.PLANT,
       T1.PLANT_DESC,
       T1.VSTEL,
       T1.VSTEL_DESC,
       T1.CARRY_COMPANY_CODE,
       T1.CARRY_COMPANY_NAME,
       T1.OUT_STOCK_CODE,
       T1.DELIVY_PLACE_CODE,
       T1.DELIVY_PLACE_NAME,
       T1.STLMT_UNIT_NO,
       T1.STLMT_UNIT_NM,
       T1.DELIVY_TIME,
       T1.VALIDFLAG,
       T1.ORD_PK,
       T1.ORD_LN_PK,
       T1.ORD_LN_DLY_PK,
       T1.DEPARTMENT_CODE,
       T1.DEPARTMENT_DESC,
       T1.PONDER_NO,
       NVL(T1.PONDER_GROSS_WT, 0) PONDER_GROSS_WT,
       T1.JUDGE_STD_NAME,
       T1.JUDGE_STD_CODE,
       T1.FINISHPRO_MOLD,
       T1.IN_MOLD,
       T1.MEASURING_SEQ
  FROM YDM_ZC_LOADVEHICLE_MAT T1
  WHERE T1.BILL_NO = ?
       AND T1.MAT_NO = ?
		]]>
	</query>
</queryMap>