#
Junjie
8 天以前 466acbeed92a4f162132219052089bf4c494b90b
#
7个文件已修改
9个文件已添加
1016 ■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/DeviceConfigController.java 126 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/DeviceConfig.java 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/mapper/DeviceConfigMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/DeviceConfigService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/DeviceConfigServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/CodeBuilder.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/ServerBootstrap.java 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/cache/MessageQueue.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/enums/RedisKeyType.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/impl/NyShuttleThread.java 75 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/utils/DeviceMsgUtils.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 86 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/DeviceConfigMapper.xml 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/deviceConfig/deviceConfig.js 255 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/admin/deviceConfig/deviceConfig.html 116 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/admin/deviceConfig/deviceConfig_detail.html 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/DeviceConfigController.java
New file
@@ -0,0 +1,126 @@
package com.zy.asrs.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.core.common.DateUtils;
import com.zy.asrs.entity.DeviceConfig;
import com.zy.asrs.service.DeviceConfigService;
import com.core.annotations.ManagerAuth;
import com.core.common.BaseRes;
import com.core.common.Cools;
import com.core.common.R;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
@RestController
public class DeviceConfigController extends BaseController {
    @Autowired
    private DeviceConfigService deviceConfigService;
    @RequestMapping(value = "/deviceConfig/{id}/auth")
    @ManagerAuth
    public R get(@PathVariable("id") String id) {
        return R.ok(deviceConfigService.selectById(String.valueOf(id)));
    }
    @RequestMapping(value = "/deviceConfig/list/auth")
    @ManagerAuth
    public R list(@RequestParam(defaultValue = "1")Integer curr,
                  @RequestParam(defaultValue = "10")Integer limit,
                  @RequestParam(required = false)String orderByField,
                  @RequestParam(required = false)String orderByType,
                  @RequestParam(required = false)String condition,
                  @RequestParam Map<String, Object> param){
        EntityWrapper<DeviceConfig> wrapper = new EntityWrapper<>();
        excludeTrash(param);
        convert(param, wrapper);
        allLike(DeviceConfig.class, param.keySet(), wrapper, condition);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
        return R.ok(deviceConfigService.selectPage(new Page<>(curr, limit), wrapper));
    }
    private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){
        for (Map.Entry<String, Object> entry : map.entrySet()){
            String val = String.valueOf(entry.getValue());
            if (val.contains(RANGE_TIME_LINK)){
                String[] dates = val.split(RANGE_TIME_LINK);
                wrapper.ge(entry.getKey(), DateUtils.convert(dates[0]));
                wrapper.le(entry.getKey(), DateUtils.convert(dates[1]));
            } else {
                wrapper.like(entry.getKey(), val);
            }
        }
    }
    @RequestMapping(value = "/deviceConfig/add/auth")
    @ManagerAuth
    public R add(DeviceConfig deviceConfig) {
        deviceConfig.setCreateTime(new Date());
        deviceConfigService.insert(deviceConfig);
        return R.ok();
    }
    @RequestMapping(value = "/deviceConfig/update/auth")
    @ManagerAuth
    public R update(DeviceConfig deviceConfig){
        if (Cools.isEmpty(deviceConfig) || null==deviceConfig.getId()){
            return R.error();
        }
        deviceConfigService.updateById(deviceConfig);
        return R.ok();
    }
    @RequestMapping(value = "/deviceConfig/delete/auth")
    @ManagerAuth
    public R delete(@RequestParam(value="ids[]") Integer[] ids){
         for (Integer id : ids){
            deviceConfigService.deleteById(id);
        }
        return R.ok();
    }
    @RequestMapping(value = "/deviceConfig/export/auth")
    @ManagerAuth
    public R export(@RequestBody JSONObject param){
        EntityWrapper<DeviceConfig> wrapper = new EntityWrapper<>();
        List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
        Map<String, Object> map = excludeTrash(param.getJSONObject("deviceConfig"));
        convert(map, wrapper);
        List<DeviceConfig> list = deviceConfigService.selectList(wrapper);
        return R.ok(exportSupport(list, fields));
    }
    @RequestMapping(value = "/deviceConfigQuery/auth")
    @ManagerAuth
    public R query(String condition) {
        EntityWrapper<DeviceConfig> wrapper = new EntityWrapper<>();
        wrapper.like("id", condition);
        Page<DeviceConfig> page = deviceConfigService.selectPage(new Page<>(0, 10), wrapper);
        List<Map<String, Object>> result = new ArrayList<>();
        for (DeviceConfig deviceConfig : page.getRecords()){
            Map<String, Object> map = new HashMap<>();
            map.put("id", deviceConfig.getId());
            map.put("value", deviceConfig.getId());
            result.add(map);
        }
        return R.ok(result);
    }
    @RequestMapping(value = "/deviceConfig/check/column/auth")
    @ManagerAuth
    public R query(@RequestBody JSONObject param) {
        Wrapper<DeviceConfig> wrapper = new EntityWrapper<DeviceConfig>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val"));
        if (null != deviceConfigService.selectOne(wrapper)){
            return R.parse(BaseRes.REPEAT).add(getComment(DeviceConfig.class, String.valueOf(param.get("key"))));
        }
        return R.ok();
    }
}
src/main/java/com/zy/asrs/entity/DeviceConfig.java
New file
@@ -0,0 +1,94 @@
package com.zy.asrs.entity;
import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.annotations.TableField;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;
@Data
@TableName("rcs_device_config")
public class DeviceConfig implements Serializable {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value= "")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    /**
     * 设备ip
     */
    @ApiModelProperty(value= "设备ip")
    private String ip;
    /**
     * 设备端口
     */
    @ApiModelProperty(value= "设备端口")
    private Integer port;
    /**
     * 实现类
     */
    @ApiModelProperty(value= "实现类")
    @TableField("thread_impl")
    private String threadImpl;
    /**
     * 创建时间
     */
    @ApiModelProperty(value= "创建时间")
    @TableField("create_time")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    /**
     * 设备类型
     */
    @ApiModelProperty(value= "设备类型")
    @TableField("device_type")
    private String deviceType;
    /**
     * 设备编号
     */
    @ApiModelProperty(value= "设备编号")
    @TableField("device_no")
    private Integer deviceNo;
    public DeviceConfig() {}
    public DeviceConfig(String ip,Integer port,String threadImpl,Date createTime,String deviceType,Integer deviceNo) {
        this.ip = ip;
        this.port = port;
        this.threadImpl = threadImpl;
        this.createTime = createTime;
        this.deviceType = deviceType;
        this.deviceNo = deviceNo;
    }
