package com.sw.mes.sap.verify.closeOrderState;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.sw.mes.sap.dto.jip.JipCloseOrderVerifyResult;
import com.sw.mes.sap.service.ReportSapGoodsmvtService;
import com.sw.mes.sap.verify.VerifyWorkOrderState;

/**
 * 冲销数据格式验证
 * 1
 * @author liru
 * @date 2024-04-17
 */
@Component("chargeOffMengeVerify")
public class ChargeOffMengeVerify implements VerifyWorkOrderState {

	@Autowired
	private ReportSapGoodsmvtService reportSapGoodsmvtService;

	@Override
	public void executeVerify(JipCloseOrderVerifyResult result, String AUFNR, String WERKS) {
		Long count = reportSapGoodsmvtService.getChargeOffMengeCount(AUFNR);
		if(null != count && count>0) {
			result.setStatus(false);
            result.setMsg("工单["+AUFNR+"]存在冲销记录数量为正数数据,不允许关单");
		}
	}
}
