Browse Source

Merge branch 'dev_DY_CC' of http://dev.ccwin-in.com:3000/BoXu.Zheng/WZC2 into dev_DY_CC

dev_DY_CC
郑勃旭 1 year ago
parent
commit
90d099c9d6
  1. 29
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Client/WebApi.cs
  2. 6
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingRequestReader.cs
  3. 6
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs
  4. 2
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ThirdLocationJobController.cs
  5. 2
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/TransferLibJobController.cs
  6. 13
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ThirdLocationRequestController.cs
  7. 7
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/SplitPackings/ISplitPackingRecAppService.cs
  8. 24
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/test/TestAppService.cs
  9. 1
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/IBalanceAppService.cs
  10. 18
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs
  11. 3
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs
  12. 1
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Transactions/Transaction.cs
  13. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs
  14. 44
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs
  15. 61
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs
  16. 9
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/KittingPackagingNotes/KittingPackagingNoteChassisDetail.cs
  17. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/KittingPackagingNotes/KittingPackagingNoteDbContextModelCreatingExtensions.cs
  18. 0
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/AssembleIssueNoteEventHandler.cs
  19. 65
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/CoatingIssueNoteEventHandler.cs
  20. 65
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/InjectionIssueNoteEventHandler.cs
  21. 0
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/KittingIssueNoteEventHandler.cs
  22. 107
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/SparePartIssueNoteEventHandler.cs
  23. 33
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs
  24. 17
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ThirdLocationRequestEventHandler.cs
  25. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/NoOkConvertOKNoteEventHandler.cs

29
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Client/WebApi.cs

@ -1,3 +1,5 @@
//---------------------- //----------------------
// <auto-generated> // <auto-generated>
// Generated using the NSwag toolchain v14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) // Generated using the NSwag toolchain v14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
@ -212,15 +214,15 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
/// <returns>Success</returns> /// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception> /// <exception cref="ApiException">A server side error occurred.</exception>
public virtual System.Threading.Tasks.Task<System.Collections.Generic.ICollection<ResponCargoItem>> GetCargoStaticAsync(string p_AreaID) public virtual System.Threading.Tasks.Task<System.Collections.Generic.ICollection<ResponCargoItem>> GetCargoStaticAsync(string areaID)
{ {
return GetCargoStaticAsync(p_AreaID, System.Threading.CancellationToken.None); return GetCargoStaticAsync(areaID, System.Threading.CancellationToken.None);
} }
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param> /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>Success</returns> /// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception> /// <exception cref="ApiException">A server side error occurred.</exception>
public virtual async System.Threading.Tasks.Task<System.Collections.Generic.ICollection<ResponCargoItem>> GetCargoStaticAsync(string p_AreaID, System.Threading.CancellationToken cancellationToken) public virtual async System.Threading.Tasks.Task<System.Collections.Generic.ICollection<ResponCargoItem>> GetCargoStaticAsync(string areaID, System.Threading.CancellationToken cancellationToken)
{ {
var client_ = _httpClient; var client_ = _httpClient;
var disposeClient_ = false; var disposeClient_ = false;
@ -228,8 +230,7 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
{ {
using (var request_ = new System.Net.Http.HttpRequestMessage()) using (var request_ = new System.Net.Http.HttpRequestMessage())
{ {
request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "text/plain"); request_.Method = new System.Net.Http.HttpMethod("GET");
request_.Method = new System.Net.Http.HttpMethod("POST");
request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain"));
var urlBuilder_ = new System.Text.StringBuilder(); var urlBuilder_ = new System.Text.StringBuilder();
@ -237,9 +238,9 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
// Operation Path: "CargoState/GetCargoStatic" // Operation Path: "CargoState/GetCargoStatic"
urlBuilder_.Append("CargoState/GetCargoStatic"); urlBuilder_.Append("CargoState/GetCargoStatic");
urlBuilder_.Append('?'); urlBuilder_.Append('?');
if (p_AreaID != null) if (areaID != null)
{ {
urlBuilder_.Append(System.Uri.EscapeDataString("p_AreaID")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(p_AreaID, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); urlBuilder_.Append(System.Uri.EscapeDataString("AreaID")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(areaID, System.Globalization.CultureInfo.InvariantCulture))).Append('&');
} }
urlBuilder_.Length--; urlBuilder_.Length--;
@ -535,16 +536,8 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
} }
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")]
public partial class ResponCargoItem1 public partial class ResponCargoItem1
{ {
/// <summary>
/// 读取次数
/// </summary>
[Newtonsoft.Json.JsonProperty("number", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Number { get; set; }
/// <summary> /// <summary>
/// 区域ID /// 区域ID
/// </summary> /// </summary>
@ -569,8 +562,12 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
[Newtonsoft.Json.JsonProperty("flag", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonProperty("flag", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int Flag { get; set; } public int Flag { get; set; }
}
[Newtonsoft.Json.JsonProperty("number", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Number { get; set; }
}

6
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingRequestReader.cs

@ -50,7 +50,6 @@ public class InjectionMoldingRequestReader : IReader
) )
{ {
_injectionRequest = injectionRequest; _injectionRequest = injectionRequest;
_logger = logger; _logger = logger;
_options = options; _options = options;
_httpClientFactory = httpClientFactory; _httpClientFactory = httpClientFactory;
@ -102,8 +101,7 @@ public class InjectionMoldingRequestReader : IReader
{ {
var idsList = await client.GetCargoStaticAsync(itm).ConfigureAwait(false); var idsList = await client.GetCargoStaticAsync(itm).ConfigureAwait(false);
Thread.Sleep(500);//设备读取50ms延时,设置延时时间为1000ms保证读取更新到信息
Thread.Sleep(1000);//设备读取50ms延时,设置延时时间为1000ms保证读取更新到信息
//flag 1-有货 0-空闲 //flag 1-有货 0-空闲
foreach (var respon in idsList.Where(r => r.Flag == 0)) foreach (var respon in idsList.Where(r => r.Flag == 0))
{ {
@ -167,6 +165,8 @@ public class InjectionMoldingRequestReader : IReader
_logger.LogInformation(MakeGrid($"{guid}同步WMS内容", injectionList)); _logger.LogInformation(MakeGrid($"{guid}同步WMS内容", injectionList));
//_logger.LogInformation($"标识{guid}同步WMS开始");
foreach (var inject in injectionList) foreach (var inject in injectionList)

6
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs

@ -85,9 +85,9 @@ public static class IncomingToWmsExtensions
} }
public static async Task HandleErpLocationItemsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext) public static async Task HandleErpLocationItemsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{ {
//var erpLocationItem = JsonSerializer.Deserialize<ErpLocationItemEditInput>(incomingConverted.DataContent); var erpLocationItem = JsonSerializer.Deserialize<ErpLocationItemEditInput>(incomingConverted.DataContent);
//var erpLocationItemAppService = workerContext.ServiceProvider.GetRequiredService<IErpLocationItemAppService>(); var erpLocationItemAppService = workerContext.ServiceProvider.GetRequiredService<IErpLocationItemAppService>();
//await erpLocationItemAppService.UpsertAsync(erpLocationItem).ConfigureAwait(false); await erpLocationItemAppService.UpsertAsync(erpLocationItem).ConfigureAwait(false);
} }
public static async Task HandleErpLocationsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext) public static async Task HandleErpLocationsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{ {

2
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ThirdLocationJobController.cs

@ -182,7 +182,7 @@ public class ThirdLocationJobController : AbpController
} }
/// <summary> /// <summary>
/// 关闭任务 /// 终止关闭任务
/// </summary> /// </summary>
/// <param name="id"></param> /// <param name="id"></param>
/// <returns></returns> /// <returns></returns>

2
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/TransferLibJobController.cs

@ -15,7 +15,7 @@ namespace Win_in.Sfs.Wms.Pda.Controllers.Stores;
/// ///
/// </summary> /// </summary>
[ApiController] [ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}store/transferlib-job")] [Route($"{PdaHostConst.ROOT_ROUTE}store/transferlib-job")] //??store应该改成job
public class TransferLibJobController : AbpController public class TransferLibJobController : AbpController
{ {

13
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ThirdLocationRequestController.cs

@ -109,4 +109,17 @@ public class ThirdLocationRequestController : AbpController
return Ok(result); return Ok(result);
} }
/// <summary>
/// 完成三方库请求
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("complete/{id}")]
public virtual async Task<ActionResult<ThirdLocationRequestDTO>> CompleteAsync(Guid id)
{
var result = await _thirdLocationRequestAppService.CompleteAsync(id).ConfigureAwait(false);
return Ok(result);
}
} }

7
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/SplitPackings/ISplitPackingRecAppService.cs

@ -30,6 +30,13 @@ public interface ISplitPackingRecAppService
Task<SplitPackingRecDTO> GetSplitPackingCode(string toPackingCode); Task<SplitPackingRecDTO> GetSplitPackingCode(string toPackingCode);
Task<List<SplitPackingRecDTO>> GetFirstOrDefaultPackingCode(List<string> toPackingCodeList); Task<List<SplitPackingRecDTO>> GetFirstOrDefaultPackingCode(List<string> toPackingCodeList);
/// <summary>
/// 根据to箱码取所有具有相同箱码的拆箱记录
/// </summary>
/// <param name="toPackingCode"></param>
/// <returns></returns>
Task<List<SplitPackingRecDTO>> GetSamePoNumberListByToPackingCode(string toPackingCode);
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

24
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/test/TestAppService.cs

@ -47,11 +47,11 @@ public class TestService:ApplicationService
[HttpPost("GetCargoStatic")] [HttpGet("GetCargoStatic")]
/// <summary> /// <summary>
/// 异步开始生命周期操作不能堵塞 /// 异步开始生命周期操作不能堵塞
/// </summary> /// </summary>
public async Task<List<ResponCargoItem>> GetCargoStatic(string p_AreaID) public async Task<List<ResponCargoItem>> GetCargoStatic(string AreaID)
{ {
List<ResponCargoItem> result = new List<ResponCargoItem>(); List<ResponCargoItem> result = new List<ResponCargoItem>();
@ -60,28 +60,28 @@ public class TestService:ApplicationService
result.Add(new ResponCargoItem() { AreaID = "1", CargoID = "PTXB2", PartCode = "TMDLYA0A061AB", Flag = 0 }); result.Add(new ResponCargoItem() { AreaID = "1", CargoID = "PTXB2", PartCode = "TMDLYA0A061AB", Flag = 0 });
result.Add(new ResponCargoItem() { AreaID = "2", CargoID = "ZSXB2", PartCode = "TMDLYD0ABM5A", Flag = 0 }); result.Add(new ResponCargoItem() { AreaID = "2", CargoID = "ZSXB2", PartCode = "TMDLYD0ABM5A", Flag = 0 });
result = result.Where(p => p.AreaID == p_AreaID).ToList(); result = result.Where(p => p.AreaID == AreaID).ToList();
return result; return result;
} }
[HttpPost("SyncIssueJobStereo")] //[HttpPost("SyncIssueJobStereo")]
public virtual async Task<ReusltObject> SyncIssueJobStereoAsync(IssueJobToRestoDTO input) //public virtual async Task<ReusltObject> SyncIssueJobStereoAsync(IssueJobToRestoDTO input)
{ //{
ReusltObject reuslt=new ReusltObject(); // ReusltObject reuslt=new ReusltObject();
reuslt.Code = "1"; // reuslt.Code = "1";
reuslt.Message = "操作成功"; // reuslt.Message = "操作成功";
reuslt.OperateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); // reuslt.OperateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
return reuslt; // return reuslt;
} //}

1
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/IBalanceAppService.cs

@ -177,4 +177,5 @@ public interface IBalanceAppService
string itemCode, string locationCode, EnumInventoryStatus status,string lot); string itemCode, string locationCode, EnumInventoryStatus status,string lot);
Task<List<BalanceDTO>> GetRecommendBalancesByLocationsExpectOldBalancesAsync(RecommendBalanceRequestInput input); Task<List<BalanceDTO>> GetRecommendBalancesByLocationsExpectOldBalancesAsync(RecommendBalanceRequestInput input);
Task CountPlanActiveAsync(string packingCode, string itemCode, string lot, string locationCode, EnumInventoryStatus status, DateTime datetime, string countPlanNumber); Task CountPlanActiveAsync(string packingCode, string itemCode, string lot, string locationCode, EnumInventoryStatus status, DateTime datetime, string countPlanNumber);
Task<List<BalanceDTO>> GetUsableListByTypeAsync(RecommendBalanceRequestInput input);
} }

18
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs

@ -687,7 +687,25 @@ public class BalanceAppService
return dtos; return dtos;
} }
/// <summary>
/// 获取可用库存列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
[HttpGet("usable-list-by-type")]
public virtual async Task<List<BalanceDTO>> GetUsableListByTypeAsync(RecommendBalanceRequestInput input)
{
List<string> locationCodes = new List<string>();
var locations=await _locationAclService.GetListByTypesAsync(input.LocationTypes).ConfigureAwait(false);
locationCodes= locations.Select(location=>location.Code).ToList();
var inventoryBalances = await _balanceManager
.GetUsableListAsync(input.ItemCode, locationCodes, input.Statuses, input.IsPackingCode).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<Balance>, List<BalanceDTO>>(inventoryBalances);
return dtos;
}
/// <summary> /// <summary>
/// pda发料执行查询使用 /// pda发料执行查询使用
/// </summary> /// </summary>

