wuyouming666
2023-12-06 c684729c17bb02ab968cdc2fceae74dacaa9593f
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -1,7 +1,9 @@
package com.example.springboot.component;
import cn.hutool.json.JSONObject;
import cn.hutool.poi.excel.sax.handler.MapRowHandler;
import java.sql.SQLException;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
@@ -13,6 +15,8 @@
import com.example.springboot.mapper.HomeMapper;
import com.example.springboot.mapper.SpianMapper;
import com.example.springboot.service.JdbcConnections;
import com.example.springboot.service.North_Glass_Buffer1Service;
import com.example.springboot.service.SpianService;
public class Plchome extends Thread {
@@ -20,11 +24,15 @@
    @Autowired
    private HomeMapper homeMapper;
    private SpianMapper spianMapper;
    private SpianService spianService;
    private North_Glass_Buffer1Service north_Glass_Buffer1Service;
    private JdbcConnections dbserve;
    //出片队列是否允许出片
    public static Boolean isAllowQueue=true;
    public static String FrameNo="";
    //铝框id
    public static String FrameNo;
    //是否需要手动确认玻璃
    public static Boolean isConfirm=false;
    // public static Map b=new HashMap<>();
    // b.put()
    @Override
@@ -40,6 +48,8 @@
            // 注入mapper
            homeMapper = WebSocketServer.applicationContext.getBean(HomeMapper.class);
            spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
            spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
            north_Glass_Buffer1Service = WebSocketServer.applicationContext.getBean(North_Glass_Buffer1Service.class);
            // 笼子使用情况
            List<StorageCage> tableData = homeMapper.selectAll();
            jsonObject.append("tableData", tableData);
@@ -101,11 +111,51 @@
            jsonObject.append("listoutslice", listoutslice);
            //获取当前出片队列状态
            jsonObject.append("isAllowQueue",Plchome.isAllowQueue);
            //获取铝框idDB106.DBW64
            // List<Short> frameno = S7control.getinstance().ReadWord("DB106.24", 1);
            //获取铝框idDB106.DBW64
            // String frameno=spianService.queGlassid("DB106.24",14).toString();
            // if(frameno!=Plchome.FrameNo){
            //     Plchome.FrameNo=frameno;
            // }
            // Plchome.FrameNo="123";
            // try {
            //     north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo);
            // } catch (SQLException e) {
            //     // TODO Auto-generated catch block
            //     e.printStackTrace();
            // }
            //是否需要人工确认上片玻璃
            jsonObject.append("isConfirm", isConfirm);
            //铝框线交互
            // //铝框id请求字
            // List<Short> framerequest = S7control.getinstance().ReadWord("铝框id请求字地址", 1);
            // if(framerequest!=null){
            //     //铝框id
            //     String franmeno= spianService.queGlassid("铝框id地址", 14).toString();
            //     String position;
            //         try {
            //             position=dbserve.SelectPositionByFrameBarcode(franmeno);
            //         } catch (SQLException e) {
            //             // TODO Auto-generated catch block
            //             position="0";
            //             e.printStackTrace();
            //         }
            //     Short send;
            //     if(position=="0"){
            //         send=0;
            //     }else{
            //         send=1;
            //     }
            //     S7control.getinstance().WriteWord("铝框翻转发送地址", (short)send);
            // }
            
            dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
            boolean dbconnected = false;
            try {
@@ -122,6 +172,8 @@
                sendwServer.sendMessage(jsonObject.toString());
            }
        }
    }
}