using Newtonsoft.Json;
using Rhea.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using Tiger.Business.SqlSugarHepler;
using Tiger.IBusiness;
using Tiger.Model;
using Tiger.Model.Entitys.WMS.DTOS;
namespace Tiger.Business.WMS
{
///
///
///
public class StockInfoBusiness : IStockInfoBusiness
{
///
/// 从T100获取库存信息
///
///
///
///
public List GetStockInfo(StockInputDTO input)
{
#region 创建请求实体
var model = new BodyDTO>>()
{
host = new HostDTO(),
datakey = new DataKey()
{
EntId = "88",
CompanyId = input.site
},
service = new ServiceDTO()
{
name = "wms_erp_wms_getmatstock"
},
payload = new PayLoad>()
{
std_data = new Std_Data()
{
parameter = input
}
}
};
#endregion 创建请求实体
#region 发起请求
var result = new T100ActionResult>();
try
{
var requestJson = JsonConvert.SerializeObject(model);
var response = HttpHelper.PostAsync(BizSqlsugar.t100Url, requestJson).Result;
result = JsonConvert.DeserializeObject>>(response.Message);
}
catch (Exception ex)
{
throw new Exception(ex.Message.ToString());
}
#endregion 发起请求
var data = new List();
if (result.payload.std_data.parameter?.@return.Count() > 0)
{
data = result.payload.std_data.parameter?.@return.Where(i => i.inag009 != 0).ToList();
//count = result.payload.std_data.parameter.@return.Count();
}
return data;
}
}
}