/// <summary> /// 获取两票列表 /// </summary> /// <param name="type">1:操作票;2:工作票</param> /// <param name="begin_date">格式:yyyyMMdd 默认为当天</param> /// <param name="end_date">跨度最大一个月</param> /// <returns></returns> public BaseTran <tickets> GetTicketsList(string type, string begin_date, string end_date) { BaseTran <tickets> recv = new BaseTran <tickets>(); string path = "api/tickets"; string url = BaseUri + path; QueryArg query = new QueryArg(); query.Add("type", type); query.Add("begin_date", begin_date); query.Add("end_date", end_date); url += query.GetQueryString(); recv = GetEntityList <tickets>(url); if (recv.data == null) { recv.data = new List <tickets>(); } return(recv); }
/// <summary> /// 获取两票列表 /// </summary> /// <param name="type">1:操作票;2:工作票</param> /// <param name="begin_date">格式:yyyyMMdd 默认为当天</param> /// <param name="end_date">跨度最大一个月</param> /// <returns></returns> public BaseTran <tickets> GetTicketsList(string type, string begin_date, string end_date) { BaseTran <tickets> recv = new BaseTran <tickets>(); try { string path = "api/tickets"; string url = BaseUri + path; QueryArg query = new QueryArg(); query.Add("type", type); query.Add("begin_date", begin_date); query.Add("end_date", end_date); url += query.GetQueryString(); recv = GetEntityList <tickets>(url); if (recv.data == null) { recv.data = new List <tickets>(); } foreach (tickets item in recv.data) { int nFlag = 0; if (item.type == 1) { OperationTicket ot = bll.OperationTickets.DbSet.Where(p => p.Abutment_Id == item.id).FirstOrDefault(); if (ot == null) { ot = new OperationTicket(); ot.OperationStartTime = DateTime.Now; ot.OperationEndTime = DateTime.Now.AddDays(1); nFlag = 1; } ot.Abutment_Id = item.id; ot.No = item.code; if (nFlag == 1) { bll.OperationTickets.Add(ot); } else { bll.OperationTickets.Edit(ot); } } else { WorkTicket wt = bll.WorkTickets.DbSet.Where(p => p.Abutment_Id == item.id).FirstOrDefault(); if (wt == null) { wt = new WorkTicket(); wt.StartTimeOfPlannedWork = DateTime.Now; wt.EndTimeOfPlannedWork = DateTime.Now.AddDays(1); nFlag = 1; } wt.Abutment_Id = item.id; wt.No = item.code; if (nFlag == 1) { bll.WorkTickets.Add(wt); } else { bll.WorkTickets.Edit(wt); } } } } catch (Exception ex) { string messgae = ex.Message; } return(recv); }