Browse Source

修改 叫料请求>发料任务

集成Redis
郑渤旭[Irelia] 2 years ago
parent
commit
223f5107a4
  1. 4
      be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/Win_in.Sfs.Wms.Store.HttpApi.Host.csproj
  2. 6
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/CountJobController.cs
  3. 4
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/DeliverJobController.cs
  4. 4
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/InspectJobController.cs
  5. 6
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobController.cs
  6. 4
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/JisDeliverJobController.cs
  7. 2
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/JobController.cs
  8. 4
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ProductReceiveJobController.cs
  9. 4
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ProductionReturnJobController.cs
  10. 4
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PurchaseReturnJobController.cs
  11. 4
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PutawayJobController.cs
  12. 4
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/TransferRequestController.cs
  13. 7
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemPacks/ItemPackAutoMapperProfile.cs
  14. 9
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectIns/ExpectInAutoMapperProfile.cs
  15. 1
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAppService.cs
  16. 9
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAutoMapperProfile.cs
  17. 10
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/Balance.cs
  18. 4
      be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs
  19. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/Inputs/MaterialRequestImportInput.cs
  20. 156
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/MaterialRequestAppService.cs
  21. 12
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/IssueJobAutoMapperProfile.cs
  22. 32
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/ExpectInOuts/IssueJobEventHandler.cs
  23. 173
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/IssueJobEventHandler.cs
  24. 81
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/MaterialRequestEventHandler.cs
  25. 6
      build/src/docker/publish/conf/settings/appsettings.Development.json

4
be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/Win_in.Sfs.Wms.Store.HttpApi.Host.csproj

@ -33,18 +33,22 @@
</ItemGroup>
<ItemGroup>
<Compile Remove="logs\**" />
<Compile Remove="reporting\**" />
<Compile Remove="Reports\**" />
<Compile Remove="StaticDictionaryPrintData\**" />
<Compile Remove="wwwroot\**" />
<Content Remove="logs\**" />
<Content Remove="reporting\**" />
<Content Remove="Reports\**" />
<Content Remove="StaticDictionaryPrintData\**" />
<Content Remove="wwwroot\**" />
<EmbeddedResource Remove="logs\**" />
<EmbeddedResource Remove="reporting\**" />
<EmbeddedResource Remove="Reports\**" />
<EmbeddedResource Remove="StaticDictionaryPrintData\**" />
<EmbeddedResource Remove="wwwroot\**" />
<None Remove="logs\**" />
<None Remove="reporting\**" />
<None Remove="Reports\**" />
<None Remove="StaticDictionaryPrintData\**" />

6
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/CountJobController.cs

@ -75,7 +75,7 @@ public class CountJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase
@ -133,7 +133,7 @@ public class CountJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes);
var status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
var status = new List<string>() {EnumJobStatus.Open.ToString(),EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status);
var requestInput = new SfsJobRequestInputBase
@ -165,7 +165,7 @@ public class CountJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase

4
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/DeliverJobController.cs

@ -75,7 +75,7 @@ public class DeliverJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
_ = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase
@ -132,7 +132,7 @@ public class DeliverJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase

4
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/InspectJobController.cs

@ -64,7 +64,7 @@ public class InspectJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase
@ -108,7 +108,7 @@ public class InspectJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase

6
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobController.cs

@ -65,7 +65,7 @@ public class IssueJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes);
var status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
var status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase
@ -143,7 +143,7 @@ public class IssueJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes);
var status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
var status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status);
var requestInput = new SfsJobRequestInputBase
@ -175,7 +175,7 @@ public class IssueJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase

4
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/JisDeliverJobController.cs

@ -74,7 +74,7 @@ public class JisDeliverJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase
@ -106,7 +106,7 @@ public class JisDeliverJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase

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

@ -76,7 +76,7 @@ public class JobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status);
var list = new List<JobCountDto>();

4
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ProductReceiveJobController.cs

@ -62,7 +62,7 @@ public class ProductReceiveJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase
@ -106,7 +106,7 @@ public class ProductReceiveJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase

4
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ProductionReturnJobController.cs

@ -69,7 +69,7 @@ public class ProductionReturnJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase
@ -113,7 +113,7 @@ public class ProductionReturnJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase

4
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PurchaseReturnJobController.cs

@ -63,7 +63,7 @@ public class PurchaseReturnJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase
@ -132,7 +132,7 @@ public class PurchaseReturnJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase

4
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PutawayJobController.cs

@ -62,7 +62,7 @@ public class PutawayJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase
@ -106,7 +106,7 @@ public class PutawayJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase

4
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/TransferRequestController.cs

