Ejemplo n.º 1
0
        public ActionResult getMan(int AlarmID)
        {
            string result = "";

            try
            {
                t_AlarmTable_en       alarm = bll.t_AlarmTable_en.Where(p => p.AlarmID == AlarmID).ToList().First();
                List <t_CM_Constract> ll    = bll.t_CM_Constract.Where(p => p.CtrPid == alarm.PID).ToList();
                if (ll == null || ll.Count <= 0)
                {
                    return(Content(result));
                }
                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("联系班长:" + listUsers.First().UserName + "." + listUsers.First().Mobilephone));
                }
                return(Content(listUsers.First().Mobilephone));
            }
            catch
            {
                return(Content(result));
            }
        }
Ejemplo n.º 2
0
 public PDRInfo2(t_CM_PDRInfo pdrInfo, t_CM_Constract constract, string Mobilephone, t_CM_Area area, t_ES_ElecVoltage vmodel, t_CM_Unit unit, t_ES_Industry ind)
 {
     // TODO: Complete member initialization
     this.pdrInfo     = pdrInfo;
     this.constract   = constract;
     this.Mobilephone = Mobilephone;
     this.area        = area;
     this.vmodel      = vmodel;
     this.unit        = unit;
     this.ind         = ind;
 }
Ejemplo n.º 3
0
 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("报警确认失败!"));
     }
 }