no message
							parent
							
								
									4b2577b715
								
							
						
					
					
						commit
						57e8dd1149
					
				| 
						 | 
					@ -59,7 +59,7 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param pickId 出库单ID
 | 
					     * @param pickId 出库单ID
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Query("from Task t where t.pickDetail.pick.id =:pickId and t.planQty - t.moveQty>=0 and  t.moveQty!=0 ")
 | 
					    @Query("from Task t where t.pickDetail.pick.id =:pickId and t.planQty - t.moveQty=0 and  t.callAgvTaskId is null ")
 | 
				
			||||||
    List<Task> findByPickAllTask(Long pickId);
 | 
					    List<Task> findByPickAllTask(Long pickId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -111,15 +111,7 @@ public class InventoryServiceImpl implements InventoryService {
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void deleteAll(Long[] ids) {
 | 
					    public void deleteAll(Long[] ids) {
 | 
				
			||||||
        for (Long id : ids) {
 | 
					        for (Long id : ids) {
 | 
				
			||||||
            Inventory inventory = this.findById(id);
 | 
					            inventoryRepository.deleteById(id);
 | 
				
			||||||
            Stock stock = inventory.getStock();
 | 
					 | 
				
			||||||
            Point point = inventory.getPoint();
 | 
					 | 
				
			||||||
            inventoryRepository.deleteById(inventory.getId());
 | 
					 | 
				
			||||||
            List<Inventory> inventoryList = this.findByStockCode(stock.getCode());
 | 
					 | 
				
			||||||
            if (inventoryList.isEmpty()) {
 | 
					 | 
				
			||||||
                pointService.freePoint(point);
 | 
					 | 
				
			||||||
                stockService.usedStock(stock, null, BaseStatus.FREE);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -200,13 +200,10 @@ public class TaskServiceImpl implements TaskService {
 | 
				
			||||||
        //查询出待分配的pickDetail
 | 
					        //查询出待分配的pickDetail
 | 
				
			||||||
        List<PickDetail> pickDetails = pickDetailService.findByPickDetailNoAllocate(pick.getId());
 | 
					        List<PickDetail> pickDetails = pickDetailService.findByPickDetailNoAllocate(pick.getId());
 | 
				
			||||||
        for (PickDetail pickDetail : pickDetails) {
 | 
					        for (PickDetail pickDetail : pickDetails) {
 | 
				
			||||||
            synchronized (pickDetail.getId()) {
 | 
					 | 
				
			||||||
            msgList.add(this.allocate(pickDetail.getId(), pickDetail.getOrderQty() - pickDetail.getAllocatedQty(), endPoint));
 | 
					            msgList.add(this.allocate(pickDetail.getId(), pickDetail.getOrderQty() - pickDetail.getAllocatedQty(), endPoint));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* 更新出库单状态*/
 | 
					        /* 更新出库单状态*/
 | 
				
			||||||
        synchronized (pick.getId()) {
 | 
					 | 
				
			||||||
        pickService.refreshPickStatus(pick);
 | 
					        pickService.refreshPickStatus(pick);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (BizStatus.ALLOCATE.equals(pick.getStatus()) || BizStatus.ASSIGN.equals(pick.getStatus())) {
 | 
					        if (BizStatus.ALLOCATE.equals(pick.getStatus()) || BizStatus.ASSIGN.equals(pick.getStatus())) {
 | 
				
			||||||
| 
						 | 
					@ -217,7 +214,6 @@ public class TaskServiceImpl implements TaskService {
 | 
				
			||||||
            //占用点位
 | 
					            //占用点位
 | 
				
			||||||
            pointService.usedPoint(endPoint);
 | 
					            pointService.usedPoint(endPoint);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //保存日志
 | 
					        //保存日志
 | 
				
			||||||
| 
						 | 
					@ -576,6 +572,10 @@ public class TaskServiceImpl implements TaskService {
 | 
				
			||||||
            inventory.setQueuedQty(inventory.getQueuedQty() - moveQty);
 | 
					            inventory.setQueuedQty(inventory.getQueuedQty() - moveQty);
 | 
				
			||||||
            inventory.setQuantity(inventory.getQuantity() - moveQty);
 | 
					            inventory.setQuantity(inventory.getQuantity() - moveQty);
 | 
				
			||||||
            inventoryService.update(inventory);
 | 
					            inventoryService.update(inventory);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (inventory.getQuantity() == 0) {
 | 
				
			||||||
 | 
					                inventoryService.deleteAll(new Long[]{inventory.getId()});
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //生成新库存
 | 
					        //生成新库存
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,8 +54,10 @@ public class pickTask {
 | 
				
			||||||
            throw new BadRequestException("无待分配的成品出库单,分配失败!");
 | 
					            throw new BadRequestException("无待分配的成品出库单,分配失败!");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        for (Pick pick : pickList) {
 | 
					        for (Pick pick : pickList) {
 | 
				
			||||||
 | 
					            synchronized (pick) {
 | 
				
			||||||
                taskService.allocatePick(pick);
 | 
					                taskService.allocatePick(pick);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -75,7 +77,7 @@ public class pickTask {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 轮询拣货完成的出库单,自动叫料
 | 
					     * 生成叫料搬运任务
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public void callJlTask() {
 | 
					    public void callJlTask() {
 | 
				
			||||||
        /*查询拣货完成完成的出库单*/
 | 
					        /*查询拣货完成完成的出库单*/
 | 
				
			||||||
| 
						 | 
					@ -98,6 +100,7 @@ public class pickTask {
 | 
				
			||||||
            throw new BadRequestException("无备料任务或无叫料任务!");
 | 
					            throw new BadRequestException("无备料任务或无叫料任务!");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        for (AgvTask agvTask : agvTaskList) {
 | 
					        for (AgvTask agvTask : agvTaskList) {
 | 
				
			||||||
 | 
					            synchronized (agvTask) {
 | 
				
			||||||
                if (BizStatus.PICK.equals(agvTask.getType())) {
 | 
					                if (BizStatus.PICK.equals(agvTask.getType())) {
 | 
				
			||||||
                    //目标点没有托盘继续下发下一个任务
 | 
					                    //目标点没有托盘继续下发下一个任务
 | 
				
			||||||
                    String endSlotCode = agvTask.getEndSlotCode();
 | 
					                    String endSlotCode = agvTask.getEndSlotCode();
 | 
				
			||||||
| 
						 | 
					@ -112,6 +115,8 @@ public class pickTask {
 | 
				
			||||||
                    kmReService.sendAgvTask(agvTask, kmReService.sendAgvTaskHjJson(agvTask));
 | 
					                    kmReService.sendAgvTask(agvTask, kmReService.sendAgvTaskHjJson(agvTask));
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue