package nc.bs.mmpac.pmo.pac0002.bp.rule;


import nc.bs.logging.Log;
import nc.bs.mmpac.pmo.pac0002.bp.rule.util.SyncEpicMesUtil;
import nc.impl.pubapp.pattern.rule.IRule;
import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
import nc.vo.scmpub.util.ArrayUtil;

/**
 * 流程生产订单审批后推送艾普MES
 *
 * @author mzr
 * @date 2025/7/3
 */
public class AfterApproveSyncEpicMesRule implements IRule<PMOAggVO> {

    private static final String LOG_INFO_NAME = "dldzlog";

    private static final Log logDl = Log.getInstance(LOG_INFO_NAME);

    @Override
    public void process(PMOAggVO[] pmoAggVOS) {
        if (ArrayUtil.isEmpty(pmoAggVOS)) {
            return;
        }
        try {
            SyncEpicMesUtil mesUtil = new SyncEpicMesUtil();
            mesUtil.processData(pmoAggVOS, "Y");
        } catch (Exception e) {
            logDl.error("同步生产订单到艾普MES系统失败: " + e.getMessage(), e);
            ExceptionUtils.wrappException(e);
        }
    }


}
