Browse Source

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

dev_DY_CC
赵新宇 1 year ago
parent
commit
8ad44198b5
  1. 12
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/OutgoingFromWmsWorker.cs
  2. 3
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Locations/ILocationAppService.cs
  3. 3
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductLineItems/IProductionLineItemAppService.cs
  4. 1
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/PurchasePrices/IPurchasePriceSheetAppService.cs
  5. 8
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Locations/LocationAppService.cs
  6. 10
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLineItems/ProductionLineItemAppService.cs
  7. 12
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PurchasePrices/PurchasePriceSheetAppService.cs
  8. 8
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/IBalanceAppService.cs
  9. 312
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs
  10. 107
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs
  11. 29
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/IBalanceManager.cs
  12. 1
      be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransType.cs
  13. 8
      be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Job/EnumJobStatus.cs
  14. 4
      be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumIssueType.cs
  15. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/ExchangeDatas/IExchangeDataAppService.cs
  16. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/InjectionJobs/DTOs/InjectionJobDTO.cs
  17. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/InjectionJobs/IInjectionJobAppService.cs
  18. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/InjectionJobs/Inputs/InjectionJobEditInput.cs
  19. 12
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ThirdLocationJobs/DTOs/ThirdLocationJobDetailDTO.cs
  20. 14
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ThirdLocationJobs/Inputs/ThirdLocationJobDetailInput.cs
  21. 5
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/DTOs/ThirdLocationRequestDTO.cs
  22. 7
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/Inputs/ThirdLocationRequestDetailInput.cs
  23. 9
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/Inputs/ThirdLocationRequestImportInput.cs
  24. 14
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/ExchangeDatas/ExchangeDataAppService.cs
  25. 28
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionJobs/InjectionJobAppService.cs
  26. 12
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs
  27. 13
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAppService.cs
  28. 28
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs
  29. 14
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs
  30. 12
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/ExchangeDatas/ExchangeDataManager.cs
  31. 9
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ThirdLocationJobs/ThirdLocationJobDetail.cs
  32. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ThirdLocationNotes/ThirdLocationNoteDetail.cs
  33. 4
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestManager.cs
  34. 7
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ThirdLocationRequests/ThirdLocationRequestDetail.cs
  35. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/ThirdLocationJobs/ThirdLocationJobDbContextModelCreatingExtensions.cs
  36. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/ThirdLocationRequests/ThirdLocationRequestDbContextModelCreatingExtensions.cs
  37. 7
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/ThirdLocationRequestAutoMapperProfile.cs
  38. 216
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/InjectionJobEventHandler.cs
  39. 182
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InjectionRequestEventHandler.cs
  40. 5
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ThirdLocationRequestEventHandler.cs
  41. 2
      be/WZC2.sln.DotSettings
  42. 4
      build/src/docker/publish/conf/settings/appsettings.Development.json

12
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/OutgoingFromWmsWorker.cs

@ -47,7 +47,17 @@ public class OutgoingFromWmsWorker : AsyncPeriodicBackgroundWorkerBase
//var exchangeDataList = await exchangeDataAppService.GetAllListByFilterAsync(input).ConfigureAwait(false);
var exchangeDataList = await exchangeDataAppService.GetToBeProcessedListAsync(batchSize).ConfigureAwait(false);
var outgoingFromWmsList = objectMapper.Map<List<ExchangeDataDTO>, List<OutgoingFromWms>>(exchangeDataList);
await outgoingFromWmsManager.CreateManyAsync(outgoingFromWmsList).ConfigureAwait(false);
try
{
await outgoingFromWmsManager.CreateManyAsync(outgoingFromWmsList).ConfigureAwait(false);
await exchangeDataAppService.UpdateManyAsync(exchangeDataList).ConfigureAwait(false);
}
catch (System.Exception ex)
{
throw ex;
}
}
}

3
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Locations/ILocationAppService.cs

@ -31,6 +31,5 @@ public interface ILocationAppService
Task<List<LocationDTO>> GetListByManyCodes(List<string> codes);
Task<List<LocationDTO>> GetListByTypesAndErpCodeAsync(List<EnumLocationType> types, string erpCode);
Task<List<LocationDTO>> GetListByTypesAndErpCodeAsync(List<EnumLocationType> types, string erpCode,string locCode);
Task<List<LocationDTO>> GetListByErpLocationCodes(List<string> ErpLocationCodes);
}

3
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ProductLineItems/IProductionLineItemAppService.cs

@ -13,4 +13,7 @@ public interface IProductionLineItemAppService
{
Task<List<ProductionLineItemDTO>> GetByProductLineCodeAsync(string productLineCode);
Task<ProductionLineItemDTO> GetByProductLineCodeAndItemCodeAsync(string productLineCode,
string itemCode);
}

1
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/PurchasePrices/IPurchasePriceSheetAppService.cs

@ -5,6 +5,7 @@ namespace Win_in.Sfs.Basedata.Application.Contracts;
public interface IPurchasePriceSheetAppService : ISfsBaseDataAppServiceBase<PurchasePriceSheetDTO, SfsBaseDataRequestInputBase, PurchasePriceSheetEditInput>
{
Task<bool> CheckPurPriceAsync(string supplierCode, string itemCode);
Task<PurchasePriceSheetDTO> GetByItemCodeAsync(string itemCode,string supplierCode);
Task UpsertAsyncByInterface(PurchasePriceSheetEditInput input);
}

8
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Locations/LocationAppService.cs

@ -202,7 +202,15 @@ public class LocationAppService
return dtos;
}
[HttpPost("get-list-by-erplocation-codes")]
public virtual async Task<List<LocationDTO>> GetListByErpLocationCodes(List<string> ErpLocationCodes)
{
var entitys = await _repository.GetListAsync(p => ErpLocationCodes.Contains(p.ErpLocationCode)).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<Domain.Location>, List<LocationDTO>>(entitys);
return dtos;
}
[HttpGet("get-all")]
//[Authorize(LocationPermissions.Default)]
public virtual async Task<List<LocationDTO>> GetAllAsync()

10
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLineItems/ProductionLineItemAppService.cs

@ -17,6 +17,7 @@ public class ProductionLineItemAppService :
ProductionLineItemEditInput, ProductionLineItemImportInput>, IProductionLineItemAppService
{
private new readonly IProductionLineItemRepository _repository;
public ProductionLineItemAppService(
IProductionLineItemRepository repository
, IDistributedCache<ProductionLineItemDTO> cache
@ -53,4 +54,13 @@ public class ProductionLineItemAppService :
var entityList = await _repository.GetListAsync(p => p.ProdLineCode == productLineCode).ConfigureAwait(false);
return ObjectMapper.Map<List<ProductionLineItem>, List<ProductionLineItemDTO>>(entityList);
}
[HttpPost("get-by-product-item")]
public virtual async Task<ProductionLineItemDTO> GetByProductLineCodeAndItemCodeAsync(string productLineCode,
string itemCode)
{
var entityList = await _repository
.FindAsync(p => p.ProdLineCode == productLineCode && p.ItemCode == itemCode).ConfigureAwait(false);
return ObjectMapper.Map<ProductionLineItem, ProductionLineItemDTO>(entityList);
}
}

12
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PurchasePrices/PurchasePriceSheetAppService.cs

@ -41,4 +41,16 @@ public class PurchasePriceSheetAppService : SfsBaseDataAppServiceBase<PurchasePr
var entity = ObjectMapper.Map<PurchasePriceSheetEditInput, PurchasePriceSheet>(input);
await _repository.UpsertAsyncByInterface(entity).ConfigureAwait(false);
}
/// <summary>
/// 判断是否有采购价格
/// </summary>
/// <returns></returns>
[HttpPost("check-purprice")]
public virtual async Task<bool> CheckPurPriceAsync( string supplierCode, string itemCode)
{
bool result = false;
var entitys = await _repository.GetListAsync(p => p.SupplierCode == supplierCode && p.ItemCode == itemCode).ConfigureAwait(false);
if (entitys.Count == 0) result = true;
return result;
}
}

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

@ -166,4 +166,12 @@ public interface IBalanceAppService
Task<List<BalanceDTO>> GetListByErpLocationCodeAndItemCodeAsync(string erplocationCode, string itemCode);
Task<List<BalanceDTO>> GetRecommendBalancesByLocationsAsync(RecommendBalanceRequestInput input);
Task<PagedResultDto<BalanceDTO>> GetBalancePagedListByFilterAsync(SfsInventoryRequestInputBase sfsRequestInput, bool includeDetails = false, CancellationToken cancellationToken = default);
/// <summary>
/// 获取可用库存列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
Task<List<BalanceDTO>> GetUsableListAsync(RecommendBalanceRequestInput input);
}

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

