| | |
| | | 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; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åå
¥å¤ä½ï¼å
¥åºç«¯ï¼ |
| | | /// ä¸é®å¯å¨å
¥åºåæ¯è½¦ |
| | | /// </summary> |
| | | public WebResponseContent WriteInReset(SaveModel saveModel) |
| | | { |
| | |
| | | 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; |
| | |
| | | |
| | | //è·åéè¦å¤ä½çè®¾å¤ |
| | | 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(); |
| | | } |
| | |
| | | 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(); |
| | |
| | | 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(); |
| | |
| | | return Commonstacker.Communicator.Write<short>(DeviceProDataBlock, rgvvalues); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ£å¸¸å
¥åº |
| | | /// </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("æ£å¸¸å
¥åºè°åå¼å¸¸ï¼åå ï¼" + 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, "æ£è½¬é·è¾¾æ¥è¦"}, |
| | | {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] : "æªç¥æ¥è¦ä»£ç "; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// æ¥çæ¥è¦ |
| | |
| | | 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); |
| | | } |
| | |
| | | {28, "æ¾è´§æ¶èªèº«æ è´§ç©æ¥è¦"}, |
| | | {29, "è´§åæªåå°åå§ä½æ¥è¦"}, |
| | | {30, "触åä»
ç§»å¨å½ä»¤æ¶è´§åä¸å¨åå§ä½æ¥è¦"}, |
| | | {31, "è´§åå°è¾¾åå§ä½ä½ä¸ä½ä¼ æå¨æªæ£æµå°æ¥è¦"} |
| | | {31, "è´§åå°è¾¾åå§ä½ä½ä¸ä½ä¼ æå¨æªæ£æµå°æ¥è¦"} |
| | | }; |
| | | |
| | | return alarmMessages.ContainsKey(alarmCode) ? alarmMessages[alarmCode] : "æªç¥æ¥è¦ä»£ç "; |