From 5734a79352c273282e48cbc9db5c0ed7cdfc8c9c Mon Sep 17 00:00:00 2001
From: admin <admin@admin.com>
Date: 星期二, 08 十月 2024 11:21:42 +0800
Subject: [PATCH] 上线计划优化

---
 _Main/BL/Type_AssemblyOnlinePlanRow/Method_Filter.qbl                                                         |   17 ++++++++
 _Main/UI/MacroPlannerWebApp/Component_FormAssemblyOnlinePlan/Component_MatrixEditor951#480.def                |    2 +
 _Main/BL/Type_AssemblyOnlinePlanCell/StaticMethod_RefreshData.qbl                                             |   41 ++++++++++++++++++++
 _Main/UI/MacroPlannerWebApp/Component_FormAssemblyOnlinePlan/Response_pHeader_bGenerateReport_OnClick#774.def |    4 +-
 _Main/UI/MacroPlannerWebApp/Component_FormAssemblyOnlinePlan/_ROOT_Component_FormAssemblyOnlinePlan.def       |    1 
 _Main/UI/MacroPlannerWebApp/Component_FormAssemblyOnlinePlan/Component_pHeader.def                            |    4 +-
 _Main/UI/MacroPlannerWebApp/Component_FormOfflinePlan/Component_pHeader1#799.def                              |    4 +-
 _Main/UI/MacroPlannerWebApp/Component_FormOfflinePlan/Response_pHeader1_799_bRefresh_OnClick.def              |    4 +-
 _Main/UI/MacroPlannerWebApp/Component_FormOfflinePlan/_ROOT_Component_FormOfflinePlan.def                     |    1 
 9 files changed, 69 insertions(+), 9 deletions(-)

diff --git a/_Main/BL/Type_AssemblyOnlinePlanCell/StaticMethod_RefreshData.qbl b/_Main/BL/Type_AssemblyOnlinePlanCell/StaticMethod_RefreshData.qbl
index df7f2c7..ce8bc30 100644
--- a/_Main/BL/Type_AssemblyOnlinePlanCell/StaticMethod_RefreshData.qbl
+++ b/_Main/BL/Type_AssemblyOnlinePlanCell/StaticMethod_RefreshData.qbl
@@ -12,7 +12,9 @@
     
     // 鎵捐閰嶇嚎琛�
     oprs := selectsortedset( opt, OfflinePlanRow, tempOPR, 
-                             tempOPR.ProductionLine() = "DL MoMo" or tempOPR.ProductionLine() = "CC MoMo" or tempOPR.ProductionLine() = "DL ZKM", 
+                             tempOPR.ProductionLine() = "DL MoMo" 
+    //                         or tempOPR.ProductionLine() = "CC MoMo" or tempOPR.ProductionLine() = "DL ZKM"
+                             , 
                              tempOPR.ProductionLine(), tempOPR.ProductID(), tempOPR.Type() );
     opcs := selectsortedset( opt, OfflinePlanColumn, tempOPC, true, tempOPC.ColumnDate() );
     
@@ -34,5 +36,42 @@
     }
     
     // 澶勭悊鏃ュ巻浜嬩欢
+    pls := selectuniquevalues( macroPlan, AssemblyOnlinePlanRow, tempAOPR, true, tempAOPR.ProductionLine() );
+    traverse ( pls, Elements, pl ) {
+      targetQuantity := ifexpr( pl = "CC MoMo", guard( macroPlan.AssemblyOnlineQuantity().CCMoMo(), 0 ),
+                                ifexpr( pl = "DL MoMo", guard( macroPlan.AssemblyOnlineQuantity().DLMoMo(), 0 ), guard( macroPlan.AssemblyOnlineQuantity().DLZKM(), 0 ) )
+                               );
+      
+      u           := select( macroPlan, Unit, tempU, tempU.ID() = pl );
+      drainPs     := selectset( u, UnitCalendar.Participation, tempP, guard( tempP.Event().Subject() = "鎺掔┖", false ) );
+      lineLyingPs := selectset( u, UnitCalendar.Participation, tempP, guard( tempP.Event().Subject() = "閾虹嚎", false ) );
+      
+      // 澶勭悊鎺掔┖
+      info( "褰撳墠浜х嚎锛�", pl, "    澶勭悊鎺掔┖--------------------------" );
+      traverse ( drainPs, Elements, p ) {
+        traverse ( p, ExplicitTimeInterval, eti ) {
+          info( "寮�濮嬫椂闂达細", eti.Start().Format( "Y-M2-D2" ), "    缁撴潫鏃堕棿锛�", eti.End().Format( "Y-M2-D2" ) );
+          // 鍓嶄竴澶╂棩鍘�
+          aopc := select( macroPlan, AssemblyOnlinePlanColumn, tempAOPC, tempAOPC.ColumnDate() = ( eti.Start().Date() - 1 ) );
+          info( "闇�瑕佹帓绌虹殑涓婄嚎璁″垝鏃堕棿锛�", aopc.ColumnDate().Format( "Y-M2-D2" ) );
+          aoprs := selectset( macroPlan, AssemblyOnlinePlanRow, tempAOPR, tempAOPR.ProductionLine() = pl and tempAOPR.Type() = "2" and
+                              exists( tempAOPR, AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanColumn() = aopc and tempAOPC.Value() <> "" ) );
+          aopr  := maxselect( aoprs, Elements.AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanColumn() = aopc,
+                              [Number]tempAOPC.Value().ReplaceAll( "#0", "" ) );
+          cell  := select( macroPlan, AssemblyOnlinePlanRow.AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanRow().ProductionLine() = pl and tempAOPC.AssemblyOnlinePlanColumn() = aopc and
+                           tempAOPC.AssemblyOnlinePlanRow().Type() = "1" and tempAOPC.AssemblyOnlinePlanRow().ProductID() = aopr.AssemblyOnlinePlanRow().ProductID() ); 
+          
+          cell.Value( [String] ( [Number]cell.Value() - targetQuantity ) );
+        }
+      }
+      
+      info( "褰撳墠浜х嚎锛�", pl, "    澶勭悊閾虹嚎--------------------------" );
+      // 澶勭悊閾虹嚎
+      traverse ( lineLyingPs, Elements, p ) {
+        traverse ( p, ExplicitTimeInterval, eti ) {
+          info( "寮�濮嬫椂闂达細", eti.Start().Format( "Y-M2-D2" ), "    缁撴潫鏃堕棿锛�", eti.End().Format( "Y-M2-D2" ) );
+        }
+      }
+    }
   *]
 }
diff --git a/_Main/BL/Type_AssemblyOnlinePlanRow/Method_Filter.qbl b/_Main/BL/Type_AssemblyOnlinePlanRow/Method_Filter.qbl
new file mode 100644
index 0000000..d5e399d
--- /dev/null
+++ b/_Main/BL/Type_AssemblyOnlinePlanRow/Method_Filter.qbl
@@ -0,0 +1,17 @@
+Quintiq file version 2.0
+#parent: #root
+Method Filter (
+  Entitys entitys
+) declarative remote as Boolean
+{
+  TextBody:
+  [*
+    flag := false;
+    
+    traverse ( entitys, Elements.astype( Unit ), u, not flag ) {
+      flag := u.Name() = this.ProductionLine();
+    }
+    
+    return flag;
+  *]
+}
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormAssemblyOnlinePlan/Component_MatrixEditor951\043480.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormAssemblyOnlinePlan/Component_MatrixEditor951\043480.def"
index 60dcc04..ad666b1 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_FormAssemblyOnlinePlan/Component_MatrixEditor951\043480.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormAssemblyOnlinePlan/Component_MatrixEditor951\043480.def"
@@ -45,6 +45,8 @@
           Properties:
           [
             DataType: 'MacroPlan'
+            FilterArguments: 'entities:QLibMacroPlannerWebUI::ApplicationMacroPlanner.DataHolderCheckedEntities'
+            FixedFilter: 'object.Filter( entities )'
             Source: 'MacroPlan'
             Taborder: 0
             Transformation: 'AssemblyOnlinePlanRow'
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormAssemblyOnlinePlan/Component_pHeader.def b/_Main/UI/MacroPlannerWebApp/Component_FormAssemblyOnlinePlan/Component_pHeader.def
index 3e8f767..f9a4b71 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormAssemblyOnlinePlan/Component_pHeader.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormAssemblyOnlinePlan/Component_pHeader.def
@@ -25,13 +25,13 @@
         Taborder: 2
       ]
     }
