| | |
| | | // 创建行 |
| | | 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 ); |
| | | } |
| | | } |
| | |
| | | // 大连外租库空料架数量:【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 ) ); |
| | |
| | | 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 ) ) ) |
| | |
| | | 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外租库出库费用:发动机出库量 / 料架容量(向上取整)* 料架出库单价 |
| | |
| | | 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 ) ) ); |