From b891692b0006fbe8805a97580a1fa70c6736a72e Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期五, 01 十一月 2024 16:24:50 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev

---
 _Main/BL/Type_InventorySummarySource/StaticMethod_InitiateSearch.qbl                                |    2 
 _Main/BL/Type_MachiningPipelineCell/Attribute_DLToCCArrivalQty.qbl                                  |    8 
 _Main/BL/Type_PackagingPlanCell/StaticMethod_GenerateReport.qbl                                     |    6 
 _Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl                                         |   10 
 _Main/BL/Type_MachiningPipelineReport/Method_Generate.qbl                                           |   75 +++-
 _Main/BL/Relations/Relation_AOnlineAndMOfflinePlanMS64_MS64Data_AOnlineAndMOfflinePlanMS64Data_.qbl |    2 
 _Main/UI/MacroPlannerWebApp/Views/Machine_stock_data.vw                                             |   34 -
 _Main/BL/Type_EnginePipelineRow/StaticMethod_CraeteCellValueForRow.qbl                              |    8 
 _Main/BL/Type_MachiningPipelineRow/Method_SetDepartureAndArrivalValue.qbl                           |   24 +
 _Main/BL/Type_MachiningPipelineCell/Attribute_DLToCCDepartureQty.qbl                                |    8 
 _Main/BL/Type_EnginePipelineSource/StaticMethod_InitiateSearch.qbl                                  |    2 
 _Main/BL/Type_MachiningPipelineSource0/StaticMethod_InitiateSearch.qbl                              |    2 
 _Main/BL/Type_FinancialProductionSource/StaticMethod_InitiateSearch.qbl                             |    2 
 _Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl                                      |   86 +++--
 _Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesDL.qbl                   |    6 
 _Main/BL/Type_EnginePipelineReport/Method_Generate.qbl                                              |  174 ++++-------
 _Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl                                  |   87 +++-
 _Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitiateSearch.qbl                          |    2 
 _Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl                                         |   26 +
 _Main/BL/Type_MachiningPipelineSource0/StaticMethod_Download.qbl                                    |   18 
 _Main/UI/MacroPlannerWebApp/Component_FormMachineStockData/Component_ListMachineStockData.def       |    2 
 _Main/Sys/Repr/Global/MachiningPipelineCell.qrp                                                     |   33 ++
 /dev/null                                                                                           |  153 ----------
 _Main/BL/Type_NewOfflinePlanCell/StaticMethod_DeductionOfReplacementLoss.qbl                        |   13 
 _Main/BL/Type_MachiningPipelineCell/Attribute_CCToDLDepartureQty.qbl                                |    8 
 _Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_InitiateSearch.qbl                           |    2 
 _Main/BL/Type_MachiningPipelineCell/Attribute_CCToDLArrivalQty.qbl                                  |    8 
 _Main/BL/Type_MachiningPipelineRow/Attribute_DLInventoryQty.qbl                                     |    8 
 _Main/BL/Type_FinancialSalesSource/StaticMethod_InitiateSearch.qbl                                  |    2 
 _Main/BL/Type_MachiningPipelineRow/Attribute_CCInventoryQty.qbl                                     |    8 
 _Main/BL/Type_FinishedEngineInventory/StaticMethod_GenerateData.qbl                                 |    4 
 _Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesCC.qbl                   |   31 ++
 32 files changed, 430 insertions(+), 424 deletions(-)

diff --git a/_Main/BL/Relations/Relation_AOnlineAndMOfflinePlanMS64_MS64Data_AOnlineAndMOfflinePlanMS64Data_.qbl b/_Main/BL/Relations/Relation_AOnlineAndMOfflinePlanMS64_MS64Data_AOnlineAndMOfflinePlanMS64Data_.qbl
index 82ca49b..7f7d0ac 100644
--- a/_Main/BL/Relations/Relation_AOnlineAndMOfflinePlanMS64_MS64Data_AOnlineAndMOfflinePlanMS64Data_.qbl
+++ b/_Main/BL/Relations/Relation_AOnlineAndMOfflinePlanMS64_MS64Data_AOnlineAndMOfflinePlanMS64Data_.qbl
@@ -9,7 +9,7 @@
   RelationSide.LeftSide MS64Data
   {
     #keys: '3[415136.0.1039640178][415136.0.1039640177][415136.0.1039640179]'
-    Cardinality: '0to1'
+    Cardinality: '1toN'
     ObjectDefinition: AOnlineAndMOfflinePlanMS64
     OwningSide: 'Owned'
   }
diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_InitiateSearch.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_InitiateSearch.qbl
index a6cdcd8..ffa8a1f 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_InitiateSearch.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_InitiateSearch.qbl
@@ -10,7 +10,7 @@
     allunit                   := DLEngineLogisticsCostReport::GetDefaultAllUnit();
     search                    := owner.CCEngineLogisticsCostSearch();
     if( isnull( search ) ){
-      owner.CCEngineLogisticsCostSearch( relnew, Generation := allunit, MqbMlb := allunit, Power := allunit );
+      search                  := owner.CCEngineLogisticsCostSearch( relnew, Generation := allunit, MqbMlb := allunit, Power := allunit );
     }else{
       search                  := owner.CCEngineLogisticsCostSearch();
       search.Generation( allunit );
diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitiateSearch.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitiateSearch.qbl
index 997f6ba..d951643 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitiateSearch.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitiateSearch.qbl
@@ -10,7 +10,7 @@
     allunit                   := DLEngineLogisticsCostReport::GetDefaultAllUnit();
     search                    := owner.DLEngineLogisticsCostSearch();
     if( isnull( search ) ){
-      owner.DLEngineLogisticsCostSearch( relnew, Generation := allunit, MqbMlb := allunit, Power := allunit );
+      search                  := owner.DLEngineLogisticsCostSearch( relnew, Generation := allunit, MqbMlb := allunit, Power := allunit );
     }else{
       search                  := owner.DLEngineLogisticsCostSearch();
       search.Generation( allunit );
diff --git a/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl b/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
index 128058b..27b05ec 100644
--- a/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
+++ b/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
@@ -94,11 +94,11 @@
         
         // 澶栫搴撹繍杈撹垂鐢細鍙戝姩鏈鸿繍杈撻噺 / 鍖呰瀹归噺 / 瑁呰浇瀹归噺锛堝悜涓婂彇鏁达級 * 鏂欐灦杩愯緭鍗曚环
         transportationQuantity := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT, 
-                                       tempPIT.Product_MP().Generation()                                                =  ccerr.Generation() and
-                                       tempPIT.Product_MP().MQBMLB()                                                    =  ccerr.MLB_MQB()    and
-                                       tempPIT.Trip().Departure().Date()                                                >= ccerc.StartDate()  and
-                                       tempPIT.Trip().Arrival().Date()                                                  <= lastDayOfThisMonth and
-                                       tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID()      = "CC 鍘傚唴搴�"         and
+                                       tempPIT.Product_MP().Generation()                                                = ccerr.Generation()        and
+                                       tempPIT.Product_MP().MQBMLB()                                                    = ccerr.MLB_MQB()           and
+                                       tempPIT.Trip().Departure().Date().Year()                                         = ccerc.StartDate().Year()  and
+                                       tempPIT.Trip().Departure().Date().Month()                                        = ccerc.StartDate().Month() and
+                                       tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID()      = "CC 鍘傚唴搴�"               and
                                        tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID() = "闀挎槬澶栫搴�",
                                        tempPIT.Quantity()
                                       );
diff --git a/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl b/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
index 14c6378..731bea9 100644
--- a/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
+++ b/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
@@ -60,7 +60,9 @@
                            tempMRTCell.MaterialRackTotalRow().Generation() = dlerr.Generation()        and
                            tempMRTCell.MaterialRackTotalRow().MLB_MQB()    = dlerr.MLB_MQB()           and
                            tempMRTCell.MaterialRackColumn().Month()        = dlerc.StartDate().Month() );
-        cell.TotalQuantityOfMaterialRacks( mrtcell.Quantity() );
+        if ( dlerr.Generation() = "350bar" and dlerr.MLB_MQB() = "MQB" ) {
+          cell.TotalQuantityOfMaterialRacks( mrtcell.Quantity() );
+        }
        
         // 澶ц繛澶栫搴撶┖鏂欐灦鏁伴噺锛氥��350bar MQB鏂欐灦鎬绘暟閲� - 鎵�鏈�350bar MQB鎬诲簱瀛� / 鍖呰瀹归噺 - 瀹㈡埛搴撴枡鏋舵暟閲忋��* 澶ц繛澶栫搴撶┖鏂欐灦姣斾緥
         plannedInventory := sum( macroPlan, Product_MP.ProductInStockingPoint_MP.ProductInStockingPointInPeriod, tempPISPIP,
@@ -84,8 +86,8 @@
                                         tempF.StartDate().Year()        = dlerc.StartDate().Year()  and
                                         tempF.StartDate().Month()       = dlerc.StartDate().Month(),
                                         tempF.FulfilledQuantity() );
-        info( "鏃堕棿锛�", dlerc.StartDate().Format( "Y-M2-D2" ), "    鍏ュ簱鏁伴噺锛�", transportationQuantity1, "    鍖呰瀹归噺锛�", guard( lce.PackagingCapacity(), 0 ),
-              "    鍏ュ簱鍗曚环锛�", guard( lcmrCC.WarehousingPrice(), 0 ) ); // 娴嬭瘯杈撳嚭
+    //    info( "鏃堕棿锛�", dlerc.StartDate().Format( "Y-M2-D2" ), "    鍏ュ簱鏁伴噺锛�", transportationQuantity1, "    鍖呰瀹归噺锛�", guard( lce.PackagingCapacity(), 0 ),
+    //          "    鍏ュ簱鍗曚环锛�", guard( lcmrCC.WarehousingPrice(), 0 ) ); // 娴嬭瘯杈撳嚭
         cell.CCStorageFeesForRentedWarehouses( [Number] ( guard( transportationQuantity1 / lce.PackagingCapacity(), 0 ) * lcmrCC.WarehousingPrice() ) );
         
         // CC澶栫搴撳嚭搴撹垂鐢細鍙戝姩鏈洪攢閲� / 鍖呰瀹归噺锛堝悜涓婂彇鏁达級* 鏂欐灦鍑哄簱鍗曚环
@@ -96,14 +98,15 @@
         
         // CC闀块�旇繍杈撹垂鐢細璋冩嫧鏁伴噺 / 鍖呰瀹归噺 / 瑁呰浇瀹归噺 * 鏂欐灦杩愯緭鍗曚环
         transportationQuantity2 := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT, 
