add:新增二期发货区监控功能

This commit is contained in:
2024-08-19 18:48:40 +08:00
parent 948c2fda5f
commit 7c58708a6e
9 changed files with 648 additions and 33 deletions

View File

@@ -609,42 +609,42 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
StIvtIostorinv mstDao = this.getById(whereJson.getLongValue("iostorinv_id")); StIvtIostorinv mstDao = this.getById(whereJson.getLongValue("iostorinv_id"));
// 查询此明细所有未生成的分配明细
List<JSONObject> disDaoList = stIvtIostorinvdisMapper.getNotCreateDis(whereJson);
if (ObjectUtil.isEmpty(disDaoList)) {
throw new BadRequestException("当前没有可设置的分配明细!");
}
//判断是否有正在执行中的任务
List<JSONObject> arr2 = taskService.query("handle_class = '" + TwoOutTask.class.getName() + "' and task_status < '" + TaskStatusEnum.FINISHED.getCode() + "' and is_delete ='0'")
.getResultJSONArray(0).toJavaList(JSONObject.class);
Map<String, List<JSONObject>> taskGroup = arr2.stream()
.collect(Collectors.groupingBy(row -> row.getString("task_group_id")));
if (taskGroup.size() >= 3) {
throw new BadRequestException("当前有三种不同规格的木箱正在出库,请稍后在试!");
}
/*
* 下发任务
* 1.根据木箱 长、宽、高、订单号、物料分组
* 2.相同木箱规格、订单号、物料的木箱一个任务组
*/
// 定义一个函数,将需要分组的元素映射到一个建的集合里
Function<JSONObject, List<String>> compositeKey = row ->
Arrays.asList(row.getString("box_length"), row.getString("box_width"),
row.getString("box_high"),row.getString("sale_order_name"),
row.getString("material_id")
);
Map<List<String>, List<JSONObject>> groupingDisMap =
disDaoList.stream().collect(Collectors.groupingBy(compositeKey, Collectors.toList()));
// 创建手动式事务 // 创建手动式事务
ArrayList<String> arr = new ArrayList<>(); ArrayList<String> arr = new ArrayList<>();
TranUtil.openTransaction((req, allTransactionConsumer) -> { TranUtil.openTransaction((req, allTransactionConsumer) -> {
// 查询此明细所有未生成的分配明细
List<JSONObject> disDaoList = stIvtIostorinvdisMapper.getNotCreateDis(whereJson);
if (ObjectUtil.isEmpty(disDaoList)) {
throw new BadRequestException("当前没有可设置的分配明细!");
}
//判断是否有正在执行中的任务
List<JSONObject> arr2 = taskService.query("handle_class = '" + TwoOutTask.class.getName() + "' and task_status < '" + TaskStatusEnum.FINISHED.getCode() + "' and is_delete ='0'")
.getResultJSONArray(0).toJavaList(JSONObject.class);
Map<String, List<JSONObject>> taskGroup = arr2.stream()
.collect(Collectors.groupingBy(row -> row.getString("task_group_id")));
if (taskGroup.size() >= 3) {
throw new BadRequestException("当前有三种不同规格的木箱正在出库,请稍后在试!");
}
/*
* 下发任务
* 1.根据木箱 长、宽、高、订单号、物料分组
* 2.相同木箱规格、订单号、物料的木箱一个任务组
*/
// 定义一个函数,将需要分组的元素映射到一个建的集合里
Function<JSONObject, List<String>> compositeKey = row ->
Arrays.asList(row.getString("box_length"), row.getString("box_width"),
row.getString("box_high"),row.getString("sale_order_name"),
row.getString("material_id")
);
Map<List<String>, List<JSONObject>> groupingDisMap =
disDaoList.stream().collect(Collectors.groupingBy(compositeKey, Collectors.toList()));
// 判断是否有异常任务 // 判断是否有异常任务
String exceptionPointCode = exceptionPointCode(disDaoList); String exceptionPointCode = exceptionPointCode(disDaoList);
if (ObjectUtil.isNotEmpty(exceptionPointCode)) { if (ObjectUtil.isNotEmpty(exceptionPointCode)) {

View File

@@ -34,4 +34,9 @@ public interface AutoRiKuService {
* 获取空托盘 * 获取空托盘
*/ */
JSONObject getEmpPoint(); JSONObject getEmpPoint();
/**
* 获取发货区(二期)
*/
JSONObject queryNumTwo(JSONObject whereJson);
} }

View File

@@ -265,4 +265,20 @@ public class AutoRiKuServiceImpl implements AutoRiKuService {
return jsonAll; return jsonAll;
} }
@Override
public JSONObject queryNumTwo(JSONObject whereJson) {
WQLObject schBasePointService = WQLObject.getWQLObject("sch_base_point");
// 有货个数
JSONArray haveMoney = schBasePointService.query("point_type = '8' and IFNULL(vehicle_code,'')<>'' and is_delete = '0' and is_used = '1' AND region_code = 'BFH01'").getResultJSONArray(0);
// 无货个数
JSONArray unMoney = schBasePointService.query("point_type = '8' and IFNULL(vehicle_code,'')='' and is_delete = '0' and is_used = '1' AND region_code = 'BFH01'").getResultJSONArray(0);
JSONObject result = new JSONObject();
result.put("haveMoney", haveMoney.size());
result.put("unMoney", unMoney.size());
return result;
}
} }

View File

@@ -42,4 +42,11 @@ public class AutoWebSocketRiKu {
public ResponseEntity<Object> queryNum(@RequestBody JSONObject whereJson) { public ResponseEntity<Object> queryNum(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(autoRiKuService.queryNum(whereJson), HttpStatus.OK); return new ResponseEntity<>(autoRiKuService.queryNum(whereJson), HttpStatus.OK);
} }
@PostMapping("/queryNumTwo")
@Log("查询发货区(二期)")
public ResponseEntity<Object> queryNumTwo(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(autoRiKuService.queryNumTwo(whereJson), HttpStatus.OK);
}
} }

View File

@@ -88,6 +88,14 @@ public class StructattrController {
return new ResponseEntity<>(structattrService.getStructByCodesFs(jsonArray), HttpStatus.OK); return new ResponseEntity<>(structattrService.getStructByCodesFs(jsonArray), HttpStatus.OK);
} }
@PostMapping("/getStructByCodesFsTwo")
@Log("获取点位信息(二期)")
public ResponseEntity<Object> getStructByCodesFsTwo(@RequestBody String json) {
JSONArray jsonArray = JSONArray.parseArray(json);
return new ResponseEntity<>(structattrService.getStructByCodesFsTwo(jsonArray), HttpStatus.OK);
}
@PostMapping("/unLockPoint") @PostMapping("/unLockPoint")
@Log("解锁点位") @Log("解锁点位")
@@ -95,6 +103,13 @@ public class StructattrController {
return new ResponseEntity<>(structattrService.unLockPoint(whereJson), HttpStatus.OK); return new ResponseEntity<>(structattrService.unLockPoint(whereJson), HttpStatus.OK);
} }
@PostMapping("/unLockPointTwo")
@Log("解锁点位(二期)")
public ResponseEntity<Object> unLockPointTwo(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(structattrService.unLockPointTwo(whereJson), HttpStatus.OK);
}
@PostMapping("/oneCreate") @PostMapping("/oneCreate")
@Log("一键生成货位") @Log("一键生成货位")
public ResponseEntity<Object> oneCreate(@RequestBody JSONObject whereJson) { public ResponseEntity<Object> oneCreate(@RequestBody JSONObject whereJson) {

View File

@@ -90,6 +90,12 @@ public interface StructattrService {
* @return * @return
*/ */
JSONArray getStructByCodesFs(JSONArray json); JSONArray getStructByCodesFs(JSONArray json);
/**
* 获取点位信息(二期)
*wo
* @return
*/
JSONArray getStructByCodesFsTwo(JSONArray json);
Map getStructByCodesFsAnNum(JSONArray json); Map getStructByCodesFsAnNum(JSONArray json);
/** /**
@@ -126,4 +132,11 @@ public interface StructattrService {
* } * }
*/ */
void tunConfirm(JSONObject json); void tunConfirm(JSONObject json);
/**
* 点位解锁
* @param whereJson{点位信息}
* @return 、
*/
JSONObject unLockPointTwo(JSONObject whereJson);
} }

View File

@@ -8,8 +8,12 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxlashboundService;
import org.nl.b_lms.storage_manage.database.service.dao.BstIvtBoxlashbound;
import org.nl.b_lms.storage_manage.database.service.dao.mapper.BstIvtBoxinfoMapper;
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum; import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
import org.nl.common.utils.MapOf; import org.nl.common.utils.MapOf;
import org.nl.common.utils.SecurityUtils; import org.nl.common.utils.SecurityUtils;
@@ -28,6 +32,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
@@ -48,6 +53,18 @@ public class StructattrServiceImpl implements StructattrService {
@Autowired @Autowired
private StorattrService storattrService; private StorattrService storattrService;
/**
* 木箱绑定服务
*/
@Autowired
private IBstIvtBoxlashboundService iBstIvtBoxlashboundService;
/**
* 木箱信息mapper
*/
@Resource
private BstIvtBoxinfoMapper bstIvtBoxinfoMapper;
@Override @Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) { public Map<String, Object> queryAll(Map whereJson, Pageable page) {
String search = (String) whereJson.get("search"); String search = (String) whereJson.get("search");
@@ -398,6 +415,86 @@ public class StructattrServiceImpl implements StructattrService {
return arr; return arr;
} }
@Override
public JSONArray getStructByCodesFsTwo(JSONArray jsonArray) {
WQLObject attrTab = WQLObject.getWQLObject("sch_base_point");
JSONArray arr = new JSONArray();
List<String> list = new ArrayList<>();
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject js = jsonArray.getJSONObject(i);
String struct_id = js.getString("struct_id");
if (ObjectUtil.isEmpty(struct_id)) {
continue;
}
list.add(struct_id);
}
String sql = "('" + list.stream().collect(Collectors.joining("','")) + "')";
JSONArray array = WQL
.getWO("QST_STRUCTATTR")
.addParamMap(MapOf.of("struct_ids", sql, "flag", "3"))
.process()
.getResultJSONArray(0);
Map<String, JSONObject> pointMap = array.stream().collect(HashMap::new, (BiConsumer<HashMap<String, JSONObject>, Object>) (m, o) -> {
JSONObject item = (JSONObject) o;
m.put(item.getString("point_id"), item);
}, HashMap::putAll);
JSONArray attrs = attrTab.query("point_id in " + sql).getResultJSONArray(0);
Map<String, JSONObject> attrMap = attrs.stream().collect(HashMap::new, (BiConsumer<HashMap<String, JSONObject>, Object>) (m, o) -> {
JSONObject item = (JSONObject) o;
m.put(item.getString("point_id"), item);
}, HashMap::putAll);
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灰色禁用
// 计算子卷净重
JSONObject json = pointMap.get(struct_id);
List<JSONObject> pointList = array.toJavaList(JSONObject.class).stream()
.filter(row -> row.getString("point_id").equals(struct_id))
.collect(Collectors.toList());
if (ObjectUtil.isNotEmpty(json.getString("net_weight"))) {
BigDecimal container_weight = pointList.stream().map(row -> row.getBigDecimal("net_weight")).reduce(BigDecimal.ZERO, BigDecimal::add);
for (int j = 0; j < pointList.size(); j++) {
JSONObject jsonObject = pointList.get(j);
jsonObject.put("container_weight", container_weight);
}
}
JSONObject strInfo = attrMap.get(struct_id);
if (strInfo !=null && ObjectUtil.isEmpty(strInfo.getString("vehicle_code"))) {
// 空位
struct_status = 3;
}
if (strInfo !=null && strInfo.getString("is_used").equals(IOSEnum.IS_NOTANDYES.code(""))) {
// 未启用
struct_status = 4;
}
// 剩余层数货位信息没统计统计可以用obj.put(key, value)返给前端前端在initStatus()就可以遍历去获取,给节点赋值
obj.put("data", pointList);
obj.put("struct_status", struct_status);
obj.put("struct_id", strInfo.getString("point_id"));
obj.put("struct_code", strInfo.getString("point_code"));
obj.put("id", js.getString("id")); // 设备不存在就只保留id方便前端查看
arr.add(obj);
}
return arr;
}
@Override @Override
public Map getStructByCodesFsAnNum(JSONArray jsonArray) { public Map getStructByCodesFsAnNum(JSONArray jsonArray) {
WQLObject attrTab = WQLObject.getWQLObject("sch_base_point"); WQLObject attrTab = WQLObject.getWQLObject("sch_base_point");
@@ -705,4 +802,56 @@ public class StructattrServiceImpl implements StructattrService {
} }
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject unLockPointTwo(JSONObject whereJson) {
// 点位表
WQLObject schBasePointService = WQLObject.getWQLObject("sch_base_point");
String box_no = whereJson.getString("vehicle_code");
if (ObjectUtil.isEmpty(box_no)) {
throw new BadRequestException("木箱不能为空");
}
BstIvtBoxlashbound boundDao = iBstIvtBoxlashboundService.getOne(
new QueryWrapper<BstIvtBoxlashbound>().lambda()
.eq(BstIvtBoxlashbound::getBox_no, box_no)
);
if (ObjectUtil.isEmpty(boundDao)) {
throw new BadRequestException("此木箱没有经过自动捆扎,请在【点位管理】页面手动解绑!");
}
// 查出所有捆绑在一起的木箱
List<BstIvtBoxlashbound> boundDaoList = iBstIvtBoxlashboundService.list(
new QueryWrapper<BstIvtBoxlashbound>().lambda()
.eq(BstIvtBoxlashbound::getBound_id, boundDao.getBound_id())
);
// 查询所在点位
String box_in = boundDaoList.stream()
.map(BstIvtBoxlashbound::getBox_no)
.collect(Collectors.joining("','"));
JSONObject jsonPoint = schBasePointService.query("vehicle_code IN ('" + box_in + "') and is_delete = '0' and is_used = '1' and point_type = '8'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonPoint)) {
throw new BadRequestException("请输入正确的木箱或查看点位是否存在");
}
// 解锁点位
jsonPoint.put("point_status", "1");
jsonPoint.put("lock_type", "1");
jsonPoint.put("vehicle_code", "");
schBasePointService.update(jsonPoint);
// 删除木箱绑定关系
iBstIvtBoxlashboundService.remove(
new QueryWrapper<BstIvtBoxlashbound>().lambda()
.eq(BstIvtBoxlashbound::getBound_id, boundDaoList.get(0).getBound_id())
);
return null;
}
} }

