using Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StorageMeterSystem
{
    public class EventDb
    {
        public string baseSpotNo = "";
        Log l = Log.GetInstance();
        public void EventData(object o, StorageCollectModel e) 
        {
            //这里每隔0.5秒执行一次
            try
            {
                if (PbStorageCache.sportInfo != null && PbStorageCache.sportInfo.baseSpotNo == baseSpotNo)
                {
                    PbStorageCache.collect = e;
                }
                foreach (StorageCollectModel model in PbStorageCache.ltCollect) 
                {
                    if (model.pointid == baseSpotNo) 
                    {
                        model.mainWgt = e.mainWgt;
                        model.viceWgt = e.viceWgt;
                        model.datetime = e.datetime;
                        model.mainWeightStatus = e.mainWeightStatus;
                        model.pointid = baseSpotNo;
                        model.voiceWeightStatus = e.voiceWeightStatus;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                l.WriteLog(0, "frmMeterMain.EventData异常7：" + ex.Message);
            }
        }
    }
}
