出库液压台在线且高位则选为出库台
This commit is contained in:
李广豪 2022-11-24 09:09:38 +08:00
parent 7e9d8f5e64
commit a002354d49

View File

@ -63,6 +63,7 @@ public class RunTaskUtils {
/**
* 进炉加工
*
* @param currTaskId 任务id
* @return R
* @throws InterruptedException
@ -191,6 +192,7 @@ public class RunTaskUtils {
* 加工完成出炉传入工业炉id查询正在该工业炉加工的currTask,查询是否有空闲车辆
* 查询是否为自动任务查询下一步的工业炉是否空闲调车去下一工业炉加工暂存缓存区
* 呼叫车辆暂存缓存区车辆调度任务结束后结束后再查询缓R存区队列避免车辆路线冲突查询该工业炉的缓存区队列开始下一托盘货物调度进工业炉
*
* @return R
*/
public R runTaskForOutKiln(Long kilnId) throws IOException {
@ -267,8 +269,17 @@ public class RunTaskUtils {
vehicleInfo.setStatus(1);
vehicleInfo.setUpdateTime(LocalDateTime.now());
vehicleInfoServiceBiz.updateById(vehicleInfo);
asynRunTaskService.asynRunOutStockForKilnToYYT(currTask.getId(),"YYT001",vehicleId);
return R.ok("操作成功!托盘即将出库到一号液压台。");
String yytCode = "YYT001";
//选择出库液压台
if (platFormPosition("YYT001")) {
yytCode = "YYT001";
} else if (platFormPosition("YYT002")) {
yytCode = "YYT002";
} else {
yytCode = "YYT001";
}
asynRunTaskService.asynRunOutStockForKilnToYYT(currTask.getId(), yytCode, vehicleId);
return R.ok("操作成功!托盘即将出库到" + yytCode + "液压台。");
} else {
//查询缓存区库位是否已满
int count = locationServiceBiz.count(new QueryWrapper<Location>()
@ -318,6 +329,7 @@ public class RunTaskUtils {
/**
* 从缓存区出库
*
* @param locationId 库位id
* @param yeyaTaiCode 液压台code
* @return R
@ -377,6 +389,7 @@ public class RunTaskUtils {
/**
* 获取变量值
*
* @param nameSpace nameSpace前缀
* @param variableName 变量名称
* @return result字符串
@ -399,6 +412,7 @@ public class RunTaskUtils {
/**
* 判断液压台是否准备好放货
*
* @param platFormCode 液压台编码
* @return /
*/
@ -478,8 +492,91 @@ public class RunTaskUtils {
}
return false;
}
/**
* 选择出库液压台;
* 查询液压台1和液压台2是否为高位,都不为高位则选择液压台1
*/
private Boolean platFormPosition(String platFormCode) {
String identifier = null;
if ("YYT001".equals(platFormCode)) {
identifier = "S7-1200 station_2.Boutique.DB500_PLCToWCS.Platform4ToWCS.";
Map<String, Object> json = new HashMap();
json.put("nameSpace", 6);
json.put("plcName", "plc1");
json.put("identifier", identifier + "Online");
String result = null;
try {
result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json));
} catch (IOException e) {
e.printStackTrace();
logger.info("获取液压台1当前是否在线失败");
}
Boolean aBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
if (aBoolean) {
Map<String, Object> statusJson = new HashMap();
statusJson.put("nameSpace", 6);
statusJson.put("plcName", "plc1");
statusJson.put("identifier", identifier + "LifterPosition");
String statusResult = null;
try {
statusResult = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(statusJson));
} catch (IOException e) {
e.printStackTrace();
logger.info("获取液压台1当前是否高位");
}
Integer status = Integer.valueOf(JSONObject.parseObject(statusResult).get("result").toString());
if (status == 2) {
return true;
} else {
return false;
}
} else {
return false;
}
}
if ("YYT002".equals(platFormCode)) {
identifier = "S7-1200 station_2.Boutique.DB500_PLCToWCS.Platform3ToWCS.";
Map<String, Object> json = new HashMap();
json.put("nameSpace", 6);
json.put("plcName", "plc1");
json.put("identifier", identifier + "Online");
String result = null;
try {
result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json));
} catch (IOException e) {
e.printStackTrace();
logger.info("获取液压台2当前是否在线失败");
}
Boolean aBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
if (aBoolean) {
Map<String, Object> statusJson = new HashMap();
statusJson.put("nameSpace", 6);
statusJson.put("plcName", "plc1");
statusJson.put("identifier", identifier + "LifterPosition");
String statusResult = null;
try {
statusResult = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(statusJson));
} catch (IOException e) {
e.printStackTrace();
logger.info("获取液压台2当前是否高位失败");
}
Integer status = Integer.valueOf(JSONObject.parseObject(statusResult).get("result").toString());
if (status == 2) {
return true;
} else {
return false;
}
} else {
return false;
}
}
return false;
}
/**
* 车辆是否在线
*
* @param vehicleId 车辆id
* @return true/false
* @throws IOException plc访问失败
@ -509,6 +606,7 @@ public class RunTaskUtils {
/**
* 车辆是否空闲
*
* @param vehicleId 车辆id
* @return true/false
* @throws IOException plc访问失败