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
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public class StockInfoBusiness : IStockInfoBusiness
|
{
|
/// <summary>
|
/// 从T100获取库存信息
|
/// </summary>
|
/// <param name="input"></param>
|
/// <returns></returns>
|
/// <exception cref="NotImplementedException"></exception>
|
public List<SaleOutInfoDetailDTO> GetStockInfo(StockInputDTO input)
|
{
|
#region 创建请求实体
|
|
var model = new BodyDTO<PayLoad<Std_Data<StockInputDTO>>>()
|
{
|
host = new HostDTO(),
|
datakey = new DataKey()
|
{
|
EntId = "88",
|
CompanyId = input.site
|
},
|
service = new ServiceDTO()
|
{
|
name = "wms_erp_wms_getmatstock"
|
},
|
payload = new PayLoad<Std_Data<StockInputDTO>>()
|
{
|
std_data = new Std_Data<StockInputDTO>()
|
{
|
parameter = input
|
}
|
}
|
};
|
|
#endregion 创建请求实体
|
|
#region 发起请求
|
|
var result = new T100ActionResult<resultStd_data<SaleOutInfoParameter>>();
|
try
|
{
|
var requestJson = JsonConvert.SerializeObject(model);
|
var response = HttpHelper.PostAsync(BizSqlsugar.t100Url, requestJson).Result;
|
result = JsonConvert.DeserializeObject<T100ActionResult<resultStd_data<SaleOutInfoParameter>>>(response.Message);
|
}
|
catch (Exception ex)
|
{
|
throw new Exception(ex.Message.ToString());
|
}
|
|
#endregion 发起请求
|
|
var data = new List<SaleOutInfoDetailDTO>();
|
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;
|
}
|
}
|
}
|