From e8619d825e5f09daf129b4847bf2bf4e660d40c5 Mon Sep 17 00:00:00 2001
From: yunchai <yunying.chai@capgemini.com>
Date: 星期四, 12 十月 2023 09:29:21 +0800
Subject: [PATCH] Merge remote-tracking branch 'refs/remotes/origin/dev'

---
 _Main/BL/Type_PRData/StaticMethod_FromSupplyPlanning#662.qbl |   86 +++++++++++++++++++++++++++----------------
 1 files changed, 54 insertions(+), 32 deletions(-)

diff --git "a/_Main/BL/Type_PRData/StaticMethod_FromSupplyPlanning\043662.qbl" "b/_Main/BL/Type_PRData/StaticMethod_FromSupplyPlanning\043662.qbl"
index 2b88918..1b30f35 100644
--- "a/_Main/BL/Type_PRData/StaticMethod_FromSupplyPlanning\043662.qbl"
+++ "b/_Main/BL/Type_PRData/StaticMethod_FromSupplyPlanning\043662.qbl"
@@ -3,25 +3,26 @@
 StaticMethod FromSupplyPlanning (
   GlobalOTDTable otdTable,
   MacroPlan macroPlan,
-  MacroPlan mappingRoot,
-  ProductInStockingPointInPeriod pispip
+  ProductInStockingPointInPeriod pispip,
+  String userId
 ) as PRData
 {
   TextBody:
   [*
     // yypsybs Sep-12-2023 (created)
     result := macroPlan.PRData( relnew );
-    result.InterfaceSourceCode( "Quintiq" );
     
     pisp := pispip.ProductInStockingPoint_MP();
     product := pisp.Product_MP();
     stockingPoint := pisp.StockingPoint_MP();
     period := pispip.Period_MP();
-    mappingProduct := MappingProduct::GetByProductId( mappingRoot, product.ID() );
+    // QID7
+    mappingProduct := Global_MappingProduct_MP::GetByProductId( otdTable, product.ID() );
+    // QID12
+    mappingOperation := Global_MappingOperation::GetByProductId( otdTable, product.ID() );
+    // QID15
+    mappingProviderCapacity := Global_MappingProviderCapacity::GetByProductId( otdTable, product.ID() );
     matAttrSetting := MatAttrSettingAndPlanStrategy::GetExistByMatCode( otdTable, product.ID() );
-    // 鎺ュ彛/涓棿琛ㄦ殏鏃�
-    mappingProviderCapacity := "鏆傛棤";
-    erpData := "鏆傛棤";
     
     // 鏍规嵁pispip
     result.MRPCalverNo( ifexpr( pispip.MRPCalverNo() = "", "鏆傛棤", pispip.MRPCalverNo() ) );
@@ -35,9 +36,9 @@
     result.StockingPointID( stockingPoint.ID() );
     
     // 鏍规嵁period
-    result.ProduceRequiredDate( period.StartDate() );
-    result.PRSuggestionDate( ifexpr( (result.ProduceRequiredDate() - Duration::Days( 7 )).Date() >= Date::Today(),
-                                     Date::Today(), (result.ProduceRequiredDate() - Duration::Days( 7 )).Date() ) );
+    result.DeliveryDate( period.StartDate() );
+    result.PRSuggestionDate( ifexpr( (result.DeliveryDate() - Duration::Days( 7 )).Date() >= Date::Today(),
+                                     Date::Today(), (result.DeliveryDate() - Duration::Days( 7 )).Date() ) );
     
     // 鏍规嵁 鐗╂枡灞炴�ф爣绛捐瀹�&鐗╂枡璁″垝绛栫暐
     result.IsPanelMaterial( "鏆傛棤" );
@@ -51,22 +52,39 @@
       result.MaterialMRPType( ifexpr( matAttrSetting.PlanningStrategyCustom() <> "", matAttrSetting.PlanningStrategyCustom(), matAttrSetting.PlanningStrategyAuto() ) );
     }
     
-    
     // 鏍规嵁product涓棿琛�
     if( isnull( mappingProduct ) ) {
-      result.BusinessType( "鏆傛棤" );
-      result.OrganCode( "鏆傛棤" );
-      result.UnitOfMeasure( "鏆傛棤" );
+      result.BusinessType( "鏆傛棤" );  
     } else {
-      result.BusinessType( mappingProduct.BusinessType() );
-      result.OrganCode( mappingProduct.OrgCode() );
-      result.UnitOfMeasure( mappingProduct.UnitOfMeasureName() );
+      result.BusinessType( mappingProduct.BusinessType() );   
+    }
+    result.InterfaceSourceCode( "Quintiq_" + result.BusinessType() );
+    
+    // 鏍规嵁operation涓棿琛�
+    if( isnull( mappingOperation ) ) {
+      result.OrgId( "鏆傛棤" );
+      result.OrganCode( "鏆傛棤" );
+      result.OrganName( "鏆傛棤" );
+      result.DestinationOrganizationID( "鏆傛棤" );
+    } else {
+      result.OrgId( mappingOperation.OrganId() );
+      result.OrganCode( mappingOperation.OrganCode() );
+      result.OrganName( mappingOperation.OrganName() );
+      result.DestinationOrganizationID( mappingOperation.DestinationOrganizationId() );
     }
     
     // 鏍规嵁渚涘簲鍟嗚兘鍔涗腑闂磋〃
-    result.ProviderCode( mappingProviderCapacity );
-    result.ProductName( mappingProviderCapacity );
-    result.LeadTime( 0.0 );
+    if( isnull( mappingProviderCapacity ) ) {
+      result.ProviderCode( "鏆傛棤" );
+      result.ProviderName( "鏆傛棤" );
+      result.LeadTime( 0.0 );
+      result.UnitOfMeasure( "鏆傛棤" );
+    } else {
+      result.ProviderCode( "鏆傛棤" );
+      result.ProviderName( mappingProviderCapacity.ProviderName() );
+      result.LeadTime( mappingProviderCapacity.LeadTime() );
+      result.UnitOfMeasure( mappingProviderCapacity.UnitOfMeasureName() );
+    }
     
     // 鏍规嵁erp鎺ュ彛 鍥哄畾鍊�
     result.RequisitionType( "PURCHASE" );
@@ -76,21 +94,25 @@
     result.LineTypeId( "1" );
     result.LineType( "璐х墿" );
     // 鏍规嵁erp鎺ュ彛 todo
-    result.PreparerId( erpData );
-    result.HeaderDescription( erpData );
-    result.DestinationOrganizationID( erpData );
-    result.DeliverToRequestorId( erpData );
-    result.LineAttribute1( erpData );
-    result.LineAttribute6( erpData );
-    result.OrgId( erpData );
+    result.LineAttribute1( "" );
+    result.LineAttribute3( "" );
+    result.LineAttribute6( "" );
     
-    // 鐢熸垚id todo
-    result.DataID( [String]Number::Random( Number::MinNumber(), Number::MaxNumber() ) );
+    // 鐢ㄦ埛id/name
+    result.PreparerId( userId );
+    result.HeaderDescription( userId );
+    result.DeliverToRequestorId( result.PreparerId() );
+    
+    // 鐢熸垚id
+    cnv := DateTimeToString::StandardConverter();
+    cnv.SetCustomConversion();
+    cnv.CustomFormatString( "yyyyMMdd_H:mm:ss" );
+    result.DataID( cnv.Convert( DateTime::ActualTime() ) + "_" + [String]Number::Random( Number::MinNumber(), Number::MaxNumber() ) );
     
     // 鍙戦�佷俊鎭�
-    result.SendStatus( "" );
-    result.SendBy( "" );
-    result.SendTime( DateTime::MinDateTime() );
+    result.PRReleaseStatus( "" );
+    result.CreateBy( "" );
+    result.CreateTime( DateTime::MinDateTime() );
     
     return result;
   *]

--
Gitblit v1.9.3