Browse Source

修改 收货任务 到质检

集成Redis
郑渤旭[Irelia] 2 years ago
parent
commit
914ac45b1e
  1. 2
      be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.StoreDbContext.sql
  2. 9
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Transactions/TransactionAutoMapperProfile.cs
  3. 6
      be/Modules/Label/src/Win_in.Sfs.Label.Application.Contracts/InventoryLabels/IInventoryLabelAppService.cs
  4. 21
      be/Modules/Label/src/Win_in.Sfs.Label.Application/InventoryLabels/InventoryLabelAppService.cs
  5. 12
      be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs
  6. 5
      be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inspect/EnumPurchaseReceiptInspectStatus.cs
  7. 4
      be/Modules/Shared/src/Win_in.Sfs.Shared.Framework/NumberGenerator/SnowflakeIdGenerator/SnowflakeIdGenerator.cs
  8. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/PurchaseReceiptNotes/DTOs/PurchaseReceiptNoteDTO.cs
  9. 7
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/PurchaseReceiptNotes/Inputs/PurchaseReceiptNoteEditInput.cs
  10. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/SupplierAsns/ISupplierAsnAppService.cs
  11. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/SupplierAsns/Inputs/SupplierAsnEditInput.cs
  12. 7
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/InspectRequests/DTOs/InspectRequestDTO.cs
  13. 7
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/InspectRequests/Inputs/InspectRequestEditInput.cs
  14. 12
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/InspectJobs/InspectJobAutoMapperProfile.cs
  15. 165
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAppService.cs
  16. 7
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAutoMapperProfile.cs
  17. 9
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InspectNotes/InspectNoteAutoMapperProfile.cs
  18. 20
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/SupplierAsns/SupplierAsnAppService.cs
  19. 28
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/InspectRequests/InspectRequestAutoMapperProfile.cs
  20. 14
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/PurchaseReceiptRequests/PurchaseReceiptRequestAppService.cs
  21. 4
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/SfsJobManagerBase.cs
  22. 5
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/PurchaseReceiptNotes/PurchaseReceiptNote.cs
  23. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/InspectRequests/InspectRequest.cs
  24. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/PurchaseReceiptJobAutoMapperProfile.cs
  25. 21
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/PurchaseReceiptNoteAutoMapperProfile.cs
  26. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/InspectRequestAutoMapperProfile.cs
  27. 14
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/PurchaseReceiptJobEventHandler.cs
  28. 213
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Orders/PurchaseOrderEventHandler.cs
  29. 22
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/PurchaseReceiptRequestEventHandler.cs
  30. 17
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/StoreEventAutoMapperProfile.cs
  31. 53
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/PurchaseReceiptNoteEventHandler.cs

2
be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.StoreDbContext.sql

@ -856,6 +856,7 @@ CREATE TABLE [Store_InspectRequest] (
[RpNumber] nvarchar(64) NULL,
[PoNumber] nvarchar(64) NULL,
[SupplierCode] nvarchar(64) NOT NULL,
[WarehouseCode] nvarchar(max) NULL,
[ExtraProperties] nvarchar(max) NULL,
[ConcurrencyStamp] nvarchar(40) NULL,
[CreationTime] datetime2 NOT NULL,
@ -1388,6 +1389,7 @@ CREATE TABLE [Store_PurchaseReceiptNote] (
[SupplierAddress] nvarchar(max) NULL,
[ReceiveTime] datetime2 NOT NULL,
[JobNumber] nvarchar(64) NULL,
[WarehouseCode] nvarchar(max) NULL,
[Type] nvarchar(64) NOT NULL,
[Status] nvarchar(64) NOT NULL,
[ExtraProperties] nvarchar(max) NULL,

9
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Transactions/TransactionAutoMapperProfile.cs

@ -1,4 +1,5 @@
using AutoMapper;
using Volo.Abp.AutoMapper;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Inventory.Domain;
@ -10,6 +11,14 @@ public partial class InventoryApplicationAutoMapperProfile : Profile
{
CreateMap<Transaction, TransactionDTO>()
.ReverseMap();
CreateMap<TransactionEditInput, Transaction>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.TransNumber)
.Ignore(x => x.TransTime)
.Ignore(x => x.ActiveDate)
.Ignore(x => x.ConcurrencyStamp)
.Ignore(x => x.Id);
}
}

6
be/Modules/Label/src/Win_in.Sfs.Label.Application.Contracts/InventoryLabels/IInventoryLabelAppService.cs

@ -14,4 +14,10 @@ public interface IInventoryLabelAppService
Task<List<InventoryLabelDto>> GenerateAndCreateManyAsync(InventoryLabelWithoutCodeCreateInput input, int count);
/// <summary>
/// Code需要自己生成 传入 否则无法赋值 完整条码
/// </summary>
/// <param name="inputs"></param>
/// <returns></returns>
Task<List<InventoryLabelDto>> CreateManyByNoCodeAsync(List<InventoryLabelEditInput> inputs);
}

21
be/Modules/Label/src/Win_in.Sfs.Label.Application/InventoryLabels/InventoryLabelAppService.cs

@ -8,6 +8,8 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Label.Application.Contracts;
using Win_in.Sfs.Label.Domain;
@ -47,6 +49,7 @@ public class InventoryLabelAppService
}
[HttpPost("")]
[UnitOfWork]
public override async Task<InventoryLabelDto> CreateAsync(InventoryLabelEditInput input)
{
var existEntity = await GetByCodeAsync(input.Code).ConfigureAwait(false);
@ -58,6 +61,7 @@ public class InventoryLabelAppService
}
[HttpPost("many")]
[UnitOfWork]
public virtual async Task<List<InventoryLabelDto>> CreateManyAsync(List<InventoryLabelEditInput> inputs)
{
List<InventoryLabelDto> inventoryLabelDtos = new List<InventoryLabelDto>();
@ -70,7 +74,22 @@ public class InventoryLabelAppService
return inventoryLabelDtos;
}
/// <summary>
/// Code需要自己生成 传入 否则无法赋值 完整条码
/// </summary>
/// <param name="inputs"></param>
/// <returns></returns>
[HttpPost("create-many-no-code")]
[UnitOfWork]
public virtual async Task<List<InventoryLabelDto>> CreateManyByNoCodeAsync(List<InventoryLabelEditInput> inputs)
{
var entitys= ObjectMapper.Map<List<InventoryLabelEditInput>, List<InventoryLabel>>(inputs);
await _repository.InsertManyAsync(entitys).ConfigureAwait(false);
return ObjectMapper.Map<List<InventoryLabel>, List<InventoryLabelDto>>(entitys);
}
[HttpPost("generate-and-create")]
[UnitOfWork]
public virtual async Task<InventoryLabelDto> GenerateAndCreateAsync(InventoryLabelWithoutCodeCreateInput input)
{
var labelType = input.LabelType.ToString();
@ -81,6 +100,7 @@ public class InventoryLabelAppService
}
[HttpPost("generate-and-create/many")]
[UnitOfWork]
public virtual async Task<List<InventoryLabelDto>> GenerateAndCreateManyAsync(List<InventoryLabelWithoutCodeCreateInput> inputs)
{
var labelType = inputs.First().LabelType.ToString();
@ -98,6 +118,7 @@ public class InventoryLabelAppService
}
[HttpPost("generate-and-create/many/{count}")]
[UnitOfWork]
public virtual async Task<List<InventoryLabelDto>> GenerateAndCreateManyAsync(InventoryLabelWithoutCodeCreateInput input, int count)
{
var labelType = input.LabelType.ToString();

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

@ -565,8 +565,6 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq
{
//将需要新增的数据进行发布
var addList = entityDict.Where(p => p.Value == EntityState.Added).Select(p => p.Key).ToList();
//一定要 先发布 在导入 否则没有事务性了 只针对于导入
await PublishCreatedAsync(addList).ConfigureAwait(false);
await SaveImportAsync(entityDict).ConfigureAwait(false);
}
}
@ -630,6 +628,7 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq
/// </summary>
/// <param name="entities"></param>
/// <returns></returns>
[UnitOfWork]
private async Task PublishCreatedAsync(List<TEntity> entities)
{
try
@ -657,7 +656,7 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq
/// <summary>
/// 导入保存到数据库,可重写
/// </summary>
[UnitOfWork]
protected virtual async Task SaveImportAsync(Dictionary<TEntity, EntityState> dict)
{
var entityList = dict.Keys.ToList();
@ -683,8 +682,13 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq
PreserveInsertOrder = true
};
await context.BulkInsertOrUpdateAsync(entityList, bulkConfig).ConfigureAwait(false);
var addList = dict.Where(p => p.Value == EntityState.Added).Select(p => p.Key).ToList();
await context.BulkInsertOrUpdateAsync(addList, bulkConfig).ConfigureAwait(false);
await context.BulkInsertAsync(list).ConfigureAwait(false);
//await _repository.InsertManyAsync(addList).ConfigureAwait(true);
//await _repository.UpdateManyAsync(dict.Where(p => p.Value == EntityState.Modified).Select(p => p.Key)).ConfigureAwait(false);
await PublishCreatedAsync(addList).ConfigureAwait(false);
}
}

