From a3d30e9bbb7f6210cb5ce47b372814c5a0d87dc8 Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期三, 08 十一月 2023 13:50:06 +0800
Subject: [PATCH] 添加优先级计算的结果赋值到PriorityName
---
_Main/BL/Type_PriorityResult/StaticMethod_calculatePriorityResult.qbl | 124 +++++++++++++++-------------------------
_Main/BL/Relations/Relation_PriorityResult_CustomerOrder_CustomerOrder_PriorityResult.qbl | 23 +++++++
2 files changed, 70 insertions(+), 77 deletions(-)
diff --git a/_Main/BL/Relations/Relation_PriorityResult_CustomerOrder_CustomerOrder_PriorityResult.qbl b/_Main/BL/Relations/Relation_PriorityResult_CustomerOrder_CustomerOrder_PriorityResult.qbl
new file mode 100644
index 0000000..35f6d74
--- /dev/null
+++ b/_Main/BL/Relations/Relation_PriorityResult_CustomerOrder_CustomerOrder_PriorityResult.qbl
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#parent: #root
+Relation PriorityResult_CustomerOrder_CustomerOrder_PriorityResult
+{
+ #keys: '1[414996.0.57846264]'
+ DefaultRelationStrategy
+ {
+ }
+ RelationSide.LeftSide CustomerOrder
+ {
+ #keys: '3[414996.0.57846266][414996.0.57846265][414996.0.57846267]'
+ Cardinality: '0to1'
+ ObjectDefinition: PriorityResult
+ OwningSide: 'Reference'
+ }
+ RelationSide.RightSide PriorityResult
+ {
+ #keys: '3[414996.0.57846269][414996.0.57846268][414996.0.57846270]'
+ Cardinality: '0to1'
+ ObjectDefinition: CustomerOrder
+ OwningSide: 'Reference'
+ }
+}
diff --git a/_Main/BL/Type_PriorityResult/StaticMethod_calculatePriorityResult.qbl b/_Main/BL/Type_PriorityResult/StaticMethod_calculatePriorityResult.qbl
index c8cc95d..bfd7213 100644
--- a/_Main/BL/Type_PriorityResult/StaticMethod_calculatePriorityResult.qbl
+++ b/_Main/BL/Type_PriorityResult/StaticMethod_calculatePriorityResult.qbl
@@ -12,15 +12,13 @@
// NBoTk Sep-26-2023 (created)
// 鍏堝垹闄ゅ巻鍙茬殑璺戝垎璇︽儏
- traverse( macroPlan,PriorityResult,p)
- {
+ traverse( macroPlan,PriorityResult,p){
p.PriorityResultBusinessTypeDetail(relflush );
p.Delete();
}
// 璁$畻瀹㈡埛璁㈠崟鐨勪紭鍏堢骇寰楀垎 鍥炲~鏉冮噸鏁版嵁 鐢熸垚鏂扮殑Priority鏄庣粏鏁版嵁
- traverse( macroPlan,SalesDemand.astype( CustomerOrder ),e)
- {
+ traverse( macroPlan,SalesDemand.astype( CustomerOrder ),e){
// 浜嬩笟閮ㄤ俊鎭�
businessType := e.BusinessType();
@@ -34,100 +32,72 @@
priorityResult := macroPlan.PriorityResult(relnew,CustomerOrderID := e.ID(),BusinessType := businessType,Customer := e.CustomerName(),CustomerID := e.CustomerID(),
DemandDate := e.EndDate(),ProductID := e.ProductID(),Quantity := e.Quantity(),SalesSegmentName := e.SalesSegmentName(),
StockingPointID := e.StockingPointID(),UnitOfMeasureName := e.UnitOfMeasureName()
- );
-
+ );
+ priorityResult.CustomerOrder(relset, e);
// 鍒ゆ柇鏄泦鍥� 杩樻槸浜嬩笟閮�
- if( businessType.FindString( "闆嗗洟",0 ) <> -1)
- {
+ if( businessType.FindString( "闆嗗洟",0 ) <> -1){
priorityResult.PriorityResultGroupDetail( relnew,BusinessType := businessType,Customer := e.CustomerName(),CustomerID := e.CustomerID(),
DemandDate := e.EndDate(),PriorityPolicyName := priorityPolicyName,PriorityResultScore := value,
Quantity := e.Quantity(),SalesSegmentName := e.SalesSegmentName(),StockingPointID := e.StockingPointID(),
UnitOfMeasureName := e.UnitOfMeasureName(),PriorityTotalScore := value
);
- }
- else
- {
+ }else{
priorityResult.PriorityResultBusinessTypeDetail( relnew,BusinessType := businessType,Customer := e.CustomerName(),CustomerID := e.CustomerID(),
DemandDate := e.EndDate(),PriorityPolicyName := priorityPolicyName,PriorityResultScore := value,
Quantity := e.Quantity(),SalesSegmentName := e.SalesSegmentName(),StockingPointID := e.StockingPointID(),
UnitOfMeasureName := e.UnitOfMeasureName(),PriorityTotalScore := value
);
- }
+ }
}
// 浼樺厛绾у洜瀛愬鐞嗗畬鎴愬悗 鎺掑簭鍥炲~鏁版嵁
+
+ traverse( macroPlan,PriorityResult,e){
+ businessTypeScore := max( e,PriorityResultBusinessTypeDetail,p,
+ p.PriorityTotalScore()
+ );
+
+ groupScore := max( e,PriorityResultGroupDetail,p,
+ p.PriorityTotalScore()
+ );
+ value := maxvalue( businessTypeScore,groupScore);
+ e.PriorityResultScore( value );
+ }
+
resultList := selectsortedset( macroPlan,PriorityResult,result,
true,
- result.PriorityResultScore()
+ -result.PriorityResultScore()
)
- // Quintiq浼樺厛绾у垎10绾� 闇�瑕佸垎娈佃绠� 鍚戜笂鍙栨暣
- subLevel := round( resultList.Size() div 10);
- subLevelCount := 0;
+ // Quintiq浼樺厛绾у垎10绾� 闇�瑕佸垎娈佃绠� 鍚戜笅鍙栨暣
+ if( resultList.Size() >= 10){
+ subListSize := resultList.Size() div 10;
+ overListSize := resultList.Size() mod 10;
- priorityValue := 1;
- if( resultList.Size() <= 10 )
- {
- traverse( resultList,Elements,e)
- {
- obj := selectobject( macroPlan,SalesDemand.astype( CustomerOrder ),order,
- order.ID() = e.CustomerOrderID()
- );
-
- // 璁㈠崟鏁版嵁涓嶄负绌哄啀鍋氬鐞�
- if( not isnull( obj ) )
- {
- obj.PriorityName([String]priorityValue);
-
- // 鍒涘缓浼樺厛绾ф暟鎹� 闇�瑕佸厛娓呴櫎涓婁竴娆$殑璁$畻缁撴灉
- // 鍒ゆ柇褰撳墠customerOrder鏄惁瀛樺湪
- oldPriority := selectobject( macroPlan,Priority,p,p.Name() = [String]priorityValue);
- if(isnull( oldPriority ) )
- {
- macroPlan.Priority(relnew,Weight := priorityValue,Name := [String]priorityValue);
- }
+ count := 10;
+ point := 10;
+ count1 := 0;
+ flag := 0;
+ for( i := 0 ; i < resultList.Size() - overListSize ; i := i + subListSize){
+ subListCopy := subListSize;
+ if (count <= overListSize){
+ subListCopy := subListCopy + 1;
+ flag := flag + 1;
}
-
- // 鍒ゆ柇璁$畻鍒嗘鏁伴噺涓嶲uintiq鍘熷浼樺厛绾�
- //浼樺厛绾�+1
- priorityValue := priorityValue + 1;
+ for( j := 0;j < subListCopy ; j++){
+ element := resultList.Element( count1 * subListSize + j + flag );
+ element.CustomerOrder().PriorityName( [String]point );
+ }
+ point --;
+ count --;
+ count1++;
}
- }
- else
- {
- traverse( resultList,Elements,e)
- {
- obj := selectobject( macroPlan,SalesDemand.astype( CustomerOrder ),order,
- order.ID() = e.CustomerOrderID()
- );
-
- // 璁㈠崟鏁版嵁涓嶄负绌哄啀鍋氬鐞�
- if( not isnull( obj ) )
- {
- obj.PriorityName([String]priorityValue);
-
- // 鍒涘缓浼樺厛绾ф暟鎹� 闇�瑕佸厛娓呴櫎涓婁竴娆$殑璁$畻缁撴灉
- // 鍒ゆ柇褰撳墠customerOrder鏄惁瀛樺湪
- oldPriority := selectobject( macroPlan,Priority,p,p.Name() = [String]priorityValue);
- if(isnull( oldPriority ) )
- {
- macroPlan.Priority(relnew,Weight := priorityValue,Name := [String]priorityValue);
- }
- }
-
- // 鍒ゆ柇璁$畻鍒嗘鏁伴噺涓嶲uintiq鍘熷浼樺厛绾�
- subLevelCount := subLevelCount + 1;
- if( subLevelCount = subLevel )
- {
- // 褰撳埌杈惧垎娈垫暟閲忓悗 浼樺厛绾�+1 鍒嗘璁℃暟浠�0寮�濮�
- if( priorityValue < 10 )
- {
- priorityValue := priorityValue + 1;
- }
- subLevelCount := 0;
- }
- }
-
+ }else {
+ point := 10;
+ traverse( resultList,Elements,element){
+ element.CustomerOrder().PriorityName([String]point);
+ point --;
+ }
}
*]
}
--
Gitblit v1.9.3