From 7a48109b4bc75b886dd7180d7db35ad2bf33fb67 Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期四, 14 十一月 2024 19:06:44 +0800
Subject: [PATCH] 修复一些bug

---
 _Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl                                         |  128 +++++++++++++++------
 _Main/UI/MacroPlannerWebApp/Component_FormLockPeriod/Response_ListLockPeriod_mEnable_OnClick#21.def             |    2 
 _Main/UI/MacroPlannerWebApp/Component_Form701/Response_pRibbon504_bComparison_OnClick.def                       |    4 
 _Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanComparison/Response_PanelRibbon763_184_bExport_OnClick.def |    2 
 _Main/BL/Type_OfflinePlanArchiveVersionRow/Attribute_StockingPointID.qbl                                        |    7 +
 _Main/UI/MacroPlannerWebApp/Component_Form701/Component_pRibbon.def                                             |    2 
 _Main/UI/MacroPlannerWebApp/Component_Form701/Response_pRibbon504_dhXMLDataListener_OnDataChanged.def           |    4 
 _Main/UI/MacroPlannerWebApp/Component_Form701/Component_pRibbon504.def                                          |    2 
 /dev/null                                                                                                       |   18 ---
 _Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_Create.qbl                                                  |    3 
 _Main/UI/MacroPlannerWebApp/Component_Form701/Response_pRibbon504_bExport_OnClick.def                           |   18 +++
 _Main/UI/MacroPlannerWebApp/Component_Form701/Response_pRibbon504_dhTimeUnit_OnCreated.def                      |    4 
 _Main/BL/Type_OfflinePlanArchiveVersion/Method_GetRow.qbl                                                       |    4 
 _Main/UI/MacroPlannerWebApp/Component_Form701/Response_pRibbon504_rbgTimeUnit_OnUserChanged.def                 |    4 
 _Main/UI/MacroPlannerWebApp/Component_DialogCreateLockPeriod/Component_pProduct#661.def                         |    2 
 _Main/BL/Type_LockPeriod/Method_Enable.qbl                                                                      |    8 
 _Main/UI/MacroPlannerWebApp/Component_DialogCreateLockPeriod/Response_pnlActions_btnOk_OnClick.def              |    8 
 _Main/BL/Type_LockPeriod/StaticMethod_Create.qbl                                                                |    7 
 _Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateTempTable.qbl                                         |   77 ++++++++++++
 19 files changed, 220 insertions(+), 84 deletions(-)

diff --git a/_Main/BL/Type_LockPeriod/Method_Enable.qbl b/_Main/BL/Type_LockPeriod/Method_Enable.qbl
index ccff833..56456a3 100644
--- a/_Main/BL/Type_LockPeriod/Method_Enable.qbl
+++ b/_Main/BL/Type_LockPeriod/Method_Enable.qbl
@@ -1,19 +1,19 @@
 Quintiq file version 2.0
 #parent: #root
 Method Enable (
-  const NewOfflinePlanTable offlinePlanTable
+  const OfflinePlanArchiveVersion offlinePlanTable
 )
 {
   TextBody:
   [*
     // Akari Oct-30-2024 (created)
-    offlinePlanRow := select( offlinePlanTable,NewOfflinePlanRow,row,row.ProductID() = this.ProductInStockingPoint_MP().ProductID() and row.StockingPointID() = this.ProductInStockingPoint_MP().StockingPointID() );
+    offlinePlanRow := select( offlinePlanTable,Row,row,row.ProductID() = this.ProductInStockingPoint_MP().ProductID() and row.StockingPointID() = this.ProductInStockingPoint_MP().StockingPointID() );
     
-    offlinePlanCells := selectset( offlinePlanRow, NewOfflinePlanCell,cell,true );
+    offlinePlanCells := selectset( offlinePlanRow, Cell,cell,cell.Column().TimeUnit() = "Day" );
     offlinePlanCellIndexTree := NamedValueTree::Create();
     for( i := 0; i< offlinePlanCells.Size(); i++ ){
       offlinePlanCell := offlinePlanCells.Element( i );
-      offlinePlanCellHandle := offlinePlanCellIndexTree.GetHandle( offlinePlanCell.NewOfflinePlanColumn().StartDate().AsQUILL() );
+      offlinePlanCellHandle := offlinePlanCellIndexTree.GetHandle( offlinePlanCell.Column().StartDate().AsQUILL() );
       offlinePlanCellIndexTree.Root().AddChild( offlinePlanCellHandle,i );
     }
     
diff --git a/_Main/BL/Type_LockPeriod/StaticMethod_Create.qbl b/_Main/BL/Type_LockPeriod/StaticMethod_Create.qbl
index 667e135..2095968 100644
--- a/_Main/BL/Type_LockPeriod/StaticMethod_Create.qbl
+++ b/_Main/BL/Type_LockPeriod/StaticMethod_Create.qbl
@@ -2,7 +2,8 @@
 #parent: #root
 StaticMethod Create (
   ProductInStockingPoint_MP owner,
-  Date lockDate
+  Date lockDate,
+  const InterfaceDataset interfaceDataset
 )
 {
   TextBody:
@@ -10,9 +11,7 @@
     // rislai Jun-13-2024 (created)
     lockPeriod := owner.LockPeriod( relnew, LockDate := lockDate );
     
-    macroPlan := owner.MacroPlan();
-    
-    offlineTable := select( macroPlan,NewOfflinePlanTable,table,true );
+    offlineTable := select( interfaceDataset,OfflinePlanArchiveVersion,table,not table.IsShow() );
     
     if( not isnull( offlineTable )){
       lockPeriod.Enable( offlineTable ); 
diff --git a/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_Create.qbl b/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_Create.qbl
index 0dae889..dd478ff 100644
--- a/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_Create.qbl
+++ b/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_Create.qbl
@@ -17,7 +17,8 @@
     table := archive.ArchiveTable( relnew,Name := ArchiveCell_ScheduleSummary::GetTableName(),MacroPlanMDSID := macroPlan.MDSID(),MacroPlanName := macroPlan.MDSMacroPlan().Description());
     
     startDate := macroPlan.StartOfPlanning().Date();
-    endDate := maxselect( macroPlan,Unit.UnitPeriod.astype( UnitPeriodTime ).Period_MP,period,period.TimeUnit() = Translations::MP_GlobalParameters_Day(),period.EndDate()).EndDate();
+    endDate := macroPlan.StartOfPlanning().Date() + 7;
+    //endDate := maxselect( macroPlan,Unit.UnitPeriod.astype( UnitPeriodTime ).Period_MP,period,period.TimeUnit() = Translations::MP_GlobalParameters_Day(),period.EndDate()).EndDate();
     
     columns := construct( ArchiveColumns );
     columnIndexTree := NamedValueTree::Create();
diff --git a/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl b/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl
index d0a3c05..28ced4a 100644
--- a/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl
+++ b/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl
@@ -9,12 +9,14 @@
   TextBody:
   [*
     // rislai Aug-7-2024 (created)
+    // 鑾峰彇瀛樻。鏁版嵁
     tables := selectset( archive,ArchiveTable,table,table.Name() = ArchiveCell_ScheduleSummary::GetTableName() );
     
+    // 鑾峰彇瀹為檯鐢熶骇鏁版嵁
     scheduleSummaryOutputDataIndexTree := NamedValueTree::Create();
     scheduleSummaryOutputDatas := selectset( archive,ScheduleSummaryOutputLine.ScheduleSummaryOutputData,data,
                                              exists( tables,Elements.ArchiveRow,row,row.CustomName() = data.ScheduleSummaryOutputLine().LineName() ));
-    
+    // 鏋勫缓瀹為檯鐢熶骇鏁版嵁绱㈠紩
     for( i :=0;i < scheduleSummaryOutputDatas.Size();i++ ){
       scheduleSummaryOutputData := scheduleSummaryOutputDatas.Element( i );
       scheduleSummaryOutputDataKey := scheduleSummaryOutputData.ScheduleSummaryOutputLine().LineName() + scheduleSummaryOutputData.Date().AsQUILL();
@@ -22,14 +24,17 @@
       scheduleSummaryOutputDataIndexTree.Root().AddChild( scheduleSummaryOutputDataHandle,i );
     }
     
+    // 娓呴櫎鍘嗗彶鏁版嵁
     traverse( recycleBin,LocalTable,table,table.Name() = ArchiveCell_ScheduleSummary::GetTableName() ){
       table.Delete();
     }
     localTable := recycleBin.LocalTable( relnew,Name := ArchiveCell_ScheduleSummary::GetTableName() );
     
+    // 鑾峰彇寮�濮嬫椂闂村拰缁撴潫鏃堕棿
     startDate := minselect( tables,Elements.ArchiveColumn,column,column.CustomDate() ).CustomDate();
     endDate := maxselect( tables,Elements.ArchiveColumn,column,column.CustomDate() ).CustomDate();
     
+    // 鏋勫缓LocalColumn鐨勭储寮�
     localColumns := construct( LocalColumns );
     localColumnIndexTree := NamedValueTree::Create();
     for( i := startDate.StartOfMonth(); i <= endDate.StartOfMonth(); i := i.StartOfNextMonth() ){
@@ -39,12 +44,15 @@
        localColumnIndexTree.Root().AddChild( localColumnHandle,localColumns.Size() - 1 );
     }
     
+    // LocalRow鐨勭储寮�
     localRows := construct( LocalRows );
     localRowIndexTree := NamedValueTree::Create();
     
+    // LocalCell鐨勭储寮�
     localCells := construct( LocalCell_ScheduleSummarys );
     localCellIndexTree := NamedValueTree::Create();
     
+    // unit鐨勭储寮�
     units := selectset( macroPlan,Unit,unit,unit.HasCapacityTypeTime() and not unit.HasChild());
     unitIndexTree := NamedValueTree::Create();
     for( i := 0 ; i< units.Size() ; i++ ){
@@ -53,9 +61,9 @@
       unitIndexTree.Root().AddChild( unitHandle,i );
     }
     
-    
+    // 寮�濮嬫嫾鎺ュ瓨妗f暟鎹�
     traverse( tables,Elements.ArchiveRow,row ){
-       rowMacroPlanMDSID := row.ArchiveTable().MacroPlanMDSID();
+       // 鍏堝鎵緇ocalRow锛屾壘涓嶅埌灏辨柊寤猴紝骞跺垱寤虹储寮�
        localRow := null( LocalRow );
        {
          localRowHandle := localRowIndexTree.GetHandle( row.Name() );
@@ -68,32 +76,20 @@
            localRow := localRows.Element( localRowIndex.GetValueAsNumber());
          }
        }
+       // 寰幆鍒涘缓鏈堟暟鎹�
        traverse( localColumns,Elements,localColumn ){
-          cells := selectset( row,ArchiveCell.astype( ArchiveCell_ScheduleSummary ),cell,
-                              ifexpr( rowMacroPlanMDSID = macroPlan.MDSID() , true , cell.IsFristWeekData()) and
+          archiveCells := selectset( row,ArchiveCell.astype( ArchiveCell_ScheduleSummary ),cell,
+                              cell.IsFristWeekData() and
                               cell.ArchiveColumn().CustomDate() >= localColumn.CustomDate() and 
                               cell.ArchiveColumn().CustomDate() < localColumn.CustomDate().StartOfNextMonth() );
           
           isFuture := macroPlan.StartOfPlanning().Date() < localColumn.CustomDate();
           
+          workingDay := 0;
+          capacity := 0.0;
           output := 0.0;
-          if( isFuture ){
-            unitHandle := unitIndexTree.GetHandle( row.Name() );
-            unitIndex := guard( unitIndexTree.Root().Child( unitHandle ),null( NamedValue ));
-            if( not isnull( unitIndex )){
-              unit := units.Element( unitIndex.GetValueAsNumber() );
-              output := sum( unit,UnitPeriod.astype( UnitPeriodTime ).PeriodTask_MP.NewSupply,np,
-                             np.PeriodTask_MP().UnitPeriod().StartDate() >= localColumn.CustomDate() and 
-                             np.PeriodTask_MP().UnitPeriod().StartDate() < localColumn.CustomDate().StartOfNextMonth() and
-                             np.PeriodTask_MP().UnitPeriod().Period_MP().TimeUnit() = "Day",
-                             np.Quantity() );
-              output := sum( unit,StockingPoint_MP.ProductInStockingPoint_MP.ProductInStockingPointInPeriod,pispip,
-                             pispip.Period_MP().StartDate() >= localColumn.CustomDate() and
-                             pispip.Period_MP().StartDate() < localColumn.CustomDate().StartOfNextMonth() and
-                             pispip.Period_MP().TimeUnit() = "Day",
-                             pispip.NewSupplyProductionQuantity());
-            }
-          }else{
+          shiftPatterns := construct( Strings );
+          if( not isFuture ){
             scheduleSummaryOutputDataKey := row.Name() + localColumn.CustomDate().AsQUILL();
             scheduleSummaryOutputDataHandle := scheduleSummaryOutputDataIndexTree.GetHandle( scheduleSummaryOutputDataKey );
             scheduleSummaryOutputDataIndex := guard( scheduleSummaryOutputDataIndexTree.Root().Child( scheduleSummaryOutputDataHandle ),null( NamedValue ));
@@ -102,11 +98,8 @@
               output := scheduleSummaryOutputData.Output();
             }
           }
-          
-          workingDay := 0;
-          capacity := 0.0;
-          shiftPatterns := construct( Strings );
-          traverse( cells,Elements,cell ){
+    
+          traverse( archiveCells,Elements,cell ){
              workingDay := workingDay + cell.WorkingDay();
              capacity := capacity + cell.Capacity();
              if( cell.ShiftPattern() <> "" ){
@@ -133,21 +126,80 @@
        }
     }
     
+    tempArchiveTable := ArchiveCell_ScheduleSummary::CreateTempTable( macroPlan,recycleBin );
+    traverse( tempArchiveTable,LocalRow,row ){
+       
+       localRow := null( LocalRow );
+       {
+         localRowHandle := localRowIndexTree.GetHandle( row.CustomName());
+         localRowIndex := guard( localRowIndexTree.Root().Child( localRowHandle ),null( NamedValue ));
+         if( isnull( localRowIndex )){
+           localRow := localTable.LocalRow( relnew,CustomName := row.CustomName(),Index := localTable.GetRowIndexCache() );
+           localRows.Add( localRow );
+           localRowIndexTree.Root().AddChild( localRowHandle,localRows.Size() - 1 );
+         }else{
+           localRow := localRows.Element( localRowIndex.GetValueAsNumber());
+         }
+       }
+       traverse( localColumns,Elements,localColumn ){
+          archiveCells := selectset( row,LocalCell.astype( LocalCell_ScheduleSummary ),cell,
+                              cell.LocalColumn().CustomDate() >= localColumn.CustomDate() and 
+                              cell.LocalColumn().CustomDate() < localColumn.CustomDate().StartOfNextMonth() );
+          
+          workingDay := 0;
+          capacity := 0.0;
+          output := 0.0;
+          shiftPatterns := construct( Strings );
+          isFuture := macroPlan.StartOfPlanning().Date() < localColumn.CustomDate();
+          
+          if( isFuture ){
+            unitHandle := unitIndexTree.GetHandle( row.CustomName() );
+            unitIndex := guard( unitIndexTree.Root().Child( unitHandle ),null( NamedValue ));
+            if( not isnull( unitIndex )){
+              unit := units.Element( unitIndex.GetValueAsNumber() );
+              output := sum( unit,StockingPoint_MP.ProductInStockingPoint_MP.ProductInStockingPointInPeriod,pispip,
+                             pispip.Period_MP().StartDate() >= localColumn.CustomDate() and
+                             pispip.Period_MP().StartDate() < localColumn.CustomDate().StartOfNextMonth() and
+                             pispip.Period_MP().TimeUnit() = "Day",
+                             pispip.NewSupplyProductionQuantity());
+            }
+          }
+    
+          traverse( archiveCells,Elements,cell ){
+             workingDay := workingDay + cell.WorkingDay();
+             capacity := capacity + cell.Capacity();
+             if( cell.ShiftPattern() <> "" ){
+               shiftPatterns.Add( cell.ShiftPattern() );
+             }
+          }
+          localCell := null( LocalCell_ScheduleSummary );
+          {
+            localCellHandle := localCellIndexTree.GetHandle( row.CustomName() + localColumn.CustomDate().AsQUILL() );
+            localCellIndex := guard( localCellIndexTree.Root().Child( localCellHandle ),null( NamedValue ));
+            if( isnull( localCellIndex )){
+              localCell := localRow.LocalCell( relnew,LocalCell_ScheduleSummary,LocalColumn := localColumn );
+              localCells.Add( localCell );
+              localCellIndexTree.Root().AddChild( localCellHandle , localCells.Size() - 1 );
+            }else{
+              localCell := localCells.Element( localCellIndex.GetValueAsNumber() ); 
+            }
+          }
+          
+          localCell.ShiftPattern( selectuniquevalues( shiftPatterns,Elements,element,element ).Concatenate( "/" ) );
+          
+          localCell.WorkingDay( localCell.WorkingDay() + workingDay );
+          localCell.Capacity( localCell.Capacity() + capacity );
+          localCell.Output( localCell.Output() + output );
+          
+       }
+    }
+    
+    
+    
     traverse( localTable,LocalRow.LocalCell.astype( LocalCell_ScheduleSummary ),cell ){
       cell.Capacity( cell.Capacity() / tables.Size() );
       cell.Output( cell.Output() / tables.Size() );
     }
-    
-    //startDate := owner.StartOfPlanning().Date() + 7;
-    //endDate := maxselect( owner,Unit.UnitPeriod.astype( UnitPeriodTime ).Period_MP,period,period.EndDate(),period.TimeUnit() = "Month" ).EndDate();
-    //columns := construct( ArchiveColumns );
-    //columnIndexTree := NamedValueTree::Create();
-    //for( i := startDate;i < endDate; i := i + 1){
-    //  column := table.ArchiveColumn( relnew,CustomDate := i );
-    //  columnHandle := columnIndexTree.GetHandle( i.AsQUILL() );
-    //  columns.Add( column );
-    //  columnIndexTree.Root().AddChild( columnHandle,columns.Size() - 1 );
-    //}
     
     AsyncFlag::Success( recycleBin,ArchiveCell_ScheduleSummary::GetTableName() );
     return localTable;
diff --git a/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateTempTable.qbl b/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateTempTable.qbl
new file mode 100644
index 0000000..d35d371
--- /dev/null
+++ b/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateTempTable.qbl
@@ -0,0 +1,77 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod CreateTempTable (
+  const MacroPlan macroPlan,
+  RecycleBin recycleBin
+) as LocalTable
+{
+  TextBody:
+  [*
+      // rislai Aug-6-2024 (created)
+    zeroDuration := Duration::Construct( 0,0,0,0 );
+    
+    table := recycleBin.LocalTable( relnew,Name := ArchiveCell_ScheduleSummary::GetTableName());
+    
+    startDate := macroPlan.StartOfPlanning().Date() + 8;
+    endDate := maxselect( macroPlan,Unit.UnitPeriod.astype( UnitPeriodTime ).Period_MP,period,period.TimeUnit() = Translations::MP_GlobalParameters_Day(),period.EndDate()).EndDate();
+    
+    columns := construct( LocalColumns );
+    columnIndexTree := NamedValueTree::Create();
+    for( i := startDate;i < endDate; i := i + 1){
+      column := table.LocalColumn( relnew,CustomDate := i );
+      columnHandle := columnIndexTree.GetHandle( i.AsQUILL() );
+      columns.Add( column );
+      columnIndexTree.Root().AddChild( columnHandle,columns.Size() - 1 );
+    }
+    
+    traverse( macroPlan,Unit,unit,unit.HasCapacityTypeTime() and not unit.HasChild()){
+      // unit.AsEntity().DisplayNameForSelection()
+      row := table.LocalRow( relnew,CustomName := unit.ID(),Index := table.GetRowIndexCache() ); 
+      throughput := guard( sum( unit,Operation,operation,operation.Throughput() ) / unit.Operation( relsize ) , 0 );
+      
+      unitPeriodTimes := selectset( unit,UnitPeriod.astype( UnitPeriodTime ),unitPeriodTime,
+                                        unitPeriodTime.Period_MP().StartDate() >= startDate 
+                                    and unitPeriodTime.Period_MP().EndDate() <= endDate 
+                                    and unitPeriodTime.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day());
+      traverse( unitPeriodTimes,Elements,unitPeriodTime ){
+        columnHandle := columnIndexTree.GetHandle( unitPeriodTime.Period_MP().StartDate().AsQUILL() );
+        columnIndex := guard( columnIndexTree.Root().Child( columnHandle ),null( NamedValue ));
+        if( not isnull( columnIndex )){
+          
+          // 褰揳rrowedAvailableCapacity涓嶄负0锛屽伐浣滄棩 + 1
+          arrowedAvailableCapacity := unitPeriodTime.TotalAvailableCapacity();
+          workDay := ifexpr( arrowedAvailableCapacity <> zeroDuration, 1,0 );
+          
+          if( workDay = 0 ){
+            workDay := ifexpr( unitPeriodTime.ShiftPlan().Outcome() <> "",1,0 );
+          }
+          
+          column := columns.Element( columnIndex.GetValueAsNumber() );
+          
+          dayOfWeek := column.CustomDate().DayOfWeek();
+          workHours := select( unitPeriodTime,ShiftPattern.ShiftDay,shifDay,shifDay.Day_MP().ID() = dayOfWeek );
+          capacity := 0.0;
+          
+          
+          if( not isnull( workHours )){
+            capacity := workDay * throughput //* workHours.Capacity().HoursAsReal()
+          }
+          
+          row.LocalCell( relnew,LocalCell_ScheduleSummary,LocalColumn := column,
+                       ShiftPattern := unitPeriodTime.ShiftPatternName(),
+                       WorkingDay := workDay,
+                       Capacity := capacity,
+                       Output := 0 );
+        }
+      }
+    }
+    
+    
+    traverse( table,LocalColumn,column,column.LocalCell( relsize ) = 0 ){
+      column.Delete(); 
+    }
+    
+    
+    return table;
+  *]
+}
diff --git a/_Main/BL/Type_OfflinePlanArchiveVersion/Method_GetRow.qbl b/_Main/BL/Type_OfflinePlanArchiveVersion/Method_GetRow.qbl
index 0345029..18d0349 100644
--- a/_Main/BL/Type_OfflinePlanArchiveVersion/Method_GetRow.qbl
+++ b/_Main/BL/Type_OfflinePlanArchiveVersion/Method_GetRow.qbl
@@ -7,13 +7,13 @@
   TextBody:
   [*
     // 鐢勫叞楦� Oct-11-2024 (created)
-    row       := selectobject( this, Row, row, row.ProductID() = noprow.ProductID() and row.ProductionLine() = noprow.ProductionLine() and row.Type() = noprow.Type() );
+    row       := selectobject( this, Row, row, row.ProductID() = noprow.ProductID() and row.ProductionLine() = noprow.ProductionLine() and row.Type() = noprow.Type() and row.StockingPointID() = noprow.StockingPointID() );
     
     if( isnull( row ) ){
       product := selectobject( noprow.NewOfflinePlanTable().MacroPlan(), Product_MP, product, product.ID() = noprow.ProductID() );
       if( not isnull( product ) ){
         unit    := ifexpr( noprow.ProductionLine().FindString( "CC", 0 ) > -1, FinancialProductionReport::GetDefaultCCUnit(), FinancialProductionReport::GetDefaultDLUnit() );
-        row     := this.Row( relnew, Name := noprow.ProductID(), ProductionLine := noprow.ProductionLine(), Type := noprow.Type(), Unit := unit
+        row     := this.Row( relnew, Name := noprow.ProductID(), ProductionLine := noprow.ProductionLine(), Type := noprow.Type(), Unit := unit,StockingPointID := noprow.StockingPointID()
                              , ProductID := ifexpr( exists( product.GetAllParent(), Elements, e, e.ID() = EnginePipelineReport::GetDefaultProductParent() ), product.Notes(), product.ID() ) );
         //鍒濆鍖栧崟鍏冩牸
         row.InitializeCell();
diff --git a/_Main/BL/Type_OfflinePlanArchiveVersionRow/Attribute_StockingPointID.qbl b/_Main/BL/Type_OfflinePlanArchiveVersionRow/Attribute_StockingPointID.qbl
new file mode 100644
index 0000000..2023813
--- /dev/null
+++ b/_Main/BL/Type_OfflinePlanArchiveVersionRow/Attribute_StockingPointID.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute StockingPointID
+{
+  #keys: '3[414996.1.237454745][414996.1.237454744][414996.1.237454746]'
+  ValueType: String
+}
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateLockPeriod/Component_pProduct\043661.def" "b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateLockPeriod/Component_pProduct\043661.def"
index 7fc5e05..0763846 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateLockPeriod/Component_pProduct\043661.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateLockPeriod/Component_pProduct\043661.def"
@@ -27,7 +27,7 @@
       ]
       Properties:
       [
-        DisplayField: 'ProductID'
+        DisplayField: 'ID'
         Label: '浜у搧'
         NumberOfColumns: 50
         Taborder: 0
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateLockPeriod/Response_pnlActions_btnOk_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateLockPeriod/Response_pnlActions_btnOk_OnClick.def
index ae1e8b9..36d0cba 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateLockPeriod/Response_pnlActions_btnOk_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateLockPeriod/Response_pnlActions_btnOk_OnClick.def
@@ -14,14 +14,14 @@
           // 閿佸畾鍏ㄩ儴浜у搧
           traverse( MacroPlan,Product_MP,product ){
             traverse( product,ProductInStockingPoint_MP,productInStockingPoint ){
-              LockPeriod::Create( productInStockingPoint,dsLockDate.Date() );
+              LockPeriod::Create( productInStockingPoint,dsLockDate.Date(),InterfaceDataset );
             }
           }
         }else{
           // 閿佸畾鎸囧畾浜у搧涓嬬殑鍏ㄩ儴搴撳瓨鐐�
           product := ddlProduct.Data();
           traverse( product,ProductInStockingPoint_MP,productInStockingPoint){
-            LockPeriod::Create( productInStockingPoint,dsLockDate.Date() );
+            LockPeriod::Create( productInStockingPoint,dsLockDate.Date(), InterfaceDataset );
           }
         }
       }else{
@@ -29,13 +29,13 @@
           // 閿佸畾鎸囧畾搴撳瓨鐐逛笅鐨勫叏閮ㄤ骇鍝�
           stockingPoint := ddlStockingPoint.Data();
           traverse( stockingPoint,ProductInStockingPoint_MP,productInStockingPoint ){
-            LockPeriod::Create( productInStockingPoint,dsLockDate.Date() );
+            LockPeriod::Create( productInStockingPoint,dsLockDate.Date(), InterfaceDataset );
           }
         }else{
           // 閿佸畾鎸囧畾搴撳瓨鐐圭殑鎸囧畾浜у搧
           productInStockingPoint := select( ddlProduct.Data(),ProductInStockingPoint_MP,pisp,pisp.StockingPoint_MP() = ddlStockingPoint.Data() );
           if( not isnull( productInStockingPoint )){
-            LockPeriod::Create( productInStockingPoint,dsLockDate.Date() );
+            LockPeriod::Create( productInStockingPoint,dsLockDate.Date(),InterfaceDataset );
           }
         } 
       }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_Form701/Component_pRibbon.def b/_Main/UI/MacroPlannerWebApp/Component_Form701/Component_pRibbon.def
index 041150e..93dfd4a 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_Form701/Component_pRibbon.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_Form701/Component_pRibbon.def
@@ -6,7 +6,7 @@
   Children:
   [
     #child: PanelFilter_490
-    #child: PanelRibbon504
+    #child: pRibbon504
   ]
   Properties:
   [
diff --git a/_Main/UI/MacroPlannerWebApp/Component_Form701/Component_PanelRibbon504.def b/_Main/UI/MacroPlannerWebApp/Component_Form701/Component_pRibbon504.def
similarity index 98%
rename from _Main/UI/MacroPlannerWebApp/Component_Form701/Component_PanelRibbon504.def
rename to _Main/UI/MacroPlannerWebApp/Component_Form701/Component_pRibbon504.def
index 667bf5f..26c0fd7 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_Form701/Component_PanelRibbon504.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_Form701/Component_pRibbon504.def
@@ -1,5 +1,5 @@
 Quintiq file version 2.0
-Component PanelRibbon504
+Component pRibbon504
 {
   #keys: '[414996.1.211223991]'
   BaseType: 'WebPanel'
diff --git a/_Main/UI/MacroPlannerWebApp/Component_Form701/Response_PanelRibbon504_bExport_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_Form701/Response_PanelRibbon504_bExport_OnClick.def
deleted file mode 100644
index 4431779..0000000
--- a/_Main/UI/MacroPlannerWebApp/Component_Form701/Response_PanelRibbon504_bExport_OnClick.def
+++ /dev/null
@@ -1,18 +0,0 @@
-Quintiq file version 2.0
-#parent: PanelRibbon504/bExport
-Response OnClick () id:Response_PanelRibbon504_bExport_OnClick
-{
-  #keys: '[414996.1.211223969]'
-  CanBindMultiple: false
-  DefinitionID: 'Responsedef_WebButton_OnClick'
-  GroupServerCalls: true
-  QuillAction
-  {
-    Body:
-    [*
-      rows := selectset( dhTable.Data(),LocalRow,row,exists( dhFinelProducts.Data(),Elements,product,product.ID() = row.ProductID()));
-      columns := selectset( dhTable.Data( ),LocalColumn,column,true );
-      LocalCell_OfflinePlanComparison::AsyncExport( RecycleBin, rows, columns, MacroPlan );
-    *]
-  }
-}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_Form701/Response_PanelRibbon504_bComparison_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_Form701/Response_pRibbon504_bComparison_OnClick.def
similarity index 89%
rename from _Main/UI/MacroPlannerWebApp/Component_Form701/Response_PanelRibbon504_bComparison_OnClick.def
rename to _Main/UI/MacroPlannerWebApp/Component_Form701/Response_pRibbon504_bComparison_OnClick.def
index 6260e62..d971673 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_Form701/Response_PanelRibbon504_bComparison_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_Form701/Response_pRibbon504_bComparison_OnClick.def
@@ -1,6 +1,6 @@
 Quintiq file version 2.0
-#parent: PanelRibbon504/bComparison
-Response OnClick () id:Response_PanelRibbon504_bComparison_OnClick
+#parent: pRibbon504/bComparison
+Response OnClick () id:Response_pRibbon504_bComparison_OnClick
 {
   #keys: '[414996.1.211223970]'
   CanBindMultiple: false
diff --git a/_Main/UI/MacroPlannerWebApp/Component_Form701/Response_pRibbon504_bExport_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_Form701/Response_pRibbon504_bExport_OnClick.def
new file mode 100644
index 0000000..b710824
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_Form701/Response_pRibbon504_bExport_OnClick.def
@@ -0,0 +1,18 @@
+Quintiq file version 2.0
+#parent: pRibbon504/bExport
+Response OnClick () id:Response_pRibbon504_bExport_OnClick
+{
+  #keys: '[414996.1.211223969]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebButton_OnClick'
+  GroupServerCalls: true
+  QuillAction
+  {
+    Body:
+    [*
+      rows := selectset( dhTable.Data(),LocalRow,row,exists( dhFinelProducts.Data(),Elements,product,product.ID() = row.ProductID()));
+      columns := selectset( dhTable.Data( ),LocalColumn,column, not column.IsAttrbuteColumn() and dhStartDate.Data() <= column.Date() and dhEndDate.Data() > column.Date() and column.TimeUnit() = dhTimeUnit.Data() );
+      LocalCell_OfflinePlanComparison::AsyncExport( RecycleBin, rows, columns, MacroPlan );
+    *]
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_Form701/Response_PanelRibbon504_dhTimeUnit_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_Form701/Response_pRibbon504_dhTimeUnit_OnCreated.def
similarity index 69%
rename from _Main/UI/MacroPlannerWebApp/Component_Form701/Response_PanelRibbon504_dhTimeUnit_OnCreated.def
rename to _Main/UI/MacroPlannerWebApp/Component_Form701/Response_pRibbon504_dhTimeUnit_OnCreated.def
index 5af1092..fe31d37 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_Form701/Response_PanelRibbon504_dhTimeUnit_OnCreated.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_Form701/Response_pRibbon504_dhTimeUnit_OnCreated.def
@@ -1,6 +1,6 @@
 Quintiq file version 2.0
-#parent: PanelRibbon504/dhTimeUnit
-Response OnCreated () id:Response_PanelRibbon504_dhTimeUnit_OnCreated
+#parent: pRibbon504/dhTimeUnit
+Response OnCreated () id:Response_pRibbon504_dhTimeUnit_OnCreated
 {
   #keys: '[414996.1.211223966]'
   CanBindMultiple: false
diff --git a/_Main/UI/MacroPlannerWebApp/Component_Form701/Response_PanelRibbon504_dhXMLDataListener_OnDataChanged.def b/_Main/UI/MacroPlannerWebApp/Component_Form701/Response_pRibbon504_dhXMLDataListener_OnDataChanged.def
similarity index 79%
rename from _Main/UI/MacroPlannerWebApp/Component_Form701/Response_PanelRibbon504_dhXMLDataListener_OnDataChanged.def
rename to _Main/UI/MacroPlannerWebApp/Component_Form701/Response_pRibbon504_dhXMLDataListener_OnDataChanged.def
index e0cbf71..8cd650b 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_Form701/Response_PanelRibbon504_dhXMLDataListener_OnDataChanged.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_Form701/Response_pRibbon504_dhXMLDataListener_OnDataChanged.def
@@ -1,6 +1,6 @@
 Quintiq file version 2.0
-#parent: PanelRibbon504/dhXMLDataListener
-Response OnDataChanged () id:Response_PanelRibbon504_dhXMLDataListener_OnDataChanged
+#parent: pRibbon504/dhXMLDataListener
+Response OnDataChanged () id:Response_pRibbon504_dhXMLDataListener_OnDataChanged
 {
   #keys: '[414996.1.211223968]'
   CanBindMultiple: false
diff --git a/_Main/UI/MacroPlannerWebApp/Component_Form701/Response_PanelRibbon504_rbgTimeUnit_OnUserChanged.def b/_Main/UI/MacroPlannerWebApp/Component_Form701/Response_pRibbon504_rbgTimeUnit_OnUserChanged.def
similarity index 69%
rename from _Main/UI/MacroPlannerWebApp/Component_Form701/Response_PanelRibbon504_rbgTimeUnit_OnUserChanged.def
rename to _Main/UI/MacroPlannerWebApp/Component_Form701/Response_pRibbon504_rbgTimeUnit_OnUserChanged.def
index cba0ac4..053067c 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_Form701/Response_PanelRibbon504_rbgTimeUnit_OnUserChanged.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_Form701/Response_pRibbon504_rbgTimeUnit_OnUserChanged.def
@@ -1,6 +1,6 @@
 Quintiq file version 2.0
-#parent: PanelRibbon504/rbgTimeUnit
-Response OnUserChanged () id:Response_PanelRibbon504_rbgTimeUnit_OnUserChanged
+#parent: pRibbon504/rbgTimeUnit
+Response OnUserChanged () id:Response_pRibbon504_rbgTimeUnit_OnUserChanged
 {
   #keys: '[414996.1.211223967]'
   CanBindMultiple: false
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormLockPeriod/Response_ListLockPeriod_mEnable_OnClick\04321.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormLockPeriod/Response_ListLockPeriod_mEnable_OnClick\04321.def"
index c1e9778..d42616e 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_FormLockPeriod/Response_ListLockPeriod_mEnable_OnClick\04321.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormLockPeriod/Response_ListLockPeriod_mEnable_OnClick\04321.def"
@@ -13,7 +13,7 @@
   {
     Body:
     [*
-      offlinePlanTable := select( MacroPlan,NewOfflinePlanTable,table,true );
+      offlinePlanTable := select( InterfaceDataset,OfflinePlanArchiveVersion,table,not table.IsShow() );
       traverse( selection,Elements,element ,not element.IsEnable() ){
         element.Enable( offlinePlanTable ); 
       }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanComparison/Response_PanelRibbon763_184_bExport_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanComparison/Response_PanelRibbon763_184_bExport_OnClick.def
index b33f8ac..c0bcc78 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanComparison/Response_PanelRibbon763_184_bExport_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanComparison/Response_PanelRibbon763_184_bExport_OnClick.def
@@ -11,7 +11,7 @@
     Body:
     [*
       rows := selectset( dhTable.Data(),LocalRow,row,exists( dhFinelProducts.Data(),Elements,product,product.ID() = row.ProductID()));
-      columns := selectset( dhTable.Data( ),LocalColumn,column,not column.IsAttrbuteColumn() and dhStartDate.Data() <= column.Date() and dhEndDate.Data() > column.Date() );
+      columns := selectset( dhTable.Data( ),LocalColumn,column,not column.IsAttrbuteColumn() and dhStartDate.Data() <= column.Date() and dhEndDate.Data() > column.Date() and dhTimeUnit.Data() = column.TimeUnit() );
       LocalCell_ProductionComparison::AsyncExport( RecycleBin, rows, columns, MacroPlan );
     *]
   }

--
Gitblit v1.9.3