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

import com.dxhy.common.enums.FpztEnum;
import com.dxhy.common.vo.UserInfo;
import com.dxhy.sign.entity.TDxRecordInvoice;
import com.dxhy.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";
    }
}
