|
|
@ -810,142 +810,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[HttpPost("call-back-freezed-agv")] |
|
|
|
public async Task<AgvResultObject> CallFreezedAgvAsync(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 = "", |
|
|
|
}; |
|
|
|
using var unitOfWork = _unitOfWorkManager.Begin(); |
|
|
|
try |
|
|
|
{ |
|
|
|
if (request.Data.Count > 0) |
|
|
|
{ |
|
|
|
var notes = request.Data; |
|
|
|
|
|
|
|
foreach (var detail in notes) |
|
|
|
{ |
|
|
|
TransferNoteEditInput transfer = new TransferNoteEditInput(); |
|
|
|
transfer.CallJobNumber = detail.OrderNum; |
|
|
|
transfer.Type = EnumTransSubType.Agv_Freezed.ToString(); |
|
|
|
transfer.Worker = "Agv"; |
|
|
|
transfer.UseOnTheWayLocation = false; |
|
|
|
List<TransferNoteDetailInput> transferNoteDetailInputs = new List<TransferNoteDetailInput>(); |
|
|
|
TransferNoteDetailInput detailInput = new TransferNoteDetailInput(); |
|
|
|
var fromloc = await _postionLocationAppService.GetByCodeAsync(detail.BeginPosition).ConfigureAwait(false); |
|
|
|
if (fromloc == null) |
|
|
|
{ |
|
|
|
errors.Add($"来源起始点{detail.BeginPosition}没查到"); |
|
|
|
} |
|
|
|
LocationDTO fromlocation = null; |
|
|
|
if (fromloc != null) |
|
|
|
{ |
|
|
|
fromlocation = await _locationAppService.GetByCodeAsync(fromloc.LocationCode).ConfigureAwait(false); |
|
|
|
} |
|
|
|
if (fromlocation == null) |
|
|
|
{ |
|
|
|
errors.Add($"来源起始点{detail.BeginPosition}库位没查到"); |
|
|
|
} |
|
|
|
var toloc = await _postionLocationAppService.GetByCodeAsync(detail.EndPosition) |
|
|
|
.ConfigureAwait(false); |
|
|
|
if (toloc == null) |
|
|
|
{ |
|
|
|
errors.Add($"结束点{detail.EndPosition}没查到"); |
|
|
|
} |
|
|
|
LocationDTO tolocation = null; |
|
|
|
if (toloc != null) |
|
|
|
{ |
|
|
|
tolocation = await _locationAppService.GetByCodeAsync(toloc.LocationCode).ConfigureAwait(false); |
|
|
|
} |
|
|
|
if (tolocation == null) |
|
|
|
{ |
|
|
|
errors.Add($"结束点{detail.EndPosition}库位没查到"); |
|
|
|
} |
|
|
|
var item = await _itemBasicAppService.GetByCodeAsync(detail.MatCode).ConfigureAwait(false); |
|
|
|
if (item == null) |
|
|
|
{ |
|
|
|
errors.Add($"零件号{detail.MatCode}的零件不存在!"); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
detailInput.ItemCode = item.Code; |
|
|
|
detailInput.Uom = item.BasicUom; |
|
|
|
detailInput.ItemName = item.Name; |
|
|
|
detailInput.ItemDesc1 = !string.IsNullOrEmpty(item.Desc1) ? item.Desc1 : string.Empty; |
|
|
|
} |
|
|
|
if (errors.Count > 0) |
|
|
|
{ |
|
|
|
return ret = new AgvResultObject() |
|
|
|
{ |
|
|
|
Code = "-1", |
|
|
|
ReqCode = "", |
|
|
|
Message = string.Join(",", errors.ToArray()) |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
detailInput.ToLocationCode = tolocation.Code; |
|
|
|
detailInput.ToLocationGroup = tolocation.LocationGroupCode; |
|
|
|
detailInput.ToLocationArea = tolocation.AreaCode; |
|
|
|
detailInput.ToLocationErpCode = tolocation.ErpLocationCode; |
|
|
|
detailInput.ToWarehouseCode = tolocation.WarehouseCode; |
|
|
|
detailInput.ToStatus = EnumInventoryStatus.FROZEN; |
|
|
|
|
|
|
|
detailInput.Qty = detail.MatQty; |
|
|
|
//detailInput.ToLot = !string.IsNullOrEmpty(detail.BatchAttr07) ? detail.BatchAttr07 : string.Empty;
|
|
|
|
detailInput.ToPackingCode = string.Empty; |
|
|
|
detailInput.FromWarehouseCode = fromlocation.WarehouseCode; |
|
|
|
detailInput.FromLocationCode = fromlocation.Code; |
|
|
|
detailInput.FromLocationGroup = fromlocation.LocationGroupCode; |
|
|
|
detailInput.FromLocationArea = fromlocation.AreaCode; |
|
|
|
detailInput.FromLocationErpCode = fromlocation.ErpLocationCode; |
|
|
|
detailInput.FromStatus = EnumInventoryStatus.OK; |
|
|
|
detailInput.Qty = detail.MatQty; |
|
|
|
//detailInput.FromLot = !string.IsNullOrEmpty(detail.BatchAttr07) ? detail.BatchAttr07 : string.Empty;
|
|
|
|
detailInput.FromPackingCode = string.Empty; |
|
|
|
transfer.Details.Add(detailInput); |
|
|
|
await CreateAsync(transfer).ConfigureAwait(false); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
errors.Add("Agv确认单据里无数据! \n"); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
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 = "" |
|
|
|
}; |
|
|
|
await unitOfWork.RollbackAsync().ConfigureAwait(false); |
|
|
|
} |
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|