| | |
| | | import com.ruoyi.device.vo.DeviceRepairVo; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.SparePartsMapper; |
| | | import com.ruoyi.project.system.service.ISysNoticeService; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SpareParts; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SparePartsRequisitionRecord; |
| | | import com.ruoyi.measuringinstrumentledger.service.SparePartsRequisitionRecordService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private final SparePartsMapper sparePartsMapper; |
| | | private final SparePartsRequisitionRecordService sparePartsRequisitionRecordService; |
| | | private final FileUtil fileUtil; |
| | | private final ISysNoticeService sysNoticeService; |
| | | |
| | | private static final int STATUS_PENDING_REPAIR = 0; |
| | | private static final int STATUS_COMPLETED = 1; |
| | |
| | | sparePartsMapper.updateById(spareParts); |
| | | sparePartIds.add(sparePartUse.getId()); |
| | | |
| | | // 库存预警通知 |
| | | if (spareParts.getWarnNum() != null && spareParts.getNotifyPersonId() != null |
| | | && spareParts.getQuantity().compareTo(spareParts.getWarnNum()) < 0) { |
| | | sysNoticeService.simpleNoticeByUser( |
| | | "备件库存预警", |
| | | "备件【" + spareParts.getName() + "】当前库存(" + spareParts.getQuantity() |
| | | + ")已低于预警数量(" + spareParts.getWarnNum() + "),请及时采购补充。", |
| | | List.of(spareParts.getNotifyPersonId()), |
| | | "/equipmentManagement/spareParts"); |
| | | } |
| | | |
| | | // 创建备件领用记录 |
| | | SparePartsRequisitionRecord record = new SparePartsRequisitionRecord(); |
| | | record.setSourceType(0); // 0 维修 |