package com.sw.mes.yb.pc.service.impl;



import com.sw.mes.core.base.BaseServiceImpl;
import com.sw.mes.core.enums.EnumValues;
import com.sw.mes.yb.pc.dao.TrayBindingRecordDao;
import com.sw.mes.yb.pc.dto.TrayUnbindingDto;
import com.sw.mes.yb.pc.entity.TrayBindingRecord;
import com.sw.mes.yb.pc.service.TrayBindingRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


/**
 * @Author
 * @Description：
 * @Date: Create in
 * @Modified By:
 */
@Service
@Transactional
public class TrayBindingRecordImpl extends BaseServiceImpl<TrayBindingRecord> implements TrayBindingRecordService {
    TrayBindingRecordDao dao;

    @Autowired
    public void setDao(TrayBindingRecordDao dao) {
        super.setBaseDao(dao);
        this.dao = dao;
    }

    @Override
    public List<TrayBindingRecord> findByCodeAndStatus(String code, Integer status) {
        return dao.findByCodeAndStatus(code, status);
    }

    @Override
    public List<TrayBindingRecord> findBySectionNoAndStatus(String sectionNo, Integer status) {
        return dao.findBySectionNoAndStatus(sectionNo,status);
    }

    @Override
    public void trayUnbinding(TrayUnbindingDto trayUnbindingDto) {
        dao.updateByCodeAndSectionNoList(trayUnbindingDto.getCode(),trayUnbindingDto.getSectionNoList(),trayUnbindingDto.getUnbundlingUserName(), EnumValues.trayBindingRecordStatus.UNBUNDLING.getKey());
    }
}
