This commit is contained in:
loujf
2022-12-09 14:37:56 +08:00
parent a5828449c7
commit e978043b35
6 changed files with 133 additions and 11 deletions

View File

@@ -306,7 +306,10 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
RljnPackagePalletSplitManipulatorDeviceDriver rljnPackagePalletSplitManipulatorDeviceDriver;
if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorSiteDeviceDriver) {
lnshPalletizingManipulatorSiteDeviceDriver = (LnshPalletizingManipulatorSiteDeviceDriver) device.getDeviceDriver();
if (lnshPalletizingManipulatorSiteDeviceDriver.getIserror()) {
if (lnshPalletizingManipulatorSiteDeviceDriver.getIserror()
&& !device_code.equals("MDJXS601")
&& !device_code.equals("MDJXS201")
&& !device_code.equals("MDJXS301")) {
throw new BadRequestException("设备状态异常,下发失败!");
}
if (StrUtil.isEmpty(qty)) {
@@ -418,6 +421,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
return resultJson;
} finally {
log.info("createOrder--------------:设备信号异常,下发失败!");
MDC.remove(log_file_type);
}

View File

@@ -171,6 +171,13 @@ public interface InstructionService {
*/
void cancel(String id) throws Exception;
/**
* 嘉耐取消指令
*
* @param id
*/
void jnCancel(String id) throws Exception;
/**
* 取消指令不下发agv
*

View File

@@ -824,6 +824,94 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
}
@Override
public void jnCancel(String id) throws Exception {
//flag= true时取消指令
boolean flag = false;
Instruction entity = this.findById(id);
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
TaskDto task = taskService.findByCodeFromCache(entity.getTask_code());
if (StrUtil.isEmpty(entity.getRoute_plan_code())) {
entity.setRoute_plan_code(task.getRoute_plan_code());
}
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(entity.getStart_device_code(), entity.getNext_device_code(), entity.getRoute_plan_code());
String type = shortPathsList.get(0).getType();
// != 0 为agv任务 1=magic 2=NDC 3=XZ
if (!StrUtil.equals(type, "0")) {
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "1")
&& !StrUtil.equals(entity.getSend_status(), "2")) {
MagicAgvServiceImpl magicAgvService = SpringContextHolder.getBean(MagicAgvServiceImpl.class);
magicAgvService.deleteAgvInst(entity.getInstruction_code());
flag = true;
} else if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "2")) {
//NDC agv指令不当场取消指令,需要等agv上报
if (!StrUtil.isEmpty(entity.getAgv_jobno())) {
NDCAgvServiceImpl ndcAgv = SpringContextHolder.getBean(NDCAgvServiceImpl.class);
ndcAgv.deleteAgvInstToNDC(entity);
flag = true;
}
} else if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "3")
&& !StrUtil.equals(entity.getSend_status(), "2")) {
XianGongAgvServiceImpl xianGongAgvService = SpringContextHolder.getBean(XianGongAgvServiceImpl.class);
xianGongAgvService.deleteXZAgvInst(entity.getInstruction_code());
flag = true;
} else {
flag = true;
}
} else {
flag = true;
}
if (flag) {
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
entity.setUpdate_time(now);
entity.setUpdate_by(currentUsername);
entity.setInstruction_status("3");
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
JSONObject json = (JSONObject) JSONObject.toJSON(entity);
wo.update(json);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.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);
String instnextdevice = entity.getNext_device_code();
Device device = appService.findDeviceByCode(instnextdevice);
if (device == null) {
log.debug("地址对应设备未找到");
return;
}
removeByCodeFromCache(entity.getInstruction_code());
}
}
@Override
public void cancelNOSendAgv(String id) throws Exception {
//flag= true时取消指令

View File

@@ -563,7 +563,7 @@ public class JnHandServiceImpl implements JnHandService {
if (StrUtil.isEmpty(instdto.getAgv_jobno())) {
instructionService.cancelNOSendAgv(inst_uuid);
} else {
agvService.deleteAgvInst(instdto.getInstruction_code());
instructionService.cancel(instdto.getInstruction_id());
}
} catch (Exception e) {

View File

@@ -198,6 +198,10 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
logServer.deviceExecuteLog("ndc", "","","未找到指令号对应的指令:" + ikey);
break;
}
if (device_code.equals("MDJXS201") || device_code.equals("MDJXS301") || device_code.equals("MDJXS601")) {
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
}
//检测站点
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
@@ -290,6 +294,10 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
logServer.deviceExecuteLog("ndc", "","","未找到指令号对应的指令:" + ikey);
break;
}
if (device_code.equals("MDJXS201") || device_code.equals("MDJXS301") || device_code.equals("MDJXS601")) {
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
}
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() == 0) {
@@ -375,7 +383,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
logServer.deviceExecuteLog("ndc", "","","未找到指令号对应的指令:" + ikey);
break;
}
logServer.deviceExecuteLog("ndc","","","phase==0x06," + "指令号:" + ikey + ",address" + device_code);
logServer.deviceExecuteLog("ndc","","","phase==0x06," + "指令号:" + ikey + ",address" + device.getDevice_code());
//检测站点
if (device.getDeviceDriver() instanceof LnshLaminatingMachineDeviceDriver) {
lnshLaminatingMachineDeviceDriver = (LnshLaminatingMachineDeviceDriver) device.getDeviceDriver();
@@ -393,6 +401,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
//如果组盘绑定条码成功就允许agv离开
if (lnshLaminatingMachineDeviceDriver.getMode() == 6 && lnshLaminatingMachineDeviceDriver.getResult()) {
lnshLaminatingMachineDeviceDriver.writing(6);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
}
}
@@ -403,6 +412,10 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
logServer.deviceExecuteLog("ndc", "","","未找到指令号对应的指令:" + ikey);
break;
}
if (device_code.equals("MDJXS201") || device_code.equals("MDJXS301") || device_code.equals("MDJXS601")) {
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
}
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() == 0) {
@@ -476,6 +489,10 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
logServer.deviceExecuteLog("ndc", "","","未找到指令号对应的指令:" + ikey);
break;
}
if (device_code.equals("MDJXS201") || device_code.equals("MDJXS301") || device_code.equals("MDJXS601")) {
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
}
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() != 0) {
@@ -571,19 +588,21 @@ 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;
}
// 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.jnCancel(inst.getInstruction_id());
}
data = AgvService.sendAgvOneModeInst(phase, index, 0);
}