From dba117185ebab076ce8ae59c1df13f0d14f6cfe0 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期日, 17 九月 2023 16:43:30 +0800
Subject: [PATCH] 主界面添加小车位置配置
---
CanadaMes-ui/src/views/home/index.vue | 59 ++++++++++---------
CanadaMes-ui/src/api/home.js | 9 +++
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java | 7 +-
springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java | 12 ++-
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java | 11 ++-
springboot-vue3/src/main/java/com/example/springboot/entity/CarPosition.java | 32 ++++++++++
6 files changed, 91 insertions(+), 39 deletions(-)
diff --git a/CanadaMes-ui/src/api/home.js b/CanadaMes-ui/src/api/home.js
index fa70d72..83efa7b 100644
--- a/CanadaMes-ui/src/api/home.js
+++ b/CanadaMes-ui/src/api/home.js
@@ -82,3 +82,12 @@
data :""
})
}
+
+export function Loadcarlist() {
+ return request({
+ url: '/home/Loadcarlist',
+ method: 'get',
+ data :""
+ })
+}
+
diff --git a/CanadaMes-ui/src/views/home/index.vue b/CanadaMes-ui/src/views/home/index.vue
index b87e524..ad12103 100644
--- a/CanadaMes-ui/src/views/home/index.vue
+++ b/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) {
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
index cc53b99..e9dbca5 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -47,19 +47,18 @@
jsonObject.append("alarmmg", alarmmg);
// 璇诲幓Plc杩涚墖杞︿笌鍑虹墖杞︿綅缃甒
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, });
diff --git a/springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java b/springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java
index 4636ae8..33409bf 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java
+++ b/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);
+ }
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/entity/CarPosition.java b/springboot-vue3/src/main/java/com/example/springboot/entity/CarPosition.java
new file mode 100644
index 0000000..c307c00
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/entity/CarPosition.java
@@ -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;
+ }
+
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java b/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
index 8c8b53b..7a964ac 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
+++ b/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();
// 鏍规嵁浠诲姟绫诲瀷鏌ヨ褰撳墠姝e湪鍑虹墖锛岃繘鐗囩殑鐜荤拑淇℃伅
@@ -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();
+
}
--
Gitblit v1.8.0