admin
2024-10-29 58099609ea32d8644da535fcd631229a3074655c
大连料架报表优化
已修改3个文件
59 ■■■■ 文件已修改
_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_DL_EngineRackCell/StaticMethod_Import.qbl 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/Sys/Repr/Global/DL_EngineRackCell.qrp 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
@@ -34,7 +34,9 @@
                        and tempLCE.StartDate() <= dlerc.StartDate() and tempLCE.EndDate() >= dlerc.StartDate().StartOfNextMonth() );
                        
        // 料架成本参数
        lcmr := select( macroPlan, LogisticsCostMaterialRack, tempLCMR, tempLCMR.Factory() = "大连工厂"
        lcmrDL := select( macroPlan, LogisticsCostMaterialRack, tempLCMR, tempLCMR.Factory() = "大连工厂"
                        and tempLCMR.StartDate() <= dlerc.StartDate() and tempLCMR.EndDate() >= dlerc.StartDate().StartOfNextMonth() );
        lcmrCC := select( macroPlan, LogisticsCostMaterialRack, tempLCMR, tempLCMR.Factory() = "长春工厂"
                        and tempLCMR.StartDate() <= dlerc.StartDate() and tempLCMR.EndDate() >= dlerc.StartDate().StartOfNextMonth() );
                        
        // 运输成本参数
@@ -79,16 +81,18 @@
                                        tempF.Product_MP().Generation() =  dlerr.Generation()       and
                                        tempF.Product_MP().MQBMLB()     =  dlerr.MLB_MQB()          and
                                        tempF.StockingPointID()         =  "大连发动机的长春外租库" and
                                        tempF.StartDate()               >= dlerc.StartDate()        and
                                        tempF.EndDate()                 <= lastDayOfThisMonth,
                                        tempF.StartDate().Year()        = dlerc.StartDate().Year()  and
                                        tempF.StartDate().Month()       = dlerc.StartDate().Month(),
                                        tempF.FulfilledQuantity() );
        cell.CCStorageFeesForRentedWarehouses( [Number] ( guard( transportationQuantity1 / lce.PackagingCapacity(), 0 ) * lcmr.WarehousingPrice() ) );
        info( "时间:", dlerc.StartDate().Format( "Y-M2-D2" ), "    入库数量:", transportationQuantity1, "    包装容量:", guard( lce.PackagingCapacity(), 0 ),
              "    入库单价:", guard( lcmrCC.WarehousingPrice(), 0 ) ); // 测试输出
        cell.CCStorageFeesForRentedWarehouses( [Number] ( guard( transportationQuantity1 / lce.PackagingCapacity(), 0 ) * lcmrCC.WarehousingPrice() ) );
        
        // CC外租库出库费用:发动机销量 / 包装容量(向上取整)* 料架出库单价
        cell.CCOutboundExpensesForRentedWarehouses( [Number] ( guard( transportationQuantity1 / lce.PackagingCapacity(), 0 ) * lcmr.OutboundPrice() ) );
        cell.CCOutboundExpensesForRentedWarehouses( [Number] ( guard( transportationQuantity1 / lce.PackagingCapacity(), 0 ) * lcmrCC.OutboundPrice() ) );
        
        // CC外租库仓储费用:料架总数量 - 发动机库存 / 包装容量(向上取整) * 料架仓储单价
        cell.CCRentalWarehouseStorageFees( [Number] ( ( cell.TotalQuantityOfMaterialRacks() - guard( plannedInventory / lce.PackagingCapacity(), 0 ) ) * lcmr.StoragePrice() ) );
        cell.CCRentalWarehouseStorageFees( [Number] ( ( cell.TotalQuantityOfMaterialRacks() - guard( plannedInventory / lce.PackagingCapacity(), 0 ) ) * lcmrCC.StoragePrice() ) );
        
        // CC长途运输费用:调拨数量 / 包装容量 / 装载容量 * 料架运输单价
        transportationQuantity2 := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT, 
@@ -114,8 +118,8 @@
                                  tempF.StartDate()                       <= ( lastDayOfThisMonth - 2 ),
                                  tempF.FulfilledQuantity() );
    //                   info( "时间:", dlerc.StartDate().Format( "Y-M2-D2" ), "    入库数量:", inventoryQuantity, "    包装容量:", guard( lce.PackagingCapacity(), 0 ),
    //                         "    装载容量:", guard( lct1.LoadingCapacity(), 0 ) ); // 测试输出
        cell.DLStorageFeesForRentedWarehouses( [Number] ( guard( inventoryQuantity / lce.PackagingCapacity(), 0 ) * guard( lce.WarehousingPrice(), 1 ) ) );
    //                         "    入库单价:", guard( lcmr.WarehousingPrice(), 0 ) ); // 测试输出
        cell.DLStorageFeesForRentedWarehouses( [Number] ( guard( inventoryQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmrDL.WarehousingPrice(), 1 ) ) );
        
        // DL外租库出库费用:发动机出库量 / 料架容量(向上取整)* 料架出库单价
        outboundQuantity := sum( macroPlan, Product_MP.ProductInStockingPoint_MP.ProductInStockingPointInPeriodPlanning.astype( ProductInStockingPointInPeriodPlanningLeaf ), tempPISPIPPL,
@@ -126,7 +130,7 @@
                                 tempPISPIPPL.End().Date()                                          <= lastDayOfThisMonth,
                                 tempPISPIPPL.NewSupplyQuantity() );
    //    info( "数量:", outboundQuantity, "    包装融创:", guard( lce.PackagingCapacity(), 0 ), "    出库单价:", guard( lcmr.OutboundPrice(), 0 ) );
        cell.DLOutboundExpensesForRentedWarehouses( [Number] ( guard( outboundQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmr.OutboundPrice(), 1 ) ) );
        cell.DLOutboundExpensesForRentedWarehouses( [Number] ( guard( outboundQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmrDL.OutboundPrice(), 1 ) ) );
        
        // DL外租库运输费用:发动机运输量 / 包装容量 / 装载容量(向上取整)* 料架运输单价
        cell.DLExternalRentalWarehouseTransportationCosts( [Number] ( guard( inventoryQuantity / lce.PackagingCapacity() / lct2.LoadingCapacity(), 0 ) * guard( lct2.TransportPrice(), 1 ) ) );
