From 235416c98e8a9a079e7c6708b50797a160be3817 Mon Sep 17 00:00:00 2001
From: zhaoxinyu <89237069@qq.com>
Date: Tue, 23 Apr 2024 13:05:28 +0800
Subject: [PATCH 1/3] =?UTF-8?q?Kitting=E6=B7=BB=E5=8A=A0=E9=9B=B6=E4=BB=B6?=
=?UTF-8?q?=E6=A0=A1=E9=AA=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Kittings/Inputs/KittingImportInput.cs | 22 +++++----
.../Kittings/KittingAppService.cs | 47 +++++++++++++++++--
2 files changed, 56 insertions(+), 13 deletions(-)
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/Inputs/KittingImportInput.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/Inputs/KittingImportInput.cs
index 7b48e3b61..3062be0a7 100644
--- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/Inputs/KittingImportInput.cs
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/Inputs/KittingImportInput.cs
@@ -5,6 +5,18 @@ namespace Win_in.Sfs.Basedata.Application.Contracts;
[Display(Name = "Kitting箱")]
public class KittingImportInput : SfsBaseDataImportInputBase
{
+
+
+ [Display(Name = "Kitting编码")]
+ public string Code { get; set; }
+
+ ///
+ /// Kitting名称
+ ///
+ [Display(Name = "Kitting名称")]
+ public string Name { get; set; }
+
+
///
/// Kitting编码
///
@@ -34,15 +46,7 @@ public class KittingImportInput : SfsBaseDataImportInputBase
- [Display(Name = "Kitting编码")]
- public string Code { get; set; }
-
- ///
- /// Kitting名称
- ///
- [Display(Name = "Kitting名称")]
- public string Name { get; set; }
-
+
///
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Kittings/KittingAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Kittings/KittingAppService.cs
index e3020c8bc..8b513d23d 100644
--- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Kittings/KittingAppService.cs
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Kittings/KittingAppService.cs
@@ -36,14 +36,22 @@ public class KittingAppService : SfsBaseDataWithCodeAppServiceBase cache, IKittingManager manager, IExportImportService excelService) : base(repository,cache)
+ public KittingAppService(IKittingRepository repository, IDistributedCache cache, IKittingManager manager,
+ IExportImportService excelService,
+ IItemBasicRepository itmBasicRepository
+ ) : base(repository,cache)
{
_repository = repository;
_manager = manager;
- _excelService = excelService;
+ _excelService = excelService;
+ _itmBasicRepository = itmBasicRepository;
//base.CreatePolicyName = KittingPermissions.Create;
//base.UpdatePolicyName = KittingPermissions.Update;
//base.DeletePolicyName = KittingPermissions.Delete;
@@ -151,13 +159,40 @@ public class KittingAppService : SfsBaseDataWithCodeAppServiceBase(inputFileBytes).ToList();
var checklist=importList.GroupBy(p => new { p.Code, p.ItemCode }).Where(g => g.Count() > 1).Select(p => new { Code = p.Key.Code, PartCode = p.Key.ItemCode });//导入重复报错 //检测是否导入重复
List errors = new List();
+
+
+ var importPartList = importList.Select(p => p.ItemCode).Distinct().ToList();
+ var partContainList = await _itmBasicRepository.GetListAsync(p => importPartList.Distinct().Contains(p.Code)).ConfigureAwait(false);
+
+ var partCodeList1 = partContainList.Select(p => p.Code);
+
+ var errorQuery = from itm in importPartList join itm1 in partCodeList1 on itm equals itm1 into temp from tm in temp.DefaultIfEmpty() where tm == null select itm;
+
+ if (errorQuery.Any())
+ {
+ foreach (var error in errorQuery)
+ {
+ errors.Add(new KittingErrorDto() { Code = "", PartCode = error, Content = "不在零件基础信息!" });
+ }
+ }
if (checklist.Any())
{
foreach (var error in checklist) {
errors.Add(new KittingErrorDto() { Code=error.Code,PartCode=error.PartCode, Content="记录有重复!" });
}
}
- var codeList=importList.Select(p=>p.Code).Distinct().ToList();
+ if (errors.Count > 0)
+ {
+ var fileContent = _excelService.Export(errors);
+ return new TestResult(fileContent.FileContents, ExportImportService.ContentType) { FileDownloadName = "错误信息" };
+ }
+ foreach (var itm in importList)
+ {
+ itm.ItemName = partContainList.FirstOrDefault(p => p.Code == itm.ItemCode)?.Name;
+ itm.ItemDesc1 = partContainList.FirstOrDefault(p => p.Code == itm.ItemCode)?.Desc1;
+ itm.ItemDesc2 = partContainList.FirstOrDefault(p => p.Code == itm.ItemCode)?.Desc2;
+ }
+ var codeList = importList.Select(p => p.Code).Distinct().ToList();
var includeList = query.Where(p => codeList.Contains(p.Code)).ToList();
var existCodeList = includeList.Select(p => p.Code).ToList();
var newCodeList = from itm in codeList
@@ -188,6 +223,8 @@ public class KittingAppService : SfsBaseDataWithCodeAppServiceBase, List>(newKittingInputList);
+
+
foreach (var itm in kittingList)
{
var id = Guid.NewGuid();
@@ -196,8 +233,10 @@ public class KittingAppService : SfsBaseDataWithCodeAppServiceBase
Date: Tue, 23 Apr 2024 17:12:22 +0800
Subject: [PATCH 2/3] =?UTF-8?q?=E5=AE=8C=E6=88=90=20kitting=E7=BB=84?=
=?UTF-8?q?=E5=8C=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ProductionLineItemAppService.cs | 11 ++--------
.../ProductionLineItems/ProductionLineItem.cs | 1 -
...ineItemDbContextModelCreatingExtensions.cs | 13 -----------
.../IChassisOperationSequenceAppService.cs | 3 ++-
.../ChassisOperationSequenceAppService.cs | 4 ++--
.../KittingPackagingNoteAppService.cs | 22 ++++++++++++++++---
.../KittingPackagingNoteAutoMapperProfile.cs | 12 ++++++++++
.../StoreApplicationAutoMapperProfile.cs | 1 +
.../KittingPackagingNote.cs | 2 +-
...ingNoteDbContextModelCreatingExtensions.cs | 2 --
.../KittingPackagingNoteHandler.cs | 20 +++++++++++------
11 files changed, 52 insertions(+), 39 deletions(-)
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLineItems/ProductionLineItemAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLineItems/ProductionLineItemAppService.cs
index 88e1ba22e..3b126dc7a 100644
--- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLineItems/ProductionLineItemAppService.cs
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLineItems/ProductionLineItemAppService.cs
@@ -16,17 +16,10 @@ public class ProductionLineItemAppService :
SfsBaseDataAppServiceBase, IProductionLineItemAppService
{
- private new readonly IProductionLineItemRepository _repository;
-
public ProductionLineItemAppService(
- IProductionLineItemRepository repository
- , IDistributedCache cache
- , IProductionLineItemManager manager
- , IProductionLineAppService prodLineAppService
+ IProductionLineItemRepository repository, IDistributedCache cache
) : base(repository, cache)
{
- _repository = repository;
-
base.CreatePolicyName = ProductionLineItemPermissions.Create;
base.UpdatePolicyName = ProductionLineItemPermissions.Update;
base.DeletePolicyName = ProductionLineItemPermissions.Delete;
@@ -36,7 +29,7 @@ public class ProductionLineItemAppService :
public virtual async Task UpsertAsync(ProductionLineItemEditInput input)
{
var entity = ObjectMapper.Map(input);
- await _repository.UpsertAsync(entity).ConfigureAwait(false);
+ await _repository.UpdateAsync(entity).ConfigureAwait(false);
}
protected override async Task ValidateImportModelAsync(ProductionLineItemImportInput importInput,
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/ProductionLineItems/ProductionLineItem.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/ProductionLineItems/ProductionLineItem.cs
index c319c0d17..649f0a8c1 100644
--- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/ProductionLineItems/ProductionLineItem.cs
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/ProductionLineItems/ProductionLineItem.cs
@@ -14,7 +14,6 @@ public class ProductionLineItem : SfsBaseDataAggregateRootBase
///
/// 生产线代码
///
- [Key]
[Display(Name = "生产线代码")]
[Required(ErrorMessage = "{0}是必填项")]
[IgnoreUpdate]
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/ProductionLineItems/ProductionLineItemDbContextModelCreatingExtensions.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/ProductionLineItems/ProductionLineItemDbContextModelCreatingExtensions.cs
index 6da2af05f..7eb8a17de 100644
--- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/ProductionLineItems/ProductionLineItemDbContextModelCreatingExtensions.cs
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/ProductionLineItems/ProductionLineItemDbContextModelCreatingExtensions.cs
@@ -17,21 +17,8 @@ public static class ProductionLineItemDbContextModelCreatingExtensions
b.ConfigureByConvention();
//Configure Sfs base properties
b.ConfigureSfsBase();
-
- //Properties
- //b.Property(x => x.ProdLineId).IsRequired();
- //b.Property(x => x.ItemId).IsRequired();
- //b.Property(x => x.BomId).IsRequired();
- //b.Property(x => x.RoutingId).IsRequired();
-
b.Property(x => x.ProdLineCode).IsRequired();
b.Property(x => x.ItemCode).IsRequired();
-
- //Relations
- //None
-
- //Indexes
- b.HasIndex(q => new { q.ProdLineCode, q.ItemCode }).IsUnique();
});
}
}
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 d6a0546ee..0454175f1 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
@@ -15,6 +15,7 @@ public interface IChassisOperationSequenceAppService
///
///
///
+ ///
///
- Task UpdateChassisSortNumberByKittingCodeAsync(string kittingCode, long newChassisSortNumber);
+ Task UpdateChassisSortNumberByKittingCodeAsync(string kittingCode, long newChassisSortNumber,string chassisNumber);
}
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 289f78092..ef2bcadd0 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
@@ -41,7 +41,7 @@ public class ChassisOperationSequenceAppService
///
///
[HttpPost("update-chassis-sort-number-by-kitting-code")]
- public async Task UpdateChassisSortNumberByKittingCodeAsync(string kittingCode, long newChassisSortNumber)
+ public async Task UpdateChassisSortNumberByKittingCodeAsync(string kittingCode, long newChassisSortNumber, string chassisNumber)
{
var chassisOperationSequence =
await _repository.FindAsync(p => p.KittingCode == kittingCode).ConfigureAwait(false);
@@ -50,7 +50,7 @@ public class ChassisOperationSequenceAppService
{
var input= new ChassisOperationSequenceEditInput();
input.KittingCode=kittingCode;
- input.ChassisNumber = string.Empty;
+ input.ChassisNumber = chassisNumber;
input.ChassisSortNumber = newChassisSortNumber;
await CreateAsync(input).ConfigureAwait(false);
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/KittingPackagingNotes/KittingPackagingNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/KittingPackagingNotes/KittingPackagingNoteAppService.cs
index e493af73d..e4a232f71 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/KittingPackagingNotes/KittingPackagingNoteAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/KittingPackagingNotes/KittingPackagingNoteAppService.cs
@@ -3,13 +3,18 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Castle.Components.DictionaryAdapter;
+using DocumentFormat.OpenXml.Spreadsheet;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
+using Volo.Abp.Guids;
+using Volo.Abp.ObjectMapping;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Basedata.Boms.DTOs;
using Win_in.Sfs.Basedata.Domain;
using Win_in.Sfs.Basedata.Domain.Shared;
+using Win_in.Sfs.Shared.Application;
+using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared;
@@ -35,20 +40,25 @@ public class KittingPackagingNoteAppService
private readonly IChassisOperationSequenceAppService _chassisOperationSequenceAppService;
private readonly IBomAppService _bomAppService;
private readonly IKittingAppService _kittingAppService;
+ private readonly IKittingPackagingNoteManager _kittingPackagingNoteManager;
public KittingPackagingNoteAppService(
- IKittingPackagingNoteRepository repository, IChassisOperationSequenceAppService chassisOperationSequenceAppService, IBomAppService bomAppService, IKittingAppService kittingAppService) : base(repository)
+ IKittingPackagingNoteRepository repository, IChassisOperationSequenceAppService chassisOperationSequenceAppService, IBomAppService bomAppService, IKittingAppService kittingAppService, IKittingPackagingNoteManager kittingPackagingNoteManager) : base(repository)
{
_chassisOperationSequenceAppService = chassisOperationSequenceAppService;
_bomAppService = bomAppService;
_kittingAppService = kittingAppService;
+ _kittingPackagingNoteManager = kittingPackagingNoteManager;
}
[HttpPost("")]
public override async Task CreateAsync(KittingPackagingNoteEditInput input)
{
var sortNumber=input.DepDetails.Max(p => p.ChassisSortNumber);
- await _chassisOperationSequenceAppService.UpdateChassisSortNumberByKittingCodeAsync(input.KittingCode,sortNumber).ConfigureAwait(false);
+ var maxChassisDetailInputs = input.DepDetails.First(p => p.ChassisSortNumber== sortNumber);
+ input.Details = new EditableList();
+
+ await _chassisOperationSequenceAppService.UpdateChassisSortNumberByKittingCodeAsync(input.KittingCode,sortNumber, maxChassisDetailInputs.ChassisNumber).ConfigureAwait(false);
//所有底盘转换为总成的零件号
var chassisItemCode = new List();
var listItemCode=input.DepDetails.Select(p => p.ItemCode);
@@ -91,6 +101,12 @@ public class KittingPackagingNoteAppService
}
input.DepDetails.ForEach(p=>p.KittingCode=input.KittingCode);
- return await base.CreateAsync(input).ConfigureAwait(false);
+ var entity = input.ToObject();
+ entity.SetIdAndNumberWithDetails(GuidGenerator, await GenerateNumberAsync(typeof(KittingPackagingNote).Name, entity.ActiveDate).ConfigureAwait(false));
+ entity.DepDetails.ForEach(p=>p.SetIdAndNumber(GuidGenerator, entity.Id, entity.Number));
+
+ var result=await _repository.InsertAsync(entity).ConfigureAwait(false);
+ await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData(result), false).ConfigureAwait(false);
+ return ObjectMapper.Map(result);
}
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/KittingPackagingNotes/KittingPackagingNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/KittingPackagingNotes/KittingPackagingNoteAutoMapperProfile.cs
index c7b01d559..6498aa767 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/KittingPackagingNotes/KittingPackagingNoteAutoMapperProfile.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/KittingPackagingNotes/KittingPackagingNoteAutoMapperProfile.cs
@@ -11,5 +11,17 @@ public partial class StoreApplicationAutoMapperProfile : Profile
{
CreateMap()
.ReverseMap();
+
+ CreateMap()
+ .ReverseMap();
+
+ CreateMap()
+ .ReverseMap();
+
+ CreateMap();
+
+ CreateMap();
+
+ CreateMap();
}
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs
index 5e2ebfd9b..2e3025d3c 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs
@@ -136,5 +136,6 @@ public partial class StoreApplicationAutoMapperProfile : Profile
ChassisAutoMapperProfile();
ChassisOperationSequenceAutoMapperProfile();
+ KittingPackagingNoteAutoMapperProfile();
}
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/KittingPackagingNotes/KittingPackagingNote.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/KittingPackagingNotes/KittingPackagingNote.cs
index 204a3d063..fde3486e3 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/KittingPackagingNotes/KittingPackagingNote.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/KittingPackagingNotes/KittingPackagingNote.cs
@@ -18,7 +18,7 @@ public class KittingPackagingNote : SfsStoreAggregateRootBase
/// 明细(记录Kitting打包中的子物品明细)
///
- public List Details { get; set; } = new();
+ public override List Details { get; set; } = new();
///
/// 明细(记录底盘相关的信息)
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/KittingPackagingNotes/KittingPackagingNoteDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/KittingPackagingNotes/KittingPackagingNoteDbContextModelCreatingExtensions.cs
index 77c5acc94..2ee0c6e2e 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/KittingPackagingNotes/KittingPackagingNoteDbContextModelCreatingExtensions.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/KittingPackagingNotes/KittingPackagingNoteDbContextModelCreatingExtensions.cs
@@ -40,7 +40,6 @@ public static class KittingPackagingNoteDbContextModelCreatingExtensions
//Properties
b.Property(q => q.KittingCode).HasMaxLength(SfsPropertyConst.CodeLength);
//Indexes
- b.HasIndex(q => new { q.KittingCode }).IsUnique();
});
@@ -55,7 +54,6 @@ public static class KittingPackagingNoteDbContextModelCreatingExtensions
//Properties
b.Property(q => q.KittingCode).HasMaxLength(SfsPropertyConst.CodeLength);
//Indexes
- b.HasIndex(q => new { q.KittingCode }).IsUnique();
});
}
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/KittingPackagingNoteHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/KittingPackagingNoteHandler.cs
index 0062b8f79..d3f34885b 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/KittingPackagingNoteHandler.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/KittingPackagingNoteHandler.cs
@@ -24,13 +24,15 @@ public class KittingPackagingNoteEventHandler
private readonly IProductionLineAppService _productionLineAppService;
private readonly IProductionLineItemAppService _productionLineItemAppService;
private readonly ILocationAppService _locationAppService;
+ private readonly ITransferLogAppService _transferLogAppService;
public KittingPackagingNoteEventHandler(
- IProductionLineAppService productionLineAppService, ILocationAppService locationAppService, IProductionLineItemAppService productionLineItemAppService)
+ IProductionLineAppService productionLineAppService, ILocationAppService locationAppService, IProductionLineItemAppService productionLineItemAppService, ITransferLogAppService transferLogAppService)
{
_productionLineAppService = productionLineAppService;
_locationAppService = locationAppService;
_productionLineItemAppService = productionLineItemAppService;
+ _transferLogAppService = transferLogAppService;
}
[UnitOfWork]
@@ -38,7 +40,7 @@ public class KittingPackagingNoteEventHandler
{
var entity = eventData.Entity;
var transferLogEditInputs = await BuildTransferLogsAsync(entity).ConfigureAwait(false);
- await TransferLogAppService.AddManyAsync(transferLogEditInputs).ConfigureAwait(false);
+ await _transferLogAppService.AddManyAsync(transferLogEditInputs).ConfigureAwait(false);
}
[UnitOfWork]
@@ -51,7 +53,7 @@ public class KittingPackagingNoteEventHandler
transferLogCreateInputs.AddRange(await BuildTransferLogsAsync(entitie).ConfigureAwait(false));
}
- await TransferLogAppService.AddManyAsync(transferLogCreateInputs).ConfigureAwait(false);
+ await _transferLogAppService.AddManyAsync(transferLogCreateInputs).ConfigureAwait(false);
}
///
@@ -73,7 +75,11 @@ public class KittingPackagingNoteEventHandler
//Kitting线边库位
var kittingLocation =
- await LocationAclService.GetFirstByTypeAsync(EnumLocationType.KittingWip).ConfigureAwait(false);
+ await _locationAppService.GetFirstByTypeAsync(EnumLocationType.KittingWip).ConfigureAwait(false);
+ if (kittingLocation == null)
+ {
+ throw new UserFriendlyException("没有设置Kitting线边库位");
+ }
foreach (var detail in kittingPackagingNote.Details.Where(detail => detail.Qty != 0))
{
@@ -81,14 +87,14 @@ public class KittingPackagingNoteEventHandler
if (productionLineItemDtos == null)
{
var strProductionLine = string.Empty;
- productionLineList.ForEach(dto => strProductionLine += " " + dto.Code);
- throw new UserFriendlyException($"没有在 生产线代码列表中找到【{strProductionLine}】物料代码【{detail.ItemCode}】的配置");
+ productionLineList.ForEach(dto => strProductionLine += dto.Code+ ",");
+ throw new UserFriendlyException($"没有在 【生产线零件】中找到 生产线代码【{strProductionLine.Remove(strProductionLine.Length-1)}】物料代码【{detail.ItemCode}】的配置");
}
var list = JsonSerializer.Deserialize>(productionLineItemDtos.WipLocationCodeListJson);
if (list == null || list.Count < 1)
{
- throw new UserFriendlyException($"没有在 生产线代码【{productionLineItemDtos.ProdLineCode}】物料代码【{detail.ItemCode}】中配置线边库位");
+ throw new UserFriendlyException($"没有在 【生产线零件】中 生产线代码【{productionLineItemDtos.ProdLineCode}】物料代码【{detail.ItemCode}】中配置线边库位");
}
var assembleFirstLocationCode = list.First();
From e11d8b598080e501d9c3a7de1ccb283ad3beeb15 Mon Sep 17 00:00:00 2001
From: zhouhongjun <565221961@qq.com>
Date: Wed, 24 Apr 2024 08:22:21 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=89=E6=96=B9?=
=?UTF-8?q?=E5=BA=93TYRP=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ThirdLocationNoteEventHandler.cs | 45 +++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ThirdLocationNoteEventHandler.cs
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
new file mode 100644
index 000000000..abd58f12a
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ThirdLocationNoteEventHandler.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.EventBus;
+using Volo.Abp.Uow;
+using Win_in.Sfs.Basedata.Application.Contracts;
+using Win_in.Sfs.Shared.Event;
+using Win_in.Sfs.Wms.Inventory.Domain.Acl.Location;
+using Win_in.Sfs.Wms.Store.Application.Contracts;
+using Win_in.Sfs.Wms.Store.Domain;
+using ILocationAclService = Win_in.Sfs.Wms.Store.Domain.Acl.Location.ILocationAclService;
+
+namespace Win_in.Sfs.Wms.Store.Event.DataExchanges
+{
+ public class ThirdLocationNoteEventHandler :
+ StoreDataExchangeEventHandlerBase
+ , ILocalEventHandler>
+ {
+ private readonly Domain.Acl.Location.ILocationAclService _locationAclService;
+
+ public ThirdLocationNoteEventHandler(ILocationAclService locationAclService)
+ {
+ _locationAclService = locationAclService;
+ }
+
+ [UnitOfWork]
+ public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData)
+ {
+ var entity = eventData.Entity;
+ await AddExchangeDataAsync(entity).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);
+ await AddManyAsync(exchangeData).ConfigureAwait(false);
+
+ }
+ }
+}