<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="墩粗实绩">
	<query id="FrmVrpPierCoSurInspe.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,
       NVL(T.PRO_NUM, 0) PRO_NUM,
       NVL(T.PRO_WT, 0) PRO_WT,
       NVL(T.ACC_NUM, 0) ACC_NUM,
       NVL(T.ACC_WT, 0) ACC_WT,
       NVL(T.FAIL_NUM, 0) FAIL_NUM,
       NVL(T.FAIL_WT, 0) FAIL_WT,
       NVL(T.LEU_NUM, 0) LEU_NUM,
       NVL(T.D4_NUM, 0) D4_NUM,
       NVL(T.ELLIP_NUM, 0) ELLIP_NUM,
       NVL(T.UPSETTING_NUM, 0) UPSETTING_NUM,
       NVL(T.CRACK_NUM, 0) CRACK_NUM,
       NVL(T.AIR_NUM, 0) AIR_NUM,
       NVL(T.NOTCH, 0) NOTCH,
       NVL(T.OTHER, 0) OTHER,
       NVL(T.OFFLINE_NUM, 0) OFFLINE_NUM,
       NVL(T.OFFLINE_WT, 0) OFFLINE_WT,
       NVL(T.RE_NUM, 0) RE_NUM,
       NVL(T.RE_WT, 0) 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,
       T.DEF_SERIAL_ITEM
  FROM VRP_JUMPINGUP_FACE_M T INNER JOIN VRP_COM_INFO B ON T.RESULT_NO=B.RESULT_NO
 WHERE T.HEAT_PLAN_NO = ?
        ]]>
	</query>

	<query id="FrmVrpPierCoSurInspe.getQueryExpandResult1" desc="查询墩粗实绩合格支数的和">
        <![CDATA[
   SELECT NVL(SUM(T.ACC_NUM), 0) ACC_NUM FROM VRP_JUMPINGUP_FACE_M T
   WHERE T.HEAT_PLAN_NO = ?
        ]]>
	</query>

	<query id="FrmVrpPierCoSurInspe.UpdatePln" desc="新增修改计划表状态">
		<![CDATA[
 UPDATE PLN_ZY_DBK_M
    SET  PER_STATUS = '40'
  WHERE HEAT_PLAN_NO = ?
			]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.UpdatePln1" desc="撤销修改计划表状态">
		<![CDATA[
 UPDATE PLN_ZY_DBK_M
    SET  PER_STATUS = '50'
  WHERE HEAT_PLAN_NO = ?
			]]>
	</query>

	<query id="FrmVrpPierCoSurInspe.plnupdate" desc="结炉修改计划表状态">
		<![CDATA[
 UPDATE PLN_ZY_DBK_M
    SET  BESIDE_STATUS = '40'
  WHERE HEAT_PLAN_NO = ?
			]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.plnupdate1" desc="撤销结庐修改计划表状态">
		<![CDATA[
 UPDATE PLN_ZY_DBK_M
    SET  BESIDE_STATUS = '50'
  WHERE HEAT_PLAN_NO = ?
			]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.getQueryJumDResult" desc="查询墩粗从表实绩">
		<![CDATA[
		SELECT T.RESULT_NO,
       T.M_RESULT_NO,
       T.SQE_NO,
       T.LEU_D,
       T.D4_MAX,
       T.D4_MIN,
       T.ELLIP_VAL,
       T.UPW_MAX,
       T.UPW_MIN,
       T.WALL_VAL,
       T.DRIFTING_VAL,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.CREATE_NAME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       T.UPDATE_NAME
  FROM VRP_JUMPINGUP_FACE_D T
 WHERE T.RESULT_NO =?		
		 ]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.queryExpandMaxRESULT" desc="查询最大实绩编号">
		<![CDATA[
SELECT ? ||
       LPAD(SUBSTR(NVL(MAX(T.RESULT_NO), '000000'), -6, 6) + 1, 6, '0') AS RESULT_NO
  FROM VRP_JUMPINGUP_FACE_M T
 WHERE TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD') = ?
   AND T.PLINE_CODE = ?
		]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.queryJumpDRESULT" desc="查询从表最大实绩编号">
		<![CDATA[
SELECT  LPAD(SUBSTR(NVL(MAX(T.M_RESULT_NO), '000000'), -6, 6) + 1, 6, '0') AS M_RESULT_NO
  FROM VRP_JUMPINGUP_FACE_D T
 WHERE T.RESULT_NO = ?
		]]>
	</query>

	<query id="FrmVrpPierCoSurInspe.UpdatePath" desc="修改队列表工艺路径">
		<![CDATA[
		UPDATE PORT_VRP_BATCH_SAMPLE_RESULT T
   SET T.PRC_TECHNOLOGY_PATH = SUBSTR(T.PRC_TECHNOLOGY_PATH, 1,6) || ? ||
                               SUBSTR(T.PRC_TECHNOLOGY_PATH,8, LENGTH(T.PRC_TECHNOLOGY_PATH))
 WHERE T.HEAT_PLAN_NO = ? AND T.MAT_STATUS = '00'
		]]>
	</query>

	<query id="FrmVrpPierCoSurInspe.AddExpandResult" desc="新增墩粗实绩">
		<![CDATA[
		INSERT INTO VRP_JUMPINGUP_FACE_M (RESULT_NO, HEAT_PLAN_NO, ZY_BATCH_ID, 
PRO_PLAN_ID, GX_PLAN_NO, PLINE_CODE, PLINE_NAME, PRO_NUM, PRO_WT, ACC_NUM, 
ACC_WT, FAIL_NUM, FAIL_WT, LEU_NUM, D4_NUM, ELLIP_NUM, UPSETTING_NUM, CRACK_NUM, 
AIR_NUM, NOTCH, OTHER, 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,DEF_SERIAL_ITEM) 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="FrmVrpPierCoSurInspe.AddExpandDResult" desc="新增从表实绩">
		<![CDATA[
		INSERT INTO VRP_JUMPINGUP_FACE_D (RESULT_NO, M_RESULT_NO, SQE_NO, LEU_D, D4_MAX, 
D4_MIN, ELLIP_VAL, UPW_MAX, UPW_MIN, WALL_VAL, DRIFTING_VAL, CREATE_TIME, 
CREATE_NAME) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
 TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'), ?)
		]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.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 (?, ?, ?, ?, 
?, ?, ?, ?, ?, ?, ?, ?, ?, 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="FrmVrpPierCoSurInspe.deleteVrpExpandResult" desc="删除墩粗表检主表实绩">
		<![CDATA[
		DELETE VRP_JUMPINGUP_FACE_M WHERE RESULT_NO = ?		
		]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.deleteVrpExpandResultD" desc="删除镦粗表检从表实绩">
		<![CDATA[
		DELETE VRP_JUMPINGUP_FACE_D WHERE RESULT_NO = ?		
		]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.deleteVrpExpandResultD1" desc="删除检测实绩实绩">
		<![CDATA[
		DELETE VRP_JUMPINGUP_FACE_D WHERE RESULT_NO = ?  AND  M_RESULT_NO=?		
		]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.deleteComInfoResult" desc="删除公共信息">
		<![CDATA[
		DELETE VRP_COM_INFO WHERE RESULT_NO = ?		
		]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.updateVrpExpandResult" desc="修改墩粗实绩">
		<![CDATA[		
UPDATE VRP_JUMPINGUP_FACE_M
   SET PRO_NUM = ?,
       PRO_WT = ?,
       ACC_NUM = ?,
       ACC_WT = ?,
       FAIL_NUM = ?,
       FAIL_WT = ?,
       LEU_NUM = ?,
       D4_NUM = ?,
       ELLIP_NUM = ?,
       UPSETTING_NUM = ?,
       CRACK_NUM = ?,
       AIR_NUM = ?,
       NOTCH = ?,
       OTHER = ?,
       OFFLINE_NUM = ?,
       OFFLINE_WT = ?,
       RE_NUM = ?,
       RE_WT = ?,
       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="FrmVrpPierCoSurInspe.updateVrpExpandResultD" desc="修改墩粗从表实绩">
		<![CDATA[		
UPDATE VRP_JUMPINGUP_FACE_D
   SET LEU_D        = ?,
       D4_MAX       = ?,
       D4_MIN       = ?,
       ELLIP_VAL    = ?,
       UPW_MAX      = ?,
       UPW_MIN      = ?,
       WALL_VAL     = ?,
       DRIFTING_VAL = ?,
       UPDATE_TIME  = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       UPDATE_NAME  = ?
 WHERE RESULT_NO = ?
   AND M_RESULT_NO = ?
			]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.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="FrmVrpPierCoSurInspe.queryJumD" desc="查询外观检测是否有记录">
		<![CDATA[
SELECT COUNT(*) COUNT FROM VRP_JUMPINGUP_FACE_D
WHERE RESULT_NO = ?
			]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.selectComInfo" desc="查询是否有当前工序">
		<![CDATA[
SELECT COUNT(*) COUNT FROM VRP_COM_INFO
WHERE HEAT_PLAN_NO = ?
 AND PLINE_CODE = ?
 AND STATION_CODE = ?
			]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.qureyGxComInfo" desc="查询公共信息表工序状态">
		<![CDATA[
SELECT DISTINCT STATION_STATUS
  FROM VRP_COM_INFO
 WHERE HEAT_PLAN_NO = ?
   AND PLINE_CODE = ?
   AND STATION_CODE = ?
			]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.doBeside" desc="修改工序信息表工序状态为生产完成">
		<![CDATA[
		UPDATE VRP_COM_INFO
 SET STATION_STATUS = '2'
WHERE HEAT_PLAN_NO = ?
 AND PLINE_CODE = ?
 AND STATION_CODE = ?
			]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.deleteBeside" desc="修改公共信息表工序点状态为生产中">
		<![CDATA[
		UPDATE VRP_COM_INFO
 SET STATION_STATUS = '1'
WHERE HEAT_PLAN_NO = ?
 AND PLINE_CODE = ?
 AND STATION_CODE = ?
			]]>
	</query>

	<query id="FrmVrpPierCoSurInspe.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="FrmVrpPierCoSurInspe.QueryFaillWt" desc="获取废品重量">
		<![CDATA[
SELECT NVL(SUM(T1.ACT_WEIGHT),0) ACT_WEIGHT
  FROM (SELECT T.ACT_WEIGHT
          FROM PORT_VRP_BATCH_SAMPLE_RESULT T
         WHERE T.MAT_STATUS = '00'
           AND T.IS_SAMPLE_PIPE !='1'
           AND T.HEAT_PLAN_NO = ?
         ORDER BY T.MAT_NO ASC) T1
 WHERE ROWNUM<?
			]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.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 !='1'
           AND T.INSTORE_FLAG = '0'
           AND T.HEAT_PLAN_NO = ?
         ORDER BY T.MAT_NO ASC) T1
 WHERE ROWNUM<?
			]]>
	</query>

	<query id="FrmVrpPierCoSurInspe.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="FrmVrpPierCoSurInspe.queryExpandFailNUM1" desc="查询工序废品数量">
		<![CDATA[
		SELECT NVL(SUM(T.FAIL_NUM),0) FAIL_NUM FROM VRP_JUMPINGUP_FACE_M T
WHERE  T.HEAT_PLAN_NO=? 
			]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.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="FrmVrpPierCoSurInspe.doQueryRession" desc="查询废品原因">
		<![CDATA[
SELECT DEF_SERIAL_NO,
       DEF_SERIAL_ITEM,
       HEAT_PLAN_NO,
       DEF_FILL_NAME,
       NVL(DEF_FILL_NUM, 0) DEF_FILL_NUM,
       CRE_TIME
  FROM VRP_WASTE_RESULT
  WHERE DEF_SERIAL_ITEM=?
			]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.doComIinfoRession" desc="查询镦粗废品原因">
		<![CDATA[
SELECT T.BASENAME,T.BASECODE FROM COM_BASE_INFO T WHERE T.SORTCODE=?
			]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.AddWaste" desc="新增缺陷表">
		<![CDATA[
INSERT INTO VRP_WASTE_RESULT
  (DEF_SERIAL_NO,
   DEF_SERIAL_ITEM,
   HEAT_PLAN_NO,
   DEF_FILL_NAME,
   DEF_FILL_NUM,
   CRE_TIME)
VALUES
  (?, ?, ?, ?, ?, TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'))
			]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.queryDefItem" desc="查询缺陷单号">
		<![CDATA[
SELECT ? ||
        LPAD(SUBSTR(NVL(MAX(T.DEF_SERIAL_ITEM), '000'), -3, 3) + 1, 3, '0') AS DEF_SERIAL_ITEM
   FROM VRP_WASTE_RESULT T
  WHERE trunc(T.CRE_TIME) =TO_DATE(?,'YYYY-MM-DD')
			]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.queryDefItemNo" desc="查询缺陷单号序号">
		<![CDATA[
SELECT LPAD(SUBSTR(NVL(MAX(T.DEF_SERIAL_NO), '00'), -2, 2) + 1, 2, '0') AS DEF_SERIAL_NO
   FROM VRP_WASTE_RESULT T
  WHERE T.DEF_SERIAL_ITEM = ?
			]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.DeleteRess" desc="删除缺陷项">
		<![CDATA[
DELETE VRP_WASTE_RESULT WHERE DEF_SERIAL_ITEM = ?
			]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.UpdateWaste" desc="修改缺陷项">
		<![CDATA[
UPDATE VRP_WASTE_RESULT
   SET DEF_FILL_NAME = ?, DEF_FILL_NUM = ?
 WHERE DEF_SERIAL_NO = ?
   AND DEF_SERIAL_ITEM = ?
			]]>
	</query>
	<query id="FrmVrpPierCoSurInspe.DeleteWaste" desc="删除单个缺陷项">
		<![CDATA[
DELETE VRP_WASTE_RESULT
 WHERE DEF_SERIAL_NO = ?
   AND DEF_SERIAL_ITEM = ?
			]]>
	</query>
</queryMap>