@ -1,16 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using DocumentFormat.OpenXml.Office2016.Drawing.ChartDrawing;
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.Events.Distributed;
using Volo.Abp.Domain.Repositories;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Application.Contracts;
@ -21,12 +19,11 @@ using Win_in.Sfs.Wms.Inventory.Domain;
using Win_in.Sfs.Wms.Inventory.Domain.Acl.ItemBasic;
using Win_in.Sfs.Wms.Inventory.Domain.Acl.Location;
using Win_in.Sfs.Wms.Inventory.Domain.Shared;
using JsonSerializer = System.Text.Json.JsonSerializer;
namespace Win_in.Sfs.Wms.Inventory.Application;
/// <summary>
/// 库存余额
/// 库存余额
/// </summary>
[Authorize]
[Route($"{InventoryConsts.RootPath}inventory-balance")]
@ -58,13 +55,55 @@ public class BalanceAppService
_locationAclService = locationAclService;
_itemBasicAclService = itemBasicAclService;
_itemBasicAppService = itemBasicAppService;
_stdCostPriceSheetAppService= stdCostPriceSheetAppService;
_stdCostPriceSheetAppService = stdCostPriceSheetAppService;
}
#region Update
/// <summary>
/// 库存余额更新物品基础信息
/// </summary>
[HttpPost("update/item-basic-info")]
public async Task UpdateItemBasicInfoAsync(BalanceUpdateItemBasicInfoDto balanceUpdateItemBasicInfoDto)
{
//停用,可能用其他处理方案
return;
// 物品编码
var itemCodes = balanceUpdateItemBasicInfoDto.BalanceUpdateItemBasicInfos?.Select(c => c.ItemCode);
itemCodes = itemCodes?.Where(t => string.IsNullOrWhiteSpace(t) == false);
if (itemCodes == null || itemCodes.Any() == false)
{
return;
}
// 获取库存余额
var entitys = await _repository.GetListAsync(p =>
itemCodes.Contains(p.ItemCode)).ConfigureAwait(false);
if (entitys.Count <= 0)
{
return;
}
// 库存余额更新物品基础信息
var entitysGroup = entitys.GroupBy(t => t.ItemCode);
foreach (var entity in entitysGroup)
{
var balanceUpdateItemBasicInfo =
balanceUpdateItemBasicInfoDto.BalanceUpdateItemBasicInfos.FirstOrDefault(t => t.ItemCode == entity.Key);
foreach (var item in entity)
{
item.ItemName = balanceUpdateItemBasicInfo.ItemName ?? item.ItemName;
item.ItemDesc1 = balanceUpdateItemBasicInfo.ItemDesc1 ?? item.ItemDesc1;
item.ItemDesc2 = balanceUpdateItemBasicInfo.ItemDesc2 ?? item.ItemDesc2;
}
}
await _repository.UpdateManyAsync(entitys).ConfigureAwait(false);
}
/// <summary>
/// 修改批次
/// 修改批次
/// </summary>
/// <param name="id"></param>
/// <param name="lot"></param>
@ -74,19 +113,22 @@ public class BalanceAppService
/// <param name="expireDate"></param>
/// <returns></returns>
[HttpPost("update/batch")]
public virtual async Task UpdateBatchAsync(Guid id, string lot, string supplierBatch, DateTime arriveDate, DateTime produceDate, DateTime expireDate)
public virtual async Task UpdateBatchAsync(Guid id, string lot, string supplierBatch, DateTime arriveDate,
DateTime produceDate, DateTime expireDate)
{
var entity = await _repository.FindAsync(id).ConfigureAwait(false);
Check.NotNull(entity, EntityClassName);
var worker = CurrentUser.GetUserName();
var jobNumber = "";
var docNumber = "";
await _transferLogManager.ChangeBatchAsync(entity, lot, supplierBatch, arriveDate, produceDate, expireDate, worker, jobNumber, docNumber).ConfigureAwait(false);
await _transferLogManager
.ChangeBatchAsync(entity, lot, supplierBatch, arriveDate, produceDate, expireDate, worker, jobNumber,
docNumber).ConfigureAwait(false);
await _repository.UpdateAsync(entity).ConfigureAwait(false);
}
/// <summary>
/// 修改序号
/// 修改序号
/// </summary>
/// <param name="id"></param>
/// <param name="serialNumber"></param>
@ -101,7 +143,7 @@ public class BalanceAppService
}
/// <summary>
/// 修改库位
/// 修改库位
/// </summary>
/// <param name="id"></param>
/// <param name="warehouseCode"></param>
@ -109,7 +151,8 @@ public class BalanceAppService
/// <param name="containerCode"></param>
/// <returns></returns>
[HttpPost("update/location")]
public virtual async Task UpdateLocationAsync(Guid id, string warehouseCode, string locationCode, string containerCode)
public virtual async Task UpdateLocationAsync(Guid id, string warehouseCode, string locationCode,
string containerCode)
{
var entity = await _repository.FindAsync(id).ConfigureAwait(false);
Check.NotNull(entity, EntityClassName);
@ -122,7 +165,7 @@ public class BalanceAppService
}
/// <summary>
/// 修改状态
/// 修改状态
/// </summary>
/// <param name="id"></param>
/// <param name="status"></param>
@ -140,7 +183,7 @@ public class BalanceAppService
}
/// <summary>
/// 修改过期日期
/// 修改过期日期
/// </summary>
/// <param name="id"></param>
/// <param name="expireDate"></param>
@ -155,7 +198,7 @@ public class BalanceAppService
}
/// <summary>
/// 修改托盘标签
/// 修改托盘标签
/// </summary>
/// <param name="id"></param>
/// <param name="containerCode"></param>
@ -170,7 +213,7 @@ public class BalanceAppService
}
/// <summary>
/// 可用
/// 可用
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
@ -184,7 +227,7 @@ public class BalanceAppService
}
/// <summary>
/// 不可用
/// 不可用
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
@ -198,7 +241,7 @@ public class BalanceAppService
}
/// <summary>
/// 设置为不可用 根据 库位 零件 箱码 批次 状态
/// 设置为不可用 根据 库位 零件 箱码 批次 状态
/// </summary>
/// <param name="packingCode"></param>
/// <param name="itemCode"></param>
@ -227,7 +270,7 @@ public class BalanceAppService
}
/// <summary>
/// 设置为可用 根据 库位 零件 箱码 批次 状态
/// 设置为可用 根据 库位 零件 箱码 批次 状态
/// </summary>
/// <param name="packingCode"></param>
/// <param name="itemCode"></param>
@ -258,27 +301,30 @@ public class BalanceAppService
#endregion Update
#region Get
/// <summary>
/// 获取库存余额带标准价格得
/// 获取库存余额带标准价格得
/// </summary>
/// <param name="sfsRequestInput"></param>
/// <param name="includeDetails"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
[HttpPost("get-list")]
public virtual async Task<PagedResultDto<BalanceDTO>> GetBalancePagedListByFilterAsync(SfsInventoryRequestInputBase sfsRequestInput, bool includeDetails = false,
CancellationToken cancellationToken = default)
public virtual async Task<PagedResultDto<BalanceDTO>> GetBalancePagedListByFilterAsync(
SfsInventoryRequestInputBase sfsRequestInput, bool includeDetails = false,
CancellationToken cancellationToken = default)
{
var result =await base.GetPagedListByFilterAsync(sfsRequestInput, includeDetails, cancellationToken);
var result = await base.GetPagedListByFilterAsync(sfsRequestInput, includeDetails, cancellationToken);
foreach (var item in result.Items)
{
var std = await _stdCostPriceSheetAppService.GetByItemCode(item.ItemCode).ConfigureAwait(false);
item.StdCostPrice = std == null ? 0 : std.StdCostPrice;
}
return result;
}
/// <summary>
///
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
@ -304,11 +350,11 @@ public class BalanceAppService
dto.ItemDesc2 = item.Desc2;
dto.Uom = item.BasicUom;
}
return dtos;
}
/// <summary>
///
/// </summary>
/// <param name="packingCode"></param>
/// <param name="itemCode"></param>
@ -317,20 +363,23 @@ public class BalanceAppService
/// <exception cref="NotImplementedException"></exception>
[HttpGet("item-status")]
[AllowAnonymous]
public virtual async Task<BalanceDTO> GetByItemLocationAndPackingAsync(string packingCode, string itemCode, string locationCode)
public virtual async Task<BalanceDTO> GetByItemLocationAndPackingAsync(string packingCode, string itemCode,
string locationCode)
{
var entity = await _repository.FirstOrDefaultAsync(c =>
c.PackingCode == packingCode && c.ItemCode == itemCode && c.LocationCode == locationCode).ConfigureAwait(false);
c.PackingCode == packingCode && c.ItemCode == itemCode && c.LocationCode == locationCode)
.ConfigureAwait(false);
if (entity == null)
{
throw new UserFriendlyException($"未找到箱码为 {packingCode},物料代码为 {itemCode},库位代码为 {locationCode} 的库存");
}
var dto = ObjectMapper.Map<Balance, BalanceDTO>(entity);
return dto;
}
/// <summary>
/// 获取对应的库存
/// 获取对应的库存
/// </summary>
/// <param name="packingCode"></param>
/// <param name="itemCode"></param>
@ -339,14 +388,17 @@ public class BalanceAppService
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
[HttpGet("item-loc-packing-status")]
public virtual async Task<BalanceDTO> GetByItemLocationPackingAndStatusAsync(string packingCode, string itemCode, string locationCode, EnumInventoryStatus status)
public virtual async Task<BalanceDTO> GetByItemLocationPackingAndStatusAsync(string packingCode, string itemCode,
string locationCode, EnumInventoryStatus status)
{
var entity = await _repository.FirstOrDefaultAsync(c =>
c.PackingCode == packingCode && c.ItemCode == itemCode && c.LocationCode == locationCode && c.Status == status).ConfigureAwait(false);
c.PackingCode == packingCode && c.ItemCode == itemCode && c.LocationCode == locationCode &&
c.Status == status).ConfigureAwait(false);
if (entity == null)
{
throw new UserFriendlyException($"未找到箱码为 {packingCode},物料代码为 {itemCode},库位代码为 {locationCode} 的库存");
}
var dto = ObjectMapper.Map<Balance, BalanceDTO>(entity);
return dto;
}
@ -407,14 +459,16 @@ public class BalanceAppService
&& p.Status == status).ConfigureAwait(false);
if (entity == null)
{
throw new UserFriendlyException($"未找到箱码为 {packingCode},物料代码为 {itemCode},库位代码为 {locationCode},状态为为 {status} 的库存");
throw new UserFriendlyException(
$"未找到箱码为 {packingCode},物料代码为 {itemCode},库位代码为 {locationCode},状态为为 {status} 的库存");
}
var dto = ObjectMapper.Map<Balance, BalanceDTO>(entity);
return dto;
}
/// <summary>
/// 查找可用物品的库存(此物品库存状态为合格)
/// 查找可用物品的库存(此物品库存状态为合格)
/// </summary>
/// <param name="itemCode"></param>
/// <returns></returns>
@ -436,35 +490,39 @@ public class BalanceAppService
}
/// <summary>
/// 获取【库存】根据 库位代码 和 物品代码
/// 获取【库存】根据 库位代码 和 物品代码
/// </summary>
/// <param name="locationCode"></param>
/// <param name="itemCode"></param>
/// <returns></returns>
[HttpGet("list/by-location-and-item")]
public virtual async Task<List<BalanceDTO>> GetListByLocationCodeAndItemCodeAsync(string locationCode, string itemCode)
public virtual async Task<List<BalanceDTO>> GetListByLocationCodeAndItemCodeAsync(string locationCode,
string itemCode)
{
var entitys = await _repository.GetListAsync(p => p.LocationCode == locationCode && p.ItemCode == itemCode).ConfigureAwait(false);
var entitys = await _repository.GetListAsync(p => p.LocationCode == locationCode && p.ItemCode == itemCode)
.ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<Balance>, List<BalanceDTO>>(entitys);
return dtos;
}
/// <summary>
/// 获取【库存】根据 库位代码 和 物品代码
/// 获取【库存】根据 库位代码 和 物品代码
/// </summary>
/// <param name="erplocationCode"></param>
/// <param name="itemCode"></param>
/// <returns></returns>
[HttpGet("list/by-erplocation-and-item")]
public virtual async Task<List<BalanceDTO>> GetListByErpLocationCodeAndItemCodeAsync(string erplocationCode, string itemCode)
public virtual async Task<List<BalanceDTO>> GetListByErpLocationCodeAndItemCodeAsync(string erplocationCode,
string itemCode)
{
var entitys = await _repository.GetListAsync(p => p.LocationErpCode == erplocationCode && p.ItemCode == itemCode).ConfigureAwait(false);
var entitys = await _repository
.GetListAsync(p => p.LocationErpCode == erplocationCode && p.ItemCode == itemCode).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<Balance>, List<BalanceDTO>>(entitys);
return dtos;
}
/// <summary>
/// 根据发料任务需求,算出推荐的库存 (在获取时 已经添加预占用)
/// 根据发料任务需求,算出推荐的库存 (在获取时 已经去除了预占用)
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
@ -480,7 +538,9 @@ public class BalanceAppService
var statuses = input.Statuses;
Logger.LogDebug(traceId + "|Input:" + input);
var balances = await _balanceManager.GetRecommendBalancesAsync(traceId, itemCode, qty, locationTypes, locationAreas, statuses).ConfigureAwait(false);
var balances = await _balanceManager
.GetRecommendBalancesAsync(traceId, itemCode, qty, locationTypes, locationAreas, statuses)
.ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<Balance>, List<BalanceDTO>>(balances);
@ -488,7 +548,7 @@ public class BalanceAppService
}
/// <summary>
/// 根据发料任务需求的库位,算出推荐的库存 (在获取时 已经添加预占用)
/// 根据发料任务需求的库位,算出推荐的库存 (在获取时 已经去除了预占用)
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
@ -506,21 +566,26 @@ public class BalanceAppService
var locationDto = await _locationAclService.GetByCodeAsync(location).ConfigureAwait(false);
if (locationDto != null)
{
if(input.LocationAreas==null)
if (input.LocationAreas == null)
{
input.LocationAreas = new List<string>();
}
input.LocationAreas.Add(locationDto.AreaCode);
if (input.LocationTypes == null)
{
input.LocationTypes = new List<EnumLocationType>();
}
input.LocationTypes.Add(locationDto.Type);
}
}
Logger.LogDebug(traceId + "|Input:" + input);
var balances = await _balanceManager.GetRecommendBalancesByLocationAsync(traceId, itemCode, qty, locations, statuses, input.IsPackingCode).ConfigureAwait(false);
var balances = await _balanceManager
.GetRecommendBalancesByLocationAsync(traceId, itemCode, qty, locations, statuses, input.IsPackingCode)
.ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<Balance>, List<BalanceDTO>>(balances);
@ -528,7 +593,24 @@ public class BalanceAppService
}
/// <summary>
/// pda发料执行查询使用
/// 获取可用库存列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
[HttpGet("usable-list")]
public virtual async Task<List<BalanceDTO>> GetUsableListAsync(RecommendBalanceRequestInput input)
{
var inventoryBalances = await _balanceManager
.GetUsableListAsync(input.ItemCode, input.Locations, input.Statuses, true).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<Balance>, List<BalanceDTO>>(inventoryBalances);
return dtos;
}
/// <summary>
/// pda发料执行查询使用
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
@ -539,7 +621,8 @@ public class BalanceAppService
//可以领料
if (input.IsEnablePick != null)
{
var locations = await _locationAclService.GetListByEnablePickAsync((bool)input.IsEnablePick).ConfigureAwait(false);
var locations = await _locationAclService.GetListByEnablePickAsync((bool)input.IsEnablePick)
.ConfigureAwait(false);
var codes = JsonSerializer.Serialize(locations.Select(c => c.Code));
input.Condition.Filters.Add(new Filter("LocationCode", codes, "In"));
}
@ -552,48 +635,51 @@ public class BalanceAppService
input.Condition.Filters.Add(new Filter("LocationCode", codes, "In"));
}
var dtos = await GetPagedListByFilterAsync(input, false).ConfigureAwait(false);
var dtos = await GetPagedListByFilterAsync(input).ConfigureAwait(false);
return dtos;
}
/// <summary>
/// 查询库存余额 根据 状态集合 库位类别集合 物品代码 箱码 托码 批次 库位
/// 查询库存余额 根据 状态集合 库位类别集合 物品代码 箱码 托码 批次 库位
/// </summary>
/// <param name="balanceManyParameterRequestInput"></param>
/// <returns></returns>
[HttpPost("get-by-item-location-packing-container-lot-locationtype-status")]
public virtual async Task<List<BalanceDTO>> GetListByManyParameter(BalanceManyParameterRequestInput balanceManyParameterRequestInput)
public virtual async Task<List<BalanceDTO>> GetListByManyParameter(
BalanceManyParameterRequestInput balanceManyParameterRequestInput)
{
var input = new SfsInventoryRequestInputBase()
var input = new SfsInventoryRequestInputBase
{
MaxResultCount = 1000,
SkipCount = 0,
Sorting = string.Empty,
Condition = new Condition()
{
Filters = new List<Filter>()
}
Condition = new Condition { Filters = new List<Filter>() }
};
if (!string.IsNullOrWhiteSpace(balanceManyParameterRequestInput.ItemCode))
{
input.Condition.Filters.Add(new Filter("ItemCode", balanceManyParameterRequestInput.ItemCode));
}
if (!string.IsNullOrWhiteSpace(balanceManyParameterRequestInput.LocationCode))
{
input.Condition.Filters.Add(new Filter("LocationCode", balanceManyParameterRequestInput.LocationCode));
}
if (!string.IsNullOrWhiteSpace(balanceManyParameterRequestInput.PackingCode))
{
input.Condition.Filters.Add(new Filter("PackingCode", balanceManyParameterRequestInput.PackingCode));
}
if (!string.IsNullOrWhiteSpace(balanceManyParameterRequestInput.ContainerCode))
{
input.Condition.Filters.Add(new Filter("ContainerCode", balanceManyParameterRequestInput.ContainerCode));
}
if (!string.IsNullOrWhiteSpace(balanceManyParameterRequestInput.Lot))
{
input.Condition.Filters.Add(new Filter("Lot", balanceManyParameterRequestInput.Lot));
}
//筛选库存状态
if (balanceManyParameterRequestInput.InventoryStatuses.Count > 0)
{
@ -601,6 +687,7 @@ public class BalanceAppService
balanceManyParameterRequestInput.InventoryStatuses);
input.Condition.Filters.Add(new Filter("Status", Statuses, "In"));
}
//筛选库位类型
if (balanceManyParameterRequestInput.LocationTypes.Count > 0)
{
@ -617,91 +704,115 @@ public class BalanceAppService
}
/// <summary>
/// 查询库存余额 根据 物品 库位 库位类型 库存状态 批次
/// 查询库存余额 根据 物品 库位 库位类型 库存状态 批次
/// </summary>
/// <param name="listInput"></param>
/// <returns></returns>
[HttpPost("by-balances-request-many-parameter")]
public async Task<PagedResultDto<BalanceDTO>> GetListByLocationTypeAndInventoryStatusAsync(BalanceListByIssueInputByInventoryStatusAndLocationType listInput)
public async Task<PagedResultDto<BalanceDTO>> GetListByLocationTypeAndInventoryStatusAsync(
BalanceListByIssueInputByInventoryStatusAndLocationType listInput)
{
var input = new SfsInventoryRequestInputBase()
var input = new SfsInventoryRequestInputBase
{
MaxResultCount = listInput.pageSize,
SkipCount = (listInput.pageIndex - 1) * listInput.pageSize,
Sorting = listInput.sortBy,
Condition = new Condition()
{
Filters = new List<Filter>()
}
Condition = new Condition { Filters = new List<Filter>() }
};
if (!string.IsNullOrWhiteSpace(listInput.itemCode))
{
input.Condition.Filters.Add(new Filter("ItemCode", listInput.itemCode));
}
if (!string.IsNullOrWhiteSpace(listInput.locationCode))
{
input.Condition.Filters.Add(new Filter("LocationCode", listInput.locationCode));
}
if (!string.IsNullOrWhiteSpace(listInput.lot))
{
input.Condition.Filters.Add(new Filter("Lot", listInput.lot));
}
if (!string.IsNullOrWhiteSpace(listInput.packingCode))
{
input.Condition.Filters.Add(new Filter("PackingCode", listInput.packingCode));
}
if (!string.IsNullOrWhiteSpace(listInput.containerCode))
{
input.Condition.Filters.Add(new Filter("ContainerCode", listInput.containerCode));
}
if (listInput.locationTypes != null && listInput.locationTypes.Any())
{
var locationCodes = (await _locationAclService.GetListByTypesAsync(listInput.locationTypes).ConfigureAwait(false)).Select(t => t.Code).ToList();
var locationCodes =
(await _locationAclService.GetListByTypesAsync(listInput.locationTypes).ConfigureAwait(false))
.Select(t => t.Code).ToList();
if (locationCodes.Any())
{
input.Condition.Filters.Add(new Filter("LocationCode", JsonSerializer.Serialize(locationCodes), "In"));
}
}
if (listInput.inventoryStatuses != null && listInput.inventoryStatuses.Any())
{
input.Condition.Filters.Add(new Filter("Status", JsonSerializer.Serialize(listInput.inventoryStatuses), "In"));
input.Condition.Filters.Add(new Filter("Status", JsonSerializer.Serialize(listInput.inventoryStatuses),
"In"));
}
var balanceDTOs = await GetPagedListByFilterAsync(input, false).ConfigureAwait(false);
var balanceDTOs = await GetPagedListByFilterAsync(input).ConfigureAwait(false);
return balanceDTOs;
}
/// <summary>
/// 获取 隔离库位 不合格 库存
/// 获取 隔离库位 不合格 库存
/// </summary>
/// <param name="sfsRequestDTO"></param>
/// <param name="includeDetails"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
[HttpPost("by-hold-location-code-and-no-ok")]
public async Task<PagedResultDto<BalanceDTO>> GetByHoldLocationCodeAndNoOkAsync(SfsInventoryRequestInputBase sfsRequestDTO, bool includeDetails = false,
public async Task<PagedResultDto<BalanceDTO>> GetByHoldLocationCodeAndNoOkAsync(
SfsInventoryRequestInputBase sfsRequestDTO, bool includeDetails = false,
CancellationToken cancellationToken = default)
{
var locationInfo = await _locationAclService.GetFirstByTypeAsync(EnumLocationType.HOLD).ConfigureAwait(false);
sfsRequestDTO.Condition.Filters.Add(new Sfs.Shared.Domain.Filter() { Action = "==", Column = "LocationCode", Logic = EnumFilterLogic.And.ToString(), Value = locationInfo.Code });
sfsRequestDTO.Condition.Filters.Add(new Sfs.Shared.Domain.Filter() { Action = "==", Column = "Status", Logic = EnumFilterLogic.And.ToString(), Value = ((int)EnumInventoryStatus.NOK).ToString(), });
sfsRequestDTO.Condition.Filters.Add(new Filter
{
Action = "==",
Column = "LocationCode",
Logic = EnumFilterLogic.And.ToString(),
Value = locationInfo.Code
});
sfsRequestDTO.Condition.Filters.Add(new Filter
{
Action = "==",
Column = "Status",
Logic = EnumFilterLogic.And.ToString(),
Value = ((int)EnumInventoryStatus.NOK).ToString()
});
Expression<Func<Balance, bool>> expression = sfsRequestDTO.Condition.Filters?.Count > 0
var expression = sfsRequestDTO.Condition.Filters?.Count > 0
? sfsRequestDTO.Condition.Filters.ToLambda<Balance>()
: p => true;
return await GetPagedListAsync(expression, sfsRequestDTO.SkipCount, sfsRequestDTO.MaxResultCount, sfsRequestDTO.Sorting, includeDetails, cancellationToken).ConfigureAwait(false);
return await GetPagedListAsync(expression, sfsRequestDTO.SkipCount, sfsRequestDTO.MaxResultCount,
sfsRequestDTO.Sorting, includeDetails, cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// 获取 【实际库存余额】(不包含预计入,抛出预计出)
/// 获取 【实际库存余额】(不包含预计入,抛出预计出)
/// </summary>
/// <returns></returns>
[HttpPost("get-real-qty-by-packing-and-item-and-location-and-status")]
public async Task<BalanceDTO> GetRealQtyByPackingCodeAndItemCodeAndLocationCodeAndStatusAsync(string packingCode, string itemCode, string locationCode, EnumInventoryStatus status)
public async Task<BalanceDTO> GetRealQtyByPackingCodeAndItemCodeAndLocationCodeAndStatusAsync(string packingCode,
string itemCode, string locationCode, EnumInventoryStatus status)
{
var entity = await _repository.FirstOrDefaultAsync(c =>
c.PackingCode == packingCode && c.ItemCode == itemCode && c.LocationCode == locationCode && c.Status == status).ConfigureAwait(false);
c.PackingCode == packingCode && c.ItemCode == itemCode && c.LocationCode == locationCode &&
c.Status == status).ConfigureAwait(false);
if (entity == null)
{
throw new UserFriendlyException($"未找到箱码为 {packingCode},物料代码为 {itemCode},库位代码为 {locationCode} 的库存");
@ -714,7 +825,8 @@ public class BalanceAppService
}
[HttpGet("list-by-location-status")]
public async Task<List<BalanceDTO>> GetListByLocationCodeAndStatusAsync(string locationCode, EnumInventoryStatus status)
public async Task<List<BalanceDTO>> GetListByLocationCodeAndStatusAsync(string locationCode,
EnumInventoryStatus status)
{
var entities = await _repository.GetListAsync(
c => c.LocationCode == locationCode && c.Status == status
@ -728,17 +840,18 @@ public class BalanceAppService
#endregion Get
#region export
/// <summary>
/// 导出数据
/// 导出数据
/// </summary>
[HttpPost("export")]
public override async Task<IActionResult> ExportAsync(SfsInventoryRequestInputBase input)
{
var expression = input.Condition.Filters?.Count > 0
? input.Condition.Filters.ToLambda<Balance>()
: p => true;
? input.Condition.Filters.ToLambda<Balance>()
: p => true;
var entities = await _repository.GetPagedListAsync(expression, input.SkipCount, input.MaxResultCount,
input.Sorting, true).ConfigureAwait(false);
input.Sorting, true).ConfigureAwait(false);
var list = ObjectMapper.Map<List<Balance>, List<BalanceDTO>>(entities);
//var hasDetails = typeof(TEntity) is SfsMasterAggregateRootBase<TDetail> detailEntity;
@ -760,47 +873,6 @@ public class BalanceAppService
return ExportImportService.Export(list, detailsProptyName: hasDetails ? nameof(EmptyDetail) : null);
}
#endregion
/// <summary>
/// 库存余额更新物品基础信息
/// </summary>
[HttpPost("update/item-basic-info")]
public async Task UpdateItemBasicInfoAsync(BalanceUpdateItemBasicInfoDto balanceUpdateItemBasicInfoDto)
{
//停用,可能用其他处理方案
return;
// 物品编码
var itemCodes = balanceUpdateItemBasicInfoDto.BalanceUpdateItemBasicInfos?.Select(c => c.ItemCode);
itemCodes = itemCodes?.Where(t => string.IsNullOrWhiteSpace(t) == false);
if (itemCodes == null || itemCodes.Any() == false)
{
return;
}
// 获取库存余额
var entitys = await _repository.GetListAsync(p =>
itemCodes.Contains(p.ItemCode)).ConfigureAwait(false);
if (entitys.Count <= 0)
{
return;
}
// 库存余额更新物品基础信息
var entitysGroup = entitys.GroupBy(t => t.ItemCode);
foreach (var entity in entitysGroup)
{
var balanceUpdateItemBasicInfo = balanceUpdateItemBasicInfoDto.BalanceUpdateItemBasicInfos.FirstOrDefault(t => t.ItemCode == entity.Key);
foreach (var item in entity)
{
item.ItemName = balanceUpdateItemBasicInfo.ItemName ?? item.ItemName;
item.ItemDesc1 = balanceUpdateItemBasicInfo.ItemDesc1 ?? item.ItemDesc1;
item.ItemDesc2 = balanceUpdateItemBasicInfo.ItemDesc2 ?? item.ItemDesc2;
}
}
await _repository.UpdateManyAsync(entitys).ConfigureAwait(false);
}
#endregion
}

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

@ -459,15 +459,13 @@ public class BalanceManager : DomainService, IBalanceManager
#region GetRecommendList
/// <summary>
/// 根据库位获取推荐库位
/// </summary>
/// <param name="traceId"></param>
/// <param name="itemCode"></param>
/// <param name="requestQty"></param>
/// <param name="validLocationTypes"></param>
/// <param name="validLocationAreas"></param>
/// <param name="validLocations"></param>
/// <param name="validStatuses"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
@ -770,6 +768,109 @@ public class BalanceManager : DomainService, IBalanceManager
#endregion
}
/// <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>> GetUsableListAsync(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)
&& 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();
return usableBalances;
}
private decimal GetRecommendQty(Guid traceId, decimal requestQty, decimal remainingQty, Balance usableBalance, LocationDTO location, ItemStoreRelationDTO itemStoreRelation)
{
var balanceQty = usableBalance.Qty;

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

@ -9,22 +9,23 @@ namespace Win_in.Sfs.Wms.Inventory.Domain;
public interface IBalanceManager : IDomainService
{
/// <summary>
/// 入库
/// 入库
/// </summary>
/// <param name="transaction"></param>
/// <returns></returns>
Task<Balance> InboundAsync(Transaction transaction, ItemBasicDTO item, LocationDTO location);
/// <summary>
/// 出库
/// 出库
/// </summary>
/// <param name="transaction"></param>
/// <returns></returns>
Task<Balance> OutboundAsync(Transaction transaction, ItemBasicDTO item, LocationDTO location);
Task<List<Balance>> GetRecommendBalancesAsync(Guid traceId, string itemCode, decimal requestQty,
List<EnumLocationType> validLocationTypes, List<string> validLocationAreas, List<EnumInventoryStatus> validStatuses);
List<EnumLocationType> validLocationTypes, List<string> validLocationAreas,
List<EnumInventoryStatus> validStatuses);
Task<List<Balance>> GetListByLocationAsync(string locationCode);
@ -32,6 +33,22 @@ public interface IBalanceManager : IDomainService
Task<List<Balance>> GetListByItemAndLocationAsync(string itemCode, string locationCode);
Task<List<string>> GetItemCodesOfLocationAsync(string locationCode);
Task<Balance> ModifyAsync(Balance balance);
Task<List<Balance>> GetListByLocationTypeAndInventoryStatusAsync(string itemCode, EnumInventoryStatus enumInventoryStatus, List<EnumLocationType> enumLocationTypes);
Task<List<Balance>> GetRecommendBalancesByLocationAsync(Guid traceId, string itemCode, decimal requestQty, List<string> validLocations, List<EnumInventoryStatus> validStatuses,bool ispackingcode);
Task<List<Balance>> GetListByLocationTypeAndInventoryStatusAsync(string itemCode,
EnumInventoryStatus enumInventoryStatus, List<EnumLocationType> enumLocationTypes);
Task<List<Balance>> GetRecommendBalancesByLocationAsync(Guid traceId, string itemCode, decimal requestQty,
List<string> validLocations, List<EnumInventoryStatus> validStatuses, bool ispackingcode);
/// <summary>
/// 获取可用库存列表
/// </summary>
/// <param name="itemCode"></param>
/// <param name="validLocations"></param>
/// <param name="validStatuses"></param>
/// <param name="isRemovePackingCode"></param>
/// <returns></returns>
Task<List<Balance>> GetUsableListAsync(string itemCode,
List<string> validLocations,
List<EnumInventoryStatus> validStatuses, bool isRemovePackingCode);
}

1
be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransType.cs

@ -97,6 +97,7 @@ public enum EnumTransType
[Display(Name = "新版库内转移")]
TransferLib = 68,
/// <summary>
/// 库间调拨

8
be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Job/EnumJobStatus.cs

@ -45,5 +45,11 @@ public enum EnumJobStatus
/// 作废
/// </summary>
[Display(Name = "作废")]
Cancelled = 9
Cancelled = 9,
/// <summary>
/// 等待
/// </summary>
[Display(Name = "等待")]
Wait=30,
}

4
be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumIssueType.cs

@ -12,10 +12,10 @@ public enum EnumIssueType
/// <summary>
/// 按箱 叫料
/// </summary>
Box=1,
BoxQty=1,
/// <summary>
/// 按数量 叫料
/// </summary>
Num=2,
Qty=2,
}

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/ExchangeDatas/IExchangeDataAppService.cs

@ -14,4 +14,5 @@ public interface IExchangeDataAppService
Task<List<ExchangeDataDTO>> GetToBeProcessedListPostAsync(int batchSize);
Task<List<ExchangeDataDTO>> GetToBeProcessedListOnlyReadAsync(int batchSize);
Task<List<ExchangeDataDTO>> UpdateStatusByIdListAsync(List<Guid> list);
Task<List<ExchangeDataDTO>> UpdateManyAsync(List<ExchangeDataDTO> dtos);
}

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

@ -42,5 +42,4 @@ public class InjectionJobDTO : SfsJobDTOBase<InjectionJobDetailDTO>
/// </summary>
[Display(Name = "使用在途库")]
public bool UseOnTheWayLocation { get; set; }
}

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/InjectionJobs/IInjectionJobAppService.cs

@ -8,7 +8,7 @@ namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public interface IInjectionJobAppService
: ISfsJobAppServiceBase<InjectionJobDTO, SfsJobRequestInputBase, InjectionJobCheckInput, InjectionJobEditInput>
{
Task<List<InjectionJobDTO>> CheckJobExistByItemCodeAndLocationCode(string itemCode, string locationCode);
Task<List<InjectionJobDTO>> CheckJobExistByItemCodeAndLocationCodeAsync(string itemCode, string locationCode);
Task CancelByMaterialRequestAsync(string injectionNumber);
@ -22,5 +22,4 @@ public interface IInjectionJobAppService
/// </summary>
/// <returns></returns>
Task<InjectionJobDTO> SaveDetail_SplitPackingAsync(SplitPacking_UpdateJobDetailInput input);
}

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

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Domain.Shared.Enums.Store;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;

