Browse Source

修改 业务库移

dev_DY_CC
郑勃旭 12 months ago
parent
commit
d011be343f
  1. 2
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobController.cs
  2. 1
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Locations/ILocationAppService.cs
  3. 10
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Locations/LocationAppService.cs
  4. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/IssueJobs/IIssueJobAppService.cs
  5. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/TransferLibJobs/ITransferLibJobAppService.cs
  6. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/TransferLibRequests/ITransferLibRequestAppService.cs
  7. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/IssueJobAppService.cs
  8. 7
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs
  9. 119
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs
  10. 77
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferLibRequests/TransferLibRequestAppService.cs
  11. 32
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/KittingIssueJobEventHandler.cs
  12. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/KittingIssueRequestEventHandler.cs

2
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobController.cs

@ -240,7 +240,7 @@ public class IssueJobController : AbpController
[HttpGet("check-job-exist")] [HttpGet("check-job-exist")]
public virtual async Task<List<IssueJobDTO>> CheckJobExistByItemCodeAndLocationCode(string itemCode, string locationCode) public virtual async Task<List<IssueJobDTO>> CheckJobExistByItemCodeAndLocationCode(string itemCode, string locationCode)
{ {
return await _issueJobAppService.CheckJobExistByItemCodeAndLocationCode(itemCode, locationCode).ConfigureAwait(false); return await _issueJobAppService.CheckJobExistByItemCodeAndLocationCodeAsync(itemCode, locationCode).ConfigureAwait(false);
} }
/// <summary> /// <summary>

1
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Locations/ILocationAppService.cs

@ -32,4 +32,5 @@ public interface ILocationAppService
Task<List<LocationDTO>> GetListByTypesAndErpCodeAsync(List<EnumLocationType> types, string erpCode); Task<List<LocationDTO>> GetListByTypesAndErpCodeAsync(List<EnumLocationType> types, string erpCode);
Task<List<LocationDTO>> GetListByTypesAndErpCodeAsync(List<EnumLocationType> types, string erpCode,string locCode); Task<List<LocationDTO>> GetListByTypesAndErpCodeAsync(List<EnumLocationType> types, string erpCode,string locCode);
Task<List<LocationDTO>> GetListByErpLocationCodes(List<string> ErpLocationCodes); Task<List<LocationDTO>> GetListByErpLocationCodes(List<string> ErpLocationCodes);
Task<LocationDTO> GetFirstRowOneAsync();
} }

10
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Locations/LocationAppService.cs

