| | |
| | | macroPlan.MachineLogisticsCostReportRow( relflush ); |
| | | macroPlan.MachineLogisticsCostReportColumn( relflush ); |
| | | |
| | | // 初始化一年数据列 |
| | | // 创建行 |
| | | categories := selectuniquevalues( macroPlan, Product_MP, tempPMP, tempPMP.IsLeaf() and |
| | | exists( tempPMP, AllParent.AsParent, tempPMP1, tempPMP1.ID() = "机加件" ), |
| | | tempPMP.ParentID() ); |
| | | traverse ( categories, Elements, c ) { |
| | | macroPlan.MachineLogisticsCostReportRow( relnew, Factory := "大连工厂", Category := c ); |
| | | macroPlan.MachineLogisticsCostReportRow( relnew, Factory := "长春工厂", Category := c ); |
| | | } |
| | | |
| | | // 创建列 |
| | | indexDate := macroPlan.StartOfPlanning().Date().StartOfMonth(); |
| | | for ( i := 0; i < 12; i++ ) { |
| | | macroPlan.MachineLogisticsCostReportColumn( relnew, StartDate := indexDate ); |
| | | indexDate := indexDate.StartOfNextMonth(); |
| | | } |
| | | |
| | | // 找出所有大类,创建数据 |
| | | categories := selectuniquevalues( macroPlan, PackagingPlanRow, tempPPR, true, tempPPR.Category() ); |
| | | |
| | | traverse ( categories, Elements, c ) { |
| | | // 创建单元格 |
| | | traverse ( macroPlan, MachineLogisticsCostReportRow, mlcrr ) { // 循环行 |
| | | info( "当前遍历的行:", mlcrr.Factory(), " ", mlcrr.Category() ); |
| | | traverse ( macroPlan, MachineLogisticsCostReportColumn, mlcrc ) { // 循环列 |
| | | |
| | | // 机加成本参数 |
| | | lcm := select( macroPlan, LogisticsCostMachining, tempLCM, tempLCM.Factory() = factory and tempLCM.Product() = c ); |
| | | |
| | | // 运输成本参数 |
| | | lct := select( macroPlan, LogisticsCostTransport, tempLCT, tempLCT.Origin() = ifexpr( factory = "大连工厂", "CC", "DL" ) and |
| | | tempLCT.Destination() = ifexpr( factory = "大连工厂", "DL", "CC" ) and |
| | | tempLCT.Product() = c ); |
| | | |
| | | // 初始化机加成本参数报表行 |
| | | mlcrr := macroPlan.MachineLogisticsCostReportRow( relnew, Category := c, Factory := factory ); |
| | | |
| | | // 循环所有时间列创建数据 |
| | | traverse ( macroPlan, MachineLogisticsCostReportColumn, mlcrc ) { |
| | | cell := mlcrr.MachineLogisticsCostReportCell( relnew ); |
| | | // 机加成本参数 |
| | | lcm := select( macroPlan, LogisticsCostMachining, tempLCM, tempLCM.Factory() = mlcrr.Factory() and tempLCM.Product() = mlcrr.Category() |
| | | and tempLCM.StartDate() <= mlcrc.StartDate() and tempLCM.EndDate() >= mlcrc.StartDate().StartOfNextMonth() ); |
| | | |
| | | // 运输成本参数 |
| | | lct := select( macroPlan, LogisticsCostTransport, tempLCT, tempLCT.Product() = mlcrr.Category() and |
| | | tempLCT.Origin() = "长春外租库" and tempLCT.Destination() = "CC 厂内库" ); |
| | | |
| | | cell := mlcrr.MachineLogisticsCostReportCell( relnew ); |
| | | |
| | | // 设置包装费用(包装量 * 包装单价) |
| | | packageQuantity := sum( macroPlan, PackagingPlanRow.PackagingPlanCell, tempPPC, |
| | | tempPPC.PackagingPlanRow().Category() = c and |
| | | tempPPC.PackagingPlanRow().Category() = mlcrr.Category() and |
| | | tempPPC.PackagingPlanRow().Factory() = factory and |
| | | tempPPC.PackagingPlanColumn().StartDate().Year() = mlcrc.StartDate().Year() and |
| | | tempPPC.PackagingPlanColumn().StartDate().Month() = mlcrc.StartDate().Month(), |
| | | tempPPC.Package() ); |
| | | // cell.PackingCharges( packageQuantity * guard( lcm.PackagePrice(), 1 ) ); |
| | | |
| | | cell.PackingCharges( packageQuantity * guard( lcm.PackagePrice(), 1 ) ); |
| | | |
| | | // 设置拆包费用(拆包量 * 拆包单价) |
| | | unpackingQuantity := sum( macroPlan, PackagingPlanRow.PackagingPlanCell, tempPPC, |
| | | tempPPC.PackagingPlanRow().Category() = c and |
| | | tempPPC.PackagingPlanRow().Category() = mlcrr.Category() and |
| | | tempPPC.PackagingPlanRow().Factory() = factory and |
| | | tempPPC.PackagingPlanColumn().StartDate().Year() = mlcrc.StartDate().Year() and |
| | | tempPPC.PackagingPlanColumn().StartDate().Month() = mlcrc.StartDate().Month(), |
| | | tempPPC.Unpacking() ); |
| | | // cell.UnpackingCost( unpackingQuantity * guard( lcm.UnpackingPrice(), 1 ) ); |
| | | |
| | | cell.UnpackingCost( unpackingQuantity * guard( lcm.UnpackingPrice(), 1 ) ); |
| | | |
| | | // 设置缓冲纸费用(包装类 * 缓冲纸单价) |
| | | // cell.BufferPaperCost( packageQuantity * guard( lcm.BufferPaperPrice(), 1 ) ); |
| | | |
| | | // 设置木箱单价 |
| | | // cell.UnitPriceOfWoodenCrate( guard( lcm.WoodenCratePrice(), 1 ) ); |
| | | |
| | | cell.BufferPaperCost( packageQuantity * guard( lcm.BufferPaperPrice(), 1 ) ); |
| | | |
| | | // 设置木箱单价 |
| | | cell.WoodenCratePriceReal( guard( lcm.WoodenCratePrice(), 1 ) ); |
| | | |
| | | // 设置调拨费用(调拨数量 / 包装容量 / 装载容量 * 运输单价) |
| | | transferQuantity := sum( macroPlan, TransferPlanRow.TransferPlanCell, tempTPC, |
| | | tempTPC.TransferPlanRow().Category() = c and |
| | | tempTPC.TransferPlanRow().Category() = mlcrr.Category() and |
| | | tempTPC.TransferPlanRow().Name() = ifexpr( factory = "大连工厂", "CC to DL", "DL to CC" ) and |
| | | tempTPC.TransferPlanColumn().ColumnDate().Year() = mlcrc.StartDate().Year() and |
| | | tempTPC.TransferPlanColumn().ColumnDate().Month() = mlcrc.StartDate().Month(), |
| | | [Number]tempTPC.Value() ); |
| | | // cell.TransferCost( transferQuantity / guard( lcm.PackagingCapacity(), 1 ) / guard( lct.LoadingCapacity(), 1 ) * guard( lct.TransportPrice(), 1 ) ); |
| | | |
| | | cell.TransferCost( transferQuantity / guard( lcm.PackagingCapacity(), 1 ) / guard( lct.LoadingCapacity(), 1 ) * guard( lct.TransportPrice(), 1 ) ); |
| | | |
| | | // 外租库入库费用(入库量[包装量] / 包装容量 * 入库单价) |
| | | // cell.StorageFeesForRentedWarehouses( packageQuantity / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.WarehousingPrice(), 1 ) ); |
| | | |
| | | // cell.StorageFeesForRentedWarehouses( packageQuantity / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.WarehousingPrice(), 1 ) ); |
| | | |
| | | // 外租库出库费用(出库量[拆包量] / 包装容量 * 出库单价) |
| | | // cell.OutboundExpensesForRentedWarehouses( unpackingQuantity / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.OutboundPrice(), 1 ) ); |
| | | |
| | | // cell.OutboundExpensesForRentedWarehouses( unpackingQuantity / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.OutboundPrice(), 1 ) ); |
| | | |
| | | // 外租库运输费用(运输数量 / 包装容量 / 装载容量 * 运输单价) |
| | | |
| | | cell.MachineLogisticsCostReportColumn( relset, mlcrc ); |