12
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ThirdLocationJobs/DTOs/ThirdLocationJobDetailDTO.cs

@ -9,10 +9,16 @@ public class ThirdLocationJobDetailDTO : SfsJobRecommendFromDetailDTOBase, IHasT
{
/// <summary>
/// 请求库位
/// 来源库位
/// </summary>
[Display(Name = "请求库位")]
public string RequestLocationCode { get; set; }
[Display(Name = "来源库位")]
public string FromLocationCode { get; set; }
/// <summary>
/// 来源库区
/// </summary>
[Display(Name = "来源库区")]
public string FromLocationArea { get; set; }
/// <summary>
/// 到库位

14
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ThirdLocationJobs/Inputs/ThirdLocationJobDetailInput.cs

@ -9,12 +9,20 @@ public class ThirdLocationJobDetailInput : SfsJobRecommendFromDetailInputBase, I
{
/// <summary>
/// 请求库位
/// 来源库位
/// </summary>
[Display(Name = "请求库位")]
[Display(Name = "来源库位")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string RequestLocationCode { get; set; }
public string FromLocationCode { get; set; }
/// <summary>
/// 来源库区
/// </summary>
[Display(Name = "来源库位")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string FromLocationArea { get; set; }
/// <summary>
/// 到库位

5
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/DTOs/ThirdLocationRequestDTO.cs

@ -37,4 +37,9 @@ public class ThirdLocationRequestDTO : SfsStoreRequestDTOBase<ThirdLocationReque
/// </summary>
[Display(Name = "目标ERP储位")]
public string ToLocationErpCode { get; set; }
/// <summary>
/// 来源库区
/// </summary>
public string FromLocationArea { get; set; }
}

7
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/Inputs/ThirdLocationRequestDetailInput.cs

@ -14,6 +14,13 @@ public class ThirdLocationRequestDetailInput : SfsStoreDetailWithQtyInputBase
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string ToLocationCode { get; set; }
/// <summary>
/// 来源库位
/// </summary>
[Display(Name = "来源库位")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string FromLocationCode { get; set; }
/// <summary>
/// 来源库区
/// </summary>

9
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/Inputs/ThirdLocationRequestImportInput.cs

@ -31,10 +31,17 @@ public class ThirdLocationRequestImportInput : SfsStoreImportInputBase
[Required]
public string ToLocationCode { get; set; }
/// <summary>
/// 来源库位
/// </summary>
[Display(Name = "来源库位")]
[Required]
public string FromLocationCode { get; set; }
/// <summary>
/// 来源库区
/// </summary>
[Display(Name = "调出库区")]
[Display(Name = "来源库区")]
[Required]
public string FromLocationArea { get; set; }

14
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/ExchangeDatas/ExchangeDataAppService.cs

@ -142,4 +142,18 @@ public class ExchangeDataAppService
var dtos = ObjectMapper.Map<List<ExchangeData>, List<ExchangeDataDTO>>(resultList);
return dtos;
}
[HttpPost("update-many")]
public virtual async Task<List<ExchangeDataDTO>> UpdateManyAsync(List<ExchangeDataDTO> dtos)
{
var list = ObjectMapper.Map<List<ExchangeDataDTO>, List<ExchangeData>>(dtos);
list.ForEach(p =>
{
p.Status = EnumExchangeDataStatus.Success;
p.ReadTime = Clock.Now;
p.Reader = "DataExchange.Agent";
});
await _repository.UpdateManyAsync(list).ConfigureAwait(false);
return dtos;
}
}

28
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionJobs/InjectionJobAppService.cs

@ -15,6 +15,7 @@ using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared;
using Win_in.Sfs.Wms.Store.Notes;
namespace Win_in.Sfs.Wms.Store.Application;
@ -22,7 +23,7 @@ namespace Win_in.Sfs.Wms.Store.Application;
[Route($"{StoreConsts.RootPath}injection-job")]
public class InjectionJobAppService
: SfsJobAppServiceBase<InjectionJob, InjectionJobDetail, InjectionJobDTO, SfsJobRequestInputBase, InjectionJobCheckInput, InjectionJobEditInput>,
IInjectionJobAppService
IInjectionJobAppService,ITransferLibCallback
{
private readonly IInjectionJobManager _injectionJobManager;
@ -33,6 +34,16 @@ public class InjectionJobAppService
_injectionJobManager = injectionJobManager;
}
public override Task<List<InjectionJobDTO>> CreateManyAsync(List<InjectionJobEditInput> inputs)
{
return base.CreateManyAsync(inputs);
}
public override Task<InjectionJobDTO> CreateAsync(InjectionJobEditInput input)
{
return base.CreateAsync(input);
}
/// <summary>
/// 根据物品和库位 检查是否存在发料任务
/// </summary>
@ -42,7 +53,7 @@ public class InjectionJobAppService
/// <exception cref="NotImplementedException"></exception>
[Authorize]
[HttpGet("check-job-exist")]
public virtual async Task<List<InjectionJobDTO>> CheckJobExistByItemCodeAndLocationCode(string itemCode,
public virtual async Task<List<InjectionJobDTO>> CheckJobExistByItemCodeAndLocationCodeAsync(string itemCode,
string locationCode)
{
var entities = await _repository.GetListAsync(c =>
@ -141,4 +152,17 @@ public class InjectionJobAppService
var ret = ObjectMapper.Map<InjectionJob, InjectionJobDTO>(entity);
return ret;
}
[HttpPost("Do-Call-Back")]
public Tuple<bool?, string> DoTransferLibCallback(string businessType, string requestNum, string jobNum)
{
throw new NotImplementedException();
}
[HttpPost("test")]
public virtual async Task Test()
{
Console.WriteLine("FuAZCZXVZXVXZVZ");
await Task.CompletedTask;
}
}

12
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs

@ -3,6 +3,7 @@ using System.Reflection;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
@ -18,10 +19,12 @@ public class TransferLibJobAppService
: SfsJobAppServiceBase<TransferLibJob, TransferLibJobDetail, TransferLibJobDTO, SfsJobRequestInputBase, TransferLibJobCheckInput, TransferLibJobEditInput>,
ITransferLibJobAppService
{
private readonly IServiceProvider _serviceProvider;
public TransferLibJobAppService(
ITransferLibJobRepository repository, ITransferLibJobManager TransferLibJobManager
) : base(repository, TransferLibJobManager)
ITransferLibJobRepository repository, ITransferLibJobManager TransferLibJobManager, IServiceProvider serviceProvider) : base(repository, TransferLibJobManager)
{
_serviceProvider = serviceProvider;
}
/// <summary>
@ -32,6 +35,11 @@ public class TransferLibJobAppService
/// <returns></returns>
public override async Task<TransferLibJobDTO> CompleteAsync(Guid id, TransferLibJobDTO dto)
{
var str = "Win_in.Sfs.Wms.Store.Application.InjectionJobAppService";
var implementation=_serviceProvider.GetService(Type.GetType("Win_in.Sfs.Wms.Store.Application.InjectionJobAppService"));
MethodInfo methodInfo=implementation.GetType().GetMethod("Test");
methodInfo.Invoke(implementation, null);
string methodPrefix = "TransferLibJobAppService.CompleteAsync - ";
if (dto.CallServerName.IsNullOrEmpty())

13
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAppService.cs

@ -17,6 +17,7 @@ using Win_in.Sfs.Wms.Store.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Application;
using System.Linq;
using Win_in.Sfs.Basedata.Application.Contracts;
[Authorize]
[Route($"{StoreConsts.RootPath}putaway-note")]
@ -29,18 +30,21 @@ public class PutawayNoteAppService :
private readonly IPurchaseReceiptNoteAppService _purchaseReceiptNoteAppService;
public readonly IInspectJobAppService _inspectJobAppService;
public readonly IPurchaseOrderManager _purchaseOrderManager;
public readonly IPurchasePriceSheetAppService _purchasePriceSheetAppService;
public PutawayNoteAppService(
IPutawayNoteRepository repository,
IPutawayNoteManager putawayNoteManager,
IPurchaseReceiptNoteAppService purchaseReceiptNoteAppService,
IInspectJobAppService inspectJobAppService,
IPurchaseOrderManager purchaseOrderManager) : base(repository)
IPurchaseOrderManager purchaseOrderManager,
IPurchasePriceSheetAppService purchasePriceSheetAppService ) : base(repository)
{
_putawayNoteManager = putawayNoteManager;
_purchaseReceiptNoteAppService = purchaseReceiptNoteAppService;
_inspectJobAppService = inspectJobAppService;
_purchaseOrderManager = purchaseOrderManager;
_purchasePriceSheetAppService = purchasePriceSheetAppService;
}
/// <summary>
@ -59,7 +63,12 @@ public class PutawayNoteAppService :
var isClosed = await _purchaseOrderManager.CheckIsCloseAsync(input.Number,input.SupplierCode, detail.ItemCode).ConfigureAwait(false);
if (isClosed)
{
throw new UserFriendlyException($"零件名称【{detail.ItemCode}】的订单明细行以关闭无法执行采购上价!");
throw new UserFriendlyException($"零件名称【{detail.ItemCode}】的订单明细行以关闭无法执行采购上架!");
}
var isprice = await _purchasePriceSheetAppService.CheckPurPriceAsync(input.SupplierCode, detail.ItemCode).ConfigureAwait(false);
if (isprice)
{
throw new UserFriendlyException($"供应商【{input.SupplierCode}】零件名称【{detail.ItemCode}】无采购价格无法执行采购上架!");
}
var purchasereDetail = await _purchaseReceiptNoteAppService
.GetDetailByItemAndPackingAsync(detail.ItemCode, detail.ToPackingCode).ConfigureAwait(false);

28
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs

@ -28,17 +28,20 @@ public class PurchaseOrderAppService :
private readonly IPurchaseOrderManager _purchaseOrderManager;
private readonly ISupplierAppService _supplierAppService;
private readonly IItemBasicAppService _itemBasicAppService;
private readonly ILocationAppService _locationAppService;
public PurchaseOrderAppService(
IPurchaseOrderRepository repository,
IPurchaseOrderManager purchaseOrderManager,
ISupplierAppService supplierAppService,
IItemBasicAppService itemBasicAppService) : base(repository)
IItemBasicAppService itemBasicAppService
, ILocationAppService locationAppService) : base(repository)
{
_repository = repository;
_purchaseOrderManager = purchaseOrderManager;
_supplierAppService = supplierAppService;
_itemBasicAppService = itemBasicAppService;
_locationAppService = locationAppService;
base.CreatePolicyName = PurchaseOrderPermissions.Create;
base.UpdatePolicyName = PurchaseOrderPermissions.Update;
base.DeletePolicyName = PurchaseOrderPermissions.Delete;
@ -56,6 +59,15 @@ public class PurchaseOrderAppService :
{
var ImportData = dictionary.Select(p => p.Key);
#region 校验ERP库位是否存在
var allTempErpLocationCode = ImportData.Select(p => p.Details.Select(p => p.LocationErpCode).ToList()).ToList();
var allErpLocationCode = new List<string>();
allTempErpLocationCode.ForEach(p => { allErpLocationCode.AddRange(p); });
var erpLocations = await CheckErpLocationCodeAsync(allErpLocationCode).ConfigureAwait(false);
#endregion
var supplierDtos = new List<SupplierDTO>();
#region 校验供应商
@ -190,7 +202,21 @@ public class PurchaseOrderAppService :
return result;
}
private async Task<List<LocationDTO>> CheckErpLocationCodeAsync(List<string> erpLocationCodes)
{
erpLocationCodes = erpLocationCodes.Distinct().ToList();
var result = await _locationAppService.GetListByErpLocationCodes(erpLocationCodes).ConfigureAwait(false);
var resultcode = result.Select(r => r.ErpLocationCode).Distinct();
foreach (var code in erpLocationCodes)
{
if (resultcode.All(p => p != code))
{
throw new UserFriendlyException($"ERP储位代码【{code}】不存在");
}
}
return result;
}
#endregion

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

@ -86,7 +86,7 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase<Thir
{
if (item.Qty <= 0)
{
throw new UserFriendlyException($"{item.ItemCode} 物的需求量必须大于0");
throw new UserFriendlyException($"{item.ItemCode} 物的需求量必须大于0");
}
}
@ -94,6 +94,7 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase<Thir
{
var toLocationDto = await _locationAppService.GetByCodeAsync(detailInput.ToLocationCode).ConfigureAwait(false);
CheckLocation(toLocationDto, detailInput.ToLocationCode);
var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detailInput.ItemCode).ConfigureAwait(false);
CheckItemBasic(itemBasicDto, detailInput.ItemCode);
@ -101,12 +102,7 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase<Thir
detailInput.ToLocationErpCode = toLocationDto.ErpLocationCode;
}
//input.AutoSubmit = true;
//input.AutoAgree = true;
//input.AutoHandle = true;
//input.AutoCompleteJob = false;
//input.DirectCreateNote = false;
await SetRequestAutoPropertiesAsync(input).ConfigureAwait(false);
@ -333,9 +329,9 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase<Thir
throw new UserFriendlyException($"库位代码为【{LocationCode}】不存在");
}
if (LocationDto.Type != EnumLocationType.WIP)
if (LocationDto.Type != EnumLocationType.THIRDPARTY)
{
throw new UserFriendlyException($"库位代码【{LocationCode}】不是【{EnumLocationType.WIP.GetDisplayName()}】类型");
throw new UserFriendlyException($"库位代码【{LocationCode}】不是【{EnumLocationType.THIRDPARTY.GetDisplayName()}】类型");
}
}

