package com.uas.platform.b2b.erp.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.uas.platform.b2b.dao.BarLPSetingDao;
import com.uas.platform.b2b.erp.model.LabelPrintSetting;
import com.uas.platform.b2b.erp.service.BarLPSetingService;
import com.uas.platform.b2b.model.BarLabelPrintSetting;

@Service
public class BarLPSetingServiceImpl implements BarLPSetingService{

	@Autowired
	BarLPSetingDao barLPSetingDao;
	
	@Override
	public List<BarLabelPrintSetting> convertBarLSeting(List<LabelPrintSetting> lps) {
		List<BarLabelPrintSetting> barLPSetings = new ArrayList<BarLabelPrintSetting>();
		for(LabelPrintSetting lpseting : lps) {
			BarLabelPrintSetting barLabelPSeting = lpseting.convent();
			List<BarLabelPrintSetting> barLPSetings2= barLPSetingDao.findByLaid(barLabelPSeting.getLabel().getId());
			if(barLPSetings2.size() > 0) {
				barLabelPSeting.setId(barLPSetings2.get(0).getId());
			}
			barLPSetings.add(barLabelPSeting);
		}
		return barLPSetings;
	}

}
