代码更新
This commit is contained in:
@@ -808,7 +808,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
|||||||
/*
|
/*
|
||||||
* 分配逻辑:
|
* 分配逻辑:
|
||||||
* 1、先查找该木箱内属于什么物料、订单,定位到具体的块、排,查看是否存在空位
|
* 1、先查找该木箱内属于什么物料、订单,定位到具体的块、排,查看是否存在空位
|
||||||
* a、存在的话,优先放在这一块这一排中
|
* a、存在的话,优先放在这一块这一排中(遍历)
|
||||||
* b、不存在则根据该订单物料大概数量、选择数量相近的一个空巷道
|
* b、不存在则根据该订单物料大概数量、选择数量相近的一个空巷道
|
||||||
* 1)存在空巷道
|
* 1)存在空巷道
|
||||||
* 2)不存在,则找一个双通有空位置、数量相近的巷道
|
* 2)不存在,则找一个双通有空位置、数量相近的巷道
|
||||||
@@ -832,9 +832,11 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
|||||||
row_map.put("sect_id", sect_id);
|
row_map.put("sect_id", sect_id);
|
||||||
row_map.put("flag", "11");
|
row_map.put("flag", "11");
|
||||||
//查询到当前可用的巷道
|
//查询到当前可用的巷道
|
||||||
JSONObject row_jo = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().uniqueResult(0);
|
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);
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(row_jo)) {
|
|
||||||
String block_num = row_jo.getString("block_num");
|
String block_num = row_jo.getString("block_num");
|
||||||
String row_num = row_jo.getString("row_num");
|
String row_num = row_jo.getString("row_num");
|
||||||
String placement_type = row_jo.getString("placement_type");
|
String placement_type = row_jo.getString("placement_type");
|
||||||
@@ -845,9 +847,11 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
|||||||
if (placement_type.equals("02")) {
|
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);
|
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")) {
|
} 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);
|
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 {
|
} else {
|
||||||
// 双通
|
// 双通
|
||||||
|
|
||||||
@@ -870,6 +874,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
|||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(jsonDescStruct)) {
|
if (ObjectUtil.isNotEmpty(jsonDescStruct)) {
|
||||||
struct_jo = jsonDescStruct;
|
struct_jo = jsonDescStruct;
|
||||||
|
break;
|
||||||
} else {
|
} 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 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);
|
||||||
@@ -890,6 +895,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
|||||||
}
|
}
|
||||||
if (ObjectUtil.isNotEmpty(jsonAscStruct)) {
|
if (ObjectUtil.isNotEmpty(jsonAscStruct)) {
|
||||||
struct_jo = jsonAscStruct;
|
struct_jo = jsonAscStruct;
|
||||||
|
break;
|
||||||
} else {
|
} else {
|
||||||
// 说明这排有任务在执行,新开一排
|
// 说明这排有任务在执行,新开一排
|
||||||
//根据分切计划查询该订单物料大概还有多少未入
|
//根据分切计划查询该订单物料大概还有多少未入
|
||||||
@@ -915,11 +921,12 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
|||||||
|
|
||||||
if (placement_type.equals("02")) {
|
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);
|
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 {
|
} 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);
|
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 {
|
} 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);
|
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);
|
||||||
|
|
||||||
@@ -932,74 +939,24 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
|||||||
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);
|
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")) {
|
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);
|
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);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotEmpty(left_str.getString("storagevehicle_code")) || !left_str.getString("lock_type").equals("1")) {
|
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);
|
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 {
|
} else {
|
||||||
// 说明这排有任务在执行,新开一排
|
continue;
|
||||||
//根据分切计划查询该订单物料大概还有多少未入
|
|
||||||
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("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);
|
|
||||||
} 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);
|
|
||||||
}
|
|
||||||
} 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);
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
if (ObjectUtil.isEmpty(rowArr) || ObjectUtil.isEmpty(struct_jo)) {
|
||||||
}
|
//如果不存在相同订单物料的巷道 或者未找到相同物料订单号巷道中的货位 则
|
||||||
} else {
|
|
||||||
//如果不存在相同订单物料的巷道
|
|
||||||
/*//查询是否存在未完成的相同订单物流的入库单,如果存在则查询该排是否存在可用的仓位
|
|
||||||
HashMap<String,String> io_map = new HashMap<>();
|
|
||||||
io_map.put("flag","12");
|
|
||||||
io_map.put("material_code",material_code);
|
|
||||||
io_map.put("sale_order_name",sale_order_name);
|
|
||||||
JSONArray io_rows = WQL.getWO("").addParamMap(io_map).process().getResultJSONArray(0);*/
|
|
||||||
|
|
||||||
//根据分切计划查询该订单物料大概还有多少未入
|
//根据分切计划查询该订单物料大概还有多少未入
|
||||||
row_map.put("flag", "12");
|
row_map.put("flag", "12");
|
||||||
@@ -1048,6 +1005,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(struct_jo)) {
|
if (ObjectUtil.isEmpty(struct_jo)) {
|
||||||
throw new BadRequestException("未查询到可用的仓位!");
|
throw new BadRequestException("未查询到可用的仓位!");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user