xiaoding721
2024-11-15 ab5176a7074144e411c00a409010422a3ee5c98a
_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl
@@ -7,6 +7,7 @@
  TextBody:
  [*
    // 甄兰鸽 Aug-12-2024 (created)
    // 甄兰鸽 Aug-12-2024 (created)
    owner.DLEngineLogisticsCostReport( relflush );
    produtparent              := DLEngineLogisticsCostReport::GetDefaultProductParent();
    name                      := DLEngineLogisticsCostReport::GetDefaultName();
@@ -45,28 +46,40 @@
                                            and pispip.Start().Date() < column.StartDate().StartOfNextMonth() 
                                            and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 ) );
                cell          := selectobject( row, Cell, cell, cell.Column() = column );
                entercost     := 0.0;
                othercost     := 0.0;
                outcost       := 0.0;
                storecost     := 0.0;
                transcost     := 0.0;
                newsupplyqty  := sum( pispips, Elements, pispip, pispip.NewSupplyQuantity() );
                plannedinvqty := sum( pispips, Elements, pispip, pispip.PlannedInventoryLevelEnd() );
                if( isdltoccrent){
                  othercost   := Real::MaxReal();
                  transset    := selectset( transcosts, Elements, trans, trans.Origin() = '长春外租库' and trans.Destination() = '客户库' );
                  column.CalcEngineCost( pispips, enginecosts, transset, ccfactory, entercost, othercost, outcost, storecost, transcost );
                  cell.CCRentQty( cell.CCRentQty() + sum( pispips, Elements, pispip, pispip.NewSupplyQuantity() ) );
                  //在发动机成本参数表找到对应的包装容量
                  enginecost  := selectobject( enginecosts, Elements, engine, engine.StartDate() <= column.StartDate()  and engine.EndDate() >= column.StartDate()
                                                     and engine.Factory() = ccfactory );
                  cell.CCRentQty( cell.CCRentQty() + newsupplyqty );
                  //长春外租库入库费用:入库量/包装容量*入库单价
                  entercost   := ceil( newsupplyqty / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
                  //长春外租库出库费用: 出库量/包装容量*出库单价
                  outcost     := ceil( newsupplyqty / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice();
                  cell.CCRentInCost( cell.CCRentInCost() + entercost );
                  cell.CCRentOutOfCost( cell.CCRentOutOfCost() + outcost );
                  cell.CCRentStorCost( cell.CCRentStorCost() + storecost );//长春外租库仓储费用
                  cell.CCShorTransCost( cell.CCShorTransCost() + transcost );//长春短途运输费用
                  cost        := ceil( plannedinvqty / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//四舍五入
                  cell.CCRentStorCost( cell.CCRentStorCost() + cost );//长春外租库仓储费用
                  transcost   := selectobject( transcosts, Elements, trans, trans.StartDate() <= column.StartDate() and trans.EndDate() >= column.StartDate() and trans.Origin() = '长春外租库' and trans.Destination() = '客户库' );
                  if( not isnull( transcost ) ){
                    cost      := ceil( ceil( newsupplyqty / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();
                    cell.CCShorTransCost( cell.CCShorTransCost() + cost );//长春短途运输费用
                  }
                } else {
                  outcost     := Real::MaxReal();
                  transset    := selectset( transcosts, Elements, trans, trans.Origin() = '大连厂内库' and trans.Destination() = '大连外租库' );
                  column.CalcEngineCost( pispips, enginecosts, transset, dlfactory, entercost, othercost, outcost, storecost, transcost );
                  cell.DLRentStorCost( cell.DLRentStorCost() + storecost );//大连外租库仓储费用
                  cell.DLRentOtherCost( cell.DLRentOtherCost() + othercost );//大连外租库其他费用
                  cell.DLRentInCost( cell.DLRentInCost() + entercost );//大连外租库入库费用
                  cell.WerkToDLRentTransCost( cell.WerkToDLRentTransCost() + transcost );//厂内到大连外租库运输费用
                  //在发动机成本参数表找到对应的包装容量
                  enginecost  := selectobject( enginecosts, Elements, engine, engine.StartDate() <= column.StartDate()  and engine.EndDate() >= column.StartDate()
                                                     and engine.Factory() = dlfactory  );
                  if( not isnull( enginecost ) ){
                    cost      := ceil( plannedinvqty / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//四舍五入
                    cell.DLRentStorCost( cell.DLRentStorCost() + cost );//大连外租库仓储费用
                    row.SetDLRentEnterCost( column, enginecost, newsupplyqty );//大连外租库入库费用
                    transcost := selectobject( transcosts, Elements, trans, trans.StartDate() <= column.StartDate() and trans.EndDate() >= column.StartDate() and trans.Origin() = '大连厂内库' and trans.Destination() = '大连外租库' );
                    if( not isnull( transcost ) ){
                      cost    := ceil( ceil( newsupplyqty / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//四舍五入
                      row.SetFactoryToRentTransCost( column, cost );
                    }
                  }
                }
              }
              products.Add( pisp.Product_MP() );