From 00141e8e299943448c60f5f6d2031a8510812e2c Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期四, 14 十一月 2024 18:19:19 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev-zlg

---
 _Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesCC.qbl |   53 +++++++++++++++++++++++++++++++++++------------------
 1 files changed, 35 insertions(+), 18 deletions(-)

diff --git a/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesCC.qbl b/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesCC.qbl
index b8ca3b8..f2c0576 100644
--- a/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesCC.qbl
+++ b/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesCC.qbl
@@ -6,26 +6,43 @@
 {
   TextBody:
   [*
-    traverse ( macroPlan, PackagingPlanRow, ppr, ppr.Factory() = "闀挎槬宸ュ巶" /*and ppr.ProductID() = "06K103011CM"*/ ) {
-      traverse ( ppr, PackagingPlanCell, ppcell/*, ppcell.StartDate() <= Date::Construct( 2025, 1, 4 )*/ ) {
-        unpackagedQuantity := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT, 
-                                   tempPIT.ProductID()          = ppcell.PackagingPlanRow().ProductID()                               and
-                                   tempPIT.Trip().Departure().Date() = ppcell.StartDate()                                             and
-                                   tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "澶栫搴�" )      and
-                                   tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "绾胯竟搴�" ),
-                                   tempPIT.Quantity()
-                                  );
-        ppcell.Unpacking( unpackagedQuantity );
+    traverse ( macroPlan, PackagingPlanRow, ppr, ppr.Factory() = "闀挎槬宸ュ巶" /*and ppr.Category() = "ZKG" and ppr.ProductID() = "06K103011CP"*/ ) {
+      
+      u  := select( macroPlan, Unit, tempU, tempU.ID() = "CC " + ppr.Category() + " 绾胯竟鍜屽绉熷簱闂�");
+      
+      ts := selectset( u, Lane.LaneLeg.Trip, tempT, 
+                       guard( select( tempT, ProductInTrip, tempPIT, tempPIT.ProductID() = ppr.ProductID() ).Quantity() > 0, false ) );
+                       
+      traverse ( ts, Elements.ProductInTrip, pit, pit.Quantity() > 0 and pit.ProductID() = ppr.ProductID() ) {
+        ppcell := select( ppr, PackagingPlanCell, tempPPCell, tempPPCell.PackagingPlanColumn().StartDate() = pit.Trip().Departure().Date() );
         
-        packagedQuantity := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT, 
-                                 tempPIT.ProductID()          = ppcell.PackagingPlanRow().ProductID()                               and
-                                 tempPIT.Trip().Departure().Date() = ppcell.StartDate()                                             and
-                                 tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "绾胯竟搴�" )      and
-                                 tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "澶栫搴�" ),
-                                 tempPIT.Quantity()
-                                );
-        ppcell.Package( packagedQuantity );
+        if ( pit.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "澶栫搴�" ) and pit.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "绾胯竟搴�" ) ) {
+          ppcell.Unpacking( pit.Quantity() );
+        }
+        
+        if ( pit.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "绾胯竟搴�" ) and pit.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "澶栫搴�" ) ) {
+          ppcell.Package( pit.Quantity() );
+        }
       }
+    //  traverse ( ppr, PackagingPlanCell, ppcell/*, ppcell.StartDate() <= Date::Construct( 2025, 1, 4 )*/ ) {
+    //    unpackagedQuantity := sum( u, Lane.LaneLeg.Trip.ProductInTrip, tempPIT, 
+    //                               tempPIT.ProductID()          = ppcell.PackagingPlanRow().ProductID()                               and
+    //                               tempPIT.Trip().Departure().Date() = ppcell.StartDate()                                             and
+    //                               tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "澶栫搴�" )      and
+    //                               tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "绾胯竟搴�" ),
+    //                               tempPIT.Quantity()
+    //                              );
+    //    ppcell.Unpacking( unpackagedQuantity );
+    //    
+    //    packagedQuantity := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT, 
+    //                             tempPIT.ProductID()          = ppcell.PackagingPlanRow().ProductID()                               and
+    //                             tempPIT.Trip().Departure().Date() = ppcell.StartDate()                                             and
+    //                             tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "绾胯竟搴�" )      and
+    //                             tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "澶栫搴�" ),
+    //                             tempPIT.Quantity()
+    //                            );
+    //    ppcell.Package( packagedQuantity );
+    //  }
     }
   *]
 }

--
Gitblit v1.9.3