From 10b3be5622ad46e4e37a6a2ce11aafcfa565c36d Mon Sep 17 00:00:00 2001 From: lihongji <3117313295@qq.com> Date: 星期四, 07 十一月 2024 11:46:08 +0800 Subject: [PATCH] 计划库存接口 --- _Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl | 64 +++++++++++++------------------- 1 files changed, 26 insertions(+), 38 deletions(-) diff --git a/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl b/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl index 8f4c851..7a0a699 100644 --- a/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl +++ b/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl @@ -12,8 +12,8 @@ // 鍒涘缓琛� genrations := selectuniquevalues( macroPlan, Product_MP, tempPMP, tempPMP.Generation().TrimBoth() <> "", tempPMP.Generation() ); mqbmlbs := selectuniquevalues( macroPlan, Product_MP, tempPMP, tempPMP.MQBMLB().TrimBoth() <> "", tempPMP.MQBMLB() ); - traverse ( genrations, Elements, g ) { - traverse ( mqbmlbs, Elements, m ) { + traverse ( genrations, Elements, g, g = "350bar" ) { + traverse ( mqbmlbs, Elements, m, m = "MQB" ) { macroPlan.DL_EngineRackRow( relnew, Generation := g, MLB_MQB := m ); } } @@ -67,13 +67,13 @@ // 澶ц繛澶栫搴撶┖鏂欐灦鏁伴噺锛氥��350bar MQB鏂欐灦鎬绘暟閲� - 鎵�鏈�350bar MQB鎬诲簱瀛� / 鍖呰瀹归噺 - 瀹㈡埛搴撴枡鏋舵暟閲忋��* 澶ц繛澶栫搴撶┖鏂欐灦姣斾緥 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().StockingPointID() = "澶ц繛鍙戝姩鏈虹殑闀挎槬澶栫搴�" and - tempPISPIP.ProductInStockingPoint_MP().Product_MP().Generation() = dlerr.Generation() and - tempPISPIP.ProductInStockingPoint_MP().Product_MP().MQBMLB() = dlerr.MLB_MQB() and - tempPISPIP.Start().Date() >= dlerc.StartDate() and - tempPISPIP.End().Date() <= lastDayOfThisMonth, - tempPISPIP.PlannedInventoryLevelEnd() ) / ( lastDayOfThisMonth - dlerc.StartDate() ); + exists( tempPISPIP.ProductInStockingPoint_MP().Product_MP(), AllParent.AsParent, tempPMP, tempPMP.ID() = "鍙戝姩鏈�" ) and + //tempPISPIP.ProductInStockingPoint_MP().StockingPointID() = "澶ц繛鍙戝姩鏈虹殑闀挎槬澶栫搴�" and + tempPISPIP.ProductInStockingPoint_MP().Product_MP().Generation() = dlerr.Generation() and + tempPISPIP.ProductInStockingPoint_MP().Product_MP().MQBMLB() = dlerr.MLB_MQB() and + tempPISPIP.Start().Date().Year() = dlerc.StartDate().Year() and + tempPISPIP.Start().Date().Month() = dlerc.StartDate().Month(), + tempPISPIP.PlannedInventoryLevelEnd() ) / ( dlerc.StartDate().StartOfNextMonth() - dlerc.StartDate() ); cell.PackagingCapacity( guard( lce.PackagingCapacity(), 1 ) ); cell.PlannedInventory( plannedInventory ); cell.NumberOfEmptyShelves( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - guard( cell.PlannedInventory() / cell.PackagingCapacity(), 0 ) - guard( mrcc.Quantity(), 0 ) ) * guard( mrpc.Quantity(), 1 ), 0 ) ); @@ -107,7 +107,7 @@ tempPIT.Quantity() ); // info( "鏁伴噺锛�", transportationQuantity2 ); - cell.CCLineHaulCost( [Number] ( guard( transportationQuantity2 / lce.PackagingCapacity() / lct1.LoadingCapacity(), 0 ) * guard( lct1.TransportPrice(), 1 ) ) ); + cell.CCLineHaulCost( [Number] ( guard( ceil( ceil( transportationQuantity2 / lce.PackagingCapacity() ) / lct1.LoadingCapacity() ), 0 ) * guard( lct1.TransportPrice(), 1 ) ) ); // CC鐭�旇繍杈撹垂鐢細璋冩嫧鏁伴噺 / 鍖呰瀹归噺 / 瑁呰浇瀹归噺 * 鏂欐灦杩愯緭鍗曚环 cell.CCShortDistanceTransportationCosts( [Number] ( guard( transportationQuantity1 / lce.PackagingCapacity() / lct3.LoadingCapacity(), 0 ) * guard( lct3.TransportPrice(), 1 ) ) ) @@ -120,8 +120,9 @@ tempF.StartDate() >= ( dlerc.StartDate() - 2 ) and tempF.StartDate() <= ( lastDayOfThisMonth - 2 ), tempF.FulfilledQuantity() ); - // info( "鏃堕棿锛�", dlerc.StartDate().Format( "Y-M2-D2" ), " 鍏ュ簱鏁伴噺锛�", inventoryQuantity, " 鍖呰瀹归噺锛�", guard( lce.PackagingCapacity(), 0 ), - // " 鍏ュ簱鍗曚环锛�", guard( lcmr.WarehousingPrice(), 0 ) ); // 娴嬭瘯杈撳嚭 + // info( "鏃堕棿锛�", dlerc.StartDate().Format( "Y-M2-D2" ), " 鏃堕棿鍖哄煙锛�", ( dlerc.StartDate() - 2 ).Format( "Y-M2-D2" ), " ", ( lastDayOfThisMonth - 2 ).Format( "Y-M2-D2" ), + // " 鍏ュ簱鏁伴噺锛�", inventoryQuantity, " 鍖呰瀹归噺锛�", guard( lce.PackagingCapacity(), 0 ), + // " 鍏ュ簱鍗曚环锛�", guard( lcmrDL.WarehousingPrice(), 0 ) ); // 娴嬭瘯杈撳嚭 cell.DLStorageFeesForRentedWarehouses( [Number] ( guard( inventoryQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmrDL.WarehousingPrice(), 1 ) ) ); // DL澶栫搴撳嚭搴撹垂鐢細鍙戝姩鏈哄嚭搴撻噺 / 鏂欐灦瀹归噺锛堝悜涓婂彇鏁达級* 鏂欐灦鍑哄簱鍗曚环 @@ -132,42 +133,29 @@ tempPISPIPPL.Start().Date() >= dlerc.StartDate() and tempPISPIPPL.End().Date() <= lastDayOfThisMonth, tempPISPIPPL.NewSupplyQuantity() ); - // info( "鏁伴噺锛�", outboundQuantity, " 鍖呰铻嶅垱锛�", guard( lce.PackagingCapacity(), 0 ), " 鍑哄簱鍗曚环锛�", guard( lcmr.OutboundPrice(), 0 ) ); + // info( "鏁伴噺锛�", outboundQuantity, " 鍖呰瀹归噺锛�", guard( lce.PackagingCapacity(), 0 ), " 鍑哄簱鍗曚环锛�", guard( lcmr.OutboundPrice(), 0 ) ); cell.DLOutboundExpensesForRentedWarehouses( [Number] ( guard( outboundQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmrDL.OutboundPrice(), 1 ) ) ); // DL澶栫搴撹繍杈撹垂鐢細鍙戝姩鏈鸿繍杈撻噺 / 鍖呰瀹归噺 / 瑁呰浇瀹归噺锛堝悜涓婂彇鏁达級* 鏂欐灦杩愯緭鍗曚环 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.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().Year() = dlerc.StartDate().Year() and + tempPISPIPPL.Start().Date().Month() = dlerc.StartDate().Month(), tempPISPIPPL.NewSupplyQuantity() ); - cell.DLExternalRentalWarehouseTransportationCosts( [Number] ( guard( outboundQuantity1 / lce.PackagingCapacity() / lct2.LoadingCapacity(), 0 ) * guard( lct2.TransportPrice(), 1 ) ) ); + // info( "鏁伴噺锛�", outboundQuantity1, " 鍖呰瀹归噺锛�", guard( lce.PackagingCapacity(), 0 ), " 瑁呰浇瀹归噺锛�", guard( lct2.LoadingCapacity(), 0 ), " 杩愯緭鍗曚环锛�", guard( lct2.TransportPrice(), 1 ) ); + cell.DLExternalRentalWarehouseTransportationCosts( [Number] ( guard( ceil( ceil( outboundQuantity1 / lce.PackagingCapacity() ) / lct2.LoadingCapacity() ), 0 ) * guard( lct2.TransportPrice(), 1 ) ) ); // 澶ц繛澶栫搴撲粨鍌ㄨ垂鐢細銆�350bar MQB鏂欐灦鎬绘暟閲�-鎵�鏈�350bar MQB鎬诲簱瀛�/鍖呰瀹归噺-瀹㈡埛搴撴枡鏋舵暟閲忋��*澶ц繛澶栫搴撶┖鏂欐灦姣斾緥 // DL澶栫搴撲粨鍌ㄨ垂鐢細鏂欐灦鎬绘暟閲� - 鍙戝姩鏈哄簱瀛� / 鍖呰瀹归噺锛堝悜涓婂彇鏁达級* 绌烘枡鏋朵粨鍌ㄥ崟浠� - plannedInventory1 := 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().StockingPointID() = "澶ц繛澶栫搴�" and - tempPISPIP.ProductInStockingPoint_MP().Product_MP().Generation() = dlerr.Generation() and - tempPISPIP.ProductInStockingPoint_MP().Product_MP().MQBMLB() = dlerr.MLB_MQB() and - tempPISPIP.Start().Date() >= dlerc.StartDate() and - tempPISPIP.End().Date() <= lastDayOfThisMonth, - tempPISPIP.PlannedInventoryLevelEnd() ); - cell.DLRentalWarehouseStorageFees( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - guard( plannedInventory1 / lce.PackagingCapacity(), 0 ) - guard( mrcc.Quantity(), 0 ) ) * guard( mrpc.Quantity(), 1 ) * guard( lcmrDL.StoragePrice(), 1 ), 0 ) ); + // info( "绌烘枡鏋舵暟閲忥細", cell.TotalQuantityOfMaterialRacks(), " 搴撳瓨锛�", cell.PlannedInventory(), " 澶╂暟锛�", dlerc.StartDate().StartOfNextMonth() - dlerc.StartDate(), + // " 鍖呰瀹归噺锛�", guard( lce.PackagingCapacity(), 0 ) ); + cell.DLRentalWarehouseStorageFees( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - ceil( guard( cell.PlannedInventory() / lce.PackagingCapacity(), 0 ) ) - guard( mrcc.Quantity(), 0 ) ) * guard( mrpc.Quantity(), 1 ) * guard( lcmrDL.StoragePrice(), 1 ) * ( dlerc.StartDate().StartOfNextMonth() - dlerc.StartDate() ), 0 ) ); // CC澶栫搴撴竻娲楄垂鐢細鍙戝姩鏈哄叆搴撻噺 / 鍖呰瀹归噺 * 鏂欐灦娓呮礂鍗曚环銆傚彂鍔ㄦ満鍏ュ簱閲忓彇鍙戝姩鏈洪攢閲忥紝鍖呰瀹归噺鍙栬嚜鍙戝姩鏈烘垚鏈〃銆傛枡鏋舵竻娲楀崟浠峰彇鏂欐灦鎴愭湰琛ㄣ�� - clearnQuantity := sum( macroPlan, SalesDemand.astype( Forecast ), tempF, - tempF.Product_MP().Generation() = dlerr.Generation() and - tempF.Product_MP().MQBMLB() = dlerr.MLB_MQB() and - tempF.StockingPointID() = "澶ц繛鍙戝姩鏈虹殑闀挎槬澶栫搴�" and - tempF.StartDate().Year() = dlerc.StartDate().Year() and - tempF.StartDate().Month() = dlerc.StartDate().Month(), - tempF.Quantity() ); - // info( "鏁伴噺锛�", clearnQuantity, " 鍖呰瀹归噺锛�", guard( lce.PackagingCapacity(), 0 ), " 娓呮礂鍗曚环锛�", guard( lcmr.CleanPrice(), 0 ) ); - cell.CCCleaningCost( [Number] ( guard( clearnQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmrCC.CleanPrice(), 1 ) ) ); + // info( "鏁伴噺锛�", transportationQuantity1, " 鍖呰瀹归噺锛�", guard( lce.PackagingCapacity(), 0 ), " 娓呮礂鍗曚环锛�", guard( lcmrCC.CleanPrice(), 0 ) ); + cell.CCCleaningCost( [Number] ( guard( transportationQuantity1 / lce.PackagingCapacity(), 0 ) * guard( lcmrCC.CleanPrice(), 1 ) ) ); // DL澶栫搴撴竻娲楄垂鐢細鍙戝姩鏈哄叆搴撻噺 / 鍖呰瀹归噺 * 鏂欐灦娓呮礂鍗曚环銆傚彂鍔ㄦ満鍏ュ簱閲忓彇鍙戝姩鏈洪攢閲忥紝鍖呰瀹归噺鍙栬嚜鍙戝姩鏈烘垚鏈〃銆傛枡鏋舵竻娲楀崟浠峰彇鏂欐灦鎴愭湰琛ㄣ�� cell.CleaningCost( [Number] ( guard( outboundQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmrDL.CleanPrice(), 1 ) ) ); -- Gitblit v1.9.3