|
|
|
@ -2,13 +2,16 @@ package cn.iocoder.yudao.module.camera.controller.admin.kesc;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
|
import cn.iocoder.yudao.module.camera.dal.dataobject.checklog.CheckLogDO;
|
|
|
|
import cn.iocoder.yudao.module.camera.dal.dataobject.checklog.CheckLogDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.camera.dal.dataobject.lightsource.LightSourceDO;
|
|
|
|
import cn.iocoder.yudao.module.camera.dal.dataobject.order.OrderDO;
|
|
|
|
import cn.iocoder.yudao.module.camera.dal.dataobject.order.OrderDO;
|
|
|
|
import cn.iocoder.yudao.module.camera.dal.dataobject.stock.StockDO;
|
|
|
|
import cn.iocoder.yudao.module.camera.dal.dataobject.stock.StockDO;
|
|
|
|
import cn.iocoder.yudao.module.camera.dal.entity.ScanData;
|
|
|
|
import cn.iocoder.yudao.module.camera.dal.entity.ScanData;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.camera.framework.light.LightFactory;
|
|
|
|
import cn.iocoder.yudao.module.camera.framework.netty.ksec.KsecDataInfo;
|
|
|
|
import cn.iocoder.yudao.module.camera.framework.netty.ksec.KsecDataInfo;
|
|
|
|
import cn.iocoder.yudao.module.camera.service.checklog.CheckLogService;
|
|
|
|
import cn.iocoder.yudao.module.camera.service.checklog.CheckLogService;
|
|
|
|
import cn.iocoder.yudao.module.camera.service.plc.PLCService;
|
|
|
|
import cn.iocoder.yudao.module.camera.service.plc.PLCService;
|
|
|
|
import cn.iocoder.yudao.module.camera.service.stock.StockService;
|
|
|
|
import cn.iocoder.yudao.module.camera.service.stock.StockService;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.camera.service.street.StreetService;
|
|
|
|
import cn.iocoder.yudao.module.logistics.dal.dataobject.checkconf.CheckConfDO;
|
|
|
|
import cn.iocoder.yudao.module.logistics.dal.dataobject.checkconf.CheckConfDO;
|
|
|
|
import cn.iocoder.yudao.module.logistics.service.checkconf.CheckConfService;
|
|
|
|
import cn.iocoder.yudao.module.logistics.service.checkconf.CheckConfService;
|
|
|
|
import cn.iocoder.yudao.module.system.service.sse.SseClient;
|
|
|
|
import cn.iocoder.yudao.module.system.service.sse.SseClient;
|
|
|
|
@ -99,15 +102,23 @@ public class StockControlController {
|
|
|
|
// kescEntity = kescEntity.fromBySRMNumber(kescEntity);
|
|
|
|
// kescEntity = kescEntity.fromBySRMNumber(kescEntity);
|
|
|
|
|
|
|
|
|
|
|
|
executorService.submit(() -> {
|
|
|
|
executorService.submit(() -> {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<LightSourceDO> list = streetService.getLightSourceListByStreetPlc(kescEntity.getSRMNumber());
|
|
|
|
// 随行开始
|
|
|
|
// 随行开始
|
|
|
|
if (kescEntity.getCmdName().equals("start")) {
|
|
|
|
if (kescEntity.getCmdName().equals("start")) {
|
|
|
|
plcService.orderStart(kescEntity);
|
|
|
|
plcService.orderStart(kescEntity);
|
|
|
|
|
|
|
|
for(LightSourceDO lightSourceDO : list){
|
|
|
|
|
|
|
|
LightFactory.LightController(lightSourceDO,1);
|
|
|
|
|
|
|
|
}
|
|
|
|
} else if (kescEntity.getCmdName().contains("load")) {
|
|
|
|
} else if (kescEntity.getCmdName().contains("load")) {
|
|
|
|
// 随行正在进行
|
|
|
|
// 随行正在进行
|
|
|
|
plcService.action(kescEntity.getTaskId(), kescEntity.getCmdName());
|
|
|
|
plcService.action(kescEntity.getTaskId(), kescEntity.getCmdName());
|
|
|
|
if (kescEntity.getCmdName().contains("loaded")) {
|
|
|
|
if (kescEntity.getCmdName().contains("loaded")) {
|
|
|
|
//随行结束,异步随行,导致结束和loaded合并
|
|
|
|
//随行结束,异步随行,导致结束和loaded合并
|
|
|
|
OrderDO orderDO = plcService.orderStop(kescEntity.getTaskId());
|
|
|
|
OrderDO orderDO = plcService.orderStop(kescEntity.getTaskId());
|
|
|
|
|
|
|
|
for(LightSourceDO lightSourceDO : list){
|
|
|
|
|
|
|
|
LightFactory.LightController(lightSourceDO,0);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (kescEntity.getCmdName().contains("finish")) {
|
|
|
|
} else if (kescEntity.getCmdName().contains("finish")) {
|
|
|
|
// 随行结束
|
|
|
|
// 随行结束
|
|
|
|
@ -117,10 +128,15 @@ public class StockControlController {
|
|
|
|
// updateResult(orderDO);
|
|
|
|
// updateResult(orderDO);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return CommonResult.success("OK");
|
|
|
|
return CommonResult.success("OK");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
StreetService streetService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/inventory")
|
|
|
|
@PostMapping("/inventory")
|
|
|
|
@Operation(summary = "盘点任务")
|
|
|
|
@Operation(summary = "盘点任务")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
@ -134,6 +150,8 @@ public class StockControlController {
|
|
|
|
|
|
|
|
|
|
|
|
executorService.submit(() -> {
|
|
|
|
executorService.submit(() -> {
|
|
|
|
String cmdName = kescEntity.getCmdName();
|
|
|
|
String cmdName = kescEntity.getCmdName();
|
|
|
|
|
|
|
|
List<LightSourceDO> list = streetService.getLightSourceListByStreetPlc(kescEntity.getSRMNumber());
|
|
|
|
|
|
|
|
|
|
|
|
boolean keyExists = redisUtil.hasKey(dedupKey);
|
|
|
|
boolean keyExists = redisUtil.hasKey(dedupKey);
|
|
|
|
List<Object> cmdList = keyExists ? redisUtil.lGet(dedupKey, 0, -1) : null;
|
|
|
|
List<Object> cmdList = keyExists ? redisUtil.lGet(dedupKey, 0, -1) : null;
|
|
|
|
boolean valueExists = cmdList != null && cmdList.contains(cmdName);
|
|
|
|
boolean valueExists = cmdList != null && cmdList.contains(cmdName);
|
|
|
|
@ -141,6 +159,9 @@ public class StockControlController {
|
|
|
|
if (!keyExists) {
|
|
|
|
if (!keyExists) {
|
|
|
|
// 不存在 key:首次请求,启动盘点
|
|
|
|
// 不存在 key:首次请求,启动盘点
|
|
|
|
plcService.checkStart(kescEntity);
|
|
|
|
plcService.checkStart(kescEntity);
|
|
|
|
|
|
|
|
for(LightSourceDO lightSourceDO : list){
|
|
|
|
|
|
|
|
LightFactory.LightController(lightSourceDO,1);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!valueExists) {
|
|
|
|
if (!valueExists) {
|
|
|
|
// 存在 key,不存在 value:新的命令,执行盘点
|
|
|
|
// 存在 key,不存在 value:新的命令,执行盘点
|
|
|
|
|