using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using Commom.Utility;
|
using Common;
|
using Model;
|
|
namespace BLL.DAL
|
{
|
public class DAL_ManualControl
|
{
|
public IList<WCSPlcInfo> GetList(AjaxPlcInfoList Json, ref PageInfo pageInfo)
|
{
|
try
|
{
|
StringBuilder strSql = new StringBuilder();
|
strSql.Append("select * from WCSPlcInfo where IsDel = 0 ");
|
|
if (!string.IsNullOrWhiteSpace(Json.Type) )
|
{
|
strSql.Append(" and Type = '" + Json.Type + "' ");
|
}
|
DataTable dt = DataFactory.SqlDataBase().GetPageList(strSql.ToString(), null, "CreateTime", "", ref pageInfo);
|
return ModelConvertHelper<WCSPlcInfo>.DataTableToModel(dt);
|
}
|
catch
|
{
|
throw new NotImplementedException();
|
}
|
}
|
|
public bool Add(TaskMonitorModel model, string loginUser)
|
{
|
bool result = false;
|
try
|
{
|
Hashtable ht = new Hashtable();
|
|
ht["TaskType"] = model.TaskType.AddQuotes();
|
ht["InitialAddre"] = "'" + model.InitialAddre + "'";
|
ht["Palno"] = "'" + model.Palno + "'";
|
ht["TargetAddre"] = "'" + model.TargetAddre + "'";
|
ht["State"] = "'0'";
|
ht["IsSucceed"] = "'" + model.IsSucceed + "'";
|
ht["ErrorStr"] = "'" + model.ErrorStr + "'";
|
ht["PriorityLevel"] = model.PriorityLevel;
|
ht["Source"] = "'手动'";
|
ht["Demo"] = "'"+ model.Demo + "'";
|
|
ht["CreateUser"] = "'" + loginUser + "'";
|
ht["CreateTime"] = "Getdate()";
|
|
|
int _ret = DataFactory.SqlDataBase().InsertByHashtableNullParam("TaskMonitor", ht);
|
|
if (_ret == 1) result = true;
|
|
return result;
|
|
}
|
catch
|
{
|
return result;
|
}
|
}
|
|
public IList<Dictionarys> GetDictionaryItems(Dictionarys dictionarys, ref PageInfo page)
|
{
|
try
|
{
|
StringBuilder stringBuilder = new StringBuilder();
|
stringBuilder.Append("select * from View_Dictionary_Userinfo where IsDel = 0 and TopCode = 'Access' ");
|
if (dictionarys.TopCode != null && dictionarys.TopCode != "")
|
{
|
stringBuilder.Append(" and TopCode = " + dictionarys.TopCode.AddQuotes());
|
}
|
if (dictionarys.TypeName != null && dictionarys.TypeName != "")
|
{
|
stringBuilder.Append(" and TypeName like '%" + dictionarys.TypeName + "%' ");
|
}
|
if (dictionarys.Guid != null && dictionarys.Guid != "")
|
{
|
stringBuilder.Append(" and Guid = " + dictionarys.Guid.AddQuotes());
|
}
|
|
SqlParam[] para = new SqlParam[]
|
{
|
};
|
|
DataTable dt = DataFactory.SqlDataBase().GetPageList(stringBuilder.ToString(), para, "TopCode", "ASC", ref page);
|
IList<Dictionarys> list = ModelConvertHelper<Dictionarys>.DataTableToModel(dt);
|
|
return list;
|
}
|
catch
|
{
|
throw new NotImplementedException();
|
}
|
}
|
|
public bool IsAutoUpdate(string[] Code)
|
{
|
bool result = false;
|
try
|
{
|
string[] str = { "WCSAuto" };
|
int dt = DataFactory.SqlDataBase().IsExist("Dictionary", "TopCode", str);
|
if (dt >= Code.Length)
|
{
|
int i = 0;
|
while (i < Code.Length)
|
{
|
StringBuilder sql = new StringBuilder();
|
sql.Append("update Dictionary set Code='" + Code[i] + "' where TopCode='WCSAuto'");
|
int _ret = DataFactory.SqlDataBase().ExecuteBySql(sql);
|
if (_ret >= Code.Length) result = true;
|
i++;
|
}
|
|
}
|
return result;
|
|
}
|
catch
|
{
|
return result;
|
}
|
}
|
}
|
}
|