Kevin Kok Khah Whey
2023-11-07 5ae534ab606e6f2ba5ea60914224d665b0447d5a
_Main/UI/MacroPlannerWebApp/Component_DialogDataDistribution/Response_pnlActions_btnOk_OnClick.def
@@ -4,21 +4,36 @@
{
  #keys: '[414702.1.84941735]'
  DefinitionID: 'Responsedef_WebButton_OnClick'
  Precondition:
  [*
    flag := not isnull( GlobalOTDTable ) and not isnull( GlobalOTDLog );
    activeScenario := DataHolderActiveScenario.Data();
    currentScenario := DataHolderScenario.Data();
    businessType := ddlBusinessType.Data();
    if ( activeScenario = currentScenario or isnull( businessType ) ) {
      flag := false;
      feedback := "无法对当前选中场景进行分发";
    }
    isExists := exists( GlobalOTDLog, DataDistributionLog, tempDD, tempDD.ExecuteStatus() = "Running" and tempDD.MacroPlanMDSID() = currentScenario.DatasetMDSID() );
    if ( flag and isExists ) {
      flag := false;
      feedback := "当前场景正在进行分发";
    }
    return flag;
  *]
  QuillAction
  {
    Body:
    [*
      Form.ApplyChanges();
      
      businessType := select( GlobalOTDTable,
                              BusinessType,
                              b,
                              b.ScenarioName() = dropDownStringListGeneral.Text()
                             );
      //Global_BrokerExecuteLog::CreateInOperation( GlobalOTDTable, "DataDistribution", ApplicationMacroPlanner.GetUserName() );
      DataDistributionLog::Create( GlobalOTDLog, ApplicationMacroPlanner.GetUserName(), DataHolderScenario.Data().DatasetMDSID(), DataHolderScenario.Data().Name() );
      MacroPlan::DoASync( DataHolderScenario.Data(), 
                          businessType.BusinessTypeName(),
                          ddlBusinessType.Data(),
                          checkboxIsKeyProduct.Checked(), 
                          checkboxCreatePurchaseSupplyProduct.Checked(),
                          GlobalOTDTable );