Merge remote-tracking branch 'origin/main'
# Conflicts: # ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java # ruoyi-admin/src/main/java/com/ruoyi/api/service/IApiService.java # ruoyi-admin/src/main/java/com/ruoyi/api/service/impl/ApiServiceImpl.java # ruoyi-admin/src/main/java/com/ruoyi/job/mapper/MydoJobMapper.java # ruoyi-admin/src/main/java/com/ruoyi/job/service/IMydoJobService.java # ruoyi-admin/src/main/java/com/ruoyi/job/service/impl/MydoJobServiceImpl.java # ruoyi-admin/src/main/java/com/ruoyi/queue/srgv/mapper/WcsSrgvQueueMapper.java # ruoyi-admin/src/main/java/com/ruoyi/queue/srgv/service/impl/WcsSrgvQueueServiceImpl.java # ruoyi-admin/src/main/java/com/ruoyi/schedule/plcRead/ssj/PlcSsjRead.java # ruoyi-admin/src/main/java/com/ruoyi/schedule/scheduleTask/cdz/CdzThread.java # ruoyi-admin/src/main/java/com/ruoyi/schedule/scheduleTask/srgv/BaseSRgvThread.java # ruoyi-admin/src/main/java/com/ruoyi/schedule/scheduleTask/ssj/SsjThread.java # ruoyi-admin/src/main/resources/mapper/device/DeviceSrgvMapper.xml # ruoyi-admin/src/main/resources/mapper/job/MydoJobMapper.xml # ruoyi-admin/src/main/resources/mapper/queue/WcsSrgvQueueMapper.xml
This commit is contained in:
21
ruoyi-admin/src/main/java/com/ruoyi/MyStartupRunner.java
Normal file
21
ruoyi-admin/src/main/java/com/ruoyi/MyStartupRunner.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.ruoyi;
|
||||
|
||||
import com.ruoyi.schedule.ScheduleThread;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class MyStartupRunner implements CommandLineRunner {
|
||||
|
||||
@Autowired
|
||||
private ScheduleThread scheduleThread;
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
// 这里编写项目启动后要执行的方法逻辑
|
||||
//System.out.println("项目启动成功后自动执行此方法");
|
||||
// scheduleThread.startAllThread();
|
||||
// scheduleThread.startAllThread2();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ruoyi.algorithm.controller;
|
||||
|
||||
import java.util.Map;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
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.algorithm.service.ITidyService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/algorithm/tidy")
|
||||
public class TidyController {
|
||||
@Autowired
|
||||
private ITidyService tidyService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('algorithm:tidy:query')")
|
||||
@GetMapping("/status")
|
||||
public AjaxResult status() { return AjaxResult.success(tidyService.getStatus()); }
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('algorithm:tidy:edit')")
|
||||
@PutMapping("/mode")
|
||||
public AjaxResult mode(@RequestBody Map<String, String> body) {
|
||||
try { return AjaxResult.success(tidyService.updateMode(body == null ? null : body.get("mode"))); }
|
||||
catch (IllegalArgumentException ex) { return AjaxResult.error(ex.getMessage()); }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ruoyi.algorithm.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface ITidyService {
|
||||
Map<String, Object> getStatus();
|
||||
Map<String, Object> updateMode(String mode);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.ruoyi.algorithm.service.impl;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.algorithm.service.ITidyService;
|
||||
|
||||
@Service
|
||||
public class TidyServiceImpl implements ITidyService {
|
||||
private final AtomicReference<String> mode = new AtomicReference<>("AUTO");
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getStatus() {
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
result.put("mode", mode.get());
|
||||
result.put("enabled", true);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> updateMode(String requestedMode) {
|
||||
if (requestedMode == null || !("AUTO".equalsIgnoreCase(requestedMode) || "MANUAL".equalsIgnoreCase(requestedMode))) {
|
||||
throw new IllegalArgumentException("mode must be AUTO or MANUAL");
|
||||
}
|
||||
mode.set(requestedMode.toUpperCase());
|
||||
return getStatus();
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,13 @@ public class Wcs2WmsController {
|
||||
return apiService.cancelMydoJob(jobParam);
|
||||
}
|
||||
|
||||
/** Return a read-only snapshot of all S-RGV vehicles. */
|
||||
@PostMapping("/tidyVehicleSnapshot")
|
||||
public AjaxResult tidyVehicleSnapshot() {
|
||||
return apiService.tidyVehicleSnapshot();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.ruoyi.api.domain.wcs2wms;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/** Read-only vehicle status snapshot exposed to WMS. */
|
||||
@Data
|
||||
public class SrgvVehicleSnapshot {
|
||||
private String guid;
|
||||
private Integer deviceId;
|
||||
private String deviceName;
|
||||
private String agvStatus;
|
||||
private Boolean online;
|
||||
private Boolean healthy;
|
||||
private Boolean idle;
|
||||
private Integer taskNo;
|
||||
private Integer alarm;
|
||||
private Integer errMsg;
|
||||
private Integer chargeFlag;
|
||||
private Integer locked;
|
||||
private Integer battery;
|
||||
private String currSite;
|
||||
private Integer currFloor;
|
||||
}
|
||||
@@ -6,9 +6,9 @@ spring:
|
||||
druid:
|
||||
#主数据信息
|
||||
master:
|
||||
url: jdbc:sqlserver://127.0.0.1:1433;databaseName=FT546-WCS;
|
||||
url: jdbc:sqlserver://127.0.0.1:1433;databaseName=FT546-wcs;
|
||||
username: sa
|
||||
password: 123456
|
||||
password: Flrd0914.
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
|
||||
9
ruoyi-ui/src/api/algorithm/tidy.js
Normal file
9
ruoyi-ui/src/api/algorithm/tidy.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getTidyStatus() {
|
||||
return request({ url: '/algorithm/tidy/status', method: 'get' })
|
||||
}
|
||||
|
||||
export function updateTidyMode(mode) {
|
||||
return request({ url: '/algorithm/tidy/mode', method: 'put', data: { mode } })
|
||||
}
|
||||
33
ruoyi-ui/src/views/algorithm/tidy/index.vue
Normal file
33
ruoyi-ui/src/views/algorithm/tidy/index.vue
Normal file
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<div class="app-container tidy-page">
|
||||
<el-card>
|
||||
<div slot="header"><span>理货控制</span></div>
|
||||
<el-switch v-model="manual" active-text="手动理货" inactive-text="自动理货" :disabled="loading || !hasEdit" @change="changeMode" />
|
||||
<span class="mode-status">当前模式:{{ modeLabel }}</span>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getTidyStatus, updateTidyMode } from '@/api/algorithm/tidy'
|
||||
|
||||
export default {
|
||||
name: 'TidyControl',
|
||||
data() { return { manual: false, mode: 'AUTO', loading: false, timer: null, hasEdit: this.$auth.hasPermi('algorithm:tidy:edit') } },
|
||||
computed: { modeLabel() { return this.mode === 'MANUAL' ? '手动' : '自动' } },
|
||||
created() { this.refresh(); this.timer = setInterval(this.refresh, 5000) },
|
||||
beforeDestroy() { if (this.timer) { clearInterval(this.timer); this.timer = null } },
|
||||
methods: {
|
||||
refresh() { getTidyStatus().then(res => { const data = res.data || {}; this.mode = data.mode || 'AUTO'; this.manual = this.mode === 'MANUAL' }).catch(() => {}) },
|
||||
changeMode(value) {
|
||||
const previous = this.mode
|
||||
this.loading = true
|
||||
updateTidyMode(value ? 'MANUAL' : 'AUTO').then(res => { const data = res.data || {}; this.mode = data.mode || (value ? 'MANUAL' : 'AUTO') }).catch(() => { this.manual = previous === 'MANUAL'; this.$message.error('理货模式切换失败') }).finally(() => { this.loading = false })
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.mode-status { margin-left: 16px; color: #606266; }
|
||||
</style>
|
||||
@@ -18,6 +18,7 @@ module.exports = {
|
||||
outputDir: 'dist',
|
||||
assetsDir: 'static',
|
||||
productionSourceMap: false,
|
||||
parallel: false,
|
||||
transpileDependencies: ['quill'],
|
||||
devServer: {
|
||||
host: '0.0.0.0',
|
||||
|
||||
Reference in New Issue
Block a user