From f3dec8f5b480474c9a3b2ea0fabb0f6b9fdc0423 Mon Sep 17 00:00:00 2001
From: renhao <renhui.hao@capgemini.com>
Date: 星期五, 13 十月 2023 17:11:34 +0800
Subject: [PATCH] Merge branch 'dev'

---
 _Main/BL/Type_MacroPlan/Method_MappingOperationData.qbl |   34 +++++++++++++++++++---------------
 1 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/_Main/BL/Type_MacroPlan/Method_MappingOperationData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingOperationData.qbl
index a3a19ed..3ef68b5 100644
--- a/_Main/BL/Type_MacroPlan/Method_MappingOperationData.qbl
+++ b/_Main/BL/Type_MacroPlan/Method_MappingOperationData.qbl
@@ -1,21 +1,24 @@
 Quintiq file version 2.0
 #parent: #root
 Method MappingOperationData (
-  Strings businessTypes
+  Strings businessTypes,
+  GlobalOTDTable globalOTDTable,
+  Strings organcodelist
 )
 {
   TextBody:
   [*
     // yypsybs Aug-18-2023 (created)
     // 鑾峰彇鏈夊簭鐨勫緟澶勭悊璁板綍
-    toDealList := construct( MappingOperations );
+    toDealList := construct( Global_MappingOperations ) ;
     if( not isnull( businessTypes ) and businessTypes.Size() > 0 ) {
-        toDealList := selectsortedset( this, MappingOperation, item, 
-    //                                   businessTypes.Find( item.BusinessType() ) >= 0, 
-                                       businessTypes.Difference( businessTypes.Difference( item.BusinessType().Tokenize( ", " ) ) ).Size() > 0, 
+        toDealList := selectsortedset( globalOTDTable, Global_MappingOperation, item, 
+                                       ( businessTypes.Find( item.BusinessType() ) >= 0 ) and 
+                                       ( organcodelist.Find( item.OrganCode() ) >= 0 ), 
+    //                                   businessTypes.Difference( businessTypes.Difference( item.BusinessType().Tokenize( ", " ) ) ).Size() > 0, 
                                        item.SequenceNumber() );
     } else {
-        toDealList := selectsortedset( this, MappingOperation, item, 
+        toDealList := selectsortedset( globalOTDTable, Global_MappingOperation, item, 
                                        true, 
                                        item.SequenceNumber() );
     }
@@ -26,7 +29,7 @@
         routingId := item.OrganCode() + "_" + item.ProductID();
         unitId := item.OrganCode() + "_" + item.PlantName() + "_" + item.ProcessSection();
         routingStepName := item.ProcessSection() + "_" + [String]item.SequenceNumber();
-        operationId := item.OrganCode() + "_" + item.ProductID() + "_" + item.ProcessSection();
+        operationId := item.OrganCode() + "_" + item.ProductID() + "_" + item.ProcessSection()+"_" + [String]item.SequenceNumber();
     //    info( "========" )
     //    info( "routingId:" + routingId );
     //    info( "unitId:" + unitId );
@@ -51,15 +54,16 @@
         if( isnull( routingStep ) ) {
             routingStep := RoutingStep::Create( routing, routingStepName, "", true );
         }
-        // UnitOfMeasure
-        unitOfMeasure := UnitOfMeasure_MP::FindByName( this, item.UnitOfMeasureName() );
-        if( isnull( unitOfMeasure ) ) {
-            error( "unit of measure [" + item.UnitOfMeasureName() + "] not found for routing [" + routingId + "]" );
-        }
+        
         // Unit
         unit := Unit::FindById( this, unitId );
         if( isnull( unit ) ) {
-            unit := this.Unit( relnew, 
+          // UnitOfMeasure
+        unitOfMeasure := UnitOfMeasure_MP::FindByName( this, item.UnitOfMeasureName() );
+          if( isnull( unitOfMeasure ) ) {
+              info( "unit of measure [" + item.UnitOfMeasureName() + "] not found for routing [" + routingId + "]" );
+          }
+           unit := this.Unit( relnew, 
                               ID := unitId, Name := unitId, CapacityType := "Infinite",
                               DefaultGridX := 0, DefaultGridY := 0,
                               IsManuallyConfigured := false,
@@ -70,12 +74,12 @@
         op := Operation::FindOperationTypeIndex( operationId );
         if( isnull( op)){
           op := Operation::Create( operationId, unit, operationId, routingStep, 
-                                        Duration::Hours( item.UserLeadTime() ), Duration::Zero(), item.ActualCapacity(), false, 
+                                        Duration::Days( item.UserLeadTime() ), Duration::Zero(), item.ActualCapacity(), false, 
                                         [Real]item.MinimumQuantity(), haveMaxQty, guard( [Real]item.MaximumQuantity(), Real::MaxReal() ), 
                                         0.0, 0.0, false, true );
         }
         
-        ManufactureLTProcessSection::CreateOrUpdate( op );
+    //    ManufactureLTProcessSection::CreateOrUpdate( op );
     }
     info( "========" )
     // 閬嶅巻routing锛岃繘琛宭ink

--
Gitblit v1.9.3