From aa221b6b6c3939130c78e4219207d14ce877ff30 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期三, 06 八月 2025 15:57:34 +0800
Subject: [PATCH] 1
---
src/main/java/com/zy/asrs/controller/AgvBasDevpController.java | 214 ++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 187 insertions(+), 27 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/AgvBasDevpController.java b/src/main/java/com/zy/asrs/controller/AgvBasDevpController.java
index c2f2115..a1d9d75 100644
--- a/src/main/java/com/zy/asrs/controller/AgvBasDevpController.java
+++ b/src/main/java/com/zy/asrs/controller/AgvBasDevpController.java
@@ -10,10 +10,11 @@
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.R;
-import com.zy.asrs.entity.AgvBasDevp;
-import com.zy.asrs.entity.BasDevp;
+import com.core.exception.CoolException;
+import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.LocMastInitParam;
-import com.zy.asrs.service.AgvBasDevpService;
+import com.zy.asrs.service.*;
+import com.zy.asrs.utils.CodeDetectionUtil;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -26,18 +27,30 @@
@Autowired
AgvBasDevpService agvBasDevpService;
+ @Autowired
+ AgvWrkMastService agvWrkMastService;
+ @Autowired
+ AgvWrkDetlService agvWrkDetlService;
+ @Autowired
+ AgvWaitPakinService agvWaitPakinService;
+ @Autowired
+ AgvWorkService agvWorkService;
+ @Autowired
+ AgvLocDetlService agvLocDetlService;
@RequestMapping(value = "/basDevp/list/auth")
@ManagerAuth
- public R list(@RequestParam(defaultValue = "1")Integer curr,
- @RequestParam(defaultValue = "10")Integer limit,
- @RequestParam(required = false)String orderByField,
- @RequestParam(required = false)String orderByType,
- @RequestParam Map<String, Object> param){
+ public R list(@RequestParam(defaultValue = "1") Integer curr,
+ @RequestParam(defaultValue = "10") Integer limit,
+ @RequestParam(required = false) String orderByField,
+ @RequestParam(required = false) String orderByType,
+ @RequestParam Map<String, Object> param) {
excludeTrash(param);
EntityWrapper<AgvBasDevp> wrapper = new EntityWrapper<>();
convert(param, wrapper);
- if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
+ if (!Cools.isEmpty(orderByField)) {
+ wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));
+ }
return R.ok(agvBasDevpService.selectPage(new Page<>(curr, limit), wrapper));
}
@@ -57,7 +70,7 @@
@ManagerAuth
public R query(@RequestBody JSONObject param) {
Wrapper<AgvBasDevp> wrapper = new EntityWrapper<AgvBasDevp>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val"));
- if (null != agvBasDevpService.selectOne(wrapper)){
+ if (null != agvBasDevpService.selectOne(wrapper)) {
return R.parse(BaseRes.REPEAT).add(getComment(BasDevp.class, String.valueOf(param.get("key"))));
}
return R.ok();
@@ -71,9 +84,9 @@
@RequestMapping(value = "/basDevp/update/auth")
@ManagerAuth(memo = "绔欑偣淇敼")
- public R update(AgvBasDevp basDevp){
- if (Cools.isEmpty(basDevp) || null==basDevp.getDevNo()){
- return R.error();
+ public R update(AgvBasDevp basDevp) {
+ if (Cools.isEmpty(basDevp) || null == basDevp.getDevNo()) {
+ return R.error("鍙傛暟缂哄け");
}
basDevp.setModiUser(getUserId());
basDevp.setModiTime(new Date());
@@ -83,12 +96,12 @@
@RequestMapping(value = "/basDevp/delete/auth")
@ManagerAuth(memo = "绔欑偣鍒犻櫎")
- public R delete(@RequestParam String param){
+ public R delete(@RequestParam String param) {
List<AgvBasDevp> list = JSONArray.parseArray(param, AgvBasDevp.class);
- if (Cools.isEmpty(list)){
- return R.error();
+ if (Cools.isEmpty(list)) {
+ return R.error("鍙傛暟缂哄け");
}
- for (AgvBasDevp entity : list){
+ for (AgvBasDevp entity : list) {
agvBasDevpService.delete(new EntityWrapper<>(entity));
}
return R.ok();
@@ -96,23 +109,26 @@
@RequestMapping(value = "/basDevp/unbind/auth")
@ManagerAuth(memo = "绔欑偣瑙g粦")
- public R unbind(@RequestParam String param){
- AgvBasDevp agvBasDevp = JSONArray.parseObject(param,AgvBasDevp.class);
-
+ public R unbind(@RequestParam String param) {
+ AgvBasDevp agvBasDevp = JSONArray.parseObject(param, AgvBasDevp.class);
+ if (agvBasDevp == null) {
+ return R.error("鍙傛暟缂哄け");
+ }
//鑻ュ綋鍓嶇珯鐐硅揣浣嶇姸鎬佷笉涓篎.鍦ㄥ簱鐘舵�侊紝鍒欒繑鍥為敊璇�
- if(!agvBasDevp.getLocSts().equals("F")){
+ if (!agvBasDevp.getLocSts().equals("F")) {
return R.error("褰撳墠绔欑偣璐т綅鐘舵�佷笉涓哄湪搴擄紝鏃犳硶瑙i櫎缁戝畾");
}
agvBasDevp.setLocSts("O");
agvBasDevp.setBarcode("");
- agvBasDevpService.update(agvBasDevp,new EntityWrapper<AgvBasDevp>().eq("dev_no",agvBasDevp.getDevNo()));
+ agvBasDevp.setLocType2(null);
+ agvBasDevpService.update(agvBasDevp, new EntityWrapper<AgvBasDevp>().eq("dev_no", agvBasDevp.getDevNo()));
return R.ok();
}
@RequestMapping(value = "/basDevp/export/auth")
@ManagerAuth(memo = "绔欑偣瀵煎嚭")
- public R export(@RequestBody JSONObject param){
+ public R export(@RequestBody JSONObject param) {
List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
EntityWrapper<AgvBasDevp> wrapper = new EntityWrapper<>();
Map<String, Object> map = excludeTrash(param.getJSONObject("basDevp"));
@@ -128,7 +144,7 @@
wrapper.like("dev_no", condition);
Page<AgvBasDevp> page = agvBasDevpService.selectPage(new Page<>(0, 10), wrapper);
List<Map<String, Object>> result = new ArrayList<>();
- for (AgvBasDevp basDevp : page.getRecords()){
+ for (AgvBasDevp basDevp : page.getRecords()) {
Map<String, Object> map = new HashMap<>();
map.put("id", basDevp.getDevNo());
map.put("value", basDevp.getDevNo());
@@ -148,10 +164,154 @@
return R.ok();
}
- private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){
- for (Map.Entry<String, Object> entry : map.entrySet()){
+ /*
+ 绔欑偣鏄庣粏
+ */
+ @RequestMapping(value = "/basDevp/detail/list/auth")
+ public R basDevpDetailList(@RequestParam(defaultValue = "1") Integer curr,
+ @RequestParam(defaultValue = "10") Integer limit,
+ @RequestParam Map<String, Object> param) {
+ String devNo = param.get("devNo").toString();
+ if (Cools.isEmpty(devNo) || !CodeDetectionUtil.carCodeDetection(devNo)) {
+ throw new CoolException(devNo + "灏忚溅鍦扮爜鏈夎锛岃姝g‘鎵爜锛侊紒锛�");
+ }
+ AgvBasDevp agvBasDevp = agvBasDevpService.selectById(devNo);
+ if ("F".equals(agvBasDevp.getLocSts()) || "R".equals(agvBasDevp.getLocSts())) {
+ //鍏堝幓鍏ュ簱閫氱煡妗f壘鏄庣粏
+ Page<AgvWaitPakin> agvWaitPakinPage = agvWaitPakinService.selectPage(new Page<>(curr, limit), new EntityWrapper<AgvWaitPakin>()
+ .eq("supp_code", agvBasDevp.getBarcode()));
+ if (agvWaitPakinPage.getRecords().size() > 0) {
+ return R.ok(agvWaitPakinPage);
+ } else {
+ //濡傛灉鍏ュ簱閫氭。鏄庣粏涓虹┖锛屽垯鍘诲伐浣滄。鎵炬槑缁�
+ AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>()
+ .eq("loc_no", agvBasDevp.getDevNo())
+ .or().eq("source_loc_no", agvBasDevp.getDevNo()));
+ if (Cools.isEmpty(agvWrkMast)) {
+ Page<AgvLocDetl> agvLocDetlPage = agvLocDetlService.selectPage(new Page<>(curr, limit), new EntityWrapper<AgvLocDetl>()
+ .eq("supp_code", agvBasDevp.getBarcode()));
+ if (agvLocDetlPage.getRecords().size() > 0) {
+ return R.ok(agvLocDetlPage);
+ } else {
+ return R.error("褰撳墠璐ф灦鐮佸紓甯革紒");
+ }
+ }
+
+ Page<AgvWrkDetl> agvWrkDetlPage = agvWrkDetlService.selectPage(new Page<>(curr, limit), new EntityWrapper<AgvWrkDetl>()
+ .eq("wrk_no", agvWrkMast.getWrkNo()));
+
+ if (agvWrkDetlPage.getRecords().size() > 0) {
+ return R.ok(agvWrkDetlPage);
+ }
+ }
+ }
+
+ return R.ok();
+ }
+
+ @RequestMapping(value = "/basDevp/visualized/list/auth")
+ public R visualizedList(@RequestBody JSONObject param) {
+
+ String stationCode = param.get("stationCode").toString();
+
+ Map<String, Object> result = agvBasDevpService.getAgvBasDevpDtoByStationCode(stationCode);
+
+ return R.ok(result);
+ }
+
+ @RequestMapping(value = "/basDevp/visualized/list/auth/v2")
+ public R visualizedList(@RequestParam String stationCode) {
+
+ Map<String, Object> result = agvBasDevpService.getAgvBasDevpDtoByStationCode(stationCode);
+
+ return R.ok(result);
+ }
+
+ /*
+ 浠诲姟瀹屾垚
+ */
+ @RequestMapping(value = "/basDevp/visualized/container/moveOut")
+ @ManagerAuth(memo = "纭鍑哄簱")
+ public R visualiZedContainerMoveOut(@RequestBody Map<String, Object> map) {
+
+ String barcode = map.get("barcode").toString();
+ AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("barcode", barcode).eq("wrk_sts", 205L));
+ if (agvWrkMast == null) {
+ agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("barcode", barcode));
+ if (agvWrkMast != null && agvWrkMast.getWrkSts() != 205) {
+ return R.error("宸ヤ綔妗g姸鎬佷笉瀵�,杩樺湪鎼繍涓�");
+ }
+ return R.error("宸ヤ綔妗d笉瀛樺湪");
+ }
+ if (agvWrkMast.getIoType() != 101 && agvWrkMast.getIoType() != 110) {
+ throw new CoolException("宸ヤ綔鍙蜂负" + agvWrkMast.getWrkNo() + "绫诲瀷涓嶄负101.鍑哄簱锛屾棤娉曟墽琛岃揣鏋剁鍦轰换鍔★紝璇烽噸鏂伴�夋嫨绔欑偣銆�");
+ }
+
+ agvWrkMast.setWrkSts(206L);
+ agvWrkMast.setModiTime(new Date());
+ agvWrkMastService.updateById(agvWrkMast);
+
+ return R.ok("璐ф灦绂诲満鎴愬姛");
+ }
+
+ /*
+ 浠诲姟瀹屾垚
+ */
+ @RequestMapping(value = "/basDevp/visualized/container/moveOut2")
+ @ManagerAuth(memo = "纭鍑哄簱2")
+ public R visualiZedContainerMoveOut2(@RequestBody Map<String, Object> map) {
+
+ String barcode = map.get("barcode").toString();
+ AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("barcode", barcode).eq("wrk_sts", 205L));
+ if (agvWrkMast == null) {
+ return R.error("宸ヤ綔妗d笉瀛樺湪");
+ }
+ if (agvWrkMast.getIoType() != 101 && agvWrkMast.getIoType() != 110) {
+ throw new CoolException("宸ヤ綔鍙蜂负" + agvWrkMast.getWrkNo() + "绫诲瀷涓嶄负101.鍑哄簱锛屾棤娉曟墽琛岃揣鏋剁鍦轰换鍔★紝璇烽噸鏂伴�夋嫨绔欑偣銆�");
+ }
+
+ agvWrkMast.setWrkSts(208L);
+ agvWrkMast.setModiTime(new Date());
+ agvWrkMastService.updateById(agvWrkMast);
+
+ return R.ok("璐ф灦绂诲満鎴愬姛");
+ }
+
+ /*
+ 鎷f枡/鐩樼偣鍏ュ簱
+ */
+ @RequestMapping(value = "/basDevp/visualized/container/pickIn")
+ @ManagerAuth(memo = "宸叉嫞鏂欏洖搴�")
+ public R visualiZedPickIn(@RequestBody Map<String, Object> map) {
+ if (Cools.isEmpty(map.get("devNo"))) {
+ return R.error("绔欑偣涓嶈兘涓虹┖");
+ }
+ if (Cools.isEmpty(map.get("barcode"))) {
+ return R.error("璐ф灦鐮佷笉鑳戒负绌�");
+ }
+ List<AgvWrkMast> agvWrkMastList = new ArrayList<>();
+ String devNo = map.get("devNo").toString();
+ String barcode = map.get("barcode").toString();
+ AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("barcode", barcode).eq("loc_no", devNo).eq("wrk_sts", 205L));
+ if (agvWrkMast != null) {
+ if (agvWrkMast.getIoType() == 101) {
+ throw new CoolException("宸ヤ綔鍙蜂负" + agvWrkMast.getWrkNo() + "绫诲瀷涓�101.鍑哄簱锛屾棤娉曟墽琛屾嫞鏂欏叆搴撲换鍔★紝璇烽噸鏂伴�夋嫨绔欑偣銆�");
+ }
+ agvWrkMast.setLocNo(devNo);
+ agvWrkMastList.add(agvWrkMast);
+ agvWorkService.pickIn(agvWrkMastList);
+ } else {
+ return R.error("鏌ヤ笉鍒版嫞鏂欏嚭搴撲换鍔�");
+ }
+
+
+ return R.ok("鐢熸垚鎷f枡鍥炲簱浠诲姟鎴愬姛");
+ }
+
+ private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) {
+ for (Map.Entry<String, Object> entry : map.entrySet()) {
String val = String.valueOf(entry.getValue());
- if (val.contains(RANGE_TIME_LINK)){
+ if (val.contains(RANGE_TIME_LINK)) {
String[] dates = val.split(RANGE_TIME_LINK);
wrapper.ge(entry.getKey(), DateUtils.convert(dates[0]));
wrapper.le(entry.getKey(), DateUtils.convert(dates[1]));
--
Gitblit v1.9.1