rev:更新
This commit is contained in:
@@ -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.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.http.HttpResponse;
|
import cn.hutool.http.HttpResponse;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.RequiredArgsConstructor;
|
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.DeviceErrorLogService;
|
||||||
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
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.instruction.service.dto.Instruction;
|
||||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
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.nl.modules.wql.util.SpringContextHolder;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -60,6 +59,8 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
|
|||||||
TaskService taskServer = SpringContextHolder.getBean("taskServiceImpl");
|
TaskService taskServer = SpringContextHolder.getBean("taskServiceImpl");
|
||||||
@Autowired
|
@Autowired
|
||||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||||
|
@Autowired
|
||||||
|
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
|
||||||
|
|
||||||
int heartbeat = 0;
|
int heartbeat = 0;
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
@@ -151,7 +152,7 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
|
|||||||
if (StrUtil.equals("true", applyEmpty)) {
|
if (StrUtil.equals("true", applyEmpty)) {
|
||||||
//申请空框任务
|
//申请空框任务
|
||||||
if (mode == 3 && move == 0 && !requireSucess) {
|
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) {
|
< this.instruction_require_time_out) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TaskDto vehicle_dto = taskServer.findByContainer(barcode);
|
Instruction instruction = instructionService.findByContainer(barcode, "1");
|
||||||
if (vehicle_dto != null) {
|
if (instruction != null) {
|
||||||
containerArrivedRequestTime = new Date();
|
containerArrivedRequestTime = new Date();
|
||||||
ContainerArrivedRequest containerArrivedRequest = new ContainerArrivedRequest();
|
ContainerArrivedRequest containerArrivedRequest = new ContainerArrivedRequest();
|
||||||
NodeStates nodeStates = new NodeStates();
|
NodeStates nodeStates = new NodeStates();
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
|
|||||||
Device device = deviceAppService.findDeviceByCode(slotCode);
|
Device device = deviceAppService.findDeviceByCode(slotCode);
|
||||||
if (device != null && device.getDeviceDriver() instanceof HailiangHrSsxDeviceDriver) {
|
if (device != null && device.getDeviceDriver() instanceof HailiangHrSsxDeviceDriver) {
|
||||||
HailiangHrSsxDeviceDriver hailiangHrSsxDeviceDriver = (HailiangHrSsxDeviceDriver) device.getDeviceDriver();
|
HailiangHrSsxDeviceDriver hailiangHrSsxDeviceDriver = (HailiangHrSsxDeviceDriver) device.getDeviceDriver();
|
||||||
hailiangHrSsxDeviceDriver.writing("to_command", "4");
|
//hailiangHrSsxDeviceDriver.writing("to_command", "4");
|
||||||
if (hailiangHrSsxDeviceDriver.getAction() == 2) {
|
if (hailiangHrSsxDeviceDriver.getAction() == 2) {
|
||||||
unloadContainerReqResponse.setAllow(true);
|
unloadContainerReqResponse.setAllow(true);
|
||||||
} else {
|
} else {
|
||||||
@@ -240,7 +240,7 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
|
|||||||
Device device = deviceAppService.findDeviceByCode(slotCode);
|
Device device = deviceAppService.findDeviceByCode(slotCode);
|
||||||
if (device != null && device.getDeviceDriver() instanceof HailiangHrSsxDeviceDriver) {
|
if (device != null && device.getDeviceDriver() instanceof HailiangHrSsxDeviceDriver) {
|
||||||
HailiangHrSsxDeviceDriver hailiangHrSsxDeviceDriver = (HailiangHrSsxDeviceDriver) device.getDeviceDriver();
|
HailiangHrSsxDeviceDriver hailiangHrSsxDeviceDriver = (HailiangHrSsxDeviceDriver) device.getDeviceDriver();
|
||||||
hailiangHrSsxDeviceDriver.writing("to_command", "5");
|
hailiangHrSsxDeviceDriver.writing("to_command", "4");
|
||||||
}
|
}
|
||||||
JSONObject json = (JSONObject) JSONObject.toJSON(unloadContainerFinishResponse);
|
JSONObject json = (JSONObject) JSONObject.toJSON(unloadContainerFinishResponse);
|
||||||
result.put("code", "0");
|
result.put("code", "0");
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import org.springframework.http.HttpStatus;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -269,6 +270,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
try {
|
try {
|
||||||
taskService.create(task_dto);
|
taskService.create(task_dto);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
log.error("创建任务出现异常:{}", Arrays.toString(e.getStackTrace()));
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
json.put("task_id", task_id);
|
json.put("task_id", task_id);
|
||||||
@@ -286,6 +288,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
resultJson.put("data", new JSONObject());
|
resultJson.put("data", new JSONObject());
|
||||||
log.info("createFromWms--------------:输出参数:" + resultJson.toString());
|
log.info("createFromWms--------------:输出参数:" + resultJson.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
log.error("创建任务出现异常:{}", Arrays.toString(e.getStackTrace()));
|
||||||
resultJson.put("status", 400);
|
resultJson.put("status", 400);
|
||||||
resultJson.put("errArr", new JSONArray());
|
resultJson.put("errArr", new JSONArray());
|
||||||
resultJson.put("message", e.getMessage());
|
resultJson.put("message", e.getMessage());
|
||||||
@@ -1176,6 +1179,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
// return resultJson;
|
// return resultJson;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> putOver(JSONObject param) {
|
public Map<String, Object> putOver(JSONObject param) {
|
||||||
log.info("接收WMS余料上完,下发参数:{}", JSON.toJSONString(param));
|
log.info("接收WMS余料上完,下发参数:{}", JSON.toJSONString(param));
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import java.util.Map;
|
|||||||
**/
|
**/
|
||||||
public interface InstructionService {
|
public interface InstructionService {
|
||||||
Instruction findByTaskcodeAndStatus(String code);
|
Instruction findByTaskcodeAndStatus(String code);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询数据分页
|
* 查询数据分页
|
||||||
*
|
*
|
||||||
@@ -353,4 +354,12 @@ public interface InstructionService {
|
|||||||
Instruction findInstByDeviceCode(String device_code);
|
Instruction findInstByDeviceCode(String device_code);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据载具号查询下发海柔成功的指令
|
||||||
|
*
|
||||||
|
* @param vehicleCode
|
||||||
|
* @param sendStatus
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Instruction findByContainer(String vehicleCode, String sendStatus);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,6 +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);
|
// private LuceneExecuteLogService lucene = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
||||||
@Override
|
@Override
|
||||||
public void autoInitial() {
|
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");
|
List<Instruction> list = this.queryAll("instruction_status < 2 and is_delete = 0");
|
||||||
this.instructions = list == null ? new CopyOnWriteArrayList<>() : new CopyOnWriteArrayList<>(list);
|
this.instructions = list == null ? new CopyOnWriteArrayList<>() : new CopyOnWriteArrayList<>(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Instruction findByTaskcodeAndStatus(String code) {
|
public Instruction findByTaskcodeAndStatus(String code) {
|
||||||
Iterator var3 = instructions.iterator();
|
Iterator var3 = instructions.iterator();
|
||||||
@@ -109,6 +111,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||||
String code = (String) whereJson.get("code");
|
String code = (String) whereJson.get("code");
|
||||||
@@ -1614,4 +1617,16 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user