-                                        tempPIT.Product_MP().Generation()                                                =  dlerr.Generation()      and
-                                        tempPIT.Product_MP().MQBMLB()                                                    =  dlerr.MLB_MQB()         and
-                                        tempPIT.Trip().Departure().Date()                                                >= dlerc.StartDate()       and
-                                        tempPIT.Trip().Arrival().Date()                                                  <= lastDayOfThisMonth      and
+                                        tempPIT.Product_MP().Generation()                                                =  dlerr.Generation()       and
+                                        tempPIT.Product_MP().MQBMLB()                                                    =  dlerr.MLB_MQB()          and
+                                        tempPIT.Trip().Departure().Date().Year()                                         = dlerc.StartDate().Year()  and
+                                        tempPIT.Trip().Departure().Date().Month()                                        = dlerc.StartDate().Month() and
                                         tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID()      = "澶ц繛鍘傚唴搴�"              and
                                         tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID() = "澶ц繛鍙戝姩鏈虹殑闀挎槬澶栫搴�",
                                         tempPIT.Quantity()
                                        );
+    //    info( "鏁伴噺锛�", transportationQuantity2 );
         cell.CCLineHaulCost( [Number] ( guard( transportationQuantity2 / lce.PackagingCapacity() / lct1.LoadingCapacity(), 0 ) * guard( lct1.TransportPrice(), 1 ) ) );
         
         // CC鐭�旇繍杈撹垂鐢細璋冩嫧鏁伴噺 / 鍖呰瀹归噺 / 瑁呰浇瀹归噺 * 鏂欐灦杩愯緭鍗曚环
@@ -133,7 +136,14 @@
         cell.DLOutboundExpensesForRentedWarehouses( [Number] ( guard( outboundQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmrDL.OutboundPrice(), 1 ) ) );
         
         // DL澶栫搴撹繍杈撹垂鐢細鍙戝姩鏈鸿繍杈撻噺 / 鍖呰瀹归噺 / 瑁呰浇瀹归噺锛堝悜涓婂彇鏁达級* 鏂欐灦杩愯緭鍗曚环
-        cell.DLExternalRentalWarehouseTransportationCosts( [Number] ( guard( inventoryQuantity / lce.PackagingCapacity() / lct2.LoadingCapacity(), 0 ) * guard( lct2.TransportPrice(), 1 ) ) );
+        outboundQuantity1 := sum( macroPlan, Product_MP.ProductInStockingPoint_MP.ProductInStockingPointInPeriodPlanning.astype( ProductInStockingPointInPeriodPlanningLeaf ), tempPISPIPPL,
+                                 tempPISPIPPL.ProductInStockingPoint_MP().Product_MP().Generation() = dlerr.Generation()  and
+                                 tempPISPIPPL.ProductInStockingPoint_MP().Product_MP().MQBMLB()     = dlerr.MLB_MQB()     and
+                                 tempPISPIPPL.ProductInStockingPoint_MP().StockingPointID()         = "澶ц繛澶栫搴�"        and
+                                 tempPISPIPPL.Start().Date()                                        >= dlerc.StartDate()  and
+                                 tempPISPIPPL.End().Date()                                          <= lastDayOfThisMonth,
+                                 tempPISPIPPL.NewSupplyQuantity() );
+        cell.DLExternalRentalWarehouseTransportationCosts( [Number] ( guard( outboundQuantity1 / lce.PackagingCapacity() / lct2.LoadingCapacity(), 0 ) * guard( lct2.TransportPrice(), 1 ) ) );
         
         // 澶ц繛澶栫搴撲粨鍌ㄨ垂鐢細銆�350bar MQB鏂欐灦鎬绘暟閲�-鎵�鏈�350bar MQB鎬诲簱瀛�/鍖呰瀹归噺-瀹㈡埛搴撴枡鏋舵暟閲忋��*澶ц繛澶栫搴撶┖鏂欐灦姣斾緥
         // DL澶栫搴撲粨鍌ㄨ垂鐢細鏂欐灦鎬绘暟閲� - 鍙戝姩鏈哄簱瀛� / 鍖呰瀹归噺锛堝悜涓婂彇鏁达級* 绌烘枡鏋朵粨鍌ㄥ崟浠�
diff --git a/_Main/BL/Type_EnginePipelineReport/Method_Generate.qbl b/_Main/BL/Type_EnginePipelineReport/Method_Generate.qbl
index 5a7b2b7..cf500dd 100644
--- a/_Main/BL/Type_EnginePipelineReport/Method_Generate.qbl
+++ b/_Main/BL/Type_EnginePipelineReport/Method_Generate.qbl
@@ -24,11 +24,12 @@
     sumstr                  := sumname.Format( 'S(Len(10))' );
     sumrowproduction        := EnginePipelineRow::CraeteCellValueForRow( this, sumstr.Concat( '鎬讳骇閲�' ), sumname, '', rows.Size() * cellnr );
     sumrowdlproduction      := EnginePipelineRow::CraeteCellValueForRow( this, sumstr.Concat( '澶ц繛浜ч噺' ), sumname, '', sumrowproduction.RowNr() + 1 );
-    sumrowccproduction      := EnginePipelineRow::CraeteCellValueForRow( this, sumstr.Concat( '闀挎槬浜ч噺' ), sumname, '', sumrowproduction.RowNr() + 2  );
-    sumrowdemand            := EnginePipelineRow::CraeteCellValueForRow( this, sumstr.Concat( '鎬婚渶姹�' ), sumname, '', sumrowproduction.RowNr() + 3 );
-    rowno                   := sumrowproduction.RowNr() + 4;
+    sumrowccproduction      := EnginePipelineRow::CraeteCellValueForRow( this, sumstr.Concat( '闀挎槬浜ч噺' ), sumname, '', sumrowdlproduction.RowNr() + 1  );
+    sumrowdemand            := EnginePipelineRow::CraeteCellValueForRow( this, sumstr.Concat( '鎬婚渶姹�' ), sumname, '', sumrowccproduction.RowNr() + 1 );
+    sumdemandrows           := construct( EnginePipelineRows );
+    rowno                   := sumrowdemand.RowNr() + 1;
     traverse( models, Elements, model ){
-      EnginePipelineRow::CraeteCellValueForRow( this, sumstr.Concat( model.Concat( '闇�姹�' ) ), sumname, model, rowno ); 
+      sumdemandrows.Add( EnginePipelineRow::CraeteCellValueForRow( this, sumstr.Concat( model.Concat( '闇�姹�' ) ), sumname, model, rowno ) ); 
       rowno                 := rowno + 1;
     }
     sumrowinventory         := EnginePipelineRow::CraeteCellValueForRow( this, sumstr.Concat( '搴撳瓨' ), sumname, '', rowno );
@@ -36,138 +37,93 @@
     //琛岃鏁�
     rownr                   := 0;
     traverse( rows, Elements, row, productids.Find( row.Name() ) >= 0 ){
-      rowname             := row.Name().Format( 'S(Len(10))' );
-      showrowproduction   := EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( '鎬讳骇閲�' ), row.Name(), '', rownr );
-      showrowdlproduction := EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( '澶ц繛浜ч噺' ), row.Name(), '', rownr + 1 );
-      showrowccproduction := EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( '闀挎槬浜ч噺' ), row.Name(), '', rownr + 2 );
-      showrowdemand       := EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( '鎬婚渶姹�' ), row.Name(), '', rownr + 3 );
-      rownr               := rownr + 4;
-      modelsnr            := rownr + 3;
-      models              := construct( Strings );
-      uniquemodels        := selectuniquevalues( row, Cell.Demand, demand, true, demand.Model() );
-    
+      rowname               := row.Name().Format( 'S(Len(10))' );
+      showrowproduction     := EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( '鎬讳骇閲�' ), row.Name(), '', rownr );
+      showrowdlproduction   := EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( '澶ц繛浜ч噺' ), row.Name(), '', showrowproduction.RowNr() + 1 );
+      showrowccproduction   := EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( '闀挎槬浜ч噺' ), row.Name(), '', showrowdlproduction.RowNr() + 1 );
+      showrowdemand         := EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( '鎬婚渶姹�' ), row.Name(), '', showrowccproduction.RowNr() + 1 );
+      rownr                 := showrowdemand.RowNr() + 1;
+      modelsnr              := showrowdemand.RowNr() + 4;
+      uniquemodels          := selectuniquevalues( row, Cell.Demand, demand, true, demand.Model() );
+      demandrows            := construct( EnginePipelineRows );
       traverse( uniquemodels, Elements, e ){
     
         if( rownr < modelsnr ){
-          EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( e.Concat( '闇�姹�' ) ), row.Name(), e, rownr ); 
-          models.Add( e );
+          demandrows.Add( EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( e.Concat( '闇�姹�' ) ), row.Name(), e, rownr ) ); 
           rownr             := rownr + 1;
         }
       }
     
       for( rownr := rownr; rownr < modelsnr; rownr ++ ){
     
-        EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( '' ), row.Name(), '', rownr ); 
+        demandrows.Add( EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( '' ), row.Name(), '', rownr ) ); 
       }
-      showrowinventory    :=  EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( '搴撳瓨' ), row.Name(), '', rownr );
+      showrowinventory      :=  EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( '搴撳瓨' ), row.Name(), '', rownr );
     