12
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/ExchangeDatas/ExchangeDataManager.cs

@ -43,14 +43,14 @@ public class ExchangeDataManager : DomainService, IExchangeDataManager
.Take(batchSize)
.ToListAsync().ConfigureAwait(false);
foreach (var entity in entities)
{
//foreach (var entity in entities)
//{
entity.Status = EnumExchangeDataStatus.Success;
entity.ReadTime = Clock.Now;
entity.Reader = "DataExchange.Agent";
// entity.Status = EnumExchangeDataStatus.Success;
// entity.ReadTime = Clock.Now;
// entity.Reader = "DataExchange.Agent";
}
//}
return entities;
}

9
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ThirdLocationJobs/ThirdLocationJobDetail.cs

@ -7,9 +7,14 @@ namespace Win_in.Sfs.Wms.Store.Domain;
public class ThirdLocationJobDetail : SfsJobRecommendFromDetailEntityBase, IHasToLocation
{
/// <summary>
/// 请求库位
/// 来源库位
/// </summary>
public string RequestLocationCode { get; set; }
public string FromLocationCode { get; set; }
/// <summary>
/// 来源库区
/// </summary>
public string FromLocationArea { get; set; }
/// <summary>
/// 到库位

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ThirdLocationNotes/ThirdLocationNoteDetail.cs

@ -7,7 +7,7 @@ public class ThirdLocationNoteDetail : SfsStoreRecommendFromDetailWithFromToEnti
{
/// <summary>
/// 发时间
/// 发时间
/// </summary>
public DateTime IssueTime { get; set; }

4
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestManager.cs

@ -34,7 +34,7 @@ public class InjectionRequestManager
/// <param name="entity"></param>
/// <returns></returns>
public virtual async Task<InjectionRequest> CreateByNumberAsync(InjectionRequest entity)
{
{
var number = string.IsNullOrEmpty(entity.Number)
? await GenerateNumberAsync(nameof(InjectionRequest), entity.ActiveDate).ConfigureAwait(false)
: entity.Number;
@ -42,7 +42,7 @@ public class InjectionRequestManager
entity.Submit();
entity.Agree();
entity.RequestStatus = EnumRequestStatus.Partial;
await LocalEventBus.PublishAsync(new SfsHandledEntityEventData<InjectionRequest>(entity), false)
await LocalEventBus.PublishAsync(new SfsHandledEntityEventData<InjectionRequest>(entity),false)
.ConfigureAwait(false);
await _repository.InsertAsync(entity).ConfigureAwait(false);
return entity;

7
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ThirdLocationRequests/ThirdLocationRequestDetail.cs

@ -35,10 +35,17 @@ public class ThirdLocationRequestDetail : SfsStoreDetailWithQtyEntityBase, IHasT
/// </summary>
public string ToWarehouseCode { get; set; }
/// <summary>
/// 来源库位
/// </summary>
public string FromLocationCode { get; set; }
/// <summary>
/// 来源库区
/// </summary>
public string FromLocationArea { get; set; }
// /// <summary>
// /// 在途库库位

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/ThirdLocationJobs/ThirdLocationJobDbContextModelCreatingExtensions.cs

@ -48,7 +48,8 @@ public static class ThirdLocationJobDbContextModelCreatingExtensions
b.Property(q => q.ToWarehouseCode).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ToLocationArea).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ToLocationGroup).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.RequestLocationCode).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.FromLocationCode).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.FromLocationArea).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.WorkStation).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.Operation).HasMaxLength(SfsPropertyConst.CodeLength);

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/ThirdLocationRequests/ThirdLocationRequestDbContextModelCreatingExtensions.cs

