|
@ -55,7 +55,6 @@ import java.text.DateFormat; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.concurrent.atomic.AtomicBoolean; |
|
|
import java.util.concurrent.atomic.AtomicBoolean; |
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
|
|
|
|
|
|
|
|
@Slf4j |
|
|
@Slf4j |
|
|
@Service |
|
|
@Service |
|
@ -2130,9 +2129,10 @@ public class AgvServiceImpl implements AgvService { |
|
|
throw new BadRequestException("请求失败,参数错误!"); |
|
|
throw new BadRequestException("请求失败,参数错误!"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public JSONObject inBlockGroup(JSONObject requestParam) { |
|
|
public JSONObject inBlockGroup(JSONObject requestParam) { |
|
|
log.info("仙工AGV请求进入互斥组区域,请求参数 - {}", requestParam); |
|
|
log.info("仙工AGV请求进入自动门区域,请求参数 - {}", requestParam); |
|
|
JSONObject resp = new JSONObject(); |
|
|
JSONObject resp = new JSONObject(); |
|
|
//AGV名称
|
|
|
//AGV名称
|
|
|
String robot_name = requestParam.getString("robot_name"); |
|
|
String robot_name = requestParam.getString("robot_name"); |
|
@ -2141,14 +2141,15 @@ public class AgvServiceImpl implements AgvService { |
|
|
if (robot_name == null || block_group_id == null) { |
|
|
if (robot_name == null || block_group_id == null) { |
|
|
resp.put("code", 400); |
|
|
resp.put("code", 400); |
|
|
resp.put("message", "请求参数不完整: robot_name 或 block_group_id缺失"); |
|
|
resp.put("message", "请求参数不完整: robot_name 或 block_group_id缺失"); |
|
|
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); |
|
|
log.info("上位不允许仙工AGV请求进入自动门区域 请求结果{}", resp); |
|
|
return resp; |
|
|
return resp; |
|
|
} |
|
|
} |
|
|
|
|
|
block_group_id = block_group_id.toUpperCase(); |
|
|
Device device = deviceAppService.findDeviceByCode(block_group_id); |
|
|
Device device = deviceAppService.findDeviceByCode(block_group_id); |
|
|
if (device == null) { |
|
|
if (device == null) { |
|
|
resp.put("code", 400); |
|
|
resp.put("code", 400); |
|
|
resp.put("message", "请求设备不存在"); |
|
|
resp.put("message", "请求设备不存在"); |
|
|
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); |
|
|
log.info("上位不允许仙工AGV请求进入自动门区域 请求结果{}", resp); |
|
|
return resp; |
|
|
return resp; |
|
|
} |
|
|
} |
|
|
if (device.getDeviceDriver() instanceof YqGRLDeviceDriver) { |
|
|
if (device.getDeviceDriver() instanceof YqGRLDeviceDriver) { |
|
@ -2157,7 +2158,7 @@ public class AgvServiceImpl implements AgvService { |
|
|
//返回AGV成功
|
|
|
//返回AGV成功
|
|
|
resp.put("code", 200); |
|
|
resp.put("code", 200); |
|
|
resp.put("message", "ok"); |
|
|
resp.put("message", "ok"); |
|
|
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); |
|
|
log.info("上位允许仙工AGV请求进入自动门区域 请求结果{},此时PLC信号:g:{},a:{},m:{}", resp, grlDeviceDriver.getGDoorStatus(), grlDeviceDriver.getADoorStatus(), grlDeviceDriver.getMiddleStatus()); |
|
|
return resp; |
|
|
return resp; |
|
|
} else { |
|
|
} else { |
|
|
//到达固熔炉
|
|
|
//到达固熔炉
|
|
@ -2165,7 +2166,7 @@ public class AgvServiceImpl implements AgvService { |
|
|
//返回AGV失败
|
|
|
//返回AGV失败
|
|
|
resp.put("code", 400); |
|
|
resp.put("code", 400); |
|
|
resp.put("message", "安全门未开到位||固熔炉门未开到位||卷扬机未到达中位"); |
|
|
resp.put("message", "安全门未开到位||固熔炉门未开到位||卷扬机未到达中位"); |
|
|
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); |
|
|
log.info("上位不允许仙工AGV请求进入自动门区域 请求结果{}", resp); |
|
|
return resp; |
|
|
return resp; |
|
|
} |
|
|
} |
|
|
} else if (device.getDeviceDriver() instanceof YqSXLDeviceDriver) { |
|
|
} else if (device.getDeviceDriver() instanceof YqSXLDeviceDriver) { |
|
@ -2173,25 +2174,25 @@ public class AgvServiceImpl implements AgvService { |
|
|
if (sxlDeviceDriver.getSDoorStatus() == 1) { |
|
|
if (sxlDeviceDriver.getSDoorStatus() == 1) { |
|
|
resp.put("code", 200); |
|
|
resp.put("code", 200); |
|
|
resp.put("message", "ok"); |
|
|
resp.put("message", "ok"); |
|
|
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); |
|
|
log.info("上位允许仙工AGV请求进入自动门区域 请求结果{},此时PLC信号:s:{}", resp, sxlDeviceDriver.getSDoorStatus()); |
|
|
return resp; |
|
|
return resp; |
|
|
} else { |
|
|
} else { |
|
|
sxlDeviceDriver.writing(1); |
|
|
sxlDeviceDriver.writing(1); |
|
|
resp.put("code", 400); |
|
|
resp.put("code", 400); |
|
|
resp.put("message", "时效炉门未开到位"); |
|
|
resp.put("message", "时效炉门未开到位"); |
|
|
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); |
|
|
log.info("上位不允许仙工AGV请求进入自动门区域 请求结果{}", resp); |
|
|
return resp; |
|
|
return resp; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
resp.put("code", 400); |
|
|
resp.put("code", 400); |
|
|
resp.put("message", "请求参数有误!"); |
|
|
resp.put("message", "请求参数有误!"); |
|
|
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); |
|
|
log.info("上位不允许仙工AGV请求进入自动门区域 请求结果{}", resp); |
|
|
return resp; |
|
|
return resp; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public JSONObject outBlockGroup(JSONObject requestParam) { |
|
|
public JSONObject outBlockGroup(JSONObject requestParam) { |
|
|
log.info("仙工AGV请求进入互斥组区域,请求参数 - {}", requestParam); |
|
|
log.info("仙工AGV请求离开互斥组区域,请求参数 - {}", requestParam); |
|
|
JSONObject resp = new JSONObject(); |
|
|
JSONObject resp = new JSONObject(); |
|
|
//AGV名称
|
|
|
//AGV名称
|
|
|
String robot_name = requestParam.getString("robot_name"); |
|
|
String robot_name = requestParam.getString("robot_name"); |
|
@ -2200,14 +2201,15 @@ public class AgvServiceImpl implements AgvService { |
|
|
if (robot_name == null || block_group_id == null) { |
|
|
if (robot_name == null || block_group_id == null) { |
|
|
resp.put("code", 400); |
|
|
resp.put("code", 400); |
|
|
resp.put("message", "请求参数不完整: robot_name 或 block_group_id缺失"); |
|
|
resp.put("message", "请求参数不完整: robot_name 或 block_group_id缺失"); |
|
|
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); |
|
|
log.info("上位不允许仙工AGV请求离开自动门区域 请求结果{}", resp); |
|
|
return resp; |
|
|
return resp; |
|
|
} |
|
|
} |
|
|
|
|
|
block_group_id = block_group_id.toUpperCase(); |
|
|
Device device = deviceAppService.findDeviceByCode(block_group_id); |
|
|
Device device = deviceAppService.findDeviceByCode(block_group_id); |
|
|
if (device == null) { |
|
|
if (device == null) { |
|
|
resp.put("code", 400); |
|
|
resp.put("code", 400); |
|
|
resp.put("message", "请求设备不存在"); |
|
|
resp.put("message", "请求设备不存在"); |
|
|
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); |
|
|
log.info("上位不允许仙工AGV请求离开自动门区域 请求结果{}", resp); |
|
|
return resp; |
|
|
return resp; |
|
|
} |
|
|
} |
|
|
if (device.getDeviceDriver() instanceof YqGRLDeviceDriver) { |
|
|
if (device.getDeviceDriver() instanceof YqGRLDeviceDriver) { |
|
@ -2217,7 +2219,7 @@ public class AgvServiceImpl implements AgvService { |
|
|
//返回AGV失败
|
|
|
//返回AGV失败
|
|
|
resp.put("code", 200); |
|
|
resp.put("code", 200); |
|
|
resp.put("message", "ok"); |
|
|
resp.put("message", "ok"); |
|
|
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); |
|
|
log.info("上位允许仙工AGV请求离开自动门区域 请求结果{}", resp); |
|
|
return resp; |
|
|
return resp; |
|
|
} else if (device.getDeviceDriver() instanceof YqSXLDeviceDriver) { |
|
|
} else if (device.getDeviceDriver() instanceof YqSXLDeviceDriver) { |
|
|
YqSXLDeviceDriver sxlDeviceDriver = (YqSXLDeviceDriver) device.getDeviceDriver(); |
|
|
YqSXLDeviceDriver sxlDeviceDriver = (YqSXLDeviceDriver) device.getDeviceDriver(); |
|
@ -2225,12 +2227,12 @@ public class AgvServiceImpl implements AgvService { |
|
|
sxlDeviceDriver.writing(2); |
|
|
sxlDeviceDriver.writing(2); |
|
|
resp.put("code", 200); |
|
|
resp.put("code", 200); |
|
|
resp.put("message", "ok"); |
|
|
resp.put("message", "ok"); |
|
|
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); |
|
|
log.info("上位允许仙工AGV请求离开自动门区域 请求结果{}", resp); |
|
|
return resp; |
|
|
return resp; |
|
|
} |
|
|
} |
|
|
resp.put("code", 400); |
|
|
resp.put("code", 400); |
|
|
resp.put("message", "请求参数有误!"); |
|
|
resp.put("message", "请求参数有误!"); |
|
|
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); |
|
|
log.info("上位不允许仙工AGV请求离开自动门区域 请求结果{}", resp); |
|
|
return resp; |
|
|
return resp; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|