From 28110912ca4803e5793f181517d7bf2d7a5ea2ad Mon Sep 17 00:00:00 2001
From: HuBingJie <3146306518@qq.com>
Date: 星期五, 05 十二月 2025 00:32:49 +0800
Subject: [PATCH] 1
---
代码管理/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RgvOperationService.cs | 155 +++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 147 insertions(+), 8 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 9a57388..17aa7d2 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"
@@ -49,15 +49,19 @@
using System.Net;
using WIDESEAWCS_ISystemServices;
using System.Security.Claims;
+using WIDESEAWCS_Common.TaskEnum;
+using SqlSugar.Extensions;
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;
}
@@ -164,7 +168,7 @@
}
/// <summary>
- /// 鍐欏叆澶嶄綅锛堝叆搴撶锛�
+ /// 涓�閿惎鍔ㄥ叆搴撳瓙姣嶈溅
/// </summary>
public WebResponseContent WriteInReset(SaveModel saveModel)
{
@@ -173,7 +177,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;
@@ -201,7 +205,7 @@
//鑾峰彇闇�瑕佸浣嶇殑璁惧
DeviceProDTO? RGV_Resetoperation = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_Resetoperation", "DeviceCommand"); //澶嶄綅鎶ヨ淇℃伅
- RgvSetLine(Commonstacker, RGV_Resetoperation.DeviceProAddress, (short)1);
+ RgvSetLine(Commonstacker, RGV_Resetoperation.DeviceProAddress, (short)0);
}
return webResponse.OK();
}
@@ -223,7 +227,25 @@
SpeStackerCrane Commonstacker = (SpeStackerCrane)device;
//鑾峰彇闇�瑕佸浣嶇殑璁惧
- DeviceProDTO? RGV_Resetoperation = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_DWorkingmode", "DeviceCommand"); //澶嶄綅鎶ヨ淇℃伅
+ 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();
@@ -246,7 +268,7 @@
SpeStackerCrane Commonstacker = (SpeStackerCrane)device;
//鑾峰彇闇�瑕佸浣嶇殑璁惧
- DeviceProDTO? RGV_Resetoperation = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_DWorkingmode", "DeviceCommand"); //澶嶄綅鎶ヨ淇℃伅
+ DeviceProDTO? RGV_Resetoperation = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_DWorkingmode", "DeviceCommand");
RgvSetLine(Commonstacker, RGV_Resetoperation.DeviceProAddress, (short)1);
}
return webResponse.OK();
@@ -287,6 +309,123 @@
return Commonstacker.Communicator.Write<short>(DeviceProDataBlock, rgvvalues);
}
+ /// <summary>
+ /// 姝e父鍏ュ簱
+ /// </summary>
+ public WebResponseContent WriteInNormal(SaveModel saveModel)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ int taskNum = saveModel.MainData.FirstOrDefault(x => x.Key == "taskNum").Value.ObjToInt();
+
+ Dt_Task dt_Task = _taskRepository.QueryFirst(x => x.TaskState == (int)TaskInStatusEnum.InAbnormalFinish && x.TaskNum == taskNum);
+ if (dt_Task == null)
+ {
+ return content.Error("娌℃湁寮傚父鍏ュ簱浠诲姟");
+ }
+ dt_Task.TaskState = (int)TaskInStatusEnum.RGV_InPickupFinish;
+ dt_Task.RGVTaskType = (int)RGVTaskTypeEnum.Placing;
+ dt_Task.NextAddress = "1021";
+ _taskRepository.UpdateData(dt_Task);
+ return content.OK();
+ }
+ catch (Exception ex)
+ {
+ return content.Error("姝e父鍏ュ簱璋冨彇寮傚父锛屽師鍥狅細" + ex.Message);
+ throw;
+ }
+ }
+ /// <summary>
+ /// 鍏ュ簱寮傚父鎺掑嚭
+ /// </summary>
+ public WebResponseContent WriteInAbnormal(SaveModel saveModel)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ int taskNum = saveModel.MainData.FirstOrDefault(x => x.Key == "taskNum").Value.ObjToInt();
+ Dt_Task dt_Task = _taskRepository.QueryFirst(x => x.TaskState == (int)TaskInStatusEnum.InAbnormalFinish && x.TaskNum == taskNum);
+ if (dt_Task == null)
+ {
+ return WebResponseContent.Instance.Error("娌℃湁寮傚父鍏ュ簱浠诲姟");
+ }
+ dt_Task.TaskState = (int)TaskInStatusEnum.InexceptionalSelection;
+ dt_Task.RGVTaskType = (int)RGVTaskTypeEnum.Placing;
+ _taskRepository.UpdateData(dt_Task);
+ return content.OK();
+ }
+ catch (Exception ex)
+ {
+ return content.Error("寮傚父鎺掗櫎璋冨彇寮傚父锛屽師鍥狅細" + ex.Message);
+ throw;
+ }
+ }
+
+
+
+ public static List<string> OutStationareaList = new List<string>() { "RGV111", "RGV116", "RGV110", "RGV112", "RGV114", "RGV115", "RGV118" };
+ public static List<string> InStationareaList = new List<string>() { "RGV101", "RGV103", "RGV105", "RGV108", "RGV109", "RGV104", "RGV107" };
+ /// <summary>
+ /// 鏌ョ湅鎶ヨ
+ /// </summary>
+ public static string AQMReadAlarminform()
+ {
+ string deviceName = "RGV101";
+ IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == deviceName);
+ if (device == null) return null;
+
+ SpeStackerCrane stacker = (SpeStackerCrane)device;
+ DeviceProDTO? faultInfo = GetRGVDeviceProDTO(stacker, deviceName, "RGV_Faultcode", "ReadDeviceCommand");
+ int alarmCode = GetLine(stacker, faultInfo.DeviceProAddress);
+
+ 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, "璐у弶鍒拌揪鍒濆浣嶄絾涓綅浼犳劅鍣ㄦ湭妫�娴嬪埌鎶ヨ"},
+ {32, "琛岃蛋杞存病鍒颁綅绂佹璐у弶浼稿嚭"},
+ {33, "鍙栬揣寮傚父鎶ヨ"},
+ {34, "鏀捐揣寮傚父鎶ヨ"},
+ {35, "澶栧瀷妫�娴�-鍓嶈秴鍑烘姤璀�"},
+ {36, "澶栧瀷妫�娴�-鍚庤秴鍑烘姤璀�"},
+ {37, "澶栧瀷妫�娴�-宸﹁秴鍑烘姤璀�"},
+ {38, "澶栧瀷妫�娴�-鍙宠秴鍑烘姤璀�"},
+ {39, "澶栧瀷妫�娴�-涓婅秴鍑烘姤璀�"}
+};
+
+ return alarmMessages.ContainsKey(alarmCode) ? alarmMessages[alarmCode] : "鏈煡鎶ヨ浠g爜";
+ }
+
/// <summary>
/// 鏌ョ湅鎶ヨ
@@ -301,7 +440,7 @@
DeviceProDTO? RGV_Resetoperation = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_Faultcode", "ReadDeviceCommand");
int baoj = GetLine(Commonstacker, RGV_Resetoperation.DeviceProAddress);
string alarmMessage = "";
- if (DeviceName == "RGV118")
+ if (DeviceName == "RGV118" || DeviceName == "RGV101")
{
alarmMessage = GetAlarmMessage(baoj);
}
@@ -354,7 +493,7 @@
{28, "鏀捐揣鏃惰嚜韬棤璐х墿鎶ヨ"},
{29, "璐у弶鏈洖鍒板垵濮嬩綅鎶ヨ"},
{30, "瑙﹀彂浠呯Щ鍔ㄥ懡浠ゆ椂璐у弶涓嶅湪鍒濆浣嶆姤璀�"},
- {31, "璐у弶鍒拌揪鍒濆浣嶄絾涓綅浼犳劅鍣ㄦ湭妫�娴嬪埌鎶ヨ"}
+ {31, "璐у弶鍒拌揪鍒濆浣嶄絾涓綅浼犳劅鍣ㄦ湭妫�娴嬪埌鎶ヨ"}
};
return alarmMessages.ContainsKey(alarmCode) ? alarmMessages[alarmCode] : "鏈煡鎶ヨ浠g爜";
--
Gitblit v1.9.3