-      traverse( row, Cell, cell, cell.Column().TimeUnit() = search.TimeUnit() ){
-    
-        column            := selectobject( this, Column, column, column.StartDate() = cell.Column().StartDate() and column.TimeUnit() = search.TimeUnit() );
+      traverse( this, Column, column ){
+        daycells            := selectset( row, Cell, cell, cell.Column().TimeUnit() = Translations::MP_GlobalParameters_Day() and
+                                            cell.Column().StartDate() >= column.StartDate() and 
+                                            cell.Column().StartDate() <= column.EndDate() );
         
-        if( not isnull( column ) ){
-          
-          //鐢熶骇
-          production              := column.CellValue( relnew, Value := [String]cell.ProductionQuantity() );
-          showrowproduction.CellValue( relinsert, production );
-          sumproduction           := selectobject( column, CellValue, c, c.Row() = sumrowproduction );
-    
-          if( isnull( sumproduction ) ){
-            sumproduction         := column.CellValue( relnew, Value := [String]0 );
-            sumrowproduction.CellValue( relinsert, sumproduction );
+        //鐢熶骇
+        productionqty       := [Number]sum( daycells, Elements, cell, cell.ProductionQuantity() );
+        production          := selectobject( column, CellValue, c, c.Row() = showrowproduction );
+        production.Value( [String]productionqty );
+        sumproduction       := selectobject( column, CellValue, c, c.Row() = sumrowproduction );
+        sumproduction.Value( [String]( [Real]sumproduction.Value() + productionqty ) );
+        //澶ц繛浜ч噺
+        dlproductionqty     := [Number]sum( daycells, Elements.Production, cellproduction, cellproduction.DLProduction() );
+        dlproduction        := selectobject( column, CellValue, c, c.Row() = showrowdlproduction );
+        dlproduction.Value( [String]dlproductionqty );
+        sumdlproduction     := selectobject( column, CellValue, c, c.Row() = sumrowdlproduction );
+        sumdlproduction.Value( [String]( [Real]sumdlproduction.Value() + dlproductionqty ) );
+        //闀挎槬浜ч噺
+        ccproductionqty     := [Number]sum( daycells, Elements.Production, cellproduction, cellproduction.CCProduction() );
+        ccproduction        := selectobject( column, CellValue, c, c.Row() = showrowccproduction );
+        ccproduction.Value( [String]ccproductionqty );
+        sumccproduction     := selectobject( column, CellValue, c, c.Row() = sumrowccproduction );
+        sumccproduction.Value( [String]( [Real]sumccproduction.Value() + ccproductionqty ) );
+        //闇�姹�
+        totaldemandqty      := [Number]sum( daycells, Elements, cell, cell.DemandQuantity() );
+        totaldemand         := selectobject( column, CellValue, c, c.Row() = showrowdemand );
+        totaldemand.Value( [String]totaldemandqty );
+        sumdemand           := selectobject( column, CellValue, c, c.Row() = sumrowdemand );
+        sumdemand.Value( [String]( [Real]sumdemand.Value() + totaldemandqty ) );
+        //鍏蜂綋闇�姹�
+        traverse( demandrows, Elements, demandrow ){
+          demandqty         :=  [Number]sum( daycells, Elements.Demand, celldemand, celldemand.Model() = demandrow.Demand(), celldemand.Quantity() );
+          demandcell        := selectobject( column, CellValue, c, c.Row() = demandrow );
+          demandcell.Value( [String]demandqty );
+          sumdemandrow      := selectobject( sumdemandrows, Elements, r, r.Demand() = demandrow.Demand() );
+          if( not isnull( sumdemandrow ) ){
+            sumdemandcell   := selectobject( column, CellValue, c, c.Row() = sumdemandrow );
+            sumdemandcell.Value( [String]( [Real]sumdemandcell.Value() + demandqty ) );
           }
-          sumproduction.Value( [String]( [Real]sumproduction.Value() + cell.ProductionQuantity() ) );
-    
-          //澶ц繛浜ч噺
-          dlproductionquantity     := guard( cell.Production().DLProduction(), 0 );
-          dlproduction             := column.CellValue( relnew, Value := [String]dlproductionquantity );
-          showrowdlproduction.CellValue( relinsert, dlproduction );
-          sumdlproduction          := selectobject( column, CellValue, c, c.Row() = sumrowdlproduction );
-    
-          if( isnull( sumdlproduction ) ){
-            sumdlproduction        := column.CellValue( relnew, Value := [String]0 );
-            sumrowdlproduction.CellValue( relinsert, sumdlproduction );
-          }
-          sumdlproduction.Value( [String]( [Real]sumdlproduction.Value() + dlproductionquantity ) );
-          
-          //闀挎槬浜ч噺
-          ccproductionquantity     := guard( cell.Production().CCProduction(), 0 );
-          ccproduction             := column.CellValue( relnew, Value := [String]ccproductionquantity );
-          showrowccproduction.CellValue( relinsert, ccproduction );
-          sumccproduction          := selectobject( column, CellValue, c, c.Row() = sumrowccproduction );
-    
-          if( isnull( sumccproduction ) ){
-            sumccproduction        := column.CellValue( relnew, Value := [String]0 );
-            sumrowccproduction.CellValue( relinsert, sumccproduction );
-          }
-          sumccproduction.Value( [String]( [Real]sumccproduction.Value() + ccproductionquantity ) );
-          
-          //闇�姹�
-          totaldemand              := column.CellValue( relnew, Value := [String]cell.DemandQuantity() );
-          showrowdemand.CellValue( relinsert, totaldemand );
-          sumdemand                := selectobject( column, CellValue, c, c.Row() = sumrowdemand );
-          if( isnull( sumdemand ) ){
-            sumdemand              := column.CellValue( relnew, Value := [String]0 );
-            sumrowdemand.CellValue( relinsert, sumdemand );
-          }
-          sumdemand.Value( [String]( [Real]sumdemand.Value() + cell.DemandQuantity() ) );
-          
-          traverse( cell, Demand, demand, exists( models, Elements, model, model = demand.Model() ) ){
-            demandrow              := selectobject( this, Row, r, r.Product() = row.Name() and r.Demand() = demand.Model() );
-            sumdemandrow           := selectobject( this, Row, r, r.Product() = sumname and r.Demand() = demand.Model() );
-    
-            if( not isnull( demandrow ) ){
-              demandcell             := column.CellValue( relnew, Value := [String]demand.Quantity() );
-              demandrow.CellValue( relinsert, demandcell );
-            }
-            if( not isnull( sumdemandrow ) ){
-            sumdemandcell          := selectobject( column, CellValue, c, c.Row() = sumdemandrow );
-            if( isnull( sumdemandcell ) ){
-              sumdemandcell        := column.CellValue( relnew, Value := [String]0 );
-              sumdemandrow.CellValue( relinsert, sumdemandcell );
-            }
-            sumdemandcell.Value( [String]( [Real]sumdemandcell.Value() + demand.Quantity() ) );
-            }
-          }
-    
-          for( demandr := showrowdemand.RowNr() + 1; demandr < showrowinventory.RowNr(); demandr := demandr + 1 ){
-            demandrow              := selectobject( this, Row, r, r.RowNr() = demandr and r.Name() = row.Name() );
-            if( not isnull( demandrow ) and not exists( demandrow, CellValue, cv, cv.Column() = column ) ){
-              demandcell           := column.CellValue( relnew, Value := '' );
-              demandrow.CellValue( relinsert, demandcell );
-            }
-          }
-    
-          
-          //搴撳瓨
-          inventory                := column.CellValue( relnew, Value := [String]cell.InventoryQuantity() );
-          showrowinventory.CellValue( relinsert, inventory );
-          suminventory             := selectobject( column, CellValue, c, c.Row() = sumrowinventory );
-          if( isnull( suminventory ) ){
-            suminventory           := column.CellValue( relnew, Value := [String]0 );
-            sumrowinventory.CellValue( relinsert, suminventory );
-          }
-          suminventory.Value( [String]( [Real]suminventory.Value() + cell.InventoryQuantity() ) );
-    
         }
+        //搴撳瓨
+        inventroyqty        := [Number]maxobject( daycells, Elements, e, e.Column().StartDate() ).InventoryQuantity();
+        inventory           := selectobject( column, CellValue, c, c.Row() = showrowinventory );
+        inventory.Value( [String]inventroyqty );
+        suminventory        := selectobject( column, CellValue, c, c.Row() = sumrowinventory );
+        suminventory.Value( [String]( [Real]suminventory.Value() + inventroyqty ) );
       }
     }
     traverse( this, Column, column ){
       for( demandr := sumrowdemand.RowNr() + 1; demandr < sumrowinventory.RowNr(); demandr := demandr + 1 ){
-        demandrow              := selectobject( this, Row, r, r.RowNr() = demandr and r.Name() = sumname );
+        demandrow           := selectobject( this, Row, r, r.RowNr() = demandr and r.Name() = sumname );
     //    info( '------------------14----------------' );
         if( not isnull( demandrow ) and not exists( demandrow, CellValue, cv, cv.Column() = column ) ){
-          demandcell           := column.CellValue( relnew, Value := '' );
+          demandcell        := column.CellValue( relnew, Value := '' );
           demandrow.CellValue( relinsert, demandcell );
         }
       }
     }
     
-    rows := selectsortedset( this, Row, row, row.Name(), row.RowNr() );
-    i    := 0;
+    rows                    := selectsortedset( this, Row, row, row.Name(), row.RowNr() );
+    i                       := 0;
     traverse( rows, Elements, e ){
       e.RowNr( i );
-      i := i + 1;
+      i                     := i + 1;
     }
   *]
 }
