admin
2024-10-25 3a871621096a949fe8c897b89d9a66d1adb8e110
料架总数优化
已修改2个文件
41 ■■■■ 文件已修改
_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
@@ -40,12 +40,25 @@
        // 运输成本参数
        lct  := select( macroPlan, LogisticsCostTransport, tempLCT, tempLCT.Product() = "发动机料架" and tempLCT.Origin() = "长春外租库" and tempLCT.Destination() = "CC 厂内库" );
        
        // 空料架比例
        mrpc := select( macroPlan, MaterialRackProportionRow.MaterialRackProportionCell, tempMRPCell, tempMRPCell.MaterialRackProportionRow().Generation() = "长春外租库" and tempMRPCell.MaterialRackColumn().Month() = ccerc.StartDate().Month() );
        // 客户库料架总数量
        mrcc := select( macroPlan, MaterialRackCustomRow.MaterialRackCustomCell, tempMRCCell, tempMRCCell.MaterialRackCustomRow().Generation() = ccerr.Generation() and tempMRCCell.MaterialRackCustomRow().MLB_MQB() = ccerr.MLB_MQB() and tempMRCCell.MaterialRackColumn().Month() = ccerc.StartDate().Month() );
        // 当前月末最后一天日期                
        lastDayOfThisMonth := ccerc.StartDate().StartOfNextMonth() - 1; 
        
        cell := ccerr.CC_EngineRackCell( relnew );
        
        // 空料架数量(长春厂该产品的料架总数量 - 发动机库存 / 包装容量 )
        // 料架总数量
        mrtcell := select( macroPlan, MaterialRackTotalRow.MaterialRackTotalCell, tempMRTCell,
                           tempMRTCell.MaterialRackTotalRow().Generation() = ccerr.Generation()        and
                           tempMRTCell.MaterialRackTotalRow().MLB_MQB()    = ccerr.MLB_MQB()           and
                           tempMRTCell.MaterialRackColumn().Month()        = ccerc.StartDate().Month() );
        cell.TotalQuantityOfMaterialRacks( mrtcell.Quantity() );
        // 空料架数量:【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
@@ -57,7 +70,7 @@
                                 tempPISPIP.PlannedInventoryLevelEnd() );
        cell.PackagingCapacity( guard( lce.PackagingCapacity(), 1 ) );
        cell.PlannedInventory( plannedInventory );
        cell.NumberOfEmptyShelves( guard( [Number] ( cell.TotalQuantityOfMaterialRacks() - ( plannedInventory / lce.PackagingCapacity() ) ), 0 ) );
        cell.NumberOfEmptyShelves( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - ( plannedInventory / lce.PackagingCapacity() ) - guard( mrcc.Quantity(), 0 ) ) * guard( mrpc.Quantity(), 1 ), 0 ) );
        
        // 外租库入库费用(发动机销量 / 包装容量[向上取整] * 料架入库单价)
        engineSales := sum( macroPlan, FSImportData, tempFSID, 
@@ -92,9 +105,9 @@
    //    info( "时间:", ccerc.StartDate().Format( "Y-M2-D2" ), "    运输数据:", transportationQuantity, "     运输单价:", lct.TransportPrice() );
        cell.ExternalRentalWarehouseTransportationCosts( [Number] ( transportationQuantity / guard( lce.PackagingCapacity(), 1 ) / guard( lct.LoadingCapacity(), 1 ) * guard( lct.TransportPrice(), 1 ) ) );
             
        // 外租库仓储费用:料架总数量 - 发动机库存 / 包装容量(向上取整),再乘以空料架仓储单价得到空料架仓储费用。发动机库存取Actual inventories里取到长春外租库该发动机的仓储量,料架总数量需要手动维护。
        // 外租库仓储费用:【350bar MQB料架总数量 - 所有350bar MQB总库存 / 包装容量 - 客户库料架数量】* 长春外租库空料架比例*料架仓储单价。发动机库存取Actual inventories里取到长春外租库该发动机的仓储量,料架总数量需要手动维护。
        cell.UnitPriceOfEmptyShelfStorage( lcmr.StoragePrice() );
        cell.RentalWarehouseStorageFees( [Number] ( guard( ( cell.TotalQuantityOfMaterialRacks() - [Number]( plannedInventory / lce.PackagingCapacity() ) ) * lcmr.StoragePrice(), 0 ) ) );
        cell.RentalWarehouseStorageFees( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - [Number]( plannedInventory / lce.PackagingCapacity() ) - guard( mrcc.Quantity(), 0 ) ) * guard( mrpc.Quantity(), 1 ) * lcmr.StoragePrice(), 0 ) );
        
        // 清洗费用:发动机入库量 / 包装容量 * 料架清洗单价。发动机入库量取发动机销量,包装容量取自发动机成本表。料架清洗单价取料架成本表。
        cell.CleaningCost( [Number] ( engineProductions / guard( lce.PackagingCapacity(), 1 ) * lcmr.CleanPrice() ) );
