马昊 2 years ago
parent
commit
8fecc9040f
  1. 2
      be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.StoreDbContext.sql
  2. 2
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/WorkCenters/WorkCenter.cs
  3. 30
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Event/appsettings.json
  4. 2
      be/Modules/Label/src/Win_in.Sfs.Label.Application.Contracts/InventoryLabels/InventoryLabelEditInput.cs
  5. 15
      be/Modules/Label/src/Win_in.Sfs.Label.Application/InventoryLabels/InventoryLabelAppService.cs
  6. 10
      be/Modules/Label/src/Win_in.Sfs.Label.Application/InventoryLabels/InventoryLabelAutoMapperProfile.cs
  7. 30
      be/Modules/Message/src/Win_in.Sfs.Message.Event/appsettings.json
  8. 20
      be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs
  9. 2
      be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/Interfaces/IHasLocationSwitch.cs
  10. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/DTOs/PurchaseOrderDetailDTO.cs
  11. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/Inputs/PurchaseOrderDetailInput.cs
  12. 16
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/Inputs/PurchaseOrderImportInput.cs
  13. 7
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/SupplierAsns/ISupplierAsnAppService.cs
  14. 12
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Bases/SfsJobAppServiceBase.cs
  15. 23
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/Project/FuWeiDongYang/FuWeiDongYang_PurchaseOrderAppService.cs
  16. 64
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs
  17. 12
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAutoMapperProfile.cs
  18. 32
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/SupplierAsns/SupplierAsnAppService.cs
  19. 14
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/PurchaseReceiptRequests/PurchaseReceiptRequestAutoMapperProfile.cs
  20. 4
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreManagerBase.cs
  21. 25
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRequestManagerBase.cs
  22. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/InspectJobs/InspectJobManager.cs
  23. 12
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/SfsJobManagerBase.cs
  24. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/InspectNotes/InspectNoteManager.cs
  25. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/IssueNoteManager.cs
  26. 4
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/PurchaseReceiptNotes/PurchaseReceiptNoteManager.cs
  27. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/PurchaseReturnNotes/PurchaseReturnNoteManager.cs
  28. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/TransferNotes/TransferNoteManager.cs
  29. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Orders/PurchaseOrders/PurchaseOrderDetail.cs
  30. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs
  31. 4
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20230401163806_Added_AddPurchaseOrder.Designer.cs
  32. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20230401163806_Added_AddPurchaseOrder.cs
  33. 4
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/StoreDbContextModelSnapshot.cs
  34. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Orders/PurchaseOrderAutoMapperProfile.cs
  35. 52
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Orders/PurchaseOrderEventHandler.cs
  36. 232
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Plans/SupplierAsnEventHandler.cs
  37. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/PurchaseReceiptRequestEventHandler.cs

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

