From c6c9b7d3baa822765768c110304d27623f946286 Mon Sep 17 00:00:00 2001
From: pjb <123456>
Date: 星期二, 15 七月 2025 14:29:09 +0800
Subject: [PATCH] `1`
---
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/LocTypeBindController.java | 239 ++++++++++++++++++++++++++++++++++-------------------------
1 files changed, 137 insertions(+), 102 deletions(-)
diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/LocTypeBindController.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/LocTypeBindController.java
index 28a1350..fe990cf 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/LocTypeBindController.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/LocTypeBindController.java
@@ -1,102 +1,137 @@
-package com.zy.asrs.wms.asrs.controller;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.zy.asrs.framework.common.Cools;
-import com.zy.asrs.framework.common.R;
-import com.zy.asrs.wms.common.annotation.OperationLog;
-import com.zy.asrs.wms.common.domain.BaseParam;
-import com.zy.asrs.wms.common.domain.KeyValVo;
-import com.zy.asrs.wms.common.domain.PageParam;
-import com.zy.asrs.wms.asrs.entity.LocTypeBind;
-import com.zy.asrs.wms.asrs.service.LocTypeBindService;
-import com.zy.asrs.wms.system.controller.BaseController;
-import com.zy.asrs.wms.utils.ExcelUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-@RestController
-@RequestMapping("/api")
-public class LocTypeBindController extends BaseController {
-
- @Autowired
- private LocTypeBindService locTypeBindService;
-
- @PreAuthorize("hasAuthority('asrs:locTypeBind:list')")
- @PostMapping("/locTypeBind/page")
- public R page(@RequestBody Map<String, Object> map) {
- BaseParam baseParam = buildParam(map, BaseParam.class);
- PageParam<LocTypeBind, BaseParam> pageParam = new PageParam<>(baseParam, LocTypeBind.class);
- return R.ok().add(locTypeBindService.page(pageParam, pageParam.buildWrapper(true)));
- }
-
- @PreAuthorize("hasAuthority('asrs:locTypeBind:list')")
- @PostMapping("/locTypeBind/list")
- public R list(@RequestBody Map<String, Object> map) {
- return R.ok().add(locTypeBindService.list());
- }
-
- @PreAuthorize("hasAuthority('asrs:locTypeBind:list')")
- @GetMapping("/locTypeBind/{id}")
- public R get(@PathVariable("id") Long id) {
- return R.ok().add(locTypeBindService.getById(id));
- }
-
- @PreAuthorize("hasAuthority('asrs:locTypeBind:save')")
- @OperationLog("娣诲姞搴撲綅绫诲瀷缁戝畾")
- @PostMapping("/locTypeBind/save")
- public R save(@RequestBody LocTypeBind locTypeBind) {
- if (!locTypeBindService.save(locTypeBind)) {
- return R.error("娣诲姞澶辫触");
- }
- return R.ok("娣诲姞鎴愬姛");
- }
-
- @PreAuthorize("hasAuthority('asrs:locTypeBind:update')")
- @OperationLog("淇敼搴撲綅绫诲瀷缁戝畾")
- @PostMapping("/locTypeBind/update")
- public R update(@RequestBody LocTypeBind locTypeBind) {
- if (!locTypeBindService.updateById(locTypeBind)) {
- return R.error("淇敼澶辫触");
- }
- return R.ok("淇敼鎴愬姛");
- }
-
- @PreAuthorize("hasAuthority('asrs:locTypeBind:remove')")
- @OperationLog("鍒犻櫎搴撲綅绫诲瀷缁戝畾")
- @PostMapping("/locTypeBind/remove/{ids}")
- public R remove(@PathVariable Long[] ids) {
- if (!locTypeBindService.removeByIds(Arrays.asList(ids))) {
- return R.error("鍒犻櫎澶辫触");
- }
- return R.ok("鍒犻櫎鎴愬姛");
- }
-
- @PreAuthorize("hasAuthority('asrs:locTypeBind:list')")
- @PostMapping("/locTypeBind/query")
- public R query(@RequestParam(required = false) String condition) {
- List<KeyValVo> vos = new ArrayList<>();
- LambdaQueryWrapper<LocTypeBind> wrapper = new LambdaQueryWrapper<>();
- if (!Cools.isEmpty(condition)) {
- wrapper.like(LocTypeBind::getName, condition);
- }
- locTypeBindService.page(new Page<>(1, 30), wrapper).getRecords().forEach(
- item -> vos.add(new KeyValVo(item.getId(), item.getName()))
- );
- return R.ok().add(vos);
- }
-
- @PreAuthorize("hasAuthority('asrs:locTypeBind:list')")
- @PostMapping("/locTypeBind/export")
- public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception {
- ExcelUtil.build(ExcelUtil.create(locTypeBindService.list(), LocTypeBind.class), response);
- }
-
-}
+package com.zy.asrs.wms.asrs.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zy.asrs.framework.common.Cools;
+import com.zy.asrs.framework.common.R;
+import com.zy.asrs.wms.asrs.entity.Loc;
+import com.zy.asrs.wms.asrs.entity.enums.LocStsType;
+import com.zy.asrs.wms.asrs.entity.param.InitLocTypeBindParam;
+import com.zy.asrs.wms.asrs.service.LocService;
+import com.zy.asrs.wms.common.annotation.OperationLog;
+import com.zy.asrs.wms.common.domain.BaseParam;
+import com.zy.asrs.wms.common.domain.KeyValVo;
+import com.zy.asrs.wms.common.domain.PageParam;
+import com.zy.asrs.wms.asrs.entity.LocTypeBind;
+import com.zy.asrs.wms.asrs.service.LocTypeBindService;
+import com.zy.asrs.wms.system.controller.BaseController;
+import com.zy.asrs.wms.utils.ExcelUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/api")
+public class LocTypeBindController extends BaseController {
+
+ @Autowired
+ private LocTypeBindService locTypeBindService;
+ @Autowired
+ private LocService locService;
+
+ @PreAuthorize("hasAuthority('asrs:locTypeBind:list')")
+ @PostMapping("/locTypeBind/page")
+ public R page(@RequestBody Map<String, Object> map) {
+ BaseParam baseParam = buildParam(map, BaseParam.class);
+ PageParam<LocTypeBind, BaseParam> pageParam = new PageParam<>(baseParam, LocTypeBind.class);
+ return R.ok().add(locTypeBindService.page(pageParam, pageParam.buildWrapper(true)));
+ }
+
+ @PreAuthorize("hasAuthority('asrs:locTypeBind:list')")
+ @PostMapping("/locTypeBind/list")
+ public R list(@RequestBody Map<String, Object> map) {
+ return R.ok().add(locTypeBindService.list());
+ }
+
+ @PreAuthorize("hasAuthority('asrs:locTypeBind:list')")
+ @GetMapping("/locTypeBind/{id}")
+ public R get(@PathVariable("id") Long id) {
+ return R.ok().add(locTypeBindService.getById(id));
+ }
+
+ @PreAuthorize("hasAuthority('asrs:locTypeBind:save')")
+ @OperationLog("鍒濆鍖栧簱浣嶇被鍨嬬粦瀹�")
+ @PostMapping("/locTypeBind/init")
+ @Transactional
+ public R init(@RequestBody InitLocTypeBindParam param) {
+ LambdaQueryWrapper<Loc> queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.ge(Loc::getRow1, param.getStartRow());
+ queryWrapper.le(Loc::getRow1, param.getTargetRow());
+ queryWrapper.ge(Loc::getBay1, param.getStartBay());
+ queryWrapper.le(Loc::getBay1, param.getTargetBay());
+ queryWrapper.ge(Loc::getLev1, param.getStartLev());
+ queryWrapper.le(Loc::getLev1, param.getTargetLev());
+
+ List<Loc> list = locService.list(queryWrapper);
+ if (list.isEmpty()) {
+ return R.error("鏈壘鍒板簱浣嶄俊鎭�");
+ }
+
+ for (Loc loc : list) {
+ LocTypeBind locTypeBind = new LocTypeBind();
+ locTypeBind.setLocId(loc.getId());
+ locTypeBind.setTypeId(param.getTypeId());
+ locTypeBindService.save(locTypeBind);
+ }
+
+ return R.ok("鍒濆鍖栨垚鍔�");
+ }
+
+ @PreAuthorize("hasAuthority('asrs:locTypeBind:save')")
+ @OperationLog("娣诲姞搴撲綅绫诲瀷缁戝畾")
+ @PostMapping("/locTypeBind/save")
+ public R save(@RequestBody LocTypeBind locTypeBind) {
+ if (!locTypeBindService.save(locTypeBind)) {
+ return R.error("娣诲姞澶辫触");
+ }
+ return R.ok("娣诲姞鎴愬姛");
+ }
+
+ @PreAuthorize("hasAuthority('asrs:locTypeBind:update')")
+ @OperationLog("淇敼搴撲綅绫诲瀷缁戝畾")
+ @PostMapping("/locTypeBind/update")
+ public R update(@RequestBody LocTypeBind locTypeBind) {
+ if (!locTypeBindService.updateById(locTypeBind)) {
+ return R.error("淇敼澶辫触");
+ }
+ return R.ok("淇敼鎴愬姛");
+ }
+
+ @PreAuthorize("hasAuthority('asrs:locTypeBind:remove')")
+ @OperationLog("鍒犻櫎搴撲綅绫诲瀷缁戝畾")
+ @PostMapping("/locTypeBind/remove/{ids}")
+ public R remove(@PathVariable Long[] ids) {
+ if (!locTypeBindService.removeByIds(Arrays.asList(ids))) {
+ return R.error("鍒犻櫎澶辫触");
+ }
+ return R.ok("鍒犻櫎鎴愬姛");
+ }
+
+ @PreAuthorize("hasAuthority('asrs:locTypeBind:list')")
+ @PostMapping("/locTypeBind/query")
+ public R query(@RequestParam(required = false) String condition) {
+ List<KeyValVo> vos = new ArrayList<>();
+ LambdaQueryWrapper<LocTypeBind> wrapper = new LambdaQueryWrapper<>();
+ if (!Cools.isEmpty(condition)) {
+ wrapper.like(LocTypeBind::getName, condition);
+ }
+ locTypeBindService.page(new Page<>(1, 30), wrapper).getRecords().forEach(
+ item -> vos.add(new KeyValVo(item.getId(), item.getName()))
+ );
+ return R.ok().add(vos);
+ }
+
+ @PreAuthorize("hasAuthority('asrs:locTypeBind:list')")
+ @PostMapping("/locTypeBind/export")
+ public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception {
+ ExcelUtil.build(ExcelUtil.create(locTypeBindService.list(), LocTypeBind.class), response);
+ }
+
+}
--
Gitblit v1.9.1