package com.aucma.dms.service;

import com.aucma.dms.domain.DmsBillsFaultInstance;
import com.aucma.dms.domain.DmsFaultCompentsParts;
import com.aucma.dms.domain.DmsFaultInstanceActivity;
import com.aucma.dms.domain.vo.DmsBillsFaultInstanceScanVo;

import java.util.List;

/**
 * 检修工单Service接口
 *
 * @author Open Platform
 * @date 2024-01-23
 */
public interface IDmsBillsFaultInstanceService
{
    /**
     * 查询检修工单
     *
     * @param repairInstanceId 检修工单主键
     * @return 检修工单
     */
    public DmsBillsFaultInstance selectDmsBillsFaultInstanceByRepairInstanceId(Long repairInstanceId);

    /**
     * 查询检修工单列表
     *
     * @param dmsBillsFaultInstance 检修工单
     * @return 检修工单集合
     */
    public List<DmsBillsFaultInstance> selectDmsBillsFaultInstanceList(DmsBillsFaultInstance dmsBillsFaultInstance);

    /**
     * 新增检修工单
     *
     * @param dmsBillsFaultInstance 检修工单
     * @return 结果
     */
    public int insertDmsBillsFaultInstance(DmsBillsFaultInstance dmsBillsFaultInstance);

    /**
     * 修改检修工单
     *
     * @param dmsBillsFaultInstance 检修工单
     * @return 结果
     */
    public int updateDmsBillsFaultInstance(DmsBillsFaultInstance dmsBillsFaultInstance);

    /**
     * 批量删除检修工单
     *
     * @param repairInstanceIds 需要删除的检修工单主键集合
     * @return 结果
     */
    public int deleteDmsBillsFaultInstanceByRepairInstanceIds(Long[] repairInstanceIds);

    /**
     * 删除检修工单信息
     *
     * @param repairInstanceId 检修工单主键
     * @return 结果
     */
    public int deleteDmsBillsFaultInstanceByRepairInstanceId(Long repairInstanceId);

    int insertDmsBillsFaultInstancePDA(DmsBillsFaultInstance dmsBillsFaultInstance);


    /**
     * 查询报修工单列表，Join 设备
     *
     * @param dmsBillsFaultInstance 报修工单
     * @return 报修工单
     */
    public List<DmsBillsFaultInstance> selectDmsBillsFaultInstanceJoinList(DmsBillsFaultInstance dmsBillsFaultInstance);

    /**
     * 获取故障报修工单明细，提供给维修使用
     * @param repairInstanceId
     * @return
     */
    public DmsBillsFaultInstance getDmsBillsFaultInstance4Repair(Long repairInstanceId);

    /**
     * 修改报修工单实例节点
     *
     * @param dmsFaultInstanceActivity 报修工单实例节点
     * @return 结果
     */
    public int updateDmsFaultInstanceActivity(DmsFaultInstanceActivity dmsFaultInstanceActivity);

    /**
     * 扫描设备编码验证，验证通过后进行维修
     * @param dmsBillsFaultInstanceScanVo
     */
    public void scanDevice4Repair(DmsBillsFaultInstanceScanVo dmsBillsFaultInstanceScanVo);

    /**
     * 开始维修
     *
     * @param dmsFaultInstanceActivity 报修工单实例节点
     * @return 结果
     */
    public int startRepair(DmsFaultInstanceActivity dmsFaultInstanceActivity);

    /**
     * 指定派工
     *
     * @param dmsFaultInstanceActivity 报修工单实例节点（需包含 repairInstanceId、handleUserId、handleBy）
     * @return 结果
     */
    public int dispatchRepair(DmsFaultInstanceActivity dmsFaultInstanceActivity);

    /**
     * 完成维修
     *
     * @param dmsFaultInstanceActivity 报修工单实例节点
     * @return 结果
     */
    public int completeRepair(DmsFaultInstanceActivity dmsFaultInstanceActivity);

    DmsFaultInstanceActivity selectFaults(Long repairInstanceId);

    List<DmsBillsFaultInstance> selectDmsBillsFaultInstanceCompletedList(DmsBillsFaultInstance dmsBillsFaultInstance);

    List<DmsFaultCompentsParts> getDmsPartsList(Long repairInstanceId);
}
