no message
parent
65bb9f90b5
commit
e2b7594612
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.youchain.appupdate.inputJson;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ContainerSynchronized {
|
||||||
|
@ApiModelProperty(value = "库区编码")
|
||||||
|
String areaCode;
|
||||||
|
}
|
||||||
|
|
@ -218,12 +218,11 @@ public class BydAppServiceImpl implements BydAppService {
|
||||||
//刷新出库单状态
|
//刷新出库单状态
|
||||||
pickService.refreshPickStatus(task.getPickDetail().getPick());
|
pickService.refreshPickStatus(task.getPickDetail().getPick());
|
||||||
|
|
||||||
//生成叫料任务
|
|
||||||
taskService.callJlTask(pick);
|
|
||||||
|
|
||||||
//成品原托盘返库;单品不回库
|
//成品原托盘返库;单品不回库
|
||||||
if (BaseStatus.GD_TYPE_CT.equals(pick.getOrderType())) {
|
if (BaseStatus.GD_TYPE_CT.equals(pick.getOrderType())) {
|
||||||
this.returnFBAgvTask(task);
|
this.returnXJFBAgvTask(task);
|
||||||
|
} else if (BaseStatus.GD_TYPE_DP.equals(pick.getOrderType())) {
|
||||||
|
this.returnDJFBAgvTask(task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -456,7 +455,7 @@ public class BydAppServiceImpl implements BydAppService {
|
||||||
*
|
*
|
||||||
* @param task 任务
|
* @param task 任务
|
||||||
*/
|
*/
|
||||||
private void returnFBAgvTask(Task task) {
|
private void returnXJFBAgvTask(Task task) {
|
||||||
double planQty = 0;
|
double planQty = 0;
|
||||||
double moveQty = 0;
|
double moveQty = 0;
|
||||||
List<Task> taskList = taskService.findTaskByAgvTask(task.getAgvTask().getId());
|
List<Task> taskList = taskService.findTaskByAgvTask(task.getAgvTask().getId());
|
||||||
|
|
@ -483,5 +482,35 @@ public class BydAppServiceImpl implements BydAppService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AGV中的任务都拣货完成托盘回库
|
||||||
|
*
|
||||||
|
* @param task 任务
|
||||||
|
*/
|
||||||
|
private void returnDJFBAgvTask(Task task) {
|
||||||
|
double planQty = 0;
|
||||||
|
double moveQty = 0;
|
||||||
|
List<Task> taskList = taskService.findTaskByAgvTask(task.getAgvTask().getId());
|
||||||
|
for (Task tasks : taskList) {
|
||||||
|
planQty += tasks.getPlanQty();
|
||||||
|
moveQty += tasks.getMoveQty();
|
||||||
|
}
|
||||||
|
if (planQty == moveQty) {
|
||||||
|
//查询大件返空区的空闲点位
|
||||||
|
List<String> areaNames = Collections.singletonList(AreaNameDic.DJFKQ);
|
||||||
|
List<Point> points = pointService.queryByAreaNames(areaNames, BaseStatus.FREE);
|
||||||
|
if (!points.isEmpty()) {
|
||||||
|
Point endPoint = points.get(0);
|
||||||
|
// 没有空车的处理逻辑
|
||||||
|
if (agvTaskService.isEndPointAvailable(endPoint.getCode(), BizStatus.FB_RETURN, "FORKLIFT_MOVE")) {
|
||||||
|
// 生成agv任务进行等待
|
||||||
|
AgvTask agvTask = agvTaskService.createAgvTask(BizStatus.FB_RETURN, task.getSrcStock(), task.getDstPointCode(), endPoint.getCode(), "FORKLIFT_MOVE");
|
||||||
|
pointService.usedPoint(endPoint);
|
||||||
|
kmReService.sendAgvTask(agvTask, kmReService.sendAgvTaskCcJson(agvTask));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,4 +45,10 @@ public interface PointRepository extends JpaRepository<Point, Long>, JpaSpecific
|
||||||
|
|
||||||
@Query(" from Point p where p.code in :pointCodes")
|
@Query(" from Point p where p.code in :pointCodes")
|
||||||
List<Point> findByCodes(Set<String> pointCodes);
|
List<Point> findByCodes(Set<String> pointCodes);
|
||||||
|
|
||||||
|
@Query(" from Point point where point.enabled=true" +
|
||||||
|
" and (:status is null or point.status = :status) " +
|
||||||
|
" and (point.area.name in :areaNames ) " +
|
||||||
|
" order by point.posX,point.posY desc,point.posZ asc")
|
||||||
|
List<Point> queryByAreaNames(List<String> areaNames,String status);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,8 @@ public class StockController {
|
||||||
return new ResponseEntity<>(stockMsg, HttpStatus.OK);
|
return new ResponseEntity<>(stockMsg, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private ResponseEntity<Object> badRequest(String message) {
|
private ResponseEntity<Object> badRequest(String message) {
|
||||||
return new ResponseEntity<>(ApiResult.fail(BAD_REQUEST.value(), message, ""), HttpStatus.BAD_REQUEST);
|
return new ResponseEntity<>(ApiResult.fail(BAD_REQUEST.value(), message, ""), HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,14 @@ public interface PointService {
|
||||||
*/
|
*/
|
||||||
List<Point> queryPoints(String code, String status, String type, String areaName);
|
List<Point> queryPoints(String code, String status, String type, String areaName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询点位
|
||||||
|
* @param areaNames 库区
|
||||||
|
* @param status 状态
|
||||||
|
*/
|
||||||
|
List<Point> queryByAreaNames(List<String> areaNames,String status);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询点位
|
* 查询点位
|
||||||
* @param code 点位编码
|
* @param code 点位编码
|
||||||
|
|
|
||||||
|
|
@ -46,4 +46,8 @@ public class StockQueryCriteria{
|
||||||
|
|
||||||
@Query(joinName = "point>area>", propName="name",type = Query.Type.EQUAL)
|
@Query(joinName = "point>area>", propName="name",type = Query.Type.EQUAL)
|
||||||
private String areaName;
|
private String areaName;
|
||||||
|
|
||||||
|
/** 状态:1启用、0禁用 */
|
||||||
|
@Query(type = Query.Type.EQUAL)
|
||||||
|
private Boolean enabled;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,11 @@ public class PointServiceImpl implements PointService {
|
||||||
return pointRepository.queryPoints(code, status, type, areaName);
|
return pointRepository.queryPoints(code, status, type, areaName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Point> queryByAreaNames(List<String> areaNames, String status) {
|
||||||
|
return pointRepository.queryByAreaNames(areaNames, status);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Point queryPoint(String code, String status, String type, String areaName) {
|
public Point queryPoint(String code, String status, String type, String areaName) {
|
||||||
List<Point> pointList = pointRepository.queryPoints(code, status, type, areaName);
|
List<Point> pointList = pointRepository.queryPoints(code, status, type, areaName);
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.youchain.businessdata.rest;
|
||||||
|
|
||||||
import com.youchain.annotation.AnonymousAccess;
|
import com.youchain.annotation.AnonymousAccess;
|
||||||
import com.youchain.annotation.Log;
|
import com.youchain.annotation.Log;
|
||||||
|
import com.youchain.appupdate.inputJson.ContainerSynchronized;
|
||||||
import com.youchain.appupdate.inputJson.MissionStateCallback;
|
import com.youchain.appupdate.inputJson.MissionStateCallback;
|
||||||
import com.youchain.businessdata.domain.AgvTask;
|
import com.youchain.businessdata.domain.AgvTask;
|
||||||
import com.youchain.businessdata.service.AgvTaskService;
|
import com.youchain.businessdata.service.AgvTaskService;
|
||||||
|
|
@ -14,10 +15,7 @@ import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||||
import static org.springframework.http.HttpStatus.OK;
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
|
|
@ -52,4 +50,19 @@ public class KMReSController {
|
||||||
return new ResponseEntity<>(ApiResult.fail(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
return new ResponseEntity<>(ApiResult.fail(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/containerSynchronized")
|
||||||
|
@Log("同步AGV容器")
|
||||||
|
@ApiOperation("同步AGV容器")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> containerSynchronized(@RequestBody ContainerSynchronized containerSynchronized) {
|
||||||
|
try {
|
||||||
|
kmReService.containerSynchronized(containerSynchronized.getAreaCode());
|
||||||
|
return new ResponseEntity<>(ApiResult.success(OK.value(), "", ""), HttpStatus.OK);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return new ResponseEntity<>(ApiResult.fail(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -163,4 +163,22 @@ public interface AgvTaskService {
|
||||||
* 统计本周任务数量
|
* 统计本周任务数量
|
||||||
*/
|
*/
|
||||||
Map<String, Object> queryWeeklyTaskCounts();
|
Map<String, Object> queryWeeklyTaskCounts();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证起点是否有任务
|
||||||
|
*
|
||||||
|
* @param startSlotCode 终点点位代码
|
||||||
|
* @return 终点是否可用
|
||||||
|
*/
|
||||||
|
boolean isSrcPointAvailable(String startSlotCode, String type, String jobType);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证终点是否有任务
|
||||||
|
*
|
||||||
|
* @param endPointCode 终点点位代码
|
||||||
|
* @return 终点是否可用
|
||||||
|
*/
|
||||||
|
boolean isEndPointAvailable(String endPointCode, String type, String jobType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ public interface KMReService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 容器出场
|
* 容器出场
|
||||||
|
*
|
||||||
* @param containerCode 容器
|
* @param containerCode 容器
|
||||||
*/
|
*/
|
||||||
void containerOut(String containerCode);
|
void containerOut(String containerCode);
|
||||||
|
|
@ -44,8 +45,23 @@ public interface KMReService {
|
||||||
*/
|
*/
|
||||||
void sendAgvTaskToContainer(String url, String json);
|
void sendAgvTaskToContainer(String url, String json);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询容器JSON
|
||||||
|
*
|
||||||
|
* @param areaCode 库区编号
|
||||||
|
*/
|
||||||
|
String containerQuery(String areaCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 容器同步
|
||||||
|
*
|
||||||
|
* @param areaCode 库区编号
|
||||||
|
*/
|
||||||
|
void containerSynchronized(String areaCode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下发agv叉车任务JSON
|
* 下发agv叉车任务JSON
|
||||||
|
*
|
||||||
* @param agvTask 任务
|
* @param agvTask 任务
|
||||||
*/
|
*/
|
||||||
String sendAgvTaskCcJson(AgvTask agvTask);
|
String sendAgvTaskCcJson(AgvTask agvTask);
|
||||||
|
|
@ -53,24 +69,28 @@ public interface KMReService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下发agv货架任务JSON
|
* 下发agv货架任务JSON
|
||||||
|
*
|
||||||
* @param agvTask 任务
|
* @param agvTask 任务
|
||||||
*/
|
*/
|
||||||
String sendAgvTaskHjJson(AgvTask agvTask);
|
String sendAgvTaskHjJson(AgvTask agvTask);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下发agv滚筒任务JSON
|
* 下发agv滚筒任务JSON
|
||||||
|
*
|
||||||
* @param agvTask 任务
|
* @param agvTask 任务
|
||||||
*/
|
*/
|
||||||
String sendAgvTaskGtJson(AgvTask agvTask);
|
String sendAgvTaskGtJson(AgvTask agvTask);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下发agv任务
|
* 下发agv任务
|
||||||
|
*
|
||||||
* @param agvTasks 任务
|
* @param agvTasks 任务
|
||||||
*/
|
*/
|
||||||
void sendAgvTask(AgvTask agvTasks, String json);
|
void sendAgvTask(AgvTask agvTasks, String json);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务回报更新状态
|
* 任务回报更新状态
|
||||||
|
*
|
||||||
* @param agvTask 任务
|
* @param agvTask 任务
|
||||||
* @param status 状态
|
* @param status 状态
|
||||||
* @param containerCode 容器
|
* @param containerCode 容器
|
||||||
|
|
@ -80,6 +100,7 @@ public interface KMReService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 托盘回库
|
* 托盘回库
|
||||||
|
*
|
||||||
* @param srcPoint 起点
|
* @param srcPoint 起点
|
||||||
* @param stock 容器
|
* @param stock 容器
|
||||||
* @param item 物料
|
* @param item 物料
|
||||||
|
|
@ -89,6 +110,7 @@ public interface KMReService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务放行Json
|
* 任务放行Json
|
||||||
|
*
|
||||||
* @param agvTask 任务
|
* @param agvTask 任务
|
||||||
*/
|
*/
|
||||||
String operationFeedbackJson(AgvTask agvTask);
|
String operationFeedbackJson(AgvTask agvTask);
|
||||||
|
|
|
||||||
|
|
@ -193,6 +193,8 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
return agvTaskRepository.findByStatus(status);
|
return agvTaskRepository.findByStatus(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> queryWeeklyTaskCounts() {
|
public Map<String, Object> queryWeeklyTaskCounts() {
|
||||||
List<Object[]> objectList = agvTaskRepository.queryWeeklyTaskCounts();
|
List<Object[]> objectList = agvTaskRepository.queryWeeklyTaskCounts();
|
||||||
|
|
@ -215,4 +217,14 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isEndPointAvailable(String endPointCode, String type, String jobType) {
|
||||||
|
return findByEndSlotCode(endPointCode, type, jobType);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isSrcPointAvailable(String startSlotCode, String type, String jobType) {
|
||||||
|
return findByStartSlotCode(startSlotCode, type, jobType);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.youchain.businessdata.service.impl;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.youchain.basicdata.domain.Area;
|
||||||
import com.youchain.basicdata.domain.Item;
|
import com.youchain.basicdata.domain.Item;
|
||||||
import com.youchain.basicdata.domain.Point;
|
import com.youchain.basicdata.domain.Point;
|
||||||
import com.youchain.basicdata.domain.Stock;
|
import com.youchain.basicdata.domain.Stock;
|
||||||
|
|
@ -22,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|
@ -173,6 +175,134 @@ public class KMReServiceImpl implements KMReService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param areaCode 库区编号
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String containerQuery(String areaCode) {
|
||||||
|
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
||||||
|
//请求 id
|
||||||
|
jsonObject.put("areaCode", areaCode);
|
||||||
|
//容器类型
|
||||||
|
jsonObject.put("containerCode", "");
|
||||||
|
//容器编号
|
||||||
|
jsonObject.put("containerModelCode", "");
|
||||||
|
|
||||||
|
jsonObject.put("emptyFullStatus", "");
|
||||||
|
//容器当前位置
|
||||||
|
jsonObject.put("position", "");
|
||||||
|
return jsonObject.toJSONString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void containerSynchronized(String areaCode) {
|
||||||
|
String resultJson = HttpPostUtil.sendPostReq(UrlApi.containerQuery(), containerQuery(areaCode));
|
||||||
|
if (StringUtils.isEmpty(resultJson)) {
|
||||||
|
throw new BadRequestException("AGV返回信息:下发任务接口调用失败!");
|
||||||
|
}
|
||||||
|
JSONObject resulObject = JSON.parseObject(resultJson);
|
||||||
|
if (resulObject == null) {
|
||||||
|
throw new BadRequestException("AGV返回信息:下发任务接口返回为空!");
|
||||||
|
}
|
||||||
|
|
||||||
|
String code = resulObject.getString("code");
|
||||||
|
String message = resulObject.getString("message");
|
||||||
|
if (!"0".equals(code)) {
|
||||||
|
throw new BadRequestException("AGV返回消息:" + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取数据
|
||||||
|
JSONArray resultArray = resulObject.getJSONArray("data");
|
||||||
|
|
||||||
|
//获取未移动的容器和点位
|
||||||
|
Map<String, String> containerNodeMap = buildContainerNodeMap(resultArray);
|
||||||
|
|
||||||
|
//通过AGV给的库区获取WMS对应的库区
|
||||||
|
List<String> areaNames = getAreaNames(areaCode);
|
||||||
|
|
||||||
|
//根据库区查询点位
|
||||||
|
List<Point> points = pointService.queryByAreaNames(areaNames,null);
|
||||||
|
|
||||||
|
//获取点位集合
|
||||||
|
List<String> pointCodes = points.stream().map(Point::getCode).collect(Collectors.toList());
|
||||||
|
|
||||||
|
//获取需要更新的点位
|
||||||
|
List<String> updatePoints = getUpdatePoints(containerNodeMap, pointCodes);
|
||||||
|
|
||||||
|
//更新容器和点位
|
||||||
|
processContainers(containerNodeMap);
|
||||||
|
|
||||||
|
//更新点位
|
||||||
|
processPoints(updatePoints);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, String> buildContainerNodeMap(JSONArray resultArray) {
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
for (int i = 0; i < resultArray.size(); i++) {
|
||||||
|
JSONObject jsonObject = resultArray.getJSONObject(i);
|
||||||
|
String isCarry = Optional.ofNullable(jsonObject.getString("isCarry")).orElse("");
|
||||||
|
String containerCode = Optional.ofNullable(jsonObject.getString("containerCode")).orElse("");
|
||||||
|
String nodeCode = Optional.ofNullable(jsonObject.getString("nodeCode")).orElse("");
|
||||||
|
if ("0".equals(isCarry)) {
|
||||||
|
map.put(containerCode, nodeCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getAreaNames(String areaCode) {
|
||||||
|
switch (areaCode) {
|
||||||
|
case "CPSXX-CX":
|
||||||
|
return Arrays.asList(AreaNameDic.CPRKQ, AreaNameDic.CPXXQ);
|
||||||
|
case "DJBY-CS":
|
||||||
|
return Arrays.asList(AreaNameDic.DJFBCQ, AreaNameDic.DJJLQ);
|
||||||
|
default:
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getUpdatePoints(Map<String, String> containerNodeMap, List<String> pointCodes) {
|
||||||
|
return pointCodes.stream()
|
||||||
|
.filter(pointCode -> !containerNodeMap.containsValue(pointCode))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processContainers(Map<String, String> containerNodeMap) {
|
||||||
|
for (Map.Entry<String, String> entry : containerNodeMap.entrySet()) {
|
||||||
|
Stock stock = stockService.validateStock(entry.getKey());
|
||||||
|
Point point = pointService.validatePoint(entry.getValue());
|
||||||
|
stockService.usedStock(stock, point, BaseStatus.USED);
|
||||||
|
pointService.usedPoint(point);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processPoints(List<String> updatePoints) {
|
||||||
|
for (String pointCode : updatePoints) {
|
||||||
|
Point point = pointService.validatePoint(pointCode);
|
||||||
|
Area area = point.getArea();
|
||||||
|
String areaName = area.getName();
|
||||||
|
String bizStatus = getBizStatus(areaName);
|
||||||
|
if (agvTaskService.isEndPointAvailable(pointCode, bizStatus, "RACK_MOVE")) {
|
||||||
|
pointService.freePoint(point);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getBizStatus(String areaName) {
|
||||||
|
switch (areaName) {
|
||||||
|
case AreaNameDic.CPRKQ:
|
||||||
|
return BizStatus.Cp_Off_Line;
|
||||||
|
case AreaNameDic.CPXXQ:
|
||||||
|
return BizStatus.Cp_Off_Up;
|
||||||
|
case AreaNameDic.DJJLQ:
|
||||||
|
return BizStatus.CALL_PICK;
|
||||||
|
case AreaNameDic.DJFBCQ:
|
||||||
|
return BizStatus.JL_Back;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 叉车任务Json
|
* 叉车任务Json
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,6 @@ public class MesServiceImpl implements MesService {
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
item = itemService.createItem(itemCode, itemDate.getItemName(), itemDate.getItemQty(), BizStatus.XJ);
|
item = itemService.createItem(itemCode, itemDate.getItemName(), itemDate.getItemQty(), BizStatus.XJ);
|
||||||
} else {
|
} else {
|
||||||
item.setGoodType(BizStatus.XJ);
|
|
||||||
item.setExtendD1(itemDate.getItemQty());
|
item.setExtendD1(itemDate.getItemQty());
|
||||||
itemRepository.save(item);
|
itemRepository.save(item);
|
||||||
}
|
}
|
||||||
|
|
@ -109,7 +108,6 @@ public class MesServiceImpl implements MesService {
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
item = itemService.createItem(itemDate.getItemCode(), itemDate.getItemName(), itemDate.getItemQty(), BizStatus.DJ);
|
item = itemService.createItem(itemDate.getItemCode(), itemDate.getItemName(), itemDate.getItemQty(), BizStatus.DJ);
|
||||||
} else {
|
} else {
|
||||||
item.setGoodType(BizStatus.DJ);
|
|
||||||
item.setExtendD1(itemDate.getItemQty());
|
item.setExtendD1(itemDate.getItemQty());
|
||||||
itemRepository.save(item);
|
itemRepository.save(item);
|
||||||
}
|
}
|
||||||
|
|
@ -252,7 +250,7 @@ public class MesServiceImpl implements MesService {
|
||||||
List<Stock> emptyStockList = getEmptyStockList();
|
List<Stock> emptyStockList = getEmptyStockList();
|
||||||
if (emptyStockList.isEmpty()) {
|
if (emptyStockList.isEmpty()) {
|
||||||
// 没有空车的处理逻辑
|
// 没有空车的处理逻辑
|
||||||
if (!isEndPointAvailable(endPoint.getCode(), BizStatus.Cp_Off_Up, "RACK_MOVE")) {
|
if (!agvTaskService.isEndPointAvailable(endPoint.getCode(), BizStatus.Cp_Off_Up, "RACK_MOVE")) {
|
||||||
return pointCode + "点位有任务,请稍后再试!";
|
return pointCode + "点位有任务,请稍后再试!";
|
||||||
}
|
}
|
||||||
// 生成agv任务进行等待
|
// 生成agv任务进行等待
|
||||||
|
|
@ -266,7 +264,7 @@ public class MesServiceImpl implements MesService {
|
||||||
Point srcPoint = emptyStock.getPoint();
|
Point srcPoint = emptyStock.getPoint();
|
||||||
|
|
||||||
// 验证终点是否有任务
|
// 验证终点是否有任务
|
||||||
if (!isEndPointAvailable(endPoint.getCode(), BizStatus.Cp_Off_Up, "RACK_MOVE")) {
|
if (!agvTaskService.isEndPointAvailable(endPoint.getCode(), BizStatus.Cp_Off_Up, "RACK_MOVE")) {
|
||||||
return pointCode + "点位有任务,请稍后再试!";
|
return pointCode + "点位有任务,请稍后再试!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -290,25 +288,7 @@ public class MesServiceImpl implements MesService {
|
||||||
return emptyStockList;
|
return emptyStockList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 验证终点是否有任务
|
|
||||||
*
|
|
||||||
* @param endPointCode 终点点位代码
|
|
||||||
* @return 终点是否可用
|
|
||||||
*/
|
|
||||||
private boolean isEndPointAvailable(String endPointCode, String type, String jobType) {
|
|
||||||
return agvTaskService.findByEndSlotCode(endPointCode, type, jobType);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 验证起点是否有任务
|
|
||||||
*
|
|
||||||
* @param startSlotCode 终点点位代码
|
|
||||||
* @return 终点是否可用
|
|
||||||
*/
|
|
||||||
private boolean isSrcPointAvailable(String startSlotCode, String type, String jobType) {
|
|
||||||
return agvTaskService.findByStartSlotCode(startSlotCode, type, jobType);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String moveCpOffLine(TransTask transTask) {
|
private String moveCpOffLine(TransTask transTask) {
|
||||||
Point srcPoint = pointRepository.findByCode(transTask.getPointCode());
|
Point srcPoint = pointRepository.findByCode(transTask.getPointCode());
|
||||||
|
|
@ -323,7 +303,7 @@ public class MesServiceImpl implements MesService {
|
||||||
Point endPoint = findAvailableEndPoint();
|
Point endPoint = findAvailableEndPoint();
|
||||||
if (endPoint == null) {
|
if (endPoint == null) {
|
||||||
// 没有可用终点点位的处理逻辑
|
// 没有可用终点点位的处理逻辑
|
||||||
if (!isSrcPointAvailable(srcPoint.getCode(), BizStatus.Cp_Off_Line, "RACK_MOVE")) {
|
if (!agvTaskService.isSrcPointAvailable(srcPoint.getCode(), BizStatus.Cp_Off_Line, "RACK_MOVE")) {
|
||||||
return srcPoint.getCode() + "点位有任务,请稍后再试!";
|
return srcPoint.getCode() + "点位有任务,请稍后再试!";
|
||||||
}
|
}
|
||||||
// 生成等待任务
|
// 生成等待任务
|
||||||
|
|
@ -338,7 +318,7 @@ public class MesServiceImpl implements MesService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证终点是否有任务
|
// 验证终点是否有任务
|
||||||
if (!isEndPointAvailable(endPoint.getCode(), BizStatus.Cp_Off_Line, "RACK_MOVE")) {
|
if (!agvTaskService.isEndPointAvailable(endPoint.getCode(), BizStatus.Cp_Off_Line, "RACK_MOVE")) {
|
||||||
return transTask.getPointCode() + "点位有任务,请稍后再试!";
|
return transTask.getPointCode() + "点位有任务,请稍后再试!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -383,7 +363,7 @@ public class MesServiceImpl implements MesService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证终点是否有任务
|
// 验证终点是否有任务
|
||||||
if (!isEndPointAvailable(dstPointCode, BizStatus.Fx_Off_Line, "ROLLER_MOVE")) {
|
if (!agvTaskService.isEndPointAvailable(dstPointCode, BizStatus.Fx_Off_Line, "ROLLER_MOVE")) {
|
||||||
return dstPointCode + "点位有任务,请稍后再试!";
|
return dstPointCode + "点位有任务,请稍后再试!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -427,7 +407,7 @@ public class MesServiceImpl implements MesService {
|
||||||
List<Point> endPointList = pointService.queryPoints(null, BaseStatus.FREE, BaseStatus.BOX, dstAreaCode);
|
List<Point> endPointList = pointService.queryPoints(null, BaseStatus.FREE, BaseStatus.BOX, dstAreaCode);
|
||||||
if (endPointList.isEmpty()) {
|
if (endPointList.isEmpty()) {
|
||||||
// 没有空车的处理逻辑
|
// 没有空车的处理逻辑
|
||||||
if (!isSrcPointAvailable(srcPoint.getCode(), BizStatus.JL_Back, "RACK_MOVE")) {
|
if (!agvTaskService.isSrcPointAvailable(srcPoint.getCode(), BizStatus.JL_Back, "RACK_MOVE")) {
|
||||||
return srcPoint.getCode() + "点位有任务,请稍后再试!";
|
return srcPoint.getCode() + "点位有任务,请稍后再试!";
|
||||||
}
|
}
|
||||||
//生成agv任务进行等待
|
//生成agv任务进行等待
|
||||||
|
|
@ -442,7 +422,7 @@ public class MesServiceImpl implements MesService {
|
||||||
|
|
||||||
Point endPoint = endPointList.get(0);
|
Point endPoint = endPointList.get(0);
|
||||||
|
|
||||||
if (!isEndPointAvailable(endPoint.getCode(), BizStatus.JL_Back, "RACK_MOVE")) {
|
if (!agvTaskService.isEndPointAvailable(endPoint.getCode(), BizStatus.JL_Back, "RACK_MOVE")) {
|
||||||
return endPoint.getCode() + "点位有任务,请稍后再试!";
|
return endPoint.getCode() + "点位有任务,请稍后再试!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -264,10 +264,12 @@ public class TaskServiceImpl implements TaskService {
|
||||||
//绑定任务
|
//绑定任务
|
||||||
List<Task> taskList = this.findByPickAllTask(pick.getId());
|
List<Task> taskList = this.findByPickAllTask(pick.getId());
|
||||||
if (taskList.isEmpty()) {
|
if (taskList.isEmpty()) {
|
||||||
return;
|
throw new BadRequestException(pick.getGdCode() + "工单没有进行翻包!");
|
||||||
|
}
|
||||||
|
//工单是否叫料
|
||||||
|
if (StringUtils.isEmpty(pick.getCallPoint())) {
|
||||||
|
throw new BadRequestException(pick.getGdCode() + "工单没有进行叫料!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//终点
|
//终点
|
||||||
String[] points = pick.getCallPoint().split(",");
|
String[] points = pick.getCallPoint().split(",");
|
||||||
String endPointCode = points[points.length - 1];
|
String endPointCode = points[points.length - 1];
|
||||||
|
|
@ -589,6 +591,8 @@ public class TaskServiceImpl implements TaskService {
|
||||||
Inventory newInventory = inventoryService.createInventory(itemKey, dstStock.getPoint(), dstStock, dept, moveQty);
|
Inventory newInventory = inventoryService.createInventory(itemKey, dstStock.getPoint(), dstStock, dept, moveQty);
|
||||||
|
|
||||||
//更新Task
|
//更新Task
|
||||||
|
double planQty = task.getPlanQty();
|
||||||
|
String status = task.getTaskStatus();
|
||||||
task.setInvId(inventory.getId());
|
task.setInvId(inventory.getId());
|
||||||
task.setNewInvId(newInventory.getId());
|
task.setNewInvId(newInventory.getId());
|
||||||
task.setMoveQty(task.getMoveQty() + moveQty);
|
task.setMoveQty(task.getMoveQty() + moveQty);
|
||||||
|
|
@ -602,9 +606,10 @@ public class TaskServiceImpl implements TaskService {
|
||||||
task.setMoveQty(moveQty);
|
task.setMoveQty(moveQty);
|
||||||
task.setTaskStatus(BizStatus.FINISH);
|
task.setTaskStatus(BizStatus.FINISH);
|
||||||
// 生成Task任务
|
// 生成Task任务
|
||||||
Task newTask = this.createTask(task.getItemKey().getItem(), task.getPlanQty() - moveQty, task.getItemKey(), null, BizStatus.PICK, pickDetail, task.getInvId(), task.getSrcStock(), task.getSrcPoint(), task.getDstPoint(), task.getAgvTask());
|
Task newTask = this.createTask(task.getItemKey().getItem(), planQty - moveQty, task.getItemKey(), null, BizStatus.PICK, pickDetail, task.getInvId(), task.getSrcStock(), task.getSrcPoint(), task.getDstPoint(), task.getAgvTask());
|
||||||
newTask.setDstStock(dstStock);
|
newTask.setDstStock(dstStock);
|
||||||
newTask.setDstStockCode(dstStock.getCode());
|
newTask.setDstStockCode(dstStock.getCode());
|
||||||
|
newTask.setTaskStatus(status);
|
||||||
taskRepository.save(newTask);
|
taskRepository.save(newTask);
|
||||||
}
|
}
|
||||||
taskRepository.save(task);
|
taskRepository.save(task);
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ public class pickTask {
|
||||||
* 生成叫料任务
|
* 生成叫料任务
|
||||||
*/
|
*/
|
||||||
public void createJlTask() {
|
public void createJlTask() {
|
||||||
/* *//*查询拣货完成完成的出库单*//*
|
//查询拣货完成完成的出库单
|
||||||
List<String> statuses = Arrays.asList(BizStatus.PICKUP, BizStatus.PICK_ALL);
|
List<String> statuses = Arrays.asList(BizStatus.PICKUP, BizStatus.PICK_ALL);
|
||||||
List<Pick> pickList = pickService.findByPickStatus(statuses, true);
|
List<Pick> pickList = pickService.findByPickStatus(statuses, true);
|
||||||
if (pickList.isEmpty()) {
|
if (pickList.isEmpty()) {
|
||||||
|
|
@ -80,7 +80,7 @@ public class pickTask {
|
||||||
synchronized (pick) {
|
synchronized (pick) {
|
||||||
taskService.callJlTask(pick);
|
taskService.callJlTask(pick);
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,4 +83,9 @@ public interface AreaNameDic {
|
||||||
*/
|
*/
|
||||||
String DJJLQ = "大件叫料区";
|
String DJJLQ = "大件叫料区";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大件返空区
|
||||||
|
*/
|
||||||
|
String DJFKQ = "大件返空区";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,34 @@ public class EladminSystemApplicationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String str = "17213913-0002";
|
List<String> list = new ArrayList<>();
|
||||||
String aa=str.substring(0,11);
|
list.add("DJ001");
|
||||||
System.out.println(aa);
|
list.add("DJ002");
|
||||||
|
list.add("DJ003");
|
||||||
|
list.add("DJ004");
|
||||||
|
list.add("DJ005");
|
||||||
|
list.add("DJ006");
|
||||||
|
list.add("DJ007");
|
||||||
|
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
map.put("1001","DJ001");
|
||||||
|
map.put("1003","DJ003");
|
||||||
|
map.put("1004","DJ004");
|
||||||
|
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
for (String element : list) {
|
||||||
|
// 检查 map 的值中是否包含当前元素
|
||||||
|
if (!map.containsValue(element)) {
|
||||||
|
// 如果不包含,则将该元素添加到结果列表中
|
||||||
|
result.add(element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> strings= list.stream()
|
||||||
|
.filter(pointCode -> !map.containsValue(pointCode))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
System.out.println(strings);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Set bb(Set set1, Set set2) {
|
static Set bb(Set set1, Set set2) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue