/// <summary> /// 获取有作业的设备信息 /// </summary> /// <returns></returns> public async Task <JsonResult> GetDeviceTaskLst() { List <DeviceTaskDetail> detailLst = new List <DeviceTaskDetail>(); List <Device> hasTask = await new CWDevice().FindListAsync(dv => dv.TaskID != 0); CWTask cwtask = new CWTask(); foreach (Device dev in hasTask) { ImplementTask itask = await cwtask.FindAsync(dev.TaskID); if (itask != null) { string desp = dev.Warehouse.ToString() + dev.DeviceCode.ToString(); string type = PlusCvt.ConvertTaskType(itask.Type); string status = PlusCvt.ConvertTaskStatus(itask.Status, itask.SendStatusDetail); DeviceTaskDetail detail = new DeviceTaskDetail { DevDescp = desp, TaskType = type, Status = status, Proof = itask.ICCardCode }; detailLst.Add(detail); } } return(Json(detailLst, JsonRequestBehavior.AllowGet)); }
/// <summary> /// /// </summary> /// <param name="tID"></param> /// <returns></returns> public ActionResult GetTaskDetailByID(int ID) { ImplementTask itask = new CWTask().Find(tsk => tsk.ID == ID); DisplayITask dtask = new DisplayITask(); if (itask != null) { dtask = new DisplayITask { ID = itask.ID, Warehouse = itask.Warehouse, DeviceCode = itask.DeviceCode, Type = PlusCvt.ConvertTaskType(itask.Type), Status = PlusCvt.ConvertTaskStatus(itask.Status, itask.SendStatusDetail), SendStatusDetail = PlusCvt.ConvertSendStateDetail(itask.SendStatusDetail), CreateDate = itask.CreateDate.ToString(), SendDtime = itask.SendDtime.ToString(), HallCode = itask.HallCode, FromLctAddress = itask.FromLctAddress, ToLctAddress = itask.ToLctAddress, ICCardCode = itask.ICCardCode, Distance = itask.Distance, CarSize = itask.CarSize, CarWeight = itask.CarWeight }; } return(Json(dtask, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 推送执行作业信息 /// </summary> /// <param name="itask"></param> private void FileWatch_IMPTaskWatchEvent(int type, ImplementTask itask) { #region 给页面显示处理 string desp = itask.Warehouse.ToString() + itask.DeviceCode.ToString(); string ctype = PlusCvt.ConvertTaskType(itask.Type); string status = PlusCvt.ConvertTaskStatus(itask.Status, itask.SendStatusDetail); DeviceTaskDetail detail = new DeviceTaskDetail { DevDescp = desp, TaskType = ctype, Status = status, Proof = itask.ICCardCode }; //作业要删除时 if (type == 3) { detail.TaskType = ""; detail.Status = ""; detail.Proof = ""; } //给界面用 Clients.All.feedbackImpTask(detail); #endregion }
public JsonResult GetTaskList(int?pageSize, int?pageIndex, string sortOrder, string sortName) { Page <ImplementTask> page = new Page <ImplementTask>(); if (pageSize != null) { page.PageSize = (int)pageSize; } if (pageIndex != null) { page.PageIndex = (int)pageIndex; } OrderParam orderParam = null; if (!string.IsNullOrEmpty(sortName)) { orderParam = new OrderParam(); orderParam.PropertyName = sortName; if (!string.IsNullOrEmpty(sortOrder)) { orderParam.Method = sortOrder.ToLower() == "asc" ? OrderMethod.Asc : OrderMethod.Desc; } else { orderParam.Method = OrderMethod.Asc; } } Page <ImplementTask> pageTask = new CWTask().FindPageList(page, orderParam); List <DisplayITask> dispTaskLst = new List <DisplayITask>(); foreach (ImplementTask itask in pageTask.ItemLists) { DisplayITask dtask = new DisplayITask { ID = itask.ID, Warehouse = itask.Warehouse, DeviceCode = itask.DeviceCode, Type = PlusCvt.ConvertTaskType(itask.Type), Status = PlusCvt.ConvertTaskStatus(itask.Status, itask.SendStatusDetail), SendStatusDetail = PlusCvt.ConvertSendStateDetail(itask.SendStatusDetail), CreateDate = itask.CreateDate.ToString(), SendDtime = itask.SendDtime.ToString(), HallCode = itask.HallCode, FromLctAddress = itask.FromLctAddress, ToLctAddress = itask.ToLctAddress, ICCardCode = itask.ICCardCode, Distance = itask.Distance, CarSize = itask.CarSize, CarWeight = itask.CarWeight }; dispTaskLst.Add(dtask); } int rcdNum = pageTask.TotalNumber; var data = new { total = pageTask.TotalNumber, rows = dispTaskLst }; return(Json(data)); }