From 19674bf7bc725aabc28f9cf14cad0bf8a789ff23 Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期三, 07 一月 2026 15:47:47 +0800
Subject: [PATCH] 台机与库位绑定关系
---
src/main/java/com/zy/asrs/entity/LocAroundBind.java | 5
src/main/java/com/zy/asrs/service/impl/LocAroundBindServiceImpl.java | 73 ++++++++++++
src/main/webapp/views/locAroundBind/locAroundBind.html | 101 ++++++----------
src/main/java/com/zy/asrs/entity/param/InitDeviceLocParams.java | 36 ++++++
src/main/java/com/zy/asrs/service/LocAroundBindService.java | 4
src/main/webapp/static/js/locAroundBind/locAroundBind.js | 31 ++++
src/main/webapp/static/js/locCache/locCache.js | 3
src/main/java/com/zy/asrs/controller/LocAroundBindController.java | 91 ++++++++++++---
8 files changed, 253 insertions(+), 91 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/LocAroundBindController.java b/src/main/java/com/zy/asrs/controller/LocAroundBindController.java
index e870bec..f998722 100644
--- a/src/main/java/com/zy/asrs/controller/LocAroundBindController.java
+++ b/src/main/java/com/zy/asrs/controller/LocAroundBindController.java
@@ -7,6 +7,8 @@
import com.baomidou.mybatisplus.plugins.Page;
import com.core.common.DateUtils;
import com.zy.asrs.entity.LocAroundBind;
+import com.zy.asrs.entity.LocCache;
+import com.zy.asrs.entity.param.InitDeviceLocParams;
import com.zy.asrs.service.LocAroundBindService;
import com.core.annotations.ManagerAuth;
import com.core.common.BaseRes;
@@ -32,22 +34,26 @@
@RequestMapping(value = "/locAroundBind/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(required = false) String condition,
+ @RequestParam Map<String, Object> param) {
EntityWrapper<LocAroundBind> wrapper = new EntityWrapper<>();
excludeTrash(param);
convert(param, wrapper);
- if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
+ allLike(LocAroundBind.class, param.keySet(), wrapper, condition);
+ if (!Cools.isEmpty(orderByField)) {
+ wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));
+ }
return R.ok(locAroundBindService.selectPage(new Page<>(curr, limit), wrapper));
}
- private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){
- for (Map.Entry<String, Object> entry : map.entrySet()){
+ 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]));
@@ -64,10 +70,10 @@
return R.ok();
}
- @RequestMapping(value = "/locAroundBind/update/auth")
- @ManagerAuth
- public R update(LocAroundBind locAroundBind){
- if (Cools.isEmpty(locAroundBind) || null==locAroundBind.getId()){
+ @RequestMapping(value = "/locAroundBind/update/auth")
+ @ManagerAuth
+ public R update(LocAroundBind locAroundBind) {
+ if (Cools.isEmpty(locAroundBind) || null == locAroundBind.getId()) {
return R.error();
}
locAroundBindService.updateById(locAroundBind);
@@ -76,8 +82,8 @@
@RequestMapping(value = "/locAroundBind/delete/auth")
@ManagerAuth
- public R delete(@RequestParam(value="ids[]") Long[] ids){
- for (Long id : ids){
+ public R delete(@RequestParam(value = "ids[]") Long[] ids) {
+ for (Long id : ids) {
locAroundBindService.deleteById(id);
}
return R.ok();
@@ -85,7 +91,7 @@
@RequestMapping(value = "/locAroundBind/export/auth")
@ManagerAuth
- public R export(@RequestBody JSONObject param){
+ public R export(@RequestBody JSONObject param) {
EntityWrapper<LocAroundBind> wrapper = new EntityWrapper<>();
List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
Map<String, Object> map = excludeTrash(param.getJSONObject("locAroundBind"));
@@ -101,7 +107,7 @@
wrapper.like("id", condition);
Page<LocAroundBind> page = locAroundBindService.selectPage(new Page<>(0, 10), wrapper);
List<Map<String, Object>> result = new ArrayList<>();
- for (LocAroundBind locAroundBind : page.getRecords()){
+ for (LocAroundBind locAroundBind : page.getRecords()) {
Map<String, Object> map = new HashMap<>();
map.put("id", locAroundBind.getId());
map.put("value", locAroundBind.getId());
@@ -113,11 +119,58 @@
@RequestMapping(value = "/locAroundBind/check/column/auth")
@ManagerAuth
public R query(@RequestBody JSONObject param) {
- Wrapper<LocAroundBind> wrapper = new EntityWrapper<LocAroundBind>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val"));
- if (null != locAroundBindService.selectOne(wrapper)){
+ Wrapper<LocAroundBind> wrapper = new EntityWrapper<LocAroundBind>()
+ .eq(humpToLine(String.valueOf(param.get("key"))), param.get("val"));
+ if (null != locAroundBindService.selectOne(wrapper)) {
return R.parse(BaseRes.REPEAT).add(getComment(LocAroundBind.class, String.valueOf(param.get("key"))));
}
return R.ok();
}
+ /**
+ * 鍙版満缁戝畾浣滀笟搴撲綅
+ *
+ * @param locAroundBind
+ * @return
+ */
+ @ManagerAuth
+ @PostMapping(value = "/locAroundBind/bind/init")
+ public R bind(@RequestBody InitDeviceLocParams params) {
+ if (Cools.isEmpty(params)) {
+ return R.error("鍙傛暟涓嶈兘涓虹┖");
+ }
+ if (Cools.isEmpty(params.getDevNo())) {
+ return R.error("鍙版満鍙蜂笉鑳戒负绌�");
+ }
+ if (Cools.isEmpty(params.getStartRow())) {
+ return R.error("璧峰鎺掍笉鑳戒负绌�");
+ }
+ if (Cools.isEmpty(params.getEndRow())) {
+ return R.error("缁堟鎺掍笉鑳戒负绌�");
+ }
+ if (Cools.isEmpty(params.getStartBay())) {
+ return R.error("璧峰鍒椾笉鑳戒负绌�");
+ }
+ if (Cools.isEmpty(params.getEndBay())) {
+ return R.error("缁堟鍒椾笉鑳戒负绌�");
+ }
+ if (Cools.isEmpty(params.getStartLev())) {
+ return R.error("璧峰灞備笉鑳戒负绌�");
+ }
+ if (Cools.isEmpty(params.getEndLev())) {
+ return R.error("缁堟灞備笉鑳戒负绌�");
+ }
+ if (params.getStartRow() > params.getEndRow()) {
+ return R.error("璧峰鎺掍笉鑳藉ぇ浜庣粓姝㈡帓");
+ }
+ if (params.getStartBay() > params.getEndBay()) {
+ return R.error("璧峰鍒椾笉鑳藉ぇ浜庣粓姝㈠垪");
+ }
+ if (params.getStartLev() > params.getEndLev()) {
+ return R.error("璧峰灞備笉鑳藉ぇ浜庣粓姝㈠眰");
+ }
+
+ return locAroundBindService.bindLocs(params);
+ }
+
}
diff --git a/src/main/java/com/zy/asrs/entity/LocAroundBind.java b/src/main/java/com/zy/asrs/entity/LocAroundBind.java
index 3fd519a..77f9731 100644
--- a/src/main/java/com/zy/asrs/entity/LocAroundBind.java
+++ b/src/main/java/com/zy/asrs/entity/LocAroundBind.java
@@ -1,5 +1,7 @@
package com.zy.asrs.entity;
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.enums.IdType;
import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableField;
import io.swagger.annotations.ApiModelProperty;
@@ -13,7 +15,8 @@
private static final long serialVersionUID = 1L;
- @ApiModelProperty(value= "")
+ @ApiModelProperty(value= "ID")
+ @TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
diff --git a/src/main/java/com/zy/asrs/entity/param/InitDeviceLocParams.java b/src/main/java/com/zy/asrs/entity/param/InitDeviceLocParams.java
new file mode 100644
index 0000000..e5a67e5
--- /dev/null
+++ b/src/main/java/com/zy/asrs/entity/param/InitDeviceLocParams.java
@@ -0,0 +1,36 @@
+package com.zy.asrs.entity.param;
+
+import java.io.Serializable;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+import io.swagger.annotations.ApiModel;
+
+@Data
+@ApiModel(value = "InitDeviceLocParams", description = "鍒濆鍖栧彴鏈哄簱浣嶅弬鏁�")
+@Accessors(chain = true)
+public class InitDeviceLocParams implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ // 鍙版満鍙�
+ private String devNo;
+
+ // 璧峰鎺�
+ private Integer startRow;
+
+ // 缁堟鎺�
+ private Integer endRow;
+
+ // 璧峰鍒�
+ private Integer startBay;
+
+ // 缁堟鍒�
+ private Integer endBay;
+
+ // 璧峰灞�
+ private Integer startLev;
+
+ // 缁堟灞�
+ private Integer endLev;
+}
diff --git a/src/main/java/com/zy/asrs/service/LocAroundBindService.java b/src/main/java/com/zy/asrs/service/LocAroundBindService.java
index 75c6d56..ed9da0d 100644
--- a/src/main/java/com/zy/asrs/service/LocAroundBindService.java
+++ b/src/main/java/com/zy/asrs/service/LocAroundBindService.java
@@ -1,8 +1,12 @@
package com.zy.asrs.service;
import com.zy.asrs.entity.LocAroundBind;
+import com.zy.asrs.entity.param.InitDeviceLocParams;
import com.baomidou.mybatisplus.service.IService;
+import com.core.common.R;
public interface LocAroundBindService extends IService<LocAroundBind> {
+ R bindLocs(InitDeviceLocParams params);
+
}
diff --git a/src/main/java/com/zy/asrs/service/impl/LocAroundBindServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/LocAroundBindServiceImpl.java
index b46c47b..6029d47 100644
--- a/src/main/java/com/zy/asrs/service/impl/LocAroundBindServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/LocAroundBindServiceImpl.java
@@ -1,12 +1,83 @@
package com.zy.asrs.service.impl;
import com.zy.asrs.mapper.LocAroundBindMapper;
+import com.zy.asrs.entity.BasDevice;
import com.zy.asrs.entity.LocAroundBind;
+import com.zy.asrs.entity.LocMast;
+import com.zy.asrs.entity.param.InitDeviceLocParams;
+import com.zy.asrs.enums.LocStsType;
+import com.zy.asrs.service.BasDeviceService;
import com.zy.asrs.service.LocAroundBindService;
+import com.zy.asrs.service.LocMastService;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.core.common.Cools;
+import com.core.common.R;
+import com.core.exception.CoolException;
+
+import java.util.List;
+import java.util.Objects;
+
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
@Service("locAroundBindService")
-public class LocAroundBindServiceImpl extends ServiceImpl<LocAroundBindMapper, LocAroundBind> implements LocAroundBindService {
+public class LocAroundBindServiceImpl extends ServiceImpl<LocAroundBindMapper, LocAroundBind>
+ implements LocAroundBindService {
+
+ @Autowired
+ private LocMastService locMastService;
+ @Autowired
+ private BasDeviceService basDeviceService;
+
+ /**
+ * 缁戝畾浣滀笟搴撲綅
+ *
+ * @param params
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public R bindLocs(InitDeviceLocParams params) {
+ // 鏍¢獙鍙傛暟
+ if (Cools.isEmpty(params.getStartRow()) || Cools.isEmpty(params.getEndRow()) ||
+ Cools.isEmpty(params.getStartBay()) || Cools.isEmpty(params.getEndBay()) ||
+ Cools.isEmpty(params.getStartLev()) || Cools.isEmpty(params.getEndLev())) {
+ return R.error("鍙傛暟閿欒");
+ }
+ BasDevice basDevice = basDeviceService.selectOne(new EntityWrapper<BasDevice>()
+ .eq("dev_no", params.getDevNo()));
+ if (Objects.isNull(basDevice)) {
+ return R.error("鏈煡璇㈠埌璇ヨ澶�");
+ }
+
+ List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
+ .between("row1", params.getStartRow(), params.getEndRow())
+ .between("bay1", params.getStartBay(), params.getEndBay())
+ .between("lev1", params.getStartLev(), params.getEndLev())
+ .ne("loc_sts", LocStsType.LOC_STS_TYPE_X.type));
+ if (Cools.isEmpty(locMasts)) {
+ return R.error("鏈煡璇㈠埌绗﹀悎鏉′欢鐨勫簱浣�");
+ }
+
+ // 鏍¢獙搴撲綅鏄惁宸茬粦瀹�
+ for (LocMast mast : locMasts) {
+ LocAroundBind aroundBind = this.selectOne(new EntityWrapper<LocAroundBind>()
+ .eq("dev_no", params.getDevNo())
+ .eq("b_loc_no", mast.getLocNo()));
+ if (!Objects.isNull(aroundBind)) {
+ continue;
+ }
+ LocAroundBind bind = new LocAroundBind();
+ bind.setDevNo(params.getDevNo());
+ bind.setBLocNo(mast.getLocNo());
+ bind.setDevId(basDevice.getId());
+ if (!this.insert(bind)) {
+ throw new CoolException("缁戝畾搴撲綅澶辫触");
+ }
+ }
+ return R.ok("缁戝畾搴撲綅鎴愬姛");
+ }
}
diff --git a/src/main/webapp/static/js/locAroundBind/locAroundBind.js b/src/main/webapp/static/js/locAroundBind/locAroundBind.js
index 1735a63..8b45ac4 100644
--- a/src/main/webapp/static/js/locAroundBind/locAroundBind.js
+++ b/src/main/webapp/static/js/locAroundBind/locAroundBind.js
@@ -22,13 +22,11 @@
height: 'full-120',
cols: [[
{ type: 'checkbox' }
- , { field: 'number', align: 'center', title: '搴忓彿' }
, { field: 'id', align: 'center', title: 'ID' }
, { field: 'devId', align: 'center', title: '鍙版満ID' }
, { field: 'devNo', align: 'center', title: '鍙版満鍙�' }
- , { field: 'bLocId', align: 'center', title: '搴撲綅ID' }
- , { field: 'bLocNo', align: 'center', title: '搴撲綅鐮�' }
-
+ , { field: 'blocId', align: 'center', title: '搴撲綅ID', hide: true }
+ , { field: 'blocNo', align: 'center', title: '搴撲綅鐮�' }
, { fixed: 'right', title: '鎿嶄綔', align: 'center', toolbar: '#operate', width: 120 }
]],
request: {
@@ -129,7 +127,7 @@
if (res.data) {
layer.open({
type: 1,
- title: '鍒濆鍖栧簱浣�',
+ title: '鍙版満缁戝畾浣滀笟搴撲綅',
area: ["400px"],
maxmin: true,
shadeClose: true,
@@ -148,6 +146,29 @@
}
});
+ // 鍒濆鍖栦繚瀛�
+ form.on('submit(initDo)', function (data) {
+ $.ajax({
+ url: baseUrl + "/locAroundBind/bind/init",
+ headers: { 'token': localStorage.getItem('token') },
+ data: JSON.stringify(data.field),
+ contentType: 'application/json;charset=UTF-8',
+ method: 'POST',
+ async: false,
+ success: function (res) {
+ if (res.code === 200) {
+ layer.msg(res.msg);
+ layer.closeAll();
+ tableReload(false);
+ } else if (res.code === 403) {
+ parent.location.href = "/";
+ } else {
+ layer.msg(res.msg)
+ }
+ }
+ })
+ });
+
// 鐩戝惉琛屽伐鍏蜂簨浠�
table.on('tool(locAroundBind)', function (obj) {
var data = obj.data;
diff --git a/src/main/webapp/static/js/locCache/locCache.js b/src/main/webapp/static/js/locCache/locCache.js
index 938cf5c..e35b6f2 100644
--- a/src/main/webapp/static/js/locCache/locCache.js
+++ b/src/main/webapp/static/js/locCache/locCache.js
@@ -119,8 +119,6 @@
}
});
-
-
// 鐩戝惉琛屽伐鍏蜂簨浠�
table.on('tool(locCache)', function (obj) {
var data = obj.data;
@@ -150,7 +148,6 @@
// 鍒濆鍖栦繚瀛�
form.on('submit(initDo)', function (data) {
- console.log(data.field)
$.ajax({
url: baseUrl + "/locCache/init/auth",
headers: {'token': localStorage.getItem('token')},
diff --git a/src/main/webapp/views/locAroundBind/locAroundBind.html b/src/main/webapp/views/locAroundBind/locAroundBind.html
index 2b32fdc..89118df 100644
--- a/src/main/webapp/views/locAroundBind/locAroundBind.html
+++ b/src/main/webapp/views/locAroundBind/locAroundBind.html
@@ -13,16 +13,15 @@
</head>
<body>
-
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-form toolbar" id="search-box">
<div class="layui-form-item">
<div class="layui-inline">
- <label class="layui-form-label">缂栧彿:</label>
<div class="layui-input-inline">
- <input class="layui-input" type="text" name="id" placeholder="缂栧彿" autocomplete="off">
+ <input class="layui-input" type="text" name="condition" placeholder="璇疯緭鍏�"
+ autocomplete="off">
</div>
</div>
<div class="layui-inline"> 
@@ -104,79 +103,57 @@
<div id="resetLocDiv" style="margin: 20px 0 10px 30px; display: none">
<div class="layui-form layui-form-pane">
<div class="layui-form-item">
- <div class="layui-inline">
- <label class="layui-form-label">鍒犻櫎搴撲綅</label>
- <div class="layui-input-inline" style="width: 100px;">
- <input type="checkbox" name="enable" lay-skin="switch" value="1" lay-text="鍒犻櫎|淇濈暀">
- </div>
- </div>
- </div>
- <div class="layui-form-item">
- <div class="layui-inline">
- <label class="layui-form-label"><span class="not-null">*</span>搴撳尯鍚嶇О锛�</label>
- <div class="layui-input-inline cool-auto-complete">
- <input id="identifying" name="identifying" class="layui-input" type="text" style="display: none">
- <input id="identifying$" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)"
- type="text" onfocus=this.blur()>
- <div class="cool-auto-complete-window">
- <input class="cool-auto-complete-window-input" data-key="basAreasQueryBywhsType"
- onkeyup="autoLoad(this.getAttribute('data-key'))">
- <select class="cool-auto-complete-window-select" data-key="basAreasQueryBywhsTypeSelect"
- onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple">
- </select>
- </div>
- </div>
+ <label class="layui-form-label">鍙版満鍙�</label>
+ <div class="layui-input-inline">
+ <input type="text" name="devNo" autocomplete="off" class="layui-input">
</div>
</div>
<!-- 鎺� -->
<div class="layui-form-item">
- <label class="layui-form-label">鍫嗗灈鏈烘暟閲�</label>
- <div class="layui-input-inline">
- <input type="text" name="crnAmount" lay-verify="required|number" autocomplete="off" class="layui-input">
- </div>
- </div>
- <div class="layui-form-item">
<div class="layui-inline">
- <label class="layui-form-label">璧峰鍫嗗灈鏈�</label>
- <div class="layui-input-inline">
- <input type="text" name="staCrn" autocomplete="off" class="layui-input" lay-verify="number">
+ <label class="layui-form-label">璧锋鎺�</label>
+ <div class="layui-input-inline" style="width: 100px;">
+ <input type="text" name="startRow" autocomplete="off" class="layui-input"
+ lay-verify="required|number">
+ </div>
+ <div class="layui-form-mid">-</div>
+ <div class="layui-input-inline" style="width: 100px;">
+ <input type="text" name="endRow" autocomplete="off" class="layui-input"
+ lay-verify="required|number">
</div>
</div>
</div>
- <!-- 搴撲綅绫诲瀷 -->
+ <!-- 鍒� -->
<div class="layui-form-item">
- <label class="layui-form-label">楂樹綆绫诲瀷</label>
- <div class="layui-input-inline">
- <select name="locType1">
- <option style="display: none"></option>
- <option value="0">鏈煡</option>
- <option value="1">浣庡簱浣�</option>
- <option value="2">楂樺簱浣�</option>
- </select>
+ <div class="layui-inline">
+ <label class="layui-form-label">璧锋鍒�</label>
+ <div class="layui-input-inline" style="width: 100px;">
+ <input type="text" name="startBay" autocomplete="off" class="layui-input"
+ lay-verify="required|number">
+ </div>
+ <div class="layui-form-mid">-</div>
+ <div class="layui-input-inline" style="width: 100px;">
+ <input type="text" name="endBay" autocomplete="off" class="layui-input"
+ lay-verify="required|number">
+ </div>
</div>
</div>
+ <!-- 灞� -->
<div class="layui-form-item">
- <label class="layui-form-label">瀹界獎绫诲瀷</label>
- <div class="layui-input-inline">
- <select name="locType2">
- <option style="display: none"></option>
- <option value="0">鏈煡</option>
- <option value="1">绐勫簱浣�</option>
- <option value="2">瀹藉簱浣�</option>
- </select>
+ <div class="layui-inline">
+ <label class="layui-form-label">璧锋灞�</label>
+ <div class="layui-input-inline" style="width: 100px;">
+ <input type="text" name="startLev" autocomplete="off" class="layui-input"
+ lay-verify="required|number">
+ </div>
+ <div class="layui-form-mid">-</div>
+ <div class="layui-input-inline" style="width: 100px;">
+ <input type="text" name="endLev" autocomplete="off" class="layui-input"
+ lay-verify="required|number">
+ </div>
</div>
</div>
- <div class="layui-form-item">
- <label class="layui-form-label">杞婚噸绫诲瀷</label>
- <div class="layui-input-inline">
- <select name="locType3">
- <option style="display: none"></option>
- <option value="0">鏈煡</option>
- <option value="1">杞诲簱浣�</option>
- <option value="2">閲嶅簱浣�</option>
- </select>
- </div>
- </div>
+ <!-- -->
<div style="text-align: center; margin-top: 20px">
<button class="layui-btn layui-btn-radius layui-btn-normal" id="initDo" lay-submit lay-filter="initDo">
纭畾
--
Gitblit v1.9.1