From 673b5a596f611099eaacc310f6e7def0e022daca Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期三, 29 四月 2026 11:00:55 +0800
Subject: [PATCH] 添加盘点模板和胶箱台账功能
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 51 insertions(+), 1 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
index ed624ac..8677a3f 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
@@ -100,6 +100,7 @@
public readonly IRepository<Dt_LocationType> _locationTypeRepository;
public readonly IRepository<Dt_WarehouseArea> _warehouseAreaRepository;
private readonly IRepository<Dt_OutStockLockInfo> _outboundLockInfoRepository;
+ private readonly IRepository<Dt_PlasticContainerLedger> _plasticContainerLedger;
public IRepository<Dt_Task> Repository => BaseDal;
private Dictionary<string, SqlSugar.OrderByType> _taskOrderBy = new()
@@ -119,7 +120,7 @@
public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList();
- public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository, IRepository<Dt_ReCheckOrder> reCheckOrderRepository, IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IMaterialUnitService materialUnitService, ITask_HtyService task_HtyService, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, IRepository<Dt_AllocateMaterialInfo_Hty> allocateMaterialInfo_Hty, HttpClientHelper httpClientHelper, IBasicService basicService,IRepository<Dt_TakeStockOrder> takeStockOrder, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_OutStockLockInfo> outboundLockInfoRepository) : base(BaseDal)
+ public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository, IRepository<Dt_ReCheckOrder> reCheckOrderRepository, IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IMaterialUnitService materialUnitService, ITask_HtyService task_HtyService, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, IRepository<Dt_AllocateMaterialInfo_Hty> allocateMaterialInfo_Hty, HttpClientHelper httpClientHelper, IBasicService basicService,IRepository<Dt_TakeStockOrder> takeStockOrder, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_OutStockLockInfo> outboundLockInfoRepository, IRepository<Dt_PlasticContainerLedger> plasticContainerLedger) : base(BaseDal)
{
_mapper = mapper;
_unitOfWorkManage = unitOfWorkManage;
@@ -151,6 +152,7 @@
_locationTypeRepository = locationTypeRepository;
_warehouseAreaRepository = warehouseAreaRepository;
_outboundLockInfoRepository = outboundLockInfoRepository;
+ _plasticContainerLedger = plasticContainerLedger;
}
public async Task TaskStatusChange(string taskNum, TaskStatusEnum taskStatusEnum)
@@ -192,6 +194,54 @@
}
_logger.LogInformation($"TaskService TaskCompleted: {JsonConvert.SerializeObject(task)} , {task.TaskType} ");
+
+ var taskType = (TaskTypeEnum)task.TaskType;
+ bool isInboundTask = taskType is
+ TaskTypeEnum.Inbound
+ or TaskTypeEnum.InEmpty
+ or TaskTypeEnum.InInventory
+ or TaskTypeEnum.InPick
+ or TaskTypeEnum.InQuality
+ or TaskTypeEnum.ProductionReturn
+ or TaskTypeEnum.MesMatReturn
+ or TaskTypeEnum.InAllocate
+ or TaskTypeEnum.AllocateInWarehouse;
+
+ if (isInboundTask && !string.IsNullOrEmpty(task.PalletCode))
+ {
+ string palletCode = task.PalletCode;
+
+ // 1. 寮傛鏌ヨ鎵樼洏瀵瑰簲鐨勫�熷嚭鍙拌处锛堟纭啓娉曪級
+ var ledger = await _plasticContainerLedger.Db.Queryable<Dt_PlasticContainerLedger>()
+ .FirstAsync(x => x.PalletCode == palletCode);
+
+ if (ledger != null)
+ {
+ // 2. 鍒犻櫎鍙拌处锛堝凡褰掕繕锛�
+ await _plasticContainerLedger.DeleteDataAsync(ledger);
+
+ // 3. 鏌ヨ搴撳瓨
+ var stock = await _stockService.StockInfoService.Repository
+ .QueryFirstAsync(x => x.PalletCode == palletCode);
+
+ if (stock != null)
+ {
+ // 4. 鎷兼帴澶囨敞
+ string borrowTime = ledger.CreateDate.ToString("yyyy-MM-dd HH:mm:ss");
+ string returnTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ string remark = $"{borrowTime} 鍊熷嚭锛寋returnTime} 杩樺洖";
+
+ stock.Remark = string.IsNullOrEmpty(stock.Remark)
+ ? remark
+ : $"{stock.Remark}锛泏remark}";
+
+ stock.SupplyCode = ledger.SupplyCode;
+ stock.BorrowTime = ledger.CreateDate;
+ await _stockService.StockInfoService.Repository.UpdateDataAsync(stock);
+ }
+ }
+ }
+
MethodInfo? methodInfo = GetType().GetMethod(((TaskTypeEnum)task.TaskType) + "TaskCompleted");
if (methodInfo != null)
{
--
Gitblit v1.9.3