From e2494303609cb24dd805b65c2654b82538be8c36 Mon Sep 17 00:00:00 2001 From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com> Date: 星期五, 18 十月 2024 11:22:24 +0800 Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev --- _Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl | 52 ++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 40 insertions(+), 12 deletions(-) diff --git a/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl b/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl index a347a1c..98564c2 100644 --- a/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl +++ b/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl @@ -1,8 +1,7 @@ Quintiq file version 2.0 #parent: #root StaticMethod CreateData ( - MacroPlan macroPlan, - String factory + MacroPlan macroPlan ) { TextBody: @@ -36,15 +35,24 @@ and tempLCM.StartDate() <= mlcrc.StartDate() and tempLCM.EndDate() >= mlcrc.StartDate().StartOfNextMonth() ); // 杩愯緭鎴愭湰鍙傛暟 - lct := select( macroPlan, LogisticsCostTransport, tempLCT, tempLCT.Product() = mlcrr.Category() and - tempLCT.Origin() = "闀挎槬澶栫搴�" and tempLCT.Destination() = "CC 鍘傚唴搴�" ); + lct := select( macroPlan, LogisticsCostTransport, tempLCT, + tempLCT.Product() = mlcrr.Category() and + tempLCT.Origin() = ifexpr( mlcrr.Factory() = "澶ц繛宸ュ巶", "闀挎槬澶栫搴�", "澶ц繛鍘傚唴搴�" ) and + tempLCT.Destination() = ifexpr( mlcrr.Factory() = "澶ц繛宸ュ巶", "澶ц繛鍦哄唴搴�", "闀挎槬澶栫搴�" ) ); + lct1 := select( macroPlan, LogisticsCostTransport, tempLCT, + tempLCT.Product() = mlcrr.Category() and + tempLCT.Origin() = ifexpr( mlcrr.Factory() = "澶ц繛宸ュ巶", "澶ц繛鍘傚唴搴�", "CC 鍘傚唴搴�" ) and + tempLCT.Destination() = ifexpr( mlcrr.Factory() = "澶ц繛宸ュ巶", "澶ц繛澶栫搴�", "闀挎槬澶栫搴�" ) ); + + // 褰撳墠鏈堟湯鏈�鍚庝竴澶╂棩鏈� + lastDayOfThisMonth := mlcrc.StartDate().StartOfNextMonth() - 1; cell := mlcrr.MachineLogisticsCostReportCell( relnew ); // 璁剧疆鍖呰璐圭敤锛堝寘瑁呴噺 * 鍖呰鍗曚环锛� packageQuantity := sum( macroPlan, PackagingPlanRow.PackagingPlanCell, tempPPC, tempPPC.PackagingPlanRow().Category() = mlcrr.Category() and - tempPPC.PackagingPlanRow().Factory() = factory and + tempPPC.PackagingPlanRow().Factory() = mlcrr.Factory() and tempPPC.PackagingPlanColumn().StartDate().Year() = mlcrc.StartDate().Year() and tempPPC.PackagingPlanColumn().StartDate().Month() = mlcrc.StartDate().Month(), tempPPC.Package() ); @@ -53,7 +61,7 @@ // 璁剧疆鎷嗗寘璐圭敤锛堟媶鍖呴噺 * 鎷嗗寘鍗曚环锛� unpackingQuantity := sum( macroPlan, PackagingPlanRow.PackagingPlanCell, tempPPC, tempPPC.PackagingPlanRow().Category() = mlcrr.Category() and - tempPPC.PackagingPlanRow().Factory() = factory and + tempPPC.PackagingPlanRow().Factory() = mlcrr.Factory() and tempPPC.PackagingPlanColumn().StartDate().Year() = mlcrc.StartDate().Year() and tempPPC.PackagingPlanColumn().StartDate().Month() = mlcrc.StartDate().Month(), tempPPC.Unpacking() ); @@ -67,20 +75,40 @@ // 璁剧疆璋冩嫧璐圭敤锛堣皟鎷ㄦ暟閲� / 鍖呰瀹归噺 / 瑁呰浇瀹归噺 * 杩愯緭鍗曚环锛� transferQuantity := sum( macroPlan, TransferPlanRow.TransferPlanCell, tempTPC, - tempTPC.TransferPlanRow().Category() = mlcrr.Category() and - tempTPC.TransferPlanRow().Name() = ifexpr( factory = "澶ц繛宸ュ巶", "CC to DL", "DL to CC" ) and - tempTPC.TransferPlanColumn().ColumnDate().Year() = mlcrc.StartDate().Year() and - tempTPC.TransferPlanColumn().ColumnDate().Month() = mlcrc.StartDate().Month(), + tempTPC.TransferPlanRow().Category() = mlcrr.Category() and + tempTPC.TransferPlanRow().Name() = ifexpr( mlcrr.Factory() = "澶ц繛宸ュ巶", "CC to DL", "DL to CC" ) and + guard( tempTPC.TransferPlanColumn().ColumnDate().Year() = mlcrc.StartDate().Year(), false ) and + guard( tempTPC.TransferPlanColumn().ColumnDate().Month() = mlcrc.StartDate().Month(), false ), [Number]tempTPC.Value() ); cell.TransferCost( transferQuantity / guard( lcm.PackagingCapacity(), 1 ) / guard( lct.LoadingCapacity(), 1 ) * guard( lct.TransportPrice(), 1 ) ); // 澶栫搴撳叆搴撹垂鐢紙鍏ュ簱閲廩鍖呰閲廬 / 鍖呰瀹归噺 * 鍏ュ簱鍗曚环锛� - // cell.StorageFeesForRentedWarehouses( packageQuantity / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.WarehousingPrice(), 1 ) ); + cell.StorageFeesForRentedWarehouses( packageQuantity / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.WarehousingPrice(), 1 ) ); // 澶栫搴撳嚭搴撹垂鐢紙鍑哄簱閲廩鎷嗗寘閲廬 / 鍖呰瀹归噺 * 鍑哄簱鍗曚环锛� - // cell.OutboundExpensesForRentedWarehouses( unpackingQuantity / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.OutboundPrice(), 1 ) ); + cell.OutboundExpensesForRentedWarehouses( unpackingQuantity / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.OutboundPrice(), 1 ) ); // 澶栫搴撹繍杈撹垂鐢紙杩愯緭鏁伴噺 / 鍖呰瀹归噺 / 瑁呰浇瀹归噺 * 杩愯緭鍗曚环锛� + transportationQuantity := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT, + tempPIT.Product_MP().ParentID() = mlcrr.Category() and + tempPIT.Trip().Departure().Date() >= mlcrc.StartDate() and + tempPIT.Trip().Arrival().Date() <= lastDayOfThisMonth and + tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID() = "CC 鍘傚唴搴�" and + tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID() = "闀挎槬澶栫搴�", + tempPIT.Quantity() + ); + cell.ExternalRentalWarehouseTransportationCosts( transportationQuantity / guard( lcm.PackagingCapacity(), 1 ) / guard( lct1.LoadingCapacity(), 1 ) * guard( lct1.TransportPrice(), 1 ) ); + + // 澶栫搴撲粨鍌ㄨ垂鐢細浠撳偍鏁伴噺/鍖呰瀹归噺*浠撳偍鍗曚环 + plannedInventory := sum( macroPlan, Product_MP.ProductInStockingPoint_MP.ProductInStockingPointInPeriod, tempPISPIP, + tempPISPIP.ProductInStockingPoint_MP().Product_MP().IsLeaf() and + exists( tempPISPIP.ProductInStockingPoint_MP().Product_MP(), AllParent.AsParent, tempPMP, tempPMP.ID() = "鏈哄姞浠�" ) and + tempPISPIP.ProductInStockingPoint_MP().Product_MP().ParentID() = mlcrr.Category() and + tempPISPIP.Start().Date() >= mlcrc.StartDate() and + tempPISPIP.End().Date() <= lastDayOfThisMonth and + tempPISPIP.ProductInStockingPoint_MP().StockingPointID() = ifexpr( mlcrr.Factory() = "澶ц繛宸ュ巶", "澶ц繛澶栫搴�", "闀挎槬澶栫搴�" ), + tempPISPIP.PlannedInventoryLevelEnd() ); + cell.RentalWarehouseStorageFees( plannedInventory / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.StoragePrice(), 1 ) ); cell.MachineLogisticsCostReportColumn( relset, mlcrc ); } -- Gitblit v1.9.3