Browse Source

任务取消后起点库存变为空修复

master
pangshenghao 2 years ago
parent
commit
cf5625b9f9
  1. 19
      acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDeviceDriver.java
  2. 44
      acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
  3. 5
      acs/hd/nladmin-system/src/main/java/org/nl/acs/task/service/TaskService.java
  4. 13
      acs/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
  5. 8
      acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java

19
acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDeviceDriver.java

@ -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 {
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());
}
}
} 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;
}

44
acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java

@ -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);

5
acs/hd/nladmin-system/src/main/java/org/nl/acs/task/service/TaskService.java

@ -115,6 +115,11 @@ public interface TaskService {
*/
List<TaskDto> queryTaskByDeviceCode(String device_code);
/**
* 根据设备号查询未执行的任务
*/
List<TaskDto> queryTaskByNextDeviceCode(String device_code);
/**
* 创建
*

13
acs/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java

@ -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");

8
acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java

@ -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;
}
}
//任务删除确认
//(需要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);
}

Loading…
Cancel
Save