From 384872d68792ebf666c7910060bebd906f697e0f Mon Sep 17 00:00:00 2001 From: liuxy Date: Wed, 25 Oct 2023 08:58:23 +0800 Subject: [PATCH] =?UTF-8?q?rev=EF=BC=9A=E7=AB=8B=E5=BA=93=E6=94=B9?= =?UTF-8?q?=E9=80=A0=E3=80=81=E5=85=A5=E5=BA=93=E5=88=86=E9=85=8D=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BF=AE=E6=94=B9=E3=80=81=E7=A7=BB=E5=BA=93=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/RawAssistIStorServiceImpl.java | 237 +++++++++++++++++- .../st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql | 17 ++ 2 files changed, 249 insertions(+), 5 deletions(-) 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 23f5754c3..746fbe704 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 @@ -535,6 +535,34 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { struct_name = struct_jo.getString("struct_name"); } else { //更新入库分配表仓位相关字段 + + // 校验仓位是否满足此木箱高度 + JSONObject jsonSub = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + map.get("box_no") + "'").uniqueResult(0); + double box_high = jsonSub.getDoubleValue("box_high"); + + JSONObject jsonAttr = WQLObject.getWQLObject("st_ivt_structattr").query("struct_code = '" + map.get("struct_code") + "'").uniqueResult(0); + + // 入库木箱下限 + String in_download_box_high = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("in_download_box_high").getValue(); + // 入库木箱上线 + String in_up_box_high = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("in_up_box_high").getValue(); + + if (Double.parseDouble(in_download_box_high) < box_high && box_high <= Double.parseDouble(in_up_box_high)) { + if (StrUtil.equals(jsonAttr.getString("layer_num"), "3")) { + if (box_high > jsonAttr.getDoubleValue("height")) { + throw new BadRequestException("木箱高度不符,请检查!"); + } + } else if (StrUtil.equals(jsonAttr.getString("layer_num"), "1")) { + if (box_high > Double.parseDouble(in_download_box_high)) { + throw new BadRequestException("木箱高度不符,请检查!"); + } + } + } + + if (box_high > Double.parseDouble(in_up_box_high)) { + throw new BadRequestException("木箱高度不符,请检查!"); + } + sect_id = map.get("sect_id"); sect_code = map.get("sect_code"); sect_name = map.get("sect_name"); @@ -895,7 +923,31 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { // 获取系统参数入库到第几层 0-3层都可 1-1层 2-2层 3-3层 String in_layer_num = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("in_layer_num").getValue(); - row_map.put("col_num", "1,2,3".contains(in_layer_num) ? in_layer_num : ""); + /* + * 判断木箱高度能入第几层: + * 1.低于650mm 三层都可以入 + * 2.650mm > 木箱 <= 800mm, 只能入二、三层 + * 3.第三层要根据实际高度分配货位 + */ + // 入库木箱下限 + String in_download_box_high = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("in_download_box_high").getValue(); + // 入库木箱上线 + String in_up_box_high = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("in_up_box_high").getValue(); + + double box_high = sub_jo.getDoubleValue("box_high"); + + if (Double.parseDouble(in_download_box_high) < box_high && box_high <= Double.parseDouble(in_up_box_high)) { + // 只能入到 2/3层 + in_layer_num = "('2','3')"; + } else { + in_layer_num = ""; + } + + // 木箱高度大于入库上限 报错 + if (box_high > Double.parseDouble(in_up_box_high)) { + throw new BadRequestException("木箱:"+sub_jo.getString("package_box_sn")+"高度不符合要求,请检查!"); + } + row_map.put("in_layer_num", in_layer_num); //查询到当前可用的巷道 JSONArray rowArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0); @@ -913,10 +965,26 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { 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); + + // 判断是否是第三层 且高度是否超过仓位高度 + if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) { + if (box_high > struct_jo.getDoubleValue("height")) { + struct_jo = null; + continue; + } + } 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); + + // 判断是否是第三层 且高度是否超过仓位高度 + if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) { + if (box_high > struct_jo.getDoubleValue("height")) { + struct_jo = null; + continue; + } + } break; } else { // 双通 @@ -940,6 +1008,14 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { 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 { // 没有就正序找到第一个物料、判断上一个是否有货位 @@ -961,6 +1037,14 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { } 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 { // 说明这排有任务在执行,新开一排 @@ -987,9 +1071,25 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { 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); + + // 判断是否是第三层 且高度是否超过仓位高度 + 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 { @@ -1024,6 +1124,14 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { 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 { // 没有就正序找到第一个物料、判断上一个是否有货位 @@ -1045,6 +1153,14 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { } 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; } } @@ -1079,7 +1195,13 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { int box_num = (int) Math.ceil(plan_rows.size() / 2) + box_rows.size(); //查询数量与订单物料箱子数量相近的一排 - JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("col_num", "1,2,3".contains(in_layer_num) ? in_layer_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); + JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR") + .addParam("in_layer_num", in_layer_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"); @@ -1087,13 +1209,13 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { 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", "1,2,3".contains(in_layer_num) ? in_layer_num : "").addParam("sect_id", sect_id).addParam("flag", "14").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num)").process().getResultJSONArray(0); + JSONArray haveArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("in_layer_num", in_layer_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); @@ -1122,6 +1244,14 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { 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 { // 没有就正序找到第一个物料、判断上一个是否有货位 @@ -1143,6 +1273,14 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { } 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; } } @@ -1186,12 +1324,15 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { 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); @@ -1208,10 +1349,26 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { 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); + + // 判断是否是第三层 且高度是否超过仓位高度 + if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) { + if (box_high > struct_jo.getDoubleValue("height")) { + struct_jo = null; + continue; + } + } 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); + + // 判断是否是第三层 且高度是否超过仓位高度 + if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) { + if (box_high > struct_jo.getDoubleValue("height")) { + struct_jo = null; + continue; + } + } break; } else { // 双通 @@ -1235,6 +1392,14 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { 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 { // 没有就正序找到第一个物料、判断上一个是否有货位 @@ -1256,6 +1421,14 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { } 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 { // 说明这排有任务在执行,新开一排 @@ -1282,9 +1455,25 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { 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); + + // 判断是否是第三层 且高度是否超过仓位高度 + 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 { @@ -1319,6 +1508,14 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { 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 { // 没有就正序找到第一个物料、判断上一个是否有货位 @@ -1340,6 +1537,14 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { } 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; } } @@ -1374,7 +1579,13 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { 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); + 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"); @@ -1417,6 +1628,14 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { 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 { // 没有就正序找到第一个物料、判断上一个是否有货位 @@ -1438,6 +1657,14 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { } 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; } } 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 4f02dbfb1..7db7c7dfa 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 @@ -38,6 +38,8 @@ 输入.block_num TYPEAS s_string 输入.sql_str TYPEAS f_string 输入.in_stor_id TYPEAS f_string + 输入.in_layer_num TYPEAS f_string + 输入.box_height TYPEAS s_string [临时表] @@ -454,6 +456,9 @@ ENDOPTION OPTION 输入.sale_order_name <> "" sub.sale_order_name = 输入.sale_order_name + ENDOPTION + OPTION 输入.in_layer_num <> "" + sa2.layer_num in 输入.in_layer_num ENDOPTION OPTION 输入.col_num <> "" sa2.layer_num = 输入.col_num @@ -504,10 +509,18 @@ AND is_used = '1' AND sa.sect_id = 输入.sect_id + OPTION 输入.in_layer_num <> "" + sa.layer_num in 输入.in_layer_num + ENDOPTION + OPTION 输入.col_num <> "" sa.layer_num = 输入.col_num ENDOPTION + OPTION 输入.box_height <> "" + IFNULL(sa.height,0) >= 输入.box_height + ENDOPTION + GROUP BY sa.block_num, sa.row_num, @@ -564,6 +577,10 @@ AND placement_type = '01' AND sa.sect_id = 输入.sect_id + OPTION 输入.in_layer_num <> "" + sa.layer_num in 输入.in_layer_num + ENDOPTION + OPTION 输入.col_num <> "" sa.layer_num = 输入.col_num ENDOPTION