lisai17@sina.com 2020-09-27 17:31:41 +08:00
parent 53bd81f12b
commit 9322ee1d2d
5 changed files with 24 additions and 6 deletions

View File

@ -193,7 +193,10 @@ public class DeviceThread extends Thread {
Controller controller = null;
if (which.startsWith(Enums.CtrlFlowEnum.R.name())) {
controller = new InController(which, camera, scale, led, plc);
InController incontroller = new InController(which, camera, scale, led, plc);
incontroller.setSupermarket_id(supermarket_id);
controller = incontroller;
} else if (which.startsWith(Enums.CtrlFlowEnum.C.name())) {
controller = new OutController(which, camera, scale, led, plc);
} else {

View File

@ -11,10 +11,20 @@ import java.io.IOException;
public class InController extends Controller implements Runnable {
private static Log log = Log.getLog(InController.class);
private int supermarket_id;
public InController(String which, Camera camera, AbsScale scale, LEDThread led, PLC plc) {
super(which, camera, scale, led, plc);
}
public int getSupermarket_id() {
return supermarket_id;
}
public void setSupermarket_id(int supermarket_id) {
this.supermarket_id = supermarket_id;
}
@Override
public String plcRod1Up() {
return "rodIn1Up";
@ -158,8 +168,13 @@ public class InController extends Controller implements Runnable {
log.error(e.getMessage(), e);
}
// 盐港的雷达离地磅比较远,要多等一会儿
if(supermarket_id == 6){
Thread.sleep(10000);
}else{
// 获取到地感线圈状态后,等待 5 秒后开始称重
Thread.sleep(5000);
}
double weight = 0;
int tryCount = 0;

View File

@ -259,7 +259,7 @@ public class PLC extends Device {
PLC plc = new PLC("_plc", "192.168.20.20", 502, com.cowr.local.ssjygl.devicectrl.common.DeviceThread.defaultAddressTable);
plc.connect();
plc.isConnected();
plc.write("rodOut1Up");
plc.write("rodIn1Down");
// plc.write("rodOut2Up");
// plc.write("sensorIn2Reset");

View File

@ -92,7 +92,7 @@ public class XiShuiScale extends AbsScale {
public static void main(String[] args) {
XiShuiScale s = new XiShuiScale("scale", "192.168.20.30", 10003);
XiShuiScale s = new XiShuiScale("scale", "192.168.20.31", 10001);
try {
boolean connect = s.connect();

View File

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