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.

56 lines
1.8 KiB
C#

using ATC_MaterialBind.Entity;
using Models;
using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace SlnMesnac.Repository.service.Impl
{
public class Real_workdataServiceImpl : BaseServiceImpl<Real_workdata>, IReal_workdataService
{
public Real_workdataServiceImpl(Repository<Real_workdata> repository):base(repository)
{
}
public async Task<bool> AddAsync(Real_workdata record)
{
var newDb = _rep.CopyNew();
bool result = await newDb.InsertAsync(record);
return result;
}
public List<DeviceInfo> GetDeviceInfos()
{
List<DeviceInfo> taskInfos = null;
try
{
String sql = "select t1.connectstr, t2.combineid,t1.addr,t3.port from base_device_info t1 left join [dbo].[base_sensor_info] t2 on t1.deviceid = t2.deviceid left join [dbo].[base_collect_info] t3 on t1.collectid = t3.collectId where t1.deleteflag != 1 ";
taskInfos = base._rep.AsTenant().GetConnection("mes").Ado.SqlQuery<DeviceInfo>(sql);
}
catch (Exception ex)
{
}
return taskInfos;
}
public string GetPort(string collectid)
{
string port = "9880";
try
{
List<DeviceInfo> device = new List<DeviceInfo>();
String sql = " SELECT [port] FROM [WLDB].[dbo].[base_collect_info] where deleteflag != 1 and collectId = "+ collectid;
device = base._rep.AsTenant().GetConnection("mes").Ado.SqlQuery<DeviceInfo>(sql);
return device[0].port;
}
catch (Exception ex)
{
return port;
}
}
}
}