Esempio n. 1
0
        //插入命令历史记录
        private void InsertBreakOilHistoryRecord(EGPSCurrentInfo info, string tenantCode, string userCode,
            EnumOilCommandType commandType)
        {
            #region create entity
            EBreakOilHistoryRecord history = new EBreakOilHistoryRecord();
            history.ACC = info.ACCState;
            history.AntennaState = info.AntennaState;

            history.CommandType = (int)commandType;
            history.GPSCode = info.GPSCode;
            history.IsBreakOil = commandType == EnumOilCommandType.BreakOil ? true : false;

            history.Latitude = info.Latitude;
            history.Longitude = info.Longitude;

            history.OilState = info.OilState;
            history.RecordID = Guid.NewGuid();

            history.SerialNumber = Guid.NewGuid();
            history.SetTime = DateTime.Now;
            history.Speed = info.Speed;

            history.TenantCode = tenantCode;
            history.UserCode = userCode;
            history.VehicleCode = info.VehicleCode;
            #endregion

            BreakOilHistoryManager breakOilHistoryMgr = new BreakOilHistoryManager();
            breakOilHistoryMgr.Add(history);

            BreakOilLastRecordManager breakOilLastRecordMgr = new BreakOilLastRecordManager();
            EBreakOilLastRecord lastRecord = breakOilLastRecordMgr.Exists(history.VehicleCode);
            if (lastRecord == null)
            {
                lastRecord = new EBreakOilLastRecord();
                lastRecord.VehicleCode = history.VehicleCode;
                lastRecord.BreakOilHistoryRecord = history;
                breakOilLastRecordMgr.Add(lastRecord);
            }
            else
            {
                lastRecord.BreakOilHistoryRecord = history;
                breakOilLastRecordMgr.Update(lastRecord);
            }

            breakOilLastRecordMgr.VehicleControl(info.GPSCode, commandType, history.SerialNumber);
        }
Esempio n. 2
0
 public List<BreakOilHistoryRecordVM> SearchBreakOilHistory(Guid vehicleCode, int pageSize)
 {
     try
     {
         BreakOilHistoryManager mgr = new BreakOilHistoryManager();
         IList<EBreakOilHistoryRecord> list = mgr.Search(vehicleCode, pageSize);
         return ConvertHelper.ConvertList<EBreakOilHistoryRecord, BreakOilHistoryRecordVM>(list.ToList());
     }
     catch (Exception ex)
     {
         Logger.Error(ex.Message, ex);
         return null;
     }
 }