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

---
 _Main/BL/Type_PackagingPlanCell/StaticMethod_GenerateReport.qbl                   |    6 ++-
 _Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl                       |   10 ++--
 _Main/BL/Type_NewOfflinePlanCell/StaticMethod_DeductionOfReplacementLoss.qbl      |   13 ++++--
 _Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesDL.qbl |    6 +-
 _Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl                       |   26 +++++++++----
 _Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesCC.qbl |   31 +++++++++++++++
 6 files changed, 69 insertions(+), 23 deletions(-)

diff --git a/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl b/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
index 128058b..27b05ec 100644
--- a/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
+++ b/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
@@ -94,11 +94,11 @@
         
         // 澶栫搴撹繍杈撹垂鐢細鍙戝姩鏈鸿繍杈撻噺 / 鍖呰瀹归噺 / 瑁呰浇瀹归噺锛堝悜涓婂彇鏁达級 * 鏂欐灦杩愯緭鍗曚环
         transportationQuantity := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT, 
-                                       tempPIT.Product_MP().Generation()                                                =  ccerr.Generation() and
-                                       tempPIT.Product_MP().MQBMLB()                                                    =  ccerr.MLB_MQB()    and
-                                       tempPIT.Trip().Departure().Date()                                                >= ccerc.StartDate()  and
-                                       tempPIT.Trip().Arrival().Date()                                                  <= lastDayOfThisMonth and
-                                       tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID()      = "CC 鍘傚唴搴�"         and
+                                       tempPIT.Product_MP().Generation()                                                = ccerr.Generation()        and
+                                       tempPIT.Product_MP().MQBMLB()                                                    = ccerr.MLB_MQB()           and
+                                       tempPIT.Trip().Departure().Date().Year()                                         = ccerc.StartDate().Year()  and
+                                       tempPIT.Trip().Departure().Date().Month()                                        = ccerc.StartDate().Month() and
+                                       tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID()      = "CC 鍘傚唴搴�"               and
                                        tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID() = "闀挎槬澶栫搴�",
                                        tempPIT.Quantity()
                                       );
diff --git a/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl b/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
index 14c6378..731bea9 100644
--- a/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
+++ b/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
@@ -60,7 +60,9 @@
                            tempMRTCell.MaterialRackTotalRow().Generation() = dlerr.Generation()        and
                            tempMRTCell.MaterialRackTotalRow().MLB_MQB()    = dlerr.MLB_MQB()           and
                            tempMRTCell.MaterialRackColumn().Month()        = dlerc.StartDate().Month() );
-        cell.TotalQuantityOfMaterialRacks( mrtcell.Quantity() );
+        if ( dlerr.Generation() = "350bar" and dlerr.MLB_MQB() = "MQB" ) {
+          cell.TotalQuantityOfMaterialRacks( mrtcell.Quantity() );
+        }
        
         // 澶ц繛澶栫搴撶┖鏂欐灦鏁伴噺锛氥��350bar MQB鏂欐灦鎬绘暟閲� - 鎵�鏈�350bar MQB鎬诲簱瀛� / 鍖呰瀹归噺 - 瀹㈡埛搴撴枡鏋舵暟閲忋��* 澶ц繛澶栫搴撶┖鏂欐灦姣斾緥
         plannedInventory := sum( macroPlan, Product_MP.ProductInStockingPoint_MP.ProductInStockingPointInPeriod, tempPISPIP,
@@ -84,8 +86,8 @@
                                         tempF.StartDate().Year()        = dlerc.StartDate().Year()  and
                                         tempF.StartDate().Month()       = dlerc.StartDate().Month(),
                                         tempF.FulfilledQuantity() );
-        info( "鏃堕棿锛�", dlerc.StartDate().Format( "Y-M2-D2" ), "    鍏ュ簱鏁伴噺锛�", transportationQuantity1, "    鍖呰瀹归噺锛�", guard( lce.PackagingCapacity(), 0 ),
-              "    鍏ュ簱鍗曚环锛�", guard( lcmrCC.WarehousingPrice(), 0 ) ); // 娴嬭瘯杈撳嚭
+    //    info( "鏃堕棿锛�", dlerc.StartDate().Format( "Y-M2-D2" ), "    鍏ュ簱鏁伴噺锛�", transportationQuantity1, "    鍖呰瀹归噺锛�", guard( lce.PackagingCapacity(), 0 ),
+    //          "    鍏ュ簱鍗曚环锛�", guard( lcmrCC.WarehousingPrice(), 0 ) ); // 娴嬭瘯杈撳嚭
         cell.CCStorageFeesForRentedWarehouses( [Number] ( guard( transportationQuantity1 / lce.PackagingCapacity(), 0 ) * lcmrCC.WarehousingPrice() ) );
         
         // CC澶栫搴撳嚭搴撹垂鐢細鍙戝姩鏈洪攢閲� / 鍖呰瀹归噺锛堝悜涓婂彇鏁达級* 鏂欐灦鍑哄簱鍗曚环