@ -46,6 +46,8 @@ public static class ThirdLocationRequestDbContextModelCreatingExtensions
b.Property(q => q.ToWarehouseCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ToLocationArea).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ToLocationGroup).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.FromLocationCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.FromLocationArea).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ExpiredTime).IsRequired();
b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.WorkStation).HasMaxLength(SfsPropertyConst.CodeLength);

7
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/ThirdLocationRequestAutoMapperProfile.cs

@ -35,7 +35,7 @@ public partial class StoreEventAutoMapperProfile : Profile
;
CreateMap<ThirdLocationRequestDetail, ThirdLocationJobDetailInput>()
.ForMember(x => x.RequestLocationCode, y => y.MapFrom(d => d.ToLocationCode))
.ForMember(x => x.FromLocationCode, y => y.MapFrom(d => d.FromLocationCode))
.Ignore(x => x.RecommendFromLocationArea)
.Ignore(x => x.RecommendFromLocationGroup)
.Ignore(x => x.HandledFromLocationArea)
@ -99,7 +99,7 @@ public partial class StoreEventAutoMapperProfile : Profile
.Ignore(x => x.ToLocationArea)
.Ignore(x => x.ToLocationGroup)
.Ignore(x => x.HandledFromWarehouseCode)
.Ignore(x => x.RequestLocationCode)
.Ignore(x => x.FromLocationCode)
.Ignore(x => x.ToLocationCode)
.Ignore(x => x.ProdLine)
.Ignore(x => x.WorkStation)
@ -123,12 +123,13 @@ public partial class StoreEventAutoMapperProfile : Profile
.Ignore(x => x.PlanBeginTime)
.Ignore(x => x.PlannedSplitRule)
.Ignore(x => x.DeliveryQty)
.Ignore(x => x.RequestLocationCode)
.Ignore(x => x.FromLocationCode)
.Ignore(x => x.ToLocationCode)
.Ignore(x => x.ProdLine)
.Ignore(x => x.WorkStation)
.Ignore(x => x.PositionCode)
.Ignore(x => x.RecommendType)
.Ignore(x => x.FromLocationArea)
.IgnoreIHasRecommendAndHandledFrom();
}

