/// <summary> /// 获取工单详情 /// </summary> /// <param name="OrderID">工单ID</param> /// <returns></returns> public ActionResult LoadOrderInfo(int OrderID) { string strJson = "error"; string sessionid = ""; if (Request.Cookies["sid"] != null) { sessionid = Request.Cookies["sid"].Value; if (Session[sessionid] != null) { t_PM_Order order = bll.t_PM_Order.Where(o => o.OrderID == OrderID).First(); if (order != null) { strJson = Common.JsonDataInfo(order); //修改工单状态,已领取 if (order.OrderState == 0) { order.OrderState = 1; order.AcceptedDate = DateTime.Now; bll.ObjectStateManager.ChangeObjectState(order, EntityState.Modified); bll.SaveChanges(); } } } } return(Content(strJson)); }
public OrderDetail(t_PM_Order order, t_CM_PDRInfo t_CM_PDRInfo, t_CM_Unit t_CM_Unit, IDAO.Models.t_CM_UserInfo user, List <t_cm_files> listFiles) { // TODO: Complete member initialization addr = t_CM_PDRInfo.Position; all = t_CM_PDRInfo.CapTotal.ToString(); check_content = order.OrderContent; check_info = order.CheckInfo; check_man = order.UserName; order_id = order.OrderID.ToString(); company = t_CM_PDRInfo.CompanyName; connect_man = t_CM_Unit.LinkMan; tel = t_CM_Unit.LinkMobile; count = t_CM_PDRInfo.Transformers.ToString(); finish_time = order.CheckDate.ToString(); first_arrived = order.FistDate.ToString(); lv = t_CM_PDRInfo.Vlevel; name = order.PName; order_name = order.OrderName; print_time = DateTime.Now.ToString(); received_time = order.AcceptedDate.ToString(); send_time = order.CreateDate.ToString(); handle_result = order.IsQualified == 1 ? "已完成作业" : "未完成作业"; title = order.OrderType + "报告"; this.listFiles = listFiles; }
public UnOrderDetail(t_PM_Order order, t_CM_PDRInfo t_CM_PDRInfo, string tel, List <Template> list) { address = t_CM_PDRInfo.Position; name = t_CM_PDRInfo.CompanyName; release_time = order.CreateDate.ToString(); title = order.OrderName; until_time = order.PlanDate.ToString(); work_content = order.OrderContent; FistDate = order.FistDate.ToString(); RejectReason = order.RejectReason; work_man = order.UserName; order_id = order.OrderID; status = (int)order.OrderState; this.tel = tel; this.list = list; string s = t_CM_PDRInfo.Coordination; string[] sArray = s.Split('|'); try { rLongtitude = sArray[0]; rLatitude = sArray[1]; } catch (Exception e) { } }
public ActionResult LoadOrder(int OrderID) { string strJson = "error"; t_PM_Order order = bll.t_PM_Order.Where(o => o.OrderID == OrderID).First(); if (order != null) { strJson = JsonConvert.SerializeObject(order); } return(Content(strJson)); }
/// <summary> /// 保存工单信息 /// </summary> /// <param name="order">工单详情</param> /// <returns></returns> public ActionResult SaveOrderInfo(t_PM_Order order) { string result = "成功"; string sessionid = ""; if (Request.Cookies["sid"] != null)//如果没有 { sessionid = Request.Cookies["sid"].Value; if (Session[sessionid] != null) { try { List <t_PM_Order> list = bll.t_PM_Order.Where(o => o.OrderID == order.OrderID).ToList(); if (list.Count > 0) { t_PM_Order orderinfo = list[0]; orderinfo.IsQualified = order.IsQualified; orderinfo.CheckDate = DateTime.Now; orderinfo.Rectification = order.Rectification; orderinfo.CheckInfo = order.CheckInfo; orderinfo.OrderState = 2;//1未处理,2处理完成 orderinfo.Latitude = order.Latitude; orderinfo.Longtitude = order.Longtitude; orderinfo.Currentplace = order.Currentplace; bll.ObjectStateManager.ChangeObjectState(orderinfo, EntityState.Modified); bll.SaveChanges(); } else { result = "源工单不存在!"; } } catch (Exception ex) { result = ex.ToString(); } } else { result = "未登录"; } } else { result = "未登录"; } return(Content(result)); }
public UnOrderDetail3(List <OrderInfo> infos, t_PM_Order order, t_CM_PDRInfo t_CM_PDRInfo, string tel) { mInfos = new List <OrderInfo4>(); List <OrderInfo> element = null; string title = ""; // string sTemplateBlock2Old = "", sTemplateBlock2New = ""; for (int i = 0; i < infos.Count; i++) { if (title != infos[i].templateBlock) { if (element != null && title != "") { OrderInfo4 map = new OrderInfo4(title, element); mInfos.Add(map); } title = infos[i].templateBlock; element = new List <OrderInfo>(); } // sTemplateBlock2New = infos[i].templateBlock2 == null ? "" : infos[i].templateBlock2; if (sTemplateBlock2New.Equals(sTemplateBlock2Old)) { infos[i].templateBlock2 = ""; } else { sTemplateBlock2Old = sTemplateBlock2New; } // element.Add(infos[i]); if (i == infos.Count - 1) { OrderInfo4 map = new OrderInfo4(title, element); mInfos.Add(map); } } }
public ActionResult getOrderDetail(int orderid) { string strJson = ""; try { StringBuilder sbOrder = new StringBuilder(); List <t_PM_Order> list = bll.t_PM_Order.Where(o => o.OrderID == orderid).ToList(); if (list.Count > 0) { t_PM_Order order = list[0]; sbOrder.Append("<table cellpadding=\"\" cellspacing=\"\" border=\"0\" class=\"d_list\" style=\"font-size: 12px;\">"); sbOrder.Append("<tr><td class=\"d_l_t\"=>工单名称</td><td class=\"d_l_d\">"); sbOrder.Append(order.OrderName + "</td><td class=\"d_l_t\">站室</td><td class=\"d_l_d\">"); sbOrder.Append(order.PName + "</td><td class=\"d_l_t\" >优先级</td><td class=\"d_l_d\" >"); sbOrder.Append(getPriority((int)order.Priority)); sbOrder.Append("</td></tr>"); sbOrder.Append("<tr><td class=\"d_l_t\">关联隐患</td><td class=\"d_l_d\">" + order.BugInfo + "</td><td class=\"d_l_t\">工单类型</td><td class=\"d_l_d\">" + order.OrderType + "</td><td class=\"d_l_t\">派单人</td><td class=\"d_l_d\">" + order.Creater + "</td></tr>"); sbOrder.Append("<tr><td class=\"d_l_t\">派单时间</td><td class=\"d_l_d\">" + order.CreateDate + "</td><td class=\"d_l_t\">接收时间</td><td class=\"d_l_d\">" + order.AcceptedDate + "</td><td class=\"d_l_t\">到场时间</td><td class=\"d_l_d\">" + order.FistDate + "</td></tr>"); sbOrder.Append("<tr><td class=\"d_l_t\">检查人</td><td class=\"d_l_d\">"); sbOrder.Append(order.UserName); sbOrder.Append("</td><td class=\"d_l_t\">执行日期</td><td class=\"d_l_d\">"); sbOrder.Append(order.PlanDate == null ? "" : Convert.ToDateTime(order.PlanDate).ToString("yyyy-MM-dd")); sbOrder.Append(" </td><td class=\"d_l_t\">完成日期</td><td class=\"d_l_d\">"); sbOrder.Append(order.CheckDate == null ? "" : Convert.ToDateTime(order.CheckDate).ToString("yyyy-MM-dd")); sbOrder.Append("</td></tr><tr><td class=\"d_l_t\">工单内容</td><td class=\"d_l_d\" colspan=\"5\">"); sbOrder.Append(order.OrderContent); if (order.RejectReason != null && order.OrderState == 5) { sbOrder.Append("</td></tr><tr><td class=\"d_l_t\">工单状态</td><td class=\"d_l_d\" colspan=\"5\">"); sbOrder.Append("<b style='color:red;'>已被拒绝,请及时处理!" + "</b>" + " 拒绝理由:" + order.RejectReason); } sbOrder.Append("</td></tr><tr><td class=\"d_l_t\">进场申请</td><td class=\"d_l_d\" colspan=\"5\">"); sbOrder.Append("申请图片:" + getOrderFile(orderid, "image", "Apply")); sbOrder.Append("<br>申请说明:" + order.ApplyInfo); sbOrder.Append("<br>申请时间:" + order.ApplyDate); sbOrder.Append(order.OrderState != 2 ? "" : "<br><div style=\"height:10px\"></div><a href=\"#\" class=\"easyui-linkbutton\" data-options=\"iconCls:'icon-cancel'\" onclick=\"ApplyEnter('" + orderid.ToString() + "');\">点击这里【批准进场】</a><br><div style=\"height:10px\"></div><a href=\"#\" class=\"easyui-linkbutton\" data-options=\"iconCls:'icon-cancel'\" onclick=\"rejectEnter('" + orderid.ToString() + "');\">点击这里【不准进场】</a><input id=\"reason\" style=\"width: 98%\" type=\"text\" placeholder=\"请输入拒绝原因\"><div id=\"ApplyEnterInfo\"></div><div id=\"rejectEnterInfo\"></div>"); sbOrder.Append("</td></tr><tr><td class=\"d_l_t\">完成情况</td><td class=\"d_l_d\" colspan=\"5\">"); sbOrder.Append(order.CheckInfo); sbOrder.Append("</td></tr><tr><td class=\"d_l_t\">图像列表</td><td class=\"d_l_d\" colspan=\"5\">"); //图片列表 sbOrder.Append(getOrderFile(orderid, "image", "order")); sbOrder.Append("</td></tr>"); //音频 sbOrder.Append("<tr><td class=\"d_l_t\">音频列表</td><td class=\"d_l_d\" colspan=\"5\">"); sbOrder.Append(getOrderFile(orderid, "voice", "order")); sbOrder.Append("</td></tr>"); //视频 sbOrder.Append("<tr><td class=\"d_l_t\">视频列表</td><td class=\"d_l_d\" colspan=\"5\">"); sbOrder.Append(getOrderFile(orderid, "infrared", "order")); sbOrder.Append("</td></tr>"); if (order.CheckDate != null) { sbOrder.Append("<tr><td class=\"d_l_t\">处理结果</td>"); sbOrder.Append(isQualified(order.IsQualified, order.Rectification)); } sbOrder.Append("<tr><td class=\"d_l_t\">备注</td><td class=\"d_l_d\" colspan=\"5\">"); sbOrder.Append(order.Remarks + "</td></tr>"); sbOrder.Append("<tr><td class=\"d_l_t\">工单报告</td><td class=\"d_l_d\" colspan=\"5\">"); sbOrder.Append(getOrderFile(orderid, "doc", "order") + "</td></tr>"); sbOrder.Append("<tr><td class=\"d_l_t\">格式报告</td><td class=\"d_l_d\" colspan=\"5\">"); sbOrder.Append(getOrderFile(orderid, "doc", "report") + "</td></tr></table>"); strJson = sbOrder.ToString(); } } catch (Exception ex) { strJson = ""; } return(Content(strJson)); }
public ActionResult SaveOrder_templateList(int CtrOrderId, t_PM_Order order, FormCollection collection) { //string content = collection["OrderContent"].ToString(); string result = "OK"; try { if (order.OrderID > 0) { t_PM_Order orderinfo = bll.t_PM_Order.Where(o => o.OrderID == order.OrderID).First(); orderinfo.OrderContent = Common.ReplaceEnter(order.OrderContent); orderinfo.OrderNO = order.OrderNO; orderinfo.PID = order.PID; orderinfo.PlanDate = order.PlanDate; orderinfo.CtrPlanDate = order.CtrPlanDate; orderinfo.PName = order.PName; orderinfo.Priority = order.Priority; orderinfo.Remarks = Common.ReplaceEnter(order.Remarks); orderinfo.UserID = order.UserID; orderinfo.OrderState = 0; if (orderinfo.UserName != order.UserName) { UtilsSms.smsOrderCancel(orderinfo.UserName, orderinfo.OrderName, bll); } orderinfo.UserName = order.UserName; orderinfo.BugID = order.BugID; orderinfo.BugInfo = order.BugInfo; orderinfo.OrderType = order.OrderType; orderinfo.OrderName = order.OrderName; orderinfo.DressCodeID = order.DressCodeID; bll.ObjectStateManager.ChangeObjectState(orderinfo, EntityState.Modified); bll.SaveChanges(); //发送短信; UtilsSms.smsOrderAdd(order.UserName, order.OrderName, bll); // if (orderinfo.sTemplateIDs != order.sTemplateIDs || orderinfo.sTemplateCount != order.sTemplateCount) { //delete date //删除工单 string strsql = "delete from t_PM_Order_Info where OrderID = " + order.OrderID; int docount = bll.ExecuteStoreCommand(strsql, null); // if (!string.IsNullOrEmpty(order.sTemplateIDs) && !string.IsNullOrEmpty(order.sTemplateCount)) { string[] sTemplateIDsArry = order.sTemplateIDs.Split(','); string[] sTemplateCountArry = order.sTemplateCount.Split(','); if (sTemplateIDsArry.Length > 0 && sTemplateIDsArry.Length == sTemplateCountArry.Length) { for (int i = 0; i < sTemplateIDsArry.Length; i++) { //result = DeleteInfo(int.Parse(sTemplateIDsArry[i].Trim())); t_PM_Order_Info Order_Info = new t_PM_Order_Info(); Order_Info.orderId = order.OrderID; Order_Info.templateId = int.Parse((sTemplateIDsArry[i])); Order_Info.deviceCount = int.Parse((sTemplateCountArry[i])); Order_Info.unCount = Order_Info.deviceCount; bll.t_PM_Order_Info.AddObject(Order_Info); bll.SaveChanges(); } } } } Common.InsertLog("工单管理", CurrentUser.UserName, "编辑工单信息[" + order.OrderNO + "]");//log } else { order.OrderState = 0; //0待接收 1已受理 2已完成 order.IsQualified = -1; //-1 未检查 0不合格 1合格 order.CreateDate = DateTime.Now; order.Creater = CurrentUser.UserName; order.OrderContent = order.OrderContent.Replace("\n", "<br>"); int iOrderTypeId = 1; if (order.OrderType.Equals("日常巡检")) { iOrderTypeId = 3; } if (order.OrderType.Equals("检修试验")) { iOrderTypeId = 2; } if (order.OrderType.Equals("应急抢修")) { iOrderTypeId = 1; } order.OrderTypeId = iOrderTypeId; bll.t_PM_Order.AddObject(order); bll.SaveChanges(); if (CtrOrderId > 0) { t_PM_Order order2 = bll.t_PM_Order.ToList().Last(); updateCstrOrder(CtrOrderId, order2.OrderID); } if (!string.IsNullOrEmpty(order.sTemplateIDs) && !string.IsNullOrEmpty(order.sTemplateCount)) { string[] sTemplateIDsArry = order.sTemplateIDs.Split(','); string[] sTemplateCountArry = order.sTemplateCount.Split(','); if (sTemplateIDsArry.Length > 0 && sTemplateIDsArry.Length == sTemplateCountArry.Length) { t_PM_Order orderNew = null; List <t_PM_Order> list = bll.t_PM_Order.Where(o => o.OrderNO == order.OrderNO).ToList(); if (list.Count > 0) { orderNew = list[0]; if (orderNew == null) { return(Content("添加工单错误!")); } for (int i = 0; i < sTemplateIDsArry.Length; i++) { //result = DeleteInfo(int.Parse(sTemplateIDsArry[i].Trim())); t_PM_Order_Info Order_Info = new t_PM_Order_Info(); Order_Info.orderId = orderNew.OrderID; Order_Info.templateId = int.Parse((sTemplateIDsArry[i])); Order_Info.deviceCount = int.Parse((sTemplateCountArry[i])); Order_Info.unCount = Order_Info.deviceCount; bll.t_PM_Order_Info.AddObject(Order_Info); bll.SaveChanges(); } } } } Common.InsertLog("工单管理", CurrentUser.UserName, "新增工单信息[" + order.OrderNO + "]");//log //发送短信; UtilsSms.smsOrderAdd(order.UserName, order.OrderName, bll); Console.WriteLine(result); } } catch (Exception ex) { result = ex.ToString(); } return(Content(result)); }
public ActionResult SaveOrder(t_PM_Order order, FormCollection collection) { //string content = collection["OrderContent"].ToString(); string result = "OK"; try { if (order.OrderID > 0) { t_PM_Order orderinfo = bll.t_PM_Order.Where(o => o.OrderID == order.OrderID).First(); orderinfo.OrderContent = Common.ReplaceEnter(order.OrderContent); orderinfo.OrderNO = order.OrderNO; orderinfo.PID = order.PID; orderinfo.PlanDate = order.PlanDate; orderinfo.PName = order.PName; orderinfo.Priority = order.Priority; orderinfo.Remarks = Common.ReplaceEnter(order.Remarks); orderinfo.UserID = order.UserID; orderinfo.OrderState = 0; if (orderinfo.UserName != order.UserName) { UtilsSms.smsOrderCancel(orderinfo.UserName, orderinfo.OrderName, bll); } orderinfo.UserName = order.UserName; orderinfo.BugID = order.BugID; orderinfo.BugInfo = order.BugInfo; orderinfo.OrderType = order.OrderType; orderinfo.OrderName = order.OrderName; orderinfo.DressCodeID = order.DressCodeID; bll.ObjectStateManager.ChangeObjectState(orderinfo, EntityState.Modified); bll.SaveChanges(); Common.InsertLog("工单管理", CurrentUser.UserName, "编辑工单信息[" + order.OrderNO + "]");//log } else { order.OrderState = 0; //0待接收 1已受理 2已完成 order.IsQualified = -1; //-1 未检查 0不合格 1合格 order.CreateDate = DateTime.Now; order.Creater = CurrentUser.UserName; order.OrderContent = order.OrderContent.Replace("\n", "<br>"); int iOrderTypeId = 1; if (order.OrderType.Equals("日常巡检")) { iOrderTypeId = 3; } if (order.OrderType.Equals("检修试验")) { iOrderTypeId = 2; } if (order.OrderType.Equals("应急抢修")) { iOrderTypeId = 1; } order.OrderTypeId = iOrderTypeId; bll.t_PM_Order.AddObject(order); bll.SaveChanges(); Common.InsertLog("工单管理", CurrentUser.UserName, "新增工单信息[" + order.OrderNO + "]");//log } //发送短信; UtilsSms.smsOrderAdd(order.UserName, order.OrderName, bll); Console.WriteLine(result); } catch (Exception ex) { result = ex.ToString(); } return(Content(result)); }
public string rLatitude; //纬度 public UnOrderDetail2(List <OrderInfo> infos, t_PM_Order order, t_CM_PDRInfo t_CM_PDRInfo, string tel) { List <OrderInfo2> tempList = new List <OrderInfo2>(); List <OrderInfo> element = null; string title = ""; string templateName = ""; int templateId = -1; for (int i = 0; i < infos.Count; i++) { if (title != infos[i].templateBlock) { if (element != null && title != "") { OrderInfo2 map = new OrderInfo2(templateId, title, element, templateName); tempList.Add(map); } title = infos[i].templateBlock; templateId = (int)infos[i].templateId; templateName = infos[i].templateName; element = new List <OrderInfo>(); } element.Add(infos[i]); if (i == infos.Count - 1) { OrderInfo2 map = new OrderInfo2(templateId, title, element, infos[i].templateName); tempList.Add(map); } } templateName = ""; templateId = -1; string sTemplateBlock2Old = "", sTemplateBlock2New = ""; List <OrderInfo2> element2 = null; for (int i = 0; i < tempList.Count; i++) { if (templateId != tempList[i].templateId) { if (element2 != null && title != "") { OrderInfo3 map = new OrderInfo3(templateId, templateName, element2); mInfos.Add(map); } templateId = (int)tempList[i].templateId; templateName = tempList[i].templateName; element2 = new List <OrderInfo2>(); } // for (int j = 0; j < tempList[i].element.Count; j++) { sTemplateBlock2New = tempList[i].element[j].templateBlock2; if (sTemplateBlock2New.Equals(sTemplateBlock2Old)) { tempList[i].element[j].templateBlock2 = ""; } else { sTemplateBlock2Old = sTemplateBlock2New; } } // element2.Add(tempList[i]); if (i == tempList.Count - 1) { OrderInfo3 map = new OrderInfo3(templateId, tempList[i].templateName, element2); mInfos.Add(map); } } address = t_CM_PDRInfo.Position; name = t_CM_PDRInfo.CompanyName; release_time = order.CreateDate.ToString(); title = order.OrderName; until_time = order.PlanDate.ToString(); work_content = order.OrderContent; FistDate = order.FistDate.ToString(); work_man = order.UserName; order_id = order.OrderID; status = (int)order.OrderState; this.tel = tel; string s = t_CM_PDRInfo.Coordination; string[] sArray = s.Split('|'); try { rLongtitude = sArray[0]; rLatitude = sArray[1]; } catch (Exception e) { } }
public ActionResult DelAlarmById(int AlarmID, string AlarmTreatment) { try { string PDRList = HomeController.GetPID(CurrentUser.UNITList); //string PDRList = CurrentUser.PDRList; if (!PDRList.Equals("")) { string sSql = "update [t_AlarmTable_en] set AlarmState = 0,AlarmTreatment = '" + AlarmTreatment + "',AlarmConfirm='已确认',UserName='******',ConfirmDate='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "' where PID in (" + PDRList + ") and AlarmConfirm='未确认' and AlarmState>0 and AlarmID=" + AlarmID; bll.ExecuteStoreCommand(sSql); if (AlarmTreatment != null && AlarmTreatment.Contains("真实"))//添加隐患,并且下发工单; { List <t_AlarmTable_en> list = bll.t_AlarmTable_en.Where(p => p.AlarmID == AlarmID).ToList(); if (list != null && list.Count > 0) { try { t_AlarmTable_en alarm = list.First(); t_PM_Order order = new t_PM_Order(); order.PID = alarm.PID; t_CM_PDRInfo pdrinfo = bll.t_CM_PDRInfo.Where(p => p.PID == alarm.PID).ToList().First(); order.PName = pdrinfo.Name; try { string c = pdrinfo.Coordination; string[] xx = c.Split('|'); order.Latitude = decimal.Parse(xx[1]); order.Longtitude = decimal.Parse(xx[0]); } catch { } order.OrderName = order.PName + "应急抢修" + DateTime.Now; List <t_CM_Constract> ll = bll.t_CM_Constract.Where(p => p.CtrPid == alarm.PID).ToList(); if (ll == null || ll.Count <= 0) { return(Content("报警已确认!\n未找到合同中的负责人!\n自动下发工单失败,请手工处理!")); } t_CM_Constract t = ll.First(); string sql = "SELECT * FROM t_CM_UserInfo WHERE UserName='******'"; List <t_CM_UserInfo> listUsers = bll.ExecuteStoreQuery <t_CM_UserInfo>(sql).ToList(); if (listUsers == null | listUsers.Count <= 0) { return(Content("报警已确认!\n未找到工单需要下发的人员!\n自动下发工单失败,请手工处理!")); } order.UserName = t.person;//根据pid,类型查找合同,到名字; order.PlanDate = DateTime.Now; order.UserID = listUsers.First().UserID; order.Priority = 1; order.OrderNO = DateTime.Now.Ticks + ""; order.OrderType = "应急抢修"; order.DressCodeID = 2; order.OrderState = 0; //0待接收 1已受理 2已完成 order.IsQualified = -1; //-1 未检查 0不合格 1合格 order.CreateDate = DateTime.Now; order.Creater = CurrentUser.UserName; order.OrderTypeId = 3; order.OrderContent = "报警内容:" + alarm.ALarmType + ";" + alarm.AlarmDateTime + ";" + alarm.AlarmCate + ";" + ValueReset((double)alarm.AlarmValue, alarm.AlarmCate) + ";" + alarm.AlarmAddress + ";" + alarm.AlarmArea + ";" + alarm.Company + "。已确认为真实故障,请立即检修。"; bll.t_PM_Order.AddObject(order); bll.SaveChanges(); //发送短信; Result a = UtilsSms.smsOrderAdd(order.UserName, order.OrderName, bll); AddBugInfo(AlarmID); return(Content("报警已确认!" + "\n\n" + parserContent(a))); } catch (Exception ex) { string error = ex.ToString(); return(Content("报警已确认!\n自动下发工单失败,请手工处理!")); } } } return(Content("报警已确认!")); } else { return(Content("没有权限,报警未确认!")); } } catch (Exception ex) { string error = ex.ToString(); return(Content("报警确认失败!")); } }