|
|
@ -14,8 +14,6 @@ using Microsoft.Extensions.Options; |
|
|
|
using MyNamespace; |
|
|
|
using Omu.ValueInjecter; |
|
|
|
using Volo.Abp; |
|
|
|
using Volo.Abp.ObjectMapping; |
|
|
|
using Volo.Abp.Timing; |
|
|
|
using Volo.Abp.Uow; |
|
|
|
using Volo.Abp.Users; |
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
@ -28,7 +26,6 @@ using Win_in.Sfs.Wms.Store.Domain.Shared; |
|
|
|
using Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy; |
|
|
|
using Win_in.Sfs.Wms.Store.Notes; |
|
|
|
using Win_in.Sfs.Wms.Store.Options; |
|
|
|
using static Volo.Abp.Identity.Settings.IdentitySettingNames; |
|
|
|
|
|
|
|
namespace Win_in.Sfs.Wms.Store.Application; |
|
|
|
|
|
|
@ -59,7 +56,8 @@ public class AssembleIssueJobAppService |
|
|
|
ILocationAppService locationAppService, |
|
|
|
IAssembleIssueNoteAppService assembleIssueNoteAppService, IExpectOutAppService expectOutAppService |
|
|
|
, IHttpClientFactory httpClientFactory |
|
|
|
, IOptions<RestoOptions> options, ITransferLibRequestAppService transferLibRequestAppService, ICurrentUser currentUser, UnitOfWorkManager unitOfWorkManager) : base( |
|
|
|
, IOptions<RestoOptions> options, ITransferLibRequestAppService transferLibRequestAppService, |
|
|
|
ICurrentUser currentUser, UnitOfWorkManager unitOfWorkManager) : base( |
|
|
|
repository, assembleIssueJobManager) |
|
|
|
{ |
|
|
|
_assembleIssueJobManager = assembleIssueJobManager; |
|
|
@ -93,35 +91,24 @@ public class AssembleIssueJobAppService |
|
|
|
if (dimensionalStorehouseflag) |
|
|
|
{ |
|
|
|
input.IsClaims = true; |
|
|
|
input.ClaimsUserId = string.IsNullOrEmpty(_options.Value.StereosUser) ? "LYF" : _options.Value.StereosUser; |
|
|
|
input.ClaimsUserName = string.IsNullOrEmpty(_options.Value.StereosPassword) ? "LYF" : _options.Value.StereosPassword; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
input.ClaimsUserId = string.IsNullOrEmpty(_options.Value.StereosUser) |
|
|
|
? "LYF" |
|
|
|
: _options.Value.StereosUser; |
|
|
|
input.ClaimsUserName = string.IsNullOrEmpty(_options.Value.StereosPassword) |
|
|
|
? "LYF" |
|
|
|
: _options.Value.StereosPassword; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var assembleIssueJobDtos = await base.CreateManyAsync(inputs).ConfigureAwait(false); |
|
|
|
foreach (var assembleIssueJobDto in assembleIssueJobDtos) |
|
|
|
{ |
|
|
|
await CheckDimensionalStorehouseAsync(assembleIssueJobDto).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
return assembleIssueJobDtos; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPost("")] |
|
|
|
public override async Task<AssembleIssueJobDTO> CreateAsync(AssembleIssueJobEditInput input) |
|
|
|
{ |
|
|
@ -168,7 +155,7 @@ public class AssembleIssueJobAppService |
|
|
|
[HttpPost("by-request-number/{requestNumber}")] |
|
|
|
public virtual async Task<List<AssembleIssueJobDTO>> GetByRequestNumberAsync(string requestNumber) |
|
|
|
{ |
|
|
|
var entitys = await _repository.GetListAsync(p => p.AssembleRequestNumber == requestNumber,"",true) |
|
|
|
var entitys = await _repository.GetListAsync(p => p.AssembleRequestNumber == requestNumber, "", true) |
|
|
|
.ConfigureAwait(false); |
|
|
|
return ObjectMapper.Map<List<AssembleIssueJob>, List<AssembleIssueJobDTO>>(entitys); |
|
|
|
} |
|
|
@ -270,7 +257,8 @@ public class AssembleIssueJobAppService |
|
|
|
.ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
await UpdateRequestAndjobStatusDoneAsync(assembleIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty) |
|
|
|
await UpdateRequestAndjobStatusDoneAsync(assembleIssueJob, issueJobDetailDto, |
|
|
|
issueJobDetailDto.HandledToQty) |
|
|
|
.ConfigureAwait(false); |
|
|
|
await _expectOutAppService.RemoveByNumberAsync(assembleIssueJob.Number).ConfigureAwait(false); |
|
|
|
} |
|
|
@ -294,7 +282,6 @@ public class AssembleIssueJobAppService |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 执行任务明细
|
|
|
|
/// </summary>
|
|
|
@ -305,8 +292,11 @@ public class AssembleIssueJobAppService |
|
|
|
var assembleIssueJob = await _repository.GetAsync(masterId).ConfigureAwait(false); |
|
|
|
assembleIssueJob.JobStatus = EnumJobStatus.Doing; |
|
|
|
|
|
|
|
assembleIssueJob.ClaimsUserId = string.IsNullOrEmpty( _options.Value.StereosUser)? "LYF" : _options.Value.StereosUser; |
|
|
|
assembleIssueJob.ClaimsUserName = string.IsNullOrEmpty(_options.Value.StereosPassword) ? "LYF" : _options.Value.StereosPassword; |
|
|
|
assembleIssueJob.ClaimsUserId = |
|
|
|
string.IsNullOrEmpty(_options.Value.StereosUser) ? "LYF" : _options.Value.StereosUser; |
|
|
|
assembleIssueJob.ClaimsUserName = string.IsNullOrEmpty(_options.Value.StereosPassword) |
|
|
|
? "LYF" |
|
|
|
: _options.Value.StereosPassword; |
|
|
|
|
|
|
|
|
|
|
|
//if (assembleIssueJob.IsClaims)
|
|
|
@ -332,7 +322,6 @@ public class AssembleIssueJobAppService |
|
|
|
issueJobDetail.HandledToQty = entityDetail.HandledToQty; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
issueJobDetail.HandledToQty += issueJobDetailDto.HandledToQty; |
|
|
|
issueJobDetail.HandledFromQty += issueJobDetailDto.HandledFromQty; |
|
|
|
assembleIssueJob.Details = new EditableList<AssembleIssueJobDetail> { issueJobDetail }; |
|
|
@ -347,7 +336,8 @@ public class AssembleIssueJobAppService |
|
|
|
.ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
await UpdateRequestAndjobStatusDoneAsync(assembleIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty) |
|
|
|
await UpdateRequestAndjobStatusDoneAsync(assembleIssueJob, issueJobDetailDto, |
|
|
|
issueJobDetailDto.HandledToQty) |
|
|
|
.ConfigureAwait(false); |
|
|
|
await _expectOutAppService.RemoveByNumberAsync(assembleIssueJob.Number).ConfigureAwait(false); |
|
|
|
} |
|
|
@ -371,13 +361,6 @@ public class AssembleIssueJobAppService |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 完成任务
|
|
|
|
/// </summary>
|
|
|
@ -426,7 +409,7 @@ public class AssembleIssueJobAppService |
|
|
|
public override async Task AcceptAsync(Guid id) |
|
|
|
{ |
|
|
|
var entity = await _repository.FindAsync(id).ConfigureAwait(false); |
|
|
|
entity.IsClaims=true; |
|
|
|
entity.IsClaims = true; |
|
|
|
entity.ClaimsUserName = _currentUser.UserName; |
|
|
|
entity.ClaimsUserId = _currentUser.Id.ToString(); |
|
|
|
entity.AcceptTime = Clock.Now; |
|
|
@ -434,7 +417,7 @@ public class AssembleIssueJobAppService |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 取消承接任务
|
|
|
|
/// 取消承接任务
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="id"></param>
|
|
|
|
/// <returns></returns>
|
|
|
@ -450,16 +433,28 @@ public class AssembleIssueJobAppService |
|
|
|
await _repository.UpdateAsync(entity).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("get-job-by-packing/{packingCode}")] |
|
|
|
public virtual async Task<AssembleIssueJobDTO> GetJobByPackingCodeAsync(string packingCode) |
|
|
|
{ |
|
|
|
var list=await _repository.GetListAsync(p => p.Details.Any(r => r.RecommendFromPackingCode==packingCode)).ConfigureAwait(false); |
|
|
|
if (list == null || list.Count < 1) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("未找到该箱码的任务"); |
|
|
|
} |
|
|
|
var dto=ObjectMapper.Map<AssembleIssueJob, AssembleIssueJobDTO>(list.First()); |
|
|
|
return dto; |
|
|
|
} |
|
|
|
|
|
|
|
#region 立库
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 立体库同步
|
|
|
|
/// 立体库同步
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <param name="pLoc"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("sync-issue-job-stereo")] |
|
|
|
public async Task<ReusltObject> SyncIssueJobStereoAsync(List<AssembleIssueJobDTO> input, string pLoc,Guid uid) |
|
|
|
public async Task<ReusltObject> SyncIssueJobStereoAsync(List<AssembleIssueJobDTO> input, string pLoc, Guid uid) |
|
|
|
{ |
|
|
|
var ret = new ReusltObject(); |
|
|
|
ret.Code = 0; |
|
|
@ -471,7 +466,7 @@ public class AssembleIssueJobAppService |
|
|
|
var IssueJobToRestoDetailDTOs = new List<IssueJobToRestoDetailDTO>(); |
|
|
|
var main = new IssueJobToRestoDTO(); |
|
|
|
main.Uuid = uid; |
|
|
|
main.OperatorName = string.IsNullOrEmpty(CurrentUser.UserName)? "admin": CurrentUser.UserName; |
|
|
|
main.OperatorName = string.IsNullOrEmpty(CurrentUser.UserName) ? "admin" : CurrentUser.UserName; |
|
|
|
foreach (var job in input) |
|
|
|
{ |
|
|
|
foreach (var jobitem in job.Details) |
|
|
@ -500,16 +495,23 @@ public class AssembleIssueJobAppService |
|
|
|
#endif
|
|
|
|
|
|
|
|
//var json = JsonSerializer.Serialize(main);
|
|
|
|
_options.Value.Address =string.IsNullOrEmpty(_options.Value.Address)?"http://7e42682n64.goho.co:21171/": _options.Value.Address; //测试地址
|
|
|
|
_options.Value.Token = string.IsNullOrEmpty(_options.Value.Token)? string.Empty: _options.Value.Token; //测试token
|
|
|
|
_options.Value.UserName = string.IsNullOrEmpty(_options.Value.UserName) ? "": _options.Value.UserName; //测试用户名
|
|
|
|
_options.Value.Password = string.IsNullOrEmpty(_options.Value.Password) ? "": _options.Value.Password; //测试密码
|
|
|
|
_options.Value.Path = string.IsNullOrEmpty(_options.Value.Path) ? "zozocnApi/custom/receiveProductionPlan":_options.Value.Path; //测试密码
|
|
|
|
|
|
|
|
_logger.LogInformation(System.Text.Json.JsonSerializer.Serialize(_options)); |
|
|
|
_options.Value.Address = string.IsNullOrEmpty(_options.Value.Address) |
|
|
|
? "http://7e42682n64.goho.co:21171/" |
|
|
|
: _options.Value.Address; //测试地址
|
|
|
|
_options.Value.Token = |
|
|
|
string.IsNullOrEmpty(_options.Value.Token) ? string.Empty : _options.Value.Token; //测试token
|
|
|
|
_options.Value.UserName = |
|
|
|
string.IsNullOrEmpty(_options.Value.UserName) ? "" : _options.Value.UserName; //测试用户名
|
|
|
|
_options.Value.Password = |
|
|
|
string.IsNullOrEmpty(_options.Value.Password) ? "" : _options.Value.Password; //测试密码
|
|
|
|
_options.Value.Path = string.IsNullOrEmpty(_options.Value.Path) |
|
|
|
? "zozocnApi/custom/receiveProductionPlan" |
|
|
|
: _options.Value.Path; //测试密码
|
|
|
|
|
|
|
|
_logger.LogInformation(JsonSerializer.Serialize(_options)); |
|
|
|
|
|
|
|
var flag = DateTime.Now.ToString("yyyyMMddHHmmss"); |
|
|
|
_logger.LogInformation($"标志{flag}开始调用高通WMS:传递值{System.Text.Json.JsonSerializer.Serialize(main)}"); |
|
|
|
_logger.LogInformation($"标志{flag}开始调用高通WMS:传递值{JsonSerializer.Serialize(main)}"); |
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(_options.Value.Token)) |
|
|
@ -529,7 +531,7 @@ public class AssembleIssueJobAppService |
|
|
|
var client = new IssueJobToRestoClient(_options.Value.Address, httpclient, _options.Value.Path); |
|
|
|
ret = await client.SyncIssueJobStereoAsync(main).ConfigureAwait(false); |
|
|
|
|
|
|
|
_logger.LogInformation($"标志{flag}调用高通WMS:返回值{System.Text.Json.JsonSerializer.Serialize(ret)}"); |
|
|
|
_logger.LogInformation($"标志{flag}调用高通WMS:返回值{JsonSerializer.Serialize(ret)}"); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
@ -552,12 +554,15 @@ public class AssembleIssueJobAppService |
|
|
|
#if DEBUG
|
|
|
|
#endif
|
|
|
|
var errors = new List<string>(); |
|
|
|
var ret = new ReusltObject { Code = int.Parse(GaoTongResultStatus.Success), OperateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Message = "操作成功" }; |
|
|
|
var ret = new ReusltObject |
|
|
|
{ |
|
|
|
Code = int.Parse(GaoTongResultStatus.Success), |
|
|
|
OperateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
|
|
|
Message = "操作成功" |
|
|
|
}; |
|
|
|
using var unitOfWork = _unitOfWorkManager.Begin(); |
|
|
|
try |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
if (input.Jobs.Count > 0) |
|
|
|
{ |
|
|
|
var jobs = input.Jobs; |
|
|
@ -565,19 +570,19 @@ public class AssembleIssueJobAppService |
|
|
|
var query = _repository.WithDetails() |
|
|
|
.Where(p => numbers.Contains(p.Number) && p.JobStatus != EnumJobStatus.Done); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var entities = query.ToList(); |
|
|
|
if (entities.Count == 0) |
|
|
|
{ |
|
|
|
errors.Add($"任务号{string.Join(",", numbers)}不存在!"); |
|
|
|
} |
|
|
|
|
|
|
|
var dtos = ObjectMapper.Map<List<AssembleIssueJob>, List<AssembleIssueJobDTO>>(entities); |
|
|
|
if (input.Jobs.Count != entities.Count) |
|
|
|
{ |
|
|
|
errors.Add("立体库提交出库任务和WMS任务不符,请核对! \n"); |
|
|
|
} |
|
|
|
|
|
|
|
foreach (var itm in dtos) |
|
|
|
{ |
|
|
|
var first = jobs.FirstOrDefault(p => p.JobNumber == itm.Number); |
|
|
@ -585,27 +590,27 @@ public class AssembleIssueJobAppService |
|
|
|
var details = new List<AssembleIssueJobDetailDTO>(); |
|
|
|
foreach (var detail in first.Details) |
|
|
|
{ |
|
|
|
|
|
|
|
var fromloc=await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); |
|
|
|
var fromloc = await _locationAppService.GetByCodeAsync(detail.FromLocationCode) |
|
|
|
.ConfigureAwait(false); |
|
|
|
if (fromloc == null) |
|
|
|
{ |
|
|
|
errors.Add($"来源库位{detail.FromLocationCode}没查到"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var toloc = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); |
|
|
|
var toloc = await _locationAppService.GetByCodeAsync(detail.ToLocationCode) |
|
|
|
.ConfigureAwait(false); |
|
|
|
if (toloc == null) |
|
|
|
{ |
|
|
|
errors.Add($"目标库位{detail.ToLocationCode}没查到"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var entity = itmDetails.FirstOrDefault(p => p.ItemCode == detail.ItemCode); |
|
|
|
|
|
|
|
if (entity == null) |
|
|
|
{ |
|
|
|
errors.Add($"物料号{detail.ItemCode}不在任务明细内!"); |
|
|
|
errors.Add($"物料号{detail.ItemCode}不在任务明细内!"); |
|
|
|
} |
|
|
|
|
|
|
|
var dto = new AssembleIssueJobDetailDTO(); |
|
|
@ -633,7 +638,7 @@ public class AssembleIssueJobAppService |
|
|
|
dto.HandledToPackingCode = string.Empty; |
|
|
|
|
|
|
|
|
|
|
|
dto.HandledFromWarehouseCode=fromloc.WarehouseCode; |
|
|
|
dto.HandledFromWarehouseCode = fromloc.WarehouseCode; |
|
|
|
dto.HandledFromLocationCode = fromloc.Code; |
|
|
|
dto.HandledFromLocationGroup = fromloc.LocationGroupCode; |
|
|
|
dto.HandledFromLocationArea = fromloc.AreaCode; |
|
|
@ -643,10 +648,10 @@ public class AssembleIssueJobAppService |
|
|
|
dto.HandledFromPackingCode = string.Empty; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
details.Add(dto); |
|
|
|
await ExecuteDetailExtAsync(itm.Id, entity.Id, dto).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
if (errors.Count > 0) |
|
|
|
{ |
|
|
|
ret = new ReusltObject |
|
|
@ -657,9 +662,10 @@ public class AssembleIssueJobAppService |
|
|
|
Data = json |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
itm.Details = details; |
|
|
|
// await CompleteAsync(itm.Id, itm).ConfigureAwait(false);
|
|
|
|
_logger.LogInformation($"{flag}接收到立体库确认单据内容:" + json+"立体库任务完成"); |
|
|
|
// await CompleteAsync(itm.Id, itm).ConfigureAwait(false);
|
|
|
|
_logger.LogInformation($"{flag}接收到立体库确认单据内容:" + json + "立体库任务完成"); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
@ -671,8 +677,10 @@ public class AssembleIssueJobAppService |
|
|
|
{ |
|
|
|
ret = new ReusltObject |
|
|
|
{ |
|
|
|
Code = int.Parse(GaoTongResultStatus.Failure), OperateTime = DateTime.Now.ToString("yyyy-MM-dd"), Message = ex.Message |
|
|
|
, Data = json |
|
|
|
Code = int.Parse(GaoTongResultStatus.Failure), |
|
|
|
OperateTime = DateTime.Now.ToString("yyyy-MM-dd"), |
|
|
|
Message = ex.Message, |
|
|
|
Data = json |
|
|
|
}; |
|
|
|
await unitOfWork.RollbackAsync(); |
|
|
|
return ret; |
|
|
@ -686,7 +694,6 @@ public class AssembleIssueJobAppService |
|
|
|
OperateTime = DateTime.Now.ToString("yyyy-MM-dd"), |
|
|
|
Message = string.Join(",", errors.ToArray()), |
|
|
|
Data = json |
|
|
|
|
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
@ -766,10 +773,10 @@ public class AssembleIssueJobAppService |
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
|
|
|
|
//private async Task CheckDimensionalStorehouseAsync(AssembleIssueJobEditInput input)
|
|
|
|
//{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// var jobDetailInputdetail = input.Details.FirstOrDefault();
|
|
|
|
|
|
|
@ -798,10 +805,8 @@ public class AssembleIssueJobAppService |
|
|
|
input.JobStatus = EnumJobStatus.Wait; |
|
|
|
return true; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
@ -811,7 +816,6 @@ public class AssembleIssueJobAppService |
|
|
|
/// <returns></returns>
|
|
|
|
private async Task CheckDimensionalStorehouseAsync(AssembleIssueJobDTO assembleIssueJobDto) |
|
|
|
{ |
|
|
|
|
|
|
|
var jobDetailInputdetail = assembleIssueJobDto.Details.FirstOrDefault(); |
|
|
|
var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode) |
|
|
|
.ConfigureAwait(false); |
|
|
|