216
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/InjectionJobEventHandler.cs

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@ -6,7 +5,9 @@ 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.Domain.Shared.Enums.Store;
using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared;
@ -16,16 +17,26 @@ namespace Win_in.Sfs.Wms.Store.Event.BusinessJob;
public class InjectionJobEventHandler :
StoreEventHandlerBase
, ILocalEventHandler<SfsCompletedEntityEventData<InjectionJob>>
, ILocalEventHandler<SfsCreatedEntityEventData<InjectionJob>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<InjectionJob>>>
{
private const EnumTransType TransType = EnumTransType.Issue;
private readonly IInjectionNoteAppService _injectionNoteAppService;
private readonly IBalanceAppService _balanceAppService;
private readonly IExpectOutAppService _expectOutAppService;
private readonly ILocationAppService _locationAppService;
private readonly ITransferLibRequestAppService _transferLibRequestAppService;
public InjectionJobEventHandler(IInjectionNoteAppService injectionNoteAppService, ILocationAppService locationAppService)
public InjectionJobEventHandler(IInjectionNoteAppService injectionNoteAppService,
IBalanceAppService balanceAppService, IExpectOutAppService expectOutAppService,
ILocationAppService locationAppService, ITransferLibRequestAppService transferLibRequestAppService)
{
_injectionNoteAppService = injectionNoteAppService;
_balanceAppService = balanceAppService;
_expectOutAppService = expectOutAppService;
_locationAppService = locationAppService;
_transferLibRequestAppService = transferLibRequestAppService;
}
/// <summary>
@ -41,8 +52,133 @@ public class InjectionJobEventHandler :
await _injectionNoteAppService.CreateAsync(injectionNote).ConfigureAwait(false);
}
/// <summary>
/// 创建后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<InjectionJob> eventData)
{
var entity = eventData.Entity;
await CreateExpectOutAsync(entity).ConfigureAwait(false);
await CreateTransferLibAsync(entity).ConfigureAwait(false);
}
/// <summary>
/// 批量创建后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<InjectionJob>> eventData)
{
var entitys = eventData.Entity;
foreach (var entity in entitys)
{
await CreateExpectOutAsync(entity).ConfigureAwait(false);
await CreateTransferLibAsync(entity).ConfigureAwait(false);
}
}
#region 私有
/// <summary>
/// 创建预计出
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
private async Task CreateExpectOutAsync(InjectionJob entity)
{
var expectOutEditInputs = new List<ExpectOutEditInput>();
foreach (var detail in entity.Details)
{
var balanceDto = await _balanceAppService
.GetRealQtyByPackingCodeAndItemCodeAndLocationCodeAndStatusAsync(detail.RecommendPackingCode,
detail.ItemCode, detail.RecommendFromLocationCode, EnumInventoryStatus.OK).ConfigureAwait(false);
var inputoExpectOutEditInput = new ExpectOutEditInput();
inputoExpectOutEditInput.JobNumber = entity.Number;
inputoExpectOutEditInput.ItemCode = detail.ItemCode;
inputoExpectOutEditInput.Qty = balanceDto.Qty;
inputoExpectOutEditInput.LocationCode = balanceDto.LocationCode;
inputoExpectOutEditInput.ArriveDate = balanceDto.ArriveDate;
inputoExpectOutEditInput.ContainerCode = balanceDto.ContainerCode;
inputoExpectOutEditInput.ExpireDate = balanceDto.ExpireDate;
inputoExpectOutEditInput.ItemDesc1 = balanceDto.ItemDesc1;
inputoExpectOutEditInput.ItemDesc2 = balanceDto.ItemDesc2;
inputoExpectOutEditInput.ItemName = balanceDto.ItemName;
inputoExpectOutEditInput.LocationArea = balanceDto.LocationArea;
inputoExpectOutEditInput.LocationGroup = balanceDto.LocationGroup;
inputoExpectOutEditInput.LocationErpCode = balanceDto.LocationErpCode;
inputoExpectOutEditInput.PackingCode = balanceDto.PackingCode;
inputoExpectOutEditInput.Lot = balanceDto.Lot;
inputoExpectOutEditInput.ProduceDate = balanceDto.ProduceDate;
inputoExpectOutEditInput.Status = balanceDto.Status;
inputoExpectOutEditInput.Uom = balanceDto.Uom;
inputoExpectOutEditInput.SupplierBatch = balanceDto.SupplierBatch;
inputoExpectOutEditInput.WarehouseCode= balanceDto.WarehouseCode;
expectOutEditInputs.Add(inputoExpectOutEditInput);
}
await _expectOutAppService.AddManyAsync(expectOutEditInputs).ConfigureAwait(false);
}
/// <summary>
/// 根据是否在 第一层 来创建 是否生成库移任务
/// </summary>
/// <returns></returns>
private async Task CreateTransferLibAsync(InjectionJob injectionJob)
{
foreach (var detail in injectionJob.Details)
{
var input = new TransferLibRequestEditInput();
input.CallBusinessType = nameof(IInjectionJobAppService);
input.CallJobNumber = injectionJob.Number;
input.CallRequestNumber = injectionJob.InjectionRequestNumber;
input.CallServerName = "Win_in.Sfs.Wms.Store.Application.InjectionJobAppService";
input.Type = "Transfer_Warehouse";
input.UseOnTheWayLocation = true;
var detailInput = new TransferLibRequestDetailInput();
detailInput.CallBusinessType = nameof(IInjectionJobAppService);
detailInput.CallRequestNumber = injectionJob.InjectionRequestNumber;
detailInput.CallServerName = "Win_in.Sfs.Wms.Store.Application.InjectionJobAppService";
detailInput.CallJobNumber = injectionJob.Number;
detailInput.JobStatus = EnumJobStatus.Open;
detailInput.ItemCode=detail.ItemCode;
detailInput.Qty = detail.RecommendQty;
detailInput.ArriveDate = detailInput.ArriveDate;
detailInput.ExpireDate=detailInput.ExpireDate;
detailInput.ProduceDate = detail.RecommendProduceDate;
detailInput.ToLocationCode = detail.ToLocationCode;
detailInput.ToWarehouseCode=detail.ToWarehouseCode;
detailInput.ToLocationErpCode=detail.ToLocationErpCode;
detailInput.ToLocationGroup=detail.ToLocationGroup;
detailInput.ToLocationArea= detail.ToLocationArea;
detailInput.FromLocationCode = detail.RecommendFromLocationCode;
detailInput.FromLocationArea = detail.RecommendFromLocationArea;
detailInput.FromLocationGroup=detail.RecommendFromLocationGroup;
detailInput.FromLocationErpCode= detail.RecommendFromLocationErpCode;
detailInput.FromWarehouseCode= detail.RecommendFromWarehouseCode;
detailInput.FromLot = detail.RecommendLot;
detailInput.ToLot=detail.RecommendLot;
detailInput.Qty=detail.RecommendQty;
detailInput.StdPackQty = detail.StdPackQty;
detailInput.Uom=detail.Uom;
detailInput.SupplierBatch = detail.RecommendSupplierBatch;
await _transferLibRequestAppService.CreateAsync(input).ConfigureAwait(false);
}
}
/// <summary>
/// 创建补料记录实体
/// </summary>
@ -80,49 +216,49 @@ public class InjectionJobEventHandler :
switch (locationType)
{
case EnumLocationType.WIP:
{
//用开关控制 发料到线边后去除箱码和托码 ???
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemovePackingCode)
.ConfigureAwait(false))
{
injectionNoteDetail.ToPackingCode = "";
}
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveContainerCode)
.ConfigureAwait(false))
{
//用开关控制 发料到线边后去除箱码和托码 ???
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemovePackingCode)
.ConfigureAwait(false))
{
injectionNoteDetail.ToPackingCode = "";
}
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveContainerCode)
.ConfigureAwait(false))
{
injectionNoteDetail.ToContainerCode = "";
}
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveLot).ConfigureAwait(false))
{
injectionNoteDetail.ToLot = "";
}
break;
injectionNoteDetail.ToContainerCode = "";
}
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveLot).ConfigureAwait(false))
{
injectionNoteDetail.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))
{
injectionNoteDetail.ToPackingCode = "";
}
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveContainerCode)
.ConfigureAwait(false))
{
injectionNoteDetail.ToContainerCode = "";
}
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveLot).ConfigureAwait(false))
{
injectionNoteDetail.ToLot = "";
}
break;
injectionNoteDetail.ToPackingCode = "";
}
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveContainerCode)
.ConfigureAwait(false))
{
injectionNoteDetail.ToContainerCode = "";
}
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveLot).ConfigureAwait(false))
{
injectionNoteDetail.ToLot = "";
}
break;
}
}
}

182
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InjectionRequestEventHandler.cs