diff --git a/_Main/BL/Type_EnginePipelineReport/Method_Generate0.qbl b/_Main/BL/Type_EnginePipelineReport/Method_Generate0.qbl
deleted file mode 100644
index 733701c..0000000
--- a/_Main/BL/Type_EnginePipelineReport/Method_Generate0.qbl
+++ /dev/null
@@ -1,153 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Method Generate0 (
-  EnginePipelineSearch search,
-  Product_MPs products
-)
-{
-  TextBody:
-  [*
-    // 鐢勫叞楦� Jun-25-2024 (created)
-    table                   := selectobject( this, Source.Report, report, not report.IsShow() );
-    //娓呯┖涔嬪墠瀛樺偍鐨勬樉绀烘暟鎹�
-    this.Clear( search.TimeUnit(), search.StartDate(), search.EndDate() );
-    Transaction::Transaction().Propagate( attribute( EnginePipelineColumn, Index ) );
-    Transaction::Transaction().Propagate( attribute( EnginePipelineCell, ProductionQuantity ) );
-    Transaction::Transaction().Propagate( attribute( EnginePipelineCell, DemandQuantity ) );
-    //杩囨护鍚庣殑浜у搧id
-    productids              := selectuniquevalues( products, Elements, product, true, product.ID() );
-    rows                    := selectsortedset( table, Row, row, row.RowNr() );
-    models                  := selectuniquevalues( table, Column.Cell.Demand, demand, demand.Model() );
-    cellnr                  := 5 + models.Size();
-    //鍚堣琛�
-    sumname                 := 'SUM';
-    sumstr                  := sumname.Format( 'S(Len(10))' );
-    sumrowproduction        := EnginePipelineRow::CraeteCellValueForRow( this, sumstr.Concat( '鎬讳骇閲�' ), sumname, '', rows.Size() * cellnr );
-    sumrowdlproduction      := EnginePipelineRow::CraeteCellValueForRow( this, sumstr.Concat( '澶ц繛浜ч噺' ), sumname, '', sumrowproduction.RowNr() + 1 );
-    sumrowccproduction      := EnginePipelineRow::CraeteCellValueForRow( this, sumstr.Concat( '闀挎槬浜ч噺' ), sumname, '', sumrowdlproduction.RowNr() + 1  );
-    sumrowdemand            := EnginePipelineRow::CraeteCellValueForRow( this, sumstr.Concat( '鎬婚渶姹�' ), sumname, '', sumrowccproduction.RowNr() + 1 );
-    sumdemandrows           := construct( EnginePipelineRows );
-    rowno                   := sumrowdemand.RowNr() + 1;
-    traverse( models, Elements, model ){
-      sumdemandrows.Add( EnginePipelineRow::CraeteCellValueForRow( this, sumstr.Concat( model.Concat( '闇�姹�' ) ), sumname, model, rowno ) ); 
-      rowno                 := rowno + 1;
-    }
-    sumrowinventory         := EnginePipelineRow::CraeteCellValueForRow( this, sumstr.Concat( '搴撳瓨' ), sumname, '', rowno );
-    
-    //琛岃鏁�
-    rownr                   := 0;
-    traverse( rows, Elements, row, productids.Find( row.Name() ) >= 0 ){
-      rowname               := row.Name().Format( 'S(Len(10))' );
-      showrowproduction     := EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( '鎬讳骇閲�' ), row.Name(), '', rownr );
-      showrowdlproduction   := EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( '澶ц繛浜ч噺' ), row.Name(), '', showrowproduction.RowNr() + 1 );
-      showrowccproduction   := EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( '闀挎槬浜ч噺' ), row.Name(), '', showrowdlproduction.RowNr() + 1 );
-      showrowdemand         := EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( '鎬婚渶姹�' ), row.Name(), '', showrowccproduction.RowNr() + 1 );
-      rownr                 := showrowdemand.RowNr() + 1;
-      modelsnr              := showrowdemand.RowNr() + 3;
-      uniquemodels          := selectuniquevalues( row, Cell.Demand, demand, true, demand.Model() );
-      demandrows            := construct( EnginePipelineRows );
-      traverse( uniquemodels, Elements, e ){
-    
-        if( rownr < modelsnr ){
-          demandrows.Add( EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( e.Concat( '闇�姹�' ) ), row.Name(), e, rownr ) ); 
-          rownr             := rownr + 1;
-        }
-      }
-    
-      for( rownr := rownr; rownr < modelsnr; rownr ++ ){
-    
-        demandrows.Add( EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( '' ), row.Name(), '', rownr ) ); 
-      }
-      showrowinventory      :=  EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( '搴撳瓨' ), row.Name(), '', rownr );
-    
-      traverse( this, Column, column ){
-        daycells            := selectset( row, Cell, cell, cell.Column().TimeUnit() = Translations::MP_GlobalParameters_Day() and
-                                            cell.Column().StartDate() >= column.StartDate() and 
-                                            cell.Column().StartDate() <= column.EndDate() );
-        
-        //鐢熶骇
-        productionqty       := sum( daycells, Elements, cell, cell.ProductionQuantity() );
-        production          := column.CellValue( relnew, Value := [String]productionqty );
-        showrowproduction.CellValue( relinsert, production );
-        sumproduction       := selectobject( column, CellValue, c, c.Row() = sumrowproduction );
-        if( isnull( sumproduction ) ){
-          sumproduction     := column.CellValue( relnew, Value := [String]0 );
-          sumrowproduction.CellValue( relinsert, sumproduction );
-        }
-        sumproduction.Value( [String]( [Real]sumproduction.Value() + productionqty ) );
-        //澶ц繛浜ч噺
-        dlproductionqty     := sum( daycells, Elements, cell, cell.Production().DLProduction() );
-        dlproduction        := column.CellValue( relnew, Value := [String]dlproductionqty );
-        showrowdlproduction.CellValue( relinsert, dlproduction );
-        sumdlproduction     := selectobject( column, CellValue, c, c.Row() = sumrowdlproduction );
-        if( isnull( sumdlproduction ) ){
-          sumdlproduction   := column.CellValue( relnew, Value := [String]0 );
-          sumrowdlproduction.CellValue( relinsert, sumdlproduction );
-        }
-        sumdlproduction.Value( [String]( [Real]sumdlproduction.Value() + dlproductionqty ) );
-        //闀挎槬浜ч噺
-        ccproductionqty     := sum( daycells, Elements, cell, cell.Production().CCProduction() );
-        ccproduction        := column.CellValue( relnew, Value := [String]ccproductionqty );
-        showrowccproduction.CellValue( relinsert, ccproduction );
-        sumccproduction     := selectobject( column, CellValue, c, c.Row() = sumrowccproduction );
-        if( isnull( sumccproduction ) ){
-          sumccproduction   := column.CellValue( relnew, Value := [String]0 );
-          sumrowccproduction.CellValue( relinsert, sumccproduction );
-        }
-        sumccproduction.Value( [String]( [Real]sumccproduction.Value() + ccproductionqty ) );
-        //闇�姹�
-        totaldemandqty      := sum( daycells, Elements, cell, cell.DemandQuantity() );
-        totaldemand         := column.CellValue( relnew, Value := [String]totaldemandqty );
-        showrowdemand.CellValue( relinsert, totaldemand );
-        sumdemand           := selectobject( column, CellValue, c, c.Row() = sumrowdemand );
-        if( isnull( sumdemand ) ){
-          sumdemand         := column.CellValue( relnew, Value := [String]0 );
-          sumrowdemand.CellValue( relinsert, sumdemand );
-        }
-        sumdemand.Value( [String]( [Real]sumdemand.Value() + totaldemandqty ) );
-        //鍏蜂綋闇�姹�
-        traverse( demandrows, Elements, demandrow ){
-          demandqty         :=  sum( daycells, Elements.Demand, celldemand, celldemand.Model() = demandrow.Demand(), celldemand.Quantity() );
-          demandcell        := column.CellValue( relnew, Value := [String]demandqty );
-          demandrow.CellValue( relinsert, demandcell );
-          sumdemandrow      := selectobject( sumdemandrows, Elements, r, r.Demand() = demandrow.Demand() );
-          if( not isnull( sumdemandrow ) ){
-            sumdemandcell   := selectobject( column, CellValue, c, c.Row() = sumdemandrow );
-            if( isnull( sumdemandcell ) ){
-              sumdemandcell := column.CellValue( relnew, Value := [String]0 );
-              sumdemandrow.CellValue( relinsert, sumdemandcell );
-            }
-            sumdemandcell.Value( [String]( [Real]sumdemandcell.Value() + demandqty ) );
-          }
-        }
-        //搴撳瓨
-        inventroyqty             := maxobject( daycells, Elements, e, e.Column().StartDate() ).InventoryQuantity();
-        inventory                := column.CellValue( relnew, Value := [String]inventroyqty );
-        showrowinventory.CellValue( relinsert, inventory );
-        suminventory             := selectobject( column, CellValue, c, c.Row() = sumrowinventory );
-        if( isnull( suminventory ) ){
-          suminventory           := column.CellValue( relnew, Value := [String]0 );
-          sumrowinventory.CellValue( relinsert, suminventory );
-        }
-        suminventory.Value( [String]( [Real]suminventory.Value() + inventroyqty ) );
-      }
-    }
-    traverse( this, Column, column ){
-      for( demandr := sumrowdemand.RowNr() + 1; demandr < sumrowinventory.RowNr(); demandr := demandr + 1 ){
-        demandrow              := selectobject( this, Row, r, r.RowNr() = demandr and r.Name() = sumname );
-    //    info( '------------------14----------------' );
-        if( not isnull( demandrow ) and not exists( demandrow, CellValue, cv, cv.Column() = column ) ){
-          demandcell           := column.CellValue( relnew, Value := '' );
-          demandrow.CellValue( relinsert, demandcell );
-        }
-      }
-    }
-    
-    rows := selectsortedset( this, Row, row, row.Name(), row.RowNr() );
-    i    := 0;
-    traverse( rows, Elements, e ){
-      e.RowNr( i );
-      i := i + 1;
-    }
-  *]
-}
diff --git a/_Main/BL/Type_EnginePipelineRow/StaticMethod_CraeteCellValueForRow.qbl b/_Main/BL/Type_EnginePipelineRow/StaticMethod_CraeteCellValueForRow.qbl
index 7eac237..2d828d6 100644
--- a/_Main/BL/Type_EnginePipelineRow/StaticMethod_CraeteCellValueForRow.qbl
+++ b/_Main/BL/Type_EnginePipelineRow/StaticMethod_CraeteCellValueForRow.qbl
@@ -12,10 +12,10 @@
   [*
     // 鐢勫叞楦� Jul-11-2024 (created)
     row           := table.Row( relnew, Name := name, RowNr := rownr, Product := product, Demand := demand );
-    //traverse( table, Column, column ){
-    //  cell        := column.CellValue( relnew, Value := '0' );
-    //  row.CellValue( relinsert, cell );
-    //}
+    traverse( table, Column, column ){
+      cell        := column.CellValue( relnew, Value := '0' );
+      row.CellValue( relinsert, cell );
+    }
     return row;
   *]
 }
diff --git a/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl b/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl
index dbb23a4..784080d 100644
--- a/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl
@@ -17,46 +17,52 @@
     
     products                  := construct( Product_MPs );
     //鍒濆鍖栧垪
