From 472c228ef6d7c8d877558ff90051b1fdb35ffb5c Mon Sep 17 00:00:00 2001
From: renhao <renhui.hao@capgemini.com>
Date: 星期二, 10 十月 2023 14:05:34 +0800
Subject: [PATCH] Merge branch 'dev'

---
 _Main/BL/Type_MacroPlan/Method_MappingCustomerOrderData.qbl |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/_Main/BL/Type_MacroPlan/Method_MappingCustomerOrderData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingCustomerOrderData.qbl
index bee6304..da901cc 100644
--- a/_Main/BL/Type_MacroPlan/Method_MappingCustomerOrderData.qbl
+++ b/_Main/BL/Type_MacroPlan/Method_MappingCustomerOrderData.qbl
@@ -2,7 +2,8 @@
 #parent: #root
 Method MappingCustomerOrderData (
   Strings businessTypes,
-  GlobalOTDTable globalOTDTable
+  GlobalOTDTable globalOTDTable,
+  Strings organcodelist
 )
 {
   Description: 'ETL璁㈠崟棰勬祴'
@@ -14,7 +15,11 @@
     if( isnull( businessTypes ) or businessTypes.Size() = 0 ) {
         listToDeal := selectset( globalOTDTable, Global_MappingCustomOrder, item, true );
     } else {
-        listToDeal := selectset( globalOTDTable, Global_MappingCustomOrder, item, businessTypes.Find( item.BusinessType() ) <> -1 );
+        listToDeal := selectset( globalOTDTable, 
+                                 Global_MappingCustomOrder, 
+                                 item, 
+                                 ( businessTypes.Find( item.BusinessType() ) <> -1 ) and 
+                                 ( organcodelist.Find( item.StockingPointID().SubString( 0, 3 ) ) >= 0 ) );
     }
     queryStartDate := guard( min( this, Period_MP, item, true, item.StartDate() ) - Duration::Days( 30 ), DateTime::MinDateTime() ).Date();
     queryEndDate := guard( max( this, Period_MP, item, true, item.EndDate() ), Date::MaxDate() );
@@ -33,12 +38,18 @@
         }
     //  if( not isnull( Product_MP::FindById( this, item.ProductID() ) ) ){
     //    info( item.ProductID().AsQUILL() );
-      CustomerOrder::CreateOrUpdate( this, item.CurrencyID(), item.Customer(), item.CustomerID(), item.ID(), 
-                                     item.OrderDate(), item.OrderID(), item.OrderLineID(), item.Price(), 
-                                     priorityName, item.ProductID(), 
-                                     item.StockingPointID(), 
-                                     item.SalesSegmentName(), 
-                                     item.Quantity(), item.UnitOfMeasureName(), item.OrderType(), item.IsAvailable());
+      customOrder := CustomerOrder::CreateOrUpdate( this, item.CurrencyID(), item.Customer(), item.CustomerID(), item.ID(), 
+                                                    item.OrderDate(), item.OrderID(), item.OrderLineID(), item.Price(), 
+                                                    priorityName, item.ProductID(), 
+                                                    item.StockingPointID(), 
+                                                    item.SalesSegmentName(), 
+                                                    item.Quantity(), item.UnitOfMeasureName(), item.OrderType(), item.IsAvailable());
+      customOrder.BusinessType( item.BusinessType() );
+      customOrder.OrderType( item.OrderType() );
+      customOrder.OrderTime( item.OrderTime() );
+      customOrder.ProductGrade( item.ProductGrade() );
+      customOrder.SegmentPriority( item.SegmentPriority() );
+      customOrder.SheetProfitability( item.SheetProfitability() );
     //  }else{
     //    info( "invaild product: " + item.ProductID().AsQUILL() );
     //    }

--
Gitblit v1.9.3