diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/ShipReader.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/ShipReader.cs index a27f4d930..a0a11f34a 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/ShipReader.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/ShipReader.cs @@ -159,7 +159,7 @@ public class ShipReader : IReader var supplierAsn = new SupplierAsnExchangeDto() { Number = ship.ShipBillNo, - PoNumber = ship.ShipBillNo, + PoNumber = ship.PlanBillNo, SupplierCode = ship.SupplierCode, ContactName = ship.PlanUserCode, ShipDate = ship.ShipDate, @@ -175,7 +175,7 @@ public class ShipReader : IReader var supplierAsnDetail = new SupplierAsnDetailExchangeDto() { Number = ship.ShipBillNo, - PoNumber = ship.ShipBillNo, + PoNumber = ship.PlanBillNo, LocationErpCode = ship.Loc, PackingCode = ship.DetailMatNo, Uom = ship.Unit ?? "", diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/AssembleIssueNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/AssembleIssueNoteConverter.cs deleted file mode 100644 index 375faace0..000000000 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/AssembleIssueNoteConverter.cs +++ /dev/null @@ -1,142 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text.Json; -using System.Threading.Tasks; -using Volo.Abp.ObjectMapping; -using Win_in.Sfs.Wms.DataExchange.Domain; -using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; -using Win_in.Sfs.Wms.DataExchange.Domain.Shared; -using Win_in.Sfs.Wms.DataExchange.WMS.PCK; -using Win_in.Sfs.Wms.Store.Application.Contracts; - -namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.Outgoing; - -public class AssembleIssueNoteConverter : IOutgoingConverter -{ - private readonly string billtype = "4026"; - private readonly IOutgoingFromWmsManager _outgoingFromWmsManager; - private readonly IOutgoingToExternalManager _outgoingToExternalManager; - private readonly IObjectMapper _objectMapper; - - public AssembleIssueNoteConverter( - IOutgoingFromWmsManager outgoingFromWmsManager - , IOutgoingToExternalManager outgoingToExternalManager - , IObjectMapper objectMapper - ) - { - _outgoingFromWmsManager = outgoingFromWmsManager; - _outgoingToExternalManager = outgoingToExternalManager; - _objectMapper = objectMapper; - } - - public virtual async Task> ConvertAsync() - { - var outgoingToExternalList = new List(); - //获取要同步得数据 - var outgoingFromWmsList = await _outgoingFromWmsManager.GetToBeProcessedListAsync(EnumOutgoingDataType.AssembleIssue, EnumSystemType.ERP).ConfigureAwait(false); - foreach (var outgoingFromWms in outgoingFromWmsList) - { - string tyrpNumber = outgoingFromWms.TyrpNumber; - #region 主表 - var wmsReceipt = JsonSerializer.Deserialize(outgoingFromWms.DataContent); - var exchangeReceipt = _objectMapper.Map(wmsReceipt); - var putawayNote = BuildDataInterface(exchangeReceipt); - var outgoingToExternal = new OutgoingToExternal() - { - DataType = EnumOutgoingDataType.Issue.ToString(), - TableType = EnumExchangeTableType.MainTable, - DataAction = outgoingFromWms.DataAction, - SerialNumber = tyrpNumber, - SourceSystem = EnumSystemType.WMS.ToString(), - SourceDataId = wmsReceipt.Id.ToString(), - SourceDataGroupCode = wmsReceipt.Number, - SourceDataDetailCode = wmsReceipt.Number, - Writer = nameof(TyrpOutgoingBackgroundWorker), - DestinationSystem = EnumSystemType.ERP.ToString(), - DestinationDataId = "", - }; - outgoingToExternal.SetEffectiveDate(outgoingFromWms.EffectiveDate); - outgoingToExternal.SourceDataContent = JsonSerializer.Serialize(exchangeReceipt); - outgoingToExternal.DestinationDataContent = JsonSerializer.Serialize(putawayNote); - outgoingToExternalList.Add(outgoingToExternal); - #endregion - var sumDetails = wmsReceipt.Details.GroupBy(r => new { r.ItemCode, r.HandledFromLocationErpCode, r.HandledToLocationErpCode }).Select(p => new AssembleIssueNoteDetailDTO { ItemCode = p.Key.ItemCode, HandledFromLocationErpCode = p.Key.HandledFromLocationErpCode, HandledToLocationErpCode = p.Key.HandledToLocationErpCode, HandledToQty = p.Sum(x => x.HandledToQty) }).ToList(); - #region 明细 - foreach (var detail in sumDetails) - { - var outgoingDetailToExternal = new OutgoingToExternal() - { - DataType = EnumOutgoingDataType.Issue.ToString(), - TableType = EnumExchangeTableType.DetailTable, - DataAction = outgoingFromWms.DataAction, - SerialNumber = tyrpNumber, - SourceSystem = EnumSystemType.WMS.ToString(), - SourceDataId = detail.Id.ToString(), - SourceDataGroupCode = wmsReceipt.Number, - SourceDataDetailCode = detail.ItemCode, - Writer = nameof(TyrpOutgoingBackgroundWorker), - DestinationSystem = EnumSystemType.ERP.ToString(), - DestinationDataId = "", - }; - outgoingDetailToExternal.SetEffectiveDate(outgoingFromWms.EffectiveDate); - var exchangeReceiptDetail = _objectMapper.Map(detail); - outgoingDetailToExternal.SourceDataContent = JsonSerializer.Serialize(exchangeReceiptDetail); - var putawayNoteDetail = BuildDataInterfaceDetail(exchangeReceipt, exchangeReceiptDetail, putawayNote.scontrol_dt_w); - outgoingDetailToExternal.DestinationDataContent = JsonSerializer.Serialize(putawayNoteDetail); - outgoingToExternalList.Add(outgoingDetailToExternal); - } - #endregion - } - //插入到中间表OutgoingToExternal - await _outgoingToExternalManager.CreateManyAsync(outgoingToExternalList).ConfigureAwait(false); - //将outgoingFromWms数据归档 - await _outgoingFromWmsManager.ArchiveManyAsync(outgoingFromWmsList).ConfigureAwait(false); - - return outgoingToExternalList; - } - /// - /// 构建主表 - /// - /// - /// - private Scontrol BuildDataInterface(AssembleIssueNoteExchangeDto exchangeOrder) - { - var ret = new Scontrol() - { - scontrol_nbr = exchangeOrder.Number, - scontrol_dt_w = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"), - scontrol_stat = "Y", - scontrol_dt_k = "", - scontrol_type = billtype, - scontrol_id = 0,//明细中最大scmsend_id - }; - return ret; - } - /// - /// 构建明细 - /// - /// - /// - /// - private Scmsend BuildDataInterfaceDetail(AssembleIssueNoteExchangeDto exchangeOrder, AssembleIssueNoteDetailExchangeDto exchangeDetailOrder, string dt_w) - { - var ret = new Scmsend() - { - scmsend_type = billtype, - scmsend_dt_w = dt_w, - scmsend_nbr = exchangeOrder.Number, - scmsend_stat1 = "1", - scmsend_part = exchangeDetailOrder.ItemCode, - scmsend_delv_date = "", - scmsend_orderno = "", - scmsend_loc = exchangeDetailOrder.FromLocationErpCode, - //scmsend_date = exchangeOrder.ActiveDate.ToString("yyyyMMdd"), - scmsend_date = DateTime.Now.ToString("yyyyMMdd"), - scmsend_qty = exchangeDetailOrder.Qty, - scmsend_wipd_loc = exchangeDetailOrder.ToLocationErpCode, - scmsend_userid = "WMS" - }; - return ret; - } -} diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/IssueNote/AssembleIssueNote/AssembleIssueNoteDetailExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/IssueNote/AssembleIssueNote/AssembleIssueNoteDetailExchangeDto.cs deleted file mode 100644 index c58436b83..000000000 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/IssueNote/AssembleIssueNote/AssembleIssueNoteDetailExchangeDto.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using Win_in.Sfs.Shared.Domain; - -namespace Win_in.Sfs.Wms.DataExchange.WMS.PCK; - -public class AssembleIssueNoteDetailExchangeDto - -{ - - /// - /// 目标ERP库位 - /// - [Display(Name = "目标ERP库位")] - public string ToLocationErpCode { get; set; } - - public string FromPackingCode { get; set; } - /// - /// 来源ERP库位 - /// - public string FromLocationErpCode { get; set; } - - /// - /// 数量 - /// - [Display(Name = "数量")] - public decimal Qty { get; set; } - - /// - /// 物品代码 - /// - [Display(Name = "物品代码")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - [Required(ErrorMessage = "{0}是必填项")] - public string ItemCode { get; set; } - -} diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/IssueNote/AssembleIssueNote/AssembleIssueNoteExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/IssueNote/AssembleIssueNote/AssembleIssueNoteExchangeDto.cs deleted file mode 100644 index 22ff4899e..000000000 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/IssueNote/AssembleIssueNote/AssembleIssueNoteExchangeDto.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; - -namespace Win_in.Sfs.Wms.DataExchange.WMS.PCK; - -public class AssembleIssueNoteExchangeDto -{ - /// - /// 发料记录号 - /// - [Display(Name = "发料记录号")] - public string Number { get; set; } - /// - /// 生效日期 - /// - [Display(Name = "生效日期")] - public DateTime ActiveDate { get; set; } = DateTime.Now.Date; - - /// - /// 操作员 - /// - [Display(Name = "操作员")] - public string Worker { get; set; } - /// - /// 明细 - /// - [Display(Name = "明细")] - public AssembleIssueNoteDetailExchangeDto Detail { get; set; } = new(); -} diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumOutgoingDataType.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumOutgoingDataType.cs index a2fdb0412..e4bcf2fd1 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumOutgoingDataType.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumOutgoingDataType.cs @@ -32,19 +32,7 @@ public enum EnumOutgoingDataType ProductRecycle = 24, Item_Transform = 25,//线边仓调整单 WIPAdjust = 26,//回收料调整单 - SemiPutaway=27,//半成品上架 - /// - /// 注塑发料 - /// - InjectionIssue = 30, - /// - /// 涂装发料 - /// - CoatingIssue = 31, - /// - /// 装配发料 - /// - AssembleIssue = 32, + SemiPutaway=27,//半成品上架 } public enum EnumExchangeTableType 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 85558bfe0..ec1fa3df7 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 @@ -173,4 +173,15 @@ public class KittingIssueJobsController : AbpController return jobDto; } + + /// + /// + /// + /// + /// + [HttpPost("by-request-number/{requestNumber}")] + public virtual async Task> GetByRequestNumberAsync(string requestNumber) + { + return await _kittingIssueJobAppService.GetByRequestNumberAsync(requestNumber).ConfigureAwait(false); + } } 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 5caf96652..5c6aed4cb 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 @@ -72,7 +72,6 @@ public class TransferLibJobController : AbpController /// /// [HttpPost("complete/{id}")] - public virtual async Task CompleteAsync(Guid id, TransferLibJobDTO jobDTO) { var entity = await _transferLibJobAppService.CompleteAsync(id, jobDTO).ConfigureAwait(false); diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/UnplannedIssueJobController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/UnplannedIssueJobController.cs index f886d53df..e0d88fdc3 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/UnplannedIssueJobController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/UnplannedIssueJobController.cs @@ -10,6 +10,7 @@ using Win_in.Sfs.Shared.Domain.Shared; using System.Text.Json; using Win_in.Sfs.Shared.Domain; using Volo.Abp; +using Win_in.Sfs.Shared.Domain.Shared.Enums.Store; namespace Win_in.Sfs.Wms.Pda.Controllers.Jobs; @@ -51,14 +52,15 @@ public class UnplannedIssueJobController : AbpController /// /// [HttpGet("list")] - public virtual async Task> GetListAsync(int pageSize, int pageIndex, bool isCreationTimeSorting, bool isToday) + public virtual async Task> GetListAsync(int pageSize, int pageIndex, bool isCreationTimeSorting, bool isToday, EnumUnplannedIssueType enumUnplannedIssueType) { - var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); - var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes); + //var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); + //var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes); var status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; var jsonStatus = JsonSerializer.Serialize(status); - + var issueType = new List() { (int)enumUnplannedIssueType }; + var jsonIssueType = JsonSerializer.Serialize(issueType); var request = new SfsJobRequestInputBase { MaxResultCount = pageSize, @@ -68,7 +70,7 @@ public class UnplannedIssueJobController : AbpController { Filters = new List { - // new(nameof(UnplannedIssueJobDTO.WorkGroupCode),jsonWlgCodes,"In"), + new(nameof(UnplannedIssueJobDTO.UnplannedIssueType),jsonIssueType,"In"), new(nameof(UnplannedIssueJobDTO.JobStatus),jsonStatus,"In") } } @@ -81,7 +83,6 @@ public class UnplannedIssueJobController : AbpController { request.Sorting = $"{nameof(UnplannedIssueJobDTO.CreationTime)} ASC"; } - var list = await _unplannedIssueJobAppService.GetPagedListByFilterAsync(request, true).ConfigureAwait(false); return list; } diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/UnplannedReceiptJobController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/UnplannedReceiptJobController.cs index 601cde5f7..22bf2370e 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/UnplannedReceiptJobController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/UnplannedReceiptJobController.cs @@ -10,6 +10,7 @@ using Win_in.Sfs.Shared.Domain.Shared; using System.Text.Json; using Win_in.Sfs.Shared.Domain; using Volo.Abp; +using Win_in.Sfs.Shared.Domain.Shared.Enums.Store; namespace Win_in.Sfs.Wms.Pda.Controllers.Jobs; @@ -50,14 +51,15 @@ public class UnplannedReceiptJobController : AbpController /// /// [HttpGet("list")] - public virtual async Task> GetListAsync(int pageSize, int pageIndex, bool isCreationTimeSorting, bool isToday) + public virtual async Task> GetListAsync(int pageSize, int pageIndex, bool isCreationTimeSorting, bool isToday, EnumUnplannedReceiptType enumUnplannedReceiptType) { - var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); - var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes); + //var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); + //var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes); var status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + var receiptType = new List() { (int)enumUnplannedReceiptType }; var jsonStatus = JsonSerializer.Serialize(status); - + var jsonreceiptType = JsonSerializer.Serialize(receiptType); var request = new SfsJobRequestInputBase { MaxResultCount = pageSize, @@ -67,7 +69,7 @@ public class UnplannedReceiptJobController : AbpController { Filters = new List { - // new(nameof(UnplannedReceiptJobDTO.WorkGroupCode),jsonWlgCodes,"In"), + new(nameof(UnplannedReceiptJobDTO.UnplannedReceiptType),jsonreceiptType,"In"), new(nameof(UnplannedReceiptJobDTO.JobStatus),jsonStatus,"In") } } diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/IssueRequest/KittingRequestController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/IssueRequest/KittingRequestController.cs index c24e85e69..110c5a417 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/IssueRequest/KittingRequestController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/IssueRequest/KittingRequestController.cs @@ -73,10 +73,10 @@ public class KittingRequestController : AbpController { MaxResultCount = pageSize, SkipCount = (pageIndex - 1) * pageSize, - Sorting = $"{nameof(ContainerJobDTO.CreationTime)} ASC", + Sorting = $"{nameof(KittingIssueRequestDTO.CreationTime)} ASC", Condition = new Condition { - Filters = new List { new(nameof(ContainerJobDTO.JobStatus), jsonStatus, "In") } + Filters = new List { new(nameof(KittingIssueRequestDTO.RequestStatus), jsonStatus, "In") } } }; @@ -97,7 +97,7 @@ public class KittingRequestController : AbpController /// /// 根据Job Number 获取盘点任务列表 /// - /// + /// /// [HttpGet("by-number/{requestNumber}")] public virtual async Task> GetByNumberAsync(string requestNumber) @@ -122,4 +122,14 @@ public class KittingRequestController : AbpController var result = await _kittingIssueRequestAppService.GetAsync(id).ConfigureAwait(false); return Ok(result); } + + /// + /// + /// + /// + [HttpPost("IsHasNewJob")] + public virtual async Task IsHasNewJobAsync(string requestNumber, List jobNumber) + { + return await _kittingIssueRequestAppService.IsHasNewJobAsync(requestNumber, jobNumber).ConfigureAwait(false); + } } diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ProductReceiptNoteController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ProductReceiptNoteController.cs index 256241889..945b6ca4f 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ProductReceiptNoteController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ProductReceiptNoteController.cs @@ -6,7 +6,7 @@ using Win_in.Sfs.Wms.Store.Application.Contracts; namespace Win_in.Sfs.Wms.Pda.Controllers.Stores; /// -/// +///缴库 /// [ApiController] [Route($"{PdaHostConst.ROOT_ROUTE}store/product-receipt")] @@ -14,14 +14,16 @@ namespace Win_in.Sfs.Wms.Pda.Controllers.Stores; public class ProductReceiptNoteController : AbpController { private readonly IProductReceiptNoteAppService _productReceiptNoteAppService; - + private readonly IProductReceiptNoteDetailAppService _productReceiptNoteDetailAppService; /// - /// + /// 缴库 /// /// - public ProductReceiptNoteController(IProductReceiptNoteAppService productReceiptNoteAppService) + /// + public ProductReceiptNoteController(IProductReceiptNoteAppService productReceiptNoteAppService, IProductReceiptNoteDetailAppService productReceiptNoteDetailAppService) { _productReceiptNoteAppService = productReceiptNoteAppService; + _productReceiptNoteDetailAppService = productReceiptNoteDetailAppService; } /// @@ -34,5 +36,15 @@ public class ProductReceiptNoteController : AbpController { await _productReceiptNoteAppService.CreateAsync(input).ConfigureAwait(false); } + /// + /// 单件码获取方法 + /// + /// + /// + [HttpPost("get-itemcode-by-mesbarcode")] + public virtual async Task GetItemCodeByMesBarCode(string mesBarCode) + { + return await _productReceiptNoteDetailAppService.GetItemCodeByMesBarCode(mesBarCode).ConfigureAwait(false); + } } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PositionCodes/PositionCodeAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PositionCodes/PositionCodeAppService.cs index c70f4caf8..97596b08d 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PositionCodes/PositionCodeAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PositionCodes/PositionCodeAppService.cs @@ -75,7 +75,6 @@ public class PositionCodeAppService input.PartName = itemBasic.Name; input.PartDesc = itemBasic.Desc1; input.BasicUom = itemBasic.BasicUom; - input.StdPackQty = itemBasic.StdPackQty; var location = await LocationAppService.GetByCodeAsync(input.LocationCode).ConfigureAwait(false); Check.NotNull(location, "库位代码", $"库位 {input.LocationCode} 不存在"); @@ -173,23 +172,23 @@ public class PositionCodeAppService private async Task CheckPositionCodeInputAsync(PositionCodeImportInput input, List validationRresult) { - var itemEntity = await _repository.FirstOrDefaultAsync(p => p.PartCode == input.PartCode && p.Code != input.Code).ConfigureAwait(false); - if (itemEntity != null) - { - validationRresult.Add(new ValidationResult($"物品代码{input.PartCode}已存在", new string[] { "物品代码" })); - } - var itemBasic = await ItemBasicAppService.GetByCodeAsync(input.PartCode).ConfigureAwait(false); - //如果类型选择为原料,校验物料号类型必须为原料,器具、KItting 的不用加校验 - if (input.Type == EnumRecommendType.RAW && itemBasic.Type != "10C02") - { - validationRresult.Add(new ValidationResult($"物品代码{input.PartCode} 物料号类型必须为原料", new string[] { "物料号类型" })); - } - var location = await LocationAppService.GetByCodeAsync(input.LocationCode).ConfigureAwait(false); - //如果类型选择为原料,库位的类型必须为原料库位 - if (input.Type==EnumRecommendType.RAW && location.Type != EnumLocationType.RAW) - { - validationRresult.Add(new ValidationResult($"库位代码{input.LocationCode} 库位的类型必须为原料库位", new string[] { "库位类型" })); - } + //var itemEntity = await _repository.FirstOrDefaultAsync(p => p.PartCode == input.PartCode && p.Code != input.Code).ConfigureAwait(false); + //if (itemEntity != null) + //{ + // validationRresult.Add(new ValidationResult($"物品代码{input.PartCode}已存在", new string[] { "物品代码" })); + //} + //var itemBasic = await ItemBasicAppService.GetByCodeAsync(input.PartCode).ConfigureAwait(false); + ////如果类型选择为原料,校验物料号类型必须为原料,器具、KItting 的不用加校验 + //if (input.Type == EnumRecommendType.RAW && itemBasic.Type != "10C02") + //{ + // validationRresult.Add(new ValidationResult($"物品代码{input.PartCode} 物料号类型必须为原料", new string[] { "物料号类型" })); + //} + //var location = await LocationAppService.GetByCodeAsync(input.LocationCode).ConfigureAwait(false); + ////如果类型选择为原料,库位的类型必须为原料库位 + //if (input.Type==EnumRecommendType.RAW && location.Type != EnumLocationType.RAW) + //{ + // validationRresult.Add(new ValidationResult($"库位代码{input.LocationCode} 库位的类型必须为原料库位", new string[] { "库位类型" })); + //} } protected override async Task ValidateImportModelAsync(PositionCodeImportInput importInput, List validationRresult) diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumIssueRequestType - 复制.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumIssueSendType.cs similarity index 100% rename from be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumIssueRequestType - 复制.cs rename to be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumIssueSendType.cs diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Chassis/IChassisAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Chassis/IChassisAppService.cs index eb28b2756..c807299ab 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Chassis/IChassisAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Chassis/IChassisAppService.cs @@ -12,10 +12,5 @@ public interface IChassisAppService ISfsCheckStatusAppService , ISfsUpsertAppService { - /// - /// ƽֳʹ յ̷ڲ20 - /// - /// - Task> GetListWithNextCountAsync(long sortNumber,int count, - CancellationToken cancellationToken = default); + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/ChassisOperationSequence/IChassisOperationSequenceAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/ChassisOperationSequence/IChassisOperationSequenceAppService.cs index 0454175f1..dbc631dc4 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/ChassisOperationSequence/IChassisOperationSequenceAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/ChassisOperationSequence/IChassisOperationSequenceAppService.cs @@ -1,4 +1,6 @@ +using System.Threading; using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; using Win_in.Sfs.Shared.Application.Contracts; namespace Win_in.Sfs.Wms.Store.Application.Contracts; @@ -18,4 +20,11 @@ public interface IChassisOperationSequenceAppService /// /// Task UpdateChassisSortNumberByKittingCodeAsync(string kittingCode, long newChassisSortNumber,string chassisNumber); + + /// + /// 平板或手持使用 按照底盘返回排序大于参数中20个的 + /// + /// + Task> GetListWithNextCountAsync(int count, string kittingCode, + CancellationToken cancellationToken = default); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobPermissions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobPermissions.cs index de9f948ca..ec6f854f9 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobPermissions.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobPermissions.cs @@ -1,28 +1,23 @@ using Volo.Abp.Authorization.Permissions; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; +using Win_in.Sfs.Wms.Store.Jobs.IssueJobs; namespace Win_in.Sfs.Wms.Store.Application.Contracts; public static class CoatingIssueJobPermissions { - public const string Default = StorePermissions.GroupName + "." + nameof(IssueJob); + public const string Default = StorePermissions.GroupName + "." + nameof(CoatingIssueJob); public const string Create = Default + "." + StorePermissions.CreateStr; public const string Update = Default + "." + StorePermissions.UpdateStr; public const string Delete = Default + "." + StorePermissions.DeleteStr; - //自动发料任务 - public const string AutoIssueJob = StorePermissions.GroupName + "." + nameof(AutoIssueJob); - public static void AddCoatingIssueJobPermission(this PermissionGroupDefinition permissionGroup) { var IssueJobPermission = permissionGroup.AddPermission(Default, StorePermissionDefinitionProvider.L(nameof(IssueJob))); IssueJobPermission.AddChild(Create, StorePermissionDefinitionProvider.L(StorePermissions.CreateStr)); IssueJobPermission.AddChild(Update, StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr)); IssueJobPermission.AddChild(Delete, StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr)); - - permissionGroup.AddPermission(AutoIssueJob, StorePermissionDefinitionProvider.L(nameof(AutoIssueJob))); - } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/IProductReceiptNoteDetailAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/IProductReceiptNoteDetailAppService.cs new file mode 100644 index 000000000..dc5d7250b --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/IProductReceiptNoteDetailAppService.cs @@ -0,0 +1,9 @@ +using System.Threading.Tasks; +using Volo.Abp.Application.Services; +using Win_in.Sfs.Wms.Store.Application.Contracts; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; +public interface IProductReceiptNoteDetailAppService : ISfsStoreAppServiceBase +{ + Task GetItemCodeByMesBarCode(string mesBarCode); +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/ProductReceiptNoteDetailPermissions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/ProductReceiptNoteDetailPermissions.cs new file mode 100644 index 000000000..07bbcd6c0 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/ProductReceiptNoteDetailPermissions.cs @@ -0,0 +1,25 @@ +using Volo.Abp.Authorization.Permissions; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; +public static class ProductReceiptNoteDetailPermissions +{ + public const string Default = StorePermissions.GroupName + "." + nameof(ProductReceiptNoteDetail); + public const string Create = Default + "." + StorePermissions.CreateStr; + public const string Update = Default + "." + StorePermissions.UpdateStr; + public const string Delete = Default + "." + StorePermissions.DeleteStr; + + //线边完工收货记录 + public const string WipProductReceiptNoteDetail = StorePermissions.GroupName + "." + nameof(WipProductReceiptNoteDetail); + + public static void AddProductReceiptNoteDetailPermission(this PermissionGroupDefinition permissionGroup) + { + var productReceiptNotePermission = permissionGroup.AddPermission(Default, StorePermissionDefinitionProvider.L(nameof(ProductReceiptNoteDetail))); + productReceiptNotePermission.AddChild(Create, StorePermissionDefinitionProvider.L(StorePermissions.CreateStr)); + productReceiptNotePermission.AddChild(Update, StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr)); + productReceiptNotePermission.AddChild(Delete, StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr)); + + permissionGroup.AddPermission(WipProductReceiptNoteDetail, StorePermissionDefinitionProvider.L(nameof(WipProductReceiptNoteDetail))); + + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs index 82e0f51b2..beeaa8c94 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs @@ -17,6 +17,7 @@ public class StorePermissionDefinitionProvider : PermissionDefinitionProvider storeGroup.AddProductionPlanPermission(); storeGroup.AddPreparationPlanPermission(); storeGroup.AddProductReceiptNotePermission(); + storeGroup.AddProductReceiptNoteDetailPermission(); storeGroup.AddOfflineSettlementNotePermission(); storeGroup.AddBackFlushNotePermission(); storeGroup.AddWorkOrderPermission(); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/IssueRequest/KittingIssueRequests/IKittingIssueRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/IssueRequest/KittingIssueRequests/IKittingIssueRequestAppService.cs index f7d630cc0..10f501e57 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/IssueRequest/KittingIssueRequests/IKittingIssueRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/IssueRequest/KittingIssueRequests/IKittingIssueRequestAppService.cs @@ -12,4 +12,5 @@ public interface IKittingIssueRequestAppService { Task CreateAndHandleAsync(KittingIssueRequestEditInput input); Task UpdateStatusCompletedAsync(string number); + Task IsHasNewJobAsync(string requestNumber,List jobNumber); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Chassis/ChassisAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Chassis/ChassisAppService.cs index 97483d727..bded6701f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Chassis/ChassisAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Chassis/ChassisAppService.cs @@ -1,11 +1,8 @@ using System; using System.Collections.Generic; -using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Volo.Abp.Application.Dtos; -using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; @@ -74,32 +71,5 @@ public class ChassisAppService throw new NotImplementedException(); } - /// - /// 平板或手持使用 按照底盘返回排序大于参数中20个的 - /// - /// - [HttpPost("get-list-with-next-count")] - public async Task> GetListWithNextCountAsync(long sortNumber,int count, - CancellationToken cancellationToken = default) - { - var requestInput = new SfsStoreRequestInputBase - { - MaxResultCount = count, - SkipCount = 0, - Sorting = $"{nameof(Chassis.SortNumber)} DESC", - Condition = new Condition - { - Filters = new List { new(nameof(Chassis.SortNumber), sortNumber.ToString(), ">=") } - } - }; - - var expression = requestInput.Condition.Filters?.Count > 0 - ? requestInput.Condition.Filters.ToLambda() - : p => true; - - return await GetPagedListAsync(expression, requestInput.SkipCount, requestInput.MaxResultCount, - requestInput.Sorting, false, cancellationToken).ConfigureAwait(false); - } - #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/ChassisOperationSequence/ChassisOperationSequenceAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/ChassisOperationSequence/ChassisOperationSequenceAppService.cs index ef2bcadd0..93187a8f7 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/ChassisOperationSequence/ChassisOperationSequenceAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/ChassisOperationSequence/ChassisOperationSequenceAppService.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Volo.Abp.Application.Dtos; +using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; @@ -21,10 +24,10 @@ public class ChassisOperationSequenceAppService { private new readonly IChassisOperationSequenceRepository _repository; private readonly IChassisOperationSequenceManager _manager; + private readonly IChassisAppService _chassisAppService; public ChassisOperationSequenceAppService( - IChassisOperationSequenceRepository repository, IChassisOperationSequenceManager manager - ) : base(repository) + IChassisOperationSequenceRepository repository, IChassisOperationSequenceManager manager, IChassisAppService chassisAppService) : base(repository) { base.CreatePolicyName = ChassisOperationSequencePermissions.Create; base.UpdatePolicyName = ChassisOperationSequencePermissions.Update; @@ -32,6 +35,7 @@ public class ChassisOperationSequenceAppService _repository = repository; _manager = manager; + _chassisAppService = chassisAppService; } /// @@ -39,6 +43,7 @@ public class ChassisOperationSequenceAppService /// /// /// + /// /// [HttpPost("update-chassis-sort-number-by-kitting-code")] public async Task UpdateChassisSortNumberByKittingCodeAsync(string kittingCode, long newChassisSortNumber, string chassisNumber) @@ -62,6 +67,38 @@ public class ChassisOperationSequenceAppService } } + /// + /// 平板或手持使用 按照底盘返回排序大于参数中20个的 + /// + /// + [HttpPost("get-list-with-next-count")] + public async Task> GetListWithNextCountAsync(int count, string kittingCode, + CancellationToken cancellationToken = default) + { + var chassisOperationSequence=await _repository.FindAsync(p => p.KittingCode == kittingCode).ConfigureAwait(false); + long sortNumber = 1; + if (chassisOperationSequence != null) + { + sortNumber = chassisOperationSequence.ChassisSortNumber; + } + + var requestInput = new SfsStoreRequestInputBase + { + MaxResultCount = count, + SkipCount = 0, + Sorting = $"{nameof(Chassis.SortNumber)} DESC", + Condition = new Condition + { + Filters = new List + { + new(nameof(Chassis.SortNumber), sortNumber.ToString(), ">="), + } + + } + }; + return await _chassisAppService.GetPagedListByFilterAsync(requestInput,false, cancellationToken).ConfigureAwait(false); + } + #region 无用 [NonAction] 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 d04462a11..a0c4c9546 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 @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Threading.Tasks; +using Castle.Components.DictionaryAdapter; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; @@ -95,11 +96,10 @@ public class KittingIssueJobAppService await _kittingIssueJobManager.CancelAsync(injectionJob).ConfigureAwait(false); } - - [HttpPost("cancel-by-request/{injectionNumber}")] - public virtual async Task CancelByMaterialRequestAsync(string injectionNumber) + [HttpPost("cancel-by-request/{requestNumber}")] + public virtual async Task CancelByMaterialRequestAsync(string requestNumber) { - var entities = await _repository.GetListAsync(p => p.KittingRequestNumber == injectionNumber) + var entities = await _repository.GetListAsync(p => p.KittingRequestNumber == requestNumber) .ConfigureAwait(false); foreach (var entity in entities) { @@ -171,26 +171,36 @@ public class KittingIssueJobAppService public async Task ExecuteDetailAsync(Guid masterId, Guid detailId, KittingIssueJobDetailDTO issueJobDetailDto) { var kittingIssueJob = await _repository.GetAsync(masterId).ConfigureAwait(false); + kittingIssueJob.JobStatus = EnumJobStatus.Doing; var kittingIssueJobDto = ObjectMapper.Map(kittingIssueJob); kittingIssueJobDto.Details = new List { issueJobDetailDto }; var kittingIssueNoteEditInput = await BuildKittingIssueNoteAsync(kittingIssueJobDto).ConfigureAwait(false); await _kittingIssueNoteAppService.CreateAsync(kittingIssueNoteEditInput).ConfigureAwait(false); - kittingIssueJobDto = ObjectMapper.Map(kittingIssueJob); + var issueJobDetail=ObjectMapper.Map(issueJobDetailDto); + var entityDetail=kittingIssueJob.Details.Find(p => p.Id == detailId); + issueJobDetail.HandledFromQty = entityDetail.HandledFromQty; + issueJobDetail.HandledToQty = entityDetail.HandledToQty; + + issueJobDetail.HandledToQty += issueJobDetailDto.HandledToQty; + issueJobDetail.HandledFromQty += issueJobDetailDto.HandledFromQty; + kittingIssueJob.Details = new EditableList() { issueJobDetail }; - if (kittingIssueJob.EnumIssueSendType == EnumIssueSendType.QtyType) //按箱叫料 因为任务只有1箱 所以可以直接完成 + if (kittingIssueJob.EnumIssueSendType == EnumIssueSendType.BoxQtyType) //按箱叫料 因为任务只有1箱 所以可以直接完成 { - await UpdateJobStatusDoneAsync(kittingIssueJob, issueJobDetailDto).ConfigureAwait(false); + await UpdateRequestAndjobStatusDoneAsync(kittingIssueJob, issueJobDetailDto).ConfigureAwait(false); } else { var detail = kittingIssueJob.Details.First(p => p.Id == issueJobDetailDto.Id); - if (issueJobDetailDto.HandledToQty >= detail.RequestQty) + if (issueJobDetail.HandledToQty >= detail.RequestQty) { - await UpdateJobStatusDoneAsync(kittingIssueJob, issueJobDetailDto).ConfigureAwait(false); + await UpdateRequestAndjobStatusDoneAsync(kittingIssueJob, issueJobDetailDto).ConfigureAwait(false); } } + + await _repository.UpdateAsync(kittingIssueJob).ConfigureAwait(false); } #region 私有 @@ -246,16 +256,16 @@ public class KittingIssueJobAppService jobDetailInputdetail.TransferLibToArriveDate = jobDetailInputdetail.RecommendToArriveDate; jobDetailInputdetail.TransferLibToContainerCode = jobDetailInputdetail.RecommendToContainerCode; jobDetailInputdetail.TransferLibToExpireDate = jobDetailInputdetail.RecommendToExpireDate; - jobDetailInputdetail.TransferLibToLocationArea = jobDetailInputdetail.RecommendToLocationArea; - jobDetailInputdetail.TransferLibToLocationCode = jobDetailInputdetail.RecommendToLocationCode; - jobDetailInputdetail.TransferLibToLocationErpCode = jobDetailInputdetail.RecommendToLocationErpCode; - jobDetailInputdetail.TransferLibToLocationGroup = jobDetailInputdetail.RecommendToLocationGroup; jobDetailInputdetail.TransferLibToLot = jobDetailInputdetail.RecommendToLot; jobDetailInputdetail.TransferLibToPackingCode = jobDetailInputdetail.RecommendToPackingCode; jobDetailInputdetail.TransferLibToProduceDate = jobDetailInputdetail.RecommendToProduceDate; jobDetailInputdetail.TransferLibToQty = jobDetailInputdetail.RecommendToQty; jobDetailInputdetail.TransferLibToSupplierBatch = jobDetailInputdetail.RecommendToSupplierBatch; - jobDetailInputdetail.TransferLibToWarehouseCode = jobDetailInputdetail.RecommendToWarehouseCode; + jobDetailInputdetail.TransferLibToWarehouseCode = jobDetailInputdetail.TransferLibFromWarehouseCode; + jobDetailInputdetail.TransferLibToLocationArea = jobDetailInputdetail.TransferLibFromLocationArea; + jobDetailInputdetail.TransferLibToLocationCode = jobDetailInputdetail.TransferLibFromLocationCode; + jobDetailInputdetail.TransferLibToLocationErpCode = jobDetailInputdetail.TransferLibFromLocationErpCode; + jobDetailInputdetail.TransferLibToLocationGroup = jobDetailInputdetail.TransferLibFromLocationGroup; } } @@ -279,14 +289,21 @@ public class KittingIssueJobAppService } } - private async Task UpdateJobStatusDoneAsync(KittingIssueJob kittingIssueJob, + /// + /// 修改当前任务状态 和 该任务的请求状态 + /// + /// + /// + /// + /// + private async Task UpdateRequestAndjobStatusDoneAsync(KittingIssueJob kittingIssueJob, KittingIssueJobDetailDTO kittingIssueJobDetailDto) { if (kittingIssueJob.JobStatus is EnumJobStatus.Closed or EnumJobStatus.Cancelled or EnumJobStatus.None or EnumJobStatus.Done) //需要考虑下 多次提交的问题 所以不判断 进行中 { throw new UserFriendlyException( - $"任务状态错误:编号为【{kittingIssueJob.Number}】的任务已经【{kittingIssueJob.JobStatus.GetDisplayName()}】"); + $"任务状态错误:编号为【{kittingIssueJob.Number}】的任务状态为【{kittingIssueJob.JobStatus.GetDisplayName()}】"); } kittingIssueJob.JobStatus = EnumJobStatus.Done; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs index 7fbf30d55..37689d407 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; using Volo.Abp; using Volo.Abp.Uow; +using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; @@ -21,11 +22,13 @@ public class TransferLibJobAppService ITransferLibJobAppService { private readonly IServiceProvider _serviceProvider; + private readonly ILocationAppService _locationAppService; public TransferLibJobAppService( - ITransferLibJobRepository repository, ITransferLibJobManager TransferLibJobManager, IServiceProvider serviceProvider) : base(repository, TransferLibJobManager) + ITransferLibJobRepository repository, ITransferLibJobManager TransferLibJobManager, IServiceProvider serviceProvider, ILocationAppService locationAppService) : base(repository, TransferLibJobManager) { _serviceProvider = serviceProvider; + _locationAppService = locationAppService; } /// @@ -172,6 +175,27 @@ public class TransferLibJobAppService } #endregion + foreach (var detail in dto.Details) + { + detail.HandledFromContainerCode = string.Empty; + detail.HandledToContainerCode = string.Empty; + + var fromLocationDto=await _locationAppService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false); + var toLocationDto=await _locationAppService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false); + + detail.HandledFromLocationArea = fromLocationDto.AreaCode; + detail.HandledFromLocationCode = fromLocationDto.Code; + detail.HandledFromLocationErpCode = fromLocationDto.ErpLocationCode; + detail.HandledFromLocationGroup = fromLocationDto.LocationGroupCode; + detail.HandledFromWarehouseCode = fromLocationDto.WarehouseCode; + + detail.HandledToLocationArea = toLocationDto.AreaCode; + detail.HandledToLocationCode = toLocationDto.Code ; + detail.HandledToLocationErpCode = toLocationDto.ErpLocationCode; + detail.HandledToLocationGroup = toLocationDto.LocationGroupCode; + detail.HandledToWarehouseCode = toLocationDto.WarehouseCode; + } + var ret = await base.CompleteAsync(id, dto).ConfigureAwait(false); if (ret != null) { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductReceiptNotes/ProductReceiptNoteDetailAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductReceiptNotes/ProductReceiptNoteDetailAppService.cs new file mode 100644 index 000000000..ccacd5537 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductReceiptNotes/ProductReceiptNoteDetailAppService.cs @@ -0,0 +1,36 @@ +using System; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.Application.Dtos; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; +using Volo.Abp.Application.Services; +using Microsoft.AspNetCore.Authorization; +using Win_in.Sfs.Wms.Store.Domain.Shared; +using Win_in.Sfs.Wms.Store.Application; +using Volo.Abp.Domain.Repositories; + +namespace Win_in.Sfs.Wms.Store.Notes.ProductReceiptNotes; +[Authorize] +[Route($"{StoreConsts.RootPath}product-receipt-note-detail")] + +public class ProductReceiptNoteDetailAppService : SfsStoreAppServiceBase, IProductReceiptNoteDetailAppService +{ + private readonly IProductReceiptNoteDetailRepository _productReceiptNoteDetailRepository; + public ProductReceiptNoteDetailAppService( + IProductReceiptNoteDetailRepository repository + ) : base(repository) + { + _productReceiptNoteDetailRepository = repository; + } + + + [HttpGet("get-itemcode-by-mesbarcode")] + public virtual async Task GetItemCodeByMesBarCode(string mesBarCode) + { + var entity = await _productReceiptNoteDetailRepository.FirstOrDefaultAsync(r => r.MesBarCode == mesBarCode).ConfigureAwait(false); + var dto = ObjectMapper.Map(entity); + return dto; + } + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/IssuelRequests/KittingIssueRequests/KittingIssueRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/IssuelRequests/KittingIssueRequests/KittingIssueRequestAppService.cs index f508e12b5..7dac2cb09 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/IssuelRequests/KittingIssueRequests/KittingIssueRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/IssuelRequests/KittingIssueRequests/KittingIssueRequestAppService.cs @@ -2,8 +2,10 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Castle.Components.DictionaryAdapter; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using NUglify.Helpers; using Volo.Abp; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; @@ -138,14 +140,38 @@ public class KittingIssueRequestAppService : SfsStoreRequestAppServiceBase CancelAsync(Guid id) + { + var request=await _repository.GetAsync(id).ConfigureAwait(false); + + var list=await _kittingIssueJobAppService.GetByRequestNumberAsync(request.Number).ConfigureAwait(false); + if (list.Any()) + { + foreach (var kittingIssueJobDto in list) + { + if (kittingIssueJobDto.JobStatus == EnumJobStatus.Open || + kittingIssueJobDto.JobStatus == EnumJobStatus.Partial || + kittingIssueJobDto.JobStatus == EnumJobStatus.Doing || + kittingIssueJobDto.JobStatus == EnumJobStatus.Wait) + { + await _kittingIssueJobAppService.CancelAsync(kittingIssueJobDto.Id).ConfigureAwait(false); + } + } + } + + return await base.CancelAsync(id).ConfigureAwait(false); + } + [HttpPost("UpdateStatusCompleted")] public async Task UpdateStatusCompletedAsync(string number) { var kittingIssueRequest=await _repository.FindAsync(p=>p.Number== number).ConfigureAwait(false); + await UpdateKittingIssueRequestDetailQtyAsync(kittingIssueRequest,new EditableList()).ConfigureAwait(false); + var kittingIssueJobDtos=await _kittingIssueJobAppService.GetByRequestNumberAsync(kittingIssueRequest.Number).ConfigureAwait(false); - if (!kittingIssueJobDtos.Any(p => + if (kittingIssueJobDtos.Any(p => p.JobStatus == EnumJobStatus.Open || p.JobStatus == EnumJobStatus.Doing || p.JobStatus == EnumJobStatus.Partial) ) { @@ -175,6 +201,81 @@ public class KittingIssueRequestAppService : SfsStoreRequestAppServiceBase + /// 修改请求的 已发 已收数量 + /// + /// + /// + /// + private async Task UpdateKittingIssueRequestDetailQtyAsync(KittingIssueRequest kittingIssueRequest, + List addKittingIssueJobDtos) + { + //原有任务 + var existKittingIssueJobDtos = await _kittingIssueJobAppService.GetByRequestNumberAsync(kittingIssueRequest.Number) + .ConfigureAwait(false); + + //新增的任务和已有的任务总和 + var allKittingIssueJobDtos = new List(); + allKittingIssueJobDtos.AddRange(addKittingIssueJobDtos); + allKittingIssueJobDtos.AddRange(existKittingIssueJobDtos); + + var groupByItemCodeLocationCode = kittingIssueRequest.Details.GroupBy(p => + new { p.ItemCode, p.ToLocationCode }); + foreach (var group in groupByItemCodeLocationCode) + { + foreach (var requestDetail in group) + { + //所有已发数量 + decimal allIssuedQty = 0; + + //所有已发数量 + decimal allReceivedQty = 0; + + foreach (var allKittingIssueJobDto in allKittingIssueJobDtos) + { + var jobDetailDtos = allKittingIssueJobDto.Details.Where(p => + p.ItemCode == group.Key.ItemCode && p.RequestLocationCode == group.Key.ToLocationCode); + //所有已发数量 + allIssuedQty += jobDetailDtos.Sum(p => p.RequestQty); + //所有已发数量 + allReceivedQty += jobDetailDtos.Sum(p => p.HandledToQty); + } + + requestDetail.IssuedQty += allIssuedQty; + requestDetail.ReceivedQty += allReceivedQty; + } + } + + await _repository.UpdateAsync(kittingIssueRequest).ConfigureAwait(false); + } + + [HttpPost("IsHasNewJob")] + public async Task IsHasNewJobAsync(string requestNumber,List jobNumber) + { + var joblIssueJobDtos=await _kittingIssueJobAppService.GetByRequestNumberAsync(requestNumber).ConfigureAwait(false); + if (joblIssueJobDtos != null && joblIssueJobDtos.Any()) + { + var jobNumberList = joblIssueJobDtos.Select(p => p.Number); + + var difference = jobNumberList.Except(jobNumber); + if (difference.Any()) + { + var result = "已生成任务号"; + difference.ForEach(p=> result+="【"+p+"】"); + result += "的任务"; + return result; + } + else + { + return "无任务生成,请检查库存"; + } + } + else + { + return "无任务生成,请检查库存"; + } + } + #region 校验 private void CheckStatus(EnumRequestStatus targetStatus, EnumRequestStatus nowStatus) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/ExchangeDatas/EnumExchangeDataType.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/ExchangeDatas/EnumExchangeDataType.cs index 09a3b16e9..547f89df8 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/ExchangeDatas/EnumExchangeDataType.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/ExchangeDatas/EnumExchangeDataType.cs @@ -32,18 +32,6 @@ public enum EnumExchangeDataType //回收料调整 Item_Transform = 28, //半成品上架 - SemiPutaway = 29, - /// - /// 注塑发料 - /// - InjectionIssue=30, - /// - /// 涂装发料 - /// - CoatingIssue=31, - /// - /// 装配发料 - /// - AssembleIssue=32, + SemiPutaway = 29, } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobManager.cs index 0725bd952..dd45e4f9b 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobManager.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Linq.Expressions; using System.Threading.Tasks; using Volo.Abp; +using Volo.Abp.Domain.Repositories; using Volo.Abp.Users; using Volo.Abp.Validation; using Win_in.Sfs.Shared.Domain.Shared; @@ -18,7 +19,9 @@ public class KittingIssueJobManager : SfsJobManagerBase +{ +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs index 5fd1058d9..7038db0fd 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs @@ -74,6 +74,8 @@ public interface IStoreDbContext : IEfCoreDbContext public DbSet JisProductReceiptNotes { get; } public DbSet ProductReceiptNotes { get; } + + public DbSet ProductReceiptNoteDetails { get; } public DbSet OfflineSettlementNotes { get; } public DbSet BackFlushNotes { get; } public DbSet ProductL7PartsNotes { get; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/ProductReceiptNotes/ProductReceiptNoteDetailEfCoreRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/ProductReceiptNotes/ProductReceiptNoteDetailEfCoreRepository.cs new file mode 100644 index 000000000..1f3c9d5b3 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/ProductReceiptNotes/ProductReceiptNoteDetailEfCoreRepository.cs @@ -0,0 +1,10 @@ +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; +public class ProductReceiptNoteDetailEfCoreRepository : SfsStoreEfCoreRepositoryBase, IProductReceiptNoteDetailRepository +{ + public ProductReceiptNoteDetailEfCoreRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs index 5aca78453..8ef095cd4 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs @@ -73,6 +73,8 @@ public class StoreDbContext : AbpDbContext, IStoreDbContext public DbSet JisProductReceiptNotes { get; set; } public DbSet ProductReceiptNotes { get; set; } + + public DbSet ProductReceiptNoteDetails { get; set; } public DbSet OfflineSettlementNotes { get; set; } public DbSet BackFlushNotes { get; set; } public DbSet ProductL7PartsNotes { get; set; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs index a40b7bf6c..600f637f7 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs @@ -95,6 +95,7 @@ public class StoreEntityFrameworkCoreModule : AbpModule context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); + context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); @@ -106,7 +107,8 @@ public class StoreEntityFrameworkCoreModule : AbpModule context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); - context.Services.AddTransient(); context.Services.AddTransient(); + context.Services.AddTransient(); + context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/AssembleIssueNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/AssembleIssueNoteEventHandler.cs index bfcaccd94..8b0ef87ed 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/AssembleIssueNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/AssembleIssueNoteEventHandler.cs @@ -12,15 +12,15 @@ using Win_in.Sfs.Wms.Store.Notes.IssueNotes; namespace Win_in.Sfs.Wms.Store.Event.DataExchanges; /// -/// 装配发料记录传给TYRP(线边仓领料单) +/// 装配线边=>外购件 库移记录传给TYRP(线边仓领料单) /// public class AssembleIssueNoteEventHandler : StoreDataExchangeEventHandlerBase , ILocalEventHandler> , ILocalEventHandler>> { - - private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.AssembleIssue; + //线边仓领料单 + private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.Issue; [UnitOfWork] public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/CoatingIssueNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/CoatingIssueNoteEventHandler.cs index 523e5973f..d73bea9fb 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/CoatingIssueNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/CoatingIssueNoteEventHandler.cs @@ -19,8 +19,8 @@ public class CoatingIssueNoteEventHandler , ILocalEventHandler> , ILocalEventHandler>> { - - private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.CoatingIssue; + //线边仓领料单 + private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.Issue; [UnitOfWork] public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/InjectionIssueNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/InjectionIssueNoteEventHandler.cs index 10600d8ce..34d324950 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/InjectionIssueNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/InjectionIssueNoteEventHandler.cs @@ -18,8 +18,8 @@ public class InjectionIssueNoteEventHandler , ILocalEventHandler> , ILocalEventHandler>> { - - private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.InjectionIssue; + //线边仓领料单 + private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.Issue; [UnitOfWork] public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/KittingIssueNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/KittingIssueNoteEventHandler.cs new file mode 100644 index 000000000..d2f44e76f --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/KittingIssueNoteEventHandler.cs @@ -0,0 +1,107 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.EventBus; +using Volo.Abp.Uow; +using Win_in.Sfs.Shared.Domain; +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.Notes.IssueNotes; + +namespace Win_in.Sfs.Wms.Store.Event.DataExchanges; + +/// +/// Kitting区=>装配线边库移记录传给TYRP(线边仓领料单) +/// +public class KittingIssueNoteEventHandler + : StoreDataExchangeEventHandlerBase + , ILocalEventHandler> + , ILocalEventHandler>> +{ + //Kitting区 线边仓领料单 + private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.Issue; + + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + await AddExchangeDataAsync(entity).ConfigureAwait(false); + } + + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entities = eventData.Entity; + await AddExchangeDataAsync(entities).ConfigureAwait(false); + } + + protected override async Task AddExchangeDataAsync(List entities) + { + var dtos = ObjectMapper.Map, List>(entities); + foreach (var detail in dtos.SelectMany(dto => dto.Details)) + { + if (string.IsNullOrEmpty(detail.HandledFromLocationErpCode)) + { + var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false); + if (location != null) + { + detail.HandledFromLocationErpCode = location.ErpLocationCode; + detail.HandledFromLocationGroup = location.LocationGroupCode; + detail.HandledFromLocationArea = location.AreaCode; + + if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode)) + { + detail.HandledFromWarehouseCode = location.WarehouseCode; + } + } + } + + if (string.IsNullOrEmpty(detail.HandledToLocationErpCode)) + { + var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false); + if (location != null) + { + detail.HandledToLocationErpCode = location.ErpLocationCode; + detail.HandledToLocationGroup = location.LocationGroupCode; + detail.HandledToLocationArea = location.AreaCode; + + if (string.IsNullOrEmpty(detail.HandledToWarehouseCode)) + { + detail.HandledToWarehouseCode = location.WarehouseCode; + } + } + } + + } + + var toErpDto = new List(); + foreach (var item in dtos) + { + if (item.Details != null && item.Details.Count != 0) + { + toErpDto.Add(item); + } + } + + //2023-12-6要求同储位不传入接口 按历史规则 + var result = new List(); + foreach (var kittingIssueNoteDto in toErpDto) + { + kittingIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.HandledToLocationErpCode); + if (kittingIssueNoteDto.Details.Count > 0) + { + result.Add(kittingIssueNoteDto); + } + } + + if (result.Count > 0) + { + var exchangeDataerp = + await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, result) + .ConfigureAwait(false); + await AddManyAsync(exchangeDataerp).ConfigureAwait(false); + } + } + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ThirdLocationNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ThirdLocationNoteEventHandler.cs index 7adb5dde4..dd745a257 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ThirdLocationNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ThirdLocationNoteEventHandler.cs @@ -14,16 +14,15 @@ using ILocationAclService = Win_in.Sfs.Wms.Store.Domain.Acl.Location.ILocationAc namespace Win_in.Sfs.Wms.Store.Event.DataExchanges { + /// + /// 三方库库移记录传给TYRP(储位调拨单) + /// public class ThirdLocationNoteEventHandler : StoreDataExchangeEventHandlerBase , ILocalEventHandler> { - private readonly Domain.Acl.Location.ILocationAclService _locationAclService; - - public ThirdLocationNoteEventHandler(ILocationAclService locationAclService) - { - _locationAclService = locationAclService; - } + //三方库 储位调拨单 + private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.Transfer; [UnitOfWork] public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) @@ -32,11 +31,22 @@ namespace Win_in.Sfs.Wms.Store.Event.DataExchanges await AddExchangeDataAsync(entity).ConfigureAwait(false); } + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entities = eventData.Entity; + await AddExchangeDataAsync(entities).ConfigureAwait(false); + } + protected override async Task AddExchangeDataAsync(List entities) { var dtos = ObjectMapper.Map, List>(entities); - - var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, EnumExchangeDataType.Transfer, dtos).ConfigureAwait(false); + foreach (var detail in dtos.SelectMany(dto => dto.Details)) + { + await detail.TrySetLocationAsync(LocationAclService).ConfigureAwait(false); + } + + var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, dtos).ConfigureAwait(false); await AddManyAsync(exchangeData).ConfigureAwait(false); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/KittingIssueJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/KittingIssueJobEventHandler.cs index b2f396b3a..ae77c1b59 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/KittingIssueJobEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/KittingIssueJobEventHandler.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Castle.Components.DictionaryAdapter; using Volo.Abp.EventBus; using Volo.Abp.Uow; using Win_in.Sfs.Basedata.Application.Contracts; @@ -183,6 +184,8 @@ public class KittingIssueJobEventHandler : detailInput.RecommendToLocationErpCode = detail.RecommendToLocationErpCode; detailInput.RecommendToWarehouseCode = detail.RecommendToWarehouseCode; + input.Details = new EditableList() { detailInput }; + await _transferLibRequestAppService.CreateAsync(input).ConfigureAwait(false); } }