wxw
2025-05-12 c2dc3bd2569f8398e2710aca2685bb3115c77eb0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
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;
            }
        }
    }
}