| | |
| | | product := selectobject( owner, Product_MP, product, product.ID() = tprow.ProductID() ); |
| | | productparents := product.GetAllParent(); |
| | | if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//查询产品类型是发动机 |
| | | //查询对应的发动机成本 |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation() |
| | | and engine.MLB_MQB() = product.MQBMLB() |
| | | and engine.Factory() = ccunit |
| | | and exists( productparents, Elements, e, e.ID() = engine.Product() ) ); |
| | | //在运输成本参数表里找到发动机对应运输单价和装载容量 |
| | | transcost := selectobject( owner, LogisticsCostTransport, trans, trans.Origin() = dlline |
| | | and trans.Destination() = dlrent |
| | | and exists( productparents, Elements, e, e.ID() = trans.Product() ) ); |
| | | if( not isnull( enginecost ) and not isnull( transcost ) ){ |
| | | row := table.GetRow( product.ID() ); |
| | | products.Add( product ); |
| | | traverse( tprow,TransferPlanCell, tpcell ){ |
| | | periodtime := tpcell.TransferPlanColumn().ColumnDate().StartOfMonth(); |
| | | periodname := periodtime.Format( "M2/D2/Y" ); |
| | | column := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime ); |
| | | |
| | | cost := ceil( ceil( [Number]tpcell.Value() / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice(); |
| | | cell := selectobject( row, Cell, cell, cell.Column() = column ); |
| | | cell.CCLongTransCoat( cell.CCLongTransCoat() + cost ); |
| | | } |
| | | } |
| | | //起始库存点是否是大连 |
| | | originsp := selectobject( owner, StockingPoint_MP, sp, sp.ID() = tprow.SourceStockpoingPointID() ); |
| | | isdl := table.IsInUnit( originsp, dlunit ); |
| | | //目的地库存点是否是长春 |
| | | destisp := selectobject( owner, StockingPoint_MP, sp, sp.ID() = tprow.TargetStockpoingPointID() ); |
| | | iscc := table.IsInUnit( destisp, ccunit ); |
| | | if( isdl and iscc ){ |
| | | //查询对应的发动机成本 |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation() |
| | | and engine.MLB_MQB() = product.MQBMLB() |
| | | and engine.Factory() = ccunit |
| | | and exists( productparents, Elements, e, e.ID() = engine.Product() ) ); |
| | | //在运输成本参数表里找到发动机对应运输单价和装载容量 |
| | | transcost := selectobject( owner, LogisticsCostTransport, trans, trans.Origin() = dlline |
| | | and trans.Destination() = dlrent |
| | | and exists( productparents, Elements, e, e.ID() = trans.Product() ) ); |
| | | if( not isnull( enginecost ) and not isnull( transcost ) ){ |
| | | row := table.GetRow( product.ID() ); |
| | | products.Add( product ); |
| | | traverse( tprow,TransferPlanCell, tpcell ){ |
| | | periodtime := tpcell.TransferPlanColumn().ColumnDate().StartOfMonth(); |
| | | periodname := periodtime.Format( "M2/D2/Y" ); |
| | | column := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime ); |
| | | |
| | | cost := ceil( ceil( [Number]tpcell.Value() / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice(); |
| | | cell := selectobject( row, Cell, cell, cell.Column() = column ); |
| | | cell.CCLongTransCoat( cell.CCLongTransCoat() + cost ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //长春短途运输费用:客户需求数量/包装容量/装载容量*运输单价,客户需求数量取自forecast里sales segment为长春的数量汇总,再用公式计算,月度进行汇总(取客户需求数量换算成车次) |