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;

/**
 * 计划外上报验证
 * 
 * @author liru
 * @date 2024-04-17
 */
@Component("rsnumVerify")
public class RsnumVerify implements VerifyWorkOrderState {

	@Autowired
	private ReportSapGoodsmvtService reportSapGoodsmvtService;

	@Override
	public void executeVerify(JipCloseOrderVerifyResult result, String AUFNR, String WERKS) {
		Long count = reportSapGoodsmvtService.getRsnumNullCount(AUFNR);
		if(null != count && count>0) {
			result.setStatus(false);
            result.setMsg("工单["+AUFNR+"]存在计划外上报记录,不允许关单");
		}
	}
}
