package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.print.strategy;

import cn.estsh.i3plus.ext.mes.pcn.api.busi.ISxPrintTemplateStrategyService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.SxPrintTemplateModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Description 质保书打印通用的模板策略实现
 * @Author: wangjie
 * @CreateDate: 2020/6/22 9:38 AM
 * @Description:
 **/
@Slf4j
@Service
public class SxPrintQualityAssureSingleTemplateService implements ISxPrintTemplateStrategyService {

    @Autowired
    private SxPrintTemplateDispatchService dispatchService;

    @Override
    public List<Map<String, Object>> getPrintTemplateData(SxPrintTemplateModel printModel) {

        dispatchService.checkValidAndPackSnList(printModel);

        dispatchService.checkLabelTemplate(printModel,
                printModel.getSnList().get(0).getSerialNumber(),
                printModel.getSnList().get(0).getQualityAssureTemplate(),
                "质保书");

        return dispatchService.exec(printModel);
    }
}
