Browse Source

修改采购订单

集成Redis
郑勃旭 2 years ago
parent
commit
2d574d1c3c
  1. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs
  2. 48
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Orders/PurchaseOrderEventHandler.cs

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

@ -113,7 +113,7 @@ public class PurchaseOrderAppService :
}
var entity = ObjectMapper.Map<PurchaseOrderEditInput, PurchaseOrder>(input);
entity.Remark = "接口数据";
await _purchaseOrderManager.CreateAsync(entity).ConfigureAwait(false);
return ObjectMapper.Map<PurchaseOrder, PurchaseOrderDTO>(entity);

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

@ -1,26 +1,20 @@
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.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;
using Win_in.Sfs.Shared.Domain.Shared;
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;
@ -67,8 +61,11 @@ public class PurchaseOrderEventHandler
{
var entity = eventData.Entity;
if (entity.Remark != "接口数据")
{
await CreateSupplierAsnAsync(entity).ConfigureAwait(false);
}
}
//批量创建
[UnitOfWork]
@ -77,10 +74,13 @@ public class PurchaseOrderEventHandler
var entities = eventData.Entity;
foreach (var entity in entities)
{
if (entity.Remark != "接口数据")
{
await CreateSupplierAsnAsync(entity).ConfigureAwait(false);
}
}
}
#region 业务 创建采购订单后 > 创建收货单
@ -103,10 +103,17 @@ public class PurchaseOrderEventHandler
//收货口
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 supplierTimeWindowDtos = await _supplierTimeWindowAppService
.GetListBySupplierCodeAsync(purchaseOrder.SupplierCode).ConfigureAwait(false);
if (!supplierTimeWindowDtos.Any())
{
throw new UserFriendlyException($"供应商窗口【{purchaseOrder.SupplierCode}】没设置");
@ -121,14 +128,15 @@ public class PurchaseOrderEventHandler
var supplierDto = await _supplierAppService.GetByCodeAsync(purchaseOrder.SupplierCode).ConfigureAwait(false);
//所有的标签
List<InventoryLabelEditInput> inventoryLabelEditInputs = new List<InventoryLabelEditInput>();
var inventoryLabelEditInputs = new List<InventoryLabelEditInput>();
foreach (var itemCode in itemCodes) //查询
{
//var itemPackDtos = await _itemPackAppService.GetListByItemCodeAsync(itemCode).ConfigureAwait(false);
//var itemPackDto = itemPackDtos.First();
//ItemPacks.Add(itemPackDto);
var supplierItem = await _supplierItemAppService.GetBySupplierCodeAndItemCodeAsync(purchaseOrder.SupplierCode, itemCode).ConfigureAwait(false);
var supplierItem = await _supplierItemAppService
.GetBySupplierCodeAndItemCodeAsync(purchaseOrder.SupplierCode, itemCode).ConfigureAwait(false);
supplierItemDtos.Add(supplierItem);
}
@ -156,7 +164,16 @@ public class PurchaseOrderEventHandler
supplierAsnEditInput.CreateType = EnumSupplierAsnCreateType.Import;
//供应商时间窗口
var dayOfWeek = new List<string>() { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
var dayOfWeek = new List<string>
{
"星期日",
"星期一",
"星期二",
"星期三",
"星期四",
"星期五",
"星期六"
};
var chineseWeek = dayOfWeek[Clock.Now.DayOfWeek.GetHashCode()]; //中文星期
var dateTimeWindowDto = supplierTimeWindowDtos.FirstOrDefault(p => p.Week == chineseWeek);
if (dateTimeWindowDto == null)
@ -170,7 +187,8 @@ public class PurchaseOrderEventHandler
supplierAsnEditInput.ActiveDate = Clock.Now;
//发货单号
supplierAsnEditInput.Number = await _supplierAsnAppService.GenerateSupplierAsnNumberAsync(supplierAsnEditInput.ActiveDate).ConfigureAwait(false);
supplierAsnEditInput.Number = await _supplierAsnAppService
.GenerateSupplierAsnNumberAsync(supplierAsnEditInput.ActiveDate).ConfigureAwait(false);
#endregion
@ -212,7 +230,8 @@ public class PurchaseOrderEventHandler
for (var i = 0; i < itemPackingCount; i++)
{
var supplierAsnDetailInput = ObjectMapper.Map<PurchaseOrderDetail, SupplierAsnDetailInput>(purchaseOrderDetaildetail);
var supplierAsnDetailInput =
ObjectMapper.Map<PurchaseOrderDetail, SupplierAsnDetailInput>(purchaseOrderDetaildetail);
//添加箱码
var pakcingCode = generateManyAsync.First();
supplierAsnDetailInput.PackingCode = pakcingCode;
@ -241,7 +260,8 @@ public class PurchaseOrderEventHandler
itemQty -= itemPackDto;
var InventoryLabelEditInput = await BuildInventoryLabelEditInputAsync(supplierAsnEditInput, supplierAsnDetailInput, supplierDto, itemBasicDto, supplierItemDto).ConfigureAwait(false);
var InventoryLabelEditInput = await BuildInventoryLabelEditInputAsync(supplierAsnEditInput,
supplierAsnDetailInput, supplierDto, itemBasicDto, supplierItemDto).ConfigureAwait(false);
inventoryLabelEditInputs.Add(InventoryLabelEditInput);
supplierAsnEditInput.Details.Add(supplierAsnDetailInput);

Loading…
Cancel
Save