Browse Source

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

dev_DY_CC
lvzb 11 months ago
parent
commit
97ed5205e8
  1. 2
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/TransferLibJobController.cs
  2. 13
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ThirdLocationRequestController.cs
  3. 106
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs
  4. 4
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/IBalanceManager.cs
  5. 20
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleIssueJobs/DTOs/AssembleIssueJobDTO.cs
  6. 21
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleIssueJobs/Inputs/AssembleIssueJobEditInput.cs
  7. 21
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/DTOs/CoatingIssueJobDTO.cs
  8. 21
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/Inputs/CoatingIssueJobEditInput.cs
  9. 21
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/InjectionJobs/DTOs/InjectionIssueJobDTO.cs
  10. 21
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/InjectionJobs/Inputs/InjectionIssueJobEditInput.cs
  11. 21
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/KittingIssueJobs/DTOs/KittingIssueJobDTO.cs
  12. 21
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/KittingIssueJobs/Inputs/KittingIssueJobEditInput.cs
  13. 21
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/SparePartIssueJobs/DTOs/SparePartIssueJobDTO.cs
  14. 21
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/SparePartIssueJobs/Inputs/SparePartIssueJobEditInput.cs
  15. 49
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs
  16. 56
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs
  17. 47
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJobAppService.cs
  18. 47
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs
  19. 47
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJobAppService.cs
  20. 47
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs
  21. 117
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs
  22. 21
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJob.cs
  23. 21
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJob.cs
  24. 21
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJob.cs
  25. 21
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJob.cs
  26. 21
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJob.cs
  27. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/SfsJobManagerBase.cs
  28. 9
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/KittingPackagingNotes/KittingPackagingNoteChassisDetail.cs
  29. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/KittingPackagingNotes/KittingPackagingNoteDbContextModelCreatingExtensions.cs
  30. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/AssembleIssueRequestAutoMapperProfile.cs
  31. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/CoatingIssueRequestAutoMapperProfile.cs
  32. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/InjectionIssueRequestAutoMapperProfile.cs
  33. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/KittingIssueRequestAutoMapperProfile.cs
  34. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/SparePartIssueRequestAutoMapperProfile.cs
  35. 33
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs
  36. 17
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ThirdLocationRequestEventHandler.cs

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>
[ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}store/transferlib-job")]
[Route($"{PdaHostConst.ROOT_ROUTE}store/transferlib-job")] //??store应该改成job
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);
}
/// <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);
}
}

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

@ -1026,6 +1026,112 @@ public class BalanceManager : DomainService, IBalanceManager
return usableBalances;
}
/// <summary>
/// 获取无箱码可用库存列表
/// </summary>
/// <param name="itemCode"></param>
/// <param name="validLocations"></param>
/// <param name="validStatuses"></param>
/// <param name="isRemovePackingCode"></param>
/// <returns></returns>
public virtual async Task<List<Balance>> GetNoPackCodeUsableListAsync(string itemCode,
List<string> validLocations,
List<EnumInventoryStatus> validStatuses, bool isRemovePackingCode)
{
var recommendBalances = new List<Balance>();//返回可使用的推荐库存余额
var item = await _itemBasicAclService.GetByCodeAsync(itemCode).ConfigureAwait(false);
if (item == null) //物品是否存在
{
// throw new UserFriendlyException($"未找到代码为 {itemCode} 的物料记录");
return recommendBalances;
}
//构造查询条件
Expression<Func<Balance, bool>> 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;

4
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/IBalanceManager.cs

@ -51,5 +51,9 @@ public interface IBalanceManager : IDomainService
Task<List<Balance>> GetUsableListAsync(string itemCode,
List<string> validLocations,
List<EnumInventoryStatus> validStatuses, bool isRemovePackingCode);
Task<List<Balance>> GetNoPackCodeUsableListAsync(string itemCode,
List<string> validLocations,
List<EnumInventoryStatus> validStatuses, bool isRemovePackingCode);
Task<List<Balance>> GetRecommendBalancesByLocationExpectOldBalancesAsync(Guid traceId, string itemCode, decimal requestQty, List<string> validLocations, List<EnumInventoryStatus> validStatuses, bool ispackingcode, List<Balance> oldBalances);
}

20
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleIssueJobs/DTOs/AssembleIssueJobDTO.cs

@ -38,4 +38,24 @@ public class AssembleIssueJobDTO : SfsJobDTOBase<AssembleIssueJobDetailDTO>
public EnumIssueSendType EnumIssueSendType { get; set; }
/// <summary>
/// 已承接
/// </summary>
/// <returns></returns>
[Display(Name = "是否已承接")]
public bool IsClaims { get; set; }
/// <summary>
/// 承接人ID
/// </summary>
/// <returns></returns>
[Display(Name = "承接人ID")]
public string ClaimsUserId { get; set; }
/// <summary>
/// 承接人
/// </summary>
/// <returns></returns>
[Display(Name = "承接人")]
public string ClaimsUserName { get; set; }
}

21
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleIssueJobs/Inputs/AssembleIssueJobEditInput.cs

@ -66,5 +66,26 @@ public class AssembleIssueJobEditInput : SfsJobCreateUpdateInputBase, ISfsJobCre
public bool UseOnTheWayLocation { get; set; }
public EnumIssueSendType EnumIssueSendType { get; set; }
/// <summary>
/// 已承接
/// </summary>
/// <returns></returns>
[Display(Name = "是否已承接")]
public bool IsClaims { get; set; }
/// <summary>
/// 承接人ID
/// </summary>
/// <returns></returns>
[Display(Name = "承接人ID")]
public string ClaimsUserId { get; set; }
/// <summary>
/// 承接人
/// </summary>
/// <returns></returns>
[Display(Name = "承接人")]
public string ClaimsUserName { get; set; }
#endregion
}

21
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/DTOs/CoatingIssueJobDTO.cs

