package com.steerinfo.ems.emsprodplanround.service.impl;

import com.steerinfo.ems.Utils.DateUtils;
import com.steerinfo.ems.emsprodplanround.mapper.EmsProdplanRoundMapper;
import com.steerinfo.ems.emsprodplanround.model.EmsProdplanRound;
import com.steerinfo.ems.emsprodplanround.service.IEmsProdplanRoundService;
import com.steerinfo.framework.mapper.IBaseMapper;
import com.steerinfo.framework.service.impl.BaseServiceImpl;
import com.steerinfo.framework.service.pagehelper.PageHelper;
import com.steerinfo.framework.service.pagehelper.PageList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

/**
 * EmsProdplanRound服务实现：
 * @author generator
 * @version 1.0-SNAPSHORT 2021-07-06 03:43
 * 类描述
 * 修订历史：
 * 日期：2021-07-06
 * 作者：generator
 * 参考：
 * 描述：EmsProdplanRound服务实现
 * @see null
 * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
 */
@Service(value = "emsProdplanRoundService")
public class EmsProdplanRoundServiceImpl extends BaseServiceImpl<EmsProdplanRound, String> implements IEmsProdplanRoundService {

    @Autowired
    private EmsProdplanRoundMapper emsProdplanRoundMapper;

    @Override
    protected IBaseMapper<EmsProdplanRound, String> getMapper() {
        return emsProdplanRoundMapper;
    }

    @Override
    public EmsProdplanRound getbeyondWeight(HashMap<String,Object> parmas) {
        return emsProdplanRoundMapper.getbeyondWeight(parmas);
    }

    @Override
    public EmsProdplanRound getSumPlanWeight(String id) {
        return emsProdplanRoundMapper.getSumPlanWeight(id);
    }

    @Override
    public String getMaxidAsGm(EmsProdplanRound emsProdplanRound) {
        return emsProdplanRoundMapper.getMaxidAsGm(emsProdplanRound);
    }

    @Override
    public String getMaxidAsSC(EmsProdplanRound emsProdplanRound) {
        return emsProdplanRoundMapper.getMaxidAsSC(emsProdplanRound);
    }

    @Override
    public List<EmsProdplanRound> getbasespecbillet() {
        return emsProdplanRoundMapper.getbasespecbillet();
    }

    @Override
    public List<EmsProdplanRound> getiateralArea() {
        return emsProdplanRoundMapper.getiateralArea();
    }

    @Override
    public List<EmsProdplanRound> getdimension() {
        return emsProdplanRoundMapper.getdimension();
    }

    @Override
    public List<EmsProdplanRound> getsurfaceStandard() {
        return emsProdplanRoundMapper.getsurfaceStandard();
    }

    @Override
    public List<EmsProdplanRound> getchemicalStandard() {
        return emsProdplanRoundMapper.getchemicalStandard();
    }

    @Override
    public PageList<Map<String, Object>> getAuditDateForPage(HashMap<String, Object> parmas, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Map<String, Object>> auditDate = emsProdplanRoundMapper.getAuditDate(parmas);
        PageList<Map<String,Object>> plist = new PageList<Map<String,Object>>(auditDate);
        return plist;
    }

    @Override
    public Integer updateAuditState(EmsProdplanRound emsProdplanRound) {
        return emsProdplanRoundMapper.updateAuditState(emsProdplanRound);
    }

    @Override
    public List<EmsProdplanRound> getRounds(EmsProdplanRound emsProdplanRound) {
        return emsProdplanRoundMapper.getRounds(emsProdplanRound);
    }

    @Override
    public  PageList<EmsProdplanRound> getTableDetailAsRadioForPage(HashMap<String, Object> hashMap, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<EmsProdplanRound> datas = emsProdplanRoundMapper.getTableDetailAsRadio(hashMap);
        PageList pageInfo = new PageList(datas);
        return pageInfo;
    }

//    public List<EmsProdplanRound> getTableDetailAsRadiForPage(Map<String, Object> parameters, Integer pageNum, Integer pageSize) {
//        PageHelper.startPage(pageNum, pageSize);
//        List<T> rows =
//        PageList pageInfo = new PageList(rows);
//        return pageInfo;
//    }
public String tostr(EmsProdplanRound model,EmsProdplanRound model2) {
    StringBuilder sb = new StringBuilder();
    sb.append("操作前的数据为:[");
    sb.append(" 轮次编号=").append(model.getId());
    sb.append(", 排产时间=").append(DateUtils.dateStr(model.getMay(),"yyyy-MM-dd"));
    sb.append(", 描述=").append(model.getDescribe());
    sb.append(", 钢种=").append(model.getGrades());
    sb.append(", 重量=").append(model.getPlanWeight());
    sb.append(", 规格=").append(model.getSpecifications());
    sb.append(", 长度=").append(model.getLengths());
    sb.append(", 化学成分执行标准=").append(model.getChemicalStandard());
    sb.append(", 表面成分执行标准=").append(model.getSurfaceStandard());
    sb.append(", 备注=").append(model.getMemo());
    sb.append(", 运输方式=").append(model.getTransportType());
    sb.append(", 用途=").append(model.getPurpose());
    sb.append("]");
    if(model2 != null){
        sb.append(",操作后的数据为:[");
        sb.append(" 轮次编号=").append(model2.getId());
        sb.append(", 排产时间=").append(DateUtils.dateStr(model2.getMay(),"yyyy-MM-dd"));
        sb.append(", 描述=").append(model2.getDescribe());
        sb.append(", 钢种=").append(model2.getGrades());
        sb.append(", 重量=").append(model2.getPlanWeight());
        sb.append(", 规格=").append(model2.getSpecifications());
        sb.append(", 长度=").append(model2.getLengths());
        sb.append(", 化学成分执行标准=").append(model2.getChemicalStandard());
        sb.append(", 表面成分执行标准=").append(model2.getSurfaceStandard());
        sb.append(", 备注=").append(model2.getMemo());
        sb.append(", 运输方式=").append(model2.getTransportType());
        sb.append(", 用途=").append(model2.getPurpose());
        sb.append("]");
    }
    return sb.toString();
}

    @Override
    public List<EmsProdplanRound> getLastIssuedData(HashMap<String, Object> params) {
        return emsProdplanRoundMapper.getLastIssuedData(params);
    }
}