@ -1,12 +1,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Caching; using Volo.Abp.Caching;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Validation; using Volo.Abp.Validation;
using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Basedata.Domain; using Win_in.Sfs.Basedata.Domain;
@ -220,6 +222,14 @@ public class LocationAppService
return ObjectMapper.Map<List<Domain.Location>, List<LocationDTO>>(list); return ObjectMapper.Map<List<Domain.Location>, List<LocationDTO>>(list);
} }
[HttpGet("get-first-row-one")]
public virtual async Task<LocationDTO> GetFirstRowOneAsync()
{
var first = await _repository.GetListAsync(p => p.RowCode == 1).ConfigureAwait(false);
return ObjectMapper.Map<Location, LocationDTO>(first.FirstOrDefault());
}
protected override async Task ValidateImportModelAsync(LocationImportInput importInput, List<ValidationResult> validationRresult) protected override async Task ValidateImportModelAsync(LocationImportInput importInput, List<ValidationResult> validationRresult)
{ {
await base.ValidateImportModelAsync(importInput, validationRresult).ConfigureAwait(false); await base.ValidateImportModelAsync(importInput, validationRresult).ConfigureAwait(false);

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/IssueJobs/IIssueJobAppService.cs

@ -8,7 +8,7 @@ namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public interface IIssueJobAppService public interface IIssueJobAppService
: ISfsJobAppServiceBase<IssueJobDTO, SfsJobRequestInputBase, IssueJobCheckInput, IssueJobEditInput> : ISfsJobAppServiceBase<IssueJobDTO, SfsJobRequestInputBase, IssueJobCheckInput, IssueJobEditInput>
{ {
Task<List<IssueJobDTO>> CheckJobExistByItemCodeAndLocationCode(string itemCode, string locationCode); Task<List<IssueJobDTO>> CheckJobExistByItemCodeAndLocationCodeAsync(string itemCode, string locationCode);
Task CancelByMaterialRequestAsync(string materialNumber); Task CancelByMaterialRequestAsync(string materialNumber);

6
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/TransferLibJobs/ITransferLibJobAppService.cs

@ -1,7 +1,11 @@
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Win_in.Sfs.Wms.Store.Application.Contracts; namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public interface ITransferLibJobAppService public interface ITransferLibJobAppService
: ISfsJobAppServiceBase<TransferLibJobDTO, SfsJobRequestInputBase, TransferLibJobCheckInput, TransferLibJobEditInput> : ISfsJobAppServiceBase<TransferLibJobDTO, SfsJobRequestInputBase, TransferLibJobCheckInput, TransferLibJobEditInput>
{ {
Task<List<TransferLibJobDTO>> GetByRequestNumberAsync(string requestNumber);
Task CompleteByRequestAsync(string requestNumber);
} }

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/TransferLibRequests/ITransferLibRequestAppService.cs

@ -17,4 +17,5 @@ public interface ITransferLibRequestAppService
Task<PagedResultDto<TransferLibRequestDTO>> GetListForCustomAsync(SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false, Task<PagedResultDto<TransferLibRequestDTO>> GetListForCustomAsync(SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false,
CancellationToken cancellationToken = default); CancellationToken cancellationToken = default);
Task CompleteByJobAsync(string requestNumber);
} }

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/IssueJobAppService.cs

@ -43,7 +43,7 @@ public class IssueJobAppService
/// <exception cref="NotImplementedException"></exception> /// <exception cref="NotImplementedException"></exception>
[Authorize] [Authorize]
[HttpGet("check-job-exist")] [HttpGet("check-job-exist")]
public virtual async Task<List<IssueJobDTO>> CheckJobExistByItemCodeAndLocationCode(string itemCode, public virtual async Task<List<IssueJobDTO>> CheckJobExistByItemCodeAndLocationCodeAsync(string itemCode,
string locationCode) string locationCode)
{ {
var entities = await _repository.GetListAsync(c => var entities = await _repository.GetListAsync(c =>

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

@ -108,9 +108,10 @@ public class KittingIssueJobAppService
if (kittingJob.JobStatus == EnumJobStatus.Open || kittingJob.JobStatus == EnumJobStatus.Partial || if (kittingJob.JobStatus == EnumJobStatus.Open || kittingJob.JobStatus == EnumJobStatus.Partial ||
kittingJob.JobStatus == EnumJobStatus.Wait) kittingJob.JobStatus == EnumJobStatus.Wait)
{ {
throw new UserFriendlyException($"任务状态不是{kittingJob.JobStatus == EnumJobStatus.Open}、" + throw new UserFriendlyException($"任务状态不是" +
$"{kittingJob.JobStatus == EnumJobStatus.Partial}、" + $"{EnumJobStatus.Open.GetDisplayName()}、" +
$"{kittingJob.JobStatus == EnumJobStatus.Wait}"); $"{EnumJobStatus.Partial.GetDisplayName()}、" +
$"{EnumJobStatus.Wait.GetDisplayName()}");
} }
await _expectOutAppService.RemoveByNumberAsync(kittingJob.Number).ConfigureAwait(false); await _expectOutAppService.RemoveByNumberAsync(kittingJob.Number).ConfigureAwait(false);

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

@ -1,12 +1,13 @@
using System; using System;
using System.Reflection; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Uow; using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Basedata.Application.Contracts;
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.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared; using Win_in.Sfs.Wms.Store.Domain.Shared;
@ -16,23 +17,30 @@ namespace Win_in.Sfs.Wms.Store.Application;
[Authorize] [Authorize]
[Route($"{StoreConsts.RootPath}transfer-lib-job")] [Route($"{StoreConsts.RootPath}transfer-lib-job")]
public class TransferLibJobAppService public class TransferLibJobAppService
: SfsJobAppServiceBase<TransferLibJob, TransferLibJobDetail, TransferLibJobDTO, SfsJobRequestInputBase, TransferLibJobCheckInput, TransferLibJobEditInput>, : SfsJobAppServiceBase<TransferLibJob, TransferLibJobDetail, TransferLibJobDTO, SfsJobRequestInputBase,
ITransferLibJobAppService TransferLibJobCheckInput, TransferLibJobEditInput>,
ITransferLibJobAppService
{ {
private readonly IServiceProvider _serviceProvider; private readonly IServiceProvider _serviceProvider;
private readonly ILocationAppService _locationAppService; private readonly ILocationAppService _locationAppService;
private readonly IExpectOutAppService _expectOutAppService;
protected ITransferLibRequestAppService TransferLibRequestAppService =>
LazyServiceProvider.LazyGetRequiredService<ITransferLibRequestAppService>();
public TransferLibJobAppService( public TransferLibJobAppService(
ITransferLibJobRepository repository, ITransferLibJobManager TransferLibJobManager, IServiceProvider serviceProvider, ILocationAppService locationAppService) : base(repository, TransferLibJobManager) ITransferLibJobRepository repository, ITransferLibJobManager TransferLibJobManager,
IServiceProvider serviceProvider, ILocationAppService locationAppService, IExpectOutAppService expectOutAppService) : base(repository,
TransferLibJobManager)
{ {
_serviceProvider = serviceProvider; _serviceProvider = serviceProvider;
_locationAppService = locationAppService; _locationAppService = locationAppService;
_expectOutAppService = expectOutAppService;
} }
/// <summary> /// <summary>
/// 新移库完成任务 /// 新移库完成任务
/// </summary> /// </summary>
/// <param name="id"></param> /// <param name="id"></param>
/// <param name="dto"></param> /// <param name="dto"></param>
@ -41,32 +49,36 @@ public class TransferLibJobAppService
[UnitOfWork] [UnitOfWork]
public override async Task<TransferLibJobDTO> CompleteAsync(Guid id, TransferLibJobDTO dto) public override async Task<TransferLibJobDTO> CompleteAsync(Guid id, TransferLibJobDTO dto)
{ {
string methodPrefix = "TransferLibJobAppService.CompleteAsync - "; var methodPrefix = "TransferLibJobAppService.CompleteAsync - ";
if (dto.CallServerName.IsNullOrEmpty()) if (dto.CallServerName.IsNullOrEmpty())
{ {
throw new UserFriendlyException($"{methodPrefix}CallServerName 不能为空"); throw new UserFriendlyException($"{methodPrefix}CallServerName 不能为空");
} }
if (dto.CallBusinessType.IsNullOrEmpty()) if (dto.CallBusinessType.IsNullOrEmpty())
{ {
throw new UserFriendlyException($"{methodPrefix}CallBusinessType 不能为空"); throw new UserFriendlyException($"{methodPrefix}CallBusinessType 不能为空");
} }
if (dto.CallRequestNumber.IsNullOrEmpty()) if (dto.CallRequestNumber.IsNullOrEmpty())
{ {
throw new UserFriendlyException($"{methodPrefix}CallRequestNumber 不能为空"); throw new UserFriendlyException($"{methodPrefix}CallRequestNumber 不能为空");
} }
if (dto.CallJobNumber.IsNullOrEmpty()) if (dto.CallJobNumber.IsNullOrEmpty())
{ {
throw new UserFriendlyException($"{methodPrefix}CallJobNumber 不能为空"); throw new UserFriendlyException($"{methodPrefix}CallJobNumber 不能为空");
} }
#region 校验 #region 校验
foreach (var detailObj in dto.Details) foreach (var detailObj in dto.Details)
{ {
if (detailObj.IsPackingCodeFrom) if (detailObj.IsPackingCodeFrom)
{ {
if (detailObj.RecommendFromPackingCode != detailObj.HandledFromPackingCode) if (detailObj.RecommendFromPackingCode != detailObj.HandledFromPackingCode)
{ {
throw new UserFriendlyException($"触发校验:推荐From箱码必须等于实际From箱码"); throw new UserFriendlyException("触发校验:推荐From箱码必须等于实际From箱码");
} }
} }
@ -74,7 +86,7 @@ public class TransferLibJobAppService
{ {
if (detailObj.RecommendToPackingCode != detailObj.HandledToPackingCode) if (detailObj.RecommendToPackingCode != detailObj.HandledToPackingCode)
{ {
throw new UserFriendlyException($"触发校验:推荐To箱码必须等于实际To箱码"); throw new UserFriendlyException("触发校验:推荐To箱码必须等于实际To箱码");
} }
} }
@ -82,7 +94,7 @@ public class TransferLibJobAppService
{ {
if (detailObj.RecommendFromLot != detailObj.HandledFromLot) if (detailObj.RecommendFromLot != detailObj.HandledFromLot)
{ {
throw new UserFriendlyException($"触发校验:推荐From批次必须等于实际From批次"); throw new UserFriendlyException("触发校验:推荐From批次必须等于实际From批次");
} }
} }
@ -90,9 +102,10 @@ public class TransferLibJobAppService
{ {
if (detailObj.RecommendToLot != detailObj.HandledToLot) if (detailObj.RecommendToLot != detailObj.HandledToLot)
{ {
throw new UserFriendlyException($"触发校验:推荐To批次必须等于实际To批次"); throw new UserFriendlyException("触发校验:推荐To批次必须等于实际To批次");
} }
} }
//if (detailObj.IsItemCodeFrom) //if (detailObj.IsItemCodeFrom)
//if (detailObj.IsItemCodeTo) //if (detailObj.IsItemCodeTo)
//if (detailObj.IsStatusFrom) //if (detailObj.IsStatusFrom)
@ -101,7 +114,7 @@ public class TransferLibJobAppService
{ {
if (detailObj.RecommendFromLocationCode != detailObj.HandledFromLocationCode) if (detailObj.RecommendFromLocationCode != detailObj.HandledFromLocationCode)
{ {
throw new UserFriendlyException($"触发校验:推荐From库位必须等于实际From库位"); throw new UserFriendlyException("触发校验:推荐From库位必须等于实际From库位");
} }
} }
@ -109,7 +122,7 @@ public class TransferLibJobAppService
{ {
if (detailObj.RecommendToLocationCode != detailObj.HandledToLocationCode) if (detailObj.RecommendToLocationCode != detailObj.HandledToLocationCode)
{ {
throw new UserFriendlyException($"触发校验:推荐To库位必须等于实际To库位"); throw new UserFriendlyException("触发校验:推荐To库位必须等于实际To库位");
} }
} }
@ -117,7 +130,7 @@ public class TransferLibJobAppService
{ {
if (detailObj.RecommendFromLocationGroup != detailObj.HandledFromLocationGroup) if (detailObj.RecommendFromLocationGroup != detailObj.HandledFromLocationGroup)
{ {
throw new UserFriendlyException($"触发校验:推荐From库位组必须等于实际From库位组"); throw new UserFriendlyException("触发校验:推荐From库位组必须等于实际From库位组");
} }
} }
@ -125,14 +138,15 @@ public class TransferLibJobAppService
{ {
if (detailObj.RecommendToLocationGroup != detailObj.HandledToLocationGroup) if (detailObj.RecommendToLocationGroup != detailObj.HandledToLocationGroup)
{ {
throw new UserFriendlyException($"触发校验:推荐To库位组必须等于实际To库位组"); throw new UserFriendlyException("触发校验:推荐To库位组必须等于实际To库位组");
} }
} }
if (detailObj.IsLocationAreaFrom) if (detailObj.IsLocationAreaFrom)
{ {
if (detailObj.RecommendFromLocationArea != detailObj.HandledFromLocationArea) if (detailObj.RecommendFromLocationArea != detailObj.HandledFromLocationArea)
{ {
throw new UserFriendlyException($"触发校验:推荐From库区必须等于实际From库区"); throw new UserFriendlyException("触发校验:推荐From库区必须等于实际From库区");
} }
} }
@ -140,14 +154,15 @@ public class TransferLibJobAppService
{ {
if (detailObj.RecommendToLocationArea != detailObj.HandledToLocationArea) if (detailObj.RecommendToLocationArea != detailObj.HandledToLocationArea)
{ {
throw new UserFriendlyException($"触发校验:推荐To库区必须等于实际To库区"); throw new UserFriendlyException("触发校验:推荐To库区必须等于实际To库区");
} }
} }
if (detailObj.IsLocationErpCodeFrom) if (detailObj.IsLocationErpCodeFrom)
{ {
if (detailObj.RecommendFromLocationErpCode != detailObj.HandledFromLocationErpCode) if (detailObj.RecommendFromLocationErpCode != detailObj.HandledFromLocationErpCode)
{ {
throw new UserFriendlyException($"触发校验:推荐From ERP库区必须等于实际From ERP库区"); throw new UserFriendlyException("触发校验:推荐From ERP库区必须等于实际From ERP库区");
} }
} }
@ -155,24 +170,27 @@ public class TransferLibJobAppService
{ {
if (detailObj.RecommendToLocationErpCode != detailObj.HandledToLocationErpCode) if (detailObj.RecommendToLocationErpCode != detailObj.HandledToLocationErpCode)
{ {
throw new UserFriendlyException($"触发校验:推荐To ERP库区必须等于实际To ERP库区"); throw new UserFriendlyException("触发校验:推荐To ERP库区必须等于实际To ERP库区");
} }
} }
if (detailObj.IsQtyFrom) if (detailObj.IsQtyFrom)
{ {
if (detailObj.RecommendFromQty != detailObj.HandledFromQty) if (detailObj.RecommendFromQty != detailObj.HandledFromQty)
{ {
throw new UserFriendlyException($"触发校验:推荐From数量必须等于实际From数量"); throw new UserFriendlyException("触发校验:推荐From数量必须等于实际From数量");
} }
} }
if (detailObj.IsQtyTo) if (detailObj.IsQtyTo)
{ {
if (detailObj.RecommendToQty != detailObj.HandledToQty) if (detailObj.RecommendToQty != detailObj.HandledToQty)
{ {
throw new UserFriendlyException($"触发校验:推荐To数量必须等于实际To数量"); throw new UserFriendlyException("触发校验:推荐To数量必须等于实际To数量");
} }
} }
} }
#endregion #endregion
foreach (var detail in dto.Details) foreach (var detail in dto.Details)
@ -180,8 +198,10 @@ public class TransferLibJobAppService
detail.HandledFromContainerCode = string.Empty; detail.HandledFromContainerCode = string.Empty;
detail.HandledToContainerCode = string.Empty; detail.HandledToContainerCode = string.Empty;
var fromLocationDto=await _locationAppService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false); var fromLocationDto = await _locationAppService.GetByCodeAsync(detail.HandledFromLocationCode)
var toLocationDto=await _locationAppService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false); .ConfigureAwait(false);
var toLocationDto =
await _locationAppService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false);
detail.HandledFromLocationArea = fromLocationDto.AreaCode; detail.HandledFromLocationArea = fromLocationDto.AreaCode;
detail.HandledFromLocationCode = fromLocationDto.Code; detail.HandledFromLocationCode = fromLocationDto.Code;
@ -190,7 +210,7 @@ public class TransferLibJobAppService
detail.HandledFromWarehouseCode = fromLocationDto.WarehouseCode; detail.HandledFromWarehouseCode = fromLocationDto.WarehouseCode;
detail.HandledToLocationArea = toLocationDto.AreaCode; detail.HandledToLocationArea = toLocationDto.AreaCode;
detail.HandledToLocationCode = toLocationDto.Code ; detail.HandledToLocationCode = toLocationDto.Code;
detail.HandledToLocationErpCode = toLocationDto.ErpLocationCode; detail.HandledToLocationErpCode = toLocationDto.ErpLocationCode;
detail.HandledToLocationGroup = toLocationDto.LocationGroupCode; detail.HandledToLocationGroup = toLocationDto.LocationGroupCode;
detail.HandledToWarehouseCode = toLocationDto.WarehouseCode; detail.HandledToWarehouseCode = toLocationDto.WarehouseCode;
@ -199,23 +219,68 @@ public class TransferLibJobAppService
var ret = await base.CompleteAsync(id, dto).ConfigureAwait(false); var ret = await base.CompleteAsync(id, dto).ConfigureAwait(false);
if (ret != null) if (ret != null)
{ {
Type ty = Type.GetType(dto.CallServerName); var ty = Type.GetType(dto.CallServerName);
if (ty == null) if (ty == null)
{ {
throw new UserFriendlyException($"{methodPrefix}没有找到类型为{dto.CallServerName}的对象"); throw new UserFriendlyException($"{methodPrefix}没有找到类型为{dto.CallServerName}的对象");
} }
var instance = _serviceProvider.GetService(ty); var instance = _serviceProvider.GetService(ty);
if (instance == null) if (instance == null)
{ {
throw new UserFriendlyException($"{methodPrefix}类型为{dto.CallServerName}的对象创建失败"); throw new UserFriendlyException($"{methodPrefix}类型为{dto.CallServerName}的对象创建失败");
} }
ITransferLibCallback transferLibCallback = (ITransferLibCallback)instance;
var transferLibCallback = (ITransferLibCallback)instance;
if (transferLibCallback == null) if (transferLibCallback == null)
{ {
throw new UserFriendlyException($"{methodPrefix}类型为{dto.CallServerName}的对象没有实现ITransferLibCallback接口"); throw new UserFriendlyException($"{methodPrefix}类型为{dto.CallServerName}的对象没有实现ITransferLibCallback接口");
} }
await transferLibCallback.DoTransferLibCallbackAsync(dto).ConfigureAwait(false); await transferLibCallback.DoTransferLibCallbackAsync(dto).ConfigureAwait(false);
} }
await TransferLibRequestAppService.CompleteByJobAsync(dto.RequestNumber).ConfigureAwait(false);
return ret; return ret;
} }
[HttpPost("get-by-request/{requestNumber}")]
[UnitOfWork]
public async Task<List<TransferLibJobDTO>> GetByRequestNumberAsync(string requestNumber)
{
var list = await _repository.GetListAsync(p => p.RequestNumber == requestNumber).ConfigureAwait(false);
return ObjectMapper.Map<List<TransferLibJob>, List<TransferLibJobDTO>>(list);
}
public override async Task CancelAcceptAsync(Guid id)
{
var job = await _repository.FindAsync(p => p.Id == id).ConfigureAwait(false);
if (job.JobStatus == EnumJobStatus.Open || job.JobStatus == EnumJobStatus.Partial ||
job.JobStatus == EnumJobStatus.Doing || job.JobStatus == EnumJobStatus.Wait)
{
await _repository.UpdateAsync(job).ConfigureAwait(false);
}
await _expectOutAppService.RemoveByNumberAsync(job.Number).ConfigureAwait(false);
}
[HttpPost("complete-by-request/{requestNumber}")]
[UnitOfWork]
public async Task CompleteByRequestAsync(string requestNumber)
{
var list = await _repository.GetListAsync(p => p.RequestNumber == requestNumber).ConfigureAwait(false);
foreach (var job in list)
{
if (job.JobStatus == EnumJobStatus.Open || job.JobStatus == EnumJobStatus.Partial ||
job.JobStatus == EnumJobStatus.Doing || job.JobStatus == EnumJobStatus.Wait)
{
await _repository.UpdateAsync(job).ConfigureAwait(false);
await _expectOutAppService.RemoveByNumberAsync(job.Number).ConfigureAwait(false);
}
}
}
} }

77
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferLibRequests/TransferLibRequestAppService.cs

@ -4,11 +4,13 @@ using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using DocumentFormat.OpenXml.Office2010.Excel;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.ObjectMapping;
using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain;
@ -17,6 +19,8 @@ using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared; using Win_in.Sfs.Wms.Store.Domain.Shared;
using static ClosedXML.Excel.XLPredefinedFormat;
using Filter = Win_in.Sfs.Shared.Domain.Filter;
namespace Win_in.Sfs.Wms.Store.Application; namespace Win_in.Sfs.Wms.Store.Application;
@ -39,16 +43,18 @@ public class TransferLibRequestAppService : SfsStoreRequestAppServiceBase
private readonly ITransferLibRequestManager _transferLibRequestManager; private readonly ITransferLibRequestManager _transferLibRequestManager;
private readonly IBalanceAppService _balanceAppService; private readonly IBalanceAppService _balanceAppService;
private readonly ILocationAppService _locationAppService; private readonly ILocationAppService _locationAppService;
private readonly ITransferLibJobAppService _transferLibJobAppService;
public TransferLibRequestAppService( public TransferLibRequestAppService(
ITransferLibRequestRepository repository, ITransferLibRequestRepository repository,
ITransferLibRequestManager transferLibRequestManager, ITransferLibRequestManager transferLibRequestManager,
IBalanceAppService balanceAppService, IBalanceAppService balanceAppService,
ILocationAppService locationAppService) : base(repository, transferLibRequestManager) ILocationAppService locationAppService, ITransferLibJobAppService transferLibJobAppService) : base(repository, transferLibRequestManager)
{ {
_transferLibRequestManager = transferLibRequestManager; _transferLibRequestManager = transferLibRequestManager;
_balanceAppService = balanceAppService; _balanceAppService = balanceAppService;
_locationAppService = locationAppService; _locationAppService = locationAppService;
_transferLibJobAppService = transferLibJobAppService;
} }
#region 东阳使用 #region 东阳使用
@ -307,6 +313,75 @@ public class TransferLibRequestAppService : SfsStoreRequestAppServiceBase
#endregion #endregion
public override async Task<TransferLibRequestDTO> CancelAsync(Guid id)
{
var request = await _repository.GetAsync(id).ConfigureAwait(false);
var list = await _transferLibJobAppService.GetByRequestNumberAsync(request.Number).ConfigureAwait(false);
if (list.Any())
{
foreach (var kittingIssueJobDto in list)
{
if (kittingIssueJobDto.JobStatus == EnumJobStatus.Open ||
kittingIssueJobDto.JobStatus == EnumJobStatus.Partial ||
kittingIssueJobDto.JobStatus == EnumJobStatus.Doing ||
kittingIssueJobDto.JobStatus == EnumJobStatus.Wait)
{
await _transferLibJobAppService.CancelAsync(kittingIssueJobDto.Id).ConfigureAwait(false);
}
}
}
if (request.RequestStatus == EnumRequestStatus.Partial || request.RequestStatus == EnumRequestStatus.Handling ||
request.RequestStatus == EnumRequestStatus.New)
{
request.RequestStatus = EnumRequestStatus.Cancelled;
await _repository.UpdateAsync(request).ConfigureAwait(false);
}
else
{
throw new UserFriendlyException($"【{request.RequestStatus.GetDisplayName()}】状态不允许取消");
}
return ObjectMapper.Map<TransferLibRequest, TransferLibRequestDTO>(request);
}
public override async Task<TransferLibRequestDTO> CompleteAsync(Guid id)
{
var request = await _repository.FindAsync(p => p.Id == id).ConfigureAwait(false);
if (request.RequestStatus == EnumRequestStatus.Partial || request.RequestStatus == EnumRequestStatus.Handling ||
request.RequestStatus == EnumRequestStatus.New)
{
request.RequestStatus = EnumRequestStatus.Completed;
await _repository.UpdateAsync(request).ConfigureAwait(false);
}
else
{
throw new UserFriendlyException($"【{request.RequestStatus.GetDisplayName()}】状态不允许取消");
}
await _transferLibJobAppService.CompleteByRequestAsync(request.Number).ConfigureAwait(false);
return ObjectMapper.Map<TransferLibRequest, TransferLibRequestDTO>(request);
}
[HttpPost("Complete-By-Job")]
public async Task CompleteByJobAsync(string requestNumber)
{
var request = await _repository.FindAsync(p => p.Number == requestNumber).ConfigureAwait(false);
if (request.RequestStatus == EnumRequestStatus.Partial || request.RequestStatus == EnumRequestStatus.Handling ||
request.RequestStatus == EnumRequestStatus.New)
{
request.RequestStatus = EnumRequestStatus.Completed;
await _repository.UpdateAsync(request).ConfigureAwait(false);
}
else
{
throw new UserFriendlyException($"【{request.RequestStatus.GetDisplayName()}】状态不允许取消");
}
}
/// <summary> /// <summary>
/// 【创建】库移请求 /// 【创建】库移请求

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

@ -2,6 +2,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Castle.Components.DictionaryAdapter; using Castle.Components.DictionaryAdapter;
using Volo.Abp;
using Volo.Abp.EventBus; using Volo.Abp.EventBus;
using Volo.Abp.Uow; using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Basedata.Application.Contracts;
@ -128,6 +129,25 @@ public class KittingIssueJobEventHandler :
{ {
var locationDto = await _locationAppService.GetByCodeAsync(detail.RecommendFromLocationCode) var locationDto = await _locationAppService.GetByCodeAsync(detail.RecommendFromLocationCode)
.ConfigureAwait(false); .ConfigureAwait(false);
var locationList = await _locationAppService.GetListByGroupsAsync(
new List<string>{ detail.RecommendFromLocationGroup }).ConfigureAwait(false);
var locationListSort=locationList.OrderBy(p => p.RowCode);
var locationDtoRowOne = new LocationDTO();
if (locationListSort.Any())
{
locationDtoRowOne = locationListSort.FirstOrDefault();
}
else
{
locationDtoRowOne = await _locationAppService.GetFirstRowOneAsync().ConfigureAwait(false);
if (locationDtoRowOne == null)
{
throw new UserFriendlyException("没有找到1层的库位");
}
}
if (locationDto.Type == EnumLocationType.RAW) if (locationDto.Type == EnumLocationType.RAW)
{ {
if (!await IsMinRowAsync(kittingIssueJob).ConfigureAwait(false)) if (!await IsMinRowAsync(kittingIssueJob).ConfigureAwait(false))
@ -154,7 +174,7 @@ public class KittingIssueJobEventHandler :
detailInput.RecommendFromQty = detail.RecommendFromQty; detailInput.RecommendFromQty = detail.RecommendFromQty;
detailInput.RecommendFromLot = detail.RecommendFromLot; detailInput.RecommendFromLot = detail.RecommendFromLot;
detailInput.RecommendFromPackingCode = detailInput.RecommendFromPackingCode; detailInput.RecommendFromPackingCode = detail.RecommendFromPackingCode;
detailInput.RecommendToLot = detail.RecommendToLot; detailInput.RecommendToLot = detail.RecommendToLot;
detailInput.RecommendFromArriveDate = detail.RecommendFromArriveDate; detailInput.RecommendFromArriveDate = detail.RecommendFromArriveDate;
@ -178,11 +198,11 @@ public class KittingIssueJobEventHandler :
detailInput.RecommendToProduceDate = detail.RecommendToProduceDate; detailInput.RecommendToProduceDate = detail.RecommendToProduceDate;
detailInput.RecommendToSupplierBatch = detail.RecommendToSupplierBatch; detailInput.RecommendToSupplierBatch = detail.RecommendToSupplierBatch;
detailInput.RecommendToLocationCode = detail.RecommendToLocationCode; detailInput.RecommendToLocationCode = locationDtoRowOne.Code;
detailInput.RecommendToLocationGroup = detail.RecommendToLocationGroup; detailInput.RecommendToLocationGroup = locationDtoRowOne.LocationGroupCode;
detailInput.RecommendToLocationArea = detail.RecommendToLocationArea; detailInput.RecommendToLocationArea = locationDtoRowOne.AreaCode;
detailInput.RecommendToLocationErpCode = detail.RecommendToLocationErpCode; detailInput.RecommendToLocationErpCode = locationDtoRowOne.ErpLocationCode;
detailInput.RecommendToWarehouseCode = detail.RecommendToWarehouseCode; detailInput.RecommendToWarehouseCode = locationDtoRowOne.WarehouseCode;
input.Details = new EditableList<TransferLibRequestDetailInput>() { detailInput }; input.Details = new EditableList<TransferLibRequestDetailInput>() { detailInput };

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/KittingIssueRequestEventHandler.cs

@ -688,7 +688,7 @@ public class KittingIssueRequestEventHandler
resultBalance.LocationRow = locationDto.RowCode; resultBalance.LocationRow = locationDto.RowCode;
} }
resultBalances resultBalances=resultBalances
.OrderBy(p => p.Lot) .OrderBy(p => p.Lot)
.ThenBy(p=>p.LocationRow) .ThenBy(p=>p.LocationRow)
.ThenBy(p => p.PutInTime) .ThenBy(p => p.PutInTime)

Loading…
Cancel
Save