@ -4159,7 +4159,7 @@ CREATE TABLE [Store_PurchaseOrderDetail] (
[ReceivedQty] decimal(18,6) NOT NULL,
[ReturnedQty] decimal(18,6) NOT NULL,
[PutAwayQty] decimal(18,6) NOT NULL,
[ContactUserCode] nvarchar(max) NULL,
[PlanUserCode] nvarchar(max) NULL,
[Lot] nvarchar(max) NULL,
[PlanArriveDate] datetime2 NOT NULL,
[Ctype] nvarchar(max) NULL,

2
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/WorkCenters/WorkCenter.cs

@ -10,7 +10,7 @@ namespace Win_in.Sfs.Basedata.Domain;
/// </summary>
public class WorkStation : SfsBaseDataAggregateRootBase, IHasCode, IHasName
{
[Display(Name = "码")]
[Display(Name = "工作中心代码")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
[IgnoreUpdate]

30
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Event/appsettings.json

@ -1,17 +1,17 @@
{
"RabbitMQ": {
"Connections": {
"Default": {
"HostName": "127.0.0.1",
"Port": 5672,
"UserName": "admin",
"Password": "admin",
"VirtualHost": "my_vhost"
}
},
"EventBus": {
"ClientName": "Inventory",
"ExchangeName": "InventoryMessages"
}
}
//"RabbitMQ": {
// "Connections": {
// "Default": {
// "HostName": "127.0.0.1",
// "Port": 5672,
// "UserName": "admin",
// "Password": "admin",
// "VirtualHost": "my_vhost"
// }
// },
// "EventBus": {
// "ClientName": "Inventory",
// "ExchangeName": "InventoryMessages"
// }
//}
}

2
be/Modules/Label/src/Win_in.Sfs.Label.Application.Contracts/InventoryLabels/InventoryLabelEditInput.cs

@ -203,6 +203,7 @@ public class InventoryLabelEditInput : SfsLabelCreateOrUpdateInputBase
/// </summary>
[Display(Name = "供应商零件名")]
public string SupplierItemName { get; set; }
#endregion
#region Create
@ -219,5 +220,6 @@ public class InventoryLabelEditInput : SfsLabelCreateOrUpdateInputBase
[Display(Name = "标签类型")]
[Required(ErrorMessage = "{0}是必填项")]
public EnumLabelType LabelType { get; set; }
#endregion
}

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

@ -60,17 +60,14 @@ public class InventoryLabelAppService
[HttpPost("many")]
public virtual async Task<List<InventoryLabelDto>> CreateManyAsync(List<InventoryLabelEditInput> inputs)
{
var codes = inputs.Select(p => p.Code).ToList();
var existEntities = await GetByCodesAsync(codes).ConfigureAwait(false);
if (existEntities.Any())
List<InventoryLabelDto> inventoryLabelDtos = new List<InventoryLabelDto>();
foreach (var input in inputs)
{
var existCodes = existEntities.Select(p => p.Code).ToList();
throw new UserFriendlyException($"{existCodes.JoinAsString(",")} 已存在");
inventoryLabelDtos.Add(await CreateAsync(input));
}
var entities = ObjectMapper.Map<List<InventoryLabelEditInput>, List<InventoryLabel>>(inputs);
await Repository.InsertManyAsync(entities).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<InventoryLabel>, List<InventoryLabelDto>>(entities);
return dtos;
return inventoryLabelDtos;
}
[HttpPost("generate-and-create")]

10
be/Modules/Label/src/Win_in.Sfs.Label.Application/InventoryLabels/InventoryLabelAutoMapperProfile.cs

@ -22,6 +22,16 @@ public class InventoryLabelAutoMapperProfile : Profile
.Ignore(x => x.Remark)
.Ignore(x => x.ExtraProperties);
CreateMap<InventoryLabelEditInput, InventoryLabel>()
.IgnoreAuditedObjectProperties()
.MapQualityInfoDto()
.MapPurchaseInfoDto()
.MapProductionInfoDto()
.Ignore(x=>x.Id)
.Ignore(x => x.ConcurrencyStamp)
;
CreateMap<InventoryLabelImportInput, InventoryLabel>()
.IgnoreAuditedObjectProperties()
.MapPurchaseInfoDto()

30
be/Modules/Message/src/Win_in.Sfs.Message.Event/appsettings.json

@ -1,19 +1,19 @@
{
"RabbitMQ": {
"Connections": {
"Default": {
"HostName": "127.0.0.1",
"Port": 5672,
"UserName": "admin",
"Password": "admin",
"VirtualHost": "my_vhost"
}
},
"EventBus": {
"ClientName": "Store",
"ExchangeName": "StoreMessages"
}
},
//"RabbitMQ": {
// "Connections": {
// "Default": {
// "HostName": "127.0.0.1",
// "Port": 5672,
// "UserName": "admin",
// "Password": "admin",
// "VirtualHost": "my_vhost"
// }
// },
// "EventBus": {
// "ClientName": "Store",
// "ExchangeName": "StoreMessages"
// }
//},
"Settings": {
"CreateMessageJob": true
}

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

@ -12,8 +12,10 @@ using System.Threading;
using System.Threading.Tasks;
using AutoMapper.Internal;
using DocumentFormat.OpenXml.Math;
using DocumentFormat.OpenXml.Office2010.ExcelAc;
using DocumentFormat.OpenXml.Spreadsheet;
using DocumentFormat.OpenXml.Vml.Office;
using DocumentFormat.OpenXml.Wordprocessing;
using EFCore.BulkExtensions;
using JetBrains.Annotations;
using Microsoft.AspNetCore.Http;
@ -329,12 +331,13 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq
/// </summary>
[HttpPost("import")]
[Consumes("multipart/form-data")]
[UnitOfWork]
public virtual async Task<IActionResult> ImportAsync([FromForm] SfsImportRequestInput requestInput, [Required] IFormFile file)
{
using var ms = new MemoryStream();
await file.OpenReadStream().CopyToAsync(ms).ConfigureAwait(false);
var inputFileBytes = ms.GetAllBytes();
var result = await ImportInternalAsync(requestInput, inputFileBytes).ConfigureAwait(false);
var result = await ImportInternalAsync(requestInput, inputFileBytes);
var bytes = result.FileContents;
result.FileContents = null;
@ -507,6 +510,7 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq
/// <summary>
/// 导入数据具体实现,可重写
/// </summary>
[UnitOfWork]
protected virtual async Task<SfsImportResult> ImportInternalAsync(SfsImportRequestInput requestInput, byte[] inputFileBytes)
{
IList<TImportInput> modelList = null;
@ -552,18 +556,20 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq
// 批量更新
if (entityDict.Any())
{
//加工数据
entityDict=await ImportProcessingEntityAsync(entityDict);
// 调用批量验证
var entityListStatus = await ValidateImportEntities(entityDict).ConfigureAwait(false);
if (entityListStatus)
{
//将需要新增的数据进行发布
var addList = entityDict.Where(p => p.Value == EntityState.Added).Select(p => p.Key).ToList();
//一定要 先发布 在导入 否则没有事务性了 只针对于导入
await PublishCreatedAsync(addList).ConfigureAwait(false);
await SaveImportAsync(entityDict).ConfigureAwait(false);
}
}
await PublishCreatedAsync(entityDict.Keys.ToList());
// 创建导入报告
var reportFile = ExportImportService.GetImportReport(inputFileBytes, modelDict);
// 创建返回值
@ -620,7 +626,7 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq
}
/// <summary>
/// 导入数据后 发布事件
/// 发布新增事件
/// </summary>
/// <param name="entities"></param>
/// <returns></returns>
@ -628,7 +634,7 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq
{
try
{
await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData<List<TEntity>>(entities),true).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData<List<TEntity>>(entities),false).ConfigureAwait(false);
}
catch (Exception ex)
{
@ -651,6 +657,7 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq
/// <summary>
/// 导入保存到数据库,可重写
/// </summary>
protected virtual async Task SaveImportAsync(Dictionary<TEntity, EntityState> dict)
{
var entityList = dict.Keys.ToList();
@ -675,6 +682,7 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq
SetOutputIdentity = true,
PreserveInsertOrder = true
};
await context.BulkInsertOrUpdateAsync(entityList, bulkConfig).ConfigureAwait(false);
await context.BulkInsertAsync(list).ConfigureAwait(false);
}

2
be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/Interfaces/IHasLocationSwitch.cs

@ -7,7 +7,7 @@ public interface IHasLocationSwitch
public bool EnableMixStatus { get; set; } // 可以混状态
public bool EnableNegative { get; set; } // 可以负库存
public bool EnableKeepZero { get; set; } // 可以保留零库存
public bool EnableOpportunityCount { get; set; } // 可以机会盘点
public bool EnableOpportunityCount { get; set; } // 可以机会盘点(动态盘点)
public bool EnablePick { get; set; } // 可以领料
public bool EnableOverPick { get; set; } // 可以过量领料
public bool EnableWholeStore { get; set; } // 可以整包存储

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/DTOs/PurchaseOrderDetailDTO.cs

@ -85,7 +85,7 @@ public class PurchaseOrderDetailDTO : SfsStoreDetailWithQtyDTOBase
/// 筹措员代码
/// </summary>
[Display(Name = "明细-筹措员代码")]
public string ContactUserCode { get; set; }
public string PlanUserCode { get; set; }
/// <summary>
/// 生产批次

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/Inputs/PurchaseOrderDetailInput.cs

@ -66,7 +66,7 @@ public class PurchaseOrderDetailInput : SfsStoreDetailWithQtyInputBase
/// 筹措员代码
/// </summary>
[Display(Name = "明细-筹措员代码")]
public string ContactUserCode { get; set; }
public string PlanUserCode { get; set; }
/// <summary>
/// 生产批次

16
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/Inputs/PurchaseOrderImportInput.cs

@ -21,6 +21,7 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase
[Display(Name = "采购订单号")]
[Key]
public string Number { get; set; }
/// <summary>
/// 供应商代码
/// </summary>
@ -31,7 +32,6 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase
/// 订单类型
/// </summary>
[Display(Name = "订单类型")]
public string PoType { get; set; }
/// <summary>
@ -68,8 +68,8 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase
/// 版本
/// </summary>
[Display(Name = "版本")]
public string Version { get; set; }
/// <summary>
/// 税率
/// </summary>
@ -82,6 +82,7 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase
/// </summary>
[Display(Name = "仓库代码")]
public string WarehouseCode { get; set; }
/// <summary>
/// 明细-订单行
/// </summary>
@ -106,6 +107,7 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase
/// </summary>
[Display(Name = "明细-数量计量单位")]
public string Uom { get; set; }
/// <summary>
/// 明细-标准包装数量
/// </summary>
@ -133,11 +135,18 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase
[Required(ErrorMessage = "{0}是必填项")]
public decimal ConvertRate { get; set; }
/// <summary>
/// ERP库位
/// </summary>
[Display(Name = "明细-ERP库位")]
[Required(ErrorMessage = "{0}是必填项")]
public string LocationErpCode { get; set; }
/// <summary>
/// 筹措员代码
/// </summary>
[Display(Name = "明细-筹措员代码")]
public string ContactUserCode { get; set; }
public string PlanUserCode { get; set; }
/// <summary>
/// 生产批次
@ -204,5 +213,4 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase
/// </summary>
[Display(Name = "联系人邮箱")]
public string ContactEmail { get; set; }
}

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

@ -24,4 +24,11 @@ public interface ISupplierAsnAppService
Task<List<SupplierAsnDTO>> GetForTodayUnReceivedListAsync();
Task<List<SupplierAsnDTO>> GetByStartTimeEndTimeAsync(DateTime startTime, DateTime endTime);
/// <summary>
/// 生成ASN订单号
/// </summary>
/// <param name="activeDate"></param>
/// <returns></returns>
Task<string> GenerateSupplierAsnNumberAsync(DateTime activeDate);
}

12
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Bases/SfsJobAppServiceBase.cs

@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Uow;
using Volo.Abp.Validation;
using Win_in.Sfs.Shared.Application;
using Win_in.Sfs.Shared.Application.Contracts;
@ -51,6 +52,7 @@ public abstract class SfsJobAppServiceBase<TEntity, TDetail, TEntityDto, TReques
/// <param name="input">任务Input</param>
/// <returns></returns>
[HttpPost("")]
[UnitOfWork]
public override async Task<TEntityDto> CreateAsync(TCreateInput input)
{
var entity = input.ToObject<TEntity>();
@ -66,6 +68,7 @@ public abstract class SfsJobAppServiceBase<TEntity, TDetail, TEntityDto, TReques
/// <param name="inputs">任务Input列表</param>
/// <returns></returns>
[HttpPost("add-many")]
[UnitOfWork]
public virtual async Task<List<TEntityDto>> CreateManyAsync(List<TCreateInput> inputs)
{
var entities = inputs.ToObject<List<TEntity>>();
@ -80,6 +83,7 @@ public abstract class SfsJobAppServiceBase<TEntity, TDetail, TEntityDto, TReques
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("cancel/{id}")]
[UnitOfWork]
public virtual async Task CancelAsync(Guid id)
{
var entity = await GetEntityAsync(id).ConfigureAwait(false);
@ -92,6 +96,7 @@ public abstract class SfsJobAppServiceBase<TEntity, TDetail, TEntityDto, TReques
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("accept/{id}")]
[UnitOfWork]
public virtual async Task AcceptAsync(Guid id)
{
var entity = await GetEntityAsync(id).ConfigureAwait(false);
@ -104,6 +109,7 @@ public abstract class SfsJobAppServiceBase<TEntity, TDetail, TEntityDto, TReques
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("open/{id}")]
[UnitOfWork]
public virtual async Task OpenAsync(Guid id)
{
var entity = await GetEntityAsync(id).ConfigureAwait(false);
@ -116,6 +122,7 @@ public abstract class SfsJobAppServiceBase<TEntity, TDetail, TEntityDto, TReques
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("close/{id}")]
[UnitOfWork]
public virtual async Task CloseAsync(Guid id)
{
var entity = await GetEntityAsync(id).ConfigureAwait(false);
@ -128,6 +135,7 @@ public abstract class SfsJobAppServiceBase<TEntity, TDetail, TEntityDto, TReques
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("cancel-accept/{id}")]
[UnitOfWork]
public virtual async Task CancelAcceptAsync(Guid id)
{
var entity = await GetEntityAsync(id).ConfigureAwait(false);
@ -141,6 +149,7 @@ public abstract class SfsJobAppServiceBase<TEntity, TDetail, TEntityDto, TReques
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("handle/{id}")]
[UnitOfWork]
public virtual async Task<TEntityDto> CompleteAsync(Guid id, TEntityDto dto)
{
var handleEntity = ObjectMapper.Map<TEntityDto, TEntity>(dto);
@ -157,6 +166,7 @@ public abstract class SfsJobAppServiceBase<TEntity, TDetail, TEntityDto, TReques
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("check")]
[UnitOfWork]
public virtual async Task CheckAsync(string jobNumber, TEntityDto dto, TCheckInput input)
{
await Task.CompletedTask.ConfigureAwait(false);
@ -182,6 +192,7 @@ public abstract class SfsJobAppServiceBase<TEntity, TDetail, TEntityDto, TReques
/// <param name="itemCode"></param>
/// <returns></returns>
[HttpGet("check-job-exist-by-packing")]
[UnitOfWork]
public virtual async Task<List<TEntityDto>> CheckJobExistByPackingCode(string packingCode, string itemCode)
{
var entities = await _jobManager.GetWorkingListByPackingAsync(packingCode).ConfigureAwait(false);
@ -196,6 +207,7 @@ public abstract class SfsJobAppServiceBase<TEntity, TDetail, TEntityDto, TReques
/// <param name="itemCode"></param>
/// <returns></returns>
[HttpGet("check-job-exist-by-container")]
[UnitOfWork]
public virtual async Task<List<TEntityDto>> CheckJobExistByContainerCode(string containerCode, string itemCode)
{
var entities = await _jobManager.GetWorkingListByContainerAsync(containerCode).ConfigureAwait(false);

23
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/Project/FuWeiDongYang/FuWeiDongYang_PurchaseOrderAppService.cs

@ -1,23 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Wms.Store.Application;
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.Project;
namespace Win_in.Sfs.Wms.Store.Orders.PurchaseOrders.Project.FuWeiDongYang;
[Route($"{ProjectStoreConsts.RootPath}purchase-order-fuweidongyang")]
public class FuWeiDongYang_PurchaseOrderAppService:PurchaseOrderAppService
{
public FuWeiDongYang_PurchaseOrderAppService(IPurchaseOrderRepository repository, IPurchaseOrderManager purchaseOrderManager, ISupplierAppService supplierAppService) : base(repository, purchaseOrderManager, supplierAppService)
{
}
}

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

@ -3,14 +3,19 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using DocumentFormat.OpenXml.Office2010.ExcelAc;
using DocumentFormat.OpenXml.Spreadsheet;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using Volo.Abp.Uow;
using Volo.Abp.Users;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared;
@ -28,21 +33,57 @@ public class PurchaseOrderAppService :
private new readonly IPurchaseOrderRepository _repository;
private readonly IPurchaseOrderManager _purchaseOrderManager;
private readonly ISupplierAppService _supplierAppService;
private readonly IItemBasicAppService _itemBasicAppService;
public PurchaseOrderAppService(
IPurchaseOrderRepository repository,
IPurchaseOrderManager purchaseOrderManager
, ISupplierAppService supplierAppService
) : base(repository)
IPurchaseOrderManager purchaseOrderManager,
ISupplierAppService supplierAppService,
IItemBasicAppService itemBasicAppService) : base(repository)
{
_repository = repository;
_purchaseOrderManager = purchaseOrderManager;
_supplierAppService = supplierAppService;
_itemBasicAppService = itemBasicAppService;
base.CreatePolicyName = PurchaseOrderPermissions.Create;
base.UpdatePolicyName = PurchaseOrderPermissions.Update;
base.DeletePolicyName = PurchaseOrderPermissions.Delete;
}
#region 东阳使用
/// <summary>
/// 用来重写 导入数据时可以加工数据
/// </summary>
/// <param name="dictionary"></param>
/// <returns></returns>
protected override async Task<Dictionary<PurchaseOrder, EntityState>> ImportProcessingEntityAsync(
Dictionary<PurchaseOrder, EntityState> dictionary)
{
var addList= dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key);
foreach (var PurchaseOrder in addList)
{
PurchaseOrder.CreatorId = CurrentUser.Id;
PurchaseOrder.Worker = CurrentUser.Name;
foreach (var detail in PurchaseOrder.Details)
{
var itemBasicDto= await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
detail.ItemName= itemBasicDto.Name;
detail.ItemDesc1 = itemBasicDto.Desc1;
detail.ItemDesc2 = itemBasicDto.Desc2;
}
}
return dictionary;
}
#endregion
/// <summary>
/// 【创建】采购订单
/// </summary>
@ -89,23 +130,6 @@ public class PurchaseOrderAppService :
return ObjectMapper.Map<List<PurchaseOrder>, List<PurchaseOrderDTO>>(entityList);
}
/// <summary>
/// 用来重写 导入数据时可以加工数据
/// </summary>
/// <param name="dictionary"></param>
/// <returns></returns>
protected override Task<Dictionary<PurchaseOrder, EntityState>> ImportProcessingEntityAsync(
Dictionary<PurchaseOrder, EntityState> dictionary)
{
return base.ImportProcessingEntityAsync(dictionary);
}
[HttpPost("{id}/detail")]
public virtual async Task UpdateDetailsAsync(string number, List<PurchaseOrderDetailUpdateInput> inputs)
{

12
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAutoMapperProfile.cs

@ -28,7 +28,8 @@ public partial class StoreApplicationAutoMapperProfile : Profile
.Ignore(x => x.MasterID)
.Ignore(x => x.TenantId)
.Ignore(x => x.Number)
.Ignore(x => x.Id);
.Ignore(x => x.Id)
;
CreateMap<PurchaseOrderImportInput, PurchaseOrder>()
.IgnoreAuditedObjectProperties()
@ -46,16 +47,13 @@ public partial class StoreApplicationAutoMapperProfile : Profile
.Ignore(x => x.ReceivedQty)
.Ignore(x => x.ReturnedQty)
.Ignore(x => x.PutAwayQty)
.Ignore(x => x.ItemName).Ignore(x => x.ItemDesc1).Ignore(x => x.ItemDesc2)
.Ignore(x => x.LocationErpCode)
.Ignore(x => x.ItemName)
.Ignore(x => x.ItemDesc1)
.Ignore(x => x.ItemDesc2)
.Ignore(x => x.ProjectCode)
.Ignore(x => x.LineStatus)
.Ignore(x => x.TenantId)
.Ignore(x => x.MasterID)
.Ignore(x => x.ShippedQty)
.Ignore(x => x.ReceivedQty)
.Ignore(x => x.ReturnedQty)
.Ignore(x => x.PutAwayQty)
.Ignore(x => x.Id);
}
}

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

@ -7,6 +7,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Label.Application.Contracts;
using Win_in.Sfs.Label.Domain.Shared;
@ -35,13 +36,12 @@ public class SupplierAsnAppService :
private readonly ISupplierItemAppService _supplierItemAppService;
public SupplierAsnAppService(
ISupplierAsnRepository repository
, ISupplierAsnManager supplierAsnManager
, ISupplierAppService supplierAppService
, IDockAppService dockAppService
, ILabelDefinitionAppService labelDefinitionAppService
, ISupplierItemAppService supplierItemAppService
) : base(repository)
ISupplierAsnRepository repository,
ISupplierAsnManager supplierAsnManager,
ISupplierAppService supplierAppService,
IDockAppService dockAppService,
ILabelDefinitionAppService labelDefinitionAppService,
ISupplierItemAppService supplierItemAppService) : base(repository)
{
_repository = repository;
_supplierAsnManager = supplierAsnManager;
@ -50,12 +50,16 @@ public class SupplierAsnAppService :
_labelDefinitionAppService = labelDefinitionAppService;
_supplierItemAppService = supplierItemAppService;
}
#region 东阳使用
/// <summary>
/// 【创建】收货请求 (到货单、到货通知)
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("")]
[UnitOfWork]
public override async Task<SupplierAsnDTO> CreateAsync(SupplierAsnEditInput input)
{
var inputEntity = ObjectMapper.Map<SupplierAsnEditInput, SupplierAsn>(input);
@ -65,6 +69,20 @@ public class SupplierAsnAppService :
return ObjectMapper.Map<SupplierAsn, SupplierAsnDTO>(resultEntity);
}
#endregion
/// <summary>
/// 生成ASN订单号
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("generate-supplierasn-number")]
public async Task<string> GenerateSupplierAsnNumberAsync(DateTime activeDate)
{
return await _supplierAsnManager.GenerateNumberAsync(nameof(SupplierAsn), Clock.Normalize(activeDate))
.ConfigureAwait(false);
}
private async Task<SupplierAsnDTO> CreateFromFileAsync(SupplierAsnEditInput input)
{
var entity = ObjectMapper.Map<SupplierAsnEditInput, SupplierAsn>(input);

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

@ -42,5 +42,19 @@ public partial class StoreApplicationAutoMapperProfile : Profile
.Ignore(x => x.CreatorId)
.Ignore(x => x.TenantId)
.Ignore(x => x.Id);
CreateMap<PurchaseReceiptRequestEditInput, PurchaseReceiptRequest>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.ConcurrencyStamp)
.Ignore(x => x.Id)
.Ignore(x => x.TenantId)
;
CreateMap<PurchaseReceiptRequestDetailInput, PurchaseReceiptRequestDetail>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.Id)
.Ignore(x => x.TenantId)
;
}
}

