wu
2024-11-28 cfc2855d2fe063e26947bad7277a1091efbb3bbb
springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java
@@ -395,8 +395,8 @@
    }
    // 查询玻璃信息
    public Result SelectGlassInfo(String width, String height, String thickness, String films,String tier) {
        List<GlassInfo> glassInfoList = homeMapper.SelectGlassInfo(width, height, thickness, films,tier);
    public Result SelectGlassInfo(String width, String height, String thickness, String films, String tier) {
        List<GlassInfo> glassInfoList = homeMapper.SelectGlassInfo(width, height, thickness, films, tier);
        Map<String, Object> map = new HashMap<>();
        map.put("StorageCageAddInfo", glassInfoList);
        return Result.success(map);
@@ -449,19 +449,21 @@
        map.put("message", "200");
        return Result.success(map);
    }
    //扫码匹配成功
    public int ScanMatch(String Order, Integer Mateid,Integer tier) {
        GlassInfo glass=homeMapper.SelectCodeGlass(Order,Mateid,tier);
        System.out.println("glass:"+glass);
        System.out.println("order"+Order+"mateid"+Mateid+"tier"+tier);
        if(glass==null){
    // 扫码匹配成功
    public int ScanMatch(String Order, Integer Mateid, Integer tier) {
        GlassInfo glass = homeMapper.SelectCodeGlass(Order, Mateid, tier);
        System.out.println("glass:" + glass);
        System.out.println("order" + Order + "mateid" + Mateid + "tier" + tier);
        if (glass == null) {
            return 0;
        }else{
        int cont= QueueMapper.insertQueueCode(glass.getFlowcard(),glass.getGlassid(),glass.getMateid(),glass.getGlasstype(),glass.getWidth(),glass.getHeight(),glass.getThickness());
        glassInfoMapper.updatemeasurenumber(glass.getId());
        return cont;
     }
        } else {
            int cont = QueueMapper.insertQueueCode(glass.getFlowcard(), glass.getGlassid(), glass.getMateid(),
                    glass.getGlasstype(), glass.getWidth(), glass.getHeight(), glass.getThickness());
            glassInfoMapper.updatemeasurenumber(glass.getId());
            return cont;
        }
    }
    // 人工匹配修改测量信息
@@ -470,24 +472,26 @@
        PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
        Map<String, Object> map = new HashMap<>();
        QueueMapper.DeleteQueue();
        String mestoplc=plcmes.getPlcParameter("MESToGaStatus").getValue();
        String A02Plc=plcmes.getPlcParameter("GaToMES").getValue();
        System.out.println("人工匹配mestoplc:"+mestoplc);
        String mestoplc = plcmes.getPlcParameter("MESToGaStatus").getValue();
        String A02Plc = plcmes.getPlcParameter("GaToMES").getValue();
        System.out.println("人工匹配mestoplc:" + mestoplc);
        // int count = homeMapper.SelectQueue();
        if (("0".equals(mestoplc)&&"0".equals(A02Plc))||("1".equals(A02Plc)&&"4".equals(mestoplc))) {
            // homeMapper.UpdateQueue(glassInfo.getFlowcard(), glassInfo.getWidth(), glassInfo.getHeight(),
            //         glassInfo.getGlasstype(), glassInfo.getThickness(), glassInfo.getTier(), glassInfo.getMateid());
        if (("0".equals(mestoplc) && "0".equals(A02Plc)) || ("1".equals(A02Plc) && "4".equals(mestoplc))) {
            // homeMapper.UpdateQueue(glassInfo.getFlowcard(), glassInfo.getWidth(),
            // glassInfo.getHeight(),
            // glassInfo.getGlasstype(), glassInfo.getThickness(), glassInfo.getTier(),
            // glassInfo.getMateid());
            homeMapper.AddQueue(glassInfo.getFlowcard(), glassInfo.getWidth(), glassInfo.getHeight(),
                    glassInfo.getGlasstype(), glassInfo.getThickness(), glassInfo.getTier(), glassInfo.getMateid());
            glassInfoMapper.updatemeasurenumber(glassInfo.getId());
           if("0".equals(mestoplc)){
            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToA01").getAddress(), (short) 1);
            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1);
            System.out.println("提前匹配");
           }else{
            System.out.println("测量匹配");
            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1);
           }
            if ("0".equals(mestoplc)) {
                S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToA01").getAddress(), (short) 1);
                S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1);
                System.out.println("提前匹配");
            } else {
                System.out.println("测量匹配");
                S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1);
            }
            map.put("message", "200");
        } else {
            map.put("message", "300");
@@ -503,14 +507,35 @@
    public Result ManualTake(String glassInfo) {
        // 读取DB105区文件
        PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
        // 移除
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 3);
        // 删除数据
        QueueMapper.DeleteErrorQueue();
        // plcmes.getPlcParameter("GaToMES").setValue("3");
        String A02Plc = plcmes.getPlcParameter("GaToMES").getValue();
        String A01Plc = plcmes.getPlcParameter("A01ToMES").getValue();
        String A02Mes = plcmes.getPlcParameter("MESToGaStatus").getValue();
        Map<String, Object> map = new HashMap<>();
        map.put("message", "200");
        // 移除
        if ("1".equals(A02Plc)||"2".equals(A02Plc)|"1".equals(A02Mes)) {
            Queue queue = QueueMapper.selectLastQueue3();
            if (queue != null) {
                // 减少匹配次数
                glassInfoMapper.updateGlassNumber(queue.getglasstype());
            }
            // 删除队列
            QueueMapper.DeletefromQueue();
            if("0".equals(A02Plc)){
                S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 0);
            }else{
                S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 3);
            }
            System.out.println("人工拿走A02Plc:" + A02Plc);
            map.put("message", "200");
        }else{
            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToA01").getAddress(), (short) 3);
            QueueMapper.DeletefromQueue();
            map.put("message", "300");
            System.out.println("人工拿走A01Plc:" + A01Plc);
        }
        // plcmes.getPlcParameter("GaToMES").setValue("3");
        return Result.success(map);
    }
@@ -533,8 +558,8 @@
    // 删除出片队列
    public Result DeleteOutTask(Integer id) {
        int cell=homeMapper.SelectOutTaskId(id);
        int cell = homeMapper.SelectOutTaskId(id);
        UpdateStroageCageByCell(cell, 1);// 玻璃数量+1
        homeMapper.DeleteOutTask(id);
        Map<String, Object> map = new HashMap<>();
@@ -567,8 +592,8 @@
        PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
        // 重新测量
        String PlcRequest = plcmes.getPlcParameter("GaToMES").getValue();// plc请求字
        if("1".equals(PlcRequest)){
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 2);
        if ("1".equals(PlcRequest)) {
            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 2);
        }
        // 删除数据
        QueueMapper.DeleteErrorQueue();
@@ -628,7 +653,7 @@
        for (Map map : RemoveErrorData) {
            String key = map.get("base").toString() + "_" + map.get("height").toString() + "_"
                    + map.get("thickness").toString() + "_" + map.get("films").toString() + "_"
                    + map.get("order").toString() + "_" + map.get("matching").toString()+ map.get("tier").toString();
                    + map.get("order").toString() + "_" + map.get("matching").toString() + map.get("tier").toString();
            String tierkey = map.get("order").toString() + "_" + map.get("matching").toString();
            String value = TypeData.get(key);