From 4ce99addc03049aba2011a056e82e4f1285a754f Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期二, 19 三月 2024 13:25:48 +0800
Subject: [PATCH] 合并代码
---
springboot-vue3/src/main/java/com/example/springboot/mapper/QueueMapper.java | 35 +++++
springboot-vue3/src/main/java/com/example/springboot/service/HomeService.java | 168 +++++++++++++++++++----
Albania_Mes-ui/src/lang/locales/en-US.json | 2
Albania_Mes-ui/src/views/home/index.vue | 61 ++++++--
Albania_Mes-ui/package.json | 2
springboot-vue3/src/main/java/com/example/springboot/entity/GlassInfo.java | 1
springboot-vue3/src/main/java/com/example/springboot/entity/glassinfo.java | 1
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java | 52 ++++---
springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java | 4
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java | 4
springboot-vue3/src/main/java/com/example/springboot/mapper/GlassInfoMapper.java | 31 ++++
springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java | 2
Albania_Mes-ui/src/api/home.js | 4
springboot-vue3/src/main/java/com/example/springboot/mapper/MeasureSettingMapper.java | 20 ++
springboot-vue3/pom.xml | 26 +++
springboot-vue3/src/main/java/com/example/springboot/entity/StorageTask.java | 6
16 files changed, 332 insertions(+), 87 deletions(-)
diff --git a/Albania_Mes-ui/package.json b/Albania_Mes-ui/package.json
index 033f287..e3cce57 100644
--- a/Albania_Mes-ui/package.json
+++ b/Albania_Mes-ui/package.json
@@ -49,4 +49,4 @@
"last 2 versions",
"not dead"
]
-}
+}
\ No newline at end of file
diff --git a/Albania_Mes-ui/src/api/home.js b/Albania_Mes-ui/src/api/home.js
index 843d369..dccdaac 100644
--- a/Albania_Mes-ui/src/api/home.js
+++ b/Albania_Mes-ui/src/api/home.js
@@ -302,9 +302,9 @@
})
}
-export function FinishTask(tasktype,id) {
+export function FinishTask(id) {
return request({
- url: '/home/FinishTask?tasktype='+tasktype+'&id='+id,
+ url: '/home/FinishTask?id='+id,
method: 'post',
data:""
})
diff --git a/Albania_Mes-ui/src/lang/locales/en-US.json b/Albania_Mes-ui/src/lang/locales/en-US.json
index aeba614..cbab583 100644
--- a/Albania_Mes-ui/src/lang/locales/en-US.json
+++ b/Albania_Mes-ui/src/lang/locales/en-US.json
@@ -1,4 +1,6 @@
{
+
+ "Operation failed":"Operation canceled",
"Flowcard":"Flowcard",
"Glasstype":"Glasstype",
"Mode Change":"Mode Change",
diff --git a/Albania_Mes-ui/src/views/home/index.vue b/Albania_Mes-ui/src/views/home/index.vue
index ab7309e..cf85f0d 100644
--- a/Albania_Mes-ui/src/views/home/index.vue
+++ b/Albania_Mes-ui/src/views/home/index.vue
@@ -251,19 +251,22 @@
</label>
</div>
</div>
- <div style="display:flex;justify-content: space-around;width: 9zz5%;margin: 0 auto;">
- <el-button type="primary" @click="showform(1)" :disabled="SoftEmergencyStopState"
- :class="SoftEmergencyStopState == true ? 'hide' : ''">
+ <div style="display:flex;justify-content: space-around;width: 95%;margin: 0 auto;">
+ <el-button type="primary" @click="showform(1)" :disabled="SoftEmergencyStopState" style="z-index: 999;"
+ >
{{ $t('Import order') }}</el-button>
- <el-button type="primary" @click="showform(2)" :disabled="SoftEmergencyStopState"
- :class="SoftEmergencyStopState == true ? 'hide' : ''">
+
+ <el-button type="primary" @click="showform(2)" :disabled="SoftEmergencyStopState" style="z-index: 999;"
+ >
{{ $t('Measure') }}</el-button>
- <el-button type="primary" @click="showform(3)" :disabled="SoftEmergencyStopState"
- :class="SoftEmergencyStopState == true ? 'hide' : ''">
+
+ <el-button type="primary" @click="showform(3)" :disabled="SoftEmergencyStopState" style="z-index: 999;"
+ >
{{ $t('StorageCage') }}</el-button>
- <el-button type="primary" @click="showform(4)" :disabled="SoftEmergencyStopState"
- :class="SoftEmergencyStopState == true ? 'hide' : ''">
+ <el-button type="primary" @click="showform(4)" :disabled="SoftEmergencyStopState" style="z-index: 999;"
+ >
{{ $t('Task queue') }}</el-button>
+
</div>
<div style="display: flex;align-items: center;">
<div class="blocks" style="position: relative;width: 100%;">
@@ -324,7 +327,25 @@
<el-dialog :visible.sync="Importorder" :title="$t('Import order')" top="5vh">
</el-dialog>
- <el-dialog :visible.sync="Measure" :title="$t('Measure')" top="5vh">
+ <el-dialog :visible.sync="Measure" :title="$t('Measure')" top="5vh"><!--娴嬮噺椤甸潰-->
+ <!--娴嬮噺椤甸潰涓讳綋-->
+ <div>
+ <!--鍔熻兘-->
+ <div>
+ <el-button type="primary" @click="ManualMatching()" :disabled="SoftEmergencyStopState" style="z-index: 999;">
+ 浜哄伐鍖归厤</el-button>
+
+ </div>
+ <!--鏄剧ず-->
+ <div style="width:100%;height: 600px;border: 1px solid black;">
+ <!--鐜荤拑鍥�-->
+ <div
+ style="top:0;bottom: 0;left: 0;right: 0;margin: auto;position:absolute;width: 100px;height: 200px;background-color: aqua;line-height: 200px;text-align: center;">
+ 100*200
+ </div>
+
+ </div>
+ </div>
</el-dialog>
<el-dialog :visible.sync="StorageCage" :title="$t('StorageCage')" top="5vh">
@@ -389,7 +410,7 @@
</el-table-column>
<el-table-column prop="state" :label="$t('Task State')">
<template slot-scope='scope'>
- {{ scope.state == 0 ? $t('Start') : $t('Finished') }}
+ {{ scope.row.state >= 0?scope.row.state == 0 ? $t('Start') : $t('Stop'):"" }}
</template>
</el-table-column>
<el-table-column prop="method" :label="$t('Task Method')">
@@ -461,7 +482,7 @@
name: "Home",
data() {
return {
- tableData1:[],
+ tableData1: [],
Measuermode: false,
confirm1: false,
confirm2: false,
@@ -615,7 +636,6 @@
this.cagelist4 = obj.cagelist4[0];
this.tasklist2 = obj.StoragTaskeTaskFeed[0];
this.tasklist1 = obj.StoragTaskeTaskOut[0];
- console.log(this.tasklist1);
this.alarm = obj.alarmmg[0];
this.tableData1 = obj.OrderTask[0];
@@ -708,14 +728,16 @@
StorageCageAddGlass(index) {
if (this.Measuermode == true) {
StorageCageAddGlass(this.cell, this.StorageCageAddInfo[index]).then(res => {
- if (res.data.code == 200) {
+ if (res.data.message == 200) {
this.$message.success(this.$t('Operation successful'));
}
})
} else {
UpdateQueue(this.StorageCageAddInfo[index]).then(res => {
- if (res.data.code == 200) {
+ if (res.data.message == 200) {
this.$message.success(this.$t('Operation successful'));
+ }else{
+ this.$message.error(this.$t('Operation failed'));
}
});
}
@@ -723,9 +745,8 @@
},
//棰嗗彇/鏆傚仠浠诲姟
ClaimTasks(flowcard, state) {
- console.log(flowcard, state);
ClaimTasks(flowcard, state).then(res => {
- if (res.data.code == 200) {
+ if (res.data.message == 200) {
this.$message.success(this.$t('Operation successful'));
}
});
@@ -733,7 +754,7 @@
//淇敼鍑虹墖鏂瑰紡
ModeChange(flowcard, method) {
ModeChange(flowcard, method).then(res => {
- if (res.data.code == 200) {
+ if (res.data.message == 200) {
this.$message.success(this.$t('Operation successful'));
}
});
@@ -830,6 +851,10 @@
const specialChars = /[^\w\s]/g;
return this.GlassIdList[num].replace(specialChars, "");
}
+ },
+ //浜哄伐鍖归厤
+ ManualMatching() {
+ this.StorageCageAdd=true;
}
}
diff --git a/springboot-vue3/pom.xml b/springboot-vue3/pom.xml
index 916560c..c6f27f8 100644
--- a/springboot-vue3/pom.xml
+++ b/springboot-vue3/pom.xml
@@ -151,6 +151,29 @@
<version>5.13.1</version>
</dependency>
+ <!-- <dependency>
+ <groupId>net.sourceforge.jexcelapi</groupId>
+ <artifactId>jxl</artifactId>
+ <version>2.6.12</version>
+ </dependency> -->
+
+
+ <dependency>
+ <groupId>org.apache.poi</groupId>
+ <artifactId>poi</artifactId>
+ <version>4.1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.poi</groupId>
+ <artifactId>poi-ooxml</artifactId>
+ <version>4.1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.poi</groupId>
+ <artifactId>poi-ooxml-schemas</artifactId>
+ <version>4.1.2</version>
+ </dependency>
+
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
@@ -176,6 +199,9 @@
<artifactId>jackson-annotations</artifactId>
<version>2.13.0</version>
</dependency>
+
+
+
</dependencies>
<build>
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 dd6b213..684d234 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
@@ -3,6 +3,8 @@
import java.util.ArrayList;
import java.util.List;
import com.example.springboot.service.*;
+
+import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import com.example.springboot.entity.FlowCard;
@@ -114,35 +116,37 @@
//璇诲彇DB105鍖烘枃浠�
PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
- //String PlcRequest=plcmes.getPlcParameter("GaToMES").getValue();//鍑虹墖璇锋眰涓�绾�
- //double width=plcmes.getPlcParameter("Height").getValue();//鍑虹墖璇锋眰涓�绾�
- //double height=plcmes.getPlcParameter("width").getValue();//鍑虹墖璇锋眰涓�绾�
- // 鑾峰彇娴嬮噺鐨勯暱锛屽
+ //String PlcRequest=plcmes.getPlcParameter("GaToMES").getValue();//璇锋眰
+ //double width=plcmes.getPlcParameter("Height").getValue();//瀹�
+ //double height=plcmes.getPlcParameter("width").getValue();//楂�
+ //鑾峰彇娴嬮噺鐨勯暱锛屽
+ String url="C:\\Users\\SNG-ZDH-012\\Desktop\\闃垮皵宸村凹浜氭暟鎹姹�.xlsx";
+ //List typecount= HomeService.ReadExecl2(s);
+ // List xiaopian=HomeService.ReadExecl2(s);
+ // //xiaopian NG1{A:10,B20} NG2{A:5,B5}
+ // for(Object C:xiaopian){
+ // //鐪嬪眰鏁�
+ // }
+
+ // for(int i=0;i<result.size();i++){
+ // System.out.println(result.get(i));
+ // }
+
+
+ //List result= HomeService.ReadExecl(url);
+ // for(int i=0;i<result.size();i++){
+ // System.out.println(result.get(i));
+ // }
+
+
+
String PlcRequest = "1";
double width = 402;
double height = 402;
- //鑾峰彇鍖归厤璁剧疆
+ //鍖归厤
if ("1".equals(PlcRequest)) {
- List<GlassInfo> Result=HomeService.NormalGlassInfo(width, height, "1");
- if(Result.size()==1){
- //鍖归厤鎴愬姛 灏变竴绉嶇被鍨� 娣诲姞鏁版嵁
- GlassInfo GlassInfo=Result.get(0);
- QueueMapper.insert(GlassInfo.getGlassid(),width,height,1);
- System.out.println("鍖归厤鎴愬姛");
- //S7control.getinstance().WriteWord(plcmes.getPlcParameter("GaToMES").getAddress(), (short) 1);
- System.out.println(GlassInfo.getGlassid());
- }else if(Result.size()>1){
- //鍖归厤澶辫触 鍖归厤鍒板鏉$鍚堢殑鏁版嵁 娣诲姞鏁版嵁
- QueueMapper.insert(null,width,height,2);
- System.out.println("鍖归厤澶辫触");
- }
- else{
- //鍖归厤澶辫触 鏈壘鍒扮鍚堢殑鏁版嵁 娣诲姞鏁版嵁
- QueueMapper.insert(null,width,height,3);
- System.out.println("鏈壘鍒扮鍚堢殑鏁版嵁");
- }
-
+ boolean Result=HomeService.Normal(width, height, "1");
}
// String E01id = new String( S7controlLK.getinstance().ReadByte("DB17.0",16));
// String J01id = new String( S7controlLK.getinstance().ReadByte("DB17.22",14));
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 0a52ee2..f47de89 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
@@ -455,8 +455,8 @@
//鎵嬪姩瀹屾垚浠诲姟
@PostMapping("/FinishTask")
- public Result FinishTask(Integer tasktype,Integer id) {
- return storageCageService.FinishTask(tasktype,id);
+ public Result FinishTask(Integer id) {
+ return storageCageService.FinishTask(id);
}
//鏌ヨ鐜荤拑淇℃伅
diff --git a/springboot-vue3/src/main/java/com/example/springboot/entity/GlassInfo.java b/springboot-vue3/src/main/java/com/example/springboot/entity/GlassInfo.java
index d375337..137e8c5 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/entity/GlassInfo.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/entity/GlassInfo.java
@@ -20,4 +20,5 @@
private Double thickness;// 鍘�
private Integer number;// 鏁伴噺
private Integer finishnumber;// 瀹屾垚鏁伴噺
+ private Integer measurenumber;// 娴嬮噺瀹屾垚鏁伴噺
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/entity/StorageTask.java b/springboot-vue3/src/main/java/com/example/springboot/entity/StorageTask.java
index c4f12d1..15d5259 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/entity/StorageTask.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/entity/StorageTask.java
@@ -12,7 +12,7 @@
private String loadrack;//鐩爣浣�
private Integer count;//鐜荤拑鏁伴噺
private Integer glasstype;//鐜荤拑绫诲瀷
- private Integer flowcard;//娴佺▼鍗�
+ private String flowcard;//娴佺▼鍗�
private Integer mateid;//閰嶇墖id
private Integer tier;//鐗囧簭
@@ -88,11 +88,11 @@
public void setGlasstype(Integer glasstype) {
this.glasstype = glasstype;
}
- public Integer getFlowcard() {
+ public String getFlowcard() {
return flowcard;
}
- public void setFlowcard(Integer flowcard) {
+ public void setFlowcard(String flowcard) {
this.flowcard = flowcard;
} public Integer getMateid() {
return mateid;
diff --git a/springboot-vue3/src/main/java/com/example/springboot/entity/glassinfo.java b/springboot-vue3/src/main/java/com/example/springboot/entity/glassinfo.java
index d375337..137e8c5 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/entity/glassinfo.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/entity/glassinfo.java
@@ -20,4 +20,5 @@
private Double thickness;// 鍘�
private Integer number;// 鏁伴噺
private Integer finishnumber;// 瀹屾垚鏁伴噺
+ private Integer measurenumber;// 娴嬮噺瀹屾垚鏁伴噺
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/mapper/GlassInfoMapper.java b/springboot-vue3/src/main/java/com/example/springboot/mapper/GlassInfoMapper.java
new file mode 100644
index 0000000..8814052
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/mapper/GlassInfoMapper.java
@@ -0,0 +1,31 @@
+package com.example.springboot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.springboot.entity.GlassInfo;
+import com.example.springboot.entity.RolePermission;
+
+
+import org.apache.ibatis.annotations.*;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+
+@Mapper
+@Repository
+public interface GlassInfoMapper extends BaseMapper<GlassInfo> {
+
+ @Select("SELECT * FROM glassinfo where width<=#{maxwidth} and width>=#{minwidth} and height<=#{maxheight} and height>=#{minheight} and measurenumber<number")
+ List<GlassInfo> selectGlassInfos(@Param("maxwidth") double maxwidth, @Param("minwidth") double minwidth, @Param("maxheight") double maxheight, @Param("minheight") double minheight);
+
+ // @Select("SELECT COUNT(*) FROM role_permission WHERE role_id = #{roleId} AND permission_id = #{permissionId}")
+ // boolean checkExists(@Param("roleId") int roleId, @Param("permissionId") int permissionId);
+
+
+ @Update("UPDATE glassinfo SET measurenumber = measurenumber+1 WHERE id = #{id}")
+ void updatemeasurenumber(@Param("id") int roleId);
+
+ // @Insert("INSERT INTO role_permission (role_id, permission_id, state) VALUES (#{roleId}, #{permissionId}, #{state})")
+ // void insert(@Param("roleId") int roleId, @Param("permissionId") int permissionId, @Param("state") int state);
+
+}
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 66857b4..243c024 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
@@ -280,11 +280,11 @@
@Update("update flowcard set method=#{method} where flowcard=#{flowcard}")
void ModeChange(String flowcard, int method);
- @Update("update queue set flowcard=#{flowcard},glasswidth=#{width},glassheight=#{height},glasstype=#{glasstype} where state=0")
+ @Update("update queue set flowcard=#{flowcard},glasswidth=#{width},glassheight=#{height},glasstype=#{glasstype},state=1 where state=0")
void UpdateQueue(String flowcard,double width,double height,Integer glasstype);
@Update("update glassinfo set finishnumber=finishnumber+1 where flowcard=#{flowcard} and mateid=#{mateid} and tier=#{geTier}")
- void AddGlassNo(Integer flowcard, Integer mateid, Integer geTier);
+ void AddGlassNo(String flowcard, Integer mateid, Integer geTier);
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/mapper/MeasureSettingMapper.java b/springboot-vue3/src/main/java/com/example/springboot/mapper/MeasureSettingMapper.java
new file mode 100644
index 0000000..8feee4c
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/mapper/MeasureSettingMapper.java
@@ -0,0 +1,20 @@
+package com.example.springboot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.springboot.entity.GlassInfo;
+import com.example.springboot.entity.MeasureSetting;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Mapper
+@Repository
+public interface MeasureSettingMapper extends BaseMapper<MeasureSetting> {
+ @Select("SELECT * FROM measuresetting where line=#{line}")
+ MeasureSetting SelectMeasureSetting(@Param("line") String line);
+
+
+}
\ No newline at end of file
diff --git a/springboot-vue3/src/main/java/com/example/springboot/mapper/QueueMapper.java b/springboot-vue3/src/main/java/com/example/springboot/mapper/QueueMapper.java
new file mode 100644
index 0000000..27c6fb1
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/mapper/QueueMapper.java
@@ -0,0 +1,35 @@
+package com.example.springboot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.springboot.entity.Queue;
+import com.example.springboot.entity.RolePermission;
+
+
+import org.apache.ibatis.annotations.*;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+
+@Mapper
+@Repository
+public interface QueueMapper extends BaseMapper<Queue> {
+ @Select("SELECT * FROM queue where glassid=#{glassid}")
+ List<Queue> selectQueues(@Param("glassid") int glassid);
+
+ // @Select("SELECT COUNT(*) FROM role_permission WHERE role_id = #{roleId} AND permission_id = #{permissionId}")
+ // boolean checkExists(@Param("roleId") int roleId, @Param("permissionId") int permissionId);
+
+
+ // @Update("UPDATE role_permission SET state = #{state} WHERE role_id = #{roleId} AND permission_id = #{permissionId}")
+ // void updateState(@Param("roleId") int roleId, @Param("permissionId") int permissionId, @Param("state") int state);
+
+ @Insert("insert into queue (glassid,flowcard,listid,boxid,glasswidth,glassheight,glasswidthmm,glassheightmm,glasstype,state,time) "+
+ "select glassid,flowcard,null,null,width,height,#{glasswidthmm},#{glassheightmm},glasstype,#{state},NOW() from glassinfo where glassid=#{glassid}")
+ void insert(@Param("glassid") String glassid, @Param("glasswidthmm") double glasswidthmm, @Param("glassheightmm") double glassheightmm,@Param("state") int state);
+
+ @Insert("insert into queue (glassid,flowcard,listid,boxid,glasswidth,glassheight,glasswidthmm,glassheightmm,glasstype,state,time) "+
+ "values (null,null,null,null,null,null,#{glasswidthmm},#{glassheightmm},null,null,NOW())")
+ void insertMatchFailure(@Param("glasswidthmm") double glasswidthmm, @Param("glassheightmm") double glassheightmm);
+
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/service/HomeService.java b/springboot-vue3/src/main/java/com/example/springboot/service/HomeService.java
index 2467976..6d86b72 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/service/HomeService.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/service/HomeService.java
@@ -1,50 +1,150 @@
package com.example.springboot.service;
+import java.io.File;
+import java.io.FileInputStream;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellType;
+import org.apache.poi.ss.usermodel.CellValue;
+import org.apache.poi.ss.usermodel.FormulaEvaluator;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.usermodel.WorkbookFactory;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.example.springboot.entity.GlassInfo;
import com.example.springboot.entity.MeasureSetting;
-// import com.example.springboot.mapper.GlassInfoMapper;
-// import com.example.springboot.mapper.MeasureSettingMapper;
-// import com.example.springboot.mapper.QueueMapper;
+import com.example.springboot.mapper.GlassInfoMapper;
+import com.example.springboot.mapper.MeasureSettingMapper;
+import com.example.springboot.mapper.QueueMapper;
@Service
public class HomeService {
- // @Autowired
- // MeasureSettingMapper MeasureSettingMapper;
- // @Autowired
- // GlassInfoMapper GlassInfoMapper;
- // @Autowired
- // QueueMapper QueueMapper;
+ @Autowired
+ MeasureSettingMapper MeasureSettingMapper;
+ @Autowired
+ GlassInfoMapper GlassInfoMapper;
+ @Autowired
+ QueueMapper QueueMapper;
- // // 鍖归厤鐜荤拑 瀹斤紝楂橈紝绾胯矾
- // public List<GlassInfo> NormalGlassInfo(double width, double height, String line) {
- // //
- // List<GlassInfo> Results=new ArrayList<GlassInfo>();
- // // 鑾峰彇鍖归厤璁剧疆
- // MeasureSetting MeasureSetting = MeasureSettingMapper.SelectMeasureSetting(line);
- // if (height > 0 && width > 0 && MeasureSetting != null) {
- // // 鏈夋晥鍙傛暟 璇锋眰=1 闀�/瀹�>0
- // double maxheight = height + MeasureSetting.getErrorHeight();
- // double minheight = height - MeasureSetting.getErrorHeight();
- // double maxwidth = width + MeasureSetting.getErrorWidth();
- // double minwidth = width - MeasureSetting.getErrorWidth();
- // // 鏌ヨ褰撳墠娴嬮噺鏁版嵁
- // List<GlassInfo> GlassInfos = GlassInfoMapper.selectGlassInfos(maxwidth, minwidth, maxheight, minheight);
- // List types = new ArrayList<>();
- // for (int i = 0; i < GlassInfos.size(); i++) {
- // Integer glasstype = GlassInfos.get(i).getGlasstype();
- // if (!types.contains(glasstype)) {
- // types.add(glasstype);
- // Results.add(GlassInfos.get(i));
- // }
- // }
- // }
- // return Results;
- // }
+ // 鍖归厤鐜荤拑 瀹斤紝楂橈紝绾胯矾
+ public List<GlassInfo> NormalGlassInfo(double width, double height, String line) {
+ //
+ List<GlassInfo> Results = new ArrayList<GlassInfo>();
+ // 鑾峰彇鍖归厤璁剧疆
+ MeasureSetting MeasureSetting = MeasureSettingMapper.SelectMeasureSetting(line);
+ if (height > 0 && width > 0 && MeasureSetting != null) {
+ // 鏈夋晥鍙傛暟 璇锋眰=1 闀�/瀹�>0
+ double maxheight = height + MeasureSetting.getErrorHeight();
+ double minheight = height - MeasureSetting.getErrorHeight();
+ double maxwidth = width + MeasureSetting.getErrorWidth();
+ double minwidth = width - MeasureSetting.getErrorWidth();
+ // 鏌ヨ褰撳墠娴嬮噺鏁版嵁
+ List<GlassInfo> GlassInfos = GlassInfoMapper.selectGlassInfos(maxwidth, minwidth, maxheight, minheight);
+ List types = new ArrayList<>();
+ for (int i = 0; i < GlassInfos.size(); i++) {
+ Integer glasstype = GlassInfos.get(i).getGlasstype();
+ if (!types.contains(glasstype)) {
+ types.add(glasstype);
+ Results.add(GlassInfos.get(i));
+ }
+ }
+ }
+ return Results;
+ }
+
+ // 鍖归厤閫昏緫
+ public boolean Normal(double width, double height, String line) {
+ List<GlassInfo> Result = NormalGlassInfo(width, height, "1");
+ if (Result.size() == 1) {
+ // 鍖归厤鎴愬姛 灏变竴绉嶇被鍨� 娣诲姞鏁版嵁
+ GlassInfo GlassInfo = Result.get(0);
+ QueueMapper.insert(GlassInfo.getGlassid(), width, height, 1);
+ GlassInfoMapper.updatemeasurenumber(GlassInfo.getId());
+ System.out.println("鍖归厤鎴愬姛");
+
+ // S7control.getinstance().WriteWord(plcmes.getPlcParameter("GaToMES").getAddress(),
+ // (short) 1);
+ System.out.println(GlassInfo.getGlassid());
+ return true;
+ } else if (Result.size() > 1) {
+ // 鍖归厤澶辫触 鍖归厤鍒板鏉$鍚堢殑鏁版嵁 娣诲姞鏁版嵁
+ QueueMapper.insert(null, width, height, 2);
+ System.out.println("鍖归厤澶辫触");
+ return false;
+ } else {
+ // 鍖归厤澶辫触 鏈壘鍒扮鍚堢殑鏁版嵁 娣诲姞鏁版嵁
+ QueueMapper.insert(null, width, height, 3);
+ //System.out.println("鏈壘鍒扮鍚堢殑鏁版嵁");
+ return false;
+ }
+ }
+
+ // Execl琛ㄦ牸 浼犲叆鏂囦欢璺緞
+ public List ReadExecl(String filename) {
+ try {
+ // 鍒涘缓鏂囦欢瀵硅薄
+ File file = new File(filename);
+ // 鍒涘缓鏂囦欢杈撳叆娴佸璞�
+ FileInputStream inputStream = new FileInputStream(file);
+ // 鍒涘缓宸ヤ綔绨垮璞�
+ Workbook workbook = WorkbookFactory.create(inputStream);
+ // 鑾峰彇绗竴涓伐浣滆〃瀵硅薄
+ Sheet sheet = workbook.getSheetAt(0);
+ // 鍒涘缓涓�涓疄浣撶被闆嗗悎锛岀敤浜庡瓨鍌‥xcel鏁版嵁
+
+ List Results = new ArrayList();
+ int i = 0;
+ // 閬嶅巻琛�
+ for (Row row : sheet) {
+ // 閬嶅巻鍗曞厓鏍�
+ List ResultRow = new ArrayList();
+ // System.out.println();
+ for (Cell cell : row) {
+ String LastCellvalue = "";
+ // 鍒ゆ柇鍗曞厓鏍肩被鍨嬫槸鍚︿负鍏紡绫诲瀷
+ if (cell.getCellType() == CellType.FORMULA) {
+ // 浣跨敤鍏紡璁$畻鍣ㄨ绠楀崟鍏冩牸鐨勫��
+ FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
+ CellValue cellValue = evaluator.evaluate(cell);
+ // 璁$畻鍚庣殑鍗曞厓鏍煎��
+ LastCellvalue = cellValue.getNumberValue() + "";
+ } else if (cell.getCellType() == CellType.NUMERIC) {
+ double value = cell.getNumericCellValue();
+ if (value % 1 == 0) {
+ LastCellvalue = Math.round(value) + "";
+ } else {
+ LastCellvalue = value + "";
+ }
+ } else {
+ // 鍗曞厓鏍煎��
+ LastCellvalue = cell.toString();
+ }
+ ResultRow.add(LastCellvalue);
+ // System.out.print(LastCellvalue+" ");
+ }
+ Results.add(ResultRow);
+ i++;
+ }
+ System.out.println(i);
+ // 鍏抽棴宸ヤ綔绨垮拰杈撳叆娴佸璞�
+ workbook.close();
+ inputStream.close();
+ return Results;
+ } catch (Exception e) {
+ // TODO: handle exception
+ System.out.println("寮傚父");
+ return new ArrayList();
+ }
+
+ }
+
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java b/springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java
index b56fdf0..14acc27 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java
@@ -237,7 +237,7 @@
}
//鎵嬪姩瀹屾垚浠诲姟
- public Result FinishTask( Integer id) {
+ public Result FinishTask(Integer id) {
StorageTask storageTask = homeMapper.SelectStorageTaskById(id);//鑾峰彇浠诲姟淇℃伅
homeMapper.FinishTask(storageTask.getId());//瀹屾垚浠诲姟
if(storageTask.getTaskType().equals("0")){
--
Gitblit v1.8.0