rev:出库一键设置报错优化
This commit is contained in:
@@ -39,6 +39,7 @@ import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
@@ -67,8 +68,6 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
|
||||
private final RedissonClient redissonClient;
|
||||
|
||||
private JSONObject struct_jo = null;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> pageQuery(Map whereJson, Pageable page) {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
@@ -1381,6 +1380,8 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
|
||||
String col_num = whereJson.getString("layer_num"); // 转库时用
|
||||
|
||||
JSONObject struct_jo = new JSONObject();
|
||||
|
||||
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + box_no + "' AND status < 3").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(sub_jo)) {
|
||||
throw new BadRequestException("子卷包装关系不存在或已出库,请检查!");
|
||||
@@ -1743,8 +1744,389 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
|
||||
if (ObjectUtil.isEmpty(struct_jo)) {
|
||||
// 主存区类型更改成中转区类型:找一排主存区的更改中转区、把一排中转区的更改成主存区(只允许调用一次)
|
||||
updateStructSect(col_num);
|
||||
autoDisMove(whereJson);
|
||||
SpringContextHolder.getBean(RawAssistIStorServiceImpl.class).updateStructSect(col_num);
|
||||
struct_jo = autoDisMove2(whereJson);
|
||||
}
|
||||
return struct_jo;
|
||||
}
|
||||
|
||||
public JSONObject autoDisMove2(JSONObject whereJson) {
|
||||
/*
|
||||
* 分配逻辑:
|
||||
* 1、先查找该木箱内属于什么物料、订单,定位到具体的块、排,查看是否存在空位
|
||||
* a、存在的话,优先放在这一块这一排中(遍历)
|
||||
* b、不存在则根据该订单物料大概数量、选择数量相近的一个空巷道
|
||||
* 1)存在空巷道
|
||||
* 2)不存在,则找一个双通有空位置、数量相近的巷道
|
||||
* */
|
||||
|
||||
|
||||
String box_no = whereJson.getString("box_no");
|
||||
|
||||
String sect_id = whereJson.getString("sect_id");
|
||||
|
||||
String col_num = whereJson.getString("layer_num"); // 转库时用
|
||||
|
||||
JSONObject struct_jo = new JSONObject();
|
||||
|
||||
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + box_no + "' AND status < 3").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(sub_jo)) {
|
||||
throw new BadRequestException("子卷包装关系不存在或已出库,请检查!");
|
||||
}
|
||||
|
||||
String material_code = sub_jo.getString("product_name");
|
||||
|
||||
String sale_order_name = sub_jo.getString("sale_order_name");
|
||||
|
||||
double box_high = sub_jo.getDoubleValue("box_high");
|
||||
|
||||
HashMap<String, String> row_map = new HashMap<>();
|
||||
row_map.put("material_code", material_code);
|
||||
row_map.put("sale_order_name", sale_order_name);
|
||||
row_map.put("col_num", col_num);
|
||||
row_map.put("sect_id", sect_id);
|
||||
row_map.put("flag", "11");
|
||||
|
||||
//查询到当前可用的巷道
|
||||
JSONArray rowArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
||||
|
||||
for (int i = 0; i < rowArr.size(); i++) {
|
||||
JSONObject row_jo = rowArr.getJSONObject(i);
|
||||
|
||||
String block_num = row_jo.getString("block_num");
|
||||
String row_num = row_jo.getString("row_num");
|
||||
String placement_type = row_jo.getString("placement_type");
|
||||
|
||||
// 判断此排是否有除:入库锁、移入锁以外的锁
|
||||
JSONArray isLock = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('1','2','7') AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(isLock)) {
|
||||
if ("02".equals(placement_type)) {
|
||||
// 左通
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0);
|
||||
|
||||
// 判断是否是第三层 且高度是否超过仓位高度
|
||||
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) {
|
||||
if (box_high > struct_jo.getDoubleValue("height")) {
|
||||
struct_jo = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} else if ("03".equals(placement_type)) {
|
||||
// 右通
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' 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 (StrUtil.equals(struct_jo.getString("layer_num"), "3")) {
|
||||
if (box_high > struct_jo.getDoubleValue("height")) {
|
||||
struct_jo = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
// 双通
|
||||
|
||||
// 先倒序找到第一个木箱、判断上一个是否有货位
|
||||
JSONObject jsonDescBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' 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);
|
||||
|
||||
JSONObject jsonDescStruct = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(jsonDescBox)) {
|
||||
String out_order_seq = jsonDescBox.getString("out_order_seq");
|
||||
jsonDescStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' 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_num + "'AND placement_type = '" + placement_type + "' 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(jsonDescEmpStruct)) {
|
||||
String out_order_seq = jsonDescEmpStruct.getString("out_order_seq");
|
||||
jsonDescStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' 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(jsonDescStruct)) {
|
||||
struct_jo = jsonDescStruct;
|
||||
|
||||
// 判断是否是第三层 且高度是否超过仓位高度
|
||||
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) {
|
||||
if (box_high > struct_jo.getDoubleValue("height")) {
|
||||
struct_jo = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
// 没有就正序找到第一个物料、判断上一个是否有货位
|
||||
JSONObject jsonAscBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0);
|
||||
|
||||
JSONObject jsonAscStruct = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(jsonAscBox)) {
|
||||
String out_order_seq2 = jsonAscBox.getString("out_order_seq");
|
||||
// 上一个货位顺序号
|
||||
jsonAscStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' 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_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' 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");
|
||||
jsonAscStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' 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(jsonAscStruct)) {
|
||||
struct_jo = jsonAscStruct;
|
||||
|
||||
// 判断是否是第三层 且高度是否超过仓位高度
|
||||
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) {
|
||||
if (box_high > struct_jo.getDoubleValue("height")) {
|
||||
struct_jo = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
// 说明这排有任务在执行,新开一排
|
||||
//根据分切计划查询该订单物料大概还有多少未入
|
||||
row_map.put("flag", "12");
|
||||
JSONArray plan_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(plan_rows)) {
|
||||
plan_rows = new JSONArray();
|
||||
}
|
||||
//查询该销售订单及行号有多少个生成状态的箱子
|
||||
row_map.put("flag", "27");
|
||||
JSONArray box_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(box_rows)) {
|
||||
box_rows = new JSONArray();
|
||||
}
|
||||
int box_num = (int) Math.ceil(plan_rows.size() / 2) + box_rows.size();
|
||||
|
||||
//查询数量与订单物料箱子数量相近的一排
|
||||
JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("col_num", col_num).addParam("sect_id", sect_id).addParam("flag", "13").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num),block_num,row_num").process().uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(empty_row)) {
|
||||
String block_num2 = empty_row.getString("block_num");
|
||||
String row_num2 = empty_row.getString("row_num");
|
||||
String placement_type2 = empty_row.getString("placement_type");
|
||||
|
||||
if ("02".equals(placement_type)) {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num2 + "' AND row_num = '" + row_num2 + "' AND placement_type = '" + placement_type2 + "' AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq ASC").uniqueResult(0);
|
||||
|
||||
// 判断是否是第三层 且高度是否超过仓位高度
|
||||
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) {
|
||||
if (box_high > struct_jo.getDoubleValue("height")) {
|
||||
struct_jo = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num2 + "' AND row_num = '" + row_num2 + "' AND placement_type = '" + placement_type2 + "'AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq DESC").uniqueResult(0);
|
||||
|
||||
// 判断是否是第三层 且高度是否超过仓位高度
|
||||
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) {
|
||||
if (box_high > struct_jo.getDoubleValue("height")) {
|
||||
struct_jo = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
//如果查询不到空的一排,则查询有空位双通的一排
|
||||
JSONArray haveArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("col_num", col_num).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);
|
||||
|
||||
String block_num3 = have_row.getString("block_num");
|
||||
String row_num3 = have_row.getString("row_num");
|
||||
|
||||
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;
|
||||
|
||||
// 判断是否是第三层 且高度是否超过仓位高度
|
||||
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) {
|
||||
if (box_high > struct_jo.getDoubleValue("height")) {
|
||||
struct_jo = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
// 判断是否是第三层 且高度是否超过仓位高度
|
||||
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) {
|
||||
if (box_high > struct_jo.getDoubleValue("height")) {
|
||||
struct_jo = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(rowArr) || ObjectUtil.isEmpty(struct_jo)) {
|
||||
//如果不存在相同订单物料的巷道 或者未找到相同物料订单号巷道中的货位 则
|
||||
|
||||
//根据分切计划查询该订单物料大概还有多少未入
|
||||
row_map.put("flag", "12");
|
||||
JSONArray plan_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(plan_rows)) {
|
||||
plan_rows = new JSONArray();
|
||||
}
|
||||
//查询该销售订单及行号有多少个生成状态的箱子
|
||||
row_map.put("flag", "27");
|
||||
JSONArray box_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(box_rows)) {
|
||||
box_rows = new JSONArray();
|
||||
}
|
||||
int box_num = (int) Math.ceil(plan_rows.size() / 2) + box_rows.size();
|
||||
|
||||
//查询数量与订单物料箱子数量相近的一排
|
||||
JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR")
|
||||
.addParam("col_num", col_num)
|
||||
.addParam("sect_id", sect_id)
|
||||
.addParam("box_height", String.valueOf(box_high))
|
||||
.addParam("flag", "13")
|
||||
.addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num),block_num,row_num")
|
||||
.process().uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(empty_row)) {
|
||||
String block_num = empty_row.getString("block_num");
|
||||
String row_num = empty_row.getString("row_num");
|
||||
String placement_type = empty_row.getString("placement_type");
|
||||
|
||||
if ("02".equals(placement_type)) {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND placement_type = '" + placement_type + "' AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq ASC").uniqueResult(0);
|
||||
} else {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND placement_type = '" + placement_type + "'AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq DESC").uniqueResult(0);
|
||||
}
|
||||
} else {
|
||||
|
||||
//如果查询不到空的一排,则查询有空位双通的一排
|
||||
JSONArray haveArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("col_num", col_num).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);
|
||||
|
||||
String block_num3 = have_row.getString("block_num");
|
||||
String row_num3 = have_row.getString("row_num");
|
||||
|
||||
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;
|
||||
|
||||
// 判断是否是第三层 且高度是否超过仓位高度
|
||||
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) {
|
||||
if (box_high > struct_jo.getDoubleValue("height")) {
|
||||
struct_jo = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
// 判断是否是第三层 且高度是否超过仓位高度
|
||||
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) {
|
||||
if (box_high > struct_jo.getDoubleValue("height")) {
|
||||
struct_jo = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return struct_jo;
|
||||
}
|
||||
@@ -2132,7 +2514,11 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
dtl_wql.update(map, "iostorinv_id = '" + mst_row.get("iostorinv_id") + "'");
|
||||
}
|
||||
|
||||
private void updateStructSect(String layer_num) {
|
||||
/**
|
||||
* 新开事务,把当前事务挂起,(新开事务不回滚)
|
||||
*/
|
||||
@Transactional(propagation=Propagation.REQUIRES_NEW)
|
||||
public void updateStructSect(String layer_num) {
|
||||
WQLObject attr = WQLObject.getWQLObject("st_ivt_structattr");
|
||||
WQLObject point = WQLObject.getWQLObject("sch_base_point");
|
||||
/*
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
sa.is_delete = '0'
|
||||
AND sa.is_used = '1'
|
||||
AND sa.sect_code = 'ZC01'
|
||||
AND sa.placement_type = '01'
|
||||
OPTION 输入.layer_num <> ""
|
||||
sa.layer_num = 输入.layer_num
|
||||
ENDOPTION
|
||||
@@ -79,6 +80,7 @@
|
||||
AND sa2.is_delete = '0'
|
||||
AND sa2.sect_code = 'ZC01'
|
||||
AND IFNULL( sa2.storagevehicle_code, '' ) = ''
|
||||
AND sa2.placement_type = '01'
|
||||
OPTION 输入.layer_num <> ""
|
||||
sa2.layer_num = 输入.layer_num
|
||||
ENDOPTION
|
||||
@@ -113,6 +115,7 @@
|
||||
AND sa.is_used = '1'
|
||||
AND sa.lock_type = '1'
|
||||
AND sa.sect_code = 'ZC01'
|
||||
AND sa.placement_type = '01'
|
||||
OPTION 输入.layer_num <> ""
|
||||
sa.layer_num = 输入.layer_num
|
||||
ENDOPTION
|
||||
@@ -137,6 +140,7 @@
|
||||
AND sa2.is_used = '1'
|
||||
AND sa2.is_delete = '0'
|
||||
AND sa2.sect_code = 'ZC01'
|
||||
AND sa2.placement_type = '01'
|
||||
AND IFNULL( sa2.storagevehicle_code, '' ) = ''
|
||||
OPTION 输入.layer_num <> ""
|
||||
sa2.layer_num = 输入.layer_num
|
||||
|
||||
Reference in New Issue
Block a user