<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc = "提交/审批改判">
<query id = "FrmExamineJudge.getGpData" desc = "查询改判实绩">
<![CDATA[
	SELECT 
       JUDGE_ID,
       JUDGE_STOVE_NO_OLD,
       BATCH_NO_OLD,
       BATCH_GROUD_NO_OLD,
       ACT_COUNT,
       ACT_WEIGHT,
       JUDGE_STOVE_NO,
       BATCH_NO,
       BATCH_GROUD_NO,
       MATERIAL_NO_OLD,
       MATERIAL_NAME_OLD,
       PRODUCCODE_OLD,
       PRODUCNAME_OLD,
       STEELCODE_OLD,
       STEELNAME_OLD,
       SPEC_CODE_OLD,
       SPEC_NAME_OLD,
       MODEL_CODE_OLD,
       MODEL_DESC_OLD,
       STD_STYLE_OLD,
       STD_STYLE_DESC_OLD,
       MATERIAL_NO,
       MATERIAL_NAME,
       PRODUCCODE,
       PRODUCNAME,
       STEELCODE,
       STEELNAME,
       SPEC_CODE,
       SPEC_NAME,
       MODEL_CODE,
       MODEL_DESC,
       STD_STYLE,
       STD_STYLE_DESC,
       CREATE_NAME,
       TO_CHAR(CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       SUBMIT_NAME,
       TO_CHAR(SUBMIT_TIME, 'YYYY-MM-DD HH24:MI:SS') SUBMIT_TIME,
       AGREE_NAME,
       TO_CHAR(AGREE_TIME, 'YYYY-MM-DD HH24:MI:SS') AGREE_TIME,
       DECODE(AGREE_FLAG,'0','未提交审批','1','提交审批','2','审批通过','3','审批不通过')AGREE_FLAG,
       CREATE_MEMO,
       SUBMIT_MEMO,
       AGREE_MEMO,
       DECODE(VALID_FLAG,'0','无效','1','有效')VALID_FLAG,
       DELETE_NAME,
       TO_CHAR(DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       BELONG_CODE,
       BELONG_NAME,
       SUPPLY_UNIT_CODE,
       SUPPLY_UNIT
 FROM QCM_ZG_JUDGE_CHANGE
 WHERE VALID_FLAG = '1'
 ]]>
</query>
<query id = "FrmExamineJudge.submitGpData" desc = "提交改判">
UPDATE QCM_ZG_JUDGE_CHANGE T
   SET T.SUBMIT_MEMO = ?, T.SUBMIT_NAME = ?, T.SUBMIT_TIME = SYSDATE,T.AGREE_FLAG = '1'
 WHERE T.JUDGE_ID = ?
</query>
<query id = "noExamineData.updateArgeeFlag" desc = "审批不通过">
UPDATE QCM_ZG_JUDGE_CHANGE T
   SET T.AGREE_MEMO = ?, T.AGREE_NAME = ?, T.AGREE_TIME = SYSDATE,T.AGREE_FLAG = '3'
 WHERE T.JUDGE_ID = ?
</query>
<query id = "noExamineData.updateLockFlag" desc = "审批不通过释放物料">
UPDATE MAT_ZC_M T SET T.LOCK_FLAG = '0' WHERE T.JUDGE_ID = ?
</query>
<query id = "examineData.updateArgeeFlag" desc = "审批通过">
UPDATE QCM_ZG_JUDGE_CHANGE T
   SET T.AGREE_MEMO = ?, T.AGREE_NAME = ?, T.AGREE_TIME = SYSDATE,T.AGREE_FLAG = '2'
 WHERE T.JUDGE_ID = ?
</query>
<query id = "examineData.insertOutList" desc = "写出库表">
 INSERT INTO YDM_ZC_OUTLIST(
        DEPARTMENT_CODE,
        DEPARTMENT_DESC,
        PRODUCT_FLAG,
        MAT_STATUS,
        JUDGE_STD_NAME,
        JUDGE_STD_CODE,
        BAL_YEAR_MONTH,
        OUTSTOCK_SQE,
        OUTSTOCK_DOC,
        OUTSTOCK_TYPE_CODE,
        OUTSTOCK_TYPE_NAME,
        MAT_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,
        BELONG_CODE,
        BELONG_NAME,
        STORAGE_NO,
        LOCATION_NO,
        MANAGEMENT_NO,
        MANAGEMENT_NAME,
        OUTSTOCK_TIME,
        OUT_BC,
        OUT_BZ,
        MEMO,
        VALIDFLAG,
        CREATE_NAME,
        CREATE_TIME,
    SUPPLY_UNIT_CODE,
    SUPPLY_UNIT)
 VALUES( 
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        SYSDATE,
        ?,
        ?,
        ?,
        ?,
        ?,
        SYSDATE,?,?)
</query>
<query id = "examineData.deleteButess" desc = "删除位置表">
DELETE YDM_ZC_BUTTRESS T WHERE T.MAT_NO = ?
</query>
<query id = "examineData.insertMat" desc = "插入材料表">
<![CDATA[
	   INSERT INTO MAT_ZC_M
     (
     JUDGE_STOVE_NO,
     BATCH_NO,
     BATCH_GROUD_NO,
     PRODUCCODE,
     PRODUCNAME,
     STEELCODE,
     STEELNAME,
     SPEC_CODE,
     SPEC_NAME,
     MODEL_CODE,
     MODEL_DESC,
     STD_CODE,
     STD_NAME,
     BELONG_CODE,
     BELONG_NAME,
     STD_STYLE,
     STD_STYLE_DESC,
     
     ACT_DIMATER,
     ACT_HEIGHT,
     LEN_NO,
     LEN_DESC,
     LEN_UNIT,
     ACT_LEN_MIN,
     ACT_LEN_MAX,
     CREATE_NAME,
 	 
     ACT_COUNT,		 
     ACT_WEIGHT,
     CREATE_TIME, 
     INSTOCK_TIME,  
     MAT_NO,
     MEMO,
     JUGDE_APPLY_FLAG,
     INSTOCK_FLAG,
     PRODUCT_FLAG,
     MAT_STATUS,
     ACT_LEN,
     JUDGE_STD_NAME,
     BAL_YEAR_MONTH,
     PLINE_CODE,
     PLINE_NAME,
     GRADECODE,
     GRADENAME,
     PIPMEMO,
     OLD_ORDER_NO,
     JUDGE_RESULT_TIME,
     MAT_ORIGIN_CODE,
     MAT_ORIGIN_NAME,
     SOURE_CODE,
     SOURE_NAME,
     MATERIAL_NO,
     MATERIAL_NAME,
     LOT_NO,
     STOVE_NO,
     ZBS_FLAG,
     ZBS_ID,
     SUPPLY_UNIT_CODE,
     SUPPLY_UNIT
     ) VALUES  (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,
             ?,?,?,?,?,?,
             TO_NUMBER(?),ROUND(TO_NUMBER(?),4),TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'),TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'),
             ?,?,'1','1','801402','80150202',TO_NUMBER(?),?,?,?,?,?,?,?,?,TO_DATE(?,'YYYY-MM-DD'),?,?,?,?,?,?,?,?,?,?,?,?)
		]]>
</query>
<query id = "examineData.insertButess" desc = "写位置表">
<![CDATA[
       INSERT INTO YDM_ZC_BUTTRESS
    (
     JUDGE_STOVE_NO,
     BATCH_NO,
     BATCH_GROUD_NO,
     STORAGE_NO,
     LOCATION_NO,
     STORAGE_TYPE_NO,
     STORAGE_TYPE_NAME,
     
     CREATE_NAME,
     MAT_NO,
     CREATE_TIME,
     MANAGEMENT_NO,
     MANAGEMENT_NAME,
     DEPARTMENT_CODE,
     DEPARTMENT_DESC
     )
    VALUES ( ?,?,?,?,?,?,?,?,?,to_date(?,'YYYY-MM-DD HH24:MI:SS'),?,?,?,?)
		]]>

</query>
<query id = "examineData.insertInList" desc = "写入库表">
INSERT INTO YDM_ZC_INLIST
  (MANAGEMENT_NO,
   MANAGEMENT_NAME,
   INSTOCK_SQE,
   INSTOCK_DOC,
   INSTOCK_TYPE_CODE,
   INSTOCK_TYPE_NAME,
   MAT_NO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   BATCH_GROUD_NO,
   PRODUCCODE,
   PRODUCNAME,
   STD_CODE,
   STD_NAME,
   
   STEELCODE,
   STEELNAME,
   STD_STYLE,
   STD_STYLE_DESC,
   SPEC_CODE,
   SPEC_NAME,
   MODEL_CODE,
   MODEL_DESC,
   ACT_DIMATER,
   ACT_HEIGHT,
   ACT_LEN_MIN,
   ACT_LEN_MAX,
   ACT_COUNT,
   ACT_WEIGHT,
   ACT_THEORY_WEIGHT,
   BELONG_CODE,
   BELONG_NAME,
   STORAGE_NO,
   
   MEMO,
   VALIDFLAG,
   CREATE_NAME,
   CREATE_TIME,
   PRODUCT_FLAG,
   MAT_STATUS,
   INSTOCK_TIME,
   ACT_LEN,
   DEPARTMENT_CODE,
   DEPARTMENT_DESC,
   JUDGE_STD_NAME,
   PLINE_CODE,
   PLINE_NAME,
   GRADECODE,
   GRADENAME,
   BAL_YEAR_MONTH,
   IN_TIME_F,
   PIPMEMO,
   MAT_ORIGIN_CODE,
   MAT_ORIGIN_NAME,
   SOURE_CODE,
   SOURE_NAME,
   MATERIAL_NO,
   MATERIAL_NAME,
    SUPPLY_UNIT_CODE,
    SUPPLY_UNIT)
VALUES
  (?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   to_date(?, 'YYYY-MM-DD HH24:MI:SS'),
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   '801402',
   '80150202',
   to_date(?, 'YYYY-MM-DD HH24:MI:SS'),
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   to_date(?, 'YYYY-MM-DD HH24:MI:SS'),
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,?,?)
</query>
<query id = "examineData.selectMatNo" desc = "查询被锁定材料号">
 SELECT 
       T.JUDGE_STD_NAME,
       T.JUDGE_STD_CODE,
       T.JUDGE_GRADE,
       T.PIPMEMO,
       T.SOURE_CODE,
       T.SOURE_NAME,
       T.MEMO,
       T.JUDGE_ID,
       T.MAT_NO,
       T.PRODUCT_FLAG,
       T.MAT_STATUS,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       T.MATERIAL_NO,
       T.MATERIAL_NAME,
       T.PRODUCCODE,
       T.PRODUCNAME,
       T.STEELCODE,
       T.STEELNAME,
       T.GRADECODE,
       T.GRADENAME,
       T.SPEC_CODE,
       T.SPEC_NAME,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.STD_CODE,
       T.STD_NAME,
       T.STD_STYLE,
       T.STD_STYLE_DESC,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.MAT_ORIGIN_CODE,
       T.MAT_ORIGIN_NAME,
       T.ACT_DIMATER,
       T.ACT_HEIGHT,
       T.ACT_LEN,
       T.ACT_LEN_MIN,
       T.ACT_LEN_MAX,
       T.ACT_COUNT,
       T.ACT_WEIGHT,
       T.ACT_THEORY_WEIGHT,
       T.BELONG_CODE,
       T.BELONG_NAME,
       T.LEN_NO,
       T.LEN_DESC,
       T.LEN_UNIT,
       T.Old_Order_No,
       S.STORAGE_NO,
       S.LOCATION_NO,
       S.STORAGE_ATTR,
       S.Storage_Attr_Name,
       S.Storage_Type_No,
       S.Storage_Type_Name
 FROM MAT_ZC_M T,YDM_ZC_BUTTRESS S
 WHERE T.MAT_NO = S.MAT_NO
 AND T.JUDGE_ID = ?
</query>
<query id = "FrmExamineJudge.getOutDoc" desc= "获取出库单号">
SELECT T.OUTSTOCK_SQE,T.OUTSTOCK_DOC FROM YDM_ZC_OUTLIST T
    WHERE 
    T.CREATE_TIME LIKE '%'|| TO_DATE(?,'YYYY/MM/DD')||'%' 
    AND T.OUTSTOCK_TYPE_CODE LIKE '%'|| ? ||'%'
    ORDER BY T.OUTSTOCK_SQE DESC
</query>
<query id = "FrmExamineJudge.getOutDoc1" desc = "获取出库流水">
SELECT T.OUTSTOCK_SQE,T.OUTSTOCK_DOC FROM YDM_ZC_OUTLIST T 
    WHERE 
    T.CREATE_TIME LIKE '%'|| TO_DATE(?,'YYYY/MM/DD')||'%' 
    AND T.OUTSTOCK_DOC LIKE '%'|| ? ||'%'
    ORDER BY T.OUTSTOCK_SQE DESC
</query>
  <query id = "FrmExamineJudge.queryGroupNo" desc = "查询同炉同批组号">
       SELECT T.BATCH_GROUD_NO FROM MAT_ZC_M T WHERE T.JUDGE_STOVE_NO = ? AND T.BATCH_NO = ? ORDER BY T.BATCH_GROUD_NO DESC
       </query>
       <query id="FrmExamineJudge.QueryMatNoM" desc="自动生存材料号">
		<![CDATA[
	 SELECT T.MAT_NO FROM MAT_ZC_M T WHERE T.JUDGE_STOVE_NO=? AND T.BATCH_NO=? ORDER BY T.MAT_NO DESC
		]]>
	</query>	
	
	<query id = "FrmExamineJudge.examineData1" desc= "执行大SQL">
	<![CDATA[
	declare
  v_Outstock_doc ydm_zc_outlist.outstock_doc%type := null; --出库单号
  v_outstock_sqe ydm_zc_outlist.outstock_sqe%type := null; --出库流水
  v_Instock_doc  ydm_zc_inlist.instock_doc%type := null; --入库单号
  v_instock_sqe  ydm_zc_inlist.instock_sqe%type := null; --入库流水
  v_Memo         com_base_info.memo%type := null;
  v_Imemo        com_base_info.memo%type := null;
  v_Ocount       NUMBER := 1;
  v_Icount       NUMBER := 1;
  v_time         ydm_zc_outlist.create_time%type := sysdate;
  v_bathYear     mat_zc_m.bal_year_month%type := to_char(sysdate, 'yyyyMM');
  v_matNo        mat_zc_m.mat_no%type := null; --材料号
  v_matCount     Number := 1;
  v_groupNo      mat_zc_m.batch_groud_no%type := null; --组号
begin
  begin
    --生成出库单号
    select memo into v_Memo from com_base_info where basecode = ?;
    select v_Memo || to_char(sysdate, 'yymmdd') ||
           Lpad(NVL(MAX(substr(outstock_doc, 9)), 0) + 1, 5, 0) outstock_doc
      into v_Outstock_doc
      from ydm_zc_outlist t
     where t.outstock_type_code = ?
       AND trunc(t.CREATE_TIME) =
           trunc(sysdate);
    --生成入库单号
    select memo into v_Imemo from com_base_info where basecode = ?;
    select v_Imemo || to_char(sysdate, 'yymmdd') ||
           Lpad(NVL(MAX(substr(t.instock_doc, 9)), 0) + 1, 5, 0) instock_doc
      into v_Instock_doc
      from ydm_zc_inlist t
     where t.instock_type_code = ?
       AND trunc(t.CREATE_TIME) =
           trunc(sysdate);
    --生成材料号
    SELECT Lpad(NVL(MAX(substr(t.mat_no, length(t.mat_no) - 3)), 0) + 1,
                4,
                0)
      into v_matCount
      FROM MAT_ZC_M T
     WHERE T.JUDGE_STOVE_NO = ?
       AND T.BATCH_NO = ?;
    --生成组号
    SELECT Lpad(NVL(MAX(t.batch_groud_no), 0) + 1, 3, 0)
      into v_groupNo
      FROM MAT_ZC_M T
     WHERE T.JUDGE_STOVE_NO = ?
       AND T.BATCH_NO = ?;
    for myrow in (SELECT T.*,
                         S.STORAGE_NO,
                         S.LOCATION_NO,
                         S.STORAGE_ATTR,
                         S.Storage_Attr_Name,
                         S.Storage_Type_No,
                         S.Storage_Type_Name
                    FROM MAT_ZC_M T, YDM_ZC_BUTTRESS S
                   WHERE T.MAT_NO = S.MAT_NO
                     AND T.JUDGE_ID = ?) loop
      v_outstock_sqe := v_Outstock_doc || Lpad(v_Ocount, 4, 0);
      INSERT INTO YDM_ZC_OUTLIST
        (DEPARTMENT_CODE,
         DEPARTMENT_DESC,
         PRODUCT_FLAG,
         MAT_STATUS,
         JUDGE_STD_NAME,
         JUDGE_STD_CODE,
         BAL_YEAR_MONTH,
         OUTSTOCK_SQE,
         OUTSTOCK_DOC,
         OUTSTOCK_TYPE_CODE,
         OUTSTOCK_TYPE_NAME,
         MAT_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,
         BELONG_CODE,
         BELONG_NAME,
         STORAGE_NO,
         LOCATION_NO,
         MANAGEMENT_NO,
         MANAGEMENT_NAME,
         OUTSTOCK_TIME,
         OUT_BC,
         OUT_BZ,
         MEMO,
         VALIDFLAG,
         CREATE_NAME,
         CREATE_TIME)
      VALUES
        (?,
         ?,
         myrow.product_flag,
         myrow.mat_status,
         myrow.judge_std_name,
         myrow.judge_std_code,
         v_bathYear,
         v_outstock_sqe,
         v_Outstock_doc,
         ?,
         ?,
         myrow.mat_no,
         myrow.JUDGE_STOVE_NO,
         myrow.BATCH_NO,
         myrow.BATCH_GROUD_NO,
         myrow.MATERIAL_NO,
         myrow.MATERIAL_NAME,
         myrow.PRODUCCODE,
         myrow.PRODUCNAME,
         myrow.STD_CODE,
         myrow.STD_NAME,
         myrow.GRADECODE,
         myrow.GRADENAME,
         myrow.STEELCODE,
         myrow.STEELNAME,
         myrow.STD_STYLE,
         myrow.STD_STYLE_DESC,
         myrow.SPEC_CODE,
         myrow.SPEC_NAME,
         myrow.MODEL_CODE,
         myrow.MODEL_DESC,
         myrow.PLINE_CODE,
         myrow.PLINE_NAME,
         myrow.ACT_DIMATER,
         myrow.ACT_HEIGHT,
         myrow.ACT_LEN,
         myrow.ACT_LEN_MIN,
         myrow.ACT_LEN_MAX,
         myrow.ACT_COUNT,
         myrow.ACT_WEIGHT,
         myrow.ACT_THEORY_WEIGHT,
         myrow.BELONG_CODE,
         myrow.BELONG_NAME,
         myrow.STORAGE_NO,
         myrow.LOCATION_NO,
         ?,
         ?,
         v_time,
         '1',
         '1',
         myrow.pipmemo,
         '1',
         ?,
         v_time);
         
         INSERT INTO YDM_ZC_OUTLIST_XS
        (DEPARTMENT_CODE,
         DEPARTMENT_DESC,
         PRODUCT_FLAG,
         MAT_STATUS,
         JUDGE_STD_NAME,
         JUDGE_STD_CODE,
         BAL_YEAR_MONTH,
         OUTSTOCK_SQE,
         OUTSTOCK_DOC,
         OUTSTOCK_TYPE_CODE,
         OUTSTOCK_TYPE_NAME,
         MAT_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,
         BELONG_CODE,
         BELONG_NAME,
         STORAGE_NO,
         LOCATION_NO,
         MANAGEMENT_NO,
         MANAGEMENT_NAME,
         OUTSTOCK_TIME,
         OUT_BC,
         OUT_BZ,
         MEMO,
         VALIDFLAG,
         CREATE_NAME,
         CREATE_TIME)
      VALUES
        (?,
         ?,
         myrow.product_flag,
         myrow.mat_status,
         myrow.judge_std_name,
         myrow.judge_std_code,
         v_bathYear,
         v_outstock_sqe,
         v_Outstock_doc,
         ?,
         ?,
         myrow.mat_no,
         myrow.JUDGE_STOVE_NO,
         myrow.BATCH_NO,
         myrow.BATCH_GROUD_NO,
         myrow.MATERIAL_NO,
         myrow.MATERIAL_NAME,
         myrow.PRODUCCODE,
         myrow.PRODUCNAME,
         myrow.STD_CODE,
         myrow.STD_NAME,
         myrow.GRADECODE,
         myrow.GRADENAME,
         myrow.STEELCODE,
         myrow.STEELNAME,
         myrow.STD_STYLE,
         myrow.STD_STYLE_DESC,
         myrow.SPEC_CODE,
         myrow.SPEC_NAME,
         myrow.MODEL_CODE,
         myrow.MODEL_DESC,
         myrow.PLINE_CODE,
         myrow.PLINE_NAME,
         myrow.ACT_DIMATER,
         myrow.ACT_HEIGHT,
         myrow.ACT_LEN,
         myrow.ACT_LEN_MIN,
         myrow.ACT_LEN_MAX,
         myrow.ACT_COUNT,
         myrow.ACT_WEIGHT,
         myrow.ACT_THEORY_WEIGHT,
         myrow.BELONG_CODE,
         myrow.BELONG_NAME,
         myrow.STORAGE_NO,
         myrow.LOCATION_NO,
         ?,
         ?,
         v_time,
         '1',
         '1',
         myrow.pipmemo,
         '1',
         ?,
         v_time);
         
      DELETE YDM_ZC_BUTTRESS T WHERE T.MAT_NO = myrow.mat_no;
    
      v_matNo := myrow.judge_stove_no || myrow.batch_no ||
                 Lpad(v_matCount, 4, 0);
      INSERT INTO MAT_ZC_M
        (JUDGE_STOVE_NO,
         BATCH_NO,
         BATCH_GROUD_NO,
         PRODUCCODE,
         PRODUCNAME,
         STEELCODE,
         STEELNAME,
         SPEC_CODE,
         SPEC_NAME,
         MODEL_CODE,
         MODEL_DESC,
         STD_CODE,
         STD_NAME,
         BELONG_CODE,
         BELONG_NAME,
         STD_STYLE,
         STD_STYLE_DESC,
         
         ACT_DIMATER,
         ACT_HEIGHT,
         LEN_NO,
         LEN_DESC,
         LEN_UNIT,
         ACT_LEN_MIN,
         ACT_LEN_MAX,
         CREATE_NAME,
         
         ACT_COUNT,
         ACT_WEIGHT,
         CREATE_TIME,
         INSTOCK_TIME,
         MAT_NO,
         MEMO,
         JUGDE_APPLY_FLAG,
         INSTOCK_FLAG,
         PRODUCT_FLAG,
         MAT_STATUS,
         ACT_LEN,
         JUDGE_STD_NAME,
         BAL_YEAR_MONTH,
         PLINE_CODE,
         PLINE_NAME,
         GRADECODE,
         GRADENAME,
         PIPMEMO,
         OLD_ORDER_NO,
         JUDGE_RESULT_TIME,
         MAT_ORIGIN_CODE,
         MAT_ORIGIN_NAME,
         SOURE_CODE,
         SOURE_NAME,
         MATERIAL_NO,
         MATERIAL_NAME)
      VALUES
        (myrow.JUDGE_STOVE_NO,
         myrow.BATCH_NO,
         v_groupNo,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         myrow.std_code,
         myrow.STD_NAME,
         myrow.BELONG_CODE,
         myrow.BELONG_NAME,
         ?,
         ?,
         
         myrow.ACT_DIMATER,
         myrow.ACT_HEIGHT,
         myrow.LEN_NO,
         myrow.LEN_DESC,
         myrow.LEN_UNIT,
         myrow.ACT_LEN_MIN,
         myrow.ACT_LEN_MAX,
         ?,
         
         myrow.ACT_COUNT,
         myrow.ACT_WEIGHT,
         v_time,
         v_time,
         v_matNo,
         myrow.MEMO,
         myrow.JUGDE_APPLY_FLAG,
         myrow.INSTOCK_FLAG,
         myrow.PRODUCT_FLAG,
         myrow.MAT_STATUS,
         myrow.ACT_LEN,
         myrow.JUDGE_STD_NAME,
         v_bathYear,
         myrow.PLINE_CODE,
         myrow.PLINE_NAME,
         myrow.GRADECODE,
         myrow.GRADENAME,
         myrow.PIPMEMO,
         myrow.OLD_ORDER_NO,
         myrow.JUDGE_RESULT_TIME,
         myrow.MAT_ORIGIN_CODE,
         myrow.MAT_ORIGIN_NAME,
         myrow.SOURE_CODE,
         myrow.SOURE_NAME,
         ?,
         ?);
         
         INSERT INTO MAT_ZC_M_XS
        (JUDGE_STOVE_NO,
         BATCH_NO,
         BATCH_GROUD_NO,
         PRODUCCODE,
         PRODUCNAME,
         STEELCODE,
         STEELNAME,
         SPEC_CODE,
         SPEC_NAME,
         MODEL_CODE,
         MODEL_DESC,
         STD_CODE,
         STD_NAME,
         BELONG_CODE,
         BELONG_NAME,
         STD_STYLE,
         STD_STYLE_DESC,
         
         ACT_DIMATER,
         ACT_HEIGHT,
         LEN_NO,
         LEN_DESC,
         LEN_UNIT,
         ACT_LEN_MIN,
         ACT_LEN_MAX,
         CREATE_NAME,
         
         ACT_COUNT,
         ACT_WEIGHT,
         CREATE_TIME,
         INSTOCK_TIME,
         MAT_NO,
         MEMO,
         JUGDE_APPLY_FLAG,
         INSTOCK_FLAG,
         PRODUCT_FLAG,
         MAT_STATUS,
         ACT_LEN,
         JUDGE_STD_NAME,
         BAL_YEAR_MONTH,
         PLINE_CODE,
         PLINE_NAME,
         GRADECODE,
         GRADENAME,
         PIPMEMO,
         OLD_ORDER_NO,
         JUDGE_RESULT_TIME,
         MAT_ORIGIN_CODE,
         MAT_ORIGIN_NAME,
         SOURE_CODE,
         SOURE_NAME,
         MATERIAL_NO,
         MATERIAL_NAME)
      VALUES
        (myrow.JUDGE_STOVE_NO,
         myrow.BATCH_NO,
         v_groupNo,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         myrow.std_code,
         myrow.STD_NAME,
         myrow.BELONG_CODE,
         myrow.BELONG_NAME,
         ?,
         ?,
         
         myrow.ACT_DIMATER,
         myrow.ACT_HEIGHT,
         myrow.LEN_NO,
         myrow.LEN_DESC,
         myrow.LEN_UNIT,
         myrow.ACT_LEN_MIN,
         myrow.ACT_LEN_MAX,
         ?,
         
         myrow.ACT_COUNT,
         myrow.ACT_WEIGHT,
         v_time,
         v_time,
         v_matNo,
         myrow.MEMO,
         myrow.JUGDE_APPLY_FLAG,
         myrow.INSTOCK_FLAG,
         myrow.PRODUCT_FLAG,
         myrow.MAT_STATUS,
         myrow.ACT_LEN,
         myrow.JUDGE_STD_NAME,
         v_bathYear,
         myrow.PLINE_CODE,
         myrow.PLINE_NAME,
         myrow.GRADECODE,
         myrow.GRADENAME,
         myrow.PIPMEMO,
         myrow.OLD_ORDER_NO,
         myrow.JUDGE_RESULT_TIME,
         myrow.MAT_ORIGIN_CODE,
         myrow.MAT_ORIGIN_NAME,
         myrow.SOURE_CODE,
         myrow.SOURE_NAME,
         ?,
         ?);
         
         INSERT INTO CRM_MAT_ZC(
        MAT_NO,
        PRODUCT_FLAG,
        MAT_STATUS,
        LOT_NO,
        STOVE_NO,
        JUDGE_STOVE_NO,
        BATCH_NO,
        BATCH_GROUD_NO,
        MATERIAL_NO,
        MATERIAL_NAME,
        PRODUCCODE,
        PRODUCNAME,
        STEELCODE,
        STEELNAME,
        GRADECODE,
        GRADENAME,
        SPEC_CODE,
        SPEC_NAME,
        MODEL_CODE,
        MODEL_DESC,
        STD_CODE,
        STD_NAME,
        STD_STYLE,
        STD_STYLE_DESC,
        PRO_ORDER_NO,
        ORDER_NO,
        ORDER_SEQ,
        ORDER_SEQ_NO,
        ORD_PK,
        ORD_LN_PK,
        ORD_LN_DLY_PK,
        PLINE_CODE,
        PLINE_NAME,
        ACT_DIMATER,
        ACT_HEIGHT,
        ACT_LEN,
        ACT_LEN_MIN,
        ACT_LEN_MAX,
        ACT_COUNT,
        ACT_WEIGHT,
        BELONG_CODE,
        BELONG_NAME,
        IN_MOLD,
        INSTOCK_TIME,
        STORAGE_NO,
        LOCATION_NO,
        STORAGE_NAME,
        LOCATION_NAME,
        SUPPLY_UNIT_CODE,
        SUPPLY_UNIT,
        CREATE_TIME)
 VALUES(
        v_matNo,
        (SELECT F.BASENAME FROM COM_BASE_INFO F WHERE F.BASECODE = MYROW.PRODUCT_FLAG),
        (SELECT F.BASENAME FROM COM_BASE_INFO F WHERE F.BASECODE = MYROW.MAT_STATUS),
        MYROW.LOT_NO,
        MYROW.STOVE_NO,
        MYROW.JUDGE_STOVE_NO,
        MYROW.BATCH_NO,
        v_groupNo,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        MYROW.GRADECODE,
        MYROW.GRADENAME,
        ?,
        ?,
        ?,
        ?,
        MYROW.STD_CODE,
        MYROW.STD_NAME,
        ?,
        ?,
        MYROW.PRO_ORDER_NO,
        MYROW.ORDER_NO,
        MYROW.ORDER_SEQ,
        MYROW.DELIVERY_NO,
        MYROW.ORD_PK,
        MYROW.ORD_LN_PK,
        MYROW.ORD_LN_DLY_PK,
        MYROW.PLINE_CODE,
        MYROW.PLINE_NAME,
        MYROW.ACT_DIMATER,
        MYROW.ACT_HEIGHT,
        MYROW.ACT_LEN,
        MYROW.ACT_LEN_MIN,
        MYROW.ACT_LEN_MAX,
        MYROW.ACT_COUNT,
        MYROW.ACT_WEIGHT,
        MYROW.BELONG_CODE,
        MYROW.BELONG_NAME,
        (SELECT F.BASENAME FROM COM_BASE_INFO F WHERE F.BASECODE = MYROW.IN_MOLD),
        TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
        MYROW.STORAGE_NO,
        MYROW.LOCATION_NO,
        (SELECT S1.STORAGE_NAME FROM YDM_BS_STORAGE S1 WHERE S1.STORAGE_NO = MYROW.STORAGE_NO),
        (SELECT S2.LOCATION_NAME FROM YDM_BS_LOCATION S2 WHERE S2.LOCATION_NO = MYROW.LOCATION_NO),
        MYROW.SUPPLY_UNIT_CODE,
        MYROW.SUPPLY_UNIT,
        TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'));
      INSERT INTO YDM_ZC_BUTTRESS
        (JUDGE_STOVE_NO,
         BATCH_NO,
         BATCH_GROUD_NO,
         STORAGE_NO,
         LOCATION_NO,
         STORAGE_TYPE_NO,
         STORAGE_TYPE_NAME,
         
         CREATE_NAME,
         MAT_NO,
         CREATE_TIME,
         MANAGEMENT_NO,
         MANAGEMENT_NAME,
         DEPARTMENT_CODE,
         DEPARTMENT_DESC)
      VALUES
        (myrow.JUDGE_STOVE_NO,
         myrow.BATCH_NO,
         v_groupNo,
         myrow.STORAGE_NO,
         myrow.LOCATION_NO,
         myrow.STORAGE_TYPE_NO,
         myrow.STORAGE_TYPE_NAME,
         
         ?,
         v_matNo,
         v_time,
         ?,
         ?,
         ?,
         ?);
      v_instock_sqe := v_Instock_doc || Lpad(v_Icount, 4, 0);
      INSERT INTO YDM_ZC_INLIST
        (MANAGEMENT_NO,
         MANAGEMENT_NAME,
         INSTOCK_SQE,
         INSTOCK_DOC,
         INSTOCK_TYPE_CODE,
         INSTOCK_TYPE_NAME,
         MAT_NO,
         JUDGE_STOVE_NO,
         BATCH_NO,
         BATCH_GROUD_NO,
         PRODUCCODE,
         PRODUCNAME,
         STD_CODE,
         STD_NAME,
         
         STEELCODE,
         STEELNAME,
         STD_STYLE,
         STD_STYLE_DESC,
         SPEC_CODE,
         SPEC_NAME,
         MODEL_CODE,
         MODEL_DESC,
         ACT_DIMATER,
         ACT_HEIGHT,
         ACT_LEN_MIN,
         ACT_LEN_MAX,
         ACT_COUNT,
         ACT_WEIGHT,
         ACT_THEORY_WEIGHT,
         BELONG_CODE,
         BELONG_NAME,
         STORAGE_NO,
         
         MEMO,
         VALIDFLAG,
         CREATE_NAME,
         CREATE_TIME,
         PRODUCT_FLAG,
         MAT_STATUS,
         INSTOCK_TIME,
         ACT_LEN,
         DEPARTMENT_CODE,
         DEPARTMENT_DESC,
         JUDGE_STD_NAME,
         PLINE_CODE,
         PLINE_NAME,
         GRADECODE,
         GRADENAME,
         BAL_YEAR_MONTH,
         IN_TIME_F,
         PIPMEMO,
         MAT_ORIGIN_CODE,
         MAT_ORIGIN_NAME,
         SOURE_CODE,
         SOURE_NAME,
         MATERIAL_NO,
         MATERIAL_NAME)
      VALUES
        (?,
         ?,
         v_instock_sqe,
         v_Instock_doc,
         ?,
         ?,
         v_matNo,
         myrow.JUDGE_STOVE_NO,
         myrow.BATCH_NO,
         v_groupNo,
         ?,
         ?,
         myrow.STD_CODE,
         myrow.STD_NAME,
         
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         myrow.ACT_DIMATER,
         myrow.ACT_HEIGHT,
         myrow.ACT_LEN_MIN,
         myrow.ACT_LEN_MAX,
         myrow.ACT_COUNT,
         myrow.ACT_WEIGHT,
         myrow.ACT_THEORY_WEIGHT,
         myrow.BELONG_CODE,
         myrow.BELONG_NAME,
         myrow.STORAGE_NO,
         
         myrow.MEMO,
         '1',
         ?,
         v_time,
         myrow.PRODUCT_FLAG,
         myrow.MAT_STATUS,
         v_time,
         myrow.ACT_LEN,
         ?,
         ?,
         myrow.JUDGE_STD_NAME,
         myrow.PLINE_CODE,
         myrow.PLINE_NAME,
         myrow.GRADECODE,
         myrow.GRADENAME,
         v_bathYear,
         v_time,
         myrow.PIPMEMO,
         myrow.MAT_ORIGIN_CODE,
         myrow.MAT_ORIGIN_NAME,
         myrow.SOURE_CODE,
         myrow.SOURE_NAME,
         ?,
         ?);
         
         INSERT INTO YDM_ZC_INLIST_XS
        (MANAGEMENT_NO,
         MANAGEMENT_NAME,
         INSTOCK_SQE,
         INSTOCK_DOC,
         INSTOCK_TYPE_CODE,
         INSTOCK_TYPE_NAME,
         MAT_NO,
         JUDGE_STOVE_NO,
         BATCH_NO,
         BATCH_GROUD_NO,
         PRODUCCODE,
         PRODUCNAME,
         STD_CODE,
         STD_NAME,
         
         STEELCODE,
         STEELNAME,
         STD_STYLE,
         STD_STYLE_DESC,
         SPEC_CODE,
         SPEC_NAME,
         MODEL_CODE,
         MODEL_DESC,
         ACT_DIMATER,
         ACT_HEIGHT,
         ACT_LEN_MIN,
         ACT_LEN_MAX,
         ACT_COUNT,
         ACT_WEIGHT,
         ACT_THEORY_WEIGHT,
         BELONG_CODE,
         BELONG_NAME,
         STORAGE_NO,
         
         MEMO,
         VALIDFLAG,
         CREATE_NAME,
         CREATE_TIME,
         PRODUCT_FLAG,
         MAT_STATUS,
         INSTOCK_TIME,
         ACT_LEN,
         DEPARTMENT_CODE,
         DEPARTMENT_DESC,
         JUDGE_STD_NAME,
         PLINE_CODE,
         PLINE_NAME,
         GRADECODE,
         GRADENAME,
         BAL_YEAR_MONTH,
         IN_TIME_F,
         PIPMEMO,
         MAT_ORIGIN_CODE,
         MAT_ORIGIN_NAME,
         SOURE_CODE,
         SOURE_NAME,
         MATERIAL_NO,
         MATERIAL_NAME)
      VALUES
        (?,
         ?,
         v_instock_sqe,
         v_Instock_doc,
         ?,
         ?,
         v_matNo,
         myrow.JUDGE_STOVE_NO,
         myrow.BATCH_NO,
         v_groupNo,
         ?,
         ?,
         myrow.STD_CODE,
         myrow.STD_NAME,
         
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         myrow.ACT_DIMATER,
         myrow.ACT_HEIGHT,
         myrow.ACT_LEN_MIN,
         myrow.ACT_LEN_MAX,
         myrow.ACT_COUNT,
         myrow.ACT_WEIGHT,
         myrow.ACT_THEORY_WEIGHT,
         myrow.BELONG_CODE,
         myrow.BELONG_NAME,
         myrow.STORAGE_NO,
         
         myrow.MEMO,
         '1',
         ?,
         v_time,
         myrow.PRODUCT_FLAG,
         myrow.MAT_STATUS,
         v_time,
         myrow.ACT_LEN,
         ?,
         ?,
         myrow.JUDGE_STD_NAME,
         myrow.PLINE_CODE,
         myrow.PLINE_NAME,
         myrow.GRADECODE,
         myrow.GRADENAME,
         v_bathYear,
         v_time,
         myrow.PIPMEMO,
         myrow.MAT_ORIGIN_CODE,
         myrow.MAT_ORIGIN_NAME,
         myrow.SOURE_CODE,
         myrow.SOURE_NAME,
         ?,
         ?);
         
      UPDATE QCM_ZG_JUDGE_CHANGE T
         SET T.AGREE_MEMO     = ?,
             T.AGREE_NAME     = ?,
             T.AGREE_TIME     = v_time,
             T.AGREE_FLAG     = '2',
             T.Batch_Groud_No = v_groupNo
       WHERE T.JUDGE_ID = ?;
      v_Ocount   := v_Ocount + 1;
      v_matCount := v_matCount + 1;
      v_Icount   := v_Icount + 1;
    end loop;
  EXCEPTION
    WHEN OTHERS THEN
      dbms_output.put_line(SQLCODE || '---' || SQLERRM ||'--'||v_Ocount||'--'||v_matCount||'--'||v_Icount||v_matNo );
end;
end;
	]]>
	</query>
	<query id = "FrmExamineJudge.examineData1_" desc = "插入出库表">
	<![CDATA[
	declare
  v_Outstock_doc ydm_zc_outlist.outstock_doc%type := null; --出库单号
  v_outstock_sqe ydm_zc_outlist.outstock_sqe%type := null; --出库流水
  
  v_Memo         com_base_info.memo%type := null;
  v_Ocount       NUMBER := 1;
  v_time         ydm_zc_outlist.create_time%type := sysdate;
  v_bathYear     mat_zc_m.bal_year_month%type := to_char(sysdate, 'yyyyMM');
begin
    --生成出库单号
    select memo into v_Memo from com_base_info where basecode = ?;
    select v_Memo || to_char(sysdate, 'yymmdd') ||
           Lpad(NVL(MAX(substr(outstock_doc, 9)), 0) + 1, 5, 0) outstock_doc
      into v_Outstock_doc
      from ydm_zc_outlist t
     where t.outstock_type_code = ?
       AND trunc(t.CREATE_TIME) =
           trunc(sysdate);
    for myrow in (SELECT T.*,
                         S.STORAGE_NO,
                         S.LOCATION_NO,
                         S.STORAGE_ATTR,
                         S.Storage_Attr_Name,
                         S.Storage_Type_No,
                         S.Storage_Type_Name
                    FROM MAT_ZC_M T, YDM_ZC_BUTTRESS S
                   WHERE T.MAT_NO = S.MAT_NO
                     AND T.JUDGE_ID = ?) loop

       INSERT INTO CRM_MAT_ZC(
        MAT_NO,
        PRODUCT_FLAG,
        MAT_STATUS,
        LOT_NO,
        STOVE_NO,
        JUDGE_STOVE_NO,
        BATCH_NO,
        BATCH_GROUD_NO,
        MATERIAL_NO,
        MATERIAL_NAME,
        PRODUCCODE,
        PRODUCNAME,
        STEELCODE,
        STEELNAME,
        GRADECODE,
        GRADENAME,
        SPEC_CODE,
        SPEC_NAME,
        MODEL_CODE,
        MODEL_DESC,
        STD_CODE,
        STD_NAME,
        STD_STYLE,
        STD_STYLE_DESC,
        PRO_ORDER_NO,
        ORDER_NO,
        ORDER_SEQ,
        ORDER_SEQ_NO,
        ORD_PK,
        ORD_LN_PK,
        ORD_LN_DLY_PK,
        PLINE_CODE,
        PLINE_NAME,
        ACT_DIMATER,
        ACT_HEIGHT,
        ACT_LEN,
        ACT_LEN_MIN,
        ACT_LEN_MAX,
        ACT_COUNT,
        ACT_WEIGHT,
        BELONG_CODE,
        BELONG_NAME,
        IN_MOLD,
        INSTOCK_TIME,
        STORAGE_NO,
        LOCATION_NO,
        STORAGE_NAME,
        LOCATION_NAME,
        SUPPLY_UNIT_CODE,
        SUPPLY_UNIT,
        CREATE_TIME,
        DATA_STATUS)
 VALUES(
        MYROW.MAT_NO,
        (SELECT F.BASENAME FROM COM_BASE_INFO F WHERE F.BASECODE = MYROW.PRODUCT_FLAG),
        (SELECT F.BASENAME FROM COM_BASE_INFO F WHERE F.BASECODE = MYROW.MAT_STATUS),
        MYROW.LOT_NO,
        MYROW.STOVE_NO,
        MYROW.JUDGE_STOVE_NO,
        MYROW.BATCH_NO,
        MYROW.BATCH_GROUD_NO,
        MYROW.MATERIAL_NO,
        MYROW.MATERIAL_NAME,
        MYROW.PRODUCCODE,
        MYROW.PRODUCNAME,
        MYROW.STEELCODE,
        MYROW.STEELNAME,
        MYROW.GRADECODE,
        MYROW.GRADENAME,
        MYROW.SPEC_CODE,
        MYROW.SPEC_NAME,
        MYROW.MODEL_CODE,
        MYROW.MODEL_DESC,
        MYROW.STD_CODE,
        MYROW.STD_NAME,
        MYROW.STD_STYLE,
        MYROW.STD_STYLE_DESC,
        MYROW.PRO_ORDER_NO,
        MYROW.ORDER_NO,
        MYROW.ORDER_SEQ,
        MYROW.ORDER_SEQ_NO,
        MYROW.ORD_PK,
        MYROW.ORD_LN_PK,
        MYROW.ORD_LN_DLY_PK,
        MYROW.PLINE_CODE,
        MYROW.PLINE_NAME,
        MYROW.ACT_DIMATER,
        MYROW.ACT_HEIGHT,
        MYROW.ACT_LEN,
        MYROW.ACT_LEN_MIN,
        MYROW.ACT_LEN_MAX,
        MYROW.ACT_COUNT,
        MYROW.ACT_WEIGHT,
        MYROW.BELONG_CODE,
        MYROW.BELONG_NAME,
        (SELECT F.BASENAME FROM COM_BASE_INFO F WHERE F.BASECODE = MYROW.IN_MOLD),
        TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
        MYROW.STORAGE_NO,
        MYROW.LOCATION_NO,
        (SELECT S1.STORAGE_NAME FROM YDM_BS_STORAGE S1 WHERE S1.STORAGE_NO = MYROW.STORAGE_NO),
        (SELECT S2.LOCATION_NAME FROM YDM_BS_LOCATION S2 WHERE S2.LOCATION_NO = MYROW.LOCATION_NO),
        MYROW.SUPPLY_UNIT_CODE,
        MYROW.SUPPLY_UNIT,
        TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),'2');
      v_outstock_sqe := v_Outstock_doc || Lpad(v_Ocount, 4, 0);
      INSERT INTO YDM_ZC_OUTLIST
        (DEPARTMENT_CODE,
         DEPARTMENT_DESC,
         PRODUCT_FLAG,
         MAT_STATUS,
         JUDGE_STD_NAME,
         JUDGE_STD_CODE,
         BAL_YEAR_MONTH,
         OUTSTOCK_SQE,
         OUTSTOCK_DOC,
         OUTSTOCK_TYPE_CODE,
         OUTSTOCK_TYPE_NAME,
         MAT_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,
         BELONG_CODE,
         BELONG_NAME,
         STORAGE_NO,
         LOCATION_NO,
         MANAGEMENT_NO,
         MANAGEMENT_NAME,
         OUTSTOCK_TIME,
         OUT_BC,
         OUT_BZ,
         MEMO,
         VALIDFLAG,
         CREATE_NAME,
         CREATE_TIME,
         SUPPLY_UNIT_CODE,
         SUPPLY_UNIT,
         IS_DEALER,
         LOT_NO,
         STOVE_NO,
         PROCESS_CDOE,
         PROCESS_DESC)
      VALUES
        (?,
         ?,
         myrow.product_flag,
         myrow.mat_status,
         myrow.judge_std_name,
         myrow.judge_std_code,
         ?,
         v_outstock_sqe,
         v_Outstock_doc,
         ?,
         ?,
         myrow.mat_no,
         myrow.JUDGE_STOVE_NO,
         myrow.BATCH_NO,
         myrow.BATCH_GROUD_NO,
         myrow.MATERIAL_NO,
         myrow.MATERIAL_NAME,
         myrow.PRODUCCODE,
         myrow.PRODUCNAME,
         myrow.STD_CODE,
         myrow.STD_NAME,
         myrow.GRADECODE,
         myrow.GRADENAME,
         myrow.STEELCODE,
         myrow.STEELNAME,
         myrow.STD_STYLE,
         myrow.STD_STYLE_DESC,
         myrow.SPEC_CODE,
         myrow.SPEC_NAME,
         myrow.MODEL_CODE,
         myrow.MODEL_DESC,
         myrow.PLINE_CODE,
         myrow.PLINE_NAME,
         myrow.ACT_DIMATER,
         myrow.ACT_HEIGHT,
         myrow.ACT_LEN,
         myrow.ACT_LEN_MIN,
         myrow.ACT_LEN_MAX,
         myrow.ACT_COUNT,
         myrow.ACT_WEIGHT,
         myrow.ACT_THEORY_WEIGHT,
         myrow.BELONG_CODE,
         myrow.BELONG_NAME,
         myrow.STORAGE_NO,
         myrow.LOCATION_NO,
         ?,
         ?,
         v_time,
         '1',
         '1',
         myrow.pipmemo,
         '1',
         ?,
         v_time,
         myrow.SUPPLY_UNIT_CODE,
         myrow.SUPPLY_UNIT,
         myrow.IS_DEALER,
         myrow.LOT_NO,
         myrow.STOVE_NO,
         myrow.PROCESS_CDOE,
         myrow.PROCESS_DESC);
      DELETE YDM_ZC_BUTTRESS T WHERE T.MAT_NO = myrow.mat_no;
      v_Ocount   := v_Ocount + 1;
    end loop;
end;
	]]>
	</query>
	<query id = "FrmExamineJudge.examineData_R" desc= "入库信息">
	<![CDATA[
	declare
  v_Instock_doc  ydm_zc_inlist.instock_doc%type := null; --入库单号
  v_instock_sqe  ydm_zc_inlist.instock_sqe%type := null; --入库流水
  v_Imemo        com_base_info.memo%type := null;
  v_Icount       NUMBER := 1;
  v_time         ydm_zc_outlist.create_time%type := sysdate;
  v_bathYear     mat_zc_m.bal_year_month%type := to_char(sysdate, 'yyyyMM');
  v_matNo        mat_zc_m.mat_no%type := null; --材料号
  v_matCount     Number := 1;
  v_groupNo      mat_zc_m.batch_groud_no%type := null; --组号
  v_act_dimater  mat_zc_m.act_dimater%type := null;--外径
  v_act_height  mat_zc_m.act_height%type := null;--壁厚
begin
    --外径壁厚
    SELECT
        DIMATER,HEIGHT
    into
        v_act_dimater,v_act_height
    FROM COM_BASE_SPEC WHERE SPEC_CODE = ?;
    --生成入库单号
    select memo into v_Imemo from com_base_info where basecode = ?;
    select v_Imemo || to_char(sysdate, 'yymmdd') ||
           Lpad(NVL(MAX(substr(t.instock_doc, 9)), 0) + 1, 5, 0) instock_doc
      into v_Instock_doc
      from ydm_zc_inlist t
     where t.instock_type_code = ?
       AND trunc(t.CREATE_TIME) =
           trunc(sysdate);
    --生成材料号
    SELECT Lpad(NVL(MAX(substr(t1.mat_no, length(t1.mat_no) - 3)), 0) + 1, 4, 0)
  into v_matCount
  FROM (SELECT T.MAT_NO
          FROM MAT_ZC_M T
         WHERE T.JUDGE_STOVE_NO = ?
           AND T.BATCH_NO = ?
        UNION ALL
        SELECT T.MAT_NO
          FROM MAT_ZC_TRACK T
         WHERE T.JUDGE_STOVE_NO = ?
           AND T.BATCH_NO = ?) T1;
    --生成组号
    SELECT Lpad(NVL(MAX(t.batch_groud_no), 0) + 1, 3, 0)
      into v_groupNo
      FROM MAT_ZC_M T
     WHERE T.JUDGE_STOVE_NO = ?
       AND T.BATCH_NO = ?;
    for myrow in (SELECT T.*,
                         S.STORAGE_NO,
                         S.LOCATION_NO,
                         S.STORAGE_ATTR,
                         S.Storage_Attr_Name,
                         S.Storage_Type_No,
                         S.Storage_Type_Name
                    FROM MAT_ZC_M T, YDM_ZC_BUTTRESS S
                   WHERE T.MAT_NO = S.MAT_NO
                     AND T.JUDGE_ID = ?) loop
      v_matNo := myrow.judge_stove_no || myrow.batch_no ||
                 Lpad(v_matCount, 4, 0);
      INSERT INTO MAT_ZC_M
        (JUDGE_STOVE_NO,
         BATCH_NO,
         BATCH_GROUD_NO,
         PRODUCCODE,
         PRODUCNAME,
         STEELCODE,
         STEELNAME,
         SPEC_CODE,
         SPEC_NAME,
         MODEL_CODE,
         MODEL_DESC,
         STD_CODE,
         STD_NAME,
         BELONG_CODE,
         BELONG_NAME,
         STD_STYLE,
         STD_STYLE_DESC,
         
         ACT_DIMATER,
         ACT_HEIGHT,
         LEN_NO,
         LEN_DESC,
         LEN_UNIT,
         ACT_LEN_MIN,
         ACT_LEN_MAX,
         CREATE_NAME,
         
         ACT_COUNT,
         ACT_WEIGHT,
         CREATE_TIME,
         INSTOCK_TIME,
         MAT_NO,
         MEMO,
         JUGDE_APPLY_FLAG,
         INSTOCK_FLAG,
         PRODUCT_FLAG,
         MAT_STATUS,
         ACT_LEN,
         JUDGE_STD_NAME,
         BAL_YEAR_MONTH,
         PLINE_CODE,
         PLINE_NAME,
         GRADECODE,
         GRADENAME,
         PIPMEMO,
         OLD_ORDER_NO,
         JUDGE_RESULT_TIME,
         MAT_ORIGIN_CODE,
         MAT_ORIGIN_NAME,
         SOURE_CODE,
         SOURE_NAME,
         MATERIAL_NO,
         MATERIAL_NAME,
         ZBS_FLAG,
         ZBS_ID,
         MEASURING_SEQ,
         JG_ZBS_ID,
         SUPPLY_UNIT_CODE,
         SUPPLY_UNIT,
         IS_DEALER,
         LOT_NO,
         STOVE_NO,
         PROCESS_CDOE,
         PROCESS_DESC)
      VALUES
        (myrow.JUDGE_STOVE_NO,
         myrow.BATCH_NO,
         v_groupNo,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         myrow.std_code,
         myrow.STD_NAME,
         myrow.BELONG_CODE,
         myrow.BELONG_NAME,
         ?,
         ?,
         
         v_act_dimater,
         v_act_height,
         myrow.LEN_NO,
         myrow.LEN_DESC,
         myrow.LEN_UNIT,
         myrow.ACT_LEN_MIN,
         myrow.ACT_LEN_MAX,
         ?,
         
         myrow.ACT_COUNT,
         myrow.ACT_WEIGHT,
         v_time,
         v_time,
         v_matNo,
         myrow.MEMO,
         myrow.JUGDE_APPLY_FLAG,
         myrow.INSTOCK_FLAG,
         myrow.PRODUCT_FLAG,
         myrow.MAT_STATUS,
         myrow.ACT_LEN,
         myrow.JUDGE_STD_NAME,
         v_bathYear,
         myrow.PLINE_CODE,
         myrow.PLINE_NAME,
         myrow.GRADECODE,
         myrow.GRADENAME,
         myrow.PIPMEMO,
         myrow.OLD_ORDER_NO,
         myrow.JUDGE_RESULT_TIME,
         myrow.MAT_ORIGIN_CODE,
         myrow.MAT_ORIGIN_NAME,
         myrow.SOURE_CODE,
         myrow.SOURE_NAME,
         ?,
         ?,
         myrow.ZBS_FLAG,
         myrow.ZBS_ID,
         myrow.MEASURING_SEQ,
         myrow.JG_ZBS_ID,
         myrow.SUPPLY_UNIT_CODE,
         myrow.SUPPLY_UNIT,
         myrow.IS_DEALER,
        myrow.LOT_NO,
         myrow.STOVE_NO,
         myrow.PROCESS_CDOE,
         myrow.PROCESS_DESC);
         
         INSERT INTO CRM_MAT_ZC(
        MAT_NO,
        PRODUCT_FLAG,
        MAT_STATUS,
        LOT_NO,
        STOVE_NO,
        JUDGE_STOVE_NO,
        BATCH_NO,
        BATCH_GROUD_NO,
        MATERIAL_NO,
        MATERIAL_NAME,
        PRODUCCODE,
        PRODUCNAME,
        STEELCODE,
        STEELNAME,
        GRADECODE,
        GRADENAME,
        SPEC_CODE,
        SPEC_NAME,
        MODEL_CODE,
        MODEL_DESC,
        STD_CODE,
        STD_NAME,
        STD_STYLE,
        STD_STYLE_DESC,
        PRO_ORDER_NO,
        ORDER_NO,
        ORDER_SEQ,
        ORDER_SEQ_NO,
        ORD_PK,
        ORD_LN_PK,
        ORD_LN_DLY_PK,
        PLINE_CODE,
        PLINE_NAME,
        ACT_DIMATER,
        ACT_HEIGHT,
        ACT_LEN,
        ACT_LEN_MIN,
        ACT_LEN_MAX,
        ACT_COUNT,
        ACT_WEIGHT,
        BELONG_CODE,
        BELONG_NAME,
        IN_MOLD,
        INSTOCK_TIME,
        STORAGE_NO,
        LOCATION_NO,
        STORAGE_NAME,
        LOCATION_NAME,
        SUPPLY_UNIT_CODE,
        SUPPLY_UNIT,
        CREATE_TIME,
        DATA_STATUS)
 VALUES(
        v_matNo,
        (SELECT F.BASENAME FROM COM_BASE_INFO F WHERE F.BASECODE = MYROW.PRODUCT_FLAG),
        (SELECT F.BASENAME FROM COM_BASE_INFO F WHERE F.BASECODE = MYROW.MAT_STATUS),
        MYROW.LOT_NO,
        MYROW.STOVE_NO,
        MYROW.JUDGE_STOVE_NO,
        MYROW.BATCH_NO,
        v_groupNo,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        MYROW.GRADECODE,
        MYROW.GRADENAME,
        ?,
        ?,
        ?,
        ?,
        MYROW.STD_CODE,
        MYROW.STD_NAME,
        ?,
        ?,
        MYROW.PRO_ORDER_NO,
        MYROW.ORDER_NO,
        MYROW.ORDER_SEQ,
        MYROW.ORDER_SEQ_NO,
        MYROW.ORD_PK,
        MYROW.ORD_LN_PK,
        MYROW.ORD_LN_DLY_PK,
        MYROW.PLINE_CODE,
        MYROW.PLINE_NAME,
        v_act_dimater,
        v_act_height,
        MYROW.ACT_LEN,
        MYROW.ACT_LEN_MIN,
        MYROW.ACT_LEN_MAX,
        MYROW.ACT_COUNT,
        MYROW.ACT_WEIGHT,
        MYROW.BELONG_CODE,
        MYROW.BELONG_NAME,
        (SELECT F.BASENAME FROM COM_BASE_INFO F WHERE F.BASECODE = MYROW.IN_MOLD),
        v_time,
        MYROW.STORAGE_NO,
        MYROW.LOCATION_NO,
        (SELECT S1.STORAGE_NAME FROM YDM_BS_STORAGE S1 WHERE S1.STORAGE_NO = MYROW.STORAGE_NO),
        (SELECT S2.LOCATION_NAME FROM YDM_BS_LOCATION S2 WHERE S2.LOCATION_NO = MYROW.LOCATION_NO),
        MYROW.SUPPLY_UNIT_CODE,
        MYROW.SUPPLY_UNIT,
        v_time,'0');
      INSERT INTO YDM_ZC_BUTTRESS
        (JUDGE_STOVE_NO,
         BATCH_NO,
         BATCH_GROUD_NO,
         STORAGE_NO,
         LOCATION_NO,
         STORAGE_TYPE_NO,
         STORAGE_TYPE_NAME,
         
         CREATE_NAME,
         MAT_NO,
         CREATE_TIME,
         MANAGEMENT_NO,
         MANAGEMENT_NAME,
         DEPARTMENT_CODE,
         DEPARTMENT_DESC)
      VALUES
        (myrow.JUDGE_STOVE_NO,
         myrow.BATCH_NO,
         v_groupNo,
         myrow.STORAGE_NO,
         myrow.LOCATION_NO,
         myrow.STORAGE_TYPE_NO,
         myrow.STORAGE_TYPE_NAME,
         
         ?,
         v_matNo,
         v_time,
         ?,
         ?,
         ?,
         ?);
      v_instock_sqe := v_Instock_doc || Lpad(v_Icount, 4, 0);
      INSERT INTO YDM_ZC_INLIST
        (MANAGEMENT_NO,
         MANAGEMENT_NAME,
         INSTOCK_SQE,
         INSTOCK_DOC,
         INSTOCK_TYPE_CODE,
         INSTOCK_TYPE_NAME,
         MAT_NO,
         JUDGE_STOVE_NO,
         BATCH_NO,
         BATCH_GROUD_NO,
         PRODUCCODE,
         PRODUCNAME,
         STD_CODE,
         STD_NAME,
         
         STEELCODE,
         STEELNAME,
         STD_STYLE,
         STD_STYLE_DESC,
         SPEC_CODE,
         SPEC_NAME,
         MODEL_CODE,
         MODEL_DESC,
         ACT_DIMATER,
         ACT_HEIGHT,
         ACT_LEN_MIN,
         ACT_LEN_MAX,
         ACT_COUNT,
         ACT_WEIGHT,
         ACT_THEORY_WEIGHT,
         BELONG_CODE,
         BELONG_NAME,
         STORAGE_NO,
         
         MEMO,
         VALIDFLAG,
         CREATE_NAME,
         CREATE_TIME,
         PRODUCT_FLAG,
         MAT_STATUS,
         INSTOCK_TIME,
         ACT_LEN,
         DEPARTMENT_CODE,
         DEPARTMENT_DESC,
         JUDGE_STD_NAME,
         PLINE_CODE,
         PLINE_NAME,
         GRADECODE,
         GRADENAME,
         BAL_YEAR_MONTH,
         IN_TIME_F,
         PIPMEMO,
         MAT_ORIGIN_CODE,
         MAT_ORIGIN_NAME,
         SOURE_CODE,
         SOURE_NAME,
         MATERIAL_NO,
         MATERIAL_NAME,
         SUPPLY_UNIT_CODE,
         SUPPLY_UNIT,
         IS_DEALER,
          LOT_NO,
         STOVE_NO,
         PROCESS_CDOE,
         PROCESS_DESC)
      VALUES
        (?,
         ?,
         v_instock_sqe,
         v_Instock_doc,
         ?,
         ?,
         v_matNo,
         myrow.JUDGE_STOVE_NO,
         myrow.BATCH_NO,
         v_groupNo,
         ?,
         ?,
         myrow.STD_CODE,
         myrow.STD_NAME,
         
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         v_act_dimater,
         v_act_height,
         myrow.ACT_LEN_MIN,
         myrow.ACT_LEN_MAX,
         myrow.ACT_COUNT,
         myrow.ACT_WEIGHT,
         myrow.ACT_THEORY_WEIGHT,
         myrow.BELONG_CODE,
         myrow.BELONG_NAME,
         myrow.STORAGE_NO,
         
         myrow.MEMO,
         '1',
         ?,
         v_time,
         myrow.PRODUCT_FLAG,
         myrow.MAT_STATUS,
         v_time,
         myrow.ACT_LEN,
         ?,
         ?,
         myrow.JUDGE_STD_NAME,
         myrow.PLINE_CODE,
         myrow.PLINE_NAME,
         myrow.GRADECODE,
         myrow.GRADENAME,
         ?,
         v_time,
         myrow.PIPMEMO,
         myrow.MAT_ORIGIN_CODE,
         myrow.MAT_ORIGIN_NAME,
         myrow.SOURE_CODE,
         myrow.SOURE_NAME,
         ?,
         ?,
         myrow.SUPPLY_UNIT_CODE,
         myrow.SUPPLY_UNIT,
         myrow.IS_DEALER,
          myrow.LOT_NO,
        myrow. STOVE_NO,
         myrow.PROCESS_CDOE,
         myrow.PROCESS_DESC);
         
         
      UPDATE QCM_ZG_JUDGE_CHANGE T
         SET T.AGREE_MEMO     = ?,
             T.AGREE_NAME     = ?,
             T.AGREE_TIME     = v_time,
             T.AGREE_FLAG     = '2',
             T.Batch_Groud_No = v_groupNo,
             T.JUDGE_STOVE_NO = myrow.JUDGE_STOVE_NO,
             T.BATCH_NO       = myrow.BATCH_NO
       WHERE T.JUDGE_ID = ?;
      v_matCount := v_matCount + 1;
      v_Icount   := v_Icount + 1;
    end loop;
end;
	]]>
	</query>
	
	<query id = "FrmExamineJudgeXs.examineData_R" desc= "入库信息">
	<![CDATA[
	declare
  v_Instock_doc  ydm_zc_inlist.instock_doc%type := null; --入库单号
  v_instock_sqe  ydm_zc_inlist.instock_sqe%type := null; --入库流水
  v_Imemo        com_base_info.memo%type := null;
  v_Icount       NUMBER := 1;
  v_time         ydm_zc_outlist.create_time%type := sysdate;
  v_bathYear     mat_zc_m.bal_year_month%type := to_char(sysdate, 'yyyyMM');
  v_matNo        mat_zc_m.mat_no%type := null; --材料号
  v_matCount     Number := 1;
  v_groupNo      mat_zc_m.batch_groud_no%type := null; --组号
  v_act_dimater  mat_zc_m.act_dimater%type := null;--外径
  v_act_height  mat_zc_m.act_height%type := null;--壁厚
begin
    --外径壁厚
    SELECT
        DIMATER,HEIGHT
    into
        v_act_dimater,v_act_height
    FROM COM_BASE_SPEC WHERE SPEC_CODE = ?;
    --生成入库单号
    select memo into v_Imemo from com_base_info where basecode = ?;
    select v_Imemo || to_char(sysdate, 'yymmdd') ||
           Lpad(NVL(MAX(substr(t.instock_doc, 9)), 0) + 1, 5, 0) instock_doc
      into v_Instock_doc
      from ydm_zc_inlist t
     where t.instock_type_code = ?
       AND trunc(t.CREATE_TIME) =
           trunc(sysdate);
    --生成材料号
    SELECT Lpad(NVL(MAX(substr(t1.mat_no, length(t1.mat_no) - 3)), 0) + 1, 4, 0)
  into v_matCount
  FROM (SELECT T.MAT_NO
          FROM MAT_ZC_M T
         WHERE T.JUDGE_STOVE_NO = ?
           AND T.BATCH_NO = ?
        UNION ALL
        SELECT T.MAT_NO
          FROM MAT_ZC_TRACK T
         WHERE T.JUDGE_STOVE_NO = ?
           AND T.BATCH_NO = ?) T1;
    --生成组号
    SELECT Lpad(NVL(MAX(t.batch_groud_no), 0) + 1, 3, 0)
      into v_groupNo
      FROM MAT_ZC_M T
     WHERE T.JUDGE_STOVE_NO = ?
       AND T.BATCH_NO = ?;
    for myrow in (SELECT T.*,
                         S.STORAGE_NO,
                         S.LOCATION_NO,
                         S.STORAGE_ATTR,
                         S.Storage_Attr_Name,
                         S.Storage_Type_No,
                         S.Storage_Type_Name
                    FROM MAT_ZC_M T, YDM_ZC_BUTTRESS S
                   WHERE T.MAT_NO = S.MAT_NO
                     AND T.JUDGE_ID = ?) loop
      v_matNo := myrow.judge_stove_no || myrow.batch_no ||
                 Lpad(v_matCount, 4, 0);
      INSERT INTO MAT_ZC_M
        (JUDGE_STOVE_NO,
         BATCH_NO,
         BATCH_GROUD_NO,
         PRODUCCODE,
         PRODUCNAME,
         STEELCODE,
         STEELNAME,
         SPEC_CODE,
         SPEC_NAME,
         MODEL_CODE,
         MODEL_DESC,
         STD_CODE,
         STD_NAME,
         BELONG_CODE,
         BELONG_NAME,
         STD_STYLE,
         STD_STYLE_DESC,
         
         ACT_DIMATER,
         ACT_HEIGHT,
         LEN_NO,
         LEN_DESC,
         LEN_UNIT,
         ACT_LEN_MIN,
         ACT_LEN_MAX,
         CREATE_NAME,
         
         ACT_COUNT,
         ACT_WEIGHT,
         CREATE_TIME,
         INSTOCK_TIME,
         MAT_NO,
         MEMO,
         JUGDE_APPLY_FLAG,
         INSTOCK_FLAG,
         PRODUCT_FLAG,
         MAT_STATUS,
         ACT_LEN,
         JUDGE_STD_NAME,
         BAL_YEAR_MONTH,
         PLINE_CODE,
         PLINE_NAME,
         GRADECODE,
         GRADENAME,
         PIPMEMO,
         OLD_ORDER_NO,
         JUDGE_RESULT_TIME,
         MAT_ORIGIN_CODE,
         MAT_ORIGIN_NAME,
         SOURE_CODE,
         SOURE_NAME,
         MATERIAL_NO,
         MATERIAL_NAME,
         ZBS_FLAG,
         ZBS_ID,
         MEASURING_SEQ,
         JG_ZBS_ID,
         SUPPLY_UNIT_CODE,
         SUPPLY_UNIT,
         IS_DEALER,
         LOT_NO,
         STOVE_NO,
         PROCESS_CDOE,
         PROCESS_DESC)
      VALUES
        (myrow.JUDGE_STOVE_NO,
         myrow.BATCH_NO,
         v_groupNo,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         myrow.std_code,
         myrow.STD_NAME,
         myrow.BELONG_CODE,
         myrow.BELONG_NAME,
         ?,
         ?,
         
         v_act_dimater,
         v_act_height,
         myrow.LEN_NO,
         myrow.LEN_DESC,
         myrow.LEN_UNIT,
         myrow.ACT_LEN_MIN,
         myrow.ACT_LEN_MAX,
         ?,
         
         myrow.ACT_COUNT,
         myrow.ACT_WEIGHT,
         v_time,
         v_time,
         v_matNo,
         myrow.MEMO,
         myrow.JUGDE_APPLY_FLAG,
         myrow.INSTOCK_FLAG,
         myrow.PRODUCT_FLAG,
         myrow.MAT_STATUS,
         myrow.ACT_LEN,
         myrow.JUDGE_STD_NAME,
         v_bathYear,
         myrow.PLINE_CODE,
         myrow.PLINE_NAME,
         myrow.GRADECODE,
         myrow.GRADENAME,
         myrow.PIPMEMO,
         myrow.OLD_ORDER_NO,
         myrow.JUDGE_RESULT_TIME,
         myrow.MAT_ORIGIN_CODE,
         myrow.MAT_ORIGIN_NAME,
         myrow.SOURE_CODE,
         myrow.SOURE_NAME,
         ?,
         ?,
         myrow.ZBS_FLAG,
         myrow.ZBS_ID,
         myrow.MEASURING_SEQ,
         myrow.JG_ZBS_ID,
         myrow.SUPPLY_UNIT_CODE,
         myrow.SUPPLY_UNIT,
         myrow.IS_DEALER,
        myrow.LOT_NO,
         myrow.STOVE_NO,
         myrow.PROCESS_CDOE,
         myrow.PROCESS_DESC);
         
         INSERT INTO MAT_ZC_M_XS
        (JUDGE_STOVE_NO,
         BATCH_NO,
         BATCH_GROUD_NO,
         PRODUCCODE,
         PRODUCNAME,
         STEELCODE,
         STEELNAME,
         SPEC_CODE,
         SPEC_NAME,
         MODEL_CODE,
         MODEL_DESC,
         STD_CODE,
         STD_NAME,
         BELONG_CODE,
         BELONG_NAME,
         STD_STYLE,
         STD_STYLE_DESC,
         
         ACT_DIMATER,
         ACT_HEIGHT,
         LEN_NO,
         LEN_DESC,
         LEN_UNIT,
         ACT_LEN_MIN,
         ACT_LEN_MAX,
         CREATE_NAME,
         
         ACT_COUNT,
         ACT_WEIGHT,
         CREATE_TIME,
         INSTOCK_TIME,
         MAT_NO,
         MEMO,
         JUGDE_APPLY_FLAG,
         INSTOCK_FLAG,
         PRODUCT_FLAG,
         MAT_STATUS,
         ACT_LEN,
         JUDGE_STD_NAME,
         BAL_YEAR_MONTH,
         PLINE_CODE,
         PLINE_NAME,
         GRADECODE,
         GRADENAME,
         PIPMEMO,
         OLD_ORDER_NO,
         JUDGE_RESULT_TIME,
         MAT_ORIGIN_CODE,
         MAT_ORIGIN_NAME,
         SOURE_CODE,
         SOURE_NAME,
         MATERIAL_NO,
         MATERIAL_NAME,
         ZBS_FLAG,
         ZBS_ID,
         MEASURING_SEQ,
         JG_ZBS_ID,
         SUPPLY_UNIT_CODE,
         SUPPLY_UNIT,
         IS_DEALER,
         LOT_NO,
         STOVE_NO,
         PROCESS_CDOE,
         PROCESS_DESC)
      VALUES
        (myrow.JUDGE_STOVE_NO,
         myrow.BATCH_NO,
         v_groupNo,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         myrow.std_code,
         myrow.STD_NAME,
         myrow.BELONG_CODE,
         myrow.BELONG_NAME,
         ?,
         ?,
         
         v_act_dimater,
         v_act_height,
         myrow.LEN_NO,
         myrow.LEN_DESC,
         myrow.LEN_UNIT,
         myrow.ACT_LEN_MIN,
         myrow.ACT_LEN_MAX,
         ?,
         
         myrow.ACT_COUNT,
         myrow.ACT_WEIGHT,
         v_time,
         v_time,
         v_matNo,
         myrow.MEMO,
         myrow.JUGDE_APPLY_FLAG,
         myrow.INSTOCK_FLAG,
         myrow.PRODUCT_FLAG,
         myrow.MAT_STATUS,
         myrow.ACT_LEN,
         myrow.JUDGE_STD_NAME,
         v_bathYear,
         myrow.PLINE_CODE,
         myrow.PLINE_NAME,
         myrow.GRADECODE,
         myrow.GRADENAME,
         myrow.PIPMEMO,
         myrow.OLD_ORDER_NO,
         myrow.JUDGE_RESULT_TIME,
         myrow.MAT_ORIGIN_CODE,
         myrow.MAT_ORIGIN_NAME,
         myrow.SOURE_CODE,
         myrow.SOURE_NAME,
         ?,
         ?,
         myrow.ZBS_FLAG,
         myrow.ZBS_ID,
         myrow.MEASURING_SEQ,
         myrow.JG_ZBS_ID,
         myrow.SUPPLY_UNIT_CODE,
         myrow.SUPPLY_UNIT,
         myrow.IS_DEALER,
        myrow.LOT_NO,
         myrow.STOVE_NO,
         myrow.PROCESS_CDOE,
         myrow.PROCESS_DESC);

         INSERT INTO CRM_MAT_ZC(
        MAT_NO,
        PRODUCT_FLAG,
        MAT_STATUS,
        LOT_NO,
        STOVE_NO,
        JUDGE_STOVE_NO,
        BATCH_NO,
        BATCH_GROUD_NO,
        MATERIAL_NO,
        MATERIAL_NAME,
        PRODUCCODE,
        PRODUCNAME,
        STEELCODE,
        STEELNAME,
        GRADECODE,
        GRADENAME,
        SPEC_CODE,
        SPEC_NAME,
        MODEL_CODE,
        MODEL_DESC,
        STD_CODE,
        STD_NAME,
        STD_STYLE,
        STD_STYLE_DESC,
        PRO_ORDER_NO,
        ORDER_NO,
        ORDER_SEQ,
        ORDER_SEQ_NO,
        ORD_PK,
        ORD_LN_PK,
        ORD_LN_DLY_PK,
        PLINE_CODE,
        PLINE_NAME,
        ACT_DIMATER,
        ACT_HEIGHT,
        ACT_LEN,
        ACT_LEN_MIN,
        ACT_LEN_MAX,
        ACT_COUNT,
        ACT_WEIGHT,
        BELONG_CODE,
        BELONG_NAME,
        IN_MOLD,
        INSTOCK_TIME,
        STORAGE_NO,
        LOCATION_NO,
        STORAGE_NAME,
        LOCATION_NAME,
        SUPPLY_UNIT_CODE,
        SUPPLY_UNIT,
        CREATE_TIME,
        DATA_STATUS)
 VALUES(
        v_matNo,
        (SELECT F.BASENAME FROM COM_BASE_INFO F WHERE F.BASECODE = MYROW.PRODUCT_FLAG),
        (SELECT F.BASENAME FROM COM_BASE_INFO F WHERE F.BASECODE = MYROW.MAT_STATUS),
        MYROW.LOT_NO,
        MYROW.STOVE_NO,
        MYROW.JUDGE_STOVE_NO,
        MYROW.BATCH_NO,
        v_groupNo,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        MYROW.GRADECODE,
        MYROW.GRADENAME,
        ?,
        ?,
        ?,
        ?,
        MYROW.STD_CODE,
        MYROW.STD_NAME,
        ?,
        ?,
        MYROW.PRO_ORDER_NO,
        MYROW.ORDER_NO,
        MYROW.ORDER_SEQ,
        MYROW.ORDER_SEQ_NO,
        MYROW.ORD_PK,
        MYROW.ORD_LN_PK,
        MYROW.ORD_LN_DLY_PK,
        MYROW.PLINE_CODE,
        MYROW.PLINE_NAME,
        v_act_dimater,
        v_act_height,
        MYROW.ACT_LEN,
        MYROW.ACT_LEN_MIN,
        MYROW.ACT_LEN_MAX,
        MYROW.ACT_COUNT,
        MYROW.ACT_WEIGHT,
        MYROW.BELONG_CODE,
        MYROW.BELONG_NAME,
        (SELECT F.BASENAME FROM COM_BASE_INFO F WHERE F.BASECODE = MYROW.IN_MOLD),
        v_time,
        MYROW.STORAGE_NO,
        MYROW.LOCATION_NO,
        (SELECT S1.STORAGE_NAME FROM YDM_BS_STORAGE S1 WHERE S1.STORAGE_NO = MYROW.STORAGE_NO),
        (SELECT S2.LOCATION_NAME FROM YDM_BS_LOCATION S2 WHERE S2.LOCATION_NO = MYROW.LOCATION_NO),
        MYROW.SUPPLY_UNIT_CODE,
        MYROW.SUPPLY_UNIT,
        v_time,'0');
      INSERT INTO YDM_ZC_BUTTRESS
        (JUDGE_STOVE_NO,
         BATCH_NO,
         BATCH_GROUD_NO,
         STORAGE_NO,
         LOCATION_NO,
         STORAGE_TYPE_NO,
         STORAGE_TYPE_NAME,
         
         CREATE_NAME,
         MAT_NO,
         CREATE_TIME,
         MANAGEMENT_NO,
         MANAGEMENT_NAME,
         DEPARTMENT_CODE,
         DEPARTMENT_DESC)
      VALUES
        (myrow.JUDGE_STOVE_NO,
         myrow.BATCH_NO,
         v_groupNo,
         myrow.STORAGE_NO,
         myrow.LOCATION_NO,
         myrow.STORAGE_TYPE_NO,
         myrow.STORAGE_TYPE_NAME,
         
         ?,
         v_matNo,
         v_time,
         ?,
         ?,
         ?,
         ?);
      v_instock_sqe := v_Instock_doc || Lpad(v_Icount, 4, 0);
      INSERT INTO YDM_ZC_INLIST
        (MANAGEMENT_NO,
         MANAGEMENT_NAME,
         INSTOCK_SQE,
         INSTOCK_DOC,
         INSTOCK_TYPE_CODE,
         INSTOCK_TYPE_NAME,
         MAT_NO,
         JUDGE_STOVE_NO,
         BATCH_NO,
         BATCH_GROUD_NO,
         PRODUCCODE,
         PRODUCNAME,
         STD_CODE,
         STD_NAME,
         
         STEELCODE,
         STEELNAME,
         STD_STYLE,
         STD_STYLE_DESC,
         SPEC_CODE,
         SPEC_NAME,
         MODEL_CODE,
         MODEL_DESC,
         ACT_DIMATER,
         ACT_HEIGHT,
         ACT_LEN_MIN,
         ACT_LEN_MAX,
         ACT_COUNT,
         ACT_WEIGHT,
         ACT_THEORY_WEIGHT,
         BELONG_CODE,
         BELONG_NAME,
         STORAGE_NO,
         
         MEMO,
         VALIDFLAG,
         CREATE_NAME,
         CREATE_TIME,
         PRODUCT_FLAG,
         MAT_STATUS,
         INSTOCK_TIME,
         ACT_LEN,
         DEPARTMENT_CODE,
         DEPARTMENT_DESC,
         JUDGE_STD_NAME,
         PLINE_CODE,
         PLINE_NAME,
         GRADECODE,
         GRADENAME,
         BAL_YEAR_MONTH,
         IN_TIME_F,
         PIPMEMO,
         MAT_ORIGIN_CODE,
         MAT_ORIGIN_NAME,
         SOURE_CODE,
         SOURE_NAME,
         MATERIAL_NO,
         MATERIAL_NAME,
         SUPPLY_UNIT_CODE,
         SUPPLY_UNIT,
         IS_DEALER,
          LOT_NO,
         STOVE_NO,
         PROCESS_CDOE,
         PROCESS_DESC)
      VALUES
        (?,
         ?,
         v_instock_sqe,
         v_Instock_doc,
         ?,
         ?,
         v_matNo,
         myrow.JUDGE_STOVE_NO,
         myrow.BATCH_NO,
         v_groupNo,
         ?,
         ?,
         myrow.STD_CODE,
         myrow.STD_NAME,
         
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         v_act_dimater,
         v_act_height,
         myrow.ACT_LEN_MIN,
         myrow.ACT_LEN_MAX,
         myrow.ACT_COUNT,
         myrow.ACT_WEIGHT,
         myrow.ACT_THEORY_WEIGHT,
         myrow.BELONG_CODE,
         myrow.BELONG_NAME,
         myrow.STORAGE_NO,
         
         myrow.MEMO,
         '1',
         ?,
         v_time,
         myrow.PRODUCT_FLAG,
         myrow.MAT_STATUS,
         v_time,
         myrow.ACT_LEN,
         ?,
         ?,
         myrow.JUDGE_STD_NAME,
         myrow.PLINE_CODE,
         myrow.PLINE_NAME,
         myrow.GRADECODE,
         myrow.GRADENAME,
         ?,
         v_time,
         myrow.PIPMEMO,
         myrow.MAT_ORIGIN_CODE,
         myrow.MAT_ORIGIN_NAME,
         myrow.SOURE_CODE,
         myrow.SOURE_NAME,
         ?,
         ?,
         myrow.SUPPLY_UNIT_CODE,
         myrow.SUPPLY_UNIT,
         myrow.IS_DEALER,
          myrow.LOT_NO,
        myrow. STOVE_NO,
         myrow.PROCESS_CDOE,
         myrow.PROCESS_DESC);
         
         INSERT INTO YDM_ZC_INLIST_XS
        (MANAGEMENT_NO,
         MANAGEMENT_NAME,
         INSTOCK_SQE,
         INSTOCK_DOC,
         INSTOCK_TYPE_CODE,
         INSTOCK_TYPE_NAME,
         MAT_NO,
         JUDGE_STOVE_NO,
         BATCH_NO,
         BATCH_GROUD_NO,
         PRODUCCODE,
         PRODUCNAME,
         STD_CODE,
         STD_NAME,
         
         STEELCODE,
         STEELNAME,
         STD_STYLE,
         STD_STYLE_DESC,
         SPEC_CODE,
         SPEC_NAME,
         MODEL_CODE,
         MODEL_DESC,
         ACT_DIMATER,
         ACT_HEIGHT,
         ACT_LEN_MIN,
         ACT_LEN_MAX,
         ACT_COUNT,
         ACT_WEIGHT,
         ACT_THEORY_WEIGHT,
         BELONG_CODE,
         BELONG_NAME,
         STORAGE_NO,
         
         MEMO,
         VALIDFLAG,
         CREATE_NAME,
         CREATE_TIME,
         PRODUCT_FLAG,
         MAT_STATUS,
         INSTOCK_TIME,
         ACT_LEN,
         DEPARTMENT_CODE,
         DEPARTMENT_DESC,
         JUDGE_STD_NAME,
         PLINE_CODE,
         PLINE_NAME,
         GRADECODE,
         GRADENAME,
         BAL_YEAR_MONTH,
         IN_TIME_F,
         PIPMEMO,
         MAT_ORIGIN_CODE,
         MAT_ORIGIN_NAME,
         SOURE_CODE,
         SOURE_NAME,
         MATERIAL_NO,
         MATERIAL_NAME,
         SUPPLY_UNIT_CODE,
         SUPPLY_UNIT,
         IS_DEALER,
          LOT_NO,
         STOVE_NO,
         PROCESS_CDOE,
         PROCESS_DESC)
      VALUES
        (?,
         ?,
         v_instock_sqe,
         v_Instock_doc,
         ?,
         ?,
         v_matNo,
         myrow.JUDGE_STOVE_NO,
         myrow.BATCH_NO,
         v_groupNo,
         ?,
         ?,
         myrow.STD_CODE,
         myrow.STD_NAME,
         
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?,
         v_act_dimater,
         v_act_height,
         myrow.ACT_LEN_MIN,
         myrow.ACT_LEN_MAX,
         myrow.ACT_COUNT,
         myrow.ACT_WEIGHT,
         myrow.ACT_THEORY_WEIGHT,
         myrow.BELONG_CODE,
         myrow.BELONG_NAME,
         myrow.STORAGE_NO,
         
         myrow.MEMO,
         '1',
         ?,
         v_time,
         myrow.PRODUCT_FLAG,
         myrow.MAT_STATUS,
         v_time,
         myrow.ACT_LEN,
         ?,
         ?,
         myrow.JUDGE_STD_NAME,
         myrow.PLINE_CODE,
         myrow.PLINE_NAME,
         myrow.GRADECODE,
         myrow.GRADENAME,
         ?,
         v_time,
         myrow.PIPMEMO,
         myrow.MAT_ORIGIN_CODE,
         myrow.MAT_ORIGIN_NAME,
         myrow.SOURE_CODE,
         myrow.SOURE_NAME,
         ?,
         ?,
         myrow.SUPPLY_UNIT_CODE,
         myrow.SUPPLY_UNIT,
         myrow.IS_DEALER,
          myrow.LOT_NO,
        myrow. STOVE_NO,
         myrow.PROCESS_CDOE,
         myrow.PROCESS_DESC);
         
      UPDATE QCM_ZG_JUDGE_CHANGE T
         SET T.AGREE_MEMO     = ?,
             T.AGREE_NAME     = ?,
             T.AGREE_TIME     = v_time,
             T.AGREE_FLAG     = '2',
             T.Batch_Groud_No = v_groupNo,
             T.JUDGE_STOVE_NO = myrow.JUDGE_STOVE_NO,
             T.BATCH_NO       = myrow.BATCH_NO
       WHERE T.JUDGE_ID = ?;
      v_matCount := v_matCount + 1;
      v_Icount   := v_Icount + 1;
    end loop;
end;
	]]>
	</query>
	
	<query id = "FrmExamineJudge.examineDataStaus" desc = "获取改判信息状态">
	SELECT T.AGREE_FLAG FROM QCM_ZG_JUDGE_CHANGE T WHERE T.JUDGE_ID = ?
	</query>
</queryMap>