From 29cd467ba62b2bdf49c6546e78ae3ec809c4a723 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期四, 19 六月 2025 17:50:28 +0800
Subject: [PATCH] 1
---
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 322 ++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 244 insertions(+), 78 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
index ec45bd3..707c9bf 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
@@ -17,6 +17,7 @@
using AutoMapper;
using MailKit.Search;
+using Newtonsoft.Json;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using SqlSugar;
using System;
@@ -25,6 +26,7 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Linq.Expressions;
+using System.Net.Http.Headers;
using System.Reflection;
using System.Reflection.Metadata;
using System.Text;
@@ -34,6 +36,7 @@
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
+using WIDESEA_Core.Log;
using WIDESEA_DTO.Inbound;
using WIDESEA_DTO.Stock;
using WIDESEA_IBasicRepository;
@@ -86,6 +89,7 @@
/// <returns>杩斿洖澶勭悊缁撴灉</returns>
public WebResponseContent TaskCompleted(int taskNum)
{
+ WebResponseContent content = new WebResponseContent();
try
{
Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
@@ -93,45 +97,153 @@
{
return WebResponseContent.Instance.Error("鏈壘鍒颁换鍔′俊鎭�");
}
- MethodInfo? methodInfo = GetType().GetMethod(((TaskTypeEnum)task.TaskType) + "TaskCompleted");
- if (methodInfo != null)
+ _unitOfWorkManage.BeginTran();
+ #region MyRegion
+ switch ((TaskTypeEnum)task.TaskType)
{
- WebResponseContent? responseContent = (WebResponseContent?)methodInfo.Invoke(this, new object[] { task });
- if (responseContent != null)
- {
- return responseContent;
- }
+ case TaskTypeEnum.Inbound:
+ content = InboundTaskCompleted(task);
+ break;
+ case TaskTypeEnum.Outbound:
+ content = OutboundTaskCompleted(task);
+ break;
+ case TaskTypeEnum.PalletInbound:
+ content = PalletInboundTaskCompleted(task);
+ break;
+ case TaskTypeEnum.PalletOutbound:
+ content = PalletOutboundTaskCompleted(task);
+ break;
+ case TaskTypeEnum.Relocation:
+ content = RelocationTaskCompleted(task);
+ break;
+ case TaskTypeEnum.AGVCarry:
+ content = AGVCarryTaskCompleted(task);
+ break;
+ default:
+ return content = WebResponseContent.Instance.Error("鏈壘鍒颁换鍔$被鍨嬪搴斾笟鍔″鐞嗛�昏緫");
}
- return WebResponseContent.Instance.Error("鏈壘鍒颁换鍔$被鍨嬪搴斾笟鍔″鐞嗛�昏緫");
+ if (content.Status)
+ {
+ if (App.User.UserId > 0 && task.TaskType != TaskTypeEnum.AGVCarry.ObjToInt())
+ {
+ content = HttpHelper.Post<WebResponseContent>(url + "StackCraneTaskCompleted?taskNum=" + task.TaskNum, "", "浠诲姟瀹屾垚");
+ if (!content.Status) throw new Exception(content.Message);
+ }
+ _unitOfWorkManage.CommitTran();
+ }
+ return content;
+ #endregion
}
catch (Exception ex)
{
- return WebResponseContent.Instance.Error(ex.Message);
+ _unitOfWorkManage.RollbackTran();
+ return content = WebResponseContent.Instance.Error(ex.Message);
+ }
+ finally
+ {
+ WriteLog.GetLog("浠诲姟瀹屾垚").Write($"鎿嶄綔浜猴細{(App.User.UserId > 0 ? App.User.UserName : "System")}{Environment.NewLine}浠诲姟鍙凤細{taskNum}{Environment.NewLine}{JsonConvert.SerializeObject(content)}", "浠诲姟瀹屾垚");
}
}
- public WebResponseContent TaskCancel(SaveModel saveModel)
+ /// <summary>
+ /// 浠诲姟鍙栨秷
+ /// </summary>
+ /// <param name="taskNum"></param>
+ /// <returns></returns>
+ public WebResponseContent TaskCancel(int taskNum)
{
+ WebResponseContent content = new WebResponseContent();
try
{
- int taskNum = int.Parse(saveModel.MainData["taskNum"].ToString());
+ Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
+ if (task == null)
+ {
+ return content = WebResponseContent.Instance.Error("鏈壘鍒颁换鍔′俊鎭�");
+ }
+ _unitOfWorkManage.BeginTran();
+ #region MyRegion
+ switch ((TaskTypeEnum)task.TaskType)
+ {
+ case TaskTypeEnum.Inbound:
+ content = InboundTaskCancel(task);
+ break;
+ case TaskTypeEnum.Outbound:
+ content = OutboundTaskCancel(task);
+ break;
+ case TaskTypeEnum.PalletInbound:
+ content = PalletInboundTaskCancel(task);
+ break;
+ case TaskTypeEnum.PalletOutbound:
+ content = PalletOutboundTaskCancel(task);
+ break;
+ case TaskTypeEnum.Relocation:
+ content = RelocationTaskCancel(task);
+ break;
+ case TaskTypeEnum.AGVCarry:
+ content = AGVCarryTaskCompleted(task);
+ break;
+ default:
+ return content = WebResponseContent.Instance.Error("鏈壘鍒颁换鍔$被鍨嬪搴斾笟鍔″鐞嗛�昏緫");
+ }
+ if (content.Status)
+ {
+ if (App.User.UserId > 0 && task.TaskType != TaskTypeEnum.AGVCarry.ObjToInt())
+ {
+ content = HttpHelper.Post<WebResponseContent>(url + "TaskCancel?taskNum=" + task.TaskNum, "", "浠诲姟鍙栨秷");
+ if (!content.Status) throw new Exception(content.Message);
+ }
+ _unitOfWorkManage.CommitTran();
+ }
+ return content;
+ #endregion
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ return content = WebResponseContent.Instance.Error(ex.Message);
+ }
+ finally
+ {
+ WriteLog.GetLog("浠诲姟鍙栨秷").Write($"鎿嶄綔浜猴細{(App.User.UserId > 0 ? App.User.UserName : "System")}{Environment.NewLine}浠诲姟鍙凤細{taskNum}{Environment.NewLine}{JsonConvert.SerializeObject(content)}", "浠诲姟鍙栨秷");
+ }
+ }
+
+ public WebResponseContent UpdateTaskStatus(int taskNum)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
if (task == null)
{
return WebResponseContent.Instance.Error("鏈壘鍒颁换鍔′俊鎭�");
}
- MethodInfo? methodInfo = GetType().GetMethod(((TaskTypeEnum)task.TaskType) + "TaskCancel");
- if (methodInfo != null)
+ if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt() || task.TaskType == TaskTypeEnum.PalletOutbound.ObjToInt())
{
- WebResponseContent? responseContent = (WebResponseContent?)methodInfo.Invoke(this, new object[] { task });
- if (responseContent != null)
- {
- return responseContent;
- }
+ task.TaskStatus = OutTaskStatusEnum.SC_OutExecuting.ObjToInt();
}
- return WebResponseContent.Instance.Error("鏈壘鍒颁换鍔$被鍨嬪搴斾笟鍔″鐞嗛�昏緫");
+ else if (task.TaskType == TaskTypeEnum.Inbound.ObjToInt() || task.TaskType == TaskTypeEnum.PalletInbound.ObjToInt())
+ {
+ task.TaskStatus = InTaskStatusEnum.SC_InExecuting.ObjToInt();
+ }
+ else if (task.TaskType == TaskTypeEnum.Relocation.ObjToInt())
+ {
+ task.TaskStatus = RelocationTaskStatusEnum.RelocationExecuting.ObjToInt();
+ }
+ else
+ {
+ throw new Exception($"浠诲姟绫诲瀷閿欒,鏈壘鍒拌浠诲姟绫诲瀷,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟绫诲瀷:銆恵task.TaskType}銆�");
+ }
+ _unitOfWorkManage.BeginTran();
+ task.Dispatchertime = DateTime.Now;
+ task.ModifyDate = DateTime.Now;
+ task.Modifier = App.User.UserId > 0 ? App.User.UserName : "System";
+ BaseDal.UpdateData(task);
+ _unitOfWorkManage.CommitTran();
+ return content = WebResponseContent.Instance.OK();
}
catch (Exception ex)
{
+ _unitOfWorkManage.RollbackTran();
return WebResponseContent.Instance.Error(ex.Message);
}
}
@@ -139,14 +251,37 @@
{
try
{
- _unitOfWorkManage.BeginTran();
decimal beforeQuantity = 0;
Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode);
+ Dt_StockInfoDetail stockInfoDetail = stockInfo.Details.FirstOrDefault();
Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress);
CheckCompleted(stockInfo, locationInfo);
+
+ Dt_InboundOrder inboundOrder = _inboundService.InbounOrderService.GetInboundOrder(stockInfoDetail.OrderNo);
+ if (inboundOrder != null)
+ {
+ Dt_InboundOrderDetail? inboundOrderDetail = inboundOrder.Details.Where(x => x.BatchNo == stockInfoDetail.BatchNo).FirstOrDefault();
+ if (inboundOrderDetail != null)
+ {
+ inboundOrderDetail.OverInQuantity++;
+ inboundOrderDetail.OrderDetailStatus = inboundOrderDetail.OverInQuantity == inboundOrderDetail.OrderQuantity ? OrderDetailStatusEnum.Over.ObjToInt() : OrderDetailStatusEnum.GroupAndInbound.ObjToInt();
+
+ if (inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt())
+ {
+ if (inboundOrder.Details.FirstOrDefault(x => x.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt() && x.BatchNo != inboundOrderDetail.BatchNo) == null)
+ {
+ inboundOrder.OrderStatus = InboundStatusEnum.鍏ュ簱瀹屾垚.ObjToInt();
+ _inboundService.InbounOrderService.Repository.DeleteAndMoveIntoHty(inboundOrder, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
+ _inboundService.InboundOrderDetailService.Repository.DeleteAndMoveIntoHty(inboundOrder.Details, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
+ }
+ }
+ _inboundService.InboundOrderDetailService.Repository.UpdateData(inboundOrderDetail);
+ }
+ _inboundService.InbounOrderService.Repository.UpdateData(inboundOrder);
+ }
stockInfo.LocationCode = locationInfo.LocationCode;
stockInfo.StockStatus = StockStatusEmun.宸插叆搴�.ObjToInt();
@@ -164,16 +299,14 @@
BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
_recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum);
- _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) + beforeQuantity, StockChangeType.Inbound);
- _unitOfWorkManage.CommitTran();
+ _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) + beforeQuantity, StockChangeType.Inbound, task.TaskNum);
return WebResponseContent.Instance.OK();
}
catch (Exception ex)
{
- _unitOfWorkManage.RollbackTran();
return WebResponseContent.Instance.Error(ex.Message);
}
-
+
}
/// <summary>
@@ -191,12 +324,13 @@
{
PalletCode = task.PalletCode,
LocationCode = task.TargetAddress,
- StockStatus = StockStatusEmun.宸插叆搴�.ObjToInt()
+ StockStatus = StockStatusEmun.宸插叆搴�.ObjToInt(),
+ Creater = App.User.UserId > 0 ? App.User.UserName : "System",
+ CreateDate = DateTime.Now,
};
Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress);
CheckCompleted(stockInfo, locationInfo);
-
_stockService.StockInfoService.Repository.AddData(stockInfo);
@@ -250,7 +384,6 @@
{
try
{
- _unitOfWorkManage.BeginTran();
decimal beforeQuantity = 0;
Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode);
@@ -262,22 +395,16 @@
stockInfo.StockStatus = StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt();
_stockService.StockInfoService.Repository.UpdateData(stockInfo);
int beforeStatus = locationInfo.LocationStatus;
- if (task.Depth == 1)
+ if (locationInfo.Depth == 2)
{
- if (DepthTask(task)) { }
- else
+ if (DepthTask(locationInfo) == false)
{
- locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
_basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false);
- _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
+
}
}
- else
- {
- locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
- _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false);
- _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
- }
+ locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
+ _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
task.TaskStatus = OutTaskStatusEnum.OutFinish.ObjToInt();
BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
@@ -287,14 +414,13 @@
beforeQuantity = stockInfo.Details.Where(x => x.Id != 0).Sum(x => x.StockQuantity);
_recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum);
- _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) - beforeQuantity, StockChangeType.Outbound);
+ _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) - beforeQuantity, StockChangeType.Outbound, task.TaskNum);
- _unitOfWorkManage.CommitTran();
return OnOutboundTaskCompleted?.Invoke(task) ?? WebResponseContent.Instance.OK();
+
}
catch (Exception ex)
{
- _unitOfWorkManage.RollbackTran();
return WebResponseContent.Instance.Error(ex.Message);
}
}
@@ -312,10 +438,15 @@
int beforeStatus = locationInfo.LocationStatus;
+ if (locationInfo.Depth == 2)
+ {
+ if (DepthTask(locationInfo) == false)
+ {
+ _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false);
+ }
+ }
locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
- _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false);
_basicService.LocationInfoService.Repository.UpdateData(locationInfo);
-
task.TaskStatus = OutTaskStatusEnum.OutFinish.ObjToInt();
BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
@@ -341,6 +472,7 @@
Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode);
Dt_LocationInfo locationEnd = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress);
+ Dt_LocationInfo locationStart = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress);
CheckCompleted(stockInfo, locationEnd);
@@ -348,9 +480,24 @@
stockInfo.StockStatus = StockStatusEmun.宸插叆搴�.ObjToInt();
_stockService.StockInfoService.Repository.UpdateData(stockInfo);
+ if (locationStart.Depth == 1)
+ {
+ if (DepthTask(locationStart) == false)
+ {
+ locationStart.LocationStatus = LocationStatusEnum.Free.ObjToInt();
+ _basicService.LocationInfoService.RelocationFree(locationEnd, task.TaskNum);
+ _basicService.LocationInfoService.Repository.UpdateData(locationStart);
+ }
+ else
+ {
+ locationStart.LocationStatus = LocationStatusEnum.Free.ObjToInt();
+ _basicService.LocationInfoService.Repository.UpdateData(locationStart);
+ }
+ }
+
_basicService.LocationInfoService.RelocationFree(locationEnd, task.TaskNum);
- task.TaskStatus = InTaskStatusEnum.RelocationFinish.ObjToInt();
+ task.TaskStatus = RelocationTaskStatusEnum.RelocationFinish.ObjToInt();
BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
_unitOfWorkManage.CommitTran();
@@ -359,6 +506,18 @@
catch (Exception ex)
{
_unitOfWorkManage.RollbackTran();
+ return WebResponseContent.Instance.Error(ex.Message);
+ }
+ }
+ public WebResponseContent AGVCarryTaskCompleted(Dt_Task task)
+ {
+ try
+ {
+ BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
+ return WebResponseContent.Instance.OK();
+ }
+ catch (Exception ex)
+ {
return WebResponseContent.Instance.Error(ex.Message);
}
}
@@ -376,7 +535,6 @@
CheckCompleted(stockInfo, locationInfo);
- stockInfo.LocationCode = locationInfo.LocationCode;
stockInfo.StockStatus = StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt();
_stockService.StockInfoService.Repository.UpdateData(stockInfo);
@@ -384,7 +542,10 @@
int beforeStatus = locationInfo.LocationStatus;
locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
- _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Inbound.ObjToInt(), false);
+ if (locationInfo.Depth == 2)
+ {
+ _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false);
+ }
_basicService.LocationInfoService.Repository.UpdateData(locationInfo);
task.TaskStatus = InTaskStatusEnum.InCancel.ObjToInt();
@@ -414,7 +575,10 @@
int beforeStatus = locationInfo.LocationStatus;
locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
- _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false);
+ if (locationInfo.Depth == 2)
+ {
+ _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false);
+ }
_basicService.LocationInfoService.Repository.UpdateData(locationInfo);
task.TaskStatus = InTaskStatusEnum.InCancel.ObjToInt();
@@ -432,7 +596,7 @@
}
}
-
+
public WebResponseContent OutboundTaskCancel(Dt_Task task)
{
try
@@ -440,6 +604,7 @@
_unitOfWorkManage.BeginTran();
decimal beforeQuantity = 0;
Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode);
+ Dt_StockInfoDetail stockInfoDetail = _stockService.StockInfoDetailService.Repository.QueryFirst(x => x.StockId == stockInfo.Id);
Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress);
@@ -447,23 +612,22 @@
stockInfo.LocationCode = locationInfo.LocationCode;
stockInfo.StockStatus = StockStatusEmun.宸插叆搴�.ObjToInt();
+ stockInfoDetail.OutboundQuantity = beforeQuantity;
+
_stockService.StockInfoService.Repository.UpdateData(stockInfo);
+ _stockService.StockInfoDetailService.Repository.UpdateData(stockInfoDetail);
int beforeStatus = locationInfo.LocationStatus;
- if (task.Depth == 1)
+
+ if (locationInfo.Depth == 2)
{
- if (!DepthTask(task))
+ if (DepthTask(locationInfo) == false)
{
- locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
- _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false);
- _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
+ _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), true);
}
}
- else
- {
- locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
- _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false);
- _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
- }
+ locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
+ _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
+
task.TaskStatus = OutTaskStatusEnum.OutCancel.ObjToInt();
BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
@@ -471,10 +635,10 @@
beforeQuantity = stockInfo.Details.Where(x => x.Id != 0).Sum(x => x.StockQuantity);
_recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum);
- _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) - beforeQuantity, StockChangeType.Outbound);
+ _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) - beforeQuantity, StockChangeType.Outbound, task.TaskNum);
_unitOfWorkManage.CommitTran();
- return OnOutboundTaskCompleted?.Invoke(task) ?? WebResponseContent.Instance.OK();
+ return WebResponseContent.Instance.OK();
}
catch (Exception ex)
{
@@ -496,14 +660,21 @@
int beforeStatus = locationInfo.LocationStatus;
+ if (locationInfo.Depth == 2)
+ {
+ if (DepthTask(locationInfo) == false)
+ {
+ _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), true);
+ }
+ }
locationInfo.LocationStatus = LocationStatusEnum.Pallet.ObjToInt();
- _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false);
_basicService.LocationInfoService.Repository.UpdateData(locationInfo);
+ stockInfo.StockStatus = StockStatusEmun.宸插叆搴�.ObjToInt();
+ _stockService.StockInfoService.Repository.UpdateData(stockInfo);
task.TaskStatus = OutTaskStatusEnum.OutCancel.ObjToInt();
BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
- _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
_recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum);
@@ -527,11 +698,14 @@
Dt_LocationInfo locationEnd = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress);
Dt_LocationInfo locationStart = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress);
- locationEnd.LocationStatus= LocationStatusEnum.Free.ObjToInt();
+ stockInfo.StockStatus = StockStatusEmun.宸插叆搴�.ObjToInt();
+ _stockService.StockInfoService.Repository.UpdateData(stockInfo);
+
+ locationEnd.LocationStatus = LocationStatusEnum.Free.ObjToInt();
_basicService.LocationInfoService.RelocationFree(locationStart, task.TaskNum);
_basicService.LocationInfoService.Repository.UpdateData(locationEnd);
- task.TaskStatus = InTaskStatusEnum.RelocationFinish.ObjToInt();
+ task.TaskStatus = RelocationTaskStatusEnum.RelocationCancel.ObjToInt();
BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
_unitOfWorkManage.CommitTran();
@@ -543,27 +717,19 @@
return WebResponseContent.Instance.Error(ex.Message);
}
}
- public bool DepthTask(Dt_Task task)
+ public bool DepthTask(Dt_LocationInfo location)
{
- Dt_LocationInfo location=_locationInfoService.Repository.QueryFirst(x=>x.LocationCode == task.SourceAddress);
- if(location != null)
+ if (location != null)
{
- if(location.Row%2==0)
+ Dt_LocationInfo locations = _locationInfoService.Repository.QueryFirst(x => x.RoadwayNo == location.RoadwayNo && x.Column == location.Column && x.Layer == location.Layer && x.Depth != location.Depth && x.Row != location.Row && (SqlFunc.Abs(x.Row - location.Row) == 1));
+ if (locations != null)
{
- Dt_LocationInfo locations = _locationInfoService.Repository.QueryFirst(x => x.Row == location.Row + 1 && x.Layer == location.Layer && x.Column == location.Column && x.RoadwayNo == location.RoadwayNo);
- Dt_Task tasks=BaseDal.QueryFirst(x=>x.SourceAddress == locations.LocationCode);
- return tasks != null ? true : false;
- }
- else
- {
- Dt_LocationInfo locations = _locationInfoService.Repository.QueryFirst(x => x.Row == location.Row - 1 && x.Layer == location.Layer && x.Column == location.Column && x.RoadwayNo == location.RoadwayNo);
Dt_Task tasks = BaseDal.QueryFirst(x => x.SourceAddress == locations.LocationCode);
return tasks != null ? true : false;
}
}
return false;
}
-
public WebResponseContent GetTaskInfo()
{
WebResponseContent content = new WebResponseContent();
@@ -574,7 +740,7 @@
{
expression = x => x.Creater == App.User.UserName;
}
- var task = BaseDal.Db.Queryable<Dt_Task>().OrderByDescending(x => x.CreateDate).Take(10).Select(x => new Dt_Task { TaskNum = x.TaskNum, PalletCode=x.PalletCode, TaskType=x.TaskType,SourceAddress=x.SourceAddress,TargetAddress=x.TargetAddress }).ToList();
+ var task = BaseDal.Db.Queryable<Dt_Task>().OrderByDescending(x => x.CreateDate).Take(10).Select(x => new Dt_Task { TaskNum = x.TaskNum, PalletCode = x.PalletCode, TaskType = x.TaskType, SourceAddress = x.SourceAddress, TargetAddress = x.TargetAddress }).ToList();
content = WebResponseContent.Instance.OK(data: task);
}
catch (Exception ex)
--
Gitblit v1.9.3