From 821af8301009019a0f0e81a3ea2a0ae7952b5025 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期三, 28 一月 2026 11:43:30 +0800
Subject: [PATCH] 更新
---
项目代码/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs | 70 +++++++++++++++++++++++++++++++++-
1 files changed, 67 insertions(+), 3 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs"
index c94b3ea..abcbd34 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -200,6 +200,7 @@
WebResponseContent content = new WebResponseContent();
try
{
+ WriteLog.Write_Log("瀹瑰櫒鍏ュ簱鍒涘缓浠诲姟", $"杈撻�佺嚎淇℃伅", "寮�濮嬪叆搴�", $"鎵樼洏鍙穥containerFlowDTO.ContainerCode}锛岃澶噞deviceCode}");
List<Dt_LocationInfo> locationInfos = _locationInfoRepository.QueryData();
Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.PalletCode == containerFlowDTO.ContainerCode);
if (locationInfo != null) throw new Exception($"搴撲綅鏂欑鍙穥containerFlowDTO.ContainerCode}宸插瓨鍦�");
@@ -221,13 +222,14 @@
_taskExecuteDetailService.AddTaskExecuteDetail(new List<int>() { taskOld.TaskNum }, $"{oldSlotCode}鎹㈣嚦{containerFlowDTO.SlotCode}鍏ュ簱");
return content.OK();
}
- else if(taskOld != null)
+ else if (taskOld != null)
{
- throw new Exception($"鏂欑鍙穥containerFlowDTO.ContainerCode}" + (taskOld.TaskType == TaskTypeEnum.Inbound.ObjToInt() ? "鍏ュ簱AGV鎵ц涓�": "鍑哄簱AGV鎵ц涓�"));
+ throw new Exception($"鏂欑鍙穥containerFlowDTO.ContainerCode}" + (taskOld.TaskType == TaskTypeEnum.Inbound.ObjToInt() ? "鍏ュ簱AGV鎵ц涓�" : "鍑哄簱AGV鎵ц涓�"));
}
Dt_LocationInfo? noInLocation = locationInfos.FirstOrDefault(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt());
if (noInLocation == null) throw new Exception($"鍙敤璐т綅涓嶈冻!");
Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt() && x.StationDeviceCode == deviceCode);
+ WriteLog.Write_Log("瀹瑰櫒鍏ュ簱鍒涘缓浠诲姟", $"绔欏彴淇℃伅", "鏌ヨ绔欏彴", $"绔欏彴鍙穥stationManger.StationCode}锛岃澶噞stationManger.StationDeviceCode}");
//鍒涘缓浠诲姟
Dt_Task task = new Dt_Task();
task.PalletCode = containerFlowDTO.ContainerCode;
@@ -242,7 +244,8 @@
task.TaskState = TaskStatusEnum.CL_Executing.ObjToInt();
//娣诲姞浠诲姟
- BaseDal.AddData(task);
+ int taskId = BaseDal.AddData(task);
+ WriteLog.Write_Log("瀹瑰櫒鍏ュ簱鍒涘缓浠诲姟", $"浠诲姟淇℃伅", "鍒涘缓鍏ュ簱", $"浠诲姟鍙凤細{taskId},鎵樼洏缂栧彿锛歿task.PalletCode}");
if (type > 0)
{
_taskExecuteDetailService.AddTaskExecuteDetail(new List<int>() { task.TaskNum }, "鎵嬪姩鎸夐挳鍏ュ簱");
@@ -255,6 +258,7 @@
}
catch (Exception ex)
{
+ WriteLog.Write_Log("瀹瑰櫒鍏ュ簱鍒涘缓浠诲姟", $"浠诲姟", "鍒涘缓鍏ュ簱", $"澶辫触锛歿ex.Message}");
content.Error($"閿欒淇℃伅:{ex.Message}");
}
return content;
@@ -809,6 +813,65 @@
return content;
}
/// <summary>
+ /// 浜哄伐鎵嬪姩鍙栨秷鎸囧畾浠诲姟
+ /// </summary>
+ /// <param name="taskNum">浠诲姟缂栧彿</param>
+ /// <returns>鎿嶄綔缁撴灉</returns>
+ public WebResponseContent ManualTaskCancellation(int taskNum)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ // 1. 鑾峰彇浠诲姟淇℃伅
+ Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
+ if (task == null)return content.Error($"浠诲姟{taskNum}涓嶅瓨鍦�");
+
+ TaskTypeGroup group = task.TaskType.GetTaskTypeGroup();
+ if (group == TaskTypeGroup.InboundGroup)// 鍏ュ簱浠诲姟鍙栨秷
+ {
+ // 鑾峰彇鐩爣璐т綅
+ Dt_LocationInfo locationInfo = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress);
+ if (locationInfo == null)return content.Error($"鐩爣璐т綅{task.TargetAddress}涓嶅瓨鍦�");
+ // 楠岃瘉璐т綅鐘舵��
+ if (locationInfo.LocationStatus != LocationStatusEnum.Lock.ObjToInt())
+ return content.Error($"{task.TargetAddress}璐т綅鐘舵�佸紓甯革紝鏃犳硶鍙栨秷");
+
+ // 鎭㈠璐т綅鐘舵��
+ locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); // 鎭㈠涓虹┖闂茬姸鎬�
+ locationInfo.PalletCode = ""; // 娓呯┖鎵樼洏鍙�
+ // 鏇存柊鏁版嵁搴�
+ _unitOfWorkManage.BeginTran();
+ _locationInfoRepository.UpdateData(locationInfo);
+ BaseDal.DeleteAndMoveIntoHty(task, OperateTypeEnum.浜哄伐鍒犻櫎);
+ _unitOfWorkManage.CommitTran();
+ // 璁板綍鐘舵�佸彉鏇�
+ _locationStatusChangeRecordService.AddLocationStatusChangeRecord(
+ locationInfo,
+ LocationStatusEnum.Lock,
+ LocationStatusEnum.Free,
+ LocationChangeType.InboundCancelled,
+ task.TaskNum
+ );
+ content.OK("浠诲姟鍙栨秷鎴愬姛");
+ }
+ else
+ {
+ content.Error("鍙兘鍏ュ簱浠诲姟鍙栨秷锛�");
+ }
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ content.Error($"鍙栨秷澶辫触: {ex.Message}");
+ // 璁板綍璇︾粏閿欒
+ _taskExecuteDetailService.AddTaskExecuteDetail(
+ new Dt_Task { TaskNum = taskNum },
+ $"浠诲姟鍙栨秷寮傚父: {ex.Message}"
+ );
+ }
+ return content;
+ }
+ /// <summary>
/// 浠诲姟鍙栨秷
/// </summary>
/// <returns></returns>
@@ -1077,5 +1140,6 @@
}
return content;
}
+
}
}
--
Gitblit v1.9.3