admin
2024-10-11 2330d95eb90e79163563fcecc50930bba9ea180f
大连料架优化
已修改3个文件
101 ■■■■■ 文件已修改
_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl 88 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormDL_EngineRackReport/Response_pHeader_bRefresh_OnClick.def 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
@@ -61,7 +61,8 @@
                                 tempPISPIP.ProductInStockingPoint_MP().StockingPointID()                                               = "长春外租库"       and
                                 tempPISPIP.ProductInStockingPoint_MP().Product_MP().Generation()                                       = ccerr.Generation() and
                                 tempPISPIP.ProductInStockingPoint_MP().Product_MP().MQBMLB()                                           = ccerr.MLB_MQB()    and
                                 tempPISPIP.Start().Date()                                                                              = lastDayOfThisMonth,
                                 tempPISPIP.Start().Date()                                                                              >= ccerc.StartDate()  and
                                 tempPISPIP.End().Date()                                                                                <= lastDayOfThisMonth,
                                 tempPISPIP.PlannedInventoryLevelEnd() );
        cell.PackagingCapacity( guard( lce.PackagingCapacity(), 1 ) );
        cell.PlannedInventory( plannedInventory );
@@ -101,16 +102,16 @@
                                       tempPIT.Quantity()
                                      );
    //    info( "时间:", ccerc.StartDate().Format( "Y-M2-D2" ), "    运输数据:", transportationQuantity, "     运输单价:", lct.TransportPrice() );
        cell.ExternalRentalWarehouseTransportationCosts( transportationQuantity / guard( lce.PackagingCapacity(), 1 ) / guard( lct.LoadingCapacity(), 1 ) * guard( lct.TransportPrice(), 1 ) );
        cell.ExternalRentalWarehouseTransportationCosts( [Number] ( transportationQuantity / guard( lce.PackagingCapacity(), 1 ) / guard( lct.LoadingCapacity(), 1 ) * guard( lct.TransportPrice(), 1 ) ) );
        sumExternalRentalWarehouseTransportationCosts := sumExternalRentalWarehouseTransportationCosts + cell.ExternalRentalWarehouseTransportationCosts();
             
        // 外租库仓储费用:料架总数量 - 发动机库存 / 包装容量(向上取整),再乘以空料架仓储单价得到空料架仓储费用。发动机库存取Actual inventories里取到长春外租库该发动机的仓储量,料架总数量需要手动维护。
        cell.UnitPriceOfEmptyShelfStorage( lcmr.StoragePrice() );
        cell.RentalWarehouseStorageFees( guard( ( cell.TotalQuantityOfMaterialRacks() - [Number]( plannedInventory / lce.PackagingCapacity() ) ) * lcmr.StoragePrice(), 0 ) );
        cell.RentalWarehouseStorageFees( [Number] ( guard( ( cell.TotalQuantityOfMaterialRacks() - [Number]( plannedInventory / lce.PackagingCapacity() ) ) * lcmr.StoragePrice(), 0 ) ) );
        sumRentalWarehouseStorageFees := sumRentalWarehouseStorageFees + cell.RentalWarehouseStorageFees();
        
        // 清洗费用:发动机入库量 / 包装容量 * 料架清洗单价。发动机入库量取发动机销量,包装容量取自发动机成本表。料架清洗单价取料架成本表。
        cell.CleaningCost( engineSales / guard( lce.PackagingCapacity(), 1 ) * lcmr.CleanPrice() );
        cell.CleaningCost( [Number] ( engineProductions / guard( lce.PackagingCapacity(), 1 ) * lcmr.CleanPrice() ) );
        sumCleaningCost := sumCleaningCost + cell.CleaningCost();
        
        // 预计总费用
@@ -123,7 +124,7 @@
        sumEstimatedTotalCost := sumEstimatedTotalCost + cell.EstimatedTotalCost();
                                
        // 系数
        cell.Coefficient( 1 );
        cell.Coefficient( 1.05 );
        
        // 总费用
        cell.TotalCost( cell.EstimatedTotalCost() * cell.Coefficient() );
_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
@@ -33,6 +33,14 @@
        lce  := select( macroPlan, LogisticsCostEngine, tempLCE, tempLCE.Generation() = dlerr.Generation() and tempLCE.MLB_MQB() = dlerr.MLB_MQB() and tempLCE.Factory() = "大连工厂" 
                        and tempLCE.StartDate() <= dlerc.StartDate() and tempLCE.EndDate() >= dlerc.StartDate().StartOfNextMonth() );
        
        // 料架成本参数
        lcmr := select( macroPlan, LogisticsCostMaterialRack, tempLCMR, tempLCMR.Factory() = "大连工厂"
                        and tempLCMR.StartDate() <= dlerc.StartDate() and tempLCMR.EndDate() >= dlerc.StartDate().StartOfNextMonth() );
        // 运输成本参数
        lct1 := select( macroPlan, LogisticsCostTransport, tempLCT, tempLCT.Product() = "发动机料架" and tempLCT.Origin() = "长春外租库" and tempLCT.Destination() = "DL 厂内库" );
        lct2 := select( macroPlan, LogisticsCostTransport, tempLCT, tempLCT.Product() = "发动机料架" and tempLCT.Origin() = "大连外租库" and tempLCT.Destination() = "DL 厂内库" );
        // 当前月末最后一天日期                
        lastDayOfThisMonth := dlerc.StartDate().StartOfNextMonth() - 1; 
        
