duan
2024-08-21 22bd5bc1ce2b49284cc2f042c7f4f48619fcf85b
提交 | 用户 | age
5e4ef3 1 using DIXWeb.DAL;
1e406e 2 using DIXWeb.Entity.GlobalM;
5e4ef3 3 using DIXWeb.Entity.Workflow;
A 4 using System;
5 using System.Collections.Generic;
955cd4 6 using System.Data;
5e4ef3 7 using System.Linq;
A 8 using System.Text;
9 using System.Threading.Tasks;
10
11 namespace DIXWeb.Business.Workflow
12 {
13     public class BillBusiness
14     {
1e406e 15         public List<BillType> GetWorkflowBillType()
A 16         {
17             List<BillType> list = null;
18             using (DBContext db = new DBContext())
19             {
20                 list = db.BillType.ToList();
21             }
22             return list;
23         }
24
5e4ef3 25         public ReceiveBill GetBillById(int BillId)
A 26         {
27             ReceiveBill record = null;
28             using (DBContext db = new DBContext())
29             {
30                 System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] {
31                     new System.Data.SqlClient.SqlParameter("@BillId", BillId),
32                 };
33                 record = db.Database.SqlQuery<ReceiveBill>("EXEC meta.p_getBillById @BillId ", paramList).FirstOrDefault();
34             }
35             return record;
36         }
1e406e 37
955cd4 38         public Receive SubmitBill(string Code, string Name, int BillTypeId, int UserId)
1e406e 39         {
A 40             Receive record = null;
41             using (DBContext db = new DBContext())
42             {
43                 System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] {
44                     new System.Data.SqlClient.SqlParameter("@Code", Code),
45                     new System.Data.SqlClient.SqlParameter("@Name", Name),
46                     new System.Data.SqlClient.SqlParameter("@BillTypeId", BillTypeId),
47                     new System.Data.SqlClient.SqlParameter("@UserId", UserId),
48                 };
49                 record = db.Database.SqlQuery<Receive>("EXEC meta.p_submitBill @Code,@Name,@BillTypeId,@UserId ", paramList).FirstOrDefault();
50             }
51             return record;
52         }
955cd4 53
40698f 54         public Receive SubmitBill(int BookId, int BillTypeId, int UserId)
955cd4 55         {
A 56             Receive record = null;
57             using (DBContext db = new DBContext())
58             {
59                 System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] {
40698f 60                     new System.Data.SqlClient.SqlParameter("@BookId", BookId),
955cd4 61                     new System.Data.SqlClient.SqlParameter("@BillTypeId", BillTypeId),
A 62                     new System.Data.SqlClient.SqlParameter("@UserId", UserId),
63                 };
40698f 64                 record = db.Database.SqlQuery<Receive>("EXEC biz.p_submitInspectBook @BookId,@BillTypeId,@UserId ", paramList).FirstOrDefault();
955cd4 65             }
A 66             return record;
67         }
68
ac2719 69
7d6280 70         public Receive ReckDataUpdateHistory(int InspectBookId,string FilterType, int rows, int page)
ac2719 71         {
A 72             int Total = 0;
73             Receive record = new Receive();
74             try
75             {
76                 using (DBContext db = new DBContext())
77                 {
78                     System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] {
79                         new System.Data.SqlClient.SqlParameter("@InspectBookId", InspectBookId),
80                         new System.Data.SqlClient.SqlParameter("@pageSize", rows),
81                         new System.Data.SqlClient.SqlParameter("@pageIndex", page),
7d6280 82                         new System.Data.SqlClient.SqlParameter("@filterType", FilterType),
ac2719 83                         new System.Data.SqlClient.SqlParameter("@Total", Total),
A 84                     };
85                     int index = paramList.Length - 1;
86                     paramList[index].Direction = ParameterDirection.Output;
7d6280 87                     record.rows = db.Database.SqlQuery<ReceiveInspectDetail>("exec biz.p_getReckDataUpdateHistory @InspectBookId,@pageSize,@pageIndex,@filterType,@Total output ", paramList).ToList();
ac2719 88                     record.total = int.Parse(paramList[index].Value.ToString());
A 89                 }
90                 record.Code = 200;
91                 record.Message = "SUCCESS";
92             }
93             catch (Exception ex)
94             {
95                 record.Code = 500;
96                 record.Message = ex.Message;
97             }
98             return record;
99         }
100
7d6280 101         public Receive ReckImgUpdateHistory(int InspectBookId,string FilterType, int rows, int page)
ac2719 102         {
A 103             int Total = 0;
104             Receive record = new Receive();
105             try
106             {
107                 using (DBContext db = new DBContext())
108                 {
109                     System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] {
110                         new System.Data.SqlClient.SqlParameter("@InspectBookId", InspectBookId),
111                         new System.Data.SqlClient.SqlParameter("@pageSize", rows),
112                         new System.Data.SqlClient.SqlParameter("@pageIndex", page),
7d6280 113                         new System.Data.SqlClient.SqlParameter("@filterType", FilterType),
ac2719 114                         new System.Data.SqlClient.SqlParameter("@Total", Total),
A 115                     };
116                     int index = paramList.Length - 1;
117                     paramList[index].Direction = ParameterDirection.Output;
7d6280 118                     record.rows = db.Database.SqlQuery<ReceiveReckImgHistory>("exec biz.p_getReckImgUpdateHistory @InspectBookId,@pageSize,@pageIndex,@filterType,@Total output ", paramList).ToList();
ac2719 119                     record.total = int.Parse(paramList[index].Value.ToString());
A 120                 }
121                 record.Code = 200;
122                 record.Message = "SUCCESS";
123             }
124             catch (Exception ex)
125             {
126                 record.Code = 500;
127                 record.Message = ex.Message;
128             }
129             return record;
130         }
131
1bf8ef 132         public Receive GetInspectBook(string InspectObjectCode, DateTime TimeBegin, DateTime TimeEnd, int Status, int rows, int page,string filterType,int UserId )
955cd4 133         {
A 134             int Total = 0;
135             Receive record = new Receive();
136             try
137             {
138                 using (DBContext db = new DBContext())
139                 {
140                     System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] {
675b00 141                         new System.Data.SqlClient.SqlParameter("@InspectObjectCode", InspectObjectCode),
955cd4 142                         new System.Data.SqlClient.SqlParameter("@TimeBegin", TimeBegin),
A 143                         new System.Data.SqlClient.SqlParameter("@TimeEnd", TimeEnd),
144                         new System.Data.SqlClient.SqlParameter("@Status", Status),
145                         new System.Data.SqlClient.SqlParameter("@pageSize", rows),
146                         new System.Data.SqlClient.SqlParameter("@pageIndex", page),
ac2719 147                         new System.Data.SqlClient.SqlParameter("@FilterType", filterType),
1bf8ef 148                         new System.Data.SqlClient.SqlParameter("@UserId", UserId),
955cd4 149                         new System.Data.SqlClient.SqlParameter("@Total", Total),
A 150                     };
40698f 151                     int index = paramList.Length - 1;
A 152                     paramList[index].Direction = ParameterDirection.Output;
1bf8ef 153                     record.rows = db.Database.SqlQuery<ReceiveInspectBook>("exec biz.p_getInspectBook @InspectObjectCode,@TimeBegin,@TimeEnd,@Status,@pageSize,@pageIndex,@FilterType,@UserId,@Total output ", paramList).ToList();
40698f 154                     record.total = int.Parse(paramList[index].Value.ToString());
955cd4 155                 }
A 156                 record.Code = 200;
157                 record.Message = "SUCCESS";
158             }
159             catch (Exception ex)
160             {
161                 record.Code = 500;
162                 record.Message = ex.Message;
163             }
164             return record;
165         }
166
7d6280 167         public Receive GetFalseInspectBook(int InspectAreaId, int InspectObjectTypeId, string InspectObjectCode, DateTime TimeBegin, DateTime TimeEnd, int rows, int page)
A 168         {
169             int Total = 0;
170             Receive record = new Receive();
171             try
172             {
173                 using (DBContext db = new DBContext())
174                 {
175                     System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] {
176                         new System.Data.SqlClient.SqlParameter("@InspectAreaId", InspectAreaId),
177                         new System.Data.SqlClient.SqlParameter("@InspectObjectTypeId", InspectObjectTypeId),
178                         new System.Data.SqlClient.SqlParameter("@InspectObjectCode", InspectObjectCode),
179                         new System.Data.SqlClient.SqlParameter("@TimeBegin", TimeBegin),
180                         new System.Data.SqlClient.SqlParameter("@TimeEnd", TimeEnd),
181                         new System.Data.SqlClient.SqlParameter("@pageSize", rows),
182                         new System.Data.SqlClient.SqlParameter("@pageIndex", page),
183                         new System.Data.SqlClient.SqlParameter("@Total", Total),
184                     };
185                     int index = paramList.Length - 1;
186                     paramList[index].Direction = ParameterDirection.Output;
187                     record.rows = db.Database.SqlQuery<ReceiveInspectBook>("exec biz.p_getFalseInspectBook @InspectAreaId,@InspectObjectTypeId,@InspectObjectCode,@TimeBegin,@TimeEnd,@pageSize,@pageIndex,@Total output ", paramList).ToList();
188                     record.total = int.Parse(paramList[index].Value.ToString());
189                 }
190                 record.Code = 200;
191                 record.Message = "SUCCESS";
192             }
193             catch (Exception ex)
194             {
195                 record.Code = 500;
196                 record.Message = ex.Message;
197             }
198             return record;
199         }
200
201
202         public Receive GetInspectDetailByBookId(int BookId,string filterType)
40698f 203         {
A 204             int Total = 0;
205             Receive record = new Receive();
206             try
207             {
208                 using (DBContext db = new DBContext())
209                 {
210                     System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] {
211                         new System.Data.SqlClient.SqlParameter("@BookId", BookId),
7d6280 212                         new System.Data.SqlClient.SqlParameter("@filterType", filterType),
40698f 213                         new System.Data.SqlClient.SqlParameter("@Total", Total),
A 214                     };
215                     int index = paramList.Length - 1;
216                     paramList[index].Direction = ParameterDirection.Output;
7d6280 217                     record.rows = db.Database.SqlQuery<ReceiveInspectDetail>("exec biz.p_getInspectDetailByBookId @BookId,@filterType,@Total output ", paramList).ToList();
238f73 218                     if (string.IsNullOrEmpty(paramList[index].Value.ToString()))
A 219                     {
220                         record.total = 0;
221                     }
222                     else
223                     {
224                         record.total = int.Parse(paramList[index].Value.ToString());
225                     }
40698f 226                 }
A 227                 record.Code = 200;
228                 record.Message = "SUCCESS";
229             }
230             catch (Exception ex)
231             {
232                 record.Code = 500;
233                 record.Message = ex.Message;
234             }
235             return record;
236         }
9057d4 237
A 238
7d6280 239         public Receive UpdateInspectReck(int InspectReckId, string InspectLimit, int Judge, string NGReason, int DealInScene, string Answer, string InspectOperator,string FilterType)
ac2719 240         {
A 241             Receive receive = new Receive();
242             try
243             {
244                 using (DBContext db = new DBContext())
245                 {
246                     System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] {
247                         new System.Data.SqlClient.SqlParameter("@InspectReckId", InspectReckId),
248                         new System.Data.SqlClient.SqlParameter("@InspectLimit", InspectLimit),
249                         new System.Data.SqlClient.SqlParameter("@Judge", Judge),
250                         new System.Data.SqlClient.SqlParameter("@NGReason", NGReason),
251                         new System.Data.SqlClient.SqlParameter("@DealInScene", DealInScene),
252                         new System.Data.SqlClient.SqlParameter("@Answer", Answer),
253                         new System.Data.SqlClient.SqlParameter("@InspectOperator", InspectOperator),
7d6280 254                         new System.Data.SqlClient.SqlParameter("@filterType", FilterType),
ac2719 255                     };
7d6280 256                     receive = db.Database.SqlQuery<Receive>("exec biz.p_updateInspectReck @InspectReckId,@InspectLimit,@Judge,@NGReason,@DealInScene,@Answer,@InspectOperator,@filterType ", paramList).FirstOrDefault();
ac2719 257                 }
A 258             }
259             catch (Exception ex)
260             {
261                 receive.Code = 500;
262                 receive.Message = ex.Message;
263             }
264             return receive;
265         }
266
7d6280 267         public Receive UpdateInspectReck(int InspectReckId, string ImgArrStr, string InspectOperator,string FilterType)
ac2719 268         {
A 269             Receive receive = new Receive();
270             try
271             {
272                 using (DBContext db = new DBContext())
273                 {
274                     System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] {
275                         new System.Data.SqlClient.SqlParameter("@InspectReckId", InspectReckId),
276                         new System.Data.SqlClient.SqlParameter("@ImgArrStr", ImgArrStr),
277                         new System.Data.SqlClient.SqlParameter("@InspectOperator", InspectOperator),
7d6280 278                         new System.Data.SqlClient.SqlParameter("@filterType", FilterType),
ac2719 279                     };
7d6280 280                     receive = db.Database.SqlQuery<Receive>("exec biz.p_updateInspectReckImg @InspectReckId,@ImgArrStr,@InspectOperator,@filterType ", paramList).FirstOrDefault();
ac2719 281                 }
A 282             }
283             catch (Exception ex)
284             {
285                 receive.Code = 500;
286                 receive.Message = ex.Message;
287             }
288             return receive;
289         }
9057d4 290         public string GetNeedDealtNumByUserCode(string UserNo)
A 291         {
292             string result = string.Empty;
293             try
294             {
295                 using (DBContext db = new DBContext())
296                 {
297                     System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] {
298                         new System.Data.SqlClient.SqlParameter("@UserCode", UserNo),
299                     };
300                     result = db.Database.SqlQuery<string>("exec biz.p_GetNeedDealtNumByUserCode @UserCode ", paramList).FirstOrDefault();
301                 }
302             }
303             catch (Exception ex)
304             {
305                 result = ex.Message;
306                 result = "";
307             }
308             return result;
309         }
310
311
5e4ef3 312     }
A 313 }