using Mesnac.Action.ChemicalWeighing.FreeDb; using Mesnac.Action.ChemicalWeighing.LjMaterial; using Mesnac.Basic; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Mesnac.Action.ChemicalWeighing.ManualControl { public class LjManualLog { /// /// 日志查询 内容 时间 值 /// /// 查询关键字 public static DataTable ManualLogSelect(string txt) { string sql = "select top 500 id, logtext, logtime, value from Manual_Log "; if (!string.IsNullOrEmpty(txt)) { sql += $" where logtext like '%{txt}%'"; } sql += " order by id desc"; return DBHelp.GetTable(sql); } /// /// 完整手动日志插入 /// /// 日志内容 /// 值 /// 值类型 0无 1水称设定值 2水称称量值 3螺旋设定值 4螺旋称量值 /// 设备编号 /// 设备类型 0无 1水称 2螺旋 public static void ManualLogControl(string logName, int value, int valuekind, int deviceno, int devicekind) { var Log = new ManualLogEntity() { logtext = logName, logtime = DateTime.Now, userid = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName, value = value, deviceno = deviceno, devicekind = devicekind, valuekind = valuekind, createdate = DateTime.Now.ToString("yyyyMMdd") }; FreeSqlUnit.Instance.Insert(Log).ExecuteIdentity(); } /// /// 无数值 有设备 日志记录 /// /// 日志内容 /// 设备编号 /// 设备类型 public static void ManualLogControl(string logName, int deviceno, int devicekind) { var Log = new ManualLogEntity() { logtext = logName, logtime = DateTime.Now, userid = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName, value = 0, deviceno = deviceno, devicekind = devicekind, valuekind = 0, createdate = DateTime.Now.ToString("yyyyMMdd") }; FreeSqlUnit.Instance.Insert(Log).ExecuteIdentity(); } /// /// 无数值 无设备 日志记录 /// /// public static void ManualLogControl(string logName) { var Log = new ManualLogEntity() { logtext = logName, logtime = DateTime.Now, userid = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName, value = 0, deviceno = 0, devicekind = 0, valuekind = 0, createdate = DateTime.Now.ToString("yyyyMMdd") }; FreeSqlUnit.Instance.Insert(Log).ExecuteIdentity(); } } }