ZengTao
2023-09-17 dba117185ebab076ce8ae59c1df13f0d14f6cfe0
主界面添加小车位置配置
5个文件已修改
1个文件已添加
130 ■■■■ 已修改文件
CanadaMes-ui/src/api/home.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/home/index.vue 59 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/entity/CarPosition.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/api/home.js
@@ -82,3 +82,12 @@
        data :""
    })
}
export function Loadcarlist() {
    return request({
        url: '/home/Loadcarlist',
        method: 'get',
        data :""
    })
}
CanadaMes-ui/src/views/home/index.vue
@@ -241,22 +241,22 @@
        <el-footer>
            <div class="blocks" style="position: relative;">
                <div style="display:flex;position: absolute;float:left;z-index: 999;top:102px;left:237px;">
                    <div :class="getStatusClass(item.state)" v-for="item in cagelist1" :key="item['date']"
                        :style="{ height: 35 * item['glassWidth'] + 'px' }" @click="showcageinfo(item['cage'])"></div>
                    <div :class="getStatusClass(item.state)" v-for="(item,index) in cagelist1" :key="item['date']"
                        :style="{ height: 35 * item['glassWidth'] + 'px',left:3.07*index+'px' }" @click="showcageinfo(item['cage'])"></div>
                </div>
                <div style="display:flex;position: absolute;float:left;z-index: 999;top:102px;left:640px;">
                    <div :class="getStatusClass(item.state)" v-for="item in cagelist2" :key="item['date']"
                        :style="{ height: 35 * item['glassWidth'] + 'px' }" @click="showcageinfo(item['cage'])"></div>
                    <div :class="getStatusClass(item.state)" v-for="(item,index) in cagelist2" :key="item['date']"
                        :style="{ height: 35 * item['glassWidth'] + 'px',left:3.07*index+'px' }" @click="showcageinfo(item['cage'])"></div>
                </div>
                <div style="display:flex;position: absolute;float:left;z-index: 999;top:139px;left:237px;">
                    <div :class="getStatusClass(item.state)" v-for="item in cagelist3" :key="item['date']"
                        :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px' }"
                    <div :class="getStatusClass(item.state)" v-for="(item,index) in cagelist3" :key="item['date']"
                        :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px',left:3.07*index+'px' }"
                        @click="showcageinfo(item['cage'])">
                    </div>
                </div>
                <div style="display:flex;position: absolute;float:left;z-index: 999;top:139px;left:640px;">
                    <div :class="getStatusClass(item.state)" v-for="item in cagelist4" :key="item['date']"
                        :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px' }"
                    <div :class="getStatusClass(item.state)" v-for="(item,index) in cagelist4" :key="item['date']"
                        :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px',left:3.07*index+'px' }"
                        @click="showcageinfo(item['cage'])"></div>
                </div>
                <div class="blocks-img" :style="{ left: car1 + 'px', top: '16px' }"></div>
@@ -264,23 +264,23 @@
                <div class="blocks-img2"></div>
                <div class="blocks-img3"></div>
                <!-- <div style="display:flex;position: absolute;float:left;z-index: 999;top:112px;left:328px;">
                    <div :class="getStatusClass(item.state)" v-for="item in cagelist1" :key="item['date']"
                        :style="{ height: 35 * item['glassWidth'] + 'px' }"
                    <div :class="getStatusClass(item.state)" v-for="(item,index) in cagelist1" :key="item['date']"
                        :style="{ height: 35 * item['glassWidth'] + 'px',left:4.22*index+'px' }"
                        @click="showcageinfo(item['cage'])"></div>
                </div>
                <div style="display:flex;position: absolute;float:left;z-index: 999;top:112px;left:885px;">
                    <div :class="getStatusClass(item.state)" v-for="item in cagelist2" :key="item['date']"
                        :style="{ height: 35 * item['glassWidth'] + 'px' }"
                    <div :class="getStatusClass(item.state)" v-for="(item,index) in cagelist2" :key="item['date']"
                        :style="{ height: 35 * item['glassWidth'] + 'px',left:4.22*index+'px' }"
                        @click="showcageinfo(item['cage'])"></div>
                </div>
                <div style="display:flex;position: absolute;float:left;z-index: 999;top:154px;left:328px;">
                    <div :class="getStatusClass(item.state)" v-for="item in cagelist3" :key="item['date']"
                        :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px' }"
                    <div :class="getStatusClass(item.state)" v-for="(item,index) in cagelist3" :key="item['date']"
                        :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px',left:4.22*index+'px' }"
                        @click="showcageinfo(item['cage'])"></div>
                </div>
                <div style="display:flex;position: absolute;float:left;z-index: 999;top:154px;left:885px;">
                    <div :class="getStatusClass(item.state)" v-for="item in cagelist4" :key="item['date']"
                        :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px' }"
                    <div :class="getStatusClass(item.state)" v-for="(item,index) in cagelist4" :key="item['date']"
                        :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px',left:4.22*index+'px' }"
                        @click="showcageinfo(item['cage'])"></div>
                </div>
                <div class="blocks-img" :style="{ left: car1 + 'px', top: '16px' }"></div>
@@ -360,7 +360,7 @@
</template>
<script>
import { home, home2, loadtask, InsertOrder, Addglassid, UpdateTask, SelectAlarmmgInfo, SelectCageInfo, DeleteByGlassID, OutByGlassID } from "../../api/home";
import { home, home2, loadtask, InsertOrder, Addglassid, UpdateTask, SelectAlarmmgInfo, SelectCageInfo, DeleteByGlassID, OutByGlassID, Loadcarlist } from "../../api/home";
import LanguageMixin from '../../lang/LanguageMixin'
@@ -397,12 +397,13 @@
            order: "",
            glassid: "",
            url: "../../img/bigcar01.png",
            car1: 107,
            car2: 175,
            // car1: 150,
            // car2: 242,
            car1: 145,
            car2: 210,
            // car1: 210,
            // car2: 300,
            cageinfo: [],
            cage: 0
            cage: 0,
            carlist:[]
        };
    },
    created() {
@@ -434,10 +435,10 @@
                    //console.log("收到数据====" + msg.data);
                    let obj = JSON.parse(msg.data);
                    if (obj.params != null) {
                        this.car1 = 107 + 17.62 * obj.params[0][0]/1000;
                        this.car2 = 175 + 17.62 * obj.params[0][1]/1000;
                        // this.car1 = 150 + 24.6 * obj.params[0][0]/1000;
                        // this.car2 = 242 + 24.6 * obj.params[0][1]/1000;
                        this.car1 = 145 + 8.15 * (obj.params[0][0]-this.carlist[0]['start'])/(this.carlist[0]['end']-this.carlist[0]['start'])*100;
                        this.car2 = 210 + 8.15 * (obj.params[0][1]-this.carlist[1]['start'])/(this.carlist[1]['end']-this.carlist[1]['start'])*100;
                        // this.car1 = 210 + 11.25 * (obj.params[0][1]-this.carlist[1]['start'])/(this.carlist[1]['end']-this.carlist[1]['start'])*100;
                        // this.car2 = 300 + 11.25 * (obj.params[0][1]-this.carlist[1]['start'])/(this.carlist[1]['end']-this.carlist[1]['start'])*100;
                    }
                    this.tableData = obj.tableData[0];
                    this.cagelist1 = obj.cagelist1[0];
@@ -486,15 +487,17 @@
                if (res.data.list.length > 0) {
                    this.outcell = this.tasklist2[0]['cell'];
                }
            });
            loadtask(this.task2).then(res => {
                this.tasklist2 = res.data.list;
            });
            SelectAlarmmgInfo().then(res => {
                this.alarm = res.data.alarmmg;
            });
            Loadcarlist().then(res => {
                this.carlist = res.data.carlist;
                console.log(this.carlist);
            });
        },
        //根据格子状态修改颜色
        getStatusClass(state) {
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -47,19 +47,18 @@
            jsonObject.append("alarmmg", alarmmg);
            // 读去Plc进片车与出片车位置W
            List<String> addressList = new ArrayList<String>();
            addressList.add("DB106.0");
            addressList.add("DB106.12");
            addressList.add("DB106.0");
            List<Short> paramlist = S7control.getinstance().ReadWord(addressList);
            // List<Short> paramlists = new ArrayList<Short>();
            // short para1 = 1;
            // short para2 = 2;
            // short para1 = 11111;
            // short para2 = 32000;
            // paramlists.add(para1);
            // paramlists.add(para2);
            // System.out.println(paramlists);
            if(paramlist!=null){
            // Short[] paramlists = paramlist.toArray(new Short[0]);
            jsonObject.append("params", paramlist);
            }
            // jsonObject.append("params", new short[] { 30, 40, });
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java
@@ -10,6 +10,7 @@
import com.example.springboot.service.HomeService;
import com.example.springboot.service.SpianService;
import com.example.springboot.common.Result;
import com.example.springboot.entity.CarPosition;
import com.example.springboot.entity.StorageCage;
import com.example.springboot.entity.alarmmg;
@@ -130,8 +131,6 @@
    @GetMapping("/OutByGlassID")
    public Result OutByGlassID(String glassid) {
        Map<String, Object> map = new HashMap<>();
        // 调用伍上片函数
        Short results = spianService.selectout2(glassid);
@@ -142,8 +141,14 @@
        } else if (results == 400) {
            map.put("message2", "400");
        }
        return Result.success(map);
    }
    @GetMapping("/Loadcarlist")
    public Result Loadcarlist() {
        List<CarPosition> carlist = homeMapper.Loadcarlist();
        Map<String, Object> map = new HashMap<>();
        map.put("carlist", carlist);
        return Result.success(map);
    }
}
springboot-vue3/src/main/java/com/example/springboot/entity/CarPosition.java
New file
@@ -0,0 +1,32 @@
package com.example.springboot.entity;
public class CarPosition {
    public int carid;
    public int start;
    public int end;
    public void setcarId(Integer carid) {
        this.carid = carid;
    }
    public Integer getcarId() {
        return carid;
    }
    public void setStart(Integer start) {
        this.start = start;
    }
    public Integer getStart() {
        return start;
    }
    public void setEnd(Integer end) {
        this.end = end;
    }
    public Integer getEnd() {
        return end;
    }
}
springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
@@ -2,6 +2,7 @@
import org.apache.ibatis.annotations.*;
import com.example.springboot.entity.CarPosition;
import com.example.springboot.entity.StorageCage;
import com.example.springboot.entity.alarmmg;
@@ -14,19 +15,19 @@
  List<StorageCage> selectAll();
  // 查询1-5笼内层格子状态
  @Select("SELECT cage,state,glasswidth/width*2 as glasswidth from storage_cage where cage<=5 and tier=2")
  @Select("SELECT cage,state,glasswidth/2750*2 as glasswidth from storage_cage where cage<=5 and tier=2")
  List<StorageCage> selectRack1();
  // 查询6-10笼内层格子状态
  @Select("SELECT cage,state,glasswidth/width*2 as glasswidth from storage_cage where cage>5 and tier=2")
  @Select("SELECT cage,state,glasswidth/2750*2 as glasswidth from storage_cage where cage>5 and tier=2")
  List<StorageCage> selectRack2();
  // 查询1-5笼外层格子状态
  @Select("SELECT case when tier=1 then cage else 0 end as cage,case when tier=1 then state else 0 end as state,sum(case when tier=1 then glasswidth/width*2 else 0 end) as glasswidth,sum(case when tier=2 then glasswidth/width*2 else 0 end) as width  from storage_cage where cage<=5  group by cell")
  @Select("SELECT case when tier=1 then cage else 0 end as cage,case when tier=1 then state else 0 end as state,sum(case when tier=1 then glasswidth/2750*2 else 0 end) as glasswidth,sum(case when tier=2 then glasswidth/2750*2 else 0 end) as width  from storage_cage where cage<=5  group by cage,cell")
  List<StorageCage> selectRack3();
  // 查询6-10笼外层格子状态
  @Select("SELECT case when tier=1 then cage else 0 end as cage,case when tier=1 then state else 0 end as state,sum(case when tier=1 then glasswidth/width*2 else 0 end) as glasswidth,sum(case when tier=2 then glasswidth/width*2 else 0 end) as width  from storage_cage where cage>5  group by cell")
  @Select("SELECT case when tier=1 then cage else 0 end as cage,case when tier=1 then state else 0 end as state,sum(case when tier=1 then glasswidth/2750*2 else 0 end) as glasswidth,sum(case when tier=2 then glasswidth/2750*2 else 0 end) as width  from storage_cage where cage>5  group by cage,cell")
  List<StorageCage> selectRack4();
  // 根据任务类型查询当前正在出片,进片的玻璃信息
@@ -72,4 +73,7 @@
  @Update("update storage_cage set state=0,glass_id=null,order_id=null,glasswidth=null,glassheight=null,coating=null where glass_id=#{glassid}")
  void DeleteByGlassID(short glassid);
  @Select("select * from car_position")
  List<CarPosition> Loadcarlist();
}