| | |
| | | //去掉消息头3F 00 |
| | | data = data.Substring(4); |
| | | Console.WriteLine($"{ip}-{data}"); |
| | | var plc = Settings.deviceInfos.Where(a => a.address == ip && a.enable == 1).FirstOrDefault(); |
| | | Console.WriteLine("plc:" + JsonConvert.SerializeObject(plc)); |
| | | if (plc != null) { |
| | | if (plc.deviceType == 1) { |
| | | |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | var workOrder = db.Queryable<WorkOrder>().Where(a => a.S_STATUS.Equals("执行中") && a.S_PROD_LINE.Equals(plc.deviceName)).First(); |
| | | Console.WriteLine("工单:" + JsonConvert.SerializeObject(workOrder)); |
| | | if (workOrder != null) { |
| | | string endArea = LocationHelper.getAreaByAreaName(workOrder.S_END_AREA).S_CODE; |
| | | |
| | | InstockInfo instockInfo = new InstockInfo() |
| | | { |
| | | start = plc.location[0], |
| | | item = workOrder.S_ITEM_CODE, |
| | | endArea = endArea, |
| | | ip = ip, |
| | | UDID = GenerateTaskNo() |
| | | }; |
| | | LogHelper.Info("接收信号处理:"+ JsonConvert.SerializeObject(instockInfo),"TSSG"); |
| | | ApiHelper.Instock(instockInfo); |
| | | } |
| | | } |
| | | else if (plc.deviceType == 2) { |
| | | //出库缓存位的光电信息 |
| | | //如果有缓存位是空的状态,我们先判断有没有任务终点分配到这里,如果没有,就找一条出库任务,终点是虚拟点的任务,分配到这个空位 |
| | | //修改任务终点 |
| | | } |
| | | } |
| | | else { |
| | | Console.WriteLine($"TCP信号处理:未查询到IP为{ip}的数据,请检查deviceInfo配置中心是否存在该IP的数据!"); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | } |