From ef47083c90ff7e70362a32741a0a4d5770037e7f Mon Sep 17 00:00:00 2001
From: 严智鑫 <test>
Date: 星期一, 18 三月 2024 10:44:04 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/Albania_Mes

---
 springboot-vue3/src/main/java/com/example/springboot/service/SpianServiceNew.java |   81 ++++++++++++++++++++++++++++------------
 1 files changed, 56 insertions(+), 25 deletions(-)

diff --git a/springboot-vue3/src/main/java/com/example/springboot/service/SpianServiceNew.java b/springboot-vue3/src/main/java/com/example/springboot/service/SpianServiceNew.java
index f779ef2..7b49fa8 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/service/SpianServiceNew.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/service/SpianServiceNew.java
@@ -7,6 +7,8 @@
 import com.example.springboot.component.PLCAutoMes;
 import com.example.springboot.component.S7control;
 import com.example.springboot.entity.GlassInfo;
+import com.example.springboot.entity.StorageCage;
+import com.example.springboot.entity.GlassInfo;
 import com.example.springboot.entity.device.PlcParameterObject;
 import com.example.springboot.mapper.AlbaniaMapper;
 import com.google.common.primitives.Bytes;
@@ -23,20 +25,20 @@
     int cageid;
     String glassid=glassInfo.getGlassid();
     Double width=glassInfo.getWidth();
-    Double height=glassInfo.getHeight();
+    //int mateid=glassInfo.getMateid();
+    String flowcard=glassInfo.getFlowcard();
     int glasstype=glassInfo.getGlasstype();
     
     
 
     //鍒ゆ柇鏄惁鏈夊悓绫诲瀷鐨�
-     cageid=albaniaMapper.SelectCage(glassInfo.getGlasstype(), glassInfo.getWidth(), 50);
+     cageid=albaniaMapper.SelectCage(glasstype,width, 50);
     //濡傛灉鏈夊悓绫诲瀷鏃剁洿鎺ュ鍔�
     if(cageid!=Integer.MIN_VALUE){
         //鍙戦�乸lc浠诲姟
+        //Mestast(glassid,1001,cageid,1);
         
-        //浠诲姟瀹屾垚鍚庡鍔犳暟閲�
-        albaniaMapper.UpdateCageNumberAdd(cageid);
-    }else{
+    }else{ 
          //鍒ゆ柇鐜荤拑鏄惁杩涘叆澶х墖绗�
         if(glassInfo.getThickness()>=15){
             cageid=albaniaMapper.SelectNewCell(3,5);
@@ -45,23 +47,51 @@
             //鍙戦�乸lc浠诲姟
         }
         //褰撹繑鍥炵殑鏍煎瓙鍙蜂负绌烘椂,杩斿洖400绗煎瓙宸叉弧
-        if(cageid==Integer.MIN_VALUE){
-            return(400);
+        if(cageid!=Integer.MIN_VALUE){
+            Mestast(glassid,1001,cageid,1);
+            //鍙戦�乸lc浠诲姟
+            
         }else{
-            //鍒ゆ柇瀹屾垚浠诲姟鍚庡鍔犳暟閲�
-            albaniaMapper.AddCage(cageid, glassid, width, height, width, height, 0, glasstype, 1);
+            return(400);
         }
     }
     //澧炲姞浠诲姟璁板綍
-    albaniaMapper.Inserttask(0, 0, 0, cageid, glassInfo.getGlassid(), 0, 0);
+    albaniaMapper.Inserttask(0, 0, 1001, cageid, glassid,glasstype, flowcard,0,0);
     return(200);
 
 }
 
-
-    public Short selectout(String glasstype) {
-        //鍒ゆ柇绗煎瓙鏈�鍏堝嚭鍝墖
-         
+    //鍑虹墖
+    public Short selectout(int line) {
+        int mateid;
+        int glasstype;
+        int tier;
+        int sumid;
+        String flowcard;
+        GlassInfo glassmate=new GlassInfo();
+           
+            for(int i=1;i<=7;i++){
+                glassmate= albaniaMapper.SelectOutGlass(line);
+                mateid=glassmate.getMateid();
+                glasstype=glassmate.getGlasstype();
+                tier=glassmate.getTier();
+                sumid=glassmate.getId();
+                flowcard=glassmate.getFlowcard(); 
+   
+                    StorageCage glass= albaniaMapper.SelectCageGlass(glasstype);
+                    //鍙戦�侀厤鐗囨暟鎹�
+                    Mestast(glassmate.getGlasstype()+"i", glass.getId(),2002, 0);
+                    albaniaMapper.AddFinishNumber(flowcard, mateid, tier);
+                    albaniaMapper.Inserttask(1, 0, glass.getId(), 2002, glassmate.getGlassid()+i, glasstype,glass.getFlowcard(),mateid,tier);
+                    if(tier==sumid){
+                        //鏈閰嶇墖瀹屾垚鍙戦�佸惎鍔ㄥ懡浠�
+                        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short)2);//鍑虹墖浠诲姟鍚姩
+                        return (200);//缁撴潫
+                    }
+                
+            }
+           
+     
        
         return(200);// 缁撴潫
     }
@@ -78,7 +108,7 @@
         }
         byte[] bytes = Bytes.toArray(glassidlist);
         System.out.println("outmesidbytes:" + bytes.length);
-        S7control.getinstance().WriteByte(plcmes.getPlcParameter(address).getAddress(plcmes.getPlcParameter(address).getAddressIndex()),bytes);
+        S7control.getinstance().WriteByte(plcmes.getPlcParameter(address).getAddress(),bytes);
         //S7control.getinstance().WriteByte(address, bytes);// 娲惧彂鍑虹墖id
 
     }
@@ -93,7 +123,7 @@
                 writedstrIdOut.append((char) iditem);
             }
         }
-        return writedstrIdOut;
+        return writedstrIdOut;  
     }
 
     // char鏁扮粍杞寲鎴恇it鏁扮粍
@@ -115,15 +145,16 @@
         return listbool;
     }
 
-    // 鏍规嵁鐜荤拑id瀹屾垚鍦ㄨ繘琛屼腑鐨勪换鍔�
-    public void overtask(String glassid) {
-
-        // spianMapper.UpdatetaskOut(glassid.toString());// 瀹屾垚涓婁竴娆� 鍑虹墖鎴栬�呰繘鐗囦换鍔�
-        // spianMapper.OverOutSlice(glassid.toString(), 2, 1);// 瀹屾垚鍑虹墖闃熷垪浠诲姟
-        // spianMapper.UpdataGlassCage(glassid.toString(), 0);// 娓呴櫎鍑虹墖鏍煎瓙鐜荤拑淇℃伅
-        // spianMapper.UpdateCageOver(glassid.toString(), 0);// 鏇存敼绗煎瓙琛ㄥ嚭鐗囩姸鎬�
-        // spianMapper.UpdateCageadd(glassid.toString(), 1);// 鏇存敼绗煎瓙琛ㄨ繘鐗囩姸鎬�
-        // spianMapper.UpdateAddQueue(glassid.toString());// 鎶婅繘鐗囩殑鐜荤拑鏇存柊鍒板嚭鐗囬槦鍒椾腑
+    //涓嬪彂鐞嗙墖浠诲姟
+    public void Mestast(String glassid,int MESToPLCStart1,int MESToPLCTarget1,int MESToPLC) {
+        outmesid(glassid, "MESID1");//涓嬪彂鐜荤拑id
+        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStart1").getAddress(), (short) MESToPLCStart1);//璧峰浣嶇疆
+        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCTarget1").getAddress(), (short) MESToPLCTarget1);//鐩爣浣嶇疆
+        if(MESToPLC!=0){
+            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short)MESToPLC);//mes鐞嗙墖浠诲姟绫诲瀷
+        }
+        
+        
     }
 
 }

--
Gitblit v1.8.0