|
@ -2,6 +2,7 @@ |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
|
|
|
using Abp.Domain.Uow; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using Newtonsoft.Json; |
|
|
using Newtonsoft.Json; |
|
|
using Volo.Abp; |
|
|
using Volo.Abp; |
|
@ -25,6 +26,7 @@ public class OtherZllService : ApplicationService, IOtherZllService |
|
|
private readonly IOtherZllManager _otherZllManager; |
|
|
private readonly IOtherZllManager _otherZllManager; |
|
|
private readonly ITLTransactionRepository _tlTransactionRepository; |
|
|
private readonly ITLTransactionRepository _tlTransactionRepository; |
|
|
private readonly TmPgWmsUpdate _tmPgWmsUpdate; |
|
|
private readonly TmPgWmsUpdate _tmPgWmsUpdate; |
|
|
|
|
|
private readonly Volo.Abp.Uow.IUnitOfWorkManager _unitOfWorkManager; |
|
|
|
|
|
|
|
|
public OtherZllService(ITsStockDetailRepository tsStockDetailRepository, |
|
|
public OtherZllService(ITsStockDetailRepository tsStockDetailRepository, |
|
|
ITbProductReceiveRepository tbProductReceiveRepository, |
|
|
ITbProductReceiveRepository tbProductReceiveRepository, |
|
@ -33,7 +35,8 @@ public class OtherZllService : ApplicationService, IOtherZllService |
|
|
ITaStoreLocationRepository taStoreLocationRepository, |
|
|
ITaStoreLocationRepository taStoreLocationRepository, |
|
|
IOtherZllManager otherZllManager, |
|
|
IOtherZllManager otherZllManager, |
|
|
ITLTransactionRepository tlTransactionRepository, |
|
|
ITLTransactionRepository tlTransactionRepository, |
|
|
TmPgWmsUpdate tmPgWmsUpdate) |
|
|
TmPgWmsUpdate tmPgWmsUpdate |
|
|
|
|
|
, Volo.Abp.Uow.IUnitOfWorkManager unitOfWorkManager) |
|
|
{ |
|
|
{ |
|
|
_tsStockDetailRepository = tsStockDetailRepository; |
|
|
_tsStockDetailRepository = tsStockDetailRepository; |
|
|
_tbProductReceiveRepository = tbProductReceiveRepository; |
|
|
_tbProductReceiveRepository = tbProductReceiveRepository; |
|
@ -43,6 +46,7 @@ public class OtherZllService : ApplicationService, IOtherZllService |
|
|
_otherZllManager = otherZllManager; |
|
|
_otherZllManager = otherZllManager; |
|
|
_tlTransactionRepository = tlTransactionRepository; |
|
|
_tlTransactionRepository = tlTransactionRepository; |
|
|
_tmPgWmsUpdate = tmPgWmsUpdate; |
|
|
_tmPgWmsUpdate = tmPgWmsUpdate; |
|
|
|
|
|
_unitOfWorkManager = unitOfWorkManager; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[HttpPost("add")] |
|
|
[HttpPost("add")] |
|
@ -62,11 +66,14 @@ public class OtherZllService : ApplicationService, IOtherZllService |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
WmsWebApiOtherZLLDTO dto = new WmsWebApiOtherZLLDTO(); |
|
|
|
|
|
dto.JSON = content.ToString(); |
|
|
|
|
|
dto.SetId(GuidGenerator); |
|
|
|
|
|
|
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
if (_dtoList[0].ZDJLX == "20") |
|
|
if (_dtoList[0].ZDJLX == "20") |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
var _dtoDetails = _dtoList.Where(p => p.WERKS == "1000").ToList(); |
|
|
var _dtoDetails = _dtoList.Where(p => p.WERKS == "1000").ToList(); |
|
|
if (_dtoDetails == null || _dtoDetails.Count() == 0) |
|
|
if (_dtoDetails == null || _dtoDetails.Count() == 0) |
|
|
{ |
|
|
{ |
|
@ -75,6 +82,11 @@ public class OtherZllService : ApplicationService, IOtherZllService |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
|
|
|
dto.ZLLDJ = _dtoDetails[0].ZLLDJ; |
|
|
|
|
|
dto.MBLNR = _dtoDetails[0].MBLNR; |
|
|
|
|
|
dto.MJAHR = _dtoDetails[0].MJAHR; |
|
|
|
|
|
dto.ZLLR = _dtoDetails[0].ZLLR; |
|
|
|
|
|
|
|
|
var _billNumList = _dtoDetails.Select(p => p.MBLNR).Distinct().ToList(); |
|
|
var _billNumList = _dtoDetails.Select(p => p.MBLNR).Distinct().ToList(); |
|
|
foreach (var _billNum in _billNumList) |
|
|
foreach (var _billNum in _billNumList) |
|
|
{ |
|
|
{ |
|
@ -267,6 +279,8 @@ public class OtherZllService : ApplicationService, IOtherZllService |
|
|
_transList.Add(tlTrans); |
|
|
_transList.Add(tlTrans); |
|
|
} |
|
|
} |
|
|
if (!bErr) |
|
|
if (!bErr) |
|
|
|
|
|
{ |
|
|
|
|
|
try |
|
|
{ |
|
|
{ |
|
|
if (_recieveList.Count > 0) |
|
|
if (_recieveList.Count > 0) |
|
|
{ |
|
|
{ |
|
@ -281,6 +295,12 @@ public class OtherZllService : ApplicationService, IOtherZllService |
|
|
await _tmPgWmsUpdate.DeleteTsStock(_stockDelList); |
|
|
await _tmPgWmsUpdate.DeleteTsStock(_stockDelList); |
|
|
await _tlTransactionRepository.AddAsync(_transList); |
|
|
await _tlTransactionRepository.AddAsync(_transList); |
|
|
} |
|
|
} |
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
{ |
|
|
|
|
|
dto.ITYPE = ex.GetBaseException().Message; |
|
|
|
|
|
throw new Exception("操作数据库失败,请稍后重试。", ex); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -291,48 +311,38 @@ public class OtherZllService : ApplicationService, IOtherZllService |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
//var pParts = boms.Select(p => p.MATNR).ToList().ToString();
|
|
|
|
|
|
|
|
|
|
|
|
WmsWebApiOtherZLLDTO dto = new WmsWebApiOtherZLLDTO() |
|
|
|
|
|
{ |
|
|
|
|
|
JSON = content.ToString() |
|
|
|
|
|
}; |
|
|
|
|
|
if (_dtoDetails != null && _dtoDetails.Count > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
dto.ZLLDJ = _dtoDetails[0].ZLLDJ; |
|
|
|
|
|
dto.MBLNR = _dtoDetails[0].MBLNR; |
|
|
|
|
|
dto.MJAHR = _dtoDetails[0].MJAHR; |
|
|
|
|
|
dto.ZLLR = _dtoDetails[0].ZLLR; |
|
|
|
|
|
} |
|
|
|
|
|
dto.SetId(GuidGenerator); |
|
|
|
|
|
|
|
|
|
|
|
if (bErr || bTypeErr) |
|
|
if (bErr || bTypeErr) |
|
|
{ |
|
|
{ |
|
|
dto.ITYPE = result.MESSAGE; |
|
|
dto.ITYPE = result.MESSAGE; |
|
|
} |
|
|
} |
|
|
await _otherZllManager.AddAsync(dto); |
|
|
|
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
result.MESSAGE = "err:非物流领料单"; |
|
|
result.MESSAGE = "err:非物流领料单"; |
|
|
WmsWebApiOtherZLLDTO dto = new WmsWebApiOtherZLLDTO() |
|
|
|
|
|
{ |
|
|
|
|
|
JSON = content.ToString(), |
|
|
|
|
|
ITYPE = "err:非物流领料单", |
|
|
|
|
|
}; |
|
|
|
|
|
dto.SetId(GuidGenerator); |
|
|
|
|
|
|
|
|
|
|
|
await _otherZllManager.AddAsync(dto); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|
{ |
|
|
{ |
|
|
result.TYPE = 'E'; |
|
|
dto.ITYPE = ex.GetBaseException().Message; |
|
|
result.MESSAGE = ex.Message; |
|
|
throw; |
|
|
throw new UserFriendlyException(ex.Message, null, null, ex); |
|
|
} |
|
|
|
|
|
finally |
|
|
|
|
|
{ |
|
|
|
|
|
await AddOtherZLLDtoNowUnitOfWorkAsync(dto); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private async Task AddOtherZLLDtoNowUnitOfWorkAsync(WmsWebApiOtherZLLDTO wmsWebApiOtherZLLDTO) |
|
|
|
|
|
{ |
|
|
|
|
|
if (wmsWebApiOtherZLLDTO == null) { return; } |
|
|
|
|
|
|
|
|
|
|
|
using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) |
|
|
|
|
|
{ |
|
|
|
|
|
await _otherZllManager.AddAsync(wmsWebApiOtherZLLDTO); |
|
|
|
|
|
await uow.SaveChangesAsync(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |