<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="合同综合信息">
	<query id="CoreOrderCost.QueryOrderCost" desc="查询合同状态">
		<![CDATA[
SELECT M.DESGIN_KEY,
			       T.ORD_PK,
			       T.ORD_LN_PK,
			       T.ORDER_NO,
			       T.ORDER_SEQ,
			       T.DELIVERY_NO,
			       (T.ORDER_NO || '/' || T.ORDER_SEQ) ORDER_NO_SEQ,
			       (SELECT A.PRODUC_DESC
			          FROM COM_BASE_PRODUCT A
			         WHERE A.PRODUCCODE = T.PRODUCCODE
			           AND A.VALIDFLAG = '1') PRD_CLS,
			       T.PRODUCCODE,
			       T.PRODUCNAME,
			       T.STD_CODE,
			       T.STD_NAME,
			       T.STEELCODE,
			       T.STEELNAME,
			       T.SPEC_CODE,
			       T.SPEC_NAME,
			       T.OUTDIAMETER,
			       T.WALLTHICK,
			       T.LEN_UNIT,
			       T.LENGTHMAX,
			       T.LENGTHMIN,
			       T.LENGTHDISC,
			       T.MODEL_CODE,
			       T.MODEL_DESC,
			       T.ORDERWEIGHT,
			       DECODE(T.ORDER_UNIT, '支', '支', '吨') ORDERWEIGHTUNIT,
			       DECODE(T.TOTLENGTH, 0, '', T.TOTLENGTH) TOTLENGTH,
			       T.TOTLENGTH_UNIT,
			       T.DELVRY_RANGE_TPE,
			       T.DELVRY_RANGE_MIN,
			       T.DELVRY_RANGE_MAX,
			       '(-' || TO_CHAR(ABS(T.DELVRY_RANGE_MIN)) ||
			       DECODE(T.DELVRY_RANGE_TPE, '%', '%', '') || ',' ||
			       TO_CHAR(T.DELVRY_RANGE_MAX) ||
			       DECODE(T.DELVRY_RANGE_TPE, '%', '%', '') || ')' DELVRY_RANGE,
			       T.BUYER_ID,
			       (SELECT A.ABRVITION
			          FROM SLM_BASE_CUSTOMER A
			         WHERE A.CUSTOMER_NO = T.BUYER_ID) BUYER_NAME,
			       T.ORDER_SPECIAL_DESC,
			       T.ADD_ASK_NO,
			       M2.ORDER_ADD_DESC,
			       (SELECT A.BASENAME
			          FROM COM_BASE_INFO A
			         WHERE A.BASECODE = T.ORDERFROM) ORDERFROM,
			       T.FINAL_USER,
			       NVL((SELECT A.ABRVITION
			             FROM SLM_BASE_CUSTOMER A
			            WHERE A.CUSTOMER_NO = DECODE(T.FINAL_USER,
			                                         NULL,
			                                         T.BUYER_ID,
			                                         '/',
			                                         T.BUYER_ID,
			                                         T.FINAL_USER)),
			           DECODE(T.FINAL_USER_DESC,
			                  NULL,
			                  T.BUYER_NAME,
			                  '/',
			                  T.BUYER_NAME,
			                  T.FINAL_USER_DESC)) FINAL_USER_DESC,
			       TO_CHAR(T.DELVRY_EDATE, 'YYYY-MM-DD') DELVRY_EDATE,
			       T.ORDERCONTACT,
			       (SELECT A.BASENAME
			          FROM COM_BASE_INFO A
			         WHERE A.BASECODE = T.MONITORDEMAND) MONITORDEMAND,
			       E.PRDCRPRO,
			       T.SPECSTANDARD,
			       T.PSC,
			       T.MSC,
			       T.CODE_JG,
			       T.CODE_DJ_BL,
			       T.PLANWEIGHT,
			       T.PAYDOWNWEIGHT,
			       DECODE(E.ORDER_SOURCE, '补量需求', R.REQ_NAME, T.CREATE_NAME) CREATE_NAME,
			       TO_CHAR(DECODE(E.ORDER_SOURCE, '补量需求', R.REQ_TIME, T.CREATE_TIME),
			               'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
			       DECODE(E.ORDER_SOURCE, '补量需求', R.PLAN_DEAL_NAME, T.UPDATE_NAME) UPDATE_NAME,
			       TO_CHAR(DECODE(E.ORDER_SOURCE,
			                      '补量需求',
			                      R.PLAN_DEAL_TIME,
			                      T.UPDATE_TIME),
			               'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
			       T.ENDGXNAME,
			       T.MERGETYPE,
			       DECODE(T.JZ_FILE_IF_ALL, '1', '是', '0', '否') JZ_FILE_IF_ALL,
			       T.PRDCR_NO,
			       E.ROLL_MONTH,
			       T.MATERIAL_NO,
			       T.MATERIAL_DESC,
			       T.BL_GROUP_NUM,
			       T.SHRT_LEN_RATO,
			       T.SHORTEST,
			       T.LONG_LEN_RATO,
			       T.LONGEST,
			       T.SHRT_STOVE,
			       T.AVG_LEN_MIN,
			       T.DIFRNC_LEN_MAX,
			       T.SIGL_LEN,
			       T.ENDLEN_SPECSTD,
			       T.STATION_NO,
			       T.STATION_NM,
			       T.PRODUCE_SORT,
			       T.USE_CODE,
			       T.USE_DESC,
			       DECODE(T.TOTLENGTH_M, 0, '', T.TOTLENGTH_M) TOTLENGTH_M,
			       T.ORDERNUM,
			       (SELECT A.BASENAME
			          FROM COM_BASE_INFO A
			         WHERE A.BASECODE = T.OUTS_BILLET_FL) OUTS_BILLET_FL,
			       T.PIPE_PROPERTY,
			       T.LEN_TOEND_MIN,
			       T.LEN_TOEND_MAX,
			       T.LENGTH_JG,
			       T.WEIGH_TYPE,
			       T.TRANSIT_TYP,
			       DECODE(E.ORDER_SOURCE,
			              '补量需求',
			              R.ACCEPT_NO,
			              T.ACCEPT_NO) ACCEPT_NO,
			       (SELECT A.BASENAME
			          FROM COM_BASE_INFO A
			         WHERE A.BASECODE = T.OUTS_STL_PIPE_FL) OUTS_STL_PIPE_FL,
			       H.SALE_AREA_DESC,
			       DECODE(T.JGORD_IS_OK, '0', '否', '1', '是', '2', '/') JGORD_IS_OK,
			       DECODE(T.JGL_REQ_IS_OK, '0', '否', '1', '是', '2', '/') JGL_REQ_IS_OK,
			       DECODE(T.DJBL_REQ_IS_OK, '0', '否', '1', '是', '2', '/') DJBL_REQ_IS_OK,
			       DECODE(T.IF_SALE_FREEZE, '1', '是', '0', '否') IF_SALE_FREEZE,
			       T.ASK_TYPE_STATUS,
			       T.STD_STYLE_DESC,
			       NVL(T.ROLL_WELL_MONTH, T.ROLL_MONTH) ROLL_WELL_MONTH,
			       T.PAYDOWN_NUM,
			       T.HEIGHT_ORD_MIN,
			       T.HEIGHT_ORD_MAX,
			       M2.AW,
			       (SELECT A.BASENAME FROM COM_BASE_INFO A WHERE A.BASECODE = E.PRIORITY) PRIORITY,
			       E.PRIORITY_MEMO,
			       E.ORDER_SOURCE,
			       E.ORD_LN_DLY_PK,
			       E.PLN_DIVIDE_ID,
			       E.R_NUM_ID,
			       E.CRAFT_SEQ,
			       E.CRAFT_FILE_NO,
			       E.CRAFT_NO_V,
			       (SELECT T1.CRAFT_NAME
			          FROM CRAFT_ORD_DESIGN_APPOINT T1
			         WHERE T1.ORD_LN_PK = T.ORD_LN_PK) CRAFT_FILE_MAN,
			       (SELECT MAX(T1.CRAFT_NO)
			          FROM CRAFT_ORD_DESIGN T1
			         WHERE T1.ORD_LN_PK = T.ORD_LN_PK
			           AND T1.VALIDFLAG = '1') CRAFT_NO_NEW,
			       (SELECT MAX(T1.CRAFT_NO_V)
			          FROM CRAFT_ORD_DESIGN T1
			         WHERE T1.ORD_LN_PK = T.ORD_LN_PK
			           AND T1.VALIDFLAG = '1') CRAFT_NO_V_NEW,
			       DECODE(E.CRAFT_SEQ,
			              NVL((SELECT MAX(T1.CRAFT_SEQ)
			                    FROM CRAFT_ORD_DESIGN T1
			                   WHERE T1.ORD_LN_PK = T.ORD_LN_PK
			                     AND T1.VALIDFLAG = '1'),
			                  E.CRAFT_SEQ),
			              '无更新',
			              DECODE(E.PLANSTATUS, '4', '无更新', '5', '无更新', '待替换')) CRAFT_RENEW_ST,
			       E.INDEX_SEQ,
			       E.PROCESS_SEQ,
			       (SELECT P.WHOLE_BACKLOG_DESC
			          FROM CRAFT_ORD_DESIGN_MSC_PL P
			         WHERE P.DESGIN_KEY = M.DESGIN_KEY
			           AND P.MSC_PLINE = E.INDEX_SEQ) WHOLE_BACKLOG_DESC,
			       E.BOM,
			       (SELECT B.BASENAME
			          FROM COM_BASE_INFO B
			         WHERE B.BASECODE = E.GROUP_JGX) GROUP_JGX,
			       (SELECT B.BASENAME
			          FROM COM_BASE_INFO B
			         WHERE B.BASECODE = E.GROUP_RCL) GROUP_RCL,
			       DECODE(E.PLANSTATUS,
			              '1',
			              '已接收',
			              '2',
			              '已下发',
			              '3',
			              '生产中',
			              '4',
			              '生产完成',
			              '5',
			              '缴库完成') PLANSTATUS,
			       E.GRADECODE_ALL,
			       (SELECT A.GRADENAME
			          FROM COM_BASE_GRADE A
			         WHERE A.GRADECODE = E.GRADECODE) GRADECODE,
			       E.GROUP_ROLL_ALL,
			       (SELECT A.PLINE_NAME
			          FROM COM_BASE_PLINE A
			         WHERE A.PLINE_CODE = E.GROUP_ROLL) GROUP_ROLL,
			       E.BJ_TYPE,
			       E.E_IN_MATERIAL_NO,
			       E.E_IN_MATERIAL_DESC,
			       E.DIMATER_YLG,
			       E.HEIGHT_YLG,
			       E.STUFF_PROPERTY,
			       E.WEIGHT_PER_M,
			       E.PLAN_TOT_LEN_D,
			       E.ORDER_QTY_D,
			       E.ORDER_UNIT,
			       E.PLAN_WT_D,
			       E.PLAN_NUM_D,
			       E.FINISH_WT,
			       E.PLAN_WT_BEGIN,
			       E.PLAN_NUM_BEGIN,
			       E.HEIGHT_NK_MIN,
			       E.HEIGHT_NK_MAX,
			       E.AIM_LEN_END,
			       E.AIM_LEN_ROLL,
			       E.TOT_LEN_ONE_P,
			       E.CUT_NUM_P,
			       E.AIM_WALLTHICK,
			       E.ROLL_LENGTH,
			       E.PLAN_P_MAIN,
			       E.ISSUED_MAN,
			       E.IF_EXPORT,
			       E.ADJUST_PRICE_NUM,
			       E.TOTAL_COST,
			       TO_CHAR(E.ISSUED_TIME, 'YYYY-MM-DD HH24:MI:SS') ISSUED_TIME,
			       DECODE(E.F_IS_OK, '0', '否', '1', '是', '2', '/') F_IS_OK,
			       DECODE(E.IF_ALLOW_ISSUE, '0', '否', '1', '是') IF_ALLOW_ISSUE,
			       DECODE(E.G_IS_OK, '0', '否', '1', '是', '2', '/') G_IS_OK,
			       DECODE(E.GRADECODE_IS_OK, '0', '否', '1', '是') GRADECODE_IS_OK,
			       DECODE(E.D_IS_OK, '0', '否', '1', '是', '2', '/') D_IS_OK,
			       DECODE(E.PLAN_IS_OK, '0', '否', '1', '是') PLAN_IS_OK,
			       DECODE(E.E_IS_OK, '0', '否', '1', '是', '2', '/') E_IS_OK,
			       MC.UNIT_DESC_PROCESS UNIT_DESC,
			       F.DEPARTNAME,
			       E.LEN_ROLL_MAX,
			       E.LEN_ROLL_MIN,
			       Z1.Z_ORDERWEIGHT,
			       Z1.Z_ORDERNUM,
			       M2.DESIGN_STS
			  FROM PLN_SALEORD_PROC E
			  LEFT JOIN (SELECT Z.ORD_LN_DLY_PK,
			                    Z.PLN_DIVIDE_ID,
			                    SUM(Z.ORDERWEIGHT) Z_ORDERWEIGHT,
			                    SUM(Z.ORDERNUM) Z_ORDERNUM
			               FROM PLN_ORDER_ZG Z
			              GROUP BY Z.ORD_LN_DLY_PK, Z.PLN_DIVIDE_ID) Z1
			    ON Z1.ORD_LN_DLY_PK = E.ORD_LN_DLY_PK
			   AND Z1.PLN_DIVIDE_ID = E.PLN_DIVIDE_ID
			  LEFT JOIN PLN_SALEORD T
			    ON T.ORD_LN_DLY_PK = E.ORD_LN_DLY_PK
			  LEFT JOIN SLM_ORDER_HEAD H
			    ON H.ORD_PK = T.ORD_PK
			   AND H.VALIDFLAG = '1'
			  LEFT JOIN (SELECT DECODE(K.DESIGN_STS,
			                           'W',
			                           '等待',
			                           'S',
			                           '通过',
			                           'F',
			                           '失败') DESIGN_STS,
			                    H.ORD_LN_PK,
			                    H.AW,
			                    H.ORDER_ADD_DESC
			               FROM SLM_ORDER_LINE H, CRAFT_ORD_DESIGN M
			               LEFT JOIN CRAFT_ORD_DESIGN_STS_TKLG K
			                 ON K.DESGIN_KEY = M.DESGIN_KEY
			                AND K.VALIDFLAG = '1'
			              WHERE M.CRAFT_SEQ =
			                    (SELECT MAX(CRAFT_SEQ)
			                       FROM CRAFT_ORD_DESIGN
			                      WHERE ORD_LN_PK = M.ORD_LN_PK)
			                AND H.VALIDFLAG <> '0'
			                AND M.ORD_LN_PK = H.ORD_LN_PK
			                AND M.VALIDFLAG <> '0') M2
			    ON M2.ORD_LN_PK = T.ORD_LN_PK
			  LEFT JOIN COM_MSC MC
			  LEFT JOIN CORE_APP_DEPARTMENT DP
			    ON DP.DEPARTID = MC.UNIT_CODE_PROCESS
			  LEFT JOIN CORE_APP_DEPARTMENT F
			    ON F.DEPARTID = DP.PID ON T.MSC = MC.MSC
			  LEFT JOIN CRAFT_ORD_DESIGN M
			    ON M.ORD_LN_PK = T.ORD_LN_PK
			   AND M.CRAFT_SEQ = E.CRAFT_SEQ
			  LEFT JOIN PLN_SALEORDER_R_NUM R
			    ON R.R_NUM_ID = E.R_NUM_ID
			 WHERE T.ORD_LN_DLY_PK = E.ORD_LN_DLY_PK
		]]>
	</query>
	
	<query id="CoreOrderCost.queryLgInfo" desc="查询炼钢信息">
             <![CDATA[
SELECT T.GX_PLAN_NO,
       T.PLINE_CODE_A,
       T.PLINE_NAME_A,
       T.GRADECODE,
       T.GRADENAME,
       T.WLID_IN,
       T.WLDESC_IN,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.WIC,
       T.GIC,
       T.IF_MONITOR_LG,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T.PLAN_WT_S,
       T.FURNACE_WT,
       T.GX_PRO_SEQ,
       T.PRO_MONTH,
       TO_CHAR(ROUND(TO_NUMBER(NVL(T.PLAN_USETIME, '0')) / 60, 2)) PLAN_USETIME,
       TO_CHAR(T.PLAN_TIME_B, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_B,
       TO_CHAR(T.PLAN_TIME_E, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_E,
       T.FINISHWEIGHT,
       DECODE(T.EXE_STATUS,
              '0',
              '计划',
              '1',
              '生产中',
              '2',
              '已生产',
              '3',
              '关闭A',
              '异常') EXE_STATUS,
       DECODE(T.IS_REPAIR_PLN, '1', 'True', 'False') IS_REPAIR_PLN,
       T.REPAIR_TYPE,
       DECODE(T.IS_PLAN_OK, '1', 'True', 'False') IS_PLAN_OK,
       T.MEMO,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.UPDATE_NAME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       TO_CHAR(T.ISSUED_TIME, 'YYYY-MM-DD HH24:MI:SS') ISSUED_TIME,
       T.ISSUED_MAN,
       TO_CHAR(T.LAST_UNDOWN_TIME, 'YYYY-MM-DD HH24:MI:SS') LAST_UNDOWN_TIME,
       T.LAST_UNDOWN_MAN,
       T.PROCESSING_COST_A,
       T.TOTAL_COST_A
  FROM PLN_ORDER_CAST_S T
 WHERE 1 = 1
                 ]]>
	</query>
	
	<query id="CoreOrderCost.queryZzInfo" desc="查询铸造信息">
             <![CDATA[
           SELECT T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.CASTINGTYPE,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.GRADECODE,
       T.GRADENAME,
       T.DIAMETER_LZ,
       T.LENGTH_LZ,
       T.MATERIAL_NO,
       T.MATERIAL_NAME,
       T.WLID_IN,
       T.WLDESC_IN,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.WIC,
       T.GIC,
       T.IF_MONITOR_LG,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T.WT_CAST_ONE,
       T.PLAN_WT_S,
       T.PLAN_NUM_S,
       T.CAST_NUM_CALC,
       T.FURNACE_NUM_CALC,
       T.GX_PRO_SEQ,
       T.PRO_MONTH,
       TO_CHAR(ROUND(TO_NUMBER(NVL(T.PLAN_USETIME, '0')) / 60, 2)) PLAN_USETIME,
       TO_CHAR(T.PLAN_TIME_B, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_B,
       TO_CHAR(T.PLAN_TIME_E, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_E,
       T.CAST_NUM,
       T.FURNACE_NUM,
       T.FINISHWEIGHT,
       T.FINISH_NUM,
       DECODE(T.EXE_STATUS,'0','计划','1','生产中','2','已生产','3','关闭A','异常') EXE_STATUS,
       DECODE(T.IS_REPAIR_PLN, '1', 'True', 'False') IS_REPAIR_PLN,
       T.REPAIR_TYPE,
       DECODE(T.IS_PLAN_OK, '1', 'True', 'False') IS_PLAN_OK,
       T.ADD_WT_BEGIN,
       T.ADD_WT_END,
       DECODE(T.IF_CONNECT_AHEAD, '1', 'True', 'False') IF_CONNECT_AHEAD,
       T.ADD_WT_AHEAD,
       DECODE(T.IF_CONNECT_NEXT, '1', 'True', 'False') IF_CONNECT_NEXT,
       T.ADD_WT_NEXT,
       T.MEMO,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.UPDATE_NAME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       T.PROCESSING_COST_B,
       T.TOTAL_COST_B
  FROM PLN_ORDER_CAST_S T
 WHERE 1 = 1
                 ]]>
	</query>
	
	<query id="CoreOrderCost.queryDZInfo" desc="查询锻造排产信息">
		<![CDATA[
		SELECT T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.CASTINGTYPE,
       T.GRADECODE,
       T.GRADENAME,
       T.DIAMETER_OUT,
       T.LENGTH_OUT,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.OUT_WT_ONE,
       T.OUT_WT_TOT,
       T.OUT_NUM_TOT,
       T.DIAMETER_IN,
       T.LENGTH_IN,
       T.WT_ONE_IN,
       T.WLID_IN,
       T.WLDESC_IN,
       T.IN_WEIGHT_S,
       T.IN_NUM_S,
       T.WEIGTH_S,
       T.NUM_S,
       T.ADD_WT_IN,
       T.ADD_NUM_IN,
       T.MATCH_WT_IN,
       T.MATCH_NUM_IN,
       T.DZ_LOSE_ADD,
       T.DZ_CUT_HEAD_END,
       T.DZ_BURN_LOSE,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.WIC,
       T.GIC,
       T.GX_PRO_SEQ,
       T.PRO_MONTH,
       TO_CHAR(ROUND(TO_NUMBER(NVL(T.PLAN_USETIME, '0')) / 60, 2)) PLAN_USETIME,
       TO_CHAR(T.PLAN_TIME_B, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_B,
       TO_CHAR(T.PLAN_TIME_E, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_E,
       T.BATCHED_WT,
       T.BATCHED_NUM,
       T.FINISHWEIGHT,
       T.FINISHNUM,
       DECODE(T.EXE_STATUS,'0','计划','1','生产中','2','已生产','异常')EXE_STATUS,
       DECODE(T.IS_REPAIR_PLN, '1', 'True', 'False') IS_REPAIR_PLN,
       T.REPAIR_TYPE,
       DECODE(T.IS_PLAN_OK, '1', 'True', 'False') IS_PLAN_OK,
       T.ZY_BATCH_ID,
       T.PROCESSING_COST,
       T.TOTAL_COST
  FROM PLN_ORDER_DZ_S T
 WHERE 1 = 1
		    ]]>
	</query>
	
	<query id="CoreOrderCost.queryZgS" desc="查询轧管信息">
             <![CDATA[
            SELECT T.PRO_ORDER_NO,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.PLAN_GROUP_ID,
       T.ORDER_SOURCE,
       T.ORD_LN_DLY_PK,
       T.PLN_DIVIDE_ID,
       DECODE(T.ISENDGX,
              '1',
              NULLIF(T.ORDER_NO || '/' || T.ORDER_SEQ, '/'),
              T.PRO_PLAN_ID) PRO_PLAN_NO,
       NULLIF(T.ORDER_NO || '/' || T.ORDER_SEQ, '/') ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.REQ_BL_ID,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.STEELCODE,
       T.STEELNAME,
       T.GRADECODE,
       T.GRADENAME,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.LENGTHDISC,
       T.INWL_ID,
       T.INWL_DESC,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.LEN_ROLL_MAX,
       T.LEN_ROLL_MIN,
       T.AIMOUTDIAMETER,
       T.AIMWALLTHICK,
       T.AIMLENGTH,
       T.DIAMETER_GP,
       T.LEN_GP_SINGLE,
       T.ROLL_LENGTH,
       T.LEN_CUTHEAD,
       T.LEN_CUTEND,
       T.OUTNUM_CUT,
       T.DIAMETER_MANDREL,
       T.PASS_CODE,
       T.PASS_NAME,
       T.IN_WEIGHT_S,
       T.IN_NUM_S,
       T.WEIGTH_S,
       T.NUM_S,
       T.ADD_WT_IN,
       T.ADD_NUM_IN,
       T.MATCH_WT_IN,
       T.MATCH_NUM_IN,
       decode(T.ISENDGX, '1', 'True', 'False') ISENDGX,
       DECODE(T.IF_MONITOR_ZG, '1', 'True', 'False') IF_MONITOR_ZG,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T.CRAFT_FILE_NO,
       T.CRAFT_FILE_MAN,
       T.CRAFT_SEQ,
       T.STATION_ROAD,
       T.PRO_MONTH,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.WIC,
       T.GIC,
       T.GX_PRO_SEQ,
       TO_CHAR(ROUND(TO_NUMBER(NVL(T.PLAN_USETIME, '0')) / 60, 2)) PLAN_USETIME,
       TO_CHAR(T.PLAN_TIME_B, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_B,
       TO_CHAR(T.PLAN_TIME_E, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_E,
       T.BATCHED_WT,
       T.BATCHED_NUM,
       T.FINISHWEIGHT,
       T.FINISHNUM,
        DECODE(T.EXE_STATUS,
              '0',
              '计划',
              '1',
              '生产中',
              '2',
              '已生产',
              '异常') EXE_STATUS,
       decode(T.IS_REPAIR_PLN, '1', 'True', 'False') is_repair_pln,
       T.REPAIR_TYPE,
       decode(T.IS_PLAN_OK, '1', 'True', 'False') IS_PLAN_OK,
       decode(T.GPREQ_IF_OK, '1', 'True', 'False') GPREQ_IF_OK,
       T.GPREQ_ID,
       T.ZY_BATCH_ID,
       T.PROCESSING_COST,
       T.TOTAL_COST,
       T2.PRODUCCODE,
       T2.PRODUCNAME,
       T2.STD_CODE,
       T2.STD_NAME,
       T2.STD_STYLE,
       T2.STD_STYLE_DESC,
       T2.ORDER_SPEC_CODE,
       T2.ORDER_SPEC_DESC,
       T2.SPEC_CODE,
       T2.SPEC_NAME
  FROM PLN_ORDER_ZG_S T,
       (SELECT Q1.PRODUCCODE,
               Q1.PRODUCNAME,
               Q1.STD_CODE,
               Q1.STD_NAME,
               Q1.STD_STYLE,
               Q1.STD_STYLE_DESC,
               Q1.ORDER_SPEC_CODE,
               Q1.ORDER_SPEC_DESC,
               Q1.SPEC_CODE,
               Q1.SPEC_NAME,
               Q2.ORD_LN_DLY_PK
          FROM SLM_ORDER_LINE Q1, SLM_ORDER_LINE_DELIVERY Q2
         WHERE Q1.ORD_LN_PK = Q2.ORD_LN_PK) T2
 WHERE T.ORD_LN_DLY_PK = T2.ORD_LN_DLY_PK(+)
                 ]]>
	</query>
	
	<query id="CoreOrderCost.getPlnOrderDbks" desc="查询镦拔扩排产">
             <![CDATA[
   SELECT T.PRO_ORDER_NO,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.PLAN_GROUP_ID,
       T.ORDER_SOURCE,
       T.ORD_LN_DLY_PK,
       T.PLN_DIVIDE_ID,
       decode(t.isendgx,
              '1',
              NULLIF(T.ORDER_NO || '/' || T.ORDER_SEQ, '/'),
              t.pro_plan_id) pro_plan_no,
       NULLIF(T.ORDER_NO || '/' || T.ORDER_SEQ, '/') ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.REQ_BL_ID,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.INWL_ID,
       T.INWL_DESC,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.WEIGTH_S,
       T.NUM_S,
       T.GX_PRO_SEQ,
       to_char(round(to_number(nvl(T.PLAN_USETIME, '0')) / 60, 2)) PLAN_USETIME,
       TO_CHAR(T.PLAN_TIME_B, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_B,
       TO_CHAR(T.PLAN_TIME_E, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_E,
       DECODE(T.EXE_STATUS,
              '0',
              '计划',
              '1',
              '生产中',
              '2',
              '已生产',
              '3','关闭A','异常') EXE_STATUS,
       DECODE(T.IS_REPAIR_PLN, '1', 'True', 'False') IS_REPAIR_PLN,
       T.REPAIR_TYPE,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.LENGTHDISC,
       T.AIMOUTDIAMETER,
       T.AIMWALLTHICK,
       T.AIMLENGTH,
       T.OUTDIAMETER_IN,
       T.WALLTHICK_IN,
       T.LENGTH_IN,
       T.LEN_CUTHEAD,
       T.LEN_CUTEND,
       T.LENGTHMAX_IN,
       T.LENGTHMIN_IN,
       T.IN_WEIGHT_S,
       T.IN_NUM_S,
       T.ADD_WT_IN,
       T.ADD_NUM_IN,
       T.MATCH_WT_IN,
       T.MATCH_NUM_IN,
       decode(T.ISENDGX, '1', 'True', 'False')ISENDGX,
       decode(T.IF_MONITOR_DBK, '1', 'True', 'False') IF_MONITOR_DBK,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.WIC,
       T.GIC,
       T.CRAFT_FILE_NO,
       T.CRAFT_FILE_MAN,
       T.CRAFT_SEQ,
       T.STATION_ROAD,
       T.BATCHED_WT,
       T.BATCHED_NUM,
       T.FINISHWEIGHT,
       T.FINISHNUM,
       decode(T.IS_PLAN_OK, '1', 'True', 'False') IS_PLAN_OK,
       T.ZY_BATCH_ID,
        T.PRO_MONTH,
       T.PREVIOUS_GX,
       T.PREV_GXPLAN_ID,
       T.PROCESSING_COST,
       T.TOTAL_COST,
       T2.PRODUCCODE,
       T2.PRODUCNAME,
       T2.STD_CODE,
       T2.STD_NAME,
       T2.STD_STYLE,
       T2.STD_STYLE_DESC,
       T2.ORDER_SPEC_CODE,
       T2.ORDER_SPEC_DESC,
       T2.SPEC_CODE,
       T2.SPEC_NAME,
       T2.STEELCODE,
       T2.STEELNAME
  FROM PLN_ORDER_DBK_S T,
       (SELECT Q1.PRODUCCODE,
               Q1.PRODUCNAME,
               Q1.STD_CODE,
               Q1.STD_NAME,
               Q1.STEELCODE,
               Q1.STEELNAME,
               Q1.STD_STYLE,
               Q1.STD_STYLE_DESC,
               Q1.ORDER_SPEC_CODE,
               Q1.ORDER_SPEC_DESC,
               Q1.SPEC_CODE,
               Q1.SPEC_NAME,
               Q2.ORD_LN_DLY_PK
          FROM SLM_ORDER_LINE Q1, SLM_ORDER_LINE_DELIVERY Q2
         WHERE Q1.ORD_LN_PK = Q2.ORD_LN_PK) T2
 WHERE T.ORD_LN_DLY_PK = T2.ORD_LN_DLY_PK(+)
                 ]]>
	</query>
	
	<query id="CoreOrderCost.queryRcls" desc="查询热处理工序排产">
		<![CDATA[
SELECT T.PRO_ORDER_NO,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.PLAN_GROUP_ID,
       T.ORDER_SOURCE,
       T.ORD_LN_DLY_PK,
       T.PLN_DIVIDE_ID,
       DECODE(T1.ISENDGX,'1', NULLIF(T.ORDER_NO||'/'|| T.ORDER_SEQ,'/'),T.PRO_PLAN_ID) PRO_PLAN_NO,
        NULLIF(T.ORDER_NO||'/'|| T.ORDER_SEQ,'/') ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.REQ_BL_ID,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.INWL_ID,
       T.INWL_DESC,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.GRADECODE,
       T.GRADENAME,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.LENGTHDISC,
       T.LENGTHMAX_IN,
       T.LENGTHMIN_IN,
       T.LENGTH_IN,
       T.AIMLENGTH,
       T.IN_WEIGHT_S,
       T.IN_NUM_S,
       T.WEIGTH_S,
       T.NUM_S,
       T.MATCH_WT_IN,
       T.MATCH_NUM_IN,
       DECODE(T.IF_MONITOR_RCL,'1','True','False')IF_MONITOR_RCL,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.WIC,
       T.GIC,
       T.CRAFT_FILE_NO,
       T.CRAFT_FILE_MAN,
       T.CRAFT_SEQ,
       T.STATION_ROAD,
       T.GX_PRO_SEQ,
       TO_CHAR(ROUND(TO_NUMBER(NVL(T.PLAN_USETIME, '0')) / 60, 2)) PLAN_USETIME,
       TO_CHAR(T.PLAN_TIME_B, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_B,
       TO_CHAR(T.PLAN_TIME_E, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_E,
       T.BATCHED_WT,
       T.BATCHED_NUM,
       T.FINISHWEIGHT,
       T.FINISHNUM,
       DECODE(T.EXE_STATUS,
              '0',
              '计划',
              '1',
              '生产中',
              '2',
              '已生产',
              '3','关闭A','异常') EXE_STATUS,
        DECODE(T.IS_REPAIR_PLN, '1', 'TRUE', 'FALSE') IS_REPAIR_PLN,
       T.REPAIR_TYPE,
       T.ZY_BATCH_ID,
        T.PRO_MONTH,
       T.PREVIOUS_GX,
       T.PREV_GXPLAN_ID,
       T.PROCESSING_COST,
       T.TOTAL_COST,
       T1.GROUP_RCL,
       T2.PRODUCCODE,
       T2.PRODUCNAME,
       T2.STD_CODE,
       T2.STD_NAME,
       T2.STD_STYLE,
       T2.STD_STYLE_DESC,
       T2.ORDER_SPEC_CODE,
       T2.ORDER_SPEC_DESC,
       T2.SPEC_CODE,
       T2.SPEC_NAME,
       T2.STEELCODE,
       T2.STEELNAME
  FROM PLN_ORDER_RCL_S T,
       PLN_GX_RCL_M T1,
       (SELECT Q1.PRODUCCODE,
               Q1.PRODUCNAME,
               Q1.STD_CODE,
               Q1.STD_NAME,
               Q1.STEELCODE,
               Q1.STEELNAME,
               Q1.STD_STYLE,
               Q1.STD_STYLE_DESC,
               Q1.ORDER_SPEC_CODE,
               Q1.ORDER_SPEC_DESC,
               Q1.SPEC_CODE,
               Q1.SPEC_NAME,
               Q2.ORD_LN_DLY_PK
          FROM SLM_ORDER_LINE Q1, SLM_ORDER_LINE_DELIVERY Q2
         WHERE Q1.ORD_LN_PK = Q2.ORD_LN_PK) T2
 WHERE T.PRO_PLAN_ID = T1.PRO_PLAN_ID(+)
   AND T.ORD_LN_DLY_PK = T2.ORD_LN_DLY_PK(+)
		    ]]>
	</query>
	
	<query id="CoreOrderCost.queryJgxs" desc="查询加工线排产(用于界面显示)">
             <![CDATA[
 SELECT 
        T.IF_EXPORT,
       T.FINAL_USER_DESC,
       T.PROCESS_DESC_C_ZG,
       T.GROUP_ROLL_NAME,
       TO_CHAR(T.BEGIN_TIME_ZG, 'YYYY-MM-DD HH24:MI:SS') BEGIN_TIME_ZG,
       T.PRDCR_ADVC_DAY,
       T.WHOLE_BACKLOG_DESC,
       (SELECT T9.BASENAME FROM COM_BASE_INFO T9 WHERE T9.BASECODE=T.PRIORITY) PRIORITY,
       T.PRIORITY_MEMO,
       TO_CHAR(T.DELVRY_EDATE, 'YYYY-MM-DD HH24:MI:SS') DELVRY_EDATE,
       T.STATION_NM,
       T.OUTLINE_SITE_250,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.MEMO,
       T.PRO_ORDER_NO,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       NULLIF(T.ORDER_NO || '/' || T.ORDER_SEQ ,'/') PRO_PLAN_NO,
       T.PLAN_GROUP_ID,
       T.ORDER_SOURCE,
       T.ORD_LN_DLY_PK,
       T.PLN_DIVIDE_ID,
       NULLIF(T.ORDER_NO || '/' || T.ORDER_SEQ ,'/') ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.REQ_BL_ID,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.STEELCODE,
       T.STEELNAME,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.LENGTHMAX,
       T.LENGTHMIN,
       T.LENGTHDISC,
       T.AIMWALLTHICK,
       T.AIMLENGTH,
       T.SHRT_LEN_RATO,
       T.SHORTEST,
       T.LONG_LEN_RATO,
       T.LONGEST,
       T.SHRT_STOVE,
       T.AVG_LEN_MIN,
       T.DIFRNC_LEN_MAX,
       T.SIGL_LEN,
       T.ENDLEN_SPECSTD,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.LENGTHMAX_IN,
       T.LENGTHMIN_IN,
       T.LENGTH_IN,
       T.INWL_ID,
       T.INWL_DESC,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.IN_WEIGHT_S,
       T.IN_NUM_S,
       T.WEIGTH_S,
       T.NUM_S,
       T.MATCH_WT_IN,
       T.MATCH_NUM_IN,
       DECODE(T.IF_MONITOR_JGX, '1', 'True', 'False') IF_MONITOR_JGX,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.WIC,
       T.GIC,
       T.CRAFT_FILE_NO,
       T.CRAFT_FILE_MAN,
       T.CRAFT_SEQ,
       T.STATION_ROAD,
       T.GX_PRO_SEQ,
       TO_CHAR(round(TO_NUMBER(NVL(T.PLAN_USETIME, '0')) / 60, 2)) PLAN_USETIME,
       TO_CHAR(T.PLAN_TIME_B, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_B,
       TO_CHAR(T.PLAN_TIME_E, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_E,
       T.BATCHED_WT,
       T.BATCHED_NUM,
       T.FINISHWEIGHT,
       T.FINISHNUM,
       DECODE(T.EXE_STATUS,
              '0',
              '计划',
              '1',
              '生产中',
              '2',
              '已生产',
              '3','关闭A',
              '') EXE_STATUS,
       DECODE(T.IS_REPAIR_PLN, '1', 'True', 'False') IS_REPAIR_PLN,
       T.REPAIR_TYPE,
       DECODE(T.IS_PLAN_OK, '1', 'True', 'False') IS_PLAN_OK,
       T.ZY_BATCH_ID,
       T.PRO_MONTH,
       T.PREVIOUS_GX,
       T.PREV_GXPLAN_ID,
       T.PROCESSING_COST,
       T.TOTAL_COST,
       T1.GROUP_JGX,
       T2.PRODUCCODE,
       T2.PRODUCNAME,
       T2.STD_CODE,
       T2.STD_NAME,
       T2.STD_STYLE,
       T2.STD_STYLE_DESC,
       T2.ORDER_SPEC_CODE,
       T2.ORDER_SPEC_DESC,
       T2.SPEC_CODE,
       T2.SPEC_NAME,
       T3.ADD_ASK1,
       T3.ADD_ASK2,
       T3.ADD_ASK3,
       T3.ADD_ASK4,
       T3.ADD_ASK5,
       T3.ADD_ASK6,
       T3.ADD_ASK7,
       T3.ADD_ASK8,
       T3.ADD_ASK9,
       T3.ADD_ASK10,
       T3.ADD_ASK11,
       T3.ADD_ASK12,
       T3.ADD_ASK13,
          NVL((SELECT MAX(C1.CRAFT_PATH)
              FROM CRAFT_ORD_DESIGN_FILE C1
             WHERE C1.CRAFT_NO = T.CRAFT_FILE_NO),  (SELECT MAX(C2.CRAFT_PATH)
                      FROM CRAFT_ORD_DESIGN C2
                     WHERE C2.CRAFT_NO = T.CRAFT_FILE_NO )
            ) AS CRAFT_PATH
  FROM PLN_ORDER_JGX_S T,
       PLN_GX_JGX_M T1,
       (SELECT Q1.PRODUCCODE,
               Q1.PRODUCNAME,
               Q1.STD_CODE,
               Q1.STD_NAME,
               Q1.STD_STYLE,
               Q1.STD_STYLE_DESC,
               Q1.ORDER_SPEC_CODE,
               Q1.ORDER_SPEC_DESC,
               Q1.SPEC_CODE,
               Q1.SPEC_NAME,
               Q2.ORD_LN_DLY_PK
          FROM SLM_ORDER_LINE Q1, SLM_ORDER_LINE_DELIVERY Q2
         WHERE Q1.ORD_LN_PK = Q2.ORD_LN_PK) T2,
       (SELECT *
          FROM (SELECT Q.ASK_ITME_DESC,
                       Q.ASK_SUB_ITME_VAL_DESC,
                       Q.ORD_LN_DLY_PK
                  FROM (SELECT Q3.ASK_ITME_DESC,
                               Q1.ORD_LN_DLY_PK,
                               LISTAGG(Q3.ASK_SUB_ITME_VAL_DESC, ' ** ') WITHIN GROUP(ORDER BY Q3.ASK_ITME) ASK_SUB_ITME_VAL_DESC
                          FROM SLM_ORDER_LINE_DELIVERY Q1,
                               SLM_ORDER_LINE          Q2,
                               SLM_ORDER_ADD_ASK       Q3
                         WHERE Q1.ORD_LN_PK = Q2.ORD_LN_PK
                           AND Q2.ADD_ASK_NO = Q3.ADD_ASK_NO
                           AND Q1.VALIDFLAG = '1'
                           AND Q2.VALIDFLAG = '1'
                           AND Q2.CREATE_NAME IS NOT NULL
                           AND Q3.VALIDFLAG = '1'
                         GROUP BY Q3.ASK_ITME_DESC, Q1.ORD_LN_DLY_PK) Q) PIVOT(MAX(ASK_SUB_ITME_VAL_DESC) FOR ASK_ITME_DESC IN('喷标' AS
                                                                                                                               ADD_ASK1,
                                                                                                                               '涂漆' AS
                                                                                                                               ADD_ASK2,
                                                                                                                               '保护帽' AS
                                                                                                                               ADD_ASK3,
                                                                                                                               '丝扣油' AS
                                                                                                                               ADD_ASK4,
                                                                                                                               '计重方式' AS
                                                                                                                               ADD_ASK5,
                                                                                                                               '打捆' AS
                                                                                                                               ADD_ASK6,
                                                                                                                               '质量' AS
                                                                                                                               ADD_ASK7,
                                                                                                                               '交货材料' AS
                                                                                                                               ADD_ASK8,
                                                                                                                               '发货结算约定' AS
                                                                                                                               ADD_ASK9,
                                                                                                                               '特殊通径' AS
                                                                                                                               ADD_ASK10,
                                                                                                                               '特殊端部加工' AS
                                                                                                                               ADD_ASK11,
                                                                                                                               '取样备注' AS
                                                                                                                               ADD_ASK12,
                                                                                                                               '表面质量' AS
                                                                                                                               ADD_ASK13))) T3

 WHERE T.PRO_PLAN_ID = T1.PRO_PLAN_ID(+)
   AND T.ORD_LN_DLY_PK = T2.ORD_LN_DLY_PK(+)
   AND T.ORD_LN_DLY_PK = T3.ORD_LN_DLY_PK(+)
   AND 1 = 1
                 ]]>
	</query>
</queryMap>