Browse Source

修改 【回收料 收货】 盘点】

集成Redis
郑渤旭[Irelia] 2 years ago
parent
commit
0d34dd8ca2
  1. 2
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/RecycledMaterialReceiptNoteController.cs
  2. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/PurchaseReceiptJobs/IPurchaseReceiptJobAppService.cs
  3. 17
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAppService.cs
  4. 43
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs
  5. 48
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAppService.cs
  6. 9
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAutoMapperProfile.cs
  7. 26
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs
  8. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/IRecycledMaterialReceiptNoteManager.cs
  9. 14
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteManager.cs
  10. 9
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs
  11. 30
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/RecycledMaterialReceiptNoteEventHandler.cs

2
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/RecycledMaterialReceiptNoteController.cs

@ -26,7 +26,7 @@ public class RecycledMaterialReceiptNoteController : AbpController
}
/// <summary>
/// 获取盘点任务详情
/// 回收料调整
/// </summary>
/// <param name="id"></param>
/// <returns></returns>

6
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/PurchaseReceiptJobs/IPurchaseReceiptJobAppService.cs

@ -40,4 +40,10 @@ public interface IPurchaseReceiptJobAppService
/// </summary>
/// <returns></returns>
Task<List<PurchaseReceiptJobDetailDTO>> SetInspectWithNotInspectAsync(Guid id);
/// <summary>
/// 根据供应商编号获取收货任务
/// </summary>
/// <returns></returns>
Task<List<PurchaseReceiptJobDTO>> GetListBySupplierCodeOnTodayAsync(string supplierCode);
}

17
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAppService.cs

@ -5,6 +5,7 @@ using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.ObjectMapping;
using Win_in.Sfs.FileStorage.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Store.Application.Contracts;
@ -198,6 +199,22 @@ public class PurchaseReceiptJobAppService :
}
}
/// <summary>
/// 根据供应商编号获取收货任务
/// </summary>
/// <returns></returns>
[HttpPost("get-by-supplier-code-on-today/{supplierCode}")]
public virtual async Task<List<PurchaseReceiptJobDTO>> GetListBySupplierCodeOnTodayAsync(string supplierCode)
{
var purchaseReceiptJobs = await _repository.GetListAsync(p =>
p.SupplierCode == supplierCode &&
p.PlanArriveDate.Year == DateTime.Now.Year &&
p.PlanArriveDate.Month == DateTime.Now.Month &&
p.PlanArriveDate.Day == DateTime.Now.Day).ConfigureAwait(false);
var dto = ObjectMapper.Map<List<PurchaseReceiptJob>, List<PurchaseReceiptJobDTO>>(purchaseReceiptJobs);
return dto;
}
///// <summary>
///// 取消请求
///// </summary>

43
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs

@ -1,11 +1,13 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using Volo.Abp.Domain.Repositories;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
@ -35,6 +37,45 @@ public class CountNoteAppService :
_countPlanAppService = countPlanAppService;
}
#region 东阳
/// <summary>
/// 用来重写 导入数据时可以加工数据
/// </summary>
/// <param name="dictionary"></param>
/// <returns></returns>
protected async override Task<Dictionary<CountNote, EntityState>> ImportProcessingEntityAsync(Dictionary<CountNote, EntityState> dictionary)
{
var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key);
foreach (var countNote in addList)
{
var countPlanDto=await _countPlanAppService.GetByNumberAsync(countNote.CountPlanNumber).ConfigureAwait(false);
if (countPlanDto.RequestType != CountPlanRequestType.Import)
{
throw new UserFriendlyException("非Excel盘点执行方式不能使用导入");
}
//特殊处理 因为盘点记录可以重复导入 所以每次导入前删除调原有记录
//_repository.DeleteAsync(p=>p.CountPlanNumber==CountPlan)
countNote.Worker = CurrentUser.GetUserName();
countNote.CreatorId = CurrentUser.Id;
countNote.BeginTime= DateTime.Now;
countNote.Adjusted = false;
countNote.EndTime=DateTime.Now;
countNote.Stage = EnumCountStage.Audit;
//foreach (var detail in purchaseReturnRequest.Details)
//{
//}
}
return dictionary;
}
#endregion
/// <summary>
/// 新增接口
/// </summary>

48
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAppService.cs

@ -1,6 +1,11 @@
using System.Threading.Tasks;
using DocumentFormat.OpenXml.Bibliography;
using FluentValidation.Validators;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.ObjectMapping;
using Win_in.Sfs.Basedata.Application.Contracts;
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;
@ -22,24 +27,53 @@ public class RecycledMaterialReceiptNoteAppService :
{
private readonly IRecycledMaterialReceiptNoteManager _RecycledMaterialReceiptNoteManager;
private readonly ILocationCapacityAppService _locationCapacityAppService;
private readonly ILocationAppService _locationAppService;
private readonly IItemBasicAppService _itemBasicAppService;
public RecycledMaterialReceiptNoteAppService(IRecycledMaterialReceiptNoteRepository repository,
IRecycledMaterialReceiptNoteManager RecycledMaterialReceiptNoteManager,
ILocationCapacityAppService locationCapacityAppService) : base(repository)
ILocationCapacityAppService locationCapacityAppService,
ILocationAppService locationAppService,
IItemBasicAppService itemBasicAppService) : base(repository)
{
_RecycledMaterialReceiptNoteManager = RecycledMaterialReceiptNoteManager;
_locationCapacityAppService = locationCapacityAppService;
_locationAppService = locationAppService;
_itemBasicAppService = itemBasicAppService;
}
[HttpPost("")]
//[Authorize(RecycledMaterialReceiptNotePermissions.Create)]
/// <summary>
/// 新增实体
/// </summary>
/// <param name="input">CreateInput</param>
public override async Task<RecycledMaterialReceiptNoteDTO> CreateAsync(RecycledMaterialReceiptNoteEditInput input)
{
var entity = ObjectMapper.Map<RecycledMaterialReceiptNoteEditInput, RecycledMaterialReceiptNote>(input);
await _RecycledMaterialReceiptNoteManager.CreateAsync(entity).ConfigureAwait(false);
var entity= ObjectMapper.Map<RecycledMaterialReceiptNoteEditInput, RecycledMaterialReceiptNote>(input);
var dto = ObjectMapper.Map<RecycledMaterialReceiptNote, RecycledMaterialReceiptNoteDTO>(entity);
entity.Number=string.IsNullOrEmpty(input.Number)
? await GenerateNumberAsync(nameof(RecycledMaterialReceiptNote), input.ActiveDate)
.ConfigureAwait(false)
: input.Number;
return dto;
foreach (var detail in entity.Details)
{
var detailNumber = await GenerateNumberAsync(nameof(RecycledMaterialReceiptNote), input.ActiveDate)
.ConfigureAwait(false);
detail.Number=detailNumber;
var locationDto = await _locationAppService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false);
detail.LocationErpCode = locationDto.ErpLocationCode;
detail.LocationArea = locationDto.AreaCode;
detail.LocationGroup = locationDto.LocationGroupCode;
detail.WarehouseCode=locationDto.WarehouseCode;
var itemBasicDto=await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
detail.StdPackQty = itemBasicDto.StdPackQty;
detail.Uom = itemBasicDto.BasicUom;
}
entity=await _repository.InsertAsync(entity).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData<RecycledMaterialReceiptNote>(entity),false).ConfigureAwait(false);
return ObjectMapper.Map<RecycledMaterialReceiptNote, RecycledMaterialReceiptNoteDTO>(entity);
}
}

9
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAutoMapperProfile.cs

@ -22,5 +22,14 @@ public partial class StoreApplicationAutoMapperProfile : Profile
.Ignore(x => x.TenantId)
.Ignore(x => x.Number)
.Ignore(x => x.Id);
CreateMap< RecycledMaterialReceiptNoteEditInput,RecycledMaterialReceiptNote > ()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.Remark)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.TenantId)
.Ignore(x => x.Number)
.Ignore(x => x.Id);
;
}
}

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

@ -26,6 +26,7 @@ public class PurchaseOrderAppService :
private readonly IPurchaseOrderManager _purchaseOrderManager;
private readonly ISupplierAppService _supplierAppService;
private readonly IItemBasicAppService _itemBasicAppService;
private readonly IPurchaseReceiptJobAppService _purchaseReceiptJobAppService;
public PurchaseOrderAppService(
IPurchaseOrderRepository repository,
@ -233,34 +234,15 @@ public class PurchaseOrderAppService :
#endregion
//protected override async Task<PurchaseOrder> GetEntityAsync(PurchaseOrderImportInput importInput)
//{
// return await _repository.FindAsync(t => t.Number == importInput.Number).ConfigureAwait(false);
//}
//protected virtual async Task ImportDataAsync(List<PurchaseOrder> entites, List<PurchaseOrder> deleteEntities)
//{
// await _purchaseOrderManager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false);
//}
return dtos;
}
[HttpGet("get-list-by-supplier-code-and-item-code")]
public virtual async Task<List<PurchaseOrderDTO>> GetListBySupplierCodeAsync(string supplierCode, string itemCode)
{
var entitys = await _repository.GetListAsync(p => p.Details.Any(y => y.ItemCode == itemCode) && p.SupplierCode == supplierCode);
var entitys = await _repository.GetListAsync(p => p.Details.Any(y => y.ItemCode == itemCode) && p.SupplierCode == supplierCode).ConfigureAwait(false);
List<PurchaseOrder> list = new List<PurchaseOrder>();
var dtos = ObjectMapper.Map<List<PurchaseOrder>, List<PurchaseOrderDTO>>(entitys);
foreach (var entity in entitys)
{
var purchaseOrder = await _repository.GetAsync(entity.Id);
list.Add(purchaseOrder);
return dtos;
}
var dtos = ObjectMapper.Map<List<PurchaseOrder>, List<PurchaseOrderDTO>>(list);
return dtos;
}
}

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/IRecycledMaterialReceiptNoteManager.cs

