diff --git a/src/main/java/com/iflytop/sgs/app/controller/CraftsController.java b/src/main/java/com/iflytop/sgs/app/controller/CraftsController.java index 4feb22d..a7e0ece 100644 --- a/src/main/java/com/iflytop/sgs/app/controller/CraftsController.java +++ b/src/main/java/com/iflytop/sgs/app/controller/CraftsController.java @@ -1,6 +1,7 @@ package com.iflytop.sgs.app.controller; import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.iflytop.sgs.app.model.bo.status.device.DeviceState; import com.iflytop.sgs.app.model.dto.PauseCraftsDto; import com.iflytop.sgs.app.model.dto.ResumeCraftsDTO; @@ -9,9 +10,12 @@ import com.iflytop.sgs.app.model.dto.StopCraftsDTO; import com.iflytop.sgs.app.model.entity.CraftMonitor; import com.iflytop.sgs.app.model.entity.Crafts; import com.iflytop.sgs.app.model.vo.CraftMonitorVO; +import com.iflytop.sgs.app.model.vo.OresCraftsListVO; import com.iflytop.sgs.app.model.vo.SetCraftsVO; import com.iflytop.sgs.app.service.api.CraftsService; import com.iflytop.sgs.app.service.device.DeviceStateService; +import com.iflytop.sgs.common.base.BasePageQuery; +import com.iflytop.sgs.common.result.PageResult; import com.iflytop.sgs.common.result.Result; import com.iflytop.sgs.common.result.ResultCode; import io.swagger.v3.oas.annotations.Operation; @@ -38,10 +42,10 @@ public class CraftsController { private final DeviceStateService deviceStateService; @Operation(summary = "根据矿石id获取工艺列表") - @GetMapping("/list/{oresId}") - public Result> getList(@NotNull(message = "矿石ID 不能为空") @Min(value = 1, message = "矿石ID 必须大于等于 1") @Parameter(description = "矿石ID") @PathVariable Long oresId) { - List craftList = craftsService.selectAllByOresId(oresId); - return Result.success(craftList); + @GetMapping("/list") + public PageResult getPage(BasePageQuery pageQuery) { + IPage result = craftsService.getPage(pageQuery); + return PageResult.success(result); } @Operation(summary = "添加新工艺") @@ -79,12 +83,6 @@ public class CraftsController { return Result.failed(); } -// @Operation(summary = "配置加热区工艺") -// @PostMapping("/set") -// public Result setCrafts(@Valid @RequestBody SetCraftsDTO setCraftsDTO) { -// return Result.success(craftsService.setCraft(setCraftsDTO.getCraftId(), setCraftsDTO.getHeatId())); -// } - @Operation(summary = "开始执行工艺") @PostMapping("/start") diff --git a/src/main/java/com/iflytop/sgs/app/controller/OresController.java b/src/main/java/com/iflytop/sgs/app/controller/OresController.java deleted file mode 100644 index ed8cc99..0000000 --- a/src/main/java/com/iflytop/sgs/app/controller/OresController.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.iflytop.sgs.app.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.iflytop.sgs.app.model.entity.Ores; -import com.iflytop.sgs.app.model.vo.OresCraftsListVO; -import com.iflytop.sgs.app.service.api.OresService; -import com.iflytop.sgs.common.base.BasePageQuery; -import com.iflytop.sgs.common.result.PageResult; -import com.iflytop.sgs.common.result.Result; -import com.iflytop.sgs.common.result.ResultCode; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.validation.Valid; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.*; - -@Tag(name = "矿石管理") -@RestController -@RequestMapping("/api/ores") -@RequiredArgsConstructor -@Slf4j -public class OresController { - private final OresService oresService; - - @Operation(summary = "矿石工艺列表") - @GetMapping("/list") - public PageResult getList(BasePageQuery pageQuery) { - IPage result = oresService.getPage(pageQuery); - return PageResult.success(result); - } - - @Operation(summary = "添加新矿石") - @PostMapping("") - public Result add(@Valid @RequestBody Ores ores) { - Ores existingOres = oresService.findByName(ores.getName()); - if (existingOres == null) { - boolean isSuccess = oresService.addOres(ores); - if (isSuccess) { - return Result.success(); - } - } else { - return Result.failed(ResultCode.DATA_ALREADY_EXISTS); - } - return Result.failed(); - } - - @Operation(summary = "更新矿石") - @PutMapping("") - public Result update(@Valid @RequestBody Ores ores) { - Ores existingOres = oresService.findByName(ores.getName()); - if (existingOres == null) { - boolean isSuccess = oresService.updateOres(ores); - if (isSuccess) { - return Result.success(); - } - } else { - return Result.failed(ResultCode.DATA_ALREADY_EXISTS); - } - return Result.failed(); - } - - @Operation(summary = "删除矿石") - @DeleteMapping("/{ids}") - public Result delete(@Parameter(description = "矿石ID,多个以英文逗号(,)分割") @PathVariable String ids) { - boolean isSuccess = oresService.deleteOres(ids); - if (isSuccess) { - return Result.success(); - } - return Result.failed(); - } - -} diff --git a/src/main/java/com/iflytop/sgs/app/core/CraftsContext.java b/src/main/java/com/iflytop/sgs/app/core/CraftsContext.java index ca4ce6b..bb5336b 100644 --- a/src/main/java/com/iflytop/sgs/app/core/CraftsContext.java +++ b/src/main/java/com/iflytop/sgs/app/core/CraftsContext.java @@ -5,7 +5,6 @@ import com.iflytop.sgs.app.model.bo.CraftsStep; import com.iflytop.sgs.app.model.bo.status.device.CraftsState; import com.iflytop.sgs.app.model.entity.CraftMonitor; import com.iflytop.sgs.app.model.entity.Crafts; -import com.iflytop.sgs.app.model.entity.Ores; import com.iflytop.sgs.app.service.api.CraftMonitorService; import com.iflytop.sgs.app.service.crafts.CraftsStepService; import com.iflytop.sgs.app.service.device.DeviceStateService; @@ -32,7 +31,6 @@ import java.util.Map; @Getter public class CraftsContext implements Runnable { private final HeatModuleCode heatModuleCode; - private final Ores ores; private final Crafts craft; private final List craftsStepList; private final StateMachine sm; @@ -46,7 +44,7 @@ public class CraftsContext implements Runnable { /** * 构造方法,初始化上下文并启动状态机至 READY */ - public CraftsContext(HeatModuleCode heatModuleCode, int currentIndex, Ores ores, + public CraftsContext(HeatModuleCode heatModuleCode, int currentIndex, Crafts craft, CraftMonitor craftMonitor, StateMachineFactory factory, WebSocketSender webSocketService, @@ -55,7 +53,6 @@ public class CraftsContext implements Runnable { DeviceStateService deviceStateService) { this.heatModuleCode = heatModuleCode; this.currentIndex = currentIndex; - this.ores = ores; this.craft = craft; this.craftMonitor = craftMonitor; this.craftsStepList = JSONUtil.parseArray(craft.getSteps()).toList(CraftsStep.class); diff --git a/src/main/java/com/iflytop/sgs/app/mapper/OresMapper.java b/src/main/java/com/iflytop/sgs/app/mapper/OresMapper.java deleted file mode 100644 index c538853..0000000 --- a/src/main/java/com/iflytop/sgs/app/mapper/OresMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.iflytop.sgs.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.iflytop.sgs.app.model.entity.Ores; -import org.apache.ibatis.annotations.Mapper; - -/** - * 矿石持久层接口 - */ -@Mapper -public interface OresMapper extends BaseMapper { - - Ores findByName(String name); - -} diff --git a/src/main/java/com/iflytop/sgs/app/model/bo/status/device/CraftsState.java b/src/main/java/com/iflytop/sgs/app/model/bo/status/device/CraftsState.java index 27471dd..9dac6e2 100644 --- a/src/main/java/com/iflytop/sgs/app/model/bo/status/device/CraftsState.java +++ b/src/main/java/com/iflytop/sgs/app/model/bo/status/device/CraftsState.java @@ -2,7 +2,6 @@ package com.iflytop.sgs.app.model.bo.status.device; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.iflytop.sgs.app.model.entity.Crafts; -import com.iflytop.sgs.app.model.entity.Ores; import com.iflytop.sgs.common.enums.automaton.CraftStates; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -20,9 +19,6 @@ public class CraftsState { @Schema(description = "工艺状态") private CraftStates state; - @Schema(description = "工艺所属矿石") - private Ores ores; - @Schema(description = "工艺") private Crafts craft; diff --git a/src/main/java/com/iflytop/sgs/app/model/entity/Crafts.java b/src/main/java/com/iflytop/sgs/app/model/entity/Crafts.java index 5ad04c2..e9b9591 100644 --- a/src/main/java/com/iflytop/sgs/app/model/entity/Crafts.java +++ b/src/main/java/com/iflytop/sgs/app/model/entity/Crafts.java @@ -25,8 +25,4 @@ public class Crafts extends BaseEntity { @Schema(description = "工艺步骤") private String steps; - @Positive(message = "矿石ID 必须是正数") - @NotNull - @Schema(description = "矿石ID") - private Long oresId; } diff --git a/src/main/java/com/iflytop/sgs/app/model/entity/Ores.java b/src/main/java/com/iflytop/sgs/app/model/entity/Ores.java deleted file mode 100644 index 306d03a..0000000 --- a/src/main/java/com/iflytop/sgs/app/model/entity/Ores.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.iflytop.sgs.app.model.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import com.iflytop.sgs.common.base.BaseEntity; -import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.NotNull; -import lombok.Data; -import lombok.EqualsAndHashCode; - -@EqualsAndHashCode(callSuper = true) -@Schema(description = "矿石") -@TableName("ores") -@Data -public class Ores extends BaseEntity { - - @NotNull - @Schema(description = "矿石名称") - private String name; - -} diff --git a/src/main/java/com/iflytop/sgs/app/model/vo/CraftMonitorVO.java b/src/main/java/com/iflytop/sgs/app/model/vo/CraftMonitorVO.java index ede7664..cbaac14 100644 --- a/src/main/java/com/iflytop/sgs/app/model/vo/CraftMonitorVO.java +++ b/src/main/java/com/iflytop/sgs/app/model/vo/CraftMonitorVO.java @@ -20,11 +20,6 @@ public class CraftMonitorVO { @Schema(description = "加热区 ID") private HeatModuleCode heatId; - @Schema(description = "矿石 ID") - private Long oresId; - - @Schema(description = "矿石名称") - private String oresName; @Schema(description = "工艺 ID") private Long craftsId; diff --git a/src/main/java/com/iflytop/sgs/app/model/vo/CraftStatusVO.java b/src/main/java/com/iflytop/sgs/app/model/vo/CraftStatusVO.java index b52c920..18a414b 100644 --- a/src/main/java/com/iflytop/sgs/app/model/vo/CraftStatusVO.java +++ b/src/main/java/com/iflytop/sgs/app/model/vo/CraftStatusVO.java @@ -17,11 +17,6 @@ public class CraftStatusVO { @Schema(description = "加热区 ID") private HeatModuleCode heatId; - @Schema(description = "矿石 ID") - private Long oresId; - - @Schema(description = "矿石名称") - private String oresName; @Schema(description = "工艺 ID") private Long craftsId; diff --git a/src/main/java/com/iflytop/sgs/app/model/vo/SetCraftsVO.java b/src/main/java/com/iflytop/sgs/app/model/vo/SetCraftsVO.java index 30dce97..42baf53 100644 --- a/src/main/java/com/iflytop/sgs/app/model/vo/SetCraftsVO.java +++ b/src/main/java/com/iflytop/sgs/app/model/vo/SetCraftsVO.java @@ -15,9 +15,4 @@ public class SetCraftsVO { @Schema(description = "工艺名称") private Long craftsId; - @Schema(description = "矿石名称") - private String oresName; - - @Schema(description = "矿石ID") - private Long oresId; } diff --git a/src/main/java/com/iflytop/sgs/app/service/api/CraftsService.java b/src/main/java/com/iflytop/sgs/app/service/api/CraftsService.java index ec16a86..99410b4 100644 --- a/src/main/java/com/iflytop/sgs/app/service/api/CraftsService.java +++ b/src/main/java/com/iflytop/sgs/app/service/api/CraftsService.java @@ -3,6 +3,8 @@ package com.iflytop.sgs.app.service.api; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.iflytop.sgs.app.core.CraftsContext; import com.iflytop.sgs.app.mapper.CraftsMapper; @@ -14,7 +16,6 @@ import com.iflytop.sgs.app.model.bo.status.device.TubeState; import com.iflytop.sgs.app.model.dto.StartCraftsDTO; import com.iflytop.sgs.app.model.entity.CraftMonitor; import com.iflytop.sgs.app.model.entity.Crafts; -import com.iflytop.sgs.app.model.entity.Ores; import com.iflytop.sgs.app.model.vo.CraftMonitorVO; import com.iflytop.sgs.app.model.vo.CraftStatusVO; import com.iflytop.sgs.app.model.vo.SetCraftsVO; @@ -22,6 +23,7 @@ import com.iflytop.sgs.app.service.crafts.CraftsStepService; import com.iflytop.sgs.app.service.device.DeviceStateService; import com.iflytop.sgs.app.service.device.module.HeatModuleService; import com.iflytop.sgs.app.ws.server.WebSocketSender; +import com.iflytop.sgs.common.base.BasePageQuery; import com.iflytop.sgs.common.enums.HeatModuleCode; import com.iflytop.sgs.common.enums.SystemConfigCode; import com.iflytop.sgs.common.enums.automaton.CraftEvents; @@ -55,7 +57,6 @@ public class CraftsService extends ServiceImpl { private final StateMachineFactory stateMachineFactory; private final WebSocketSender webSocketService; private final CraftsStepService craftsStepService; - private final OresService oresService; private final CraftMonitorService craftMonitorService; private final ConcurrentHashMap contextMap = new ConcurrentHashMap<>(); private final ConcurrentHashMap> futureMap = new ConcurrentHashMap<>(); @@ -89,10 +90,6 @@ public class CraftsService extends ServiceImpl { if (craft == null) { throw new AppException(ResultCode.INVALID_PARAMETER); } - Ores ores = oresService.getById(craft.getOresId()); - if (ores == null) { - throw new AppException(ResultCode.INVALID_PARAMETER); - } //判断是否指定加热区id if (startCraftsDTO.getHeatId() == null) { //如果没有指定加热区id,则自动获取一个 @@ -141,7 +138,6 @@ public class CraftsService extends ServiceImpl { } CraftsState craftsState = craftsStateObjectProvider.getObject(); craftsState.setCraft(craft); - craftsState.setOres(ores); craftsState.setState(CraftStates.READY); craftsState.setCurrentIndex(0); trayState.setHeatModuleCode(heatModuleCode); @@ -150,7 +146,6 @@ public class CraftsService extends ServiceImpl { CraftsContext ctx = new CraftsContext( heatModuleCode, currentIndex, - ores, craft, craftMonitor, stateMachineFactory, @@ -167,8 +162,6 @@ public class CraftsService extends ServiceImpl { setCraftsVO.setHeatId(heatModuleCode); setCraftsVO.setCraftsName(craft.getName()); setCraftsVO.setCraftsId(craft.getId()); - setCraftsVO.setOresName(ores.getName()); - setCraftsVO.setOresId(ores.getId()); return setCraftsVO; } @@ -239,8 +232,6 @@ public class CraftsService extends ServiceImpl { } CraftStatusVO vo = new CraftStatusVO(); vo.setHeatId(heatModuleCode); - vo.setOresId(ctx.getOres().getId()); - vo.setOresName(ctx.getOres().getName()); vo.setCraftsId(ctx.getCraft().getId()); vo.setCraftsName(ctx.getCraft().getName()); vo.setState(ctx.getSm().getState().getId()); @@ -258,8 +249,6 @@ public class CraftsService extends ServiceImpl { CraftsContext ctx = entry.getValue(); CraftStatusVO vo = new CraftStatusVO(); vo.setHeatId(heatModuleCode); - vo.setOresId(ctx.getOres().getId()); - vo.setOresName(ctx.getOres().getName()); vo.setCraftsId(ctx.getCraft().getId()); vo.setCraftsName(ctx.getCraft().getName()); vo.setState(ctx.getSm().getState().getId()); @@ -289,13 +278,10 @@ public class CraftsService extends ServiceImpl { voList.forEach(craftMonitor -> { Crafts crafts = this.getById(craftMonitor.getCraftsId()); if (crafts != null) { - Ores ores = oresService.getById(crafts.getOresId()); CraftMonitorVO vo = new CraftMonitorVO(); vo.setMonitorId(craftMonitor.getId()); vo.setCraftsId(crafts.getId()); vo.setCraftsName(crafts.getName()); - vo.setOresId(ores.getId()); - vo.setOresName(ores.getName()); vo.setSteps(JSONUtil.parseArray(crafts.getSteps()).toList(CraftsStep.class)); vo.setCurrentStepIndex(craftMonitor.getCurrentStepId()); vo.setCurrentStepResult(craftMonitor.getCurrentStepResult()); @@ -328,4 +314,12 @@ public class CraftsService extends ServiceImpl { public void removeMonitor(Long id) { craftMonitorService.removeById(id); } + + public IPage getPage(BasePageQuery pageQuery) { + // 构建分页对象 + Page craftsPage = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize()); + + // 分页查询矿石数据 + return this.baseMapper.selectPage(craftsPage, new QueryWrapper<>()); + } } diff --git a/src/main/java/com/iflytop/sgs/app/service/api/OresService.java b/src/main/java/com/iflytop/sgs/app/service/api/OresService.java deleted file mode 100644 index 1165ed8..0000000 --- a/src/main/java/com/iflytop/sgs/app/service/api/OresService.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.iflytop.sgs.app.service.api; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.iflytop.sgs.app.mapper.CraftsMapper; -import com.iflytop.sgs.app.mapper.OresMapper; -import com.iflytop.sgs.app.model.entity.Crafts; -import com.iflytop.sgs.app.model.entity.Ores; -import com.iflytop.sgs.app.model.vo.OresCraftsListVO; -import com.iflytop.sgs.common.base.BasePageQuery; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * 矿石业务实现类 - */ -@Service -@RequiredArgsConstructor -public class OresService extends ServiceImpl { - - private final CraftsMapper craftsMapper; - - - public IPage getPage(BasePageQuery pageQuery) { - // 构建分页对象 - Page oresPage = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize()); - - // 分页查询矿石数据 - IPage oresIPage = this.baseMapper.selectPage(oresPage, new QueryWrapper<>()); - - // 获取矿石ID列表 - List oresIds = oresIPage.getRecords().stream() - .map(Ores::getId) - .collect(Collectors.toList()); - - // 查询对应的工艺数据 - QueryWrapper craftsQueryWrapper = new QueryWrapper<>(); - craftsQueryWrapper.in("ores_id", oresIds); - List craftsList = craftsMapper.selectList(craftsQueryWrapper); - - // 将工艺数据按矿石ID分组 - Map> craftsMap = craftsList.stream() - .collect(Collectors.groupingBy(Crafts::getOresId)); - - // 转换成 OresCraftsListVO - List oresCraftsList = oresIPage.getRecords().stream().map(ores -> { - OresCraftsListVO oresCraftsListVO = new OresCraftsListVO(); - oresCraftsListVO.setId(ores.getId()); - oresCraftsListVO.setOresName(ores.getName()); - oresCraftsListVO.setCreateTime(ores.getCreateTime()); - oresCraftsListVO.setUpdateTime(ores.getUpdateTime()); - - // 设置该矿石的工艺列表 - List crafts = craftsMap.get(ores.getId()); - if (crafts != null) { - crafts.forEach(c -> c.setSteps(null)); - } - oresCraftsListVO.setCraftsList(crafts); - - return oresCraftsListVO; - }).collect(Collectors.toList()); - - // 将转换后的分页数据放入新的分页对象 - Page resultPage = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize()); - resultPage.setTotal(oresIPage.getTotal()); - resultPage.setRecords(oresCraftsList); - - return resultPage; - - } - - - public Ores findByName(String name) { - return this.getOne(new LambdaQueryWrapper().eq(Ores::getName, name)); - } - - - public boolean addOres(Ores ores) { - return this.save(ores); - } - - - public boolean updateOres(Ores ores) { - return this.updateById(ores); - } - - - public boolean deleteOres(String idsStr) { - List ids = Arrays.stream(idsStr.split(",")) - .map(Long::parseLong) - .collect(Collectors.toList()); - return this.removeByIds(ids); - } -} diff --git a/src/main/java/com/iflytop/sgs/app/service/crafts/CraftsStepService.java b/src/main/java/com/iflytop/sgs/app/service/crafts/CraftsStepService.java index 43a6ffb..7bcbc90 100644 --- a/src/main/java/com/iflytop/sgs/app/service/crafts/CraftsStepService.java +++ b/src/main/java/com/iflytop/sgs/app/service/crafts/CraftsStepService.java @@ -277,7 +277,7 @@ public class CraftsStepService { Double volume = params.getDouble("volume");//量 JSONArray jsonArray = params.getJSONArray("columns");//列数 Double height = params.getDouble("height");//下降进入试管的高度 - if (height > 54) {//到达试管底部的最大距离 + if (height > 55) {//到达试管底部的最大距离 throw new AppException(ResultCode.CRAFT_PARAMS_MISTAKE); } Integer channel = container.getChannel();//获取阀门通道 @@ -515,7 +515,7 @@ public class CraftsStepService { Double volume = params.getDouble("volume") == null ? 2.0 : params.getDouble("volume");//加水量 Integer cycle = params.getInt("cycle");//次数 Double height = params.getDouble("height");//下降进入试管的高度 - if (height > 54) { + if (height > 55) { throw new AppException(ResultCode.CRAFT_PARAMS_MISTAKE); } boolean heatModuleTrayExist = deviceSensorService.getTrayStateByHeatModuleCode(heatModuleCode);//目标加热模块有无托盘 @@ -605,6 +605,7 @@ public class CraftsStepService { solutionModuleService.liquidPumpMove(-drainDistance);//排空 solutionModuleService.liquidValveSwitch(SolutionCode.water);//电磁阀对应通道打开 solutionModuleService.liquidPumpMove(preFillDistance);//预充 + solutionModuleService.liquidPumpMove(-backFlowDistance);//防滴落 solutionModuleService.solutionMotorMoveZero();//加液机械臂上升 log.info("工艺{},清洗开始", heatModuleCode); transferModuleService.transferMove(liquidAreaTrayPoint3D);//移动至加液时托盘位置点 @@ -624,7 +625,7 @@ public class CraftsStepService { log.info("工艺{},加液模块上升至最高,移出试管", heatModuleCode); solutionModuleService.solutionMotorMoveZero();//加液模块上升至最高,移出试管 } - solutionModuleService.liquidPumpMove(-backFlowDistance);//预充 + solutionModuleService.liquidPumpMove(-backFlowDistance);//防滴落 log.info("工艺{},电磁阀废液通道打开", heatModuleCode); Thread.sleep(1000); /*抽*/ diff --git a/src/main/java/com/iflytop/sgs/app/service/device/DeviceInitService.java b/src/main/java/com/iflytop/sgs/app/service/device/DeviceInitService.java index aa52925..224b9e2 100644 --- a/src/main/java/com/iflytop/sgs/app/service/device/DeviceInitService.java +++ b/src/main/java/com/iflytop/sgs/app/service/device/DeviceInitService.java @@ -60,7 +60,6 @@ public class DeviceInitService { } }); initDeviceState(); - //把加热至为stop todo initDeviceSetData(); canBusService.initOvertime(); initEnable(); @@ -162,5 +161,6 @@ public class DeviceInitService { } } + } } diff --git a/src/main/resources/sql/init.sql b/src/main/resources/sql/init.sql index 5ebaf0e..2a6e547 100644 --- a/src/main/resources/sql/init.sql +++ b/src/main/resources/sql/init.sql @@ -7,7 +7,7 @@ CREATE TABLE IF NOT EXISTS user password TEXT, role TEXT, fixed_user TEXT, - deleted TEXT DEFAULT 'DISABLE', + deleted TEXT DEFAULT 'DISABLE', create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); @@ -16,14 +16,6 @@ INSERT OR IGNORE INTO user (username, nickname, password, role, fixed_user, dele VALUES ('admin', 'Admin', '123456', 'ADMIN', 'ENABLE', 'DISABLE'), ('test', 'test', '123456', 'ADMIN', 'ENABLE', 'DISABLE'); --- ores 矿石 表 -CREATE TABLE IF NOT EXISTS ores -( - id INTEGER PRIMARY KEY AUTOINCREMENT, - name VARCHAR NOT NULL, - create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP -); -- 设备位置 表 CREATE TABLE IF NOT EXISTS device_position ( @@ -46,23 +38,42 @@ CREATE TABLE IF NOT EXISTS system_config create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); -INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") VALUES (1, '水加液系数', 'water', '2.0', '2025-06-07 10:58:06.000', '2025-06-07 10:58:07.000'); -INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") VALUES (2, '浓硝酸加液系数', 'thick', '2.0', '2025-05-28 13:30:45', '2025-05-28 13:30:45'); -INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") VALUES (3, '稀硝酸加液系数', 'thin', '2.0', '2025-05-28 13:30:45', '2025-05-28 13:30:45'); -INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") VALUES (4, '回吸放滴落距离', 'back_flow_distance', '0.1', '2025-05-28 13:30:45', '2025-05-28 13:30:45'); -INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") VALUES (5, '过量预充距离', 'pre_fill_distance', '17.0', '2025-05-28 13:30:45', '2025-05-28 13:30:45'); -INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") VALUES (6, '过量排空距离', 'drain_distance', '17.0', '2025-05-28 13:30:45', '2025-05-28 13:30:45'); -INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") VALUES (7, '过量抽液距离', 'number_reduce', '7.0', '2025-05-28 13:30:45', '2025-05-28 13:30:45'); -INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") VALUES (8, '允许的最大清洁次数', 'cycle_clean_max', '5', '2025-05-28 13:30:45', '2025-05-28 13:30:45'); -INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") VALUES (9, '蠕动泵最大转速限制', 'liquid_max_speed', '150', '2025-05-28 13:30:45', '2025-05-28 13:30:45'); -INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") VALUES (10, '忽略门自检', 'door_origin_is_ignore', 'true', '2025-05-29T14:23:48', '2025-05-29T14:23:48'); -INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") VALUES (11, '工艺结束蜂鸣器次数', 'crafts_end_beep_times', '3', '2025-06-04 19:06:55.000', '2025-06-04 19:06:56.000'); -INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") VALUES (12, '风扇关闭的温度设置', 'fan_stop_temperature', '110.0', '2025-06-04 19:06:55.000', '2025-06-04 19:06:56.000'); -INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") VALUES (13, '开机是否预充', 'pre_fill_when_open_service', 'true', '2025-06-04 19:06:55.000', '2025-06-04 19:06:56.000'); -INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") VALUES (14, '开机预充距离', 'pre_fill_distance_when_open_service', '3.0', '2025-06-04 19:06:55.000', '2025-06-04 19:06:56.000'); -INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") VALUES (15, 'z轴进入卡槽的速度 标准50 最大100', 'z_move_in_low_speed', '30.0', '2025-06-04 19:06:55.000', '2025-06-04 19:06:56.000'); -INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") VALUES (16, 'z轴正常移动速度 标准100', 'z_move_in_normal_speed', '100.0', '2025-06-04 19:06:55.000', '2025-06-04 19:06:56.000'); - +INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") +VALUES (1, '水加液系数', 'water', '2.0', '2025-06-07 10:58:06.000', '2025-06-07 10:58:07.000'); +INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") +VALUES (2, '浓硝酸加液系数', 'thick', '2.0', '2025-05-28 13:30:45', '2025-05-28 13:30:45'); +INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") +VALUES (3, '稀硝酸加液系数', 'thin', '2.0', '2025-05-28 13:30:45', '2025-05-28 13:30:45'); +INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") +VALUES (4, '回吸放滴落距离', 'back_flow_distance', '0.1', '2025-05-28 13:30:45', '2025-05-28 13:30:45'); +INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") +VALUES (5, '过量预充距离', 'pre_fill_distance', '17.0', '2025-05-28 13:30:45', '2025-05-28 13:30:45'); +INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") +VALUES (6, '过量排空距离', 'drain_distance', '17.0', '2025-05-28 13:30:45', '2025-05-28 13:30:45'); +INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") +VALUES (7, '过量抽液距离', 'number_reduce', '7.0', '2025-05-28 13:30:45', '2025-05-28 13:30:45'); +INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") +VALUES (8, '允许的最大清洁次数', 'cycle_clean_max', '5', '2025-05-28 13:30:45', '2025-05-28 13:30:45'); +INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") +VALUES (9, '蠕动泵最大转速限制', 'liquid_max_speed', '150', '2025-05-28 13:30:45', '2025-05-28 13:30:45'); +INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") +VALUES (10, '忽略门自检', 'door_origin_is_ignore', 'true', '2025-05-29T14:23:48', '2025-05-29T14:23:48'); +INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") +VALUES (11, '工艺结束蜂鸣器次数', 'crafts_end_beep_times', '3', '2025-06-04 19:06:55.000', '2025-06-04 19:06:56.000'); +INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") +VALUES (12, '风扇关闭的温度设置', 'fan_stop_temperature', '110.0', '2025-06-04 19:06:55.000', + '2025-06-04 19:06:56.000'); +INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") +VALUES (13, '开机是否预充', 'pre_fill_when_open_service', 'true', '2025-06-04 19:06:55.000', '2025-06-04 19:06:56.000'); +INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") +VALUES (14, '开机预充距离', 'pre_fill_distance_when_open_service', '3.0', '2025-06-04 19:06:55.000', + '2025-06-04 19:06:56.000'); +INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") +VALUES (15, 'x轴进入卡槽的速度 标准50 最大100', 'x_move_in_low_speed', '30.0', '2025-06-04 19:06:55.000', + '2025-06-04 19:06:56.000'); +INSERT OR IGNORE INTO system_config ("id", "name", "code", "value", "create_time", "update_time") +VALUES (16, 'x轴正常移动速度 标准100', 'x_move_in_normal_speed', '100.0', '2025-06-04 19:06:55.000', + '2025-06-04 19:06:56.000'); -- 系统日志 表 @@ -92,10 +103,10 @@ CREATE TABLE IF NOT EXISTS crafts id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR NOT NULL, steps TEXT, - ores_id INTEGER, create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); + -- crafts_monitor 工艺执行表 CREATE TABLE IF NOT EXISTS craft_monitor (