<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="加工交库">
	<query id="FrmMchInOnlineStore.DeleteComInfoResult" desc="删除comInfo表">		
        <![CDATA[
DELETE MCH_COM_INFO
 WHERE HEAT_PLAN_NO = ?
   AND STATION_CODE = ?
   AND INSTOCK_DOC = ? 
          ]]>
	</query>
	<query id="FrmMchInOnlineStore.queryperstu" desc="查询信息表除了本工序之外的最大工序">		
        <![CDATA[
 
SELECT NVL(MAX(T.STATION_CODE),0) STATION_CODE FROM MCH_COM_INFO T WHERE T.HEAT_PLAN_NO=? AND T.STATION_CODE !=?
          ]]>
	</query>
	
		<query id="FrmMchInOnlineStore.getQueryExpandResultStuts" desc="查询相同炉计划ID下交库实绩状态">		
        <![CDATA[
 SELECT  INSTORE_FLAG  FROM PORT_MCH_BATCH_SAMPLE_RESULT
 WHERE HEAT_PLAN_NO = ? AND PLINE_CODE = ?
   AND MAT_STATUS IN ('00', '10') 
   GROUP BY INSTORE_FLAG

          ]]>
	</query>
	<query id="FrmMchInOnlineStore.UpdatePath1" desc="修改队列表工艺路径">		
        <![CDATA[
UPDATE PORT_MCH_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 T.HEAT_PLAN_NO=?
          ]]>
	</query>
		<query id="FrmMchInOnlineStore.queryGxPosition" desc="查询产线下工序的位置">
		<![CDATA[
SELECT (LENGTH(T.PRC_TECHNOLOGY_PATH) + 1) / 2 CNUM
  FROM PORT_MCH_BATCH_SAMPLE_RESULT T  WHERE T.PLINE_CODE = ?
			]]>
	</query>
	<query id="FrmMchInOnlineStore.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="FrmMchInOnlineStore.UpdatePlanResult1" desc="交库时修改计划表">		
        <![CDATA[
UPDATE PLN_ZY_JGX_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='10'
     --  STORAGE_NO2=?,
      -- STORAGE_NAME2=?
 WHERE HEAT_PLAN_NO = ?
          ]]>
	</query>
	
		<query id="FrmMchInOnlineStore.UpdatePlanResultC1" desc="交库时修改计划表从表">		
        <![CDATA[
UPDATE PLN_ZY_JGX_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="FrmMchInOnlineStore.queryperstuts" desc="查询交库时哪个工序结炉">		
        <![CDATA[
SELECT PER_STATUS FROM PLN_ZY_JGX_M WHERE HEAT_PLAN_NO = ?
          ]]>
	</query>
	
	<query id="FrmMchInOnlineStore.querymchmatno" desc="查询材料表和管号队列最大的材料号">		
        <![CDATA[
SELECT MIN(T.MAT_NO) MAT_NO
             FROM PORT_MCH_BATCH_SAMPLE_RESULT T
            WHERE T.HEAT_PLAN_NO = ?
          ]]>
	</query>
	<query id="FrmMchInOnlineStore.detelematno" desc="删除比最小材料号位数长的数据">		
        <![CDATA[
DELETE FROM MAT_ZC_M T2
    WHERE LENGTH(T2.MAT_NO) > LENGTH(?)
          ]]>
	</query>
	
	
	<query id="FrmMchInOnlineStore.UpdatePlanResult" desc="删除时修改计划表">		
        <![CDATA[
UPDATE PLN_ZY_JGX_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="FrmMchInOnlineStore.UpdatePlanResultC" desc="删除时修改计划从表">		
        <![CDATA[
UPDATE PLN_ZY_JGX_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="FrmMchInOnlineStore.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="FrmMchInOnlineStore.DeleteMatButters" desc="删除位置表">		
        <![CDATA[
DELETE YDM_ZC_BUTTRESS T
 WHERE T.MAT_NO = ?
          ]]>
	</query>
	<query id="FrmMchInOnlineStore.updateif" desc="修改管号队列是否入库的字段">		
        <![CDATA[
UPDATE PORT_MCH_BATCH_SAMPLE_RESULT
   SET INSTORE_FLAG = ?
 WHERE HEAT_PLAN_NO = ?
   AND MAT_STATUS IN ('00', '10')
             ]]>
	</query>

	<query id="FrmMchInOnlineStore.DeleteLinResult" desc="删除交库实绩表">		
        <![CDATA[
DELETE YDM_ZC_INLIST T WHERE  T.MAT_NO = ? AND T.INSTOCK_DOC = ?
          ]]>
	</query>
	<query id="FrmMchInOnlineStore.doQuery" desc="实体类查询镦拔扩计划表">
        <![CDATA[
		SELECT T.*
  FROM PLN_ZY_JGX_M T
    WHERE T.HEAT_PLAN_NO=?
        ]]>
	</query>
	
	<query id="FrmMchInOnlineStore.getQueryMatNo" desc="查询管号队列里材料号">
        <![CDATA[
	SELECT COUNT(0)
  FROM MAT_ZC_M T
 WHERE T.MAT_NO = ?
        ]]>
	</query>
	
	<query id="FrmMchInOnlineStore.doQuerymch" desc="查询加工队列">
        <![CDATA[
		SELECT T1.HEAT_PLAN_NO,T1.JUDGE_STOVE_NO,DECODE(T1.BESIDE_STATUS,
                      '00',
                      '上料结炉',
                      '01',
                      '探伤结炉',
                      '02',
                      '分切结炉',
                      '03',
                      '车丝结炉',
                      '04',
                      '螺纹检验结炉',
                      '05',
                      '拧接结炉',
                      '06',
                      '通径结炉',
                      '07','水压结炉','08','倒凌结炉','09','测量点结炉','10','交库结炉') BESIDE_STATUS FROM PLN_ZY_JGX_M T1
		WHERE 1=1
        ]]>
	</query>
	
	<query id="FrmMchInOnlineStore.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_MCH_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_MCH_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_MCH_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_MCH_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_MCH_BATCH_SAMPLE_RESULT T  ----管号队列总的支数
                    WHERE 
                      T.HEAT_PLAN_NO = T1.HEAT_PLAN_NO),
                   0) LOAD_PIECES,
               NVL((SELECT SUM(T.ACT_WEIGHT)
                     FROM PORT_MCH_BATCH_SAMPLE_RESULT T
                    WHERE 
                      T.HEAT_PLAN_NO = T1.HEAT_PLAN_NO),
                   0) LOAD_WEIGHT,
               NVL((SELECT SUM(T.ACT_COUNT)
                     FROM PORT_MCH_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_MCH_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',
                      '上料结炉',
                      '01',
                      '探伤结炉',
                      '02',
                      '分切结炉',
                      '03',
                      '车丝结炉',
                      '04',
                      '螺纹检验结炉',
                      '05',
                      '拧接结炉',
                      '06',
                      '通径结炉',
                      '07','水压结炉','08','倒凌结炉','09','测量点结炉','10','交库结炉') BESIDE_STATUS,
               DECODE(T1.PER_STATUS,
                      '00',
                      '上料开始',
                      '01',
                      '探伤开始',
                      '02',
                      '分切开始',
                      '03',
                      '车丝开始',
                      '04',
                      '螺纹检验开始',
                      '05',
                      '拧接开始',
                      '06',
                      '通径开始',
                      '07','水压开始','08','倒凌开始','09','测量点开始','10','交库开始') PER_STATUS,
               DECODE(T1.PLANSTATUS,
                      '00',
                      '计划',
                      '10',
                      '下发',
                      '20',
                      '生产中',
                      '30',
                      '生产完成',
                      '40',
                      '关闭') PLANSTATUS,
               DECODE(T1.IF_MONITOR, '0', '否', '1', '是', '否') IF_MONITOR,
               T1.CRAFT_FILE_MAN,
               T1.Craft_File_No,
               T1.CRAFT_SEQ
         FROM PLN_ZY_JGX_M T1
 WHERE 1=1
        ]]>
	</query>
	<query id="FrmMchInOnlineStore.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.PRO_BC,
       T.PRO_BZ,
       MIN(TO_CHAR(T.INSTOCK_TIME, 'YYYY-MM-DD HH24:MI:SS')) INSTOCK_TIME,
       T.IN_BC,
       T.IN_BZ,
       T.HAND_FLAG,
       T.MEMO,
       T.VALIDFLAG,
       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,
       MIN(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,
       T.CREATE_NAME
  FROM YDM_ZC_INLIST T, YDM_BS_STORAGE B, PORT_MCH_BATCH_SAMPLE_RESULT M
 WHERE T.STORAGE_NO = B.STORAGE_NO
 AND T.MAT_NO=M.MAT_NO
   AND T.AFFIRM_LOG = '1'
   AND T.INSTOCK_TYPE_CODE = '800701'		
		   ]]>
	</query>
	<query id="FrmMchInOnlineStore.doQuerySingle" desc="查询炉信息（剔除，合格，样管）">
	 <![CDATA[  
SELECT T.HEAT_PLAN_NO,
       T.LOT_NO,
       T.LOT_NO_SQE,
       DECODE(T.MAT_STATUS, '00', '合格', '15', '绝废','合格') MAT_STATUS
  FROM PORT_MCH_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_MCH_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="FrmMchInOnlineStore.queryMaxMatNo" desc="查询材料表里在制品材料号">
	 <![CDATA[  
 SELECT T1.*
  FROM (SELECT M.MAT_NO,
  			   M.PRODUCT_FLAG,
               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.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.LEN_NO,
               M.LEN_DESC,
               M.LEN_UNIT,
               M.ACT_THEORY_WEIGHT,
               M.ORD_PK,
               M.ORD_LN_PK,
               M.ORD_LN_DLY_PK,
               M.BELONG_CODE,
               M.BELONG_NAME,
               M.PRC_QCM_STAUS,
               M.SAMPLE_FLAG,
               M.PRO_ORDER_NO,
               M.PRO_ORDER_NO1,
               M.PRO_ORDER_ID,
               M.PRO_ORDER_ID1,
               M.CRAF_NO,
               M.JUGDE_APPLY_FLAG,
               M.JUGDE_APPLY_CODE,
               M.JUGDE_APPLY_TIME,
               M.FACE_RESULT_CODE,
               M.CHEM_RESULT_CODE,
               M.PHY_RESULT_CODE,
               M.DETECT_RESULT_CODE,
               M.JUDGE_RESULT_CODE,
               M.JUDGE_RESULT,
               M.JUDGE_RESULT_TIME,
               M.INSTOCK_TIME,
               M.CREATE_NAME,
               M.CREATE_TIME,
               M.JUDGE_STD_NAME,
               M.JUDGE_STD_CODE,
               M.SOURE_CODE,
               M.SOURE_NAME,
               M.PLN_GRADENAME,
               M.PLN_GRADECODE,
               M.MAT_SQE_NO,
               M.CUTTING_FLAG,
               M.ORIGIN_MAT_NO,
               M.INPUT_MATERIAL_NO,
               M.INPUT_MATERIAL_NAME,
               M.INPUT_ORIGIN_CODE,
               M.PROCESS_CDOE,
               M.PROCESS_DESC,
               M.NEXT_PROCESS_CDOE,
               M.NEXT_PROCESS_DESC,
               T.FLAG_STOVE_NO VPR_FLAG_STOVE_NO_ZG,
               M.PRC_FLAG_STOVE_NO_ZG
          FROM PORT_MCH_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="FrmMchInOnlineStore.doqueryportresult" desc="获取管号队列材料号">
	 <![CDATA[  
 select t.* from PORT_MCH_BATCH_SAMPLE_RESULT t 
  WHERE T.MAT_STATUS = ?
           AND T.HEAT_PLAN_NO = ?
           AND T.IS_SAMPLE_PIPE = ?
           AND ROWNUM < ?
         ORDER BY T.MAT_NO ASC
   ]]>
	</query>
	<query id="FrmMchInOnlineStore.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_MCH_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_MCH_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_MCH_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="FrmMchInOnlineStore.doQueryWt" desc="查询重量">
	 <![CDATA[  
SELECT SUM(T2.ACT_WEIGHT) ACT_WEIGHT
  FROM (SELECT T.MAT_NO, T.ACT_WEIGHT
          FROM PORT_MCH_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="FrmMchInOnlineStore.doQueryWtMatNo" desc="查询管号队列材料号">
	 <![CDATA[  
SELECT T2.MAT_NO
  FROM (SELECT T.MAT_NO
          FROM PORT_MCH_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="FrmMchInOnlineStore.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.PRC_FLAG_STOVE_NO_ZG,
               M.VRP_PLINE_CODE,
               M.VRP_PLINE_NAME,
               M.HTT_PLINE_CODE,
               M.HTT_PLINE_NAME
          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="FrmMchInOnlineStore.queryMaxMatNogai" desc="查询位置表材料号">
	 <![CDATA[  
SELECT T1.*
  FROM (SELECT T.MAT_NO      
          FROM YDM_ZC_INLIST T, PORT_MCH_BATCH_SAMPLE_RESULT M
         WHERE  t.MAT_NO = m.MAT_NO
         group by t.mat_no
         ORDER BY T.MAT_NO ASC) T1
 WHERE ROWNUM < ?

   ]]>
	</query>

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

   ]]>
	</query>
	<query id="FrmMchInOnlineStore.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 = 'G'
   ]]>
	</query>
	<query id="FrmMchInOnlineStore.querystatus" desc="查询公共信息表里交库工序状态">
	 <![CDATA[  
SELECT DISTINCT T.STATION_STATUS,T.BELONG_CODE,T.BELONG_NAME
  FROM MCH_COM_INFO T
 WHERE T.STATION_CODE = ?
   AND T.HEAT_PLAN_NO = ?
   ]]>
	</query>
	<query id="FrmMchInOnlineStore.qureyGxComInfo" desc="查询公共信息表工序点状态">
		<![CDATA[
SELECT  STATION_STATUS,STATION_DESC,STATION_CODE
  FROM MCH_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="FrmMchInOnlineStore.queryExpandMaxRESULT" desc="查询最大实绩编号">
		<![CDATA[
SELECT ? ||
       LPAD(SUBSTR(NVL(MAX(T.RESULT_NO), '000000'), -6, 6) + 1, 6, '0') AS RESULT_NO
  FROM MCH_com_info T
 WHERE TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD') = ?
   AND T.PLINE_CODE = ?
   and t.STATION_CODE=?		
   ]]>
	</query>
	<query id="FrmMchInOnlineStore.queryPlanJg1" desc="查询已交库量">
		<![CDATA[
SELECT NVL(SUM(T1.ACT_COUNT), 0) ACT_COUNT
  FROM PORT_MCH_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="FrmMchInOnlineStore.AddComInfoResult" desc="新增公共信息">
		<![CDATA[
DECLARE
BEGIN
  FOR MYROW IN (SELECT T.* FROM PLN_ZY_JGX_M T WHERE T.HEAT_PLAN_NO = ?) LOOP
    INSERT INTO MCH_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,
       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_MCH,
       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,
       CREATET_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.STEELCODE,
       MYROW.STEELNAME,
       ?,
       ?,
       ?,
       ?,
       ?,
       ?,
       ?,
       ?,
       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="FrmMchInOnlineStore.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="FrmMchInOnlineStore.UpdateMatNo" desc="新增材料表">
		<![CDATA[
	INSERT INTO MAT_ZC_M (MAT_NO,PRODUCT_FLAG,MAT_STATUS,LOT_NO,STOVE_NO,JUDGE_STOVE_NO,
	BATCH_NO,BATCH_GROUD_NO,MAT_SQE_NO,SAMPLE_FLAG,CUTTING_FLAG,ORIGIN_MAT_NO,MATERIAL_NO,
	MATERIAL_NAME,INPUT_MATERIAL_NAME,INPUT_MATERIAL_NO,INPUT_ORIGIN_CODE,PRODUCCODE,
	PRODUCNAME,STEELCODE,STEELNAME,GRADECODE,GRADENAME,SPEC_CODE,SPEC_NAME,MODEL_CODE,
	MODEL_DESC,STD_CODE,STD_NAME,STD_STYLE,STD_STYLE_DESC,PRO_ORDER_NO,PRO_ORDER_NO1,
	PRO_ORDER_ID,PRO_ORDER_ID1,ORDER_NO,ORDER_SEQ,ORDER_SEQ_NO,CRAF_NO,PROCESS_CDOE,PROCESS_DESC,
	NEXT_PROCESS_CDOE,NEXT_PROCESS_DESC,PLINE_CODE,PLINE_NAME,MAT_ORIGIN_CODE,MAT_ORIGIN_NAME,
	ACT_DIMATER,ACT_HEIGHT,ACT_LEN,PRC_QCM_STAUS,PRC_SPEC_RESULT_CODE,PRC_CHEM_RESULT_CODE,
	PRC_FACE_RESULT_CODE,PRC_PHY_RESULT_CODE,PRC_JUDGE_RESULT_CODE,MAT_GOWHERE_CODE,MAT_GOWHERE_NAME,
	PRC_FLAG_STOVE_NO_ZG,BELONG_CODE,BELONG_NAME,UPDATE_TIME,UPDATE_NAME,PRC_CRAF_NO,PRC_SAMPLE_FLAG,
	PRC_LOT_NO,PRC_PRO_ORDER_NO,PRC_PRO_ORDER_ID,PRC_HEAT_PLAN_NO,PRC_GX_PLAN_NO,PRC_PLINE_CODE,PRC_PLINE_NAME,
	ACT_LEN_MIN,ACT_LEN_MAX,ACT_COUNT,ACT_WEIGHT,JUGDE_APPLY_FLAG,JUGDE_APPLY_CODE,JUGDE_APPLY_TIME,FACE_RESULT_CODE,
	CHEM_RESULT_CODE,PHY_RESULT_CODE,DETECT_RESULT_CODE,JUDGE_RESULT_CODE,JUDGE_RESULT,JUDGE_RESULT_TIME,INSTOCK_TIME,
	CREATE_NAME,CREATE_TIME,ORD_PK,ORD_LN_PK,ORD_LN_DLY_PK,JUDGE_STD_NAME,JUDGE_STD_CODE,SOURE_CODE,SOURE_NAME,
	PLN_GRADENAME,PLN_GRADECODE) 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'),
	?,TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'),? ,? ,? , ? ,? ,? ,? ,? ,?)
		]]>
	</query>
	
	<query id="FrmMchInOnlineStore.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="FrmMchInOnlineStore.updatePln" desc="回写镦拔扩计划表">
	<![CDATA[
  UPDATE PLN_ZY_JGX_M
     SET PLANSTATUS = ?, BESIDE_STATUS = ?
   WHERE HEAT_PLAN_NO = ?
    ]]>
	</query>
	<query id="FrmMchInOnlineStore.updatePlnGxProSeq" desc="修改镦拔扩订单表下一顺序号状态为生产中">
	<![CDATA[
UPDATE PLN_ORDER_JGX_S T SET T.EXE_STATUS = ? WHERE T.GX_PRO_SEQ = ? AND T.PLINE_CODE=? AND EXE_STATUS IN('0','1')
    ]]>
	</query>
	<query id="FrmMchInOnlineStore.updatePlnId" desc="回写镦拔扩订单表">
	<![CDATA[
  UPDATE PLN_ORDER_JGX_S T
     SET T.EXE_STATUS = ?, PLAN_TIME_E = TO_DATE(?,'YYYY-MM-DD HH24:MI:SS')
   WHERE T.PRO_PLAN_ID = ?
     AND T.GX_PLAN_NO = ?
     AND T.EXE_STATUS<>'3'
    ]]>
	</query>
	<query id="FrmMchInOnlineStore.deletePlnId" desc="撤销结炉回写">
	<![CDATA[
  UPDATE PLN_ORDER_JGX_S T
     SET T.EXE_STATUS = ?, PLAN_TIME_E = ''
   WHERE T.PRO_PLAN_ID = ?
     AND T.GX_PLAN_NO = ?
    ]]>
	</query>
	<query id="FrmMchInOnlineStore.queryProPlanID" desc="查询订单向下的炉计划">
	<![CDATA[
  SELECT COUNT(*) COUNT
    FROM PLN_ZY_JGX_M T
   WHERE T.PRO_PLAN_ID = ?
     AND T.GX_PLAN_NO = ?
     AND T.PLANSTATUS IN ('00', '10', '20')
    ]]>
	</query>
	<query id="FrmMchInOnlineStore.queryProPlanReady" desc="查询虚拟炉计划是否为零">
	<![CDATA[
   SELECT COUNT(*) COUNT
     FROM PLN_ZY_JGX_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="FrmMchInOnlineStore.queryProPlandBkS" desc="查询排产表排产顺序">
	<![CDATA[
 SELECT T.GX_PRO_SEQ
  FROM PLN_ORDER_JGX_S T
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
    ]]>
	</query>
	<query id="FrmMchInOnlineStore.UpdateLibraryResult" desc="修改材料表里的材料类别为成品">
	<![CDATA[
	UPDATE MAT_ZC_M SET PRODUCT_FLAG ='801402',MAT_STATUS = '80150201' 
	WHERE JUDGE_STOVE_NO = ?
	AND BATCH_NO = ?
    ]]>
	</query>
	<query id="FrmMchInOnlineStore.AddMatM" desc="末工序修改料表">
	<![CDATA[
UPDATE MAT_ZC_M
   SET PRODUCT_FLAG = ?,
       MAT_STATUS   = ?,
       PROCESS_CDOE = ?,
       PROCESS_DESC = ?,
       PRC_PLINE_CODE = ?,
       PRC_PLINE_NAME = ?, 
       PRC_FACE_RESULT_CODE = ?,
       PRC_CHEM_RESULT_CODE = ?,
       PRC_GX_PLAN_NO = ?,
       PRC_GX_PLAN_NO1 = ?,
       PRC_SPEC_RESULT_CODE = ?,
       PRC_QCM_STAUS = ?,
       PRC_HEAT_PLAN_NO = ?,
       PRC_PRO_ORDER_ID = ?,
       PRC_PRO_ORDER_ID1 = ?,
       PRC_PRO_ORDER_NO = ?,
       PRC_PRO_ORDER_NO1 = ?,
       PRC_LOT_NO = ?,
       PRC_PHY_RESULT_CODE = ?,
       PRC_SAMPLE_FLAG = ?,
       PRC_CRAF_NO = ?,
       PRC_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'),
       PRC_JUDGE_RESULT_CODE=?,
       BELONG_CODE=?,
       BELONG_NAME=?,
       MAT_GOWHERE_CODE=?,
       MAT_GOWHERE_NAME=?,
       PRC_FLAG_STOVE_NO_ZG=?
 WHERE MAT_NO = ?
    ]]>
	</query>
	<query id="FrmMchInOnlineStore.queryPlanJg" desc="查询镦拔扩计划表状态">
	<![CDATA[
	SELECT PLANSTATUS --,GX_NAME_LAST
	FROM PLN_ZY_JGX_M
	WHERE HEAT_PLAN_NO = ?
    ]]>
	</query>
	<query id="FrmMchInOnlineStore.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="FrmMchInOnlineStore.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="FrmMchInOnlineStore.UpdatePortBatch" desc="修改管号队列重量">
	<![CDATA[
UPDATE PORT_MCH_BATCH_SAMPLE_RESULT T
   SET T.ACT_WEIGHT = ?
 WHERE T.MAT_NO = ?
    ]]>
	</query>
	<query id="FrmMchInOnlineStore.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>
</queryMap>