大件走人工流程;小件走AGV流程
parent
b26a3482bf
commit
ab57324968
|
|
@ -36,6 +36,7 @@ public class BydAppServiceImpl implements BydAppService {
|
|||
private final AsnDetailService asnDetailService;
|
||||
private final ItemKeyService itemKeyService;
|
||||
private final TaskService taskService;
|
||||
private final InventoryLogService inventoryLogService;
|
||||
private final AgvTaskService agvTaskService;
|
||||
private final InventoryService inventoryService;
|
||||
private final KMReService kmReService;
|
||||
|
|
@ -85,6 +86,70 @@ public class BydAppServiceImpl implements BydAppService {
|
|||
//指定容器类型:托盘
|
||||
validateStockType(stock.getStockType());
|
||||
|
||||
switch (item.getGoodType()) {
|
||||
case BizStatus.XJ:
|
||||
xjMaterialIn(stock, pointCode, item, barCodeVos);
|
||||
break;
|
||||
case BizStatus.DJ:
|
||||
djMaterialIn(stock, pointCode, item, barCodeVos);
|
||||
break;
|
||||
default:
|
||||
throw new BadRequestException(item.getCode() + "物料类型不正确,请检查");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void djMaterialIn(Stock stock, String pointCode, Item item, List<BarCodeVo> barCodeVos) {
|
||||
//验证终点;大件入库只能扫描大件存储区的点位
|
||||
Point endPoint = pointService.validatePoint(pointCode);
|
||||
if (!AreaNameDic.DJQ.equals(endPoint.getArea().getName())) {
|
||||
throw new BadRequestException(pointCode + "不是大件存储区中的点位,请检查");
|
||||
}
|
||||
//验证终点状态
|
||||
pointService.validatePointStatus(endPoint);
|
||||
|
||||
//清空库存
|
||||
inventoryService.clearInventory(stock);
|
||||
|
||||
//创建ASN明细和ItemKey和Task任务库存
|
||||
for (BarCodeVo barCodeVo : barCodeVos) {
|
||||
|
||||
AsnDetail asnDetail = asnDetailService.createAsnDetail(item, stock, null, barCodeVo.getPropC1(), barCodeVo.getBoxNumber(), barCodeVo.getPropC3(), Timestamp.valueOf(DateUtil.formatDateTime(DateUtil.parse(barCodeVo.getPropD1()))), barCodeVo.getOrderQty(), barCodeVo.getMo());
|
||||
if (asnDetail != null) {
|
||||
asnDetail.setReceivedQty(asnDetail.getOrderQty());
|
||||
asnDetail.setStatus(BizStatus.RECEIVED);
|
||||
asnDetailService.update(asnDetail);
|
||||
}
|
||||
|
||||
ItemKey itemKey = itemKeyService.createItemKey(item, barCodeVo.getPropC1(), asnDetail.getPropD1(), barCodeVo.getBoxNumber());
|
||||
|
||||
Task task = taskService.createTask(item, asnDetail.getOrderQty(), itemKey, asnDetail, BizStatus.ASN, null, null, stock, null, endPoint, null);
|
||||
if (task != null) {
|
||||
task.setMoveQty(task.getPlanQty());
|
||||
task.setTaskStatus(BizStatus.FINISH);
|
||||
taskService.update(task);
|
||||
}
|
||||
|
||||
//新增库存
|
||||
Inventory inventory = inventoryService.createInventory(itemKey, endPoint, stock, stock.getDept(), asnDetail.getOrderQty());
|
||||
|
||||
//点位占用
|
||||
pointService.usedPoint(endPoint);
|
||||
|
||||
//占用容器
|
||||
stockService.usedStock(stock, endPoint, BaseStatus.USED);
|
||||
|
||||
//新增日志
|
||||
inventoryLogService.createInventoryLog(BizStatus.RECEIVING_UP, BizStatus.ADD, null, itemKey, null, endPoint, stock, stock, 0d, asnDetail.getOrderQty(), BizStatus.ASN, asnDetail.getId(), inventory.getId(), asnDetail.getRemark());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void xjMaterialIn(Stock stock, String pointCode, Item item, List<BarCodeVo> barCodeVos) {
|
||||
|
||||
//验证起点点位
|
||||
Point srcPoint = pointService.validatePoint(pointCode);
|
||||
|
||||
|
|
@ -113,7 +178,6 @@ public class BydAppServiceImpl implements BydAppService {
|
|||
|
||||
//发送任务
|
||||
kmReService.sendAgvTask(agvTask, kmReService.sendAgvTaskCcJson(agvTask));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -298,7 +362,7 @@ public class BydAppServiceImpl implements BydAppService {
|
|||
private void validateSrcPointArea(Point srcPoint) {
|
||||
String srcPointAreaName = srcPoint.getArea().getName();
|
||||
if (!AreaNameDic.DXJRKQ.equals(srcPointAreaName)) {
|
||||
throw new BadRequestException(srcPointAreaName + "的" + srcPoint.getCode() + "点位不能入库");
|
||||
throw new BadRequestException(srcPoint.getCode() + "不是小件入库点位,请检查");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,6 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(AsnDetail resources) {
|
||||
AsnDetail asnDetail = asnDetailRepository.findById(resources.getId()).orElseGet(AsnDetail::new);
|
||||
ValidationUtil.isNull(asnDetail.getId(), "AsnDetail", "id", resources.getId());
|
||||
|
|
|
|||
|
|
@ -86,7 +86,6 @@ public class TaskServiceImpl implements TaskService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(Task resources) {
|
||||
Task task = taskRepository.findById(resources.getId()).orElseGet(Task::new);
|
||||
ValidationUtil.isNull(task.getId(), "Task", "id", resources.getId());
|
||||
|
|
|
|||
Loading…
Reference in New Issue