From bec8253218bab296ac46ee9f6995ffc93f137a8c Mon Sep 17 00:00:00 2001 From: lvzb <35200379@qq.com> Date: Tue, 4 Jul 2023 10:09:05 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E7=9B=98=E7=82=B9=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E5=BA=93=E4=BD=8D=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=98=AF=E7=BA=BF=E8=BE=B9=E4=BB=93=E7=9A=84=E4=BC=A0=E7=BA=BF?= =?UTF-8?q?=E8=BE=B9=E4=BB=93=E8=B0=83=E6=95=B4=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Outgoing/CountAdjustNoteConverter.cs | 62 +++++++++++++++++-- 1 file changed, 58 insertions(+), 4 deletions(-) diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/CountAdjustNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/CountAdjustNoteConverter.cs index 197b5796d..a5990abd1 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/CountAdjustNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/CountAdjustNoteConverter.cs @@ -5,6 +5,7 @@ using System.Text.Json; using System.Threading.Tasks; using Volo.Abp.ObjectMapping; using Win_in.Sfs.Auth.Application.Contracts; +using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Wms.DataExchange.Domain; using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; @@ -21,6 +22,7 @@ public class CountAdjustNoteConverter : IOutgoingConverter private readonly ISupplierAsnAppService _supplierAsnAppService; private readonly IDepartmentAppService _departmentAppService; private readonly IObjectMapper _objectMapper; + private readonly ILocationAppService _locationAppService; public CountAdjustNoteConverter( IOutgoingFromWmsManager outgoingFromWmsManager @@ -28,6 +30,7 @@ public class CountAdjustNoteConverter : IOutgoingConverter , ISupplierAsnAppService supplierAsnAppService , IDepartmentAppService departmentAppService , IObjectMapper objectMapper + , ILocationAppService locationAppService ) { _outgoingFromWmsManager = outgoingFromWmsManager; @@ -35,6 +38,7 @@ public class CountAdjustNoteConverter : IOutgoingConverter _supplierAsnAppService = supplierAsnAppService; _departmentAppService = departmentAppService; _objectMapper = objectMapper; + _locationAppService= locationAppService; } public virtual async Task> ConvertAsync() @@ -47,9 +51,41 @@ public class CountAdjustNoteConverter : IOutgoingConverter var department = await _departmentAppService.GetByUsernameAsync(wmsCountAdjust.Worker).ConfigureAwait(false); var departmentCode = department == null ? "" : department.Code; - var details = wmsCountAdjust.Details.GroupBy(r => new { r.ItemCode, r.LocationErpCode }).Select(p => new CountAdjustNoteDetailExchangeDto { CountQty = p.Sum(itm => itm.CountQty), InventoryQty = p.Sum(itm => itm.InventoryQty), ItemCode = p.Key.ItemCode, LocationErpCode = p.Key.LocationErpCode }); - var detal = details.ToList(); - foreach (var detail in detal) + + var locs =await _locationAppService.GetListByTypesAsync(new List { EnumLocationType.WIP }).ConfigureAwait(false); + var locationCodes = locs.Select(p => p.Code); + var wipItems=wmsCountAdjust.Details.Where(p => locationCodes.Contains(p.LocationCode));//库位类型是线边,传线边仓调整 + var Items = wmsCountAdjust.Details.Where(p => !locationCodes.Contains(p.LocationCode));//盘点 + var WipDetails = wipItems.GroupBy(r => new { r.ItemCode, r.LocationErpCode }).Select(p => new CountAdjustNoteDetailExchangeDto { CountQty = p.Sum(itm => itm.CountQty), InventoryQty = p.Sum(itm => itm.InventoryQty), ItemCode = p.Key.ItemCode, LocationErpCode = p.Key.LocationErpCode }); + foreach (var detail in WipDetails) + { + //判断盘点数与库存数是否相等 + if (detail.CountQty != detail.InventoryQty) + { + var outgoingToExternal = new OutgoingToExternal() + { + DataType = outgoingFromWms.DataType, + DataAction = outgoingFromWms.DataAction, + SourceSystem = EnumSystemType.WMS.ToString(), + SourceDataId = wmsCountAdjust.Number, + SourceDataGroupCode = wmsCountAdjust.Number, + SourceDataDetailCode = WipDetails.FirstOrDefault().ItemCode, + Writer = nameof(TyrpOutgoingBackgroundWorker), + DestinationSystem = EnumSystemType.ERP.ToString(), + DestinationDataId = "", + }; + outgoingToExternal.SetEffectiveDate(outgoingFromWms.EffectiveDate); + var exchangeIssue = await BuildPurchaseReceiptExchangeDtoAsync(wmsCountAdjust, detail).ConfigureAwait(false); + outgoingToExternal.SourceDataContent = JsonSerializer.Serialize(exchangeIssue); + var arrive = BuildWip(exchangeIssue, departmentCode); + outgoingToExternal.DestinationDataContent = JsonSerializer.Serialize(arrive); + + outgoingToExternalList.Add(outgoingToExternal); + } + } + + var details = Items.GroupBy(r => new { r.ItemCode, r.LocationErpCode }).Select(p => new CountAdjustNoteDetailExchangeDto { CountQty = p.Sum(itm => itm.CountQty), InventoryQty = p.Sum(itm => itm.InventoryQty), ItemCode = p.Key.ItemCode, LocationErpCode = p.Key.LocationErpCode }); + foreach (var detail in details) { //判断盘点数与库存数是否相等 if (detail.CountQty != detail.InventoryQty) @@ -104,7 +140,25 @@ public class CountAdjustNoteConverter : IOutgoingConverter return counta; } - + private CountAdjust BuildWip(CountAdjustNoteExchangeDto exchangeCountAdjust, string departmentCode) + { + var detail = exchangeCountAdjust.Detail; + var counta = new CountAdjust() + { + mesout_asd_refc = departmentCode, + mesout_asd_dt_w = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"), + mesout_asd_type = "4041", + mesout_asd_part = detail.ItemCode, + mesout_asd_date = exchangeCountAdjust.ActiveDate.ToString("yyyyMMdd"), + mesout_asd_loc = string.Empty, + mesout_asd_code = detail.ReasonCode, + mesout_asd_qty = detail.CountQty + detail.InventoryQty, + mesout_asd_user = "WMS", + mesout_asd_k = string.Empty, + mesout_asd_stat = "Y" + }; + return counta; + } private async Task BuildPurchaseReceiptExchangeDtoAsync( CountAdjustNoteDTO wmsCountAdjust, CountAdjustNoteDetailExchangeDto wmsCountAdjustDetail) { From fcb56d134875d3a0d50371987cdfa79a9187d4ab Mon Sep 17 00:00:00 2001 From: "boxu.zheng" Date: Wed, 5 Jul 2023 13:42:29 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9B=98=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DTOs/CountPlanForNoteExportDTO.cs | 20 ++++++++++++- .../Plans/CountPlans/CountPlanAppService.cs | 29 ++++++++++++------- .../Plans/CountPlans/CountPlanManager.cs | 18 ++++++++++++ 3 files changed, 55 insertions(+), 12 deletions(-) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/CountPlans/DTOs/CountPlanForNoteExportDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/CountPlans/DTOs/CountPlanForNoteExportDTO.cs index 84b6434e7..ff01cb52e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/CountPlans/DTOs/CountPlanForNoteExportDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/CountPlans/DTOs/CountPlanForNoteExportDTO.cs @@ -26,7 +26,7 @@ public class CountPlanForNoteExportDTO /// /// 物品代码 /// - [Display(Name = "物料号")] + [Display(Name = "物品代码")] [Required(ErrorMessage = "{0}是必填项")] public string ItemCode { get; set; } @@ -36,6 +36,24 @@ public class CountPlanForNoteExportDTO [Display(Name = "物品名称")] public string ItemName { get; set; } + /// + /// 物品描述1 + /// + [Display(Name = "物品描述1")] + public string ItemDesc1 { get; set; } + + /// + /// 物品描述2 + /// + [Display(Name = "物品描述2")] + public string ItemDesc2 { get; set; } + + /// + /// 配置码 + /// + [Display(Name = "配置码")] + public string Configuration { get; set; } + /// /// 箱码 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAppService.cs index cf4254513..bba258161 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAppService.cs @@ -13,6 +13,7 @@ using Win_in.Sfs.Wms.Store.Domain.Shared; namespace Win_in.Sfs.Wms.Store.Application; +using Win_in.Sfs.Basedata.Application; using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain; @@ -36,13 +37,15 @@ public class CountPlanAppService : private readonly ICountPlanManager _countPlanManager; private readonly ITransactionTypeAppService _transactionTypeAppService; + private readonly IItemBasicAppService _itemBasicAppService; public CountPlanAppService(ICountPlanRepository repository, ICountPlanManager countPlanManager, - ITransactionTypeAppService transactionTypeAppService) : base(repository, countPlanManager) + ITransactionTypeAppService transactionTypeAppService, IItemBasicAppService itemBasicAppService) : base(repository, countPlanManager) { _countPlanManager = countPlanManager; _transactionTypeAppService = transactionTypeAppService; + _itemBasicAppService = itemBasicAppService; base.CreatePolicyName = CountPlanPermissions.Create; base.UpdatePolicyName = CountPlanPermissions.Update; @@ -63,13 +66,13 @@ public class CountPlanAppService : entity.Worker = CurrentUser.GetUserName(); - TransactionTypeDTO tranTypeDTO = null; + TransactionTypeDTO tranTypeDto = null; switch (input.RequestType) { case CountPlanRequestType.Manual: - tranTypeDTO = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.CountPlan, + tranTypeDto = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.CountPlan, EnumTransSubType.ArtificialCountPlan).ConfigureAwait(false); - if (tranTypeDTO == null) + if (tranTypeDto == null) { throw new UserFriendlyException( $"盘点方式 {input.RequestType} 没有设置库存事务类型。主事务类型{EnumTransType.CountPlan}," + @@ -78,9 +81,9 @@ public class CountPlanAppService : break; case CountPlanRequestType.Import: - tranTypeDTO = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.CountPlan, + tranTypeDto = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.CountPlan, EnumTransSubType.ExcelInCountPlan).ConfigureAwait(false); - if (tranTypeDTO == null) + if (tranTypeDto == null) { throw new UserFriendlyException( $"盘点方式 {input.RequestType} 没有设置库存事务类型。主事务类型{EnumTransType.CountPlan}," + @@ -93,11 +96,11 @@ public class CountPlanAppService : throw new UserFriendlyException($"{input.RequestType}盘点方式设置错误"); } - entity.AutoCompleteJob = tranTypeDTO.AutoCompleteJob; - entity.AutoSubmit = tranTypeDTO.AutoSubmitRequest; - entity.AutoAgree = tranTypeDTO.AutoAgreeRequest; - entity.AutoHandle = tranTypeDTO.AutoHandleRequest; - entity.DirectCreateNote = tranTypeDTO.DirectCreateNote; + entity.AutoCompleteJob = tranTypeDto.AutoCompleteJob; + entity.AutoSubmit = tranTypeDto.AutoSubmitRequest; + entity.AutoAgree = tranTypeDto.AutoAgreeRequest; + entity.AutoHandle = tranTypeDto.AutoHandleRequest; + entity.DirectCreateNote = tranTypeDto.DirectCreateNote; await _countPlanManager.CreateWithConditionAsync(entity, input.PartCondition, input.LocCondition, input.LocCondition, input.StatusList).ConfigureAwait(false); @@ -185,6 +188,7 @@ public class CountPlanAppService : foreach (var detail in request.Details) { var note = new CountPlanForNoteExportDTO(); + var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); note.CountPlanNumber = request.Number; note.LocationCode = detail.LocationCode; @@ -192,6 +196,9 @@ public class CountPlanAppService : note.ItemName = detail.ItemName; note.PackingCode = detail.PackingCode; note.ContainerCode = detail.ContainerCode; + note.ItemDesc1=detail.ItemDesc1; + note.ItemDesc2 = detail.ItemDesc1; + note.Configuration = itemBasicDto.Configuration; note.Lot = detail.Lot; note.InventoryQty = detail.InventoryQty; note.FirstCountQty = detail.FirstCountQty; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs index f0c42a09b..bcdb35698 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs @@ -132,6 +132,24 @@ public class CountPlanManager : SfsStoreRequestManagerBase p.Code).Distinct().ToList(); + + //同一个库位不能同时盘点 + var countPlans=await _repository.GetListAsync(p => + p.RequestStatus != EnumRequestStatus.Abort && + p.RequestStatus != EnumRequestStatus.Refused&& + p.RequestStatus !=EnumRequestStatus.None&& + p.RequestStatus !=EnumRequestStatus.Completed&& + p.RequestStatus !=EnumRequestStatus.Cancelled + ).ConfigureAwait(false); + foreach (var countPlan in countPlans) + { + var countPlanDetails = countPlan.Details.Where(p => selectLocationCodes.Contains(p.LocationCode)); + if (countPlanDetails != null || countPlanDetails.Count() > 0) + { + throw new UserFriendlyException($"库位只能存在于一个盘点计划中,盘点计划号【{countPlan.Number}】中已包含【{countPlanDetails.First().LocationCode}】库位。"); + } + } + } //状态查询 var statusStr = System.Text.Json.JsonSerializer.Serialize(selectStatusList.Select(p => (int)p).ToList()); From 51e2c41babfb91e38cefbb00bbe55e253b229696 Mon Sep 17 00:00:00 2001 From: "boxu.zheng" Date: Fri, 7 Jul 2023 08:39:13 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E5=8F=91=E6=96=99=20=E5=8F=98=E6=9B=B4=E4=B8=BA=20=E9=9D=9E?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E8=B0=83=E6=8B=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Enums/Inventory/EnumTransSubType.cs | 4 ++-- .../Plans/CountPlans/CountPlanManager.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransSubType.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransSubType.cs index 1434da8ce..57d1e43cd 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransSubType.cs +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransSubType.cs @@ -134,9 +134,9 @@ public enum EnumTransSubType Issue_SafetyStock = 1504, /// - /// 直接发料 + /// 非生产调拨 /// - [Display(Name = "直接发料")] + [Display(Name = "非生产调拨")] Issue_Direct = 1505, /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs index bcdb35698..846c509cc 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs @@ -139,12 +139,12 @@ public class CountPlanManager : SfsStoreRequestManagerBase selectLocationCodes.Contains(p.LocationCode)); - if (countPlanDetails != null || countPlanDetails.Count() > 0) + var countPlanDetails = countPlan.Details.Where(p => selectLocationCodes.Contains(p.LocationCode)).ToList(); + if (countPlanDetails != null && countPlanDetails.Count() > 0) { throw new UserFriendlyException($"库位只能存在于一个盘点计划中,盘点计划号【{countPlan.Number}】中已包含【{countPlanDetails.First().LocationCode}】库位。"); } From 6905a38aadbf7c4d194512f4b790d5d967fe7771 Mon Sep 17 00:00:00 2001 From: mahao Date: Fri, 7 Jul 2023 09:39:13 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=81=9C=E7=94=A8=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E4=BD=99=E9=A2=9D=E6=9B=B4=E6=96=B0=E7=89=A9=E5=93=81=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E7=94=A8=E5=85=B6=E4=BB=96=E5=A4=84=E7=90=86=E6=96=B9?= =?UTF-8?q?=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Balances/BalanceAppService.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs index 4d1ebb37b..4edd22ff0 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs @@ -658,6 +658,8 @@ public class BalanceAppService [HttpPost("update/item-basic-info")] public async Task UpdateItemBasicInfoAsync(BalanceUpdateItemBasicInfoDto balanceUpdateItemBasicInfoDto) { + //停用,可能用其他处理方案 + return; // 物品编码 var itemCodes = balanceUpdateItemBasicInfoDto.BalanceUpdateItemBasicInfos?.Select(c => c.ItemCode); itemCodes = itemCodes?.Where(t => string.IsNullOrWhiteSpace(t) == false); From c34bcaf9fe7c8fbe8a817c3fec080071749fc0d3 Mon Sep 17 00:00:00 2001 From: lvzb <35200379@qq.com> Date: Mon, 10 Jul 2023 09:14:53 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E9=AA=8C=E6=94=B6=E5=8D=95=E5=92=8C?= =?UTF-8?q?=E9=A2=86=E6=96=99=E5=8D=95=E5=86=8D=E4=BC=A0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=97=B6=E8=BF=9B=E8=A1=8C=E6=B1=87=E6=80=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Outgoing/IssueNoteConverter.cs | 5 +++-- .../Outgoing/PutawayNoteConverter.cs | 5 ++++- .../Outgoing/ScontrolWriter.cs | 5 +++++ 3 files changed, 12 insertions(+), 3 deletions(-) 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 686eecaa7..b977269d5 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 @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Text.Json; using System.Threading.Tasks; using Volo.Abp.ObjectMapping; @@ -58,9 +59,9 @@ public class IssueNoteConverter : IOutgoingConverter outgoingToExternal.DestinationDataContent = JsonSerializer.Serialize(putawayNote); outgoingToExternalList.Add(outgoingToExternal); #endregion - + var sumDetails = wmsReceipt.Details.GroupBy(r => new { r.ItemCode, r.FromLocationErpCode, r.ToLocationErpCode }).Select(p => new IssueNoteDetailDTO { ItemCode = p.Key.ItemCode, FromLocationErpCode = p.Key.FromLocationErpCode, ToLocationErpCode = p.Key.ToLocationErpCode, Qty = p.Sum(x => x.Qty) }).ToList(); #region 明细 - foreach (var detail in wmsReceipt.Details) + foreach (var detail in sumDetails) { var outgoingDetailToExternal = new OutgoingToExternal() { diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PutawayNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PutawayNoteConverter.cs index 3c1bd6cf8..06b8fe872 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PutawayNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PutawayNoteConverter.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Text.Json; using System.Threading.Tasks; using Volo.Abp.ObjectMapping; @@ -61,8 +62,10 @@ public class PutawayNoteConverter : IOutgoingConverter outgoingToExternalList.Add(outgoingToExternal); #endregion + var sumDetails= wmsReceipt.Details.GroupBy(r => new { r.ItemCode, r.PoNumber, r.ToLocationErpCode }).Select(p => new PutawayNoteDetailDTO { ItemCode = p.Key.ItemCode, PoNumber = p.Key.PoNumber, ToLocationErpCode = p.Key.ToLocationErpCode ,Qty=p.Sum(x=>x.Qty)}).ToList(); + #region 明细 - foreach (var detail in wmsReceipt.Details) + foreach (var detail in sumDetails) { var outgoingDetailToExternal = new OutgoingToExternal() { diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ScontrolWriter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ScontrolWriter.cs index ea7815a5c..df1883ceb 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ScontrolWriter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ScontrolWriter.cs @@ -49,6 +49,11 @@ public class ScontrolWriter : IWriter } try { + //零件号和ERP库位以及单据号相同则汇总 + //var groupScmsends= dataInterfaceDetailList.GroupBy(r => new { r.scmsend_type, r.scmsend_dt_w, r.scmsend_nbr, r.scmsend_stat1, r.scmsend_part, r.scmsend_delv_date, r.scmsend_orderno, r.scmsend_loc, r.scmsend_date, r.scmsend_wipd_loc, r.scmsend_userid }) + // .Select(p=>new Scmsend { scmsend_type = p.Key.scmsend_type , scmsend_dt_w =p.Key.scmsend_dt_w , scmsend_nbr =p.Key.scmsend_nbr , scmsend_stat1 =p.Key.scmsend_stat1 , scmsend_part =p.Key.scmsend_part + // , scmsend_delv_date =p.Key.scmsend_delv_date , scmsend_orderno =p.Key.scmsend_orderno , scmsend_loc =p.Key.scmsend_loc , scmsend_date=p.Key.scmsend_date, scmsend_wipd_loc = p.Key.scmsend_wipd_loc, + // scmsend_userid=p.Key.scmsend_userid,scmsend_qty=p.Sum(itm=>itm.scmsend_qty)} ).ToList(); //dataInterface分主子表分别写入ERP await _dataInterfaceManager.PostListAsync(dataInterfaceList, dataInterfaceDetailList).ConfigureAwait(false); }