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

---
 _Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_MatrixEditor510.def                             |    2 
 _Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_CreateFullTable.qbl                                                  |   15 ++++++-
 /dev/null                                                                                                                 |   18 ---------
 _Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Response_PanelRibbon322_88_ButtonRibbon820_OnClick#71.def |    2 +
 _Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_Create.qbl                                                           |   12 ++++-
 _Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_PanelScheduleSummary.def                        |   17 +-------
 _Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Response_PanelRibbon322_88_ButtonRibbon_OnClick#88.def    |    5 +-
 _Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_PanelRibbon322#88.def                           |    5 +-
 8 files changed, 33 insertions(+), 43 deletions(-)

diff --git a/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_Create.qbl b/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_Create.qbl
index d5c3eee..53b1182 100644
--- a/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_Create.qbl
+++ b/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_Create.qbl
@@ -12,10 +12,11 @@
       table.Delete(); 
     }
     
+    zeroDuration := Duration::Construct( 0,0,0,0 );
+    
     table := owner.MP_Table( relnew,Name := MP_Cell_ScheduleSummary::GetTableName());
     
     startDate := owner.StartOfPlanning().Date();
-    
     endDate := maxselect( owner,Unit.UnitPeriod.astype( UnitPeriodTime ).Period_MP,period,period.TimeUnit() = Translations::MP_GlobalParameters_Day(),period.EndDate()).EndDate();
     
     columns := construct( MP_Columns );
@@ -40,9 +41,14 @@
         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();
-          zeroDuration := Duration::Construct( 0,0,0,0 );
+          workDay := ifexpr( arrowedAvailableCapacity <> zeroDuration, 1,0 );
+          
+          if( workDay = 0 ){
+            workDay := ifexpr( unitPeriodTime.ShiftPlan().Outcome() <> "",1,0 );
+          }
           
           column := columns.Element( columnIndex.GetValueAsNumber() );
           
@@ -50,7 +56,7 @@
           workHours := select( unitPeriodTime,ShiftPattern.ShiftDay,shifDay,shifDay.Day_MP().ID() = dayOfWeek );
           capacity := 0.0;
           
-          workDay := ifexpr( arrowedAvailableCapacity <> zeroDuration, 1,0 );
+          
           if( not isnull( workHours )){
             capacity := workDay * throughput * workHours.Capacity().HoursAsReal()
           }