View File

@@ -16,6 +16,14 @@ export function getStructByCodesFs(data) { // 获取点位信息
}) })
} }
export function getStructByCodesFsTwo(data) { // 获取点位信息(二期)
return request({
url: 'api/structattr/getStructByCodesFsTwo',
method: 'post',
data: data
})
}
export function unLockPoint(data) { // 解锁点位 export function unLockPoint(data) { // 解锁点位
return request({ return request({
url: 'api/structattr/unLockPoint', url: 'api/structattr/unLockPoint',
@@ -24,6 +32,14 @@ export function unLockPoint(data) { // 解锁点位
}) })
} }
export function unLockPointTwo(data) { // 解锁点位
return request({
url: 'api/structattr/unLockPointTwo',
method: 'post',
data: data
})
}
export function autoWeb() { // 查询立库监控数据 export function autoWeb() { // 查询立库监控数据
return request({ return request({
url: 'api/autoWeb/query', url: 'api/autoWeb/query',
@@ -38,3 +54,11 @@ export function queryNum(data) { // 获取个数
data data
}) })
} }
export function queryNumTwo(data) { // 获取个数(二期)
return request({
url: 'api/autoWeb/queryNumTwo',
method: 'post',
data
})
}

View File

@@ -0,0 +1,386 @@
<template>
<div>
<el-row style="padding-top: 10px;padding-left: 10px;padding-bottom: 30px">
<el-form
:inline="true"
class="demo-form-inline"
label-position="right"
label-width="100px"
label-suffix=":"
>
<el-form-item label="有货点位">
<el-input
v-model="numData.haveMoney"
disabled
style="width: 80px"
size="mini"
/>
</el-form-item>
<el-form-item label="无货点位">
<el-input
v-model="numData.unMoney"
disabled
style="width: 80px"
size="mini"
/>
</el-form-item>
</el-form>
</el-row>
<el-row>
<div id="container" className="container" />
</el-row>
<!--点击设备显示信息-->
<el-dialog
id="dialogs"
title="点位信息"
class="newDialog"
:visible.sync="dialogDeviceMsgVisible"
width="22%"
:top="tops"
:show-close="false"
:modal="false"
>
<el-table
:data="arr"
style="width: 100%"
max-height="500px"
>
<el-table-column
prop="name"
label="监控项"
/>
<el-table-column
prop="value"
label="当前值"
/>
</el-table>
</el-dialog>
<!--弹窗设置设备与图标绑定与角度-->
<el-dialog title="点位操作" :visible.sync="dialogFormVisible1" width="35%">
<el-form :model="form" size="small">
<el-form-item label="点位编码:" prop="device_code" label-width="80px">
<el-input v-model="form.point_code" :disabled="true" />
</el-form-item>
<el-form-item label="木箱号:" label-width="80px">
<el-input v-model="form.vehicle_code" :disabled="true" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible1 = false"> </el-button>
<el-button type="primary" @click="unlock" v-permission="permission.confirm" > </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import crudStage from '@/api/logicflow/stage'
import '@logicflow/core/dist/style/index.css'
import '@logicflow/extension/lib/style/index.css'
import uuidv1 from 'uuid/v1'
import { LogicFlow } from '@logicflow/core'
import { registerCustomElement } from '@/views/system/logicflow/editor/components/node'
import { getStructByCodesFsTwo, unLockPointTwo, queryNumTwo } from '@/views/system/monitor/device/structStage'
let data = {}
let lf = ''
export default {
// 发货区监控
name: 'SendoutTwo',
data() {
return {
stageParam: 'FS_two', // 舞台参数
dialogDeviceMsgVisible: false,
device_code: null,
tops: '20vh',
stage_code: '',
stageSelectList: [],
resion: {},
arr: [], // 显示数组
dialogFormVisible: false,
dialogFormVisible1: false,
dialogFormVisible2: false,
dialogFormVisible3: false,
dialogFormVisible4: false,
form: {
point_code: '',
vehicle_code: ''
},
permission: {
confirm: ['admin', 'sendout:unlock']
},
allStructMsg: [],
msgTop: '200px',
msgLeft: '200px',
numData: {
haveMoney: null,
unMoney: null
},
layerNum: '1'
}
},
mounted() {
this.init()
this.queryNumTwo()
},
beforeDestroy() {
// js提供的clearInterval方法用来清除定时器
console.log('定时器销毁')
clearInterval(this.timer)
},
methods: {
// 流程图初始化
init() {
// 初始化配置
lf = new LogicFlow({
overlapMode: 1,
container: document.querySelector('#container'), // 容器
// 画布配置
// width: window.innerWidth, // 宽度
height: window.innerHeight, // 高度
grid: { // 不用格子直接显示,使用背景
visible: false,
type: 'mesh',
size: 5
},
background: {
// backgroundImage: 'url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTSAwIDEwIEwgNDAgMTAgTSAxMCAwIEwgMTAgNDAgTSAwIDIwIEwgNDAgMjAgTSAyMCAwIEwgMjAgNDAgTSAwIDMwIEwgNDAgMzAgTSAzMCAwIEwgMzAgNDAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2QwZDBkMCIgb3BhY2l0eT0iMC4yIiBzdHJva2Utd2lkdGg9IjEiLz48cGF0aCBkPSJNIDQwIDAgTCAwIDAgMCA0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZDBkMGQwIiBzdHJva2Utd2lkdGg9IjEiLz48L3BhdHRlcm4+PC9kZWZzPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JpZCkiLz48L3N2Zz4=")',
backgroundRepeat: 'repeat'
},
adjustEdge: false,
adjustEdgeMiddle: false,
adjustEdgeStartAndEnd: false,
adjustNodePosition: false,
hideAnchors: true,
nodeTextEdit: false,
edgeTextEdit: false
})
lf.setTheme(
{
baseEdge: { strokeWidth: 1 },
baseNode: { strokeWidth: 1 },
nodeText: { overflowMode: 'autoWrap', lineHeight: 1.5 },
edgeText: { overflowMode: 'autoWrap', lineHeight: 1.5 }
}
)
// 注册自定义元素
registerCustomElement(lf)
// 删除默认的右键菜单
lf.extension.menu.setMenuConfig({
nodeMenu: false
})
lf.on('node:click', (data, e) => { // 鼠标点击节点
// 展开显示设备信息 todo: 1
if (data.data.type !== 'pro-rect' && data.data.type !== 'pro-circle' && data.data.type !== 'triangle' && data.data.type !== 'rect-radius') {
if (data.data.properties.struct_id) {
this.moveShow(data.data) // 传递节点数据用来获取id做比对
this.dialogDeviceMsgVisible = true
this.struct_id = data.data.properties.struct_id // ?暂时没用
this.tops = data.e.y + 'px'
document.getElementsByClassName('el-dialog')[0].style.marginLeft = data.e.x + 'px'
}
}
})
// 右键单击事件
lf.on('node:contextmenu', (data, e) => {
let item = ''
item = this.allStructMsg.find((structMsg) => structMsg.id === data.data.id)
const data1 = item.data[0]
this.form.point_code = data1.point_code
this.form.vehicle_code = data1.vehicle_code
this.dialogFormVisible1 = true
})
// lf.on('node:mouseleave', (data, e) => {
// this.dialogDeviceMsgVisible = false
// })
// 开始渲染
lf.render(data)
this.initStageData()
},
webSocketOnMessage(e) {
const records = JSON.parse(e.data)
this.allStructMsg = records.data
this.numData.haveMoney = records.haveMoney
this.numData.unMoney = records.unMoney
for (var item of records.data) { // 循环设置属性
if (item.struct_status != undefined) {
lf.setProperties(item.id, {
struct_status: item.struct_status
})
}
}
const { nodes } = lf.getSelectElements() // 获取选中的节点
if (nodes.length === 1) { // 因为是定时器,没有选中则不用实时更新显示数据
this.moveShow(nodes[0]) // 监控模式下不可能托选,因此就只有一个数据
}
},
initStageData() {
// 获取舞台编码
crudStage.getNewStageDataByCode(this.stageParam).then(res => {
data = JSON.parse(res.stage_data)
lf.render(data)
this.initStatus()
})
// todo: 定时器
this.timer = setInterval(() => { // 定时刷新设备的状态信息
console.log('定时器启动')
this.initStatus()
}, 6000)
},
initStatus() { // 初始化数据
this.resion = lf.getGraphData().nodes.map(item => ({ id: item.id, struct_id: item.properties.struct_id }))
getStructByCodesFsTwo(this.resion).then(res => {
this.allStructMsg = res
// 实时设置状态信息
for (var item of res) { // 循环设置属性
if (item.struct_status != undefined) {
lf.setProperties(item.id, {
struct_status: item.struct_status
})
}
}
// 设置动态实时显示设备信息
const { nodes } = lf.getSelectElements() // 获取选中的节点
if (nodes.length === 1) { // 因为是定时器,没有选中则不用实时更新显示数据
this.moveShow(nodes[0]) // 监控模式下不可能托选,因此就只有一个数据
}
})
this.queryNumTwo()
},
moveShow(nodeData) { // 点击之后显示出来的数据----只需要设备信息
let item = ''
// 查找点击节点的id
item = this.allStructMsg.find((structMsg) => structMsg.id === nodeData.id)
this.arr = [] // 清空
if (item.struct_id && item.data) { // item.data是数组
this.arr = [
{ name: '货位编号', value: item.struct_code }
]
const data1 = item.data[0] // 至少有一条
const data = item.data // 总的data数据
// 以下是设置参数显示值
for (const val in data1) {
if (val === 'vehicle_code' && data1.vehicle_code) {
const obj = { name: '木箱号', value: data1[val] }
this.arr.push(obj)
}
if (val === 'quanlity_in_box' && data1.quanlity_in_box) {
const obj = { name: '子卷数', value: data1[val] }
this.arr.push(obj)
}
if (val === 'sale_order_name' && data1.sale_order_name) {
const obj = { name: '订单号', value: data1[val] }
this.arr.push(obj)
}
if (val === 'product_description' && data1.product_description) {
const obj = { name: '物料', value: data1[val] }
this.arr.push(obj)
}
if (val === 'box_weight' && data1.box_weight) {
const obj = { name: '木箱总重', value: data1[val] }
this.arr.push(obj)
}
if (val === 'container_weight' && data1.container_weight) {
const obj = { name: '子卷净重', value: data1[val] }
this.arr.push(obj)
}
}
if (data.length > 1) { // 显示子卷
for (let i = 0; i < data.length; i++) {
let container_name
let net_weight
for (const val in data[i]) {
if (val === 'container_name' && data[i].container_name) {
container_name = data[i][val]
}
if (val === 'net_weight' && data[i].net_weight) {
net_weight = data[i][val]
}
}
if (container_name && net_weight) {
const obj = { name: container_name, value: net_weight }
this.arr.push(obj)
}
}
}
}
},
unlock() {
// 解锁点位
if (this.form.vehicle_code === '') {
this.$message({
message: '此点位已解绑',
type: 'warning'
})
return
}
unLockPointTwo(this.form).then(res => {
this.dialogFormVisible1 = false
this.initStageData()
this.queryNumTwo()
this.$message({
message: '解绑成功',
type: 'success'
})
})
},
changeStage(value) {
if (value === 'FS_1') {
this.layerNum = '1'
} else if (value === 'FS_2') {
this.layerNum = '2'
}
this.initStageData()
this.queryNumTwo()
},
queryNumTwo() {
queryNumTwo({}).then(res => {
this.numData.haveMoney = res.haveMoney
this.numData.unMoney = res.unMoney
})
}
}
}
</script>
<style>
html, body {
height: 100%;
}
body {
padding: 0;
margin: 0;
}
</style>
<style scoped>
.container {
background-color: #f8f9fa;
height: 100%;
}
.newDialog /deep/ .el-dialog__header {
padding: 1vh 1vw 0 1vw;
}
.newDialog /deep/ .el-dialog__body {
padding: 1vh 1vw;
}
.toolbar-sty {
position: absolute;
margin-top: 5px;
top: 0;
padding: 5px;
left: 30px;
height: 45px;
/*width: 310px;*/
display: flex;
align-items: center;
border-bottom: 1px solid #e5e5e5;
z-index: 10;
background: #e5e5e5;
}
</style>