@@ -142,7 +146,7 @@
                                  tempPISPIP.Start().Date()                                                                              >= dlerc.StartDate()        and 
                                  tempPISPIP.End().Date()                                                                                <= lastDayOfThisMonth,
                                  tempPISPIP.PlannedInventoryLevelEnd() );
        cell.DLRentalWarehouseStorageFees( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - guard( plannedInventory1  / lce.PackagingCapacity(), 0 ) - guard( mrcc.Quantity(), 0 ) ) * guard( mrpc.Quantity(), 1 ) * guard( lcmr.StoragePrice(), 1 ), 0 ) );
        cell.DLRentalWarehouseStorageFees( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - guard( plannedInventory1  / lce.PackagingCapacity(), 0 ) - guard( mrcc.Quantity(), 0 ) ) * guard( mrpc.Quantity(), 1 ) * guard( lcmrDL.StoragePrice(), 1 ), 0 ) );
        
        // CC外租库清洗费用:发动机入库量 / 包装容量 * 料架清洗单价。发动机入库量取发动机销量,包装容量取自发动机成本表。料架清洗单价取料架成本表。
        clearnQuantity := sum( macroPlan, SalesDemand.astype( Forecast ), tempF, 
@@ -153,10 +157,10 @@
                               tempF.StartDate().Month()               = dlerc.StartDate().Month(),
                               tempF.Quantity() );
    //    info( "数量:", clearnQuantity, "    包装容量:", guard( lce.PackagingCapacity(), 0 ), "    清洗单价:", guard( lcmr.CleanPrice(), 0 ) );
        cell.CCCleaningCost( [Number] ( guard( clearnQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmr.CleanPrice(), 1 ) ) );
        cell.CCCleaningCost( [Number] ( guard( clearnQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmrCC.CleanPrice(), 1 ) ) );
        
        // DL外租库清洗费用:发动机入库量 / 包装容量 * 料架清洗单价。发动机入库量取发动机销量,包装容量取自发动机成本表。料架清洗单价取料架成本表。
        cell.CleaningCost( [Number] ( guard( outboundQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmr.CleanPrice(), 1 ) ) );
        cell.CleaningCost( [Number] ( guard( outboundQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmrDL.CleanPrice(), 1 ) ) );
        
        // 预计总费用
        cell.EstimatedTotalCost( cell.CCStorageFeesForRentedWarehouses() + cell.CCOutboundExpensesForRentedWarehouses() + cell.CCRentalWarehouseStorageFees() + cell.CCLineHaulCost() + 
_Main/BL/Type_DL_EngineRackCell/StaticMethod_Import.qbl
@@ -103,6 +103,26 @@
              cell.IsTotalCost( true );
            }
            cell.TotalCost( [Real]cellValue );
          } else if ( attributeUpdateFlag = "CC外租库清洗费用"         and not isnull( cell ) ) {
            if ( not cell.IsCCCleaningCost() and cell.CCCleaningCost() <> [Real]cellValue ) {
              cell.IsCCCleaningCost( true );
            }
            cell.CCCleaningCost( [Real]cellValue );
          } else if ( attributeUpdateFlag = "DL外租库料架费用"         and not isnull( cell ) ) {
            if ( not cell.IsDLRentalWarehouseMaterialRackCost() and cell.DLRentalWarehouseMaterialRackCost() <> [Real]cellValue ) {
              cell.IsDLRentalWarehouseMaterialRackCost( true );
            }
            cell.DLRentalWarehouseMaterialRackCost( [Real]cellValue );
          } else if ( attributeUpdateFlag = "CC外租库DL料架费用"         and not isnull( cell ) ) {
            if ( not cell.IsCCExternalRentalWarehouseDLMaterialRackCost() and cell.CCExternalRentalWarehouseDLMaterialRackCost() <> [Real]cellValue ) {
              cell.IsCCExternalRentalWarehouseDLMaterialRackCost( true );
            }
            cell.CCExternalRentalWarehouseDLMaterialRackCost( [Real]cellValue );
          } else if ( attributeUpdateFlag = "两厂间料架运输费用"         and not isnull( cell ) ) {
            if ( not cell.IsCCLineHaulCost() and cell.CCLineHaulCost() <> [Real]cellValue ) {
              cell.IsCCLineHaulCost( true );
            }
            cell.CCLineHaulCost( [Real]cellValue );
          }
        }
      }
_Main/Sys/Repr/Global/DL_EngineRackCell.qrp
@@ -6,6 +6,17 @@
  {
    AttributeKey: '[415754.0.513823109]'
    Synonym: 'CC外租库清洗费用'
    Conditional:
    [
      DataRepresentation.Conditional
      {
        BackgroundColor: '$FF3399'
        ConditionBody: 'object.IsCCCleaningCost()'
        ConversionBody: ''
        DefaultBackgroundColor: false
        InheritConversion: false
      }
    ]
  }
  AttributeRepresentation CCExternalRentalWarehouseDLMaterialRackCost
  {