ZengTao
2024-01-19 c13207a19a92c845fcb8c356e01f073142d9084e
测试后代码更新
10个文件已修改
150 ■■■■ 已修改文件
CanadaMes-ui/src/lang/locales/en-US.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/lang/locales/zh-CN.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/home/index.vue 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/lang/locales/en-US.json
@@ -1,4 +1,5 @@
{
  "Clear":"Clear",
  "ip":"localhost",
  "systemTitle": "Login System",
  "usernamePlaceholder": "Please enter username",
CanadaMes-ui/src/lang/locales/zh-CN.json
@@ -1,4 +1,5 @@
{
  "Clear":"清除",
  "ip":"localhost",
  "systemTitle": "登录系统",
  "usernamePlaceholder": "请输入用户名",
CanadaMes-ui/src/views/home/index.vue
@@ -375,78 +375,67 @@
                <div class="device" :style="'top: 262px;left: 150px;background-color: ' + ShowDeviceList(8) + ';'">D05</div>
                <div class="device" :style="'top: 339px;left: 150px;background-color: ' + ShowDeviceList(9) + ';'">D06</div>
                <div class="glass D01" style="top: 39px;left: 1055px;position: absolute;"
                    >{{ ShowGlassIdList(0) }}
                    <br/>
                <div class="glass D01" style="top: 39px;left: 1055px;position: absolute;">{{ ShowGlassIdList(0) }}
                    <br />
                    <el-button type="primary" size="mini" @click="ClearGlassId('DB101.9.2', 0)">
                        {{ $t('Clear') }}</el-button>
                </div>
                <div class="glass D02" style="top: 117px;left: 1055px;position: absolute;"
                    >{{ ShowGlassIdList(1) }}
                    <br/>
                <div class="glass D02" style="top: 117px;left: 1055px;position: absolute;">{{ ShowGlassIdList(1) }}
                    <br />
                    <el-button type="primary" size="mini" @click="ClearGlassId('DB101.9.2', 1)">
                        {{ $t('Clear') }}</el-button>
                </div>
                <div class="glass B01" style="top: 270px;left: 640px;position: absolute;"
                    >
                <div class="glass B01" style="top: 270px;left: 640px;position: absolute;">
                    B01:{{ ShowGlassIdList(2) }}
                    <br/>
                    <br />
                    <el-button type="primary" size="mini" @click="ClearGlassId('DB101.10.2', 2)">
                        {{ $t('Clear') }}</el-button>
                </div>
                <div class="glass B02" style="top: 290px;left: 640px;position: absolute;"
                    >B02:{{ ShowGlassIdList(3) }}
                    <br/>
                <div class="glass B02" style="top: 315px;left: 640px;position: absolute;">B02:{{ ShowGlassIdList(3) }}
                    <br />
                    <el-button type="primary" size="mini" @click="ClearGlassId('DB101.10.3', 3)">
                        {{ $t('Clear') }}</el-button>
                </div>
                <div class="glass A01" style="top: 270px;left: 289px;position: absolute;"
                    >
                <div class="glass A01" style="top: 270px;left: 289px;position: absolute;">
                    A01.1:{{ ShowGlassIdList(4) }}
                    <br/>
                    <br />
                    <el-button type="primary" size="mini" @click="ClearGlassId('DB101.10.0', 4)">
                        {{ $t('Clear') }}</el-button>
                </div>
                <div class="glass A01" style="top: 315px;left: 289px;position: absolute;"
                    >A01.2:{{ ShowGlassIdList(5) }}X21942611703GV
                    <br/>
                <div class="glass A01" style="top: 315px;left: 289px;position: absolute;">A01.2:{{ ShowGlassIdList(5) }}
                    <br />
                    <el-button type="primary" size="mini" @click="ClearGlassId('DB101.10.1,5', 5)">
                        {{ $t('Clear') }}</el-button>
                </div>
                <div class="glass A02" style="top: 360px;left: 289px;position: absolute;"
                    >A02:{{ ShowGlassIdList(6) }}
                    <br/>
                <div class="glass A02" style="top: 360px;left: 289px;position: absolute;">A02:{{ ShowGlassIdList(6) }}
                    <br />
                    <el-button type="primary" size="mini" @click="ClearGlassId('DB101.10.2,6', 6)">
                        {{ $t('Clear') }}</el-button>
                </div>
                <div class="glass D03" style="top: 122px;left: 42px;position: absolute;"
                    >
                <div class="glass D03" style="top: 122px;left: 42px;position: absolute;">
                    {{ ShowGlassIdList(7) }}
                    <br/>
                    <br />
                    <el-button type="primary" size="mini" @click="ClearGlassId('DB101.9.4', 7)">
                        {{ $t('Clear') }}</el-button>
                </div>
                <div class="glass D04" style="top: 198px;left: 42px;position: absolute;"
                    >
                <div class="glass D04" style="top: 198px;left: 42px;position: absolute;">
                    {{ ShowGlassIdList(8) }}
                    <br/>
                    <br />
                    <el-button type="primary" size="mini" @click="ClearGlassId('DB101.9.5', 8)">
                        {{ $t('Clear') }}</el-button>
                </div>
                <div class="glass D05" style="top: 275px;left: 42px;position: absolute;"
                    >
                <div class="glass D05" style="top: 275px;left: 42px;position: absolute;">
                    {{ ShowGlassIdList(9) }}
                    <br/>
                    <br />
                    <el-button type="primary" size="mini" @click="ClearGlassId('DB101.9.6', 9)">
                        {{ $t('Clear') }}</el-button>
                </div>
                <div class="glass D06" style="top: 352px;left: 42px;position: absolute;"
                    >
                <div class="glass D06" style="top: 352px;left: 42px;position: absolute;">
                    {{ ShowGlassIdList(10) }}
                    <br/>
                    <br />
                    <el-button type="primary" size="mini" @click="ClearGlassId('DB101.9.5', 10)">
                        {{ $t('Clear') }}</el-button>
                </div>
@@ -617,12 +606,12 @@
                        }}</el-button>
                    </el-form-item> -->
                    <el-form-item>
                        {{ $t('Confirm State') }}:{{ this.isConfirm == true ? $t('Not Allow') : $t('Allow') }}
                        {{ $t('Confirm State') }}:{{ this.isConfirm == true ? $t('Allow') : $t('Not Allow') }}
                        <el-button type="primary" @click="isConfirmState()">
                            {{ this.isConfirm == true ? $t('Allow') : $t('Not Allow') }}</el-button>
                            {{ this.isConfirm == true ? $t('Not Allow') : $t('Allow') }}</el-button>
                    </el-form-item>
                    <el-form-item>
                        {{ $t('Current State') }}:{{ this.Scanningmethod == true ? $t('Automatic') : $t('Hand Movement') }}
                        {{ $t('Current State') }}:{{ this.Scanningmethod == false ? $t('Automatic') : $t('Hand Movement') }}
                        <el-button type="primary" @click="SwitchScanMethod()">{{ $t('Switch')
                        }}</el-button>
                    </el-form-item>
