From cd44f1223ccf40a2b6f0788dbcd24ff7cd8f0eef Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期四, 11 十二月 2025 15:22:41 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/ZhongRui/ALDbanyunxiangmu
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 303 ++++++++++++++++++++++++++++++++++++--------------
1 files changed, 216 insertions(+), 87 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 956fcca..b65d4c3 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"
@@ -84,6 +84,7 @@
private readonly IRecordService _recordService;
private readonly IAllocateService _allocateService;
private readonly IInvokeMESService _invokeMESService;
+ private readonly ITask_HtyService _task_HtyService;
public IRepository<Dt_Task> Repository => BaseDal;
private Dictionary<string, SqlSugar.OrderByType> _taskOrderBy = new()
@@ -103,7 +104,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) : 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) : base(BaseDal)
{
_mapper = mapper;
_unitOfWorkManage = unitOfWorkManage;
@@ -126,8 +127,22 @@
_allocateOrderDetailRepository = allocateOrderDetailRepository;
_allocateOrderRepository = allocateOrderRepository;
_materialUnitService = materialUnitService;
+ _task_HtyService = task_HtyService;
}
+ public async Task TaskStatusChange(string taskNum, TaskStatusEnum taskStatusEnum)
+ {
+ if (int.TryParse(taskNum, out var newTaskNum))
+ {
+ await Db.Updateable<Dt_Task>().SetColumns(it => new Dt_Task
+ {
+ TaskStatus = taskStatusEnum.ObjToInt()
+ })
+ .Where(it => it.TaskNum == newTaskNum)
+ .ExecuteCommandAsync();
+ }
+
+ }
/// <summary>
///
@@ -276,11 +291,22 @@
task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
- BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
+ // BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
+ var result = _task_HtyService.DeleteAndMoveIntoHty(task, OperateTypeEnum.浜哄伐鍒犻櫎);
+ if (!result)
+ {
+ await Db.Deleteable(task).ExecuteCommandAsync();
+ }
+ try
+ {
+ _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum);
- _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum);
-
- _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) + beforeQuantity, WIDESEA_Common.StockEnum.StockChangeType.MaterielGroup);
+ _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) + beforeQuantity, WIDESEA_Common.StockEnum.StockChangeType.MaterielGroup);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogInformation($"InboundTaskCompleted AddLocationStatusChangeRecord : {ex.Message} ");
+ }
try
{
foreach (var inboundOrder in inboundOrders)
@@ -325,8 +351,8 @@
}).ToList();
allocatefeedmodel.Details = groupedData;
- var result = await _invokeMESService.FeedbackAllocate(allocatefeedmodel);
- if (result != null && result.code == 200)
+ var feedbackresult = await _invokeMESService.FeedbackAllocate(allocatefeedmodel);
+ if (feedbackresult != null && feedbackresult.code == 200)
{
_inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 })
.Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
@@ -381,8 +407,8 @@
}).ToList();
allocatefeedmodel.Details = groupedData;
- var result = await _invokeMESService.FeedbackAllocate(allocatefeedmodel);
- if (result != null && result.code == 200)
+ var feedbackresult = await _invokeMESService.FeedbackAllocate(allocatefeedmodel);
+ if (feedbackresult != null && feedbackresult.code == 200)
{
_inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 })
.Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
@@ -429,13 +455,20 @@
}).ToList();
feedmodel.details = groupedData;
- var result = await _invokeMESService.FeedbackInbound(feedmodel);
- if (result != null && result.code == 200)
+ var feedbackresult = await _invokeMESService.FeedbackInbound(feedmodel);
+ if (feedbackresult != null && feedbackresult.code == 200)
{
- _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 })
+ _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1, Remark = "" })
.Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
_inboundOrderDetailService.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 })
.Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand();
+ }
+ else
+ {
+ _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 2, Remark = feedbackresult.message })
+ .Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
+ _inboundOrderDetailService.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 2 })
+ .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand();
}
}
}
@@ -536,10 +569,20 @@
var outboundOrder = _outboundOrderService.Db.Queryable<Dt_OutboundOrder>().First(x => x.OrderNo == task.OrderNo);
task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
- BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? WIDESEA_Core.Enums.OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
-
- _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforelocationStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum);
-
+ // BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? WIDESEA_Core.Enums.OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
+ var result = _task_HtyService.DeleteAndMoveIntoHty(task, OperateTypeEnum.浜哄伐鍒犻櫎);
+ if (!result)
+ {
+ await Db.Deleteable(task).ExecuteCommandAsync();
+ }
+ try
+ {
+ _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforelocationStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogInformation($"InEmptyTaskCompleted AddLocationStatusChangeRecord : {ex.Message} ");
+ }
if (outboundOrder != null)
{
@@ -565,8 +608,6 @@
try
{
- _unitOfWorkManage.BeginTran(); // 娣诲姞浜嬪姟绠$悊
-
// 鏌ュ簱瀛�
Dt_StockInfo stockInfo = await _stockRepository.Db.Queryable<Dt_StockInfo>()
.Includes(x => x.Details)
@@ -584,7 +625,6 @@
_logger.LogInformation($"TaskService InPickTaskCompleted: 鏈壘鍒拌鎵樼洏搴撳瓨鏄庣粏淇℃伅.{task.TaskNum}");
return WebResponseContent.Instance.Error($"鏈壘鍒拌鎵樼洏搴撳瓨鏄庣粏淇℃伅");
}
-
// 鏌ヨ揣浣�
Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress);
if (locationInfo == null)
@@ -606,7 +646,6 @@
foreach (var lockInfo in returnLocks)
{
lockInfo.Status = (int)OutLockStockStatusEnum.宸插洖搴�;
- lockInfo.Operator = App.User.UserName;
}
if (returnLocks.Any())
@@ -650,20 +689,31 @@
task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
// 鍒犻櫎浠诲姟璁板綍
- BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
- BaseDal.DeleteData(task);
+ //BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
+ //BaseDal.DeleteData(task);
+ var result = _task_HtyService.DeleteAndMoveIntoHty(task, OperateTypeEnum.浜哄伐鍒犻櫎);
+ if (!result)
+ {
+ await Db.Deleteable(task).ExecuteCommandAsync();
+ }
- // 璁板綍璐т綅鐘舵�佸彉鏇�
- _locationStatusChangeRecordService.AddLocationStatusChangeRecord(
- locationInfo,
- beforelocationStatus,
- StockChangeType.Inbound.ObjToInt(),
- "",
- task.TaskNum
- );
await RecalculateOrderStatus(task.OrderNo);
+ try
+ {
+ // 璁板綍璐т綅鐘舵�佸彉鏇�
+ _locationStatusChangeRecordService.AddLocationStatusChangeRecord(
+ locationInfo,
+ beforelocationStatus,
+ StockChangeType.Inbound.ObjToInt(),
+ "",
+ task.TaskNum
+ );
+ }
+ catch (Exception ex)
+ {
+ _logger.LogInformation($"InPickTaskCompleted AddLocationStatusChangeRecord : {ex.Message} ");
+ }
- _unitOfWorkManage.CommitTran(); // 鎻愪氦浜嬪姟
_logger.LogInformation($"鎵樼洏鍥炲簱瀹屾垚澶勭悊鎴愬姛 - 浠诲姟鍙�: {task.TaskNum}, 鎵樼洏: {task.PalletCode}, 璁㈠崟: {task.OrderNo}");
_ = Task.Run(async () =>
{
@@ -707,60 +757,62 @@
{
try
{
+
+
// 鑾峰彇鍙楀奖鍝嶇殑璁㈠崟鏄庣粏ID锛堝幓閲嶏級
- var affectedDetailIds = returnLocks
- .Select(x => x.OrderDetailId)
- .Distinct()
- .ToList();
+ //var affectedDetailIds = returnLocks
+ // .Select(x => x.OrderDetailId)
+ // .Distinct()
+ // .ToList();
- if (!affectedDetailIds.Any())
- {
- _logger.LogInformation($"娌℃湁鍙楀奖鍝嶇殑璁㈠崟鏄庣粏 - OrderNo: {orderNo}");
- return;
- }
+ //if (!affectedDetailIds.Any())
+ //{
+ // _logger.LogInformation($"娌℃湁鍙楀奖鍝嶇殑璁㈠崟鏄庣粏 - OrderNo: {orderNo}");
+ // return;
+ //}
- _logger.LogInformation($"鏇存柊{affectedDetailIds.Count}涓彈褰卞搷鐨勮鍗曟槑缁� - OrderNo: {orderNo}");
+ //_logger.LogInformation($"鏇存柊{affectedDetailIds.Count}涓彈褰卞搷鐨勮鍗曟槑缁� - OrderNo: {orderNo}");
- foreach (var detailId in affectedDetailIds)
- {
- // 閲嶆柊璁$畻璇ヨ鍗曟槑缁嗙殑閿佸畾鏁伴噺
- decimal currentLockQty = await CalculateOrderDetailLockQuantity(detailId);
+ //foreach (var detailId in affectedDetailIds)
+ //{
+ // // 閲嶆柊璁$畻璇ヨ鍗曟槑缁嗙殑閿佸畾鏁伴噺
+ // decimal currentLockQty = await CalculateOrderDetailLockQuantity(detailId);
- // 妫�鏌ユ暟鎹竴鑷存��
- if (currentLockQty < 0)
- {
- _logger.LogWarning($"閿佸畾鏁伴噺璁$畻涓鸿礋鍊� - OrderDetailId: {detailId}, 褰撳墠鍊�: {currentLockQty}锛岄噸缃负0");
- currentLockQty = 0;
- }
+ // // 妫�鏌ユ暟鎹竴鑷存��
+ // if (currentLockQty < 0)
+ // {
+ // _logger.LogWarning($"閿佸畾鏁伴噺璁$畻涓鸿礋鍊� - OrderDetailId: {detailId}, 褰撳墠鍊�: {currentLockQty}锛岄噸缃负0");
+ // currentLockQty = 0;
+ // }
- // 鑾峰彇璁㈠崟鏄庣粏
- var orderDetail = await _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>()
- .FirstAsync(x => x.Id == detailId);
+ // // 鑾峰彇璁㈠崟鏄庣粏
+ // var orderDetail = await _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>()
+ // .FirstAsync(x => x.Id == detailId);
- if (orderDetail == null)
- {
- _logger.LogWarning($"鏈壘鍒拌鍗曟槑缁� - OrderDetailId: {detailId}");
- continue;
- }
+ // if (orderDetail == null)
+ // {
+ // _logger.LogWarning($"鏈壘鍒拌鍗曟槑缁� - OrderDetailId: {detailId}");
+ // continue;
+ // }
- // 鏇存柊閿佸畾鏁伴噺
- if (orderDetail.LockQuantity != currentLockQty)
- {
- await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
- .SetColumns(it => new Dt_OutboundOrderDetail
- {
- LockQuantity = currentLockQty,
- })
- .Where(it => it.Id == detailId)
- .ExecuteCommandAsync();
+ // // 鏇存柊閿佸畾鏁伴噺
+ // if (orderDetail.LockQuantity != currentLockQty)
+ // {
+ // await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
+ // .SetColumns(it => new Dt_OutboundOrderDetail
+ // {
+ // LockQuantity = currentLockQty,
+ // })
+ // .Where(it => it.Id == detailId)
+ // .ExecuteCommandAsync();
- _logger.LogInformation($"鏇存柊璁㈠崟鏄庣粏閿佸畾鏁伴噺 - OrderDetailId: {detailId}, " +
- $"鏃у��: {orderDetail.LockQuantity}, 鏂板��: {currentLockQty}");
- }
+ // _logger.LogInformation($"鏇存柊璁㈠崟鏄庣粏閿佸畾鏁伴噺 - OrderDetailId: {detailId}, " +
+ // $"鏃у��: {orderDetail.LockQuantity}, 鏂板��: {currentLockQty}");
+ // }
- // 鏇存柊璁㈠崟鏄庣粏鐘舵��
- await UpdateOrderDetailStatus(orderDetail);
- }
+ // // 鏇存柊璁㈠崟鏄庣粏鐘舵��
+ // await UpdateOrderDetailStatus(orderDetail);
+ //}
}
catch (Exception ex)
{
@@ -909,6 +961,7 @@
{
hasInProgress = true;
}
+ await UpdateOrderDetailStatus(detail);
}
var outboundOrder = await _outboundOrderService.Db.Queryable<Dt_OutboundOrder>()
@@ -940,13 +993,13 @@
.SetColumns(x => new Dt_OutboundOrder
{
OrderStatus = newStatus,
- Operator = App.User.UserName,
})
.Where(x => x.OrderNo == orderNo)
.ExecuteCommandAsync();
_logger.LogInformation($"鏇存柊璁㈠崟鐘舵�� - OrderNo: {orderNo}, 鏃х姸鎬�: {outboundOrder.OrderStatus}, 鏂扮姸鎬�: {newStatus}");
}
+
}
catch (Exception ex)
{
@@ -1016,7 +1069,7 @@
if (allCompleted && newStatus == (int)OutOrderStatusEnum.鍑哄簱瀹屾垚)
{
- if (outboundOrder.OrderType == OutOrderTypeEnum.Allocate.ObjToInt())
+ if (outboundOrder.OrderType == OutOrderTypeEnum.Allocate.ObjToInt() || outboundOrder.OrderType == OutOrderTypeEnum.InternalAllocat.ObjToInt())
{
var allocate = _allocateService.Repository.QueryData(x => x.UpperOrderNo == outboundOrder.UpperOrderNo).First();
var allocatefeedmodel = new AllocateDto
@@ -1083,8 +1136,33 @@
allocatefeedmodel.Details.Add(detailModel);
}
+ var groupedResult = allocatefeedmodel.Details.GroupBy(item => new
+ {
+ item.WarehouseCode,
+ item.MaterialCode,
+ item.Unit,
+ item.LineNo
+ }).Select(group => new AllocateDtoDetail
+ {
+ WarehouseCode = group.Key.WarehouseCode,
+ MaterialCode = group.Key.MaterialCode,
+ LineNo = group.Key.LineNo,
+ Qty = group.Sum(x => x.Qty),
+ Unit = group.Key.Unit,
+ Barcodes = group.SelectMany(x => x.Barcodes)
+ .GroupBy(b => b.Barcode)
+ .Select(b => new BarcodeInfo
+ {
+ Barcode = b.Key,
+ BatchNo = b.First().BatchNo,
+ SupplyCode = b.First().SupplyCode,
+ Qty = b.Max(x => x.Qty),
+ Unit = b.First().Unit
+ }) .ToList()
+ }) .ToList();
+ allocatefeedmodel.Details = groupedResult;
- var result = await _invokeMESService.FeedbackAllocate(allocatefeedmodel);
+ var result = await _invokeMESService.FeedbackAllocate(allocatefeedmodel);
if (result != null && result.code == 200)
{
await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
@@ -1095,7 +1173,6 @@
.SetColumns(x => new Dt_OutboundOrder
{
ReturnToMESStatus = 1,
- Operator = App.User.UserName,
}).Where(x => x.OrderNo == orderNo).ExecuteCommandAsync();
}
}
@@ -1105,7 +1182,7 @@
//涓嶇敤鍥炰紶
}
else
- {
+ {
if (outboundOrder != null && outboundOrder.IsBatch == 0)
{
var feedmodel = new FeedbackOutboundRequestModel
@@ -1170,6 +1247,31 @@
}
feedmodel.details.Add(detailModel);
}
+ var groupedResult = feedmodel.details.GroupBy(item => new
+ {
+ item.warehouseCode,
+ item.materialCode,
+ item.unit,
+ item.lineNo
+ }).Select(group => new FeedbackOutboundDetailsModel
+ {
+ warehouseCode = group.Key.warehouseCode,
+ materialCode = group.Key.materialCode,
+ lineNo = group.Key.lineNo,
+ qty = group.Sum(x => x.qty),
+ unit = group.Key.unit,
+ barcodes = group.SelectMany(x => x.barcodes)
+ .GroupBy(b => b.barcode)
+ .Select(b => new WIDESEA_DTO.Outbound.BarcodesModel
+ {
+ barcode = b.Key,
+ batchNo = b.First().batchNo,
+ supplyCode = b.First().supplyCode,
+ qty = b.Max(x => x.qty),
+ unit = b.First().unit
+ }).ToList()
+ }).ToList();
+ feedmodel.details = groupedResult;
var result = await _invokeMESService.FeedbackOutbound(feedmodel);
if (result != null && result.code == 200)
@@ -1180,14 +1282,26 @@
.ExecuteCommandAsync();
await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>()
- .SetColumns(x => x.ReturnToMESStatus == 1)
+ .SetColumns(it => new Dt_OutboundOrder { ReturnToMESStatus = 2, Remark = "" })
.Where(x => x.OrderNo == orderNo)
+ .ExecuteCommandAsync();
+ }
+ else
+ {
+ await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
+ .SetColumns(x => x.ReturnToMESStatus == 2)
+ .Where(x => x.OrderId == outboundOrder.Id)
+ .ExecuteCommandAsync();
+
+ await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>()
+ .SetColumns(it => new Dt_OutboundOrder { ReturnToMESStatus = 2, Remark = result.message })
+ .Where(x => x.OrderNo == orderNo)
.ExecuteCommandAsync();
}
}
else if (outboundOrder != null && outboundOrder.IsBatch == 1)
{
- await _invokeMESService.BatchOrderFeedbackToMes(new List<string>(){outboundOrder.OrderNo },2);
+ await _invokeMESService.BatchOrderFeedbackToMes(new List<string>() { outboundOrder.OrderNo }, 2);
}
}
@@ -1227,12 +1341,27 @@
task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
- BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
- _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
- //_stockRepository.Db.Deleteable(stockInfo).ExecuteCommand();
- _stockService.StockInfoService.DeleteData(stockInfo);
- _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum);
+ // BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
+ var result = _task_HtyService.DeleteAndMoveIntoHty(task, OperateTypeEnum.浜哄伐鍒犻櫎);
+ if (!result)
+ {
+ await Db.Deleteable(task).ExecuteCommandAsync();
+ }
+ var stockresult = _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
+ if (!stockresult)
+ {
+ _stockRepository.Db.Deleteable(stockInfo).ExecuteCommand();
+ }
+ _stockService.StockInfoService.DeleteData(stockInfo);
+ try
+ {
+ _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), stockInfo?.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError($"TaskService OutEmptyTaskCompleted AddLocationStatusChangeRecord: {ex.Message} ");
+ }
return await Task.FromResult(WebResponseContent.Instance.OK());
}
--
Gitblit v1.9.3