//    DeviceConfig deviceConfig = new DeviceConfig(
//            null,    // 设备ip
//            null,    // 设备端口
//            null,    // 实现类
//            null,    // 创建时间
//            null,    // 设备类型
//            null    // 设备编号
//    );
    public String getCreateTime$(){
        if (Cools.isEmpty(this.createTime)){
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
    }
}
src/main/java/com/zy/asrs/mapper/DeviceConfigMapper.java
New file
@@ -0,0 +1,12 @@
package com.zy.asrs.mapper;
import com.zy.asrs.entity.DeviceConfig;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface DeviceConfigMapper extends BaseMapper<DeviceConfig> {
}
src/main/java/com/zy/asrs/service/DeviceConfigService.java
New file
@@ -0,0 +1,8 @@
package com.zy.asrs.service;
import com.zy.asrs.entity.DeviceConfig;
import com.baomidou.mybatisplus.service.IService;
public interface DeviceConfigService extends IService<DeviceConfig> {
}
src/main/java/com/zy/asrs/service/impl/DeviceConfigServiceImpl.java
New file
@@ -0,0 +1,12 @@
package com.zy.asrs.service.impl;
import com.zy.asrs.mapper.DeviceConfigMapper;
import com.zy.asrs.entity.DeviceConfig;
import com.zy.asrs.service.DeviceConfigService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@Service("deviceConfigService")
public class DeviceConfigServiceImpl extends ServiceImpl<DeviceConfigMapper, DeviceConfig> implements DeviceConfigService {
}
src/main/java/com/zy/common/CodeBuilder.java
@@ -15,7 +15,7 @@
        generator.url="localhost:3306/shuttle_rcs";
        generator.username="root";
        generator.password="root";
        generator.table="asr_bas_shuttle_charge";
        generator.table="rcs_device_config";
        // sqlserver
//        generator.sqlOsType = SqlOsType.SQL_SERVER;
//        generator.url="127.0.0.1:1433;databasename=tzskasrs";
src/main/java/com/zy/core/ServerBootstrap.java
@@ -1,6 +1,10 @@
package com.zy.core;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.exception.CoolException;
import com.zy.asrs.entity.DeviceConfig;
import com.zy.asrs.service.DeviceConfigService;
import com.zy.common.utils.RedisUtil;
import com.zy.core.cache.MessageQueue;
import com.zy.core.cache.SlaveConnection;
@@ -12,6 +16,7 @@
import com.zy.core.thread.impl.LfdZyForkLiftSlaveThread;
import com.zy.core.thread.impl.NyShuttleThread;
import com.zy.core.thread.impl.ZyForkLiftThread;
import com.zy.core.utils.DeviceMsgUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
@@ -19,6 +24,8 @@
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by vincent on 2020/8/4
@@ -28,12 +35,13 @@
public class ServerBootstrap {
    @Autowired
    private SlaveProperties slaveProperties;
    @Autowired
    private MainProcess mainProcess;
    @Autowired
    private RedisUtil redisUtil;
    @Autowired
    private DeviceConfigService deviceConfigService;
    @Autowired
    private DeviceMsgUtils deviceMsgUtils;
    @PostConstruct
    @Async
@@ -51,59 +59,75 @@
    private void initMq(){
        // 初始化货叉提升机mq
        for (Slave forkLift : slaveProperties.getForkLift()) {
        List<DeviceConfig> forkLiftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.ForkLift)));
        for (DeviceConfig forkLift : forkLiftList) {
            MessageQueue.init(SlaveType.ForkLift, forkLift);
        }
        // 初始化四向穿梭车mq
        for (Slave shuttle : slaveProperties.getShuttle()) {
        List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.Shuttle)));
        for (DeviceConfig shuttle : shuttleList) {
            MessageQueue.init(SlaveType.Shuttle, shuttle);
        }
    }
    private void initThread(){
        // 初始化货叉提升机
        for (ForkLiftSlave forkLiftSlave : slaveProperties.getForkLift()) {
            News.info("初始化货叉提升机........................................................");
            ThreadHandler thread = null;
            if (forkLiftSlave.getThreadImpl().equals("ZyForkLiftThread")) {
                thread = new ZyForkLiftThread(forkLiftSlave, redisUtil);
            } else if (forkLiftSlave.getThreadImpl().equals("LfdZyForkLiftSlaveThread")) {
                thread = new LfdZyForkLiftSlaveThread(forkLiftSlave, redisUtil, forkLiftSlave.getMasterId());
            } else {
                throw new CoolException("未知的线程实现");
            }
        List<DeviceConfig> allDevices = new ArrayList<>();
            new Thread(thread).start();
            SlaveConnection.put(SlaveType.ForkLift, forkLiftSlave.getId(), thread);
        }
//        // 初始化货叉提升机
//        List<DeviceConfig> forkLiftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
//                .eq("device_type", String.valueOf(SlaveType.ForkLift)));
//        allDevices.addAll(forkLiftList);
//        for (DeviceConfig deviceConfig : forkLiftList) {
//            News.info("初始化货叉提升机........................................................");
//            ThreadHandler thread = null;
//            if (deviceConfig.getThreadImpl().equals("ZyForkLiftThread")) {
//                thread = new ZyForkLiftThread(forkLiftSlave, redisUtil);
//            } else if (deviceConfig.getThreadImpl().equals("LfdZyForkLiftSlaveThread")) {
//                thread = new LfdZyForkLiftSlaveThread(forkLiftSlave, redisUtil, forkLiftSlave.getMasterId());
//            } else {
//                throw new CoolException("未知的线程实现");
//            }
//
//            new Thread(thread).start();
//            SlaveConnection.put(SlaveType.ForkLift, deviceConfig.getDeviceNo(), thread);
//        }
        // 初始化货叉提升机
        for (ForkLiftSlave forkLiftSlave : slaveProperties.getForkLiftMaster()) {
            News.info("初始化货叉提升机Master........................................................");
            ThreadHandler thread = null;
            if (forkLiftSlave.getThreadImpl().equals("LfdZyForkLiftMasterThread")) {
                thread = new LfdZyForkLiftMasterThread(forkLiftSlave, redisUtil);
            } else {
                throw new CoolException("未知的线程实现");
            }
            new Thread(thread).start();
            SlaveConnection.put(SlaveType.ForkLiftMaster, forkLiftSlave.getId(), thread);
        }
//        // 初始化货叉提升机
//        for (ForkLiftSlave forkLiftSlave : slaveProperties.getForkLiftMaster()) {
//            News.info("初始化货叉提升机Master........................................................");
//            ThreadHandler thread = null;
//            if (forkLiftSlave.getThreadImpl().equals("LfdZyForkLiftMasterThread")) {
//                thread = new LfdZyForkLiftMasterThread(forkLiftSlave, redisUtil);
//            } else {
//                throw new CoolException("未知的线程实现");
//            }
//
//            new Thread(thread).start();
//            SlaveConnection.put(SlaveType.ForkLiftMaster, forkLiftSlave.getId(), thread);
//        }
        // 初始化四向穿梭车
        for (ShuttleSlave shuttleSlave : slaveProperties.getShuttle()) {
        List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.Shuttle)));
        allDevices.addAll(shuttleList);
        for (DeviceConfig deviceConfig : shuttleList) {
            News.info("初始化四向穿梭车......................................................");
            ThreadHandler thread = null;
            if (shuttleSlave.getThreadImpl().equals("NyShuttleThread")) {
                thread = new NyShuttleThread(shuttleSlave, redisUtil);
            if (deviceConfig.getThreadImpl().equals("NyShuttleThread")) {
                thread = new NyShuttleThread(deviceConfig, redisUtil);
            } else {
                throw new CoolException("未知的线程实现");
            }
            new Thread(thread).start();
            SlaveConnection.put(SlaveType.Shuttle, shuttleSlave.getId(), thread);
            SlaveConnection.put(SlaveType.Shuttle, deviceConfig.getDeviceNo(), thread);
        }
        //设备初始化完毕
        deviceMsgUtils.sendDeviceConfig(JSON.toJSONString(allDevices));
    }
