rev:发货区修改
This commit is contained in:
@@ -384,80 +384,69 @@ public class SendOutManageServiceImpl implements SendOutManageService {
|
|||||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
|
||||||
// 根据任务号找到第一次申请时的任务
|
// 根据任务号找到第一次申请时的任务
|
||||||
JSONObject taskJson = taskTab.query("task_code = '" + whereJson.getString("task_code") + "'").uniqueResult(0);
|
JSONObject taskJson = taskTab.query("task_code = '" + whereJson.getString("task_code") + "' AND is_delete = '0'").uniqueResult(0);
|
||||||
if (ObjectUtil.isEmpty(taskJson)) {
|
if (ObjectUtil.isEmpty(taskJson)) {
|
||||||
throw new BadRequestException("任务号为:"+ whereJson.getString("task_code")+ "的任务不存在!");
|
throw new BadRequestException("任务号为:"+ whereJson.getString("task_code")+ "的任务不存在!");
|
||||||
}
|
}
|
||||||
|
|
||||||
String point_code4 = "";
|
String point_code4 = "";
|
||||||
|
|
||||||
// 判断当前点位是否被堵住
|
// 所有发货区点位
|
||||||
JSONObject paramJson = new JSONObject();
|
List<SchBasePoint> pointDaoList = ischBasePointService.list(
|
||||||
paramJson.put("point_code", taskJson.getString("point_code4"));
|
new QueryWrapper<SchBasePoint>().lambda()
|
||||||
paramJson.put("region_id", RegionTypeEnum.TWO_FH01.getId());
|
.eq(SchBasePoint::getRegion_id, RegionTypeEnum.TWO_FH01.getId())
|
||||||
List<JSONObject> isBlock = schBasePointMapper.isBlock(paramJson);
|
.eq(SchBasePoint::getIs_used, IOSEnum.IS_NOTANDYES.code("是"))
|
||||||
|
.eq(SchBasePoint::getIs_delete, IOSEnum.IS_NOTANDYES.code("否"))
|
||||||
|
);
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(isBlock)) {
|
SchBasePoint pointDao = pointDaoList.stream()
|
||||||
// 堵住: 找这一排的的空位
|
.filter(row -> row.getPoint_code().equals(taskJson.getString("point_code4")))
|
||||||
// 所有发货区点位
|
.findFirst().orElse(null);
|
||||||
List<SchBasePoint> pointDaoList = ischBasePointService.list(
|
|
||||||
new QueryWrapper<SchBasePoint>().lambda()
|
|
||||||
.eq(SchBasePoint::getRegion_id, RegionTypeEnum.TWO_FH01.getId())
|
|
||||||
.eq(SchBasePoint::getIs_used, IOSEnum.IS_NOTANDYES.code("是"))
|
|
||||||
.eq(SchBasePoint::getIs_delete, IOSEnum.IS_NOTANDYES.code("否"))
|
|
||||||
);
|
|
||||||
|
|
||||||
SchBasePoint pointDao = pointDaoList.stream()
|
// 找出这一排所有空位
|
||||||
.filter(row -> row.getPoint_code().equals(taskJson.getString("point_code4")))
|
List<SchBasePoint> rowPointList = pointDaoList.stream()
|
||||||
.findFirst().orElse(null);
|
.filter(row -> row.getRow_num().toString().equals(pointDao.getRow_num().toString()) &&
|
||||||
|
ObjectUtil.isEmpty(row.getVehicle_code())
|
||||||
|
)
|
||||||
|
.sorted(Comparator.comparing(SchBasePoint::getIn_order_seq))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
// 找出这一排所有空位
|
// 判断是否被堵住
|
||||||
List<SchBasePoint> rowPointList = pointDaoList.stream()
|
for (int i = 0; i < rowPointList.size(); i++) {
|
||||||
.filter(row -> row.getRow_num().toString().equals(pointDao.getRow_num().toString()) &&
|
SchBasePoint json = rowPointList.get(i);
|
||||||
ObjectUtil.isEmpty(row.getVehicle_code()) &&
|
|
||||||
row.getLock_type().equals(IOSEnum.LOCK_TYPE.code("未锁定"))
|
|
||||||
)
|
|
||||||
.sorted(Comparator.comparing(SchBasePoint::getIn_order_seq))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
// 判断是否被堵住
|
JSONObject paramJson2 = new JSONObject();
|
||||||
for (int i = 0; i < rowPointList.size(); i++) {
|
paramJson2.put("point_code", json.getPoint_code());
|
||||||
SchBasePoint json = rowPointList.get(i);
|
paramJson2.put("region_id", RegionTypeEnum.TWO_FH01.getId());
|
||||||
|
List<JSONObject> isBlock2 = schBasePointMapper.isBlock(paramJson2);
|
||||||
|
|
||||||
JSONObject paramJson2 = new JSONObject();
|
if (ObjectUtil.isNotEmpty(isBlock2)) {
|
||||||
paramJson2.put("point_code", json.getPoint_code());
|
continue;
|
||||||
paramJson2.put("region_id", RegionTypeEnum.TWO_FH01.getId());
|
|
||||||
List<JSONObject> isBlock2 = schBasePointMapper.isBlock(paramJson2);
|
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(isBlock2)) {
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
JSONObject jsonNewRow = JSONObject.parseObject(JSON.toJSONString(rowPointList.get(0)));
|
|
||||||
point_code4 = jsonNewRow.getString("point_code");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新原仓位
|
|
||||||
JSONObject jsonUpdate = new JSONObject();
|
|
||||||
jsonUpdate.put("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"));
|
|
||||||
pointTab.update(jsonUpdate,"point_code = '"+taskJson.getString("point_code4")+"'");
|
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(point_code4)) {
|
|
||||||
// 如果没有找到此排空位 则重新下发到别的排
|
|
||||||
JSONObject param = new JSONObject();
|
|
||||||
param.put("device_code", taskJson.getString("point_code2"));
|
|
||||||
param.put("vehicle_code", taskJson.getString("vehicle_code"));
|
|
||||||
createSendOutTaskOne(param);
|
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
// 更新现仓位
|
JSONObject jsonNewRow = JSONObject.parseObject(JSON.toJSONString(json));
|
||||||
jsonUpdate.put("lock_type", IOSEnum.LOCK_TYPE.code("其它"));
|
point_code4 = jsonNewRow.getString("point_code");
|
||||||
pointTab.update(jsonUpdate,"point_code = '"+point_code4+"'");
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
if (ObjectUtil.isEmpty(point_code4)) {
|
||||||
point_code4 = taskJson.getString("point_code4");
|
throw new BadRequestException("此排没有空位!"+pointDao.getRow_num());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断货位是否是第一次申请的货位
|
||||||
|
if (!point_code4.equals(taskJson.getString("point_code4"))) {
|
||||||
|
// 更新现仓位
|
||||||
|
JSONObject jsonUpdate = new JSONObject();
|
||||||
|
jsonUpdate.put("lock_type", IOSEnum.LOCK_TYPE.code("其它"));
|
||||||
|
pointTab.update(jsonUpdate,"point_code = '"+point_code4+"'");
|
||||||
|
|
||||||
|
// 判断此货位是否是最后一个入库的货位 如果是就解锁: 5 / 9
|
||||||
|
if ("5,9".contains(pointDao.getIn_order_seq().toString())) {
|
||||||
|
// 更新原仓位
|
||||||
|
jsonUpdate.put("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"));
|
||||||
|
pointTab.update(jsonUpdate,"point_code = '"+taskJson.getString("point_code4")+"'");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//创建任务
|
//创建任务
|
||||||
|
|||||||
Reference in New Issue
Block a user