dev
parent
0dd93df916
commit
5ab37782e8
|
|
@ -155,9 +155,9 @@ public class DeviceThread extends Thread {
|
||||||
String plckey = plcconf.getString("ip") + "_" + plcconf.getIntValue("port");
|
String plckey = plcconf.getString("ip") + "_" + plcconf.getIntValue("port");
|
||||||
|
|
||||||
// 一个摄像头只能连一次
|
// 一个摄像头只能连一次
|
||||||
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;
|
||||||
for (Map.Entry<String, PLC> entry : plcMap.entrySet()) {
|
for (Map.Entry<String, PLC> entry : plcMap.entrySet()) {
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
|
||||||
|
|
@ -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");
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
@ -246,14 +246,23 @@ public class Config extends JFinalConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
me.add(new QuartzPlugin());
|
me.add(new QuartzPlugin());
|
||||||
me.add(new RedisPlugin(
|
if (StrKit.notBlank(dbprop.get("redis.pwd"), dbprop.get("redis.db"))) {
|
||||||
com.cowr.common.Const.REDIS_CACHENAME,
|
me.add(new RedisPlugin(
|
||||||
dbprop.get("redis.ip"),
|
com.cowr.common.Const.REDIS_CACHENAME,
|
||||||
dbprop.getInt("redis.port"),
|
dbprop.get("redis.ip"),
|
||||||
0
|
dbprop.getInt("redis.port"),
|
||||||
, dbprop.get("redis.pwd")
|
0
|
||||||
, dbprop.getInt("redis.db")
|
, dbprop.get("redis.pwd")
|
||||||
));
|
, 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());
|
||||||
|
|
@ -327,7 +336,7 @@ public class Config extends JFinalConfig {
|
||||||
|
|
||||||
// 最后启动 deviceThread
|
// 最后启动 deviceThread
|
||||||
// if ("prod".equals(ENV)) {
|
// if ("prod".equals(ENV)) {
|
||||||
deviceThread.start();
|
deviceThread.start();
|
||||||
// }
|
// }
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
|
|
|
||||||
|
|
@ -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=浠水县长投环保有限公司
|
||||||
|
|
|
||||||
|
|
@ -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=
|
||||||
|
|
@ -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=浠水县长投环保有限公司
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue