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> 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) 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); hangzhoumesParent/common/pom.xml
@@ -136,23 +136,22 @@ </exclusion> </exclusions> </dependency> <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> 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() //只显示api路径下的页面 .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("本文档描述了mes网站微服务接口定义") .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() // //只显示api路径下的页面 // .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("本文档描述了mes网站微服务接口定义") // .version("1.0") // .contact(new Contact("zhan_py", "", "")) // .build(); // } } hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/GlassInfo.java
@@ -141,6 +141,10 @@ * 玻璃ID */ private String glassId; /** * 是否合并 */ private Integer merge; } 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; 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); } 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 { 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("出片任务是否完成:{},失败且玻璃id:{}不为空则执行进片任务", outFlase, glassIdeValue); log.info("出片任务是否完成:{},且玻璃id:{}不为空则执行进片任务", outFlase, glassIdeValue); if (!outFlase && StringUtils.isNotBlank(glassIdeValue)) { inTo(glassIdeValue, confirmationWrodAddress, currentSlot); } 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 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 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") 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") 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(startOfPeriodStr); reportingdamage.setReportingWorkTime2(endOfPeriodStr); //扇形图各设备的加工破损数量 List<Reportingdamage> device = reportingWorkService.selectDamage(reportingdamage); 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 hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/config/SocketConfig.java
New file @@ -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); } } 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执行过程中发生异常"); } } } } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/tools/SocketUtil.java
New file @@ -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; } } 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 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>