Bill.cs
2.55 KB
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
using HHWCS.Model;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HHWCS.Bill
{
public class Bill
{
public static List<TaskEntity> getTasks(string status,string taskNo,string pallet,DateTime? beginTime ,DateTime? endTime)
{
String sql = "select * from task where 1=1 ";
if (!String.IsNullOrEmpty(status))
{
sql += " and status = '" + status + "'";
}
if (!String.IsNullOrEmpty(taskNo))
{
sql += " and id = " + taskNo;
}
if (!String.IsNullOrEmpty(pallet))
{
sql += " and containerCode = '" + pallet + "'";
}
if (beginTime != null)
{
sql += " and created>='" + beginTime.ToString()+"'";
}
if (endTime != null)
{
sql += " and created<='" + endTime.ToString()+"'";
}
DataSet ds = MySqlHelper.ExecuteDataset(AppCommon.MysqlConnection, sql);
if (ds == null || ds.Tables.Count == 0)
{
return null;
}
return ds.Tables[0].AsEnumerable().Select(x => new TaskEntity {
Id = (int)x["id"],
WarehouseId = Convert.ToInt32(x["warehouseId"]),
WarehouseCode = x["warehouseCode"]?.ToString(),
CompanyId = x["companyId"] is DBNull?null:(int?)x["companyId"],
Priority = Convert.ToInt32(x["priority"]),
Type = Convert.ToInt32(x["type"]),
Station = x["station"] is DBNull ? null : (int?)x["station"],
ContainerId = x["containerId"] is DBNull ? null : (int?)x["containerId"],
ContainerCode = x["containerCode"]?.ToString(),
SourceLocation = x["sourceLocation"]?.ToString(),
DestinationLocation = x["destinationLocation"]?.ToString(),
Status = Convert.ToInt32(x["status"]),
Created = x["created"] is DBNull ? null:(DateTime?)x["created"],
CreatedBy = x["createdBy"]?.ToString(),
BeginTime =x["beginTime"] is DBNull?null:(DateTime?)x["beginTime"],
EndTime =x["endTime"] is DBNull ? null : (DateTime?)x["endTime"],
LastUpdated=x["lastUpdated"] is DBNull ? null : (DateTime?)x["lastUpdated"],
}).OrderByDescending(t=>t.Created).ToList();
}
}
}