Browse Source

修改 预计出

dev_DY_CC
郑勃旭 12 months ago
parent
commit
7bf9e9da8a
  1. 1
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/ExpectOuts/IExpectOutAppService.cs
  2. 28
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAppService.cs
  3. 15
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/KittingIssueJobs/IKittingIssueJobAppService.cs
  4. 122
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs
  5. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs
  6. 8
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/KittingIssueJobEventHandler.cs
  7. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/TransferLibJobEventHandler.cs
  8. 84
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/TransferLibNoteEventHandler.cs

1
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/ExpectOuts/IExpectOutAppService.cs

@ -47,4 +47,5 @@ public interface IExpectOutAppService
decimal qty);
Task RemoveByNumberAsync(string number);
Task<ExpectOutDTO> UpdateLocationByPackingCodeAsync(string packingCode,string locationCode);
}

28
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAppService.cs

@ -5,7 +5,9 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.ObjectMapping;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Basedata.Domain.Shared;
using Win_in.Sfs.Basedata.SplitPackings.Commons;
using Win_in.Sfs.Shared.Application.Contracts;
@ -27,14 +29,15 @@ public class ExpectOutAppService
, IExpectOutAppService
{
private readonly IExpectOutManager _expectOutManager;
private readonly ILocationAppService _locationAppService;
public ExpectOutAppService(
IExpectOutRepository repository,
IExpectOutManager expectOutManager
) : base(repository)
IExpectOutManager expectOutManager, ILocationAppService locationAppService) : base(repository)
{
_expectOutManager = expectOutManager;
_locationAppService = locationAppService;
}
[HttpPost("remove")]
@ -274,4 +277,25 @@ public class ExpectOutAppService
{
return await _repository.GetListAsync(p => p.JobNumber == input.Number && p.PackingCode == input.FromPackingCode && p.Qty == input.FromQty && p.LocationCode == input.FromLocationCode).ConfigureAwait(false);
}
[HttpPost("Update-Location-By-PackingCode")]
public virtual async Task<ExpectOutDTO> UpdateLocationByPackingCodeAsync(string packingCode,string locationCode)
{
var expectOut=await _repository.FindAsync(p=>p.PackingCode== packingCode).ConfigureAwait(false);
if (expectOut != null)
{
var locationDto=await _locationAppService.GetByCodeAsync(locationCode).ConfigureAwait(false);
expectOut.LocationCode = locationDto.Code;
expectOut.LocationArea = locationDto.AreaCode;
expectOut.LocationErpCode = locationDto.ErpLocationCode;
expectOut.WarehouseCode = locationDto.WarehouseCode;
expectOut.LocationGroup = locationDto.LocationGroupCode;
await _repository.UpdateAsync(expectOut).ConfigureAwait(false);
}
return ObjectMapper.Map<ExpectOut, ExpectOutDTO>(expectOut);
}
}

15
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/KittingIssueJobs/IKittingIssueJobAppService.cs

