<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc = "轧管委外管理">
<query id = "FrmEntrustedCheck.doQuerySubcontract" desc = "查询委托单">
<![CDATA[
 SELECT T.SUBCONTRACT_NO,
       T.LOT_NO,
       T.STOVE_NO,
       T.JUDGE_STOVE_NO,
       (SELECT T1.PLINE_NAME
          FROM COM_BASE_PLINE T1
         WHERE T1.PLINE_CODE = T.PLINE_CODE) PLINE_CODE,
       T.OFFLINE_PRO,
       T.BACKLINE_NUM,
       T.SUBCONTRACTCOMPLETE_NUM,
       T.SUBCONTRACT_NUM,
       TO_CHAR(T.ENTRUSTED_TIME, 'YYYY-MM-DD HH24:MI:SS') ENTRUSTED_TIME,
       T.REMARK,
       T.COL_USER,
       T.COL_SHIFT,
       T.COL_GROUP,
       T.SUBCONTRACT_FLAG,
       T.OFFLINE_TYPE,
       T.SUBCONTRACTSCRAP_NUM,
       T.ENTRUSTED_FLAG,
       T.ENTRUSTED_PLINE_CODE,
       T.ENTRUSTED_PLINE_NAME,
       T.ENTRUSTED_REMARK,
       T.SUBCONTRACT_WGT,
       T.SUBCONTRACT_COMPLETE_WGT,
       T.CRAFT_FILE_NO,
       T.STEEL_PIPE_PROCESS,
       T.UL_TESTING,
       T.SUBCONTRACT_NO_SEQ,
       T.SUBCONTRACT_TYPE,
       T.SUBCONTRACT_COMPLETE_LEN,
       T.SUBCONTRACT_COMPLETE_CUT,
       M.VARIETIES,
       REPLACE(M.PIPE_SIZE, '*', 'x') PIPE_SIZE,
       M.STEELNAME,
       M.GRADENAME
  FROM MIL_ENTRUSTED_BILL T, MIL_PLAN M
 WHERE T.JUDGE_STOVE_NO = M.JUDGE_STOVE_NO(+)
   AND T.PRO_PLAN_ID = M.PRO_PLAN_ID(+)
   AND T.GX_PLAN_NO = M.GX_PLAN_NO(+)
   AND T.SUBCONTRACT_NO || '&' LIKE '%' || ? || '%'
   AND T.ENTRUSTED_FLAG || '&' LIKE '%' || ? || '%'
   AND T.JUDGE_STOVE_NO || '&' LIKE '%' || ? || '%'
 ]]>
</query>
<query id = "FrmEntrustedCheck.doQueryPline" desc = "查询产线">
SELECT T.PLINE_NAME,T.PLINE_CODE FROM COM_BASE_PLINE T
</query>
<query id = "FrmEntrustedCheck.checkPass" desc = "审核通过">
UPDATE MIL_ENTRUSTED_BILL T
   SET T.ENTRUSTED_FLAG       = '1',
       T.ENTRUSTED_PLINE_CODE = ?,
       T.ENTRUSTED_PLINE_NAME = ?,
       T.ENTRUSTED_REMARK     = ?
 WHERE T.SUBCONTRACT_NO_SEQ = ?
   AND T.JUDGE_STOVE_NO = ?
</query>
<query id = "FrmEntrustedCheck.noCheckPass" desc = "审核不通过">
UPDATE MIL_ENTRUSTED_BILL T
   SET T.ENTRUSTED_FLAG       = '2',
       T.ENTRUSTED_REMARK     = ?
 WHERE T.SUBCONTRACT_NO_SEQ = ?
   AND T.JUDGE_STOVE_NO = ?
</query>
<query id = "FrmEntrustedCheck.cancelCheckPass" desc = "撤销审核">
UPDATE MIL_ENTRUSTED_BILL T
   SET T.ENTRUSTED_FLAG       = '0',
       T.ENTRUSTED_PLINE_CODE = '',
       T.ENTRUSTED_PLINE_NAME = '',
       T.ENTRUSTED_REMARK     = ''
 WHERE T.SUBCONTRACT_NO_SEQ = ?
   AND T.JUDGE_STOVE_NO = ?
</query>
<query id = "FrmEntrustedCheck.selectEntrustFlag" desc = "查询审核标志">
SELECT  T.ENTRUSTED_FLAG FROM MIL_ENTRUSTED_BILL T WHERE T.SUBCONTRACT_NO_SEQ = ? AND T.JUDGE_STOVE_NO = ?
</query>
</queryMap>