<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="旋扩实绩">
	<query id="FrmVrpExpandResult.getQueryFallResion" desc="查询废品原因">
        <![CDATA[
        SELECT T.BASECODE,T.BASENAME FROM COM_BASE_INFO T WHERE T.SORTCODE=? AND T.VALIDFLAG='1'
          ]]>
	</query>
	<query id="FrmVrpExpandResult.getQueryExpandResult" desc="查询旋扩实绩">
        <![CDATA[
    SELECT T.RESULT_NO,
       T.HEAT_PLAN_NO,
       T.ZY_BATCH_ID,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.SPEC_CODE,
       T.SPEC_NAME,
       T.DIMATER,
       T.HEIGHT,
       T.HOL_DIMATER,
       T.HOL_HEIGHT,
       T.ROLL_DISTANCE,
       T.GUIDE_DISTANCE,
       T.PLUG_SIZE,
       T.PLUG_BAR_D,
       T.PLUG_POSITION,
       T.MOTOR_SPEED,
       T.PRO_NUM,
       T.PRO_WT,
       T.FAIL_NUM,
       T.FAIL_WT,
       T.FAIL_REASON,
       T.OFFLINE_NUM,
       T.OFFLINE_WT,
       T.RE_NUM,
       T.RE_WT,
       T.MONITORDEMAND,
       DECODE(T.IF_MONITOR_DBK,'1','是','0','否') IF_MONITOR_DBK,
       T.PRODUCER,
       T.PRDCR_NO,
       TO_CHAR(T.PRODUCER_TIME, 'YYYY-MM-DD HH24:MI:SS') PRODUCER_TIME,
       TO_CHAR(T.LOAD_TIME, 'YYYY-MM-DD HH24:MI:SS') LOAD_TIME,
       T.LOAD_SHIFT,
       T.LOAD_GROUP,
       T.LOAD_USER,
       T.COL_MODE,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       T.UPDATE_NAME,
       DECODE(B.STATION_STATUS, '1', '生产中', '2', '生产完成') STATION_STATUS
  FROM VRP_EXPAND_RESULT T INNER JOIN VRP_COM_INFO B ON T.RESULT_NO=B.RESULT_NO
 WHERE T.HEAT_PLAN_NO = ?
        ]]>
	</query>

	<query id="FrmVrpExpandResult.getQueryExpandResult1" desc="查询旋扩实绩合格支数的和">
        <![CDATA[
   SELECT NVL(SUM(T.PRO_NUM), 0) PRO_NUM FROM VRP_EXPAND_RESULT T
   WHERE T.HEAT_PLAN_NO = ?
        ]]>
	</query>
	<query id="FrmVrpExpandResult.queryOffMaxRESULT" desc="查询离线最大实绩编号">
		<![CDATA[
SELECT ? ||
       LPAD(SUBSTR(NVL(MAX(T.RESULT_NO), '000000'), -6, 6) + 1, 6, '0') AS RESULT_NO
  FROM VRP_OFFLINE_RESULT T
 WHERE T.PRO_YEAR_MONTH_DAY = ?
   AND T.PLINE_CODE = ?
   AND T.RESULT_NO LIKE ? || '%'
		]]>
	</query>
	<query id="FrmVrpExpandResult.queryExpandMaxRESULT" desc="查询最大实绩编号">
		<![CDATA[
SELECT ? ||
       LPAD(SUBSTR(NVL(MAX(T.RESULT_NO), '000000'), -6, 6) + 1, 6, '0') AS RESULT_NO
  FROM VRP_EXPAND_RESULT T
 WHERE TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD') = ?
   AND T.PLINE_CODE = ?
		]]>
	</query>
	<query id="FrmVrpExpandResult.AddExpandResult" desc="新增旋扩实绩">
		<![CDATA[
		INSERT INTO VRP_EXPAND_RESULT (RESULT_NO, HEAT_PLAN_NO, ZY_BATCH_ID, 
PRO_PLAN_ID, GX_PLAN_NO, PLINE_CODE, PLINE_NAME, DIMATER, 
HEIGHT, HOL_DIMATER, HOL_HEIGHT, ROLL_DISTANCE, GUIDE_DISTANCE, PLUG_SIZE, 
PLUG_BAR_D, PLUG_POSITION, MOTOR_SPEED, PRO_NUM, PRO_WT, FAIL_NUM, FAIL_WT, 
FAIL_REASON, OFFLINE_NUM, OFFLINE_WT, RE_NUM, RE_WT, MONITORDEMAND, 
IF_MONITOR_DBK, PRODUCER, PRDCR_NO, PRODUCER_TIME, LOAD_TIME, LOAD_SHIFT, 
LOAD_GROUP, LOAD_USER, COL_MODE, CREATE_TIME) 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'))
		]]>
	</query>
	<query id="FrmVrpExpandResult.AddComInfoResult" desc="新增公共信息">
		<![CDATA[
INSERT INTO VRP_COM_INFO (RESULT_NO, HEAT_PLAN_NO, STATION_CODE, STATION_DESC, 
PLINE_CODE, PLINE_NAME, ZY_BATCH_ID, PRO_PLAN_ID, GX_PLAN_NO, IF_MONITOR_DBK, 
PRDCR_NO, MONITORDEMAND, PRODUCER, PRODUCER_TIME, CRAFT_FILE_NO, CRAFT_FILE_MAN, 
CRAFT_SEQ, JUDGE_STOVE_NO, BATCH_NO, BATCH_GROUD_NO, GRADECODE, GRADENAME,  LEN, 
DIMATER, PLN_LEN,  HEIGHT, LEN_MIN, LEN_MAX, LEN_CUT_HEAD, LEN_CUT_END,PLN_DIMATER,
PLN_HEIGHT, ACT_MATERIAL_NO, 
ACT_MATERIAL_NAME, IN_WL_ID, IN_WL_DESC, PRO_NUM, PRO_WT, FAIL_NUM, FAIL_WT, 
OFFLINE_NUM, OFFLINE_WT, RE_NUM, RE_WT, STATION_STATUS, RRO_TIME, RRO_TIME_NU, 
PRO_USER, PRO_SHIFT, PRO_GROUP, CREATE_TIME, COL_OPERATOR,STEELCODE,STEELNAME,SPEC_CODE,SPEC_NAME) VALUES (?, ?, ?, (SELECT BASENAME FROM COM_BASE_INFO  WHERE BASECODE=? ),
?, ?, ?, ?, ?, ?, ?, ?, ?, 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="FrmVrpExpandResult.AddComInfoResultoffline" desc="离线时新增公共信息">
		<![CDATA[
INSERT INTO VRP_COM_INFO (RESULT_NO, HEAT_PLAN_NO, STATION_CODE, STATION_DESC, 
PLINE_CODE, PLINE_NAME, ZY_BATCH_ID, PRO_PLAN_ID, GX_PLAN_NO, IF_MONITOR_DBK, 
PRDCR_NO, MONITORDEMAND, PRODUCER, PRODUCER_TIME, CRAFT_FILE_NO, CRAFT_FILE_MAN, 
CRAFT_SEQ, JUDGE_STOVE_NO, BATCH_NO, BATCH_GROUD_NO, GRADECODE, GRADENAME,  LEN, 
DIMATER, PLN_LEN,  HEIGHT, LEN_MIN, LEN_MAX, LEN_CUT_HEAD, LEN_CUT_END,PLN_DIMATER,
PLN_HEIGHT, ACT_MATERIAL_NO, 
ACT_MATERIAL_NAME, IN_WL_ID, IN_WL_DESC, PRO_NUM, PRO_WT, FAIL_NUM, FAIL_WT, 
OFFLINE_NUM, OFFLINE_WT, RE_NUM, RE_WT, STATION_STATUS, RRO_TIME, RRO_TIME_NU, 
PRO_USER, PRO_SHIFT, PRO_GROUP, CREATE_TIME, COL_OPERATOR) 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'), ?)	
		]]>
	</query>
	<query id="FrmVrpExpandResult.deleteVrpExpandResult" desc="删除旋扩实绩">
		<![CDATA[
		DELETE VRP_EXPAND_RESULT WHERE RESULT_NO = ?		
		]]>
	</query>
	<query id="FrmVrpExpandResult.deleteComInfoResult" desc="删除公共信息">
		<![CDATA[
		DELETE VRP_COM_INFO WHERE RESULT_NO = ?		
		]]>
	</query>
	<query id="FrmVrpExpandResult.updateVrpExpandResult" desc="修改旋扩实绩">
		<![CDATA[		
	UPDATE VRP_EXPAND_RESULT
   SET HOL_DIMATER    = ?,
       HOL_HEIGHT     = ?,
       ROLL_DISTANCE  = ?,
       GUIDE_DISTANCE = ?,
       PLUG_SIZE      = ?,
       PLUG_BAR_D     = ?,
       PLUG_POSITION  = ?,
       MOTOR_SPEED    = ?,
       PRO_NUM        = ?,
       PRO_WT         = ?,
       FAIL_NUM       = ?,
       FAIL_WT        = ?,
       FAIL_REASON    = ?,
       PRODUCER       = ?,
       PRODUCER_TIME  = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       LOAD_TIME      = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       LOAD_SHIFT     = ?,
       LOAD_GROUP     = ?,
       UPDATE_TIME    = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       UPDATE_NAME    = ?
 WHERE RESULT_NO = ?	
			]]>
	</query>
	<query id="FrmVrpExpandResult.updateComInfoResult" desc="修改公共信息">
		<![CDATA[
UPDATE VRP_COM_INFO
   SET PRODUCER      = ?,
       PRODUCER_TIME = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       PRO_NUM       = ?,
       PRO_WT        = ?,
       FAIL_NUM      = ?,
       FAIL_WT       = ?,
       RRO_TIME      = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       PRO_SHIFT     = ?,
       PRO_GROUP     = ?
 WHERE RESULT_NO = ?
		]]>
	</query>
	<query id="FrmVrpExpandResult.selectComInfo" desc="查询是否有当前工序">
		<![CDATA[
SELECT COUNT(*) COUNT FROM VRP_COM_INFO
WHERE HEAT_PLAN_NO = ?
 AND PLINE_CODE = ?
 AND STATION_CODE = ?
			]]>
	</query>
	<query id="FrmVrpExpandResult.qureyGxComInfo" desc="查询工序是否是结炉状态">
		<![CDATA[
SELECT DISTINCT STATION_STATUS
  FROM VRP_COM_INFO
 WHERE HEAT_PLAN_NO = ?
   AND PLINE_CODE = ?
   AND STATION_CODE = ?
			]]>
	</query>

	<query id="FrmVrpExpandResult.qureyGxComInfo1" desc="查询是否是组炉状态">
		<![CDATA[
	SELECT GROUP_FLAG FROM PORT_VRP_BATCH_SAMPLE_RESULT 
	WHERE HEAT_PLAN_NO = ?
   AND PLINE_CODE = ?
			]]>
	</query>
	<query id="FrmVrpExpandResult.doBeside" desc="修改工序状态为结炉">
		<![CDATA[
		UPDATE VRP_COM_INFO
 SET STATION_STATUS = '2'
WHERE HEAT_PLAN_NO = ?
 AND PLINE_CODE = ?
 AND STATION_CODE = ?
			]]>
	</query>
	<query id="FrmVrpExpandResult.deleteBeside" desc="修改工序状态撤销结炉">
		<![CDATA[
		UPDATE VRP_COM_INFO
 SET STATION_STATUS = '1'
WHERE HEAT_PLAN_NO = ?
 AND PLINE_CODE = ?
 AND STATION_CODE = ?
			]]>
	</query>

	<query id="FrmVrpExpandResult.queryExpandNUM" desc="查询管号队列里合格的材料号">
		<![CDATA[
	SELECT T1.MAT_NO
  FROM (SELECT T.MAT_NO
          FROM PORT_VRP_BATCH_SAMPLE_RESULT T
         WHERE T.MAT_STATUS = '00'
           AND T.IS_SAMPLE_PIPE='0'
           AND T.INSTORE_FLAG= '0'
           AND T.HEAT_PLAN_NO = ?
         ORDER BY T.MAT_NO ASC) T1
 WHERE ROWNUM<?
			]]>
	</query>

	<query id="FrmVrpExpandResult.queryExpandNUM2" desc="查询废品材料信息">
		<![CDATA[
	SELECT T1.MAT_NO
  FROM (SELECT T.MAT_NO
          FROM PORT_VRP_BATCH_SAMPLE_RESULT T
         WHERE T.MAT_STATUS = '10'
           AND T.HEAT_PLAN_NO = ?
             AND T.OP_PROCESS=?
         ORDER BY T.MAT_NO ASC) T1
 WHERE ROWNUM<?
			]]>
	</query>


	<query id="FrmVrpExpandResult.queryExpandFailNUM" desc="查询管号队列废品数量">
		<![CDATA[
		SELECT NVL(SUM(T.ACT_COUNT),0) ACT_COUNT
  FROM PORT_VRP_BATCH_SAMPLE_RESULT T
 WHERE T.MAT_STATUS = '10'
   AND T.HEAT_PLAN_NO = ?
   AND T.OP_PROCESS = ?
		
			]]>
	</query>
	<query id="FrmVrpExpandResult.queryPortVrpBatchHg" desc="查询合格支">
		<![CDATA[
		SELECT NVL(SUM(T.ACT_COUNT),0) ACT_COUNT
  FROM PORT_VRP_BATCH_SAMPLE_RESULT T
 WHERE T.MAT_STATUS = '00'
   AND T.HEAT_PLAN_NO = ?
   AND T.INSTORE_FLAG = '0'
			]]>
	</query>
	<query id="FrmVrpExpandResult.AddComInfoResult1" desc="修改材料状态和工序编码">
		<![CDATA[
UPDATE PORT_VRP_BATCH_SAMPLE_RESULT T SET T.MAT_STATUS=?,T.OP_PROCESS=?
WHERE T.HEAT_PLAN_NO=? AND T.MAT_NO=?
			]]>
	</query>

	<query id="FrmVrpExpandResult.queryExpandFailNUM1" desc="查询工序废品数量">
		<![CDATA[
		SELECT NVL(SUM(T.FAIL_NUM),0) FAIL_NUM FROM VRP_EXPAND_RESULT T
WHERE  T.HEAT_PLAN_NO=? 
			]]>
	</query>
	<query id="FrmVrpExpandResult.UpdatePath" desc="修改队列表工艺路径">
		<![CDATA[
UPDATE PORT_VRP_BATCH_SAMPLE_RESULT T
   SET T.PRC_TECHNOLOGY_PATH = SUBSTR(T.PRC_TECHNOLOGY_PATH, 1,2) || ? ||
                               SUBSTR(T.PRC_TECHNOLOGY_PATH,4, LENGTH(T.PRC_TECHNOLOGY_PATH))
 WHERE T.HEAT_PLAN_NO = ?
 AND MAT_STATUS='00'
			]]>
	</query>

	<query id="FrmVrpExpandResult.UpdatePln" desc="新增修改计划表状态">
		<![CDATA[
 UPDATE PLN_ZY_DBK_M
    SET  PER_STATUS = '10'
  WHERE HEAT_PLAN_NO = ?
			]]>
	</query>

	<query id="FrmVrpExpandResult.UpdatePln1" desc="撤销修改计划表状态">
		<![CDATA[
 UPDATE PLN_ZY_DBK_M
    SET  PER_STATUS = '00'
  WHERE HEAT_PLAN_NO = ?
			]]>
	</query>

	<query id="FrmVrpExpandResult.plnupdate" desc="结炉修改计划表状态">
		<![CDATA[
 UPDATE PLN_ZY_DBK_M
    SET  BESIDE_STATUS = '10'
  WHERE HEAT_PLAN_NO = ?
			]]>
	</query>

	<query id="FrmVrpExpandResult.plnupdate1" desc="撤销结庐修改计划表状态">
		<![CDATA[
 UPDATE PLN_ZY_DBK_M
    SET  BESIDE_STATUS = '00'
  WHERE HEAT_PLAN_NO = ?
			]]>
	</query>

	<query id="FrmVrpExpandResult.queryPortVrpResult" desc="查询管号队列支，吨">
		<![CDATA[
SELECT NVL(SUM(T.ACT_COUNT), 0) ACT_COUNT,
       NVL(SUM(T.ACT_WEIGHT), 0) ACT_WEIGHT
  FROM PORT_VRP_BATCH_SAMPLE_RESULT T
 WHERE T.HEAT_PLAN_NO = ?
 AND T.MAT_STATUS='00'
			]]>
	</query>
	<query id="FrmVrpExpandResult.queryPortVrpHg" desc="查询管号队列合格数据">
		<![CDATA[
	SELECT T1.*
  FROM (SELECT T.HEAT_PLAN_NO,
               T.MAT_NO,
               T.M_MAT_NO,
               T.M_M_MAT_NO,
               T.LOT_NO,
               T.LOT_NO_SQE,
               T.PLINE_CODE,
               T.PLINE_NAME,
               T.JUDGE_STOVE_NO,
               T.BATCH_NO,
               T.GROUP_NO,
               T.STOVE_NO,
               T.ACT_DIMATER,
               T.ACT_HEIGHT,
               T.ACT_LEN,
               T.ACT_LEN_MIN,
               T.ACT_LEN_MAX,
               T.ACT_COUNT,
               T.ACT_WEIGHT,
               T.ACT_THEORY_WEIGHT,
               T.IS_SAMPLE_PIPE,
               T.SAMPLE_PIPE_LEN,
               T.GET_SAMPLE_SHIFT,
               T.GET_SAMPLE_CLASS,
               T.GET_SAMPLE_NAME,
               T.GET_SAMPLE_TIME,
               T.OLD_JUDGE_STOVE_NO,
               T.GROUP_FLAG,
               T.OP_PROCESS,
               T.MAT_STATUS,
               T.LEVE_LOG,
               T.INSTORE_FLAG,
               T.PRO_USER,
               T.PRO_SHIFT,
               T.PRO_GROUP,
               T.PRO_TIME,
               T.REMARK,
               T.PRC_TECHNOLOGY_PATH
          FROM PORT_VRP_BATCH_SAMPLE_RESULT T
         WHERE T.MAT_STATUS = '00'
           AND T.HEAT_PLAN_NO = ?
           AND T.JUDGE_STOVE_NO = ?
           AND T.BATCH_NO = ?
           AND T.GROUP_NO = ?
           AND T.INSTORE_FLAG = '0'
         ORDER BY T.MAT_NO ASC) T1
 WHERE ROWNUM < ?
			]]>
	</query>


	<query id="FrmVrpExpandResult.queryPortVrpHg2" desc="查询管号队列合格数据">
		<![CDATA[
	SELECT T1.*
  FROM (SELECT *
          FROM PORT_VRP_BATCH_SAMPLE_RESULT T
         WHERE T.MAT_STATUS = '00'
           AND T.IS_SAMPLE_PIPE = '0'
           AND T.HEAT_PLAN_NO = ?
           AND T.JUDGE_STOVE_NO = ?
           AND T.PHY_BATCH_NO = ?
           AND INSTORE_FLAG = '0'
         ORDER BY T.MAT_NO ASC) T1
 WHERE ROWNUM < ?
			]]>
	</query>

	<query id="FrmVrpExpandResult.UpdatePathPortVrp" desc="修改队列表工艺路径，材料状态，工序状态,离线状态">
		<![CDATA[
UPDATE PORT_VRP_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.MAT_STATUS          = ?,
       T.LEVE_LOG            = ?,
       T.OP_PROCESS          = ?,
       T.RESULT_NO           = ?
 WHERE T.HEAT_PLAN_NO = ?
   AND T.MAT_NO=?
   AND MAT_STATUS = '00'

			]]>
	</query>
	<query id="FrmVrpExpandResult.AddOffLine" desc="新增离线实绩">
		<![CDATA[
INSERT INTO VRP_OFFLINE_RESULT T
  (RESULT_NO,
   HEAT_PLAN_NO,
   STATION_CODE,
   STATION_DESC,
   PLINE_CODE,
   PLINE_NAME,
   ZY_BATCH_ID,
   PRO_PLAN_ID,
   GX_PLAN_NO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   PRODUCCODE,
   PRODUCNAME,
   STEELCODE,
   STEELNAME,
   GRADECODE,
   GRADENAME,
   MODEL_CODE,
   MODEL_DESC,
   STD_CODE,
   STD_NAME,
   STD_STYLE,
   STD_STYLE_DESC,
   ACT_DIMATER,
   ACT_HEIGHT,
   ACT_LEN,
   ACT_LEN_MIN,
   ACT_LEN_MAX,
   OFFLINE_NUM,
   OFFLINE_WT,
   PRO_TIME,
   PRO_USER,
   PRO_SHIFT,
   PRO_GROUP,
   ORD_LN_DLY_PK,
   ORDER_NO,
   ORDER_SEQ,
   DELIVERY_NO,
   BATCH_GROUD_NO,
   FLAG_STOVE_NO,
   MEMO,
   LOAD_JUDGE_STOVE_NO)
VALUES
  (?,
   ?,
   ?,
   (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = ?),
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?)

			]]>
	</query>

	<query id="FrmVrpExpandResult.MarkUnCancelFlag" desc="标记无法撤销返线">
		<![CDATA[
UPDATE VRP_OFFLINE_RESULT T
   SET FLAG = '1'
 WHERE T.HEAT_PLAN_NO = ?
   AND JUDGE_STOVE_NO =?
   AND NVL(BATCH_NO,'') = ?
   AND  NVL(BATCH_GROUD_NO,'') = ?
   AND STATION_CODE = ?
   AND (TO_NUMBER(NVL(T.OFFLINE_NUM, 0)) - TO_NUMBER(NVL(T.GROUP_NUM, 0)) -
       TO_NUMBER(NVL(T.RE_NUM, 0)) - TO_NUMBER(NVL(T.SUBCONTRACT_NUM, 0)) +
       TO_NUMBER(NVL(T.SUBCONTRACTCOMPLETE_NUM, 0))) <=  0
			]]>
	</query>

	<query id="FrmVrpExpandResult.AddYdmInList" desc="新增镦拔扩入库表">
		<![CDATA[
	INSERT INTO YDM_BC_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) 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="FrmVrpExpandResult.UpdateMatNo" desc="修改材料表">
		<![CDATA[
UPDATE MAT_BC_BACKUP T SET T.MAT_STATUS = ? WHERE T.MAT_NO = ?
			]]>
	</query>
	<query id="FrmVrpExpandResult.getQueryDbkPortVrp" desc="墩拔库管号队列查询">
		<![CDATA[
		SELECT T.HEAT_PLAN_NO,
       T.MAT_NO,
       T.M_MAT_NO,
       T.M_M_MAT_NO,
       T.LOT_NO,
       T.LOT_NO_SQE,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.GROUP_NO,
       T.STOVE_NO,
       T.FLAG_STOVE_NO,
       T.ACT_DIMATER,
       T.ACT_HEIGHT,
       T.ACT_LEN,
       T.ACT_LEN_MIN,
       T.ACT_LEN_MAX,
       T.ACT_COUNT,
       T.ACT_WEIGHT,
       T.ACT_THEORY_WEIGHT,
       DECODE(T.IS_SAMPLE_PIPE, '0', '否', '1', '是') IS_SAMPLE_PIPE,
       T.SAMPLE_PIPE_LEN,
       T.GET_SAMPLE_SHIFT,
       T.GET_SAMPLE_CLASS,
       T.GET_SAMPLE_NAME,
       TO_CHAR(T.GET_SAMPLE_TIME, 'YYYY-MM-DD HH24:MI:SS') GET_SAMPLE_TIME,
       T.OLD_JUDGE_STOVE_NO,
       DECODE(T.GROUP_FLAG, '0', '未组炉', '1', '组炉') GROUP_FLAG,
       (SELECT T1.BASENAME
          FROM COM_BASE_INFO T1
         WHERE T1.BASECODE = T.OP_PROCESS
           AND T1.VALIDFLAG = '1') OP_PROCESS,
       DECODE(T.MAT_STATUS, '00', '合格', '10', '剔除', '20', '待处理') MAT_STATUS,
       DECODE(T.LEVE_LOG, '00', '无', '10', '离线', '20', '返线') LEVE_LOG,
       DECODE(T.INSTORE_FLAG, '0', '未入库', '1', '已入库') INSTORE_FLAG,
       T.PRO_USER,
       DECODE(T.PRO_SHIFT, 1, '早', 2, '中', 3, '夜', 0, '常白') PRO_SHIFT,
       DECODE(T.PRO_GROUP, 1, '甲', 2, '乙', 3, '丙', 4, '丁') PRO_GROUP,
       TO_CHAR(T.PRO_TIME, 'YYYY-MM-DD HH24:MI:SS') PRO_TIME,
       T.REMARK,
       T.PRC_TECHNOLOGY_PATH
  FROM PORT_VRP_BATCH_SAMPLE_RESULT T
 WHERE T.HEAT_PLAN_NO = ?
 ORDER BY T.MAT_NO ASC	
			]]>
	</query>
	<query id="FrmVrpExpandResult.getInListDoc1" desc="查询入库流水">
	<![CDATA[
	SELECT LPAD(SUBSTR(NVL(MAX(T.INSTOCK_SQE), '0000'), -4, 4) + 1, 4, '0') AS INSTOCK_SQE
  FROM YDM_BC_INLIST T
 WHERE T.INSTOCK_DOC = ?
    ]]>
	</query>
	<query id="FrmVrpExpandResult.getInListDoc" desc="查询入库单号">
	<![CDATA[
	SELECT ? || ? ||
       LPAD(SUBSTR(NVL(MAX(T.INSTOCK_DOC), '00000'), -5, 5) + 1, 5, '0') AS INSTOCK_DOC
  FROM YDM_BC_INLIST T
 WHERE TRUNC(T.CREATE_TIME) = TO_DATE(?, 'YYYY-MM-DD')
 AND T.INSTOCK_TYPE_CODE=?
    ]]>
	</query>
	<query id="FrmVrpExpandResult.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="FrmVrpExpandResult.AddConLoag" desc="新增调度信息">
	 <![CDATA[ 
	 INSERT INTO VRP_CONTROL_LOG (LOGS_BEG, PLINE_CODE, JUDGE_STOVE_NO, LOT_NO, 
CONTRACT_NO, CRAFT_FILE_NO, PRDCR_NO, GRADECODE, GRADENAME, PRO_BC, PRO_BZ, 
QUALIFIED_NUM, QUALIFIED_WT, SCRAP_NUM, SCRAP_WT, PRO_TYPE, USER_DATE, 
USER_NAME, RESULT_NO, HEAT_PLAN_NO, BATCH_NO, BATCH_GROUD_NO) 
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 
TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'), ?,?, ?, ?, ?)
	   ]]>
	</query>
	<query id="FrmVrpExpandResult.DeleteConLoag" desc="删除调度信息">
	 <![CDATA[ 
DELETE VRP_CONTROL_LOG WHERE HEAT_PLAN_NO = ? AND RESULT_NO=?
	   ]]>
	</query>
	<query id="FrmVrpExpandResult.UpdateConLoag" desc="修改调度信息">
	 <![CDATA[ 
UPDATE VRP_CONTROL_LOG
   SET QUALIFIED_NUM = ?,
       QUALIFIED_WT  = ?,
       SCRAP_NUM     = ?,
       SCRAP_WT      = ?,
       PRO_BC        = ?,
       PRO_BZ        = ?
 WHERE HEAT_PLAN_NO = ?
   AND RESULT_NO = ?
	   ]]>
	</query>
	<query id="FrmVrpExpandResult.UpdateNodeConLoag" desc="修改调度日志结炉标识">
	 <![CDATA[ 
UPDATE VRP_CONTROL_LOG
   SET LOGS_END = ?,
       NODE_FLAG  = ?
 WHERE HEAT_PLAN_NO = ?
	   ]]>
	</query>
</queryMap>