| | |
| | | link.setDealAndClose(1); |
| | | } |
| | | }break; |
| | | //设备入库申请 TODO 入库影响库存 |
| | | //设备入库申请 |
| | | case 2: |
| | | //设备报废申请 |
| | | case 3:{ |
| | |
| | | link.setDealAndClose(1); |
| | | } |
| | | }break; |
| | | case 4:{ //TODO 出库申请 |
| | | case 4:{ // 出库申请 |
| | | if(link.getStatus() == WorkflowEnum.LINK_STATUS_PASS.getValue().intValue()){ |
| | | mainInDB.setStatus(WorkflowEnum.MAIN_STATUS_WAIT_FOR_DEALING.getValue()); |
| | | mainInDB.setStatus(WorkflowEnum.MAIN_STATUS_END_PASS.getValue()); |
| | | mainInDB.setEndTime(now); |
| | | mainInDB.setEndReason(link.getDealReason()); |
| | | mainService.updateById(mainInDB); |
| | | //获取出库申请单设备 |
| | | List<WorkflowDevice> deviceListInDB = deviceService.getByMainId(mainInDB.getId()); |
| | | List<DeviceSpare> spareList = new ArrayList<>(); |
| | | deviceListInDB.forEach(device -> { |
| | | DeviceSpare spare = new DeviceSpare(); |
| | | BeanUtils.copyProperties(device,spare); |
| | | spareList.add(spare); |
| | | }); |
| | | //更新库存 |
| | | deviceSpareService.outBound(spareList); |
| | | }else if(link.getStatus() == WorkflowEnum.LINK_STATUS_REJECT.getValue().intValue()){ |
| | | mainInDB.setStatus(WorkflowEnum.MAIN_STATUS_END_REJECT.getValue()); |
| | | mainInDB.setEndReason(link.getDealRejectReason()); |
| | | mainInDB.setEndTime(now); |
| | | //检查是否有关联工单.如果有关联工单,关联工单状态重置为完结待处理,完成时间重置为空 |
| | | if(mainInDB.getRelatedId() != null){ |
| | | Integer relatedId = mainInDB.getRelatedId(); |
| | | //mainService.resetRepairStatus(relatedId,mainInDB.getQuantity()); |
| | | } |
| | | mainService.updateById(mainInDB); |
| | | link.setDealAndClose(1); |
| | | } |