opt:查询优化

This commit is contained in:
2025-11-04 17:50:58 +08:00
parent 957af8db2b
commit 0dff4de50e
3 changed files with 23 additions and 10 deletions

View File

@@ -57,7 +57,7 @@
</select> </select>
<select id="queryAllByPage" resultType="com.alibaba.fastjson.JSONObject"> <select id="queryAllByPage" resultType="com.alibaba.fastjson.JSONObject">
SELECT SELECT distinct
ext.group_id as storagevehicleext_id, ext.group_id as storagevehicleext_id,
ext.storagevehicle_code, ext.storagevehicle_code,
ext.pcsn, ext.pcsn,
@@ -80,6 +80,8 @@
INNER JOIN md_me_materialbase mater ON mater.material_id = ext.material_id INNER JOIN md_me_materialbase mater ON mater.material_id = ext.material_id
<where> <where>
1 = 1 1 = 1
And ext.`status`='02'
AND attr.occupancy_state = 3
<if test="param.stor_id != null and param.stor_id != ''"> <if test="param.stor_id != null and param.stor_id != ''">
AND AND
attr.stor_id = #{param.stor_id} attr.stor_id = #{param.stor_id}
@@ -143,6 +145,7 @@
INNER JOIN md_me_materialbase mater ON mater.material_id = ext.material_id INNER JOIN md_me_materialbase mater ON mater.material_id = ext.material_id
<where> <where>
1 = 1 1 = 1
And ext.`status`='02'
AND attr.occupancy_state = 3 AND attr.occupancy_state = 3
<if test="param.stor_id != null and param.stor_id != ''"> <if test="param.stor_id != null and param.stor_id != ''">
AND AND
@@ -182,7 +185,7 @@
</select> </select>
<select id="queryAllIn" resultType="com.alibaba.fastjson.JSONObject"> <select id="queryAllIn" resultType="com.alibaba.fastjson.JSONObject">
SELECT SELECT distinct
ext.group_id, ext.group_id,
ext.group_id as storagevehicleext_id, ext.group_id as storagevehicleext_id,
ext.storagevehicle_code, ext.storagevehicle_code,

View File

