Kaynağa Gözat

刷新后删除工位当前工件码

dkk 2 hafta önce
ebeveyn
işleme
dc28c1bf16

+ 13 - 1
src/com/mes/ui/DataUtil.java

@@ -17,13 +17,25 @@ import java.util.Properties;
 public class DataUtil {
     public static final Logger log = LoggerFactory.getLogger(DataUtil.class);
 
+    //删除当前工位工件码
+    public static JSONObject delCurSn(String oprno,String serverIp,String lineSn){
+        try {
+            String url = "http://"+serverIp+":8980/js/a/mes/mesProductRecord/cancelCurSn";
+            String params = "__ajax=json&oprno="+oprno+"&lineSn="+lineSn+"&__sid="+MesClient.sessionid;
+            JSONObject result = JSONObject.parseObject(doPost(url, params));
+//            log.info("请求参数:"+params);
+            return result;
+        } catch (Exception e) {
+            log.info("e="+e.getMessage());
+            return null;
+        }
+    }
     //获取当前工位工件码
     public static JSONObject getCurSn(String oprno,String serverIp,String lineSn){
         try {
             String url = "http://"+serverIp+":8980/js/a/mes/mesProductRecord/getCurSn";
             String params = "__ajax=json&oprno="+oprno+"&lineSn="+lineSn+"&__sid="+MesClient.sessionid;
             JSONObject result = JSONObject.parseObject(doPost(url, params));
-
             return result;
         } catch (Exception e) {
             log.info("e="+e.getMessage());

+ 14 - 8
src/com/mes/ui/WorkStationPanel.java

@@ -279,19 +279,25 @@ public class WorkStationPanel extends JPanel {
     }
 
     public void resetScanA() {
-        this.workStatus = 0;
-        this.checkQualityResult = false;
-        finishOkButton.setEnabled(false);
+        JSONObject retObj = DataUtil.delCurSn(gw, serverIp, lineSn);
+        if (retObj.get("result")!=null && retObj.get("result").toString().equalsIgnoreCase("true")){
+            this.workStatus = 0;
+            this.checkQualityResult = false;
+            finishOkButton.setEnabled(false);
 //        finishNgButton.setEnabled(false);
-        productSnField.setText("");
-        fxLabel.setVisible(false);
+            productSnField.setText("");
+            fxLabel.setVisible(false);
 
-        scanButton.setEnabled(true);
-        statusLabel.setText("请扫工件码");
+            scanButton.setEnabled(true);
+            statusLabel.setText("请扫工件码");
 //        MesClient.setMenuStatus("开班点检,请先进行OKNG样件测试",-1);
 
-        updateMaterailData();
+            updateMaterailData();
 //        shiftUserCheck();
+        } else {
+            statusLabel.setText("刷新失败");
+        }
+
     }
     public static void updateMaterailData(){
         try{