From 56fd7e8181fa8db461333e0451cbabbf03f290f9 Mon Sep 17 00:00:00 2001
From: yypsybs <yypsybs@foxmail.com>
Date: 星期三, 27 九月 2023 16:40:23 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev

---
 _Main/BL/Type_Global_MappingOperationBOM/Attribute_IsLinkedWithFinishedGood.qbl                                                                                       |    8 
 _Main/BL/EDI/Broker_GlobalOTDTable_CustomerGrade.qbl                                                                                                                  |   64 
 _Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_ContextMenuSalesFillingCapacity_MenuSalesFillingS#360.def                        |    3 
 LibMacroPlannerOptimizer/BL/Type_CapacityPlanningSuboptimizer/Method_CapacityPlanningAlgorithmHandleFeasibleOperationDependentDemandInputG.qbl                        |   39 
 _Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Component_ListSalesDemands.def                                                                            |   30 
 _Main/BL/Type_H_OrderForecastRealQty/Attribute_Unit.qbl                                                                                                               |    2 
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_ListCapacityAllocationResultsRuleConfiguration_MenuSelectAll_OnClic.def |   17 
 _Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_ContextMenuSalesFillingCapacity.def                                                           |    4 
 _Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactor/Response_pnlActions_btnOk_OnClick.def                                                                  |   11 
 _Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_ListPriorityFactor_OnClick#106.def                                                                  |    0 
 _Main/UI/MacroPlannerWebApp/Component_FormIssueWorkOrder/Component_ListIssueWorkOrder.def                                                                             |    2 
 _Main/BL/Type_CapacityAllocationResults/Attribute_ProductID.qbl                                                                                                       |    7 
 _Main/UI/MacroPlannerWebApp/Views/Test.vw                                                                                                                             |  177 ++
 _Main/UI/MacroPlannerWebApp/Component_FrmMaterial/Response_OnCreated.def                                                                                              |    6 
 _Main/UI/MacroPlannerWebApp/Component_FormFillingScheme/Response_ListFillingScheme_MenuDelete_OnClick.def                                                             |    3 
 _Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_DataHolderPriorityFactorBusinessType_OnCreated.def                                                  |   17 
 _Main/BL/Type_FilllingCapacityOrderScheme/StaticMethod_CreateFillingCapacityOrderScheme.qbl                                                                           |   51 
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Component_listContextMenuCapacityAllocationResults.def                                            |    2 
 _Main/BL/Type_CustomerOrder/Attribute_BusinessType.qbl                                                                                                                |    8 
 _Main/BL/Type_CapacityAllocationResultsRuleConfiguration/StaticMethod_Export.qbl                                                                                      |   14 
 _Main/UI/MacroPlannerWebApp/Component_DialogFillingCustomerAndForecast/Component_pnlContent.def                                                                       |    2 
 _Main/UI/MacroPlannerWebApp/_ROOT_Project_MacroPlannerWebApp.qp                                                                                                       |    2 
 _Main/BL/Type_PriorityPolicy/StaticMethod_RollBackCalcStr.qbl                                                                                                         |   44 
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Response_PanelCapacityAllocationResults_ButtonGenerateCapacityAllocationR#39.def                  |   16 
 _Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Response_ListSalesDemands_MenuCreate_OnClick#715.def                                                      |   19 
 LibMacroPlannerOptimizer/BL/Type_SelectorFullPuzzle/Method_SetOptimizerInput.qbl                                                                                      |    4 
 _Main/BL/Type_Global_MappingCustomerGrade/TypeIndex_Global_MappingCustomerGradeTypeIndex.qbl                                                                          |   20 
 _Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PanelPriorityPolicyOperationButton_ButtonAddPriorityPolicy_OnClick.def                              |    6 
 _Main/BL/Type_CustomerAndForecastOrder/Attribute_CustomerOrderID.qbl                                                                                                  |    7 
 _Main/BL/Type_H_FunctionClass/StaticMethod_UpdateOrderForecastRealQty.qbl                                                                                             |    2 
 _Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Component_PanelSDIP.def                                                                                   |   15 
 _Main/UI/MacroPlannerWebApp/Component_DialogFillingCapacityOrder/Component_pnlContent.def                                                                             |   22 
 _Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Component_pnlContent.def                                                                             |   33 
 _Main/BL/Type_GlobalDTOTable/Method_OnAsyncExecute_GlobalOTDTable_DOI_DSI.qbl                                                                                         |   17 
 _Main/BL/Type_H_FunctionClass/StaticMethod_SM_MaterialReverse.qbl                                                                                                     |    7 
 _Main/BL/Type_Unit/StaticMethod_CreateOrUpdate.qbl                                                                                                                    |    8 
 _Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/_ROOT_Component_FormPriorityFactor.def                                                                       |   14 
 _Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/Method_New.def                                                                 |   14 
 _Main/BL/Type_CapacityAllocationResultsRuleConfiguration/Attribute_StockingPointID.qbl                                                                                |    9 
 _Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Response_pnlActions_btnCancel_OnClick.def                                                            |   15 
 _Main/BL/Type_BusinessType/StaticMethod_CreateData.qbl                                                                                                                |    1 
 _Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel351_btn_Add_Material_FOF503_OnClick#222.def                                                      |   32 
 _Main/BL/Type_CustomerAndForecastOrder/StaticMethod_RefreshData.qbl                                                                                                   |   46 
 _Main/BL/Type_GlobalDTOTable/Method_OnAsyncExecuteFailure_GlobalOTDTable_CustomerGrade.qbl                                                                            |   20 
 _Main/BL/Type_Global_MappingCustomerGrade/Attribute_CustomerGrade.qbl                                                                                                 |    9 
 _Main/UI/MacroPlannerWebApp/Component_FormFillingCapacityScheme/Component_listContextMenuCustomerAndFillingCapacityOrder.def                                          |    4 
 _Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Component_PanelPriorityPolicyCoefficient#902.def                                                             |    2 
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Component_PanelImportAndExport.def                                               |   37 
 _Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/Response_pnlActions_btnCancel_OnClick.def                                      |   15 
 _Main/BL/Type_Global_MappingDOI_DSI/Attribute_OrganCode.qbl                                                                                                           |    9 
 _Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl                                                                                                                    |    3 
 _Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenario_OnClick#549.def                                                    |    2 
 _Main/BL/Relations/Relation_CapacityAllocationResultsRuleConfiguration_CapacityAllocationResult.qbl                                                                   |   23 
 _Main/BL/Type_Global_MappingProduct_MP/Method_SetIsLinkedWithFinishedGoodAttributes_Recursive.qbl                                                                     |   83 +
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_ListCapacityAllocationResultsRuleConfiguration_MenuNew_OnClick.def      |   19 
 _Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetMaterialData.qbl                                                                                                     |   17 
 _Main/BL/Type_ScenarioManager/StaticMethod_AvailableBusinessTypes.qbl                                                                                                 |   15 
 _Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Response_pnlContent_DataHolderChoosePriorityPolicy_OnDataChanged.def                                 |   18 
 _Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactorDetails/Response_pnlActions_btnOk_OnClick.def                                                           |    2 
 _Main/BL/Type_CapacityAllocationResultsRuleConfiguration/Attribute_Division.qbl                                                                                       |    8 
 _Main/UI/MacroPlannerWebApp/Component_FrmMaterial/Response_List832_OnDoubleClick.def                                                                                  |   47 
 _Main/UI/MacroPlannerWebApp/Component_DialogBusinessType/Method_ClickBtnOk.def                                                                                        |    8 
 _Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Component_ListSalesDemands.def                                                                               |   18 
 _Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/_ROOT_Component_FormCustomerOrders226.def                                                                 |   18 
 _Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Response_pnlContent_DataHolderChoosePriorityPolicy_OnCreated.def                                     |   18 
 _Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactorDetails/Response_pnlContent_isRange_OnCreated.def                                                       |   30 
 _Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Component_PanelSalesDemands.def                                                                           |   12 
 _Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_DropDownStringListBusinessType_OnSelectionChanged.def                                               |    1 
 _Main/BL/Type_BusinessType/StaticMethod_GetBusinessNameStr.qbl                                                                                                        |    2 
 _Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Method_OpenChoose.def                                                                                |   10 
 _Main/UI/MacroPlannerWebApp/Component_FormPriorityFactorGrading/_ROOT_Component_FormPriorityFactorGrading.def                                                         |    4 
 _Main/BL/Type_CapacityAllocationResults/Attribute_ManufacturedDate.qbl                                                                                                |    7 
 _Main/BL/Type_CapacityAllocationResultsRuleConfiguration/TypeIndex_CapacityAllocationResultsRuleConfigurationTypeIndex.qbl                                            |   20 
 _Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Component_PanelAllSalesDemands.def                                                                           |    8 
 _Main/BL/Type_PriorityFactor/Attribute_ReflectionType.qbl                                                                                                             |    7 
 _Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_ContextMenuSalesFillingCapacity_MenuSalesFillingSchem.def                        |    3 
 _Main/BL/EDI/Broker_GlobalOTDTable_CARRC_Export.qbl                                                                                                                   |   49 
 _Main/BL/Type_H_OrderForecastRealQty/Attribute_Department.qbl                                                                                                         |    8 
 _Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Component_listContextMenuPriorityFactor.def                                                                  |   13 
 _Main/BL/KnowledgeBaseDomain_MacroPlanner/KnowledgeBase_Knowledge_MP/_ROOT_KnowledgeBase_Knowledge_MP.qbl                                                             |    6 
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Component_PanelCapacityAllocationResults.def                                                      |   37 
 _Main/UI/MacroPlannerWebApp/Component_FrmMaterial/Response_Panel418_btn_Add_FM_OnClick#975.def                                                                        |    3 
 _Main/BL/Type_PriorityResult/StaticMethod_CalculateScore.qbl                                                                                                          |   89 +
 _Main/UI/MacroPlannerWebApp/Component_FormFillingScheme/Response_ListFillingScheme_OnSelectionChanged.def                                                             |   20 
 _Main/BL/Type_H_OrderForecastRealQty/Attribute_Month.qbl                                                                                                              |    2 
 _Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_ContextMenuSalesFillingCapacity_MenuSalesFillingCapac.def                        |    5 
 _Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_OnCreated.def                                                                                         |   10 
 _Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/_ROOT_Component_FormCustomerOrders.def                                                                       |   10 
 _Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactorDetails/Response_pnlContent_isRange_OnChanged.def                                                       |   14 
 _Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenarioAndDoSync_OnClick#545.def                                           |    2 
 _Main/BL/Type_Global_MappingDOI_DSI/_ROOT_Type_Global_MappingDOI_DSI.qbl                                                                                              |    9 
 _var/_Main/ProjSettings/MacroPlannerWebApp/Views/FillingCapacityOrderHistorical.vw                                                                                    |   14 
 _var/_Main/ProjSettings/MacroPlannerWebApp/Views/Test.vw                                                                                                              |   42 
 _Main/BL/Type_Global_MappingDOI_DSI/Attribute_ProductID.qbl                                                                                                           |    9 
 _Main/BL/Type_H_FunctionClass/StaticMethod_SM_OrderReverseOrAuthorize.qbl                                                                                             |    7 
 _Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel351_btn_Add_Order_FOF449_OnClick#880.def                                                         |   21 
 _Main/BL/Type_CapacityAllocationResults/Attribute_Date.qbl                                                                                                            |    7 
 _Main/BL/Type_PriorityResult/StaticMethod_calculatePriorityResult.qbl                                                                                                 |   78 +
 _Main/BL/Type_H_FunctionClass/StaticMethod_SM_InitialForcastDataEx.qbl                                                                                                |  102 
 _Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_ListPriorityPolicy_MenuDelete_OnClick.def                                                           |    1 
 _Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Method_CalculatePriorityResult.def                                                                   |   12 
 _Main/BL/Type_CustomerAndForecastOrder/Attribute_ForecastID.qbl                                                                                                       |    7 
 _Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PanelPriorityPolicyOperationButton_DropDownStringList_OnSelectionCh.def                             |    2 
 _Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Component_PanelPriorityPolicyOperationButton#713.def                                                         |    4 
 _Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Component_ListSDIP.def                                                                                    |   20 
 _Main/BL/Type_CapacityAllocationResultsRuleConfiguration/Attribute_ModuleMaterialCode.qbl                                                                             |    9 
 _Main/BL/Type_GlobalDTOTable/Method_SetIsLinkedWithFinishedGoodAttributes.qbl                                                                                         |   41 
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Component_listActionBarPageCapacityAllocationResults.def                                          |    2 
 _Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel351_btn_Query_FOF_OnClick.def                                                                    |   21 
 _Main/BL/Type_CapacityAllocationResults/StaticMethod_IterativeGeneration2.qbl                                                                                         |   97 +
 _Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_liH_Forecast.def                                                                                     |    8 
 _Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Component_PanelAllSalesDemands.def                                                                        |   11 
 _Main/UI/MacroPlannerWebApp/Views/填产方案列表.vw                                                                                                                           |    2 
 _Main/BL/Type_FilllingCapacityOrderScheme/StaticMethod_DeleteDetails.qbl                                                                                              |   19 
 _Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Component_listContextMenuSD.def                                                                              |   17 
 _Main/BL/Type_Global_MappingCustomerGrade/Attribute_Customer.qbl                                                                                                      |    9 
 _Main/BL/Type_Global_MappingDOI_DSI/Attribute_DOI.qbl                                                                                                                 |    8 
 _Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/Component_pnlActions.def                                                       |   40 
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_PanelImportAndExport_Import_OnClick.def                                 |   29 
 _Main/BL/Type_CapacityAllocationResults/Attribute_UserQuantity.qbl                                                                                                    |    7 
 _Main/BL/Type_PriorityResult/StaticMethod_GetDetailsValue.qbl                                                                                                         |  114 +
 _Main/BL/EDI/Broker_GlobalOTDTable_CARRC_Import.qbl                                                                                                                   |   49 
 _Main/BL/Type_CustomerOrder/Attribute_OrderTag.qbl                                                                                                                    |    8 
 _Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_ListPriorityFactor_OnSelectionChanged.def                                                           |   20 
 _Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactorDetails/Component_pnlContent.def                                                                        |   27 
 _Main/BL/InfoMessages.qbl                                                                                                                                             |    6 
 _Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/_ROOT_Component_FrmOrderForecast.def                                                                           |   96 -
 _Main/BL/Type_CapacityAllocationResultsRuleConfiguration/_ROOT_Type_CapacityAllocationResultsRuleConfiguration.qbl                                                    |   10 
 _Main/BL/Type_CustomerOrder/Attribute_OrderType.qbl                                                                                                                   |    8 
 _Main/BL/Type_PriorityResult/StaticMethod_CalculateBracketScore.qbl                                                                                                   |   19 
 _Main/BL/Type_Global_MappingDOI_DSI/TypeIndex_Global_MappingDOI_DSITypeIndex.qbl                                                                                      |   16 
 _Main/BL/Type_PriorityFactorDetails/StaticMethod_InitData.qbl                                                                                                         |  111 +
 _Main/BL/Type_CustomerOrder/Attribute_CustomerPolicy.qbl                                                                                                              |    8 
 _Main/BL/Type_H_OrderForecastRealQty/Attribute_ForecastQty.qbl                                                                                                        |    2 
 _Main/BL/Type_H_OrderForecastRealQty/Attribute_SKU.qbl                                                                                                                |    2 
 _Main/BL/Type_CustomerOrder/Attribute_IsAvailable.qbl                                                                                                                 |    8 
 _Main/UI/MacroPlannerWebApp/Component_FormFillingCapacityScheme/Response_ListCustomerAndFillingCapacityOrder_MenuRefresh_OnClick.def                                  |    8 
 _Main/UI/MacroPlannerWebApp/Component_FormPanelMaterialTianHua/_ROOT_Component_FormPanelMaterialTianHua.def                                                           |    4 
 _Main/BL/Type_ProductInStockingPointInPeriodPlanningLeaf/FunctionOverride_CalcStockLevelInDays.qbl                                                                    |   79 +
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_ListCapacityAllocationResultsRuleConfiguration_MenuDelete_OnClick.def   |   18 
 _Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Response_TIANMA_JITUAN_ListSalesDemands_MenuPriorityResult_OnClick.def                                       |   19 
 _Main/BL/Type_PriorityFactor/Attribute_ReflectionAttribute.qbl                                                                                                        |    7 
 _Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_abgTest_btnTest_OnClick.def                                                      |   16 
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Component_ListCapacityAllocationResults.def                                                       |   14 
 _Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenarioAndDoSync_OnClick.def                                               |    2 
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Component_ListCapacityAllocationResultsRuleConfiguration.def                     |   59 
 _Main/BL/Type_Global_MappingProduct_MP/Attribute_IsLinkedWithFinishedGood.qbl                                                                                         |    8 
 _Main/UI/MacroPlannerWebApp/Component_DialogCreateEditIssueWorkOrder/Response_pnlActions_btnOk_OnClick.def                                                            |   10 
 _Main/BL/EDI/Broker_GlobalOTDTable_DOI_DSI.qbl                                                                                                                        |   71 
 _Main/BL/Type_CapacityAllocationResults/Attribute_Description.qbl                                                                                                     |    7 
 _Main/BL/Type_ProductInStockingPointInPeriodPlanningLeaf/_ROOT_Type_ProductInStockingPointInPeriodPlanningLeaf.qbl                                                    |    6 
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/_ROOT_Component_FormCapacityAllocationResultsRuleConfiguration.def               |   43 
 _Main/BL/Relations/Relation_H_CustomOrder_MacroPlan_MacroPlan_H_CustomOrder.qbl                                                                                       |   23 
 _Main/BL/Type_H_OrderForecastRealQty/Attribute_VCode.qbl                                                                                                              |    8 
 _Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_abgTest.def                                                                                   |   25 
 _Main/BL/Type_CapacityAllocationResults/Attribute_ID.qbl                                                                                                              |    7 
 _Main/UI/MacroPlannerWebApp/Views/PriorityResults.vw                                                                                                                  |    4 
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_PanelImportAndExport_Export_OnClick.def                                 |   16 
 _Main/BL/Type_Global_MappingOperation/Attribute_IsLinkedWithFinishedGood.qbl                                                                                          |    8 
 LibMacroPlanner/BL/Type_UnitPeriodTimeBase/Function_CalcTotalAvailableCapacity.qbl                                                                                    |    3 
 _Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PanelPriorityPolicyOperationButton_DropDownStringList_OnCreated.def                                 |   17 
 _Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_Panel351.def                                                                                         |   42 
 _Main/BL/Type_Global_MappingCustomerGrade/_ROOT_Type_Global_MappingCustomerGrade.qbl                                                                                  |    9 
 _Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/_ROOT_Component_DialogCreateEditCapacityAllocationResultsRuleConfiguration.def |   32 
 _Main/BL/Type_CapacityAllocationResults/StaticMethod_CreateDate.qbl                                                                                                   |   21 
 _Main/BL/Type_GlobalDTOTable/Method_OnAsyncExecute_GlobalOTDTable_CustomerGrade.qbl                                                                                   |   17 
 _Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Response_pnlActions_btnOk_OnClick.def                                                                |   16 
 _Main/BL/Type_CapacityAllocationResultsRuleConfiguration/StaticMethod_Import.qbl                                                                                      |   14 
 _Main/BL/Type_CapacityAllocationResults/DeclarativeReferenceRelation_CalcCapacityAllocationResultsRuleConfiguration.qbl                                               |   15 
 _Main/UI/MacroPlannerWebApp/Component_FormPriorityResult/_ROOT_Component_FormPriorityResult.def                                                                       |    4 
 _Main/BL/Type_CustomerOrder/Attribute_SheetProfitability.qbl                                                                                                          |    8 
 _Main/BL/Type_Routing/Method_DoSanityCheckData.qbl                                                                                                                    |   20 
 _Main/BL/Relations/Relation_Global_MappingDOI_DSI_GlobalOTDTable_GlobalOTDTable_Global_MappingD.qbl                                                                   |   23 
 _Main/BL/Type_CustomerOrder/Attribute_SegmentPriority.qbl                                                                                                             |    8 
 _Main/BL/Type_H_FunctionClass/StaticMethod_SM_OrderHedging.qbl                                                                                                        |  321 ++-
 _Main/BL/Type_PriorityFactor/StaticMethod_CheckNameValid.qbl                                                                                                          |   29 
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/_ROOT_Component_FormCapacityAllocationResults.def                                                 |   12 
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Response_PanelCapacityAllocationResults_Export_OnClick.def                                        |   16 
 _Main/BL/Type_PriorityFactor/StaticMethod_InitData.qbl                                                                                                                |   45 
 _Main/UI/MacroPlannerWebApp/Views/FillingCapacityOrderHistorical.vw                                                                                                   |    2 
 _Main/BL/EDI/Broker_GlobalOTDTable_CAR_Export.qbl                                                                                                                     |   65 
 _Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetBOMBySKU.qbl                                                                                                         |   10 
 _Main/BL/Type_H_OrderForecastRealQty/Attribute_CustomCode.qbl                                                                                                         |    8 
 _Main/BL/Type_H_OrderForecastRealQty/Attribute_StockingPointID.qbl                                                                                                    |    8 
 _Main/BL/Type_Routing/Method_GetHasTianmaNonSupplierOperationWithNoInput.qbl                                                                                          |   28 
 _Main/BL/Type_GlobalDTOTable/StaticMethod_SynchronizationAllMappingBrokerAndAPI.qbl                                                                                   |    4 
 _Main/UI/MacroPlanner/Component_FormTestButtonCollection/Response_Button398_OnClick.def                                                                               |    2 
 _Main/BL/Type_CapacityAllocationResults/StaticMethod_Export.qbl                                                                                                       |   13 
 _Main/UI/MacroPlannerWebApp/Component_FormIssueWorkOrder/Response_ListIssueWorkOrder_MenuEdit_OnClick.def                                                             |   12 
 _Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/Response_pnlActions_btnOk_OnClick.def                                          |   34 
 _Main/BL/Relations/Relation_CapacityAllocationResultsRuleConfiguration_GlobalOTDTable_GlobalOTD.qbl                                                                   |   23 
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Component_listContextMenuCapacityAllocationResultsRuleConfiguration.def          |   59 
 _Main/BL/Type_CustomerOrder/Attribute_OrderTime.qbl                                                                                                                   |    8 
 _Main/BL/Type_GlobalDTOTable/Method_OnAsyncExecuteFailure_GlobalOTDTable_DOI_DSI.qbl                                                                                  |   20 
 _Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Component_pnlActions.def                                                                             |   40 
 _Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetProductInfo#1.qbl                                                                                                    |    7 
 _Main/UI/MacroPlannerWebApp/Views/FillingCapacityOrder.vw                                                                                                             |    4 
 _Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/_ROOT_Component_DialogChoosePriorityPolicy.def                                                       |   22 
 _Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_ListPriorityPolicy_OnUserSelectionChanged.def                                                       |    6 
 _Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_liH_Forecast_OnDoubleClick.def                                                                        |   26 
 _Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_DropDownStringListBusinessType_OnCreated.def                                                        |    2 
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_DataHolderSelectCapacityAllocationResultsRuleConfiguration_OnDataCh.def |   18 
 _Main/BL/Type_CapacityAllocationResults/Attribute_StockingPointID.qbl                                                                                                 |    7 
 _Main/BL/Type_CapacityAllocationResultsRuleConfiguration/Attribute_PanelMaterialCode.qbl                                                                              |    9 
 _Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Response_ListSalesDemands_MenuCopy_OnClick.def                                                            |   19 
 _Main/BL/Type_PriorityResult/StaticMethod_GetRemindFormula.qbl                                                                                                        |   32 
 _Main/BL/Type_PriorityResult/Attribute_CustomerOrderID.qbl                                                                                                            |    7 
 _Main/BL/Type_Global_MappingDOI_DSI/Attribute_DSI.qbl                                                                                                                 |    8 
 _Main/BL/Type_CapacityAllocationResults/StaticMethod_ObtainTheFinalOutputProduct.qbl                                                                                  |   35 
 _Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PanelPriorityPolicyOperationButton_ButtonRollBack_OnClick.def                                       |    2 
 _Main/UI/MacroPlannerWebApp/Component_FrmAuthorizeAndCountersign_Material/Response_OnCreated.def                                                                      |    3 
 _Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/Method_Edit.def                                                                |   17 
 _Main/BL/Type_H_OrderForecastRealQty/Attribute_SKUName.qbl                                                                                                            |    8 
 _Main/BL/Type_CustomerOrder/Attribute_ProductGrade.qbl                                                                                                                |    8 
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Component_listActionBarPageCapacityAllocationResultsRuleConfiguration.def        |   10 
 _Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Response_ListSalesDemands_MenuEdit_OnClick.def                                                            |   20 
 _Main/BL/Relations/Relation_Global_MappingCustomerGrade_GlobalOTDTable_GlobalOTDTable_Global_Ma.qbl                                                                   |   23 
 _Main/BL/Type_Global_MappingCustomerGrade/Attribute_BusinessType.qbl                                                                                                  |    9 
 _Main/BL/Type_H_CustomOrder/_ROOT_Type_H_CustomOrder.qbl                                                                                                              |   10 
 _Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/_ROOT_Component_ApplicationMacroPlanner.def                                                             |    1 
 _Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenario_OnClick.def                                                        |    2 
 _Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuEdit_OnClick.def                                                                  |    2 
 _Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/Component_pnlContent.def                                                       |   58 
 _Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Component_PanelSalesDemands.def                                                                              |    8 
 _Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_applicationDevelopmentActionBarPageDef#1.def                                                  |    8 
 _Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_DataHolderPriorityFactorBusinessType_OnDataChanged.def                                              |   19 
 /dev/null                                                                                                                                                             |   12 
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_ListCapacityAllocationResultsRuleConfiguration_MenuEdit_OnClick.def     |   21 
 228 files changed, 4,024 insertions(+), 635 deletions(-)

diff --git a/LibMacroPlanner/BL/Type_UnitPeriodTimeBase/Function_CalcTotalAvailableCapacity.qbl b/LibMacroPlanner/BL/Type_UnitPeriodTimeBase/Function_CalcTotalAvailableCapacity.qbl
index 7b7de81..704abc5 100644
--- a/LibMacroPlanner/BL/Type_UnitPeriodTimeBase/Function_CalcTotalAvailableCapacity.qbl
+++ b/LibMacroPlanner/BL/Type_UnitPeriodTimeBase/Function_CalcTotalAvailableCapacity.qbl
@@ -16,7 +16,8 @@
                                
       if( not isnull( planningup ) )
       {
-         value := planningup.BaseAvailableCapacity().HoursAsReal() * planningup.MaximumLoadPercentage() / 100;   
+         value := planningup.BaseAvailableCapacity().HoursAsReal() * planningup.MaximumLoadPercentage() / 100
+                  * this.PlanningSystemRatio(); // Tianma fix 20230926
       }
     }
     else
diff --git a/LibMacroPlannerOptimizer/BL/Type_CapacityPlanningSuboptimizer/Method_CapacityPlanningAlgorithmHandleFeasibleOperationDependentDemandInputG.qbl b/LibMacroPlannerOptimizer/BL/Type_CapacityPlanningSuboptimizer/Method_CapacityPlanningAlgorithmHandleFeasibleOperationDependentDemandInputG.qbl
index dcaa2a7..48ca380 100644
--- a/LibMacroPlannerOptimizer/BL/Type_CapacityPlanningSuboptimizer/Method_CapacityPlanningAlgorithmHandleFeasibleOperationDependentDemandInputG.qbl
+++ b/LibMacroPlannerOptimizer/BL/Type_CapacityPlanningSuboptimizer/Method_CapacityPlanningAlgorithmHandleFeasibleOperationDependentDemandInputG.qbl
@@ -9,7 +9,6 @@
   Description: 'Assign the optimal quantity from optimizer for dependent demand in input group.'
   TextBody:
   [*
-    // Tianma fix 20230727
     // Dependent demand of input group fulfillment
     ptperiod := periodtaskoperation.UnitPeriod().Period_MP();
     operation := periodtaskoperation.Operation();
@@ -19,22 +18,24 @@
               dd, 
               dd.HasRegularProductForOptimizer() or dd.OperationInput().GetIsProductInOptimizerRun( runcontext.IsPostProcessing() ) )
     {
-      pispipperiods := construct( Period_MPs, constcontent ); 
-      if ( getfromperiodtask ) // in case we are able to get from period tasks, below method refinds periodtask for (operation, ptperiod) i.e. periodtaskoperation and then output dep.demand periods
-      {
-        traverse( periodtaskoperation, DependentDemand.ProductInStockingPointInPeriodPlanningLeaf.Period_MP, ddperiod ) 
-        {
-          pispipperiods.Add( ddperiod ); 
-        }
-      }
-      else
-      {
-        CapacityPlanningSuboptimizer::GetOperationDependentDemandPeriods( ptperiod, operation, &pispipperiods, getfromperiodtask );
-      }
+      fulfilledqty := 0.0; 
       
-      fulfilledqty := 0.0;  
       if( operation.HasLeadTime() )     // Get the dependent demands that is located at different period from the period of period task.
       {
+        // compute dependent demand periods
+        pispipperiods := construct( Period_MPs, constcontent ); 
+        if ( getfromperiodtask ) // in case we are able to get from period tasks, below method refinds periodtask for (operation, ptperiod) i.e. periodtaskoperation and then output dep.demand periods
+        {
+          traverse( periodtaskoperation, DependentDemand.ProductInStockingPointInPeriodPlanningLeaf.Period_MP, ddperiod ) 
+          {
+            pispipperiods.Add( ddperiod ); 
+          }
+        }
+        else
+        {
+          CapacityPlanningSuboptimizer::GetOperationDependentDemandPeriods( ptperiod, operation, &pispipperiods, getfromperiodtask );
+        }
+        
         fulfilledqty := sum( pispipperiods, Elements, pispipperiod,
                              this.GetOptimalValue( program.PartialOperationDemandQtyVariables().Get( dd.OperationInput(), pispipperiod, ptperiod ) ) );
         if ( runcontext.IsMetaIteration() and operation.IsBlending() ) // no filtering for numerical sensitive blending operation in meta optimizer
@@ -44,15 +45,15 @@
         }                     
       }
       else
-      {
-        fulfilledqty := sum( pispipperiods, Elements, pispipperiod,
-                             this.GetOptimalValue( program.OperationDemandQtyVariables().Get( dd.OperationInput(), pispipperiod ) ) );
+      { 
+        // note that in case there is no lead time then the set of dependent demand periods just equals the singleton set {ptperiod}
+        fulfilledqty := this.GetOptimalValue( program.OperationDemandQtyVariables().Get( dd.OperationInput(), ptperiod ) );
         if( runcontext.IsMetaIteration() and operation.IsBlending() ) // no filtering for numerical sensitive blending operation in meta optimizer
         {
-          fulfilledqty := sum( pispipperiods, Elements, pispipperiod,
-                               this.GetOptimalValueUnfiltered( program.OperationDemandQtyVariables().Get( dd.OperationInput(), pispipperiod ) ) );
+          fulfilledqty := this.GetOptimalValueUnfiltered( program.OperationDemandQtyVariables().Get( dd.OperationInput(), ptperiod ) );
         }
       }
+      
       dd.OptimizerFulfilledQuantity( fulfilledqty );
     }
   *]
diff --git a/LibMacroPlannerOptimizer/BL/Type_SelectorFullPuzzle/Method_SetOptimizerInput.qbl b/LibMacroPlannerOptimizer/BL/Type_SelectorFullPuzzle/Method_SetOptimizerInput.qbl
index d9e0f40..c34a5c7 100644
--- a/LibMacroPlannerOptimizer/BL/Type_SelectorFullPuzzle/Method_SetOptimizerInput.qbl
+++ b/LibMacroPlannerOptimizer/BL/Type_SelectorFullPuzzle/Method_SetOptimizerInput.qbl
@@ -175,10 +175,12 @@
       
       if ( ddperiodstotal.Size() > 0 ) 
       {
+        minstart := min( ddperiodstotal, Elements, p, p.Start() ); 
+        minstartperiods := min( periods, Elements, p, p.Start() ); 
         pispiptoadd := selectset( operation, 
                                   OperationInput.ProductInStockingPoint_MP.ProductInStockingPointInPeriodPlanning, 
                                   pispip,
-                                  ddperiodstotal.Find( pispip.Period_MP() ) > 0
+                                  pispip.Start() >= minstart and pispip.Start() < minstartperiods // must add the entire block. Don't want gaps in the pispip horizon
                                   and ( pispip.HasRegularProductForOptimizer() or pispip.GetProductIsIncludedInOptimizerRun( runcontext.IsPostProcessing() ) ) 
                                   and not scope.Contains( pispip.PISPIPInOptimizerRun() ) )
                                     
diff --git a/_Main/BL/EDI/Broker_GlobalOTDTable_CARRC_Export.qbl b/_Main/BL/EDI/Broker_GlobalOTDTable_CARRC_Export.qbl
new file mode 100644
index 0000000..d50d284
--- /dev/null
+++ b/_Main/BL/EDI/Broker_GlobalOTDTable_CARRC_Export.qbl
@@ -0,0 +1,49 @@
+Quintiq file version 2.0
+#parent: #root
+EDIBroker GlobalOTDTable_CARRC_Export
+{
+  MDSDefinition: GlobalOTDTable
+  TimeZone: 'ACT'
+  UseOSTimeZone: false
+  EDIModelLink.Source Source11
+  {
+    EDIMLTable CapacityAllocationResultsRuleConfiguration
+    {
+      PrimaryKeyColumns: ModuleMaterialCode
+      PrimaryKeyColumns: PanelMaterialCode
+      PrimaryKeyColumns: StockingPointID
+      TargetType: CapacityAllocationResultsRuleConfiguration
+      TypeIndex: CapacityAllocationResultsRuleConfigurationTypeIndex
+      EDIMLColumn Division { Attribute: Division ValueType: String }
+      EDIMLColumn ModuleMaterialCode { Attribute: ModuleMaterialCode ValueType: String }
+      EDIMLColumn PanelMaterialCode { Attribute: PanelMaterialCode ValueType: String }
+      EDIMLColumn StockingPointID { Attribute: StockingPointID ValueType: String }
+    }
+  }
+  EDITransformation.Transformation Transformation11
+  {
+    EDITableTransformation
+    {
+      InputTable: CapacityAllocationResultsRuleConfiguration
+      OutputTable: CapacityAllocationResultsRuleConfiguration
+      EDIColumnMatch { InputColumn: Division OutputColumn: Division }
+      EDIColumnMatch { InputColumn: ModuleMaterialCode OutputColumn: ModuleMaterialCode }
+      EDIColumnMatch { InputColumn: PanelMaterialCode OutputColumn: PanelMaterialCode }
+      EDIColumnMatch { InputColumn: StockingPointID OutputColumn: StockingPointID }
+    }
+  }
+  EDIXLSLink.Destination Destination12
+  {
+    FileName: 'Destination12'
+    EDIXLSLinkTable CapacityAllocationResultsRuleConfiguration
+    {
+      Columns:
+      [
+        EDIXLSLinkColumn Division { ValueType: String }
+        EDIXLSLinkColumn ModuleMaterialCode { ValueType: String }
+        EDIXLSLinkColumn PanelMaterialCode { ValueType: String }
+        EDIXLSLinkColumn StockingPointID { ValueType: String }
+      ]
+    }
+  }
+}
diff --git a/_Main/BL/EDI/Broker_GlobalOTDTable_CARRC_Import.qbl b/_Main/BL/EDI/Broker_GlobalOTDTable_CARRC_Import.qbl
new file mode 100644
index 0000000..e539ed2
--- /dev/null
+++ b/_Main/BL/EDI/Broker_GlobalOTDTable_CARRC_Import.qbl
@@ -0,0 +1,49 @@
+Quintiq file version 2.0
+#parent: #root
+EDIBroker GlobalOTDTable_CARRC_Import
+{
+  MDSDefinition: GlobalOTDTable
+  TimeZone: 'ACT'
+  UseOSTimeZone: false
+  EDIModelLink.Destination Destination13
+  {
+    EDIMLTable CapacityAllocationResultsRuleConfiguration
+    {
+      PrimaryKeyColumns: ModuleMaterialCode
+      PrimaryKeyColumns: PanelMaterialCode
+      PrimaryKeyColumns: StockingPointID
+      TargetType: CapacityAllocationResultsRuleConfiguration
+      TypeIndex: CapacityAllocationResultsRuleConfigurationTypeIndex
+      EDIMLColumn Division { Attribute: Division ValueType: String }
+      EDIMLColumn ModuleMaterialCode { Attribute: ModuleMaterialCode ValueType: String }
+      EDIMLColumn PanelMaterialCode { Attribute: PanelMaterialCode ValueType: String }
+      EDIMLColumn StockingPointID { Attribute: StockingPointID ValueType: String }
+    }
+  }
+  EDITransformation.Transformation Transformation12
+  {
+    EDITableTransformation
+    {
+      InputTable: CapacityAllocationResultsRuleCo
+      OutputTable: CapacityAllocationResultsRuleConfiguration
+      EDIColumnMatch { InputColumn: Division OutputColumn: Division }
+      EDIColumnMatch { InputColumn: ModuleMaterialCode OutputColumn: ModuleMaterialCode }
+      EDIColumnMatch { InputColumn: PanelMaterialCode OutputColumn: PanelMaterialCode }
+      EDIColumnMatch { InputColumn: StockingPointID OutputColumn: StockingPointID }
+    }
+  }
+  EDIXLSLink.Source Source12
+  {
+    FileName: '浜ц兘鍒嗛厤缁撴灉瑙勫垯.xlsx'
+    EDIXLSLinkTable CapacityAllocationResultsRuleCo
+    {
+      Columns:
+      [
+        EDIXLSLinkColumn Division { ValueType: String }
+        EDIXLSLinkColumn ModuleMaterialCode { ValueType: String }
+        EDIXLSLinkColumn PanelMaterialCode { ValueType: String }
+        EDIXLSLinkColumn StockingPointID { ValueType: String }
+      ]
+    }
+  }
+}
diff --git a/_Main/BL/EDI/Broker_GlobalOTDTable_CAR_Export.qbl b/_Main/BL/EDI/Broker_GlobalOTDTable_CAR_Export.qbl
new file mode 100644
index 0000000..571fce9
--- /dev/null
+++ b/_Main/BL/EDI/Broker_GlobalOTDTable_CAR_Export.qbl
@@ -0,0 +1,65 @@
+Quintiq file version 2.0
+#parent: #root
+EDIBroker GlobalOTDTable_CAR_Export
+{
+  MDSDefinition: GlobalOTDTable
+  TimeZone: 'ACT'
+  UseOSTimeZone: false
+  EDIModelLink.Source Source13
+  {
+    EDIMLTable CapacityAllocationResults
+    {
+      TargetType: CapacityAllocationResults
+      EDIMLColumn Date { Attribute: Date ValueType: Date }
+      EDIMLColumn Description { Attribute: Description ValueType: String }
+      EDIMLColumn Division { Attribute: Division ValueType: String }
+      EDIMLColumn ID { Attribute: ID ValueType: String }
+      EDIMLColumn ManufacturedDate { Attribute: ManufacturedDate ValueType: Date }
+      EDIMLColumn ModuleBase { Attribute: ModuleBase ValueType: String }
+      EDIMLColumn ModuleMaterialCode { Attribute: ModuleMaterialCode ValueType: String }
+      EDIMLColumn ModuleMeasurementUnit { Attribute: ModuleMeasurementUnit ValueType: String }
+      EDIMLColumn NumberOfModules { Attribute: NumberOfModules ValueType: Real }
+      EDIMLColumn NumberOfPanels { Attribute: NumberOfPanels ValueType: Real }
+      EDIMLColumn PanelBase { Attribute: PanelBase ValueType: String }
+      EDIMLColumn PanelMaterialCode { Attribute: PanelMaterialCode ValueType: String }
+      EDIMLColumn PanelMeasurementUnit { Attribute: PanelMeasurementUnit ValueType: String }
+      EDIMLColumn ProductID { Attribute: ProductID ValueType: String }
+      EDIMLColumn RequirementDate { Attribute: RequirementDate ValueType: Date }
+      EDIMLColumn StockingPointID { Attribute: StockingPointID ValueType: String }
+      EDIMLColumn UserQuantity { Attribute: UserQuantity ValueType: Real }
+      EDIMLColumn VersionNumber { Attribute: VersionNumber ValueType: String }
+    }
+  }
+  EDITransformation.Transformation Transformation13
+  {
+    EDITableTransformation
+    {
+      InputTable: CapacityAllocationResults
+      OutputTable: CapacityAllocationResults
+      EDIColumnMatch { InputColumn: Date OutputColumn: Date }
+      EDIColumnMatch { InputColumn: Description OutputColumn: Description }
+      EDIColumnMatch { InputColumn: ID OutputColumn: ID }
+      EDIColumnMatch { InputColumn: ManufacturedDate OutputColumn: ManufacturedDate }
+      EDIColumnMatch { InputColumn: ProductID OutputColumn: ProductID }
+      EDIColumnMatch { InputColumn: StockingPointID OutputColumn: StockingPointID }
+      EDIColumnMatch { InputColumn: UserQuantity OutputColumn: UserQuantity }
+    }
+  }
+  EDIXLSLink.Destination Destination14
+  {
+    FileName: 'Destination14'
+    EDIXLSLinkTable CapacityAllocationResults
+    {
+      Columns:
+      [
+        EDIXLSLinkColumn Date { ValueType: Date }
+        EDIXLSLinkColumn Description { ValueType: String }
+        EDIXLSLinkColumn ID { ValueType: String }
+        EDIXLSLinkColumn ProductID { ValueType: String }
+        EDIXLSLinkColumn StockingPointID { ValueType: String }
+        EDIXLSLinkColumn UserQuantity { ValueType: Real }
+        EDIXLSLinkColumn ManufacturedDate { ValueType: Date }
+      ]
+    }
+  }
+}
diff --git a/_Main/BL/EDI/Broker_GlobalOTDTable_CustomerGrade.qbl b/_Main/BL/EDI/Broker_GlobalOTDTable_CustomerGrade.qbl
new file mode 100644
index 0000000..9ba2dac
--- /dev/null
+++ b/_Main/BL/EDI/Broker_GlobalOTDTable_CustomerGrade.qbl
@@ -0,0 +1,64 @@
+Quintiq file version 2.0
+#parent: #root
+EDIBroker GlobalOTDTable_CustomerGrade
+{
+  MDSDefinition: GlobalOTDTable
+  TimeZone: 'ACT'
+  UseOSTimeZone: false
+  EDIModelLink.Destination Destination16
+  {
+    EDIMLTable Global_MappingCustomerGrade
+    {
+      PrimaryKeyColumns: BusinessType
+      PrimaryKeyColumns: Customer
+      PrimaryKeyColumns: CustomerGrade
+      TargetType: Global_MappingCustomerGrade
+      TypeIndex: Global_MappingCustomerGradeTypeIndex
+      EDIMLColumn BusinessType { Attribute: BusinessType ValueType: String }
+      EDIMLColumn Customer { Attribute: Customer ValueType: String }
+      EDIMLColumn CustomerGrade { Attribute: CustomerGrade ValueType: String }
+    }
+  }
+  EDIODBCLink.Source Source15
+  {
+    DataIntegrityStrategy: 'Disabled'
+    SettingsEngineLink: 'domainmodel.ediremotedatasourcedefinition.remotestorage.oracle'
+    EDIODBCLinkTable MID_CUSTOMERGRADE
+    {
+      OthersMayCreateTable: true
+      OthersMayDeleteRow: true
+      OthersMayDropTable: true
+      OthersMayFlushTable: true
+      OthersMayInsertRow: true
+      Parameters: '/owner="OTD"'
+      PrimaryKeyColumns: CUSTOMER
+      RecordModificationHintStrategy: 'None'
+      EDIODBCLinkColumn BUSINESSTYPE
+      {
+        OthersMayUpdateColumn: true
+        ValueType: String
+      }
+      EDIODBCLinkColumn CUSTOMER
+      {
+        OthersMayUpdateColumn: true
+        ValueType: String
+      }
+      EDIODBCLinkColumn CUSTOMERGRADE
+      {
+        OthersMayUpdateColumn: true
+        ValueType: String
+      }
+    }
+  }
+  EDITransformation.Transformation Transformation15
+  {
+    EDITableTransformation
+    {
+      InputTable: MID_CUSTOMERGRADE
+      OutputTable: Global_MappingCustomerGrade
+      EDIColumnMatch { InputColumn: BUSINESSTYPE OutputColumn: BusinessType }
+      EDIColumnMatch { InputColumn: CUSTOMER OutputColumn: Customer }
+      EDIColumnMatch { InputColumn: CUSTOMERGRADE OutputColumn: CustomerGrade }
+    }
+  }
+}
diff --git a/_Main/BL/EDI/Broker_GlobalOTDTable_DOI_DSI.qbl b/_Main/BL/EDI/Broker_GlobalOTDTable_DOI_DSI.qbl
new file mode 100644
index 0000000..4fcd29e
--- /dev/null
+++ b/_Main/BL/EDI/Broker_GlobalOTDTable_DOI_DSI.qbl
@@ -0,0 +1,71 @@
+Quintiq file version 2.0
+#parent: #root
+EDIBroker GlobalOTDTable_DOI_DSI
+{
+  MDSDefinition: GlobalOTDTable
+  TimeZone: 'ACT'
+  UseOSTimeZone: false
+  EDIModelLink.Destination Destination15
+  {
+    EDIMLTable Global_MappingDOI_DSI
+    {
+      PrimaryKeyColumns: OrganCode
+      PrimaryKeyColumns: ProductID
+      TargetType: Global_MappingDOI_DSI
+      TypeIndex: Global_MappingDOI_DSITypeIndex
+      EDIMLColumn DOI { Attribute: DOI ValueType: String }
+      EDIMLColumn DSI { Attribute: DSI ValueType: String }
+      EDIMLColumn OrganCode { Attribute: OrganCode ValueType: String }
+      EDIMLColumn ProductID { Attribute: ProductID ValueType: String }
+    }
+  }
+  EDIODBCLink.Source Source14
+  {
+    DataIntegrityStrategy: 'Disabled'
+    SettingsEngineLink: 'domainmodel.ediremotedatasourcedefinition.remotestorage.oracle'
+    EDIODBCLinkTable MID_DOI_DSI
+    {
+      OthersMayCreateTable: true
+      OthersMayDeleteRow: true
+      OthersMayDropTable: true
+      OthersMayFlushTable: true
+      OthersMayInsertRow: true
+      Parameters: '/owner="OTD"'
+      PrimaryKeyColumns: ORGANCODE
+      PrimaryKeyColumns: PRODUCTID
+      RecordModificationHintStrategy: 'None'
+      EDIODBCLinkColumn DOI
+      {
+        OthersMayUpdateColumn: true
+        ValueType: String
+      }
+      EDIODBCLinkColumn DSI
+      {
+        OthersMayUpdateColumn: true
+        ValueType: String
+      }
+      EDIODBCLinkColumn ORGANCODE
+      {
+        OthersMayUpdateColumn: true
+        ValueType: String
+      }
+      EDIODBCLinkColumn PRODUCTID
+      {
+        OthersMayUpdateColumn: true
+        ValueType: String
+      }
+    }
+  }
+  EDITransformation.Transformation Transformation14
+  {
+    EDITableTransformation
+    {
+      InputTable: MID_DOI_DSI
+      OutputTable: Global_MappingDOI_DSI
+      EDIColumnMatch { InputColumn: DOI OutputColumn: DOI }
+      EDIColumnMatch { InputColumn: DSI OutputColumn: DSI }
+      EDIColumnMatch { InputColumn: ORGANCODE OutputColumn: OrganCode }
+      EDIColumnMatch { InputColumn: PRODUCTID OutputColumn: ProductID }
+    }
+  }
+}
diff --git a/_Main/BL/InfoMessages.qbl b/_Main/BL/InfoMessages.qbl
index 952d7d5..aa2917b 100644
--- a/_Main/BL/InfoMessages.qbl
+++ b/_Main/BL/InfoMessages.qbl
@@ -10,4 +10,8 @@
   {
     DefaultText: 'Please input validate value !'
   }
-}
\ No newline at end of file
+  InfoMessage PriorityFactor_CheckNameValid
+  {
+    DefaultText: '璇ヤ紭鍏堢骇鍥犲瓙鍚嶇О宸插瓨鍦紒'
+  }
+}
diff --git a/_Main/BL/KnowledgeBaseDomain_MacroPlanner/KnowledgeBase_Knowledge_MP/_ROOT_KnowledgeBase_Knowledge_MP.qbl b/_Main/BL/KnowledgeBaseDomain_MacroPlanner/KnowledgeBase_Knowledge_MP/_ROOT_KnowledgeBase_Knowledge_MP.qbl
new file mode 100644
index 0000000..ea0a67e
--- /dev/null
+++ b/_Main/BL/KnowledgeBaseDomain_MacroPlanner/KnowledgeBase_Knowledge_MP/_ROOT_KnowledgeBase_Knowledge_MP.qbl
@@ -0,0 +1,6 @@
+Quintiq file version 2.0
+#root
+#parent: #root
+KnowledgeBase Knowledge_MP #extension
+{
+}
diff --git a/_Main/BL/Relations/Relation_CapacityAllocationResultsRuleConfiguration_CapacityAllocationResult.qbl b/_Main/BL/Relations/Relation_CapacityAllocationResultsRuleConfiguration_CapacityAllocationResult.qbl
new file mode 100644
index 0000000..744cd1a
--- /dev/null
+++ b/_Main/BL/Relations/Relation_CapacityAllocationResultsRuleConfiguration_CapacityAllocationResult.qbl
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#parent: #root
+Relation CapacityAllocationResultsRuleConfiguration_CapacityAllocationResults_CapacityAllocationResults_CapacityAllocationResultsRuleConfiguration
+{
+  #keys: '1[414702.0.387791788]'
+  DefaultRelationStrategy
+  {
+  }
+  RelationSide.LeftSide CapacityAllocationResults
+  {
+    #keys: '3[414702.0.387791790][414702.0.387791789][414702.0.387791791]'
+    Cardinality: '1toN'
+    ObjectDefinition: CapacityAllocationResultsRuleConfiguration
+    OwningSide: 'Reference'
+  }
+  RelationSide.RightSide CapacityAllocationResultsRuleConfiguration
+  {
+    #keys: '3[414702.0.387791793][414702.0.387791792][414702.0.387791794]'
+    Cardinality: '0to1'
+    ObjectDefinition: CapacityAllocationResults
+    OwningSide: 'Reference'
+  }
+}
diff --git a/_Main/BL/Relations/Relation_CapacityAllocationResultsRuleConfiguration_GlobalOTDTable_GlobalOTD.qbl b/_Main/BL/Relations/Relation_CapacityAllocationResultsRuleConfiguration_GlobalOTDTable_GlobalOTD.qbl
new file mode 100644
index 0000000..40be5f9
--- /dev/null
+++ b/_Main/BL/Relations/Relation_CapacityAllocationResultsRuleConfiguration_GlobalOTDTable_GlobalOTD.qbl
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#parent: #root
+Relation CapacityAllocationResultsRuleConfiguration_GlobalOTDTable_GlobalOTDTable_CapacityAllocationResultsRuleConfiguration
+{
+  #keys: '1[414702.0.374991408]'
+  DefaultRelationStrategy
+  {
+  }
+  RelationSide.LeftSide GlobalOTDTable
+  {
+    #keys: '3[414702.0.374991410][414702.0.374991409][414702.0.374991411]'
+    Cardinality: '0to1'
+    ObjectDefinition: CapacityAllocationResultsRuleConfiguration
+    OwningSide: 'Reference'
+  }
+  RelationSide.RightSide CapacityAllocationResultsRuleConfiguration
+  {
+    #keys: '3[414702.0.374991413][414702.0.374991412][414702.0.374991414]'
+    Cardinality: '1toN'
+    ObjectDefinition: GlobalOTDTable
+    OwningSide: 'Owned'
+  }
+}
diff --git a/_Main/BL/Relations/Relation_Global_MappingCustomerGrade_GlobalOTDTable_GlobalOTDTable_Global_Ma.qbl b/_Main/BL/Relations/Relation_Global_MappingCustomerGrade_GlobalOTDTable_GlobalOTDTable_Global_Ma.qbl
new file mode 100644
index 0000000..9f05865
--- /dev/null
+++ b/_Main/BL/Relations/Relation_Global_MappingCustomerGrade_GlobalOTDTable_GlobalOTDTable_Global_Ma.qbl
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#parent: #root
+Relation Global_MappingCustomerGrade_GlobalOTDTable_GlobalOTDTable_Global_MappingCustomerGrade
+{
+  #keys: '1[414702.0.445485678]'
+  DefaultRelationStrategy
+  {
+  }
+  RelationSide.LeftSide GlobalOTDTable
+  {
+    #keys: '3[414702.0.445485680][414702.0.445485679][414702.0.445485681]'
+    Cardinality: '0to1'
+    ObjectDefinition: Global_MappingCustomerGrade
+    OwningSide: 'Reference'
+  }
+  RelationSide.RightSide Global_MappingCustomerGrade
+  {
+    #keys: '3[414702.0.445485683][414702.0.445485682][414702.0.445485684]'
+    Cardinality: '1toN'
+    ObjectDefinition: GlobalOTDTable
+    OwningSide: 'Owned'
+  }
+}
diff --git a/_Main/BL/Relations/Relation_Global_MappingDOI_DSI_GlobalOTDTable_GlobalOTDTable_Global_MappingD.qbl b/_Main/BL/Relations/Relation_Global_MappingDOI_DSI_GlobalOTDTable_GlobalOTDTable_Global_MappingD.qbl
new file mode 100644
index 0000000..2020f2e
--- /dev/null
+++ b/_Main/BL/Relations/Relation_Global_MappingDOI_DSI_GlobalOTDTable_GlobalOTDTable_Global_MappingD.qbl
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#parent: #root
+Relation Global_MappingDOI_DSI_GlobalOTDTable_GlobalOTDTable_Global_MappingDOI_DSI
+{
+  #keys: '1[414702.0.445364657]'
+  DefaultRelationStrategy
+  {
+  }
+  RelationSide.LeftSide GlobalOTDTable
+  {
+    #keys: '3[414702.0.445364659][414702.0.445364658][414702.0.445364660]'
+    Cardinality: '0to1'
+    ObjectDefinition: Global_MappingDOI_DSI
+    OwningSide: 'Reference'
+  }
+  RelationSide.RightSide Global_MappingDOI_DSI
+  {
+    #keys: '3[414702.0.445364662][414702.0.445364661][414702.0.445364663]'
+    Cardinality: '1toN'
+    ObjectDefinition: GlobalOTDTable
+    OwningSide: 'Owned'
+  }
+}
diff --git a/_Main/BL/Relations/Relation_H_CustomOrder_MacroPlan_MacroPlan_H_CustomOrder.qbl b/_Main/BL/Relations/Relation_H_CustomOrder_MacroPlan_MacroPlan_H_CustomOrder.qbl
new file mode 100644
index 0000000..6a5b131
--- /dev/null
+++ b/_Main/BL/Relations/Relation_H_CustomOrder_MacroPlan_MacroPlan_H_CustomOrder.qbl
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#parent: #root
+Relation H_CustomOrder_MacroPlan_MacroPlan_H_CustomOrder
+{
+  #keys: '1[414724.0.177854649]'
+  DefaultRelationStrategy
+  {
+  }
+  RelationSide.LeftSide MacroPlan
+  {
+    #keys: '3[414724.0.177854651][414724.0.177854650][414724.0.177854652]'
+    Cardinality: '0to1'
+    ObjectDefinition: H_CustomOrder
+    OwningSide: 'Reference'
+  }
+  RelationSide.RightSide H_CustomOrder
+  {
+    #keys: '3[414724.0.177854654][414724.0.177854653][414724.0.177854655]'
+    Cardinality: '1toN'
+    ObjectDefinition: MacroPlan
+    OwningSide: 'Owned'
+  }
+}
diff --git a/_Main/BL/Type_BusinessType/StaticMethod_CreateData.qbl b/_Main/BL/Type_BusinessType/StaticMethod_CreateData.qbl
index 0606111..f82bfcb 100644
--- a/_Main/BL/Type_BusinessType/StaticMethod_CreateData.qbl
+++ b/_Main/BL/Type_BusinessType/StaticMethod_CreateData.qbl
@@ -2,6 +2,7 @@
 #parent: #root
 StaticMethod CreateData (
   GlobalOTDTable owner,
+  MacroPlan macroPlan,
   String businessName
 )
 {
diff --git a/_Main/BL/Type_BusinessType/StaticMethod_GetBusinessNameStr.qbl b/_Main/BL/Type_BusinessType/StaticMethod_GetBusinessNameStr.qbl
index eb62f70..22f2d2e 100644
--- a/_Main/BL/Type_BusinessType/StaticMethod_GetBusinessNameStr.qbl
+++ b/_Main/BL/Type_BusinessType/StaticMethod_GetBusinessNameStr.qbl
@@ -25,7 +25,7 @@
     }
     
     // 娴嬭瘯鏁版嵁
-    result := "闆嗗洟闈㈡澘;涓撲笟鏄剧ず浜嬩笟閮�;澶栧崠CELL;闈炴樉;杩愬姩鍋ュ悍;杩愬姩鍋ュ悍浜嬩笟閮�;鎵嬫満浜嬩笟閮�;鐗圭鏄剧ず;姹借溅鐢靛瓙浜嬩笟閮�;杞﹁浇鏄剧ず浜嬩笟閮�;IT浜嬩笟閮�";
+    //result := "闆嗗洟闈㈡澘;涓撲笟鏄剧ず浜嬩笟閮�;澶栧崠CELL;闈炴樉;杩愬姩鍋ュ悍;杩愬姩鍋ュ悍浜嬩笟閮�;鎵嬫満浜嬩笟閮�;鐗圭鏄剧ず;姹借溅鐢靛瓙浜嬩笟閮�;杞﹁浇鏄剧ず浜嬩笟閮�;IT浜嬩笟閮�";
     
     return result;
   *]
diff --git a/_Main/BL/Type_CapacityAllocationResults/Attribute_Date.qbl b/_Main/BL/Type_CapacityAllocationResults/Attribute_Date.qbl
new file mode 100644
index 0000000..a158e2b
--- /dev/null
+++ b/_Main/BL/Type_CapacityAllocationResults/Attribute_Date.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute Date
+{
+  #keys: '3[414702.0.388471426][414702.0.388471425][414702.0.388471427]'
+  ValueType: Date
+}
diff --git a/_Main/BL/Type_CapacityAllocationResults/Attribute_Description.qbl b/_Main/BL/Type_CapacityAllocationResults/Attribute_Description.qbl
new file mode 100644
index 0000000..4d7f093
--- /dev/null
+++ b/_Main/BL/Type_CapacityAllocationResults/Attribute_Description.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute Description
+{
+  #keys: '3[414702.0.388471436][414702.0.388471435][414702.0.388471437]'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_CapacityAllocationResults/Attribute_ID.qbl b/_Main/BL/Type_CapacityAllocationResults/Attribute_ID.qbl
new file mode 100644
index 0000000..3a52d76
--- /dev/null
+++ b/_Main/BL/Type_CapacityAllocationResults/Attribute_ID.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute ID
+{
+  #keys: '3[414702.0.388471446][414702.0.388471445][414702.0.388471447]'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_CapacityAllocationResults/Attribute_ManufacturedDate.qbl b/_Main/BL/Type_CapacityAllocationResults/Attribute_ManufacturedDate.qbl
new file mode 100644
index 0000000..15ee01f
--- /dev/null
+++ b/_Main/BL/Type_CapacityAllocationResults/Attribute_ManufacturedDate.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute ManufacturedDate
+{
+  #keys: '3[414702.0.388471486][414702.0.388471485][414702.0.388471487]'
+  ValueType: Date
+}
diff --git a/_Main/BL/Type_CapacityAllocationResults/Attribute_ProductID.qbl b/_Main/BL/Type_CapacityAllocationResults/Attribute_ProductID.qbl
new file mode 100644
index 0000000..ca7c6e4
--- /dev/null
+++ b/_Main/BL/Type_CapacityAllocationResults/Attribute_ProductID.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute ProductID
+{
+  #keys: '3[414702.0.388471456][414702.0.388471455][414702.0.388471457]'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_CapacityAllocationResults/Attribute_StockingPointID.qbl b/_Main/BL/Type_CapacityAllocationResults/Attribute_StockingPointID.qbl
new file mode 100644
index 0000000..2a28f0d
--- /dev/null
+++ b/_Main/BL/Type_CapacityAllocationResults/Attribute_StockingPointID.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute StockingPointID
+{
+  #keys: '3[414702.0.388471466][414702.0.388471465][414702.0.388471467]'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_CapacityAllocationResults/Attribute_UserQuantity.qbl b/_Main/BL/Type_CapacityAllocationResults/Attribute_UserQuantity.qbl
new file mode 100644
index 0000000..9c3d31c
--- /dev/null
+++ b/_Main/BL/Type_CapacityAllocationResults/Attribute_UserQuantity.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute UserQuantity
+{
+  #keys: '3[414702.0.388471476][414702.0.388471475][414702.0.388471477]'
+  ValueType: Real
+}
diff --git a/_Main/BL/Type_CapacityAllocationResults/DeclarativeReferenceRelation_CalcCapacityAllocationResultsRuleConfiguration.qbl b/_Main/BL/Type_CapacityAllocationResults/DeclarativeReferenceRelation_CalcCapacityAllocationResultsRuleConfiguration.qbl
new file mode 100644
index 0000000..59c9af0
--- /dev/null
+++ b/_Main/BL/Type_CapacityAllocationResults/DeclarativeReferenceRelation_CalcCapacityAllocationResultsRuleConfiguration.qbl
@@ -0,0 +1,15 @@
+Quintiq file version 2.0
+#parent: #root
+DeclarativeReferenceRelation CalcCapacityAllocationResultsRuleConfiguration
+{
+  #keys: '1[414702.0.388304510]'
+  Expression:
+  [*
+    targetCapacityAllocationResultsRuleConfiguration := select( this.GlobalOTDTable(), CapacityAllocationResultsRuleConfiguration, tempCARRC, 
+                                                                tempCARRC.ModuleMaterialCode() = this.ModuleMaterialCode() and
+                                                                tempCARRC.PanelMaterialCode() = this.PanelMaterialCode() );
+    
+    return targetCapacityAllocationResultsRuleConfiguration;
+  *]
+  Relation: CapacityAllocationResultsRuleConfiguration
+}
diff --git a/_Main/BL/Type_CapacityAllocationResults/StaticMethod_CreateDate.qbl b/_Main/BL/Type_CapacityAllocationResults/StaticMethod_CreateDate.qbl
index ef9782f..2340157 100644
--- a/_Main/BL/Type_CapacityAllocationResults/StaticMethod_CreateDate.qbl
+++ b/_Main/BL/Type_CapacityAllocationResults/StaticMethod_CreateDate.qbl
@@ -2,27 +2,32 @@
 #parent: #root
 StaticMethod CreateDate (
   GlobalOTDTable globalOTDTable,
-  MacroPlan macroPlan
+  MacroPlan macroPlan,
+  Scenario scenario
 )
 {
   TextBody:
   [*
     globalOTDTable.CapacityAllocationResults( relflush );
     
-    finaleProduct_MPs := CapacityAllocationResults::ObtainTheFinalOutputProduct( macroPlan );
+    finaleProductInStockingPoint_MPs := CapacityAllocationResults::ObtainTheFinalOutputProduct( macroPlan, globalOTDTable );
     
     period_MPS := null( Period_MPs );
     traverse ( macroPlan, PeriodSpecification_MP, psmp, psmp.ID() = "Planning periods" ) {
       period_MPS := selectsortedset( psmp, PeriodSpecificationPeriod.Period_MP, pmp, not pmp.IsHistorical(), pmp.StartDate() );
     }
     
-    traverse ( finaleProduct_MPs, Elements, fpmp/*, fpmp.ID() = "ProXOver 1 D2.6 A"*/ ) {
-      traverse ( fpmp, ProductInStockingPoint_MP, pisp, /*pisp.Name() = "ProXOver 1 D2.6 A in Finished Cars (France)" and*/ not pisp.IsSystem() ) {
-        traverse ( period_MPS, Elements, pmp ) {     
-          CapacityAllocationResults::IterativeGeneration( globalOTDTable, pisp, 1, null( NewSupply ), -1.0, pmp.StartDate() );
-        }
-    //    info( pisp.Name() );
+    traverse ( finaleProductInStockingPoint_MPs, Elements, fpispmp ) {
+      capacityAllocationResultsRuleConfigurations := selectset( globalOTDTable, CapacityAllocationResultsRuleConfiguration, tempCARRC, tempCARRC.ModuleMaterialCode() = fpispmp.ProductID() and tempCARRC.StockingPointID() = fpispmp.StockingPointID() );
+    //  info( "鐢熶骇鐨勪骇鍝侊細", fpispmp.ProductID(), "------浜у搧鍦ㄥ簱瀛樼偣-------锛�", fpispmp.StockingPointID() );
+      traverse ( period_MPS, Elements, pmp ) {     
+        // CapacityAllocationResults::IterativeGeneration( globalOTDTable, pisp, 1, null( NewSupply ), -1.0, pmp.StartDate() ); 鑰佺増
+        CapacityAllocationResults::IterativeGeneration2( globalOTDTable, fpispmp, pmp.StartDate(), capacityAllocationResultsRuleConfigurations, 0, null( NewSupply ), 0.0 );
       }
     }
+    
+    traverse ( globalOTDTable, CapacityAllocationResults, car ) {
+      car.VersionNumber( scenario.Name() );
+    }
   *]
 }
diff --git a/_Main/BL/Type_CapacityAllocationResults/StaticMethod_Export.qbl b/_Main/BL/Type_CapacityAllocationResults/StaticMethod_Export.qbl
new file mode 100644
index 0000000..14045dd
--- /dev/null
+++ b/_Main/BL/Type_CapacityAllocationResults/StaticMethod_Export.qbl
@@ -0,0 +1,13 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod Export (
+  GlobalOTDTable globalOTDTable
+) as BinaryValue
+{
+  TextBody:
+  [*
+    binaryData := globalOTDTable.GlobalOTDTable_CAR_Export().ExecuteToXLS( true );
+    
+    return binaryData.AsBinaryValue();
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAllocationResults/StaticMethod_IterativeGeneration2.qbl b/_Main/BL/Type_CapacityAllocationResults/StaticMethod_IterativeGeneration2.qbl
new file mode 100644
index 0000000..b327f63
--- /dev/null
+++ b/_Main/BL/Type_CapacityAllocationResults/StaticMethod_IterativeGeneration2.qbl
@@ -0,0 +1,97 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod IterativeGeneration2 (
+  GlobalOTDTable globalOTDTable,
+  ProductInStockingPoint_MP pisp,
+  Date targetDate,
+  CapacityAllocationResultsRuleConfigurations carrcs,
+  Number numberOfLayers,
+  NewSupply firstLevelSupply,
+  Real currentLayerDependentDemandQuantity
+)
+{
+  TextBody:
+  [*
+    numberOfLayers++;
+    //info( "鐩爣鏃堕棿锛�", targetDate.Format( "Y-M2-D2" ) );
+    info( pisp.Name() );
+    traverse ( pisp, ProductInStockingPointInPeriodPlanning.astype( ProductInStockingPointInPeriodPlanningLeaf ), pispippl, pispippl.Start().Date() = targetDate ) {
+      traverse ( pispippl, NewSupply, ns, ns.Quantity() > 0 ) {
+        if ( numberOfLayers = 1 ) {
+          firstLevelSupply := ns;
+        }
+        
+        ontype( ns.PeriodTask_MP() ) {
+          PeriodTaskOperation as pto : {
+    //        info( "Operation鍛ㄦ湡浠诲姟..." );     
+            traverse ( ns, PeriodTask_MP.astype( PeriodTaskOperation ).DependentDemand, dd ) {
+              if ( numberOfLayers = 1 ) {
+                currentLayerDependentDemandQuantity := ns.Quantity();
+              }
+              currentLayerDependentDemandQuantity := currentLayerDependentDemandQuantity                     * 
+                                                     ns.ProcessOutput().astype( OperationOutput ).Quantity() *
+                                                     dd.ProcessInput().astype( OperationInput ).Quantity();
+    //          info( "灞傛暟锛�", numberOfLayers, "    褰撳墠渚涘簲鐨刾isp锛�", ns.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().Name(), "    鎬讳緵搴斿�硷細", ns.Quantity(), "    闇�瑕佷緵搴斿�硷細", currentLayerDependentDemandQuantity,
+    //                "    褰撳墠闇�姹俻isp锛�", dd.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().Name(), "    闇�姹傚�硷細", currentLayerDependentDemandQuantity );
+    //          info( "-----------------------------------------------------------------------------------------------------------------" );
+              CapacityAllocationResults::IterativeGeneration2( globalOTDTable,
+                                                               dd.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP(),
+                                                               targetDate,
+                                                               carrcs,
+                                                               numberOfLayers,
+                                                               firstLevelSupply,
+                                                               currentLayerDependentDemandQuantity
+                                                              );
+            }
+            carrc := select( carrcs, Elements, carrc, carrc.PanelMaterialCode() = ns.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().ProductID() );
+            if ( not isnull( carrc ) ) {
+    //          info( "鎵惧埌闈㈡澘鐗╂枡..." );
+              globalOTDTable.CapacityAllocationResults( relnew,
+                                                        PanelBase             := pto.Operation().UnitID(),
+                                                        PanelMaterialCode     := ns.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().ProductID(),
+                                                        NumberOfPanels        := currentLayerDependentDemandQuantity,
+                                                        PanelMeasurementUnit  := ns.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().UnitOfMeasureName(),
+                                                        ModuleMaterialCode    := firstLevelSupply.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().ProductID(),
+                                                        NumberOfModules       := firstLevelSupply.Quantity(),
+                                                        ModuleMeasurementUnit := firstLevelSupply.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().UnitOfMeasureName(),
+                                                        ModuleBase            := guard( firstLevelSupply.PeriodTask_MP().astype( PeriodTaskOperation ).Operation().UnitID(), "杞﹂亾杩愯緭" ),
+                                                        Division              := carrc.Division(),
+                                                        RequirementDate       := ns.Start().Date(),
+                                                        Date                  := ns.Start().Date(),
+                                                        Description           := "",
+                                                        ID                    := OS::GenerateGUIDAsString(),
+                                                        ProductID             := ns.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().ProductID(),
+                                                        StockingPointID       := ns.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().StockingPointID(),
+                                                        UserQuantity          := currentLayerDependentDemandQuantity,
+                                                        ManufacturedDate      := Date::MinDate()
+                                                       );
+                                                        
+            }
+            info( "-----------------------------------------------------------------------------------------------------------------" );
+          }
+          
+          PeriodTaskLaneLeg as ptll : {
+            targetDependentDemand := select( ptll, DependentDemand, dd, dd.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().ProductID() = ns.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().ProductID() );
+            currentLayerDependentDemandQuantity := ifexpr( numberOfLayers = 1, targetDependentDemand.Quantity(), currentLayerDependentDemandQuantity );
+    //        info( "灞傛暟锛�", numberOfLayers,"    褰撳墠渚涘簲鐨刾isp锛�", ns.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().Name(), "    鎬讳緵搴斿�硷細", ns.Quantity(), "    闇�瑕佷緵搴斿�硷細", currentLayerDependentDemandQuantity,
+    //              "    褰撳墠闇�姹俻isp锛�", targetDependentDemand.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().Name(), "    闇�姹傚�硷細", currentLayerDependentDemandQuantity );
+    //        info( "LaneLeg鍛ㄦ湡浠诲姟..." );
+            info( "-----------------------------------------------------------------------------------------------------------------" );
+            CapacityAllocationResults::IterativeGeneration2( globalOTDTable,
+                                                             targetDependentDemand.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP(),
+                                                             targetDate,
+                                                             carrcs,
+                                                             numberOfLayers,
+                                                             firstLevelSupply,
+                                                             currentLayerDependentDemandQuantity
+                                                            );
+          }
+        }
+        
+        if ( numberOfLayers = 1 ) {
+          firstLevelSupply := null( NewSupply );
+        }
+      }
+    }
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAllocationResults/StaticMethod_ObtainTheFinalOutputProduct.qbl b/_Main/BL/Type_CapacityAllocationResults/StaticMethod_ObtainTheFinalOutputProduct.qbl
index 0db5a04..6501563 100644
--- a/_Main/BL/Type_CapacityAllocationResults/StaticMethod_ObtainTheFinalOutputProduct.qbl
+++ b/_Main/BL/Type_CapacityAllocationResults/StaticMethod_ObtainTheFinalOutputProduct.qbl
@@ -1,25 +1,30 @@
 Quintiq file version 2.0
 #parent: #root
 StaticMethod ObtainTheFinalOutputProduct (
-  MacroPlan macroPlan
-) as owning Product_MPs
+  MacroPlan macroPlan,
+  GlobalOTDTable globalOTDTable
+) as owning ProductInStockingPoint_MPs
 {
   TextBody:
   [*
-    finaleProducts := construct( Product_MPs );
+    //finaleProducts := construct( Product_MPs );
+    //
+    //traverse ( macroPlan, Product_MP, pmp, pmp.IsLeaf() ) {
+    //  flag := true;
+    //  traverse ( macroPlan, Routing.RoutingStep.Operation.OperationInput, oi, flag ) {
+    //    if ( pmp = oi.ProductInStockingPoint_MP().Product_MP() ) {
+    //      flag := false;
+    //    }
+    //  }
+    //  if ( flag ) {
+    //    finaleProducts.Add( pmp );
+    //  }
+    //}
     
-    traverse ( macroPlan, Product_MP, pmp, pmp.IsLeaf() ) {
-      flag := true;
-      traverse ( macroPlan, Routing.RoutingStep.Operation.OperationInput, oi, flag ) {
-        if ( pmp = oi.ProductInStockingPoint_MP().Product_MP() ) {
-          flag := false;
-        }
-      }
-      if ( flag ) {
-        finaleProducts.Add( pmp );
-      }
-    }
+    finaleProductInStockingPoint_MPs := selectset( macroPlan, Product_MP.ProductInStockingPoint_MP, tempPISPMP, 
+                                                   exists( globalOTDTable, CapacityAllocationResultsRuleConfiguration, tempCARRC, tempCARRC.ModuleMaterialCode() = tempPISPMP.ProductID() and tempCARRC.StockingPointID() = tempPISPMP.StockingPointID() )
+                                                  );
     
-    return &finaleProducts;
+    return &finaleProductInStockingPoint_MPs;
   *]
 }
diff --git a/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/Attribute_Division.qbl b/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/Attribute_Division.qbl
new file mode 100644
index 0000000..2b0b5c3
--- /dev/null
+++ b/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/Attribute_Division.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute Division
+{
+  #keys: '3[414702.0.374991447][414702.0.374991446][414702.0.374991448]'
+  Description: '浜嬩笟閮�'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/Attribute_ModuleMaterialCode.qbl b/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/Attribute_ModuleMaterialCode.qbl
new file mode 100644
index 0000000..ca60799
--- /dev/null
+++ b/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/Attribute_ModuleMaterialCode.qbl
@@ -0,0 +1,9 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute ModuleMaterialCode
+{
+  #keys: '3[414702.0.374991437][414702.0.374991436][414702.0.374991438]'
+  Description: '妯$粍鐗╂枡缂栫爜'
+  IsReadOnly: true
+  ValueType: String
+}
diff --git a/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/Attribute_PanelMaterialCode.qbl b/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/Attribute_PanelMaterialCode.qbl
new file mode 100644
index 0000000..02037a2
--- /dev/null
+++ b/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/Attribute_PanelMaterialCode.qbl
@@ -0,0 +1,9 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute PanelMaterialCode
+{
+  #keys: '3[414702.0.374991427][414702.0.374991426][414702.0.374991428]'
+  Description: '闈㈡澘鐗╂枡缂栫爜'
+  IsReadOnly: true
+  ValueType: String
+}
diff --git a/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/Attribute_StockingPointID.qbl b/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/Attribute_StockingPointID.qbl
new file mode 100644
index 0000000..fb82a94
--- /dev/null
+++ b/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/Attribute_StockingPointID.qbl
@@ -0,0 +1,9 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute StockingPointID
+{
+  #keys: '3[414702.0.375010145][414702.0.375010144][414702.0.375010146]'
+  Description: '妯$粍浜ф垚鍝佸簱瀛樼偣ID'
+  IsReadOnly: true
+  ValueType: String
+}
diff --git a/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/StaticMethod_Export.qbl b/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/StaticMethod_Export.qbl
new file mode 100644
index 0000000..4397413
--- /dev/null
+++ b/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/StaticMethod_Export.qbl
@@ -0,0 +1,14 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod Export (
+  GlobalOTDTable globalOTDTable
+) as BinaryValue
+{
+  TextBody:
+  [*
+    // hongjli Sep-25-2023 (created)
+    binaryValue := globalOTDTable.GlobalOTDTable_CARRC_Export().ExecuteToXLS( true ).AsBinaryValue();
+    
+    return binaryValue;
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/StaticMethod_Import.qbl b/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/StaticMethod_Import.qbl
new file mode 100644
index 0000000..a4eddc6
--- /dev/null
+++ b/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/StaticMethod_Import.qbl
@@ -0,0 +1,14 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod Import (
+  GlobalOTDTable globalOTDTable,
+  String base64String
+)
+{
+  TextBody:
+  [*
+    binaryData := BinaryData::FromBase64EncodedString( base64String );
+    
+    globalOTDTable.GlobalOTDTable_CARRC_Import().ExecuteFromXLS( &binaryData, true );
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/TypeIndex_CapacityAllocationResultsRuleConfigurationTypeIndex.qbl b/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/TypeIndex_CapacityAllocationResultsRuleConfigurationTypeIndex.qbl
new file mode 100644
index 0000000..ea74562
--- /dev/null
+++ b/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/TypeIndex_CapacityAllocationResultsRuleConfigurationTypeIndex.qbl
@@ -0,0 +1,20 @@
+Quintiq file version 2.0
+#parent: #root
+TypeIndex CapacityAllocationResultsRuleConfigurationTypeIndex
+{
+  Attributes:
+  [
+    TypeIndexAttribute
+    {
+      ModelElement: ModuleMaterialCode
+    }
+    TypeIndexAttribute
+    {
+      ModelElement: PanelMaterialCode
+    }
+    TypeIndexAttribute
+    {
+      ModelElement: StockingPointID
+    }
+  ]
+}
diff --git a/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/_ROOT_Type_CapacityAllocationResultsRuleConfiguration.qbl b/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/_ROOT_Type_CapacityAllocationResultsRuleConfiguration.qbl
new file mode 100644
index 0000000..7e012c9
--- /dev/null
+++ b/_Main/BL/Type_CapacityAllocationResultsRuleConfiguration/_ROOT_Type_CapacityAllocationResultsRuleConfiguration.qbl
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+#root
+#parent: #DomainModel
+Type CapacityAllocationResultsRuleConfiguration
+{
+  #keys: '5[414702.0.374991403][414702.0.374991401][0.0.0][414702.0.374991402][414702.0.374991404]'
+  BaseType: Object
+  Description: '浜ц兘鍒嗛厤缁撴灉锛岃鍒欓厤缃�'
+  StructuredName: 'CapacityAllocationResultsRuleConfigurations'
+}
diff --git a/_Main/BL/Type_CustomerAndForecastOrder/Attribute_CustomerOrderID.qbl b/_Main/BL/Type_CustomerAndForecastOrder/Attribute_CustomerOrderID.qbl
new file mode 100644
index 0000000..19d7605
--- /dev/null
+++ b/_Main/BL/Type_CustomerAndForecastOrder/Attribute_CustomerOrderID.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute CustomerOrderID
+{
+  #keys: '3[414382.0.554303146][414382.0.554303145][414382.0.554303147]'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_CustomerAndForecastOrder/Attribute_ForecastID.qbl b/_Main/BL/Type_CustomerAndForecastOrder/Attribute_ForecastID.qbl
new file mode 100644
index 0000000..d3d12e5
--- /dev/null
+++ b/_Main/BL/Type_CustomerAndForecastOrder/Attribute_ForecastID.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute ForecastID
+{
+  #keys: '3[414382.0.554303156][414382.0.554303155][414382.0.554303157]'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_CustomerAndForecastOrder/StaticMethod_RefreshData.qbl b/_Main/BL/Type_CustomerAndForecastOrder/StaticMethod_RefreshData.qbl
new file mode 100644
index 0000000..f3c1564
--- /dev/null
+++ b/_Main/BL/Type_CustomerAndForecastOrder/StaticMethod_RefreshData.qbl
@@ -0,0 +1,46 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod RefreshData (
+  MacroPlan owner,
+  GlobalOTDTable globalOTDTable
+)
+{
+  TextBody:
+  [*
+    // NBoTk Sep-26-2023 (created)
+    
+    // 鑾峰彇宸茬粡瀛樺湪 customerOrderID 鍜宖orecastID
+    customerOrderIDs := selectvalues( owner,CustomerAndForecastOrder,c,
+                                      c.CustomerOrderID() <> '',
+                                      c.CustomerID()
+                                      );
+    
+    forecastIDs := selectvalues( owner,CustomerAndForecastOrder,c,
+                                      c.ForecastID() <> '',
+                                      c.ForecastID()
+                                      );
+    
+    
+    // 浠庢暟鎹箹 Global_MappingCustomerOrder Global_MappingForecast 涓幏鍙栨柊鐨勮鍗曟暟鎹�
+    
+    traverse( globalOTDTable,Global_MappingCustomOrder,cus)
+    {
+        if(customerOrderIDs.Find( cus.ID()) = -1 )
+        {
+             owner.CustomerAndForecastOrder(relnew,OrderID := cus.OrderID(),ProductID := cus.ProductID(),BusinessType := cus.BusinessType(),Customer := cus.Customer(),CustomerID := cus.CustomerID(),
+                                    Quantity := cus.Quantity(),UnitOfMeasureName := cus.UnitOfMeasureName(),DemandDate := cus.OrderDate()
+                                    );
+        }    
+    }
+    
+    traverse( globalOTDTable,Global_MappingForecast,forecast)
+    {
+        if(forecastIDs.Find( forecast.ID()) = -1 )
+        {
+             owner.CustomerAndForecastOrder(relnew,ProductID := forecast.ProductID(),BusinessType := forecast.BusinessType(),
+                                    Quantity := forecast.Quantity(),UnitOfMeasureName := forecast.UnitOfMeasureName(),DemandDate := forecast.EndDate()
+                                    );
+        }    
+    }
+  *]
+}
diff --git a/_Main/BL/Type_CustomerOrder/Attribute_BusinessType.qbl b/_Main/BL/Type_CustomerOrder/Attribute_BusinessType.qbl
new file mode 100644
index 0000000..a39b026
--- /dev/null
+++ b/_Main/BL/Type_CustomerOrder/Attribute_BusinessType.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute BusinessType
+{
+  #keys: '3[414382.0.554303217][414382.0.554303216][414382.0.554303218]'
+  Description: '浜嬩笟閮�'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_CustomerOrder/Attribute_CustomerPolicy.qbl b/_Main/BL/Type_CustomerOrder/Attribute_CustomerPolicy.qbl
new file mode 100644
index 0000000..6647d7a
--- /dev/null
+++ b/_Main/BL/Type_CustomerOrder/Attribute_CustomerPolicy.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute CustomerPolicy
+{
+  #keys: '3[414382.0.554014841][414382.0.554014840][414382.0.554014842]'
+  Description: '瀹㈡埛绛栫暐'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_CustomerOrder/Attribute_IsAvailable.qbl b/_Main/BL/Type_CustomerOrder/Attribute_IsAvailable.qbl
new file mode 100644
index 0000000..1a6ca55
--- /dev/null
+++ b/_Main/BL/Type_CustomerOrder/Attribute_IsAvailable.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute IsAvailable
+{
+  #keys: '3[414382.0.554303237][414382.0.554303236][414382.0.554303238]'
+  Description: '璁㈠崟鏄惁鍙備笌璁″垝'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_CustomerOrder/Attribute_OrderTag.qbl b/_Main/BL/Type_CustomerOrder/Attribute_OrderTag.qbl
new file mode 100644
index 0000000..4d3e7e6
--- /dev/null
+++ b/_Main/BL/Type_CustomerOrder/Attribute_OrderTag.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute OrderTag
+{
+  #keys: '3[414724.0.177854629][414724.0.177854628][414724.0.177854630]'
+  Description: '璁㈠崟鐘舵�侊紝鍐插噺鍚庤祴鍊硷紝绾娴�,鏈夐娴嬶紝鏃犻娴嬶紝鍙嶇锛屾巿鏉�'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_CustomerOrder/Attribute_OrderTime.qbl b/_Main/BL/Type_CustomerOrder/Attribute_OrderTime.qbl
new file mode 100644
index 0000000..e89a41d
--- /dev/null
+++ b/_Main/BL/Type_CustomerOrder/Attribute_OrderTime.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute OrderTime
+{
+  #keys: '3[414382.0.554303277][414382.0.554303276][414382.0.554303278]'
+  Description: '璁㈠崟涓嬪崟鏃堕棿'
+  ValueType: Date
+}
diff --git a/_Main/BL/Type_CustomerOrder/Attribute_OrderType.qbl b/_Main/BL/Type_CustomerOrder/Attribute_OrderType.qbl
new file mode 100644
index 0000000..4efd905
--- /dev/null
+++ b/_Main/BL/Type_CustomerOrder/Attribute_OrderType.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute OrderType
+{
+  #keys: '3[414382.0.554303227][414382.0.554303226][414382.0.554303228]'
+  Description: '璁㈠崟绫诲瀷'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_CustomerOrder/Attribute_ProductGrade.qbl b/_Main/BL/Type_CustomerOrder/Attribute_ProductGrade.qbl
new file mode 100644
index 0000000..76e256b
--- /dev/null
+++ b/_Main/BL/Type_CustomerOrder/Attribute_ProductGrade.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute ProductGrade
+{
+  #keys: '3[414382.0.554303247][414382.0.554303246][414382.0.554303248]'
+  Description: '浜у搧绛夌骇'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_CustomerOrder/Attribute_SegmentPriority.qbl b/_Main/BL/Type_CustomerOrder/Attribute_SegmentPriority.qbl
new file mode 100644
index 0000000..6f488d6
--- /dev/null
+++ b/_Main/BL/Type_CustomerOrder/Attribute_SegmentPriority.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute SegmentPriority
+{
+  #keys: '3[414382.0.554303257][414382.0.554303256][414382.0.554303258]'
+  Description: '缁嗗垎甯傚満浼樺厛绾�'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_CustomerOrder/Attribute_SheetProfitability.qbl b/_Main/BL/Type_CustomerOrder/Attribute_SheetProfitability.qbl
new file mode 100644
index 0000000..726b8ab
--- /dev/null
+++ b/_Main/BL/Type_CustomerOrder/Attribute_SheetProfitability.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute SheetProfitability
+{
+  #keys: '3[414382.0.554303267][414382.0.554303266][414382.0.554303268]'
+  Description: '澶у紶鐩堝埄姘村钩'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_FilllingCapacityOrderScheme/StaticMethod_CreateFillingCapacityOrderScheme.qbl b/_Main/BL/Type_FilllingCapacityOrderScheme/StaticMethod_CreateFillingCapacityOrderScheme.qbl
index 15c7113..3f0ea88 100644
--- a/_Main/BL/Type_FilllingCapacityOrderScheme/StaticMethod_CreateFillingCapacityOrderScheme.qbl
+++ b/_Main/BL/Type_FilllingCapacityOrderScheme/StaticMethod_CreateFillingCapacityOrderScheme.qbl
@@ -8,7 +8,7 @@
   TextBody:
   [*
     // NBoTk Sep-14-2023 (created)
-    
+    info('test' )
     fillingCapacityOrders := selectset( owner,FillingCapacityOrder,fillingOrder,
                                         not fillingOrder.IsFilling()
                                         );
@@ -34,8 +34,7 @@
     salesSegmentName := salesSegmentNameList.Concatenate( ",")
     
     schemeDate := Date::Today();
-    
-    filllingCapacityOrderScheme := owner.FilllingCapacityOrderScheme(relnew,SchemeName := schemeName,SchemeDate := schemeDate,BusinessType := businessType,Customer := customer,CustomerID := customerID,
+    owner.FilllingCapacityOrderScheme(relnew,SchemeName := schemeName,SchemeDate := schemeDate,BusinessType := businessType,Customer := customer,CustomerID := customerID,
                                                                       SalesSegmentName := salesSegmentName);
     
     
@@ -43,27 +42,35 @@
     {
       e.SchemeName(schemeName);
       e.IsFilling(true);
-      filllingCapacityOrderScheme.FillingCapacityOrder(relinsert, e);
     }
-    
-    // 鐗堟湰鍙�
-    verNoOrder := select( filllingCapacityOrderScheme,FillingCapacityOrder,o,
-                                 o.VerNo() <> ''
-                                 )
     
     // 闇�瑕佸皢閿�鍞鍗曞拰棰勫敭璁㈠崟鍚屾椂淇濆瓨鍒版柟妗堜腑
-    traverse( owner,CustomerAndForecastOrder,order)
-    {
-      
-         fillingOrder := owner.FillingCapacityOrder(relnew,BusinessType := order.BusinessType(),Customer := order.Customer(),CustomerID := order.CustomerID(),
-                                                                           DemandDate := order.DemandDate(),ForecastDemandDate := order.ForecastDemandDate(),IsFilling := true,
-                                                                           OrderType := '鎻愭媺',PanelBigSheetQuantity := order.PanelBigSheetQuantity(),ProductID := order.ProductID(),
-                                                                           Quantity := order.Quantity(),SalesSegmentName := order.SalesSegmentName(),SalesAmount := order.SalesAmount(),
-                                                                           SchemeName := schemeName,StockingPointID := order.StockingPointID(),UnitOfMeasureName := order.UnitOfMeasureName(),
-                                                                           VerNo := verNoOrder.VerNo()
-                                                                           );
-                                                                           
-        filllingCapacityOrderScheme.FillingCapacityOrder(relinsert, fillingOrder);
-    }
+    //traverse( owner,CustomerAndForecastOrder,order)
+    //{
+    //  
+    //     fillingOrder := owner.FillingCapacityOrder(relnew,BusinessType := order.BusinessType(),Customer := order.Customer(),CustomerID := order.CustomerID(),
+    //                                                                       DemandDate := order.DemandDate(),ForecastDemandDate := order.ForecastDemandDate(),IsFilling := true,
+    //                                                                       OrderType := '鎻愭媺',PanelBigSheetQuantity := order.PanelBigSheetQuantity(),ProductID := order.ProductID(),
+    //                                                                       Quantity := order.Quantity(),SalesSegmentName := order.SalesSegmentName(),SalesAmount := order.SalesAmount(),
+    //                                                                       SchemeName := schemeName,StockingPointID := order.StockingPointID(),UnitOfMeasureName := order.UnitOfMeasureName(),
+    //                                                                       VerNo := order.VerNo()
+    //                                                                       );
+    //                                                                       
+    //    filllingCapacityOrderScheme.FillingCapacityOrder(relinsert, fillingOrder);
+    //}
+    
+    //// 鏂板鍙嶇/鎺堟潈璁㈠崟 璁㈠崟淇℃伅鍔犲叆濉骇
+    //traverse( owner,H_Forecast,hf)
+    //{
+    //          fillingOrder := owner.FillingCapacityOrder(relnew,BusinessType := hf.Department(),Customer := hf.CustomName(),CustomerID := hf.CustomCode(),
+    //                                                                       DemandDate := Date::Today(),ForecastDemandDate := Date::Today(),IsFilling := true,
+    //                                                                       OrderType := '鎻愭媺',PanelBigSheetQuantity := 0,ProductID := '',
+    //                                                                       Quantity := hf.ForecastQty(),SalesSegmentName := '',SalesAmount := 0,
+    //                                                                       SchemeName := schemeName,StockingPointID := '',UnitOfMeasureName := hf.Util(),
+    //                                                                       VerNo := ''
+    //                                                                       );
+    //                                                                       
+    //    filllingCapacityOrderScheme.FillingCapacityOrder(relinsert, fillingOrder);
+    //}
   *]
 }
diff --git a/_Main/BL/Type_FilllingCapacityOrderScheme/StaticMethod_DeleteDetails.qbl b/_Main/BL/Type_FilllingCapacityOrderScheme/StaticMethod_DeleteDetails.qbl
new file mode 100644
index 0000000..7eeebb0
--- /dev/null
+++ b/_Main/BL/Type_FilllingCapacityOrderScheme/StaticMethod_DeleteDetails.qbl
@@ -0,0 +1,19 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod DeleteDetails (
+  MacroPlan owner,
+  String schemeName
+)
+{
+  TextBody:
+  [*
+    // NBoTk Sep-25-2023 (created)
+    
+    details := selectset( owner,FillingCapacityOrder,f,true);
+    
+    traverse( details,Elements,e)
+    {
+      owner.FillingCapacityOrder(reldelete,e);
+    }
+  *]
+}
diff --git a/_Main/BL/Type_GlobalDTOTable/Method_OnAsyncExecuteFailure_GlobalOTDTable_CustomerGrade.qbl b/_Main/BL/Type_GlobalDTOTable/Method_OnAsyncExecuteFailure_GlobalOTDTable_CustomerGrade.qbl
new file mode 100644
index 0000000..26b2034
--- /dev/null
+++ b/_Main/BL/Type_GlobalDTOTable/Method_OnAsyncExecuteFailure_GlobalOTDTable_CustomerGrade.qbl
@@ -0,0 +1,20 @@
+Quintiq file version 2.0
+#parent: #root
+Method OnAsyncExecuteFailure_GlobalOTDTable_CustomerGrade (
+  Number errorNo,
+  String errorMessage
+)
+{
+  TextBody:
+  [*
+    this.Global_BrokerExecuteLog( relnew,
+                                  BrokerName    := "GlobalOTDTable_CustomerGrade",
+                                  ElementTotal  := 0,
+                                  ErrorMessage  := errorMessage,
+                                  IsSuccess     := false,
+                                  Name          := "瀹㈡埛绛夌骇鏁版嵁",
+                                  ErrorNo       := errorNo,
+                                  ErrorDateTime := DateTime::ActualTime().Format( "Y-M-D H2:m:s" )
+                                 );
+  *]
+}
diff --git a/_Main/BL/Type_GlobalDTOTable/Method_OnAsyncExecuteFailure_GlobalOTDTable_DOI_DSI.qbl b/_Main/BL/Type_GlobalDTOTable/Method_OnAsyncExecuteFailure_GlobalOTDTable_DOI_DSI.qbl
new file mode 100644
index 0000000..8ebfbf3
--- /dev/null
+++ b/_Main/BL/Type_GlobalDTOTable/Method_OnAsyncExecuteFailure_GlobalOTDTable_DOI_DSI.qbl
@@ -0,0 +1,20 @@
+Quintiq file version 2.0
+#parent: #root
+Method OnAsyncExecuteFailure_GlobalOTDTable_DOI_DSI (
+  Number errorNo,
+  String errorMessage
+)
+{
+  TextBody:
+  [*
+    this.Global_BrokerExecuteLog( relnew,
+                                  BrokerName    := "GlobalOTDTable_DOI_DSI",
+                                  ElementTotal  := 0,
+                                  ErrorMessage  := errorMessage,
+                                  IsSuccess     := false,
+                                  Name          := "DOI_DSI鏁版嵁",
+                                  ErrorNo       := errorNo,
+                                  ErrorDateTime := DateTime::ActualTime().Format( "Y-M-D H2:m:s" )
+                                 );
+  *]
+}
diff --git a/_Main/BL/Type_GlobalDTOTable/Method_OnAsyncExecute_GlobalOTDTable_CustomerGrade.qbl b/_Main/BL/Type_GlobalDTOTable/Method_OnAsyncExecute_GlobalOTDTable_CustomerGrade.qbl
new file mode 100644
index 0000000..e09fc63
--- /dev/null
+++ b/_Main/BL/Type_GlobalDTOTable/Method_OnAsyncExecute_GlobalOTDTable_CustomerGrade.qbl
@@ -0,0 +1,17 @@
+Quintiq file version 2.0
+#parent: #root
+Method OnAsyncExecute_GlobalOTDTable_CustomerGrade
+{
+  TextBody:
+  [*
+    this.Global_BrokerExecuteLog( relnew,
+                                  BrokerName      := "GlobalOTDTable_CustomerGrade",
+                                  ElementTotal    := this.Global_MappingCustomerGrade( relsize ),
+                                  ErrorMessage    := "",
+                                  IsSuccess       := true,
+                                  Name            := "瀹㈡埛绛夌骇鏁版嵁",
+                                  SuccessDateTime := DateTime::ActualTime().Format( "Y-M-D H2:m:s" ),
+                                  ErrorNo         := 0
+                                 );
+  *]
+}
diff --git a/_Main/BL/Type_GlobalDTOTable/Method_OnAsyncExecute_GlobalOTDTable_DOI_DSI.qbl b/_Main/BL/Type_GlobalDTOTable/Method_OnAsyncExecute_GlobalOTDTable_DOI_DSI.qbl
new file mode 100644
index 0000000..9082ba1
--- /dev/null
+++ b/_Main/BL/Type_GlobalDTOTable/Method_OnAsyncExecute_GlobalOTDTable_DOI_DSI.qbl
@@ -0,0 +1,17 @@
+Quintiq file version 2.0
+#parent: #root
+Method OnAsyncExecute_GlobalOTDTable_DOI_DSI
+{
+  TextBody:
+  [*
+    this.Global_BrokerExecuteLog( relnew,
+                                  BrokerName      := "GlobalOTDTable_DOI_DSI",
+                                  ElementTotal    := this.Global_MappingDOI_DSI( relsize ),
+                                  ErrorMessage    := "",
+                                  IsSuccess       := true,
+                                  Name            := "DOI_DSI鏁版嵁",
+                                  SuccessDateTime := DateTime::ActualTime().Format( "Y-M-D H2:m:s" ),
+                                  ErrorNo         := 0
+                                 );
+  *]
+}
diff --git a/_Main/BL/Type_GlobalDTOTable/Method_SetIsLinkedWithFinishedGoodAttributes.qbl b/_Main/BL/Type_GlobalDTOTable/Method_SetIsLinkedWithFinishedGoodAttributes.qbl
new file mode 100644
index 0000000..6aedc24
--- /dev/null
+++ b/_Main/BL/Type_GlobalDTOTable/Method_SetIsLinkedWithFinishedGoodAttributes.qbl
@@ -0,0 +1,41 @@
+Quintiq file version 2.0
+#parent: #root
+Method SetIsLinkedWithFinishedGoodAttributes
+{
+  Description: 'Method to traverse the supply chain to determine if there are any products that are not used to produce finished goods.'
+  TextBody:
+  [*
+    // Reset IsLinkedWithFinishedGood
+    traverse( this, Global_MappingProduct_MP, instance )
+    {
+      instance.IsLinkedWithFinishedGood( false );
+    }
+    
+    traverse( this, Global_MappingOperation, instance )
+    {
+      instance.IsLinkedWithFinishedGood( false );
+    }
+    
+    traverse( this, Global_MappingOperationBOM, instance )
+    {
+      instance.IsLinkedWithFinishedGood( false );
+    }
+    
+    productspool := selectset( this, Global_MappingProduct_MP, product,
+                               product.ProductMajorType() <> "鎴愬搧" );
+    operationspool := this.Global_MappingOperation( relget );
+    operationbomspool := this.Global_MappingOperationBOM( relget );
+    
+    // Traverse each finished good and search for linked products/operations/lanes
+    traverse( this, Global_MappingProduct_MP, product,
+              product.ProductMajorType() = "鎴愬搧" )
+    {
+      product.SetIsLinkedWithFinishedGoodAttributes_Recursive( 0, // depth
+                                                               100, // maxdepth
+                                                               productspool,
+                                                               operationspool,
+                                                               operationbomspool );
+      
+    }
+  *]
+}
diff --git a/_Main/BL/Type_GlobalDTOTable/StaticMethod_SynchronizationAllMappingBrokerAndAPI.qbl b/_Main/BL/Type_GlobalDTOTable/StaticMethod_SynchronizationAllMappingBrokerAndAPI.qbl
index 100a489..9239cfb 100644
--- a/_Main/BL/Type_GlobalDTOTable/StaticMethod_SynchronizationAllMappingBrokerAndAPI.qbl
+++ b/_Main/BL/Type_GlobalDTOTable/StaticMethod_SynchronizationAllMappingBrokerAndAPI.qbl
@@ -25,6 +25,8 @@
     globalOTDTable.Global_MappingOperationCost( relflush );
     globalOTDTable.Global_MappingForecast( relflush );
     globalOTDTable.Global_MappingCustomOrder( relflush );
+    globalOTDTable.Global_MappingDOI_DSI( relflush );
+    globalOTDTable.Global_MappingCustomerGrade( relflush );
     
     globalOTDTable.GlobalOTDTable_UnitOfMeasure_MP().AsyncExecute();
     globalOTDTable.GlobalOTDTable_SalesSegment_MP().AsyncExecute();
@@ -44,5 +46,7 @@
     globalOTDTable.GlobalOTDTable_OperationCost().AsyncExecute();
     globalOTDTable.GlobalOTDTable_Forecast().AsyncExecute();
     globalOTDTable.GlobalOTDTable_CustomOrder().AsyncExecute();
+    globalOTDTable.GlobalOTDTable_DOI_DSI().AsyncExecute();
+    globalOTDTable.GlobalOTDTable_CustomerGrade().AsyncExecute();
   *]
 }
diff --git a/_Main/BL/Type_Global_MappingCustomerGrade/Attribute_BusinessType.qbl b/_Main/BL/Type_Global_MappingCustomerGrade/Attribute_BusinessType.qbl
new file mode 100644
index 0000000..0c0ee82
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingCustomerGrade/Attribute_BusinessType.qbl
@@ -0,0 +1,9 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute BusinessType
+{
+  #keys: '3[414702.0.445738362][414702.0.445738361][414702.0.445738363]'
+  Description: '浜嬩笟閮�'
+  IsReadOnly: true
+  ValueType: String
+}
diff --git a/_Main/BL/Type_Global_MappingCustomerGrade/Attribute_Customer.qbl b/_Main/BL/Type_Global_MappingCustomerGrade/Attribute_Customer.qbl
new file mode 100644
index 0000000..046a760
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingCustomerGrade/Attribute_Customer.qbl
@@ -0,0 +1,9 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute Customer
+{
+  #keys: '3[414702.0.445738352][414702.0.445738351][414702.0.445738353]'
+  Description: '瀹㈡埛鍚嶇О'
+  IsReadOnly: true
+  ValueType: String
+}
diff --git a/_Main/BL/Type_Global_MappingCustomerGrade/Attribute_CustomerGrade.qbl b/_Main/BL/Type_Global_MappingCustomerGrade/Attribute_CustomerGrade.qbl
new file mode 100644
index 0000000..cd779bb
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingCustomerGrade/Attribute_CustomerGrade.qbl
@@ -0,0 +1,9 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute CustomerGrade
+{
+  #keys: '3[414702.0.445738372][414702.0.445738371][414702.0.445738373]'
+  Description: '瀹㈡埛绛夌骇'
+  IsReadOnly: true
+  ValueType: String
+}
diff --git a/_Main/BL/Type_Global_MappingCustomerGrade/TypeIndex_Global_MappingCustomerGradeTypeIndex.qbl b/_Main/BL/Type_Global_MappingCustomerGrade/TypeIndex_Global_MappingCustomerGradeTypeIndex.qbl
new file mode 100644
index 0000000..b30282d
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingCustomerGrade/TypeIndex_Global_MappingCustomerGradeTypeIndex.qbl
@@ -0,0 +1,20 @@
+Quintiq file version 2.0
+#parent: #root
+TypeIndex Global_MappingCustomerGradeTypeIndex
+{
+  Attributes:
+  [
+    TypeIndexAttribute
+    {
+      ModelElement: BusinessType
+    }
+    TypeIndexAttribute
+    {
+      ModelElement: Customer
+    }
+    TypeIndexAttribute
+    {
+      ModelElement: CustomerGrade
+    }
+  ]
+}
diff --git a/_Main/BL/Type_Global_MappingCustomerGrade/_ROOT_Type_Global_MappingCustomerGrade.qbl b/_Main/BL/Type_Global_MappingCustomerGrade/_ROOT_Type_Global_MappingCustomerGrade.qbl
new file mode 100644
index 0000000..f568483
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingCustomerGrade/_ROOT_Type_Global_MappingCustomerGrade.qbl
@@ -0,0 +1,9 @@
+Quintiq file version 2.0
+#root
+#parent: #DomainModel
+Type Global_MappingCustomerGrade
+{
+  #keys: '5[414702.0.445485672][414702.0.445485670][0.0.0][414702.0.445485671][414702.0.445485673]'
+  BaseType: Object
+  StructuredName: 'Global_MappingCustomerGrades'
+}
diff --git a/_Main/BL/Type_Global_MappingDOI_DSI/Attribute_DOI.qbl b/_Main/BL/Type_Global_MappingDOI_DSI/Attribute_DOI.qbl
new file mode 100644
index 0000000..d4d3c40
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingDOI_DSI/Attribute_DOI.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute DOI
+{
+  #keys: '3[414702.0.445364709][414702.0.445364708][414702.0.445364710]'
+  Description: '搴撳瓨鍛ㄨ浆澶╂暟'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_Global_MappingDOI_DSI/Attribute_DSI.qbl b/_Main/BL/Type_Global_MappingDOI_DSI/Attribute_DSI.qbl
new file mode 100644
index 0000000..2ad6d72
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingDOI_DSI/Attribute_DSI.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute DSI
+{
+  #keys: '3[414702.0.445364719][414702.0.445364718][414702.0.445364720]'
+  Description: '搴撳瓨鍙敭澶╂暟'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_Global_MappingDOI_DSI/Attribute_OrganCode.qbl b/_Main/BL/Type_Global_MappingDOI_DSI/Attribute_OrganCode.qbl
new file mode 100644
index 0000000..2bd3055
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingDOI_DSI/Attribute_OrganCode.qbl
@@ -0,0 +1,9 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute OrganCode
+{
+  #keys: '3[414702.0.445364699][414702.0.445364698][414702.0.445364700]'
+  Description: '缁勭粐缂栫爜'
+  IsReadOnly: true
+  ValueType: String
+}
diff --git a/_Main/BL/Type_Global_MappingDOI_DSI/Attribute_ProductID.qbl b/_Main/BL/Type_Global_MappingDOI_DSI/Attribute_ProductID.qbl
new file mode 100644
index 0000000..51fd7ff
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingDOI_DSI/Attribute_ProductID.qbl
@@ -0,0 +1,9 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute ProductID
+{
+  #keys: '3[414702.0.445364677][414702.0.445364676][414702.0.445364678]'
+  Description: '鐗╂枡缂栫爜'
+  IsReadOnly: true
+  ValueType: String
+}
diff --git a/_Main/BL/Type_Global_MappingDOI_DSI/TypeIndex_Global_MappingDOI_DSITypeIndex.qbl b/_Main/BL/Type_Global_MappingDOI_DSI/TypeIndex_Global_MappingDOI_DSITypeIndex.qbl
new file mode 100644
index 0000000..c088e3b
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingDOI_DSI/TypeIndex_Global_MappingDOI_DSITypeIndex.qbl
@@ -0,0 +1,16 @@
+Quintiq file version 2.0
+#parent: #root
+TypeIndex Global_MappingDOI_DSITypeIndex
+{
+  Attributes:
+  [
+    TypeIndexAttribute
+    {
+      ModelElement: ProductID
+    }
+    TypeIndexAttribute
+    {
+      ModelElement: OrganCode
+    }
+  ]
+}
diff --git a/_Main/BL/Type_Global_MappingDOI_DSI/_ROOT_Type_Global_MappingDOI_DSI.qbl b/_Main/BL/Type_Global_MappingDOI_DSI/_ROOT_Type_Global_MappingDOI_DSI.qbl
new file mode 100644
index 0000000..628e476
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingDOI_DSI/_ROOT_Type_Global_MappingDOI_DSI.qbl
@@ -0,0 +1,9 @@
+Quintiq file version 2.0
+#root
+#parent: #DomainModel
+Type Global_MappingDOI_DSI
+{
+  #keys: '5[414702.0.445364654][414702.0.445364652][0.0.0][414702.0.445364653][414702.0.445364655]'
+  BaseType: Object
+  StructuredName: 'Global_MappingDOI_DSIs'
+}
diff --git a/_Main/BL/Type_Global_MappingOperation/Attribute_IsLinkedWithFinishedGood.qbl b/_Main/BL/Type_Global_MappingOperation/Attribute_IsLinkedWithFinishedGood.qbl
new file mode 100644
index 0000000..76d65ba
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingOperation/Attribute_IsLinkedWithFinishedGood.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute IsLinkedWithFinishedGood
+{
+  #keys: '3[157968.0.1145180207][157968.0.1145180206][157968.0.1145180208]'
+  Description: 'Updated procedurally for checking whether this object is used to produce a finished good.'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_Global_MappingOperationBOM/Attribute_IsLinkedWithFinishedGood.qbl b/_Main/BL/Type_Global_MappingOperationBOM/Attribute_IsLinkedWithFinishedGood.qbl
new file mode 100644
index 0000000..e5ff163
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingOperationBOM/Attribute_IsLinkedWithFinishedGood.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute IsLinkedWithFinishedGood
+{
+  #keys: '3[157968.0.1145180190][157968.0.1145180189][157968.0.1145180191]'
+  Description: 'Updated procedurally for checking whether this object is used to produce a finished good.'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_Global_MappingProduct_MP/Attribute_IsLinkedWithFinishedGood.qbl b/_Main/BL/Type_Global_MappingProduct_MP/Attribute_IsLinkedWithFinishedGood.qbl
new file mode 100644
index 0000000..d2cec36
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingProduct_MP/Attribute_IsLinkedWithFinishedGood.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute IsLinkedWithFinishedGood
+{
+  #keys: '3[157968.0.1145180168][157968.0.1145180167][157968.0.1145180169]'
+  Description: 'Updated procedurally for checking whether this product is used to produce a finished good.'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_Global_MappingProduct_MP/Method_SetIsLinkedWithFinishedGoodAttributes_Recursive.qbl b/_Main/BL/Type_Global_MappingProduct_MP/Method_SetIsLinkedWithFinishedGoodAttributes_Recursive.qbl
new file mode 100644
index 0000000..4c9b813
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingProduct_MP/Method_SetIsLinkedWithFinishedGoodAttributes_Recursive.qbl
@@ -0,0 +1,83 @@
+Quintiq file version 2.0
+#parent: #root
+Method SetIsLinkedWithFinishedGoodAttributes_Recursive (
+  Number depth,
+  Number maxdepth,
+  Global_MappingProduct_MPs productspool,
+  Global_MappingOperations operationspool,
+  Global_MappingOperationBOMs operationbomspool
+)
+{
+  Description: 'Method to traverse the supply chain recursively to determine if there are any products that are not used to produce finished goods.'
+  TextBody:
+  [*
+    if( not this.IsLinkedWithFinishedGood() )
+    {
+      depth := depth + 1;
+      this.IsLinkedWithFinishedGood( true );
+      
+      if( depth <= maxdepth )
+      {
+        operations := selectset( operationspool, Elements, operation,
+                                 not operation.IsLinkedWithFinishedGood()
+                                 and operation.BusinessType() = this.BusinessType()
+                                 and operation.ProductID() = this.ID() );
+        operationspool.Remove( operations );
+        
+        traverse( operations, Elements, operation )
+        {
+          operation.IsLinkedWithFinishedGood( true );
+          
+          operationboms := selectset( operationbomspool, Elements, operationbom,
+                                      not operationbom.IsLinkedWithFinishedGood()
+                                      and operationbom.BusinessType() = operation.BusinessType()
+                                      and operationbom.OrganCode() = operation.OrganCode()
+                                      and operationbom.ProcessSection() = operation.ProcessSection()
+                                      and operationbom.ProductCode() = operation.ProductID() );
+          operationbomspool.Remove( operationboms );
+          
+          traverse( operationboms, Elements, operationbom )
+          {
+            operationbom.IsLinkedWithFinishedGood( true );
+            
+            componentproduct := Global_MappingProduct_MP::FindTypeIndexIDAndBusinessType( operationbom.ComponentCode(),
+                                                                                          operationbom.BusinessType() );
+            
+            if( guard( not componentproduct.IsLinkedWithFinishedGood(), false ) )
+            {
+              productspool.Remove( componentproduct );
+              componentproduct.SetIsLinkedWithFinishedGoodAttributes_Recursive( depth,
+                                                                                maxdepth,
+                                                                                productspool,
+                                                                                operationspool,
+                                                                                operationbomspool );
+            }
+            
+            if( operationbom.AlternativeMaterialCode() <> ""
+                and operationbom.AlternativeMaterialCode() <> operationbom.ComponentCode() )
+            {
+              alternativeproduct := Global_MappingProduct_MP::FindTypeIndexIDAndBusinessType( operationbom.AlternativeMaterialCode(),
+                                                                                              operationbom.BusinessType() );
+              
+              if( guard( not alternativeproduct.IsLinkedWithFinishedGood(), false ) )
+              {
+                productspool.Remove( alternativeproduct );
+                alternativeproduct.SetIsLinkedWithFinishedGoodAttributes_Recursive( depth,
+                                                                                    maxdepth,
+                                                                                    productspool,
+                                                                                    operationspool,
+                                                                                    operationbomspool );
+              }
+            }
+          }
+        }
+      }
+      else
+      {
+        debuginfo( "Product:", this.ID(),
+                   "| BusinessType:", this.BusinessType(),
+                   "| Max depth reached, stop searching... (", depth, ")" );
+      }
+    }
+  *]
+}
diff --git a/_Main/BL/Type_H_CustomOrder/_ROOT_Type_H_CustomOrder.qbl b/_Main/BL/Type_H_CustomOrder/_ROOT_Type_H_CustomOrder.qbl
new file mode 100644
index 0000000..a8c4845
--- /dev/null
+++ b/_Main/BL/Type_H_CustomOrder/_ROOT_Type_H_CustomOrder.qbl
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+#root
+#parent: #DomainModel
+Type H_CustomOrder
+{
+  #keys: '5[414724.0.177854646][414724.0.177854644][0.0.0][414724.0.177854645][414724.0.177854647]'
+  BaseType: Object
+  Description: '閲嶅缓鍚庣殑璁㈠崟'
+  StructuredName: 'H_CustomOrders'
+}
diff --git a/_Main/BL/Type_H_FunctionClass/StaticMethod_NewStaticMethod.qbl b/_Main/BL/Type_H_FunctionClass/StaticMethod_NewStaticMethod.qbl
deleted file mode 100644
index 7118da1..0000000
--- a/_Main/BL/Type_H_FunctionClass/StaticMethod_NewStaticMethod.qbl
+++ /dev/null
@@ -1,10 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-StaticMethod NewStaticMethod () as owning JSON
-{
-  TextBody:
-  [*
-    jResult := JSON::Object().Add( "A","123");
-    return jResult.Build();
-  *]
-}
diff --git a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetALlBOM.qbl b/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetALlBOM.qbl
deleted file mode 100644
index 5ab9f90..0000000
--- a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetALlBOM.qbl
+++ /dev/null
@@ -1,27 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-StaticMethod SM_GetALlBOM (
-  MacroPlan Owner,
-  MappingBOM Material
-) as Number
-{
-  Description: '鏍规嵁SKU鑾峰彇鏈熸牴閮ㄦ墍鏈夋暟鎹�'
-  TextBody:
-  [*
-    AllMaterials := selectset( Owner,MappingBOM,Obj,Obj.ComponentCode()=Material.ProductCode())
-    if( AllMaterials.Size()>0) 
-    {
-          traverse( AllMaterials,Elements,Obj,not isnull( Obj))
-         {
-              H_FunctionClass::SM_GetALlBOM( Owner,Obj);
-         }   
-    }
-    else
-    {
-        Owner.H_MaterialInfo(relnew,ID := H_FunctionClass::SM_GenerateID( "BM")
-                                    ,MaterialName := Material.ComponentType()  );
-      
-    }
-    return 0;
-  *]
-}
diff --git a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetBOMBySKU.qbl b/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetBOMBySKU.qbl
index a10fbae..11d0768 100644
--- a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetBOMBySKU.qbl
+++ b/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetBOMBySKU.qbl
@@ -1,17 +1,17 @@
 Quintiq file version 2.0
 #parent: #root
 StaticMethod SM_GetBOMBySKU (
-  MacroPlan Owner,
+  GlobalOTDTable GlobData,
   String SKU
-) as MappingBOM
+) as Global_MappingOperationBOM
 {
   Description: '鏍规嵁SKU鑾峰彇BOM'
   TextBody:
   [*
-    Obj :=null( MappingBOM,constcontent );
-    if( not isnull( Owner) and SKU.Length()>0)
+    Obj :=null( Global_MappingOperationBOM,constcontent );
+    if( not isnull( GlobData) and SKU.Length()>0)
     {
-      Obj := select( Owner,MappingBOM,ObjM,ObjM.ProductCode()=SKU);
+      Obj := select( GlobData,Global_MappingOperationBOM,ObjM,ObjM.ProductCode()=SKU);
     }
     return Obj;
   *]
diff --git a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetMaterialData.qbl b/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetMaterialData.qbl
index 3edc063..850417c 100644
--- a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetMaterialData.qbl
+++ b/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetMaterialData.qbl
@@ -6,7 +6,8 @@
   Number ProductQty,
   String ForecastId,
   String VCode,
-  Date NDate
+  Date NDate,
+  GlobalOTDTable GlobData
 ) as owning JSON
 {
   Description: '鑾峰彇鐗╂枡淇℃伅'
@@ -26,15 +27,15 @@
       if( Owner.MappingBOM(relsize )>0)
       {
         // 寰楀埌涓嬩竴绾ф暟鎹�
-        AllData:= selectset( Owner, MappingBOM,object,object.ComponentCode()=ParentSKU);
-        ObjProduct := null( MappingProduct,constcontent );
+        AllData:= selectset( GlobData, Global_MappingOperationBOM,object,object.ComponentCode()=ParentSKU);
+        ObjProduct := null( Product_MP,constcontent );
         ObjUnit := null( Unit,constcontent );
         MaterialType:="";
         MaterialName:="-";
         StockPoint := "";
         NRate:=1.0;
         NComponentsUsed :=0.0;
-        ObjBOM := H_FunctionClass::SM_GetBOMBySKU( Owner,ParentSKU);
+        ObjBOM := H_FunctionClass::SM_GetBOMBySKU(GlobData,ParentSKU);
         if(not isnull( ObjBOM))
         {
           NRate := ObjBOM.ComponentOutputRate();
@@ -56,10 +57,10 @@
               // 鐗╂枡绫诲瀷
               MaterialType := Obj.ProductType();
               // 寰楀埌鐗╂枡淇℃伅
-              ObjProduct:= H_FunctionClass::SM_GetProductInfo(Owner, Obj.ProductCode());
+              ObjProduct:= H_FunctionClass::SM_GetProductInfo(Owner,Obj.ProductCode());
               if( not isnull( ObjProduct))
               {
-                MaterialType:= ObjProduct.ProductMajorType();
+                MaterialType:= ObjProduct.ParentID();
                 MaterialName:=ObjProduct.Name();
               }
               ObjUnit:= H_FunctionClass::SM_GetUnitBySKU( Owner,Obj.ProductCode());
@@ -87,6 +88,10 @@
                                     ,ID := H_FunctionClass::SM_GenerateID( "MI"),MaterialType := "鍘熸潗鏂�",NeedDate := NDate
                                     ,NeedQty := [Number](ProductQty*0.8).Round( 0),Unit := "PCS"
                                     ,StockPoint :="娴嬭瘯",MaterialName := "娴嬭瘯鏁版嵁" );
+        Owner.H_MaterialInfo(relnew,ParentSKU := ParentSKU,SKU := "SKU_M"+ (nCount+1).AsQUILL() ,ForecastID := ForecastId,OrgCode := "ORG_000",VCode := VCode
+                                    ,ID := H_FunctionClass::SM_GenerateID( "MI"),MaterialType := "鍗婃垚鍝�",NeedDate := NDate
+                                    ,NeedQty := [Number](ProductQty*0.8).Round( 0),Unit := "PCS"
+                                    ,StockPoint :="娴嬭瘯",MaterialName := "娴嬭瘯鏁版嵁" );
       }
       bStatus := true;
       strMsg :="";
diff --git "a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetProductInfo\0431.qbl" "b/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetProductInfo\0431.qbl"
index 2b1ed8f..09e6868 100644
--- "a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetProductInfo\0431.qbl"
+++ "b/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_GetProductInfo\0431.qbl"
@@ -3,16 +3,17 @@
 StaticMethod SM_GetProductInfo (
   MacroPlan Owner,
   String SKU
-) as MappingProduct
+) as Product_MP
 {
   Description: '鏍规嵁SKU鑾峰彇鐗╂枡淇℃伅'
   TextBody:
   [*
     // 鏍规嵁SKU鑾峰彇鐗╂枡淇℃伅
-    Obj := null( MappingProduct,constcontent );
+    // 娉ㄦ剰锛氱墿鏂欑被鍨嬪彇 ParentID
+    Obj := null( Product_MP,constcontent );
     if( not isnull( Owner) and SKU.Length()>0)
     {
-      Obj:= select( Owner,MappingProduct,ObjMP,ObjMP.ID()=SKU);
+      Obj:= select( Owner,Product_MP,ObjMP,ObjMP.ID()=SKU);
     }
     return Obj;
   *]
diff --git a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_InitialForcastData.qbl b/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_InitialForcastData.qbl
deleted file mode 100644
index edf6c16..0000000
--- a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_InitialForcastData.qbl
+++ /dev/null
@@ -1,111 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-StaticMethod SM_InitialForcastData (
-  MacroPlan Owner
-) as owning JSON
-{
-  Description: '鍒濆鍖栬鍗曢娴嬩俊鎭�'
-  TextBody:
-  [*
-    /**********************************鍒濆鍖栬鍗曢娴嬩俊鎭�***************************************
-    *娉細鏈‘瀹氫笂娓搁娴嬭鍗曟洿鏂伴�昏緫鍜屾暟鎹湁鏁堟�э紝杩欓噷杩涜浜屾澶勭悊锛屾柊鐢熸垚涓�涓垪琛紝閬垮厤涓婃父淇℃伅鍙樺姩涓ラ噸
-    *    褰卞搷鍔熻兘
-    *
-    *****************************************************************************************/
-    // 鍒濆鍖栫粨鏋�
-    bStatus := false;
-    strMsg :="";
-    
-    try{
-      // 娓呴櫎鏃ф暟鎹紝閲嶆柊鎷夊彇
-      if(Owner.H_Forecast(relget ).Size()>0)
-      {
-        traverse( Owner,H_Forecast,Obj,not isnull( Obj))
-        {
-          Owner.H_Forecast(reldelete, Obj);
-        }
-      }
-      
-      // 鑾峰彇棰勬祴璁㈠崟锛氬綋鏈堝拰涔嬪悗鐨�3涓湀棰勬祴鏁版嵁 涓旈娴嬫暟閲�>0鐨�
-      AllData:= selectset( Owner, Product_MP.SalesDemand.astype( Forecast ),object,object.EndDate().DateTime().Date() >= Date::ActualDate().StartOfMonth() 
-                           and object.EndDate().DateTime().Date() <= Date::ActualDate().StartOfNextMonth().StartOfNextMonth().StartOfNextMonth().StartOfNextMonth()
-                           and object.Quantity()>0 );
-      
-      CustomName:="";
-      DepartMent:="";
-      idx:=0;
-      strOrderCode:="";
-      RQty:=0;
-      ObjOrderRealQty:=null( H_OrderForecastRealQty,constcontent );
-    //  ObjPruduct :=null( MappingProduct,constcontent );
-      traverse( AllData,Elements,Obj,not isnull(Obj))
-      {
-        // 杩欓噷鐢ㄦ煡鎵惧悗鎴彇锛屽洜涓轰笉纭畾鏈夊嚑涓í绾匡紝浠ョ涓�涓负鍑�
-        idx:=Obj.SalesSegmentName().FindString( "-",0);
-        if(idx>0)
-        {
-          DepartMent:=Obj.SalesSegmentName().SubString( 0,idx);
-          CustomName := Obj.SalesSegmentName().SubString( idx+1, Obj.SalesSegmentName().Length() - (idx+1));
-        }
-        else
-        {
-          CustomName :=Obj.SalesSegmentName();
-          DepartMent := "閮ㄩ棬鏁版嵁鑾峰彇澶辫触锛�"
-        }
-    //    // 浠庣墿鏂欒〃鑾峰彇鐗╂枡淇℃伅
-    //    ObjPruduct := H_FunctionClass::SM_GetProductInfo( Owner,Obj.ProductID());
-    //    if( not isnull( ObjPruduct))
-    //    {
-    //      
-    //    }
-         // 鍐欏叆棰勬祴璁㈠崟淇℃伅琛�
-         strOrderCode:=H_FunctionClass::SM_GenerateID( "OF");
-         Owner.H_Forecast(relnew,OrderCode := strOrderCode,
-                                SKU := Obj.ProductID(),
-                               CustomCode := CustomName,
-                               CustomName := CustomName,
-                               Util:=Obj.UnitOfMeasureName(),
-                               NeedTime:=Obj.EndDate(),
-                               ForecastQty:=[Number]Obj.Quantity().Round( 0),
-                               StockingPointID := Obj.StockingPointID(),
-                               Department:=DepartMent);
-         // 鍐欏叆棰勬祴瀹炴椂淇℃伅
-         ObjOrderRealQty := select( Owner,H_OrderForecastRealQty,ObjO,ObjO.CustomID()=CustomName and ObjO.SKU()=Obj.ProductID() 
-                                    and ObjO.Month().StartOfMonth() = Obj.EndDate().StartOfMonth() )
-         if( isnull( ObjOrderRealQty))
-         {
-             Owner.H_OrderForecastRealQty(relnew,CustomID := CustomName,CustomName := CustomName,ForecatsQty := [Number]Obj.Quantity().Round( 0)
-                                           ,ForecatsRealQty := [Number]Obj.Quantity().Round( 0),ID := H_FunctionClass::SM_GenerateID( "OR")
-                                           ,Month := Obj.EndDate(),OrderCode := strOrderCode,SKU := Obj.ProductID(),Unit := Obj.UnitOfMeasureName());
-         }
-         else
-         {
-            if( [Number]Obj.Quantity().Round( 0)<> ObjOrderRealQty.ForecatsQty())
-            {
-                  RQty := [Number]Obj.Quantity().Round( 0) - ObjOrderRealQty.ForecatsQty();
-                  RQty := ObjOrderRealQty.ForecatsRealQty() + RQty;
-                  if( RQty<0)
-                  {
-                      RQty :=0;
-                  }
-                  ObjOrderRealQty.ForecatsQty([Number]Obj.Quantity().Round( 0));
-                  ObjOrderRealQty.ForecatsRealQty(RQty);
-            }
-         }
-      }
-     
-      
-      bStatus := true;
-      strMsg :="璁㈠崟棰勬祴鍒濆鍖栨垚鍔�!";
-    }
-    onerror
-    {
-      strMsg :="璁㈠崟棰勬祴鍒濆鍖栧け璐ワ紝鍙兘褰卞搷鍐插噺璁$畻锛岃鑱旂郴绯荤粺绠$悊鍛橈紒";
-      Owner.H_ErrorLogs(relnew,EClassName := "H_FunctionClass",EDateTime := DateTime::ActualGMTTime(),EFunctionName := "SM_InitialForcastData",
-                         DeveloperInformation :=  e.DeveloperInformation(),ErrorNr := e.ErrorNr(),DetailedInformation := e.DetailedInformation(),
-                         GeneralInformation := e.GeneralInformation());                
-    }
-    return JSON::Object().Add( "Status",bStatus)
-                         .Add( "Msg",strMsg).Build();
-  *]
-}
diff --git a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_InitialForcastDataEx.qbl b/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_InitialForcastDataEx.qbl
index 524b723..d8870c8 100644
--- a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_InitialForcastDataEx.qbl
+++ b/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_InitialForcastDataEx.qbl
@@ -2,7 +2,8 @@
 #parent: #root
 StaticMethod SM_InitialForcastDataEx (
   MacroPlan Owner,
-  Boolean IsNew
+  Boolean IsNew,
+  String VersionCode
 ) as owning JSON
 {
   Description: '鍒濆鍖栬鍗曢娴嬩俊鎭�'
@@ -11,36 +12,46 @@
     /**********************************鍒濆鍖栬鍗曢娴嬩俊鎭�***************************************
     *娉細鏈‘瀹氫笂娓搁娴嬭鍗曟洿鏂伴�昏緫鍜屾暟鎹湁鏁堟�э紝杩欓噷杩涜浜屾澶勭悊锛屾柊鐢熸垚涓�涓垪琛紝閬垮厤涓婃父淇℃伅鍙樺姩涓ラ噸
     *    褰卞搷鍔熻兘
-    *
+    *鍙傛暟锛欼sNew 鏄惁鏃跺叏鏂版暟鎹紝鍏ㄦ柊鏁版嵁浼氬皢鏃х殑鏁版嵁娓呴櫎锛岀劧鍚庨噸鏂板~鍏咃紝涓嶆槸鍏ㄦ柊鏁版嵁锛屽皢绱鍜屾洿鏂�
     *****************************************************************************************/
     // 鍒濆鍖栫粨鏋�
     bStatus := false;
     strMsg :="";
     
     try{
-      // 娓呴櫎鏃ф暟鎹紝閲嶆柊鎷夊彇
-      if(Owner.H_Forecast(relget ).Size()>0)
+      // 20230925 浼樺寲鐨勪笟鍔¢�昏緫,濡傛灉鏃舵柊鏁版嵁锛屽垯棰勬祴鏁版嵁鍏ㄩ儴骞叉帀锛岀劧鍚庨噸鏂扮敓鎴�
+      if( IsNew)
       {
-        traverse( Owner,H_Forecast,Obj,not isnull( Obj))
+        if( Owner.H_OrderForecastRealQty(relsize )>0)
         {
-          Owner.H_Forecast(reldelete, Obj);
+          traverse( Owner,H_OrderForecastRealQty,Obj,not isnull( Obj))
+          {
+            Owner.H_OrderForecastRealQty(reldelete, Obj);
+          }
         }
       }
       
       // 鑾峰彇棰勬祴璁㈠崟锛氬綋鏈堝拰涔嬪悗鐨�3涓湀棰勬祴鏁版嵁 涓旈娴嬫暟閲�>0鐨�
-      AllData:= selectset( Owner, Product_MP.SalesDemand.astype( Forecast ),object,object.EndDate().DateTime().Date() >= Date::ActualDate().StartOfMonth() 
-                           and object.EndDate().DateTime().Date() <= Date::ActualDate().StartOfNextMonth().StartOfNextMonth().StartOfNextMonth().StartOfNextMonth()
+      AllData:= selectset( Owner, Product_MP.SalesDemand.astype( Forecast ),object,
+                           object.EndDate().DateTime().Date() >= Date::ActualDate().StartOfMonth() 
+                           // 闇�姹傜粰鏈潵4涓湀鐨勬暟鎹紝浣嗗彲鑳藉苟涓嶅噯纭紝鏆傛椂娉ㄩ噴鎺夛紝鍥涗釜鏈堥檺鍒�
+                           //and object.EndDate().DateTime().Date() <= Date::ActualDate().StartOfNextMonth().StartOfNextMonth().StartOfNextMonth().StartOfNextMonth()
                            and object.Quantity()>0 );
       
       CustomName:="";
       DepartMent:="";
       idx:=0;
-      strOrderCode:="";
       RQty:=0;
       ObjOrderRealQty:=null( H_OrderForecastRealQty,constcontent );
-    //  ObjPruduct :=null( MappingProduct,constcontent );
+      SKU:="";
+      SKUName := "";
+    
       traverse( AllData,Elements,Obj,not isnull(Obj))
       {
+        // 娌℃湁瀹㈡埛淇℃伅鍜岄儴闂ㄤ俊鎭紝SalesSegmentName=浜嬩笟閮�+鈥�-鈥�+瀹㈡埛鍚嶇О
+        CustomName := Obj.SalesSegmentName();
+        DepartMent := Obj.SalesSegmentName();
+        SKU :=Obj.ProductID();
         // 杩欓噷鐢ㄦ煡鎵惧悗鎴彇锛屽洜涓轰笉纭畾鏈夊嚑涓í绾匡紝浠ョ涓�涓负鍑�
         idx:=Obj.SalesSegmentName().FindString( "-",0);
         if(idx>0)
@@ -48,61 +59,40 @@
           DepartMent:=Obj.SalesSegmentName().SubString( 0,idx);
           CustomName := Obj.SalesSegmentName().SubString( idx+1, Obj.SalesSegmentName().Length() - (idx+1));
         }
-        else
+        
+        // 鑾峰彇鐗╂枡淇℃伅
+        ObjMaterial := H_FunctionClass::SM_GetProductInfo( Owner,Obj.ProductID());
+        if(not isnull( ObjMaterial))
         {
-          CustomName :=Obj.SalesSegmentName();
-          DepartMent := "閮ㄩ棬鏁版嵁鑾峰彇澶辫触锛�"
+          SKUName := ObjMaterial.Name();
         }
-    //    // 浠庣墿鏂欒〃鑾峰彇鐗╂枡淇℃伅
-    //    ObjPruduct := H_FunctionClass::SM_GetProductInfo( Owner,Obj.ProductID());
-    //    if( not isnull( ObjPruduct))
-    //    {
-    //      
-    //    }
-         // 鍐欏叆棰勬祴璁㈠崟淇℃伅琛�
-         strOrderCode:=H_FunctionClass::SM_GenerateID( "OF");
-         Owner.H_Forecast(relnew,OrderCode := strOrderCode,
-                                SKU := Obj.ProductID(),
-                               CustomCode := CustomName,
-                               CustomName := CustomName,
-                               Util:=Obj.UnitOfMeasureName(),
-                               NeedTime:=Obj.EndDate(),
-                               ForecastQty:=[Number]Obj.Quantity().Round( 0),
-                               StockingPointID := Obj.StockingPointID(),
-                               Department:=DepartMent);
-         // 鍐欏叆棰勬祴瀹炴椂淇℃伅
-         ObjOrderRealQty := select( Owner,H_OrderForecastRealQty,ObjO,ObjO.CustomID()=CustomName and ObjO.SKU()=Obj.ProductID() 
+        
+         // 鏇存柊棰勬祴淇℃伅锛岄潪鏂版暟鎹洿鏂颁俊鎭��
+         ObjOrderRealQty := select( Owner,H_OrderForecastRealQty,ObjO,ObjO.CustomCode()=CustomName and ObjO.SKU()=Obj.ProductID() 
                                     and ObjO.Month().StartOfMonth() = Obj.EndDate().StartOfMonth() )
-         if( isnull( ObjOrderRealQty))
+         if( IsNew or isnull( ObjOrderRealQty))
          {
-             Owner.H_OrderForecastRealQty(relnew,CustomID := CustomName,CustomName := CustomName,ForecatsQty := [Number]Obj.Quantity().Round( 0)
-                                           ,ForecatsRealQty := [Number]Obj.Quantity().Round( 0),ID := H_FunctionClass::SM_GenerateID( "OR")
-                                           ,Month := Obj.EndDate(),OrderCode := strOrderCode,SKU := Obj.ProductID(),Unit := Obj.UnitOfMeasureName());
+           Owner.H_OrderForecastRealQty(relnew,CustomCode := CustomName,CustomName := CustomName,ForecastQty := [Number]Obj.Quantity().Round( 0)
+                                         ,ForecatsRealQty := [Number]Obj.Quantity().Round( 0),ID := H_FunctionClass::SM_GenerateID( "OR")
+                                         ,Month := Obj.EndDate(),SKU := Obj.ProductID(),Unit := Obj.UnitOfMeasureName()
+                                         ,Department := DepartMent,VCode := VersionCode,SKUName := SKUName);
          }
          else
          {
-           if( IsNew)
-           {
-              ObjOrderRealQty.ForecatsQty([Number]Obj.Quantity().Round( 0));
-              ObjOrderRealQty.ForecatsRealQty([Number]Obj.Quantity().Round( 0));
-           }
-           else
-           {
-              if( [Number]Obj.Quantity().Round( 0)<> ObjOrderRealQty.ForecatsQty())
-              {
-                    RQty := [Number]Obj.Quantity().Round( 0) - ObjOrderRealQty.ForecatsQty();
-                    RQty := ObjOrderRealQty.ForecatsRealQty() + RQty;
-                    if( RQty<0)
-                    {
-                        RQty :=0;
-                    }
-                    ObjOrderRealQty.ForecatsQty([Number]Obj.Quantity().Round( 0));
-                    ObjOrderRealQty.ForecatsRealQty(RQty);
-              }
-           }
+           // 鏇存柊浜嗛娴嬫暟鎹紝鍒欒绠楀疄鏃舵暟鎹鍑�
+            if( [Number]Obj.Quantity().Round( 0)<> ObjOrderRealQty.ForecastQty())
+            {
+                  RQty := [Number]Obj.Quantity().Round( 0) - ObjOrderRealQty.ForecastQty();
+                  RQty := ObjOrderRealQty.ForecatsRealQty() + RQty;
+                  if( RQty<0)
+                  {
+                      RQty :=0;
+                  }
+                  ObjOrderRealQty.ForecastQty([Number]Obj.Quantity().Round( 0));
+                  ObjOrderRealQty.ForecatsRealQty(RQty);
+            }
          }
       }
-     
       
       bStatus := true;
       strMsg :="璁㈠崟棰勬祴鍒濆鍖栨垚鍔�!";
diff --git a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_MaterialReverse.qbl b/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_MaterialReverse.qbl
index d096a87..b044a49 100644
--- a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_MaterialReverse.qbl
+++ b/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_MaterialReverse.qbl
@@ -39,7 +39,7 @@
         nNoHaveForecastQty:=0;//浜旈娴嬫暟閲�
         // 鑾峰彇棰勬祴鏁伴噺锛堝鎴�+SKU+鏈堜唤 鐞嗚鏄病鏈夌墿鏂欓娴嬶級
         OrderForecast := select(Owner, H_OrderForecastRealQty , Obj, Obj.SKU() = SKU 
-                                              and Obj.CustomID() = CustomerCode 
+                                              and Obj.CustomCode() = CustomerCode 
                                               and Obj.Month().Format( "YM2") = Date::ActualDate().Format( "YM2"));                                   
         if ( not isnull(OrderForecast))
         {
@@ -195,10 +195,9 @@
           {
             Owner.H_OrderForecastRealQty(relnew,ID := H_FunctionClass::SM_GenerateID( "OF"),SKU := SKU,
                                                                                             Month := Date::ActualDate(),
-                                                                                            CustomID := CustomerCode,
+                                                                                            CustomCode := CustomerCode,
                                                                                             CustomName := "瀹㈡埛琛ㄨ幏鍙�",
-                                                                                            OrderCode := "-",
-                                                                                            ForecatsQty :=0,
+                                                                                            ForecastQty := 0,
                                                                                             ForecatsRealQty :=nForecastQtyNew,
                                                                                             Unit := "SKU 鍒扮墿鏂欒〃鑾峰彇");
           } 
diff --git a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_OrderHedging.qbl b/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_OrderHedging.qbl
index c4c2894..88c8f1d 100644
--- a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_OrderHedging.qbl
+++ b/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_OrderHedging.qbl
@@ -26,161 +26,198 @@
       if( not isnull( Owner))
       {
         // 鍒濆鍖栭娴嬩俊鎭�
-        JResult := H_FunctionClass::SM_InitialForcastDataEx( Owner,IsNew);
+        JResult := H_FunctionClass::SM_InitialForcastDataEx( Owner,IsNew,"--");
+        // 棰勬祴鍒濆鍖栧畬鎴�
         if( JResult.Get( "Status").GetBoolean())
         {
-          traverse( Owner,SalesDemand.astype( CustomerOrder ),ObjOrder,not isnull( ObjOrder))
+          nForecastQtyOld := 0; //鍘熼娴嬫暟閲�
+          nReverseQtyOld :=0;   //鍘熷弽绛炬暟閲�
+          nAuthorizeQtyOld :=0; //鍘熸巿鏉冩暟閲�
+          nForecastQtyNew :=0;  //璁$畻鍚庣殑棰勬祴鏁伴噺
+          nReverseQtyNew :=0;   //璁$畻鍚庣殑鍙嶇鏁伴噺
+          nAuthorizeQtyNew :=0; //璁$畻鍚庣殑鎺堟潈鏁伴噺
+          nHaveForecastQty :=0; //鏈夐娴嬫暟閲�
+          nNoHaveForecastQty:=0;//浜旈娴嬫暟閲�
+          OrderQuantity := 0;   //鍓╀綑璁㈠崟鏁伴噺
+          traverse( Owner,SalesDemand.astype( CustomerOrder ),ObjOrder)
           {
-            //----------------------------------------浠ヤ笅鍚庡幓棰勬祴 鍙嶇 鎺堟潈鏁版嵁淇℃伅----------------
-            nForecastQtyOld := 0; //鍘熼娴嬫暟閲�
-            nReverseQtyOld :=0;   //鍘熷弽绛炬暟閲�
-            nAuthorizeQtyOld :=0; //鍘熸巿鏉冩暟閲�
-            nForecastQtyNew :=0;  //璁$畻鍚庣殑棰勬祴鏁伴噺
-            nReverseQtyNew :=0;   //璁$畻鍚庣殑鍙嶇鏁伴噺
-            nAuthorizeQtyNew :=0; //璁$畻鍚庣殑鎺堟潈鏁伴噺
-            nHaveForecastQty :=0; //鏈夐娴嬫暟閲�
-            nNoHaveForecastQty:=0;//浜旈娴嬫暟閲�
-            OrderQuantity := 0;   //鍓╀綑璁㈠崟鏁伴噺
-           
-            // 鑾峰彇棰勬祴鏁伴噺锛堝鎴�+SKU+鏈堜唤 鐞嗚鏄病鏈夌墿鏂欓娴嬶級
-            OrderForecast := select(Owner, H_OrderForecastRealQty , Obj, Obj.SKU() = ObjOrder.ProductID() 
-                                                  and Obj.CustomID() = ObjOrder.CustomerName() 
-                                                  and Obj.Month().Format( "YM2") =ObjOrder.EndDate().Format( "YM2"));
-            if ( not isnull(OrderForecast))
+            // 鐩存帴鍒犻櫎鏈湀涔嬪墠鐨勮鍗�
+            if( ObjOrder.EndDate()<Date::ActualDate().StartOfMonth())
             {
-                nForecastQtyOld := OrderForecast.ForecatsRealQty();
-                nForecastQtyNew := nForecastQtyOld;
-            }
-            
-            // 鑾峰彇鍙嶇鏁伴噺锛堝彧鍒ゆ柇SKU锛�
-            ObjReverse := select(Owner, H_ReverseRealQty , Obj, Obj.SKU() = ObjOrder.ProductID());
-            if ( not isnull(ObjReverse))
-            {
-                nReverseQtyOld := ObjReverse.ReverseRealQty();
-                nReverseQtyNew := nReverseQtyOld;
-            }
-            
-            // 鑾峰彇鎺堟潈鏁伴噺锛堝鎴稩D+SKU锛�
-            ObjAuthorize := select(Owner, H_AuthorizeRealQty , Obj, Obj.SKU() = ObjOrder.ProductID() 
-                                                                    and Obj.CustomID() = ObjOrder.CustomerName());
-            if ( not isnull(ObjAuthorize))
-            {
-                nAuthorizeQtyOld := ObjAuthorize.AuthorizeRealQty();
-                nAuthorizeQtyNew :=nAuthorizeQtyOld;
-            }
-            //-----------------------------浠ヤ笅璁㈠崟鍐插噺--------------------
-            // 鎺堟潈璁板綍ID
-            AQID := H_FunctionClass::SM_GenerateID( "AQ");
-            // 璁㈠崟鍓╀綑鏁伴噺
-            OrderQuantity := [Number]ObjOrder.Quantity().Round( 0);
-            // 1 鍏堝啿鎺堟潈
-            if( OrderQuantity>0 and nAuthorizeQtyOld>0)
-            { 
-               OrderQuantity := OrderQuantity-nAuthorizeQtyOld;
-               nAuthorizeQtyNew :=0; 
-               if( OrderQuantity<0)
-               {
-                 nAuthorizeQtyNew := abs(OrderQuantity);
-                 OrderQuantity :=0;
-               }
-            }
-            // 2 鍐嶅啿鍙嶇
-            if( OrderQuantity>0 and nReverseQtyOld>0)
-            { 
-               OrderQuantity := OrderQuantity-nReverseQtyOld;
-               nReverseQtyNew :=0; 
-               if( OrderQuantity<0)
-               {
-                 nReverseQtyNew := abs(OrderQuantity);
-                 OrderQuantity :=0;
-               }
-            }
-            // 3 鏈�鍚庡啿棰勬祴
-            if( OrderQuantity>0 and nForecastQtyOld>0)
-            { 
-               //榛樿璁㈠崟鏁伴噺>棰勬祴鏁伴噺
-               OrderQuantity := OrderQuantity-nForecastQtyOld;
-               nForecastQtyNew :=0;
-               nHaveForecastQty := nForecastQtyOld;
-               nNoHaveForecastQty := OrderQuantity; 
-               if( OrderQuantity<0)
-               {
-                 nForecastQtyNew := abs(OrderQuantity);
-                 OrderQuantity :=0;
-                 nHaveForecastQty := nForecastQtyOld - nForecastQtyNew;
-                 nNoHaveForecastQty := 0;
-               }
-            }
-            // 璁板綍鍔ㄤ綔
-            Owner.H_OrderRecord(relnew,
-                                   ID := AQID,
-                                   VCode:=VCode,
-                                   SKU:=ObjOrder.ProductID(),
-                                   ReverseQty := nReverseQtyNew,
-                                   CustomerCode := ObjOrder.CustomerName(),
-                                   CustomerName := ObjOrder.CustomerName(),
-                                   ForecastQty := nForecastQtyNew,
-                                   OrderDateTime := ObjOrder.EndDate(),
-                                   OrderQty := [Number]ObjOrder.Quantity().Round( 0),
-                                   OrderCode:=ObjOrder.OrderID(),
-                                   AuthorizeQty := nAuthorizeQtyNew,
-                                   ReverseDeductQty := nReverseQtyOld - nReverseQtyNew,
-                                   AuthorizeDeductQty := 0,
-                                   ForecastHitQty :=nHaveForecastQty,
-                                   ForecastNoHitQty :=nNoHaveForecastQty,
-                                   OperateType := OperatorType,
-                                   Operator := Operator,
-                                   Unit := ObjOrder.UnitOfMeasureName(),
-                                   OperateQty := [Number]ObjOrder.Quantity().Round( 0),
-                                   OperateTime := DateTime::ActualTime());
-                                   
-            // 鏇存柊褰撳墠鍙嶇鏁伴噺
-            if( not isnull( ObjReverse))
-            {
-              ObjReverse.ReverseRealQty(nReverseQtyNew);
+               ObjOrder.Delete();  
             }
             else
             {
-              Owner.H_ReverseRealQty(relnew,ID := H_FunctionClass::SM_GenerateID( "RQ"),SKU := ObjOrder.ProductID(),Unit := ObjOrder.UnitOfMeasureName()
-                                      ,ReverseRealQty := nReverseQtyNew);
-            } 
-            // 鏇存柊鎺堟潈
-            if( not isnull( ObjAuthorize))
-            {
-              ObjAuthorize.AuthorizeRealQty(nAuthorizeQtyNew);
+              //----------------------------------------浠ヤ笅鍚庡幓棰勬祴 鍙嶇 鎺堟潈鏁版嵁淇℃伅----------------
+              nForecastQtyOld := 0; //鍘熼娴嬫暟閲�
+              nReverseQtyOld :=0;   //鍘熷弽绛炬暟閲�
+              nAuthorizeQtyOld :=0; //鍘熸巿鏉冩暟閲�
+              nForecastQtyNew :=0;  //璁$畻鍚庣殑棰勬祴鏁伴噺
+              nReverseQtyNew :=0;   //璁$畻鍚庣殑鍙嶇鏁伴噺
+              nAuthorizeQtyNew :=0; //璁$畻鍚庣殑鎺堟潈鏁伴噺
+              nHaveForecastQty :=0; //鏈夐娴嬫暟閲�
+              nNoHaveForecastQty:=0;//浜旈娴嬫暟閲�
+              OrderQuantity := 0;   //鍓╀綑璁㈠崟鏁伴噺
+              // 鑾峰彇棰勬祴鏁伴噺锛堝鎴�+SKU+鏈堜唤 鐞嗚鏄病鏈夌墿鏂欓娴嬶級
+              OrderForecast := select(Owner, H_OrderForecastRealQty , Obj, Obj.SKU() = ObjOrder.ProductID() 
+                                                    and Obj.CustomCode() = ObjOrder.CustomerName() 
+                                                    and Obj.Month().Format( "YM2") =ObjOrder.EndDate().Format( "YM2"));
+              if ( not isnull(OrderForecast))
+              {
+                  nForecastQtyOld := OrderForecast.ForecatsRealQty();
+                  nForecastQtyNew := nForecastQtyOld;
+              }
+              // 鑾峰彇鍙嶇鏁伴噺锛堝彧鍒ゆ柇SKU锛�
+              ObjReverse := select(Owner, H_ReverseRealQty , Obj, Obj.SKU() = ObjOrder.ProductID());
+              if ( not isnull(ObjReverse))
+              {
+                  nReverseQtyOld := ObjReverse.ReverseRealQty();
+                  nReverseQtyNew := nReverseQtyOld;
+              }
+              // 鑾峰彇鎺堟潈鏁伴噺锛堝鎴稩D+SKU锛�
+              ObjAuthorize := select(Owner, H_AuthorizeRealQty , Obj, Obj.SKU() = ObjOrder.ProductID() 
+                                                                      and Obj.CustomID() = ObjOrder.CustomerName());
+              if ( not isnull(ObjAuthorize))
+              {
+                  nAuthorizeQtyOld := ObjAuthorize.AuthorizeRealQty();
+                  nAuthorizeQtyNew :=nAuthorizeQtyOld;
+              }
+              //-----------------------------浠ヤ笅璁㈠崟鍐插噺--------------------
+              // 鎺堟潈璁板綍ID
+              AQID := H_FunctionClass::SM_GenerateID( "AQ");
+              // 璁㈠崟鍓╀綑鏁伴噺
+              OrderQuantity := [Number]ObjOrder.Quantity().Round( 0);
+              // 1 鍏堝啿鎺堟潈
+              if( OrderQuantity>0 and nAuthorizeQtyOld>0)
+              { 
+                 OrderQuantity := OrderQuantity-nAuthorizeQtyOld;
+                 nAuthorizeQtyNew :=0; 
+                 if( OrderQuantity<0)
+                 {
+                   nAuthorizeQtyNew := abs(OrderQuantity);
+                   OrderQuantity :=0;
+                 }
+              }
+              // 2 鍐嶅啿鍙嶇
+              if( OrderQuantity>0 and nReverseQtyOld>0)
+              { 
+                 OrderQuantity := OrderQuantity-nReverseQtyOld;
+                 nReverseQtyNew :=0; 
+                 if( OrderQuantity<0)
+                 {
+                   nReverseQtyNew := abs(OrderQuantity);
+                   OrderQuantity :=0;
+                 }
+              }
+              // 3 鏈�鍚庡啿棰勬祴
+              if( OrderQuantity>0)
+              { 
+                 //榛樿璁㈠崟鏁伴噺>棰勬祴鏁伴噺
+                 OrderQuantity := OrderQuantity-nForecastQtyOld;
+                 nForecastQtyNew :=0;
+                 nHaveForecastQty := nForecastQtyOld;
+                 nNoHaveForecastQty := OrderQuantity; 
+                 if( OrderQuantity<0)
+                 {
+                   nForecastQtyNew := abs(OrderQuantity);
+                   OrderQuantity :=0;
+                   nHaveForecastQty := nForecastQtyOld - nForecastQtyNew;
+                   nNoHaveForecastQty := 0;
+                 }
+              }
+              // 璁板綍鍔ㄤ綔
+              Owner.H_OrderRecord(relnew,
+                                     ID := AQID,
+                                     VCode:=VCode,
+                                     SKU:=ObjOrder.ProductID(),
+                                     ReverseQty := nReverseQtyNew,
+                                     CustomerCode := ObjOrder.CustomerName(),
+                                     CustomerName := ObjOrder.CustomerName(),
+                                     ForecastQty := nForecastQtyNew,
+                                     OrderDateTime := ObjOrder.EndDate(),
+                                     OrderQty := [Number]ObjOrder.Quantity().Round( 0),
+                                     OrderCode:=ObjOrder.OrderID(),
+                                     AuthorizeQty := nAuthorizeQtyNew,
+                                     ReverseDeductQty := nReverseQtyOld - nReverseQtyNew,
+                                     AuthorizeDeductQty := 0,
+                                     ForecastHitQty :=nHaveForecastQty,
+                                     ForecastNoHitQty :=nNoHaveForecastQty,
+                                     OperateType := OperatorType,
+                                     Operator := Operator,
+                                     Unit := ObjOrder.UnitOfMeasureName(),
+                                     OperateQty := [Number]ObjOrder.Quantity().Round( 0),
+                                     OperateTime := DateTime::ActualTime());
+              // 绾娴嬭鍗�
+              if( nForecastQtyNew>0)
+              {
+                FOrder := ObjOrder.Copy();
+                FOrder.OrderTag("绾娴�");
+                FOrder.Quantity(nForecastQtyNew);
+              }
+              // 鏈夐娴嬭鍗�
+              if(nHaveForecastQty>0)
+              {
+                HFOrder := ObjOrder.Copy();
+                HFOrder.OrderTag("鏈夐娴�");
+                HFOrder.Quantity(nHaveForecastQty);
+              }
+              // 鏃犻娴�
+              if(nNoHaveForecastQty>0)
+              {
+                NHFOrder := ObjOrder.Copy();
+                NHFOrder.OrderTag("鏃犻娴�");
+                NHFOrder.Quantity(nNoHaveForecastQty);
+              }
+              // ERP鍙嶇鎺堟潈璁㈠崟-鎺ュ彛鏈彁渚�
+             
+              // 鏇存柊褰撳墠鍙嶇鏁伴噺
+              if( not isnull( ObjReverse))
+              {
+                ObjReverse.ReverseRealQty(nReverseQtyNew);
+              }
+              else
+              {
+                Owner.H_ReverseRealQty(relnew,ID := H_FunctionClass::SM_GenerateID( "RQ"),SKU := ObjOrder.ProductID(),Unit := ObjOrder.UnitOfMeasureName()
+                                        ,ReverseRealQty := nReverseQtyNew);
+              } 
+              // 鏇存柊鎺堟潈
+              if( not isnull( ObjAuthorize))
+              {
+                ObjAuthorize.AuthorizeRealQty(nAuthorizeQtyNew);
+              }
+              else
+              {
+                Owner.H_AuthorizeRealQty(relnew,ID := H_FunctionClass::SM_GenerateID( "AR"),SKU := ObjOrder.ProductID(),
+                                                                                                Month := ObjOrder.EndDate(),
+                                                                                                CustomID := ObjOrder.CustomerName(),
+                                                                                                CustomName := ObjOrder.CustomerName(),
+                                                                                                OrderCode := "-",
+                                                                                                AuthorizeRealQty :=nAuthorizeQtyNew,
+                                                                                                Unit := ObjOrder.UnitOfMeasureName());
+              } 
+              // 鏇存柊棰勬祴
+              if( not isnull( OrderForecast))
+              {
+                OrderForecast.ForecatsRealQty(nForecastQtyNew);
+              }
+              else
+              {
+                Owner.H_OrderForecastRealQty(relnew,ID := H_FunctionClass::SM_GenerateID( "OF"),SKU := ObjOrder.ProductID(),
+                                                                                                Month := ObjOrder.EndDate(),
+                                                                                                CustomCode := ObjOrder.CustomerName(),
+                                                                                                CustomName := ObjOrder.CustomerName(),
+                                                                                                ForecastQty := 0,
+                                                                                                ForecatsRealQty :=nForecastQtyNew,
+                                                                                                Unit := ObjOrder.UnitOfMeasureName());
+              }
+              ObjOrder.Delete();
             }
-            else
-            {
-              Owner.H_AuthorizeRealQty(relnew,ID := H_FunctionClass::SM_GenerateID( "AR"),SKU := ObjOrder.ProductID(),
-                                                                                              Month := ObjOrder.EndDate(),
-                                                                                              CustomID := ObjOrder.CustomerName(),
-                                                                                              CustomName := ObjOrder.CustomerName(),
-                                                                                              OrderCode := "-",
-                                                                                              AuthorizeRealQty :=nAuthorizeQtyNew,
-                                                                                              Unit := ObjOrder.UnitOfMeasureName());
-            } 
-            // 鏇存柊棰勬祴
-            if( not isnull( OrderForecast))
-            {
-              OrderForecast.ForecatsRealQty(nForecastQtyNew);
-            }
-            else
-            {
-              Owner.H_OrderForecastRealQty(relnew,ID := H_FunctionClass::SM_GenerateID( "OF"),SKU := ObjOrder.ProductID(),
-                                                                                              Month := ObjOrder.EndDate(),
-                                                                                              CustomID := ObjOrder.CustomerName(),
-                                                                                              CustomName := ObjOrder.CustomerName(),
-                                                                                              OrderCode := "-",
-                                                                                              ForecatsQty :=0,
-                                                                                              ForecatsRealQty :=nForecastQtyNew,
-                                                                                              Unit := ObjOrder.UnitOfMeasureName());
-            } 
           }
         }
         else
         {
           strMsg:="棰勬祴璁㈠崟淇℃伅鍔犺浇澶辫触锛岃鑱旂郴绯荤粺绠$悊鍛橈紒";
-        }    
+        }  
       }
     }
     onerror
diff --git a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_OrderReverseOrAuthorize.qbl b/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_OrderReverseOrAuthorize.qbl
index 72a96c0..a74b90f 100644
--- a/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_OrderReverseOrAuthorize.qbl
+++ b/_Main/BL/Type_H_FunctionClass/StaticMethod_SM_OrderReverseOrAuthorize.qbl
@@ -42,7 +42,7 @@
         nNoHaveForecastQty:=0;//浜旈娴嬫暟閲�
         // 鑾峰彇棰勬祴鏁伴噺锛堝鎴�+SKU+鏈堜唤 鐞嗚鏄病鏈夌墿鏂欓娴嬶級
         OrderForecast := select(Owner, H_OrderForecastRealQty , Obj, Obj.SKU() = SKU 
-                                              and Obj.CustomID() = CustomerCode 
+                                              and Obj.CustomCode() = CustomerCode 
                                               and Obj.Month().Format( "YM2") = Date::ActualDate().Format( "YM2"));
         if ( not isnull(OrderForecast))
         {
@@ -189,10 +189,9 @@
           {
             Owner.H_OrderForecastRealQty(relnew,ID := H_FunctionClass::SM_GenerateID( "OF"),SKU := SKU,
                                                                                             Month := Date::ActualDate(),
-                                                                                            CustomID := CustomerCode,
+                                                                                            CustomCode := CustomerCode,
                                                                                             CustomName := CustomName,
-                                                                                            OrderCode := "-",
-                                                                                            ForecatsQty :=0,
+                                                                                            ForecastQty := 0,
                                                                                             ForecatsRealQty :=nForecastQtyNew,
                                                                                             Unit := Unit);
           } 
diff --git a/_Main/BL/Type_H_FunctionClass/StaticMethod_UpdateOrderForecastRealQty.qbl b/_Main/BL/Type_H_FunctionClass/StaticMethod_UpdateOrderForecastRealQty.qbl
index 988d53e..4a0d857 100644
--- a/_Main/BL/Type_H_FunctionClass/StaticMethod_UpdateOrderForecastRealQty.qbl
+++ b/_Main/BL/Type_H_FunctionClass/StaticMethod_UpdateOrderForecastRealQty.qbl
@@ -24,7 +24,7 @@
         for ( x := 1; x <= 10; x := x + 1 )
         {
             Owner.H_OrderForecastRealQty(relnew,ID := "AAAAA_"+ x.AsQUILL(),SKU := "OTN-01-ACC-00"+ x.AsQUILL() , Month := Date::ActualDate(),CustomName := "灏忕背",
-                                          CustomID := "XM0001",OrderCode:="OD0001",ForecatsQty:=1000,ForecatsRealQty:=1000, Unit := "PCS");
+                                          CustomCode := "XM0001",ForecastQty := 1000,ForecatsRealQty:=1000, Unit := "PCS");
         }
       }
       //H_FunctionClass := Owner.H_FunctionClass(relnew,VCode_Material := VCode,UpdateTime_Material := Date::ActualDate());
diff --git a/_Main/BL/Type_H_OrderForecastRealQty/Attribute_CustomCode.qbl b/_Main/BL/Type_H_OrderForecastRealQty/Attribute_CustomCode.qbl
new file mode 100644
index 0000000..9cb80f6
--- /dev/null
+++ b/_Main/BL/Type_H_OrderForecastRealQty/Attribute_CustomCode.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute CustomCode
+{
+  #keys: '3[414724.0.174571651][414724.0.174571650][414724.0.174571652]'
+  Description: '瀹㈡埛ID锛屽敮涓�寤轰箣涓�'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_H_OrderForecastRealQty/Attribute_CustomID.qbl b/_Main/BL/Type_H_OrderForecastRealQty/Attribute_CustomID.qbl
deleted file mode 100644
index f0cb7e7..0000000
--- a/_Main/BL/Type_H_OrderForecastRealQty/Attribute_CustomID.qbl
+++ /dev/null
@@ -1,8 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Attribute CustomID
-{
-  #keys: '3[414724.0.46380328][414724.0.46380327][414724.0.46380329]'
-  Description: '瀹㈡埛ID'
-  ValueType: String
-}
diff --git a/_Main/BL/Type_H_OrderForecastRealQty/Attribute_Department.qbl b/_Main/BL/Type_H_OrderForecastRealQty/Attribute_Department.qbl
new file mode 100644
index 0000000..efe5e78
--- /dev/null
+++ b/_Main/BL/Type_H_OrderForecastRealQty/Attribute_Department.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute Department
+{
+  #keys: '3[414724.0.174571661][414724.0.174571660][414724.0.174571662]'
+  Description: '閮ㄩ棬锛屾病鏈変环鍊硷紝鏄剧ず浣跨敤'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_H_OrderForecastRealQty/Attribute_ForecatsQty.qbl b/_Main/BL/Type_H_OrderForecastRealQty/Attribute_ForecastQty.qbl
similarity index 87%
rename from _Main/BL/Type_H_OrderForecastRealQty/Attribute_ForecatsQty.qbl
rename to _Main/BL/Type_H_OrderForecastRealQty/Attribute_ForecastQty.qbl
index 2edd0bc..bdc2eb0 100644
--- a/_Main/BL/Type_H_OrderForecastRealQty/Attribute_ForecatsQty.qbl
+++ b/_Main/BL/Type_H_OrderForecastRealQty/Attribute_ForecastQty.qbl
@@ -1,6 +1,6 @@
 Quintiq file version 2.0
 #parent: #root
-Attribute ForecatsQty
+Attribute ForecastQty
 {
   #keys: '3[414724.0.46380358][414724.0.46380357][414724.0.46380359]'
   Description: '棰勬祴鏁伴噺'
diff --git a/_Main/BL/Type_H_OrderForecastRealQty/Attribute_Month.qbl b/_Main/BL/Type_H_OrderForecastRealQty/Attribute_Month.qbl
index cc1224e..8e83213 100644
--- a/_Main/BL/Type_H_OrderForecastRealQty/Attribute_Month.qbl
+++ b/_Main/BL/Type_H_OrderForecastRealQty/Attribute_Month.qbl
@@ -3,6 +3,6 @@
 Attribute Month
 {
   #keys: '3[414724.0.46380308][414724.0.46380307][414724.0.46380309]'
-  Description: '鏈堜唤'
+  Description: '鏈堜唤锛屽敮涓�閿箣涓�'
   ValueType: Date
 }
diff --git a/_Main/BL/Type_H_OrderForecastRealQty/Attribute_OrderCode.qbl b/_Main/BL/Type_H_OrderForecastRealQty/Attribute_OrderCode.qbl
deleted file mode 100644
index 66e08c7..0000000
--- a/_Main/BL/Type_H_OrderForecastRealQty/Attribute_OrderCode.qbl
+++ /dev/null
@@ -1,8 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Attribute OrderCode
-{
-  #keys: '3[414724.0.46380338][414724.0.46380337][414724.0.46380339]'
-  Description: '璁㈠崟缂栧彿'
-  ValueType: String
-}
diff --git a/_Main/BL/Type_H_OrderForecastRealQty/Attribute_SKU.qbl b/_Main/BL/Type_H_OrderForecastRealQty/Attribute_SKU.qbl
index a9eab85..5f2e17f 100644
--- a/_Main/BL/Type_H_OrderForecastRealQty/Attribute_SKU.qbl
+++ b/_Main/BL/Type_H_OrderForecastRealQty/Attribute_SKU.qbl
@@ -3,6 +3,6 @@
 Attribute SKU
 {
   #keys: '3[414724.0.46380348][414724.0.46380347][414724.0.46380349]'
-  Description: 'SKU缂栫爜'
+  Description: 'SKU缂栫爜锛屽敮涓�閿箣涓�'
   ValueType: String
 }
diff --git a/_Main/BL/Type_H_OrderForecastRealQty/Attribute_SKUName.qbl b/_Main/BL/Type_H_OrderForecastRealQty/Attribute_SKUName.qbl
new file mode 100644
index 0000000..ddbce61
--- /dev/null
+++ b/_Main/BL/Type_H_OrderForecastRealQty/Attribute_SKUName.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute SKUName
+{
+  #keys: '3[414724.0.174572228][414724.0.174572227][414724.0.174572229]'
+  Description: 'SKU鍚嶇О'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_H_OrderForecastRealQty/Attribute_StockingPointID.qbl b/_Main/BL/Type_H_OrderForecastRealQty/Attribute_StockingPointID.qbl
new file mode 100644
index 0000000..ebf027f
--- /dev/null
+++ b/_Main/BL/Type_H_OrderForecastRealQty/Attribute_StockingPointID.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute StockingPointID
+{
+  #keys: '3[414724.0.174571671][414724.0.174571670][414724.0.174571672]'
+  Description: '搴撳瓨鐐癸紝娌℃湁浠峰�硷紝鏄剧ず浣跨敤'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_H_OrderForecastRealQty/Attribute_Unit.qbl b/_Main/BL/Type_H_OrderForecastRealQty/Attribute_Unit.qbl
index 6569ece..eb7052c 100644
--- a/_Main/BL/Type_H_OrderForecastRealQty/Attribute_Unit.qbl
+++ b/_Main/BL/Type_H_OrderForecastRealQty/Attribute_Unit.qbl
@@ -3,6 +3,6 @@
 Attribute Unit
 {
   #keys: '3[414724.0.46380378][414724.0.46380377][414724.0.46380379]'
-  Description: '鍗曚綅'
+  Description: '鍗曚綅锛屾病鏈変环鍊硷紝鏄剧ず浣跨敤'
   ValueType: String
 }
diff --git a/_Main/BL/Type_H_OrderForecastRealQty/Attribute_VCode.qbl b/_Main/BL/Type_H_OrderForecastRealQty/Attribute_VCode.qbl
new file mode 100644
index 0000000..fb94eeb
--- /dev/null
+++ b/_Main/BL/Type_H_OrderForecastRealQty/Attribute_VCode.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute VCode
+{
+  #keys: '3[414724.0.174571641][414724.0.174571640][414724.0.174571642]'
+  Description: '鐗堟湰鍙凤紝鏆傛椂涓嶉�傜敤锛岄粯璁�-'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl
index eeb6a49..e826ddb 100644
--- a/_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl
+++ b/_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl
@@ -42,12 +42,13 @@
                           infinite, 
                           unitofmeasurename );
     
-    Unit::CreateOrUpdate( this, 
+    supplyunit := Unit::CreateOrUpdate( this, 
                           "渚涘簲鍟�", 
                           "渚涘簲鍟�", 
                           "澶╅┈闆嗗洟", 
                           infinite, 
                           unitofmeasurename );
+    supplyunit.IsSupplier(true);
     
     Unit::CreateOrUpdate( this, 
                           "鏁磋溅杩愯緭", 
diff --git a/_Main/BL/Type_PriorityFactor/Attribute_ReflectionAttribute.qbl b/_Main/BL/Type_PriorityFactor/Attribute_ReflectionAttribute.qbl
new file mode 100644
index 0000000..3f5a69d
--- /dev/null
+++ b/_Main/BL/Type_PriorityFactor/Attribute_ReflectionAttribute.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute ReflectionAttribute
+{
+  #keys: '3[414382.0.554303396][414382.0.554303395][414382.0.554303397]'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_PriorityFactor/Attribute_ReflectionType.qbl b/_Main/BL/Type_PriorityFactor/Attribute_ReflectionType.qbl
new file mode 100644
index 0000000..49b163b
--- /dev/null
+++ b/_Main/BL/Type_PriorityFactor/Attribute_ReflectionType.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute ReflectionType
+{
+  #keys: '3[414382.0.554014806][414382.0.554014805][414382.0.554014807]'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_PriorityFactor/StaticMethod_CheckNameValid.qbl b/_Main/BL/Type_PriorityFactor/StaticMethod_CheckNameValid.qbl
new file mode 100644
index 0000000..4fa81fb
--- /dev/null
+++ b/_Main/BL/Type_PriorityFactor/StaticMethod_CheckNameValid.qbl
@@ -0,0 +1,29 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod CheckNameValid (
+  MacroPlan owner,
+  String businessType,
+  Real coefficient,
+  String desc,
+  String name
+) as Boolean
+{
+  TextBody:
+  [*
+    // NBoTk Sep-22-2023 (created)
+    
+    value := true;
+    
+    // 鍚嶇О鐩稿悓璺宠繃
+    obj := selectobject( owner,PriorityFactor,p,
+                        p.BusinessType() = businessType and p.Coefficient() = coefficient and p.Name() = name and p.Desc() = desc
+                        );
+    
+    if(not isnull( obj) )
+    {
+        value := false;
+    }
+    
+    return value;
+  *]
+}
diff --git a/_Main/BL/Type_PriorityFactor/StaticMethod_InitData.qbl b/_Main/BL/Type_PriorityFactor/StaticMethod_InitData.qbl
index 1d5ff08..76858f0 100644
--- a/_Main/BL/Type_PriorityFactor/StaticMethod_InitData.qbl
+++ b/_Main/BL/Type_PriorityFactor/StaticMethod_InitData.qbl
@@ -1,41 +1,34 @@
 Quintiq file version 2.0
 #parent: #root
 StaticMethod InitData (
-  MacroPlan owner
+  MacroPlan owner,
+  String businessType
 )
 {
   TextBody:
   [*
     // NBoTk Sep-15-2023 (created)
-    
-    info(" init PriorutyFactor");
-    
     // businessType
     // result := "闆嗗洟闈㈡澘;涓撲笟鏄剧ず浜嬩笟閮�;澶栧崠CELL;闈炴樉;杩愬姩鍋ュ悍;杩愬姩鍋ュ悍浜嬩笟閮�;鎵嬫満浜嬩笟閮�;鐗圭鏄剧ず;姹借溅鐢靛瓙浜嬩笟閮�;杞﹁浇鏄剧ず浜嬩笟閮�;IT浜嬩笟閮�";
-    businessTypeList := construct( structured[String]);
-    businessTypeList.Add( "闆嗗洟闈㈡澘");
-    businessTypeList.Add( "涓撲笟鏄剧ず浜嬩笟閮�");
-    businessTypeList.Add( "澶栧崠CELL");
-    businessTypeList.Add( "闈炴樉");
-    businessTypeList.Add( "杩愬姩鍋ュ悍");
-    businessTypeList.Add( "杩愬姩鍋ュ悍浜嬩笟閮�");
-    businessTypeList.Add( "鎵嬫満浜嬩笟閮ㄩ潰鏉�");
-    businessTypeList.Add( "鐗圭鏄剧ず");
-    businessTypeList.Add( "姹借溅鐢靛瓙浜嬩笟閮ㄩ潰鏉�");
-    businessTypeList.Add( "杞﹁浇鏄剧ず浜嬩笟閮�");
-    businessTypeList.Add( "IT浜嬩笟閮�");
+    // 娣诲姞浜嬩笟閮ㄥ搴旂殑棰勫埗浼樺厛绾у洜瀛愭暟鎹�
+    owner.PriorityFactor(relnew,Name := "瀹㈡埛绛栫暐" ,Desc := "灏嗕簨涓氶儴璁$畻鐨勪紭鍏堢骇锛屾寜璇ョ粏鍒嗛」姣斾緥闃舵纭畾璇ラ」寰楀垎銆傚锛�81%鈮鈮�100% 5鍒嗭紝61%鈮鈮�80% 4鍒�", BusinessType := businessType );
+    owner.PriorityFactor(relnew,Name := "瀹㈡埛绛夌骇" ,Desc := "鏍规嵁闇�姹傛暟鎹腑瀹㈡埛锛屽尮閰嶅鎴风瓑绾�",BusinessType := businessType);
+    owner.PriorityFactor(relnew,Name := "澶у紶鐩堝埄姘村钩" ,Desc := "1銆佽幏鍙栧鎴�*SKU澶у紶鐩堝埄鏁� 2銆佸畾涔夊鎴�*SKU澶у紶鐩堝埄鏁伴樁姊緱鍒� 3銆佸尮閰嶉渶姹傛暟鎹腑瀹㈡埛鍙奡KU鏁版嵁锛屽緱鍒板搴旈樁姊緱鍒�", BusinessType := businessType );
+    owner.PriorityFactor(relnew,Name := "缁嗗垎甯傚満绛夌骇" ,Desc := "1銆佽幏鍙栧鎴�*SKU瀵瑰簲缁嗗垎甯傚満绛夌骇 2銆佸尮閰嶉渶姹傛暟鎹腑瀹㈡埛鍙奡KU瀵瑰簲缁嗗垎甯傚満璇勫垎绛夌骇锛屽緱鍒板搴旈樁姊緱鍒�", BusinessType := businessType );
+    owner.PriorityFactor(relnew,Name := "闇�姹傜被鍨�" ,Desc := "鍖归厤涓嶅悓闇�姹傜绫伙紝寰楀埌瀵瑰簲寰楀垎", BusinessType := businessType );
+    owner.PriorityFactor(relnew,Name := "璁㈠崟涓嬪崟鏃堕棿" ,Desc := "鏍规嵁闇�姹傝鍗曚腑涓嬪崟鏃堕棿涓庨渶姹傛椂闂村樊鍊硷紝鍖归厤闃舵寰楀垎", BusinessType := businessType );
+    owner.PriorityFactor(relnew,Name := "浜у搧绛夌骇" ,Desc := "1銆佽幏鍙栧鎴�*SKU DOI&DSI鏁� 2銆佸畾涔夊鎴�*SKUDOI&DSI鏁伴樁姊緱鍒� 3銆佸尮閰嶉渶姹傛暟鎹腑瀹㈡埛鍙奡KU鏁版嵁锛屽緱鍒板搴旈樁姊緱鍒�", BusinessType := businessType );
+    owner.PriorityFactor(relnew,Name := "DOI" ,Desc := "1銆佽幏鍙栧鎴�*SKU DOI&DSI鏁� 2銆佸畾涔夊鎴�*SKUDOI&DSI鏁伴樁姊緱鍒� 3銆佸尮閰嶉渶姹傛暟鎹腑瀹㈡埛鍙奡KU鏁版嵁锛屽緱鍒板搴旈樁姊緱鍒�", BusinessType := businessType );
+    owner.PriorityFactor(relnew,Name := "DSI" ,Desc := "1銆佽幏鍙栧鎴�*SKU DOI&DSI鏁� 2銆佸畾涔夊鎴�*SKUDOI&DSI鏁伴樁姊緱鍒� 3銆佸尮閰嶉渶姹傛暟鎹腑瀹㈡埛鍙奡KU鏁版嵁锛屽緱鍒板搴旈樁姊緱鍒�", BusinessType := businessType );
     
-    traverse( businessTypeList,Elements,b)
+    // 浼樺厛绾у洜瀛愮粏鍒�
+    priorityFactorList := selectset( owner,PriorityFactor,p,
+                                     p.BusinessType() = businessType
+                                     );
+    
+    traverse( priorityFactorList,Elements,e)
     {
-        owner.PriorityFactor(relnew,Name := "瀹㈡埛绛栫暐" ,Desc := "灏嗕簨涓氶儴璁$畻鐨勪紭鍏堢骇锛屾寜璇ョ粏鍒嗛」姣斾緥闃舵纭畾璇ラ」寰楀垎銆傚锛�81%鈮鈮�100% 5鍒嗭紝61%鈮鈮�80% 4鍒�", BusinessType := b );
-        owner.PriorityFactor(relnew,Name := "瀹㈡埛绛夌骇" ,Desc := "鏍规嵁闇�姹傛暟鎹腑瀹㈡埛锛屽尮閰嶅鎴风瓑绾�",BusinessType := b);
-        owner.PriorityFactor(relnew,Name := "澶у紶鐩堝埄姘村钩" ,Desc := "1銆佽幏鍙栧鎴�*SKU澶у紶鐩堝埄鏁� 2銆佸畾涔夊鎴�*SKU澶у紶鐩堝埄鏁伴樁姊緱鍒� 3銆佸尮閰嶉渶姹傛暟鎹腑瀹㈡埛鍙奡KU鏁版嵁锛屽緱鍒板搴旈樁姊緱鍒�", BusinessType := b );
-        owner.PriorityFactor(relnew,Name := "缁嗗垎甯傚満绛夌骇" ,Desc := "1銆佽幏鍙栧鎴�*SKU瀵瑰簲缁嗗垎甯傚満绛夌骇 2銆佸尮閰嶉渶姹傛暟鎹腑瀹㈡埛鍙奡KU瀵瑰簲缁嗗垎甯傚満璇勫垎绛夌骇锛屽緱鍒板搴旈樁姊緱鍒�", BusinessType := b );
-        owner.PriorityFactor(relnew,Name := "闇�姹傜被鍨�" ,Desc := "鍖归厤涓嶅悓闇�姹傜绫伙紝寰楀埌瀵瑰簲寰楀垎", BusinessType := b );
-        owner.PriorityFactor(relnew,Name := "璁㈠崟涓嬪崟鏃堕棿" ,Desc := "鏍规嵁闇�姹傝鍗曚腑涓嬪崟鏃堕棿涓庨渶姹傛椂闂村樊鍊硷紝鍖归厤闃舵寰楀垎", BusinessType := b );
-        owner.PriorityFactor(relnew,Name := "浜у搧绛夌骇" ,Desc := "1銆佽幏鍙栧鎴�*SKU DOI&DSI鏁� 2銆佸畾涔夊鎴�*SKUDOI&DSI鏁伴樁姊緱鍒� 3銆佸尮閰嶉渶姹傛暟鎹腑瀹㈡埛鍙奡KU鏁版嵁锛屽緱鍒板搴旈樁姊緱鍒�", BusinessType := b );
-        owner.PriorityFactor(relnew,Name := "DOI" ,Desc := "1銆佽幏鍙栧鎴�*SKU DOI&DSI鏁� 2銆佸畾涔夊鎴�*SKUDOI&DSI鏁伴樁姊緱鍒� 3銆佸尮閰嶉渶姹傛暟鎹腑瀹㈡埛鍙奡KU鏁版嵁锛屽緱鍒板搴旈樁姊緱鍒�", BusinessType := b );
-        owner.PriorityFactor(relnew,Name := "DSI" ,Desc := "1銆佽幏鍙栧鎴�*SKU DOI&DSI鏁� 2銆佸畾涔夊鎴�*SKUDOI&DSI鏁伴樁姊緱鍒� 3銆佸尮閰嶉渶姹傛暟鎹腑瀹㈡埛鍙奡KU鏁版嵁锛屽緱鍒板搴旈樁姊緱鍒�", BusinessType := b );
+        PriorityFactorDetails::InitData( owner,e); 
     }
   *]
 }
diff --git a/_Main/BL/Type_PriorityFactorDetails/StaticMethod_CreateTestData.qbl b/_Main/BL/Type_PriorityFactorDetails/StaticMethod_CreateTestData.qbl
deleted file mode 100644
index 4954d67..0000000
--- a/_Main/BL/Type_PriorityFactorDetails/StaticMethod_CreateTestData.qbl
+++ /dev/null
@@ -1,15 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-StaticMethod CreateTestData (
-  MacroPlan owner
-)
-{
-  TextBody:
-  [*
-    // NBoTk Sep-18-2023 (created)
-    
-    info( "init data" );
-    PriorityFactor::InitData( owner);
-    PriorityFactorDetails::InitData( owner);
-  *]
-}
diff --git a/_Main/BL/Type_PriorityFactorDetails/StaticMethod_InitData.qbl b/_Main/BL/Type_PriorityFactorDetails/StaticMethod_InitData.qbl
index 9327dbe..1449c61 100644
--- a/_Main/BL/Type_PriorityFactorDetails/StaticMethod_InitData.qbl
+++ b/_Main/BL/Type_PriorityFactorDetails/StaticMethod_InitData.qbl
@@ -1,35 +1,102 @@
 Quintiq file version 2.0
 #parent: #root
 StaticMethod InitData (
-  MacroPlan owner
+  MacroPlan owner,
+  PriorityFactor priorityFactor
 )
 {
   TextBody:
   [*
     // NBoTk Sep-17-2023 (created)
     
-    info(" init PriorutyFactorDetails" );
-    
-    
-    
-    traverse( owner, PriorityFactor , p) 
+    isBusinessType := false;
+    if( priorityFactor.BusinessType() <> "闆嗗洟闈㈡澘" )
     {
-        isBusinessType := false;
-        if( p.BusinessType() <> "闆嗗洟闈㈡澘" )
-        {
-            isBusinessType := true; 
-        }
-      
-        p.PriorityFactorDetails(relnew,BusinessType := p.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 5,
-                                     IsRange := false,GradingName := "澶х泩",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := p.Name());
-        p.PriorityFactorDetails(relnew,BusinessType := p.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 3,
-                                     IsRange := false,GradingName := "灏忕泩",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := p.Name());
-        p.PriorityFactorDetails(relnew,BusinessType := p.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 0,
-                                     IsRange := false,GradingName := "鎸佸钩",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := p.Name());
-        p.PriorityFactorDetails(relnew,BusinessType := p.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := -3,
-                                     IsRange := false,GradingName := "灏忎簭",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := p.Name());
-        p.PriorityFactorDetails(relnew,BusinessType := p.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := -5,
-                                     IsRange := false,GradingName := "澶т簭",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := p.Name());
+        isBusinessType := true; 
+    }
+    
+    if( priorityFactor.Name() = "澶у紶鐩堝埄姘村钩" )
+    {
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 5,
+                                            IsRange := false,GradingName := "澶х泩",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 3,
+                                                IsRange := false,GradingName := "灏忕泩",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 0,
+                                                IsRange := false,GradingName := "鎸佸钩",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := -3,
+                                                IsRange := false,GradingName := "灏忎簭",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := -5,
+                                                IsRange := false,GradingName := "澶т簭",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+    }
+    
+    if( priorityFactor.Name() = "瀹㈡埛绛栫暐" )
+    {
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 5,
+                                            IsRange := false,GradingName := "81%鈮鈮�100%",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 4,
+                                                IsRange := false,GradingName := "61%鈮鈮�80%",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 3,
+                                                IsRange := false,GradingName := "41%鈮鈮�60%",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 2,
+                                                IsRange := false,GradingName := "21%鈮鈮�40%",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 1,
+                                                IsRange := false,GradingName := "1%鈮鈮�20%",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+    }
+    
+    if( priorityFactor.Name() = "缁嗗垎甯傚満绛夌骇" )
+    {
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 5,
+                                            IsRange := false,GradingName := "鎴樼暐",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 3,
+                                                IsRange := false,GradingName := "閲嶇偣",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 1,
+                                                IsRange := false,GradingName := "娼滃姏",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+    }
+    
+    if( priorityFactor.Name() = "璁㈠崟涓嬪崟鏃堕棿" )
+    {
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 5,
+                                            IsRange := false,GradingName := "120",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 4,
+                                                IsRange := false,GradingName := "90",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 3,
+                                                IsRange := false,GradingName := "60",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 2,
+                                                IsRange := false,GradingName := "30",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 1,
+                                                IsRange := false,GradingName := "0",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+    }
+    
+    if( priorityFactor.Name() = "闇�姹傜被鍨�" )
+    {
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 5,
+                                            IsRange := false,GradingName := "鏈夐娴�",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 3,
+                                                IsRange := false,GradingName := "鏃犻娴�",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 1,
+                                                IsRange := false,GradingName := "绾娴�",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+    }
+    
+    if( priorityFactor.Name() = "瀹㈡埛绛夌骇" )
+    {
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 5,
+                                            IsRange := false,GradingName := "鎴樼暐",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 3,
+                                                IsRange := false,GradingName := "閲嶇偣",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 1,
+                                                IsRange := false,GradingName := "娼滃姏",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+    }
+    
+    if( priorityFactor.Name() = "DOI" or priorityFactor.Name() = "DSI")
+    {
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 5,
+                                            IsRange := false,GradingName := "<7",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 3,
+                                                IsRange := false,GradingName := "<15",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 1,
+                                                IsRange := false,GradingName := "<30",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());
+        priorityFactor.PriorityFactorDetails(relnew,BusinessType := priorityFactor.BusinessType(), IsBusinessType := isBusinessType,GradeTarget := 1,
+                                                IsRange := false,GradingName := ">30",RangeMin := 0.0,RangeMax := 0.0,PriorityFactorName := priorityFactor.Name());                                                                                     
     }
   *]
 }
diff --git a/_Main/BL/Type_PriorityPolicy/StaticMethod_RollBackCalcStr.qbl b/_Main/BL/Type_PriorityPolicy/StaticMethod_RollBackCalcStr.qbl
new file mode 100644
index 0000000..7c80e98
--- /dev/null
+++ b/_Main/BL/Type_PriorityPolicy/StaticMethod_RollBackCalcStr.qbl
@@ -0,0 +1,44 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod RollBackCalcStr (
+  MacroPlan owner,
+  String businessType,
+  String stringData
+) as String
+{
+  TextBody:
+  [*
+    // NBoTk Sep-21-2023 (created)
+    value := stringData;
+    
+    symbolList := construct( structured[String]);
+    symbolList.Add( "+")
+    symbolList.Add( "-")
+    symbolList.Add( "x")
+    symbolList.Add( "/")
+    symbolList.Add( "(")
+    symbolList.Add( ")")
+    
+    traverse( symbolList,Elements,e)
+    {
+        if( stringData.EndsWith( e ))
+        {
+             end := stringData.Length() - e.Length();
+             value := stringData.SubString( 0,end);
+        } 
+    }
+    
+    nameList := PriorityFactor::GetDataByBusinessType(  owner,businessType);       
+    traverse( nameList,Elements,e)
+    {
+        nameText := e.Name() + "[" + [String]e.Coefficient() + "*L]"
+        if( stringData.EndsWith( nameText))
+        {
+             end := stringData.Length() - nameText.Length();
+             value := stringData.SubString( 0,end);
+        } 
+    }
+    
+    return value;
+  *]
+}
diff --git a/_Main/BL/Type_PriorityResult/Attribute_CustomerOrderID.qbl b/_Main/BL/Type_PriorityResult/Attribute_CustomerOrderID.qbl
new file mode 100644
index 0000000..f65a510
--- /dev/null
+++ b/_Main/BL/Type_PriorityResult/Attribute_CustomerOrderID.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute CustomerOrderID
+{
+  #keys: '3[414382.0.554015006][414382.0.554015005][414382.0.554015007]'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_PriorityResult/StaticMethod_CalculateBracketScore.qbl b/_Main/BL/Type_PriorityResult/StaticMethod_CalculateBracketScore.qbl
new file mode 100644
index 0000000..962e51e
--- /dev/null
+++ b/_Main/BL/Type_PriorityResult/StaticMethod_CalculateBracketScore.qbl
@@ -0,0 +1,19 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod CalculateBracketScore (
+  String calcStr,
+  CustomerOrder customerOrder,
+  String businessType,
+  MacroPlan macroPlan,
+  GlobalOTDTable globalOTDTable
+) as Real
+{
+  Description: '璁$畻鍏紡涓嫭鍙峰唴鐨勬暟鎹�'
+  TextBody:
+  [*
+    // NBoTk Sep-26-2023 (created)
+    
+    
+    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
new file mode 100644
index 0000000..0cc1c80
--- /dev/null
+++ b/_Main/BL/Type_PriorityResult/StaticMethod_CalculateScore.qbl
@@ -0,0 +1,89 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod CalculateScore (
+  String formula,
+  CustomerOrder customerOrder,
+  String businessType,
+  MacroPlan macroPlan,
+  Real lastScore,
+  GlobalOTDTable globalOTDTable
+) as Real
+{
+  TextBody:
+  [*
+    // NBoTk Sep-26-2023 (created)
+    
+    score := 0.0;
+    remindFormula := formula;
+    
+    // 閬嶅巻浼樺厛绾у洜瀛愰厤缃�
+    
+    if( not remindFormula = '' )
+    {
+            // 浠庤捣濮嬩綅缃紑濮嬪尮閰� 
+            if(remindFormula.StartsWith( "+" ))
+            {
+                remindFormula := remindFormula.SubString( 1,remindFormula.Length());
+                score := PriorityResult::GetDetailsValue( customerOrder,remindFormula,macroPlan,globalOTDTable); 
+                score := lastScore + score;
+                
+                // 鎴彇鎺夊凡缁忚绠楃殑浼樺厛绾у洜瀛� 閫掑綊璁$畻
+                remindFormula := PriorityResult::GetRemindFormula( remindFormula,macroPlan);
+                PriorityResult::CalculateScore( remindFormula,customerOrder,businessType,macroPlan,score,globalOTDTable);
+            }
+            else if( remindFormula.StartsWith( "-" ))
+            {
+                remindFormula := remindFormula.SubString( 1,remindFormula.Length());
+                score := PriorityResult::GetDetailsValue( customerOrder,remindFormula,macroPlan,globalOTDTable);
+                score := lastScore - score;
+                
+                // 鎴彇鎺夊凡缁忚绠楃殑浼樺厛绾у洜瀛� 閫掑綊璁$畻
+                remindFormula := PriorityResult::GetRemindFormula( remindFormula,macroPlan);
+                PriorityResult::CalculateScore( remindFormula,customerOrder,businessType,macroPlan,score,globalOTDTable);
+            }
+            else if( remindFormula.StartsWith( "*" ) )
+            {
+                remindFormula := remindFormula.SubString( 1,remindFormula.Length());
+                score := PriorityResult::GetDetailsValue( customerOrder,remindFormula,macroPlan,globalOTDTable);
+                score := lastScore * score;
+                
+                // 鎴彇鎺夊凡缁忚绠楃殑浼樺厛绾у洜瀛� 閫掑綊璁$畻
+                remindFormula := PriorityResult::GetRemindFormula( remindFormula,macroPlan);
+                PriorityResult::CalculateScore( remindFormula,customerOrder,businessType,macroPlan,score,globalOTDTable);
+            }
+            else if( remindFormula.StartsWith( "/" ) )
+            {
+                remindFormula := remindFormula.SubString( 1,remindFormula.Length());
+                score := PriorityResult::GetDetailsValue( customerOrder,remindFormula,macroPlan,globalOTDTable);
+                score := lastScore / score;
+                
+                // 鎴彇鎺夊凡缁忚绠楃殑浼樺厛绾у洜瀛� 閫掑綊璁$畻
+                remindFormula := PriorityResult::GetRemindFormula( remindFormula,macroPlan);
+                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,globalOTDTable);
+                
+                // 鎴彇 ) 鍚庣殑瀛楃缁х画杩涜璁$畻
+                remindFormula := remindFormula.SubString( rightBracket,remindFormula.Length());
+            }
+            else
+            {
+                // 涓嶆槸绗﹀彿 鐩存帴鑾峰彇璁$畻鍚庣殑鏁板��
+                score := PriorityResult::GetDetailsValue( customerOrder,remindFormula,macroPlan,globalOTDTable);
+                info( "123123");
+                // 鎴彇鎺夊凡缁忚绠楃殑浼樺厛绾у洜瀛� 閫掑綊璁$畻
+                remindFormula := PriorityResult::GetRemindFormula( remindFormula,macroPlan);
+                PriorityResult::CalculateScore( remindFormula,customerOrder,businessType,macroPlan,score,globalOTDTable);
+            }
+    }
+    
+    // 娌℃湁鍖归厤 鍏紡璁$畻瀹屾垚
+    return lastScore;
+  *]
+}
diff --git a/_Main/BL/Type_PriorityResult/StaticMethod_GetDetailsValue.qbl b/_Main/BL/Type_PriorityResult/StaticMethod_GetDetailsValue.qbl
new file mode 100644
index 0000000..035c057
--- /dev/null
+++ b/_Main/BL/Type_PriorityResult/StaticMethod_GetDetailsValue.qbl
@@ -0,0 +1,114 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetDetailsValue (
+  CustomerOrder customerOrder,
+  String formula,
+  MacroPlan macroPlan,
+  GlobalOTDTable globalOTDTable
+) as Real
+{
+  TextBody:
+  [*
+    // NBoTk Sep-26-2023 (created)
+    // 褰撳墠璁$畻浼樺厛绾у洜瀛愮粏鍒� 濡傛灉鑾峰彇涓嶅埌鍏ㄩ儴鍏堥粯璁や负1
+    
+    value := 0.0;
+    
+    priorityFactor := null( PriorityFactor);
+    
+    traverse( macroPlan,PriorityFactor,p)
+    {   
+         if( formula.StartsWith( p.Name()) )
+         {
+            priorityFactor := p;
+         }
+    }
+    
+    if( "瀹㈡埛绛栫暐" =  priorityFactor.Name())
+    {
+         obj := selectobject( priorityFactor,PriorityFactorDetails,p , p.PriorityFactorName() = "瀹㈡埛绛栫暐" and p.GradingName() = customerOrder.CustomerPolicy());
+         value := priorityFactor.Coefficient() * obj.GradeTarget();
+    }
+    
+    if( "澶у紶鐩堝埄姘村钩" =  priorityFactor.Name())
+    {
+         obj := selectobject( priorityFactor,PriorityFactorDetails,p , p.PriorityFactorName() = "澶у紶鐩堝埄姘村钩" and  p.GradingName() = customerOrder.SheetProfitability());
+         gradeTarget := 1.0;
+         if( not isnull( obj ) )
+         {
+              gradeTarget := obj.GradeTarget();
+         }
+         value := priorityFactor.Coefficient() * gradeTarget;
+    }
+    
+    if( "DOI" =  priorityFactor.Name())
+    {
+         // DOI鏁版嵁
+         obj := selectobject( globalOTDTable,Global_MappingDOI_DSI,doi,doi.ProductID() = customerOrder.ProductID())
+         doi := 1.0;
+         if( not isnull( obj ) )
+         {
+              doi := [Real]obj.DOI();
+         }
+         value := priorityFactor.Coefficient() * doi;
+    }
+    
+    if( "DSI" =  priorityFactor.Name())
+    {
+         // DOI鏁版嵁
+         obj := selectobject( globalOTDTable,Global_MappingDOI_DSI,doi,doi.ProductID() = customerOrder.ProductID())
+         dsi := 1.0;
+         if( not isnull( obj ) )
+         {
+              dsi := [Real]obj.DSI();
+         }
+         value := priorityFactor.Coefficient() * dsi;
+    }
+    
+    if( "缁嗗垎甯傚満绛夌骇" =  priorityFactor.Name())
+    {
+         obj := selectobject( priorityFactor,PriorityFactorDetails,p , p.PriorityFactorName() = "缁嗗垎甯傚満绛夌骇" and p.GradingName() = customerOrder.SegmentPriority());
+         gradeTarget := 1.0;
+         if( not isnull( obj ) )
+         {
+              gradeTarget := obj.GradeTarget();
+         }
+         value := priorityFactor.Coefficient() * gradeTarget;
+    }
+    
+    if( "闇�姹傜被鍨�" =  priorityFactor.Name())
+    {     
+        // 鏈夐娴� 鏃犻娴� 绾娴�
+         obj := selectobject( priorityFactor,PriorityFactorDetails,p,p.GradingName() = customerOrder.OrderType());
+         gradeTarget := 1.0;
+         if( not isnull( obj ) )
+         {
+              gradeTarget := obj.GradeTarget();
+         }
+         value := priorityFactor.Coefficient() * gradeTarget;
+    }
+    
+    if( "瀹㈡埛绛夌骇" =  priorityFactor.Name())
+    {
+         // 閫氳繃鏁版嵁婀栬绠楀鎴风瓑绾�
+         obj := selectobject( globalOTDTable,Global_MappingCustomerGrade,doi,doi.BusinessType() = customerOrder.BusinessType() and doi.Customer() = customerOrder.CustomerName())
+         customerGrade := 1.0;
+         if( not isnull( obj ) )
+         {
+              customerGrade := [Real]obj.CustomerGrade();
+         }
+         value := priorityFactor.Coefficient() * customerGrade;
+    }
+    
+    if( "璁㈠崟涓嬪崟鏃堕棿" =  priorityFactor.Name())
+    {
+         // 涓嬪崟鏃堕棿
+         orderTime := customerOrder.OrderTime();
+         days := orderTime.TotalInDays() - customerOrder.EndDate().TotalInDays();
+         obj := selectobject( priorityFactor,PriorityFactorDetails,p , p.PriorityFactorName() = "璁㈠崟涓嬪崟鏃堕棿" and days >= [Number]p.GradingName());
+         value := priorityFactor.Coefficient() * obj.GradeTarget();
+    }
+    
+    return value;
+  *]
+}
diff --git a/_Main/BL/Type_PriorityResult/StaticMethod_GetRemindFormula.qbl b/_Main/BL/Type_PriorityResult/StaticMethod_GetRemindFormula.qbl
new file mode 100644
index 0000000..c931871
--- /dev/null
+++ b/_Main/BL/Type_PriorityResult/StaticMethod_GetRemindFormula.qbl
@@ -0,0 +1,32 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetRemindFormula (
+  String formula,
+  MacroPlan macroPlan
+) as String
+{
+  TextBody:
+  [*
+    // NBoTk Sep-26-2023 (created)
+    
+    str := "";
+    
+    traverse( macroPlan,PriorityFactor,p)
+    {  
+         if( formula.StartsWith( p.Name()) )
+         {
+              // 鍒ゆ柇鍓╀綑瀛楃闀垮害
+              if( p.Name().Length() = formula.Length() )
+              {
+                 str := ""
+              }
+              else
+              {              
+                str := formula.SubString( 0 + p.Name().Length(),formula.Length());
+              }
+         }
+    }
+    
+    return str;
+  *]
+}
diff --git a/_Main/BL/Type_PriorityResult/StaticMethod_calculatePriorityResult.qbl b/_Main/BL/Type_PriorityResult/StaticMethod_calculatePriorityResult.qbl
new file mode 100644
index 0000000..7688006
--- /dev/null
+++ b/_Main/BL/Type_PriorityResult/StaticMethod_calculatePriorityResult.qbl
@@ -0,0 +1,78 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod CalculatePriorityResult (
+  String priorityPolicyName,
+  MacroPlan macroPlan,
+  GlobalOTDTable globalOTDTable
+)
+{
+  TextBody:
+  [*
+    // NBoTk Sep-26-2023 (created)
+    
+    // 璁$畻瀹㈡埛璁㈠崟鐨勪紭鍏堢骇寰楀垎 鍥炲~鏉冮噸鏁版嵁 鐢熸垚鏂扮殑Priority鏄庣粏鏁版嵁
+    
+    traverse( macroPlan,SalesDemand.astype( CustomerOrder ),e)
+    {
+         // 浜嬩笟閮ㄤ俊鎭�
+         //businessType := e.BusinessType();
+         businessType :=  "鎵嬫満浜嬩笟閮�";
+         
+         // 鑾峰彇瀵瑰簲浜嬩笟閮ㄨ绠楀叕寮�
+         priorityPolicys := selectobject( macroPlan,PriorityPolicy,p,p.BusinessType() = businessType and p.Name() = priorityPolicyName);
+         formula := priorityPolicys.Formula();
+         
+         // 閫掑綊澶勭悊璁$畻鍏紡 鑾峰彇褰撳墠璁㈠崟鐨勫緱鍒�
+         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(),
+                                                     DemandDate := e.EndDate(),ProductID := e.ProductID(),Quantity := e.Quantity(),SalesSegmentName := e.SalesSegmentName(),
+                                                     StockingPointID := e.StockingPointID(),UnitOfMeasureName := e.UnitOfMeasureName()
+                                                     );
+          
+         // 鍒ゆ柇鏄泦鍥� 杩樻槸浜嬩笟閮�
+         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
+         {
+               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 
+                                                                );      
+         }                                                                                                                                       
+    }
+    
+    // 浼樺厛绾у洜瀛愬鐞嗗畬鎴愬悗 鎺掑簭鍥炲~鏁版嵁
+    resultList := selectsortedset( macroPlan,PriorityResult,result,
+                                   true,
+                                   result.PriorityResultScore()
+                                   )
+    
+    priorityValue := 1;
+    traverse( resultList,Elements,e)
+    {
+        obj := selectobject( macroPlan,SalesDemand.astype( CustomerOrder ),order, 
+                             order.ID() = e.CustomerOrderID()
+                             );
+        
+        // 璁㈠崟鏁版嵁涓嶄负绌哄啀鍋氬鐞�
+        if( not isnull( obj ) )
+        {
+              obj.PriorityName([String]priorityValue);
+              
+              // 鍒涘缓浼樺厛绾ф暟鎹�
+              macroPlan.Priority(relnew,Weight := priorityValue,Name := obj.OrderID());
+              priorityValue := priorityValue + 1;
+        }
+    
+    }
+  *]
+}
diff --git a/_Main/BL/Type_ProductInStockingPointInPeriodPlanningLeaf/FunctionOverride_CalcStockLevelInDays.qbl b/_Main/BL/Type_ProductInStockingPointInPeriodPlanningLeaf/FunctionOverride_CalcStockLevelInDays.qbl
new file mode 100644
index 0000000..bd5d786
--- /dev/null
+++ b/_Main/BL/Type_ProductInStockingPointInPeriodPlanningLeaf/FunctionOverride_CalcStockLevelInDays.qbl
@@ -0,0 +1,79 @@
+Quintiq file version 2.0
+#parent: #root
+FunctionOverride CalcStockLevelInDays #extension
+{
+  TextBody:
+  [*
+    totalDays := 0.0;
+    
+    if( not this.Period_MP().MacroPlan().IsMetaOptimizerRunning() ) 
+    {
+      balanceInv := this.InventoryLevelEnd();
+      
+      if( balanceInv > 0 )
+      {
+        // Calculate stock level in days
+        futureperiods := selectsortedset( this, ProductInStockingPoint_MP.ProductInStockingPointInPeriodPlanning.astype( ProductInStockingPointInPeriodPlanningLeaf ), p,
+                                          p.Start() >= this.End(), p.Start() );
+        product := this.ProductInStockingPoint_MP().Product_MP();
+        shelflife := this.ShelfLife();
+        hasshelflife := product.HasShelfLife() and not isnull( shelflife );
+        agevector := RealVector::Construct();
+        quantityvector := RealVector::Construct();
+        
+        // Modified logic to consider shelf-life for stock level in days
+        if( hasshelflife )
+        {
+          // Get the age and quantity vector of remaining product stock at the end of period
+          agevector := RealVector::Construct( shelflife.ShelfLifeEndAgeVectorAsBinaryValue() );
+          quantityvector := RealVector::Construct( shelflife.ShelfLifeEndQuantityVectorAsBinaryValue() );
+        }
+        
+        /*
+          Track if consecutive future periods has 0 demand (although we have balance supply, but if remaining future periods has 0 demand not consider as coverable).
+          Accumulate the coverable days and only add to total days if manage to find a subsequent period with demand.
+        */
+        traverse( futureperiods, Elements, pispip,
+                  // Terminate calculation once remaining supply is 0
+                  balanceInv > 0 )
+        {
+          if( balanceInv > 0 )
+          {
+            demandQty := pispip.DependentDemandAndSalesDemandQuantity();
+            
+            // Include expired quantity as demand to determine stock level in days
+            if( hasshelflife )
+            {
+              isexpiredinperiodvector := BooleanVector::Construct();
+              
+              traverse( agevector.AsValues(), Elements, age )
+              {
+                isexpiredinperiod := not product.GetIsUsableInTargetPeriod( [Real] age, pispip.Start(), pispip.Period_MP() );
+                isexpiredinperiodvector.Append( isexpiredinperiod );
+                agevector.Add( pispip.Period_MP().GetDurationInDaysForShelfLife(), false );
+              }
+              
+              // Sum of all elements in the quantity vector that corresponds to element = true in the boolean vector
+              expiredinventoryqty := quantityvector.GetSelection( isexpiredinperiodvector ).Sum();
+              demandQty := demandQty + expiredinventoryqty; // Reduce inventory as expired
+            }
+            
+            if( balanceInv > demandQty ) // Remaining supply can cover demand in period
+            {
+              totalDays := totalDays + pispip.Period_MP().DurationInDays();
+              balanceInv := balanceInv - demandQty;
+            }
+            else // Remaining supply partially cover the demand in period
+            {
+              // Main calc logic
+              totalDays := totalDays + ( balanceInv / demandQty * pispip.Period_MP().DurationInDays() );
+              balanceInv := 0.0;
+            }
+          }
+        }
+      }
+    }
+    
+    this.StockLevelInDays( totalDays );
+  *]
+}
diff --git a/_Main/BL/Type_ProductInStockingPointInPeriodPlanningLeaf/_ROOT_Type_ProductInStockingPointInPeriodPlanningLeaf.qbl b/_Main/BL/Type_ProductInStockingPointInPeriodPlanningLeaf/_ROOT_Type_ProductInStockingPointInPeriodPlanningLeaf.qbl
new file mode 100644
index 0000000..8c6a2c8
--- /dev/null
+++ b/_Main/BL/Type_ProductInStockingPointInPeriodPlanningLeaf/_ROOT_Type_ProductInStockingPointInPeriodPlanningLeaf.qbl
@@ -0,0 +1,6 @@
+Quintiq file version 2.0
+#root
+#parent: #DomainModel
+TypeSpecialization ProductInStockingPointInPeriodPlanningLeaf #extension
+{
+}
diff --git a/_Main/BL/Type_Routing/Method_DoSanityCheckData.qbl b/_Main/BL/Type_Routing/Method_DoSanityCheckData.qbl
new file mode 100644
index 0000000..c23a63b
--- /dev/null
+++ b/_Main/BL/Type_Routing/Method_DoSanityCheckData.qbl
@@ -0,0 +1,20 @@
+Quintiq file version 2.0
+#parent: #root
+Method DoSanityCheckData (
+  output Strings feedback_o,
+  output Strings sanitycheckfeedback_o
+) declarative remote #extension
+{
+  TextBody:
+  [*
+    // Adhi Feb-10-2016 (created)
+    
+    isvalid := true;
+    
+    isvalid := this.GetHasValidInput( feedback_o, sanitycheckfeedback_o ) and isvalid;
+    
+    isvalid := this.GetHasTianmaNonSupplierOperationWithNoInput( feedback_o, sanitycheckfeedback_o ) and isvalid;
+    
+    return isvalid;
+  *]
+}
diff --git a/_Main/BL/Type_Routing/Method_GetHasTianmaNonSupplierOperationWithNoInput.qbl b/_Main/BL/Type_Routing/Method_GetHasTianmaNonSupplierOperationWithNoInput.qbl
new file mode 100644
index 0000000..ec4ca3e
--- /dev/null
+++ b/_Main/BL/Type_Routing/Method_GetHasTianmaNonSupplierOperationWithNoInput.qbl
@@ -0,0 +1,28 @@
+Quintiq file version 2.0
+#parent: #root
+Method GetHasTianmaNonSupplierOperationWithNoInput (
+  output Strings feedback_o,
+  output Strings sanitycheckfeedback_o
+) declarative remote as Boolean
+{
+  TextBody:
+  [*
+    // Tianma change 20230925: If the unit is not a supplier, raise a data issue if there's no input
+    value := forall( this, RoutingStep.Operation, operation,
+                     guard( operation.Unit().IsSupplier(), false )
+                     or operation.OperationInput( relsize ) > 0 );
+    
+    if( not value )
+    {
+      // Add instance text
+      routingname := MacroPlan::GetSubstituteName( this.Name() );
+      instance := Translations::MP_Routing_Instance( routingname );
+      feedback := SanityCheckMessage::GetFormattedMessage( instance,
+                                                           "闈炰緵搴斿晢鎿嶄綔娌℃湁鎶曞叆鏂欍��" );
+      feedback_o.Add( feedback );
+      sanitycheckfeedback_o.Add( SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning() );
+    }
+    
+    return value;
+  *]
+}
diff --git a/_Main/BL/Type_ScenarioManager/StaticMethod_AvailableBusinessTypes.qbl b/_Main/BL/Type_ScenarioManager/StaticMethod_AvailableBusinessTypes.qbl
index 64f7bc4..3c1a81f 100644
--- a/_Main/BL/Type_ScenarioManager/StaticMethod_AvailableBusinessTypes.qbl
+++ b/_Main/BL/Type_ScenarioManager/StaticMethod_AvailableBusinessTypes.qbl
@@ -1,17 +1,22 @@
 Quintiq file version 2.0
 #parent: #root
-StaticMethod AvailableBusinessTypes () as String
+StaticMethod AvailableBusinessTypes (
+  GlobalOTDTable globalOTDTable
+) as String
 {
   TextBody:
   [*
     // yypsybs Aug-23-2023 (created)
-    strings := "闆嗗洟闈㈡澘;涓撲笟鏄剧ず浜嬩笟閮�;澶栧崠CELL;闈炴樉;杩愬姩鍋ュ悍;杩愬姩鍋ュ悍浜嬩笟閮�;鎵嬫満浜嬩笟閮�;鐗圭鏄剧ず;姹借溅鐢靛瓙浜嬩笟閮�;杞﹁浇鏄剧ず浜嬩笟閮�;IT浜嬩笟閮�;";
+    //strings := "闆嗗洟闈㈡澘;涓撲笟鏄剧ず浜嬩笟閮�;澶栧崠CELL;闈炴樉;杩愬姩鍋ュ悍;杩愬姩鍋ュ悍浜嬩笟閮�;鎵嬫満浜嬩笟閮�;鐗圭鏄剧ず;姹借溅鐢靛瓙浜嬩笟閮�;杞﹁浇鏄剧ず浜嬩笟閮�;IT浜嬩笟閮�;";
     
     //table := KB_BusinessTypesTable;
+    //
+    //if( strings.EndsWith( ";" ) ) {
+    //    strings := strings.SubString( 0, strings.Length() - 1 );  
+    //}
     
-    if( strings.EndsWith( ";" ) ) {
-        strings := strings.SubString( 0, strings.Length() - 1 );  
-    }
+    // 浣跨敤businessType鑾峰彇鏁版嵁
+    strings := BusinessType::GetBusinessNameStr( globalOTDTable);
     
     return strings;
   *]
diff --git a/_Main/BL/Type_Unit/StaticMethod_CreateOrUpdate.qbl b/_Main/BL/Type_Unit/StaticMethod_CreateOrUpdate.qbl
index df72958..5806f00 100644
--- a/_Main/BL/Type_Unit/StaticMethod_CreateOrUpdate.qbl
+++ b/_Main/BL/Type_Unit/StaticMethod_CreateOrUpdate.qbl
@@ -7,7 +7,7 @@
   String parentunitid,
   String capacitytype,
   String unitofmeasurename
-)
+) as Unit
 {
   TextBody:
   [*
@@ -21,7 +21,7 @@
     unit := Unit::FindById( owner, id );
     
     if( id="澶╅┈闆嗗洟" and isnull( unit ) ){
-      owner.Unit( relnew, 
+      unit := owner.Unit( relnew, 
                  ID := id, 
                  Name := name, 
                  UnitOfMeasureName := unitofmeasurename, 
@@ -31,7 +31,7 @@
                  CapacityType := capacitytype );
       }else{
       if( isnull( unit ) ){
-        owner.Unit( relnew, ID := id, 
+        unit := owner.Unit( relnew, ID := id, 
                    Name := name, 
                    ParentUnitID := parentunitid, 
                    CapacityType := capacitytype, 
@@ -46,5 +46,7 @@
           unit.UnitOfMeasureName( unitofmeasurename );
           }
         }
+    
+    return unit;
   *]
 }
diff --git a/_Main/UI/MacroPlanner/Component_FormTestButtonCollection/Response_Button398_OnClick.def b/_Main/UI/MacroPlanner/Component_FormTestButtonCollection/Response_Button398_OnClick.def
index 7b1da32..e164af9 100644
--- a/_Main/UI/MacroPlanner/Component_FormTestButtonCollection/Response_Button398_OnClick.def
+++ b/_Main/UI/MacroPlanner/Component_FormTestButtonCollection/Response_Button398_OnClick.def
@@ -5,7 +5,7 @@
   #keys: '[414702.0.340554926]'
   Body:
   [*
-    CapacityAllocationResults::CreateDate( GlobalOTDTable, MacroPlan );
+    CapacityAllocationResults::CreateDate( GlobalOTDTable, MacroPlan, SelectionScenario.Data() );
   *]
   CanBindMultiple: false
   DefinitionID: 'Responsedef_GUIButtonBase_OnClick'
diff --git a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_ContextMenuSalesFillingCapacity.def b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_ContextMenuSalesFillingCapacity.def
index 4e6377b..0aae48c 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_ContextMenuSalesFillingCapacity.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_ContextMenuSalesFillingCapacity.def
@@ -14,7 +14,7 @@
         Image: 'ELEMENT_BLUE'
         Taborder: 0
         Title: '澶栧崠CELL'
-        Tooltip: 'Filling Capacity Scheme List'
+        Tooltip: '澶栧崠CELL'
       ]
     }
     Component MenuSalesFillingSchemeDetail
@@ -26,6 +26,7 @@
         Image: 'ELEMENT_ORANGE'
         Taborder: 1
         Title: '濉骇鏂规鍒楄〃'
+        Tooltip: '濉骇鏂规鍒楄〃'
       ]
     }
     Component MenuSalesFillingSchemeHistorical
@@ -37,6 +38,7 @@
         Image: 'ELEMENT_ORANGE'
         Taborder: 2
         Title: '濉骇鍘嗗彶璁㈠崟鍒楄〃'
+        Tooltip: '濉骇鍘嗗彶璁㈠崟鍒楄〃'
       ]
     }
   ]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_abgTest.def b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_abgTest.def
new file mode 100644
index 0000000..e7f2aa2
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_abgTest.def
@@ -0,0 +1,25 @@
+Quintiq file version 2.0
+Component abgTest
+{
+  #keys: '[414702.0.358311816]'
+  BaseType: 'WebActionBarGroup'
+  Children:
+  [
+    Component btnTest
+    {
+      #keys: '[414702.0.358311907]'
+      BaseType: 'WebButton'
+      Properties:
+      [
+        Image: 'WATER_FISH'
+        Label: '娴嬭瘯瑙嗗浘'
+        Taborder: 0
+      ]
+    }
+  ]
+  Properties:
+  [
+    Taborder: 4
+    Title: 'TestView'
+  ]
+}
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_applicationDevelopmentActionBarPageDef\0431.def" "b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_applicationDevelopmentActionBarPageDef\0431.def"
new file mode 100644
index 0000000..42787dc
--- /dev/null
+++ "b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_applicationDevelopmentActionBarPageDef\0431.def"
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+Component applicationDevelopmentActionBarPageDef id:applicationDevelopmentActionBarPageDef_1 #extension
+{
+  Children:
+  [
+    #child: abgTest
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_ContextMenuSalesFillingCapacity_MenuSalesFillingCapac.def b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_ContextMenuSalesFillingCapacity_MenuSalesFillingCapac.def
index 3bd914f..73a0e05 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_ContextMenuSalesFillingCapacity_MenuSalesFillingCapac.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_ContextMenuSalesFillingCapacity_MenuSalesFillingCapac.def
@@ -10,9 +10,8 @@
     Body:
     [*
       // Open view
-      //ApplicationMacroPlanner.OpenView( 'Filling Capacity Scheme List',ButtonSalesFillingCapacity);
-      
-      ApplicationMacroPlanner.OpenView( 'FillingCapacityOrder', ButtonSalesFillingCapacity );
+      //ApplicationMacroPlanner.OpenView( 'FillingCapacityOrder', ButtonSalesFillingCapacity );
+      ApplicationScope.ViewManager().ResetUserViewById( "FillingCapacityOrder",true);
     *]
     GroupServerCalls: false
   }
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_ContextMenuSalesFillingCapacity_MenuSalesFillingS\043360.def" "b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_ContextMenuSalesFillingCapacity_MenuSalesFillingS\043360.def"
index 2d1e1f4..067c423 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_ContextMenuSalesFillingCapacity_MenuSalesFillingS\043360.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_ContextMenuSalesFillingCapacity_MenuSalesFillingS\043360.def"
@@ -10,8 +10,7 @@
     Body:
     [*
       // Open view
-      //ApplicationMacroPlanner.OpenView( "FillingCapacitySchemeList",ButtonSalesFillingCapacity);
-      ApplicationMacroPlanner.OpenView( "FillingCapacityOrderHistorical");
+      ApplicationScope.ViewManager().ResetUserViewById( "FillingCapacityOrderHistorical",true);
     *]
     GroupServerCalls: false
   }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_ContextMenuSalesFillingCapacity_MenuSalesFillingSchem.def b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_ContextMenuSalesFillingCapacity_MenuSalesFillingSchem.def
index 0ad306d..22b6bc7 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_ContextMenuSalesFillingCapacity_MenuSalesFillingSchem.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_ContextMenuSalesFillingCapacity_MenuSalesFillingSchem.def
@@ -10,8 +10,7 @@
     Body:
     [*
       // Open view
-      //ApplicationMacroPlanner.OpenView( "FillingCapacitySchemeList",ButtonSalesFillingCapacity);
-      ApplicationMacroPlanner.OpenView( "FillingCapacitySchemeList");
+      ApplicationScope.ViewManager().ResetUserViewById( "FillingCapacitySchemeList",true);
     *]
     GroupServerCalls: false
   }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_abgTest_btnTest_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_abgTest_btnTest_OnClick.def
new file mode 100644
index 0000000..8b67882
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_abgTest_btnTest_OnClick.def
@@ -0,0 +1,16 @@
+Quintiq file version 2.0
+#parent: abgTest/btnTest
+Response OnClick () id:Response_TIANMA_JITUAN_abgTest_btnTest_OnClick
+{
+  #keys: '[414702.0.358346189]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebButton_OnClick'
+  GroupServerCalls: true
+  QuillAction
+  {
+    Body:
+    [*
+      ApplicationScope.ViewManager().ResetUserViewById( "Test", true );
+    *]
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/_ROOT_Component_ApplicationMacroPlanner.def b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/_ROOT_Component_ApplicationMacroPlanner.def
index 2ee31ab..b0bcb6e 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/_ROOT_Component_ApplicationMacroPlanner.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/_ROOT_Component_ApplicationMacroPlanner.def
@@ -11,6 +11,7 @@
       [
         #child: ActionBarPageData
         #child: ActionBarPageSales
+        #child: applicationDevelopmentActionBarPageDef_1
       ]
     }
     Component DataHolderCapacityAndSaleBudgeFilterItem
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogBusinessType/Method_ClickBtnOk.def b/_Main/UI/MacroPlannerWebApp/Component_DialogBusinessType/Method_ClickBtnOk.def
index 54a2fe2..fbfa4cc 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogBusinessType/Method_ClickBtnOk.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogBusinessType/Method_ClickBtnOk.def
@@ -12,13 +12,11 @@
     // OnOk
     this.ApplyChanges();
     
+    businessType := DataHolderBusinessType.Data().BusinessTypeName();
     DataHolderBusinessType.Data().Commit();
     
-    //if( not isnull( DataHolderForm.Data() ) )
-    //{
-    //  // Access the form, select the new assumption
-    //  DataHolderForm.Data().ListAssumptions().SelectByKey( DataHolderDialogData.Data().WrappedInstance().Key() );
-    //}
+     
+    PriorityFactor::InitData( MacroPlan,businessType);
     
     this.Close();
   *]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/Component_pnlActions.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/Component_pnlActions.def
new file mode 100644
index 0000000..0e13477
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/Component_pnlActions.def
@@ -0,0 +1,40 @@
+Quintiq file version 2.0
+Component pnlActions
+{
+  #keys: '[414702.0.373821470]'
+  BaseType: 'WebPanel'
+  Children:
+  [
+    Component btnOk
+    {
+      #keys: '[414702.0.373821474]'
+      BaseType: 'WebButton'
+      Properties:
+      [
+        Label: 'OK'
+        Taborder: 0
+      ]
+    }
+    Component btnCancel
+    {
+      #keys: '[414702.0.373821476]'
+      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_DialogCapacityAllocationResultsRuleConfiguration/Component_pnlContent.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/Component_pnlContent.def
new file mode 100644
index 0000000..f885a86
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/Component_pnlContent.def
@@ -0,0 +1,58 @@
+Quintiq file version 2.0
+Component pnlContent
+{
+  #keys: '[414702.0.373821468]'
+  BaseType: 'WebPanel'
+  Children:
+  [
+    Component efPanelMaterialCode
+    {
+      #keys: '[414702.0.375722232]'
+      BaseType: 'WebEditField'
+      Properties:
+      [
+        DataBinding: 'DataHolderDialogData.Data.PanelMaterialCode'
+        Label: '闈㈡澘鐗╂枡缂栫爜'
+        Taborder: 0
+      ]
+    }
+    Component efModuleMaterialCode
+    {
+      #keys: '[414702.0.375722245]'
+      BaseType: 'WebEditField'
+      Properties:
+      [
+        DataBinding: 'DataHolderDialogData.Data.ModuleMaterialCode'
+        Label: '妯℃澘浜ф垚鍝両D'
+        Taborder: 1
+      ]
+    }
+    Component efDivision
+    {
+      #keys: '[414702.0.375722257]'
+      BaseType: 'WebEditField'
+      Properties:
+      [
+        DataBinding: 'DataHolderDialogData.Data.Division'
+        Label: '浜嬩笟閮�'
+        Taborder: 2
+      ]
+    }
+    Component efStockingPointID
+    {
+      #keys: '[414702.0.375874061]'
+      BaseType: 'WebEditField'
+      Properties:
+      [
+        DataBinding: 'DataHolderDialogData.Data.StockingPointID'
+        Label: '妯$粍浜ф垚鍝佸簱瀛樼偣ID'
+        Taborder: 3
+      ]
+    }
+  ]
+  Properties:
+  [
+    Padding: 'true'
+    Taborder: 0
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/Method_Edit.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/Method_Edit.def
new file mode 100644
index 0000000..77662e1
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/Method_Edit.def
@@ -0,0 +1,17 @@
+Quintiq file version 2.0
+#parent: #root
+Method Edit (
+  CapacityAllocationResultsRuleConfiguration selection
+) id:Method_DialogCreateEditCapacityAllocationResultsRuleConfiguration_Edit
+{
+  #keys: '[414702.0.375759040]'
+  Body:
+  [*
+    // Edits assumption
+    data := shadow( selection );
+    
+    DataHolderDialogData.Data( &data );
+    
+    ApplicationMacroPlanner.ShowFormModal( this );
+  *]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/Method_New.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/Method_New.def
new file mode 100644
index 0000000..fa8fb18
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/Method_New.def
@@ -0,0 +1,14 @@
+Quintiq file version 2.0
+#parent: #root
+Method New () id:Method_DialogCreateEditCapacityAllocationResultsRuleConfiguration_New
+{
+  #keys: '[414702.0.375317354]'
+  Body:
+  [*
+    capacityAllocationResultsRuleConfiguration := GlobalOTDTable.CapacityAllocationResultsRuleConfiguration( relshadow );
+    
+    DataHolderDialogData.Data( &capacityAllocationResultsRuleConfiguration );
+    
+    ApplicationMacroPlanner.ShowFormModal( this );
+  *]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/Response_pnlActions_btnCancel_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/Response_pnlActions_btnCancel_OnClick.def
new file mode 100644
index 0000000..057d12d
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/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: '[414702.0.373821480]'
+  DefinitionID: 'Responsedef_WebButton_OnClick'
+  GroupServerCalls: true
+  QuillAction
+  {
+    Body:
+    [*
+      Form.Close();
+    *]
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/Response_pnlActions_btnOk_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/Response_pnlActions_btnOk_OnClick.def
new file mode 100644
index 0000000..336e9a8
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/Response_pnlActions_btnOk_OnClick.def
@@ -0,0 +1,34 @@
+Quintiq file version 2.0
+#parent: pnlActions/btnOk
+Response OnClick () id:Response_pnlActions_btnOk_OnClick
+{
+  #keys: '[414702.0.373821479]'
+  DefinitionID: 'Responsedef_WebButton_OnClick'
+  QuillAction
+  {
+    Body:
+    [*
+      Form.ApplyChanges();
+      
+      data := DataHolderDialogData.Data().WrappedInstance();
+      if ( isnull( data ) ) {
+        GlobalOTDTable.CapacityAllocationResultsRuleConfiguration( relnew,
+                                                                   PanelMaterialCode  := efPanelMaterialCode.Text(),
+                                                                   ModuleMaterialCode := efModuleMaterialCode.Text(),
+                                                                   Division           := efDivision.Text(),
+                                                                   StockingPointID    := efStockingPointID.Text()
+                                                                  );
+      } else {
+        DataHolderDialogData.Data().PanelMaterialCode( efPanelMaterialCode.Text() );
+        DataHolderDialogData.Data().ModuleMaterialCode( efModuleMaterialCode.Text() );
+        DataHolderDialogData.Data().Division( efDivision.Text() );
+        DataHolderDialogData.Data().StockingPointID( efStockingPointID.Text() );
+        DataHolderDialogData.Data().Commit();
+      }
+      
+      
+      Form.Close();
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/_ROOT_Component_DialogCreateEditCapacityAllocationResultsRuleConfiguration.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/_ROOT_Component_DialogCreateEditCapacityAllocationResultsRuleConfiguration.def
new file mode 100644
index 0000000..76da375
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCapacityAllocationResultsRuleConfiguration/_ROOT_Component_DialogCreateEditCapacityAllocationResultsRuleConfiguration.def
@@ -0,0 +1,32 @@
+Quintiq file version 2.0
+#root
+#parent: MacroPlannerWebApp
+OrphanComponent DialogCreateEditCapacityAllocationResultsRuleConfiguration
+{
+  #keys: '[414702.0.373821466]'
+  BaseType: 'WebForm'
+  Children:
+  [
+    #child: pnlContent
+    #child: pnlActions
+    Component DataHolderDialogData
+    {
+      #keys: '[414702.0.375413793]'
+      BaseType: 'WebDataHolder'
+      Databinding: 'shadow[CapacityAllocationResultsRuleConfiguration]*'
+      Properties:
+      [
+        Taborder: 2
+      ]
+    }
+  ]
+  Properties:
+  [
+    Alignment: 'trailing'
+    EnterButton: 'btnOk'
+    EscapeButton: 'btnCancel'
+    ExcludeFromActiveComponent: true
+    Image: 'BEAR'
+    Padding: 'false'
+  ]
+}
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_CalculatePriorityResult.def b/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Method_CalculatePriorityResult.def
new file mode 100644
index 0000000..177aa43
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogChoosePriorityPolicy/Method_CalculatePriorityResult.def
@@ -0,0 +1,12 @@
+Quintiq file version 2.0
+#parent: #root
+Method CalculatePriorityResult () id:Method_DialogChoosePriorityPolicy_CalculatePriorityResult
+{
+  #keys: '[414382.0.577602130]'
+  Body:
+  [*
+    name := PriorityPolicyStringList.Text();
+    PriorityResult::CalculatePriorityResult(name,MacroPlan,GlobalOTDTable);
+    this.Close();
+  *]
+}
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..9924430
--- /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:
+    [*
+      dlg := construct( DialogChoosePriorityPolicy );
+      dlg.CalculatePriorityResult();
+    *]
+    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_DialogCreateEditIssueWorkOrder/Response_pnlActions_btnOk_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditIssueWorkOrder/Response_pnlActions_btnOk_OnClick.def
index 4e08b41..76530fa 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditIssueWorkOrder/Response_pnlActions_btnOk_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditIssueWorkOrder/Response_pnlActions_btnOk_OnClick.def
@@ -4,6 +4,16 @@
 {
   #keys: '[414702.0.223820978]'
   DefinitionID: 'Responsedef_WebButton_OnClick'
+  Precondition:
+  [*
+    flag := guard( [Real]efPlannedQuantity.Text() > 0.0, false ) or DataHolderDialogDatas.Data().Size() > 1;
+    
+    if ( not flag ) {
+      feedback := "璇疯緭鍏ヤ竴涓ぇ浜�0鐨勬暟瀛�";
+    }
+    
+    return flag;
+  *]
   QuillAction
   {
     Body:
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactor/Response_pnlActions_btnOk_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactor/Response_pnlActions_btnOk_OnClick.def
index ba900bc..8d24e23 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactor/Response_pnlActions_btnOk_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactor/Response_pnlActions_btnOk_OnClick.def
@@ -7,10 +7,17 @@
   Precondition:
   [*
     feedback := Translations::FilllingCapacity_ValidateInput();
-    
     checkValue := not Coefficient.Text() = ''
     
-    return checkValue;
+    if(not checkValue )
+    {
+      feedback := Translations::PriorityFactor_CheckNameValid();
+      editData := DataHolderEditPriorityFactor.Data();
+      checkValue := not PriorityFactor::CheckNameValid( MacroPlan,editData.BusinessType(),[Real]Coefficient.Text(),PriorityFactorName.Text(),Desc.Text());
+    
+    }
+    
+    return checkValue
   *]
   QuillAction
   {
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactorDetails/Component_pnlContent.def b/_Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactorDetails/Component_pnlContent.def
index 1a52538..8f09095 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactorDetails/Component_pnlContent.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactorDetails/Component_pnlContent.def
@@ -36,6 +36,7 @@
         DataBinding: 'DataHolderEditPriorityFactorDetails.Data.RangeMax'
         Label: '鏈�澶у��'
         Taborder: 4
+        Visible: false
       ]
     }
     Component RangeMin
@@ -46,7 +47,8 @@
       [
         DataBinding: 'DataHolderEditPriorityFactorDetails.Data.RangeMin'
         Label: '鏈�灏忓��'
-        Taborder: 5
+        ReadOnly: true
+        Taborder: 6
       ]
     }
     Component GradeDesc
@@ -59,7 +61,7 @@
         FixedSize: false
         Label: '鎻忚堪'
         SizeRatio: 3
-        Taborder: 6
+        Taborder: 8
       ]
     }
     Component PriorityFactorName
@@ -84,6 +86,27 @@
         Taborder: 1
       ]
     }
+    Component RangeMaxTest
+    {
+      #keys: '[414382.0.523235618]'
+      BaseType: 'WebLabel'
+      Properties:
+      [
+        Label: '鏈�澶у��'
+        Taborder: 5
+        Visible: false
+      ]
+    }
+    Component RangeMinText
+    {
+      #keys: '[414382.0.523361009]'
+      BaseType: 'WebLabel'
+      Properties:
+      [
+        Label: '鏈�灏忓��'
+        Taborder: 7
+      ]
+    }
   ]
   Properties:
   [
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactorDetails/Response_pnlActions_btnOk_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactorDetails/Response_pnlActions_btnOk_OnClick.def
index 14d65cd..09b6252 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactorDetails/Response_pnlActions_btnOk_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactorDetails/Response_pnlActions_btnOk_OnClick.def
@@ -12,7 +12,7 @@
     
     if( isRange.Checked() )
     {
-       checkValue := not RangeMax.Text() = '' and not RangeMin.Text() = '';
+       checkValue := not RangeMax.Text() = '' and not RangeMin.Text() = '' and RangeMax.Text() > RangeMin.Text();
     }
     
     return checkValue;
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactorDetails/Response_pnlContent_isRange_OnChanged.def b/_Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactorDetails/Response_pnlContent_isRange_OnChanged.def
index 91202b9..06616ab 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactorDetails/Response_pnlContent_isRange_OnChanged.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactorDetails/Response_pnlContent_isRange_OnChanged.def
@@ -11,12 +11,18 @@
     [*
       if( this.Checked())
       {
-          RangeMax.ReadOnly(false);
-          RangeMin.ReadOnly(false) 
+          RangeMax.Visible(true);
+          RangeMin.Visible(true);
+          RangeMaxTest.Visible(false); 
+          RangeMinText.Visible(false);
       }
       else{
-          RangeMax.ReadOnly(true);
-          RangeMin.ReadOnly(true) 
+          RangeMax.Visible(false);
+          RangeMin.Visible(false);
+          RangeMaxTest.Visible(true) 
+          RangeMaxTest.Text([String]DataHolderEditPriorityFactorDetails.Data().RangeMax());
+          RangeMinText.Visible(true) 
+          RangeMinText.Text([String]DataHolderEditPriorityFactorDetails.Data().RangeMin());
       }
     *]
     GroupServerCalls: false
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactorDetails/Response_pnlContent_isRange_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactorDetails/Response_pnlContent_isRange_OnCreated.def
new file mode 100644
index 0000000..ad0f874
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogEditPriorityFactorDetails/Response_pnlContent_isRange_OnCreated.def
@@ -0,0 +1,30 @@
+Quintiq file version 2.0
+#parent: pnlContent/isRange
+Response OnCreated () id:Response_pnlContent_isRange_OnCreated
+{
+  #keys: '[414382.0.523105450]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebComponent_OnCreated'
+  QuillAction
+  {
+    Body:
+    [*
+      if( this.Checked())
+      {
+          RangeMax.Visible(true);
+          RangeMin.Visible(true);
+          RangeMaxTest.Visible(false); 
+          RangeMinText.Visible(false);
+      }
+      else{
+          RangeMax.Visible(false);
+          RangeMin.Visible(false);
+          RangeMaxTest.Visible(true) 
+          RangeMaxTest.Text([String]DataHolderEditPriorityFactorDetails.Data().RangeMax());
+          RangeMinText.Visible(true) 
+          RangeMinText.Text([String]DataHolderEditPriorityFactorDetails.Data().RangeMin());
+      }
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogFillingCapacityOrder/Component_pnlContent.def b/_Main/UI/MacroPlannerWebApp/Component_DialogFillingCapacityOrder/Component_pnlContent.def
index 63e6384..3425275 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogFillingCapacityOrder/Component_pnlContent.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogFillingCapacityOrder/Component_pnlContent.def
@@ -13,8 +13,7 @@
       [
         AllowEmpty: true
         DataBinding: 'DataHolderFillingCapacityOrder.Data.ProductID'
-        Label: 'ProductID'
-        Strings: 'productID'
+        Label: '鍟嗗搧缂栫爜'
         Taborder: 0
       ]
     }
@@ -26,8 +25,7 @@
       [
         AllowEmpty: true
         DataBinding: 'DataHolderFillingCapacityOrder.Data.SalesSegmentName'
-        Label: 'SalesSegmentName'
-        Strings: 'SalesSagmentName'
+        Label: '閿�鍞儴闂�'
         Taborder: 1
       ]
     }
@@ -39,8 +37,7 @@
       [
         AllowEmpty: true
         DataBinding: 'DataHolderFillingCapacityOrder.Data.StockingPointID'
-        Label: 'StockPointID'
-        Strings: 'StockPointID'
+        Label: '搴撳瓨鐐�'
         Taborder: 2
       ]
     }
@@ -52,8 +49,7 @@
       [
         AllowEmpty: true
         DataBinding: 'DataHolderFillingCapacityOrder.Data.Customer'
-        Label: 'Customer'
-        Strings: 'Customer'
+        Label: '瀹㈡埛'
         Taborder: 3
       ]
     }
@@ -64,7 +60,7 @@
       Properties:
       [
         DataBinding: 'DataHolderFillingCapacityOrder.Data.Quantity'
-        Label: 'Quantity'
+        Label: '鏁伴噺'
         Mask: 'REAL'
         Taborder: 4
       ]
@@ -77,7 +73,7 @@
       [
         AllowEmpty: true
         DataBinding: 'DataHolderFillingCapacityOrder.Data.UnitOfMeasureName'
-        Label: 'UnitOfMeasureName'
+        Label: '鏁伴噺鍗曚綅'
         Strings: 'UnitName'
         Taborder: 5
       ]
@@ -89,7 +85,7 @@
       Properties:
       [
         DataBinding: 'DataHolderFillingCapacityOrder.Data.SalesAmount'
-        Label: 'SalesAmount'
+        Label: '閿�鍞'
         Mask: 'NUMBER'
         Taborder: 6
       ]
@@ -101,7 +97,7 @@
       Properties:
       [
         DataBinding: 'DataHolderFillingCapacityOrder.Data.DemandDate'
-        Label: 'Demand Date'
+        Label: '闇�姹傛棩鏈�'
         Taborder: 8
       ]
     }
@@ -112,7 +108,7 @@
       Properties:
       [
         DataBinding: 'DataHolderFillingCapacityOrder.Data.ForecastDemandDate'
-        Label: 'Forecast Demand Date'
+        Label: '棰勬湡闇�姹傛棩鏈�'
         Taborder: 7
       ]
     }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogFillingCustomerAndForecast/Component_pnlContent.def b/_Main/UI/MacroPlannerWebApp/Component_DialogFillingCustomerAndForecast/Component_pnlContent.def
index 488be7e..3c4dba9 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogFillingCustomerAndForecast/Component_pnlContent.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogFillingCustomerAndForecast/Component_pnlContent.def
@@ -12,7 +12,7 @@
       Properties:
       [
         DataBinding: 'DataHolderFilling.Data.VerNo'
-        Label: 'VerNo'
+        Label: '鐗堟湰鍙�'
         Taborder: 0
       ]
     }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Component_ListCapacityAllocationResults.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Component_ListCapacityAllocationResults.def
index c07b922..27d0374 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Component_ListCapacityAllocationResults.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Component_ListCapacityAllocationResults.def
@@ -1,26 +1,26 @@
 Quintiq file version 2.0
 Component ListCapacityAllocationResults
 {
-  #keys: '[414702.0.338762075]'
+  #keys: '[414702.0.390053833]'
   BaseType: 'WebList'
   Children:
   [
     Component DataExtractorCapacityAllocationResults
     {
-      #keys: '[414702.0.338762076]'
+      #keys: '[414702.0.390053834]'
       BaseType: 'WebDataExtractor'
       Properties:
       [
-        DataType: 'GlobalOTDTable'
-        Source: 'GlobalOTDTable'
+        DataType: 'structured[CapacityAllocationResultsRuleConfiguration]'
+        Source: 'FormCapacityAllocationResultsRuleConfiguration.DataHolderSelectCapacityAllocationResultsRuleConfiguration'
         Taborder: 0
-        Transformation: 'CapacityAllocationResults'
+        Transformation: 'Elements.CapacityAllocationResults'
       ]
     }
     #child: listActionBarPageCapacityAllocationResults
     Component DataSetLevelCapacityAllocationResults
     {
-      #keys: '[414702.0.338762081]'
+      #keys: '[414702.0.390053839]'
       BaseType: 'WebDataSetLevel'
       Children:
       [
@@ -28,7 +28,7 @@
       ]
       Properties:
       [
-        Columns: '[{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"VersionNumber","title":"VersionNumber","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"VersionNumber"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"PanelMeasurementUnit","title":"PanelMeasurementUnit","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"PanelMeasurementUnit"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"PanelMaterialCode","title":"PanelMaterialCode","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"PanelMaterialCode"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"NumberOfPanels","title":"NumberOfPanels","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"NumberOfPanels"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"PanelMeasurementUnit","title":"PanelMeasurementUnit","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"PanelMeasurementUnit"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ModuleMaterialCode","title":"ModuleMaterialCode","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ModuleMaterialCode"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"NumberOfModules","title":"NumberOfModules","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"NumberOfModules"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ModuleMeasurementUnit","title":"ModuleMeasurementUnit","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ModuleMeasurementUnit"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ModuleMeasurementUnit","title":"ModuleMeasurementUnit","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ModuleMeasurementUnit"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Division","title":"Division","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Division"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"RequirementDate","title":"RequirementDate","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"RequirementDate"}}]'
+        Columns: '[{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Date","title":"Date","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Date"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Description","title":"Description","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Description"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ID","title":"ID","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ProductID","title":"ProductID","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ProductID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"StockingPointID","title":"StockingPointID","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"StockingPointID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"UserQuantity","title":"UserQuantity","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"UserQuantity"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ManufacturedDate","title":"ManufacturedDate","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ManufacturedDate"}}]'
         ContextMenu: 'listContextMenuCapacityAllocationResults'
         Taborder: 2
       ]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Component_PanelCapacityAllocationResults.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Component_PanelCapacityAllocationResults.def
new file mode 100644
index 0000000..a916ec0
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Component_PanelCapacityAllocationResults.def
@@ -0,0 +1,37 @@
+Quintiq file version 2.0
+Component PanelCapacityAllocationResults
+{
+  #keys: '[414702.0.391687385]'
+  BaseType: 'WebPanel'
+  Children:
+  [
+    Component ButtonGenerateCapacityAllocationResults id:ButtonGenerateCapacityAllocationResults_570
+    {
+      #keys: '[414702.0.391717497]'
+      BaseType: 'WebButton'
+      Properties:
+      [
+        Image: 'PROCESS'
+        Label: '鐢熸垚鏁版嵁'
+        Taborder: 0
+      ]
+    }
+    Component Export id:Export_398
+    {
+      #keys: '[414702.0.392048461]'
+      BaseType: 'WebButton'
+      Properties:
+      [
+        Image: 'EXPORT1'
+        Label: '瀵煎嚭'
+        Taborder: 1
+      ]
+    }
+  ]
+  Properties:
+  [
+    FixedSize: true
+    Orientation: 'horizontal'
+    Taborder: 0
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Component_listActionBarPageCapacityAllocationResults.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Component_listActionBarPageCapacityAllocationResults.def
index 5384f4a..81f7ddb 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Component_listActionBarPageCapacityAllocationResults.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Component_listActionBarPageCapacityAllocationResults.def
@@ -1,7 +1,7 @@
 Quintiq file version 2.0
 Component listActionBarPageCapacityAllocationResults
 {
-  #keys: '[414702.0.338762078]'
+  #keys: '[414702.0.390053836]'
   BaseType: 'listActionBarPage'
   Properties:
   [
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Component_listContextMenuCapacityAllocationResults.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Component_listContextMenuCapacityAllocationResults.def
index 62d4067..b7e995a 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Component_listContextMenuCapacityAllocationResults.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Component_listContextMenuCapacityAllocationResults.def
@@ -1,7 +1,7 @@
 Quintiq file version 2.0
 Component listContextMenuCapacityAllocationResults
 {
-  #keys: '[414702.0.338762083]'
+  #keys: '[414702.0.390053841]'
   BaseType: 'listContextMenu'
   Properties:
   [
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Response_ButtonGenerateCapacityAllocationResults_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Response_ButtonGenerateCapacityAllocationResults_OnClick.def
deleted file mode 100644
index 2d97d02..0000000
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Response_ButtonGenerateCapacityAllocationResults_OnClick.def
+++ /dev/null
@@ -1,16 +0,0 @@
-Quintiq file version 2.0
-#parent: ButtonGenerateCapacityAllocationResults
-Response OnClick () id:Response_FormCapacityAllocationResults_ButtonGenerateCapacityAllocationResults_OnClick
-{
-  #keys: '[414702.0.340111671]'
-  CanBindMultiple: false
-  DefinitionID: 'Responsedef_WebButton_OnClick'
-  QuillAction
-  {
-    Body:
-    [*
-      CapacityAllocationResults::CreateDate( GlobalOTDTable, MacroPlan );
-    *]
-    GroupServerCalls: false
-  }
-}
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Response_PanelCapacityAllocationResults_ButtonGenerateCapacityAllocationR\04339.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Response_PanelCapacityAllocationResults_ButtonGenerateCapacityAllocationR\04339.def"
new file mode 100644
index 0000000..6a4fd16
--- /dev/null
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Response_PanelCapacityAllocationResults_ButtonGenerateCapacityAllocationR\04339.def"
@@ -0,0 +1,16 @@
+Quintiq file version 2.0
+#parent: PanelCapacityAllocationResults/ButtonGenerateCapacityAllocationResults_570
+Response OnClick () id:Response_FormCapacityAllocationResults_ButtonGenerateCapacityAllocationResults_OnClick_39
+{
+  #keys: '[414702.0.391717496]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebButton_OnClick'
+  QuillAction
+  {
+    Body:
+    [*
+      CapacityAllocationResults::CreateDate( GlobalOTDTable, MacroPlan, DataHolderActiveScenario.Data() );
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Response_PanelCapacityAllocationResults_Export_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Response_PanelCapacityAllocationResults_Export_OnClick.def
new file mode 100644
index 0000000..4428575
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Response_PanelCapacityAllocationResults_Export_OnClick.def
@@ -0,0 +1,16 @@
+Quintiq file version 2.0
+#parent: PanelCapacityAllocationResults/Export_398
+Response OnClick () id:Response_PanelCapacityAllocationResults_Export_OnClick
+{
+  #keys: '[414702.0.391791234]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebButton_OnClick'
+  QuillAction
+  {
+    Body:
+    [*
+      Application.Download( "浜ц兘鍒嗛厤缁撴灉.xlsx", CapacityAllocationResults::Export( GlobalOTDTable ).AsBinaryData() );
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/_ROOT_Component_FormCapacityAllocationResults.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/_ROOT_Component_FormCapacityAllocationResults.def
index 432fdfa..983e0ed 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/_ROOT_Component_FormCapacityAllocationResults.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/_ROOT_Component_FormCapacityAllocationResults.def
@@ -8,17 +8,7 @@
   Children:
   [
     #child: ListCapacityAllocationResults
-    Component ButtonGenerateCapacityAllocationResults
-    {
-      #keys: '[414702.0.340677556]'
-      BaseType: 'WebButton'
-      Properties:
-      [
-        Image: 'PROCESS'
-        Label: '鐢熸垚鏁版嵁'
-        Taborder: 0
-      ]
-    }
+    #child: PanelCapacityAllocationResults
   ]
   Properties:
   [
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Component_ListCapacityAllocationResultsRuleConfiguration.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Component_ListCapacityAllocationResultsRuleConfiguration.def
new file mode 100644
index 0000000..add7c86
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Component_ListCapacityAllocationResultsRuleConfiguration.def
@@ -0,0 +1,59 @@
+Quintiq file version 2.0
+Component ListCapacityAllocationResultsRuleConfiguration
+{
+  #keys: '[414702.0.375255758]'
+  BaseType: 'WebList'
+  Children:
+  [
+    Component DataExtractorCapacityAllocationResultsRuleConfiguration
+    {
+      #keys: '[414702.0.375255759]'
+      BaseType: 'WebDataExtractor'
+      Properties:
+      [
+        DataType: 'GlobalOTDTable'
+        Source: 'GlobalOTDTable'
+        Taborder: 0
+        Transformation: 'CapacityAllocationResultsRuleConfiguration'
+      ]
+    }
+    #child: listActionBarPageCapacityAllocationResultsRuleConfiguration
+    Component DataSetLevelCapacityAllocationResultsRuleConfiguration
+    {
+      #keys: '[414702.0.375255764]'
+      BaseType: 'WebDataSetLevel'
+      Children:
+      [
+        #child: listContextMenuCapacityAllocationResultsRuleConfiguration
+      ]
+      Properties:
+      [
+        Columns: '[{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"PanelMaterialCode","title":"PanelMaterialCode","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"PanelMaterialCode"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ModuleMaterialCode","title":"ModuleMaterialCode","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ModuleMaterialCode"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Division","title":"Division","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Division"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"StockingPointID","title":"StockingPointID","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"StockingPointID"}}]'
+        ContextMenu: 'listContextMenuCapacityAllocationResultsRuleConfiguration'
+        Taborder: 2
+      ]
+    }
+  ]
+  Properties:
+  [
+    Taborder: 1
+  ]
+  ResponseDefinitions:
+  [
+    DelegatedResponseDefinition OnClick id:Responsedef_ListCapacityAllocationResultsRuleConfiguration_WebMenu_OnClick
+    {
+      #keys: '[414702.0.373845107]'
+      Initiator: 'WebMenu'
+      IsInherited: false
+      ResponseType: 'OnClick'
+      Arguments:
+      [
+        ResponseDefinitionArgument selection
+        {
+          #keys: '[811.0.13515064]'
+          Binding: 'this.Selection()'
+        }
+      ]
+    }
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Component_PanelImportAndExport.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Component_PanelImportAndExport.def
new file mode 100644
index 0000000..367ca52
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Component_PanelImportAndExport.def
@@ -0,0 +1,37 @@
+Quintiq file version 2.0
+Component PanelImportAndExport
+{
+  #keys: '[414702.0.391512140]'
+  BaseType: 'WebPanel'
+  Children:
+  [
+    Component Import
+    {
+      #keys: '[414702.0.390081531]'
+      BaseType: 'WebButton'
+      Properties:
+      [
+        Image: 'IMPORT1'
+        Label: '瀵煎叆'
+        Taborder: 0
+      ]
+    }
+    Component Export
+    {
+      #keys: '[414702.0.391512453]'
+      BaseType: 'WebButton'
+      Properties:
+      [
+        Image: 'EXPORT1'
+        Label: '瀵煎嚭'
+        Taborder: 1
+      ]
+    }
+  ]
+  Properties:
+  [
+    FixedSize: true
+    Orientation: 'horizontal'
+    Taborder: 0
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Component_listActionBarPageCapacityAllocationResultsRuleConfiguration.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Component_listActionBarPageCapacityAllocationResultsRuleConfiguration.def
new file mode 100644
index 0000000..cc72a32
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Component_listActionBarPageCapacityAllocationResultsRuleConfiguration.def
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+Component listActionBarPageCapacityAllocationResultsRuleConfiguration
+{
+  #keys: '[414702.0.375255761]'
+  BaseType: 'listActionBarPage'
+  Properties:
+  [
+    Taborder: 1
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Component_listContextMenuCapacityAllocationResultsRuleConfiguration.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Component_listContextMenuCapacityAllocationResultsRuleConfiguration.def
new file mode 100644
index 0000000..597ad1b
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Component_listContextMenuCapacityAllocationResultsRuleConfiguration.def
@@ -0,0 +1,59 @@
+Quintiq file version 2.0
+Component listContextMenuCapacityAllocationResultsRuleConfiguration
+{
+  #keys: '[414702.0.375255766]'
+  BaseType: 'listContextMenu'
+  Children:
+  [
+    Component MenuNew
+    {
+      #keys: '[414702.0.373851234]'
+      BaseType: 'WebMenu'
+      Properties:
+      [
+        Image: 'BEAR'
+        Taborder: 3
+        Title: '鍒涘缓瑙勫垯'
+      ]
+    }
+    Component MenuEdit
+    {
+      #keys: '[414702.0.376312130]'
+      BaseType: 'WebMenu'
+      Properties:
+      [
+        BindOnDoubleClick: true
+        Image: 'MESSAGE_EDIT'
+        Taborder: 4
+        Title: '缂栬緫'
+      ]
+    }
+    Component MenuDelete
+    {
+      #keys: '[414702.0.382537902]'
+      BaseType: 'WebMenu'
+      Properties:
+      [
+        Image: 'DELETE'
+        Taborder: 5
+        Title: '鍒犻櫎'
+      ]
+    }
+    Component MenuSelectAll
+    {
+      #keys: '[414702.0.382602953]'
+      BaseType: 'WebMenu'
+      Properties:
+      [
+        Image: 'DOCUMENT_SELECTION'
+        Shortcut: 'Ctrl+A'
+        Taborder: 6
+        Title: '鍏ㄩ��'
+      ]
+    }
+  ]
+  Properties:
+  [
+    Taborder: 0
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_DataHolderSelectCapacityAllocationResultsRuleConfiguration_OnDataCh.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_DataHolderSelectCapacityAllocationResultsRuleConfiguration_OnDataCh.def
new file mode 100644
index 0000000..1c99357
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_DataHolderSelectCapacityAllocationResultsRuleConfiguration_OnDataCh.def
@@ -0,0 +1,18 @@
+Quintiq file version 2.0
+#parent: DataHolderSelectCapacityAllocationResultsRuleConfiguration
+Response OnDataChanged () id:Response_FormCapacityAllocationResultsRuleConfiguration_DataHolderSelectCapacityAllocationResultsRuleConfiguration_OnDataChanged
+{
+  #keys: '[414702.0.391379706]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebComponent_OnDataChanged'
+  QuillAction
+  {
+    Body:
+    [*
+      traverse ( this.Data(), Elements, e ) {
+        info( "闈㈡澘鐗╂枡ID锛�", e.PanelMaterialCode() );
+      }
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_ListCapacityAllocationResultsRuleConfiguration_MenuDelete_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_ListCapacityAllocationResultsRuleConfiguration_MenuDelete_OnClick.def
new file mode 100644
index 0000000..ecf8b8c
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_ListCapacityAllocationResultsRuleConfiguration_MenuDelete_OnClick.def
@@ -0,0 +1,18 @@
+Quintiq file version 2.0
+#parent: ListCapacityAllocationResultsRuleConfiguration
+Response OnClick (
+  CapacityAllocationResultsRuleConfiguration selection
+) id:Response_ListCapacityAllocationResultsRuleConfiguration_MenuDelete_OnClick
+{
+  #keys: '[414702.0.381071285]'
+  DefinitionID => /ListCapacityAllocationResultsRuleConfiguration/Responsedef_ListCapacityAllocationResultsRuleConfiguration_WebMenu_OnClick
+  Initiator: 'MenuDelete'
+  QuillAction
+  {
+    Body:
+    [*
+      selection.Delete();
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_ListCapacityAllocationResultsRuleConfiguration_MenuEdit_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_ListCapacityAllocationResultsRuleConfiguration_MenuEdit_OnClick.def
new file mode 100644
index 0000000..01a7ffa
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_ListCapacityAllocationResultsRuleConfiguration_MenuEdit_OnClick.def
@@ -0,0 +1,21 @@
+Quintiq file version 2.0
+#parent: ListCapacityAllocationResultsRuleConfiguration
+Response OnClick (
+  CapacityAllocationResultsRuleConfiguration selection
+) id:Response_ListCapacityAllocationResultsRuleConfiguration_MenuEdit_OnClick
+{
+  #keys: '[414702.0.376349145]'
+  CanBindMultiple: false
+  DefinitionID => /ListCapacityAllocationResultsRuleConfiguration/Responsedef_ListCapacityAllocationResultsRuleConfiguration_WebMenu_OnClick
+  Initiator: 'MenuEdit'
+  QuillAction
+  {
+    Body:
+    [*
+      dlg := construct( DialogCreateEditCapacityAllocationResultsRuleConfiguration );
+      
+      dlg.Edit( selection );
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_ListCapacityAllocationResultsRuleConfiguration_MenuNew_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_ListCapacityAllocationResultsRuleConfiguration_MenuNew_OnClick.def
new file mode 100644
index 0000000..76e0cd1
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_ListCapacityAllocationResultsRuleConfiguration_MenuNew_OnClick.def
@@ -0,0 +1,19 @@
+Quintiq file version 2.0
+#parent: ListCapacityAllocationResultsRuleConfiguration
+Response OnClick () id:Response_ListCapacityAllocationResultsRuleConfiguration_MenuNew_OnClick
+{
+  #keys: '[414702.0.375256192]'
+  CanBindMultiple: false
+  DefinitionID => /ListCapacityAllocationResultsRuleConfiguration/Responsedef_ListCapacityAllocationResultsRuleConfiguration_WebMenu_OnClick
+  Initiator: 'MenuNew'
+  QuillAction
+  {
+    Body:
+    [*
+      dlg := construct( DialogCreateEditCapacityAllocationResultsRuleConfiguration );
+      
+      dlg.New();
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_ListCapacityAllocationResultsRuleConfiguration_MenuSelectAll_OnClic.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_ListCapacityAllocationResultsRuleConfiguration_MenuSelectAll_OnClic.def
new file mode 100644
index 0000000..720300e
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_ListCapacityAllocationResultsRuleConfiguration_MenuSelectAll_OnClic.def
@@ -0,0 +1,17 @@
+Quintiq file version 2.0
+#parent: ListCapacityAllocationResultsRuleConfiguration
+Response OnClick () id:Response_ListCapacityAllocationResultsRuleConfiguration_MenuSelectAll_OnClick
+{
+  #keys: '[414702.0.381011855]'
+  CanBindMultiple: false
+  DefinitionID => /ListCapacityAllocationResultsRuleConfiguration/Responsedef_ListCapacityAllocationResultsRuleConfiguration_WebMenu_OnClick
+  Initiator: 'MenuSelectAll'
+  QuillAction
+  {
+    Body:
+    [*
+      this.SelectAll();
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_PanelImportAndExport_Export_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_PanelImportAndExport_Export_OnClick.def
new file mode 100644
index 0000000..602baba
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_PanelImportAndExport_Export_OnClick.def
@@ -0,0 +1,16 @@
+Quintiq file version 2.0
+#parent: PanelImportAndExport/Export
+Response OnClick () id:Response_PanelImportAndExport_Export_OnClick
+{
+  #keys: '[414702.0.391658465]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebButton_OnClick'
+  QuillAction
+  {
+    Body:
+    [*
+      Application.Download( "浜ц兘鍒嗛厤缁撴灉瑙勫垯.xlsx", CapacityAllocationResultsRuleConfiguration::Export( GlobalOTDTable ).AsBinaryData() );
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_PanelImportAndExport_Import_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_PanelImportAndExport_Import_OnClick.def
new file mode 100644
index 0000000..3e90d91
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/Response_PanelImportAndExport_Import_OnClick.def
@@ -0,0 +1,29 @@
+Quintiq file version 2.0
+#parent: PanelImportAndExport/Import
+Response OnClick () id:Response_PanelImportAndExport_Import_OnClick
+{
+  #keys: '[414702.0.391899822]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebButton_OnClick'
+  QuillAction
+  {
+    Body:
+    [*
+      try {
+        uploadJsonString := Application.GetFile();
+        if ( uploadJsonString <> "" ) {
+          uploadJson := JSON::Parse( uploadJsonString );
+          
+          fileName := uploadJson.Get( "name" ).GetString();
+          base64String := uploadJson.Get( "data" ).GetString();
+          CapacityAllocationResultsRuleConfiguration::Import( GlobalOTDTable, base64String );
+          
+          WebMessageBox::Success( "涓婁紶鎴愬姛", true );
+        }
+      } onerror {
+        WebMessageBox::Error( e.GeneralInformation(), true );
+      }
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/_ROOT_Component_FormCapacityAllocationResultsRuleConfiguration.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/_ROOT_Component_FormCapacityAllocationResultsRuleConfiguration.def
new file mode 100644
index 0000000..436ef69
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResultsRuleConfiguration/_ROOT_Component_FormCapacityAllocationResultsRuleConfiguration.def
@@ -0,0 +1,43 @@
+Quintiq file version 2.0
+#root
+#parent: MacroPlannerWebApp
+OrphanComponent FormCapacityAllocationResultsRuleConfiguration
+{
+  #keys: '[414702.0.373844315]'
+  BaseType: 'WebForm'
+  Children:
+  [
+    #child: ListCapacityAllocationResultsRuleConfiguration
+    Component DataHolderSelectCapacityAllocationResultsRuleConfiguration
+    {
+      #keys: '[414702.0.390054479]'
+      BaseType: 'WebDataHolder'
+      Databinding: 'structured[CapacityAllocationResultsRuleConfiguration]*'
+      Children:
+      [
+        Component DataExtractorSelectCapacityAllocationResultsRuleConfiguration
+        {
+          #keys: '[414702.0.391186862]'
+          BaseType: 'WebDataExtractor'
+          Properties:
+          [
+            DataType: 'CapacityAllocationResultsRuleConfiguration'
+            ExtractionMode: 'Selected'
+            Source: 'ListCapacityAllocationResultsRuleConfiguration'
+            Taborder: 0
+          ]
+        }
+      ]
+      Properties:
+      [
+        Taborder: 2
+      ]
+    }
+    #child: PanelImportAndExport
+  ]
+  Properties:
+  [
+    Image: 'DOCUMENT_CHECKS'
+    Title: '浜ц兘鍒嗛厤缁撴灉鎶ヨ〃-瑙勫垯缁存姢'
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Component_ListSalesDemands.def b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Component_ListSalesDemands.def
new file mode 100644
index 0000000..54be6e2
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Component_ListSalesDemands.def
@@ -0,0 +1,18 @@
+Quintiq file version 2.0
+Component ListSalesDemands #extension
+{
+  Children:
+  [
+    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_PanelAllSalesDemands.def b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Component_PanelAllSalesDemands.def
new file mode 100644
index 0000000..b6550d1
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Component_PanelAllSalesDemands.def
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+Component PanelAllSalesDemands #extension
+{
+  Children:
+  [
+    #child: ListSalesDemands
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Component_PanelSalesDemands.def b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Component_PanelSalesDemands.def
new file mode 100644
index 0000000..14acdde
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/Component_PanelSalesDemands.def
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+Component PanelSalesDemands #extension
+{
+  Children:
+  [
+    #child: PanelAllSalesDemands
+  ]
+}
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
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/_ROOT_Component_FormCustomerOrders.def b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/_ROOT_Component_FormCustomerOrders.def
new file mode 100644
index 0000000..040c94f
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders/_ROOT_Component_FormCustomerOrders.def
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+#root
+#parent: LibMacroPlannerWebUI
+OrphanComponent FormCustomerOrders #extension
+{
+  Children:
+  [
+    #child: PanelSalesDemands
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Component_ListSDIP.def b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Component_ListSDIP.def
new file mode 100644
index 0000000..b0cbc0a
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Component_ListSDIP.def
@@ -0,0 +1,20 @@
+Quintiq file version 2.0
+Component ListSDIP
+{
+  #keys: '[134266.1.1970512356]'
+  BaseType: 'ListSDIP'
+  IsDerived: true
+  Children:
+  [
+    Component DataSetLevelSDIP
+    {
+      #keys: '[134266.1.1970512358]'
+      BaseType: 'DataSetLevelSDIP'
+      IsDerived: true
+      Properties:
+      [
+        Columns: '[{"attribute":{"classtype":"WebApiDefinitionAttributeAllConstraint","columnid":"All constraints","title":"All constraints","subtotals":"","tooltip":"","width":1,"display":"shown"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ImgIsRestricted","title":"ImgIsRestricted","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"ImgIsRestricted"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"SalesSegmentName","title":"Sales segment","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"SalesSegmentName"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ProductID","title":"Product","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"ProductID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"StockingPointID","title":"Stocking point","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"StockingPointID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"StartDate","title":"Start","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"StartDate"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"EndDate","title":"End","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"EndDate"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"MasterSalesDemand.UnitOfMeasureName","title":"UoM","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"MasterSalesDemand.UnitOfMeasureName"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"QuantityInSalesDemandUOM","title":"Quantity","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"QuantityInSalesDemandUOM"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"FulfilledQuantityInSalesDemandUOM","title":"Fulfilled","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"FulfilledQuantityInSalesDemandUOM"}},{"attribute":{"classtype":"WebApiDefinitionAttributeChart","columnid":"Fulfillment","title":"Fulfillment","subtotals":"","tooltip":"","width":-1,"display":"shown","type":"stackbar","relative":true,"attributes":[{"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)"}},{"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)"}}]}}]'
+      ]
+    }
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Component_ListSalesDemands.def b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Component_ListSalesDemands.def
new file mode 100644
index 0000000..0abeb62
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Component_ListSalesDemands.def
@@ -0,0 +1,30 @@
+Quintiq file version 2.0
+Component ListSalesDemands
+{
+  #keys: '[134266.1.1970507083]'
+  BaseType: 'ListSalesDemands'
+  IsDerived: true
+  Children:
+  [
+    Component DataExtractorSalesDemands
+    {
+      #keys: '[134266.1.1970507084]'
+      BaseType: 'DataExtractorSalesDemands'
+      IsDerived: true
+      Properties:
+      [
+        Transformation: 'Elements.astype(CustomerOrder)'
+      ]
+    }
+    Component DataSetLevelSalesDemands
+    {
+      #keys: '[134266.1.1970507085]'
+      BaseType: 'DataSetLevelSalesDemands'
+      IsDerived: true
+      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"}}]'
+      ]
+    }
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Component_PanelAllSalesDemands.def b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Component_PanelAllSalesDemands.def
new file mode 100644
index 0000000..60db013
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Component_PanelAllSalesDemands.def
@@ -0,0 +1,11 @@
+Quintiq file version 2.0
+Component PanelAllSalesDemands
+{
+  #keys: '[134266.1.1970497658]'
+  BaseType: 'PanelAllSalesDemands'
+  IsDerived: true
+  Children:
+  [
+    #child: ListSalesDemands
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Component_PanelSDIP.def b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Component_PanelSDIP.def
new file mode 100644
index 0000000..6ddf675
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Component_PanelSDIP.def
@@ -0,0 +1,15 @@
+Quintiq file version 2.0
+Component PanelSDIP
+{
+  #keys: '[134266.1.1970511019]'
+  BaseType: 'PanelSDIP'
+  IsDerived: true
+  Children:
+  [
+    #child: ListSDIP
+  ]
+  Properties:
+  [
+    Title: 'Customer orders at planning level'
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Component_PanelSalesDemands.def b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Component_PanelSalesDemands.def
new file mode 100644
index 0000000..e90068d
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Component_PanelSalesDemands.def
@@ -0,0 +1,12 @@
+Quintiq file version 2.0
+Component PanelSalesDemands
+{
+  #keys: '[134266.1.1970506995]'
+  BaseType: 'PanelSalesDemands'
+  IsDerived: true
+  Children:
+  [
+    #child: PanelSDIP
+    #child: PanelAllSalesDemands
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Response_ListSalesDemands_MenuCopy_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Response_ListSalesDemands_MenuCopy_OnClick.def
new file mode 100644
index 0000000..e6db580
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Response_ListSalesDemands_MenuCopy_OnClick.def
@@ -0,0 +1,19 @@
+Quintiq file version 2.0
+#parent: ListSalesDemands
+Response OnClick () inherited id:Response_ListSalesDemands_MenuCopy_OnClick
+{
+  #keys: '[136682.1.799924425]'
+  BaseType: 'Response_ListSalesDemands_MenuCopy_OnClick'
+  DefinitionID: 'Responsedef_ListSalesDemands_WebMenu_OnClick'
+  Initiator: 'MenuCopy'
+  QuillAction
+  {
+    Body:
+    [*
+      // Copy sales demand
+      data := selectset( selection, Elements.astype( CustomerOrder ), co, true, true );
+      CustomerOrder::Copy( data );
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Response_ListSalesDemands_MenuCreate_OnClick\043715.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Response_ListSalesDemands_MenuCreate_OnClick\043715.def"
new file mode 100644
index 0000000..85a98aa
--- /dev/null
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Response_ListSalesDemands_MenuCreate_OnClick\043715.def"
@@ -0,0 +1,19 @@
+Quintiq file version 2.0
+#parent: ListSalesDemands
+Response OnClick () inherited id:Response_ListSalesDemands_MenuCreate_OnClick_715
+{
+  #keys: '[136682.1.803262814]'
+  BaseType: 'Response_ListSalesDemands_MenuCreate_OnClick_715'
+  DefinitionID: 'Responsedef_ListSalesDemands_WebMenu_OnClick'
+  Initiator: 'MenuCreate'
+  QuillAction
+  {
+    Body:
+    [*
+      //Create new sales demand
+      dlg := construct( DialogCreateEditCustomerOrder );
+      dlg.New();
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Response_ListSalesDemands_MenuEdit_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Response_ListSalesDemands_MenuEdit_OnClick.def
new file mode 100644
index 0000000..edf9a16
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/Response_ListSalesDemands_MenuEdit_OnClick.def
@@ -0,0 +1,20 @@
+Quintiq file version 2.0
+#parent: ListSalesDemands
+Response OnClick () inherited id:Response_ListSalesDemands_MenuEdit_OnClick
+{
+  #keys: '[136682.1.803135245]'
+  BaseType: 'Response_ListSalesDemands_MenuEdit_OnClick'
+  DefinitionID: 'Responsedef_ListSalesDemands_WebMenu_OnClick'
+  Initiator: 'MenuEdit'
+  QuillAction
+  {
+    Body:
+    [*
+      //Edit sales demand
+      dlg := construct( DialogCreateEditCustomerOrder );
+      
+      data := selectset( selection, Elements.astype( CustomerOrder ), f, true, true );
+      dlg.Edit( data );
+    *]
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/_ROOT_Component_FormCustomerOrders226.def b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/_ROOT_Component_FormCustomerOrders226.def
new file mode 100644
index 0000000..4e72e24
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCustomerOrders226/_ROOT_Component_FormCustomerOrders226.def
@@ -0,0 +1,18 @@
+Quintiq file version 2.0
+#root
+#parent: MacroPlannerWebApp
+OrphanComponent FormCustomerOrders226
+{
+  #keys: '[414724.0.179160850]'
+  Accessibility: 'Extensible'
+  BaseType: 'FormSalesDemands'
+  Children:
+  [
+    #child: PanelSalesDemands
+  ]
+  Properties:
+  [
+    Image: 'SALES_QUOTATION'
+    Title: 'Customer orders'
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFillingCapacityScheme/Component_listContextMenuCustomerAndFillingCapacityOrder.def b/_Main/UI/MacroPlannerWebApp/Component_FormFillingCapacityScheme/Component_listContextMenuCustomerAndFillingCapacityOrder.def
index 01848c5..8ba1423 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFillingCapacityScheme/Component_listContextMenuCustomerAndFillingCapacityOrder.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFillingCapacityScheme/Component_listContextMenuCustomerAndFillingCapacityOrder.def
@@ -16,7 +16,7 @@
         Title: 'Filling'
       ]
     }
-    Component MenuTest
+    Component MenuRefresh
     {
       #keys: '[414382.0.415603149]'
       BaseType: 'WebMenu'
@@ -24,7 +24,7 @@
       [
         Image: 'ADD2'
         Taborder: 4
-        Title: 'Test'
+        Title: '鍒锋柊'
       ]
     }
   ]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFillingCapacityScheme/Response_ListCustomerAndFillingCapacityOrder_MenuTest_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormFillingCapacityScheme/Response_ListCustomerAndFillingCapacityOrder_MenuRefresh_OnClick.def
similarity index 70%
rename from _Main/UI/MacroPlannerWebApp/Component_FormFillingCapacityScheme/Response_ListCustomerAndFillingCapacityOrder_MenuTest_OnClick.def
rename to _Main/UI/MacroPlannerWebApp/Component_FormFillingCapacityScheme/Response_ListCustomerAndFillingCapacityOrder_MenuRefresh_OnClick.def
index f292299..aba413a 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFillingCapacityScheme/Response_ListCustomerAndFillingCapacityOrder_MenuTest_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFillingCapacityScheme/Response_ListCustomerAndFillingCapacityOrder_MenuRefresh_OnClick.def
@@ -1,17 +1,17 @@
 Quintiq file version 2.0
 #parent: ListCustomerAndFillingCapacityOrder
-Response OnClick () id:Response_ListCustomerAndFillingCapacityOrder_MenuTest_OnClick
+Response OnClick () id:Response_ListCustomerAndFillingCapacityOrder_MenuRefresh_OnClick
 {
   #keys: '[414382.0.415724061]'
   CanBindMultiple: false
   DefinitionID => /ListCustomerAndFillingCapacityOrder/Responsedef_ListCustomerAndFillingCapacityOrder_WebMenu_OnClick
-  GroupServerCalls: true
-  Initiator: 'MenuTest'
+  Initiator: 'MenuRefresh'
   QuillAction
   {
     Body:
     [*
-      CustomerAndForecastOrder::CreateTestData( MacroPlan);
+      CustomerAndForecastOrder::RefreshData(  MacroPlan,GlobalOTDTable);
     *]
+    GroupServerCalls: false
   }
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFillingScheme/Response_ListFillingScheme_MenuDelete_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormFillingScheme/Response_ListFillingScheme_MenuDelete_OnClick.def
index 92f2bb9..f103e1b 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFillingScheme/Response_ListFillingScheme_MenuDelete_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFillingScheme/Response_ListFillingScheme_MenuDelete_OnClick.def
@@ -21,7 +21,8 @@
   {
     Body:
     [*
-      selection.Delete()
+      FilllingCapacityOrderScheme::DeleteDetails( MacroPlan,selection.SchemeName());
+      selection.Delete();
     *]
     GroupServerCalls: false
   }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFillingScheme/Response_ListFillingScheme_OnSelectionChanged.def b/_Main/UI/MacroPlannerWebApp/Component_FormFillingScheme/Response_ListFillingScheme_OnSelectionChanged.def
new file mode 100644
index 0000000..7986675
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFillingScheme/Response_ListFillingScheme_OnSelectionChanged.def
@@ -0,0 +1,20 @@
+Quintiq file version 2.0
+#parent: ListFillingScheme
+Response OnSelectionChanged (
+  FilllingCapacityOrderScheme selection
+) id:Response_ListFillingScheme_OnSelectionChanged
+{
+  #keys: '[414382.0.532640606]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebList_OnSelectionChanged'
+  QuillAction
+  {
+    Body:
+    [*
+      schemeName := selection.SchemeName();
+      list := selectset( MacroPlan,FillingCapacityOrder,order,order.SchemeName() = selection.SchemeName());
+      DataHolderFillingScheme.Data(&list);
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormIssueWorkOrder/Component_ListIssueWorkOrder.def b/_Main/UI/MacroPlannerWebApp/Component_FormIssueWorkOrder/Component_ListIssueWorkOrder.def
index 23d2fcb..c3f47fb 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormIssueWorkOrder/Component_ListIssueWorkOrder.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormIssueWorkOrder/Component_ListIssueWorkOrder.def
@@ -28,7 +28,7 @@
       ]
       Properties:
       [
-        Columns: '[{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ProductionWorkOrderNumber","title":"ProductionWorkOrderNumber","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ProductionWorkOrderNumber"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ProductModel","title":"ProductModel","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ProductModel"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"MaterialDescription","title":"MaterialDescription","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"MaterialDescription"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"StartDate","title":"StartDate","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"StartDate"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"EndDate","title":"EndDate","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"EndDate"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"PlannedQuantity","title":"PlannedQuantity","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"PlannedQuantity"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"WorkOrderType","title":"WorkOrderType","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"WorkOrderType"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"WorkOrderStatus","title":"WorkOrderStatus","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"WorkOrderStatus"}}]'
+        Columns: '[{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ProductionWorkOrderNumber","title":"ProductionWorkOrderNumber","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ProductionWorkOrderNumber"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ProductModel","title":"Product ID","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ProductModel"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"MaterialDescription","title":"MaterialDescription","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"MaterialDescription"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"StartDate","title":"StartDate","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"StartDate"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"EndDate","title":"EndDate","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"EndDate"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"PlannedQuantity","title":"PlannedQuantity","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"PlannedQuantity"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"WorkOrderType","title":"WorkOrderType","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"WorkOrderType"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"WorkOrderStatus","title":"WorkOrderStatus","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"WorkOrderStatus"}}]'
         ContextMenu: 'MenuIssueEdit'
         Taborder: 2
       ]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormIssueWorkOrder/Response_ListIssueWorkOrder_MenuEdit_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormIssueWorkOrder/Response_ListIssueWorkOrder_MenuEdit_OnClick.def
index f516650..d9366a0 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormIssueWorkOrder/Response_ListIssueWorkOrder_MenuEdit_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormIssueWorkOrder/Response_ListIssueWorkOrder_MenuEdit_OnClick.def
@@ -8,13 +8,23 @@
   CanBindMultiple: false
   DefinitionID => /ListIssueWorkOrder/Responsedef_ListIssueWorkOrder_WebMenu_OnClick
   Initiator: 'MenuEdit'
+  Precondition:
+  [*
+    flag := DataHolderCheckedMasterPlanReleaseWorkOrderTabulation.Data().Size() > 0;
+    
+    if ( not flag ) {
+     feedback := "鏈�夋嫨鏁版嵁";
+    }
+    
+    return flag;
+  *]
   QuillAction
   {
     Body:
     [*
       dlg := construct( DialogCreateEditIssueWorkOrder );
       
-      dlg.Edit( selection );
+      dlg.Edit( DataHolderCheckedMasterPlanReleaseWorkOrderTabulation.Data() );
     *]
     GroupServerCalls: false
   }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPanelMaterialTianHua/_ROOT_Component_FormPanelMaterialTianHua.def b/_Main/UI/MacroPlannerWebApp/Component_FormPanelMaterialTianHua/_ROOT_Component_FormPanelMaterialTianHua.def
index 31b93b5..08db4f3 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormPanelMaterialTianHua/_ROOT_Component_FormPanelMaterialTianHua.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormPanelMaterialTianHua/_ROOT_Component_FormPanelMaterialTianHua.def
@@ -32,8 +32,8 @@
   ]
   Properties:
   [
-    Description: '澶╄姳'
+    Description: '澶╁崕'
     Image: 'CANDLE'
-    Title: '澶╄姳'
+    Title: '澶╁崕'
   ]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Component_listContextMenuPriorityFactor.def b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Component_listContextMenuPriorityFactor.def
index c6dd966..6ac9928 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Component_listContextMenuPriorityFactor.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Component_listContextMenuPriorityFactor.def
@@ -5,17 +5,6 @@
   BaseType: 'listContextMenu'
   Children:
   [
-    Component MenuInitData
-    {
-      #keys: '[414382.0.482890505]'
-      BaseType: 'WebMenu'
-      Properties:
-      [
-        Image: 'GEAR'
-        Taborder: 3
-        Title: 'Init Data'
-      ]
-    }
     Component MenuEdit
     {
       #keys: '[414382.0.485622263]'
@@ -23,7 +12,7 @@
       Properties:
       [
         Image: 'GEAR_EDIT'
-        Taborder: 4
+        Taborder: 3
         Title: '缂栬緫'
       ]
     }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_DataHolderPriorityFactorBusinessType_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_DataHolderPriorityFactorBusinessType_OnCreated.def
new file mode 100644
index 0000000..97bd89b
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_DataHolderPriorityFactorBusinessType_OnCreated.def
@@ -0,0 +1,17 @@
+Quintiq file version 2.0
+#parent: DataHolderPriorityFactorBusinessType
+Response OnCreated () id:Response_FormPriorityFactor_DataHolderPriorityFactorBusinessType_OnCreated
+{
+  #keys: '[414382.0.539235155]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebComponent_OnCreated'
+  QuillAction
+  {
+    Body:
+    [*
+      businessTypeList := selectset( GlobalOTDTable,BusinessType,b,true);
+      this.Data(&businessTypeList);
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_DataHolderPriorityFactorBusinessType_OnDataChanged.def b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_DataHolderPriorityFactorBusinessType_OnDataChanged.def
new file mode 100644
index 0000000..f02625b
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_DataHolderPriorityFactorBusinessType_OnDataChanged.def
@@ -0,0 +1,19 @@
+Quintiq file version 2.0
+#parent: DataHolderPriorityFactorBusinessType
+Response OnDataChanged () id:Response_FormPriorityFactor_DataHolderPriorityFactorBusinessType_OnDataChanged
+{
+  #keys: '[414382.0.539235291]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebComponent_OnDataChanged'
+  QuillAction
+  {
+    Body:
+    [*
+      businessTypeList := selectset( GlobalOTDTable,BusinessType,b,true);
+      this.Data(&businessTypeList);
+      strings := BusinessType::GetBusinessNameStr( GlobalOTDTable );
+      DropDownStringListBusinessType.Strings(strings);
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_DropDownStringListBusinessType_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_DropDownStringListBusinessType_OnCreated.def
index 338425b..639dcea 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_DropDownStringListBusinessType_OnCreated.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_DropDownStringListBusinessType_OnCreated.def
@@ -2,7 +2,7 @@
 #parent: DropDownStringListBusinessType
 Response OnCreated () id:Response_FormPriorityFactor_DropDownStringListBusinessType_OnCreated
 {
-  #keys: '[414382.0.461201807]'
+  #keys: '[414382.0.539375553]'
   CanBindMultiple: false
   DefinitionID: 'Responsedef_WebComponent_OnCreated'
   QuillAction
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_DropDownStringListBusinessType_OnSelectionChanged.def b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_DropDownStringListBusinessType_OnSelectionChanged.def
index 1018d65..2ac7956 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_DropDownStringListBusinessType_OnSelectionChanged.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_DropDownStringListBusinessType_OnSelectionChanged.def
@@ -9,6 +9,7 @@
   {
     Body:
     [*
+      info( "selection" );
       list := PriorityFactor::GetDataByBusinessType( MacroPlan, DropDownStringListBusinessType.Text());
       DataHolderPriorityFactorSelect.Data(&list);
     *]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_ListPriorityFactor_MenuInitData_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_ListPriorityFactor_MenuInitData_OnClick.def
deleted file mode 100644
index f165c1b..0000000
--- a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_ListPriorityFactor_MenuInitData_OnClick.def
+++ /dev/null
@@ -1,17 +0,0 @@
-Quintiq file version 2.0
-#parent: ListPriorityFactor
-Response OnClick () id:Response_ListPriorityFactor_MenuInitData_OnClick
-{
-  #keys: '[414382.0.482802120]'
-  CanBindMultiple: false
-  DefinitionID => /ListPriorityFactor/Responsedef_ListPriorityFactor_WebMenu_OnClick
-  Initiator: 'MenuInitData'
-  QuillAction
-  {
-    Body:
-    [*
-      PriorityFactorDetails::CreateTestData(  MacroPlan);
-    *]
-    GroupServerCalls: false
-  }
-}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_ListPriorityFactor_OnClick.def "b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_ListPriorityFactor_OnClick\043106.def"
similarity index 100%
rename from _Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_ListPriorityFactor_OnClick.def
rename to "_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_ListPriorityFactor_OnClick\043106.def"
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_ListPriorityFactor_OnSelectionChanged.def b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_ListPriorityFactor_OnSelectionChanged.def
new file mode 100644
index 0000000..235a322
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/Response_ListPriorityFactor_OnSelectionChanged.def
@@ -0,0 +1,20 @@
+Quintiq file version 2.0
+#parent: ListPriorityFactor
+Response OnSelectionChanged (
+  PriorityFactor selection
+) id:Response_ListPriorityFactor_OnSelectionChanged
+{
+  #keys: '[414382.0.541275298]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebList_OnSelectionChanged'
+  QuillAction
+  {
+    Body:
+    [*
+      info( "selecion change" );
+      detaisls := PriorityFactorDetails::GetDataByPriorityFactor( selection, MacroPlan);
+      DataHolderPriorityFactorDetailsSelect.Data(&detaisls);
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/_ROOT_Component_FormPriorityFactor.def b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/_ROOT_Component_FormPriorityFactor.def
index f6e060e..fa7ba3e 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/_ROOT_Component_FormPriorityFactor.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactor/_ROOT_Component_FormPriorityFactor.def
@@ -38,5 +38,19 @@
         Taborder: 3
       ]
     }
+    Component DataHolderPriorityFactorBusinessType
+    {
+      #keys: '[414382.0.539205233]'
+      BaseType: 'WebDataHolder'
+      Databinding: 'structured[BusinessType]*'
+      Properties:
+      [
+        Taborder: 4
+      ]
+    }
+  ]
+  Properties:
+  [
+    Title: '浼樺厛绾у洜瀛�'
   ]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactorGrading/_ROOT_Component_FormPriorityFactorGrading.def b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactorGrading/_ROOT_Component_FormPriorityFactorGrading.def
index bef2ddb..b9ab15b 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactorGrading/_ROOT_Component_FormPriorityFactorGrading.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityFactorGrading/_ROOT_Component_FormPriorityFactorGrading.def
@@ -33,4 +33,8 @@
     }
     #child: ListPriorityFactorGrading
   ]
+  Properties:
+  [
+    Title: '浼樺厛绾у洜瀛愮粏鍒�'
+  ]
 }
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Component_PanelPriorityPolicyCoefficient\043902.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Component_PanelPriorityPolicyCoefficient\043902.def"
index e2c6e2f..62b4cb9 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Component_PanelPriorityPolicyCoefficient\043902.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Component_PanelPriorityPolicyCoefficient\043902.def"
@@ -21,7 +21,7 @@
       BaseType: 'WebButton'
       Properties:
       [
-        Label: '瀹屾垚'
+        Label: '淇濆瓨'
         Taborder: 1
       ]
     }
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Component_PanelPriorityPolicyOperationButton\043713.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Component_PanelPriorityPolicyOperationButton\043713.def"
index 9c91139..571a83c 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Component_PanelPriorityPolicyOperationButton\043713.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Component_PanelPriorityPolicyOperationButton\043713.def"
@@ -11,7 +11,7 @@
       BaseType: 'WebButton'
       Properties:
       [
-        Label: '娣诲姞鍥犲瓙'
+        Label: '娣诲姞'
         Taborder: 1
       ]
     }
@@ -31,7 +31,7 @@
       BaseType: 'WebButton'
       Properties:
       [
-        Label: '*'
+        Label: '-'
         Taborder: 3
       ]
     }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_DataHolderPriorityPolicySelectBusinessType_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_DataHolderPriorityPolicySelectBusinessType_OnCreated.def
deleted file mode 100644
index d3d9c4a..0000000
--- a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_DataHolderPriorityPolicySelectBusinessType_OnCreated.def
+++ /dev/null
@@ -1,17 +0,0 @@
-Quintiq file version 2.0
-#parent: DataHolderPriorityPolicySelectBusinessType
-Response OnCreated () id:Response_FormPriorityPolicy_DataHolderPriorityPolicySelectBusinessType_OnCreated
-{
-  #keys: '[414382.0.493813692]'
-  CanBindMultiple: false
-  DefinitionID: 'Responsedef_WebComponent_OnCreated'
-  QuillAction
-  {
-    Body:
-    [*
-      this.Data(PriorityPolicyBusinessType.Text());
-    *]
-    GroupServerCalls: false
-  }
-}
-
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_ListPriorityPolicy_MenuDelete_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_ListPriorityPolicy_MenuDelete_OnClick.def
index 5517113..96d7545 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_ListPriorityPolicy_MenuDelete_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_ListPriorityPolicy_MenuDelete_OnClick.def
@@ -12,6 +12,7 @@
   {
     Body:
     [*
+      
       selection.Delete();
     *]
     GroupServerCalls: false
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_ListPriorityPolicy_OnUserSelectionChanged.def b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_ListPriorityPolicy_OnUserSelectionChanged.def
index e16df3d..09c165d 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_ListPriorityPolicy_OnUserSelectionChanged.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_ListPriorityPolicy_OnUserSelectionChanged.def
@@ -17,11 +17,11 @@
       str := PriorityFactor::GetNameList( MacroPlan, businessType);
       DropDownStringList.Strings(str);
       
+      LabelFormula.Text(selection.Formula());
+      LabelCalculateValue.Text(selection.CalculateValue());
+      
       data := shadow( selection );
       DataHolderEditPriorityPolicy.Data( &data );
-      
-      //coefficient := PriorityFactor::GetCoeffcientByName( MacroPlan,businessType,DropDownStringList.Text());
-      //LabelPriorityPolicyCoefficient.Text([String]coefficient);
     *]
     GroupServerCalls: false
   }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PanelPriorityPolicyOperationButton_ButtonAddPriorityPolicy_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PanelPriorityPolicyOperationButton_ButtonAddPriorityPolicy_OnClick.def
index 3b56ae5..383cbb2 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PanelPriorityPolicyOperationButton_ButtonAddPriorityPolicy_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PanelPriorityPolicyOperationButton_ButtonAddPriorityPolicy_OnClick.def
@@ -5,6 +5,12 @@
   #keys: '[414382.0.502145449]'
   CanBindMultiple: false
   DefinitionID: 'Responsedef_WebButton_OnClick'
+  Precondition:
+  [*
+    feedback := "璇ヤ紭鍏堢骇鍥犲瓙宸茶閫夋嫨."
+    
+    return not LabelFormula.Text() ~ DropDownStringList.Text();
+  *]
   QuillAction
   {
     Body:
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PanelPriorityPolicyOperationButton_ButtonRollBack_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PanelPriorityPolicyOperationButton_ButtonRollBack_OnClick.def
index f8952da..d7adf1d 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PanelPriorityPolicyOperationButton_ButtonRollBack_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PanelPriorityPolicyOperationButton_ButtonRollBack_OnClick.def
@@ -13,7 +13,7 @@
       formulaText := PriorityPolicy::RollBackStr( MacroPlan,businessType,LabelFormula.Text());
       LabelFormula.Text(formulaText);
       
-      calculateTest := PriorityPolicy::RollBackStr( MacroPlan,businessType,LabelCalculateValue.Text());
+      calculateTest := PriorityPolicy::RollBackCalcStr( MacroPlan,businessType,LabelCalculateValue.Text());
       LabelCalculateValue.Text(calculateTest);
     *]
     GroupServerCalls: false
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PanelPriorityPolicyOperationButton_DropDownStringList_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PanelPriorityPolicyOperationButton_DropDownStringList_OnCreated.def
new file mode 100644
index 0000000..7cbbd08
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PanelPriorityPolicyOperationButton_DropDownStringList_OnCreated.def
@@ -0,0 +1,17 @@
+Quintiq file version 2.0
+#parent: PanelPriorityPolicyOperationButton/DropDownStringList
+Response OnCreated () id:Response_PanelPriorityPolicyOperationButton_DropDownStringList_OnCreated
+{
+  #keys: '[414382.0.539822108]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebComponent_OnCreated'
+  QuillAction
+  {
+    Body:
+    [*
+      strs := PriorityFactor::GetNameList( MacroPlan,DropDownStringList.Text());
+      this.Strings(strs);
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PanelPriorityPolicyOperationButton_DropDownStringList_OnSelectionCh.def b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PanelPriorityPolicyOperationButton_DropDownStringList_OnSelectionCh.def
index 9debaba..9fc4b38 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PanelPriorityPolicyOperationButton_DropDownStringList_OnSelectionCh.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityPolicy/Response_PanelPriorityPolicyOperationButton_DropDownStringList_OnSelectionCh.def
@@ -9,11 +9,9 @@
   {
     Body:
     [*
-      info( "select changeed" );
       businessType := PriorityPolicyBusinessType.Text();
       coefficient := PriorityFactor::GetCoeffcientByName( MacroPlan,businessType,DropDownStringList.Text());
       LabelPriorityPolicyCoefficient.Text([String]coefficient);
-      info("coefficient := " + [String]coefficient  );
     *]
     GroupServerCalls: false
   }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityResult/_ROOT_Component_FormPriorityResult.def b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityResult/_ROOT_Component_FormPriorityResult.def
index 99f642d..aeac56e 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormPriorityResult/_ROOT_Component_FormPriorityResult.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormPriorityResult/_ROOT_Component_FormPriorityResult.def
@@ -30,4 +30,8 @@
       ]
     }
   ]
+  Properties:
+  [
+    Title: '浼樺厛绾х粨鏋滈〉闈�'
+  ]
 }
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 5140232..560aeb3 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() );
+      dlg.dropDownStringListGeneral().Strings( ScenarioManager::AvailableBusinessTypes(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 126a965..ff086e5 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() );
+      dlg.dropDownStringListGeneral().Strings( ScenarioManager::AvailableBusinessTypes(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 b9fdf28..4e81457 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() );
+      dlg.dropDownStringListGeneral().Strings( ScenarioManager::AvailableBusinessTypes(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 913510e..52b82cf 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() );
+      dlg.dropDownStringListGeneral().Strings( ScenarioManager::AvailableBusinessTypes(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 fd08942..8fbf279 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() );
+      dlg.dropDownStringListGeneral().Strings( ScenarioManager::AvailableBusinessTypes(GlobalOTDTable) );
       dlg.checkboxIsKeyProduct().Visible( selection.EnableSync() );
       dlg.checkboxCreatePurchaseSupplyProduct().Visible( selection.EnableSync() );
       
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmAuthorizeAndCountersign_Material/Response_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FrmAuthorizeAndCountersign_Material/Response_OnCreated.def
index 1b87aa1..0b8df6f 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmAuthorizeAndCountersign_Material/Response_OnCreated.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FrmAuthorizeAndCountersign_Material/Response_OnCreated.def
@@ -21,9 +21,12 @@
         {
           JInfo := JSON::Parse( SelectItem.ValueJsonString());
           lb_SUK_FAACM.Text(JInfo.Get( "ParentSKU").GetString());
+          lb_SKUName_FAACM.Text(JInfo.Get( "ParentSKUName").GetString());
           lb_MaterialCode_FAACM.Text(JInfo.Get( "SKU").GetString());
+          lb_MaterialName.Text(JInfo.Get( "MaterialName").GetString());
           lb_Unit_FAACM.Text(JInfo.Get( "Unit").GetString());
           lb_Operator_FAACM.Text(ApplicationMacroPlanner.GetUserName());
+          lb_MaterialType_FAACM.Text(JInfo.Get( "MaterialType").GetString());
           txt_CustomID_FAACM.Text(JInfo.Get( "CustomCode").GetString());
           txt_CustomName_FAACM.Text(JInfo.Get( "CustomName").GetString());
         }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmMaterial/Response_List832_OnDoubleClick.def b/_Main/UI/MacroPlannerWebApp/Component_FrmMaterial/Response_List832_OnDoubleClick.def
index b04f7cf..b2a673b 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmMaterial/Response_List832_OnDoubleClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FrmMaterial/Response_List832_OnDoubleClick.def
@@ -13,19 +13,33 @@
     [*
       if( not isnull( selection))
       {
+        // 棰勬祴璁㈠崟鍩烘湰淇℃伅
+        CustomCode:="";
+        CustomName:="";
+        SKUName:="";
+        SValueJsonString:="";
+        // 鑾峰彇瀹㈡埛鍚嶇О鍜屽鎴稩D
+        if(txtSaveForecastData_FM.Text().Length()>0)
+        {
+           jForecast := JSON::Parse( txtSaveForecastData_FM.Text());
+           CustomCode := jForecast.Get( "CustomCode").GetString();
+           CustomName := jForecast.Get( "CustomName").GetString();
+           SKUName := jForecast.Get( "SKUName").GetString();
+        }
+        
         if(selection.MaterialType()="鍗婃垚鍝�")
         {
-          OrderCode:="";
+          ForecastID:="";
           if( txtSaveForecastData_FM.Text().Length()>0)
           {
-            JForecast := JSON::Parse( txtSaveForecastData_FM.Text());
-            OrderCode := JForecast.Get( "OrderCode").GetString();
+            JForecast := JSON::Parse(txtSaveForecastData_FM.Text());
+            ForecastID := JForecast.Get( "ForecastID").GetString();
           }
-         jResult := H_FunctionClass::SM_GetMaterialData( MacroPlan,selection.SKU(),selection.NeedQty(), OrderCode,"-",selection.NeedDate());
+         jResult := H_FunctionClass::SM_GetMaterialData( MacroPlan,selection.SKU(),selection.NeedQty(), ForecastID,"-",selection.NeedDate(),GlobalOTDTable);
           if(jResult.Get( "Status").GetBoolean())
           {
                 de_dh_FM_ProductMP.FixedFilter( "object.ParentSKU() = " +  selection.SKU().AsQUILL()
-                                                + " and object.ForecastID() = " + OrderCode.AsQUILL()
+                                                + " and object.ForecastID() = " + ForecastID.AsQUILL()
                                                 );
           }
           else
@@ -35,7 +49,28 @@
         }
         else
         {
-            // 寮瑰嚭鐗╂枡鍙嶇鎺堟潈
+          SelectItem :=  select( MacroPlan,H_MessagePassing,Obj,Obj.FKey()="FrmMaterial" and Obj.ItemKey()="ListSelect");
+          if(not isnull(selection))
+          {
+            SValueJsonString:= JSON::Object().Add( "SKU",selection.SKU())
+                        .Add( "MaterialName",selection.MaterialName())
+                        .Add( "MaterialType",selection.MaterialType())
+                        .Add( "OrgCode",selection.OrgCode())
+                        .Add( "Unit",selection.Unit())
+                        .Add( "CustomCode",CustomCode)
+                        .Add( "ParentSKU",lb_SUK_FM.Text())
+                        .Add( "ParentSKUName",SKUName)
+                        .Add( "CustomName",CustomName).Build().AsString();
+          }
+          if(isnull( SelectItem))
+          {
+            MacroPlan.H_MessagePassing(relnew,FKey := "FrmMaterial",ItemKey := "ListSelect", ValueJsonString:=SValueJsonString);
+          }
+          else
+          {
+            SelectItem.ValueJsonString( SValueJsonString);
+          }
+          Application.OpenForm( "FrmAuthorizeAndCountersign_Material","modal");
         }
       }
     *]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmMaterial/Response_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FrmMaterial/Response_OnCreated.def
index c3a42c1..4529905 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmMaterial/Response_OnCreated.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FrmMaterial/Response_OnCreated.def
@@ -17,11 +17,11 @@
       {
         if( SelectItem.ValueJsonString().Length()>0)
         {
-          txtSaveForecastData_FM.Text(  SelectItem.ValueJsonString());
-          JSelect := JSON::Parse( SelectItem.ValueJsonString());
+          txtSaveForecastData_FM.Text(SelectItem.ValueJsonString());
+          JSelect := JSON::Parse(SelectItem.ValueJsonString());
           lb_SUK_FM.Text(JSelect.Get( "SKU").GetString());
           de_dh_FM_ProductMP.FixedFilter( "object.ParentSKU() = " + JSelect.Get( "SKU").GetString().AsQUILL()
-                                          + " and object.ForecastID() = " + JSelect.Get( "OrderCode").GetString().AsQUILL()
+                                          + " and object.ForecastID() = " + JSelect.Get( "ForecastID").GetString().AsQUILL()
                                           );
         }
       }
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FrmMaterial/Response_Panel418_btn_Add_FM_OnClick\043975.def" "b/_Main/UI/MacroPlannerWebApp/Component_FrmMaterial/Response_Panel418_btn_Add_FM_OnClick\043975.def"
index dd32915..45e0871 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_FrmMaterial/Response_Panel418_btn_Add_FM_OnClick\043975.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FrmMaterial/Response_Panel418_btn_Add_FM_OnClick\043975.def"
@@ -20,12 +20,14 @@
       CustomName:="";
       SValue:="";
       SValueJsonString:="";
+      SKUName:="";
       // 鑾峰彇瀹㈡埛鍚嶇О鍜屽鎴稩D
       if(txtSaveForecastData_FM.Text().Length()>0)
       {
          jForecast := JSON::Parse( txtSaveForecastData_FM.Text());
          CustomCode := jForecast.Get( "CustomCode").GetString();
          CustomName := jForecast.Get( "CustomName").GetString();
+         SKUName := jForecast.Get( "SKUName").GetString();
       }
       if(not isnull(selection))
       {
@@ -36,6 +38,7 @@
                     .Add( "Unit",selection.Unit())
                     .Add( "CustomCode",CustomCode)
                     .Add( "ParentSKU",lb_SUK_FM.Text())
+                    .Add( "ParentSKUName",SKUName)
                     .Add( "CustomName",CustomName).Build().AsString();
       }
       if( isnull( SelectItem))
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_Panel351.def b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_Panel351.def
index c6fbad5..2d6bd11 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_Panel351.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_Panel351.def
@@ -11,9 +11,10 @@
       BaseType: 'WebButton'
       Properties:
       [
+        ButtonSize: 'compact'
         Description: '璁㈠崟鏂板鍙嶇/鎺堟潈'
         Label: '璁㈠崟鏂板鍙嶇/鎺堟潈'
-        Taborder: 1
+        Taborder: 0
       ]
       ResponseDefinitions:
       [
@@ -39,9 +40,10 @@
       BaseType: 'WebButton'
       Properties:
       [
+        ButtonSize: 'compact'
         Description: '鍘熸枡鏂板鍙嶇/鎺堟潈'
         Label: '鍘熸枡鏂板鍙嶇/鎺堟潈'
-        Taborder: 2
+        Taborder: 1
       ]
       ResponseDefinitions:
       [
@@ -61,30 +63,42 @@
         }
       ]
     }
-    Component btn_InitialData778
-    {
-      #keys: '[414724.0.115504406]'
-      BaseType: 'WebButton'
-      Properties:
-      [
-        Description: '鍔犺浇鏁版嵁锛堝亣鐨勶紝鍚庣画闇�瑕佸鎺ユ暟鎹級'
-        Label: '鍔犺浇棰勬祴璁㈠崟鏁版嵁'
-        Taborder: 0
-        Visible: false
-      ]
-    }
     Component btn_OrderH_FOF
     {
       #keys: '[414724.0.165490408]'
       BaseType: 'WebButton'
       Properties:
       [
+        ButtonSize: 'compact'
         Description: 'ERO璁㈠崟鍐插噺'
         Image: 'AMMUNITION_BOX_CLOSED'
         Label: 'ERP璁㈠崟鍐插噺'
+        Taborder: 2
+      ]
+    }
+    Component txt_QueryContent_FOF
+    {
+      #keys: '[414724.0.172390935]'
+      BaseType: 'WebEditField'
+      Properties:
+      [
+        PlaceHolder: '妯$硦鎼滅储'
         Taborder: 3
       ]
     }
+    Component btn_Query_FOF
+    {
+      #keys: '[414724.0.172390951]'
+      BaseType: 'WebButton'
+      Properties:
+      [
+        ButtonSize: 'compact'
+        Description: '鏌ヨ'
+        Image: 'VIEW'
+        Label: '鏌ヨ'
+        Taborder: 4
+      ]
+    }
   ]
   Properties:
   [
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_Panel383.def b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_Panel383.def
deleted file mode 100644
index ff6b8ad..0000000
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_Panel383.def
+++ /dev/null
@@ -1,53 +0,0 @@
-Quintiq file version 2.0
-Component Panel383
-{
-  #keys: '[414724.0.86151558]'
-  BaseType: 'WebPanel'
-  Children:
-  [
-    Component ds_Month_FOF
-    {
-      #keys: '[414724.0.86151747]'
-      BaseType: 'WebDateSelector'
-      Properties:
-      [
-        DateFormat: 'YMM'
-        Label: '鏈堜唤'
-        Taborder: 0
-        Visible: false
-      ]
-    }
-    Component txt_QueryContent_FOF
-    {
-      #keys: '[414724.0.86151766]'
-      BaseType: 'WebEditField'
-      Properties:
-      [
-        PlaceHolder: '妯$硦鎼滅储'
-        Taborder: 1
-        Visible: false
-      ]
-    }
-    Component btn_Query_FOF
-    {
-      #keys: '[414724.0.88914059]'
-      BaseType: 'WebButton'
-      Properties:
-      [
-        Description: '鏌ヨ'
-        Image: 'VIEW'
-        Label: '鏌ヨ'
-        Taborder: 2
-        Visible: false
-      ]
-    }
-  ]
-  Properties:
-  [
-    FixedSize: true
-    MinimumColumns: 80
-    Orientation: 'horizontal'
-    Taborder: 0
-    Visible: false
-  ]
-}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_Panel647.def b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_Panel647.def
deleted file mode 100644
index 7b147ac..0000000
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_Panel647.def
+++ /dev/null
@@ -1,50 +0,0 @@
-Quintiq file version 2.0
-Component Panel647
-{
-  #keys: '[414724.0.86151576]'
-  BaseType: 'WebPanel'
-  Children:
-  [
-    Component btn_Add_Order_FOF
-    {
-      #keys: '[414724.0.87342042]'
-      BaseType: 'WebButton'
-      Properties:
-      [
-        Description: '璁㈠崟鏂板鍙嶇/鎺堟潈'
-        Label: '璁㈠崟鏂板鍙嶇/鎺堟潈'
-        Taborder: 1
-      ]
-    }
-    Component btn_Add_Material_FOF
-    {
-      #keys: '[414724.0.86151707]'
-      BaseType: 'WebButton'
-      Properties:
-      [
-        Description: '鍘熸枡鏂板鍙嶇/鎺堟潈'
-        Label: '鍘熸枡鏂板鍙嶇/鎺堟潈'
-        Taborder: 2
-      ]
-    }
-    Component btn_InitialData
-    {
-      #keys: '[414724.0.93657921]'
-      BaseType: 'WebButton'
-      Properties:
-      [
-        Description: '鍔犺浇鏁版嵁锛堝亣鐨勶紝鍚庣画闇�瑕佸鎺ユ暟鎹級'
-        Label: '鍔犺浇棰勬祴璁㈠崟鏁版嵁'
-        Taborder: 0
-        Visible: false
-      ]
-    }
-  ]
-  Properties:
-  [
-    Alignment: 'trailing'
-    FixedSize: true
-    Orientation: 'horizontal'
-    Taborder: 1
-  ]
-}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_Panel849.def b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_Panel849.def
deleted file mode 100644
index 35b07f6..0000000
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_Panel849.def
+++ /dev/null
@@ -1,19 +0,0 @@
-Quintiq file version 2.0
-Component Panel849
-{
-  #keys: '[414724.0.87341748]'
-  BaseType: 'WebPanel'
-  Children:
-  [
-    #child: Panel383
-    #child: Panel647
-  ]
-  Properties:
-  [
-    Description: '宸茬粡闅愯棌锛屾殏鏈娇鐢�'
-    FixedSize: true
-    Orientation: 'horizontal'
-    Taborder: 2
-    Visible: false
-  ]
-}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_liH_Forecast.def b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_liH_Forecast.def
index e056848..67ab89e 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_liH_Forecast.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_liH_Forecast.def
@@ -11,8 +11,8 @@
       BaseType: 'WebDataExtractor'
       Properties:
       [
-        DataType: 'structured[H_Forecast]'
-        Source: 'dh_FOF_H_Forecast'
+        DataType: 'structured[H_OrderForecastRealQty]'
+        Source: 'dh_FOF_H_OrderForecastRealQty'
         Taborder: 0
         Transformation: 'Elements'
       ]
@@ -28,7 +28,7 @@
       ]
       Properties:
       [
-        Columns: '[{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"OrderCode","title":"璁㈠崟缂栧彿","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"OrderCode"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"SKU","title":"SKU缂栫爜","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"SKU"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ForecastQty","title":"棰勬祴鏁伴噺","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ForecastQty"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"NeedTime","title":"闇�姹傛椂闂�","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"NeedTime"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Util","title":"鍗曚綅","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Util"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"CustomName","title":"瀹㈡埛鍚嶇О","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"CustomName"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Department","title":"閿�鍞儴闂�","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Department"}}]'
+        Columns: '[{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Month","title":"鏈堜唤","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Month"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"CustomName","title":"瀹㈡埛鍚嶇О","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"CustomName"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"SKU","title":"SKU缂栧彿","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"SKU"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ForecatsQty","title":"棰勬祴鏁伴噺","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ForecatsQty"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ForecatsRealQty","title":"绾娴嬫暟閲�","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ForecatsRealQty"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Unit","title":"鍗曚綅","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Unit"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Department","title":"閮ㄩ棬","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Department"}}]'
         ContextMenu: 'listContextMenu367'
         Taborder: 2
       ]
@@ -36,6 +36,6 @@
   ]
   Properties:
   [
-    Taborder: 7
+    Taborder: 3
   ]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_listActionBarPage963.def b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_listActionBarPage963.def
deleted file mode 100644
index 320820a..0000000
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_listActionBarPage963.def
+++ /dev/null
@@ -1,10 +0,0 @@
-Quintiq file version 2.0
-Component listActionBarPage963
-{
-  #keys: '[414724.0.86151897]'
-  BaseType: 'listActionBarPage'
-  Properties:
-  [
-    Taborder: 1
-  ]
-}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_listContextMenu687.def b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_listContextMenu687.def
deleted file mode 100644
index 5f3683c..0000000
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_listContextMenu687.def
+++ /dev/null
@@ -1,10 +0,0 @@
-Quintiq file version 2.0
-Component listContextMenu687
-{
-  #keys: '[414724.0.86151902]'
-  BaseType: 'listContextMenu'
-  Properties:
-  [
-    Taborder: 0
-  ]
-}
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_list_ForecastView_FOF\043670.def" "b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_list_ForecastView_FOF\043670.def"
deleted file mode 100644
index 0c21175..0000000
--- "a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Component_list_ForecastView_FOF\043670.def"
+++ /dev/null
@@ -1,43 +0,0 @@
-Quintiq file version 2.0
-Component list_ForecastView_FOF
-{
-  #keys: '[414724.0.86151894]'
-  BaseType: 'WebList'
-  Children:
-  [
-    Component de_list_ForecastView_FOF
-    {
-      #keys: '[414724.0.86151895]'
-      BaseType: 'WebDataExtractor'
-      Properties:
-      [
-        DataType: 'structured[SalesDemandBase]'
-        Source: 'dh_FOF_Data'
-        Taborder: 0
-        Transformation: 'Elements.astype(Forecast)'
-      ]
-    }
-    #child: listActionBarPage963
-    Component DataSetLevel191
-    {
-      #keys: '[414724.0.86151900]'
-      BaseType: 'WebDataSetLevel'
-      Children:
-      [
-        #child: listContextMenu687
-      ]
-      Properties:
-      [
-        Columns: '[{"attribute":{"classtype":"WebApiDefinitionAttributeAllConstraint","columnid":"All constraints","title":"All constraints","subtotals":"","tooltip":"","width":1,"display":"shown"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ImgNotLinkedToPeriod","title":"ImgNotLinkedToPeriod","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"ImgNotLinkedToPeriod"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ImgIsPostponed","title":"ImgIsPostponed","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"ImgIsPostponed"}},{"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":"Product_MP.ID","title":"Product","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"Product_MP.ID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"StartDate","title":"Start","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"StartDate"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"EndDate","title":"End","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"EndDate"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"UnitOfMeasure_MP.Name","title":"Quantity UoM","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"UnitOfMeasure_MP.Name"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Quantity","title":"Original Qty","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Quantity"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"NettedQuantity","title":"Quantity","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"NettedQuantity"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"FulfilledQuantity","title":"Fulfilled","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"FulfilledQuantity"}},{"attribute":{"classtype":"WebApiDefinitionAttributeChart","columnid":"Fulfillment Illustration","title":"Fulfillment","subtotals":"","tooltip":"","width":-1,"display":"shown","type":"stackbar","relative":true,"attributes":[{"name":"Fulfilled demand","color":"rgb(87,184,71)","expression":{"classtype":"WebApiDefinitionAttributeExpression","columnid":"Fulfillment","title":"Fulfilled demand","subtotals":"","tooltip":"","width":-1,"display":"shown","expressionbody":"object.FulfilledQuantity().Round(2)"}},{"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.NettedQuantity()-object.FulfilledQuantity(),0.0).Round(2)"}}]}},{"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":"Priority.Name","title":"Priority","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"Priority.Name"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"DemandUncertaintyPercentage","title":"Uncertainty","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"DemandUncertaintyPercentage"}}]'
-        ContextMenu: 'listContextMenu687'
-        FixedFilter: 'object.EndDate().DateTime().Date() >= Date::ActualDate().StartOfMonth() and object.EndDate().DateTime().Date() <= Date::ActualDate().StartOfNextMonth().StartOfNextMonth().StartOfNextMonth().StartOfNextMonth()'
-        Taborder: 2
-      ]
-    }
-  ]
-  Properties:
-  [
-    Taborder: 5
-    Visible: false
-  ]
-}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_OnCreated.def
index 5cb899a..700b61d 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_OnCreated.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_OnCreated.def
@@ -9,13 +9,15 @@
   {
     Body:
     [*
-      // 鍒濆鍖栨煡璇㈠弬鏁版湀浠�
-      ds_Month_FOF.Date(Date::ActualDate());
       // 鍒濆鍖栭娴嬫暟鎹�
-      JResult := H_FunctionClass::SM_InitialForcastData( MacroPlan);
+      JResult := H_FunctionClass::SM_InitialForcastDataEx( MacroPlan,true,"-");
       if(not JResult.Get( "Status").GetBoolean())
       {
-          WebMessageBox::Warning( JResult.Get( "Msg").GetString());
+        WebMessageBox::Warning( JResult.Get( "Msg").GetString());
+      }
+      else
+      {
+        WebMessageBox::Information( JResult.Get( "Msg").GetString());
       }
     *]
     GroupServerCalls: false
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel351_btn_Add_Material_FOF503_OnClick\043222.def" "b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel351_btn_Add_Material_FOF503_OnClick\043222.def"
index 0f50e1f..67308a0 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel351_btn_Add_Material_FOF503_OnClick\043222.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel351_btn_Add_Material_FOF503_OnClick\043222.def"
@@ -1,7 +1,7 @@
 Quintiq file version 2.0
 #parent: Panel351/btn_Add_Material_FOF503
 Response OnClick (
-  H_Forecast selection
+  H_OrderForecastRealQty selection
 ) id:Response_Panel351_btn_Add_Material_FOF503_OnClick_222
 {
   #keys: '[414724.0.145178766]'
@@ -17,28 +17,28 @@
         if( isnull( SelectItem))
         {
            MacroPlan.H_MessagePassing(relnew,FKey :="FrmOrderForecast",ItemKey := "ListSelect",
-                                       Value := selection.SKU()+";"+selection.Util()+";"+selection.CustomCode()+";"+selection.CustomName(),
                                        ValueJsonString := JSON::Object().Add( "SKU",selection.SKU())
-                                                                         .Add( "Util",selection.Util())
-                                                                         .Add( "CustomCode",selection.CustomCode())
-                                                                         .Add( "CustomName",selection.CustomName())
-                                                                         .Add( "ForecastQty",selection.ForecastQty())
-                                                                         .Add( "NeedTime",selection.NeedTime().AsQUILL())
-                                                                         .Add( "OrderCode",selection.OrderCode()).Build().AsString());
+                                                                       .Add( "SKUName",selection.SKUName())
+                                                                       .Add( "Util",selection.Unit())
+                                                                       .Add( "CustomCode",selection.CustomCode())
+                                                                       .Add( "CustomName",selection.CustomName())
+                                                                       .Add( "ForecastQty",selection.ForecastQty())
+                                                                       .Add( "ForecastID",selection.ID())
+                                                                       .Add( "NeedTime",selection.Month().AsQUILL()).Build().AsString());
         }
         else
         {
-          SelectItem.Value(selection.SKU()+";"+selection.Util()+";"+selection.CustomCode()+";"+selection.CustomName());
           SelectItem.ValueJsonString(JSON::Object().Add( "SKU",selection.SKU())
-                                   .Add( "Util",selection.Util())
-                                   .Add( "CustomCode",selection.CustomCode())
-                                   .Add( "CustomName",selection.CustomName())
-                                   .Add( "ForecastQty",selection.ForecastQty())
-                                   .Add( "NeedTime",selection.NeedTime().AsQUILL())
-                                   .Add( "OrderCode",selection.OrderCode()).Build().AsString());
+                                                   .Add( "SKUName",selection.SKUName())
+                                                   .Add( "Util",selection.Unit())
+                                                   .Add( "CustomCode",selection.CustomCode())
+                                                   .Add( "CustomName",selection.CustomName())
+                                                   .Add( "ForecastQty",selection.ForecastQty())
+                                                   .Add( "ForecastID",selection.ID())
+                                                   .Add( "NeedTime",selection.Month().AsQUILL()).Build().AsString());
         }
         
-        jResult := H_FunctionClass::SM_GetMaterialData( MacroPlan,selection.SKU(),selection.ForecastQty(),selection.OrderCode(),"-",selection.NeedTime());
+        jResult := H_FunctionClass::SM_GetMaterialData( MacroPlan,selection.SKU(),selection.ForecastQty(),selection.ID(),"-",selection.Month(),GlobalOTDTable);
         if(jResult.Get( "Status").GetBoolean())
         {
             Application.OpenForm( "FrmMaterial","popout");
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel351_btn_Add_Order_FOF449_OnClick\043880.def" "b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel351_btn_Add_Order_FOF449_OnClick\043880.def"
index bf1f99c..7432121 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel351_btn_Add_Order_FOF449_OnClick\043880.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel351_btn_Add_Order_FOF449_OnClick\043880.def"
@@ -1,7 +1,7 @@
 Quintiq file version 2.0
 #parent: Panel351/btn_Add_Order_FOF449
 Response OnClick (
-  H_Forecast selection
+  H_OrderForecastRealQty selection
 ) id:Response_Panel351_btn_Add_Order_FOF449_OnClick_880
 {
   #keys: '[414724.0.141244111]'
@@ -16,20 +16,21 @@
         SelectItem :=  select( MacroPlan,H_MessagePassing,Obj,Obj.FKey()="FrmOrderForecast" and Obj.ItemKey()="ListSelect");
         if( isnull( SelectItem))
         {
+          
            MacroPlan.H_MessagePassing(relnew,FKey :="FrmOrderForecast",ItemKey := "ListSelect",
-                                       Value := selection.SKU()+";"+selection.Util()+";"+selection.CustomCode()+";"+selection.CustomName(),
-                                       ValueJsonString := JSON::Object().Add( "SKU",selection.SKU())
-                                                                         .Add( "Util",selection.Util())
-                                                                         .Add( "CustomCode",selection.CustomCode())
-                                                                         .Add( "CustomName",selection.CustomName()).Build().AsString());
+                                      ValueJsonString := JSON::Object().Add( "SKU",selection.SKU())
+                                                                       .Add( "Util",selection.Unit())
+                                                                       .Add( "CustomCode",selection.CustomCode())
+                                                                       .Add( "SKUName",selection.SKUName())
+                                                                       .Add( "CustomName",selection.CustomName()).Build().AsString());
         }
         else
         {
-          SelectItem.Value(selection.SKU()+";"+selection.Util()+";"+selection.CustomCode()+";"+selection.CustomName());
           SelectItem.ValueJsonString(JSON::Object().Add( "SKU",selection.SKU())
-                                   .Add( "Util",selection.Util())
-                                   .Add( "CustomCode",selection.CustomCode())
-                                   .Add( "CustomName",selection.CustomName()).Build().AsString());
+                                                   .Add( "Util",selection.Unit())
+                                                   .Add( "CustomCode",selection.CustomCode())
+                                                   .Add( "SKUName",selection.SKUName())
+                                                   .Add( "CustomName",selection.CustomName()).Build().AsString());
         }
         Application.OpenForm( "FrmAuthorizeAndCountersign_Order","modal");  
       }
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel351_btn_InitialData778_OnClick\043971.def" "b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel351_btn_InitialData778_OnClick\043971.def"
deleted file mode 100644
index 7ec4937..0000000
--- "a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel351_btn_InitialData778_OnClick\043971.def"
+++ /dev/null
@@ -1,35 +0,0 @@
-Quintiq file version 2.0
-#parent: Panel351/btn_InitialData778
-Response OnClick () id:Response_Panel351_btn_InitialData778_OnClick_971
-{
-  #keys: '[414724.0.141222418]'
-  CanBindMultiple: false
-  DefinitionID: 'Responsedef_WebButton_OnClick'
-  QuillAction
-  {
-    Body:
-    [*
-      //// 娌℃湁鐢ㄧ殑鎸夐挳鍜屽嚱鏁帮紝鍙负浜嗘祴璇曠敓鎴愬亣鏁版嵁銆�
-      //StrCustoms:="XM_2023,灏忕背;HW_2023,鍗庝负;OV_2023,VIVO;OP_2023,OPPO;HX_2023,娴蜂俊;YJ_2023,涓�鍔�;HE_2023,娴峰皵;GL_2023,鏍煎姏;";
-      //ArrayCustom := StrCustoms.Tokenize( ";"); //8涓鎴�
-      //idx :=0;
-      //for( i:=0;i<20;i:=i+1)
-      //{
-      //  idx :=Number::Random( 0,7);
-      //  arrCustomInfo := ArrayCustom.Element( idx).Tokenize( ",");
-      //  MacroPlan.H_Forecast(relnew, CustomName := arrCustomInfo.Element( 1),CustomCode := arrCustomInfo.Element( 0),ForecastQty := Number::Random( 100,5000),
-      //                        Department := "閿�鍞�1閮�",NeedTime := Date::ActualDate(),OrderCode := H_FunctionClass::SM_GenerateID( "OF") ,SKU := "SKU-CP-2023-N"+(Number::Random( 1000,9999)).AsQUILL(),Util := "PCS");  
-      //  
-      //}
-      //// 鐢熸垚棰勬祴 瀹炴椂鏁版嵁锛屽弽绛炬暟鎹紝鎺堟潈鏁版嵁锛堝弽绛� 鎺堟潈榛樿涓�0锛屽鑷姩鍒涘缓锛岃繖閲屼笉鍐嶆坊鍔狅級
-      // traverse(MacroPlan,H_Forecast ,Obj,not isnull(Obj) )
-      //{
-      //  MacroPlan.H_OrderForecastRealQty(relnew,CustomID := Obj.CustomCode(),CustomName := Obj.CustomName(),ForecatsQty := Obj.ForecastQty(),
-      //                                    ForecatsRealQty := Obj.ForecastQty(),ID := H_FunctionClass::SM_GenerateID( "OF"),Month := Date::ActualDate(),
-      //                                    OrderCode := Obj.OrderCode(),SKU := Obj.SKU(),Unit := Obj.Util());
-      //                                    
-      //}
-    *]
-    GroupServerCalls: false
-  }
-}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel351_btn_Query_FOF_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel351_btn_Query_FOF_OnClick.def
new file mode 100644
index 0000000..1b95a1a
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel351_btn_Query_FOF_OnClick.def
@@ -0,0 +1,21 @@
+Quintiq file version 2.0
+#parent: Panel351/btn_Query_FOF
+Response OnClick () id:Response_Panel351_btn_Query_FOF_OnClick
+{
+  #keys: '[414724.0.172390950]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebButton_OnClick'
+  QuillAction
+  {
+    Body:
+    [*
+      de_dh_FOF_H_Foecast.FixedFilter( "object.SKU().LikeUserLocale( " + txt_QueryContent_FOF.Text().AsQUILL() + " )"
+                                                   + " or " + "object.CustomName().LikeUserLocale( " + txt_QueryContent_FOF.Text().AsQUILL() + " )"  
+                                                   + " or " + "object.Unit().LikeUserLocale( " + txt_QueryContent_FOF.Text().AsQUILL() + " )" 
+                                                   + " or " + "object.Department().LikeUserLocale( " + txt_QueryContent_FOF.Text().AsQUILL() + " )" 
+                                                   + " or " + "object.StockingPointID().LikeUserLocale( " + txt_QueryContent_FOF.Text().AsQUILL() + " )"
+                                      );
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel383_btn_Query_FOF_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel383_btn_Query_FOF_OnClick.def
deleted file mode 100644
index 41a29a8..0000000
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel383_btn_Query_FOF_OnClick.def
+++ /dev/null
@@ -1,17 +0,0 @@
-Quintiq file version 2.0
-#parent: Panel383/btn_Query_FOF
-Response OnClick () id:Response_Panel383_btn_Query_FOF_OnClick
-{
-  #keys: '[414724.0.91472695]'
-  CanBindMultiple: false
-  DefinitionID: 'Responsedef_WebButton_OnClick'
-  QuillAction
-  {
-    Body:
-    [*
-      MacroPlan.H_Forecast(relnew, CustomName := "灏忕背",CustomCode := "XM001",ForecastQty := 100,Department := "閿�鍞�1閮�",
-                                         NeedTime := Date::ActualDate(),OrderCode := "00010101",SKU := "ANNDDSSSS",Util := "PCS");
-    *]
-    GroupServerCalls: false
-  }
-}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel647_btn_Add_Material_FOF_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel647_btn_Add_Material_FOF_OnClick.def
deleted file mode 100644
index b54e053..0000000
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel647_btn_Add_Material_FOF_OnClick.def
+++ /dev/null
@@ -1,20 +0,0 @@
-Quintiq file version 2.0
-#parent: Panel647/btn_Add_Material_FOF
-Response OnClick () id:Response_Panel647_btn_Add_Material_FOF_OnClick
-{
-  #keys: '[414724.0.86152486]'
-  CanBindMultiple: false
-  DefinitionID: 'Responsedef_WebButton_OnClick'
-  Precondition:
-  [*
-    return not isnull( MacroPlan);
-  *]
-  QuillAction
-  {
-    Body:
-    [*
-      Application.OpenForm( "FrmMaterial","popout");
-    *]
-    GroupServerCalls: false
-  }
-}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel647_btn_Add_Order_FOF_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel647_btn_Add_Order_FOF_OnClick.def
deleted file mode 100644
index 82c16f5..0000000
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel647_btn_Add_Order_FOF_OnClick.def
+++ /dev/null
@@ -1,28 +0,0 @@
-Quintiq file version 2.0
-#parent: Panel647/btn_Add_Order_FOF
-Response OnClick () id:Response_Panel647_btn_Add_Order_FOF_OnClick
-{
-  #keys: '[414724.0.86152095]'
-  CanBindMultiple: false
-  DefinitionID: 'Responsedef_WebButton_OnClick'
-  Precondition:
-  [*
-    return not isnull( MacroPlan);
-  *]
-  QuillAction
-  {
-    Body:
-    [*
-      SelectItem := select( MacroPlan,H_MessagePassing,Obj,Obj.FKey()="FrmOrderForecast" and Obj.ItemKey()="ListSelect");
-      if(not isnull( SelectItem) and SelectItem.Value().Length()>0)
-      {
-        Application.OpenForm( "FrmAuthorizeAndCountersign_Order","popout");
-      }
-      else
-      {
-        WebMessageBox::Information( "璇烽�夋嫨涓�椤归娴嬪悗鍐嶇偣鍑绘寜閽紒");  
-      }
-    *]
-    GroupServerCalls: false
-  }
-}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel647_btn_InitialData_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel647_btn_InitialData_OnClick.def
deleted file mode 100644
index 1804c2e..0000000
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_Panel647_btn_InitialData_OnClick.def
+++ /dev/null
@@ -1,39 +0,0 @@
-Quintiq file version 2.0
-#parent: Panel647/btn_InitialData
-Response OnClick () id:Response_Panel647_btn_InitialData_OnClick
-{
-  #keys: '[414724.0.93657952]'
-  CanBindMultiple: false
-  DefinitionID: 'Responsedef_WebButton_OnClick'
-  Precondition:
-  [*
-    return not isnull( MacroPlan);
-  *]
-  QuillAction
-  {
-    Body:
-    [*
-      // 娌℃湁鐢ㄧ殑鎸夐挳鍜屽嚱鏁帮紝鍙负浜嗘祴璇曠敓鎴愬亣鏁版嵁銆�
-      StrCustoms:="XM_2023,灏忕背;HW_2023,鍗庝负;OV_2023,VIVO;OP_2023,OPPO;HX_2023,娴蜂俊;YJ_2023,涓�鍔�;HE_2023,娴峰皵;GL_2023,鏍煎姏;";
-      ArrayCustom := StrCustoms.Tokenize( ";"); //8涓鎴�
-      idx :=0;
-      for( i:=0;i<20;i:=i+1)
-      {
-        idx :=Number::Random( 0,7);
-        arrCustomInfo := ArrayCustom.Element( idx).Tokenize( ",");
-        MacroPlan.H_Forecast(relnew, CustomName := arrCustomInfo.Element( 1),CustomCode := arrCustomInfo.Element( 0),ForecastQty := Number::Random( 100,5000),
-                              Department := "閿�鍞�1閮�",NeedTime := Date::ActualDate(),OrderCode := H_FunctionClass::SM_GenerateID( "OF") ,SKU := "SKU-CP-2023-N"+(Number::Random( 1000,9999)).AsQUILL(),Util := "PCS");  
-        
-      }
-      // 鐢熸垚棰勬祴 瀹炴椂鏁版嵁锛屽弽绛炬暟鎹紝鎺堟潈鏁版嵁锛堝弽绛� 鎺堟潈榛樿涓�0锛屽鑷姩鍒涘缓锛岃繖閲屼笉鍐嶆坊鍔狅級
-       traverse(MacroPlan,H_Forecast ,Obj,not isnull(Obj) )
-      {
-        MacroPlan.H_OrderForecastRealQty(relnew,CustomID := Obj.CustomCode(),CustomName := Obj.CustomName(),ForecatsQty := Obj.ForecastQty(),
-                                          ForecatsRealQty := Obj.ForecastQty(),ID := H_FunctionClass::SM_GenerateID( "OF"),Month := Date::ActualDate(),
-                                          OrderCode := Obj.OrderCode(),SKU := Obj.SKU(),Unit := Obj.Util());
-                                          
-      }
-    *]
-    GroupServerCalls: false
-  }
-}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_liH_Forecast_OnDoubleClick.def b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_liH_Forecast_OnDoubleClick.def
index 991029e..ac7e8b0 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_liH_Forecast_OnDoubleClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_liH_Forecast_OnDoubleClick.def
@@ -1,7 +1,7 @@
 Quintiq file version 2.0
 #parent: liH_Forecast
 Response OnDoubleClick (
-  H_Forecast selection
+  H_OrderForecastRealQty selection
 ) id:Response_liH_Forecast_OnDoubleClick
 {
   #keys: '[414724.0.111761136]'
@@ -15,28 +15,28 @@
       if( isnull( SelectItem))
       {
          MacroPlan.H_MessagePassing(relnew,FKey :="FrmOrderForecast",ItemKey := "ListSelect",
-                                     Value := selection.SKU()+";"+selection.Util()+";"+selection.CustomCode()+";"+selection.CustomName(),
                                      ValueJsonString := JSON::Object().Add( "SKU",selection.SKU())
-                                                                       .Add( "Util",selection.Util())
+                                                                       .Add( "SKUName",selection.SKUName())
+                                                                       .Add( "Util",selection.Unit())
                                                                        .Add( "CustomCode",selection.CustomCode())
                                                                        .Add( "CustomName",selection.CustomName())
                                                                        .Add( "ForecastQty",selection.ForecastQty())
-                                                                       .Add( "NeedTime",selection.NeedTime().AsQUILL())
-                                                                       .Add( "OrderCode",selection.OrderCode()).Build().AsString());
+                                                                       .Add( "ForecastID",selection.ID())
+                                                                       .Add( "NeedTime",selection.Month().AsQUILL()).Build().AsString());
       }
       else
       {
-        SelectItem.Value(selection.SKU()+";"+selection.Util()+";"+selection.CustomCode()+";"+selection.CustomName());
         SelectItem.ValueJsonString(JSON::Object().Add( "SKU",selection.SKU())
-                                 .Add( "Util",selection.Util())
-                                 .Add( "CustomCode",selection.CustomCode())
-                                 .Add( "CustomName",selection.CustomName())
-                                 .Add( "ForecastQty",selection.ForecastQty())
-                                 .Add( "NeedTime",selection.NeedTime().AsQUILL())
-                                 .Add( "OrderCode",selection.OrderCode()).Build().AsString());
+                                                 .Add( "SKUName",selection.SKUName())
+                                                 .Add( "Util",selection.Unit())
+                                                 .Add( "CustomCode",selection.CustomCode())
+                                                 .Add( "CustomName",selection.CustomName())
+                                                 .Add( "ForecastQty",selection.ForecastQty())
+                                                 .Add( "ForecastID",selection.ID())
+                                                 .Add( "NeedTime",selection.Month().AsQUILL()).Build().AsString());
       }
       
-      jResult := H_FunctionClass::SM_GetMaterialData( MacroPlan,selection.SKU(),selection.ForecastQty(),selection.OrderCode(),"-",selection.NeedTime());
+      jResult := H_FunctionClass::SM_GetMaterialData( MacroPlan,selection.SKU(),selection.ForecastQty(),selection.ID(),"-",selection.Month(),GlobalOTDTable );
       if(jResult.Get( "Status").GetBoolean())
       {
         Application.OpenForm( "FrmMaterial","popout");
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_list_ForecastView_FOF_OnDoubleClick.def b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_list_ForecastView_FOF_OnDoubleClick.def
deleted file mode 100644
index 3d85f54..0000000
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_list_ForecastView_FOF_OnDoubleClick.def
+++ /dev/null
@@ -1,30 +0,0 @@
-Quintiq file version 2.0
-#parent: list_ForecastView_FOF
-Response OnDoubleClick (
-  Forecast selection
-) id:Response_list_ForecastView_FOF_OnDoubleClick
-{
-  #keys: '[414724.0.92081867]'
-  CanBindMultiple: false
-  DefinitionID: 'Responsedef_WebList_OnDoubleClick'
-  GroupServerCalls: true
-  Precondition:
-  [*
-    return not isnull( MacroPlan);
-  *]
-  QuillAction
-  {
-    Body:
-    [*
-      SelectItem :=  select( MacroPlan,H_MessagePassing,Obj,Obj.FKey()="FrmOrderForecast" and Obj.ItemKey()="ListSelect");
-      if( isnull( SelectItem))
-      {
-         MacroPlan.H_MessagePassing(relnew,FKey :="FrmOrderForecast",ItemKey := "ListSelect",Value := "");
-      }
-      CustomID := "NO";
-      CustonName :="鏈姄鍙栧埌";
-      SelectItem.Value(selection.ProductID()+";"+selection.UnitOfMeasureName()+";"+CustomID+";"+CustonName);
-      Application.OpenForm( "FrmMaterial","popout");
-    *]
-  }
-}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_list_ForecastView_FOF_OnSelectionChanged.def b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_list_ForecastView_FOF_OnSelectionChanged.def
deleted file mode 100644
index 582090d..0000000
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/Response_list_ForecastView_FOF_OnSelectionChanged.def
+++ /dev/null
@@ -1,25 +0,0 @@
-Quintiq file version 2.0
-#parent: list_ForecastView_FOF
-Response OnSelectionChanged (
-  Forecast selection
-) id:Response_list_ForecastView_FOF_OnSelectionChanged
-{
-  #keys: '[414724.0.91684287]'
-  CanBindMultiple: false
-  DefinitionID: 'Responsedef_WebList_OnSelectionChanged'
-  QuillAction
-  {
-    Body:
-    [*
-      SelectItem :=  select( MacroPlan,H_MessagePassing,Obj,Obj.FKey()="FrmOrderForecast" and Obj.ItemKey()="ListSelect");
-      if( isnull( SelectItem))
-      {
-         MacroPlan.H_MessagePassing(relnew,FKey :="FrmOrderForecast",ItemKey := "ListSelect",Value := "");
-      }
-      CustomID := "NO";
-      CustonName :="鏈姄鍙栧埌";
-      SelectItem.Value(selection.ProductID()+";"+selection.UnitOfMeasureName()+";"+CustomID+";"+CustonName);
-    *]
-    GroupServerCalls: false
-  }
-}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/_ROOT_Component_FrmOrderForecast.def b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/_ROOT_Component_FrmOrderForecast.def
index d6e1cad..3d07f93 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/_ROOT_Component_FrmOrderForecast.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FrmOrderForecast/_ROOT_Component_FrmOrderForecast.def
@@ -7,100 +7,12 @@
   BaseType: 'WebForm'
   Children:
   [
-    #child: Panel849
-    #child: list_ForecastView_FOF
-    Component dh_FOF_Data
-    {
-      #keys: '[414724.0.86151860]'
-      BaseType: 'WebDataHolder'
-      Databinding: 'structured[SalesDemandBase]*'
-      Children:
-      [
-        Component de_dh_FOF_Data
-        {
-          #keys: '[414724.0.86151875]'
-          BaseType: 'WebDataExtractor'
-          Properties:
-          [
-            DataType: 'structured[SalesDemandBase]'
-            Source: 'dh_FOF_ChildrenData'
-            Taborder: 0
-            Transformation: 'Elements'
-          ]
-        }
-        Component DataExtractor819
-        {
-          #keys: '[414724.0.107645127]'
-          BaseType: 'WebDataExtractor'
-          Properties:
-          [
-            DataType: 'MacroPlan'
-            Source: 'MacroPlan'
-            Taborder: 1
-            Transformation: 'SalesDemand'
-          ]
-        }
-      ]
-      Properties:
-      [
-        Taborder: 4
-      ]
-    }
     #child: Panel961
-    Component dh_FOF_ChildrenData
-    {
-      #keys: '[414724.0.106541535]'
-      BaseType: 'WebDataHolder'
-      Databinding: 'structured[SalesDemandBase]*'
-      Children:
-      [
-        Component de_FOF_ChildrenData_0
-        {
-          #keys: '[414724.0.106541577]'
-          BaseType: 'WebDataExtractor'
-          Properties:
-          [
-            DataType: 'structured[Product_MP]'
-            Source: 'ApplicationMacroPlanner.DataHolderProduct'
-            Taborder: 0
-            Transformation: 'Elements.SalesDemand'
-          ]
-        }
-        Component de_FOF_ChildrenData_1
-        {
-          #keys: '[414724.0.106541594]'
-          BaseType: 'WebDataExtractor'
-          Properties:
-          [
-            DataType: 'structured[StockingPoint_MP]'
-            Source: 'ApplicationMacroPlanner.DataHolderStockingPoint'
-            Taborder: 1
-            Transformation: 'Elements.SalesDemand'
-          ]
-        }
-        Component de_FOF_ChildrenData_2
-        {
-          #keys: '[414724.0.106541611]'
-          BaseType: 'WebDataExtractor'
-          Properties:
-          [
-            DataType: 'structured[SalesSegment_MP]'
-            Source: 'ApplicationMacroPlanner.DataHolderSalesSegment'
-            Taborder: 2
-            Transformation: 'Elements.SalesDemand'
-          ]
-        }
-      ]
-      Properties:
-      [
-        Taborder: 3
-      ]
-    }
-    Component dh_FOF_H_Forecast
+    Component dh_FOF_H_OrderForecastRealQty
     {
       #keys: '[414724.0.109053093]'
       BaseType: 'WebDataHolder'
-      Databinding: 'structured[H_Forecast]*'
+      Databinding: 'structured[H_OrderForecastRealQty]*'
       Children:
       [
         Component de_dh_FOF_H_Foecast
@@ -112,13 +24,13 @@
             DataType: 'MacroPlan'
             Source: 'MacroPlan'
             Taborder: 0
-            Transformation: 'H_Forecast'
+            Transformation: 'H_OrderForecastRealQty'
           ]
         }
       ]
       Properties:
       [
-        Taborder: 6
+        Taborder: 2
       ]
     }
     #child: liH_Forecast
diff --git a/_Main/UI/MacroPlannerWebApp/Component_Frm_TEST/Component_List212.def b/_Main/UI/MacroPlannerWebApp/Component_Frm_TEST/Component_List212.def
deleted file mode 100644
index d04a4cb..0000000
--- a/_Main/UI/MacroPlannerWebApp/Component_Frm_TEST/Component_List212.def
+++ /dev/null
@@ -1,41 +0,0 @@
-Quintiq file version 2.0
-Component List212
-{
-  #keys: '[414724.0.153225431]'
-  BaseType: 'WebList'
-  Children:
-  [
-    Component DataExtractor924
-    {
-      #keys: '[414724.0.153225432]'
-      BaseType: 'WebDataExtractor'
-      Properties:
-      [
-        DataType: 'MacroPlan'
-        Source: 'MacroPlan'
-        Taborder: 0
-        Transformation: 'MappingProduct'
-      ]
-    }
-    #child: listActionBarPage441
-    Component DataSetLevel622
-    {
-      #keys: '[414724.0.153225437]'
-      BaseType: 'WebDataSetLevel'
-      Children:
-      [
-        #child: listContextMenu182
-      ]
-      Properties:
-      [
-        Columns: '[{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"BusinessType","title":"BusinessType","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"BusinessType"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"CommonBusiness","title":"CommonBusiness","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"CommonBusiness"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"EndDate","title":"EndDate","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"EndDate"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ID","title":"ID","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"ID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"IsCommon","title":"IsCommon","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"IsCommon"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"KeyProduct","title":"KeyProduct","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"KeyProduct"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Name","title":"Name","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Name"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Notes","title":"Notes","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Notes"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ProductMajorType","title":"ProductMajorType","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ProductMajorType"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ProductSubclassType","title":"ProductSubclassType","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ProductSubclassType"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ShelfLife","title":"ShelfLife","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ShelfLife"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"UnitOfMeasureName","title":"UnitOfMeasureName","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"UnitOfMeasureName"}}]'
-        ContextMenu: 'listContextMenu182'
-        Taborder: 2
-      ]
-    }
-  ]
-  Properties:
-  [
-    Taborder: 1
-  ]
-}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_Frm_TEST/Component_listActionBarPage441.def b/_Main/UI/MacroPlannerWebApp/Component_Frm_TEST/Component_listActionBarPage441.def
deleted file mode 100644
index bb08f37..0000000
--- a/_Main/UI/MacroPlannerWebApp/Component_Frm_TEST/Component_listActionBarPage441.def
+++ /dev/null
@@ -1,10 +0,0 @@
-Quintiq file version 2.0
-Component listActionBarPage441
-{
-  #keys: '[414724.0.153225434]'
-  BaseType: 'listActionBarPage'
-  Properties:
-  [
-    Taborder: 1
-  ]
-}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_Frm_TEST/Component_listContextMenu182.def b/_Main/UI/MacroPlannerWebApp/Component_Frm_TEST/Component_listContextMenu182.def
deleted file mode 100644
index e5e38ee..0000000
--- a/_Main/UI/MacroPlannerWebApp/Component_Frm_TEST/Component_listContextMenu182.def
+++ /dev/null
@@ -1,10 +0,0 @@
-Quintiq file version 2.0
-Component listContextMenu182
-{
-  #keys: '[414724.0.153225439]'
-  BaseType: 'listContextMenu'
-  Properties:
-  [
-    Taborder: 0
-  ]
-}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_Frm_TEST/Response_Button593_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_Frm_TEST/Response_Button593_OnClick.def
deleted file mode 100644
index d37a96f..0000000
--- a/_Main/UI/MacroPlannerWebApp/Component_Frm_TEST/Response_Button593_OnClick.def
+++ /dev/null
@@ -1,24 +0,0 @@
-Quintiq file version 2.0
-#parent: Button593
-Response OnClick () id:Response_Frm_TEST_Button593_OnClick
-{
-  #keys: '[414724.0.153411735]'
-  CanBindMultiple: false
-  DefinitionID: 'Responsedef_WebButton_OnClick'
-  QuillAction
-  {
-    Body:
-    [*
-      HObj := H_FunctionClass::SM_GetProductInfo( MacroPlan,"");
-      if( not isnull( HObj))
-      {
-        WebMessageBox::Information( HObj.BusinessType());  
-      }
-      else
-      {
-        WebMessageBox::Information( "寰楀埌鐨勭┖鍊�");  
-      }
-    *]
-    GroupServerCalls: false
-  }
-}
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_Frm_TEST/Response_ButtonERP\350\256\242\345\215\225_OnClick.def" "b/_Main/UI/MacroPlannerWebApp/Component_Frm_TEST/Response_ButtonERP\350\256\242\345\215\225_OnClick.def"
deleted file mode 100644
index e2bd314..0000000
--- "a/_Main/UI/MacroPlannerWebApp/Component_Frm_TEST/Response_ButtonERP\350\256\242\345\215\225_OnClick.def"
+++ /dev/null
@@ -1,16 +0,0 @@
-Quintiq file version 2.0
-#parent: ButtonERP璁㈠崟
-Response OnClick () id:Response_Frm_TEST_ButtonERP璁㈠崟_OnClick
-{
-  #keys: '[414724.0.164341791]'
-  CanBindMultiple: false
-  DefinitionID: 'Responsedef_WebButton_OnClick'
-  QuillAction
-  {
-    Body:
-    [*
-      H_FunctionClass::SM_OrderHedging( MacroPlan,true,"System","ERP璁㈠崟");
-    *]
-    GroupServerCalls: false
-  }
-}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_Frm_TEST/_ROOT_Component_Frm_TEST.def b/_Main/UI/MacroPlannerWebApp/Component_Frm_TEST/_ROOT_Component_Frm_TEST.def
deleted file mode 100644
index 55c933a..0000000
--- a/_Main/UI/MacroPlannerWebApp/Component_Frm_TEST/_ROOT_Component_Frm_TEST.def
+++ /dev/null
@@ -1,62 +0,0 @@
-Quintiq file version 2.0
-#root
-#parent: MacroPlannerWebApp
-OrphanComponent Frm_TEST
-{
-  #keys: '[414724.0.153225415]'
-  BaseType: 'WebForm'
-  Children:
-  [
-    #child: List212
-    Component DataHolder417
-    {
-      #keys: '[414724.0.153253171]'
-      BaseType: 'WebDataHolder'
-      Databinding: 'structured[MappingProduct]*'
-      Children:
-      [
-        Component DataExtractor742
-        {
-          #keys: '[414724.0.153253184]'
-          BaseType: 'WebDataExtractor'
-          Properties:
-          [
-            DataType: 'MacroPlan'
-            Source: 'MacroPlan'
-            Taborder: 0
-            Transformation: 'MappingProduct'
-          ]
-        }
-      ]
-      Properties:
-      [
-        Taborder: 2
-      ]
-    }
-    Component Button593
-    {
-      #keys: '[414724.0.153411711]'
-      BaseType: 'WebButton'
-      Properties:
-      [
-        Image: 'MONITOR_RGB'
-        Label: '娴嬭瘯'
-        Taborder: 0
-      ]
-    }
-    Component ButtonERP璁㈠崟
-    {
-      #keys: '[414724.0.164341716]'
-      BaseType: 'WebButton'
-      Properties:
-      [
-        Label: 'ERP璁㈠崟'
-        Taborder: 3
-      ]
-    }
-  ]
-  Properties:
-  [
-    Title: '娴嬭瘯椤甸潰'
-  ]
-}
diff --git a/_Main/UI/MacroPlannerWebApp/Views/FillingCapacityOrder.vw b/_Main/UI/MacroPlannerWebApp/Views/FillingCapacityOrder.vw
index 21e8b5a..274be38 100644
--- a/_Main/UI/MacroPlannerWebApp/Views/FillingCapacityOrder.vw
+++ b/_Main/UI/MacroPlannerWebApp/Views/FillingCapacityOrder.vw
@@ -180,10 +180,10 @@
     userconfigurableinformation
     {
     }
+    image: ''
     page: ''
     group: ''
-    index: 14
-    image: ''
+    index: 0
     description: ''
   }
   formatversion: 2
diff --git a/_Main/UI/MacroPlannerWebApp/Views/FillingCapacityOrderHistorical.vw b/_Main/UI/MacroPlannerWebApp/Views/FillingCapacityOrderHistorical.vw
index e8b9ad7..f322040 100644
--- a/_Main/UI/MacroPlannerWebApp/Views/FillingCapacityOrderHistorical.vw
+++ b/_Main/UI/MacroPlannerWebApp/Views/FillingCapacityOrderHistorical.vw
@@ -2,10 +2,10 @@
 {
   viewcontents
   {
+    image: ''
     page: ''
     group: ''
     index: 0
-    image: ''
     description: ''
   }
   formatversion: 2
diff --git a/_Main/UI/MacroPlannerWebApp/Views/PriorityResults.vw b/_Main/UI/MacroPlannerWebApp/Views/PriorityResults.vw
index 3489b0c..e0e823a 100644
--- a/_Main/UI/MacroPlannerWebApp/Views/PriorityResults.vw
+++ b/_Main/UI/MacroPlannerWebApp/Views/PriorityResults.vw
@@ -2244,10 +2244,10 @@
     userconfigurableinformation
     {
     }
+    image: ''
     page: ''
     group: ''
-    index: 15
-    image: ''
+    index: 0
     description: ''
   }
   formatversion: 2
diff --git a/_Main/UI/MacroPlannerWebApp/Views/Test.vw b/_Main/UI/MacroPlannerWebApp/Views/Test.vw
new file mode 100644
index 0000000..c66c058
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Views/Test.vw
@@ -0,0 +1,177 @@
+Quintiq file version 2.0
+{
+  viewcontents
+  {
+    forms
+    {
+      form_FormCapacityAllocationResultsRuleConfiguration
+      {
+        title: 'QTIANMA_JITUAN::FormCapacityAllocationResultsRuleConfiguration'
+        shown: true
+        componentID: 'QTIANMA_JITUAN::FormCapacityAllocationResultsRuleConfiguration'
+        layout
+        {
+          mode: 'open'
+          rowPosition: 1
+          rowSpan: 15
+          columnPosition: 1
+          columnSpan: 4
+        }
+        components
+        {
+          FormCapacityAllocationResultsRuleConfiguration_PanelImportAndExport
+          {
+            sizeRatio: 1
+          }
+          FormCapacityAllocationResultsRuleConfiguration_ListCapacityAllocationResultsRuleConfiguration
+          {
+          }
+          FormCapacityAllocationResultsRuleConfiguration_DataSetLevelCapacityAllocationResultsRuleConfiguration
+          {
+            groupDepth: -1
+            column_PanelMaterialCode
+            {
+              columnId: 'PanelMaterialCode'
+              dataPath: 'PanelMaterialCode'
+              dataType: 'string'
+              index: 0
+              subtotals: ''
+              width: 150
+            }
+            column_ModuleMaterialCode
+            {
+              columnId: 'ModuleMaterialCode'
+              dataPath: 'ModuleMaterialCode'
+              dataType: 'string'
+              index: 1
+              subtotals: ''
+              width: 150
+            }
+            column_Division
+            {
+              columnId: 'Division'
+              dataPath: 'Division'
+              dataType: 'string'
+              index: 2
+              subtotals: ''
+              width: 150
+            }
+            column_StockingPointID
+            {
+              columnId: 'StockingPointID'
+              dataPath: 'StockingPointID'
+              dataType: 'string'
+              index: 3
+              subtotals: ''
+              width: 150
+            }
+          }
+        }
+      }
+      form_FormCapacityAllocationResults
+      {
+        title: 'QTIANMA_JITUAN::FormCapacityAllocationResults'
+        shown: true
+        componentID: 'QTIANMA_JITUAN::FormCapacityAllocationResults'
+        layout
+        {
+          mode: 'open'
+          rowPosition: 1
+          rowSpan: 15
+          columnPosition: 5
+          columnSpan: 8
+        }
+        components
+        {
+          FormCapacityAllocationResults_PanelCapacityAllocationResults
+          {
+            sizeRatio: 1
+          }
+          FormCapacityAllocationResults_ListCapacityAllocationResults
+          {
+          }
+          FormCapacityAllocationResults_DataSetLevelCapacityAllocationResults
+          {
+            groupDepth: -1
+            column_Date
+            {
+              columnId: 'Date'
+              dataPath: 'Date'
+              dataType: 'date'
+              index: 0
+              subtotals: ''
+              width: 150
+            }
+            column_Description
+            {
+              columnId: 'Description'
+              dataPath: 'Description'
+              dataType: 'string'
+              index: 1
+              subtotals: ''
+              width: 150
+            }
+            column_ID
+            {
+              columnId: 'ID'
+              dataPath: 'ID'
+              dataType: 'string'
+              index: 2
+              subtotals: ''
+              width: 150
+            }
+            column_ProductID
+            {
+              columnId: 'ProductID'
+              dataPath: 'ProductID'
+              dataType: 'string'
+              index: 3
+              subtotals: ''
+              width: 150
+            }
+            column_StockingPointID
+            {
+              columnId: 'StockingPointID'
+              dataPath: 'StockingPointID'
+              dataType: 'string'
+              index: 4
+              subtotals: ''
+              width: 150
+            }
+            column_UserQuantity
+            {
+              columnId: 'UserQuantity'
+              dataPath: 'UserQuantity'
+              dataType: 'real'
+              index: 5
+              subtotals: ''
+              width: 150
+            }
+            column_ManufacturedDate
+            {
+              columnId: 'ManufacturedDate'
+              dataPath: 'ManufacturedDate'
+              dataType: 'date'
+              index: 6
+              subtotals: ''
+              width: 150
+            }
+          }
+        }
+      }
+    }
+    userconfigurableinformation
+    {
+    }
+    image: 'BEAR'
+    page: ''
+    group: ''
+    index: 0
+    description: ''
+  }
+  formatversion: 2
+  id: 'Test'
+  name: 'Test'
+  isglobal: false
+  isroot: true
+}
diff --git "a/_Main/UI/MacroPlannerWebApp/Views/\345\241\253\344\272\247\346\226\271\346\241\210\345\210\227\350\241\250.vw" "b/_Main/UI/MacroPlannerWebApp/Views/\345\241\253\344\272\247\346\226\271\346\241\210\345\210\227\350\241\250.vw"
index 359d913..9f88591 100644
--- "a/_Main/UI/MacroPlannerWebApp/Views/\345\241\253\344\272\247\346\226\271\346\241\210\345\210\227\350\241\250.vw"
+++ "b/_Main/UI/MacroPlannerWebApp/Views/\345\241\253\344\272\247\346\226\271\346\241\210\345\210\227\350\241\250.vw"
@@ -180,10 +180,10 @@
     userconfigurableinformation
     {
     }
+    group: ''
     index: 0
     image: ''
     page: ''
-    group: ''
     description: ''
   }
   formatversion: 2
diff --git a/_Main/UI/MacroPlannerWebApp/_ROOT_Project_MacroPlannerWebApp.qp b/_Main/UI/MacroPlannerWebApp/_ROOT_Project_MacroPlannerWebApp.qp
index b4cfb85..cb94597 100644
--- a/_Main/UI/MacroPlannerWebApp/_ROOT_Project_MacroPlannerWebApp.qp
+++ b/_Main/UI/MacroPlannerWebApp/_ROOT_Project_MacroPlannerWebApp.qp
@@ -5,7 +5,7 @@
   ProjectProperties
   {
     ApplicationComponentName: 'ApplicationMacroPlanner'
-    BuildVersion: '2022.3.0.34'
+    BuildVersion: '2022.3.0.32'
     Description: 'Quintiq Macro Planner'
     ProjectKind: 'WebClient'
   }
diff --git a/_var/_Main/ProjSettings/MacroPlannerWebApp/Views/FillingCapacityOrder.vw b/_var/_Main/ProjSettings/MacroPlannerWebApp/Views/FillingCapacityOrder.vw
deleted file mode 100644
index e143a99..0000000
--- a/_var/_Main/ProjSettings/MacroPlannerWebApp/Views/FillingCapacityOrder.vw
+++ /dev/null
@@ -1,12 +0,0 @@
-Quintiq file version 2.0
-{
-  viewcontents
-  {
-    index: 0
-  }
-  formatversion: 2
-  id: 'FillingCapacityOrder'
-  name: 'FillingCapacityOrder'
-  isglobal: false
-  isroot: false
-}
diff --git a/_var/_Main/ProjSettings/MacroPlannerWebApp/Views/FillingCapacityOrderHistorical.vw b/_var/_Main/ProjSettings/MacroPlannerWebApp/Views/FillingCapacityOrderHistorical.vw
index 1323ac5..5dd155f 100644
--- a/_var/_Main/ProjSettings/MacroPlannerWebApp/Views/FillingCapacityOrderHistorical.vw
+++ b/_var/_Main/ProjSettings/MacroPlannerWebApp/Views/FillingCapacityOrderHistorical.vw
@@ -2,6 +2,9 @@
 {
   viewcontents
   {
+    userconfigurableinformation
+    {
+    }
     forms
     {
       form_FormCustomerAndForecastOrder
@@ -417,18 +420,11 @@
         }
       }
     }
-    userconfigurableinformation
-    {
-    }
-    page: ''
-    group: ''
-    index: 15
-    image: ''
-    description: ''
+    index: 0
   }
   formatversion: 2
   id: 'FillingCapacityOrderHistorical'
   name: 'FillingCapacityOrderHistorical'
   isglobal: false
-  isroot: true
+  isroot: false
 }
diff --git a/_var/_Main/ProjSettings/MacroPlannerWebApp/Views/Test.vw b/_var/_Main/ProjSettings/MacroPlannerWebApp/Views/Test.vw
new file mode 100644
index 0000000..1571655
--- /dev/null
+++ b/_var/_Main/ProjSettings/MacroPlannerWebApp/Views/Test.vw
@@ -0,0 +1,42 @@
+Quintiq file version 2.0
+{
+  viewcontents
+  {
+    forms
+    {
+      form_FormCapacityAllocationResults
+      {
+        layout
+        {
+          rowSpan: 15
+          columnPosition: 5
+          columnSpan: 8
+        }
+      }
+      form_FormCapacityAllocationResultsRuleConfiguration
+      {
+        title: 'QTIANMA_JITUAN::FormCapacityAllocationResultsRuleConfiguration'
+        shown: true
+        componentID: 'QTIANMA_JITUAN::FormCapacityAllocationResultsRuleConfiguration'
+        layout
+        {
+          mode: 'open'
+          rowPosition: 1
+          rowSpan: 15
+          columnPosition: 1
+          columnSpan: 4
+        }
+        components: null
+      }
+      form_FormPanelPullPlanReport
+      {
+        _removed: true
+      }
+    }
+  }
+  formatversion: 2
+  id: 'Test'
+  name: 'Test'
+  isglobal: false
+  isroot: false
+}

--
Gitblit v1.9.3