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

import cn.estsh.i3plus.ext.mes.pcn.api.busi.ISxPrintTemplateMethodService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.ProduceSnExtModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.SxPrintTemplateModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description 印尼向质保书打印
 * @Author: wangjie
 * @CreateDate: 2020/6/22 9:38 AM
 * @Description:
 **/
@Slf4j
@Service
public class BuSxPrintQualityAssureIndiaService extends SxPrintDispatchService implements ISxPrintTemplateMethodService {

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

        List<ProduceSnExtModel> snList = printModel.getSnList();

        List<Map<String, Object>> resultMapList = new ArrayList<>();
        for (int i = 0; i < snList.size(); i++) {
            Map<String, Object> resultMap = new HashMap<>();
            resultMap.put("qualityAssureCode",snList.get(i).getQualityAssureCode());
            resultMap.put("serialNumber",getSnWithOutPercent(snList.get(i).getSerialNumber()));
            resultMapList.add(resultMap);
        }

        return resultMapList;
    }

}
