| | |
| | | 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; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | /// <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(); |
| | |
| | | public static bool RgvSetLine(SpeStackerCrane Commonstacker, string DeviceProDataBlock, short rgvvalues) |
| | | { |
| | | return Commonstacker.Communicator.Write<short>(DeviceProDataBlock, rgvvalues); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ£å¸¸å
¥åº |
| | | /// </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; |
| | | } |
| | | |
| | | |
| | |
| | | {28, "æ¾è´§æ¶èªèº«æ è´§ç©æ¥è¦"}, |
| | | {29, "è´§åæªåå°åå§ä½æ¥è¦"}, |
| | | {30, "触åä»
ç§»å¨å½ä»¤æ¶è´§åä¸å¨åå§ä½æ¥è¦"}, |
| | | {31, "è´§åå°è¾¾åå§ä½ä½ä¸ä½ä¼ æå¨æªæ£æµå°æ¥è¦"} |
| | | {31, "è´§åå°è¾¾åå§ä½ä½ä¸ä½ä¼ æå¨æªæ£æµå°æ¥è¦"} |
| | | }; |
| | | |
| | | return alarmMessages.ContainsKey(alarmCode) ? alarmMessages[alarmCode] : "æªç¥æ¥è¦ä»£ç "; |