From edfbb3b9cb8a6700df14ee75a6981f48e13c76c5 Mon Sep 17 00:00:00 2001
From: yypsybs <yypsybs@foxmail.com>
Date: 星期五, 13 十月 2023 10:09:02 +0800
Subject: [PATCH] 制造LT归集优化,产销预算测试数据生成逻辑修改

---
 _Main/BL/Type_ManufactureLTImputation/StaticMethod_Apply.qbl                                                 |    5 
 _Main/BL/Type_GlobalDTOTable/Method_InitTestData#12.qbl                                                      |    1 
 _Main/BL/Type_GlobalDTOTable/Method_InitTestDataByYear.qbl                                                   |   67 +++++++
 _Main/BL/Type_ManufactureLTImputation/StaticMethod_Refresh.qbl                                               |    5 
 _Main/BL/Type_ManufactureLTProcessSection/StaticMethod_Apply#202.qbl                                         |    7 
 _Main/UI/MacroPlannerWebApp/Component_FormManufactureLT/Component_ListManufactureLT#943.def                  |    6 
 _Main/UI/MacroPlannerWebApp/Component_FormManufactureLT/Response_ButtonLoad_OnClick#417.def                  |   20 ++
 _Main/BL/Type_ManufactureLTProcessSection/StaticMethod_Apply.qbl                                             |    5 
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_ButtonGenerateTestData_OnClick.def   |   21 ++
 _Main/BL/Type_ManufactureLTProcessSection/StaticMethod_CreateOrUpdate.qbl                                    |   11 
 _Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Method_OnOk.def                               |    4 
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/_ROOT_Component_FormCapacityAndSaleBudge.def  |   15 +
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_OnCreated.def                        |    2 
 _Main/BL/Type_ManufactureLTProcessSection/StaticMethod_CreateOrUpdate0.qbl                                   |   13 
 _var/_Main/ProjSettings/MacroPlannerWebApp/Views/ManufactureLT.vw                                            |  239 ++++++++++++++++++++++++++
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_ButtonExportDetail_OnClick.def       |    2 
 /dev/null                                                                                                    |   14 -
 _Main/BL/Type_ManufactureLTImputation/StaticMethod_Transfer#25.qbl                                           |   15 +
 _Main/BL/Type_ManufactureLTImputation/StaticMethod_CreateOrUpdate.qbl                                        |    6 
 _Main/UI/MacroPlannerWebApp/Component_FormManufactureLT/Response_ListManufactureLT_943_MenuApply_OnClick.def |   23 ++
 _Main/BL/Relations/Relation_ManufactureLTImputation_GlobalOTDTable_GlobalOTDTable_ManufactureLT.qbl          |   23 ++
 _Main/UI/MacroPlannerWebApp/Component_FormManufactureLT/_ROOT_Component_FormManufactureLT.def                |   11 +
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Component_ListCapacityAndSaleBudge.def        |    2 
 23 files changed, 470 insertions(+), 47 deletions(-)

diff --git a/_Main/BL/Relations/Relation_ManufactureLTImputation_GlobalOTDTable_GlobalOTDTable_ManufactureLT.qbl b/_Main/BL/Relations/Relation_ManufactureLTImputation_GlobalOTDTable_GlobalOTDTable_ManufactureLT.qbl
new file mode 100644
index 0000000..3a23be5
--- /dev/null
+++ b/_Main/BL/Relations/Relation_ManufactureLTImputation_GlobalOTDTable_GlobalOTDTable_ManufactureLT.qbl
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#parent: #root
+Relation ManufactureLTImputation_GlobalOTDTable_GlobalOTDTable_ManufactureLTImputation
+{
+  #keys: '1[414384.0.964611377]'
+  DefaultRelationStrategy
+  {
+  }
+  RelationSide.LeftSide GlobalOTDTable
+  {
+    #keys: '3[414384.0.964611379][414384.0.964611378][414384.0.964611380]'
+    Cardinality: '0to1'
+    ObjectDefinition: ManufactureLTImputation
+    OwningSide: 'Reference'
+  }
+  RelationSide.RightSide ManufactureLTImputation
+  {
+    #keys: '3[414384.0.964611382][414384.0.964611381][414384.0.964611383]'
+    Cardinality: '1toN'
+    ObjectDefinition: GlobalOTDTable
+    OwningSide: 'Owned'
+  }
+}
diff --git a/_Main/BL/Relations/Relation_ManufactureLTImputation_MacroPlan_MacroPlan_ManufactureLTImputation.qbl b/_Main/BL/Relations/Relation_ManufactureLTImputation_MacroPlan_MacroPlan_ManufactureLTImputation.qbl
deleted file mode 100644
index 7aa6d28..0000000
--- a/_Main/BL/Relations/Relation_ManufactureLTImputation_MacroPlan_MacroPlan_ManufactureLTImputation.qbl
+++ /dev/null
@@ -1,23 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Relation ManufactureLTImputation_MacroPlan_MacroPlan_ManufactureLTImputation
-{
-  #keys: '1[414384.0.697090694]'
-  DefaultRelationStrategy
-  {
-  }
-  RelationSide.LeftSide MacroPlan
-  {
-    #keys: '3[414384.0.697090696][414384.0.697090695][414384.0.697090697]'
-    Cardinality: '0to1'
-    ObjectDefinition: ManufactureLTImputation
-    OwningSide: 'Reference'
-  }
-  RelationSide.RightSide ManufactureLTImputation
-  {
-    #keys: '3[414384.0.697090699][414384.0.697090698][414384.0.697090700]'
-    Cardinality: '1toN'
-    ObjectDefinition: MacroPlan
-    OwningSide: 'Owned'
-  }
-}
diff --git "a/_Main/BL/Type_GlobalDTOTable/Method_InitTestData\04312.qbl" "b/_Main/BL/Type_GlobalDTOTable/Method_InitTestData\04312.qbl"
index f59360c..274df0b 100644
--- "a/_Main/BL/Type_GlobalDTOTable/Method_InitTestData\04312.qbl"
+++ "b/_Main/BL/Type_GlobalDTOTable/Method_InitTestData\04312.qbl"
@@ -10,6 +10,7 @@
     productCodeList := selectuniquevalues( macroPlan, Product_MP, item, item.ID() );
     debuginfo( "productCodeList : " + [String]productCodeList.Size() );
     
+    this.Global_MappingAnnualBudgetData( relflush );
     if( this.Global_MappingAnnualBudgetData( relsize ) = 0 ) {
       debuginfo( "create Global_MappingAnnualBudgetData test data" );
       id := 1;
diff --git a/_Main/BL/Type_GlobalDTOTable/Method_InitTestDataByYear.qbl b/_Main/BL/Type_GlobalDTOTable/Method_InitTestDataByYear.qbl
new file mode 100644
index 0000000..4223466
--- /dev/null
+++ b/_Main/BL/Type_GlobalDTOTable/Method_InitTestDataByYear.qbl
@@ -0,0 +1,67 @@
+Quintiq file version 2.0
+#parent: #root
+Method InitTestDataByYear (
+  MacroPlan macroPlan,
+  CapacityAndSaleBudgeFilterYears years
+)
+{
+  TextBody:
+  [*
+    // yypsybs Oct-7-2023 (created)
+    productCodeList := selectuniquevalues( macroPlan, Product_MP, item, item.ID() );
+    debuginfo( "productCodeList : " + [String]productCodeList.Size() );
+    
+    this.Global_MappingAnnualBudgetData( relflush );
+    debuginfo( "create Global_MappingAnnualBudgetData test data" );
+    id := 1;
+    traverse( years, Elements, year ) {
+      for( i := 1; i <= productCodeList.Size(); i := i + 1 ) {
+        productCode := productCodeList.Element( i - 1 );
+        mappingAnnualBudget := this.Global_MappingAnnualBudgetData( relnew, 
+                                                                    ID := [String]id,
+                                                                    YearNo := [String]year.YearNo(),
+                                                                    BusinessType := "浜嬩笟閮�" + [String](productCode.Length() mod 3),
+                                                                    ProductID := productCode);
+        id := id + 1;
+        mappingAnnualBudget.MonthlyModCapacity1( [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlyModCapacity2( [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlyModCapacity3( [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlyModCapacity4( [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlyModCapacity5( [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlyModCapacity6( [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlyModCapacity7( [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlyModCapacity8( [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlyModCapacity9( [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlyModCapacity10( [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlyModCapacity11( [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlyModCapacity12( [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySheetCapacity1(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySheetCapacity2(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySheetCapacity3(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySheetCapacity4(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySheetCapacity5(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySheetCapacity6(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySheetCapacity7(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySheetCapacity8(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySheetCapacity9(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySheetCapacity10(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySheetCapacity11(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySheetCapacity12(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySales1(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySales2(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySales3(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySales4(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySales5(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySales6(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySales7(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySales8(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySales9(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySales10(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySales11(  [String]Real::Random( 20000.0, 30000.0 ) );
+        mappingAnnualBudget.MonthlySales12(  [String]Real::Random( 20000.0, 30000.0 ) );
+      }
+    }
+    result2 := selectset( this, Global_MappingAnnualBudgetData, item, true );
+    debuginfo( "test MappingAnnualBudget size : " + [String]result2.Size() );
+  *]
+}
diff --git a/_Main/BL/Type_ManufactureLTImputation/StaticMethod_Apply.qbl b/_Main/BL/Type_ManufactureLTImputation/StaticMethod_Apply.qbl
index 8e7f10e..12288b1 100644
--- a/_Main/BL/Type_ManufactureLTImputation/StaticMethod_Apply.qbl
+++ b/_Main/BL/Type_ManufactureLTImputation/StaticMethod_Apply.qbl
@@ -1,7 +1,8 @@
 Quintiq file version 2.0
 #parent: #root
 StaticMethod Apply (
-  ManufactureLTImputations toApply
+  ManufactureLTImputations toApply,
+  MacroPlan macroPlan
 )
 {
   TextBody:
@@ -9,7 +10,7 @@
     // yypsybs Aug-28-2023 (created)
     traverse( toApply, Elements, parent ) {
       traverse( parent, ManufactureLTProcessSection, child ) {
-        ManufactureLTProcessSection::Apply( child );  
+        ManufactureLTProcessSection::Apply( child, macroPlan );  
       }
     }
   *]
diff --git a/_Main/BL/Type_ManufactureLTImputation/StaticMethod_CreateOrUpdate.qbl b/_Main/BL/Type_ManufactureLTImputation/StaticMethod_CreateOrUpdate.qbl
index 3190688..27fc818 100644
--- a/_Main/BL/Type_ManufactureLTImputation/StaticMethod_CreateOrUpdate.qbl
+++ b/_Main/BL/Type_ManufactureLTImputation/StaticMethod_CreateOrUpdate.qbl
@@ -1,7 +1,7 @@
 Quintiq file version 2.0
 #parent: #root
 StaticMethod CreateOrUpdate (
-  MacroPlan macroPlan,
+  GlobalOTDTable parent,
   String orgCode,
   String productId,
   String desc
@@ -10,9 +10,9 @@
   TextBody:
   [*
     // yypsybs Aug-25-2023 (created)
-    value := select( macroPlan, ManufactureLTImputation, item, item.OrgCode() = orgCode and item.SkuID() = productId );
+    value := select( parent, ManufactureLTImputation, item, item.OrgCode() = orgCode and item.SkuID() = productId );
     if( isnull( value ) ) {
-        value := macroPlan.ManufactureLTImputation( relnew, OrgCode := orgCode, SkuID := productId, Describe := desc );
+        value := parent.ManufactureLTImputation( relnew, OrgCode := orgCode, SkuID := productId, Describe := desc );
     } else {
         value.Describe( desc );  
     }
diff --git a/_Main/BL/Type_ManufactureLTImputation/StaticMethod_NewStaticMethod.qbl b/_Main/BL/Type_ManufactureLTImputation/StaticMethod_NewStaticMethod.qbl
deleted file mode 100644
index 5884b30..0000000
--- a/_Main/BL/Type_ManufactureLTImputation/StaticMethod_NewStaticMethod.qbl
+++ /dev/null
@@ -1,9 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-StaticMethod NewStaticMethod
-{
-  TextBody:
-  [*
-    // yypsybs Sep-19-2023 (created)
-  *]
-}
diff --git a/_Main/BL/Type_ManufactureLTImputation/StaticMethod_Refresh.qbl b/_Main/BL/Type_ManufactureLTImputation/StaticMethod_Refresh.qbl
index 90c199f..c36ff8f 100644
--- a/_Main/BL/Type_ManufactureLTImputation/StaticMethod_Refresh.qbl
+++ b/_Main/BL/Type_ManufactureLTImputation/StaticMethod_Refresh.qbl
@@ -1,7 +1,8 @@
 Quintiq file version 2.0
 #parent: #root
 StaticMethod Refresh (
-  ManufactureLTImputations toRefresh
+  ManufactureLTImputations toRefresh,
+  MacroPlan macroPlan
 )
 {
   TextBody:
@@ -9,7 +10,7 @@
     // yypsybs Aug-28-2023 (created)
     traverse( toRefresh, Elements, parent ) {
       traverse( parent, ManufactureLTProcessSection, child ) {
-        ManufactureLTProcessSection::Apply( child );  
+        ManufactureLTProcessSection::Apply( child, macroPlan );  
       }
     }
   *]
diff --git "a/_Main/BL/Type_ManufactureLTImputation/StaticMethod_Transfer\04325.qbl" "b/_Main/BL/Type_ManufactureLTImputation/StaticMethod_Transfer\04325.qbl"
new file mode 100644
index 0000000..2845682
--- /dev/null
+++ "b/_Main/BL/Type_ManufactureLTImputation/StaticMethod_Transfer\04325.qbl"
@@ -0,0 +1,15 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod Transfer (
+  MacroPlan macroPlan,
+  GlobalOTDTable parent
+)
+{
+  TextBody:
+  [*
+    // yypsybs Oct-11-2023 (created)
+    traverse( macroPlan, Routing.RoutingStep.Operation, item ) {
+         ManufactureLTProcessSection::CreateOrUpdate( item, parent );
+    }
+  *]
+}
diff --git a/_Main/BL/Type_ManufactureLTImputation/StaticMethod_Transfer.qbl b/_Main/BL/Type_ManufactureLTImputation/StaticMethod_Transfer.qbl
deleted file mode 100644
index ae70b83..0000000
--- a/_Main/BL/Type_ManufactureLTImputation/StaticMethod_Transfer.qbl
+++ /dev/null
@@ -1,33 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-StaticMethod Transfer (
-  MacroPlan oldMP,
-  MacroPlan newMP
-)
-{
-  Description: '绉讳氦鎺у埗鏉�'
-  TextBody:
-  [*
-    //// yypsybs Aug-25-2023 (created)
-    //if( isnull( oldMP ) ) {
-    //    info( "========transfer ManufactureLTImputations to macroPlan " + [String]newMP.MDSID() + "========" );
-    //} else {
-    //    info( "========transfer ManufactureLTImputations from macroPlan " + [String]oldMP.MDSID() + " to macroPlan " + [String]newMP.MDSID() + "========" );
-    //}
-    //// 娓呯┖鏂扮殑锛岃�佺殑澶嶅埗鍒版柊鐨勶紝娓呯┖鑰佺殑
-    //if( not isnull( oldMP ) and not isnull( newMP ) ) {
-    //    info( "old ManufactureLTImputation size : " + [String]oldMP.ManufactureLTImputation( relsize ) )
-    //    traverse( oldMP, ManufactureLTImputation, parent, true ) {
-    //        traverse( parent, ManufactureLTProcessSection, child, true ) {
-    //              ManufactureLTProcessSection::CreateOrUpdate( newMP, parent.OrgCode(), parent.SkuID(), parent.Describe(), 
-    //                                                            child.ProcessSection(), child.Sequence(), child.Line(), child.SystemLT(),
-    //                                                           child.Edited(), child.EditLT(), child.Describe() );
-    //        }
-    //    }  
-    //}
-    //// 澶勭悊鏂扮殑鐨刼peration
-    //traverse( newMP, Routing.RoutingStep.Operation, item ) {
-    //     ManufactureLTProcessSection::CreateOrUpdate( item );
-    //}
-  *]
-}
diff --git "a/_Main/BL/Type_ManufactureLTProcessSection/StaticMethod_Apply\043202.qbl" "b/_Main/BL/Type_ManufactureLTProcessSection/StaticMethod_Apply\043202.qbl"
index 502281f..278b5f3 100644
--- "a/_Main/BL/Type_ManufactureLTProcessSection/StaticMethod_Apply\043202.qbl"
+++ "b/_Main/BL/Type_ManufactureLTProcessSection/StaticMethod_Apply\043202.qbl"
@@ -1,14 +1,15 @@
 Quintiq file version 2.0
 #parent: #root
 StaticMethod Apply (
-  ManufactureLTProcessSection toApply
+  ManufactureLTProcessSection toApply,
+  MacroPlan macroPlan
 )
 {
   TextBody:
   [*
     // yypsybs Aug-28-2023 (created)
     parent := toApply.ManufactureLTImputation();
-    toUpdate := select( toApply, ManufactureLTImputation.MacroPlan.Routing.RoutingStep.Operation, op,
+    toUpdate := select( macroPlan, Routing.RoutingStep.Operation, op,
                         op.RoutingID() = parent.OrgCode() + "_" + parent.SkuID() 
                         and op.RoutingStepName() = toApply.ProcessSection() + "_" + toApply.Sequence()
                         and op.Name() = ifexpr( toApply.Line() <> "", 
@@ -18,7 +19,7 @@
       toUpdate.UserLeadTime( Duration::Days( toApply.EditLT() ) );
       toApply.SystemLT( toApply.EditLT() );
     } else {
-      info( "operation to update not found" );  
+      debuginfo(  "operation to update not found" );  
     }
   *]
 }
diff --git a/_Main/BL/Type_ManufactureLTProcessSection/StaticMethod_Apply.qbl b/_Main/BL/Type_ManufactureLTProcessSection/StaticMethod_Apply.qbl
index 2b410b4..7f69c3f 100644
--- a/_Main/BL/Type_ManufactureLTProcessSection/StaticMethod_Apply.qbl
+++ b/_Main/BL/Type_ManufactureLTProcessSection/StaticMethod_Apply.qbl
@@ -1,14 +1,15 @@
 Quintiq file version 2.0
 #parent: #root
 StaticMethod Apply (
-  ManufactureLTProcessSections toApply
+  ManufactureLTProcessSections toApply,
+  MacroPlan macroPlan
 )
 {
   TextBody:
   [*
     // yypsybs Aug-28-2023 (created)
     traverse( toApply, Elements, child ) {
-      ManufactureLTProcessSection::Apply( child );
+      ManufactureLTProcessSection::Apply( child, macroPlan );
     }
   *]
 }
diff --git a/_Main/BL/Type_ManufactureLTProcessSection/StaticMethod_CreateOrUpdate.qbl b/_Main/BL/Type_ManufactureLTProcessSection/StaticMethod_CreateOrUpdate.qbl
index fe55479..662ef7e 100644
--- a/_Main/BL/Type_ManufactureLTProcessSection/StaticMethod_CreateOrUpdate.qbl
+++ b/_Main/BL/Type_ManufactureLTProcessSection/StaticMethod_CreateOrUpdate.qbl
@@ -1,7 +1,8 @@
 Quintiq file version 2.0
 #parent: #root
 StaticMethod CreateOrUpdate (
-  Operation op
+  Operation op,
+  GlobalOTDTable parent
 ) as ManufactureLTProcessSection
 {
   TextBody:
@@ -31,9 +32,11 @@
     }
     child := null( ManufactureLTProcessSection );
     //if( orgCode <> "" and productId <> "" and processStep <> "" and sequence <> "" ) {
-    //    parent := ManufactureLTImputation::CreateOrUpdate( op.RoutingStep().Routing().MacroPlan(), orgCode, productId, "" );
-    //    info( "DaysAsReal : " + [String]op.UserLeadTime().DaysAsReal() );
-    //    child := ManufactureLTProcessSection::CreateOrUpdate( parent, processStep, false, sequence, line, op.UserLeadTime().DaysAsReal(), 0.0, "" );
+      ltParent := ManufactureLTImputation::CreateOrUpdate( parent, orgCode, productId, "" );
+      info( "DaysAsReal : " + [String]op.UserLeadTime().DaysAsReal() );
+      child := ManufactureLTProcessSection::CreateOrUpdate( ltParent, processStep, false, sequence, line, op.UserLeadTime().DaysAsReal(), 0.0, "" );
+    //} else {
+    //  info( "skip operation" );
     //}
     return child;
   *]
diff --git a/_Main/BL/Type_ManufactureLTProcessSection/StaticMethod_CreateOrUpdate0.qbl b/_Main/BL/Type_ManufactureLTProcessSection/StaticMethod_CreateOrUpdate0.qbl
index b18ed17..533457a 100644
--- a/_Main/BL/Type_ManufactureLTProcessSection/StaticMethod_CreateOrUpdate0.qbl
+++ b/_Main/BL/Type_ManufactureLTProcessSection/StaticMethod_CreateOrUpdate0.qbl
@@ -1,6 +1,7 @@
 Quintiq file version 2.0
 #parent: #root
 StaticMethod CreateOrUpdate (
+  GlobalOTDTable parent,
   MacroPlan macroPlan,
   String orgCode,
   String productId,
@@ -17,15 +18,15 @@
   TextBody:
   [*
     // yypsybs Aug-25-2023 (created)
-    parent := select( macroPlan, ManufactureLTImputation, item, item.OrgCode() = orgCode and item.SkuID() = productId );
-    if( isnull( parent ) ) {
-        parent := macroPlan.ManufactureLTImputation( relnew, OrgCode := orgCode, SkuID := productId, Describe := parentDesc );
+    ltParent := select( parent, ManufactureLTImputation, item, item.OrgCode() = orgCode and item.SkuID() = productId );
+    if( isnull( ltParent ) ) {
+        ltParent := parent.ManufactureLTImputation( relnew, OrgCode := orgCode, SkuID := productId, Describe := parentDesc );
     } else {
-        parent.Describe( parentDesc );  
+        ltParent.Describe( parentDesc );  
     }
-    child := select( parent, ManufactureLTProcessSection, item, item.ProcessSection() = processSection and item.Sequence() = seq and item.Line() = line );
+    child := select( ltParent, ManufactureLTProcessSection, item, item.ProcessSection() = processSection and item.Sequence() = seq and item.Line() = line );
     if( isnull( child ) ) {
-        child := parent.ManufactureLTProcessSection( relnew, 
+        child := ltParent.ManufactureLTProcessSection( relnew, 
                                                      ProcessSection := processSection, Sequence := seq, Line := line, SystemLT := systemLt, 
                                                      Edited := edited, EditLT := editLt, Describe := childDesc );
     } else {
diff --git "a/_Main/BL/Type_ManufactureLTProcessSection/StaticMethod_Refresh\0431.qbl" "b/_Main/BL/Type_ManufactureLTProcessSection/StaticMethod_Refresh\0431.qbl"
deleted file mode 100644
index 069eb30..0000000
--- "a/_Main/BL/Type_ManufactureLTProcessSection/StaticMethod_Refresh\0431.qbl"
+++ /dev/null
@@ -1,23 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-StaticMethod Refresh (
-  ManufactureLTProcessSection toRefresh
-)
-{
-  TextBody:
-  [*
-    // yypsybs Aug-28-2023 (created)
-    parent := toRefresh.ManufactureLTImputation();
-    toUpdate := select( toRefresh, ManufactureLTImputation.MacroPlan.Routing.RoutingStep.Operation, op,
-                        op.RoutingID() = parent.OrgCode() + "_" + parent.SkuID() 
-                        and op.RoutingStepName() = toRefresh.ProcessSection() + "_" + toRefresh.Sequence()
-                        and op.Name() = ifexpr( toRefresh.Line() <> "", 
-                                                parent.OrgCode() + "_" + toRefresh.ProcessSection() + "_" + toRefresh.Line(),
-                                                parent.OrgCode() + "_" + toRefresh.ProcessSection() ) );
-    if( not isnull( toUpdate ) ) {
-      toRefresh.SystemLT( toUpdate.UserLeadTime().DaysAsReal() );
-    } else {
-      info( "operation to refresh not found" );  
-    }
-  *]
-}
diff --git a/_Main/BL/Type_ManufactureLTProcessSection/StaticMethod_Refresh.qbl b/_Main/BL/Type_ManufactureLTProcessSection/StaticMethod_Refresh.qbl
deleted file mode 100644
index b39c91c..0000000
--- a/_Main/BL/Type_ManufactureLTProcessSection/StaticMethod_Refresh.qbl
+++ /dev/null
@@ -1,14 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-StaticMethod Refresh (
-  ManufactureLTProcessSections toApply
-)
-{
-  TextBody:
-  [*
-    // yypsybs Aug-28-2023 (created)
-    traverse( toApply, Elements, child ) {
-      ManufactureLTProcessSection::Refresh( child );
-    }
-  *]
-}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Method_OnOk.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Method_OnOk.def
index b488de3..c7a866e 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Method_OnOk.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Method_OnOk.def
@@ -6,7 +6,7 @@
   [*
     // Disabled button to prevent the possibility of multiple firing
     
-    macroPlanOld := MacroPlan;
+    //macroPlanOld := MacroPlan;
     
     btnOK.Enabled( false, '' )
     
@@ -110,7 +110,7 @@
     }
     
     macroPlanNew := MacroPlan;
-    ManufactureLTImputation::Transfer( macroPlanOld, macroPlanNew );
+    //ManufactureLTImputation::Transfer( macroPlanOld, macroPlanNew );
     
     // sync data
     if( data.EnableSync() ) {
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Component_ListCapacityAndSaleBudge.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Component_ListCapacityAndSaleBudge.def
index 4af954a..a0f1d91 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Component_ListCapacityAndSaleBudge.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Component_ListCapacityAndSaleBudge.def
@@ -38,6 +38,6 @@
   ]
   Properties:
   [
-    Taborder: 2
+    Taborder: 3
   ]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_ButtonExportDetail_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_ButtonExportDetail_OnClick.def
index 6ff9db2..e09f8c8 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_ButtonExportDetail_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_ButtonExportDetail_OnClick.def
@@ -7,7 +7,7 @@
   DefinitionID: 'Responsedef_WebButton_OnClick'
   Precondition:
   [*
-    return not isnull( MPSync );
+    return not isnull( GlobalOTDTable );
   *]
   QuillAction
   {
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_ButtonGenerateTestData_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_ButtonGenerateTestData_OnClick.def
new file mode 100644
index 0000000..ca24ac8
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_ButtonGenerateTestData_OnClick.def
@@ -0,0 +1,21 @@
+Quintiq file version 2.0
+#parent: ButtonGenerateTestData
+Response OnClick () id:Response_FormCapacityAndSaleBudge_ButtonGenerateTestData_OnClick
+{
+  #keys: '[414384.0.971540692]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebButton_OnClick'
+  Precondition:
+  [*
+    return not isnull( MacroPlan );
+  *]
+  QuillAction
+  {
+    Body:
+    [*
+      GlobalOTDTable.InitTestDataByYear( MacroPlan, DataHolderCapacityAndSaleBudgeFilterYear.Data() );
+      Global_MappingAnnualBudgetData::SetOrgCodeFromForecast( GlobalOTDTable );
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_OnCreated.def
index e0e1268..8a33617 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_OnCreated.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_OnCreated.def
@@ -12,8 +12,6 @@
     [*
       MPSync::TestData( MPSync, MacroPlan );
       GlobalOTDTable.InitTestData();
-      GlobalOTDTable.InitTestData( MacroPlan );
-      Global_MappingAnnualBudgetData::SetOrgCodeFromForecast( GlobalOTDTable );
       GlobalOTDTable.RefreshCapacityAndSaleBudgeFilter( true );
     *]
   }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/_ROOT_Component_FormCapacityAndSaleBudge.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/_ROOT_Component_FormCapacityAndSaleBudge.def
index c2687d8..995281a 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/_ROOT_Component_FormCapacityAndSaleBudge.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/_ROOT_Component_FormCapacityAndSaleBudge.def
@@ -16,7 +16,7 @@
       [
         Image: 'EXPORT1'
         Label: '瀵煎嚭'
-        Taborder: 0
+        Taborder: 1
       ]
     }
     Component ButtonExportTest
@@ -27,10 +27,21 @@
       [
         Image: 'EXPORT1'
         Label: '瀵煎嚭娴嬭瘯'
-        Taborder: 1
+        Taborder: 2
         Visible: false
       ]
     }
+    Component ButtonGenerateTestData
+    {
+      #keys: '[414384.0.971540693]'
+      BaseType: 'WebButton'
+      Properties:
+      [
+        Image: 'IMPORT1'
+        Label: '鏍规嵁绛涢�夋湀浠界敓鎴愭祴璇曟暟鎹�'
+        Taborder: 0
+      ]
+    }
   ]
   Properties:
   [
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormManufactureLT/Component_ListManufactureLT\043943.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormManufactureLT/Component_ListManufactureLT\043943.def"
index c2d85db..d71a6ee 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_FormManufactureLT/Component_ListManufactureLT\043943.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormManufactureLT/Component_ListManufactureLT\043943.def"
@@ -11,8 +11,8 @@
       BaseType: 'WebDataExtractor'
       Properties:
       [
-        DataType: 'MacroPlan'
-        Source: 'MacroPlan'
+        DataType: 'GlobalOTDTable'
+        Source: 'GlobalOTDTable'
         Taborder: 0
         Transformation: 'ManufactureLTImputation'
       ]
@@ -37,7 +37,7 @@
   ]
   Properties:
   [
-    Taborder: 0
+    Taborder: 1
   ]
   ResponseDefinitions:
   [
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormManufactureLT/Response_ButtonLoad_OnClick\043417.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormManufactureLT/Response_ButtonLoad_OnClick\043417.def"
new file mode 100644
index 0000000..fca0b35
--- /dev/null
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormManufactureLT/Response_ButtonLoad_OnClick\043417.def"
@@ -0,0 +1,20 @@
+Quintiq file version 2.0
+#parent: ButtonLoad_657
+Response OnClick () id:Response_PanelPRDataButton_ButtonLoad_OnClick_417
+{
+  #keys: '[414384.0.967076760]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebButton_OnClick'
+  Precondition:
+  [*
+    return not isnull( MacroPlan );
+  *]
+  QuillAction
+  {
+    Body:
+    [*
+      ManufactureLTImputation::Transfer( MacroPlan, GlobalOTDTable );
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormManufactureLT/Response_ListManufactureLT_943_MenuApply_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormManufactureLT/Response_ListManufactureLT_943_MenuApply_OnClick.def
new file mode 100644
index 0000000..facd5e2
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormManufactureLT/Response_ListManufactureLT_943_MenuApply_OnClick.def
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#parent: ListManufactureLT_943
+Response OnClick (
+  structured[ManufactureLTImputation] selection
+) id:Response_ListManufactureLT_943_MenuApply_OnClick
+{
+  #keys: '[414384.0.967590502]'
+  CanBindMultiple: false
+  DefinitionID => /ListManufactureLT_943/Responsedef_ListManufactureLT_943_WebMenu_OnClick
+  GroupServerCalls: true
+  Initiator: 'MenuApply'
+  Precondition:
+  [*
+    return not isnull( MacroPlan );
+  *]
+  QuillAction
+  {
+    Body:
+    [*
+      ManufactureLTImputation::Apply( selection, MacroPlan );
+    *]
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormManufactureLT/_ROOT_Component_FormManufactureLT.def b/_Main/UI/MacroPlannerWebApp/Component_FormManufactureLT/_ROOT_Component_FormManufactureLT.def
index a35f176..a5790c1 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormManufactureLT/_ROOT_Component_FormManufactureLT.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormManufactureLT/_ROOT_Component_FormManufactureLT.def
@@ -8,6 +8,17 @@
   Children:
   [
     #child: ListManufactureLT_943
+    Component ButtonLoad id:ButtonLoad_657
+    {
+      #keys: '[414384.0.967076761]'
+      BaseType: 'WebButton'
+      Properties:
+      [
+        Image: 'THICK_ARROW_DOWN_BLUE'
+        Label: '閲嶆柊鍔犺浇'
+        Taborder: 0
+      ]
+    }
   ]
   Properties:
   [
diff --git a/_var/_Main/ProjSettings/MacroPlannerWebApp/Views/ManufactureLT.vw b/_var/_Main/ProjSettings/MacroPlannerWebApp/Views/ManufactureLT.vw
new file mode 100644
index 0000000..76e471c
--- /dev/null
+++ b/_var/_Main/ProjSettings/MacroPlannerWebApp/Views/ManufactureLT.vw
@@ -0,0 +1,239 @@
+Quintiq file version 2.0
+{
+  viewcontents
+  {
+    forms
+    {
+      form_legacy_1
+      {
+        title: 'Scenario manager'
+        shown: true
+        componentID: 'FormScenarioManager'
+        layout
+        {
+          mode: 'open'
+          rowPosition: 1
+          rowSpan: 8
+          columnPosition: 1
+          columnSpan: 5
+        }
+        components
+        {
+          FormScenarioManager_ListScenario
+          {
+          }
+          FormScenarioManager_DataSetLevelScenario
+          {
+            groupDepth: -1
+            column_All_constraints
+            {
+              columnId: 'All constraints'
+              dataPath: 'All constraints'
+              dataType: 'string'
+              title: 'All constraints'
+              index: 0
+              subtotals: ''
+              width: 90
+            }
+            column_Name
+            {
+              columnId: 'Name'
+              dataPath: 'Name'
+              dataType: 'string'
+              title: '鍚嶇О'
+              index: 1
+              subtotals: ''
+              width: 197
+            }
+            column_ChangedBy
+            {
+              columnId: 'ChangedBy'
+              dataPath: 'ChangedBy'
+              dataType: 'string'
+              title: 'Changed by'
+              index: 2
+              subtotals: ''
+              width: 91
+            }
+            column_ChangedOn
+            {
+              columnId: 'ChangedOn'
+              dataPath: 'ChangedOn'
+              dataType: 'datetime'
+              title: 'Changed on'
+              index: 3
+              subtotals: ''
+              width: 99
+            }
+            column_StorageMode
+            {
+              columnId: 'StorageMode'
+              dataPath: 'StorageMode'
+              dataType: 'string'
+              title: 'StorageMode'
+              index: 4
+              subtotals: ''
+              width: 40
+            }
+          }
+        }
+      }
+      form_FormOptimizerPuzzles
+      {
+        title: 'Optimizer Puzzles'
+        shown: false
+        componentID: 'FormOptimizerPuzzles'
+        layout
+        {
+          mode: 'dockright'
+          index: 0
+        }
+        components
+        {
+          FormOptimizerPuzzles_ListOptimizerPuzzles
+          {
+          }
+          FormOptimizerPuzzles_DataSetLevelOptimizerPuzzles
+          {
+            groupDepth: -1
+            column_All_constraints
+            {
+              columnId: 'All constraints'
+              dataPath: 'All constraints'
+              dataType: 'string'
+              title: 'All constraints'
+              index: 0
+              subtotals: ''
+              width: 32
+            }
+            column_Name
+            {
+              columnId: 'Name'
+              dataPath: 'Name'
+              dataType: 'string'
+              title: '鍚嶇О'
+              index: 1
+              subtotals: ''
+              width: 109
+            }
+            column_Description
+            {
+              columnId: 'Description'
+              dataPath: 'Description'
+              dataType: 'string'
+              title: '鎻忚堪'
+              index: 2
+              subtotals: ''
+              width: 207
+            }
+          }
+        }
+      }
+      form_FormKPI
+      {
+        title: 'KPI Dashboard'
+        shown: false
+        componentID: 'FormKPI'
+        layout
+        {
+          mode: 'dockright'
+          index: 1
+        }
+        components
+        {
+          FormKPI_PanelKPI
+          {
+            sizeRatio: 1
+            activeChild: 'PanelKPISelection'
+          }
+          FormKPI_PanelKPIDashboard
+          {
+            sizeRatio: 1
+          }
+          FormKPI_PanelKPISelection
+          {
+            sizeRatio: 1
+          }
+          FormKPI_ListKPISelection
+          {
+            QuillViewData
+            {
+              Food_KPISetting: 'Cost of sales;Fulfillment;Fulfillment target;Inventory holding cost;Labor cost;Margin;Safety stock;Sales;Sourcing cost;Total CO2 emission;Transportation cost;Volume'
+            }
+          }
+          FormKPI_DataSetLevelKPISelection
+          {
+            groupDepth: -1
+            column_All_constraints
+            {
+              columnId: 'All constraints'
+              dataPath: 'All constraints'
+              dataType: 'string'
+              title: 'All constraints'
+              index: 0
+              subtotals: ''
+              width: 32
+            }
+            column_Name
+            {
+              columnId: 'Name'
+              dataPath: 'Name'
+              dataType: 'string'
+              title: '鍚嶇О'
+              index: 1
+              subtotals: ''
+              width: 200
+            }
+          }
+        }
+      }
+      form_SWF_DialogWorkflowParameter
+      {
+        title: 'S&OP Workflow Parameters'
+        shown: true
+        componentID: 'SWF_DialogWorkflowParameter'
+        layout
+        {
+          mode: 'dockright'
+          index: 2
+        }
+        components
+        {
+          SWF_DialogWorkflowParameter_PanelCurrentDate
+          {
+            sizeRatio: 1
+          }
+          SWF_DialogWorkflowParameter_PanelIntegration
+          {
+            sizeRatio: 1
+          }
+          SWF_DialogWorkflowParameter_PanelSynchronizeRoles
+          {
+            sizeRatio: 1
+          }
+          SWF_DialogWorkflowParameter_PanelRequestDatasetSync
+          {
+            sizeRatio: 1
+          }
+          SWF_DialogWorkflowParameter_PanelKickQueues
+          {
+            sizeRatio: 1
+          }
+        }
+      }
+    }
+    userconfigurableinformation
+    {
+    }
+    page: 'ActionBarPageData'
+    group: ''
+    index: 1
+    image: 'CODE_LINE'
+    description: '鍒堕�燣T'
+  }
+  formatversion: 2
+  id: 'ManufactureLT'
+  name: 'ManufactureLT'
+  isglobal: false
+  isroot: true
+}

--
Gitblit v1.9.3