|
|
|
@ -182,19 +182,39 @@ public class PlaceController { |
|
|
|
}else{ |
|
|
|
map.put("state",2); |
|
|
|
} |
|
|
|
Object id = map.get("id"); |
|
|
|
// 获取当前修改的库位
|
|
|
|
Place placeById = placeService.findPlaceById(ObjectFormatUtil.toInteger(id)); |
|
|
|
|
|
|
|
Map<String, Object> update = new HashMap<>(); |
|
|
|
Integer place_x = ObjectFormatUtil.toInteger(map.get("place_x")); |
|
|
|
// Integer place_y = ObjectFormatUtil.toInteger(map.get("place_y"));
|
|
|
|
Integer place_z = ObjectFormatUtil.toInteger(map.get("place_z")); |
|
|
|
String newCode = ""; |
|
|
|
if(Integer.compare(placeById.getX(),place_x) != 0 || Integer.compare(placeById.getZ(),place_z) != 0){ |
|
|
|
// 如果更改了行层
|
|
|
|
// String code = String.format("%02d", place_x) + String.format("%02d", place_y) + String.format("%02d", place_z);
|
|
|
|
newCode = String.format("%02d", place_x) + String.format("%02d", place_z); |
|
|
|
}else{ |
|
|
|
newCode = (String)map.get("code"); |
|
|
|
} |
|
|
|
String oldCode = placeById.getCode(); |
|
|
|
if(!newCode.equals(oldCode)){ |
|
|
|
// 如果编码发生改变
|
|
|
|
|
|
|
|
// 获取当前修改后的库位编码是否存在
|
|
|
|
Place placeByDidAndCode = placeService.findPlaceByDidAndCode(placeById.getDid(), oldCode); |
|
|
|
if(placeByDidAndCode != null){ |
|
|
|
// 如果存在
|
|
|
|
return new RestResponse("",12345,new StatusInfo("修改失败","该编码或位置已经存在")); |
|
|
|
} |
|
|
|
} |
|
|
|
String min = (String) map.get("min"); |
|
|
|
String max = (String) map.get("max"); |
|
|
|
// String code = String.format("%02d", place_x) + String.format("%02d", place_y) + String.format("%02d", place_z);
|
|
|
|
String oldCode = (String)map.get("code"); |
|
|
|
String code = String.format("%02d", place_x) + String.format("%02d", place_z); |
|
|
|
update.put("x", place_x); |
|
|
|
// update.put("y", place_y);
|
|
|
|
update.put("z", place_z); |
|
|
|
update.put("code", code); |
|
|
|
update.put("code", newCode); |
|
|
|
update.put("oldCode", oldCode); |
|
|
|
update.put("did", map.get("depositoryId")); |
|
|
|
if (!"".equals(min)) { |
|
|
|
@ -205,9 +225,9 @@ public class PlaceController { |
|
|
|
if (!"".equals(max)) { |
|
|
|
update.put("max", map.get("max")); |
|
|
|
} else { |
|
|
|
update.put("max", 0); |
|
|
|
update.put("max", 500); |
|
|
|
} |
|
|
|
update.put("id",map.get("id")); |
|
|
|
update.put("id", id); |
|
|
|
return CrudUtil.postHandle(placeService.UpdatePlace(update),1); |
|
|
|
} |
|
|
|
|
|
|
|
|