From 1abdb127068876cb6885f3da901b238ed5a11dc1 Mon Sep 17 00:00:00 2001 From: "boxu.zheng" Date: Tue, 10 Sep 2024 11:13:53 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E5=8F=98=E4=B8=BA=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Outgoing/CustomerReturnNoteConverter.cs | 4 +++- .../Outgoing/DeliverNoteConverter.cs | 21 +++++++++++++------ .../Outgoing/IssueNoteConverter.cs | 2 +- .../RecycledMaterialReceiptNoteConverter.cs | 12 ++++++----- .../Departments/DepartmentAppService.cs | 12 +++++++++-- .../src/Win_in.Sfs.Auth.Web/appsettings.json | 1 + 6 files changed, 37 insertions(+), 15 deletions(-) diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/CustomerReturnNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/CustomerReturnNoteConverter.cs index 0d538caac..8ae33abda 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/CustomerReturnNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/CustomerReturnNoteConverter.cs @@ -101,10 +101,12 @@ public class CustomerReturnNoteConverter : IOutgoingConverter return outgoingToExternalList; } + /// /// 构建主表 /// /// + /// /// private Wmsoutm BuildDataInterface(CustomerReturnNoteExchangeDto exchangeOrder, string departmentCode) { @@ -117,7 +119,7 @@ public class CustomerReturnNoteConverter : IOutgoingConverter wmsoutm_stat = "Y", wmsoutm_tyrp_dt = "", wmsoutm_user ="WMS", - wmsoutm_dept = "",//根据Worker从UserDepartment中获取 + wmsoutm_dept = departmentCode,//根据Worker从UserDepartment中获取 wmsoutm_date = DateTime.Now.ToString("yyyyMMdd"), wmsoutm_cust = exchangeOrder.Customer, wmsoutm_shm_nbr = "", diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/DeliverNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/DeliverNoteConverter.cs index 7c71a5729..5c5fe076b 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/DeliverNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/DeliverNoteConverter.cs @@ -3,7 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Text.Json; using System.Threading.Tasks; +using Microsoft.Extensions.Configuration; using Volo.Abp.ObjectMapping; +using Win_in.Sfs.Auth.Application.Contracts; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Wms.DataExchange.Domain; using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; @@ -18,7 +20,8 @@ public class DeliverNoteConverter : IOutgoingConverter private readonly string billtype = "1003"; private readonly IOutgoingFromWmsManager _outgoingFromWmsManager; private readonly IOutgoingToExternalManager _outgoingToExternalManager; - // private readonly IUserDepartmentAppService _departmentAppService; + private readonly IDepartmentAppService _departmentAppService; + private readonly IConfiguration _configuration; private readonly IObjectMapper _objectMapper; private readonly ISalePriceSheetAppService _salePriceSheetAppService; @@ -26,13 +29,14 @@ public class DeliverNoteConverter : IOutgoingConverter IOutgoingFromWmsManager outgoingFromWmsManager , IOutgoingToExternalManager outgoingToExternalManager , IObjectMapper objectMapper, - ISalePriceSheetAppService salePriceSheetAppService - ) + ISalePriceSheetAppService salePriceSheetAppService, IConfiguration configuration, IDepartmentAppService departmentAppService) { _outgoingFromWmsManager = outgoingFromWmsManager; _outgoingToExternalManager = outgoingToExternalManager; _objectMapper = objectMapper; _salePriceSheetAppService = salePriceSheetAppService; + _configuration = configuration; + _departmentAppService = departmentAppService; } /// @@ -52,6 +56,10 @@ public class DeliverNoteConverter : IOutgoingConverter var wmsReceipt = JsonSerializer.Deserialize(outgoingFromWms.DataContent); #region 明细 var WipDetails = wmsReceipt.Details.GroupBy(r => new { r.Number, r.ItemCode, r.FromLocationErpCode }).Select(p => new DeliverNoteDetailExchangeDto { Qty = p.Sum(itm => itm.Qty), Number = p.Key.Number, ItemCode = p.Key.ItemCode, FromLocationErpCode = p.Key.FromLocationErpCode }); + + var department = await _departmentAppService.GetByUsernameAsync(wmsReceipt.Worker).ConfigureAwait(false); + var departmentCode = department == null ? "" : department.Code; + foreach (var detail in WipDetails) { var item= await _salePriceSheetAppService.GetByItemCodeAndCustomerCode(detail.ItemCode, wmsReceipt.CustomerCode); @@ -85,7 +93,7 @@ public class DeliverNoteConverter : IOutgoingConverter if (flag) { var exchangeReceipt = _objectMapper.Map(wmsReceipt); - var purchaseOrder = BuildDataInterface(exchangeReceipt, tyrpNumber); + var purchaseOrder = BuildDataInterface(exchangeReceipt, tyrpNumber, departmentCode); var outgoingToExternal = new OutgoingToExternal() { DataType = EnumOutgoingDataType.Deliver.ToString(), @@ -125,7 +133,7 @@ public class DeliverNoteConverter : IOutgoingConverter /// /// /// - private Wmsoutm BuildDataInterface(DeliverNoteExchangeDto exchangeOrder,string tyrpNumber) + private Wmsoutm BuildDataInterface(DeliverNoteExchangeDto exchangeOrder,string tyrpNumber,string departmentCode) { var ret = new Wmsoutm() @@ -136,7 +144,7 @@ public class DeliverNoteConverter : IOutgoingConverter wmsoutm_stat = "Y", wmsoutm_tyrp_dt = "", wmsoutm_user = "WMS", - wmsoutm_dept = "", + wmsoutm_dept = departmentCode, // wmsoutm_date = exchangeOrder.ActiveDate.ToString("yyyyMMdd"), wmsoutm_date = DateTime.Now.ToString("yyyyMMdd"), wmsoutm_cust = exchangeOrder.CustomerCode ?? "", @@ -150,6 +158,7 @@ public class DeliverNoteConverter : IOutgoingConverter wmsoutm_id = 0,//明细中最大scmsend_id wmsoutm_open_qty = 0, }; + return ret; } /// diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/IssueNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/IssueNoteConverter.cs index 8817630e3..9b5e42364 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/IssueNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/IssueNoteConverter.cs @@ -135,7 +135,7 @@ public class IssueNoteConverter : IOutgoingConverter scmsend_date = DateTime.Now.ToString("yyyyMMdd"), scmsend_qty = exchangeDetailOrder.Qty, scmsend_wipd_loc = exchangeDetailOrder.ToLocationErpCode, - scmsend_userid = "WMS" + scmsend_userid = "WMS", }; return ret; } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/RecycledMaterialReceiptNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/RecycledMaterialReceiptNoteConverter.cs index 72243a4cf..8c4e83014 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/RecycledMaterialReceiptNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/RecycledMaterialReceiptNoteConverter.cs @@ -39,6 +39,8 @@ public class RecycledMaterialReceiptNoteConverter : IOutgoingConverter /// public virtual async Task> ConvertAsync() { + + var outgoingToExternalList = new List(); //获取要同步得数据 var outgoingFromWmsList = await _outgoingFromWmsManager.GetToBeProcessedListAsync(EnumOutgoingDataType.RecycledMaterialReceipt, EnumSystemType.ERP).ConfigureAwait(false); @@ -48,9 +50,9 @@ public class RecycledMaterialReceiptNoteConverter : IOutgoingConverter #region 主表 var wmsReceipt = JsonSerializer.Deserialize(outgoingFromWms.DataContent); var exchangeReceipt = _objectMapper.Map(wmsReceipt); - //var department = await _departmentAppService.GetByUsernameAsync(exchangeReceipt.Worker).ConfigureAwait(false); - //var departmentCode = department == null ? "" : department.Code; - var purchaseOrder = BuildDataInterface(tyrpNumber); + var department = await _departmentAppService.GetByUsernameAsync(exchangeReceipt.Worker).ConfigureAwait(false); + var departmentCode = department == null ? "" : department.Code; + var purchaseOrder = BuildDataInterface(tyrpNumber, departmentCode); var outgoingToExternal = new OutgoingToExternal() { DataType = EnumOutgoingDataType.RecycledMaterialReceipt.ToString(), @@ -109,7 +111,7 @@ public class RecycledMaterialReceiptNoteConverter : IOutgoingConverter /// /// /// - private Wmsoutm BuildDataInterface(string tyrpNumber) + private Wmsoutm BuildDataInterface(string tyrpNumber,string departmentCode) { var ret = new Wmsoutm() @@ -120,7 +122,7 @@ public class RecycledMaterialReceiptNoteConverter : IOutgoingConverter wmsoutm_stat = "Y", wmsoutm_tyrp_dt = "", wmsoutm_user = "WMS", - wmsoutm_dept = "510800",//根据Worker从UserDepartment中获取 + wmsoutm_dept = departmentCode,//根据Worker从UserDepartment中获取 //wmsoutm_date = exchangeOrder.ActiveDate.ToString("yyyyMMdd"), wmsoutm_date = DateTime.Now.ToString("yyyyMMdd"), wmsoutm_cust = "", diff --git a/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/Departments/DepartmentAppService.cs b/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/Departments/DepartmentAppService.cs index f546528a1..7633ed318 100644 --- a/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/Departments/DepartmentAppService.cs +++ b/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/Departments/DepartmentAppService.cs @@ -1,6 +1,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; using Volo.Abp.Identity; using Win_in.Sfs.Auth.Application.Contracts; using Win_in.Sfs.Auth.Domain; @@ -17,10 +18,10 @@ public class DepartmentAppService private readonly IdentityUserManager _identityUserManager; private new readonly IDepartmentRepository _repository; + private readonly IConfiguration _configuration; public DepartmentAppService( - IDepartmentRepository repository, IdentityUserManager identityUserManager - ) : base(repository) + IDepartmentRepository repository, IdentityUserManager identityUserManager, IConfiguration configuration) : base(repository) { _repository = repository; @@ -28,6 +29,7 @@ public class DepartmentAppService base.UpdatePolicyName = DepartmentPermissions.Update; base.DeletePolicyName = DepartmentPermissions.Delete; _identityUserManager = identityUserManager; + _configuration = configuration; } [AllowAnonymous] @@ -47,6 +49,12 @@ public class DepartmentAppService } var deptDto = await GetByCodeAsync(departmentCode).ConfigureAwait(false); + if (username.ToLower() == "wms") + { + var depCode=_configuration["WmsDepCode"]; + deptDto.Code = depCode; + } + return deptDto; } diff --git a/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/appsettings.json b/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/appsettings.json index 7ec7d8dd5..be4e1c5eb 100644 --- a/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/appsettings.json +++ b/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/appsettings.json @@ -1,6 +1,7 @@ { "ConfigServer": "http://localhost:21093", "ConfigServer.Docker": "http://gateway:21093", + "WmsDepCode": "部门代码3.0" //"ConnectionStrings": { // "Default": "Server=dev.ccwin-in.com,21195;Database=WmsAuth;uid=ccwin-in;pwd=Microsoft@2022;Packet Size=512;", // "Auth": "Server=dev.ccwin-in.com,21195;Database=WmsAuth;uid=ccwin-in;pwd=Microsoft@2022;Packet Size=512;" From f8e1237727c3b3b8cf8c7f8120fefe2d5b02c2d9 Mon Sep 17 00:00:00 2001 From: "boxu.zheng" Date: Tue, 10 Sep 2024 11:37:09 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E7=AE=B1=E7=A0=81?= =?UTF-8?q?=E6=9F=A5=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IssueJobs/AssembleIssueJobsController.cs | 11 ++ .../IssueJobs/CoatingIssueJobsController.cs | 11 ++ .../IssueJobs/InjectionIssueJobsController.cs | 11 ++ .../IssueJobs/KittingIssueJobsController.cs | 11 ++ .../IssueJobs/SparePartIssueJobsController.cs | 11 ++ .../IAssembleIssueJobAppService.cs | 1 + .../ICoatingIssueJobAppService.cs | 1 + .../IInjectionIssueJobAppService.cs | 1 + .../IKittingIssueJobAppService.cs | 1 + .../ISparePartIssueJobAppService.cs | 1 + .../AssembleIssueJobAppService.cs | 154 +++++++++--------- .../CoatingIssueJobAppService.cs | 12 ++ .../InjectionIssueJobAppService.cs | 12 ++ .../KittingIssueJobAppService.cs | 13 ++ .../SparePartIssueJobAppService.cs | 13 ++ 15 files changed, 189 insertions(+), 75 deletions(-) diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/AssembleIssueJobsController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/AssembleIssueJobsController.cs index d9a2a3487..06d40b9eb 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/AssembleIssueJobsController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/AssembleIssueJobsController.cs @@ -189,4 +189,15 @@ public class AssembleIssueJobsController : AbpController { return await _assembleIssueJobAppService.GetByRequestNumberAsync(requestNumber).ConfigureAwait(false); } + + /// + /// 按箱码获取任务 + /// + /// + /// + [HttpPost("get-job-by-packing/{packingCode}")] + public virtual async Task GetJobByPackingCode(string packingCode) + { + return await _assembleIssueJobAppService.GetJobByPackingCodeAsync(packingCode).ConfigureAwait(false); + } } diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/CoatingIssueJobsController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/CoatingIssueJobsController.cs index 3ef708283..26b5b65fa 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/CoatingIssueJobsController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/CoatingIssueJobsController.cs @@ -189,4 +189,15 @@ public class CoatingIssueJobsController : AbpController { return await _coatingIssueJobAppService.GetByRequestNumberAsync(requestNumber).ConfigureAwait(false); } + + /// + /// 按箱码获取任务 + /// + /// + /// + [HttpPost("get-job-by-packing/{packingCode}")] + public virtual async Task GetJobByPackingCode(string packingCode) + { + return await _coatingIssueJobAppService.GetJobByPackingCodeAsync(packingCode).ConfigureAwait(false); + } } diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/InjectionIssueJobsController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/InjectionIssueJobsController.cs index 80044277c..197e8cbd4 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/InjectionIssueJobsController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/InjectionIssueJobsController.cs @@ -189,4 +189,15 @@ public class InjectionIssueJobsController : AbpController { return await _injectionIssueJobAppService.GetByRequestNumberAsync(requestNumber).ConfigureAwait(false); } + + /// + /// 按箱码获取任务 + /// + /// + /// + [HttpPost("get-job-by-packing/{packingCode}")] + public virtual async Task GetJobByPackingCode(string packingCode) + { + return await _injectionIssueJobAppService.GetJobByPackingCodeAsync(packingCode).ConfigureAwait(false); + } } diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/KittingIssueJobsController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/KittingIssueJobsController.cs index a9b46de89..9386bfc88 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/KittingIssueJobsController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/KittingIssueJobsController.cs @@ -188,4 +188,15 @@ public class KittingIssueJobsController : AbpController { return await _kittingIssueJobAppService.GetByRequestNumberAsync(requestNumber).ConfigureAwait(false); } + + /// + /// 按箱码获取任务 + /// + /// + /// + [HttpPost("get-job-by-packing/{packingCode}")] + public virtual async Task GetJobByPackingCode(string packingCode) + { + return await _kittingIssueJobAppService.GetJobByPackingCodeAsync(packingCode).ConfigureAwait(false); + } } diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/SparePartIssueJobsController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/SparePartIssueJobsController.cs index e2ddfe366..7caaaa07f 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/SparePartIssueJobsController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/SparePartIssueJobsController.cs @@ -188,4 +188,15 @@ public class SparePartIssueJobsController : AbpController { return await _sparePartIssueJobAppService.GetByRequestNumberAsync(requestNumber).ConfigureAwait(false); } + + /// + /// 按箱码获取任务 + /// + /// + /// + [HttpPost("get-job-by-packing/{packingCode}")] + public virtual async Task GetJobByPackingCode(string packingCode) + { + return await _sparePartIssueJobAppService.GetJobByPackingCodeAsync(packingCode).ConfigureAwait(false); + } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleIssueJobs/IAssembleIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleIssueJobs/IAssembleIssueJobAppService.cs index 20a932137..750e7ee2f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleIssueJobs/IAssembleIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleIssueJobs/IAssembleIssueJobAppService.cs @@ -27,4 +27,5 @@ public interface IAssembleIssueJobAppService Task CompleteByRequestNumberAsync(string requestNumber); Task GetByNumber2Async(string number); + Task GetJobByPackingCodeAsync(string packingCode); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/ICoatingIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/ICoatingIssueJobAppService.cs index e88f479ad..444d6db81 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/ICoatingIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/ICoatingIssueJobAppService.cs @@ -27,4 +27,5 @@ public interface ICoatingIssueJobAppService Task CompleteByRequestNumberAsync(string requestNumber); Task GetByNumber2Async(string number); + Task GetJobByPackingCodeAsync(string packingCode); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/InjectionJobs/IInjectionIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/InjectionJobs/IInjectionIssueJobAppService.cs index 6cbae5472..81e67c8c0 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/InjectionJobs/IInjectionIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/InjectionJobs/IInjectionIssueJobAppService.cs @@ -26,4 +26,5 @@ public interface IInjectionIssueJobAppService Task CompleteByRequestNumberAsync(string requestNumber); Task GetByNumber2Async(string number); + Task GetJobByPackingCodeAsync(string packingCode); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/KittingIssueJobs/IKittingIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/KittingIssueJobs/IKittingIssueJobAppService.cs index b1df6963d..d2e0e8999 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/KittingIssueJobs/IKittingIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/KittingIssueJobs/IKittingIssueJobAppService.cs @@ -26,4 +26,5 @@ public interface IKittingIssueJobAppService Task CompleteByRequestNumberAsync(string requestNumber); Task GetByNumber2Async(string number); + Task GetJobByPackingCodeAsync(string packingCode); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/SparePartIssueJobs/ISparePartIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/SparePartIssueJobs/ISparePartIssueJobAppService.cs index 0aaefbff3..ab2ea4478 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/SparePartIssueJobs/ISparePartIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/SparePartIssueJobs/ISparePartIssueJobAppService.cs @@ -26,4 +26,5 @@ public interface ISparePartIssueJobAppService Task CompleteByRequestNumberAsync(string requestNumber); Task GetByNumber2Async(string number); + Task GetJobByPackingCodeAsync(string packingCode); } 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 4d0273d08..96548150d 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 @@ -14,8 +14,6 @@ using Microsoft.Extensions.Options; using MyNamespace; using Omu.ValueInjecter; using Volo.Abp; -using Volo.Abp.ObjectMapping; -using Volo.Abp.Timing; using Volo.Abp.Uow; using Volo.Abp.Users; using Win_in.Sfs.Basedata.Application.Contracts; @@ -28,7 +26,6 @@ using Win_in.Sfs.Wms.Store.Domain.Shared; using Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy; using Win_in.Sfs.Wms.Store.Notes; using Win_in.Sfs.Wms.Store.Options; -using static Volo.Abp.Identity.Settings.IdentitySettingNames; namespace Win_in.Sfs.Wms.Store.Application; @@ -59,7 +56,8 @@ public class AssembleIssueJobAppService ILocationAppService locationAppService, IAssembleIssueNoteAppService assembleIssueNoteAppService, IExpectOutAppService expectOutAppService , IHttpClientFactory httpClientFactory - , IOptions options, ITransferLibRequestAppService transferLibRequestAppService, ICurrentUser currentUser, UnitOfWorkManager unitOfWorkManager) : base( + , IOptions options, ITransferLibRequestAppService transferLibRequestAppService, + ICurrentUser currentUser, UnitOfWorkManager unitOfWorkManager) : base( repository, assembleIssueJobManager) { _assembleIssueJobManager = assembleIssueJobManager; @@ -93,35 +91,24 @@ public class AssembleIssueJobAppService if (dimensionalStorehouseflag) { input.IsClaims = true; - input.ClaimsUserId = string.IsNullOrEmpty(_options.Value.StereosUser) ? "LYF" : _options.Value.StereosUser; - input.ClaimsUserName = string.IsNullOrEmpty(_options.Value.StereosPassword) ? "LYF" : _options.Value.StereosPassword; - - - + input.ClaimsUserId = string.IsNullOrEmpty(_options.Value.StereosUser) + ? "LYF" + : _options.Value.StereosUser; + input.ClaimsUserName = string.IsNullOrEmpty(_options.Value.StereosPassword) + ? "LYF" + : _options.Value.StereosPassword; } } + var assembleIssueJobDtos = await base.CreateManyAsync(inputs).ConfigureAwait(false); foreach (var assembleIssueJobDto in assembleIssueJobDtos) { await CheckDimensionalStorehouseAsync(assembleIssueJobDto).ConfigureAwait(false); } + return assembleIssueJobDtos; } - - - - - - - - - - - - - - [HttpPost("")] public override async Task CreateAsync(AssembleIssueJobEditInput input) { @@ -168,7 +155,7 @@ public class AssembleIssueJobAppService [HttpPost("by-request-number/{requestNumber}")] public virtual async Task> GetByRequestNumberAsync(string requestNumber) { - var entitys = await _repository.GetListAsync(p => p.AssembleRequestNumber == requestNumber,"",true) + var entitys = await _repository.GetListAsync(p => p.AssembleRequestNumber == requestNumber, "", true) .ConfigureAwait(false); return ObjectMapper.Map, List>(entitys); } @@ -270,7 +257,8 @@ public class AssembleIssueJobAppService .ConfigureAwait(false); } - await UpdateRequestAndjobStatusDoneAsync(assembleIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty) + await UpdateRequestAndjobStatusDoneAsync(assembleIssueJob, issueJobDetailDto, + issueJobDetailDto.HandledToQty) .ConfigureAwait(false); await _expectOutAppService.RemoveByNumberAsync(assembleIssueJob.Number).ConfigureAwait(false); } @@ -294,7 +282,6 @@ public class AssembleIssueJobAppService } - /// /// 执行任务明细 /// @@ -305,8 +292,11 @@ public class AssembleIssueJobAppService var assembleIssueJob = await _repository.GetAsync(masterId).ConfigureAwait(false); assembleIssueJob.JobStatus = EnumJobStatus.Doing; - assembleIssueJob.ClaimsUserId = string.IsNullOrEmpty( _options.Value.StereosUser)? "LYF" : _options.Value.StereosUser; - assembleIssueJob.ClaimsUserName = string.IsNullOrEmpty(_options.Value.StereosPassword) ? "LYF" : _options.Value.StereosPassword; + assembleIssueJob.ClaimsUserId = + string.IsNullOrEmpty(_options.Value.StereosUser) ? "LYF" : _options.Value.StereosUser; + assembleIssueJob.ClaimsUserName = string.IsNullOrEmpty(_options.Value.StereosPassword) + ? "LYF" + : _options.Value.StereosPassword; //if (assembleIssueJob.IsClaims) @@ -332,7 +322,6 @@ public class AssembleIssueJobAppService issueJobDetail.HandledToQty = entityDetail.HandledToQty; - issueJobDetail.HandledToQty += issueJobDetailDto.HandledToQty; issueJobDetail.HandledFromQty += issueJobDetailDto.HandledFromQty; assembleIssueJob.Details = new EditableList { issueJobDetail }; @@ -347,7 +336,8 @@ public class AssembleIssueJobAppService .ConfigureAwait(false); } - await UpdateRequestAndjobStatusDoneAsync(assembleIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty) + await UpdateRequestAndjobStatusDoneAsync(assembleIssueJob, issueJobDetailDto, + issueJobDetailDto.HandledToQty) .ConfigureAwait(false); await _expectOutAppService.RemoveByNumberAsync(assembleIssueJob.Number).ConfigureAwait(false); } @@ -371,13 +361,6 @@ public class AssembleIssueJobAppService } - - - - - - - /// /// 完成任务 /// @@ -426,7 +409,7 @@ public class AssembleIssueJobAppService public override async Task AcceptAsync(Guid id) { var entity = await _repository.FindAsync(id).ConfigureAwait(false); - entity.IsClaims=true; + entity.IsClaims = true; entity.ClaimsUserName = _currentUser.UserName; entity.ClaimsUserId = _currentUser.Id.ToString(); entity.AcceptTime = Clock.Now; @@ -434,7 +417,7 @@ public class AssembleIssueJobAppService } /// - /// 取消承接任务 + /// 取消承接任务 /// /// /// @@ -450,16 +433,28 @@ public class AssembleIssueJobAppService await _repository.UpdateAsync(entity).ConfigureAwait(false); } + [HttpPost("get-job-by-packing/{packingCode}")] + public virtual async Task GetJobByPackingCodeAsync(string packingCode) + { + var list=await _repository.GetListAsync(p => p.Details.Any(r => r.RecommendFromPackingCode==packingCode)).ConfigureAwait(false); + if (list == null || list.Count < 1) + { + throw new UserFriendlyException("未找到该箱码的任务"); + } + var dto=ObjectMapper.Map(list.First()); + return dto; + } + #region 立库 /// - /// 立体库同步 + /// 立体库同步 /// /// /// /// [HttpPost("sync-issue-job-stereo")] - public async Task SyncIssueJobStereoAsync(List input, string pLoc,Guid uid) + public async Task SyncIssueJobStereoAsync(List input, string pLoc, Guid uid) { var ret = new ReusltObject(); ret.Code = 0; @@ -471,7 +466,7 @@ public class AssembleIssueJobAppService var IssueJobToRestoDetailDTOs = new List(); var main = new IssueJobToRestoDTO(); main.Uuid = uid; - main.OperatorName = string.IsNullOrEmpty(CurrentUser.UserName)? "admin": CurrentUser.UserName; + main.OperatorName = string.IsNullOrEmpty(CurrentUser.UserName) ? "admin" : CurrentUser.UserName; foreach (var job in input) { foreach (var jobitem in job.Details) @@ -500,16 +495,23 @@ public class AssembleIssueJobAppService #endif //var json = JsonSerializer.Serialize(main); - _options.Value.Address =string.IsNullOrEmpty(_options.Value.Address)?"http://7e42682n64.goho.co:21171/": _options.Value.Address; //测试地址 - _options.Value.Token = string.IsNullOrEmpty(_options.Value.Token)? string.Empty: _options.Value.Token; //测试token - _options.Value.UserName = string.IsNullOrEmpty(_options.Value.UserName) ? "": _options.Value.UserName; //测试用户名 - _options.Value.Password = string.IsNullOrEmpty(_options.Value.Password) ? "": _options.Value.Password; //测试密码 - _options.Value.Path = string.IsNullOrEmpty(_options.Value.Path) ? "zozocnApi/custom/receiveProductionPlan":_options.Value.Path; //测试密码 - - _logger.LogInformation(System.Text.Json.JsonSerializer.Serialize(_options)); + _options.Value.Address = string.IsNullOrEmpty(_options.Value.Address) + ? "http://7e42682n64.goho.co:21171/" + : _options.Value.Address; //测试地址 + _options.Value.Token = + string.IsNullOrEmpty(_options.Value.Token) ? string.Empty : _options.Value.Token; //测试token + _options.Value.UserName = + string.IsNullOrEmpty(_options.Value.UserName) ? "" : _options.Value.UserName; //测试用户名 + _options.Value.Password = + string.IsNullOrEmpty(_options.Value.Password) ? "" : _options.Value.Password; //测试密码 + _options.Value.Path = string.IsNullOrEmpty(_options.Value.Path) + ? "zozocnApi/custom/receiveProductionPlan" + : _options.Value.Path; //测试密码 + + _logger.LogInformation(JsonSerializer.Serialize(_options)); var flag = DateTime.Now.ToString("yyyyMMddHHmmss"); - _logger.LogInformation($"标志{flag}开始调用高通WMS:传递值{System.Text.Json.JsonSerializer.Serialize(main)}"); + _logger.LogInformation($"标志{flag}开始调用高通WMS:传递值{JsonSerializer.Serialize(main)}"); if (!string.IsNullOrEmpty(_options.Value.Token)) @@ -529,7 +531,7 @@ public class AssembleIssueJobAppService var client = new IssueJobToRestoClient(_options.Value.Address, httpclient, _options.Value.Path); ret = await client.SyncIssueJobStereoAsync(main).ConfigureAwait(false); - _logger.LogInformation($"标志{flag}调用高通WMS:返回值{System.Text.Json.JsonSerializer.Serialize(ret)}"); + _logger.LogInformation($"标志{flag}调用高通WMS:返回值{JsonSerializer.Serialize(ret)}"); } catch (Exception ex) { @@ -552,12 +554,15 @@ public class AssembleIssueJobAppService #if DEBUG #endif var errors = new List(); - var ret = new ReusltObject { Code = int.Parse(GaoTongResultStatus.Success), OperateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Message = "操作成功" }; + var ret = new ReusltObject + { + Code = int.Parse(GaoTongResultStatus.Success), + OperateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + Message = "操作成功" + }; using var unitOfWork = _unitOfWorkManager.Begin(); try { - - if (input.Jobs.Count > 0) { var jobs = input.Jobs; @@ -565,19 +570,19 @@ public class AssembleIssueJobAppService var query = _repository.WithDetails() .Where(p => numbers.Contains(p.Number) && p.JobStatus != EnumJobStatus.Done); - - var entities = query.ToList(); if (entities.Count == 0) { errors.Add($"任务号{string.Join(",", numbers)}不存在!"); } + var dtos = ObjectMapper.Map, List>(entities); if (input.Jobs.Count != entities.Count) { errors.Add("立体库提交出库任务和WMS任务不符,请核对! \n"); } + foreach (var itm in dtos) { var first = jobs.FirstOrDefault(p => p.JobNumber == itm.Number); @@ -585,27 +590,27 @@ public class AssembleIssueJobAppService var details = new List(); foreach (var detail in first.Details) { - - var fromloc=await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); + var fromloc = await _locationAppService.GetByCodeAsync(detail.FromLocationCode) + .ConfigureAwait(false); if (fromloc == null) { errors.Add($"来源库位{detail.FromLocationCode}没查到"); } - var toloc = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + var toloc = await _locationAppService.GetByCodeAsync(detail.ToLocationCode) + .ConfigureAwait(false); if (toloc == null) { errors.Add($"目标库位{detail.ToLocationCode}没查到"); } - var entity = itmDetails.FirstOrDefault(p => p.ItemCode == detail.ItemCode); if (entity == null) { - errors.Add($"物料号{detail.ItemCode}不在任务明细内!"); + errors.Add($"物料号{detail.ItemCode}不在任务明细内!"); } var dto = new AssembleIssueJobDetailDTO(); @@ -633,7 +638,7 @@ public class AssembleIssueJobAppService dto.HandledToPackingCode = string.Empty; - dto.HandledFromWarehouseCode=fromloc.WarehouseCode; + dto.HandledFromWarehouseCode = fromloc.WarehouseCode; dto.HandledFromLocationCode = fromloc.Code; dto.HandledFromLocationGroup = fromloc.LocationGroupCode; dto.HandledFromLocationArea = fromloc.AreaCode; @@ -643,10 +648,10 @@ public class AssembleIssueJobAppService dto.HandledFromPackingCode = string.Empty; - details.Add(dto); await ExecuteDetailExtAsync(itm.Id, entity.Id, dto).ConfigureAwait(false); } + if (errors.Count > 0) { ret = new ReusltObject @@ -657,9 +662,10 @@ public class AssembleIssueJobAppService Data = json }; } + itm.Details = details; - // await CompleteAsync(itm.Id, itm).ConfigureAwait(false); - _logger.LogInformation($"{flag}接收到立体库确认单据内容:" + json+"立体库任务完成"); + // await CompleteAsync(itm.Id, itm).ConfigureAwait(false); + _logger.LogInformation($"{flag}接收到立体库确认单据内容:" + json + "立体库任务完成"); } } else @@ -671,8 +677,10 @@ public class AssembleIssueJobAppService { ret = new ReusltObject { - Code = int.Parse(GaoTongResultStatus.Failure), OperateTime = DateTime.Now.ToString("yyyy-MM-dd"), Message = ex.Message - , Data = json + Code = int.Parse(GaoTongResultStatus.Failure), + OperateTime = DateTime.Now.ToString("yyyy-MM-dd"), + Message = ex.Message, + Data = json }; await unitOfWork.RollbackAsync(); return ret; @@ -686,7 +694,6 @@ public class AssembleIssueJobAppService OperateTime = DateTime.Now.ToString("yyyy-MM-dd"), Message = string.Join(",", errors.ToArray()), Data = json - }; } @@ -766,10 +773,10 @@ public class AssembleIssueJobAppService /// /// /// - + //private async Task CheckDimensionalStorehouseAsync(AssembleIssueJobEditInput input) //{ - + // var jobDetailInputdetail = input.Details.FirstOrDefault(); @@ -798,10 +805,8 @@ public class AssembleIssueJobAppService input.JobStatus = EnumJobStatus.Wait; return true; } - else - { - return false; - } + + return false; } /// @@ -811,7 +816,6 @@ public class AssembleIssueJobAppService /// private async Task CheckDimensionalStorehouseAsync(AssembleIssueJobDTO assembleIssueJobDto) { - var jobDetailInputdetail = assembleIssueJobDto.Details.FirstOrDefault(); var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode) .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 c9f82ca58..cc142eca0 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 @@ -360,6 +360,18 @@ public class CoatingIssueJobAppService await _repository.UpdateAsync(entity).ConfigureAwait(false); } + [HttpPost("get-job-by-packing/{packingCode}")] + public virtual async Task GetJobByPackingCodeAsync(string packingCode) + { + var list = await _repository.GetListAsync(p => p.Details.Any(r => r.RecommendFromPackingCode == packingCode)).ConfigureAwait(false); + if (list == null || list.Count < 1) + { + throw new UserFriendlyException("未找到该箱码的任务"); + } + var dto = ObjectMapper.Map(list.First()); + return dto; + } + #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 4ee1530b1..38de02d7f 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 @@ -332,6 +332,18 @@ public class InjectionIssueJobAppService await _repository.UpdateAsync(entity).ConfigureAwait(false); } + [HttpPost("get-job-by-packing/{packingCode}")] + public virtual async Task GetJobByPackingCodeAsync(string packingCode) + { + var list = await _repository.GetListAsync(p => p.Details.Any(r => r.RecommendFromPackingCode == packingCode)).ConfigureAwait(false); + if (list == null || list.Count < 1) + { + throw new UserFriendlyException("未找到该箱码的任务"); + } + var dto = ObjectMapper.Map(list.First()); + return dto; + } + #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 f9e99dd69..f7ced55b9 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,7 @@ using Microsoft.AspNetCore.Mvc; 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; @@ -338,6 +339,18 @@ public class KittingIssueJobAppService await _repository.UpdateAsync(entity).ConfigureAwait(false); } + [HttpPost("get-job-by-packing/{packingCode}")] + public virtual async Task GetJobByPackingCodeAsync(string packingCode) + { + var list = await _repository.GetListAsync(p => p.Details.Any(r => r.RecommendFromPackingCode == packingCode)).ConfigureAwait(false); + if (list == null || list.Count < 1) + { + throw new UserFriendlyException("未找到该箱码的任务"); + } + var dto = ObjectMapper.Map(list.First()); + return dto; + } + #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 26cedaeac..f481bddf1 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 @@ -333,6 +333,19 @@ public class SparePartIssueJobAppService await _repository.UpdateAsync(entity).ConfigureAwait(false); } + [HttpPost("get-job-by-packing/{packingCode}")] + public virtual async Task GetJobByPackingCodeAsync(string packingCode) + { + var list = await _repository.GetListAsync(p => p.Details.Any(r => r.RecommendFromPackingCode == packingCode)).ConfigureAwait(false); + if (list == null || list.Count <1) + { + throw new UserFriendlyException("未找到该箱码的任务"); + } + + var dto = ObjectMapper.Map(list.First()); + return dto; + } + #region 立库 /// From e06aead20dce2d7ce9e3c7104eea5f7680bd370f Mon Sep 17 00:00:00 2001 From: "boxu.zheng" Date: Thu, 12 Sep 2024 14:55:29 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20pda=20=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E4=BF=A1=E6=81=AF=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/BaseDatas/Customertroller.cs | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/BaseDatas/Customertroller.cs diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/BaseDatas/Customertroller.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/BaseDatas/Customertroller.cs new file mode 100644 index 000000000..cb482e4f6 --- /dev/null +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/BaseDatas/Customertroller.cs @@ -0,0 +1,34 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.Application.Dtos; +using Volo.Abp.AspNetCore.Mvc; +using Win_in.Sfs.Basedata.Application.Contracts; + +namespace Win_in.Sfs.Wms.Pda.Controllers.BaseDatas; + +/// +/// +[ApiController] +[Route($"{PdaHostConst.ROOT_ROUTE}customer")] +public class Customertroller : AbpController +{ + private readonly ICustomerAppService _customerAppService; + + /// + /// + /// + public Customertroller(ICustomerAppService customerAppService) + { + _customerAppService = customerAppService; + } + + /// + /// + [HttpPost("get-list")] + public virtual async Task> GetListAsync(SfsBaseDataRequestInputBase input) + { + var dto = await _customerAppService.GetPagedListByFilterAsync(input).ConfigureAwait(false); + + return dto; + } +} From ef3a7660ee2f2f54c2e9f6f44dcf614bb17e38ed Mon Sep 17 00:00:00 2001 From: "boxu.zheng" Date: Thu, 19 Sep 2024 15:30:47 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A0=A1=E9=AA=8C=20?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E9=9B=B6=E4=BB=B6=E5=85=B3=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomerItems/ICustomerItemAppService.cs | 1 + .../CustomerItems/CustomerItemAppService.cs | 8 ++++- .../DeliverNotes/DeliverNoteAppService.cs | 29 +++++++++++++++++-- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/CustomerItems/ICustomerItemAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/CustomerItems/ICustomerItemAppService.cs index 8e721681c..1af4f50da 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/CustomerItems/ICustomerItemAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/CustomerItems/ICustomerItemAppService.cs @@ -12,4 +12,5 @@ public interface ICustomerItemAppService { Task GetFirstLocationCodeByItemCode(string itemCode); Task> GetListByPartsAsync(List inputs); + Task GetByCustomerAndItemAsync(string itemCode,string customerCode); } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/CustomerItems/CustomerItemAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/CustomerItems/CustomerItemAppService.cs index 3f1400a4e..3b1f0b463 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/CustomerItems/CustomerItemAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/CustomerItems/CustomerItemAppService.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Volo.Abp.Caching; +using Volo.Abp.ObjectMapping; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Basedata.Domain; using Win_in.Sfs.Basedata.Domain.Shared; @@ -74,5 +75,10 @@ public class CustomerItemAppService : SfsBaseDataAppServiceBase GetByCustomerAndItemAsync(string itemCode,string customerCode) + { + var entity=await _repository.FindAsync(p => p.ItemCode == itemCode && p.CustomerCode == customerCode).ConfigureAwait(false); + return ObjectMapper.Map(entity); + } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/DeliverNotes/DeliverNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/DeliverNotes/DeliverNoteAppService.cs index 03ab41c6e..218e1dd9d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/DeliverNotes/DeliverNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/DeliverNotes/DeliverNoteAppService.cs @@ -5,7 +5,9 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Volo.Abp; using Volo.Abp.Application.Dtos; +using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; @@ -28,13 +30,14 @@ public class DeliverNoteAppService : IDeliverNoteAppService { private readonly IDeliverNoteManager _deliverNoteManager; + private readonly ICustomerItemAppService _customerItemAppService; public DeliverNoteAppService( IDeliverNoteRepository repository, - IDeliverNoteManager deliverNoteManager - ) : base(repository) + IDeliverNoteManager deliverNoteManager, ICustomerItemAppService customerItemAppService) : base(repository) { _deliverNoteManager = deliverNoteManager; + _customerItemAppService = customerItemAppService; } /// @@ -49,6 +52,10 @@ public class DeliverNoteAppService : await _deliverNoteManager.CreateAsync(entity).ConfigureAwait(false); var dto = ObjectMapper.Map(entity); + foreach (var detail in dto.Details) + { + CheckCustomerItem(detail.ItemCode,dto.CustomerCode); + } return dto; } /// @@ -63,6 +70,15 @@ public class DeliverNoteAppService : await _deliverNoteManager.CreateManyAsync(entitys).ConfigureAwait(false); var dtos = ObjectMapper.Map, List>(entitys); + + foreach (var dto in dtos) + { + foreach (var detail in dto.Details) + { + CheckCustomerItem(detail.ItemCode, dto.CustomerCode); + } + } + return dtos; } /// @@ -161,4 +177,13 @@ public class DeliverNoteAppService : await _repository.UpdateAsync(entity).ConfigureAwait(false); } + + private void CheckCustomerItem(string customerCode, string itemCode) + { + var dto=_customerItemAppService.GetByCustomerAndItemAsync(itemCode, customerCode); + if (dto == null) + { + throw new UserFriendlyException($"{customerCode}客户零件号,{itemCode}Erp料号没有客户物品对应关系"); + } + } }