| | |
| | | { |
| | | //è·åå½åè®¾å¤ |
| | | OtherDevice device = (OtherDevice)value; |
| | | List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).Distinct().ToList(); |
| | | List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode); |
| | | foreach (var item in stationMangers.Where(x => deviceStations.Contains(x.StationCode))) |
| | | Dt_StationManger? RequestIn = stationMangers.FirstOrDefault(x => x.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt()); |
| | | if (RequestIn != null) |
| | | { |
| | | DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(R_CLineCPHDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(W_CLineCPHDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | if (item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt() && deviceProRead != null && deviceProWrite != null) |
| | | DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == RequestIn.StationCode && x.DeviceProParamType == nameof(R_CLineCPHDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == RequestIn.StationCode && x.DeviceProParamType == nameof(W_CLineCPHDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | if (deviceProRead != null && deviceProWrite != null) |
| | | { |
| | | R_CLineCPHInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_CLineCPHInfo>(deviceProRead.DeviceProAddress); |
| | | //ç åç¯çº¿è¯·æ±ä»»å¡ |
| | |
| | | //{ |
| | | |
| | | //} |
| | | //åå
¥æ§è¡æ°æ® |
| | | device.SetValue(W_CLineCPHDB.W_TaskNo, 1002, item.StationCode); |
| | | device.SetValue(W_CLineCPHDB.W_Channel, 5, item.StationCode); |
| | | device.SetValue(W_CLineCPHDB.W_Long, 400, item.StationCode); |
| | | device.SetValue(W_CLineCPHDB.W_Wide, 370, item.StationCode); |
| | | device.SetValue(W_CLineCPHDB.W_High, 300, item.StationCode); |
| | | device.SetValue(W_CLineCPHDB.W_TMID, conveyorLineInfoRead.R_BoxCode, item.StationCode); |
| | | device.SetValue(W_CLineCPHDB.W_Request, 1, item.StationCode); |
| | | string[] strings = conveyorLineInfoRead.R_BoxCode.Split("-"); |
| | | if (strings.Length==2) |
| | | { |
| | | //åå
¥æ§è¡æ°æ® |
| | | device.SetValue(W_CLineCPHDB.W_TaskNo, 100 + strings[1].ObjToInt(), RequestIn.StationCode); |
| | | device.SetValue(W_CLineCPHDB.W_Channel, strings[1].ObjToInt(), RequestIn.StationCode); |
| | | |
| | | device.SetValue(W_CLineCPHDB.W_Long, 425, RequestIn.StationCode); |
| | | device.SetValue(W_CLineCPHDB.W_Wide, 325, RequestIn.StationCode); |
| | | device.SetValue(W_CLineCPHDB.W_High, 400, RequestIn.StationCode); |
| | | device.SetValue(W_CLineCPHDB.W_TMID, conveyorLineInfoRead.R_BoxCode, RequestIn.StationCode); |
| | | device.SetValue(W_CLineCPHDB.W_Request, 1, RequestIn.StationCode); |
| | | } |
| | | else |
| | | { |
| | | WriteError(RequestIn.StationName, $"æ°æ®æªåé误ï¼{strings}"); |
| | | } |
| | | } |
| | | } |
| | | else if (item.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt() && deviceProRead != null) |
| | | else |
| | | { |
| | | WriteError(RequestIn.StationName, $"æªæ¾å°è®¾å¤åç¼å·{RequestIn.StationCode}çå议信æ¯"); |
| | | } |
| | | } |
| | | foreach (var item in stationMangers.Where(x=>x.StationType==StationTypeEnum.StationType_OnlyOutbound.ObjToInt())) |
| | | { |
| | | DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(R_CLineCPHDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | if (deviceProRead != null) |
| | | { |
| | | R_CLineCPHInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_CLineCPHInfo>(deviceProRead.DeviceProAddress); |
| | | //è·åç åå£ä»»å¡æ´æ°ä»»å¡ç¶æ |
| | |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WriteError(item.StationName, $"æªæ¾å°è®¾å¤åç¼å·{item.StationCode}çå议信æ¯"); |
| | | } |
| | | } |
| | | Thread.Sleep(100); |
| | | } |
| | | Thread.Sleep(100); |
| | | |
| | | } |
| | | } |
| | | catch (Exception ex) |