-    table.GenerateColumn( owner, 'All', search.StartDate(), search.EndDate() );
+    table.GenerateColumn( owner, Translations::MP_GlobalParameters_Day(), search.StartDate(), search.EndDate() );
     endperiod                 := maxobject( owner, Period_MP, period, not period.IsHistorical() and period.TimeUnit() = Translations::MP_GlobalParameters_Day(), period.StartDate() );
     
     //鐢熸垚鐢熶骇鍜屽簱瀛樻暟鎹�
     traverse( owner, StockingPoint_MP, stockingpoint ){
+      unit                    := stockingpoint.Unit();
+      parentunits             := unit.GetAllParent();
       //鏄惁灞炰簬闀挎槬宸ュ巶
-      iscc                    := ( stockingpoint.ID().StartsWith( 'CC' ) or stockingpoint.ID().StartsWith( '闀挎槬' ) ) and stockingpoint.ID().EndsWith( '鍘傚唴搴�' );
+      iscc                    := stockingpoint.ID().StartsWith( 'CC' ) or unit.ID().StartsWith( 'CC' ) or exists( parentunits, Elements, punit, punit.ID().StartsWith( 'CC' ) );
       //鏄惁灞炰簬澶ц繛宸ュ巶
-      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 ) 
-                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 ) ) ){
-        pispips             := selectsortedset( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() 
-                                                    and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day(), pispip.Start() );
-        row := table.GetRow( pisp.ProductID() );
-        products.Add( pisp.Product_MP() );
-        traverse( pispips, Elements, pispip ){
-          //澶�
-          daycolumn         := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), pispip.Start().Date() );
-          //鍛�
-          weekcolumn        := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(),  pispip.Start().Date() );
-          supplyquantity    := [Number]pispip.NewSupplyQuantity();//鍥涜垗浜斿叆
-          inventoryquantity := [Number]pispip.PlannedInventoryLevelEnd();//鍥涜垗浜斿叆
-          //浜ч噺鏄姞鎬�
-          if( iscc or isdl ){
-            row.SetCellProductionValue( daycolumn, iscc, [Real]supplyquantity );
-            row.SetCellProductionValue( weekcolumn, iscc, [Real]supplyquantity );
+      isdl                    := stockingpoint.ID().StartsWith( 'DL' ) or unit.ID().StartsWith( 'DL' ) or exists( parentunits, Elements, punit, punit.ID().StartsWith( 'DL' ) );
+      //鏄惁灞炰簬闀挎槬浜ч噺
+      isccproduction          := iscc and stockingpoint.ID().EndsWith( '鍘傚唴搴�' );
+      //鏄惁灞炰簬澶ц繛浜ч噺
+      isdlproduction          := isdl and stockingpoint.ID().EndsWith( '鍘傚唴搴�' ) or  stockingpoint.ID() = '澶ц繛澶栫搴�';
+      if( isccproduction or isdlproduction ){
+        traverse( stockingpoint, ProductInStockingPoint_MP, pisp,  pisp.Product_MP().IsLeaf() and not pisp.IsSystem() 
+                  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 ) ) ){
+          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 ), pispip.Start() );
+          row := table.GetRow( pisp.ProductID() );
+          products.Add( pisp.Product_MP() );
+          traverse( pispips, Elements, pispip ){
+            //澶�
+            daycolumn         := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), pispip.Start().Date() );
+            //鍛�
+    //        weekcolumn        := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(),  pispip.Start().Date() );
+            supplyquantity    := pispip.NewSupplyQuantity();//鍥涜垗浜斿叆
+            inventoryquantity := pispip.PlannedInventoryLevelEnd();
+            //浜ч噺鏄姞鎬�
+            if( isccproduction or isdlproduction ){
+              row.SetCellProductionValue( daycolumn, iscc, supplyquantity );
+    //          row.SetCellProductionValue( weekcolumn, iscc, supplyquantity );
+            }
+            //搴撳瓨闇�瑕佸彇鏈�鍚庝竴澶�
+            row.SetCellInventoryValue( daycolumn, [Real]inventoryquantity );
+        
+    //        if( pispip.Start().Date() = weekcolumn.EndDate() or pispip.Period_MP() = endperiod ){
+    //            
+    //          row.SetCellInventoryValue( weekcolumn, [Real]inventoryquantity );
+    //        } 
           }
-          //搴撳瓨闇�瑕佸彇鏈�鍚庝竴澶�
-          row.SetCellInventoryValue( daycolumn, [Real]inventoryquantity );
-      
-          if( pispip.Start().Date() = weekcolumn.EndDate() or pispip.Period_MP() = endperiod ){
-              
-            row.SetCellInventoryValue( weekcolumn, [Real]inventoryquantity );
-          } 
         }
       }
     }
-    
     //鐢熸垚闇�姹傛暟鎹�
     traverse( owner, SalesDemand.astype( Forecast ), forecast, not isnull( forecast.SalesSegment_MP() ) and forecast.StartDate() < endperiod.StartDate() and forecast.Quantity() <> 0 
               and exists( forecast.Product_MP().GetAllParent(), Elements, e, e.ID() = productparent )
@@ -68,26 +74,26 @@
         //澶�
         daycolumn         := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), psdip.StartDate() );
         //鍛�
-        weekcolumn        := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), psdip.StartDate() );
+    //    weekcolumn        := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), psdip.StartDate() );
           
         if( not isnull( daycolumn ) ){
           row.SetCellDemandValue( daycolumn, forecast.SalesSegmentName(), forecast.Quantity() );
         }
-        if( not isnull( weekcolumn ) ){
-          row.SetCellDemandValue( weekcolumn, forecast.SalesSegmentName(), forecast.Quantity() );
-        }
+    //    if( not isnull( weekcolumn ) ){
+    //      row.SetCellDemandValue( weekcolumn, forecast.SalesSegmentName(), forecast.Quantity() );
+    //    }
     //    if( psdip.StartDate() = ( weekstart + Duration::Days( 6 ) ).Date() or psdip.PeriodStart() = endperiod.StartDate() ){
     //      weekstart       := ( weekstart + Duration::Days( 7 ) ).Date();
     //    } 
       }
     }
     
-    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 );
   *]
 }
