码迷,mamicode.com
首页 > 编程语言 > 详细

优化小数组件没有回写出来,

时间:2018-07-28 15:19:02      阅读:143      评论:0      收藏:0      [点我收藏+]

标签:cas   event   split   col   none   null   cli   sele   site   

技术分享图片

 

原因是,LOC_ID加工的数据出现错误,不是工厂数据,而是6900之类

技术分享图片

技术分享图片

 

技术分享图片

 

技术分享图片
SELECT MO.PRODUCTIONORDID MO_ID,
                       IT.ITEM,
                       IT.BOM_ID,
                         IT.QTYALLOCATED
                       * FP_GET_CONVRATE (TM.ITEM_ID,
                                          TM.UDF_MEINS,
                                          NVL (TU.QTY_UOM, TM.UDF_MEINS))
                          QTYALLOCATED,
                       SUBSTR (
                          CASE
                             WHEN MO.LOC_ID = 2021 THEN  NVL (TU.LOC_ID, IIS.LOC_ID)
                             WHEN    TRIM (IIS.PROC_TYPE) || TRIM (IIS.SP_PROC_TYPE) IN (E71) THEN 2029
                             ELSE
                                NVL (
                                   IT.LOCATION_ID,
                                   (SELECT X.LOC_ID
                                      FROM IN_ITEM_SITE X
                                     WHERE     X.ITEM_ID = IT.ITEM
                                           AND X.SITE_ID =
                                                  CASE
                                                     WHEN    TRIM (
                                                                IIS.PROC_TYPE)
                                                          || TRIM (
                                                                IIS.SP_PROC_TYPE) =
                                                             E70
                                                     THEN
                                                        2023
                                                     ELSE
                                                        MO.LOC_ID
                                                  END
                                           AND ROWNUM = 1))
                          END,
                          1,
                          4)
                          LOC_ID,
                       NVL (TU.QTY_UOM, TM.UDF_MEINS) QTYUOM
                       ,IT.LOCATION_ID
                       ,CASE WHEN LENGTH(IT.LOCATION_ID)=9 OR LENGTH(IT.LOCATION_ID)=7 THEN IT.LOCATION_ID  
                            ELSE SUBSTR(IT.LOCATION_ID,LENGTH(IT.LOCATION_ID)-8,4)
                            END  KKA
                      , NVL (
                                   (CASE WHEN LENGTH(IT.LOCATION_ID)=9 OR LENGTH(IT.LOCATION_ID)=7 THEN IT.LOCATION_ID  
                                    ELSE SUBSTR(IT.LOCATION_ID,LENGTH(IT.LOCATION_ID)-8,4)
                                    END ) ,
                                    
                                   (SELECT X.LOC_ID
                                      FROM IN_ITEM_SITE X
                                     WHERE     X.ITEM_ID = IT.ITEM
                                           AND X.SITE_ID =
                                                  CASE
                                                     WHEN    TRIM (
                                                                IIS.PROC_TYPE)
                                                          || TRIM (
                                                                IIS.SP_PROC_TYPE) =
                                                             E70
                                                     THEN
                                                        --‘2012‘
                                                        2023
                                                     ELSE
                                                        MO.LOC_ID
                                                  END
                                           AND ROWNUM = 1)) AA
                  FROM OUT_MO MO,
                       TEMP_ITEM_UOM TU,
                       IN_ITEM TM,
                       IN_ITEM_SITE IIS,
                       (  SELECT NVL (TMS.COMBINE_MO, MI.ROOTID) ROOTID,
                                 MI.PARENT_ID,
                                 MI.BOM_ID,
                                 MI.SITE_ID,
                                 MI.ITEM,
                                 MI.LOCATION_ID,
                                 SUM (
                                      MI.QTYALLOCATED
                                    * (NVL (TMS.QTYORDERED / TMS.ORIG_QTY, 1)))
                                    QTYALLOCATED
                            FROM TEMP_MO_SPLIT TMS, TEMP_MO_ITEM MI
                           WHERE TMS.MO_ID(+) = MI.ROOTID
                        GROUP BY NVL (TMS.COMBINE_MO, MI.ROOTID),
                                 MI.PARENT_ID,
                                 MI.BOM_ID,
                                 MI.SITE_ID,
                                 MI.ITEM,
                                 MI.LOCATION_ID) IT
                 WHERE     MO.PRODUCTIONORDID = IT.ROOTID
                       AND IT.SITE_ID = TU.SITE_ID(+)
                       AND IT.PARENT_ID = TU.PARENT_ID(+)
                       AND IT.ITEM = TU.ITEM_ID(+)
                       AND IT.ITEM = TM.ITEM_ID
                       AND MO.LOC_ID = IIS.SITE_ID
                       AND TM.ITEM_ID = IIS.ITEM_ID
                       AND MO.PRODUCTIONORDID=5000179906/480_1-MFG0001
                      -- AND IT.ITEM=‘000000102001002018‘
                       and IT.LOCATION_ID is not null
                      -- and IT.LOCATION_ID not like ‘20%‘
View Code

 

优化小数组件没有回写出来,

标签:cas   event   split   col   none   null   cli   sele   site   

原文地址:https://www.cnblogs.com/Snowfun/p/9381678.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!