Compare commits
2 Commits
2862fdef4f
...
e931cb13e5
| Author | SHA1 | Date |
|---|---|---|
|
|
e931cb13e5 | |
|
|
a661dae55f |
|
|
@ -7,6 +7,7 @@ import org.springframework.http.HttpStatus;
|
||||||
public class ApiResult {
|
public class ApiResult {
|
||||||
private Object data;//数据
|
private Object data;//数据
|
||||||
private String msg;//内容
|
private String msg;//内容
|
||||||
|
private String notify;//样式
|
||||||
private int code;//编码
|
private int code;//编码
|
||||||
|
|
||||||
public static ApiResult fail() {
|
public static ApiResult fail() {
|
||||||
|
|
@ -36,6 +37,11 @@ public class ApiResult {
|
||||||
|
|
||||||
public static ApiResult result(int code, String msg, Object data) {
|
public static ApiResult result(int code, String msg, Object data) {
|
||||||
ApiResult rs = new ApiResult();
|
ApiResult rs = new ApiResult();
|
||||||
|
if (code==200){
|
||||||
|
rs.setNotify("success");
|
||||||
|
}else {
|
||||||
|
rs.setNotify("error");
|
||||||
|
}
|
||||||
rs.setCode(code);
|
rs.setCode(code);
|
||||||
rs.setMsg(msg);
|
rs.setMsg(msg);
|
||||||
rs.setData(data);
|
rs.setData(data);
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.youchain.Netty.model;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class Jb {
|
||||||
|
@ApiModelProperty(value = "点位编码")
|
||||||
|
String pointCode;//点位编码
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
/*
|
||||||
|
* 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.Netty.rest;
|
||||||
|
|
||||||
|
import com.youchain.Netty.model.Jb;
|
||||||
|
import com.youchain.annotation.AnonymousAccess;
|
||||||
|
import com.youchain.annotation.Log;
|
||||||
|
import com.youchain.basicdata.domain.Point;
|
||||||
|
import com.youchain.basicdata.repository.PointRepository;
|
||||||
|
import com.youchain.exception.handler.ApiResult;
|
||||||
|
import com.youchain.modules.mnt.domain.App;
|
||||||
|
import com.youchain.modules.mnt.service.AppService;
|
||||||
|
import com.youchain.modules.mnt.service.dto.AppQueryCriteria;
|
||||||
|
import com.youchain.utils.BaseStatus;
|
||||||
|
import com.youchain.utils.BizStatus;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhanghouying
|
||||||
|
* @date 2019-08-24
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Api(tags = "合肥暖通PDA")
|
||||||
|
@RequestMapping("/api/pdaHvac")
|
||||||
|
public class PdaHvacController {
|
||||||
|
private final PointRepository pointRepository;
|
||||||
|
@Log("解绑备货位")
|
||||||
|
@ApiOperation("解绑备货位")
|
||||||
|
@PostMapping(value = "/jb")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> Jb(@RequestBody Jb jb){
|
||||||
|
ApiResult apiResult=ApiResult.fail(200,"解绑成功",null);
|
||||||
|
Point point = pointRepository.findByCode(jb.getPointCode());
|
||||||
|
if (point!=null){
|
||||||
|
if (!point.getStatus().equals(BaseStatus.USED)) {
|
||||||
|
apiResult=ApiResult.fail(400,"库位未占用",null);
|
||||||
|
}
|
||||||
|
else if (!point.getArea().getCode().equals("出库接驳口")){
|
||||||
|
apiResult=ApiResult.fail(400,"库位不在出库接驳点",null);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
point.setStatus(BaseStatus.FREE);
|
||||||
|
pointRepository.save(point);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
apiResult=ApiResult.fail(400,"未查询到库位",null);
|
||||||
|
}
|
||||||
|
return new ResponseEntity<>(apiResult,apiResult.getStatus());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.youchain.basicdata.model;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class YhWcModel {
|
||||||
|
@ApiModelProperty(value = "工单编码")
|
||||||
|
String gdCode;
|
||||||
|
}
|
||||||
|
|
@ -33,7 +33,7 @@ public interface PointRepository extends JpaRepository<Point, Long>, JpaSpecific
|
||||||
public List<Map<String, String>> getKyPointList();
|
public List<Map<String, String>> getKyPointList();
|
||||||
@Query(value = "SELECT p FROM Point p WHERE p.code=?1", nativeQuery = false)
|
@Query(value = "SELECT p FROM Point p WHERE p.code=?1", nativeQuery = false)
|
||||||
Point findByCode(String code);
|
Point findByCode(String code);
|
||||||
@Query(value = "SELECT p FROM Point p WHERE p.area.name=?1 and p.status=?2 and p.enabled=1", nativeQuery = false)
|
@Query(value = "SELECT p FROM Point p WHERE p.area.name=?1 and p.status=?2 and p.enabled=true", nativeQuery = false)
|
||||||
List<Point> findByAreaAndStatus(String areaName,String status);
|
List<Point> findByAreaAndStatus(String areaName,String status);
|
||||||
|
|
||||||
/** 库位信息化看板*/
|
/** 库位信息化看板*/
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,20 @@ public class PointController {
|
||||||
public ResponseEntity<Object> queryPoint(PointQueryCriteria criteria, Pageable pageable) {
|
public ResponseEntity<Object> queryPoint(PointQueryCriteria criteria, Pageable pageable) {
|
||||||
return new ResponseEntity<>(pointService.queryAll(criteria, pageable), HttpStatus.OK);
|
return new ResponseEntity<>(pointService.queryAll(criteria, pageable), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
@PostMapping("/clearCk")
|
||||||
|
@ApiOperation("清空备货位")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> clearCk() {
|
||||||
|
/* 清空出库接驳口*/
|
||||||
|
List<Point> pointList = pointRepository.findByAreaAndStatus("出库接驳口", BaseStatus.USED);
|
||||||
|
for (Point p : pointList) {
|
||||||
|
p.setStatus(BaseStatus.FREE);
|
||||||
|
pointRepository.save(p);
|
||||||
|
}
|
||||||
|
ApiResult apiResult=ApiResult.fail(200,"操作成功",null);
|
||||||
|
return new ResponseEntity<>(apiResult, apiResult.getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(value = "/queryPointList")
|
@GetMapping(value = "/queryPointList")
|
||||||
@ApiOperation("下拉查询点位")
|
@ApiOperation("下拉查询点位")
|
||||||
|
|
|
||||||
|
|
@ -146,6 +146,13 @@ public class PointServiceImpl implements PointService {
|
||||||
map.put("外部编码", point.getCode());
|
map.put("外部编码", point.getCode());
|
||||||
map.put("名称", point.getName());
|
map.put("名称", point.getName());
|
||||||
map.put("状态", point.getStatus());
|
map.put("状态", point.getStatus());
|
||||||
|
String types="";
|
||||||
|
if (point.getType().equals(BaseStatus.STORAGE)) {
|
||||||
|
types = "存储点";
|
||||||
|
} else if (point.getType().equals(BaseStatus.BOX)) {
|
||||||
|
types = "线边点位";
|
||||||
|
}
|
||||||
|
map.put("存储类型", types);
|
||||||
map.put("描述", point.getDescription());
|
map.put("描述", point.getDescription());
|
||||||
map.put("库区", point.getArea().getName());
|
map.put("库区", point.getArea().getName());
|
||||||
map.put("地标码", point.getBeatCode());
|
map.put("地标码", point.getBeatCode());
|
||||||
|
|
|
||||||
|
|
@ -108,8 +108,8 @@ public class Inventory extends BaseEntity implements Serializable {
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@Column(name = "`be_lock`")
|
@Column(name = "`be_lock`")
|
||||||
@ApiModelProperty(value = "是否锁定")
|
@ApiModelProperty(value = "检验")
|
||||||
private Boolean beLock=false;
|
private Boolean beLock=true;
|
||||||
|
|
||||||
@Column(name = "`be_reject`")
|
@Column(name = "`be_reject`")
|
||||||
@ApiModelProperty(value = "是否不良品")
|
@ApiModelProperty(value = "是否不良品")
|
||||||
|
|
|
||||||
|
|
@ -29,5 +29,6 @@ import java.util.List;
|
||||||
* @date 2023-08-22
|
* @date 2023-08-22
|
||||||
**/
|
**/
|
||||||
public interface InventoryRepository extends JpaRepository<Inventory, Long>, JpaSpecificationExecutor<Inventory> {
|
public interface InventoryRepository extends JpaRepository<Inventory, Long>, JpaSpecificationExecutor<Inventory> {
|
||||||
|
@Query(value = "select inv from Inventory inv where inv.billCode=?1 ")
|
||||||
|
List<Inventory> findByBillCode(String billCode);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,4 +80,6 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
|
||||||
*/
|
*/
|
||||||
@Query(value = "select * from data_task a where a.dst_point_code like 'MA1151-QHL%' and a.create_time > :time", nativeQuery = true)
|
@Query(value = "select * from data_task a where a.dst_point_code like 'MA1151-QHL%' and a.create_time > :time", nativeQuery = true)
|
||||||
List<Task> queryInQHALLData(String time);
|
List<Task> queryInQHALLData(String time);
|
||||||
|
|
||||||
|
List<Task> findByTaskStatus(String inspect);
|
||||||
}
|
}
|
||||||
|
|
@ -3,6 +3,8 @@ package com.youchain.businessdata.rest;
|
||||||
import com.youchain.annotation.Log;
|
import com.youchain.annotation.Log;
|
||||||
import com.youchain.annotation.AnonymousAccess;
|
import com.youchain.annotation.AnonymousAccess;
|
||||||
import com.youchain.appupdate.inputJson.MissionStateCallback;
|
import com.youchain.appupdate.inputJson.MissionStateCallback;
|
||||||
|
import com.youchain.basicdata.domain.Point;
|
||||||
|
import com.youchain.basicdata.repository.PointRepository;
|
||||||
import com.youchain.businessdata.domain.AgvTask;
|
import com.youchain.businessdata.domain.AgvTask;
|
||||||
import com.youchain.businessdata.domain.Inventory;
|
import com.youchain.businessdata.domain.Inventory;
|
||||||
import com.youchain.businessdata.domain.ItemKey;
|
import com.youchain.businessdata.domain.ItemKey;
|
||||||
|
|
@ -22,6 +24,7 @@ import com.youchain.businessdata.service.dto.AgvTaskDto;
|
||||||
import com.youchain.businessdata.service.dto.OrderDto;
|
import com.youchain.businessdata.service.dto.OrderDto;
|
||||||
import com.youchain.exception.handler.ApiResult;
|
import com.youchain.exception.handler.ApiResult;
|
||||||
import com.youchain.service.LogService;
|
import com.youchain.service.LogService;
|
||||||
|
import com.youchain.utils.BaseStatus;
|
||||||
import com.youchain.utils.BizStatus;
|
import com.youchain.utils.BizStatus;
|
||||||
import com.youchain.utils.UrlApi;
|
import com.youchain.utils.UrlApi;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|
@ -49,6 +52,7 @@ public class KMReSController {
|
||||||
|
|
||||||
private final AgvTaskService agvTaskService;
|
private final AgvTaskService agvTaskService;
|
||||||
private final AgvTaskRepository agvTaskRepository;
|
private final AgvTaskRepository agvTaskRepository;
|
||||||
|
private final PointRepository pointRepository;
|
||||||
private final TaskRepository taskRepository;
|
private final TaskRepository taskRepository;
|
||||||
private final InventoryRepository inventoryRepository;
|
private final InventoryRepository inventoryRepository;
|
||||||
private final TaskService taskService;
|
private final TaskService taskService;
|
||||||
|
|
@ -80,10 +84,55 @@ public class KMReSController {
|
||||||
} else if (agvTask.getType().equals(BizStatus.ASN)) {
|
} else if (agvTask.getType().equals(BizStatus.ASN)) {
|
||||||
//入库
|
//入库
|
||||||
asnTask(id, missionStatus,slotCode);
|
asnTask(id, missionStatus,slotCode);
|
||||||
|
} else if (agvTask.getType().equals(BizStatus.INV)) {
|
||||||
|
invTask(id, missionStatus,slotCode);
|
||||||
|
} else if (agvTask.getType().equals(BizStatus.INV_BACK)) {
|
||||||
|
invBackTask(id, missionStatus,slotCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 验货 返空任务完成*/
|
||||||
|
private void invBackTask(String id, String missionStatus, String slotCode) {
|
||||||
|
if (missionStatus.equals(BizStatus.PICKER_RECEIVE)) {
|
||||||
|
/* 清空起点*/
|
||||||
|
Point point=pointRepository.findByCode(slotCode);
|
||||||
|
point.setStatus(BaseStatus.FREE);
|
||||||
|
pointRepository.save(point);
|
||||||
|
}else
|
||||||
|
if (missionStatus.equals(BizStatus.PICKER_SEND)) {
|
||||||
|
AgvTask agvTask=agvTaskRepository.getById(Integer.valueOf(id));
|
||||||
|
Point point=pointRepository.findByCode(slotCode);
|
||||||
|
if (point!=null){
|
||||||
|
/* 修改任务状态*/
|
||||||
|
Task task = getFirstTask(agvTask.getId());
|
||||||
|
task.setTaskStatus(BizStatus.FINISH);
|
||||||
|
taskRepository.save(task);
|
||||||
|
/* 清除库存占用*/
|
||||||
|
Inventory inventory=inventoryRepository.getById(task.getInvId());
|
||||||
|
inventory.setQueuedQty(0d);
|
||||||
|
inventoryRepository.save(inventory);
|
||||||
|
}
|
||||||
|
agvTask.setStatus(BizStatus.FINISH);
|
||||||
|
agvTaskRepository.save(agvTask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void invTask(String id, String missionStatus, String slotCode) {
|
||||||
|
if (missionStatus.equals(BizStatus.PICKER_SEND)) {
|
||||||
|
AgvTask agvTask=agvTaskRepository.getById(Integer.valueOf(id));
|
||||||
|
Point point=pointRepository.findByCode(slotCode);
|
||||||
|
if (point!=null){
|
||||||
|
Task task = getFirstTask(agvTask.getId());
|
||||||
|
task.setTaskStatus(BizStatus.INSPECT);
|
||||||
|
task.setMoveQty(task.getPlanQty());
|
||||||
|
taskRepository.save(task);
|
||||||
|
}
|
||||||
|
agvTask.setStatus(BizStatus.FINISH);
|
||||||
|
agvTaskRepository.save(agvTask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void asnTask(String id, String missionStatus, String slotCode) {
|
public void asnTask(String id, String missionStatus, String slotCode) {
|
||||||
//执行第一个任务后 可以继续执行第二个任务 并携带第一个任务的返回值 第二个任务执行完没有返回值
|
//执行第一个任务后 可以继续执行第二个任务 并携带第一个任务的返回值 第二个任务执行完没有返回值
|
||||||
AgvTaskDto agvTaskDto = agvTaskService.findById(Integer.parseInt(id));
|
AgvTaskDto agvTaskDto = agvTaskService.findById(Integer.parseInt(id));
|
||||||
|
|
|
||||||
|
|
@ -22,22 +22,29 @@ import com.youchain.annotation.AnonymousAccess;
|
||||||
import com.youchain.annotation.Log;
|
import com.youchain.annotation.Log;
|
||||||
import com.youchain.basicdata.domain.Box;
|
import com.youchain.basicdata.domain.Box;
|
||||||
import com.youchain.basicdata.domain.Item;
|
import com.youchain.basicdata.domain.Item;
|
||||||
|
import com.youchain.basicdata.domain.Point;
|
||||||
|
import com.youchain.basicdata.model.YhWcModel;
|
||||||
|
import com.youchain.basicdata.repository.PointRepository;
|
||||||
import com.youchain.basicdata.service.ItemService;
|
import com.youchain.basicdata.service.ItemService;
|
||||||
import com.youchain.businessdata.ReturnJson.RPTaskList;
|
import com.youchain.businessdata.ReturnJson.RPTaskList;
|
||||||
|
import com.youchain.businessdata.domain.AgvTask;
|
||||||
import com.youchain.businessdata.domain.Inventory;
|
import com.youchain.businessdata.domain.Inventory;
|
||||||
import com.youchain.businessdata.domain.PickDetail;
|
import com.youchain.businessdata.domain.PickDetail;
|
||||||
import com.youchain.businessdata.domain.Task;
|
import com.youchain.businessdata.domain.Task;
|
||||||
import com.youchain.businessdata.inputJson.IPPickDetail;
|
import com.youchain.businessdata.inputJson.IPPickDetail;
|
||||||
import com.youchain.businessdata.inputJson.IScanPut;
|
import com.youchain.businessdata.inputJson.IScanPut;
|
||||||
import com.youchain.businessdata.service.InventoryLogService;
|
import com.youchain.businessdata.repository.AgvTaskRepository;
|
||||||
import com.youchain.businessdata.service.PickDetailService;
|
import com.youchain.businessdata.repository.InventoryRepository;
|
||||||
import com.youchain.businessdata.service.TaskService;
|
import com.youchain.businessdata.repository.TaskRepository;
|
||||||
|
import com.youchain.businessdata.service.*;
|
||||||
import com.youchain.businessdata.service.dto.PickDetailDto;
|
import com.youchain.businessdata.service.dto.PickDetailDto;
|
||||||
import com.youchain.businessdata.service.dto.PickDetailQueryCriteria;
|
import com.youchain.businessdata.service.dto.PickDetailQueryCriteria;
|
||||||
import com.youchain.businessdata.service.dto.TaskDto;
|
import com.youchain.businessdata.service.dto.TaskDto;
|
||||||
import com.youchain.businessdata.service.dto.TaskQueryCriteria;
|
import com.youchain.businessdata.service.dto.TaskQueryCriteria;
|
||||||
|
import com.youchain.exception.BadRequestException;
|
||||||
import com.youchain.exception.handler.ApiError;
|
import com.youchain.exception.handler.ApiError;
|
||||||
import com.youchain.exception.handler.ApiResult;
|
import com.youchain.exception.handler.ApiResult;
|
||||||
|
import com.youchain.utils.BaseStatus;
|
||||||
import com.youchain.utils.BizStatus;
|
import com.youchain.utils.BizStatus;
|
||||||
import com.youchain.utils.HttpUtils;
|
import com.youchain.utils.HttpUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
@ -75,6 +82,11 @@ public class PickDetailController {
|
||||||
|
|
||||||
private final PickDetailService pickDetailService;
|
private final PickDetailService pickDetailService;
|
||||||
private final TaskService taskService;
|
private final TaskService taskService;
|
||||||
|
private final TaskRepository taskRepository;
|
||||||
|
private final AgvTaskService agvTaskService;
|
||||||
|
private final AgvTaskRepository agvTaskRepository;
|
||||||
|
private final PointRepository pointRepository;
|
||||||
|
private final InventoryRepository inventoryRepository;
|
||||||
|
|
||||||
|
|
||||||
@Log("导出数据")
|
@Log("导出数据")
|
||||||
|
|
@ -172,6 +184,83 @@ public class PickDetailController {
|
||||||
List<RPTaskList> t=taskService.queryTaskApp(null);
|
List<RPTaskList> t=taskService.queryTaskApp(null);
|
||||||
return new ResponseEntity<>(t,HttpStatus.OK);
|
return new ResponseEntity<>(t,HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
@PostMapping("/yhWc")
|
||||||
|
@Log("验货完成")
|
||||||
|
@ApiOperation("验货完成")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> yhWc(@RequestBody YhWcModel yhWcModel){
|
||||||
|
List<Inventory> inventoryList=inventoryRepository.findByBillCode(yhWcModel.getGdCode());
|
||||||
|
if (inventoryList.size()<1){
|
||||||
|
throw new BadRequestException(HttpStatus.INTERNAL_SERVER_ERROR, "工单号错误,未查询到库存");
|
||||||
|
}else {
|
||||||
|
/* 更新检验状态*/
|
||||||
|
for (Inventory inventory:inventoryList){
|
||||||
|
if (inventory.getBeLock()==true){
|
||||||
|
inventory.setBeLock(false);
|
||||||
|
inventoryRepository.save(inventory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* 验货返空*/
|
||||||
|
List<Task> taskList=taskRepository.findByTaskStatus(BizStatus.INSPECT);
|
||||||
|
for (Task task:taskList){
|
||||||
|
/* 生成搬运任务*/
|
||||||
|
AgvTask agvTask = new AgvTask(BizStatus.INV_BACK, task.getSrcStock().getCode(), task.getDstPoint().getCode(), task.getSrcPoint().getCode(), BizStatus.OPEN, "PICKER_MOVE");
|
||||||
|
agvTaskRepository.save(agvTask);
|
||||||
|
/* 修改Task状态*/
|
||||||
|
task.setTaskStatus(BizStatus.RETURN);
|
||||||
|
task.setAgvTask(agvTask);
|
||||||
|
taskRepository.save(task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* 检测验货中的物料-确认返空*/
|
||||||
|
ApiResult apiResult=ApiResult.fail(200,"验货完成",null);
|
||||||
|
return new ResponseEntity<>(apiResult,apiResult.getStatus());
|
||||||
|
}
|
||||||
|
@PostMapping("/yhFk")
|
||||||
|
@Log("验货-返空")
|
||||||
|
@ApiOperation("验货-返空")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> fk(@RequestBody YhWcModel yhWcModel){
|
||||||
|
|
||||||
|
|
||||||
|
ApiResult apiResult=ApiResult.fail(200,"验货完成",null);
|
||||||
|
return new ResponseEntity<>(apiResult,apiResult.getStatus());
|
||||||
|
}
|
||||||
|
@PostMapping("/hjYh")
|
||||||
|
@Log("呼叫验货")
|
||||||
|
@ApiOperation("呼叫验货")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> hjYh(@RequestBody Long[] ids){
|
||||||
|
int a=0;
|
||||||
|
List<Point> pointList = pointRepository.findByAreaAndStatus("验货货架", BaseStatus.FREE);
|
||||||
|
if (ids.length>pointList.size()){
|
||||||
|
throw new BadRequestException(HttpStatus.INTERNAL_SERVER_ERROR, "验货货架,没有库位");
|
||||||
|
}
|
||||||
|
for (Long id:ids){
|
||||||
|
Inventory inventory=inventoryRepository.getById(id);
|
||||||
|
if (inventory.getBeLock()==true&&inventory.getQueuedQty()==0){
|
||||||
|
Point endPoint=pointList.get(a);
|
||||||
|
/* 生成搬运任务*/
|
||||||
|
AgvTask agvTask = new AgvTask(BizStatus.INV, inventory.getStock().getCode(), inventory.getPoint().getCode(), endPoint.getCode(), BizStatus.OPEN, "PICKER_MOVE");
|
||||||
|
agvTaskRepository.save(agvTask);
|
||||||
|
/* 占用库存*/
|
||||||
|
inventory.setQueuedQty(inventory.getQuantity());
|
||||||
|
inventoryRepository.save(inventory);
|
||||||
|
/* 生成Task任务*/
|
||||||
|
Task task = new Task(inventory.getItemKey().getItem(), inventory.getItemKey(), inventory.getBillCode(), BizStatus.INV, null, null, null, null, inventory.getStock()
|
||||||
|
, inventory.getStock(), inventory.getPoint(), endPoint, inventory.getStock().getCode(), inventory.getStock().getCode(),
|
||||||
|
inventory.getPoint().getCode(), endPoint.getCode(), null, BizStatus.OPEN, inventory.getQuantity(), null, inventory.getId(), inventory.getDept(), agvTask);
|
||||||
|
taskService.create(task);
|
||||||
|
System.out.println("id:"+id);
|
||||||
|
/* 锁定目标位*/
|
||||||
|
endPoint.setStatus(BaseStatus.USED);
|
||||||
|
pointRepository.save(endPoint);
|
||||||
|
a=a+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ApiResult apiResult=ApiResult.fail(200,"呼叫成功,新增"+a+"条搬运任务",null);
|
||||||
|
return new ResponseEntity<>(apiResult,apiResult.getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/pickingApp")
|
@PostMapping("/pickingApp")
|
||||||
@Log("APP拣货确认")
|
@Log("APP拣货确认")
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,9 @@ public class InventoryQueryCriteria{
|
||||||
// NOT_EQUAL 不等于
|
// NOT_EQUAL 不等于
|
||||||
@Query(type = Query.Type.NOT_EQUAL)
|
@Query(type = Query.Type.NOT_EQUAL)
|
||||||
private Double quantity;
|
private Double quantity;
|
||||||
|
/** 是否检验*/
|
||||||
|
@Query(type = Query.Type.EQUAL)
|
||||||
|
private Boolean beLock;
|
||||||
@Query(joinName = "stock", propName="code",type = Query.Type.INNER_LIKE)
|
@Query(joinName = "stock", propName="code",type = Query.Type.INNER_LIKE)
|
||||||
private String stockCode;
|
private String stockCode;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -287,14 +287,14 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
|
|
||||||
objMap.put("missionData", missionDataArray);
|
objMap.put("missionData", missionDataArray);
|
||||||
jsonObject.putAll(objMap);
|
jsonObject.putAll(objMap);
|
||||||
/*String resultJson = "{\n" +
|
String resultJson = "{\n" +
|
||||||
" \"data\": null,\n" +
|
" \"data\": null,\n" +
|
||||||
" \"code\": \"0\",\n" +
|
" \"code\": \"0\",\n" +
|
||||||
" \"message\": null,\n" +
|
" \"message\": null,\n" +
|
||||||
" \"success\": true\n" +
|
" \"success\": true\n" +
|
||||||
"}";*/
|
"}";
|
||||||
String resultJson = HttpPostUtil.sendPostReq(UrlApi.submitMission, jsonObject.toString());
|
// String resultJson = HttpPostUtil.sendPostReq(UrlApi.submitMission, jsonObject.toString());
|
||||||
if (resultJson == null) {
|
if (resultJson== null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
JSONObject resulObject = JSON.parseObject(resultJson);
|
JSONObject resulObject = JSON.parseObject(resultJson);
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ public class InventoryServiceImpl implements InventoryService {
|
||||||
if (billCode.isEmpty()) {
|
if (billCode.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String hql = " from Inventory inv where 1=1 and inv.billCode in (:billCode) and inv.quantity-inv.queuedQty>0 ";
|
String hql = " from Inventory inv where 1=1 and inv.billCode in (:billCode) ";
|
||||||
Query query = entityManager.createQuery(hql);
|
Query query = entityManager.createQuery(hql);
|
||||||
query.setParameter("billCode", billCode);
|
query.setParameter("billCode", billCode);
|
||||||
List<Inventory> list = query.getResultList();
|
List<Inventory> list = query.getResultList();
|
||||||
|
|
|
||||||
|
|
@ -427,97 +427,108 @@ public class MlsServiceImpl implements MlsService {
|
||||||
if (inventoryListFuture.join().isEmpty()) {
|
if (inventoryListFuture.join().isEmpty()) {
|
||||||
throw new RuntimeException("无库存信息!");
|
throw new RuntimeException("无库存信息!");
|
||||||
}
|
}
|
||||||
try {
|
List<String> errorMsgList = new ArrayList<>();
|
||||||
inventoryListFuture.thenAccept((result) -> {
|
inventoryListFuture.thenAccept((result) -> {
|
||||||
//目标点
|
//目标点
|
||||||
/*Point endPoint = redisObjectUtils.getObjectFromCache("ckjbk", () -> pointService.findByCode(null, BaseStatus.FREE, null, "出库接驳口", null),
|
/*Point endPoint = redisObjectUtils.getObjectFromCache("ckjbk", () -> pointService.findByCode(null, BaseStatus.FREE, null, "出库接驳口", null),
|
||||||
"系统无此点位!");*/
|
"系统无此点位!");*/
|
||||||
|
|
||||||
List<Inventory> inventoryToUpdate = new ArrayList<>();
|
List<Inventory> inventoryToUpdate = new ArrayList<>();
|
||||||
List<PickDetail> pickDetailToCreate = new ArrayList<>();
|
List<PickDetail> pickDetailToCreate = new ArrayList<>();
|
||||||
List<AgvTask> agvTaskToCreate = new ArrayList<>();
|
List<AgvTask> agvTaskToCreate = new ArrayList<>();
|
||||||
List<Task> taskToCreate = new ArrayList<>();
|
List<Task> taskToCreate = new ArrayList<>();
|
||||||
for (Inventory inv : result) {
|
for (Inventory inv : result) {
|
||||||
/* 按顺序获取出库接驳点*/
|
/* 按顺序获取出库接驳点*/
|
||||||
Point endPoint;
|
Point endPoint;
|
||||||
List<Point> pointList = pointRepository.findByAreaAndStatus("出库接驳口", BaseStatus.FREE);
|
List<Point> pointList = pointRepository.findByAreaAndStatus("出库接驳口", BaseStatus.FREE);
|
||||||
if (pointList.size() < 1) {
|
if (pointList.size() < 1) {
|
||||||
throw new RuntimeException("无空闲出库接驳口!");
|
errorMsgList.add(inv.getItemKey().getPropC1() + "标签分配无空闲备货位!");
|
||||||
/* 出库接驳口无空闲库位,更新状态重新分配*/
|
continue;
|
||||||
|
/* 出库接驳口无空闲库位,更新状态重新分配*/
|
||||||
/*pointList = pointRepository.findByAreaAndStatus("出库接驳口", BaseStatus.USED);
|
/*pointList = pointRepository.findByAreaAndStatus("出库接驳口", BaseStatus.USED);
|
||||||
for (Point p : pointList) {
|
for (Point p : pointList) {
|
||||||
p.setStatus(BaseStatus.FREE);
|
p.setStatus(BaseStatus.FREE);
|
||||||
pointRepository.save(p);
|
pointRepository.save(p);
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
endPoint = pointList.get(0);
|
if (inv.getBeLock()==true&&BaseCode.PICK_YH_QR.equals("1")){
|
||||||
endPoint.setStatus(BaseStatus.USED);
|
errorMsgList.add(inv.getItemKey().getPropC1() + "库存未验货!");
|
||||||
pointRepository.save(endPoint);
|
continue;
|
||||||
|
}
|
||||||
|
if (inv.getQueuedQty()>0){
|
||||||
|
errorMsgList.add(inv.getItemKey().getPropC1() + "库存已被占用!");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
endPoint = pointList.get(0);
|
||||||
|
endPoint.setStatus(BaseStatus.USED);
|
||||||
|
pointRepository.save(endPoint);
|
||||||
|
|
||||||
//根据库存信息生成叫料任务
|
//根据库存信息生成叫料任务
|
||||||
Stock stock = inv.getStock();//容器
|
Stock stock = inv.getStock();//容器
|
||||||
Point startPoint = inv.getPoint();//起始点位
|
Point startPoint = inv.getPoint();//起始点位
|
||||||
ItemKey itemKey = inv.getItemKey();
|
ItemKey itemKey = inv.getItemKey();
|
||||||
Item item = inv.getItemKey().getItem();
|
Item item = inv.getItemKey().getItem();
|
||||||
|
|
||||||
//更新库存信息
|
//更新库存信息
|
||||||
inventoryToUpdate.add(updateInventory(inv));
|
inventoryToUpdate.add(updateInventory(inv));
|
||||||
|
|
||||||
//生成出库明细
|
//生成出库明细
|
||||||
PickDetail pd = createPickDetail(item, inv.getBillCode(), itemKey.getPropC1(), inv.getQuantity(), issueInfo.getTaskNumber());
|
PickDetail pd = createPickDetail(item, inv.getBillCode(), itemKey.getPropC1(), inv.getQuantity(), issueInfo.getTaskNumber());
|
||||||
pickDetailToCreate.add(pd);
|
pickDetailToCreate.add(pd);
|
||||||
|
|
||||||
//生成搬运任务
|
//生成搬运任务
|
||||||
AgvTask agvTask = new AgvTask(BizStatus.PICK, stock.getCode(), startPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "PICKER_MOVE");
|
AgvTask agvTask = new AgvTask(BizStatus.PICK, stock.getCode(), startPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "PICKER_MOVE");
|
||||||
agvTaskToCreate.add(agvTask);
|
agvTaskToCreate.add(agvTask);
|
||||||
|
|
||||||
//生成Task
|
//生成Task
|
||||||
Task task = createTask(item, itemKey, pd, inv.getBillCode(), stock, startPoint, endPoint, agvTask, inv);
|
Task task = createTask(item, itemKey, pd, inv.getBillCode(), stock, startPoint, endPoint, agvTask, inv);
|
||||||
taskToCreate.add(task);
|
taskToCreate.add(task);
|
||||||
|
}
|
||||||
|
if (!errorMsgList.isEmpty()) {
|
||||||
|
throw new RuntimeException(errorMsgList.toString());
|
||||||
|
}
|
||||||
|
ExecutorService executor = ThreadPoolExecutorUtil.getPoll("getIssueInfo-job");
|
||||||
|
|
||||||
|
// 批量更新库存信息
|
||||||
|
CompletableFuture<Void> inventoryFuture = CompletableFuture.runAsync(() -> {
|
||||||
|
//批量更新库存信息
|
||||||
|
if (!inventoryToUpdate.isEmpty()) {
|
||||||
|
batchCreateOrUpdate.batchUpdate(inventoryToUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
ExecutorService executor = ThreadPoolExecutorUtil.getPoll("getIssueInfo-job");
|
}, executor);
|
||||||
|
|
||||||
// 批量更新库存信息
|
|
||||||
CompletableFuture<Void> inventoryFuture = CompletableFuture.runAsync(() -> {
|
|
||||||
//批量更新库存信息
|
|
||||||
if (!inventoryToUpdate.isEmpty()) {
|
|
||||||
batchCreateOrUpdate.batchUpdate(inventoryToUpdate);
|
|
||||||
}
|
|
||||||
|
|
||||||
}, executor);
|
|
||||||
|
|
||||||
|
|
||||||
CompletableFuture<Void> pickDetailFuture = inventoryFuture.thenRunAsync(() -> {
|
CompletableFuture<Void> pickDetailFuture = inventoryFuture.thenRunAsync(() -> {
|
||||||
//批量生成叫料明细
|
//批量生成叫料明细
|
||||||
if (!pickDetailToCreate.isEmpty()) {
|
if (!pickDetailToCreate.isEmpty()) {
|
||||||
batchCreateOrUpdate.batchCreate(pickDetailToCreate);
|
batchCreateOrUpdate.batchCreate(pickDetailToCreate);
|
||||||
}
|
}
|
||||||
|
|
||||||
}, executor);
|
}, executor);
|
||||||
|
|
||||||
CompletableFuture<Void> agvTaskFuture = pickDetailFuture.thenRunAsync(() -> {
|
CompletableFuture<Void> agvTaskFuture = pickDetailFuture.thenRunAsync(() -> {
|
||||||
// 批量生成agv任务
|
// 批量生成agv任务
|
||||||
if (!agvTaskToCreate.isEmpty()) {
|
if (!agvTaskToCreate.isEmpty()) {
|
||||||
batchCreateOrUpdate.batchCreate(agvTaskToCreate);
|
batchCreateOrUpdate.batchCreate(agvTaskToCreate);
|
||||||
}
|
}
|
||||||
|
|
||||||
}, executor);
|
}, executor);
|
||||||
|
|
||||||
CompletableFuture<Void> taskFuture = agvTaskFuture.thenRunAsync(() -> {
|
CompletableFuture<Void> taskFuture = agvTaskFuture.thenRunAsync(() -> {
|
||||||
// 批量生成任务
|
// 批量生成任务
|
||||||
if (!taskToCreate.isEmpty()) {
|
if (!taskToCreate.isEmpty()) {
|
||||||
batchCreateOrUpdate.batchCreate(taskToCreate);
|
batchCreateOrUpdate.batchCreate(taskToCreate);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}, executor);
|
}, executor);
|
||||||
taskFuture.join();
|
taskFuture.join();
|
||||||
|
|
||||||
executor.shutdown();
|
executor.shutdown();
|
||||||
}).join();
|
});
|
||||||
} catch (Exception e) {
|
if (!errorMsgList.isEmpty()) {
|
||||||
throw new RuntimeException(e.getMessage());
|
throw new RuntimeException(errorMsgList.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,5 +15,6 @@ public class configTask {
|
||||||
BaseCode.MLS_IP=body.getString("MLS_IP");
|
BaseCode.MLS_IP=body.getString("MLS_IP");
|
||||||
BaseCode.PLC_PORT=body.getIntValue("PLC_PORT");
|
BaseCode.PLC_PORT=body.getIntValue("PLC_PORT");
|
||||||
BaseCode.PLC_IP=body.getString("PLC_IP");
|
BaseCode.PLC_IP=body.getString("PLC_IP");
|
||||||
|
BaseCode.PICK_YH_QR=body.getString("PICK_YH_QR");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,34 @@ public class pickTask {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public void yhTask() {
|
||||||
|
/* 发送验货任务*/
|
||||||
|
pickTaskByType(BizStatus.INV);
|
||||||
|
/* 发送验货返库任务*/
|
||||||
|
pickTaskByType(BizStatus.INV_BACK);
|
||||||
|
System.out.println("发送验货任务");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void pickTaskByType(String agvType) {
|
||||||
|
// 下发验货任务
|
||||||
|
List<AgvTask> agvTaskList = agvTaskService.queryByAgvTask(BizStatus.OPEN, agvType);
|
||||||
|
if (agvTaskList.size() > 0) {
|
||||||
|
/* 第一个任务的创建视角*/
|
||||||
|
long lastTaskTime = agvTaskList.get(0).getCreateTime().getTime();
|
||||||
|
if ((agvTaskList.size() >= MAX_TASK_COUNT)) {
|
||||||
|
/* 数量大于等于5时*/
|
||||||
|
// 取集合中的前五个任务合并发送
|
||||||
|
List<AgvTask> agvTasks=agvTaskList.subList(0, MAX_TASK_COUNT);
|
||||||
|
Result(agvTaskService.sendAgvTaskLXImpl(agvTasks));
|
||||||
|
}else if((System.currentTimeMillis() - lastTaskTime >=1*60*1000) ){
|
||||||
|
Result(agvTaskService.sendAgvTaskLXImpl(agvTaskList));
|
||||||
|
} else {
|
||||||
|
// throw new RuntimeException("出库料箱任务未满足条件(不满足五个料箱需等待2分钟)!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// throw new RuntimeException("无出库料箱任务!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Result(String result) {
|
private void Result(String result) {
|
||||||
if(result==null ||result.length()==0){
|
if(result==null ||result.length()==0){
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import javax.annotation.PostConstruct;
|
||||||
**/
|
**/
|
||||||
@Component
|
@Component
|
||||||
public class BaseCode {
|
public class BaseCode {
|
||||||
|
public static String PICK_YH_QR="0";
|
||||||
/** PLC IP*/
|
/** PLC IP*/
|
||||||
public static String PLC_IP = "10.173.188.201";
|
public static String PLC_IP = "10.173.188.201";
|
||||||
/** PLC 端口号*/
|
/** PLC 端口号*/
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,8 @@ public interface BizStatus {
|
||||||
public static String CANCEL = "CANCEL";
|
public static String CANCEL = "CANCEL";
|
||||||
/* 放料*/
|
/* 放料*/
|
||||||
public static String PICKER_SEND = "PICKER_SEND";
|
public static String PICKER_SEND = "PICKER_SEND";
|
||||||
|
/** 取料*/
|
||||||
|
public static String PICKER_RECEIVE = "PICKER_RECEIVE";
|
||||||
/**
|
/**
|
||||||
* 出入库状态-已关闭
|
* 出入库状态-已关闭
|
||||||
*/
|
*/
|
||||||
|
|
@ -60,6 +62,8 @@ public interface BizStatus {
|
||||||
* 任务状态-执行中
|
* 任务状态-执行中
|
||||||
*/
|
*/
|
||||||
public static String ATCALL = "ATCALL";
|
public static String ATCALL = "ATCALL";
|
||||||
|
/** 任务状态-验货中*/
|
||||||
|
public static String INSPECT = "INSPECT";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务状态-工作中
|
* 任务状态-工作中
|
||||||
|
|
@ -93,9 +97,11 @@ public interface BizStatus {
|
||||||
public static String PICK = "PICK";
|
public static String PICK = "PICK";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 盘点任务
|
* 验货任务
|
||||||
*/
|
*/
|
||||||
public static String INV = "INV";
|
public static String INV = "INV";
|
||||||
|
/** 验货返库*/
|
||||||
|
public static String INV_BACK = "INV_BACK";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 库存日志-移位
|
* 库存日志-移位
|
||||||
|
|
@ -207,5 +213,4 @@ public interface BizStatus {
|
||||||
* 空车出库/空箱出库
|
* 空车出库/空箱出库
|
||||||
*/
|
*/
|
||||||
public static String EMPTY_OUT = "EMPTY_OUT";
|
public static String EMPTY_OUT = "EMPTY_OUT";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue