lihongji
2024-10-18 b3b09d31287fc40eecc28d78575ba0bd1d8b03ea
包装计划优化
已修改2个文件
43 ■■■■■ 文件已修改
_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/Sys/Repr/Global/PackagingPlanCell.qrp 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl
@@ -37,12 +37,8 @@
        // 运输成本参数
        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() = "大连工厂", "大连外租库", "长春外租库" ) );
                        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; 
@@ -80,7 +76,7 @@
                                 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 ) );
@@ -93,11 +89,21 @@
                                       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() = "长春外租库",
                                       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,
@@ -106,10 +112,21 @@
                                 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
  {