src/main/java/com/zy/core/cache/MessageQueue.java
@@ -1,6 +1,6 @@
package com.zy.core.cache;
import com.zy.core.Slave;
import com.zy.asrs.entity.DeviceConfig;
import com.zy.core.enums.SlaveType;
import com.zy.core.model.Task;
@@ -26,19 +26,19 @@
    /**
     * mq 交换机初始化
     */
    public static void init(SlaveType type, Slave slave) {
    public static void init(SlaveType type, DeviceConfig deviceConfig) {
        switch (type) {
            case Shuttle:
                SHUTTLE_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
                SHUTTLE_EXCHANGE.put(deviceConfig.getDeviceNo(), new ConcurrentLinkedQueue<>());
                break;
            case ForkLift:
                FORK_LIFT_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
                FORK_LIFT_EXCHANGE.put(deviceConfig.getDeviceNo(), new ConcurrentLinkedQueue<>());
                break;
            case ForkLiftMaster:
                FORK_LIFT_MASTER_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
                FORK_LIFT_MASTER_EXCHANGE.put(deviceConfig.getDeviceNo(), new ConcurrentLinkedQueue<>());
                break;
            case Lift:
                LIFT_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
                LIFT_EXCHANGE.put(deviceConfig.getDeviceNo(), new ConcurrentLinkedQueue<>());
                break;
            default:
                break;
src/main/java/com/zy/core/enums/RedisKeyType.java
@@ -21,6 +21,9 @@
    //设备指令消息KEY
    DEVICE_SHUTTLE_COMMAND_MSG_KEY("deviceShuttleCommandMsgKey_"),
    DEVICE_FORK_LIFT_COMMAND_MSG_KEY("deviceForkLiftCommandMsgKey_"),
    //设备配置文件
    DEVICE_CONFIG("deviceConfig"),
    ;
    public String key;
src/main/java/com/zy/core/thread/impl/NyShuttleThread.java
@@ -8,6 +8,7 @@
import com.core.exception.CoolException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zy.asrs.entity.BasShuttle;
import com.zy.asrs.entity.DeviceConfig;
import com.zy.asrs.entity.DeviceDataLog;
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.service.BasShuttleService;
@@ -29,7 +30,6 @@
import com.zy.core.enums.*;
import com.zy.core.model.CommandResponse;
import com.zy.core.model.DeviceMsgModel;
import com.zy.core.model.ShuttleSlave;
import com.zy.core.model.command.NyShuttleHttpCommand;
import com.zy.core.model.command.ShuttleCommand;
import com.zy.core.model.command.ShuttleRedisCommand;
@@ -49,7 +49,7 @@
@SuppressWarnings("all")
public class NyShuttleThread implements ShuttleThread {
    private ShuttleSlave slave;
    private DeviceConfig deviceConfig;
    private RedisUtil redisUtil;
    private ShuttleProtocol shuttleProtocol;
@@ -61,14 +61,14 @@
    //原始设备数据
    private Object originDeviceData;
    public NyShuttleThread(ShuttleSlave slave, RedisUtil redisUtil) {
        this.slave = slave;
    public NyShuttleThread(DeviceConfig deviceConfig, RedisUtil redisUtil) {
        this.deviceConfig = deviceConfig;
        this.redisUtil = redisUtil;
    }
    @Override
    public void run() {
        News.info("{}号四向车线程启动", slave.getId());
        News.info("{}号四向车线程启动", deviceConfig.getDeviceNo());
        //设备读取
        Thread readThread = new Thread(() -> {
@@ -100,7 +100,7 @@
                        continue;
                    }
                    Object object = redisUtil.get(RedisKeyType.SHUTTLE_FLAG.key + slave.getId());
                    Object object = redisUtil.get(RedisKeyType.SHUTTLE_FLAG.key + deviceConfig.getDeviceNo());
                    if (object == null) {
                        continue;
                    }
@@ -108,14 +108,14 @@
                    Integer taskNo = Integer.valueOf(String.valueOf(object));
                    if (taskNo != 0) {
                        //存在任务需要执行
                        boolean result = shuttleAction.executeWork(slave.getId(), taskNo);
                        boolean result = shuttleAction.executeWork(deviceConfig.getDeviceNo(), taskNo);
                    }
//                    //小车空闲且有跑库程序
//                    shuttleAction.moveLoc(slave.getId());
//                    shuttleAction.moveLoc(deviceConfig.getDeviceNo());
                    //演示模式
                    shuttleAction.demo(slave.getId());
                    shuttleAction.demo(deviceConfig.getDeviceNo());
                    Thread.sleep(200);
                } catch (Exception e) {
@@ -155,24 +155,29 @@
                deviceDataLog.setOriginData(JSON.toJSONString(this.originDeviceData));
                deviceDataLog.setWcsData(JSON.toJSONString(shuttleProtocol));
                deviceDataLog.setType(String.valueOf(SlaveType.Shuttle));
                deviceDataLog.setDeviceNo(slave.getId());
                deviceDataLog.setDeviceNo(deviceConfig.getDeviceNo());
                deviceDataLog.setCreateTime(new Date());
                deviceDataLogService.insert(deviceDataLog);
                //更新采集时间
                shuttleProtocol.setDeviceDataLog(System.currentTimeMillis());
                OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId()));
                OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), deviceConfig.getDeviceNo()));
            }
        }
    }
    private void listenMessageFromRedis() {
        try {
            DeviceMsgUtils deviceMsgUtils = SpringUtils.getBean(DeviceMsgUtils.class);
            DeviceMsgUtils deviceMsgUtils = null;
            try {
                deviceMsgUtils = SpringUtils.getBean(DeviceMsgUtils.class);
            }catch (Exception e){
            }
            if (deviceMsgUtils == null) {
                return;
            }
            DeviceMsgModel deviceMsg = deviceMsgUtils.getDeviceMsg(SlaveType.Shuttle, slave.getId());
            DeviceMsgModel deviceMsg = deviceMsgUtils.getDeviceMsg(SlaveType.Shuttle, deviceConfig.getDeviceNo());
            if(deviceMsg == null){
                return;
            }
@@ -241,7 +246,7 @@
        try {
            if (null == shuttleProtocol) {
                shuttleProtocol = new ShuttleProtocol();
                shuttleProtocol.setShuttleNo(slave.getId());
                shuttleProtocol.setShuttleNo(deviceConfig.getDeviceNo());
                shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
                InnerSuhttleExtend extend = new InnerSuhttleExtend();
@@ -259,9 +264,9 @@
                return;
            }
            NyShuttleHttpCommand readStatusCommand = getReadStatusCommand(slave.getId());
            NyShuttleHttpCommand readStatusCommand = getReadStatusCommand(deviceConfig.getDeviceNo());
            //指令超过五条,不再下发任务状态请求
            TreeSet<String> deviceCommandMsgListKey = deviceMsgUtils.getDeviceCommandMsgListKey(SlaveType.Shuttle, slave.getId());
            TreeSet<String> deviceCommandMsgListKey = deviceMsgUtils.getDeviceCommandMsgListKey(SlaveType.Shuttle, deviceConfig.getDeviceNo());
            if (deviceCommandMsgListKey.size() < 5) {
                requestCommandAsync(readStatusCommand);//请求状态
            }
@@ -339,10 +344,10 @@
            this.originDeviceData = data.getString("originDeviceData");
            OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId()));
            OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), deviceConfig.getDeviceNo()));
        } catch (Exception e) {
            e.printStackTrace();
            OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】四向穿梭车Socket状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
            OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】四向穿梭车Socket状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort()));
        }
    }
