no message
							parent
							
								
									6592dee8f5
								
							
						
					
					
						commit
						7bd2c694d5
					
				| 
						 | 
					@ -37,7 +37,7 @@ public class BydAppController {
 | 
				
			||||||
    @AnonymousAccess
 | 
					    @AnonymousAccess
 | 
				
			||||||
    public ResponseEntity<Object> materialIn(@RequestBody BindStock bindStock) {
 | 
					    public ResponseEntity<Object> materialIn(@RequestBody BindStock bindStock) {
 | 
				
			||||||
        try {
 | 
					        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();//容器编号
 | 
					            String stockCode = bindStock.getStockCode();//容器编号
 | 
				
			||||||
            List<String> boxNumbers = bindStock.getBoxNumbers();//箱号集合
 | 
					            List<String> boxNumbers = bindStock.getBoxNumbers();//箱号集合
 | 
				
			||||||
            String pointCode = bindStock.getPointCode();//点位编号
 | 
					            String pointCode = bindStock.getPointCode();//点位编号
 | 
				
			||||||
| 
						 | 
					@ -86,6 +86,7 @@ public class BydAppController {
 | 
				
			||||||
    public ResponseEntity<Object> unBindContainer(@RequestBody BindStock bindStock) {
 | 
					    public ResponseEntity<Object> unBindContainer(@RequestBody BindStock bindStock) {
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            String stockCode = bindStock.getStockCode();//容器编号
 | 
					            String stockCode = bindStock.getStockCode();//容器编号
 | 
				
			||||||
 | 
					            stockService.unBindContainer(stockCode);
 | 
				
			||||||
            return successResponse("解绑成功!");
 | 
					            return successResponse("解绑成功!");
 | 
				
			||||||
        } catch (Exception e) {
 | 
					        } catch (Exception e) {
 | 
				
			||||||
            return badRequest("解绑失败:" + e.getMessage());
 | 
					            return badRequest("解绑失败:" + e.getMessage());
 | 
				
			||||||
| 
						 | 
					@ -141,21 +142,6 @@ public class BydAppController {
 | 
				
			||||||
        return successResponse("入库成功!");
 | 
					        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) {
 | 
					    private ResponseEntity<Object> badRequest(String message) {
 | 
				
			||||||
        return new ResponseEntity<>(message, HttpStatus.BAD_REQUEST);
 | 
					        return new ResponseEntity<>(message, HttpStatus.BAD_REQUEST);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -209,4 +209,6 @@ public interface StockService {
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    void cpCallStock();
 | 
					    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.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;
 | 
				
			||||||
 | 
					import com.youchain.basicdata.repository.PointRepository;
 | 
				
			||||||
import com.youchain.basicdata.service.ItemService;
 | 
					import com.youchain.basicdata.service.ItemService;
 | 
				
			||||||
import com.youchain.basicdata.service.PointService;
 | 
					 | 
				
			||||||
import com.youchain.basicdata.vo.BarCodeVo;
 | 
					import com.youchain.basicdata.vo.BarCodeVo;
 | 
				
			||||||
import com.youchain.businessdata.domain.*;
 | 
					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.InventoryRepository;
 | 
				
			||||||
import com.youchain.businessdata.repository.PickDetailRepository;
 | 
					import com.youchain.businessdata.repository.PickDetailRepository;
 | 
				
			||||||
import com.youchain.businessdata.repository.TaskRepository;
 | 
					import com.youchain.businessdata.repository.TaskRepository;
 | 
				
			||||||
| 
						 | 
					@ -53,7 +53,6 @@ import java.io.IOException;
 | 
				
			||||||
import java.util.concurrent.CompletableFuture;
 | 
					import java.util.concurrent.CompletableFuture;
 | 
				
			||||||
import java.util.concurrent.ConcurrentHashMap;
 | 
					import java.util.concurrent.ConcurrentHashMap;
 | 
				
			||||||
import java.util.concurrent.ExecutorService;
 | 
					import java.util.concurrent.ExecutorService;
 | 
				
			||||||
import java.util.stream.Collectors;
 | 
					 | 
				
			||||||
import javax.servlet.http.HttpServletResponse;
 | 
					import javax.servlet.http.HttpServletResponse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -69,8 +68,10 @@ import javax.servlet.http.HttpServletResponse;
 | 
				
			||||||
public class StockServiceImpl implements StockService {
 | 
					public class StockServiceImpl implements StockService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final StockRepository stockRepository;
 | 
					    private final StockRepository stockRepository;
 | 
				
			||||||
 | 
					    private final PointRepository pointRepository;
 | 
				
			||||||
    private final PickDetailRepository pickDetailRepository;
 | 
					    private final PickDetailRepository pickDetailRepository;
 | 
				
			||||||
    private final TaskRepository taskRepository;
 | 
					    private final TaskRepository taskRepository;
 | 
				
			||||||
 | 
					    private final AgvTaskRepository agvTaskRepository;
 | 
				
			||||||
    private final InventoryRepository inventoryRepository;
 | 
					    private final InventoryRepository inventoryRepository;
 | 
				
			||||||
    private final AgvTaskService agvTaskService;
 | 
					    private final AgvTaskService agvTaskService;
 | 
				
			||||||
    private final ItemService itemService;
 | 
					    private final ItemService itemService;
 | 
				
			||||||
| 
						 | 
					@ -78,8 +79,6 @@ public class StockServiceImpl implements StockService {
 | 
				
			||||||
    private final InventoryLogService inventoryLogService;
 | 
					    private final InventoryLogService inventoryLogService;
 | 
				
			||||||
    private final AsnDetailService asnDetailService;
 | 
					    private final AsnDetailService asnDetailService;
 | 
				
			||||||
    private final PickDetailService pickDetailService;
 | 
					    private final PickDetailService pickDetailService;
 | 
				
			||||||
    private final ItemKeyService itemKeyService;
 | 
					 | 
				
			||||||
    private final PointService pointService;
 | 
					 | 
				
			||||||
    private final TaskService taskService;
 | 
					    private final TaskService taskService;
 | 
				
			||||||
    private final StockTypeToAreaMap stockTypeToAreaMap;
 | 
					    private final StockTypeToAreaMap stockTypeToAreaMap;
 | 
				
			||||||
    private final BatchCreateOrUpdate batchCreateOrUpdate;
 | 
					    private final BatchCreateOrUpdate batchCreateOrUpdate;
 | 
				
			||||||
| 
						 | 
					@ -116,7 +115,7 @@ public class StockServiceImpl implements StockService {
 | 
				
			||||||
        if (resources.getPoint() != null) {
 | 
					        if (resources.getPoint() != null) {
 | 
				
			||||||
            Point point = resources.getPoint();
 | 
					            Point point = resources.getPoint();
 | 
				
			||||||
            point.setStatus(BaseStatus.USED);
 | 
					            point.setStatus(BaseStatus.USED);
 | 
				
			||||||
            pointService.update(point);
 | 
					            pointRepository.save(point);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return stockMapper.toDto(stockRepository.save(resources));
 | 
					        return stockMapper.toDto(stockRepository.save(resources));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -128,12 +127,12 @@ public class StockServiceImpl implements StockService {
 | 
				
			||||||
        if (stock.getPoint() != null) {
 | 
					        if (stock.getPoint() != null) {
 | 
				
			||||||
            Point point = stock.getPoint();
 | 
					            Point point = stock.getPoint();
 | 
				
			||||||
            point.setStatus(BaseStatus.FREE);
 | 
					            point.setStatus(BaseStatus.FREE);
 | 
				
			||||||
            pointService.update(point);
 | 
					            pointRepository.save(point);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (resources.getPoint() != null) {
 | 
					        if (resources.getPoint() != null) {
 | 
				
			||||||
            Point point = resources.getPoint();
 | 
					            Point point = resources.getPoint();
 | 
				
			||||||
            point.setStatus(BaseStatus.USED);
 | 
					            point.setStatus(BaseStatus.USED);
 | 
				
			||||||
            pointService.update(point);
 | 
					            pointRepository.save(point);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        ValidationUtil.isNull(stock.getId(), "Stock", "id", resources.getId());
 | 
					        ValidationUtil.isNull(stock.getId(), "Stock", "id", resources.getId());
 | 
				
			||||||
        stock.copy(resources);
 | 
					        stock.copy(resources);
 | 
				
			||||||
| 
						 | 
					@ -241,7 +240,7 @@ public class StockServiceImpl implements StockService {
 | 
				
			||||||
        Point point = stock.getPoint();
 | 
					        Point point = stock.getPoint();
 | 
				
			||||||
        if (point != null) {
 | 
					        if (point != null) {
 | 
				
			||||||
            point.setStatus(BaseStatus.FREE);
 | 
					            point.setStatus(BaseStatus.FREE);
 | 
				
			||||||
            pointService.update(point);
 | 
					            pointRepository.save(point);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        stock.setStatus(BaseStatus.FREE);
 | 
					        stock.setStatus(BaseStatus.FREE);
 | 
				
			||||||
        stock.setPoint(null);
 | 
					        stock.setPoint(null);
 | 
				
			||||||
| 
						 | 
					@ -610,14 +609,18 @@ public class StockServiceImpl implements StockService {
 | 
				
			||||||
            if (stock == null) {
 | 
					            if (stock == null) {
 | 
				
			||||||
                throw new RuntimeException(srcPoint.getCode() + "点位没有货架!");
 | 
					                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");
 | 
					            AgvTask agvTask = new AgvTask(BizStatus.Cp_Off_Line, stock.getCode(), srcPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "RACK_MOVE");
 | 
				
			||||||
            agvTaskService.create(agvTask);
 | 
					            agvTaskService.create(agvTask);
 | 
				
			||||||
            agvTaskService.sendAgvTaskImpl(agvTask);
 | 
					            agvTaskService.sendAgvTaskImpl(agvTask);
 | 
				
			||||||
            srcPoint.setStatus(BaseStatus.USED);
 | 
					 | 
				
			||||||
            pointService.update(srcPoint);
 | 
					 | 
				
			||||||
            endPoint.setStatus(BaseStatus.USED);
 | 
					            endPoint.setStatus(BaseStatus.USED);
 | 
				
			||||||
            pointService.update(endPoint);
 | 
					            pointRepository.save(endPoint);
 | 
				
			||||||
 | 
					            stock.setStatus(BaseStatus.USED);
 | 
				
			||||||
 | 
					            stockRepository.save(stock);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            throw new RuntimeException("任务类型不存在!");
 | 
					            throw new RuntimeException("任务类型不存在!");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -628,7 +631,7 @@ public class StockServiceImpl implements StockService {
 | 
				
			||||||
    @Transactional(rollbackFor = Exception.class)
 | 
					    @Transactional(rollbackFor = Exception.class)
 | 
				
			||||||
    public void cpCallStock() {
 | 
					    public void cpCallStock() {
 | 
				
			||||||
        // 尝试从成品入库缓存区查询空车
 | 
					        // 尝试从成品入库缓存区查询空车
 | 
				
			||||||
        List<Stock> emptyStockList = stockRepository.findByEnmptyStock(AreaNameDic.CPRKCHQ);
 | 
					        List<Stock> emptyStockList = stockRepository.findByEnmptyStock(AreaNameDic.CPRKHCQ);
 | 
				
			||||||
        if (emptyStockList.isEmpty()) {
 | 
					        if (emptyStockList.isEmpty()) {
 | 
				
			||||||
            // 如果成品入库缓存区没有空车,则从入库区查询
 | 
					            // 如果成品入库缓存区没有空车,则从入库区查询
 | 
				
			||||||
            emptyStockList = stockRepository.findByEnmptyStock(AreaNameDic.CPRKQ);
 | 
					            emptyStockList = stockRepository.findByEnmptyStock(AreaNameDic.CPRKQ);
 | 
				
			||||||
| 
						 | 
					@ -639,19 +642,30 @@ public class StockServiceImpl implements StockService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Stock emptyStock = emptyStockList.get(0);
 | 
					        Stock emptyStock = emptyStockList.get(0);
 | 
				
			||||||
        Point srcPoint = emptyStock.getPoint();
 | 
					        Point srcPoint = emptyStock.getPoint();
 | 
				
			||||||
        Point endPoint = pointService.findByCode(null, BaseStatus.FREE, BaseStatus.BOX, AreaNameDic.CPXXQ, null, null);
 | 
					        List<Point> endPointList = pointRepository.findByCode(null, BaseStatus.FREE, BaseStatus.BOX, AreaNameDic.CPXXQ, null, null);
 | 
				
			||||||
        if (endPoint == null) {
 | 
					        if (endPointList.isEmpty()) {
 | 
				
			||||||
            throw new RuntimeException("成品下线区没有空闲点位,请稍后再试!");
 | 
					            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");
 | 
					        List<AgvTask> agvTaskList = agvTaskRepository.findRepeat(emptyStock.getCode());
 | 
				
			||||||
        agvTaskService.create(agvTask);
 | 
					        if (agvTaskList.isEmpty()) {
 | 
				
			||||||
        agvTaskService.sendAgvTaskImpl(agvTask);
 | 
					            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);
 | 
					            endPoint.setStatus(BaseStatus.USED);
 | 
				
			||||||
        pointService.update(endPoint);
 | 
					            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)) {
 | 
					        if (AreaNameDic.XJQ.equals(areaCode)) {
 | 
				
			||||||
            itemHeight = item.getExtendD2();//整托高度
 | 
					            itemHeight = item.getExtendD2();//整托高度
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        Point endPoint = pointService.findByCode(null, BaseStatus.FREE, BaseStatus.STORAGE, areaCode, null, itemHeight);
 | 
					        List<Point> endPointList = pointRepository.findByCode(null, BaseStatus.FREE, BaseStatus.STORAGE, areaCode, null, itemHeight);
 | 
				
			||||||
        if (endPoint == null) {
 | 
					        if (endPointList.isEmpty()) {
 | 
				
			||||||
            throw new RuntimeException(areaCode + "没有空闲点位!");
 | 
					            throw new RuntimeException(areaCode + "没有空闲点位!");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        Point endPoint = endPointList.get(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        AgvTask agvTask = new AgvTask(BizStatus.FB_RETURN, stock.getCode(), srcPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "");
 | 
					        AgvTask agvTask = new AgvTask(BizStatus.FB_RETURN, stock.getCode(), srcPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "");
 | 
				
			||||||
        agvTaskService.create(agvTask);
 | 
					        agvTaskService.create(agvTask);
 | 
				
			||||||
| 
						 | 
					@ -786,27 +801,27 @@ public class StockServiceImpl implements StockService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private Point validateSrcPoint(String pointCode) {
 | 
					    private Point validateSrcPoint(String pointCode) {
 | 
				
			||||||
        Point srcPoint = pointService.findByCode(pointCode, null, null, null, null, null);
 | 
					        List<Point> pointList = pointRepository.findByCode(pointCode, null, null, null, null, null);
 | 
				
			||||||
        if (srcPoint == null) {
 | 
					        if (pointList.isEmpty()) {
 | 
				
			||||||
            throw new RuntimeException("请扫描正确点位!");
 | 
					            throw new RuntimeException("请扫描正确的点位!");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return srcPoint;
 | 
					        return pointList.get(0);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private Point validateEndPoint(String areaCode) {
 | 
					    private Point validateEndPoint(String areaCode) {
 | 
				
			||||||
        Point endPoint = pointService.findByCode(null, BaseStatus.FREE, BaseStatus.STORAGE, areaCode, null, null);
 | 
					        List<Point> endPointList = pointRepository.findByCode(null, BaseStatus.FREE, BaseStatus.STORAGE, areaCode, null, null);
 | 
				
			||||||
        if (endPoint == null) {
 | 
					        if (endPointList.isEmpty()) {
 | 
				
			||||||
            throw new RuntimeException(areaCode + "没有空闲点位!");
 | 
					            throw new RuntimeException(areaCode + "没有空闲点位!");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return endPoint;
 | 
					        return endPointList.get(0);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private Point validateEndPoint(String code, String status, String type, String areaCode) {
 | 
					    private Point validateEndPoint(String code, String status, String type, String areaCode) {
 | 
				
			||||||
        Point endPoint = pointService.findByCode(code, status, type, areaCode, null, null);
 | 
					        List<Point> endPointList = pointRepository.findByCode(code, status, type, areaCode, null, null);
 | 
				
			||||||
        if (endPoint == null) {
 | 
					        if (endPointList.isEmpty()) {
 | 
				
			||||||
            throw new RuntimeException(areaCode + "没有空闲点位!");
 | 
					            throw new RuntimeException(areaCode + "没有空闲点位!");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return endPoint;
 | 
					        return endPointList.get(0);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -827,10 +842,10 @@ public class StockServiceImpl implements StockService {
 | 
				
			||||||
        update(stock);
 | 
					        update(stock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        endPoint.setStatus(BaseStatus.USED);
 | 
					        endPoint.setStatus(BaseStatus.USED);
 | 
				
			||||||
        pointService.update(endPoint);
 | 
					        pointRepository.save(endPoint);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        srcPoint.setStatus(BaseStatus.USED);
 | 
					        srcPoint.setStatus(BaseStatus.USED);
 | 
				
			||||||
        pointService.update(srcPoint);
 | 
					        pointRepository.save(srcPoint);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private void handleFullContainerCall(String itemCode, Point endPoint) {
 | 
					    private void handleFullContainerCall(String itemCode, Point endPoint) {
 | 
				
			||||||
| 
						 | 
					@ -852,7 +867,7 @@ public class StockServiceImpl implements StockService {
 | 
				
			||||||
            AgvTask agvTask = taskList.get(0).getAgvTask();
 | 
					            AgvTask agvTask = taskList.get(0).getAgvTask();
 | 
				
			||||||
            sendAgvTaskAndHandleResponse(agvTask);
 | 
					            sendAgvTaskAndHandleResponse(agvTask);
 | 
				
			||||||
            endPoint.setStatus(BaseStatus.USED);
 | 
					            endPoint.setStatus(BaseStatus.USED);
 | 
				
			||||||
            pointService.update(endPoint);
 | 
					            pointRepository.save(endPoint);
 | 
				
			||||||
        } catch (Exception e) {
 | 
					        } catch (Exception e) {
 | 
				
			||||||
            throw new RuntimeException(e.getMessage());
 | 
					            throw new RuntimeException(e.getMessage());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -886,7 +901,7 @@ public class StockServiceImpl implements StockService {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private boolean isRestrictedArea(String areaName) {
 | 
					    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) {
 | 
					    private void handleEmptyContainer(Stock stock, Point point) {
 | 
				
			||||||
        point.setStatus(BaseStatus.USED);
 | 
					        point.setStatus(BaseStatus.USED);
 | 
				
			||||||
        pointService.update(point);
 | 
					        pointRepository.save(point);
 | 
				
			||||||
        stock.setStatus(BaseStatus.FREE);
 | 
					        stock.setStatus(BaseStatus.FREE);
 | 
				
			||||||
        stock.setPoint(point);
 | 
					        stock.setPoint(point);
 | 
				
			||||||
        update(stock);
 | 
					        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')")
 | 
					    @Query(value = " from AgvTask agv where agv.stockCode=:stockCode  and agv.status in ('OPEN','ATCALL','UP_CONTAINER','ARRIVED')")
 | 
				
			||||||
    List<AgvTask> findRepeat(String startSlotCode, String endSlotCode);
 | 
					    List<AgvTask> findRepeat(String stockCode);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -458,7 +458,10 @@ public class AgvTaskServiceImpl implements AgvTaskService {
 | 
				
			||||||
            case AreaNameDic.JLQ:
 | 
					            case AreaNameDic.JLQ:
 | 
				
			||||||
//                handleJL(taskList, endPoint, stock);//满车出库
 | 
					//                handleJL(taskList, endPoint, stock);//满车出库
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 | 
					            case AreaNameDic.CPXXQ:
 | 
				
			||||||
 | 
					            case AreaNameDic.CPRKQ:
 | 
				
			||||||
 | 
					                handleCPXXAndCPRK(endPoint, stock);//空货架-成品下线区;满货架-成品入库区
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        agvTask.setStatus(BizStatus.FINISH);
 | 
					        agvTask.setStatus(BizStatus.FINISH);
 | 
				
			||||||
| 
						 | 
					@ -812,4 +815,9 @@ public class AgvTaskServiceImpl implements AgvTaskService {
 | 
				
			||||||
            pointService.update(point);
 | 
					            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());
 | 
					        List<Task> taskList = taskRepository.findByNotPickTask(pick.getId());
 | 
				
			||||||
        for (Task task : taskList) {
 | 
					        for (Task task : taskList) {
 | 
				
			||||||
            /*生成搬运任务*/
 | 
					            /*生成搬运任务*/
 | 
				
			||||||
            List<AgvTask> agvTaskList = agvTaskRepository.findRepeat(task.getSrcPointCode(), task.getDstPointCode());
 | 
					            List<AgvTask> agvTaskList = agvTaskRepository.findRepeat(task.getSrcStockCode());
 | 
				
			||||||
            if (agvTaskList.size() > 0) {
 | 
					            if (agvTaskList.size() > 0) {
 | 
				
			||||||
                agvTask = agvTaskList.get(0);
 | 
					                agvTask = agvTaskList.get(0);
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,7 +3,6 @@ package com.youchain.modules.quartz.task;
 | 
				
			||||||
import com.youchain.basicdata.service.StockService;
 | 
					import com.youchain.basicdata.service.StockService;
 | 
				
			||||||
import com.youchain.businessdata.domain.Pick;
 | 
					import com.youchain.businessdata.domain.Pick;
 | 
				
			||||||
import com.youchain.businessdata.repository.PickRepository;
 | 
					import com.youchain.businessdata.repository.PickRepository;
 | 
				
			||||||
import com.youchain.businessdata.service.AgvTaskService;
 | 
					 | 
				
			||||||
import com.youchain.businessdata.service.PickDetailService;
 | 
					import com.youchain.businessdata.service.PickDetailService;
 | 
				
			||||||
import com.youchain.businessdata.service.PickService;
 | 
					import com.youchain.businessdata.service.PickService;
 | 
				
			||||||
import com.youchain.utils.*;
 | 
					import com.youchain.utils.*;
 | 
				
			||||||
| 
						 | 
					@ -45,7 +44,6 @@ public class pickTask {
 | 
				
			||||||
                pickDetailService.allocatePick(pick);
 | 
					                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 UP_CONTAINER = "UP_CONTAINER";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 任务状态-翻包返库
 | 
					     * 翻包返库
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static String FB_RETURN = "FB_RETURN";
 | 
					    public static String FB_RETURN = "FB_RETURN";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -121,6 +121,3 @@ file:
 | 
				
			||||||
minidao:
 | 
					minidao:
 | 
				
			||||||
  base-package: org.jeecg.modules.jmreport.desreport.dao*
 | 
					  base-package: org.jeecg.modules.jmreport.desreport.dao*
 | 
				
			||||||
  db-type: mysql
 | 
					  db-type: mysql
 | 
				
			||||||
task:
 | 
					 | 
				
			||||||
  onOff:
 | 
					 | 
				
			||||||
    zCJXBTask: false
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -130,6 +130,3 @@ file:
 | 
				
			||||||
minidao:
 | 
					minidao:
 | 
				
			||||||
  base-package: org.jeecg.modules.jmreport.desreport.dao*
 | 
					  base-package: org.jeecg.modules.jmreport.desreport.dao*
 | 
				
			||||||
  db-type: mysql
 | 
					  db-type: mysql
 | 
				
			||||||
task:
 | 
					 | 
				
			||||||
  onOff:
 | 
					 | 
				
			||||||
    zCJXBTask: false
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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:
 | 
				
			||||||
| 
						 | 
					@ -31,11 +31,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
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,6 +24,26 @@ public class EladminSystemApplicationTests {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static void main(String[] args) {
 | 
					    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(() -> {
 | 
					        CompletableFuture<Void> asnDetailFuture = CompletableFuture.runAsync(() -> {
 | 
				
			||||||
            System.out.println("新增asnDetail");
 | 
					            System.out.println("新增asnDetail");
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
| 
						 | 
					@ -37,18 +57,6 @@ public class EladminSystemApplicationTests {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        taskFuture.join();
 | 
					        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<>();
 | 
					        Set<BarCodeVo> barCodeVos = new HashSet<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        BarCodeVo barCodeVo = new BarCodeVo();
 | 
					        BarCodeVo barCodeVo = new BarCodeVo();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue