<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="热处理交库">
	<query id="FrmHttInOnlineStore.DeleteComInfoResult" desc="删除comInfo表">		
        <![CDATA[
DELETE HTT_COM_INFO
 WHERE HEAT_PLAN_NO = ?
   AND STATION_CODE = ?
   AND INSTOCK_DOC = ? 
          ]]>
	</query>
		<query id="FrmHttInOnlineStore.UpdatePlanResultC" desc="删除时修改计划从表">		
        <![CDATA[
UPDATE PLN_ZY_RCL_C
   SET REAL_OUTDOUBLE_WT  = TO_NUMBER(NVL(REAL_OUTDOUBLE_WT, 0)) - TO_NUMBER(?),
       REAL_OUTDOUBLE_NUM = TO_NUMBER(NVL(REAL_OUTDOUBLE_NUM, 0)) - TO_NUMBER(?)
       --PER_STATUS=?  --,
      -- STORAGE_NO2='',
      -- STORAGE_NAME2=''
 WHERE HEAT_PLAN_NO = ?
          ]]>
	</query>
	
	<query id="FrmHttInOnlineStore.doQuerymch" desc="查询热处理队列">
        <![CDATA[
		SELECT T1.HEAT_PLAN_NO,T1.JUDGE_STOVE_NO,DECODE(T1.BESIDE_STATUS,
                       '00',
                      '上料结炉',
                      '10',
                      '高温结炉',
                      '20',
                      '淬火结炉',
                      '30',
                      '低温结炉',
                      '40',
                      '定径结炉',
                      '50',
                      '热矫结炉',
                      '60',
                      '冷矫结炉',
                      '70',
                      '检验结炉',
                      '80',
                      '探伤结炉',
                      '90',
                      '交库结炉') BESIDE_STATUS FROM PLN_ZY_RCL_M T1
		WHERE 1=1
        ]]>
	</query>
			<query id="FrmHttInOnlineStore.getQueryExpandResultStuts" desc="查询相同炉计划ID下交库实绩状态">		
        <![CDATA[
 SELECT  INSTORE_FLAG  FROM PORT_HTT_BATCH_SAMPLE_RESULT
 WHERE HEAT_PLAN_NO = ? AND PLINE_CODE = ?
   AND MAT_STATUS IN ('00', '10') 
   GROUP BY INSTORE_FLAG

          ]]>
	</query>
	<query id="FrmHttInOnlineStore.UpdatePath1" desc="修改队列表工艺路径">		
        <![CDATA[
UPDATE PORT_HTT_BATCH_SAMPLE_RESULT T
   SET T.PRC_TECHNOLOGY_PATH = SUBSTR(T.PRC_TECHNOLOGY_PATH, ?, ?) || ? ||
                               SUBSTR(T.PRC_TECHNOLOGY_PATH,
                                      ?,
                                      LENGTH(T.PRC_TECHNOLOGY_PATH)),
       T.VM_INSTORE_FLAG     = ?
 WHERE T.MAT_NO = ?
 AND PROCESS_SEQ = (SELECT real_process_seq FROM pln_zy_rcl_m WHERE heat_plan_no = t.heat_plan_no)
 AND T.HEAT_PLAN_NO=?
          ]]>
	</query>
	<query id="FrmHttInOnlineStore.AddYdmButt" desc="新增位置表">
	<![CDATA[
	INSERT INTO YDM_ZC_BUTTRESS
  (MAT_NO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   BATCH_GROUD_NO,
   STORAGE_NO,
   LOCATION_NO,
   LARY_NO,
   LOC_NO,
   STORAGE_ATTR,
   STORAGE_ATTR_NAME,
   STORAGE_TYPE_NO,
   STORAGE_TYPE_NAME,
   MANAGEMENT_NO,
   MANAGEMENT_NAME,
   MEMO,
   CREATE_NAME,
   CREATE_TIME,
   DEPARTMENT_CODE,
   DEPARTMENT_DESC)
  values ( ?,
          ?,
          ?,
          ?,
          ?,
          ?,
          ?,
          ?,
          ?,
          ?,
          ?,
          ?,
          ?,
          ?,
          ?,
          ?,
          TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
          ?,
          ?)
    ]]>
	</query>
	<query id="FrmHttInOnlineStore.UpdatePlanResult1" desc="交库时修改计划表">		
        <![CDATA[
UPDATE PLN_ZY_RCL_M
   SET --OUT_WT_REAL  = TO_NUMBER(NVL(OUT_WT_REAL, 0)) + TO_NUMBER(?),
       --OUT_NUM_REAL = TO_NUMBER(NVL(OUT_NUM_REAL, 0)) + TO_NUMBER(?),
       PER_STATUS='90'
       --STORAGE_NO2=?,
       --STORAGE_NAME2=?
 WHERE HEAT_PLAN_NO = ?
          ]]>
	</query>
	
		<query id="FrmHttInOnlineStore.UpdatePlanResultC1" desc="交库时修改计划表从表">		
        <![CDATA[
UPDATE PLN_ZY_RCL_C
   SET REAL_OUTDOUBLE_WT  = TO_NUMBER(NVL(REAL_OUTDOUBLE_WT, 0)) + TO_NUMBER(?),
       REAL_OUTDOUBLE_NUM = TO_NUMBER(NVL(REAL_OUTDOUBLE_NUM, 0)) + TO_NUMBER(?)
       --PER_STATUS='10',
       --STORAGE_NO2=?,
       --STORAGE_NAME2=?
 WHERE HEAT_PLAN_NO = ?
          ]]>
	</query>
	<query id="FrmHttInOnlineStore.UpdatePlanResult" desc="删除时修改计划表">		
        <![CDATA[
UPDATE PLN_ZY_RCL_M
   SET --OUT_WT_REAL  = TO_NUMBER(NVL(OUT_WT_REAL, 0)) - TO_NUMBER(?),
       --OUT_NUM_REAL = TO_NUMBER(NVL(OUT_NUM_REAL, 0)) - TO_NUMBER(?),
       PER_STATUS=?--,
       --STORAGE_NO2='',
       --STORAGE_NAME2=''
 WHERE HEAT_PLAN_NO = ?
          ]]>
	</query>
	<query id="FrmHttInOnlineStore.DeleteMatM" desc="修改热处理材料表">		
        <![CDATA[
UPDATE MAT_ZC_M
   SET PRODUCT_FLAG = ?,
       MAT_STATUS   = ?,
       PROCESS_CDOE = ?,
       PROCESS_DESC = ?,
       VRP_PLINE_CODE = ?,
       VRP_PLINE_NAME = ?, 
       VRP_FACE_RESULT_CODE = ?,
       VRP_CHEM_RESULT_CODE = ?,
       VRP_GX_PLAN_NO = ?,
       VRP_GX_PLAN_NO1 = ?,
       VRP_SPEC_RESULT_CODE = ?,
       VRP_QCM_STAUS = ?,
       VRP_HEAT_PLAN_NO = ?,
       VRP_PRO_ORDER_ID = ?,
       VRP_PRO_ORDER_ID1 = ?,
       VRP_PRO_ORDER_NO = ?,
       VRP_PRO_ORDER_NO1 = ?,
       VRP_LOT_NO = ?,
       VRP_PHY_RESULT_CODE = ?,
       VRP_SAMPLE_FLAG = ?,
       VRP_CRAF_NO = ?,
       VPR_QUALITY_GROUP_ZG = ?,
       VRP_ACT_HEIGHT = ?,
       VRP_ACT_DIMATER = ?,
       MATERIAL_NO = ?,
       MATERIAL_NAME = ?,
       INPUT_MATERIAL_NAME = ?,
       INPUT_MATERIAL_NO = ?,
       INPUT_ORIGIN_CODE = ?,
       NEXT_PROCESS_CDOE = ?,
       NEXT_PROCESS_DESC = ?,
       PLINE_CODE = ?,
       PLINE_NAME = ?, 
       UPDATE_NAME = ?,
       UPDATE_TIME =TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       VRP_JUDGE_RESULT_CODE=?,
       BELONG_CODE=?,
       BELONG_NAME=?,
       MAT_GOWHERE_CODE=?,
       MAT_GOWHERE_NAME=?
 WHERE MAT_NO = ?
          ]]>
	</query>
	<query id="FrmHttInOnlineStore.DeleteMatButters" desc="删除位置表">		
        <![CDATA[
DELETE YDM_ZC_BUTTRESS T
 WHERE T.MAT_NO = ?
          ]]>
	</query>
	<query id="FrmHttInOnlineStore.updateif" desc="修改管号队列是否入库的字段">		
        <![CDATA[
UPDATE PORT_HTT_BATCH_SAMPLE_RESULT T
   SET INSTORE_FLAG = ?
 WHERE HEAT_PLAN_NO = ?
 AND PROCESS_SEQ = (SELECT real_process_seq FROM pln_zy_rcl_m WHERE heat_plan_no = t.heat_plan_no)
   AND MAT_STATUS IN ('00', '10')
             ]]>
	</query>

	<query id="FrmHttInOnlineStore.DeleteLinResult" desc="删除交库实绩表">		
        <![CDATA[
DELETE YDM_ZC_INLIST T WHERE  T.MAT_NO = ? AND T.INSTOCK_DOC = ?
          ]]>
	</query>
	<query id="FrmHttInOnlineStore.doQuery" desc="实体类查询热处理计划表">
        <![CDATA[
		SELECT T.*
  FROM PLN_ZY_RCL_M T
    WHERE T.HEAT_PLAN_NO=?
        ]]>
	</query>
	<query id="FrmHttInOnlineStore.doQuerySingleJugStove" desc="投入产出">
        <![CDATA[
 SELECT T.*,  
       TO_NUMBER(LOAD_PIECES) - TO_NUMBER(PLAN_JG_NUM) - TO_NUMBER(FAIL_CUT_NUM) LL_NUM,
       TO_NUMBER(LOAD_WEIGHT) - TO_NUMBER(PLAN_JG_WEIGHT) - TO_NUMBER(FAIL_CUT_WEIGHT) LL_WEIGHT,
       TO_NUMBER(LOAD_PIECES) - TO_NUMBER(PLAN_JG_NUM) - TO_NUMBER(FAIL_CUT_NUM) - TO_NUMBER(SJ_NUM) CLC_NUM,
       TO_NUMBER(LOAD_WEIGHT) - TO_NUMBER(PLAN_JG_WEIGHT) - TO_NUMBER(FAIL_CUT_WEIGHT) -
       TO_NUMBER(SJ_WEIGHT) CLC_WEIGHT
  FROM (SELECT T1.ORDER_NO || '/' || T1.ORDER_SEQ || '/' || T1.DELIVERY_NO ORDER_NO_SEQ,
               T1.ZY_BATCH_ID,
               T1.HEAT_PLAN_NO,
               T1.JUDGE_STOVE_NO,
               T1.BATCH_NO,
               T1.ORDER_NO,
               T1.ORDER_SEQ,
               T1.DELIVERY_NO,
               T1.PLINE_CODE,
               T1.PRO_PLAN_ID,
               T1.GX_PLAN_NO,
               T1.PLINE_NAME,
               --NVL(T1.OUT_WT, 0) PLAN_JG_WEIGHT,
               --NVL(T1.OUT_NUM, 0) PLAN_JG_NUM,
               NVL((SELECT SUM(T.ACT_WEIGHT)
                     FROM PORT_HTT_BATCH_SAMPLE_RESULT  T
                    WHERE T.MAT_STATUS = '20'
                      AND T.HEAT_PLAN_NO = T1.HEAT_PLAN_NO),
                   0) PLAN_JG_WEIGHT,
               NVL((SELECT SUM(T.ACT_COUNT)
                     FROM PORT_HTT_BATCH_SAMPLE_RESULT  T
                    WHERE T.MAT_STATUS = '20'
                      AND T.HEAT_PLAN_NO = T1.HEAT_PLAN_NO),
                   0) PLAN_JG_NUM,
               NVL((SELECT SUM(T.ACT_COUNT)
                     FROM PORT_HTT_BATCH_SAMPLE_RESULT  T
                    WHERE T.MAT_STATUS = '10'
                      AND T.HEAT_PLAN_NO = T1.HEAT_PLAN_NO),
                   0) FAIL_CUT_NUM,
               NVL((SELECT SUM(T.ACT_WEIGHT)
                     FROM PORT_HTT_BATCH_SAMPLE_RESULT T
                    WHERE T.MAT_STATUS = '10'
                      AND T.HEAT_PLAN_NO = T1.HEAT_PLAN_NO),
                   0) FAIL_CUT_WEIGHT,
               NVL((SELECT SUM(T.ACT_COUNT)
                     FROM PORT_HTT_BATCH_SAMPLE_RESULT T
                    WHERE 
                      T.HEAT_PLAN_NO = T1.HEAT_PLAN_NO),
                   0) LOAD_PIECES,
               NVL((SELECT SUM(T.ACT_WEIGHT)
                     FROM PORT_HTT_BATCH_SAMPLE_RESULT T
                    WHERE 
                      T.HEAT_PLAN_NO = T1.HEAT_PLAN_NO),
                   0) LOAD_WEIGHT,
               NVL((SELECT SUM(T.ACT_COUNT)
                     FROM PORT_HTT_BATCH_SAMPLE_RESULT T
                    WHERE T.MAT_STATUS = '00'
                      AND T.HEAT_PLAN_NO = T1.HEAT_PLAN_NO),
                   0) SJ_NUM,
               NVL((SELECT SUM(T.ACT_WEIGHT)
                     FROM PORT_HTT_BATCH_SAMPLE_RESULT T
                    WHERE T.MAT_STATUS = '00'
                      AND T.HEAT_PLAN_NO = T1.HEAT_PLAN_NO),
                   0) SJ_WEIGHT,
                DECODE(T1.BESIDE_STATUS,
                      '00',
                      '上料结炉',
                      '10',
                      '高温结炉',
                      '20',
                      '淬火结炉',
                      '30',
                      '低温结炉',
                      '40',
                      '定径结炉',
                      '50',
                      '热矫结炉',
                      '60',
                      '冷矫结炉','70','检验结炉','80','探伤结炉','90','交库结炉') BESIDE_STATUS,
               DECODE(T1.PER_STATUS,
                      '00',
                      '上料开始',
                      '10',
                      '高温开始',
                      '20',
                      '淬火开始',
                      '30',
                      '低温开始',
                      '40',
                      '定径开始',
                      '50',
                      '热矫开始',
                      '60',
                      '冷矫开始','70','检验开始','80','探伤开始','90','交库开始') PER_STATUS,
               DECODE(T1.PLANSTATUS,
                      '00',
                      '计划',
                      '10',
                      '下发',
                      '20',
                      '生产中',
                      '30',
                      '生产完成',
                      '40',
                      '关闭') PLANSTATUS,
               DECODE(T1.IF_MONITOR, '0', '否', '1', '是', '否') IF_MONITOR_DBK,
               T1.CRAFT_FILE_MAN,
               T1.Craft_File_No,
               T1.CRAFT_SEQ,
               T2.BATCH_GROUD_NO
         FROM pln_zy_rcl_m T1,pln_zy_rcl_c t2
 WHERE 1=1 and T1.PRO_PLAN_ID = T2.PRO_PLAN_ID and t1.heat_plan_no=t2.heat_plan_no and t1.zy_batch_id=t2.zy_batch_id
         AND T1.GX_PLAN_NO = T2.GX_PLAN_NO
        ]]>
	</query>
	<query id="FrmHttInOnlineStore.doQueryLibrary" desc="查询交库信息">
	 <![CDATA[
		SELECT T.INSTOCK_DOC,
       T.INSTOCK_TYPE_CODE,
       T.INSTOCK_TYPE_NAME,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       T.MATERIAL_NAME,
       T.PRODUCNAME,
       T.STD_NAME,
       T.GRADENAME,
       T.STEELNAME,
       T.STD_STYLE_DESC,
       T.SPEC_NAME,
       T.MODEL_DESC,
       T.PRO_ORDER_NO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.ACT_DIMATER,
       T.ACT_HEIGHT,
       SUM(T.ACT_LEN) ACT_LEN,
       T.ACT_LEN_MIN,
       T.ACT_LEN_MAX,
       SUM(T.ACT_COUNT) ACT_COUNT,
       SUM(T.ACT_WEIGHT) ACT_WEIGHT,
       SUM(T.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT,
       T.BELONG_CODE,
       T.BELONG_NAME,
       T.STORAGE_NO,
       T.LOCATION_NO,
       T.LARY_NO,
       T.LOC_NO,
       T.STORAGE_ATTR_NAME,
       T.STORAGE_TYPE_NAME,
       T.MANAGEMENT_NAME,
       T.RPO_TIME,
       T.PRO_BC,
       T.PRO_BZ,
       TO_CHAR(T.INSTOCK_TIME,'YYYY-MM-DD HH24:MI:SS') INSTOCK_TIME,
       DECODE(T.IN_BC,'1','早','2','中','3','晚') IN_BC,
       DECODE(T.IN_BZ,'1','甲','2','乙','3','丙','4','丁') IN_BZ,
       T.HAND_FLAG,
       T.MEMO,
       T.VALIDFLAG,
       T.CREATE_NAME,
       T.CREATE_TIME,
       T.UPDATE_NAME,
       T.UPDATE_TIME,
       T.ORD_PK,
       T.ORD_LN_PK,
       T.ORD_LN_DLY_PK,
       T.DEPARTMENT_CODE,
       T.DEPARTMENT_DESC,
       T.ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       DECODE(T.PRODUCT_FLAG,
              '801401',
              '在制品',
              '801402',
              '成品',
              '801403',
              '商品') PRODUCT_FLAG,
       DECODE(T.MAT_STATUS,
              '80150101',
              '材料产出待判',
              '80150102',
              '材料产出(已判定)',
              '80150103',
              '材料已编计划',
              '80150104',
              '材料待处理',
              '80150105',
              '材料加工',
              '80150201',
              '材料产出待判(未综合判定)',
              '80150202',
              '材料产出(已综合判定)',
              '80150203',
              '材料为余材(生产组织产生)',
              '80150204',
              '材料脱单余材(销售组织脱单)',
              '80150205',
              '材料缴库余材
    (销售组织缴库)',
              '80150301',
              '材料可编提单',
              '80150302',
              '材料已编提单',
              '80150303',
              '销售出厂') MAT_STATUS,
       T.JUDGE_STD_NAME,
       T.JUDGE_STD_CODE,
       TO_CHAR(T.IN_TIME_F,'YYYY-MM-DD HH24:MI:SS') IN_TIME_F,
       T.BAL_YEAR_MONTH,
       T.PIPMEMO,
       DECODE(T.QCM_STAUS,
              '00',
              '合格',
              '11',
              '待处理',
              '22',
              '判废',
              '10',
              '处理合格',
              '12',
              '处理判废') QCM_STAUS,
       B.STORAGE_NAME,
       M.HEAT_PLAN_NO
  FROM YDM_ZC_INLIST T, YDM_BS_STORAGE B, PORT_HTT_BATCH_SAMPLE_RESULT M
 WHERE T.STORAGE_NO = B.STORAGE_NO
 	AND T.MAT_NO=M.MAT_NO
   --AND T.JUDGE_STOVE_NO = M.HEATNO_LAST
   --AND NVL(T.BATCH_NO, '/') = NVL(M.LAST_BATCH_NO, '/')
   --AND NVL(T.BATCH_GROUD_NO, '/') = NVL(M.BATCH_GROUD_NO, '/')
   --AND AFFIRM_LOG = '1'
   AND T.INSTOCK_TYPE_CODE = '800701'		
		   ]]>
	</query>
	<query id="FrmHttInOnlineStore.doQuerySingle" desc="查询炉信息（剔除，合格，样管）">
	 <![CDATA[  
SELECT T.HEAT_PLAN_NO,
       T.LOT_NO,
       T.LOT_NO_SQE,
       DECODE(T.MAT_STATUS, '00', '合格', '10', '剔除') MAT_STATUS
  FROM PORT_HTT_BATCH_SAMPLE_RESULT T
 WHERE T.HEAT_PLAN_NO = ?
   AND T.MAT_STATUS != '20'
   AND T.JUDGE_STOVE_NO = ?
   AND NVL(T.BATCH_NO, '/') = NVL(?, '/')
   AND NVL(T.GROUP_NO, '/') = NVL(?, '/')
 GROUP BY T.HEAT_PLAN_NO, T.LOT_NO, T.LOT_NO_SQE, T.MAT_STATUS
UNION ALL
SELECT DISTINCT T.HEAT_PLAN_NO,
                T.LOT_NO,
                T.LOT_NO_SQE,
                DECODE(T.IS_SAMPLE_PIPE, '0', '样管', '1', '样管') MAT_STATUS
  FROM PORT_HTT_BATCH_SAMPLE_RESULT T
 WHERE T.HEAT_PLAN_NO = ?
   AND T.JUDGE_STOVE_NO = ?
   AND NVL(T.BATCH_NO, '/') = NVL(?, '/')
    AND NVL(T.GROUP_NO, '/') = NVL(?, '/')
 GROUP BY T.HEAT_PLAN_NO, T.LOT_NO, T.LOT_NO_SQE, T.IS_SAMPLE_PIPE
   ]]>
	</query>
	<query id="FrmHttInOnlineStore.queryMaxMatNo" desc="查询材料表里在制品材料号">
	 <![CDATA[  
 SELECT T1.*
  FROM (SELECT  M.MAT_NO,
               M.JUDGE_STOVE_NO,
               M.BATCH_NO,
               M.BATCH_GROUD_NO,
               M.MATERIAL_NO,
               M.MATERIAL_NAME,
               M.PRODUCCODE,
               M.PRODUCNAME,
               M.STEELCODE,
               M.STEELNAME,
               M.GRADECODE,
               M.GRADENAME,
               M.SPEC_CODE,
               M.SPEC_NAME,
               M.MODEL_CODE,
               M.MODEL_DESC,
               M.STD_CODE,
               M.STD_NAME,
               M.STD_STYLE,
               M.STD_STYLE_DESC,
               M.ORDER_SEQ,
               M.ORDER_NO,
               M.ORDER_SEQ_NO,
               M.LOT_NO,
               M.STOVE_NO,
               M.PLINE_CODE,
               M.PLINE_NAME M,
               M.MAT_ORIGIN_CODE,
               M.MAT_ORIGIN_NAME,
               M.ACT_DIMATER,
               M.ACT_HEIGHT,
               M.ACT_LEN,
               M.ACT_LEN_MIN,
               M.ACT_LEN_MAX,
               T.ACT_COUNT,
               T.ACT_WEIGHT,
               M.ACT_THEORY_WEIGHT,
               M.ORD_PK,
               M.ORD_LN_PK,
               M.ORD_LN_DLY_PK,
               M.BELONG_CODE,
               M.BELONG_NAME,
               T.FLAG_STOVE_NO  HTT_FLAG_STOVE_NO_ZG
          FROM PORT_HTT_BATCH_SAMPLE_RESULT T, MAT_ZC_M M
         WHERE T.MAT_NO = M.MAT_NO
           AND T.JUDGE_STOVE_NO = ?
           AND NVL(T.BATCH_NO, '/') = NVL(?, '/')
           AND NVL(T.GROUP_NO, '/') = NVL(?, '/')
           AND T.MAT_STATUS = ?
           AND T.IS_SAMPLE_PIPE = ?
           AND T.HEAT_PLAN_NO = ?
           AND T.VM_INSTORE_FLAG = '0'
         ORDER BY T.MAT_NO ASC) T1
 WHERE ROWNUM < ?
   ]]>
	</query>
	<query id="FrmHttInOnlineStore.doQuerySingle1" desc="查询炉信息里的内容">
	 <![CDATA[  
SELECT T2.*,
       TO_NUMBER(T2.ACT_COUNT) - TO_NUMBER(T2.LINT_COUNT) EDI_COUNT,
       TO_NUMBER(T2.ACT_WEIGHT) - TO_NUMBER(T2.LINT_WT) EDI_WT
  FROM (SELECT SUM(T.ACT_COUNT) ACT_COUNT,
               SUM(T.ACT_WEIGHT) ACT_WEIGHT,
               SUM(T.ACT_LEN) ACT_LEN,
               T.BATCH_NO,
               T.JUDGE_STOVE_NO,
               T.GROUP_NO,
               (SELECT NVL(SUM(T1.ACT_COUNT), 0)
                  FROM PORT_HTT_BATCH_SAMPLE_RESULT T1
                 WHERE T1.HEAT_PLAN_NO = T.HEAT_PLAN_NO
                   AND T1.VM_INSTORE_FLAG = '1'
                   AND T1.MAT_STATUS = T.MAT_STATUS
                   AND T1.IS_SAMPLE_PIPE = T.IS_SAMPLE_PIPE) LINT_COUNT,
               (SELECT NVL(SUM(T1.ACT_WEIGHT), 0)
                 FROM PORT_HTT_BATCH_SAMPLE_RESULT T1
                WHERE T1.HEAT_PLAN_NO = T.HEAT_PLAN_NO
                  AND T1.VM_INSTORE_FLAG = '1'
                  AND T1.MAT_STATUS = T.MAT_STATUS
                  AND T1.IS_SAMPLE_PIPE = T.IS_SAMPLE_PIPE
        ) LINT_WT
  FROM PORT_HTT_BATCH_SAMPLE_RESULT T
 WHERE T.MAT_STATUS = ?
   AND T.HEAT_PLAN_NO = ?
   AND T.IS_SAMPLE_PIPE = ?
 GROUP BY T.BATCH_NO, T.JUDGE_STOVE_NO, T.GROUP_NO,T.HEAT_PLAN_NO,T.MAT_STATUS,T.IS_SAMPLE_PIPE) T2
   ]]>
	</query>
	<query id="FrmHttInOnlineStore.queryMaxMatNo1" desc="查询入库表材料号">
	 <![CDATA[  
SELECT T1.*
FROM (SELECT T.MAT_NO,
             M.INPUT_MATERIAL_NO,
             M.INPUT_MATERIAL_NAME,
             M.ZG_PLINE_CODE,
             M.ZG_PLINE_NAME,
             M.HTT_PLINE_CODE,
             M.HTT_PLINE_NAME,
             M.VRP_PLINE_CODE,
             M.VRP_PLINE_NAME,
             M.ACT_WEIGHT
        FROM YDM_ZC_INLIST T, MAT_ZC_M M
       WHERE T.MAT_NO = M.MAT_NO
         AND T.INSTOCK_DOC = ?
       ORDER BY T.MAT_NO ASC) T1
WHERE ROWNUM < ?

   ]]>
	</query>

	<query id="FrmHttInOnlineStore.doBeside" desc="修改公共信息表的状态为生产完成">
	 <![CDATA[  
UPDATE HTT_COM_INFO T
   SET T.STATION_STATUS = ?
 WHERE T.STATION_CODE = ?
   AND HEAT_PLAN_NO = ?

   ]]>
	</query>
	<query id="FrmHttInOnlineStore.queryApCode" desc="查询炉计划是否申请判定">
	 <![CDATA[  
SELECT COUNT(*) COUNT
  FROM QCM_ZG_JUGDE_APPLY T
 WHERE T.JUDGE_STOVE_NO = ?
   AND T.BATCH_NO = ?
   AND T.PROCESS_CODE = 'F'
   ]]>
	</query>
	<query id="FrmHttInOnlineStore.querystatus" desc="查询公共信息表里交库工序状态">
	 <![CDATA[  
SELECT DISTINCT T.STATION_STATUS,T.BELONG_CODE,T.BELONG_NAME
  FROM HTT_COM_INFO T
 WHERE T.STATION_CODE = ?
   AND T.HEAT_PLAN_NO = ?
   ]]>
	</query>
	<query id="FrmHttInOnlineStore.qureyGxComInfo" desc="查询公共信息表工序点状态">
		<![CDATA[
SELECT  STATION_STATUS,STATION_DESC,STATION_CODE
  FROM HTT_COM_INFO
 WHERE HEAT_PLAN_NO = ?
   AND PLINE_CODE = ?
   AND STATION_CODE != ? 
   GROUP BY STATION_STATUS,STATION_DESC,STATION_CODE
   ORDER BY STATION_CODE ASC
			]]>
	</query>
	<query id="FrmHttInOnlineStore.queryExpandMaxRESULT" desc="查询最大实绩编号">
		<![CDATA[
SELECT ? ||
       LPAD(SUBSTR(NVL(MAX(T.RESULT_NO), '000000'), -6, 6) + 1, 6, '0') AS RESULT_NO
  FROM HTT_COM_INFO T
 WHERE TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD') = ?
   AND T.PLINE_CODE = ?
   and t.STATION_CODE=?		
   ]]>
	</query>
	<query id="FrmHttInOnlineStore.queryPlanJg1" desc="查询已交库量">
		<![CDATA[
SELECT NVL(SUM(T1.ACT_COUNT), 0) ACT_COUNT
  FROM PORT_HTT_BATCH_SAMPLE_RESULT T1
 WHERE T1.HEAT_PLAN_NO = ?
   AND T1.MAT_STATUS = ?
   AND T1.IS_SAMPLE_PIPE = ?
   AND T1.VM_INSTORE_FLAG = '1'
   ]]>
	</query>
	<query id="FrmHttInOnlineStore.AddComInfoResult" desc="新增公共信息">
		<![CDATA[
DECLARE
BEGIN
  FOR MYROW IN (SELECT T.* FROM PLN_ZY_RCL_M T WHERE T.HEAT_PLAN_NO = ?) LOOP
    INSERT INTO HTT_COM_INFO
      (RESULT_NO,
       HEAT_PLAN_NO,
       ZY_BATCH_ID,
       PROD_INDEX,
       PRO_PLAN_ID,
       GX_PLAN_NO,
       ORDER_SOURCE,
       ORDER_NO,
       ORDER_SEQ,
       REQ_BL_ID,
       PLINE_CODE,
       PLINE_NAME,
       STATION_CODE,
       STATION_DESC,
       JUDGE_STOVE_NO,
       BATCH_NO,
       BATCH_GROUD_NO,
       PRODUCCODE,
       PRODUCNAME,
       GRADECODE,
       GRADENAME,
       STEELCODE,
       STEELNAME,
       MODEL_CODE,
       MODEL_DESC,
       STD_CODE,
       STD_NAME,
       STD_STYLE,
       STD_STYLE_DESC,
       SPEC_CODE,
       SPEC_NAME,
       DIMATER,
       HEIGHT,
       LEN,
       LEN_MIN,
       LEN_MAX,
       PLN_LEN,
       ACT_SPEC_CODE,
       ACT_SPEC_NAME,
       ACT_DIMATER,
       ACT_HEIGHT,
       ACT_LEN,
       ACT_LEN_MIN,
       ACT_LEN_MAX,
       ACT_MATERIAL_NO,
       ACT_MATERIAL_NAME,
       INWL_ID,
       INWL_DESC,
       MONITOR_POINT,
       IF_MONITOR_RCL,
       PRDCR_NO,
       STATION_ROAD,
       CRAFT_FILE_NO,
       CRAFT_FILE_MAN,
       CRAFT_SEQ,
       PRO_NUM,
       PRO_WT,
       FAIL_NUM,
       FAIL_WT,
       OFFLINE_NUM,
       OFFLINE_WT,
       RE_NUM,
       RE_WT,
       PONDER_GROSS_WT,
       INSTOCK_DOC,
       STATION_STATUS,
       RRO_TIME,
       PRO_USER,
       PRO_SHIFT,
       PRO_GROUP,
       CREATE_TIME,
       COL_OPERATOR,
       VALIDFLAG,BELONG_CODE,BELONG_NAME)
    VALUES
      (?,
       MYROW.HEAT_PLAN_NO,
       MYROW.ZY_BATCH_ID,
       '',
       MYROW.PRO_PLAN_ID,
       MYROW.GX_PLAN_NO,
       MYROW.ORDER_SOURCE,
       MYROW.ORDER_NO,
       MYROW.ORDER_SEQ,
       MYROW.REQ_BL_ID,
       MYROW.PLINE_CODE,
       MYROW.PLINE_NAME,
       ?,
       ?,
       MYROW.JUDGE_STOVE_NO,
       MYROW.BATCH_NO,
       '',
       ?,
       ?,
       MYROW.GRADECODE,
       MYROW.GRADENAME,
       MYROW.STEELCODE,
       MYROW.STEELNAME,
       ?,
       ?,
       ?,
       ?,
       ?,
       ?,
       ?,
       ?,
       MYROW.OUTDIAMETER_IN,
       MYROW.WALLTHICK_IN,
       MYROW.LENGTH_IN,
       MYROW.LENGTHMIN_IN,
       MYROW.LENGTHMAX_IN,
       '',
       ?,
       ?,
       ?,
       ?,
       ?,
       ?,
       ?,
       MYROW.OUTWL_ID,
       MYROW.OUTWL_DESC,
       MYROW.INWL_ID,
       MYROW.INWL_DESC,
       MYROW.MONITOR_POINT,
       MYROW.IF_MONITOR,
       MYROW.PRDCR_NO,
       MYROW.STATION_ROAD,
       MYROW.CRAFT_FILE_NO,
       MYROW.CRAFT_FILE_MAN,
       MYROW.CRAFT_SEQ,
       ?,
       ?,
       ?,
       ?,
       ?,
       ?,
       ?,
       ?,
       ?,
       ?,
       '1',
       TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       ?,
       ?,
       ?,
       TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       ?,
       '1',?,?);
  END LOOP;
END;
		]]>
	</query>
	<query id="FrmHttInOnlineStore.AddPlnInfo" desc="新增热处理入库表">
		<![CDATA[
	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, LARY_NO, LOC_NO, 
STORAGE_ATTR, STORAGE_ATTR_NAME, STORAGE_TYPE_NO, STORAGE_TYPE_NAME, 
MANAGEMENT_NO, MANAGEMENT_NAME, RPO_TIME, PRO_BC, PRO_BZ, INSTOCK_TIME, IN_BC, 
IN_BZ, MEMO, CREATE_NAME, CREATE_TIME, ORD_PK, ORD_LN_PK, ORD_LN_DLY_PK, 
DEPARTMENT_CODE, DEPARTMENT_DESC, ORDER_NO, ORDER_SEQ, DELIVERY_NO, 
PRODUCT_FLAG, MAT_STATUS, JUDGE_STD_NAME, JUDGE_STD_CODE, IN_TIME_F, 
LEN_NO, LEN_DESC, LEN_UNIT, PIPMEMO, SOURE_CODE, SOURE_NAME, 
MAT_ORIGIN_CODE, MAT_ORIGIN_NAME, AFFIRM_LOG,QCM_STAUS) VALUES (?, ?, 
?, ?, ?, 
?, ?, ?, ?, ?, ?, ?, 
?, ?, ?, ?, ?, ?, ?, 
?, ?, ?, ?, ?, ?, 
?, ?, ?, ?, ?, ?, 
?, ?,?, ?, ?,?, 
?,?, ?, ?, ?, ?, 
?, ?, ?, ?, ?, 
?, ?, TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'), ?, ?, TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'), ?, 
?, ?, ?, TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'),?, ?, ?, 
?, ?, ?, ?, ?, 
?, ?, ?, ?, TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'),  ?, ?, ?, ?,?, ?, 
?, ?, ?,?)
		]]>
	</query>
	<query id="FrmHttInOnlineStore.AddLibraryResult" desc="新增位置表">
	<![CDATA[
	INSERT INTO YDM_ZC_BUTTRESS
  (MAT_NO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   BATCH_GROUD_NO,
   STORAGE_NO,
   LOCATION_NO,
   LARY_NO,
   LOC_NO,
   STORAGE_ATTR,
   STORAGE_ATTR_NAME,
   STORAGE_TYPE_NO,
   STORAGE_TYPE_NAME,
   MANAGEMENT_NO,
   MANAGEMENT_NAME,
   MEMO,
   CREATE_NAME,
   CREATE_TIME,
   DEPARTMENT_CODE,
   DEPARTMENT_DESC)
  values ( ?,
          ?,
          ?,
          ?,
          ?,
          ?,
          ?,
          ?,
          ?,
          ?,
          ?,
          ?,
          ?,
          ?,
          ?,
          ?,
          TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
          ?,
          ?)
    ]]>
	</query>
	<query id="FrmHttInOnlineStore.updatePln" desc="回写热处理计划表">
	<![CDATA[	
  UPDATE PLN_ZY_RCL_M
     SET PLANSTATUS = ?, BESIDE_STATUS = ?
   WHERE HEAT_PLAN_NO = ?

    ]]>
	</query>
	<query id="FrmHttInOnlineStore.updatePlnId" desc="回写热处理订单表">
	<![CDATA[
  UPDATE PLN_ORDER_RCL_S T
     SET T.EXE_STATUS = ?, PLAN_TIME_E = SYSDATE
   WHERE T.PRO_PLAN_ID = ?
     AND T.GX_PLAN_NO = ?
     AND T.EXE_STATUS<>'3'
    ]]>
	</query>
		<query id="FrmHttInOnlineStore.deletePlnId" desc="撤销结炉回写">
	<![CDATA[
  UPDATE PLN_ORDER_RCL_S T
     SET T.EXE_STATUS = ?, PLAN_TIME_E = ''
   WHERE T.PRO_PLAN_ID = ?
     AND T.GX_PLAN_NO = ?
    ]]>
	</query>
	<query id="FrmHttInOnlineStore.queryProPlanID" desc="查询订单向下的炉计划">
	<![CDATA[
  SELECT COUNT(*) COUNT
    FROM PLN_ZY_RCL_M T
   WHERE T.PRO_PLAN_ID = ?
     AND T.GX_PLAN_NO = ?
     AND T.PLANSTATUS IN ('00', '10', '20')
    ]]>
	</query>
	<query id="FrmHttInOnlineStore.UpdateLibraryResult" desc="修改材料表里的材料类别为成品">
	<![CDATA[
	UPDATE MAT_ZC_M SET PRODUCT_FLAG ='801402',MAT_STATUS = '80150201' 
	WHERE JUDGE_STOVE_NO = ?
	AND BATCH_NO = ?
    ]]>
	</query>
	<query id="FrmHttInOnlineStore.AddMatM" desc="末工序修改料表">
	<![CDATA[
UPDATE MAT_ZC_M
   SET PRODUCT_FLAG = ?,
       MAT_STATUS   = ?,
       PROCESS_CDOE = ?,
       PROCESS_DESC = ?,
       HTT_PLINE_CODE = ?,
       HTT_PLINE_NAME = ?, 
       HTT_FACE_RESULT_CODE = ?,
       HTT_CHEM_RESULT_CODE = ?,
       HTT_GX_PLAN_NO = ?,
       HTT_GX_PLAN_NO1 = ?,
       HTT_SPEC_RESULT_CODE = ?,
       HTT_QCM_STAUS = ?,
       HTT_HEAT_PLAN_NO = ?,
       HTT_PRO_ORDER_ID = ?,
       HTT_PRO_ORDER_ID1 = ?,
       HTT_PRO_ORDER_NO = ?,
       HTT_PRO_ORDER_NO1 = ?,
       HTT_LOT_NO = ?,
       HTT_PHY_RESULT_CODE = ?,
       HTT_SAMPLE_FLAG = ?,
       HTT_CRAF_NO = ?,
       HTT_QUALITY_GROUP_ZG = ?,
       MATERIAL_NO = ?,
       MATERIAL_NAME = ?,
       INPUT_MATERIAL_NAME = ?,
       INPUT_MATERIAL_NO = ?,
       INPUT_ORIGIN_CODE = ?,
       NEXT_PROCESS_CDOE = ?,
       NEXT_PROCESS_DESC = ?,
       PLINE_CODE = ?,
       PLINE_NAME = ?,   
       UPDATE_NAME = ?,
       UPDATE_TIME =TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       HTT_JUDGE_RESULT_CODE=?,
       BELONG_CODE=?,
       BELONG_NAME=?,
       MAT_GOWHERE_CODE=?,
       MAT_GOWHERE_NAME=?,
       ACT_HEIGHT=?,
       HTT_FLAG_STOVE_NO_ZG=?
 WHERE MAT_NO = ?
    ]]>
	</query>
	<query id="FrmHttInOnlineStore.queryPlanJg" desc="查询热处理计划表状态">
	<![CDATA[
	SELECT PLANSTATUS
	FROM PLN_ZY_RCL_M
	WHERE HEAT_PLAN_NO = ?
    ]]>
	</query>
	<query id="FrmHttInOnlineStore.getInListDoc" desc="查询入库单号">
	<![CDATA[
	SELECT ? || ? ||
       LPAD(SUBSTR(NVL(MAX(T.INSTOCK_DOC), '00000'), -5, 5) + 1, 5, '0') AS INSTOCK_DOC
  FROM YDM_ZC_INLIST T
 WHERE TRUNC(T.CREATE_TIME) = TO_DATE(?, 'YYYY-MM-DD')
 AND T.INSTOCK_TYPE_CODE=?
    ]]>
	</query>
	<query id="FrmHttInOnlineStore.getInListDoc1" desc="查询入库流水">
	<![CDATA[
	SELECT LPAD(SUBSTR(NVL(MAX(T.INSTOCK_SQE), '0000'), -4, 4) + 1, 4, '0') AS INSTOCK_SQE
  FROM YDM_ZC_INLIST T
 WHERE T.INSTOCK_DOC = ?
    ]]>
	</query>
	<query id="FrmHttInOnlineStore.queryStorageType" desc="查询库位信息">
	 <![CDATA[ 
SELECT T.STORAGE_ATTR,
       T.STORAGE_ATTR_NAME,
       T.STORAGE_TYPE_NO,
       T.STORAGE_TYPE_NAME,
       T.MANAGEMENT_NO,
       T.MANAGEMENT_NAME,
       T.DEPARTMENT_CODE,
       T.DEPARTMENT_DESC
  FROM YDM_BS_STORAGE T
 WHERE T.STORAGE_NO = ?
 AND T.VALIDFLAG='1'
	  ]]>
	</query>
	<query id="FrmHttInOnlineStore.updatePlnGxProSeq" desc="修改热处理订单表下一顺序号状态为生产中">
	<![CDATA[
UPDATE Pln_Order_Rcl_s T
   SET T.EXE_STATUS = ?
 WHERE T.GX_PRO_SEQ = ?
   AND T.PLINE_CODE = ?
   AND EXE_STATUS IN ('0', '1')
  ]]>
	</query>
	<query id="FrmHttInOnlineStore.queryProPlanReady" desc="查询虚拟炉计划是否为零">
	<![CDATA[
   SELECT COUNT(*) COUNT
     FROM PLN_ZY_RCL_READY T
    WHERE T.PRO_PLAN_ID = ?
      AND T.GX_PLAN_NO = ?
      AND (T.REAL_ALLOT_NUM ='0' OR T.REAL_ALLOT_NUM IS  NULL)
    ]]>
	</query>
	<query id="FrmHttInOnlineStore.queryProPlandBkS" desc="查询订单顺序号">
	<![CDATA[
 SELECT T.GX_PRO_SEQ
  FROM PLN_ORDER_RCL_S T
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
    ]]>
	</query>
	<query id="FrmHttInOnlineStore.doQueryWt" desc="查询重量">
	 <![CDATA[  
SELECT SUM(T2.ACT_WEIGHT) ACT_WEIGHT
  FROM (SELECT T.MAT_NO, T.ACT_WEIGHT
          FROM PORT_HTT_BATCH_SAMPLE_RESULT T
         WHERE T.MAT_STATUS = ?
           AND T.HEAT_PLAN_NO = ?
           AND T.IS_SAMPLE_PIPE = ?
         ORDER BY T.MAT_NO ASC) T2
 WHERE ROWNUM < ?
   ]]>
	</query>
	<query id="FrmHttInOnlineStore.UpdatePortBatch" desc="修改管号队列重量">
	<![CDATA[
UPDATE PORT_HTT_BATCH_SAMPLE_RESULT T
   SET T.ACT_WEIGHT = ?
 WHERE T.MAT_NO = ?
 AND PROCESS_SEQ = (SELECT real_process_seq FROM pln_zy_rcl_m WHERE heat_plan_no = t.heat_plan_no)
    ]]>
	</query>
	<query id="FrmHttInOnlineStore.doQueryWtMatNo" desc="查询管号队列材料号">
	 <![CDATA[  
SELECT T2.MAT_NO
  FROM (SELECT T.MAT_NO
          FROM PORT_HTT_BATCH_SAMPLE_RESULT T
         WHERE T.MAT_STATUS = ?
           AND T.HEAT_PLAN_NO = ?
           AND T.IS_SAMPLE_PIPE = ?
         ORDER BY T.MAT_NO ASC) T2
 WHERE ROWNUM < ?
   ]]>
	</query>
</queryMap>