package task

import (
	omServices "LAPP_LF_MOM_BACKEND/services/om"
	services "LAPP_LF_MOM_BACKEND/services/schedule"
)

var ApsReleaseStatus int
var feedbackFromMesTaskStatus int

func StartApsRelease() {
	if feedbackFromMesTaskStatus == 1 {
		return
	}
	if ApsReleaseStatus == 0 {
		ApsReleaseStatus = 1
		defer func() {
			ApsReleaseStatus = 0
		}()
	} else {
		return
	}
	plantNr := 100
	services.ApsRelease(plantNr)
}

/******************************************************************************
 *
 * @Struct Name              : FeedbackFromMes
 *-----------------------------------------------------------------------------
 *
 * @Description              : 从mes系统回写状态 时间等数据
 *
 * @Author                   : zhangxin
 *
 * @Date                     : 2021-05-13
 *
 ******************************************************************************/
func FeedbackFromMes() {
	if ApsReleaseStatus == 1 {
		return
	}
	if feedbackFromMesTaskStatus == 0 {
		feedbackFromMesTaskStatus = 1
		defer func() {
			feedbackFromMesTaskStatus = 0
		}()
	} else {
		return
	}
	plantNr := 100
	omServicesImpl := omServices.NewOmToMesService()
	omServicesImpl.FeedbackFromMes(plantNr)
}
