no message
parent
755b86ace9
commit
2e85985110
|
|
@ -43,8 +43,8 @@ public class MesController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/zpjlZj")
|
@PostMapping("/zpjlZj")
|
||||||
@Log("mes-其他整件叫料")
|
@Log("mes-整件叫料")
|
||||||
@ApiOperation("mes-其他整件叫料")
|
@ApiOperation("mes-整件叫料")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> zpjlZj(@Validated @RequestBody ZpjlZj zpjlZj) {
|
public ResponseEntity<Object> zpjlZj(@Validated @RequestBody ZpjlZj zpjlZj) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -60,8 +60,8 @@ public class MesController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/zpjlCt")
|
@PostMapping("/zpjlCt")
|
||||||
@Log("mes-成套叫料")
|
@Log("mes-散件叫料")
|
||||||
@ApiOperation("mes-成套叫料")
|
@ApiOperation("mes-散件叫料")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> zpjlCt(@Validated @RequestBody ZpjlCt zpjlCt) {
|
public ResponseEntity<Object> zpjlCt(@Validated @RequestBody ZpjlCt zpjlCt) {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
@ -96,7 +97,6 @@ public class MesServiceImpl implements MesService {
|
||||||
if (!createPickDetails.isEmpty()) {
|
if (!createPickDetails.isEmpty()) {
|
||||||
pickDetailRepository.saveAll(createPickDetails);
|
pickDetailRepository.saveAll(createPickDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -273,9 +273,7 @@ public class MesServiceImpl implements MesService {
|
||||||
//创建Agv任务
|
//创建Agv任务
|
||||||
AgvTask agvTask = agvTaskService.createAgvTask(BizStatus.Cp_Off_Up, emptyStock, srcPoint.getCode(), endPoint.getCode(), "RACK_MOVE");
|
AgvTask agvTask = agvTaskService.createAgvTask(BizStatus.Cp_Off_Up, emptyStock, srcPoint.getCode(), endPoint.getCode(), "RACK_MOVE");
|
||||||
// 更新点位状态
|
// 更新点位状态
|
||||||
synchronized (this) {
|
pointService.usedPoint(endPoint);
|
||||||
pointService.usedPoint(endPoint);
|
|
||||||
}
|
|
||||||
//下发任务
|
//下发任务
|
||||||
kmReService.sendAgvTask(agvTask, kmReService.sendAgvTaskHjJson(agvTask));
|
kmReService.sendAgvTask(agvTask, kmReService.sendAgvTaskHjJson(agvTask));
|
||||||
}
|
}
|
||||||
|
|
@ -296,13 +294,15 @@ public class MesServiceImpl implements MesService {
|
||||||
if (agvTaskService.findByEndSlotCode(endPoint.getCode(), BizStatus.Cp_Off_Line, "RACK_MOVE")) {
|
if (agvTaskService.findByEndSlotCode(endPoint.getCode(), BizStatus.Cp_Off_Line, "RACK_MOVE")) {
|
||||||
//创建Agv任务
|
//创建Agv任务
|
||||||
AgvTask agvTask = agvTaskService.createAgvTask(BizStatus.Cp_Off_Line, fullStock, srcPoint.getCode(), endPoint.getCode(), "RACK_MOVE");
|
AgvTask agvTask = agvTaskService.createAgvTask(BizStatus.Cp_Off_Line, fullStock, srcPoint.getCode(), endPoint.getCode(), "RACK_MOVE");
|
||||||
synchronized (this) {
|
synchronized (endPoint) {
|
||||||
// 更新点位状态
|
// 更新点位状态
|
||||||
pointService.usedPoint(endPoint);
|
pointService.usedPoint(endPoint);
|
||||||
|
|
||||||
//占用容器
|
//占用容器
|
||||||
stockService.usedStock(fullStock, srcPoint, BaseStatus.USED);
|
stockService.usedStock(fullStock, srcPoint, BaseStatus.USED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//下发任务
|
//下发任务
|
||||||
kmReService.sendAgvTask(agvTask, kmReService.sendAgvTaskHjJson(agvTask));
|
kmReService.sendAgvTask(agvTask, kmReService.sendAgvTaskHjJson(agvTask));
|
||||||
}
|
}
|
||||||
|
|
@ -333,10 +333,14 @@ public class MesServiceImpl implements MesService {
|
||||||
|
|
||||||
//创建Agv任务
|
//创建Agv任务
|
||||||
AgvTask agvTask = agvTaskService.createAgvTask(BizStatus.Cp_Off_Line, stock, srcPoint.getCode(), endPoint.getCode(), "RACK_MOVE");
|
AgvTask agvTask = agvTaskService.createAgvTask(BizStatus.Cp_Off_Line, stock, srcPoint.getCode(), endPoint.getCode(), "RACK_MOVE");
|
||||||
// 更新点位状态
|
|
||||||
pointService.usedPoint(endPoint);
|
synchronized (endPoint) {
|
||||||
//占用容器
|
// 更新点位状态
|
||||||
stockService.usedStock(stock, srcPoint, BaseStatus.USED);
|
pointService.usedPoint(endPoint);
|
||||||
|
//占用容器
|
||||||
|
stockService.usedStock(stock, srcPoint, BaseStatus.USED);
|
||||||
|
}
|
||||||
|
|
||||||
//下发任务
|
//下发任务
|
||||||
kmReService.sendAgvTask(agvTask, kmReService.sendAgvTaskHjJson(agvTask));
|
kmReService.sendAgvTask(agvTask, kmReService.sendAgvTaskHjJson(agvTask));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 更新出库单状态*/
|
/* 更新出库单状态*/
|
||||||
synchronized (this) {
|
synchronized (pick) {
|
||||||
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())) {
|
||||||
|
|
@ -215,34 +215,27 @@ public class TaskServiceImpl implements TaskService {
|
||||||
public void materialPick(Pick pick) {
|
public void materialPick(Pick pick) {
|
||||||
AgvTask agvTask = null;
|
AgvTask agvTask = null;
|
||||||
List<Task> taskList = this.findByPickNotAllTask(pick.getId());
|
List<Task> taskList = this.findByPickNotAllTask(pick.getId());
|
||||||
synchronized (this) {
|
for (Task task : taskList) {
|
||||||
for (Task task : taskList) {
|
/*生成搬运任务*/
|
||||||
/*生成搬运任务*/
|
List<AgvTask> agvTaskList = agvTaskService.findRepeat(task.getSrcStockCode(), task.getSrcPointCode(), task.getDstPointCode());
|
||||||
List<AgvTask> agvTaskList = agvTaskService.findRepeat(task.getSrcStockCode(), task.getSrcPointCode(), task.getDstPointCode());
|
if (agvTaskList.isEmpty()) {
|
||||||
if (agvTaskList.isEmpty()) {
|
//创建任务
|
||||||
//创建任务
|
agvTask = agvTaskService.createAgvTask(BizStatus.PICK, task.getSrcStock(), task.getSrcPoint().getCode(), task.getDstPoint().getCode(), "FORKLIFT_MOVE");
|
||||||
agvTask = agvTaskService.createAgvTask(BizStatus.PICK, task.getSrcStock(), task.getSrcPoint().getCode(), task.getDstPoint().getCode(), "FORKLIFT_MOVE");
|
|
||||||
|
|
||||||
//终点占用
|
|
||||||
pointService.usedPoint(task.getDstPoint());
|
|
||||||
} else {
|
|
||||||
agvTask = agvTaskList.get(0);
|
|
||||||
}
|
|
||||||
task.setAgvTask(agvTask);
|
|
||||||
task.setTaskStatus(agvTask.getStatus());
|
|
||||||
taskRepository.save(task);
|
|
||||||
|
|
||||||
|
|
||||||
|
//终点占用
|
||||||
|
pointService.usedPoint(task.getDstPoint());
|
||||||
|
} else {
|
||||||
|
agvTask = agvTaskList.get(0);
|
||||||
|
}
|
||||||
|
task.setAgvTask(agvTask);
|
||||||
|
task.setTaskStatus(agvTask.getStatus());
|
||||||
|
taskRepository.save(task);
|
||||||
/* //叫料区是否有空车,呼叫到备料缓存区
|
/* //叫料区是否有空车,呼叫到备料缓存区
|
||||||
this.callEmptyStock(task.getPickDetail().getItem().getGoodType());*/
|
this.callEmptyStock(task.getPickDetail().getItem().getGoodType());*/
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*更新出库单状态*/
|
/*更新出库单状态*/
|
||||||
synchronized (this) {
|
pick.setStatus(BizStatus.PICKUP);
|
||||||
pick.setStatus(BizStatus.PICKUP);
|
pickService.update(pick);
|
||||||
pickService.update(pick);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -276,9 +269,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
}
|
}
|
||||||
|
|
||||||
//终点占用
|
//终点占用
|
||||||
synchronized (this) {
|
pointService.usedPoint(endPoint);
|
||||||
pointService.usedPoint(endPoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
//创建任务
|
//创建任务
|
||||||
agvTaskService.createAgvTask(BizStatus.CALL_RETURN, stock, srcPoint.getCode(), endPoint.getCode(), "RACK_MOVE");
|
agvTaskService.createAgvTask(BizStatus.CALL_RETURN, stock, srcPoint.getCode(), endPoint.getCode(), "RACK_MOVE");
|
||||||
|
|
@ -311,22 +302,21 @@ public class TaskServiceImpl implements TaskService {
|
||||||
|
|
||||||
//绑定任务
|
//绑定任务
|
||||||
List<Task> taskList = this.findByPickAllTask(pick.getId());
|
List<Task> taskList = this.findByPickAllTask(pick.getId());
|
||||||
synchronized (this) {
|
|
||||||
for (Task task : taskList) {
|
|
||||||
task.setCallAgvTaskId(agvTask.getId());
|
|
||||||
taskRepository.save(task);
|
|
||||||
}
|
|
||||||
|
|
||||||
//起点占用
|
for (Task task : taskList) {
|
||||||
pointService.usedPoint(srcPoint);
|
task.setCallAgvTaskId(agvTask.getId());
|
||||||
|
taskRepository.save(task);
|
||||||
//终点占用
|
|
||||||
pointService.usedPoint(endPoint);
|
|
||||||
|
|
||||||
//更新出库单状态为叫料中
|
|
||||||
pick.setStatus(BizStatus.SHIP_PART);
|
|
||||||
pickService.update(pick);
|
|
||||||
}
|
}
|
||||||
|
//起点占用
|
||||||
|
pointService.usedPoint(srcPoint);
|
||||||
|
|
||||||
|
//终点占用
|
||||||
|
pointService.usedPoint(endPoint);
|
||||||
|
|
||||||
|
//更新出库单状态为叫料中
|
||||||
|
pick.setStatus(BizStatus.SHIP_PART);
|
||||||
|
pickService.update(pick);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -354,9 +344,9 @@ public class TaskServiceImpl implements TaskService {
|
||||||
//未分配数量
|
//未分配数量
|
||||||
double unQty = quantity;
|
double unQty = quantity;
|
||||||
Set<String> tps = new HashSet<>();
|
Set<String> tps = new HashSet<>();
|
||||||
synchronized (this) {
|
for (Inventory inv : inventoryList) {
|
||||||
for (Inventory inv : inventoryList) {
|
//判断托盘是否有任务
|
||||||
//判断托盘是否有任务
|
synchronized (inv) {
|
||||||
if (this.existsByStock(pick.getCode(), inv.getStockCode()) >= 1) {
|
if (this.existsByStock(pick.getCode(), inv.getStockCode()) >= 1) {
|
||||||
tps.add(inv.getStockCode());
|
tps.add(inv.getStockCode());
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -384,7 +374,6 @@ public class TaskServiceImpl implements TaskService {
|
||||||
|
|
||||||
//生成Task任务
|
//生成Task任务
|
||||||
this.createTask(item, allocateQty, inv.getItemKey(), null, BizStatus.PICK, pickDetail, inv.getId(), inv.getStock(), startPoint, endPoint, null);
|
this.createTask(item, allocateQty, inv.getItemKey(), null, BizStatus.PICK, pickDetail, inv.getId(), inv.getStock(), startPoint, endPoint, null);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -399,23 +388,20 @@ public class TaskServiceImpl implements TaskService {
|
||||||
public void cancelAllocate(long id, double quantity) {
|
public void cancelAllocate(long id, double quantity) {
|
||||||
PickDetail pd = pickDetailService.findById(id);
|
PickDetail pd = pickDetailService.findById(id);
|
||||||
List<Task> tasks = this.findByPickDetailNotAllTask(id);
|
List<Task> tasks = this.findByPickDetailNotAllTask(id);
|
||||||
synchronized (this) {
|
for (Task task : tasks) {
|
||||||
for (Task task : tasks) {
|
//根据task找到对应的库存
|
||||||
//根据task找到对应的库存
|
Inventory inv = inventoryService.findById(task.getInvId());
|
||||||
Inventory inv = inventoryService.findById(task.getInvId());
|
inv.setQueuedQty(inv.getQueuedQty() - pd.getAllocatedQty());
|
||||||
inv.setQueuedQty(inv.getQueuedQty() - pd.getAllocatedQty());
|
inventoryService.update(inv);
|
||||||
inventoryService.update(inv);
|
|
||||||
|
|
||||||
//删除Task
|
//删除Task
|
||||||
taskRepository.delete(task);
|
taskRepository.delete(task);
|
||||||
|
|
||||||
pd.setAllocatedQty(pd.getAllocatedQty() - quantity);
|
|
||||||
if (pd.getAllocatedQty() == 0) {
|
|
||||||
pd.setStatus(BizStatus.OPEN);
|
|
||||||
}
|
|
||||||
pickDetailService.update(pd);
|
|
||||||
|
|
||||||
|
pd.setAllocatedQty(pd.getAllocatedQty() - quantity);
|
||||||
|
if (pd.getAllocatedQty() == 0) {
|
||||||
|
pd.setStatus(BizStatus.OPEN);
|
||||||
}
|
}
|
||||||
|
pickDetailService.update(pd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -431,11 +417,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
if (task.getPlanQty() > task.getMoveQty()) {
|
if (task.getPlanQty() > task.getMoveQty()) {
|
||||||
PickDetail pickDetail = task.getPickDetail();
|
PickDetail pickDetail = task.getPickDetail();
|
||||||
Inventory inv = inventoryService.findById(task.getInvId());
|
Inventory inv = inventoryService.findById(task.getInvId());
|
||||||
synchronized (this) {
|
synchronized (inv) {
|
||||||
task.setMoveQty(pickedQuantity);
|
|
||||||
task.setTaskStatus(BizStatus.FINISH);
|
|
||||||
taskRepository.save(task);
|
|
||||||
|
|
||||||
inv.setQuantity(inv.getQuantity() - pickedQuantity);
|
inv.setQuantity(inv.getQuantity() - pickedQuantity);
|
||||||
inv.setQueuedQty(inv.getQueuedQty() - pickedQuantity);
|
inv.setQueuedQty(inv.getQueuedQty() - pickedQuantity);
|
||||||
inventoryService.update(inv);
|
inventoryService.update(inv);
|
||||||
|
|
@ -447,6 +429,10 @@ public class TaskServiceImpl implements TaskService {
|
||||||
inventoryService.deleteAll(new Long[]{inv.getId()});
|
inventoryService.deleteAll(new Long[]{inv.getId()});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task.setMoveQty(pickedQuantity);
|
||||||
|
task.setTaskStatus(BizStatus.FINISH);
|
||||||
|
taskRepository.save(task);
|
||||||
|
|
||||||
//回写拣货数量
|
//回写拣货数量
|
||||||
pickDetail.setPickedQty(pickDetail.getPickedQty() + pickedQuantity);
|
pickDetail.setPickedQty(pickDetail.getPickedQty() + pickedQuantity);
|
||||||
pickDetailService.update(pickDetail);
|
pickDetailService.update(pickDetail);
|
||||||
|
|
@ -475,7 +461,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
|
|
||||||
//退回库存
|
//退回库存
|
||||||
double srcQty = inv.getQueuedQty();
|
double srcQty = inv.getQueuedQty();
|
||||||
synchronized (this) {
|
synchronized (inv) {
|
||||||
inv.setQueuedQty(inv.getQueuedQty() + pickedQuantity);
|
inv.setQueuedQty(inv.getQueuedQty() + pickedQuantity);
|
||||||
inv.setQuantity(inv.getQuantity() + pickedQuantity);
|
inv.setQuantity(inv.getQuantity() + pickedQuantity);
|
||||||
inventoryService.update(inv);
|
inventoryService.update(inv);
|
||||||
|
|
@ -537,17 +523,14 @@ public class TaskServiceImpl implements TaskService {
|
||||||
throw new BadRequestException(orderNumber + "箱号库存数量不足,请更换箱号!");
|
throw new BadRequestException(orderNumber + "箱号库存数量不足,请更换箱号!");
|
||||||
}
|
}
|
||||||
Inventory srcinventory = inventoryService.findById(task.getInvId());
|
Inventory srcinventory = inventoryService.findById(task.getInvId());
|
||||||
synchronized (srcinventory) {
|
srcinventory.setQueuedQty(srcinventory.getQueuedQty() - task.getPlanQty());
|
||||||
synchronized (dstinventory) {
|
inventoryService.update(srcinventory);
|
||||||
srcinventory.setQueuedQty(srcinventory.getQueuedQty() - task.getPlanQty());
|
dstinventory.setQueuedQty(dstinventory.getQueuedQty() + task.getPlanQty());
|
||||||
inventoryService.update(srcinventory);
|
inventoryService.update(dstinventory);
|
||||||
dstinventory.setQueuedQty(dstinventory.getQueuedQty() + task.getPlanQty());
|
task.setInvId(dstinventory.getId());
|
||||||
inventoryService.update(dstinventory);
|
task.setItemKey(dstinventory.getItemKey());
|
||||||
task.setInvId(dstinventory.getId());
|
taskRepository.save(task);
|
||||||
task.setItemKey(dstinventory.getItemKey());
|
|
||||||
taskRepository.save(task);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -584,9 +567,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
|
|
||||||
|
|
||||||
//容器占用
|
//容器占用
|
||||||
synchronized (dstStock) {
|
stockService.usedStock(dstStock, dstStock.getPoint(), BaseStatus.USED);
|
||||||
stockService.usedStock(dstStock, dstStock.getPoint(), BaseStatus.USED);
|
|
||||||
}
|
|
||||||
|
|
||||||
//库存日志
|
//库存日志
|
||||||
inventoryLogService.createInventoryLog(BizStatus.MOVE, BizStatus.ADD, task.getPickDetail().getPo(), task.getItemKey(), task.getDstPoint(), dstStock.getPoint(), task.getSrcStock(), dstStock, 0d, moveQty, BizStatus.PICK, task.getId(), newInventory.getId(), "");
|
inventoryLogService.createInventoryLog(BizStatus.MOVE, BizStatus.ADD, task.getPickDetail().getPo(), task.getItemKey(), task.getDstPoint(), dstStock.getPoint(), task.getSrcStock(), dstStock, 0d, moveQty, BizStatus.PICK, task.getId(), newInventory.getId(), "");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue