no message

main
HUOJIN\92525 2024-08-12 16:17:14 +08:00
parent 530d4b48d8
commit 1719717807
5 changed files with 55 additions and 30 deletions

View File

@ -72,7 +72,6 @@ public class StockServiceImpl implements StockService {
private final AgvTaskService agvTaskService; private final AgvTaskService agvTaskService;
private final ItemService itemService; private final ItemService itemService;
private final ItemKeyService itemKeyService; private final ItemKeyService itemKeyService;
private final InventoryService inventoryService;
private final InventoryLogService inventoryLogService; private final InventoryLogService inventoryLogService;
private final AsnDetailService asnDetailService; private final AsnDetailService asnDetailService;
private final TaskService taskService; private final TaskService taskService;
@ -258,6 +257,9 @@ public class StockServiceImpl implements StockService {
/**验证容器*/ /**验证容器*/
Stock stock = validateStock(stockCode); Stock stock = validateStock(stockCode);
/**验证容器状态*/
validateStockStatus(stock);
/**验证箱条码集合*/ /**验证箱条码集合*/
validateBoxNumbers(boxNumbers); validateBoxNumbers(boxNumbers);
@ -297,6 +299,7 @@ public class StockServiceImpl implements StockService {
/**更新库存和点位状态*/ /**更新库存和点位状态*/
updateStockAndPoints(stock, srcPoint, endPoint); updateStockAndPoints(stock, srcPoint, endPoint);
agvTaskService.sendAgvTaskCCImpl(agvTask);//发送任务
} }
@ -364,7 +367,6 @@ public class StockServiceImpl implements StockService {
private AgvTask createAndSendAgvTask(Stock stock, Point srcPoint, Point endPoint) { private AgvTask createAndSendAgvTask(Stock stock, Point srcPoint, Point endPoint) {
AgvTask agvTask = new AgvTask(BizStatus.ASN, stock.getCode(), srcPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "FORKLIFT_MOVE"); AgvTask agvTask = new AgvTask(BizStatus.ASN, stock.getCode(), srcPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "FORKLIFT_MOVE");
agvTaskService.create(agvTask); agvTaskService.create(agvTask);
agvTaskService.sendAgvTaskCCImpl(agvTask);//发送任务
return agvTask; return agvTask;
} }
@ -502,14 +504,16 @@ public class StockServiceImpl implements StockService {
/**验证目标容器*/ /**验证目标容器*/
Stock dstStock = validatedstStock(dstStockCode); Stock dstStock = validatedstStock(dstStockCode);
if (dstStock.getStatus().equals(BaseStatus.USED)) {
throw new RuntimeException(dstStock.getCode() + "目标托盘已使用,请绑定新的托盘!");
}
/**待拣货数量*/ /**待拣货数量*/
double moveQty = task.getPlanQty(); double moveQty = task.getPlanQty();
if (pick.getStock() == null) { if (pick.getStock() == null) {
List<Inventory> inventoryList = inventoryRepository.fingByStock(dstStock.getId());
if (!inventoryList.isEmpty()) {
throw new RuntimeException(dstStock + "目标托盘已绑定其他出库单,请更换其它的托盘!");
}
pick.setStock(dstStock); pick.setStock(dstStock);
pickRepository.save(pick); pickRepository.save(pick);
} else { } else {
@ -738,12 +742,9 @@ public class StockServiceImpl implements StockService {
} }
private void returnFBAgvTask(Point srcPoint, Stock stock, Item item) { private void returnFBAgvTask(Point srcPoint, Stock stock, Item item) {
String areaCode = stockTypeToAreaMap.getValueByKey(stock.getStockType()); String areaCode = stockTypeToAreaMap.getValueByKey(item.getGoodType());
Double itemHeight = null;
if (AreaNameDic.XJQ.equals(areaCode)) { List<Point> endPointList = pointRepository.findByCode(null, BaseStatus.FREE, BaseStatus.STORAGE, areaCode, null, null);
itemHeight = item.getExtendD2();//整托高度
}
List<Point> endPointList = pointRepository.findByCode(null, BaseStatus.FREE, BaseStatus.STORAGE, areaCode, null, itemHeight);
if (endPointList.isEmpty()) { if (endPointList.isEmpty()) {
throw new RuntimeException(areaCode + "没有空闲点位!"); throw new RuntimeException(areaCode + "没有空闲点位!");
} }
@ -752,6 +753,8 @@ public class StockServiceImpl implements StockService {
AgvTask agvTask = new AgvTask(BizStatus.FB_RETURN, stock.getCode(), srcPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "FORKLIFT_MOVE"); AgvTask agvTask = new AgvTask(BizStatus.FB_RETURN, stock.getCode(), srcPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "FORKLIFT_MOVE");
agvTaskService.create(agvTask); agvTaskService.create(agvTask);
agvTaskService.sendAgvTaskCCImpl(agvTask); agvTaskService.sendAgvTaskCCImpl(agvTask);
endPoint.setStatus(BaseStatus.USED);
pointRepository.save(endPoint);
} }
private Item validateItem(String itemCode) { private Item validateItem(String itemCode) {
@ -770,6 +773,11 @@ public class StockServiceImpl implements StockService {
return stock; return stock;
} }
private void validateStockStatus(Stock stock) {
if (BaseStatus.USED.equals(stock.getStatus())) {
throw new RuntimeException("容器已使用,请更换新的容器!");
}
}
private Point validateSrcPoint(String pointCode) { private Point validateSrcPoint(String pointCode) {
List<Point> pointList = pointRepository.findByCode(pointCode, null, null, null, null, null); List<Point> pointList = pointRepository.findByCode(pointCode, null, null, null, null, null);
@ -864,11 +872,8 @@ public class StockServiceImpl implements StockService {
* @param stock * @param stock
*/ */
private void clearInventory(Stock stock) { private void clearInventory(Stock stock) {
List<Inventory> inventoryList = inventoryService.queryInventory(stock); List<Inventory> inventoryList = inventoryRepository.fingByStock(stock.getId());
Long[] ids = inventoryList.stream().map(Inventory::getId).toArray(Long[]::new); inventoryRepository.deleteAll(inventoryList);
if (ids.length > 0) {
inventoryService.deleteAll(ids);
}
} }
private void handleEmptyContainer(Stock stock, Point point) { private void handleEmptyContainer(Stock stock, Point point) {

View File

@ -353,7 +353,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
} }
private void sendAgvTask(AgvTask agvTask, String json) { private void sendAgvTask(AgvTask agvTask, String json) {
String resultJson = HttpPostUtil.sendPostReq(UrlApi.submitMission(), json); /*String resultJson = HttpPostUtil.sendPostReq(UrlApi.submitMission(), json);
if (StringUtils.isEmpty(resultJson)) { if (StringUtils.isEmpty(resultJson)) {
throw new RuntimeException("AGV返回信息:下发任务接口调用失败!"); throw new RuntimeException("AGV返回信息:下发任务接口调用失败!");
} }
@ -363,7 +363,10 @@ public class AgvTaskServiceImpl implements AgvTaskService {
} }
String code = resulObject.getString("code"); String code = resulObject.getString("code");
String message = resulObject.getString("message"); String message = resulObject.getString("message");*/
String resultJson = null;
String code = "0";
String message = null;
if (!"0".equals(code)) { if (!"0".equals(code)) {
throw new RuntimeException("AGV返回信息:" + message); throw new RuntimeException("AGV返回信息:" + message);
} else { } else {
@ -379,7 +382,6 @@ public class AgvTaskServiceImpl implements AgvTaskService {
} }
@Override @Override
public AgvTask toEntity(AgvTaskDto agvTaskDto) { public AgvTask toEntity(AgvTaskDto agvTaskDto) {
return agvTaskMapper.toEntity(agvTaskDto); return agvTaskMapper.toEntity(agvTaskDto);
} }
@ -388,8 +390,6 @@ public class AgvTaskServiceImpl implements AgvTaskService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void agvTaskCallback(AgvTask agvTask, String status, String containerCode) { public void agvTaskCallback(AgvTask agvTask, String status, String containerCode) {
switch (status) { switch (status) {
case "ARRIVED":
break;
case "UP_CONTAINER": case "UP_CONTAINER":
case "FORK_UP": case "FORK_UP":
handleUpContainer(agvTask, containerCode);//容器顶升 handleUpContainer(agvTask, containerCode);//容器顶升
@ -571,6 +571,16 @@ public class AgvTaskServiceImpl implements AgvTaskService {
updateInventory(stock, task, ad); updateInventory(stock, task, ad);
} }
} else if (BizStatus.FB_RETURN.equals(agvTask.getType())) {
Point endPoint = pointService.findByCode(agvTask.getEndSlotCode(), null, null, null, null, null);
List<Inventory> inventoryList = inventoryService.queryInventory(stock);
for (Inventory inventory : inventoryList) {
inventory.setPoint(endPoint);
inventory.setPointCode(endPoint.getCode());
inventoryRepository.save(inventory);
}
stock.setPoint(endPoint);
stockRepository.save(stock);
} }
} }
@ -587,7 +597,8 @@ public class AgvTaskServiceImpl implements AgvTaskService {
List<Inventory> inventoryList = inventoryService.queryInventory(stock); List<Inventory> inventoryList = inventoryService.queryInventory(stock);
for (Inventory inventory : inventoryList) { for (Inventory inventory : inventoryList) {
inventory.setPoint(endPoint); inventory.setPoint(endPoint);
inventoryService.update(inventory); inventory.setPointCode(endPoint.getCode());
inventoryRepository.save(inventory);
} }
/* 更新Task任务状态*/ /* 更新Task任务状态*/
for (Task task : taskList) { for (Task task : taskList) {

View File

@ -152,9 +152,12 @@ public class PickDetailServiceImpl implements PickDetailService {
} }
double allocateQty = 0; double allocateQty = 0;
double unQty = quantity;//未分配数量 double unQty = quantity;//未分配数量
boolean beSuccess = false;
Set<String> tps = new HashSet<>();
for (Inventory inv : inventoryList) { for (Inventory inv : inventoryList) {
//判断托盘是否有任务 //判断托盘是否有任务
if (taskRepository.existsByStock(inv.getStockCode()) >= 1) { if (taskRepository.existsByStock(inv.getStockCode()) >= 1) {
tps.add(inv.getStockCode());
continue; continue;
} }
Point startPoint = inv.getPoint();//起始点位 Point startPoint = inv.getPoint();//起始点位
@ -178,8 +181,14 @@ public class PickDetailServiceImpl implements PickDetailService {
/** 生成Task任务 */ /** 生成Task任务 */
createTask(inv, pd, allocateQty, item, startPoint, endPoint, dept); createTask(inv, pd, allocateQty, item, startPoint, endPoint, dept);
beSuccess = true;
} }
return pick.getCode() + "出库单;" + item.getCode() + "分配成功!"; if (beSuccess) {
return pick.getCode() + "出库单;" + item.getCode() + "分配成功!";
} else {
return tps + "托盘有任务!";
}
} }

View File

@ -352,10 +352,10 @@ public class PickServiceImpl implements PickService {
} else { } else {
agvTask = new AgvTask(BizStatus.PICK, task.getSrcStockCode(), task.getSrcPointCode(), task.getDstPointCode(), BizStatus.OPEN, "FORKLIFT_MOVE"); agvTask = new AgvTask(BizStatus.PICK, task.getSrcStockCode(), task.getSrcPointCode(), task.getDstPointCode(), BizStatus.OPEN, "FORKLIFT_MOVE");
agvTaskRepository.save(agvTask); agvTaskRepository.save(agvTask);
agvTaskService.sendAgvTaskCCImpl(agvTask);
} }
task.setAgvTask(agvTask); task.setAgvTask(agvTask);
taskRepository.save(task); taskRepository.save(task);
agvTaskService.sendAgvTaskCCImpl(agvTask);
} }
/*更新出库单状态*/ /*更新出库单状态*/
pick.setStatus(BizStatus.PICKUP); pick.setStatus(BizStatus.PICKUP);

View File

@ -6,8 +6,8 @@ spring:
freemarker: freemarker:
check-template-location: false check-template-location: false
profiles: profiles:
active: prod #active: prod
#active: dev active: dev
jackson: jackson:
time-zone: GMT+8 time-zone: GMT+8
data: data:
@ -36,11 +36,11 @@ spring:
redis: redis:
#数据库索引 #数据库索引
database: ${REDIS_DB:2} database: ${REDIS_DB:2}
host: ${REDIS_HOST:192.168.100.102} #host: ${REDIS_HOST:192.168.100.102}
password: ${REDIS_PWD:123456} #password: ${REDIS_PWD:123456}
#host: ${REDIS_HOST:localhost} host: ${REDIS_HOST:localhost}
#password: ${REDIS_PWD:} password: ${REDIS_PWD:}
port: ${REDIS_PORT:6379} port: ${REDIS_PORT:6379}
#连接超时时间 #连接超时时间
timeout: 5000 timeout: 5000