Commit 0ffd683b authored by prane's avatar prane

syncom mrp process optimization changes

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@196328 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1291af62
...@@ -4,7 +4,7 @@ select distinct item.item_code__plan as item_code ...@@ -4,7 +4,7 @@ select distinct item.item_code__plan as item_code
and ( independent_demand.site_code in ('@sitecode@') ) and ( independent_demand.site_code in ('@sitecode@') )
and ( item.item_code__plan >= '@itemcodefr@') and ( item.item_code__plan >= '@itemcodefr@')
and ( item.item_code__plan <= '@itemcodeto@') and ( item.item_code__plan <= '@itemcodeto@')
and (siteitem.site_code = independent_demand.site_code)) and (siteitem.site_code = independent_demand.site_code)
and siteitem.item_code = case when item.item_code__plan is null then item.item_code else item.item_code__plan end and siteitem.item_code = case when item.item_code__plan is null then item.item_code else item.item_code__plan end
and case when siteitem.master_sch is null then 'Y' else siteitem.master_sch end <> 'N' and case when siteitem.master_sch is null then 'Y' else siteitem.master_sch end <> 'N'
and (siteitem.mfg_type not in ('O','D') ) and (siteitem.mfg_type not in ('O','D') )
......
...@@ -167,7 +167,7 @@ UNION ALL ...@@ -167,7 +167,7 @@ UNION ALL
AND NVL(c.plan_prod,'N') = 'Y' AND NVL(c.plan_prod,'N') = 'Y'
AND a.item_code=d.item_code AND a.item_code=d.item_code
and d.item_ser not in ('FG01','FG07') and d.item_ser not in ('FG01','FG07')
AND a.EFF_date > to_date(fn_sysdate())) group by item_code,due_date AND a.EFF_date > to_date('@rundate@')) group by item_code,due_date
UNION ALL UNION ALL
SELECT item.item_code__plan as item_code,to_date('@fromdate@') as due_date, SELECT item.item_code__plan as item_code,to_date('@fromdate@') as due_date,
...@@ -187,23 +187,20 @@ and d.item_ser not in ('FG01','FG07') ...@@ -187,23 +187,20 @@ and d.item_ser not in ('FG01','FG07')
SELECT workorder_bill.item_code as item_code,to_date('@fromdate@') as due_date, SELECT workorder_bill.item_code as item_code,to_date('@fromdate@') as due_date,
sum( fn_get_avgpotency('@itemcode@' ,'@sitecode@' ,case when workorder_bill.QUANTITY is null then 0 else workorder_bill.QUANTITY end - case when (case when workorder_bill.ALLOC_QTY is null then 0 else workorder_bill.ALLOC_QTY end - case when workorder_bill.ISS_QTY is null then 0 else workorder_bill.ISS_QTY end) < 0 then case when workorder_bill.ISS_QTY is null then 0 else workorder_bill.ISS_QTY end else case when workorder_bill.ALLOC_QTY is null then 0 else workorder_bill.ALLOC_QTY end end )) as demand , sum( fn_get_avgpotency('@itemcode@' ,'@sitecode@' ,case when workorder_bill.QUANTITY is null then 0 else workorder_bill.QUANTITY end - case when (case when workorder_bill.ALLOC_QTY is null then 0 else workorder_bill.ALLOC_QTY end - case when workorder_bill.ISS_QTY is null then 0 else workorder_bill.ISS_QTY end) < 0 then case when workorder_bill.ISS_QTY is null then 0 else workorder_bill.ISS_QTY end else case when workorder_bill.ALLOC_QTY is null then 0 else workorder_bill.ALLOC_QTY end end )) as demand ,
0 as supply, 0 as stock_qty, 0 as oth_supply, 0 as pending_po, 0 as pending_do, 0 as pending_indent, 0 as pending_dr 0 as supply, 0 as stock_qty, 0 as oth_supply, 0 as pending_po, 0 as pending_do, 0 as pending_indent, 0 as pending_dr
from workorder_bill, workorder, item, siteitem from workorder_bill, workorder, item, siteitem , ITEM ITEM1
where workorder_bill.work_order = workorder.work_order where workorder_bill.work_order = workorder.work_order
and workorder_bill.item_code = item.item_code and workorder_bill.item_code = item.item_code
and workorder_bill.line_type <> 'B' and workorder_bill.line_type <> 'B'
and workorder_bill.item_code = siteitem.item_code and workorder_bill.item_code = siteitem.item_code
and workorder.site_code = siteitem.site_code and workorder.site_code = siteitem.site_code
and case when workorder_bill.QUANTITY is null then 0 else workorder_bill.QUANTITY end - case when (case when workorder_bill.ALLOC_QTY is null then 0 else workorder_bill.ALLOC_QTY end - case when workorder_bill.ISS_QTY is null then 0 else workorder_bill.ISS_QTY end ) < 0 then ( case when workorder_bill.ISS_QTY is null then 0 else workorder_bill.ISS_QTY end) else (case when workorder_bill.ALLOC_QTY is null then 0 else workorder_bill.ALLOC_QTY end) end > 0 and case when workorder_bill.QUANTITY is null then 0 else workorder_bill.QUANTITY end - case when (case when workorder_bill.ALLOC_QTY is null then 0 else workorder_bill.ALLOC_QTY end - case when workorder_bill.ISS_QTY is null then 0 else workorder_bill.ISS_QTY end ) < 0 then ( case when workorder_bill.ISS_QTY is null then 0 else workorder_bill.ISS_QTY end) else (case when workorder_bill.ALLOC_QTY is null then 0 else workorder_bill.ALLOC_QTY end) end > 0
and workorder.work_order in ( and item1.item_code = workorder.item_code
SELECT workorder.work_order and (workorder.site_code in ('@sitecode@') )
FROM workorder, item item1 AND ( item1.item_code__plan = '@itemcode@' )
WHERE item1.item_code = workorder.item_code and AND (workorder.due_date <= to_date('@todate@'))
(workorder.site_code in ('@sitecode@') ) AND AND (case when workorder.status is null then 'P' else workorder.status end in ('R','F'))
( item1.item_code__plan = '@itemcode@' ) AND AND (case when workorder.consider_wip is null then 'O' else workorder.consider_wip end = 'O')
(workorder.due_date <= to_date('@todate@')) AND
(case when workorder.status is null then 'P' else workorder.status end in ('R','F')) and
(case when workorder.consider_wip is null then 'O' else workorder.consider_wip end = 'O')
)
Group By workorder_bill.item_code,to_date('@fromdate@') Group By workorder_bill.item_code,to_date('@fromdate@')
) )
group by item_code,due_date group by item_code,due_date
......
select item_code,due_date, demand, 0 supply, 0 stock_qty, 0 oth_supply, SELECT item.item_code__plan as item_code,sorditem.due_date as due_date,
0 as pending_po, 0 as pending_do, 0 as pending_indent, 0 as pending_dr,tran_id,tran_ser,site_code from
(
SELECT sorditem.sale_order||'@'||sorditem.line_no as tran_id, 'Sord' as tran_ser, item.item_code__plan as item_code,sorditem.due_date as due_date,
((case when sorditem.quantity is null then 0 else sorditem.quantity end - case when sorditem.qty_alloc is null then 0 else sorditem.qty_alloc end - case when sorditem.qty_desp is null then 0 else sorditem.qty_desp end ) * case when sorditem.conv__qty_stdqty is null then 1 else sorditem.conv__qty_stdqty end ) as demand, ((case when sorditem.quantity is null then 0 else sorditem.quantity end - case when sorditem.qty_alloc is null then 0 else sorditem.qty_alloc end - case when sorditem.qty_desp is null then 0 else sorditem.qty_desp end ) * case when sorditem.conv__qty_stdqty is null then 1 else sorditem.conv__qty_stdqty end ) as demand,
0 as supply, 0 as stock_qty, 0 as oth_supply, 0 as pending_po, 0 as pending_do, 0 as pending_indent, 0 as pending_dr , sorditem.site_code 0 as supply, 0 as stock_qty, 0 as oth_supply, 0 as pending_po, 0 as pending_do, 0 as pending_indent, 0 as pending_dr , sorditem.sale_order||'@'||sorditem.line_no as tran_id, 'Sord' as tran_ser,sorditem.site_code as site_code
FROM sorder,sorditem, item FROM sorder,sorditem, item
WHERE (sorditem.item_code = item.item_code ) and WHERE (sorditem.item_code = item.item_code ) and
(sorder.sale_order = sorditem.sale_order ) and (sorder.sale_order = sorditem.sale_order ) and
...@@ -15,4 +12,3 @@ select item_code,due_date, demand, 0 supply, 0 stock_qty, 0 oth_supply, ...@@ -15,4 +12,3 @@ select item_code,due_date, demand, 0 supply, 0 stock_qty, 0 oth_supply,
(sorditem.due_date <= to_date('@todate@')) and (sorditem.due_date <= to_date('@todate@')) and
(case when sorder.status is null then 'P' else sorder.status end = 'P') and (case when sorder.status is null then 'P' else sorder.status end = 'P') and
(sorder.order_type not in ('S') ) (sorder.order_type not in ('S') )
)
...@@ -17,4 +17,4 @@ ...@@ -17,4 +17,4 @@
and ( case when sorder.status is null then 'P' else sorder.status end = 'P') and ( case when sorder.status is null then 'P' else sorder.status end = 'P')
and ( sorder.order_type not in (@ordtypes@) ) and ( sorder.order_type not in (@ordtypes@) )
and trim(nvl((select si.mfg_type from siteitem si where si.site_code = sorditem.site_code and si.item_code = item.item_code ),' ')) in ('O','D') and trim(nvl((select si.mfg_type from siteitem si where si.site_code = sorditem.site_code and si.item_code = item.item_code ),' ')) in ('O','D')
and ((CASE WHEN SORDITEM.QUANTITY IS NULL THEN 0 ELSE SORDITEM.QUANTITY END - CASE WHEN SORDITEM.QTY_ALLOC IS NULL THEN 0 ELSE SORDITEM.QTY_ALLOC END - CASE WHEN SORDITEM.QTY_DESP IS NULL THEN 0 ELSE SORDITEM.QTY_DESP END ) * CASE WHEN SORDITEM.CONV__QTY_STDQTY IS NULL THEN 1 ELSE SORDITEM.CONV__QTY_STDQTY END ) > 0 ; and ((CASE WHEN SORDITEM.QUANTITY IS NULL THEN 0 ELSE SORDITEM.QUANTITY END - CASE WHEN SORDITEM.QTY_ALLOC IS NULL THEN 0 ELSE SORDITEM.QTY_ALLOC END - CASE WHEN SORDITEM.QTY_DESP IS NULL THEN 0 ELSE SORDITEM.QTY_DESP END ) * CASE WHEN SORDITEM.CONV__QTY_STDQTY IS NULL THEN 1 ELSE SORDITEM.CONV__QTY_STDQTY END ) > 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment