opt: 部分优化

This commit is contained in:
2025-07-29 15:29:07 +08:00
parent c9e8e45fa4
commit a76c7657f5
5 changed files with 16 additions and 156 deletions

View File

@@ -5,7 +5,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/*
/**
* @author ZZQ
* @Date 2024/5/29 16:26
*/
@@ -17,6 +17,7 @@ public class InteracteDto<T> {
private String service;
private String type;
private String system;
private String ip;
private String request_time;
private String trace_id;

View File

@@ -1,20 +1,12 @@
package org.nl.gateway.service;
import cn.hutool.core.lang.Assert;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.RedissonUtils;
import org.nl.gateway.dto.InteracteDto;
import org.nl.gateway.service.impl.GateWayServiceImpl;
import org.nl.wms.sch_manage.service.ISchBasePointService;
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
/**
* 网关执行接口层
@@ -24,11 +16,6 @@ import java.util.concurrent.atomic.AtomicReference;
*/
@Service
public class GateWayService {
@Autowired
private GateWayServiceImpl gateWayServiceImpl;
@Autowired
private ISchBasePointService iSchBasePointService;
@Autowired
private ISchBaseTaskService iSchBaseTaskService;
@@ -38,42 +25,11 @@ public class GateWayService {
//处理日志相关
JSONObject result = new JSONObject();
String service = param.getService();
String type = param.getType();
//根据服务拆分不同的业务
if ("InStorage".equals(service)) {
RedissonUtils.lock(() -> {
String taskCode = gateWayServiceImpl.applyTask(param.getService(), type, jsonObject, param);
result.put("taskCode", taskCode);
}, param.getService() + param.getType(), null);
}
if ("Task".equals(service)) {
iSchBaseTaskService.operation(jsonObject);
}
if ("DeviceInfo".equals(service)) {
}
if ("Device".equals(service)) {
Assert.noNullElements(new Object[]{jsonObject.getString("devicePoint"), jsonObject.getString("status")}, "请求参数不能为空");
if (!"1207".equals(jsonObject.getString("devicePoint")) && !"1210".equals(jsonObject.getString("devicePoint"))) {
throw new BadRequestException("您输入的拣选位不存在请输入1207或1210拣选位!");
}
RedissonUtils.lock(() -> {
LambdaUpdateWrapper<SchBasePoint> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(SchBasePoint::getIs_used, "0".equals(jsonObject.getString("status")) ? 0 : 1);
iSchBasePointService.update(updateWrapper);
}, param.getService() + param.getType(), null);
}
if ("ErrorInfo".equals(service)) {
Assert.noNullElements(new Object[]{type, jsonObject.getString("msg")}, "请求参数不能为空");
String msg = jsonObject.getString("msg").trim();
//iSchBasePointService.sendErrorMsg(type,null, msg);
}
if ("ErrorTask".equals(service)) {
AtomicReference<JSONObject> reference = new AtomicReference<>(new JSONObject());
RedissonUtils.lock(() -> {
// reference.set(iSchBaseTaskService.errorTask(jsonObject, param.getType()));
}, param.getService() + param.getType(), null);
return reference.get();
}
return result;
}

View File

@@ -97,7 +97,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
.like(StrUtil.isNotEmpty(search), Structattr::getStruct_code, search)
.like(StrUtil.isNotEmpty(search), Structattr::getStruct_name, search)
.eq(StrUtil.isNotEmpty(stor_id), Structattr::getStor_id, stor_id)
.eq(StrUtil.isNotEmpty(sect_id), Structattr::getSect_id, sect_id)
.eq(StrUtil.isNotEmpty(sect_id), Structattr::getSect_code, sect_id)
.eq(StrUtil.isNotEmpty(lock_type), Structattr::getLock_type, lock_type)
.eq(StrUtil.isNotEmpty(layer_num), Structattr::getLayer_num, layer_num)
.eq(StrUtil.isNotEmpty(is_used), Structattr::getIs_used, is_used)
@@ -196,8 +196,9 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
dto.setUpdate_time(now);
dto.setUpdate_id(currentUserId);
dto.setUpdate_name(nickName);
Sectattr sectattr = iSectattrService.findByCode(dto.getSect_id());
Sectattr sectattr = iSectattrService.findByCode(dto.getSect_code());
BsrealStorattr bsrealStorattr = iBsrealStorattrService.findById(sectattr.getStor_id());
dto.setSect_id(sectattr.getSect_id());
dto.setSect_code(sectattr.getSect_code());
dto.setSect_name(sectattr.getSect_name());
dto.setStor_id(bsrealStorattr.getStor_id());

View File

@@ -79,107 +79,4 @@ public class AlleyAveRuleHandler extends Decisioner<Structattr, JSONObject> {
return subList;
}
// public static void main(String[] args) {
// List<Structattr> list = new ArrayList<>();
// for (int i =0;i<10;i++){
// Structattr structattr = new Structattr();
// structattr.setRow_num(new Random().nextInt(2)+1);
// structattr.setCol_num(new Random().nextInt(10)+1);
// structattr.setLayer_num(new Random().nextInt(2)+1);
// list.add(structattr);
// }
// System.out.println(list);
// ArrayList<String> of = ListOf.of("x", "z","y");
// list.sort((o1, o2) -> {
// Integer rowNum1 = o1.getRow_num();
// Integer colNum1 = o1.getCol_num();
// Integer layerNum1 = o1.getLayer_num();
// Integer rowNum2 = o2.getRow_num();
// Integer colNum2 = o2.getCol_num();
// Integer layerNum2 = o2.getLayer_num();
// HashMap<String,Integer> of1 = MapOf.of("x", rowNum1, "y", colNum1, "z", layerNum1);
// HashMap<String,Integer> of2 = MapOf.of("x", rowNum2, "y", colNum2, "z", layerNum2);
// for (String sort : of) {
// Integer in1 = of1.get(sort);
// Integer in2 = of2.get(sort);
// if (in1 > in2){
// return 1;
// }
// if (in1 < in2){
// return -1;
// }
// }
// return 0;
// });
// System.out.println(list.toString());
// }
/**
* 入库策略
*
* @param attrList :仓位集合
* @param jsonParammaterialId :物料标识(此方法只根据物料进行匹配)
* @return List<Structattr> :仓位集合
*/
// private List<Structattr> inHandler(List<Structattr> attrList, PmFormData jsonParam) {
// // in查询条件处理
// List<Integer> blockNumIn = attrList.stream()
// .map(Structattr::getBlock_num)
// .distinct()
// .collect(Collectors.toList());
// // 查询相同巷道货位相同物料
// List<Structattr> blockAttrList = null;
// iStructattrService.getByQuery(new StructattrQuery());
// // 如果为空说明这些巷道都没有相同物料的巷道,则返回所有仓位
// if (ObjectUtil.isEmpty(blockAttrList)) {
// return attrList;
// }
// // 计算每个巷道的相同物料
// Map<Integer, List<Structattr>> collectMap = blockAttrList.stream()
// .collect(Collectors.groupingBy(Structattr::getBlock_num));
// // 巷道
// int blockNum = blockAttrList.get(0).getBlock_num().intValue();
// // 集合数量
// int size = blockAttrList.size();
// for (Integer num : collectMap.keySet()) {
// int min = Math.min(size, collectMap.get(num).size());
// if (size > min) {
// // 返回最小的巷道
// blockNum = num.intValue();
// size = min;
// }
// }
// // 匹配相同巷道的集合并返回
// int finalBlockNum = blockNum;
// return attrList.stream()
// .filter(row -> row.getBlock_num().intValue() == finalBlockNum)
// .collect(Collectors.toList());
// }
/**
* 出库策略 - 查询物料最多的巷道
*
* @param attrList 仓位物料
* @return 巷道
*/
// private int getMaxMaterial(List<Structattr> attrList) {
// // 根据巷道分组
// Map<Integer, List<Structattr>> collectMap = attrList.stream()
// .collect(Collectors.groupingBy(Structattr::getBlock_num));
// // 找最大物料巷道
// // 巷道
// int blockNum = attrList.get(0).getBlock_num().intValue();
// // 集合数量
// int size = 0;
// for (Integer num : collectMap.keySet()) {
// int max = Math.max(size, collectMap.get(num).size());
// if (size < max) {
// // 返回最大的巷道
// blockNum = num.intValue();
// size = max;
// }
// }
// return blockNum;
// }
}

View File

@@ -36,7 +36,7 @@
</el-select>
</el-form-item>
<el-form-item label="立库层数">
<el-form-item label="货架层数">
<el-select
v-model="query.layer_num"
clearable
@@ -260,6 +260,11 @@
<el-table-column prop="simple_name" label="仓位简称" :min-width="flexWidth('simple_name',crud.data,'仓位简称')" />
<el-table-column prop="sect_name" label="所属库区" width="150" />
<el-table-column prop="stor_name" label="所属仓库" width="150" />
<el-table-column prop="occupancy_state" label="仓位状态" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span>{{ dict.label.occupancy_state[scope.row.occupancy_state] }}</span>
</template>
</el-table-column>
<el-table-column prop="storagevehicle_code" label="载具号" :min-width="flexWidth('storagevehicle_code',crud.data,'载具号')" />
<el-table-column prop="lock_type" label="锁定类型" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
@@ -282,7 +287,7 @@
<!-- />-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column prop="taskdtl_type" label="锁定任务类型" width="150" :formatter="taskdtl_typeFormat" />
<!-- <el-table-column prop="taskdtl_type" label="锁定任务类型" width="150" :formatter="taskdtl_typeFormat" />-->
<el-table-column prop="task_code" label="锁定任务编码" width="150" />
<el-table-column prop="inv_code" label="锁定单据编码" width="150" />
<el-table-column prop="inv_type" label="锁定单据类型" width="150" :formatter="invtypeFormat" />
@@ -373,7 +378,7 @@ const defaultForm = {
}
export default {
name: 'Structattr',
dicts: ['ST_HEIGHT_TYPE', 'is_used', 'd_lock_type', 'SCH_TASK_TYPE_DTL', 'placement_type'],
dicts: ['ST_HEIGHT_TYPE', 'is_used', 'd_lock_type', 'SCH_TASK_TYPE_DTL', 'placement_type', 'occupancy_state'],
components: { pagination, crudOperation, rrOperation, udOperation },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
@@ -465,14 +470,14 @@ export default {
[CRUD.HOOK.beforeRefresh]() {
return true
},
[CRUD.HOOK.afterToEdit](crud, form) {
[CRUD.HOOK.beforeToEdit](crud, form) {
const val = []
val[0] = form.stor_id
val[1] = form.sect_id
val[1] = form.sect_code
form.cascader = val
},
sectChange(val) {
this.form.sect_id = val[1]
this.form.sect_code = val[1]
},
openOneCreate() {
this.openOneCreateDialog = true