3
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs

@ -560,8 +560,7 @@ public class BalanceManager : DomainService, IBalanceManager
.GroupBy(p => p.ContainerCode) .GroupBy(p => p.ContainerCode)
.Select(d => d.Key) .Select(d => d.Key)
.ToListAsync().ConfigureAwait(false); .ToListAsync().ConfigureAwait(false);
usableBalances= usableBalances
usableBalances
//扣减已占用库存 //扣减已占用库存
.DecreaseExpectOutQty(expectOuts, locations) .DecreaseExpectOutQty(expectOuts, locations)
//去除不可拆箱 拆托的且有预占用的库存余额 //去除不可拆箱 拆托的且有预占用的库存余额

1
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Transactions/Transaction.cs

@ -238,6 +238,7 @@ public class Transaction : SfsInventoryAggregateRootBase
ItemName = item.Name; ItemName = item.Name;
ItemDesc1 = item.Desc1; ItemDesc1 = item.Desc1;
ItemDesc2 = item.Desc2; ItemDesc2 = item.Desc2;
StdPackQty = item.StdPackQty;
} }
if (string.IsNullOrEmpty(WarehouseCode)) if (string.IsNullOrEmpty(WarehouseCode))
{ {

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs

@ -626,7 +626,6 @@ public class AssembleIssueJobAppService
{ {
var jobDetailInputdetail = assembleIssueJobDto.Details.FirstOrDefault(); var jobDetailInputdetail = assembleIssueJobDto.Details.FirstOrDefault();
var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode) var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode)
.ConfigureAwait(false); .ConfigureAwait(false);

44
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs

@ -6,13 +6,16 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Entities;
using Volo.Abp.ObjectMapping; using Volo.Abp.ObjectMapping;
using Volo.Abp.Uow; using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Domain.Shared; using Win_in.Sfs.Basedata.Domain.Shared;
using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared; using Win_in.Sfs.Wms.Store.Domain.Shared;
@ -56,22 +59,26 @@ public class ThirdLocationJobAppService
} }
else else
{ {
var jobDetail= job.Details.FirstOrDefault(p => p.ItemCode == dto.Details[0].ItemCode); foreach(var item in dto.Details)
{
var jobDetail = job.Details.FirstOrDefault(p => p.ItemCode == item.ItemCode);
if (jobDetail == null) if (jobDetail == null)
{ {
throw new UserFriendlyException($"任务错误:未找到物品【{dto.Details[0].ItemCode} 的明细信息"); throw new UserFriendlyException($"任务错误:未找到物品【{item.ItemCode} 的明细信息");
} }
else else
{ {
if (dto.Details[0].HandledQty > jobDetail.RecommendQty) if (item.HandledQty > jobDetail.RecommendQty)
{ {
throw new UserFriendlyException($"任务错误:编号为【{job.Number}】的实际数量【{dto.Details[0].HandledQty}】不能大于推荐数量【{dto.Details[0].RecommendQty}】"); throw new UserFriendlyException($"任务错误:编号为【{job.Number}】的实际数量【{item.HandledQty}】不能大于推荐数量【{item.RecommendQty}】");
} }
if (jobDetail.ToLocationCode != dto.Details[0].ToLocationCode) if (jobDetail.ToLocationCode != item.ToLocationCode)
{ {
throw new UserFriendlyException($"任务错误:编号为【{job.Number}】的实际目标库位【{dto.Details[0].ToLocationCode}】与申请目标库位【{jobDetail.ToLocationCode}】不一致"); throw new UserFriendlyException($"任务错误:编号为【{job.Number}】的实际目标库位【{item.ToLocationCode}】与申请目标库位【{jobDetail.ToLocationCode}】不一致");
}
} }
} }
@ -89,6 +96,12 @@ public class ThirdLocationJobAppService
return handleDto; return handleDto;
} }
/// <summary>
/// 终止关闭任务
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
[HttpPost("close-job/{id}")] [HttpPost("close-job/{id}")]
public virtual async Task CloseJobAsync(Guid id) public virtual async Task CloseJobAsync(Guid id)
{ {
@ -97,8 +110,25 @@ public class ThirdLocationJobAppService
{ {
throw new UserFriendlyException($"未找到ID为 {id} 的任务"); throw new UserFriendlyException($"未找到ID为 {id} 的任务");
} }
else
{
if (thirdLocationJob.JobStatus == EnumJobStatus.Partial)
{
thirdLocationJob.JobStatus = EnumJobStatus.Done;
await Task.CompletedTask.ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsClosedEntityEventData<ThirdLocationJob>(thirdLocationJob), false).ConfigureAwait(false);
await Repository.UpdateAsync(thirdLocationJob).ConfigureAwait(false);
//await _thirdLocationJobManager.CloseAsync(thirdLocationJob).ConfigureAwait(false);
}
else
{
throw new UserFriendlyException($"【{thirdLocationJob.JobStatus.GetDisplayName()}】状态不允许终止");
}
}
await _thirdLocationJobManager.CloseAsync(thirdLocationJob).ConfigureAwait(false);
} }
/// <summary> /// <summary>

