<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="测量点">
	<query id="CldDataTask.QueryData" desc="查询">
		<![CDATA[
			SELECT
        T.FEED_HEAT_NO JUDGE_STOVE_NO,
        T.STEELNAME STEEL_NAME,
        T.OUTDIAMETER || 'x' || T.WALLTHICK SPEC_NAME,
        T.OUTDIAMETER,
        T.WALLTHICK,
        T.ORDER_NO || '/'|| T.ORDER_SEQ ORDER_NO,
        T.PROD_STANDARD,
        T.OUTPUT_STANDARD,
        (
        SELECT
          H.PROTCL_NO
        FROM
          SLM_ORDER_HEAD H
          LEFT JOIN SLM_ORDER_LINE_DELIVERY D ON H.ORD_PK = D.ORD_PK
          AND H.VALIDFLAG = '1'
        WHERE
          D.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
          AND ROWNUM = 1
        ) PROTCL_NO,
        (
        SELECT
          B.PRESSURE
        FROM
          CRAFT_ORD_DESIGN_MSC A
          LEFT JOIN CRAFT_ORD_DESIGN_STD_WIC B ON A.DESGIN_KEY = B.DESGIN_KEY
        WHERE
          T.ORD_LN_DLY_PK LIKE A.ORD_LN_PK || '%'
          AND A.VALIDFLAG = '1'
          AND ROWNUM = 1
        ) FORMULA,
        (
        SELECT
          B.ITEM_NAME_W
        FROM
          CRAFT_ORD_DESIGN_MSC A
          LEFT JOIN CRAFT_ORD_DESIGN_STD_PIC B ON A.DESGIN_KEY = B.DESGIN_KEY
        WHERE
          T.ORD_LN_DLY_PK LIKE A.ORD_LN_PK || '%'
          AND A.VALIDFLAG = '1'
          AND B.PHY_CODE_MAX = 'R0002'
          AND ROWNUM = 1
        ) ITEM_NAME_W,
        T.LEN_ROLL_MIN,T.LEN_ROLL_MAX,T.PRODUCNAME,T1.FINISH_USER 
      FROM
        PLN_ZY_ZG_M T,(select distinct FINISH_USER,id from MIL_PLAN) T1
      WHERE
       T.HEAT_PLAN_NO = T1.ID
        and T.SYNC_FLAG_TH = '0'
        AND PLANSTATUS IN( '10','20','30','40')
        AND t.PLINE_CODE = 'C072'
		]]>
	</query>

	<query id="CldDataTask.updateData" desc="修改同步">
		<![CDATA[
			UPDATE PLN_ZY_ZG_M SET SYNC_FLAG_TH = '1'
			WHERE SYNC_FLAG_TH = '0'
				AND PLANSTATUS IN( '10','20','30','40')
				AND PLINE_CODE = 'C072'
				AND FEED_HEAT_NO = '#JUDGE_STOVE_NO#'
		]]>
	</query>


	<query id="CldDataTask.insertData" desc="新增同步">
		<![CDATA[
			INSERT INTO cxzysj ( JUDGE_STOVE_NO, STEEL_NAME, SPEC_NAME, OUTDIAMETER, WALLTHICK, ORDER_NO, PROTCL_NO, FORMULA, ITEM_NAME_W,
				PROD_STANDARD,OUTPUT_STANDARD,LEN_ROLL_MIN,LEN_ROLL_MAX,PRODUCNAME,FINISH_USER)
			VALUES
				( '#JUDGE_STOVE_NO#', '#STEEL_NAME#', '#SPEC_NAME#', '#OUTDIAMETER#', '#WALLTHICK#', '#ORDER_NO#', '#PROTCL_NO#', '#FORMULA#', '#ITEM_NAME_W#',
				 '#PROD_STANDARD#','#OUTPUT_STANDARD#','#LEN_ROLL_MIN#','#LEN_ROLL_MAX#','#PRODUCNAME#','#FINISH_USER#')
		]]>
	</query>
</queryMap>
