From eaa07b80e3400da9be84e9a7a834e56d829a625b Mon Sep 17 00:00:00 2001
From: huanghongfeng <huanghongfeng@hnkhzn.com>
Date: 星期三, 29 十月 2025 14:32:32 +0800
Subject: [PATCH] 1
---
代码管理/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RgvOperationService.cs | 256 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 249 insertions(+), 7 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RgvOperationService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RgvOperationService.cs"
index f8edb2f..bedb574 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RgvOperationService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RgvOperationService.cs"
@@ -48,15 +48,19 @@
using WIDESEAWCS_QuartzJob.Service;
using System.Net;
using WIDESEAWCS_ISystemServices;
+using System.Security.Claims;
+using WIDESEAWCS_Common.TaskEnum;
namespace WIDESEAWCS_TaskInfoService
{
public class RgvOperationService : ServiceBase<Dt_Task_hty, ITask_HtyRepository>, IRgvOperationService
{
private readonly IAgvStationService _gvStationService;
- public RgvOperationService(ITask_HtyRepository BaseDal, IAgvStationService agvStationService) : base(BaseDal)
+ private readonly ITaskRepository _taskRepository;
+ public RgvOperationService(ITask_HtyRepository BaseDal, IAgvStationService agvStationService, ITaskRepository taskRepository) : base(BaseDal)
{
_gvStationService = agvStationService;
+ _taskRepository = taskRepository;
}
@@ -104,17 +108,17 @@
case "1": // 宸ヤ綔妯″紡锛�0鎵嬪姩銆�1鑷姩锛�
//鑾峰彇瀹炰緥
DeviceProDTO? RGV_DWorkingmode = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_DWorkingmode", "DeviceCommand"); //浠诲姟绫诲瀷
- //绗竴姝ュ啓鍏ヤ换鍔�
+ //绗竴姝ュ啓鍏ヤ换鍔�
RgvSetLine(Commonstacker, RGV_DWorkingmode.DeviceProAddress, WriteRGVvalue);
break;
case "2": //澶嶄綅鎿嶄綔锛�0涓嶅浣嶃��1澶嶄綅锛�
DeviceProDTO? RGV_Resetoperation = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_Resetoperation", "DeviceCommand"); //浠诲姟绫诲瀷
- //绗竴姝ュ啓鍏ヤ换鍔�
+ //绗竴姝ュ啓鍏ヤ换鍔�
RgvSetLine(Commonstacker, RGV_Resetoperation.DeviceProAddress, WriteRGVvalue);
break;
case "3": //浠诲姟纭瀹屾垚锛�0涓嶇‘瀹氾紝1纭畾锛�
DeviceProDTO? RGV_taskcomplete = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_taskcomplete", "RGV_taskcomplete"); //浠诲姟绫诲瀷
- //绗竴姝ュ啓鍏ヤ换鍔�
+ //绗竴姝ュ啓鍏ヤ换鍔�
RgvSetLine(Commonstacker, RGV_taskcomplete.DeviceProAddress, WriteRGVvalue);
break;
case "4": //浠诲姟绫诲瀷(4娓呴櫎)
@@ -163,7 +167,7 @@
}
/// <summary>
- /// 鍐欏叆澶嶄綅锛堝叆搴撶锛�
+ /// 涓�閿惎鍔ㄥ叆搴撳瓙姣嶈溅
/// </summary>
public WebResponseContent WriteInReset(SaveModel saveModel)
{
@@ -172,7 +176,7 @@
List<AGVStation> rgvdata = _gvStationService.GetInStroller();
foreach (AGVStation rgvstation in rgvdata)
{
- string DeviceName = saveModel.DelKeys[0].ToString(); //璁惧鍚嶇О
+ string DeviceName = rgvstation.ChildPosiDeviceCode; //璁惧鍚嶇О
IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == DeviceName);
if (device == null) continue;
SpeStackerCrane Commonstacker = (SpeStackerCrane)device;
@@ -200,6 +204,70 @@
//鑾峰彇闇�瑕佸浣嶇殑璁惧
DeviceProDTO? RGV_Resetoperation = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_Resetoperation", "DeviceCommand"); //澶嶄綅鎶ヨ淇℃伅
+ RgvSetLine(Commonstacker, RGV_Resetoperation.DeviceProAddress, (short)0);
+ }
+ return webResponse.OK();
+ }
+
+ /// <summary>
+ /// 涓�閿殏鍋�
+ /// </summary>
+ /// <param name="saveModel"></param>
+ /// <returns></returns>
+ public WebResponseContent WriteOutbuttonpause(SaveModel saveModel)
+ {
+ WebResponseContent webResponse = new WebResponseContent();
+ List<AGVStation> rgvdata = _gvStationService.GetOutStroller();
+ foreach (AGVStation rgvstation in rgvdata)
+ {
+ string DeviceName = rgvstation.ChildPosiDeviceCode; //璁惧鍚嶇О
+ IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == DeviceName);
+ if (device == null) continue;
+ SpeStackerCrane Commonstacker = (SpeStackerCrane)device;
+
+ //鑾峰彇闇�瑕佸浣嶇殑璁惧
+ DeviceProDTO? RGV_Resetoperation = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_DWorkingmode", "DeviceCommand");
+ RgvSetLine(Commonstacker, RGV_Resetoperation.DeviceProAddress, (short)0);
+ }
+ return webResponse.OK();
+ }
+
+ public WebResponseContent InWriteOutbuttonpause(SaveModel saveModel)
+ {
+ WebResponseContent webResponse = new WebResponseContent();
+ List<AGVStation> rgvdata = _gvStationService.InGetOutStroller();
+ foreach (AGVStation rgvstation in rgvdata)
+ {
+ string DeviceName = rgvstation.ChildPosiDeviceCode; //璁惧鍚嶇О
+ IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == DeviceName);
+ if (device == null) continue;
+ SpeStackerCrane Commonstacker = (SpeStackerCrane)device;
+
+ //鑾峰彇闇�瑕佸浣嶇殑璁惧
+ DeviceProDTO? RGV_Resetoperation = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_DWorkingmode", "DeviceCommand");
+ RgvSetLine(Commonstacker, RGV_Resetoperation.DeviceProAddress, (short)0);
+ }
+ return webResponse.OK();
+ }
+
+ /// <summary>
+ /// 涓�閿惎鍔�
+ /// </summary>
+ /// <param name="saveModel"></param>
+ /// <returns></returns>
+ public WebResponseContent WriteOuttouchstart(SaveModel saveModel)
+ {
+ WebResponseContent webResponse = new WebResponseContent();
+ List<AGVStation> rgvdata = _gvStationService.GetOutStroller();
+ foreach (AGVStation rgvstation in rgvdata)
+ {
+ string DeviceName = rgvstation.ChildPosiDeviceCode; //璁惧鍚嶇О
+ IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == DeviceName);
+ if (device == null) continue;
+ SpeStackerCrane Commonstacker = (SpeStackerCrane)device;
+
+ //鑾峰彇闇�瑕佸浣嶇殑璁惧
+ DeviceProDTO? RGV_Resetoperation = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_DWorkingmode", "DeviceCommand");
RgvSetLine(Commonstacker, RGV_Resetoperation.DeviceProAddress, (short)1);
}
return webResponse.OK();
@@ -224,7 +292,7 @@
/// <param name="conveyorLine"></param>
/// <param name="DeviceProDataBlock"></param>
/// <returns></returns>
- public static int GetLine(CommonConveyorLine Commonstacker, string DeviceProDataBlock)
+ public static int GetLine(SpeStackerCrane Commonstacker, string DeviceProDataBlock)
{
return Commonstacker.Communicator.Read<short>(DeviceProDataBlock);
}
@@ -240,7 +308,181 @@
return Commonstacker.Communicator.Write<short>(DeviceProDataBlock, rgvvalues);
}
+ /// <summary>
+ /// 姝e父鍏ュ簱
+ /// </summary>
+ public WebResponseContent WriteInNormal(SaveModel saveModel)
+ {
+ WebResponseContent content = new WebResponseContent();
+ Dt_Task dt_Task = _taskRepository.QueryFirst(x => x.TaskState == (int)TaskInStatusEnum.InAbnormalFinish);
+ dt_Task.TaskState = (int)TaskInStatusEnum.RGV_InPickupFinish;
+ dt_Task.RGVTaskType = (int)RGVTaskTypeEnum.Placing;
+ dt_Task.NextAddress = "1021";
+ _taskRepository.UpdateData(dt_Task);
+ return content;
+ }
+ /// <summary>
+ /// 鍏ュ簱寮傚父鎺掑嚭
+ /// </summary>
+ public WebResponseContent WriteInAbnormal(SaveModel saveModel)
+ {
+ WebResponseContent content = new WebResponseContent();
+ Dt_Task dt_Task = _taskRepository.QueryFirst(x => x.TaskState == (int)TaskInStatusEnum.InAbnormalFinish);
+ dt_Task.TaskState = (int)TaskInStatusEnum.InexceptionalSelection;
+ dt_Task.RGVTaskType = (int)RGVTaskTypeEnum.Placing;
+ _taskRepository.UpdateData(dt_Task);
+ return content;
+ }
+
+ public static List<string> OutStationareaList = new List<string>() { "RGV111", "RGV116", "RGV110", "RGV112", "RGV114", "RGV115", "RGV118" };
+ public static List<string> InStationareaList = new List<string>() { "RGV111", "RGV116", "RGV110", "RGV112", "RGV114", "RGV115", "RGV118" };
+ /// <summary>
+ /// 鏌ョ湅鎶ヨ
+ /// </summary>
+ public bool AQMReadAlarminform(int tasktype)
+ {
+ var deviceList = tasktype == 1 ? InStationareaList : OutStationareaList;
+
+ foreach (string deviceName in deviceList)
+ {
+ IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == deviceName);
+ if (device == null) return false;
+
+ SpeStackerCrane stacker = (SpeStackerCrane)device;
+ DeviceProDTO? faultInfo = GetRGVDeviceProDTO(stacker, deviceName, "RGV_Faultcode", "ReadDeviceCommand");
+ int alarmCode = GetLine(stacker, faultInfo.DeviceProAddress);
+
+ if (alarmCode != 0)
+ {
+ return true;
+ }
+ }
+
+ return true;
+ }
+
+
+ /// <summary>
+ /// 鏌ョ湅鎶ヨ
+ /// </summary>
+ public WebResponseContent ReadAlarminformation(SaveModel saveModel)
+ {
+ WebResponseContent webResponse = new WebResponseContent();
+ string DeviceName = saveModel.DelKeys[0].ToString(); //璁惧鍚嶇О
+ IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == DeviceName);
+ if (device == null) return webResponse.Error();
+ SpeStackerCrane Commonstacker = (SpeStackerCrane)device;
+ DeviceProDTO? RGV_Resetoperation = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_Faultcode", "ReadDeviceCommand");
+ int baoj = GetLine(Commonstacker, RGV_Resetoperation.DeviceProAddress);
+ string alarmMessage = "";
+ if (DeviceName == "RGV118")
+ {
+ alarmMessage = GetAlarmMessage(baoj);
+ }
+ else if (DeviceName == "RGV111" || DeviceName == "RGV116")
+ {
+ alarmMessage = GetAlarmMessage2(baoj);
+ }
+ else if (DeviceName == "RGV110" || DeviceName == "RGV112" || DeviceName == "RGV114" || DeviceName == "RGV115")
+ {
+ alarmMessage = GetAlarmMessage3(baoj);
+ }
+
+
+ return webResponse.OK(data: alarmMessage);
+ }
+
+ // 鎶ヨ浠g爜鏄犲皠鏂规硶
+ private string GetAlarmMessage(int alarmCode)
+ {
+ var alarmMessages = new Dictionary<int, string>
+ {
+ {0, "鏃犳姤璀�"},
+ {1, "RGV灏忚溅鎬ュ仠琚寜涓�"},
+ {2, "姝h浆闆疯揪鎶ヨ"},
+ {3, "鍙嶈浆闆疯揪鎶ヨ"},
+ {4, "鍓嶈繘闄愪綅鎶ヨ"},
+ {5, "鍚庨��闄愪綅鎶ヨ"},
+ {6, ""},
+ {7, "PLC鎽稿潡鏁呴殰"},
+ {8, "PLC鎵╁睍妯″潡鏁呴殰"},
+ {9, "绉伴噸妯″潡鏁呴殰"},
+ {10, "鎵爜瀹氫綅鏁呴殰"},
+ {11, "RGV闀挎椂闂寸┖杞晠闅�"},
+ {12, "鐩殑鍦颁笉绛変簬瀹為檯浣嶇疆鏁呴殰"},
+ {13, "涓庢�绘帶閫氳鏁呴殰"},
+ {14, "鍓嶉浄杈惧睆钄借鍛�"},
+ {15, "鍚庨浄杈惧睆钄借鍛�"},
+ {16, "琛岃蛋鍙橀鍣ㄦ晠闅�"},
+ {17, "浼哥缉鍙夊彉棰戝櫒鏁呴殰"},
+ {18, "娑插帇鍗曞厓杩囪浇淇濇姢鏁呴殰"},
+ {19, "娑插帇涓婂崌瓒呮椂鎶ヨ"},
+ {20, "娑插帇涓嬮檷瓒呮椂鎶ヨ"},
+ {21, "浼哥缉鍙変几鍑鸿秴鏃舵姤璀�"},
+ {22, "浼哥缉鍙夌缉鍥炶秴鏃舵姤璀�"},
+ {23, "澶栧舰妫�娴嬫姤璀�"},
+ {24, "绉伴噸瓒呴噸鎶ヨ"},
+ {25, "璐у弶浼稿嚭鏋侀檺闄愪綅鎶ヨ"},
+ {26, "璐у弶缂╁洖鏋侀檺闄愪綅鎶ヨ"},
+ {27, "鍙栬揣鏃惰嚜韬湁璐х墿鎶ヨ"},
+ {28, "鏀捐揣鏃惰嚜韬棤璐х墿鎶ヨ"},
+ {29, "璐у弶鏈洖鍒板垵濮嬩綅鎶ヨ"},
+ {30, "瑙﹀彂浠呯Щ鍔ㄥ懡浠ゆ椂璐у弶涓嶅湪鍒濆浣嶆姤璀�"},
+ {31, "璐у弶鍒拌揪鍒濆浣嶄絾涓綅浼犳劅鍣ㄦ湭妫�娴嬪埌鎶ヨ"}
+ };
+
+ return alarmMessages.ContainsKey(alarmCode) ? alarmMessages[alarmCode] : "鏈煡鎶ヨ浠g爜";
+ }
+
+
+ private string GetAlarmMessage2(int alarmCode)
+ {
+ var alarmMessages = new Dictionary<int, string>
+ {
+ {0, "鏃犳姤璀�"},
+ {1, "RGV灏忚溅鎬ュ仠琚寜涓�"},
+ {2, "鍓嶈繘闄愪綅鎶ヨ"},
+ {3, "鍚庨��闄愪綅鎶ヨ"},
+ {4, "PLC鎽稿潡鏁呴殰"},
+ {5, "PLC鎵╁睍妯″潡鏁呴殰"},
+ {6, "鎵爜瀹氫綅鏁呴殰"},
+ {7, "RGV闀挎椂闂寸┖杞晠闅�"},
+ {8, "鐩殑鍦颁笉绛変簬瀹為檯浣嶇疆鏁呴殰"},
+ {9, "涓庢�绘帶閫氳鏁呴殰"},
+ {10, "琛岃蛋鍙橀鍣ㄦ晠闅�"},
+ {11, "娑插帇鍗曞厓杩囪浇淇濇姢鏁呴殰"},
+ {12, "娑插帇涓婂崌瓒呮椂鎶ヨ"},
+ {13, "娑插帇涓嬮檷瓒呮椂鎶ヨ"},
+ {14, "鍙栬揣鏃惰嚜韬湁璐х墿鎶ヨ"},
+ {15, "鏀捐揣鏃惰嚜韬棤璐х墿鎶ヨ"},
+ {16, "鍙栬揣妫�娴嬩笉鍒拌揣鐗╂姤璀�"}
+ };
+
+ return alarmMessages.ContainsKey(alarmCode) ? alarmMessages[alarmCode] : "鏈煡鎶ヨ浠g爜";
+ }
+
+ private string GetAlarmMessage3(int alarmCode)
+ {
+ var alarmMessages = new Dictionary<int, string>
+ {
+ {0, "鏃犳姤璀�"},
+ {1, "RGV灏忚溅鎬ュ仠琚寜涓�"},
+ {2, "鍓嶈繘闄愪綅鎶ヨ"},
+ {3, "鍚庨��闄愪綅鎶ヨ"},
+ {4, "PLC鎽稿潡鏁呴殰"},
+ {5, "PLC鎵╁睍妯″潡鏁呴殰"},
+ {6, "RGV闀挎椂闂寸┖杞晠闅�"},
+ {7, "鐩殑鍦颁笉绛変簬瀹為檯浣嶇疆鏁呴殰"},
+ {8, "涓庢�绘帶閫氳鏁呴殰"},
+ {9, "琛岃蛋鍙橀鍣ㄦ晠闅�"},
+ {10, "鍙栬揣鏃惰嚜韬湁璐х墿鎶ヨ"},
+ {11, "鏀捐揣鏃惰嚜韬棤璐х墿鎶ヨ"},
+ {12, "鍋滄鏃朵綅缃繃鍐叉姤璀�"}
+ };
+
+ return alarmMessages.ContainsKey(alarmCode) ? alarmMessages[alarmCode] : "鏈煡鎶ヨ浠g爜";
+ }
}
}
--
Gitblit v1.9.3