| | |
| | | row := table.GetRow( producttrip ); |
| | | product := selectobject( owner, Product_MP, product, product.ID() = producttrip ); |
| | | products.Add( product ); |
| | | quantity := sum( alltrips, Elements.ProductInTrip, pit, pit.Product_MP() = product, pit.Quantity() ); |
| | | quantity := sum( alltrips, Elements.ProductInTrip, pit, pit.Product_MP() = product, floor( pit.Quantity() ) ); |
| | | enginecost := selectobject( enginecosts, Elements, engine, engine.Generation().ToLower() = product.Generation().ToLower() and engine.MLB_MQB() = product.MQBMLB() and engine.Factory() = ccfactory ); |
| | | //在运输成本参数表里找到发动机对应运输单价和装载容量 |
| | | transcost := selectobject( transcosts, Elements, trans, trans.Origin() = 'CC 厂内库' and trans.Destination() = ccrent and exists( product.GetAllParent(), Elements, e, ifexpr( trans.Product().FindString( '发动机', 0 ) >= 0, e.ID() = produtparent, e.ID() = trans.Product() ) ) ); |
| | |
| | | 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() ); |
| | | } |
| | | } |
| | | } |
| | |
| | | //当product planning的日期区间在需要的日期区间内 |
| | | traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and ( pispip.Start() + Duration::Days( 1 ) ).Date() < startofnextyear and pispip.NewSupplyQuantity() <> 0 ){ |
| | | dayperiodtime := ( pispip.Start() + Duration::Days( 1 ) ).Date(); |
| | | dayperiodname := dayperiodtime.Format( "M2/D2/Y" ); |
| | | // dayperiodname := dayperiodtime.Format( "M2/D2/Y" ); |
| | | periodtime := dayperiodtime.StartOfMonth(); |
| | | periodname := periodtime.Format( "M2/D2/Y" ); |
| | | // quantity := [Number]pispip.NewSupplyQuantity();//四舍五入 |
| | | daycolumn := selectobject( table, FinancialProductionColumn, column, column.Name() = dayperiodname and column.Period() = dayperiodtime ); |
| | | // daycolumn := selectobject( table, FinancialProductionColumn, column, column.Name() = dayperiodname and column.Period() = dayperiodtime ); |
| | | column := selectobject( table, FinancialProductionColumn, column, column.Name() = periodname and column.Period() = periodtime ); |
| | | factoryrow.Initialize( daycolumn, pispip.NewSupplyQuantity() ); |
| | | // factoryrow.Initialize( daycolumn, pispip.NewSupplyQuantity() ); |
| | | factoryrow.Initialize( column, pispip.NewSupplyQuantity() ); |
| | | // allrow.Initialize( column, pispip.NewSupplyQuantity() ); |
| | | } |
| | |
| | | productids.Add( forecast.ProductID() ); |
| | | traverse( forecast, PlanningSalesDemandInPeriod, psdip, psdip.Quantity() <> 0 and ( psdip.StartDate() + Duration::Days( 1 ) ).Date() < startofnextyear ){ |
| | | dayperiodtime := ( psdip.StartDate() + Duration::Days( 1 ) ).Date();//psdip.StartDate(); |
| | | dayperiodname := dayperiodtime.Format( "M2/D2/Y" ); |
| | | // dayperiodname := dayperiodtime.Format( "M2/D2/Y" ); |
| | | periodtime := dayperiodtime.StartOfMonth(); |
| | | periodname := periodtime.Format( "M2/D2/Y" ); |
| | | // info( '-------------------------', periodname, periodtime ); |
| | | daycolumn := selectobject( table, FinancialSalesColumn, column, column.Name() = dayperiodname and column.Period() = dayperiodtime ); |
| | | // daycolumn := selectobject( table, FinancialSalesColumn, column, column.Name() = dayperiodname and column.Period() = dayperiodtime ); |
| | | column := selectobject( table, FinancialSalesColumn, column, column.Name() = periodname and column.Period() = periodtime ); |
| | | // info( '-------------------------', column.Name() ); |
| | | quantity := [Number]psdip.Quantity();//四舍五入 |
| | | |
| | | factoryrow.Initialize( column, quantity ); |
| | | factoryrow.Initialize( daycolumn, quantity ); |
| | | // factoryrow.Initialize( daycolumn, quantity ); |
| | | } |
| | | } |
| | | } |
| | |
| | | and ( pispip.Start() + Duration::Days( 1 ) ).Date() < startofnextyear |
| | | and ( pispip.DependentDemandAndSalesDemandQuantity() <> 0 or pispip.NewSupplyQuantity() <> 0 ) ){ |
| | | dayperiodtime := ( pispip.Start() + Duration::Days( 1 ) ).Date();//pispip.Start().Date(); |
| | | dayperiodname := dayperiodtime.Format( "M2/D2/Y" ); |
| | | // dayperiodname := dayperiodtime.Format( "M2/D2/Y" ); |
| | | periodtime := dayperiodtime.StartOfMonth(); |
| | | periodname := periodtime.Format( "M2/D2/Y" ); |
| | | daycolumn := selectobject( table, FinancialSalesColumn, column, column.Name() = dayperiodname and column.Period() = dayperiodtime ); |
| | | // daycolumn := selectobject( table, FinancialSalesColumn, column, column.Name() = dayperiodname and column.Period() = dayperiodtime ); |
| | | column := selectobject( table, FinancialSalesColumn, column, column.Name() = periodname and column.Period() = periodtime ); |
| | | quantity := [Number]pispip.NewSupplyQuantity();//四舍五入 |
| | | |
| | | factoryrow.Initialize( column, quantity );//取Total Demand字段按月汇总需求数量 |
| | | factoryrow.Initialize( daycolumn, quantity ); |
| | | // factoryrow.Initialize( daycolumn, quantity ); |
| | | } |
| | | } |
| | | // } |