@ -4,5 +4,5 @@ namespace Win_in.Sfs.Wms.Store.Domain;
public interface IRecycledMaterialReceiptNoteManager : ISfsStoreManager<RecycledMaterialReceiptNote, RecycledMaterialReceiptNoteDetail>
{
Task CreateByPurchaseReceiptNoteAsync(PurchaseReceiptNote purchaseReceiptNote);
}

14
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteManager.cs

@ -10,18 +10,4 @@ public class RecycledMaterialReceiptNoteManager : SfsStoreManagerBase<RecycledMa
) : base(repository)
{
}
public override async Task<RecycledMaterialReceiptNote> CreateAsync(RecycledMaterialReceiptNote entity)
{
return await base.CreateAsync(entity).ConfigureAwait(false);
}
public virtual async Task CreateByPurchaseReceiptNoteAsync(PurchaseReceiptNote purchaseReceiptNote)
{
var RecycledMaterialReceiptNote = ObjectMapper.Map<PurchaseReceiptNote, RecycledMaterialReceiptNote>(purchaseReceiptNote);
await base.CreateAsync(RecycledMaterialReceiptNote).ConfigureAwait(false);
}
}

9
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs

@ -14,12 +14,14 @@ namespace Win_in.Sfs.Wms.Store.Domain;
public class CountPlanManager : SfsStoreRequestManagerBase<CountPlan, CountPlanDetail>, ICountPlanManager
{
private readonly ICountPlanRepository _repository;
public CountPlanManager(
ICountPlanRepository repository
)
: base(repository)
{
_repository = repository;
}
/// <summary>
@ -200,10 +202,8 @@ public class CountPlanManager : SfsStoreRequestManagerBase<CountPlan, CountPlanD
{
// 盘点标签
CountLabel = GuidGenerator.Create().ToString(),
// 数量
InventoryQty = inventory.Qty,
// 最终盘点数量
FinalCountQty = 0,
// 状态
@ -214,18 +214,21 @@ public class CountPlanManager : SfsStoreRequestManagerBase<CountPlan, CountPlanD
PackingCode = inventory.PackingCode,
// 托标签
ContainerCode = inventory.ContainerCode,
// 物品
ItemName = inventory.ItemName,
ItemDesc1 = inventory.ItemDesc1,
ItemDesc2 = inventory.ItemDesc2,
ItemCode = inventory.ItemCode,
// 排序批次
Lot = inventory.Lot,
/// 批次
// 批次
SupplierBatch = inventory.SupplierBatch,
ArriveDate = inventory.ArriveDate,
ProduceDate = inventory.ProduceDate,
ExpireDate = inventory.ExpireDate,
// 库位
LocationArea = inventory.LocationArea,
LocationCode = inventory.LocationCode,
LocationErpCode = inventory.LocationErpCode,
WarehouseCode = inventory.WarehouseCode,

30
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/RecycledMaterialReceiptNoteEventHandler.cs

@ -19,6 +19,11 @@ public class RecycledMaterialReceiptNoteEventHandler
private const EnumTransType TransType = EnumTransType.UnplannedReceipt;
private const EnumTransSubType TransSubType = EnumTransSubType.UnplannedReceipt_RecycledMaterialReceipt;
/// <summary>
/// 创建后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<RecycledMaterialReceiptNote> eventData)
{
@ -26,6 +31,20 @@ public class RecycledMaterialReceiptNoteEventHandler
await AddTransactionsAsync(entity).ConfigureAwait(false);
}
/// <summary>
/// 批量创建后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<RecycledMaterialReceiptNote>> eventData)
{
var entities = eventData.Entity;
await AddTransactionsAsync(entities).ConfigureAwait(false);
}
#region 私有
private async Task AddTransactionsAsync(RecycledMaterialReceiptNote RecycledMaterialReceiptNote)
{
var inboundTransactions = new List<TransactionEditInput>();
@ -33,19 +52,10 @@ public class RecycledMaterialReceiptNoteEventHandler
inboundTransactions.AddRange(BuildTransactions(RecycledMaterialReceiptNote));
await TransactionAppService.AddManyAsync(inboundTransactions).ConfigureAwait(false);
}
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<RecycledMaterialReceiptNote>> eventData)
{
var entities = eventData.Entity;
await AddTransactionsAsync(entities).ConfigureAwait(false);
}
private async Task AddTransactionsAsync(List<RecycledMaterialReceiptNote> RecycledMaterialReceiptNotes)
{
var inboundTransactions = new List<TransactionEditInput>();
//如果要做库存事务汇总,可以修改此处
@ -74,7 +84,9 @@ public class RecycledMaterialReceiptNoteEventHandler
transactions.Add(transaction);
}
return transactions;
}
#endregion
}

Loading…
Cancel
Save