This commit is contained in:
2024-03-19 14:20:49 +08:00
29 changed files with 1074 additions and 458 deletions

View File

@@ -279,7 +279,15 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
map.put("point_code", point_code);
}
if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) {
// 将字符串时间解析为日期对象
Date date = DateUtil.parse(create_time.replace("Z", " UTC"), "yyyy-MM-dd'T'HH:mm:ss.SSS Z");
// 将日期对象加上8小时
/*Date newDate = DateUtil.offsetHour(date, 8);*/
// 将新日期对象格式化为字符串时间
create_time = DateUtil.formatDateTime(date);
map.put("create_time", create_time);
Date date1 = DateUtil.parse(end_time.replace("Z", " UTC"), "yyyy-MM-dd'T'HH:mm:ss.SSS Z");
end_time = DateUtil.formatDateTime(date1);
map.put("end_time", end_time);
}
JSONObject jsonObject1 =

View File

@@ -1,6 +1,7 @@
package org.nl.acs.agv.rest;
import com.alibaba.fastjson.JSONObject;
import groovy.lang.Lazy;
import org.nl.acs.agv.server.XianGongAgvService;
import org.nl.common.logging.annotation.Log;
import org.springframework.beans.factory.annotation.Autowired;
@@ -17,7 +18,7 @@ import org.springframework.web.bind.annotation.RequestBody;
@Controller
public class XianGongAgvController {
@Lazy
@Autowired
private XianGongAgvService xianGongAgentService;

View File

@@ -30,7 +30,6 @@ import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.Date;
import java.util.List;
import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString;
@@ -233,13 +232,14 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
try {
standardAutodoorDeviceDriver.writing("to_command", 1);
standardAutodoorDeviceDriver.writing("to_open", "1");
standardAutodoorDeviceDriver.writing("to_close", "0");
} catch (Exception e) {
log.info("下发电气信号失败:" + e.getMessage());
e.printStackTrace();
}
if (standardAutodoorDeviceDriver.getAction() == 1 && standardAutodoorDeviceDriver.getTo_command() == 1) {
log.info("下发开门信号值为:{}", standardAutodoorDeviceDriver.getTo_command());
if (standardAutodoorDeviceDriver.getOpen() == 1 && standardAutodoorDeviceDriver.getToOpen() == 1 ) {
log.info("下发开门信号值为:{},下发关门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getToClose());
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
}

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.autodoor.standard_autodoor;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -8,13 +9,10 @@ import java.util.List;
@Slf4j
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
public static String item_state = "state";
public static String item_action = "action";
public static String item_error = "error";
public static String item_to_command = "to_command";
public static String item_to_state = "to_state";
public static String item_open = "open";
public static String item_close = "close";
public static String item_to_open = "to_open";
public static String item_to_close = "to_close";
private StandardAutodoorDeviceDriver driver;
@@ -23,35 +21,27 @@ public class ItemProtocol {
this.driver = driver;
}
public int getHeartbeat() {
return this.getOpcIntegerValue(item_heartbeat);
public int getOpen() {
return this.getOpcIntegerValue(item_open);
}
public int getMode() {
return this.getOpcIntegerValue(item_mode);
public int getClose() {
return this.getOpcIntegerValue(item_close);
}
public int getAction() {
return this.getOpcIntegerValue(item_action);
public int getToOpen() {
return this.getOpcIntegerValue(item_to_open);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
public int getToClose() {
return this.getOpcIntegerValue(item_to_close);
}
public int getToCommand() {
return this.getOpcIntegerValue(item_to_command);
}
public int getToState() {
return this.getOpcIntegerValue(item_to_state);
}
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
// log.error("读取错误!");
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
} else {
return value;
}
@@ -59,22 +49,34 @@ public class ItemProtocol {
}
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
if (StrUtil.isEmpty(value)) {
} else {
return value;
}
return "0";
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0"));
list.add(new ItemDto(item_mode, "工作模式", "DB600.B1", Boolean.valueOf(true)));
list.add(new ItemDto(item_state, "工作状态", "DB600.B2"));
list.add(new ItemDto(item_action, "动作信号", "DB600.B3"));
list.add(new ItemDto(item_error, "报警信号", "DB600.B4"));
list.add(new ItemDto(item_open, "开到位", "10001"));
list.add(new ItemDto(item_close, "关到位", "10002"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "作业命令", "DB601.W2", Boolean.valueOf(true)));
list.add(new ItemDto(item_to_state, "下发状态", "DB601.W3", Boolean.valueOf(true)));
list.add(new ItemDto(item_to_open, "下发开门", "00001" ));
list.add(new ItemDto(item_to_close, "下发关门", "00002"));
return list;
}
@Override
public String toString() {
return "";
}
}

View File

@@ -2,12 +2,11 @@ package org.nl.acs.device_driver.autodoor.standard_autodoor;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.enums.DeviceType;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
import org.nl.acs.device.enums.DeviceType;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
@@ -31,6 +30,7 @@ public class StandardAutodoorDefination implements OpcDeviceDriverDefination {
return "标准版-自动门";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new StandardAutodoorDeviceDriver()).setDevice(device).setDriverDefination(this);
@@ -49,18 +49,10 @@ public class StandardAutodoorDefination implements OpcDeviceDriverDefination {
return types;
}
@Override
public List<ItemDto> getReadableItemDtos() {
return getReadableItemDtos2();
}
public static List<ItemDto> getReadableItemDtos2() {
List<ItemDto> list = new ArrayList();
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB600.B0"));
list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB600.B1", true));
list.add(new ItemDto(ItemProtocol.item_action, "动作信号", "DB600.B2"));
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB600.B4"));
return list;
return ItemProtocol.getReadableItemDtos();
}
@Override

View File

@@ -4,98 +4,41 @@ import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device;
import org.nl.acs.ext.wms.data.one.feedBackTaskStatus.FeedBackTaskStatusRequest;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.utils.ReadUtil;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.utils.ReadUtil;
import org.nl.config.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* 自动门驱动
*/
@Slf4j
@Data
@RequiredArgsConstructor
public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver {
public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
int open = 0;
int close = 0;
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
int last_open = 0;
int last_close = 0;
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
String container;
String container_type_desc;
String last_container_type_desc;
String last_container;
//放货准备锁
String putReadyLock = null;
//有货标记
protected boolean has_goods_tag = false;
String devicecode;
int mode = 0;
int action = 0;
int error = 0;
Boolean iserror = false;
int move = 0;
int task = 0;
int state = 0;
int last_state = 0;
int last_action = 0;
int last_mode = 0;
int last_error = 0;
int last_move = 0;
int last_task = 0;
boolean hasVehicle = false;
boolean isReady = false;
protected int instruction_num = 0;
protected int instruction_num_truth = 0;
protected boolean hasGoods = false;
boolean isFold = false;
private String assemble_check_tag;
private Boolean sampleMode0;
private Boolean sampleMode3;
private Integer sampleError;
private Boolean sampleOnline;
protected String displayMessage = null;
public int display_message_time_out = 30000;
public Date display_message_time;
protected String current_stage_instruction_message;
protected String last_stage_instruction_message;
Integer heartbeat_tag;
private Date instruction_require_time = new Date();
private Date instruction_finished_time = new Date();
int to_command = 0;
int last_to_command = 0;
private int instruction_require_time_out;
boolean requireSucess = false;
private int instruction_finished_time_out;
int branchProtocol = 0;
int toOpen = 0;
int last_toOpen = 0;
int toClose = 0;
int last_toClose = 0;
String device_code = null;
@Override
public Device getDevice() {
@@ -107,55 +50,44 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
public void execute() {
String message = null;
String device_code = this.getDevice().getDevice_code();
mode = this.itemProtocol.getMode();
action = this.itemProtocol.getAction();
error = this.itemProtocol.getError();
to_command = this.itemProtocol.getToCommand();
if (mode != last_mode) {
device_code = this.getDevice().getDevice_code();
open = this.itemProtocol.getOpen();
close = this.itemProtocol.getClose();
toOpen = this.itemProtocol.getToOpen();
toClose = this.itemProtocol.getToClose();
if (open != last_open) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号open" + last_open + "->" + open);
}
if (action != last_action) {
if (close != last_close) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号close" + last_close + "->" + close);
if(close ==1 ){
this.writing("to_close","0");
}
}
if (error != last_error) {
}
if (state != last_state) {
//固化室状态变更后通知lms更新固化室状态
FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
request.setState(String.valueOf(state));
request.setDevice_code(this.devicecode);
request.setType(CommonFinalParam.ONE);
acsToWmsService.notify(request);
}
last_action = action;
last_mode = mode;
last_error = error;
last_state = state;
last_to_command = to_command;
//message = StringFormatUtl.format("设备报警:{}", new Object[]{});
// String manual_create_task = this.getDevice().getExtraValue().get("manual_create_task").toString();
if (toClose != last_toClose) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号toClose" + last_toClose + "->" + toClose);
}
if (toOpen != last_toOpen) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号toOpen" + last_toOpen + "->" + toOpen);
}
last_open = open;
last_close = close;
last_toClose = toClose;
last_toOpen = toOpen;
}
public synchronized String getStatus() {
JSONObject jo = new JSONObject();
if (action == 1) {
jo.put("name", this.getDevice().getDevice_code());
jo.put("status", "OPEN");
public void writing(String param, String value) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, Integer.parseInt(value));
} else if (action == 2) {
jo.put("name", this.getDevice().getDevice_code());
jo.put("status", "CLOSE");
} else {
jo.put("name", this.getDevice().getDevice_code());
jo.put("status", "ERROR");
}
return jo.toString();
this.control(itemMap);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
}
public void writing(String param, int command) {
String to_command = String.format("%s.%s.%s.%s", this.getDevice().getOpc_server_code(), this.getDevice().getOpc_plc_code(), this.getDevice().getDevice_code(), param);
@@ -165,19 +97,37 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
log.info("下发PLC信号{},{}", to_command, command);
System.out.println("设备:" + devicecode + ",下发PLC信号" + to_command + ",value:" + command);
System.out.println("设备:" + this.device_code + ",下发PLC信号" + to_command + ",value:" + command);
}
public synchronized void OpenOrClose(String type) {
//开门
if (CommonFinalParam.ONE.equals(type)) {
writing(ItemProtocol.item_to_command, 1);
} else {
writing(ItemProtocol.item_to_command, 2);
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String open = "";
String close = "";
if (this.getOpen() == 0) {
open = "未知";
} else if (this.getOpen() == 1) {
open = "开到位";
}
if (this.getClose() == 0) {
open = "未知";
} else if (this.getClose() == 1) {
open = "关到位";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("open", open);
jo.put("close", close);
jo.put("isOnline", true);
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -271,14 +271,14 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
this.require_apply_strangulation_time = date;
// String vehicle_code = "";
//
// if (StrUtil.isEmpty(vehicle_code)) {
// message = LangProcess.msg("one_message8") + ": " + task + LangProcess.msg("one_message11");
// return;
// }
Instruction inst = instructionService.findByCodeFromCache(String.valueOf(task));
if (StrUtil.isEmpty(inst.getVehicle_code())) {
message = LangProcess.msg("one_message8") + ": " + task + LangProcess.msg("one_message11");
return;
}
JSONObject param = new JSONObject();
param.put("device_code", device_code);
param.put("vehicle_code", material_barcode);
param.put("vehicle_code", inst.getVehicle_code());
param.put("type", AcsToLmsApplyTaskTypeEnum.LABEL_BIND.getType());
String response = acsToWmsService.deviceApplyTwo(param);
JSONObject jo = JSON.parseObject(response);
@@ -289,7 +289,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
// Map datas = applyLabelingAndBindingResponse.getData();
packagePLCData(jo.getString("body"));
packagePLCData(jo.getString("data"));
requireSucess = true;
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()

View File

@@ -1,4 +1,4 @@
package org.nl.acs.device_driver.manipulator_cache;
package org.nl.acs.device_driver.one_conveyor.manipulator_cache;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

View File

@@ -1,19 +1,21 @@
package org.nl.acs.device_driver.manipulator_cache;
package org.nl.acs.device_driver.one_conveyor.manipulator_cache;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.enums.DeviceType;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
import org.springframework.stereotype.Service;
import java.util.LinkedList;
import java.util.List;
/**
* 扫码器
* 行架对接缓存位
*/
@Service
public class ManipulatorCacheDefination implements DeviceDriverDefination {
public class ManipulatorCacheDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "manipulator_cache";
@@ -35,6 +37,17 @@ public class ManipulatorCacheDefination implements DeviceDriverDefination {
}
@Override
public List<ItemDto> getReadableItemDtos() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
return null;
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return ManipulatorCacheDeviceDriver.class;

View File

@@ -1,9 +1,5 @@
package org.nl.acs.device_driver.manipulator_cache;
package org.nl.acs.device_driver.one_conveyor.manipulator_cache;
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 com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@@ -25,7 +21,7 @@ import java.util.*;
import java.util.concurrent.ThreadPoolExecutor;
/**
* 标准版扫码器
* 行架对接缓存位
*/
@Slf4j
@Data

View File

@@ -1,7 +1,6 @@
package org.nl.acs.device_driver.one_manipulator.box_package_manipulator;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@@ -20,8 +19,7 @@ import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.device_driver.manipulator_cache.ManipulatorCacheDeviceDriver;
import org.nl.acs.device_driver.one_conveyor.box_subvolumes_conveyor.BoxSubvolumesConveyorDeviceDriver;
import org.nl.acs.device_driver.one_conveyor.manipulator_cache.ManipulatorCacheDeviceDriver;
import org.nl.acs.history.ErrorUtil;
import org.nl.acs.history.service.DeviceErrorLogService;
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;

View File

@@ -19,7 +19,7 @@ import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.device_driver.manipulator_cache.ManipulatorCacheDeviceDriver;
import org.nl.acs.device_driver.one_conveyor.manipulator_cache.ManipulatorCacheDeviceDriver;
import org.nl.acs.device_driver.one_manipulator.trapped_manipulator.InteractionJsonDTO;
import org.nl.acs.enums.VolumeTwoTypeEnum;
import org.nl.acs.history.ErrorUtil;

View File

@@ -1,20 +1,17 @@
package org.nl.acs.device_driver.stacker.standard_stacker;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.common.value.qual.StringVal;
import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.enums.DeviceType;
import org.nl.acs.device.enums.ErrorType;
import org.nl.acs.device.service.DeviceExtraService;
import org.nl.acs.device.service.impl.DeviceExtraServiceImpl;
import org.nl.acs.device_driver.DeviceDriver;
@@ -25,10 +22,7 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.history.ErrorUtil;
import org.nl.acs.history.domain.AcsDeviceErrorLog;
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;
@@ -42,6 +36,7 @@ import org.nl.acs.route.service.impl.RouteLineServiceImpl;
import org.nl.acs.task.domain.Task;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.common.utils.RedisUtils;
import org.nl.config.SpringContextHolder;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService;
@@ -78,6 +73,11 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
public static final String REDIS_MOVE_BOX = "MOVE:MOVE_TASK";
@Autowired
private RedisUtils redisUtils;
/**
* 禁止入库
*/
@@ -286,6 +286,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
Instruction inst = null;
@Override
public Device getDevice() {
return this.device;
@@ -479,6 +481,18 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
Instruction inst = checkInst();
try {
finish_instruction(inst);
// if (ObjectUtil.isNotEmpty(redisUtils.get(REDIS_MOVE_BOX))){
// String taskRedis = redisUtils.get(REDIS_MOVE_BOX).toString();
// task = Integer.valueOf(taskRedis);
// Instruction instOld = checkInst();
// List list1 = new ArrayList();
// pakageCommand(list1, taskRedis);
// pakagePlc(instOld, list1);
// if (ObjectUtil.isNotNull(list1)) {
// this.writing(list1);
// }
// }
// list.remove(0);
} catch (Exception e) {
e.printStackTrace();
}
@@ -565,29 +579,58 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
return;
} else {
Instruction instruction = instructionService.findByCode(String.valueOf(task));
if (ObjectUtil.isNotEmpty(instruction)){
if (ObjectUtil.isEmpty(instruction)){
message = "one_message9";
return;
}
JSONObject param = new JSONObject();
param.put("task_code", instruction.getTask_code());
param.put("task_id", instruction.getTask_id());
param.put("type", type);
String response = acsToWmsService.applyUpdatePointCode(param);
JSONObject jo = JSON.parseObject(response);
if (StrUtil.isNotEmpty(jo.getString("body")) || jo.getInteger("status") == 200) {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请更新点位,参数,接口返回:" + jo)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
JSONObject pointCodeJson = JSON.parseObject(jo.getString("body"));
String poinCode = pointCodeJson.getString("poin_code").toString();
if (type.equals(StandarStirageErroEnum.BLOCK_OUT.getType()) || type.equals(StandarStirageErroEnum.VOIDANCE.getType())){
updateData1(poinCode, instruction);
}
if (type.equals(StandarStirageErroEnum.BLOCK_IN.getType()) || type.equals(StandarStirageErroEnum.FILL.getType())){
updateData2(poinCode, instruction);
try {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请更新点位,参数,接口返回:" + jo)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
String poinCode = jo.getString("point_code");
if (StrUtil.isNotEmpty(poinCode)) {
String[] split = poinCode.split("-");
Device point = deviceAppService.findDeviceByCode(split[0]);
if (ObjectUtil.isEmpty(point)) {
message = "one_message18";
}
if (type.equals(StandarStirageErroEnum.VOIDANCE.getType())) {
updateData1(poinCode, instruction, point, split);
pakageData(point, split);
}
if (type.equals(StandarStirageErroEnum.BLOCK_IN.getType()) || type.equals(StandarStirageErroEnum.FILL.getType())) {
updateData2(poinCode, instruction, point, split);
pakageData(point, split);
}
}
if (StrUtil.isNotEmpty(jo.getString("task_id"))) {
//取货潜货位阻挡做完移库任务
if (type.equals(StandarStirageErroEnum.BLOCK_OUT.getType())) {
//存缓存
redisUtils.set(REDIS_MOVE_BOX, task);
TaskDto taskId = taskserver.findById(jo.getString("task_id"));
if (ObjectUtil.isNotEmpty(taskId)) {
String poinCodeMove = taskId.getStart_point_code();
String[] split = poinCodeMove.split("-");
Device point = deviceAppService.findDeviceByCode(split[0]);
pakageData(point, split);
}
}
}
}catch (Exception e){
this.requireSucess = true;
e.printStackTrace();
}
this.requireSucess = true;
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
@@ -599,47 +642,81 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
}
private void updateData2(String poinCode, Instruction instruction) {
Instruction instructionUpdate = new Instruction();
instructionUpdate.setNext_point_code(poinCode);
String[] split = poinCode.split("-");
Device endPoint = deviceAppService.findDeviceByCode(split[0]);
instructionUpdate.setTo_x(endPoint.getExtraValue().get("x").toString());
instructionUpdate.setNext_device_code(split[0]);
instructionUpdate.setTo_y(split[1]);
instructionUpdate.setTo_z(split[2]);
instructionUpdate.setInstruction_code(String.valueOf(task));
instructionService.updateByInstructionCode(instructionUpdate);
Task taskUpdate = new Task();
taskUpdate.setTo_x(endPoint.getExtraValue().get("x").toString());
taskUpdate.setNext_device_code(split[0]);
taskUpdate.setTo_y(split[1]);
taskUpdate.setTo_z(split[2]);
taskUpdate.setTask_code(instruction.getTask_code());
taskserver.updateByTaskCode(taskUpdate);
private void pakageData( Device point, String[] split) {
List list = new ArrayList();
String x = point.getExtraValue().get("x").toString();
String y = split[1];
String z = split[2];
HashMap map1 = new HashMap();
map1.put("code", "to_x");
map1.put("value", y);
list.add(map1);
HashMap map2 = new HashMap();
map2.put("code", "to_y");
map2.put("value", z);
list.add(map2);
HashMap map3 = new HashMap();
map3.put("code", "to_z");
map3.put("value", x);
list.add(map3);
if (ObjectUtil.isNotEmpty(list)) {
this.writing(list);
}
}
private void updateData1(String poinCode, Instruction instruction) {
Instruction instructionUpdate = new Instruction();
private void updateData2(String poinCode, Instruction instruction, Device point, String[] split) {
Instruction instructionUpdate = checkInst();
TaskDto taskUpdate = new TaskDto();
instructionUpdate.setNext_point_code(poinCode);
instructionUpdate.setNext_device_code(split[0]);
taskUpdate.setNext_point_code(poinCode);
taskUpdate.setNext_device_code(split[0]);
taskUpdate.setTask_id(instructionUpdate.getTask_id());
pakageData2(instruction, instructionUpdate, point, split, taskUpdate);
instructionService.update(instructionUpdate);
taskserver.update(taskUpdate);
}
private void updateData1(String poinCode, Instruction instruction, Device point, String[] split) {
Instruction instructionUpdate = checkInst();
TaskDto taskUpdate = new TaskDto();
instructionUpdate.setStart_point_code(poinCode);
String[] split = poinCode.split("-");
Device starPoint = deviceAppService.findDeviceByCode(split[0]);
instructionUpdate.setFrom_x(starPoint.getExtraValue().get("x").toString());
instructionUpdate.setStart_device_code(split[0]);
taskUpdate.setStart_point_code(poinCode);
taskUpdate.setStart_device_code(split[0]);
taskUpdate.setTask_id(instructionUpdate.getTask_id());
pakageData1(instruction, instructionUpdate, point, split, taskUpdate);
//更新缓存数据库
instructionService.update(instructionUpdate);
taskserver.update(taskUpdate);
}
private void pakageData1(Instruction instruction, Instruction instructionUpdate, Device starPoint, String[] split, TaskDto taskUpdate) {
instructionUpdate.setFrom_x(starPoint.getExtraValue().get("x").toString());
instructionUpdate.setFrom_y(split[1]);
instructionUpdate.setFrom_z(split[2]);
instructionUpdate.setInstruction_code(String.valueOf(task));
instructionService.updateByInstructionCode(instructionUpdate);
Task taskUpdate = new Task();
taskUpdate.setFrom_x(starPoint.getExtraValue().get("x").toString());
taskUpdate.setStart_device_code(split[0]);
taskUpdate.setFrom_y(split[1]);
taskUpdate.setFrom_z(split[2]);
taskUpdate.setTask_code(instruction.getTask_code());
taskserver.updateByTaskCode(taskUpdate);
}
private void pakageData2(Instruction instruction, Instruction instructionUpdate, Device starPoint, String[] split, TaskDto taskUpdate) {
instructionUpdate.setTo_x(starPoint.getExtraValue().get("x").toString());
instructionUpdate.setTo_y(split[1]);
instructionUpdate.setTo_z(split[2]);
instructionUpdate.setInstruction_code(String.valueOf(task));
taskUpdate.setTo_x(starPoint.getExtraValue().get("x").toString());
taskUpdate.setTo_y(split[1]);
taskUpdate.setTo_z(split[2]);
taskUpdate.setTask_code(instruction.getTask_code());
}
/**
* 申请任务
*
@@ -704,18 +781,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
}
List list = new ArrayList();
HashMap map1 = new HashMap();
map1.put("code", "to_device_code");
map1.put("value", this.getDevice().getAddress());
list.add(map1);
HashMap map2 = new HashMap();
map2.put("code", "to_command");
map2.put("value", 1);
list.add(map2);
HashMap map3 = new HashMap();
map3.put("code", "to_task");
list.add(map3);
map3.put("value", inst.getInstruction_code());
pakageCommand(list, inst.getInstruction_code());
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) {
if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("z"))) {
HashMap map4 = new HashMap();
@@ -737,26 +804,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
}
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.storage.name())) {
HashMap map4 = new HashMap();
map4.put("code", "to_y");
map4.put("value", inst.getFrom_z());
list.add(map4);
if (inst.getFrom_x().length() > 1) {
String substring = inst.getFrom_x().substring(1);
HashMap map5 = new HashMap();
map5.put("code", "to_z");
map5.put("value", substring);
list.add(map5);
} else {
HashMap map6 = new HashMap();
map6.put("code", "to_z");
map6.put("value", inst.getFrom_x());
list.add(map6);
}
HashMap map7 = new HashMap();
map7.put("code", "to_x");
map7.put("value", inst.getFrom_y());
list.add(map7);
pakagePlc(inst, list);
}
if (ObjectUtil.isNotEmpty(list)) {
this.writing(list);
@@ -767,6 +815,44 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
return true;
}
private void pakagePlc(Instruction inst, List list) {
HashMap map4 = new HashMap();
map4.put("code", "to_y");
map4.put("value", inst.getFrom_z());
list.add(map4);
if (inst.getFrom_x().length() > 1) {
String substring = inst.getFrom_x().substring(1);
HashMap map5 = new HashMap();
map5.put("code", "to_z");
map5.put("value", substring);
list.add(map5);
} else {
HashMap map6 = new HashMap();
map6.put("code", "to_z");
map6.put("value", inst.getFrom_x());
list.add(map6);
}
HashMap map7 = new HashMap();
map7.put("code", "to_x");
map7.put("value", inst.getFrom_y());
list.add(map7);
}
private void pakageCommand( List list, String inst) {
HashMap map1 = new HashMap();
map1.put("code", "to_device_code");
map1.put("value", this.getDevice().getAddress());
list.add(map1);
HashMap map2 = new HashMap();
map2.put("code", "to_command");
map2.put("value", 1);
list.add(map2);
HashMap map3 = new HashMap();
map3.put("code", "to_task");
map3.put("value", inst);
list.add(map3);
}
/**
* 将指令根据优先级和创建时间排序
*

View File

@@ -617,7 +617,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
MDC.put(log_file_type, log_type);
log.info("applyTaskToWms-----输入参数{}", param);
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("applyUpdatePointCode");
AddressDto addressDto = addressService.findByCode("deviceApplyExceptional");
String url = wmsurl + addressDto.getMethods_url();
HttpResponse result2 = null;
try {

View File

@@ -453,5 +453,4 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
*/
Boolean querySameNextDeviceCodeInstByOut(String nextDeviceCode);
void updateByInstructionCode(Instruction instructionUpdate);
}

View File

@@ -1,11 +1,9 @@
package org.nl.acs.instruction.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.stream.CollectorUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@@ -17,7 +15,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
@@ -28,7 +25,6 @@ import org.nl.acs.agv.server.XianGongAgvService;
import org.nl.acs.auto.initial.ApplicationAutoInitial;
import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.domain.DeviceErpmapping;
import org.nl.acs.device.enums.DeviceType;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.impl.DeviceServiceImpl;
@@ -36,7 +32,6 @@ import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver;
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
import org.nl.acs.device_driver.conveyor.standard_conveyor_control.StandardCoveyorControlDeviceDriver;
import org.nl.acs.device_driver.conveyor.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
import org.nl.acs.device_driver.conveyor.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.two_conveyor.hongxiang_device.HongXiangConveyorDeviceDriver;
@@ -1822,13 +1817,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
.isEmpty();
}
@Override
public void updateByInstructionCode(Instruction instructionUpdate) {
InstructionMybatis entity = ConvertUtil.convert(instructionUpdate, InstructionMybatis.class);
UpdateWrapper<InstructionMybatis> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("instruction_code", instructionUpdate.getInstruction_code());
instructionMapper.update(entity,updateWrapper);
}
private boolean regional( String start_device_code, String next_device_code) {
Device startdevice = deviceAppService.findDeviceByCode(start_device_code);

View File

@@ -511,5 +511,4 @@ public interface TaskService extends CommonService<Task> {
*/
TaskDto findByTaskCode(String task_code);
void updateByTaskCode(Task taskUpdate);
}

View File

@@ -2,13 +2,12 @@ package org.nl.acs.task.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -30,9 +29,6 @@ import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.dto.DeviceAssignedDto;
import org.nl.acs.device.service.impl.DeviceServiceImpl;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.RequestMethodEnum;
import org.nl.acs.ext.wms.data.one.BaseRequest;
import org.nl.acs.ext.wms.data.one.feedBackTaskStatus.FeedBackTaskStatusRequest;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.domain.InstructionMybatis;
@@ -48,7 +44,6 @@ import org.nl.acs.route.service.mapper.RoutePlanMapper;
import org.nl.acs.task.enums.TaskStatusEnum;
import org.nl.acs.task.enums.TaskTypeEnum;
import org.nl.acs.task.service.TaskFeedbackService;
import org.nl.acs.task.service.dto.TaskFeedbackDto;
import org.nl.acs.common.base.PageInfo;
import org.nl.acs.common.base.QueryHelpMybatisPlus;
import org.nl.acs.common.base.impl.CommonServiceImpl;
@@ -75,7 +70,6 @@ import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.regex.Matcher;
@@ -1541,12 +1535,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
return null;
}
@Override
public void updateByTaskCode(Task taskUpdate) {
UpdateWrapper<Task> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("task_code", taskUpdate.getTask_code());
taskMapper.update(taskUpdate,updateWrapper);
}
/**
* 把多个字符串拼接的inst_nextDevice_code解析成集合

View File

@@ -15,6 +15,10 @@
*/
package org.nl.system.service.secutiry.impl;
import cn.dev33.satoken.SaManager;
import cn.dev33.satoken.config.SaCookieConfig;
import cn.dev33.satoken.context.SaHolder;
import cn.dev33.satoken.context.model.SaCookie;
import cn.dev33.satoken.secure.SaSecureUtil;
import cn.dev33.satoken.stp.SaLoginModel;
import cn.dev33.satoken.stp.StpUtil;
@@ -257,6 +261,19 @@ public class OnlineUserService {
.setDevice("PC")
.setExtra("loginInfo", user)
);
String tokenValue = StpUtil.getTokenValue();
SaCookieConfig cfg = SaManager.getConfig().getCookie();
SaCookie cookie = new SaCookie()
.setName(StpUtil.getTokenValue())
.setValue(tokenValue)
.setMaxAge(-1)
.setDomain(cfg.getDomain())
.setPath(cfg.getPath())
.setSecure(cfg.getSecure())
.setHttpOnly(cfg.getHttpOnly())
.setSameSite(cfg.getSameSite())
;
SaHolder.getResponse().addCookie(cookie);
// 返回 token 与 用户信息
JSONObject jsonObject = new JSONObject();

View File

@@ -9,11 +9,12 @@ spring:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
username: ${DB_USER:root}
# password: ${DB_PWD:Root.123456}
password: ${DB_PWD:p@ssw0rd}
password: ${DB_PWD:123456}
# 初始连接数
initial-size: 5
# 最小连接数

View File

@@ -14,6 +14,7 @@ one_message14=\u7533\u8BF7\u4EFB\u52A1\u5931\u8D25
one_message15=\u7533\u8BF7AGV\u642C\u8FD0\u4EFB\u52A1\u63A5\u53E3\u4E0D\u901A
one_message16=\u7533\u8BF7AGV\u642C\u8FD0\u4EFB\u52A1\u6210\u529F
one_message17=\u7533\u8BF7AGV\u642C\u8FD0\u4EFB\u52A1\u5931\u8D25
one_message18=\u672A\u627E\u5230\u66F4\u65B0\u7684\u70B9\u4F4D
one_mode1=\u7533\u8BF7\u5165\u5E93\u4EFB\u52A1
one_mode2=\u7533\u8BF7\u7A7A\u6258\u76D8\u5165\u5E93
one_mode3=\u7533\u8BF7AGV\u4EFB\u52A1

View File

@@ -14,6 +14,8 @@ one_message14=Task request failed
one_message15=The interface for applying for a complement to the AGV carrying task fails. Procedure
one_message16=Succeeded in applying for the AGV transfer task. Procedure
one_message17=Failed to apply for the AGV transfer task. Procedure
one_message18=No updated point found
one_mode1=Request a warehouse entry task
one_mode2=Request empty pallets for storage
one_mode3=Request AGV

View File

@@ -14,6 +14,8 @@ one_message14=Misi aplikasi gagal
one_message15=Permintaan kode tambahan AGV memindahkan antarmuka misi tidak tersedia
one_message16=Minta ijin ke operasi AGV
one_message17=Aplikasi bantuan AGV pemindahan gagal
one_message18=Titik pembaruan tidak ditemukan
one_mode1=Berlaku untuk tugas pustaka
one_mode2=Pendaftaran nampan kosong
one_mode3=Permintaan AGV

View File

@@ -14,6 +14,8 @@ one_message14=\u7533\u8BF7\u4EFB\u52A1\u5931\u8D25
one_message15=\u7533\u8BF7\u8865\u7801AGV\u642C\u8FD0\u4EFB\u52A1\u63A5\u53E3\u4E0D\u901A
one_message16=\u7533\u8BF7\u8865\u7801AGV\u642C\u8FD0\u4EFB\u52A1\u6210\u529F
one_message17=\u7533\u8BF7\u8865\u7801AGV\u642C\u8FD0\u4EFB\u52A1\u5931\u8D25
one_message18=\u672A\u627E\u5230\u66F4\u65B0\u7684\u70B9\u4F4D
one_mode1=\u7533\u8BF7\u5165\u5E93\u4EFB\u52A1
one_mode2=\u7533\u8BF7\u7A7A\u6258\u76D8\u5165\u5E93
one_mode3=\u7533\u8BF7AGV\u4EFB\u52A1

View File

@@ -1,9 +1,9 @@
window.g = {
dev: {
VUE_APP_BASE_API: 'http://192.168.101.1:8011'
VUE_APP_BASE_API: 'http://127.0.0.1:8011'
},
prod: {
VUE_APP_BASE_API: 'http://192.168.101.1:8011'
VUE_APP_BASE_API: 'http://127.0.0.1:8011'
}
}

View File

@@ -125,6 +125,7 @@ import return_good_manipulator from '@/views/acs/device/driver/one_manipulator/r
import volume_two_manipulator from '@/views/acs/device/driver/one_manipulator/volume_two_manipulator.vue'
import box_storage_out_conveyor from '@/views/acs/device/driver/one_conveyor/box_storage_out_conveyor.vue'
import box_subvolumes_conveyor from '@/views/acs/device/driver/one_conveyor/box_subvolumes_conveyor.vue'
import manipulator_cache from '@/views/acs/device/driver/one_conveyor/manipulator_cache.vue'
import finished_product_out_with_bind_lable_conveyor from '@/views/acs/device/driver/one_conveyor/finished_product_out_with_bind_lable_conveyor.vue'
import fold_disc_site from '@/views/acs/device/driver/one_conveyor/fold_disc_site.vue'
import scanner_weight_conveyor from '@/views/acs/device/driver/one_conveyor/scanner_weight_conveyor.vue'
@@ -188,7 +189,8 @@ export default {
xg_agv_car,
oven_inspect_site,
manipulator_agv_station,
volume_two_manipulator
volume_two_manipulator,
manipulator_cache
},
dicts: ['device_type'],
mixins: [crud],

View File

@@ -0,0 +1,564 @@
<template>
<!--行架对接缓存位-->
<div>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">设备协议</span>
</div>
<el-row>
<el-col :span="12">
OpcServer:
<el-select
v-model="opc_id"
placeholder="无"
clearable
filterable
@change="changeOpc"
>
<el-option
v-for="item in dataOpcservers"
:key="item.opc_id"
:label="item.opc_name"
:value="item.opc_id"
/>
</el-select>
</el-col>
<el-col :span="12">
PLC:
<el-select
v-model="plc_id"
placeholder="无"
clearable
@change="changePlc"
>
<el-option
v-for="item in dataOpcPlcs"
:key="item.plc_id"
:label="item.plc_name"
:value="item.plc_id"
/>
</el-select>
</el-col>
</el-row>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">输送系统</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-row>
<el-col :span="8">
<el-form-item label="电气调度号" label-width="150px">
<el-input v-model="form.address" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">指令相关</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-row>
<el-col :span="12">
<el-form-item label="排:" label-width="150px" prop="x">
<el-input v-model.number="form.x" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="列:" label-width="150px" prop="z">
<el-input v-model.number="form.z" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="层:" label-width="150px" prop="yY">
<el-input v-model.number="form.y" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">AGV相关</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-row>
<el-col :span="8">
<el-form-item label="取货">
<el-switch v-model="form.is_pickup" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="放货">
<el-switch v-model="form.is_release" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">PLC读取字段</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-table
v-loading="false"
:data="data1"
:max-height="550"
size="small"
style="width: 100%;margin-bottom: 15px"
>
<el-table-column prop="name" label="用途" />
<el-table-column prop="code" label="别名要求" />
<el-table-column prop="db" label="DB块">
<template slot-scope="scope">
<el-input
v-model="data1[scope.$index].db"
size="mini"
class="edit-input"
@input="finishReadEdit(data1[scope.$index])"
/>
</template>
</el-table-column>
<el-table-column prop="dbr_value">
<template slot="header">
<el-link type="primary" :underline="false" @click.native="test_read1()">测试读</el-link>
</template>
<template slot-scope="scope">
<el-input v-model="data1[scope.$index].dbr_value" size="mini" class="edit-input" />
</template>
</el-table-column>
</el-table>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">PLC写入字段</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-table
v-loading="false"
:data="data2"
:max-height="550"
size="small"
style="width: 100%;margin-bottom: 15px"
>
<el-table-column prop="name" label="用途" />
<el-table-column prop="code" label="别名要求" />
<el-table-column prop="db" label="DB块">
<template slot-scope="scope">
<el-input
v-model="data2[scope.$index].db"
size="mini"
class="edit-input"
@input="finishWriteEdit(data2[scope.$index])"
/>
</template>
</el-table-column>
<el-table-column prop="dbr_value2">
<template slot="header">
<el-link type="primary" :underline="false" @click.native="test_read2()">测试读</el-link>
</template>
<template slot-scope="scope">
<el-input v-model="data2[scope.$index].dbr_value" size="mini" class="edit-input" />
</template>
</el-table-column>
<el-table-column prop="dbw_value">
<template slot="header">
<el-link type="primary" :underline="false" @click.native="test_write1()">测试写</el-link>
</template>
<template slot-scope="scope">
<el-input v-model="data2[scope.$index].dbw_value" size="mini" class="edit-input" />
</template>
</el-table-column>
</el-table>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span" />
<el-button
:loading="false"
icon="el-icon-check"
size="mini"
style="float: right; padding: 6px 9px"
type="primary"
@click="doSubmit"
>保存
</el-button>
</div>
</el-card>
</div>
</template>
<script>
import {
queryDriverConfig,
updateConfig,
testRead,
testwrite
} from '@/api/acs/device/driverConfig'
import { selectOpcList } from '@/api/acs/device/opc'
import { selectPlcList } from '@/api/acs/device/opcPlc'
import { selectListByOpcID } from '@/api/acs/device/opcPlc'
import crud from '@/mixins/crud'
import deviceCrud from '@/api/acs/device/device'
export default {
name: 'ManipulatorCache',
mixins: [crud],
props: {
parentForm: {
type: Object,
required: true
}
},
data() {
return {
device_code: '',
device_id: '',
plc_id: '',
plc_code: '',
address: '',
opc_id: '',
opc_code: '',
configLoading: false,
dataOpcservers: [],
dataOpcPlcs: [],
deviceList: [],
data1: [],
data2: [],
form: {
inspect_in_stocck: true,
ignore_pickup_check: true,
ignore_release_check: true,
apply_task: true,
link_three_lamp: '',
manual_create_task: true,
is_pickup: true,
is_release: true,
link_device_code: [],
ship_device_update: true
},
rules: {}
}
},
created() {
this.$nextTick(() => {
// 从父表单获取设备编码
this.device_id = this.$props.parentForm.device_id
this.device_code = this.$props.parentForm.device_code
queryDriverConfig(
this.device_id,
this.$props.parentForm.driver_code
).then((data) => {
// 给表单赋值,并且属性不能为空
if (data.form) {
const arr = Object.keys(data.form)
// 不为空
if (arr.length > 0) {
this.form = data.form
}
}
// 给表单赋值,并且属性不能为空
if (data.parentForm) {
const arr = Object.keys(data.parentForm)
// 不为空
if (arr.length > 0) {
this.opc_code = data.parentForm.opc_code
this.plc_code = data.parentForm.plc_code
}
}
this.data1 = data.rs
this.data2 = data.ws
this.sliceItem()
})
selectPlcList().then((data) => {
this.dataOpcPlcs = data
this.plc_id = this.$props.parentForm.opc_plc_id
})
selectOpcList().then((data) => {
this.dataOpcservers = data
this.opc_id = this.$props.parentForm.opc_server_id
})
deviceCrud.selectDeviceList().then((data) => {
this.deviceList = data
})
})
},
methods: {
finishReadEdit(data) {
// 编辑的是code列,并且值包含mode
if (data.code.indexOf('mode') !== -1) {
const dbValue = data.db
// .之前的字符串
const beforeStr = dbValue.match(/(\S*)\./)[1]
// .之后的字符串
const afterStr = dbValue.match(/\.(\S*)/)[1]
// 取最后数字
const endNumber = afterStr.substring(1)
// 最后为非数字
if (isNaN(parseInt(endNumber))) {
return
}
for (const val in this.data1) {
if (this.data1[val].code.indexOf('mode') !== -1) {
this.data1[val].db =
beforeStr +
'.' +
afterStr.substring(0, 1) +
(parseInt(endNumber) + 0)
}
if (this.data1[val].code.indexOf('move') !== -1) {
this.data1[val].db =
beforeStr +
'.' +
afterStr.substring(0, 1) +
(parseInt(endNumber) + 1)
}
if (this.data1[val].code.indexOf('carrier_direction') !== -1) {
this.data1[val].db =
beforeStr +
'.' +
afterStr.substring(0, 1) +
(parseInt(endNumber) + 2)
}
if (this.data1[val].code.indexOf('error') !== -1) {
this.data1[val].db =
beforeStr +
'.' +
afterStr.substring(0, 1) +
(parseInt(endNumber) + 4)
}
if (this.data1[val].code.indexOf('task') !== -1) {
this.data1[val].db =
beforeStr + '.' + 'D' + (parseInt(endNumber) + 8)
}
}
}
},
finishWriteEdit(data) {
// 编辑的是code列,并且值包含mode
if (data.code.indexOf('to_command') !== -1) {
const dbValue = data.db
// .之前的字符串
const beforeStr = dbValue.match(/(\S*)\./)[1]
// .之后的字符串
const afterStr = dbValue.match(/\.(\S*)/)[1]
// 取最后数字
const endNumber = afterStr.substring(1)
// 最后为非数字
if (isNaN(parseInt(endNumber))) {
return
}
console.log(endNumber)
for (const val in this.data2) {
if (this.data2[val].code.indexOf('to_command') !== -1) {
this.data2[val].db =
beforeStr +
'.' +
afterStr.substring(0, 1) +
(parseInt(endNumber) + 0)
}
if (this.data2[val].code.indexOf('to_target') !== -1) {
this.data2[val].db =
beforeStr +
'.' +
afterStr.substring(0, 1) +
(parseInt(endNumber) + 2)
}
if (this.data2[val].code.indexOf('to_container_type') !== -1) {
this.data2[val].db =
beforeStr +
'.' +
afterStr.substring(0, 1) +
(parseInt(endNumber) + 4)
}
if (this.data2[val].code.indexOf('to_task') !== -1) {
this.data2[val].db =
beforeStr + '.' + 'D' + (parseInt(endNumber) + 6)
}
if (this.data2[val].code.indexOf('to_strap_times') !== -1) {
this.data2[val].db =
beforeStr +
'.' +
afterStr.substring(0, 1) +
(parseInt(endNumber) + 10)
}
if (this.data2[val].code.indexOf('to_length') !== -1) {
this.data2[val].db =
beforeStr +
'.' +
afterStr.substring(0, 1) +
(parseInt(endNumber) + 12)
}
if (this.data2[val].code.indexOf('to_weight') !== -1) {
this.data2[val].db =
beforeStr +
'.' +
afterStr.substring(0, 1) +
(parseInt(endNumber) + 14)
}
if (this.data2[val].code.indexOf('to_height') !== -1) {
this.data2[val].db =
beforeStr +
'.' +
afterStr.substring(0, 1) +
(parseInt(endNumber) + 16)
}
}
}
},
changeOpc(val) {
this.dataOpcservers.forEach((item) => {
if (item.opc_id === val) {
this.opc_code = item.opc_code
}
})
selectListByOpcID(val).then((data) => {
this.dataOpcPlcs = data
this.plc_id = ''
this.plc_code = ''
if (this.dataOpcPlcs && this.dataOpcPlcs.length > 0) {
this.plc_id = this.dataOpcPlcs[0].plc_id
this.plc_code = this.dataOpcPlcs[0].plc_code
}
this.sliceItem()
})
},
changePlc(val) {
this.dataOpcPlcs.forEach((item) => {
if (item.plc_id === val) {
this.plc_code = item.plc_code
this.sliceItem()
return
}
})
},
test_read1() {
testRead(this.data1, this.opc_id)
.then((data) => {
this.data1 = data
console.log(this.data1)
this.notify('操作成功!', 'success')
})
.catch((err) => {
console.log(err.response.data.message)
})
},
test_write1() {
testwrite(this.data2, this.opc_id)
.then((data) => {
this.notify('操作成功!', 'success')
})
.catch((err) => {
console.log(err.response.data.message)
})
},
test_read2() {
testRead(this.data2, this.opc_id)
.then((data) => {
this.data2 = data
console.log(this.data2)
this.notify('操作成功!', 'success')
})
.catch((err) => {
console.log(err.response.data.message)
})
},
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.configLoading = true
// 根据驱动类型判断是否为路由设备
const parentForm = this.parentForm
parentForm.is_route = true
parentForm.plc_id = this.plc_id
parentForm.opc_id = this.opc_id
updateConfig(parentForm, this.form, this.data1, this.data2)
.then((res) => {
this.notify('保存成功', 'success')
this.configLoading = false
})
.catch((err) => {
this.configLoading = false
console.log(err.response.data.message)
})
}
})
},
sliceItem() {
// 拼接DB的Item值
this.data1.forEach((item) => {
const str = item.code
// 是否包含.
if (str.search('.') !== -1) {
// 截取最后一位
item.code =
this.opc_code +
'.' +
this.plc_code +
'.' +
this.device_code +
'.' +
str.slice(str.lastIndexOf('.') + 1)
} else {
item.code =
this.opc_code +
'.' +
this.plc_code +
'.' +
this.device_code +
'.' +
item.code
}
})
this.data2.forEach((item) => {
const str = item.code
// 是否包含.
if (str.search('.') !== -1) {
// 截取最后一位
item.code =
this.opc_code +
'.' +
this.plc_code +
'.' +
this.device_code +
'.' +
str.slice(str.lastIndexOf('.') + 1)
} else {
item.code =
this.opc_code +
'.' +
this.plc_code +
'.' +
this.device_code +
'.' +
item.code
}
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -82,7 +82,7 @@
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '90' THEN '3'
END AS sub_type,
DATEDIFF( NOW(), ivt.instorage_time ) AS stock_age
DATEDIFF( NOW(), sub.date_of_production ) AS stock_age
FROM
ST_IVT_StructIvt ivt

View File

@@ -296,6 +296,8 @@ public class OutBillQueryServiceImpl implements OutBillQueryService {
mp.put("净重", json.getString("net_weight"));
mp.put("单位", json.getString("qty_unit_name"));
mp.put("管件类型", json.getString("paper_type"));
mp.put("管件编码", json.getString("paper_code"));
mp.put("管件描述", json.getString("paper_name"));
mp.put("客户编码", json.getString("customer_name"));
mp.put("发货客户名称", json.getString("customer_description"));
if (ObjectUtil.isEmpty(json.getString("sale_order_name"))) {