<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="PORT_MIL_BATCH_SAMPLE_RESULT （生成工具：代码生成工具4.0   访问地址：http://172.16.2.128/tool/）">
    <query id="PortMilBatchSampleResultDAL.Query" desc="查询">
        <![CDATA[
SELECT T.JUDGE_STOVE_NO,
       SUM(T.ACT_COUNT) ACT_COUNT,
       MAX(C.STEELNAME) STEELNAME,
       MAX(B.OUTDIAMETER) OUTDIAMETER,
       MAX(B.WALLTHICK) WALLTHICK,
       MAX(D.BASENAME) CHEM_RESULT_DESC,
       MAX(E.BASENAME) PHY_RESULT_DESC,
       SUM(T.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT,
       MAX(B.PRO_ORDER_NO) PRO_ORDER_NO,
       MAX(B.PRO_PLAN_ID) PRO_PLAN_ID,
       MAX(A.PLINE_NAME) PLINE_NAME,
       MAX(T.PLAN_ID) PLAN_ID,
       DECODE(MAX(T.CHEM_RESULT_CODE), NULL, '未判', '已判') CHEM_JUDGE_STATE,
       DECODE(MAX(T.PHY_RESULT_CODE), NULL, '未判', '已判') PHY_JUDGE_STATE
  FROM PORT_MIL_BATCH_SAMPLE_RESULT T
  LEFT JOIN COM_BASE_INFO D
    ON D.BASECODE = T.CHEM_RESULT_CODE
  LEFT JOIN COM_BASE_INFO E
    ON E.BASECODE = T.PHY_RESULT_CODE, PLN_ZY_DBK_M A, PLN_ORDER_DBK_S B,
 PLN_SALEORD C
 WHERE T.PLAN_ID = A.HEAT_PLAN_NO
   AND A.PRO_PLAN_ID = B.PRO_PLAN_ID
   AND A.GX_PLAN_NO = B.GX_PLAN_NO
   AND C.ORD_LN_DLY_PK = B.ORD_LN_DLY_PK
        ]]>
    </query>
    <query id="PortMilBatchSampleResultDAL.QueryByPk" desc="通过主键查询">
        <![CDATA[
 SELECT 
       T.PLAN_ID,
       T.LOT_NO,
       T.STOVE_NO,
       T.JUDGE_STOVE_NO,
       T.GROUP_NO,
       T.PLINE_CODE,
       T.BATCH_NO,
       T.SEQ,
       T.MAT_NO,
       T.IS_SAMPLE_PIPE,
       T.IS_VALID,
       T.REMARK,
       T.SAMPLE_PIPE_LEN,
       T.GET_SAMPLE_NAME,
       TO_CHAR(T.GET_SAMPLE_TIME, 'YYYY-MM-DD HH24:MI:SS') GET_SAMPLE_TIME,
       T.GET_SAMPLE_SHIFT,
       T.GET_SAMPLE_CLASS,
       T.ORDER_LENGTH,
       T.ACT_THEORY_WEIGHT,
       T.ACT_COUNT,
       TO_CHAR(T.CRATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CRATE_TIME,
       T.STATUS,
       T.M_MAT_NO,
       T.GROUP_FLAG,
       T.OP_PROCESS,
       T.BACK_PROCESS,
       T.M_M_MAT_NO,
       T.INSTORE_FLAG,
       T.REAL_BATCH_NO,
       T.RECUT_LENGTH,
       T.CUT_ACT_THEORY_WEIGHT,
       T.SAMPLE_PIPE_LEN_A,
       T.SAMPLE_PIPE_LEN_B,
       T.OFFLINE_TYPE,
       T.BAL_YEAR_MONTH
 FROM PORT_MIL_BATCH_SAMPLE_RESULT T
 WHERE
       T.PLAN_ID = '#PLAN_ID#'
       AND T.LOT_NO = '#LOT_NO#'
       AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
       AND T.SEQ = '#SEQ#'
        ]]>
    </query>
    <query id="PortMilBatchSampleResultDAL.Insert" desc="新增">
        <![CDATA[
 INSERT INTO PORT_MIL_BATCH_SAMPLE_RESULT(
        PLAN_ID,
        LOT_NO,
        STOVE_NO,
        JUDGE_STOVE_NO,
        GROUP_NO,
        PLINE_CODE,
        BATCH_NO,
        SEQ,
        MAT_NO,
        IS_SAMPLE_PIPE,
        IS_VALID,
        REMARK,
        SAMPLE_PIPE_LEN,
        GET_SAMPLE_NAME,
        GET_SAMPLE_TIME,
        GET_SAMPLE_SHIFT,
        GET_SAMPLE_CLASS,
        ORDER_LENGTH,
        ACT_THEORY_WEIGHT,
        ACT_COUNT,
        CRATE_TIME,
        STATUS,
        M_MAT_NO,
        GROUP_FLAG,
        OP_PROCESS,
        BACK_PROCESS,
        M_M_MAT_NO,
        INSTORE_FLAG,
        REAL_BATCH_NO,
        RECUT_LENGTH,
        CUT_ACT_THEORY_WEIGHT,
        SAMPLE_PIPE_LEN_A,
        SAMPLE_PIPE_LEN_B,
        OFFLINE_TYPE,
        BAL_YEAR_MONTH)
 VALUES( 
        '#PLAN_ID#',
        '#LOT_NO#',
        '#STOVE_NO#',
        '#JUDGE_STOVE_NO#',
        '#GROUP_NO#',
        '#PLINE_CODE#',
        '#BATCH_NO#',
        '#SEQ#',
        '#MAT_NO#',
        '#IS_SAMPLE_PIPE#',
        '#IS_VALID#',
        '#REMARK#',
        '#SAMPLE_PIPE_LEN#',
        '#GET_SAMPLE_NAME#',
        SYSDATE,
        '#GET_SAMPLE_SHIFT#',
        '#GET_SAMPLE_CLASS#',
        '#ORDER_LENGTH#',
        '#ACT_THEORY_WEIGHT#',
        '#ACT_COUNT#',
        SYSDATE,
        '#STATUS#',
        '#M_MAT_NO#',
        '#GROUP_FLAG#',
        '#OP_PROCESS#',
        '#BACK_PROCESS#',
        '#M_M_MAT_NO#',
        '#INSTORE_FLAG#',
        '#REAL_BATCH_NO#',
        '#RECUT_LENGTH#',
        '#CUT_ACT_THEORY_WEIGHT#',
        '#SAMPLE_PIPE_LEN_A#',
        '#SAMPLE_PIPE_LEN_B#',
        '#OFFLINE_TYPE#',
        '#BAL_YEAR_MONTH#')
        ]]>
    </query>
    <query id="PortMilBatchSampleResultDAL.Update" desc="修改">
        <![CDATA[
 UPDATE PORT_MIL_BATCH_SAMPLE_RESULT T
   SET 
        T.PLAN_ID = '#PLAN_ID#',
        T.LOT_NO = '#LOT_NO#',
        T.STOVE_NO = '#STOVE_NO#',
        T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#',
        T.GROUP_NO = '#GROUP_NO#',
        T.PLINE_CODE = '#PLINE_CODE#',
        T.BATCH_NO = '#BATCH_NO#',
        T.SEQ = '#SEQ#',
        T.MAT_NO = '#MAT_NO#',
        T.IS_SAMPLE_PIPE = '#IS_SAMPLE_PIPE#',
        T.IS_VALID = '#IS_VALID#',
        T.REMARK = '#REMARK#',
        T.SAMPLE_PIPE_LEN = '#SAMPLE_PIPE_LEN#',
        T.GET_SAMPLE_NAME = '#GET_SAMPLE_NAME#',
        T.GET_SAMPLE_TIME = SYSDATE,
        T.GET_SAMPLE_SHIFT = '#GET_SAMPLE_SHIFT#',
        T.GET_SAMPLE_CLASS = '#GET_SAMPLE_CLASS#',
        T.ORDER_LENGTH = '#ORDER_LENGTH#',
        T.ACT_THEORY_WEIGHT = '#ACT_THEORY_WEIGHT#',
        T.ACT_COUNT = '#ACT_COUNT#',
        T.CRATE_TIME = SYSDATE,
        T.STATUS = '#STATUS#',
        T.M_MAT_NO = '#M_MAT_NO#',
        T.GROUP_FLAG = '#GROUP_FLAG#',
        T.OP_PROCESS = '#OP_PROCESS#',
        T.BACK_PROCESS = '#BACK_PROCESS#',
        T.M_M_MAT_NO = '#M_M_MAT_NO#',
        T.INSTORE_FLAG = '#INSTORE_FLAG#',
        T.REAL_BATCH_NO = '#REAL_BATCH_NO#',
        T.RECUT_LENGTH = '#RECUT_LENGTH#',
        T.CUT_ACT_THEORY_WEIGHT = '#CUT_ACT_THEORY_WEIGHT#',
        T.SAMPLE_PIPE_LEN_A = '#SAMPLE_PIPE_LEN_A#',
        T.SAMPLE_PIPE_LEN_B = '#SAMPLE_PIPE_LEN_B#',
        T.OFFLINE_TYPE = '#OFFLINE_TYPE#',
        T.BAL_YEAR_MONTH = '#BAL_YEAR_MONTH#'
 WHERE
       T.PLAN_ID = '#PLAN_ID#'
       AND T.LOT_NO = '#LOT_NO#'
       AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
       AND T.SEQ = '#SEQ#'
        ]]>
    </query>
    <query id="PortMilBatchSampleResultDAL.GetMaxPk" desc="获取最大主键">
        <![CDATA[
SELECT NVL(MAX(PLAN_ID), 0) + 1 MAX_VALUE FROM PORT_MIL_BATCH_SAMPLE_RESULT T
        ]]>
    </query>
    <query id="PortMilBatchSampleResultDAL.Delete" desc="作废">
        <![CDATA[
UPDATE PORT_MIL_BATCH_SAMPLE_RESULT T
   SET
       T.VALIDFLAG = '0',
       T.DELETE_NAME = '#DELETE_NAME#',
       T.DELETE_TIME = SYSDATE
WHERE
       T.PLAN_ID = '#PLAN_ID#'
       AND T.LOT_NO = '#LOT_NO#'
       AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
       AND T.SEQ = '#SEQ#'
        ]]>
    </query>
    <query id="PortMilBatchSampleResultDAL.Resume" desc="恢复">
        <![CDATA[
UPDATE PORT_MIL_BATCH_SAMPLE_RESULT T
   SET
       T.VALIDFLAG = '1',
       T.DELETE_NAME = NULL,
       T.DELETE_TIME = NULL,
       T.UPDATE_NAME = '#UPDATE_NAME#',
       T.UPDATE_TIME = SYSDATE
WHERE
       T.PLAN_ID = '#PLAN_ID#'
       AND T.LOT_NO = '#LOT_NO#'
       AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
       AND T.SEQ = '#SEQ#'
        ]]>
    </query>
    
    <query id="PortMilBatchSampleResultDAL.updateResultChem" desc="修改轧管分批取样表的成分 ">
		<![CDATA[
UPDATE PORT_MIL_BATCH_SAMPLE_RESULT T
   SET T.CHEM_RESULT_CODE = {0}
 WHERE T.JUDGE_STOVE_NO = {1}
		]]>
	</query>
	
	<query id="PortMilBatchSampleResultDAL.updateResultPhy" desc="修改轧管分批取样表 的理化">
		<![CDATA[
UPDATE PORT_MIL_BATCH_SAMPLE_RESULT T
   SET T.PHY_RESULT_CODE = {0}
 WHERE T.JUDGE_STOVE_NO = {1}
		]]>
	</query>
</queryMap>