61
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs

@ -49,10 +49,12 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase<Thir
private readonly IExpectOutAppService _expectOutAppService; private readonly IExpectOutAppService _expectOutAppService;
private readonly IBalanceAppService _balanceAppService; private readonly IBalanceAppService _balanceAppService;
private readonly IThirdLocationJobAppService _thirdLocationJobAppService; private readonly IThirdLocationJobAppService _thirdLocationJobAppService;
private readonly IThirdLocationJobRepository _thirdLocationJobRepository;
public ThirdLocationRequestAppService( public ThirdLocationRequestAppService(
IThirdLocationRequestRepository repository, IThirdLocationRequestRepository repository,
IThirdLocationJobAppService thirdLocationJobAppService, IThirdLocationJobAppService thirdLocationJobAppService,
IThirdLocationJobRepository thirdLocationJobRepository,
IThirdLocationRequestManager thirdLocationRequestManager, IThirdLocationRequestManager thirdLocationRequestManager,
IPreparationPlanManager preparationPlanManager, IPreparationPlanManager preparationPlanManager,
IItemStoreRelationAppService itemStoreRelationApp, IItemStoreRelationAppService itemStoreRelationApp,
@ -77,6 +79,7 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase<Thir
_expectOutAppService= expectOutAppService; _expectOutAppService= expectOutAppService;
_balanceAppService= balanceAppService; _balanceAppService= balanceAppService;
_thirdLocationJobAppService= thirdLocationJobAppService; _thirdLocationJobAppService= thirdLocationJobAppService;
_thirdLocationJobRepository= thirdLocationJobRepository;
} }
@ -212,10 +215,7 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase<Thir
{ {
foreach (var thirdLocationJobDto in list) foreach (var thirdLocationJobDto in list)
{ {
if (thirdLocationJobDto.JobStatus == EnumJobStatus.Open || if (thirdLocationJobDto.JobStatus == EnumJobStatus.Open)
thirdLocationJobDto.JobStatus == EnumJobStatus.Partial ||
thirdLocationJobDto.JobStatus == EnumJobStatus.Doing ||
thirdLocationJobDto.JobStatus == EnumJobStatus.Wait)
{ {
await _thirdLocationJobAppService.CancelAsync(thirdLocationJobDto.Id).ConfigureAwait(false); await _thirdLocationJobAppService.CancelAsync(thirdLocationJobDto.Id).ConfigureAwait(false);
} }
@ -226,7 +226,7 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase<Thir
} }
} }
if (request.RequestStatus == EnumRequestStatus.Partial || request.RequestStatus == EnumRequestStatus.Handling || if (request.RequestStatus == EnumRequestStatus.Handling ||
request.RequestStatus == EnumRequestStatus.New) request.RequestStatus == EnumRequestStatus.New)
{ {
request.RequestStatus = EnumRequestStatus.Cancelled; request.RequestStatus = EnumRequestStatus.Cancelled;
@ -234,16 +234,67 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase<Thir
await LocalEventBus.PublishAsync(new SfsCancelledEntityEventData<ThirdLocationRequest>(request), false).ConfigureAwait(false); await LocalEventBus.PublishAsync(new SfsCancelledEntityEventData<ThirdLocationRequest>(request), false).ConfigureAwait(false);
await _repository.UpdateAsync(request).ConfigureAwait(false); await _repository.UpdateAsync(request).ConfigureAwait(false);
}
else
{
throw new UserFriendlyException($"【{request.RequestStatus.GetDisplayName()}】状态不允许取消");
}
return ObjectMapper.Map<ThirdLocationRequest, ThirdLocationRequestDTO>(request);
}
/// <summary>
/// 用来重写 完成请求
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public override async Task<ThirdLocationRequestDTO> CompleteAsync(Guid id)
{
var request = await _repository.GetAsync(id).ConfigureAwait(false);
if (request.RequestStatus == EnumRequestStatus.Partial)
{
request.RequestStatus = EnumRequestStatus.Completed;
await Task.CompletedTask.ConfigureAwait(false);
//await LocalEventBus.PublishAsync(new SfsCompletedEntityEventData<ThirdLocationRequest>(request), false).ConfigureAwait(false);
await _repository.UpdateAsync(request).ConfigureAwait(false);
} }
else else
{ {
throw new UserFriendlyException($"【{request.RequestStatus.GetDisplayName()}】状态不允许取消"); throw new UserFriendlyException($"【{request.RequestStatus.GetDisplayName()}】状态不允许取消");
} }
var entitys = await _thirdLocationJobRepository.GetListAsync(p => p.RequestNumber == request.Number, "", true).ConfigureAwait(false);
if (entitys.Any())
{
foreach (var thirdLocationJob in entitys)
{
if (thirdLocationJob.JobStatus == EnumJobStatus.Partial)
{
thirdLocationJob.JobStatus = EnumJobStatus.Done;
await Task.CompletedTask.ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsClosedEntityEventData<ThirdLocationJob>(thirdLocationJob), false).ConfigureAwait(false);
await _thirdLocationJobRepository.UpdateAsync(thirdLocationJob).ConfigureAwait(false);
}
else if (thirdLocationJob.JobStatus == EnumJobStatus.Open)
{
thirdLocationJob.JobStatus = EnumJobStatus.Closed;
await Task.CompletedTask.ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsClosedEntityEventData<ThirdLocationJob>(thirdLocationJob), false).ConfigureAwait(false);
await _thirdLocationJobRepository.UpdateAsync(thirdLocationJob).ConfigureAwait(false);
}
else
{
}
}
}
return ObjectMapper.Map<ThirdLocationRequest, ThirdLocationRequestDTO>(request); return ObjectMapper.Map<ThirdLocationRequest, ThirdLocationRequestDTO>(request);
} }
/// <summary> /// <summary>
/// 赋值Request业务属性 /// 赋值Request业务属性
/// </summary> /// </summary>

