|
|
@ -20,6 +20,8 @@ using WmsWebApi.Enums; |
|
|
|
using WmsWebApi.Jsons; |
|
|
|
using WmsWebApi.StockMove; |
|
|
|
using WmsWebApi.Wms; |
|
|
|
using WmsWebApi.WMS; |
|
|
|
using WmsWebApi.WMS.IRepository; |
|
|
|
|
|
|
|
namespace WmsWebApi.StockMove; |
|
|
|
|
|
|
@ -42,6 +44,7 @@ public class StockMoveService : ApplicationService, IStockMoveService |
|
|
|
private readonly IBackgroundJobRequestRetry _backgroundJobRequestRetry; |
|
|
|
private readonly IStockMoveJsonRepository _stockMoveJsonRepository; |
|
|
|
private readonly AsyncRetryPolicy _asyncRetryPolicy; |
|
|
|
private readonly ITSUNIAPIRepository _tSUNIAPIRepository; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 是否是请求重试
|
|
|
@ -59,7 +62,8 @@ public class StockMoveService : ApplicationService, IStockMoveService |
|
|
|
IConfiguration configuration, |
|
|
|
IUnitOfWorkManager unitOfWorkManager, |
|
|
|
IBackgroundJobRequestRetry backgroundJobRequestRetry, |
|
|
|
IStockMoveJsonRepository stockMoveJsonRepository) |
|
|
|
IStockMoveJsonRepository stockMoveJsonRepository, |
|
|
|
ITSUNIAPIRepository tSUNIAPIRepository) |
|
|
|
{ |
|
|
|
_tsStockDetailRepository = tsStockDetailRepository; |
|
|
|
_tbStockMoveRepository = tbStockMoveRepository; |
|
|
@ -83,6 +87,7 @@ public class StockMoveService : ApplicationService, IStockMoveService |
|
|
|
{ |
|
|
|
Logger.LogInformation($"执行失败,第 {retryCount} 次重试"); |
|
|
|
}); |
|
|
|
_tSUNIAPIRepository = tSUNIAPIRepository; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
@ -131,6 +136,7 @@ public class StockMoveService : ApplicationService, IStockMoveService |
|
|
|
List<TS_STOCK_DETAIL> _stockUpdateList = new List<TS_STOCK_DETAIL>(); |
|
|
|
List<TS_STOCK_DETAIL> _stockDelList = new List<TS_STOCK_DETAIL>(); |
|
|
|
List<TL_TRANSACTION> _transList = new List<TL_TRANSACTION>(); |
|
|
|
List<TS_UNI_API> listTSUNIAPI = new List<TS_UNI_API>(); |
|
|
|
|
|
|
|
#region 添加BILL
|
|
|
|
var tbBill = new TB_BILL |
|
|
@ -392,9 +398,43 @@ public class StockMoveService : ApplicationService, IStockMoveService |
|
|
|
_transList.Add(tlTrans1); |
|
|
|
_transList.Add(tlTrans2); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
//插入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 = tbStockMove.FromLocCode, |
|
|
|
ToLoc = tbStockMove.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) |
|
|
|
{ |
|
|
@ -409,6 +449,10 @@ public class StockMoveService : ApplicationService, IStockMoveService |
|
|
|
await _tmPgWmsUpdate.UpdateTsStock(_stockUpdateList); |
|
|
|
if (_stockDelList != null && _stockDelList.Count() > 0) |
|
|
|
await _tmPgWmsUpdate.DeleteTsStock(_stockDelList); |
|
|
|
if (listTSUNIAPI != null && listTSUNIAPI.Count() > 0) |
|
|
|
{ |
|
|
|
await _tSUNIAPIRepository.InsertManyAsync(listTSUNIAPI); |
|
|
|
} |
|
|
|
await _tlTransactionRepository.AddAsync(_transList); |
|
|
|
} |
|
|
|
await CurrentUnitOfWork.SaveChangesAsync(); |
|
|
@ -436,12 +480,12 @@ public class StockMoveService : ApplicationService, IStockMoveService |
|
|
|
if (bErr) |
|
|
|
{ |
|
|
|
result.TYPE = 'E'; |
|
|
|
apiSSdto.ITYPE = result.MESSAGE; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
apiSSdto.ITYPE = "成功"; |
|
|
|
} |
|
|
|
apiSSdto.ITYPE = result.MESSAGE; |
|
|
|
try |
|
|
|
{ |
|
|
|
await AddWmsWebApiStockMoveDTONowUnitOfWorkAsync(apiSSdto); |
|
|
|