rev:指令下发

Signed-off-by: jiaoliming <dawnjiao@foxmail.com>
This commit is contained in:
jiaoliming
2023-09-01 10:08:22 +08:00
parent 4b8d2a7814
commit d7d4341684
2 changed files with 32 additions and 7 deletions

View File

@@ -187,7 +187,15 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
dos.write(b); dos.write(b);
dos.flush(); dos.flush();
} catch (IOException e) { } catch (IOException e) {
throw new BadRequestException(e.getMessage()); try {
log.info("再次下发agv数据:" + Bytes2HexString(b));
System.out.println("再次下发agv数据:" + Bytes2HexString(b));
dos.write(b);
dos.flush();
}catch (IOException e1){
throw new BadRequestException(e1.getMessage());
}
} }
} }

View File

@@ -41,6 +41,8 @@ import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.FileUtil; import org.nl.modules.common.utils.FileUtil;
import org.nl.modules.common.utils.SecurityUtils; import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.lucene.service.LuceneExecuteLogService;
import org.nl.modules.lucene.service.dto.LuceneLogDto;
import org.nl.modules.system.service.ParamService; import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.util.CodeUtil; import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.WQL; import org.nl.modules.wql.WQL;
@@ -84,7 +86,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
private TaskService taskService; private TaskService taskService;
@Autowired @Autowired
AcsToLiKuService acsToLiKuService; AcsToLiKuService acsToLiKuService;
// private LuceneExecuteLogService lucene = SpringContextHolder.getBean(LuceneExecuteLogService.class);
@Override @Override
public void autoInitial() { public void autoInitial() {
this.reload(); this.reload();
@@ -354,7 +356,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
* 7 不去称重平台称重PS20 agvtype:2 * 7 不去称重平台称重PS20 agvtype:2
* 8 RT20 agvtype:3 * 8 RT20 agvtype:3
*/ */
if(StrUtil.equals(task.getTask_type(),"10")){ if(StrUtil.equals(task.getTask_type(),"18")){
CreateRequest createRequest = new CreateRequest(); CreateRequest createRequest = new CreateRequest();
List<AGVTask> list = new ArrayList(); List<AGVTask> list = new ArrayList();
AcsToLiKuService acsToLiKuService = SpringContextHolder.getBean(AcsToLiKuService.class); AcsToLiKuService acsToLiKuService = SpringContextHolder.getBean(AcsToLiKuService.class);
@@ -457,7 +459,20 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} }
} }
} catch (Exception e) { } catch (Exception e) {
dto.setSend_status("2"); try {
Thread.sleep(5000L);
if (StrUtil.equals("1", dto.getAgv_system_type())) {
ndcAgvService.sendAgvTwoInstToNDC(dto, null);
} else if (StrUtil.equals("2", dto.getAgv_system_type())) {
ndcAgvService.sendAgvOneInstToNDC(dto);
}
dto.setSend_status("1");
} catch (InterruptedException ex) {
ex.printStackTrace();
} catch (Exception exception) {
dto.setSend_status("2");
exception.printStackTrace();
}
e.printStackTrace(); e.printStackTrace();
} }
@@ -863,6 +878,8 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
jo.put("batch", ""); jo.put("batch", "");
jo.put("islock", "0"); jo.put("islock", "0");
deviceService.changeDeviceStatus(jo); deviceService.changeDeviceStatus(jo);
// lucene.deviceExecuteLog(new LuceneLogDto(id,"指令更新状态为:"+entity.getInstruction_status()));
log.info("{}指令更新状态为:{}",id,entity.getInstruction_status());
this.update(entity); this.update(entity);
JSONObject taskjson = taskwo.query("task_id ='" + insttaskid + "'").uniqueResult(0); JSONObject taskjson = taskwo.query("task_id ='" + insttaskid + "'").uniqueResult(0);
TaskDto obj = taskjson.toJavaObject(TaskDto.class); TaskDto obj = taskjson.toJavaObject(TaskDto.class);
@@ -880,7 +897,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
@Transactional @Transactional
public void finishByLinkNum(String linkNum) { public void finishByLinkNum(String linkNum) {
List<Instruction> insts = this.findByLinkNum(linkNum); List<Instruction> insts = this.findByLinkNum(linkNum);
if (insts != null) { if (insts != null && insts.size() > 0) {
insts.stream().forEach(inst -> { insts.stream().forEach(inst -> {
try { try {
this.finish(inst.getInstruction_id()); this.finish(inst.getInstruction_id());
@@ -1039,7 +1056,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
}else { }else {
ndcAgvService.deleteAgvInstToNDC(entity); ndcAgvService.deleteAgvInstToNDC(entity);
} }
flag = true;
} else { } else {
flag = true; flag = true;
} }
@@ -1053,7 +1070,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} }
if (flag) { if (flag) {
if (StrUtil.equals(entity.getInstruction_type(), "10")) { if (StrUtil.equals(entity.getInstruction_type(), AgvTypeEnum.HAIROU_TYPE_1.getTaskType())) {
CancelRequest cancelRequest = new CancelRequest(); CancelRequest cancelRequest = new CancelRequest();
cancelRequest.setTaskCodes(new ArrayList<String>(Collections.singleton(entity.getInstruction_id()))); cancelRequest.setTaskCodes(new ArrayList<String>(Collections.singleton(entity.getInstruction_id())));
acsToLiKuService.cancel(cancelRequest); acsToLiKuService.cancel(cancelRequest);