From ed070d695972cadcf9b6bbfe9e779aa5a0850125 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期三, 09 十月 2024 09:15:28 +0800
Subject: [PATCH] 库存汇总报表数据逻辑bug

---
 _Main/BL/Type_InventorySummaryColumn/Attribute_EndaDate.qbl                                                  |    7 +
 _Main/BL/Type_MachiningPipelineReport/Method_GenerateColumn.qbl                                              |    4 
 _Main/UI/MacroPlannerWebApp/Component_FormEnginePipelineReport/Response_PanelExport_570_bRefresh_OnClick.def |    2 
 _Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl                                    |   10 
 _Main/BL/Type_InventorySummaryColumn/Attribute_StartDate.qbl                                                 |    7 +
 _Main/BL/Type_EnginePipelineReport/StaticMethod_GetDefaultProductParent.qbl                                  |    3 
 /dev/null                                                                                                    |    8 -
 _Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_GetDefaultProductParent.qbl                           |    3 
 _Main/BL/Type_InventorySummaryReport/Method_GenerateColumn.qbl                                               |   37 +++---
 _Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl                                        |   28 ++--
 _Main/BL/Type_InventorySummaryReport/Method_Generate.qbl                                                     |   46 ++++---
 _Main/UI/MacroPlannerWebApp/Component_FormMachiningPipelineReport/Response_PanelExport_bRefresh_OnClick.def  |    2 
 _Main/BL/Type_MachiningPipelineRow/Method_SetAssemblyPlanValue#0.qbl                                         |   20 +++
 _Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl                                               |   18 --
 _Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl                                             |   88 ++------------
 _Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_GetDefaultProductParent.qbl                          |    3 
 _Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl                                           |   52 +++-----
 17 files changed, 145 insertions(+), 193 deletions(-)

diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_GetDefaultProductParent.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_GetDefaultProductParent.qbl
index a0443f2..f076bf5 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_GetDefaultProductParent.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_GetDefaultProductParent.qbl
@@ -5,6 +5,7 @@
   TextBody:
   [*
     // 鐢勫叞楦� Aug-14-2024 (created)
-    return '浜ф垚鍝�';
+    //return '浜ф垚鍝�';
+    return '鍙戝姩鏈�';
   *]
 }
diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl
index 25ae29f..69c2ade 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl
@@ -13,7 +13,7 @@
     allunit                   := CCEngineLogisticsCostReport::GetDefaultAllUnit();
     ccfactory                 := CCEngineLogisticsCostReport::GetCCFactory();
     ccunit                    := CCEngineLogisticsCostReport::GetDefaultCCUnit();
-    ccline                    := CCEngineLogisticsCostReport::GetStockingPointCCLine();
+    //ccline                    := CCEngineLogisticsCostReport::GetStockingPointCCLine();
     ccrent                    := CCEngineLogisticsCostReport::GetStockingPointCCRent();
     
     startofplanning           := owner.StartOfPlanning().Date();
@@ -30,23 +30,23 @@
     //澶栫搴撳叆搴撹垂鐢細鍙栬嚜璐㈠姟浜ч噺鎶ヨ〃鐨勪骇閲忥紝鍦ㄤ骇鍝佽〃鏍规嵁鍙戝姩鏈哄彿鎵惧埌瀵瑰簲鐨凣eneration 鍜屾í绾靛埗锛屽湪鍙戝姩鏈烘垚鏈弬鏁拌〃閲屾壘鍒板搴旂殑鍖呰瀹归噺鍜屽叆搴撳崟浠凤紝鐢ㄥ叕寮忚绠楋紝鏈堝害杩涜姹囨��
     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' and cell.FinancialProductionColumn().IsDay() ) ){//璐㈠姟浜ч噺鎶ヨ〃閲岀殑闀挎槬浜ч噺, 涓嶄负0
