<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="同步检化验成品成分到质量成分">
	<query id="AuditMeltingDataTask.getPlnSteelforfurnace" desc="获取炼钢炉次计划表">
		<![CDATA[
SELECT MAX(A.FURNACENO) FURNACENO, A.STOVE_NO, MAX(A.CRAFT_NO) CRAFT_NO
  FROM PLN_STEELFORFURNACE A
 WHERE A.STOVE_NO = {0}
 GROUP BY A.STOVE_NO
		]]>
	</query>
	
	<query id="AuditMeltingDataTask.getCraftLg2Cic" desc="获取炼钢二级工艺成分">
		<![CDATA[
SELECT B.*, '1' ISJUDGE
  FROM CRAFT_LG2_M A, CRAFT_LG2_CIC B
 WHERE A.CRAFT_NO = {0}
   AND A.VALIDFLAG = '10'
   AND B.CIC_GID = A.CIC_GID
		]]>
	</query>
	
	<query id="AuditMeltingDataTask.getJhyElements" desc="检化验成分数据">
		<![CDATA[
SELECT *
  FROM (SELECT A.ASSAYNO,
               A.STOVE_NO,
               A.JUDGE_STOVE_NO,
               A.BATCH_NO,
               A.ASSAYTYPE,
               A.FLAG,
               A.C,
               A.SI,
               A.MN,
               A.P,
               A.S,
               A.NI,
               A.CR,
               A.MO,
               A.CU,
               A.AL,
               A.CA,
               A.V,
               A.NB,
               A.TI,
               A.B,
               A.PB,
               A.SN,
               A.ASN,
               A.SB,
               A.BI,
               A.O,
               A.N,
               A.H,
               A.ZR,
               A.W,
               A.ZN,
               A.ALS,
               A.ALT,
               A.SE,
               A.SAMPLE_ID,
               A.XH,
               A.MACHINE,
               A.CREATE_NAME,
               A.CREATE_TIME,
               A.UPDATE_NAME,
               A.UPDATE_TIME,
               A.DELETE_NAME,
               A.DELETE_TIME,
               A.VALIDFLAG,
               A.MEMO,
               A.SAMPLE_NO,
               A.PLINE_CODE
          FROM QCM_JHY_ELEMENTS A, PLN_STEELFORFURNACE B
         WHERE A.SAMPLE_NO LIKE '601__'
           AND A.VALIDFLAG = '1'
           AND A.ASSAYTYPE = 'A'
           AND A.JUDGE_FLAG = '00'
           AND B.STOVE_NO = A.STOVE_NO
        UNION
        SELECT A.ASSAYNO,
               A.STOVE_NO,
               A.JUDGE_STOVE_NO,
               A.BATCH_NO,
               A.ASSAYTYPE,
               A.FLAG,
               A.C,
               A.SI,
               A.MN,
               A.P,
               A.S,
               A.NI,
               A.CR,
               A.MO,
               A.CU,
               A.AL,
               A.CA,
               A.V,
               A.NB,
               A.TI,
               A.B,
               A.PB,
               A.SN,
               A.ASN,
               A.SB,
               A.BI,
               A.O,
               A.N,
               A.H,
               A.ZR,
               A.W,
               A.ZN,
               A.ALS,
               A.ALT,
               A.SE,
               A.SAMPLE_ID,
               A.XH,
               A.MACHINE,
               A.CREATE_NAME,
               A.CREATE_TIME,
               A.UPDATE_NAME,
               A.UPDATE_TIME,
               A.DELETE_NAME,
               A.DELETE_TIME,
               A.VALIDFLAG,
               A.MEMO,
               A.SAMPLE_NO,
               A.PLINE_CODE
          FROM QCM_JHY_ELEMENTS A
          LEFT JOIN QCM_JHY_ELEMENTS C
            ON C.STOVE_NO = A.STOVE_NO
           AND C.STOVE_NO IS NOT NULL
           AND A.STOVE_NO IS NOT NULL
           AND C.SAMPLE_NO LIKE A.SAMPLE_NO
           AND C.SAMPLE_NO IS NOT NULL
           AND A.SAMPLE_NO IS NOT NULL
           AND C.SAMPLE_NO LIKE '601__'
           AND C.VALIDFLAG = '1'
           AND C.ASSAYTYPE = 'A'
           AND C.JUDGE_FLAG = '00', PLN_STEELFORFURNACE B
         WHERE A.SAMPLE_NO = '601'
           AND A.VALIDFLAG = '1'
           AND A.ASSAYTYPE = 'A'
           AND A.JUDGE_FLAG = '00'
           AND C.STOVE_NO IS NULL
           AND B.STOVE_NO = A.STOVE_NO
         ORDER BY STOVE_NO)
 WHERE ROWNUM <= 50
		]]>
	</query>
	
	<query id="AuditMeltingDataTask.updatePlnSteelforfurnace" desc="更新炼钢炉次计划表">
		<![CDATA[
UPDATE PLN_STEELFORFURNACE T SET T.JUDGE_FLAG = {0} WHERE T.STOVE_NO = {1}
		]]>
	</query>
	
	<query id="AuditMeltingDataTask.updateJhyElements" desc="更新成分实绩表">
		<![CDATA[
UPDATE QCM_JHY_ELEMENTS T SET T.JUDGE_FLAG = {0} WHERE T.STOVE_NO = {1}
AND T.ASSAYTYPE = 'A' AND T.SAMPLE_NO LIKE '601%'
		]]>
	</query>
</queryMap>