From b96ce0a45451c34d7c108c577ae3cf70aef84826 Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Thu, 13 Jun 2024 08:57:15 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E4=B8=89=E6=96=B9=E5=BA=93=E7=BB=88?= =?UTF-8?q?=E6=AD=A2=E5=8A=9F=E8=83=BD=E6=94=B9=E6=88=90=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ThirdLocationJobs/ThirdLocationJobAppService.cs | 11 ++++++++++- .../Jobs/ThirdLocationJobEventHandler.cs | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) 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..9707f05ec 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; @@ -107,7 +110,13 @@ 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); + + //await _thirdLocationJobManager.CloseAsync(thirdLocationJob).ConfigureAwait(false); + } else { 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..aa86d7425 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 @@ -123,7 +123,7 @@ public class ThirdLocationJobEventHandler : await _transferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); - thirdLocationRequest.RequestStatus = EnumRequestStatus.Abort; + thirdLocationRequest.RequestStatus = EnumRequestStatus.Completed; await _thirdLocationRequestManager.UpdateAsync(thirdLocationRequest).ConfigureAwait(false); } From 58d849ff79e046905ccfdc4ddf0e9aa4b50164c3 Mon Sep 17 00:00:00 2001 From: liuyunfeng Date: Thu, 13 Jun 2024 10:31:19 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9kitting=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Jobs/TransferLibJobController.cs | 2 +- .../KittingPackagingNoteChassisDetail.cs | 9 ++++++++- ...ttingPackagingNoteDbContextModelCreatingExtensions.cs | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) 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/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 }); } From 8cee51fdc6776954242b4e4195d84b6aceb40178 Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Thu, 13 Jun 2024 14:01:23 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E4=B8=89=E6=96=B9=E5=BA=93=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=AF=B7=E6=B1=82=E5=AE=8C=E6=88=90=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Stores/ThirdLocationRequestController.cs | 13 +++++ .../ThirdLocationJobAppService.cs | 30 +++++----- .../ThirdLocationRequestAppService.cs | 55 +++++++++++++++++++ .../Jobs/ThirdLocationJobEventHandler.cs | 33 +++++++++-- .../ThirdLocationRequestEventHandler.cs | 17 ++++-- 5 files changed, 123 insertions(+), 25 deletions(-) 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/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 9707f05ec..23af60ffa 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 @@ -59,25 +59,29 @@ public class ThirdLocationJobAppService } else { - var jobDetail= job.Details.FirstOrDefault(p => p.ItemCode == dto.Details[0].ItemCode); - - if(jobDetail==null) - { - throw new UserFriendlyException($"任务错误:未找到物品【{dto.Details[0].ItemCode} 的明细信息"); - } - else + foreach(var item in dto.Details) { - 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}】不一致"); + } } - } - + } + + } 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..b3075b3ac 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 @@ -49,10 +49,12 @@ 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.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.Event/Jobs/ThirdLocationJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs index aa86d7425..1556e7251 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.Completed; - 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) + { + 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); } From 62d0b3c698673ffe39591312955849d1c97d9f33 Mon Sep 17 00:00:00 2001 From: "boxu.zheng" Date: Thu, 13 Jun 2024 17:22:49 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E5=8F=91=E6=96=99?= =?UTF-8?q?=E7=9A=84=E6=89=BF=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DTOs/AssembleIssueJobDTO.cs | 20 ++++++++++ .../Inputs/AssembleIssueJobEditInput.cs | 21 +++++++++++ .../DTOs/CoatingIssueJobDTO.cs | 21 +++++++++++ .../Inputs/CoatingIssueJobEditInput.cs | 21 +++++++++++ .../DTOs/InjectionIssueJobDTO.cs | 21 +++++++++++ .../Inputs/InjectionIssueJobEditInput.cs | 21 +++++++++++ .../DTOs/KittingIssueJobDTO.cs | 21 +++++++++++ .../Inputs/KittingIssueJobEditInput.cs | 21 +++++++++++ .../DTOs/SparePartIssueJobDTO.cs | 21 +++++++++++ .../Inputs/SparePartIssueJobEditInput.cs | 21 +++++++++++ .../AssembleIssueJobAppService.cs | 37 ++++++++++++++++++- .../CoatingIssueJobAppService.cs | 35 +++++++++++++++++- .../InjectionIssueJobAppService.cs | 35 +++++++++++++++++- .../KittingIssueJobAppService.cs | 35 +++++++++++++++++- .../SparePartIssueJobAppService.cs | 35 +++++++++++++++++- .../AssembleIssueJobs/AssembleIssueJob.cs | 21 +++++++++++ .../CoatingIssueJobs/CoatingIssueJob.cs | 21 +++++++++++ .../InjectionIssueJobs/InjectionIssueJob.cs | 21 +++++++++++ .../KittingIssueJobs/KittingIssueJob.cs | 21 +++++++++++ .../SparePartIssueJobs/SparePartIssueJob.cs | 21 +++++++++++ .../AssembleIssueRequestAutoMapperProfile.cs | 3 ++ .../CoatingIssueRequestAutoMapperProfile.cs | 3 ++ .../InjectionIssueRequestAutoMapperProfile.cs | 3 ++ .../KittingIssueRequestAutoMapperProfile.cs | 3 ++ .../SparePartIssueRequestAutoMapperProfile.cs | 3 ++ 25 files changed, 501 insertions(+), 5 deletions(-) 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 541fbf282..c391bd22a 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; } @@ -292,6 +298,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..f24e687d5 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 @@ -14,6 +14,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; @@ -42,6 +44,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 +56,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 +66,7 @@ public class CoatingIssueJobAppService _httpClientFactory = httpClientFactory; _options = options; _transferLibRequestAppService = transferLibRequestAppService; + _currentUser = currentUser; _logger = logger; } @@ -306,6 +310,35 @@ 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..9604c5cb0 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) @@ -285,6 +289,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..067b61a3b 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")] @@ -284,6 +288,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..a78a1d3c9 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")] @@ -277,6 +281,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.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.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) From eade7087b13b7924898533f58025b2c97ce69876 Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Thu, 13 Jun 2024 17:27:38 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E4=B8=89=E6=96=B9=E5=BA=93=E5=BE=85?= =?UTF-8?q?=E5=A4=84=E7=90=86=E7=8A=B6=E6=80=81=E4=B9=9F=E8=83=BD=E5=85=B3?= =?UTF-8?q?=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ThirdLocationJobs/ThirdLocationJobAppService.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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 23af60ffa..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 @@ -118,8 +118,14 @@ public class ThirdLocationJobAppService await Task.CompletedTask.ConfigureAwait(false); await LocalEventBus.PublishAsync(new SfsClosedEntityEventData(thirdLocationJob), false).ConfigureAwait(false); await Repository.UpdateAsync(thirdLocationJob).ConfigureAwait(false); - - //await _thirdLocationJobManager.CloseAsync(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 From 1c809ba320a2b5602c3473912070ef9d3ae92126 Mon Sep 17 00:00:00 2001 From: "boxu.zheng" Date: Fri, 14 Jun 2024 08:57:25 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E5=8F=91=E6=96=99?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=89=BF=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AssembleIssueJobAppService.cs | 12 +++++++++++ .../CoatingIssueJobAppService.cs | 21 ++++++++++++++++++- .../InjectionIssueJobAppService.cs | 12 +++++++++++ .../KittingIssueJobAppService.cs | 12 +++++++++++ .../SparePartIssueJobAppService.cs | 12 +++++++++++ 5 files changed, 68 insertions(+), 1 deletion(-) 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 9d964a877..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 @@ -210,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 }; @@ -253,6 +264,7 @@ public class AssembleIssueJobAppService } await _repository.UpdateAsync(assembleIssueJob).ConfigureAwait(false); + await CancelAcceptAsync(masterId).ConfigureAwait(false); } /// 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 f24e687d5..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,12 +7,14 @@ 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; @@ -208,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); @@ -265,6 +278,7 @@ public class CoatingIssueJobAppService } await _repository.UpdateAsync(coatingIssueJob).ConfigureAwait(false); + await CancelAcceptAsync(masterId).ConfigureAwait(false); } /// @@ -310,6 +324,11 @@ public class CoatingIssueJobAppService } } + /// + /// 承接任务 + /// + /// + /// [HttpPost("accept/{id}")] [UnitOfWork] public override async Task AcceptAsync(Guid id) 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 9604c5cb0..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 @@ -202,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 }; @@ -244,6 +255,7 @@ public class InjectionIssueJobAppService } await _repository.UpdateAsync(injectionIssueJob).ConfigureAwait(false); + await CancelAcceptAsync(masterId).ConfigureAwait(false); } /// 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 067b61a3b..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 @@ -201,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 }; @@ -243,6 +254,7 @@ public class KittingIssueJobAppService } await _repository.UpdateAsync(kittingIssueJob).ConfigureAwait(false); + await CancelAcceptAsync(masterId).ConfigureAwait(false); } /// 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 a78a1d3c9..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 @@ -194,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 }; @@ -236,6 +247,7 @@ public class SparePartIssueJobAppService } await _repository.UpdateAsync(sparePartIssueJob).ConfigureAwait(false); + await CancelAcceptAsync(masterId).ConfigureAwait(false); } /// From 44d58f76f9c00e92470a5d16d1671d718ffb9cc2 Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Fri, 14 Jun 2024 08:58:09 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Jobs/ThirdLocationJobEventHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 1556e7251..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 @@ -130,7 +130,7 @@ public class ThirdLocationJobEventHandler : bool isDone = false; foreach (var job in jobEntities.Where(p=>p.Number!= entity.Number)) { - if(job.JobStatus == EnumJobStatus.Done) + if(job.JobStatus == EnumJobStatus.Done || job.JobStatus == EnumJobStatus.Closed) { isDone = true; } From 06786068a2d94f7e11c140bc3b39f59346c04aea Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Fri, 14 Jun 2024 11:04:42 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E5=BA=93=E5=AD=98=E4=BD=99=E9=A2=9D?= =?UTF-8?q?=E6=8C=89=E5=BA=93=E4=BD=8D=E7=B1=BB=E5=9E=8B=E5=8C=BA=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ThirdLocationRequestAppService.cs | 60 +++++++++++++++---- 1 file changed, 47 insertions(+), 13 deletions(-) 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 b3075b3ac..e480576c1 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; @@ -50,6 +51,7 @@ 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); + } + else + { + inventoryBalances = await _balanceManager.GetUsableListAsync(detailInput.ItemCode, locationCodes, inventoryStatusList, false).ConfigureAwait(false); } - var expectOutNums= await _expectOutAppService.GetListByItemAsync(detailInput.ItemCode).ConfigureAwait(false); - decimal expectOutSum = 0; - foreach (var item in expectOutNums) + + decimal balanceSum = 0; + foreach (var item in inventoryBalances) { - expectOutSum += item.Qty; + balanceSum += item.Qty; } - decimal realityBalance = balanceSum - expectOutSum; - if (detailInput.Qty> realityBalance) + + if (detailInput.Qty > balanceSum) { - throw new UserFriendlyException($"{detailInput.ItemCode} 物品的库存为 {realityBalance} ,库存不够"); + 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; From 5de4b01a6cd7c346b241f75274c2f76ea7a354cb Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Fri, 14 Jun 2024 11:59:20 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E6=88=90=E5=93=81=E5=92=8C=E5=8D=8A?= =?UTF-8?q?=E6=88=90=E5=93=81=E6=8C=89=E6=97=A0=E7=AE=B1=E7=A0=81=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E5=BA=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Balances/BalanceManager.cs | 106 ++++++++++++++++++ .../Balances/IBalanceManager.cs | 4 + .../ThirdLocationRequestAppService.cs | 2 +- 3 files changed, 111 insertions(+), 1 deletion(-) 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/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs index e480576c1..a199ce6ed 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 @@ -167,7 +167,7 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase Date: Fri, 14 Jun 2024 13:34:05 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E4=BB=BB=E5=8A=A1doing=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E4=B9=9F=E5=8F=AF=E4=BB=A5=E5=8F=96=E6=B6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ThirdLocationRequests/ThirdLocationRequestAppService.cs | 4 ++-- .../src/Win_in.Sfs.Wms.Store.Domain/Jobs/SfsJobManagerBase.cs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) 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 a199ce6ed..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 @@ -249,7 +249,7 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase(thirdLocationJob), false).ConfigureAwait(false); await _thirdLocationJobRepository.UpdateAsync(thirdLocationJob).ConfigureAwait(false); } - else if (thirdLocationJob.JobStatus == EnumJobStatus.Open) + else if (thirdLocationJob.JobStatus == EnumJobStatus.Open || thirdLocationJob.JobStatus == EnumJobStatus.Doing) { thirdLocationJob.JobStatus = EnumJobStatus.Closed; await Task.CompletedTask.ConfigureAwait(false); 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;