diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/modules/system/service/impl/EsLogServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/modules/system/service/impl/EsLogServiceImpl.java index 14c4fd2c..2a224afd 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/modules/system/service/impl/EsLogServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/modules/system/service/impl/EsLogServiceImpl.java @@ -68,7 +68,6 @@ public class EsLogServiceImpl implements EsLogService { page.setPage(logQuery.getPage()); page.setPageSize(logQuery.getSize()); res.put("total",page.getTotal()); - this.clearLogs(logQuery); } res.put("page",page); return res; @@ -86,9 +85,6 @@ public class EsLogServiceImpl implements EsLogService { if (!StringUtils.isEmpty(system)){ query.must().add(QueryBuilders.matchQuery("system", system)); } - long time = DateUtil.offset(new Date(), DateField.DAY_OF_MONTH, -7).getTime(); - String script = "doc['@timestamp'].value.millis < " + time + "L"; - query.must().add(QueryBuilders.scriptQuery(new Script(script))); DeleteQuery deleteQuery = new DeleteQuery(); deleteQuery.setQuery(query); elasticsearchRestTemplate.delete(deleteQuery,new LogRepositoryDTO().getClass()); diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/pda/st/out/service/impl/HandCleanOutIvtServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/pda/st/out/service/impl/HandCleanOutIvtServiceImpl.java index 9e7a1d59..5a4161a7 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/pda/st/out/service/impl/HandCleanOutIvtServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/pda/st/out/service/impl/HandCleanOutIvtServiceImpl.java @@ -17,6 +17,7 @@ import org.nl.pda.exception.PdaRequestException; import org.nl.pda.st.in.service.HandNewMaterialService; import org.nl.pda.st.out.service.HandCleanOutIvtService; import org.nl.utils.SecurityUtils; +import org.nl.wms.common.util.RedissonUtils; import org.nl.wms.sch.manage.AbstractAcsTask; import org.nl.wms.st.core.service.CheckOutBillService; import org.nl.wms.st.core.service.StorPublicService; @@ -358,81 +359,83 @@ public class HandCleanOutIvtServiceImpl implements HandCleanOutIvtService { if (StrUtil.isEmpty(point_code)) { throw new PdaRequestException("请选择一个站点!"); } - Long currentUserId = SecurityUtils.getCurrentUserId(); - UserDto userDto = userService.findById(currentUserId); - String storagevehicle_code = (String) jsonObject.get("storagevehicle_code"); - JSONObject inforow = WQL.getWO("QPADST_OUT_SERVICE").addParam("flag", "7").addParam("storagevehicle_code", storagevehicle_code).process().uniqueResult(0); - //生成回库指令 - if (ObjectUtil.isEmpty(inforow)) { - throw new PdaRequestException("未找到单据!"); - } - //扫托盘时校验托盘需无未完成任务 - String task_id = inforow.getString("task_id"); - if (StrUtil.isEmpty(task_id)) { - throw new PdaRequestException("出库指令未找到!"); - } - JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id='" + task_id + "' and task_status <>'99'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(taskObj)) { - throw new PdaRequestException("存在未完成的任务,不能直接回库!"); - } - double real_qty = inforow.getDoubleValue("real_qty"); - if (real_qty <= 0) { - throw new PdaRequestException("单据的实际出库数量必须大0"); - } - - JSONObject task = new JSONObject(); - String taskdtl_id = IdUtil.getSnowflake(1, 1).nextId() + ""; - String task_code = CodeUtil.getNewCode("TASK_CODE"); - task.put("taskdtl_id", taskdtl_id); - task.put("task_id", inforow.getString("task_id")); - //判断有没有重复生成回库任务 - JSONObject returnTaskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id='" + inforow.getString("task_id") + "' and is_delete<>'1' and task_status<>'99'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(returnTaskObj)) { - throw new PdaRequestException("已经生成回库任务,不能重复生成!"); - } - //判断是拣选出库,还是全出,全出不允许回库, 02 全出,05 拣选 - JSONObject taskjo = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id ='" + inforow.getString("task_id") + "' and is_delete<>'1'").uniqueResult(0); - if (ObjectUtil.isEmpty(taskjo)) { - throw new PdaRequestException("未找到出库指令!"); - } - if (StrUtil.equals(taskjo.getString("taskdtl_type"), "02")) { - throw new PdaRequestException("全出的出库单不允许回库!"); - } - task.put("task_code", task_code); - task.put("task_type", "02"); - task.put("taskdtl_type", "06"); - task.put("task_status", "01"); - task.put("start_point_code", point_code); - task.put("next_point_code", inforow.getString("struct_code")); - task.put("vehicle_code", storagevehicle_code); - task.put("handle_class", OutTask.class.getName()); - task.put("finished_type", ""); - task.put("is_delete", "0"); - task.put("create_id", currentUserId); - task.put("create_name", userDto.getNickName()); - task.put("create_time", DateUtil.now()); - task.put("update_optid", currentUserId); - task.put("update_optname", userDto.getNickName()); - task.put("update_time", DateUtil.now()); - task.put("priority", "1"); - WQLObject taskTable = WQLObject.getWQLObject("SCH_BASE_Task"); - taskTable.insert(task); - JSONObject returnjo = new JSONObject(); - //下发给acs - AbstractAcsTask intask = new InTask(); - //调用ACS接受任务接口 - JSONObject result = intask.notifyAcs(taskdtl_id); - if (ObjectUtil.isNotEmpty(result)) { - String status = result.getString("status"); - if ("200".equals(status)) { - HashMap mapnow = new HashMap<>(); - mapnow.put("task_status", "02"); - taskTable.update(mapnow, "taskdtl_id = '" + taskdtl_id + "'"); - } else { - throw new PdaRequestException("任务下发失败:" + result.getString("message")); + RedissonUtils.lock(a->{ + Long currentUserId = SecurityUtils.getCurrentUserId(); + UserDto userDto = userService.findById(currentUserId); + String storagevehicle_code = (String) jsonObject.get("storagevehicle_code"); + JSONObject inforow = WQL.getWO("QPADST_OUT_SERVICE").addParam("flag", "7").addParam("storagevehicle_code", storagevehicle_code).process().uniqueResult(0); + //生成回库指令 + if (ObjectUtil.isEmpty(inforow)) { + throw new PdaRequestException("未找到单据!"); + } + //扫托盘时校验托盘需无未完成任务 + String task_id = inforow.getString("task_id"); + if (StrUtil.isEmpty(task_id)) { + throw new PdaRequestException("出库指令未找到!"); + } + JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id='" + task_id + "' and task_status <>'99'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(taskObj)) { + throw new PdaRequestException("存在未完成的任务,不能直接回库!"); + } + double real_qty = inforow.getDoubleValue("real_qty"); + if (real_qty <= 0) { + throw new PdaRequestException("单据的实际出库数量必须大0"); } - } + JSONObject task = new JSONObject(); + String taskdtl_id = IdUtil.getSnowflake(1, 1).nextId() + ""; + String task_code = CodeUtil.getNewCode("TASK_CODE"); + task.put("taskdtl_id", taskdtl_id); + task.put("task_id", inforow.getString("task_id")); + //判断有没有重复生成回库任务 + JSONObject returnTaskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id='" + inforow.getString("task_id") + "' and is_delete<>'1' and task_status<>'99'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(returnTaskObj)) { + throw new PdaRequestException("已经生成回库任务,不能重复生成!"); + } + //判断是拣选出库,还是全出,全出不允许回库, 02 全出,05 拣选 + JSONObject taskjo = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id ='" + inforow.getString("task_id") + "' and is_delete<>'1'").uniqueResult(0); + if (ObjectUtil.isEmpty(taskjo)) { + throw new PdaRequestException("未找到出库指令!"); + } + if (StrUtil.equals(taskjo.getString("taskdtl_type"), "02")) { + throw new PdaRequestException("全出的出库单不允许回库!"); + } + task.put("task_code", task_code); + task.put("task_type", "02"); + task.put("taskdtl_type", "06"); + task.put("task_status", "01"); + task.put("start_point_code", point_code); + task.put("next_point_code", inforow.getString("struct_code")); + task.put("vehicle_code", storagevehicle_code); + task.put("handle_class", OutTask.class.getName()); + task.put("finished_type", ""); + task.put("is_delete", "0"); + task.put("create_id", currentUserId); + task.put("create_name", userDto.getNickName()); + task.put("create_time", DateUtil.now()); + task.put("update_optid", currentUserId); + task.put("update_optname", userDto.getNickName()); + task.put("update_time", DateUtil.now()); + task.put("priority", "1"); + WQLObject taskTable = WQLObject.getWQLObject("SCH_BASE_Task"); + taskTable.insert(task); + //下发给acs + AbstractAcsTask intask = new InTask(); + //调用ACS接受任务接口 + JSONObject result = intask.notifyAcs(taskdtl_id); + if (ObjectUtil.isNotEmpty(result)) { + String status = result.getString("status"); + if ("200".equals(status)) { + HashMap mapnow = new HashMap<>(); + mapnow.put("task_status", "02"); + taskTable.update(mapnow, "taskdtl_id = '" + taskdtl_id + "'"); + } else { + throw new PdaRequestException("任务下发失败:" + result.getString("message")); + } + } + },"backstore"+point_code,2); + + JSONObject returnjo = new JSONObject(); returnjo.put("code", "1"); returnjo.put("desc", "成功生成指令!"); return returnjo; diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/pda/st/out/service/impl/HandXCOutIvtServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/pda/st/out/service/impl/HandXCOutIvtServiceImpl.java index a3831b52..9c66dd64 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/pda/st/out/service/impl/HandXCOutIvtServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/pda/st/out/service/impl/HandXCOutIvtServiceImpl.java @@ -13,6 +13,7 @@ import org.apache.commons.lang3.StringUtils; import org.nl.modules.system.service.UserService; import org.nl.modules.system.service.dto.UserDto; import org.nl.modules.system.util.CodeUtil; +import org.nl.modules.system.util.MapOf; import org.nl.pda.exception.PdaRequestException; import org.nl.pda.st.out.service.HandXCOutIvtService; import org.nl.utils.SecurityUtils; @@ -179,8 +180,12 @@ public class HandXCOutIvtServiceImpl implements HandXCOutIvtService { param.put("point_status","00"); param.put("lock_type","00"); - WQLObject.getWQLObject("sch_base_point").update(param,"vehicle_code = '"+storagevehicle_code+"'"); - System.out.println("载具"+storagevehicle_code+"解绑成功!"); + if (StringUtils.isNotEmpty(storagevehicle_code)){ + WQLObject.getWQLObject("ST_IVT_StructAttr").update(MapOf.of("storagevehicle_code",null,"storagevehicle_id",null,"storagevehicle_type",null,"update_time",DateUtil.now()), + "is_delete = '1' and storagevehicle_code = '"+storagevehicle_code+"'"); + WQLObject.getWQLObject("sch_base_point").update(param,"vehicle_code = '"+storagevehicle_code+"'"); + System.out.println("载具"+storagevehicle_code+"解绑成功!"); + } JSONObject returnjo = new JSONObject(); returnjo.put("code", "1"); diff --git a/mes/hd/nladmin-system/src/main/resources/config/application-dev.yml b/mes/hd/nladmin-system/src/main/resources/config/application-dev.yml index bd98628e..58867101 100644 --- a/mes/hd/nladmin-system/src/main/resources/config/application-dev.yml +++ b/mes/hd/nladmin-system/src/main/resources/config/application-dev.yml @@ -22,15 +22,14 @@ spring: client: reactive: #endpoints: 172.31.185.110:9200,172.31.154.9:9200 #内网 - endpoints: 47.96.133.178:8200 #外网 + endpoints: 127.0.0.1:200 #外网 # endpoints: http://10.1.3.90:9200 #外网 elasticsearch: rest: #uris: 172.31.185.110:9200,172.31.154.9:9200 #内网 - uris: 47.96.133.178:8200 #外网 + uris: 127.0.0.1:9200 #外网 # uris: http://10.1.3.90:9200 #外网 - username: elastic - password: 123456 + datasource: druid: db-type: com.alibaba.druid.pool.DruidDataSource diff --git a/mes/hd/nladmin-system/src/main/resources/config/application-prod.yml b/mes/hd/nladmin-system/src/main/resources/config/application-prod.yml index 20d84615..186d64bb 100644 --- a/mes/hd/nladmin-system/src/main/resources/config/application-prod.yml +++ b/mes/hd/nladmin-system/src/main/resources/config/application-prod.yml @@ -21,12 +21,12 @@ spring: client: reactive: #endpoints: 172.31.185.110:9200,172.31.154.9:9200 #内网 - endpoints: 10.16.1.24:9200 #外网 + endpoints: 127.0.0.1:9200 #外网 # endpoints: http://10.1.3.90:9200 #外网 elasticsearch: rest: #uris: 172.31.185.110:9200,172.31.154.9:9200 #内网 - uris: 10.16.1.24:9200 #外网 + uris: 127.0.0.1:9200 #外网 # uris: http://10.1.3.90:9200 #外网 # username: elastic # password: 123456 diff --git a/mes/hd/nladmin-system/src/main/resources/logback-spring.xml b/mes/hd/nladmin-system/src/main/resources/logback-spring.xml index a31dfce9..7ffef186 100644 --- a/mes/hd/nladmin-system/src/main/resources/logback-spring.xml +++ b/mes/hd/nladmin-system/src/main/resources/logback-spring.xml @@ -50,7 +50,7 @@ https://juejin.cn/post/6844903775631572999 - http://10.16.1.24:9200/_bulk + http://127.0.0.1:9200/_bulk ${esIndex} whxr_log es-logger