@ -74,7 +74,7 @@ public class TransferRequestController : AbpController
Filters = new List<Filter>
{
new(nameof(TransferRequestDTO.Type),EnumTransSubType.Transfer_Area.ToString(),"=="),
new(nameof(TransferRequestDTO.RequestStatus),((int)EnumRequestStatus.New).ToString(),"==")
new(nameof(TransferRequestDTO.RequestStatus),EnumRequestStatus.New.ToString(),"==")
}
}
};
@ -98,7 +98,7 @@ public class TransferRequestController : AbpController
Filters = new List<Filter>
{
new(nameof(TransferRequestDTO.Type),EnumTransSubType.Transfer_Area.ToString(),"=="),
new(nameof(TransferRequestDTO.RequestStatus),((int)EnumRequestStatus.New).ToString(),"==")
new(nameof(TransferRequestDTO.RequestStatus),EnumRequestStatus.New.ToString(),"==")
}
}
};

7
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemPacks/ItemPackAutoMapperProfile.cs

@ -19,5 +19,12 @@ public partial class BasedataApplicationAutoMapperProfile : Profile
.Ignore(x => x.ConcurrencyStamp)
;
CreateMap<ItemPackEditInput, ItemPack>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.TenantId)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.ConcurrencyStamp)
;
}
}

9
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectIns/ExpectInAutoMapperProfile.cs

@ -1,4 +1,5 @@
using AutoMapper;
using Volo.Abp.AutoMapper;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Inventory.Domain;
@ -10,5 +11,13 @@ public partial class InventoryApplicationAutoMapperProfile : Profile
{
CreateMap<ExpectIn, ExpectInDTO>()
.ReverseMap();
CreateMap<ExpectInEditInput, ExpectIn>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.ConcurrencyStamp)
.Ignore(x => x.Id)
.Ignore(x => x.Remark)
.Ignore(x => x.ExtraProperties)
;
}
}

1
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAppService.cs

@ -66,6 +66,7 @@ public class ExpectOutAppService
LocationArea = first.LocationArea,
LocationGroup = first.LocationGroup,
LocationCode = s.Key.LocationCode,
LocationErpCode = first.LocationErpCode,
Lot = s.Key.Lot,
ContainerCode = s.Key.ContainerCode,
ItemCode = s.Key.ItemCode,

9
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAutoMapperProfile.cs

@ -19,5 +19,14 @@ public partial class InventoryApplicationAutoMapperProfile : Profile
.Ignore(x => x.JobNumber)
.Ignore(x => x.ConcurrencyStamp)
.Ignore(x => x.Remark);
CreateMap<ExpectOutEditInput, ExpectOut>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.ConcurrencyStamp)
.Ignore(x => x.Id)
.Ignore(x => x.Remark)
.Ignore(x => x.ExtraProperties)
;
;
}
}

10
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/Balance.cs

@ -298,8 +298,6 @@ public class Balance : SfsInventoryAggregateRootBase
LastCountPlanNumber = other.LastCountPlanNumber;
LastCountTime = other.LastCountTime;
LastModificationTime = other.LastModificationTime;
LocationCode = other.LocationCode;
LocationErpCode = other.LocationErpCode;
Lot = other.Lot;
Uom = other.Uom;
Qty = other.Qty;
@ -317,9 +315,17 @@ public class Balance : SfsInventoryAggregateRootBase
ArriveDate = other.ArriveDate;
ProduceDate = other.ProduceDate;
ExpireDate = other.ExpireDate;
ItemCode = other.ItemCode;
ItemName = other.ItemName;
ItemDesc1 = other.ItemDesc1;
ItemDesc2 = other.ItemDesc2;
LocationArea= other.LocationArea;
LocationGroup= other.LocationGroup;
LocationCode = other.LocationCode;
LocationErpCode = other.LocationErpCode;
}
public override string ToString()

4
be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs

@ -582,6 +582,10 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq
}
catch (Exception ex)
{
Console.WriteLine("---------------------------------");
Console.WriteLine($"####导入验证错误:");
Console.WriteLine($"{ex.Message}");
Console.WriteLine("---------------------------------");
Logger.LogException(ex);
if (modelList != null)
{

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/Inputs/MaterialRequestImportInput.cs

@ -25,7 +25,6 @@ public class MaterialRequestImportInput : SfsStoreImportInputBase
/// </summary>
[Display(Name = "目标库位")]
[Required]
[Key]
public string ToLocationCode { get; set; }
/// <summary>

156
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/MaterialRequestAppService.cs

@ -21,9 +21,10 @@ namespace Win_in.Sfs.Wms.Store.Application;
[Authorize]
[Route($"{StoreConsts.RootPath}material-request")]
public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialRequest, MaterialRequestDTO, SfsStoreRequestInputBase, MaterialRequestEditInput, MaterialRequestDetail, MaterialRequestDetailDTO, SfsStoreRequestInputBase, MaterialRequestImportInput>,
IMaterialRequestAppService
public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialRequest, MaterialRequestDTO,
SfsStoreRequestInputBase, MaterialRequestEditInput, MaterialRequestDetail, MaterialRequestDetailDTO,
SfsStoreRequestInputBase, MaterialRequestImportInput>,
IMaterialRequestAppService
{
private readonly IMaterialRequestManager _materialRequestManager;
@ -33,20 +34,65 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
private readonly IAreaAppService _areaApp;
private readonly ILocationAppService _locationAppService;
private readonly IItemBasicAppService _itemBasicAppService;
public MaterialRequestAppService(
IMaterialRequestRepository repository,
IMaterialRequestManager materialRequestManager,
IPreparationPlanManager preparationPlanManager,
IItemStoreRelationAppService itemStoreRelationApp,
IAreaAppService areaApp)
IAreaAppService areaApp
, ILocationAppService locationAppService
, IItemBasicAppService itemBasicAppService)
: base(repository, materialRequestManager)
{
_materialRequestManager = materialRequestManager;
_preparationPlanManager = preparationPlanManager;
_itemStoreRelationApp = itemStoreRelationApp;
_areaApp = areaApp;
_locationAppService = locationAppService;
_itemBasicAppService = itemBasicAppService;
}
#region 东阳使用
/// <summary>
/// 用来重写 导入数据时可以加工数据
/// </summary>
/// <param name="dictionary"></param>
/// <returns></returns>
protected override async Task<Dictionary<MaterialRequest, EntityState>> ImportProcessingEntityAsync(
Dictionary<MaterialRequest, EntityState> dictionary)
{
var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key);
foreach (var materialRequest in addList)
{
materialRequest.Worker = CurrentUser.GetUserName();
materialRequest.CreatorId = CurrentUser.Id;
foreach (var detail in materialRequest.Details)
{
var locationDto= await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false);
var itemBasicDto=await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
detail.ToLocationArea = locationDto.AreaCode;
detail.ToLocationErpCode = locationDto.ErpLocationCode;
detail.ToLocationGroup = locationDto.LocationGroupCode;
detail.ToWarehouseCode = locationDto.WarehouseCode;
detail.ItemDesc1 = itemBasicDto.Desc1;
detail.ItemDesc2= itemBasicDto.Desc2;
detail.ItemName= itemBasicDto.Name;
detail.Uom = itemBasicDto.BasicUom;
}
}
return await base.ImportProcessingEntityAsync(dictionary).ConfigureAwait(false);
}
#endregion
[HttpPost("")]
//[Authorize(MaterialRequestPermissions.Create)]
public override async Task<MaterialRequestDTO> CreateAsync(MaterialRequestEditInput input)
@ -85,7 +131,7 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
}
/// <summary>
/// 创建并且执行叫料请求
/// 创建并且执行叫料请求
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
@ -134,7 +180,7 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
}
/// <summary>
/// 根据备料计划生成 叫料请求
/// 根据备料计划生成 叫料请求
/// </summary>
/// <returns></returns>
[HttpPost("create-and-handle-by-preparation-plan/{number}")]
@ -142,10 +188,7 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
{
var prodPreparationPlan = await _preparationPlanManager.GetByNumberAsync(number).ConfigureAwait(false);
var materialRequestCreateInput = new MaterialRequestEditInput()
{
Worker = CurrentUser.GetUserName(),
};
var materialRequestCreateInput = new MaterialRequestEditInput { Worker = CurrentUser.GetUserName() };
foreach (var preparationPlanDetail in prodPreparationPlan.Details)
{
@ -170,18 +213,19 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
}
/// <summary>
/// 检验备料计划是否存在要料请求
/// 检验备料计划是否存在要料请求
/// </summary>
/// <param name="preparationPlanNumber"></param>
/// <returns></returns>
private async Task<List<MaterialRequest>> CheckExistByPreparationPlanAsync(string preparationPlanNumber)
{
var entities = await _repository.GetListAsync(c => c.PreparationPlanNumber == preparationPlanNumber).ConfigureAwait(false);
var entities = await _repository.GetListAsync(c => c.PreparationPlanNumber == preparationPlanNumber)
.ConfigureAwait(false);
return entities;
}
/// <summary>
/// 根据类型获取叫料请求
/// 根据类型获取叫料请求
/// </summary>
/// <param name="requestInput"></param>
/// <param name="type">
@ -199,7 +243,6 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
bool includeDetails = false,
CancellationToken cancellationToken = default)
{
Expression<Func<MaterialRequest, bool>> expression = p => p.Type == type;
if (requestInput.Condition.Filters?.Count > 0)
{
@ -210,8 +253,7 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
requestInput.Sorting, includeDetails, cancellationToken).ConfigureAwait(false);
}
#region import
#region 导入
//protected override async Task CheckImportInputBusinessAsync(MaterialRequestImportInput importInput, EnumImportMethod importMethod)
//{
@ -227,7 +269,14 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
// CheckTransactionType(EnumTransInOut.In, EnumInventoryStatus.OK, transactionType, item, location);
//}
protected override async Task ValidateImportModelAsync(MaterialRequestImportInput model, List<ValidationResult> validationRresult)
/// <summary>
/// 导入验证
/// </summary>
/// <param name="model"></param>
/// <param name="validationRresult"></param>
/// <returns></returns>
protected override async Task ValidateImportModelAsync(MaterialRequestImportInput model,
List<ValidationResult> validationRresult)
{
_ = new Dictionary<string, string>();
_ = await CheckItemBasicAsync(model, validationRresult).ConfigureAwait(false);
@ -236,11 +285,14 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
await CheckStoreRelationAsync(model, validationRresult).ConfigureAwait(false);
}
#region 校验
protected override async Task<bool> ValidateImportEntities(Dictionary<MaterialRequest, EntityState> dict)
{
foreach (var entity in dict.Keys)
{
var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false);
var tranType = await TransactionTypeAclService
.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false);
Check.NotNull(tranType, "事务类型", "事务类型不存在");
@ -250,84 +302,71 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
entity.AutoHandle = tranType.AutoHandleRequest;
entity.DirectCreateNote = tranType.DirectCreateNote;
}
return await base.ValidateImportEntities(dict).ConfigureAwait(false);
}
protected async Task<ItemBasicDTO> CheckItemBasicAsync(MaterialRequestImportInput importInput, List<ValidationResult> validationRresult)
protected async Task<ItemBasicDTO> CheckItemBasicAsync(MaterialRequestImportInput importInput,
List<ValidationResult> validationRresult)
{
var item = await ItemBasicAclService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false);
if (item == null)
{
validationRresult.Add(new ValidationResult($"物品代码{importInput.ItemCode}不存在", new string[] { "物品代码" }));
validationRresult.Add(new ValidationResult($"物品代码{importInput.ItemCode}不存在", new[] { "物品代码" }));
}
else if (item.StdPackQty == 0)
{
validationRresult.Add(new ValidationResult($"物品代码{importInput.ItemCode}的标准包装不存在", new string[] { "标准包装" }));
validationRresult.Add(
new ValidationResult($"物品代码{importInput.ItemCode}的物品信息中标准包装等于0或不存在", new[] { "标准包装" }));
}
return item;
}
protected async Task<LocationDTO> CheckLocationAsync(MaterialRequestImportInput importInput, List<ValidationResult> validationRresult)
protected async Task<LocationDTO> CheckLocationAsync(MaterialRequestImportInput importInput,
List<ValidationResult> validationRresult)
{
var location = await LocationAclService.GetByCodeAsync(importInput.ToLocationCode).ConfigureAwait(false);
var location = await _locationAppService.GetByCodeAsync(importInput.ToLocationCode).ConfigureAwait(false);
if (location == null)
{
validationRresult.Add(new ValidationResult($"目标库位{importInput.ToLocationCode}不存在", new string[] { "目标库位" }));
validationRresult.Add(new ValidationResult($"目标库位{importInput.ToLocationCode}不存在", new[] { "目标库位" }));
}
return location;
}
protected async Task CheckAreaAsync(MaterialRequestImportInput importInput, List<ValidationResult> validationRresult)
protected async Task CheckAreaAsync(MaterialRequestImportInput importInput,
List<ValidationResult> validationRresult)
{
var area = await _areaApp.GetByCodeAsync(importInput.FromLocationArea).ConfigureAwait(false);
if (area == null)
{
validationRresult.Add(new ValidationResult($"调出库区{importInput.FromLocationArea}不存在", new string[] { "调出库区" }));
validationRresult.Add(new ValidationResult($"调出库区{importInput.FromLocationArea}不存在", new[] { "调出库区" }));
}
}
protected async Task CheckStoreRelationAsync(MaterialRequestImportInput importInput, List<ValidationResult> validationRresult)
protected async Task CheckStoreRelationAsync(MaterialRequestImportInput importInput,
List<ValidationResult> validationRresult)
{
var itemStoreRelation = await _itemStoreRelationApp.GetFirstAsync(importInput.ItemCode, importInput.ToLocationCode).ConfigureAwait(false);
var itemStoreRelation = await _itemStoreRelationApp
.GetFirstAsync(importInput.ItemCode, importInput.ToLocationCode).ConfigureAwait(false);
if (itemStoreRelation == null)
{
validationRresult.Add(new ValidationResult($"物品代码{importInput.ItemCode}与目标库位{importInput.ToLocationCode}不存在对应关", new string[] { "物品库位对应关系" }));
validationRresult.Add(new ValidationResult(
$"物品代码{importInput.ItemCode}与目标库位{importInput.ToLocationCode}不存在对应关", new[] { "物品库位对应关系" }));
}
}
protected override async Task SaveImportAsync(Dictionary<MaterialRequest, EntityState> dict)
{
var entityList = dict.Keys.ToList();
foreach (var entity in entityList)
{
foreach (var detail in entity.Details)
{
var item = await ItemBasicAclService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
if (item != null)
{
detail.ItemName = item.Name;
detail.ItemDesc1 = item.Desc1;
detail.ItemDesc2 = item.Desc2;
detail.StdPackQty = item.StdPackQty;
}
var location = await LocationAclService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false);
if (location != null)
{
detail.ToLocationErpCode = location.ErpLocationCode;
detail.ToWarehouseCode = location.WarehouseCode;
}
}
}
await base.SaveImportAsync(dict).ConfigureAwait(false);
}
#endregion
#endregion
/// <summary>
/// 根据类型 获取叫料申请
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
[HttpGet("list/by-type/{type}")]
public virtual async Task<List<MaterialRequestDTO>> GetListByTypeAsync(string type)
{
var entities = await _repository.GetListAsync(c => c.Type == type).ConfigureAwait(false);
@ -335,6 +374,5 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
var dtos = ObjectMapper.Map<List<MaterialRequest>, List<MaterialRequestDTO>>(entities);
return dtos;
}
}

12
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/IssueJobAutoMapperProfile.cs

@ -43,15 +43,14 @@ public partial class StoreEventAutoMapperProfile : Profile
.ForMember(x => x.FromLocationErpCode, y => y.MapFrom(d => d.HandledFromLocationErpCode))
.ForMember(x => x.FromWarehouseCode, y => y.MapFrom(d => d.HandledFromWarehouseCode))
.ForMember(x => x.ToLocationCode, y => y.MapFrom(d => d.ToLocationCode))
.Ignore(x => x.ToWarehouseCode)
.Ignore(x => x.ToLocationArea)
.Ignore(x => x.ToLocationGroup)
.Ignore(x => x.ToLocationErpCode)
;
CreateMap<IssueJobDetail, ExpectInEditInput>()
CreateMap<
IssueJobDetail, ExpectInEditInput>()
.MapExpectInOutFrom()
.Ignore(x => x.LocationArea)
.Ignore(x => x.LocationGroup)
.Ignore(x => x.WarehouseCode)
.Ignore(x => x.Worker)
.Ignore(x => x.SerialNumber)
.Ignore(x => x.ExtraProperties)
@ -59,9 +58,6 @@ public partial class StoreEventAutoMapperProfile : Profile
CreateMap<IssueJobDetail, ExpectOutEditInput>()
.MapExpectInOutFrom()
.Ignore(x => x.LocationArea)
.Ignore(x => x.LocationGroup)
.Ignore(x => x.WarehouseCode)
.Ignore(x => x.Worker)
.Ignore(x => x.SerialNumber)
.Ignore(x => x.ExtraProperties);

