调度代码修改
This commit is contained in:
@@ -0,0 +1,37 @@
|
|||||||
|
package com.ruoyi.api.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.api.service.ITestService;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/test")
|
||||||
|
public class TestController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ITestService testService;
|
||||||
|
|
||||||
|
@GetMapping("/sendSsjData")
|
||||||
|
public String sendSsjData(Integer id) {
|
||||||
|
boolean b = testService.sendSsjData(id);
|
||||||
|
if (!b) {
|
||||||
|
return "error";
|
||||||
|
}
|
||||||
|
return "success";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/sendDdjData")
|
||||||
|
public String sendDdjData(Integer id) {
|
||||||
|
boolean b = testService.sendDdjData(id);
|
||||||
|
if (!b) {
|
||||||
|
return "error";
|
||||||
|
}
|
||||||
|
return "success";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.ruoyi.api.service;
|
||||||
|
|
||||||
|
public interface ITestService {
|
||||||
|
|
||||||
|
boolean sendSsjData(Integer id);
|
||||||
|
|
||||||
|
boolean sendDdjData(Integer id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package com.ruoyi.api.service.impl;
|
||||||
|
|
||||||
|
import com.ruoyi.api.service.ITestService;
|
||||||
|
import com.ruoyi.common.core.text.Convert;
|
||||||
|
import com.ruoyi.common.domain.SendData;
|
||||||
|
import com.ruoyi.device.ddj.domain.MsgDdj;
|
||||||
|
import com.ruoyi.device.ddj.mapper.MsgDdjMapper;
|
||||||
|
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||||
|
import com.ruoyi.device.ssj.mapper.DeviceSsjMapper;
|
||||||
|
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
||||||
|
import com.ruoyi.schedule.plcRead.util.Tools;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class TestServiceImpl implements ITestService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MsgDdjMapper msgDdjMapper;
|
||||||
|
@Resource
|
||||||
|
private DeviceSsjMapper deviceSsjMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean sendDdjData(Integer id) {
|
||||||
|
MsgDdj msgDdj = msgDdjMapper.selectSendData(id);
|
||||||
|
SendData czfs = new SendData(Tools.INT, msgDdj.getCzfs());
|
||||||
|
SendData sbzt = new SendData(Tools.INT, msgDdj.getSbzt());
|
||||||
|
SendData rwh = new SendData(Tools.DINT, Convert.toInt(msgDdj.getRwh()));
|
||||||
|
SendData hczt = new SendData(Tools.INT, msgDdj.getHczt());
|
||||||
|
SendData jdbz = new SendData(Tools.INT, msgDdj.getJdbz());
|
||||||
|
SendData yph = new SendData(Tools.INT, msgDdj.getYph());
|
||||||
|
SendData ylh = new SendData(Tools.INT, msgDdj.getYlh());
|
||||||
|
SendData ych = new SendData(Tools.INT, msgDdj.getYch());
|
||||||
|
SendData mbph = new SendData(Tools.INT, msgDdj.getMbph());
|
||||||
|
SendData mblh = new SendData(Tools.INT, msgDdj.getMblh());
|
||||||
|
SendData mbch = new SendData(Tools.INT, msgDdj.getMbch());
|
||||||
|
SendData yxxf = new SendData(Tools.INT, msgDdj.getYxxf());
|
||||||
|
SendData xtxh = new SendData(Tools.INT, msgDdj.getXtxh());
|
||||||
|
SendData trayCode = new SendData(Tools.INT, Convert.toInt(msgDdj.getSpare2()));
|
||||||
|
byte[] bytes = Tools.sendData(czfs, sbzt, rwh, hczt, jdbz, yph, ylh, ych, mbph, mblh, mbch, yxxf, xtxh, trayCode);
|
||||||
|
int i = PlcSsjRead.WriteToSSJ("DB41.0", bytes);
|
||||||
|
if (i == 1) {
|
||||||
|
System.out.println("写入成功");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean sendSsjData(Integer id) {
|
||||||
|
DeviceSsj deviceSsj = deviceSsjMapper.selectSendData(id);
|
||||||
|
|
||||||
|
SendData kx = new SendData(Tools.INT, deviceSsj.getKx());
|
||||||
|
SendData dw = new SendData(Tools.INT, deviceSsj.getDw());
|
||||||
|
SendData rkqq = new SendData(Tools.INT, deviceSsj.getRkqq());
|
||||||
|
SendData taskNo = new SendData(Tools.DINT, deviceSsj.getTaskNo());
|
||||||
|
|
||||||
|
byte[] bytes = Tools.sendData(kx, dw, rkqq, taskNo);
|
||||||
|
|
||||||
|
int i = PlcSsjRead.WriteToSSJ(deviceSsj.getPlcDbReadAddress(), bytes);
|
||||||
|
if (i == 1) {
|
||||||
|
System.out.println("写入成功");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,11 +5,11 @@ public class TaskType {
|
|||||||
/**
|
/**
|
||||||
* 堆垛机任务类型
|
* 堆垛机任务类型
|
||||||
*/
|
*/
|
||||||
//1-二楼双向
|
//入库取货扫码
|
||||||
public static final int DDJ_RWLX_1 = 1;
|
public static final int DDJ_RWLX_1 = 1;
|
||||||
//2-一楼单向
|
//入库放货
|
||||||
public static final int DDJ_RWLX_2 = 2;
|
public static final int DDJ_RWLX_2 = 2;
|
||||||
//3-一楼双向
|
//出库
|
||||||
public static final int DDJ_RWLX_3 = 3;
|
public static final int DDJ_RWLX_3 = 3;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,4 +58,6 @@ public interface MsgDdjMapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteMsgDdjByIds(Long[] ids);
|
public int deleteMsgDdjByIds(Long[] ids);
|
||||||
|
|
||||||
|
MsgDdj selectSendData(Integer id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,4 +58,6 @@ public interface DeviceSsjMapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteDeviceSsjByIds(Long[] ids);
|
public int deleteDeviceSsjByIds(Long[] ids);
|
||||||
|
|
||||||
|
DeviceSsj selectSendData(Integer id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,31 +109,31 @@ public class ScheduleThread {
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
msgDdj.setPlcDbReadAddress("DB42.0");
|
msgDdj.setPlcDbReadAddress("DB42.0");
|
||||||
PlcDdjRead plcDdjRead2 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.1", 102));
|
PlcDdjRead plcDdjRead2 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.2", 102));
|
||||||
Thread plcDdjReadThread2 = new Thread(plcDdjRead2);
|
Thread plcDdjReadThread2 = new Thread(plcDdjRead2);
|
||||||
plcDdj2ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread2, plcDdjRead2);
|
plcDdj2ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread2, plcDdjRead2);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
msgDdj.setPlcDbReadAddress("DB42.0");
|
msgDdj.setPlcDbReadAddress("DB42.0");
|
||||||
PlcDdjRead plcDdjRead3 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.1", 102));
|
PlcDdjRead plcDdjRead3 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.3", 102));
|
||||||
Thread plcDdjReadThread3 = new Thread(plcDdjRead3);
|
Thread plcDdjReadThread3 = new Thread(plcDdjRead3);
|
||||||
plcDdj3ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread3, plcDdjRead3);
|
plcDdj3ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread3, plcDdjRead3);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
msgDdj.setPlcDbReadAddress("DB42.0");
|
msgDdj.setPlcDbReadAddress("DB42.0");
|
||||||
PlcDdjRead plcDdjRead4 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.1", 102));
|
PlcDdjRead plcDdjRead4 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.4", 102));
|
||||||
Thread plcDdjReadThread4 = new Thread(plcDdjRead4);
|
Thread plcDdjReadThread4 = new Thread(plcDdjRead4);
|
||||||
plcDdj4ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread4, plcDdjRead4);
|
plcDdj4ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread4, plcDdjRead4);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
msgDdj.setPlcDbReadAddress("DB42.0");
|
msgDdj.setPlcDbReadAddress("DB42.0");
|
||||||
PlcDdjRead plcDdjRead5 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.1", 102));
|
PlcDdjRead plcDdjRead5 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.5", 102));
|
||||||
Thread plcDdjReadThread5 = new Thread(plcDdjRead5);
|
Thread plcDdjReadThread5 = new Thread(plcDdjRead5);
|
||||||
plcDdj5ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread5, plcDdjRead5);
|
plcDdj5ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread5, plcDdjRead5);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
msgDdj.setPlcDbReadAddress("DB42.0");
|
msgDdj.setPlcDbReadAddress("DB42.0");
|
||||||
PlcDdjRead plcDdjRead6 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.1", 102));
|
PlcDdjRead plcDdjRead6 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.6", 102));
|
||||||
Thread plcDdjReadThread6 = new Thread(plcDdjRead6);
|
Thread plcDdjReadThread6 = new Thread(plcDdjRead6);
|
||||||
plcDdj6ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread6, plcDdjRead6);
|
plcDdj6ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread6, plcDdjRead6);
|
||||||
break;
|
break;
|
||||||
@@ -148,11 +148,11 @@ public class ScheduleThread {
|
|||||||
public void startAllThread() {
|
public void startAllThread() {
|
||||||
plcSsjReadCustomThread.getThread().start();
|
plcSsjReadCustomThread.getThread().start();
|
||||||
plcDdj1ReadCustomThread.getThread().start();
|
plcDdj1ReadCustomThread.getThread().start();
|
||||||
/*plcDdj2ReadCustomThread.getThread().start();
|
plcDdj2ReadCustomThread.getThread().start();
|
||||||
plcDdj3ReadCustomThread.getThread().start();
|
plcDdj3ReadCustomThread.getThread().start();
|
||||||
plcDdj4ReadCustomThread.getThread().start();
|
plcDdj4ReadCustomThread.getThread().start();
|
||||||
plcDdj5ReadCustomThread.getThread().start();
|
plcDdj5ReadCustomThread.getThread().start();
|
||||||
plcDdj6ReadCustomThread.getThread().start();*/
|
plcDdj6ReadCustomThread.getThread().start();
|
||||||
isRun = true;
|
isRun = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class PlcDdjRead extends Thread {
|
|||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
return;
|
return;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.info("********IP:" + this.ip + " port:" + this.port + "<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣 " + e.getMessage());
|
log.info("********IP:" + this.ip + " port:" + this.port + "端口号 " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -96,9 +96,9 @@ public class PlcDdjRead extends Thread {
|
|||||||
siemensS7Net.setPort(this.port);
|
siemensS7Net.setPort(this.port);
|
||||||
siemensS7Net.setRack((byte) 0);
|
siemensS7Net.setRack((byte) 0);
|
||||||
siemensS7Net.setSlot((byte) 1);
|
siemensS7Net.setSlot((byte) 1);
|
||||||
|
|
||||||
OperateResult connect = siemensS7Net.ConnectServer();
|
OperateResult connect = siemensS7Net.ConnectServer();
|
||||||
if (connect.IsSuccess) {
|
if (connect.IsSuccess) {
|
||||||
|
log.info("********IP:" + this.ip + " port:" + this.port + "连接成功 ");
|
||||||
setIsConnect(true);
|
setIsConnect(true);
|
||||||
readWriteNet = siemensS7Net;
|
readWriteNet = siemensS7Net;
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ public class PlcDdjRead extends Thread {
|
|||||||
void reConnect() {
|
void reConnect() {
|
||||||
closeServer();
|
closeServer();
|
||||||
ConnectServer();
|
ConnectServer();
|
||||||
log.info("重新连接 SSJ-PLC");
|
log.info("重新连接 Ddj-PLC");
|
||||||
}
|
}
|
||||||
|
|
||||||
void closeServer() {
|
void closeServer() {
|
||||||
|
|||||||
@@ -28,8 +28,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static com.ruoyi.common.TaskStatusCode.*;
|
import static com.ruoyi.common.TaskStatusCode.*;
|
||||||
import static com.ruoyi.common.TaskType.DDJ_RWLX_2;
|
import static com.ruoyi.common.TaskType.*;
|
||||||
import static com.ruoyi.common.TaskType.DDJ_RWLX_3;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
||||||
@@ -272,7 +271,7 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
ddjDeviceExecutionQueue.setMblh(integers.get(1));
|
ddjDeviceExecutionQueue.setMblh(integers.get(1));
|
||||||
ddjDeviceExecutionQueue.setMbch(integers.get(2));
|
ddjDeviceExecutionQueue.setMbch(integers.get(2));
|
||||||
ddjDeviceExecutionQueue.setDdjxf("0");
|
ddjDeviceExecutionQueue.setDdjxf("0");
|
||||||
ddjDeviceExecutionQueue.setRwlx(1);
|
ddjDeviceExecutionQueue.setRwlx(DDJ_RWLX_1);
|
||||||
ddjDeviceExecutionQueue.setScsj(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
ddjDeviceExecutionQueue.setScsj(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
||||||
ddjDeviceExecutionQueue.setMlfs(3);
|
ddjDeviceExecutionQueue.setMlfs(3);
|
||||||
ddjDeviceExecutionQueue.setSpare1("0");
|
ddjDeviceExecutionQueue.setSpare1("0");
|
||||||
@@ -293,10 +292,7 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
//完成作业
|
//完成作业
|
||||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
|
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
|
||||||
if (ObjUtil.isNotNull(ddjDeviceExecutionQueue)){
|
if (ObjUtil.isNotNull(ddjDeviceExecutionQueue)){
|
||||||
if (ddjDeviceExecutionQueue.getRwlx()==1){
|
if (ddjDeviceExecutionQueue.getRwlx()==2 || ddjDeviceExecutionQueue.getRwlx()==3 ){
|
||||||
//完成队列
|
|
||||||
ddjTaskFinish(rwh, ddj.getId(),2);
|
|
||||||
}else {
|
|
||||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||||
if (ObjUtil.isNotNull(mydoJob)){
|
if (ObjUtil.isNotNull(mydoJob)){
|
||||||
//回传完成信号
|
//回传完成信号
|
||||||
@@ -305,6 +301,17 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 3 && ddj.getJdbz() == 5) {
|
||||||
|
Long rwh = ddj.getRwh();
|
||||||
|
//完成作业
|
||||||
|
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
|
||||||
|
if (ObjUtil.isNotNull(ddjDeviceExecutionQueue)){
|
||||||
|
if (ddjDeviceExecutionQueue.getRwlx()==1){
|
||||||
|
//完成队列
|
||||||
|
ddjTaskFinish(rwh, ddj.getId(),2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
第二部分
|
第二部分
|
||||||
@@ -392,6 +399,14 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
}
|
}
|
||||||
//正常下发
|
//正常下发
|
||||||
if (ddj.getYxxf() == 1 && ddj.getCzfs() == 5) {
|
if (ddj.getYxxf() == 1 && ddj.getCzfs() == 5) {
|
||||||
|
DdjDeviceExecutionQueue ddjDeviceExecutionRunningQueueParam = new DdjDeviceExecutionQueue();
|
||||||
|
ddjDeviceExecutionRunningQueueParam.setDdjxf("1");
|
||||||
|
List<DdjDeviceExecutionQueue> ddjDeviceExecutionQueues1 = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(ddjDeviceExecutionRunningQueueParam);
|
||||||
|
if (CollUtil.isNotEmpty(ddjDeviceExecutionQueues1)){
|
||||||
|
log.info("正在执行任务 {}", ddjDeviceExecutionQueues1.get(0).getRwh());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ddj.getSbzt() == 0) {
|
if (ddj.getSbzt() == 0) {
|
||||||
//无货待机 只查询入库取货扫码或者出库队列
|
//无货待机 只查询入库取货扫码或者出库队列
|
||||||
ArrayList<Integer> rwlxList = new ArrayList<>();
|
ArrayList<Integer> rwlxList = new ArrayList<>();
|
||||||
|
|||||||
@@ -4,10 +4,6 @@ import com.ruoyi.job.domain.MydoJob;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
/**
|
|
||||||
* 堆垛机线程接口
|
|
||||||
* 定义堆垛机线程必须实现的方法
|
|
||||||
*/
|
|
||||||
public interface DdjThreadInterface {
|
public interface DdjThreadInterface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,183 +0,0 @@
|
|||||||
package com.ruoyi.web.controller.tool;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* swagger 用户测试方法
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
@Api("用户信息管理")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/test/user")
|
|
||||||
public class TestController extends BaseController
|
|
||||||
{
|
|
||||||
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
|
|
||||||
{
|
|
||||||
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
|
|
||||||
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("获取用户列表")
|
|
||||||
@GetMapping("/list")
|
|
||||||
public R<List<UserEntity>> userList()
|
|
||||||
{
|
|
||||||
List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
|
|
||||||
return R.ok(userList);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("获取用户详细")
|
|
||||||
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
|
|
||||||
@GetMapping("/{userId}")
|
|
||||||
public R<UserEntity> getUser(@PathVariable Integer userId)
|
|
||||||
{
|
|
||||||
if (!users.isEmpty() && users.containsKey(userId))
|
|
||||||
{
|
|
||||||
return R.ok(users.get(userId));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return R.fail("用户不存在");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("新增用户")
|
|
||||||
@ApiImplicitParams({
|
|
||||||
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class),
|
|
||||||
@ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class),
|
|
||||||
@ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class),
|
|
||||||
@ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)
|
|
||||||
})
|
|
||||||
@PostMapping("/save")
|
|
||||||
public R<String> save(UserEntity user)
|
|
||||||
{
|
|
||||||
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
|
||||||
{
|
|
||||||
return R.fail("用户ID不能为空");
|
|
||||||
}
|
|
||||||
users.put(user.getUserId(), user);
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("更新用户")
|
|
||||||
@PutMapping("/update")
|
|
||||||
public R<String> update(@RequestBody UserEntity user)
|
|
||||||
{
|
|
||||||
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
|
||||||
{
|
|
||||||
return R.fail("用户ID不能为空");
|
|
||||||
}
|
|
||||||
if (users.isEmpty() || !users.containsKey(user.getUserId()))
|
|
||||||
{
|
|
||||||
return R.fail("用户不存在");
|
|
||||||
}
|
|
||||||
users.remove(user.getUserId());
|
|
||||||
users.put(user.getUserId(), user);
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("删除用户信息")
|
|
||||||
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
|
|
||||||
@DeleteMapping("/{userId}")
|
|
||||||
public R<String> delete(@PathVariable Integer userId)
|
|
||||||
{
|
|
||||||
if (!users.isEmpty() && users.containsKey(userId))
|
|
||||||
{
|
|
||||||
users.remove(userId);
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return R.fail("用户不存在");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiModel(value = "UserEntity", description = "用户实体")
|
|
||||||
class UserEntity
|
|
||||||
{
|
|
||||||
@ApiModelProperty("用户ID")
|
|
||||||
private Integer userId;
|
|
||||||
|
|
||||||
@ApiModelProperty("用户名称")
|
|
||||||
private String username;
|
|
||||||
|
|
||||||
@ApiModelProperty("用户密码")
|
|
||||||
private String password;
|
|
||||||
|
|
||||||
@ApiModelProperty("用户手机")
|
|
||||||
private String mobile;
|
|
||||||
|
|
||||||
public UserEntity()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserEntity(Integer userId, String username, String password, String mobile)
|
|
||||||
{
|
|
||||||
this.userId = userId;
|
|
||||||
this.username = username;
|
|
||||||
this.password = password;
|
|
||||||
this.mobile = mobile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getUserId()
|
|
||||||
{
|
|
||||||
return userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserId(Integer userId)
|
|
||||||
{
|
|
||||||
this.userId = userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUsername()
|
|
||||||
{
|
|
||||||
return username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUsername(String username)
|
|
||||||
{
|
|
||||||
this.username = username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPassword()
|
|
||||||
{
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String password)
|
|
||||||
{
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMobile()
|
|
||||||
{
|
|
||||||
return mobile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMobile(String mobile)
|
|
||||||
{
|
|
||||||
this.mobile = mobile;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,7 @@ spring:
|
|||||||
druid:
|
druid:
|
||||||
#主数据信息
|
#主数据信息
|
||||||
master:
|
master:
|
||||||
url: jdbc:sqlserver://172.16.2.170:1433;databaseName=FT541-WCS;
|
url: jdbc:sqlserver://172.16.2.170:1433;databaseName=FT541-wcs;
|
||||||
username: sa
|
username: sa
|
||||||
password: Flrd0914.
|
password: Flrd0914.
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ server:
|
|||||||
# 日志配置
|
# 日志配置
|
||||||
logging:
|
logging:
|
||||||
level:
|
level:
|
||||||
com.ruoyi: info
|
com.ruoyi: debug
|
||||||
org.springframework: warn
|
org.springframework: warn
|
||||||
|
|
||||||
# 用户配置
|
# 用户配置
|
||||||
|
|||||||
@@ -54,6 +54,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<include refid="selectDeviceSsjVo"/>
|
<include refid="selectDeviceSsjVo"/>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectSendData" resultMap="DeviceSsjResult">
|
||||||
|
select id, device_code , name , type, ip_address, plc_db_read_address, is_active, create_time, plc_db_write_address, rkqq, kx, dw, tray_code, task_no,exception,tray_size,allow_put from device_ssj_test
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertDeviceSsj" parameterType="DeviceSsj" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertDeviceSsj" parameterType="DeviceSsj" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into device_ssj
|
insert into device_ssj
|
||||||
|
|||||||
@@ -58,6 +58,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<include refid="selectMsgDdjVo"/>
|
<include refid="selectMsgDdjVo"/>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectSendData" resultMap="MsgDdjResult">
|
||||||
|
select id, name, rwh, jdbz, sbzt, czfs, yxxf, yph, ylh, ych, mbph, mblh, mbch, xtxh, dqxd, hczt, spare1, spare2, spare3 from msg_ddj_test
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertMsgDdj" parameterType="MsgDdj">
|
<insert id="insertMsgDdj" parameterType="MsgDdj">
|
||||||
insert into msg_ddj
|
insert into msg_ddj
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by scsj desc
|
order by scsj asc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDdjDeviceExecutionQueueByUuid" parameterType="String" resultMap="DdjDeviceExecutionQueueResult">
|
<select id="selectDdjDeviceExecutionQueueByUuid" parameterType="String" resultMap="DdjDeviceExecutionQueueResult">
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ public class SecurityConfig
|
|||||||
.antMatchers("/agv/api/**").permitAll()
|
.antMatchers("/agv/api/**").permitAll()
|
||||||
.antMatchers("/device/api/**").permitAll()
|
.antMatchers("/device/api/**").permitAll()
|
||||||
.antMatchers("/wcs2Wms/api/**").permitAll()
|
.antMatchers("/wcs2Wms/api/**").permitAll()
|
||||||
|
.antMatchers("/test/**").permitAll()
|
||||||
.antMatchers("/largeScreen/monitor/**").permitAll()
|
.antMatchers("/largeScreen/monitor/**").permitAll()
|
||||||
// 除上面外的所有请求全部需要鉴权认证
|
// 除上面外的所有请求全部需要鉴权认证
|
||||||
.anyRequest().authenticated();
|
.anyRequest().authenticated();
|
||||||
|
|||||||
Reference in New Issue
Block a user