lihongji
2024-11-02 6f15693d25602dda1f6765994c37c4c05ac23442
_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl
@@ -39,12 +39,12 @@
                        tempLCT.Product()     = mlcrr.Category()                                                                                                                         and
                        tempLCT.Origin()      = ifexpr( mlcrr.Category() = "AGW", "DL AGW", ifexpr( mlcrr.Factory() = "大连工厂", "DL", "CC" ) + " " + mlcrr.Category() + "外租库" )     and
                        tempLCT.Destination() = ifexpr( mlcrr.Category() = "AGW", "CC AGW库房", ifexpr( mlcrr.Factory() = "大连工厂", "DL", "CC" ) + " " + mlcrr.Category() + "线边库" ) );
         // 当前月末最后一天日期
        lastDayOfThisMonth := mlcrc.StartDate().StartOfNextMonth() - 1;
        cell := mlcrr.MachineLogisticsCostReportCell( relnew );
        // 设置包装费用(包装量 * 包装单价)
        packageQuantity := sum( macroPlan, PackagingPlanRow.PackagingPlanCell, tempPPC,
                                tempPPC.PackagingPlanRow().Category()             = mlcrr.Category()          and
@@ -53,7 +53,7 @@
                                tempPPC.PackagingPlanColumn().StartDate().Month() = mlcrc.StartDate().Month(),
                                tempPPC.Package() );
        cell.PackingCharges( packageQuantity * guard( lcm.PackagePrice(), 1 ) );
        // 设置拆包费用(拆包量 * 拆包单价)
        unpackingQuantity := sum( macroPlan, PackagingPlanRow.PackagingPlanCell, tempPPC,
                                  tempPPC.PackagingPlanRow().Category()             = mlcrr.Category()          and
@@ -62,13 +62,13 @@
                                  tempPPC.PackagingPlanColumn().StartDate().Month() = mlcrc.StartDate().Month(),
                                  tempPPC.Unpacking() );
        cell.UnpackingCost( unpackingQuantity * guard( lcm.UnpackingPrice(), 1 ) );
        // 设置缓冲纸费用(包装类 * 缓冲纸单价)
        cell.BufferPaperCost( packageQuantity * guard( lcm.BufferPaperPrice(), 1 ) );
          // 设置木箱单价
        cell.WoodenCratePriceReal( guard( lcm.WoodenCratePrice(), 1 ) );
        // 设置调拨费用(调拨数量 / 包装容量 / 装载容量 * 运输单价)
        transferQuantity := sum( macroPlan, TransferPlanRow.TransferPlanCell, tempTPC,
                                 tempTPC.TransferPlanRow().Category()                      = mlcrr.Category()                                               and
@@ -77,13 +77,13 @@
                                 guard(  tempTPC.TransferPlanColumn().ColumnDate().Month() = mlcrc.StartDate().Month(), false ),
                                 [Number]tempTPC.Value() );
        cell.TransferCost( [Number] ( [Number] ( transferQuantity / guard( lcm.PackagingCapacity(), 1 ) ) / guard( lct.LoadingCapacity(), 1 ) ) * guard( lct.TransportPrice(), 1 ) );
        // 外租库入库费用(入库量[包装量] / 包装容量 * 入库单价)
        cell.StorageFeesForRentedWarehouses( packageQuantity / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.WarehousingPrice(), 1 ) );
        // 外租库出库费用(出库量[拆包量] / 包装容量 * 出库单价)
        cell.OutboundExpensesForRentedWarehouses( unpackingQuantity / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.OutboundPrice(), 1 ) );
        // 外租库运输费用(运输数量 / 包装容量 / 装载容量 * 运输单价)
        transportationQuantity := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT,
                                       tempPIT.Product_MP().ParentID()                                                  =  mlcrr.Category()                                                                       and
@@ -102,9 +102,8 @@
                                       tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID() =  ifexpr( mlcrr.Factory() = "大连工厂", "DL", "CC" ) + " " + mlcrr.Category() + "线边库",
                                       tempPIT.Quantity()
                                      );
        cell.ExternalRentalWarehouseTransportationCosts( transportationQuantity / guard( lcm.PackagingCapacity(), 1 ) / guard( lct.LoadingCapacity(), 1 ) * guard( lct.TransportPrice(), 1 ) );
        // 外租库仓储费用:仓储数量/包装容量*仓储单价
        plannedInventory := sum( macroPlan, Product_MP.ProductInStockingPoint_MP.ProductInStockingPointInPeriod, tempPISPIP,
                                 tempPISPIP.ProductInStockingPoint_MP().Product_MP().IsLeaf()                                                                 and
@@ -115,15 +114,25 @@
                                 tempPISPIP.ProductInStockingPoint_MP().StockingPointID()                                               =  ifexpr( mlcrr.Factory() = "大连工厂", "DL", "CC" ) + " " + mlcrr.Category() + "外租库",
                                 tempPISPIP.PlannedInventoryLevelEnd() );
        cell.RentalWarehouseStorageFees( plannedInventory / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.StoragePrice(), 1 ) );
        // 大连工厂(外租库入库费用、外租库出库费用、外租库运输费用、外租库仓储费用)为0
        if ( mlcrr.Factory() = "大连工厂" ) {
          cell.StorageFeesForRentedWarehouses( 0 );
          cell.OutboundExpensesForRentedWarehouses( 0 );
          cell.ExternalRentalWarehouseTransportationCosts( 0 );
          cell.RentalWarehouseStorageFees( 0 );
        }
        // 预计总费用
        cell.EstimatedTotalCost( cell.PackingCharges() + cell.UnpackingCost() + cell.BufferPaperCost() + cell.WoodenCrateCost() + cell.TransferCost() +
                                 cell.StorageFeesForRentedWarehouses() + cell.OutboundExpensesForRentedWarehouses() + cell.ExternalRentalWarehouseTransportationCosts() +
                                 cell.RentalWarehouseStorageFees() );
        // 系数
        cell.Coefficient( 1.05 );
        // 总费用
        cell.TotalCost( cell.EstimatedTotalCost() * cell.Coefficient() );