+        traverse( report, FinancialProductionRow, row, row.Unit() = ccunit and exists( row, FinancialProductionCell, cell, cell.Value() <> '0' and not cell.FinancialProductionColumn().IsDay() ) ){//璐㈠姟浜ч噺鎶ヨ〃閲岀殑闀挎槬浜ч噺, 涓嶄负0
           product             := row.Product_MP();
           productparents      := product.GetAllParent();
           if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
             //鏌ヨ瀵瑰簲鐨勫彂鍔ㄦ満鎴愭湰
-            enginecosts       := selectset( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() 
+            enginecosts       := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.Generation().ToLower() = product.Generation().ToLower() 
                                                  and engine.MLB_MQB() = product.MQBMLB()
                                                  and engine.Factory() = ccfactory );//ccunit
             if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
               ccrow           := table.GetRow( row.Name() );
               products.Add( product );
-              traverse( row, FinancialProductionCell, cell, cell.Value() <> '0' and cell.FinancialProductionColumn().IsDay() ){
+              traverse( row, FinancialProductionCell, cell, cell.Value() <> '0' and not cell.FinancialProductionColumn().IsDay() ){
                 cellcolumn    := cell.FinancialProductionColumn();
                 enginecost    := selectobject( enginecosts, Elements, engine, engine.StartDate() <= cellcolumn.Period() and engine.EndDate() >= cellcolumn.Period() );
                 if( not isnull( enginecost ) ){
                   //鍏ュ簱閲�/鍖呰瀹归噺*鍏ュ簱鍗曚环锛屽叆搴撻噺绛変簬闀挎槬浜ч噺
-                  quantity          := ceil( [Number]cell.Value() / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
+                  quantity          := ceil( cell.Quantity() / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
                   column            := selectobject( table, Column, column, column.Name() = cell.FinancialProductionColumn().Name() );
                   //澶栫搴撳叆搴撹垂鐢� 
                   ccrow.SetRentEnterCost( column, quantity );
@@ -60,23 +60,23 @@
     //澶栫搴撳嚭搴撹垂鐢細鍑哄簱閲忕瓑浜庨暱鏄ラ攢閲忥紝鍙栬嚜璐㈠姟閿�閲忔姤琛ㄧ殑閿�閲忥紝鍦ㄤ骇鍝佽〃鏍规嵁鍙戝姩鏈哄彿鎵惧埌瀵瑰簲鐨凣eneration 鍜屾í绾靛埗锛屽湪鍙戝姩鏈烘垚鏈弬鏁拌〃閲屾壘鍒板搴旂殑鍖呰瀹归噺鍜屽嚭搴撳崟浠凤紝鐢ㄥ叕寮忚绠楋紝鏈堝害杩涜姹囨��
     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' and cell.FinancialSalesColumn().IsDay() ) ){//璐㈠姟閿�閲忔姤琛ㄩ噷鐨勯暱鏄ヤ骇閲�, 涓嶄负0
+        traverse( report, FinancialSalesRow, row, row.Unit() = ccunit and exists( row, FinancialSalesCell, cell, cell.Value() <> '0' and not cell.FinancialSalesColumn().IsDay() ) ){//璐㈠姟閿�閲忔姤琛ㄩ噷鐨勯暱鏄ヤ骇閲�, 涓嶄负0
           product             := row.Product_MP();
           productparents      := product.GetAllParent();
           if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
             //鏌ヨ瀵瑰簲鐨勫彂鍔ㄦ満鎴愭湰
-            enginecosts       := selectset( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() 
+            enginecosts       := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.Generation().ToLower() = product.Generation().ToLower() 
                                                  and engine.MLB_MQB() = product.MQBMLB()
                                                  and engine.Factory() = ccfactory );
             if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
               ccrow           := table.GetRow( row.Name() );
               products.Add( product );
-              traverse( row, FinancialSalesCell, cell, cell.Value() <> '0' and cell.FinancialSalesColumn().IsDay() ){
+              traverse( row, FinancialSalesCell, cell, cell.Value() <> '0' and not cell.FinancialSalesColumn().IsDay() ){
                 cellcolumn    := cell.FinancialSalesColumn();
                 enginecost    := selectobject( enginecosts, Elements, engine, engine.StartDate() <= cellcolumn.Period() and engine.EndDate() >= cellcolumn.Period() );
                 if( not isnull( enginecost ) ){
                   //鍑哄簱閲�/鍖呰瀹归噺*鍑哄簱鍗曚环锛屽叆搴撻噺绛変簬闀挎槬閿�閲�
-                  quantity    := ceil( [Number]cell.Value() / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
+                  quantity    := ceil( [Number]cell.Value() / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice();
                   column      := selectobject( table, Column, column, column.Name() = cell.FinancialSalesColumn().Name() );
                   //澶栫搴撳嚭搴撹垂鐢�
                   ccrow.SetRentOutCost( column, quantity );
@@ -91,7 +91,7 @@
     traverse( owner, Unit.Lane.LaneLeg, laneleg ){
       //璧峰搴撳瓨鐐规槸鍚︽槸闀挎槬瑁呴厤绾胯竟搴�
       originsp               := selectobject( owner, StockingPoint_MP, sp, sp.ID() = laneleg.OriginStockingPointID() );
-      isccspline             := table.IsInUnit( originsp, ccline );
+      isccspline             := table.IsInUnit( originsp, 'CC 鍘傚唴搴�' );
       //鐩殑鍦版槸鍚︽槸闀挎槬澶栫搴�
       destisp                := selectobject( owner, StockingPoint_MP, sp, sp.ID() = laneleg.DestinationStockingPointID() );
       isccrent               := table.IsInUnit( destisp, ccrent );
@@ -101,8 +101,8 @@
           periodname         := periodtime.Format( "M2/D2/Y" );
           
           column             := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
-          enginecosts        := selectset( owner, LogisticsCostEngine, engine, engine.StartDate() <= trip.Arrival().Date() and engine.EndDate() >= trip.Arrival().Date() );
-          transcosts         := selectset( owner, LogisticsCostTransport, trans, trans.StartDate() <= trip.Arrival().Date() and trans.EndDate() >= trip.Arrival().Date() );
+          enginecosts        := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.StartDate() <= trip.Arrival().Date() and engine.EndDate() >= trip.Arrival().Date() );
+          transcosts         := selectset( owner, LogisticsCostTransport, trans, trans.LoadingCapacity() <> 0 and trans.StartDate() <= trip.Arrival().Date() and trans.EndDate() >= trip.Arrival().Date() );
           if( not isnull( enginecosts ) and enginecosts.Size() > 0 and not isnull( transcosts ) and transcosts.Size() > 0 ){
             traverse( trip, ProductInTrip, pit, pit.Quantity() <> 0 ){
               product          := pit.Product_MP();
@@ -113,7 +113,7 @@
                                                    and engine.MLB_MQB() = product.MQBMLB()
                                                    and engine.Factory() = ccfactory );
                 //鍦ㄨ繍杈撴垚鏈弬鏁拌〃閲屾壘鍒板彂鍔ㄦ満瀵瑰簲杩愯緭鍗曚环鍜岃杞藉閲�
-                transcost      := selectobject( transcosts, Elements, trans, trans.Origin() = ccline 
+                transcost      := selectobject( transcosts, Elements, trans, trans.Origin() = 'CC 鍘傚唴搴�' 
                                                   and trans.Destination() = ccrent 
                                                   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 ) ){
@@ -142,7 +142,7 @@
           productparents       := product.GetAllParent();
           if( exists( productparents, Elements, e, e.ID() = produtparent ) ){////鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
             //鏌ヨ瀵瑰簲鐨勫彂鍔ㄦ満鎴愭湰
-            enginecosts        := selectset( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() 
+            enginecosts        := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.Generation().ToLower() = product.Generation().ToLower() 
                                                  and engine.MLB_MQB() = product.MQBMLB()
                                                  and engine.Factory() = ccfactory );
             if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_GetDefaultProductParent.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_GetDefaultProductParent.qbl
index a0443f2..f076bf5 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_GetDefaultProductParent.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_GetDefaultProductParent.qbl
@@ -5,6 +5,7 @@
   TextBody:
   [*
     // 鐢勫叞楦� Aug-14-2024 (created)
-    return '浜ф垚鍝�';
+    //return '浜ф垚鍝�';
+    return '鍙戝姩鏈�';
   *]
 }
diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl
index 90133e3..3ab7f55 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl
@@ -136,7 +136,7 @@
     //澶ц繛澶栫搴撳叆搴撹垂鐢細鍏ュ簱閲�/鍖呰瀹归噺*鍏ュ簱鍗曚环锛屽叆搴撻噺绛変簬澶ц繛宸ュ巶璇ヤ骇鍝佷骇閲忓噺鍘诲彂寰�闀挎槬(澶ц繛鐨勯暱鏄ュ绉熷簱锛夌殑鏁伴噺-newSupply
     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' and cell.FinancialProductionColumn().IsDay() ) ){//璐㈠姟浜ч噺鎶ヨ〃閲岀殑澶ц繛浜ч噺, 涓嶄负0
+        traverse( report, FinancialProductionRow, row, row.Unit() = dlunit and exists( row, FinancialProductionCell, cell, cell.Value() <> '0' and not cell.FinancialProductionColumn().IsDay() ) ){//璐㈠姟浜ч噺鎶ヨ〃閲岀殑澶ц繛浜ч噺, 涓嶄负0
           product            := row.Product_MP();
           productparents     := product.GetAllParent();
           if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
@@ -147,7 +147,7 @@
             if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
               products.Add( product );
               ccrow          := table.GetRow( row.Name() );
-              traverse( row, FinancialProductionCell, cell, cell.Value() <> '0' and cell.FinancialProductionColumn().IsDay() ){
+              traverse( row, FinancialProductionCell, cell, cell.Value() <> '0' and not cell.FinancialProductionColumn().IsDay() ){
                 cellcolumn   := cell.FinancialProductionColumn();
                 enginecost   := selectobject( enginecosts, Elements, engine, engine.StartDate() <= cellcolumn.Period() and engine.EndDate() >= cellcolumn.Period() );
                 if( not isnull( enginecost ) ){
@@ -164,7 +164,7 @@
     //澶ц繛澶栫搴撳嚭搴撹垂鐢細鍑哄簱閲�/鍖呰瀹归噺*鍑哄簱鍗曚环锛屽嚭搴撻噺绛変簬澶ц繛宸ュ巶璇ヤ骇鍝侀攢閲忓噺鍘诲彂寰�闀挎槬鐨勬暟閲�-newSupply, 澶ц繛鍘傚唴搴擄紝澶ц繛澶栫搴�
     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' and cell.FinancialSalesColumn().IsDay() ) ){//璐㈠姟閿�閲忔姤琛ㄩ噷鐨勫ぇ杩炰骇閲�, 涓嶄负0
+        traverse( report, FinancialSalesRow, row, row.Unit() = ccunit and exists( row, FinancialSalesCell, cell, cell.Value() <> '0' and not cell.FinancialSalesColumn().IsDay() ) ){//璐㈠姟閿�閲忔姤琛ㄩ噷鐨勫ぇ杩炰骇閲�, 涓嶄负0
           product            := row.Product_MP();
           productparents     := product.GetAllParent();
           if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
@@ -175,7 +175,7 @@
             if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
               products.Add( product );
               ccrow          := table.GetRow( row.Name() );
-              traverse( row, FinancialSalesCell, cell, cell.Value() <> '0' and cell.FinancialSalesColumn().IsDay() ){
+              traverse( row, FinancialSalesCell, cell, cell.Value() <> '0' and not cell.FinancialSalesColumn().IsDay() ){
                 cellcolumn   := cell.FinancialSalesColumn();
                 enginecost   := selectobject( enginecosts, Elements, engine, engine.StartDate() <= cellcolumn.Period() and engine.EndDate() >= cellcolumn.Period() );
                 if(  not isnull( enginecost ) ){
@@ -233,7 +233,7 @@
       salessegment            := forecast.SalesSegment_MP();
       parentsalessegments     := salessegment.GetAllParent();
       //鏄惁灞炰簬闀挎槬
-      iscc                    := salessegment.Name().StartsWith( 'Changechun' ) or exists( parentsalessegments, Elements, psalessegment, psalessegment.Name().StartsWith( 'Changechun' ) );
+      iscc                    := salessegment.Name().StartsWith( 'Changchun' ) or exists( parentsalessegments, Elements, psalessegment, psalessegment.Name().StartsWith( 'Changchun' ) );
       if( iscc ){
         product               := forecast.Product_MP();
         productparents        := product.GetAllParent();
diff --git a/_Main/BL/Type_EnginePipelineReport/StaticMethod_GetDefaultProductParent.qbl b/_Main/BL/Type_EnginePipelineReport/StaticMethod_GetDefaultProductParent.qbl
index a0443f2..f076bf5 100644
--- a/_Main/BL/Type_EnginePipelineReport/StaticMethod_GetDefaultProductParent.qbl
+++ b/_Main/BL/Type_EnginePipelineReport/StaticMethod_GetDefaultProductParent.qbl
@@ -5,6 +5,7 @@
   TextBody:
   [*
     // 鐢勫叞楦� Aug-14-2024 (created)
-    return '浜ф垚鍝�';
+    //return '浜ф垚鍝�';
+    return '鍙戝姩鏈�';
   *]
 }
diff --git a/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl b/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl
index a024d30..1dad475 100644
--- a/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl
@@ -8,14 +8,7 @@
   [*
     // 鐢勫叞楦� Jun-24-2024 (created)
     owner.EnginePipelineSource( relflush );
-    //ccunit                    := EnginePipelineReport::GetDefaultCCUnit();
-    //dlunit                    := EnginePipelineReport::GetDefaultDLUnit();
     productparent             := EnginePipelineReport::GetDefaultProductParent();
-    //ccalineunit               := EnginePipelineReport::GetDefaultCCALineUnit();
-    //dlalienunit               := EnginePipelineReport::GetDefaultDLALineUnit()
-    //ccmplineunit              := EnginePipelineReport::GetDefaultCCMPLineUnit()
-    //dlmplineunit              := EnginePipelineReport::GetDefaultDLMPLineUnit();
-    //allunit                   := EnginePipelineReport::GetDefaultAllUnit();
     source                    := owner.EnginePipelineSource( relnew, Name := EnginePipelineReport::GetDefaultName() );
     table                     := source.Report( relnew, ID := source.Name(), Name := source.Name() );
     showtable                 := source.Report( relnew, ID := source.Name() + 'Show', Name := source.Name(), IsShow := true );
@@ -28,16 +21,11 @@
     endperiod                 := maxobject( owner, Period_MP, period, not period.IsHistorical() and period.TimeUnit() = Translations::MP_GlobalParameters_Day(), period.StartDate() );
     
     //鐢熸垚鐢熶骇鍜屽簱瀛樻暟鎹�
-    //traverse( owner, StockingPoint_MP, stockingpoint ){
-    traverse( owner, StockingPoint_MP, stockingpoint, stockingpoint.ID().EndsWith( '鍘傚唴搴�' ) ){
-    //  unit                    := stockingpoint.Unit();
-    //  parentunits             := unit.GetAllParent();
+    traverse( owner, StockingPoint_MP, stockingpoint ){
       //鏄惁灞炰簬闀挎槬宸ュ巶
-    //  iscc                    := unit.ID() = ccalineunit or unit.ID() = ccmplineunit or exists( parentunits, Elements, punit, punit.ID() = ccalineunit or punit.ID() = ccmplineunit );
-      iscc                    := stockingpoint.ID().StartsWith( 'CC' );
+      iscc                    := ( stockingpoint.ID().StartsWith( 'CC' ) or stockingpoint.ID().StartsWith( '闀挎槬' ) ) and stockingpoint.ID().EndsWith( '鍘傚唴搴�' );
       //鏄惁灞炰簬澶ц繛宸ュ巶
-    //  isdl                    := unit.ID() = dlalienunit or unit.ID() = dlmplineunit  or exists( parentunits, Elements, punit, punit.ID() = dlalienunit or punit.ID() = dlmplineunit );
-      isdl                    := stockingpoint.ID().StartsWith( '澶ц繛' );
+      isdl                    := ( ( stockingpoint.ID().StartsWith( 'DL' ) or stockingpoint.ID().StartsWith( '澶ц繛' ) ) and stockingpoint.ID().EndsWith( '鍘傚唴搴�' ) ) or  stockingpoint.ID() = '澶ц繛澶栫搴�';
       
       traverse( stockingpoint, ProductInStockingPoint_MP, pisp,  pisp.Product_MP().IsLeaf() and not pisp.IsSystem() 
                 and exists( pisp.Product_MP().GetAllParent(), Elements, e, e.ID() = productparent ) 
diff --git a/_Main/BL/Type_InventorySummaryColumn/Attribute_EndaDate.qbl b/_Main/BL/Type_InventorySummaryColumn/Attribute_EndaDate.qbl
new file mode 100644
index 0000000..13999d8
--- /dev/null
+++ b/_Main/BL/Type_InventorySummaryColumn/Attribute_EndaDate.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute EndaDate
+{
+  #keys: '3[415136.0.1181174808][415136.0.1181174807][415136.0.1181174809]'
+  ValueType: Date
+}
diff --git a/_Main/BL/Type_InventorySummaryColumn/Attribute_StartDate.qbl b/_Main/BL/Type_InventorySummaryColumn/Attribute_StartDate.qbl
new file mode 100644
index 0000000..f957f31
--- /dev/null
+++ b/_Main/BL/Type_InventorySummaryColumn/Attribute_StartDate.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute StartDate
+{
+  #keys: '3[415136.0.1181144701][415136.0.1181144700][415136.0.1181144702]'
+  ValueType: Date
+}
diff --git a/_Main/BL/Type_InventorySummaryReport/Method_Generate.qbl b/_Main/BL/Type_InventorySummaryReport/Method_Generate.qbl
index 56611da..38e179b 100644
--- a/_Main/BL/Type_InventorySummaryReport/Method_Generate.qbl
+++ b/_Main/BL/Type_InventorySummaryReport/Method_Generate.qbl
@@ -13,36 +13,40 @@
     startofendyear            := startofplanning.StartOfNextYear() - Duration::Days( 1 );
     //鏌ヨ鏃ユ湡杩斿洖闇�瑕佸湪璁″垝鏃ユ湡涔嬪唴
     if( search.StartDate().DateTime() < startofendyear and search.EndDate().DateTime() > startofyear ){
-      table      := selectobject( this, InventorySummarySource.InventorySummaryReport, report, not report.IsShow() );
-      allunit    := '<All>';
+      table                   := selectobject( this, InventorySummarySource.InventorySummaryReport, report, not report.IsShow() );
+      allunit                 := '<All>';
       //娓呯┖涔嬪墠瀛樺偍鐨勬樉绀烘暟鎹�
       this.Clear( search.Category(), search.StartDate().DateTime(), search.EndDate().DateTime() );
       //杩囨护鍚庣殑浜у搧id
-      productids := selectuniquevalues( products, Elements, product, ( search.Generation() = allunit or product.Generation() = search.Generation() )
-                                        and ( search.MqbMlb() = allunit or product.MQBMLB() = search.MqbMlb() )
-                                        and ( search.Power() = allunit or product.Power() = search.Power() ), product.ID() );
-      sumrow     := this.InventroySummaryRow( relnew, Name := 'SUM', Unit := search.Unit(), RowNr := table.InventroySummaryRow( relsize ) );
+      productids              := selectuniquevalues( products, Elements, product, ( search.Generation() = allunit or product.Generation() = search.Generation() )
+                                                     and ( search.MqbMlb() = allunit or product.MQBMLB() = search.MqbMlb() )
+                                                     and ( search.Power() = allunit or product.Power() = search.Power() ), product.ID() );
+      sumrow                  := this.InventroySummaryRow( relnew, Name := 'SUM', Unit := search.Unit(), RowNr := table.InventroySummaryRow( relsize ) );
       sumrow.InitializeCell( this );
       traverse( table, InventroySummaryRow, row, row.Unit() = search.Unit() ){
-        productid  := construct( Strings );
+        productid             := construct( Strings );
         productid.Add( row.Name() );
         
         if( productids.ContainsAll( productid ) ){
-          showrow := this.InventroySummaryRow( relnew, Name := row.Name(), Unit := row.Unit(), RowNr := row.RowNr() );
-          
-          traverse( row, InventorySummaryCell, cell, cell.InventorySummaryColumn().TimeUnit() = search.Category() ){
-            column   := selectobject( this, InventorySummaryColumn, column, column.Name() = cell.InventorySummaryColumn().Name() );
+          showrow             := this.InventroySummaryRow( relnew, Name := row.Name(), Unit := row.Unit(), RowNr := row.RowNr() );
+          traverse( this, InventorySummaryColumn, column ){
+            sumcell           := selectobject( column, InventorySummaryCell, c, c.InventroySummaryRow() = sumrow );
+            daycells          := selectset( row, InventorySummaryCell, cell, cell.InventorySummaryColumn().TimeUnit() = Translations::MP_GlobalParameters_Day() and
+                                            cell.InventorySummaryColumn().StartDate() >= column.StartDate() and 
+                                            cell.InventorySummaryColumn().StartDate() <= column.EndaDate() );
             
-            if( not isnull( column ) ){
-              sumcell  := selectobject( column, InventorySummaryCell, c, c.InventroySummaryRow() = sumrow );
-              
-              showcell := column.InventorySummaryCell( relnew, EndingInventory := cell.EndingInventory(), MinimumInventory := cell.MinimumInventory(), MaximumInventory := cell.MaximumInventory(), AverageInventory := cell.AverageInventory() );
-              showrow.InventorySummaryCell( relinsert, showcell );
-              sumcell.EndingInventory( sumcell.EndingInventory() + cell.EndingInventory() );
-              sumcell.MinimumInventory( sumcell.MinimumInventory() + cell.MinimumInventory() );
-              sumcell.MaximumInventory( sumcell.MaximumInventory() + cell.MaximumInventory() );
-              sumcell.AverageInventory( sumcell.AverageInventory() + cell.AverageInventory() );
-            }
+            endinginventory   := maxobject( daycells, Elements, e, e.InventorySummaryColumn().StartDate() ).EndingInventory();
+            minimuminventory  := min( daycells, Elements, e, e.MinimumInventory() );
+            maximuminventory  := max( daycells, Elements, e, e.MaximumInventory() );
+            averageinventory  := [Number]average( daycells, Elements, e, e.AverageInventory() );
+            
+            showcell := column.InventorySummaryCell( relnew, EndingInventory := endinginventory, MinimumInventory := minimuminventory, MaximumInventory := maximuminventory, AverageInventory := averageinventory );
+            showrow.InventorySummaryCell( relinsert, showcell );
+            
+            sumcell.EndingInventory( sumcell.EndingInventory() + endinginventory );
+            sumcell.MinimumInventory( sumcell.MinimumInventory() + minimuminventory );
+            sumcell.MaximumInventory( sumcell.MaximumInventory() + maximuminventory);
+            sumcell.AverageInventory( sumcell.AverageInventory() + averageinventory );
           }
         }
       }
diff --git a/_Main/BL/Type_InventorySummaryReport/Method_GenerateColumn.qbl b/_Main/BL/Type_InventorySummaryReport/Method_GenerateColumn.qbl
index 4484691..6198a96 100644
--- a/_Main/BL/Type_InventorySummaryReport/Method_GenerateColumn.qbl
+++ b/_Main/BL/Type_InventorySummaryReport/Method_GenerateColumn.qbl
@@ -16,31 +16,32 @@
     //鏌ヨ鏃ユ湡杩斿洖闇�瑕佸湪璁″垝鏃ユ湡涔嬪唴
     if( starttime < startofendyear and endtime > startofyear ){
       if( starttime < startofyear ){
-        starttime := startofyear;
+        starttime             := startofyear;
       }
       if( endtime > startofendyear ){
-        endtime := startofendyear;
+        endtime               := startofendyear;
       }
-      for( start := starttime; start <= endtime; start := start.StartOfNextDay() ){
-        periodtime := start.Date();
-        periodname := periodtime.Format( "M2/D2/Y" );
-        
-        if( timeunit = 'All' or timeunit = Translations::MP_GlobalParameters_Day() ){
-          this.InventorySummaryColumn( relnew, Name := periodname, Period := periodtime, TimeUnit := Translations::MP_GlobalParameters_Day() );
+      if( timeunit = Translations::MP_GlobalParameters_Day() ){
+        for( start := starttime; start <= endtime; start := start.StartOfNextDay() ){
+          periodtime          := start.Date();
+          periodname          := periodtime.Format( "M2/D2/Y" );
+          this.InventorySummaryColumn( relnew, Name := periodname, StartDate := periodtime, EndaDate := periodtime, TimeUnit := Translations::MP_GlobalParameters_Day() );
         }
-        if( timeunit = 'All' or timeunit = Translations::MP_GlobalParameters_Week() ){
-          weekend := ( start.StartOfNextWeek() - Duration::Days( 1 ) ).Date();
+      }else if( timeunit = Translations::MP_GlobalParameters_Week() ){
+        for( start := starttime; start <= endtime; start := start.StartOfNextWeek() ){
+          periodtime          := start.Date();
+          periodname          := periodtime.Format( "M2/D2/Y" );
+          weekend             := ( start.StartOfNextWeek() - Duration::Days( 1 ) ).Date();
           
-          if( periodtime = weekend ){
-            this.InventorySummaryColumn( relnew, Name := periodname, Period := periodtime, TimeUnit := Translations::MP_GlobalParameters_Week() );
-          }
+          this.InventorySummaryColumn( relnew, Name := periodname, StartDate := periodtime, EndaDate := weekend, TimeUnit := Translations::MP_GlobalParameters_Week() );
         }
-        if( timeunit = 'All' or timeunit = Translations::MP_GlobalParameters_Month() ){
-          monthend := ( start.StartOfNextMonth() - Duration::Days( 1 ) ).Date();
+      }else if( timeunit = Translations::MP_GlobalParameters_Month() ){
+        for( start := starttime; start <= endtime; start := start.StartOfNextMonth() ){
+          periodtime          := start.Date();
+          periodname          := periodtime.Format( "M2/D2/Y" );
+          monthend            := ( start.StartOfNextMonth() - Duration::Days( 1 ) ).Date();
           
-          if( periodtime = monthend ){
-            this.InventorySummaryColumn( relnew, Name := periodname, Period := periodtime, TimeUnit := Translations::MP_GlobalParameters_Month() );
-          }
+          this.InventorySummaryColumn( relnew, Name := periodname, StartDate := periodtime, EndaDate := monthend, TimeUnit := Translations::MP_GlobalParameters_Month() );
         }
       }
     }
diff --git a/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl b/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl
index cc7d847..407d96a 100644
--- a/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl
@@ -14,32 +14,24 @@
     allunit                   := InventorySummaryReport::GetDefaultAllUnit();
     ccunit                    := InventorySummaryReport::GetDefaultCCUnit();
     dlunit                    := InventorySummaryReport::GetDefaultDLUnit();
-    //ccalineunit               := FinancialProductionReport::GetDefaultCCALineUnit();
-    //dlalienunit               := FinancialProductionReport::GetDefaultDLALineUnit()
-    //ccmplineunit              := FinancialProductionReport::GetDefaultCCMPLineUnit()
-    //dlmplineunit              := FinancialProductionReport::GetDefaultDLMPLineUnit();
     
     source                    := owner.InventorySummarySource( relnew, ID := InventorySummaryReport::GetDefaultName(), Name := InventorySummaryReport::GetDefaultName() );
     table                     := source.InventorySummaryReport( relnew, ID := source.Name(), Name := source.Name() );
     showtable                 := source.InventorySummaryReport( relnew, ID := source.Name() + 'Show', Name := source.Name(), IsShow := true );
     startofplanning           := owner.StartOfPlanning();
     startofyear               := startofplanning.StartOfYear() - Duration::Days( 1 );
-    startofnextyear           := startofplanning.StartOfNextYear() - Duration::Days( 1 );
+    startofnextyear           := startofplanning.StartOfNextYear();
     
     search                    := owner.InventorySummarySearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit, Category := Translations::MP_GlobalParameters_Day(), StartDate := Date::MinDate(), EndDate := Date::MaxDate() );
     
     table.GenerateColumn( owner, 'All', startofyear, startofnextyear );
-    //info( '-----------------------------------', table.InventorySummaryColumn( relsize ) );
     //搴撳瓨鏁伴噺涓篈ctual inventories閲岄潰鐨勭偣Planned inventories瀛楁搴撳瓨閲忓姞鎬�
     traverse( owner, StockingPoint_MP, stockingpoint ){
-    //traverse( owner, StockingPoint_MP, stockingpoint, stockingpoint.ID().EndsWith( '鍘傚唴搴�' ) ){
       unit                    := stockingpoint.Unit();
       parentunits             := unit.GetAllParent();
       //鏄惁灞炰簬闀挎槬宸ュ巶
-    //  iscc                    := stockingpoint.ID().StartsWith( 'CC' ) or stockingpoint.ID() = '闀挎槬' ;//unit.ID() = ccalineunit or unit.ID() = ccmplineunit or exists( parentunits, Elements, punit, punit.ID() = ccalineunit or punit.ID() = ccmplineunit );
       iscc                    := exists( parentunits, Elements, punit, punit.ID().StartsWith( 'VWED CC' ) );
       //鏄惁灞炰簬澶ц繛宸ュ巶
-    //  isdl                    := stockingpoint.ID().StartsWith( '澶ц繛' );//unit.ID() = dlalienunit or unit.ID() = dlmplineunit  or exists( parentunits, Elements, punit, punit.ID() = dlalienunit or punit.ID() = dlmplineunit );
       isdl                    := exists( parentunits, Elements, punit, punit.ID().StartsWith( 'VWED DL' ) );
       if( iscc or isdl ){
         traverse( stockingpoint, ProductInStockingPoint_MP, pisp,  pisp.Product_MP().IsLeaf() ){
@@ -47,12 +39,6 @@
           factoryrow          := table.GetRow( ifexpr( iscc, ccunit, dlunit ), pisp.ProductID() );
           //鑾峰彇鍚堣琛�
           allrow              := table.GetRow( allunit, pisp.ProductID() );
-          //鍛ㄥ害鐨勬暟鎹�
-          weekpispips         := construct( ProductInStockingPointInPeriods );
-          //鏈堝害鐨勬暟鎹�
-          monthpispips        := construct( ProductInStockingPointInPeriods );
-          nextweek            := startofplanning.StartOfNextWeek();
-          nextmonth           := startofplanning.StartOfNextMonth();
           
           pispips             := selectsortedset( pisp, ProductInStockingPointInPeriod, pispip, pispip.Start() < startofnextyear 
                                                   and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day(), pispip.Start() );
@@ -68,88 +54,42 @@
             quantity          := ifexpr( pispip.Period_MP().IsHistorical(), [Number]pispip.ActualInventoryLevelEnd(), [Number]pispip.PlannedInventoryLevelEnd() );
             factoryrow.SetCellValue( daycolumn, quantity );
             allrow.SetCellValue( daycolumn, quantity );
-            
-            //鍛紝閫夋嫨鍛ㄦ椂锛屾湡鏈簱瀛樹负姣忎竴鍛ㄦ渶鍚庝竴澶╃殑姹囨�诲簱瀛樹俊鎭紝鏈�灏忓簱瀛樹负杩欎竴鍛ㄥ簱瀛橀噺鏈�灏忕殑涓�澶╃殑鏁板�硷紝鏈�澶у簱瀛樹负杩欎竴鍛ㄥ簱瀛橀噺鏈�澶х殑涓�澶╃殑鏁板�硷紝骞冲潎搴撳瓨涓鸿鍛ㄧ殑骞冲潎鍊�
-            if( period.Start() < nextweek ){
-              weekpispips.Add( pispip );
-              
-              weekend := nextweek - Duration::Days( 1 );
-              if( period.Start() = weekend ){
-                weekcolumn    := selectobject( table, InventorySummaryColumn, column, column.Name() = periodname, column.Period() = periodtime, column.TimeUnit() = Translations::MP_GlobalParameters_Week() );
-                
-                maxinventory  := max( weekpispips, Elements, e, ifexpr( pispip.Period_MP().IsHistorical(), [Number]e.ActualInventoryLevelEnd(), [Number]e.PlannedInventoryLevelEnd() ) );
-                mininventory  := min( weekpispips, Elements, e, ifexpr( pispip.Period_MP().IsHistorical(), [Number]e.ActualInventoryLevelEnd(), [Number]e.PlannedInventoryLevelEnd() ) );
-                aveinventory  := average( weekpispips, Elements, e, ifexpr( pispip.Period_MP().IsHistorical(), [Number]e.ActualInventoryLevelEnd(), [Number]e.PlannedInventoryLevelEnd() ) );
-                factoryrow.SetCellValue( weekcolumn, quantity, mininventory, maxinventory, [Number]aveinventory );
-                allrow.SetCellValue( weekcolumn, quantity, mininventory, maxinventory, [Number]aveinventory );
-              }
-            }else{
-              weekpispips.Flush();
-              weekpispips.Add( pispip );
-              nextweek        := nextweek.StartOfNextWeek();
-            }
-            
-            //鏈堬紝閫夋嫨鏈堟椂锛屾湡鏈簱瀛樹负姣忎竴鏈堟渶鍚庝竴澶╃殑姹囨�诲簱瀛樹俊鎭紝鏈�灏忓簱瀛樹负杩欎竴涓湀搴撳瓨閲忔渶灏忕殑涓�澶╃殑鏁板�硷紝鏈�澶у簱瀛樹负杩欎竴涓湀搴撳瓨閲忔渶澶х殑涓�澶╃殑鏁板�硷紝骞冲潎搴撳瓨涓鸿鏈堢殑骞冲潎鍊�
-            if( period.Start() < nextmonth ){
-              monthpispips.Add( pispip );
-              
-              monthend := nextmonth - Duration::Days( 1 );
-              if( period.Start() = monthend ){
-                monthcolumn  := selectobject( table, InventorySummaryColumn, column, column.Name() = periodname, column.Period() = periodtime, column.TimeUnit() = Translations::MP_GlobalParameters_Month() );
-                
-                maxinventory := max( monthpispips, Elements, e, ifexpr( pispip.Period_MP().IsHistorical(), [Number]e.ActualInventoryLevelEnd(), [Number]e.PlannedInventoryLevelEnd() ) );
-                mininventory := min( monthpispips, Elements, e, ifexpr( pispip.Period_MP().IsHistorical(), [Number]e.ActualInventoryLevelEnd(), [Number]e.PlannedInventoryLevelEnd() ) );
-                aveinventory := average( monthpispips, Elements, e, ifexpr( pispip.Period_MP().IsHistorical(), [Number]e.ActualInventoryLevelEnd(), [Number]e.PlannedInventoryLevelEnd() ) );
-                factoryrow.SetCellValue( monthcolumn, quantity, mininventory, maxinventory, [Number]aveinventory );
-                allrow.SetCellValue( monthcolumn, quantity, mininventory, maxinventory, [Number]aveinventory );
-              }
-            }else{
-              monthpispips.Flush();
-              monthpispips.Add( pispip );
-              nextmonth      := nextmonth.StartOfNextMonth();
-            }
           }
         }
       }
     }
     //棣栧厛鍦‥ntities閲岃瘑鍒埗绾nit涓洪暱鏄�/澶ц繛鐨勬墍鏈夊簱瀛樼偣
     //闀挎槬搴撳瓨鐐�
-    ccsps := construct( Strings );
+    ccsps                     := construct( Strings );
     //澶ц繛搴撳瓨鐐�
-    dlsps := construct( Strings );
-    allsps := construct( Strings );
+    dlsps                     := construct( Strings );
+    allsps                    := construct( Strings );
     traverse( owner, Unit, unit, unit.ID() = ccunit or unit.ID() = dlunit ){
       if( unit.ID() = ccunit ){
-        ccsps := selectuniquevalues( unit, StockingPoint_MP, sp, sp.ID() );
+        ccsps                 := selectuniquevalues( unit, StockingPoint_MP, sp, sp.ID() );
       }
       if( unit.ID() = dlunit ){
-        dlsps := selectuniquevalues( unit, StockingPoint_MP, sp, sp.ID() );
+        dlsps                 := selectuniquevalues( unit, StockingPoint_MP, sp, sp.ID() );
       }
-      allsps := allsps.Union( selectuniquevalues( unit, StockingPoint_MP, sp, sp.ID() ) );
+      allsps                  := allsps.Union( selectuniquevalues( unit, StockingPoint_MP, sp, sp.ID() ) );
     }
     //鍐嶅湪搴撳瓨鏇存柊鐨勫瓙鐣岄潰搴撳瓨鐐归�夋嫨涓壘鍒拌繖浜涘簱瀛樼偣鎵�鍏宠仈鐨勫凡鍕鹃�夊簱浣�
-    selections := selectset( interface, InventoryPointSelection, selection, allsps.Find( selection.StockpoingPoint() ) >= 0 and selection.IsIncluded() );
-    productids := selectuniquevalues( selections, Elements, selection, selection.ProductID() );
+    selections                := selectset( interface, InventoryPointSelection, selection, allsps.Find( selection.StockpoingPoint() ) >= 0 and selection.IsIncluded() );
+    productids                := selectuniquevalues( selections, Elements, selection, selection.ProductID() );
     //鏈�鍚庡皢杩欎簺搴撲綅涓浂浠跺彿鐨勬暟閲忚繘琛屽姞鎬�
-    traverse( table, InventorySummaryColumn, column, column.Period() < startofplanning.Date() ){
+    traverse( table, InventorySummaryColumn, column, column.TimeUnit() = Translations::MP_GlobalParameters_Day() and column.Period() < startofplanning.Date() ){
       traverse( productids, Elements, productid ){
-        if( column.TimeUnit() = Translations::MP_GlobalParameters_Day() ){//澶�
-          column.GenerateCell( selections, ccsps, dlsps, table, column.Period(), column.Period(), productid, allunit, ccunit, dlunit );
-        }else if( column.TimeUnit() = Translations::MP_GlobalParameters_Week() ){//鍛�
-          column.GenerateCell( selections, ccsps, dlsps, table, column.Period().StartOfWeek(), column.Period(), productid, allunit, ccunit, dlunit );
-        }else if( column.TimeUnit() = Translations::MP_GlobalParameters_Month() ){//鏈�
-          column.GenerateCell( selections, ccsps, dlsps, table, column.Period().StartOfMonth(), column.Period(), productid, allunit, ccunit, dlunit );
-        }
+        column.GenerateCell( selections, ccsps, dlsps, table, column.Period(), column.Period(), productid, allunit, ccunit, dlunit );
       }
     }
       
         
-    rows := selectsortedset( table, InventroySummaryRow, row, row.Name() );
-    i    := 0;
+    rows                      := selectsortedset( table, InventroySummaryRow, row, row.Name() );
+    i                         := 0;
     traverse( rows, Elements, e ){
       if( exists( e, InventorySummaryCell, cell, cell.AverageInventory() <> 0 or cell.EndingInventory() <> 0 or cell.MaximumInventory() <> 0 or cell.MinimumInventory() <> 0 ) ){
         e.RowNr( i );
-        i := i + 1;
+        i                     := i + 1;
       }else{
         e.Delete();
       }
diff --git a/_Main/BL/Type_MachiningPipelineColumn0/Attribute_CCAssemblyPlanQty.qbl b/_Main/BL/Type_MachiningPipelineColumn0/Attribute_CCAssemblyPlanQty.qbl
deleted file mode 100644
index af5f2ec..0000000
--- a/_Main/BL/Type_MachiningPipelineColumn0/Attribute_CCAssemblyPlanQty.qbl
+++ /dev/null
@@ -1,8 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Attribute CCAssemblyPlanQty
-{
-  #keys: '3[415136.0.1006432687][415136.0.1006432686][415136.0.1006432688]'
-  Description: '闀挎槬瑁呴厤璁″垝'
-  ValueType: Real
-}
diff --git a/_Main/BL/Type_MachiningPipelineColumn0/Attribute_DLAssemblyPlanQty.qbl b/_Main/BL/Type_MachiningPipelineColumn0/Attribute_DLAssemblyPlanQty.qbl
deleted file mode 100644
index 38d7472..0000000
--- a/_Main/BL/Type_MachiningPipelineColumn0/Attribute_DLAssemblyPlanQty.qbl
+++ /dev/null
@@ -1,8 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Attribute DLAssemblyPlanQty
-{
-  #keys: '3[415136.0.1006432691][415136.0.1006432690][415136.0.1006432692]'
-  Description: '澶ц繛瑁呴厤璁″垝'
-  ValueType: Real
-}
diff --git a/_Main/BL/Type_MachiningPipelineReport/Method_GenerateColumn.qbl b/_Main/BL/Type_MachiningPipelineReport/Method_GenerateColumn.qbl
index 8a122c3..c4e150b 100644
--- a/_Main/BL/Type_MachiningPipelineReport/Method_GenerateColumn.qbl
+++ b/_Main/BL/Type_MachiningPipelineReport/Method_GenerateColumn.qbl
@@ -17,13 +17,13 @@
         periodtime          := period.StartDate();
         periodname          := periodtime.Format( "M2/D2/Y" );
         
-        this.Column( relnew, Name := periodname, StartDate := periodtime, EndDate := periodtime, CCAssemblyPlanQty := 0, DLAssemblyPlanQty := 0, TimeUnit := Translations::MP_GlobalParameters_Day() );
+        this.Column( relnew, Name := periodname, StartDate := periodtime, EndDate := periodtime, TimeUnit := Translations::MP_GlobalParameters_Day() );
       }
       
       if( timeunit = 'All' or timeunit = Translations::MP_GlobalParameters_Week() ){
         if( period.StartDate() = weekstart ){
           weekperiodname    := weekstart.Format( "M2/D2/Y" );
-          this.Column( relnew, Name := weekperiodname, StartDate := weekstart, EndDate := ( weekstart + Duration::Days( 6 ) ).Date(), CCAssemblyPlanQty := 0, DLAssemblyPlanQty := 0, TimeUnit := Translations::MP_GlobalParameters_Week() );
+          this.Column( relnew, Name := weekperiodname, StartDate := weekstart, EndDate := ( weekstart + Duration::Days( 6 ) ).Date(), TimeUnit := Translations::MP_GlobalParameters_Week() );
           weekstart         := ( weekstart + Duration::Days( 7 ) ).Date();
         }
       }
diff --git "a/_Main/BL/Type_MachiningPipelineRow/Method_SetAssemblyPlanValue\0430.qbl" "b/_Main/BL/Type_MachiningPipelineRow/Method_SetAssemblyPlanValue\0430.qbl"
new file mode 100644
index 0000000..fdf9a70
--- /dev/null
+++ "b/_Main/BL/Type_MachiningPipelineRow/Method_SetAssemblyPlanValue\0430.qbl"
@@ -0,0 +1,20 @@
+Quintiq file version 2.0
+#parent: #root
+Method SetAssemblyPlanValue (
+  MachiningPipelineColumn column,
+  Boolean iscc,
+  Real quantity
+)
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jun-24-2024 (created)
+    cell := selectobject( this, Cell, cell, cell.Column() = column );
+    
+    if( iscc ){
+      cell.CCAssemblyPlanQty( cell.CCAssemblyPlanQty() + quantity );
+    } else {
+      cell.DLAssemblyPlanQty( cell.DLAssemblyPlanQty() + quantity );
+    }
+  *]
+}
diff --git a/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl b/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl
index ca7ed85..843e310 100644
--- a/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl
@@ -48,43 +48,37 @@
           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() );
           traverse( pispips, Elements, pispip ){
-            supplyquantity    := [Number]pispip.NewSupplyQuantity();//鍥涜垗浜斿叆
+            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() );
             
+            product           := pisp.Product_MP();
+            productparents    := product.GetAllParent();
+            row               := table.GetRow( pisp.ProductID() );
+              
             //瑁呴厤绾�
             if( isccassemnly or isdlassemnly ){
               quantity        := [Number]pispip.DependentDemandAndSalesDemandQuantity();//鍥涜垗浜斿叆
-              if( isccassemnly ){
-                daycolumn.CCAssemblyPlanQty( daycolumn.CCAssemblyPlanQty() + quantity );
-                weekcolumn.CCAssemblyPlanQty( weekcolumn.CCAssemblyPlanQty() + quantity );
-              } else {
-                daycolumn.DLAssemblyPlanQty( daycolumn.DLAssemblyPlanQty() + quantity );
-                weekcolumn.DLAssemblyPlanQty( weekcolumn.DLAssemblyPlanQty() + quantity );
-              } 
+              row.SetCellProductionValue( daycolumn, isccassemnly, [Real]quantity );
+              row.SetCellProductionValue( weekcolumn, isccassemnly, [Real]quantity );
+            }
+              
+            //鏈哄姞绾�
+            if( isccproduction or isdlproduction ){
+              supplyqty       := [Number]pispip.NewSupplyQuantity();//鍥涜垗浜斿叆
+              row.SetCellProductionValue( daycolumn, isccproduction, [Real]supplyqty );
+              row.SetCellProductionValue( weekcolumn, isccproduction, [Real]supplyqty );
             }
             
-            product           := pisp.Product_MP();
-            productparents    := product.GetAllParent();
-            if( exists( productparents, Elements, e, e.ID() = productparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
-              row             := table.GetRow( pisp.ProductID() );
-              products.Add( pisp.Product_MP() );
-    
-              inventoryquantity:= [Number]pispip.PlannedInventoryLevelEnd();//鍥涜垗浜斿叆
-              
-              //鏈哄姞绾�
-              if( isccproduction or isdlproduction ){
-                row.SetCellProductionValue( daycolumn, isccproduction, [Real]supplyquantity );
-                row.SetCellProductionValue( weekcolumn, isccproduction, [Real]supplyquantity );
-              }
-              //搴撳瓨
-              if( iscc or isdl ){
-                row.SetCellInventoryValue( daycolumn, iscc, [Real]inventoryquantity );
-                if( weekcolumn.EndDate() = pispip.Start().Date() or pispip.Period_MP() = endperiod ){
-                  row.SetCellInventoryValue( weekcolumn, iscc, [Real]inventoryquantity );
-                }
+            //搴撳瓨
+            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 );
               }
             }
           }
@@ -132,10 +126,6 @@
     i    := 0;
     traverse( rows, Elements, e ){
       e.RowNr( i );
-      traverse( e, Cell, cell ){
-        cell.CCAssemblyPlanQty( cell.Column().CCAssemblyPlanQty() );
-        cell.DLAssemblyPlanQty( cell.Column().DLAssemblyPlanQty() );
-      }
       i := i + 1;
     }
     showtable.Generate( search, products );
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormEnginePipelineReport/Response_PanelExport_570_bRefresh_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormEnginePipelineReport/Response_PanelExport_570_bRefresh_OnClick.def
index cc8451d..6e83498 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormEnginePipelineReport/Response_PanelExport_570_bRefresh_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormEnginePipelineReport/Response_PanelExport_570_bRefresh_OnClick.def
@@ -19,7 +19,7 @@
       
       DataHolderTable.Data( table );
       
-      dhSearch.Data( MacroPlan.EnginePipelineSearch() );
+      //dhSearch.Data( MacroPlan.EnginePipelineSearch() );
     *]
     GroupServerCalls: false
   }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormMachiningPipelineReport/Response_PanelExport_bRefresh_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormMachiningPipelineReport/Response_PanelExport_bRefresh_OnClick.def
index b4bca44..636c334 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormMachiningPipelineReport/Response_PanelExport_bRefresh_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormMachiningPipelineReport/Response_PanelExport_bRefresh_OnClick.def
@@ -19,7 +19,7 @@
       
       DataHolderTable.Data( table );
       
-      dhSearch.Data( MacroPlan.MachiningPipelineSearch() );
+      //dhSearch.Data( MacroPlan.MachiningPipelineSearch() );
     *]
     GroupServerCalls: false
   }

--
Gitblit v1.9.3