This commit is contained in:
USER-20220102CG\noblelift
2023-02-22 15:54:29 +08:00
parent 7e080cc8f9
commit 0414ee3180
15 changed files with 161 additions and 855 deletions

View File

@@ -880,60 +880,11 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (!StrUtil.isEmpty(hasGoodStatus)) {
standardOrdinarySiteDeviceDriver.setHasGoods(Integer.parseInt(hasGoodStatus));
device.setHas_goods(Integer.parseInt(hasGoodStatus));
}
if (StrUtil.isNotEmpty(material_type)) {
standardOrdinarySiteDeviceDriver.setMaterial(material_type);
device.setMaterial_type(material_type);
} else {
standardOrdinarySiteDeviceDriver.setMaterial("");
device.setMaterial_type("");
}
if (StrUtil.isNotEmpty(quantity)) {
standardOrdinarySiteDeviceDriver.setQty(quantity);
device.setQuantity(quantity);
} else {
standardOrdinarySiteDeviceDriver.setQty("");
device.setQuantity("");
}
if (StrUtil.isNotEmpty(remark)) {
standardOrdinarySiteDeviceDriver.setRemark(remark);
device.setRemark(remark);
} else {
standardOrdinarySiteDeviceDriver.setRemark("");
device.setRemark("");
}
if (StrUtil.isNotEmpty(batch)) {
standardOrdinarySiteDeviceDriver.setBatch(batch);
device.setBatch(batch);
} else {
standardOrdinarySiteDeviceDriver.setBatch("");
device.setBatch("");
}
WQLObject runpointwo = WQLObject.getWQLObject("acs_device_runpoint");
JSONObject json = runpointwo.query("device_code ='" + device_code + "'").uniqueResult(0);
if (!ObjectUtil.isEmpty(json)) {
DeviceRunpointDto obj = json.toJavaObject(DeviceRunpointDto.class);
obj.setHasgoods(hasGoodStatus);
obj.setMaterial_type(material_type);
obj.setBatch(batch);
device.setHas_goods(Integer.parseInt(hasGoodStatus));
device.setMaterial_type(material_type);
device.setRemark(remark);
device.setQuantity(quantity);
device.setBatch(batch);
device.setIslock(islock);
JSONObject updatejson = (JSONObject) JSONObject.toJSON(obj);
runpointwo.update(updatejson, "device_code = '" + device_code + "'");
}
standardOrdinarySiteDeviceDriver.setDeviceStatus(form);
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.setMaterial(material_type);
standardInspectSiteDeviceDriver.setBatch(batch);
device.setMaterial_type(material_type);
device.setBatch(batch);
standardInspectSiteDeviceDriver.setDeviceStatus(form);
} else if (device.getDeviceDriver() instanceof SlitTwoManipulatorDeviceDriver) {
slitTwoManipulatorDeviceDriver = (SlitTwoManipulatorDeviceDriver) device.getDeviceDriver();
slitTwoManipulatorDeviceDriver.setDeviceStatus(form);

View File

@@ -26,6 +26,9 @@ import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.task.service.impl.TaskServiceImpl;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.wql.util.SpringContextHolder;
@@ -40,6 +43,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
ParamService ParamService = SpringContextHolder.getBean(ParamService.class);
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
@@ -77,8 +81,10 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (carno != 0) {
agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno));
}
TaskDto task = null;
if (ikey != 0) {
inst = instructionService.findByCodeFromCache(String.valueOf(ikey));
task = taskService.findByTaskCode(inst.getTask_code());
}
@@ -158,20 +164,22 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if(ObjectUtil.isNotEmpty(this.device.getExtraValue().get("wait"))
&& StrUtil.equals("true",this.device.getExtraValue().get("wait").toString())){
&& StrUtil.equals("true",this.device.getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(),"1")){
//
if(standardOrdinarySiteDeviceDriver.getOption() == 1 ){
if(standardOrdinarySiteDeviceDriver.getOption() == 1){
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
log.info("等待LMS系统进行确认允许取货设备号{}", device_code);
logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号"+device.getDevice_code());
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
this.setPhase(phase);
} else if (device.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver){
photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) device.getDeviceDriver();
if(photoelectricInspectionSiteDeviceDriver.getMove() == 1)
@@ -220,7 +228,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if(ObjectUtil.isNotEmpty(this.device.getExtraValue().get("wait"))
&& StrUtil.equals("true",this.device.getExtraValue().get("wait").toString())){
&& StrUtil.equals("true",this.device.getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(),"1")){
//
standardOrdinarySiteDeviceDriver.setOption(0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
@@ -229,9 +238,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
this.setPhase(phase);
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
@@ -271,20 +279,21 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if(ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait"))
&& StrUtil.equals("true",standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())){
&& StrUtil.equals("true",standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(),"1")){
//
if(standardOrdinarySiteDeviceDriver.getOption() == 1 ){
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
log.info("等待LMS系统进行确认允许取货设备号{}", device_code);
logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号"+device.getDevice_code());
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
this.setPhase(phase);
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
@@ -327,7 +336,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if(ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait"))
&& StrUtil.equals("true",standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())){
&& StrUtil.equals("true",standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(),"1")){
standardOrdinarySiteDeviceDriver.setOption(0);
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
@@ -353,6 +363,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
weight = agvaddr;
inst.setWeight(String.valueOf(weight));
instructionService.update(inst);
if(ObjectUtil.isNotEmpty(task)){
logServer.deviceExecuteLog(this.device_code, "", "", "上报满卷重量,weight:" + weight);
task.setWeight(String.valueOf(weight));
taskService.update(task);
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
}
@@ -392,18 +408,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
//请求放空 可以直接走
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
// if(ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait"))
// && StrUtil.equals("true",standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())){
// //
// if(standardOrdinarySiteDeviceDriver.getOption() == 1 ){
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
// standardOrdinarySiteDeviceDriver.setOption(0);
// } else {
// log.info("等待LMS系统进行确认离开设备号{}", device_code);
// }
// } else {
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
// }
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
@@ -455,7 +460,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if(ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait"))
&& StrUtil.equals("true",standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())){
&& StrUtil.equals("true",standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(),"1")){
//
if(standardOrdinarySiteDeviceDriver.getOption() == 2 ){
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
@@ -467,9 +473,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
this.setPhase(phase);
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
@@ -511,7 +515,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if(ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait"))
&& StrUtil.equals("true",standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())){
&& StrUtil.equals("true",standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(),"1")){
//
if(standardOrdinarySiteDeviceDriver.getOption() == 2 ){
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
@@ -523,9 +528,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
this.setPhase(phase);
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
@@ -567,7 +571,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if(ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait"))
&& StrUtil.equals("true",standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())){
&& StrUtil.equals("true",standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(),"1")){
//
if(standardOrdinarySiteDeviceDriver.getOption() == 2 ){
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
@@ -579,9 +584,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
this.setPhase(phase);
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}

View File

@@ -231,6 +231,19 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "读取信号值时出现异常:" + var17.getMessage());
}
if("true".equals(this.device.getExtraValue().get("ship_device_update"))){
if(ObjectUtil.equal(this.getDevice().getExtraValue().get("noIdleRequest"),"true")){
if (!requiresShipDeviceUpdate && move == 0) {
this.shipDeviceUpdate();
}
} else {
if (mode ==2 && !requiresShipDeviceUpdate && move == 0) {
this.shipDeviceUpdate();
}
}
}
if (mode == 0) {
this.setIsonline(false);
message = "未联机";
@@ -247,7 +260,6 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
Instruction instruction = null;
List toInstructions;
switch (mode) {
case 1:
log.debug("设备运转模式:等待工作");
@@ -257,11 +269,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
if (move > 0 && !requireSucess) {
instruction_require();
}
if (!requiresShipDeviceUpdate && move == 0) {
this.shipDeviceUpdate();
} else {
this.requiresShipDeviceUpdate = true;
}
break;
case 4:
//申请捆扎

View File

@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.basedriver.standard_ordinary_site;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
@@ -229,13 +230,17 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
jo.put("error", this.getError());
jo.put("isError", this.getIserror());
jo.put("option", option);
jo.put("is_click", true);
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
String flag = data.getString("option");
if(StrUtil.isNotEmpty(flag)){
option = Integer.parseInt(flag);
}
}
}

View File

@@ -748,32 +748,64 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
JSONArray datas = JSONArray.parseArray(whereJson);
log.info("updateTask--------------:输入参数" + datas.toString());
JSONObject map = new JSONObject();
JSONArray errArr = new JSONArray();
if (datas.size() > 0) {
for (int i = 0; i < datas.size(); i++) {
JSONObject jsonObject = datas.getJSONObject(i);
String device_code = jsonObject.getString("device_code");
String task_code = jsonObject.getString("task_code");
TaskDto task= taskService.findByTaskCode(task_code);
if(ObjectUtil.isEmpty(task)){
JSONObject resultJson = new JSONObject();
resultJson.put("status", HttpStatus.BAD_REQUEST);
resultJson.put("message", "未找到对应的任务:"+task_code);
return resultJson;
}
//1-允许取放; 2-允许离开
String option = jsonObject.getString("option");
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
Device device_k = deviceAppService.findDeviceByCode(device_code+"_K");
Device device_m = deviceAppService.findDeviceByCode(device_code+"_M");
if(device_k.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_k.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
}
if(device_m.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_m.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
}
if(StrUtil.equals(task.getTask_type(),"1")){
Device device_k = deviceAppService.findDeviceByCode(device_code+"_K");
Device device_m = deviceAppService.findDeviceByCode(device_code+"_M");
if(device_k.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_k.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
}
if(device_m.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_m.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
}
} else if (StrUtil.equals(task.getTask_type(),"2")){
if(task.getStart_device_code().endsWith("K")){
Device device_k = deviceAppService.findDeviceByCode(device_code+"_K");
if(device_k.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_k.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
}
} else if(task.getStart_device_code().endsWith("M")){
Device device_m = deviceAppService.findDeviceByCode(device_code+"_M");
if(device_m.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_m.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
}
}
}
}
}
JSONObject resultJson = new JSONObject();
resultJson.put("status", HttpStatus.OK);
resultJson.put("message", "操作成功");
resultJson.put("data", map);
if (ObjectUtil.isEmpty(errArr)) {
resultJson.put("status", HttpStatus.OK);
} else {
resultJson.put("status", HttpStatus.BAD_REQUEST);
resultJson.put("message", "操作成功");
if(ObjectUtil.isNotEmpty(errArr)){
resultJson.put("errArr",errArr);
}
}
return resultJson;
}

View File

@@ -187,6 +187,8 @@ public class DeviceOpcProtocolRunable implements Runnable {
log.info("信号{}变更从{}->{};信号快照:{}", new Object[]{item.getId(), his, value, sb});
}
// accessor_value.setValueWithPersistence(item.getId(),accessor_value.getValue(item.getId()));
// accessor_value.getHistoryUnifiedData(item.getId());
//设置值
accessor_value.setValue(item.getId(), value);

View File

@@ -76,6 +76,15 @@ public interface TaskService {
*/
TaskDto findById(String task_id);
/**
* 根据ID查询
*
* @param task_code
* @return AcsTask
*/
TaskDto findByTaskCode(String task_code);
/**
* 查询所有未完成任务
*

View File

@@ -106,9 +106,6 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
// WQLObject wo = WQLObject.getWQLObject("acs_task");
// ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "task_status < 2 ", "update_time
// desc");
HashMap<String, String> map = new HashMap<>();
map.put("flag", "1");
String task_code = (String) whereJson.get("task_code");
@@ -142,9 +139,6 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
@Override
public Map<String, Object> queryAllByCache(Map whereJson, Pageable page) {
this.reload();
String task_code = (String) whereJson.get("task_code");
String vehicle_code = (String) whereJson.get("vehicle_code");
@@ -281,6 +275,21 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
return obj;
}
@Override
public TaskDto findByTaskCode(String task_code) {
List<TaskDto> list = new ArrayList<>();
Iterator<TaskDto> iterator = tasks.iterator();
while (iterator.hasNext()) {
TaskDto task = iterator.next();
if (StrUtil.equals(task.getTask_code(),task_code)) {
return task;
}
}
return null;
}
@Override
public List<TaskDto> queryAllUnfinished(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("acs_task");
@@ -477,49 +486,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {}
} else {
// 判断起点为输送设备
if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {}
if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {
// if (nextdevice.getDeviceDriver() instanceof
// StandardOrdinarySiteDeviceDriver) {
// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver)
// nextdevice.getDeviceDriver();
// if (nextdevice.getHas_goods() != 0) {
// throw new Exception("任务终点需满足无货!");
// }
// }
JSONObject jo = new JSONObject();
JSONObject jo2 = new JSONObject();
if (!StrUtil.isEmpty(dto.getMaterial())) {
if (!StrUtil.equals(dto.getMaterial(), "1")) {
jo.put("hasGoodStatus", "2");
jo.put("material_type", dto.getMaterial());
} else {
jo.put("hasGoodStatus", "1");
jo.put("material_type", "1");
}
} else {
jo.put("hasGoodStatus", "1");
jo.put("material_type", "1");
}
jo.put("device_code", dto.getStart_device_code());
jo.put("quantity", dto.getQuantity());
jo.put("remark", dto.getRemark());
jo.put("batch", startdevice.getBatch());
jo.put("islock", "true");
deviceService.changeDeviceStatus(jo);
Device deviceByCode = deviceAppService.findDeviceByCode(dto.getNext_device_code());
jo2.put("device_code", dto.getNext_device_code());
jo2.put("hasGoodStatus", deviceByCode.getHas_goods());
jo2.put("quantity", deviceByCode.getQuantity());
jo2.put("remark", deviceByCode.getRemark());
jo2.put("material_type", deviceByCode.getMaterial_type());
jo2.put("batch", deviceByCode.getBatch());
jo2.put("islock", "true");
deviceService.changeDeviceStatus(jo2);
}
}
WQLObject wo = WQLObject.getWQLObject("acs_task");
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
@@ -693,6 +660,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
feed_jo.put("task_id", entity.getExt_task_id());
feed_jo.put("task_code", dto.getTask_code());
feed_jo.put("task_status", dto.getTask_status());
if(ObjectUtil.isNotEmpty(dto.getWeight())){
feed_jo.put("weight",dto.getWeight());
}
JSONArray ja = new JSONArray();
ja.add(feed_jo);
String message = null;

View File

@@ -174,7 +174,7 @@ https://juejin.cn/post/6844903775631572999
<!--生产环境:打印控制台和输出到文件-->
<springProfile name="prod">
<root level="info">
<root level="debug">
<appender-ref ref="ERROR"/>
<appender-ref ref="lokiAppender" />
<appender-ref ref="asyncFileAppender"/>

View File

@@ -84,8 +84,8 @@
<el-row>
<el-col :span="8">
<el-form-item label="呼叫">
<el-switch v-model="form.apply_task" />
<el-form-item label="无需待机反馈">
<el-switch v-model="form.noIdleRequest" />
</el-form-item>
</el-col>
<el-col :span="8">

View File

@@ -25,7 +25,7 @@
<el-row>
<el-col :span="8">
<el-form-item label="检验有货">
<el-switch v-model="form.inspect_in_stocck" />
<el-switch v-model="form.inspect_in_stock" />
</el-form-item>
</el-col>
<el-col :span="8">

View File

@@ -136,10 +136,10 @@
</el-form-item>
<el-form-item label="设备状态" label-width="80px">
<el-radio-group v-model="form.hasGoodStatus">
<el-radio-button :label="0">无货</el-radio-button>
<el-radio-button :label="1">有托盘</el-radio-button>
<el-radio-button :label="2">有托盘有货</el-radio-button>
<el-radio-group v-model="form.option">
<el-radio-button :label="0">禁止进出</el-radio-button>
<el-radio-button :label="1">允许进入</el-radio-button>
<el-radio-button :label="2">允许离开</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
@@ -398,9 +398,6 @@ export default {
} else if (val === 'requestSucess') {
const obj = { name: '缺料请求成功', value: data[val] }
arr.push(obj)
} else if (val === 'fullrequestSucess') {
const obj = { name: '空箱请求成功', value: data[val] }
arr.push(obj)
} else if (val === 'applySucess') {
const obj = { name: '是否申请指令', value: data[val] }
arr.push(obj)
@@ -413,9 +410,6 @@ export default {
} else if (val === 'option') {
const obj = { name: 'AGV动作', value: data[val] }
arr.push(obj)
} else if (val === 'full_ready_req_agv') {
const obj = { name: '满箱位就绪请求AGV', value: data[val] }
arr.push(obj)
} else if (val === 'temperature') {
const obj = { name: '当前温度', value: data[val] }
arr.push(obj)
@@ -437,54 +431,12 @@ export default {
} else if (val === 'door') {
const obj = { name: '门状态', value: data[val] }
arr.push(obj)
} else if (val === 'storage_stock_num') {
const obj = { name: '储料仓库存数量', value: data[val] }
arr.push(obj)
} else if (val === 'line_stock_num') {
const obj = { name: '线体库存数量', value: data[val] }
arr.push(obj)
} else if (val === 'order_prod_allnum') {
const obj = { name: '订单生产总量', value: data[val] }
arr.push(obj)
} else if (val === 'order') {
const obj = { name: '工单号', value: data[val] }
arr.push(obj)
} else if (val === 'storage_stock_num') {
const obj = { name: '储料仓库存数量', value: data[val] }
arr.push(obj)
} else if (val === 'line_stock_num') {
const obj = { name: '线体库存数量', value: data[val] }
arr.push(obj)
} else if (val === 'material_type') {
const obj = { name: '产品编号', value: data[val] }
arr.push(obj)
} else if (val === 'lack_req') {
const obj = { name: '缺料请求', value: data[val] }
arr.push(obj)
} else if (val === 'empty_req') {
const obj = { name: '空箱请求', value: data[val] }
arr.push(obj)
} else if (val === 'address') {
const obj = { name: 'agv位置', value: data[val] }
arr.push(obj)
} else if (val === 'phaseName') {
const obj = { name: 'phase', value: data[val] }
arr.push(obj)
} else if (val === 'full_req') {
const obj = { name: '满箱请求', value: data[val] }
arr.push(obj)
} else if (val === 'open_time') {
const obj = { name: '开机时间', value: data[val] }
arr.push(obj)
} else if (val === 'close_time') {
const obj = { name: '关机时间', value: data[val] }
arr.push(obj)
} else if (val === 'feeding_qty') {
const obj = { name: '上料数量', value: data[val] }
arr.push(obj)
} else if (val === 'error_num') {
const obj = { name: '故障次数', value: data[val] }
arr.push(obj)
} else if (val === 'is_disable') {
const obj = { name: '是否禁用', value: data[val] }
arr.push(obj)

View File

@@ -1,631 +0,0 @@
<template>
<div class="monitor-wrap">
<el-row style="margin-top: 20px;margin-left: 20px;margin-bottom: 20px">
<el-col :span="6" />
<el-col :span="18">
<!-- 舞台:
<el-select v-model="stage_code" placeholder="请选择" @change="changeStage">
<el-option
v-for="item in stageSelectList"
:key="item.stage_code"
:label="item.stage_name"
:value="item.stage_code">
</el-option>
</el-select>
<el-button type="primary" @click="saveAll" :loading="saveLoading">保存</el-button>
<el-button type="success" @click="cleanArr2">清空</el-button>-->
<!-- <el-button type="info">操作</el-button>-->
</el-col>
</el-row>
<el-row>
<el-col :span="1" style="margin-left: 10px">
<div>
<!-- <draggable :list="arr1" animation="300"
dragClass="dragClass"
ghostClass="ghostClass"
chosenClass="chosenClass"
@start="onStart"
@end="onEnd"
:move="onMove"
:group="{ name:'group', pull:'clone', put:false}"
>
&lt;!&ndash;vue中引入图片https://blog.csdn.net/qq_35393869/article/details/80333564&ndash;&gt;
<div v-for="(item,index) in arr1" :key="index"
style="position: relative; width: 34px;height: 34px;display: inline-block;margin: 0 0 0 0 ;vertical-align:bottom;outline: 1px solid #f0f0f0;">
<img :src="require('../../../../assets/acs/' +item.img1+'.png')" alt="" width="34px" height="34px;"
style="margin: 0 0 0 0;vertical-align:bottom;transform: rotate(0deg);"/>
</div>
</draggable>-->
</div>
</el-col>
<el-col :span="22" style="margin-left: 30px">
<el-scrollbar style="width:1850px;height: 1050px;">
<!--使用draggable组件-->
<draggable
:list="arr2"
group="group"
animation="300"
filter=".forbid"
:style="'width:'+ grid_width +'px;'"
>
<div
v-for="(item) in arr2"
:key="item.index"
class="forbid"
style="position: relative; width: 34px;height: 34px;display: inline-block;margin: 0 0 0 0 ;vertical-align:bottom;"
@click="clickDevice(item)"
>
<el-popover
v-if="currentItem == item.index"
:ref="'pop_'+item.index"
placement="bottom"
effect="dark"
trigger="manual"
:value="currentItem == item.index"
:disabled="item.device_code == ''"
:popper-class="isErrorColor(item)"
>
<div v-if="item.device_code !== ''" style="height: 390px;overflow-y: auto">
<div style="padding: 3px;">
设备信息
</div>
<el-table
:data="moveShow(item)"
style="width: 100%"
>
<af-table-column
prop="name"
label="监控项"
/>
<af-table-column
prop="value"
label="当前值"
/>
</el-table>
</div>
</el-popover>
<div v-popover="'pop_'+item.index" class="content" @mouseover="changeCurrentTime(item)">
<img
:src="require('../../../../assets/acs/' +item.img2+'.png')"
alt=""
width="34px"
height="34px;"
:style="{ transform:' rotate('+item.angle+'deg)' }"
style="outline: 1px solid #f0f0f0;"
>
<img
v-if="hasGoods(item) && item.img2!='1' "
:src="require('../../../../assets/acs/' +'托盘'+'.png')"
style="position: absolute; top: 5px;right: 5px;width: 24px;height: 24px;"
>
<img
v-if="statusPic(item) && item.img2!='1'"
:src="require('../../../../assets/acs/' +'status0'+'.png')"
style="position: absolute; top: 0;left: 0;"
>
<img
v-if="!statusPic(item) && item.img2!='1' && item.device_code"
:src="require('../../../../assets/acs/' +'status1'+'.png')"
style="position: absolute; top: 0;left: 0;"
>
<img
v-if="isError(item)"
:src="require('../../../../assets/acs/' +'icon_alert'+'.png')"
style="position: absolute; top: 5px;right: 5px;width: 23px;height: 23px;"
>
</div>
</div>
</draggable>
</el-scrollbar>
</el-col>
</el-row>
<!--弹窗设置设备与图标绑定与角度-->
<el-dialog title="设备设置" :visible.sync="dialogFormVisible" width="35%">
<el-form :model="form" size="small">
<el-form-item label="设备编号" prop="device_code" label-width="80px">
<el-input v-model="form.device_code" :disabled="true" />
</el-form-item>
<el-form-item label="设备状态" label-width="80px">
<el-radio-group v-model="form.hasGoodStatus">
<el-radio-button :label="0">无货</el-radio-button>
<el-radio-button :label="1">有托盘</el-radio-button>
<el-radio-button :label="2">有托盘有货</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="dialogSave"> </el-button>
</div>
</el-dialog>
<!--弹窗设置设备与图标绑定与角度-->
<el-dialog title="设备设置" :visible.sync="dialogFormVisible3" width="35%">
<el-form :model="form" size="small">
<el-form-item label="设备编号" prop="device_code" label-width="80px">
<el-input v-model="form.device_code" :disabled="true" />
</el-form-item>
<el-form-item label="设备状态" label-width="80px">
<el-radio-group v-model="form.hasGoodStatus">
<el-radio-button :label="0">无货</el-radio-button>
<el-radio-button :label="1">空料斗</el-radio-button>
<el-radio-button :label="2">满料斗</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="物料编码" prop="material_type" label-width="80px">
<el-input v-model="form.material_type" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible3 = false"> </el-button>
<el-button type="primary" @click="dialogSave"> </el-button>
</div>
</el-dialog>
<!--弹窗设置设备与图标绑定与角度-->
<el-dialog title="设备设置" :visible.sync="dialogFormVisible4" width="35%">
<el-form :model="form" size="small">
<el-form-item label="设备编号" prop="device_code" label-width="120px">
<el-input v-model="form.device_code" :disabled="true" />
</el-form-item>
<el-form-item label="缺料请求成功" prop="requireSucess" label-width="120px">
<el-radio-group v-model="form.requireSucess">
<el-radio-button :label="0"></el-radio-button>
<el-radio-button :label="1"></el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="空想请求成功" prop="fullrequireSucess" label-width="120px">
<el-radio-group v-model="form.fullrequireSucess">
<el-radio-button :label="0"></el-radio-button>
<el-radio-button :label="1"></el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible4 = false"> </el-button>
<el-button type="primary" @click="dialogSave"> </el-button>
</div>
</el-dialog>
<!--弹窗设置设备与图标绑定与角度-->
<el-dialog title="设备设置" :visible.sync="dialogFormVisible1" width="35%">
<el-form :model="form" size="small">
<el-form-item label="设备编号" prop="device_code" label-width="80px">
<el-input v-model="form.device_code" :disabled="true" />
</el-form-item>
<el-form-item label="条码" label-width="80px">
<el-input v-model="form.barcode" :disabled="false" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible1 = false"> </el-button>
<el-button type="primary" @click="saveBarcode"> </el-button>
</div>
</el-dialog>
<XJDeviceMonitor ref="child1" />
</div>
</template>
<script>
// 导入draggable组件
import deviceCrud from '@/api/acs/device/device'
import draggable from 'vuedraggable'
import crud from '@/mixins/crud'
import actorCrud from '@/api/acs/stage/actor'
import XJDeviceMonitor from '@/views/acs/monitor/device/XJDeviceMonitor'
export default {
name: 'MonitorDevice',
// 注册draggable组件
components: {
draggable, XJDeviceMonitor
},
mixins: [crud],
data() {
return {
stage_code: '',
dialogFormVisible: false,
dialogFormVisible1: false,
dialogFormVisible2: false,
dialogFormVisible3: false,
dialogFormVisible4: false,
arr2: [],
currentItem: '',
stageSelectList: [],
deviceList: [],
form: {
index: 0,
device_code: '',
angle: 0,
hasGoodStatus: null,
barcode: '',
suspended: null,
material_type: '',
requireSucess: '',
fullrequireSucess: ''
},
grid_width: 1000
}
},
created() {
this.initArr2()
this.webSocket()
},
methods: {
clickDevice(item) {
// debugger
const index = item.index
const clickObj = this.arr2[index]
console.log(clickObj.data)
if (!clickObj.img2 || clickObj.img2 === '1' || !item.data) {
return
}
if (clickObj.data.is_click !== true) {
return
}
if (clickObj.data.device_type === 'scanner') {
this.dialogFormVisible1 = true
} else {
if (clickObj.data.driver_type === 'hailiang_engraving_cache') {
this.dialogFormVisible3 = true
} else if (clickObj.data.driver_type === 'hailiang_packer_station') {
this.dialogFormVisible4 = true
} else if (clickObj.data.driver_type === 'hailiang_xj_plc_test') {
this.$refs.child1.setForm(clickObj)
} else {
this.dialogFormVisible = true
}
}
this.form.angle = clickObj.angle
this.form.index = clickObj.index
this.form.device_code = clickObj.device_code
this.form.hasGoodStatus = clickObj.data.hasGoods
this.form.material_type = clickObj.data.material_type
this.form.requireSucess = clickObj.data.requireSucess
this.form.fullrequireSucess = clickObj.data.fullrequireSucess
},
hasGoods(item) {
if (item.data && item.data.hasGoods > 0) {
return true
}
return false
},
statusPic(item) {
if (item.data && item.data.isOnline === true) {
return true
}
return false
},
isError(item) {
if (item.data && item.data.isError === true) {
return true
}
return false
},
isErrorColor(item) {
if (item.data && item.data.isError === true) {
return 'error'
}
return 'normal'
},
changeCurrentTime(item) {
this.currentItem = item.index
},
moveShow(item) {
// debugger
if (item.device_code && item.data) {
const arr = [
{ name: '设备编号', value: item.device_code },
{ name: '设备名称', value: item.device_name }
]
const data = item.data
for (const val in data) {
if (val === 'isOnline' || val === 'isError' || val === 'hasGoods') {
continue
}
if (val === 'message' && data.isError === true) {
const obj = { name: '设备信息', value: data[val] }
arr.push(obj)
}
if (val === 'message' && data.isError === 'false') {
const obj = { name: '异常信息', value: data[val] }
arr.push(obj)
}
if (val === 'move') {
const obj = { name: '光电信号', value: data[val] }
arr.push(obj)
} else if (val === 'mode') {
const obj = { name: '模式', value: data[val] }
arr.push(obj)
} else if (val === 'error') {
const obj = { name: '报警', value: data[val] }
arr.push(obj)
} else if (val === 'ip') {
const obj = { name: 'IP地址', value: data[val] }
arr.push(obj)
} else if (val === 'number') {
const obj = { name: '托盘数量', value: data[val] }
arr.push(obj)
} else if (val === 'qty') {
const obj = { name: '数量', value: data[val] }
arr.push(obj)
} else if (val === 'weight') {
const obj = { name: '重量', value: data[val] }
arr.push(obj)
} else if (val === 'instruction_message') {
const obj = { name: '指令信息', value: data[val] }
arr.push(obj)
} else if (val === 'last_instruction_message') {
const obj = { name: '上次指令信息', value: data[val] }
arr.push(obj)
} else if (val === 'container') {
const obj = { name: '载具号', value: data[val] }
arr.push(obj)
} else if (val === 'last_container') {
const obj = { name: '上次载具号', value: data[val] }
arr.push(obj)
} else if (val === 'instruction_code') {
const obj = { name: '指令号', value: data[val] }
arr.push(obj)
} else if (val === 'last_instruction_code') {
const obj = { name: '上次指令号', value: data[val] }
arr.push(obj)
} else if (val === 'action') {
const obj = { name: '动作信号', value: data[val] }
arr.push(obj)
} else if (val === 'io_action') {
const obj = { name: '允许进出信号', value: data[val] }
arr.push(obj)
} else if (val === 'material') {
const obj = { name: '物料', value: data[val] }
arr.push(obj)
} else if (val === 'batch') {
const obj = { name: '批次', value: data[val] }
arr.push(obj)
} else if (val === 'requestSucess') {
const obj = { name: '缺料请求成功', value: data[val] }
arr.push(obj)
} else if (val === 'fullrequestSucess') {
const obj = { name: '空箱请求成功', value: data[val] }
arr.push(obj)
} else if (val === 'applySucess') {
const obj = { name: '是否申请指令', value: data[val] }
arr.push(obj)
} else if (val === 'message') {
const obj = { name: '说明', value: data[val] }
arr.push(obj)
} else if (val === 'empty_is_lack') {
const obj = { name: '空箱位缺箱', value: data[val] }
arr.push(obj)
} else if (val === 'empty_is_finish') {
const obj = { name: '空位完成', value: data[val] }
arr.push(obj)
} else if (val === 'full_ready_req_agv') {
const obj = { name: '满箱位就绪请求AGV', value: data[val] }
arr.push(obj)
} else if (val === 'full_out') {
const obj = { name: '满箱已运出满箱位', value: data[val] }
arr.push(obj)
} else if (val === 'finish') {
const obj = { name: '烘箱完成', value: data[val] }
arr.push(obj)
} else if (val === 'countdown_house') {
const obj = { name: '恒温倒计时(时)', value: data[val] }
arr.push(obj)
} else if (val === 'countdown_min') {
const obj = { name: '恒温倒计时(分)', value: data[val] }
arr.push(obj)
} else if (val === 'countdown_sec') {
const obj = { name: '恒温倒计时(秒)', value: data[val] }
arr.push(obj)
} else if (val === 'door') {
const obj = { name: '门状态', value: data[val] }
arr.push(obj)
} else if (val === 'order_compel_finish') {
const obj = { name: '订单强制完成', value: data[val] }
arr.push(obj)
} else if (val === 'now_order_prod_num') {
const obj = { name: '当前生产总量', value: data[val] }
arr.push(obj)
} else if (val === 'now_one_prod_num') {
const obj = { name: '当前箱生产量', value: data[val] }
arr.push(obj)
} else if (val === 'task') {
const obj = { name: '任务号', value: data[val] }
arr.push(obj)
} else if (val === 'full_number') {
const obj = { name: '出料口满框数量', value: data[val] }
arr.push(obj)
} else if (val === 'storage_stock_num') {
const obj = { name: '储料仓库存数量', value: data[val] }
arr.push(obj)
} else if (val === 'line_stock_num') {
const obj = { name: '线体库存数量', value: data[val] }
arr.push(obj)
} else if (val === 'order_prod_allnum') {
const obj = { name: '订单生产总量', value: data[val] }
arr.push(obj)
} else if (val === 'order') {
const obj = { name: '工单号', value: data[val] }
arr.push(obj)
} else if (val === 'storage_stock_num') {
const obj = { name: '储料仓库存数量', value: data[val] }
arr.push(obj)
} else if (val === 'line_stock_num') {
const obj = { name: '线体库存数量', value: data[val] }
arr.push(obj)
} else if (val === 'material_type') {
const obj = { name: '产品编号', value: data[val] }
arr.push(obj)
} else if (val === 'lack_req') {
const obj = { name: '缺料请求', value: data[val] }
arr.push(obj)
} else if (val === 'empty_req') {
const obj = { name: '空箱请求', value: data[val] }
arr.push(obj)
} else if (val === 'address') {
const obj = { name: 'agv位置', value: data[val] }
arr.push(obj)
} else if (val === 'phaseName') {
const obj = { name: 'phase', value: data[val] }
arr.push(obj)
} else if (val === 'full_req') {
const obj = { name: '满箱请求', value: data[val] }
arr.push(obj)
} else if (val === 'open_time') {
const obj = { name: '开机时间', value: data[val] }
arr.push(obj)
} else if (val === 'close_time') {
const obj = { name: '关机时间', value: data[val] }
arr.push(obj)
} else if (val === 'feeding_qty') {
const obj = { name: '上料数量', value: data[val] }
arr.push(obj)
} else if (val === 'error_num') {
const obj = { name: '故障次数', value: data[val] }
arr.push(obj)
} else if (val === 'is_disable') {
const obj = { name: '是否禁用', value: data[val] }
arr.push(obj)
}
}
return arr
}
},
dialogSave() {
deviceCrud.changeDeviceStatus(this.form).then(res => {
this.notify('操作成功', 'success')
this.dialogFormVisible = false
this.dialogFormVisible3 = false
this.dialogFormVisible4 = false
this.initArr2()
}).catch(err => {
this.dialogFormVisible = false
this.dialogFormVisible3 = false
this.dialogFormVisible4 = false
console.log(err.response.data.message)
})
},
statusSave() {
deviceCrud.changeFenceStatus(this.form).then(res => {
this.notify('操作成功', 'success')
this.dialogFormVisible2 = false
this.initArr2()
}).catch(err => {
this.dialogFormVisible2 = false
console.log(err.response.data.message)
})
},
saveBarcode() {
deviceCrud.saveBarcode(this.form).then(res => {
this.notify('操作成功', 'success')
this.dialogFormVisible1 = false
this.initArr2()
}).catch(err => {
this.dialogFormVisible1 = false
console.log(err.response.data.message)
})
},
initArr2() {
actorCrud.queryStageActor('SHDP').then(data => {
if (data.detail.length > 0) {
this.grid_width = data.form.grid_width
this.arr2 = []
for (let i = 0; i < data.form.grid_length; i++) {
const a = { 'id': i, 'name': '', device_code: '', img: '', index: i, img2: '1', angle: '0' }
this.arr2.push(a)
}
for (const i of data.detail) {
const index = i.index
this.arr2.splice(index, 1, i)
}
}
}).catch(err => {
console.log(err.response.data.message)
})
},
webSocket() {
const that = this
if (typeof (WebSocket) === 'undefined') {
this.$notify({
title: '提示',
message: '当前浏览器无法接收实时报警信息,请使用谷歌浏览器!',
type: 'warning',
duration: 0
})
} else {
const id = 'device_monitor'
// 获取token保存到vuex中的用户信息此处仅适用于本项目注意删除或修改
// 实例化socket这里我把用户名传给了后台使后台能判断要把消息发给哪个用户其实也可以后台直接获取用户IP来判断并推送
// const wsUri = process.env.VUE_APP_WS_API + '/webSocket/' + id
const wsUri = window.g.prod.VUE_APP_BASE_API.replace('http', 'ws') + '/webSocket/' + id
this.socket = new WebSocket(wsUri)
// 监听socket打开
this.socket.onopen = function() {
console.log('浏览器WebSocket已打开')
// that.socket.send('测试客户端发送消息')
}
// 监听socket消息接收
this.socket.onmessage = function(msg) {
const list = JSON.parse(msg.data).msg.detail
// console.log(list)
for (const item of list) {
const index = item.index
// that.arr2.splice(index, 1, item)
if (item.data) {
Object.assign(that.arr2[index].data, item.data)
}
}
}
// 监听socket错误
this.socket.onerror = function() {
that.$notify({
title: '错误',
message: '服务器错误,无法接收实时报警信息',
type: 'error',
duration: 0
})
}
// 监听socket关闭
this.socket.onclose = function() {
console.log('WebSocket已关闭')
}
}
}
}
}
</script>
<style scoped>
.normal {
background: #4a659c !important;
}
.error {
background: #95341c !important;
}
</style>
<style>
.monitor-wrap .el-popover {
margin-left: 35px;
}
</style>

View File

@@ -7,6 +7,7 @@
<el-cascader
v-model="labelAndValue"
:options="labelsOptions"
filterable
placeholder="请选择标签"
checkStrictly
@change="queryData"

View File

@@ -37,10 +37,10 @@
</el-form-item>
<el-form-item label="设备状态" label-width="80px">
<el-radio-group v-model="form.hasGoodStatus">
<el-radio-button :label="0">无货</el-radio-button>
<el-radio-button :label="1">有托盘</el-radio-button>
<el-radio-button :label="2">有托盘有货</el-radio-button>
<el-radio-group v-model="form.option">
<el-radio-button :label="0">禁止进出</el-radio-button>
<el-radio-button :label="1">允许进入</el-radio-button>
<el-radio-button :label="2">允许离开</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
@@ -59,8 +59,8 @@
<el-form-item label="设备状态" label-width="80px">
<el-radio-group v-model="form.hasGoodStatus">
<el-radio-button :label="0">无货</el-radio-button>
<el-radio-button :label="1">空料斗</el-radio-button>
<el-radio-button :label="2">满料斗</el-radio-button>
<el-radio-button :label="1">有托盘</el-radio-button>
<el-radio-button :label="2">有托盘有货</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="物料编码" prop="material_type" label-width="80px">
@@ -153,7 +153,7 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible1 = false"> </el-button>
<el-button type="primary" @click="saveBarcode"> </el-button>
<el-button type=this"primary" @click="saveBarcode"> </el-button>
</div>
</el-dialog>
</div>
@@ -453,12 +453,15 @@ export default {
} else if (val === 'weight') {
const obj = { name: '重量', value: data[val] }
this.arr.push(obj)
} else if (val === 'tray_crib_qty') {
const obj = { name: '托盘垛数', value: data[val] }
this.arr.push(obj)
} else if (val === 'move_1') {
const obj = { name: '前工位光电信号', value: data[val] }
this.arr.push(obj)
} else if (val === 'phase') {
const obj = { name: 'AGV交互阶段', value: data[val] }
this.arr.push(obj)
} else if (val === 'option') {
const obj = { name: 'AGV动作', value: data[val] }
this.arr.push(obj)
} else if (val === 'move_2') {
const obj = { name: '后工位光电信号', value: data[val] }
this.arr.push(obj)