From 3744ee1fd763d7414a38f515ba13224866b924aa Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期二, 03 九月 2024 12:30:34 +0800
Subject: [PATCH] Merge branch 'master' of http://bore.pub:10439/r/HangZhouMes
---
hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java | 5
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/UnLoadGlassApplication.java | 4
UI-Project/src/layout/MainErpView.vue | 7
hangzhoumesParent/common/pom.xml | 29 +-
hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/TemperingGlassModuleApplication.java | 4
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java | 2
hangzhoumesParent/pom.xml | 5
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/tools/SocketUtil.java | 168 +++++++++++++++++++++
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java | 34 ++++
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/config/SocketConfig.java | 26 +++
hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/GlassInfo.java | 4
UI-Project/src/main.js | 5
hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/OptimizeGlassinfo.java | 4
hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/Swagger2Config.java | 117 ++++++++------
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/LoadGlassModuleApplication.java | 4
UI-Project/src/views/PurchaseReturn/purchaseReturn.vue | 2
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/CacheGlassModuleApplication.java | 4
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/CacheVerticalClassModuleApplication.java | 4
hangzhoumesParent/moduleService/GlassStorageModule/src/main/java/com/mes/GlassStorageApplication.java | 4
hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/job/PlcScreenTask.java | 4
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/application.yml | 3
21 files changed, 352 insertions(+), 87 deletions(-)
diff --git a/UI-Project/src/layout/MainErpView.vue b/UI-Project/src/layout/MainErpView.vue
index 8fdf761..050df7b 100644
--- a/UI-Project/src/layout/MainErpView.vue
+++ b/UI-Project/src/layout/MainErpView.vue
@@ -188,10 +188,9 @@
</el-icon>
</el-button>
<div class="header-left">
- <el-button @click="toggleCollapse"
- style="height:30px;">鈽�</el-button>
- <!-- <el-button :icon="isCollapse ? 'el-icon-s-unfold' : 'el-icon-s-fold'" @click="toggleCollapse"
- style="height:30px;"></el-button> -->
+ <el-button @click="toggleCollapse" style="height: 30px;">
+ <el-icon><Expand /></el-icon>
+ </el-button>
</div>
</span>
</div>
diff --git a/UI-Project/src/main.js b/UI-Project/src/main.js
index 166ffa7..276e058 100644
--- a/UI-Project/src/main.js
+++ b/UI-Project/src/main.js
@@ -17,7 +17,12 @@
// Vue.prototype.$echarts = echarts
// app.component("v-chart", Echarts)
// app.config.globalProperties.$echarts = echarts
+import * as ElementPlusIconsVue from '@element-plus/icons-vue'
+
const app = createApp(App)
+for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
+ app.component(key, component)
+}
const pinia = createPinia()
pinia.use(piniaPluginPersistedstate )
app.use(VXETable)
diff --git a/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue b/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
index fe85ccf..ff7922f 100644
--- a/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
+++ b/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
@@ -49,7 +49,7 @@
tableData.value = response.data
console.log(response.data);
} else {
- ElMessage.warning(res.msg)
+ ElMessage.warning(response.message)
}
} catch (error) {
// console.error('Error fetching rects :', error);
diff --git a/hangzhoumesParent/common/pom.xml b/hangzhoumesParent/common/pom.xml
index 9da0bc0..49ca831 100644
--- a/hangzhoumesParent/common/pom.xml
+++ b/hangzhoumesParent/common/pom.xml
@@ -136,23 +136,22 @@
</exclusion>
</exclusions>
</dependency>
- <!-- 2.0~2.2 Knife4j 2.0.0 ~ 2.0.6-->
+ <dependency>
+ <groupId>com.github.xiaoymin</groupId>
+ <artifactId>knife4j-spring-boot-starter</artifactId>
+ <version>2.0.9</version>
+ </dependency>
+ <!-- 2.0~2.2 Knife4j 2.0.0 ~ 2.0.6-->
<!-- <dependency>-->
- <!-- <groupId>com.github.xiaoymin</groupId>-->
- <!-- <artifactId>knife4j-spring-boot-starter</artifactId>-->
- <!-- <version>2.0.6</version>-->
+ <!-- <groupId>io.springfox</groupId>-->
+ <!-- <artifactId>springfox-swagger2</artifactId>-->
+ <!-- <version>2.7.0</version>-->
<!-- </dependency>-->
-
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger2</artifactId>
- <version>2.7.0</version>
- </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger-ui</artifactId>
- <version>2.7.0</version>
- </dependency>
+ <!-- <dependency>-->
+ <!-- <groupId>io.springfox</groupId>-->
+ <!-- <artifactId>springfox-swagger-ui</artifactId>-->
+ <!-- <version>2.7.0</version>-->
+ <!-- </dependency>-->
<!--hutool java楠岃瘉鏂规硶绫�-->
<dependency>
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/Swagger2Config.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/Swagger2Config.java
index 0062ed2..c0b8e1f 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/Swagger2Config.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/Swagger2Config.java
@@ -3,19 +3,12 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
-import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
-import springfox.documentation.schema.ModelRef;
-import springfox.documentation.service.*;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
-import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
/**
* @author zhan_py
@@ -25,54 +18,82 @@
@Configuration
public class Swagger2Config {
+
@Bean
- public Docket webApiConfig() {
- List<Parameter> pars = new ArrayList<>();
- ParameterBuilder tokenPar = new ParameterBuilder();
- tokenPar.name("userId")
- .description("鐢ㄦ埛token")
- //.defaultValue(JwtHelper.createToken(1L, "admin"))
- .defaultValue("1")
- .modelRef(new ModelRef("string"))
- .parameterType("header")
- .required(false)
- .build();
- pars.add(tokenPar.build());
+ public Docket moduleDocket() {
+ return docket("mes鎺ュ彛鏂囨。", "com.mes");
+ }
+
+ private Docket docket(String groupName, String basePackages) {
return new Docket(DocumentationType.SWAGGER_2)
- .groupName("webApi")
- .apiInfo(webApiInfo())
+ .groupName(groupName)
+ .apiInfo(apiInfo())
.select()
- //鍙樉绀篴pi璺緞涓嬬殑椤甸潰
- .apis(RequestHandlerSelectors.basePackage("com.mes"))
+ .apis(RequestHandlerSelectors.basePackage(basePackages))
.paths(PathSelectors.any())
- .build()
- .globalOperationParameters(pars)
- .securitySchemes(Collections.EMPTY_LIST)
- .securityContexts(Arrays.asList(securityContext()));
- }
-
- private SecurityContext securityContext() {
- return SecurityContext.builder()
- .securityReferences(defaultAuth())
- .forPaths(PathSelectors.any())
.build();
}
- private List<SecurityReference> defaultAuth() {
- AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
- AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
- authorizationScopes[0] = authorizationScope;
- return Arrays.asList(new SecurityReference("Authorization", authorizationScopes));
- }
-
-
- private ApiInfo webApiInfo() {
+ private ApiInfo apiInfo() {
return new ApiInfoBuilder()
- .title("缃戠珯-API鏂囨。")
- .description("鏈枃妗f弿杩颁簡mes缃戠珯寰湇鍔℃帴鍙e畾涔�")
- .version("1.0")
- .contact(new Contact("zhan_py", "", ""))
+ .title("mes鎺ュ彛鏂囨。绯荤粺")
+ .description("mesApi鎺ュ彛鏂囨。绯荤粺")
+ .license("Powered By mes")
+ .licenseUrl("http://127.0.0.1")
+ .termsOfServiceUrl("http://127.0.0.1")
+ .contact(new Contact("mes", "http://127.0.0.1", "beibo@mes.com"))
+ .version("V1.0.0")
.build();
}
+
+
+// @Bean
+// public Docket webApiConfig() {
+// List<Parameter> pars = new ArrayList<>();
+// ParameterBuilder tokenPar = new ParameterBuilder();
+// tokenPar.name("userId")
+// .description("鐢ㄦ埛token")
+// .defaultValue("1")
+// .modelRef(new ModelRef("string"))
+// .parameterType("header")
+// .required(false)
+// .build();
+// pars.add(tokenPar.build());
+//
+// return new Docket(DocumentationType.SWAGGER_2)
+// .apiInfo(webApiInfo())
+// .select()
+// //鍙樉绀篴pi璺緞涓嬬殑椤甸潰
+// .apis(RequestHandlerSelectors.basePackage("com.mes"))
+// .paths(PathSelectors.any())
+// .build()
+// .globalOperationParameters(pars)
+// .securitySchemes(Collections.EMPTY_LIST)
+// .securityContexts(Arrays.asList(securityContext()));
+// }
+//
+// private SecurityContext securityContext() {
+// return SecurityContext.builder()
+// .securityReferences(defaultAuth())
+// .forPaths(PathSelectors.any())
+// .build();
+// }
+//
+// private List<SecurityReference> defaultAuth() {
+// AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
+// AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
+// authorizationScopes[0] = authorizationScope;
+// return Arrays.asList(new SecurityReference("Authorization", authorizationScopes));
+// }
+//
+//
+// private ApiInfo webApiInfo() {
+// return new ApiInfoBuilder()
+// .title("缃戠珯-API鏂囨。")
+// .description("鏈枃妗f弿杩颁簡mes缃戠珯寰湇鍔℃帴鍙e畾涔�")
+// .version("1.0")
+// .contact(new Contact("zhan_py", "", ""))
+// .build();
+// }
}
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/GlassInfo.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/GlassInfo.java
index 0c6ae56..6ef464d 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/GlassInfo.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/GlassInfo.java
@@ -141,6 +141,10 @@
* 鐜荤拑ID
*/
private String glassId;
+ /**
+ * 鏄惁鍚堝苟
+ */
+ private Integer merge;
}
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/OptimizeGlassinfo.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/OptimizeGlassinfo.java
index 54e844b..d7d5958 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/OptimizeGlassinfo.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/OptimizeGlassinfo.java
@@ -104,6 +104,10 @@
*/
private Integer orderSort;
/**
+ * 鏄惁鍚堝苟
+ */
+ private Integer merge;
+ /**
* 鏃嬭浆瑙掑害
*/
private double rotateAngle;
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java
index 10ab730..dd2be16 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java
@@ -40,13 +40,13 @@
List<OptimizeGlassinfo> optimizeGlassinfos = null;
if (engineeringId != null) {
optimizeGlassinfos = optimizeProjectMapper.selectJoinList(OptimizeGlassinfo.class, new MPJQueryWrapper<OptimizeProject>()
- .select("b.process_id,t.glass_type,b.o_width,b.o_height,t.glass_thickness,b.order_sort,b.p_width,b.p_height,b.layer, b.total_layer, b.stock_id,b.heat_layout_id,b.heat_layout_sort,c.x_axis,c.y_axis,b.project_no,b.glass_id,c.rotate_angle")
+ .select("b.process_id,t.glass_type,b.o_width,b.o_height,t.glass_thickness,b.order_sort,b.p_width,b.p_height,b.layer, b.total_layer, b.stock_id,b.heat_layout_id,b.heat_layout_sort,c.x_axis,c.y_axis,b.project_no,b.glass_id,c.rotate_angle,d.merge")
.leftJoin("optimize_detail b on t.project_no=b.project_no")
.leftJoin("optimize_heat_detail c on c.project_no=t.project_no and b.heat_layout_id=c.layout_id and b.heat_layout_sort=c.sort")
+ .leftJoin("flow_card d on d.process_id=b.process_id and d.layers_number=b.layer")
//.eq("t.state",100)
.eq("t.project_no", engineeringId));
}
- //order_sort,o_width,o_height
// 鍒涘缓涓�涓� List 鐢ㄤ簬淇濆瓨鏄犲皠鍚庣殑瀹炰綋瀵硅薄
List<GlassInfo> resultList = new ArrayList<>();
@@ -73,6 +73,7 @@
glassInfo.setYCoordinate(map.getYAxis());
glassInfo.setAngle(map.getRotateAngle());
glassInfo.setGlassId(map.getGlassId());
+ glassInfo.setMerge(map.getMerge());
// 灏嗘槧灏勫悗鐨勫璞℃坊鍔犲埌缁撴灉鍒楄〃涓�
resultList.add(glassInfo);
}
diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/CacheGlassModuleApplication.java b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/CacheGlassModuleApplication.java
index 13cceb4..b3de82f 100644
--- a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/CacheGlassModuleApplication.java
+++ b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/CacheGlassModuleApplication.java
@@ -6,7 +6,7 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.scheduling.annotation.EnableScheduling;
-import springfox.documentation.swagger2.annotations.EnableSwagger2;
+import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
/**
* @Author : zhoush
@@ -17,7 +17,7 @@
@SpringBootApplication
@MapperScan("com.mes.*.mapper")
@EnableDiscoveryClient
-@EnableSwagger2
+@EnableSwagger2WebMvc
@EnableScheduling
public class CacheGlassModuleApplication {
diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java
index d0fb44d..9d0c330 100644
--- a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java
+++ b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java
@@ -137,7 +137,7 @@
//鍔犵瀛愰噷闈㈡槸鍚︽湁鐜荤拑锛屾湁鍏堝嚭锛屾棤鐜荤拑鍏堣繘
boolean outFlase = outTo(Integer.parseInt(out08Glassstate),
Integer.parseInt(out10Glassstate), confirmationWrodAddress, glassIdeValue, Integer.parseInt(currentSlot));
- log.info("鍑虹墖浠诲姟鏄惁瀹屾垚锛歿},澶辫触涓旂幓鐠僫d:{}涓嶄负绌哄垯鎵ц杩涚墖浠诲姟", outFlase, glassIdeValue);
+ log.info("鍑虹墖浠诲姟鏄惁瀹屾垚锛歿},涓旂幓鐠僫d:{}涓嶄负绌哄垯鎵ц杩涚墖浠诲姟", outFlase, glassIdeValue);
if (!outFlase && StringUtils.isNotBlank(glassIdeValue)) {
inTo(glassIdeValue, confirmationWrodAddress, currentSlot);
}
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/CacheVerticalClassModuleApplication.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/CacheVerticalClassModuleApplication.java
index bdd4e12..ecfee1f 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/CacheVerticalClassModuleApplication.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/CacheVerticalClassModuleApplication.java
@@ -6,7 +6,7 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.scheduling.annotation.EnableScheduling;
-import springfox.documentation.swagger2.annotations.EnableSwagger2;
+import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
/**
* @Author : zhoush
@@ -15,7 +15,7 @@
*/
@Slf4j
@SpringBootApplication
-@EnableSwagger2
+@EnableSwagger2WebMvc
@EnableDiscoveryClient
@MapperScan(basePackages = "com.mes.*.mapper")
@EnableScheduling
diff --git a/hangzhoumesParent/moduleService/GlassStorageModule/src/main/java/com/mes/GlassStorageApplication.java b/hangzhoumesParent/moduleService/GlassStorageModule/src/main/java/com/mes/GlassStorageApplication.java
index 1ac53de..1d461dc 100644
--- a/hangzhoumesParent/moduleService/GlassStorageModule/src/main/java/com/mes/GlassStorageApplication.java
+++ b/hangzhoumesParent/moduleService/GlassStorageModule/src/main/java/com/mes/GlassStorageApplication.java
@@ -6,7 +6,7 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.scheduling.annotation.EnableScheduling;
-import springfox.documentation.swagger2.annotations.EnableSwagger2;
+import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
/**
* @Author : zhoush
@@ -15,7 +15,7 @@
*/
@Slf4j
@SpringBootApplication
-@EnableSwagger2
+@EnableSwagger2WebMvc
@EnableDiscoveryClient
@MapperScan(basePackages = "com.mes.*.mapper")
@EnableScheduling
diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/LoadGlassModuleApplication.java b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/LoadGlassModuleApplication.java
index 593308c..5d05d8e 100644
--- a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/LoadGlassModuleApplication.java
+++ b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/LoadGlassModuleApplication.java
@@ -6,7 +6,7 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.scheduling.annotation.EnableScheduling;
-import springfox.documentation.swagger2.annotations.EnableSwagger2;
+import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
/**
* @Author : zhoush
@@ -15,7 +15,7 @@
*/
@Slf4j
@SpringBootApplication
-@EnableSwagger2
+@EnableSwagger2WebMvc
@EnableDiscoveryClient
@EnableScheduling
@MapperScan(basePackages = "com.mes.*.mapper")
diff --git a/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/TemperingGlassModuleApplication.java b/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/TemperingGlassModuleApplication.java
index 8fb3948..1538e9e 100644
--- a/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/TemperingGlassModuleApplication.java
+++ b/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/TemperingGlassModuleApplication.java
@@ -6,7 +6,7 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.scheduling.annotation.EnableScheduling;
-import springfox.documentation.swagger2.annotations.EnableSwagger2;
+import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
/**
* @Author : zhoush
@@ -15,7 +15,7 @@
*/
@Slf4j
@SpringBootApplication
-@EnableSwagger2
+@EnableSwagger2WebMvc
@EnableDiscoveryClient
@EnableScheduling
@MapperScan(basePackages = "com.mes.*.mapper")
diff --git a/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/job/PlcScreenTask.java b/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/job/PlcScreenTask.java
index f8df5ef..2a52753 100644
--- a/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/job/PlcScreenTask.java
+++ b/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/job/PlcScreenTask.java
@@ -51,8 +51,8 @@
String startOfPeriodStr = startOfPeriod.format(formatter);
String endOfPeriodStr = endOfPeriod.format(formatter);
// 璁剧疆涓烘渶杩戜竷澶╃殑鏃堕棿鑼冨洿
- reportingdamage.setReportingWorkTime("2024-05-11");
- //reportingdamage.setReportingWorkTime("2024-05-11");
+// reportingdamage.setReportingWorkTime("2024-05-11");
+ reportingdamage.setReportingWorkTime(startOfPeriodStr);
reportingdamage.setReportingWorkTime2(endOfPeriodStr);
//鎵囧舰鍥惧悇璁惧鐨勫姞宸ョ牬鎹熸暟閲�
List<Reportingdamage> device = reportingWorkService.selectDamage(reportingdamage);
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/UnLoadGlassApplication.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/UnLoadGlassApplication.java
index fba11e1..6066c94 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/UnLoadGlassApplication.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/UnLoadGlassApplication.java
@@ -6,7 +6,7 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.scheduling.annotation.EnableScheduling;
-import springfox.documentation.swagger2.annotations.EnableSwagger2;
+import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
/**
* @Author : zhoush
@@ -15,7 +15,7 @@
*/
@Slf4j
@SpringBootApplication
-@EnableSwagger2
+@EnableSwagger2WebMvc
@EnableDiscoveryClient
@MapperScan(basePackages = "com.mes.*.mapper")
@EnableScheduling
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/config/SocketConfig.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/config/SocketConfig.java
new file mode 100644
index 0000000..e5cfb80
--- /dev/null
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/config/SocketConfig.java
@@ -0,0 +1,26 @@
+package com.mes.config;
+
+import com.mes.tools.SocketUtil;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * @Author : zhoush
+ * @Date: 2024/9/2 15:42
+ * @Description:
+ */
+@Configuration
+public class SocketConfig {
+
+ @Value("${mes.scan.ip}")
+ private String scanIp;
+
+ @Value("${mes.scan.port}")
+ private Integer scanPort;
+
+ @Bean
+ public SocketUtil getSocketUtil() {
+ return new SocketUtil(scanIp, scanPort);
+ }
+}
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java
index 8503db8..a0c7b32 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java
@@ -14,6 +14,7 @@
import com.mes.downworkstation.entity.DownWorkstation;
import com.mes.downworkstation.service.DownWorkstationService;
import com.mes.tools.DateUtil;
+import com.mes.tools.SocketUtil;
import com.mes.tools.WebSocketServer;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
@@ -38,8 +39,8 @@
private DownGlassInfoService downGlassInfoService;
@Autowired
private DownGlassTaskService downGlassTaskService;
-
-
+ @Autowired
+ SocketUtil socketUtil;
@Autowired
private RedisUtil redisUtil;
@@ -188,4 +189,33 @@
}
}
}
+
+ @Scheduled(fixedDelay = Long.MAX_VALUE)
+ public void scanCodeTask() {
+ while (true) {
+ try {
+ if (socketUtil.openSocket()) {
+ String data = socketUtil.receiveData();
+ if (StringUtils.isNotBlank(data)) {
+ log.info("鎵弿鏁版嵁锛�" + data);
+ //鍙戦�佹壂鎻忔暟鎹�
+ //todo:鎸夌収鐜荤拑id鑾峰彇鐜荤拑淇℃伅杩斿洖缁欏墠绔晫闈紝鍏蜂綋闇�瑕佸摢浜涙暟鎹緟纭
+ ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("scanCode");
+ if (sendwServer != null) {
+ for (WebSocketServer webserver : sendwServer) {
+ if (webserver != null && webserver.session.isOpen()) {
+ webserver.sendMessage(data);
+ }
+ }
+ }
+ }
+ } else {
+ log.info("socket杩炴帴澶辫触");
+ }
+ } catch (Exception e) {
+ log.info("socke鎵ц杩囩▼涓彂鐢熷紓甯�");
+ }
+ }
+
+ }
}
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/tools/SocketUtil.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/tools/SocketUtil.java
new file mode 100644
index 0000000..cbed75a
--- /dev/null
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/tools/SocketUtil.java
@@ -0,0 +1,168 @@
+package com.mes.tools;
+
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+
+/**
+ * @Author : zhoush
+ * @Date: 2024/9/2 15:32
+ * @Description:
+ */
+
+@Slf4j
+public class SocketUtil {
+ private final String host;
+ private final int port;
+
+ private final int connectionTimeout;
+ private final int soTimeout;
+
+ private Socket socket;
+
+ private DataOutputStream dataOutputStream;
+
+ private DataInputStream dataInputStream;
+
+ public SocketUtil(String host, int port) {
+ this(host, port, 5000, 5000);
+ }
+
+ public SocketUtil(String host, int port, int connectionTimeout, int soTimeout) {
+ this.host = host;
+ this.port = port;
+ this.connectionTimeout = connectionTimeout;
+ this.soTimeout = soTimeout;
+ }
+
+ /**
+ * 鎵撳紑Socket杩炴帴
+ *
+ * @return 鏄惁鎴愬姛鎵撳紑Socket杩炴帴
+ */
+ public boolean openSocket() {
+ try {
+ socket = new Socket();
+ InetSocketAddress socketAddress = new InetSocketAddress(host, port);
+ socket.setReuseAddress(true);
+ socket.setSoTimeout(soTimeout);
+ socket.connect(socketAddress, connectionTimeout);
+ dataOutputStream = new DataOutputStream(socket.getOutputStream());
+ dataInputStream = new DataInputStream(socket.getInputStream());
+ } catch (Exception e) {
+ log.error("鎵撳紑Socket杩炴帴澶辫触:", e);
+ return false;
+ }
+ return true;
+ }
+
+ public boolean sendData(String data) {
+ return sendData(data, "utf-8");
+ }
+
+ /**
+ * 鍙戦�佽姹傛暟鎹��
+ *
+ * @param data 鏁版嵁
+ * @param charset 瀛楃闆�
+ * @return 鏄惁鍙戦�佹垚鍔�
+ */
+ public boolean sendData(String data, String charset) {
+ boolean isSend = true;
+ try {
+ byte[] bytes = data.getBytes(charset);
+ dataOutputStream.writeInt(bytes.length);
+ dataOutputStream.write(bytes);
+ } catch (IOException e) {
+ log.error("鍙戦�佹暟鎹け璐�:", e);
+ isSend = false;
+ }
+ return isSend;
+ }
+
+ /**
+ * 鎺ユ敹鍝嶅簲鏁版嵁
+ */
+ public String receiveData() {
+ return receiveData("UTF-8");
+ }
+
+ /**
+ * 鎺ユ敹鍝嶅簲鏁版嵁
+ */
+ public String receiveData(String charset) {
+ String returnStr = null;
+ byte[] data;
+ try {
+ int length = dataInputStream.readInt();
+ if (length > 0) {
+ data = new byte[length];
+ dataInputStream.readFully(data);
+ returnStr = new String(data, charset);
+ }
+ } catch (IOException e) {
+ log.error("鎺ユ敹鏁版嵁澶辫触:", e);
+ }
+ return returnStr;
+ }
+
+ /**
+ * 鍏抽棴Socket杩炴帴鍜岃緭鍏ヨ緭鍑烘祦
+ */
+ public void close() {
+ try {
+ if (dataInputStream != null) {
+ dataInputStream.close();
+ }
+ } catch (IOException e) {
+ log.error("鍏抽棴杈撳叆娴佸け璐�:", e);
+ }
+ try {
+ if (dataOutputStream != null) {
+ dataOutputStream.close();
+ }
+ } catch (IOException e) {
+ log.error("鍏抽棴杈撳嚭娴佸け璐�:", e);
+ }
+ try {
+ if (socket != null) {
+ socket.close();
+ }
+ } catch (IOException e) {
+ log.error("鍏抽棴Socket澶辫触:", e);
+ }
+ }
+
+ /**
+ * Socket鐭繛鎺ュ彂閫佽姹傛暟鎹�
+ *
+ * @param host host
+ * @param port 绔彛
+ * @param requestData 璇锋眰鏁版嵁
+ * @return 鍝嶅簲鏁版嵁
+ */
+ public static String send(String host, int port, String requestData) {
+ SocketUtil socketUtil = new SocketUtil(host, port);
+ String resp = null;
+ try {
+ if (socketUtil.openSocket()) {
+ if (socketUtil.sendData(requestData)) {
+ resp = socketUtil.receiveData();
+ } else {
+ log.error("SocketUtil.send鍙戦�佹暟鎹け璐�");
+ }
+ } else {
+ log.error("SocketUtil.openSocket鎵撳紑Socket澶辫触");
+ }
+ } catch (Exception e) {
+ log.error("SocketUtil.send鍙戦�佽姹傚け璐�:", e);
+ } finally {
+ socketUtil.close();
+ }
+ return resp;
+ }
+}
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/application.yml b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/application.yml
index 9468ed9..6c89ab2 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/application.yml
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/application.yml
@@ -21,3 +21,6 @@
throughWidth: 3000
throughHeight: 2500
threshold: 5 #涓嬬墖鐨勬渶澶ч槇鍊�
+ scan:
+ ip: 127.0.0.1
+ port: 5000
diff --git a/hangzhoumesParent/pom.xml b/hangzhoumesParent/pom.xml
index 9ef3261..a9b0a6b 100644
--- a/hangzhoumesParent/pom.xml
+++ b/hangzhoumesParent/pom.xml
@@ -42,6 +42,11 @@
<type>pom</type>
<scope>import</scope>
</dependency>
+ <dependency>
+ <groupId>org.springframework.plugin</groupId>
+ <artifactId>spring-plugin-core</artifactId>
+ <version>2.0.0.RELEASE</version>
+ </dependency>
</dependencies>
</dependencyManagement>
--
Gitblit v1.8.0