package com.hw.qms.service.impl;

import com.hw.common.core.utils.DateUtils;
import com.hw.qms.domain.MesBaseMaterialInfo;
import com.hw.qms.mapper.MesBaseMaterialInfoMapper;
import com.hw.qms.service.IMesBaseMaterialInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 物料信息Service业务层处理
 *
 * @author xins
 * @date 2023-12-21
 */
@Service
public class MesBaseMaterialInfoServiceImpl implements IMesBaseMaterialInfoService
{
    @Autowired
    private MesBaseMaterialInfoMapper mesBaseMaterialInfoMapper;

    /**
     * 查询物料信息
     *
     * @param materialId 物料信息主键
     * @return 物料信息
     */
    @Override
    public MesBaseMaterialInfo selectMesBaseMaterialInfoByMaterialId(Long materialId)
    {
        return mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByMaterialId(materialId);
    }

    /**
     * 查询物料信息列表
     *
     * @param mesBaseMaterialInfo 物料信息
     * @return 物料信息
     */
    @Override
    public List<MesBaseMaterialInfo> selectMesBaseMaterialInfoList(MesBaseMaterialInfo mesBaseMaterialInfo)
    {
        return mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoList(mesBaseMaterialInfo);
    }

    /**
     * 新增物料信息
     *
     * @param mesBaseMaterialInfo 物料信息
     * @return 结果
     */
    @Override
    public int insertMesBaseMaterialInfo(MesBaseMaterialInfo mesBaseMaterialInfo)
    {
        mesBaseMaterialInfo.setCreateTime(DateUtils.getNowDate());
        return mesBaseMaterialInfoMapper.insertMesBaseMaterialInfo(mesBaseMaterialInfo);
    }

    /**
     * 修改物料信息
     *
     * @param mesBaseMaterialInfo 物料信息
     * @return 结果
     */
    @Override
    public int updateMesBaseMaterialInfo(MesBaseMaterialInfo mesBaseMaterialInfo)
    {
        mesBaseMaterialInfo.setUpdateTime(DateUtils.getNowDate());
        return mesBaseMaterialInfoMapper.updateMesBaseMaterialInfo(mesBaseMaterialInfo);
    }

    /**
     * 批量删除物料信息
     *
     * @param materialIds 需要删除的物料信息主键
     * @return 结果
     */
    @Override
    public int deleteMesBaseMaterialInfoByMaterialIds(Long[] materialIds)
    {
        return mesBaseMaterialInfoMapper.deleteMesBaseMaterialInfoByMaterialIds(materialIds);
    }

    /**
     * 删除物料信息信息
     *
     * @param materialId 物料信息主键
     * @return 结果
     */
    @Override
    public int deleteMesBaseMaterialInfoByMaterialId(Long materialId)
    {
        return mesBaseMaterialInfoMapper.deleteMesBaseMaterialInfoByMaterialId(materialId);
    }




    /**
     * 查询物料信息列表
     *
     * @param materialIds 物料信息ID列表
     * @return 物料信息
     */
    @Override
    public List<MesBaseMaterialInfo> selectMesBaseMaterialInfoListByMaterialIds(Long[] materialIds)
    {
        return mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoListByMaterialIds(materialIds);
    }


    /**
     * 查询物料信息列表，提供给仓储配置物料列表使用
     *
     * @param mesBaseMaterialInfo 物料信息
     * @return 物料信息
     */
    @Override
    public List<MesBaseMaterialInfo> selectMaterialInfos4AllocateCheckRule(MesBaseMaterialInfo mesBaseMaterialInfo)
    {
        return mesBaseMaterialInfoMapper.selectMaterialInfos4AllocateCheckRule(mesBaseMaterialInfo);
    }

}