@@ -96,14 +98,15 @@
         
         // CC闀块�旇繍杈撹垂鐢細璋冩嫧鏁伴噺 / 鍖呰瀹归噺 / 瑁呰浇瀹归噺 * 鏂欐灦杩愯緭鍗曚环
         transportationQuantity2 := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT, 
-                                        tempPIT.Product_MP().Generation()                                                =  dlerr.Generation()      and
-                                        tempPIT.Product_MP().MQBMLB()                                                    =  dlerr.MLB_MQB()         and
-                                        tempPIT.Trip().Departure().Date()                                                >= dlerc.StartDate()       and
-                                        tempPIT.Trip().Arrival().Date()                                                  <= lastDayOfThisMonth      and
+                                        tempPIT.Product_MP().Generation()                                                =  dlerr.Generation()       and
+                                        tempPIT.Product_MP().MQBMLB()                                                    =  dlerr.MLB_MQB()          and
+                                        tempPIT.Trip().Departure().Date().Year()                                         = dlerc.StartDate().Year()  and
+                                        tempPIT.Trip().Departure().Date().Month()                                        = dlerc.StartDate().Month() and
                                         tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID()      = "澶ц繛鍘傚唴搴�"              and
                                         tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID() = "澶ц繛鍙戝姩鏈虹殑闀挎槬澶栫搴�",
                                         tempPIT.Quantity()
                                        );
+    //    info( "鏁伴噺锛�", transportationQuantity2 );
         cell.CCLineHaulCost( [Number] ( guard( transportationQuantity2 / lce.PackagingCapacity() / lct1.LoadingCapacity(), 0 ) * guard( lct1.TransportPrice(), 1 ) ) );
         
         // CC鐭�旇繍杈撹垂鐢細璋冩嫧鏁伴噺 / 鍖呰瀹归噺 / 瑁呰浇瀹归噺 * 鏂欐灦杩愯緭鍗曚环
@@ -133,7 +136,14 @@
         cell.DLOutboundExpensesForRentedWarehouses( [Number] ( guard( outboundQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmrDL.OutboundPrice(), 1 ) ) );
         
         // DL澶栫搴撹繍杈撹垂鐢細鍙戝姩鏈鸿繍杈撻噺 / 鍖呰瀹归噺 / 瑁呰浇瀹归噺锛堝悜涓婂彇鏁达級* 鏂欐灦杩愯緭鍗曚环
-        cell.DLExternalRentalWarehouseTransportationCosts( [Number] ( guard( inventoryQuantity / lce.PackagingCapacity() / lct2.LoadingCapacity(), 0 ) * guard( lct2.TransportPrice(), 1 ) ) );
+        outboundQuantity1 := sum( macroPlan, Product_MP.ProductInStockingPoint_MP.ProductInStockingPointInPeriodPlanning.astype( ProductInStockingPointInPeriodPlanningLeaf ), tempPISPIPPL,
+                                 tempPISPIPPL.ProductInStockingPoint_MP().Product_MP().Generation() = dlerr.Generation()  and
+                                 tempPISPIPPL.ProductInStockingPoint_MP().Product_MP().MQBMLB()     = dlerr.MLB_MQB()     and
+                                 tempPISPIPPL.ProductInStockingPoint_MP().StockingPointID()         = "澶ц繛澶栫搴�"        and
+                                 tempPISPIPPL.Start().Date()                                        >= dlerc.StartDate()  and
+                                 tempPISPIPPL.End().Date()                                          <= lastDayOfThisMonth,
+                                 tempPISPIPPL.NewSupplyQuantity() );
+        cell.DLExternalRentalWarehouseTransportationCosts( [Number] ( guard( outboundQuantity1 / lce.PackagingCapacity() / lct2.LoadingCapacity(), 0 ) * guard( lct2.TransportPrice(), 1 ) ) );
         
         // 澶ц繛澶栫搴撲粨鍌ㄨ垂鐢細銆�350bar MQB鏂欐灦鎬绘暟閲�-鎵�鏈�350bar MQB鎬诲簱瀛�/鍖呰瀹归噺-瀹㈡埛搴撴枡鏋舵暟閲忋��*澶ц繛澶栫搴撶┖鏂欐灦姣斾緥
         // DL澶栫搴撲粨鍌ㄨ垂鐢細鏂欐灦鎬绘暟閲� - 鍙戝姩鏈哄簱瀛� / 鍖呰瀹归噺锛堝悜涓婂彇鏁达級* 绌烘枡鏋朵粨鍌ㄥ崟浠�
