no message
parent
530d4b48d8
commit
1719717807
|
|
@ -72,7 +72,6 @@ public class StockServiceImpl implements StockService {
|
|||
private final AgvTaskService agvTaskService;
|
||||
private final ItemService itemService;
|
||||
private final ItemKeyService itemKeyService;
|
||||
private final InventoryService inventoryService;
|
||||
private final InventoryLogService inventoryLogService;
|
||||
private final AsnDetailService asnDetailService;
|
||||
private final TaskService taskService;
|
||||
|
|
@ -258,6 +257,9 @@ public class StockServiceImpl implements StockService {
|
|||
/**验证容器*/
|
||||
Stock stock = validateStock(stockCode);
|
||||
|
||||
/**验证容器状态*/
|
||||
validateStockStatus(stock);
|
||||
|
||||
/**验证箱条码集合*/
|
||||
validateBoxNumbers(boxNumbers);
|
||||
|
||||
|
|
@ -297,6 +299,7 @@ public class StockServiceImpl implements StockService {
|
|||
/**更新库存和点位状态*/
|
||||
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) {
|
||||
AgvTask agvTask = new AgvTask(BizStatus.ASN, stock.getCode(), srcPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "FORKLIFT_MOVE");
|
||||
agvTaskService.create(agvTask);
|
||||
agvTaskService.sendAgvTaskCCImpl(agvTask);//发送任务
|
||||
return agvTask;
|
||||
}
|
||||
|
||||
|
|
@ -502,14 +504,16 @@ public class StockServiceImpl implements StockService {
|
|||
|
||||
/**验证目标容器*/
|
||||
Stock dstStock = validatedstStock(dstStockCode);
|
||||
if (dstStock.getStatus().equals(BaseStatus.USED)) {
|
||||
throw new RuntimeException(dstStock.getCode() + "目标托盘已使用,请绑定新的托盘!");
|
||||
}
|
||||
|
||||
|
||||
/**待拣货数量*/
|
||||
double moveQty = task.getPlanQty();
|
||||
|
||||
if (pick.getStock() == null) {
|
||||
List<Inventory> inventoryList = inventoryRepository.fingByStock(dstStock.getId());
|
||||
if (!inventoryList.isEmpty()) {
|
||||
throw new RuntimeException(dstStock + "目标托盘已绑定其他出库单,请更换其它的托盘!");
|
||||
}
|
||||
pick.setStock(dstStock);
|
||||
pickRepository.save(pick);
|
||||
} else {
|
||||
|
|
@ -738,12 +742,9 @@ public class StockServiceImpl implements StockService {
|
|||
}
|
||||
|
||||
private void returnFBAgvTask(Point srcPoint, Stock stock, Item item) {
|
||||
String areaCode = stockTypeToAreaMap.getValueByKey(stock.getStockType());
|
||||
Double itemHeight = null;
|
||||
if (AreaNameDic.XJQ.equals(areaCode)) {
|
||||
itemHeight = item.getExtendD2();//整托高度
|
||||
}
|
||||
List<Point> endPointList = pointRepository.findByCode(null, BaseStatus.FREE, BaseStatus.STORAGE, areaCode, null, itemHeight);
|
||||
String areaCode = stockTypeToAreaMap.getValueByKey(item.getGoodType());
|
||||
|
||||
List<Point> endPointList = pointRepository.findByCode(null, BaseStatus.FREE, BaseStatus.STORAGE, areaCode, null, null);
|
||||
if (endPointList.isEmpty()) {
|
||||
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");
|
||||
agvTaskService.create(agvTask);
|
||||
agvTaskService.sendAgvTaskCCImpl(agvTask);
|
||||
endPoint.setStatus(BaseStatus.USED);
|
||||
pointRepository.save(endPoint);
|
||||
}
|
||||
|
||||
private Item validateItem(String itemCode) {
|
||||
|
|
@ -770,6 +773,11 @@ public class StockServiceImpl implements StockService {
|
|||
return stock;
|
||||
}
|
||||
|
||||
private void validateStockStatus(Stock stock) {
|
||||
if (BaseStatus.USED.equals(stock.getStatus())) {
|
||||
throw new RuntimeException("容器已使用,请更换新的容器!");
|
||||
}
|
||||
}
|
||||
|
||||
private Point validateSrcPoint(String pointCode) {
|
||||
List<Point> pointList = pointRepository.findByCode(pointCode, null, null, null, null, null);
|
||||
|
|
@ -864,11 +872,8 @@ public class StockServiceImpl implements StockService {
|
|||
* @param stock
|
||||
*/
|
||||
private void clearInventory(Stock stock) {
|
||||
List<Inventory> inventoryList = inventoryService.queryInventory(stock);
|
||||
Long[] ids = inventoryList.stream().map(Inventory::getId).toArray(Long[]::new);
|
||||
if (ids.length > 0) {
|
||||
inventoryService.deleteAll(ids);
|
||||
}
|
||||
List<Inventory> inventoryList = inventoryRepository.fingByStock(stock.getId());
|
||||
inventoryRepository.deleteAll(inventoryList);
|
||||
}
|
||||
|
||||
private void handleEmptyContainer(Stock stock, Point point) {
|
||||
|
|
|
|||
|
|
@ -353,7 +353,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
}
|
||||
|
||||
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)) {
|
||||
throw new RuntimeException("AGV返回信息:下发任务接口调用失败!");
|
||||
}
|
||||
|
|
@ -363,7 +363,10 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
}
|
||||
|
||||
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)) {
|
||||
throw new RuntimeException("AGV返回信息:" + message);
|
||||
} else {
|
||||
|
|
@ -379,7 +382,6 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
}
|
||||
|
||||
@Override
|
||||
|
||||
public AgvTask toEntity(AgvTaskDto agvTaskDto) {
|
||||
return agvTaskMapper.toEntity(agvTaskDto);
|
||||
}
|
||||
|
|
@ -388,8 +390,6 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public void agvTaskCallback(AgvTask agvTask, String status, String containerCode) {
|
||||
switch (status) {
|
||||
case "ARRIVED":
|
||||
break;
|
||||
case "UP_CONTAINER":
|
||||
case "FORK_UP":
|
||||
handleUpContainer(agvTask, containerCode);//容器顶升
|
||||
|
|
@ -571,6 +571,16 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
|
||||
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);
|
||||
for (Inventory inventory : inventoryList) {
|
||||
inventory.setPoint(endPoint);
|
||||
inventoryService.update(inventory);
|
||||
inventory.setPointCode(endPoint.getCode());
|
||||
inventoryRepository.save(inventory);
|
||||
}
|
||||
/* 更新Task任务状态*/
|
||||
for (Task task : taskList) {
|
||||
|
|
|
|||
|
|
@ -152,9 +152,12 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
}
|
||||
double allocateQty = 0;
|
||||
double unQty = quantity;//未分配数量
|
||||
boolean beSuccess = false;
|
||||
Set<String> tps = new HashSet<>();
|
||||
for (Inventory inv : inventoryList) {
|
||||
//判断托盘是否有任务
|
||||
if (taskRepository.existsByStock(inv.getStockCode()) >= 1) {
|
||||
tps.add(inv.getStockCode());
|
||||
continue;
|
||||
}
|
||||
Point startPoint = inv.getPoint();//起始点位
|
||||
|
|
@ -178,8 +181,14 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
|
||||
/** 生成Task任务 */
|
||||
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 + "托盘有任务!";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -352,10 +352,10 @@ public class PickServiceImpl implements PickService {
|
|||
} else {
|
||||
agvTask = new AgvTask(BizStatus.PICK, task.getSrcStockCode(), task.getSrcPointCode(), task.getDstPointCode(), BizStatus.OPEN, "FORKLIFT_MOVE");
|
||||
agvTaskRepository.save(agvTask);
|
||||
agvTaskService.sendAgvTaskCCImpl(agvTask);
|
||||
}
|
||||
task.setAgvTask(agvTask);
|
||||
taskRepository.save(task);
|
||||
agvTaskService.sendAgvTaskCCImpl(agvTask);
|
||||
}
|
||||
/*更新出库单状态*/
|
||||
pick.setStatus(BizStatus.PICKUP);
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
@ -36,11 +36,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
|
||||
|
|
|
|||
Loading…
Reference in New Issue