9
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/KittingPackagingNotes/KittingPackagingNoteChassisDetail.cs

@ -9,11 +9,18 @@ public class KittingPackagingNoteChassisDetail : SfsStoreDetailEntityBase
/// 底盘号 /// 底盘号
/// </summary> /// </summary>
[Display(Name = "底盘号")] [Display(Name = "底盘号")]
public long ChassisNumber { get; set; } //public long ChassisNumber { get; set; }
public string ChassisNumber { get; set; } //lyf at 20240613
/// <summary> /// <summary>
/// Kitting代码 /// Kitting代码
/// </summary> /// </summary>
[Display(Name = "Kitting代码")] [Display(Name = "Kitting代码")]
public string KittingCode { get; set; } public string KittingCode { get; set; }
/// <summary>
/// 底盘号排序序列
/// </summary>
[Display(Name = "底盘号排序序列")]
public long ChassisSortNumber { get; set; }
} }

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/KittingPackagingNotes/KittingPackagingNoteDbContextModelCreatingExtensions.cs

@ -53,6 +53,7 @@ public static class KittingPackagingNoteDbContextModelCreatingExtensions
b.ConfigureSfsBase(); b.ConfigureSfsBase();
//Properties //Properties
b.Property(q => q.KittingCode).HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.KittingCode).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ChassisNumber).HasMaxLength(SfsPropertyConst.CodeLength);
//Indexes //Indexes
}); });
} }

0
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/AssembleIssueNoteEventHandler.cs → be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/AssembleIssueNoteEventHandler.cs

65
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/CoatingIssueNoteEventHandler.cs → be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/CoatingIssueNoteEventHandler.cs