diff --git a/_Main/BL/Type_EnginePipelineSource/StaticMethod_InitiateSearch.qbl b/_Main/BL/Type_EnginePipelineSource/StaticMethod_InitiateSearch.qbl
index 2c3837f..3c906c5 100644
--- a/_Main/BL/Type_EnginePipelineSource/StaticMethod_InitiateSearch.qbl
+++ b/_Main/BL/Type_EnginePipelineSource/StaticMethod_InitiateSearch.qbl
@@ -9,7 +9,7 @@
     // 鐢勫叞楦� Sep-29-2024 (created)
     search                    := owner.EnginePipelineSearch();
     if( isnull( search ) ){
-      owner.EnginePipelineSearch( relnew, StartDate := Date::MinDate(), EndDate := Date::MaxDate(), TimeUnit := Translations::MP_GlobalParameters_Day() );
+      search                  := owner.EnginePipelineSearch( relnew, StartDate := Date::MinDate(), EndDate := Date::MaxDate(), TimeUnit := Translations::MP_GlobalParameters_Day() );
     }else{
       search                  := owner.EnginePipelineSearch();
       search.TimeUnit( Translations::MP_GlobalParameters_Day() );
diff --git a/_Main/BL/Type_FinancialProductionSource/StaticMethod_InitiateSearch.qbl b/_Main/BL/Type_FinancialProductionSource/StaticMethod_InitiateSearch.qbl
index f0d93bb..c1f1167 100644
--- a/_Main/BL/Type_FinancialProductionSource/StaticMethod_InitiateSearch.qbl
+++ b/_Main/BL/Type_FinancialProductionSource/StaticMethod_InitiateSearch.qbl
@@ -10,7 +10,7 @@
     allunit                   := FinancialProductionReport::GetDefaultAllUnit();
     search                    := owner.FinancialProductionSearch();
     if( isnull( owner.FinancialProductionSearch() ) ){
-      owner.FinancialProductionSearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit );
+      search                  := owner.FinancialProductionSearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit );
     }else{
       search                  := owner.FinancialProductionSearch();
       search.Unit( allunit );
diff --git a/_Main/BL/Type_FinancialSalesSource/StaticMethod_InitiateSearch.qbl b/_Main/BL/Type_FinancialSalesSource/StaticMethod_InitiateSearch.qbl
index 4fa422b..2596cee 100644
--- a/_Main/BL/Type_FinancialSalesSource/StaticMethod_InitiateSearch.qbl
+++ b/_Main/BL/Type_FinancialSalesSource/StaticMethod_InitiateSearch.qbl
@@ -10,7 +10,7 @@
     allunit                   := FinancialSalesReport::GetDefaultAllUnit();
     search                    := owner.FinancialSalesSearch();
     if( isnull( search ) ){
-      owner.FinancialSalesSearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit );
+      search                  := owner.FinancialSalesSearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit );
     }else{
       search                  := owner.FinancialSalesSearch();
       search.Unit( allunit );
diff --git a/_Main/BL/Type_FinishedEngineInventory/StaticMethod_GenerateData.qbl b/_Main/BL/Type_FinishedEngineInventory/StaticMethod_GenerateData.qbl
index ca6915a..997c5b1 100644
--- a/_Main/BL/Type_FinishedEngineInventory/StaticMethod_GenerateData.qbl
+++ b/_Main/BL/Type_FinishedEngineInventory/StaticMethod_GenerateData.qbl
@@ -19,8 +19,8 @@
     brand                      := guard( item.Get( "brand").GetString(),"");
     bi_place                   := guard( item.Get( "bi_place").GetString(),"");
     price                      := guard( item.Get( "price").GetString(),"");
-    total                      := guard( item.Get( "total").GetReal(),0);
-    amount                     := guard( item.Get( "amount").GetReal(),0);
+    total                      := [Real]guard( item.Get( "total").GetString(),"");
+    amount                     := [Real]guard( item.Get( "amount").GetString(),"");
     dtype                      := guard( item.Get( "dtype").GetString(),"");
     fac                        := guard( item.Get( "fac").GetString(),"");
     dday                       := guard( item.Get( "dday").GetString(),"");
diff --git a/_Main/BL/Type_InventorySummarySource/StaticMethod_InitiateSearch.qbl b/_Main/BL/Type_InventorySummarySource/StaticMethod_InitiateSearch.qbl
index 61350de..aa4e4dd 100644
--- a/_Main/BL/Type_InventorySummarySource/StaticMethod_InitiateSearch.qbl
+++ b/_Main/BL/Type_InventorySummarySource/StaticMethod_InitiateSearch.qbl
@@ -10,7 +10,7 @@
     allunit                   := InventorySummaryReport::GetDefaultAllUnit();
     search                    := owner.InventorySummarySearch();
     if( isnull( search ) ){
-      owner.InventorySummarySearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit, Category := Translations::MP_GlobalParameters_Day(), StartDate := Date::MinDate(), EndDate := Date::MaxDate() );
+      search                  := owner.InventorySummarySearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit, Category := Translations::MP_GlobalParameters_Day(), StartDate := Date::MinDate(), EndDate := Date::MaxDate() );
     }else{
       search                  := owner.InventorySummarySearch();
       search.Unit( allunit );
diff --git a/_Main/BL/Type_MachiningPipelineCell/Attribute_CCToDLArrivalQty.qbl b/_Main/BL/Type_MachiningPipelineCell/Attribute_CCToDLArrivalQty.qbl
new file mode 100644
index 0000000..0e905ac
--- /dev/null
+++ b/_Main/BL/Type_MachiningPipelineCell/Attribute_CCToDLArrivalQty.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute CCToDLArrivalQty
+{
+  #keys: '3[415136.0.1262801280][415136.0.1262801279][415136.0.1262801281]'
+  Description: 'CC to DL 鍒拌揪鏁伴噺'
+  ValueType: Real
+}
diff --git a/_Main/BL/Type_MachiningPipelineCell/Attribute_CCToDLDepartureQty.qbl b/_Main/BL/Type_MachiningPipelineCell/Attribute_CCToDLDepartureQty.qbl
new file mode 100644
index 0000000..f86688c
--- /dev/null
+++ b/_Main/BL/Type_MachiningPipelineCell/Attribute_CCToDLDepartureQty.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute CCToDLDepartureQty
+{
+  #keys: '3[415136.0.1262801270][415136.0.1262801269][415136.0.1262801271]'
+  Description: 'CC to DL绂诲満鏁伴噺'
+  ValueType: Real
+}
diff --git a/_Main/BL/Type_MachiningPipelineCell/Attribute_DLToCCArrivalQty.qbl b/_Main/BL/Type_MachiningPipelineCell/Attribute_DLToCCArrivalQty.qbl
new file mode 100644
index 0000000..5891e93
--- /dev/null
+++ b/_Main/BL/Type_MachiningPipelineCell/Attribute_DLToCCArrivalQty.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute DLToCCArrivalQty
+{
+  #keys: '3[415136.0.1262801300][415136.0.1262801299][415136.0.1262801301]'
+  Description: 'DL to CC 鍒拌揪鏁伴噺'
+  ValueType: Real
+}
diff --git a/_Main/BL/Type_MachiningPipelineCell/Attribute_DLToCCDepartureQty.qbl b/_Main/BL/Type_MachiningPipelineCell/Attribute_DLToCCDepartureQty.qbl
new file mode 100644
index 0000000..7a6ceee
--- /dev/null
+++ b/_Main/BL/Type_MachiningPipelineCell/Attribute_DLToCCDepartureQty.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute DLToCCDepartureQty
+{
+  #keys: '3[415136.0.1262801290][415136.0.1262801289][415136.0.1262801291]'
+  Description: 'DL to CC绂诲満鏁伴噺'
+  ValueType: Real
+}
diff --git a/_Main/BL/Type_MachiningPipelineReport/Method_Generate.qbl b/_Main/BL/Type_MachiningPipelineReport/Method_Generate.qbl
index ceb56aa..353f594 100644
--- a/_Main/BL/Type_MachiningPipelineReport/Method_Generate.qbl
+++ b/_Main/BL/Type_MachiningPipelineReport/Method_Generate.qbl
@@ -8,32 +8,67 @@
   TextBody:
   [*
     // 鐢勫叞楦� Jun-25-2024 (created)
-    table      := selectobject( this, Source.Report, report, not report.IsShow() );
+    startyearmonth          := search.MacroPlan().StartOfPlanning().StartOfMonth().Date();
+    table                   := selectobject( this, Source.Report, report, not report.IsShow() );
     //娓呯┖涔嬪墠瀛樺偍鐨勬樉绀烘暟鎹�
     this.Clear( search.TimeUnit(), search.StartDate(), search.EndDate() );
     //杩囨护鍚庣殑浜у搧id
-    productids := selectuniquevalues( products, Elements, product, true, product.ID() );
-    sumrow     := this.Row( relnew, Name := 'SUM', RowNr := table.Row( relsize ) );
+    productids              := selectuniquevalues( products, Elements, product, true, product.ID() );
+    sumrow                  := this.Row( relnew, Name := 'SUM', RowNr := table.Row( relsize ) );
     traverse( table, Row, row, productids.Find( row.Name() ) >= 0 ){
-      showrow := this.Row( relnew, Name := row.Name(), RowNr := row.RowNr() );
-      
-      traverse( row, Cell, cell, cell.Column().TimeUnit() = search.TimeUnit() ){
-        column   := selectobject( this, Column, column, column.StartDate() = cell.Column().StartDate() and column.TimeUnit() = search.TimeUnit() );
-        
-        if( not isnull( column ) ){
-          sumcell  := selectobject( column, Cell, c, c.Row() = sumrow );
-          if( isnull( sumcell ) ){
-            sumcell := MachiningPipelineCell::Initialize( column );
-            sumrow.Cell( relinsert, sumcell );
-          }
-          
-          showcell := cell.Copy( column );
-          showrow.Cell( relinsert, showcell );
-      
-          sumcell.Add( cell );
-    
+      showrow               := this.Row( relnew, Name := row.Name(), RowNr := row.RowNr() );
+      traverse( this, Column, column ){
+        daycells            := selectset( row, Cell, cell, cell.Column().TimeUnit() = Translations::MP_GlobalParameters_Day() and
+                                            cell.Column().StartDate() >= column.StartDate() and 
+                                            cell.Column().StartDate() <= column.EndDate() );
+        maxinventory        := maxobject( daycells, Elements, e, e.Column().StartDate() );
+        ccassemblyplanqty   := sum( daycells, Elements, cell, cell.CCAssemblyPlanQty() );
+        ccproductionqty     := sum( daycells, Elements, cell, cell.CCProductionQty() );
+        cctransferqty       := sum( daycells, Elements, cell, cell.CCTransferQty() );
+        ccinventoryqty      := 0.0;
+        dlassemblyplanqty   := sum( daycells, Elements, cell, cell.DLAssemblyPlanQty() );
+        dlproductionqty     := sum( daycells, Elements, cell, cell.DLProductionQty() );
+        dltransferqty       := sum( daycells, Elements, cell, cell.DLTransferQty() );
+        dlinventoryqty      := 0.0;
+        if( column.StartDate() = startyearmonth ){//褰撴棩鏈熸槸璁″垝寮�濮嬬涓�涓湀鏃讹紝璁$畻搴撳瓨鏄疄闄呭簱瀛�
+          ccinventoryqty    := row.CCInventoryQty() + maxinventory.CCProductionQty() - maxinventory.CCToDLDepartureQty() + maxinventory.DLToCCArrivalQty() - maxinventory.CCAssemblyPlanQty();
+          dlinventoryqty    := row.DLInventoryQty() + maxinventory.DLProductionQty() - maxinventory.DLToCCDepartureQty() + maxinventory.CCToDLArrivalQty() - maxinventory.DLAssemblyPlanQty();
+        }else{
+          beforecolumn      := column.PreviousColumn();
+          beforeinventory   := selectobject( showrow, Cell, c, c.Column() = beforecolumn );
+          ccinventoryqty    := beforeinventory.CCInventoryQty() + maxinventory.CCProductionQty() - maxinventory.CCToDLDepartureQty() + maxinventory.DLToCCArrivalQty() - maxinventory.CCAssemblyPlanQty();
+          dlinventoryqty    := beforeinventory.DLInventoryQty() + maxinventory.DLProductionQty() - maxinventory.DLToCCDepartureQty() + maxinventory.DLToCCDepartureQty() - maxinventory.DLAssemblyPlanQty();
         }
+        sumcell  := selectobject( column, Cell, c, c.Row() = sumrow );
+        if( isnull( sumcell ) ){
+          sumcell           := column.Cell( relnew, CCAssemblyPlanQty  := 0, 
+                                             CCProductionQty           := 0, 
+                                             CCTransferQty             := 0,
+                                             CCInventoryQty            := 0, 
+                                             DLAssemblyPlanQty         := 0,
+                                             DLProductionQty           := 0, 
+                                             DLTransferQty             := 0,
+                                             DLInventoryQty            := 0 );
+          sumrow.Cell( relinsert, sumcell );
+        }
+        showcell            := column.Cell( relnew, CCAssemblyPlanQty  := ccassemblyplanqty, 
+                                             CCProductionQty           := ccproductionqty, 
+                                             CCTransferQty             := cctransferqty,
+                                             CCInventoryQty            := ccinventoryqty, 
+                                             DLAssemblyPlanQty         := dlassemblyplanqty,
+                                             DLProductionQty           := dlproductionqty, 
+                                             DLTransferQty             := dltransferqty,
+                                             DLInventoryQty            := dlinventoryqty );
+        showrow.Cell( relinsert, showcell );
+      
+        sumcell.Add( showcell );
       }
     }
+    rows                    := selectsortedset( this, Row, row, row.Name(), row.RowNr() );
+    i                       := 0;
+    traverse( rows, Elements, e ){
+      e.RowNr( i );
+      i                     := i + 1;
+    }
   *]
 }
diff --git a/_Main/BL/Type_MachiningPipelineRow/Attribute_CCInventoryQty.qbl b/_Main/BL/Type_MachiningPipelineRow/Attribute_CCInventoryQty.qbl
new file mode 100644
index 0000000..d5a8ccd
--- /dev/null
+++ b/_Main/BL/Type_MachiningPipelineRow/Attribute_CCInventoryQty.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute CCInventoryQty
+{
+  #keys: '3[415136.0.1262801322][415136.0.1262801321][415136.0.1262801323]'
+  Description: 'CC瀹為檯搴撳瓨鏁版嵁'
+  ValueType: Real
+}
diff --git a/_Main/BL/Type_MachiningPipelineRow/Attribute_DLInventoryQty.qbl b/_Main/BL/Type_MachiningPipelineRow/Attribute_DLInventoryQty.qbl
new file mode 100644
index 0000000..7de5683
--- /dev/null
+++ b/_Main/BL/Type_MachiningPipelineRow/Attribute_DLInventoryQty.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute DLInventoryQty
+{
+  #keys: '3[415136.0.1262801338][415136.0.1262801337][415136.0.1262801339]'
+  Description: 'DL瀹為檯搴撳瓨鏁版嵁'
+  ValueType: Real
+}
diff --git a/_Main/BL/Type_MachiningPipelineRow/Method_SetDepartureAndArrivalValue.qbl b/_Main/BL/Type_MachiningPipelineRow/Method_SetDepartureAndArrivalValue.qbl
new file mode 100644
index 0000000..7904258
--- /dev/null
+++ b/_Main/BL/Type_MachiningPipelineRow/Method_SetDepartureAndArrivalValue.qbl
@@ -0,0 +1,24 @@
+Quintiq file version 2.0
+#parent: #root
+Method SetDepartureAndArrivalValue (
+  MachiningPipelineColumn column,
+  Boolean iscctodl,
+  Real departureqty,
+  Real arriveqty
+)
+{
+  Description: '璁剧疆绂诲巶鍒拌揪鏁伴噺'
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jun-24-2024 (created)
+    cell := selectobject( this, Cell, cell, cell.Column() = column );
+    
+    if( iscctodl ){
+      cell.CCToDLDepartureQty( cell.CCToDLDepartureQty() + departureqty );
+      cell.CCToDLArrivalQty( cell.CCToDLArrivalQty() + arriveqty );
+    } else {
+      cell.DLToCCDepartureQty( cell.DLToCCDepartureQty() + departureqty );
+      cell.DLToCCArrivalQty( cell.DLToCCArrivalQty() + arriveqty );
+    }
+  *]
+}
diff --git a/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Download.qbl b/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Download.qbl
index 718c62f..f58ef1b 100644
--- a/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Download.qbl
+++ b/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Download.qbl
@@ -78,39 +78,39 @@
           //Attribute
           //闀挎槬瑁呴厤璁″垝
           ccaqcellElement := xmlDOM.CreateElement( "cell" );
-          ccaqcellElement.SetAttribute( "value", '闀挎槬瑁呴厤璁″垝' );//CCAssemblyPlanQty
+          ccaqcellElement.SetAttribute( "value", 'CC瑁呴厤璁″垝' );//CCAssemblyPlanQty
           attricolumnelement.AppendChild( ccaqcellElement );
           //闀挎槬鐢熶骇璁″垝
           ccpqcellElement := xmlDOM.CreateElement( "cell" );
-          ccpqcellElement.SetAttribute( "value", '闀挎槬鐢熶骇璁″垝' );//CCProductionQty
+          ccpqcellElement.SetAttribute( "value", 'CC鏈哄姞璁″垝' );//CCProductionQty
           attricolumnelement.AppendChild( ccpqcellElement );
           //闀挎槬璋冩嫧璁″垝
           cctqcellElement := xmlDOM.CreateElement( "cell" );
-          cctqcellElement.SetAttribute( "value", '闀挎槬璋冩嫧璁″垝' );//CCTransferQty
+          cctqcellElement.SetAttribute( "value", 'CC to DL' );//CCTransferQty
           attricolumnelement.AppendChild( cctqcellElement );
           //闀挎槬搴撳瓨
           cciqcellElement := xmlDOM.CreateElement( "cell" );
-          cciqcellElement.SetAttribute( "value", '闀挎槬搴撳瓨' );//CCInventoryQty
+          cciqcellElement.SetAttribute( "value", 'CC搴撳瓨' );//CCInventoryQty
           attricolumnelement.AppendChild( cciqcellElement );
           //澶ц繛瑁呴厤璁″垝
           dlaqcellElement := xmlDOM.CreateElement( "cell" );
-          dlaqcellElement.SetAttribute( "value", '澶ц繛瑁呴厤璁″垝' );//DLAssemblyPlanQty
+          dlaqcellElement.SetAttribute( "value", 'DL瑁呴厤璁″垝' );//DLAssemblyPlanQty
           attricolumnelement.AppendChild( dlaqcellElement );
           //澶ц繛鐢熶骇璁″垝
           dlpqcellElement := xmlDOM.CreateElement( "cell" );
-          dlpqcellElement.SetAttribute( "value", '澶ц繛鐢熶骇璁″垝' );//DLProductionQty
+          dlpqcellElement.SetAttribute( "value", 'DL鏈哄姞璁″垝' );//DLProductionQty
           attricolumnelement.AppendChild( dlpqcellElement );
           //澶ц繛璋冩嫧璁″垝
           dltqcellElement := xmlDOM.CreateElement( "cell" );
-          dltqcellElement.SetAttribute( "value", '澶ц繛璋冩嫧璁″垝' );//DLTransferQty
+          dltqcellElement.SetAttribute( "value", 'DL to CC' );//DLTransferQty
           attricolumnelement.AppendChild( dltqcellElement );
           //澶ц繛搴撳瓨
           dliqcellElement := xmlDOM.CreateElement( "cell" );
-          dliqcellElement.SetAttribute( "value", '澶ц繛搴撳瓨' );//DLInventoryQty
+          dliqcellElement.SetAttribute( "value", 'DL搴撳瓨' );//DLInventoryQty
           attricolumnelement.AppendChild( dliqcellElement );
           //闀挎槬 + 澶ц繛 搴撳瓨
           tiqcellElement := xmlDOM.CreateElement( "cell" );
-          tiqcellElement.SetAttribute( "value", '闀挎槬 + 澶ц繛搴撳瓨' );//TotalInventoryQty
+          tiqcellElement.SetAttribute( "value", 'CC + DL搴撳瓨' );//TotalInventoryQty
           attricolumnelement.AppendChild( tiqcellElement );
         }
         //闀挎槬瑁呴厤璁″垝
diff --git a/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl b/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl
index 9d3c315..392964d 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,75 @@
       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( isccassemnly ){
+            row.CCInventoryQty( row.CCInventoryQty() + inventoryqty );
+          }
+          if( isdlassemnly ){
+            row.DLInventoryQty( 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 +124,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 );
   *]
 }
diff --git a/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_InitiateSearch.qbl b/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_InitiateSearch.qbl
index 2f69e1e..5115534 100644
--- a/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_InitiateSearch.qbl
+++ b/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_InitiateSearch.qbl
@@ -9,7 +9,7 @@
     // 鐢勫叞楦� Sep-29-2024 (created)
     search                    := owner.MachiningPipelineSearch();
     if( isnull( search ) ){
-      owner.MachiningPipelineSearch( relnew, StartDate := Date::MinDate(), EndDate := Date::MaxDate(), TimeUnit := Translations::MP_GlobalParameters_Day() );
+      search                  := owner.MachiningPipelineSearch( relnew, StartDate := Date::MinDate(), EndDate := Date::MaxDate(), TimeUnit := Translations::MP_GlobalParameters_Day() );
     }else{
       search                  := owner.MachiningPipelineSearch();
       search.TimeUnit( Translations::MP_GlobalParameters_Day() );
diff --git a/_Main/BL/Type_NewOfflinePlanCell/StaticMethod_DeductionOfReplacementLoss.qbl b/_Main/BL/Type_NewOfflinePlanCell/StaticMethod_DeductionOfReplacementLoss.qbl
index 6b23ce9..b450973 100644
--- a/_Main/BL/Type_NewOfflinePlanCell/StaticMethod_DeductionOfReplacementLoss.qbl
+++ b/_Main/BL/Type_NewOfflinePlanCell/StaticMethod_DeductionOfReplacementLoss.qbl
@@ -14,7 +14,7 @@
     allProductionLines := selectuniquevalues( newNOPT, NewOfflinePlanRow, tempNOPR, true, tempNOPR.ProductionLine() );
     
     traverse ( allProductionLines, Elements, pl
-    //           , pl = "eMotor Assy (France)" 
+    //           , pl = "CC MoMo" 
              ) 
     {
       // 涓嬬嚎璁″垝褰撳墠浜х嚎涓嬬殑琛�
@@ -24,11 +24,12 @@
       preNOPCell := null( NewOfflinePlanCell );
       
       traverse ( newNOPT, NewOfflinePlanColumn, nopc
-    //             , nopc.StartDate() >= macroPlan.StartOfPlanning().Date() and nopc.StartDate() <= Date::Construct( 2024, 4, 17 ) // 娴嬭瘯鏃跺彲浠ヨ繃婊ゆ椂闂�
+    //             , nopc.StartDate() >= macroPlan.StartOfPlanning().Date() and nopc.StartDate() <= Date::Construct( 2025, 1, 16 ) // 娴嬭瘯鏃跺彲浠ヨ繃婊ゆ椂闂�
                ) 
       {         
         for ( i := 1; i < 10; i++ ) {
-          nopcell := select( noprs, Elements.NewOfflinePlanCell, tempNOPC, tempNOPC.NewOfflinePlanColumn() = nopc and tempNOPC.OrderNr() = i );
+          nopcell := select( noprs, Elements.NewOfflinePlanCell, tempNOPC, tempNOPC.NewOfflinePlanColumn() = nopc and tempNOPC.OrderNr() = i and tempNOPC.Order() <> "" );
+          
           // 鎹㈠瀷鎹熷け鍙傛暟
           cls     := select( macroPlan, ChangeLossSetting, tempCLS, 
                              tempCLS.ProductFirst().ID()  = guard( preNOPCell.NewOfflinePlanRow().ProductID(), "" ) and
@@ -39,10 +40,12 @@
     
           // 鎵e噺鎹㈠瀷鎹熷け
           if ( not isnull( preNOPCell ) and not isnull( nopcell ) and not isnull( cls ) ) {
-            preNOPCell.Quantity( preNOPCell.Quantity() - cls.ChangeLossNumber() );                 
+    //        info( "褰撳墠浜у搧搴忓彿锛�", nopcell.OrderNr(),  "    ", nopcell.Order(), "    ", i );
     //        info( "褰撳墠鍒楁椂闂达細", nopc.StartDate().Format( "Y-M2-D2" ), 
     //              "    涓婁竴涓骇鍝佸綋鍓嶅簭鍙凤細", preNOPCell.Order(), "    涓婁竴涓骇鍝佹暟閲忥細", preNOPCell.Quantity(), "    涓婁竴涓骇鍝佸悕锛�", preNOPCell.NewOfflinePlanRow().ProductID(),
-    //              "    褰撳墠浜у搧搴忓彿锛�"      , nopcell.Order()   , "    褰撳墠浜у搧鏁伴噺锛�"     , nopcell.Quantity(), "    褰撳墠浜у搧鍚嶏細"  , nopcell.NewOfflinePlanRow().ProductID() );
+    //              "    褰撳墠浜у搧搴忓彿锛�"      , nopcell.Order()   , "    褰撳墠浜у搧鏁伴噺锛�"     , nopcell.Quantity(), "    褰撳墠浜у搧鍚嶏細"  , nopcell.NewOfflinePlanRow().ProductID(), 
+    //              "    闇�瑕佹墸鍑忕殑鏁伴噺锛�", cls.ChangeLossNumber() );
+            preNOPCell.Quantity( preNOPCell.Quantity() - cls.ChangeLossNumber() ); 
           }
           
           // 璁剧疆涓婁竴涓敓浜х殑浜у搧Cell
diff --git a/_Main/BL/Type_PackagingPlanCell/StaticMethod_GenerateReport.qbl b/_Main/BL/Type_PackagingPlanCell/StaticMethod_GenerateReport.qbl
index e45b9e4..9408e3a 100644
--- a/_Main/BL/Type_PackagingPlanCell/StaticMethod_GenerateReport.qbl
+++ b/_Main/BL/Type_PackagingPlanCell/StaticMethod_GenerateReport.qbl
@@ -106,8 +106,10 @@
     PackagingPlanCell::CalculationPackagingPlanProperties();
     Transaction::Transaction().Propagate( relation( PackagingPlanCell, Next ) );
     
-    // 璁剧疆鍖呰&鎷嗗寘-鏁伴噺
-    PackagingPlanCell::SetPackagingAndUnpackingValues( macroPlan );
+    // 璁剧疆鍖呰&鎷嗗寘-鏁伴噺锛堝ぇ杩炲伐鍘傦級
+    PackagingPlanCell::SetPackagingAndUnpackingValuesDL( macroPlan );
+    // 璁剧疆鍖呰&鎷嗗寘-鏁伴噺锛堥暱鏄ュ伐鍘傦級
+    PackagingPlanCell::SetPackagingAndUnpackingValuesCC( macroPlan );
     //traverse ( macroPlan, PackagingPlanRow, ppr, ( ppr.ProductID() = "Windshield" and ppr.StockingPointID() = "Bosch" ) or ( ppr.ProductID() = "Windshield" and ppr.StockingPointID() = "Components (Spain)" ) ) {
     //  traverse ( ppr, PackagingPlanCell, ppc/*, ppc.StartDate() = Date::Construct( 2020, 4, 1 )*/ ) {
     //    // 璁剧疆鍖呰鏁伴噺
diff --git a/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesCC.qbl b/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesCC.qbl
new file mode 100644
index 0000000..b8ca3b8
--- /dev/null
+++ b/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesCC.qbl
@@ -0,0 +1,31 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SetPackagingAndUnpackingValuesCC (
+  MacroPlan macroPlan
+)
+{
+  TextBody:
+  [*
+    traverse ( macroPlan, PackagingPlanRow, ppr, ppr.Factory() = "闀挎槬宸ュ巶" /*and ppr.ProductID() = "06K103011CM"*/ ) {
+      traverse ( ppr, PackagingPlanCell, ppcell/*, ppcell.StartDate() <= Date::Construct( 2025, 1, 4 )*/ ) {
+        unpackagedQuantity := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT, 
+                                   tempPIT.ProductID()          = ppcell.PackagingPlanRow().ProductID()                               and
+                                   tempPIT.Trip().Departure().Date() = ppcell.StartDate()                                             and
+                                   tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "澶栫搴�" )      and
+                                   tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "绾胯竟搴�" ),
+                                   tempPIT.Quantity()
+                                  );
+        ppcell.Unpacking( unpackagedQuantity );
+        
+        packagedQuantity := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT, 
+                                 tempPIT.ProductID()          = ppcell.PackagingPlanRow().ProductID()                               and
+                                 tempPIT.Trip().Departure().Date() = ppcell.StartDate()                                             and
+                                 tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "绾胯竟搴�" )      and
+                                 tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "澶栫搴�" ),
+                                 tempPIT.Quantity()
+                                );
+        ppcell.Package( packagedQuantity );
+      }
+    }
+  *]
+}
diff --git a/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValues.qbl b/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesDL.qbl
similarity index 96%
rename from _Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValues.qbl
rename to _Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesDL.qbl
index fab92f2..3e2e0e5 100644
--- a/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValues.qbl
+++ b/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesDL.qbl
@@ -1,6 +1,6 @@
 Quintiq file version 2.0
 #parent: #root
