任务取消后起点库存变为空修复
This commit is contained in:
@@ -489,13 +489,17 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
return false;
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
TaskDto task = taskserver.findByNextCode(this.devicecode);
|
||||
List<TaskDto> taskList = taskserver.queryTaskByNextDeviceCode(this.devicecode);
|
||||
try {
|
||||
Instruction inst = instructionService.findByTaskCodeFromCache(task.getTask_code());
|
||||
if (ObjectUtil.isNotEmpty(inst)) {
|
||||
instructionService.cancel(inst.getInstruction_id());
|
||||
if (taskList.size() != 0) {
|
||||
for (TaskDto task : taskList) {
|
||||
Instruction inst = instructionService.findByTaskCodeFromCache(task.getTask_code());
|
||||
if (ObjectUtil.isNotEmpty(inst)) {
|
||||
instructionService.cancel(inst.getInstruction_id());
|
||||
}
|
||||
taskserver.cancel(task.getTask_id());
|
||||
}
|
||||
}
|
||||
taskserver.cancel(task.getTask_id());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -639,11 +643,11 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
Device route_link_device = deviceAppservice.findDeviceByCode(start_device_code);
|
||||
//判断终点设备驱动是否为检测站点驱动
|
||||
if (route_link_device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
// standardInspectSiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) route_link_device.getDeviceDriver();
|
||||
// //判断该终点设备是否无货,无货就结束循环
|
||||
// if (standardInspectSiteDeviceDriver.getHasGoods() == 0) {
|
||||
// continue;
|
||||
// }
|
||||
standardInspectSiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) route_link_device.getDeviceDriver();
|
||||
// //判断该起点设备是否无货,无货就结束循环
|
||||
if (standardInspectSiteDeviceDriver.getHasGoods() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//判断是否已经有该起点设备的任务,如果有就结束循环
|
||||
int num1 = taskserver.querySameOriginTask(start_device_code);
|
||||
@@ -712,6 +716,9 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
|
||||
inrequireSucess = true;
|
||||
this.execute_log.log("设备:" + devicecode + "", "", "对应路由设备,生成任务成功已锁定");
|
||||
} else {
|
||||
message = "当前站点所有路由都为无货状态";
|
||||
writing(7);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -970,30 +970,30 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
JSONObject json = JSONObject.fromObject(entity);
|
||||
wo.update(json);
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
||||
// DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
||||
|
||||
// 如果是无光电的设备 指令完成变更起点、终点状态
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", entity.getStart_device_code());
|
||||
if (StrUtil.equals(entity.getMaterial(), "1")) {
|
||||
jo.put("hasGoodStatus", "1");
|
||||
} else if (!StrUtil.equals(entity.getMaterial(), "1") && !StrUtil.isEmpty(entity.getMaterial())) {
|
||||
jo.put("hasGoodStatus", "2");
|
||||
} else {
|
||||
jo.put("hasGoodStatus", "0");
|
||||
}
|
||||
jo.put("material_type", entity.getMaterial());
|
||||
jo.put("batch", entity.getBatch());
|
||||
jo.put("islock", "false");
|
||||
deviceService.changeDeviceStatus(jo);
|
||||
|
||||
JSONObject jo1 = new JSONObject();
|
||||
jo1.put("device_code", entity.getNext_device_code());
|
||||
jo.put("hasGoodStatus", "0");
|
||||
jo.put("material_type", "");
|
||||
jo.put("batch", "");
|
||||
jo1.put("islock", "false");
|
||||
deviceService.changeDeviceStatus(jo1);
|
||||
// JSONObject jo = new JSONObject();
|
||||
// jo.put("device_code", entity.getStart_device_code());
|
||||
// if (StrUtil.equals(entity.getMaterial(), "1")) {
|
||||
// jo.put("hasGoodStatus", "1");
|
||||
// } else if (!StrUtil.equals(entity.getMaterial(), "1") && !StrUtil.isEmpty(entity.getMaterial())) {
|
||||
// jo.put("hasGoodStatus", "2");
|
||||
// } else {
|
||||
// jo.put("hasGoodStatus", "0");
|
||||
// }
|
||||
// jo.put("material_type", entity.getMaterial());
|
||||
// jo.put("batch", entity.getBatch());
|
||||
// jo.put("islock", "false");
|
||||
// deviceService.changeDeviceStatus(jo);
|
||||
//
|
||||
// JSONObject jo1 = new JSONObject();
|
||||
// jo1.put("device_code", entity.getNext_device_code());
|
||||
// jo.put("hasGoodStatus", "0");
|
||||
// jo.put("material_type", "");
|
||||
// jo.put("batch", "");
|
||||
// jo1.put("islock", "false");
|
||||
// deviceService.changeDeviceStatus(jo1);
|
||||
|
||||
String instnextdevice = entity.getNext_device_code();
|
||||
Device device = appService.findDeviceByCode(instnextdevice);
|
||||
|
||||
@@ -115,6 +115,11 @@ public interface TaskService {
|
||||
*/
|
||||
List<TaskDto> queryTaskByDeviceCode(String device_code);
|
||||
|
||||
/**
|
||||
* 根据设备号查询未执行的任务
|
||||
*/
|
||||
List<TaskDto> queryTaskByNextDeviceCode(String device_code);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
|
||||
@@ -421,6 +421,19 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskDto> queryTaskByNextDeviceCode(String device_code) {
|
||||
List<TaskDto> list = new ArrayList<>();
|
||||
Iterator<TaskDto> iterator = tasks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TaskDto task = iterator.next();
|
||||
if (task.getNext_device_code().equals(device_code)) {
|
||||
list.add(task);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskDto> queryByStauts(String status) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
|
||||
@@ -633,20 +633,14 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
//请求删除任务
|
||||
else if (phase == 0x30) {
|
||||
flag = true;
|
||||
if (!ObjectUtil.isEmpty(inst)) {
|
||||
data = AgvService.sendAgvOneModeInst(0x8F, index, 0);
|
||||
} else {
|
||||
log.info("未找到对应的指令无法删除");
|
||||
break;
|
||||
}
|
||||
data = AgvService.sendAgvOneModeInst(0x8F, index, 0);
|
||||
}
|
||||
//任务删除确认
|
||||
//(需要WCS反馈)
|
||||
else if (phase == 0xFF) {
|
||||
flag = true;
|
||||
if (!ObjectUtil.isEmpty(inst)) {
|
||||
instructionService.cancel(inst.getInstruction_id());
|
||||
instructionService.cancelNOSendAgv(inst.getInstruction_id());
|
||||
}
|
||||
data = AgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user