From 81070dc6e62e23f1619a5341c5dbf790ed6635ea Mon Sep 17 00:00:00 2001
From: limj <limj@taizhitech.com>
Date: 星期三, 27 九月 2023 01:38:07 +0800
Subject: [PATCH] 优先级因子计算

---
 _Main/BL/Type_PriorityResult/StaticMethod_calculatePriorityResult.qbl                                                                 |   11 +-
 _Main/BL/Type_BusinessType/StaticMethod_CreateData.qbl                                                                                |    3 
 _Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Component_listContextMenuSD.def                                              |   17 +++
 _Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Component_pnlActions.def                                             |   40 ++++++++
 _Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/_ROOT_Component_DialogChoosePriorityPolicy.def                       |   22 ++++
 _Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Response_pnlActions_btnOk_OnClick.def                                |   16 +++
 _Main/BL/Type_PriorityResult/StaticMethod_CalculateBracketScore.qbl                                                                   |    5 
 _Main/BL/Type_PriorityResult/StaticMethod_CalculateScore.qbl                                                                          |   25 ++--
 _Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Component_pnlContent.def                                             |   33 ++++++
 _Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Response_pnlContent_DataHolderChoosePriorityPolicy_OnCreated.def     |   18 +++
 _Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Response_TIANMA_JITUAN_ListSalesDemands_MenuPriorityResult_OnClick.def       |   19 +++
 _Main/BL/Type_PriorityResult/StaticMethod_GetDetailsValue.qbl                                                                         |   16 ++-
 _Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Response_pnlContent_DataHolderChoosePriorityPolicy_OnDataChanged.def |   18 +++
 _Main/UI/MacroPlannerWebApp/Component_DialogBusinessType/Method_ClickBtnOk.def                                                        |    3 
 _Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Method_OpenChoose.def                                                |   10 ++
 _Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Component_ListSalesDemands.def                                               |    4 
 _Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Response_pnlActions_btnCancel_OnClick.def                            |   15 +++
 17 files changed, 246 insertions(+), 29 deletions(-)

diff --git a/_Main/BL/Type_BusinessType/StaticMethod_CreateData.qbl b/_Main/BL/Type_BusinessType/StaticMethod_CreateData.qbl
index afab52f..f82bfcb 100644
--- a/_Main/BL/Type_BusinessType/StaticMethod_CreateData.qbl
+++ b/_Main/BL/Type_BusinessType/StaticMethod_CreateData.qbl
@@ -21,9 +21,6 @@
     // 濡傛灉涓嶅瓨鍦ㄥ垯娣诲姞
     if( not checkExist ){
       owner.BusinessType(relnew,BusinessTypeName := businessName);
-      
-      // 鍒濆鍖栦紭鍏堢骇鍥犲瓙鏁版嵁
-      PriorityFactor::InitData( macroPlan,businessName);
     }
   *]
 }
diff --git a/_Main/BL/Type_PriorityResult/StaticMethod_CalculateBracketScore.qbl b/_Main/BL/Type_PriorityResult/StaticMethod_CalculateBracketScore.qbl
index 90f1891..962e51e 100644
--- a/_Main/BL/Type_PriorityResult/StaticMethod_CalculateBracketScore.qbl
+++ b/_Main/BL/Type_PriorityResult/StaticMethod_CalculateBracketScore.qbl
@@ -4,7 +4,8 @@
   String calcStr,
   CustomerOrder customerOrder,
   String businessType,
-  MacroPlan macroPlan
+  MacroPlan macroPlan,
+  GlobalOTDTable globalOTDTable
 ) as Real
 {
   Description: '璁$畻鍏紡涓嫭鍙峰唴鐨勬暟鎹�'
@@ -13,6 +14,6 @@
     // NBoTk Sep-26-2023 (created)
     
     
-    return PriorityResult::CalculateScore( calcStr,customerOrder,businessType,macroPlan,0.0);
+    return PriorityResult::CalculateScore( calcStr,customerOrder,businessType,macroPlan,0.0,globalOTDTable);
   *]
 }
diff --git a/_Main/BL/Type_PriorityResult/StaticMethod_CalculateScore.qbl b/_Main/BL/Type_PriorityResult/StaticMethod_CalculateScore.qbl
index 22b6924..decca69 100644
--- a/_Main/BL/Type_PriorityResult/StaticMethod_CalculateScore.qbl
+++ b/_Main/BL/Type_PriorityResult/StaticMethod_CalculateScore.qbl
@@ -5,7 +5,8 @@
   CustomerOrder customerOrder,
   String businessType,
   MacroPlan macroPlan,
-  Real lastScore
+  Real lastScore,
+  GlobalOTDTable globalOTDTable
 ) as Real
 {
   TextBody:
@@ -23,42 +24,42 @@
             if(remindFormula.StartsWith( "+" ))
             {
                 remindFormula := remindFormula.SubString( 1,remindFormula.Length());
-                score := PriorityResult::GetDetailsValue( customerOrder,remindFormula,macroPlan);
+                score := PriorityResult::GetDetailsValue( customerOrder,remindFormula,macroPlan,globalOTDTable); 
                 score := lastScore + score;
                 
                 // 鎴彇鎺夊凡缁忚绠楃殑浼樺厛绾у洜瀛� 閫掑綊璁$畻
                 remindFormula := PriorityResult::GetRemindFormula( remindFormula,macroPlan);
-                PriorityResult::CalculateScore( remindFormula,customerOrder,businessType,macroPlan,score);
+                PriorityResult::CalculateScore( remindFormula,customerOrder,businessType,macroPlan,score,globalOTDTable);
             }
             else if( remindFormula.StartsWith( "-" ))
             {
                 remindFormula := remindFormula.SubString( 1,remindFormula.Length());
-                score := PriorityResult::GetDetailsValue( customerOrder,remindFormula,macroPlan);
+                score := PriorityResult::GetDetailsValue( customerOrder,remindFormula,macroPlan,globalOTDTable);
                 score := lastScore - score;
                 
                 // 鎴彇鎺夊凡缁忚绠楃殑浼樺厛绾у洜瀛� 閫掑綊璁$畻
                 remindFormula := PriorityResult::GetRemindFormula( remindFormula,macroPlan);
-                PriorityResult::CalculateScore( remindFormula,customerOrder,businessType,macroPlan,score);
+                PriorityResult::CalculateScore( remindFormula,customerOrder,businessType,macroPlan,score,globalOTDTable);
             }
             else if( remindFormula.StartsWith( "*" ) )
             {
                 remindFormula := remindFormula.SubString( 1,remindFormula.Length());
-                score := PriorityResult::GetDetailsValue( customerOrder,remindFormula,macroPlan);
+                score := PriorityResult::GetDetailsValue( customerOrder,remindFormula,macroPlan,globalOTDTable);
                 score := lastScore * score;
                 
                 // 鎴彇鎺夊凡缁忚绠楃殑浼樺厛绾у洜瀛� 閫掑綊璁$畻
                 remindFormula := PriorityResult::GetRemindFormula( remindFormula,macroPlan);
-                PriorityResult::CalculateScore( remindFormula,customerOrder,businessType,macroPlan,score);
+                PriorityResult::CalculateScore( remindFormula,customerOrder,businessType,macroPlan,score,globalOTDTable);
             }
             else if( remindFormula.StartsWith( "/" ) )
             {
                 remindFormula := remindFormula.SubString( 1,remindFormula.Length());
-                score := PriorityResult::GetDetailsValue( customerOrder,remindFormula,macroPlan);
+                score := PriorityResult::GetDetailsValue( customerOrder,remindFormula,macroPlan,globalOTDTable);
                 score := lastScore / score;
                 
                 // 鎴彇鎺夊凡缁忚绠楃殑浼樺厛绾у洜瀛� 閫掑綊璁$畻
                 remindFormula := PriorityResult::GetRemindFormula( remindFormula,macroPlan);
-                PriorityResult::CalculateScore( remindFormula,customerOrder,businessType,macroPlan,score);
+                PriorityResult::CalculateScore( remindFormula,customerOrder,businessType,macroPlan,score,globalOTDTable);
             }
             else if( remindFormula.StartsWith( "(" ) )
             {
@@ -66,7 +67,7 @@
                 // 璁$畻鎷彿涓殑鍐呭
                 rightBracket := remindFormula.FindString( ")",0);
                 calcStr := remindFormula.SubString( 1,rightBracket);
-                PriorityResult::CalculateBracketScore(calcStr,customerOrder,businessType,macroPlan);
+                PriorityResult::CalculateBracketScore(calcStr,customerOrder,businessType,macroPlan,globalOTDTable);
                 
                 // 鎴彇 ) 鍚庣殑瀛楃缁х画杩涜璁$畻
                 remindFormula := remindFormula.SubString( rightBracket,remindFormula.Length());
@@ -74,11 +75,11 @@
             else
             {
                 // 涓嶆槸绗﹀彿 鐩存帴鑾峰彇璁$畻鍚庣殑鏁板��
-                score := PriorityResult::GetDetailsValue( customerOrder,remindFormula,macroPlan);
+                score := PriorityResult::GetDetailsValue( customerOrder,remindFormula,macroPlan,globalOTDTable);
               
                 // 鎴彇鎺夊凡缁忚绠楃殑浼樺厛绾у洜瀛� 閫掑綊璁$畻
                 remindFormula := PriorityResult::GetRemindFormula( remindFormula,macroPlan);
-                PriorityResult::CalculateScore( remindFormula,customerOrder,businessType,macroPlan,score);
+                PriorityResult::CalculateScore( remindFormula,customerOrder,businessType,macroPlan,score,globalOTDTable);
             }
     }
     
diff --git a/_Main/BL/Type_PriorityResult/StaticMethod_GetDetailsValue.qbl b/_Main/BL/Type_PriorityResult/StaticMethod_GetDetailsValue.qbl
index ba8486e..f12f852 100644
--- a/_Main/BL/Type_PriorityResult/StaticMethod_GetDetailsValue.qbl
+++ b/_Main/BL/Type_PriorityResult/StaticMethod_GetDetailsValue.qbl
@@ -3,7 +3,8 @@
 StaticMethod GetDetailsValue (
   CustomerOrder customerOrder,
   String formula,
-  MacroPlan macroPlan
+  MacroPlan macroPlan,
+  GlobalOTDTable globalOTDTable
 ) as Real
 {
   TextBody:
@@ -36,14 +37,16 @@
     
     if( "DOI" =  priorityFactor.Name())
     {
-         // DOI鏁版嵁鏆傛椂缂哄皯
-         value := 1;
+         // DOI鏁版嵁
+         obj := selectobject( globalOTDTable,Global_MappingDOI_DSI,doi,doi.ProductID() = customerOrder.ProductID())
+         value := priorityFactor.Coefficient() * [Real]obj.DOI();
     }
     
     if( "DSI" =  priorityFactor.Name())
     {
-         // DOI鏁版嵁鏆傛椂缂哄皯
-         value := 1;
+         // DOI鏁版嵁
+         obj := selectobject( globalOTDTable,Global_MappingDOI_DSI,doi,doi.ProductID() = customerOrder.ProductID())
+         value := priorityFactor.Coefficient() * [Real]obj.DSI();
     }
     
     if( "缁嗗垎甯傚満绛夌骇" =  priorityFactor.Name())
@@ -62,7 +65,8 @@
     if( "瀹㈡埛绛夌骇" =  priorityFactor.Name())
     {
          // 閫氳繃鏁版嵁婀栬绠楀鎴风瓑绾�
-         value := 1;
+          obj := selectobject( globalOTDTable,Global_MappingCustomerGrade,doi,doi.BusinessType() = customerOrder.BusinessType() and doi.Customer() = customerOrder.CustomerName())
+         value := priorityFactor.Coefficient() * [Real]obj.CustomerGrade();
     }
     
     if( "璁㈠崟涓嬪崟鏃堕棿" =  priorityFactor.Name())
diff --git a/_Main/BL/Type_PriorityResult/StaticMethod_calculatePriorityResult.qbl b/_Main/BL/Type_PriorityResult/StaticMethod_calculatePriorityResult.qbl
index 4021601..1b2da12 100644
--- a/_Main/BL/Type_PriorityResult/StaticMethod_calculatePriorityResult.qbl
+++ b/_Main/BL/Type_PriorityResult/StaticMethod_calculatePriorityResult.qbl
@@ -1,10 +1,9 @@
 Quintiq file version 2.0
 #parent: #root
 StaticMethod CalculatePriorityResult (
-  CustomerOrders customerOrders,
   String priorityPolicyName,
-  String businessType,
-  MacroPlan macroPlan
+  MacroPlan macroPlan,
+  GlobalOTDTable globalOTDTable
 )
 {
   TextBody:
@@ -13,7 +12,7 @@
     
     // 璁$畻瀹㈡埛璁㈠崟鐨勪紭鍏堢骇寰楀垎 鍥炲~鏉冮噸鏁版嵁 鐢熸垚鏂扮殑Priority鏄庣粏鏁版嵁
     
-    traverse( customerOrders,Elements,e)
+    traverse( macroPlan,SalesDemand.astype( CustomerOrder ),e)
     {
          // 浜嬩笟閮ㄤ俊鎭�
          businessType := e.BusinessType();
@@ -23,7 +22,7 @@
          formula := priorityPolicys.Formula();
          
          // 閫掑綊澶勭悊璁$畻鍏紡 鑾峰彇褰撳墠璁㈠崟鐨勫緱鍒�
-         value := PriorityResult::CalculateScore( formula,e,businessType,macroPlan,0.0);
+         value := PriorityResult::CalculateScore( formula,e,businessType,macroPlan,0.0,globalOTDTable);
          
          // 鐢熸垚浼樺厛绾у洜瀛愯窇鍒嗙粨鏋�
          priorityResult := macroPlan.PriorityResult(relnew,CustomerOrderID := e.ID(),BusinessType := businessType,Customer := e.CustomerName(),CustomerID := e.CustomerID(),
@@ -59,7 +58,7 @@
     priorityValue := 1;
     traverse( resultList,Elements,e)
     {
-        obj := selectobject( customerOrders,Elements,order,
+        obj := selectobject( macroPlan,SalesDemand.astype( CustomerOrder ),order, 
                              order.ID() = e.CustomerOrderID()
                              );
         obj.PriorityName([String]priorityValue);
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogBusinessType/Method_ClickBtnOk.def b/_Main/UI/MacroPlannerWebApp/Component_DialogBusinessType/Method_ClickBtnOk.def
index 4172fa3..fbfa4cc 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogBusinessType/Method_ClickBtnOk.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogBusinessType/Method_ClickBtnOk.def
@@ -15,6 +15,9 @@
     businessType := DataHolderBusinessType.Data().BusinessTypeName();
     DataHolderBusinessType.Data().Commit();
     
+     
+    PriorityFactor::InitData( MacroPlan,businessType);
+    
     this.Close();
   *]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Component_pnlActions.def b/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Component_pnlActions.def
new file mode 100644
index 0000000..d27cc39
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Component_pnlActions.def
@@ -0,0 +1,40 @@
+Quintiq file version 2.0
+Component pnlActions
+{
+  #keys: '[414382.0.563131222]'
+  BaseType: 'WebPanel'
+  Children:
+  [
+    Component btnOk
+    {
+      #keys: '[414382.0.563131226]'
+      BaseType: 'WebButton'
+      Properties:
+      [
+        Label: 'OK'
+        Taborder: 0
+      ]
+    }
+    Component btnCancel
+    {
+      #keys: '[414382.0.563131228]'
+      BaseType: 'WebButton'
+      Properties:
+      [
+        Label: 'Cancel'
+        Taborder: 1
+      ]
+    }
+  ]
+  Properties:
+  [
+    Alignment: 'trailing'
+    Border: true
+    ExcludeFromActiveComponent: true
+    FixedSize: true
+    Orientation: 'horizontal'
+    Padding: 'true'
+    Style: 'footer'
+    Taborder: 1
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Component_pnlContent.def b/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Component_pnlContent.def
new file mode 100644
index 0000000..38aee9e
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Component_pnlContent.def
@@ -0,0 +1,33 @@
+Quintiq file version 2.0
+Component pnlContent
+{
+  #keys: '[414382.0.563131220]'
+  BaseType: 'WebPanel'
+  Children:
+  [
+    Component PriorityPolicyStringList
+    {
+      #keys: '[414382.0.563131262]'
+      BaseType: 'WebDropDownStringList'
+      Properties:
+      [
+        Taborder: 0
+      ]
+    }
+    Component DataHolderChoosePriorityPolicy
+    {
+      #keys: '[414382.0.563131279]'
+      BaseType: 'WebDataHolder'
+      Databinding: 'structured[PriorityPolicy]*'
+      Properties:
+      [
+        Taborder: 1
+      ]
+    }
+  ]
+  Properties:
+  [
+    Padding: 'true'
+    Taborder: 0
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Method_OpenChoose.def b/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Method_OpenChoose.def
new file mode 100644
index 0000000..bae85c8
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Method_OpenChoose.def
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+#parent: #root
+Method OpenChoose () id:Method_DialogChoosePriorityPolicy_OpenChoose
+{
+  #keys: '[414382.0.563950563]'
+  Body:
+  [*
+    ApplicationMacroPlanner.ShowFormModal( this );
+  *]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Response_pnlActions_btnCancel_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Response_pnlActions_btnCancel_OnClick.def
new file mode 100644
index 0000000..1d6fe8b
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Response_pnlActions_btnCancel_OnClick.def
@@ -0,0 +1,15 @@
+Quintiq file version 2.0
+#parent: pnlActions/btnCancel
+Response OnClick () id:Response_pnlActions_btnCancel_OnClick
+{
+  #keys: '[414382.0.563131232]'
+  DefinitionID: 'Responsedef_WebButton_OnClick'
+  GroupServerCalls: true
+  QuillAction
+  {
+    Body:
+    [*
+      Form.Close();
+    *]
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Response_pnlActions_btnOk_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Response_pnlActions_btnOk_OnClick.def
new file mode 100644
index 0000000..7750e77
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Response_pnlActions_btnOk_OnClick.def
@@ -0,0 +1,16 @@
+Quintiq file version 2.0
+#parent: pnlActions/btnOk
+Response OnClick () id:Response_pnlActions_btnOk_OnClick
+{
+  #keys: '[414382.0.563131231]'
+  DefinitionID: 'Responsedef_WebButton_OnClick'
+  QuillAction
+  {
+    Body:
+    [*
+      name := PriorityPolicyStringList.Text();
+      PriorityResult::CalculatePriorityResult(name,MacroPlan,GlobalOTDTable);
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Response_pnlContent_DataHolderChoosePriorityPolicy_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Response_pnlContent_DataHolderChoosePriorityPolicy_OnCreated.def
new file mode 100644
index 0000000..dd31dea
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Response_pnlContent_DataHolderChoosePriorityPolicy_OnCreated.def
@@ -0,0 +1,18 @@
+Quintiq file version 2.0
+#parent: pnlContent/DataHolderChoosePriorityPolicy
+Response OnCreated () id:Response_pnlContent_DataHolderChoosePriorityPolicy_OnCreated
+{
+  #keys: '[414382.0.563131469]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebComponent_OnCreated'
+  QuillAction
+  {
+    Body:
+    [*
+      dataList := selectuniquevalues(  MacroPlan,PriorityPolicy,p,p.Name());
+      strings := dataList.Concatenate( ";");
+      PriorityPolicyStringList.Strings(strings);
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Response_pnlContent_DataHolderChoosePriorityPolicy_OnDataChanged.def b/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Response_pnlContent_DataHolderChoosePriorityPolicy_OnDataChanged.def
new file mode 100644
index 0000000..956d116
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Response_pnlContent_DataHolderChoosePriorityPolicy_OnDataChanged.def
@@ -0,0 +1,18 @@
+Quintiq file version 2.0
+#parent: pnlContent/DataHolderChoosePriorityPolicy
+Response OnDataChanged () id:Response_pnlContent_DataHolderChoosePriorityPolicy_OnDataChanged
+{
+  #keys: '[414382.0.563131545]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebComponent_OnDataChanged'
+  QuillAction
+  {
+    Body:
+    [*
+      dataList := selectuniquevalues(  MacroPlan,PriorityPolicy,p,p.Name());
+      strings := dataList.Concatenate( ";");
+      PriorityPolicyStringList.Strings(strings);
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/_ROOT_Component_DialogChoosePriorityPolicy.def b/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/_ROOT_Component_DialogChoosePriorityPolicy.def
new file mode 100644
index 0000000..11665d9
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/_ROOT_Component_DialogChoosePriorityPolicy.def
@@ -0,0 +1,22 @@
+Quintiq file version 2.0
+#root
+#parent: MacroPlannerWebApp
+OrphanComponent DialogChoosePriorityPolicy
+{
+  #keys: '[414382.0.563131218]'
+  BaseType: 'WebForm'
+  Children:
+  [
+    #child: pnlContent
+    #child: pnlActions
+  ]
+  Properties:
+  [
+    Alignment: 'trailing'
+    EnterButton: 'btnOk'
+    EscapeButton: 'btnCancel'
+    ExcludeFromActiveComponent: true
+    Padding: 'false'
+    Title: '閫夋嫨浼樺厛绾х瓥鐣�'
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Component_ListSalesDemands.def b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Component_ListSalesDemands.def
index 352a599..54be6e2 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Component_ListSalesDemands.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Component_ListSalesDemands.def
@@ -5,6 +5,10 @@
   [
     Component DataSetLevelSalesDemands #extension
     {
+      Children:
+      [
+        #child: listContextMenuSD
+      ]
       Properties:
       [
         Columns: '[{"attribute":{"classtype":"WebApiDefinitionAttributeAllConstraint","columnid":"All constraints","title":"All constraints","subtotals":"","tooltip":"","width":1,"display":"shown"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"StockingPoint_MP.ID","title":"Stocking point","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"StockingPoint_MP.ID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"SalesSegment_MP.Name","title":"Sales segment","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"SalesSegment_MP.Name"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"CustomerName","title":"Customer name","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"CustomerName"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"CustomerID","title":"Customer ID","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"CustomerID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"OrderID","title":"Order ID","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"OrderID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"OrderLineID","title":"Order line ID","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"OrderLineID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"StartDate","title":"Order date","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"StartDate"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Product_MP.ID","title":"Product","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"Product_MP.ID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"UnitOfMeasure_MP.Name","title":"UoM","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"UnitOfMeasure_MP.Name"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Quantity","title":"Quantity","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Quantity"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"FulfilledQuantity","title":"Fulfilled","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"FulfilledQuantity"}},{"attribute":{"classtype":"WebApiDefinitionAttributeChart","columnid":"Fulfillment","title":"Fulfillment","subtotals":"","tooltip":"","width":-1,"display":"shown","type":"stackbar","relative":true,"attributes":[{"name":"Unfulfilled demand","color":"rgb(232,123,0)","expression":{"classtype":"WebApiDefinitionAttributeExpression","columnid":"Unfulfilled demand","title":"Unfulfilled demand","subtotals":"","tooltip":"","width":-1,"display":"shown","expressionbody":"maxvalue( object.Quantity() - object.FulfilledQuantity(), 0.0).Round( 2)"}},{"name":"Fulfilled demand","color":"rgb(87,184,71)","expression":{"classtype":"WebApiDefinitionAttributeExpression","columnid":"Fulfilled demand","title":"Fulfilled demand","subtotals":"","tooltip":"","width":-1,"display":"shown","expressionbody":"object.FulfilledQuantity().Round( 2)"}}]}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"IsFirmed","title":"Is firmed","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"IsFirmed"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"IsEligibleForNetting","title":"Is eligible for netting","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"IsEligibleForNetting"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Price","title":"Price","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Price"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"PriceUoM","title":"PriceUoM","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"PriceUoM"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"OrderTag","title":"璁㈠崟鏍囩","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"OrderTag"}}]'
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Component_listContextMenuSD.def b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Component_listContextMenuSD.def
new file mode 100644
index 0000000..d9aacef
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Component_listContextMenuSD.def
@@ -0,0 +1,17 @@
+Quintiq file version 2.0
+Component listContextMenuSD #extension
+{
+  Children:
+  [
+    Component MenuPriorityResult
+    {
+      #keys: '[414382.0.562012014]'
+      BaseType: 'WebMenu'
+      Properties:
+      [
+        Taborder: 10
+        Title: '浜嬩笟閮ㄤ紭鍏堢骇璁$畻'
+      ]
+    }
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Response_TIANMA_JITUAN_ListSalesDemands_MenuPriorityResult_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Response_TIANMA_JITUAN_ListSalesDemands_MenuPriorityResult_OnClick.def
new file mode 100644
index 0000000..c4f3379
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Response_TIANMA_JITUAN_ListSalesDemands_MenuPriorityResult_OnClick.def
@@ -0,0 +1,19 @@
+Quintiq file version 2.0
+#parent: ListSalesDemands
+Response OnClick () id:Response_ListSalesDemands_MenuPriorityResult_OnClick
+{
+  #keys: '[414382.0.563130924]'
+  CanBindMultiple: false
+  DefinitionID => //FormSalesDemands/ListSalesDemands/Responsedef_ListSalesDemands_WebMenu_OnClick
+  Initiator: 'MenuPriorityResult'
+  QuillAction
+  {
+    Body:
+    [*
+      
+      dlg := construct( DialogChoosePriorityPolicy );
+      dlg.OpenChoose();
+    *]
+    GroupServerCalls: false
+  }
+}

--
Gitblit v1.9.3