dev
parent
4692d04fff
commit
64ad813649
|
|
@ -41,7 +41,7 @@ public class InController extends Controller implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
log.debug("开始 %s 流程", getWhich());
|
log.debug("开始 %s 流程 %s", getWhich(), supermarket_id);
|
||||||
deviceInit();
|
deviceInit();
|
||||||
|
|
||||||
while (isRunning()) {
|
while (isRunning()) {
|
||||||
|
|
@ -108,7 +108,7 @@ public class InController extends Controller implements Runnable {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug("%s 【%s】开始流程", getWhich(), pair.license);
|
log.debug("%s 【%s】开始流程 %s", getWhich(), pair.license, supermarket_id);
|
||||||
|
|
||||||
setCurrentLicense(pair.license); // 设定当前流程中的车辆
|
setCurrentLicense(pair.license); // 设定当前流程中的车辆
|
||||||
|
|
||||||
|
|
@ -179,6 +179,8 @@ public class InController extends Controller implements Runnable {
|
||||||
double weight = 0;
|
double weight = 0;
|
||||||
int tryCount = 0;
|
int tryCount = 0;
|
||||||
while (tryCount < 10 && !getResetFlow()) {
|
while (tryCount < 10 && !getResetFlow()) {
|
||||||
|
log.debug("第 %s 次,重 %s", tryCount, weight);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!getScale().isConnected()) {
|
if (!getScale().isConnected()) {
|
||||||
log.debug("%s 【%s】磅秤连接断开,重连", getWhich(), pair.license);
|
log.debug("%s 【%s】磅秤连接断开,重连", getWhich(), pair.license);
|
||||||
|
|
@ -189,6 +191,9 @@ public class InController extends Controller implements Runnable {
|
||||||
if (weight > 0) {
|
if (weight > 0) {
|
||||||
log.debug("%s 【%s】称重结果【%s】", getWhich(), pair.license, weight);
|
log.debug("%s 【%s】称重结果【%s】", getWhich(), pair.license, weight);
|
||||||
break;
|
break;
|
||||||
|
}else{
|
||||||
|
// 读数错误,断开连接,下次读取时重连
|
||||||
|
getScale().disconnect();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
getScale().disconnect();
|
getScale().disconnect();
|
||||||
|
|
@ -196,6 +201,7 @@ public class InController extends Controller implements Runnable {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
log.debug("%s 【%s】磅秤连接失败", getWhich(), pair.license);
|
log.debug("%s 【%s】磅秤连接失败", getWhich(), pair.license);
|
||||||
}
|
}
|
||||||
|
|
||||||
tryCount++;
|
tryCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,8 @@ public class OutController extends Controller implements Runnable {
|
||||||
double weight = 0;
|
double weight = 0;
|
||||||
int tryCount = 0;
|
int tryCount = 0;
|
||||||
while (tryCount < 10 && !getResetFlow()) {
|
while (tryCount < 10 && !getResetFlow()) {
|
||||||
|
log.debug("第 %s 次,重 %s", tryCount, weight);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!getScale().isConnected()) {
|
if (!getScale().isConnected()) {
|
||||||
log.debug("%s 【%s】磅秤连接断开,重连", getWhich(), pair.license);
|
log.debug("%s 【%s】磅秤连接断开,重连", getWhich(), pair.license);
|
||||||
|
|
@ -174,6 +176,9 @@ public class OutController extends Controller implements Runnable {
|
||||||
if (weight > 0) {
|
if (weight > 0) {
|
||||||
log.debug("%s 【%s】称重结果【%s】", getWhich(), pair.license, weight);
|
log.debug("%s 【%s】称重结果【%s】", getWhich(), pair.license, weight);
|
||||||
break;
|
break;
|
||||||
|
}else{
|
||||||
|
// 读数错误,断开连接,下次读取时重连
|
||||||
|
getScale().disconnect();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
getScale().disconnect();
|
getScale().disconnect();
|
||||||
|
|
@ -181,6 +186,7 @@ public class OutController extends Controller implements Runnable {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
log.debug("%s 【%s】磅秤连接失败", getWhich(), pair.license);
|
log.debug("%s 【%s】磅秤连接失败", getWhich(), pair.license);
|
||||||
}
|
}
|
||||||
|
|
||||||
tryCount++;
|
tryCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -313,7 +313,7 @@ public class LEDThread extends Device implements Runnable {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
LEDThread led = new LEDThread("", "192.168.20.50", 5005);
|
LEDThread led = new LEDThread("", "192.168.20.52", 5005);
|
||||||
Thread thread = new Thread(led);
|
Thread thread = new Thread(led);
|
||||||
thread.setDaemon(true);
|
thread.setDaemon(true);
|
||||||
thread.start();
|
thread.start();
|
||||||
|
|
|
||||||
|
|
@ -144,11 +144,6 @@ public class PLC extends Device {
|
||||||
void plcWrite(String address, byte data, byte[] framePreset) throws IOException {
|
void plcWrite(String address, byte data, byte[] framePreset) throws IOException {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
if (!isConnected()) {
|
|
||||||
log.debug("PLC %s %s 未连接", getId(), getIp());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (addressTable.containsKey(address)) {
|
if (addressTable.containsKey(address)) {
|
||||||
byte addr = addressTable.get(address);
|
byte addr = addressTable.get(address);
|
||||||
byte[] frame = new byte[framePreset.length];
|
byte[] frame = new byte[framePreset.length];
|
||||||
|
|
@ -172,11 +167,6 @@ public class PLC extends Device {
|
||||||
int plcRead() throws IOException {
|
int plcRead() throws IOException {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
if (!isConnected()) {
|
|
||||||
log.debug("PLC %s %s 未连接", getId(), getIp());
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
InputStream in = socket.getInputStream();
|
InputStream in = socket.getInputStream();
|
||||||
if (in.available() >= 6) {
|
if (in.available() >= 6) {
|
||||||
byte[] buf = new byte[6];
|
byte[] buf = new byte[6];
|
||||||
|
|
@ -199,11 +189,6 @@ public class PLC extends Device {
|
||||||
int plcClear() throws IOException {
|
int plcClear() throws IOException {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
if (!isConnected()) {
|
|
||||||
log.debug("PLC %s %s 未连接", getId(), getIp());
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
InputStream inputStream = socket.getInputStream();
|
InputStream inputStream = socket.getInputStream();
|
||||||
int available = inputStream.available();
|
int available = inputStream.available();
|
||||||
byte[] buf = new byte[available];
|
byte[] buf = new byte[available];
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.cowr.local.ssjygl.devicectrl.device;
|
package com.cowr.local.ssjygl.devicectrl.device;
|
||||||
|
|
||||||
|
import com.jfinal.log.Log;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -10,6 +12,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class XiShuiScale extends AbsScale {
|
public class XiShuiScale extends AbsScale {
|
||||||
|
private static Log log = Log.getLog(XiShuiScale.class);
|
||||||
public XiShuiScale(String id, String ip, int port) {
|
public XiShuiScale(String id, String ip, int port) {
|
||||||
super(id, ip, port);
|
super(id, ip, port);
|
||||||
}
|
}
|
||||||
|
|
@ -67,7 +70,7 @@ public class XiShuiScale extends AbsScale {
|
||||||
String weight = new String(Arrays.copyOfRange(buf, 4, 10));
|
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);
|
log.error("error weight: %s", weight);
|
||||||
|
|
||||||
if (errCount == 100) {
|
if (errCount == 100) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -92,7 +95,7 @@ public class XiShuiScale extends AbsScale {
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
XiShuiScale s = new XiShuiScale("scale", "192.168.20.31", 10001);
|
XiShuiScale s = new XiShuiScale("scale", "192.168.20.30", 10001);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
boolean connect = s.connect();
|
boolean connect = s.connect();
|
||||||
|
|
|
||||||
|
|
@ -319,6 +319,7 @@ public class Config extends JFinalConfig {
|
||||||
CliCacheData.SUP = Supermarket.dao.findById(configprop.getInt("current.supermarket_id"));
|
CliCacheData.SUP = Supermarket.dao.findById(configprop.getInt("current.supermarket_id"));
|
||||||
|
|
||||||
if (CliCacheData.SUP == null) {
|
if (CliCacheData.SUP == null) {
|
||||||
|
System.out.println("没有获取到有效的砂站信息,检查配置是否正确");
|
||||||
log.error("没有获取到有效的砂站信息,检查配置是否正确");
|
log.error("没有获取到有效的砂站信息,检查配置是否正确");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
devMode=true
|
devMode=true
|
||||||
|
|
||||||
endpoint=oss-cn-shenzhen-internal.aliyuncs.com
|
endpoint=oss-cn-shenzhen.aliyuncs.com
|
||||||
#正式、测试的附件,都存入正式的 oss 中
|
#正式、测试的附件,都存入正式的 oss 中
|
||||||
bucketName=ssjygl-xsx-static
|
bucketName=ssjygl-xsx-static
|
||||||
|
|
||||||
|
|
@ -15,7 +15,7 @@ socketserver.port=21002
|
||||||
socketio.port=12002
|
socketio.port=12002
|
||||||
|
|
||||||
#当前部署本地程序的砂站id
|
#当前部署本地程序的砂站id
|
||||||
current.supermarket_id=4
|
current.supermarket_id=6
|
||||||
|
|
||||||
#打印用到的配置信息
|
#打印用到的配置信息
|
||||||
print.vendor=浠水县长投环保有限公司
|
print.vendor=浠水县长投环保有限公司
|
||||||
|
|
@ -24,6 +24,8 @@ print.vendorTaxId=91421125MA49GYYK2B
|
||||||
#如果物流车辆入场重量大大超过皮重(>=10%),则认为是转运车辆
|
#如果物流车辆入场重量大大超过皮重(>=10%),则认为是转运车辆
|
||||||
#2019-08-01 暂定 50%
|
#2019-08-01 暂定 50%
|
||||||
weight.distinguish=0.5
|
weight.distinguish=0.5
|
||||||
|
#最大毛重不超过 49 吨,超过 49 吨不能上高速
|
||||||
|
weigh.max=49
|
||||||
|
|
||||||
#起步运输距离
|
#起步运输距离
|
||||||
start.trans.distance=5
|
start.trans.distance=5
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue