From 296fd628f1ecca7397efed30f9c4252a6cfd2a18 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期四, 29 八月 2024 16:19:44 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev-zlg

---
 _Main/BL/Type_InterfaceProductionSchedulingPlanPush/Attribute_VersionFlag.qbl                                                                  |   12 ++++++
 _Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling4.qbl                                                                                   |   11 +++--
 _Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_MacroPlanner_ContextMenuInterface_mInterfaceProductionSchedulingPla.def |    2 
 _Main/BL/Type_InterfaceProductionSchedulingPlanPush/Attribute_InterfaceTime.qbl                                                                |    8 ++++
 _Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling3.qbl                                                                                   |    5 ++
 _Main/BL/Type_InterfaceProductionSchedulingPlanPush/StaticMethod_GenerateData.qbl                                                              |   12 ++++-
 _Main/BL/Type_OfflinePlanCell/StaticMethod_RefreshOfflinePlan.qbl                                                                              |    4 +-
 _Main/BL/Type_WholeShift/Method_ProcessingTimeIntervalIsEqualToOneDay.qbl                                                                      |    8 ++--
 _Main/BL/Type_OfflinePlanRow/Attribute_Notes.qbl                                                                                               |    7 +++
 _Main/BL/Type_WholeShift/Method_CapacityRounding.qbl                                                                                           |   34 ++++++++++++++++-
 10 files changed, 85 insertions(+), 18 deletions(-)

diff --git a/_Main/BL/Type_InterfaceProductionSchedulingPlanPush/Attribute_InterfaceTime.qbl b/_Main/BL/Type_InterfaceProductionSchedulingPlanPush/Attribute_InterfaceTime.qbl
new file mode 100644
index 0000000..3ef0aff
--- /dev/null
+++ b/_Main/BL/Type_InterfaceProductionSchedulingPlanPush/Attribute_InterfaceTime.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute InterfaceTime
+{
+  #keys: '3[415754.0.175798548][415754.0.175798547][415754.0.175798549]'
+  Description: '鎺ュ彛鎺ㄩ�佹椂闂�'
+  ValueType: DateTime
+}
diff --git a/_Main/BL/Type_InterfaceProductionSchedulingPlanPush/Attribute_VersionFlag.qbl b/_Main/BL/Type_InterfaceProductionSchedulingPlanPush/Attribute_VersionFlag.qbl
new file mode 100644
index 0000000..69ea598
--- /dev/null
+++ b/_Main/BL/Type_InterfaceProductionSchedulingPlanPush/Attribute_VersionFlag.qbl
@@ -0,0 +1,12 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute VersionFlag
+{
+  #keys: '3[415754.0.176284753][415754.0.176284752][415754.0.176284754]'
+  Description:
+  [*
+    1锛氬彂甯冪増鏈�
+    0锛氭眹鎶ョ増鏈�
+  *]
+  ValueType: Number
+}
diff --git a/_Main/BL/Type_InterfaceProductionSchedulingPlanPush/StaticMethod_GenerateData.qbl b/_Main/BL/Type_InterfaceProductionSchedulingPlanPush/StaticMethod_GenerateData.qbl
index 28ee031..76c27c4 100644
--- a/_Main/BL/Type_InterfaceProductionSchedulingPlanPush/StaticMethod_GenerateData.qbl
+++ b/_Main/BL/Type_InterfaceProductionSchedulingPlanPush/StaticMethod_GenerateData.qbl
@@ -2,12 +2,16 @@
 #parent: #root
 StaticMethod GenerateData (
   MacroPlan macroPlan,
-  InterfaceDataset interfaceDataset
+  InterfaceDataset interfaceDataset,
+  Number versionFlag
 )
 {
   TextBody:
   [*
-    interfaceDataset.InterfaceProductionSchedulingPlanPush( relflush );
+    ipspps := selectset( interfaceDataset, InterfaceProductionSchedulingPlanPush, tempIPSPP, tempIPSPP.VersionFlag() = versionFlag );
+    MacroPlan::DeleteObjects( ipspps );
+    
+    actualDateTime := DateTime::ActualTime();
     
     traverse ( macroPlan, Product_MP.ProductInStockingPoint_MP, pispmp, not pispmp.IsSystem() and pispmp.IsLeaf() and ( pispmp.StockingPointID() = "DL-MoMo" or pispmp.StockingPointID() = "CC-MoMo" ) ) {
       info( pispmp.Name() );
@@ -18,7 +22,9 @@
                                                                 PlanningQty  := [Number]pispippl.NewSupplyQuantity(),
                                                                 VersionName  := macroPlan.ScenarioName(),
                                                                 FactoryName  := ifexpr( pispmp.StockingPointID().Regex( "澶ц繛" ) or pispmp.StockingPointID().Regex( "DL" ), "澶ц繛宸ュ巶", "闀挎槬宸ュ巶" ),
-                                                                Fac          := ifexpr( pispmp.StockingPointID().Regex( "澶ц繛" ) or pispmp.StockingPointID().Regex( "DL" ), "DL", "CC" )
+                                                                Fac          := ifexpr( pispmp.StockingPointID().Regex( "澶ц繛" ) or pispmp.StockingPointID().Regex( "DL" ), "DL", "CC" ),
+                                                                InterfaceTime     := actualDateTime,
+                                                                VersionFlag       := versionFlag
                                                                );
       } 
     }
