package com.sw.common.accessory.server.service;

import com.sw.common.accessory.server.dto.*;
import com.sw.common.accessory.server.entity.EquipmentAccessory;
import com.sw.common.core.request.RequestPage;
import com.sw.common.mybatisplus.base.BaseService;
import com.sw.common.mybatisplus.entity.Pageable;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @Author
* @Description：
* @Date:
* @Modified By:
*/
public interface EquipmentAccessoryService extends BaseService<EquipmentAccessory> {

    List<EquipmentAccessory> pages (EquipmentAccessBo bo, Pageable pageable);
    int pageCount(EquipmentAccessBo bo);

    void applyAccessory(ApplyAccessoryParamDto applyAccessoryParamDto);
    void applyMaterial(ApplyMaterialParamDto applyAccessoryParamDto);

    /**
     * 创建新的设备辅材
     *
     * @param equipmentInfo 设备信息
     * @param type          0：申请新辅材，1：创建设备辅材
     */
    EquipmentAccessory createNewEquipmentAccessory(EquipmentInfo equipmentInfo, int type);

    void cancelApplyAccessory(Long applyAccessoryId);

    /**
     * 修改退库中数量
     * @param equipmentAccessoryId 设备辅材id
     * @param stockReturnCount
     * @param number
     * @return
     */
    void updateStockReturnCount(Long equipmentAccessoryId, int stockReturnCount,int number);

    /**
     * 修改上机中数量
     * @param equipmentAccessoryId  设备辅材id
     * @param boardingCount 上机中数量
     * @param number 增加数量
     * @return 修改行数
     */
    void updateBoardingCount(Long equipmentAccessoryId, int boardingCount,int number);

    /**
     * 待出库数量
     * @param equipmentAccessoryId  设备辅材id
     * @param waitingOutboundCount 待出库数量
     * @param number 增加数量
     * @return 修改行数
     */
    void updateWaitingOutboundCount(Long equipmentAccessoryId, int waitingOutboundCount, int number);

    /**
     * 待上机数量
     * @param equipmentAccessoryId  设备辅材id
     * @param waitingBoardingCount 待上机数量
     * @param number 增加数量
     * @return 修改行数
     */
    void updateWaitingBoardingCount(Long equipmentAccessoryId, int waitingBoardingCount, int number);

    /**
     * 修改预警数量
     * @param equipmentAccessoryId  设备辅材id
     * @param earlyWarning 预警数量
     * @param number 增加数量
     */
    void updateEarlyWarningCount(Long equipmentAccessoryId, int earlyWarning, int number);

    EquipmentAccessory findByEquipmentCode(String equipmentCode);
}