diff --git a/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_CreateFullTable.qbl b/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_CreateFullTable.qbl
index ed6a26c..2612599 100644
--- a/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_CreateFullTable.qbl
+++ b/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_CreateFullTable.qbl
@@ -80,10 +80,16 @@
             unitIndex := guard( unitIndexTree.Root().Child( unitHandle ),null( NamedValue ));
             if( not isnull( unitIndex )){
               unit := units.Element( unitIndex.GetValueAsNumber() );
-              output := sum( unit,UnitPeriod.PeriodTask_MP.NewSupply,np,
+              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(),
+                             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{
             scheduleSummaryOutputDataKey := row.Name() + localColumn.CustomDate().AsQUILL();
@@ -138,6 +144,11 @@
        }
     }
     
+    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( MP_Columns );
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_MatrixEditor\043715.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_MatrixEditor\043715.def"
deleted file mode 100644
index e497a22..0000000
--- "a/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_MatrixEditor\043715.def"
+++ /dev/null
@@ -1,103 +0,0 @@
-Quintiq file version 2.0
-Component MatrixEditor id:MatrixEditor_715
-{
-  #keys: '[412672.1.94121865]'
-  BaseType: 'WebMatrixEditor'
-  Children:
-  [
-    Component MatrixEditorCell
-    {
-      #keys: '[412672.1.94121866]'
-      BaseType: 'WebMatrixEditorCell'
-      Children:
-      [
-        Component DataExtractorCells
-        {
-          #keys: '[412672.1.94121867]'
-          BaseType: 'WebDataExtractor'
-          Properties:
-          [
-            DataType: 'MP_Table'
-            Source: 'dhComparisonData'
-            Taborder: 0
-            Transformation: 'MP_Row.MP_Cell.astype(MP_Cell_ScheduleSummary)'
-          ]
-        }
-      ]
-      Properties:
-      [
-        Attributes: 'ShiftPattern;WorkingDay;Capacity;Output'
-        Column: 'MP_Column'
-        Row: 'MP_Row'
-        Taborder: 0
-      ]
-    }
-    Component MatrixEditorRows
-    {
-      #keys: '[412672.1.94121868]'
-      BaseType: 'WebMatrixEditorHeaderLevel'
-      Children:
-      [
-        Component DataExtractorRows
-        {
-          #keys: '[412672.1.94121869]'
-          BaseType: 'WebDataExtractor'
-          Properties:
-          [
-            DataType: 'MP_Table'
-            FilterArguments: 'checkedEntity:QMacroPlanner::FormScheduleSummaryReport.dhFinelEntity'
-            FixedFilter: 'exists( checkedEntity,Elements,entity,entity.DisplayName() = object.Name() )'
-            Source: 'dhComparisonData'
-            Taborder: 0
-            Transformation: 'MP_Row'
-          ]
-        }
-      ]
-      Properties:
-      [
-        Legend: 'Name'
-        SortCriteria: 'Index'
-        Taborder: 1
-      ]
-    }
-    Component MatrixEditorColumns
-    {
-      #keys: '[412672.1.94121870]'
-      BaseType: 'WebMatrixEditorHeaderLevel'
-      Children:
-      [
-        Component DataExtractorColumns
-        {
-          #keys: '[412672.1.94121871]'
-          BaseType: 'WebDataExtractor'
-          Properties:
-          [
-            DataType: 'MP_Table'
-            FilterArguments: 'startDate:QMacroPlanner::FormScheduleSummaryReport.dhStartDate;endDate:QMacroPlanner::FormScheduleSummaryReport.dhEndDate'
-            FixedFilter: 'not object.IsAttrbuteColumn() and startDate <= object.Date() and endDate > object.Date() '
-            Source: 'dhComparisonData'
-            Taborder: 0
-            Transformation: 'MP_Column'
-          ]
-        }
-      ]
-      Properties:
-      [
-        Legend: 'Date'
-        SortCriteria: 'Index'
-        Taborder: 2
-      ]
-    }
-    #child: matrixEditorActionBarPageDemandComparison_1
-    #child: matrixeditorContextMenuDemandComparison_1
-  ]
-  Properties:
-  [
-    AllowMultipleAttributes: true
-    Columns: 'MatrixEditorColumns'
-    ContextMenu: 'matrixeditorContextMenuDemandComparison'
-    Rows: 'MatrixEditorRows'
-    Taborder: 0
-    Visible: false
-  ]
-}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_MatrixEditor510.def b/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_MatrixEditor510.def
index 41782c5..e269af0 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_MatrixEditor510.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_MatrixEditor510.def
@@ -97,6 +97,6 @@
     Columns: 'MatrixEditorColumns391'
     ContextMenu: 'matrixeditorContextMenuDemandComparison527'
     Rows: 'MatrixEditorRows221'
-    Taborder: 2
+    Taborder: 0
   ]
 }
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_PanelRibbon322\04388.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_PanelRibbon322\04388.def"
index ebe43ed..c1a9581 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_PanelRibbon322\04388.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_PanelRibbon322\04388.def"
@@ -136,6 +136,7 @@
       BaseType: 'WebButton'
       Properties:
       [
+        Image: 'C_CLAMP'
         Label: 'CreateFullTable'
         Taborder: 1
       ]
@@ -146,9 +147,9 @@
       BaseType: 'WebButton'
       Properties:
       [
-        Label: 'Create'
+        Image: 'C_CLAMP'
+        Label: 'Create base data'
         Taborder: 0
-        Visible: false
       ]
     }
   ]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_PanelScheduleSummary.def b/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_PanelScheduleSummary.def
index 69aad65..1065716 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_PanelScheduleSummary.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_PanelScheduleSummary.def
@@ -5,16 +5,6 @@
   BaseType: 'WebPanel'
   Children:
   [
-    Component dhComparisonData
-    {
-      #keys: '[412672.1.94121859]'
-      BaseType: 'WebDataHolder'
-      Databinding: 'MP_Table'
-      Properties:
-      [
-        Taborder: 1
-      ]
-    }
     Component dhCheckedEntity
     {
       #keys: '[412672.1.94121860]'
@@ -37,7 +27,7 @@
       ]
       Properties:
       [
-        Taborder: 5
+        Taborder: 3
       ]
     }
     Component dhFinelEntity
