first commit
This commit is contained in:
@@ -0,0 +1,468 @@
|
||||
using JSMachine.WMS.Common;
|
||||
using JSMachine.WMS.Infrastructure.Attributes;
|
||||
using JSMachine.WMS.Infrastructure.Enums;
|
||||
using JSMachine.WMS.Infrastructure.Helper;
|
||||
using JSMachine.WMS.RPC.ErpRPC.Dto.In.BusinessDto;
|
||||
using JSMachine.WMS.RPC.ErpRPC.Dto.In;
|
||||
using JSMachine.WMS.RPC.ErpRPC.Dto.In.BusinessParam;
|
||||
using JSMachine.WMS.RPC.ErpRPC.Dto.Out;
|
||||
using JSMachine.WMS.RPC.ErpRPC.Dto.Out.BusinessResult;
|
||||
using JSMachine.WMS.RPC.ErpRPC.IService;
|
||||
using Newtonsoft.Json;
|
||||
using RestSharp;
|
||||
using JSMachine.WMS.RPC.ErpRPC.Dto.Out.XRBusinessResult;
|
||||
using JSMachine.WMS.RPC.ErpRPC.Dto.In.XRBusinessResult;
|
||||
|
||||
namespace JSMachine.WMS.RPC.ErpRPC.Service.IBS
|
||||
{
|
||||
[ErpTypeAttribute(ErpType.ChenLong)]
|
||||
public class ChenLongPaperStorageService : IPaperStorageService
|
||||
{
|
||||
private static string url = $"{Global.AppSettings.ErpConfig.ErpUrl}/";
|
||||
/// <summary>
|
||||
/// 纸卷领用记录新增
|
||||
/// </summary>
|
||||
/// <param name="paperReceiptRecordParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<PaperReceiptRecordAddResult> AddPaperReceiptRecord(PaperReceiptRecordAddParam paperReceiptRecordParam)
|
||||
{
|
||||
var result = await AddPaperReceiptRecordSource(paperReceiptRecordParam);
|
||||
return result
|
||||
?.Data
|
||||
?.Data
|
||||
?.FirstOrDefault()
|
||||
?.ALL;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 纸卷领用记录新增
|
||||
/// 返回原生的接口调用信息
|
||||
/// </summary>
|
||||
/// <param name="paperReceiptRecordParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ApiResult<PaperReceiptRecordAddResult>> AddPaperReceiptRecordSource(PaperReceiptRecordAddParam paperReceiptRecordParam)
|
||||
{
|
||||
var apiResultDto = new ApiResult<PaperReceiptRecordAddResult>();
|
||||
try
|
||||
{
|
||||
string resStr = await HttpRequestHelper.RequestByJson(
|
||||
url + "ODIRollPickInsert",
|
||||
Method.POST,
|
||||
RequestParam<PaperReceiptRecordAddParam>.CreateJsonParam(ActionID.ODIRollPickInsert, paperReceiptRecordParam)
|
||||
);
|
||||
|
||||
if (string.IsNullOrEmpty(resStr))
|
||||
{
|
||||
LogHelper.Error($"Erp纸卷{paperReceiptRecordParam.Barcode}领用记录新增(ODIRollPickInsert)出错");
|
||||
return null;
|
||||
}
|
||||
|
||||
apiResultDto = JsonConvert.DeserializeObject<ApiResult<PaperReceiptRecordAddResult>>(resStr);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"Erp纸卷{paperReceiptRecordParam.Barcode}领用记录新增(ODIRollPickInsert)出错: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
return apiResultDto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 纸卷退库记录新增
|
||||
/// </summary>
|
||||
/// <param name="paperReturnAddParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<PaperReturnAddResult> AddPaperReturn(PaperReturnAddParam paperReturnAddParam)
|
||||
{
|
||||
var result = await AddPaperReturnSource(paperReturnAddParam);
|
||||
return result
|
||||
?.Data
|
||||
?.Data
|
||||
?.FirstOrDefault()
|
||||
?.ALL;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 纸卷退库记录新增
|
||||
/// 返回原生的接口调用信息
|
||||
/// </summary>
|
||||
/// <param name="paperReturnAddParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ApiResult<PaperReturnAddResult>> AddPaperReturnSource(PaperReturnAddParam paperReturnAddParam)
|
||||
{
|
||||
ApiResult<PaperReturnAddResult> apiResultDto = new ApiResult<PaperReturnAddResult>();
|
||||
try
|
||||
{
|
||||
string resStr = await HttpRequestHelper.RequestByJson(
|
||||
url + "ODIRollReturnInsert",
|
||||
Method.POST,
|
||||
RequestParam<PaperReturnAddParam>.CreateJsonParam(ActionID.ODIRollReturnInsert, paperReturnAddParam)
|
||||
);
|
||||
|
||||
if (string.IsNullOrEmpty(resStr))
|
||||
{
|
||||
LogHelper.Error($"Erp纸卷{paperReturnAddParam.Barcode}退库记录新增(ODIRollReturnInsert)出错");
|
||||
return null;
|
||||
}
|
||||
apiResultDto = JsonConvert.DeserializeObject<ApiResult<PaperReturnAddResult>>(resStr);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"Erp纸卷{paperReturnAddParam.Barcode}退库记录新增(ODIRollReturnInsert)出错: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
return apiResultDto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 纸卷领用记录删除
|
||||
/// </summary>
|
||||
/// <param name="paperReceiptRecordDelParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> DelPaperReceiptRecord(PaperReceiptRecordDelParam paperReceiptRecordDelParam)
|
||||
{
|
||||
var result = false;
|
||||
try
|
||||
{
|
||||
string resStr = await HttpRequestHelper.RequestByDic(
|
||||
url,
|
||||
Method.POST,
|
||||
RequestParam<PaperReceiptRecordDelParam>.CreateParam(ActionID.ODIRollPickDelete, paperReceiptRecordDelParam)
|
||||
);
|
||||
|
||||
if (string.IsNullOrEmpty(resStr))
|
||||
{
|
||||
LogHelper.Error($"Erp纸卷{paperReceiptRecordDelParam.Barcode}领用记录删除(ODIRollPickDelete)出错");
|
||||
return result;
|
||||
}
|
||||
ApiResult<PaperReceiptRecordDelResult> apiResultDto = JsonConvert.DeserializeObject<ApiResult<PaperReceiptRecordDelResult>>(resStr);
|
||||
result = apiResultDto.ResultCode == "200";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"Erp纸卷{paperReceiptRecordDelParam.Barcode}领用记录删除(ODIRollPickDelete)出错: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 纸卷库存按条码查询(获取某卷纸的库存信息)
|
||||
/// </summary>
|
||||
/// <param name="barcode"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<PaperStorageResult> QueryByBarcode(string barcode)
|
||||
{
|
||||
ApiReturnResult<PaperStorageResult> apiResultDto = new();
|
||||
try
|
||||
{
|
||||
var resStr = await HttpRequestHelper.RequestByJson(
|
||||
url + "ODIRollStockQueryByBarcode",
|
||||
Method.POST,
|
||||
RequestParam<PaperStorageParam>.CreateJsonParam(
|
||||
ActionID.ODIRollStockQueryByBarcode,
|
||||
new PaperStorageParam
|
||||
{
|
||||
Barcode = barcode
|
||||
})
|
||||
);
|
||||
|
||||
if (string.IsNullOrEmpty(resStr))
|
||||
{
|
||||
LogHelper.Error($"Erp纸卷{barcode}库存按条码查询(ODIRollStockQueryByBarcode)出错");
|
||||
return null;
|
||||
}
|
||||
|
||||
apiResultDto = JsonConvert.DeserializeObject<ApiReturnResult<PaperStorageResult>>(resStr);
|
||||
if (apiResultDto != null)
|
||||
{
|
||||
var item = apiResultDto.Data;
|
||||
//ActualQty
|
||||
if (item.ActualQty == "0" || string.IsNullOrEmpty(item.ActualQty))
|
||||
{
|
||||
item.ActualQty = "0";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.ActualQty.Contains("."))
|
||||
{
|
||||
item.ActualQty = item.ActualQty.Substring(0, item.ActualQty.LastIndexOf("."));
|
||||
}
|
||||
else
|
||||
{
|
||||
item.ActualQty = item.ActualQty;
|
||||
}
|
||||
}
|
||||
//StockMeter
|
||||
if (item.StockMeter == "0" || string.IsNullOrEmpty(item.StockMeter))
|
||||
{
|
||||
item.StockMeter = "0";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.StockMeter.Contains("."))
|
||||
{
|
||||
item.StockMeter = item.StockMeter.Substring(0, item.StockMeter.LastIndexOf("."));
|
||||
}
|
||||
else
|
||||
{
|
||||
item.StockMeter = item.StockMeter;
|
||||
}
|
||||
}
|
||||
//GPerM2
|
||||
if (item.GPerM2 == "0" || string.IsNullOrEmpty(item.GPerM2))
|
||||
{
|
||||
item.GPerM2 = "0";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.GPerM2.Contains("."))
|
||||
{
|
||||
item.GPerM2 = item.GPerM2.Substring(0, item.GPerM2.LastIndexOf("."));
|
||||
}
|
||||
else
|
||||
{
|
||||
item.GPerM2 = item.GPerM2;
|
||||
}
|
||||
}
|
||||
//PaperWidth
|
||||
if (item.PaperWidth == "0" || string.IsNullOrEmpty(item.PaperWidth))
|
||||
{
|
||||
item.PaperWidth = "0";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.PaperWidth.Contains("."))
|
||||
{
|
||||
item.PaperWidth = item.PaperWidth.Substring(0, item.PaperWidth.LastIndexOf("."));
|
||||
}
|
||||
else
|
||||
{
|
||||
item.PaperWidth = item.PaperWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"Erp纸卷{barcode}库存按条码查询(ODIRollStockQueryByBarcode)出错: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
return apiResultDto?.Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 原纸退纸记录删除
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> DelPaperReturn(PaperReturnDelParam paperReturnDelParam)
|
||||
{
|
||||
var result = false;
|
||||
try
|
||||
{
|
||||
string resStr = await HttpRequestHelper.RequestByDic(
|
||||
url,
|
||||
Method.POST,
|
||||
RequestParam<PaperReturnDelParam>.CreateParam(ActionID.ODIRollReturnDelete, paperReturnDelParam)
|
||||
);
|
||||
if (string.IsNullOrEmpty(resStr))
|
||||
{
|
||||
LogHelper.Error($"Erp原纸{paperReturnDelParam.Barcode}退纸记录删除(ODIRollReturnDelete)出错");
|
||||
return result;
|
||||
}
|
||||
ApiResult<PaperReturnDelResult> apiResultDto = JsonConvert.DeserializeObject<ApiResult<PaperReturnDelResult>>(resStr);
|
||||
result = apiResultDto.ResultCode == "200";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"Erp原纸{paperReturnDelParam.Barcode}退纸记录删除(ODIRollReturnDelete)出错: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 原纸库存,按门幅、纸质编码查询
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<PaperStockQueryResult>> QueryByPaperWidthAndCode(PaperPreparationQueryParam param)
|
||||
{
|
||||
ApiReturnResult<List<PaperStockQueryResult>> apiResultDto = new();
|
||||
try
|
||||
{
|
||||
if (param.Paper.Contains("-"))
|
||||
{
|
||||
param.Paper = param.Paper.Replace("-", "");
|
||||
}
|
||||
string resStr = await HttpRequestHelper.RequestByJson(
|
||||
url+ "ODIRollStockQuery",
|
||||
Method.POST,
|
||||
RequestParam<PaperPreparationQueryParam>.CreateJsonParam(
|
||||
ActionID.ODIRollStockQuery,
|
||||
new PaperPreparationQueryParam
|
||||
{
|
||||
Paper = param.Paper,
|
||||
PaperWidth = param.PaperWidth
|
||||
})
|
||||
);
|
||||
|
||||
if (string.IsNullOrEmpty(resStr))
|
||||
{
|
||||
LogHelper.Error($"Erp纸卷库存,按门幅、纸质编码查询(ODIRollStockQuery)出错");
|
||||
return null;
|
||||
}
|
||||
|
||||
apiResultDto = JsonConvert.DeserializeObject<ApiReturnResult<List<PaperStockQueryResult>>>(resStr);
|
||||
if (apiResultDto != null)
|
||||
{
|
||||
foreach (var item in apiResultDto?.Data)
|
||||
{
|
||||
//ActualQty
|
||||
if (item.ActualQty == "0" || string.IsNullOrEmpty(item.ActualQty))
|
||||
{
|
||||
item.ActualQty = "0";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.ActualQty.Contains("."))
|
||||
{
|
||||
item.ActualQty = item.ActualQty.Substring(0, item.ActualQty.LastIndexOf("."));
|
||||
}
|
||||
else
|
||||
{
|
||||
item.ActualQty = item.ActualQty;
|
||||
}
|
||||
}
|
||||
//StockMeter
|
||||
if (item.StockMeter == "0" || string.IsNullOrEmpty(item.StockMeter))
|
||||
{
|
||||
item.StockMeter = "0";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.StockMeter.Contains("."))
|
||||
{
|
||||
item.StockMeter = item.StockMeter.Substring(0, item.StockMeter.LastIndexOf("."));
|
||||
}
|
||||
else
|
||||
{
|
||||
item.StockMeter = item.StockMeter;
|
||||
}
|
||||
}
|
||||
//GPerM2
|
||||
if (item.GPerM2 == "0" || string.IsNullOrEmpty(item.GPerM2))
|
||||
{
|
||||
item.GPerM2 = "0";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.GPerM2.Contains("."))
|
||||
{
|
||||
item.GPerM2 = item.GPerM2.Substring(0, item.GPerM2.LastIndexOf("."));
|
||||
}
|
||||
else
|
||||
{
|
||||
item.GPerM2 = item.GPerM2;
|
||||
}
|
||||
}
|
||||
//PaperWidth
|
||||
if (item.PaperWidth == "0" || string.IsNullOrEmpty(item.PaperWidth))
|
||||
{
|
||||
item.PaperWidth = "0";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.PaperWidth.Contains("."))
|
||||
{
|
||||
item.PaperWidth = item.PaperWidth.Substring(0, item.PaperWidth.LastIndexOf("."));
|
||||
}
|
||||
else
|
||||
{
|
||||
item.PaperWidth = item.PaperWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"Erp纸卷库存,按门幅、纸质编码查询(ODIRollStockQuery)出错: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
return apiResultDto?.Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新卷入库信息查询(按起始时间)
|
||||
/// </summary>
|
||||
/// <param name="barcode"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<PaperStorageResult>> RollNewQueryByTime(PaperStorageQueryParam param)
|
||||
{
|
||||
List<PaperStorageResult> apiResultDto = new List<PaperStorageResult>();
|
||||
try
|
||||
{
|
||||
string resStr = await HttpRequestHelper.RequestByDic(
|
||||
url,
|
||||
Method.POST,
|
||||
RequestParam<PaperStorageQueryParam>.CreateParam(
|
||||
ActionID.ODIRollNewQueryByTime,
|
||||
new PaperStorageQueryParam
|
||||
{
|
||||
StartTime = param.StartTime,
|
||||
EndTime = param.EndTime
|
||||
})
|
||||
);
|
||||
|
||||
if (string.IsNullOrEmpty(resStr))
|
||||
{
|
||||
LogHelper.Error($"新卷入库信息查询(按起始时间)(ODIRollNewQueryByTime)出错");
|
||||
return null;
|
||||
}
|
||||
|
||||
apiResultDto = JsonConvert.DeserializeObject<List<PaperStorageResult>>(resStr);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"新卷入库信息查询(按起始时间)(ODIRollNewQueryByTime)出错: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
return apiResultDto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PDA扫合格证码获取物料信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<XRResultDto> GetMateriaInfo(string barCode)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生产入库
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> AddProduceIn(ErpProduceInParam erpMateriaInDto)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生产退库
|
||||
/// </summary>
|
||||
/// <param name="erpProduceOutParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> AddProduceOut(ErpProduceOutParam erpProduceOutParam)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销售出库
|
||||
/// </summary>
|
||||
/// <param name="erpSaleOutParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> AddSaleOut(ErpSaleOutParam erpSaleOutParam)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,323 @@
|
||||
using JSMachine.WMS.Common;
|
||||
using JSMachine.WMS.Infrastructure.Attributes;
|
||||
using JSMachine.WMS.Infrastructure.Enums;
|
||||
using JSMachine.WMS.Infrastructure.Helper;
|
||||
using JSMachine.WMS.RPC.ErpRPC.Dto.In.BusinessParam;
|
||||
using JSMachine.WMS.RPC.ErpRPC.Dto.In.XRBusinessResult;
|
||||
using JSMachine.WMS.RPC.ErpRPC.Dto.Out;
|
||||
using JSMachine.WMS.RPC.ErpRPC.Dto.Out.BusinessResult;
|
||||
using JSMachine.WMS.RPC.ErpRPC.Dto.Out.IBSBusinessResult;
|
||||
using JSMachine.WMS.RPC.ErpRPC.Dto.Out.XRBusinessResult;
|
||||
using JSMachine.WMS.RPC.ErpRPC.IService;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace JSMachine.WMS.RPC.ErpRPC.Service.IBS
|
||||
{
|
||||
[ErpTypeAttribute(ErpType.IBS)]
|
||||
public class IBSPaperStorageService : IPaperStorageService
|
||||
{
|
||||
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 QueryByPaperWidthAndCodeUrl = Global.AppSettings.ErpConfig.QueryByPaperWidthAndCodeUrl;
|
||||
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="paperReceiptRecordParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<PaperReceiptRecordAddResult> AddPaperReceiptRecord(PaperReceiptRecordAddParam paperReceiptRecordParam)
|
||||
{
|
||||
try
|
||||
{
|
||||
var url = IbsUrl + PaperStockOutUrl;
|
||||
var parameters = new Dictionary<string, string>
|
||||
{
|
||||
{ "PaperLabel", paperReceiptRecordParam.Barcode }
|
||||
};
|
||||
var resStr = await HttpRequestHelper.Post(url, parameters, header);
|
||||
if (resStr == null)
|
||||
{
|
||||
LogHelper.Error($"IBS原纸出库(PaperStockOut)失败");
|
||||
return null;
|
||||
}
|
||||
var ibsResult = JsonConvert.DeserializeObject<IbsApiResult<IbsResultDto>>(resStr);
|
||||
if (ibsResult == null || !ibsResult.Data.State)
|
||||
return null;
|
||||
|
||||
return new PaperReceiptRecordAddResult();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"IBS原纸出库(PaperStockOut)失败: {ex.Message} \n {ex.StackTrace}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增纸卷领用记录(原纸出库)
|
||||
/// </summary>
|
||||
/// <param name="paperReceiptRecordParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ApiResult<PaperReceiptRecordAddResult>> AddPaperReceiptRecordSource(PaperReceiptRecordAddParam paperReceiptRecordParam)
|
||||
{
|
||||
var ibsResult = new IbsApiResult<IbsResultDto>();
|
||||
try
|
||||
{
|
||||
var url = IbsUrl + PaperStockOutUrl;
|
||||
var parameters = new Dictionary<string, string>
|
||||
{
|
||||
{ "PaperLabel", paperReceiptRecordParam.Barcode }
|
||||
};
|
||||
var resStr = await HttpRequestHelper.Post(url, parameters, header);
|
||||
if (resStr == null)
|
||||
{
|
||||
LogHelper.Error($"IBS原纸出库(PaperStockOut)失败");
|
||||
return null;
|
||||
}
|
||||
ibsResult = JsonConvert.DeserializeObject<IbsApiResult<IbsResultDto>>(resStr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"IBS原纸出库(PaperStockOut)失败: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
|
||||
ApiResult<PaperReceiptRecordAddResult> apiResult = new()
|
||||
{
|
||||
ResultCode = ibsResult != null && ibsResult.Data.State ? "200" : "500",
|
||||
ErrorMsg = ibsResult == null ? "" : ibsResult.Data.Messages
|
||||
};
|
||||
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增纸卷退库记录(入库)
|
||||
/// </summary>
|
||||
/// <param name="paperReturnAddParam"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task<PaperReturnAddResult> AddPaperReturn(PaperReturnAddParam paperReturnAddParam)
|
||||
{
|
||||
try
|
||||
{
|
||||
var url = IbsUrl + RePaperStockInUrl;
|
||||
var parameters = new Dictionary<string, string>
|
||||
{
|
||||
{ "PaperLabel", paperReturnAddParam.Barcode },
|
||||
{ "Weight", paperReturnAddParam.ReturnQty.ToString() },
|
||||
{ "Meters", paperReturnAddParam.ReturnMeter.ToString() }
|
||||
};
|
||||
var resStr = await HttpRequestHelper.Post(url, parameters, header);
|
||||
if (resStr == null)
|
||||
{
|
||||
LogHelper.Error($"IBS残卷回库(RePaperStockIn)失败");
|
||||
return null;
|
||||
}
|
||||
var ibsResult = JsonConvert.DeserializeObject<IbsApiResult<IbsResultDto>>(resStr);
|
||||
return ibsResult == null || !ibsResult.Data.State ? null : new PaperReturnAddResult();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"IBS残卷回库(RePaperStockIn)失败: {ex.Message} \n {ex.StackTrace}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 纸卷退库记录新增
|
||||
/// 返回原生的接口调用信息
|
||||
/// </summary>
|
||||
/// <param name="paperReturnAddParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ApiResult<PaperReturnAddResult>> AddPaperReturnSource(PaperReturnAddParam paperReturnAddParam)
|
||||
{
|
||||
var ibsResult = new IbsApiResult<IbsResultDto>();
|
||||
try
|
||||
{
|
||||
var url = IbsUrl + RePaperStockInUrl;
|
||||
var parameters = new Dictionary<string, string>
|
||||
{
|
||||
{ "PaperLabel", paperReturnAddParam.Barcode },
|
||||
{ "Weight", paperReturnAddParam.ReturnQty.ToString() },
|
||||
{ "Meters", paperReturnAddParam.ReturnMeter.ToString() }
|
||||
};
|
||||
var resStr = await HttpRequestHelper.Post(url, parameters, header);
|
||||
if (resStr == null)
|
||||
{
|
||||
LogHelper.Error($"IBS残卷回库(RePaperStockIn)失败");
|
||||
return null;
|
||||
}
|
||||
ibsResult = JsonConvert.DeserializeObject<IbsApiResult<IbsResultDto>>(resStr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"IBS残卷回库(RePaperStockIn)失败: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
|
||||
ApiResult<PaperReturnAddResult> apiResult = new()
|
||||
{
|
||||
ResultCode = ibsResult != null && ibsResult.Data != null && ibsResult.Data.State ? "200" : "500",
|
||||
ErrorMsg = ibsResult != null && ibsResult.Data != null ? ibsResult.Data.Messages : ""
|
||||
};
|
||||
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
public Task<bool> DelPaperReceiptRecord(PaperReceiptRecordDelParam paperReceiptRecordDelParam)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<bool> DelPaperReturn(PaperReturnDelParam paperReturnDelParam)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 纸卷库存按条码查询(获取某卷纸的库存信息)
|
||||
/// </summary>
|
||||
/// <param name="barcode"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<PaperStorageResult> QueryByBarcode(string barcode)
|
||||
{
|
||||
var ibsResult = new IbsApiResult<PaperBaseInfoDto>();
|
||||
try
|
||||
{
|
||||
var url = IbsUrl + QueryByPaperLabelUrl + barcode;
|
||||
var resStr = await 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}");
|
||||
}
|
||||
|
||||
if (ibsResult?.Data == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
PaperStorageResult paperStorageResult = new()
|
||||
{
|
||||
Maker = ibsResult.Data.MakerName,
|
||||
ActualQty = ibsResult.Data.InWeight.ToString(),
|
||||
StockMeter = ibsResult.Data.Meters.ToString(),
|
||||
Paper = ibsResult.Data.PaperCode,
|
||||
GPerM2 = ibsResult.Data.PaperUnitWeight?.ToString(),
|
||||
PaperWidth = ibsResult.Data.PaperWidth.ToString(),
|
||||
Barcode = ibsResult.Data.PaperLabel,
|
||||
SuppShortName = ibsResult.Data.Phonetic,
|
||||
Location = ibsResult.Data.StockHouseCode,
|
||||
LocSub = ibsResult.Data.LocationMark,
|
||||
ObjID = ibsResult.Data.ID.ToString("N"),
|
||||
};
|
||||
|
||||
return paperStorageResult;
|
||||
}
|
||||
/// <summary>
|
||||
/// 原纸库存,按门幅、纸质编码查询
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task<List<PaperStockQueryResult>> QueryByPaperWidthAndCode(PaperPreparationQueryParam param)
|
||||
{
|
||||
var ibsResult = new IbsApiResult<List<PaperBaseInfoDto>>();
|
||||
try
|
||||
{
|
||||
var url = IbsUrl + QueryByPaperWidthAndCodeUrl + "?paperWidth=" + param.PaperWidth + "&paperCode=" + param.Paper.Replace("-", "");
|
||||
var resStr = await HttpRequestHelper.Get(url, header);
|
||||
if (resStr == null)
|
||||
{
|
||||
LogHelper.Error($"IBS原纸库存,按门幅、纸质编码查询(GetPaperMessage)出错");
|
||||
return null;
|
||||
}
|
||||
ibsResult = JsonConvert.DeserializeObject<IbsApiResult<List<PaperBaseInfoDto>>>(resStr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"IBS原纸库存,按门幅、纸质编码查询(GetPaperMessage)出错: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
|
||||
if (ibsResult?.Data == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var paperStorageResultList = new List<PaperStockQueryResult>();
|
||||
foreach (PaperBaseInfoDto item in ibsResult.Data)
|
||||
{
|
||||
paperStorageResultList.Add(new PaperStockQueryResult
|
||||
{
|
||||
Paper = item.PaperCode,
|
||||
Barcode = item.PaperLabel,
|
||||
PaperWidth = item.PaperWidth.ToString(),
|
||||
StockMeter = item.Meters == 0m ? "" : Math.Round(item.Meters, 2).ToString(),
|
||||
ActualQty = item.InWeight == 0 ? "" : item.InWeight.ToString(),
|
||||
Location = item.StockHouseCode,
|
||||
LocSub = item.LocationMark,
|
||||
GPerM2 = item.PaperUnitWeight?.ToString(),
|
||||
SuppShortName = item.Phonetic,
|
||||
Maker = item.Phonetic,
|
||||
ObjID = item.ID.ToString("N"),
|
||||
});
|
||||
}
|
||||
return paperStorageResultList;
|
||||
}
|
||||
|
||||
public Task<List<PaperStorageResult>> RollNewQueryByTime(PaperStorageQueryParam param)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PDA扫合格证码获取物料信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<XRResultDto> GetMateriaInfo(string barCode)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生产入库
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> AddProduceIn(ErpProduceInParam erpMateriaInDto)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生产退库
|
||||
/// </summary>
|
||||
/// <param name="erpProduceOutParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> AddProduceOut(ErpProduceOutParam erpProduceOutParam)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销售出库
|
||||
/// </summary>
|
||||
/// <param name="erpSaleOutParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> AddSaleOut(ErpSaleOutParam erpSaleOutParam)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,336 @@
|
||||
using JSMachine.WMS.Common;
|
||||
using JSMachine.WMS.Infrastructure.Attributes;
|
||||
using JSMachine.WMS.Infrastructure.Enums;
|
||||
using JSMachine.WMS.Infrastructure.Helper;
|
||||
using JSMachine.WMS.RPC.PaperMESServerRPC.Bo;
|
||||
using JSMachine.WMS.RPC.ErpRPC.Dto.In;
|
||||
using JSMachine.WMS.RPC.ErpRPC.Dto.In.BusinessDto;
|
||||
using JSMachine.WMS.RPC.ErpRPC.Dto.In.BusinessParam;
|
||||
using JSMachine.WMS.RPC.ErpRPC.Dto.Out;
|
||||
using JSMachine.WMS.RPC.ErpRPC.Dto.Out.BusinessResult;
|
||||
using JSMachine.WMS.RPC.ErpRPC.IService;
|
||||
using Newtonsoft.Json;
|
||||
using RestSharp;
|
||||
using JSMachine.WMS.RPC.ErpRPC.Dto.Out.XRBusinessResult;
|
||||
using System.Security.Policy;
|
||||
using JSMachine.WMS.RPC.ErpRPC.Dto.In.XRBusinessResult;
|
||||
|
||||
namespace JSMachine.WMS.RPC.ErpRPC.Service.WantitErp
|
||||
{
|
||||
[ErpTypeAttribute(ErpType.Wantit)]
|
||||
public class WantitPaperStorageService : IPaperStorageService
|
||||
{
|
||||
private static string url = $"{Global.AppSettings.ErpConfig.ErpUrl}/DI/DIExecute.action";
|
||||
/// <summary>
|
||||
/// 纸卷领用记录新增
|
||||
/// </summary>
|
||||
/// <param name="paperReceiptRecordParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<PaperReceiptRecordAddResult> AddPaperReceiptRecord(PaperReceiptRecordAddParam paperReceiptRecordParam)
|
||||
{
|
||||
var result = await AddPaperReceiptRecordSource(paperReceiptRecordParam);
|
||||
return result
|
||||
?.Data
|
||||
?.Data
|
||||
?.FirstOrDefault()
|
||||
?.ALL;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 纸卷领用记录新增
|
||||
/// 返回原生的接口调用信息
|
||||
/// </summary>
|
||||
/// <param name="paperReceiptRecordParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ApiResult<PaperReceiptRecordAddResult>> AddPaperReceiptRecordSource(PaperReceiptRecordAddParam paperReceiptRecordParam)
|
||||
{
|
||||
var apiResultDto = new ApiResult<PaperReceiptRecordAddResult>();
|
||||
try
|
||||
{
|
||||
string resStr = await HttpRequestHelper.RequestByDic(
|
||||
url,
|
||||
Method.POST,
|
||||
RequestParam<PaperReceiptRecordAddParam>.CreateParam(ActionID.ODIRollPickInsert, paperReceiptRecordParam)
|
||||
);
|
||||
|
||||
if (string.IsNullOrEmpty(resStr))
|
||||
{
|
||||
LogHelper.Error($"Erp纸卷{paperReceiptRecordParam.Barcode}领用记录新增(ODIRollPickInsert)出错");
|
||||
return null;
|
||||
}
|
||||
|
||||
apiResultDto = JsonConvert.DeserializeObject<ApiResult<PaperReceiptRecordAddResult>>(resStr);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"Erp纸卷{paperReceiptRecordParam.Barcode}领用记录新增(ODIRollPickInsert)出错: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
return apiResultDto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 纸卷退库记录新增
|
||||
/// </summary>
|
||||
/// <param name="paperReturnAddParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<PaperReturnAddResult> AddPaperReturn(PaperReturnAddParam paperReturnAddParam)
|
||||
{
|
||||
var result = await AddPaperReturnSource(paperReturnAddParam);
|
||||
return result
|
||||
?.Data
|
||||
?.Data
|
||||
?.FirstOrDefault()
|
||||
?.ALL;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 纸卷退库记录新增
|
||||
/// 返回原生的接口调用信息
|
||||
/// </summary>
|
||||
/// <param name="paperReturnAddParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ApiResult<PaperReturnAddResult>> AddPaperReturnSource(PaperReturnAddParam paperReturnAddParam)
|
||||
{
|
||||
ApiResult<PaperReturnAddResult> apiResultDto = new ApiResult<PaperReturnAddResult>();
|
||||
try
|
||||
{
|
||||
string resStr = await HttpRequestHelper.RequestByDic(
|
||||
url,
|
||||
Method.POST,
|
||||
RequestParam<PaperReturnAddParam>.CreateParam(ActionID.ODIRollReturnInsert, paperReturnAddParam)
|
||||
);
|
||||
|
||||
if (string.IsNullOrEmpty(resStr))
|
||||
{
|
||||
LogHelper.Error($"Erp纸卷{paperReturnAddParam.Barcode}退库记录新增(ODIRollReturnInsert)出错");
|
||||
return null;
|
||||
}
|
||||
apiResultDto = JsonConvert.DeserializeObject<ApiResult<PaperReturnAddResult>>(resStr);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"Erp纸卷{paperReturnAddParam.Barcode}退库记录新增(ODIRollReturnInsert)出错: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
return apiResultDto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 纸卷领用记录删除
|
||||
/// </summary>
|
||||
/// <param name="paperReceiptRecordDelParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> DelPaperReceiptRecord(PaperReceiptRecordDelParam paperReceiptRecordDelParam)
|
||||
{
|
||||
var result = false;
|
||||
try
|
||||
{
|
||||
string resStr = await HttpRequestHelper.RequestByDic(
|
||||
url,
|
||||
Method.POST,
|
||||
RequestParam<PaperReceiptRecordDelParam>.CreateParam(ActionID.ODIRollPickDelete, paperReceiptRecordDelParam)
|
||||
);
|
||||
|
||||
if (string.IsNullOrEmpty(resStr))
|
||||
{
|
||||
LogHelper.Error($"Erp纸卷{paperReceiptRecordDelParam.Barcode}领用记录删除(ODIRollPickDelete)出错");
|
||||
return result;
|
||||
}
|
||||
ApiResult<PaperReceiptRecordDelResult> apiResultDto = JsonConvert.DeserializeObject<ApiResult<PaperReceiptRecordDelResult>>(resStr);
|
||||
result = apiResultDto.ResultCode == "200";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"Erp纸卷{paperReceiptRecordDelParam.Barcode}领用记录删除(ODIRollPickDelete)出错: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 纸卷库存按条码查询(获取某卷纸的库存信息)
|
||||
/// </summary>
|
||||
/// <param name="barcode"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<PaperStorageResult> QueryByBarcode(string barcode)
|
||||
{
|
||||
ApiResult<PaperStorageResult> apiResultDto = new();
|
||||
try
|
||||
{
|
||||
string resStr = await HttpRequestHelper.RequestByDic(
|
||||
url,
|
||||
Method.POST,
|
||||
RequestParam<PaperStorageParam>.CreateParam(
|
||||
ActionID.ODIRollStockQueryByBarcode,
|
||||
new PaperStorageParam
|
||||
{
|
||||
Barcode = barcode
|
||||
})
|
||||
);
|
||||
|
||||
if (string.IsNullOrEmpty(resStr))
|
||||
{
|
||||
LogHelper.Error($"Erp纸卷{barcode}库存按条码查询(ODIRollStockQueryByBarcode)出错");
|
||||
return null;
|
||||
}
|
||||
|
||||
apiResultDto = JsonConvert.DeserializeObject<ApiResult<PaperStorageResult>>(resStr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"Erp纸卷{barcode}库存按条码查询(ODIRollStockQueryByBarcode)出错: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
return apiResultDto
|
||||
?.Data
|
||||
?.Data
|
||||
?.FirstOrDefault()
|
||||
?.ALL;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 原纸退纸记录删除
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> DelPaperReturn(PaperReturnDelParam paperReturnDelParam)
|
||||
{
|
||||
var result = false;
|
||||
try
|
||||
{
|
||||
string resStr = await HttpRequestHelper.RequestByDic(
|
||||
url,
|
||||
Method.POST,
|
||||
RequestParam<PaperReturnDelParam>.CreateParam(ActionID.ODIRollReturnDelete, paperReturnDelParam)
|
||||
);
|
||||
if (string.IsNullOrEmpty(resStr))
|
||||
{
|
||||
LogHelper.Error($"Erp原纸{paperReturnDelParam.Barcode}退纸记录删除(ODIRollReturnDelete)出错");
|
||||
return result;
|
||||
}
|
||||
ApiResult<PaperReturnDelResult> apiResultDto = JsonConvert.DeserializeObject<ApiResult<PaperReturnDelResult>>(resStr);
|
||||
result = apiResultDto.ResultCode == "200";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"Erp原纸{paperReturnDelParam.Barcode}退纸记录删除(ODIRollReturnDelete)出错: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 原纸库存,按门幅、纸质编码查询
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<PaperStockQueryResult>> QueryByPaperWidthAndCode(PaperPreparationQueryParam param)
|
||||
{
|
||||
ApiResult<PaperStockQueryResult> apiResultDto = new();
|
||||
try
|
||||
{
|
||||
string resStr = await HttpRequestHelper.RequestByDic(
|
||||
url,
|
||||
Method.POST,
|
||||
RequestParam<PaperPreparationQueryParam>.CreateParam(
|
||||
ActionID.ODIRollStockQuery,
|
||||
new PaperPreparationQueryParam
|
||||
{
|
||||
Paper = param.Paper,
|
||||
PaperWidth = param.PaperWidth
|
||||
})
|
||||
);
|
||||
|
||||
if (string.IsNullOrEmpty(resStr))
|
||||
{
|
||||
LogHelper.Error($"Erp纸卷库存,按门幅、纸质编码查询(ODIRollStockQuery)出错");
|
||||
return null;
|
||||
}
|
||||
|
||||
apiResultDto = JsonConvert.DeserializeObject<ApiResult<PaperStockQueryResult>>(resStr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"Erp纸卷库存,按门幅、纸质编码查询(ODIRollStockQuery)出错: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
return apiResultDto
|
||||
?.Data
|
||||
?.Data
|
||||
?.Select(p => p.ALL)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新卷入库信息查询(按起始时间)
|
||||
/// </summary>
|
||||
/// <param name="barcode"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<PaperStorageResult>> RollNewQueryByTime(PaperStorageQueryParam param)
|
||||
{
|
||||
List<PaperStorageResult> apiResultDto = new List<PaperStorageResult>();
|
||||
try
|
||||
{
|
||||
string resStr = await HttpRequestHelper.RequestByDic(
|
||||
url,
|
||||
Method.POST,
|
||||
RequestParam<PaperStorageQueryParam>.CreateParam(
|
||||
ActionID.ODIRollNewQueryByTime,
|
||||
new PaperStorageQueryParam
|
||||
{
|
||||
StartTime = param.StartTime,
|
||||
EndTime = param.EndTime
|
||||
})
|
||||
);
|
||||
|
||||
if (string.IsNullOrEmpty(resStr))
|
||||
{
|
||||
LogHelper.Error($"新卷入库信息查询(按起始时间)(ODIRollNewQueryByTime)出错");
|
||||
return null;
|
||||
}
|
||||
|
||||
apiResultDto = JsonConvert.DeserializeObject<List<PaperStorageResult>>(resStr);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"新卷入库信息查询(按起始时间)(ODIRollNewQueryByTime)出错: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
return apiResultDto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PDA扫合格证码获取物料信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<XRResultDto> GetMateriaInfo(string barCode)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生产入库
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> AddProduceIn(ErpProduceInParam erpMateriaInDto)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生产退库
|
||||
/// </summary>
|
||||
/// <param name="erpProduceOutParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> AddProduceOut(ErpProduceOutParam erpProduceOutParam)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销售出库
|
||||
/// </summary>
|
||||
/// <param name="erpSaleOutParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> AddSaleOut(ErpSaleOutParam erpSaleOutParam)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
using JSMachine.WMS.Common;
|
||||
using JSMachine.WMS.Infrastructure.Attributes;
|
||||
using JSMachine.WMS.Infrastructure.Enums;
|
||||
using JSMachine.WMS.Infrastructure.Helper;
|
||||
using JSMachine.WMS.RPC.ErpRPC.Dto.In.XRBusinessResult;
|
||||
using JSMachine.WMS.RPC.ErpRPC.Dto.Out.XRBusinessResult;
|
||||
using JSMachine.WMS.RPC.ErpRPC.IService;
|
||||
using Newtonsoft.Json;
|
||||
using RestSharp;
|
||||
|
||||
namespace JSMachine.WMS.RPC.ErpRPC.Service.XinRong
|
||||
{
|
||||
[ErpTypeAttribute(ErpType.XinRong)]
|
||||
public class XinRongPaperStorageService : IPaperStorageService
|
||||
{
|
||||
private static readonly string xrUrl = Global.AppSettings.ErpConfig.ErpUrl;
|
||||
private static readonly string userkey = Global.AppSettings.ErpConfig.Userkey;
|
||||
private static readonly string queryMateriaInforUrl = Global.AppSettings.ErpConfig.QueryMateriaInforUrl;
|
||||
private static readonly string produceInUrl = Global.AppSettings.ErpConfig.ProduceInUrl;
|
||||
private static readonly string produceOutUrl = Global.AppSettings.ErpConfig.ProduceOutUrl;
|
||||
private static readonly string saleOutUrl = Global.AppSettings.ErpConfig.SaleOutUrl;
|
||||
|
||||
/// <summary>
|
||||
/// PDA扫合格证码获取物料信息
|
||||
/// </summary>
|
||||
/// <param name="barCode"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<XRResultDto> GetMateriaInfo(string barCode)
|
||||
{
|
||||
var result = new XRResultDto();
|
||||
try
|
||||
{
|
||||
string url = xrUrl + queryMateriaInforUrl;
|
||||
var jsonParam = new
|
||||
{
|
||||
barCode = barCode,
|
||||
user_key = userkey
|
||||
};
|
||||
string resStr = await HttpRequestHelper.RequestByJson(url, Method.POST, JsonConvert.SerializeObject(jsonParam), 15000);
|
||||
if (string.IsNullOrEmpty(resStr))
|
||||
{
|
||||
LogHelper.Error($"PDA扫合格证码获取物料信息(GetMateriaInfo)失败");
|
||||
return null;
|
||||
}
|
||||
var apiResultDto = JsonConvert.DeserializeObject<XRApiResult<XRResultDto>>(resStr);
|
||||
result = JsonConvert.DeserializeObject<XRResultDto>(apiResultDto.result);
|
||||
if (!result.success)
|
||||
{
|
||||
LogHelper.Error($"PDA扫合格证码获取物料信息(GetMateriaInfo)失败: {result.errors}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"PDA扫合格证码获取物料信息(GetMateriaInfo)失败: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生产入库
|
||||
/// </summary>
|
||||
/// <param name="erpProduceInParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<XRResultDto> AddProduceIn(ErpProduceInParam erpProduceInParam)
|
||||
{
|
||||
var result = new XRResultDto { success = false, status = 500 };
|
||||
try
|
||||
{
|
||||
string url = xrUrl + produceInUrl;
|
||||
var jsonParam = new ErpProduceInParam
|
||||
{
|
||||
barCode = erpProduceInParam.barCode,
|
||||
materiaName = erpProduceInParam.materiaName,
|
||||
materiaBatch = erpProduceInParam.materiaBatch,
|
||||
materiaCode = erpProduceInParam.materiaCode,
|
||||
materiaNum = erpProduceInParam.materiaNum,
|
||||
user_key = userkey
|
||||
};
|
||||
string resStr = await HttpRequestHelper.RequestByJson(url, Method.POST, JsonConvert.SerializeObject(jsonParam), 30000);
|
||||
if (string.IsNullOrEmpty(resStr))
|
||||
{
|
||||
result.errors = $"调用Erp生产入库(AddProduceIn)接口失败:{url}";
|
||||
return result;
|
||||
}
|
||||
var apiResultDto = JsonConvert.DeserializeObject<XRApiResult<XRResultDto>>(resStr);
|
||||
result = JsonConvert.DeserializeObject<XRResultDto>(apiResultDto.result);
|
||||
|
||||
if (result.success)
|
||||
{
|
||||
result.status = 200;
|
||||
result.success = true;
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.errors = $"生产入库(AddProduceIn)接口返回失败:" + result.errors;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.errors = $"生产入库(AddProduceIn)异常: {ex.Message} \n {ex.StackTrace}";
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生产退库
|
||||
/// </summary>
|
||||
/// <param name="erpProduceOutParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<XRResultDto> AddProduceOut(ErpProduceOutParam erpProduceOutParam)
|
||||
{
|
||||
var result = new XRResultDto { success = false, status = 500 };
|
||||
|
||||
try
|
||||
{
|
||||
string url = xrUrl + produceOutUrl;
|
||||
var jsonParam = new ErpProduceOutParam
|
||||
{
|
||||
produceReturnCode = erpProduceOutParam.produceReturnCode,
|
||||
barCode = erpProduceOutParam.barCode,
|
||||
materiaName = erpProduceOutParam.materiaName,
|
||||
materiaBatch = erpProduceOutParam.materiaBatch,
|
||||
materiaCode = erpProduceOutParam.materiaCode,
|
||||
num = erpProduceOutParam.num,
|
||||
user_key = userkey
|
||||
};
|
||||
string resStr = await HttpRequestHelper.RequestByJson(url, Method.POST, JsonConvert.SerializeObject(jsonParam), 30000);
|
||||
if (string.IsNullOrEmpty(resStr))
|
||||
{
|
||||
result.errors = $"调用Erp生产退库(AddProduceOut)接口失败:{url}";
|
||||
return result;
|
||||
}
|
||||
result = JsonConvert.DeserializeObject<XRResultDto>(resStr);
|
||||
if (result.success)
|
||||
{
|
||||
result.status = 200;
|
||||
result.success = true;
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.errors = $"生产退库(AddProduceOut)接口返回失败:" + result.errors;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.errors = $"生产退库(AddProduceOut)异常: {ex.Message} \n {ex.StackTrace}";
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销售出库
|
||||
/// </summary>
|
||||
/// <param name="erpSaleOutParam"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<XRResultDto> AddSaleOut(StockOutParam erpSaleOutParam)
|
||||
{
|
||||
var result = new XRResultDto { success = false, status = 500 };
|
||||
|
||||
try
|
||||
{
|
||||
string url = xrUrl + saleOutUrl;
|
||||
var jsonParam = new StockOutParam
|
||||
{
|
||||
saleNo = erpSaleOutParam.saleNo,
|
||||
barCode = erpSaleOutParam.barCode,
|
||||
materiaCode = erpSaleOutParam.materiaCode,
|
||||
num = erpSaleOutParam.num,
|
||||
materiaBatch = erpSaleOutParam.materiaBatch,
|
||||
user_key = userkey
|
||||
|
||||
};
|
||||
string resStr = await HttpRequestHelper.RequestByJson(url, Method.POST, JsonConvert.SerializeObject(jsonParam), 30000);
|
||||
if (string.IsNullOrEmpty(resStr))
|
||||
{
|
||||
result.errors = $"调用Erp销售出库(AddSaleOut)接口失败:{url}";
|
||||
return result;
|
||||
}
|
||||
var apiResultDto = JsonConvert.DeserializeObject<XRApiResult<XRResultDto>>(resStr);
|
||||
result = JsonConvert.DeserializeObject<XRResultDto>(apiResultDto.result);
|
||||
if (result.success)
|
||||
{
|
||||
result.status = 200;
|
||||
result.success = true;
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.errors = $"销售出库(AddSaleOut)接口返回失败:" + result.errors;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.errors = $"销售出库(AddSaleOut)异常: {ex.Message} \n {ex.StackTrace}";
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user