4
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreManagerBase.cs

@ -121,7 +121,7 @@ public abstract class SfsStoreManagerBase<TEntity, TDetailEntity>
{
try
{
await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData<TEntity>(entity)).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData<TEntity>(entity),false).ConfigureAwait(false);
}
catch (Exception ex)
{
@ -136,7 +136,7 @@ public abstract class SfsStoreManagerBase<TEntity, TDetailEntity>
{
try
{
await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData<List<TEntity>>(entities)).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData<List<TEntity>>(entities), false).ConfigureAwait(false);
}
catch (Exception ex)
{

25
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRequestManagerBase.cs

@ -25,6 +25,7 @@ public abstract class SfsStoreRequestManagerBase<TEntity, TDetailEntity>
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[UnitOfWork]
public override async Task<TEntity> CreateAsync(TEntity entity)
{
entity.SetIdAndNumberWithDetails(GuidGenerator, await GenerateNumberAsync(typeof(TEntity).Name, entity.ActiveDate).ConfigureAwait(false));
@ -40,6 +41,7 @@ public abstract class SfsStoreRequestManagerBase<TEntity, TDetailEntity>
}
}
[UnitOfWork]
public override async Task<List<TEntity>> CreateManyAsync(List<TEntity> entities)
{
var results = new List<TEntity>();
@ -83,11 +85,12 @@ public abstract class SfsStoreRequestManagerBase<TEntity, TDetailEntity>
}
}
[UnitOfWork]
private async Task PublishSubmittedAsync(TEntity entity)
{
try
{
await LocalEventBus.PublishAsync(new SfsSubmittedEntityEventData<TEntity>(entity)).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsSubmittedEntityEventData<TEntity>(entity),false).ConfigureAwait(false);
}
catch (Exception ex)
{
@ -118,11 +121,12 @@ public abstract class SfsStoreRequestManagerBase<TEntity, TDetailEntity>
}
}
[UnitOfWork]
private async Task PublishAgreedAsync(TEntity entity)
{
try
{
await LocalEventBus.PublishAsync(new SfsAgreedEntityEventData<TEntity>(entity)).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsAgreedEntityEventData<TEntity>(entity),false).ConfigureAwait(false);
}
catch (Exception ex)
{
@ -146,11 +150,12 @@ public abstract class SfsStoreRequestManagerBase<TEntity, TDetailEntity>
return await Repository.UpdateAsync(entity).ConfigureAwait(false);
}
[UnitOfWork]
private async Task PublishRefusedAsync(TEntity entity)
{
try
{
await LocalEventBus.PublishAsync(new SfsRefusedEntityEventData<TEntity>(entity)).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsRefusedEntityEventData<TEntity>(entity),false).ConfigureAwait(false);
}
catch (Exception ex)
{
@ -174,11 +179,12 @@ public abstract class SfsStoreRequestManagerBase<TEntity, TDetailEntity>
return await AddOrUpdateAsync(entity).ConfigureAwait(false);
}
[UnitOfWork]
protected virtual async Task PublishHandledAsync(TEntity entity)
{
try
{
await LocalEventBus.PublishAsync(new SfsHandledEntityEventData<TEntity>(entity)).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsHandledEntityEventData<TEntity>(entity), false).ConfigureAwait(false);
}
catch (Exception ex)
{
@ -197,11 +203,12 @@ public abstract class SfsStoreRequestManagerBase<TEntity, TDetailEntity>
return await Repository.UpdateAsync(entity).ConfigureAwait(false);
}
[UnitOfWork]
private async Task PublishCompletedAsync(TEntity entity)
{
try
{
await LocalEventBus.PublishAsync(new SfsCompletedEntityEventData<TEntity>(entity)).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsCompletedEntityEventData<TEntity>(entity), false).ConfigureAwait(false);
}
catch (Exception ex)
{
@ -220,11 +227,12 @@ public abstract class SfsStoreRequestManagerBase<TEntity, TDetailEntity>
return await Repository.UpdateAsync(entity).ConfigureAwait(false);
}
[UnitOfWork]
private async Task PublishCancelledAsync(TEntity entity)
{
try
{
await LocalEventBus.PublishAsync(new SfsCancelledEntityEventData<TEntity>(entity)).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsCancelledEntityEventData<TEntity>(entity), false).ConfigureAwait(false);
}
catch (Exception ex)
{
@ -235,6 +243,7 @@ public abstract class SfsStoreRequestManagerBase<TEntity, TDetailEntity>
}
}
[UnitOfWork]
public virtual async Task<TEntity> AbortAsync(TEntity entity)
{
entity.Abort();
@ -242,11 +251,12 @@ public abstract class SfsStoreRequestManagerBase<TEntity, TDetailEntity>
return await Repository.UpdateAsync(entity).ConfigureAwait(false);
}
[UnitOfWork]
private async Task PublishAbortedAsync(TEntity entity)
{
try
{
await LocalEventBus.PublishAsync(new SfsAbortedEntityEventData<TEntity>(entity)).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsAbortedEntityEventData<TEntity>(entity), false).ConfigureAwait(false);
}
catch (Exception ex)
{
@ -257,6 +267,7 @@ public abstract class SfsStoreRequestManagerBase<TEntity, TDetailEntity>
}
}
[UnitOfWork]
protected async Task<TEntity> AddOrUpdateAsync(TEntity entity)
{
var isExist = await Repository.AnyAsync(p => p.Id == entity.Id).ConfigureAwait(false);

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/InspectJobs/InspectJobManager.cs

@ -174,7 +174,7 @@ public class InspectJobManager : SfsJobManagerBase<InspectJob, InspectJobDetail>
#endregion
await LocalEventBus.PublishAsync(new SfsUpdateEntitySummaryDetailEventData<InspectJob>(CopyJob)).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsUpdateEntitySummaryDetailEventData<InspectJob>(CopyJob),false).ConfigureAwait(false);
return summaryDetailEntity;
}

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

