| | |
| | | // 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(); |
| | | |
| | |
| | | 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; |
| | | } |
| | | |
| | | // å¤æè®¡ç®å段æ°éä¸Quintiqåå§ä¼å
级 |
| | | //ä¼å
级+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); |
| | | } |
| | | } |
| | | |
| | | // å¤æè®¡ç®å段æ°éä¸Quintiqåå§ä¼å
级 |
| | | 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 --; |
| | | } |
| | | } |
| | | *] |
| | | } |