Merge remote-tracking branch 'origin/master'
# Conflicts: # acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java # acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java
This commit is contained in:
@@ -1367,6 +1367,7 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
|
||||
@Override
|
||||
public JSONObject queryDriverConfigByDeviceId(String device_id, String driver_code) {
|
||||
final JSONObject extraObj = new JSONObject();
|
||||
|
||||
DeviceDto dto = this.findById(device_id);
|
||||
if (ObjectUtil.isNull(dto)) {
|
||||
return new JSONObject();
|
||||
@@ -1386,7 +1387,6 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
|
||||
}
|
||||
|
||||
|
||||
// JSONArray arr = WQLObject.getWQLObject("acs_device_extra").query("filed_type ='01' and device_id = '" + device_id + "'").getResultJSONArray(0);
|
||||
List<DeviceExtra> deviceExtraList = new LambdaQueryChainWrapper<>(deviceExtraMapper)
|
||||
.eq(DeviceExtra::getDevice_id, device_id)
|
||||
.eq(DeviceExtra::getFiled_type, "01")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.nl.acs.device_driver.one_conveyor.box_out_subvolumes_conveyor;
|
||||
package org.nl.acs.device_driver.one_conveyor.box_subvolumes_conveyor;
|
||||
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
@@ -16,7 +16,7 @@ import java.util.List;
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class BoxOutSubvolumesConveyorDefination implements OpcDeviceDriverDefination {
|
||||
public class BoxSubvolumesConveyorDefination implements OpcDeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "box_out_subvolumes_conveyor";
|
||||
@@ -34,13 +34,13 @@ public class BoxOutSubvolumesConveyorDefination implements OpcDeviceDriverDefina
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new BoxOutSubvolumesConveyorDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
return (new BoxSubvolumesConveyorDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return BoxOutSubvolumesConveyorDeviceDriver.class;
|
||||
return BoxSubvolumesConveyorDeviceDriver.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.nl.acs.device_driver.one_conveyor.box_out_subvolumes_conveyor;
|
||||
package org.nl.acs.device_driver.one_conveyor.box_subvolumes_conveyor;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
@@ -20,7 +20,6 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
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.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
@@ -44,7 +43,7 @@ import java.util.concurrent.ThreadPoolExecutor;
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class BoxOutSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
|
||||
public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
|
||||
private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll();
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.nl.acs.device_driver.one_conveyor.box_out_subvolumes_conveyor;
|
||||
package org.nl.acs.device_driver.one_conveyor.box_subvolumes_conveyor;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.Data;
|
||||
@@ -72,14 +72,14 @@ public class ItemProtocol {
|
||||
|
||||
|
||||
|
||||
private BoxOutSubvolumesConveyorDeviceDriver driver;
|
||||
private BoxSubvolumesConveyorDeviceDriver driver;
|
||||
|
||||
public int getContainer_type() {
|
||||
return this.getOpcIntegerValue(item_container_type);
|
||||
}
|
||||
|
||||
|
||||
public ItemProtocol(BoxOutSubvolumesConveyorDeviceDriver driver) {
|
||||
public ItemProtocol(BoxSubvolumesConveyorDeviceDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -18,6 +19,8 @@ import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.enums.StorageTypeEnum;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
@@ -59,6 +62,8 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
|
||||
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsService.class);
|
||||
|
||||
//工作模式
|
||||
int mode = 0;
|
||||
int last_mode = 0;
|
||||
@@ -224,6 +229,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
if (error != last_error) {
|
||||
|
||||
//存在报警信号,则下发去异常处理位的任务
|
||||
applyErrorTask();
|
||||
|
||||
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + "->" + error);
|
||||
@@ -234,26 +240,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
}
|
||||
|
||||
// 更新指令状态
|
||||
if (mode == 3 && task > 0) {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
||||
|
||||
} else {
|
||||
this.instruction_update_time = date;
|
||||
//更改指令状态
|
||||
if (task > 0) {
|
||||
Instruction inst = checkInst();
|
||||
if (inst != null) {
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "0")) {
|
||||
inst.setInstruction_status(CommonFinalParam.ONE);
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
instructionService.update(inst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
updateInstruct();
|
||||
|
||||
} catch (Exception var17) {
|
||||
var17.printStackTrace();
|
||||
@@ -276,9 +263,9 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
message = "";
|
||||
Instruction instruction = null;
|
||||
List toInstructions;
|
||||
//申请入库任务
|
||||
//木箱入库申请入库任务
|
||||
if (mode == 6 && !requireSucess){
|
||||
|
||||
applyIn();
|
||||
}
|
||||
|
||||
//申请任务
|
||||
@@ -331,7 +318,84 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
last_barcode = barcode;
|
||||
}
|
||||
|
||||
private void applyErrorTask() {
|
||||
try {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", device_code);
|
||||
param.put("vehicle_code", barcode);
|
||||
param.put("type", StorageTypeEnum.ERROR.getType());
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "木箱入库申请入库任务,参数:" + param);
|
||||
HttpResponse response = acsToWmsService.shipDeviceUpdate(param);
|
||||
if (response == null || response.getStatus() == 200) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "木箱入库申请入库任务,接口返回:" + response.body());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void applyIn() {
|
||||
try {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", device_code);
|
||||
param.put("vehicle_code", barcode);
|
||||
param.put("type", StorageTypeEnum.STORAGE.getType());
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "木箱入库申请入库任务,参数:" + param);
|
||||
HttpResponse response = acsToWmsService.shipDeviceUpdate(param);
|
||||
if (response == null || response.getStatus() == 200) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "木箱入库申请入库任务,接口返回:" + response.body());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateInstruct() {
|
||||
if (mode == 3 && task > 0) {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
||||
|
||||
} else {
|
||||
this.instruction_update_time = date;
|
||||
//更改指令状态
|
||||
if (task > 0) {
|
||||
Instruction inst = checkInst();
|
||||
if (inst != null) {
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "0")) {
|
||||
inst.setInstruction_status(CommonFinalParam.ONE);
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
instructionService.update(inst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void updateInstruct() {
|
||||
if (mode == 3 && task > 0) {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
||||
|
||||
} else {
|
||||
this.instruction_update_time = date;
|
||||
//更改指令状态
|
||||
if (task > 0) {
|
||||
Instruction inst = checkInst();
|
||||
if (inst != null) {
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "0")) {
|
||||
inst.setInstruction_status(CommonFinalParam.ONE);
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
instructionService.update(inst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求指令
|
||||
|
||||
@@ -16,10 +16,9 @@ import org.nl.acs.device.service.impl.DeviceExtraServiceImpl;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.box_manipulator_site.BoxManipulatorSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.device_driver.one_conveyor.box_out_subvolumes_conveyor.BoxOutSubvolumesConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.one_conveyor.box_subvolumes_conveyor.BoxSubvolumesConveyorDeviceDriver;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
@@ -337,7 +336,7 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
//找符合条件的任务
|
||||
BoxOutSubvolumesConveyorDeviceDriver boxOutSubvolumesConveyorDeviceDriver = new BoxOutSubvolumesConveyorDeviceDriver();
|
||||
BoxSubvolumesConveyorDeviceDriver boxOutSubvolumesConveyorDeviceDriver = new BoxSubvolumesConveyorDeviceDriver();
|
||||
String deviceCode = boxOutSubvolumesConveyorDeviceDriver.getDevice_code();
|
||||
TaskDto taskDto = taskserver.findByEndCodeAndReady(deviceCode, TaskTypeEnum.Truss_Task.getIndex());
|
||||
if (ObjectUtil.isNotEmpty(taskDto)) {
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
public class BoxStorageManipulatorDefination implements OpcDeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "box_storage";
|
||||
return "box_storage_manipulator";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.device_driver.one_conveyor.box_storage_out_conveyor.BoxStorageOutConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.one_conveyor.box_subvolumes_conveyor.BoxSubvolumesConveyorDeviceDriver;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
@@ -277,7 +277,41 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
instructionService.update(inst);
|
||||
}
|
||||
}
|
||||
|
||||
//放货完成
|
||||
if (mode == 3 && action == 4 && move == 0) {
|
||||
if (inst != null) {
|
||||
try {
|
||||
logServer.deviceExecuteLog(this.device_code,"","","放货完成");
|
||||
finish_instruction(inst);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", 5);
|
||||
this.writing(map);
|
||||
message = "放货完成";
|
||||
} catch (Exception e) {
|
||||
message = "放货失败";
|
||||
e.printStackTrace();
|
||||
}
|
||||
feedMessage = "";
|
||||
}else {
|
||||
feedMessage = "行架机械手:";
|
||||
if (mode != 3) {
|
||||
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
|
||||
}
|
||||
if (action != 8) {
|
||||
feedMessage = feedMessage + "动作信号(action)不为放货完成状态,";
|
||||
}
|
||||
if (move != 0) {
|
||||
feedMessage = feedMessage + "光电信号(move)不为无货状态,";
|
||||
}
|
||||
if (task == 0) {
|
||||
feedMessage = feedMessage + "当前上报任务号(task)不应该为0。";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,8 +323,8 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
//找终点为入库输送线工位任务类型为行架的任务
|
||||
BoxStorageOutConveyorDeviceDriver boxStorageConveyorDeviceDriver = new BoxStorageOutConveyorDeviceDriver();
|
||||
String deviceCode = boxStorageConveyorDeviceDriver.getDevice_code();
|
||||
BoxSubvolumesConveyorDeviceDriver boxOutSubvolumesConveyorDeviceDriver = new BoxSubvolumesConveyorDeviceDriver();
|
||||
String deviceCode = boxOutSubvolumesConveyorDeviceDriver.getDevice_code();
|
||||
TaskDto taskDto = taskserver.findByEndCodeAndReady(deviceCode, TaskTypeEnum.Box_Storage.getIndex());
|
||||
if (ObjectUtil.isNotEmpty(taskDto)) {
|
||||
|
||||
@@ -395,6 +429,11 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized boolean finish_instruction(Instruction inst) throws Exception {
|
||||
instructionService.finish(inst);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 抽取统一下发电气信号前缀
|
||||
*
|
||||
|
||||
@@ -1,2 +1,26 @@
|
||||
package org.nl.acs.enums;public enum StorageTypeEnum {
|
||||
package org.nl.acs.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum StorageTypeEnum {
|
||||
STORAGE("1", "入库任务"),
|
||||
|
||||
DISKS_IN("2", "空盘入库"),
|
||||
|
||||
DISKS_OUT("3", "空盘出库"),
|
||||
|
||||
ERROR("4", "异常处理位");
|
||||
/**
|
||||
* 索引
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String value;
|
||||
}
|
||||
|
||||
@@ -490,7 +490,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
task_code = CodeUtil.getNewCode("TASK_NO");
|
||||
task_code = CommonFinalParam.HYPHEN_ + task_code;
|
||||
}
|
||||
String start_point_code = dto.getStart_point_code();
|
||||
String start_point_code;
|
||||
String next_point_code = dto.getNext_point_code();
|
||||
String start_device_code = dto.getStart_device_code();
|
||||
String next_device_code = dto.getNext_device_code();
|
||||
|
||||
Reference in New Issue
Block a user