add: 新增立库监控前后端
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
package org.nl;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
|
||||
import com.alicp.jetcache.anno.config.EnableMethodCache;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
@@ -70,5 +76,108 @@ public class AppRun {
|
||||
public String index() {
|
||||
return "Backend service started successfully";
|
||||
}
|
||||
@GetMapping("/w") // 最后可以去掉这个方法
|
||||
@SaIgnore
|
||||
public String index2() {
|
||||
// 采用循环+判断进行铺设图标, 可以通过舞台编辑协助完成
|
||||
WQLObject stageTab = WQLObject.getWQLObject("stage");
|
||||
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr");
|
||||
JSONObject save = new JSONObject();
|
||||
JSONArray nodes = new JSONArray();
|
||||
JSONArray edges = new JSONArray();
|
||||
int x = 50; // 首个位置
|
||||
int y = 50;
|
||||
int step = 5;
|
||||
String type = "html-node";
|
||||
int nodeSizeW = 50;
|
||||
int nodeSizeH = 50;
|
||||
for (int i = 2; i < 23; i=i+2) { // 第几块,每两块为一块
|
||||
// 获取列数col_num
|
||||
System.out.println( (i>=10?"3":"30") + i);
|
||||
JSONObject jsonObject = WQL.getWO("ss").addParamMap(MapOf.of("flag", "1"
|
||||
, "block_num", (i>=10?"3":"30") + i)).process().uniqueResult(0);
|
||||
int num = Integer.parseInt(jsonObject.getString("num"));
|
||||
for (int j = 1; j <= num; j++) {
|
||||
// 获取2,1....块的数据
|
||||
JSONArray array = attrTab.query("block_num IN ('" + (i>=10?"3":"30") + i + "','" +
|
||||
((i-1)>=10?"3":"30") + (i - 1) + "') AND " +
|
||||
"layer_num = 3 AND col_num = " + j, "block_num DESC, row_num DESC").getResultJSONArray(0);
|
||||
for (int k = 0; k < array.size(); k++) { // 1,2...块的每列数据
|
||||
JSONObject object = array.getJSONObject(k);
|
||||
if (object.getString("is_delete").equals("1")) {
|
||||
x = x + step + nodeSizeW;
|
||||
continue;
|
||||
}
|
||||
// 设置节点,只需要struct_id, 自定义参数数据都加载properties对象里面
|
||||
JSONObject node = new JSONObject();
|
||||
node.put("id", IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
node.put("type", type);
|
||||
node.put("x", x);
|
||||
node.put("y", y);
|
||||
JSONObject properties = new JSONObject();
|
||||
JSONObject nodeSize = new JSONObject();
|
||||
nodeSize.put("width", nodeSizeW);
|
||||
nodeSize.put("height", nodeSizeH);
|
||||
properties.put("nodeSize", nodeSize);
|
||||
properties.put("struct_id", object.getString("struct_id")); // 灵活配置,其他为固定参数
|
||||
node.put("properties", properties);
|
||||
node.put("zIndex", "2023");
|
||||
x = x + step + nodeSizeW;
|
||||
nodes.add(node);
|
||||
if (k+1 < array.size()) { // 如果块与块不同,空一个距离
|
||||
JSONObject object2 = array.getJSONObject(k+1);
|
||||
if (!object2.getString("block_num").equals(object.getString("block_num"))) {
|
||||
JSONObject node2 = new JSONObject();
|
||||
node2.put("id", IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
node2.put("type", type);
|
||||
node2.put("x", x);
|
||||
node2.put("y", y);
|
||||
JSONObject properties2 = new JSONObject();
|
||||
JSONObject nodeSize2 = new JSONObject();
|
||||
nodeSize2.put("width", nodeSizeW);
|
||||
nodeSize2.put("height", nodeSizeH);
|
||||
properties2.put("nodeSize", nodeSize2);
|
||||
properties2.put("flag", "1");
|
||||
properties2.put("transform", 90);
|
||||
node2.put("properties", properties2);
|
||||
node2.put("zIndex", "2023");
|
||||
x = x + step + nodeSizeW;
|
||||
nodes.add(node2);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 下一列
|
||||
x = 50;
|
||||
y = y + step + nodeSizeH;
|
||||
}
|
||||
// 下一个块
|
||||
x = 50;
|
||||
for (int j = 0; j < 16; j++) { // 铺设一行道路
|
||||
JSONObject node2 = new JSONObject();
|
||||
node2.put("id", IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
node2.put("type", type);
|
||||
node2.put("x", x);
|
||||
node2.put("y", y);
|
||||
JSONObject properties2 = new JSONObject();
|
||||
JSONObject nodeSize2 = new JSONObject();
|
||||
nodeSize2.put("width", nodeSizeW);
|
||||
nodeSize2.put("height", nodeSizeH);
|
||||
properties2.put("nodeSize", nodeSize2);
|
||||
properties2.put("flag", "1");
|
||||
node2.put("properties", properties2);
|
||||
node2.put("zIndex", "2023");
|
||||
x = x + step + nodeSizeW;
|
||||
nodes.add(node2);
|
||||
}
|
||||
x = 50;
|
||||
y = y + step + nodeSizeH;
|
||||
}
|
||||
save.put("nodes", nodes);
|
||||
save.put("edges", edges);
|
||||
JSONObject jsonObject = stageTab.query("stage_code = 'AS_3'").uniqueResult(0);
|
||||
jsonObject.put("stage_data", save);
|
||||
stageTab.update(jsonObject);
|
||||
return "Backend service started successfully";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
54
lms/nladmin-system/src/main/java/org/nl/ss.wql
Normal file
54
lms/nladmin-system/src/main/java/org/nl/ss.wql
Normal file
@@ -0,0 +1,54 @@
|
||||
[交易说明]
|
||||
交易名: 半成品出库
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.block_num TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
IF 输入.flag = "1"
|
||||
QUERY
|
||||
SELECT
|
||||
MAX(col_num) as num
|
||||
FROM
|
||||
`st_ivt_structattr`
|
||||
WHERE
|
||||
1=1
|
||||
OPTION 输入.block_num <> ""
|
||||
block_num = 输入.block_num
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -2,6 +2,7 @@
|
||||
package org.nl.wms.basedata.st.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -73,4 +74,12 @@ public class StructattrController {
|
||||
structattrService.changeActive(json);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PostMapping("/getStructByCodes")
|
||||
@Log("获取仓位信息")
|
||||
@ApiOperation("获取仓位信息")
|
||||
public ResponseEntity<Object> getStructByCodes(@RequestBody String json){
|
||||
JSONArray jsonArray = JSONArray.parseArray(json);
|
||||
return new ResponseEntity<>(structattrService.getStructByCodes(jsonArray), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
package org.nl.wms.basedata.st.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.basedata.st.service.dto.StructattrDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -69,4 +70,9 @@ public interface StructattrService {
|
||||
*/
|
||||
void changeActive(JSONObject json);
|
||||
|
||||
/**
|
||||
* 获取仓位信息
|
||||
* @return
|
||||
*/
|
||||
JSONArray getStructByCodes(JSONArray json);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata.st.service.SectattrService;
|
||||
@@ -240,4 +241,52 @@ public class StructattrServiceImpl implements StructattrService {
|
||||
WQLObject.getWQLObject("sch_base_point").update(json, " point_id = '" + struct_id + "'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getStructByCodes(JSONArray jsonArray) {
|
||||
/**
|
||||
* jsonArry: 所有组件的信息,包括组件本身的id以及仓位id,组件id是用来给前端做对应筛选使用,如果没有仓位id证明不是
|
||||
* 仓位组件,故不做处理,可以不用返回数据。
|
||||
*/
|
||||
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr");
|
||||
JSONArray arr = new JSONArray();
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject obj = new JSONObject();
|
||||
JSONObject js = jsonArray.getJSONObject(i);
|
||||
String struct_id = js.getString("struct_id");
|
||||
|
||||
if (ObjectUtil.isEmpty(struct_id)) continue;
|
||||
|
||||
int struct_status = 2;
|
||||
// 获取信息 1蓝色空载具 2黄色木箱 3绿色空位 4灰色禁用
|
||||
// 查找详细信息, 这里可能是有多条数据
|
||||
JSONArray array = WQL
|
||||
.getWO("QST_STRUCTATTR")
|
||||
.addParamMap(MapOf.of("struct_id", struct_id, "flag", "1"))
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
// 获取仓位表中的信息
|
||||
JSONObject strInfo = attrTab
|
||||
.query("struct_id = '" + struct_id + "'")
|
||||
.uniqueResult(0);
|
||||
if (strInfo.getString("is_delete").equals("1")) {
|
||||
// 被删掉
|
||||
struct_status = 4;
|
||||
} else if (ObjectUtil.isEmpty(strInfo.getString("storagevehicle_code"))) {
|
||||
// 空位
|
||||
struct_status = 3;
|
||||
} else if (ObjectUtil.isNotEmpty(strInfo.getString("storagevehicle_code"))
|
||||
&& strInfo.getString("sect_code").equals("KTP01")) {
|
||||
struct_status = 1;
|
||||
}
|
||||
// 剩余层数货位信息没统计,统计可以用obj.put(key, value)返给前端,前端在initStatus()就可以遍历去获取,给节点赋值
|
||||
obj.put("data", array);
|
||||
obj.put("struct_status", struct_status);
|
||||
obj.put("struct_id", strInfo.getString("struct_id"));
|
||||
obj.put("struct_code", strInfo.getString("struct_code"));
|
||||
obj.put("id", js.getString("id")); // 设备不存在就只保留id,方便前端查看
|
||||
arr.add(obj);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
[交易说明]
|
||||
交易名: 将海亮的物料导入mysql
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.struct_id TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
QUERY
|
||||
SELECT
|
||||
attr.*,
|
||||
sub.package_box_sn,
|
||||
sub.quanlity_in_box,
|
||||
sub.box_weight,
|
||||
sub.sale_order_name,
|
||||
sub.container_name,
|
||||
sub.product_description,
|
||||
sub.net_weight
|
||||
FROM
|
||||
st_ivt_structattr attr
|
||||
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.package_box_sn = attr.storagevehicle_code
|
||||
WHERE
|
||||
1 = 1
|
||||
OPTION 输入.struct_id <> ""
|
||||
attr.struct_id = 输入.struct_id
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
Reference in New Issue
Block a user