@ -1,28 +1,25 @@
using System;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public interface IKittingIssueJobAppService
: ISfsJobAppServiceBase<KittingIssueJobDTO, SfsJobRequestInputBase, KittingIssueJobCheckInput, KittingIssueJobEditInput>
: ISfsJobAppServiceBase<KittingIssueJobDTO, SfsJobRequestInputBase, KittingIssueJobCheckInput,
KittingIssueJobEditInput>
{
Task CancelByMaterialRequestAsync(string requestNumber);
Task<List<KittingIssueJobDTO>> GetByRequestNumberAsync(string requestNumber);
/// <summary>
/// 执行任务明细
/// 执行任务明细
/// </summary>
/// <returns></returns>
Task ExecuteDetailAsync(Guid masterId,Guid detailId, KittingIssueJobDetailDTO issueJobDetailDto);
Task ExecuteDetailAsync(Guid masterId, Guid detailId, KittingIssueJobDetailDTO issueJobDetailDto);
Task CompleteAsync(Guid id);
/// <summary>
/// 请求点了完成,任务全部都完成
/// 请求点了完成,任务全部都完成
/// </summary>
/// <param name="requestNumber"></param>
/// <returns></returns>

122
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs

@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using Castle.Components.DictionaryAdapter;
using Microsoft.AspNetCore.Authorization;
@ -10,7 +12,6 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using MyNamespace;
using Volo.Abp;
using Volo.Abp.ObjectMapping;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Domain.Shared.Enums.Store;
@ -18,12 +19,9 @@ 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;
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 IdentityModel.ClaimComparer;
using static Volo.Abp.Identity.Settings.IdentitySettingNames;
namespace Win_in.Sfs.Wms.Store.Application;
@ -71,12 +69,12 @@ public class KittingIssueJobAppService
await CheckDimensionalStorehouseAsync(input).ConfigureAwait(false);
}
var kittingIssueJobDtos=await base.CreateManyAsync(inputs).ConfigureAwait(false);
var kittingIssueJobDtos = await base.CreateManyAsync(inputs).ConfigureAwait(false);
foreach (var kittingIssueJobDto in kittingIssueJobDtos)
{
await CheckDimensionalStorehouseAsync(kittingIssueJobDto).ConfigureAwait(false);
}
return kittingIssueJobDtos;
}
@ -86,7 +84,7 @@ public class KittingIssueJobAppService
await CheckMinRowAndSetStatusAsync(input).ConfigureAwait(false);
await CheckDimensionalStorehouseAsync(input).ConfigureAwait(false);
var kittingIssueJobDto=await base.CreateAsync(input).ConfigureAwait(false);
var kittingIssueJobDto = await base.CreateAsync(input).ConfigureAwait(false);
await CheckDimensionalStorehouseAsync(kittingIssueJobDto).ConfigureAwait(false);
return kittingIssueJobDto;
@ -111,7 +109,8 @@ public class KittingIssueJobAppService
}
await _expectOutAppService.RemoveByNumberAsync(kittingJob.Number).ConfigureAwait(false);
await _transferLibRequestAppService.CancelByCallRequestNumberAsync(kittingJob.KittingRequestNumber).ConfigureAwait(false);
await _transferLibRequestAppService.CancelByCallRequestNumberAsync(kittingJob.KittingRequestNumber)
.ConfigureAwait(false);
kittingJob.JobStatus = EnumJobStatus.Cancelled;
await _repository.UpdateAsync(kittingJob).ConfigureAwait(false);
@ -192,29 +191,33 @@ public class KittingIssueJobAppService
var kittingIssueNoteEditInput = await BuildKittingIssueNoteAsync(kittingIssueJobDto).ConfigureAwait(false);
await _kittingIssueNoteAppService.CreateAsync(kittingIssueNoteEditInput).ConfigureAwait(false);
var issueJobDetail=ObjectMapper.Map<KittingIssueJobDetailDTO, KittingIssueJobDetail>(issueJobDetailDto);
var entityDetail=kittingIssueJob.Details.Find(p => p.Id == detailId);
var issueJobDetail = ObjectMapper.Map<KittingIssueJobDetailDTO, KittingIssueJobDetail>(issueJobDetailDto);
var entityDetail = kittingIssueJob.Details.Find(p => p.Id == detailId);
issueJobDetail.HandledFromQty = entityDetail.HandledFromQty;
issueJobDetail.HandledToQty = entityDetail.HandledToQty;
issueJobDetail.HandledToQty += issueJobDetailDto.HandledToQty;
issueJobDetail.HandledFromQty += issueJobDetailDto.HandledFromQty;
kittingIssueJob.Details = new EditableList<KittingIssueJobDetail>() { issueJobDetail };
kittingIssueJob.Details = new EditableList<KittingIssueJobDetail> { issueJobDetail };
if (kittingIssueJob.EnumIssueSendType == EnumIssueSendType.BoxQtyType) //按箱叫料 因为任务只有1箱 所以可以直接完成
{
await UpdateRequestAndjobStatusDoneAsync(kittingIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty).ConfigureAwait(false);
await UpdateRequestAndjobStatusDoneAsync(kittingIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty)
.ConfigureAwait(false);
await _expectOutAppService.RemoveByNumberAsync(kittingIssueJob.Number).ConfigureAwait(false);
}
else
{
var detail = kittingIssueJob.Details.First(p => p.Id == issueJobDetailDto.Id);
if (issueJobDetail.HandledToQty >= detail.RequestQty)
{
await UpdateRequestAndjobStatusDoneAsync(kittingIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty).ConfigureAwait(false);
await UpdateRequestAndjobStatusDoneAsync(kittingIssueJob, issueJobDetailDto,
issueJobDetailDto.HandledToQty).ConfigureAwait(false);
}
else
{
await RemoveExpectOutAsync(kittingIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty).ConfigureAwait(false);
await RemoveExpectOutAsync(kittingIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty)
.ConfigureAwait(false);
}
}
@ -222,7 +225,7 @@ public class KittingIssueJobAppService
}
/// <summary>
/// 完成任务
/// 完成任务
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
@ -235,57 +238,60 @@ public class KittingIssueJobAppService
await _expectOutAppService.RemoveByNumberAsync(kittingIssueJob.Number).ConfigureAwait(false);
await KittingIssueRequestAppService.UpdateStatusCompletedAsync(kittingIssueJob.KittingRequestNumber).ConfigureAwait(false);
await _transferLibRequestAppService.CancelByCallRequestNumberAsync(kittingIssueJob.KittingRequestNumber).ConfigureAwait(false);
await KittingIssueRequestAppService.UpdateStatusCompletedAsync(kittingIssueJob.KittingRequestNumber)
.ConfigureAwait(false);
await _transferLibRequestAppService.CancelByCallRequestNumberAsync(kittingIssueJob.KittingRequestNumber)
.ConfigureAwait(false);
await _repository.UpdateAsync(kittingIssueJob).ConfigureAwait(false);
}
/// <summary>
/// 请求点了完成,任务全部都完成
/// 请求点了完成,任务全部都完成
/// </summary>
/// <param name="requestNumber"></param>
/// <returns></returns>
[HttpPost("complete-by-request/{requestNumber}")]
public async Task CompleteByRequestNumberAsync(string requestNumber)
{
var kittingIssueJobs = await _repository.GetListAsync(p=>p.KittingRequestNumber==requestNumber).ConfigureAwait(false);
var kittingIssueJobs = await _repository.GetListAsync(p => p.KittingRequestNumber == requestNumber)
.ConfigureAwait(false);
foreach (var kittingIssueJob in kittingIssueJobs)
{
kittingIssueJob.JobStatus = EnumJobStatus.Done;
await _repository.UpdateAsync(kittingIssueJob).ConfigureAwait(false);
await _expectOutAppService.RemoveByNumberAsync(kittingIssueJob.Number).ConfigureAwait(false);
await _transferLibRequestAppService.CancelByCallRequestNumberAsync(kittingIssueJob.KittingRequestNumber).ConfigureAwait(false);
await _transferLibRequestAppService.CancelByCallRequestNumberAsync(kittingIssueJob.KittingRequestNumber)
.ConfigureAwait(false);
}
}
#region 立库
/// <summary>
/// 立体库同步
/// 立体库同步
/// </summary>
/// <param name="input"></param>
/// <param name="p_loc"></param>
/// <returns></returns>
[HttpPost("sync-issue-job-stereo")]
public async Task<ReusltObject> SyncIssueJobStereoAsync(List<KittingIssueJobDTO> input, string p_loc)
{
ReusltObject ret = new ReusltObject();
var ret = new ReusltObject();
ret.Code = "1";
ret.Message = "操作成功";
ret.OperateTime = DateTime.Now.ToString("yyyy-MM-dd");
try
{
List<IssueJobToRestoDetailDTO> IssueJobToRestoDetailDTOs = new List<IssueJobToRestoDetailDTO>();
IssueJobToRestoDTO main = new IssueJobToRestoDTO();
var IssueJobToRestoDetailDTOs = new List<IssueJobToRestoDetailDTO>();
var main = new IssueJobToRestoDTO();
main.OperatorName = CurrentUser.UserName;
foreach (var job in input)
{
foreach (var jobitem in job.Details)
{
IssueJobToRestoDetailDTOs.Add(new IssueJobToRestoDetailDTO()
IssueJobToRestoDetailDTOs.Add(new IssueJobToRestoDetailDTO
{
Count = jobitem.HandledToQty,
ProductNo = jobitem.ItemCode,
@ -295,15 +301,16 @@ public class KittingIssueJobAppService
});
}
}
main.Details = IssueJobToRestoDetailDTOs;
var httpclient = _httpClientFactory.CreateClient();
#if DEBUG
string json = System.Text.Json.JsonSerializer.Serialize(main);
_options.Value.Address = "http://localhost:59094/";//测试地址
_options.Value.Token = "";//测试token
_options.Value.UserName = "";//测试用户名
_options.Value.Password = "";//测试密码
var json = JsonSerializer.Serialize(main);
_options.Value.Address = "http://localhost:59094/"; //测试地址
_options.Value.Token = ""; //测试token
_options.Value.UserName = ""; //测试用户名
_options.Value.Password = ""; //测试密码
#endif
if (!string.IsNullOrEmpty(_options.Value.Token))
@ -311,14 +318,16 @@ public class KittingIssueJobAppService
var token = _options.Value.Token;
httpclient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
}
if (!string.IsNullOrEmpty(_options.Value.UserName) && !string.IsNullOrEmpty(_options.Value.Password))
{
var username = _options.Value.UserName;
var password = _options.Value.Password;
httpclient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes($"{username}:{password}")));
httpclient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic",
Convert.ToBase64String(Encoding.ASCII.GetBytes($"{username}:{password}")));
}
IssueJobToRestoClient client = new IssueJobToRestoClient(_options.Value.Address, httpclient);
var client = new IssueJobToRestoClient(_options.Value.Address, httpclient);
ret = await client.SyncIssueJobStereoAsync(main).ConfigureAwait(false);
}
catch (Exception ex)
@ -330,47 +339,40 @@ public class KittingIssueJobAppService
}
return ret;
}
[HttpPost("receive-issue-job-stereo")]
public virtual async Task<ReusltObject> SyncReciveIssueJobStereoAsync(IssueRequestFromRestoDTO input)
{
#if DEBUG
var json = System.Text.Json.JsonSerializer.Serialize(input);
var json = JsonSerializer.Serialize(input);
#endif
List<string> errors = new List<string>();
var ret = new ReusltObject()
{
Code = "1",
OperateTime = DateTime.Now.ToString("yyyy-MM-dd"),
Message = "操作成功"
};
var errors = new List<string>();
var ret = new ReusltObject { Code = "1", OperateTime = DateTime.Now.ToString("yyyy-MM-dd"), Message = "操作成功" };
try
{
if (input.Jobs.Count > 0)
{
var jobs = input.Jobs;
var numbers = jobs.Select(p => p.JobNumber);
var query = _repository.WithDetails()
.Where(p => numbers.Contains(p.Number));
.Where(p => numbers.Contains(p.Number));
var entities = query.ToList();
var dtos = ObjectMapper.Map<List<KittingIssueJob>, List<KittingIssueJobDTO>>(entities);
if (input.Jobs.Count == entities.Count)
{
errors.Add("立体库提交出库任务和WMS任务不符,请核对! \n");
}
foreach (var itm in dtos)
{
var first = jobs.FirstOrDefault<IssueJobFromRestoDTO>(p => p.JobNumber == itm.Number);
var first = jobs.FirstOrDefault(p => p.JobNumber == itm.Number);
var itmDetails = itm.Details.ToList();
List<KittingIssueJobDetailDTO> details = new List<KittingIssueJobDetailDTO>();
var details = new List<KittingIssueJobDetailDTO>();
foreach (var detail in first.Details)
{
var entity = itmDetails.FirstOrDefault(p => p.ItemCode == detail.ItemCode);
KittingIssueJobDetailDTO dto = new KittingIssueJobDetailDTO();
var dto = new KittingIssueJobDetailDTO();
dto.HandledFromLocationCode = entity.HandledFromLocationCode;
dto.HandledToLocationCode = entity.HandledToLocationCode;
dto.ItemCode = detail.ItemCode;
@ -381,6 +383,7 @@ public class KittingIssueJobAppService
dto.Status = entity.Status;
details.Add(dto);
}
itm.Details = details;
await CompleteAsync(itm.Id, itm).ConfigureAwait(false);
}
@ -392,24 +395,23 @@ public class KittingIssueJobAppService
}
catch (Exception ex)
{
ret = new ReusltObject()
ret = new ReusltObject
{
Code = "2",
OperateTime = DateTime.Now.ToString("yyyy-MM-dd"),
Message = ex.Message
Code = "2", OperateTime = DateTime.Now.ToString("yyyy-MM-dd"), Message = ex.Message
};
return ret;
}
if (errors.Count > 0)
{
ret = new ReusltObject()
ret = new ReusltObject
{
Code = "2",
OperateTime = DateTime.Now.ToString("yyyy-MM-dd"),
Message = string.Join(",", errors.ToArray())
};
}
return ret;
}
@ -514,18 +516,17 @@ public class KittingIssueJobAppService
if (loctionDto.Type == EnumLocationType.DimensionalStorehouse)
{
//TODO 立体库
var ret = await SyncIssueJobStereoAsync(new List<KittingIssueJobDTO> { kittingIssueJobDto }, loctionDto.Code).ConfigureAwait(false);
var ret = await SyncIssueJobStereoAsync(new List<KittingIssueJobDTO> { kittingIssueJobDto },
loctionDto.Code).ConfigureAwait(false);
if (ret.Code != "1")
{
throw new UserFriendlyException($"调用立体库不成功!原因:{ret.Message}");
}
}
}
/// <summary>
/// 修改当前任务状态 和 该任务的请求状态
/// 修改当前任务状态 和 该任务的请求状态
/// </summary>
/// <param name="kittingIssueJob"></param>
/// <param name="kittingIssueJobDetailDto"></param>
@ -533,7 +534,7 @@ public class KittingIssueJobAppService
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
private async Task UpdateRequestAndjobStatusDoneAsync(KittingIssueJob kittingIssueJob,
KittingIssueJobDetailDTO kittingIssueJobDetailDto,decimal handledToQty)
KittingIssueJobDetailDTO kittingIssueJobDetailDto, decimal handledToQty)
{
if (kittingIssueJob.JobStatus is EnumJobStatus.Closed or EnumJobStatus.Cancelled or EnumJobStatus.None
or EnumJobStatus.Done) //需要考虑下 多次提交的问题 所以不判断 进行中
@ -554,7 +555,8 @@ public class KittingIssueJobAppService
await Task.CompletedTask.ConfigureAwait(false);
}
private async Task RemoveExpectOutAsync(KittingIssueJob kittingIssueJob, KittingIssueJobDetailDTO kittingIssueJobDetailDto,
private async Task RemoveExpectOutAsync(KittingIssueJob kittingIssueJob,
KittingIssueJobDetailDTO kittingIssueJobDetailDto,
decimal handledToQty)
{
await _expectOutAppService.RemoveByNumberAndInventoryAsync(kittingIssueJob.Number,

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs

@ -31,7 +31,8 @@ public class TransferLibJobAppService
public TransferLibJobAppService(
ITransferLibJobRepository repository, ITransferLibJobManager TransferLibJobManager,
IServiceProvider serviceProvider, ILocationAppService locationAppService, IExpectOutAppService expectOutAppService) : base(repository,
IServiceProvider serviceProvider, ILocationAppService locationAppService,
IExpectOutAppService expectOutAppService) : base(repository,
TransferLibJobManager)
{
_serviceProvider = serviceProvider;

8
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/KittingIssueJobEventHandler.cs

@ -130,8 +130,8 @@ public class KittingIssueJobEventHandler :
var locationDto = await _locationAppService.GetByCodeAsync(detail.RecommendFromLocationCode)
.ConfigureAwait(false);
var locationList = await _locationAppService.GetListByGroupsAsync(
new List<string>{ detail.RecommendFromLocationGroup }).ConfigureAwait(false);
var locationListSort=locationList.OrderBy(p => p.RowCode);
new List<string> { detail.RecommendFromLocationGroup }).ConfigureAwait(false);
var locationListSort = locationList.OrderBy(p => p.RowCode);
var locationDtoRowOne = new LocationDTO();
if (locationListSort.Any())
@ -204,7 +204,7 @@ public class KittingIssueJobEventHandler :
detailInput.RecommendToLocationErpCode = locationDtoRowOne.ErpLocationCode;
detailInput.RecommendToWarehouseCode = locationDtoRowOne.WarehouseCode;
input.Details = new EditableList<TransferLibRequestDetailInput>() { detailInput };
input.Details = new EditableList<TransferLibRequestDetailInput> { detailInput };
await _transferLibRequestAppService.CreateAsync(input).ConfigureAwait(false);
}
@ -238,7 +238,7 @@ public class KittingIssueJobEventHandler :
var locationDto = await _locationAppService.GetByCodeAsync(detail.RecommendFromLocationCode)
.ConfigureAwait(false);
if (locationDto.Type==EnumLocationType.RAW&& locationDto.RowCode == 1)
if (locationDto.Type == EnumLocationType.RAW && locationDto.RowCode == 1)
{
return true;
}

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/TransferLibJobEventHandler.cs

@ -56,7 +56,6 @@ public class TransferLibJobEventHandler :
/// 创建补料记录实体
/// </summary>
/// <param name="entity"></param>
/// <param name="input"></param>
/// <returns></returns>
private TransferLibNoteEditInput BuildTransferLibNoteCreateInput(TransferLibJob entity)
{

84
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/TransferLibNoteEventHandler.cs

@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Castle.Components.DictionaryAdapter;
using Volo.Abp.EventBus;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event;
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.Event.Transaction;
@ -15,22 +15,25 @@ namespace Win_in.Sfs.Wms.Store.Event.Transactions;
public class TransferLibNoteEventHandler
: StoreInventoryEventHandlerBase
, ILocalEventHandler<SfsCreatedEntityEventData<TransferLibNote>>
, ILocalEventHandler<SfsConfirmedEntityEventData<TransferLibNote>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<TransferLibNote>>>
, ILocalEventHandler<SfsCreatedEntityEventData<TransferLibNote>>
, ILocalEventHandler<SfsConfirmedEntityEventData<TransferLibNote>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<TransferLibNote>>>
{
private const EnumTransType TransType = EnumTransType.TransferLib;
private readonly ILocationAppService _locationAppService;
private readonly ITransferLogAppService _transferLogAppService;
private readonly IExpectOutAppService _expectOutAppService;
public TransferLibNoteEventHandler(ILocationAppService locationAppService, ITransferLogAppService transferLogAppService)
public TransferLibNoteEventHandler(ILocationAppService locationAppService,
ITransferLogAppService transferLogAppService, IExpectOutAppService expectOutAppService)
{
_locationAppService = locationAppService;
_transferLogAppService = transferLogAppService;
_expectOutAppService = expectOutAppService;
}
/// <summary>
/// 创建 后
/// 创建 后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
@ -48,7 +51,7 @@ public class TransferLibNoteEventHandler
}
/// <summary>
/// 批量创建 后
/// 批量创建 后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
@ -67,7 +70,7 @@ public class TransferLibNoteEventHandler
}
/// <summary>
/// 确认 后
/// 确认 后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
@ -76,7 +79,8 @@ public class TransferLibNoteEventHandler
{
var entity = eventData.Entity;
var inputList = await BuildTransferLogsAsync(entity, EnumTransferRoute.OnTheWayToDestination).ConfigureAwait(false);
var inputList = await BuildTransferLogsAsync(entity, EnumTransferRoute.OnTheWayToDestination)
.ConfigureAwait(false);
await AddTransferLogsAsync(inputList).ConfigureAwait(false);
}
@ -87,11 +91,10 @@ public class TransferLibNoteEventHandler
transferLogs.AddRange(inputList);
await _transferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false);
}
/// <summary>
/// 构建正常的input
/// 构建正常的input
/// </summary>
/// <param name="note"></param>
/// <param name="route"></param>
@ -104,7 +107,7 @@ public class TransferLibNoteEventHandler
{
//var transferLog = ObjectMapper.Map<TransferLibNoteDetail, TransferLogEditInput>(detail);
//0416修改
TransferLogEditInput transferLog = new TransferLogEditInput();
var transferLog = new TransferLogEditInput();
//transferLog.TransferNumber = "";
transferLog.FromPackingCode = detail.HandledFromPackingCode;
transferLog.ToPackingCode = detail.HandledToPackingCode;
@ -147,9 +150,12 @@ public class TransferLibNoteEventHandler
transferLog.TenantId = detail.TenantId;
transferLog.Remark = detail.Remark;
var fromLocation = await _locationAppService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false);
var toLocation = await _locationAppService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false);
var transferOnTheWay = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT).ConfigureAwait(false);
var fromLocation = await _locationAppService.GetByCodeAsync(detail.HandledFromLocationCode)
.ConfigureAwait(false);
var toLocation = await _locationAppService.GetByCodeAsync(detail.HandledToLocationCode)
.ConfigureAwait(false);
var transferOnTheWay = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT)
.ConfigureAwait(false);
switch (route)
{
@ -185,7 +191,8 @@ public class TransferLibNoteEventHandler
transferLog.ToLocationArea = toLocation.AreaCode;
transferLog.ToLocationErpCode = toLocation.ErpLocationCode;
transferLog.ToLocationGroup = toLocation.LocationGroupCode;
break;;
break;
;
default:
throw new ArgumentOutOfRangeException(nameof(route), route, null);
}
@ -196,11 +203,54 @@ public class TransferLibNoteEventHandler
transferLog.DocNumber = note.Number;
transferLog.JobNumber = note.JobNumber;
if (detail.RecommendToPackingCode == detail.HandledToPackingCode) //相同把预计出的库位修改了
{
await _expectOutAppService.UpdateLocationByPackingCodeAsync(detail.HandledToPackingCode,
detail.HandledToLocationCode).ConfigureAwait(false);
}
else //不相同创建一个新的预计出
{
await CreateExpectOutAsync(detail).ConfigureAwait(false);
}
transferLogs.Add(transferLog);
}
return transferLogs;
}
}
/// <summary>
/// 创建预计出
/// </summary>
/// <param name="detail"></param>
/// <returns></returns>
private async Task CreateExpectOutAsync(TransferLibNoteDetail detail)
{
var inputoExpectOutEditInput = new ExpectOutEditInput();
inputoExpectOutEditInput.JobNumber = detail.CallRequestNumber;
inputoExpectOutEditInput.ItemCode = detail.ItemCode;
inputoExpectOutEditInput.Qty = detail.HandledFromQty;
inputoExpectOutEditInput.LocationCode = detail.HandledFromLocationCode;
inputoExpectOutEditInput.ArriveDate = detail.HandledFromArriveDate;
inputoExpectOutEditInput.ContainerCode = detail.HandledFromContainerCode;
inputoExpectOutEditInput.ExpireDate = detail.HandledFromExpireDate;
inputoExpectOutEditInput.ItemDesc1 = detail.ItemDesc1;
inputoExpectOutEditInput.ItemDesc2 = detail.ItemDesc2;
inputoExpectOutEditInput.ItemName = detail.ItemName;
inputoExpectOutEditInput.LocationArea = detail.HandledFromLocationArea;
inputoExpectOutEditInput.LocationGroup = detail.HandledFromLocationGroup;
inputoExpectOutEditInput.LocationErpCode = detail.HandledFromLocationErpCode;
inputoExpectOutEditInput.PackingCode = detail.HandledFromPackingCode;
inputoExpectOutEditInput.Lot = detail.HandledFromLot;
inputoExpectOutEditInput.ProduceDate = detail.HandledFromProduceDate;
inputoExpectOutEditInput.Status = detail.Status;
inputoExpectOutEditInput.Uom = detail.Uom;
inputoExpectOutEditInput.SupplierBatch = detail.HandledFromSupplierBatch;
inputoExpectOutEditInput.WarehouseCode = detail.HandledFromWarehouseCode;
await _expectOutAppService.AddManyAsync(new EditableList<ExpectOutEditInput> { inputoExpectOutEditInput })
.ConfigureAwait(false);
await Task.CompletedTask.ConfigureAwait(false);
}
}

Loading…
Cancel
Save