@ -37,44 +37,45 @@ public class CoatingIssueNoteEventHandler
protected override async Task AddExchangeDataAsync(List<CoatingIssueNote> entities) protected override async Task AddExchangeDataAsync(List<CoatingIssueNote> entities)
{ {
var dtos = ObjectMapper.Map<List<CoatingIssueNote>, List<CoatingIssueNoteDTO>>(entities); var dtos = ObjectMapper.Map<List<CoatingIssueNote>, List<IssueNoteDTO>>(entities);
foreach (var detail in dtos.SelectMany(dto => dto.Details)) foreach (var detail in dtos.SelectMany(dto => dto.Details))
{ {
if (string.IsNullOrEmpty(detail.HandledFromLocationErpCode)) await detail.TrySetLocationAsync(LocationAclService).ConfigureAwait(false);
{ //if (string.IsNullOrEmpty(detail.HandledFromLocationErpCode))
var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false); //{
if (location != null) // var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false);
{ // if (location != null)
detail.HandledFromLocationErpCode = location.ErpLocationCode; // {
detail.HandledFromLocationGroup = location.LocationGroupCode; // detail.HandledFromLocationErpCode = location.ErpLocationCode;
detail.HandledFromLocationArea = location.AreaCode; // detail.HandledFromLocationGroup = location.LocationGroupCode;
// detail.HandledFromLocationArea = location.AreaCode;
if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode)) // if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode))
{ // {
detail.HandledFromWarehouseCode = location.WarehouseCode; // detail.HandledFromWarehouseCode = location.WarehouseCode;
} // }
} // }
} //}
if (string.IsNullOrEmpty(detail.HandledToLocationErpCode)) //if (string.IsNullOrEmpty(detail.HandledToLocationErpCode))
{ //{
var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false); // var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false);
if (location != null) // if (location != null)
{ // {
detail.HandledToLocationErpCode = location.ErpLocationCode; // detail.HandledToLocationErpCode = location.ErpLocationCode;
detail.HandledToLocationGroup = location.LocationGroupCode; // detail.HandledToLocationGroup = location.LocationGroupCode;
detail.HandledToLocationArea = location.AreaCode; // detail.HandledToLocationArea = location.AreaCode;
if (string.IsNullOrEmpty(detail.HandledToWarehouseCode)) // if (string.IsNullOrEmpty(detail.HandledToWarehouseCode))
{ // {
detail.HandledToWarehouseCode = location.WarehouseCode; // detail.HandledToWarehouseCode = location.WarehouseCode;
} // }
} // }
} //}
} }
var toErpDto = new List<CoatingIssueNoteDTO>(); var toErpDto = new List<IssueNoteDTO>();
foreach (var item in dtos) foreach (var item in dtos)
{ {
if (item.Details != null && item.Details.Count != 0) if (item.Details != null && item.Details.Count != 0)
@ -84,10 +85,10 @@ public class CoatingIssueNoteEventHandler
} }
//2023-12-6要求同储位不传入接口 按历史规则 //2023-12-6要求同储位不传入接口 按历史规则
var result = new List<CoatingIssueNoteDTO>(); var result = new List<IssueNoteDTO>();
foreach (var coatingIssueNoteDto in toErpDto) foreach (var coatingIssueNoteDto in toErpDto)
{ {
coatingIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.HandledToLocationErpCode); coatingIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.ToLocationErpCode);
if (coatingIssueNoteDto.Details.Count > 0) if (coatingIssueNoteDto.Details.Count > 0)
{ {
result.Add(coatingIssueNoteDto); result.Add(coatingIssueNoteDto);

65
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/InjectionIssueNoteEventHandler.cs → be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/InjectionIssueNoteEventHandler.cs

@ -37,44 +37,45 @@ public class InjectionIssueNoteEventHandler
protected override async Task AddExchangeDataAsync(List<InjectionIssueNote> entities) protected override async Task AddExchangeDataAsync(List<InjectionIssueNote> entities)
{ {
var dtos = ObjectMapper.Map<List<InjectionIssueNote>, List<InjectionIssueNoteDTO>>(entities); var dtos = ObjectMapper.Map<List<InjectionIssueNote>, List<IssueNoteDTO>>(entities);
foreach (var detail in dtos.SelectMany(dto => dto.Details)) foreach (var detail in dtos.SelectMany(dto => dto.Details))
{ {
if(string.IsNullOrEmpty(detail.HandledFromLocationErpCode)) await detail.TrySetLocationAsync(LocationAclService).ConfigureAwait(false);
{ //if(string.IsNullOrEmpty(detail.HandledFromLocationErpCode))
var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false); //{
if (location != null) // var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false);
{ // if (location != null)
detail.HandledFromLocationErpCode = location.ErpLocationCode; // {
detail.HandledFromLocationGroup = location.LocationGroupCode; // detail.HandledFromLocationErpCode = location.ErpLocationCode;
detail.HandledFromLocationArea = location.AreaCode; // detail.HandledFromLocationGroup = location.LocationGroupCode;
// detail.HandledFromLocationArea = location.AreaCode;
if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode)) // if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode))
{ // {
detail.HandledFromWarehouseCode = location.WarehouseCode; // detail.HandledFromWarehouseCode = location.WarehouseCode;
} // }
} // }
} //}
if(string.IsNullOrEmpty(detail.HandledToLocationErpCode)) //if(string.IsNullOrEmpty(detail.HandledToLocationErpCode))
{ //{
var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false); // var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false);
if (location != null) // if (location != null)
{ // {
detail.HandledToLocationErpCode = location.ErpLocationCode; // detail.HandledToLocationErpCode = location.ErpLocationCode;
detail.HandledToLocationGroup = location.LocationGroupCode; // detail.HandledToLocationGroup = location.LocationGroupCode;
detail.HandledToLocationArea = location.AreaCode; // detail.HandledToLocationArea = location.AreaCode;
if (string.IsNullOrEmpty(detail.HandledToWarehouseCode)) // if (string.IsNullOrEmpty(detail.HandledToWarehouseCode))
{ // {
detail.HandledToWarehouseCode = location.WarehouseCode; // detail.HandledToWarehouseCode = location.WarehouseCode;
} // }
} // }
} //}
} }
var toErpDto = new List<InjectionIssueNoteDTO>(); var toErpDto = new List<IssueNoteDTO>();
foreach (var item in dtos) foreach (var item in dtos)
{ {
if (item.Details != null && item.Details.Count != 0) if (item.Details != null && item.Details.Count != 0)
@ -84,10 +85,10 @@ public class InjectionIssueNoteEventHandler
} }
//2023-12-6要求同储位不传入接口 按历史规则 //2023-12-6要求同储位不传入接口 按历史规则
var result = new List<InjectionIssueNoteDTO>(); var result = new List<IssueNoteDTO>();
foreach (var injectionIssueNoteDto in toErpDto) foreach (var injectionIssueNoteDto in toErpDto)
{ {
injectionIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.HandledToLocationErpCode); injectionIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.ToLocationErpCode);
if (injectionIssueNoteDto.Details.Count > 0) if (injectionIssueNoteDto.Details.Count > 0)
{ {
result.Add(injectionIssueNoteDto); result.Add(injectionIssueNoteDto);

0
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/KittingIssueNoteEventHandler.cs → be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/KittingIssueNoteEventHandler.cs

107
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/SparePartIssueNoteEventHandler.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;
namespace Win_in.Sfs.Wms.Store.Event.DataExchanges;
/// <summary>
/// 备品发料记录传给TYRP(线边仓领料单)
/// </summary>
public class SparePartIssueNoteEventHandler
: StoreDataExchangeEventHandlerBase<SparePartIssueNote>
, ILocalEventHandler<SfsCreatedEntityEventData<SparePartIssueNote>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<SparePartIssueNote>>>
{
//线边仓领料单
private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.Issue;
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<SparePartIssueNote> eventData)
{
var entity = eventData.Entity;
await AddExchangeDataAsync(entity).ConfigureAwait(false);
}
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<SparePartIssueNote>> eventData)
{
var entities = eventData.Entity;
await AddExchangeDataAsync(entities).ConfigureAwait(false);
}
protected override async Task AddExchangeDataAsync(List<SparePartIssueNote> entities)
{
var dtos = ObjectMapper.Map<List<SparePartIssueNote>, List<IssueNoteDTO>>(entities);
foreach (var detail in dtos.SelectMany(dto => dto.Details))
{
await detail.TrySetLocationAsync(LocationAclService).ConfigureAwait(false);
//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<IssueNoteDTO>();
foreach (var item in dtos)
{
if (item.Details != null && item.Details.Count != 0)
{
toErpDto.Add(item);
}
}
//2023-12-6要求同储位不传入接口 按历史规则
var result = new List<IssueNoteDTO>();
foreach (var sparePartIssueNoteDto in toErpDto)
{
sparePartIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.ToLocationErpCode);
if (sparePartIssueNoteDto.Details.Count > 0)
{
result.Add(sparePartIssueNoteDto);
}
}
if (result.Count > 0)
{
var exchangeDataerp =
await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, result)
.ConfigureAwait(false);
await AddManyAsync(exchangeDataerp).ConfigureAwait(false);
}
}
}