-StaticMethod SetPackagingAndUnpackingValues (
+StaticMethod SetPackagingAndUnpackingValuesDL (
   MacroPlan macroPlan
 )
 {
@@ -10,7 +10,7 @@
     plannedStartDate := macroPlan.StartOfPlanning().Date();
     
     // 璁剧疆鍖呰鍊硷紙绗﹀悎lotsize鍜屼竴鏃ユ渶澶у寘瑁呴噺锛�
-    traverse ( macroPlan, PackagingPlanRow, ppr/*, ppr.Factory() = "澶ц繛宸ュ巶" and ppr.ProductID() = "06K103011CM"*/ ) {
+    traverse ( macroPlan, PackagingPlanRow, ppr, ppr.Factory() = "澶ц繛宸ュ巶" /*and ppr.ProductID() = "06K103011CM"*/ ) {
       traverse ( ppr, PackagingPlanCell, ppcell/*, ppcell.StartDate() <= Date::Construct( 2025, 1, 4 )*/ ) {
         // Product_MP
         pmp                     := select( macroPlan, Product_MP, tempPMP, tempPMP.IsLeaf() and tempPMP.ID() = ppr.ProductID() );
@@ -93,7 +93,7 @@
     }
     
     // 璁剧疆鎷嗗寘鍊硷紙绗﹀悎lotsize鍜屼竴鏃ユ渶澶у寘瑁呴噺锛�
-    traverse ( macroPlan, PackagingPlanRow, ppr/*, ppr.Factory() = "澶ц繛宸ュ巶" and ppr.ProductID() = "06K103011CM"*/ ) {
+    traverse ( macroPlan, PackagingPlanRow, ppr, ppr.Factory() = "澶ц繛宸ュ巶" /*and ppr.ProductID() = "06K103011CM"*/ ) {
       traverse ( ppr, PackagingPlanCell, ppcell/*, ppcell.StartDate() <= Date::Construct( 2025, 1, 4 )*/ ) {
         // Product_MP
         pmp                     := select( macroPlan, Product_MP, tempPMP, tempPMP.IsLeaf() and tempPMP.ID() = ppr.ProductID() );
diff --git a/_Main/Sys/Repr/Global/MachiningPipelineCell.qrp b/_Main/Sys/Repr/Global/MachiningPipelineCell.qrp
index 77a9570..c4b4d1e 100644
--- a/_Main/Sys/Repr/Global/MachiningPipelineCell.qrp
+++ b/_Main/Sys/Repr/Global/MachiningPipelineCell.qrp
@@ -11,6 +11,17 @@
   {
     AttributeKey: '[415136.0.886711533]'
     Synonym: 'CC搴撳瓨'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF9999'
+        ConditionBody: 'object.CCInventoryQty() < 0'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation CCProductionQty
   {
@@ -31,6 +42,17 @@
   {
     AttributeKey: '[415136.0.894481161]'
     Synonym: 'DL搴撳瓨'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF9999'
+        ConditionBody: 'object.DLInventoryQty() < 0'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation DLProductionQty
   {
@@ -46,6 +68,17 @@
   {
     AttributeKey: '[415136.0.894481168]'
     Synonym: 'CC+DL鎬诲簱瀛�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF9999'
+        ConditionBody: 'object.TotalInventoryQty() < 0'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   RelationRepresentation AsFirstCellInColumn { RelationKey: '[415136.0.894469842]' Visibility: 'Normal' }
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormMachineStockData/Component_ListMachineStockData.def b/_Main/UI/MacroPlannerWebApp/Component_FormMachineStockData/Component_ListMachineStockData.def
index f9f1e69..3ab0d77 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormMachineStockData/Component_ListMachineStockData.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormMachineStockData/Component_ListMachineStockData.def
@@ -28,7 +28,7 @@
       ]
       Properties:
       [
-        Columns: '[{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"MaterialNo","title":"MaterialNo","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"MaterialNo"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"MaterialName","title":"MaterialName","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"MaterialName"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Fac","title":"Fac","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Fac"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"FacName","title":"FacName","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"FacName"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"LineType","title":"LineType","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"LineType"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"DDay","title":"DDay","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"DDay"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Total","title":"Total","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Total"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"AllTotal","title":"AllTotal","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"AllTotal"}}]'
+        Columns: '[{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"MaterialNo","title":"MaterialNo","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"MaterialNo"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"LineType","title":"LineType","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"LineType"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"DDay","title":"DDay","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"DDay"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Total","title":"Total","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Total"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Lgort","title":"Lgort","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Lgort"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Fac","title":"Fac","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Fac"}}]'
         ContextMenu: 'listContextMenuMachineStockData'
         SortCriteria: 'desc:DDay'
         Taborder: 2
diff --git a/_Main/UI/MacroPlannerWebApp/Views/Machine_stock_data.vw b/_Main/UI/MacroPlannerWebApp/Views/Machine_stock_data.vw
index 0c37faa..186a0ac 100644
--- a/_Main/UI/MacroPlannerWebApp/Views/Machine_stock_data.vw
+++ b/_Main/UI/MacroPlannerWebApp/Views/Machine_stock_data.vw
@@ -35,30 +35,21 @@
               subtotals: ''
               width: 150
             }
-            column_MaterialName
-            {
-              columnId: 'MaterialName'
-              dataPath: 'MaterialName'
-              dataType: 'string'
-              index: 1
-              subtotals: ''
-              width: 150
-            }
             column_Fac
             {
               columnId: 'Fac'
               dataPath: 'Fac'
               dataType: 'string'
-              index: 2
+              index: 1
               subtotals: ''
               width: 150
             }
-            column_FacName
+            column_Lgort
             {
-              columnId: 'FacName'
-              dataPath: 'FacName'
+              columnId: 'Lgort'
+              dataPath: 'Lgort'
               dataType: 'string'
-              index: 3
+              index: 2
               subtotals: ''
               width: 150
             }
@@ -67,7 +58,7 @@
               columnId: 'LineType'
               dataPath: 'LineType'
               dataType: 'string'
-              index: 4
+              index: 3
               subtotals: ''
               width: 150
             }
@@ -76,7 +67,7 @@
               columnId: 'DDay'
               dataPath: 'DDay'
               dataType: 'date'
-              index: 5
+              index: 4
               subtotals: ''
               width: 150
             }
@@ -85,16 +76,7 @@
               columnId: 'Total'
               dataPath: 'Total'
               dataType: 'real'
-              index: 6
-              subtotals: ''
-              width: 150
-            }
-            column_AllTotal
-            {
-              columnId: 'AllTotal'
-              dataPath: 'AllTotal'
-              dataType: 'real'
-              index: 7
+              index: 5
               subtotals: ''
               width: 150
             }

--
Gitblit v1.9.3