@@ -47,10 +37,9 @@
       Databinding: 'structured[Entity]*'
       Properties:
       [
-        Taborder: 4
+        Taborder: 2
       ]
     }
-    #child: MatrixEditor_715
     #child: MatrixEditor510
     Component dhComparisonData854
     {
@@ -59,7 +48,7 @@
       Databinding: 'LocalTable'
       Properties:
       [
-        Taborder: 3
+        Taborder: 1
       ]
     }
   ]
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_matrixEditorActionBarPageDemandComparison\0431.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_matrixEditorActionBarPageDemandComparison\0431.def"
deleted file mode 100644
index 235d981..0000000
--- "a/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_matrixEditorActionBarPageDemandComparison\0431.def"
+++ /dev/null
@@ -1,10 +0,0 @@
-Quintiq file version 2.0
-Component matrixEditorActionBarPageDemandComparison id:matrixEditorActionBarPageDemandComparison_1
-{
-  #keys: '[412672.1.94121872]'
-  BaseType: 'matrixEditorActionBarPage'
-  Properties:
-  [
-    Taborder: 3
-  ]
-}
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_matrixeditorContextMenuDemandComparison\0431.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_matrixeditorContextMenuDemandComparison\0431.def"
deleted file mode 100644
index a12dd25..0000000
--- "a/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Component_matrixeditorContextMenuDemandComparison\0431.def"
+++ /dev/null
@@ -1,10 +0,0 @@
-Quintiq file version 2.0
-Component matrixeditorContextMenuDemandComparison id:matrixeditorContextMenuDemandComparison_1
-{
-  #keys: '[412672.1.94121873]'
-  BaseType: 'matrixeditorContextMenu'
-  Properties:
-  [
-    Taborder: 4
-  ]
-}
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Response_PanelRibbon322_88_ButtonRibbon820_OnClick\04371.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Response_PanelRibbon322_88_ButtonRibbon820_OnClick\04371.def"
index 4715969..9c26fb3 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Response_PanelRibbon322_88_ButtonRibbon820_OnClick\04371.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Response_PanelRibbon322_88_ButtonRibbon820_OnClick\04371.def"
@@ -13,6 +13,8 @@
       table := MP_Cell_ScheduleSummary::CreateFullTable( macroPlans,RecycleBin ,Archive, MacroPlan );
       
       dhComparisonData854.Data( table );
+      
+      WebMessageBox::Success( "Success" );
     *]
     GroupServerCalls: false
   }
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Response_PanelRibbon322_88_ButtonRibbon_OnClick\04388.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Response_PanelRibbon322_88_ButtonRibbon_OnClick\04388.def"
index 994e6d2..58b31f0 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Response_PanelRibbon322_88_ButtonRibbon_OnClick\04388.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Response_PanelRibbon322_88_ButtonRibbon_OnClick\04388.def"
@@ -9,9 +9,8 @@
   {
     Body:
     [*
-      table := MP_Cell_ScheduleSummary::Create( MacroPlan );
-      
-      dhComparisonData.Data( table );
+      MP_Table::CreateMP_Tables_ScheduleSummary( ApplicationMacroPlanner.GetMacroPlans() );
+      WebMessageBox::Success( "Success" );
     *]
     GroupServerCalls: false
   }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Response_PanelScheduleSummary_dhComparisonData_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Response_PanelScheduleSummary_dhComparisonData_OnCreated.def
deleted file mode 100644
index 08961a7..0000000
--- a/_Main/UI/MacroPlannerWebApp/Component_FormScheduleSummaryReport/Response_PanelScheduleSummary_dhComparisonData_OnCreated.def
+++ /dev/null
@@ -1,18 +0,0 @@
-Quintiq file version 2.0
-#parent: PanelScheduleSummary/dhComparisonData
-Response OnCreated () id:Response_PanelScheduleSummary_dhComparisonData_OnCreated
-{
-  #keys: '[412672.1.96303222]'
-  CanBindMultiple: false
-  DefinitionID: 'Responsedef_WebComponent_OnCreated'
-  GroupServerCalls: true
-  QuillAction
-  {
-    Body:
-    [*
-      table := select( MacroPlan,MP_Table,table,table.Name() = MP_Cell_ScheduleSummary::GetTableName() );
-      
-      dhComparisonData.Data( table );
-    *]
-  }
-}

--
Gitblit v1.9.3