diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/TransferLibJobController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/TransferLibJobController.cs index 5c6aed4cb..d1e770fac 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/TransferLibJobController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/TransferLibJobController.cs @@ -15,7 +15,7 @@ namespace Win_in.Sfs.Wms.Pda.Controllers.Stores; /// /// [ApiController] -[Route($"{PdaHostConst.ROOT_ROUTE}store/transferlib-job")] +[Route($"{PdaHostConst.ROOT_ROUTE}store/transferlib-job")] //??store应该改成job public class TransferLibJobController : AbpController { diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ThirdLocationRequestController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ThirdLocationRequestController.cs index 9c5a29854..529776dbb 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ThirdLocationRequestController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ThirdLocationRequestController.cs @@ -109,4 +109,17 @@ public class ThirdLocationRequestController : AbpController return Ok(result); } + /// + /// 完成三方库请求 + /// + /// + /// + [HttpPost("complete/{id}")] + public virtual async Task> CompleteAsync(Guid id) + { + var result = await _thirdLocationRequestAppService.CompleteAsync(id).ConfigureAwait(false); + return Ok(result); + } + + } diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs index 69f37b12d..48afaa429 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs @@ -1026,6 +1026,112 @@ public class BalanceManager : DomainService, IBalanceManager return usableBalances; } + /// + /// 获取无箱码可用库存列表 + /// + /// + /// + /// + /// + /// + public virtual async Task> GetNoPackCodeUsableListAsync(string itemCode, + List validLocations, + List validStatuses, bool isRemovePackingCode) + { + var recommendBalances = new List();//返回可使用的推荐库存余额 + + var item = await _itemBasicAclService.GetByCodeAsync(itemCode).ConfigureAwait(false); + if (item == null) //物品是否存在 + { + // throw new UserFriendlyException($"未找到代码为 {itemCode} 的物料记录"); + return recommendBalances; + } + + //构造查询条件 + Expression> expression = p => p.ItemCode == itemCode; + expression = expression.And(p => validStatuses.Contains(p.Status)); + expression = expression.And(p => p.IsActive); + + //如果物品的有效期不是无限的, 要过滤掉过期库存 + if (item.ValidityUnit != EnumValidityUnit.Infinite) + { + expression = expression.And(p => p.ExpireDate > DateTime.Now); + } + //排除有箱码库存 + if (isRemovePackingCode) + { + expression = expression.And(p => string.IsNullOrEmpty(p.PackingCode)); + } + + + var allBalances = await + (await _balanceRepository.GetDbSetAsync().ConfigureAwait(false)) + .Where(expression) + .AsNoTracking() + .ToListAsync().ConfigureAwait(false); + + var balanceLocationCodes = allBalances.Select(p => p.LocationCode).Distinct().ToList(); + var locations = await _locationAclService.GetByCodesAsync(balanceLocationCodes).ConfigureAwait(false); + //筛选有效库位类型 + if (validLocations.Any()) + { + locations = locations.Where(p => validLocations.Contains(p.Code)).ToList(); + } + var locationCodes = locations.Where(p => p.EnablePick).Select(p => p.Code).ToList(); + + if (!locationCodes.Any()) + { + return recommendBalances; + } + //获取物品存储关系 + var itemStoreRelationDict = await GetItemStoreRelationDictAsync(itemCode, locationCodes).ConfigureAwait(false); + //过滤掉无用的库位代码 + locationCodes = itemStoreRelationDict.Keys.ToList(); + locations = locations.Where(p => locationCodes.Contains(p.Code)).ToList(); + + var usableBalances = allBalances.Where(p => locationCodes.Contains(p.LocationCode)).ToList(); + + if (!usableBalances.Any()) + { + return recommendBalances; + } + + //读取该itemCode项目为空的预占用库存 + var expectOuts = await + (await _expectOutRepository.GetDbSetAsync().ConfigureAwait(false)) + .AsNoTracking() + .Where(p => p.ItemCode == itemCode + && locationCodes.Contains(p.LocationCode) && string.IsNullOrEmpty(p.PackingCode) + && validStatuses.Contains(p.Status)) + .ToListAsync().ConfigureAwait(false); + + var containerCodes = usableBalances + .Where(p => !string.IsNullOrEmpty(p.ContainerCode)) + .Select(p => p.ContainerCode) + .ToList(); + + var expectOutContainerCodes = await + (await _expectOutRepository.GetDbSetAsync().ConfigureAwait(false)) + .Where(p => containerCodes.Contains(p.ContainerCode)) + .GroupBy(p => p.ContainerCode) + .Select(d => d.Key) + .ToListAsync().ConfigureAwait(false); + + usableBalances + //扣减已占用库存 + .DecreaseExpectOutQty(expectOuts, locations) + //去除不可拆箱 拆托的且有预占用的库存余额 + .IgnoreExpectOutOfSameContainer(expectOutContainerCodes, itemStoreRelationDict, locations) + //过滤掉不允许拣料的库位 + .FilterLocationEnablePickAsync(locations) + //排序库存余额 最终可用的余额集合 + .SortByFifo(); + usableBalances = usableBalances.Where(p => p.Qty != 0).ToList(); + + return usableBalances; + } + + private decimal GetRecommendQty(Guid traceId, decimal requestQty, decimal remainingQty, Balance usableBalance, LocationDTO location, ItemStoreRelationDTO itemStoreRelation) { var balanceQty = usableBalance.Qty; diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/IBalanceManager.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/IBalanceManager.cs index 1d2e4880d..a5f0ad18c 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/IBalanceManager.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/IBalanceManager.cs @@ -51,5 +51,9 @@ public interface IBalanceManager : IDomainService Task> GetUsableListAsync(string itemCode, List validLocations, List validStatuses, bool isRemovePackingCode); + + Task> GetNoPackCodeUsableListAsync(string itemCode, + List validLocations, + List validStatuses, bool isRemovePackingCode); Task> GetRecommendBalancesByLocationExpectOldBalancesAsync(Guid traceId, string itemCode, decimal requestQty, List validLocations, List validStatuses, bool ispackingcode, List oldBalances); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleIssueJobs/DTOs/AssembleIssueJobDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleIssueJobs/DTOs/AssembleIssueJobDTO.cs index e05f8d4b4..a4a10f4cc 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleIssueJobs/DTOs/AssembleIssueJobDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleIssueJobs/DTOs/AssembleIssueJobDTO.cs @@ -38,4 +38,24 @@ public class AssembleIssueJobDTO : SfsJobDTOBase public EnumIssueSendType EnumIssueSendType { get; set; } + /// + /// 已承接 + /// + /// + [Display(Name = "是否已承接")] + public bool IsClaims { get; set; } + + /// + /// 承接人ID + /// + /// + [Display(Name = "承接人ID")] + public string ClaimsUserId { get; set; } + + /// + /// 承接人 + /// + /// + [Display(Name = "承接人")] + public string ClaimsUserName { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleIssueJobs/Inputs/AssembleIssueJobEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleIssueJobs/Inputs/AssembleIssueJobEditInput.cs index fdf1a372d..73c2e99c7 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleIssueJobs/Inputs/AssembleIssueJobEditInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleIssueJobs/Inputs/AssembleIssueJobEditInput.cs @@ -66,5 +66,26 @@ public class AssembleIssueJobEditInput : SfsJobCreateUpdateInputBase, ISfsJobCre public bool UseOnTheWayLocation { get; set; } public EnumIssueSendType EnumIssueSendType { get; set; } + + /// + /// 已承接 + /// + /// + [Display(Name = "是否已承接")] + public bool IsClaims { get; set; } + + /// + /// 承接人ID + /// + /// + [Display(Name = "承接人ID")] + public string ClaimsUserId { get; set; } + + /// + /// 承接人 + /// + /// + [Display(Name = "承接人")] + public string ClaimsUserName { get; set; } #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/DTOs/CoatingIssueJobDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/DTOs/CoatingIssueJobDTO.cs index 6521709ea..f0908bea2 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/DTOs/CoatingIssueJobDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/DTOs/CoatingIssueJobDTO.cs @@ -37,4 +37,25 @@ public class CoatingIssueJobDTO : SfsJobDTOBase public bool UseOnTheWayLocation { get; set; } public EnumIssueSendType EnumIssueSendType { get; set; } + + /// + /// 已承接 + /// + /// + [Display(Name = "是否已承接")] + public bool IsClaims { get; set; } + + /// + /// 承接人ID + /// + /// + [Display(Name = "承接人ID")] + public string ClaimsUserId { get; set; } + + /// + /// 承接人 + /// + /// + [Display(Name = "承接人")] + public string ClaimsUserName { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/Inputs/CoatingIssueJobEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/Inputs/CoatingIssueJobEditInput.cs index 492464524..3de14a3d3 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/Inputs/CoatingIssueJobEditInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/Inputs/CoatingIssueJobEditInput.cs @@ -66,5 +66,26 @@ public class CoatingIssueJobEditInput : SfsJobCreateUpdateInputBase, ISfsJobCrea public bool UseOnTheWayLocation { get; set; } public EnumIssueSendType EnumIssueSendType { get; set; } + + /// + /// 已承接 + /// + /// + [Display(Name = "是否已承接")] + public bool IsClaims { get; set; } + + /// + /// 承接人ID + /// + /// + [Display(Name = "承接人ID")] + public string ClaimsUserId { get; set; } + + /// + /// 承接人 + /// + /// + [Display(Name = "承接人")] + public string ClaimsUserName { get; set; } #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/InjectionJobs/DTOs/InjectionIssueJobDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/InjectionJobs/DTOs/InjectionIssueJobDTO.cs index 73f657364..d22f9e52a 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/InjectionJobs/DTOs/InjectionIssueJobDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/InjectionJobs/DTOs/InjectionIssueJobDTO.cs @@ -37,4 +37,25 @@ public class InjectionIssueJobDTO : SfsJobDTOBase public bool UseOnTheWayLocation { get; set; } public EnumIssueSendType EnumIssueSendType { get; set; } + + /// + /// 已承接 + /// + /// + [Display(Name = "是否已承接")] + public bool IsClaims { get; set; } + + /// + /// 承接人ID + /// + /// + [Display(Name = "承接人ID")] + public string ClaimsUserId { get; set; } + + /// + /// 承接人 + /// + /// + [Display(Name = "承接人")] + public string ClaimsUserName { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/InjectionJobs/Inputs/InjectionIssueJobEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/InjectionJobs/Inputs/InjectionIssueJobEditInput.cs index 48f2d75b5..86079f0dc 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/InjectionJobs/Inputs/InjectionIssueJobEditInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/InjectionJobs/Inputs/InjectionIssueJobEditInput.cs @@ -66,5 +66,26 @@ public class InjectionIssueJobEditInput : SfsJobCreateUpdateInputBase, ISfsJobCr public bool UseOnTheWayLocation { get; set; } public EnumIssueSendType EnumIssueSendType { get; set; } + + /// + /// 已承接 + /// + /// + [Display(Name = "是否已承接")] + public bool IsClaims { get; set; } + + /// + /// 承接人ID + /// + /// + [Display(Name = "承接人ID")] + public string ClaimsUserId { get; set; } + + /// + /// 承接人 + /// + /// + [Display(Name = "承接人")] + public string ClaimsUserName { get; set; } #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/KittingIssueJobs/DTOs/KittingIssueJobDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/KittingIssueJobs/DTOs/KittingIssueJobDTO.cs index 2141ce1d8..77f50dfc2 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/KittingIssueJobs/DTOs/KittingIssueJobDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/KittingIssueJobs/DTOs/KittingIssueJobDTO.cs @@ -37,4 +37,25 @@ public class KittingIssueJobDTO : SfsJobDTOBase public bool UseOnTheWayLocation { get; set; } public EnumIssueSendType EnumIssueSendType { get; set; } + + /// + /// 已承接 + /// + /// + [Display(Name = "是否已承接")] + public bool IsClaims { get; set; } + + /// + /// 承接人ID + /// + /// + [Display(Name = "承接人ID")] + public string ClaimsUserId { get; set; } + + /// + /// 承接人 + /// + /// + [Display(Name = "承接人")] + public string ClaimsUserName { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/KittingIssueJobs/Inputs/KittingIssueJobEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/KittingIssueJobs/Inputs/KittingIssueJobEditInput.cs index d22be4f4d..7b41298e9 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/KittingIssueJobs/Inputs/KittingIssueJobEditInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/KittingIssueJobs/Inputs/KittingIssueJobEditInput.cs @@ -66,5 +66,26 @@ public class KittingIssueJobEditInput : SfsJobCreateUpdateInputBase, ISfsJobCrea public bool UseOnTheWayLocation { get; set; } public EnumIssueSendType EnumIssueSendType { get; set; } + + /// + /// 已承接 + /// + /// + [Display(Name = "是否已承接")] + public bool IsClaims { get; set; } + + /// + /// 承接人ID + /// + /// + [Display(Name = "承接人ID")] + public string ClaimsUserId { get; set; } + + /// + /// 承接人 + /// + /// + [Display(Name = "承接人")] + public string ClaimsUserName { get; set; } #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/SparePartIssueJobs/DTOs/SparePartIssueJobDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/SparePartIssueJobs/DTOs/SparePartIssueJobDTO.cs index 74ab9f2cc..390089903 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/SparePartIssueJobs/DTOs/SparePartIssueJobDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/SparePartIssueJobs/DTOs/SparePartIssueJobDTO.cs @@ -37,4 +37,25 @@ public class SparePartIssueJobDTO : SfsJobDTOBase public bool UseOnTheWayLocation { get; set; } public EnumIssueSendType EnumIssueSendType { get; set; } + + /// + /// 已承接 + /// + /// + [Display(Name = "是否已承接")] + public bool IsClaims { get; set; } + + /// + /// 承接人ID + /// + /// + [Display(Name = "承接人ID")] + public string ClaimsUserId { get; set; } + + /// + /// 承接人 + /// + /// + [Display(Name = "承接人")] + public string ClaimsUserName { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/SparePartIssueJobs/Inputs/SparePartIssueJobEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/SparePartIssueJobs/Inputs/SparePartIssueJobEditInput.cs index 82cdeed81..e20fd100a 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/SparePartIssueJobs/Inputs/SparePartIssueJobEditInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/SparePartIssueJobs/Inputs/SparePartIssueJobEditInput.cs @@ -66,5 +66,26 @@ public class SparePartIssueJobEditInput : SfsJobCreateUpdateInputBase, ISfsJobCr public bool UseOnTheWayLocation { get; set; } public EnumIssueSendType EnumIssueSendType { get; set; } + + /// + /// 已承接 + /// + /// + [Display(Name = "是否已承接")] + public bool IsClaims { get; set; } + + /// + /// 承接人ID + /// + /// + [Display(Name = "承接人ID")] + public string ClaimsUserId { get; set; } + + /// + /// 承接人 + /// + /// + [Display(Name = "承接人")] + public string ClaimsUserName { get; set; } #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs index b6d1770b6..e9e264da5 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs @@ -15,6 +15,9 @@ 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; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared.Enums.Store; @@ -25,6 +28,7 @@ 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; @@ -46,6 +50,7 @@ public class AssembleIssueJobAppService private readonly ITransferLibRequestAppService _transferLibRequestAppService; private readonly IOptions _options; private readonly ILogger _logger; + private readonly ICurrentUser _currentUser; public AssembleIssueJobAppService( ILogger logger, @@ -53,7 +58,7 @@ public class AssembleIssueJobAppService ILocationAppService locationAppService, IAssembleIssueNoteAppService assembleIssueNoteAppService, IExpectOutAppService expectOutAppService , IHttpClientFactory httpClientFactory - , IOptions options, ITransferLibRequestAppService transferLibRequestAppService) : base( + , IOptions options, ITransferLibRequestAppService transferLibRequestAppService, ICurrentUser currentUser) : base( repository, assembleIssueJobManager) { _assembleIssueJobManager = assembleIssueJobManager; @@ -63,6 +68,7 @@ public class AssembleIssueJobAppService _httpClientFactory = httpClientFactory; _options = options; _transferLibRequestAppService = transferLibRequestAppService; + _currentUser = currentUser; _logger = logger; } @@ -204,6 +210,17 @@ public class AssembleIssueJobAppService { var assembleIssueJob = await _repository.GetAsync(masterId).ConfigureAwait(false); assembleIssueJob.JobStatus = EnumJobStatus.Doing; + if (assembleIssueJob.IsClaims) + { + if (assembleIssueJob.ClaimsUserId != _currentUser.Id.ToString()) + { + throw new UserFriendlyException($"该任务已被【{assembleIssueJob.ClaimsUserName}】承接"); + } + } + else + { + throw new UserFriendlyException("该任务未被承接,请重新刷新页面,承接任务"); + } var assembleIssueJobDto = ObjectMapper.Map(assembleIssueJob); assembleIssueJobDto.Details = new List { issueJobDetailDto }; @@ -247,6 +264,7 @@ public class AssembleIssueJobAppService } await _repository.UpdateAsync(assembleIssueJob).ConfigureAwait(false); + await CancelAcceptAsync(masterId).ConfigureAwait(false); } /// @@ -292,6 +310,35 @@ public class AssembleIssueJobAppService } } + [HttpPost("accept/{id}")] + [UnitOfWork] + public override async Task AcceptAsync(Guid id) + { + var entity = await _repository.FindAsync(id).ConfigureAwait(false); + entity.IsClaims=true; + entity.ClaimsUserName = _currentUser.UserName; + entity.ClaimsUserId = _currentUser.Id.ToString(); + entity.AcceptTime = Clock.Now; + await _repository.UpdateAsync(entity).ConfigureAwait(false); + } + + /// + /// 取消承接任务 + /// + /// + /// + [HttpPost("cancel-accept/{id}")] + [UnitOfWork] + public override async Task CancelAcceptAsync(Guid id) + { + var entity = await _repository.FindAsync(id).ConfigureAwait(false); + entity.IsClaims = false; + entity.ClaimsUserName = string.Empty; + entity.ClaimsUserId = string.Empty; + entity.AcceptTime = DateTime.Now; + await _repository.UpdateAsync(entity).ConfigureAwait(false); + } + #region 立库 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs index 7e59d4800..0f796ca16 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs @@ -7,13 +7,17 @@ using System.Text; using System.Text.Json; using System.Threading.Tasks; using Castle.Components.DictionaryAdapter; +using IdentityServer4.Extensions; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using MyNamespace; using Volo.Abp; +using Volo.Abp.Domain.Entities; using Volo.Abp.ObjectMapping; +using Volo.Abp.Uow; +using Volo.Abp.Users; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared.Enums.Store; @@ -42,6 +46,7 @@ public class CoatingIssueJobAppService private readonly ITransferLibRequestAppService _transferLibRequestAppService; private readonly IOptions _options; private readonly ILogger _logger; + private readonly ICurrentUser _currentUser; protected ICoatingIssueRequestAppService CoatingIssueRequestAppService => LazyServiceProvider.LazyGetRequiredService(); @@ -53,7 +58,7 @@ public class CoatingIssueJobAppService ILocationAppService locationAppService, ICoatingIssueNoteAppService coatingIssueNoteAppService, IExpectOutAppService expectOutAppService , IHttpClientFactory httpClientFactory - , IOptions options, ITransferLibRequestAppService transferLibRequestAppService) : base( + , IOptions options, ITransferLibRequestAppService transferLibRequestAppService, ICurrentUser currentUser) : base( repository, coatingIssueJobManager) { _coatingIssueJobManager = coatingIssueJobManager; @@ -63,6 +68,7 @@ public class CoatingIssueJobAppService _httpClientFactory = httpClientFactory; _options = options; _transferLibRequestAppService = transferLibRequestAppService; + _currentUser = currentUser; _logger = logger; } @@ -204,7 +210,18 @@ public class CoatingIssueJobAppService { var coatingIssueJob = await _repository.GetAsync(masterId).ConfigureAwait(false); coatingIssueJob.JobStatus = EnumJobStatus.Doing; - + if (coatingIssueJob.IsClaims) + { + if (coatingIssueJob.ClaimsUserId != _currentUser.Id.ToString()) + { + throw new UserFriendlyException($"该任务已被【{coatingIssueJob.ClaimsUserName}】承接"); + } + } + else + { + throw new UserFriendlyException("该任务未被承接,请重新刷新页面,承接任务"); + } + var coatingIssueJobDto = ObjectMapper.Map(coatingIssueJob); var fromLocationDto=await _locationAppService.GetByCodeAsync(issueJobDetailDto.HandledFromLocationCode).ConfigureAwait(false); @@ -261,6 +278,7 @@ public class CoatingIssueJobAppService } await _repository.UpdateAsync(coatingIssueJob).ConfigureAwait(false); + await CancelAcceptAsync(masterId).ConfigureAwait(false); } /// @@ -306,6 +324,40 @@ public class CoatingIssueJobAppService } } + /// + /// 承接任务 + /// + /// + /// + [HttpPost("accept/{id}")] + [UnitOfWork] + public override async Task AcceptAsync(Guid id) + { + var entity = await _repository.FindAsync(id).ConfigureAwait(false); + entity.IsClaims = true; + entity.ClaimsUserName = _currentUser.UserName; + entity.ClaimsUserId = _currentUser.Id.ToString(); + entity.AcceptTime = Clock.Now; + await _repository.UpdateAsync(entity).ConfigureAwait(false); + } + + /// + /// 取消承接任务 + /// + /// + /// + [HttpPost("cancel-accept/{id}")] + [UnitOfWork] + public override async Task CancelAcceptAsync(Guid id) + { + var entity = await _repository.FindAsync(id).ConfigureAwait(false); + entity.IsClaims = false; + entity.ClaimsUserName = string.Empty; + entity.ClaimsUserId = string.Empty; + entity.AcceptTime = DateTime.Now; + await _repository.UpdateAsync(entity).ConfigureAwait(false); + } + #region 立库 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJobAppService.cs index 1259feed5..7edfa7635 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJobAppService.cs @@ -13,6 +13,8 @@ using Microsoft.Extensions.Options; using MyNamespace; using Volo.Abp; using Volo.Abp.ObjectMapping; +using Volo.Abp.Uow; +using Volo.Abp.Users; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared.Enums.Store; @@ -40,6 +42,7 @@ public class InjectionIssueJobAppService private readonly IHttpClientFactory _httpClientFactory; private readonly ITransferLibRequestAppService _transferLibRequestAppService; private readonly IOptions _options; + private readonly ICurrentUser _currentUser; protected IInjectionIssueRequestAppService InjectionIssueRequestAppService => LazyServiceProvider.LazyGetRequiredService(); @@ -49,7 +52,7 @@ public class InjectionIssueJobAppService ILocationAppService locationAppService, IInjectionIssueNoteAppService injectionIssueNoteAppService, IExpectOutAppService expectOutAppService , IHttpClientFactory httpClientFactory - , IOptions options, ITransferLibRequestAppService transferLibRequestAppService) : base( + , IOptions options, ITransferLibRequestAppService transferLibRequestAppService, ICurrentUser currentUser) : base( repository, injectionIssueJobManager) { _injectionIssueJobManager = injectionIssueJobManager; @@ -59,6 +62,7 @@ public class InjectionIssueJobAppService _httpClientFactory = httpClientFactory; _options = options; _transferLibRequestAppService = transferLibRequestAppService; + _currentUser = currentUser; } [HttpPost("get-by-number-2")] public async Task GetByNumber2Async(string number) @@ -198,6 +202,17 @@ public class InjectionIssueJobAppService { var injectionIssueJob = await _repository.GetAsync(masterId).ConfigureAwait(false); injectionIssueJob.JobStatus = EnumJobStatus.Doing; + if (injectionIssueJob.IsClaims) + { + if (injectionIssueJob.ClaimsUserId != _currentUser.Id.ToString()) + { + throw new UserFriendlyException($"该任务已被【{injectionIssueJob.ClaimsUserName}】承接"); + } + } + else + { + throw new UserFriendlyException("该任务未被承接,请重新刷新页面,承接任务"); + } var injectionIssueJobDto = ObjectMapper.Map(injectionIssueJob); injectionIssueJobDto.Details = new List { issueJobDetailDto }; @@ -240,6 +255,7 @@ public class InjectionIssueJobAppService } await _repository.UpdateAsync(injectionIssueJob).ConfigureAwait(false); + await CancelAcceptAsync(masterId).ConfigureAwait(false); } /// @@ -285,6 +301,35 @@ public class InjectionIssueJobAppService } } + [HttpPost("accept/{id}")] + [UnitOfWork] + public override async Task AcceptAsync(Guid id) + { + var entity = await _repository.FindAsync(id).ConfigureAwait(false); + entity.IsClaims = true; + entity.ClaimsUserName = _currentUser.UserName; + entity.ClaimsUserId = _currentUser.Id.ToString(); + entity.AcceptTime = Clock.Now; + await _repository.UpdateAsync(entity).ConfigureAwait(false); + } + + /// + /// 取消承接任务 + /// + /// + /// + [HttpPost("cancel-accept/{id}")] + [UnitOfWork] + public override async Task CancelAcceptAsync(Guid id) + { + var entity = await _repository.FindAsync(id).ConfigureAwait(false); + entity.IsClaims = false; + entity.ClaimsUserName = string.Empty; + entity.ClaimsUserId = string.Empty; + entity.AcceptTime = DateTime.Now; + await _repository.UpdateAsync(entity).ConfigureAwait(false); + } + #region 立库 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs index cbc2ee77e..1dcea8e63 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs @@ -12,6 +12,8 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; using MyNamespace; using Volo.Abp; +using Volo.Abp.Uow; +using Volo.Abp.Users; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared.Enums.Store; @@ -39,6 +41,7 @@ public class KittingIssueJobAppService private readonly IHttpClientFactory _httpClientFactory; private readonly ITransferLibRequestAppService _transferLibRequestAppService; private readonly IOptions _options; + private readonly ICurrentUser _currentUser; protected IKittingIssueRequestAppService KittingIssueRequestAppService => LazyServiceProvider.LazyGetRequiredService(); @@ -48,7 +51,7 @@ public class KittingIssueJobAppService ILocationAppService locationAppService, IKittingIssueNoteAppService kittingIssueNoteAppService, IExpectOutAppService expectOutAppService , IHttpClientFactory httpClientFactory - , IOptions options, ITransferLibRequestAppService transferLibRequestAppService) : base( + , IOptions options, ITransferLibRequestAppService transferLibRequestAppService, ICurrentUser currentUser) : base( repository, kittingIssueJobManager) { _kittingIssueJobManager = kittingIssueJobManager; @@ -58,6 +61,7 @@ public class KittingIssueJobAppService _httpClientFactory = httpClientFactory; _options = options; _transferLibRequestAppService = transferLibRequestAppService; + _currentUser = currentUser; } [HttpPost("get-by-number-2")] @@ -197,6 +201,17 @@ public class KittingIssueJobAppService { var kittingIssueJob = await _repository.GetAsync(masterId).ConfigureAwait(false); kittingIssueJob.JobStatus = EnumJobStatus.Doing; + if (kittingIssueJob.IsClaims) + { + if (kittingIssueJob.ClaimsUserId != _currentUser.Id.ToString()) + { + throw new UserFriendlyException($"该任务已被【{kittingIssueJob.ClaimsUserName}】承接"); + } + } + else + { + throw new UserFriendlyException("该任务未被承接,请重新刷新页面,承接任务"); + } var kittingIssueJobDto = ObjectMapper.Map(kittingIssueJob); kittingIssueJobDto.Details = new List { issueJobDetailDto }; @@ -239,6 +254,7 @@ public class KittingIssueJobAppService } await _repository.UpdateAsync(kittingIssueJob).ConfigureAwait(false); + await CancelAcceptAsync(masterId).ConfigureAwait(false); } /// @@ -284,6 +300,35 @@ public class KittingIssueJobAppService } } + [HttpPost("accept/{id}")] + [UnitOfWork] + public override async Task AcceptAsync(Guid id) + { + var entity = await _repository.FindAsync(id).ConfigureAwait(false); + entity.IsClaims = true; + entity.ClaimsUserName = _currentUser.UserName; + entity.ClaimsUserId = _currentUser.Id.ToString(); + entity.AcceptTime = Clock.Now; + await _repository.UpdateAsync(entity).ConfigureAwait(false); + } + + /// + /// 取消承接任务 + /// + /// + /// + [HttpPost("cancel-accept/{id}")] + [UnitOfWork] + public override async Task CancelAcceptAsync(Guid id) + { + var entity = await _repository.FindAsync(id).ConfigureAwait(false); + entity.IsClaims = false; + entity.ClaimsUserName = string.Empty; + entity.ClaimsUserId = string.Empty; + entity.AcceptTime = DateTime.Now; + await _repository.UpdateAsync(entity).ConfigureAwait(false); + } + #region 立库 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJobAppService.cs index 07d0dc43b..140635d3e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJobAppService.cs @@ -12,6 +12,8 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; using MyNamespace; using Volo.Abp; +using Volo.Abp.Uow; +using Volo.Abp.Users; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared.Enums.Store; @@ -39,6 +41,7 @@ public class SparePartIssueJobAppService private readonly IHttpClientFactory _httpClientFactory; private readonly ITransferLibRequestAppService _transferLibRequestAppService; private readonly IOptions _options; + private readonly ICurrentUser _currentUser; protected ISparePartIssueRequestAppService SparePartIssueRequestAppService => LazyServiceProvider.LazyGetRequiredService(); @@ -48,7 +51,7 @@ public class SparePartIssueJobAppService ILocationAppService locationAppService, ISparePartIssueNoteAppService sparePartIssueNoteAppService, IExpectOutAppService expectOutAppService , IHttpClientFactory httpClientFactory - , IOptions options, ITransferLibRequestAppService transferLibRequestAppService) : base( + , IOptions options, ITransferLibRequestAppService transferLibRequestAppService, ICurrentUser currentUser) : base( repository, sparePartIssueJobManager) { _sparePartIssueJobManager = sparePartIssueJobManager; @@ -58,6 +61,7 @@ public class SparePartIssueJobAppService _httpClientFactory = httpClientFactory; _options = options; _transferLibRequestAppService = transferLibRequestAppService; + _currentUser = currentUser; } [HttpPost("add-many")] @@ -190,6 +194,17 @@ public class SparePartIssueJobAppService { var sparePartIssueJob = await _repository.GetAsync(masterId).ConfigureAwait(false); sparePartIssueJob.JobStatus = EnumJobStatus.Doing; + if (sparePartIssueJob.IsClaims) + { + if (sparePartIssueJob.ClaimsUserId != _currentUser.Id.ToString()) + { + throw new UserFriendlyException($"该任务已被【{sparePartIssueJob.ClaimsUserName}】承接"); + } + } + else + { + throw new UserFriendlyException("该任务未被承接,请重新刷新页面,承接任务"); + } var sparePartIssueJobDto = ObjectMapper.Map(sparePartIssueJob); sparePartIssueJobDto.Details = new List { issueJobDetailDto }; @@ -232,6 +247,7 @@ public class SparePartIssueJobAppService } await _repository.UpdateAsync(sparePartIssueJob).ConfigureAwait(false); + await CancelAcceptAsync(masterId).ConfigureAwait(false); } /// @@ -277,6 +293,35 @@ public class SparePartIssueJobAppService } } + [HttpPost("accept/{id}")] + [UnitOfWork] + public override async Task AcceptAsync(Guid id) + { + var entity = await _repository.FindAsync(id).ConfigureAwait(false); + entity.IsClaims = true; + entity.ClaimsUserName = _currentUser.UserName; + entity.ClaimsUserId = _currentUser.Id.ToString(); + entity.AcceptTime = Clock.Now; + await _repository.UpdateAsync(entity).ConfigureAwait(false); + } + + /// + /// 取消承接任务 + /// + /// + /// + [HttpPost("cancel-accept/{id}")] + [UnitOfWork] + public override async Task CancelAcceptAsync(Guid id) + { + var entity = await _repository.FindAsync(id).ConfigureAwait(false); + entity.IsClaims = false; + entity.ClaimsUserName = string.Empty; + entity.ClaimsUserId = string.Empty; + entity.AcceptTime = DateTime.Now; + await _repository.UpdateAsync(entity).ConfigureAwait(false); + } + #region 立库 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs index 83121b505..e48dfd201 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs @@ -6,13 +6,16 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; using Volo.Abp; using Volo.Abp.Application.Dtos; +using Volo.Abp.Domain.Entities; using Volo.Abp.ObjectMapping; using Volo.Abp.Uow; using Win_in.Sfs.Basedata.Domain.Shared; using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; @@ -56,25 +59,29 @@ public class ThirdLocationJobAppService } else { - var jobDetail= job.Details.FirstOrDefault(p => p.ItemCode == dto.Details[0].ItemCode); - - if(jobDetail==null) + foreach(var item in dto.Details) { - throw new UserFriendlyException($"任务错误:未找到物品【{dto.Details[0].ItemCode} 的明细信息"); - } - else - { - if (dto.Details[0].HandledQty > jobDetail.RecommendQty) + var jobDetail = job.Details.FirstOrDefault(p => p.ItemCode == item.ItemCode); + + if (jobDetail == null) { - throw new UserFriendlyException($"任务错误:编号为【{job.Number}】的实际数量【{dto.Details[0].HandledQty}】不能大于推荐数量【{dto.Details[0].RecommendQty}】"); + throw new UserFriendlyException($"任务错误:未找到物品【{item.ItemCode} 的明细信息"); } - if (jobDetail.ToLocationCode != dto.Details[0].ToLocationCode) + else { - throw new UserFriendlyException($"任务错误:编号为【{job.Number}】的实际目标库位【{dto.Details[0].ToLocationCode}】与申请目标库位【{jobDetail.ToLocationCode}】不一致"); + if (item.HandledQty > jobDetail.RecommendQty) + { + throw new UserFriendlyException($"任务错误:编号为【{job.Number}】的实际数量【{item.HandledQty}】不能大于推荐数量【{item.RecommendQty}】"); + } + if (jobDetail.ToLocationCode != item.ToLocationCode) + { + throw new UserFriendlyException($"任务错误:编号为【{job.Number}】的实际目标库位【{item.ToLocationCode}】与申请目标库位【{jobDetail.ToLocationCode}】不一致"); + } } - } - + } + + } @@ -107,7 +114,19 @@ public class ThirdLocationJobAppService { if (thirdLocationJob.JobStatus == EnumJobStatus.Partial) { - await _thirdLocationJobManager.CloseAsync(thirdLocationJob).ConfigureAwait(false); + thirdLocationJob.JobStatus = EnumJobStatus.Done; + await Task.CompletedTask.ConfigureAwait(false); + await LocalEventBus.PublishAsync(new SfsClosedEntityEventData(thirdLocationJob), false).ConfigureAwait(false); + await Repository.UpdateAsync(thirdLocationJob).ConfigureAwait(false); + + } + else if (thirdLocationJob.JobStatus == EnumJobStatus.Open) + { + thirdLocationJob.JobStatus = EnumJobStatus.Closed; + await Task.CompletedTask.ConfigureAwait(false); + await LocalEventBus.PublishAsync(new SfsClosedEntityEventData(thirdLocationJob), false).ConfigureAwait(false); + await Repository.UpdateAsync(thirdLocationJob).ConfigureAwait(false); + } else { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs index deeaa16ae..27e5936c6 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs @@ -22,6 +22,7 @@ using Win_in.Sfs.Shared.Domain; 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.Inventory.Domain; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; @@ -49,10 +50,13 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase locationCodes=new List(); + locationCodes.Add(detailInput.FromLocationCode); + List inventoryStatusList = new List(); + inventoryStatusList.Add(EnumInventoryStatus.OK); + + var fromLocationDto = await _locationAppService.GetByCodeAsync(detailInput.FromLocationCode).ConfigureAwait(false); + + List inventoryBalances; + if (fromLocationDto.Type== EnumLocationType.RAW) { - balanceSum += item.Qty; + inventoryBalances = await _balanceManager.GetUsableListAsync(detailInput.ItemCode, locationCodes, inventoryStatusList, true).ConfigureAwait(false); } - var expectOutNums= await _expectOutAppService.GetListByItemAsync(detailInput.ItemCode).ConfigureAwait(false); - decimal expectOutSum = 0; - foreach (var item in expectOutNums) + else { - expectOutSum += item.Qty; + inventoryBalances = await _balanceManager.GetNoPackCodeUsableListAsync(detailInput.ItemCode, locationCodes, inventoryStatusList, true).ConfigureAwait(false); } - decimal realityBalance = balanceSum - expectOutSum; - if (detailInput.Qty> realityBalance) + + decimal balanceSum = 0; + foreach (var item in inventoryBalances) { - throw new UserFriendlyException($"{detailInput.ItemCode} 物品的库存为 {realityBalance} ,库存不够"); + balanceSum += item.Qty; } - + if (detailInput.Qty > balanceSum) + { + throw new UserFriendlyException($"{detailInput.ItemCode} 物品的库存为 {balanceSum} ,库存不够"); + } + + + //var balanceNums= await _balanceAppService.GetListByLocationCodeAndItemCodeAsync(detailInput.FromLocationCode, detailInput.ItemCode).ConfigureAwait(false); + //decimal balanceSum = 0; + //foreach (var item in balanceNums) + //{ + // balanceSum += item.Qty; + //} + //var expectOutNums= await _expectOutAppService.GetListByItemAsync(detailInput.ItemCode).ConfigureAwait(false); + //decimal expectOutSum = 0; + //foreach (var item in expectOutNums) + //{ + // expectOutSum += item.Qty; + //} + //decimal realityBalance = balanceSum - expectOutSum; + //if (detailInput.Qty> realityBalance) + //{ + // throw new UserFriendlyException($"{detailInput.ItemCode} 物品的库存为 {realityBalance} ,库存不够"); + //} + + detailInput.ToLocationErpCode = toLocationDto.ErpLocationCode; @@ -212,7 +249,7 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase(request); } + /// + /// 用来重写 完成请求 + /// + /// + /// + public override async Task CompleteAsync(Guid id) + { + var request = await _repository.GetAsync(id).ConfigureAwait(false); + + if (request.RequestStatus == EnumRequestStatus.Partial) + { + request.RequestStatus = EnumRequestStatus.Completed; + await Task.CompletedTask.ConfigureAwait(false); + //await LocalEventBus.PublishAsync(new SfsCompletedEntityEventData(request), false).ConfigureAwait(false); + await _repository.UpdateAsync(request).ConfigureAwait(false); + + } + else + { + throw new UserFriendlyException($"【{request.RequestStatus.GetDisplayName()}】状态不允许取消"); + } + var entitys = await _thirdLocationJobRepository.GetListAsync(p => p.RequestNumber == request.Number, "", true).ConfigureAwait(false); + + if (entitys.Any()) + { + foreach (var thirdLocationJob in entitys) + { + if (thirdLocationJob.JobStatus == EnumJobStatus.Partial) + { + thirdLocationJob.JobStatus = EnumJobStatus.Done; + await Task.CompletedTask.ConfigureAwait(false); + await LocalEventBus.PublishAsync(new SfsClosedEntityEventData(thirdLocationJob), false).ConfigureAwait(false); + await _thirdLocationJobRepository.UpdateAsync(thirdLocationJob).ConfigureAwait(false); + } + else if (thirdLocationJob.JobStatus == EnumJobStatus.Open || thirdLocationJob.JobStatus == EnumJobStatus.Doing) + { + thirdLocationJob.JobStatus = EnumJobStatus.Closed; + await Task.CompletedTask.ConfigureAwait(false); + await LocalEventBus.PublishAsync(new SfsClosedEntityEventData(thirdLocationJob), false).ConfigureAwait(false); + await _thirdLocationJobRepository.UpdateAsync(thirdLocationJob).ConfigureAwait(false); + } + else + { + + } + } + } + + return ObjectMapper.Map(request); + } + + /// /// 赋值Request业务属性 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJob.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJob.cs index 4448b1291..8953f13d3 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJob.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJob.cs @@ -45,4 +45,25 @@ public class AssembleIssueJob : SfsJobAggregateRootBase public override List Details { get; set; } = new List(); public EnumIssueSendType EnumIssueSendType { get; set; } + + /// + /// 已承接 + /// + /// + [Display(Name = "是否已承接")] + public bool IsClaims { get; set; } + + /// + /// 承接人ID + /// + /// + [Display(Name = "承接人ID")] + public string ClaimsUserId { get; set; } + + /// + /// 承接人 + /// + /// + [Display(Name = "承接人")] + public string ClaimsUserName { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJob.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJob.cs index 0792f221b..5f3809163 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJob.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJob.cs @@ -41,4 +41,25 @@ public class CoatingIssueJob : SfsJobAggregateRootBase public override List Details { get; set; } = new List(); public EnumIssueSendType EnumIssueSendType { get; set; } + + /// + /// 已承接 + /// + /// + [Display(Name = "是否已承接")] + public bool IsClaims { get; set; } + + /// + /// 承接人ID + /// + /// + [Display(Name = "承接人ID")] + public string ClaimsUserId { get; set; } + + /// + /// 承接人 + /// + /// + [Display(Name = "承接人")] + public string ClaimsUserName { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJob.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJob.cs index 866fc727e..a9ef3dde0 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJob.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJob.cs @@ -41,4 +41,25 @@ public class InjectionIssueJob : SfsJobAggregateRootBase Details { get; set; } = new List(); public EnumIssueSendType EnumIssueSendType { get; set; } + + /// + /// 已承接 + /// + /// + [Display(Name = "是否已承接")] + public bool IsClaims { get; set; } + + /// + /// 承接人ID + /// + /// + [Display(Name = "承接人ID")] + public string ClaimsUserId { get; set; } + + /// + /// 承接人 + /// + /// + [Display(Name = "承接人")] + public string ClaimsUserName { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJob.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJob.cs index 5d4cf2c24..41d448a07 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJob.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJob.cs @@ -41,4 +41,25 @@ public class KittingIssueJob : SfsJobAggregateRootBase public override List Details { get; set; } = new List(); public EnumIssueSendType EnumIssueSendType { get; set; } + + /// + /// 已承接 + /// + /// + [Display(Name = "是否已承接")] + public bool IsClaims { get; set; } + + /// + /// 承接人ID + /// + /// + [Display(Name = "承接人ID")] + public string ClaimsUserId { get; set; } + + /// + /// 承接人 + /// + /// + [Display(Name = "承接人")] + public string ClaimsUserName { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJob.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJob.cs index 555d606cc..b08d20359 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJob.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJob.cs @@ -41,4 +41,25 @@ public class SparePartIssueJob : SfsJobAggregateRootBase Details { get; set; } = new List(); public EnumIssueSendType EnumIssueSendType { get; set; } + + /// + /// 已承接 + /// + /// + [Display(Name = "是否已承接")] + public bool IsClaims { get; set; } + + /// + /// 承接人ID + /// + /// + [Display(Name = "承接人ID")] + public string ClaimsUserId { get; set; } + + /// + /// 承接人 + /// + /// + [Display(Name = "承接人")] + public string ClaimsUserName { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/SfsJobManagerBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/SfsJobManagerBase.cs index 5d16fbc0c..8d7459ab0 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/SfsJobManagerBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/SfsJobManagerBase.cs @@ -219,6 +219,7 @@ public abstract class SfsJobManagerBase validStatuses = new List { EnumJobStatus.Open, + EnumJobStatus.Doing, EnumJobStatus.Closed, }; break; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/KittingPackagingNotes/KittingPackagingNoteChassisDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/KittingPackagingNotes/KittingPackagingNoteChassisDetail.cs index e1349a47e..8615428c9 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/KittingPackagingNotes/KittingPackagingNoteChassisDetail.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/KittingPackagingNotes/KittingPackagingNoteChassisDetail.cs @@ -9,11 +9,18 @@ public class KittingPackagingNoteChassisDetail : SfsStoreDetailEntityBase /// 底盘号 /// [Display(Name = "底盘号")] - public long ChassisNumber { get; set; } + //public long ChassisNumber { get; set; } + public string ChassisNumber { get; set; } //lyf at 20240613 /// /// Kitting代码 /// [Display(Name = "Kitting代码")] public string KittingCode { get; set; } + + /// + /// 底盘号排序序列 + /// + [Display(Name = "底盘号排序序列")] + public long ChassisSortNumber { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/KittingPackagingNotes/KittingPackagingNoteDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/KittingPackagingNotes/KittingPackagingNoteDbContextModelCreatingExtensions.cs index 2ee0c6e2e..09c22253e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/KittingPackagingNotes/KittingPackagingNoteDbContextModelCreatingExtensions.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/KittingPackagingNotes/KittingPackagingNoteDbContextModelCreatingExtensions.cs @@ -53,6 +53,7 @@ public static class KittingPackagingNoteDbContextModelCreatingExtensions b.ConfigureSfsBase(); //Properties b.Property(q => q.KittingCode).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.ChassisNumber).HasMaxLength(SfsPropertyConst.CodeLength); //Indexes }); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/AssembleIssueRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/AssembleIssueRequestAutoMapperProfile.cs index c96d98feb..7df1b8d63 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/AssembleIssueRequestAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/AssembleIssueRequestAutoMapperProfile.cs @@ -13,6 +13,9 @@ public partial class StoreEventAutoMapperProfile : Profile { CreateMap() .ForMember(x => x.AssembleRequestNumber, y => y.MapFrom(d => d.Number)) + .ForMember(x => x.IsClaims, y => y.MapFrom(d => false)) + .Ignore(x => x.ClaimsUserName) + .Ignore(x => x.ClaimsUserId) .Ignore(x => x.WarehouseCode) .Ignore(x => x.UpStreamJobNumber) .Ignore(x => x.JobType) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/CoatingIssueRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/CoatingIssueRequestAutoMapperProfile.cs index 12561b673..b56b1c920 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/CoatingIssueRequestAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/CoatingIssueRequestAutoMapperProfile.cs @@ -13,6 +13,9 @@ public partial class StoreEventAutoMapperProfile : Profile { CreateMap() .ForMember(x => x.CoatingRequestNumber, y => y.MapFrom(d => d.Number)) + .ForMember(x => x.IsClaims, y => y.MapFrom(d => false)) + .Ignore(x => x.ClaimsUserName) + .Ignore(x => x.ClaimsUserId) .Ignore(x => x.WarehouseCode) .Ignore(x => x.UpStreamJobNumber) .Ignore(x => x.JobType) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/InjectionIssueRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/InjectionIssueRequestAutoMapperProfile.cs index 8cdd7e8df..5d1ad348d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/InjectionIssueRequestAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/InjectionIssueRequestAutoMapperProfile.cs @@ -13,6 +13,9 @@ public partial class StoreEventAutoMapperProfile : Profile { CreateMap() .ForMember(x => x.InjectionRequestNumber, y => y.MapFrom(d => d.Number)) + .ForMember(x => x.IsClaims, y => y.MapFrom(d => false)) + .Ignore(x => x.ClaimsUserName) + .Ignore(x => x.ClaimsUserId) .Ignore(x => x.WarehouseCode) .Ignore(x => x.UpStreamJobNumber) .Ignore(x => x.JobType) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/KittingIssueRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/KittingIssueRequestAutoMapperProfile.cs index 5333732f1..184df3f8c 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/KittingIssueRequestAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/KittingIssueRequestAutoMapperProfile.cs @@ -13,6 +13,9 @@ public partial class StoreEventAutoMapperProfile : Profile { CreateMap() .ForMember(x => x.KittingRequestNumber, y => y.MapFrom(d => d.Number)) + .ForMember(x => x.IsClaims, y => y.MapFrom(d => false)) + .Ignore(x => x.ClaimsUserName) + .Ignore(x => x.ClaimsUserId) .Ignore(x => x.WarehouseCode) .Ignore(x => x.UpStreamJobNumber) .Ignore(x => x.JobType) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/SparePartIssueRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/SparePartIssueRequestAutoMapperProfile.cs index 63874e5d7..1146f1f90 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/SparePartIssueRequestAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/SparePartIssueRequestAutoMapperProfile.cs @@ -13,6 +13,9 @@ public partial class StoreEventAutoMapperProfile : Profile { CreateMap() .ForMember(x => x.SparePartRequestNumber, y => y.MapFrom(d => d.Number)) + .ForMember(x => x.IsClaims, y => y.MapFrom(d => false)) + .Ignore(x => x.ClaimsUserName) + .Ignore(x => x.ClaimsUserId) .Ignore(x => x.WarehouseCode) .Ignore(x => x.UpStreamJobNumber) .Ignore(x => x.JobType) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs index af8b6ad51..43c45a438 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Microsoft.AspNetCore.Routing.Matching; using Volo.Abp.EventBus; using Volo.Abp.Uow; using Win_in.Sfs.Basedata.Application.Contracts; @@ -24,13 +25,15 @@ public class ThirdLocationJobEventHandler : private readonly ILocationAppService _locationAppService; private readonly IThirdLocationRequestManager _thirdLocationRequestManager; private readonly ITransferLogAppService _transferLogAppService; + private readonly IThirdLocationJobRepository _thirdLocationJobRepository; - public ThirdLocationJobEventHandler(IThirdLocationNoteAppService thirdLocationNoteAppService, ITransferLogAppService transferLogAppService, IThirdLocationRequestManager thirdLocationRequestManager, ILocationAppService locationAppService) + public ThirdLocationJobEventHandler(IThirdLocationNoteAppService thirdLocationNoteAppService, IThirdLocationJobRepository thirdLocationJobRepository, ITransferLogAppService transferLogAppService, IThirdLocationRequestManager thirdLocationRequestManager, ILocationAppService locationAppService) { _thirdLocationNoteAppService = thirdLocationNoteAppService; _locationAppService = locationAppService; _thirdLocationRequestManager = thirdLocationRequestManager; _transferLogAppService = transferLogAppService; + _thirdLocationJobRepository = thirdLocationJobRepository; } /// @@ -119,21 +122,39 @@ public class ThirdLocationJobEventHandler : var transferLogs = new List(); - transferLogs.AddRange(await BuildCancelTransferLogsAsync(thirdLocationRequest).ConfigureAwait(false)); + transferLogs.AddRange(await BuildCancelTransferLogsAsync(thirdLocationRequest, entity.Details[0].ItemCode).ConfigureAwait(false)); await _transferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); - thirdLocationRequest.RequestStatus = EnumRequestStatus.Abort; - await _thirdLocationRequestManager.UpdateAsync(thirdLocationRequest).ConfigureAwait(false); + var jobEntities = await _thirdLocationJobRepository.GetListAsync(p => p.RequestNumber == entity.RequestNumber, "Number", true).ConfigureAwait(false); + bool isDone = false; + foreach (var job in jobEntities.Where(p=>p.Number!= entity.Number)) + { + if(job.JobStatus == EnumJobStatus.Done || job.JobStatus == EnumJobStatus.Closed) + { + isDone = true; + } + else + { + isDone = false; + } + + } + if(isDone) + { + thirdLocationRequest.RequestStatus = EnumRequestStatus.Completed; + await _thirdLocationRequestManager.UpdateAsync(thirdLocationRequest).ConfigureAwait(false); + } + } } - private async Task> BuildCancelTransferLogsAsync(ThirdLocationRequest thirdLocationRequest) + private async Task> BuildCancelTransferLogsAsync(ThirdLocationRequest thirdLocationRequest,string itemCode) { var transferLogs = new List(); - foreach (var detail in thirdLocationRequest.Details.Where(detail => detail.IssuedQty-detail.ReceivedQty != 0)) + foreach (var detail in thirdLocationRequest.Details.Where(detail => detail.IssuedQty-detail.ReceivedQty != 0 && detail.ItemCode== itemCode)) { var transferLog = ObjectMapper.Map(detail); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ThirdLocationRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ThirdLocationRequestEventHandler.cs index 783808a45..0eab56632 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ThirdLocationRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ThirdLocationRequestEventHandler.cs @@ -306,13 +306,18 @@ public class ThirdLocationRequestEventHandler } var fromLocation = await _locationAppService.GetByCodeAsync(thirdLocationRequestDetail.FromLocationCode).ConfigureAwait(false); - var job = jobs.FirstOrDefault(p => p.WorkGroupCode == fromLocation?.WorkGroupCode); - if (job == null || job.Details.Any(p => p.ToLocationCode != thirdLocationRequestDetail.ToLocationCode)) - { - job = BuildThirdLocationJobCreateInput(thirdLocationRequest, fromLocation); - jobs.Add(job); - } + + var job = BuildThirdLocationJobCreateInput(thirdLocationRequest, fromLocation); job.Details.AddRange(jobDetails); + jobs.Add(job); + + //var job = jobs.FirstOrDefault(p => p.WorkGroupCode == fromLocation?.WorkGroupCode); + //if (job == null || job.Details.Any(p => p.ToLocationCode != thirdLocationRequestDetail.ToLocationCode)) + //{ + // job = BuildThirdLocationJobCreateInput(thirdLocationRequest, fromLocation); + // jobs.Add(job); + //} + //job.Details.AddRange(jobDetails); }