<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="加工上料实绩">
	<query id="FrmMcpLoading.GetLoadResultByID" desc="上料实绩查询">
        <![CDATA[
       SELECT T.RESULT_NO,
       T.HEAT_PLAN_NO,
       T.ZY_BATCH_ID,
       T.PROD_INDEX,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.MONITORDEMAND,
       T.PRDCR_NO,
       T.PRODUCER,
       TO_CHAR(T.PRODUCER_TIME, 'YYYY-MM-DD HH24:MI:SS') PRODUCER_TIME,
       T.PRO_NUM,
       T.PRO_WT,
       T.FAIL_NUM,
       T.FAIL_WT,
       T.OFFLINE_NUM,
       T.OFFLINE_WT,
       T.RE_NUM,
       T.RE_WT,
       TO_CHAR(T.LOAD_TIME, 'YYYY-MM-DD HH24:MI:SS') LOAD_TIME,
       T.LOAD_SHIFT,
       T.LOAD_GROUP,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.COL_MODE,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.CREATET_USER,
       T.OUTNUM_CUT,
       T.LENGTH_IN,
       T.LENGTHMAX_IN,
       T.LENGTHMIN_IN,
       T.OUTSTOCK_DOC,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       T.BAL_YEAR_MONTH,
       T.PRO_YEAR_MONTH_DAY,
       DECODE(B.STATION_STATUS, '1', '生产中', '2', '生产完成') STATION_STATUS,
       T.HEAT_PLAN_SQE,
       T.MAT_SOURCE
  FROM MCH_LOADING_RESULT T,MCH_COM_INFO B
   WHERE T.RESULT_NO = B.RESULT_NO
   AND T.HEAT_PLAN_NO = ?
   AND T.BATCH_NO = ?
 ORDER BY T.LOAD_TIME DESC      
        ]]>
	</query>