@@ -1030,7 +1019,6 @@
    },
    created() {
        this.load();
        this.init();
    }
    ,
@@ -1305,6 +1293,7 @@
        },
        //手动上片
        sbumitglassid() {
            console.log(1111111);
            if (this.form.order != "") {
                if (this.form.height < 380 || this.form.width < 390 || this.form.height > 1810 || this.form.width > 2760) {
                    this.$message.error(this.$t('The glass size is not within the range'));
@@ -1678,6 +1667,9 @@
                        if (res.data.message == 200) {
                            this.form5 = {};
                            this.$message.success(this.$t('Operation successful'));
                        }
                        else if (res.data.message == 400) {
                            this.$message.error(this.$t('The glass size is not within the range'));
                        } else {
                            this.$message.error(this.$t('This glass ID already exists in the sorting cage'));
                        }
@@ -2090,7 +2082,7 @@
            if (this.ClearGlassID == false) {
                console.log(this.DeviceList, num);
                if (this.DeviceList[num] == 0) {
                    if (this.GlassIdList[num].length < 14) {
                    if (this.GlassIdList[num].length <= 14) {
                        this.$confirm(this.$t('Are you sure to clear this barcode ?'), this.$t('confirm'), {
                            confirmButtonText: this.$t('Yes'),
                            cancelButtonText: this.$t('No'),
springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
@@ -1,5 +1,6 @@
package com.example.springboot.component;
import java.time.LocalDateTime;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import com.example.springboot.service.JdbcConnections;
@@ -29,6 +30,7 @@
        // \\ TODO Auto-generated catch block
        e.printStackTrace();
      }
      // if (S7control.getinstance().CheckConnected() == false) {
        spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
        spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
@@ -82,6 +84,8 @@
          if (outstate == true) {// 当出片车空闲时,且出片启动为1时,任务启动改为0
            if (outstate1 == true) {
              S7control.getinstance().WriteWord("DB105.18", (short) 0);// 出片任务启动改为0
              System.out.println("关闭启动"+LocalDateTime.now());
            }
          }
        }
@@ -99,22 +103,31 @@
        // 当进片小车完成任务时
        if (B01backs == true) {
          // 当B01小车汇报完成时更改玻璃状态 为1
          //判断是否汇报正确的id
          int HB=spianMapper.SelectHB(B01glassid.toString());
          if(HB>0){
             // 当B01小车汇报完成时更改玻璃状态 为1
          spianService.overtask(B01glassid.toString());// 完成任务
          S7control.getinstance().WriteWord("DB106.60", (short) 0);// 恢复B01小车应答改为0
          boolean yingda = spianService.listbool("DB106.60");// b01汇报
          System.out.println("汇报时B01|第" + aaa + "次" + B01glassid + "应答" + yingda);
          aaa += 1;
          }
        }
        // 当出片小车完成任务时
        if (B02backs == true) {
          //判断是否汇报正确的id
          int HB=spianMapper.SelectHB(B02glassid.toString());
          if(HB>0){
          // 当B02小车汇报完成时更改玻璃状态为0
          spianService.overtask(B02glassid.toString());// 完成任务
          S7control.getinstance().WriteWord("DB106.62", (short) 0);// 恢复B02小车应答改为0
          System.out.println("汇报时B02|" + B02glassid);
          boolean yingda = spianService.listbool("DB106.62");// b02汇报
          System.out.println("汇报时B02|第" + aaa + "次" + B02glassid + "应答" + yingda);
          }
        }
        // 获取DO1数据
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -153,7 +153,7 @@
            // // TODO: handle exception
            // }
            if (S7control.getinstance().CheckConnected() == true) {
            // if (S7control.getinstance().CheckConnected() == true) {
                // 获取当前扫码方式
                List<Boolean> Scanningmethods = S7control.getinstance().ReadBits("DB101.11.4", 1);
@@ -171,7 +171,7 @@
                jsonObject.append("DeviceList", DeviceList);
                // 获取D01-D06,A01,A02,B01,B02玻璃id
                List<String> GlassIdList = new ArrayList<String>();
                GlassIdList.add(spianService.queGlassid("DB103.40", 14).toString());
                GlassIdList.add(spianService.queGlassid("DB103.44", 14).toString());
                GlassIdList.add(spianService.queGlassid("DB103.58", 14).toString());
                GlassIdList.add(spianService.queGlassid("DB103.184", 14).toString());
@@ -294,7 +294,7 @@
                // }
                // }
            }
            // }
            storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
            dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
@@ -17,10 +17,10 @@
        //
        System.out.println("启动完成");
      //  new PlcHold().start();
         new PlcHold().start();
        new Plchome().start();
        new PlcLayout().start();
        new Plcalarm().start();
        new Plcsign().start();
@@ -36,10 +36,10 @@
        new PlcManualonePosition2().start();
        new PlcServoManualone().start();
        new PLCManualJog().start();
        //new Plclog().start();
        new Plclog().start();
        new PlcInteractionState().start();
//new PlcParameter1Review().start();
        //new PlcParameter1Review().start();
       // new PLCAutomaticParameterSettingReview().start();
    }
}
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java
@@ -275,16 +275,21 @@
  @PostMapping("/InsertQueueGlassId")
  public Result InsertQueueGlassId(Short id, @RequestBody Queue queue) {
    Map<String, Object> map = new HashMap<>();
    Short zhi=200;
    short result = homeMapper.SelectStorageByGlassId(queue.getglassId());
    if (result > 0) {
      map.put("message", "300");
    } else {
      homeMapper.InsertQueueGlassId(queue, id);
      if (id == 1) {
        // 调用伍存储过程
        spianService.selectAll(queue.getglassId());
        zhi=spianService.selectAll(queue.getglassId());
        if(zhi==200){
          homeMapper.InsertQueueGlassId(queue, id);
        }
      }
      map.put("message", "200");
      map.put("message",zhi);
    }
    return Result.success(map);
  }
springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java
@@ -18,8 +18,8 @@
    @Select("select a.cage,FrameBarcode,COUNT(if(a.order_id=#{orderids},a.order_id,null))as orderid,b.shu,c.shu2,a.cell,min(a.state)as state1,max(a.state)as state2,disabled,FrameBarcode from storage_cage a left join (select COUNT(*)shu,cage from storage_cage  where order_id=#{orderids} GROUP BY cage)as b on a.cage=b.cage left join(select cage ,COUNT(glass_id)as shu2 from storage_cage GROUP BY cage)c  on a.cage=c.cage where (order_id=#{orderids} or ''='') GROUP BY cage,cell HAVING state1=0 ORDER BY (FrameBarcode=#{Fbarcode} or ''='') desc,shu desc,shu2,state2 asc,cage asc;")
    List<StorageCage> selectAll(String orderids,String Fbarcode);
    //优先判断一次是否有同铝框的空位
    @Select("select *,min(state) state1 from storage_cage  GROUP BY cage,cell HAVING state1=0 and  FrameBarcode=#{FrameBarcode} LIMIT 1;")
    List<StorageCage> selectAllFbarcode(String Fbarcode);
    @Select("select *,min(state) state1 from storage_cage where width>=(#{width}+#{width2})  GROUP BY cage,cell HAVING state1=0 and  FrameBarcode=#{Fbarcode} ORDER BY width desc LIMIT 1;")
    List<StorageCage> selectAllFbarcode(String Fbarcode,double width,double width2);
    // 获取判断该格子是否需要把外片推入内片位置
    @Select("select state from storage_cage where  cage=#{cage} and cell=#{cell} and tier=1;")
    int selectcell(int cage, int cell);
@@ -232,4 +232,7 @@
    //判断玻璃是否禁用
    @Select(" select disabled from storage_cage where glass_id=#{glassid} limit 1;")
    int SelectCageGlassState(String glassid);
    //判断汇报的id是否正确
    @Select("SELECT count(*) FROM `storage_cage` where state!=0 and state!=1 and glass_id=#{glassid}")
    int SelectHB(String glassid);
}
springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java
@@ -19,7 +19,7 @@
    // @GetMapping("/all")
    public Short selectAll(String glassid) {
        int cage1;
        int cage1=0;
        int cells;
        int ids;
        int prcid;
@@ -33,12 +33,7 @@
        if (glasslist == null) {
            return (300);
        }
        //判断是否还有进片任务未完成的
        int cagestate=spianMapper.SelectCageState(2);
        //有进片任务未完成时返回不进片
        if(cagestate>0){
            return (300);
        }
        double widths = glasslist.getglasslengthmm();
        String orderids = glasslist.getordernumber();
        String FrameBarcode = glasslist.getFrameBarcode();
@@ -54,7 +49,10 @@
        // String orderid="A001";
        // 获取订单相关度最高的笼子排序
        List<StorageCage> storageCage = spianMapper.selectAllFbarcode(FrameBarcode);
        List<StorageCage> storageCage = spianMapper.selectAllFbarcode(FrameBarcode,widths,400);
        //判断铝框指定空格是否需要间隔空间
        if (storageCage.size() == 0) {
            storageCage = spianMapper.selectAll(orderids, FrameBarcode);
        }
@@ -171,10 +169,10 @@
            spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid, state);// 新增任务
            // int state = spianMapper.selectGlassState(cage, cell);//获取格子数量
            if (state == 2) {
                spianMapper.UpdateDBCage1(cage, cell);// 将内片数据更新到外片里
                spianMapper.UpdateDBCage2(cage, cell);// 清除内片数据
            }
            // if (state == 2) {
            //     spianMapper.UpdateDBCage1(cage, cell);// 将内片数据更新到外片里
            //     spianMapper.UpdateDBCage2(cage, cell);// 清除内片数据
            // }
            System.out.println("出片任务|" + datas);
            S7control.getinstance().WriteWord(adddresslist, datas);// 派发出片车任务
            outmesid(glassid, "DB105.34");// 派发出片ID
springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java
@@ -30,19 +30,21 @@
        String A01glassid2 = spianService.queGlassid("DB103.142", 14).toString();
        String A02glassid1 = spianService.queGlassid("DB103.156", 14).toString();
        String B01glassid = spianService.queGlassid("DB103.184", 14).toString();
        String B02glassid = spianService.queGlassid("DB103.198", 14).toString();
        String B02glassid = spianService.queGlassid("DB103.212", 14).toString();
        List<Short> DeviceList = S7control.getinstance().ReadWord("DB103.0", 10);
        if (types == 0) {// 终止进片任务
            List<StorageTask> cageList = homeMapper.SelectTaskByState(types);
            for (StorageTask storageTask : cageList) {
                // 判断出片任务位置并清除对应玻璃id
                if ((storageTask.getGlassId() == A01glassid1 || storageTask.getGlassId() == A01glassid2)&&DeviceList.get(4)==0) {
                if ((storageTask.getGlassId().equals(A01glassid1)|| storageTask.getGlassId().equals(A01glassid2))&&DeviceList.get(4)==0) {
                    outSliceServive.StopTask(storageTask.getGlassId(), types);
                    ClearGlassId("DB101.10.0");
                } else if (storageTask.getGlassId() == B01glassid&&DeviceList.get(2)==0) {
                }
                if (storageTask.getGlassId().equals(B01glassid)&&DeviceList.get(2)==0) {
                    outSliceServive.StopTask(storageTask.getGlassId(), types);
                    ClearGlassId("DB101.10.2");
                } else if (storageTask.getGlassId() == B02glassid&&DeviceList.get(3)==0) {
                }
                if (storageTask.getGlassId().equals(B02glassid)&&DeviceList.get(3)==0) {
                    ClearGlassId("DB101.10.3");
                    outSliceServive.StopTask(storageTask.getGlassId(), types);
                }
@@ -56,7 +58,6 @@
            }
            for (StorageTask cageList : cageLists) {
                if (cageList.getTaskType().equals("1")) {
                    System.out.println(DeviceList.get(5));
                    if(cageList.getGlassId().equals(A02glassid1)&&DeviceList.get(5)==0){
                        outSliceServive.StopTask(cageList.getGlassId(), types);