ZengTao
2023-12-19 939b4eae5a2f459b60ab3e8d17dcf466511a4b66
测试更新
9个文件已修改
1个文件已添加
157 ■■■■ 已修改文件
CanadaMes-ui/src/lang/locales/en-US.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/lang/locales/zh-CN.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/home/index.vue 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/Plclog.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/lang/locales/en-US.json
@@ -270,7 +270,7 @@
  "There is no glass for this order":"There is no glass for this order",
  "There are currently tasks":"There are currently tasks",
  "There is no such glass":"There is no such glass",
  "There is no such grid":"There is no such grid",
  "There is no such slot":"There is no such slot",
  "No delete allowed":"No delete allowed",
  "No out allowed":"No out allowed",
  "Are you sure to perform this operation ?":"Are you sure to perform this operation ?",
CanadaMes-ui/src/lang/locales/zh-CN.json
@@ -252,7 +252,7 @@
  "There is no such order": "没有此订单的玻璃",
  "There are currently tasks": "当前有任务",
  "There is no such glass": "没有此玻璃",
  "There is no such grid": "没有空闲格子",
  "There is no such slot": "没有空闲格子",
  "No delete allowed": "不能删除",
  "No out allowed": "不能出片",
  "Are you sure to perform this operation ?": "确定执行此操作?",
CanadaMes-ui/src/views/home/index.vue
@@ -472,7 +472,7 @@
            <el-pagination :style="'margin-top:-2px'" @size-change="handleSizeChanges"
                @current-change="handleCurrentChanges" :pager-count="7" :current-page="currentPages"
                :page-sizes="[21, 42, 84, 420]" :page-size="pagesizes" layout="total, sizes, prev, pager, next, jumper"
                :page-sizes="[42, 84, 126, 420]" :page-size="pagesizes" layout="total, sizes, prev, pager, next, jumper"
                :total="cageinfo.length > 0 ? cageinfo.length : null" background style="float: right; margin-top: 20px">
            </el-pagination>
@@ -649,9 +649,13 @@
                    </template>
                </el-table-column>
                <el-table-column prop="sequence" :label="$t('Sequence')"></el-table-column>
                <el-table-column prop="position" :label="$t('Position')" style="font-size: 20px;">
                <el-table-column :min-width="300" prop="position" :label="$t('Position')" style="font-size: 20px;">
                    <template slot-scope='scope'>
                        {{ scope.row.position == 1 ? "▄▄▄" : "▋" }}
                        <!-- {{ scope.row.position == 1 ? "<>▄▄▄" : "▋" }} -->
                        <div :style="'width:'+(scope.row.position==1?'300':'100') +'px;height:'+(scope.row.position==1?'100':'300') +'px;background-Color:gray;'">
                            <!-- <div :style="'width:100px;height:300px;background-Color:red;'"></div> -->
                        </div>
                        <!-- {{ scope.row.position == 1 ? "<div></div>" : "<div></div>" }} -->
                    </template>
                </el-table-column>
                <el-table-column prop="position" :label="$t('Flip')">
@@ -733,6 +737,7 @@
        <el-dialog :visible.sync="dialogFormCountDown" :title="$t('Approximately resettable time')" top="5vh">
            <div :style="'font-size: ' + PromptSize + 'px;text-align: center;'">
                <!-- {{ this.CountDowns }} -->
                {{ this.CountDowns }}
            </div>
        </el-dialog>
@@ -816,7 +821,7 @@
            pagesize: 15,    //每页默认显示的数据
            pageCount: 0,
            currentPages: 1,  //默认初始页
            pagesizes: 21,    //每页默认显示的数据
            pagesizes: 42,    //每页默认显示的数据
            pageCounts: 0,
            OutSlice: [],
            AluminumFrame: [],
