|
|
@ -1,19 +1,19 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Net.Http.Headers; |
|
|
|
using System.Net.Http; |
|
|
|
using System.Text; |
|
|
|
using System.Text.Json; |
|
|
|
using System.Threading; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
using Omu.ValueInjecter; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using Microsoft.Extensions.Options; |
|
|
|
using Volo.Abp; |
|
|
|
using Volo.Abp.Application.Dtos; |
|
|
|
using Win_in.Sfs.Basedata.Application; |
|
|
|
using Volo.Abp.Uow; |
|
|
|
using Win_in.Sfs.Basedata; |
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
|
using Win_in.Sfs.Basedata.Domain.Shared; |
|
|
|
using Win_in.Sfs.Basedata.SplitPackings.Commons; |
|
|
@ -21,17 +21,10 @@ using Win_in.Sfs.Label.Application.Contracts; |
|
|
|
using Win_in.Sfs.Shared.Domain; |
|
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
|
using Win_in.Sfs.Wms.Inventory.Application.Contracts; |
|
|
|
|
|
|
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|
|
|
using Win_in.Sfs.Wms.Store.Domain; |
|
|
|
using Win_in.Sfs.Wms.Store.Domain.Shared; |
|
|
|
using Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy; |
|
|
|
using Win_in.Sfs.Wms.Store.Options; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using Microsoft.Extensions.Options; |
|
|
|
using Volo.Abp.ObjectMapping; |
|
|
|
using NUglify.Helpers; |
|
|
|
using Volo.Abp.Uow; |
|
|
|
|
|
|
|
namespace Win_in.Sfs.Wms.Store.Application; |
|
|
|
|
|
|
@ -63,6 +56,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
private readonly ILogger<TransferNoteAppService> _logger; |
|
|
|
|
|
|
|
private readonly IPostionLocationAppService _postionLocationAppService; |
|
|
|
private readonly IProductionLineAppService _productionLineAppService; |
|
|
|
|
|
|
|
|
|
|
|
private readonly UnitOfWorkManager _unitOfWorkManager; |
|
|
@ -84,7 +78,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
IPostionLocationAppService postionLocationAppService, |
|
|
|
IItemBasicAppService itemBasicAppService, |
|
|
|
UnitOfWorkManager unitOfWorkManager, |
|
|
|
IExpectOutAppService expectOutAppService) : base(repository) |
|
|
|
IExpectOutAppService expectOutAppService, IProductionLineAppService productionLineAppService) : base(repository) |
|
|
|
{ |
|
|
|
_unitOfWorkManager = unitOfWorkManager; |
|
|
|
_transferNoteManager = transferNoteManager; |
|
|
@ -97,6 +91,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
_issueJobAppService = issueJobAppService; |
|
|
|
_inventoryLabelAppService = inventoryLabelAppService; |
|
|
|
_expectOutAppService = expectOutAppService; |
|
|
|
_productionLineAppService = productionLineAppService; |
|
|
|
_logger = logger; |
|
|
|
_agvOptions = agvOptions; |
|
|
|
_postionLocationAppService = postionLocationAppService; |
|
|
@ -124,15 +119,17 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
{ |
|
|
|
var balanceDto = await _balanceAppService.GetByItemLocationAndPackingAsync(detail.FromPackingCode, |
|
|
|
detail.ItemCode, detail.FromLocationCode).ConfigureAwait(false); |
|
|
|
var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); |
|
|
|
var fromLocationDto = await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); |
|
|
|
var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode) |
|
|
|
.ConfigureAwait(false); |
|
|
|
var fromLocationDto = await _locationAppService.GetByCodeAsync(detail.FromLocationCode) |
|
|
|
.ConfigureAwait(false); |
|
|
|
|
|
|
|
CheckLocation(toLocationDto, detail); |
|
|
|
CheckFromLocation(fromLocationDto, detail); |
|
|
|
await CheckPackingCodeAsync(detail.FromPackingCode).ConfigureAwait(false); |
|
|
|
if (toLocationDto.Type != fromLocationDto.Type) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"来源库位与目标库位类型不一致"); |
|
|
|
throw new UserFriendlyException("来源库位与目标库位类型不一致"); |
|
|
|
} |
|
|
|
|
|
|
|
detail.OnTheWayLocationCode = bool.FalseString; |
|
|
@ -190,6 +187,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
} |
|
|
|
|
|
|
|
#region 校验
|
|
|
|
|
|
|
|
private void CheckLocation(LocationDTO locationDto, TransferNoteDetail detail) |
|
|
|
{ |
|
|
|
if (locationDto == null) |
|
|
@ -197,6 +195,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
throw new UserFriendlyException($"库位代码为【{detail.ToLocationCode}】不存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void CheckFromLocation(LocationDTO locationDto, TransferNoteDetail detail) |
|
|
|
{ |
|
|
|
if (locationDto == null) |
|
|
@ -204,6 +203,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
throw new UserFriendlyException($"库位代码为【{detail.FromLocationCode}】不存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
@ -297,6 +297,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
return await GetSubTypeListAsync(sfsRequestDTO, EnumTransSubType.Transfer_Inside, includeDetails, |
|
|
|
cancellationToken).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("get-Injection-list")] |
|
|
|
public virtual async Task<PagedResultDto<TransferNoteDTO>> GetInjectionTransferListAsync( |
|
|
|
SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false, |
|
|
@ -305,6 +306,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
return await GetSubTypeListAsync(sfsRequestDTO, EnumTransSubType.Transfer_Injection, includeDetails, |
|
|
|
cancellationToken).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("get-coating-list")] |
|
|
|
public virtual async Task<PagedResultDto<TransferNoteDTO>> GetCoatingTransferListAsync( |
|
|
|
SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false, |
|
|
@ -313,6 +315,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
return await GetSubTypeListAsync(sfsRequestDTO, EnumTransSubType.Transfer_Coating, includeDetails, |
|
|
|
cancellationToken).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("get-assemble-list")] |
|
|
|
public virtual async Task<PagedResultDto<TransferNoteDTO>> GetAssembleTransferListAsync( |
|
|
|
SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false, |
|
|
@ -321,6 +324,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
return await GetSubTypeListAsync(sfsRequestDTO, EnumTransSubType.Transfer_Assemble, includeDetails, |
|
|
|
cancellationToken).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 按条件获取客户储位间调拨的分页列表
|
|
|
|
/// request sample
|
|
|
@ -373,10 +377,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
{ |
|
|
|
sfsRequestDTO.Condition.Filters.Add(new Filter |
|
|
|
{ |
|
|
|
Action = "==", |
|
|
|
Column = "Type", |
|
|
|
Logic = EnumFilterLogic.And.ToString(), |
|
|
|
Value = type.ToString() |
|
|
|
Action = "==", Column = "Type", Logic = EnumFilterLogic.And.ToString(), Value = type.ToString() |
|
|
|
}); |
|
|
|
|
|
|
|
var expression = sfsRequestDTO.Condition.Filters?.Count > 0 |
|
|
@ -406,6 +407,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
await CheckPackingCodeAsync(detail.FromPackingCode).ConfigureAwait(false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
entity = await _transferNoteManager.CreateAsync(entity).ConfigureAwait(false); |
|
|
|
|
|
|
|
var dto = ObjectMapper.Map<TransferNote, TransferNoteDTO>(entity); |
|
|
@ -434,6 +436,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
await CheckPackingCodeAsync(detail.FromPackingCode).ConfigureAwait(false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
resultEntity.Add(await _transferNoteManager.CreateAsync(entity).ConfigureAwait(false)); |
|
|
|
_ = ObjectMapper.Map<TransferNote, TransferNoteDTO>(entity); |
|
|
|
} |
|
|
@ -460,8 +463,6 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 确认对应的记录单
|
|
|
|
/// </summary>
|
|
|
@ -494,18 +495,21 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
/// </summary>
|
|
|
|
/// <param name="transferNoteEditInput"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task<bool> WriteSplitPackingRec(TransferNoteEditInput transferNoteEditInput, SplitPacking_UpdateJobDetailInput updateJobDetailInput = null) |
|
|
|
private async Task<bool> WriteSplitPackingRec(TransferNoteEditInput transferNoteEditInput, |
|
|
|
SplitPacking_UpdateJobDetailInput updateJobDetailInput = null) |
|
|
|
{ |
|
|
|
|
|
|
|
List<SplitPackingRecEditInput> recLst = new List<SplitPackingRecEditInput>(); |
|
|
|
var recLst = new List<SplitPackingRecEditInput>(); |
|
|
|
foreach (var inputDetail in transferNoteEditInput.Details) |
|
|
|
{ |
|
|
|
bool qtyEnough = await _splitPackingRecAppService.CheckSplitNum(inputDetail.FromPackingCode, inputDetail.Qty).ConfigureAwait(false); |
|
|
|
var qtyEnough = await _splitPackingRecAppService.CheckSplitNum(inputDetail.FromPackingCode, inputDetail.Qty) |
|
|
|
.ConfigureAwait(false); |
|
|
|
if (qtyEnough == false) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"[WriteSplitPackingRec]拆箱记录表数量不足:FromPackingCode={inputDetail.FromPackingCode},Qty={inputDetail.Qty}"); |
|
|
|
throw new UserFriendlyException( |
|
|
|
$"[WriteSplitPackingRec]拆箱记录表数量不足:FromPackingCode={inputDetail.FromPackingCode},Qty={inputDetail.Qty}"); |
|
|
|
} |
|
|
|
SplitPackingRecEditInput packRec = new SplitPackingRecEditInput(); |
|
|
|
|
|
|
|
var packRec = new SplitPackingRecEditInput(); |
|
|
|
|
|
|
|
packRec.OprType = OprTypeEnum.SplitBox; |
|
|
|
packRec.FromPackingCode = inputDetail.FromPackingCode; |
|
|
@ -536,8 +540,10 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
packRec.FromQty = updateJobDetailInput.FromQty; |
|
|
|
packRec.ToQty = updateJobDetailInput.ToQty; |
|
|
|
} |
|
|
|
|
|
|
|
//根据箱码在inventoryLabel取采购订单、供应商发货单
|
|
|
|
var inventoryLabelDto = await _inventoryLabelAppService.GetByCodeAsync(inputDetail.FromPackingCode).ConfigureAwait(false); |
|
|
|
var inventoryLabelDto = await _inventoryLabelAppService.GetByCodeAsync(inputDetail.FromPackingCode) |
|
|
|
.ConfigureAwait(false); |
|
|
|
if (inventoryLabelDto != null) |
|
|
|
{ |
|
|
|
packRec.PurchaseInfo_PoNumber = inventoryLabelDto.PoNumber; |
|
|
@ -545,13 +551,14 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
//packRec.PurchaseInfo_SupplierCode = inventoryLabelDto.SupplierCode;
|
|
|
|
|
|
|
|
#region InventoryLabel兼容成员
|
|
|
|
|
|
|
|
var inputObj = inventoryLabelDto; |
|
|
|
packRec.FullBarcodeString = inputObj.FullBarcodeString; |
|
|
|
packRec.SupplierBatch = inputObj.SupplierBatch; |
|
|
|
packRec.ArriveDate = inputObj.ArriveDate; |
|
|
|
packRec.ProduceDate = inputObj.ProduceDate; |
|
|
|
packRec.ExpireDate = inputObj.ExpireDate; |
|
|
|
packRec.LabelStatus = (Win_in.Sfs.Basedata.LabelStatus)((int)inputObj.LabelStatus); |
|
|
|
packRec.LabelStatus = (LabelStatus)(int)inputObj.LabelStatus; |
|
|
|
packRec.RecommendLocationCode = inputObj.RecommendLocationCode; |
|
|
|
packRec.LocationErpCode = inputObj.LocationErpCode; |
|
|
|
//packRec.ContainerCode = inputObj.ContainerCode;
|
|
|
@ -570,10 +577,13 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
packRec.SupplierItemCode = inputObj.SupplierItemCode; |
|
|
|
packRec.SupplierItemName = inputObj.SupplierItemName; |
|
|
|
packRec.PlanArriveDate = inputObj.PlanArriveDate; |
|
|
|
|
|
|
|
#endregion
|
|
|
|
} |
|
|
|
|
|
|
|
recLst.Add(packRec); |
|
|
|
} |
|
|
|
|
|
|
|
var ret = await _splitPackingRecAppService.BatchInsertAsync(recLst).ConfigureAwait(false); |
|
|
|
return ret; |
|
|
|
} |
|
|
@ -585,11 +595,16 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
/// <param name="updateJobDetailInput"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("split-packing-purchase-receipt")] |
|
|
|
public async Task<bool> SplitPacking_PurchaseReceiptAsync(TransferNoteEditInput transferNoteEditInput, [FromQuery] SplitPacking_UpdateJobDetailInput updateJobDetailInput) |
|
|
|
{ |
|
|
|
var jobRet = await _purchaseReceiptJobAppService.SaveDetail_SplitPackingAsync(updateJobDetailInput).ConfigureAwait(false); |
|
|
|
var requestRet = await _purchaseReceiptRequestAppService.SaveDetail_SplitPackingAsync(updateJobDetailInput, jobRet.PurchaseReceiptRequestNumber).ConfigureAwait(false); |
|
|
|
bool ret = await WriteSplitPackingRec(transferNoteEditInput, updateJobDetailInput).ConfigureAwait(false); //采购收货-目检-拆箱时,还没有入库,不涉及库存操作
|
|
|
|
public async Task<bool> SplitPacking_PurchaseReceiptAsync(TransferNoteEditInput transferNoteEditInput, |
|
|
|
[FromQuery] SplitPacking_UpdateJobDetailInput updateJobDetailInput) |
|
|
|
{ |
|
|
|
var jobRet = await _purchaseReceiptJobAppService.SaveDetail_SplitPackingAsync(updateJobDetailInput) |
|
|
|
.ConfigureAwait(false); |
|
|
|
var requestRet = await _purchaseReceiptRequestAppService |
|
|
|
.SaveDetail_SplitPackingAsync(updateJobDetailInput, jobRet.PurchaseReceiptRequestNumber) |
|
|
|
.ConfigureAwait(false); |
|
|
|
var ret = await WriteSplitPackingRec(transferNoteEditInput, updateJobDetailInput) |
|
|
|
.ConfigureAwait(false); //采购收货-目检-拆箱时,还没有入库,不涉及库存操作
|
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
@ -600,7 +615,8 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
/// <param name="updateJobDetailInput"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("split-packing-inspect")] |
|
|
|
public async Task<TransferNoteDTO> SplitPacking_InspectAsync(TransferNoteEditInput transferNoteEditInput, [FromQuery] SplitPacking_UpdateJobDetailInput updateJobDetailInput) |
|
|
|
public async Task<TransferNoteDTO> SplitPacking_InspectAsync(TransferNoteEditInput transferNoteEditInput, |
|
|
|
[FromQuery] SplitPacking_UpdateJobDetailInput updateJobDetailInput) |
|
|
|
{ |
|
|
|
//SplitPacking_UpdateDetailInput newInput = new SplitPacking_UpdateDetailInput();
|
|
|
|
//newInput.Number = updateJobDetailInput.Number;
|
|
|
@ -611,7 +627,8 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
//newInput.FromLocationCode = transferNoteEditInput.Details[0].FromLocationCode;
|
|
|
|
//newInput.ToLocationCode = transferNoteEditInput.Details[0].ToLocationCode;
|
|
|
|
//var expectOutRet = await _expectOutAppService.SaveDetail_SplitPackingAsync(newInput).ConfigureAwait(false);
|
|
|
|
var jobRet = await _inspectJobAppService.SaveDetail_SplitPackingAsync(updateJobDetailInput).ConfigureAwait(false); |
|
|
|
var jobRet = await _inspectJobAppService.SaveDetail_SplitPackingAsync(updateJobDetailInput) |
|
|
|
.ConfigureAwait(false); |
|
|
|
var ret = await SplitPackingAsync(transferNoteEditInput).ConfigureAwait(false); //库存操作
|
|
|
|
return ret; |
|
|
|
} |
|
|
@ -623,9 +640,10 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
/// <param name="updateJobDetailInput"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("split-packing-issue")] |
|
|
|
public async Task<TransferNoteDTO> SplitPacking_IssueAsync(TransferNoteEditInput transferNoteEditInput, [FromQuery] SplitPacking_UpdateJobDetailInput updateJobDetailInput) |
|
|
|
public async Task<TransferNoteDTO> SplitPacking_IssueAsync(TransferNoteEditInput transferNoteEditInput, |
|
|
|
[FromQuery] SplitPacking_UpdateJobDetailInput updateJobDetailInput) |
|
|
|
{ |
|
|
|
SplitPacking_UpdateDetailInput newInput = new SplitPacking_UpdateDetailInput(); |
|
|
|
var newInput = new SplitPacking_UpdateDetailInput(); |
|
|
|
newInput.Number = updateJobDetailInput.Number; |
|
|
|
newInput.FromPackingCode = updateJobDetailInput.FromPackingCode; |
|
|
|
newInput.FromQty = updateJobDetailInput.FromQty; |
|
|
@ -646,10 +664,11 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
/// <param name="updateJobDetailInputBase"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("split-packing-check-expect-out")] |
|
|
|
public async Task<TransferNoteDTO> SplitPackingCheckExpectOutAsync(TransferNoteEditInput transferNoteEditInput, [FromQuery] SplitPacking_UpdateJobDetailInputBase updateJobDetailInputBase) |
|
|
|
public async Task<TransferNoteDTO> SplitPackingCheckExpectOutAsync(TransferNoteEditInput transferNoteEditInput, |
|
|
|
[FromQuery] SplitPacking_UpdateJobDetailInputBase updateJobDetailInputBase) |
|
|
|
{ |
|
|
|
var detailObj = transferNoteEditInput.Details[0]; |
|
|
|
SplitPacking_UpdateDetailInput newInput = new SplitPacking_UpdateDetailInput(); |
|
|
|
var newInput = new SplitPacking_UpdateDetailInput(); |
|
|
|
newInput.Number = updateJobDetailInputBase.Number; |
|
|
|
newInput.FromPackingCode = detailObj.FromPackingCode; |
|
|
|
newInput.FromQty = detailObj.Qty; |
|
|
@ -660,37 +679,23 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
var expectOutLst = await _expectOutAppService.GetListByJobNumberAsync(newInput).ConfigureAwait(false); |
|
|
|
if (expectOutLst.Count > 0) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"预计出表存在数据,不允许办理拆箱:JobNumber={newInput.Number}|PackingCode={newInput.FromPackingCode}|Qty={newInput.FromQty}|LocationCode={newInput.FromLocationCode}"); |
|
|
|
throw new UserFriendlyException( |
|
|
|
$"预计出表存在数据,不允许办理拆箱:JobNumber={newInput.Number}|PackingCode={newInput.FromPackingCode}|Qty={newInput.FromQty}|LocationCode={newInput.FromLocationCode}"); |
|
|
|
} |
|
|
|
|
|
|
|
var ret = await SplitPackingAsync(transferNoteEditInput).ConfigureAwait(false); |
|
|
|
return ret; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPost("call-back-agv")] |
|
|
|
public async Task<AgvResultObject> CallBackAgvAsync(AgvRequestDto request) |
|
|
|
{ |
|
|
|
var json = JsonSerializer.Serialize(request); |
|
|
|
var flag = DateTime.Now.ToString("yyyyMMddHHmmss"); |
|
|
|
_logger.LogInformation($"{flag}接收到AGV确认单据内容:" + json); |
|
|
|
#if DEBUG
|
|
|
|
#endif
|
|
|
|
var errors = new List<string>(); |
|
|
|
var ret = new AgvResultObject |
|
|
|
{ |
|
|
|
Code = "0", |
|
|
|
Message = "OK", |
|
|
|
ReqCode = "", |
|
|
|
}; |
|
|
|
var ret = new AgvResultObject { Code = "0", Message = "OK", ReqCode = "" }; |
|
|
|
using var unitOfWork = _unitOfWorkManager.Begin(); |
|
|
|
try |
|
|
|
{ |
|
|
@ -700,29 +705,36 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
|
|
|
|
foreach (var detail in notes) |
|
|
|
{ |
|
|
|
TransferNoteEditInput transfer = new TransferNoteEditInput(); |
|
|
|
var transfer = new TransferNoteEditInput(); |
|
|
|
transfer.CallJobNumber = detail.OrderNum; |
|
|
|
|
|
|
|
transfer.Worker = "Agv"; |
|
|
|
transfer.UseOnTheWayLocation = false; |
|
|
|
List<TransferNoteDetailInput> transferNoteDetailInputs = new List<TransferNoteDetailInput>(); |
|
|
|
TransferNoteDetailInput detailInput = new TransferNoteDetailInput(); |
|
|
|
var transferNoteDetailInputs = new List<TransferNoteDetailInput>(); |
|
|
|
var detailInput = new TransferNoteDetailInput(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LocationDTO fromlocation = await _locationAppService.GetByCodeAsync(detail.BeginPosition).ConfigureAwait(false); |
|
|
|
var fromlocation = |
|
|
|
await _locationAppService.GetByCodeAsync(detail.BeginPosition).ConfigureAwait(false); |
|
|
|
|
|
|
|
if (fromlocation == null) |
|
|
|
{ |
|
|
|
errors.Add($"来源起始点{detail.BeginPosition}库位没查到"); |
|
|
|
} |
|
|
|
|
|
|
|
LocationDTO tolocation = await _locationAppService.GetByCodeAsync(detail.EndPosition).ConfigureAwait(false); |
|
|
|
var tolocation = await _locationAppService.GetByCodeAsync(detail.EndPosition).ConfigureAwait(false); |
|
|
|
|
|
|
|
if (tolocation == null) |
|
|
|
{ |
|
|
|
errors.Add($"结束点{detail.EndPosition}库位没查到"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//fromlocation.Type == EnumLocationType.WIP;
|
|
|
|
//tolocation.Type==EnumLocationType.SEMI||EnumLocationType.DimensionalStorehouse
|
|
|
|
//var productionLineDto=await _productionLineAppService.GetByLocationCodeAsync(tolocation.Code);
|
|
|
|
//productionLineDto.ProductionLineType==EnumProductionLineType.Assemble
|
|
|
|
|
|
|
|
switch (tolocation.WarehouseCode) |
|
|
|
{ |
|
|
|
case "APA-KWZ": // 装配线边库位组
|
|
|
@ -736,7 +748,6 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
break; |
|
|
|
default: |
|
|
|
throw new UserFriendlyException("结束库位、不是喷涂、注塑、涂装等线边类型!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var item = await _itemBasicAppService.GetByCodeAsync(detail.MatCode).ConfigureAwait(false); |
|
|
@ -751,15 +762,15 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
detailInput.ItemName = item.Name; |
|
|
|
detailInput.ItemDesc1 = !string.IsNullOrEmpty(item.Desc1) ? item.Desc1 : string.Empty; |
|
|
|
} |
|
|
|
|
|
|
|
if (errors.Count > 0) |
|
|
|
{ |
|
|
|
return ret = new AgvResultObject() |
|
|
|
return ret = new AgvResultObject |
|
|
|
{ |
|
|
|
Code = "-1", |
|
|
|
ReqCode = "", |
|
|
|
Message = string.Join(",", errors.ToArray()) |
|
|
|
Code = "-1", ReqCode = "", Message = string.Join(",", errors.ToArray()) |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
detailInput.ToLocationCode = tolocation.Code; |
|
|
|
detailInput.ToLocationGroup = tolocation.LocationGroupCode; |
|
|
|
detailInput.ToLocationArea = tolocation.AreaCode; |
|
|
@ -768,7 +779,6 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
detailInput.FromStatus = tolocation.DefaultInventoryStatus; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
detailInput.Qty = detail.MatQty; |
|
|
|
detailInput.ToLot = !string.IsNullOrEmpty(detail.BatchAttr07) ? detail.BatchAttr07 : string.Empty; |
|
|
|
detailInput.ToPackingCode = string.Empty; |
|
|
@ -795,34 +805,16 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
ret = new AgvResultObject |
|
|
|
{ |
|
|
|
Code = "-1", |
|
|
|
ReqCode = "", |
|
|
|
Message = ex.Message |
|
|
|
}; |
|
|
|
ret = new AgvResultObject { Code = "-1", ReqCode = "", Message = ex.Message }; |
|
|
|
await unitOfWork.RollbackAsync().ConfigureAwait(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (errors.Count > 0) |
|
|
|
{ |
|
|
|
ret = new AgvResultObject |
|
|
|
{ |
|
|
|
Code = "-1", |
|
|
|
Message = string.Join(",", errors.ToArray()), |
|
|
|
ReqCode = "" |
|
|
|
}; |
|
|
|
ret = new AgvResultObject { Code = "-1", Message = string.Join(",", errors.ToArray()), ReqCode = "" }; |
|
|
|
await unitOfWork.RollbackAsync().ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|