| | |
| | | enginecosts := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.Generation().ToLower() = product.Generation().ToLower() and engine.MLB_MQB() = product.MQBMLB() ); |
| | | transcosts := selectset( owner, LogisticsCostTransport, trans, trans.LoadingCapacity() <> 0 and exists( productparents, Elements, e, ifexpr( trans.Product().FindString( '发动机', 0 ) >= 0, e.ID() = produtparent, e.ID() = trans.Product() ) ) ); |
| | | if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){ |
| | | products.Add( pisp.Product_MP() ); |
| | | traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear |
| | | and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 ) ){ |
| | | periodtime := pispip.Start().StartOfMonth().Date(); |
| | | periodname := periodtime.Format( "M2/D2/Y" ); |
| | | column := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime ); |
| | | traverse( table, Column, column ){ |
| | | pispips := selectset( pisp, ProductInStockingPointInPeriod, pispip, pispip.Start().Date() >= column.StartDate() |
| | | and pispip.Start().Date() < column.StartDate().StartOfNextMonth() |
| | | and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 ) ); |
| | | cell := selectobject( row, Cell, cell, cell.Column() = column ); |
| | | |
| | | newsupplyqty := sum( pispips, Elements, pispip, pispip.NewSupplyQuantity() ); |
| | | plannedinvqty := sum( pispips, Elements, pispip, pispip.PlannedInventoryLevelEnd() ); |
| | | if( isdltoccrent){ |
| | | //在发动机成本参数表找到对应的包装容量 |
| | | enginecost := selectobject( enginecosts, Elements, engine, engine.StartDate() <= pispip.Start().Date() and engine.EndDate() >= pispip.Start().Date() |
| | | enginecost := selectobject( enginecosts, Elements, engine, engine.StartDate() <= column.StartDate() and engine.EndDate() >= column.StartDate() |
| | | and engine.Factory() = ccfactory ); |
| | | cell.CCRentQty( cell.CCRentQty() + pispip.NewSupplyQuantity() ); |
| | | cell.CCRentQty( cell.CCRentQty() + newsupplyqty ); |
| | | //长春外租库入库费用:入库量/包装容量*入库单价 |
| | | entercost := ceil( pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice(); |
| | | entercost := ceil( newsupplyqty / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice(); |
| | | //长春外租库出库费用: 出库量/包装容量*出库单价 |
| | | outcost := ceil( pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice(); |
| | | outcost := ceil( newsupplyqty / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice(); |
| | | cell.CCRentInCost( cell.CCRentInCost() + entercost ); |
| | | cell.CCRentOutOfCost( cell.CCRentOutOfCost() + outcost ); |
| | | cost := ceil( pispip.PlannedInventoryLevelEnd() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//四舍五入 |
| | | 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( pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice(); |
| | | cost := ceil( ceil( newsupplyqty / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice(); |
| | | cell.CCShorTransCost( cell.CCShorTransCost() + cost );//长春短途运输费用 |
| | | } |
| | | } else { |
| | | //在发动机成本参数表找到对应的包装容量 |
| | | enginecost := selectobject( enginecosts, Elements, engine, engine.StartDate() <= pispip.Start().Date() and engine.EndDate() >= pispip.Start().Date() |
| | | enginecost := selectobject( enginecosts, Elements, engine, engine.StartDate() <= column.StartDate() and engine.EndDate() >= column.StartDate() |
| | | and engine.Factory() = dlfactory ); |
| | | if( not isnull( enginecost ) ){ |
| | | cost := ceil( pispip.PlannedInventoryLevelEnd() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//四舍五入 |
| | | cost := ceil( plannedinvqty / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//四舍五入 |
| | | cell.DLRentStorCost( cell.DLRentStorCost() + cost );//大连外租库仓储费用 |
| | | row.SetDLRentEnterCost( column, enginecost, pispip.NewSupplyQuantity() );//大连外租库入库费用 |
| | | transcost := selectobject( transcosts, Elements, trans, trans.StartDate() <= pispip.Start().Date() and trans.EndDate() >= pispip.Start().Date() and trans.Origin() = '大连厂内库' and trans.Destination() = '大连外租库' ); |
| | | 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( pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//四舍五入 |
| | | cost := ceil( ceil( newsupplyqty / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//四舍五入 |
| | | row.SetFactoryToRentTransCost( column, cost ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | products.Add( pisp.Product_MP() ); |
| | | } |
| | | } |
| | | } |