diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RawAssistIStorServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RawAssistIStorServiceImpl.java index 34e85c4..1a0752d 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RawAssistIStorServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RawAssistIStorServiceImpl.java @@ -1768,393 +1768,22 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { @Override public JSONObject autoDisMove(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 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; - } - } - } - } + String col_num = whereJson.getString("layer_num"); // 转库时用 + struct_jo = this.moveAutoDis(whereJson); + //移库自动扩容,再次分配库位 if (ObjectUtil.isEmpty(struct_jo)) { // 主存区类型更改成中转区类型:找一排主存区的更改中转区、把一排中转区的更改成主存区(只允许调用一次) this.updateStructSect(col_num); - struct_jo = autoDisMove2(whereJson); + struct_jo = moveAutoDis(whereJson); } return struct_jo; } - public JSONObject autoDisMove2(JSONObject whereJson) { + public JSONObject moveAutoDis(JSONObject whereJson) { /* * 分配逻辑: * 1、先查找该木箱内属于什么物料、订单,定位到具体的块、排,查看是否存在空位 diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql index 6b03d0c..ef4a61b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql @@ -483,12 +483,9 @@ OPTION 输入.sale_order_name <> "" sub.sale_order_name = 输入.sale_order_name ENDOPTION - OPTION 输入.in_layer_num <> "" sa.layer_num IN 输入.in_layer_num ENDOPTION - - GROUP BY sa.block_num,sa.row_num,sa.placement_type ORDER BY