| src/main/java/com/zy/asrs/controller/OpenController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/webapp/views/index.html | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/zy/asrs/controller/OpenController.java
@@ -14,8 +14,12 @@ import com.zy.common.annotations.OpenApiLog; import com.zy.common.service.CommonService; import com.zy.core.enums.WrkIoType; import com.zy.system.entity.Config; import com.zy.system.service.ConfigService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; @@ -28,6 +32,8 @@ @RequestMapping("/openapi") public class OpenController { @Value("${mainProcessPlugin}") private String mainProcessPlugin; @Autowired private CommonService commonService; @Autowired @@ -38,6 +44,8 @@ private LocMastService locMastService; @Autowired private WrkMastService wrkMastService; @Autowired private ConfigService configService; //移库任务 @PostMapping("/createLocMoveTask") @@ -327,4 +335,44 @@ return R.ok(); } @GetMapping("/getFakeSystemRunStatus") public R getFakeSystemRunStatus() { HashMap<String, Object> map = new HashMap<>(); if(mainProcessPlugin.equals("FakeProcess")) { map.put("running", false); map.put("isFake", true); Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "enableFake")); if(config != null) { if(config.getValue().equals("Y")) { map.put("running", true); } } } else { map.put("isFake", false); } return R.ok().add(map); } @PostMapping("/startFakeSystem") @OpenApiLog(memo = "启动仿真模拟") public R startFakeSystem() { Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "enableFake")); if(config != null) { config.setValue("Y"); configService.updateById(config); } return R.ok(); } @PostMapping("/stopFakeSystem") @OpenApiLog(memo = "停止仿真模拟") public R stopFakeSystem() { Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "enableFake")); if(config != null) { config.setValue("N"); configService.updateById(config); } return R.ok(); } } src/main/webapp/views/index.html
@@ -43,6 +43,9 @@ <!-- <li class="layui-nav-item" lay-unselect>--> <!-- <a ew-event="note" title="便签"><i class="layui-icon layui-icon-note"></i></a>--> <!-- </li>--> <li class="layui-nav-item" lay-unselect id="fakeShow" style="display: none;user-select: none;"> <div style="color: red;" id="fakeShowText">仿真模拟运行中</div> </li> <li class="layui-nav-item" lay-unselect id="licenseShow" style="display: none;user-select: none;"> <div style="color: red;">许可证有效期:<span id="licenseDays">29</span>天</div> </li> @@ -120,6 +123,71 @@ } } let fakeRunning = false setInterval(function () { $.ajax({ url: baseUrl + "/openapi/getFakeSystemRunStatus", headers: {'token': localStorage.getItem('token')}, method: 'GET', success: function (res) { if (res.code === 200) { if(res.data.isFake) { $("#fakeShow").show() let running = res.data.running if (running) { $("#fakeShowText").text("仿真模拟运行中") } else { $("#fakeShowText").text("仿真模拟未运行") } fakeRunning = running }else { $("#fakeShow").hide() } }else { top.location.href = baseUrl + "/login"; } } }); }, 1000); $("#fakeShow").on("click", function () { if (fakeRunning) { layer.confirm('确定要停止仿真模拟吗?', function (index) { layer.close(index); $.ajax({ url: baseUrl + "/openapi/stopFakeSystem", headers: {'token': localStorage.getItem('token')}, method: 'POST', success: function (res) { if (res.code === 200) { layer.msg("仿真模拟已停止", {icon: 1}); $("#fakeShowText").text("仿真模拟未运行") } else { layer.msg(res.msg, {icon: 2}); } } }); }); } else { layer.confirm('确定要启动仿真模拟吗?', function (index) { layer.close(index); $.ajax({ url: baseUrl + "/openapi/startFakeSystem", headers: {'token': localStorage.getItem('token')}, method: 'POST', success: function (res) { if (res.code === 200) { layer.msg("仿真模拟已启动", {icon: 1}); $("#fakeShowText").text("仿真模拟运行中") } else { layer.msg(res.msg, {icon: 2}); } } }); }); } }); $.ajax({ url: baseUrl + "/menu/auth", headers: {'token': localStorage.getItem('token')},