33
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Routing.Matching;
using Volo.Abp.EventBus; using Volo.Abp.EventBus;
using Volo.Abp.Uow; using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Basedata.Application.Contracts;
@ -24,13 +25,15 @@ public class ThirdLocationJobEventHandler :
private readonly ILocationAppService _locationAppService; private readonly ILocationAppService _locationAppService;
private readonly IThirdLocationRequestManager _thirdLocationRequestManager; private readonly IThirdLocationRequestManager _thirdLocationRequestManager;
private readonly ITransferLogAppService _transferLogAppService; private readonly ITransferLogAppService _transferLogAppService;
private readonly IThirdLocationJobRepository _thirdLocationJobRepository;
public ThirdLocationJobEventHandler(IThirdLocationNoteAppService thirdLocationNoteAppService, ITransferLogAppService transferLogAppService, IThirdLocationRequestManager thirdLocationRequestManager, ILocationAppService locationAppService) public ThirdLocationJobEventHandler(IThirdLocationNoteAppService thirdLocationNoteAppService, IThirdLocationJobRepository thirdLocationJobRepository, ITransferLogAppService transferLogAppService, IThirdLocationRequestManager thirdLocationRequestManager, ILocationAppService locationAppService)
{ {
_thirdLocationNoteAppService = thirdLocationNoteAppService; _thirdLocationNoteAppService = thirdLocationNoteAppService;
_locationAppService = locationAppService; _locationAppService = locationAppService;
_thirdLocationRequestManager = thirdLocationRequestManager; _thirdLocationRequestManager = thirdLocationRequestManager;
_transferLogAppService = transferLogAppService; _transferLogAppService = transferLogAppService;
_thirdLocationJobRepository = thirdLocationJobRepository;
} }
/// <summary> /// <summary>
@ -104,7 +107,7 @@ public class ThirdLocationJobEventHandler :
} }
/// <summary> /// <summary>
/// 关闭任务后 /// 终止关闭任务后
/// </summary> /// </summary>
/// <param name="eventData"></param> /// <param name="eventData"></param>
/// <returns></returns> /// <returns></returns>
@ -119,21 +122,39 @@ public class ThirdLocationJobEventHandler :
var transferLogs = new List<TransferLogEditInput>(); var transferLogs = new List<TransferLogEditInput>();
transferLogs.AddRange(await BuildCancelTransferLogsAsync(thirdLocationRequest).ConfigureAwait(false)); transferLogs.AddRange(await BuildCancelTransferLogsAsync(thirdLocationRequest, entity.Details[0].ItemCode).ConfigureAwait(false));
await _transferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); await _transferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false);
thirdLocationRequest.RequestStatus = EnumRequestStatus.Abort; var jobEntities = await _thirdLocationJobRepository.GetListAsync(p => p.RequestNumber == entity.RequestNumber, "Number", true).ConfigureAwait(false);
bool isDone = false;
foreach (var job in jobEntities.Where(p=>p.Number!= entity.Number))
{
if(job.JobStatus == EnumJobStatus.Done)
{
isDone = true;
}
else
{
isDone = false;
}
}
if(isDone)
{
thirdLocationRequest.RequestStatus = EnumRequestStatus.Completed;
await _thirdLocationRequestManager.UpdateAsync(thirdLocationRequest).ConfigureAwait(false); await _thirdLocationRequestManager.UpdateAsync(thirdLocationRequest).ConfigureAwait(false);
}
} }
} }
private async Task<List<TransferLogEditInput>> BuildCancelTransferLogsAsync(ThirdLocationRequest thirdLocationRequest) private async Task<List<TransferLogEditInput>> BuildCancelTransferLogsAsync(ThirdLocationRequest thirdLocationRequest,string itemCode)
{ {
var transferLogs = new List<TransferLogEditInput>(); var transferLogs = new List<TransferLogEditInput>();
foreach (var detail in thirdLocationRequest.Details.Where(detail => detail.IssuedQty-detail.ReceivedQty != 0)) foreach (var detail in thirdLocationRequest.Details.Where(detail => detail.IssuedQty-detail.ReceivedQty != 0 && detail.ItemCode== itemCode))
{ {
var transferLog = ObjectMapper.Map<ThirdLocationRequestDetail, TransferLogEditInput>(detail); var transferLog = ObjectMapper.Map<ThirdLocationRequestDetail, TransferLogEditInput>(detail);

17
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ThirdLocationRequestEventHandler.cs

@ -306,13 +306,18 @@ public class ThirdLocationRequestEventHandler
} }
var fromLocation = await _locationAppService.GetByCodeAsync(thirdLocationRequestDetail.FromLocationCode).ConfigureAwait(false); var fromLocation = await _locationAppService.GetByCodeAsync(thirdLocationRequestDetail.FromLocationCode).ConfigureAwait(false);
var job = jobs.FirstOrDefault(p => p.WorkGroupCode == fromLocation?.WorkGroupCode);
if (job == null || job.Details.Any(p => p.ToLocationCode != thirdLocationRequestDetail.ToLocationCode)) var job = BuildThirdLocationJobCreateInput(thirdLocationRequest, fromLocation);
{
job = BuildThirdLocationJobCreateInput(thirdLocationRequest, fromLocation);
jobs.Add(job);
}
job.Details.AddRange(jobDetails); job.Details.AddRange(jobDetails);
jobs.Add(job);
//var job = jobs.FirstOrDefault(p => p.WorkGroupCode == fromLocation?.WorkGroupCode);
//if (job == null || job.Details.Any(p => p.ToLocationCode != thirdLocationRequestDetail.ToLocationCode))
//{
// job = BuildThirdLocationJobCreateInput(thirdLocationRequest, fromLocation);
// jobs.Add(job);
//}
//job.Details.AddRange(jobDetails);
} }

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/NoOkConvertOKNoteEventHandler.cs

@ -58,7 +58,7 @@ public class NoOkConvertOkNoteEventHandler
transferLog.TransType = TransType; transferLog.TransType = TransType;
transferLog.ToLocationCode = locationInfo.Code; transferLog.ToLocationCode = locationInfo.Code;
transferLog.FromLocationArea = locationInfo.AreaCode; transferLog.ToLocationArea = locationInfo.AreaCode;
transferLog.ToLocationErpCode = locationInfo.ErpLocationCode; transferLog.ToLocationErpCode = locationInfo.ErpLocationCode;
transferLog.ToLocationGroup = locationInfo.LocationGroupCode; transferLog.ToLocationGroup = locationInfo.LocationGroupCode;
transferLog.ToStatus = EnumInventoryStatus.OK; transferLog.ToStatus = EnumInventoryStatus.OK;

Loading…
Cancel
Save