| | |
| | | traverse( owner, FinancialProductionSource, source, not source.IsImport() ){//财务产量报表非导入 |
| | | traverse( source, FinancialProductionReport, report, not report.IsShow() ){//财务产量报表不显示 |
| | | traverse( report, FinancialProductionRow, row, row.Unit() = ccunit and exists( row, FinancialProductionCell, cell, cell.Value() <> '0' ) ){//财务产量报表里的长春产量, 不为0 |
| | | ccrow := table.GetRow( row.Name() ); |
| | | product := row.Product_MP(); |
| | | productparents := product.GetAllParent(); |
| | | if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//查询产品类型是发动机 |
| | | //查询对应的发动机成本 |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation() |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() |
| | | and engine.MLB_MQB() = product.MQBMLB() |
| | | and engine.Factory() = ccunit ); |
| | | if( not isnull( enginecost ) ){ |
| | | ccrow := table.GetRow( row.Name() ); |
| | | products.Add( product ); |
| | | traverse( row, FinancialProductionCell, cell, cell.Value() <> '0' ){ |
| | | //入库量/包装容量*入库单价,入库量等于长春产量 |
| | |
| | | traverse( owner, FinancialSalesSource, source, not source.IsImport() ){//财务销量报表非导入 |
| | | traverse( source, FinancialSalesReport, report, not report.IsShow() ){//财务销量报表不显示 |
| | | traverse( report, FinancialSalesRow, row, row.Unit() = ccunit and exists( row, FinancialSalesCell, cell, cell.Value() <> '0' ) ){//财务销量报表里的长春产量, 不为0 |
| | | ccrow := table.GetRow( row.Name() ); |
| | | product := row.Product_MP(); |
| | | productparents := product.GetAllParent(); |
| | | if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//查询产品类型是发动机 |
| | | //查询对应的发动机成本 |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation() |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() |
| | | and engine.MLB_MQB() = product.MQBMLB() |
| | | and engine.Factory() = ccunit ); |
| | | if( not isnull( enginecost ) ){ |
| | | ccrow := table.GetRow( row.Name() ); |
| | | products.Add( product ); |
| | | traverse( row, FinancialSalesCell, cell, cell.Value() <> '0' ){ |
| | | //出库量/包装容量*出库单价,入库量等于长春销量 |
| | |
| | | periodname := periodtime.Format( "M2/D2/Y" ); |
| | | |
| | | column := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime ); |
| | | traverse( trip, ProductInTrip, pit, pit.Quantity() = 0 ){ |
| | | row := table.GetRow( pit.ProductID() ); |
| | | traverse( trip, ProductInTrip, pit, pit.Quantity() <> 0 ){ |
| | | product := pit.Product_MP(); |
| | | productparents := product.GetAllParent(); |
| | | if( exists( productparents, Elements, e, e.ID() = produtparent ) ){////查询产品类型是发动机 |
| | | //在发动机成本参数表找到对应的包装容量 |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation() |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() |
| | | and engine.MLB_MQB() = product.MQBMLB() |
| | | and engine.Factory() = ccunit ); |
| | | //在运输成本参数表里找到发动机对应运输单价和装载容量 |
| | | transcost := selectobject( owner, LogisticsCostTransport, trans, trans.Origin() = ccline |
| | | and trans.Destination() = ccrent |
| | | and exists( productparents, Elements, e, e.ID() = trans.Product() ) ); |
| | | and exists( productparents, Elements, e, ifexpr( trans.Product().FindString( '发动机', 0 ) >= 0, e.ID() = produtparent, e.ID() = trans.Product() ) ) ); |
| | | if( not isnull( enginecost ) and not isnull( transcost ) ){ |
| | | row := table.GetRow( pit.ProductID() ); |
| | | products.Add( product ); |
| | | //运输数量/包装容量/装载容量*运输单价 |
| | | quantity := ceil( ceil( [Number]pit.Quantity() / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//四舍五入 |
| | |
| | | //是否属于长春外租库 |
| | | isccrent := table.IsInUnit( stockingpoint, ccrent ); |
| | | if( isccrent ){ |
| | | traverse( stockingpoint, ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf() ){ |
| | | traverse( stockingpoint, ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf() |
| | | and exists( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear and pispip.NewSupplyQuantity() <> 0 ) ){ |
| | | //获取行 |
| | | product := pisp.Product_MP(); |
| | | productparents := product.GetAllParent(); |
| | | row := table.GetRow( pisp.ProductID() ); |
| | | if( exists( productparents, Elements, e, e.ID() = produtparent ) ){////查询产品类型是发动机 |
| | | //查询对应的发动机成本 |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation() |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() |
| | | and engine.MLB_MQB() = product.MQBMLB() |
| | | and engine.Factory() = ccunit ); |
| | | if( not isnull( enginecost ) ){ |
| | | row := table.GetRow( pisp.ProductID() ); |
| | | products.Add( product ); |
| | | //当product planning的日期区间在需要的日期区间内 |
| | | traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear |
| | | ){ |
| | | traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear and pispip.NewSupplyQuantity() <> 0 ){ |
| | | periodtime := pispip.Start().StartOfMonth().Date(); |
| | | periodname := periodtime.Format( "M2/D2/Y" ); |
| | | quantity := ceil( [Number]pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//四舍五入 |
| | |
| | | periodname := periodtime.Format( "M2/D2/Y" ); |
| | | |
| | | column := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime ); |
| | | traverse( trip, ProductInTrip, pit, pit.Quantity() = 0 and exists( pit.Product_MP().GetAllParent(), Elements, e, e.ID() = produtparent ) ){//查询产品类型是发动机 |
| | | traverse( trip, ProductInTrip, pit, pit.Quantity() <> 0 and not isnull( column ) and exists( pit.Product_MP().GetAllParent(), Elements, e, e.ID() = produtparent ) ){//查询产品类型是发动机 |
| | | quantity := [Number]pit.Quantity(); |
| | | row := table.GetRow( pit.ProductID() ); |
| | | product := pit.Product_MP(); |
| | | productparents := product.GetAllParent(); |
| | | if( isccrent ){//目的地是长春外租库 |
| | | //在发动机成本参数表找到对应的包装容量 |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation() |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() |
| | | and engine.MLB_MQB() = product.MQBMLB() |
| | | and engine.Factory() = ccunit |
| | | and exists( productparents, Elements, e, e.ID() = engine.Product() ) ); |
| | | and engine.Factory() = ccunit ); |
| | | if( not isnull( enginecost ) ){ |
| | | products.Add( product ); |
| | | cell := selectobject( row, Cell, cell, cell.Column() = column ); |
| | |
| | | } |
| | | if( isdlrent ){//目的地是大连外租库 |
| | | //在发动机成本参数表找到对应的包装容量 |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation() |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() |
| | | and engine.MLB_MQB() = product.MQBMLB() |
| | | and engine.Factory() = dlunit |
| | | and exists( productparents, Elements, e, e.ID() = engine.Product() ) ); |
| | | and engine.Factory() = dlunit ); |
| | | //在运输成本参数表里找到发动机对应运输单价和装载容量 |
| | | transcost := selectobject( owner, LogisticsCostTransport, trans, trans.Origin() = dlline |
| | | and trans.Destination() = dlrent |
| | | and exists( productparents, Elements, e, e.ID() = trans.Product() ) ); |
| | | transcost := selectobject( owner, LogisticsCostTransport, trans, trans.Origin() = laneleg.OriginStockingPointID() |
| | | and trans.Destination() = laneleg.DestinationStockingPointID() |
| | | and exists( productparents, Elements, e, ifexpr( trans.Product().FindString( '发动机', 0 ) >= 0, e.ID() = produtparent, e.ID() = trans.Product() ) ) ); |
| | | if( not isnull( enginecost ) and not isnull( transcost ) ){ |
| | | products.Add( product ); |
| | | cell := selectobject( row, Cell, cell, cell.Column() = column ); |
| | |
| | | traverse( owner, FinancialProductionSource, source, not source.IsImport() ){//财务产量报表非导入 |
| | | traverse( source, FinancialProductionReport, report, not report.IsShow() ){//财务产量报表不显示 |
| | | traverse( report, FinancialProductionRow, row, row.Unit() = dlunit and exists( row, FinancialProductionCell, cell, cell.Value() <> '0' ) ){//财务产量报表里的大连产量, 不为0 |
| | | ccrow := table.GetRow( row.Name() ); |
| | | product := row.Product_MP(); |
| | | products.Add( product ); |
| | | productparents := product.GetAllParent(); |
| | | if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//查询产品类型是发动机 |
| | | //查询对应的发动机成本 |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation() |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() |
| | | and engine.MLB_MQB() = product.MQBMLB() |
| | | and engine.Factory() = dlunit |
| | | and exists( productparents, Elements, e, e.ID() = engine.Product() ) ); |
| | | and engine.Factory() = dlunit ); |
| | | if( not isnull( enginecost ) ){ |
| | | ccrow := table.GetRow( row.Name() ); |
| | | traverse( row, FinancialProductionCell, cell, cell.Value() <> '0' ){ |
| | | column := selectobject( table, Column, column, column.Name() = cell.FinancialProductionColumn().Name() ); |
| | | //大连外租库入库费用 |
| | |
| | | traverse( owner, FinancialSalesSource, source, not source.IsImport() ){//财务销量报表非导入 |
| | | traverse( source, FinancialSalesReport, report, not report.IsShow() ){//财务销量报表不显示 |
| | | traverse( report, FinancialSalesRow, row, row.Unit() = ccunit and exists( row, FinancialSalesCell, cell, cell.Value() <> '0' ) ){//财务销量报表里的大连产量, 不为0 |
| | | ccrow := table.GetRow( row.Name() ); |
| | | product := row.Product_MP(); |
| | | productparents := product.GetAllParent(); |
| | | if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//查询产品类型是发动机 |
| | | products.Add( product ); |
| | | //查询对应的发动机成本 |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation() |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() |
| | | and engine.MLB_MQB() = product.MQBMLB() |
| | | and engine.Factory() = dlunit |
| | | and exists( productparents, Elements, e, e.ID() = engine.Product() ) ); |
| | | and engine.Factory() = dlunit ); |
| | | if( not isnull( enginecost ) ){ |
| | | ccrow := table.GetRow( row.Name() ); |
| | | traverse( row, FinancialSalesCell, cell, cell.Value() <> '0' ){ |
| | | column := selectobject( table, Column, column, column.Name() = cell.FinancialSalesColumn().Name() ); |
| | | //大连外租库出库费用 |
| | |
| | | iscc := table.IsInUnit( destisp, ccunit ); |
| | | if( isdl and iscc ){ |
| | | //查询对应的发动机成本 |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation() |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() |
| | | and engine.MLB_MQB() = product.MQBMLB() |
| | | and engine.Factory() = ccunit |
| | | and exists( productparents, Elements, e, e.ID() = engine.Product() ) ); |
| | | and engine.Factory() = ccunit ); |
| | | //在运输成本参数表里找到发动机对应运输单价和装载容量 |
| | | transcost := selectobject( owner, LogisticsCostTransport, trans, trans.Origin() = dlline |
| | | and trans.Destination() = dlrent |
| | | and exists( productparents, Elements, e, e.ID() = trans.Product() ) ); |
| | | transcost := selectobject( owner, LogisticsCostTransport, trans, trans.Origin() = tprow.SourceStockpoingPointID() |
| | | and trans.Destination() = tprow.TargetStockpoingPointID() |
| | | and exists( productparents, Elements, e, ifexpr( trans.Product().FindString( '发动机', 0 ) >= 0, e.ID() = produtparent, e.ID() = trans.Product() ) ) ); |
| | | if( not isnull( enginecost ) and not isnull( transcost ) ){ |
| | | row := table.GetRow( product.ID() ); |
| | | products.Add( product ); |
| | | traverse( tprow,TransferPlanCell, tpcell, tpcell.TransferPlanColumn().ColumnDate() <> Date::MinDate() ){ |
| | | traverse( tprow,TransferPlanCell, tpcell, tpcell.TransferPlanColumn().ColumnDate() <> Date::MinDate() and [Number]tpcell.Value() > 0){ |
| | | periodtime := tpcell.TransferPlanColumn().ColumnDate().StartOfMonth(); |
| | | periodname := periodtime.Format( "M2/D2/Y" ); |
| | | column := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime ); |
| | |
| | | } |
| | | } |
| | | //长春短途运输费用:客户需求数量/包装容量/装载容量*运输单价,客户需求数量取自forecast里sales segment为长春的数量汇总,再用公式计算,月度进行汇总(取客户需求数量换算成车次) |
| | | traverse( owner, SalesDemand.astype( Forecast ), forecast, not isnull( forecast.SalesSegment_MP() ) and forecast.StartDate() < startofnextyear ){ |
| | | traverse( owner, SalesDemand.astype( Forecast ), forecast, forecast.Quantity() > 0 and not isnull( forecast.SalesSegment_MP() ) and forecast.StartDate() < startofnextyear ){ |
| | | salessegment := forecast.SalesSegment_MP(); |
| | | parentsalessegments := salessegment.GetAllParent(); |
| | | //是否属于长春 |
| | |
| | | product := forecast.Product_MP(); |
| | | productparents := product.GetAllParent(); |
| | | if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//查询产品类型是发动机 |
| | | row := table.GetRow( forecast.ProductID() ); |
| | | products.Add( forecast.Product_MP() ); |
| | | |
| | | //查询对应的发动机成本 |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation() |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() |
| | | and engine.MLB_MQB() = product.MQBMLB() |
| | | and engine.Factory() = ccunit |
| | | and exists( productparents, Elements, e, e.ID() = engine.Product() ) ); |
| | | and engine.Factory() = ccunit ); |
| | | if( not isnull( enginecost ) ){ |
| | | traverse( forecast, PlanningSalesDemandInPeriod, psdip ){ |
| | | row := table.GetRow( forecast.ProductID() ); |
| | | traverse( forecast, PlanningSalesDemandInPeriod, psdip, psdip.Quantity() > 0 ){ |
| | | periodtime := psdip.StartDate().StartOfMonth(); |
| | | periodname := periodtime.Format( "M2/D2/Y" ); |
| | | // info( '-------------------------', periodname, periodtime ); |
| | |
| | | //是否属于大连外租库 |
| | | isdlrent := stockingpoint.ID() = dlrent or unit.ID() = dlrent or exists( parentunits, Elements, punit, punit.ID() = dlrent ); |
| | | if( isccrent or isdlrent ){ |
| | | traverse( stockingpoint, ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf() ){ |
| | | traverse( stockingpoint, ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf() |
| | | and exists( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear and pispip.NewSupplyQuantity() <> 0 ) ){ |
| | | //获取行 |
| | | product := pisp.Product_MP(); |
| | | productparents := product.GetAllParent(); |
| | | if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//查询产品类型是发动机 |
| | | row := table.GetRow( pisp.ProductID() ); |
| | | products.Add( pisp.Product_MP() ); |
| | | traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear ){ |
| | | traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear and pispip.NewSupplyQuantity() <> 0 ){ |
| | | periodtime := pispip.Start().StartOfMonth().Date(); |
| | | periodname := periodtime.Format( "M2/D2/Y" ); |
| | | column := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime ); |
| | |
| | | |
| | | if( isccrent ){ |
| | | //在发动机成本参数表找到对应的包装容量 |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation() |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() |
| | | and engine.MLB_MQB() = product.MQBMLB() |
| | | and engine.Factory() = ccunit |
| | | and exists( productparents, Elements, e, e.ID() = engine.Product() ) ); |
| | | and engine.Factory() = ccunit ); |
| | | if( not isnull( enginecost ) ){ |
| | | cost := ceil( [Number]pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//四舍五入 |
| | | cell.CCRentStorageCost( cell.CCRentStorageCost() + cost ); |
| | | } |
| | | } else { |
| | | //在发动机成本参数表找到对应的包装容量 |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation() |
| | | enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() |
| | | and engine.MLB_MQB() = product.MQBMLB() |
| | | and engine.Factory() = dlunit |
| | | and exists( productparents, Elements, e, e.ID() = engine.Product() ) ); |
| | | and engine.Factory() = dlunit ); |
| | | if( not isnull( enginecost ) ){ |
| | | cost := ceil( [Number]pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//四舍五入 |
| | | cell.DLRentStorageCost( cell.DLRentStorageCost() + cost );; |