<?xml version="1.0" encoding="UTF-8" ?>
<queryMap>
    <query id="CrmOrderProduceServer.Query" desc="查询生产进度">
        SELECT
            T.ORD_LN_DLY_PK,
            T.CREATE_NAME,
            TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
            T.APP_NUM,
            T.APP_UNIT,
            T.PSS_NUM,
            T.PSS_WGT,
            T.WGT_ESTMT,
            T.LG_NUM,
            T.LG_WGT,
            TO_CHAR(T.LG_TIME, 'YYYY-MM-DD HH24:MI:SS') LG_TIME,
            T.D_PLINE_CODE,
            T.D_PLINE_NAME,
            T.PASS_CODE,
            T.PASS_NAME,
            TO_CHAR(T.PLAN_TIME_B, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_B,
            DECODE(T.EXE_STATUS,'0','计划','1','生产中','2','完成','3','关闭')EXE_STATUS，
            T.GRADECODE,
            T.GRADENAME,
            T.DIAMETER_GP,
            T.ZG_NUM,
            T.ZG_WGT,
            TO_CHAR(T.PLAN_TIME_DBK, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_DBK,
            T.DBK_NUM,
            T.DBK_WGT,
            TO_CHAR(T.PLAN_TIME_RCL, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_RCL,
            T.RCL_NUM,
            T.RCL_WGT,
            TO_CHAR(T.PLAN_TIME_JGX, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_JGX,
            T.JGX_NUM,
            T.JGX_WGT,
            T.PRODUCT_NUM,
            T.PRODUCT_WGT,
            T.PRODUCT_LEN,
            DECODE(T.DATA_STATUS,'0','新增','1','修改','2','删除')DATA_STATUS,
            DECODE(T.IS_FLAG,'0','未同步','1','已同步')IS_FLAG,
            TO_CHAR(T.SYNCHRO_TIME, 'YYYY-MM-DD HH24:MI:SS') SYNCHRO_TIME,
            T.INITIAL_ID,
            T.OUTS_BILLET_FL,
            DECODE(T.EXE_STATUS_DBK,'0','计划','1','生产中','2','完成','3','关闭')EXE_STATUS_DBK,
            DECODE(T.EXE_STATUS_RCL,'0','计划','1','生产中','2','完成','3','关闭')EXE_STATUS_RCL,
            DECODE(T.EXE_STATUS_JGX,'0','计划','1','生产中','2','完成','3','关闭')EXE_STATUS_JGX,
            P.ORDER_NO,
            (SELECT ORDER_SEQ from SLM_ORDER_LINE where ORD_LN_PK = SUBSTR(t.ORD_LN_DLY_PK,0,length(t.ORD_LN_DLY_PK) - 3)) ORDER_SEQ
        FROM CRM_ORDER_PRODUCE T LEFT JOIN slm_order_head P ON SUBSTR(t.ORD_LN_DLY_PK,0,length(t.ORD_LN_DLY_PK) - 6) = p.ORD_PK
        WHERE
            1 = 1

    </query>

</queryMap>


