no message
parent
6592dee8f5
commit
7bd2c694d5
|
|
@ -37,7 +37,7 @@ public class BydAppController {
|
|||
@AnonymousAccess
|
||||
public ResponseEntity<Object> materialIn(@RequestBody BindStock bindStock) {
|
||||
try {
|
||||
//P:A17A;V:148795;M:10441666-00/PCS;B:240512JFET;Lot:20240427;S:124051200181131;PO:5913490946/00020;Q:36/20/32;D:2024-04-27;SN:;YX:2025-04-26;DN:D12405120005031AS
|
||||
//P:A17A;V:148795;M:10441666-00/PCS;B:240512JFET;Lot:20240427;S:124051200181132;PO:5913490946/00020;Q:36/20/32;D:2024-04-27;SN:;YX:2025-04-26;DN:D12405120005031AS
|
||||
String stockCode = bindStock.getStockCode();//容器编号
|
||||
List<String> boxNumbers = bindStock.getBoxNumbers();//箱号集合
|
||||
String pointCode = bindStock.getPointCode();//点位编号
|
||||
|
|
@ -86,6 +86,7 @@ public class BydAppController {
|
|||
public ResponseEntity<Object> unBindContainer(@RequestBody BindStock bindStock) {
|
||||
try {
|
||||
String stockCode = bindStock.getStockCode();//容器编号
|
||||
stockService.unBindContainer(stockCode);
|
||||
return successResponse("解绑成功!");
|
||||
} catch (Exception e) {
|
||||
return badRequest("解绑失败:" + e.getMessage());
|
||||
|
|
@ -141,21 +142,6 @@ public class BydAppController {
|
|||
return successResponse("入库成功!");
|
||||
}
|
||||
|
||||
@PostMapping("/callStock")
|
||||
@Log("呼叫容器")
|
||||
@ApiOperation("呼叫容器")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> callStock(@RequestBody CallStock callStock) {
|
||||
String pointCode = callStock.getPointCode();//目标点位
|
||||
String itemCode = callStock.getItemCode();//物料编号
|
||||
int scene = callStock.getScene();//业务场景
|
||||
try {
|
||||
stockService.callContainer(itemCode, pointCode, scene);
|
||||
} catch (Exception e) {
|
||||
return badRequest(e.getMessage());
|
||||
}
|
||||
return successResponse("呼叫成功!");
|
||||
}
|
||||
|
||||
private ResponseEntity<Object> badRequest(String message) {
|
||||
return new ResponseEntity<>(message, HttpStatus.BAD_REQUEST);
|
||||
|
|
|
|||
|
|
@ -209,4 +209,6 @@ public interface StockService {
|
|||
*/
|
||||
void cpCallStock();
|
||||
|
||||
void unBindContainer(String stockCode);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ import com.youchain.appupdate.ReturnJson.ReturnTaskVo;
|
|||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.domain.Stock;
|
||||
import com.youchain.basicdata.repository.PointRepository;
|
||||
import com.youchain.basicdata.service.ItemService;
|
||||
import com.youchain.basicdata.service.PointService;
|
||||
import com.youchain.basicdata.vo.BarCodeVo;
|
||||
import com.youchain.businessdata.domain.*;
|
||||
import com.youchain.businessdata.repository.AsnDetailRepository;
|
||||
import com.youchain.businessdata.repository.AgvTaskRepository;
|
||||
import com.youchain.businessdata.repository.InventoryRepository;
|
||||
import com.youchain.businessdata.repository.PickDetailRepository;
|
||||
import com.youchain.businessdata.repository.TaskRepository;
|
||||
|
|
@ -53,7 +53,6 @@ import java.io.IOException;
|
|||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
||||
|
|
@ -69,8 +68,10 @@ import javax.servlet.http.HttpServletResponse;
|
|||
public class StockServiceImpl implements StockService {
|
||||
|
||||
private final StockRepository stockRepository;
|
||||
private final PointRepository pointRepository;
|
||||
private final PickDetailRepository pickDetailRepository;
|
||||
private final TaskRepository taskRepository;
|
||||
private final AgvTaskRepository agvTaskRepository;
|
||||
private final InventoryRepository inventoryRepository;
|
||||
private final AgvTaskService agvTaskService;
|
||||
private final ItemService itemService;
|
||||
|
|
@ -78,8 +79,6 @@ public class StockServiceImpl implements StockService {
|
|||
private final InventoryLogService inventoryLogService;
|
||||
private final AsnDetailService asnDetailService;
|
||||
private final PickDetailService pickDetailService;
|
||||
private final ItemKeyService itemKeyService;
|
||||
private final PointService pointService;
|
||||
private final TaskService taskService;
|
||||
private final StockTypeToAreaMap stockTypeToAreaMap;
|
||||
private final BatchCreateOrUpdate batchCreateOrUpdate;
|
||||
|
|
@ -116,7 +115,7 @@ public class StockServiceImpl implements StockService {
|
|||
if (resources.getPoint() != null) {
|
||||
Point point = resources.getPoint();
|
||||
point.setStatus(BaseStatus.USED);
|
||||
pointService.update(point);
|
||||
pointRepository.save(point);
|
||||
}
|
||||
return stockMapper.toDto(stockRepository.save(resources));
|
||||
}
|
||||
|
|
@ -128,12 +127,12 @@ public class StockServiceImpl implements StockService {
|
|||
if (stock.getPoint() != null) {
|
||||
Point point = stock.getPoint();
|
||||
point.setStatus(BaseStatus.FREE);
|
||||
pointService.update(point);
|
||||
pointRepository.save(point);
|
||||
}
|
||||
if (resources.getPoint() != null) {
|
||||
Point point = resources.getPoint();
|
||||
point.setStatus(BaseStatus.USED);
|
||||
pointService.update(point);
|
||||
pointRepository.save(point);
|
||||
}
|
||||
ValidationUtil.isNull(stock.getId(), "Stock", "id", resources.getId());
|
||||
stock.copy(resources);
|
||||
|
|
@ -241,7 +240,7 @@ public class StockServiceImpl implements StockService {
|
|||
Point point = stock.getPoint();
|
||||
if (point != null) {
|
||||
point.setStatus(BaseStatus.FREE);
|
||||
pointService.update(point);
|
||||
pointRepository.save(point);
|
||||
}
|
||||
stock.setStatus(BaseStatus.FREE);
|
||||
stock.setPoint(null);
|
||||
|
|
@ -610,14 +609,18 @@ public class StockServiceImpl implements StockService {
|
|||
if (stock == null) {
|
||||
throw new RuntimeException(srcPoint.getCode() + "点位没有货架!");
|
||||
}
|
||||
Point endPoint = validateEndPoint(null, BaseStatus.FREE, BaseStatus.BOX, AreaNameDic.CPRKQ);//终点
|
||||
List<Point> endPointList = pointRepository.findByCode(null, BaseStatus.FREE, BaseStatus.BOX, AreaNameDic.CPRKQ, null, null);
|
||||
if (endPointList.isEmpty()) {
|
||||
throw new RuntimeException("成品入库区没有空闲点位!");
|
||||
}
|
||||
Point endPoint = endPointList.get(0);
|
||||
AgvTask agvTask = new AgvTask(BizStatus.Cp_Off_Line, stock.getCode(), srcPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "RACK_MOVE");
|
||||
agvTaskService.create(agvTask);
|
||||
agvTaskService.sendAgvTaskImpl(agvTask);
|
||||
srcPoint.setStatus(BaseStatus.USED);
|
||||
pointService.update(srcPoint);
|
||||
endPoint.setStatus(BaseStatus.USED);
|
||||
pointService.update(endPoint);
|
||||
pointRepository.save(endPoint);
|
||||
stock.setStatus(BaseStatus.USED);
|
||||
stockRepository.save(stock);
|
||||
} else {
|
||||
throw new RuntimeException("任务类型不存在!");
|
||||
}
|
||||
|
|
@ -628,7 +631,7 @@ public class StockServiceImpl implements StockService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cpCallStock() {
|
||||
// 尝试从成品入库缓存区查询空车
|
||||
List<Stock> emptyStockList = stockRepository.findByEnmptyStock(AreaNameDic.CPRKCHQ);
|
||||
List<Stock> emptyStockList = stockRepository.findByEnmptyStock(AreaNameDic.CPRKHCQ);
|
||||
if (emptyStockList.isEmpty()) {
|
||||
// 如果成品入库缓存区没有空车,则从入库区查询
|
||||
emptyStockList = stockRepository.findByEnmptyStock(AreaNameDic.CPRKQ);
|
||||
|
|
@ -639,19 +642,30 @@ public class StockServiceImpl implements StockService {
|
|||
|
||||
Stock emptyStock = emptyStockList.get(0);
|
||||
Point srcPoint = emptyStock.getPoint();
|
||||
Point endPoint = pointService.findByCode(null, BaseStatus.FREE, BaseStatus.BOX, AreaNameDic.CPXXQ, null, null);
|
||||
if (endPoint == null) {
|
||||
List<Point> endPointList = pointRepository.findByCode(null, BaseStatus.FREE, BaseStatus.BOX, AreaNameDic.CPXXQ, null, null);
|
||||
if (endPointList.isEmpty()) {
|
||||
throw new RuntimeException("成品下线区没有空闲点位,请稍后再试!");
|
||||
}
|
||||
Point endPoint = endPointList.get(0);
|
||||
// 创建并下发任务
|
||||
AgvTask agvTask = new AgvTask(BizStatus.EMPTY_IN, emptyStock.getCode(), srcPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "RACK_MOVE");
|
||||
agvTaskService.create(agvTask);
|
||||
agvTaskService.sendAgvTaskImpl(agvTask);
|
||||
List<AgvTask> agvTaskList = agvTaskRepository.findRepeat(emptyStock.getCode());
|
||||
if (agvTaskList.isEmpty()) {
|
||||
AgvTask agvTask = new AgvTask(BizStatus.EMPTY_IN, emptyStock.getCode(), srcPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "RACK_MOVE");
|
||||
agvTaskService.create(agvTask);
|
||||
agvTaskService.sendAgvTaskImpl(agvTask);
|
||||
|
||||
// 更新点位状态
|
||||
endPoint.setStatus(BaseStatus.USED);
|
||||
pointService.update(endPoint);
|
||||
// 更新点位状态
|
||||
endPoint.setStatus(BaseStatus.USED);
|
||||
pointRepository.save(endPoint);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void unBindContainer(String stockCode) {
|
||||
Stock stock = validateStock(stockCode);
|
||||
stock.setStatus(BaseStatus.FREE);
|
||||
stockRepository.save(stock);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -758,10 +772,11 @@ public class StockServiceImpl implements StockService {
|
|||
if (AreaNameDic.XJQ.equals(areaCode)) {
|
||||
itemHeight = item.getExtendD2();//整托高度
|
||||
}
|
||||
Point endPoint = pointService.findByCode(null, BaseStatus.FREE, BaseStatus.STORAGE, areaCode, null, itemHeight);
|
||||
if (endPoint == null) {
|
||||
List<Point> endPointList = pointRepository.findByCode(null, BaseStatus.FREE, BaseStatus.STORAGE, areaCode, null, itemHeight);
|
||||
if (endPointList.isEmpty()) {
|
||||
throw new RuntimeException(areaCode + "没有空闲点位!");
|
||||
}
|
||||
Point endPoint = endPointList.get(0);
|
||||
|
||||
AgvTask agvTask = new AgvTask(BizStatus.FB_RETURN, stock.getCode(), srcPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "");
|
||||
agvTaskService.create(agvTask);
|
||||
|
|
@ -786,27 +801,27 @@ public class StockServiceImpl implements StockService {
|
|||
|
||||
|
||||
private Point validateSrcPoint(String pointCode) {
|
||||
Point srcPoint = pointService.findByCode(pointCode, null, null, null, null, null);
|
||||
if (srcPoint == null) {
|
||||
throw new RuntimeException("请扫描正确点位!");
|
||||
List<Point> pointList = pointRepository.findByCode(pointCode, null, null, null, null, null);
|
||||
if (pointList.isEmpty()) {
|
||||
throw new RuntimeException("请扫描正确的点位!");
|
||||
}
|
||||
return srcPoint;
|
||||
return pointList.get(0);
|
||||
}
|
||||
|
||||
private Point validateEndPoint(String areaCode) {
|
||||
Point endPoint = pointService.findByCode(null, BaseStatus.FREE, BaseStatus.STORAGE, areaCode, null, null);
|
||||
if (endPoint == null) {
|
||||
List<Point> endPointList = pointRepository.findByCode(null, BaseStatus.FREE, BaseStatus.STORAGE, areaCode, null, null);
|
||||
if (endPointList.isEmpty()) {
|
||||
throw new RuntimeException(areaCode + "没有空闲点位!");
|
||||
}
|
||||
return endPoint;
|
||||
return endPointList.get(0);
|
||||
}
|
||||
|
||||
private Point validateEndPoint(String code, String status, String type, String areaCode) {
|
||||
Point endPoint = pointService.findByCode(code, status, type, areaCode, null, null);
|
||||
if (endPoint == null) {
|
||||
List<Point> endPointList = pointRepository.findByCode(code, status, type, areaCode, null, null);
|
||||
if (endPointList.isEmpty()) {
|
||||
throw new RuntimeException(areaCode + "没有空闲点位!");
|
||||
}
|
||||
return endPoint;
|
||||
return endPointList.get(0);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -827,10 +842,10 @@ public class StockServiceImpl implements StockService {
|
|||
update(stock);
|
||||
|
||||
endPoint.setStatus(BaseStatus.USED);
|
||||
pointService.update(endPoint);
|
||||
pointRepository.save(endPoint);
|
||||
|
||||
srcPoint.setStatus(BaseStatus.USED);
|
||||
pointService.update(srcPoint);
|
||||
pointRepository.save(srcPoint);
|
||||
}
|
||||
|
||||
private void handleFullContainerCall(String itemCode, Point endPoint) {
|
||||
|
|
@ -852,7 +867,7 @@ public class StockServiceImpl implements StockService {
|
|||
AgvTask agvTask = taskList.get(0).getAgvTask();
|
||||
sendAgvTaskAndHandleResponse(agvTask);
|
||||
endPoint.setStatus(BaseStatus.USED);
|
||||
pointService.update(endPoint);
|
||||
pointRepository.save(endPoint);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
|
|
@ -886,7 +901,7 @@ public class StockServiceImpl implements StockService {
|
|||
}
|
||||
|
||||
private boolean isRestrictedArea(String areaName) {
|
||||
return areaName.equals(AreaNameDic.CPRKQ) || areaName.equals(AreaNameDic.CPRKCHQ) || areaName.equals(AreaNameDic.DXJRKQ);
|
||||
return areaName.equals(AreaNameDic.CPRKQ) || areaName.equals(AreaNameDic.CPRKHCQ) || areaName.equals(AreaNameDic.DXJRKQ);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -905,7 +920,7 @@ public class StockServiceImpl implements StockService {
|
|||
|
||||
private void handleEmptyContainer(Stock stock, Point point) {
|
||||
point.setStatus(BaseStatus.USED);
|
||||
pointService.update(point);
|
||||
pointRepository.save(point);
|
||||
stock.setStatus(BaseStatus.FREE);
|
||||
stock.setPoint(point);
|
||||
update(stock);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,6 @@ public interface AgvTaskRepository extends JpaRepository<AgvTask, Long>, JpaSpec
|
|||
/**
|
||||
* 去重
|
||||
*/
|
||||
@Query(value = " from AgvTask agv where agv.startSlotCode=:startSlotCode and agv.endSlotCode=:endSlotCode and agv.status in ('OPEN','ATCALL','ATWORK','CANCEL')")
|
||||
List<AgvTask> findRepeat(String startSlotCode, String endSlotCode);
|
||||
@Query(value = " from AgvTask agv where agv.stockCode=:stockCode and agv.status in ('OPEN','ATCALL','UP_CONTAINER','ARRIVED')")
|
||||
List<AgvTask> findRepeat(String stockCode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -458,7 +458,10 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
case AreaNameDic.JLQ:
|
||||
// handleJL(taskList, endPoint, stock);//满车出库
|
||||
break;
|
||||
|
||||
case AreaNameDic.CPXXQ:
|
||||
case AreaNameDic.CPRKQ:
|
||||
handleCPXXAndCPRK(endPoint, stock);//空货架-成品下线区;满货架-成品入库区
|
||||
break;
|
||||
}
|
||||
|
||||
agvTask.setStatus(BizStatus.FINISH);
|
||||
|
|
@ -812,4 +815,9 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
pointService.update(point);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleCPXXAndCPRK(Point endPoint, Stock stock) {
|
||||
stock.setPoint(endPoint);
|
||||
stockRepository.save(stock);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ public class PickServiceImpl implements PickService {
|
|||
List<Task> taskList = taskRepository.findByNotPickTask(pick.getId());
|
||||
for (Task task : taskList) {
|
||||
/*生成搬运任务*/
|
||||
List<AgvTask> agvTaskList = agvTaskRepository.findRepeat(task.getSrcPointCode(), task.getDstPointCode());
|
||||
List<AgvTask> agvTaskList = agvTaskRepository.findRepeat(task.getSrcStockCode());
|
||||
if (agvTaskList.size() > 0) {
|
||||
agvTask = agvTaskList.get(0);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package com.youchain.modules.quartz.task;
|
|||
import com.youchain.basicdata.service.StockService;
|
||||
import com.youchain.businessdata.domain.Pick;
|
||||
import com.youchain.businessdata.repository.PickRepository;
|
||||
import com.youchain.businessdata.service.AgvTaskService;
|
||||
import com.youchain.businessdata.service.PickDetailService;
|
||||
import com.youchain.businessdata.service.PickService;
|
||||
import com.youchain.utils.*;
|
||||
|
|
@ -45,7 +44,6 @@ public class pickTask {
|
|||
pickDetailService.allocatePick(pick);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public interface AreaNameDic {
|
|||
/**
|
||||
* 成品入库缓存区
|
||||
*/
|
||||
public static String CPRKCHQ = "CPRKCHQ";
|
||||
public static String CPRKHCQ = "CPRKHCQ";
|
||||
|
||||
/**
|
||||
* 成品下线区
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ public interface BizStatus {
|
|||
public static String UP_CONTAINER = "UP_CONTAINER";
|
||||
|
||||
/**
|
||||
* 任务状态-翻包返库
|
||||
* 翻包返库
|
||||
*/
|
||||
public static String FB_RETURN = "FB_RETURN";
|
||||
|
||||
|
|
|
|||
|
|
@ -121,6 +121,3 @@ file:
|
|||
minidao:
|
||||
base-package: org.jeecg.modules.jmreport.desreport.dao*
|
||||
db-type: mysql
|
||||
task:
|
||||
onOff:
|
||||
zCJXBTask: false
|
||||
|
|
|
|||
|
|
@ -130,6 +130,3 @@ file:
|
|||
minidao:
|
||||
base-package: org.jeecg.modules.jmreport.desreport.dao*
|
||||
db-type: mysql
|
||||
task:
|
||||
onOff:
|
||||
zCJXBTask: false
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ spring:
|
|||
freemarker:
|
||||
check-template-location: false
|
||||
profiles:
|
||||
#active: prod
|
||||
active: dev
|
||||
active: prod
|
||||
#active: dev
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
data:
|
||||
|
|
@ -31,11 +31,11 @@ spring:
|
|||
redis:
|
||||
#数据库索引
|
||||
database: ${REDIS_DB:2}
|
||||
#host: ${REDIS_HOST:192.168.100.102}
|
||||
#password: ${REDIS_PWD:123456}
|
||||
host: ${REDIS_HOST:192.168.100.102}
|
||||
password: ${REDIS_PWD:123456}
|
||||
|
||||
host: ${REDIS_HOST:localhost}
|
||||
password: ${REDIS_PWD:}
|
||||
#host: ${REDIS_HOST:localhost}
|
||||
#password: ${REDIS_PWD:}
|
||||
port: ${REDIS_PORT:6379}
|
||||
#连接超时时间
|
||||
timeout: 5000
|
||||
|
|
|
|||
|
|
@ -24,6 +24,26 @@ public class EladminSystemApplicationTests {
|
|||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add("物料库存不足,请先补充库存!");
|
||||
list.add("数量已分配!");
|
||||
list.add("托盘有任务,请先完成任务!");
|
||||
boolean containsSuccess = list.stream().anyMatch(s -> s.contains("分配成功"));
|
||||
|
||||
if (containsSuccess) {
|
||||
System.out.println("集合中存在分配成功的信息!");
|
||||
} else {
|
||||
System.out.println("集合中不存在分配成功的信息!");
|
||||
}
|
||||
}
|
||||
|
||||
private static final int MAX_TASK_COUNT = 4;
|
||||
private static final long TIMEOUT_MS = 600000; // 10分钟,以毫秒为单位
|
||||
private long lastTaskTime = System.currentTimeMillis();
|
||||
private List<Integer> taskQueue = new ArrayList<>(MAX_TASK_COUNT);
|
||||
|
||||
void aa() {
|
||||
|
||||
CompletableFuture<Void> asnDetailFuture = CompletableFuture.runAsync(() -> {
|
||||
System.out.println("新增asnDetail");
|
||||
});
|
||||
|
|
@ -37,18 +57,6 @@ public class EladminSystemApplicationTests {
|
|||
});
|
||||
taskFuture.join();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static final int MAX_TASK_COUNT = 4;
|
||||
private static final long TIMEOUT_MS = 600000; // 10分钟,以毫秒为单位
|
||||
private long lastTaskTime = System.currentTimeMillis();
|
||||
private List<Integer> taskQueue = new ArrayList<>(MAX_TASK_COUNT);
|
||||
|
||||
void aa() {
|
||||
|
||||
|
||||
|
||||
Set<BarCodeVo> barCodeVos = new HashSet<>();
|
||||
|
||||
BarCodeVo barCodeVo = new BarCodeVo();
|
||||
|
|
|
|||
Loading…
Reference in New Issue