From 83278bc9522c243875f8717b7501fa46723bdc8e Mon Sep 17 00:00:00 2001
From: hongji.li <hongji.a.li@capgemini.com>
Date: 星期日, 08 十月 2023 16:08:15 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/TIANMA_JITUAN into dev_lhj

---
 _Main/BL/Type_BusinessType/StaticMethod_GetScenarioNamesStr.qbl                                                             |   10 
 _Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Method_OnOk.def                                              |    7 +
 _Main/UI/MacroPlannerWebApp/Component_DialogNewPriorityPolicy/Method_Edit.def                                               |   15 ++
 _Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenario_OnClick#549.def          |    2 
 _Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetMaterialData.qbl                                                           |   12 +-
 _Main/BL/Type_ScenarioManager/StaticMethod_AvailableScenarioNames.qbl                                                       |    4 
 _Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_ListPriorityPolicy_MenuEdit_OnClick.def                   |   15 ++
 _Main/UI/MacroPlannerWebApp/Component_FrmAuthorizeAndCountersign_Order/Response_OnCreated.def                               |   10 -
 _Main/UI/MacroPlannerWebApp/Component_FrmErrorLogs/Response_Panel391_Button655_OnClick.def                                  |   39 ++++++
 _Main/UI/MacroPlannerWebApp/Component_FrmErrorLogs/Component_Panel391.def                                                   |   24 ++++
 _Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenarioAndDoSync_OnClick#545.def |    2 
 _Main/UI/MacroPlannerWebApp/Component_FrmErrorLogs/_ROOT_Component_FrmErrorLogs.def                                         |    3 
 _Main/BL/Type_H_FunctionClass/StaticMethod_SM_OrderHedgingEx.qbl                                                            |  161 ++++++++++++++++++++++++++
 _Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenarioAndDoSync_OnClick.def     |    2 
 _Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Component_PanelGeneral#549.def                               |    4 
 _Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PriorityPolicyBusinessType_OnCreated.def                  |    2 
 _Main/UI/MacroPlannerWebApp/Component_FrmErrorLogs/Component_List710.def                                                    |    2 
 _Main/BL/Type_H_FunctionClass/StaticMethod_SM_OrderReverseOrAuthorize.qbl                                                   |    2 
 _Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenario_OnClick.def              |    2 
 _Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuEdit_OnClick.def                        |    2 
 _Main/BL/Type_CustomerOrder/StaticMethod_CreateOrUpdate.qbl                                                                 |    2 
 _Main/BL/Type_Scenario/Attribute_ScenarioName.qbl                                                                           |    8 +
 22 files changed, 295 insertions(+), 35 deletions(-)

diff --git a/_Main/BL/Type_BusinessType/StaticMethod_GetBusinessNameStr.qbl b/_Main/BL/Type_BusinessType/StaticMethod_GetScenarioNamesStr.qbl
similarity index 69%
rename from _Main/BL/Type_BusinessType/StaticMethod_GetBusinessNameStr.qbl
rename to _Main/BL/Type_BusinessType/StaticMethod_GetScenarioNamesStr.qbl
index 7496f0f..130ee5a 100644
--- a/_Main/BL/Type_BusinessType/StaticMethod_GetBusinessNameStr.qbl
+++ b/_Main/BL/Type_BusinessType/StaticMethod_GetScenarioNamesStr.qbl
@@ -1,6 +1,6 @@
 Quintiq file version 2.0
 #parent: #root
-StaticMethod GetBusinessNameStr (
+StaticMethod GetScenarioNamesStr (
   GlobalOTDTable owner
 ) as String
 {
@@ -9,18 +9,18 @@
     // NBoTk Sep-7-2023 (created)
     // 鑾峰彇businessType 闆嗗悎
     result := "";
-    businessTypeList := construct( structured[String]);
+    scenarioNameList := construct( structured[String]);
     
     traverse( owner,BusinessType,b)
     {
-        businessTypeList.Add( b.BusinessTypeName()); 
+        scenarioNameList.Add( b.ScenarioName() ); 
     }
     
     // 濡傛灉瀛樺湪businessType鏁版嵁 鍒欒繑鍥� : a,b,c
     
-    if( not isnull( businessTypeList ) )
+    if( not isnull( scenarioNameList ) )
     {
-        result := businessTypeList.Concatenate( ";" );
+        result := scenarioNameList.Concatenate( ";" );
     }
     
     // 娴嬭瘯鏁版嵁
diff --git a/_Main/BL/Type_CustomerOrder/StaticMethod_CreateOrUpdate.qbl b/_Main/BL/Type_CustomerOrder/StaticMethod_CreateOrUpdate.qbl
index e428bb7..1728622 100644
--- a/_Main/BL/Type_CustomerOrder/StaticMethod_CreateOrUpdate.qbl
+++ b/_Main/BL/Type_CustomerOrder/StaticMethod_CreateOrUpdate.qbl
@@ -58,7 +58,7 @@
     // 鏂板/鏇存柊
     result := CustomerOrder::FindById( macroPlan, id );
     if( isnull( result ) ) {
-        CustomerOrder::Create( product, stockingPoint, id, orderDate, quantity, price, 
+        result := CustomerOrder::Create( product, stockingPoint, id, orderDate, quantity, price, 
                                priorityName, salesSegmentName, currencyId, unitOfMeasureName, 
                                false, customerName, customerId, orderId, orderLineId, true, true, true );
     } else {
diff --git a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetMaterialData.qbl b/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetMaterialData.qbl
index 850417c..2f75b5f 100644
--- a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetMaterialData.qbl
+++ b/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetMaterialData.qbl
@@ -24,10 +24,10 @@
     strMsg :="";
     
     try{
-      if( Owner.MappingBOM(relsize )>0)
+      if( GlobData.Global_MappingOperationBOM(relsize )>0)
       {
         // 寰楀埌涓嬩竴绾ф暟鎹�
-        AllData:= selectset( GlobData, Global_MappingOperationBOM,object,object.ComponentCode()=ParentSKU);
+        AllData:= selectset( GlobData, Global_MappingOperationBOM,object,object.ProductCode()=ParentSKU);
         ObjProduct := null( Product_MP,constcontent );
         ObjUnit := null( Unit,constcontent );
         MaterialType:="";
@@ -51,24 +51,24 @@
           traverse( AllData,Elements,Obj,not isnull( Obj))
           {
             // 寰楀埌褰撳墠宸插瓨鍦ㄧ殑鐗╂枡淇℃伅锛堣鍗旾D + SKU锛�
-            ObjMaterial := select( Owner,H_MaterialInfo,ObjM,ObjM.ForecastID()=ForecastId and ObjM.SKU()=Obj.ProductCode());
+            ObjMaterial := select( Owner,H_MaterialInfo,ObjM,ObjM.ForecastID()=ForecastId and ObjM.SKU()=Obj.ComponentCode());
             if( isnull( ObjMaterial))
             {
               // 鐗╂枡绫诲瀷
               MaterialType := Obj.ProductType();
               // 寰楀埌鐗╂枡淇℃伅
-              ObjProduct:= H_FunctionClass::SM_GetProductInfo(Owner,Obj.ProductCode());
+              ObjProduct:= H_FunctionClass::SM_GetProductInfo(Owner,Obj.ComponentCode());
               if( not isnull( ObjProduct))
               {
                 MaterialType:= ObjProduct.ParentID();
                 MaterialName:=ObjProduct.Name();
               }
-              ObjUnit:= H_FunctionClass::SM_GetUnitBySKU( Owner,Obj.ProductCode());
+              ObjUnit:= H_FunctionClass::SM_GetUnitBySKU( Owner,Obj.ComponentCode());
               if( not isnull( ObjUnit))
               {
                 StockPoint:= ObjUnit.Name();
               }
-              Owner.H_MaterialInfo(relnew,ParentSKU := Obj.ComponentCode(),SKU := Obj.ProductCode(),ForecastID := ForecastId,OrgCode := Obj.OrganCode(),VCode := VCode
+              Owner.H_MaterialInfo(relnew,ParentSKU := ParentSKU,SKU := Obj.ComponentCode(),ForecastID := ForecastId,OrgCode := Obj.OrganCode(),VCode := VCode
                                     ,ID := H_FunctionClass::SM_GenerateID( "MI"),MaterialType := MaterialType,NeedDate := NDate
                                     ,NeedQty := [Number](ProductQty/NRate*NComponentsUsed).Round( 0),Unit := Obj.UnitOfMeasureName()
                                     ,StockPoint :=StockPoint,MaterialName := MaterialName );
diff --git a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_OrderHedgingEx.qbl b/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_OrderHedgingEx.qbl
new file mode 100644
index 0000000..dd62492
--- /dev/null
+++ b/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_OrderHedgingEx.qbl
@@ -0,0 +1,161 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SM_OrderHedgingEx (
+  MacroPlan Owner,
+  String Operator
+) as owning JSON
+{
+  Description: '濉骇鍚庡啿鍑�'
+  TextBody:
+  [*
+    /*******************************濉骇鍚庤鍗曞啿鍑�***********************
+    *鍑芥暟鍚嶇О锛歋M_OrderHedgingEx
+    *鍒� 寤� 浜猴細yunying
+    *鍒涘缓鏃堕棿锛�2023-09-27
+    *鎻�    杩帮細濉骇鍚庤鍗曞啿鍑�,濉骇鍚庣殑琛細Owner.FillingCapacityOrder
+    *鍙�    鏁帮細Operator 鎿嶄綔浜�
+    *杩� 鍥� 鍊硷細JSON {Status: true 鎴愬姛/false 澶辫触,Msg:"鎻愮ず娑堟伅",Count: 0锛堝啿鍑忚鍗曠殑鏁伴噺锛墋
+    *******************************************************************/
+    // 鍒濆鍖栫粨鏋�
+    bStatus := false;
+    strMsg :="";
+    // 鍐插噺鎴愬姛鏉℃暟
+    nCount:=0;
+    try
+    {
+      if(not isnull( Owner))
+      {
+        // 鑾峰彇鎿嶄綔璁㈠崟
+        NewOrders := selectset( Owner,FillingCapacityOrder,Obj,Obj.State() = "鏈啿鍑�" or Obj.State() ="");
+        if(NewOrders.Size()>0)
+        {
+          // 鏂拌鍗曚笌鍘熻鍗曞啿鍑�
+          traverse( NewOrders,Elements,Obj)
+          {
+            if( (Obj.OrderType()="鍙嶇" or Obj.OrderType()="鎺堟潈") and Obj.Quantity()>0 )
+            {
+              // 寰楀埌鎿嶄綔鐩稿叧鐨勫弽绛捐鍗�
+              ROrders:= select( Owner,SalesDemand.astype( CustomerOrder ),ObjOrder,
+                                   ObjOrder.CustomerName() = Obj.Customer() 
+                                   and ObjOrder.ProductID()=Obj.ProductID() 
+                                   and ObjOrder.OrderTag() ="鍙嶇"
+                                   );
+              // 鍙嶇鏃犲啿鍑忥紝鐩存帴鍚戣鍗曚腑鍔犲叆鍙嶇鏁版嵁
+              if( Obj.OrderType()="鍙嶇")
+              {
+                if( not isnull( ROrders))
+                {
+                  ROrders.Quantity(ROrders.Quantity()+Obj.Quantity());
+                }
+                else
+                {
+                  // 鏂板璁㈠崟
+                  error( "----------------璇峰疄鐜版柊澧炲弽绛捐鍗曞姛鑳戒唬鐮�---------------------");
+                  // 璁㈠崟蹇呰淇℃伅濡備笅锛�
+                  // OrderTag = "鍙嶇"
+                  // Quantity = Obj.Quantity()
+                  // 鍏朵粬淇℃伅缁ф壙褰撳墠鐨勮鍗�
+                }
+              }
+              else if(Obj.OrderType()="鎺堟潈")
+              {
+                // 寰楀埌鎿嶄綔鐩稿叧鐨勬巿鏉冭鍗�
+                AOrders:= select( Owner,SalesDemand.astype( CustomerOrder ),ObjOrder,
+                                   ObjOrder.CustomerName() = Obj.Customer() 
+                                   and ObjOrder.ProductID()=Obj.ProductID() 
+                                   and ObjOrder.OrderTag() ="鎺堟潈"
+                                   );
+                if( not isnull( ROrders))
+                {
+                  // 褰撳墠鍙嶇鏁伴噺
+                  RQty:=ROrders.Quantity();
+                  // 璁$畻鏂扮殑鎺堟潈鏁伴噺
+                  AQty:= Obj.Quantity() - ROrders.Quantity();
+                  // 鎺堟潈澶т簬0锛屽弽绛捐鍐叉病,鍚﹀垯鎺堟潈琚啿锛屽弽绛剧瓑浜嶢Qty鐨勭粷瀵瑰��
+                  if( AQty>=0)
+                  {
+                    RQty:=0;
+                  }
+                  else
+                  {
+                    RQty :=ROrders.Quantity() - Obj.Quantity();
+                    AQty :=0;
+                  }
+                  // 鏇存柊鍙嶇鏁版嵁
+                  if( RQty>=0)
+                  {
+                    ROrders.Quantity(RQty);
+                  }
+                  else
+                  {
+                    ROrders.Delete();
+                  }
+                  // 鏇存柊鎺堟潈鏁版嵁
+                  if(AQty>0 )
+                  {
+                    if( not isnull( AOrders))
+                    {
+                      AOrders.Quantity(AOrders.Quantity()+AQty);
+                    }
+                    // 鏂板鎺堟潈璁㈠崟
+                    error( "----------------璇峰疄鐜版柊澧炴巿鏉冭鍗曞姛鑳戒唬鐮�---------------------");
+                    // 璁㈠崟蹇呰淇℃伅濡備笅锛�
+                    // OrderTag = "鎺堟潈"
+                    // Quantity = AQty
+                    // 鍏朵粬淇℃伅缁ф壙褰撳墠鐨勮鍗�  
+                  }
+                }
+                else
+                {
+                  // 灏嗘柊鎺堟潈鏁版嵁绱姞鍒拌鍗曚腑
+                  if( not isnull( AOrders))
+                  {
+                    AOrders.Quantity(AOrders.Quantity()+Obj.Quantity());
+                  }
+                  else
+                  {
+                    // 鏂板鎺堟潈璁㈠崟
+                    error( "----------------璇峰疄鐜版柊澧炴巿鏉冭鍗曞姛鑳戒唬鐮�---------------------");
+                    // 璁㈠崟蹇呰淇℃伅濡備笅锛�
+                    // OrderTag = "鎺堟潈"
+                    // Quantity = Obj.Quantity()
+                    // 鍏朵粬淇℃伅缁ф壙褰撳墠鐨勮鍗�
+                  }
+                }
+              }
+              // 鏇存柊鍐插噺鐘舵��
+              Obj.State("宸插啿鍑�");
+              nCount++;
+            }
+            else
+            {
+              // 鏃犳硶璇嗗埆鐨勭被鍨嬶紝鎴栨暟閲忎负0鏃舵殏涓嶅鐞�
+              //strMsg :="璁㈠崟绫诲瀷锛�" + Obj.OrderType() + "鏃犳硶鍐插噺锛�";
+            }
+          }
+          bStatus:=true;
+          strMsg :="濉骇鍚庡啿鍑忓畬鎴愶紒";
+        }
+        else
+        {
+          strMsg :="鏃犲彲鍐插噺鐨勬暟鎹紒";
+        }
+      }
+      else
+      {
+        strMsg :="鍔犺浇鏁版嵁澶辫触锛岃鍒涘缓鎴栭�夋嫨鍦烘櫙鍚庡啀鎿嶄綔锛�";
+      }
+    }
+    onerror
+    {
+      strMsg :="濉骇鍚庤鍗曞啿鍑忓彂鐢熼敊璇紝璇疯仈绯荤郴缁熺鐞嗗憳锛�";
+      // 璁板綍閿欒鏃ュ織
+    //  Owner.H_ErrorLogs(relnew,EClassName := "H_FunctionClass",EDateTime := DateTime::ActualGMTTime(),EFunctionName := "SM_OrderHedgingEx",
+    //                     DeveloperInformation :=  e.DeveloperInformation(),ErrorNr := e.ErrorNr(),DetailedInformation := e.DetailedInformation(),
+    //                     GeneralInformation := e.GeneralInformation());                
+    }
+    return JSON::Object().Add( "Status",bStatus)
+                         .Add( "Count",nCount)
+                         .Add( "Msg",strMsg).Build();
+  *]
+}
diff --git a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_OrderReverseOrAuthorize.qbl b/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_OrderReverseOrAuthorize.qbl
index a74b90f..2b201ca 100644
--- a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_OrderReverseOrAuthorize.qbl
+++ b/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_OrderReverseOrAuthorize.qbl
@@ -39,7 +39,7 @@
         nReverseQtyNew :=0;   //璁$畻鍚庣殑鍙嶇鏁伴噺
         nAuthorizeQtyNew :=0; //璁$畻鍚庣殑鎺堟潈鏁伴噺
         nHaveForecastQty :=0; //鏈夐娴嬫暟閲�
-        nNoHaveForecastQty:=0;//浜旈娴嬫暟閲�
+        nNoHaveForecastQty:=0;//鏃犻娴嬫暟閲�
         // 鑾峰彇棰勬祴鏁伴噺锛堝鎴�+SKU+鏈堜唤 鐞嗚鏄病鏈夌墿鏂欓娴嬶級
         OrderForecast := select(Owner, H_OrderForecastRealQty , Obj, Obj.SKU() = SKU 
                                               and Obj.CustomCode() = CustomerCode 
diff --git a/_Main/BL/Type_Scenario/Attribute_ScenarioName.qbl b/_Main/BL/Type_Scenario/Attribute_ScenarioName.qbl
new file mode 100644
index 0000000..d40aac3
--- /dev/null
+++ b/_Main/BL/Type_Scenario/Attribute_ScenarioName.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute ScenarioName
+{
+  #keys: '3[412960.0.288500040][412960.0.288500039][412960.0.288500041]'
+  Description: '鍦烘櫙鍚嶇О锛屽搴斾簨涓氶儴&缁勭粐缂栫爜缁存姢涓淮鎶ょ殑鍦烘櫙鍚嶇О'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_ScenarioManager/StaticMethod_AvailableBusinessTypes.qbl b/_Main/BL/Type_ScenarioManager/StaticMethod_AvailableScenarioNames.qbl
similarity index 84%
rename from _Main/BL/Type_ScenarioManager/StaticMethod_AvailableBusinessTypes.qbl
rename to _Main/BL/Type_ScenarioManager/StaticMethod_AvailableScenarioNames.qbl
index 3c1a81f..4956f3d 100644
--- a/_Main/BL/Type_ScenarioManager/StaticMethod_AvailableBusinessTypes.qbl
+++ b/_Main/BL/Type_ScenarioManager/StaticMethod_AvailableScenarioNames.qbl
@@ -1,6 +1,6 @@
 Quintiq file version 2.0
 #parent: #root
-StaticMethod AvailableBusinessTypes (
+StaticMethod AvailableScenarioNames (
   GlobalOTDTable globalOTDTable
 ) as String
 {
@@ -16,7 +16,7 @@
     //}
     
     // 浣跨敤businessType鑾峰彇鏁版嵁
-    strings := BusinessType::GetBusinessNameStr( globalOTDTable);
+    strings := BusinessType::GetScenarioNamesStr( globalOTDTable);
     
     return strings;
   *]
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Component_PanelGeneral\043549.def" "b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Component_PanelGeneral\043549.def"
index f8a1684..158887f 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Component_PanelGeneral\043549.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Component_PanelGeneral\043549.def"
@@ -46,8 +46,8 @@
       Properties:
       [
         AllowEmpty: true
-        DataBinding: 'DataHolderDialogData.Data.BusinessType'
-        Label: 'BusinessType'
+        DataBinding: 'DataHolderDialogData.Data.ScenarioName'
+        Label: 'Scenario Name'
         Taborder: 4
       ]
     }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Method_OnOk.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Method_OnOk.def
index b8022af..b488de3 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Method_OnOk.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Method_OnOk.def
@@ -32,6 +32,13 @@
       data.Name( versionname );
       }
     
+    // Get Business Type from Scenario Name
+    businesstype := select( globalotdtable, 
+                            BusinessType, 
+                            b, 
+                            b.ScenarioName()=data.ScenarioName() ).BusinessTypeName();
+    data.BusinessType( businesstype );
+    
     // Copy scenario
     if( isnull( data.WrappedInstance() ) )
     {
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogNewPriorityPolicy/Method_Edit.def b/_Main/UI/MacroPlannerWebApp/Component_DialogNewPriorityPolicy/Method_Edit.def
new file mode 100644
index 0000000..1962e28
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogNewPriorityPolicy/Method_Edit.def
@@ -0,0 +1,15 @@
+Quintiq file version 2.0
+#parent: #root
+Method Edit (
+  PriorityPolicy selection
+) id:Method_DialogNewPriorityPolicy_Edit
+{
+  #keys: '[414382.0.603040472]'
+  Body:
+  [*
+    data := shadow( selection );
+    
+    DataHolderNewPriorityPolicy.Data( &data);
+    ApplicationMacroPlanner.ShowFormModal( this );
+  *]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_ListPriorityPolicy_MenuEdit_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_ListPriorityPolicy_MenuEdit_OnClick.def
index b956173..e5eb7a8 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_ListPriorityPolicy_MenuEdit_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_ListPriorityPolicy_MenuEdit_OnClick.def
@@ -12,8 +12,21 @@
   {
     Body:
     [*
-      PanelPriorityPolicyOperation.Visible(true);
+      dlg := construct( DialogNewPriorityPolicy );
+      businessType := PriorityPolicyBusinessType.Text();
+      dlg.Edit( selection);
+      
       PanelPriorityPolicyOperationName.Text(selection.Name());
+      
+      businessType := PriorityPolicyBusinessType.Text();
+      str := PriorityFactor::GetNameList( MacroPlan, businessType);
+      DropDownStringList.Strings(str);
+      
+      LabelFormula.Text(selection.Formula());
+      LabelCalculateValue.Text(selection.CalculateValue());
+      
+      data := shadow( selection );
+      DataHolderEditPriorityPolicy.Data( &data );
     *]
     GroupServerCalls: false
   }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PriorityPolicyBusinessType_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PriorityPolicyBusinessType_OnCreated.def
index e693b84..ff9a42e 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PriorityPolicyBusinessType_OnCreated.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PriorityPolicyBusinessType_OnCreated.def
@@ -9,7 +9,7 @@
   {
     Body:
     [*
-      strings := BusinessType::GetBusinessNameStr( GlobalOTDTable );
+      strings := BusinessType::GetScenarioNamesStr( GlobalOTDTable );
       this.Strings(strings);
       
       list := PriorityPolicy::GetDataByBusinessType( MacroPlan, PriorityPolicyBusinessType.Text());
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenarioAndDoSync_OnClick\043545.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenarioAndDoSync_OnClick\043545.def"
index 560aeb3..8e69dc4 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenarioAndDoSync_OnClick\043545.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenarioAndDoSync_OnClick\043545.def"
@@ -16,7 +16,7 @@
       dlg := construct( DialogCreateEditScenario );
       dlg.checkboxEnableSync().Visible( true );
       dlg.dropDownStringListGeneral().Visible( true );
-      dlg.dropDownStringListGeneral().Strings( ScenarioManager::AvailableBusinessTypes(GlobalOTDTable) );
+      dlg.dropDownStringListGeneral().Strings( ScenarioManager::AvailableScenarioNames( GlobalOTDTable ) );
       dlg.checkboxIsKeyProduct().Visible( true );
       dlg.checkboxCreatePurchaseSupplyProduct().Visible( true );
       dlg.NewScenario( ScenarioManager, selection, true );
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenarioAndDoSync_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenarioAndDoSync_OnClick.def
index ff086e5..4c3b7f0 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenarioAndDoSync_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenarioAndDoSync_OnClick.def
@@ -17,7 +17,7 @@
       dlg := construct( DialogCreateEditScenario );
       dlg.checkboxEnableSync().Visible( true );
       dlg.dropDownStringListGeneral().Visible( true );
-      dlg.dropDownStringListGeneral().Strings( ScenarioManager::AvailableBusinessTypes(GlobalOTDTable) );
+      dlg.dropDownStringListGeneral().Strings( ScenarioManager::AvailableScenarioNames( GlobalOTDTable ) );
       dlg.checkboxIsKeyProduct().Visible( true );
       dlg.checkboxCreatePurchaseSupplyProduct().Visible( true );
       parent := selection.Element( 0 ).Parent();
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenario_OnClick\043549.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenario_OnClick\043549.def"
index 4e81457..607ae7d 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenario_OnClick\043549.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenario_OnClick\043549.def"
@@ -17,7 +17,7 @@
       dlg.checkboxEnableSync().Checked( false );
       dlg.checkboxEnableSync().Visible( false );
       dlg.dropDownStringListGeneral().Visible( false );
-      dlg.dropDownStringListGeneral().Strings( ScenarioManager::AvailableBusinessTypes(GlobalOTDTable) );
+      dlg.dropDownStringListGeneral().Strings( ScenarioManager::AvailableScenarioNames( GlobalOTDTable ) );
       dlg.checkboxIsKeyProduct().Visible( false );
       dlg.checkboxCreatePurchaseSupplyProduct().Visible( false );
       dlg.NewScenario( ScenarioManager, selection );
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenario_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenario_OnClick.def
index 52b82cf..55945ed 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenario_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenario_OnClick.def
@@ -18,7 +18,7 @@
       dlg.checkboxEnableSync().Checked( false );
       dlg.checkboxEnableSync().Visible( false );
       dlg.dropDownStringListGeneral().Visible( false );
-      dlg.dropDownStringListGeneral().Strings( ScenarioManager::AvailableBusinessTypes(GlobalOTDTable) );
+      dlg.dropDownStringListGeneral().Strings( ScenarioManager::AvailableScenarioNames( GlobalOTDTable ) );
       dlg.checkboxIsKeyProduct().Visible( false );
       dlg.checkboxCreatePurchaseSupplyProduct().Visible( false );
       parent := selection.Element( 0 ).Parent();
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuEdit_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuEdit_OnClick.def
index 8fbf279..9c2d77f 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuEdit_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuEdit_OnClick.def
@@ -18,7 +18,7 @@
       // Edit scenario
       dlg := construct( DialogCreateEditScenario );
       dlg.dropDownStringListGeneral().Visible( selection.EnableSync() );
-      dlg.dropDownStringListGeneral().Strings( ScenarioManager::AvailableBusinessTypes(GlobalOTDTable) );
+      dlg.dropDownStringListGeneral().Strings( ScenarioManager::AvailableScenarioNames( GlobalOTDTable ) );
       dlg.checkboxIsKeyProduct().Visible( selection.EnableSync() );
       dlg.checkboxCreatePurchaseSupplyProduct().Visible( selection.EnableSync() );
       
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmAuthorizeAndCountersign_Order/Response_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FrmAuthorizeAndCountersign_Order/Response_OnCreated.def
index 7c4d5f5..76d2c45 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmAuthorizeAndCountersign_Order/Response_OnCreated.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FrmAuthorizeAndCountersign_Order/Response_OnCreated.def
@@ -23,18 +23,10 @@
           lb_SKUCode_FAAC.Text(SelForecast.Get( "SKU").GetString());
           lb_SKUName_FAAC.Text("浜у搧");
           lb_Util_FAAC.Text(SelForecast.Get( "Util").GetString());
+          lb_SKUName_FAAC.Text(SelForecast.Get( "SKUName").GetString());
           txt_CustomID_FAAC.Text(SelForecast.Get( "CustomCode").GetString());
           txt_CustomName_FAAC.Text(SelForecast.Get( "CustomName").GetString());
           lb_Operator_FAAC.Text(ApplicationMacroPlanner.GetUserName());
-          
-      //    StrValue := SelectItem.Value().Tokenize( ";");
-      //    lb_SKUCode_FAAC.Text(StrValue.Element( 0));
-      //    lb_SKUName_FAAC.Text("浜у搧");
-      //    lb_Operator_FAAC.Text("");
-      //    lb_Util_FAAC.Text(StrValue.Element( 1));
-      //    txt_CustomID_FAAC.Text(StrValue.Element( 2));
-      //    txt_CustomName_FAAC.Text(StrValue.Element( 3));
-      //    lb_Operator_FAAC.Text(ApplicationMacroPlanner.GetUserName());
         }
       }
     *]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmErrorLogs/Component_List710.def b/_Main/UI/MacroPlannerWebApp/Component_FrmErrorLogs/Component_List710.def
index 975cea9..bd6d61d 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmErrorLogs/Component_List710.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FrmErrorLogs/Component_List710.def
@@ -36,6 +36,6 @@
   ]
   Properties:
   [
-    Taborder: 1
+    Taborder: 2
   ]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmErrorLogs/Component_Panel391.def b/_Main/UI/MacroPlannerWebApp/Component_FrmErrorLogs/Component_Panel391.def
new file mode 100644
index 0000000..c27e0ed
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FrmErrorLogs/Component_Panel391.def
@@ -0,0 +1,24 @@
+Quintiq file version 2.0
+Component Panel391
+{
+  #keys: '[414724.0.193860534]'
+  BaseType: 'WebPanel'
+  Children:
+  [
+    Component Button655
+    {
+      #keys: '[414724.0.193860558]'
+      BaseType: 'WebButton'
+      Properties:
+      [
+        Image: 'BULL'
+        Label: '濉骇鍐插噺'
+        Taborder: 0
+      ]
+    }
+  ]
+  Properties:
+  [
+    Taborder: 0
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmErrorLogs/Response_Panel391_Button655_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FrmErrorLogs/Response_Panel391_Button655_OnClick.def
new file mode 100644
index 0000000..821d8ed
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FrmErrorLogs/Response_Panel391_Button655_OnClick.def
@@ -0,0 +1,39 @@
+Quintiq file version 2.0
+#parent: Panel391/Button655
+Response OnClick () id:Response_Panel391_Button655_OnClick
+{
+  #keys: '[414724.0.194975663]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebButton_OnClick'
+  Precondition:
+  [*
+    return not isnull( MacroPlan);
+  *]
+  QuillAction
+  {
+    Body:
+    [*
+      HResult := H_FunctionClass::SM_OrderHedgingEx( MacroPlan,"娴嬭瘯鐢ㄦ埛" );
+      Msg := HResult.Get( "Msg").GetString();
+      if( HResult.Get( "Status").GetBoolean())
+      {
+        if( Msg.Length()>0)
+        {
+          WebMessageBox::Information(Msg); 
+        }
+      }
+      else
+      {
+        if( Msg.Length()>0)
+        {
+          WebMessageBox::Warning(Msg);
+        }
+        else
+        {
+          WebMessageBox::Information("杩愯閿欒锛�"); 
+        }
+      }
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmErrorLogs/_ROOT_Component_FrmErrorLogs.def b/_Main/UI/MacroPlannerWebApp/Component_FrmErrorLogs/_ROOT_Component_FrmErrorLogs.def
index 23776ce..81eec9c 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmErrorLogs/_ROOT_Component_FrmErrorLogs.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FrmErrorLogs/_ROOT_Component_FrmErrorLogs.def
@@ -30,9 +30,10 @@
       ]
       Properties:
       [
-        Taborder: 0
+        Taborder: 1
       ]
     }
+    #child: Panel391
   ]
   Properties:
   [

--
Gitblit v1.9.3