wuyouming666
2024-04-22 c576dd18c9781ef1b101aa63128b1c1d57ba010a
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownGlassCacheLogic.java
@@ -29,26 +29,16 @@
    public static final String RESULT_IN_OUT = "3";
    @Autowired
    private DownStorageCageDetailsMapper selectInfo;
    private GlassInfoService GlassInfoService;
    @Autowired
    private GlassInfoService glassInfoService;
    @Autowired
    private DownStorageCageService downStorageCageService;
    @Autowired
    private DownGlassTaskService downGlassTaskService;
//    public void identify(String Number) {
//        //查询任务
//        PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
//        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1);
//        String s = S7control.getinstance().ReadWord("DB14.26", 1).get(0) + "";
//        boolean isexist = isExist(Number);
//        if (isexist) {
//            //存在逻辑    1.添加信息 2.回复PLC存在
//            //S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1);
//        } else {
//            //不存在逻辑  1.回复PLC不存在
//            //S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 2);
//        }
//    }
    public void process() {
        String result = S7control.getinstance().ReadWord("DB14.0", 1).get(0) + "";
@@ -78,11 +68,11 @@
     */
    public boolean processInto(String Number) {
        GlassInfoService = WebSocketServer.applicationContext.getBean(GlassInfoService.class);
        glassInfoService = WebSocketServer.applicationContext.getBean(GlassInfoService.class);
        downStorageCageService = WebSocketServer.applicationContext.getBean(DownStorageCageService.class);
        //按id查询玻璃信息表里的玻璃
        GlassInfo GlassInfo = GlassInfoService.selectGlassId(Number);
        GlassInfo GlassInfo = glassInfoService.selectGlassId(Number);
        PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
        //存在此玻璃编号
        if (GlassInfo != null) {
@@ -105,6 +95,7 @@
                selectInfo.insertCacheTask(GlassInfo.getId() + "", "0", item.getSlot() + "", "1", GlassInfo.getWidth(), GlassInfo.getHeight(), GlassInfo.getFilmsid(), GlassInfo.getThickness(), GlassInfo.getFlowcardId());
                S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1);
               //完成后插入小片数据到缓存表
                return true;
            }
@@ -124,9 +115,12 @@
        String G13 = S7control.getinstance().ReadWord("DB14.58", 1).get(0) + "";
        PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
        List<DownStorageCageDetails> list = selectInfo.SelectCacheOut(1, 5);
        List<DownStorageCageDetails> list2 = selectInfo.SelectCacheOut(6, 10);
        List<DownStorageCageDetails> list3 = selectInfo.SelectCacheOut(1, 10);
        List<DownStorageCageDetails> list = downStorageCageService.getCacheOut(1, 5);
        List<DownStorageCageDetails> list2 = downStorageCageService.getCacheOut(6, 10);
        List<DownStorageCageDetails> list3 = downStorageCageService.getCacheOut(1, 10);
        GlassInfo Maxglass=glassInfoService.selectGlassId("2");;
        // 优先 超出尺寸优先人工出片 人工处理
        if (!list3.isEmpty()) {
            DownStorageCageDetails item3 = list3.get(0);
@@ -143,20 +137,18 @@
        }
        //同时请求 优先后端出片
        else if (!list3.isEmpty()) {
        else if (!list3.isEmpty()&&Maxglass.equals(list3.get(0))) {
            DownStorageCageDetails item3 = list3.get(0);
            if (G06.equals("0") && G11.equals("0")) {
                String endcell = "11";
                String SendEndcell = "1";
                selectInfo.insertCacheTask(item3.getGlassId() + "", "0", endcell, "2", item3.getWidth(), item3.getHeight(), item3.getFilmsid(), item3.getThickness(), item3.getFlowCardId());
                S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), SendEndcell);
                S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1");
                return true;
            }
        }
        // 按照顺序符合前端出片
        // 按照大小符合前端出片
        else if (!list.isEmpty()) {
            DownStorageCageDetails item = list.get(0);
            if (G06.equals("0") && G11.equals("1")) {
@@ -185,7 +177,6 @@
    }
    /**
     * @param Number
     *  //磨边   不交互  理片和磨边机自己交互
@@ -199,7 +190,7 @@
    public boolean selectMessageId(String Number) {
        //查询是否存在
        GlassInfo GlassInfo = GlassInfoService.selectGlassId(Number);
        GlassInfo GlassInfo = glassInfoService.selectGlassId(Number);
        if (GlassInfo == null) {
            //返回 不存在
            return false;
@@ -216,7 +207,7 @@
    public boolean deleteMessageId(String Number) {
        //查询是否存在
        GlassInfo GlassInfo = GlassInfoService.selectGlassId(Number);
        GlassInfo GlassInfo = glassInfoService.selectGlassId(Number);
        if (GlassInfo == null) {
            //返回 不存在
            return false;
@@ -232,7 +223,7 @@
     */
    public boolean isExist(String Number) {
        //查询是否存在
        GlassInfo GlassInfo = GlassInfoService.selectGlassId(Number);
        GlassInfo GlassInfo = glassInfoService.selectGlassId(Number);
        if (GlassInfo == null) {
            //返回 不存在
            return false;