@@ -829,10 +834,11 @@
            OutingQueue: true,
            OrderInfo: true,
            CageDetails: true,
            CountDowns: "EMERGENCY STOP",
            CountDowns: "EMERGENCY \r\n STOP",
            D01RequestState: false,
            EmergencyStop: false,
            PromptSize: 250
            PromptSize: 250,
            reset:false
        };
    },
    created() {
@@ -890,6 +896,8 @@
                    if ((obj.countdown[0] == true && this.CountDowns == 0) || this.EmergencyStop == true) {
                        this.CountDown();
                    }
                    //复位完成信号
                    this.reset=obj.reset[0];
                    //是否有进片请求
                    this.D01RequestState = obj.D01RequestState[0];
@@ -1065,7 +1073,7 @@
                                this.$message.error(this.$t('There is no such glass'));
                            }
                            else if (res.data.message2 == 400) {
                                this.$message.error(this.$t('There is no such grid'));
                                this.$message.error(this.$t('There is no such slot'));
                            }
                        });
                    } else {
@@ -1416,6 +1424,7 @@
                            this.form5 = {};
                            this.$message.success(this.$t('Operation successful'));
                        } else {
                            alert(1);
                            this.$message.error(this.$t('This glass ID already exists in the sorting cage'));
                        }
                    });
@@ -1626,7 +1635,7 @@
            rowIndex = column;
            let style = "";
            if (columnIndex === 8) {
                style = "font-size:25px;text-align: center;";
                style = "font-size:200px;text-align: center;height:200px;";
            }
            if (columnIndex === 9 && row.flip == 1) {
                style = "background-Color:yellow;";
@@ -1729,7 +1738,7 @@
                    if (this.EmergencyStop == true) {
                        clearInterval(timer);
                        this.PromptSize = 250;
                        this.CountDowns = "EMERGENCY STOP";
                        this.CountDowns = "EMERGENCY \n STOP";
                    } else {
                        if (count > 0) {
                            this.PromptSize = 500;
@@ -1738,12 +1747,11 @@
                        }
                        else {
                            this.PromptSize = 250;
                            this.CountDowns = "Waiting for reset";
                            // if(复位完成==true){
                            //     clearInterval(timer);
                            //     this.dialogFormCountDown = false;
                            // }
                            this.CountDowns = "Waiting \n for \n reset";
                            if(this.reset==true){
                                clearInterval(timer);
                                this.dialogFormCountDown = false;
                            }
                        }
                    }
                },
springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
@@ -19,12 +19,11 @@
  int aaa;
  @Override
  public void run() {
    boolean inglassbegin = false;
    boolean outglassbegin = false;
    while (this != null) {
      try {
        Thread.sleep(1000);
        Thread.sleep(100);
      } catch (InterruptedException e) {
        // \\ TODO Auto-generated catch block
        e.printStackTrace();
@@ -40,11 +39,13 @@
      // // TODO Auto-generated catch block
      // e.printStackTrace();
      // }
      List<Short> datas1List = S7control.getinstance().ReadWord("DB106.24", 1);// 获取prc进片请求数据
      List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8", 1);// 获取进片车状态
      List<Short> datas1ListState2 = S7control.getinstance().ReadWord("DB105.16", 1);// 获取进片车任务是否启动
      boolean B01backs = spianService.listbool("DB106.60");// b01汇报
      boolean B02backs = spianService.listbool("DB106.62");// b02汇报
      StringBuilder B01glassid = spianService.queGlassid("DB103.184", 14);// BO1的玻璃id
      StringBuilder B02glassid = spianService.queGlassid("DB103.212", 14);// B02的玻璃id
@@ -54,7 +55,8 @@
        // 当B01小车汇报完成时更改玻璃状态 为1
        spianService.overtask(B01glassid.toString());// 完成任务
        S7control.getinstance().WriteWord("DB106.60", (short) 0);// 恢复B01小车应答改为0
        System.out.println("汇报时B01|第"+aaa+"次"+ B01glassid);
        boolean yingda = spianService.listbool("DB106.60");// b01汇报
        System.out.println("汇报时B01|第"+aaa+"次"+ B01glassid+"应答"+yingda);
        aaa+=1;
      }
@@ -64,6 +66,8 @@
        spianService.overtask(B02glassid.toString());// 完成任务
        S7control.getinstance().WriteWord("DB106.62", (short) 0);// 恢复B02小车应答改为0
        System.out.println("汇报时B02|" + B02glassid);
        boolean yingda = spianService.listbool("DB106.62");// b01汇报
        System.out.println("汇报时B01|第"+aaa+"次"+ B02glassid+"应答"+yingda);
      }
      // 获取DO1数据
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -42,7 +42,7 @@
        while (this != null) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
@@ -127,21 +127,26 @@
            // 是否需要人工确认上片玻璃
            jsonObject.append("isConfirm", isConfirm);
            //获取进片请求状态
            // 获取进片请求状态
            List<Short> D01Request = S7control.getinstance().ReadWord("DB106.24", 1);
            boolean D01RequestState = D01Request.contains((short)1);
            boolean D01RequestState = D01Request.contains((short) 1);
            // boolean D01RequestState =true;
            jsonObject.append("D01RequestState", D01RequestState);
            //复位倒计时
            // 复位倒计时
            // 地址104.9.6
            List<Boolean> countdown = S7control.getinstance().ReadBits("DB104.9.6", 1);
            for (Boolean countdowns : countdown) {
                jsonObject.append("countdown", countdowns);
            }
            // jsonObject.append("countdown", true);
            // 复位完成信号
            List<Boolean> resets = S7control.getinstance().ReadBits("DB103.284", 1);
            for (Boolean reset : resets) {
                jsonObject.append("reset", reset);
            }
            //是否急停
            // 是否急停
            List<Boolean> emergencystops = S7control.getinstance().ReadBits("DB104.5.1", 1);
            for (Boolean emergencystop : emergencystops) {
                jsonObject.append("emergencystop", emergencystop);
springboot-vue3/src/main/java/com/example/springboot/component/Plclog.java
New file
@@ -0,0 +1,47 @@
package com.example.springboot.component;
import com.example.springboot.mapper.SpianMapper;
import com.example.springboot.service.SpianService;
public class Plclog extends Thread {
    boolean b01 = false;
    boolean b02 = false;
    private SpianService spianService;
    private SpianMapper spianMapper;
    @Override
    public void run() {
        while (this != null) {
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                // \\ TODO Auto-generated catch block
                e.printStackTrace();
            }
            spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
            spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
            boolean B01backs = spianService.listbool("DB106.60");// b01汇报
            boolean B02backs = spianService.listbool("DB106.62");// b01汇报
            if (b01 != B01backs) {
                if (B01backs == true) {
                    spianMapper.insertlog("BO1:1");
                } else {
                    spianMapper.insertlog("BO1:0");
                }
                 b01 = B01backs;
            }
             if (b02 != B02backs) {
                if (B02backs == true) {
                    spianMapper.insertlog("BO2:1");
                } else {
                    spianMapper.insertlog("BO2:0");
                }
                b02 = B02backs;
            }
        }
    }
}
springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
@@ -17,10 +17,14 @@
        //
        System.out.println("启动完成");
     new PlcHold().start();
        // new Plclog().start();
        // new PlcHold().start();
        new Plchome().start();
        //  new Plcalarm().start();
        //  new Plcsign().start();
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java
@@ -141,12 +141,12 @@
  public Result UpdateTask(Integer types, Integer shelfrack, String glassid) {
    Map<String, Object> map = new HashMap<>();
    homeMapper.UpdateTask(types, glassid);
    StorageCage glass = homeMapper.SelectGlassInfo(glassid);
    // StorageCage glass = homeMapper.SelectGlassInfo(glassid);
    if (types == 0) {
      homeMapper.UpdateCageTask1(glassid);
      // S7control.getinstance().WriteWord("DB105.16", (short) 0);
    } else {
      spianMapper.UpdataOutCage1(glass.getGlassWidth(), glass.getCage(), glass.getCell());
      // spianMapper.UpdataOutCage1(glass.getGlassWidth(), glass.getCage(), glass.getCell());
      homeMapper.DeleteByGlassID(glassid);
      // S7control.getinstance().WriteWord("DB105.18", (short) 0);
    }
@@ -202,7 +202,6 @@
        } else {
          map.put("message2", "300");
        }
      } else {
        map.put("message2", "400");
      }
springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java
@@ -15,7 +15,7 @@
public interface SpianMapper {
    // 判断相邻笼子是否有空格
    @Select("select COUNT(if(a.state1=0,cell,null))as cell,ROUND(id/2)as id from (select *,max(state)as state1 from storage_cage a  GROUP BY cage,cell)as a where (a.cage=#{cage1}-1 or a.cage=#{cage1}+1)and if(a.cage<6,a.cage>0 and a.cage<6,a.cage>5) and disabled=0 GROUP BY cage ORDER BY cell desc LIMIT 1")
    @Select("select COUNT(if(a.state1=0,cell,0))as cell,ROUND(id/2)as id from (select *,max(state)as state1 from storage_cage a  GROUP BY cage,cell)as a where (a.cage=#{cage1}-1 or a.cage=#{cage1}+1)and if(a.cage<6,a.cage>0 and a.cage<6,a.cage>5) and disabled=0 GROUP BY cage ORDER BY cell desc LIMIT 1")
    int selectCage(int cage1);
    // @Select("(select*from storage_cage as a where a.state=0 and cage%2=0 ORDER BY
@@ -42,7 +42,7 @@
    StorageCage selectCage1(int cage1, int cell, double width);
    // 判断笼子内玻璃数
    @Select("select COUNT(tier)as tier from storage_cage where  cage=#{cage} and cell=#{cell} and state!=0;")
    @Select("select COUNT(tier)as tier from storage_cage where  cage=#{cage} and cell=#{cell} and state=1;")
    int selectsum(int cage, int cell);
    // 完成进片中的玻璃状态
@@ -77,7 +77,7 @@
    StorageCage selectGlassCage(int cage, double width, int cage1, int cage2);
    // 删除笼子信息(出片)
    @Update("update storage_cage as a set state=#{state},glass_id=null,order_id=null,glasswidth=0,a.glassheight=null,a.glasswidthmm=null,a.glassheightmm=null,a.listid=null,a.boxid=null where glass_id=#{glassid} and state=3;")
    @Update("update storage_cage as a set state=#{state},glass_id=null,order_id=null,glasswidth=null,a.glassheight=null,a.glasswidthmm=null,a.glassheightmm=null,a.listid=null,a.boxid=null where glass_id=#{glassid} and state=3;")
    void UpdataGlassCage(String glassid, int state);
    // 改变玻璃状态为出片中
@@ -109,7 +109,7 @@
    void UpdataOutCage1(double width, int cage, int cell);
    // 调拨更换笼子信息
    @Update("update storage_cage as a,(select*from storage_cage b where b.cage=#{cage} and b.cell=#{cell} and b.tier=#{tier})as b set a.glass_id=b.glass_id,a.order_id=b.order_id,a.state=1,a.glasswidth=b.glasswidth,a.glassheight=b.glassheight,a.glasswidthmm=b.glasswidthmm,a.glassheightmm=b.glassheightmm,a.listid=b.listid,a.boxid=b.boxid where a.id=#{id1}")
    @Update("update storage_cage as a,(select*from storage_cage b where b.cage=#{cage} and b.cell=#{cell} and b.tier=#{tier})as b set a.glass_id=b.glass_id,a.order_id=b.order_id,a.state=2,a.glasswidth=b.glasswidth,a.glassheight=b.glassheight,a.glasswidthmm=b.glasswidthmm,a.glassheightmm=b.glassheightmm,a.listid=b.listid,a.boxid=b.boxid where a.id=#{id1}")
    void UpdateDBCage(int id1, int cage, int cell, int tier);
    // @Insert("insert into user(name, date, address, user_no) values (#{name},
@@ -231,4 +231,7 @@
    // 把该进片的玻璃更新到出片队列
    @Select("update out_slice set state=0 where glassId=#{glassId} and state=3")
    void UpdateAddQueue(String glassId);
}
    //新增日志表格
    @Insert("INSERT INTO `canadames`.`log`( `text`,time) VALUES (#{logtxt},now());")
    void insertlog(String logtxt);
}
springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java
@@ -55,6 +55,9 @@
            cage1 = storageCage2.getCage();
            // 判断该笼子号相邻最大的空格数
            int cages = spianMapper.selectCage(cage1);
            if(cages==0){
                return (400);
            }
            StorageCage cages1;
            // 判断是否是第二片需要加间隔物
            prctier = spianMapper.selectsum(cage1, storageCage2.getCell());// 传给prc的格子内玻璃数
@@ -202,14 +205,12 @@
                    datas.add((short) 2);
                    datas.add((short) 1);
                    // 更换玻璃的笼子
                    spianMapper.UpdataGlassCageState(glassid, 3);// 更改笼子表的玻璃状态
                    String glassids = spianMapper.SelectGlassid(cage, cell); // 获取被调拨的玻璃id
                    spianMapper.UpdataGlassCageState(glassids, 3);// 更改笼子表的玻璃状态
                    spianMapper.UpdateDBCage(ids, cage, cell, 2);// 将原格子数据更新到新格子里
                    spianMapper.UpdataAddCage1(glasswidth, cages, cells);// 减少新格子宽度
                    spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度
                    //spianMapper.UpdataGlassCageState(glassids, 3);// 更改笼子表的玻璃状态
                    spianMapper.Inserttask(2, 0, cageout.getId(), ids, glassid, 2);// 新增调度任务
                    // spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid);// 新增出片任务
                    spianMapper.Inserttask(2, 0, cageout.getId(), ids, glassids, 2);// 新增调度任务
                    // 传输mes数据,坐标,数据
                    System.out.println("出片任务|" + datas);
                    S7control.getinstance().WriteWord(adddresslist, datas);// 派发出片车任务
@@ -233,8 +234,8 @@
                    datas.add((short) 2);
                    datas.add((short) 1);
                    String glassids = spianMapper.SelectGlassid(cage, cell); // 获取被调拨的玻璃id
                    spianMapper.UpdataGlassCageState(glassid, 3);// 更改笼子表的玻璃状态
                    spianMapper.Inserttask(2, 0, cageout.getId() + 1, ids, glassid, 2);// 新增调度任务
                    spianMapper.UpdataGlassCageState(glassids, 3);// 更改笼子表的玻璃状态
                    spianMapper.Inserttask(2, 0, cageout.getId() + 1, ids, glassids, 2);// 新增调度任务
                    // spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid);// 新增出片任务
                    spianMapper.UpdateDBCage(ids, cage, cell, 2);// 将原格子数据更新到新格子里
                    spianMapper.UpdataAddCage1(glasswidth, cages, cells);// 减少新格子宽度
@@ -300,11 +301,11 @@
    // 根据玻璃id完成在进行中的任务
    public void overtask(String glassid) {
        
        spianMapper.UpdatetaskOut(glassid); // 完成上一次出片或者进片任务
        spianMapper.UpdatetaskOut(glassid);// 完成上一次 出片或者进片任务
        spianMapper.OverOutSlice(glassid, 2);// 完成出片队列任务
        spianMapper.UpdataGlassCage(glassid, 0);// 清除出片格子玻璃信息
        spianMapper.UpdateCageOver(glassid, 0);// 更改笼子表出片状态
        spianMapper.UpdateCageadd(glassid,1);
        spianMapper.UpdateCageadd(glassid,1);// 更改笼子表进片状态
        String barcode = spianMapper.SelectBarcode(glassid);// 获取该玻璃的铝框id
        spianMapper.UpdateAddQueue(glassid);// 把进片的玻璃更新到出片队列中
        if (barcode != null) {