From 77b8d972800221d19bd0ea7f2a14b720920b16bb Mon Sep 17 00:00:00 2001
From: hongjli <3117313295@qq.com>
Date: 星期三, 11 十月 2023 14:56:11 +0800
Subject: [PATCH] 产能分配优化

---
 _Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_OnCreated.def                                |    4 -
 _Main/BL/Type_CapacityAllocationResultsRuleConfiguration/StaticMethod_RecursiveGeneration.qbl                |   29 +++++++--
 _Main/BL/Type_CapacityAllocationResultsRuleConfiguration/StaticMethod_AutomaticallyGenerateCapacityRules.qbl |    6 +
 _Main/UI/MacroPlanner/Component_FormTestButtonCollection/Response_Button884_OnClick.def                      |   12 ++++
 _Main/BL/Type_CapacityAllocationResultsRuleConfiguration/StaticMethod_Test.qbl                               |   61 ++++++++++++++++++++
 _Main/UI/MacroPlanner/Component_FormTestButtonCollection/_ROOT_Component_FormTestButtonCollection.def        |   23 +++++++
 6 files changed, 121 insertions(+), 14 deletions(-)

diff --git a/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/StaticMethod_AutomaticallyGenerateCapacityRules.qbl b/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/StaticMethod_AutomaticallyGenerateCapacityRules.qbl
index d989131..fbdbb4d 100644
--- a/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/StaticMethod_AutomaticallyGenerateCapacityRules.qbl
+++ b/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/StaticMethod_AutomaticallyGenerateCapacityRules.qbl
@@ -7,7 +7,7 @@
 {
   TextBody:
   [*
-    targetProduct_MP := select( macroPlan, Product_MP, tempPMP, tempPMP.ID() = "Chassis - SUV 1" );
+    targetProduct_MP := select( macroPlan, Product_MP, tempPMP, tempPMP.ID() = "ProSports Spider D2.6 M" );
     
     period_MPS := null( Period_MPs );
     traverse ( macroPlan, PeriodSpecification_MP, psmp, psmp.ID() = "Planning periods" ) {
@@ -15,8 +15,10 @@
     }
     
     traverse ( targetProduct_MP, ProductInStockingPoint_MP, pisp ) {
-      traverse ( period_MPS, Elements, pmp ) { 
+      traverse ( period_MPS, Elements, pmp, pmp.StartDate() = Date::Construct( 2020, 4, 1 ) ) { 
+        info( pmp.StartDate().Format( "Y-M2-D2" ), "    outputPISP锛�", pisp.Name() );
         CapacityAllocationResultsRuleConfiguration::RecursiveGeneration( macroPlan, pisp, pisp, pmp.StartDate() );
+        info( "-------------------------------------------------------------------------------------------------------" );
       }
     }
   *]
diff --git a/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/StaticMethod_RecursiveGeneration.qbl b/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/StaticMethod_RecursiveGeneration.qbl
index 5cbc2aa..e6f6dda 100644
--- a/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/StaticMethod_RecursiveGeneration.qbl
+++ b/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/StaticMethod_RecursiveGeneration.qbl
@@ -9,15 +9,28 @@
 {
   TextBody:
   [*
-    operations := selectset( macroPlan, Routing.RoutingStep.Operation, tempO, 
-                             exists( tempO, OperationOutput, tempOO, tempOO.ProductInStockingPoint_MP() = outputPISP ) );
-    
-    traverse ( operations, Elements, o ) {
-      traverse ( o, OperationInput, tempOI ) {
-        inputPISP := tempOI.ProductInStockingPoint_MP();
-        CapacityAllocationResultsRuleConfiguration::RecursiveGeneration( macroPlan, tempOI.ProductInStockingPoint_MP(), firstPISP, startDate );
-        info( "杈撳叆PISP锛�", inputPISP.Name(), "    杈撳嚭PISP锛�", outputPISP.Name(), "    绗竴娆ISP锛�", firstPISP.Name() );
+    traverse ( outputPISP, ProcessOutput.AsProcessOutput, pmp ) {
+      
+      ontype( pmp ) {
+        Operation as o : {  
+          traverse ( o, OperationInput, oi ) {
+            oiPISP := oi.ProductInStockingPoint_MP();
+            CapacityAllocationResultsRuleConfiguration::RecursiveGeneration( macroPlan, oiPISP, firstPISP, startDate );
+            info( "杈撳叆PISP锛�", oiPISP.Name(), "    杈撳嚭PISP锛�", outputPISP.Name(), "    绗竴娆ISP锛�", firstPISP.Name() );
+          }
+        }
+        
+        LaneLeg as ll : {
+          traverse ( ll, LaneLegInput, lli ) {
+            lliPISP := lli.ProductInStockingPoint_MP();
+            if ( lliPISP.ProductID() = outputPISP.ProductID() ) {
+              CapacityAllocationResultsRuleConfiguration::RecursiveGeneration( macroPlan, lliPISP, firstPISP, startDate );
+              info( "杈撳叆PISP锛�", lliPISP.Name(), "    杈撳嚭PISP锛�", outputPISP.Name(), "    绗竴娆ISP锛�", firstPISP.Name() );
+            }
+          }
+        }
       }
+      
     }
   *]
 }
diff --git a/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/StaticMethod_Test.qbl b/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/StaticMethod_Test.qbl
new file mode 100644
index 0000000..dd2083a
--- /dev/null
+++ b/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/StaticMethod_Test.qbl
@@ -0,0 +1,61 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod Test (
+  MacroPlan this
+)
+{
+  TextBody:
+  [*
+    pispnames := construct( Strings );
+    
+    traverse( this, SalesDemand.ProductInStockingPoint_MP, pisp )
+    {
+      if( not exists( pisp, ProcessOutput.AsProcessOutput.ProcessInput, processinput, true ) )
+      {
+        pispnames.Add( pisp.Name() );
+      }
+      else
+      {
+        dummyprocesses := selectset( pisp, ProcessOutput.AsProcessOutput, process, true );
+        index := 0;
+        limit := 10000;
+        
+        while( index < dummyprocesses.Size()
+               and index < limit )
+        {
+          dummyprocess := dummyprocesses.Element( index );
+          index++;
+          
+          pisps := construct( ProductInStockingPoint_MPs );
+          
+          if( dummyprocess.istype( Operation ) )
+          {
+            pisps := selectset( dummyprocess, astype( Operation ).RoutingStep.Routing.InputPISPNodeInRouting.ProductInStockingPoint_MP, pisp2,
+                                not pisp2.IsSystem() );
+          }
+          else if( dummyprocess.istype( LaneLeg ) )
+          {
+            pisps := selectset( dummyprocess, astype( LaneLeg ).LaneLegInput.ProductInStockingPoint_MP, pisp2,
+                                pisp2.Product_MP() = pisp.Product_MP() );
+          }
+          
+          traverse( pisps, Elements, pisp2 )
+          {
+            if( not exists( pisp2, ProcessOutput.AsProcessOutput.ProcessInput, processinput, true ) )
+            {
+              pispnames.Add( pisp2.Name() );
+            }
+            else
+            {
+              dummyprocesses2 := selectset( pisp2, ProcessOutput.AsProcessOutput, process, true );
+              dummyprocesses.AddInPlace( dummyprocesses2 );
+            }
+          }
+        }
+      }
+    }
+    
+    pispnames := pispnames.Unique().Sort();
+    info( pispnames.ToString( String::NewLine() ) );
+  *]
+}
diff --git a/_Main/UI/MacroPlanner/Component_FormTestButtonCollection/Response_Button884_OnClick.def b/_Main/UI/MacroPlanner/Component_FormTestButtonCollection/Response_Button884_OnClick.def
new file mode 100644
index 0000000..c25a822
--- /dev/null
+++ b/_Main/UI/MacroPlanner/Component_FormTestButtonCollection/Response_Button884_OnClick.def
@@ -0,0 +1,12 @@
+Quintiq file version 2.0
+#parent: Button884
+Response OnClick () id:Response_FormTestButtonCollection_Button884_OnClick
+{
+  #keys: '[414702.1.33954101]'
+  Body:
+  [*
+    CapacityAllocationResultsRuleConfiguration::Test( MacroPlan );
+  *]
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_GUIButtonBase_OnClick'
+}
diff --git a/_Main/UI/MacroPlanner/Component_FormTestButtonCollection/_ROOT_Component_FormTestButtonCollection.def b/_Main/UI/MacroPlanner/Component_FormTestButtonCollection/_ROOT_Component_FormTestButtonCollection.def
index 53a8703..e4d9281 100644
--- a/_Main/UI/MacroPlanner/Component_FormTestButtonCollection/_ROOT_Component_FormTestButtonCollection.def
+++ b/_Main/UI/MacroPlanner/Component_FormTestButtonCollection/_ROOT_Component_FormTestButtonCollection.def
@@ -11,6 +11,7 @@
     Columns:
     [
       GBFlow.Column { grow: 0 id: 454 parent: 0 }
+      GBFlow.Column { grow: 0 id: 968 parent: 0 }
     ]
     Elements:
     [
@@ -18,6 +19,11 @@
       {
         Component => Button398
         Position { startcolumn: 454 startrow: 649 endcolumn: 454 endrow: 649 }
+      }
+      GBElement
+      {
+        Component => Button884
+        Position { startcolumn: 968 startrow: 649 endcolumn: 968 endrow: 649 }
       }
     ]
     Gaps: [ left: 5 right: 5 top: 5 bottom: 5 inner: 5 ]
@@ -35,7 +41,19 @@
       Properties:
       [
         Image: 'HARDHAT'
+        LayoutGroup: 'Button'
         Text: '鐢熸垚浜ц兘鍒嗛厤缁撴灉鏁版嵁'
+      ]
+    }
+    Component Button884
+    {
+      #keys: '[414702.1.33954049]'
+      BaseType: 'Button'
+      Properties:
+      [
+        Image: 'CAKE_SLICE'
+        LayoutGroup: 'Button'
+        Text: '鏍规嵁鎴愬搧鐢熸垚鐗╂枡'
       ]
     }
   ]
@@ -46,5 +64,10 @@
     IncludeInView: true
     Title: '鍔熻兘娴嬭瘯鎸夐挳'
     Width: 535
+    ModeledStringList ChildOrdering
+    {
+      c: Button398
+      c: Button884
+    }
   ]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_OnCreated.def
index 71d1402..700b61d 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_OnCreated.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_OnCreated.def
@@ -5,10 +5,6 @@
   #keys: '[414724.0.91471552]'
   CanBindMultiple: false
   DefinitionID: 'Responsedef_WebComponent_OnCreated'
-  Precondition:
-  [*
-    
-  *]
   QuillAction
   {
     Body:

--
Gitblit v1.9.3