Quintiq file version 2.0
#parent: List832
Response OnDoubleClick (
  H_MaterialInfo selection
) id:Response_List832_OnDoubleClick
{
  #keys: '[414724.0.160542461]'
  CanBindMultiple: false
  DefinitionID: 'Responsedef_WebList_OnDoubleClick'
  QuillAction
  {
    Body:
    [*
      if( not isnull( selection))
      {
        // 预测订单基本信息
        CustomCode:="";
        CustomName:="";
        SValueJsonString:="";
        // 获取客户名称和客户ID
        if(txtSaveForecastData_FM.Text().Length()>0)
        {
           jForecast := JSON::Parse( txtSaveForecastData_FM.Text());
           CustomCode := jForecast.Get( "CustomCode").GetString();
           CustomName := jForecast.Get( "CustomName").GetString();
        }
        
        if(selection.MaterialType()="半成品")
        {
          ForecastID:="";
          if( txtSaveForecastData_FM.Text().Length()>0)
          {
            JForecast := JSON::Parse(txtSaveForecastData_FM.Text());
            ForecastID := JForecast.Get( "ForecastID").GetString();
          }
         jResult := H_FunctionClass::SM_GetMaterialData( MacroPlan,selection.SKU(),selection.NeedQty(), ForecastID,"-",selection.NeedDate());
          if(jResult.Get( "Status").GetBoolean())
          {
                de_dh_FM_ProductMP.FixedFilter( "object.ParentSKU() = " +  selection.SKU().AsQUILL()
                                                + " and object.ForecastID() = " + ForecastID.AsQUILL()
                                                );
          }
          else
          {
            WebMessageBox::Warning( jResult.Get( "Msg").GetString());
          }
        }
        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( "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");
        }
      }
    *]
    GroupServerCalls: false
  }
}
