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,23 +200,19 @@ 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())) {
|
||||||
//绑定点位
|
//绑定点位
|
||||||
pick.setPoint(endPoint);
|
pick.setPoint(endPoint);
|
||||||
pickService.update(pick);
|
pickService.update(pick);
|
||||||
|
|
||||||
//占用点位
|
//占用点位
|
||||||
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,7 +54,9 @@ public class pickTask {
|
||||||
throw new BadRequestException("无待分配的成品出库单,分配失败!");
|
throw new BadRequestException("无待分配的成品出库单,分配失败!");
|
||||||
}
|
}
|
||||||
for (Pick pick : pickList) {
|
for (Pick pick : pickList) {
|
||||||
taskService.allocatePick(pick);
|
synchronized (pick) {
|
||||||
|
taskService.allocatePick(pick);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -75,7 +77,7 @@ public class pickTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 轮询拣货完成的出库单,自动叫料
|
* 生成叫料搬运任务
|
||||||
*/
|
*/
|
||||||
public void callJlTask() {
|
public void callJlTask() {
|
||||||
/*查询拣货完成完成的出库单*/
|
/*查询拣货完成完成的出库单*/
|
||||||
|
|
@ -98,19 +100,22 @@ public class pickTask {
|
||||||
throw new BadRequestException("无备料任务或无叫料任务!");
|
throw new BadRequestException("无备料任务或无叫料任务!");
|
||||||
}
|
}
|
||||||
for (AgvTask agvTask : agvTaskList) {
|
for (AgvTask agvTask : agvTaskList) {
|
||||||
if (BizStatus.PICK.equals(agvTask.getType())) {
|
synchronized (agvTask) {
|
||||||
//目标点没有托盘继续下发下一个任务
|
if (BizStatus.PICK.equals(agvTask.getType())) {
|
||||||
String endSlotCode = agvTask.getEndSlotCode();
|
//目标点没有托盘继续下发下一个任务
|
||||||
Stock stock = stockService.findByPointCode(endSlotCode);
|
String endSlotCode = agvTask.getEndSlotCode();
|
||||||
if (stock == null) {
|
Stock stock = stockService.findByPointCode(endSlotCode);
|
||||||
boolean isTaskFound = agvTaskService.findByCcEndSlotCode(endSlotCode, BizStatus.PICK, "FORKLIFT_MOVE");
|
if (stock == null) {
|
||||||
if (isTaskFound) {
|
boolean isTaskFound = agvTaskService.findByCcEndSlotCode(endSlotCode, BizStatus.PICK, "FORKLIFT_MOVE");
|
||||||
kmReService.sendAgvTask(agvTask, kmReService.sendAgvTaskCcJson(agvTask));
|
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