代码更新
This commit is contained in:
@@ -58,4 +58,6 @@ public interface RawAssistIStorService {
|
|||||||
|
|
||||||
JSONObject autoDis(JSONObject whereJson);
|
JSONObject autoDis(JSONObject whereJson);
|
||||||
|
|
||||||
|
JSONObject autoDisMove(JSONObject whereJson);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1093,6 +1093,300 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
|||||||
return struct_jo;
|
return struct_jo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject autoDisMove(JSONObject whereJson) {
|
||||||
|
/*
|
||||||
|
* 分配逻辑:
|
||||||
|
* 1、先查找该木箱内属于什么物料、订单,定位到具体的块、排,查看是否存在空位
|
||||||
|
* a、存在的话,优先放在这一块这一排中(遍历)
|
||||||
|
* b、不存在则根据该订单物料大概数量、选择数量相近的一个空巷道
|
||||||
|
* 1)存在空巷道
|
||||||
|
* 2)不存在,则找一个双通有空位置、数量相近的巷道
|
||||||
|
* */
|
||||||
|
|
||||||
|
|
||||||
|
JSONObject struct_jo = new JSONObject();
|
||||||
|
|
||||||
|
String box_no = whereJson.getString("box_no");
|
||||||
|
|
||||||
|
String sect_id = whereJson.getString("sect_id");
|
||||||
|
|
||||||
|
String col_num = whereJson.getString("layer_num"); // 转库时用
|
||||||
|
|
||||||
|
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + box_no + "' AND status < 3").uniqueResult(0);
|
||||||
|
|
||||||
|
String material_code = sub_jo.getString("product_name");
|
||||||
|
|
||||||
|
String sale_order_name = sub_jo.getString("sale_order_name");
|
||||||
|
|
||||||
|
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 (placement_type.equals("02")) {
|
||||||
|
// 左通
|
||||||
|
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);
|
||||||
|
break;
|
||||||
|
} else if (placement_type.equals("03")) {
|
||||||
|
// 右通
|
||||||
|
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);
|
||||||
|
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;
|
||||||
|
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;
|
||||||
|
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 (placement_type.equals("02")) {
|
||||||
|
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);
|
||||||
|
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);
|
||||||
|
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;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} 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("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 (placement_type.equals("02")) {
|
||||||
|
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;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ObjectUtil.isEmpty(struct_jo)) {
|
||||||
|
throw new BadRequestException("未查询到可用的仓位!");
|
||||||
|
}
|
||||||
|
return struct_jo;
|
||||||
|
}
|
||||||
|
|
||||||
public JSONObject queryEmpStruct(JSONObject whereJson) {
|
public JSONObject queryEmpStruct(JSONObject whereJson) {
|
||||||
JSONObject struct_jo = new JSONObject();
|
JSONObject struct_jo = new JSONObject();
|
||||||
String sect_id = whereJson.getString("sect_id");
|
String sect_id = whereJson.getString("sect_id");
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
输入.stor_id TYPEAS s_string
|
输入.stor_id TYPEAS s_string
|
||||||
输入.sap_pcsn TYPEAS s_string
|
输入.sap_pcsn TYPEAS s_string
|
||||||
输入.pcsn TYPEAS s_string
|
输入.pcsn TYPEAS s_string
|
||||||
|
输入.col_num TYPEAS s_string
|
||||||
输入.bill_status TYPEAS s_string
|
输入.bill_status TYPEAS s_string
|
||||||
输入.bill_type TYPEAS s_string
|
输入.bill_type TYPEAS s_string
|
||||||
输入.box_no TYPEAS s_string
|
输入.box_no TYPEAS s_string
|
||||||
@@ -452,6 +453,9 @@
|
|||||||
ENDOPTION
|
ENDOPTION
|
||||||
OPTION 输入.sale_order_name <> ""
|
OPTION 输入.sale_order_name <> ""
|
||||||
sub.sale_order_name = 输入.sale_order_name
|
sub.sale_order_name = 输入.sale_order_name
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.col_num <> ""
|
||||||
|
sa2.layer_num = 输入.col_num
|
||||||
ENDOPTION
|
ENDOPTION
|
||||||
GROUP BY
|
GROUP BY
|
||||||
sa2.block_num,sa2.row_num,sa2.placement_type
|
sa2.block_num,sa2.row_num,sa2.placement_type
|
||||||
@@ -498,6 +502,11 @@
|
|||||||
sa.is_delete = '0'
|
sa.is_delete = '0'
|
||||||
AND is_used = '1'
|
AND is_used = '1'
|
||||||
AND sa.sect_id = 输入.sect_id
|
AND sa.sect_id = 输入.sect_id
|
||||||
|
|
||||||
|
OPTION 输入.col_num <> ""
|
||||||
|
sa.layer_num = 输入.col_num
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
GROUP BY
|
GROUP BY
|
||||||
sa.block_num,
|
sa.block_num,
|
||||||
sa.row_num,
|
sa.row_num,
|
||||||
@@ -553,6 +562,10 @@
|
|||||||
AND is_used = '1'
|
AND is_used = '1'
|
||||||
AND placement_type = '01'
|
AND placement_type = '01'
|
||||||
AND sa.sect_id = 输入.sect_id
|
AND sa.sect_id = 输入.sect_id
|
||||||
|
|
||||||
|
OPTION 输入.col_num <> ""
|
||||||
|
sa.layer_num = 输入.col_num
|
||||||
|
ENDOPTION
|
||||||
GROUP BY
|
GROUP BY
|
||||||
sa.block_num,
|
sa.block_num,
|
||||||
sa.row_num,
|
sa.row_num,
|
||||||
|
|||||||
@@ -3396,12 +3396,15 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
|||||||
public void createMove(JSONObject whereJson) {
|
public void createMove(JSONObject whereJson) {
|
||||||
//任务表
|
//任务表
|
||||||
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task");
|
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||||
|
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr");
|
||||||
|
|
||||||
JSONArray jsonAllBlockPoint = whereJson.getJSONArray("jsonAllBlockPoint");
|
JSONArray jsonAllBlockPoint = whereJson.getJSONArray("jsonAllBlockPoint");
|
||||||
|
|
||||||
for (int i = 0; i < jsonAllBlockPoint.size(); i++) {
|
for (int i = 0; i < jsonAllBlockPoint.size(); i++) {
|
||||||
JSONObject json = jsonAllBlockPoint.getJSONObject(i);
|
JSONObject json = jsonAllBlockPoint.getJSONObject(i);
|
||||||
|
|
||||||
|
JSONObject jsonAttr = attrTab.query("struct_code = '" + json.getString("struct_code") + "'").uniqueResult(0);
|
||||||
|
|
||||||
JSONObject mapParam = new JSONObject();// 生成移库单传入参数
|
JSONObject mapParam = new JSONObject();// 生成移库单传入参数
|
||||||
JSONArray table = new JSONArray(); // 明细参数
|
JSONArray table = new JSONArray(); // 明细参数
|
||||||
mapParam.put("bill_status", "10");
|
mapParam.put("bill_status", "10");
|
||||||
@@ -3417,7 +3420,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
|||||||
JSONObject moveParam = new JSONObject();
|
JSONObject moveParam = new JSONObject();
|
||||||
moveParam.put("box_no", json.getString("storagevehicle_code"));
|
moveParam.put("box_no", json.getString("storagevehicle_code"));
|
||||||
moveParam.put("sect_id", RegionTypeEnum.ZZ01.getId());
|
moveParam.put("sect_id", RegionTypeEnum.ZZ01.getId());
|
||||||
JSONObject jsonMove = rawAssistIStorService.autoDis(moveParam);
|
moveParam.put("layer_num", jsonAttr.getString("layer_num"));
|
||||||
|
JSONObject jsonMove = rawAssistIStorService.autoDisMove(moveParam);
|
||||||
// 查询移出货位的库存物料
|
// 查询移出货位的库存物料
|
||||||
JSONObject jsonMoveIvt = WQL.getWO("ST_OUTIVT03")
|
JSONObject jsonMoveIvt = WQL.getWO("ST_OUTIVT03")
|
||||||
.addParam("flag", "6")
|
.addParam("flag", "6")
|
||||||
|
|||||||
Reference in New Issue
Block a user