From 91f8fb7a6b52f5c6ff2119e34ef1359ec79d189e Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期四, 16 四月 2026 19:11:11 +0800
Subject: [PATCH] 优化重写plc信号以及编写海康小车报警信号
---
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs | 10 +++
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs | 10 +-
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/AGV/HIKROBOT/HKDeviceAalarmDTO.cs | 57 +++++++++++++++++++
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 8 +-
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs | 51 +++++++++++++++-
5 files changed, 123 insertions(+), 13 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/AGV/HIKROBOT/HKDeviceAalarmDTO.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/AGV/HIKROBOT/HKDeviceAalarmDTO.cs"
new file mode 100644
index 0000000..d3b61f9
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/AGV/HIKROBOT/HKDeviceAalarmDTO.cs"
@@ -0,0 +1,57 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEAWCS_DTO.AGV.HIKROBOT
+{
+
+ /// <summary>
+ /// 娴峰悍寮傚父鍛婅DTO
+ /// </summary>
+ public class HKDeviceAalarmDTO
+ {
+ /// <summary>
+ /// 鍑虹幇寮傚父鐨勪换鍔″敮涓�鏍囪瘑銆�
+ /// </summary>
+ public string robotTaskCode { get; set; }
+
+
+ /// <summary>
+ /// 浠诲姟寮傚父鍛婅鍗曞彿
+ /// </summary>
+ public string taskWarnCode { get; set; }
+
+
+ /// <summary>
+ /// 鍒濇鍑虹幇鏁呴殰鐨勬椂闂�
+ /// </summary>
+ public string startTime { get; set; }
+
+
+ /// <summary>
+ /// 姝e湪鎵ц浠诲姟鐨勬満鍣ㄤ汉鍞竴鏍囪瘑銆�
+ /// </summary>
+ public string singleRobotCode { get; set; }
+
+ /// <summary>
+ /// 鑷畾涔夋晠闅滅爜
+ /// </summary>
+ public string errorCode { get; set; }
+
+ /// <summary>
+ /// 鑷畾涔夋晠闅滄秷鎭�
+ /// </summary>
+ public string errorMsg { get; set; }
+
+
+
+ /// <summary>
+ /// 鑷畾涔夋墿灞曞瓧娈�
+ /// </summary>
+ public string extra { get; set; }
+
+
+ }
+}
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 807210b..5a40c2a 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"
@@ -312,6 +312,8 @@
/// <param name="TaskCode">浠诲姟鍙�</param>
/// <returns></returns>
WebResponseContent Hikvisiontaskscontinue(string TaskCode, string Address = null);
+
+
/// <summary>
/// 骞冲簱璐т綅涓婁笅鏋跺鍣�
/// </summary>
@@ -326,5 +328,13 @@
/// <param name="upLocationStatusDTO"></param>
/// <returns></returns>
WebResponseContent UpLocationStatus(UpLocationStatusDTO upLocationStatusDTO);
+
+
+ /// <summary>
+ /// 娴峰悍璁惧鎶ヨ淇℃伅
+ /// </summary>
+ /// <returns></returns>
+ WebResponseContent HKDeviceAlarm(HKDeviceAalarmDTO hKDeviceAalarmDTO);
+
}
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs"
index 606617e..7bf7905 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs"
@@ -34,9 +34,9 @@
try
{
Dt_HKLocationInfo? hKLocationInfo = null;
- if (taskType==(int)TaskTypeEnum.STURR)
+ if (taskType == (int)TaskTypeEnum.STURR)
{
- var reslut=_stationInfo.Repository.QueryFirst(x=>x.StationCode==taskDTO.fromLocationCode) ?? throw new Exception($"鏈壘鍒拌捣鐐硅揣浣嶃�恵taskDTO.fromLocationCode}銆�");
+ var reslut = _stationInfo.Repository.QueryFirst(x => x.StationCode == taskDTO.fromLocationCode) ?? throw new Exception($"鏈壘鍒拌捣鐐硅揣浣嶃�恵taskDTO.fromLocationCode}銆�");
}
#region 鐐瑰埌鐐�
if (!string.IsNullOrEmpty(taskDTO.toLocationCode))
@@ -143,7 +143,7 @@
throw new Exception($"缁堢偣绔欏彴銆恵taskDTO.toLocationCode}銆戠姸鎬佷笉涓虹┖闂诧紒");
}
}
- Dt_Task dt_Task = new Dt_Task()
+ Dt_Task dt_Task = new Dt_Task()
{
TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
WMSTaskNum = taskDTO.taskCode,
@@ -255,7 +255,7 @@
{
var tasktype = (TaskTypeEnum)Enum.GetValues(typeof(TaskTypeEnum)).GetValue(task.TaskType - 1);
hIKROBOTTaskSubmit.initPriority = task.Grade;
- if (task.PalletCode== "MR-Q3-600LE-D(M)")
+ if (task.PalletCode == "MR-Q3-600LE-D(M)")
{
hIKROBOTTaskSubmit.robotType = "19"; //娴峰悍 杞繍杞�
}
@@ -464,5 +464,48 @@
return content;
}
+
+
+ public WebResponseContent HKDeviceAlarm(HKDeviceAalarmDTO hKDeviceAalarmDTO)
+ {
+ WebResponseContent content = new WebResponseContent();
+ WMSReturn wMSReturn = null;
+ HKDeviceAalarmDTO hIKROBOTDeviceAlarm = null;
+ try
+ {
+ Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(HKDeviceAalarmDTO)) ?? throw new Exception("鏈壘鍒颁笂鎶ユ捣搴稟GV璁惧鎶ヨ鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
+ hIKROBOTDeviceAlarm = new HKDeviceAalarmDTO()
+ {
+ robotTaskCode = hKDeviceAalarmDTO.robotTaskCode,
+ taskWarnCode = hKDeviceAalarmDTO.taskWarnCode,
+ startTime = hKDeviceAalarmDTO.startTime,
+ singleRobotCode = hKDeviceAalarmDTO.singleRobotCode,
+ errorCode = hKDeviceAalarmDTO.errorCode,
+ errorMsg = hKDeviceAalarmDTO.errorMsg,
+ extra = hKDeviceAalarmDTO.extra,
+ };
+
+ string response = HttpHelper.Post(apiInfo.ApiAddress, hIKROBOTDeviceAlarm.Serialize());
+ wMSReturn = response.DeserializeObject<WMSReturn>();
+ if (wMSReturn.success == true && wMSReturn.message == "success")
+ {
+ content.OK("涓婃姤娴峰悍AGV璁惧鎶ヨ淇℃伅鎴愬姛");
+ }
+ else
+ {
+ content.Error(wMSReturn.message);
+ }
+ }
+ catch (Exception ex)
+ {
+ content.Error(ex.Message);
+ }
+ finally
+ {
+ _trackloginfoService.AddTrackLog(hIKROBOTDeviceAlarm, content, "涓婃姤娴峰悍AGV璁惧鎶ヨ淇℃伅", "", "");
+ }
+ return content;
+ }
+
}
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs"
index 12f5f2d..cd05af9 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs"
@@ -162,7 +162,7 @@
}
catch (Exception ex)
{
- task.ExceptionMessage = $"銆恵task.SourceAddress}銆戝啓鍏�3妤煎嚭搴撶鏀惧埌浣嶅け璐�";
+ task.ExceptionMessage = $"銆恵task.SourceAddress}銆戝啓鍏�3妤煎嚭搴撶鏀惧埌浣嶅け璐ex.Message}";
task.Remark = $"{device.DeviceCode}_Outboundboxon_{1}_{task.SourceAddress}"; throw;
}
@@ -198,7 +198,7 @@
catch (Exception ex)
{
- task.ExceptionMessage = $"銆恵task.TargetAddress}銆戝啓鍏�4妤肩┖绠辨斁鍒颁綅澶辫触";
+ task.ExceptionMessage = $"銆恵task.TargetAddress}銆戝啓鍏�4妤肩┖绠辨斁鍒颁綅澶辫触{ex.Message}";
task.Remark = $"{device.DeviceCode}_Emptyboxplacedinposition_{1}_{task.TargetAddress}";
}
@@ -234,7 +234,7 @@
catch (Exception ex)
{
- task.ExceptionMessage = $"銆恵task.SourceAddress}銆戝啓鍏�4妤煎嚭搴撳彇绠卞畬鎴愬け璐�";
+ task.ExceptionMessage = $"銆恵task.SourceAddress}銆戝啓鍏�4妤煎嚭搴撳彇绠卞畬鎴愬け璐ex.Message}";
task.Remark = $"{device.DeviceCode}_Outboundboxretrievalcompleted_{1}_{task.SourceAddress}";
}
@@ -271,7 +271,7 @@
catch (Exception ex)
{
- task.ExceptionMessage = $"銆恵Address}銆戝叧闂姹傝繘鍏ュけ璐ワ紒";
+ task.ExceptionMessage = $"銆恵Address}銆戝叧闂姹傝繘鍏ュけ璐ワ紒{ex.Message}";
task.Remark = $"{device.DeviceCode}_RequestToEnter_{false}_{Address}";
}
@@ -315,7 +315,7 @@
catch (Exception ex)
{
- task.ExceptionMessage = $"銆怲SJR3F銆�3妤艰鐮佽Е鍙戝け璐ワ紒";
+ task.ExceptionMessage = $"銆怲SJR3F銆�3妤艰鐮佽Е鍙戝け璐ワ紒{ex.Message}";
task.Remark = $"{device.DeviceCode}_Codereadingtriggered_{1}_TSJR3F";
}
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 2b93a1e..87e298c 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"
@@ -392,7 +392,7 @@
bool isAGV = dt_Task.TaskType == (int)TaskTypeEnum.CPInbound || dt_Task.TaskType == (int)TaskTypeEnum.CPOutbound;
//娴峰悍
- bool isHK = dt_Task.TaskType == (int)TaskTypeEnum.F01 || dt_Task.TaskType == (int)TaskTypeEnum.RK3F || dt_Task.TaskType == (int)TaskTypeEnum.CK3F || dt_Task.TaskType == (int)TaskTypeEnum.Q1TSJ4 || dt_Task.TaskType == (int)TaskTypeEnum.STU0003 || dt_Task.TaskType == (int)TaskTypeEnum.F02 || dt_Task.TaskType == (int)TaskTypeEnum.CHUKU1 || dt_Task.TaskType == (int)TaskTypeEnum.Q3RK || dt_Task.TaskType == (int)TaskTypeEnum.Q3CK||dt_Task.TaskType == (int)TaskTypeEnum.STUPTBY;
+ bool isHK = dt_Task.TaskType == (int)TaskTypeEnum.F01 || dt_Task.TaskType == (int)TaskTypeEnum.RK3F || dt_Task.TaskType == (int)TaskTypeEnum.CK3F || dt_Task.TaskType == (int)TaskTypeEnum.Q1TSJ4 || dt_Task.TaskType == (int)TaskTypeEnum.STU0003 || dt_Task.TaskType == (int)TaskTypeEnum.F02 || dt_Task.TaskType == (int)TaskTypeEnum.CHUKU1 || dt_Task.TaskType == (int)TaskTypeEnum.Q3RK || dt_Task.TaskType == (int)TaskTypeEnum.Q3CK || dt_Task.TaskType == (int)TaskTypeEnum.STUPTBY;
//淇敼鍘熸湰浠诲姟浼樺厛绾�
dt_Task.Grade = updateTaskPriority.taskPriority;
#region 鍑箰澹�
@@ -523,7 +523,7 @@
var kls = new List<Dt_KLSLocationInfo>();
var hk = new List<Dt_HKLocationInfo>();
List<Dt_StationInfo> pk = new List<Dt_StationInfo>();
- if (wMSUpdateLocationArea==null)
+ if (wMSUpdateLocationArea == null)
{
return content.Error("璇锋眰鍙傛暟涓嶈兘涓虹┖");
}
@@ -1156,7 +1156,7 @@
LocationStatus = item.LocationStatus,
EnableStatus = item.EnableStatus,
PalletCode = item.PalletCode,
- AreaCode=item.WarehouseId
+ AreaCode = item.WarehouseId
});
}
@@ -1785,7 +1785,7 @@
var station = _stationInfo.Repository.QueryFirst(x => x.StationCode == locationCode);
if (station != null)
{
- station.IsOccupied = upLocationStatusDTO.EnableStatus==0?0:1;
+ station.IsOccupied = upLocationStatusDTO.EnableStatus == 0 ? 0 : 1;
locationsToUpdate.Add(station);
resultList.Add(new
--
Gitblit v1.9.3