|
@@ -81,6 +81,9 @@ import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import static com.github.zuihou.base.R.fail;
|
|
|
+import static com.github.zuihou.base.R.success;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -150,22 +153,22 @@ public class ToolbarController {
|
|
|
String start = data.containsKey("start") ? data.get("start") : null;
|
|
|
String goal = data.containsKey("goal") ? data.get("goal") : null;
|
|
|
|
|
|
- if (StringUtils.isEmpty(start) || StringUtils.isEmpty(goal)) return R.fail("数据传参为空");
|
|
|
+ if (StringUtils.isEmpty(start) || StringUtils.isEmpty(goal)) return fail("数据传参为空");
|
|
|
String[] startNameCondition = start.split("_");
|
|
|
String[] goalNameCondition = goal.split("_");
|
|
|
- if (startNameCondition.length != 2 || goalNameCondition.length != 2) return R.fail("数据格式传输有误");
|
|
|
+ if (startNameCondition.length != 2 || goalNameCondition.length != 2) return fail("数据格式传输有误");
|
|
|
Storge startStorge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, startNameCondition[0]).likeLeft(Storge::getName, startNameCondition[1]).eq(Storge::getPointId, startNameCondition[1]));
|
|
|
- if (null == startStorge) return R.fail("起始库位数据不存在");
|
|
|
+ if (null == startStorge) return fail("起始库位数据不存在");
|
|
|
Storge goalStorge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, goalNameCondition[0]).likeLeft(Storge::getName, goalNameCondition[1]).eq(Storge::getPointId, goalNameCondition[1]));
|
|
|
- if (null == goalStorge) return R.fail("目的库位数据不存在");
|
|
|
+ if (null == goalStorge) return fail("目的库位数据不存在");
|
|
|
|
|
|
//查询排除类型托板=5
|
|
|
boolean bool2 = stockInfoService.count(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, goalStorge.getId()).le(StockInfo::getGoodsType, 4)) > 0;
|
|
|
- if (bool2) return R.fail("目的库位数据非空");
|
|
|
+ if (bool2) return fail("目的库位数据非空");
|
|
|
UpdateWrapper<StockInfo> updateWrapper = new UpdateWrapper<StockInfo>();
|
|
|
updateWrapper.lambda().eq(StockInfo::getStorgeId, startStorge.getId()).le(StockInfo::getGoodsType, 4).set(StockInfo::getStorgeId, goalStorge.getId());
|
|
|
stockInfoService.update(null, updateWrapper);
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "更新库位位置", notes = "更新库位位置")
|
|
@@ -174,24 +177,24 @@ public class ToolbarController {
|
|
|
String start = data.containsKey("start") ? data.get("start") : null;
|
|
|
String goal = data.containsKey("goal") ? data.get("goal") : null;
|
|
|
|
|
|
- if (StringUtils.isEmpty(start) || StringUtils.isEmpty(goal)) return R.fail("数据传参为空");
|
|
|
+ if (StringUtils.isEmpty(start) || StringUtils.isEmpty(goal)) return fail("数据传参为空");
|
|
|
String[] startNameCondition = start.split("_");
|
|
|
String[] goalNameCondition = goal.split("_");
|
|
|
- if (startNameCondition.length != 2 || goalNameCondition.length != 2) return R.fail("数据格式传输有误");
|
|
|
+ if (startNameCondition.length != 2 || goalNameCondition.length != 2) return fail("数据格式传输有误");
|
|
|
Storge startStorge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, startNameCondition[0]).likeLeft(Storge::getName, startNameCondition[1]).eq(Storge::getPointId, startNameCondition[1]));
|
|
|
- if (null == startStorge) return R.fail("起始库位数据不存在");
|
|
|
+ if (null == startStorge) return fail("起始库位数据不存在");
|
|
|
Storge goalStorge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, goalNameCondition[0]).likeLeft(Storge::getName, goalNameCondition[1]).eq(Storge::getPointId, goalNameCondition[1]));
|
|
|
- if (null == goalStorge) return R.fail("目的库位数据不存在");
|
|
|
+ if (null == goalStorge) return fail("目的库位数据不存在");
|
|
|
|
|
|
//查询类型托板=5
|
|
|
boolean bool2 = stockInfoService.count(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, startStorge.getId()).eq(StockInfo::getGoodsType, 5)) == 0;
|
|
|
- if (bool2) return R.fail("起始位置托板为空");
|
|
|
+ if (bool2) return fail("起始位置托板为空");
|
|
|
boolean bool3 = stockInfoService.count(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, goalStorge.getId()).eq(StockInfo::getGoodsType, 5)) > 0;
|
|
|
- if (bool3) return R.fail("目标位置托板非空");
|
|
|
+ if (bool3) return fail("目标位置托板非空");
|
|
|
UpdateWrapper<StockInfo> updateWrapper = new UpdateWrapper<StockInfo>();
|
|
|
updateWrapper.lambda().eq(StockInfo::getStorgeId, startStorge.getId()).le(StockInfo::getGoodsType, 5).set(StockInfo::getStorgeId, goalStorge.getId());
|
|
|
stockInfoService.update(null, updateWrapper);
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -204,14 +207,14 @@ public class ToolbarController {
|
|
|
private R taskNodeHandle(String instructionUrl, Map<String, String> data) {
|
|
|
String taskNodeId = data.containsKey("taskNodeId") ? data.get("taskNodeId").toString() : null;
|
|
|
String taskId = data.containsKey("taskId") ? data.get("taskId").toString() : null;
|
|
|
- if (StringUtils.isEmpty(taskNodeId) || StringUtils.isEmpty(taskId)) return R.fail("数据传参为空");
|
|
|
+ if (StringUtils.isEmpty(taskNodeId) || StringUtils.isEmpty(taskId)) return fail("数据传参为空");
|
|
|
TaskNode taskNode = taskNodeService.getById(taskNodeId);
|
|
|
- if (null == taskNode || !taskNode.getTaskId().toString().equals(taskId)) return R.fail("节点数据不存在");
|
|
|
+ if (null == taskNode || !taskNode.getTaskId().toString().equals(taskId)) return fail("节点数据不存在");
|
|
|
JSONObject jsonParam = new JSONObject();
|
|
|
jsonParam.put("taskNodeId", taskNodeId);
|
|
|
jsonParam.put("taskId", taskId);
|
|
|
String returnData = msgUtil.getCcsData(instructionUrl, jsonParam, taskNode);
|
|
|
- return R.success(returnData);
|
|
|
+ return success(returnData);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -225,41 +228,41 @@ public class ToolbarController {
|
|
|
JSONArray jsonArray = JSON.parseArray(resultData);
|
|
|
Map map = new HashMap();
|
|
|
map.put("data", jsonArray.get(jsonArray.size() - 1));
|
|
|
- return R.success(map);
|
|
|
+ return success(map);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "获取RFID", notes = "获取RFID")
|
|
|
@PostMapping("/getRFID")
|
|
|
public R getRFID(@RequestBody Map data) {
|
|
|
String positionIndex = data.containsKey("positionIndex") ? data.get("positionIndex").toString() : null;
|
|
|
- if (StringUtils.isEmpty(positionIndex)) return R.fail("次序号不能为空");
|
|
|
+ if (StringUtils.isEmpty(positionIndex)) return fail("次序号不能为空");
|
|
|
R ret = this.taskNodeHandle("/api/ReadRFID", data);
|
|
|
if (ret.getIsError()) return ret;
|
|
|
String resultData = ret.getData().toString();
|
|
|
JSONObject jsonObject = JSON.parseObject(resultData);
|
|
|
Map map = new HashMap();
|
|
|
map.put("data", jsonObject.get("result"));
|
|
|
- return R.success(map);
|
|
|
+ return success(map);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "更改设备在线状态", notes = "更改设备在线状态")
|
|
|
@PostMapping("/updateOnlineStatus")
|
|
|
public R updateOnlineStatus(@RequestBody Map<String, String> data) {
|
|
|
String ip = data.containsKey("ip") ? data.get("ip").toString() : null;
|
|
|
- if (StringUtils.isEmpty(ip)) return R.fail("设备IP不能为空");
|
|
|
+ if (StringUtils.isEmpty(ip)) return fail("设备IP不能为空");
|
|
|
Productionresource productionresource = productionresourceBizMapper.selectOne(new LbqWrapper<Productionresource>().eq(Productionresource::getIp, ip).isNotNull(Productionresource::getModeSpecification));
|
|
|
- if (null == productionresource) return R.fail("设备不存在");
|
|
|
+ if (null == productionresource) return fail("设备不存在");
|
|
|
String onlineStatus = productionresource.getOnlineStatus().equals("0") ? "1" : "0";
|
|
|
productionresource.setOnlineStatus(onlineStatus);
|
|
|
productionresourceBizMapper.updateById(productionresource);
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "更改设备掉线状态", notes = "更改设备掉线状态")
|
|
|
@PostMapping("/updateDeviceStatus")
|
|
|
public R updateDeviceStatus(@RequestBody Map<String, String> data) {
|
|
|
String line = data.containsKey("line") ? data.get("line").toString() : null;
|
|
|
- if (StringUtils.isEmpty(line)) return R.fail("设备产线不能为空");
|
|
|
+ if (StringUtils.isEmpty(line)) return fail("设备产线不能为空");
|
|
|
LbqWrapper<Productionresource> lbqWrapper = Wraps.lbQ();
|
|
|
lbqWrapper.like(Productionresource::getCode, line).isNotNull(Productionresource::getIp);
|
|
|
|
|
@@ -270,11 +273,11 @@ public class ToolbarController {
|
|
|
productionresourceBizMapper.update(null, updateWrapper);
|
|
|
//处理掉线设备
|
|
|
List<Long> ids2 = productionResourceList.stream().filter(map -> map.getStatus().equals("0")).map(item -> item.getId()).collect(Collectors.toList());
|
|
|
- if (ids2.size() == 0) return R.fail("该产线不存在已掉线设备");
|
|
|
+ if (ids2.size() == 0) return fail("该产线不存在已掉线设备");
|
|
|
UpdateWrapper<Productionresource> updateWrapper2 = new UpdateWrapper<Productionresource>();
|
|
|
updateWrapper2.lambda().set(Productionresource::getStatus, "1").in(Productionresource::getId, ids2);
|
|
|
productionresourceBizMapper.update(null, updateWrapper2);
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "新增AGV任务", notes = "新增AGV任务")
|
|
@@ -282,27 +285,27 @@ public class ToolbarController {
|
|
|
public R addHikTask(@RequestBody Map<String, String> data) {
|
|
|
String start = data.containsKey("start") ? data.get("start").toString() : null;
|
|
|
String goal = data.containsKey("goal") ? data.get("goal").toString() : null;
|
|
|
- if (StringUtils.isEmpty(start) || StringUtils.isEmpty(goal)) return R.fail("数据传参为空");
|
|
|
+ if (StringUtils.isEmpty(start) || StringUtils.isEmpty(goal)) return fail("数据传参为空");
|
|
|
|
|
|
String[] startNameCondition = start.split("_");
|
|
|
String[] goalNameCondition = goal.split("_");
|
|
|
- if (startNameCondition.length != 2 || goalNameCondition.length != 2) return R.fail("数据格式传输有误");
|
|
|
+ if (startNameCondition.length != 2 || goalNameCondition.length != 2) return fail("数据格式传输有误");
|
|
|
|
|
|
Storge startStorge = storgeService.getOne(new LbqWrapper<Storge>().eq(Storge::getLockStatus, "0").likeRight(Storge::getName, startNameCondition[0]).likeLeft(Storge::getName, startNameCondition[1]).eq(Storge::getPointId, startNameCondition[1]));
|
|
|
- if (null == startStorge) return R.fail("起始接驳位不可用");
|
|
|
+ if (null == startStorge) return fail("起始接驳位不可用");
|
|
|
Storge goalStorge = storgeService.getOne(new LbqWrapper<Storge>().eq(Storge::getLockStatus, "0").likeRight(Storge::getName, goalNameCondition[0]).likeLeft(Storge::getName, goalNameCondition[1]).eq(Storge::getPointId, goalNameCondition[1]));
|
|
|
- if (null == goalStorge) return R.fail("目的接驳位不可用");
|
|
|
+ if (null == goalStorge) return fail("目的接驳位不可用");
|
|
|
|
|
|
//判断是否已被节点目标设备预先锁定
|
|
|
Productionresource startDevice = productionresourceBizMapper.selectOne(new LbqWrapper<Productionresource>().eq(Productionresource::getCode, start).last("limit 1"));
|
|
|
- if (null == startDevice) return R.fail("起始接驳位设备不存在");
|
|
|
+ if (null == startDevice) return fail("起始接驳位设备不存在");
|
|
|
Productionresource endDevice = productionresourceBizMapper.selectOne(new LbqWrapper<Productionresource>().eq(Productionresource::getCode, goal).last("limit 1"));
|
|
|
- if (null == endDevice) return R.fail("起始接驳位设备不存在");
|
|
|
+ if (null == endDevice) return fail("起始接驳位设备不存在");
|
|
|
|
|
|
List<Map> agvDataList = agvHikOrderInfoMapper.queryAgvCheck();
|
|
|
if (agvDataList.size() > 0) {
|
|
|
List<Map> dataList = agvDataList.stream().filter(entry -> entry.get("target_resource_id").toString() != startDevice.getId().toString() && entry.get("target_resource_id").toString() != endDevice.getId().toString()).collect(Collectors.toList());
|
|
|
- if (dataList.size() > 0) return R.fail("接驳位已被任务节点锁定");
|
|
|
+ if (dataList.size() > 0) return fail("接驳位已被任务节点锁定");
|
|
|
}
|
|
|
|
|
|
Map agvData = new HashMap();
|
|
@@ -312,27 +315,27 @@ public class ToolbarController {
|
|
|
agvData.put("taskNodeId", "1");
|
|
|
agvData.put("agvTaskType", "1");
|
|
|
agvHikOrderInfoService.addHikTask(agvData);
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "复位重发指令", notes = "复位重发指令")
|
|
|
@PostMapping("/resend")
|
|
|
public R resend(@RequestBody Map<String, String> data) {
|
|
|
R result = this.taskNodeHandle("/api/GetCallbackList", data);
|
|
|
- if (result.getIsError()) return R.fail("指令不存在");
|
|
|
+ if (result.getIsError()) return fail("指令不存在");
|
|
|
String taskNodeId = data.get("taskNodeId").toString();
|
|
|
String taskId = data.get("taskId").toString();
|
|
|
TTask task = taskService.getById(taskId);
|
|
|
TaskNode taskNode = taskNodeService.getById(taskNodeId);
|
|
|
TaskNode nextNode = taskNodeService.getNextNTaskNode(taskNode, 1);
|
|
|
if (task.getStatus().equals("3") || nextNode.getExeStatus().equals("3"))
|
|
|
- return R.fail("节点任务已经完成无须重发指令");
|
|
|
+ return fail("节点任务已经完成无须重发指令");
|
|
|
JSONArray resultData = JSONArray.parseArray(result.getData().toString());
|
|
|
|
|
|
- if (resultData.size() == 0) return R.fail("回调数据不存在");
|
|
|
+ if (resultData.size() == 0) return fail("回调数据不存在");
|
|
|
JSONObject jsonObject = (JSONObject) resultData.get(resultData.size() - 1);
|
|
|
if (jsonObject.containsKey("state") && jsonObject.getString("state").equals("true")) {
|
|
|
- return R.fail("没有需复位解决的回调数据");
|
|
|
+ return fail("没有需复位解决的回调数据");
|
|
|
}
|
|
|
if (jsonObject.containsKey("state") && jsonObject.getString("state").equals("false")) {
|
|
|
//更改回调状态和更新cache缓存
|
|
@@ -344,7 +347,7 @@ public class ToolbarController {
|
|
|
params.put("State", "0");
|
|
|
msgUtil.httpForPost(updateReCallState, params.toJSONString());
|
|
|
}
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "发送指令回调", notes = "发送指令回调")
|
|
@@ -353,7 +356,7 @@ public class ToolbarController {
|
|
|
R result = this.getCallbackList(data);
|
|
|
if (result.getIsError()) return result;
|
|
|
Map resultData = (Map) result.getData();
|
|
|
- if (resultData.isEmpty() || !resultData.containsKey("data")) return R.fail("数据格式有误");
|
|
|
+ if (resultData.isEmpty() || !resultData.containsKey("data")) return fail("数据格式有误");
|
|
|
JSONObject jsonObject = (JSONObject) resultData.get("data");
|
|
|
if (jsonObject.containsKey("state") && jsonObject.getString("state").equals("true")) {
|
|
|
//手动触发节点回调
|
|
@@ -365,7 +368,7 @@ public class ToolbarController {
|
|
|
String taskNodeCallbackUrl = parameterService.getValue(ParameterKey.TASKNODECALLBACKURL, null);
|
|
|
msgUtil.httpForPost(taskNodeCallbackUrl, params.toString());
|
|
|
}
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "发送移动操作", notes = "发送移动操作")
|
|
@@ -377,20 +380,20 @@ public class ToolbarController {
|
|
|
String endPointId = data.containsKey("endpointId") ? data.get("endpointId").toString() : null;
|
|
|
|
|
|
if (StringUtils.isEmpty(startPointId) || StringUtils.isEmpty(endPointId) || StringUtils.isEmpty(zoneId))
|
|
|
- return R.fail("数据传参为空");
|
|
|
+ return fail("数据传参为空");
|
|
|
ZZone zZone = zoneService.getById(zoneId);
|
|
|
String symbol = zZone.getNo().equals("capsule") ? "CT" : (zZone.getNo().equals("framework") ? "KT" : "bz");
|
|
|
|
|
|
Storge startStorge = storgeService.getOne(new LbqWrapper<Storge>().eq(Storge::getPointId, startPointId).likeRight(Storge::getName, symbol));
|
|
|
- if (null == startStorge) return R.fail("起始库位数据不存在");
|
|
|
- if (startStorge.getLockStatus().equals("0")) return R.fail("起始库位已被锁定");
|
|
|
+ if (null == startStorge) return fail("起始库位数据不存在");
|
|
|
+ if (startStorge.getLockStatus().equals("0")) return fail("起始库位已被锁定");
|
|
|
Storge goalStorge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, symbol).eq(Storge::getPointId, endPointId));
|
|
|
- if (null == goalStorge) return R.fail("目的库位数据不存在");
|
|
|
- if (goalStorge.getLockStatus().equals("0")) return R.fail("目的库位已被锁定");
|
|
|
+ if (null == goalStorge) return fail("目的库位数据不存在");
|
|
|
+ if (goalStorge.getLockStatus().equals("0")) return fail("目的库位已被锁定");
|
|
|
int startCount = stockInfoService.count(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, startStorge.getId()));
|
|
|
- if (startCount == 0) return R.fail("起始位置工装为空");
|
|
|
+ if (startCount == 0) return fail("起始位置工装为空");
|
|
|
int goalCount = stockInfoService.count(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, goalStorge.getId()));
|
|
|
- if (goalCount > 0) return R.fail("目标位置工装不为空");
|
|
|
+ if (goalCount > 0) return fail("目标位置工装不为空");
|
|
|
|
|
|
OrderTask orderTask = OrderTask.builder().build();
|
|
|
|
|
@@ -412,7 +415,7 @@ public class ToolbarController {
|
|
|
e.printStackTrace();
|
|
|
return R.fail(e.getMessage());
|
|
|
} */
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "发送线边库移动操作", notes = "发送移动操作")
|
|
@@ -421,16 +424,16 @@ public class ToolbarController {
|
|
|
//String zoneId = data.containsKey("zoneId")? data.get("zoneId").toString() : null;
|
|
|
String taskId = data.containsKey("taskId") ? data.get("taskId").toString() : null;
|
|
|
String taskNodeId = data.containsKey("taskNodeId") ? data.get("taskNodeId").toString() : null;
|
|
|
- if (StringUtils.isEmpty(taskNodeId) || StringUtils.isEmpty(taskId)) return R.fail("数据传参为空");
|
|
|
+ if (StringUtils.isEmpty(taskNodeId) || StringUtils.isEmpty(taskId)) return fail("数据传参为空");
|
|
|
TaskNode taskNode = taskNodeService.getById(taskNodeId);
|
|
|
TTask task = taskService.getById(taskId);
|
|
|
if (null == taskNode || null == task || !taskNode.getTaskId().toString().equals(taskId))
|
|
|
- return R.fail("数据不存在");
|
|
|
- if (task.getStatus().equals("3")) return R.fail("当前任务已执行完成");
|
|
|
+ return fail("数据不存在");
|
|
|
+ if (task.getStatus().equals("3")) return fail("当前任务已执行完成");
|
|
|
//当前节点任务状态改成暂停状态 任务节点会将零件迁移到线边库等待任务状态改变后恢复
|
|
|
task.setStatus("4");
|
|
|
taskService.updateById(task);
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "释放锁定操作", notes = "释放锁定操作")
|
|
@@ -439,31 +442,31 @@ public class ToolbarController {
|
|
|
|
|
|
String taskNodeId = data.containsKey("taskNodeId") ? data.get("taskNodeId").toString() : null;
|
|
|
String taskId = data.containsKey("taskId") ? data.get("taskId").toString() : null;
|
|
|
- if (StringUtils.isEmpty(taskNodeId) || StringUtils.isEmpty(taskId)) return R.fail("数据传参为空");
|
|
|
+ if (StringUtils.isEmpty(taskNodeId) || StringUtils.isEmpty(taskId)) return fail("数据传参为空");
|
|
|
TaskNode taskNode = taskNodeService.getById(taskNodeId);
|
|
|
- if (null == taskNode) return R.fail("节点数据不存在");
|
|
|
+ if (null == taskNode) return fail("节点数据不存在");
|
|
|
taskNodeService.freeLock(taskNode.getCompleteBatchNo());
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "同步锁定操作", notes = "同步锁定操作")
|
|
|
@PostMapping("/addSyncLock")
|
|
|
public R addSyncLock(@RequestBody Map<String, String> data) {
|
|
|
String completeBatchNo = data.containsKey("completeBatchNo") ? data.get("completeBatchNo").toString() : null;
|
|
|
- if (StringUtils.isEmpty(completeBatchNo)) return R.fail("数据传参为空");
|
|
|
+ if (StringUtils.isEmpty(completeBatchNo)) return fail("数据传参为空");
|
|
|
int lockCount = storgeService.count(new LambdaQueryWrapper<Storge>().eq(Storge::getCompleteBatchNo, completeBatchNo).eq(Storge::getLockStatus, "0"));
|
|
|
- if (lockCount > 0) return R.fail("数据已被锁定");
|
|
|
+ if (lockCount > 0) return fail("数据已被锁定");
|
|
|
TaskNode taskNode = taskNodeService.getOne(new LambdaQueryWrapper<TaskNode>().eq(TaskNode::getCompleteBatchNo, completeBatchNo).eq(TaskNode::getExeStatus, "2"));
|
|
|
- if (null == taskNode) return R.fail("同步节点不存在");
|
|
|
+ if (null == taskNode) return fail("同步节点不存在");
|
|
|
|
|
|
Storge targetStorge = (Storge) msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_STORE + taskNode.getId());
|
|
|
Storge handStorge = (Storge) msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_JXS + taskNode.getId());
|
|
|
Storge hcwStorge = (Storge) msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_HCW + taskNode.getId());
|
|
|
- if (null == targetStorge || null == handStorge || null == hcwStorge) return R.fail("节点锁定缓存为空");
|
|
|
+ if (null == targetStorge || null == handStorge || null == hcwStorge) return fail("节点锁定缓存为空");
|
|
|
storgeService.lockStorge(targetStorge, taskNode.getId());
|
|
|
//storgeService.lockStorge(handStorge, taskNode.getId());
|
|
|
//storgeService.lockStorge(hcwStorge, taskNode.getId());
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "刷新线边库状态", notes = "刷新线边库状态")
|
|
@@ -471,15 +474,15 @@ public class ToolbarController {
|
|
|
public R refreshXbk(@RequestBody Map<String, String> data) {
|
|
|
|
|
|
String deviceType = data.containsKey("deviceType") ? data.get("deviceType").toString() : null;
|
|
|
- if (StringUtils.isEmpty(deviceType)) return R.fail("数据传参为空");
|
|
|
+ if (StringUtils.isEmpty(deviceType)) return fail("数据传参为空");
|
|
|
Map paramMap = Maps.newHashMap();
|
|
|
List<Map> taskLists = taskService.getXbkChangeStatus(paramMap);
|
|
|
- if (taskLists.size() == 0) return R.fail("线边库无满足条件零件");
|
|
|
+ if (taskLists.size() == 0) return fail("线边库无满足条件零件");
|
|
|
|
|
|
if (!deviceType.equals("0")) {
|
|
|
int iType = Integer.parseInt(deviceType);
|
|
|
List<Map> reloadList = taskLists.stream().filter(item -> item.get("isReload").equals(iType)).collect(Collectors.toList());
|
|
|
- if (reloadList.size() == 0) return R.fail("线边库无reload={}零件", deviceType);
|
|
|
+ if (reloadList.size() == 0) return fail("线边库无reload={}零件", deviceType);
|
|
|
}
|
|
|
|
|
|
LambdaUpdateWrapper<TTask> updateWrapper = new LambdaUpdateWrapper<TTask>();
|
|
@@ -491,7 +494,7 @@ public class ToolbarController {
|
|
|
}
|
|
|
taskService.update(null, updateWrapper);
|
|
|
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "添加节点消息", notes = "添加节点消息")
|
|
@@ -500,17 +503,17 @@ public class ToolbarController {
|
|
|
String taskNodeId = data.containsKey("taskNodeId") ? data.get("taskNodeId").toString() : null;
|
|
|
String count = data.containsKey("count") ? data.get("count").toString() : "0";
|
|
|
String msgType = data.containsKey("msgType") ? data.get("msgType").toString() : null;
|
|
|
- if (StringUtils.isEmpty(msgType) || StringUtils.isEmpty(taskNodeId)) return R.fail("数据传参为空");
|
|
|
+ if (StringUtils.isEmpty(msgType) || StringUtils.isEmpty(taskNodeId)) return fail("数据传参为空");
|
|
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("taskNodeId", taskNodeId);
|
|
|
jsonObject.put("bizType", msgType);
|
|
|
jsonObject.put(taskNodeId + "count", count);
|
|
|
TaskNode taskNode = taskNodeService.getById(taskNodeId);
|
|
|
- if (null == taskNode || null == taskNode.getResourceId()) return R.fail("节点不存在或者节点设备为空");
|
|
|
+ if (null == taskNode || null == taskNode.getResourceId()) return fail("节点不存在或者节点设备为空");
|
|
|
log.info("推送mq队列{}消息{}", taskNode.getResourceId().toString(), jsonObject.toString());
|
|
|
dynamicRabbitMq.sendMsg(taskNode.getResourceId().toString(), jsonObject.toString());
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "添加暂存位缓存消息", notes = "添加暂存位缓存消息")
|
|
@@ -520,23 +523,23 @@ public class ToolbarController {
|
|
|
String targetNo = data.containsKey("targetNo") ? data.get("targetNo").toString() : "0";
|
|
|
String msgType = data.containsKey("msgType") ? data.get("msgType").toString() : null;
|
|
|
if (StringUtils.isEmpty(msgType) || StringUtils.isEmpty(taskNodeId) || targetNo.equals("0"))
|
|
|
- return R.fail("数据传参为空");
|
|
|
+ return fail("数据传参为空");
|
|
|
|
|
|
TaskNode taskNode = taskNodeService.getById(taskNodeId);
|
|
|
- if (null == taskNode || null == taskNode.getResourceId()) return R.fail("节点不存在或者节点设备为空");
|
|
|
+ if (null == taskNode || null == taskNode.getResourceId()) return fail("节点不存在或者节点设备为空");
|
|
|
String[] msgTypeNameCondition = msgType.split("_");
|
|
|
|
|
|
Storge storge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, msgTypeNameCondition[0]).likeLeft(Storge::getName, msgTypeNameCondition[1]).eq(Storge::getPointId, msgTypeNameCondition[1]).last("limit 1"));
|
|
|
- if (null == storge || null == storge.getPointId()) return R.fail("暂存位库位不存在");
|
|
|
+ if (null == storge || null == storge.getPointId()) return fail("暂存位库位不存在");
|
|
|
|
|
|
Storge targetStorge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, msgTypeNameCondition[0]).likeLeft(Storge::getName, targetNo).eq(Storge::getPointId, targetNo).last("limit 1"));
|
|
|
- if (null == targetStorge || null == targetStorge.getPointId()) return R.fail("目标库位不存在");
|
|
|
+ if (null == targetStorge || null == targetStorge.getPointId()) return fail("目标库位不存在");
|
|
|
Storge jxsStorge = storgeService.getOne(new LbqWrapper<Storge>().eq(Storge::getName, msgTypeNameCondition[0] + "_机器人_手抓 124").last("limit 1"));
|
|
|
|
|
|
msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_JXS + taskNodeId, jxsStorge);
|
|
|
msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_HCW + taskNodeId, storge);
|
|
|
msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_TARGET_STORE + taskNodeId, targetStorge);
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "添加节点消息", notes = "添加节点消息")
|
|
@@ -545,7 +548,7 @@ public class ToolbarController {
|
|
|
|
|
|
msgUtil.redis_del("PRIORITY_PROCESSING");
|
|
|
msgUtil.redis_del("PRIORITY_LIST");
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "添加设备回调", notes = "添加设备回调")
|
|
@@ -556,13 +559,13 @@ public class ToolbarController {
|
|
|
String taskId = data.containsKey("taskId") ? data.get("taskId").toString() : null;
|
|
|
String taskNodeId = data.containsKey("taskNodeId") ? data.get("taskNodeId").toString() : null;
|
|
|
if (StringUtils.isEmpty(taskNodeId) || StringUtils.isEmpty(taskId) || StringUtils.isEmpty(ip))
|
|
|
- return R.fail("数据传参为空");
|
|
|
+ return fail("数据传参为空");
|
|
|
JSONObject params = new JSONObject(data);
|
|
|
TaskNode taskNode = taskNodeService.getById(taskNodeId);
|
|
|
Productionresource productionresource = productionresourceBizMapper.selectOne(new LambdaQueryWrapper<Productionresource>().eq(Productionresource::getIp, ip).last("limit 1"));
|
|
|
- if (null == taskNode || null == productionresource) return R.fail("设备或节点数据不存在");
|
|
|
+ if (null == taskNode || null == productionresource) return fail("设备或节点数据不存在");
|
|
|
msgUtil.getCcsData("/api/addMachineCallback", params, taskNode);
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "更新业务数据状态", notes = "更新业务数据状态")
|
|
@@ -573,22 +576,22 @@ public class ToolbarController {
|
|
|
String taskId = data.containsKey("taskId") ? data.get("taskId").toString() : null;
|
|
|
String taskNodeId = data.containsKey("taskNodeId") ? data.get("taskNodeId").toString() : null;
|
|
|
if ((StringUtils.isEmpty(taskNodeId) && StringUtils.isEmpty(taskId)) || StringUtils.isEmpty(status))
|
|
|
- return R.fail("数据传参为空");
|
|
|
+ return fail("数据传参为空");
|
|
|
|
|
|
if (StringUtils.isNotEmpty(taskNodeId)) {
|
|
|
TaskNode taskNode = taskNodeService.getById(taskNodeId);
|
|
|
- if (null == taskNode) return R.fail("节点数据不存在");
|
|
|
- if (taskNode.getExeStatus().equals(status)) return R.fail("节点状态一致无需变更");
|
|
|
+ if (null == taskNode) return fail("节点数据不存在");
|
|
|
+ if (taskNode.getExeStatus().equals(status)) return fail("节点状态一致无需变更");
|
|
|
taskNode.setExeStatus(status);
|
|
|
taskNodeService.updateById(taskNode);
|
|
|
} else if (StringUtils.isNotEmpty(taskId)) {
|
|
|
TTask tTask = taskService.getById(taskId);
|
|
|
- if (null == tTask) return R.fail("任务数据不存在");
|
|
|
- if (tTask.getStatus().equals(status)) return R.fail("任务状态一致无需变更");
|
|
|
+ if (null == tTask) return fail("任务数据不存在");
|
|
|
+ if (tTask.getStatus().equals(status)) return fail("任务状态一致无需变更");
|
|
|
tTask.setStatus(status);
|
|
|
taskService.updateById(tTask);
|
|
|
}
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "零件回复初始化", notes = "零件回复初始化")
|
|
@@ -596,13 +599,13 @@ public class ToolbarController {
|
|
|
public R eraseWorkPiece(@RequestBody Map<String, Object> data) {
|
|
|
//添加设备回调信息(加工设备非正常启动)
|
|
|
String completeBatchNo = data.containsKey("completeBatchNo") ? data.get("completeBatchNo").toString() : null;
|
|
|
- if (StringUtils.isEmpty(completeBatchNo)) return R.fail("数据传参为空");
|
|
|
+ if (StringUtils.isEmpty(completeBatchNo)) return fail("数据传参为空");
|
|
|
TWorkpiece workpiece = workpieceService.getOne(new LbqWrapper<TWorkpiece>().eq(TWorkpiece::getCompleteBatchNo, completeBatchNo));
|
|
|
- if (null == workpiece || workpiece.getIsEnd().equals("1")) return R.fail("还原零件不存在");
|
|
|
+ if (null == workpiece || workpiece.getIsEnd().equals("1")) return fail("还原零件不存在");
|
|
|
TaskNode taskNode = taskNodeService.getById(workpiece.getTaskNodeId());
|
|
|
- if (null == taskNode || !taskNode.getExeStatus().equals("3")) return R.fail("还原零件节点不存在");
|
|
|
+ if (null == taskNode || !taskNode.getExeStatus().equals("3")) return fail("还原零件节点不存在");
|
|
|
TTask tTask = taskService.getById(taskNode.getTaskId());
|
|
|
- if (null == tTask) return R.fail("还原零件任务不存在");
|
|
|
+ if (null == tTask) return fail("还原零件任务不存在");
|
|
|
|
|
|
//数据还原处理
|
|
|
UpdateWrapper<TWorkpiece> workpieceUpdateWrapper = new UpdateWrapper<TWorkpiece>();
|
|
@@ -642,7 +645,7 @@ public class ToolbarController {
|
|
|
item.setStatus(isFirst ? "2" : "1").setStartTime(isFirst ? new Date() : null).setEndTime(null);
|
|
|
});
|
|
|
taskService.updateBatchById(taskList);
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "清空过期缓存", notes = "清空过期缓存")
|
|
@@ -667,7 +670,7 @@ public class ToolbarController {
|
|
|
});
|
|
|
//删除CCS缓存
|
|
|
msgUtil.fuzzy_delete("IMCS_CCS:*");
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -675,12 +678,12 @@ public class ToolbarController {
|
|
|
@PostMapping("/updateUnExeTask")
|
|
|
public R updateUnExeTask(@RequestBody Map<String, Object> data) {
|
|
|
String taskNodeId = data.containsKey("taskNodeId") ? data.get("taskNodeId").toString() : null;
|
|
|
- if (StringUtils.isEmpty(taskNodeId)) return R.fail("数据传参为空");
|
|
|
+ if (StringUtils.isEmpty(taskNodeId)) return fail("数据传参为空");
|
|
|
TaskNode taskNode = taskNodeService.getById(taskNodeId);
|
|
|
- if (taskNode != null && !taskNode.getExeStatus().equals("4")) return R.fail("节点状态不正确");
|
|
|
+ if (taskNode != null && !taskNode.getExeStatus().equals("4")) return fail("节点状态不正确");
|
|
|
Productionresource productionresource = productionresourceBizMapper.selectById(taskNode.getResourceId());
|
|
|
if (productionresource == null || StringUtils.isEmpty(productionresource.getModeSpecification()))
|
|
|
- return R.fail("节点不是加工设备任务");
|
|
|
+ return fail("节点不是加工设备任务");
|
|
|
List<TaskNode> taskNodeList = taskNodeService.list(new LambdaQueryWrapper<TaskNode>().eq(TaskNode::getCompleteBatchNo, taskNode.getCompleteBatchNo()).eq(TaskNode::getTaskId, taskNode.getTaskId()).ge(TaskNode::getCompleteBatchSort, taskNode.getCompleteBatchSort()).orderByAsc(TaskNode::getCompleteBatchSort));
|
|
|
UpdateWrapper<TaskNode> updateWrapper = new UpdateWrapper<TaskNode>();
|
|
|
updateWrapper.lambda().set(TaskNode::getExeStatus, "3").set(TaskNode::getExeResult, "1").in(TaskNode::getId, taskNodeList.stream().map(TaskNode::getId).collect(Collectors.toList()));
|
|
@@ -688,14 +691,14 @@ public class ToolbarController {
|
|
|
TTask task = taskService.getById(taskNode.getTaskId());
|
|
|
task.setStatus("3").setEndTime(new Date());
|
|
|
taskService.updateById(task);
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "添加缓存回调消息", notes = "添加缓存回调消息")
|
|
|
@PostMapping("/addCallbackCache")
|
|
|
public R addCallbackCache(@RequestBody Map data) {
|
|
|
String taskNodeId = data.containsKey("taskNodeId") ? data.get("taskNodeId").toString() : null;
|
|
|
- if (StringUtils.isEmpty(taskNodeId)) return R.fail("数据传参为空");
|
|
|
+ if (StringUtils.isEmpty(taskNodeId)) return fail("数据传参为空");
|
|
|
|
|
|
String callbackType = data.containsKey("callbackType") ? data.get("callbackType").toString() : null;
|
|
|
String startNo = data.containsKey("startNo") ? data.get("startNo").toString() : null;
|
|
@@ -705,9 +708,9 @@ public class ToolbarController {
|
|
|
Storge targetStorge = null;
|
|
|
|
|
|
if (StringUtils.isEmpty(callbackType) || StringUtils.isEmpty(startNo) || StringUtils.isEmpty(targetNo) || StringUtils.isEmpty(count))
|
|
|
- return R.fail("数据传参为空");
|
|
|
+ return fail("数据传参为空");
|
|
|
TaskNode taskNode = taskNodeService.getById(taskNodeId);
|
|
|
- if (taskNode == null) return R.fail("节点不存在");
|
|
|
+ if (taskNode == null) return fail("节点不存在");
|
|
|
|
|
|
JSONObject bizJsonObject = new JSONObject();
|
|
|
switch (callbackType) {
|
|
@@ -721,12 +724,12 @@ public class ToolbarController {
|
|
|
break;
|
|
|
case "2":
|
|
|
//框体机器人节点回调
|
|
|
- if (startNo.equals("0") || targetNo.equals("0")) return R.fail("点位位置不正确");
|
|
|
+ if (startNo.equals("0") || targetNo.equals("0")) return fail("点位位置不正确");
|
|
|
storge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, "KT").likeLeft(Storge::getName, startNo).eq(Storge::getPointId, startNo).last("limit 1"));
|
|
|
- if (null == storge || null == storge.getPointId()) return R.fail("暂存位库位不存在");
|
|
|
+ if (null == storge || null == storge.getPointId()) return fail("暂存位库位不存在");
|
|
|
|
|
|
targetStorge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, "KT").likeLeft(Storge::getName, targetNo).eq(Storge::getPointId, targetNo).last("limit 1"));
|
|
|
- if (null == targetStorge || null == targetStorge.getPointId()) return R.fail("目标库位不存在");
|
|
|
+ if (null == targetStorge || null == targetStorge.getPointId()) return fail("目标库位不存在");
|
|
|
|
|
|
bizJsonObject.put("bizType", "1");
|
|
|
bizJsonObject.put("handMode", "");
|
|
@@ -742,13 +745,13 @@ public class ToolbarController {
|
|
|
break;
|
|
|
case "3":
|
|
|
//舱体机器人节点回调
|
|
|
- if (startNo.equals("0") || targetNo.equals("0")) return R.fail("点位位置不正确");
|
|
|
+ if (startNo.equals("0") || targetNo.equals("0")) return fail("点位位置不正确");
|
|
|
|
|
|
storge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, "CT").likeLeft(Storge::getName, startNo).eq(Storge::getPointId, startNo).last("limit 1"));
|
|
|
- if (null == storge || null == storge.getPointId()) return R.fail("暂存位库位不存在");
|
|
|
+ if (null == storge || null == storge.getPointId()) return fail("暂存位库位不存在");
|
|
|
|
|
|
targetStorge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, "CT").likeLeft(Storge::getName, targetNo).eq(Storge::getPointId, targetNo).last("limit 1"));
|
|
|
- if (null == targetStorge || null == targetStorge.getPointId()) return R.fail("目标库位不存在");
|
|
|
+ if (null == targetStorge || null == targetStorge.getPointId()) return fail("目标库位不存在");
|
|
|
|
|
|
bizJsonObject.put("bizType", "1");
|
|
|
bizJsonObject.put("handMode", "");
|
|
@@ -764,13 +767,13 @@ public class ToolbarController {
|
|
|
break;
|
|
|
case "4":
|
|
|
//伺服舵机节点回调
|
|
|
- if (startNo.equals("0") || targetNo.equals("0")) return R.fail("点位位置不正确");
|
|
|
+ if (startNo.equals("0") || targetNo.equals("0")) return fail("点位位置不正确");
|
|
|
|
|
|
storge = storgeService.getOne(new LbqWrapper<Storge>().eq(Storge::getPointId, startNo).and(item -> item.likeRight(Storge::getName, "bz").or().likeRight(Storge::getName, "BZ")).last("limit 1"));
|
|
|
- if (null == storge || null == storge.getPointId()) return R.fail("暂存位库位不存在");
|
|
|
+ if (null == storge || null == storge.getPointId()) return fail("暂存位库位不存在");
|
|
|
|
|
|
targetStorge = storgeService.getOne(new LbqWrapper<Storge>().eq(Storge::getPointId, targetNo).and(item -> item.likeRight(Storge::getName, "BZ").or().likeRight(Storge::getName, "bz")).last("limit 1"));
|
|
|
- if (null == targetStorge || null == targetStorge.getPointId()) return R.fail("目标库位不存在");
|
|
|
+ if (null == targetStorge || null == targetStorge.getPointId()) return fail("目标库位不存在");
|
|
|
|
|
|
bizJsonObject.put("bizType", "1");
|
|
|
bizJsonObject.put("handMode", "");
|
|
@@ -783,13 +786,13 @@ public class ToolbarController {
|
|
|
break;
|
|
|
case "5":
|
|
|
//翼片机器人节点回调
|
|
|
- if (startNo.equals("0") || targetNo.equals("0")) return R.fail("点位位置不正确");
|
|
|
+ if (startNo.equals("0") || targetNo.equals("0")) return fail("点位位置不正确");
|
|
|
|
|
|
storge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, "YP").likeLeft(Storge::getName, startNo).eq(Storge::getPointId, startNo).last("limit 1"));
|
|
|
- if (null == storge || null == storge.getPointId()) return R.fail("暂存位库位不存在");
|
|
|
+ if (null == storge || null == storge.getPointId()) return fail("暂存位库位不存在");
|
|
|
|
|
|
targetStorge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, "YP").likeLeft(Storge::getName, targetNo).eq(Storge::getPointId, targetNo).last("limit 1"));
|
|
|
- if (null == targetStorge || null == targetStorge.getPointId()) return R.fail("目标库位不存在");
|
|
|
+ if (null == targetStorge || null == targetStorge.getPointId()) return fail("目标库位不存在");
|
|
|
|
|
|
bizJsonObject.put("bizType", "1");
|
|
|
bizJsonObject.put("handMode", "");
|
|
@@ -805,13 +808,13 @@ public class ToolbarController {
|
|
|
break;
|
|
|
case "6":
|
|
|
//中舱机器人节点回调
|
|
|
- if (startNo.equals("0") || targetNo.equals("0")) return R.fail("点位位置不正确");
|
|
|
+ if (startNo.equals("0") || targetNo.equals("0")) return fail("点位位置不正确");
|
|
|
|
|
|
storge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, "ZC").likeLeft(Storge::getName, startNo).eq(Storge::getPointId, startNo).last("limit 1"));
|
|
|
- if (null == storge || null == storge.getPointId()) return R.fail("暂存位库位不存在");
|
|
|
+ if (null == storge || null == storge.getPointId()) return fail("暂存位库位不存在");
|
|
|
|
|
|
targetStorge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, "ZC").likeLeft(Storge::getName, targetNo).eq(Storge::getPointId, targetNo).last("limit 1"));
|
|
|
- if (null == targetStorge || null == targetStorge.getPointId()) return R.fail("目标库位不存在");
|
|
|
+ if (null == targetStorge || null == targetStorge.getPointId()) return fail("目标库位不存在");
|
|
|
|
|
|
bizJsonObject.put("bizType", "1");
|
|
|
bizJsonObject.put("handMode", "");
|
|
@@ -828,12 +831,12 @@ public class ToolbarController {
|
|
|
case "7":
|
|
|
//暂存位线边库回调
|
|
|
TWorkpiece tWorkpiece = workpieceService.getOne(new LbqWrapper<TWorkpiece>().eq(TWorkpiece::getTaskNodeId, taskNodeId).last("limit 1"));
|
|
|
- if (null == tWorkpiece) return R.fail("工件数据信息不存在");
|
|
|
+ if (null == tWorkpiece) return fail("工件数据信息不存在");
|
|
|
storge = storgeService.getById(tWorkpiece.getStorgeId());
|
|
|
- if (null == storge || null == storge.getPointId()) return R.fail("暂存位库位不存在");
|
|
|
+ if (null == storge || null == storge.getPointId()) return fail("暂存位库位不存在");
|
|
|
ProductionresourcePosition productionresourcePosition = productionresourcePositionService.getOne(new LbqWrapper<ProductionresourcePosition>().eq(ProductionresourcePosition::getResourceId, taskNode.getTargetResourceId()).last("limit 1"));
|
|
|
targetStorge = storgeService.getById(productionresourcePosition.getStorgeId());
|
|
|
- if (null == targetStorge || null == targetStorge.getPointId()) return R.fail("目标库位不存在");
|
|
|
+ if (null == targetStorge || null == targetStorge.getPointId()) return fail("目标库位不存在");
|
|
|
|
|
|
bizJsonObject.put("bizType", "1");
|
|
|
bizJsonObject.put("handMode", "");
|
|
@@ -847,24 +850,24 @@ public class ToolbarController {
|
|
|
msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_XBK_FLAG + taskNodeId, "1", 7, TimeUnit.DAYS);
|
|
|
break;
|
|
|
}
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "上下料站重排产", notes = "上下料站重排产")
|
|
|
@PostMapping("/reStationSchedule")
|
|
|
public R reStationSchedule(@RequestBody Map data) {
|
|
|
String orderName = data.containsKey("orderName") ? data.get("orderName").toString() : null;
|
|
|
- if (StringUtils.isEmpty(orderName)) return R.fail("数据传参为空");
|
|
|
+ if (StringUtils.isEmpty(orderName)) return fail("数据传参为空");
|
|
|
Order order = orderService.getOne(new LbqWrapper<Order>().eq(Order::getOrderName, orderName).last("limit 1"));
|
|
|
- if (null == order) return R.fail("订单不存在");
|
|
|
+ if (null == order) return fail("订单不存在");
|
|
|
List<TTask> taskList = taskService.list(new LbqWrapper<TTask>().eq(TTask::getOrderId, order.getId()).eq(TTask::getStatus, "2").eq(TTask::getProcedureNo, "OP05"));
|
|
|
int count = taskList.size();
|
|
|
- if (count == 0) return R.fail("上下料站无需重新调度");
|
|
|
+ if (count == 0) return fail("上下料站无需重新调度");
|
|
|
Long procedureId = taskList.get(0).getProcedureId();
|
|
|
List<Long> resourceIds = bomProcedureProductionresourceService.list(new LambdaQueryWrapper<BomProcedureProductionresource>().eq(BomProcedureProductionresource::getProcedureId, procedureId)).stream().map(BomProcedureProductionresource::getResourceId).collect(Collectors.toList());
|
|
|
|
|
|
if (resourceIds.size() == 1) {
|
|
|
- return R.fail("上下料站无需重新调度");
|
|
|
+ return fail("上下料站无需重新调度");
|
|
|
} else {
|
|
|
Map<Long, List<TTask>> taskMap = taskList.stream().collect(Collectors.groupingBy(TTask::getResourceId));
|
|
|
taskMap = new TreeMap<>(taskMap);
|
|
@@ -873,11 +876,11 @@ public class ToolbarController {
|
|
|
|
|
|
List<TTask> firstTaskList = taskMap.values().stream().findFirst().orElse(null);
|
|
|
List<TTask> secondTaskList = taskMap.values().stream().skip(1).findFirst().orElse(null);
|
|
|
- if (firstTaskList == null) return R.fail("上下料站数据有误");
|
|
|
+ if (firstTaskList == null) return fail("上下料站数据有误");
|
|
|
int size = taskMap.keySet().size();
|
|
|
if (size == 2) {
|
|
|
int substractSize = firstTaskList.size() - secondTaskList.size();
|
|
|
- if (substractSize == 0 || substractSize == 1) return R.success();
|
|
|
+ if (substractSize == 0 || substractSize == 1) return success();
|
|
|
//二分平均法
|
|
|
int fromSize = secondTaskList.size() + substractSize / 2;
|
|
|
List<Long> ids = firstTaskList.subList(fromSize, firstTaskList.size()).stream().map(TTask::getId).collect(Collectors.toList());
|
|
@@ -897,10 +900,10 @@ public class ToolbarController {
|
|
|
taskNodeService.update(null, updateWrapper2);
|
|
|
|
|
|
} else {
|
|
|
- return R.fail("只支持二次均分方法");
|
|
|
+ return fail("只支持二次均分方法");
|
|
|
}
|
|
|
}
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "AGV任务执行通知", notes = "AGV任务执行通知")
|
|
@@ -909,10 +912,10 @@ public class ToolbarController {
|
|
|
BaseContextHandler.setTenant("0000");
|
|
|
String taskCode = data.containsKey("taskCode") ? data.get("taskCode").toString() : null;
|
|
|
String currentPositionCode = data.containsKey("currentPositionCode") ? data.get("currentPositionCode").toString() : null;
|
|
|
- if (StringUtils.isEmpty(taskCode) && StringUtils.isEmpty(currentPositionCode)) return R.fail("数据传参为空");
|
|
|
+ if (StringUtils.isEmpty(taskCode) && StringUtils.isEmpty(currentPositionCode)) return fail("数据传参为空");
|
|
|
|
|
|
AgvHikOrderDetailInfo agvHikOrderDetailInfo = agvHikOrderDetailInfoService.getOne(new LbqWrapper<AgvHikOrderDetailInfo>().eq(AgvHikOrderDetailInfo::getTaskCode, taskCode).last("limit 1"));
|
|
|
- if (null == agvHikOrderDetailInfo) return R.fail("任务编码传参有误");
|
|
|
+ if (null == agvHikOrderDetailInfo) return fail("任务编码传参有误");
|
|
|
String reqCode = agvHikOrderDetailInfo.getReqCode();
|
|
|
|
|
|
AgvHikOrderInfo agvHikOrderInfo = agvHikOrderInfoService.getOne(new LbqWrapper<AgvHikOrderInfo>().eq(AgvHikOrderInfo::getTaskCode, taskCode).last("limit 1"));
|
|
@@ -976,64 +979,69 @@ public class ToolbarController {
|
|
|
jsonParam.put("start", "0");
|
|
|
break;
|
|
|
default:
|
|
|
- return R.fail("起始信号为空");
|
|
|
+ return fail("起始信号为空");
|
|
|
}
|
|
|
String hostSystemUrl = (null == msgUtil.redis_get(ParameterKey.PARAMETERS) ? "" : ((Map<String, String>) msgUtil.redis_get(ParameterKey.PARAMETERS)).get(ParameterKey.HOSTSYSTEMURL).toString());
|
|
|
- if (StringUtils.isEmpty(hostSystemUrl)) return R.fail("Redis缓存数据不存在");
|
|
|
+ if (StringUtils.isEmpty(hostSystemUrl)) return fail("Redis缓存数据不存在");
|
|
|
String instructionUrl = "/api/setLightCurtain";
|
|
|
String callbackTaskList = msgUtil.httpForPost(hostSystemUrl + instructionUrl, jsonParam.toJSONString());
|
|
|
JSONObject jsonObject = JSONObject.parseObject(callbackTaskList);
|
|
|
//判断是否允许继续执行任务 默认位true
|
|
|
boolean bool = Boolean.parseBoolean(jsonObject.getString("result"));
|
|
|
if (null == callbackTaskList) {
|
|
|
- return R.fail("CCS数据调用失败");
|
|
|
+ return fail("CCS数据调用失败");
|
|
|
} else if (!bool) {
|
|
|
- return R.fail("CCS开关光幕失败");
|
|
|
+ return fail("CCS开关光幕失败");
|
|
|
}
|
|
|
|
|
|
if (bool) {
|
|
|
String agvContinueTaskUrl = (null == msgUtil.redis_get(ParameterKey.PARAMETERS) ? "" : ((Map<String, String>) msgUtil.redis_get(ParameterKey.PARAMETERS)).get(ParameterKey.CONTINUETASK).toString());
|
|
|
- if (StringUtils.isEmpty(agvContinueTaskUrl)) return R.fail("继续执行任务接口地址为空");
|
|
|
+ if (StringUtils.isEmpty(agvContinueTaskUrl)) return fail("继续执行任务接口地址为空");
|
|
|
JSONObject params = new JSONObject();
|
|
|
params.put("reqCode", reqCode);
|
|
|
params.put("taskCode", taskCode);
|
|
|
msgUtil.httpForPost(agvContinueTaskUrl, params.toString());
|
|
|
}
|
|
|
- return R.success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "添加自定义订单任务", notes = "添加自定义订单任务")
|
|
|
@PostMapping("/addOrderTask")
|
|
|
- public R addOrderTask(@RequestBody Map model) {
|
|
|
+ public R<OrderTask> addOrderTask(@RequestBody Map model) {
|
|
|
BaseContextHandler.setTenant("0000");
|
|
|
String start = model.containsKey("start") ? model.get("start").toString() : null;
|
|
|
String goal = model.containsKey("goal") ? model.get("goal").toString() : null;
|
|
|
- if (StringUtil.isEmpty(start) || StringUtil.isEmpty(goal)) return R.fail("传参有误");
|
|
|
+ if (StringUtil.isEmpty(start) || StringUtil.isEmpty(goal)) return fail("传参有误");
|
|
|
String[] startNameCondition = start.split("_");
|
|
|
- if (startNameCondition.length != 2 || StringUtils.isEmpty(startNameCondition[1])) return R.fail("传参有误");
|
|
|
+ if (startNameCondition.length != 2 || StringUtils.isEmpty(startNameCondition[1])) return fail("传参有误");
|
|
|
String[] goalNameCondition = goal.split("_");
|
|
|
- if (goalNameCondition.length != 2 || StringUtils.isEmpty(goalNameCondition[1])) return R.fail("传参有误");
|
|
|
+ if (goalNameCondition.length != 2 || StringUtils.isEmpty(goalNameCondition[1])) return fail("传参有误");
|
|
|
Storge startStorge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, startNameCondition[0]).eq(Storge::getPointId, startNameCondition[1]));
|
|
|
- if (null == startStorge) return R.fail("起始库位不存在");
|
|
|
+ if (null == startStorge) return fail("起始库位不存在");
|
|
|
|
|
|
if ((startNameCondition[0].equals("KT") && goalNameCondition[0].equals("CT")) || (startNameCondition[0].equals("CT") && goalNameCondition[0].equals("KT")))
|
|
|
- return R.fail("无该产线工艺");
|
|
|
+ return fail("无该产线工艺");
|
|
|
if ((startNameCondition[0].equals("KT") && goalNameCondition[0].equals("YP")) || (startNameCondition[0].equals("YP") && goalNameCondition[0].equals("KT")))
|
|
|
- return R.fail("无该产线工艺");
|
|
|
+ return fail("无该产线工艺");
|
|
|
if ((startNameCondition[0].equals("KT") && goalNameCondition[0].equals("ZC")) || (startNameCondition[0].equals("ZC") && goalNameCondition[0].equals("KT")))
|
|
|
- return R.fail("无该产线工艺");
|
|
|
+ return fail("无该产线工艺");
|
|
|
if ((startNameCondition[0].equals("CT") && goalNameCondition[0].equals("YP")) || (startNameCondition[0].equals("YP") && goalNameCondition[0].equals("CT")))
|
|
|
- return R.fail("无该产线工艺");
|
|
|
+ return fail("无该产线工艺");
|
|
|
if ((startNameCondition[0].equals("CT") && goalNameCondition[0].equals("ZC")) || (startNameCondition[0].equals("ZC") && goalNameCondition[0].equals("CT")))
|
|
|
- return R.fail("无该产线工艺");
|
|
|
+ return fail("无该产线工艺");
|
|
|
if ((startNameCondition[0].equals("YP") && goalNameCondition[0].equals("ZC")) || (startNameCondition[0].equals("ZC") && goalNameCondition[0].equals("YP")))
|
|
|
- return R.fail("无该产线工艺");
|
|
|
+ return fail("无该产线工艺");
|
|
|
+
|
|
|
+ //防止重复提交
|
|
|
+ String ZDYDDSCJD = (null == msgUtil.redis_get(DemoCacheKey.ZDYDDSCJD)? "":msgUtil.redis_get(DemoCacheKey.ZDYDDSCJD).toString());
|
|
|
+ if (!"".equals(ZDYDDSCJD)) return fail("请勿重复提交");
|
|
|
+ msgUtil.redis_set(DemoCacheKey.ZDYDDSCJD , model, 5, TimeUnit.SECONDS);
|
|
|
|
|
|
//判断自定义订单是否跨线
|
|
|
String hasMaterial = startNameCondition[0].equals(goalNameCondition[0]) ? "0" : "1";
|
|
|
ZZone zZone = zoneService.getOne(new LbqWrapper<ZZone>().eq(ZZone::getAka, startNameCondition[0]).last("limit 1"));
|
|
|
- if (zZone == null) return R.fail("产线不存在");
|
|
|
+ if (zZone == null) return fail("产线不存在");
|
|
|
TWorkpiece tWorkpiece = workpieceService.getOne(new LbqWrapper<TWorkpiece>().eq(TWorkpiece::getPointId, startNameCondition[1]).eq(TWorkpiece::getStorgeId, startStorge.getId()).eq(TWorkpiece::getIsEnd, "0").last("limit 1"));
|
|
|
Map<String, Object> params = new HashMap<String, Object>() {
|
|
|
{
|
|
@@ -1053,7 +1061,7 @@ public class ToolbarController {
|
|
|
}else {
|
|
|
if (tWorkpiece == null || tWorkpiece.getBomId() == null) {
|
|
|
StockInfo stockInfo = stockInfoService.getStockInfoByType(startStorge.getId(), "1").get(0);
|
|
|
- if (stockInfo == null || stockInfo.getTrayNo() == null) return R.fail("工装信息有误");
|
|
|
+ if (stockInfo == null || stockInfo.getTrayNo() == null) return fail("工装信息有误");
|
|
|
String trayNo = stockInfo.getTrayNo();
|
|
|
if (trayNo.startsWith("KT_QY_A")) {
|
|
|
trayNo = StringUtils.substring(trayNo, 0, trayNo.length() - 1) + "2";
|
|
@@ -1061,7 +1069,9 @@ public class ToolbarController {
|
|
|
trayNo = StringUtils.substring(trayNo, 0, trayNo.length() - 1) + "1";
|
|
|
}
|
|
|
Tray tray = trayService.getOne(new LbqWrapper<Tray>().eq(Tray::getNo, trayNo).last("LIMIT 1"));
|
|
|
- bom = bBomService.getOne(new LbqWrapper<BBom>().eq(BBom::getTrayId, tray.getId()).like(BBom::getRemark,"OP10").last("LIMIT 1"));
|
|
|
+ //查询该工装绑定的零件OP10工艺
|
|
|
+ bom = bBomService.getOne(new LbqWrapper<BBom>().eq(BBom::getTrayId, tray.getId()).like(BBom::getName,"10").last("LIMIT 1"));
|
|
|
+ if(bom == null) return fail("该工装零件OP10工艺为空");
|
|
|
} else if (!Long.valueOf("1").equals(tWorkpiece.getBomId())) {
|
|
|
bom = bBomService.getById(tWorkpiece.getBomId());
|
|
|
}
|
|
@@ -1093,7 +1103,9 @@ public class ToolbarController {
|
|
|
OrderUpdateDTO orderUpdateDTO2 = OrderUpdateDTO.builder().ids(Arrays.asList(order.getId())).auditStatus("2").build();
|
|
|
orderService.updateStatus(orderUpdateDTO2);
|
|
|
Plan plan = planService.getOne(new LbqWrapper<Plan>().eq(Plan::getOrderId, order.getId()).last("limit 1"));
|
|
|
- return R.success(orderTaskService.prodNode(orderTask, plan.getId().toString()));
|
|
|
+// return R.success(orderTaskService.prodNode(orderTask, plan.getId().toString()));
|
|
|
+ boolean bool = orderTaskService.prodNode(orderTask,plan.getId().toString());
|
|
|
+ return bool? success(orderTask) : fail("生成节点失败,请检查该工装工艺!");
|
|
|
}
|
|
|
|
|
|
}
|