@ -37,4 +37,25 @@ public class CoatingIssueJobDTO : SfsJobDTOBase<CoatingIssueJobDetailDTO>
public bool UseOnTheWayLocation { get; set; }
public EnumIssueSendType EnumIssueSendType { get; set; }
/// <summary>
/// 已承接
/// </summary>
/// <returns></returns>
[Display(Name = "是否已承接")]
public bool IsClaims { get; set; }
/// <summary>
/// 承接人ID
/// </summary>
/// <returns></returns>
[Display(Name = "承接人ID")]
public string ClaimsUserId { get; set; }
/// <summary>
/// 承接人
/// </summary>
/// <returns></returns>
[Display(Name = "承接人")]
public string ClaimsUserName { get; set; }
}

21
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/Inputs/CoatingIssueJobEditInput.cs

@ -66,5 +66,26 @@ public class CoatingIssueJobEditInput : SfsJobCreateUpdateInputBase, ISfsJobCrea
public bool UseOnTheWayLocation { get; set; }
public EnumIssueSendType EnumIssueSendType { get; set; }
/// <summary>
/// 已承接
/// </summary>
/// <returns></returns>
[Display(Name = "是否已承接")]
public bool IsClaims { get; set; }
/// <summary>
/// 承接人ID
/// </summary>
/// <returns></returns>
[Display(Name = "承接人ID")]
public string ClaimsUserId { get; set; }
/// <summary>
/// 承接人
/// </summary>
/// <returns></returns>
[Display(Name = "承接人")]
public string ClaimsUserName { get; set; }
#endregion
}

21
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/InjectionJobs/DTOs/InjectionIssueJobDTO.cs

@ -37,4 +37,25 @@ public class InjectionIssueJobDTO : SfsJobDTOBase<InjectionIssueJobDetailDTO>
public bool UseOnTheWayLocation { get; set; }
public EnumIssueSendType EnumIssueSendType { get; set; }
/// <summary>
/// 已承接
/// </summary>
/// <returns></returns>
[Display(Name = "是否已承接")]
public bool IsClaims { get; set; }
/// <summary>
/// 承接人ID
/// </summary>
/// <returns></returns>
[Display(Name = "承接人ID")]
public string ClaimsUserId { get; set; }
/// <summary>
/// 承接人
/// </summary>
/// <returns></returns>
[Display(Name = "承接人")]
public string ClaimsUserName { get; set; }
}

21
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/InjectionJobs/Inputs/InjectionIssueJobEditInput.cs

@ -66,5 +66,26 @@ public class InjectionIssueJobEditInput : SfsJobCreateUpdateInputBase, ISfsJobCr
public bool UseOnTheWayLocation { get; set; }
public EnumIssueSendType EnumIssueSendType { get; set; }
/// <summary>
/// 已承接
/// </summary>
/// <returns></returns>
[Display(Name = "是否已承接")]
public bool IsClaims { get; set; }
/// <summary>
/// 承接人ID
/// </summary>
/// <returns></returns>
[Display(Name = "承接人ID")]
public string ClaimsUserId { get; set; }
/// <summary>
/// 承接人
/// </summary>
/// <returns></returns>
[Display(Name = "承接人")]
public string ClaimsUserName { get; set; }
#endregion
}

21
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/KittingIssueJobs/DTOs/KittingIssueJobDTO.cs

@ -37,4 +37,25 @@ public class KittingIssueJobDTO : SfsJobDTOBase<KittingIssueJobDetailDTO>
public bool UseOnTheWayLocation { get; set; }
public EnumIssueSendType EnumIssueSendType { get; set; }
/// <summary>
/// 已承接
/// </summary>
/// <returns></returns>
[Display(Name = "是否已承接")]
public bool IsClaims { get; set; }
/// <summary>
/// 承接人ID
/// </summary>
/// <returns></returns>
[Display(Name = "承接人ID")]
public string ClaimsUserId { get; set; }
/// <summary>
/// 承接人
/// </summary>
/// <returns></returns>
[Display(Name = "承接人")]
public string ClaimsUserName { get; set; }
}

21
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/KittingIssueJobs/Inputs/KittingIssueJobEditInput.cs

@ -66,5 +66,26 @@ public class KittingIssueJobEditInput : SfsJobCreateUpdateInputBase, ISfsJobCrea
public bool UseOnTheWayLocation { get; set; }
public EnumIssueSendType EnumIssueSendType { get; set; }
/// <summary>
/// 已承接
/// </summary>
/// <returns></returns>
[Display(Name = "是否已承接")]
public bool IsClaims { get; set; }
/// <summary>
/// 承接人ID
/// </summary>
/// <returns></returns>
[Display(Name = "承接人ID")]
public string ClaimsUserId { get; set; }
/// <summary>
/// 承接人
/// </summary>
/// <returns></returns>
[Display(Name = "承接人")]
public string ClaimsUserName { get; set; }
#endregion
}

21
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/SparePartIssueJobs/DTOs/SparePartIssueJobDTO.cs

@ -37,4 +37,25 @@ public class SparePartIssueJobDTO : SfsJobDTOBase<SparePartIssueJobDetailDTO>
public bool UseOnTheWayLocation { get; set; }
public EnumIssueSendType EnumIssueSendType { get; set; }
/// <summary>
/// 已承接
/// </summary>
/// <returns></returns>
[Display(Name = "是否已承接")]
public bool IsClaims { get; set; }
/// <summary>
/// 承接人ID
/// </summary>
/// <returns></returns>
[Display(Name = "承接人ID")]
public string ClaimsUserId { get; set; }
/// <summary>
/// 承接人
/// </summary>
/// <returns></returns>
[Display(Name = "承接人")]
public string ClaimsUserName { get; set; }
}

21
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/SparePartIssueJobs/Inputs/SparePartIssueJobEditInput.cs

@ -66,5 +66,26 @@ public class SparePartIssueJobEditInput : SfsJobCreateUpdateInputBase, ISfsJobCr
public bool UseOnTheWayLocation { get; set; }
public EnumIssueSendType EnumIssueSendType { get; set; }
/// <summary>
/// 已承接
/// </summary>
/// <returns></returns>
[Display(Name = "是否已承接")]
public bool IsClaims { get; set; }
/// <summary>
/// 承接人ID
/// </summary>
/// <returns></returns>
[Display(Name = "承接人ID")]
public string ClaimsUserId { get; set; }
/// <summary>
/// 承接人
/// </summary>
/// <returns></returns>
[Display(Name = "承接人")]
public string ClaimsUserName { get; set; }
#endregion
}

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

@ -15,6 +15,9 @@ using MyNamespace;
using Omu.ValueInjecter;
using Volo.Abp;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Timing;
using Volo.Abp.Uow;
using Volo.Abp.Users;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Domain.Shared.Enums.Store;
@ -25,6 +28,7 @@ using Win_in.Sfs.Wms.Store.Domain.Shared;
using Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy;
using Win_in.Sfs.Wms.Store.Notes;
using Win_in.Sfs.Wms.Store.Options;
using static Volo.Abp.Identity.Settings.IdentitySettingNames;
namespace Win_in.Sfs.Wms.Store.Application;
@ -46,6 +50,7 @@ public class AssembleIssueJobAppService
private readonly ITransferLibRequestAppService _transferLibRequestAppService;
private readonly IOptions<RestoOptions> _options;
private readonly ILogger<AssembleIssueJobAppService> _logger;
private readonly ICurrentUser _currentUser;
public AssembleIssueJobAppService(
ILogger<AssembleIssueJobAppService> logger,
@ -53,7 +58,7 @@ public class AssembleIssueJobAppService
ILocationAppService locationAppService,
IAssembleIssueNoteAppService assembleIssueNoteAppService, IExpectOutAppService expectOutAppService
, IHttpClientFactory httpClientFactory
, IOptions<RestoOptions> options, ITransferLibRequestAppService transferLibRequestAppService) : base(
, IOptions<RestoOptions> options, ITransferLibRequestAppService transferLibRequestAppService, ICurrentUser currentUser) : base(
repository, assembleIssueJobManager)
{
_assembleIssueJobManager = assembleIssueJobManager;
@ -63,6 +68,7 @@ public class AssembleIssueJobAppService
_httpClientFactory = httpClientFactory;
_options = options;
_transferLibRequestAppService = transferLibRequestAppService;
_currentUser = currentUser;
_logger = logger;
}
@ -204,6 +210,17 @@ public class AssembleIssueJobAppService
{
var assembleIssueJob = await _repository.GetAsync(masterId).ConfigureAwait(false);
assembleIssueJob.JobStatus = EnumJobStatus.Doing;
if (assembleIssueJob.IsClaims)
{
if (assembleIssueJob.ClaimsUserId != _currentUser.Id.ToString())
{
throw new UserFriendlyException($"该任务已被【{assembleIssueJob.ClaimsUserName}】承接");
}
}
else
{
throw new UserFriendlyException("该任务未被承接,请重新刷新页面,承接任务");
}
var assembleIssueJobDto = ObjectMapper.Map<AssembleIssueJob, AssembleIssueJobDTO>(assembleIssueJob);
assembleIssueJobDto.Details = new List<AssembleIssueJobDetailDTO> { issueJobDetailDto };
@ -247,6 +264,7 @@ public class AssembleIssueJobAppService
}
await _repository.UpdateAsync(assembleIssueJob).ConfigureAwait(false);
await CancelAcceptAsync(masterId).ConfigureAwait(false);
}
/// <summary>
@ -292,6 +310,35 @@ public class AssembleIssueJobAppService
}
}
[HttpPost("accept/{id}")]
[UnitOfWork]
public override async Task AcceptAsync(Guid id)
{
var entity = await _repository.FindAsync(id).ConfigureAwait(false);
entity.IsClaims=true;
entity.ClaimsUserName = _currentUser.UserName;
entity.ClaimsUserId = _currentUser.Id.ToString();
entity.AcceptTime = Clock.Now;
await _repository.UpdateAsync(entity).ConfigureAwait(false);
}
/// <summary>
/// 取消承接任务
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("cancel-accept/{id}")]
[UnitOfWork]
public override async Task CancelAcceptAsync(Guid id)
{
var entity = await _repository.FindAsync(id).ConfigureAwait(false);
entity.IsClaims = false;
entity.ClaimsUserName = string.Empty;
entity.ClaimsUserId = string.Empty;
entity.AcceptTime = DateTime.Now;
await _repository.UpdateAsync(entity).ConfigureAwait(false);
}
#region 立库
/// <summary>

56
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs

@ -7,13 +7,17 @@ using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using Castle.Components.DictionaryAdapter;
using IdentityServer4.Extensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using MyNamespace;
using Volo.Abp;
using Volo.Abp.Domain.Entities;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Uow;
using Volo.Abp.Users;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Domain.Shared.Enums.Store;
@ -42,6 +46,7 @@ public class CoatingIssueJobAppService
private readonly ITransferLibRequestAppService _transferLibRequestAppService;
private readonly IOptions<RestoOptions> _options;
private readonly ILogger<CoatingIssueJobAppService> _logger;
private readonly ICurrentUser _currentUser;
protected ICoatingIssueRequestAppService CoatingIssueRequestAppService =>
LazyServiceProvider.LazyGetRequiredService<ICoatingIssueRequestAppService>();
@ -53,7 +58,7 @@ public class CoatingIssueJobAppService
ILocationAppService locationAppService,
ICoatingIssueNoteAppService coatingIssueNoteAppService, IExpectOutAppService expectOutAppService
, IHttpClientFactory httpClientFactory
, IOptions<RestoOptions> options, ITransferLibRequestAppService transferLibRequestAppService) : base(
, IOptions<RestoOptions> options, ITransferLibRequestAppService transferLibRequestAppService, ICurrentUser currentUser) : base(
repository, coatingIssueJobManager)
{
_coatingIssueJobManager = coatingIssueJobManager;
@ -63,6 +68,7 @@ public class CoatingIssueJobAppService
_httpClientFactory = httpClientFactory;
_options = options;
_transferLibRequestAppService = transferLibRequestAppService;
_currentUser = currentUser;
_logger = logger;
}
@ -204,7 +210,18 @@ public class CoatingIssueJobAppService
{
var coatingIssueJob = await _repository.GetAsync(masterId).ConfigureAwait(false);
coatingIssueJob.JobStatus = EnumJobStatus.Doing;
if (coatingIssueJob.IsClaims)
{
if (coatingIssueJob.ClaimsUserId != _currentUser.Id.ToString())
{
throw new UserFriendlyException($"该任务已被【{coatingIssueJob.ClaimsUserName}】承接");
}
}
else
{
throw new UserFriendlyException("该任务未被承接,请重新刷新页面,承接任务");
}
var coatingIssueJobDto = ObjectMapper.Map<CoatingIssueJob, CoatingIssueJobDTO>(coatingIssueJob);
var fromLocationDto=await _locationAppService.GetByCodeAsync(issueJobDetailDto.HandledFromLocationCode).ConfigureAwait(false);
@ -261,6 +278,7 @@ public class CoatingIssueJobAppService
}
await _repository.UpdateAsync(coatingIssueJob).ConfigureAwait(false);
await CancelAcceptAsync(masterId).ConfigureAwait(false);
}
/// <summary>
@ -306,6 +324,40 @@ public class CoatingIssueJobAppService
}
}
/// <summary>
/// 承接任务
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("accept/{id}")]
[UnitOfWork]
public override async Task AcceptAsync(Guid id)
{
var entity = await _repository.FindAsync(id).ConfigureAwait(false);
entity.IsClaims = true;
entity.ClaimsUserName = _currentUser.UserName;
entity.ClaimsUserId = _currentUser.Id.ToString();
entity.AcceptTime = Clock.Now;
await _repository.UpdateAsync(entity).ConfigureAwait(false);
}
/// <summary>
/// 取消承接任务
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("cancel-accept/{id}")]
[UnitOfWork]
public override async Task CancelAcceptAsync(Guid id)
{
var entity = await _repository.FindAsync(id).ConfigureAwait(false);
entity.IsClaims = false;
entity.ClaimsUserName = string.Empty;
entity.ClaimsUserId = string.Empty;
entity.AcceptTime = DateTime.Now;
await _repository.UpdateAsync(entity).ConfigureAwait(false);
}
#region 立库
/// <summary>

47
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJobAppService.cs

@ -13,6 +13,8 @@ using Microsoft.Extensions.Options;
using MyNamespace;
using Volo.Abp;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Uow;
using Volo.Abp.Users;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Domain.Shared.Enums.Store;
@ -40,6 +42,7 @@ public class InjectionIssueJobAppService
private readonly IHttpClientFactory _httpClientFactory;
private readonly ITransferLibRequestAppService _transferLibRequestAppService;
private readonly IOptions<RestoOptions> _options;
private readonly ICurrentUser _currentUser;
protected IInjectionIssueRequestAppService InjectionIssueRequestAppService =>
LazyServiceProvider.LazyGetRequiredService<IInjectionIssueRequestAppService>();
@ -49,7 +52,7 @@ public class InjectionIssueJobAppService
ILocationAppService locationAppService,
IInjectionIssueNoteAppService injectionIssueNoteAppService, IExpectOutAppService expectOutAppService
, IHttpClientFactory httpClientFactory
, IOptions<RestoOptions> options, ITransferLibRequestAppService transferLibRequestAppService) : base(
, IOptions<RestoOptions> options, ITransferLibRequestAppService transferLibRequestAppService, ICurrentUser currentUser) : base(
repository, injectionIssueJobManager)
{
_injectionIssueJobManager = injectionIssueJobManager;
@ -59,6 +62,7 @@ public class InjectionIssueJobAppService
_httpClientFactory = httpClientFactory;
_options = options;
_transferLibRequestAppService = transferLibRequestAppService;
_currentUser = currentUser;
}
[HttpPost("get-by-number-2")]
public async Task<InjectionIssueJobDTO> GetByNumber2Async(string number)
@ -198,6 +202,17 @@ public class InjectionIssueJobAppService
{
var injectionIssueJob = await _repository.GetAsync(masterId).ConfigureAwait(false);
injectionIssueJob.JobStatus = EnumJobStatus.Doing;
if (injectionIssueJob.IsClaims)
{
if (injectionIssueJob.ClaimsUserId != _currentUser.Id.ToString())
{
throw new UserFriendlyException($"该任务已被【{injectionIssueJob.ClaimsUserName}】承接");
}
}
else
{
throw new UserFriendlyException("该任务未被承接,请重新刷新页面,承接任务");
}
var injectionIssueJobDto = ObjectMapper.Map<InjectionIssueJob, InjectionIssueJobDTO>(injectionIssueJob);
injectionIssueJobDto.Details = new List<InjectionIssueJobDetailDTO> { issueJobDetailDto };
@ -240,6 +255,7 @@ public class InjectionIssueJobAppService
}
await _repository.UpdateAsync(injectionIssueJob).ConfigureAwait(false);
await CancelAcceptAsync(masterId).ConfigureAwait(false);
}
/// <summary>
@ -285,6 +301,35 @@ public class InjectionIssueJobAppService
}
}
[HttpPost("accept/{id}")]
[UnitOfWork]
public override async Task AcceptAsync(Guid id)
{
var entity = await _repository.FindAsync(id).ConfigureAwait(false);
entity.IsClaims = true;
entity.ClaimsUserName = _currentUser.UserName;
entity.ClaimsUserId = _currentUser.Id.ToString();
entity.AcceptTime = Clock.Now;
await _repository.UpdateAsync(entity).ConfigureAwait(false);
}
/// <summary>
/// 取消承接任务
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("cancel-accept/{id}")]
[UnitOfWork]
public override async Task CancelAcceptAsync(Guid id)
{
var entity = await _repository.FindAsync(id).ConfigureAwait(false);
entity.IsClaims = false;
entity.ClaimsUserName = string.Empty;
entity.ClaimsUserId = string.Empty;
entity.AcceptTime = DateTime.Now;
await _repository.UpdateAsync(entity).ConfigureAwait(false);
}
#region 立库
/// <summary>

47
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs

@ -12,6 +12,8 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using MyNamespace;
using Volo.Abp;
using Volo.Abp.Uow;
using Volo.Abp.Users;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Domain.Shared.Enums.Store;
@ -39,6 +41,7 @@ public class KittingIssueJobAppService
private readonly IHttpClientFactory _httpClientFactory;
private readonly ITransferLibRequestAppService _transferLibRequestAppService;
private readonly IOptions<RestoOptions> _options;
private readonly ICurrentUser _currentUser;
protected IKittingIssueRequestAppService KittingIssueRequestAppService =>
LazyServiceProvider.LazyGetRequiredService<IKittingIssueRequestAppService>();
@ -48,7 +51,7 @@ public class KittingIssueJobAppService
ILocationAppService locationAppService,
IKittingIssueNoteAppService kittingIssueNoteAppService, IExpectOutAppService expectOutAppService
, IHttpClientFactory httpClientFactory
, IOptions<RestoOptions> options, ITransferLibRequestAppService transferLibRequestAppService) : base(
, IOptions<RestoOptions> options, ITransferLibRequestAppService transferLibRequestAppService, ICurrentUser currentUser) : base(
repository, kittingIssueJobManager)
{
_kittingIssueJobManager = kittingIssueJobManager;
@ -58,6 +61,7 @@ public class KittingIssueJobAppService
_httpClientFactory = httpClientFactory;
_options = options;
_transferLibRequestAppService = transferLibRequestAppService;
_currentUser = currentUser;
}
[HttpPost("get-by-number-2")]
@ -197,6 +201,17 @@ public class KittingIssueJobAppService
{
var kittingIssueJob = await _repository.GetAsync(masterId).ConfigureAwait(false);
kittingIssueJob.JobStatus = EnumJobStatus.Doing;
if (kittingIssueJob.IsClaims)
{
if (kittingIssueJob.ClaimsUserId != _currentUser.Id.ToString())
{
throw new UserFriendlyException($"该任务已被【{kittingIssueJob.ClaimsUserName}】承接");
}
}
else
{
throw new UserFriendlyException("该任务未被承接,请重新刷新页面,承接任务");
}
var kittingIssueJobDto = ObjectMapper.Map<KittingIssueJob, KittingIssueJobDTO>(kittingIssueJob);
kittingIssueJobDto.Details = new List<KittingIssueJobDetailDTO> { issueJobDetailDto };
@ -239,6 +254,7 @@ public class KittingIssueJobAppService
}
await _repository.UpdateAsync(kittingIssueJob).ConfigureAwait(false);
await CancelAcceptAsync(masterId).ConfigureAwait(false);
}
/// <summary>
@ -284,6 +300,35 @@ public class KittingIssueJobAppService
}
}
[HttpPost("accept/{id}")]
[UnitOfWork]
public override async Task AcceptAsync(Guid id)
{
var entity = await _repository.FindAsync(id).ConfigureAwait(false);
entity.IsClaims = true;
entity.ClaimsUserName = _currentUser.UserName;
entity.ClaimsUserId = _currentUser.Id.ToString();
entity.AcceptTime = Clock.Now;
await _repository.UpdateAsync(entity).ConfigureAwait(false);
}
/// <summary>
/// 取消承接任务
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("cancel-accept/{id}")]
[UnitOfWork]
public override async Task CancelAcceptAsync(Guid id)
{
var entity = await _repository.FindAsync(id).ConfigureAwait(false);
entity.IsClaims = false;
entity.ClaimsUserName = string.Empty;
entity.ClaimsUserId = string.Empty;
entity.AcceptTime = DateTime.Now;
await _repository.UpdateAsync(entity).ConfigureAwait(false);
}
#region 立库
/// <summary>

47
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJobAppService.cs

@ -12,6 +12,8 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using MyNamespace;
using Volo.Abp;
using Volo.Abp.Uow;
using Volo.Abp.Users;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Domain.Shared.Enums.Store;
@ -39,6 +41,7 @@ public class SparePartIssueJobAppService
private readonly IHttpClientFactory _httpClientFactory;
private readonly ITransferLibRequestAppService _transferLibRequestAppService;
private readonly IOptions<RestoOptions> _options;
private readonly ICurrentUser _currentUser;
protected ISparePartIssueRequestAppService SparePartIssueRequestAppService =>
LazyServiceProvider.LazyGetRequiredService<ISparePartIssueRequestAppService>();
@ -48,7 +51,7 @@ public class SparePartIssueJobAppService
ILocationAppService locationAppService,
ISparePartIssueNoteAppService sparePartIssueNoteAppService, IExpectOutAppService expectOutAppService
, IHttpClientFactory httpClientFactory
, IOptions<RestoOptions> options, ITransferLibRequestAppService transferLibRequestAppService) : base(
, IOptions<RestoOptions> options, ITransferLibRequestAppService transferLibRequestAppService, ICurrentUser currentUser) : base(
repository, sparePartIssueJobManager)
{
_sparePartIssueJobManager = sparePartIssueJobManager;
@ -58,6 +61,7 @@ public class SparePartIssueJobAppService
_httpClientFactory = httpClientFactory;
_options = options;
_transferLibRequestAppService = transferLibRequestAppService;
_currentUser = currentUser;
}
[HttpPost("add-many")]
@ -190,6 +194,17 @@ public class SparePartIssueJobAppService
{
var sparePartIssueJob = await _repository.GetAsync(masterId).ConfigureAwait(false);
sparePartIssueJob.JobStatus = EnumJobStatus.Doing;
if (sparePartIssueJob.IsClaims)
{
if (sparePartIssueJob.ClaimsUserId != _currentUser.Id.ToString())
{
throw new UserFriendlyException($"该任务已被【{sparePartIssueJob.ClaimsUserName}】承接");
}
}
else
{
throw new UserFriendlyException("该任务未被承接,请重新刷新页面,承接任务");
}
var sparePartIssueJobDto = ObjectMapper.Map<SparePartIssueJob, SparePartIssueJobDTO>(sparePartIssueJob);
sparePartIssueJobDto.Details = new List<SparePartIssueJobDetailDTO> { issueJobDetailDto };
@ -232,6 +247,7 @@ public class SparePartIssueJobAppService
}
await _repository.UpdateAsync(sparePartIssueJob).ConfigureAwait(false);
await CancelAcceptAsync(masterId).ConfigureAwait(false);
}
/// <summary>
@ -277,6 +293,35 @@ public class SparePartIssueJobAppService
}
}
[HttpPost("accept/{id}")]
[UnitOfWork]
public override async Task AcceptAsync(Guid id)
{
var entity = await _repository.FindAsync(id).ConfigureAwait(false);
entity.IsClaims = true;
entity.ClaimsUserName = _currentUser.UserName;
entity.ClaimsUserId = _currentUser.Id.ToString();
entity.AcceptTime = Clock.Now;
await _repository.UpdateAsync(entity).ConfigureAwait(false);
}
/// <summary>
/// 取消承接任务
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("cancel-accept/{id}")]
[UnitOfWork]
public override async Task CancelAcceptAsync(Guid id)
{
var entity = await _repository.FindAsync(id).ConfigureAwait(false);
entity.IsClaims = false;
entity.ClaimsUserName = string.Empty;
entity.ClaimsUserId = string.Empty;
entity.AcceptTime = DateTime.Now;
await _repository.UpdateAsync(entity).ConfigureAwait(false);
}
#region 立库
/// <summary>

