Quintiq file version 2.0
#parent: Panel351/btn_Add_Material_FOF503
Response OnClick (
  H_OrderForecastRealQty selection
) id:Response_Panel351_btn_Add_Material_FOF503_OnClick_222
{
  #keys: '[414724.0.145178766]'
  CanBindMultiple: false
  DefinitionID => /Panel351/Responsedef_Panel351_btn_Add_Material_FOF503_OnClick
  QuillAction
  {
    Body:
    [*
      if( not isnull( selection))
      {
        SelectItem :=  select( MacroPlan,H_MessagePassing,Obj,Obj.FKey()="FrmOrderForecast" and Obj.ItemKey()="ListSelect");
        if( isnull( SelectItem))
        {
           MacroPlan.H_MessagePassing(relnew,FKey :="FrmOrderForecast",ItemKey := "ListSelect",
                                       ValueJsonString := JSON::Object().Add( "SKU",selection.SKU())
                                                                       .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.ValueJsonString(JSON::Object().Add( "SKU",selection.SKU())
                                                   .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.ID(),"-",selection.Month());
        if(jResult.Get( "Status").GetBoolean())
        {
            Application.OpenForm( "FrmMaterial","popout");
        }
        else
        {
          WebMessageBox::Warning( jResult.Get( "Msg").GetString());
        }
      }
      else
      {
        WebMessageBox::Information( "请选择一项预测后再点击按钮！");  
      }
    *]
    GroupServerCalls: false
  }
}
