<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc = "轧管调度">
<query id = "FrmDispatch.doQueryMilPlan" desc = "查询生产炉信息">
<![CDATA[
 SELECT 
       ID,
       SEQ,
       STOVE_NO,
       JUDGE_STOVE_NO,
       LOT_NO,
       CONTRACT_NO,
       IMP_PROCESS,
       PLINE_CODE,
       DECODE(STATUS,'00','上料','05','开始锯切','15','入炉','25','开始穿孔','35','开始连轧','45','再入加热炉','55','开始定径','65','开始分切','75','开始矫直','85','开始探伤','95','开始质检')STATUS,
       PRODUCER,
       PROCESS_STATUS,
       DB_LENGTH,
       DB_HEIGHT,
       ROLL_LENGTH,
       SAW_NUM,
       TARGET_LENGTH,
       FINISH_USER,
       TARGET_LIABRARY,
       VARIETIES,
       PIPE_SIZE,
       BUCKLE_TYPE,
       LENGTH_RANGE,
       ROLL_STANDRAD,
       PIPE_SECTION,
       STEELCODE,
       STEELNAME,
       GRADECODE,
       GRADENAME,
       STEEL_STANDRAD,
       TARGET,
       BRANCH,
       TON,
       CUT_TARGET,
       CUT_LENGTH,
       CUT_WEIGHT,
       DB_NUM,
       TO_CHAR(START_TIME, 'YYYY-MM-DD HH24:MI:SS') START_TIME,
       TO_CHAR(END_TIME, 'YYYY-MM-DD HH24:MI:SS') END_TIME,
       TO_CHAR(TOM, 'YYYY-MM-DD HH24:MI:SS') TOM,
       TO_CHAR(TOC, 'YYYY-MM-DD HH24:MI:SS') TOC,
       DECODE(NODE_STATUS,'10','锯切完成','20','出炉','30','穿孔完成','40','连轧完成','50','出再加热炉','60','出定径','70','分切完成','80','矫直完成','90','探伤完成','93','质检完成','99','入库')NODE_STATUS,
       CUT_HEAD_LENGTHP,
       CUT_TRAIL_LENGTHP,
       CONTROL_THICKP,
       OFFLINE_FLAG,
       IS_BATCH,
       TO_CHAR(OFFLINE_DATE, 'YYYY-MM-DD HH24:MI:SS') OFFLINE_DATE,
       CUT_TYPE,
       ROLLING_STATUS,
       PRODUCE_STANDRAD,
       SIMPLE_PROCESS,
       BACK_LINE_FLAG,
       BACK_PLAN_FLAG
 FROM MIL_PLAN
 WHERE START_TIME || '&' LIKE ('%' || TO_DATE(?,'YYYY-MM-DD') || '%')
 --AND STATUS = '55' 
 ]]>
</query>
<query id = "FrmDispatch.doQueryMilSizingRack" desc = "查询管号队列">
<![CDATA[
 SELECT 
       MAT_NO,
       LOT_NO,
       STOVE_NO,
       JUDGE_STOVE_NO,
       STEELCODE,
       STEELNAME,
       GRADECODE,
       GRADENAME,
       PLINE_CODE,
       DECODE(STATUS,'0','正常轧制','1','剔除')STATUS,
       TO_CHAR(START_SIZING_TIME, 'YYYY-MM-DD HH24:MI:SS') START_SIZING_TIME,
       TO_CHAR(END_SIZING_TIME, 'YYYY-MM-DD HH24:MI:SS') END_SIZING_TIME,
       START_SIZING_TEMP,
       END_SIZING_TEMP,
       PIPE_DIAMETER,
       PIPE_THICKNESS,
       PIPE_LENGTH,
       FINISH_ROLL_TEMP,
       TO_CHAR(CBED_TIME, 'YYYY-MM-DD HH24:MI:SS') CBED_TIME,
       GROUP_FLAG,
       BEFORE_HEAT_NO,
       BEFORE_MAT_NO,
       REMARK,
       COL_MODE,
       TO_CHAR(COL_TIME, 'YYYY-MM-DD HH24:MI:SS') COL_TIME,
       COL_USER,
       COL_SHIFT,
       COL_GROUP,
       SEQ,
       TO_CHAR(SCRAP_TIME, 'YYYY-MM-DD HH24:MI:SS') SCRAP_TIME,
       RESULT_NO,
       CHANGE_FLAG,
       SCRAP_LOC
 FROM MIL_SIZING_RACK ORDER BY SEQ
 ]]>
</query>
<query id = "FrmDispatch.doQueryBaseReason" desc = "加载停机原因">
SELECT T.BASENAME,T.BASECODE
  FROM COM_BASE_INFO T
 WHERE T.VALIDFLAG = '1'
   AND T.SORTCODE IN ('50060101', '50060102', '50060103', '50060201','50060202','500603')
   ORDER BY T.SEQ
</query>
<query id = "FrmDispatch.doQueryStopData" desc = "查询停机数据">
<![CDATA[
 SELECT 
       LOT_NO,
       STOVE_NO,
       JUDGE_STOVE_NO,
       PLINE_CODE,
       TO_CHAR(START_TIME, 'YYYY-MM-DD HH24:MI:SS') START_TIME,
       TO_CHAR(END_TIME, 'YYYY-MM-DD HH24:MI:SS') END_TIME,
       END_REASON,
       MAT_NO,
       REMARK,
       COL_MODE,
       TO_CHAR(COL_TIME, 'YYYY-MM-DD HH24:MI:SS') COL_TIME,
       COL_USER,
       DECODE(COL_SHIFT,'0','常白班','1','早班','2','中班','3','夜班')COL_SHIFT,
       DECODE(COL_GROUP,'1','甲','2','乙','3','丙','4','丁')COL_GROUP,
       RESULT_NO
 FROM MIL_OPEN_STOP_RESULT
 WHERE COL_TIME || '&' LIKE ('%' || TO_DATE(?,'YYYY-MM-DD') || '%')
 AND COL_SHIFT || '&' LIKE ('%' || ? || '%')
 AND COL_GROUP || '&' LIKE ('%' || ? || '%')
 AND PLINE_CODE = ?
 ]]>
</query>
<query id = "FrmDispatch.deleteStopData" desc = "删除停机数据">
DELETE FROM MIL_OPEN_STOP_RESULT T WHERE T.MAT_NO = ?
</query>
<query id = "FrmDispatch.stopSizingRack" desc = "插入停机数据">
<![CDATA[
 INSERT INTO MIL_OPEN_STOP_RESULT(
        LOT_NO,
        STOVE_NO,
        JUDGE_STOVE_NO,
        PLINE_CODE,
        START_TIME,
        END_TIME,
        END_REASON,
        MAT_NO,
        REMARK,
        COL_MODE,
        COL_TIME,
        COL_USER,
        COL_SHIFT,
        COL_GROUP,
        RESULT_NO)
 VALUES( 
        ?,
        ?,
        ?,
        ?,
        to_date(?,'yyyy-MM-dd HH24:mi:ss'),
        SYSDATE,
        ?,
        ?,
        '',
        '1',
        SYSDATE,
        ?,
        ?,
        ?,
        ?)
        ]]>
</query>
<query id = "FrmDispatch.selectStopData" desc = "查询是否有停机记录">
SELECT COUNT(1)ACOUNT FROM MIL_OPEN_STOP_RESULT T WHERE T.MAT_NO = ?
</query>
</queryMap>