337 lines
13 KiB
C#
337 lines
13 KiB
C#
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();
|
|
}
|
|
}
|
|
}
|