<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="手工判定">
	<query id="FrmMchHandleJuge.doQueryApplyData" desc="查询申请判定信息">
		SELECT
		T.JUGDE_APPLY_CODE,
		T.JUDGE_STOVE_NO,
		T.BATCH_NO,
		T.BATCH_GROUD_NO,
		(SELECT P.PROCESS_DESC
		FROM COM_BASE_PROCESS P
		WHERE P.PROCESS_CODE =
		T.PROCESS_CODE
		AND P.VALIDFLAG = '1') PROCESS_CODE,
		T.PLINE_CODE,
		T.ACT_COUNT,
		T.ACT_WEIGHT,
		T.ACT_THEORY_WEIGHT,
		T.PRO_ORDER_ID,
		T.FACE_RESULT_CODE,
		T.SPEC_RESULT_CODE,
		T.CHEM_RESULT_CODE,
		T.PHY_RESULT_CODE,
		T.DETECT_RESULT_CODE,
		T.WPRESSURE_RESULT_CODE,
		T.PROCESS_RESULT_CODE,
		T.FACE_RESULT_PATH,
		T.SPEC_RESULT_PATH,
		T.CHEM_RESULT_PATH,
		T.PHY_RESULT_PATH,
		T.DETECT_RESULT_PATH,
		T.WPRESSURE_RESULT_PATH,
		T.PROCESS_RESULT_PATH,
		DECODE(T.VALIDFLAG,
		'00', '待判', '20', '已判', '正在处理') VALIDFLAG,
		T.APPLY_NAME,
		TO_CHAR(T.APPLY_TIME, 'YYYY-MM-DD HH24:MI:SS') APPLY_TIME,
		T.MEMO,
		T.QUALITY_GROUP,
		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.CRAF_NO,
		T.LOT_NO,
		T.PLINE_NAME,
		T.PRO_ORDER_NO,
		T.TARGET,
		T.PROCESS_STATUS,
		T.MAT_GOWHERE_CODE,
		T.MAT_GOWHERE_NAME,
		T.ACT_DIMATER,
		T.ACT_HEIGHT,
		T.ACT_LEN_MIN,
		T.ACT_LEN_MAX,
		T.JUDGE_RESULT_CODE,
		T.JUDGE_RESULT,
		TO_CHAR(T.JUDGE_RESULT_TIME, 'YYYY-MM-DD HH24:MI:SS')
		JUDGE_RESULT_TIME,
		T.JUDGE_MAKER,
		T.IF_SET_ZY_PLAN,
		T.TESTING_GRADE,
		T.TESTING_TYPE,
		T.TESTING_GRADE1,
		T.TESTING_TYPE1,
		T.DETECT_RESULT_CODE1,
		T.DETECT_RESULT_PATH1,
		T.ORD_LN_DLY_PK,
		T.APPLY_FLAG,
		T.BACK_JUGDE_MEMO,
		T.BELONG_CODE,
		T.BELONG_NAME,
		DECODE(T.INSTOCK_FLAG, '0', '未确认', '1', '已确认') INSTOCK_FLAG,
		S.NEXT_GX,
		T.ISENDGX
		FROM QCM_ZG_JUGDE_APPLY T
		LEFT JOIN (SELECT
		T1.NEXT_GX, T2.PRO_PLAN_ID
		FROM PLN_ORDER_JGX T1, PLN_ORDER_JGX_S T2
		WHERE T1.ORD_LN_DLY_PK = T2.ORD_LN_DLY_PK
		and t1.PLN_DIVIDE_ID =
		t2.PLN_DIVIDE_ID) S
		ON T.PRO_ORDER_ID = S.PRO_PLAN_ID
		WHERE 1 = 1
	</query>
	<query id="FrmMchHandleJuge.SelectApplyData" desc="查询申判信息是否已判">
		SELECT
		T.VALIDFLAG
		FROM QCM_ZG_JUGDE_APPLY T
		WHERE T.JUGDE_APPLY_CODE =
		'#JUGDE_APPLY_CODE#'
		AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
		AND
		T.BATCH_NO = '#BATCH_NO#'
		AND T.BATCH_GROUD_NO = '#BATCH_GROUD_NO#'
		AND
		T.QUALITY_GROUP = '#QUALITY_GROUP#'
		AND T.MAT_GOWHERE_CODE =
		'#MAT_GOWHERE_CODE#'
	</query>
	<query id="FrmMchHandleJuge.SelectComfirmApplyData" desc="查询判定信息是否已确认">
		SELECT
		T.INSTOCK_FLAG
		FROM QCM_ZG_JUGDE_APPLY T
		WHERE T.JUGDE_APPLY_CODE =
		'#JUGDE_APPLY_CODE#'
		AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
		AND
		T.BATCH_NO = '#BATCH_NO#'
		AND T.BATCH_GROUD_NO = '#BATCH_GROUD_NO#'
		AND
		T.QUALITY_GROUP = '#QUALITY_GROUP#'
		AND T.MAT_GOWHERE_CODE =
		'#MAT_GOWHERE_CODE#'
	</query>
	<query id="FrmMchHandleJuge.doHandleApply" desc="手工判定">
		DECLARE
		BEGIN
		FOR
		MYROW IN (SELECT *
		FROM MAT_ZC_M T
		WHERE T.JUDGE_STOVE_NO = ?
		AND
		T.BATCH_NO = ?
		AND T.BATCH_GROUD_NO = ?
		AND T.PRC_QUALITY_GROUP_ZG = ?
		AND T.MAT_GOWHERE_CODE = ?
		AND T.PRC_JUGDE_APPLY_CODE = ?
		ORDER BY
		T.MAT_NO ASC) LOOP
		UPDATE MAT_ZC_M T
		SET T.PRC_JUDGE_RESULT_CODE = ?,
		T.PRC_JUDGE_RESULT_TIME = SYSDATE,
		T.MAT_STATUS = ?
		WHERE T.MAT_NO =
		MYROW.MAT_NO ;
		END LOOP;
		UPDATE QCM_ZG_JUGDE_APPLY T
		SET T.VALIDFLAG =
		'20',
		T.JUDGE_RESULT_CODE = ?,
		T.JUDGE_RESULT = ?,
		T.JUDGE_RESULT_TIME =
		SYSDATE,
		T.JUDGE_MAKER = ?
		WHERE T.JUDGE_STOVE_NO = ?
		AND T.BATCH_NO = ?
		AND T.BATCH_GROUD_NO = ?
		AND T.QUALITY_GROUP = ?
		AND T.MAT_GOWHERE_CODE
		= ?
		AND T.JUGDE_APPLY_CODE = ?;
		END;
	</query>
	<query id="FrmMchHandleJuge.doCancelHandleApply" desc="撤销判定">
		DECLARE
		BEGIN
		FOR MYROW IN (SELECT *
		FROM MAT_ZC_M T
		WHERE T.JUDGE_STOVE_NO = ?
		AND T.BATCH_NO = ?
		AND T.BATCH_GROUD_NO = ?
		AND T.PRC_QUALITY_GROUP_ZG =
		?
		AND T.MAT_GOWHERE_CODE = ?
		AND T.PRC_JUGDE_APPLY_CODE = ?
		ORDER BY
		T.MAT_NO ASC) LOOP
		UPDATE MAT_ZC_M T
		SET T.PRC_JUDGE_RESULT_CODE = '',
		T.PRC_JUDGE_RESULT_TIME = '',
		T.MAT_STATUS = ?
		WHERE T.MAT_NO =
		MYROW.MAT_NO ;
		END LOOP;
		UPDATE QCM_ZG_JUGDE_APPLY T
		SET T.VALIDFLAG =
		'00',
		T.JUDGE_RESULT_CODE = '',
		T.JUDGE_RESULT = '',
		T.JUDGE_RESULT_TIME
		= '',
		T.JUDGE_MAKER = ''
		WHERE T.JUDGE_STOVE_NO = ?
		AND T.BATCH_NO = ?
		AND T.BATCH_GROUD_NO = ?
		AND T.QUALITY_GROUP = ?
		AND T.MAT_GOWHERE_CODE
		= ?
		AND T.JUGDE_APPLY_CODE = ?;
		END;
	</query>
	<query id="FrmMchHandleJuge.doComfirm" desc="确认缴库">
		DECLARE
		V_BELONG_CODE
		MAT_ZC_M.BELONG_CODE%TYPE := NULL;
		V_BELONG_NAME
		MAT_ZC_M.BELONG_NAME%TYPE := NULL;
		v_inListDoc
		YDM_ZC_INLIST.INSTOCK_DOC%TYPE := NULL;
		v_inListDocSeq
		YDM_ZC_INLIST.INSTOCK_SQE%TYPE := NULL;
		vCount NUMBER := 1;
		v_time
		mat_zc_m.judge_result_time%type := SYSDATE;
		v_date
		ydm_zc_outlist.bal_year_month%type := TO_CHAR(SYSDATE,
		'YYYYMM');
		BEGIN
		SELECT 'IA'||'ZZB'|| TO_CHAR(sysdate, 'YYMMDD') ||
		LPAD(NVL(MAX(SUBSTR(T.INSTOCK_DOC, LENGTH(T.INSTOCK_DOC) - 4)), 0) +
		1,
		5,
		0) INSTOCK_DOC INTO v_inListDoc
		FROM YDM_ZC_INLIST T
		WHERE
		TRUNC(T.CREATE_TIME) = TRUNC(SYSDATE)
		AND T.INSTOCK_TYPE_CODE =
		'800701'
		AND T.BELONG_CODE = '002001001';

		FOR MYROW IN (SELECT *
		FROM
		MAT_ZC_M T
		WHERE T.JUDGE_STOVE_NO = ?
		AND T.BATCH_NO = ?
		AND
		T.BATCH_GROUD_NO = ?
		AND T.QUALITY_GROUP_ZG = ?
		AND T.MAT_GOWHERE_CODE =
		?
		AND T.JUGDE_APPLY_CODE = ?
		AND T.BELONG_CODE = '002001001'
		ORDER BY
		T.MAT_NO ASC) LOOP
		IF (MYROW.PLINE_CODE = 'C008') THEN
		V_BELONG_CODE :=
		'002001016003';
		V_BELONG_NAME := '250机组';
		ELSIF (MYROW.PLINE_CODE =
		'C009') THEN
		V_BELONG_CODE := '002001016002';
		V_BELONG_NAME := '258机组';
		ELSIF (MYROW.PLINE_CODE = 'C010') THEN
		V_BELONG_CODE := '002001017003';
		V_BELONG_NAME := '168机组';
		ELSIF (MYROW.PLINE_CODE = 'C017') THEN
		V_BELONG_CODE := '002001018003';
		V_BELONG_NAME := '460机组';
		END IF;
		v_inListDocSeq := v_inListDoc || LPAD(vCount, 4, 0);
		INSERT INTO
		YDM_ZC_OUTLIST
		(OUTSTOCK_SQE,
		OUTSTOCK_DOC,
		OUTSTOCK_TYPE_CODE,
		OUTSTOCK_TYPE_NAME,
		ICCAR_NO,
		VEHICLE_NO,
		MAT_NO,
		LOT_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,
		STORAGE_ATTR,
		STORAGE_ATTR_NAME,
		STORAGE_TYPE_NO,
		STORAGE_TYPE_NAME,
		management_no,
		management_name,
		TAR_STORAGE_NO,
		TAR_LOCATION_NO,
		INSTOCK_TIME,
		OUTSTOCK_TIME,
		MEMO,
		CREATE_NAME,
		CREATE_TIME,
		PRODUCT_FLAG,
		MAT_STATUS,
		JUDGE_STD_NAME,
		JUDGE_STD_CODE,
		PONDER_GROSS_WT,
		BAL_YEAR_MONTH,
		TAR_REC_FLAG,
		ORDER_NO,
		ORDER_SEQ,
		DELIVERY_NO,
		ORD_PK,
		ORD_LN_PK,
		ORD_LN_DLY_PK)
		VALUES
		(v_inListDocSeq,
		v_inListDoc,
		'800809',
		'产权出库',
		'',
		'',
		MYROW.MAT_NO,
		MYROW.LOT_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.PRO_ORDER_NO,
		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,
		V_BELONG_CODE,
		V_BELONG_NAME,
		MYROW.MAT_GOWHERE_CODE,
		MYROW.MAT_GOWHERE_CODE||'10101',
		'',
		'',
		'',
		'',
		(SELECT F.MANAGEMENT_NO FROM YDM_BS_STORAGE F WHERE F.STORAGE_NO =
		MYROW.MAT_GOWHERE_CODE),
		(SELECT F.MANAGEMENT_NAME FROM YDM_BS_STORAGE
		F WHERE F.STORAGE_NO =
		MYROW.MAT_GOWHERE_CODE),
		'',
		'',
		MYROW.INSTOCK_TIME,
		v_time,
		MYROW.MEMO,
		'',
		v_time,
		MYROW.PRODUCT_FLAG,
		MYROW.MAT_STATUS,
		MYROW.JUDGE_STD_NAME,
		MYROW.JUDGE_STD_CODE,
		MYROW.PONDER_GROSS_WT,
		v_date,
		'1',
		MYROW.ORDER_NO,
		MYROW.ORDER_SEQ,
		MYROW.ORDER_SEQ_NO,
		MYROW.ORD_PK,
		MYROW.ORD_LN_PK,
		MYROW.ORD_LN_DLY_PK);
		
		INSERT INTO
		YDM_ZC_OUTLIST_XS
		(OUTSTOCK_SQE,
		OUTSTOCK_DOC,
		OUTSTOCK_TYPE_CODE,
		OUTSTOCK_TYPE_NAME,
		ICCAR_NO,
		VEHICLE_NO,
		MAT_NO,
		LOT_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,
		STORAGE_ATTR,
		STORAGE_ATTR_NAME,
		STORAGE_TYPE_NO,
		STORAGE_TYPE_NAME,
		management_no,
		management_name,
		TAR_STORAGE_NO,
		TAR_LOCATION_NO,
		INSTOCK_TIME,
		OUTSTOCK_TIME,
		MEMO,
		CREATE_NAME,
		CREATE_TIME,
		PRODUCT_FLAG,
		MAT_STATUS,
		JUDGE_STD_NAME,
		JUDGE_STD_CODE,
		PONDER_GROSS_WT,
		BAL_YEAR_MONTH,
		TAR_REC_FLAG,
		ORDER_NO,
		ORDER_SEQ,
		DELIVERY_NO,
		ORD_PK,
		ORD_LN_PK,
		ORD_LN_DLY_PK)
		VALUES
		(v_inListDocSeq,
		v_inListDoc,
		'800809',
		'产权出库',
		'',
		'',
		MYROW.MAT_NO,
		MYROW.LOT_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.PRO_ORDER_NO,
		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,
		V_BELONG_CODE,
		V_BELONG_NAME,
		MYROW.MAT_GOWHERE_CODE,
		MYROW.MAT_GOWHERE_CODE||'10101',
		'',
		'',
		'',
		'',
		(SELECT F.MANAGEMENT_NO FROM YDM_BS_STORAGE F WHERE F.STORAGE_NO =
		MYROW.MAT_GOWHERE_CODE),
		(SELECT F.MANAGEMENT_NAME FROM YDM_BS_STORAGE
		F WHERE F.STORAGE_NO =
		MYROW.MAT_GOWHERE_CODE),
		'',
		'',
		MYROW.INSTOCK_TIME,
		v_time,
		MYROW.MEMO,
		'',
		v_time,
		MYROW.PRODUCT_FLAG,
		MYROW.MAT_STATUS,
		MYROW.JUDGE_STD_NAME,
		MYROW.JUDGE_STD_CODE,
		MYROW.PONDER_GROSS_WT,
		v_date,
		'1',
		MYROW.ORDER_NO,
		MYROW.ORDER_SEQ,
		MYROW.ORDER_SEQ_NO,
		MYROW.ORD_PK,
		MYROW.ORD_LN_PK,
		MYROW.ORD_LN_DLY_PK);
		
		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,

		STORAGE_ATTR,
		STORAGE_ATTR_NAME,
		STORAGE_TYPE_NO,
		STORAGE_TYPE_NAME,
		MANAGEMENT_NO,
		MANAGEMENT_NAME,
		CREATE_NAME,
		INSTOCK_TIME,
		CREATE_TIME,
		DEPARTMENT_CODE,
		DEPARTMENT_DESC,
		ORD_PK,
		ORD_LN_PK,
		ORD_LN_DLY_PK,
		ORDER_NO,
		ORDER_SEQ,
		DELIVERY_NO,
		PRODUCT_FLAG,
		MAT_STATUS,
		IN_TIME_F,
		AFFIRM_LOG,
		FINISHPRO_MOLD,
		IN_MOLD,
		QCM_STAUS)
		VALUES
		(v_inListDocSeq,
		v_inListDoc,
		'800701',
		'产出入库',
		'',
		MYROW.MAT_NO,
		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.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.PRO_ORDER_NO,
		MYROW.PLINE_CODE,
		MYROW.PLINE_NAME,
		MYROW.ACT_DIMATER,
		MYROW.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.MAT_GOWHERE_CODE,
		MYROW.MAT_GOWHERE_CODE ||
		'10101',
		'',
		'',
		'',
		'',
		(SELECT F.MANAGEMENT_NO FROM YDM_BS_STORAGE F
		WHERE F.STORAGE_NO =
		MYROW.MAT_GOWHERE_CODE),
		(SELECT F.MANAGEMENT_NAME
		FROM YDM_BS_STORAGE F WHERE F.STORAGE_NO =
		MYROW.MAT_GOWHERE_CODE),
		'',
		v_time,
		v_time,
		(SELECT F.DEPARTMENT_CODE FROM YDM_BS_STORAGE F WHERE
		F.STORAGE_NO =
		MYROW.MAT_GOWHERE_CODE),
		(SELECT F.DEPARTMENT_DESC FROM
		YDM_BS_STORAGE F WHERE F.STORAGE_NO =
		MYROW.MAT_GOWHERE_CODE),
		MYROW.ORD_PK,
		MYROW.ORD_LN_PK,
		MYROW.ORD_LN_DLY_PK,
		MYROW.ORDER_NO,
		MYROW.ORDER_SEQ,
		MYROW.ORDER_SEQ_NO,
		MYROW.PRODUCT_FLAG,
		MYROW.MAT_STATUS,
		v_time,
		'1',
		MYROW.FINISHPRO_MOLD,
		MYROW.IN_MOLD,
		MYROW.QCM_STAUS);
		
		
		INSERT INTO YDM_ZC_INLIST_XS
		(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,

		STORAGE_ATTR,
		STORAGE_ATTR_NAME,
		STORAGE_TYPE_NO,
		STORAGE_TYPE_NAME,
		MANAGEMENT_NO,
		MANAGEMENT_NAME,
		CREATE_NAME,
		INSTOCK_TIME,
		CREATE_TIME,
		DEPARTMENT_CODE,
		DEPARTMENT_DESC,
		ORD_PK,
		ORD_LN_PK,
		ORD_LN_DLY_PK,
		ORDER_NO,
		ORDER_SEQ,
		DELIVERY_NO,
		PRODUCT_FLAG,
		MAT_STATUS,
		IN_TIME_F,
		AFFIRM_LOG,
		FINISHPRO_MOLD,
		IN_MOLD,
		QCM_STAUS)
		VALUES
		(v_inListDocSeq,
		v_inListDoc,
		'800701',
		'产出入库',
		'',
		MYROW.MAT_NO,
		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.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.PRO_ORDER_NO,
		MYROW.PLINE_CODE,
		MYROW.PLINE_NAME,
		MYROW.ACT_DIMATER,
		MYROW.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.MAT_GOWHERE_CODE,
		MYROW.MAT_GOWHERE_CODE ||
		'10101',
		'',
		'',
		'',
		'',
		(SELECT F.MANAGEMENT_NO FROM YDM_BS_STORAGE F
		WHERE F.STORAGE_NO =
		MYROW.MAT_GOWHERE_CODE),
		(SELECT F.MANAGEMENT_NAME
		FROM YDM_BS_STORAGE F WHERE F.STORAGE_NO =
		MYROW.MAT_GOWHERE_CODE),
		'',
		v_time,
		v_time,
		(SELECT F.DEPARTMENT_CODE FROM YDM_BS_STORAGE F WHERE
		F.STORAGE_NO =
		MYROW.MAT_GOWHERE_CODE),
		(SELECT F.DEPARTMENT_DESC FROM
		YDM_BS_STORAGE F WHERE F.STORAGE_NO =
		MYROW.MAT_GOWHERE_CODE),
		MYROW.ORD_PK,
		MYROW.ORD_LN_PK,
		MYROW.ORD_LN_DLY_PK,
		MYROW.ORDER_NO,
		MYROW.ORDER_SEQ,
		MYROW.ORDER_SEQ_NO,
		MYROW.PRODUCT_FLAG,
		MYROW.MAT_STATUS,
		v_time,
		'1',
		MYROW.FINISHPRO_MOLD,
		MYROW.IN_MOLD,
		MYROW.QCM_STAUS);
		
		vCount := vCount + 1;
		END LOOP;
		UPDATE
		QCM_ZG_JUGDE_APPLY T
		SET T.INSTOCK_FLAG = '1'
		WHERE T.JUDGE_STOVE_NO = ?
		AND T.BATCH_NO = ?
		AND T.BATCH_GROUD_NO = ?
		AND T.QUALITY_GROUP = ?
		AND
		T.MAT_GOWHERE_CODE = ?
		AND T.JUGDE_APPLY_CODE = ?;
		END;
	</query>
	<query id="FrmMchHandleJuge.doCancelComfirm" desc="取消确认">
		DECLARE
		V_BELONG_CODE MAT_ZC_M.BELONG_CODE%TYPE := NULL;
		V_BELONG_NAME
		MAT_ZC_M.BELONG_NAME%TYPE := NULL;
		BEGIN
		FOR MYROW IN (SELECT *
		FROM
		MAT_ZC_M T
		WHERE T.JUDGE_STOVE_NO = ?
		AND T.BATCH_NO = ?
		AND
		T.BATCH_GROUD_NO = ?
		AND T.QUALITY_GROUP_ZG = ?
		AND T.MAT_GOWHERE_CODE =
		?
		AND T.JUGDE_APPLY_CODE = ?
		ORDER BY T.MAT_NO ASC) LOOP
		DELETE FROM
		YDM_ZC_OUTLIST T WHERE T.MAT_NO = MYROW.MAT_NO AND
		T.OUTSTOCK_TYPE_CODE = '800809';
		DELETE FROM
		YDM_ZC_OUTLIST_XS T WHERE T.MAT_NO = MYROW.MAT_NO AND
		T.OUTSTOCK_TYPE_CODE = '800809';
		DELETE FROM YDM_ZC_INLIST T WHERE
		T.MAT_NO = MYROW.MAT_NO AND T.BELONG_CODE
		= '002001001';
		DELETE FROM YDM_ZC_INLIST_XS T WHERE
		T.MAT_NO = MYROW.MAT_NO AND T.BELONG_CODE
		= '002001001';
		END LOOP;
		UPDATE QCM_ZG_JUGDE_APPLY T
		SET T.Instock_Flag = '0'
		WHERE
		T.JUDGE_STOVE_NO = ?
		AND T.BATCH_NO = ?
		AND T.BATCH_GROUD_NO = ?
		AND
		T.QUALITY_GROUP = ?
		AND T.MAT_GOWHERE_CODE = ?
		AND T.JUGDE_APPLY_CODE =
		?;
		END;
	</query>
	<query id="FrmMchHandleJuge.SelectDBKStovePlan" desc="查询是否已生成炉计划">
		SELECT
		COUNT(1) ACOUNT
		FROM PLN_ZY_JGX_M T
		WHERE T.HEATNO_LAST =
		'#JUDGE_STOVE_NO#'
		AND T.LAST_BATCH_NO = '#BATCH_NO#'
		AND
		T.BATCH_GROUD_NO = '#BATCH_GROUD_NO#'
	</query>
</queryMap>