first commit
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
using JSMachine.WMS.Common;
|
||||
using JSMachine.WMS.Infrastructure.Helper;
|
||||
using JSMachine.WMS.RPC.IBSRPC.Dto.In.BusinessParam;
|
||||
using JSMachine.WMS.RPC.IBSRPC.Dto.Out.BusinessResult;
|
||||
using JSMachine.WMS.RPC.IBSRPC.IService;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace JSMachine.WMS.RPC.IBSRPC.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// IBS接口
|
||||
/// </summary>
|
||||
public class PaperStockOperator: IPaperStockOperator
|
||||
{
|
||||
private static readonly string IbsUrl = Global.AppSettings.ErpConfig.ErpUrl;
|
||||
private static readonly string QueryByPaperLabelUrl = Global.AppSettings.ErpConfig.QueryByPaperLabelUrl;
|
||||
private static readonly string PaperStockOutUrl = Global.AppSettings.ErpConfig.PaperStockOutUrl;
|
||||
private static readonly string RePaperStockInUrl = Global.AppSettings.ErpConfig.RePaperStockInUrl;
|
||||
private static readonly Dictionary<string, string> header = new Dictionary<string, string>
|
||||
{
|
||||
{ "AppId", Global.AppSettings.ErpConfig.AppId },
|
||||
{ "AppKey", Global.AppSettings.ErpConfig.AppKey }
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 获取原纸信息
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<PaperBaseInfoDto> QueryByPaperLabel(PaperInfoQueryParam param)
|
||||
{
|
||||
IbsApiResult<PaperBaseInfoDto> ibsResult = new();
|
||||
try
|
||||
{
|
||||
var url = IbsUrl + QueryByPaperLabelUrl + param.PaperLabel;
|
||||
var resStr = HttpRequestHelper.Get(url, header);
|
||||
if (resStr == null)
|
||||
{
|
||||
LogHelper.Error($"IBS原纸信息,按原纸卷标查询(GetPaperMessage)出错");
|
||||
return null;
|
||||
}
|
||||
//ibsResult = JsonConvert.DeserializeObject<IbsApiResult<PaperBaseInfoDto>>(resStr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"IBS原纸信息,按原纸卷标查询(GetPaperMessage)出错: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
return ibsResult?.Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 原纸出库
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IbsResultDto> PaperStockOut(PaperInfoQueryParam param)
|
||||
{
|
||||
var ibsResult = new IbsResultDto();
|
||||
try
|
||||
{
|
||||
var url = IbsUrl + PaperStockOutUrl;
|
||||
var parameters = new Dictionary<string, string>
|
||||
{
|
||||
{ "PaperLabel", param.PaperLabel }
|
||||
};
|
||||
var resStr = HttpRequestHelper.Post(url, parameters, header);
|
||||
if (resStr == null)
|
||||
{
|
||||
LogHelper.Error($"IBS原纸出库(PaperStockOut)失败");
|
||||
return null;
|
||||
}
|
||||
//ibsResult = JsonConvert.DeserializeObject<IbsResultDto>(resStr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"IBS原纸出库(PaperStockOut)失败: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
return ibsResult ?? new IbsResultDto();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 残卷入库
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IbsResultDto> RePaperStockIn(PaperInfoQueryParam param)
|
||||
{
|
||||
var ibsResult = new IbsResultDto();
|
||||
try
|
||||
{
|
||||
var url = IbsUrl + RePaperStockInUrl;
|
||||
var parameters = new Dictionary<string, string>
|
||||
{
|
||||
{ "PaperLabel", param.PaperLabel },
|
||||
{ "Weight", param.Weight.ToString() },
|
||||
{ "Meters", param.Meters.ToString() }
|
||||
};
|
||||
var resStr = HttpRequestHelper.Post(url, parameters, header);
|
||||
if (resStr == null)
|
||||
{
|
||||
LogHelper.Error($"IBS残卷回库(RePaperStockIn)失败");
|
||||
return null;
|
||||
}
|
||||
//ibsResult = JsonConvert.DeserializeObject<IbsResultDto>(resStr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"IBS残卷回库(RePaperStockIn)失败: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
return ibsResult ?? new IbsResultDto();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user