更新
This commit is contained in:
@@ -787,6 +787,50 @@ public class AMHandServiceImpl implements AMHandService {
|
||||
if (StrUtil.equals(material_type, "1")) {
|
||||
status = "1";
|
||||
}
|
||||
|
||||
if (device_codes.size() > 2) {
|
||||
throw new BadRequestException("所选设备个数不能大于2!");
|
||||
}
|
||||
if (device_codes.size() == 2) {
|
||||
//将数组转换为集合判断是否为同一排的库位,并按照库位顺序号排序
|
||||
List<String> start_device_code_list = JSONArray.parseArray(device_codes.toJSONString(), String.class);
|
||||
Collections.sort(start_device_code_list, new Comparator<String>() {
|
||||
@Override
|
||||
public int compare(String s1, String s2) {
|
||||
String start_i = s1.split("_")[0];
|
||||
String start_j = s2.split("_")[0];
|
||||
if (!StrUtil.equals(start_i, start_j)) {
|
||||
throw new BadRequestException("请选择同一排待塑区库位!");
|
||||
}
|
||||
int end_i = Integer.parseInt(s1.split("_")[s1.split("_").length - 1]);
|
||||
int end_j = Integer.parseInt(s2.split("_")[s2.split("_").length - 1]);
|
||||
if (end_i > end_j) {
|
||||
return 1;
|
||||
} else if (end_i < end_j) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
String s = start_device_code_list.get(0);
|
||||
String e = start_device_code_list.get(1);
|
||||
String row_num = s.split("_")[0];
|
||||
int s_col_num = Integer.parseInt(s.split("_")[s.split("_").length - 1]);
|
||||
int e_col_num = Integer.parseInt(e.split("_")[e.split("_").length - 1]);
|
||||
device_codes = new JSONArray();
|
||||
// start_device_codes = JSONArray.parseArray(JSON.toJSONString(start_device_code_list));
|
||||
for (int i = s_col_num; i <= e_col_num; i++) {
|
||||
String col_num = "";
|
||||
if (i < 10) {
|
||||
col_num = "0" + i;
|
||||
} else {
|
||||
col_num = String.valueOf(i);
|
||||
}
|
||||
String point_code = row_num + "_" + col_num;
|
||||
device_codes.add(point_code);
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject map = new JSONObject();
|
||||
if (StrUtil.equals(type, "1")) {
|
||||
map.put("material_type", material_type);
|
||||
@@ -907,7 +951,7 @@ public class AMHandServiceImpl implements AMHandService {
|
||||
// start_device_codes = JSONArray.parseArray(JSON.toJSONString(start_device_code_list));
|
||||
for (int i = s_col_num; i <= e_col_num; i++) {
|
||||
String col_num = "";
|
||||
if (i < 10){
|
||||
if (i < 10) {
|
||||
col_num = "0" + i;
|
||||
} else {
|
||||
col_num = String.valueOf(i);
|
||||
|
||||
Reference in New Issue
Block a user