47
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 Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Entities;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Domain.Shared;
using Win_in.Sfs.Shared.Domain;
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.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared;
@ -56,25 +59,29 @@ public class ThirdLocationJobAppService
}
else
{
var jobDetail= job.Details.FirstOrDefault(p => p.ItemCode == dto.Details[0].ItemCode);
if(jobDetail==null)
foreach(var item in dto.Details)
{
throw new UserFriendlyException($"任务错误:未找到物品【{dto.Details[0].ItemCode} 的明细信息");
}
else
{
if (dto.Details[0].HandledQty > jobDetail.RecommendQty)
var jobDetail = job.Details.FirstOrDefault(p => p.ItemCode == item.ItemCode);
if (jobDetail == null)
{
throw new UserFriendlyException($"任务错误:编号为【{job.Number}】的实际数量【{dto.Details[0].HandledQty}】不能大于推荐数量【{dto.Details[0].RecommendQty}】");
throw new UserFriendlyException($"任务错误:未找到物品【{item.ItemCode} 的明细信息");
}
if (jobDetail.ToLocationCode != dto.Details[0].ToLocationCode)
else
{
throw new UserFriendlyException($"任务错误:编号为【{job.Number}】的实际目标库位【{dto.Details[0].ToLocationCode}】与申请目标库位【{jobDetail.ToLocationCode}】不一致");
if (item.HandledQty > jobDetail.RecommendQty)
{
throw new UserFriendlyException($"任务错误:编号为【{job.Number}】的实际数量【{item.HandledQty}】不能大于推荐数量【{item.RecommendQty}】");
}
if (jobDetail.ToLocationCode != item.ToLocationCode)
{
throw new UserFriendlyException($"任务错误:编号为【{job.Number}】的实际目标库位【{item.ToLocationCode}】与申请目标库位【{jobDetail.ToLocationCode}】不一致");
}
}
}
}
}
@ -107,7 +114,19 @@ public class ThirdLocationJobAppService
{
if (thirdLocationJob.JobStatus == EnumJobStatus.Partial)
{
await _thirdLocationJobManager.CloseAsync(thirdLocationJob).ConfigureAwait(false);
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);
}
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 Repository.UpdateAsync(thirdLocationJob).ConfigureAwait(false);
}
else
{

117
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;
@ -49,10 +50,13 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase<Thir
private readonly IExpectOutAppService _expectOutAppService;
private readonly IBalanceAppService _balanceAppService;
private readonly IThirdLocationJobAppService _thirdLocationJobAppService;
private readonly IThirdLocationJobRepository _thirdLocationJobRepository;
private readonly IBalanceManager _balanceManager;
public ThirdLocationRequestAppService(
IThirdLocationRequestRepository repository,
IThirdLocationJobAppService thirdLocationJobAppService,
IThirdLocationJobRepository thirdLocationJobRepository,
IThirdLocationRequestManager thirdLocationRequestManager,
IPreparationPlanManager preparationPlanManager,
IItemStoreRelationAppService itemStoreRelationApp,
@ -63,6 +67,7 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase<Thir
ITransactionTypeAppService transactionTypeAppService,
IExpectOutAppService expectOutAppService,
IBalanceAppService balanceAppService,
IBalanceManager balanceManager,
IInjectionIssueJobAppService issueJobAppService)
: base(repository, thirdLocationRequestManager)
{
@ -77,6 +82,8 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase<Thir
_expectOutAppService= expectOutAppService;
_balanceAppService= balanceAppService;
_thirdLocationJobAppService= thirdLocationJobAppService;
_thirdLocationJobRepository= thirdLocationJobRepository;
_balanceManager= balanceManager;
}
@ -144,26 +151,56 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase<Thir
CheckLocation(toLocationDto, detailInput.ToLocationCode);
var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detailInput.ItemCode).ConfigureAwait(false);
CheckItemBasic(itemBasicDto, detailInput.ItemCode);
var balanceNums= await _balanceAppService.GetListByLocationCodeAndItemCodeAsync(detailInput.FromLocationCode, detailInput.ItemCode).ConfigureAwait(false);
decimal balanceSum = 0;
foreach (var item in balanceNums)
CheckItemBasic(itemBasicDto, detailInput.ItemCode);
List<string> locationCodes=new List<string>();
locationCodes.Add(detailInput.FromLocationCode);
List<EnumInventoryStatus> inventoryStatusList = new List<EnumInventoryStatus>();
inventoryStatusList.Add(EnumInventoryStatus.OK);
var fromLocationDto = await _locationAppService.GetByCodeAsync(detailInput.FromLocationCode).ConfigureAwait(false);
List<Balance> inventoryBalances;
if (fromLocationDto.Type== EnumLocationType.RAW)
{
balanceSum += item.Qty;
inventoryBalances = await _balanceManager.GetUsableListAsync(detailInput.ItemCode, locationCodes, inventoryStatusList, true).ConfigureAwait(false);
}
var expectOutNums= await _expectOutAppService.GetListByItemAsync(detailInput.ItemCode).ConfigureAwait(false);
decimal expectOutSum = 0;
foreach (var item in expectOutNums)
else
{
expectOutSum += item.Qty;
inventoryBalances = await _balanceManager.GetNoPackCodeUsableListAsync(detailInput.ItemCode, locationCodes, inventoryStatusList, true).ConfigureAwait(false);
}
decimal realityBalance = balanceSum - expectOutSum;
if (detailInput.Qty> realityBalance)
decimal balanceSum = 0;
foreach (var item in inventoryBalances)
{
throw new UserFriendlyException($"{detailInput.ItemCode} 物品的库存为 {realityBalance} ,库存不够");
balanceSum += item.Qty;
}
if (detailInput.Qty > balanceSum)
{
throw new UserFriendlyException($"{detailInput.ItemCode} 物品的库存为 {balanceSum} ,库存不够");
}
//var balanceNums= await _balanceAppService.GetListByLocationCodeAndItemCodeAsync(detailInput.FromLocationCode, detailInput.ItemCode).ConfigureAwait(false);
//decimal balanceSum = 0;
//foreach (var item in balanceNums)
//{
// balanceSum += item.Qty;
//}
//var expectOutNums= await _expectOutAppService.GetListByItemAsync(detailInput.ItemCode).ConfigureAwait(false);
//decimal expectOutSum = 0;
//foreach (var item in expectOutNums)
//{
// expectOutSum += item.Qty;
//}
//decimal realityBalance = balanceSum - expectOutSum;
//if (detailInput.Qty> realityBalance)
//{
// throw new UserFriendlyException($"{detailInput.ItemCode} 物品的库存为 {realityBalance} ,库存不够");
//}
detailInput.ToLocationErpCode = toLocationDto.ErpLocationCode;
@ -212,7 +249,7 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase<Thir
{
foreach (var thirdLocationJobDto in list)
{
if (thirdLocationJobDto.JobStatus == EnumJobStatus.Open)
if (thirdLocationJobDto.JobStatus == EnumJobStatus.Open || thirdLocationJobDto.JobStatus == EnumJobStatus.Doing)
{
await _thirdLocationJobAppService.CancelAsync(thirdLocationJobDto.Id).ConfigureAwait(false);
}
@ -240,6 +277,58 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase<Thir
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
{
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.Doing)
{
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);
}
/// <summary>
/// 赋值Request业务属性
/// </summary>

21
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJob.cs

@ -45,4 +45,25 @@ public class AssembleIssueJob : SfsJobAggregateRootBase<AssembleIssueJobDetail>
public override List<AssembleIssueJobDetail> Details { get; set; } = new List<AssembleIssueJobDetail>();
public EnumIssueSendType EnumIssueSendType { get; set; }
/// <summary>
/// 已承接
/// </summary>
/// <returns></returns>
[Display(Name = "是否已承接")]
public bool IsClaims { get; set; }
/// <summary>
/// 承接人ID
/// </summary>
/// <returns></returns>
[Display(Name = "承接人ID")]
public string ClaimsUserId { get; set; }
/// <summary>
/// 承接人
/// </summary>
/// <returns></returns>
[Display(Name = "承接人")]
public string ClaimsUserName { get; set; }
}

21
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJob.cs

@ -41,4 +41,25 @@ public class CoatingIssueJob : SfsJobAggregateRootBase<CoatingIssueJobDetail>
public override List<CoatingIssueJobDetail> Details { get; set; } = new List<CoatingIssueJobDetail>();
public EnumIssueSendType EnumIssueSendType { get; set; }
/// <summary>
/// 已承接
/// </summary>
/// <returns></returns>
[Display(Name = "是否已承接")]
public bool IsClaims { get; set; }
/// <summary>
/// 承接人ID
/// </summary>
/// <returns></returns>
[Display(Name = "承接人ID")]
public string ClaimsUserId { get; set; }
/// <summary>
/// 承接人
/// </summary>
/// <returns></returns>
[Display(Name = "承接人")]
public string ClaimsUserName { get; set; }
}

21
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJob.cs

@ -41,4 +41,25 @@ public class InjectionIssueJob : SfsJobAggregateRootBase<InjectionIssueJobDetail
public override List<InjectionIssueJobDetail> Details { get; set; } = new List<InjectionIssueJobDetail>();
public EnumIssueSendType EnumIssueSendType { get; set; }
/// <summary>
/// 已承接
/// </summary>
/// <returns></returns>
[Display(Name = "是否已承接")]
public bool IsClaims { get; set; }
/// <summary>
/// 承接人ID
/// </summary>
/// <returns></returns>
[Display(Name = "承接人ID")]
public string ClaimsUserId { get; set; }
/// <summary>
/// 承接人
/// </summary>
/// <returns></returns>
[Display(Name = "承接人")]
public string ClaimsUserName { get; set; }
}

21
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJob.cs

@ -41,4 +41,25 @@ public class KittingIssueJob : SfsJobAggregateRootBase<KittingIssueJobDetail>
public override List<KittingIssueJobDetail> Details { get; set; } = new List<KittingIssueJobDetail>();
public EnumIssueSendType EnumIssueSendType { get; set; }
/// <summary>
/// 已承接
/// </summary>
/// <returns></returns>
[Display(Name = "是否已承接")]
public bool IsClaims { get; set; }
/// <summary>
/// 承接人ID
/// </summary>
/// <returns></returns>
[Display(Name = "承接人ID")]
public string ClaimsUserId { get; set; }
/// <summary>
/// 承接人
/// </summary>
/// <returns></returns>
[Display(Name = "承接人")]
public string ClaimsUserName { get; set; }
}

21
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJob.cs

@ -41,4 +41,25 @@ public class SparePartIssueJob : SfsJobAggregateRootBase<SparePartIssueJobDetail
public override List<SparePartIssueJobDetail> Details { get; set; } = new List<SparePartIssueJobDetail>();
public EnumIssueSendType EnumIssueSendType { get; set; }
/// <summary>
/// 已承接
/// </summary>
/// <returns></returns>
[Display(Name = "是否已承接")]
public bool IsClaims { get; set; }
/// <summary>
/// 承接人ID
/// </summary>
/// <returns></returns>
[Display(Name = "承接人ID")]
public string ClaimsUserId { get; set; }
/// <summary>
/// 承接人
/// </summary>
/// <returns></returns>
[Display(Name = "承接人")]
public string ClaimsUserName { get; set; }
}

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/SfsJobManagerBase.cs

@ -219,6 +219,7 @@ public abstract class SfsJobManagerBase<TEntity, TDetailEntity>
validStatuses = new List<EnumJobStatus>
{
EnumJobStatus.Open,
EnumJobStatus.Doing,
EnumJobStatus.Closed,
};
break;

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

@ -9,11 +9,18 @@ public class KittingPackagingNoteChassisDetail : SfsStoreDetailEntityBase
/// 底盘号
/// </summary>
[Display(Name = "底盘号")]
public long ChassisNumber { get; set; }
//public long ChassisNumber { get; set; }
public string ChassisNumber { get; set; } //lyf at 20240613
/// <summary>
/// Kitting代码
/// </summary>
[Display(Name = "Kitting代码")]
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();
//Properties
b.Property(q => q.KittingCode).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ChassisNumber).HasMaxLength(SfsPropertyConst.CodeLength);
//Indexes
});
}

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/AssembleIssueRequestAutoMapperProfile.cs

@ -13,6 +13,9 @@ public partial class StoreEventAutoMapperProfile : Profile
{
CreateMap<AssembleIssueRequest, AssembleIssueJobEditInput>()
.ForMember(x => x.AssembleRequestNumber, y => y.MapFrom(d => d.Number))
.ForMember(x => x.IsClaims, y => y.MapFrom(d => false))
.Ignore(x => x.ClaimsUserName)
.Ignore(x => x.ClaimsUserId)
.Ignore(x => x.WarehouseCode)
.Ignore(x => x.UpStreamJobNumber)
.Ignore(x => x.JobType)

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/CoatingIssueRequestAutoMapperProfile.cs

@ -13,6 +13,9 @@ public partial class StoreEventAutoMapperProfile : Profile
{
CreateMap<CoatingIssueRequest, CoatingIssueJobEditInput>()
.ForMember(x => x.CoatingRequestNumber, y => y.MapFrom(d => d.Number))
.ForMember(x => x.IsClaims, y => y.MapFrom(d => false))
.Ignore(x => x.ClaimsUserName)
.Ignore(x => x.ClaimsUserId)
.Ignore(x => x.WarehouseCode)
.Ignore(x => x.UpStreamJobNumber)
.Ignore(x => x.JobType)

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/InjectionIssueRequestAutoMapperProfile.cs

@ -13,6 +13,9 @@ public partial class StoreEventAutoMapperProfile : Profile
{
CreateMap<InjectionIssueRequest, InjectionIssueJobEditInput>()
.ForMember(x => x.InjectionRequestNumber, y => y.MapFrom(d => d.Number))
.ForMember(x => x.IsClaims, y => y.MapFrom(d => false))
.Ignore(x => x.ClaimsUserName)
.Ignore(x => x.ClaimsUserId)
.Ignore(x => x.WarehouseCode)
.Ignore(x => x.UpStreamJobNumber)
.Ignore(x => x.JobType)

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/KittingIssueRequestAutoMapperProfile.cs

@ -13,6 +13,9 @@ public partial class StoreEventAutoMapperProfile : Profile
{
CreateMap<KittingIssueRequest, KittingIssueJobEditInput>()
.ForMember(x => x.KittingRequestNumber, y => y.MapFrom(d => d.Number))
.ForMember(x => x.IsClaims, y => y.MapFrom(d => false))
.Ignore(x => x.ClaimsUserName)
.Ignore(x => x.ClaimsUserId)
.Ignore(x => x.WarehouseCode)
.Ignore(x => x.UpStreamJobNumber)
.Ignore(x => x.JobType)

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/SparePartIssueRequestAutoMapperProfile.cs

@ -13,6 +13,9 @@ public partial class StoreEventAutoMapperProfile : Profile
{
CreateMap<SparePartIssueRequest, SparePartIssueJobEditInput>()
.ForMember(x => x.SparePartRequestNumber, y => y.MapFrom(d => d.Number))
.ForMember(x => x.IsClaims, y => y.MapFrom(d => false))
.Ignore(x => x.ClaimsUserName)
.Ignore(x => x.ClaimsUserId)
.Ignore(x => x.WarehouseCode)
.Ignore(x => x.UpStreamJobNumber)
.Ignore(x => x.JobType)

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.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Routing.Matching;
using Volo.Abp.EventBus;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
@ -24,13 +25,15 @@ public class ThirdLocationJobEventHandler :
private readonly ILocationAppService _locationAppService;
private readonly IThirdLocationRequestManager _thirdLocationRequestManager;
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;
_locationAppService = locationAppService;
_thirdLocationRequestManager = thirdLocationRequestManager;
_transferLogAppService = transferLogAppService;
_thirdLocationJobRepository = thirdLocationJobRepository;
}
/// <summary>
@ -119,21 +122,39 @@ public class ThirdLocationJobEventHandler :
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);
thirdLocationRequest.RequestStatus = EnumRequestStatus.Abort;
await _thirdLocationRequestManager.UpdateAsync(thirdLocationRequest).ConfigureAwait(false);
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 || job.JobStatus == EnumJobStatus.Closed)
{
isDone = true;
}
else
{
isDone = false;
}
}
if(isDone)
{
thirdLocationRequest.RequestStatus = EnumRequestStatus.Completed;
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>();
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);

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 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);
}
var job = BuildThirdLocationJobCreateInput(thirdLocationRequest, fromLocation);
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);
}

Loading…
Cancel
Save