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, IReal_workdataService { public Real_workdataServiceImpl(Repository repository):base(repository) { } public async Task AddAsync(Real_workdata record) { var newDb = _rep.CopyNew(); bool result = await newDb.InsertAsync(record); return result; } public List GetDeviceInfos() { List 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(sql); } catch (Exception ex) { } return taskInfos; } public string GetPort(string collectid) { string port = "9880"; try { List device = new List(); String sql = " SELECT [port] FROM [WLDB].[dbo].[base_collect_info] where deleteflag != 1 and collectId = "+ collectid; device = base._rep.AsTenant().GetConnection("mes").Ado.SqlQuery(sql); return device[0].port; } catch (Exception ex) { return port; } } } }