You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#region << 版 本 注 释 >>
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
|
* 版权所有 (c) 2025 WenJY 保留所有权利。
|
|
|
|
|
* CLR版本:4.0.30319.42000
|
|
|
|
|
* 机器名称:Mr.Wen's MacBook Pro
|
|
|
|
|
* 命名空间:Sln.Iot.Repository.service.Impl
|
|
|
|
|
* 唯一标识:83CD1830-F4B4-49D3-A5A6-A5932F8AD185
|
|
|
|
|
*
|
|
|
|
|
* 创建者:WenJY
|
|
|
|
|
* 电子邮箱:
|
|
|
|
|
* 创建时间:2025-05-27 14:06:04
|
|
|
|
|
* 版本:V1.0.0
|
|
|
|
|
* 描述:
|
|
|
|
|
*
|
|
|
|
|
*--------------------------------------------------------------------
|
|
|
|
|
* 修改人:
|
|
|
|
|
* 时间:
|
|
|
|
|
* 修改说明:
|
|
|
|
|
*
|
|
|
|
|
* 版本:V1.0.0
|
|
|
|
|
*--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#endregion << 版 本 注 释 >>
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Linq.Expressions;
|
|
|
|
|
using Sln.Iot.Model.dao;
|
|
|
|
|
using Sln.Iot.Repository.service.@base;
|
|
|
|
|
|
|
|
|
|
namespace Sln.Iot.Repository.service.Impl
|
|
|
|
|
{
|
|
|
|
|
public class DeviceRecordServiceImpl: BaseServiceImpl<DeviceRecord>, IDeviceRecordService
|
|
|
|
|
{
|
|
|
|
|
public DeviceRecordServiceImpl(Repository<DeviceRecord> rep) : base(rep)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool UpdateCloseTime(DeviceRecord deviceRecord, out List<long> resIds)
|
|
|
|
|
{
|
|
|
|
|
resIds = new List<long>();
|
|
|
|
|
|
|
|
|
|
var info = _rep.GetList(x=> x.deviceCode == deviceRecord.deviceCode && x.useState == '1').FirstOrDefault();
|
|
|
|
|
if (info != null)
|
|
|
|
|
{
|
|
|
|
|
resIds.Add(info.objid);
|
|
|
|
|
info.closeTime = deviceRecord.closeTime;
|
|
|
|
|
info.useState = deviceRecord.useState;
|
|
|
|
|
info.useTime = CalculateHoursDifference(info.openTime, deviceRecord.closeTime);
|
|
|
|
|
_rep.Update(info);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private decimal CalculateHoursDifference(DateTime startTime, DateTime endTime)
|
|
|
|
|
{
|
|
|
|
|
TimeSpan duration = endTime - startTime;
|
|
|
|
|
return Convert.ToDecimal(duration.TotalHours);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|