lihongji
2024-10-18 b3b09d31287fc40eecc28d78575ba0bd1d8b03ea
包装计划优化
已修改2个文件
83 ■■■■■ 文件已修改
_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/Sys/Repr/Global/PackagingPlanCell.qrp 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl
@@ -36,43 +36,39 @@
        
        // 运输成本参数
        lct  := select( macroPlan, LogisticsCostTransport, tempLCT, 
                        tempLCT.Product()     = mlcrr.Category()                                      and
                        tempLCT.Origin()      = mlcrr.Factory() + " " + mlcrr.Category() + "外租库"   and
                        tempLCT.Destination() = mlcrr.Factory() + " " + mlcrr.Category() + "线边库" );
        lct1 := select( macroPlan, LogisticsCostTransport, tempLCT,
                        tempLCT.Product()     = mlcrr.Category()                                                   and
                        tempLCT.Origin()      = ifexpr( mlcrr.Factory() = "大连工厂", "大连厂内库", "CC 厂内库" ) and
                        tempLCT.Destination() = ifexpr( mlcrr.Factory() = "大连工厂", "大连外租库", "长春外租库" ) );
         // 当前月末最后一天日期
        lastDayOfThisMonth := mlcrc.StartDate().StartOfNextMonth() - 1;
                        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,
        packageQuantity := sum( macroPlan, PackagingPlanRow.PackagingPlanCell, tempPPC,
                                tempPPC.PackagingPlanRow().Category()             = mlcrr.Category()          and
                                tempPPC.PackagingPlanRow().Factory()              = mlcrr.Factory()           and
                                tempPPC.PackagingPlanColumn().StartDate().Year()  = mlcrc.StartDate().Year()  and
                                tempPPC.PackagingPlanColumn().StartDate().Month() = mlcrc.StartDate().Month(),
                                tempPPC.Package() );
        cell.PackingCharges( packageQuantity * guard( lcm.PackagePrice(), 1 ) );
        // 设置拆包费用(拆包量 * 拆包单价)
        unpackingQuantity := sum( macroPlan, PackagingPlanRow.PackagingPlanCell, tempPPC,
        unpackingQuantity := sum( macroPlan, PackagingPlanRow.PackagingPlanCell, tempPPC,
                                  tempPPC.PackagingPlanRow().Category()             = mlcrr.Category()          and
                                  tempPPC.PackagingPlanRow().Factory()              = mlcrr.Factory()           and
                                  tempPPC.PackagingPlanColumn().StartDate().Year()  = mlcrc.StartDate().Year()  and
                                  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
@@ -80,25 +76,35 @@
                                 guard( tempTPC.TransferPlanColumn().ColumnDate().Year()   = mlcrc.StartDate().Year(), false )                              and
                                 guard(  tempTPC.TransferPlanColumn().ColumnDate().Month() = mlcrc.StartDate().Month(), false ),
                                 [Number]tempTPC.Value() );
        cell.TransferCost( transferQuantity / guard( lcm.PackagingCapacity(), 1 ) / guard( lct.LoadingCapacity(), 1 ) * guard( lct.TransportPrice(), 1 ) );
        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
                                       tempPIT.Trip().Departure().Date()                                                >= mlcrc.StartDate()  and
                                       tempPIT.Trip().Arrival().Date()                                                  <= lastDayOfThisMonth and
                                       tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID()      = "CC 厂内库"         and
                                       tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID() = "长春外租库",
        transportationQuantity := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT,
                                       tempPIT.Product_MP().ParentID()                                                  =  mlcrr.Category()                                                                       and
                                       tempPIT.Trip().Departure().Date()                                                >= mlcrc.StartDate()                                                                      and
                                       tempPIT.Trip().Arrival().Date()                                                  <= lastDayOfThisMonth                                                                     and
                                       tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID()      =  ifexpr( mlcrr.Factory() = "大连工厂", "DL", "CC" ) + " " + mlcrr.Category() + "线边库" and
                                       tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID() =  ifexpr( mlcrr.Factory() = "大连工厂", "DL", "CC" ) + " " + mlcrr.Category() + "外租库",
                                       tempPIT.Quantity()
                                      );
        cell.ExternalRentalWarehouseTransportationCosts( transportationQuantity / guard( lcm.PackagingCapacity(), 1 ) / guard( lct1.LoadingCapacity(), 1 ) * guard( lct1.TransportPrice(), 1 ) );
        transportationQuantity := transportationQuantity +
                                  sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT,
                                       tempPIT.Product_MP().ParentID()                                                  =  mlcrr.Category()                                                                       and
                                       tempPIT.Trip().Departure().Date()                                                >= mlcrc.StartDate()                                                                      and
                                       tempPIT.Trip().Arrival().Date()                                                  <= lastDayOfThisMonth                                                                     and
                                       tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID()      =  ifexpr( mlcrr.Factory() = "大连工厂", "DL", "CC" ) + " " + mlcrr.Category() + "外租库" and
                                       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
@@ -106,9 +112,20 @@
                                 tempPISPIP.ProductInStockingPoint_MP().Product_MP().ParentID()                                         =  mlcrr.Category()   and
                                 tempPISPIP.Start().Date()                                                                              >= mlcrc.StartDate()  and
                                 tempPISPIP.End().Date()                                                                                <= lastDayOfThisMonth and
                                 tempPISPIP.ProductInStockingPoint_MP().StockingPointID()                                               =  ifexpr( mlcrr.Factory() = "大连工厂", "大连外租库", "长春外租库" ),
                                 tempPISPIP.ProductInStockingPoint_MP().StockingPointID()                                               =  ifexpr( mlcrr.Factory() = "大连工厂", "DL", "CC" ) + " " + mlcrr.Category() + "外租库",
                                 tempPISPIP.PlannedInventoryLevelEnd() );
        cell.RentalWarehouseStorageFees( plannedInventory / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.StoragePrice(), 1 ) );
        // 预计总费用
        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() );
        
        cell.MachineLogisticsCostReportColumn( relset, mlcrc );
      }
_Main/Sys/Repr/Global/PackagingPlanCell.qrp
@@ -30,7 +30,7 @@
  AttributeRepresentation PackagingInventory
  {
    AttributeKey: '[413988.0.1393320143]'
    Synonym: 'Packaged'
    Synonym: 'Packaged inventory'
  }
  AttributeRepresentation TransferIn
  {
@@ -40,7 +40,7 @@
  AttributeRepresentation UnpackagedInventory
  {
    AttributeKey: '[413988.0.1393320130]'
    Synonym: 'Unpackaged'
    Synonym: 'Unpackaged inventory'
  }
  AttributeRepresentation Unpacking
  {