Browse Source

opt:提交仓位管理表相关代码替换

master
zds 4 weeks ago
parent
commit
268f70401d
  1. 487
      lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RawAssistIStorServiceImpl.java

487
lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RawAssistIStorServiceImpl.java

@ -810,7 +810,6 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
public void unDivStruct(Map jo) { public void unDivStruct(Map jo) {
WQLObject dis_wql = WQLObject.getWQLObject("ST_IVT_IOStorInvDis"); WQLObject dis_wql = WQLObject.getWQLObject("ST_IVT_IOStorInvDis");
WQLObject point_table = WQLObject.getWQLObject("SCH_BASE_Point"); WQLObject point_table = WQLObject.getWQLObject("SCH_BASE_Point");
WQLObject struct_table = WQLObject.getWQLObject("ST_IVT_StructAttr");
ArrayList<HashMap> rows = (ArrayList<HashMap>) jo.get("tableMater"); ArrayList<HashMap> rows = (ArrayList<HashMap>) jo.get("tableMater");
HashMap<String, String> whereJson = rows.get(0); HashMap<String, String> whereJson = rows.get(0);
@ -825,7 +824,17 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
unlock_map.put("inv_id", ""); unlock_map.put("inv_id", "");
unlock_map.put("inv_code", ""); unlock_map.put("inv_code", "");
point_table.update(unlock_map, "point_code = '" + whereJson.get("struct_code") + "'"); point_table.update(unlock_map, "point_code = '" + whereJson.get("struct_code") + "'");
struct_table.update(unlock_map, "struct_code = '" + whereJson.get("struct_code") + "'");
LambdaUpdateWrapper<Structattr> queryWrapper = new LambdaUpdateWrapper();
queryWrapper.set(Structattr::getLock_type,"1");
queryWrapper.set(Structattr::getTaskdtl_type,"");
queryWrapper.set(Structattr::getTaskdtl_id,"");
queryWrapper.set(Structattr::getTask_code,"");
queryWrapper.set(Structattr::getInv_code,"");
queryWrapper.set(Structattr::getInv_type,"");
queryWrapper.set(Structattr::getInv_id,"");
queryWrapper.eq(Structattr::getStruct_code,whereJson.get("struct_code"));
structattrMapper.update(null,queryWrapper);
//减去原货位的待入数 //减去原货位的待入数
JSONArray dis_rows = dis_wql.query("struct_code = '" + whereJson.get("struct_code") + "' AND work_status < '99'").getResultJSONArray(0); JSONArray dis_rows = dis_wql.query("struct_code = '" + whereJson.get("struct_code") + "' AND work_status < '99'").getResultJSONArray(0);
@ -1800,7 +1809,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
String col_num = whereJson.getString("layer_num"); // 转库时用 String col_num = whereJson.getString("layer_num"); // 转库时用
JSONObject struct_jo = new JSONObject(); Structattr struct_jo = new Structattr();
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + box_no + "' AND status < 3").uniqueResult(0); JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + box_no + "' AND status < 3").uniqueResult(0);
if (ObjectUtil.isEmpty(sub_jo)) { if (ObjectUtil.isEmpty(sub_jo)) {
@ -1831,15 +1840,40 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
String placement_type = row_jo.getString("placement_type"); 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)) { // 判断此排是否有除:入库锁、移入锁以外的锁
LambdaQueryWrapper<Structattr> queryWrapper = new LambdaQueryWrapper();
queryWrapper.in(Structattr::getLock_type,"1","2","7")
.eq(Structattr::getBlock_num,block_num)
.eq(Structattr::getPlacement_type,placement_type)
.eq(Structattr::getRow_num,row_num)
.eq(Structattr::getIs_delete,"0")
.eq(Structattr::getIs_used,"1");
Integer isLock = structattrMapper.selectCount(queryWrapper);
if (isLock==0) {
LambdaQueryWrapper<Structattr> queryWrapper2 = new LambdaQueryWrapper();
queryWrapper2.eq(Structattr::getLock_type,"1")
.eq(Structattr::getBlock_num,block_num)
.eq(Structattr::getPlacement_type,placement_type)
.eq(Structattr::getRow_num,row_num)
.eq(Structattr::getIs_delete,"0")
.eq(Structattr::getIs_used,"1");
if ("02".equals(placement_type)) { 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); queryWrapper2.and(lam->lam.eq(Structattr::getStoragevehicle_code,"")
.or()
.isNull(Structattr::getStoragevehicle_code))
.orderByAsc(Structattr::getOut_order_seq);
// 左通
List<Structattr> struct_jos = structattrMapper.selectList(queryWrapper2);
if(struct_jos.size()>0){
struct_jo = struct_jos.get(0);
}
// 判断是否是第三层 且高度是否超过仓位高度 // 判断是否是第三层 且高度是否超过仓位高度
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) { if (StrUtil.equals(struct_jo.getLayer_num(), "3")) {
if (box_high > struct_jo.getDoubleValue("height")) { if (box_high > struct_jo.getHeight().doubleValue()) {
struct_jo = null; struct_jo = null;
continue; continue;
} }
@ -1847,11 +1881,17 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
break; break;
} else if ("03".equals(placement_type)) { } 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); queryWrapper2.and(lam->lam.eq(Structattr::getStoragevehicle_code,"")
.or()
.isNull(Structattr::getStoragevehicle_code))
.orderByDesc(Structattr::getOut_order_seq);
List<Structattr> struct_jos = structattrMapper.selectList(queryWrapper2);
if(struct_jos.size()>0){
struct_jo = struct_jos.get(0);
}
// 判断是否是第三层 且高度是否超过仓位高度 // 判断是否是第三层 且高度是否超过仓位高度
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) { if (StrUtil.equals(struct_jo.getLayer_num(), "3")) {
if (box_high > struct_jo.getDoubleValue("height")) { if (box_high > struct_jo.getHeight().doubleValue()) {
struct_jo = null; struct_jo = null;
continue; continue;
} }
@ -1861,28 +1901,60 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
// 双通 // 双通
// 先倒序找到第一个木箱、判断上一个是否有货位 // 先倒序找到第一个木箱、判断上一个是否有货位
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); LambdaQueryWrapper<Structattr> queryWrapper4 = new LambdaQueryWrapper(queryWrapper2);
JSONObject jsonDescStruct = new JSONObject(); queryWrapper4.isNotNull(Structattr::getStoragevehicle_code)
if (ObjectUtil.isNotEmpty(jsonDescBox)) { .ne(Structattr::getStoragevehicle_code,"")
String out_order_seq = jsonDescBox.getString("out_order_seq"); .orderByDesc(Structattr::getOut_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); List<Structattr> jsonDescBoxs = structattrMapper.selectList(queryWrapper4);
} else { Structattr jsonDescStruct = new Structattr();
if (jsonDescBoxs.size()>0) {
String out_order_seq = jsonDescBoxs.get(0).getOut_order_seq();
LambdaQueryWrapper<Structattr> queryWrapper5 = new LambdaQueryWrapper(queryWrapper2);
queryWrapper5.and(lam->lam.eq(Structattr::getStoragevehicle_code,"")
.or()
.isNull(Structattr::getStoragevehicle_code))
.gt(Structattr::getOut_order_seq,out_order_seq)
.orderByAsc(Structattr::getOut_order_seq);
List<Structattr> jsonDescStructs = structattrMapper.selectList(queryWrapper5);
if(jsonDescStructs.size()>0){
jsonDescStruct = jsonDescStructs.get(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); LambdaQueryWrapper<Structattr> queryWrapper5 = new LambdaQueryWrapper();
queryWrapper5.in(Structattr::getLock_type,"2","7")
if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) { .eq(Structattr::getBlock_num,block_num)
String out_order_seq = jsonDescEmpStruct.getString("out_order_seq"); .eq(Structattr::getPlacement_type,placement_type)
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); .eq(Structattr::getRow_num,row_num)
.eq(Structattr::getIs_delete,"0")
.eq(Structattr::getIs_used,"1")
.and(lam->lam.eq(Structattr::getStoragevehicle_code,"")
.or()
.isNull(Structattr::getStoragevehicle_code))
.orderByDesc(Structattr::getOut_order_seq);
List<Structattr> jsonDescEmpStructs = structattrMapper.selectList(queryWrapper5);
if (jsonDescEmpStructs.size()>0) {
String out_order_seq = jsonDescEmpStructs.get(0).getOut_order_seq();
LambdaQueryWrapper<Structattr> queryWrapper6 = new LambdaQueryWrapper(queryWrapper2);
queryWrapper6.and(lam->lam.eq(Structattr::getStoragevehicle_code,"")
.or()
.isNull(Structattr::getStoragevehicle_code))
.gt(Structattr::getOut_order_seq,out_order_seq)
.orderByAsc(Structattr::getOut_order_seq);
List<Structattr> jsonDescStructs = structattrMapper.selectList(queryWrapper6);
if(jsonDescStructs.size()>0){
jsonDescStruct = jsonDescStructs.get(0);
}
} }
} }
if (ObjectUtil.isNotEmpty(jsonDescStruct)) { if (ObjectUtil.isNotEmpty(jsonDescStruct)) {
struct_jo = jsonDescStruct; struct_jo = jsonDescStruct;
// 判断是否是第三层 且高度是否超过仓位高度 // 判断是否是第三层 且高度是否超过仓位高度
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) { if (StrUtil.equals(struct_jo.getLayer_num(), "3")) {
if (box_high > struct_jo.getDoubleValue("height")) { if (box_high > struct_jo.getHeight().doubleValue()) {
struct_jo = null; struct_jo = null;
continue; continue;
} }
@ -1890,19 +1962,51 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
break; 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); LambdaQueryWrapper<Structattr> queryWrapper5 = new LambdaQueryWrapper(queryWrapper2);
queryWrapper5.isNotNull(Structattr::getStoragevehicle_code)
JSONObject jsonAscStruct = new JSONObject(); .ne(Structattr::getStoragevehicle_code,"")
if (ObjectUtil.isNotEmpty(jsonAscBox)) { .orderByAsc(Structattr::getOut_order_seq);
String out_order_seq2 = jsonAscBox.getString("out_order_seq"); List<Structattr> jsonAscBoxs = structattrMapper.selectList(queryWrapper5);
Structattr jsonAscStruct = new Structattr();
if (jsonAscBoxs.size()>0) {
String out_order_seq2 = jsonAscBoxs.get(0).getOut_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); LambdaQueryWrapper<Structattr> queryWrapper6 = new LambdaQueryWrapper(queryWrapper2);
} else { queryWrapper6.and(lam->lam.eq(Structattr::getStoragevehicle_code,"")
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); .or()
.isNull(Structattr::getStoragevehicle_code))
if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) { .lt(Structattr::getOut_order_seq,out_order_seq2)
String out_order_seq2 = jsonAscEmpStruct.getString("out_order_seq"); .orderByDesc(Structattr::getOut_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); List<Structattr> jsonAscStructs = structattrMapper.selectList(queryWrapper6);
if(jsonAscStructs.size()>0){
jsonAscStruct = jsonAscStructs.get(0);
}
}
else {
LambdaQueryWrapper<Structattr> queryWrapper6 = new LambdaQueryWrapper();
queryWrapper6.in(Structattr::getLock_type,"2","7")
.eq(Structattr::getBlock_num,block_num)
.eq(Structattr::getPlacement_type,placement_type)
.eq(Structattr::getRow_num,row_num)
.eq(Structattr::getIs_delete,"0")
.eq(Structattr::getIs_used,"1")
.and(lam->lam.eq(Structattr::getStoragevehicle_code,"")
.or()
.isNull(Structattr::getStoragevehicle_code))
.orderByAsc(Structattr::getOut_order_seq);
List<Structattr> jsonAscEmpStructS = structattrMapper.selectList(queryWrapper6);
if (jsonAscEmpStructS.size()>0) {
String out_order_seq2 = jsonAscEmpStructS.get(0).getOut_order_seq();
LambdaQueryWrapper<Structattr> queryWrapper7 = new LambdaQueryWrapper(queryWrapper2);
queryWrapper7.and(lam->lam.eq(Structattr::getStoragevehicle_code,"")
.or()
.isNull(Structattr::getStoragevehicle_code))
.lt(Structattr::getOut_order_seq,out_order_seq2)
.orderByDesc(Structattr::getOut_order_seq);
List<Structattr> jsonAscStructs = structattrMapper.selectList(queryWrapper7);
if(jsonAscStructs.size()>0){
jsonAscStruct = jsonAscStructs.get(0);
}
} }
} }
@ -1910,8 +2014,8 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
struct_jo = jsonAscStruct; struct_jo = jsonAscStruct;
// 判断是否是第三层 且高度是否超过仓位高度 // 判断是否是第三层 且高度是否超过仓位高度
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) { if (StrUtil.equals(struct_jo.getLayer_num(), "3")) {
if (box_high > struct_jo.getDoubleValue("height")) { if (box_high > struct_jo.getHeight().doubleValue()) {
struct_jo = null; struct_jo = null;
continue; continue;
} }
@ -1940,23 +2044,22 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
String row_num2 = empty_row.getString("row_num"); String row_num2 = empty_row.getString("row_num");
String placement_type2 = empty_row.getString("placement_type"); String placement_type2 = empty_row.getString("placement_type");
if ("02".equals(placement_type)) { LambdaQueryWrapper<Structattr> queryWrapper8 = new LambdaQueryWrapper();
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); queryWrapper8.eq(Structattr::getLock_type,"1")
.eq(Structattr::getBlock_num,block_num2)
// 判断是否是第三层 且高度是否超过仓位高度 .eq(Structattr::getPlacement_type,placement_type2)
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) { .eq(Structattr::getRow_num,row_num2)
if (box_high > struct_jo.getDoubleValue("height")) { .eq(Structattr::getIs_delete,"0")
struct_jo = null; .eq(Structattr::getIs_used,"1")
continue; .orderByAsc("02".equals(placement_type),Structattr::getOut_order_seq)
} .orderByDesc(!("02".equals(placement_type)),Structattr::getOut_order_seq);
}
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);
List<Structattr> struct_jos = structattrMapper.selectList(queryWrapper8);
if(struct_jos.size()>0){
struct_jo = struct_jos.get(0);
// 判断是否是第三层 且高度是否超过仓位高度 // 判断是否是第三层 且高度是否超过仓位高度
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) { if (StrUtil.equals(struct_jo.getLayer_num(), "3")) {
if (box_high > struct_jo.getDoubleValue("height")) { if (box_high > struct_jo.getHeight().doubleValue()) {
struct_jo = null; struct_jo = null;
continue; continue;
} }
@ -1973,23 +2076,69 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
String block_num3 = have_row.getString("block_num"); String block_num3 = have_row.getString("block_num");
String row_num3 = have_row.getString("row_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); LambdaQueryWrapper<Structattr> queryWrapper9 = new LambdaQueryWrapper();
queryWrapper9.in(Structattr::getLock_type,"1","2","7")
.eq(Structattr::getBlock_num,block_num3)
.eq(Structattr::getRow_num,row_num3)
.eq(Structattr::getIs_delete,"0")
.eq(Structattr::getIs_used,"1");
List<Structattr> isLock2s = structattrMapper.selectList(queryWrapper9);
if (ObjectUtil.isEmpty(isLock2)) { LambdaQueryWrapper<Structattr> queryWrapper10 = new LambdaQueryWrapper();
queryWrapper10.eq(Structattr::getBlock_num,block_num3)
.eq(Structattr::getRow_num,row_num3)
.eq(Structattr::getIs_delete,"0")
.eq(Structattr::getIs_used,"1");
//如果没加锁
if (isLock2s.size()==0) {
// 先倒序找到第一个木箱、判断上一个是否有货位 // 先倒序找到第一个木箱、判断上一个是否有货位
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); LambdaQueryWrapper<Structattr> queryWrapper11 = new LambdaQueryWrapper(queryWrapper10);
queryWrapper11.eq(Structattr::getLock_type,"1")
.ne(Structattr::getStoragevehicle_code,"")
.isNotNull(Structattr::getStoragevehicle_code)
.orderByDesc(Structattr::getOut_order_seq);
JSONObject jsonDescStruct2 = new JSONObject(); List<Structattr> jsonDescBox2s = structattrMapper.selectList(queryWrapper11);
if (ObjectUtil.isNotEmpty(jsonDescBox2)) { Structattr jsonDescStruct2 = new Structattr();
String out_order_seq = jsonDescBox2.getString("out_order_seq"); if (jsonDescBox2s.size()>0) {
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); String out_order_seq = jsonDescBox2s.get(0).getOut_order_seq();
LambdaQueryWrapper<Structattr> queryWrapper12 = new LambdaQueryWrapper(queryWrapper10);
queryWrapper12.eq(Structattr::getLock_type,"1")
.and(lam->lam.eq(Structattr::getStoragevehicle_code,"")
.or()
.isNull(Structattr::getStoragevehicle_code))
.gt(Structattr::getOut_order_seq,out_order_seq)
.orderByAsc(Structattr::getOut_order_seq);
List<Structattr> jsonDescStruct2s = structattrMapper.selectList(queryWrapper12);
if(jsonDescStruct2s.size()>0){
jsonDescStruct2 = jsonDescStruct2s.get(0);
}
}else { }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); LambdaQueryWrapper<Structattr> queryWrapper12 = new LambdaQueryWrapper(queryWrapper10);
queryWrapper12.in(Structattr::getLock_type,"2","7")
.and(lam->lam.eq(Structattr::getStoragevehicle_code,"")
.or()
.isNull(Structattr::getStoragevehicle_code))
.orderByDesc(Structattr::getOut_order_seq);
List<Structattr> jsonDescEmpStructs = structattrMapper.selectList(queryWrapper12);
if (jsonDescEmpStructs.size()>0) {
String out_order_seq = jsonDescEmpStructs.get(0).getOut_order_seq();
LambdaQueryWrapper<Structattr> queryWrapper13 = new LambdaQueryWrapper(queryWrapper10);
queryWrapper13.eq(Structattr::getLock_type,"1")
.and(lam->lam.eq(Structattr::getStoragevehicle_code,"")
.or()
.isNull(Structattr::getStoragevehicle_code))
.gt(Structattr::getOut_order_seq,out_order_seq)
.orderByAsc(Structattr::getOut_order_seq);
if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) { List<Structattr> jsonDescStruct2s = structattrMapper.selectList(queryWrapper13);
String out_order_seq = jsonDescEmpStruct.getString("out_order_seq"); if(jsonDescStruct2s.size()>0){
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); jsonDescStruct2 = jsonDescStruct2s.get(0);
}
} }
} }
@ -1997,8 +2146,8 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
struct_jo = jsonDescStruct2; struct_jo = jsonDescStruct2;
// 判断是否是第三层 且高度是否超过仓位高度 // 判断是否是第三层 且高度是否超过仓位高度
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) { if (StrUtil.equals(struct_jo.getLayer_num(), "3")) {
if (box_high > struct_jo.getDoubleValue("height")) { if (box_high > struct_jo.getHeight().doubleValue()) {
struct_jo = null; struct_jo = null;
continue; continue;
} }
@ -2006,28 +2155,62 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
break; break;
} else { } 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); LambdaQueryWrapper<Structattr> queryWrapper14 = new LambdaQueryWrapper(queryWrapper10);
queryWrapper14.eq(Structattr::getLock_type,"1")
.ne(Structattr::getStoragevehicle_code,"")
.isNotNull(Structattr::getStoragevehicle_code)
.orderByAsc(Structattr::getOut_order_seq);
List<Structattr> jsonAscBox2s = structattrMapper.selectList(queryWrapper14);
JSONObject jsonAscStruct2 = new JSONObject(); Structattr jsonAscStruct2 = new Structattr();
if (ObjectUtil.isNotEmpty(jsonAscBox2)) { if (jsonAscBox2s.size()>0) {
String out_order_seq2 = jsonAscBox2.getString("out_order_seq"); String out_order_seq2 = jsonAscBox2s.get(0).getOut_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); LambdaQueryWrapper<Structattr> queryWrapper15 = new LambdaQueryWrapper(queryWrapper10);
queryWrapper15.eq(Structattr::getLock_type,"1")
.and(lam->lam.eq(Structattr::getStoragevehicle_code,"")
.or()
.isNull(Structattr::getStoragevehicle_code))
.lt(Structattr::getOut_order_seq,out_order_seq2)
.orderByDesc(Structattr::getOut_order_seq);
List<Structattr> jsonAscStruct2s = structattrMapper.selectList(queryWrapper15);
if(jsonAscStruct2s.size()>0) {
jsonAscStruct2 = jsonAscStruct2s.get(0);
}
}else { }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); LambdaQueryWrapper<Structattr> queryWrapper15 = new LambdaQueryWrapper(queryWrapper10);
queryWrapper15.in(Structattr::getLock_type,"2","7")
.and(lam->lam.eq(Structattr::getStoragevehicle_code,"")
.or()
.isNull(Structattr::getStoragevehicle_code))
.orderByAsc(Structattr::getOut_order_seq);
if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) { List<Structattr> jsonAscEmpStructs = structattrMapper.selectList(queryWrapper15);
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 (jsonAscEmpStructs.size()>0) {
String out_order_seq2 = jsonAscEmpStructs.get(0).getOut_order_seq();
LambdaQueryWrapper<Structattr> queryWrapper16 = new LambdaQueryWrapper(queryWrapper10);
queryWrapper16.eq(Structattr::getLock_type,"1")
.and(lam->lam.eq(Structattr::getStoragevehicle_code,"")
.or()
.isNull(Structattr::getStoragevehicle_code))
.lt(Structattr::getOut_order_seq,out_order_seq2)
.orderByDesc(Structattr::getOut_order_seq);
List<Structattr> jsonAscStruct2s = structattrMapper.selectList(queryWrapper16);
if(jsonAscStruct2s.size()>0){
jsonAscStruct2 = jsonAscStruct2s.get(0);
} }
}
} }
if (ObjectUtil.isNotEmpty(jsonAscStruct2)) { if (ObjectUtil.isNotEmpty(jsonAscStruct2)) {
struct_jo = jsonAscStruct2; struct_jo = jsonAscStruct2;
// 判断是否是第三层 且高度是否超过仓位高度 // 判断是否是第三层 且高度是否超过仓位高度
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) { if (StrUtil.equals(struct_jo.getLayer_num(), "3")) {
if (box_high > struct_jo.getDoubleValue("height")) { if (box_high > struct_jo.getHeight().doubleValue()) {
struct_jo = null; struct_jo = null;
continue; continue;
} }
@ -2078,10 +2261,18 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
String row_num = empty_row.getString("row_num"); String row_num = empty_row.getString("row_num");
String placement_type = empty_row.getString("placement_type"); String placement_type = empty_row.getString("placement_type");
if ("02".equals(placement_type)) { LambdaQueryWrapper<Structattr> queryWrapper = new LambdaQueryWrapper();
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); queryWrapper.eq(Structattr::getLock_type,"1")
} else { .eq(Structattr::getBlock_num,block_num)
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); .eq(Structattr::getPlacement_type,placement_type)
.eq(Structattr::getRow_num,row_num)
.eq(Structattr::getIs_delete,"0")
.eq(Structattr::getIs_used,"1")
.orderByAsc("02".equals(placement_type),Structattr::getOut_order_seq)
.orderByDesc(!("02".equals(placement_type)),Structattr::getOut_order_seq);
List<Structattr> struct_jos = structattrMapper.selectList(queryWrapper);
if(struct_jos.size()>0){
struct_jo = struct_jos.get(0);
} }
} else { } else {
@ -2093,23 +2284,68 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
String block_num3 = have_row.getString("block_num"); String block_num3 = have_row.getString("block_num");
String row_num3 = have_row.getString("row_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); LambdaQueryWrapper<Structattr> queryWrapper = new LambdaQueryWrapper();
queryWrapper.notIn(Structattr::getLock_type,"1","2","7")
.eq(Structattr::getBlock_num,block_num3)
.eq(Structattr::getRow_num,row_num3)
.eq(Structattr::getIs_delete,"0")
.eq(Structattr::getIs_used,"1");
Integer isLock2 = structattrMapper.selectCount(queryWrapper);
if (ObjectUtil.isEmpty(isLock2)) { LambdaQueryWrapper<Structattr> queryWrapper2 = new LambdaQueryWrapper();
queryWrapper2.eq(Structattr::getLock_type,"1")
.eq(Structattr::getBlock_num,block_num3)
.eq(Structattr::getRow_num,row_num3)
.eq(Structattr::getIs_delete,"0")
.eq(Structattr::getIs_used,"1");
if (isLock2 == 0) {
// 先倒序找到第一个木箱、判断上一个是否有货位 // 先倒序找到第一个木箱、判断上一个是否有货位
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); LambdaQueryWrapper<Structattr> queryWrapper3 = new LambdaQueryWrapper(queryWrapper2);
queryWrapper3.ne(Structattr::getStoragevehicle_code,"")
.isNotNull(Structattr::getStoragevehicle_code)
.orderByDesc(Structattr::getOut_order_seq);
List<Structattr> jsonDescBox2s = structattrMapper.selectList(queryWrapper3);
JSONObject jsonDescStruct2 = new JSONObject(); Structattr jsonDescStruct2 = new Structattr();
if (ObjectUtil.isNotEmpty(jsonDescBox2)) { if (jsonDescBox2s.size()>0) {
String out_order_seq = jsonDescBox2.getString("out_order_seq"); String out_order_seq = jsonDescBox2s.get(0).getOut_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); LambdaQueryWrapper<Structattr> queryWrapper4 = new LambdaQueryWrapper(queryWrapper2);
queryWrapper4.and(lam->lam.eq(Structattr::getStoragevehicle_code,"")
.or()
.isNull(Structattr::getStoragevehicle_code))
.gt(Structattr::getOut_order_seq,out_order_seq)
.orderByAsc(Structattr::getOut_order_seq);
List<Structattr> jsonDescStruct2s = structattrMapper.selectList(queryWrapper4);
if(jsonDescStruct2s.size()>0){
jsonDescStruct2 = jsonDescStruct2s.get(0);
}
} else { } 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); LambdaQueryWrapper<Structattr> queryWrapper4 = new LambdaQueryWrapper(queryWrapper2);
queryWrapper4.in(Structattr::getLock_type,"1","2","7")
if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) { .and(lam->lam.eq(Structattr::getStoragevehicle_code,"")
String out_order_seq = jsonDescEmpStruct.getString("out_order_seq"); .or()
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); .isNull(Structattr::getStoragevehicle_code))
.orderByDesc(Structattr::getOut_order_seq);
List<Structattr> jsonDescEmpStructs = structattrMapper.selectList(queryWrapper4);
if (jsonDescEmpStructs.size()>0) {
String out_order_seq = jsonDescEmpStructs.get(0).getOut_order_seq();
LambdaQueryWrapper<Structattr> queryWrapper5 = new LambdaQueryWrapper(queryWrapper2);
queryWrapper5.eq(Structattr::getLock_type,"1")
.and(lam->lam.eq(Structattr::getStoragevehicle_code,"")
.or()
.isNull(Structattr::getStoragevehicle_code))
.gt(Structattr::getOut_order_seq,out_order_seq)
.orderByAsc(Structattr::getOut_order_seq);
List<Structattr> jsonDescStruct2s = structattrMapper.selectList(queryWrapper5);
if(jsonDescStruct2s.size()>0){
jsonDescStruct2 = jsonDescStruct2s.get(0);
}
} }
} }
@ -2117,8 +2353,8 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
struct_jo = jsonDescStruct2; struct_jo = jsonDescStruct2;
// 判断是否是第三层 且高度是否超过仓位高度 // 判断是否是第三层 且高度是否超过仓位高度
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) { if (StrUtil.equals(struct_jo.getLayer_num(), "3")) {
if (box_high > struct_jo.getDoubleValue("height")) { if (box_high > struct_jo.getHeight().doubleValue()) {
struct_jo = null; struct_jo = null;
continue; continue;
} }
@ -2126,19 +2362,50 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
break; break;
} else { } 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); LambdaQueryWrapper<Structattr> queryWrapper5 = new LambdaQueryWrapper(queryWrapper2);
queryWrapper5.eq(Structattr::getLock_type,"1")
.ne(Structattr::getStoragevehicle_code,"")
.isNotNull(Structattr::getStoragevehicle_code)
.orderByAsc(Structattr::getOut_order_seq);
List<Structattr> jsonAscBox2s = structattrMapper.selectList(queryWrapper5);
JSONObject jsonAscStruct2 = new JSONObject(); Structattr jsonAscStruct2 = new Structattr();
if (ObjectUtil.isNotEmpty(jsonAscBox2)) { if (jsonAscBox2s.size()>0) {
String out_order_seq2 = jsonAscBox2.getString("out_order_seq"); String out_order_seq2 = jsonAscBox2s.get(0).getOut_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); LambdaQueryWrapper<Structattr> queryWrapper4 = new LambdaQueryWrapper(queryWrapper2);
queryWrapper4.eq(Structattr::getLock_type,"1")
.and(lam->lam.eq(Structattr::getStoragevehicle_code,"")
.or()
.isNull(Structattr::getStoragevehicle_code))
.gt(Structattr::getOut_order_seq,out_order_seq2)
.orderByDesc(Structattr::getOut_order_seq);
List<Structattr> jsonAscStruct2s = structattrMapper.selectList(queryWrapper4);
if(jsonAscStruct2s.size()>0){
jsonAscStruct2 = jsonAscStruct2s.get(0);
}
}else { }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); LambdaQueryWrapper<Structattr> queryWrapper4 = new LambdaQueryWrapper(queryWrapper2);
queryWrapper4.in(Structattr::getLock_type,"2","7")
.and(lam->lam.eq(Structattr::getStoragevehicle_code,"")
.or()
.isNull(Structattr::getStoragevehicle_code))
.orderByAsc(Structattr::getOut_order_seq);
List<Structattr> jsonAscEmpStructS = structattrMapper.selectList(queryWrapper4);
if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) { if (jsonAscEmpStructS.size()>0) {
String out_order_seq2 = jsonAscEmpStruct.getString("out_order_seq"); String out_order_seq2 = jsonAscEmpStructS.get(0).getOut_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); LambdaQueryWrapper<Structattr> queryWrapper6 = new LambdaQueryWrapper(queryWrapper2);
queryWrapper6.eq(Structattr::getLock_type,"1")
.and(lam->lam.eq(Structattr::getStoragevehicle_code,"")
.or()
.isNull(Structattr::getStoragevehicle_code))
.lt(Structattr::getOut_order_seq,out_order_seq2)
.orderByDesc(Structattr::getOut_order_seq);
List<Structattr> jsonAscStruct2s = structattrMapper.selectList(queryWrapper4);
if(jsonAscStruct2s.size()>0){
jsonAscStruct2 = jsonAscStruct2s.get(0);
}
} }
} }
@ -2146,8 +2413,8 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
struct_jo = jsonAscStruct2; struct_jo = jsonAscStruct2;
// 判断是否是第三层 且高度是否超过仓位高度 // 判断是否是第三层 且高度是否超过仓位高度
if (StrUtil.equals(struct_jo.getString("layer_num"), "3")) { if (StrUtil.equals(struct_jo.getLayer_num(), "3")) {
if (box_high > struct_jo.getDoubleValue("height")) { if (box_high > struct_jo.getHeight().doubleValue()) {
struct_jo = null; struct_jo = null;
continue; continue;
} }
@ -2161,7 +2428,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
} }
} }
} }
return struct_jo; return (JSONObject) JSONObject.toJSON(struct_jo);
} }
@Override @Override

Loading…
Cancel
Save