From 0f608482fe3302b2d507c55ece76f25ca7cd81b1 Mon Sep 17 00:00:00 2001
From: lvzb <35200379@qq.com>
Date: Fri, 14 Jun 2024 15:42:18 +0800
Subject: [PATCH] =?UTF-8?q?BUG=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../MesOut/MesOut.cs | 4 +--
.../MesOutDbContextModelCreatingExtensions.cs | 4 +--
.../Incoming/MesOutReader.cs | 2 +-
.../appsettings.json | 2 +-
.../appsettings.json | 4 +--
.../Kittings/KittingAppService.cs | 15 ++++++--
.../TransferNotes/ITransferNoteAppService.cs | 1 +
.../ITransferRequestAppService.cs | 2 +-
.../TransferNotes/TransferNoteAppService.cs | 14 ++++++++
.../TransferRequestAppService.cs | 15 ++++++--
.../TransferNotes/ITransferNoteManager.cs | 1 +
.../TransferNotes/TransferNoteManager.cs | 28 +++++++++++++--
.../TransferRequestManager.cs | 11 ++++++
.../Transactions/TransferNoteEventHandler.cs | 35 ++++++++++++++++++-
14 files changed, 121 insertions(+), 17 deletions(-)
diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/MesOut/MesOut.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/MesOut/MesOut.cs
index de58a3987..426a5e92f 100644
--- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/MesOut/MesOut.cs
+++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/MesOut/MesOut.cs
@@ -13,7 +13,7 @@ public class MesOut : Entity
///
/// 条码号(20240430添加)
///
- public string Mesout_barcode { get; set; }
+ // public string Mesout_barcode { get; set; }
///
/// 调出储位
///
@@ -58,7 +58,7 @@ public class MesOut : Entity
/// 返线数量
///
public decimal Mesout_bad { get; set; }
- //public string Mes_Barcode { get; set; }
+ public string Mes_Barcode { get; set; }
public override object[] GetKeys()
{
diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/MesOut/MesOutDbContextModelCreatingExtensions.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/MesOut/MesOutDbContextModelCreatingExtensions.cs
index 0b8bdd2ff..4257c5181 100644
--- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/MesOut/MesOutDbContextModelCreatingExtensions.cs
+++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/MesOut/MesOutDbContextModelCreatingExtensions.cs
@@ -17,7 +17,7 @@ public static class MesOutDbContextModelCreatingExtensions
//Properties
b.Property(q => q.Mesout_ref_nbr).HasMaxLength(36);
- b.Property(q => q.Mesout_barcode).HasMaxLength(20);
+ //b.Property(q => q.Mesout_barcode).HasMaxLength(20);
b.Property(q => q.Mesout_id).HasMaxLength(1);
b.Property(q => q.Mesout_part).HasMaxLength(20);
b.Property(q => q.Mesout_quality).HasMaxLength(20);
@@ -30,7 +30,7 @@ public static class MesOutDbContextModelCreatingExtensions
b.Property(q => q.refno).HasMaxLength(45);
b.Property(q => q.Mesout_bad).HasPrecision(18, 2);
b.Property(q => q.Yl1);
- //b.Property(q => q.Mes_Barcode).HasMaxLength(50);
+ b.Property(q => q.Mes_Barcode).HasMaxLength(50);
});
}
diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesOutReader.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesOutReader.cs
index 97782c728..5a6894e6d 100644
--- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesOutReader.cs
+++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesOutReader.cs
@@ -167,7 +167,7 @@ public class MesOutReader : IReader
LocationErpCode = mesOut.Mesout_loc,
Remark = mesOut.memo,
ReturnQty = mesOut.Mesout_bad,
- MesBarCode = mesOut.Mesout_barcode,
+ MesBarCode = mesOut.Mes_Barcode,
MesQuality = mesOut.Mesout_quality
};
diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/appsettings.json b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/appsettings.json
index b3b640492..b21a53442 100644
--- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/appsettings.json
+++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/appsettings.json
@@ -2,7 +2,7 @@
"ConnectionStrings": {
"Default": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;TrustServerCertificate=True;Encrypt=false",
"DataExchange": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_DataExchange_CC;uid=ccwin-in;pwd=Microsoft@2022;TrustServerCertificate=True;Encrypt=false",
- "MES": "Server=dev.ccwin-in.com,13319;Database=MES_SH;uid=ccwin-in;pwd=Microsoft@2022;TrustServerCertificate=True;Encrypt=false"
+ "MES": "Server=10.164.233.7;Database=MES_JY;uid=sa;pwd=Asdf1234$;TrustServerCertificate=True;Encrypt=false"
},
"AuthServer": {
diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/appsettings.json b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/appsettings.json
index 0f8bdf492..2e0324e5f 100644
--- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/appsettings.json
+++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/appsettings.json
@@ -26,10 +26,10 @@
"RemoteServices": {
"BaseData": {
- "BaseUrl": "http://dev.ccwin-in.com:60084/"
+ "BaseUrl": "http://localhost:59094/"
},
"Store": {
- "BaseUrl": "http://dev.ccwin-in.com:60085/"
+ "BaseUrl": "http://localhost:59095/"
},
"Label": {
"BaseUrl": "http://dev.ccwin-in.com:60082/"
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 df6e5544c..c20a7072d 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
@@ -108,14 +108,23 @@ public class KittingAppService : SfsBaseDataWithCodeAppServiceBase UpdateAsync(Guid id, KittingEditInput input)
+ public override async Task UpdateAsync(Guid id, KittingEditInput input)
{
+ var detailquery = await _repository.WithDetailsAsync().ConfigureAwait(false);
+ var first = detailquery.FirstOrDefault(p => p.Code == input.Code);
+ if (first != null)
+ {
+ throw new UserFriendlyException($"已存在编码:{input.Code}的Kitting箱");
+ }
+ else
+ {
+ return await base.UpdateAsync(id, input).ConfigureAwait(false);
+ }
//var detailquery = _repository.WithDetails();
//var first = detailquery.FirstOrDefault(p => p.Id == id);
//var ids=input.Details.Select(p => p.Id);
//first.Details.Where(p =>ids.Contains(p.Id));
-
- return base.UpdateAsync(id, input);
+
//var entity = ObjectMapper.Map(input);
////entity.SetId(id);
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/ITransferNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/ITransferNoteAppService.cs
index 515522c31..00de274bf 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/ITransferNoteAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/ITransferNoteAppService.cs
@@ -90,4 +90,5 @@ public interface ITransferNoteAppService :
Task> GetInjectionTransferListAsync(SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false, CancellationToken cancellationToken = default);
Task> GetCoatingTransferListAsync(SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false, CancellationToken cancellationToken = default);
Task> GetAssembleTransferListAsync(SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false, CancellationToken cancellationToken = default);
+ Task CancelAsync(Guid id);
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/TransferRequests/ITransferRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/TransferRequests/ITransferRequestAppService.cs
index 6b3d3395d..a3016b1f9 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/TransferRequests/ITransferRequestAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/TransferRequests/ITransferRequestAppService.cs
@@ -16,5 +16,5 @@ public interface ITransferRequestAppService
Task> GetListForCustomAsync(SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false,
CancellationToken cancellationToken = default);
-
+ Task CancelByRequestNumberAsync(string number);
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs
index d55696e09..2768b848b 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs
@@ -407,6 +407,20 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
return dto;
}
+ ///
+ /// 取消已确认记录(在途回来源库位)
+ ///
+ ///
+ ///
+ [HttpPost("cancel/{id}")]
+ public virtual async Task CancelAsync(Guid id)
+ {
+ var entity = await _transferNoteManager.CancelAsync(id).ConfigureAwait(false);
+ var dto = ObjectMapper.Map(entity);
+ return dto;
+ }
+
+
///
/// 插入拆箱记录表
///
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs
index 50f6bf804..f1dd34097 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs
@@ -306,8 +306,19 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase
#endregion
#endregion
-
-
+ [HttpPost("cancel-by-request-number")]
+ public virtual async Task CancelByRequestNumberAsync(string number)
+ {
+ var requset=await _transferRequestManager.GetByNumberAsync(number).ConfigureAwait(false);
+ if (requset != null)
+ {
+ await base.CancelAsync(requset.Id).ConfigureAwait(false);
+ }
+ else
+ {
+ throw new UserFriendlyException($"未找到申请无法取消!");
+ }
+ }
///
/// 【创建】库移请求
///
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/TransferNotes/ITransferNoteManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/TransferNotes/ITransferNoteManager.cs
index a7bd64097..0e448750e 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/TransferNotes/ITransferNoteManager.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/TransferNotes/ITransferNoteManager.cs
@@ -6,5 +6,6 @@ namespace Win_in.Sfs.Wms.Store.Domain;
public interface ITransferNoteManager : ISfsStoreManager, IBulkImportService
{
+ Task CancelAsync(Guid id);
Task ConfirmAsync(Guid id);
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/TransferNotes/TransferNoteManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/TransferNotes/TransferNoteManager.cs
index d7171f75a..6c4e9957e 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/TransferNotes/TransferNoteManager.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/TransferNotes/TransferNoteManager.cs
@@ -29,7 +29,19 @@ public class TransferNoteManager : SfsStoreManagerBase CancelAsync(Guid id)
+ {
+ var entity = await Repository.FindAsync(id).ConfigureAwait(false);
+ if (entity.Confirmed)
+ {
+ throw new UserFriendlyException($"已经确认无法取消!");
+ }
+ Check.NotNull(entity, EntityClassName);
+ await PublishCancelledAsync(entity).ConfigureAwait(false);
+ await Repository.DeleteAsync(entity).ConfigureAwait(false);
+ return entity;
+ }
private async Task PublishConfirmedAsync(TransferNote entity)
{
try
@@ -43,7 +55,19 @@ public class TransferNoteManager : SfsStoreManagerBase(entity), false).ConfigureAwait(false);
+ }
+ catch (Exception ex)
+ {
+ Logger.LogDebug($"{nameof(TransferNote)} Cancelled Event:{ex.Message}", null);
+ Console.WriteLine(ex.Source);
+ throw;
+ }
+ }
///
/// 执行导入
///
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/TransferRequests/TransferRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/TransferRequests/TransferRequestManager.cs
index 8d80160d5..375a71e88 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/TransferRequests/TransferRequestManager.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/TransferRequests/TransferRequestManager.cs
@@ -1,6 +1,8 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp;
+using Volo.Abp.Uow;
+using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Domain;
@@ -72,4 +74,13 @@ public class TransferRequestManager : SfsStoreRequestManagerBase CancelAsync(TransferRequest entity)
+ {
+ entity.RequestStatus = EnumRequestStatus.Reviewing;
+ return await Repository.UpdateAsync(entity).ConfigureAwait(false);
+ }
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/TransferNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/TransferNoteEventHandler.cs
index 4e451144d..b758df87a 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/TransferNoteEventHandler.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/TransferNoteEventHandler.cs
@@ -17,16 +17,19 @@ public class TransferNoteEventHandler
: StoreInventoryEventHandlerBase
, ILocalEventHandler>
, ILocalEventHandler>
+ , ILocalEventHandler>
, ILocalEventHandler>>
{
private const EnumTransType TransType = EnumTransType.Transfer;
private readonly ILocationAppService _locationAppService;
private readonly ITransferLogAppService _transferLogAppService;
+ private readonly ITransferRequestAppService _transferRequestAppService;
- public TransferNoteEventHandler(ITransferRequestAppService transferRequestApp, ILocationAppService locationAppService, ITransferLogAppService transferLogAppService)
+ public TransferNoteEventHandler(ITransferRequestAppService transferRequestApp, ILocationAppService locationAppService, ITransferLogAppService transferLogAppService, ITransferRequestAppService transferRequestAppService)
{
_locationAppService = locationAppService;
_transferLogAppService = transferLogAppService;
+ _transferRequestAppService = transferRequestAppService;
}
///
@@ -79,7 +82,20 @@ public class TransferNoteEventHandler
var inputList = await BuildTransferLogsAsync(entity, EnumTransferRoute.OnTheWayToDestination).ConfigureAwait(false);
await AddTransferLogsAsync(inputList).ConfigureAwait(false);
}
+ ///
+ /// 取消后
+ ///
+ ///
+ ///
+ [UnitOfWork]
+ public virtual async Task HandleEventAsync(SfsCancelledEntityEventData eventData)
+ {
+ var entity = eventData.Entity;
+ var inputList = await BuildTransferLogsAsync(entity, EnumTransferRoute.OnTheWayToSource).ConfigureAwait(false);
+ await AddTransferLogsAsync(inputList).ConfigureAwait(false);
+ await _transferRequestAppService.CancelByRequestNumberAsync(entity.RequestNumber).ConfigureAwait(false); ;
+ }
private async Task AddTransferLogsAsync(List inputList)
{
var transferLogs = new List();
@@ -143,6 +159,17 @@ public class TransferNoteEventHandler
transferLog.ToLocationErpCode = toLocation.ErpLocationCode;
transferLog.ToLocationGroup = toLocation.LocationGroupCode;
break;;
+ case EnumTransferRoute.OnTheWayToSource:
+ transferLog.FromLocationCode = transferOnTheWay.Code;
+ transferLog.FromLocationArea = transferOnTheWay.AreaCode;
+ transferLog.FromLocationErpCode = transferOnTheWay.ErpLocationCode;
+ transferLog.FromLocationGroup = transferOnTheWay.LocationGroupCode;
+
+ transferLog.ToLocationCode = fromLocation.Code;
+ transferLog.ToLocationArea = fromLocation.AreaCode;
+ transferLog.ToLocationErpCode = fromLocation.ErpLocationCode;
+ transferLog.ToLocationGroup = fromLocation.LocationGroupCode;
+ break;
default:
throw new ArgumentOutOfRangeException(nameof(route), route, null);
}
@@ -158,6 +185,7 @@ public class TransferNoteEventHandler
return transferLogs;
}
+
}
public enum EnumTransferRoute
@@ -176,4 +204,9 @@ public enum EnumTransferRoute
/// 源>目标
///
SourceToDestination = 3,
+ ///
+ /// 在途>源库位
+ ///
+ OnTheWayToSource = 4,
+
}