|
|
|
|
@@ -928,22 +928,62 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
//如果查询不到空的一排,则查询有空位双通的一排
|
|
|
|
|
JSONObject have_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("sect_id", sect_id).addParam("flag", "14").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num)").process().uniqueResult(0);
|
|
|
|
|
JSONArray haveArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("sect_id", sect_id).addParam("flag", "14").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num)").process().getResultJSONArray(0);
|
|
|
|
|
|
|
|
|
|
for (int j = 0; j < haveArr.size(); j++) {
|
|
|
|
|
JSONObject have_row = haveArr.getJSONObject(j);
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(have_row)) {
|
|
|
|
|
String block_num3 = have_row.getString("block_num");
|
|
|
|
|
String row_num3 = have_row.getString("row_num");
|
|
|
|
|
|
|
|
|
|
//判断该排是左边为空,还是右边为空
|
|
|
|
|
JSONObject right_str = WQLObject.getWQLObject("st_ivt_structattr").query("block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' order by out_order_seq").uniqueResult(0);
|
|
|
|
|
JSONObject left_str = WQLObject.getWQLObject("st_ivt_structattr").query("block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' order by out_order_seq desc").uniqueResult(0);
|
|
|
|
|
if (StrUtil.isNotEmpty(right_str.getString("storagevehicle_code")) || !right_str.getString("lock_type").equals("1")) {
|
|
|
|
|
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq").uniqueResult(0);
|
|
|
|
|
JSONArray isLock2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('1','2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0);
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(isLock2)) {
|
|
|
|
|
// 先倒序找到第一个木箱、判断上一个是否有货位
|
|
|
|
|
JSONObject jsonDescBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq DESC").uniqueResult(0);
|
|
|
|
|
|
|
|
|
|
JSONObject jsonDescStruct2 = new JSONObject();
|
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonDescBox2)) {
|
|
|
|
|
String out_order_seq = jsonDescBox2.getString("out_order_seq");
|
|
|
|
|
jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
|
|
|
|
|
} else {
|
|
|
|
|
// 先倒序找到第一个入库锁或者移库锁、判断上一个是否有货位
|
|
|
|
|
JSONObject jsonDescEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq DESC").uniqueResult(0);
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) {
|
|
|
|
|
String out_order_seq = jsonDescEmpStruct.getString("out_order_seq");
|
|
|
|
|
jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonDescStruct2)) {
|
|
|
|
|
struct_jo = jsonDescStruct2;
|
|
|
|
|
break;
|
|
|
|
|
} else {
|
|
|
|
|
// 没有就正序找到第一个物料、判断上一个是否有货位
|
|
|
|
|
JSONObject jsonAscBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0);
|
|
|
|
|
|
|
|
|
|
JSONObject jsonAscStruct2 = new JSONObject();
|
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonAscBox2)) {
|
|
|
|
|
String out_order_seq2 = jsonAscBox2.getString("out_order_seq");
|
|
|
|
|
// 上一个货位顺序号
|
|
|
|
|
jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
|
|
|
|
|
} else {
|
|
|
|
|
JSONObject jsonAscEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0);
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) {
|
|
|
|
|
String out_order_seq2 = jsonAscEmpStruct.getString("out_order_seq");
|
|
|
|
|
jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonAscStruct2)) {
|
|
|
|
|
struct_jo = jsonAscStruct2;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isNotEmpty(left_str.getString("storagevehicle_code")) || !left_str.getString("lock_type").equals("1")) {
|
|
|
|
|
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq desc").uniqueResult(0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -987,20 +1027,61 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
//如果查询不到空的一排,则查询有空位双通的一排
|
|
|
|
|
JSONObject have_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("sect_id", sect_id).addParam("flag", "14").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num)").process().uniqueResult(0);
|
|
|
|
|
JSONArray haveArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("sect_id", sect_id).addParam("flag", "14").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num)").process().getResultJSONArray(0);
|
|
|
|
|
for (int j = 0; j < haveArr.size(); j++) {
|
|
|
|
|
JSONObject have_row = haveArr.getJSONObject(j);
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(have_row)) {
|
|
|
|
|
String block_num = have_row.getString("block_num");
|
|
|
|
|
String row_num = have_row.getString("row_num");
|
|
|
|
|
String block_num3 = have_row.getString("block_num");
|
|
|
|
|
String row_num3 = have_row.getString("row_num");
|
|
|
|
|
|
|
|
|
|
//判断该排是左边为空,还是右边为空
|
|
|
|
|
JSONObject right_str = WQLObject.getWQLObject("st_ivt_structattr").query("block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' order by out_order_seq").uniqueResult(0);
|
|
|
|
|
JSONObject left_str = WQLObject.getWQLObject("st_ivt_structattr").query("block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' order by out_order_seq desc").uniqueResult(0);
|
|
|
|
|
if (StrUtil.isNotEmpty(right_str.getString("storagevehicle_code")) || !right_str.getString("lock_type").equals("1")) {
|
|
|
|
|
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq").uniqueResult(0);
|
|
|
|
|
JSONArray isLock2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('1','2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0);
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(isLock2)) {
|
|
|
|
|
// 先倒序找到第一个木箱、判断上一个是否有货位
|
|
|
|
|
JSONObject jsonDescBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq DESC").uniqueResult(0);
|
|
|
|
|
|
|
|
|
|
JSONObject jsonDescStruct2 = new JSONObject();
|
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonDescBox2)) {
|
|
|
|
|
String out_order_seq = jsonDescBox2.getString("out_order_seq");
|
|
|
|
|
jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
|
|
|
|
|
} else {
|
|
|
|
|
// 先倒序找到第一个入库锁或者移库锁、判断上一个是否有货位
|
|
|
|
|
JSONObject jsonDescEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq DESC").uniqueResult(0);
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) {
|
|
|
|
|
String out_order_seq = jsonDescEmpStruct.getString("out_order_seq");
|
|
|
|
|
jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isNotEmpty(left_str.getString("storagevehicle_code")) || !left_str.getString("lock_type").equals("1")) {
|
|
|
|
|
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq desc").uniqueResult(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonDescStruct2)) {
|
|
|
|
|
struct_jo = jsonDescStruct2;
|
|
|
|
|
break;
|
|
|
|
|
} else {
|
|
|
|
|
// 没有就正序找到第一个物料、判断上一个是否有货位
|
|
|
|
|
JSONObject jsonAscBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0);
|
|
|
|
|
|
|
|
|
|
JSONObject jsonAscStruct2 = new JSONObject();
|
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonAscBox2)) {
|
|
|
|
|
String out_order_seq2 = jsonAscBox2.getString("out_order_seq");
|
|
|
|
|
// 上一个货位顺序号
|
|
|
|
|
jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
|
|
|
|
|
} else {
|
|
|
|
|
JSONObject jsonAscEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0);
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) {
|
|
|
|
|
String out_order_seq2 = jsonAscEmpStruct.getString("out_order_seq");
|
|
|
|
|
jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonAscStruct2)) {
|
|
|
|
|
struct_jo = jsonAscStruct2;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|