wu
2024-11-26 fddf1c716af76c2968e08ce11895eaa1c26319a5
springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java
@@ -239,18 +239,18 @@
    }
    // 指定格子出片
    public Result AddOutGlass(Integer cell,Integer glasstype) {
    public Result AddOutGlass(Integer cell, Integer glasstype) {
        GlassInfo glass = albaniaMapper.SelectGlassInfo(glasstype);
        Map<String, Object> map = new HashMap<>();
        if(glass!=null){
        albaniaMapper.AddFinishNumber(glass.getFlowcard(),glass.getMateid(), glass.getTier());
        UpdateStroageCageByCell(cell, -1);// 玻璃数量-1
        // 增加出片队列的任务
        albaniaMapper.InsertOutTask(1, 0, cell, 2001,glass.getGlassid(),
        glass.getGlasstype(), glass.getFlowcard(),glass.getMateid(),glass.getTier());
        map.put("message", "200");
        }else{
        map.put("message", "300");
        if (glass != null) {
            albaniaMapper.AddFinishNumber(glass.getFlowcard(), glass.getMateid(), glass.getTier());
            UpdateStroageCageByCell(cell, -1);// 玻璃数量-1
            // 增加出片队列的任务
            albaniaMapper.InsertOutTask(1, 0, cell, 2001, glass.getGlassid(),
                    glass.getGlasstype(), glass.getFlowcard(), glass.getMateid(), glass.getTier());
            map.put("message", "200");
        } else {
            map.put("message", "300");
        }
        return Result.success(map);
    }
@@ -276,13 +276,14 @@
        }
        return storageTasks;
    }
    //查询出片队列
    // 查询出片队列
    public List<Map> SelectOutTask() {
        return homeMapper.SelectOutTask();
    }
     //查询出片队列
     public List<Map> SelectOutLog() {
    // 查询出片队列
    public List<Map> SelectOutLog() {
        return homeMapper.SelectOutLog();
    }
@@ -315,6 +316,10 @@
                homeMapper.FinishTask(storageTask.getId(), 2);// 完成任务
                homeMapper.DeletequeueByGlassid(storageTask.getGlasstype().toString());
                glassInfoMapper.updateGlassNumber(storageTask.getGlasstype());// 减少扫描次数
                StorageCage storageCage = homeMapper.SelectStorageByCell(storageTask.getLoadrack());
                if (storageCage.getNumber() == null || storageCage.getNumber() == 0) {
                    UpdateStroageCageByCell(Integer.parseInt(storageTask.getShelfRack()), 0);// 清除格内信息
                }
            } else {
                System.out.println("结束出片任务:" + storageTask.getId());
                homeMapper.FinishTask(storageTask.getId(), 2);// 完成任务
@@ -390,8 +395,8 @@
    }
    // 查询玻璃信息
    public Result SelectGlassInfo(String width, String height, String thickness, String films) {
        List<GlassInfo> glassInfoList = homeMapper.SelectGlassInfo(width, height, thickness, films);
    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);
@@ -444,19 +449,45 @@
        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){
            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;
     }
    }
    // 人工匹配修改测量信息
    public Result UpdateQueue(GlassInfo glassInfo) {
        // 删除数据
        PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
        Map<String, Object> map = new HashMap<>();
        // QueueMapper.DeleteQueue();
        System.out.println("人工匹配ID:"+glassInfo.getMateid()+"膜系:"+glassInfo.getFilms());
        int count = homeMapper.SelectQueue();
        if (count > 0) {
            homeMapper.UpdateQueue(glassInfo.getFlowcard(), glassInfo.getWidth(), glassInfo.getHeight(),
        QueueMapper.DeleteQueue();
        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());
            homeMapper.AddQueue(glassInfo.getFlowcard(), glassInfo.getWidth(), glassInfo.getHeight(),
                    glassInfo.getGlasstype(), glassInfo.getThickness(), glassInfo.getTier(), glassInfo.getMateid());
            PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
            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);
           }
            map.put("message", "200");
        } else {
            map.put("message", "300");
@@ -491,6 +522,7 @@
        map.put("message", "200");
        return Result.success(map);
    }
    // 开始/暂停出片队列
    public Result UpdateOutTask(Integer id, Integer state) {
        homeMapper.UpdateOutTask(id, state);
@@ -498,8 +530,12 @@
        map.put("message", "200");
        return Result.success(map);
    }
    //删除出片队列
    // 删除出片队列
    public Result DeleteOutTask(Integer id) {
        int cell=homeMapper.SelectOutTaskId(id);
        UpdateStroageCageByCell(cell, 1);// 玻璃数量+1
        homeMapper.DeleteOutTask(id);
        Map<String, Object> map = new HashMap<>();
        map.put("message", "200");
@@ -530,7 +566,10 @@
        // 读取DB105区文件
        PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
        // 重新测量
        String PlcRequest = plcmes.getPlcParameter("GaToMES").getValue();// plc请求字
        if("1".equals(PlcRequest)){
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 2);
        }
        // 删除数据
        QueueMapper.DeleteErrorQueue();
        // plcmes.getPlcParameter("GaToMES").setValue("2");
@@ -553,7 +592,7 @@
                        &&
                        item.get("films") != null && item.get("base") != null && item.get("height") != null
                        && item.get("thickness") != null && item.get("quantity") != null
                        && item.get("matching") != null)&& item.get("Customer") != null)
                        && item.get("matching") != null))
                .collect(Collectors.toList());
        TypeDatas.forEach(item -> {
@@ -589,8 +628,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("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);
@@ -615,9 +653,11 @@
                    , Integer.parseInt(map.get("tier").toString()), map.get("films").toString(),
                    Double.parseDouble(map.get("base").toString()), Double.parseDouble(map.get("height").toString()),
                    Double.parseDouble(map.get("thickness").toString()),
                    Integer.parseInt(map.get("quantity").toString()), groupby.get(tierkey),map.get("Customer").toString());// 需要计算总层数
                    Integer.parseInt(map.get("quantity").toString()), groupby.get(tierkey),
                    map.get("Customer").toString());// 需要计算总层数
            // 订单内总层数
            homeMapper.InsertFlowcard(map.get("order").toString(), OrderFinishedProduct.get(tierkey + "_Sum"), map.get("Customer").toString());
            homeMapper.InsertFlowcard(map.get("order").toString(), OrderFinishedProduct.get(tierkey + "_Sum"),
                    map.get("Customer").toString());
            count++;
        }
        Map<String, Object> ResultCode = new HashMap<>();