diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransSubType.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransSubType.cs
index e1869bb2e..47624c403 100644
--- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransSubType.cs
+++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransSubType.cs
@@ -232,5 +232,12 @@ public enum EnumTransSubType
/// 立库出库线边仓领料
///
[Display(Name = "立库出库线边仓领料")]
- Depot_Issue_WIP = 1511
+ Depot_Issue_WIP = 1511,
+
+
+ ///
+ ///AGV出库线边仓调拨
+ ///
+ [Display(Name = "AGV出库线边仓调拨")]
+ Agv_Transfer_WIP = 1512
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs
index cb211f8eb..5c15ef655 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs
@@ -29,6 +29,8 @@ 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;
namespace Win_in.Sfs.Wms.Store.Application;
@@ -54,10 +56,10 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
private readonly IExpectOutAppService _expectOutAppService; //
private readonly IInventoryLabelAppService _inventoryLabelAppService;
private readonly IHttpClientFactory _httpClientFactory;
-
+ private readonly IItemBasicAppService _itemBasicAppService;
private readonly IOptions _agvOptions;
- private readonly ILogger _logger;
+ private readonly ILogger _logger;
private readonly IPostionLocationAppService _postionLocationAppService;
@@ -76,6 +78,10 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
IIssueJobAppService issueJobAppService,
IInventoryLabelAppService inventoryLabelAppService,
IHttpClientFactory _httpClientFactory,
+ ILogger logger,
+ IOptions agvOptions,
+ IPostionLocationAppService postionLocationAppService,
+ IItemBasicAppService itemBasicAppService,
IExpectOutAppService expectOutAppService) : base(repository)
{
_transferNoteManager = transferNoteManager;
@@ -88,6 +94,10 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
_issueJobAppService = issueJobAppService;
_inventoryLabelAppService = inventoryLabelAppService;
_expectOutAppService = expectOutAppService;
+ _logger = logger;
+ _agvOptions = agvOptions;
+ _postionLocationAppService = postionLocationAppService;
+ _itemBasicAppService = itemBasicAppService;
}
#region 东阳使用
@@ -666,124 +676,243 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
#if DEBUG
#endif
var errors = new List();
- var first = request.Data.FirstOrDefault();
- var job = await _repository.GetAsync(p => p.Number == first.OrderNum).ConfigureAwait(false);
+ //var first = request.Data.FirstOrDefault();
+ //var job = await _repository.GetAsync(p => p.Number == first.OrderNum).ConfigureAwait(false);
var ret = new AgvResultObject
{
Code = "0",
Message = "OK",
- ReqCode = job.RequestNumber,
+ ReqCode = "",
};
// using var unitOfWork = _unitOfWorkManager.Begin();
try
{
if (request.Data.Count > 0)
{
- var jobs = request.Data;
- var numbers = jobs.Select(p => p.OrderNum);
- var query = _repository.WithDetails()
- .Where(p => numbers.Contains(p.Number) );
- var entities = query.ToList();
- if (entities.Count == 0)
- {
- errors.Add($"任务号{string.Join(",", numbers)}不存在!");
- }
- var dtos = ObjectMapper.Map, List>(entities);
-
- foreach (var itm in dtos)
+ var notes = request.Data;
+ var numbers = notes.Select(p => p.OrderNum);
+ foreach (var number in numbers)
{
- var arys = jobs.Where(p => p.OrderNum == itm.Number);
- var itmDetails = itm.Details.ToList();
- var details = new List();
- foreach (var detail in arys)
+ var details= notes.Where(p => p.OrderNum == number).ToList();
+ TransferNoteEditInput transfer= new TransferNoteEditInput();
+ transfer.CallJobNumber = number;
+ transfer.Type= EnumTransSubType.Agv_Transfer_WIP.ToString();
+ transfer.Worker = "Agv";
+ transfer.UseOnTheWayLocation = false;
+
+ foreach (var detail in details)
{
- 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 entity = itmDetails.FirstOrDefault(p => p.ItemCode == detail.MatCode);
- if (entity == null)
+
+ List transferNoteDetailInputs = new List();
+
+ 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}不在任务明细内!");
+
+ errors.Add($"零件号{detail.MatCode}的零件不存在!");
}
- if (errors.Count > 0)
+ else
{
- return ret = new AgvResultObject()
- {
- Code = "-1",
- ReqCode = "",
- Message = string.Join(",", errors.ToArray())
- };
+ detailInput.ItemCode = item.Code;
+ detailInput.Uom = item.BasicUom;
+ detailInput.ItemName = item.Name;
}
- var dto = new TransferNoteDetailDTO();
- dto.InjectFrom(entity);
- dto.ToLocationCode = toloc.Code;
- dto.ToLocationGroup = tolocation.LocationGroupCode;
- dto.ToLocationArea = tolocation.AreaCode;
- dto.ToLocationErpCode = tolocation.ErpLocationCode;
-
- dto.ToWarehouseCode = tolocation.WarehouseCode;
- dto.Qty = detail.MatQty;
- dto.ToLot = !string.IsNullOrEmpty(detail.BatchAttr07) ? detail.BatchAttr07 : string.Empty;
- dto.ToPackingCode = string.Empty;
-
- dto.FromWarehouseCode = fromlocation.WarehouseCode;
- dto.FromLocationCode = fromlocation.Code;
- dto.FromLocationGroup = fromlocation.LocationGroupCode;
- dto.FromLocationArea = fromlocation.AreaCode;
- dto.FromLocationErpCode = fromlocation.ErpLocationCode;
- dto.Qty = detail.MatQty;
- dto.FromLot = string.Empty;
- dto.FromPackingCode = string.Empty;
- details.Add(dto);
+ 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.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.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);
+ }
- //await ExecuteDetailExtAsync(itm.Id, entity.Id, dto).ConfigureAwait(false);
- }
- if (errors.Count > 0)
- {
- ret = new AgvResultObject()
- {
- Code = "-1",
- ReqCode = "",
- Message = string.Join(",", errors.ToArray())
- };
- }
- itm.Worker = "AGV";
- itm.Details = details;
-
- _logger.LogInformation($"{flag}接收Agv确认单据内容:" + json + "Agv任务完成");
- }
+ //var query = _repository.WithDetails()
+ // .Where(p => numbers.Contains(p.Number));
+
+
+ //var query = _repository.WithDetails()
+ // .Where(p => numbers.Contains(p.Number) );
+ //var entities = query.ToList();
+ //if (entities.Count == 0)
+ //{
+ // errors.Add($"任务号{string.Join(",", numbers)}不存在!");
+ //}
+ //var dtos = ObjectMapper.Map, List>(entities);
+
+
+
+ //List notelist = new List();
+
+
+ //foreach (var itm in dtos)
+ //{
+ // var note = ObjectMapper.Map(itm);
+
+
+
+
+
+ // itm.Type = EnumTransSubType.Agv_Transfer_WIP.ToString();
+ // var arys = jobs.Where(p => p.OrderNum == itm.Number);
+ // var itmDetails = itm.Details.ToList();
+ // var details = new List();
+ // foreach (var detail in arys)
+ // {
+ // 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 entity = itmDetails.FirstOrDefault(p => p.ItemCode == detail.MatCode);
+ // if (entity == null)
+ // {
+ // errors.Add($"物料号{detail.MatCode}不在任务明细内!");
+ // }
+ // if (errors.Count > 0)
+ // {
+ // return ret = new AgvResultObject()
+ // {
+ // Code = "-1",
+ // ReqCode = "",
+ // Message = string.Join(",", errors.ToArray())
+ // };
+ // }
+ // var dto = new TransferNoteDetailDTO();
+ // dto.InjectFrom(entity);
+ // dto.ToLocationCode = toloc.Code;
+ // dto.ToLocationGroup = tolocation.LocationGroupCode;
+ // dto.ToLocationArea = tolocation.AreaCode;
+ // dto.ToLocationErpCode = tolocation.ErpLocationCode;
+
+ // dto.ToWarehouseCode = tolocation.WarehouseCode;
+ // dto.Qty = detail.MatQty;
+ // dto.ToLot = !string.IsNullOrEmpty(detail.BatchAttr07) ? detail.BatchAttr07 : string.Empty;
+ // dto.ToPackingCode = string.Empty;
+
+ // dto.FromWarehouseCode = fromlocation.WarehouseCode;
+ // dto.FromLocationCode = fromlocation.Code;
+ // dto.FromLocationGroup = fromlocation.LocationGroupCode;
+ // dto.FromLocationArea = fromlocation.AreaCode;
+ // dto.FromLocationErpCode = fromlocation.ErpLocationCode;
+ // dto.Qty = detail.MatQty;
+ // dto.FromLot = string.Empty;
+ // dto.FromPackingCode = string.Empty;
+ // details.Add(dto);
+
+ // //var details=
+
+
+ // //note.Details.Add()
+
+
+
+ // //await ExecuteDetailExtAsync(itm.Id, entity.Id, dto).ConfigureAwait(false);
+ // }
+
+
+
+
+ // if (errors.Count > 0)
+ // {
+ // ret = new AgvResultObject()
+ // {
+ // Code = "-1",
+ // ReqCode = "",
+ // Message = string.Join(",", errors.ToArray())
+ // };
+ // }
+ // itm.Worker = "AGV";
+ // itm.Details = details;
+
+ // _logger.LogInformation($"{flag}接收Agv确认单据内容:" + json + "Agv任务完成");
}
+
else
{
errors.Add("Agv确认单据里无数据! \n");
@@ -791,11 +920,13 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
}
catch (Exception ex)
{
+
+
ret = new AgvResultObject
{
Code = "-1",
- ReqCode = job.RequestNumber,
- Message = ex.Message,
+ ReqCode ="",
+ Message = ex.Message
};
//await unitOfWork.RollbackAsync();
return ret;
@@ -807,7 +938,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
{
Code = "-1",
Message = string.Join(",", errors.ToArray()),
- ReqCode = job.RequestNumber
+ ReqCode = ""
};
}
return ret;
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/TransferNotes/TransferNote.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/TransferNotes/TransferNote.cs
index b1cc3d1ce..ed762394c 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/TransferNotes/TransferNote.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/TransferNotes/TransferNote.cs
@@ -33,6 +33,7 @@ public class TransferNote : SfsStoreAggregateRootBase, IHasJ
///
/// 使用中间库
+ ///
///
[Display(Name = "使用中间库")]
public bool UseOnTheWayLocation { get; set; }