From 1416622ccad797dc3602b6672ca59137bab49c7e Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期四, 31 十月 2024 17:12:30 +0800
Subject: [PATCH] 机加管线报表库存值逻辑修改
---
_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl | 83 +++++++++++++++++++++++++++--------------
1 files changed, 55 insertions(+), 28 deletions(-)
diff --git a/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl b/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl
index 9d3c315..40fb9c9 100644
--- a/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl
@@ -8,6 +8,7 @@
[*
// 鐢勫叞楦� Jun-24-2024 (created)
owner.FinancialProductionSource( relflush );
+ startinventorydate := owner.StartOfPlanning() - Duration::Days( 1 );
productparent := MachiningPipelineReport::GetDefaultProductParent();
source := owner.MachiningPipelineSource( relnew, Name := MachiningPipelineReport::GetDefaultName() );
table := source.Report( relnew, ID := source.Name(), Name := source.Name() );
@@ -18,7 +19,7 @@
products := construct( Product_MPs );
//鍒濆鍖栧垪
table.GenerateColumn( owner, 'All', search.StartDate(), search.EndDate() );
- endperiod := maxobject( owner, Period_MP, period, not period.IsHistorical() and period.TimeUnit() = Translations::MP_GlobalParameters_Day(), period.StartDate() );
+ //endperiod := maxobject( owner, Period_MP, period, not period.IsHistorical() and period.TimeUnit() = Translations::MP_GlobalParameters_Day(), period.StartDate() );
//鐢熸垚瑁呴厤(闀垮唴搴�)銆佺敓浜э紙鐨凞L鍜屽簱瀛樻暟鎹�
traverse( owner, StockingPoint_MP, stockingpoint ){
@@ -31,47 +32,73 @@
if( iscc or isdl ){
traverse( stockingpoint, ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf() and not pisp.IsSystem()// and pisp.ProductID() = '06K103011CM'
and exists( pisp.Product_MP().GetAllParent(), Elements, e, e.ID() = productparent )
- and exists( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 or pispip.DependentDemandAndSalesDemandQuantity() <> 0 ) ) ){
+ and exists( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() and ( pispip.NewSupplyQuantity() <> 0 or pispip.DependentDemandAndSalesDemandQuantity() <> 0 ) ) ){
isccassemnly := stockingpoint.ID().EndsWith( pisp.Product_MP().ParentID() + '绾胯竟搴�' ) and ( stockingpoint.ID().StartsWith( 'CC' ) or stockingpoint.ID().StartsWith( '闀挎槬' ) );
isdlassemnly := stockingpoint.ID().EndsWith( pisp.Product_MP().ParentID() ) and ( stockingpoint.ID().StartsWith( 'DL' ) or stockingpoint.ID().StartsWith( '澶ц繛' ) );
pispips := selectsortedset( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical()
- and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 or pispip.DependentDemandAndSalesDemandQuantity() <> 0 ), pispip.Start() );
+ and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() and ( pispip.NewSupplyQuantity() <> 0 or pispip.DependentDemandAndSalesDemandQuantity() <> 0 ), pispip.Start() );
+ products.Add( pisp.Product_MP() );
+ row := table.GetRow( pisp.ProductID() );
+ inventoryqty := sum( pisp, ProductInStockingPointInPeriod, pispip, pispip.Start() = startinventorydate and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() and pispip.ActualInventoryLevelEnd() <> 0, pispip.ActualInventoryLevelEnd() );
+ if( iscc ){
+ row.CCInventoryQty( inventoryqty );
+ }else{
+ row.DLInventoryQty( inventoryqty );
traverse( pispips, Elements, pispip){//, pispip.Start().Month() = 1 and pispip.Start().Day() = 2
- products.Add( pisp.Product_MP() );
-
+
//澶�
daycolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), pispip.Start().Date() );
//鍛�
- weekcolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), pispip.Start().Date() );
-
- row := table.GetRow( pisp.ProductID() );
-
+ // weekcolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), pispip.Start().Date() );
if( isccassemnly or isdlassemnly ){
//瑁呴厤绾�
quantity := [Number]pispip.DependentDemandAndSalesDemandQuantity();//鍥涜垗浜斿叆
row.SetAssemblyPlanValue( daycolumn, isccassemnly, [Real]quantity );
- row.SetAssemblyPlanValue( weekcolumn, isccassemnly, [Real]quantity );
+ // row.SetAssemblyPlanValue( weekcolumn, isccassemnly, [Real]quantity );
//鐢熶骇
supplyqty := [Number]pispip.NewSupplyQuantity();//鍥涜垗浜斿叆
// info( '****************', quantity, supplyqty );
row.SetCellProductionValue( daycolumn, isccassemnly, [Real]supplyqty );
- row.SetCellProductionValue( weekcolumn, isccassemnly, [Real]supplyqty );
+ // row.SetCellProductionValue( weekcolumn, isccassemnly, [Real]supplyqty );
}
//搴撳瓨
- if( iscc or isdl ){
- inventoryqty := [Number]pispip.PlannedInventoryLevelEnd();//鍥涜垗浜斿叆
- row.SetCellInventoryValue( daycolumn, iscc, [Real]inventoryqty );
- if( weekcolumn.EndDate() = pispip.Start().Date() or pispip.Period_MP() = endperiod ){
- row.SetCellInventoryValue( weekcolumn, iscc, [Real]inventoryqty );
- }
+ // if( iscc or isdl ){
+ // inventoryqty := [Number]pispip.PlannedInventoryLevelEnd();//鍥涜垗浜斿叆
+ // row.SetCellInventoryValue( daycolumn, iscc, [Real]inventoryqty );
+ // if( weekcolumn.EndDate() = pispip.Start().Date() or pispip.Period_MP() = endperiod ){
+ // row.SetCellInventoryValue( weekcolumn, iscc, [Real]inventoryqty );
+ // }
}
}
}
}
}
-
+ //鐢熸垚璋冩嫧鏁版嵁
+ traverse( owner, Unit.Lane.LaneLeg, laneleg ){
+ originspid := laneleg.OriginStockingPointID();
+ destinationspid := laneleg.DestinationStockingPointID();
+ //CC to DL 闀挎槬鍘傚唴搴撳埌澶ц繛澶栫搴�
+ iscctodl := originspid.EndsWith( '鍘傚唴搴�' ) and ( originspid.StartsWith( '闀挎槬' ) or originspid.StartsWith( 'CC' ) ) and destinationspid = '澶ц繛澶栫搴�';
+ //DL to CC 澶ц繛鍘傚唴搴撳埌澶ц繛鍙戝姩鏈虹殑闀挎槬澶栫搴�
+ isdltocc := originspid.EndsWith( '鍘傚唴搴�' ) and ( originspid.StartsWith( '澶ц繛' ) or originspid.StartsWith( 'DL' ) ) and destinationspid = '澶ц繛鍙戝姩鏈虹殑闀挎槬澶栫搴�';
+ if( iscctodl and isdltocc ){
+ traverse( table, Column, column){//, column.StartDate().Month() = 1
+ alltrips := selectset( laneleg, Trip, trip, ( trip.Arrival().Date() < column.StartDate().StartOfNextMonth() and trip.Arrival().Date() >= column.StartDate() )
+ or ( trip.Departure().Date() < column.StartDate().StartOfNextMonth() and trip.Departure().Date() >= column.StartDate() ) );
+ producttrips := selectuniquevalues( alltrips, Elements.ProductInTrip, pit, pit.Quantity() <> 0 and exists( pit.Product_MP().GetAllParent(), Elements, e, e.ID() = productparent ), pit.ProductID() );
+ traverse( producttrips, Elements, producttrip ){//, producttrip = '6912'
+ row := table.GetRow( producttrip );
+ product := selectobject( owner, Product_MP, product, product.ID() = producttrip );
+ products.Add( product );
+ departureqty := sum( alltrips, Elements.ProductInTrip, pit, ( pit.Trip().Departure().Date() < column.StartDate().StartOfNextMonth() and pit.Trip().Departure().Date() >= column.StartDate() ) and pit.Product_MP() = product, pit.Quantity() );
+ arrivalqty := sum( alltrips, Elements.ProductInTrip, pit, ( pit.Trip().Arrival().Date() < column.StartDate().StartOfNextMonth() and pit.Trip().Arrival().Date() >= column.StartDate() ) and pit.Product_MP() = product, pit.Quantity() );
+ row.SetDepartureAndArrivalValue( column, iscctodl, departureqty, arrivalqty );
+ }
+ }
+ }
+ }
//鐢熸垚璋冩嫧鏁版嵁
traverse( owner, TransferPlanRow, tprow ){
product := selectobject( owner, Product_MP, product, product.ID() = tprow.ProductID() );
@@ -95,25 +122,25 @@
//澶�
daycolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), tpcell.TransferPlanColumn().ColumnDate() );
//鍛�
- weekcolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), tpcell.TransferPlanColumn().ColumnDate() );
+ // weekcolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), tpcell.TransferPlanColumn().ColumnDate() );
quantity := [Real]tpcell.Value();//鍥涜垗浜斿叆
if( not isnull( daycolumn ) ){
row.SetCellTransferValue( daycolumn, ( originiscc and destiisdl ), quantity );
}
- if( not isnull( weekcolumn ) ){
- row.SetCellTransferValue( weekcolumn, ( originiscc and destiisdl ), quantity );
- }
+ // if( not isnull( weekcolumn ) ){
+ // row.SetCellTransferValue( weekcolumn, ( originiscc and destiisdl ), quantity );
+ // }
}
}
}
}
- rows := selectsortedset( table, Row, row, row.Name() );
- i := 0;
- traverse( rows, Elements, e ){
- e.RowNr( i );
- i := i + 1;
- }
+ //rows := selectsortedset( table, Row, row, row.Name() );
+ //i := 0;
+ //traverse( rows, Elements, e ){
+ // e.RowNr( i );
+ // i := i + 1;
+ //}
showtable.Generate( search, products );
*]
}
--
Gitblit v1.9.3