_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
@@ -42,12 +42,25 @@
        lct2 := select( macroPlan, LogisticsCostTransport, tempLCT, tempLCT.Product() = "发动机料架" and tempLCT.Origin() = "大连外租库" and tempLCT.Destination() = "大连厂内库" );
        lct3 := select( macroPlan, LogisticsCostTransport, tempLCT, tempLCT.Product() = "发动机料架" and tempLCT.Origin() = "CC 客户库" and tempLCT.Destination() = "CC 外租库" );
        
        // 空料架比例
        mrpc := select( macroPlan, MaterialRackProportionRow.MaterialRackProportionCell, tempMRPCell, tempMRPCell.MaterialRackProportionRow().Generation() = "大连外租库" and tempMRPCell.MaterialRackColumn().Month() = dlerc.StartDate().Month() );
        // 客户库料架总数量
        mrcc := select( macroPlan, MaterialRackCustomRow.MaterialRackCustomCell, tempMRCCell, tempMRCCell.MaterialRackCustomRow().Generation() = dlerr.Generation() and tempMRCCell.MaterialRackCustomRow().MLB_MQB() = dlerr.MLB_MQB() and tempMRCCell.MaterialRackColumn().Month() = dlerc.StartDate().Month() );
        // 当前月末最后一天日期                
        lastDayOfThisMonth := dlerc.StartDate().StartOfNextMonth() - 1; 
        
        cell := dlerr.DL_EngineRackCell( relnew );
        
        // 空料架数量:大连厂该产品的料架总数量 - 发动机库存 / 包装容量(向上取整)
        // 料架总数量
        mrtcell := select( macroPlan, MaterialRackTotalRow.MaterialRackTotalCell, tempMRTCell,
                           tempMRTCell.MaterialRackTotalRow().Generation() = dlerr.Generation()        and
                           tempMRTCell.MaterialRackTotalRow().MLB_MQB()    = dlerr.MLB_MQB()           and
                           tempMRTCell.MaterialRackColumn().Month()        = dlerc.StartDate().Month() );
        cell.TotalQuantityOfMaterialRacks( mrtcell.Quantity() );
        // 大连外租库空料架数量:【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
@@ -59,7 +72,7 @@
                                 tempPISPIP.PlannedInventoryLevelEnd() );
        cell.PackagingCapacity( guard( lce.PackagingCapacity(), 1 ) );
        cell.PlannedInventory( plannedInventory );
        cell.NumberOfEmptyShelves( [Number] ( cell.TotalQuantityOfMaterialRacks() - guard( cell.PlannedInventory() / cell.PackagingCapacity(), 0 ) ) );
        cell.NumberOfEmptyShelves( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - guard( cell.PlannedInventory() / cell.PackagingCapacity(), 0 ) - guard( mrcc.Quantity(), 0 ) ) * guard( mrpc.Quantity(), 1 ), 0 ) );
        
        // CC外租库入库费用:发动机销量 / 包装容量(向上取整)* 料架入库单价
        transportationQuantity1 := sum( macroPlan, SalesDemand.astype( Forecast ), tempF, 
@@ -118,6 +131,7 @@
        // DL外租库运输费用:发动机运输量 / 包装容量 / 装载容量(向上取整)* 料架运输单价
        cell.DLExternalRentalWarehouseTransportationCosts( [Number] ( guard( inventoryQuantity / 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
@@ -128,7 +142,7 @@
                                  tempPISPIP.Start().Date()                                                                              >= dlerc.StartDate()        and 
                                  tempPISPIP.End().Date()                                                                                <= lastDayOfThisMonth,
                                  tempPISPIP.PlannedInventoryLevelEnd() );
        cell.DLRentalWarehouseStorageFees( [Number] ( guard( ( cell.TotalQuantityOfMaterialRacks() - plannedInventory1 ) / lce.PackagingCapacity(), 0 ) * guard( lcmr.StoragePrice(), 1 ) ) );
        cell.DLRentalWarehouseStorageFees( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - guard( plannedInventory1  / lce.PackagingCapacity(), 0 ) - guard( mrcc.Quantity(), 0 ) ) * guard( mrpc.Quantity(), 1 ) * guard( lcmr.StoragePrice(), 1 ), 0 ) );
        
        // CC外租库清洗费用:发动机入库量 / 包装容量 * 料架清洗单价。发动机入库量取发动机销量,包装容量取自发动机成本表。料架清洗单价取料架成本表。
        clearnQuantity := sum( macroPlan, SalesDemand.astype( Forecast ), tempF,