<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="轧管、热处理、管加工等钢管生产物料主表">
	<query id="MatZcMDAL.queryStoveNoTable" desc="查询炉号数据">
		<![CDATA[
SELECT STOVE_NO,
       JUDGE_STOVE_NO,
       LOT_NO,
       SUM(ACT_COUNT) ACT_COUNT,
       SUM(ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT,
       STEELCODE,
       STEELNAME,
       GRADECODE,
       GRADENAME,
       PRO_ORDER_ID,
       PRO_ORDER_ID1,
       PLINE_CODE,
       PLINE_NAME,
       MAX(ACT_DIMATER),
       MAX(ACT_HEIGHT),
       JUGDE_APPLY_CODE,
       A.BASENAME CHEM_RESULT_DESC,
       B.BASENAME PHY_RESULT_DESC,
       JUDGE_STD_NAME,
       JUDGE_STD_CODE,
       PLN_STEELCODE,
       PLN_STEELNAME,
       DECODE(A.BASENAME, NULL, '未判定', '已判定') CHEM_JUDGE_STATE,
       DECODE(B.BASENAME, NULL, '未判定', '已判定') PHY_JUDGE_STATE
  FROM MAT_ZC_M T
  LEFT JOIN COM_BASE_INFO A
    ON A.BASECODE = T.CHEM_RESULT_CODE
  LEFT JOIN COM_BASE_INFO B
    ON B.BASECODE = T.PHY_RESULT_CODE
 WHERE T.JUGDE_APPLY_FLAG = '1'
		]]>
	</query>
	
	<query id="MatZcMDAL.queryMatNoTable" desc="查询材料号数据 ">
		<![CDATA[
SELECT T.JUDGE_STOVE_NO,
       T.MAT_NO,
       T.STEELCODE,
       T.STEELNAME,
       T.GRADECODE,
       T.GRADENAME,
       T.PRO_ORDER_NO,
       T.ACT_DIMATER,
       T.ACT_HEIGHT,
       T.ACT_LEN,
       T.ACT_THEORY_WEIGHT,
       A.BASENAME CHEM_RESULT_CODE,
       T.PLN_GRADECODE,
       T.PLN_GRADENAME,
       DECODE(CHEM_RESULT_CODE, NULL, '未判定', '已判定') JUDGE_STATE
  FROM MAT_ZC_M T
  LEFT JOIN COM_BASE_INFO A
  ON A.BASECODE = T.CHEM_RESULT_CODE
 WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
		]]>
	</query>
	
	<query id="MatZcMDAL.updateChemJudgeResult" desc="修改成分判定结果信息 ">
		<![CDATA[
UPDATE MAT_ZC_M T
   SET T.JUGDE_SCAN_TIME  = sysdate,
       T.CHEM_RESULT_CODE = {0},
       T.CHEM_RESULT_TIME = sysdate,
       T.CHEM_MAKER       = {1}
 WHERE T.JUDGE_STOVE_NO = {2}
		]]>
	</query>
	
	<query id="MatZcMDAL.updateChemJudgeResult2" desc="修改成分判定结果信息 ">
		<![CDATA[
UPDATE MAT_ZC_M T
   SET T.JUGDE_SCAN_TIME  = sysdate,
       T.CHEM_RESULT_CODE = '#CHEM_RESULT_CODE#',
       T.CHEM_RESULT_TIME = sysdate,
       T.CHEM_MAKER       = '#CHEM_MAKER#',
       T.CHEM_PROCHECK_NO = '#CHEM_PROCHECK_NO#',
       T.PRO_ORDER_ID = '#PRO_ORDER_ID#',
       T.PRO_ORDER_ID1 = '#PRO_ORDER_ID1#'
 WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
		]]>
	</query>
	
	<query id="MatZcMDAL.updatePhyJudgeResult" desc="修改理化判定结果信息 ">
		<![CDATA[
UPDATE MAT_ZC_M T
   SET T.JUGDE_SCAN_TIME  = sysdate,
       T.PHY_RESULT_CODE = {0},
       T.PHY_RESULT_TIME = sysdate,
       T.PHY_MAKER       = {1}
 WHERE T.JUDGE_STOVE_NO = {2}
		]]>
	</query>
	
	<query id="MatZcMDAL.updatePhyJudgeResult2" desc="修改理化判定结果信息 ">
		<![CDATA[
UPDATE MAT_ZC_M T
   SET T.JUGDE_SCAN_TIME  = sysdate,
       T.PHY_RESULT_CODE = '#PHY_RESULT_CODE#',
       T.PHY_RESULT_TIME = sysdate,
       T.PHY_MAKER       = '#PHY_MAKER#',
       T.PRO_ORDER_ID = '#PRO_ORDER_ID#',
       T.PRO_ORDER_ID1 = '#PRO_ORDER_ID1#'
 WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
		]]>
	</query>
	
	<query id="MatZcMDAL.getMatZcMByJudgeStoveNo" desc="通过判定炉号查询信息 ">
		<![CDATA[
SELECT * FROM MAT_ZC_M T WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#' AND ROWNUM <= 1
		]]>
	</query>
	
	<query id="MatZcMDAL.monomer" desc="物料表脱单 ">
		<![CDATA[
UPDATE MAT_ZC_M T
   SET T.PRO_ORDER_NO = NULL,
       T.PRO_ORDER_ID = NULL,
       T.PRO_ORDER_NO1 = T.PRO_ORDER_NO,
       T.PRO_ORDER_ID1 = T.PRO_ORDER_ID
 WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
		]]>
	</query>
</queryMap>