|
|
@@ -134,7 +134,16 @@ public class WorkJPanelOP40 extends JPanel {
|
|
|
JdbcUtils.setCache(cacheName, JSON.toJSONString(cacheData));
|
|
|
}
|
|
|
|
|
|
- if(position.equals("A") || position.equals("B") || position.equals("C") || position.equals("D") || position.equals("E") || position.equals("F")){
|
|
|
+ // A/B/C 由 mes.side 切换东西侧;D-F 西 / G-L 东 逻辑保留
|
|
|
+ if(position.equals("A") || position.equals("B") || position.equals("C")){
|
|
|
+ if(MesClient.isEastSide()){
|
|
|
+ s7PLC = new S7PLC(EPlcType.S1500, plcIp2);
|
|
|
+ isScan = 2;
|
|
|
+ }else{
|
|
|
+ s7PLC = new S7PLC(EPlcType.S1500, plcIp1);
|
|
|
+ isScan = 1;
|
|
|
+ }
|
|
|
+ }else if(position.equals("D") || position.equals("E") || position.equals("F")){
|
|
|
s7PLC = new S7PLC(EPlcType.S1500, plcIp1);
|
|
|
isScan = 1;
|
|
|
}else{
|
|
|
@@ -300,20 +309,20 @@ public class WorkJPanelOP40 extends JPanel {
|
|
|
|
|
|
feedinglabel = new JLabel("请求上料");
|
|
|
feedinglabel.setHorizontalAlignment(SwingConstants.LEFT);
|
|
|
- feedinglabel.setIcon(imageGreen);
|
|
|
+ feedinglabel.setIcon(imageGray); // 默认 0,等 PLC 轮询后再亮
|
|
|
feedinglabel.setForeground(Color.BLACK);
|
|
|
feedinglabel.setBounds(0, 150, workWidth/3, 30);
|
|
|
this.add(feedinglabel);
|
|
|
|
|
|
- feedingmeslabel = new JLabel("MES扫码反馈");
|
|
|
+ feedingmeslabel = new JLabel("MES允许上料");
|
|
|
feedingmeslabel.setHorizontalAlignment(SwingConstants.LEFT);
|
|
|
- feedingmeslabel.setIcon(imageGreen);
|
|
|
+ feedingmeslabel.setIcon(imageGray);
|
|
|
feedingmeslabel.setForeground(Color.BLACK);
|
|
|
feedingmeslabel.setBounds(workWidth/3, 150, workWidth/3, 30);
|
|
|
feedingmeslabel.addMouseListener(new MouseAdapter() {
|
|
|
public void mouseClicked(MouseEvent e) {
|
|
|
boolean ret = readAllowFeeding();
|
|
|
- int choice = JOptionPane.showConfirmDialog(null, "确定修改MES扫码反馈结果为"+(ret?"false":"true")+"吗?", "操作确认", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
|
|
|
+ int choice = JOptionPane.showConfirmDialog(null, "确定修改MES允许上料结果为"+(ret?"false":"true")+"吗?", "操作确认", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
|
|
|
if (choice == JOptionPane.YES_OPTION) {
|
|
|
writeAllowFeeding(!ret);
|
|
|
}
|
|
|
@@ -323,28 +332,28 @@ public class WorkJPanelOP40 extends JPanel {
|
|
|
|
|
|
runlabel = new JLabel("设备运行中");
|
|
|
runlabel.setHorizontalAlignment(SwingConstants.LEFT);
|
|
|
- runlabel.setIcon(imageGreen);
|
|
|
+ runlabel.setIcon(imageGray);
|
|
|
runlabel.setForeground(Color.BLACK);
|
|
|
runlabel.setBounds(workWidth*2/3, 150, workWidth/3, 30);
|
|
|
this.add(runlabel);
|
|
|
|
|
|
blankinglabel = new JLabel("下料请求");
|
|
|
blankinglabel.setHorizontalAlignment(SwingConstants.LEFT);
|
|
|
- blankinglabel.setIcon(imageGreen);
|
|
|
+ blankinglabel.setIcon(imageGray);
|
|
|
blankinglabel.setForeground(Color.BLACK);
|
|
|
blankinglabel.setBounds(0, 190, workWidth/3, 30);
|
|
|
this.add(blankinglabel);
|
|
|
|
|
|
- blankingmeslabel = new JLabel("MES下料反馈");
|
|
|
+ blankingmeslabel = new JLabel("MES允许下料");
|
|
|
blankingmeslabel.setHorizontalAlignment(SwingConstants.LEFT);
|
|
|
- blankingmeslabel.setIcon(imageGreen);
|
|
|
+ blankingmeslabel.setIcon(imageGray);
|
|
|
blankingmeslabel.setForeground(Color.BLACK);
|
|
|
blankingmeslabel.setBounds(workWidth/3, 190, workWidth/3, 30);
|
|
|
this.add(blankingmeslabel);
|
|
|
blankingmeslabel.addMouseListener(new MouseAdapter() {
|
|
|
public void mouseClicked(MouseEvent e) {
|
|
|
boolean ret = readAllowBlanking();
|
|
|
- int choice = JOptionPane.showConfirmDialog(null, "确定修改MES下料反馈结果为"+(ret?"false":"true")+"吗?", "操作确认", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
|
|
|
+ int choice = JOptionPane.showConfirmDialog(null, "确定修改MES允许下料结果为"+(ret?"false":"true")+"吗?", "操作确认", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
|
|
|
if (choice == JOptionPane.YES_OPTION) {
|
|
|
writeAllowBlanking(!ret);
|
|
|
}
|
|
|
@@ -353,14 +362,14 @@ public class WorkJPanelOP40 extends JPanel {
|
|
|
|
|
|
feedingtodevicelabel = new JLabel("上料到设备");
|
|
|
feedingtodevicelabel.setHorizontalAlignment(SwingConstants.LEFT);
|
|
|
- feedingtodevicelabel.setIcon(imageGreen);
|
|
|
+ feedingtodevicelabel.setIcon(imageGray);
|
|
|
feedingtodevicelabel.setForeground(Color.BLACK);
|
|
|
feedingtodevicelabel.setBounds(workWidth*2/3, 190, workWidth/3, 30);
|
|
|
this.add(feedingtodevicelabel);
|
|
|
|
|
|
feedingtotransferlabel = new JLabel("上料到中转车");
|
|
|
feedingtotransferlabel.setHorizontalAlignment(SwingConstants.LEFT);
|
|
|
- feedingtotransferlabel.setIcon(imageGreen);
|
|
|
+ feedingtotransferlabel.setIcon(imageGray);
|
|
|
feedingtotransferlabel.setForeground(Color.BLACK);
|
|
|
feedingtotransferlabel.setBounds(0, 230, workWidth/3, 30);
|
|
|
this.add(feedingtotransferlabel);
|
|
|
@@ -368,7 +377,7 @@ public class WorkJPanelOP40 extends JPanel {
|
|
|
|
|
|
transfertodevicelabel = new JLabel("中转车上料到设备");
|
|
|
transfertodevicelabel.setHorizontalAlignment(SwingConstants.LEFT);
|
|
|
- transfertodevicelabel.setIcon(imageGreen);
|
|
|
+ transfertodevicelabel.setIcon(imageGray);
|
|
|
transfertodevicelabel.setForeground(Color.BLACK);
|
|
|
transfertodevicelabel.setBounds(workWidth/3, 230, workWidth/3, 30);
|
|
|
this.add(transfertodevicelabel);
|
|
|
@@ -487,14 +496,11 @@ public class WorkJPanelOP40 extends JPanel {
|
|
|
Boolean retFeedingAllow = readAllowFeeding();
|
|
|
feedingmeslabel.setIcon(retFeedingAllow?imageGreen:imageGray);
|
|
|
|
|
|
+ // 与 auto3 一致:PLC 不再请求上料时,清掉 MES 允许上料,避免信号粘滞
|
|
|
if(!retFeeding && retFeedingAllow){
|
|
|
writeAllowFeeding(false);
|
|
|
}
|
|
|
|
|
|
- if(retFeeding){
|
|
|
- writeAllowFeeding(true);
|
|
|
- }
|
|
|
-
|
|
|
Boolean retBlanking = readBlanking();
|
|
|
blankinglabel.setIcon(retBlanking?imageGreen:imageGray);
|
|
|
|
|
|
@@ -517,8 +523,10 @@ public class WorkJPanelOP40 extends JPanel {
|
|
|
Boolean retRunning = readRunning();
|
|
|
runlabel.setIcon(retRunning?imageGreen:imageGray);
|
|
|
|
|
|
+ // 无加工码却请求下料:允许下料并复位,防止死锁(对齐 auto3)
|
|
|
if(retBlanking && productSn.getText().isEmpty()){
|
|
|
writeAllowBlanking(true);
|
|
|
+ resetBlanking();
|
|
|
}
|
|
|
|
|
|
// 只在状态变化时打印日志,减少日志量
|
|
|
@@ -554,35 +562,16 @@ public class WorkJPanelOP40 extends JPanel {
|
|
|
}
|
|
|
|
|
|
|
|
|
- if(MesClient.transferEnabled && plcDb.equals("DB7005") && toTransfer){
|
|
|
- // 工位F/L且去中转车:触发中转车扫码流程(码赋值给中转车,不影响工位6)
|
|
|
- log.info("[{}]tjFeedingFlag=0且retFeeding=true且toTransfer=true,触发中转车扫码", oprno+pos);
|
|
|
- barCodeForTransfer();
|
|
|
- }
|
|
|
-
|
|
|
if(tjFeedingFlag == 0){
|
|
|
- if((toDevice || transferToDevice) && !retRunning){
|
|
|
+ if(retFeeding){
|
|
|
if(MesClient.transferEnabled && plcDb.equals("DB7005") && toTransfer){
|
|
|
-// // 工位F/L且去中转车:触发中转车扫码流程(码赋值给中转车,不影响工位6)
|
|
|
-// log.info("[{}]tjFeedingFlag=0且retFeeding=true且toTransfer=true,触发中转车扫码", oprno+pos);
|
|
|
-// barCodeForTransfer();
|
|
|
+ log.info("[{}]tjFeedingFlag=0且retFeeding=true且toTransfer=true,触发中转车扫码", oprno+pos);
|
|
|
+ barCodeForTransfer();
|
|
|
} else {
|
|
|
- // 正常工位加工:触发工位扫码流程
|
|
|
- log.info("[{}]tjFeedingFlag=0且retFeeding=true,触发工位扫码", oprno+pos);
|
|
|
+ log.info("[{}]tjFeedingFlag=0且retFeeding=true,触发工位取码", oprno+pos);
|
|
|
barCode();
|
|
|
}
|
|
|
}
|
|
|
- /*if(retFeeding){
|
|
|
- if(plcDb.equals("DB7005") && toTransfer){
|
|
|
-// // 工位F/L且去中转车:触发中转车扫码流程(码赋值给中转车,不影响工位6)
|
|
|
-// log.info("[{}]tjFeedingFlag=0且retFeeding=true且toTransfer=true,触发中转车扫码", oprno+pos);
|
|
|
-// barCodeForTransfer();
|
|
|
- } else {
|
|
|
- // 正常工位加工:触发工位扫码流程
|
|
|
- log.info("[{}]tjFeedingFlag=0且retFeeding=true,触发工位扫码", oprno+pos);
|
|
|
- barCode();
|
|
|
- }
|
|
|
- }*/
|
|
|
|
|
|
}else if(tjFeedingFlag == 1){
|
|
|
if(tjFlag == 0 && retRunning){
|
|
|
@@ -602,17 +591,15 @@ public class WorkJPanelOP40 extends JPanel {
|
|
|
log.info("[{}]提交中转台数据...", oprno+pos);
|
|
|
JSONObject retObj = DataUtil.saveSn(oprno+pos,productSnFeeding.getText().trim(),transferSn,transferFloor,MesClient.user_menu.getText());
|
|
|
log.info("[{}]中转台提交结果: {}", oprno+pos, retObj);
|
|
|
- if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
- tjTransferStatus = 0; // 提交成功,重置状态
|
|
|
+ if(retObj != null && retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
+ tjTransferStatus = 0;
|
|
|
resetFeeding();
|
|
|
}else{
|
|
|
- tjTransferStatus = 0; // 提交失败,重置状态允许重试
|
|
|
- if(retObj.get("result")==null){
|
|
|
+ tjTransferStatus = 0;
|
|
|
+ if(retObj == null || retObj.get("result")==null){
|
|
|
setMenuStatus("请求失败,请重试",-1);
|
|
|
- }else{
|
|
|
- if(retObj.get("result").toString().equalsIgnoreCase("false")){
|
|
|
- setMenuStatus(retObj.getString("message"),-1);
|
|
|
- }
|
|
|
+ }else if(retObj.get("result").toString().equalsIgnoreCase("false")){
|
|
|
+ setMenuStatus(retObj.getString("message"),-1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -638,14 +625,10 @@ public class WorkJPanelOP40 extends JPanel {
|
|
|
|
|
|
}
|
|
|
}else if(tjFlag == 2){
|
|
|
- if(!retRunning || retBlanking){ // 提交结果
|
|
|
+ // 与 auto3 一致:只认 PLC 请求下料,不停机即报工
|
|
|
+ if(retBlanking){
|
|
|
upResult();
|
|
|
}
|
|
|
- // 只在状态变化时打印,避免日志过多
|
|
|
- // log.info("[{}]tjFlag=2, 等待下料信号, retBlanking={}", oprno+pos, retBlanking);
|
|
|
-// if(retBlanking){
|
|
|
-// upResult();
|
|
|
-// }
|
|
|
}else if(tjFlag == 3){
|
|
|
// 只在状态变化时打印,避免日志过多
|
|
|
// log.info("[{}]tjFlag=3, 等待上传完成重置, tjQualityStatus={}", oprno+pos, tjQualityStatus);
|
|
|
@@ -658,54 +641,48 @@ public class WorkJPanelOP40 extends JPanel {
|
|
|
log.error(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
- }, 100,3000);
|
|
|
+ }, 100,1500);
|
|
|
}
|
|
|
|
|
|
public void upResult(){
|
|
|
- log.info("[{}]tjFlag 2->3,收到下料信号,准备上传结果, tjQualityStatus={}", oprno+pos, tjQualityStatus);
|
|
|
+ if(tjQualityStatus == 1){
|
|
|
+ log.info("[{}]tjQualityStatus=1,跳过上传(已在上传中)", oprno+pos);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String sn = productSn.getText() == null ? "" : productSn.getText().trim();
|
|
|
+ if(sn.isEmpty() || sn.equals("空结果")){
|
|
|
+ log.warn("[{}]下料时加工码为空,允许下料并复位", oprno+pos);
|
|
|
+ writeAllowBlanking(true);
|
|
|
+ resetBlanking();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ log.info("[{}]tjFlag 2->3,收到下料信号,准备上传结果, sn={}", oprno+pos, sn);
|
|
|
tjFlag = 3;
|
|
|
- tjQualityStatus = 0; // 强制重置,确保能触发上传
|
|
|
+ tjQualityStatus = 1;
|
|
|
setMenuStatus("工件加工结束,结果上传中", 0);
|
|
|
-
|
|
|
- if(tjQualityStatus == 0){
|
|
|
- tjQualityStatus = 1;
|
|
|
-// log.info("[{}]开始异步上传质量数据, productSn={}", oprno+pos, productSn.getText());
|
|
|
- log.info("[{}]开始上传质量数据, productSn={}", oprno+pos, productSn.getText());
|
|
|
-
|
|
|
- // 异步执行上传任务,防止阻塞
|
|
|
-// ExecutorService executor = Executors.newCachedThreadPool();
|
|
|
-// executor.submit(() -> {
|
|
|
- // 你的异步任务代码
|
|
|
- log.info("["+oprno+pos+"]质量上传任务开始, sn="+productSn.getText());
|
|
|
- try {
|
|
|
- JSONObject retObj = DataUtil.sendQuality(productSn.getText(),oprno+pos,"OK",MesClient.user_menu.getText());
|
|
|
- log.info("["+oprno+pos+"]质量上传返回结果: "+retObj);
|
|
|
- if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
- log.info("["+oprno+pos+"]质量上传成功,执行resetBlanking");
|
|
|
- resetBlanking();
|
|
|
+ try {
|
|
|
+ JSONObject retObj = DataUtil.sendQuality(sn, oprno+pos, "OK", MesClient.user_menu.getText());
|
|
|
+ log.info("[{}]质量上传返回结果: {}", oprno+pos, retObj);
|
|
|
+ if(retObj != null && retObj.get("result") != null
|
|
|
+ && retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
+ log.info("[{}]质量上传成功,执行resetBlanking", oprno+pos);
|
|
|
+ resetBlanking();
|
|
|
+ }else{
|
|
|
+ tjQualityStatus = 0;
|
|
|
+ tjFlag = 2;
|
|
|
+ if(retObj == null || retObj.get("result") == null){
|
|
|
+ log.error("[{}]质量上传失败,result为null", oprno+pos);
|
|
|
+ setMenuStatus("请求失败,请重试", -1);
|
|
|
}else{
|
|
|
- tjQualityStatus = 0; // 上传失败,重置状态允许重试
|
|
|
- if(retObj.get("result")==null){
|
|
|
- log.error("["+oprno+pos+"]质量上传失败,result为null");
|
|
|
- setMenuStatus("请求失败,请重试",-1);
|
|
|
- }else{
|
|
|
- if(retObj.get("result").toString().equalsIgnoreCase("false")){
|
|
|
- log.error("["+oprno+pos+"]质量上传失败: "+retObj.getString("message"));
|
|
|
- setMenuStatus(retObj.getString("message"),-1);
|
|
|
- }
|
|
|
- }
|
|
|
+ log.error("[{}]质量上传失败: {}", oprno+pos, retObj.getString("message"));
|
|
|
+ setMenuStatus(retObj.getString("message"), -1);
|
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
- tjQualityStatus = 0; // 异常时重置状态允许重试
|
|
|
- log.error("["+oprno+pos+"]质量上传异常: "+e.getMessage(), e);
|
|
|
- Thread.currentThread().interrupt();
|
|
|
}
|
|
|
- log.info("["+oprno+pos+"]质量上传任务结束");
|
|
|
-// });
|
|
|
- // 关闭ExecutorService,不再接受新任务,等待已提交的任务完成
|
|
|
-// executor.shutdown();
|
|
|
- }else{
|
|
|
- log.info("[{}]tjQualityStatus={},跳过上传(已在上传中)", oprno+pos, tjQualityStatus);
|
|
|
+ } catch (Exception e) {
|
|
|
+ tjQualityStatus = 0;
|
|
|
+ tjFlag = 2;
|
|
|
+ log.error("[{}]质量上传异常: {}", oprno+pos, e.getMessage(), e);
|
|
|
+ setMenuStatus("请求失败,请重试", -1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -714,58 +691,47 @@ public class WorkJPanelOP40 extends JPanel {
|
|
|
return;
|
|
|
}
|
|
|
String sn = readQrcode();
|
|
|
- if(sn.equals("")){
|
|
|
- if(productSnFeeding.getText().isEmpty()){
|
|
|
- scanRetryCount++;
|
|
|
- if(scanRetryCount > MAX_SCAN_RETRY){
|
|
|
- productSnFeeding.setText("空结果");
|
|
|
- this.setMenuStatus("扫码失败(已重试" + scanRetryCount + "次),请人工处理", -1);
|
|
|
- log.warn("[{}]扫码失败,已达最大重试次数,等待人工处理", oprno+pos);
|
|
|
- }else{
|
|
|
- this.setMenuStatus("扫码结果为空,准备重试(第" + scanRetryCount + "次)", -1);
|
|
|
- log.info("[{}]扫码结果为空,将在下次轮询时重试(第{}次)", oprno+pos, scanRetryCount);
|
|
|
- }
|
|
|
- }
|
|
|
+ if(sn == null){
|
|
|
+ sn = "";
|
|
|
+ }
|
|
|
+ sn = sn.trim();
|
|
|
+ if(sn.isEmpty()){
|
|
|
+ // 对齐 auto3:码未就绪不写死「空结果」,下个轮询继续取
|
|
|
+ setMenuStatus("等待扫码站扫码", 0);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ productSnFeeding.setText(sn);
|
|
|
+ lastSn = sn;
|
|
|
+ consumeScanSn(sn);
|
|
|
+ JSONObject retObj = DataUtil.checkQuality(sn, oprno+pos, MesClient.user_menu.getText());
|
|
|
+ if(retObj != null && retObj.get("result") != null
|
|
|
+ && retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
+ tjFeedingFlag = 1;
|
|
|
+ scanRetryCount = 0;
|
|
|
+ setMenuStatus("工件可以加工", 0);
|
|
|
+ writeAllowFeeding(true);
|
|
|
}else{
|
|
|
- productSnFeeding.setText(sn);
|
|
|
- lastSn = sn;
|
|
|
- // 查询工件质量
|
|
|
- JSONObject retObj = DataUtil.checkQuality(sn,oprno+pos,MesClient.user_menu.getText());
|
|
|
- if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
- tjFeedingFlag = 1;//可加工
|
|
|
- scanRetryCount = 0; // 成功后重置重试计数
|
|
|
- setMenuStatus("工件可以加工", 0);
|
|
|
- writeAllowFeeding(true);
|
|
|
-// resetFeedingBtn.setEnabled(false);
|
|
|
+ writeAllowFeeding(false);
|
|
|
+ resetFeedingBtn.setEnabled(true);
|
|
|
+ if(retObj == null || retObj.get("result") == null){
|
|
|
+ setMenuStatus("请求失败,请重试", -1);
|
|
|
}else{
|
|
|
- writeAllowFeeding(false);
|
|
|
- resetFeedingBtn.setEnabled(true);
|
|
|
- // 网络失败时清空productSnFeeding,允许重试
|
|
|
-// scanRetryCount++;
|
|
|
-// if(scanRetryCount > MAX_SCAN_RETRY){
|
|
|
-// log.warn("[{}]checkQuality失败,已达最大重试次数({}次),等待人工处理, sn={}", oprno+pos, scanRetryCount, sn);
|
|
|
-// if(retObj.get("result")==null){
|
|
|
-// setMenuStatus("请求超时(已重试" + scanRetryCount + "次),请人工处理",-1);
|
|
|
-// }else{
|
|
|
-// if(retObj.get("result").toString().equalsIgnoreCase("false")){
|
|
|
-// setMenuStatus(retObj.getString("message"),-1);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }else{
|
|
|
-// log.info("[{}]checkQuality失败,清空productSnFeeding准备重试(第{}次), sn={}", oprno+pos, scanRetryCount, sn);
|
|
|
-// productSnFeeding.setText(""); // 清空,允许下次轮询重新扫码
|
|
|
-// if(retObj.get("result")==null){
|
|
|
-// setMenuStatus("请求超时,准备重试(第" + scanRetryCount + "次)",-1);
|
|
|
-// }else{
|
|
|
-// if(retObj.get("result").toString().equalsIgnoreCase("false")){
|
|
|
-// setMenuStatus(retObj.getString("message") + ",准备重试",-1);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
+ setMenuStatus(retObj.getString("message"), -1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void consumeScanSn(String sn){
|
|
|
+ if(sn == null || sn.isEmpty()){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(isScan == 1 && sn.equals(MesClient.scanSnA)){
|
|
|
+ MesClient.scanSnA = "";
|
|
|
+ }else if(isScan == 2 && sn.equals(MesClient.scanSnB)){
|
|
|
+ MesClient.scanSnB = "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 专门给中转车扫码的方法(仅工位F/L使用)
|
|
|
* 触发摄像头扫码,但码赋值给中转车的productSnFeeding,不影响工位6的状态
|
|
|
@@ -1101,32 +1067,24 @@ public class WorkJPanelOP40 extends JPanel {
|
|
|
log.info("[{}]中转车上料到设备: transferSn={}, transferFloor={}", oprno+pos, transferSn, transferFloor);
|
|
|
JSONObject retObj = DataUtil.getSn(oprno+pos,transferSn,transferFloor,MesClient.user_menu.getText());
|
|
|
log.info("[{}]getSn返回结果: {}", oprno+pos, retObj);
|
|
|
- if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
+ if(retObj != null && retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
sn = retObj.getString("data");
|
|
|
log.info("[{}]中转车获取到工件码: {}", oprno+pos, sn);
|
|
|
this.setMenuStatus("允许工件加工",0);
|
|
|
-// writeAllowFeeding(true);
|
|
|
}else{
|
|
|
-// writeAllowFeeding(false);
|
|
|
- if(retObj.get("result")==null){
|
|
|
+ if(retObj == null || retObj.get("result")==null){
|
|
|
log.error("[{}]getSn失败: result为null", oprno+pos);
|
|
|
this.setMenuStatus("请求失败,请重试",-1);
|
|
|
- }else{
|
|
|
- if(retObj.get("result").toString().equalsIgnoreCase("false")){
|
|
|
- log.error("[{}]getSn失败: {}", oprno+pos, retObj.getString("message"));
|
|
|
- this.setMenuStatus(retObj.getString("message"),-1);
|
|
|
- }
|
|
|
+ }else if(retObj.get("result").toString().equalsIgnoreCase("false")){
|
|
|
+ log.error("[{}]getSn失败: {}", oprno+pos, retObj.getString("message"));
|
|
|
+ this.setMenuStatus(retObj.getString("message"),-1);
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
if(isScan == 1){
|
|
|
- log.info("[{}]触发西侧摄像头扫码", oprno+pos);
|
|
|
-// sn = MesClient.scanQrcode1();
|
|
|
- sn = MesClient.scanSnA;
|
|
|
+ sn = MesClient.scanSnA == null ? "" : MesClient.scanSnA;
|
|
|
}else{
|
|
|
- log.info("[{}]触发东侧摄像头扫码", oprno+pos);
|
|
|
- sn = MesClient.scanSnB;
|
|
|
-// sn = MesClient.scanQrcode2();
|
|
|
+ sn = MesClient.scanSnB == null ? "" : MesClient.scanSnB;
|
|
|
}
|
|
|
}
|
|
|
log.info("[{}]扫码完成,结果: {}", oprno+pos, sn);
|
|
|
@@ -1184,10 +1142,11 @@ public class WorkJPanelOP40 extends JPanel {
|
|
|
|
|
|
// 获取工位站点标注
|
|
|
private String getStationLabel(String position) {
|
|
|
+ String side = MesClient.isEastSide() ? "东侧" : "西侧";
|
|
|
switch (position) {
|
|
|
- case "A": return "西侧1号机";
|
|
|
- case "B": return "西侧2号机";
|
|
|
- case "C": return "西侧3号机";
|
|
|
+ case "A": return side + "1号机";
|
|
|
+ case "B": return side + "2号机";
|
|
|
+ case "C": return side + "3号机";
|
|
|
case "D": return "西侧4号机";
|
|
|
case "E": return "西侧5号机";
|
|
|
case "F": return "西侧6号机";
|