32
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/ExpectInOuts/IssueJobEventHandler.cs

@ -54,7 +54,11 @@ public class IssueJobEventHandler :
var expectOuts = new List<ExpectOutEditInput>();
foreach (var entity in entities)
{
var entityExpectOuts = BuildExpectOutInventoryAsync(entity);
var entityExpectOuts = BuildExpectOutInventoryAsync(entity.Details, entity.Number);
entityExpectOuts.ForEach(p =>
{
p.JobNumber = entity.Number;
});
expectOuts.AddRange(entityExpectOuts);
}
await ExpectOutAppService.AddManyAsync(expectOuts).ConfigureAwait(false);
@ -65,33 +69,25 @@ public class IssueJobEventHandler :
var expectIns = new List<ExpectInEditInput>();
foreach (var entity in entities)
{
var entityExpectIns = BuildExpectInInventoryAsync(entity);
var entityExpectIns = BuildExpectInInventoryAsync(entity.Details, entity.Number);
entityExpectIns.ForEach(p =>
{
p.JobNumber = entity.Number;
});
expectIns.AddRange(entityExpectIns);
}
await ExpectInAppService.AddManyAsync(expectIns).ConfigureAwait(false);
}
private List<ExpectInEditInput> BuildExpectInInventoryAsync(IssueJob issueJob)
private List<ExpectInEditInput> BuildExpectInInventoryAsync(List<IssueJobDetail> balanceDto, string jobNumber)
{
var inputs = ObjectMapper.Map<List<IssueJobDetail>, List<ExpectInEditInput>>(issueJob.Details);
foreach (var input in inputs)
{
input.WarehouseCode = issueJob.WarehouseCode;
input.Worker = issueJob.Worker;
input.JobNumber = issueJob.Number;
}
var inputs = ObjectMapper.Map<List<IssueJobDetail>, List<ExpectInEditInput>>(balanceDto);
return inputs;
}
private List<ExpectOutEditInput> BuildExpectOutInventoryAsync(IssueJob issueJob)
private List<ExpectOutEditInput> BuildExpectOutInventoryAsync(List<IssueJobDetail> balanceDto, string jobNumber)
{
var inputs = ObjectMapper.Map<List<IssueJobDetail>, List<ExpectOutEditInput>>(issueJob.Details);
foreach (var input in inputs)
{
input.WarehouseCode = issueJob.WarehouseCode;
input.Worker = issueJob.Worker;
input.JobNumber = issueJob.Number;
}
var inputs = ObjectMapper.Map<List<IssueJobDetail>, List<ExpectOutEditInput>>(balanceDto);
return inputs;
}
}