@@ -475,7 +475,7 @@ public class MesToWmsServiceImpl implements MesToWmsService {
//根据点位去查找对应的料桶号信息 //根据点位去查找对应的料桶号信息
SchBasePoint point = pointService.getPointByExtCode(dto.getDevice_code()); SchBasePoint point = pointService.getPointByExtCode(dto.getDevice_code());
if (ObjectUtil.isEmpty(point)) { if (ObjectUtil.isEmpty(point)) {
throw new BadRequestException("设备" + dto.getDevice_code() + "不存在,检验编码与LMS是否一致"); throw new BadRequestException("设备" + dto.getDevice_code() + "不存在,检验编码与LMS是否一致");
} }
String pointCode = point.getPoint_code(); String pointCode = point.getPoint_code();
//根据料桶号去载具表匹配料桶类型 //根据料桶号去载具表匹配料桶类型
@@ -495,7 +495,7 @@ public class MesToWmsServiceImpl implements MesToWmsService {
Sectattr sectattr = sectattrService.findByCode(dict.getPara1()); Sectattr sectattr = sectattrService.findByCode(dict.getPara1());
if (sectattr == null) { if (sectattr == null) {
throw new BadRequestException("未找到载具编码为" + point.getVehicle_code() + "的载具入库库区,请检查字典中是否维护!"); throw new BadRequestException("未找到载具编码为" + point.getVehicle_code() + "的载具入库库区,请检查字典中" + dict.getCode() + "是否维护参数1");
} }
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
@@ -506,8 +506,8 @@ public class MesToWmsServiceImpl implements MesToWmsService {
param.put("create_mode", IOSEnum.CREATE_MODE.code("外部接口产生")); param.put("create_mode", IOSEnum.CREATE_MODE.code("外部接口产生"));
} }
//退料
param.put("ext_task_code", dto.getTask_code()); param.put("ext_task_code", dto.getTask_code());
//退料
if ("1".equals(dto.getTask_type())) { if ("1".equals(dto.getTask_type())) {
//查询组盘 //查询组盘
GroupPlate groupPlate = iMdPbGroupplateService.getOne(new LambdaQueryWrapper<GroupPlate>() GroupPlate groupPlate = iMdPbGroupplateService.getOne(new LambdaQueryWrapper<GroupPlate>()
@@ -515,7 +515,14 @@ public class MesToWmsServiceImpl implements MesToWmsService {
.eq(GroupPlate::getGroup_id, point.getRemark()) .eq(GroupPlate::getGroup_id, point.getRemark())
.eq(GroupPlate::getStatus, "03")); .eq(GroupPlate::getStatus, "03"));
if (ObjectUtil.isEmpty(groupPlate)) { if (ObjectUtil.isEmpty(groupPlate)) {
throw new BadRequestException("点位" + point.getPoint_code() + "上的托盘不存在组盘信息!"); List<GroupPlate> groupPlateList = iMdPbGroupplateService.list(new LambdaQueryWrapper<GroupPlate>()
.eq(GroupPlate::getStoragevehicle_code, point.getVehicle_code())
.eq(GroupPlate::getStatus, "03")
.orderByDesc(GroupPlate::getCreate_time));
if(CollectionUtils.isEmpty(groupPlateList)) {
throw new BadRequestException("点位" + point.getPoint_code() + "上的托盘不存在组盘信息!");
}
groupPlate = groupPlateList.get(0);
} }
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getByCode(groupPlate.getMaterial_id(), true); MdMeMaterialbase materDao = iMdMeMaterialbaseService.getByCode(groupPlate.getMaterial_id(), true);

View File

@@ -359,12 +359,14 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
@Override @Override
public PdaResponse pickUp(JSONObject whereJson) { public PdaResponse pickUp(JSONObject whereJson) {
String vehicle_code = whereJson.getString("vehicle_code");
if(StringUtils.isBlank(vehicle_code) &&
("3".equals(whereJson.getString("point_status")) || "2".equals(whereJson.getString("point_status")))){
throw new BadRequestException("需要传入托盘编号");
}
//设置点位状态,有料,需要传入托盘编号 //设置点位状态,有料,需要传入托盘编号
if ("3".equals(whereJson.getString("point_status"))) { if ("3".equals(whereJson.getString("point_status"))) {
String vehicle_code = whereJson.getString("vehicle_code");
if(StringUtils.isBlank(vehicle_code)){
throw new BadRequestException("需要传入托盘编号");
}
//判断点位是否是空载具或者空位 //判断点位是否是空载具或者空位
//判断点位和仓位是否有正在执行的任务 //判断点位和仓位是否有正在执行的任务
List<SchBaseTask> schBaseTaskList = taskService.list(new LambdaQueryWrapper<SchBaseTask>() List<SchBaseTask> schBaseTaskList = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
@@ -426,6 +428,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
.set(SchBasePoint::getPoint_status, whereJson.getString("point_status")) .set(SchBasePoint::getPoint_status, whereJson.getString("point_status"))
.set("1".equals(whereJson.getString("point_status")), SchBasePoint::getVehicle_code, null) .set("1".equals(whereJson.getString("point_status")), SchBasePoint::getVehicle_code, null)
.set("1".equals(whereJson.getString("point_status")), SchBasePoint::getVehicle_qty, 0) .set("1".equals(whereJson.getString("point_status")), SchBasePoint::getVehicle_qty, 0)
.set("2".equals(whereJson.getString("point_status")),SchBasePoint::getVehicle_code, vehicle_code)
.eq(SchBasePoint::getPoint_code, whereJson.getString("point_code"))); .eq(SchBasePoint::getPoint_code, whereJson.getString("point_code")));
//查询点位上的载具 //查询点位上的载具