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


import com.sw.mes.core.base.BaseServiceImpl;
import com.sw.mes.yb.pc.dao.BatchInfoDAO;
import com.sw.mes.yb.pc.entity.BatchInfo;
import com.sw.mes.yb.pc.service.BatchInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;

@Service
@Transactional
public class BatchInfoServiceImpl extends BaseServiceImpl<BatchInfo> implements BatchInfoService {

    BatchInfoDAO batchInfoDAO;

    @Autowired
    public void setDao(BatchInfoDAO batchInfoDAO) {
        this.batchInfoDAO = batchInfoDAO;
        super.setBaseDao(batchInfoDAO);
    }







    @Override
    public BatchInfo getByLotNo(String lotNo) {
        List<BatchInfo> batchInfos = batchInfoDAO.findByLotNo(lotNo);
        if (batchInfos != null && batchInfos.size() > 0) {
            return batchInfos.get(0);
        }
        return null;
    }


}
