lisai17@sina.com 2020-09-08 21:02:25 +08:00
parent 0dd93df916
commit 5ab37782e8
8 changed files with 50 additions and 41 deletions

View File

@ -156,7 +156,7 @@ public class DeviceThread extends Thread {
// 一个摄像头只能连一次 // 一个摄像头只能连一次
Camera camera = new Camera(which + "_camera", cameraconf.getString("ip")); Camera camera = new Camera(which + "_camera", cameraconf.getString("ip"));
HuangZhouScale scale = new HuangZhouScale(which + "_scale", scaleconf.getString("ip"), scaleconf.getIntValue("port")); XiShuiScale scale = new XiShuiScale(which + "_scale", scaleconf.getString("ip"), scaleconf.getIntValue("port"));
LEDThread led = new LEDThread(which + "_led", ledconf.getString("ip"), ledconf.getIntValue("port")); LEDThread led = new LEDThread(which + "_led", ledconf.getString("ip"), ledconf.getIntValue("port"));
PLC plc = null; PLC plc = null;

View File

@ -203,8 +203,8 @@ public class LED extends Device {
public static void main(String[] args) { public static void main(String[] args) {
try { try {
LED led = new LED("", "192.168.30.201", 5005); LED led = new LED("", "192.168.20.52", 5005);
led.screen("12345678", "等待车辆", "%s\\n %s \\n%s"); led.screen("鄂A7D1P1", "等待车辆", "%s\\n %s \\n%s");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -256,10 +256,10 @@ public class PLC extends Device {
public static void main(String[] args) { public static void main(String[] args) {
try { try {
PLC plc = new PLC("_plc", "192.168.0.220", 502, com.cowr.local.ssjygl.devicectrl.common.DeviceThread.defaultAddressTable); PLC plc = new PLC("_plc", "192.168.20.20", 502, com.cowr.local.ssjygl.devicectrl.common.DeviceThread.defaultAddressTable);
plc.connect(); plc.connect();
plc.isConnected(); plc.isConnected();
plc.write("rodOut1Up"); plc.write("rodIn1Up");
// plc.write("rodOut2Up"); // plc.write("rodOut2Up");
// plc.write("sensorIn2Reset"); // plc.write("sensorIn2Reset");

View File

@ -11,8 +11,8 @@ import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class HuangZhouScale extends AbsScale { public class XiShuiScale extends AbsScale {
public HuangZhouScale(String id, String ip, int port) { public XiShuiScale(String id, String ip, int port) {
super(id, ip, port); super(id, ip, port);
} }
@ -31,14 +31,14 @@ public class HuangZhouScale extends AbsScale {
errCount++; errCount++;
byte[] buf = new byte[9]; byte[] buf = new byte[18];
int read = inputStream.read(buf); int read = inputStream.read(buf);
if (read != 9) { if (read != 18) {
continue; continue;
} }
weight = flip(new String(Arrays.copyOfRange(buf, 1, buf.length))); weight = new String(Arrays.copyOfRange(buf, 4, 10));
break; break;
} }
@ -58,15 +58,15 @@ public class HuangZhouScale extends AbsScale {
while (run.get() && list.size() < 15) { while (run.get() && list.size() < 15) {
long st = System.currentTimeMillis(); long st = System.currentTimeMillis();
byte[] buf = new byte[9]; byte[] buf = new byte[18];
int read = inputStream.read(buf); int read = inputStream.read(buf);
if (read != 9 && errCount < 10) { if (read != 18 && errCount < 10) {
errCount++; errCount++;
continue; continue;
} }
String weight = new String(Arrays.copyOfRange(buf, 1, buf.length)); String weight = new String(Arrays.copyOfRange(buf, 4, 10));
if (!pattern.matcher(weight).matches() || weight.equals("000000")) { if (!pattern.matcher(weight).matches() || weight.equals("000000")) {
// System.out.println("error:" + weight); // System.out.println("error:" + weight);
@ -78,8 +78,8 @@ public class HuangZhouScale extends AbsScale {
continue; continue;
} }
System.out.println("读一次耗时:" + (System.currentTimeMillis() - st) + ", " + Double.parseDouble(flip(weight))); // System.out.println("读一次耗时:" + (System.currentTimeMillis() - st) + ", " + Double.parseDouble(flip(weight)));
list.add(flip(weight)); list.add(weight);
} }
String max = "0"; String max = "0";
@ -94,7 +94,7 @@ public class HuangZhouScale extends AbsScale {
public static void main(String[] args) { public static void main(String[] args) {
HuangZhouScale s = new HuangZhouScale("scale", "192.168.0.189", 10001); XiShuiScale s = new XiShuiScale("scale", "192.168.20.30", 10001);
try { try {
boolean connect = s.connect(); boolean connect = s.connect();

View File

@ -246,6 +246,7 @@ public class Config extends JFinalConfig {
} }
me.add(new QuartzPlugin()); me.add(new QuartzPlugin());
if (StrKit.notBlank(dbprop.get("redis.pwd"), dbprop.get("redis.db"))) {
me.add(new RedisPlugin( me.add(new RedisPlugin(
com.cowr.common.Const.REDIS_CACHENAME, com.cowr.common.Const.REDIS_CACHENAME,
dbprop.get("redis.ip"), dbprop.get("redis.ip"),
@ -254,6 +255,14 @@ public class Config extends JFinalConfig {
, dbprop.get("redis.pwd") , dbprop.get("redis.pwd")
, dbprop.getInt("redis.db") , dbprop.getInt("redis.db")
)); ));
} else {
me.add(new RedisPlugin(
com.cowr.common.Const.REDIS_CACHENAME,
dbprop.get("redis.ip"),
dbprop.getInt("redis.port"),
0
));
}
} }
@Override @Override
@ -271,7 +280,7 @@ public class Config extends JFinalConfig {
// 让 druid 允许在 sql 中使用 union // 让 druid 允许在 sql 中使用 union
// https://github.com/alibaba/druid/wiki/%E9%85%8D%E7%BD%AE-wallfilter // https://github.com/alibaba/druid/wiki/%E9%85%8D%E7%BD%AE-wallfilter
wallFilter.getConfig().setSelectUnionCheck(false); wallFilter.getConfig().setSelectUnionCheck(false);
if("dev".equals(ENV)){ if ("dev".equals(ENV)) {
me.add(new DruidStatViewHandler("/druid")); me.add(new DruidStatViewHandler("/druid"));
} }
me.add(new GlobalHandler()); me.add(new GlobalHandler());

View File

@ -2,15 +2,15 @@
devMode=true devMode=true
#本地服务 和 云端服务 socket 通信 #本地服务 和 云端服务 socket 通信
socketserver.enable=true socketserver.enable=true
#socketserver.host=47.112.109.118 socketserver.host=47.112.109.118
socketserver.host=localhost #socketserver.host=localhost
socketserver.port=21002 socketserver.port=21002
#和 web 端的 socket.io 通信端口 #和 web 端的 socket.io 通信端口
socketio.port=12002 socketio.port=12002
#当前部署本地程序的砂站id #当前部署本地程序的砂站id
current.supermarket_id=6 current.supermarket_id=1
#打印用到的配置信息 #打印用到的配置信息
print.vendor=浠水县长投环保有限公司 print.vendor=浠水县长投环保有限公司

View File

@ -1,16 +1,16 @@
# mysql # mysql
# GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.119' IDENTIFIED BY 'Local_1' WITH GRANT OPTION; # GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.119' IDENTIFIED BY 'Local_1' WITH GRANT OPTION;
jdbcUrl=jdbc:mysql://rm-wz9wa070076b2uge2ro.mysql.rds.aliyuncs.com:3306/ssjy_xsx_dev?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true #jdbcUrl=jdbc:mysql://rm-wz9wa070076b2uge2ro.mysql.rds.aliyuncs.com:3306/ssjy_xsx_dev?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
user=ssjy_xsx #user=ssjy_xsx
password=Ssjy_xs_890 #password=Ssjy_xs_890
#jdbcUrl=jdbc:mysql://192.168.1.119:3306/ssjy_xsx_dev?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true jdbcUrl=jdbc:mysql://localhost:3306/ssjy_xsx_dev?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
#user=root user=root
#password=Local_1 password=Ssjy_xsx_890
# redis # redis
redis.basekey=ssjcgl_xsx_dev redis.basekey=ssjcgl_xsx_dev
redis.ip=r-wz9168ab2f2f7ec4pd.redis.rds.aliyuncs.com redis.ip=127.0.0.1
redis.port=6379 redis.port=6379
redis.pwd=CoWR1111 redis.pwd=
redis.db=13 redis.db=

View File

@ -10,7 +10,7 @@ socketserver.port=21002
socketio.port=12002 socketio.port=12002
#当前部署本地程序的砂站id #当前部署本地程序的砂站id
current.supermarket_id=6 current.supermarket_id=1
#打印用到的配置信息 #打印用到的配置信息
print.vendor=浠水县长投环保有限公司 print.vendor=浠水县长投环保有限公司