|
|
@@ -15,21 +15,6 @@ import java.util.Arrays;
|
|
|
public class PlcUtil {
|
|
|
|
|
|
public static void getParamDyDl(S7PLC s7PLC){
|
|
|
- Boolean starta = s7PLC.readBoolean("DB1.2.2"); //A启动中
|
|
|
- Boolean startb = s7PLC.readBoolean("DB1.2.3"); //B启动中
|
|
|
-
|
|
|
- String oprno = MesClient.mes_gw+"A";
|
|
|
- if(startb){
|
|
|
- oprno = MesClient.mes_gw+"B";
|
|
|
- }
|
|
|
- if(MesClient.mes_gwflag.equals("B")){
|
|
|
- if(oprno.equals(MesClient.mes_gw+"A")){
|
|
|
- oprno = MesClient.mes_gw+"C";
|
|
|
- }else{
|
|
|
- oprno = MesClient.mes_gw+"D";
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
if(MesClient.tjFlaga == 2 || MesClient.tjFlagb == 2){ //运行中
|
|
|
Float dya = s7PLC.readFloat32("DB1010.2");
|
|
|
Float dla = s7PLC.readFloat32("DB1010.8");
|
|
|
@@ -60,6 +45,7 @@ public class PlcUtil {
|
|
|
|
|
|
if(MesClient.hjparams.size() == 60){
|
|
|
try{
|
|
|
+ String oprno = MesClient.curFlag.equals("A") ? MesClient.PANEL_OPR_A : MesClient.PANEL_OPR_B;
|
|
|
if(MesClient.curFlag.equals("A")){
|
|
|
JdbcUtils.insertCmtData(oprno,MesClient.mes_line_sn,MesClient.product_sn.getText(), JSON.toJSONString(MesClient.hjparams));
|
|
|
}else{
|
|
|
@@ -82,7 +68,7 @@ public class PlcUtil {
|
|
|
if(starta){
|
|
|
MesClient.curFlag = "A";
|
|
|
MesClient.tjFlaga = 2;
|
|
|
- MesClient.pxstatus1.setText("A:设备运行中");
|
|
|
+ MesClient.pxstatus1.setText(MesClient.PANEL_LABEL_A + ":设备运行中");
|
|
|
PlcUtil.changeEnable(MesClient.s7PLC,false);
|
|
|
}
|
|
|
}else if(MesClient.tjFlaga == 2){ // 运行中
|
|
|
@@ -91,22 +77,22 @@ public class PlcUtil {
|
|
|
Boolean startb = s7PLC.readBoolean("DB1.2.3"); //B启动中
|
|
|
if(starta || startb){ // B启动中,A当做完成
|
|
|
MesClient.tjFlaga = 3;
|
|
|
- MesClient.pxstatus1.setText("A:设备运行结束,提交结果中");
|
|
|
+ MesClient.pxstatus1.setText(MesClient.PANEL_LABEL_A + ":设备运行结束,提交结果中");
|
|
|
MesClient.finish_ok_bt.setEnabled(true);
|
|
|
|
|
|
Boolean sendret = DataUtil.sendQuality(MesClient.nettyClient,MesClient.product_sn.getText(),"OK",MesClient.user20,"A");
|
|
|
if(!sendret){
|
|
|
- MesClient.pxstatus1.setText("A:结果上传MES失败");
|
|
|
+ MesClient.pxstatus1.setText(MesClient.PANEL_LABEL_A + ":结果上传MES失败");
|
|
|
MesClient.tjStatusa = 1;
|
|
|
}else{
|
|
|
-// MesClient.pxstatus1.setText("A:提交成功");
|
|
|
+// MesClient.pxstatus1.setText(MesClient.PANEL_LABEL_A + ":提交成功");
|
|
|
// MesClient.status_menu.setText("A件提交成功");
|
|
|
// MesClient.resetScanA();
|
|
|
}
|
|
|
}
|
|
|
// Boolean sa = s7PLC.readBoolean("DB1.2.2"); //A启动中
|
|
|
// if(!sa){
|
|
|
-// MesClient.pxstatus1.setText("A:设备运行停止");
|
|
|
+// MesClient.pxstatus1.setText(MesClient.PANEL_LABEL_A + ":设备运行停止");
|
|
|
// MesClient.finish_ok_bt.setEnabled(true);
|
|
|
// }
|
|
|
}
|
|
|
@@ -131,7 +117,7 @@ public class PlcUtil {
|
|
|
MesClient.getUser();
|
|
|
Boolean sendret = DataUtil.checkQuality(MesClient.nettyClient,snb,MesClient.user20,"B");
|
|
|
if(!sendret){
|
|
|
- MesClient.pxstatus2.setText("B:查询质量失败");
|
|
|
+ MesClient.pxstatus2.setText(MesClient.PANEL_LABEL_B + ":查询质量失败");
|
|
|
MesClient.checkB = 0;
|
|
|
}
|
|
|
}
|
|
|
@@ -143,7 +129,7 @@ public class PlcUtil {
|
|
|
if(startb){
|
|
|
MesClient.curFlag = "B";
|
|
|
MesClient.tjFlagb = 2;
|
|
|
- MesClient.pxstatus2.setText("B:设备运行中");
|
|
|
+ MesClient.pxstatus2.setText(MesClient.PANEL_LABEL_B + ":设备运行中");
|
|
|
PlcUtil.changeEnable(MesClient.s7PLC,false);
|
|
|
}
|
|
|
}else if(MesClient.tjFlagb == 2){ // 运行中
|
|
|
@@ -152,15 +138,15 @@ public class PlcUtil {
|
|
|
Boolean startb = s7PLC.readBoolean("DB1.2.2"); //A启动中
|
|
|
if(starta || startb){
|
|
|
MesClient.tjFlagb = 3;
|
|
|
- MesClient.pxstatus2.setText("B:设备运行结束,提交结果中");
|
|
|
+ MesClient.pxstatus2.setText(MesClient.PANEL_LABEL_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.pxstatus2.setText(MesClient.PANEL_LABEL_B + ":结果上传MES失败");
|
|
|
MesClient.tjStatusb = 1;
|
|
|
}else{
|
|
|
-// MesClient.pxstatus2.setText("B:提交成功");
|
|
|
+// MesClient.pxstatus2.setText(MesClient.PANEL_LABEL_B + ":提交成功");
|
|
|
// MesClient.status_menu.setText("B件提交成功");
|
|
|
// MesClient.resetScanB();
|
|
|
}
|
|
|
@@ -174,7 +160,7 @@ public class PlcUtil {
|
|
|
if(starta){
|
|
|
MesClient.curFlag = "A";
|
|
|
MesClient.tjFlaga = 2;
|
|
|
- MesClient.pxstatus1.setText("A:设备运行中");
|
|
|
+ MesClient.pxstatus1.setText(MesClient.PANEL_LABEL_A + ":设备运行中");
|
|
|
// MesClient.formatScanType(1);
|
|
|
// MesClient.batch_scan_1.setEnabled(false);
|
|
|
PlcUtil.changeEnable(s7PLC,false);
|
|
|
@@ -183,13 +169,13 @@ public class PlcUtil {
|
|
|
Boolean afinish = getAFinish(s7PLC); //A焊接完成
|
|
|
if(afinish){ // B启动中,A当做完成
|
|
|
MesClient.tjFlaga = 3;
|
|
|
- MesClient.pxstatus1.setText("A:设备运行结束,提交结果中");
|
|
|
+ MesClient.pxstatus1.setText(MesClient.PANEL_LABEL_A + ":设备运行结束,提交结果中");
|
|
|
MesClient.finish_ok_bt.setEnabled(true);
|
|
|
MesClient.finish_ng_bt.setEnabled(true);
|
|
|
|
|
|
Boolean sendret = DataUtil.sendQuality(MesClient.nettyClient,MesClient.product_sn.getText(),"OK",MesClient.user20,"A");
|
|
|
if(!sendret){
|
|
|
- MesClient.pxstatus1.setText("A:结果上传MES失败");
|
|
|
+ MesClient.pxstatus1.setText(MesClient.PANEL_LABEL_A + ":结果上传MES失败");
|
|
|
MesClient.tjStatusa = 1;
|
|
|
}
|
|
|
}
|
|
|
@@ -202,7 +188,7 @@ public class PlcUtil {
|
|
|
if(startb){
|
|
|
MesClient.curFlag = "B";
|
|
|
MesClient.tjFlagb = 2;
|
|
|
- MesClient.pxstatus2.setText("B:设备运行中");
|
|
|
+ MesClient.pxstatus2.setText(MesClient.PANEL_LABEL_B + ":设备运行中");
|
|
|
MesClient.batch_scan_2.setEnabled(false);
|
|
|
MesClient.formatScanType(1);
|
|
|
PlcUtil.changeEnable(s7PLC,false);
|
|
|
@@ -211,13 +197,13 @@ public class PlcUtil {
|
|
|
Boolean bfinish = getBFinish(s7PLC); //B焊接完成
|
|
|
if(bfinish){
|
|
|
MesClient.tjFlagb = 3;
|
|
|
- MesClient.pxstatus2.setText("B:设备运行结束,提交结果中");
|
|
|
+ MesClient.pxstatus2.setText(MesClient.PANEL_LABEL_B + ":设备运行结束,提交结果中");
|
|
|
MesClient.finish_ng_bt2.setEnabled(true);
|
|
|
MesClient.finish_ok_bt2.setEnabled(true);
|
|
|
|
|
|
Boolean sendret = DataUtil.sendQuality(MesClient.nettyClient,MesClient.product_sn2.getText(),"OK",MesClient.user20,"B");
|
|
|
if(!sendret){
|
|
|
- MesClient.pxstatus2.setText("B:结果上传MES失败");
|
|
|
+ MesClient.pxstatus2.setText(MesClient.PANEL_LABEL_B + ":结果上传MES失败");
|
|
|
MesClient.tjStatusb = 1;
|
|
|
}
|
|
|
}
|
|
|
@@ -274,7 +260,7 @@ public class PlcUtil {
|
|
|
try{
|
|
|
//DB9.21.7 A//DB9.26.4 B
|
|
|
System.out.println("调用允许启动");
|
|
|
- s7PLC.writeBoolean("DB9.30.4",result);// 100CD 120CD
|
|
|
+ s7PLC.writeBoolean("DB9.26.4",result);// 100CD 120CD
|
|
|
// s7PLC.writeBoolean("DB9.26.4",result);
|
|
|
// s7PLC.writeBoolean("DB9.21.7",result);
|
|
|
return true;
|
|
|
@@ -286,11 +272,11 @@ public class PlcUtil {
|
|
|
|
|
|
// 获取当前是A面还是B面
|
|
|
public static String getCurAside(S7PLC s7PLC){//120A
|
|
|
- String str = "B";
|
|
|
+ String str = "A";
|
|
|
try{
|
|
|
Boolean ret = s7PLC.readBoolean("DB1.2.0"); // 当前A面
|
|
|
if(!ret){
|
|
|
- str = "A";
|
|
|
+ str = "B";
|
|
|
}
|
|
|
|
|
|
}catch (Exception e){
|
|
|
@@ -300,11 +286,11 @@ public class PlcUtil {
|
|
|
}
|
|
|
|
|
|
public static String getCurAsideOther(S7PLC s7PLC){//120A
|
|
|
- String str = "A";
|
|
|
+ String str = "B";
|
|
|
try{
|
|
|
Boolean ret = s7PLC.readBoolean("DB1.2.0"); // 当前A面
|
|
|
if(!ret){
|
|
|
- str = "B";
|
|
|
+ str = "A";
|
|
|
}
|
|
|
|
|
|
}catch (Exception e){
|