| | |
| | | // 妿ä¸åå¨åæ·»å |
| | | if( not checkExist ){ |
| | | owner.BusinessType(relnew,BusinessTypeName := businessName); |
| | | |
| | | // åå§åä¼å
级å åæ°æ® |
| | | PriorityFactor::InitData( macroPlan,businessName); |
| | | } |
| | | *] |
| | | } |
| | |
| | | String calcStr, |
| | | CustomerOrder customerOrder, |
| | | String businessType, |
| | | MacroPlan macroPlan |
| | | MacroPlan macroPlan, |
| | | GlobalOTDTable globalOTDTable |
| | | ) as Real |
| | | { |
| | | Description: '计ç®å
¬å¼ä¸æ¬å·å
çæ°æ®' |
| | |
| | | // NBoTk Sep-26-2023 (created) |
| | | |
| | | |
| | | return PriorityResult::CalculateScore( calcStr,customerOrder,businessType,macroPlan,0.0); |
| | | return PriorityResult::CalculateScore( calcStr,customerOrder,businessType,macroPlan,0.0,globalOTDTable); |
| | | *] |
| | | } |
| | |
| | | CustomerOrder customerOrder, |
| | | String businessType, |
| | | MacroPlan macroPlan, |
| | | Real lastScore |
| | | Real lastScore, |
| | | GlobalOTDTable globalOTDTable |
| | | ) as Real |
| | | { |
| | | TextBody: |
| | |
| | | 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( "(" ) ) |
| | | { |
| | |
| | | // è®¡ç®æ¬å·ä¸çå
容 |
| | | 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()); |
| | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | |
| | | StaticMethod GetDetailsValue ( |
| | | CustomerOrder customerOrder, |
| | | String formula, |
| | | MacroPlan macroPlan |
| | | MacroPlan macroPlan, |
| | | GlobalOTDTable globalOTDTable |
| | | ) as Real |
| | | { |
| | | TextBody: |
| | |
| | | |
| | | 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()) |
| | |
| | | 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()) |
| | |
| | | Quintiq file version 2.0 |
| | | #parent: #root |
| | | StaticMethod CalculatePriorityResult ( |
| | | CustomerOrders customerOrders, |
| | | String priorityPolicyName, |
| | | String businessType, |
| | | MacroPlan macroPlan |
| | | MacroPlan macroPlan, |
| | | GlobalOTDTable globalOTDTable |
| | | ) |
| | | { |
| | | TextBody: |
| | |
| | | |
| | | // 计ç®å®¢æ·è®¢åçä¼å
级å¾å åå¡«æéæ°æ® çææ°çPriorityæç»æ°æ® |
| | | |
| | | traverse( customerOrders,Elements,e) |
| | | traverse( macroPlan,SalesDemand.astype( CustomerOrder ),e) |
| | | { |
| | | // äºä¸é¨ä¿¡æ¯ |
| | | businessType := e.BusinessType(); |
| | |
| | | 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(), |
| | |
| | | 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); |
| | |
| | | businessType := DataHolderBusinessType.Data().BusinessTypeName(); |
| | | DataHolderBusinessType.Data().Commit(); |
| | | |
| | | |
| | | PriorityFactor::InitData( MacroPlan,businessType); |
| | | |
| | | this.Close(); |
| | | *] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 |
| | | ] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 |
| | | ] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | Quintiq file version 2.0 |
| | | #parent: #root |
| | | Method OpenChoose () id:Method_DialogChoosePriorityPolicy_OpenChoose |
| | | { |
| | | #keys: '[414382.0.563950563]' |
| | | Body: |
| | | [* |
| | | ApplicationMacroPlanner.ShowFormModal( this ); |
| | | *] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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(); |
| | | *] |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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: 'éæ©ä¼å
级çç¥' |
| | | ] |
| | | } |
| | |
| | | [ |
| | | 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"}}]' |
¶Ô±ÈÐÂÎļþ |
| | |
| | | Quintiq file version 2.0 |
| | | Component listContextMenuSD #extension |
| | | { |
| | | Children: |
| | | [ |
| | | Component MenuPriorityResult |
| | | { |
| | | #keys: '[414382.0.562012014]' |
| | | BaseType: 'WebMenu' |
| | | Properties: |
| | | [ |
| | | Taborder: 10 |
| | | Title: 'äºä¸é¨ä¼å
级计ç®' |
| | | ] |
| | | } |
| | | ] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 |
| | | } |
| | | } |