173
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/IssueJobEventHandler.cs

@ -1,10 +1,10 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using StackExchange.Redis;
using Volo.Abp.EventBus;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Store.Application.Contracts;
@ -15,147 +15,116 @@ namespace Win_in.Sfs.Wms.Store.Event.BusinessJob;
public class IssueJobEventHandler :
StoreEventHandlerBase
, ILocalEventHandler<SfsCreatedEntityEventData<IssueJob>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<IssueJob>>>
, ILocalEventHandler<SfsCompletedEntityEventData<IssueJob>>
{
private const string MaterialRequestPrefix = "MaterialRequest";
private const EnumTransType TransType = EnumTransType.Issue;
private readonly IMaterialRequestManager _materialRequestManager;
private readonly IIssueNoteManager _issueNoteManager;
public IssueJobEventHandler(
IIssueNoteManager issueNoteManager
, IMaterialRequestManager materialRequestManager
, IConfiguration configuration)
private readonly IIssueNoteAppService _issueNoteAppService;
private readonly ILocationAppService _locationAppService;
public IssueJobEventHandler(IIssueNoteAppService issueNoteAppService, ILocationAppService locationAppService)
{
_issueNoteManager = issueNoteManager;
_materialRequestManager = materialRequestManager;
var redisConnectionString = configuration["Redis:Configuration"];
var redisConnection = ConnectionMultiplexer.Connect(redisConnectionString);
RedisDB = redisConnection.GetDatabase();
_issueNoteAppService = issueNoteAppService;
_locationAppService = locationAppService;
}
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<IssueJob> eventData)
{
var entity = eventData.Entity;
var cacheKey = GetCacheKey(entity.MaterialRequestNumber);
var jobNumber = entity.Number;
await RedisDB.HashSetAsync(cacheKey, jobNumber, true).ConfigureAwait(false);
}
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<IssueJob>> eventData)
{
var entities = eventData.Entity;
foreach (var entity in entities)
{
var cacheKey = GetCacheKey(entity.MaterialRequestNumber);
var jobNumber = entity.Number;
await RedisDB.HashSetAsync(cacheKey, jobNumber, true).ConfigureAwait(false);
}
}
/// <summary>
/// 执行后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCompletedEntityEventData<IssueJob> eventData)
{
var entity = eventData.Entity;
#region 更新叫料请求状态
var cacheKey = GetCacheKey(entity.MaterialRequestNumber);
var jobNumber = entity.Number;
await RedisDB.HashDeleteAsync(cacheKey, jobNumber).ConfigureAwait(false);
var count = await RedisDB.HashLengthAsync(cacheKey).ConfigureAwait(false);
if (count == 0)
{
await _materialRequestManager.CompleteAsync(entity.MaterialRequestNumber).ConfigureAwait(false);
}
#endregion
var issueNote = await BuildIssueNoteAsync(entity).ConfigureAwait(false);
await _issueNoteManager.CreateAsync(issueNote).ConfigureAwait(false);
await _issueNoteAppService.CreateAsync(issueNote).ConfigureAwait(false);
}
#region 私有
/// <summary>
/// 创建补料记录实体
/// 创建补料记录实体
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
private async Task<IssueNote> BuildIssueNoteAsync(IssueJob entity)
private async Task<IssueNoteEditInput> BuildIssueNoteAsync(IssueJob entity)
{
var issueNote = ObjectMapper.Map<IssueJob, IssueNote>(entity);
var locationCodes = issueNote.Details.Select(p => p.ToLocationCode).Distinct().ToList();
var locations = await LocationAclService.GetByCodesAsync(locationCodes).ConfigureAwait(false);
var issueNoteCreateInput = ObjectMapper.Map<IssueJob, IssueNoteEditInput>(entity);
var locationCodes = issueNoteCreateInput.Details.Select(p => p.ToLocationCode).Distinct().ToList();
var locations = await _locationAppService.GetByCodesAsync(locationCodes).ConfigureAwait(false);
issueNote.Details.RemoveAll(p => p.Qty == 0);
issueNoteCreateInput.Details.RemoveAll(p => p.Qty == 0);
foreach (var detail in issueNote.Details)
foreach (var detail in issueNoteCreateInput.Details)
{
var location = locations.First(p => p.Code == detail.ToLocationCode);
await RemovePackingCodeAndContainerCodeAndLot(detail, location.Type).ConfigureAwait(false);//去箱 去托 去批
await RemovePackingCodeAndContainerCodeAndLotAsync(detail, location.Type); //去箱 去托 去批
detail.ToLocationArea = location.AreaCode;
detail.ToLocationGroup = location.LocationGroupCode;
detail.ToLocationErpCode = location.ErpLocationCode;
detail.ToWarehouseCode = location.WarehouseCode;
detail.FromWarehouseCode = location.WarehouseCode;
}
return issueNote;
return issueNoteCreateInput;
}
/// <summary>
/// 去除箱码 托码 批次
/// 去除箱码 托码 批次
/// </summary>
private async Task RemovePackingCodeAndContainerCodeAndLot(IssueNoteDetail issueNoteDetail, EnumLocationType locationType)
private async Task RemovePackingCodeAndContainerCodeAndLotAsync(IssueNoteDetailInput issueNoteDetail,
EnumLocationType locationType)
{
switch (locationType)
{
case EnumLocationType.WIP:
{
//用开关控制 发料到线边后去除箱码和托码 ???
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemovePackingCode)
.ConfigureAwait(false))
{
issueNoteDetail.ToPackingCode = "";
}
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveContainerCode)
.ConfigureAwait(false))
{
//用开关控制 发料到线边后去除箱码和托码 ???
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemovePackingCode).ConfigureAwait(false))
{
issueNoteDetail.ToPackingCode = "";
}
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveContainerCode).ConfigureAwait(false))
{
issueNoteDetail.ToContainerCode = "";
}
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveLot).ConfigureAwait(false))
{
issueNoteDetail.ToLot = "";
}
break;
issueNoteDetail.ToContainerCode = "";
}
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveLot).ConfigureAwait(false))
{
issueNoteDetail.ToLot = "";
}
break;
}
case EnumLocationType.SEMI:
{
//用开关控制 发料到后去除箱码和托码 ???
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemovePackingCode)
.ConfigureAwait(false))
{
//用开关控制 发料到后去除箱码和托码 ???
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemovePackingCode).ConfigureAwait(false))
{
issueNoteDetail.ToPackingCode = "";
}
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveContainerCode).ConfigureAwait(false))
{
issueNoteDetail.ToContainerCode = "";
}
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveLot).ConfigureAwait(false))
{
issueNoteDetail.ToLot = "";
}
break;
issueNoteDetail.ToPackingCode = "";
}
}
}
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveContainerCode)
.ConfigureAwait(false))
{
issueNoteDetail.ToContainerCode = "";
}
private static string GetCacheKey(string requestNumber)
{
return $"{StoreConsts.CachePrefix}:{MaterialRequestPrefix}:{requestNumber}";
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveLot).ConfigureAwait(false))
{
issueNoteDetail.ToLot = "";
}
break;
}
}
}
#endregion
}

