admin
2024-10-23 531bf2d5dc98162aa050d03cba99a71c7ffb47d5
_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
@@ -34,7 +34,7 @@
                        and tempLCE.StartDate() <= dlerc.StartDate() and tempLCE.EndDate() >= dlerc.StartDate().StartOfNextMonth() );
                        
        // 料架成本参数
        lcmr := select( macroPlan, LogisticsCostMaterialRack, tempLCMR, tempLCMR.Factory() = "大连工厂"
        lcmr := select( macroPlan, LogisticsCostMaterialRack, tempLCMR, tempLCMR.Factory() = "长春工厂"
                        and tempLCMR.StartDate() <= dlerc.StartDate() and tempLCMR.EndDate() >= dlerc.StartDate().StartOfNextMonth() );
                        
        // 运输成本参数
@@ -95,11 +95,11 @@
        
        // DL外租库入库费用:发动机入库量 / 包装容量(向上取整)* 料架入库单价
        inventoryQuantity := 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.Product_MP().Generation()         =  dlerr.Generation()       and
                                  tempF.Product_MP().MQBMLB()             =  dlerr.MLB_MQB()          and
                                  tempF.StockingPointID()                 =  "大连外租库"             and
                                  ( tempF.StartDate() - 2 ).Year()        = dlerc.StartDate().Year()  and
                                  ( tempF.StartDate() - 2 ).Month()       = dlerc.StartDate().Month(),
                                  tempF.FulfilledQuantity() );
    //                   info( "时间:", dlerc.StartDate().Format( "Y-M2-D2" ), "    入库数量:", inventoryQuantity, "    包装容量:", guard( lce.PackagingCapacity(), 0 ),
    //                         "    装载容量:", guard( lct1.LoadingCapacity(), 0 ) ); // 测试输出
@@ -109,7 +109,7 @@
        outboundQuantity := 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.ProductInStockingPoint_MP().StockingPointID()         = "大连场内库"        and
                                 tempPISPIPPL.Start().Date()                                        >= dlerc.StartDate()  and
                                 tempPISPIPPL.End().Date()                                          <= lastDayOfThisMonth,
                                 tempPISPIPPL.NewSupplyQuantity() );
@@ -130,14 +130,22 @@
                                  tempPISPIP.PlannedInventoryLevelEnd() );
        cell.DLRentalWarehouseStorageFees( [Number] ( guard( ( cell.TotalQuantityOfMaterialRacks() - plannedInventory1 ) / lce.PackagingCapacity(), 0 ) * guard( lcmr.StoragePrice(), 1 ) ) );
        
        //清洗费用:发动机入库量 / 包装容量 * 料架清洗单价。发动机入库量取发动机销量,包装容量取自发动机成本表。料架清洗单价取料架成本表。
        cell.CleaningCost( [Number] ( guard( inventoryQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmr.CleanPrice(), 1 ) ) );
        // DL外租库清洗费用:发动机入库量 / 包装容量 * 料架清洗单价。发动机入库量取发动机销量,包装容量取自发动机成本表。料架清洗单价取料架成本表。
        cell.CleaningCost( [Number] ( guard( outboundQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmr.CleanPrice(), 1 ) ) );
        
        // 预计总费用
        cell.EstimatedTotalCost( cell.CCStorageFeesForRentedWarehouses() + cell.CCOutboundExpensesForRentedWarehouses() + cell.CCRentalWarehouseStorageFees() + cell.CCLineHaulCost() + 
                                 cell.CCShortDistanceTransportationCosts() + cell.DLStorageFeesForRentedWarehouses() + cell.DLOutboundExpensesForRentedWarehouses() +
                                 cell.DLExternalRentalWarehouseTransportationCosts() + cell.DLRentalWarehouseStorageFees() + cell.CleaningCost() );
        
        // 大连外租库料架费用
        cell.DLRentalWarehouseMaterialRackCost( cell.DLStorageFeesForRentedWarehouses() + cell.DLOutboundExpensesForRentedWarehouses() +
                                                cell.DLExternalRentalWarehouseTransportationCosts() );
        // CC外租库DL料架费用
        cell.CCExternalRentalWarehouseDLMaterialRackCost( cell.CCStorageFeesForRentedWarehouses() + cell.CCOutboundExpensesForRentedWarehouses() +
                                                          cell.CCRentalWarehouseStorageFees() + cell.CCShortDistanceTransportationCosts() );
        // 系数
        cell.Coefficient( 1.05 );