| | |
| | | fenginecost := selectobject( enginecosts, Elements, engine, engine.EndDate() > this.StartDate() and engine.EndDate() <= this.EndDate() and engine.StartDate() < this.StartDate() and engine.Factory() = factory ); |
| | | if( not isnull( fenginecost ) ){ |
| | | fpispips := selectset( pispips, Elements, pispip, pispip.Start().Date() >= fenginecost.StartDate() and pispip.Start().Date() <= fenginecost.EndDate() ); |
| | | if( entercost.IsMaxInfinity() ){ |
| | | if( not entercost.IsMaxInfinity() ){ |
| | | newsqty := sum( fpispips, Elements, e, e.NewSupplyQuantity() ); |
| | | entercost := entercost + ceil( newsqty / fenginecost.PackagingCapacity() ) * fenginecost.WarehousingPrice(); |
| | | } |
| | | if( othercost.IsMaxInfinity() ){ |
| | | if( not othercost.IsMaxInfinity() ){ |
| | | newsqty := sum( fpispips, Elements, e, e.NewSupplyQuantity() ); |
| | | othercost := othercost + ceil( newsqty / fenginecost.PackagingCapacity() ) * fenginecost.OtherPrice(); |
| | | } |
| | | if( outcost.IsMaxInfinity() ){ |
| | | if( not outcost.IsMaxInfinity() ){ |
| | | newsqty := sum( fpispips, Elements, e, e.NewSupplyQuantity() ); |
| | | outcost := outcost + ceil( newsqty / fenginecost.PackagingCapacity() ) * fenginecost.OutboundPrice(); |
| | | } |
| | | if( storecost.IsMaxInfinity() ){ |
| | | if( not storecost.IsMaxInfinity() ){ |
| | | pinvqty := sum( fpispips, Elements, e, e.PlannedInventoryLevelEnd() ); |
| | | storecost := storecost + ceil( pinvqty / fenginecost.PackagingCapacity() ) * fenginecost.StoragePrice();//四舍五入 |
| | | } |
| | | if( transcost.IsMaxInfinity() ){ |
| | | if( not transcost.IsMaxInfinity() ){ |
| | | this.CalcTransCost( fpispips, transcosts, fenginecost, transcost ); |
| | | } |
| | | } |
| | | menginecost := selectobject( enginecosts, Elements, engine, engine.StartDate() > this.StartDate() and engine.EndDate() < this.EndDate() and engine.Factory() = factory ); |
| | | if( not isnull( menginecost ) ){ |
| | | mpispips := selectset( pispips, Elements, pispip, pispip.Start().Date() >= menginecost.StartDate() and pispip.Start().Date() <= menginecost.EndDate() ); |
| | | if( entercost.IsMaxInfinity() ){ |
| | | if( not entercost.IsMaxInfinity() ){ |
| | | newsqty := sum( mpispips, Elements, e, e.NewSupplyQuantity() ); |
| | | entercost := entercost + ceil( newsqty / menginecost.PackagingCapacity() ) * menginecost.WarehousingPrice(); |
| | | } |
| | | if( othercost.IsMaxInfinity() ){ |
| | | if( not othercost.IsMaxInfinity() ){ |
| | | newsqty := sum( mpispips, Elements, e, e.NewSupplyQuantity() ); |
| | | othercost := othercost + ceil( newsqty / menginecost.PackagingCapacity() ) * menginecost.OtherPrice(); |
| | | } |
| | | if( outcost.IsMaxInfinity() ){ |
| | | if( not outcost.IsMaxInfinity() ){ |
| | | newsqty := sum( mpispips, Elements, e, e.NewSupplyQuantity() ); |
| | | outcost := outcost + ceil( newsqty / menginecost.PackagingCapacity() ) * menginecost.OutboundPrice(); |
| | | } |
| | | if( storecost.IsMaxInfinity() ){ |
| | | if( not storecost.IsMaxInfinity() ){ |
| | | pinvqty := sum( mpispips, Elements, e, e.PlannedInventoryLevelEnd() ); |
| | | storecost := storecost + ceil( pinvqty / menginecost.PackagingCapacity() ) * menginecost.StoragePrice();//四舍五入 |
| | | } |
| | | if( transcost.IsMaxInfinity() ){ |
| | | if( not transcost.IsMaxInfinity() ){ |
| | | this.CalcTransCost( mpispips, transcosts, menginecost, transcost ); |
| | | } |
| | | } |
| | | benginecost := selectobject( enginecosts, Elements, engine, engine.StartDate() > this.StartDate() and engine.StartDate() <= this.EndDate() and engine.EndDate() > this.EndDate() and engine.Factory() = factory ); |
| | | if( not isnull( benginecost ) ){ |
| | | bpispips := selectset( pispips, Elements, pispip, pispip.Start().Date() >= benginecost.StartDate() and pispip.Start().Date() <= benginecost.EndDate() ) |
| | | if( entercost.IsMaxInfinity() ){ |
| | | if( not entercost.IsMaxInfinity() ){ |
| | | newsqty := sum( bpispips, Elements, e, e.NewSupplyQuantity() ); |
| | | entercost := entercost + ceil( newsqty / benginecost.PackagingCapacity() ) * benginecost.WarehousingPrice(); |
| | | } |
| | | if( othercost.IsMaxInfinity() ){ |
| | | if( not othercost.IsMaxInfinity() ){ |
| | | newsqty := sum( bpispips, Elements, e, e.NewSupplyQuantity() ); |
| | | othercost := othercost + ceil( newsqty / benginecost.PackagingCapacity() ) * benginecost.OtherPrice(); |
| | | } |
| | | if( outcost.IsMaxInfinity() ){ |
| | | if( not outcost.IsMaxInfinity() ){ |
| | | newsqty := sum( bpispips, Elements, e, e.NewSupplyQuantity() ); |
| | | outcost := outcost + ceil( newsqty / benginecost.PackagingCapacity() ) * benginecost.OutboundPrice(); |
| | | } |
| | | if( storecost.IsMaxInfinity() ){ |
| | | if( not storecost.IsMaxInfinity() ){ |
| | | pinvqty := sum( bpispips, Elements, e, e.PlannedInventoryLevelEnd() ); |
| | | storecost := storecost + ceil( pinvqty / benginecost.PackagingCapacity() ) * benginecost.StoragePrice();//四舍五入 |
| | | } |
| | | if( transcost.IsMaxInfinity() ){ |
| | | if( not transcost.IsMaxInfinity() ){ |
| | | this.CalcTransCost( bpispips, transcosts, benginecost, transcost ); |
| | | } |
| | | } |
| | | }else{ |
| | | if( entercost.IsMaxInfinity() ){ |
| | | if( not entercost.IsMaxInfinity() ){ |
| | | newsqty := sum( pispips, Elements, pispip, pispip.NewSupplyQuantity() ); |
| | | entercost := entercost + ceil( newsqty / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice(); |
| | | } |
| | | if( othercost.IsMaxInfinity() ){ |
| | | if( not othercost.IsMaxInfinity() ){ |
| | | newsqty := sum( pispips, Elements, pispip, pispip.NewSupplyQuantity() ); |
| | | othercost := othercost + ceil( newsqty / enginecost.PackagingCapacity() ) * enginecost.OtherPrice(); |
| | | } |
| | | if( outcost.IsMaxInfinity() ){ |
| | | if( not outcost.IsMaxInfinity() ){ |
| | | newsqty := sum( pispips, Elements, pispip, pispip.NewSupplyQuantity() ); |
| | | outcost := outcost + ceil( newsqty / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice(); |
| | | } |
| | | if( storecost.IsMaxInfinity() ){ |
| | | if( not storecost.IsMaxInfinity() ){ |
| | | pinvqty := sum( pispips, Elements, pispip, pispip.PlannedInventoryLevelEnd() ); |
| | | storecost := storecost + ceil( pinvqty / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//四舍五入 |
| | | } |
| | | if( transcost.IsMaxInfinity() ){ |
| | | if( not transcost.IsMaxInfinity() ){ |
| | | this.CalcTransCost( pispips, transcosts, enginecost, transcost ); |
| | | } |
| | | } |