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/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs
index 69f37b12d..48afaa429 100644
--- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs
+++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs
@@ -1026,6 +1026,112 @@ public class BalanceManager : DomainService, IBalanceManager
return usableBalances;
}
+ ///
+ /// 获取无箱码可用库存列表
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public virtual async Task> GetNoPackCodeUsableListAsync(string itemCode,
+ List validLocations,
+ List validStatuses, bool isRemovePackingCode)
+ {
+ var recommendBalances = new List();//返回可使用的推荐库存余额
+
+ var item = await _itemBasicAclService.GetByCodeAsync(itemCode).ConfigureAwait(false);
+ if (item == null) //物品是否存在
+ {
+ // throw new UserFriendlyException($"未找到代码为 {itemCode} 的物料记录");
+ return recommendBalances;
+ }
+
+ //构造查询条件
+ Expression> expression = p => p.ItemCode == itemCode;
+ expression = expression.And(p => validStatuses.Contains(p.Status));
+ expression = expression.And(p => p.IsActive);
+
+ //如果物品的有效期不是无限的, 要过滤掉过期库存
+ if (item.ValidityUnit != EnumValidityUnit.Infinite)
+ {
+ expression = expression.And(p => p.ExpireDate > DateTime.Now);
+ }
+ //排除有箱码库存
+ if (isRemovePackingCode)
+ {
+ expression = expression.And(p => string.IsNullOrEmpty(p.PackingCode));
+ }
+
+
+ var allBalances = await
+ (await _balanceRepository.GetDbSetAsync().ConfigureAwait(false))
+ .Where(expression)
+ .AsNoTracking()
+ .ToListAsync().ConfigureAwait(false);
+
+ var balanceLocationCodes = allBalances.Select(p => p.LocationCode).Distinct().ToList();
+ var locations = await _locationAclService.GetByCodesAsync(balanceLocationCodes).ConfigureAwait(false);
+ //筛选有效库位类型
+ if (validLocations.Any())
+ {
+ locations = locations.Where(p => validLocations.Contains(p.Code)).ToList();
+ }
+ var locationCodes = locations.Where(p => p.EnablePick).Select(p => p.Code).ToList();
+
+ if (!locationCodes.Any())
+ {
+ return recommendBalances;
+ }
+ //获取物品存储关系
+ var itemStoreRelationDict = await GetItemStoreRelationDictAsync(itemCode, locationCodes).ConfigureAwait(false);
+ //过滤掉无用的库位代码
+ locationCodes = itemStoreRelationDict.Keys.ToList();
+ locations = locations.Where(p => locationCodes.Contains(p.Code)).ToList();
+
+ var usableBalances = allBalances.Where(p => locationCodes.Contains(p.LocationCode)).ToList();
+
+ if (!usableBalances.Any())
+ {
+ return recommendBalances;
+ }
+
+ //读取该itemCode项目为空的预占用库存
+ var expectOuts = await
+ (await _expectOutRepository.GetDbSetAsync().ConfigureAwait(false))
+ .AsNoTracking()
+ .Where(p => p.ItemCode == itemCode
+ && locationCodes.Contains(p.LocationCode) && string.IsNullOrEmpty(p.PackingCode)
+ && validStatuses.Contains(p.Status))
+ .ToListAsync().ConfigureAwait(false);
+
+ var containerCodes = usableBalances
+ .Where(p => !string.IsNullOrEmpty(p.ContainerCode))
+ .Select(p => p.ContainerCode)
+ .ToList();
+
+ var expectOutContainerCodes = await
+ (await _expectOutRepository.GetDbSetAsync().ConfigureAwait(false))
+ .Where(p => containerCodes.Contains(p.ContainerCode))
+ .GroupBy(p => p.ContainerCode)
+ .Select(d => d.Key)
+ .ToListAsync().ConfigureAwait(false);
+
+ usableBalances
+ //扣减已占用库存
+ .DecreaseExpectOutQty(expectOuts, locations)
+ //去除不可拆箱 拆托的且有预占用的库存余额
+ .IgnoreExpectOutOfSameContainer(expectOutContainerCodes, itemStoreRelationDict, locations)
+ //过滤掉不允许拣料的库位
+ .FilterLocationEnablePickAsync(locations)
+ //排序库存余额 最终可用的余额集合
+ .SortByFifo();
+ usableBalances = usableBalances.Where(p => p.Qty != 0).ToList();
+
+ return usableBalances;
+ }
+
+
private decimal GetRecommendQty(Guid traceId, decimal requestQty, decimal remainingQty, Balance usableBalance, LocationDTO location, ItemStoreRelationDTO itemStoreRelation)
{
var balanceQty = usableBalance.Qty;
diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/IBalanceManager.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/IBalanceManager.cs
index 1d2e4880d..a5f0ad18c 100644
--- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/IBalanceManager.cs
+++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/IBalanceManager.cs
@@ -51,5 +51,9 @@ public interface IBalanceManager : IDomainService
Task> GetUsableListAsync(string itemCode,
List validLocations,
List validStatuses, bool isRemovePackingCode);
+
+ Task> GetNoPackCodeUsableListAsync(string itemCode,
+ List validLocations,
+ List validStatuses, bool isRemovePackingCode);
Task> GetRecommendBalancesByLocationExpectOldBalancesAsync(Guid traceId, string itemCode, decimal requestQty, List validLocations, List validStatuses, bool ispackingcode, List oldBalances);
}
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/ThirdLocationRequests/ThirdLocationRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs
index 1590f32d8..0d74a5c9d 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs
@@ -22,6 +22,7 @@ using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
+using Win_in.Sfs.Wms.Inventory.Domain;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared;
@@ -50,6 +51,7 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase
/// 【创建】库移请求
///
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/SfsJobManagerBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/SfsJobManagerBase.cs
index 5d16fbc0c..8d7459ab0 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/SfsJobManagerBase.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/SfsJobManagerBase.cs
@@ -219,6 +219,7 @@ public abstract class SfsJobManagerBase
validStatuses = new List
{
EnumJobStatus.Open,
+ EnumJobStatus.Doing,
EnumJobStatus.Closed,
};
break;
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,
+
}