no message

main
huojin\hj 2025-08-15 09:36:10 +08:00
parent c406d91b57
commit aaf1b546b3
21 changed files with 352 additions and 114 deletions

View File

@ -1 +0,0 @@
186180

View File

@ -146,7 +146,7 @@
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.0</version>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
@ -199,6 +199,12 @@
<version>6.11</version>
</dependency>
<!-- fastexcel导出 -->
<dependency>
<groupId>cn.idev.excel</groupId>
<artifactId>fastexcel</artifactId>
<version>1.2.0</version>
</dependency>
</dependencies>

View File

@ -69,7 +69,7 @@ public class NioF3AppController {
public ResponseEntity<Object> findByLinePoint(@RequestBody LinePoint linePoint) {
try {
List<LesTask> lesList = nioF3AppService.findByLinePoint(linePoint.getDstPositionCode());
return new ResponseEntity<>(ApiResult.success(lesList), HttpStatus.OK);
return new ResponseEntity<>(lesList, HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(ApiResult.fail(e.getMessage()), HttpStatus.BAD_REQUEST);
}

View File

@ -45,14 +45,14 @@ public class NioF3AppServiceImpl implements NioF3AppService {
List<Les> lesList = validateLes(bindSmall.getSrcPositionCode(), bindSmall.getOnlineNo());
List<Long> lesIds = lesList.stream().map(Les::getId).collect(Collectors.toList());
// 获取目标点位
String endPointCode = getEndPointCode(lesList);
// 获取停靠点
String beatCode = getBeatCode(lesList);
AgvTask agvTask;
synchronized (bindSmall.getSrcPositionCode().intern()) {
// 验证起点是否有Agv任务
validateAgvTask(bindSmall.getSrcPositionCode());
// 生成任务
agvTask = agvTaskService.createAgvTask(BizStatus.OPEN, null, bindSmall.getSrcPositionCode(), endPointCode, "TUGGER");
agvTask = agvTaskService.createAgvTask(BizStatus.OPEN, null, bindSmall.getSrcPositionCode(), beatCode, "TUGGER");
// 绑定任务
bindLesAgvTask(agvTask.getId(), lesIds);
}
@ -99,9 +99,9 @@ public class NioF3AppServiceImpl implements NioF3AppService {
}
}
private String getEndPointCode(List<Les> lesList) {
private String getBeatCode(List<Les> lesList) {
return lesList.stream()
.map(Les::getDstPositionCode) // 提取目标字段
.map(Les::getBeatCode) // 提取目标字段
.distinct() // 去重
.collect(Collectors.joining(",")); // 用逗号拼接字符串
}
@ -129,14 +129,14 @@ public class NioF3AppServiceImpl implements NioF3AppService {
validateBoxNos(lesList, boxNos);
//获取目标点位
String endPointCode = getEndPointCode(lesList);
String beatCode = getBeatCode(lesList);
AgvTask agvTask;
synchronized (bindLarge.getSrcPositionCode().intern()) {
// 验证起点是否有Agv任务
validateAgvTask(bindLarge.getSrcPositionCode());
// 生成任务
agvTask = agvTaskService.createAgvTask(BizStatus.OPEN, null, bindLarge.getSrcPositionCode(), endPointCode, "TUGGER");
agvTask = agvTaskService.createAgvTask(BizStatus.OPEN, null, bindLarge.getSrcPositionCode(), beatCode, "TUGGER");
// 绑定任务
bindLesAgvTask(agvTask.getId(), lesIds);
}
@ -209,7 +209,7 @@ public class NioF3AppServiceImpl implements NioF3AppService {
public List<LesTask> findByLinePoint(String dstPositionCode) {
List<LesTask> lesList = lesRepository.findByLinePoint(dstPositionCode);
if (lesList.isEmpty()) {
throw new BadRequestException("PDA扫描的停靠点未匹配到LES任务");
throw new BadRequestException(dstPositionCode+"停靠点无任务");
}
return lesList;
}

View File

@ -17,10 +17,14 @@ package com.youchain.basicdata.domain;
import com.youchain.base.BaseEntity;
import com.youchain.modules.system.domain.Dept;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.io.Serializable;
@ -30,8 +34,11 @@ import java.io.Serializable;
* @author liuxue
* @date 2023-07-26
**/
@Entity
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name="base_point")
public class Point extends BaseEntity implements Serializable {
@ -58,7 +65,7 @@ public class Point extends BaseEntity implements Serializable {
private String description;
@Column(name = "`beat_code`")
@ApiModelProperty(value = "冷却区区域编码")
@ApiModelProperty(value = "停靠点")
private String beatCode;
@Column(name = "`item_code`")

View File

@ -1,28 +1,34 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.youchain.basicdata.repository;
import com.youchain.basicdata.domain.Area;
import com.youchain.basicdata.domain.Point;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
/**
* @website https://eladmin.vip
* @author HJL
* @date 2023-08-14
**/
* @author HJL
* @website https://eladmin.vip
* @date 2023-08-14
**/
public interface AreaRepository extends JpaRepository<Area, Long>, JpaSpecificationExecutor<Area> {
@Query("from Area area where area.enabled=true and area.name in :names")
List<Area> findByNames(List<String> names);
}

View File

@ -1,21 +1,22 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.youchain.basicdata.repository;
import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.domain.Stock;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
@ -23,22 +24,27 @@ import org.springframework.data.jpa.repository.Query;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @website https://eladmin.vip
* @author liuxue
* @date 2023-07-26
**/
* @author liuxue
* @website https://eladmin.vip
* @date 2023-07-26
**/
public interface PointRepository extends JpaRepository<Point, Long>, JpaSpecificationExecutor<Point> {
@Query(" from Point p where p.code = :code and p.enabled = true")
@Query("from Point p where p.code = :code and p.enabled = true")
Point findByCode(String code);
@Query(" from Point p where p.enabled=true " +
@Query("from Point p where p.enabled=true " +
"and (:code is null or p.code = :code) " +
"and (:status is null or p.status = :status) " +
"and (:type is null or p.type = :type) " +
"and (:areaName is null or p.area.name = :areaName)")
List<Point> queryPoints(String code, String status, String type, String areaName);
@Query("from Point point where point.enabled=true and point.code in :codes")
List<Point> findByCodes(List<String> codes);
}

View File

@ -0,0 +1,20 @@
package com.youchain.basicdata.requset;
import cn.idev.excel.annotation.ExcelProperty;
import lombok.Data;
@Data
public class PointImportReq {
@ExcelProperty("库区名称")
private String name;
@ExcelProperty("库位编码")
private String code;
@ExcelProperty("停靠点")
private String beatCode;
@ExcelProperty("类型")
private String type;
}

View File

@ -17,10 +17,8 @@ package com.youchain.basicdata.rest;
import com.youchain.annotation.Log;
import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.service.AreaService;
import com.youchain.basicdata.service.PointService;
import com.youchain.basicdata.service.dto.PointQueryCriteria;
import com.youchain.config.FileProperties;
import com.youchain.exception.handler.ApiResult;
import com.youchain.utils.*;
import lombok.extern.slf4j.Slf4j;
@ -37,9 +35,6 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import static org.springframework.http.HttpStatus.BAD_REQUEST;
import static org.springframework.http.HttpStatus.OK;
/**
* @author liuxue
* @website https://eladmin.vip
@ -63,11 +58,15 @@ public class PointController {
}
@Log("导入点位")
@PostMapping(value = "/import_point")
@PostMapping(value = "/importPoint")
@ApiOperation("导入点位")
@PreAuthorize("@el.check('point:importPoint')")
public ResponseEntity<Object> importPoint(@RequestParam("file") MultipartFile multipartFile) {
return null;
try {
String result = pointService.importPoint(multipartFile);
return new ResponseEntity<>(ApiResult.success(result, null), HttpStatus.OK);
}catch (Exception e){
return new ResponseEntity<>(ApiResult.fail(e.getMessage()), HttpStatus.BAD_REQUEST);
}
}
@GetMapping

View File

@ -19,6 +19,8 @@ import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.service.dto.PointDto;
import com.youchain.basicdata.service.dto.PointQueryCriteria;
import org.springframework.data.domain.Pageable;
import org.springframework.web.multipart.MultipartFile;
import java.util.Map;
import java.util.List;
import java.io.IOException;
@ -81,6 +83,13 @@ public interface PointService {
*/
void download(List<PointDto> all, HttpServletResponse response) throws IOException;
/**
*
*
* @param multipartFile
*/
String importPoint(MultipartFile multipartFile);
/**
*
*
@ -118,5 +127,11 @@ public interface PointService {
*/
Point queryPoint(String code, String status, String type, String areaName);
/**
*
*
* @param codes
*/
Map<String, Point> findByCodes(List<String> codes);
}

View File

@ -15,8 +15,13 @@
*/
package com.youchain.basicdata.service.impl;
import cn.idev.excel.FastExcel;
import com.youchain.basicdata.domain.Area;
import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.repository.AreaRepository;
import com.youchain.basicdata.requset.PointImportReq;
import com.youchain.exception.BadRequestException;
import com.youchain.modules.system.domain.Dept;
import com.youchain.utils.*;
import lombok.RequiredArgsConstructor;
import com.youchain.basicdata.repository.PointRepository;
@ -25,15 +30,18 @@ import com.youchain.basicdata.service.dto.PointDto;
import com.youchain.basicdata.service.dto.PointQueryCriteria;
import com.youchain.basicdata.service.mapstruct.PointMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.multipart.MultipartFile;
import java.util.*;
import java.io.IOException;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
/**
@ -49,6 +57,7 @@ import javax.servlet.http.HttpServletResponse;
public class PointServiceImpl implements PointService {
private final PointRepository pointRepository;
private final AreaRepository areaRepository;
private final PointMapper pointMapper;
@Override
@ -122,7 +131,119 @@ public class PointServiceImpl implements PointService {
}
@Override
@Cacheable(key = "#position", unless = "#result == null")
@Transactional(rollbackFor = Exception.class)
public String importPoint(MultipartFile multipartFile) {
List<PointImportReq> dataList;
try {
dataList = FastExcel.read(multipartFile.getInputStream()).head(PointImportReq.class)
.sheet()
.doReadSync();
} catch (IOException e) {
throw new BadRequestException("数据格式存在问题,无法读取");
}
if (CollectionUtils.isEmpty(dataList)) {
throw new BadRequestException("数据为空");
}
//获取文件中所有库区名称
List<String> names = dataList.stream()
.map(PointImportReq::getName)
.distinct()
.collect(Collectors.toList());
//查找数据库中存在的库区
List<Area> areaList = areaRepository.findByNames(names);
List<String> exitingAreaNames = areaList.stream().map(Area::getName).collect(Collectors.toList());
//获取不存在的库区名称
List<String> diffAreaNames = SmartStringUtil.getDifference(names, exitingAreaNames);
if (!diffAreaNames.isEmpty()) {
throw new BadRequestException("WMS不存在的库区集合,请维护:" + diffAreaNames);
}
Map<String, Area> existingAreaMap = areaList.stream().collect(Collectors.toMap(Area::getName, area -> area));
//获取文件中所有库位编码
List<String> codes = dataList.stream()
.map(PointImportReq::getCode)
.distinct()
.collect(Collectors.toList());
//获取已存在的点位
Map<String, Point> existingPointMap = this.findByCodes(codes);
//新增容器集合
List<Point> pointsToCreate = new ArrayList<>();
//修改容器集合
List<Point> pointsToUpdate = new ArrayList<>();
for (PointImportReq pointImportReq : dataList) {
Area area = existingAreaMap.get(pointImportReq.getName());
String code = pointImportReq.getCode();
String type = pointImportReq.getType();
String beatCode = pointImportReq.getBeatCode();
//判断是否已存在容器
if (existingPointMap.containsKey(code)) {
//修改容器
Point point = existingPointMap.get(code);
pointsToUpdate.add(updatePoint(point, area, beatCode, type));
} else {
//新增容器
Point point = createPoint(code, beatCode, type, area, UserUtils.getDept());
pointsToCreate.add(point);
existingPointMap.put(code, point);
}
}
//批量新增容器
if (!pointsToCreate.isEmpty()) {
pointRepository.saveAll(pointsToCreate);
}
//批量更新容器
if (!pointsToUpdate.isEmpty()) {
pointRepository.saveAll(pointsToUpdate);
}
return ("导入成功:" + " 新增(" + pointsToCreate.size() + ")修改(" + pointsToUpdate.size() + ")");
}
private Point createPoint(String code, String beatCode, String type, Area area, Dept dept) {
if ("缓存点".equals(type)) {
type = BaseStatus.STORAGE;
} else if ("线边点位".equals(type)) {
type = BaseStatus.BOX;
}
return Point.builder()
.code(code)
.name(code)
.status(BaseStatus.FREE)
.beatCode(beatCode)
.area(area)
.enabled(true)
.dept(dept)
.type(type)
.heat(0.0)
.build();
}
private Point updatePoint(Point point, Area area, String beatCode, String type) {
if ("缓存点".equals(type)) {
type = BaseStatus.STORAGE;
} else if ("线边点位".equals(type)) {
type = BaseStatus.BOX;
}
point.setArea(area);
point.setBeatCode(beatCode);
point.setType(type);
return point;
}
@Override
public Point validatePoint(String position) {
Point point = pointRepository.findByCode(position);
if (point == null) {
@ -158,4 +279,14 @@ public class PointServiceImpl implements PointService {
}
return pointList.get(0);
}
@Override
public Map<String, Point> findByCodes(List<String> codes) {
List<Point> pointList = pointRepository.findByCodes(codes);
Map<String, Point> pointMap = new HashMap<>();
for (Point point : pointList) {
pointMap.put(point.getCode(), point);
}
return pointMap;
}
}

View File

@ -71,6 +71,10 @@ public class Les extends BaseEntity implements Serializable {
@ApiModelProperty(value = "终点库位")
private String dstPositionCode;
@Column(name = "`beat_code`")
@ApiModelProperty(value = "停靠点")
private String beatCode;
@Column(name = "`dst_type`")
@ApiModelProperty(value = "终点类型")
private String dstType;

View File

@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.util.List;
/**
* @description:LES

View File

@ -3,35 +3,37 @@ package com.youchain.businessdata.repository;
import com.youchain.businessdata.domain.Les;
import com.youchain.appupdate.response.LesTask;
import org.springframework.data.jpa.repository.*;
import javax.persistence.LockModeType;
import java.util.List;
public interface LesRepository extends JpaRepository<Les, Long>, JpaSpecificationExecutor<Les> {
@Query(value = "select les from Les les where les.taskCode=:taskCode ")
@Query(value = "from Les les where les.taskCode=:taskCode ")
Les findByTaskCode(String taskCode);
@Query(value = " from Les les where les.agvTaskId is null and les.onlineNo=:onlineNo and les.srcPositionCode=:srcPositionCode and les.status='OPEN' ")
@Query(value = "from Les les where les.srcPositionCode=:srcPositionCode and les.onlineNo=:onlineNo and les.agvTaskId is null and les.status='OPEN' ")
List<Les> findByOnlineNo(String srcPositionCode, String onlineNo);
@Query(value = " from Les les where les.agvTaskId=:agvTaskId and les.dstPositionCode=:currentPositionCode and les.status='OPEN' ")
List<Les> findByAgvTaskId(Long agvTaskId, String currentPositionCode);
@Query(value = "from Les les where les.agvTaskId=:agvTaskId and les.beatCode=:beatCode and les.status='OPEN' ")
List<Les> findByAgvTaskId(Long agvTaskId, String beatCode);
@Query(value = "from Les les where les.srcPositionCode=:srcPositionCode and les.boxNo in (:boxNos) and les.agvTaskId is null and les.status='OPEN' ")
List<Les> findByBoxNoAndPoint(String srcPositionCode, List<String> boxNos);
@Query(value = "select " +
"new com.youchain.appupdate.response.LesTask(les.id,les.onlineNo,les.createTime," +
"les.routeCode,les.dstPositionCode,les.boxNo,les.materialCode,les.caseNum) " +
"from Les les " +
"where les.agvTaskId > 0 " +
"and les.dstPositionCode = :dstPositionCode " +
"and les.beatCode = :beatCode " +
"and les.status = 'ARRIVED'")
List<LesTask> findByLinePoint(String dstPositionCode);
@Query(value = " from Les les where les.agvTaskId is null and les.srcPositionCode=:srcPositionCode and les.boxNo in (:boxNos) and les.status='OPEN' ")
List<Les> findByBoxNoAndPoint(String srcPositionCode, List<String> boxNos);
List<LesTask> findByLinePoint(String beatCode);
@Modifying
@Query("update Les set agvTaskId = :agvTaskId where id in :ids")
void batchUpdateAgvTaskId(Long agvTaskId,List<Long> ids);
@Modifying
@Query("update Les set status = :status,arrivedTime=now() where id in :lesIds")
void batchUpdateStatus(String status,List<Long> lesIds);
}

View File

@ -1,7 +1,9 @@
package com.youchain.businessdata.service.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import java.sql.Timestamp;
@Data
@ -41,6 +43,9 @@ public class LesDto {
//终点库位
private String dstPositionCode;
//停靠点
private String beatCode;
//终点类型
private String dstType;

View File

@ -489,15 +489,12 @@ public class KMReServiceImpl implements KMReService {
* @param agvTask
*/
private void handleArrivedContainer(AgvTask agvTask, String currentPosition) {
// 验证当前点位
pointService.validatePoint(currentPosition);
// 记录当前节点
lesService.arrivedLes(agvTask.getId(), currentPosition);
agvTask.setStatus(BizStatus.ARRIVED);
// 更新点位路径
updateSlotCode(agvTask, currentPosition);
agvTask.setStatus(BizStatus.ARRIVED);
agvTaskService.update(agvTask);
}

View File

@ -2,6 +2,7 @@ package com.youchain.businessdata.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.service.PointService;
import com.youchain.businessdata.domain.Les;
import com.youchain.businessdata.inputJson.LesRequest;
@ -17,6 +18,7 @@ import com.youchain.modules.system.repository.DictRepository;
import com.youchain.utils.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.dao.DataAccessException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@ -24,9 +26,11 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLIntegrityConstraintViolationException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@Service
@Slf4j
@ -107,21 +111,22 @@ public class LesServiceImpl implements LesService {
//验证参数有效性
validateParams(lesRequest);
//目标库位
Point dstPoint = validatePositionCode(lesRequest);
//验证任务是否存在
String taskCode = lesRequest.getTaskCode();
validateLes(taskCode);
String materialCode = lesRequest.getMaterialCode();//物料代码
//有物料走料箱上线场景;无物料走其余场景
if (StringUtils.isNotEmpty(materialCode)) {
try {
createLes(lesRequest);
createLes(lesRequest, dstPoint);
} catch (Exception e) {
throw new BadRequestException(taskCode + "任务号系统已接收,请勿重复操作");
}
} else {
//直接转发给AGV
sendLesTask(JSON.toJSONString(lesRequest));
@ -188,15 +193,10 @@ public class LesServiceImpl implements LesService {
public void arrivedLes(Long agvTaskId, String currentPositionCode) {
List<Les> lesList = lesRepository.findByAgvTaskId(agvTaskId, currentPositionCode);
if (lesList.isEmpty()) {
throw new BadRequestException("系统未识别到任务");
}
for (Les les : lesList) {
les.setStatus(BizStatus.ARRIVED);
les.setArrivedTime(new Timestamp(new Date().getTime()));
}
if (!lesList.isEmpty()) {
lesRepository.saveAll(lesList);
throw new BadRequestException(currentPositionCode + "停靠点未识别到任务");
}
List<Long> lesIds = lesList.stream().map(Les::getId).collect(Collectors.toList());
lesRepository.batchUpdateStatus(BizStatus.ARRIVED,lesIds);
}
/**
@ -225,18 +225,22 @@ public class LesServiceImpl implements LesService {
if (lesRequest.getPositionCodePath() == null || lesRequest.getPositionCodePath().isEmpty() || lesRequest.getPositionCodePath().size() < 2) {
throw new BadRequestException("节点不能为空且长度至少为2");
}
//节点集合
List<PositionCodeRequest> positionCodes = lesRequest.getPositionCodePath();
//验证起点
PositionCodeRequest srcPosition = positionCodes.get(0);
pointService.validatePoint(srcPosition.getPositionCode());
//验证目标库位
PositionCodeRequest dstPosition = positionCodes.get(1);
pointService.validatePoint(dstPosition.getPositionCode());
}
}
private Point validatePositionCode(LesRequest lesRequest) {
//节点集合
List<PositionCodeRequest> positionCodes = lesRequest.getPositionCodePath();
//验证起点
PositionCodeRequest srcPosition = positionCodes.get(0);
pointService.validatePoint(srcPosition.getPositionCode());
//验证目标库位
PositionCodeRequest dstPosition = positionCodes.get(1);
pointService.validatePoint(dstPosition.getPositionCode());
return pointService.validatePoint(dstPosition.getPositionCode());
}
/**
*
*
@ -250,7 +254,7 @@ public class LesServiceImpl implements LesService {
}
@Transactional(rollbackFor = Exception.class)
public void createLes(LesRequest lesRequest) {
public void createLes(LesRequest lesRequest, Point dstPoint) {
//节点集合
List<PositionCodeRequest> positionCodes = lesRequest.getPositionCodePath();
//起点对象
@ -271,6 +275,7 @@ public class LesServiceImpl implements LesService {
.srcType(srcPosition.getType())
.dstPositionCode(dstPosition.getPositionCode())
.dstType(dstPosition.getType())
.beatCode(dstPoint.getBeatCode())
.build();
lesRepository.save(les);
}

View File

@ -19,11 +19,8 @@ package com.youchain.businessdata.service.impl;
import com.youchain.basicdata.domain.Item;
import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.domain.Stock;
import com.youchain.basicdata.service.StockService;
import com.youchain.businessdata.domain.*;
import com.youchain.businessdata.repository.PickDetailRepository;
import com.youchain.businessdata.service.*;
import com.youchain.exception.BadRequestException;
import com.youchain.utils.*;
import com.youchain.businessdata.repository.TaskRepository;
import com.youchain.businessdata.service.dto.TaskDto;

View File

@ -0,0 +1,40 @@
package com.youchain.utils;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
public class SmartStringUtil {
/**
*
*
* @param list1
* @param list2
* @return
*/
public static List<String> getIntersection(List<String> list1, List<String> list2) {
return list1.stream()
.filter(list2::contains)
.collect(Collectors.toList());
}
/**
* list1 list2
*
* @param list1
* @param list2
* @return
*/
public static List<String> getDifference(List<String> list1, List<String> list2) {
Set<String> existingLocationCodesSet = new HashSet<>(list2);
return list1.stream()
.filter(code -> !existingLocationCodesSet.contains(code))
.collect(Collectors.toList());
}
public static boolean containsAllIgnoreCase(List<String> requiredColumns, List<String> headers) {
Set<String> headersSet = new HashSet<>(headers);
return headersSet.containsAll(requiredColumns);
}
}

View File

@ -4,7 +4,7 @@ spring:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.0.159}:${DB_PORT:3306}/${DB_NAME:nio_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
url: jdbc:log4jdbc:mysql://${DB_HOST:47.117.45.79}:${DB_PORT:3306}/${DB_NAME:nio_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
username: ${DB_USER:root}
password: ${DB_PWD:Youchain@56}
# 初始连接数
@ -45,7 +45,7 @@ spring:
enabled: true
# 记录慢SQL
log-slow-sql: true
slow-sql-millis: 1000
slow-sql-millis: 10000
merge-sql: true
wall:
config:
@ -119,17 +119,14 @@ file:
path: ~/file/
avatar: ~/avatar/
linux:
path: /home/eladmin/file/
avatar: /home/eladmin/avatar/
path: /home/f3/eladmin/file/
avatar: /home/f3/eladmin/avatar/
windows:
path: C:\eladmin\file\
avatar: C:\eladmin\avatar\
# 文件大小 /M
maxSize: 100
maxSize: 200
avatarMaxSize: 5
minidao:
base-package: org.jeecg.modules.jmreport.desreport.dao*
db-type: mysql
task:
onOff:
zCJXBTask: false

View File

@ -6,7 +6,7 @@ spring:
freemarker:
check-template-location: false
profiles:
active: dev
active: prod
jackson:
time-zone: GMT+8
data:
@ -35,13 +35,14 @@ spring:
redis:
#数据库索引
database: ${REDIS_DB:3}
#host: ${REDIS_HOST:192.168.0.159}
#password: ${REDIS_PWD:}
#port: ${REDIS_PORT:6379}
database: ${REDIS_DB:1}
host: ${REDIS_HOST:47.117.45.79}
password: ${REDIS_PWD:123456}
#database: ${REDIS_DB:3}
#host: ${REDIS_HOST:127.0.0.1}
#password: ${REDIS_PWD:}
host: ${REDIS_HOST:127.0.0.1}
password: ${REDIS_PWD:}
port: ${REDIS_PORT:6379}
#连接超时时间
timeout: 5000