81
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/MaterialRequestEventHandler.cs

@ -2,6 +2,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FluentValidation.Validators;
using Volo.Abp;
using Volo.Abp.EventBus;
using Volo.Abp.SettingManagement;
@ -20,19 +21,61 @@ public class MaterialRequestEventHandler
, ILocalEventHandler<SfsHandledEntityEventData<MaterialRequest>>
, ILocalEventHandler<SfsAbortedEntityEventData<MaterialRequest>>
, ILocalEventHandler<SfsCompletedEntityEventData<MaterialRequest>>
, ILocalEventHandler<SfsCreatedEntityEventData<MaterialRequest>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<MaterialRequest>>>
{
private readonly IIssueJobAppService _issueJobAppService;
private readonly IProductionLineAppService _productionLineAppService;
private readonly IMaterialRequestManager _materialRequestManager;
private readonly ILocationAppService _locationAppService;
public MaterialRequestEventHandler(
IIssueJobAppService issueJobAppService
, IProductionLineAppService productionLineAppService
)
, IMaterialRequestManager materialRequestManager
, ILocationAppService locationAppService)
{
_issueJobAppService = issueJobAppService;
_productionLineAppService = productionLineAppService;
_materialRequestManager = materialRequestManager;
_locationAppService = locationAppService;
}
/// <summary>
/// 创建后
/// </summary>
/// <param name="eventData">Event data</param>
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<MaterialRequest> eventData)
{
var entity = eventData.Entity;
if (entity.AutoSubmit)
{
await _materialRequestManager.SubmitAsync(entity).ConfigureAwait(false);
}
}
/// <summary>
/// 批量创建后
/// </summary>
/// <param name="eventData">Event data</param>
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<MaterialRequest>> eventData)
{
var entitys = eventData.Entity;
foreach (var entity in entitys)
{
if (entity.AutoSubmit)
{
await _materialRequestManager.SubmitAsync(entity).ConfigureAwait(false);
}
}
}
/// <summary>
/// 执行后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
public virtual async Task HandleEventAsync(SfsHandledEntityEventData<MaterialRequest> eventData)
{
var entity = eventData.Entity;
@ -43,12 +86,22 @@ public class MaterialRequestEventHandler
}
}
/// <summary>
/// 驳回后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
public virtual async Task HandleEventAsync(SfsAbortedEntityEventData<MaterialRequest> eventData)
{
var entity = eventData.Entity;
await _issueJobAppService.CancelByMaterialRequestAsync(entity.Number).ConfigureAwait(false);
}
/// <summary>
/// 完成后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
public virtual async Task HandleEventAsync(SfsCompletedEntityEventData<MaterialRequest> eventData)
{
_ = eventData.Entity;
@ -63,7 +116,7 @@ public class MaterialRequestEventHandler
var transactionType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false);
var toLocationCodes = materialRequest.Details.Select(p => p.ToLocationCode).Distinct().ToList();
var toLocations = await LocationAclService.GetByCodesAsync(toLocationCodes).ConfigureAwait(false);
var toLocations = await _locationAppService.GetByCodesAsync(toLocationCodes).ConfigureAwait(false);
foreach (var materialRequestDetail in materialRequest.Details.Where(p => p.ToBeIssuedQty > 0))
{
@ -76,7 +129,7 @@ public class MaterialRequestEventHandler
}
var fromLocationCode = jobDetails[0].RecommendFromLocationCode;
var fromLocation = await LocationAclService.GetByCodeAsync(fromLocationCode).ConfigureAwait(false);
var fromLocation = await _locationAppService.GetByCodeAsync(fromLocationCode).ConfigureAwait(false);
var job = jobs.FirstOrDefault(p => p.WorkGroupCode == fromLocation?.WorkGroupCode);
if (job == null || job.Details.Any(p => p.ToLocationCode != materialRequestDetail.ToLocationCode))
{
@ -170,10 +223,27 @@ public class MaterialRequestEventHandler
var detail = ObjectMapper.Map<BalanceDTO, IssueJobDetailInput>(balance);
detail.RequestLocationCode = materialRequestDetail.ToLocationCode;
detail.ToLocationCode = materialRequestDetail.ToLocationCode;
detail.ToLocationErpCode = materialRequestDetail.ToLocationErpCode;
detail.WorkStation = materialRequestDetail.WorkStation;
detail.ExpiredTime = materialRequestDetail.ExpiredTime;
detail.RecommendPackingCode = balance.PackingCode;
detail.RecommendContainerCode = balance.ContainerCode;
detail.RecommendSupplierBatch = balance.SupplierBatch;
detail.RecommendProduceDate= balance.ProduceDate;
detail.RecommendExpireDate= balance.ExpireDate;
detail.RecommendLot= balance.Lot;
detail.RecommendProduceDate=balance.ProduceDate;
detail.RecommendArriveDate= balance.ArriveDate;
detail.RecommendFromLocationArea = balance.LocationArea;
detail.RecommendFromLocationCode= balance.LocationCode;
detail.RecommendFromLocationErpCode= balance.LocationErpCode;
detail.RecommendFromLocationGroup= balance.LocationGroup;
detail.RecommendFromWarehouseCode= balance.WarehouseCode;
detail.ToLocationCode = materialRequestDetail.ToLocationCode;
detail.ToLocationErpCode = materialRequestDetail.ToLocationErpCode;
detail.ToWarehouseCode = materialRequestDetail.ToWarehouseCode;
detail.ToLocationGroup = materialRequestDetail.ToLocationGroup;
//detail.Operation = //TODO
//detail.DistributionType =//TODO
//detail.TruncType = //TODO
@ -206,4 +276,5 @@ public class MaterialRequestEventHandler
}
}

6
build/src/docker/publish/conf/settings/appsettings.Development.json

@ -122,10 +122,10 @@
"BaseUrl": "http://dev.ccwin-in.com:21292/"
},
"Inventory": {
"BaseUrl": "http://dev.ccwin-in.com:21295/"
"BaseUrl": "http://localhost:59095/"
},
"Job": {
"BaseUrl": "http://dev.ccwin-in.com:21295/"
"BaseUrl": "http://localhost:59095/"
},
"Label": {
"BaseUrl": "http://dev.ccwin-in.com:21292/"
@ -134,7 +134,7 @@
"BaseUrl": "http://dev.ccwin-in.com:21292/"
},
"Store": {
"BaseUrl": "http://dev.ccwin-in.com:21295/"
"BaseUrl": "http://localhost:59095/"
}
},
"Serilog": {

Loading…
Cancel
Save