add:添加组盘物料校验
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
package org.nl.modules.system.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.db.PageResult;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
@@ -22,9 +25,11 @@ import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
|
||||
import org.springframework.data.elasticsearch.core.aggregation.impl.AggregatedPageImpl;
|
||||
import org.springframework.data.elasticsearch.core.query.*;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -35,6 +40,7 @@ import java.util.List;
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class EsLogServiceImpl implements EsLogService {
|
||||
|
||||
private final EsLogRepository esLogRepository;
|
||||
@@ -54,19 +60,27 @@ 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;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async
|
||||
public void clearLogs(LogQuery logQuery) {
|
||||
String system = logQuery.getSystem();
|
||||
if (StringUtils.isEmpty(system)){
|
||||
return;
|
||||
}
|
||||
log.info("清除日志"+system);
|
||||
BoolQueryBuilder query = QueryBuilders.boolQuery();
|
||||
query.must().add(QueryBuilders.matchQuery("system", system));
|
||||
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());
|
||||
|
||||
@@ -841,7 +841,7 @@ public class HandPFOutIvtServiceImpl implements HandPFOutIvtService {
|
||||
RLock lock = redisLock.getLock("QST_IVT_RAWASSISTISTOR02");
|
||||
try {
|
||||
// 尝试加锁,最多等待1000ms,上锁以后5s自动解锁
|
||||
boolean isLock = lock.tryLock(1000, 5000, TimeUnit.MILLISECONDS);
|
||||
boolean isLock = lock.tryLock(5000, 5000, TimeUnit.MILLISECONDS);
|
||||
if (isLock) {
|
||||
//获取锁成功,执行对应的业务逻辑
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.ext.lk.service.WmsToLkService;
|
||||
import org.nl.modules.security.service.dto.JwtUserDto;
|
||||
import org.nl.pda.exception.PdaRequestException;
|
||||
@@ -26,6 +27,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -505,6 +507,7 @@ public class EmptyVehicleServiceImpl implements EmptyVehicleService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Map<String, Object> confirmVehicle(Map jsonObject) {
|
||||
|
||||
WQLObject line_wql = WQLObject.getWQLObject("PDM_BI_ProcedureOffline");
|
||||
WQLObject bucket_wql = WQLObject.getWQLObject("md_pb_bucketrecord");
|
||||
WQLObject vehicle_wql = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
|
||||
@@ -520,6 +523,8 @@ public class EmptyVehicleServiceImpl implements EmptyVehicleService {
|
||||
JSONObject obj = jo.getJSONObject("obj");
|
||||
|
||||
String vehicle_code = (String) jsonObject.get("vehicle_code");
|
||||
JSONArray has = line_wql.query("storagevehicle_code = '" + vehicle_code + "' and workorder_id = " + obj.getString("workorder_id") + "'").getResultJSONArray(0);
|
||||
|
||||
JSONObject vehicle = vehicle_wql.query("storagevehicle_code = '" + vehicle_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(vehicle)){
|
||||
throw new PdaRequestException("输入的载具号有误!");
|
||||
@@ -563,6 +568,12 @@ public class EmptyVehicleServiceImpl implements EmptyVehicleService {
|
||||
line_jo.put("update_optid", currentUserId);
|
||||
line_jo.put("update_optname", SecurityUtils.getNickName());
|
||||
if (ObjectUtil.isNotEmpty(obj)){
|
||||
if (has!=null && has.size()>0){
|
||||
Set<String> hasMaterials = has.stream().map(a -> ((JSONObject) a).getString("material_id")).collect(Collectors.toSet());
|
||||
if (!hasMaterials.contains(row.get("material_id"))){
|
||||
throw new BadRequestException(vehicle_code+"当前托盘对应工令"+obj.getString("workorder_id")+"存在不同物料"+JSON.toJSONString(hasMaterials));
|
||||
}
|
||||
}
|
||||
line_jo.put("workorder_id", obj.getString("workorder_id"));
|
||||
line_jo.put("workordercard_id", obj.getString("workordercard_id"));
|
||||
line_jo.put("worktaskno_id", obj.getString("worktask_id"));
|
||||
|
||||
@@ -726,7 +726,7 @@ public abstract class AbstractInManage {
|
||||
|
||||
try {
|
||||
// 尝试加锁,最多等待1000ms,上锁以后5s自动解锁
|
||||
boolean isLock = lock.tryLock(1000, 5000, TimeUnit.MILLISECONDS);
|
||||
boolean isLock = lock.tryLock(5000, 5000, TimeUnit.MILLISECONDS);
|
||||
if (isLock) {//获取锁成功,执行对应的业务逻辑
|
||||
//调用分配货位sql
|
||||
JSONObject struct_jo = WQL.getWO("QST_IVT_RAWASSISTISTOR02").addParamMap(struct_map).process().uniqueResult(0);
|
||||
|
||||
Reference in New Issue
Block a user