From 3d07ccb8342a92b32bc8858ecf56d257d6b500c9 Mon Sep 17 00:00:00 2001
From: duyongjia <adu_555@163.com>
Date: 星期三, 27 十一月 2024 16:38:55 +0800
Subject: [PATCH] 前端增加任务取消按钮
---
/dev/null | 0
代码管理/WCS/WIDESEAWCS_Client/src/extension/taskinfo/task.js | 17 +++++
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs | 12 ++++
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs | 18 ++++-
代码管理/WCS/WIDESEAWCS_Client/config/buttons.js | 4
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 75 ++++++++++++++++++++++++
6 files changed, 118 insertions(+), 8 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/config/buttons.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/config/buttons.js"
index 5da342f..59da816 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/config/buttons.js"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/config/buttons.js"
@@ -105,8 +105,8 @@
}
},
{
- name: "鍒� 闄�",
- icon: 'el-icon-delete',
+ name: "鍒犻櫎",
+ icon: '',
class: '',
value: 'Delete',
type: 'danger',
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/extension/taskinfo/task.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/extension/taskinfo/task.js"
index 95a0325..b5dc2a9 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/extension/taskinfo/task.js"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/extension/taskinfo/task.js"
@@ -23,6 +23,7 @@
if (forceCompleteTaskButton) {
forceCompleteTaskButton.onClick = () => {
let rows = this.$refs.table.getSelected();
+ console.log("rows"+rows);
if (rows.length == 0 || rows.length > 1) return this.$error("璇烽�夋嫨涓�琛屾暟鎹�");
this.http
.post("/api/Task/ForceCompleteTask?taskNum=" + rows[0].TaskNum, {}, true)
@@ -34,6 +35,22 @@
}
}
+ var cancelTaskButton = this.buttons.find((x) => x.value == "TaskCancel");
+ if (cancelTaskButton) {
+ cancelTaskButton.onClick = () => {
+ let rows = this.$refs.table.getSelected();
+ console.log("rows"+rows);
+ if (rows.length == 0 || rows.length > 1) return this.$error("璇烽�夋嫨涓�琛屾暟鎹�");
+ this.http
+ .post("/api/Task/CancelTask?taskNum=" + rows[0].TaskNum, {}, true)
+ .then((x) => {
+ if (!x.status) return this.$message.error(x.message);
+ this.options = x.data;
+ console.log(this.options);
+ });
+ }
+ }
+
var previousButton = this.buttons.find((x) => x.value == "Previous");
if (previousButton) previousButton.hidden = true;
var nextButton = this.buttons.find((x) => x.value == "Next");
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/05ffa60e-9142-41b3-9d1d-6208c682ca6c.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/05ffa60e-9142-41b3-9d1d-6208c682ca6c.vsidx"
deleted file mode 100644
index ea4c3e7..0000000
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/05ffa60e-9142-41b3-9d1d-6208c682ca6c.vsidx"
+++ /dev/null
Binary files differ
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/71c48791-3b71-4064-86d1-e13fb205685c.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/71c48791-3b71-4064-86d1-e13fb205685c.vsidx"
deleted file mode 100644
index 7d67b1c..0000000
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/71c48791-3b71-4064-86d1-e13fb205685c.vsidx"
+++ /dev/null
Binary files differ
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/7a1458f8-0596-42c0-8957-d12b8cc9fbca.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/7a1458f8-0596-42c0-8957-d12b8cc9fbca.vsidx"
deleted file mode 100644
index d3a6800..0000000
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/7a1458f8-0596-42c0-8957-d12b8cc9fbca.vsidx"
+++ /dev/null
Binary files differ
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/ba596010-9901-42ab-9692-7e16dab54f48.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/ba596010-9901-42ab-9692-7e16dab54f48.vsidx"
deleted file mode 100644
index aad9e2b..0000000
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/ba596010-9901-42ab-9692-7e16dab54f48.vsidx"
+++ /dev/null
Binary files differ
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/c3887a9d-f738-4fa1-b9b8-dcb27de764cc.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/c3887a9d-f738-4fa1-b9b8-dcb27de764cc.vsidx"
deleted file mode 100644
index b7f39d6..0000000
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/c3887a9d-f738-4fa1-b9b8-dcb27de764cc.vsidx"
+++ /dev/null
Binary files differ
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
index 898644a..57e54d2 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
@@ -176,7 +176,19 @@
/// <param name="taskId">浠诲姟鍙�</param>
/// <param name="status">浠诲姟鐘舵��</param>
void UpdateTaskStatus(int taskId, int status);
+ /// <summary>
+ /// 浠诲姟寮哄埗瀹屾垚
+ /// </summary>
+ /// <param name="taskNum"></param>
+ /// <returns></returns>
+ WebResponseContent ForceCompleteTask(int taskNum);
+ /// <summary>
+ /// 浠诲姟鍙栨秷
+ /// </summary>
+ /// <param name="taskid"></param>
+ /// <returns></returns>
+ WebResponseContent CancelTask(int taskid);
/// <summary>
/// 鏇存柊浠诲姟鐘舵�佷俊鎭拰鏃х殑浠诲姟鍙凤紙1001锛�3001鏃朵竴鏍蜂换鍔″彿锛�
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs"
index b361d07..1ad1b94 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs"
@@ -61,13 +61,23 @@
return Service.ReceiveMESTask(taskDTO);
}
- [Route("Del")]
- public new WebResponseContent Del([FromBody] object[] key)
+ /// <summary>
+ /// 浠诲姟鍙栨秷
+ /// </summary>
+ /// <param name="key"></param>
+ /// <returns></returns>
+ [Route("CancelTask")]
+ public WebResponseContent CancelTask(int taskNum)
{
-
- return null;
+ return Service.CancelTask(taskNum);
+
}
+ /// <summary>
+ /// 浠诲姟寮哄埗瀹屾垚
+ /// </summary>
+ /// <param name="taskNum"></param>
+ /// <returns></returns>
[HttpPost, HttpGet, Route("ForceCompleteTask")]
public WebResponseContent ForceCompleteTask (int taskNum)
{
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 72477fb..dec3bb8 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -54,6 +54,7 @@
private readonly ILocationInfoRepository _locationInfoRepository;
private readonly IMapper _mapper;
private readonly IUnitOfWorkManage _unitOfWorkManage;
+ private readonly ITaskRepository _taskRepository;
private Dictionary<string, OrderByType> _taskOrderBy = new()
{
@@ -71,7 +72,7 @@
public List<int> TaskOtherboundTypes => typeof(TaskOtherTypeEnum).GetEnumIndexList();
- public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ILocationInfoRepository locationInfoRepository, IUnitOfWorkManage unitOfWorkManage) : base(BaseDal)
+ public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ILocationInfoRepository locationInfoRepository, IUnitOfWorkManage unitOfWorkManage, ITaskRepository taskRepository) : base(BaseDal)
{
_routerService = routerService;
_taskExecuteDetailService = taskExecuteDetailService;
@@ -79,6 +80,7 @@
_mapper = mapper;
_locationInfoRepository = locationInfoRepository;
_unitOfWorkManage = unitOfWorkManage;
+ _taskRepository = taskRepository;
}
/// <summary>
@@ -678,7 +680,7 @@
_taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, task.ExceptionMessage);
- content = WebResponseContent.Instance.OK();
+
}
catch (Exception ex)
{
@@ -702,6 +704,75 @@
BaseDal.UpdateData(task);
}
+ /// <summary>
+ /// 浠诲姟寮哄埗瀹屾垚
+ /// </summary>
+ /// <param name="taskNum"></param>
+ /// <returns></returns>
+ public WebResponseContent ForceCompleteTask(int taskNum)
+ {
+ return null;
+
+ }
+
+ /// <summary>
+ /// 浠诲姟鍙栨秷
+ /// </summary>
+ /// <param name="taskid"></param>
+ /// <returns></returns>
+ public WebResponseContent CancelTask(int taskid)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ //鍏堟煡璇换鍔★紝鏍规嵁涓嶅悓鐨勪换鍔$被鍨嬪仛浠诲姟鍙栨秷鎿嶄綔
+ bool isAllow = false;
+ Dt_Task task = _taskRepository.QueryFirst(x => x.TaskId == taskid);
+ if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟id:銆恵taskid}銆�");
+
+ //濡傛灉鏄叆搴撳垎鑷姩鍜屾墜鍔ㄤ袱绉嶆儏鍐靛鐞�
+ if (task.TaskType == (int)TaskInboundTypeEnum.Inbound)
+ {
+ if (task.WMSId == 0 && task.TaskState == (int)TaskInStatusEnum.InNew)//鑷姩鍏ュ簱锛�1001-AGV璇锋眰鏄惁鍏佽杩涘叆锛屼换鍔$姸鎬佷负鈥滄柊寤哄叆搴撲换鍔�200鈥濅箣鍓嶅彲浠ュ彇娑�
+ {
+ isAllow = true;
+ task.TaskState = (int)TaskInStatusEnum.InCancel;
+ }
+ else if (task.WMSId == 1 && task.TaskState == (int)TaskInStatusEnum.AGV_InExecuting)//鎵嬪姩鍏ュ簱锛�3001-AGV鏀捐揣瀹屾垚锛屼换鍔$姸鎬佷负鈥淎GV鍏ュ簱鎵ц涓�210鈥濅箣鍓嶅彲浠ュ彇娑�
+ {
+ isAllow = true;
+ task.TaskState = (int)TaskInStatusEnum.InCancel;
+ }
+ }
+ else//鍏朵粬浠诲姟锛屼换鍔$姸鎬佲�滄柊寤哄嚭搴撲换鍔♀�濅箣鍓嶏紝鎵嶅彲浠ュ彇娑�
+ {
+ if (task.TaskState == (int)TaskOutStatusEnum.OutNew)
+ {
+ isAllow = true;
+ task.TaskState = (int)TaskOutStatusEnum.OutCancel;
+ }
+ }
+
+ if (isAllow)//濡傛灉鍏佽鍙栨秷
+ {
+ //鏇存柊鐘舵�佷负浠诲姟鍙栨秷
+ UpdateTaskStatus(task.TaskId, task.TaskState);
+ _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鎵嬪姩浠诲姟鍙栨秷");
+ content = WebResponseContent.Instance.OK("鍙栨秷鎴愬姛锛�");
+ //鍚屾鍥炰紶WMS
+ }
+ else
+ {
+ content = WebResponseContent.Instance.OK("璇ヤ换鍔$洰鍓嶇姸鎬佷笉鍏呰鍙栨秷锛�");
+ }
+ }
+ catch (Exception ex)
+ {
+ content = WebResponseContent.Instance.Error(ex.Message);
+ }
+ return content;
+ }
+
/// <summary>
/// 鏇存柊浠诲姟鐘舵�佷俊鎭拰鏂扮殑浠诲姟鍙凤紙1001锛�3001鏃朵竴鏍蜂换鍔″彿锛�
--
Gitblit v1.9.3