<query id="FrmMcpLoading.queryExpandFailNUM" desc="查询管号队列废品数量">
		<![CDATA[
		SELECT NVL(SUM(T.ACT_COUNT),0) ACT_COUNT
  FROM PORT_MCH_BATCH_SAMPLE_RESULT T
 WHERE T.MAT_STATUS = '10'
   AND T.HEAT_PLAN_NO = ?
   AND T.OP_PROCESS = ?		
			]]>
	</query>
		<query id="FrmMcpLoading.queryExpandNUM2" desc="查询废品材料信息">
		<![CDATA[
	SELECT T1.MAT_NO
  FROM (SELECT T.MAT_NO
          FROM PORT_MCH_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="FrmMcpLoading.addMatBc" desc="新增材料表">
        <![CDATA[      
INSERT INTO MAT_BC_M
  SELECT *
    FROM MAT_BC_BACKUP T
   WHERE T.Mat_No = ?
     AND T.NEXT_PROCESS_CDOE = 'G'
        ]]>
	</query>
	<query id="FrmMcpLoading.updateMatBc" desc="修改材料表状态12">
        <![CDATA[      
  UPDATE MAT_BC_M T SET T.QCM_STAUS = '22',T.PROCESS_CDOE = ?, T.PROCESS_DESC =  (SELECT BASENAME FROM COM_BASE_INFO  WHERE BASECODE=? ) 
  where  T.Mat_No = ?
     AND T.NEXT_PROCESS_CDOE = 'G'
        ]]>
	</query>
	<query id="FrmMcpLoading.deleteMatBc" desc="删除材料表废品新增数据">
        <![CDATA[      
  DELETE MAT_BC_M T
    WHERE T.MAT_NO = ? AND T.NEXT_PROCESS_CDOE = 'G'
        ]]>
	</query>
	<query id="FrmMcpLoading.GetQuery1" desc="查询上料支数总和">
        <![CDATA[
   SELECT NVL(SUM(T.PRO_NUM), 0) PRO_NUM FROM MCH_LOADING_RESULT T
   WHERE T.HEAT_PLAN_NO = ?
        ]]>
	</query>
	<query id="FrmMcpLoading.DeleteOutListQuan" desc="删除出库记录产权出库">
		<![CDATA[
      DELETE YDM_BC_OUTLIST WHERE MAT_NO = ?  AND OUTSTOCK_TYPE_CODE = '800809' AND  OUTSTOCK_PLAN_NO = ?
		]]>
	</query>
	<query id="FrmMcpLoading.queryYdmOutlist" desc="查询出库信息产出出库">
	<![CDATA[
SELECT OUTSTOCK_SQE,
       OUTSTOCK_PLAN_NO,
       OUTSTOCK_DOC,
       OUTSTOCK_TYPE_CODE,
       OUTSTOCK_TYPE_NAME,
       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,
       DEPARTMENT_CODE,
       DEPARTMENT_DESC,
       ACT_WEIGHT,
       BAL_YEAR_MONTH
  FROM (SELECT *
          FROM YDM_BC_OUTLIST
         WHERE OUTSTOCK_TYPE_CODE = '800809'
           AND JUDGE_STOVE_NO = ?
           AND NVL(BATCH_NO,'/') = NVL(?,'/')
           AND OUTSTOCK_PLAN_NO = ?
         ORDER BY MAT_NO DESC)
 WHERE ROWNUM < ? 
	]]>
	</query>
		<query id="FrmMcpLoading.qureyGxOnline" desc="查询公共信息表无交库工序">
        <![CDATA[
SELECT COUNT(*) COUNT
  FROM MCH_COM_INFO T
 WHERE T.HEAT_PLAN_NO = ?
   AND T.STATION_CODE = '701311'
   AND T.STATION_DESC = '下线'
        ]]>
	</query>
		<query id="FrmMcpLoading.CopyBcMat" desc="把物料主表复制到List表">
	<![CDATA[
   INSERT INTO MAT_BC_BACKUP SELECT * FROM MAT_BC_M T WHERE T.MAT_NO = ?
	]]>
	</query>
	<query id="FrmMcpLoading.DeteleBcMat" desc="删除物料主表">
	<![CDATA[
   DELETE MAT_BC_M WHERE MAT_NO = ?
	]]>
	</query>
	<query id="FrmMcpLoading.CopyBackup" desc="复制MAT_BC_BACKUP表到物料主表">
	<![CDATA[
   INSERT INTO MAT_BC_M SELECT * FROM MAT_BC_BACKUP T WHERE T.MAT_NO = ? AND T.HEAT_PLAN_NO_NEXT = ?
	]]>
	</query>
		<query id="FrmMcpLoading.DeteleBackup" desc="删除MAT_BC_BACKUP表">
	<![CDATA[
   DELETE MAT_BC_BACKUP WHERE MAT_NO = ?  AND HEAT_PLAN_NO_NEXT =?
	]]>
	</query>

	<query id="FrmMcpLoading.DeleteOffline" desc="">
		<![CDATA[
DELETE MCH_OFFLINE_RESULT T
 WHERE HEAT_PLAN_NO = ?
   AND NOT EXISTS (SELECT 1
          FROM PORT_MCH_BATCH_SAMPLE_RESULT
         WHERE HEAT_PLAN_NO = T.HEAT_PLAN_NO AND RESULT_NO= T.RESULT_NO)

		]]>
	</query>


		<query id="FrmMcpLoading.queryStationName" desc="查询工序点配置表里工序名称">
        <![CDATA[
   
select length(t.station_names)-length(replace(t.station_names,';'))+1  NUM from MCH_COM_SETPLINE t where t.pline_code=?
        ]]>
	</query>
	<query id="FrmMcpLoading.getquerymaternum" desc="查询相同炉计划ID下待上料支数总和">
        <![CDATA[
SELECT SUM(PLAN_INDOUBLE_NUM) - SUM(REAL_INDOUBLE_NUM) NUM,
	   SUM(PLAN_INDOUBLE_wt) - SUM(REAL_INDOUBLE_wt) WT
  FROM PLN_ZY_JGX_C
 WHERE HEAT_PLAN_NO = ?
 AND BATCH_NO =?

        ]]>
	</query>
	
	<query id="FrmMcpLoading.getQueryLoadingResult" desc="查询相同炉计划ID下实绩状态">
        <![CDATA[
select b.station_status  FROM MCH_LOADING_RESULT T,MCH_COM_INFO B
   WHERE T.RESULT_NO = B.RESULT_NO
   AND T.HEAT_PLAN_NO = ? and t.pline_code= ?
        ]]>
	</query>
	
	
		<query id="FrmMcpLoading.GetQueryplan" desc="查询计划排产支数总和">
        <![CDATA[
   SELECT NVL(SUM(T.PLAN_INDOUBLE_NUM), 0) PRO_NUM FROM pln_zy_jgx_c T
   WHERE T.HEAT_PLAN_NO = ?
        ]]>
	</query>
	
	<query id="FrmMcpLoading.getTime" desc="获取服务器时间">
        <![CDATA[
   SELECT TO_CHAR(SYSDATE, 'yyyy-MM-dd hh:mm:ss') time FROM DUAL WHERE 1 = 1
        ]]>
	</query>
	
	
	<query id="FrmMcpLoading.GetPerson" desc="查询操作人员">
        <![CDATA[
   SELECT T.MAN_NAME,T.PRO_BZ FROM MCH_PERSON T WHERE T.PRO_BZ= ? AND T.PLINE_CODE=?
        ]]>
	</query>
	<query id="FrmMcpLoading.DoUpdateFilePath" desc="更新文件路径">
		<![CDATA[
   UPDATE pln_zy_jgx_m T SET  t.file_path=? WHERE t.heat_plan_no=?
        ]]>
	</query>

	<query id="FrmMcpLoading.DoUpdateFilePath2" desc="更新文件路径">
		<![CDATA[
   UPDATE pln_zy_jgx_m T SET  t.file_path2=? WHERE t.heat_plan_no=?
        ]]>
	</query>

	<query id="FrmMcpLoading.getQueryOrderRCLS" desc="查询是否上料行">
	<![CDATA[
	SELECT MIN(NVL(T2.GX_PRO_SEQ,0)) GX_PRO_SEQ
  FROM (SELECT TO_NUMBER(T1.GX_PRO_SEQ) GX_PRO_SEQ
          FROM PLN_ORDER_JGX_S T1
         WHERE T1.PLINE_CODE = ?
           AND T1.EXE_STATUS = '0'
           AND T1.IF_STOVE_ISSUED = '1'
           AND TO_NUMBER(T1.GX_PRO_SEQ) >
               (SELECT MAX(TO_NUMBER(T.GX_PRO_SEQ)) GX_PRO_SEQ
                  FROM PLN_ORDER_JGX_S T
                 WHERE T.EXE_STATUS = '1'
                   AND T.PLINE_CODE = ?
                   AND T.IF_STOVE_ISSUED = '1')) T2
	]]>
	</query>

	<query id="FrmMcpLoading.AddLoadResult" desc="新增上料实绩">
        <![CDATA[
INSERT INTO MCH_LOADING_RESULT
  (RESULT_NO,
   ZY_BATCH_ID,
   PRO_PLAN_ID,
   GX_PLAN_NO,
   PRO_NUM,
   PRO_WT,
   FAIL_NUM,
   FAIL_WT,
   OFFLINE_NUM,
   OFFLINE_WT,
   RE_NUM,
   RE_WT,
   LOAD_TIME,
   LOAD_SHIFT,
   LOAD_GROUP,
   COL_MODE,
   PLINE_CODE,
   PLINE_NAME,
   HEAT_PLAN_NO,
   CREATE_TIME,
   PRODUCER,
   PRODUCER_TIME,
   CREATET_USER,
   OUTNUM_CUT,
   LENGTH_IN,
   LENGTHMAX_IN,
   LENGTHMIN_IN,
   OUTSTOCK_DOC,
   JUDGE_STOVE_NO,
   BATCH_NO,
   BATCH_GROUD_NO,
   HEAT_PLAN_SQE,
   MAT_SOURCE,
   PRO_YEAR_MONTH_DAY,
   BAL_YEAR_MONTH)
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="FrmMcpLoading.AddOutList" desc="新增出库记录">
		<![CDATA[
INSERT INTO YDM_BC_OUTLIST
  (OUTSTOCK_SQE,
   OUTSTOCK_PLAN_NO,
   OUTSTOCK_DOC,
   OUTSTOCK_TYPE_CODE,
   OUTSTOCK_TYPE_NAME,
   MAT_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,
   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,
   OUTSTOCK_TIME,
   OUT_BC,
   OUT_BZ,
   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_CODE,
   JUDGE_STD_NAME,
   LOT_NO,
   STOVE_NO,
   LOAD_PLINE_CODE,
   LOAD_PLINE_NAME,
   PRO_ORDER_NO,
   BAL_YEAR_MONTH,
   PROCESS_CDOE,
   PROCESS_DESC)
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'),
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   (SELECT PLINE_NAME FROM COM_BASE_PLINE WHERE PLINE_CODE = ?),
   ?,
   ?,
   ?,
   ?)

	]]>
	</query>

	<query id="FrmMcpLoading.AddOutListQuan" desc="新增产权出库">
		<![CDATA[
INSERT INTO YDM_BC_OUTLIST
  (OUTSTOCK_SQE,
   OUTSTOCK_PLAN_NO,
   OUTSTOCK_DOC,
   OUTSTOCK_TYPE_CODE,
   OUTSTOCK_TYPE_NAME,
   MAT_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,
   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,
   OUTSTOCK_TIME,
   OUT_BC,
   OUT_BZ,
   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_CODE,
   JUDGE_STD_NAME,
   LOT_NO,
   STOVE_NO,
   LOAD_PLINE_CODE,
   LOAD_PLINE_NAME,
   PRO_ORDER_NO,
   BAL_YEAR_MONTH,
   PROCESS_CDOE,
   PROCESS_DESC)
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'),
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   (SELECT PLINE_NAME FROM COM_BASE_PLINE WHERE PLINE_CODE = ?),
   ?,
   ?,
   ?,
   ?)

	]]>
	</query>

	<query id="FrmMcpLoading.AddComInfoResult" desc=" 新增公共信息">
        <![CDATA[ 
        INSERT INTO MCH_COM_INFO (RESULT_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, GRADECODE, GRADENAME, STEELCODE, 
  STEELNAME, DIMATER, HEIGHT, ACT_DIMATER, ACT_SPEC_CODE, ACT_SPEC_NAME, LEN, ACT_LEN_MIN, 
  ACT_LEN_MAX, LEN_CUT_HEAD, LEN_CUT_END, ACT_MATERIAL_NO, ACT_MATERIAL_NAME, INWL_ID, INWL_DESC, 
  MONITOR_POINT, IF_MONITOR_MCH, PRDCR_NO, PRODUCER, PRODUCER_TIME, 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, STATION_STATUS, RRO_TIME, RRO_TIME_NU, 
   PRO_SHIFT, PRO_GROUP, VALIDFLAG, CREATE_TIME, COL_OPERATOR, 
  HEAT_PLAN_NO,JUDGE_STOVE_NO,BATCH_NO,BATCH_GROUD_NO,
  PRODUCCODE,PRODUCNAME,OUTNUM_CUT,SPEC_CODE,SPEC_NAME) VALUES (?, ?, ?, ?, ?,?, ?, ?, ?, ?, ?, ?, (SELECT T.BASENAME FROM COM_BASE_INFO T WHERE T.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="FrmMcpLoading.AddComInfoResultNewDB" desc=" 新增公共信息DB">
		<![CDATA[
     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,
   DIMATER,
   HEIGHT,
   LEN,
   LEN_MIN,
   LEN_MAX,
   PLN_LEN,
   PLN_LEN_MIN,
   PLN_LEN_MAX,
   OUTNUM_CUT,
   ACT_SPEC_CODE,
   ACT_SPEC_NAME,
   ACT_DIMATER,
   ACT_HEIGHT,
   ACT_LEN,
   ACT_LEN_MIN,
   ACT_LEN_MAX,
   LEN_CUT_HEAD,
   LEN_CUT_END,
   ACT_MATERIAL_NO,
   ACT_MATERIAL_NAME,
   INWL_ID,
   INWL_DESC,
   BELONG_CODE,
   BELONG_NAME,
   MONITOR_POINT,
   IF_MONITOR_MCH,
   MONITORDEMAND,
   PRDCR_NO,
   PRODUCER,
   PRODUCER_TIME,
   STATION_ROAD,
   CRAFT_FILE_NO,
   CRAFT_FILE_MAN,
   CRAFT_SEQ,
   CRAFT_NO_LV2,
   CRAFT_LV2_MAN,
   INP_NUM,
   INP_WT,
   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,
   RRO_TIME_NU,
   PRO_SHIFT,
   PRO_GROUP,
   CREATET_USER,
   CREATE_TIME,
   COL_OPERATOR)
  SELECT ?,
         HEAT_PLAN_NO,
         ZY_BATCH_ID,
         '',
         PRO_PLAN_ID,
         GX_PLAN_NO,
         ORDER_SOURCE,
         ORDER_NO,
         ORDER_SEQ,
         REQ_BL_ID,
         ?,
         ?,
         ?,
         (SELECT T.BASENAME FROM COM_BASE_INFO T WHERE T.BASECODE = ?),
         JUDGE_STOVE_NO,
         ?,
         '',
         PRODUCCODE,
         PRODUCNAME,
         GRADECODE,
         GRADENAME,
         STEELCODE,
         STEELNAME,
         MODEL_CODE,
         MODEL_DESC,
         STD_CODE,
         STD_NAME,
         STD_STYLE,
         STD_STYLE_DESC,
         SPEC_CODE,
         SPEC_NAME,
         OUTDIAMETER_IN,
         WALLTHICK_IN,
         '',
         '',
         '',
         '',
         '',
         '',
         OUTNUM_CUT,
         '',
         '',
         OUTDIAMETER,
         WALLTHICK,
         '',
         '',
         '',
         '',
         '',
         OUTWL_ID,
         OUTWL_DESC,
         INWL_ID,
         INWL_DESC,
         '',
         '',
         MONITOR_POINT,
         IF_MONITOR,
         '',
         PRDCR_NO,
         '',
         '',
         STATION_ROAD,
         CRAFT_FILE_NO,
         CRAFT_FILE_MAN,
         CRAFT_SEQ,
         '',
         '',
         '',
         '',
         ?,
         ?,
         ?,
         ?,
         '',
         '',
         '',
         '',
         '',
         '',
         1,
         TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
         '',
         ?,
         ?,
         ?,
         SYSDATE,
         ?
    FROM PLN_ZY_DBK_M
   WHERE HEAT_PLAN_NO = ?
        ]]>
	</query>
	<query id="FrmMcpLoading.AddComInfoResultNew" desc=" 新增公共信息">
		<![CDATA[
     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,
   DIMATER,
   HEIGHT,
   LEN,
   LEN_MIN,
   LEN_MAX,
   PLN_LEN,
   PLN_LEN_MIN,
   PLN_LEN_MAX,
   OUTNUM_CUT,
   ACT_SPEC_CODE,
   ACT_SPEC_NAME,
   ACT_DIMATER,
   ACT_HEIGHT,
   ACT_LEN,
   ACT_LEN_MIN,
   ACT_LEN_MAX,
   LEN_CUT_HEAD,
   LEN_CUT_END,
   ACT_MATERIAL_NO,
   ACT_MATERIAL_NAME,
   INWL_ID,
   INWL_DESC,
   BELONG_CODE,
   BELONG_NAME,
   MONITOR_POINT,
   IF_MONITOR_MCH,
   MONITORDEMAND,
   PRDCR_NO,
   PRODUCER,
   PRODUCER_TIME,
   STATION_ROAD,
   CRAFT_FILE_NO,
   CRAFT_FILE_MAN,
   CRAFT_SEQ,
   CRAFT_NO_LV2,
   CRAFT_LV2_MAN,
   INP_NUM,
   INP_WT,
   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,
   RRO_TIME_NU,
   PRO_SHIFT,
   PRO_GROUP,
   CREATET_USER,
   CREATE_TIME,
   COL_OPERATOR)
  SELECT ?,
         HEAT_PLAN_NO,
         ZY_BATCH_ID,
         '',
         PRO_PLAN_ID,
         GX_PLAN_NO,
         ORDER_SOURCE,
         ORDER_NO,
         ORDER_SEQ,
         REQ_BL_ID,
         ?,
         ?,
         ?,
         (SELECT T.BASENAME FROM COM_BASE_INFO T WHERE T.BASECODE = ?),
         JUDGE_STOVE_NO,
         ?,
         '',
         PRODUCCODE,
         PRODUCNAME,
         GRADECODE,
         GRADENAME,
         STEELCODE,
         STEELNAME,
         MODEL_CODE,
         MODEL_DESC,
         STD_CODE,
         STD_NAME,
         STD_STYLE,
         STD_STYLE_DESC,
         SPEC_CODE,
         SPEC_NAME,
         OUTDIAMETER_IN,
         WALLTHICK_IN,
         '',
         '',
         '',
         '',
         '',
         '',
         OUTNUM_CUT,
         '',
         '',
         OUTDIAMETER,
         WALLTHICK,
         '',
         '',
         '',
         '',
         '',
         OUTWL_ID,
         OUTWL_DESC,
         INWL_ID,
         INWL_DESC,
         '',
         '',
         MONITOR_POINT,
         IF_MONITOR,
         '',
         PRDCR_NO,
         '',
         '',
         STATION_ROAD,
         CRAFT_FILE_NO,
         CRAFT_FILE_MAN,
         CRAFT_SEQ,
         '',
         '',
         '',
         '',
         ?,
         ?,
         ?,
         ?,
         '',
         '',
         '',
         '',
         '',
         '',
         1,
         TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
         '',
         ?,
         ?,
         ?,
         SYSDATE,
         ?
    FROM PLN_ZY_JGX_M
   WHERE HEAT_PLAN_NO = ?
        ]]>
	</query>

	<query id="FrmMcpLoading.deleteButter" desc="删除位置表">
	<![CDATA[
 DELETE YDM_BC_BUTTRESS WHERE MAT_NO = ?
	]]>
	</query>

	<query id="FrmMcpLoading.UpdatePath" desc="修改队列表工艺路径">
		<![CDATA[
UPDATE port_mch_batch_sample_result T
   SET T.PRC_TECHNOLOGY_PATH = SUBSTR(T.PRC_TECHNOLOGY_PATH, 1,0) || ? ||
                               SUBSTR(T.PRC_TECHNOLOGY_PATH,2, LENGTH(T.PRC_TECHNOLOGY_PATH))
 WHERE T.HEAT_PLAN_NO = ? AND T.MAT_NO = ?
			]]>
	</query>
	<query id="FrmMcpLoading.queryOutList" desc="查询出库单号">
	<![CDATA[
 SELECT (SELECT S.MEMO
          FROM COM_BASE_INFO S
         WHERE S.BASECODE = ?) || OUTSTOCK_DOC OUTSTOCK_DOC
  FROM (SELECT TO_CHAR(SYSDATE, 'YYMMDD') ||
               LPAD(NVL(MAX(SUBSTR(T.OUTSTOCK_DOC, 9)), 0) + 1, 5, 0) OUTSTOCK_DOC
          FROM YDM_BC_OUTLIST T
         WHERE T.OUTSTOCK_TYPE_CODE = ?
           AND TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD') =
               TO_CHAR(SYSDATE, 'YYYY-MM-DD'))
	]]>
	</query>
	<query id="FrmMcpLoading.queryOut" desc="查询出库流水号">
	<![CDATA[
      SELECT ? ||
         LPAD(SUBSTR(NVL(MAX(T.OUTSTOCK_SQE), '0000'), -4, 4) + 1, 4, '0') AS OUTSTOCK_SQE
    FROM YDM_BC_OUTLIST T
   WHERE TO_CHAR(T.CREATE_TIME,'YYYY-MM-DD') =  TO_CHAR(SYSDATE, 'YYYY-MM-DD')
     AND T.OUTSTOCK_DOC = ?
	]]>
	</query>
	<query id="FrmMcpLoading.getQueryInfoPlan" desc="查询是否存在上料之后的数据">
	<![CDATA[
	SELECT T.STATION_CODE, T.STATION_DESC
  FROM mch_com_info T
 WHERE  T.STATION_CODE !=?
 AND T.HEAT_PLAN_NO = ?
	]]>
	</query>
	<query id="FrmMcpLoading.ReturnVrpLoadingResult" desc="撤销上料实绩">
		<![CDATA[
		DELETE mch_loading_result WHERE RESULT_NO = ?
		]]>
	</query>

	<query id="FrmMcpLoading.deleteDbkPlan" desc="删除时修改加工计划表">
		<![CDATA[
UPDATE pln_zy_jgx_c C
   SET REAL_INDOUBLE_NUM = REAL_INDOUBLE_NUM-?,
       REAL_INDOUBLE_WT  = REAL_INDOUBLE_WT-?,
            Loadtime = (SELECT MIN(LOAD_TIME) FROM MCH_LOADING_RESULT WHERE HEAT_PLAN_NO = C.HEAT_PLAN_NO AND BATCH_NO = C.BATCH_NO AND BATCH_GROUD_NO = C.BATCH_GROUD_NO)
 WHERE HEAT_PLAN_NO = ? and HEAT_PLAN_SQE =?
		]]>
	</query>

	<query id="FrmMcpLoading.deleteDbkPlan2" desc="删除时修改加工计划表">
		<![CDATA[
UPDATE pln_zy_jgx_c C
   SET   PER_STATUS =  DECODE((SELECT COUNT(1)
                             FROM MCH_LOADING_RESULT
                            WHERE HEAT_PLAN_NO = C.HEAT_PLAN_NO
                              AND BATCH_NO = C.BATCH_NO ),
                           0,
                           NULL,
                           PER_STATUS)
 WHERE HEAT_PLAN_NO = ? and BATCH_NO =?
		]]>
	</query>


		<query id="FrmMcpLoading.deleteDbkPlanpln" desc="删除时修改加工计划表">
		<![CDATA[
UPDATE PLN_ZY_JGX_M M
   SET PLANSTATUS = DECODE((SELECT COUNT(1)
                             FROM PLN_ZY_JGX_C
                            WHERE HEAT_PLAN_NO = M.HEAT_PLAN_NO
                              AND PER_STATUS IS NOT NULL),
                           0,
                           10,
                           20),
                Loadtime = (SELECT MIN(LOAD_TIME) FROM MCH_LOADING_RESULT WHERE HEAT_PLAN_NO = M.HEAT_PLAN_NO)
 WHERE HEAT_PLAN_NO = ?
		]]>
	</query>
	<query id="FrmMcpLoading.DeleteOutList" desc="删除出库记录">
		<![CDATA[
      DELETE YDM_BC_OUTLIST WHERE OUTSTOCK_SQE = ?  AND OUTSTOCK_TYPE_CODE = '800801'
		]]>
	</query>
	<query id="FrmMcpLoading.DeletePortVrp" desc="删除管号队列记录">
		<![CDATA[
DELETE port_mch_batch_sample_result
 WHERE HEAT_PLAN_NO = ?
   AND MAT_NO = ?
		]]>
	</query>
	<query id="FrmMcpLoading.updateMatZcPlan" desc="修改库存状态">
	<![CDATA[
   UPDATE MAT_BC_M T SET T.MAT_STATUS = ? WHERE T.MAT_NO = ?
	]]>
	</query>
	<query id="FrmMcpLoading.updateMatZcPlanStuts" desc="修改库存状态">
	<![CDATA[
   UPDATE MAT_BC_BACKUP T SET T.MAT_STATUS = ? WHERE T.MAT_NO = ?
	]]>
	</query>
	<query id="FrmMcpLoading.addButter" desc="新增位置表">
		<![CDATA[
   insert into YDM_BC_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, create_name, 
create_time, department_code, department_desc) values(?, ?, ?, ?, ?, ?, ?, ?, ?, 
?, ?, ?, ?, ?, ?, to_date(?, 'YYYY-MM-DD HH24:MI:SS'), ?, ?)
		]]>
	</query>
	<query id="FrmMcpLoading.deleteVrpResult" desc="撤销上料公共实绩">
		<![CDATA[
		DELETE MCH_COM_INFO WHERE RESULT_NO = ?
		]]>
	</query>
	<query id="FrmMcpLoading.qureyGxComInfo" desc="查询工序是否是结炉状态">
		<![CDATA[
SELECT DISTINCT STATION_STATUS
  FROM MCH_COM_INFO
 WHERE HEAT_PLAN_NO = ?
    AND BATCH_NO = ?
   AND STATION_CODE = ?
			]]>
	</query>
	<query id="FrmMcpLoading.queryLoadRESULT" desc="查询最大实际编号">
		<![CDATA[
SELECT ? ||
       LPAD(SUBSTR(NVL(MAX(T.RESULT_NO), '000000'), -6, 6) + 1, 6, '0') AS RESULT_NO
  FROM MCH_LOADING_RESULT T,MCH_COM_INFO T1
 WHERE T.HEAT_PLAN_NO = T1.HEAT_PLAN_NO AND TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD') = ?
   AND T.PLINE_CODE = ?
   AND T1.STATION_CODE = ?
			]]>
	</query>
	<query id="FrmMcpLoading.queryCountVrp" desc="查询计划下剩余上料支、吨">
		<![CDATA[
SELECT COUNT(*) COUNT,
       NVL(SUM(T.PRO_NUM), 0) PRO_NUM,
       NVL(SUM(T.PRO_WT), 0) PRO_WT
  FROM mch_loading_result T
 WHERE HEAT_PLAN_NO = ?
 AND OUTNUM_CUT = ?
		]]>
	</query>
	
	<query id="FrmMcpLoading.querypronum" desc="查询计划从表上料 支数和">
		<![CDATA[
SELECT NVL(SUM(T.PLAN_INDOUBLE_NUM), 0) PRO_NUM
  FROM PLN_ZY_JGX_C T
 WHERE HEAT_PLAN_NO = ?
		]]>
	</query>
	

	<query id="FrmMcpLoading.deleteBeside" desc="修改工序状态撤销结炉">
		<![CDATA[
		UPDATE MCH_COM_INFO
 SET STATION_STATUS = '1'
WHERE HEAT_PLAN_NO = ?
 AND PLINE_CODE = ?
 AND STATION_CODE = ?
			]]>
	</query>


	<query id="FrmMcpLoading.doPlnBeside" desc="修改计划表结炉状态">
	<![CDATA[
 UPDATE pln_zy_jgx_m SET BESIDE_STATUS = ? WHERE HEAT_PLAN_NO = ?
	]]>
	</query>
	
	<query id="FrmMcpLoading.updateMatNoStuts" desc="修改材料表状态">
	<![CDATA[
UPDATE MAT_BC_M
   SET MAT_STATUS       = '80150102',
       HANGING_FLAG     = '0',
       LOCK_LIKU        = '0',
       ORDER_NO         = '',
       ORDER_SEQ        = '',
       ORDER_SEQ_NO     = '',
       ORD_PK           = '',
       ORD_LN_PK        = '',
       ORD_LN_DLY_PK    = '',
       PRO_PLAN_ID_NEXT = '',
       GX_PLAN_NO_NEXT  = ''
 WHERE JUDGE_STOVE_NO = ?
   AND BATCH_NO = ?
   AND BATCH_GROUD_NO = ?
   AND JUGDE_APPLY_CODE = ?
   AND NEXT_PROCESS_CDOE = ?
	]]>
	</query>

	<query id="FrmMcpLoading.getQueryWeight" desc="根据上料支数查询重量">
	<![CDATA[
	SELECT  NVL(SUM(T1.ACT_WEIGHT),0) ACT_WEIGHT
  FROM (SELECT T.ACT_WEIGHT
          FROM MAT_BC_M T, YDM_BC_BUTTRESS B
         WHERE T.MAT_NO = B.MAT_NO
           AND T.PRODUCT_FLAG = '801401'
           AND T.MAT_STATUS = '80150103'
           AND T.JUDGE_STOVE_NO = ?
           AND NVL(T.BATCH_NO, '/') = NVL(?, '/')
           AND NVL(T.BATCH_GROUD_NO, '/') = NVL(?, '/')
         ORDER BY T.MAT_NO ASC) T1
 WHERE ROWNUM < ?

			]]>
	</query>
	<query id="FrmMcpLoading.doBeside" desc="修改工序状态为结炉">
		<![CDATA[
		UPDATE MCH_COM_INFO
 SET STATION_STATUS = '2'
WHERE HEAT_PLAN_NO = ?
 AND PLINE_CODE = ?
 AND STATION_CODE = ?
			]]>
	</query>
	<query id="FrmMcpLoading.queryYdmOut" desc="查询出库信息">
	<![CDATA[
SELECT OUTSTOCK_SQE,
       OUTSTOCK_PLAN_NO,
       OUTSTOCK_DOC,
       OUTSTOCK_TYPE_CODE,
       OUTSTOCK_TYPE_NAME,
       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,
       DEPARTMENT_CODE,
       DEPARTMENT_DESC,
       ACT_WEIGHT,
       BAL_YEAR_MONTH
  FROM (SELECT *
          FROM YDM_BC_OUTLIST
         WHERE OUTSTOCK_TYPE_CODE = '800801'
           AND JUDGE_STOVE_NO = ?
           AND NVL(BATCH_NO,'/') = NVL(?,'/')
           AND NVL(BATCH_GROUD_NO,'/') = NVL(?,'/')
           AND NVL(OUTSTOCK_DOC,'/') = NVL(?,'/')
           AND OUTSTOCK_PLAN_NO = ?
          ORDER BY MAT_NO DESC)
 WHERE ROWNUM < ? 
	]]>
	</query>

	<query id ="FrmMcpLoading.selectBack">

		SELECT * FROM YDM_BC_BUTTRESS_BACK WHERE MAT_NO = ? AND PLINE_CODE = ?
	</query>

	<query id="FrmMcpLoading.queryMatZc" desc="查询新增物料信息">
		<![CDATA[
SELECT T1.*
  FROM (SELECT T.MAT_NO,
               T.PRODUCT_FLAG,
               T.MAT_STATUS,
               T.JUDGE_STOVE_NO,
               T.BATCH_NO,
               T.BATCH_GROUD_NO,
               T.MATERIAL_NO,
               T.MATERIAL_NAME,
               T.PRODUCCODE,
               T.PRODUCNAME,
               T.STEELCODE,
               T.STEELNAME,
               T.GRADECODE,
               T.GRADENAME,
               T.SPEC_CODE,
               T.SPEC_NAME,
               T.MODEL_CODE,
               T.MODEL_DESC,
               T.STD_CODE,
               T.STD_NAME,
               T.STD_STYLE,
               T.STD_STYLE_DESC,
               T.ORDER_NO,
               T.ORDER_SEQ,
               T.ORDER_SEQ_NO,
               T.PROCESS_CDOE,
               T.PROCESS_DESC,
               T.PLINE_CODE,
               T.PLINE_NAME,
               T.MAT_ORIGIN_CODE,
               T.MAT_ORIGIN_NAME,
               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.BELONG_CODE,
               T.BELONG_NAME,
               T.LOCK_FLAG,
               T.ORD_PK,
               T.ORD_LN_PK,
               SUBSTR(T.ORD_LN_DLY_PK, 0, INSTR(T.ORD_LN_DLY_PK, '-') - 1) ORD_LN_DLY_PK,
               T.BAL_YEAR_MONTH,
               T.JUDGE_STD_NAME,
               T.JUDGE_STD_DES,
               T.SOURE_CODE,
               T.SOURE_NAME,
               T.MNG_LOCK_FLAG,
               B.STORAGE_NO,
               B.LOCATION_NO,
               B.LARY_NO,
               B.LOC_NO,
               B.STORAGE_ATTR,
               B.STORAGE_ATTR_NAME,
               B.STORAGE_TYPE_NO,
               B.STORAGE_TYPE_NAME,
               B.MANAGEMENT_NO,
               B.MANAGEMENT_NAME,
               B.DEPARTMENT_CODE,
               B.DEPARTMENT_DESC,
               T.STOVE_NO
          FROM MAT_BC_M T, YDM_BC_BUTTRESS B
         WHERE T.MAT_NO = B.MAT_NO
           AND T.PRODUCT_FLAG = '801401'
           AND T.MAT_STATUS = '80150103'
           AND T.HEAT_PLAN_NO_NEXT = ?
            AND (EXISTS (SELECT 1 FROM PLN_ZY_JGX_M  WHERE HEAT_PLAN_NO = T.HEAT_PLAN_NO_NEXT AND IF_MATCH_ODD = '5') OR
          ( NVL(T.BATCH_NO, '/') =  NVL(?, '/')
          AND   NVL(T.BATCH_GROUD_NO, '/') =  NVL(?, '/')))
    	   AND T.NEXT_PROCESS_CDOE = 'G'
          ORDER BY DECODE(B.STORAGE_NO,?,0,1), NVL(T.LOCK_FLAG,'0'),NVL(T.MNG_LOCK_FLAG,'0'),T.MAT_NO ASC) T1
 WHERE ROWNUM < ?
		]]>
	</query>
	<query id="FrmMcpLoading.AddComInfoResult1" desc="修改材料状态和工序编码">
		<![CDATA[
UPDATE PORT_MCH_BATCH_SAMPLE_RESULT T SET T.MAT_STATUS=?,T.OP_PROCESS=?
WHERE T.HEAT_PLAN_NO=? AND T.MAT_NO=?
			]]>
	</query>
	
	<query id="FrmMcpLoading.AddPortVrp" desc="新增管号队列">
		<![CDATA[
		INSERT INTO port_mch_batch_sample_result
  (HEAT_PLAN_NO,
   MAT_NO,
   M_MAT_NO,
   M_M_MAT_NO,
   LOT_NO,
   LOT_NO_SQE,
   PLINE_CODE,
   PLINE_NAME,
   JUDGE_STOVE_NO,
   BATCH_NO,
   GROUP_NO,
   STOVE_NO,
   FLAG_STOVE_NO,
   ACT_DIMATER,
   ACT_HEIGHT,
   ACT_LEN,
   ACT_LEN_MIN,
   ACT_LEN_MAX,
   ACT_COUNT,
   ACT_WEIGHT,
   ACT_THEORY_WEIGHT,  
   OP_PROCESS,
   LEVE_LOG, 
   PRC_TECHNOLOGY_PATH,
   PRO_USER,
   PRO_SHIFT,
   PRO_GROUP,
   PRO_TIME,
   PRO_PLAN_ID,
   GX_PLAN_NO,
   OUTNUM_CUT,
   PHY_BATCH_NO,
   FEED_HEAT_NO)
VALUES
  (?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,   
   ?,
   ?, 
   ?,  
   ?,
   ?,
   ?,
   TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'),
   ?,
   ?,
   ?,
   ?,
   ?)		
			]]>
	</query>


	<query id="FrmMcpLoading.AddPortNew" desc="新增管号队列">
		<![CDATA[
	INSERT INTO PORT_MCH_BATCH_SAMPLE_RESULT
  (HEAT_PLAN_NO,
   MAT_NO,
   M_MAT_NO,
   M_M_MAT_NO,
   LOT_NO,
   LOT_NO_SQE,
   PRO_PLAN_ID,
   GX_PLAN_NO,
   PLINE_CODE,
   PLINE_NAME,
   JUDGE_STOVE_NO,
   BATCH_NO,
   GROUP_NO,
   STOVE_NO,
   FLAG_STOVE_NO,
   ACT_DIMATER,
   ACT_HEIGHT,
   OUTNUM_CUT,
   ACT_LEN,
   ACT_LEN_MIN,
   ACT_LEN_MAX,
   ACT_COUNT,
   ACT_WEIGHT,
   ACT_THEORY_WEIGHT,
   IS_SAMPLE_PIPE,
   SAMPLE_PIPE_LEN,
   GET_SAMPLE_SHIFT,
   GET_SAMPLE_CLASS,
   GET_SAMPLE_NAME,
   GET_SAMPLE_TIME,
   OLD_JUDGE_STOVE_NO,
   GROUP_FLAG,
   OP_PROCESS,
   MAT_STATUS,
   LEVE_LOG,
   INSTORE_FLAG,
   PRC_TECHNOLOGY_PATH,
   VM_INSTORE_FLAG,
   RETURN_PROCESS,
   PHY_BATCH_NO,
   PRO_USER,
   PRO_SHIFT,
   PRO_GROUP,
   PRO_TIME,
   FEED_HEAT_NO,
   BAR_CODE,
   HEAT_PLAN_SQE,PRO_YEAR_MONTH_DAY,BAL_YEAR_MONTH)
  SELECT M.HEAT_PLAN_NO,
         T.MAT_NO,
         '',
         '',
         M.ZY_BATCH_ID,
         '',
         M.PRO_PLAN_ID,
         M.GX_PLAN_NO,
         M.PLINE_CODE,
         M.PLINE_NAME,
         M.JUDGE_STOVE_NO,
         T.BATCH_NO,
         T.BATCH_GROUD_NO,
         M.STOVE_NO,
         M.JUDGE_STOVE_NO,
         T.ACT_DIMATER,
         T.ACT_HEIGHT,
         M.OUTNUM_CUT,
         T.ACT_LEN,
         T.ACT_LEN_MIN,
         T.ACT_LEN_MAX,
         T.ACT_COUNT,
         T.ACT_WEIGHT,
         T.ACT_WEIGHT,
         '0',
         '',
         '',
         '',
         '',
         NULL,
         '',
         '',
         '701301',
         '00',
         '00',
         '0',
         '',
         '',
         '',
         T.BATCH_NO,
         ?,
         ?,
         ?,
         sysdate,
         ?,
         '',
         ?,?,?
    FROM MAT_BC_M T, PLN_ZY_JGX_M M
   WHERE T.MAT_NO = ?
     AND M.HEAT_PLAN_NO = ?
			]]>
	</query>



	<query id="FrmMcpLoading.updatePlnZyRclM" desc="新增时修改加工计划表">
		<![CDATA[
UPDATE pln_zy_jgx_c C
   SET REAL_INDOUBLE_NUM = TO_NUMBER(NVL(REAL_INDOUBLE_NUM, 0)) + TO_NUMBER(?),
       REAL_INDOUBLE_WT  = TO_NUMBER(NVL(REAL_INDOUBLE_WT, 0)) + TO_NUMBER(?),
        Loadtime = (SELECT MIN(LOAD_TIME) FROM MCH_LOADING_RESULT WHERE HEAT_PLAN_NO = C.HEAT_PLAN_NO AND BATCH_NO = C.BATCH_NO AND BATCH_GROUD_NO = C.BATCH_GROUD_NO)
 WHERE HEAT_PLAN_NO = ? AND heat_plan_sqe=?
		]]>
	</query>

	<query id="FrmMcpLoading.updatePlnZyDbkM2" desc="新增时修改镦拔扩计划表">
		<![CDATA[
UPDATE pln_zy_DBK_c
   SET PER_STATUS = ?
 WHERE HEAT_PLAN_NO = ? AND BATCH_NO = ?
		]]>
	</query>
	<query id="FrmMcpLoading.updatePlnZyRclM2" desc="新增时修改加工计划表">
		<![CDATA[
UPDATE pln_zy_jgx_c
   SET PER_STATUS = ?
 WHERE HEAT_PLAN_NO = ? AND BATCH_NO = ?
		]]>
	</query>
	
	<query id="FrmMcpLoading.updatePlnZyRclMpln" desc="新增时修改加工计划表">
		<![CDATA[
UPDATE pln_zy_jgx_m M
   SET PLANSTATUS  = ?,
       PER_STATUS  = ?,
         Loadtime = (SELECT MIN(LOAD_TIME) FROM MCH_LOADING_RESULT WHERE HEAT_PLAN_NO = M.HEAT_PLAN_NO)
 WHERE HEAT_PLAN_NO = ?
		]]>
	</query>

	<query id="FrmMcpLoading.queryOrderGroupNo" desc="新增时修改加工计划表">
		<![CDATA[
SELECT * FROM MCH_GROUPNO WHERE ORDER_NO = ?
		]]>
	</query>

	<query id="FrmMcpLoading.InsertIntoOrderGroupNo" desc="新增时修改加工计划表">
		<![CDATA[

INSERT INTO MCH_GROUPNO
  (ORDER_NO, GROUP_MAX, GROUP_MIN, GROUP_NO,GROUP_MAX_SIGN,
   GROUP_MIN_SIGN)
VALUES
  (?, ?, ?, ?,?,?)

		]]>
	</query>

	<query id="FrmMcpLoading.deleteYdmBack" desc="清空位置表备份">
		<![CDATA[
DELETE FROM YDM_BC_BUTTRESS_BACK  WHERE  PLINE_CODE= ? AND MAT_NO =?
		]]>
	</query>


	<query id="FrmMcpLoading.insertYdmBack" desc="插入位置备份表">
		<![CDATA[
  INSERT INTO YDM_BC_BUTTRESS_BACK
      (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,
       UPDATE_NAME,
       UPDATE_TIME,
       DELETE_NAME,
       DELETE_TIME,
       DEPARTMENT_CODE,
       DEPARTMENT_DESC,
       PLINE_CODE)
      SELECT 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,
             UPDATE_NAME,
             UPDATE_TIME,
             DELETE_NAME,
             DELETE_TIME,
             DEPARTMENT_CODE,
             DEPARTMENT_DESC,
             ?
        FROM YDM_BC_BUTTRESS
    WHERE MAT_NO = ?
		]]>
	</query>


	<query id="FrmMcpLoading.insertYdmBack2" desc="插入位置备份表">
		<![CDATA[
  INSERT INTO YDM_BC_BUTTRESS_BACK
      (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,
       UPDATE_NAME,
       UPDATE_TIME,
       DELETE_NAME,
       DELETE_TIME,
       DEPARTMENT_CODE,
       DEPARTMENT_DESC,
       PLINE_CODE)
      SELECT MAT_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,
             UPDATE_NAME,
             UPDATE_TIME,
             DELETE_NAME,
             DELETE_TIME,
             DEPARTMENT_CODE,
             DEPARTMENT_DESC,
             ?
        FROM YDM_BC_BUTTRESS
    WHERE MAT_NO = ?
		]]>
	</query>




	<query id = "FrmMcpLoading.CancelNodeFlag" desc = "结炉回退">
		DECLARE
		BEGIN
		UPDATE PLN_ZY_JGX_C T
		SET
		T.BESIDE_STATUS      = '00'
		WHERE T.HEAT_PLAN_NO = '#HEAT_PLAN_NO#'
		AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
		AND T.BATCH_NO = '#BATCH_NO#';

		UPDATE PLN_ZY_JGX_M T
		SET T.PLANSTATUS = '20'
		WHERE T.HEAT_PLAN_NO = '#HEAT_PLAN_NO#'
		AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#';

		UPDATE MCH_COM_INFO T
		SET T.STATION_STATUS = '1'
		WHERE T.HEAT_PLAN_NO = '#HEAT_PLAN_NO#'
		AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
		AND T.BATCH_NO = '#BATCH_NO#';

		END;
	</query>

</queryMap>