Merge branch 'b_lms' into master_merge
# Conflicts: # lms/nladmin-system/src/main/java/org/nl/b_lms/storage_manage/ios/service/iostorInv/util/impl/SendOutManageServiceImpl.java
This commit is contained in:
@@ -384,81 +384,68 @@ public class SendOutManageServiceImpl implements SendOutManageService {
|
||||
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)) {
|
||||
throw new BadRequestException("任务号为:"+ whereJson.getString("task_code")+ "的任务不存在!");
|
||||
}
|
||||
|
||||
String point_code4 = "";
|
||||
|
||||
// 判断当前点位是否被堵住
|
||||
JSONObject paramJson = new JSONObject();
|
||||
paramJson.put("point_code", taskJson.getString("point_code4"));
|
||||
paramJson.put("region_id", RegionTypeEnum.TWO_FH01.getId());
|
||||
List<JSONObject> isBlock = schBasePointMapper.isBlock(paramJson);
|
||||
// 所有发货区点位
|
||||
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("否"))
|
||||
);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(isBlock)) {
|
||||
// 堵住: 找这一排的的空位
|
||||
// 所有发货区点位
|
||||
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")))
|
||||
.findFirst().orElse(null);
|
||||
|
||||
SchBasePoint pointDao = pointDaoList.stream()
|
||||
.filter(row -> row.getPoint_code().equals(taskJson.getString("point_code4")))
|
||||
.findFirst().orElse(null);
|
||||
// 找出这一排所有空位
|
||||
List<SchBasePoint> rowPointList = pointDaoList.stream()
|
||||
.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()
|
||||
.filter(row -> row.getRow_num().toString().equals(pointDao.getRow_num().toString()) &&
|
||||
ObjectUtil.isEmpty(row.getVehicle_code()) &&
|
||||
row.getLock_type().equals(IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
)
|
||||
.sorted(Comparator.comparing(SchBasePoint::getIn_order_seq))
|
||||
.collect(Collectors.toList());
|
||||
// 判断是否被堵住
|
||||
for (int i = 0; i < rowPointList.size(); i++) {
|
||||
SchBasePoint json = rowPointList.get(i);
|
||||
|
||||
// 判断是否被堵住
|
||||
for (int i = 0; i < rowPointList.size(); i++) {
|
||||
SchBasePoint json = rowPointList.get(i);
|
||||
JSONObject paramJson2 = new JSONObject();
|
||||
paramJson2.put("point_code", json.getPoint_code());
|
||||
paramJson2.put("region_id", RegionTypeEnum.TWO_FH01.getId());
|
||||
List<JSONObject> isBlock2 = schBasePointMapper.isBlock(paramJson2);
|
||||
|
||||
JSONObject paramJson2 = new JSONObject();
|
||||
paramJson2.put("point_code", json.getPoint_code());
|
||||
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;
|
||||
if (ObjectUtil.isNotEmpty(isBlock2)) {
|
||||
continue;
|
||||
} else {
|
||||
// 更新现仓位
|
||||
jsonUpdate.put("lock_type", IOSEnum.LOCK_TYPE.code("其它"));
|
||||
pointTab.update(jsonUpdate,"point_code = '"+point_code4+"'");
|
||||
JSONObject jsonNewRow = JSONObject.parseObject(JSON.toJSONString(json));
|
||||
point_code4 = jsonNewRow.getString("point_code");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
point_code4 = taskJson.getString("point_code4");
|
||||
if (ObjectUtil.isEmpty(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