@@ -379,8 +384,8 @@
                    NyShuttleHttpCommand httpCommand = JSON.parseObject(initCommand.getBody(), NyShuttleHttpCommand.class);
                    JSONObject requestResult = requestCommand(httpCommand);
                    log.info(MessageFormat.format("【{0}】四向车复位上报 ===>> [code:{1}] [ip:{2}] [port:{3}]", slave.getId(), code, slave.getIp(), slave.getPort()));
                    OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】四向车复位上报 ===>> [code:{1}] [ip:{2}] [port:{3}]", slave.getId(), code, slave.getIp(), slave.getPort()));
                    log.info(MessageFormat.format("【{0}】四向车复位上报 ===>> [code:{1}] [ip:{2}] [port:{3}]", deviceConfig.getDeviceNo(), code, deviceConfig.getIp(), deviceConfig.getPort()));
                    OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】四向车复位上报 ===>> [code:{1}] [ip:{2}] [port:{3}]", deviceConfig.getDeviceNo(), code, deviceConfig.getIp(), deviceConfig.getPort()));
                    break;
                }
            }
@@ -638,7 +643,7 @@
                if (shuttleService == null) {
                    return false;
                }
                BasShuttle basShuttle = shuttleService.selectOne(new EntityWrapper<BasShuttle>().eq("shuttle_no", slave.getId()));
                BasShuttle basShuttle = shuttleService.selectOne(new EntityWrapper<BasShuttle>().eq("shuttle_no", deviceConfig.getDeviceNo()));
                if (basShuttle == null) {
                    return false;
                }
