fix:代码合并
This commit is contained in:
@@ -687,181 +687,6 @@ public class StructattrServiceImpl implements StructattrService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void oneCreate(JSONObject whereJson) {
|
||||
// 仓位表
|
||||
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr");
|
||||
// 库区表
|
||||
WQLObject sectTab = WQLObject.getWQLObject("st_ivt_sectattr");
|
||||
// 点位表
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
// 仓库表
|
||||
WQLObject storTab = WQLObject.getWQLObject("st_ivt_bsrealstorattr");
|
||||
|
||||
// 判断库区是否是虚拟区
|
||||
JSONObject jsonSect = sectTab.query("sect_id = '" + whereJson.getString("sect_id") + "'").uniqueResult(0);
|
||||
|
||||
if (!jsonSect.getString("sect_type_attr").equals("09")) {
|
||||
throw new BadRequestException("所选库区必须是虚拟区!");
|
||||
}
|
||||
|
||||
/*
|
||||
* 判断此库区是否已经生成仓位
|
||||
*/
|
||||
JSONObject jsonAttr = attrTab.query("sect_id = '" + whereJson.getString("sect_id") + "' order by struct_code DESC").uniqueResult(0);
|
||||
|
||||
// 生成数量
|
||||
int createNum = whereJson.getIntValue("num");
|
||||
// 开始生成数
|
||||
int createNum_start = 1;
|
||||
|
||||
// 前缀
|
||||
String prefix = "";
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonAttr)) {
|
||||
String struct_code = jsonAttr.getString("struct_code");
|
||||
|
||||
// 第一个-的位置
|
||||
int firstIndex = struct_code.indexOf("-");
|
||||
// 第二个-的位置
|
||||
int secondIndex = struct_code.substring(firstIndex + 1).indexOf("-") + firstIndex;
|
||||
// 最大的仓位数
|
||||
String result = struct_code.substring(firstIndex + 1, secondIndex +1);
|
||||
|
||||
createNum += Integer.parseInt(result);
|
||||
|
||||
createNum_start += Integer.parseInt(result);
|
||||
|
||||
prefix = struct_code.substring(0, firstIndex);
|
||||
} else {
|
||||
// 截取第一个 - 之前的数据集合
|
||||
|
||||
List<JSONObject> attrList = WQL.getWO("QST_STRUCT_ATTR").addParam("flag", "2").process()
|
||||
.getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
|
||||
List<String> subStringList = attrList.stream()
|
||||
.filter(row -> row.getString("struct_code").contains("-"))
|
||||
.map(row -> row.getString("struct_code").substring(0, row.getString("struct_code").indexOf("-")))
|
||||
.distinct()
|
||||
.sorted()
|
||||
.filter(row -> row.matches("-?\\d+(\\.\\d+)?"))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
prefix = String.valueOf(Integer.parseInt(subStringList.get(subStringList.size() - 1)) + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* 生成货位
|
||||
*/
|
||||
String now = DateUtil.now();
|
||||
for (int i = createNum_start; i <= createNum; i++) {
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("struct_id", IdUtil.getSnowflake(1,1).nextId());
|
||||
|
||||
if (i < 10) {
|
||||
json.put("struct_code", prefix + "-"+"000"+i+"-01");
|
||||
json.put("struct_name", prefix + "排-"+"000"+i+"列-01层");
|
||||
|
||||
}else if (i >= 10 && i < 100) {
|
||||
json.put("struct_code", prefix + "-"+"00"+i+"-01");
|
||||
json.put("struct_name", prefix + "排-"+"00"+i+"列-01层");
|
||||
}else if (i >= 100 && i < 1000) {
|
||||
json.put("struct_code", prefix + "-"+"0"+i+"-01");
|
||||
json.put("struct_name", prefix + "排-"+"0"+i+"列-01层");
|
||||
} else {
|
||||
json.put("struct_code", prefix + "-"+i+"-01");
|
||||
json.put("struct_name", prefix + "排-"+i+"列-01层");
|
||||
}
|
||||
JSONObject jsonObject = storTab.query("stor_id = '"+whereJson.getString("stor_id")+"'").uniqueResult(0);
|
||||
JSONObject jsonObjec2 = sectTab.query("stor_id = '"+whereJson.getString("stor_id")+"' and sect_id = '"+whereJson.getString("sect_id")+"'").uniqueResult(0);
|
||||
|
||||
// 新增仓位
|
||||
json.put("simple_name", json.getString("struct_name"));
|
||||
json.put("sect_id", jsonObjec2.getString("sect_id"));
|
||||
json.put("sect_code", jsonObjec2.getString("sect_code"));
|
||||
json.put("sect_name", jsonObjec2.getString("sect_name"));
|
||||
json.put("stor_id", jsonObject.getString("stor_id"));
|
||||
json.put("stor_code", jsonObject.getString("stor_code"));
|
||||
json.put("stor_name", jsonObject.getString("stor_name"));
|
||||
json.put("lock_type", "1");
|
||||
json.put("row_num", 1);
|
||||
json.put("col_num", i);
|
||||
json.put("layer_num", 1);
|
||||
json.put("block_num", 1);
|
||||
json.put("in_order_seq", i);
|
||||
json.put("out_order_seq", i);
|
||||
json.put("in_empty_seq", i);
|
||||
json.put("out_empty_seq", i);
|
||||
json.put("create_id", "1");
|
||||
json.put("create_name", "管理员");
|
||||
json.put("create_time", now);
|
||||
json.put("material_height_type", 1);
|
||||
attrTab.insert(json);
|
||||
|
||||
// 新增点位
|
||||
JSONObject jsonPoint = new JSONObject();
|
||||
jsonPoint.put("point_id",IdUtil.getSnowflake(1,1).nextId());
|
||||
jsonPoint.put("point_code", json.getString("struct_code"));
|
||||
jsonPoint.put("point_name", json.getString("struct_name"));
|
||||
jsonPoint.put("region_id", json.getString("sect_id"));
|
||||
jsonPoint.put("region_code", json.getString("sect_code"));
|
||||
jsonPoint.put("region_name", json.getString("sect_name"));
|
||||
jsonPoint.put("point_type", "2");
|
||||
jsonPoint.put("point_status", "1");
|
||||
jsonPoint.put("lock_type", "1");
|
||||
jsonPoint.put("vehicle_max_qty", 0);
|
||||
jsonPoint.put("vehicle_qty", 0);
|
||||
jsonPoint.put("block_num", 1);
|
||||
jsonPoint.put("row_num", 1);
|
||||
jsonPoint.put("col_num", 1);
|
||||
jsonPoint.put("layer_num", 1);
|
||||
jsonPoint.put("in_order_seq", 0);
|
||||
jsonPoint.put("out_order_seq", 0);
|
||||
jsonPoint.put("in_empty_seq", 0);
|
||||
jsonPoint.put("out_empty_seq", 0);
|
||||
jsonPoint.put("is_have_workder", "0");
|
||||
jsonPoint.put("is_used", "1");
|
||||
jsonPoint.put("source_id", json.get("struct_id"));
|
||||
jsonPoint.put("is_delete", "0");
|
||||
jsonPoint.put("create_id", "1");
|
||||
jsonPoint.put("create_name", "管理员");
|
||||
jsonPoint.put("create_time", now);
|
||||
pointTab.insert(jsonPoint);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blurQuery(JSONObject whereJson) {
|
||||
// 仓位表
|
||||
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr");
|
||||
|
||||
/*
|
||||
* 判断前缀是否存在
|
||||
*/
|
||||
List<JSONObject> attrList = WQL.getWO("QST_STRUCT_ATTR").addParam("flag", "2").process()
|
||||
.getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
|
||||
// 截取第一个 - 之前的数据集合
|
||||
List<String> subStringList = attrList.stream()
|
||||
.filter(row -> row.getString("struct_code").contains("-"))
|
||||
.map(row -> row.getString("struct_code").substring(0, row.getString("struct_code").indexOf("-")))
|
||||
.distinct()
|
||||
.sorted()
|
||||
.filter(row -> row.matches("-?\\d+(\\.\\d+)?"))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 判断是否有相同的前缀
|
||||
boolean is_like = subStringList.stream()
|
||||
.anyMatch(row -> row.equals(whereJson.getString("prefix")));
|
||||
|
||||
if (is_like) {
|
||||
throw new BadRequestException("此前缀已存在,请更换!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tunConfirm(JSONObject json) {
|
||||
WQLObject tab = WQLObject.getWQLObject("st_ivt_structattr");
|
||||
|
||||
@@ -929,74 +929,4 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject sendSalesIvtMsg(String file_name) {
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
if (StrUtil.equals("0", is_connect_mes)) {
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "下发成功,但未连接飞书!");
|
||||
result.put("data", new JSONObject());
|
||||
return result;
|
||||
}
|
||||
|
||||
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("FEISHU_URL").getValue();
|
||||
String api = "/FeiShuNoticesWebApi/UploadImage";
|
||||
url = url + api +"?fileName="+file_name;
|
||||
|
||||
log.info("sendSalesIvtMsg接口输入参数为:-------------------" + url.toString());
|
||||
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.execute().body();
|
||||
result = JSONObject.parseObject(resultMsg);
|
||||
log.info("sendSalesIvtMsg接口输出参数为:-------------------" + result.toString());
|
||||
|
||||
String RTYPE = result.getString("RTYPE");
|
||||
if ("E".equals(RTYPE)) {
|
||||
throw new BadRequestException(result.getString("RTMSG"));
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("飞书提示错误:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject sendSalesIvtMsgParam(JSONObject param) {
|
||||
log.info("sendSalesIvtMsgParam接口输入参数为:-------------------" + param.toString());
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
if (StrUtil.equals("0", is_connect_mes)) {
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "下发成功,但未连接飞书!");
|
||||
result.put("data", new JSONObject());
|
||||
return result;
|
||||
}
|
||||
|
||||
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("FEISHU_URL").getValue();
|
||||
String api = "/FeiShuNoticesWebApi/SendCard";
|
||||
url = url + api;
|
||||
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(String.valueOf(param))
|
||||
.execute().body();
|
||||
result = JSONObject.parseObject(resultMsg);
|
||||
log.info("sendSalesIvtMsgParam接口输出参数为:-------------------" + result.toString());
|
||||
|
||||
|
||||
String RTYPE = result.getString("RTYPE");
|
||||
if ("E".equals(RTYPE)) {
|
||||
throw new BadRequestException(result.getString("RTMSG"));
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("飞书提示错误:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user