@ -27,19 +27,17 @@ public class InjectionRequestEventHandler
{
private readonly IInjectionJobAppService _injectionJobAppService;
private readonly IProductionLineAppService _productionLineAppService;
private readonly IInjectionRequestManager _injectionRequestManager;
private readonly IProductionLineItemAppService _productionLineItemAppService;
private readonly ILocationAppService _locationAppService;
private readonly IBalanceAppService _balanceAppService;
public InjectionRequestEventHandler(
IInjectionJobAppService injectionJobAppService, IProductionLineAppService productionLineAppService,
IInjectionRequestManager injectionRequestManager, ILocationAppService locationAppService,
ILocationAppService locationAppService,
IBalanceAppService balanceAppService, IProductionLineItemAppService productionLineItemAppService)
{
_injectionJobAppService = injectionJobAppService;
_productionLineAppService = productionLineAppService;
_injectionRequestManager = injectionRequestManager;
_locationAppService = locationAppService;
_balanceAppService = balanceAppService;
_productionLineItemAppService = productionLineItemAppService;
@ -76,14 +74,14 @@ public class InjectionRequestEventHandler
switch (entity.Type)
{
case nameof(EnumIssueType.Box):
case nameof(EnumIssueType.BoxQty):
injectionJobs = await CreateInjectionJobWithBoxQtyTypeAsync(entity).ConfigureAwait(false);
break;
case nameof(EnumIssueType.Num):
injectionJobs = await CreateInjectionJobWithBoxTypeAsync(entity).ConfigureAwait(false);
case nameof(EnumIssueType.Qty):
injectionJobs = await CreateInjectionJobWithQtyTypeAsync(entity).ConfigureAwait(false);
break;
}
if (injectionJobs.Any())
{
await _injectionJobAppService.CreateManyAsync(injectionJobs).ConfigureAwait(false);
@ -123,14 +121,11 @@ public class InjectionRequestEventHandler
/// <param name="injectionRequest"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
private async Task<List<InjectionJobEditInput>> CreateInjectionJobWithBoxTypeAsync
private async Task<List<InjectionJobEditInput>> CreateInjectionJobWithQtyTypeAsync
(InjectionRequest injectionRequest)
{
var jobs = new List<InjectionJobEditInput>();
var transactionType = await TransactionTypeAclService
.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false); //库存事务
var toLocationCodes = injectionRequest.Details.Select(p => p.ToLocationCode).Distinct().ToList(); //所有发送库位的集合
var toLocations = await _locationAppService.GetByCodesAsync(toLocationCodes).ConfigureAwait(false); //所有库位的集合
@ -143,7 +138,7 @@ public class InjectionRequestEventHandler
//创建详情
var jobDetails =
await CreateInjectionJobDetailInputsWithBoxTypeAsync(injectionRequest, injectionRequestDetail,
await CreateInjectionJobDetailInputsWithQtyTypeAsync(injectionRequest, injectionRequestDetail,
toLocation.LocationGroupCode).ConfigureAwait(false);
if (!jobDetails.Any())
{
@ -155,7 +150,8 @@ public class InjectionRequestEventHandler
var job = jobs.FirstOrDefault(p => p.WorkGroupCode == fromLocation?.WorkGroupCode);
if (job == null || job.Details.Any(p => p.ToLocationCode != injectionRequestDetail.ToLocationCode))
{
job = await BuildInjectionJobCreateInputWithBoxTypeAsync(injectionRequest, fromLocation).ConfigureAwait(false);
job = await BuildInjectionJobCreateInputWithQtyTypeAsync(injectionRequest, fromLocation)
.ConfigureAwait(false);
jobs.Add(job);
}
@ -204,7 +200,8 @@ public class InjectionRequestEventHandler
/// <param name="injectionRequest"></param>
/// <param name="fromLocation"></param>
/// <returns></returns>
private async Task<InjectionJobEditInput> BuildInjectionJobCreateInputWithBoxTypeAsync(InjectionRequest injectionRequest,
private async Task<InjectionJobEditInput> BuildInjectionJobCreateInputWithQtyTypeAsync(
InjectionRequest injectionRequest,
LocationDTO fromLocation)
{
InjectionJobEditInput job;
@ -235,7 +232,7 @@ public class InjectionRequestEventHandler
/// <param name="toLocationGroupCode"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
private async Task<List<InjectionJobDetailInput>> CreateInjectionJobDetailInputsWithBoxTypeAsync(
private async Task<List<InjectionJobDetailInput>> CreateInjectionJobDetailInputsWithQtyTypeAsync(
InjectionRequest injectionRequest,
InjectionRequestDetail injectionRequestDetail, string toLocationGroupCode)
{
@ -269,8 +266,10 @@ public class InjectionRequestEventHandler
foreach (var recommend in recommendList)
{
//拿走需求量
var detail = await BuildInjectionJobDetailWithBoxTypeAsync(injectionRequestDetail, recommend, toLocationGroupCode)
.ConfigureAwait(false);
var detail =
await BuildInjectionJobDetailWithQtyTypeAsync(injectionRequestDetail, recommend,
toLocationGroupCode)
.ConfigureAwait(false);
if (injectionRequest.UseOnTheWayLocation)
{
//获取在途库
@ -297,7 +296,7 @@ public class InjectionRequestEventHandler
/// <param name="balance"></param>
/// <param name="toLocationGroupCode"></param>
/// <returns></returns>
private async Task<InjectionJobDetailInput> BuildInjectionJobDetailWithBoxTypeAsync(
private async Task<InjectionJobDetailInput> BuildInjectionJobDetailWithQtyTypeAsync(
InjectionRequestDetail injectionRequestDetail, BalanceDTO balance, string toLocationGroupCode)
{
//ProductionLineDTO prodLine = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationGroupCode).ConfigureAwait(false);
@ -340,7 +339,150 @@ public class InjectionRequestEventHandler
#region 按箱叫料
/// <summary>
/// 创建注塑任务
/// </summary>
/// <param name="injectionRequest"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
private async Task<List<InjectionJobEditInput>> CreateInjectionJobWithBoxQtyTypeAsync
(InjectionRequest injectionRequest)
{
var inputJobs = new List<InjectionJobEditInput>();
var inputExpectOutEditInput = new ExpectOutEditInput();
//已用的库存的箱码集合
var useBalanceList = new List<string>();
var groupByItemCodeAndLocationCode =
injectionRequest.Details.GroupBy(p => new { p.ItemCode, p.ToLocationCode });
foreach (var locationCodeItemCodeGroup in groupByItemCodeAndLocationCode)
{
var inputDetails = injectionRequest.Details.Where(p =>
p.ItemCode == locationCodeItemCodeGroup.Key.ItemCode &&
p.ToLocationCode == locationCodeItemCodeGroup.Key.ToLocationCode);
var inputDetailTemplate = inputDetails.First();
//获取请求下 这个零件和这个库位一个需要多少箱
var sumBoxQty = inputDetails.Sum(p => p.BoxQty);
//获取生产线
var productionLineDto = await _productionLineAppService
.GetByLocationCodeAsync(inputDetails.First().ToLocationCode).ConfigureAwait(false);
if (productionLineDto == null)
{
throw new UserFriendlyException($"库位【{inputDetailTemplate.ToLocationCode}】没有对应的【生产线】");
}
var productLineCodeAndItemCode = await _productionLineItemAppService
.GetByProductLineCodeAndItemCodeAsync(productionLineDto.Code, inputDetailTemplate.ItemCode)
.ConfigureAwait(false);
if (productLineCodeAndItemCode == null)
{
throw new UserFriendlyException(
$"物品代码【{inputDetailTemplate.ItemCode}】在生产线【{productionLineDto.Code}】中没有对应的【生产线物品关系】");
}
//获取可用库存
var input = new RecommendBalanceRequestInput
{
ItemCode = locationCodeItemCodeGroup.Key.ItemCode,
Qty = decimal.MaxValue,
Statuses = new EditableList<EnumInventoryStatus> { EnumInventoryStatus.OK },
Locations = JsonSerializer.Deserialize<List<string>>(productLineCodeAndItemCode
.RawLocationCodeListJson)
};
var usableList = await _balanceAppService.GetUsableListAsync(input).ConfigureAwait(false);
usableList = usableList.Where(p => !useBalanceList.Contains(p.PackingCode)).ToList();
for (var i = 0; i < sumBoxQty; i++)
{
var firstUsable = usableList.First();
useBalanceList.Add(firstUsable.PackingCode);
usableList.Remove(firstUsable);
var injectionJobEditInput =
await BuildInjectionJobCreateInputWithBoxQtyTypeAsync(injectionRequest, inputDetailTemplate,
firstUsable)
.ConfigureAwait(false);
inputJobs.Add(injectionJobEditInput);
}
}
return inputJobs;
}
/// <summary>
/// 构造注塑任务
/// </summary>
/// <param name="injectionRequest"></param>
/// <param name="injectionRequestDetail"></param>
/// <param name="balanceDtos"></param>
/// <returns></returns>
private async Task<InjectionJobEditInput> BuildInjectionJobCreateInputWithBoxQtyTypeAsync(
InjectionRequest injectionRequest,
InjectionRequestDetail injectionRequestDetail, BalanceDTO balanceDtos)
{
InjectionJobEditInput job;
job = ObjectMapper.Map<InjectionRequest, InjectionJobEditInput>(injectionRequest);
job.JobType = EnumJobType.IssueJob;
job.JobStatus = EnumJobStatus.Open;
job.WorkGroupCode = injectionRequestDetail.ToLocationGroup;
job.WarehouseCode = injectionRequestDetail.ToWarehouseCode;
job.ProdLine = injectionRequestDetail.ProdLine;
job.Worker = injectionRequest.Worker;
job.InjectionRequestNumber = injectionRequest.Number;
job.Details.Add(await BuildInjectionJobDetailWithBoxQtyTypeAsync(injectionRequestDetail, balanceDtos)
.ConfigureAwait(false));
await Task.CompletedTask.ConfigureAwait(false);
return job;
}
/// <summary>
/// 构造注塑任务明细
/// </summary>
/// <param name="injectionRequestDetail"></param>
/// <param name="balance"></param>
/// <param name="toLocationGroupCode"></param>
/// <returns></returns>
private async Task<InjectionJobDetailInput> BuildInjectionJobDetailWithBoxQtyTypeAsync(
InjectionRequestDetail injectionRequestDetail, BalanceDTO balance)
{
var detail = ObjectMapper.Map<BalanceDTO, InjectionJobDetailInput>(balance);
detail.RequestLocationCode = injectionRequestDetail.ToLocationCode;
detail.WorkStation = injectionRequestDetail.WorkStation;
detail.ExpiredTime = injectionRequestDetail.ExpiredTime;
detail.PositionCode = injectionRequestDetail.PositionCode;
detail.RecommendType = injectionRequestDetail.RecommendType;
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.RecommendQty = balance.Qty;
detail.Uom = balance.Uom;
detail.ToLocationCode = injectionRequestDetail.ToLocationCode;
detail.ToLocationErpCode = injectionRequestDetail.ToLocationErpCode;
detail.ToLocationArea = injectionRequestDetail.ToLocationArea;
detail.ToWarehouseCode = injectionRequestDetail.ToWarehouseCode;
detail.ToLocationGroup= injectionRequestDetail.ToLocationGroup;
detail.ProdLine = injectionRequestDetail.ToLocationCode;
await Task.CompletedTask.ConfigureAwait(false);
return detail;
}
#endregion

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

@ -120,7 +120,7 @@ public class ThirdLocationRequestEventHandler
{
var jobs = new List<ThirdLocationJobEditInput>();
var transactionType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false);//库存事务
var transactionType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.TransferLib, EnumTransSubType.Transfer_Warehouse).ConfigureAwait(false);//库存事务
var toLocationCodes = thirdLocationRequest.Details.Select(p => p.ToLocationCode).Distinct().ToList();//所有发送库位的集合
var toLocations = await _locationAppService.GetByCodesAsync(toLocationCodes).ConfigureAwait(false);//所有库位的集合
@ -245,7 +245,7 @@ public class ThirdLocationRequestEventHandler
//ProductionLineDTO prodLine = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationGroupCode).ConfigureAwait(false);
var detail = ObjectMapper.Map<BalanceDTO, ThirdLocationJobDetailInput>(balance);
detail.RequestLocationCode = thirdLocationRequestDetail.ToLocationCode;
detail.FromLocationCode = thirdLocationRequestDetail.FromLocationCode;
detail.WorkStation = thirdLocationRequestDetail.WorkStation;
detail.ExpiredTime = thirdLocationRequestDetail.ExpiredTime;
detail.PositionCode = thirdLocationRequestDetail.PositionCode;
@ -271,6 +271,7 @@ public class ThirdLocationRequestEventHandler
detail.ToLocationErpCode = thirdLocationRequestDetail.ToLocationErpCode;
detail.ToLocationArea = thirdLocationRequestDetail.ToLocationArea;
detail.ToWarehouseCode = thirdLocationRequestDetail.ToWarehouseCode;
detail.FromLocationArea = thirdLocationRequestDetail.FromLocationArea;
//detail.ProdLine = prodLine == null ? toLocationGroupCode : prodLine.Code;
detail.ProdLine = toLocationGroupCode;

2
be/WZC2.sln.DotSettings

@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeEditing/SuppressNullableWarningFix/Enabled/@EntryValue">False</s:Boolean></wpf:ResourceDictionary>

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

@ -114,8 +114,8 @@
"BaseUrl": "http://dev.ccwin-in.com:60083/"
},
"BaseData": {
//"BaseUrl": "http://localhost:59094/"
"BaseUrl": "http://dev.ccwin-in.com:60084/"
"BaseUrl": "http://localhost:59094/"
//"BaseUrl": "http://dev.ccwin-in.com:60084/"
},
"Default": {
"BaseUrl": "http://dev.ccwin-in.com:60083/"

Loading…
Cancel
Save