@@ -45,14 +53,92 @@
                                 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()                                                                              = lastDayOfThisMonth,
                                 tempPISPIP.Start().Date()                                                                              >= dlerc.StartDate()  and
                                 tempPISPIP.End().Date()                                                                                <= lastDayOfThisMonth,
                                 tempPISPIP.PlannedInventoryLevelEnd() );
        cell.PackagingCapacity( guard( lce.PackagingCapacity(), 1 ) );
        cell.PlannedInventory( plannedInventory );
        
        // CC外租库入库费用:发动机销量 / 包装容量(向上取整)* 料架入库单价
        transportationQuantity1 := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT,
                                        tempPIT.Product_MP().Generation()                                                =  dlerr.Generation() and
                                        tempPIT.Product_MP().MQBMLB()                                                    =  dlerr.MLB_MQB()    and
                                        tempPIT.Trip().Departure().Date()                                                >= dlerc.StartDate()  and
                                        tempPIT.Trip().Arrival().Date()                                                  <= lastDayOfThisMonth and
                                        tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID()      = "DL 厂内库"         and
                                        tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID() = "长春外租库",
                                        tempPIT.Quantity()
                                       );
        cell.CCStorageFeesForRentedWarehouses( [Number] ( guard( transportationQuantity1 / lce.PackagingCapacity(), 0 ) * lcmr.WarehousingPrice() ) );
        
        // CC外租库出库费用:发动机销量 / 包装容量(向上取整)* 料架出库单价
        cell.CCOutboundExpensesForRentedWarehouses( [Number] ( guard( transportationQuantity1 / lce.PackagingCapacity(), 0 ) * lcmr.OutboundPrice() ) );
        // CC外租库仓储费用:料架总数量 - 发动机库存 / 包装容量(向上取整)
        cell.CCRentalWarehouseStorageFees( [Number] ( cell.TotalQuantityOfMaterialRacks() - guard( plannedInventory / lce.PackagingCapacity(), 0 ) ) );
        // CC长途运输费用:调拨数量 / 包装容量 / 装载容量 * 料架运输单价
        transportationQuantity2 := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT,
                                        tempPIT.Product_MP().Generation()                                                =  dlerr.Generation() and
                                        tempPIT.Product_MP().MQBMLB()                                                    =  dlerr.MLB_MQB()    and
                                        tempPIT.Trip().Departure().Date()                                                >= dlerc.StartDate()  and
                                        tempPIT.Trip().Arrival().Date()                                                  <= lastDayOfThisMonth and
                                        tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID()      = "长春外租库"        and
                                        tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID() = "DL 厂内库",
                                        tempPIT.Quantity()
                                       );
        cell.CCLineHaulCost( [Number] ( guard( transportationQuantity2 / lce.PackagingCapacity() / lct1.LoadingCapacity(), 0 ) * guard( lct1.TransportPrice(), 1 ) ) );
        // CC短途运输费用:CC客户到CC外租库
        // DL外租库入库费用:发动机入库量 / 包装容量(向上取整)* 料架入库单价
        engineProductions := sum( macroPlan, FPImportData, tempFPID,
                                  tempFPID.Unit()              = FinancialProductionReport::GetDefaultDLUnit() and
                                  tempFPID.Generation()        = dlerr.Generation()                            and
                                  tempFPID.MqbMlb()            = dlerr.MLB_MQB()                               and
                                  tempFPID.StartDate().Year()  = dlerc.StartDate().Year()                      and
                                  tempFPID.StartDate().Month() = dlerc.StartDate().Month(),
                                  tempFPID.Quantity() );
        cell.DLStorageFeesForRentedWarehouses( [Number] ( guard( ( engineProductions - transportationQuantity1 ) / lce.PackagingCapacity(), 0 ) * guard( lcmr.WarehousingPrice(), 1 ) ) );
        // DL外租库出库费用:发动机出库量 / 料架容量(向上取整)* 料架出库单价
        engineSales := sum( macroPlan, FSImportData, tempFSID,
                            tempFSID.Unit()              = FinancialProductionReport::GetDefaultCCUnit() and
                            tempFSID.Generation()        = dlerr.Generation()                            and
                            tempFSID.MqbMlb()            = dlerr.MLB_MQB()                               and
                            tempFSID.StartDate().Year()  = dlerc.StartDate().Year()                      and
                            tempFSID.StartDate().Month() = dlerc.StartDate().Month(),
                            tempFSID.Quantity() );
        cell.DLOutboundExpensesForRentedWarehouses( [Number] ( guard( ( engineSales - transportationQuantity1 ) / lce.PackagingCapacity(), 0 ) * guard( lcmr.OutboundPrice(), 1 ) ) );
        // DL外租库运输费用:发动机运输量 / 包装容量 / 装载容量(向上取整)* 料架运输单价
        transportationQuantity3 := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT,
                                        tempPIT.Product_MP().Generation()                                                =  dlerr.Generation() and
                                        tempPIT.Product_MP().MQBMLB()                                                    =  dlerr.MLB_MQB()    and
                                        tempPIT.Trip().Departure().Date()                                                >= dlerc.StartDate()  and
                                        tempPIT.Trip().Arrival().Date()                                                  <= lastDayOfThisMonth and
                                        tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID()      = "大连外租库"        and
                                        tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID() = "DL 厂内库",
                                        tempPIT.Quantity()
                                       );
        cell.DLExternalRentalWarehouseTransportationCosts( [Number] ( guard( transportationQuantity3 / lce.PackagingCapacity() / lct2.LoadingCapacity(), 0 ) * guard( lct2.TransportPrice(), 1 ) ) );
        // DL外租库仓储费用:料架总数量 - 发动机库存 / 包装容量(向上取整)* 空料架仓储单价
        cell.DLRentalWarehouseStorageFees( [Number] ( guard( ( cell.TotalQuantityOfMaterialRacks() - plannedInventory ) / lce.PackagingCapacity(), 0 ) * guard( lcmr.StoragePrice(), 1 ) ) );
        //清洗费用:发动机入库量 / 包装容量 * 料架清洗单价。发动机入库量取发动机销量,包装容量取自发动机成本表。料架清洗单价取料架成本表。
        cell.CleaningCost( [Number] ( guard( engineSales / 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.Coefficient( 1.05 );
        // 总费用
        cell.TotalCost( cell.EstimatedTotalCost() * cell.Coefficient() );
        
        cell.DL_EngineRackColumn( relset, dlerc );
      }
_Main/UI/MacroPlannerWebApp/Component_FormDL_EngineRackReport/Response_pHeader_bRefresh_OnClick.def
@@ -14,6 +14,8 @@
    Body:
    [*
      DL_EngineRackCell::CreateData( MacroPlan );
      WebMessageBox::Success( Translations::A_VWED_Success() );
    *]
    GroupServerCalls: false
  }