|
@ -15,8 +15,10 @@ using WmsWebApi.BackgroundJobs; |
|
|
using WmsWebApi.Domain; |
|
|
using WmsWebApi.Domain; |
|
|
using WmsWebApi.EntityFrameworkCore; |
|
|
using WmsWebApi.EntityFrameworkCore; |
|
|
using WmsWebApi.Jsons; |
|
|
using WmsWebApi.Jsons; |
|
|
|
|
|
using WmsWebApi.Repositories; |
|
|
using WmsWebApi.Wms; |
|
|
using WmsWebApi.Wms; |
|
|
using WmsWebApi.WMS; |
|
|
using WmsWebApi.WMS; |
|
|
|
|
|
using WmsWebApi.WMS.IRepository; |
|
|
|
|
|
|
|
|
namespace WmsWebApi.ProductRecieve; |
|
|
namespace WmsWebApi.ProductRecieve; |
|
|
|
|
|
|
|
@ -39,6 +41,7 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService |
|
|
private readonly IBackgroundJobRequestRetry _backgroundJobRequestRetry; |
|
|
private readonly IBackgroundJobRequestRetry _backgroundJobRequestRetry; |
|
|
private readonly IProductRecieveJsonRepository _productRecieveJsonRepository; |
|
|
private readonly IProductRecieveJsonRepository _productRecieveJsonRepository; |
|
|
private readonly AsyncRetryPolicy _asyncRetryPolicy; |
|
|
private readonly AsyncRetryPolicy _asyncRetryPolicy; |
|
|
|
|
|
private readonly ITSUNIAPIRepository _tSUNIAPIRepository; |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 是否是请求重试
|
|
|
/// 是否是请求重试
|
|
@ -56,7 +59,8 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService |
|
|
IConfiguration configuration, |
|
|
IConfiguration configuration, |
|
|
IUnitOfWorkManager unitOfWorkManager, |
|
|
IUnitOfWorkManager unitOfWorkManager, |
|
|
IBackgroundJobRequestRetry backgroundJobRequestRetry, |
|
|
IBackgroundJobRequestRetry backgroundJobRequestRetry, |
|
|
IProductRecieveJsonRepository productRecieveJsonRepository) |
|
|
IProductRecieveJsonRepository productRecieveJsonRepository, |
|
|
|
|
|
ITSUNIAPIRepository tSUNIAPIRepository) |
|
|
{ |
|
|
{ |
|
|
_tsStockDetailRepository = tsStockDetailRepository; |
|
|
_tsStockDetailRepository = tsStockDetailRepository; |
|
|
_tbProductReceiveRepository = tbProductReceiveRepository; |
|
|
_tbProductReceiveRepository = tbProductReceiveRepository; |
|
@ -80,6 +84,7 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService |
|
|
{ |
|
|
{ |
|
|
Logger.LogInformation($"执行失败,第 {retryCount} 次重试"); |
|
|
Logger.LogInformation($"执行失败,第 {retryCount} 次重试"); |
|
|
}); |
|
|
}); |
|
|
|
|
|
_tSUNIAPIRepository = tSUNIAPIRepository; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[HttpPost("add/IF01")] |
|
|
[HttpPost("add/IF01")] |
|
@ -257,6 +262,42 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService |
|
|
TransType = 1 |
|
|
TransType = 1 |
|
|
}; |
|
|
}; |
|
|
_transList.Add(tlTrans); |
|
|
_transList.Add(tlTrans); |
|
|
|
|
|
|
|
|
|
|
|
//插入TS_UNI_API
|
|
|
|
|
|
listTSUNIAPI.Add(new TS_UNI_API() |
|
|
|
|
|
{ |
|
|
|
|
|
InterfaceType = "BackFlush", |
|
|
|
|
|
TableName = "xxwms_bk_mstr", |
|
|
|
|
|
BillType = 201, |
|
|
|
|
|
SubBillType = tbBill.SubBillType, |
|
|
|
|
|
BillNum = tbBill.BillNum, |
|
|
|
|
|
PartCode = item.PartCode, |
|
|
|
|
|
Batch = item.Batch, |
|
|
|
|
|
FromLoc = "", |
|
|
|
|
|
ToLoc = tbRecieve.ToLocCode, |
|
|
|
|
|
FromErpLoc = "", |
|
|
|
|
|
ToErpLoc = "", |
|
|
|
|
|
Qty = item.Qty, |
|
|
|
|
|
State = 0, |
|
|
|
|
|
CreateOper = "AGV", |
|
|
|
|
|
CreateTime = DateTime.Now, |
|
|
|
|
|
PutTime = DateTime.Now, |
|
|
|
|
|
CustId = "", |
|
|
|
|
|
VendId = "", |
|
|
|
|
|
PoUnit = "", |
|
|
|
|
|
LocUnit = "", |
|
|
|
|
|
ValidDate = DateTime.Now, |
|
|
|
|
|
ErpBillNum = tbBill.BillNum, |
|
|
|
|
|
ErpLineNum = 0, |
|
|
|
|
|
EqptCode = "", |
|
|
|
|
|
EqptType = "B", |
|
|
|
|
|
VendBatch = item.Batch, |
|
|
|
|
|
SourceBillNum = tbBill.SourceBillNum, |
|
|
|
|
|
ProcessId = 0, |
|
|
|
|
|
GoodQty = item.Qty, |
|
|
|
|
|
ScrapQty = 0, |
|
|
|
|
|
InvalidQty = 0 |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
if (!bErr) |
|
|
if (!bErr) |
|
|
{ |
|
|
{ |
|
@ -269,6 +310,10 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService |
|
|
await _tsStockDetailRepository.AddAsync(_stockList); |
|
|
await _tsStockDetailRepository.AddAsync(_stockList); |
|
|
if (_stockUpdateList != null && _stockUpdateList.Count() > 0) |
|
|
if (_stockUpdateList != null && _stockUpdateList.Count() > 0) |
|
|
await _tmPgWmsUpdate.UpdateTsStock(_stockUpdateList); |
|
|
await _tmPgWmsUpdate.UpdateTsStock(_stockUpdateList); |
|
|
|
|
|
if (listTSUNIAPI != null && listTSUNIAPI.Count() > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
await _tSUNIAPIRepository.InsertManyAsync(listTSUNIAPI); |
|
|
|
|
|
} |
|
|
await _tlTransactionRepository.AddAsync(_transList); |
|
|
await _tlTransactionRepository.AddAsync(_transList); |
|
|
} |
|
|
} |
|
|
await CurrentUnitOfWork.SaveChangesAsync(); |
|
|
await CurrentUnitOfWork.SaveChangesAsync(); |
|
@ -280,14 +325,14 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService |
|
|
result.TYPE = 'E'; |
|
|
result.TYPE = 'E'; |
|
|
result.MESSAGE = ex.Message; |
|
|
result.MESSAGE = ex.Message; |
|
|
|
|
|
|
|
|
if (IsRequestRetry == false) |
|
|
if (IsRequestRetry == false) |
|
|
{ |
|
|
{ |
|
|
//await _backgroundJobRequestRetry.AddBackgroundJobAsync(EnumActionName.ProductRecieveAdd, content.ToString());
|
|
|
//await _backgroundJobRequestRetry.AddBackgroundJobAsync(EnumActionName.ProductRecieveAdd, content.ToString());
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
throw new Exception($"接口异常,请稍后重试:{ex.GetBaseException().Message}", ex); |
|
|
throw new Exception($"接口异常,请稍后重试:{ex.GetBaseException().Message}", ex); |
|
|
} |
|
|
} |
|
|
finally |
|
|
finally |
|
|
{ |
|
|
{ |
|
|
if (IsRequestRetry == false) |
|
|
if (IsRequestRetry == false) |
|
|
{ |
|
|
{ |
|
@ -298,7 +343,7 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService |
|
|
result.TYPE = 'E'; |
|
|
result.TYPE = 'E'; |
|
|
apiPRdto.ITYPE = result.MESSAGE; |
|
|
apiPRdto.ITYPE = result.MESSAGE; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
result.MESSAGE = "成功"; |
|
|
result.MESSAGE = "成功"; |
|
|
apiPRdto.ITYPE = "成功"; |
|
|
apiPRdto.ITYPE = "成功"; |
|
@ -325,7 +370,7 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService |
|
|
|
|
|
|
|
|
if (bErr == false) |
|
|
if (bErr == false) |
|
|
{ |
|
|
{ |
|
|
result.MESSAGE = "接收成功!"; |
|
|
result.MESSAGE = "成功!"; |
|
|
} |
|
|
} |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|