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.
102 lines
3.5 KiB
C#
102 lines
3.5 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// 日志查询 内容 时间 值
|
|
/// </summary>
|
|
/// <param name="txt">查询关键字</param>
|
|
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);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 完整手动日志插入
|
|
/// </summary>
|
|
/// <param name="logName">日志内容</param>
|
|
/// <param name="value">值</param>
|
|
/// <param name="valuekind">值类型 0无 1水称设定值 2水称称量值 3螺旋设定值 4螺旋称量值</param>
|
|
/// <param name="deviceno">设备编号</param>
|
|
/// <param name="devicekind">设备类型 0无 1水称 2螺旋</param>
|
|
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();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 无数值 有设备 日志记录
|
|
/// </summary>
|
|
/// <param name="logName">日志内容</param>
|
|
/// <param name="deviceno">设备编号</param>
|
|
/// <param name="devicekind">设备类型</param>
|
|
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();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 无数值 无设备 日志记录
|
|
/// </summary>
|
|
/// <param name="logName"></param>
|
|
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();
|
|
}
|
|
}
|
|
}
|