package com.dxhy.jxpt.baseService.sign.service.qsgz.impl;

import com.dxhy.api.model.config.UserInfo;
import com.dxhy.common.enums.FpztEnum;
import com.dxhy.api.model.invoice.TDxRecordInvoice;
import com.dxhy.jxpt.baseService.sign.service.qsgz.RulesService;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service("1006")
public class Rules1006ServiceImpl implements RulesService {

    @Override
    public String validationRules(UserInfo userInfo, String qsType, Map<String, String> pramsMap, TDxRecordInvoice recordInvoice, String invoiceType) {
        // 1006 发票状态校验
        //正常和部分冲红的可以签收
        if (!"0".equals(recordInvoice.getInvoiceStatus())) {
            // 发票状态异常
            String zt = "";
            for (FpztEnum e : FpztEnum.values()) {
                if (e.getFpztDm().equals(recordInvoice.getInvoiceStatus())) {
                    zt = e.getFpztMc(e.getIndex());
                }
            }
            return "非正常发票不能签收，当前的发票状态:" + zt;
        }
        return "";
    }

    @Override
    public String getEdiType() {
        return "1006";
    }
}