@ -288,7 +288,7 @@ public abstract class SfsJobManagerBase<TEntity, TDetailEntity>
{
try
{
await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData<TEntity>(entity)).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData<TEntity>(entity), false).ConfigureAwait(false);
}
catch (Exception ex)
{
@ -302,7 +302,7 @@ public abstract class SfsJobManagerBase<TEntity, TDetailEntity>
{
try
{
await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData<List<TEntity>>(entities)).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData<List<TEntity>>(entities), false).ConfigureAwait(false);
}
catch (Exception ex)
{
@ -316,7 +316,7 @@ public abstract class SfsJobManagerBase<TEntity, TDetailEntity>
{
try
{
await LocalEventBus.PublishAsync(new SfsCompletedEntityEventData<TEntity>(entity)).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsCompletedEntityEventData<TEntity>(entity), false).ConfigureAwait(false);
}
catch (Exception ex)
{
@ -330,7 +330,7 @@ public abstract class SfsJobManagerBase<TEntity, TDetailEntity>
{
try
{
await LocalEventBus.PublishAsync(new SfsCancelledEntityEventData<TEntity>(entity)).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsCancelledEntityEventData<TEntity>(entity), false).ConfigureAwait(false);
}
catch (Exception ex)
{
@ -344,7 +344,7 @@ public abstract class SfsJobManagerBase<TEntity, TDetailEntity>
{
try
{
await LocalEventBus.PublishAsync(new SfsOpenedEntityEventData<TEntity>(entity)).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsOpenedEntityEventData<TEntity>(entity), false).ConfigureAwait(false);
}
catch (Exception ex)
{
@ -358,7 +358,7 @@ public abstract class SfsJobManagerBase<TEntity, TDetailEntity>
{
try
{
await LocalEventBus.PublishAsync(new SfsClosedEntityEventData<TEntity>(entity)).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsClosedEntityEventData<TEntity>(entity), false).ConfigureAwait(false);
}
catch (Exception ex)
{

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/InspectNotes/InspectNoteManager.cs

@ -54,7 +54,7 @@ public class InspectNoteManager : SfsStoreManagerBase<InspectNote, InspectNoteDe
inspectNote.Worker = entity.Worker;
await Repository.UpdateAsync(entity).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsUpdateEntityDetailEventData<InspectNote>(inspectNote)).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsUpdateEntityDetailEventData<InspectNote>(inspectNote), false).ConfigureAwait(false);
return entity;
}

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/IssueNoteManager.cs

@ -30,7 +30,7 @@ public class IssueNoteManager : SfsStoreManagerBase<IssueNote, IssueNoteDetail>,
{
try
{
await LocalEventBus.PublishAsync(new SfsConfirmedEntityEventData<IssueNote>(entity)).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsConfirmedEntityEventData<IssueNote>(entity), false).ConfigureAwait(false);
}
catch (Exception ex)
{

4
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/PurchaseReceiptNotes/PurchaseReceiptNoteManager.cs

@ -53,7 +53,7 @@ public class PurchaseReceiptNoteManager : SfsStoreManagerBase<PurchaseReceiptNot
};
try
{
await LocalEventBus.PublishAsync(purchaseReceiptNoteAddDetailEventData).ConfigureAwait(false);
await LocalEventBus.PublishAsync(purchaseReceiptNoteAddDetailEventData, false).ConfigureAwait(false);
}
catch (Exception ex)
{
@ -73,7 +73,7 @@ public class PurchaseReceiptNoteManager : SfsStoreManagerBase<PurchaseReceiptNot
};
try
{
await LocalEventBus.PublishAsync(purchaseReceiptNoteAddDetailEventData).ConfigureAwait(false);
await LocalEventBus.PublishAsync(purchaseReceiptNoteAddDetailEventData, false).ConfigureAwait(false);
}
catch (Exception ex)
{

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/PurchaseReturnNotes/PurchaseReturnNoteManager.cs

@ -26,7 +26,7 @@ public class PurchaseReturnNoteManager : SfsStoreManagerBase<PurchaseReturnNote,
};
try
{
await LocalEventBus.PublishAsync(purchaseReceiptNoteAddDetailEventData).ConfigureAwait(false);
await LocalEventBus.PublishAsync(purchaseReceiptNoteAddDetailEventData, false).ConfigureAwait(false);
}
catch (Exception ex)
{

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/TransferNotes/TransferNoteManager.cs

@ -34,7 +34,7 @@ public class TransferNoteManager : SfsStoreManagerBase<TransferNote, TransferNot
{
try
{
await LocalEventBus.PublishAsync(new SfsConfirmedEntityEventData<TransferNote>(entity)).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsConfirmedEntityEventData<TransferNote>(entity), false).ConfigureAwait(false);
}
catch (Exception ex)
{

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Orders/PurchaseOrders/PurchaseOrderDetail.cs

@ -72,7 +72,7 @@ public class PurchaseOrderDetail : SfsStoreDetailWithQtyEntityBase
/// 筹措员代码
/// </summary>
[Display(Name = "明细-筹措员代码")]
public string ContactUserCode { get; set; }
public string PlanUserCode { get; set; }
/// <summary>
/// 生产批次

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

@ -75,7 +75,7 @@ public class CountPlanManager : SfsStoreRequestManagerBase<CountPlan, CountPlanD
{
try
{
await LocalEventBus.PublishAsync(new SfsStageChangedEntityEventData<CountPlan>(entity)).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsStageChangedEntityEventData<CountPlan>(entity), false).ConfigureAwait(false);
}
catch (Exception ex)
{

4
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20230401163806_Added_AddPurchaseOrder.Designer.cs

@ -1,4 +1,4 @@
// <auto-generated />
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
@ -12461,7 +12461,7 @@ namespace Win_in.Sfs.Wms.Store.Migrations
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("ContactUserCode")
b.Property<string>("PlanUserCode")
.HasColumnType("nvarchar(max)");
b.Property<decimal>("ConvertRate")

6
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20230401163806_Added_AddPurchaseOrder.cs

@ -1,4 +1,4 @@
using System;
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
@ -1856,7 +1856,7 @@ namespace Win_in.Sfs.Wms.Store.Migrations
oldNullable: true);
migrationBuilder.AddColumn<string>(
name: "ContactUserCode",
name: "PlanUserCode",
table: "Store_PurchaseOrderDetail",
type: "nvarchar(max)",
nullable: true);
@ -4337,7 +4337,7 @@ namespace Win_in.Sfs.Wms.Store.Migrations
table: "Store_PurchaseReceiptNoteDetail");
migrationBuilder.DropColumn(
name: "ContactUserCode",
name: "PlanUserCode",
table: "Store_PurchaseOrderDetail");
migrationBuilder.DropColumn(

4
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/StoreDbContextModelSnapshot.cs

@ -1,4 +1,4 @@
// <auto-generated />
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
@ -12459,7 +12459,7 @@ namespace Win_in.Sfs.Wms.Store.Migrations
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("ContactUserCode")
b.Property<string>("PlanUserCode")
.HasColumnType("nvarchar(max)");
b.Property<decimal>("ConvertRate")

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Orders/PurchaseOrderAutoMapperProfile.cs

@ -33,12 +33,11 @@ public partial class StoreEventAutoMapperProfile : Profile
CreateMap<PurchaseOrderDetail, SupplierAsnDetailInput>()
.Ignore(x => x.PoNumber)
.Ignore(x => x.RecommendErpCode)
.Ignore(x => x.PlanUserCode)
.Ignore(x => x.PackingCode)
.Ignore(x => x.ContainerCode)
.Ignore(x => x.SupplierBatch)
.Ignore(x => x.ArriveDate)
.Ignore(x=>x.RecommendErpCode)
;
#endregion

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

@ -1,7 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Castle.Components.DictionaryAdapter;
using Volo.Abp;
using Volo.Abp.EventBus;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
@ -13,6 +16,8 @@ using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Inventory.Domain.Acl.ItemBasic;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
using static Win_in.Sfs.Wms.Store.Domain.Shared.StoreSettings;
using SupplierAsn = Win_in.Sfs.Wms.Store.Domain.SupplierAsn;
namespace Win_in.Sfs.Wms.Store.Event.Orders;
@ -27,13 +32,21 @@ public class PurchaseOrderEventHandler
private readonly IItemPackAppService _itemPackAppService;
private readonly ISupplierItemAppService _supplierItemAppService;
private readonly IDockAppService _dockAppService;
private readonly IInventoryLabelAppService _inventoryLabelAppService;
private readonly ISupplierAppService _supplierAppService;
private readonly ISupplierTimeWindowAppService _supplierTimeWindowAppService;
public PurchaseOrderEventHandler(ISupplierAsnAppService supplierAsnAppService,
ILabelDefinitionAppService labelDefinitionAppService,
IItemBasicAppService itemBasicAppService,
IItemPackAppService itemPackAppService,
ISupplierItemAppService supplierItemAppService,
IDockAppService dockAppService)
IDockAppService dockAppService,
IInventoryLabelAppService inventoryLabelAppService,
IPurchaseOrderManager purchaseOrderManager,
ISupplierAppService supplierAppService,
ISupplierTimeWindowAppService supplierTimeWindowAppService)
{
_supplierAsnAppService = supplierAsnAppService;
_labelDefinitionAppService = labelDefinitionAppService;
@ -41,6 +54,9 @@ public class PurchaseOrderEventHandler
_itemPackAppService = itemPackAppService;
_supplierItemAppService = supplierItemAppService;
_dockAppService = dockAppService;
_inventoryLabelAppService = inventoryLabelAppService;
_supplierAppService = supplierAppService;
_supplierTimeWindowAppService = supplierTimeWindowAppService;
}
//创建采购订单
@ -81,19 +97,30 @@ public class PurchaseOrderEventHandler
//收货口 //todo 处理有问题是否要和供应商关联
var dock = await _dockAppService.GetAllListByFilterAsync(
new SfsBaseDataRequestInputBase() { Condition = new Condition(), 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);
supplierAsnEditInput.DockCode = dock.First().Code;
//赋值采购订单编号
supplierAsnEditInput.PoNumber = purchaseOrder.Number;
//要货单号
supplierAsnEditInput.RpNumber = "无";
//创建方式 //todo 后期修改为 采购订单中的参数
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);
supplierAsnEditInput.TimeWindow = dateTimeWindowDto.TimeSlot;
//生效日期
supplierAsnEditInput.ActiveDate = Clock.Now;
//一次性返回所有箱码
var generateManyAsync =await _labelDefinitionAppService
.GenerateManyAsync(EnumLabelType.PurchaseLabel.ToString(), Clock.Now.ToString(SharedConst.TimeFormat),
supplierAsnEditInput.Details.Count).ConfigureAwait(false);
//发货单号
supplierAsnEditInput.Number = await _supplierAsnAppService.GenerateSupplierAsnNumberAsync(supplierAsnEditInput.ActiveDate).ConfigureAwait(false);
//所有的物品Code
var itemCodes = purchaseOrder.Details.GroupBy(p => p.ItemCode).Select(p => p.Key);
@ -103,6 +130,11 @@ public class PurchaseOrderEventHandler
var ItemPacks = new List<ItemPackDTO>();//一次性返回所有物品包装信息
var supplierItemDtos = new List<SupplierItemDTO>();//一次性返回所有供应商物品信息
//一次性返回所有箱码
var generateManyAsync = await _labelDefinitionAppService
.GenerateManyAsync(EnumLabelType.PurchaseLabel.ToString(), Clock.Now.ToString(SharedConst.TimeFormat),
supplierAsnEditInput.Details.Count).ConfigureAwait(false);
foreach (var itemCode in itemCodes)//查询
{
var itemPackDtos = await _itemPackAppService.GetListByItemCodeAsync(itemCode).ConfigureAwait(false);
@ -115,6 +147,8 @@ public class PurchaseOrderEventHandler
//赋值 详情表
supplierAsnEditInput.Details.ForEach(detail =>
{
var purchaseOrderDetail= purchaseOrder.Details.First(p => p.ItemCode == detail.ItemCode);
//添加箱码
var pakcingCode = generateManyAsync.First();
detail.PackingCode = pakcingCode;
@ -135,6 +169,12 @@ public class PurchaseOrderEventHandler
p.ItemCode == detail.ItemCode && p.SupplierCode == supplierAsnEditInput.SupplierCode);
detail.SupplierPackQty = supplierItemDto.SupplierPackQty;
detail.SupplierPackUom= supplierItemDto.SupplierPackUom;
//订单行
detail.PoLine = purchaseOrderDetail.PoLine;
//推荐ERP库位
detail.RecommendErpCode = purchaseOrderDetail.LocationErpCode;
});
return supplierAsnEditInput;

232
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Plans/SupplierAsnEventHandler.cs

@ -13,6 +13,7 @@ using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared;
using static Win_in.Sfs.Wms.Store.Domain.Shared.StoreSettings;
using SupplierAsn = Win_in.Sfs.Wms.Store.Domain.SupplierAsn;
namespace Win_in.Sfs.Wms.Store.Event.Stores;
@ -54,22 +55,11 @@ public class SupplierAsnEventHandler
{
var entity = eventData.Entity;
switch (entity.CreateType)
{
case EnumSupplierAsnCreateType.Import:
//创建标签
await CreateLabelAsync(entity).ConfigureAwait(false);
break;
case EnumSupplierAsnCreateType.AppService:
case EnumSupplierAsnCreateType.ExternalInterface:
default:
//更新订单已收货数量
//更新采购订单收货数量
await UpdatePurchaseOrderAsync(entity).ConfigureAwait(false);
break;
}
//创建收货请求(到货通知)
//await CreatePurchaseReceiptRequestAsync(entity).ConfigureAwait(false);
await CreatePurchaseReceiptRequestAsync(entity).ConfigureAwait(false);
}
/// <summary>
@ -84,23 +74,8 @@ public class SupplierAsnEventHandler
foreach (var supplierAsn in entityList)
{
switch (supplierAsn.CreateType)
{
case EnumSupplierAsnCreateType.Import:
//创建采购订单
await CreatePurchaseOrderAsync(supplierAsn).ConfigureAwait(false);
//创建标签
await CreateLabelAsync(supplierAsn).ConfigureAwait(false);
break;
case EnumSupplierAsnCreateType.AppService:
case EnumSupplierAsnCreateType.ExternalInterface:
default:
//更新订单已收货数量
//更新采购订单收货数量
await UpdatePurchaseOrderAsync(supplierAsn).ConfigureAwait(false);
break;
}
//创建收货请求(到货通知)
await CreatePurchaseReceiptRequestAsync(supplierAsn).ConfigureAwait(false);
@ -109,12 +84,7 @@ public class SupplierAsnEventHandler
#region 私有
#region 收货请求
/// <summary>
/// 创建 收货请求(到货通知)
/// </summary>
/// <param name="supplierAsn"></param>
// 创建 收货请求(到货通知)
private async Task CreatePurchaseReceiptRequestAsync(SupplierAsn supplierAsn)
{
//开关控制 创建收货请求(到货通知)
@ -126,205 +96,33 @@ public class SupplierAsnEventHandler
}
}
/// <summary>
/// 构造 收货请求
/// </summary>
/// <param name="supplierAsn"></param>
/// <returns></returns>
// 构造 收货请求
private PurchaseReceiptRequestEditInput BuildPurchaseReceiptRequestCreateInput(SupplierAsn supplierAsn)
{
var input = ObjectMapper.Map<SupplierAsn, PurchaseReceiptRequestEditInput>(supplierAsn);
return input;
}
#endregion
#region 采购订单
/// <summary>
/// 创建 采购订单
/// </summary>
/// <param name="supplierAsn"></param>
private async Task<PurchaseOrderDTO> CreatePurchaseOrderAsync(SupplierAsn supplierAsn)
{
//开关控制 创建采购订单
if (await SettingManager.IsTrueAsync(StoreSettings.SupplierAsn.AutoCreatePurchaseOrder).ConfigureAwait(false))
{
var createInput = await BulidPurchaseOrderAsync(supplierAsn).ConfigureAwait(false);
return await _purchaseOrderAppService.CreateAsync(createInput).ConfigureAwait(false);
}
return null;
}
/// <summary>
/// 构造 采购订单
/// </summary>
/// <param name="inputEntity"></param>
/// <returns></returns>
private async Task<PurchaseOrderEditInput> BulidPurchaseOrderAsync(SupplierAsn inputEntity)
// 更新采购订单中的发货数量
private async Task UpdatePurchaseOrderAsync(SupplierAsn entity)
{
await Task.CompletedTask.ConfigureAwait(false);
//创建采购订单
var purchaseOrderCreateInput = ObjectMapper.Map<SupplierAsn, PurchaseOrderEditInput>(inputEntity);
var purchaseOrderDetailUpdateInputs = new List<PurchaseOrderDetailUpdateInput>();
var group = inputEntity.Details.GroupBy(p => new { p.ItemCode, p.RecommendErpCode, p.PoLine, p.ProjectCode });
foreach (var groupKey in group)
foreach (var detail in entity.Details)
{
//样板数据
var templateData = inputEntity.Details.First(p =>
groupKey.Key.ItemCode == p.ItemCode &&
groupKey.Key.RecommendErpCode == p.RecommendErpCode &&
p.PoLine == groupKey.Key.PoLine &&
p.ProjectCode == groupKey.Key.ProjectCode);
//汇总数量
var sumQty = inputEntity.Details.Where(p =>
groupKey.Key.ItemCode == p.ItemCode &&
groupKey.Key.RecommendErpCode == p.RecommendErpCode &&
p.PoLine == groupKey.Key.PoLine &&
p.ProjectCode == groupKey.Key.ProjectCode)
.Sum(p => p.Qty);
//创建明细
var purchaseOrderDetailInput = new PurchaseOrderDetailInput()
var purchaseOrderDetailUpdateInput=new PurchaseOrderDetailUpdateInput()
{
ItemCode = groupKey.Key.ItemCode,
Qty = sumQty,
Uom = templateData.Uom,
ItemName = templateData.ItemName,
Remark = templateData.Remark,
ItemDesc2 = templateData.ItemDesc2,
ItemDesc1 = templateData.ItemDesc1,
LocationErpCode = groupKey.Key.RecommendErpCode,
StdPackQty = templateData.StdPackQty,
ConvertRate = 0,
IsConsignment = true,
LineStatus = EnumOrderStatus.Open,
PoLine = templateData.PoLine,
ProjectCode = templateData.ProjectCode,
SupplierPackQty = templateData.SupplierPackQty,
SupplierPackUom = templateData.SupplierPackUom,
ShippedQty = sumQty,
PoLine = detail.PoLine,
ItemCode = detail.ItemCode,
ShippedQty = detail.Qty,
};
purchaseOrderCreateInput.Details.Add(purchaseOrderDetailInput);
}
return purchaseOrderCreateInput;
purchaseOrderDetailUpdateInputs.Add(purchaseOrderDetailUpdateInput);
}
#endregion
#region 创建标签
/// <summary>
/// 创建 采购收货标签
/// </summary>
/// <returns></returns>
private async Task<List<InventoryLabelDto>> CreateLabelAsync(SupplierAsn supplierAsn)
{
List<InventoryLabelDto> inventoryLabelDtos = new List<InventoryLabelDto>();
foreach (var supplierAsnDetail in supplierAsn.Details)
{
var inputLabel = await BuildInventoryLabelCreateInputAsync(supplierAsn, supplierAsnDetail).ConfigureAwait(false);
var labelDto = await _inventoryLabelService.CreateAsync(inputLabel).ConfigureAwait(false);
inventoryLabelDtos.Add(labelDto);
}
return inventoryLabelDtos;
}
/// <summary>
/// 创建 构造标签
/// </summary>
/// <param name="supplierAsn"></param>
/// <param name="supplierAsnDetail"></param>
/// <returns></returns>
private async Task<InventoryLabelEditInput> BuildInventoryLabelCreateInputAsync(SupplierAsn supplierAsn, SupplierAsnDetail supplierAsnDetail)
{
var itemDto = await ItemBasicAclService.GetByCodeAsync(supplierAsnDetail.ItemCode).ConfigureAwait(false);
var supplierItem =
await _supplierItemAppService.GetBySupplierCodeAndItemCodeAsync(supplierAsn.SupplierCode,
itemDto.Code).ConfigureAwait(false);
var supplier = await _supplierAppService.GetByCodeAsync(supplierAsn.SupplierCode).ConfigureAwait(false);
if (itemDto == null)
{
throw new UserFriendlyException($"{supplierAsnDetail.ItemCode}零件信息为空");
}
if (supplier == null)
{
throw new UserFriendlyException($"{supplierAsn.SupplierCode}供应商为空");
}
if (supplierItem == null)
{
throw new UserFriendlyException($"{supplierAsn.SupplierCode}供应商零件或{itemDto.Code}零件信息为空");
}
var inputLabel = new InventoryLabelEditInput()
{
LabelType = EnumLabelType.PurchaseLabel,
ArriveDate = DateTime.Now,
Qty = supplierAsnDetail.Qty,
PoNumber = supplierAsnDetail.PoNumber,
Uom = supplierAsnDetail.Uom,
ItemDesc2 = itemDto.Desc2,
AsnNumber = supplierAsnDetail.Number,
ItemCode = supplierAsnDetail.ItemCode,
ItemName = supplierAsnDetail.ItemName,
ItemDesc1 = itemDto.Desc1,
SupplierBatch = supplierAsnDetail.SupplierBatch,
ProduceDate = supplierAsnDetail.ProduceDate,
ExpireDate = DateTime.Now.AddDays(itemDto.GetValidateDays()),
FullBarcodeString = supplierAsnDetail.PackingCode,
ExtraProperties = { },
LabelStatus = LabelStatus.Enable,
LocationErpCode = supplierAsnDetail.RecommendErpCode,
Lot = supplierAsnDetail.Lot,
RecommendLocationCode = supplierAsnDetail.RecommendErpCode,
Remark = supplierAsnDetail.Remark,
Specifications = itemDto.Color,
StdPackQty = supplierAsnDetail.StdPackQty,
SupplierCode = supplierAsn.SupplierCode,
SupplierItemCode = supplierItem.SupplierItemCode,
SupplierItemName = supplierItem.ItemName,
SupplierName = supplier.Name,
SupplierSimpleName = supplier.ShortName,
Team = null,
ProdLine = null,
QLevel = null,
QualityFile = null,
RpNumber = null,
Shift = null,
ContainerCode = null,
Code = supplierAsnDetail.PackingCode
};
return inputLabel;
}
#endregion
private async Task UpdatePurchaseOrderAsync(SupplierAsn entity)
{
var purchaseOrderDetailUpdateInputs = entity.Details
.Select(BuildPurchaseOrderDetailUpdateInput).ToList();
await _purchaseOrderAppService.UpdateDetailsAsync(entity.PoNumber, purchaseOrderDetailUpdateInputs).ConfigureAwait(false);
}
private static PurchaseOrderDetailUpdateInput BuildPurchaseOrderDetailUpdateInput(SupplierAsnDetail supplierAsnDetail)
{
return new PurchaseOrderDetailUpdateInput()
{
PoLine = supplierAsnDetail.PoLine,
ItemCode = supplierAsnDetail.ItemCode,
ShippedQty = supplierAsnDetail.Qty,
};
}
#endregion
}

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

@ -4,6 +4,7 @@ using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.EventBus;
using Volo.Abp.SettingManagement;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event;
@ -35,6 +36,7 @@ public class PurchaseReceiptRequestEventHandler
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCancelledEntityEventData<PurchaseReceiptRequest> eventData)
{
var entity = eventData.Entity;
@ -46,6 +48,7 @@ public class PurchaseReceiptRequestEventHandler
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsAgreedEntityEventData<PurchaseReceiptRequest> eventData)
{
await CreatePurchaseReceiptJob(eventData.Entity).ConfigureAwait(false);

Loading…
Cancel
Save