-    Component bRefresh id:bRefresh_187
+    Component bGenerateReport
     {
       #keys: '[413988.0.1351403370]'
       BaseType: 'WebButton'
       Properties:
       [
-        Label: 'Refresh'
+        Label: 'Generate'
         Taborder: 0
       ]
     }
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormAssemblyOnlinePlan/Response_pHeader_bRefresh_OnClick\043774.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormAssemblyOnlinePlan/Response_pHeader_bGenerateReport_OnClick\043774.def"
similarity index 83%
rename from "_Main/UI/MacroPlannerWebApp/Component_FormAssemblyOnlinePlan/Response_pHeader_bRefresh_OnClick\043774.def"
rename to "_Main/UI/MacroPlannerWebApp/Component_FormAssemblyOnlinePlan/Response_pHeader_bGenerateReport_OnClick\043774.def"
index 7dc7da8..cf20058 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_FormAssemblyOnlinePlan/Response_pHeader_bRefresh_OnClick\043774.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormAssemblyOnlinePlan/Response_pHeader_bGenerateReport_OnClick\043774.def"
@@ -1,6 +1,6 @@
 Quintiq file version 2.0
-#parent: pHeader/bRefresh_187
-Response OnClick () id:Response_pHeader_bRefresh_OnClick_774
+#parent: pHeader/bGenerateReport
+Response OnClick () id:Response_pHeader_bGenerateReport_OnClick_774
 {
   #keys: '[413988.0.1351403369]'
   CanBindMultiple: false
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormAssemblyOnlinePlan/_ROOT_Component_FormAssemblyOnlinePlan.def b/_Main/UI/MacroPlannerWebApp/Component_FormAssemblyOnlinePlan/_ROOT_Component_FormAssemblyOnlinePlan.def
index 0ab03c8..eaf2cb1 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormAssemblyOnlinePlan/_ROOT_Component_FormAssemblyOnlinePlan.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormAssemblyOnlinePlan/_ROOT_Component_FormAssemblyOnlinePlan.def
@@ -12,6 +12,7 @@
   ]
   Properties:
   [
+    Description: '瑁呴厤涓婄嚎璁″垝'
     Title: 'Assembly online plan'
   ]
 }
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlan/Component_pHeader1\043799.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlan/Component_pHeader1\043799.def"
index acea00e..912b71b 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlan/Component_pHeader1\043799.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlan/Component_pHeader1\043799.def"
@@ -5,13 +5,13 @@
   BaseType: 'WebPanel'
   Children:
   [
-    Component bGenerateReport
+    Component bRefresh
     {
       #keys: '[413988.0.1568330589]'
       BaseType: 'WebButton'
       Properties:
       [
-        Label: 'Generate report'
+        Label: 'Refresh'
         Taborder: 0
       ]
     }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlan/Response_pHeader1_799_bGenerateReport_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlan/Response_pHeader1_799_bRefresh_OnClick.def
similarity index 84%
rename from _Main/UI/MacroPlannerWebApp/Component_FormOfflinePlan/Response_pHeader1_799_bGenerateReport_OnClick.def
rename to _Main/UI/MacroPlannerWebApp/Component_FormOfflinePlan/Response_pHeader1_799_bRefresh_OnClick.def
index 96194e0..99fe18d 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlan/Response_pHeader1_799_bGenerateReport_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlan/Response_pHeader1_799_bRefresh_OnClick.def
@@ -1,6 +1,6 @@
 Quintiq file version 2.0
-#parent: pHeader1_799/bGenerateReport
-Response OnClick () id:Response_pHeader1_799_bGenerateReport_OnClick
+#parent: pHeader1_799/bRefresh
+Response OnClick () id:Response_pHeader1_799_bRefresh_OnClick
 {
   #keys: '[413988.0.1568330587]'
   CanBindMultiple: false
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlan/_ROOT_Component_FormOfflinePlan.def b/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlan/_ROOT_Component_FormOfflinePlan.def
index 8d1b9fc..ce61f05 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlan/_ROOT_Component_FormOfflinePlan.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlan/_ROOT_Component_FormOfflinePlan.def
@@ -12,6 +12,7 @@
   ]
   Properties:
   [
+    Description: '瑁呴厤涓嬬嚎璁″垝'
     Image: 'WIND_ENGINE_OFFSHORE'
     Title: 'OfflinePlan'
   ]

--
Gitblit v1.9.3