diff --git a/_Main/BL/Type_NewOfflinePlanCell/StaticMethod_DeductionOfReplacementLoss.qbl b/_Main/BL/Type_NewOfflinePlanCell/StaticMethod_DeductionOfReplacementLoss.qbl
index 6b23ce9..b450973 100644
--- a/_Main/BL/Type_NewOfflinePlanCell/StaticMethod_DeductionOfReplacementLoss.qbl
+++ b/_Main/BL/Type_NewOfflinePlanCell/StaticMethod_DeductionOfReplacementLoss.qbl
@@ -14,7 +14,7 @@
     allProductionLines := selectuniquevalues( newNOPT, NewOfflinePlanRow, tempNOPR, true, tempNOPR.ProductionLine() );
     
     traverse ( allProductionLines, Elements, pl
-    //           , pl = "eMotor Assy (France)" 
+    //           , pl = "CC MoMo" 
              ) 
     {
       // 涓嬬嚎璁″垝褰撳墠浜х嚎涓嬬殑琛�
@@ -24,11 +24,12 @@
       preNOPCell := null( NewOfflinePlanCell );
       
       traverse ( newNOPT, NewOfflinePlanColumn, nopc
-    //             , nopc.StartDate() >= macroPlan.StartOfPlanning().Date() and nopc.StartDate() <= Date::Construct( 2024, 4, 17 ) // 娴嬭瘯鏃跺彲浠ヨ繃婊ゆ椂闂�
+    //             , nopc.StartDate() >= macroPlan.StartOfPlanning().Date() and nopc.StartDate() <= Date::Construct( 2025, 1, 16 ) // 娴嬭瘯鏃跺彲浠ヨ繃婊ゆ椂闂�
                ) 
       {         
         for ( i := 1; i < 10; i++ ) {
-          nopcell := select( noprs, Elements.NewOfflinePlanCell, tempNOPC, tempNOPC.NewOfflinePlanColumn() = nopc and tempNOPC.OrderNr() = i );
+          nopcell := select( noprs, Elements.NewOfflinePlanCell, tempNOPC, tempNOPC.NewOfflinePlanColumn() = nopc and tempNOPC.OrderNr() = i and tempNOPC.Order() <> "" );
+          
           // 鎹㈠瀷鎹熷け鍙傛暟
           cls     := select( macroPlan, ChangeLossSetting, tempCLS, 
                              tempCLS.ProductFirst().ID()  = guard( preNOPCell.NewOfflinePlanRow().ProductID(), "" ) and
@@ -39,10 +40,12 @@
     
           // 鎵e噺鎹㈠瀷鎹熷け
           if ( not isnull( preNOPCell ) and not isnull( nopcell ) and not isnull( cls ) ) {
-            preNOPCell.Quantity( preNOPCell.Quantity() - cls.ChangeLossNumber() );                 
+    //        info( "褰撳墠浜у搧搴忓彿锛�", nopcell.OrderNr(),  "    ", nopcell.Order(), "    ", i );
     //        info( "褰撳墠鍒楁椂闂达細", nopc.StartDate().Format( "Y-M2-D2" ), 
     //              "    涓婁竴涓骇鍝佸綋鍓嶅簭鍙凤細", preNOPCell.Order(), "    涓婁竴涓骇鍝佹暟閲忥細", preNOPCell.Quantity(), "    涓婁竴涓骇鍝佸悕锛�", preNOPCell.NewOfflinePlanRow().ProductID(),
-    //              "    褰撳墠浜у搧搴忓彿锛�"      , nopcell.Order()   , "    褰撳墠浜у搧鏁伴噺锛�"     , nopcell.Quantity(), "    褰撳墠浜у搧鍚嶏細"  , nopcell.NewOfflinePlanRow().ProductID() );
+    //              "    褰撳墠浜у搧搴忓彿锛�"      , nopcell.Order()   , "    褰撳墠浜у搧鏁伴噺锛�"     , nopcell.Quantity(), "    褰撳墠浜у搧鍚嶏細"  , nopcell.NewOfflinePlanRow().ProductID(), 
+    //              "    闇�瑕佹墸鍑忕殑鏁伴噺锛�", cls.ChangeLossNumber() );
+            preNOPCell.Quantity( preNOPCell.Quantity() - cls.ChangeLossNumber() ); 
           }
           
           // 璁剧疆涓婁竴涓敓浜х殑浜у搧Cell
diff --git a/_Main/BL/Type_PackagingPlanCell/StaticMethod_GenerateReport.qbl b/_Main/BL/Type_PackagingPlanCell/StaticMethod_GenerateReport.qbl
index e45b9e4..9408e3a 100644
--- a/_Main/BL/Type_PackagingPlanCell/StaticMethod_GenerateReport.qbl
+++ b/_Main/BL/Type_PackagingPlanCell/StaticMethod_GenerateReport.qbl
@@ -106,8 +106,10 @@
     PackagingPlanCell::CalculationPackagingPlanProperties();
     Transaction::Transaction().Propagate( relation( PackagingPlanCell, Next ) );
     
-    // 璁剧疆鍖呰&鎷嗗寘-鏁伴噺
-    PackagingPlanCell::SetPackagingAndUnpackingValues( macroPlan );
+    // 璁剧疆鍖呰&鎷嗗寘-鏁伴噺锛堝ぇ杩炲伐鍘傦級
+    PackagingPlanCell::SetPackagingAndUnpackingValuesDL( macroPlan );
+    // 璁剧疆鍖呰&鎷嗗寘-鏁伴噺锛堥暱鏄ュ伐鍘傦級
+    PackagingPlanCell::SetPackagingAndUnpackingValuesCC( macroPlan );
     //traverse ( macroPlan, PackagingPlanRow, ppr, ( ppr.ProductID() = "Windshield" and ppr.StockingPointID() = "Bosch" ) or ( ppr.ProductID() = "Windshield" and ppr.StockingPointID() = "Components (Spain)" ) ) {
     //  traverse ( ppr, PackagingPlanCell, ppc/*, ppc.StartDate() = Date::Construct( 2020, 4, 1 )*/ ) {
     //    // 璁剧疆鍖呰鏁伴噺
diff --git a/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesCC.qbl b/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesCC.qbl
new file mode 100644
index 0000000..b8ca3b8
--- /dev/null
+++ b/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesCC.qbl
@@ -0,0 +1,31 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SetPackagingAndUnpackingValuesCC (
+  MacroPlan macroPlan
+)
+{
+  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 );
+        
+        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 );
+      }
+    }
+  *]
+}
diff --git a/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValues.qbl b/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesDL.qbl
similarity index 96%
rename from _Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValues.qbl
rename to _Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesDL.qbl
index fab92f2..3e2e0e5 100644
--- a/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValues.qbl
+++ b/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesDL.qbl
@@ -1,6 +1,6 @@
 Quintiq file version 2.0
 #parent: #root
-StaticMethod SetPackagingAndUnpackingValues (
+StaticMethod SetPackagingAndUnpackingValuesDL (
   MacroPlan macroPlan
 )
 {
@@ -10,7 +10,7 @@
     plannedStartDate := macroPlan.StartOfPlanning().Date();
     
     // 璁剧疆鍖呰鍊硷紙绗﹀悎lotsize鍜屼竴鏃ユ渶澶у寘瑁呴噺锛�
-    traverse ( macroPlan, PackagingPlanRow, ppr/*, ppr.Factory() = "澶ц繛宸ュ巶" and ppr.ProductID() = "06K103011CM"*/ ) {
+    traverse ( macroPlan, PackagingPlanRow, ppr, ppr.Factory() = "澶ц繛宸ュ巶" /*and ppr.ProductID() = "06K103011CM"*/ ) {
       traverse ( ppr, PackagingPlanCell, ppcell/*, ppcell.StartDate() <= Date::Construct( 2025, 1, 4 )*/ ) {
         // Product_MP
         pmp                     := select( macroPlan, Product_MP, tempPMP, tempPMP.IsLeaf() and tempPMP.ID() = ppr.ProductID() );
@@ -93,7 +93,7 @@
     }
     
     // 璁剧疆鎷嗗寘鍊硷紙绗﹀悎lotsize鍜屼竴鏃ユ渶澶у寘瑁呴噺锛�
-    traverse ( macroPlan, PackagingPlanRow, ppr/*, ppr.Factory() = "澶ц繛宸ュ巶" and ppr.ProductID() = "06K103011CM"*/ ) {
+    traverse ( macroPlan, PackagingPlanRow, ppr, ppr.Factory() = "澶ц繛宸ュ巶" /*and ppr.ProductID() = "06K103011CM"*/ ) {
       traverse ( ppr, PackagingPlanCell, ppcell/*, ppcell.StartDate() <= Date::Construct( 2025, 1, 4 )*/ ) {
         // Product_MP
         pmp                     := select( macroPlan, Product_MP, tempPMP, tempPMP.IsLeaf() and tempPMP.ID() = ppr.ProductID() );

--
Gitblit v1.9.3