@@ -871,7 +876,7 @@
    @Override
    public ShuttleCommand getMoveCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed, List<NavigateNode> nodes) {
        NavigateMapData navigateMapData = SpringUtils.getBean(NavigateMapData.class);
        NyShuttleHttpCommand httpStandard = getHttpStandard(slave.getId(), taskNo);
        NyShuttleHttpCommand httpStandard = getHttpStandard(deviceConfig.getDeviceNo(), taskNo);
        NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
        ArrayList<HashMap<String, Object>> path = new ArrayList<>();
@@ -916,7 +921,7 @@
        }
        ShuttleCommand command = new ShuttleCommand();
        command.setShuttleNo(slave.getId());
        command.setShuttleNo(deviceConfig.getDeviceNo());
        command.setBody(JSON.toJSONString(httpStandard));
        command.setMode(ShuttleCommandModeType.MOVE.id);
        command.setTargetLocNo(locMast.getLocNo());
@@ -926,7 +931,7 @@
    @Override
    public ShuttleCommand getLiftCommand(Integer taskNo, Boolean lift) {
        NyShuttleHttpCommand httpStandard = getHttpStandard(slave.getId(), taskNo);
        NyShuttleHttpCommand httpStandard = getHttpStandard(deviceConfig.getDeviceNo(), taskNo);
        NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
        Integer taskId = getTaskId();//TaskID需要随机
@@ -938,7 +943,7 @@
        httpStandard.setRequest(request);
        ShuttleCommand command = new ShuttleCommand();
        command.setShuttleNo(slave.getId());
        command.setShuttleNo(deviceConfig.getDeviceNo());
        command.setBody(JSON.toJSONString(httpStandard));
        command.setMode(lift ? ShuttleCommandModeType.PALLET_LIFT.id : ShuttleCommandModeType.PALLET_DOWN.id);
        command.setTaskNo(taskId);
@@ -947,7 +952,7 @@
    @Override
    public ShuttleCommand getChargeCommand(Integer taskNo, Boolean charge) {
        NyShuttleHttpCommand httpStandard = getHttpStandard(slave.getId(), taskNo);
        NyShuttleHttpCommand httpStandard = getHttpStandard(deviceConfig.getDeviceNo(), taskNo);
        NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
        Integer taskId = getTaskId();//TaskID需要随机
@@ -959,7 +964,7 @@
        httpStandard.setRequest(request);
        ShuttleCommand command = new ShuttleCommand();
        command.setShuttleNo(slave.getId());
        command.setShuttleNo(deviceConfig.getDeviceNo());
        command.setBody(JSON.toJSONString(httpStandard));
        command.setMode(charge ? ShuttleCommandModeType.CHARGE_OPEN.id : ShuttleCommandModeType.CHARGE_CLOSE.id);
        command.setTaskNo(taskId);
@@ -968,7 +973,7 @@
    @Override
    public ShuttleCommand getUpdateLocationCommand(Integer taskNo, String locNo) {
        NyShuttleHttpCommand httpStandard = getHttpStandard(slave.getId(), taskNo);
        NyShuttleHttpCommand httpStandard = getHttpStandard(deviceConfig.getDeviceNo(), taskNo);
        NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
        HashMap<String, Object> body = new HashMap<>();
@@ -979,7 +984,7 @@
        httpStandard.setRequest(request);
        ShuttleCommand command = new ShuttleCommand();
        command.setShuttleNo(slave.getId());
        command.setShuttleNo(deviceConfig.getDeviceNo());
        command.setBody(JSON.toJSONString(httpStandard));
        command.setMode(ShuttleCommandModeType.UPDATE_LOCATION.id);
        command.setTaskNo(taskNo);
@@ -990,7 +995,7 @@
    public ShuttleCommand getInitCommand(Integer taskNo, Integer code) {
        LocMastService locMastService = SpringUtils.getBean(LocMastService.class);
        NavigateMapData navigateMapData = SpringUtils.getBean(NavigateMapData.class);
        NyShuttleHttpCommand httpStandard = getHttpStandard(slave.getId(), taskNo);
        NyShuttleHttpCommand httpStandard = getHttpStandard(deviceConfig.getDeviceNo(), taskNo);
        NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
        //code -> {Integer@13781} 1101101
@@ -1031,7 +1036,7 @@
        httpStandard.setRequest(request);
        ShuttleCommand command = new ShuttleCommand();
        command.setShuttleNo(slave.getId());
        command.setShuttleNo(deviceConfig.getDeviceNo());
        command.setBody(JSON.toJSONString(httpStandard));
        command.setMode(ShuttleCommandModeType.RESET.id);
        command.setTaskNo(taskNo);
@@ -1105,10 +1110,10 @@
            data.remove("nodes");
            DeviceCommandMsgModel commandMsgModel = new DeviceCommandMsgModel();
            commandMsgModel.setDeviceId(slave.getId());
            commandMsgModel.setDeviceId(deviceConfig.getDeviceNo());
            commandMsgModel.setDeviceType(String.valueOf(SlaveType.Shuttle));
            commandMsgModel.setCommand(data);
            String key = deviceMsgUtils.sendDeviceCommand(SlaveType.Shuttle, slave.getId(), commandMsgModel);
            String key = deviceMsgUtils.sendDeviceCommand(SlaveType.Shuttle, deviceConfig.getDeviceNo(), commandMsgModel);
            String requestType = null;
            String taskId = null;
@@ -1155,10 +1160,10 @@
            data.remove("nodes");
            DeviceCommandMsgModel commandMsgModel = new DeviceCommandMsgModel();
            commandMsgModel.setDeviceId(slave.getId());
            commandMsgModel.setDeviceId(deviceConfig.getDeviceNo());
            commandMsgModel.setDeviceType(String.valueOf(SlaveType.Shuttle));
            commandMsgModel.setCommand(data);
            String key = deviceMsgUtils.sendDeviceCommand(SlaveType.Shuttle, slave.getId(), commandMsgModel);
            String key = deviceMsgUtils.sendDeviceCommand(SlaveType.Shuttle, deviceConfig.getDeviceNo(), commandMsgModel);
            String requestType = null;
            String taskId = null;
src/main/java/com/zy/core/utils/DeviceMsgUtils.java
@@ -24,6 +24,14 @@
    @Autowired
    private RedisUtil redisUtil;
    public String getDeviceConfig() {
        Object obj = redisUtil.get(RedisKeyType.DEVICE_CONFIG.key);
        if(null == obj){
            return null;
        }
        return obj.toString();
    }
    public DeviceCommandMsgModel getDeviceCommandMsg(SlaveType deviceType, Integer deviceId) {
        TreeSet<String> listKey = getDeviceCommandMsgListKey(deviceType, deviceId);
        if (listKey.isEmpty()) {
@@ -80,6 +88,10 @@
        return key;
    }
    public void sendDeviceConfig(String allDevices) {
        redisUtil.set(RedisKeyType.DEVICE_CONFIG.key,  allDevices);
    }
    public TreeSet<String> getDeviceMsgListKey(SlaveType deviceType, Integer deviceId) {
        String listKey = parseDeviceMsgKey(deviceType, deviceId);
        Set<String> keys = redisUtil.searchKeys(listKey);
src/main/resources/application.yml
@@ -56,46 +56,46 @@
    rack: 0
    slot: 0
    threadImpl: NyShuttleThread
  # 四向穿梭车2
  shuttle[1]:
    id: 2
    ip: 10.10.20.12
    port: 8888
    rack: 0
    slot: 0
    threadImpl: NyShuttleThread
  # 货叉提升机主线程
  forkLiftMaster[0]:
    id: 99
    ip: 10.10.20.20
    port: 102
    rack: 0
    slot: 0
    threadImpl: LfdZyForkLiftMasterThread
  # 货叉提升机1
  forkLift[0]:
    id: 1
    ip: 10.10.20.20
    port: 102
    rack: 0
    slot: 0
    threadImpl: LfdZyForkLiftSlaveThread
    masterId: 99
    staRow: 9
    staBay: 6
    sta[0]:
      staNo: 1001
      lev: 1
      liftNo: ${wcs-slave.forkLift[0].id}
    sta[1]:
      staNo: 1002
      lev: 2
      liftNo: ${wcs-slave.forkLift[0].id}
    sta[2]:
      staNo: 1003
      lev: 3
      liftNo: ${wcs-slave.forkLift[0].id}
    sta[3]:
      staNo: 1004
      lev: 4
      liftNo: ${wcs-slave.forkLift[0].id}
#  # 四向穿梭车2
#  shuttle[1]:
#    id: 2
#    ip: 10.10.20.12
#    port: 8888
#    rack: 0
#    slot: 0
#    threadImpl: NyShuttleThread
#  # 货叉提升机主线程
#  forkLiftMaster[0]:
#    id: 99
#    ip: 10.10.20.20
#    port: 102
#    rack: 0
#    slot: 0
#    threadImpl: LfdZyForkLiftMasterThread
#  # 货叉提升机1
#  forkLift[0]:
#    id: 1
#    ip: 10.10.20.20
#    port: 102
#    rack: 0
#    slot: 0
#    threadImpl: LfdZyForkLiftSlaveThread
#    masterId: 99
#    staRow: 9
#    staBay: 6
#    sta[0]:
#      staNo: 1001
#      lev: 1
#      liftNo: ${wcs-slave.forkLift[0].id}
#    sta[1]:
#      staNo: 1002
#      lev: 2
#      liftNo: ${wcs-slave.forkLift[0].id}
#    sta[2]:
#      staNo: 1003
#      lev: 3
#      liftNo: ${wcs-slave.forkLift[0].id}
#    sta[3]:
#      staNo: 1004
#      lev: 4
#      liftNo: ${wcs-slave.forkLift[0].id}
src/main/resources/mapper/DeviceConfigMapper.xml
New file
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zy.asrs.mapper.DeviceConfigMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.zy.asrs.entity.DeviceConfig">
        <id column="id" property="id" />
        <result column="ip" property="ip" />
        <result column="port" property="port" />
        <result column="thread_impl" property="threadImpl" />
        <result column="create_time" property="createTime" />
        <result column="device_type" property="deviceType" />
        <result column="device_no" property="deviceNo" />
    </resultMap>
</mapper>
src/main/webapp/static/js/deviceConfig/deviceConfig.js
New file
@@ -0,0 +1,255 @@
var pageCurr;
layui.config({
    base: baseUrl + "/static/layui/lay/modules/"
}).use(['table','laydate', 'form', 'admin'], function(){
    var table = layui.table;
    var $ = layui.jquery;
    var layer = layui.layer;
    var layDate = layui.laydate;
    var form = layui.form;
    var admin = layui.admin;
    // 数据渲染
    tableIns = table.render({
        elem: '#deviceConfig',
        headers: {token: localStorage.getItem('token')},
        url: baseUrl+'/deviceConfig/list/auth',
        page: true,
        limit: 15,
        limits: [15, 30, 50, 100, 200, 500],
        toolbar: '#toolbar',
        cellMinWidth: 50,
        height: 'full-120',
        cols: [[
            {type: 'checkbox'}
            ,{field: 'deviceNo', align: 'center',title: '设备编号'}
            ,{field: 'deviceType', align: 'center',title: '设备类型'}
            ,{field: 'ip', align: 'center',title: '设备ip'}
            ,{field: 'port', align: 'center',title: '设备端口'}
            ,{field: 'threadImpl', align: 'center',title: '实现类'}
            ,{field: 'createTime$', align: 'center',title: '创建时间'}
            ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:120}
        ]],
        request: {
            pageName: 'curr',
            pageSize: 'limit'
        },
        parseData: function (res) {
            return {
                'code': res.code,
                'msg': res.msg,
                'count': res.data.total,
                'data': res.data.records
            }
        },
        response: {
            statusCode: 200
        },
        done: function(res, curr, count) {
            if (res.code === 403) {
                top.location.href = baseUrl+"/";
            }
            pageCurr=curr;
            limit();
        }
    });
    // 监听排序事件
    table.on('sort(deviceConfig)', function (obj) {
        var searchData = {};
        $.each($('#search-box [name]').serializeArray(), function() {
            searchData[this.name] = this.value;
        });
        searchData['orderByField'] = obj.field;
        searchData['orderByType'] = obj.type;
        tableIns.reload({
            where: searchData,
            page: {curr: 1}
        });
    });
    // 监听头工具栏事件
    table.on('toolbar(deviceConfig)', function (obj) {
        var checkStatus = table.checkStatus(obj.config.id).data;
        switch(obj.event) {
            case 'addData':
                showEditModel();
                break;
            case 'deleteData':
               if (checkStatus.length === 0) {
                   layer.msg('请选择要删除的数据', {icon: 2});
                   return;
               }
               del(checkStatus.map(function (d) {
                   return d.id;
               }));
               break;
            case 'exportData':
                admin.confirm('确定导出Excel吗', {shadeClose: true}, function(){
                    var titles=[];
                    var fields=[];
                    obj.config.cols[0].map(function (col) {
                        if (col.type === 'normal' && col.hide === false && col.toolbar == null) {
                            titles.push(col.title);
                            fields.push(col.field);
                        }
                    });
                    var exportData = {};
                    $.each($('#search-box [name]').serializeArray(), function() {
                        exportData[this.name] = this.value;
                    });
                    var param = {
                        'deviceConfig': exportData,
                        'fields': fields
                    };
                    $.ajax({
                        url: baseUrl+"/deviceConfig/export/auth",
                        headers: {'token': localStorage.getItem('token')},
                        data: JSON.stringify(param),
                        dataType:'json',
                        contentType:'application/json;charset=UTF-8',
                        method: 'POST',
                        success: function (res) {
                            layer.closeAll();
                            if (res.code === 200) {
                                table.exportFile(titles,res.data,'xls');
                            } else if (res.code === 403) {
                                top.location.href = baseUrl+"/";
                            } else {
                                layer.msg(res.msg, {icon: 2})
                            }
                        }
                    });
                });
                break;
        }
    });
    // 监听行工具事件
    table.on('tool(deviceConfig)', function(obj){
        var data = obj.data;
        switch (obj.event) {
            case 'edit':
                showEditModel(data);
                break;
            case "del":
                del([data.id]);
                break;
        }
    });
    /* 弹窗 - 新增、修改 */
    function showEditModel(mData) {
        admin.open({
            type: 1,
            area: '600px',
            title: (mData ? '修改' : '添加') + '订单状态',
            content: $('#editDialog').html(),
            success: function (layero, dIndex) {
                layDateRender(mData);
                form.val('detail', mData);
                form.on('submit(editSubmit)', function (data) {
                    var loadIndex = layer.load(2);
                    $.ajax({
                        url: baseUrl+"/deviceConfig/"+(mData?'update':'add')+"/auth",
                        headers: {'token': localStorage.getItem('token')},
                        data: data.field,
                        method: 'POST',
                        success: function (res) {
                            layer.close(loadIndex);
                            if (res.code === 200){
                                layer.close(dIndex);
                                layer.msg(res.msg, {icon: 1});
                                tableReload();
                            } else if (res.code === 403){
                                top.location.href = baseUrl+"/";
                            }else {
                                layer.msg(res.msg, {icon: 2});
                            }
                        }
                    })
                    return false;
                });
                $(layero).children('.layui-layer-content').css('overflow', 'visible');
                layui.form.render('select');
            }
        });
    }
    /* 删除 */
    function del(ids) {
        layer.confirm('确定要删除选中数据吗?', {
            skin: 'layui-layer-admin',
            shade: .1
        }, function (i) {
            layer.close(i);
            var loadIndex = layer.load(2);
            $.ajax({
                url: baseUrl+"/deviceConfig/delete/auth",
                headers: {'token': localStorage.getItem('token')},
                data: {ids: ids},
                method: 'POST',
                success: function (res) {
                    layer.close(loadIndex);
                    if (res.code === 200){
                        layer.msg(res.msg, {icon: 1});
                        tableReload();
                    } else if (res.code === 403){
                        top.location.href = baseUrl+"/";
                    } else {
                        layer.msg(res.msg, {icon: 2});
                    }
                }
            })
        });
    }
    // 搜索
    form.on('submit(search)', function (data) {
        pageCurr = 1;
        tableReload(false);
    });
    // 重置
    form.on('submit(reset)', function (data) {
        pageCurr = 1;
        clearFormVal($('#search-box'));
        tableReload(false);
    });
    // 时间选择器
    function layDateRender(data) {
        setTimeout(function () {
            layDate.render({
                elem: '.layui-laydate-range'
                ,type: 'datetime'
                ,range: true
            });
            layDate.render({
                elem: '#createTime\\$',
                type: 'datetime',
                value: data!==undefined?data['createTime\\$']:null
            });
        }, 300);
    }
    layDateRender();
});
// 关闭动作
$(document).on('click','#data-detail-close', function () {
    parent.layer.closeAll();
});
function tableReload(child) {
    var searchData = {};
    $.each($('#search-box [name]').serializeArray(), function() {
        searchData[this.name] = this.value;
    });
    tableIns.reload({
        where: searchData,
        page: {curr: pageCurr}
     });
}
src/main/webapp/views/admin/deviceConfig/deviceConfig.html
New file
@@ -0,0 +1,116 @@
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../../static/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../static/css/admin.css?v=318" media="all">
    <link rel="stylesheet" href="../../../static/css/cool.css" media="all">
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <div class="layui-form toolbar" id="search-box">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" name="id" placeholder="编号" autocomplete="off">
                        </div>
                    </div>
                     <div class="layui-inline" style="width: 300px">
                        <div class="layui-input-inline">
                            <input class="layui-input layui-laydate-range" name="create_time" type="text" placeholder="起始时间 - 终止时间" autocomplete="off" style="width: 300px">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" name="condition" placeholder="请输入" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-inline">&emsp;
                        <button class="layui-btn icon-btn" lay-filter="search" lay-submit>
                            <i class="layui-icon">&#xe615;</i>搜索
                        </button>
                        <button class="layui-btn icon-btn" lay-filter="reset" lay-submit>
                            <i class="layui-icon">&#xe666;</i>重置
                        </button>
                    </div>
                </div>
            </div>
            <table class="layui-hide" id="deviceConfig" lay-filter="deviceConfig"></table>
        </div>
    </div>
</div>
<script type="text/html" id="toolbar">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button>
        <button class="layui-btn layui-btn-sm layui-btn-danger" id="btn-delete" lay-event="deleteData">删除</button>
        <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" style="float: right">导出</button>
    </div>
</script>
<script type="text/html" id="operate">
    <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">修改</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs btn-edit" lay-event="del">删除</a>
</script>
<script type="text/javascript" src="../../../static/js/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../../../static/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="../../../static/js/common.js" charset="utf-8"></script>
<script type="text/javascript" src="../../../static/js/cool.js" charset="utf-8"></script>
<script type="text/javascript" src="../../../static/js/deviceConfig/deviceConfig.js" charset="utf-8"></script>
</body>
<!-- 表单弹窗 -->
<script type="text/html" id="editDialog">
    <form id="detail" lay-filter="detail" class="layui-form admin-form model-form">
        <input name="id" type="hidden">
        <div class="layui-row">
            <div class="layui-col-md12">
                <div class="layui-form-item">
                    <label class="layui-form-label">设备编号: </label>
                    <div class="layui-input-block">
                        <input class="layui-input" name="deviceNo" placeholder="请输入设备编号">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">设备类型: </label>
                    <div class="layui-input-block">
                        <input class="layui-input" name="deviceType" placeholder="请输入设备类型">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">设备ip: </label>
                    <div class="layui-input-block">
                        <input class="layui-input" name="ip" placeholder="请输入设备ip">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">设备端口: </label>
                    <div class="layui-input-block">
                        <input class="layui-input" name="port" placeholder="请输入设备端口">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">实现类: </label>
                    <div class="layui-input-block">
                        <input class="layui-input" name="threadImpl" placeholder="请输入实现类">
                    </div>
                </div>
             </div>
        </div>
        <hr class="layui-bg-gray">
        <div class="layui-form-item text-right">
            <button class="layui-btn" lay-filter="editSubmit" lay-submit="">保存</button>
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
        </div>
    </form>
</script>
</html>
src/main/webapp/views/admin/deviceConfig/deviceConfig_detail.html
New file
@@ -0,0 +1,90 @@
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../../static/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../static/css/cool.css" media="all">
    <link rel="stylesheet" href="../../../static/css/common.css" media="all">
</head>
<body>
<!-- 详情 -->
<div id="data-detail" class="layer_self_wrap">
    <form id="detail" class="layui-form">
    <!--
        <div class="layui-inline"  style="display: none">
            <label class="layui-form-label"><span class="not-null">*</span>编  号:</label>
            <div class="layui-input-inline">
                <input id="id" class="layui-input" type="text" placeholder="编号">
            </div>
        </div>
    -->
        <div class="layui-inline"  style="width:31%;">
            <label class="layui-form-label"><span class="not-null">*</span>:</label>
            <div class="layui-input-inline">
                <input id="id" class="layui-input" type="text" onkeyup="check(this.id, 'deviceConfig')" lay-verify="number" >
            </div>
        </div>
        <div class="layui-inline"  style="width:31%;">
            <label class="layui-form-label">设备ip:</label>
            <div class="layui-input-inline">
                <input id="ip" class="layui-input" type="text">
            </div>
        </div>
        <div class="layui-inline"  style="width:31%;">
            <label class="layui-form-label">设备端口:</label>
            <div class="layui-input-inline">
                <input id="port" class="layui-input" type="text" lay-verify="number" >
            </div>
        </div>
        <div class="layui-inline"  style="width:31%;">
            <label class="layui-form-label">实 现 类:</label>
            <div class="layui-input-inline">
                <input id="threadImpl" class="layui-input" type="text">
            </div>
        </div>
        <div class="layui-inline"  style="width:31%;">
            <label class="layui-form-label">创建时间:</label>
            <div class="layui-input-inline">
                <input id="createTime$" class="layui-input" type="text" autocomplete="off">
            </div>
        </div>
        <div class="layui-inline"  style="width:31%;">
            <label class="layui-form-label">设备类型:</label>
            <div class="layui-input-inline">
                <input id="deviceType" class="layui-input" type="text">
            </div>
        </div>
        <div class="layui-inline"  style="width:31%;">
            <label class="layui-form-label">设备编号:</label>
            <div class="layui-input-inline">
                <input id="deviceNo" class="layui-input" type="text" lay-verify="number" >
            </div>
        </div>
        <hr class="layui-bg-gray">
        <div id="data-detail-btn" class="layui-btn-container layui-form-item">
            <div id="data-detail-submit-save" type="button" class="layui-btn layui-btn-normal" lay-submit lay-filter="save">保存</div>
            <div id="data-detail-submit-edit" type="button" class="layui-btn layui-btn-normal" lay-submit lay-filter="edit">修改</div>
            <div id="data-detail-close" type="button" class="layui-btn" lay-submit lay-filter="close">关闭</div>
        </div>
        <div id="prompt">
            温馨提示:请仔细填写相关信息,<span class="extrude"><span class="not-null">*</span> 为必填选项。</span>
        </div>
    </form>
</div>
</body>
<script type="text/javascript" src="../../../static/js/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../../../static/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="../../../static/js/common.js" charset="utf-8"></script>
<script type="text/javascript" src="../../../static/js/cool.js" charset="utf-8"></script>
<script type="text/javascript" src="../../../static/js/deviceConfig/deviceConfig.js" charset="utf-8"></script>
</html>