rev:更新

This commit is contained in:
2024-01-26 15:42:39 +08:00
parent ce5dcdf1f4
commit 300278e1c8
5 changed files with 77 additions and 48 deletions

View File

@@ -3,7 +3,6 @@ package org.nl.acs.device_driver.basedriver.hailiang_old.hailiang_hr_ssx;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
@@ -28,6 +27,7 @@ import org.nl.acs.history.ErrorUtil;
import org.nl.acs.history.service.DeviceErrorLogService;
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
@@ -39,7 +39,6 @@ import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -60,6 +59,8 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
TaskService taskServer = SpringContextHolder.getBean("taskServiceImpl");
@Autowired
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
int heartbeat = 0;
int mode = 0;
@@ -151,7 +152,7 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
if (StrUtil.equals("true", applyEmpty)) {
//申请空框任务
if (mode == 3 && move == 0 && !requireSucess) {
this.applyEmptyTask();
//this.applyEmptyTask();
}
}
@@ -203,8 +204,8 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
< this.instruction_require_time_out) {
return;
}
TaskDto vehicle_dto = taskServer.findByContainer(barcode);
if (vehicle_dto != null) {
Instruction instruction = instructionService.findByContainer(barcode, "1");
if (instruction != null) {
containerArrivedRequestTime = new Date();
ContainerArrivedRequest containerArrivedRequest = new ContainerArrivedRequest();
NodeStates nodeStates = new NodeStates();

View File

@@ -208,7 +208,7 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
Device device = deviceAppService.findDeviceByCode(slotCode);
if (device != null && device.getDeviceDriver() instanceof HailiangHrSsxDeviceDriver) {
HailiangHrSsxDeviceDriver hailiangHrSsxDeviceDriver = (HailiangHrSsxDeviceDriver) device.getDeviceDriver();
hailiangHrSsxDeviceDriver.writing("to_command", "4");
//hailiangHrSsxDeviceDriver.writing("to_command", "4");
if (hailiangHrSsxDeviceDriver.getAction() == 2) {
unloadContainerReqResponse.setAllow(true);
} else {
@@ -240,7 +240,7 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
Device device = deviceAppService.findDeviceByCode(slotCode);
if (device != null && device.getDeviceDriver() instanceof HailiangHrSsxDeviceDriver) {
HailiangHrSsxDeviceDriver hailiangHrSsxDeviceDriver = (HailiangHrSsxDeviceDriver) device.getDeviceDriver();
hailiangHrSsxDeviceDriver.writing("to_command", "5");
hailiangHrSsxDeviceDriver.writing("to_command", "4");
}
JSONObject json = (JSONObject) JSONObject.toJSON(unloadContainerFinishResponse);
result.put("code", "0");

View File

@@ -48,6 +48,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -269,6 +270,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
try {
taskService.create(task_dto);
} catch (Exception e) {
log.error("创建任务出现异常:{}", Arrays.toString(e.getStackTrace()));
e.printStackTrace();
JSONObject json = new JSONObject();
json.put("task_id", task_id);
@@ -286,6 +288,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
resultJson.put("data", new JSONObject());
log.info("createFromWms--------------:输出参数:" + resultJson.toString());
} catch (Exception e) {
log.error("创建任务出现异常:{}", Arrays.toString(e.getStackTrace()));
resultJson.put("status", 400);
resultJson.put("errArr", new JSONArray());
resultJson.put("message", e.getMessage());
@@ -1176,6 +1179,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
// return resultJson;
return null;
}
@Override
public Map<String, Object> putOver(JSONObject param) {
log.info("接收WMS余料上完,下发参数:{}", JSON.toJSONString(param));

View File

@@ -17,6 +17,7 @@ import java.util.Map;
**/
public interface InstructionService {
Instruction findByTaskcodeAndStatus(String code);
/**
* 查询数据分页
*
@@ -353,4 +354,12 @@ public interface InstructionService {
Instruction findInstByDeviceCode(String device_code);
/**
* 根据载具号查询下发海柔成功的指令
*
* @param vehicleCode
* @param sendStatus
* @return
*/
Instruction findByContainer(String vehicleCode, String sendStatus);
}

View File

@@ -86,6 +86,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
private TaskService taskService;
@Autowired
AcsToLiKuService acsToLiKuService;
// private LuceneExecuteLogService lucene = SpringContextHolder.getBean(LuceneExecuteLogService.class);
@Override
public void autoInitial() {
@@ -97,6 +98,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
List<Instruction> list = this.queryAll("instruction_status < 2 and is_delete = 0");
this.instructions = list == null ? new CopyOnWriteArrayList<>() : new CopyOnWriteArrayList<>(list);
}
@Override
public Instruction findByTaskcodeAndStatus(String code) {
Iterator var3 = instructions.iterator();
@@ -109,6 +111,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
}
return null;
}
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
String code = (String) whereJson.get("code");
@@ -1614,4 +1617,16 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
.findFirst()
.orElse(null);
}
@Override
public Instruction findByContainer(String vehicleCode,String sendStatus) {
return Optional
.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(inst -> inst.getVehicle_code().equals(vehicleCode))
.filter(inst -> inst.getSend_status().equals(sendStatus))
.findFirst()
.orElse(null);
}
}