|
|
@@ -38,7 +38,9 @@ import com.github.zuihou.business.productionResourceCenter.entity.Productionreso
|
|
|
import com.github.zuihou.business.productionResourceCenter.entity.ZZone;
|
|
|
import com.github.zuihou.business.productionResourceCenter.service.ProductionresourcePositionService;
|
|
|
import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
|
|
|
+import com.github.zuihou.business.util.DynamicRabbitMq;
|
|
|
import com.github.zuihou.business.util.MsgUtil;
|
|
|
+import com.github.zuihou.common.constant.BizConstant;
|
|
|
import com.github.zuihou.common.constant.CacheKey;
|
|
|
import com.github.zuihou.common.constant.DictionaryKey;
|
|
|
import com.github.zuihou.common.constant.ParameterKey;
|
|
|
@@ -103,6 +105,8 @@ public class ToolbarController {
|
|
|
private ParameterService parameterService;
|
|
|
@Autowired
|
|
|
private TaskService taskService;
|
|
|
+ @Autowired
|
|
|
+ private DynamicRabbitMq dynamicRabbitMq;
|
|
|
|
|
|
@ApiOperation(value = "更新库位位置", notes = "更新库位位置")
|
|
|
@PostMapping("/updateStorge")
|
|
|
@@ -183,7 +187,7 @@ public class ToolbarController {
|
|
|
Productionresource productionresource = productionresourceBizMapper.selectOne(new LbqWrapper<Productionresource>().eq(Productionresource::getIp, ip).isNotNull(Productionresource::getModeSpecification));
|
|
|
if(null == productionresource) return R.fail("设备不存在");
|
|
|
String onlineStatus = productionresource.getOnlineStatus().equals("0")? "1": "0";
|
|
|
- productionresource.setOnlineStatus(onlineStatus);
|
|
|
+ productionresource.setOnlineStatus(onlineStatus).setStatus("1");
|
|
|
productionresourceBizMapper.updateById(productionresource);
|
|
|
return R.success();
|
|
|
}
|
|
|
@@ -367,5 +371,59 @@ public class ToolbarController {
|
|
|
|
|
|
return R.success();
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "添加节点消息", notes = "添加节点消息")
|
|
|
+ @PostMapping("/addNodeMsg")
|
|
|
+ public R addNodeMsg(@RequestBody Map data) {
|
|
|
+ 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("数据传参为空");
|
|
|
+
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("taskNodeId", taskNodeId);
|
|
|
+ jsonObject.put("bizType", msgType);
|
|
|
+ jsonObject.put("handMode",0);
|
|
|
+ jsonObject.put(taskNodeId+"count", count);
|
|
|
+ TaskNode taskNode = taskNodeService.getById(taskNodeId);
|
|
|
+ if(null == taskNode || null == taskNode.getResourceId()) return R.fail("节点不存在或者节点设备为空");
|
|
|
+ log.info("推送mq队列{}消息{}",taskNode.getResourceId().toString(),jsonObject.toString());
|
|
|
+ dynamicRabbitMq.sendMsg(taskNode.getResourceId().toString(),jsonObject.toString());
|
|
|
+ return R.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "添加暂存位缓存消息", notes = "添加暂存位缓存消息")
|
|
|
+ @PostMapping("/addCacheMsg")
|
|
|
+ public R addCacheMsg(@RequestBody Map data) {
|
|
|
+ String taskNodeId = data.containsKey("taskNodeId")? data.get("taskNodeId").toString() : null;
|
|
|
+ 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("数据传参为空");
|
|
|
+
|
|
|
+ TaskNode taskNode = taskNodeService.getById(taskNodeId);
|
|
|
+ if(null == taskNode || null == taskNode.getResourceId()) return R.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("暂存位库位不存在");
|
|
|
+
|
|
|
+ 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("目标库位不存在");
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "添加节点消息", notes = "添加节点消息")
|
|
|
+ @PostMapping("/refreshPriority")
|
|
|
+ public R refreshPriority(@RequestBody Map<String, String> data) {
|
|
|
+
|
|
|
+ msgUtil.redis_del("PRIORITY_PROCESSING");
|
|
|
+ msgUtil.redis_del("PRIORITY_LIST");
|
|
|
+ return R.success();
|
|
|
+ }
|
|
|
}
|
|
|
|