5
be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inspect/EnumPurchaseReceiptInspectStatus.cs

@ -1,5 +0,0 @@
namespace Win_in.Sfs.Shared.Domain.Shared.Enums.Inspect;
public enum EnumPurchaseReceiptInspectStatus
{
}

4
be/Modules/Shared/src/Win_in.Sfs.Shared.Framework/NumberGenerator/SnowflakeIdGenerator/SnowflakeIdGenerator.cs

@ -57,14 +57,14 @@ public class SnowflakeIdGenerator : ISnowflakeIdGenerator
{
}
public SnowflakeIdGenerator(IOptions<SnowflakeIdGeneratorOptions> options, SnowflakeIdGeneratorOptions options1, SnowflakeIdGeneratorOptions options2)
public SnowflakeIdGenerator(IOptions<SnowflakeIdGeneratorOptions> options)
{
Options = options.Value;
this.DatacenterId = options.Value.GetDefaultDatacenterId();
this.WorkerId = options.Value.GetDefaultWorkerId();
}
/// <summary>
///// <summary>
/// 获得下一个ID
/// </summary>

6
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/PurchaseReceiptNotes/DTOs/PurchaseReceiptNoteDTO.cs

@ -80,4 +80,10 @@ public class PurchaseReceiptNoteDTO : SfsStoreDTOBase<PurchaseReceiptNoteDetailD
[Display(Name = "任务代码")]
public string JobNumber { get; set; }
/// <summary>
/// 仓库
/// </summary>
[Display(Name = "仓库")]
[Required(ErrorMessage = "仓库不能为空", AllowEmptyStrings = true)]
public string WarehouseCode { get; set; }
}

7
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/PurchaseReceiptNotes/Inputs/PurchaseReceiptNoteEditInput.cs

@ -99,5 +99,12 @@ public class PurchaseReceiptNoteEditInput : SfsStoreCreateOrUpdateInputBase
[Display(Name = "任务ID")]
//[Required(ErrorMessage = "{0}是必填项")]
public string JobNumber { get; set; }
/// <summary>
/// 仓库
/// </summary>
[Display(Name = "仓库")]
[Required(ErrorMessage = "仓库不能为空", AllowEmptyStrings = true)]
public string WarehouseCode { get; set; }
#endregion
}

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/SupplierAsns/ISupplierAsnAppService.cs

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
@ -31,4 +32,6 @@ public interface ISupplierAsnAppService
/// <param name="activeDate"></param>
/// <returns></returns>
Task<string> GenerateSupplierAsnNumberAsync(DateTime activeDate);
Task UpdateStatusAsync(string asnNumber, EnumSupplierAsnStatus status);
}

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/SupplierAsns/Inputs/SupplierAsnEditInput.cs

@ -132,7 +132,7 @@ public class SupplierAsnEditInput : SfsStoreCreateOrUpdateInputBase
/// 供应商地址
/// </summary>
[DisplayName("供应商地址")]
public string SupplierAdress { get; set; }
public string SupplierAddress { get; set; }
/// <summary>
/// 明细列表

7
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/InspectRequests/DTOs/InspectRequestDTO.cs

@ -52,6 +52,13 @@ public class InspectRequestDTO : SfsStoreRequestDTOBase<InspectRequestDetailDTO>
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string SupplierCode { get; set; }
/// <summary>
/// 仓库
/// </summary>
[Display(Name = "仓库")]
[Required(ErrorMessage = "仓库不能为空", AllowEmptyStrings = true)]
public string WarehouseCode { get; set; }
/// <summary>
/// 汇总明细
/// </summary>

7
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/InspectRequests/Inputs/InspectRequestEditInput.cs

@ -63,6 +63,13 @@ public class InspectRequestEditInput : SfsStoreRequestCreateOrUpdateInputBase
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string PoNumber { get; set; }
/// <summary>
/// 仓库
/// </summary>
[Display(Name = "仓库")]
[Required(ErrorMessage = "仓库不能为空", AllowEmptyStrings = true)]
public string WarehouseCode { get; set; }
/// <summary>
/// 明细列表
/// </summary>

12
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/InspectJobs/InspectJobAutoMapperProfile.cs

@ -114,5 +114,17 @@ public partial class StoreApplicationAutoMapperProfile : Profile
CreateMap<InspectJobCompleteSummaryDetailInput, InspectJobSummaryDetail>()
;
CreateMap<InspectJobEditInput, InspectJob>()
.IgnoreAuditedObjectProperties()
;
CreateMap<InspectJobDetailInput, InspectJobDetail>()
.IgnoreAuditedObjectProperties()
;
CreateMap<InspectJobSummaryDetailInput, InspectJobSummaryDetail>()
.IgnoreAuditedObjectProperties()
;
}
}

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

@ -48,17 +48,43 @@ public class PurchaseReceiptJobAppService :
_inspectJobManager = inspectJobManager;
}
#region 东阳使用
/// <summary>
/// 【设置】所有 待检状态的 收货记录为 合格
/// </summary>
/// <param name="purchaseReceiptRequestNumber"></param>
[HttpPost("cancel-by-request/{purchaseReceiptRequestNumber}")]
public virtual async Task CancelByPurchaseReceiptRequestAsync(string purchaseReceiptRequestNumber)
/// <returns></returns>
[HttpPost("set-inspect-status-ok-by-inspect/{id}")]
public virtual async Task<List<PurchaseReceiptJobDetailDTO>> SetInspectWithNotInspectAsync(Guid id)
{
var entities = await _repository.GetListAsync(p => p.PurchaseReceiptRequestNumber == purchaseReceiptRequestNumber).ConfigureAwait(false);
foreach (var entity in entities)
var purchaseReceiptJob = await _repository.FindAsync(id).ConfigureAwait(false);
var list = purchaseReceiptJob.Details
.Where(p => p.PurchaseReceiptInspectStatus == EnumPurchaseReceiptInspect.INSP).ToList();
list.ForEach(p =>
{
await _purchaseReceiptJobManager.CancelAsync(entity).ConfigureAwait(false);
{
p.PurchaseReceiptInspectStatus = EnumPurchaseReceiptInspect.OK;
p.FailedReason = string.Empty;
p.MassDefect = string.Empty;
p.HandledLot = p.RecommendLot;
p.HandledSupplierBatch = p.RecommendSupplierBatch;
p.HandledArriveDate = p.RecommendArriveDate;
p.HandledProduceDate = p.RecommendProduceDate;
p.HandledExpireDate = p.RecommendExpireDate;
p.HandledContainerCode = p.RecommendContainerCode;
p.HandledToLocationCode = p.RecommendToLocationCode;
p.HandledToLocationErpCode = p.RecommendToLocationErpCode;
p.HandledToWarehouseCode = p.RecommendToWarehouseCode;
p.HandledPackingCode = p.RecommendPackingCode;
p.HandledQty = p.RecommendQty;
}
});
await _repository.UpdateAsync(purchaseReceiptJob).ConfigureAwait(false);
return ObjectMapper.Map<List<PurchaseReceiptJobDetail>, List<PurchaseReceiptJobDetailDTO>>(list);
}
/// <summary>
@ -74,39 +100,26 @@ public class PurchaseReceiptJobAppService :
var detail = job.Details.FirstOrDefault(p => p.Id == detailId);
if (detail != null)
{
BulidResetDetail(detail);
detail.PurchaseReceiptInspectStatus = EnumPurchaseReceiptInspect.INSP;
detail.FailedReason = string.Empty;
detail.InspectPhotoJson = string.Empty;
detail.MassDefect = string.Empty;
detail.HandledLot = string.Empty;
detail.HandledSupplierBatch = string.Empty;
detail.HandledArriveDate = DateTime.Now;
detail.HandledProduceDate = DateTime.Now;
detail.HandledExpireDate = DateTime.Now;
detail.HandledContainerCode = string.Empty;
detail.HandledToLocationErpCode = string.Empty;
detail.HandledToWarehouseCode = string.Empty;
detail.HandledToLocationCode = string.Empty;
detail.HandledPackingCode = string.Empty;
detail.HandledQty = 0;
}
await _repository.UpdateAsync(job).ConfigureAwait(false);
}
/// <summary>
/// 【保存】目检 结果
/// </summary>
/// <returns></returns>
[HttpPost("save-detail-inspect/{id}")]
public virtual async Task<PurchaseReceiptJobDetailDTO> SaveDetailInspectAsync(Guid id,
PurchaseReceiptJobDetailSaveInput input)
{
var job = await _repository.FindAsync(p => p.Id == id).ConfigureAwait(false);
var detail = job.Details.FirstOrDefault(p => p.Id == input.DetailId);
if (input.FilesList != null && input.FilesList.Any())
{
var dict = await _fileAppService.CreateManyHasDictAsync(input.FilesList).ConfigureAwait(false);
detail.InspectPhotoJson = JsonSerializer.Serialize(dict);
}
if (detail != null)
{
BuildDetail(input, detail);
}
var entity = await _repository.UpdateAsync(job).ConfigureAwait(false);
return ObjectMapper.Map<PurchaseReceiptJobDetail, PurchaseReceiptJobDetailDTO>(
entity.Details.Find(p => p.Id == input.DetailId));
}
/// <summary>
/// 【重置】多个 目检 结果
/// </summary>
@ -123,48 +136,22 @@ public class PurchaseReceiptJobAppService :
}
/// <summary>
/// 【设置】所有 待检状态的 收货记录为 合格
/// 【保存】目检 结果
/// </summary>
/// <returns></returns>
[HttpPost("set-inspect-status-ok-by-inspect/{id}")]
public virtual async Task<List<PurchaseReceiptJobDetailDTO>> SetInspectWithNotInspectAsync(Guid id)
{
var purchaseReceiptJob = await _repository.FindAsync(id).ConfigureAwait(false);
var list = purchaseReceiptJob.Details
.Where(p => p.PurchaseReceiptInspectStatus == EnumPurchaseReceiptInspect.INSP).ToList();
list.ForEach(p =>
[HttpPost("save-detail-inspect/{id}")]
public virtual async Task<PurchaseReceiptJobDetailDTO> SaveDetailInspectAsync(Guid id,
PurchaseReceiptJobDetailSaveInput input)
{
var job = await _repository.FindAsync(p => p.Id == id).ConfigureAwait(false);
var detail = job.Details.FirstOrDefault(p => p.Id == input.DetailId);
if (input.FilesList != null && input.FilesList.Any())
{
p.PurchaseReceiptInspectStatus = EnumPurchaseReceiptInspect.OK;
p.FailedReason = string.Empty;
p.MassDefect = string.Empty;
p.HandledLot = p.RecommendLot;
p.HandledSupplierBatch = p.RecommendSupplierBatch;
p.HandledArriveDate = p.RecommendArriveDate;
p.HandledProduceDate = p.RecommendProduceDate;
p.HandledExpireDate = p.RecommendExpireDate;
p.HandledContainerCode = p.RecommendContainerCode;
p.HandledToLocationCode = p.RecommendToLocationCode;
p.HandledToLocationErpCode = p.RecommendToLocationErpCode;
p.HandledToWarehouseCode = p.RecommendToWarehouseCode;
p.HandledPackingCode = p.RecommendPackingCode;
p.HandledQty = p.RecommendQty;
}
});
await _repository.UpdateAsync(purchaseReceiptJob).ConfigureAwait(false);
return ObjectMapper.Map<List<PurchaseReceiptJobDetail>, List<PurchaseReceiptJobDetailDTO>>(list);
var dict = await _fileAppService.CreateManyHasDictAsync(input.FilesList).ConfigureAwait(false);
detail.InspectPhotoJson = JsonSerializer.Serialize(dict);
}
/// <summary>
/// 构造目检结果
/// </summary>
/// <param name="input"></param>
/// <param name="detail"></param>
private static PurchaseReceiptJobDetail BuildDetail(PurchaseReceiptJobDetailSaveInput input, PurchaseReceiptJobDetail detail)
if (detail != null)
{
detail.FailedReason = input.FailedReason;
detail.MassDefect = input.MassDefect;
@ -174,38 +161,36 @@ public class PurchaseReceiptJobAppService :
detail.HandledArriveDate = detail.RecommendArriveDate;
detail.HandledProduceDate = detail.RecommendProduceDate;
detail.HandledExpireDate = detail.RecommendExpireDate;
detail.HandledToLocationArea=detail.RecommendToLocationArea;
detail.HandledToLocationGroup=detail.RecommendToLocationGroup;
detail.HandledContainerCode = detail.RecommendContainerCode;
detail.HandledToLocationCode = detail.RecommendToLocationCode;
detail.HandledToLocationErpCode = detail.RecommendToLocationErpCode;
detail.HandledToWarehouseCode = detail.RecommendToWarehouseCode;
detail.HandledPackingCode = detail.RecommendPackingCode;
detail.HandledQty = detail.RecommendQty;
}
return detail;
var entity = await _repository.UpdateAsync(job).ConfigureAwait(false);
return ObjectMapper.Map<PurchaseReceiptJobDetail, PurchaseReceiptJobDetailDTO>(
entity.Details.Find(p => p.Id == input.DetailId));
}
#endregion
/// <summary>
/// 构造 并初始化 目检结果
/// </summary>
/// <param name="detail"></param>
private static PurchaseReceiptJobDetail BulidResetDetail(PurchaseReceiptJobDetail detail)
/// <param name="purchaseReceiptRequestNumber"></param>
[HttpPost("cancel-by-request/{purchaseReceiptRequestNumber}")]
public virtual async Task CancelByPurchaseReceiptRequestAsync(string purchaseReceiptRequestNumber)
{
detail.PurchaseReceiptInspectStatus = EnumPurchaseReceiptInspect.INSP;
detail.InspectPhotoJson = string.Empty;
detail.FailedReason = string.Empty;
detail.MassDefect = string.Empty;
detail.HandledLot = string.Empty;
detail.HandledSupplierBatch = string.Empty;
detail.HandledArriveDate = DateTime.Now;
detail.HandledProduceDate = DateTime.Now;
detail.HandledExpireDate = DateTime.Now;
detail.HandledContainerCode = string.Empty;
detail.HandledToLocationErpCode = string.Empty;
detail.HandledToWarehouseCode = string.Empty;
detail.HandledToLocationCode = string.Empty;
detail.HandledPackingCode = string.Empty;
return detail;
var entities = await _repository
.GetListAsync(p => p.PurchaseReceiptRequestNumber == purchaseReceiptRequestNumber).ConfigureAwait(false);
foreach (var entity in entities)
{
await _purchaseReceiptJobManager.CancelAsync(entity).ConfigureAwait(false);
}
}
/*

7
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAutoMapperProfile.cs

@ -29,5 +29,12 @@ public partial class StoreApplicationAutoMapperProfile : Profile
.Ignore(x => x.TenantId)
.Ignore(x => x.Number)
.Ignore(x => x.Id);
CreateMap<PurchaseReceiptNoteEditInput, PurchaseReceiptNote>()
.IgnoreAuditedObjectProperties()
;
CreateMap<PurchaseReceiptNoteDetailInput, PurchaseReceiptNoteDetail>()
.IgnoreAuditedObjectProperties()
;
}
}

9
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InspectNotes/InspectNoteAutoMapperProfile.cs

@ -15,6 +15,14 @@ public partial class StoreApplicationAutoMapperProfile : Profile
CreateMap<InspectNoteDetail, InspectNoteDetailDTO>()
.ReverseMap();
CreateMap<InspectNoteEditInput, InspectNote>()
.IgnoreAuditedObjectProperties()
;
CreateMap<InspectNoteSummaryDetailInput, InspectNoteSummaryDetail>()
.IgnoreAuditedObjectProperties()
;
CreateMap<InspectNoteDetailInput, InspectNoteDetail>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.MasterID)
@ -31,5 +39,6 @@ public partial class StoreApplicationAutoMapperProfile : Profile
.Ignore(x => x.TenantId)
.Ignore(x => x.Number)
.Ignore(x => x.Id);
}
}

20
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/SupplierAsns/SupplierAsnAppService.cs

@ -69,8 +69,6 @@ public class SupplierAsnAppService :
return ObjectMapper.Map<SupplierAsn, SupplierAsnDTO>(resultEntity);
}
#endregion
/// <summary>
/// 生成ASN订单号
/// </summary>
@ -83,6 +81,24 @@ public class SupplierAsnAppService :
.ConfigureAwait(false);
}
/// <summary>
/// 更新发货单状态
/// </summary>
/// <param name="asnNumber"></param>
/// <param name="status"></param>
/// <returns></returns>
[HttpGet("update-status-async")]
public virtual async Task UpdateStatusAsync(string asnNumber, EnumSupplierAsnStatus status)
{
var supplierAsn = await _repository.FindAsync(p => p.Number == asnNumber).ConfigureAwait(false);
supplierAsn.Status = status;
await _repository.UpdateAsync(supplierAsn).ConfigureAwait(false);
}
#endregion
private async Task<SupplierAsnDTO> CreateFromFileAsync(SupplierAsnEditInput input)
{
var entity = ObjectMapper.Map<SupplierAsnEditInput, SupplierAsn>(input);

28
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/InspectRequests/InspectRequestAutoMapperProfile.cs

@ -34,25 +34,13 @@ public partial class StoreApplicationAutoMapperProfile : Profile
.Ignore(x => x.TenantId)
.Ignore(x => x.Number);
CreateMap<PurchaseReceiptNote, InspectRequest>()
.ForMember(x => x.ReceiptNumber, y => y.MapFrom(d => d.Number))
.Ignore(x => x.SummaryDetails)
.Ignore(x => x.AutoAgree)
.Ignore(x => x.AutoHandle)
.Ignore(x => x.AutoSubmit)
.Ignore(x => x.AutoCompleteJob)
.Ignore(x => x.DirectCreateNote)
.Ignore(x => x.RequestStatus);
CreateMap<PurchaseReceiptNoteDetail, InspectRequestDetail>()
.ForMember(x => x.ReceiveQty, y => y.MapFrom(d => d.Qty))
.Ignore(x => x.DetailInspectStatus)
.Ignore(x => x.Uom)
.Ignore(x => x.InspectType)
.Ignore(x => x.SamplePercent)
.Ignore(x => x.Attributes)
.Ignore(x => x.InspectQty)
.Ignore(x => x.AbcClass)
.AfterMap((x, y) => y.DetailInspectStatus = EnumDetailInspectStatus.DefaultOK);
CreateMap<InspectRequestEditInput, InspectRequest>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.RequestStatus)
.Ignore(x => x.ConcurrencyStamp).Ignore(x => x.Id);
CreateMap<InspectRequestDetailInput, InspectRequestDetail>()
.IgnoreAuditedObjectProperties()
;
}
}

14
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/PurchaseReceiptRequests/PurchaseReceiptRequestAppService.cs

@ -23,24 +23,21 @@ public class PurchaseReceiptRequestAppService :
IPurchaseReceiptRequestAppService
{
private readonly IPurchaseReceiptRequestManager _purchaseReceiptRequestManager;
private readonly IInventoryLabelAppService _inventoryLabelService;
private readonly ISupplierAppService _supplierAppService;
public PurchaseReceiptRequestAppService(
IPurchaseReceiptRequestRepository repository,
IPurchaseReceiptRequestManager purchaseReceiptRequestManager,
IInventoryLabelAppService inventoryLabelService,
ISupplierAppService supplierAppService) : base(repository, purchaseReceiptRequestManager)
IPurchaseReceiptRequestManager purchaseReceiptRequestManager
) : base(repository, purchaseReceiptRequestManager)
{
_purchaseReceiptRequestManager = purchaseReceiptRequestManager;
_inventoryLabelService = inventoryLabelService;
_supplierAppService = supplierAppService;
base.CreatePolicyName = PurchaseReceiptRequestPermissions.Create;
base.UpdatePolicyName = PurchaseReceiptRequestPermissions.Update;
base.DeletePolicyName = PurchaseReceiptRequestPermissions.Delete;
}
#region 东阳使用
/// <summary>
/// 【创建】收货请求 (到货单、到货通知)
/// </summary>
@ -57,6 +54,9 @@ public class PurchaseReceiptRequestAppService :
return ObjectMapper.Map<PurchaseReceiptRequest, PurchaseReceiptRequestDTO>(resultEntity);
}
#endregion
/// <summary>
/// 【批量创建】收货请求 (到货单、到货通知)
/// </summary>

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

@ -118,7 +118,7 @@ public abstract class SfsJobManagerBase<TEntity, TDetailEntity>
CheckJobStatus(entity, EnumJobStatus.Doing);
await entity.AcceptAsync(user.Id, user.GetUserName(), Clock.Now).ConfigureAwait(false);
await entity.AcceptAsync(user.Id, user.Name, Clock.Now).ConfigureAwait(false);
await Repository.UpdateAsync(entity).ConfigureAwait(false);
}
@ -141,7 +141,7 @@ public abstract class SfsJobManagerBase<TEntity, TDetailEntity>
public virtual async Task<TEntity> CompleteAsync(TEntity entity, ICurrentUser user)
{
await entity.CompleteAsync(user.Id, user.GetUserName(), Clock.Now).ConfigureAwait(false);
await entity.CompleteAsync(user.Id, user.Name, Clock.Now).ConfigureAwait(false);
await PublishCompletedAsync(entity).ConfigureAwait(false);

5
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/PurchaseReceiptNotes/PurchaseReceiptNote.cs

@ -59,6 +59,11 @@ public class PurchaseReceiptNote : SfsStoreAggregateRootBase<PurchaseReceiptNote
/// </summary>
public string JobNumber { get; set; }
/// <summary>
/// 仓库代码
/// </summary>
public string WarehouseCode { get; set; }
/// <summary>
/// 明细列表
/// </summary>

6
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/InspectRequests/InspectRequest.cs

@ -46,6 +46,12 @@ public class InspectRequest : SfsStoreRequestAggregateRootBase<InspectRequestDet
[IgnoreUpdate]
public string SupplierCode { get; set; }
/// <summary>
/// 仓库
/// </summary>
[IgnoreUpdate]
public string WarehouseCode { get; set; }
[IgnoreUpdate]
public List<InspectRequestSummaryDetail> SummaryDetails { get; set; } = new List<InspectRequestSummaryDetail>();

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/PurchaseReceiptJobAutoMapperProfile.cs

@ -20,7 +20,7 @@ public partial class StoreEventAutoMapperProfile : Profile
;
CreateMap<PurchaseReceiptJobDetail, PurchaseReceiptNoteDetailInput>()
.ForMember(x => x.PackingCode, y => y.MapFrom(d => d.HandledPackingCode))
.ForMember(x => x.PackingCode, y => y.MapFrom(d => d.RecommendPackingCode))//未收货的是没有扫到箱码的 所以要用推荐箱码 不能是 实际箱码
.ForMember(x => x.SupplierBatch, y => y.MapFrom(d => d.HandledSupplierBatch))
.ForMember(x => x.ProduceDate, y => y.MapFrom(d => d.HandledProduceDate))
.ForMember(x => x.ExpireDate, y => y.MapFrom(d => d.HandledExpireDate))
@ -32,7 +32,6 @@ public partial class StoreEventAutoMapperProfile : Profile
.ForMember(x => x.LocationGroup, y => y.MapFrom(d => d.HandledToLocationGroup))
.ForMember(x => x.LocationErpCode, y => y.MapFrom(d => d.HandledToLocationErpCode))
.ForMember(x => x.WarehouseCode, y => y.MapFrom(d => d.HandledToWarehouseCode))
.Ignore(x => x.ArriveDate)
;
}
}

21
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/PurchaseReceiptNoteAutoMapperProfile.cs

@ -60,6 +60,27 @@ public partial class StoreEventAutoMapperProfile : Profile
;
#endregion
CreateMap<PurchaseReceiptNote, InspectRequest>()
.ForMember(x => x.ReceiptNumber, y => y.MapFrom(d => d.Number))
.Ignore(x => x.SummaryDetails)
.Ignore(x => x.AutoAgree)
.Ignore(x => x.AutoHandle)
.Ignore(x => x.AutoSubmit)
.Ignore(x => x.AutoCompleteJob)
.Ignore(x => x.DirectCreateNote)
.Ignore(x => x.RequestStatus);
CreateMap<PurchaseReceiptNoteDetail, InspectRequestDetail>()
.ForMember(x => x.ReceiveQty, y => y.MapFrom(d => d.Qty))
.Ignore(x => x.DetailInspectStatus)
.Ignore(x => x.Uom)
.Ignore(x => x.InspectType)
.Ignore(x => x.SamplePercent)
.Ignore(x => x.Attributes)
.Ignore(x => x.InspectQty)
.Ignore(x => x.AbcClass)
.AfterMap((x, y) => y.DetailInspectStatus = EnumDetailInspectStatus.DefaultOK);
}
}

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/InspectRequestAutoMapperProfile.cs

@ -19,7 +19,6 @@ public partial class StoreEventAutoMapperProfile : Profile
CreateMap<InspectRequest, InspectJobEditInput>()
.ForMember(x => x.InspectNumber, y => y.MapFrom(d => d.Number))
.ForMember(x => x.IsAutoComplete, y => y.MapFrom(d => d.AutoCompleteJob))
.Ignore(x => x.WarehouseCode)
.Ignore(x => x.UpStreamJobNumber)
.Ignore(x => x.NextAction)
.Ignore(x => x.JobDescription)

14
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/PurchaseReceiptJobEventHandler.cs

@ -1,6 +1,8 @@
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.EventBus;
using Volo.Abp.Uow;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
@ -46,11 +48,17 @@ public class PurchaseReceiptJobEventHandler :
{
var createInput = ObjectMapper.Map<PurchaseReceiptJob, PurchaseReceiptNoteEditInput>(purchaseReceiptJob);
createInput.Details.RemoveAll(p => p.Qty == 0);
//未收货记录
var noReceiptNoteList = createInput.Details.Where(p => p.Qty == 0);
foreach (var detailInput in noReceiptNoteList)
{
var jobDetail =
purchaseReceiptJob.Details.Find(p => p.RecommendPackingCode == detailInput.PackingCode);
await _purchaseReceiptNoteAppService.CreateAsync(createInput).ConfigureAwait(false);
detailInput.PurchaseReceiptInspectStatus = EnumPurchaseReceiptInspect.NORECEIPT;
}
await Task.CompletedTask.ConfigureAwait(false);
await _purchaseReceiptNoteAppService.CreateAsync(createInput).ConfigureAwait(false);
}
#endregion

213
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Orders/PurchaseOrderEventHandler.cs

@ -5,9 +5,12 @@ using System.Net.Http;
using System.Threading.Tasks;
using Castle.Components.DictionaryAdapter;
using Volo.Abp;
using Volo.Abp.Data;
using Volo.Abp.EventBus;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Basedata.Domain;
using Win_in.Sfs.Label.Application.Contracts;
using Win_in.Sfs.Label.Domain.Shared;
using Win_in.Sfs.Shared.Domain;
@ -32,10 +35,9 @@ public class PurchaseOrderEventHandler
private readonly IItemPackAppService _itemPackAppService;
private readonly ISupplierItemAppService _supplierItemAppService;
private readonly IDockAppService _dockAppService;
private readonly ISupplierTimeWindowAppService _supplierTimeWindowAppService;
private readonly IInventoryLabelAppService _inventoryLabelAppService;
private readonly ISupplierAppService _supplierAppService;
private readonly ISupplierTimeWindowAppService _supplierTimeWindowAppService;
public PurchaseOrderEventHandler(ISupplierAsnAppService supplierAsnAppService,
ILabelDefinitionAppService labelDefinitionAppService,
@ -94,10 +96,41 @@ public class PurchaseOrderEventHandler
private async Task<SupplierAsnEditInput> BuildSupplierAsnAsync(PurchaseOrder purchaseOrder)
{
var supplierAsnEditInput= ObjectMapper.Map<PurchaseOrder, SupplierAsnEditInput>(purchaseOrder);
supplierAsnEditInput.Details = new EditableList<SupplierAsnDetailInput>();//导入的是采购订单 所以下面要根据标包计算 拆成多个发货单
//收货口 //todo 处理有问题是否要和供应商关联
//所有的物品Code
var itemCodes = purchaseOrder.Details.GroupBy(p =>new{ p.ItemCode,p.Lot}).Select(p => p.Key.ItemCode);
//收货口
var dock = await _dockAppService.GetAllListByFilterAsync(
new SfsBaseDataRequestInputBase() { Condition = new Condition(){Filters = new List<Filter>()}, MaxResultCount = 99, SkipCount = 0, Sorting = string.Empty }, true).ConfigureAwait(false);
new SfsBaseDataRequestInputBase() { Condition = new Condition() { Filters = new List<Filter>() }, MaxResultCount = 99, SkipCount = 0, Sorting = string.Empty }, true).ConfigureAwait(false);
//供应商窗口
var supplierTimeWindowDtos = await _supplierTimeWindowAppService.GetListBySupplierCodeAsync(purchaseOrder.SupplierCode).ConfigureAwait(false);
//一次性返回所有物品信息
var itemBasicDtos = await _itemBasicAppService.GetByCodesAsync(itemCodes).ConfigureAwait(false);
var ItemPacks = new List<ItemPackDTO>();//一次性返回所有物品包装信息
var supplierItemDtos = new List<SupplierItemDTO>();//一次性返回所有供应商物品信息
//供应商信息
var supplierDto =await _supplierAppService.GetByCodeAsync(purchaseOrder.SupplierCode).ConfigureAwait(false);
//所有的标签
List<InventoryLabelEditInput> inventoryLabelEditInputs = new List<InventoryLabelEditInput>();
foreach (var itemCode in itemCodes)//查询
{
var itemPackDtos = await _itemPackAppService.GetListByItemCodeAsync(itemCode).ConfigureAwait(false);
var itemPackDto = itemPackDtos.First();
var supplierItem = await _supplierItemAppService.GetBySupplierCodeAndItemCodeAsync(purchaseOrder.SupplierCode, itemCode).ConfigureAwait(false);
ItemPacks.Add(itemPackDto);
supplierItemDtos.Add(supplierItem);
}
#region 主表赋值
//收货口 //todo 处理有问题是否要和供应商关联
supplierAsnEditInput.DockCode = dock.First().Code;
//赋值采购订单编号
@ -119,7 +152,6 @@ public class PurchaseOrderEventHandler
supplierAsnEditInput.CreateType = EnumSupplierAsnCreateType.Import;
//供应商时间窗口
var supplierTimeWindowDtos=await _supplierTimeWindowAppService.GetListBySupplierCodeAsync(purchaseOrder.SupplierCode).ConfigureAwait(false);
var dayOfWeek = new List<string>() { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
var chineseWeek= dayOfWeek[Clock.Now.DayOfWeek.GetHashCode()]; //中文星期
var dateTimeWindowDto=supplierTimeWindowDtos.First(p => p.Week == chineseWeek);
@ -131,67 +163,162 @@ public class PurchaseOrderEventHandler
//发货单号
supplierAsnEditInput.Number = await _supplierAsnAppService.GenerateSupplierAsnNumberAsync(supplierAsnEditInput.ActiveDate).ConfigureAwait(false);
//所有的物品Code
var itemCodes = purchaseOrder.Details.GroupBy(p => p.ItemCode).Select(p => p.Key);
#endregion
//一次性返回所有物品信息
var itemBasicDtos=await _itemBasicAppService.GetByCodesAsync(itemCodes).ConfigureAwait(false);
var ItemPacks = new List<ItemPackDTO>();//一次性返回所有物品包装信息
var supplierItemDtos = new List<SupplierItemDTO>();//一次性返回所有供应商物品信息
//根据采购订单的数量拆分成多个 箱
foreach (var purchaseOrderDetaildetail in purchaseOrder.Details)
{
//当前物品的总数
var itemQty = purchaseOrderDetaildetail.Qty;
//一次性返回所有箱码
var generateManyAsync = await _labelDefinitionAppService
.GenerateManyAsync(EnumLabelType.PurchaseLabel.ToString(), Clock.Now.ToString(SharedConst.TimeFormat),
supplierAsnEditInput.Details.Count).ConfigureAwait(false);
//todo 一个物品多个包装?怎么取值
//标包数
var itemPackDto=ItemPacks.First(p => p.ItemCode == purchaseOrderDetaildetail.ItemCode);
foreach (var itemCode in itemCodes)//查询
//总箱数
var itemPackQty = (int)(itemQty / itemPackDto.Qty);
if (itemQty % itemPackQty!= 0)
{
var itemPackDtos = await _itemPackAppService.GetListByItemCodeAsync(itemCode).ConfigureAwait(false);
var itemPackDto = itemPackDtos.First();
var supplierItem = await _supplierItemAppService.GetBySupplierCodeAndItemCodeAsync(purchaseOrder.SupplierCode, itemCode).ConfigureAwait(false);
ItemPacks.Add(itemPackDto);
supplierItemDtos.Add(supplierItem);
itemPackQty++;
}
//赋值 详情表
supplierAsnEditInput.Details.ForEach(detail =>
{
var purchaseOrderDetail= purchaseOrder.Details.First(p => p.ItemCode == detail.ItemCode);
//添加物品信息
var itemBasicDto = itemBasicDtos.First(p => p.Code == purchaseOrderDetaildetail.ItemCode);
//供应商物品
var supplierItemDto = supplierItemDtos.First(p =>
p.ItemCode == purchaseOrderDetaildetail.ItemCode && p.SupplierCode == purchaseOrder.SupplierCode);
//一次性返回所有箱码
var generateManyAsync = await _labelDefinitionAppService
.GenerateManyAsync(EnumLabelType.PurchaseLabel.ToString(), Clock.Now.ToString(SharedConst.TimeFormat),
itemPackQty).ConfigureAwait(false);
for (var i = 0; i < itemPackQty; i++)
{
var supplierAsnDetailInput = ObjectMapper.Map<PurchaseOrderDetail, SupplierAsnDetailInput>(purchaseOrderDetaildetail);
//添加箱码
var pakcingCode = generateManyAsync.First();
detail.PackingCode = pakcingCode;
supplierAsnDetailInput.PackingCode = pakcingCode;
generateManyAsync.Remove(pakcingCode);
//添加物品信息
var itemBasicDto= itemBasicDtos.First(p=>p.Code==detail.ItemCode);
detail.ItemName= itemBasicDto.Name;
detail.ItemDesc1 = itemBasicDto.Desc1;
detail.ItemDesc2= itemBasicDto.Desc2;
supplierAsnDetailInput.ItemName = itemBasicDto.Name;
supplierAsnDetailInput.ItemDesc1 = itemBasicDto.Desc1;
supplierAsnDetailInput.ItemDesc2 = itemBasicDto.Desc2;
//标包
var itemPack = ItemPacks.First(p => p.ItemCode == detail.ItemCode); //todo 一个物品多个包装?怎么取值
detail.StdPackQty = itemPack.Qty;
supplierAsnDetailInput.StdPackQty = itemPackDto.Qty;
//供应商物品
var supplierItemDto=supplierItemDtos.First(p =>
p.ItemCode == detail.ItemCode && p.SupplierCode == supplierAsnEditInput.SupplierCode);
detail.SupplierPackQty = supplierItemDto.SupplierPackQty;
detail.SupplierPackUom= supplierItemDto.SupplierPackUom;
supplierAsnDetailInput.SupplierPackQty = supplierItemDto.SupplierPackQty;
supplierAsnDetailInput.SupplierPackUom = supplierItemDto.SupplierPackUom;
//todo 批次赋值有问题
detail.SupplierBatch = purchaseOrderDetail.Lot;
supplierAsnDetailInput.SupplierBatch = purchaseOrderDetaildetail.Lot;
//订单行
detail.PoLine = purchaseOrderDetail.PoLine;
supplierAsnDetailInput.PoLine = purchaseOrderDetaildetail.PoLine;
//推荐ERP库位
detail.RecommendErpCode = purchaseOrderDetail.LocationErpCode;
supplierAsnDetailInput.RecommendErpCode = purchaseOrderDetaildetail.LocationErpCode;
supplierAsnDetailInput.PoNumber = purchaseOrder.Number;
supplierAsnDetailInput.Qty = itemQty>itemPackDto.Qty ? itemPackDto.Qty : itemQty;
itemQty-=itemPackDto.Qty;
detail.PoNumber = purchaseOrder.Number;
});
var InventoryLabelEditInput = await BuildInventoryLabelEditInputAsync(supplierAsnEditInput, supplierAsnDetailInput, supplierDto, itemBasicDto, supplierItemDto, itemPackDto).ConfigureAwait(false);
inventoryLabelEditInputs.Add(InventoryLabelEditInput);
supplierAsnEditInput.Details.Add(supplierAsnDetailInput);
}
}
//插入所有的标签
await _inventoryLabelAppService.CreateManyByNoCodeAsync(inventoryLabelEditInputs).ConfigureAwait(false);
//赋值 详情表
return supplierAsnEditInput;
}
/// <summary>
/// 创建 构造标签
/// </summary>
/// <param name="supplierAsn"></param>
/// <param name="supplierAsnDetail"></param>
/// <param name="supplierDto"></param>
/// <param name="itemBasicDto"></param>
/// <param name="supplierItemDto"></param>
/// <param name="itemPackDto"></param>
/// <returns></returns>
private Task<InventoryLabelEditInput> BuildInventoryLabelEditInputAsync(SupplierAsnEditInput supplierAsn,
SupplierAsnDetailInput supplierAsnDetail,
SupplierDTO supplierDto,
ItemBasicDTO itemBasicDto,
SupplierItemDTO supplierItemDto,
ItemPackDTO itemPackDto)
{
if (itemBasicDto == null)
{
throw new UserFriendlyException($"{supplierAsnDetail.ItemCode}零件信息为空");
}
if (supplierDto == null)
{
throw new UserFriendlyException($"{supplierAsn.SupplierCode}供应商为空");
}
if (supplierItemDto == null)
{
throw new UserFriendlyException($"{supplierAsn.SupplierCode}供应商零件或{itemBasicDto.Code}零件信息为空");
}
var inputLabel = new InventoryLabelEditInput();
inputLabel.LabelType = EnumLabelType.PurchaseLabel;
inputLabel.SupplierCode = supplierAsn.SupplierCode;
inputLabel.RpNumber = supplierAsn.RpNumber;
inputLabel.AsnNumber = supplierAsn.Number;
inputLabel.PoNumber = supplierAsnDetail.PoNumber;
inputLabel.SupplierBatch = supplierAsnDetail.SupplierBatch;
inputLabel.ProduceDate = supplierAsnDetail.ProduceDate;
inputLabel.ArriveDate = supplierAsnDetail.ArriveDate;
inputLabel.FullBarcodeString = supplierAsnDetail.PackingCode;
inputLabel.LocationErpCode = supplierAsnDetail.RecommendErpCode;
inputLabel.Lot = supplierAsnDetail.Lot;
inputLabel.RecommendLocationCode = supplierAsnDetail.RecommendErpCode;
inputLabel.Remark = supplierAsnDetail.Remark;
inputLabel.Code = supplierAsnDetail.PackingCode;
inputLabel.Qty = supplierAsnDetail.Qty;
inputLabel.Uom = supplierAsnDetail.Uom;
inputLabel.ItemCode = itemBasicDto.Code;
inputLabel.ItemName = itemBasicDto.Name;
inputLabel.ItemDesc1 = itemBasicDto.Desc1;
inputLabel.ItemDesc2 = itemBasicDto.Desc2;
inputLabel.ExpireDate = DateTime.Now.AddDays(itemBasicDto.GetValidateDays());
inputLabel.ExtraProperties = new ExtraPropertyDictionary();
inputLabel.LabelStatus = LabelStatus.Enable;
inputLabel.Specifications = itemBasicDto.Color;
inputLabel.StdPackQty = itemPackDto.Qty;
inputLabel.SupplierItemCode = supplierItemDto.SupplierItemCode;
inputLabel.SupplierItemName = supplierItemDto.ItemName;
inputLabel.SupplierName = supplierDto.Name;
inputLabel.SupplierSimpleName = supplierDto.ShortName;
inputLabel.Team = string.Empty;
inputLabel.ProdLine = string.Empty;
inputLabel.QLevel = string.Empty;
inputLabel.QualityFile = string.Empty;
inputLabel.Shift = string.Empty;
inputLabel.ContainerCode = string.Empty;
return Task.FromResult(inputLabel);
}
#endregion
}

22
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/PurchaseReceiptRequestEventHandler.cs

@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Castle.Components.DictionaryAdapter;
using Volo.Abp;
using Volo.Abp.EventBus;
using Volo.Abp.SettingManagement;
@ -123,16 +124,29 @@ public class PurchaseReceiptRequestEventHandler
job.Priority = PriorityHelper.GetPriority(Clock);
job.PriorityIncrement = 1;
var jobDetails = ObjectMapper.Map<List<PurchaseReceiptRequestDetail>, List<PurchaseReceiptJobDetailInput>>(details);
foreach (var jobDetail in jobDetails)
job.Details = new List<PurchaseReceiptJobDetailInput>();
foreach (var detail in details)
{
var jobDetail = ObjectMapper.Map<PurchaseReceiptRequestDetail,PurchaseReceiptJobDetailInput>(detail);
jobDetail.PurchaseReceiptInspectStatus = EnumPurchaseReceiptInspect.INSP;
jobDetail.Status = EnumInventoryStatus.INSP;
jobDetail.RecommendToLocationErpCode = location.ErpLocationCode;
jobDetail.RecommendToLocationCode = location.Code;
jobDetail.RecommendToLocationErpCode = location.ErpLocationCode;
jobDetail.RecommendToWarehouseCode= location.WarehouseCode;
jobDetail.RecommendToLocationArea= location.AreaCode;
jobDetail.RecommendToLocationGroup = location.LocationGroupCode;
jobDetail.RecommendErpCode = detail.RecommendErpCode;
jobDetail.RecommendArriveDate = detail.ArriveDate;
jobDetail.RecommendContainerCode = detail.ContainerCode;
jobDetail.RecommendExpireDate= detail.ExpireDate;
jobDetail.RecommendLot= detail.Lot;
job.Details.Add(jobDetail);
}
job.Details = jobDetails;
return job;
}

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

@ -7,11 +7,26 @@ public partial class StoreEventAutoMapperProfile : Profile
public StoreEventAutoMapperProfile()
{
#region Orders
//采购订单
PurchaseOrderAutoMapperProfile();
#endregion
#region plan
//发货单
SupplierAsnAutoMapperProfile();
#endregion
#region request
//到货单
PurchaseReceiptRequestAutoMapperProfile();
#endregion
InspectRequestAutoMapperProfile();
BackFlushNoteAutoMapperProfile();
CountAdjustNoteAutoMapperProfile();
@ -37,7 +52,7 @@ public partial class StoreEventAutoMapperProfile : Profile
PutawayNoteAutoMapperProfile();
RecycledMaterialReceiptNoteAutoMapperProfile();
ScrapNoteAutoMapperProfile();
SupplierAsnAutoMapperProfile();
UnplannedIssueNoteAutoMapperProfile();
UnplannedIssueRequestAutoMapperProfile();
UnplannedReceiptNoteAutoMapperProfile();

53
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/PurchaseReceiptNoteEventHandler.cs

@ -29,6 +29,7 @@ public class PurchaseReceiptNoteEventHandler
private readonly IInspectRequestAppService _inspectRequestAppService;
private readonly IPurchaseOrderAppService _purchaseOrderAppService;
private readonly IItemQualityAppService _itemQualityAppService;
private readonly ISupplierAsnAppService _supplierAsnAppService;
/// <summary>
/// 收货记录
@ -37,14 +38,15 @@ public class PurchaseReceiptNoteEventHandler
/// <param name="purchaseOrderAppService"></param>
/// <param name="itemQualityAppService"></param>
public PurchaseReceiptNoteEventHandler(
IInspectRequestAppService inspectRequestAppService
, IPurchaseOrderAppService purchaseOrderAppService
, IItemQualityAppService itemQualityAppService
)
IInspectRequestAppService inspectRequestAppService,
IPurchaseOrderAppService purchaseOrderAppService,
IItemQualityAppService itemQualityAppService,
ISupplierAsnAppService supplierAsnAppService)
{
_inspectRequestAppService = inspectRequestAppService;
_purchaseOrderAppService = purchaseOrderAppService;
_itemQualityAppService = itemQualityAppService;
_supplierAsnAppService = supplierAsnAppService;
}
/// <summary>
@ -67,24 +69,43 @@ public class PurchaseReceiptNoteEventHandler
//更新订单已收货数量
await UpdatePurchaseOrderAsync(entity).ConfigureAwait(false);
//更新发货单状态
await UpdateSupplierAsnAsync(entity.AsnNumber).ConfigureAwait(false);
}
/// <summary>
/// 更新采购订单 已收货数量
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
private async Task UpdatePurchaseOrderAsync(PurchaseReceiptNote entity)
{
var purchaseOrderDetailUpdateInputs = entity.Details
.Select(BuildPurchaseOrderDetailUpdateInput).ToList();
var purchaseOrderDetailUpdateInputs = new List<PurchaseOrderDetailUpdateInput>();
foreach (var detail in entity.Details)
{
var purchaseOrderDetailUpdateInput = new PurchaseOrderDetailUpdateInput()
{
PoLine = detail.PoLine,
ItemCode = detail.ItemCode,
ReceivedQty = detail.Qty,
};
purchaseOrderDetailUpdateInputs.Add(purchaseOrderDetailUpdateInput);
}
await _purchaseOrderAppService.UpdateDetailsAsync(entity.PoNumber, purchaseOrderDetailUpdateInputs).ConfigureAwait(false);
}
private static PurchaseOrderDetailUpdateInput BuildPurchaseOrderDetailUpdateInput(PurchaseReceiptNoteDetail purchaseReceiptNoteDetail)
{
return new PurchaseOrderDetailUpdateInput()
/// <summary>
/// 更新 发货单状态
/// </summary>
/// <param name="asnNumber"></param>
/// <returns></returns>
private async Task UpdateSupplierAsnAsync(string asnNumber)
{
PoLine = purchaseReceiptNoteDetail.PoLine,
ItemCode = purchaseReceiptNoteDetail.ItemCode,
ReceivedQty = purchaseReceiptNoteDetail.Qty,
};
await _supplierAsnAppService.UpdateStatusAsync(asnNumber,EnumSupplierAsnStatus.Received).ConfigureAwait(false);
}
#region 私有
@ -230,7 +251,7 @@ public class PurchaseReceiptNoteEventHandler
/// <returns></returns>
private async Task<InspectRequestEditInput> BuildInspectRequestAsync(PurchaseReceiptNote entity, Dictionary<string, EnumInspectType> dictionary)
{
//过滤出去 其他装填 只保留目检合格的 因为只有 目检合格的 需要继续质检
//过滤出去 其他状态 只保留目检合格的 因为只有 目检合格的 需要继续质检
var packingCodeList = entity.Details.Where(p => p.PurchaseReceiptInspectStatus == EnumPurchaseReceiptInspect.OK).Select(p => p.PackingCode);
var createInput = ObjectMapper.Map<PurchaseReceiptNote, InspectRequestEditInput>(entity);
@ -284,6 +305,7 @@ public class PurchaseReceiptNoteEventHandler
{
p.LocationCode = inspectLocation.Code;
p.LocationErpCode = inspectLocation.ErpLocationCode;
p.WarehouseCode = inspectLocation.WarehouseCode;
});
}
@ -332,6 +354,9 @@ public class PurchaseReceiptNoteEventHandler
CrackQty = 0,
FailedQty = 0,
NotPassedQty = 0,
WarehouseCode = template.WarehouseCode,
LocationArea = template.LocationArea,
LocationGroup = template.LocationGroup,
};
return inspectRequestSummaryDetailInput;
}

Loading…
Cancel
Save