package com.dev.swms.server.service.bean;

import java.util.List;

import com.dev.swms.server.service.base.ItemManager;
import com.dev.energy.client.config.page.TableConfig;
import com.dev.energy.client.ui.table.RowData;
import com.dev.energy.server.service.intercepter.AfterReturnIntercepter;

public class LotInfoInterceptorImpl implements AfterReturnIntercepter<TableConfig> {
	private ItemManager itemManager;

	public LotInfoInterceptorImpl(ItemManager itemManager) {
		super();
		this.itemManager = itemManager;
	}

	@SuppressWarnings("unchecked")
	public TableConfig afterReturn(TableConfig config) {
		List<RowData> list = config.getTableRows();
		for (RowData rw : list) {
			Long itemId = (Long) rw.getColumnValue(0);
			List<Boolean> results = itemManager.getLotRuleTackers(itemId);
			rw.addColumnValue(results);
		}
		return config;
	}

}