diff --git a/_Main/BL/Type_OfflinePlanCell/StaticMethod_RefreshOfflinePlan.qbl b/_Main/BL/Type_OfflinePlanCell/StaticMethod_RefreshOfflinePlan.qbl
index fd28df5..0e5721d 100644
--- a/_Main/BL/Type_OfflinePlanCell/StaticMethod_RefreshOfflinePlan.qbl
+++ b/_Main/BL/Type_OfflinePlanCell/StaticMethod_RefreshOfflinePlan.qbl
@@ -21,7 +21,7 @@
           oprQuantity := select( opt, OfflinePlanRow, tempOPR, tempOPR.ProductionLine() = u.ID() and tempOPR.ProductID() = ns.AsProductionSupply().ProductInStockingPoint_MP().ProductID() and tempOPR.Type() = "1" );
           oprOrder    := select( opt, OfflinePlanRow, tempOPR, tempOPR.ProductionLine() = u.ID() and tempOPR.ProductID() = ns.AsProductionSupply().ProductInStockingPoint_MP().ProductID() and tempOPR.Type() = "2" );
           if ( isnull( oprQuantity ) and isnull( oprOrder ) ) {
-            oprQuantity := opt.OfflinePlanRow( relnew, ProductionLine := u.ID(), ProductID := ns.AsProductionSupply().ProductInStockingPoint_MP().ProductID(), Type := "1" );
+            oprQuantity := opt.OfflinePlanRow( relnew, ProductionLine := u.ID(), ProductID := ns.AsProductionSupply().ProductInStockingPoint_MP().ProductID(), Type := "1", Notes := ns.AsProductionSupply().ProductInStockingPoint_MP().Product_MP().Notes() );
             oprOrder    := opt.OfflinePlanRow( relnew, ProductionLine := u.ID(), ProductID := ns.AsProductionSupply().ProductInStockingPoint_MP().ProductID(), Type := "2" );
           }
           
@@ -59,7 +59,7 @@
         productLineCell := productOPC.OfflinePlanCell( relnew, Value := opr.ProductionLine() );
         productLineCell.OfflinePlanRow( relset, opr );
       } else if( opr.Type() = "1" ) {
-        productCell := productOPC.OfflinePlanCell( relnew, Value := opr.ProductID() );
+        productCell := productOPC.OfflinePlanCell( relnew, Value := opr.ProductID() + ifexpr( opr.Notes() = "", "", "-" + opr.Notes() ) );
         productCell.OfflinePlanRow( relset, opr );
         typeCell    := typeOPC.OfflinePlanCell( relnew, Value :=  "Quantity" );
         typeCell.OfflinePlanRow( relset, opr );
diff --git a/_Main/BL/Type_OfflinePlanRow/Attribute_Notes.qbl b/_Main/BL/Type_OfflinePlanRow/Attribute_Notes.qbl
new file mode 100644
index 0000000..b3d7f68
--- /dev/null
+++ b/_Main/BL/Type_OfflinePlanRow/Attribute_Notes.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute Notes
+{
+  #keys: '3[415754.0.180041713][415754.0.180041712][415754.0.180041714]'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_WholeShift/Method_CapacityRounding.qbl b/_Main/BL/Type_WholeShift/Method_CapacityRounding.qbl
index b00c88e..d2cfd98 100644
--- a/_Main/BL/Type_WholeShift/Method_CapacityRounding.qbl
+++ b/_Main/BL/Type_WholeShift/Method_CapacityRounding.qbl
@@ -90,8 +90,34 @@
     //  }
     //  debuginfo( "銆傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘��" );
     //}
+    
+    sourceChangeover := uptb.ChangeoverDuration();
+    targetChangeover := Duration::Zero();
+    
+    debuginfo( "闇�瑕佸渾鏁寸殑鏃堕棿锛堝崟浣嶏細灏忔椂锛�", timeDifference, "    鑰冭檻ChangeOver鏉′欢鍦嗘暣浣垮叾杈惧埌鏁寸彮" );
+    nextUnitPeriodTimeBase := ifexpr( isnull( uptb.Next().astype( UnitPeriodTimeBase ) ), select( uptbs, Elements, tempUPTB, tempUPTB.Start() = uptb.End() ), uptb.Next().astype( UnitPeriodTimeBase ) );
+    while ( timeDifference > 0 and not isnull( nextUnitPeriodTimeBase ) ) {
+      debuginfo( "寮�濮嬪悜鏃堕棿涓猴細", nextUnitPeriodTimeBase.StartDate().Format( "Y-M2-D2" ), "鐨勪骇鑳藉懆鏈熷��" );
+      traverse ( nextUnitPeriodTimeBase, PeriodTaskOperation, pto, guard( pto.Operation().RoutingStep().Routing().Start(), uptb.StartDate() ) <= uptb.StartDate() and
+                                                                   guard( pto.Operation().RoutingStep().Routing().End(), uptb.End().Date() ) >= uptb.End().Date() and
+                                                                   exists( uptb, PeriodTaskOperation.Operation, tempO, tempO = pto.Operation() )                  and
+                                                                   timeDifference > 0 ) {
+        minimumCapacityThatCanBeBorrowed := pto.Quantity() / pto.Operation().Throughput();
+        unifiedProcessingTimeOfRounding := minvalue( timeDifference, minimumCapacityThatCanBeBorrowed ); 
+        debuginfo( "鍓╀綑鍦嗘暣鐨勪骇鑳斤細", timeDifference, "    nextUnitPeriodTimeBase鐨勫綋鍓嶅懆鏈熶换鍔′緵搴旀暟閲忥細", pto.Quantity(), "    鑳藉�熺殑浜ц兘锛�", minimumCapacityThatCanBeBorrowed, " 缁熶竴鍊熺殑浜ц兘锛�", unifiedProcessingTimeOfRounding, "    鍊熶箣鍓峜hangeover鏃堕棿锛�", uptb.ChangeoverDuration() ); 
+        this.UnifiedProcessingOfRoundingLogic( unifiedProcessingTimeOfRounding, uptb, pto, macroPlan ); 
+        targetChangeover := uptb.ChangeoverDuration();
+        timeDifference   := timeDifference - unifiedProcessingTimeOfRounding;                                                 
+      }
+         
+      if ( isnull( nextUnitPeriodTimeBase.Next() ) ) {
+        nextUnitPeriodTimeBase := select( uptbs, Elements, tempUPTB, tempUPTB.Start() = nextUnitPeriodTimeBase.End() );
+      } else {
+        nextUnitPeriodTimeBase := nextUnitPeriodTimeBase.Next().astype( UnitPeriodTimeBase );
+      }
+    }
         
-    debuginfo( "涓嶈�冭檻浠讳綍鏉′欢鍦嗘暣浣垮叾鍒拌揪鏁寸彮" );
+    debuginfo( "闇�瑕佸渾鏁寸殑鏃堕棿锛堝崟浣嶏細灏忔椂锛�", timeDifference, "    涓嶈�冭檻浠讳綍鏉′欢鍦嗘暣浣垮叾鍒拌揪鏁寸彮" );
     nextUnitPeriodTimeBase := ifexpr( isnull( uptb.Next().astype( UnitPeriodTimeBase ) ), select( uptbs, Elements, tempUPTB, tempUPTB.Start() = uptb.End() ), uptb.Next().astype( UnitPeriodTimeBase ) );
     while ( timeDifference > 0 and not isnull( nextUnitPeriodTimeBase ) ) {
       debuginfo( "寮�濮嬪悜鏃堕棿涓猴細", nextUnitPeriodTimeBase.StartDate().Format( "Y-M2-D2" ), "鐨勪骇鑳藉懆鏈熷��" );
@@ -100,7 +126,7 @@
                                                                    timeDifference > 0 ) {
         minimumCapacityThatCanBeBorrowed := pto.Quantity() / pto.Operation().Throughput();
         unifiedProcessingTimeOfRounding := minvalue( timeDifference, minimumCapacityThatCanBeBorrowed ); 
-        debuginfo( "鍓╀綑鍦嗘暣鐨勪骇鑳斤細", timeDifference, "    nextUnitPeriodTimeBase鐨勫綋鍓嶅懆鏈熶换鍔′緵搴旀暟閲忥細", pto.Quantity(), "    鑳藉�熺殑浜ц兘锛�", minimumCapacityThatCanBeBorrowed, " 缁熶竴鍊熺殑浜ц兘锛�", unifiedProcessingTimeOfRounding ); 
+        debuginfo( "鍓╀綑鍦嗘暣鐨勪骇鑳斤細", timeDifference, "    nextUnitPeriodTimeBase鐨勫綋鍓嶅懆鏈熶换鍔′緵搴旀暟閲忥細", pto.Quantity(), "    鑳藉�熺殑浜ц兘锛�", minimumCapacityThatCanBeBorrowed, " 缁熶竴鍊熺殑浜ц兘锛�", unifiedProcessingTimeOfRounding, "    褰撳墠changeover鏃堕棿锛�", uptb.ChangeoverDuration().HoursAsReal() ); 
         this.UnifiedProcessingOfRoundingLogic( unifiedProcessingTimeOfRounding, uptb, pto, macroPlan );  
         timeDifference := timeDifference - unifiedProcessingTimeOfRounding;                                                 
       }
@@ -111,5 +137,9 @@
         nextUnitPeriodTimeBase := nextUnitPeriodTimeBase.Next().astype( UnitPeriodTimeBase );
       }
     }
+    
+    if ( ( targetChangeover - sourceChangeover ).HoursAsReal() > 0.0 ) {
+      this.ZeroCapacityReplenishment( macroPlan, ( targetChangeover - sourceChangeover ).HoursAsReal(), uptb, uptbs );
+    }
   *]
 }
diff --git a/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling3.qbl b/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling3.qbl
index 24624c5..ca698ed 100644
--- a/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling3.qbl
+++ b/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling3.qbl
@@ -7,7 +7,10 @@
 {
   TextBody:
   [*
-    traverse ( uptbs, Elements, uptb, true/*uptb.StartDate() <= Date::Construct( 2024, 4, 23 )*/ ) {
+    traverse ( uptbs, Elements, uptb, 
+               true
+    //           uptb.StartDate() <= Date::Construct( 2024, 5, 8 ) 
+               ) {
       if ( ( uptb.End().Date() - uptb.StartDate() ) > 1 ) {  
     //    debuginfo( "寮�濮嬫椂闂达細", uptb.StartDate().Format( "Y-M2-D2" ), "    缁撴潫鏃堕棿锛�", uptb.End().Date().Format( "Y-M2-D2" ), "    鏃堕棿鍖洪棿锛�", ( uptb.End().Date() - uptb.StartDate() ) );
     //    this.ProcessingTimeIntervalIsGreaterThanOneDay( macroPlan, uptb, uptbs );
diff --git a/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling4.qbl b/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling4.qbl
index f1ba88f..2155752 100644
--- a/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling4.qbl
+++ b/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling4.qbl
@@ -10,17 +10,18 @@
   [*
     traverse ( unit, Lane.LaneLeg.Trip, t ) {
       traverse ( t, ProductInTrip, pit, pit.Quantity() > 0.0 ) {
+        info( pit.Product_MP().ParentID() );
         // 鑾峰彇浜у搧lotsize鍊嶆暟
         lotsize := 1;
-        if ( pit.Product_MP().ParentID().Regex( "缂镐綋" ) ) {
+        if ( pit.Product_MP().ParentID().Regex( "ZKG" ) ) {
           lotsize := macroPlan.CylinderBlock();
-        } else if ( pit.Product_MP().ParentID().Regex( "缂哥洊" ) ) {
+        } else if ( pit.Product_MP().ParentID().Regex( "ZKM" ) ) {
           lotsize := macroPlan.CylinderHead();
-        } else if ( pit.Product_MP().ParentID().Regex( "杩炴潌" ) ) {
+        } else if ( pit.Product_MP().ParentID().Regex( "PL" ) ) {
           lotsize := macroPlan.ConnectingRod();
-        } else if ( pit.Product_MP().ParentID().Regex( "鏇茶酱" ) ) {
+        } else if ( pit.Product_MP().ParentID().Regex( "KW" ) ) {
           lotsize := macroPlan.Crankshaft();
-        } else if ( pit.Product_MP().ParentID().Regex( "鏇茶酱" ) ) {
+        } else if ( pit.Product_MP().ParentID().Regex( "AGW" ) ) {
           lotsize := macroPlan.BalanceAxis();
         }
         
diff --git a/_Main/BL/Type_WholeShift/Method_ProcessingTimeIntervalIsEqualToOneDay.qbl b/_Main/BL/Type_WholeShift/Method_ProcessingTimeIntervalIsEqualToOneDay.qbl
index 1bd90a5..5c3470d 100644
--- a/_Main/BL/Type_WholeShift/Method_ProcessingTimeIntervalIsEqualToOneDay.qbl
+++ b/_Main/BL/Type_WholeShift/Method_ProcessingTimeIntervalIsEqualToOneDay.qbl
@@ -9,7 +9,7 @@
   Description: '澶勭悊鏃堕棿鍖洪棿绛変簬1澶�'
   TextBody:
   [*
-    if ( uptb.UsedCapacity() = uptb.TotalAvailableCapacity() or ( uptb.UtilizationPercentage() * uptb.MaximumLoadPercentage() / 100 ) = 100 or uptb.FreeCapacity().HoursAsReal() = 0 ) { 
+    if ( uptb.UsedCapacity() = uptb.TotalAvailableCapacity() or [Number]( uptb.UtilizationPercentage() * uptb.MaximumLoadPercentage() / 100 ) = 100 or uptb.FreeCapacity().HoursAsReal() = 0 ) { 
       debuginfo( "澶╁凡缁忔槸鏁寸彮锛屾棤闇�澶勭悊锛堜娇鐢ㄤ骇鑳界瓑浜庡彲鐢ㄤ骇鑳斤級" );
     } else if ( uptb.UsedCapacity().HoursAsReal() = 0 ) {
       debuginfo( "澶╁凡缁忔槸鏁寸彮锛屾棤闇�澶勭悊锛堜娇鐢ㄤ骇鑳界瓑浜�0锛�" );
@@ -27,12 +27,12 @@
         }
         debuginfo( ".........." );             
       }
-      //  whetherToFillInZero := false;
+      whetherToFillInZero := false;
       if ( whetherToFillInZero ) {
-        debuginfo( "鎵ц琛ラ浂" );
+        debuginfo( "寮�濮嬫墽琛岃ˉ闆�------------" );
         this.ZeroCapacityReplenishment( macroPlan, uptb.UsedCapacity().HoursAsReal(), uptb, uptbs ); 
       } else {
-        debuginfo( "鎵ц鍦嗘暣" );
+        debuginfo( "寮�濮嬫墽琛屽渾鏁�------------" );
         this.CapacityRounding( macroPlan, uptb.TotalAvailableCapacity().HoursAsReal() - ( uptb.UsedCapacity() + uptb.ChangeoverDuration() ).HoursAsReal(), uptb, uptbs );
       }
     } else {
diff --git a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_MacroPlanner_ContextMenuInterface_mInterfaceProductionSchedulingPla.def b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_MacroPlanner_ContextMenuInterface_mInterfaceProductionSchedulingPla.def
index dd980dc..a702496 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_MacroPlanner_ContextMenuInterface_mInterfaceProductionSchedulingPla.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_MacroPlanner_ContextMenuInterface_mInterfaceProductionSchedulingPla.def
@@ -13,7 +13,7 @@
   {
     Body:
     [*
-      InterfaceProductionSchedulingPlanPush::GenerateData( MacroPlan, InterfaceDataset );
+      InterfaceProductionSchedulingPlanPush::GenerateData( MacroPlan, InterfaceDataset, Number::Random( 0, 1 ) );
       
       WebMessageBox::Success( "鎺ㄩ�佹垚鍔燂紒" );
     *]

--
Gitblit v1.9.3