no message
parent
4b2577b715
commit
57e8dd1149
|
|
@ -59,7 +59,7 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
|
|||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -111,15 +111,7 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
@Override
|
||||
public void deleteAll(Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
Inventory inventory = this.findById(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);
|
||||
}
|
||||
inventoryRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -200,23 +200,19 @@ public class TaskServiceImpl implements TaskService {
|
|||
//查询出待分配的pickDetail
|
||||
List<PickDetail> pickDetails = pickDetailService.findByPickDetailNoAllocate(pick.getId());
|
||||
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())) {
|
||||
//绑定点位
|
||||
pick.setPoint(endPoint);
|
||||
pickService.update(pick);
|
||||
if (BizStatus.ALLOCATE.equals(pick.getStatus()) || BizStatus.ASSIGN.equals(pick.getStatus())) {
|
||||
//绑定点位
|
||||
pick.setPoint(endPoint);
|
||||
pickService.update(pick);
|
||||
|
||||
//占用点位
|
||||
pointService.usedPoint(endPoint);
|
||||
}
|
||||
//占用点位
|
||||
pointService.usedPoint(endPoint);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -576,6 +572,10 @@ public class TaskServiceImpl implements TaskService {
|
|||
inventory.setQueuedQty(inventory.getQueuedQty() - moveQty);
|
||||
inventory.setQuantity(inventory.getQuantity() - moveQty);
|
||||
inventoryService.update(inventory);
|
||||
|
||||
if (inventory.getQuantity() == 0) {
|
||||
inventoryService.deleteAll(new Long[]{inventory.getId()});
|
||||
}
|
||||
}
|
||||
|
||||
//生成新库存
|
||||
|
|
|
|||
|
|
@ -54,7 +54,9 @@ public class pickTask {
|
|||
throw new BadRequestException("无待分配的成品出库单,分配失败!");
|
||||
}
|
||||
for (Pick pick : pickList) {
|
||||
taskService.allocatePick(pick);
|
||||
synchronized (pick) {
|
||||
taskService.allocatePick(pick);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -75,7 +77,7 @@ public class pickTask {
|
|||
}
|
||||
|
||||
/**
|
||||
* 轮询拣货完成的出库单,自动叫料
|
||||
* 生成叫料搬运任务
|
||||
*/
|
||||
public void callJlTask() {
|
||||
/*查询拣货完成完成的出库单*/
|
||||
|
|
@ -98,19 +100,22 @@ public class pickTask {
|
|||
throw new BadRequestException("无备料任务或无叫料任务!");
|
||||
}
|
||||
for (AgvTask agvTask : agvTaskList) {
|
||||
if (BizStatus.PICK.equals(agvTask.getType())) {
|
||||
//目标点没有托盘继续下发下一个任务
|
||||
String endSlotCode = agvTask.getEndSlotCode();
|
||||
Stock stock = stockService.findByPointCode(endSlotCode);
|
||||
if (stock == null) {
|
||||
boolean isTaskFound = agvTaskService.findByCcEndSlotCode(endSlotCode, BizStatus.PICK, "FORKLIFT_MOVE");
|
||||
if (isTaskFound) {
|
||||
kmReService.sendAgvTask(agvTask, kmReService.sendAgvTaskCcJson(agvTask));
|
||||
synchronized (agvTask) {
|
||||
if (BizStatus.PICK.equals(agvTask.getType())) {
|
||||
//目标点没有托盘继续下发下一个任务
|
||||
String endSlotCode = agvTask.getEndSlotCode();
|
||||
Stock stock = stockService.findByPointCode(endSlotCode);
|
||||
if (stock == null) {
|
||||
boolean isTaskFound = agvTaskService.findByCcEndSlotCode(endSlotCode, BizStatus.PICK, "FORKLIFT_MOVE");
|
||||
if (isTaskFound) {
|
||||
kmReService.sendAgvTask(agvTask, kmReService.sendAgvTaskCcJson(agvTask));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
kmReService.sendAgvTask(agvTask, kmReService.sendAgvTaskHjJson(agvTask));
|
||||
}
|
||||
} else {
|
||||
kmReService.sendAgvTask(agvTask, kmReService.sendAgvTaskHjJson(agvTask));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue