|
|
@@ -112,61 +112,61 @@ public class PlcUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static void getStatusBOld(S7PLC s7PLC){
|
|
|
- String snb = "";
|
|
|
- if(MesClient.tjFlagb == 0){ // 未扫码
|
|
|
- snb = s7PLC.readString("DB8.100",50);
|
|
|
- System.out.println("snb:"+snb);
|
|
|
- if(!snb.isEmpty() && !MesClient.curSnb.equals(snb) && snb.length() == 33){
|
|
|
- MesClient.product_sn2.setText(snb);
|
|
|
- }else{
|
|
|
- snb = "";
|
|
|
- }
|
|
|
- if(!MesClient.mesQualityFlagB && !snb.isEmpty() && MesClient.curSnb.isEmpty()){ // 查询工件质量
|
|
|
- if(!MesClient.tcp_connect_flag) {
|
|
|
- MesClient.status_menu.setText("未连接MES服务器");
|
|
|
- }else{
|
|
|
- if(MesClient.checkB == 0) {
|
|
|
- MesClient.checkB = 1;
|
|
|
- MesClient.getUser();
|
|
|
- Boolean sendret = DataUtil.checkQuality(MesClient.nettyClient,snb,MesClient.user20,"B");
|
|
|
- if(!sendret){
|
|
|
- MesClient.pxstatus2.setText("B:查询质量失败");
|
|
|
- MesClient.checkB = 0;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }else if(MesClient.tjFlagb == 1){ // 待运行
|
|
|
- MesClient.checkB = 0;
|
|
|
- Boolean startb = s7PLC.readBoolean("DB1.2.3"); //B启动中
|
|
|
- if(startb){
|
|
|
- MesClient.curFlag = "B";
|
|
|
- MesClient.tjFlagb = 2;
|
|
|
- MesClient.pxstatus2.setText("B:设备运行中");
|
|
|
- PlcUtil.changeEnable(MesClient.s7PLC,false);
|
|
|
- }
|
|
|
- }else if(MesClient.tjFlagb == 2){ // 运行中
|
|
|
- MesClient.batch_scan_2.setEnabled(false);
|
|
|
- Boolean starta = s7PLC.readBoolean("DB1.2.7"); //B焊接完成
|
|
|
- Boolean startb = s7PLC.readBoolean("DB1.2.2"); //A启动中
|
|
|
- if(starta || startb){
|
|
|
- MesClient.tjFlagb = 3;
|
|
|
- MesClient.pxstatus2.setText("B:设备运行结束,提交结果中");
|
|
|
- MesClient.finish_ng_bt.setEnabled(true);
|
|
|
-
|
|
|
- Boolean sendret = DataUtil.sendQuality(MesClient.nettyClient,MesClient.product_sn2.getText(),"OK",MesClient.user20,"B");
|
|
|
- if(!sendret){
|
|
|
- MesClient.pxstatus2.setText("B:结果上传MES失败");
|
|
|
- MesClient.tjStatusb = 1;
|
|
|
- }else{
|
|
|
-// MesClient.pxstatus2.setText("B:提交成功");
|
|
|
-// MesClient.status_menu.setText("B件提交成功");
|
|
|
-// MesClient.resetScanB();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// public static void getStatusBOld(S7PLC s7PLC){
|
|
|
+// String snb = "";
|
|
|
+// if(MesClient.tjFlagb == 0){ // 未扫码
|
|
|
+// snb = s7PLC.readString("DB8.100",50);
|
|
|
+// System.out.println("snb:"+snb);
|
|
|
+// if(!snb.isEmpty() && !MesClient.curSnb.equals(snb) && snb.length() == 33){
|
|
|
+// MesClient.product_sn2.setText(snb);
|
|
|
+// }else{
|
|
|
+// snb = "";
|
|
|
+// }
|
|
|
+// if(!MesClient.mesQualityFlagB && !snb.isEmpty() && MesClient.curSnb.isEmpty()){ // 查询工件质量
|
|
|
+// if(!MesClient.tcp_connect_flag) {
|
|
|
+// MesClient.status_menu.setText("未连接MES服务器");
|
|
|
+// }else{
|
|
|
+// if(MesClient.checkB == 0) {
|
|
|
+// MesClient.checkB = 1;
|
|
|
+// MesClient.getUser();
|
|
|
+// Boolean sendret = DataUtil.checkQuality(MesClient.nettyClient,snb,MesClient.user20,"B");
|
|
|
+// if(!sendret){
|
|
|
+// MesClient.pxstatus2.setText("B:查询质量失败");
|
|
|
+// MesClient.checkB = 0;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }else if(MesClient.tjFlagb == 1){ // 待运行
|
|
|
+// MesClient.checkB = 0;
|
|
|
+// Boolean startb = s7PLC.readBoolean("DB1.2.3"); //B启动中
|
|
|
+// if(startb){
|
|
|
+// MesClient.curFlag = "B";
|
|
|
+// MesClient.tjFlagb = 2;
|
|
|
+// MesClient.pxstatus2.setText("B:设备运行中");
|
|
|
+// PlcUtil.changeEnable(MesClient.s7PLC,false);
|
|
|
+// }
|
|
|
+// }else if(MesClient.tjFlagb == 2){ // 运行中
|
|
|
+// MesClient.batch_scan_2.setEnabled(false);
|
|
|
+// Boolean starta = s7PLC.readBoolean("DB1.2.7"); //B焊接完成
|
|
|
+// Boolean startb = s7PLC.readBoolean("DB1.2.2"); //A启动中
|
|
|
+// if(starta || startb){
|
|
|
+// MesClient.tjFlagb = 3;
|
|
|
+// MesClient.pxstatus2.setText("B:设备运行结束,提交结果中");
|
|
|
+// MesClient.finish_ng_bt.setEnabled(true);
|
|
|
+//
|
|
|
+// Boolean sendret = DataUtil.sendQuality(MesClient.nettyClient,MesClient.product_sn2.getText(),"OK",MesClient.user20,"B");
|
|
|
+// if(!sendret){
|
|
|
+// MesClient.pxstatus2.setText("B:结果上传MES失败");
|
|
|
+// MesClient.tjStatusb = 1;
|
|
|
+// }else{
|
|
|
+//// MesClient.pxstatus2.setText("B:提交成功");
|
|
|
+//// MesClient.status_menu.setText("B件提交成功");
|
|
|
+//// MesClient.resetScanB();
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
public static void getStatusA(S7PLC s7PLC){
|
|
|
if(MesClient.tjFlaga == 1){ // 已扫码,设备未运行
|
|
|
@@ -273,7 +273,7 @@ public class PlcUtil {
|
|
|
public static Boolean changeEnable(S7PLC s7PLC,Boolean result){
|
|
|
try{
|
|
|
//DB9.21.7 A//DB9.26.4 B
|
|
|
- s7PLC.writeBoolean("DB9.23.7",result);
|
|
|
+ s7PLC.writeBoolean("DB9.30.4",result);
|
|
|
// s7PLC.writeBoolean("DB9.21.7",result);
|
|
|
return true;
|
|
|
}catch (Exception e){
|