From 3de2294ead88d6d164821f4c74427b3567b13e84 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 17 Mar 2026 22:51:34 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E5=9B=9B=E8=BD=AE=EF=BC=9AFlowInstanc?= =?UTF-8?q?e/FlowNodeLog=20=E5=90=8E=E7=AB=AF=E9=AA=A8=E6=9E=B6=20+=20WcsF?= =?UTF-8?q?lowLogController=E5=8D=87=E7=BA=A7=20+=20flowlog=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E9=A1=B5=E9=9D=A2=20+=20flowlog=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 11 + .env.example | 18 + Dockerfile | 19 + docker-compose.yml | 73 ++++ .../controller/WcsApiConfigController.java | 114 +++++ .../ruoyi/wcs/api/domain/WcsApiConfig.java | 187 ++++++++ .../wcs/api/mapper/WcsApiConfigMapper.java | 68 +++ .../java/com/ruoyi/wcs/api/package-info.java | 10 + .../wcs/api/service/IWcsApiConfigService.java | 60 +++ .../service/impl/WcsApiConfigServiceImpl.java | 64 +++ .../controller/WcsDeviceController.java | 84 ++++ .../controller/WcsDevicePointController.java | 76 ++++ .../ruoyi/wcs/device/domain/WcsDevice.java | 182 ++++++++ .../wcs/device/domain/WcsDevicePoint.java | 197 +++++++++ .../wcs/device/mapper/WcsDeviceMapper.java | 68 +++ .../device/mapper/WcsDevicePointMapper.java | 60 +++ .../com/ruoyi/wcs/device/package-info.java | 10 + .../service/IWcsDevicePointService.java | 52 +++ .../wcs/device/service/IWcsDeviceService.java | 60 +++ .../impl/WcsDevicePointServiceImpl.java | 50 +++ .../service/impl/WcsDeviceServiceImpl.java | 64 +++ .../flow/controller/WcsFlowDefController.java | 114 +++++ .../controller/WcsFlowInstanceController.java | 20 + .../controller/WcsFlowLineController.java | 79 ++++ .../flow/controller/WcsFlowLogController.java | 74 ++++ .../controller/WcsFlowNodeController.java | 101 +++++ .../com/ruoyi/wcs/flow/domain/WcsFlowDef.java | 142 +++++++ .../wcs/flow/domain/WcsFlowInstance.java | 103 +++++ .../ruoyi/wcs/flow/domain/WcsFlowLine.java | 132 ++++++ .../ruoyi/wcs/flow/domain/WcsFlowNode.java | 184 ++++++++ .../ruoyi/wcs/flow/domain/WcsFlowNodeLog.java | 168 ++++++++ .../wcs/flow/mapper/WcsFlowDefMapper.java | 26 ++ .../flow/mapper/WcsFlowInstanceMapper.java | 24 ++ .../wcs/flow/mapper/WcsFlowLineMapper.java | 22 + .../wcs/flow/mapper/WcsFlowNodeLogMapper.java | 28 ++ .../wcs/flow/mapper/WcsFlowNodeMapper.java | 24 ++ .../java/com/ruoyi/wcs/flow/package-info.java | 11 + .../wcs/flow/service/IWcsFlowDefService.java | 24 ++ .../flow/service/IWcsFlowInstanceService.java | 22 + .../wcs/flow/service/IWcsFlowLineService.java | 20 + .../flow/service/IWcsFlowNodeLogService.java | 26 ++ .../wcs/flow/service/IWcsFlowNodeService.java | 24 ++ .../service/impl/WcsFlowDefServiceImpl.java | 64 +++ .../impl/WcsFlowInstanceServiceImpl.java | 50 +++ .../service/impl/WcsFlowLineServiceImpl.java | 44 ++ .../impl/WcsFlowNodeLogServiceImpl.java | 62 +++ .../service/impl/WcsFlowNodeServiceImpl.java | 56 +++ .../java/com/ruoyi/wcs/job/package-info.java | 10 + .../main/java/com/ruoyi/wcs/package-info.java | 20 + .../java/com/ruoyi/wcs/plc/package-info.java | 10 + .../com/ruoyi/wcs/schedule/package-info.java | 10 + .../src/main/resources/application-druid.yml | 4 +- .../src/main/resources/application.yml | 2 +- .../mapper/wcs/WcsApiConfigMapper.xml | 125 ++++++ .../resources/mapper/wcs/WcsDeviceMapper.xml | 121 ++++++ .../mapper/wcs/WcsDevicePointMapper.xml | 119 ++++++ .../resources/mapper/wcs/WcsFlowDefMapper.xml | 110 +++++ .../mapper/wcs/WcsFlowInstanceMapper.xml | 95 +++++ .../mapper/wcs/WcsFlowLineMapper.xml | 63 +++ .../mapper/wcs/WcsFlowNodeLogMapper.xml | 114 +++++ .../mapper/wcs/WcsFlowNodeMapper.xml | 89 ++++ ruoyi-ui/src/api/wcs/apiconfig.js | 39 ++ ruoyi-ui/src/api/wcs/device.js | 39 ++ ruoyi-ui/src/api/wcs/flow.js | 55 +++ ruoyi-ui/src/api/wcs/flowlog.js | 26 ++ ruoyi-ui/src/api/wcs/point.js | 39 ++ ruoyi-ui/src/views/wcs/apiconfig/index.vue | 400 ++++++++++++++++++ ruoyi-ui/src/views/wcs/device/index.vue | 330 +++++++++++++++ ruoyi-ui/src/views/wcs/flowdef/index.vue | 353 ++++++++++++++++ ruoyi-ui/src/views/wcs/flowinstance/index.vue | 304 +++++++++++++ ruoyi-ui/src/views/wcs/flowlog/index.vue | 263 ++++++++++++ ruoyi-ui/src/views/wcs/point/index.vue | 347 +++++++++++++++ sql/wcs_init_mysql.sql | 238 +++++++++++ 73 files changed, 6494 insertions(+), 2 deletions(-) create mode 100644 .dockerignore create mode 100644 .env.example create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/api/controller/WcsApiConfigController.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/api/domain/WcsApiConfig.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/api/mapper/WcsApiConfigMapper.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/api/package-info.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/api/service/IWcsApiConfigService.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/api/service/impl/WcsApiConfigServiceImpl.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/device/controller/WcsDeviceController.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/device/controller/WcsDevicePointController.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/device/domain/WcsDevice.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/device/domain/WcsDevicePoint.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/device/mapper/WcsDeviceMapper.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/device/mapper/WcsDevicePointMapper.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/device/package-info.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/device/service/IWcsDevicePointService.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/device/service/IWcsDeviceService.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/device/service/impl/WcsDevicePointServiceImpl.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/device/service/impl/WcsDeviceServiceImpl.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/controller/WcsFlowDefController.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/controller/WcsFlowInstanceController.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/controller/WcsFlowLineController.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/controller/WcsFlowLogController.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/controller/WcsFlowNodeController.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/domain/WcsFlowDef.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/domain/WcsFlowInstance.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/domain/WcsFlowLine.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/domain/WcsFlowNode.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/domain/WcsFlowNodeLog.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/mapper/WcsFlowDefMapper.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/mapper/WcsFlowInstanceMapper.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/mapper/WcsFlowLineMapper.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/mapper/WcsFlowNodeLogMapper.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/mapper/WcsFlowNodeMapper.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/package-info.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/IWcsFlowDefService.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/IWcsFlowInstanceService.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/IWcsFlowLineService.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/IWcsFlowNodeLogService.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/IWcsFlowNodeService.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/impl/WcsFlowDefServiceImpl.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/impl/WcsFlowInstanceServiceImpl.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/impl/WcsFlowLineServiceImpl.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/impl/WcsFlowNodeLogServiceImpl.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/impl/WcsFlowNodeServiceImpl.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/job/package-info.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/package-info.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/plc/package-info.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/wcs/schedule/package-info.java create mode 100644 ruoyi-admin/src/main/resources/mapper/wcs/WcsApiConfigMapper.xml create mode 100644 ruoyi-admin/src/main/resources/mapper/wcs/WcsDeviceMapper.xml create mode 100644 ruoyi-admin/src/main/resources/mapper/wcs/WcsDevicePointMapper.xml create mode 100644 ruoyi-admin/src/main/resources/mapper/wcs/WcsFlowDefMapper.xml create mode 100644 ruoyi-admin/src/main/resources/mapper/wcs/WcsFlowInstanceMapper.xml create mode 100644 ruoyi-admin/src/main/resources/mapper/wcs/WcsFlowLineMapper.xml create mode 100644 ruoyi-admin/src/main/resources/mapper/wcs/WcsFlowNodeLogMapper.xml create mode 100644 ruoyi-admin/src/main/resources/mapper/wcs/WcsFlowNodeMapper.xml create mode 100644 ruoyi-ui/src/api/wcs/apiconfig.js create mode 100644 ruoyi-ui/src/api/wcs/device.js create mode 100644 ruoyi-ui/src/api/wcs/flow.js create mode 100644 ruoyi-ui/src/api/wcs/flowlog.js create mode 100644 ruoyi-ui/src/api/wcs/point.js create mode 100644 ruoyi-ui/src/views/wcs/apiconfig/index.vue create mode 100644 ruoyi-ui/src/views/wcs/device/index.vue create mode 100644 ruoyi-ui/src/views/wcs/flowdef/index.vue create mode 100644 ruoyi-ui/src/views/wcs/flowinstance/index.vue create mode 100644 ruoyi-ui/src/views/wcs/flowlog/index.vue create mode 100644 ruoyi-ui/src/views/wcs/point/index.vue create mode 100644 sql/wcs_init_mysql.sql diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..685d3487 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,11 @@ +**/target/ +**/node_modules/ +**/.git +**/.idea +**/.vscode +**/*.iml +**/dist/ +**/.DS_Store +**/logs/ +docker-compose.yml +.env diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..10b76741 --- /dev/null +++ b/.env.example @@ -0,0 +1,18 @@ +# WCS-RuoYi Docker 环境变量示例 +# 复制此文件为 .env 并修改为实际值 + +# MySQL +MYSQL_DATABASE=ry-vue +MYSQL_ROOT_PASSWORD=change_me_root +MYSQL_USER=ruoyi +MYSQL_PASSWORD=change_me +MYSQL_PORT=3306 + +# Redis +REDIS_PORT=6379 + +# 后端服务 +SERVER_PORT=8080 + +# 前端 +UI_PORT=80 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..462944e4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM maven:3.8-openjdk-8 AS build +WORKDIR /app +COPY pom.xml . +COPY ruoyi-admin/pom.xml ruoyi-admin/pom.xml +COPY ruoyi-common/pom.xml ruoyi-common/pom.xml +COPY ruoyi-framework/pom.xml ruoyi-framework/pom.xml +COPY ruoyi-generator/pom.xml ruoyi-generator/pom.xml +COPY ruoyi-quartz/pom.xml ruoyi-quartz/pom.xml +COPY ruoyi-system/pom.xml ruoyi-system/pom.xml +RUN mvn dependency:go-offline -B || true +COPY . . +RUN mvn package -DskipTests -q + +FROM openjdk:8-jre-slim +WORKDIR /app +COPY --from=build /app/ruoyi-admin/target/ruoyi-admin.jar app.jar +EXPOSE 8080 +ENV JAVA_OPTS="-Xms256m -Xmx512m" +ENTRYPOINT ["sh", "-c", "java ${JAVA_OPTS} -jar app.jar"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..94d1e63a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,73 @@ +version: '3.8' + +services: + mysql: + image: mysql:8.0 + container_name: wcs-mysql + environment: + MYSQL_DATABASE: ${MYSQL_DATABASE:-ry-vue} + MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-your_password_here} + MYSQL_USER: ${MYSQL_USER:-ruoyi} + MYSQL_PASSWORD: ${MYSQL_PASSWORD:-your_password_here} + ports: + - "${MYSQL_PORT:-3306}:3306" + volumes: + - mysql-data:/var/lib/mysql + - ./sql:/docker-entrypoint-initdb.d + command: > + --character-set-server=utf8mb4 + --collation-server=utf8mb4_general_ci + --default-authentication-plugin=mysql_native_password + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] + interval: 10s + timeout: 5s + retries: 5 + + redis: + image: redis:7-alpine + container_name: wcs-redis + ports: + - "${REDIS_PORT:-6379}:6379" + volumes: + - redis-data:/data + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 10s + timeout: 5s + retries: 5 + + ruoyi-server: + build: + context: . + dockerfile: Dockerfile + container_name: wcs-server + ports: + - "${SERVER_PORT:-8080}:8080" + environment: + SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/${MYSQL_DATABASE:-ry-vue}?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai + SPRING_DATASOURCE_USERNAME: ${MYSQL_USER:-ruoyi} + SPRING_DATASOURCE_PASSWORD: ${MYSQL_PASSWORD:-your_password_here} + SPRING_REDIS_HOST: redis + SPRING_REDIS_PORT: 6379 + depends_on: + mysql: + condition: service_healthy + redis: + condition: service_healthy + + ruoyi-ui: + image: node:16-alpine + container_name: wcs-ui + working_dir: /app + volumes: + - ./ruoyi-ui:/app + ports: + - "${UI_PORT:-80}:80" + command: sh -c "npm install --registry https://registry.npmmirror.com && npm run dev" + depends_on: + - ruoyi-server + +volumes: + mysql-data: + redis-data: diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/api/controller/WcsApiConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/api/controller/WcsApiConfigController.java new file mode 100644 index 00000000..48f58c0a --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/api/controller/WcsApiConfigController.java @@ -0,0 +1,114 @@ +package com.ruoyi.wcs.api.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.wcs.api.domain.WcsApiConfig; +import com.ruoyi.wcs.api.service.IWcsApiConfigService; + +/** + * 接口配置 Controller + * + * @author wcs + */ +@RestController +@RequestMapping("/wcs/api/config") +public class WcsApiConfigController extends BaseController +{ + @Autowired + private IWcsApiConfigService apiConfigService; + + /** + * 查询接口配置列表 + */ + @PreAuthorize("@ss.hasPermi('wcs:api:list')") + @GetMapping("/list") + public TableDataInfo list(WcsApiConfig apiConfig) + { + startPage(); + List list = apiConfigService.selectApiConfigList(apiConfig); + return getDataTable(list); + } + + /** + * 导出接口配置列表 + */ + @Log(title = "接口配置", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('wcs:api:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, WcsApiConfig apiConfig) + { + List list = apiConfigService.selectApiConfigList(apiConfig); + ExcelUtil util = new ExcelUtil(WcsApiConfig.class); + util.exportExcel(response, list, "接口配置数据"); + } + + /** + * 根据接口ID获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('wcs:api:query')") + @GetMapping(value = "/{apiId}") + public AjaxResult getInfo(@PathVariable Long apiId) + { + return success(apiConfigService.selectApiConfigById(apiId)); + } + + /** + * 新增接口配置 + */ + @PreAuthorize("@ss.hasPermi('wcs:api:add')") + @Log(title = "接口配置", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody WcsApiConfig apiConfig) + { + if (!apiConfigService.checkApiCodeUnique(apiConfig)) + { + return error("新增接口'" + apiConfig.getApiCode() + "'失败,接口编码已存在"); + } + apiConfig.setCreateBy(getUsername()); + return toAjax(apiConfigService.insertApiConfig(apiConfig)); + } + + /** + * 修改接口配置 + */ + @PreAuthorize("@ss.hasPermi('wcs:api:edit')") + @Log(title = "接口配置", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody WcsApiConfig apiConfig) + { + if (!apiConfigService.checkApiCodeUnique(apiConfig)) + { + return error("修改接口'" + apiConfig.getApiCode() + "'失败,接口编码已存在"); + } + apiConfig.setUpdateBy(getUsername()); + return toAjax(apiConfigService.updateApiConfig(apiConfig)); + } + + /** + * 删除接口配置 + */ + @PreAuthorize("@ss.hasPermi('wcs:api:remove')") + @Log(title = "接口配置", businessType = BusinessType.DELETE) + @DeleteMapping("/{apiIds}") + public AjaxResult remove(@PathVariable Long[] apiIds) + { + return toAjax(apiConfigService.deleteApiConfigByIds(apiIds)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/api/domain/WcsApiConfig.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/api/domain/WcsApiConfig.java new file mode 100644 index 00000000..abab5f51 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/api/domain/WcsApiConfig.java @@ -0,0 +1,187 @@ +package com.ruoyi.wcs.api.domain; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excel.ColumnType; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 接口配置表 wcs_api_config + * + * @author wcs + */ +public class WcsApiConfig extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + @Excel(name = "接口ID", cellType = ColumnType.NUMERIC) + private Long apiId; + + @Excel(name = "接口编码") + private String apiCode; + + @Excel(name = "接口名称") + private String apiName; + + @Excel(name = "接口地址") + private String apiUrl; + + @Excel(name = "请求方式") + private String requestMethod; + + @Excel(name = "内容类型") + private String contentType; + + @Excel(name = "超时时间", cellType = ColumnType.NUMERIC) + private Integer timeout; + + @Excel(name = "重试次数", cellType = ColumnType.NUMERIC) + private Integer retryCount; + + @Excel(name = "方向", readConverterExp = "inbound=入站,outbound=出站") + private String direction; + + @Excel(name = "状态", readConverterExp = "0=正常,1=停用") + private String status; + + private String delFlag; + + public Long getApiId() + { + return apiId; + } + + public void setApiId(Long apiId) + { + this.apiId = apiId; + } + + @NotBlank(message = "接口编码不能为空") + @Size(min = 0, max = 64, message = "接口编码长度不能超过64个字符") + public String getApiCode() + { + return apiCode; + } + + public void setApiCode(String apiCode) + { + this.apiCode = apiCode; + } + + @Size(min = 0, max = 128, message = "接口名称长度不能超过128个字符") + public String getApiName() + { + return apiName; + } + + public void setApiName(String apiName) + { + this.apiName = apiName; + } + + @Size(min = 0, max = 512, message = "接口地址长度不能超过512个字符") + public String getApiUrl() + { + return apiUrl; + } + + public void setApiUrl(String apiUrl) + { + this.apiUrl = apiUrl; + } + + public String getRequestMethod() + { + return requestMethod; + } + + public void setRequestMethod(String requestMethod) + { + this.requestMethod = requestMethod; + } + + public String getContentType() + { + return contentType; + } + + public void setContentType(String contentType) + { + this.contentType = contentType; + } + + public Integer getTimeout() + { + return timeout; + } + + public void setTimeout(Integer timeout) + { + this.timeout = timeout; + } + + public Integer getRetryCount() + { + return retryCount; + } + + public void setRetryCount(Integer retryCount) + { + this.retryCount = retryCount; + } + + public String getDirection() + { + return direction; + } + + public void setDirection(String direction) + { + this.direction = direction; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getDelFlag() + { + return delFlag; + } + + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + @Override + public String toString() + { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("apiId", getApiId()) + .append("apiCode", getApiCode()) + .append("apiName", getApiName()) + .append("apiUrl", getApiUrl()) + .append("requestMethod", getRequestMethod()) + .append("contentType", getContentType()) + .append("timeout", getTimeout()) + .append("retryCount", getRetryCount()) + .append("direction", getDirection()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/api/mapper/WcsApiConfigMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/api/mapper/WcsApiConfigMapper.java new file mode 100644 index 00000000..f2675bf5 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/api/mapper/WcsApiConfigMapper.java @@ -0,0 +1,68 @@ +package com.ruoyi.wcs.api.mapper; + +import java.util.List; +import com.ruoyi.wcs.api.domain.WcsApiConfig; + +/** + * 接口配置 数据层 + * + * @author wcs + */ +public interface WcsApiConfigMapper +{ + /** + * 查询接口配置列表 + * + * @param apiConfig 接口配置信息 + * @return 接口配置集合 + */ + public List selectApiConfigList(WcsApiConfig apiConfig); + + /** + * 通过接口ID查询接口配置 + * + * @param apiId 接口ID + * @return 接口配置对象 + */ + public WcsApiConfig selectApiConfigById(Long apiId); + + /** + * 新增接口配置 + * + * @param apiConfig 接口配置信息 + * @return 结果 + */ + public int insertApiConfig(WcsApiConfig apiConfig); + + /** + * 修改接口配置 + * + * @param apiConfig 接口配置信息 + * @return 结果 + */ + public int updateApiConfig(WcsApiConfig apiConfig); + + /** + * 删除接口配置 + * + * @param apiId 接口ID + * @return 结果 + */ + public int deleteApiConfigById(Long apiId); + + /** + * 批量删除接口配置 + * + * @param apiIds 接口ID数组 + * @return 结果 + */ + public int deleteApiConfigByIds(Long[] apiIds); + + /** + * 校验接口编码是否唯一 + * + * @param apiCode 接口编码 + * @return 接口配置信息 + */ + public WcsApiConfig checkApiCodeUnique(String apiCode); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/api/package-info.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/api/package-info.java new file mode 100644 index 00000000..2a6cc74c --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/api/package-info.java @@ -0,0 +1,10 @@ +/** + * WCS 接口配置模块 + *

+ * 管理 WCS 与外部系统(WMS / ERP / PLC 等)的 API 接口配置, + * 包括接口地址、请求方式、超时设置、重试策略等。 + *

+ * + * @author WCS + */ +package com.ruoyi.wcs.api; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/api/service/IWcsApiConfigService.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/api/service/IWcsApiConfigService.java new file mode 100644 index 00000000..1c8d85ce --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/api/service/IWcsApiConfigService.java @@ -0,0 +1,60 @@ +package com.ruoyi.wcs.api.service; + +import java.util.List; +import com.ruoyi.wcs.api.domain.WcsApiConfig; + +/** + * 接口配置 服务层 + * + * @author wcs + */ +public interface IWcsApiConfigService +{ + /** + * 查询接口配置列表 + * + * @param apiConfig 接口配置信息 + * @return 接口配置集合 + */ + public List selectApiConfigList(WcsApiConfig apiConfig); + + /** + * 通过接口ID查询接口配置 + * + * @param apiId 接口ID + * @return 接口配置对象 + */ + public WcsApiConfig selectApiConfigById(Long apiId); + + /** + * 新增接口配置 + * + * @param apiConfig 接口配置信息 + * @return 结果 + */ + public int insertApiConfig(WcsApiConfig apiConfig); + + /** + * 修改接口配置 + * + * @param apiConfig 接口配置信息 + * @return 结果 + */ + public int updateApiConfig(WcsApiConfig apiConfig); + + /** + * 批量删除接口配置 + * + * @param apiIds 接口ID数组 + * @return 结果 + */ + public int deleteApiConfigByIds(Long[] apiIds); + + /** + * 校验接口编码是否唯一 + * + * @param apiConfig 接口配置信息 + * @return 结果 + */ + public boolean checkApiCodeUnique(WcsApiConfig apiConfig); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/api/service/impl/WcsApiConfigServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/api/service/impl/WcsApiConfigServiceImpl.java new file mode 100644 index 00000000..9c3a0c02 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/api/service/impl/WcsApiConfigServiceImpl.java @@ -0,0 +1,64 @@ +package com.ruoyi.wcs.api.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.wcs.api.domain.WcsApiConfig; +import com.ruoyi.wcs.api.mapper.WcsApiConfigMapper; +import com.ruoyi.wcs.api.service.IWcsApiConfigService; + +/** + * 接口配置 服务层处理 + * + * @author wcs + */ +@Service +public class WcsApiConfigServiceImpl implements IWcsApiConfigService +{ + @Autowired + private WcsApiConfigMapper apiConfigMapper; + + @Override + public List selectApiConfigList(WcsApiConfig apiConfig) + { + return apiConfigMapper.selectApiConfigList(apiConfig); + } + + @Override + public WcsApiConfig selectApiConfigById(Long apiId) + { + return apiConfigMapper.selectApiConfigById(apiId); + } + + @Override + public int insertApiConfig(WcsApiConfig apiConfig) + { + return apiConfigMapper.insertApiConfig(apiConfig); + } + + @Override + public int updateApiConfig(WcsApiConfig apiConfig) + { + return apiConfigMapper.updateApiConfig(apiConfig); + } + + @Override + public int deleteApiConfigByIds(Long[] apiIds) + { + return apiConfigMapper.deleteApiConfigByIds(apiIds); + } + + @Override + public boolean checkApiCodeUnique(WcsApiConfig apiConfig) + { + Long apiId = StringUtils.isNull(apiConfig.getApiId()) ? -1L : apiConfig.getApiId(); + WcsApiConfig info = apiConfigMapper.checkApiCodeUnique(apiConfig.getApiCode()); + if (StringUtils.isNotNull(info) && info.getApiId().longValue() != apiId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/controller/WcsDeviceController.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/controller/WcsDeviceController.java new file mode 100644 index 00000000..80bc861e --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/controller/WcsDeviceController.java @@ -0,0 +1,84 @@ +package com.ruoyi.wcs.device.controller; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.wcs.device.domain.WcsDevice; +import com.ruoyi.wcs.device.service.IWcsDeviceService; + +/** + * WCS 设备管理 Controller + * + * @author wcs + */ +@RestController +@RequestMapping("/wcs/device") +public class WcsDeviceController extends BaseController +{ + @Autowired + private IWcsDeviceService deviceService; + + @PreAuthorize("@ss.hasPermi('wcs:device:list')") + @GetMapping("/list") + public TableDataInfo list(WcsDevice device) + { + startPage(); + List list = deviceService.selectDeviceList(device); + return getDataTable(list); + } + + @PreAuthorize("@ss.hasPermi('wcs:device:query')") + @GetMapping(value = "/{deviceId}") + public AjaxResult getInfo(@PathVariable Long deviceId) + { + return success(deviceService.selectDeviceById(deviceId)); + } + + @PreAuthorize("@ss.hasPermi('wcs:device:add')") + @Log(title = "设备管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody WcsDevice device) + { + if (!deviceService.checkDeviceCodeUnique(device)) + { + return error("新增设备'" + device.getDeviceCode() + "'失败,设备编码已存在"); + } + device.setCreateBy(getUsername()); + return toAjax(deviceService.insertDevice(device)); + } + + @PreAuthorize("@ss.hasPermi('wcs:device:edit')") + @Log(title = "设备管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody WcsDevice device) + { + if (!deviceService.checkDeviceCodeUnique(device)) + { + return error("修改设备'" + device.getDeviceCode() + "'失败,设备编码已存在"); + } + device.setUpdateBy(getUsername()); + return toAjax(deviceService.updateDevice(device)); + } + + @PreAuthorize("@ss.hasPermi('wcs:device:remove')") + @Log(title = "设备管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{deviceIds}") + public AjaxResult remove(@PathVariable Long[] deviceIds) + { + return toAjax(deviceService.deleteDeviceByIds(deviceIds)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/controller/WcsDevicePointController.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/controller/WcsDevicePointController.java new file mode 100644 index 00000000..7dabbdd3 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/controller/WcsDevicePointController.java @@ -0,0 +1,76 @@ +package com.ruoyi.wcs.device.controller; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.wcs.device.domain.WcsDevicePoint; +import com.ruoyi.wcs.device.service.IWcsDevicePointService; + +/** + * WCS 设备点位配置 Controller + * + * @author wcs + */ +@RestController +@RequestMapping("/wcs/device/point") +public class WcsDevicePointController extends BaseController +{ + @Autowired + private IWcsDevicePointService pointService; + + @PreAuthorize("@ss.hasPermi('wcs:point:list')") + @GetMapping("/list") + public TableDataInfo list(WcsDevicePoint point) + { + startPage(); + List list = pointService.selectPointList(point); + return getDataTable(list); + } + + @PreAuthorize("@ss.hasPermi('wcs:point:query')") + @GetMapping(value = "/{pointId}") + public AjaxResult getInfo(@PathVariable Long pointId) + { + return success(pointService.selectPointById(pointId)); + } + + @PreAuthorize("@ss.hasPermi('wcs:point:add')") + @Log(title = "点位配置", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody WcsDevicePoint point) + { + point.setCreateBy(getUsername()); + return toAjax(pointService.insertPoint(point)); + } + + @PreAuthorize("@ss.hasPermi('wcs:point:edit')") + @Log(title = "点位配置", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody WcsDevicePoint point) + { + point.setUpdateBy(getUsername()); + return toAjax(pointService.updatePoint(point)); + } + + @PreAuthorize("@ss.hasPermi('wcs:point:remove')") + @Log(title = "点位配置", businessType = BusinessType.DELETE) + @DeleteMapping("/{pointIds}") + public AjaxResult remove(@PathVariable Long[] pointIds) + { + return toAjax(pointService.deletePointByIds(pointIds)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/domain/WcsDevice.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/domain/WcsDevice.java new file mode 100644 index 00000000..1bd02b83 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/domain/WcsDevice.java @@ -0,0 +1,182 @@ +package com.ruoyi.wcs.device.domain; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excel.ColumnType; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 设备信息表 wcs_device + * + * @author wcs + */ +public class WcsDevice extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 设备ID */ + @Excel(name = "设备ID", cellType = ColumnType.NUMERIC) + private Long deviceId; + + /** 设备编码 */ + @Excel(name = "设备编码") + private String deviceCode; + + /** 设备名称 */ + @Excel(name = "设备名称") + private String deviceName; + + /** 设备类型 */ + @Excel(name = "设备类型") + private String deviceType; + + /** 所属区域编码 */ + @Excel(name = "区域编码") + private String areaCode; + + /** 通信协议 */ + @Excel(name = "通信协议") + private String protocolType; + + /** 设备IP地址 */ + @Excel(name = "IP地址") + private String ipAddress; + + /** 通信端口 */ + @Excel(name = "端口", cellType = ColumnType.NUMERIC) + private Integer port; + + /** 设备状态(0正常 1停用) */ + @Excel(name = "状态", readConverterExp = "0=正常,1=停用") + private String status; + + /** 删除标志(0存在 2删除) */ + private String delFlag; + + public Long getDeviceId() + { + return deviceId; + } + + public void setDeviceId(Long deviceId) + { + this.deviceId = deviceId; + } + + @NotBlank(message = "设备编码不能为空") + @Size(min = 0, max = 64, message = "设备编码长度不能超过64个字符") + public String getDeviceCode() + { + return deviceCode; + } + + public void setDeviceCode(String deviceCode) + { + this.deviceCode = deviceCode; + } + + @Size(min = 0, max = 128, message = "设备名称长度不能超过128个字符") + public String getDeviceName() + { + return deviceName; + } + + public void setDeviceName(String deviceName) + { + this.deviceName = deviceName; + } + + public String getDeviceType() + { + return deviceType; + } + + public void setDeviceType(String deviceType) + { + this.deviceType = deviceType; + } + + public String getAreaCode() + { + return areaCode; + } + + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getProtocolType() + { + return protocolType; + } + + public void setProtocolType(String protocolType) + { + this.protocolType = protocolType; + } + + public String getIpAddress() + { + return ipAddress; + } + + public void setIpAddress(String ipAddress) + { + this.ipAddress = ipAddress; + } + + public Integer getPort() + { + return port; + } + + public void setPort(Integer port) + { + this.port = port; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getDelFlag() + { + return delFlag; + } + + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + @Override + public String toString() + { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("deviceId", getDeviceId()) + .append("deviceCode", getDeviceCode()) + .append("deviceName", getDeviceName()) + .append("deviceType", getDeviceType()) + .append("areaCode", getAreaCode()) + .append("protocolType", getProtocolType()) + .append("ipAddress", getIpAddress()) + .append("port", getPort()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/domain/WcsDevicePoint.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/domain/WcsDevicePoint.java new file mode 100644 index 00000000..b09d630a --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/domain/WcsDevicePoint.java @@ -0,0 +1,197 @@ +package com.ruoyi.wcs.device.domain; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excel.ColumnType; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 设备点位表 wcs_device_point + * + * @author wcs + */ +public class WcsDevicePoint extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 点位ID */ + @Excel(name = "点位ID", cellType = ColumnType.NUMERIC) + private Long pointId; + + /** 所属设备ID */ + @Excel(name = "设备ID", cellType = ColumnType.NUMERIC) + private Long deviceId; + + /** 点位编码 */ + @Excel(name = "点位编码") + private String pointCode; + + /** 点位名称 */ + @Excel(name = "点位名称") + private String pointName; + + /** 点位类型(read/write/read_write) */ + @Excel(name = "点位类型") + private String pointType; + + /** 数据类型(int/float/bool/string) */ + @Excel(name = "数据类型") + private String dataType; + + /** 寄存器地址/OPC节点 */ + @Excel(name = "地址") + private String address; + + /** 单位 */ + @Excel(name = "单位") + private String unit; + + /** 状态(0正常 1停用) */ + @Excel(name = "状态", readConverterExp = "0=正常,1=停用") + private String status; + + /** 删除标志(0存在 2删除) */ + private String delFlag; + + /** 所属设备名称(非持久化,用于列表展示) */ + private String deviceName; + + public Long getPointId() + { + return pointId; + } + + public void setPointId(Long pointId) + { + this.pointId = pointId; + } + + @NotNull(message = "所属设备不能为空") + public Long getDeviceId() + { + return deviceId; + } + + public void setDeviceId(Long deviceId) + { + this.deviceId = deviceId; + } + + @NotBlank(message = "点位编码不能为空") + @Size(min = 0, max = 64, message = "点位编码长度不能超过64个字符") + public String getPointCode() + { + return pointCode; + } + + public void setPointCode(String pointCode) + { + this.pointCode = pointCode; + } + + @Size(min = 0, max = 128, message = "点位名称长度不能超过128个字符") + public String getPointName() + { + return pointName; + } + + public void setPointName(String pointName) + { + this.pointName = pointName; + } + + public String getPointType() + { + return pointType; + } + + public void setPointType(String pointType) + { + this.pointType = pointType; + } + + public String getDataType() + { + return dataType; + } + + public void setDataType(String dataType) + { + this.dataType = dataType; + } + + public String getAddress() + { + return address; + } + + public void setAddress(String address) + { + this.address = address; + } + + public String getUnit() + { + return unit; + } + + public void setUnit(String unit) + { + this.unit = unit; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getDelFlag() + { + return delFlag; + } + + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public String getDeviceName() + { + return deviceName; + } + + public void setDeviceName(String deviceName) + { + this.deviceName = deviceName; + } + + @Override + public String toString() + { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("pointId", getPointId()) + .append("deviceId", getDeviceId()) + .append("pointCode", getPointCode()) + .append("pointName", getPointName()) + .append("pointType", getPointType()) + .append("dataType", getDataType()) + .append("address", getAddress()) + .append("unit", getUnit()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/mapper/WcsDeviceMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/mapper/WcsDeviceMapper.java new file mode 100644 index 00000000..055495f9 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/mapper/WcsDeviceMapper.java @@ -0,0 +1,68 @@ +package com.ruoyi.wcs.device.mapper; + +import java.util.List; +import com.ruoyi.wcs.device.domain.WcsDevice; + +/** + * 设备信息 数据层 + * + * @author wcs + */ +public interface WcsDeviceMapper +{ + /** + * 查询设备列表 + * + * @param device 设备信息 + * @return 设备集合 + */ + public List selectDeviceList(WcsDevice device); + + /** + * 通过设备ID查询设备信息 + * + * @param deviceId 设备ID + * @return 设备对象 + */ + public WcsDevice selectDeviceById(Long deviceId); + + /** + * 新增设备 + * + * @param device 设备信息 + * @return 结果 + */ + public int insertDevice(WcsDevice device); + + /** + * 修改设备 + * + * @param device 设备信息 + * @return 结果 + */ + public int updateDevice(WcsDevice device); + + /** + * 删除设备 + * + * @param deviceId 设备ID + * @return 结果 + */ + public int deleteDeviceById(Long deviceId); + + /** + * 批量删除设备 + * + * @param deviceIds 设备ID数组 + * @return 结果 + */ + public int deleteDeviceByIds(Long[] deviceIds); + + /** + * 校验设备编码是否唯一 + * + * @param deviceCode 设备编码 + * @return 设备信息 + */ + public WcsDevice checkDeviceCodeUnique(String deviceCode); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/mapper/WcsDevicePointMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/mapper/WcsDevicePointMapper.java new file mode 100644 index 00000000..08f8cfc8 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/mapper/WcsDevicePointMapper.java @@ -0,0 +1,60 @@ +package com.ruoyi.wcs.device.mapper; + +import java.util.List; +import com.ruoyi.wcs.device.domain.WcsDevicePoint; + +/** + * 设备点位 数据层 + * + * @author wcs + */ +public interface WcsDevicePointMapper +{ + /** + * 查询点位列表 + * + * @param point 点位信息 + * @return 点位集合 + */ + public List selectPointList(WcsDevicePoint point); + + /** + * 通过点位ID查询点位信息 + * + * @param pointId 点位ID + * @return 点位对象 + */ + public WcsDevicePoint selectPointById(Long pointId); + + /** + * 新增点位 + * + * @param point 点位信息 + * @return 结果 + */ + public int insertPoint(WcsDevicePoint point); + + /** + * 修改点位 + * + * @param point 点位信息 + * @return 结果 + */ + public int updatePoint(WcsDevicePoint point); + + /** + * 删除点位 + * + * @param pointId 点位ID + * @return 结果 + */ + public int deletePointById(Long pointId); + + /** + * 批量删除点位 + * + * @param pointIds 点位ID数组 + * @return 结果 + */ + public int deletePointByIds(Long[] pointIds); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/package-info.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/package-info.java new file mode 100644 index 00000000..fd017c66 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/package-info.java @@ -0,0 +1,10 @@ +/** + * WCS 设备管理模块 + *

+ * 负责设备基本信息管理、设备点位配置、点位值读写等功能。 + * 包含 Controller / Service / Mapper / Domain 等分层结构。 + *

+ * + * @author WCS + */ +package com.ruoyi.wcs.device; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/service/IWcsDevicePointService.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/service/IWcsDevicePointService.java new file mode 100644 index 00000000..c9a1a522 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/service/IWcsDevicePointService.java @@ -0,0 +1,52 @@ +package com.ruoyi.wcs.device.service; + +import java.util.List; +import com.ruoyi.wcs.device.domain.WcsDevicePoint; + +/** + * 设备点位 服务层 + * + * @author wcs + */ +public interface IWcsDevicePointService +{ + /** + * 查询点位列表 + * + * @param point 点位信息 + * @return 点位集合 + */ + public List selectPointList(WcsDevicePoint point); + + /** + * 通过点位ID查询点位信息 + * + * @param pointId 点位ID + * @return 点位对象 + */ + public WcsDevicePoint selectPointById(Long pointId); + + /** + * 新增点位 + * + * @param point 点位信息 + * @return 结果 + */ + public int insertPoint(WcsDevicePoint point); + + /** + * 修改点位 + * + * @param point 点位信息 + * @return 结果 + */ + public int updatePoint(WcsDevicePoint point); + + /** + * 批量删除点位 + * + * @param pointIds 点位ID数组 + * @return 结果 + */ + public int deletePointByIds(Long[] pointIds); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/service/IWcsDeviceService.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/service/IWcsDeviceService.java new file mode 100644 index 00000000..70fb3d27 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/service/IWcsDeviceService.java @@ -0,0 +1,60 @@ +package com.ruoyi.wcs.device.service; + +import java.util.List; +import com.ruoyi.wcs.device.domain.WcsDevice; + +/** + * 设备信息 服务层 + * + * @author wcs + */ +public interface IWcsDeviceService +{ + /** + * 查询设备列表 + * + * @param device 设备信息 + * @return 设备集合 + */ + public List selectDeviceList(WcsDevice device); + + /** + * 通过设备ID查询设备信息 + * + * @param deviceId 设备ID + * @return 设备对象 + */ + public WcsDevice selectDeviceById(Long deviceId); + + /** + * 新增设备 + * + * @param device 设备信息 + * @return 结果 + */ + public int insertDevice(WcsDevice device); + + /** + * 修改设备 + * + * @param device 设备信息 + * @return 结果 + */ + public int updateDevice(WcsDevice device); + + /** + * 批量删除设备 + * + * @param deviceIds 设备ID数组 + * @return 结果 + */ + public int deleteDeviceByIds(Long[] deviceIds); + + /** + * 校验设备编码是否唯一 + * + * @param device 设备信息 + * @return 结果 + */ + public boolean checkDeviceCodeUnique(WcsDevice device); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/service/impl/WcsDevicePointServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/service/impl/WcsDevicePointServiceImpl.java new file mode 100644 index 00000000..1941f4bd --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/service/impl/WcsDevicePointServiceImpl.java @@ -0,0 +1,50 @@ +package com.ruoyi.wcs.device.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.wcs.device.domain.WcsDevicePoint; +import com.ruoyi.wcs.device.mapper.WcsDevicePointMapper; +import com.ruoyi.wcs.device.service.IWcsDevicePointService; + +/** + * 设备点位 服务层处理 + * + * @author wcs + */ +@Service +public class WcsDevicePointServiceImpl implements IWcsDevicePointService +{ + @Autowired + private WcsDevicePointMapper pointMapper; + + @Override + public List selectPointList(WcsDevicePoint point) + { + return pointMapper.selectPointList(point); + } + + @Override + public WcsDevicePoint selectPointById(Long pointId) + { + return pointMapper.selectPointById(pointId); + } + + @Override + public int insertPoint(WcsDevicePoint point) + { + return pointMapper.insertPoint(point); + } + + @Override + public int updatePoint(WcsDevicePoint point) + { + return pointMapper.updatePoint(point); + } + + @Override + public int deletePointByIds(Long[] pointIds) + { + return pointMapper.deletePointByIds(pointIds); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/service/impl/WcsDeviceServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/service/impl/WcsDeviceServiceImpl.java new file mode 100644 index 00000000..56005784 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/device/service/impl/WcsDeviceServiceImpl.java @@ -0,0 +1,64 @@ +package com.ruoyi.wcs.device.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.wcs.device.domain.WcsDevice; +import com.ruoyi.wcs.device.mapper.WcsDeviceMapper; +import com.ruoyi.wcs.device.service.IWcsDeviceService; + +/** + * 设备信息 服务层处理 + * + * @author wcs + */ +@Service +public class WcsDeviceServiceImpl implements IWcsDeviceService +{ + @Autowired + private WcsDeviceMapper deviceMapper; + + @Override + public List selectDeviceList(WcsDevice device) + { + return deviceMapper.selectDeviceList(device); + } + + @Override + public WcsDevice selectDeviceById(Long deviceId) + { + return deviceMapper.selectDeviceById(deviceId); + } + + @Override + public int insertDevice(WcsDevice device) + { + return deviceMapper.insertDevice(device); + } + + @Override + public int updateDevice(WcsDevice device) + { + return deviceMapper.updateDevice(device); + } + + @Override + public int deleteDeviceByIds(Long[] deviceIds) + { + return deviceMapper.deleteDeviceByIds(deviceIds); + } + + @Override + public boolean checkDeviceCodeUnique(WcsDevice device) + { + Long deviceId = StringUtils.isNull(device.getDeviceId()) ? -1L : device.getDeviceId(); + WcsDevice info = deviceMapper.checkDeviceCodeUnique(device.getDeviceCode()); + if (StringUtils.isNotNull(info) && info.getDeviceId().longValue() != deviceId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/controller/WcsFlowDefController.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/controller/WcsFlowDefController.java new file mode 100644 index 00000000..51ab4cbc --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/controller/WcsFlowDefController.java @@ -0,0 +1,114 @@ +package com.ruoyi.wcs.flow.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.wcs.flow.domain.WcsFlowDef; +import com.ruoyi.wcs.flow.service.IWcsFlowDefService; + +/** + * 流程定义 Controller + * + * @author wcs + */ +@RestController +@RequestMapping("/wcs/flow/def") +public class WcsFlowDefController extends BaseController +{ + @Autowired + private IWcsFlowDefService flowDefService; + + /** + * 查询流程定义列表 + */ + @PreAuthorize("@ss.hasPermi('wcs:flow:list')") + @GetMapping("/list") + public TableDataInfo list(WcsFlowDef flowDef) + { + startPage(); + List list = flowDefService.selectFlowDefList(flowDef); + return getDataTable(list); + } + + /** + * 导出流程定义列表 + */ + @Log(title = "流程定义", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('wcs:flow:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, WcsFlowDef flowDef) + { + List list = flowDefService.selectFlowDefList(flowDef); + ExcelUtil util = new ExcelUtil(WcsFlowDef.class); + util.exportExcel(response, list, "流程定义数据"); + } + + /** + * 根据流程ID获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('wcs:flow:query')") + @GetMapping(value = "/{flowId}") + public AjaxResult getInfo(@PathVariable Long flowId) + { + return success(flowDefService.selectFlowDefById(flowId)); + } + + /** + * 新增流程定义 + */ + @PreAuthorize("@ss.hasPermi('wcs:flow:add')") + @Log(title = "流程定义", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody WcsFlowDef flowDef) + { + if (!flowDefService.checkFlowCodeUnique(flowDef)) + { + return error("新增流程'" + flowDef.getFlowCode() + "'失败,流程编码已存在"); + } + flowDef.setCreateBy(getUsername()); + return toAjax(flowDefService.insertFlowDef(flowDef)); + } + + /** + * 修改流程定义 + */ + @PreAuthorize("@ss.hasPermi('wcs:flow:edit')") + @Log(title = "流程定义", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody WcsFlowDef flowDef) + { + if (!flowDefService.checkFlowCodeUnique(flowDef)) + { + return error("修改流程'" + flowDef.getFlowCode() + "'失败,流程编码已存在"); + } + flowDef.setUpdateBy(getUsername()); + return toAjax(flowDefService.updateFlowDef(flowDef)); + } + + /** + * 删除流程定义 + */ + @PreAuthorize("@ss.hasPermi('wcs:flow:remove')") + @Log(title = "流程定义", businessType = BusinessType.DELETE) + @DeleteMapping("/{flowIds}") + public AjaxResult remove(@PathVariable Long[] flowIds) + { + return toAjax(flowDefService.deleteFlowDefByIds(flowIds)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/controller/WcsFlowInstanceController.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/controller/WcsFlowInstanceController.java new file mode 100644 index 00000000..5ec3b23c --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/controller/WcsFlowInstanceController.java @@ -0,0 +1,20 @@ +package com.ruoyi.wcs.flow.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.core.domain.AjaxResult; + +/** + * WCS 流程实例 Controller(骨架占位) + */ +@RestController +@RequestMapping("/wcs/flow/instance") +public class WcsFlowInstanceController +{ + @GetMapping("/list") + public AjaxResult list() + { + return AjaxResult.success("WCS 流程实例模块 - 建设中"); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/controller/WcsFlowLineController.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/controller/WcsFlowLineController.java new file mode 100644 index 00000000..0ad003f7 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/controller/WcsFlowLineController.java @@ -0,0 +1,79 @@ +package com.ruoyi.wcs.flow.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.wcs.flow.domain.WcsFlowLine; +import com.ruoyi.wcs.flow.service.IWcsFlowLineService; + +/** + * 流程连线 Controller + * + * @author wcs + */ +@RestController +@RequestMapping("/wcs/flow/line") +public class WcsFlowLineController extends BaseController +{ + @Autowired + private IWcsFlowLineService flowLineService; + + /** + * 查询指定流程的连线列表 + */ + @PreAuthorize("@ss.hasPermi('wcs:flow:query')") + @GetMapping("/list/{flowId}") + public AjaxResult list(@PathVariable Long flowId) + { + List list = flowLineService.selectFlowLineListByFlowId(flowId); + return success(list); + } + + /** + * 导出指定流程的连线列表 + */ + @Log(title = "流程连线", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('wcs:flow:export')") + @PostMapping("/export/{flowId}") + public void export(HttpServletResponse response, @PathVariable Long flowId) + { + List list = flowLineService.selectFlowLineListByFlowId(flowId); + ExcelUtil util = new ExcelUtil(WcsFlowLine.class); + util.exportExcel(response, list, "流程连线数据"); + } + + /** + * 新增流程连线 + */ + @PreAuthorize("@ss.hasPermi('wcs:flow:edit')") + @Log(title = "流程连线", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WcsFlowLine flowLine) + { + return toAjax(flowLineService.insertFlowLine(flowLine)); + } + + /** + * 删除流程连线 + */ + @PreAuthorize("@ss.hasPermi('wcs:flow:edit')") + @Log(title = "流程连线", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineId}") + public AjaxResult remove(@PathVariable Long lineId) + { + return toAjax(flowLineService.deleteFlowLineById(lineId)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/controller/WcsFlowLogController.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/controller/WcsFlowLogController.java new file mode 100644 index 00000000..9ffcd2c8 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/controller/WcsFlowLogController.java @@ -0,0 +1,74 @@ +package com.ruoyi.wcs.flow.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.wcs.flow.domain.WcsFlowNodeLog; +import com.ruoyi.wcs.flow.service.IWcsFlowNodeLogService; + +/** + * 娴佺▼鑺傜偣鎵ц鏃ュ織 Controller + * + * @author wcs + */ +@RestController +@RequestMapping("/wcs/flow/log") +public class WcsFlowLogController extends BaseController +{ + @Autowired + private IWcsFlowNodeLogService wcsFlowNodeLogService; + + /** + * 鏌ヨ娴佺▼鑺傜偣鏃ュ織鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('wcs:flowlog:list')") + @GetMapping("/list") + public TableDataInfo list(WcsFlowNodeLog wcsFlowNodeLog) + { + startPage(); + List list = wcsFlowNodeLogService.selectFlowNodeLogList(wcsFlowNodeLog); + return getDataTable(list); + } + + /** + * 瀵煎嚭娴佺▼鑺傜偣鏃ュ織鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('wcs:flowlog:export')") + @Log(title = "娴佺▼鑺傜偣鏃ュ織", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WcsFlowNodeLog wcsFlowNodeLog) + { + List list = wcsFlowNodeLogService.selectFlowNodeLogList(wcsFlowNodeLog); + ExcelUtil util = new ExcelUtil(WcsFlowNodeLog.class); + util.exportExcel(response, list, "娴佺▼鑺傜偣鏃ュ織鏁版嵁"); + } + + /** + * 鑾峰彇娴佺▼鑺傜偣鏃ュ織璇︾粏淇℃伅 + */ + @PreAuthorize("@ss.hasPermi('wcs:flowlog:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(wcsFlowNodeLogService.selectFlowNodeLogById(id)); + } + + /** + * 鍒犻櫎娴佺▼鑺傜偣鏃ュ織 + */ + @PreAuthorize("@ss.hasPermi('wcs:flowlog:remove')") + @Log(title = "娴佺▼鑺傜偣鏃ュ織", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(wcsFlowNodeLogService.deleteFlowNodeLogByIds(ids)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/controller/WcsFlowNodeController.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/controller/WcsFlowNodeController.java new file mode 100644 index 00000000..cb54c743 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/controller/WcsFlowNodeController.java @@ -0,0 +1,101 @@ +package com.ruoyi.wcs.flow.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.wcs.flow.domain.WcsFlowNode; +import com.ruoyi.wcs.flow.service.IWcsFlowNodeService; + +/** + * 流程节点 Controller + * + * @author wcs + */ +@RestController +@RequestMapping("/wcs/flow/node") +public class WcsFlowNodeController extends BaseController +{ + @Autowired + private IWcsFlowNodeService flowNodeService; + + /** + * 查询指定流程的节点列表 + */ + @PreAuthorize("@ss.hasPermi('wcs:flow:query')") + @GetMapping("/list/{flowId}") + public AjaxResult list(@PathVariable Long flowId) + { + List list = flowNodeService.selectFlowNodeListByFlowId(flowId); + return success(list); + } + + /** + * 导出指定流程的节点列表 + */ + @Log(title = "流程节点", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('wcs:flow:export')") + @PostMapping("/export/{flowId}") + public void export(HttpServletResponse response, @PathVariable Long flowId) + { + List list = flowNodeService.selectFlowNodeListByFlowId(flowId); + ExcelUtil util = new ExcelUtil(WcsFlowNode.class); + util.exportExcel(response, list, "流程节点数据"); + } + + /** + * 根据节点ID获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('wcs:flow:query')") + @GetMapping(value = "/{nodeId}") + public AjaxResult getInfo(@PathVariable Long nodeId) + { + return success(flowNodeService.selectFlowNodeById(nodeId)); + } + + /** + * 新增流程节点 + */ + @PreAuthorize("@ss.hasPermi('wcs:flow:edit')") + @Log(title = "流程节点", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WcsFlowNode flowNode) + { + return toAjax(flowNodeService.insertFlowNode(flowNode)); + } + + /** + * 修改流程节点 + */ + @PreAuthorize("@ss.hasPermi('wcs:flow:edit')") + @Log(title = "流程节点", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WcsFlowNode flowNode) + { + return toAjax(flowNodeService.updateFlowNode(flowNode)); + } + + /** + * 删除流程节点 + */ + @PreAuthorize("@ss.hasPermi('wcs:flow:edit')") + @Log(title = "流程节点", businessType = BusinessType.DELETE) + @DeleteMapping("/{nodeId}") + public AjaxResult remove(@PathVariable Long nodeId) + { + return toAjax(flowNodeService.deleteFlowNodeById(nodeId)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/domain/WcsFlowDef.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/domain/WcsFlowDef.java new file mode 100644 index 00000000..e1f38593 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/domain/WcsFlowDef.java @@ -0,0 +1,142 @@ +package com.ruoyi.wcs.flow.domain; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excel.ColumnType; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 流程定义表 wcs_flow_def + * + * @author wcs + */ +public class WcsFlowDef extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + @Excel(name = "流程ID", cellType = ColumnType.NUMERIC) + private Long flowId; + + @Excel(name = "流程编码") + private String flowCode; + + @Excel(name = "流程名称") + private String flowName; + + @Excel(name = "流程类型") + private String flowType; + + @Excel(name = "版本号", cellType = ColumnType.NUMERIC) + private Integer version; + + private String flowJson; + + @Excel(name = "状态", readConverterExp = "0=草稿,1=已发布,2=已停用") + private String status; + + private String delFlag; + + public Long getFlowId() + { + return flowId; + } + + public void setFlowId(Long flowId) + { + this.flowId = flowId; + } + + @NotBlank(message = "流程编码不能为空") + @Size(min = 0, max = 64, message = "流程编码长度不能超过64个字符") + public String getFlowCode() + { + return flowCode; + } + + public void setFlowCode(String flowCode) + { + this.flowCode = flowCode; + } + + @Size(min = 0, max = 128, message = "流程名称长度不能超过128个字符") + public String getFlowName() + { + return flowName; + } + + public void setFlowName(String flowName) + { + this.flowName = flowName; + } + + public String getFlowType() + { + return flowType; + } + + public void setFlowType(String flowType) + { + this.flowType = flowType; + } + + public Integer getVersion() + { + return version; + } + + public void setVersion(Integer version) + { + this.version = version; + } + + public String getFlowJson() + { + return flowJson; + } + + public void setFlowJson(String flowJson) + { + this.flowJson = flowJson; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getDelFlag() + { + return delFlag; + } + + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + @Override + public String toString() + { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("flowId", getFlowId()) + .append("flowCode", getFlowCode()) + .append("flowName", getFlowName()) + .append("flowType", getFlowType()) + .append("version", getVersion()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/domain/WcsFlowInstance.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/domain/WcsFlowInstance.java new file mode 100644 index 00000000..275f267d --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/domain/WcsFlowInstance.java @@ -0,0 +1,103 @@ +package com.ruoyi.wcs.flow.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excel.ColumnType; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 流程实例表 wcs_flow_instance + * + * @author wcs + */ +public class WcsFlowInstance extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + @Excel(name = "实例ID", cellType = ColumnType.NUMERIC) + private Long id; + + @Excel(name = "流程定义ID", cellType = ColumnType.NUMERIC) + private Long flowDefId; + + @Excel(name = "状态", readConverterExp = "0=待执行,1=执行中,2=已完成,3=异常终止") + private String status; + + @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date startTime; + + @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date endTime; + + public Long getId() + { + return id; + } + + public void setId(Long id) + { + this.id = id; + } + + public Long getFlowDefId() + { + return flowDefId; + } + + public void setFlowDefId(Long flowDefId) + { + this.flowDefId = flowDefId; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + public Date getStartTime() + { + return startTime; + } + + public void setStartTime(Date startTime) + { + this.startTime = startTime; + } + + public Date getEndTime() + { + return endTime; + } + + public void setEndTime(Date endTime) + { + this.endTime = endTime; + } + + @Override + public String toString() + { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("flowDefId", getFlowDefId()) + .append("status", getStatus()) + .append("startTime", getStartTime()) + .append("endTime", getEndTime()) + .append("remark", getRemark()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/domain/WcsFlowLine.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/domain/WcsFlowLine.java new file mode 100644 index 00000000..52e1bbb9 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/domain/WcsFlowLine.java @@ -0,0 +1,132 @@ +package com.ruoyi.wcs.flow.domain; + +import java.util.Date; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excel.ColumnType; + +/** + * 流程连线表 wcs_flow_line + * + * @author wcs + */ +public class WcsFlowLine +{ + private static final long serialVersionUID = 1L; + + @Excel(name = "连线ID", cellType = ColumnType.NUMERIC) + private Long lineId; + + @Excel(name = "所属流程ID", cellType = ColumnType.NUMERIC) + private Long flowId; + + @Excel(name = "源节点ID", cellType = ColumnType.NUMERIC) + private Long sourceNodeId; + + @Excel(name = "目标节点ID", cellType = ColumnType.NUMERIC) + private Long targetNodeId; + + private String conditionExpr; + + private String lineLabel; + + private Integer sortOrder; + + private Date createTime; + + public Long getLineId() + { + return lineId; + } + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getFlowId() + { + return flowId; + } + + public void setFlowId(Long flowId) + { + this.flowId = flowId; + } + + public Long getSourceNodeId() + { + return sourceNodeId; + } + + public void setSourceNodeId(Long sourceNodeId) + { + this.sourceNodeId = sourceNodeId; + } + + public Long getTargetNodeId() + { + return targetNodeId; + } + + public void setTargetNodeId(Long targetNodeId) + { + this.targetNodeId = targetNodeId; + } + + public String getConditionExpr() + { + return conditionExpr; + } + + public void setConditionExpr(String conditionExpr) + { + this.conditionExpr = conditionExpr; + } + + public String getLineLabel() + { + return lineLabel; + } + + public void setLineLabel(String lineLabel) + { + this.lineLabel = lineLabel; + } + + public Integer getSortOrder() + { + return sortOrder; + } + + public void setSortOrder(Integer sortOrder) + { + this.sortOrder = sortOrder; + } + + public Date getCreateTime() + { + return createTime; + } + + public void setCreateTime(Date createTime) + { + this.createTime = createTime; + } + + @Override + public String toString() + { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("lineId", getLineId()) + .append("flowId", getFlowId()) + .append("sourceNodeId", getSourceNodeId()) + .append("targetNodeId", getTargetNodeId()) + .append("conditionExpr", getConditionExpr()) + .append("lineLabel", getLineLabel()) + .append("sortOrder", getSortOrder()) + .append("createTime", getCreateTime()) + .toString(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/domain/WcsFlowNode.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/domain/WcsFlowNode.java new file mode 100644 index 00000000..f82c4324 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/domain/WcsFlowNode.java @@ -0,0 +1,184 @@ +package com.ruoyi.wcs.flow.domain; + +import java.util.Date; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excel.ColumnType; + +/** + * 流程节点表 wcs_flow_node + * + * @author wcs + */ +public class WcsFlowNode +{ + private static final long serialVersionUID = 1L; + + @Excel(name = "节点ID", cellType = ColumnType.NUMERIC) + private Long nodeId; + + @Excel(name = "所属流程ID", cellType = ColumnType.NUMERIC) + private Long flowId; + + @Excel(name = "节点编码") + private String nodeCode; + + @Excel(name = "节点名称") + private String nodeName; + + @Excel(name = "节点类型") + private String nodeType; + + private String handlerClass; + + private String configJson; + + private Integer posX; + + private Integer posY; + + private Integer sortOrder; + + private Date createTime; + + private Date updateTime; + + public Long getNodeId() + { + return nodeId; + } + + public void setNodeId(Long nodeId) + { + this.nodeId = nodeId; + } + + public Long getFlowId() + { + return flowId; + } + + public void setFlowId(Long flowId) + { + this.flowId = flowId; + } + + public String getNodeCode() + { + return nodeCode; + } + + public void setNodeCode(String nodeCode) + { + this.nodeCode = nodeCode; + } + + public String getNodeName() + { + return nodeName; + } + + public void setNodeName(String nodeName) + { + this.nodeName = nodeName; + } + + public String getNodeType() + { + return nodeType; + } + + public void setNodeType(String nodeType) + { + this.nodeType = nodeType; + } + + public String getHandlerClass() + { + return handlerClass; + } + + public void setHandlerClass(String handlerClass) + { + this.handlerClass = handlerClass; + } + + public String getConfigJson() + { + return configJson; + } + + public void setConfigJson(String configJson) + { + this.configJson = configJson; + } + + public Integer getPosX() + { + return posX; + } + + public void setPosX(Integer posX) + { + this.posX = posX; + } + + public Integer getPosY() + { + return posY; + } + + public void setPosY(Integer posY) + { + this.posY = posY; + } + + public Integer getSortOrder() + { + return sortOrder; + } + + public void setSortOrder(Integer sortOrder) + { + this.sortOrder = sortOrder; + } + + public Date getCreateTime() + { + return createTime; + } + + public void setCreateTime(Date createTime) + { + this.createTime = createTime; + } + + public Date getUpdateTime() + { + return updateTime; + } + + public void setUpdateTime(Date updateTime) + { + this.updateTime = updateTime; + } + + @Override + public String toString() + { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("nodeId", getNodeId()) + .append("flowId", getFlowId()) + .append("nodeCode", getNodeCode()) + .append("nodeName", getNodeName()) + .append("nodeType", getNodeType()) + .append("handlerClass", getHandlerClass()) + .append("posX", getPosX()) + .append("posY", getPosY()) + .append("sortOrder", getSortOrder()) + .append("createTime", getCreateTime()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/domain/WcsFlowNodeLog.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/domain/WcsFlowNodeLog.java new file mode 100644 index 00000000..2bcb62a1 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/domain/WcsFlowNodeLog.java @@ -0,0 +1,168 @@ +package com.ruoyi.wcs.flow.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excel.ColumnType; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 流程节点执行日志表 wcs_flow_node_log + * + * @author wcs + */ +public class WcsFlowNodeLog extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + @Excel(name = "日志ID", cellType = ColumnType.NUMERIC) + private Long id; + + @Excel(name = "实例ID", cellType = ColumnType.NUMERIC) + private Long instanceId; + + @Excel(name = "节点ID") + private String nodeId; + + @Excel(name = "节点类型") + private String nodeType; + + @Excel(name = "状态", readConverterExp = "0=待执行,1=执行中,2=成功,3=失败,4=跳过") + private String status; + + private String input; + + private String output; + + @Excel(name = "错误信息") + private String errorMsg; + + @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date startTime; + + @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date endTime; + + public Long getId() + { + return id; + } + + public void setId(Long id) + { + this.id = id; + } + + public Long getInstanceId() + { + return instanceId; + } + + public void setInstanceId(Long instanceId) + { + this.instanceId = instanceId; + } + + public String getNodeId() + { + return nodeId; + } + + public void setNodeId(String nodeId) + { + this.nodeId = nodeId; + } + + public String getNodeType() + { + return nodeType; + } + + public void setNodeType(String nodeType) + { + this.nodeType = nodeType; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getInput() + { + return input; + } + + public void setInput(String input) + { + this.input = input; + } + + public String getOutput() + { + return output; + } + + public void setOutput(String output) + { + this.output = output; + } + + public String getErrorMsg() + { + return errorMsg; + } + + public void setErrorMsg(String errorMsg) + { + this.errorMsg = errorMsg; + } + + public Date getStartTime() + { + return startTime; + } + + public void setStartTime(Date startTime) + { + this.startTime = startTime; + } + + public Date getEndTime() + { + return endTime; + } + + public void setEndTime(Date endTime) + { + this.endTime = endTime; + } + + @Override + public String toString() + { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("instanceId", getInstanceId()) + .append("nodeId", getNodeId()) + .append("nodeType", getNodeType()) + .append("status", getStatus()) + .append("input", getInput()) + .append("output", getOutput()) + .append("errorMsg", getErrorMsg()) + .append("startTime", getStartTime()) + .append("endTime", getEndTime()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .toString(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/mapper/WcsFlowDefMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/mapper/WcsFlowDefMapper.java new file mode 100644 index 00000000..f26c968a --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/mapper/WcsFlowDefMapper.java @@ -0,0 +1,26 @@ +package com.ruoyi.wcs.flow.mapper; + +import java.util.List; +import com.ruoyi.wcs.flow.domain.WcsFlowDef; + +/** + * 流程定义 数据层 + * + * @author wcs + */ +public interface WcsFlowDefMapper +{ + public List selectFlowDefList(WcsFlowDef flowDef); + + public WcsFlowDef selectFlowDefById(Long flowId); + + public int insertFlowDef(WcsFlowDef flowDef); + + public int updateFlowDef(WcsFlowDef flowDef); + + public int deleteFlowDefById(Long flowId); + + public int deleteFlowDefByIds(Long[] flowIds); + + public WcsFlowDef checkFlowCodeUnique(String flowCode); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/mapper/WcsFlowInstanceMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/mapper/WcsFlowInstanceMapper.java new file mode 100644 index 00000000..b6719b63 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/mapper/WcsFlowInstanceMapper.java @@ -0,0 +1,24 @@ +package com.ruoyi.wcs.flow.mapper; + +import java.util.List; +import com.ruoyi.wcs.flow.domain.WcsFlowInstance; + +/** + * 流程实例 数据层 + * + * @author wcs + */ +public interface WcsFlowInstanceMapper +{ + public List selectFlowInstanceList(WcsFlowInstance flowInstance); + + public WcsFlowInstance selectFlowInstanceById(Long id); + + public int insertFlowInstance(WcsFlowInstance flowInstance); + + public int updateFlowInstance(WcsFlowInstance flowInstance); + + public int deleteFlowInstanceById(Long id); + + public int deleteFlowInstanceByIds(Long[] ids); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/mapper/WcsFlowLineMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/mapper/WcsFlowLineMapper.java new file mode 100644 index 00000000..45518ec0 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/mapper/WcsFlowLineMapper.java @@ -0,0 +1,22 @@ +package com.ruoyi.wcs.flow.mapper; + +import java.util.List; +import com.ruoyi.wcs.flow.domain.WcsFlowLine; + +/** + * 流程连线 数据层 + * + * @author wcs + */ +public interface WcsFlowLineMapper +{ + public List selectFlowLineListByFlowId(Long flowId); + + public WcsFlowLine selectFlowLineById(Long lineId); + + public int insertFlowLine(WcsFlowLine flowLine); + + public int deleteFlowLineById(Long lineId); + + public int deleteFlowLineByFlowId(Long flowId); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/mapper/WcsFlowNodeLogMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/mapper/WcsFlowNodeLogMapper.java new file mode 100644 index 00000000..29d561ec --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/mapper/WcsFlowNodeLogMapper.java @@ -0,0 +1,28 @@ +package com.ruoyi.wcs.flow.mapper; + +import java.util.List; +import com.ruoyi.wcs.flow.domain.WcsFlowNodeLog; + +/** + * 流程节点执行日志 数据层 + * + * @author wcs + */ +public interface WcsFlowNodeLogMapper +{ + public List selectFlowNodeLogList(WcsFlowNodeLog flowNodeLog); + + public WcsFlowNodeLog selectFlowNodeLogById(Long id); + + public List selectFlowNodeLogByInstanceId(Long instanceId); + + public int insertFlowNodeLog(WcsFlowNodeLog flowNodeLog); + + public int updateFlowNodeLog(WcsFlowNodeLog flowNodeLog); + + public int deleteFlowNodeLogById(Long id); + + public int deleteFlowNodeLogByIds(Long[] ids); + + public int deleteFlowNodeLogByInstanceId(Long instanceId); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/mapper/WcsFlowNodeMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/mapper/WcsFlowNodeMapper.java new file mode 100644 index 00000000..b2d4a977 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/mapper/WcsFlowNodeMapper.java @@ -0,0 +1,24 @@ +package com.ruoyi.wcs.flow.mapper; + +import java.util.List; +import com.ruoyi.wcs.flow.domain.WcsFlowNode; + +/** + * 流程节点 数据层 + * + * @author wcs + */ +public interface WcsFlowNodeMapper +{ + public List selectFlowNodeListByFlowId(Long flowId); + + public WcsFlowNode selectFlowNodeById(Long nodeId); + + public int insertFlowNode(WcsFlowNode flowNode); + + public int updateFlowNode(WcsFlowNode flowNode); + + public int deleteFlowNodeById(Long nodeId); + + public int deleteFlowNodeByFlowId(Long flowId); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/package-info.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/package-info.java new file mode 100644 index 00000000..41318b3e --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/package-info.java @@ -0,0 +1,11 @@ +/** + * WCS 流程定义与执行模块 + *

+ * 提供可视化流程编排能力,包含流程定义、节点定义、连线定义、 + * 流程实例运行、节点执行日志等功能。 + * 不依赖第三方流程引擎,采用轻量级自研方案。 + *

+ * + * @author WCS + */ +package com.ruoyi.wcs.flow; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/IWcsFlowDefService.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/IWcsFlowDefService.java new file mode 100644 index 00000000..dad365ca --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/IWcsFlowDefService.java @@ -0,0 +1,24 @@ +package com.ruoyi.wcs.flow.service; + +import java.util.List; +import com.ruoyi.wcs.flow.domain.WcsFlowDef; + +/** + * 流程定义 服务层 + * + * @author wcs + */ +public interface IWcsFlowDefService +{ + public List selectFlowDefList(WcsFlowDef flowDef); + + public WcsFlowDef selectFlowDefById(Long flowId); + + public int insertFlowDef(WcsFlowDef flowDef); + + public int updateFlowDef(WcsFlowDef flowDef); + + public int deleteFlowDefByIds(Long[] flowIds); + + public boolean checkFlowCodeUnique(WcsFlowDef flowDef); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/IWcsFlowInstanceService.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/IWcsFlowInstanceService.java new file mode 100644 index 00000000..a9042803 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/IWcsFlowInstanceService.java @@ -0,0 +1,22 @@ +package com.ruoyi.wcs.flow.service; + +import java.util.List; +import com.ruoyi.wcs.flow.domain.WcsFlowInstance; + +/** + * 流程实例 服务层 + * + * @author wcs + */ +public interface IWcsFlowInstanceService +{ + public List selectFlowInstanceList(WcsFlowInstance flowInstance); + + public WcsFlowInstance selectFlowInstanceById(Long id); + + public int insertFlowInstance(WcsFlowInstance flowInstance); + + public int updateFlowInstance(WcsFlowInstance flowInstance); + + public int deleteFlowInstanceByIds(Long[] ids); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/IWcsFlowLineService.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/IWcsFlowLineService.java new file mode 100644 index 00000000..64b1a5b2 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/IWcsFlowLineService.java @@ -0,0 +1,20 @@ +package com.ruoyi.wcs.flow.service; + +import java.util.List; +import com.ruoyi.wcs.flow.domain.WcsFlowLine; + +/** + * 流程连线 服务层 + * + * @author wcs + */ +public interface IWcsFlowLineService +{ + public List selectFlowLineListByFlowId(Long flowId); + + public int insertFlowLine(WcsFlowLine flowLine); + + public int deleteFlowLineById(Long lineId); + + public int deleteFlowLineByFlowId(Long flowId); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/IWcsFlowNodeLogService.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/IWcsFlowNodeLogService.java new file mode 100644 index 00000000..f14651f6 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/IWcsFlowNodeLogService.java @@ -0,0 +1,26 @@ +package com.ruoyi.wcs.flow.service; + +import java.util.List; +import com.ruoyi.wcs.flow.domain.WcsFlowNodeLog; + +/** + * 流程节点执行日志 服务层 + * + * @author wcs + */ +public interface IWcsFlowNodeLogService +{ + public List selectFlowNodeLogList(WcsFlowNodeLog flowNodeLog); + + public WcsFlowNodeLog selectFlowNodeLogById(Long id); + + public List selectFlowNodeLogByInstanceId(Long instanceId); + + public int insertFlowNodeLog(WcsFlowNodeLog flowNodeLog); + + public int updateFlowNodeLog(WcsFlowNodeLog flowNodeLog); + + public int deleteFlowNodeLogByIds(Long[] ids); + + public int deleteFlowNodeLogByInstanceId(Long instanceId); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/IWcsFlowNodeService.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/IWcsFlowNodeService.java new file mode 100644 index 00000000..690e326b --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/IWcsFlowNodeService.java @@ -0,0 +1,24 @@ +package com.ruoyi.wcs.flow.service; + +import java.util.List; +import com.ruoyi.wcs.flow.domain.WcsFlowNode; + +/** + * 流程节点 服务层 + * + * @author wcs + */ +public interface IWcsFlowNodeService +{ + public List selectFlowNodeListByFlowId(Long flowId); + + public WcsFlowNode selectFlowNodeById(Long nodeId); + + public int insertFlowNode(WcsFlowNode flowNode); + + public int updateFlowNode(WcsFlowNode flowNode); + + public int deleteFlowNodeById(Long nodeId); + + public int deleteFlowNodeByFlowId(Long flowId); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/impl/WcsFlowDefServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/impl/WcsFlowDefServiceImpl.java new file mode 100644 index 00000000..4bb7f1cb --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/impl/WcsFlowDefServiceImpl.java @@ -0,0 +1,64 @@ +package com.ruoyi.wcs.flow.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.wcs.flow.domain.WcsFlowDef; +import com.ruoyi.wcs.flow.mapper.WcsFlowDefMapper; +import com.ruoyi.wcs.flow.service.IWcsFlowDefService; + +/** + * 流程定义 服务层处理 + * + * @author wcs + */ +@Service +public class WcsFlowDefServiceImpl implements IWcsFlowDefService +{ + @Autowired + private WcsFlowDefMapper flowDefMapper; + + @Override + public List selectFlowDefList(WcsFlowDef flowDef) + { + return flowDefMapper.selectFlowDefList(flowDef); + } + + @Override + public WcsFlowDef selectFlowDefById(Long flowId) + { + return flowDefMapper.selectFlowDefById(flowId); + } + + @Override + public int insertFlowDef(WcsFlowDef flowDef) + { + return flowDefMapper.insertFlowDef(flowDef); + } + + @Override + public int updateFlowDef(WcsFlowDef flowDef) + { + return flowDefMapper.updateFlowDef(flowDef); + } + + @Override + public int deleteFlowDefByIds(Long[] flowIds) + { + return flowDefMapper.deleteFlowDefByIds(flowIds); + } + + @Override + public boolean checkFlowCodeUnique(WcsFlowDef flowDef) + { + Long flowId = StringUtils.isNull(flowDef.getFlowId()) ? -1L : flowDef.getFlowId(); + WcsFlowDef info = flowDefMapper.checkFlowCodeUnique(flowDef.getFlowCode()); + if (StringUtils.isNotNull(info) && info.getFlowId().longValue() != flowId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/impl/WcsFlowInstanceServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/impl/WcsFlowInstanceServiceImpl.java new file mode 100644 index 00000000..545e00ee --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/impl/WcsFlowInstanceServiceImpl.java @@ -0,0 +1,50 @@ +package com.ruoyi.wcs.flow.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.wcs.flow.domain.WcsFlowInstance; +import com.ruoyi.wcs.flow.mapper.WcsFlowInstanceMapper; +import com.ruoyi.wcs.flow.service.IWcsFlowInstanceService; + +/** + * 流程实例 服务层处理 + * + * @author wcs + */ +@Service +public class WcsFlowInstanceServiceImpl implements IWcsFlowInstanceService +{ + @Autowired + private WcsFlowInstanceMapper flowInstanceMapper; + + @Override + public List selectFlowInstanceList(WcsFlowInstance flowInstance) + { + return flowInstanceMapper.selectFlowInstanceList(flowInstance); + } + + @Override + public WcsFlowInstance selectFlowInstanceById(Long id) + { + return flowInstanceMapper.selectFlowInstanceById(id); + } + + @Override + public int insertFlowInstance(WcsFlowInstance flowInstance) + { + return flowInstanceMapper.insertFlowInstance(flowInstance); + } + + @Override + public int updateFlowInstance(WcsFlowInstance flowInstance) + { + return flowInstanceMapper.updateFlowInstance(flowInstance); + } + + @Override + public int deleteFlowInstanceByIds(Long[] ids) + { + return flowInstanceMapper.deleteFlowInstanceByIds(ids); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/impl/WcsFlowLineServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/impl/WcsFlowLineServiceImpl.java new file mode 100644 index 00000000..a1dccc17 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/impl/WcsFlowLineServiceImpl.java @@ -0,0 +1,44 @@ +package com.ruoyi.wcs.flow.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.wcs.flow.domain.WcsFlowLine; +import com.ruoyi.wcs.flow.mapper.WcsFlowLineMapper; +import com.ruoyi.wcs.flow.service.IWcsFlowLineService; + +/** + * 流程连线 服务层处理 + * + * @author wcs + */ +@Service +public class WcsFlowLineServiceImpl implements IWcsFlowLineService +{ + @Autowired + private WcsFlowLineMapper flowLineMapper; + + @Override + public List selectFlowLineListByFlowId(Long flowId) + { + return flowLineMapper.selectFlowLineListByFlowId(flowId); + } + + @Override + public int insertFlowLine(WcsFlowLine flowLine) + { + return flowLineMapper.insertFlowLine(flowLine); + } + + @Override + public int deleteFlowLineById(Long lineId) + { + return flowLineMapper.deleteFlowLineById(lineId); + } + + @Override + public int deleteFlowLineByFlowId(Long flowId) + { + return flowLineMapper.deleteFlowLineByFlowId(flowId); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/impl/WcsFlowNodeLogServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/impl/WcsFlowNodeLogServiceImpl.java new file mode 100644 index 00000000..d514182e --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/impl/WcsFlowNodeLogServiceImpl.java @@ -0,0 +1,62 @@ +package com.ruoyi.wcs.flow.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.wcs.flow.domain.WcsFlowNodeLog; +import com.ruoyi.wcs.flow.mapper.WcsFlowNodeLogMapper; +import com.ruoyi.wcs.flow.service.IWcsFlowNodeLogService; + +/** + * 流程节点执行日志 服务层处理 + * + * @author wcs + */ +@Service +public class WcsFlowNodeLogServiceImpl implements IWcsFlowNodeLogService +{ + @Autowired + private WcsFlowNodeLogMapper flowNodeLogMapper; + + @Override + public List selectFlowNodeLogList(WcsFlowNodeLog flowNodeLog) + { + return flowNodeLogMapper.selectFlowNodeLogList(flowNodeLog); + } + + @Override + public WcsFlowNodeLog selectFlowNodeLogById(Long id) + { + return flowNodeLogMapper.selectFlowNodeLogById(id); + } + + @Override + public List selectFlowNodeLogByInstanceId(Long instanceId) + { + return flowNodeLogMapper.selectFlowNodeLogByInstanceId(instanceId); + } + + @Override + public int insertFlowNodeLog(WcsFlowNodeLog flowNodeLog) + { + return flowNodeLogMapper.insertFlowNodeLog(flowNodeLog); + } + + @Override + public int updateFlowNodeLog(WcsFlowNodeLog flowNodeLog) + { + return flowNodeLogMapper.updateFlowNodeLog(flowNodeLog); + } + + @Override + public int deleteFlowNodeLogByIds(Long[] ids) + { + return flowNodeLogMapper.deleteFlowNodeLogByIds(ids); + } + + @Override + public int deleteFlowNodeLogByInstanceId(Long instanceId) + { + return flowNodeLogMapper.deleteFlowNodeLogByInstanceId(instanceId); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/impl/WcsFlowNodeServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/impl/WcsFlowNodeServiceImpl.java new file mode 100644 index 00000000..29f564dc --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/flow/service/impl/WcsFlowNodeServiceImpl.java @@ -0,0 +1,56 @@ +package com.ruoyi.wcs.flow.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.wcs.flow.domain.WcsFlowNode; +import com.ruoyi.wcs.flow.mapper.WcsFlowNodeMapper; +import com.ruoyi.wcs.flow.service.IWcsFlowNodeService; + +/** + * 流程节点 服务层处理 + * + * @author wcs + */ +@Service +public class WcsFlowNodeServiceImpl implements IWcsFlowNodeService +{ + @Autowired + private WcsFlowNodeMapper flowNodeMapper; + + @Override + public List selectFlowNodeListByFlowId(Long flowId) + { + return flowNodeMapper.selectFlowNodeListByFlowId(flowId); + } + + @Override + public WcsFlowNode selectFlowNodeById(Long nodeId) + { + return flowNodeMapper.selectFlowNodeById(nodeId); + } + + @Override + public int insertFlowNode(WcsFlowNode flowNode) + { + return flowNodeMapper.insertFlowNode(flowNode); + } + + @Override + public int updateFlowNode(WcsFlowNode flowNode) + { + return flowNodeMapper.updateFlowNode(flowNode); + } + + @Override + public int deleteFlowNodeById(Long nodeId) + { + return flowNodeMapper.deleteFlowNodeById(nodeId); + } + + @Override + public int deleteFlowNodeByFlowId(Long flowId) + { + return flowNodeMapper.deleteFlowNodeByFlowId(flowId); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/job/package-info.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/job/package-info.java new file mode 100644 index 00000000..547a6794 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/job/package-info.java @@ -0,0 +1,10 @@ +/** + * WCS 任务调度模块 + *

+ * 管理 WCS 运行时任务,如搬运任务下发、任务状态跟踪、异常处理等。 + * 与若依 Quartz 模块配合使用。 + *

+ * + * @author WCS + */ +package com.ruoyi.wcs.job; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/package-info.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/package-info.java new file mode 100644 index 00000000..8565d098 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/package-info.java @@ -0,0 +1,20 @@ +/** + * WCS (Warehouse Control System) 仓库控制系统模块 + *

+ * 基于若依 RuoYi-Vue 3.9.1 (SpringBoot 2.5) 构建的 WCS 业务模块。 + *

+ * 模块结构: + *

    + *
  • device - 设备管理(设备信息、点位配置、点位值)
  • + *
  • api - 接口配置(WMS/ERP 等外部系统对接)
  • + *
  • flow - 流程引擎(流程定义、节点、连线、实例、日志)
  • + *
  • job - 任务调度(搬运任务、任务状态跟踪)
  • + *
  • plc - PLC 通信(Modbus TCP / OPC UA / S7 协议封装)
  • + *
  • schedule - 调度引擎(路径规划、任务分配、冲突检测)
  • + *
+ *

+ * 数据库初始化脚本: sql/wcs_init_mysql.sql + * + * @author WCS + */ +package com.ruoyi.wcs; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/plc/package-info.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/plc/package-info.java new file mode 100644 index 00000000..24c47ebe --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/plc/package-info.java @@ -0,0 +1,10 @@ +/** + * WCS PLC 通信模块 + *

+ * 封装与 PLC 设备的通信协议(如 Modbus TCP / OPC UA / S7 等), + * 提供统一的读写接口和连接管理。 + *

+ * + * @author WCS + */ +package com.ruoyi.wcs.plc; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/wcs/schedule/package-info.java b/ruoyi-admin/src/main/java/com/ruoyi/wcs/schedule/package-info.java new file mode 100644 index 00000000..7c3ea6b0 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/wcs/schedule/package-info.java @@ -0,0 +1,10 @@ +/** + * WCS 调度引擎模块 + *

+ * 核心调度逻辑,负责设备路径规划、任务分配、冲突检测等。 + * 与 flow / device / plc 模块协同工作。 + *

+ * + * @author WCS + */ +package com.ruoyi.wcs.schedule; diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index bcfad3ea..3243003b 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -4,7 +4,9 @@ spring: type: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.cj.jdbc.Driver druid: - # 涓诲簱鏁版嵁婧� + # 涓诲簱鏁版嵁婧愶紙MySQL锛� + # WCS 椤圭洰浣跨敤 MySQL锛岃鏍规嵁瀹為檯鐜淇敼杩炴帴鍙傛暟 + # 寤鸿鏁版嵁搴撳悕: ry-wcs 鎴� ry-vue锛岄渶鍏堟墽琛� sql/ry_20250522.sql 鍜� sql/wcs_init_mysql.sql master: url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index ff21fe0d..a9845b25 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -133,4 +133,4 @@ xss: # 鎺掗櫎閾炬帴锛堝涓敤閫楀彿鍒嗛殧锛� excludes: /system/notice # 鍖归厤閾炬帴 - urlPatterns: /system/*,/monitor/*,/tool/* + urlPatterns: /system/*,/monitor/*,/tool/*,/wcs/* diff --git a/ruoyi-admin/src/main/resources/mapper/wcs/WcsApiConfigMapper.xml b/ruoyi-admin/src/main/resources/mapper/wcs/WcsApiConfigMapper.xml new file mode 100644 index 00000000..58ab3087 --- /dev/null +++ b/ruoyi-admin/src/main/resources/mapper/wcs/WcsApiConfigMapper.xml @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + select api_id, api_code, api_name, api_url, request_method, content_type, + timeout, retry_count, direction, status, del_flag, + create_by, create_time, update_by, update_time, remark + from wcs_api_config + + + + + + + + + + insert into wcs_api_config( + api_code, + api_name, + api_url, + request_method, + content_type, + timeout, + retry_count, + direction, + status, + remark, + create_by, + create_time + )values( + #{apiCode}, + #{apiName}, + #{apiUrl}, + #{requestMethod}, + #{contentType}, + #{timeout}, + #{retryCount}, + #{direction}, + #{status}, + #{remark}, + #{createBy}, + sysdate() + ) + + + + update wcs_api_config + + api_code = #{apiCode}, + api_name = #{apiName}, + api_url = #{apiUrl}, + request_method = #{requestMethod}, + content_type = #{contentType}, + timeout = #{timeout}, + retry_count = #{retryCount}, + direction = #{direction}, + status = #{status}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = sysdate() + + where api_id = #{apiId} + + + + update wcs_api_config set del_flag = '2' where api_id = #{apiId} + + + + update wcs_api_config set del_flag = '2' where api_id in + + #{apiId} + + + + diff --git a/ruoyi-admin/src/main/resources/mapper/wcs/WcsDeviceMapper.xml b/ruoyi-admin/src/main/resources/mapper/wcs/WcsDeviceMapper.xml new file mode 100644 index 00000000..eb06a77b --- /dev/null +++ b/ruoyi-admin/src/main/resources/mapper/wcs/WcsDeviceMapper.xml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + select device_id, device_code, device_name, device_type, area_code, + protocol_type, ip_address, port, status, del_flag, + create_by, create_time, update_by, update_time, remark + from wcs_device + + + + + + + + + + insert into wcs_device( + device_code, + device_name, + device_type, + area_code, + protocol_type, + ip_address, + port, + status, + remark, + create_by, + create_time + )values( + #{deviceCode}, + #{deviceName}, + #{deviceType}, + #{areaCode}, + #{protocolType}, + #{ipAddress}, + #{port}, + #{status}, + #{remark}, + #{createBy}, + sysdate() + ) + + + + update wcs_device + + device_code = #{deviceCode}, + device_name = #{deviceName}, + device_type = #{deviceType}, + area_code = #{areaCode}, + protocol_type = #{protocolType}, + ip_address = #{ipAddress}, + port = #{port}, + status = #{status}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = sysdate() + + where device_id = #{deviceId} + + + + update wcs_device set del_flag = '2' where device_id = #{deviceId} + + + + update wcs_device set del_flag = '2' where device_id in + + #{deviceId} + + + + diff --git a/ruoyi-admin/src/main/resources/mapper/wcs/WcsDevicePointMapper.xml b/ruoyi-admin/src/main/resources/mapper/wcs/WcsDevicePointMapper.xml new file mode 100644 index 00000000..4c6f0e70 --- /dev/null +++ b/ruoyi-admin/src/main/resources/mapper/wcs/WcsDevicePointMapper.xml @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + select p.point_id, p.device_id, p.point_code, p.point_name, p.point_type, + p.data_type, p.address, p.unit, p.status, p.del_flag, + p.create_by, p.create_time, p.update_by, p.update_time, p.remark, + d.device_name + from wcs_device_point p + left join wcs_device d on d.device_id = p.device_id + + + + + + + + insert into wcs_device_point( + device_id, + point_code, + point_name, + point_type, + data_type, + address, + unit, + status, + remark, + create_by, + create_time + )values( + #{deviceId}, + #{pointCode}, + #{pointName}, + #{pointType}, + #{dataType}, + #{address}, + #{unit}, + #{status}, + #{remark}, + #{createBy}, + sysdate() + ) + + + + update wcs_device_point + + device_id = #{deviceId}, + point_code = #{pointCode}, + point_name = #{pointName}, + point_type = #{pointType}, + data_type = #{dataType}, + address = #{address}, + unit = #{unit}, + status = #{status}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = sysdate() + + where point_id = #{pointId} + + + + update wcs_device_point set del_flag = '2' where point_id = #{pointId} + + + + update wcs_device_point set del_flag = '2' where point_id in + + #{pointId} + + + + diff --git a/ruoyi-admin/src/main/resources/mapper/wcs/WcsFlowDefMapper.xml b/ruoyi-admin/src/main/resources/mapper/wcs/WcsFlowDefMapper.xml new file mode 100644 index 00000000..0aa7c090 --- /dev/null +++ b/ruoyi-admin/src/main/resources/mapper/wcs/WcsFlowDefMapper.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + select flow_id, flow_code, flow_name, flow_type, version, flow_json, + status, del_flag, create_by, create_time, update_by, update_time, remark + from wcs_flow_def + + + + + + + + + + insert into wcs_flow_def( + flow_code, + flow_name, + flow_type, + version, + flow_json, + status, + remark, + create_by, + create_time + )values( + #{flowCode}, + #{flowName}, + #{flowType}, + #{version}, + #{flowJson}, + #{status}, + #{remark}, + #{createBy}, + sysdate() + ) + + + + update wcs_flow_def + + flow_code = #{flowCode}, + flow_name = #{flowName}, + flow_type = #{flowType}, + version = #{version}, + flow_json = #{flowJson}, + status = #{status}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = sysdate() + + where flow_id = #{flowId} + + + + update wcs_flow_def set del_flag = '2' where flow_id = #{flowId} + + + + update wcs_flow_def set del_flag = '2' where flow_id in + + #{flowId} + + + + diff --git a/ruoyi-admin/src/main/resources/mapper/wcs/WcsFlowInstanceMapper.xml b/ruoyi-admin/src/main/resources/mapper/wcs/WcsFlowInstanceMapper.xml new file mode 100644 index 00000000..6b6f25c4 --- /dev/null +++ b/ruoyi-admin/src/main/resources/mapper/wcs/WcsFlowInstanceMapper.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + select id, flow_def_id, status, start_time, end_time, remark, + create_by, create_time, update_by, update_time + from wcs_flow_instance + + + + + + + + insert into wcs_flow_instance( + flow_def_id, + status, + start_time, + end_time, + remark, + create_by, + create_time + )values( + #{flowDefId}, + #{status}, + #{startTime}, + #{endTime}, + #{remark}, + #{createBy}, + sysdate() + ) + + + + update wcs_flow_instance + + flow_def_id = #{flowDefId}, + status = #{status}, + start_time = #{startTime}, + end_time = #{endTime}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = sysdate() + + where id = #{id} + + + + delete from wcs_flow_instance where id = #{id} + + + + delete from wcs_flow_instance where id in + + #{id} + + + + diff --git a/ruoyi-admin/src/main/resources/mapper/wcs/WcsFlowLineMapper.xml b/ruoyi-admin/src/main/resources/mapper/wcs/WcsFlowLineMapper.xml new file mode 100644 index 00000000..42beae6b --- /dev/null +++ b/ruoyi-admin/src/main/resources/mapper/wcs/WcsFlowLineMapper.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + select line_id, flow_id, source_node_id, target_node_id, condition_expr, + line_label, sort_order, create_time + from wcs_flow_line + + + + + + + + insert into wcs_flow_line( + flow_id, + source_node_id, + target_node_id, + condition_expr, + line_label, + sort_order, + create_time + )values( + #{flowId}, + #{sourceNodeId}, + #{targetNodeId}, + #{conditionExpr}, + #{lineLabel}, + #{sortOrder}, + sysdate() + ) + + + + delete from wcs_flow_line where line_id = #{lineId} + + + + delete from wcs_flow_line where flow_id = #{flowId} + + + diff --git a/ruoyi-admin/src/main/resources/mapper/wcs/WcsFlowNodeLogMapper.xml b/ruoyi-admin/src/main/resources/mapper/wcs/WcsFlowNodeLogMapper.xml new file mode 100644 index 00000000..39b03c2c --- /dev/null +++ b/ruoyi-admin/src/main/resources/mapper/wcs/WcsFlowNodeLogMapper.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + select id, instance_id, node_id, node_type, status, input, output, + error_msg, start_time, end_time, create_by, create_time + from wcs_flow_node_log + + + + + + + + + + insert into wcs_flow_node_log( + instance_id, + node_id, + node_type, + status, + input, + output, + error_msg, + start_time, + end_time, + create_by, + create_time + )values( + #{instanceId}, + #{nodeId}, + #{nodeType}, + #{status}, + #{input}, + #{output}, + #{errorMsg}, + #{startTime}, + #{endTime}, + #{createBy}, + sysdate() + ) + + + + update wcs_flow_node_log + + status = #{status}, + input = #{input}, + output = #{output}, + error_msg = #{errorMsg}, + start_time = #{startTime}, + end_time = #{endTime}, + + where id = #{id} + + + + delete from wcs_flow_node_log where id = #{id} + + + + delete from wcs_flow_node_log where id in + + #{id} + + + + + delete from wcs_flow_node_log where instance_id = #{instanceId} + + + diff --git a/ruoyi-admin/src/main/resources/mapper/wcs/WcsFlowNodeMapper.xml b/ruoyi-admin/src/main/resources/mapper/wcs/WcsFlowNodeMapper.xml new file mode 100644 index 00000000..81ae8e82 --- /dev/null +++ b/ruoyi-admin/src/main/resources/mapper/wcs/WcsFlowNodeMapper.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + select node_id, flow_id, node_code, node_name, node_type, handler_class, + config_json, pos_x, pos_y, sort_order, create_time, update_time + from wcs_flow_node + + + + + + + + insert into wcs_flow_node( + flow_id, + node_code, + node_name, + node_type, + handler_class, + config_json, + pos_x, + pos_y, + sort_order, + create_time + )values( + #{flowId}, + #{nodeCode}, + #{nodeName}, + #{nodeType}, + #{handlerClass}, + #{configJson}, + #{posX}, + #{posY}, + #{sortOrder}, + sysdate() + ) + + + + update wcs_flow_node + + node_code = #{nodeCode}, + node_name = #{nodeName}, + node_type = #{nodeType}, + handler_class = #{handlerClass}, + config_json = #{configJson}, + pos_x = #{posX}, + pos_y = #{posY}, + sort_order = #{sortOrder}, + update_time = sysdate() + + where node_id = #{nodeId} + + + + delete from wcs_flow_node where node_id = #{nodeId} + + + + delete from wcs_flow_node where flow_id = #{flowId} + + + diff --git a/ruoyi-ui/src/api/wcs/apiconfig.js b/ruoyi-ui/src/api/wcs/apiconfig.js new file mode 100644 index 00000000..02e4bfc1 --- /dev/null +++ b/ruoyi-ui/src/api/wcs/apiconfig.js @@ -0,0 +1,39 @@ +import request from '@/utils/request' + +export function listApiConfig(query) { + return request({ + url: '/wcs/api/config/list', + method: 'get', + params: query + }) +} + +export function getApiConfig(apiId) { + return request({ + url: '/wcs/api/config/' + apiId, + method: 'get' + }) +} + +export function addApiConfig(data) { + return request({ + url: '/wcs/api/config', + method: 'post', + data: data + }) +} + +export function updateApiConfig(data) { + return request({ + url: '/wcs/api/config', + method: 'put', + data: data + }) +} + +export function delApiConfig(apiId) { + return request({ + url: '/wcs/api/config/' + apiId, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/wcs/device.js b/ruoyi-ui/src/api/wcs/device.js new file mode 100644 index 00000000..690123ef --- /dev/null +++ b/ruoyi-ui/src/api/wcs/device.js @@ -0,0 +1,39 @@ +import request from '@/utils/request' + +export function listDevice(query) { + return request({ + url: '/wcs/device/list', + method: 'get', + params: query + }) +} + +export function getDevice(deviceId) { + return request({ + url: '/wcs/device/' + deviceId, + method: 'get' + }) +} + +export function addDevice(data) { + return request({ + url: '/wcs/device', + method: 'post', + data: data + }) +} + +export function updateDevice(data) { + return request({ + url: '/wcs/device', + method: 'put', + data: data + }) +} + +export function delDevice(deviceId) { + return request({ + url: '/wcs/device/' + deviceId, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/wcs/flow.js b/ruoyi-ui/src/api/wcs/flow.js new file mode 100644 index 00000000..38e73059 --- /dev/null +++ b/ruoyi-ui/src/api/wcs/flow.js @@ -0,0 +1,55 @@ +import request from '@/utils/request' + +export function listFlowDef(query) { + return request({ + url: '/wcs/flow/def/list', + method: 'get', + params: query + }) +} + +export function getFlowDef(flowId) { + return request({ + url: '/wcs/flow/def/' + flowId, + method: 'get' + }) +} + +export function addFlowDef(data) { + return request({ + url: '/wcs/flow/def', + method: 'post', + data: data + }) +} + +export function updateFlowDef(data) { + return request({ + url: '/wcs/flow/def', + method: 'put', + data: data + }) +} + +export function delFlowDef(flowId) { + return request({ + url: '/wcs/flow/def/' + flowId, + method: 'delete' + }) +} + +export function listFlowInstance(query) { + return request({ + url: '/wcs/flow/instance/list', + method: 'get', + params: query + }) +} + +export function listFlowLog(query) { + return request({ + url: '/wcs/flow/log/list', + method: 'get', + params: query + }) +} diff --git a/ruoyi-ui/src/api/wcs/flowlog.js b/ruoyi-ui/src/api/wcs/flowlog.js new file mode 100644 index 00000000..7959fa06 --- /dev/null +++ b/ruoyi-ui/src/api/wcs/flowlog.js @@ -0,0 +1,26 @@ +import request from '@/utils/request' + +// 鏌ヨ娴佺▼鑺傜偣鏃ュ織鍒楄〃 +export function listFlowLog(query) { + return request({ + url: '/wcs/flow/log/list', + method: 'get', + params: query + }) +} + +// 鏌ヨ娴佺▼鑺傜偣鏃ュ織璇︾粏 +export function getFlowLog(id) { + return request({ + url: '/wcs/flow/log/' + id, + method: 'get' + }) +} + +// 鍒犻櫎娴佺▼鑺傜偣鏃ュ織 +export function delFlowLog(id) { + return request({ + url: '/wcs/flow/log/' + id, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/wcs/point.js b/ruoyi-ui/src/api/wcs/point.js new file mode 100644 index 00000000..fd40e855 --- /dev/null +++ b/ruoyi-ui/src/api/wcs/point.js @@ -0,0 +1,39 @@ +import request from '@/utils/request' + +export function listPoint(query) { + return request({ + url: '/wcs/device/point/list', + method: 'get', + params: query + }) +} + +export function getPoint(pointId) { + return request({ + url: '/wcs/device/point/' + pointId, + method: 'get' + }) +} + +export function addPoint(data) { + return request({ + url: '/wcs/device/point', + method: 'post', + data: data + }) +} + +export function updatePoint(data) { + return request({ + url: '/wcs/device/point', + method: 'put', + data: data + }) +} + +export function delPoint(pointId) { + return request({ + url: '/wcs/device/point/' + pointId, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/views/wcs/apiconfig/index.vue b/ruoyi-ui/src/views/wcs/apiconfig/index.vue new file mode 100644 index 00000000..a19f3f16 --- /dev/null +++ b/ruoyi-ui/src/views/wcs/apiconfig/index.vue @@ -0,0 +1,400 @@ + + + diff --git a/ruoyi-ui/src/views/wcs/device/index.vue b/ruoyi-ui/src/views/wcs/device/index.vue new file mode 100644 index 00000000..5c73054b --- /dev/null +++ b/ruoyi-ui/src/views/wcs/device/index.vue @@ -0,0 +1,330 @@ + + + diff --git a/ruoyi-ui/src/views/wcs/flowdef/index.vue b/ruoyi-ui/src/views/wcs/flowdef/index.vue new file mode 100644 index 00000000..dda72419 --- /dev/null +++ b/ruoyi-ui/src/views/wcs/flowdef/index.vue @@ -0,0 +1,353 @@ + + + diff --git a/ruoyi-ui/src/views/wcs/flowinstance/index.vue b/ruoyi-ui/src/views/wcs/flowinstance/index.vue new file mode 100644 index 00000000..5cbcd054 --- /dev/null +++ b/ruoyi-ui/src/views/wcs/flowinstance/index.vue @@ -0,0 +1,304 @@ + + + diff --git a/ruoyi-ui/src/views/wcs/flowlog/index.vue b/ruoyi-ui/src/views/wcs/flowlog/index.vue new file mode 100644 index 00000000..b218e59a --- /dev/null +++ b/ruoyi-ui/src/views/wcs/flowlog/index.vue @@ -0,0 +1,263 @@ + + + + + diff --git a/ruoyi-ui/src/views/wcs/point/index.vue b/ruoyi-ui/src/views/wcs/point/index.vue new file mode 100644 index 00000000..d449d2c5 --- /dev/null +++ b/ruoyi-ui/src/views/wcs/point/index.vue @@ -0,0 +1,347 @@ + + + diff --git a/sql/wcs_init_mysql.sql b/sql/wcs_init_mysql.sql new file mode 100644 index 00000000..9d280c37 --- /dev/null +++ b/sql/wcs_init_mysql.sql @@ -0,0 +1,238 @@ +-- ============================================= +-- WCS 仓库控制系统 - MySQL 初始化脚本 +-- 适用数据库: MySQL 5.7+ / 8.0+ +-- 字符集: utf8mb4 +-- 说明: 骨架阶段最小字段集,后续迭代逐步扩展 +-- ============================================= + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- 1. 设备信息表 +-- ---------------------------- +DROP TABLE IF EXISTS `wcs_device`; +CREATE TABLE `wcs_device` ( + `device_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '设备ID', + `device_code` varchar(64) NOT NULL COMMENT '设备编码', + `device_name` varchar(128) DEFAULT NULL COMMENT '设备名称', + `device_type` varchar(32) DEFAULT NULL COMMENT '设备类型(conveyor/agv/elevator/stacker等)', + `area_code` varchar(64) DEFAULT NULL COMMENT '所属区域编码', + `protocol_type` varchar(32) DEFAULT NULL COMMENT '通信协议(modbus_tcp/opc_ua/s7等)', + `ip_address` varchar(64) DEFAULT NULL COMMENT '设备IP地址', + `port` int(11) DEFAULT NULL COMMENT '通信端口', + `status` char(1) DEFAULT '0' COMMENT '设备状态(0正常 1停用)', + `del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0存在 2删除)', + `create_by` varchar(64) DEFAULT '' COMMENT '创建者', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) DEFAULT '' COMMENT '更新者', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`device_id`), + UNIQUE KEY `uk_device_code` (`device_code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='WCS 设备信息表'; + +-- ---------------------------- +-- 2. 设备点位表 +-- ---------------------------- +DROP TABLE IF EXISTS `wcs_device_point`; +CREATE TABLE `wcs_device_point` ( + `point_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '点位ID', + `device_id` bigint(20) NOT NULL COMMENT '所属设备ID', + `point_code` varchar(64) NOT NULL COMMENT '点位编码', + `point_name` varchar(128) DEFAULT NULL COMMENT '点位名称', + `point_type` varchar(32) DEFAULT NULL COMMENT '点位类型(read/write/read_write)', + `data_type` varchar(32) DEFAULT NULL COMMENT '数据类型(int/float/bool/string)', + `address` varchar(128) DEFAULT NULL COMMENT '寄存器地址/OPC节点', + `unit` varchar(32) DEFAULT NULL COMMENT '单位', + `status` char(1) DEFAULT '0' COMMENT '状态(0正常 1停用)', + `del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0存在 2删除)', + `create_by` varchar(64) DEFAULT '' COMMENT '创建者', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) DEFAULT '' COMMENT '更新者', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`point_id`), + KEY `idx_device_id` (`device_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='WCS 设备点位表'; + +-- ---------------------------- +-- 3. 设备点位值记录表 +-- ---------------------------- +DROP TABLE IF EXISTS `wcs_device_point_value`; +CREATE TABLE `wcs_device_point_value` ( + `value_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '记录ID', + `point_id` bigint(20) NOT NULL COMMENT '点位ID', + `device_id` bigint(20) NOT NULL COMMENT '设备ID', + `point_value` varchar(256) DEFAULT NULL COMMENT '点位值', + `quality` varchar(16) DEFAULT NULL COMMENT '数据质量(good/bad/uncertain)', + `collect_time` datetime DEFAULT NULL COMMENT '采集时间', + `create_time` datetime DEFAULT NULL COMMENT '记录时间', + PRIMARY KEY (`value_id`), + KEY `idx_point_id` (`point_id`), + KEY `idx_collect_time` (`collect_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='WCS 设备点位值记录表'; + +-- ---------------------------- +-- 4. 接口配置表 +-- ---------------------------- +DROP TABLE IF EXISTS `wcs_api_config`; +CREATE TABLE `wcs_api_config` ( + `api_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '接口ID', + `api_code` varchar(64) NOT NULL COMMENT '接口编码', + `api_name` varchar(128) DEFAULT NULL COMMENT '接口名称', + `api_url` varchar(512) DEFAULT NULL COMMENT '接口地址', + `request_method` varchar(16) DEFAULT 'POST' COMMENT '请求方式(GET/POST/PUT/DELETE)', + `content_type` varchar(64) DEFAULT 'application/json' COMMENT '内容类型', + `timeout` int(11) DEFAULT 30000 COMMENT '超时时间(毫秒)', + `retry_count` int(11) DEFAULT 0 COMMENT '重试次数', + `direction` varchar(16) DEFAULT NULL COMMENT '方向(inbound/outbound)', + `status` char(1) DEFAULT '0' COMMENT '状态(0正常 1停用)', + `del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0存在 2删除)', + `create_by` varchar(64) DEFAULT '' COMMENT '创建者', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) DEFAULT '' COMMENT '更新者', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`api_id`), + UNIQUE KEY `uk_api_code` (`api_code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='WCS 接口配置表'; + +-- ---------------------------- +-- 5. 流程定义表 +-- ---------------------------- +DROP TABLE IF EXISTS `wcs_flow_def`; +CREATE TABLE `wcs_flow_def` ( + `flow_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '流程ID', + `flow_code` varchar(64) NOT NULL COMMENT '流程编码', + `flow_name` varchar(128) DEFAULT NULL COMMENT '流程名称', + `flow_type` varchar(32) DEFAULT NULL COMMENT '流程类型', + `version` int(11) DEFAULT 1 COMMENT '版本号', + `flow_json` text COMMENT '流程JSON定义(画布数据)', + `status` char(1) DEFAULT '0' COMMENT '状态(0草稿 1已发布 2已停用)', + `del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0存在 2删除)', + `create_by` varchar(64) DEFAULT '' COMMENT '创建者', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) DEFAULT '' COMMENT '更新者', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`flow_id`), + UNIQUE KEY `uk_flow_code_version` (`flow_code`, `version`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='WCS 流程定义表'; + +-- ---------------------------- +-- 6. 流程节点表 +-- ---------------------------- +DROP TABLE IF EXISTS `wcs_flow_node`; +CREATE TABLE `wcs_flow_node` ( + `node_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '节点ID', + `flow_id` bigint(20) NOT NULL COMMENT '所属流程ID', + `node_code` varchar(64) NOT NULL COMMENT '节点编码', + `node_name` varchar(128) DEFAULT NULL COMMENT '节点名称', + `node_type` varchar(32) DEFAULT NULL COMMENT '节点类型(start/end/task/condition/parallel等)', + `handler_class` varchar(256) DEFAULT NULL COMMENT '处理器类名', + `config_json` text COMMENT '节点配置JSON', + `pos_x` int(11) DEFAULT 0 COMMENT '画布X坐标', + `pos_y` int(11) DEFAULT 0 COMMENT '画布Y坐标', + `sort_order` int(11) DEFAULT 0 COMMENT '排序', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`node_id`), + KEY `idx_flow_id` (`flow_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='WCS 流程节点表'; + +-- ---------------------------- +-- 7. 流程连线表 +-- ---------------------------- +DROP TABLE IF EXISTS `wcs_flow_line`; +CREATE TABLE `wcs_flow_line` ( + `line_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '连线ID', + `flow_id` bigint(20) NOT NULL COMMENT '所属流程ID', + `source_node_id` bigint(20) NOT NULL COMMENT '源节点ID', + `target_node_id` bigint(20) NOT NULL COMMENT '目标节点ID', + `condition_expr` varchar(512) DEFAULT NULL COMMENT '条件表达式', + `line_label` varchar(128) DEFAULT NULL COMMENT '连线标签', + `sort_order` int(11) DEFAULT 0 COMMENT '排序', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + PRIMARY KEY (`line_id`), + KEY `idx_flow_id` (`flow_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='WCS 流程连线表'; + +-- ---------------------------- +-- 8. 流程实例表 +-- ---------------------------- +DROP TABLE IF EXISTS `wcs_flow_instance`; +CREATE TABLE `wcs_flow_instance` ( + `instance_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '实例ID', + `flow_id` bigint(20) NOT NULL COMMENT '流程定义ID', + `instance_code` varchar(64) DEFAULT NULL COMMENT '实例编码', + `trigger_source` varchar(64) DEFAULT NULL COMMENT '触发来源', + `current_node_id` bigint(20) DEFAULT NULL COMMENT '当前节点ID', + `instance_status` varchar(16) DEFAULT 'running' COMMENT '实例状态(running/completed/failed/cancelled)', + `context_json` text COMMENT '运行时上下文JSON', + `start_time` datetime DEFAULT NULL COMMENT '开始时间', + `end_time` datetime DEFAULT NULL COMMENT '结束时间', + `error_msg` varchar(2000) DEFAULT NULL COMMENT '错误信息', + `create_by` varchar(64) DEFAULT '' COMMENT '创建者', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + PRIMARY KEY (`instance_id`), + KEY `idx_flow_id` (`flow_id`), + KEY `idx_instance_status` (`instance_status`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='WCS 流程实例表'; + +-- ---------------------------- +-- 9. 流程节点执行日志表 +-- ---------------------------- +DROP TABLE IF EXISTS `wcs_flow_node_log`; +CREATE TABLE `wcs_flow_node_log` ( + `log_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '日志ID', + `instance_id` bigint(20) NOT NULL COMMENT '流程实例ID', + `node_id` bigint(20) NOT NULL COMMENT '节点ID', + `node_name` varchar(128) DEFAULT NULL COMMENT '节点名称', + `execute_status` varchar(16) DEFAULT NULL COMMENT '执行状态(success/fail/skip)', + `input_data` text COMMENT '输入数据JSON', + `output_data` text COMMENT '输出数据JSON', + `error_msg` varchar(2000) DEFAULT NULL COMMENT '错误信息', + `start_time` datetime DEFAULT NULL COMMENT '开始时间', + `end_time` datetime DEFAULT NULL COMMENT '结束时间', + `duration` bigint(20) DEFAULT NULL COMMENT '执行耗时(毫秒)', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + PRIMARY KEY (`log_id`), + KEY `idx_instance_id` (`instance_id`), + KEY `idx_node_id` (`node_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='WCS 流程节点执行日志表'; + +-- ---------------------------- +-- WCS 菜单数据初始化(插入若依菜单表) +-- 菜单ID 从 2000 起,避免与系统菜单冲突 +-- ---------------------------- + +-- WCS 一级菜单 +INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) +VALUES (2000, 'WCS控制系统', 0, 5, 'wcs', NULL, '', '', 1, 0, 'M', '0', '0', '', 'server', 'admin', sysdate(), '', NULL, 'WCS仓库控制系统'); + +-- 设备管理 +INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) +VALUES (2001, '设备管理', 2000, 1, 'device', 'wcs/device/index', '', '', 1, 0, 'C', '0', '0', 'wcs:device:list', 'component', 'admin', sysdate(), '', NULL, 'WCS设备管理'); + +-- 点位配置 +INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) +VALUES (2002, '点位配置', 2000, 2, 'point', 'wcs/point/index', '', '', 1, 0, 'C', '0', '0', 'wcs:point:list', 'edit', 'admin', sysdate(), '', NULL, 'WCS点位配置'); + +-- 接口配置 +INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) +VALUES (2003, '接口配置', 2000, 3, 'apiconfig', 'wcs/apiconfig/index', '', '', 1, 0, 'C', '0', '0', 'wcs:api:list', 'link', 'admin', sysdate(), '', NULL, 'WCS接口配置'); + +-- 流程定义 +INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) +VALUES (2004, '流程定义', 2000, 4, 'flowdef', 'wcs/flowdef/index', '', '', 1, 0, 'C', '0', '0', 'wcs:flow:list', 'cascader', 'admin', sysdate(), '', NULL, 'WCS流程定义'); + +-- 流程实例 +INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) +VALUES (2005, '流程实例', 2000, 5, 'flowinstance', 'wcs/flowinstance/index', '', '', 1, 0, 'C', '0', '0', 'wcs:instance:list', 'list', 'admin', sysdate(), '', NULL, 'WCS流程实例'); + +-- 运行日志 +INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) +VALUES (2006, '运行日志', 2000, 6, 'flowlog', 'wcs/flowlog/index', '', '', 1, 0, 'C', '0', '0', 'wcs:log:list', 'log', 'admin', sysdate(), '', NULL, 'WCS运行日志'); + +SET FOREIGN_KEY_CHECKS = 1;