塔吊预警推送
This commit is contained in:
parent
4ee55f93ad
commit
6dd2db4824
|
@ -2,6 +2,8 @@
|
|||
using Model;
|
||||
using Model.APIItem.HSSE;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Web.Http;
|
||||
|
||||
|
@ -40,14 +42,53 @@ namespace WebAPI.Controllers
|
|||
record.Range = recordItem.Range;
|
||||
record.RotationAngle = recordItem.RotationAngle;
|
||||
record.WindSpeed = recordItem.WindSpeed;
|
||||
record.Hoist = recordItem.Hoist;
|
||||
|
||||
|
||||
|
||||
record.Date = DateTime.Now;
|
||||
|
||||
record.Hoist = recordItem.Hoist;
|
||||
record.Date = DateTime.Now;
|
||||
db.HSSE_TowerCraneRecord.InsertOnSubmit(record);
|
||||
db.SubmitChanges();
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(record.AlarmType))
|
||||
{
|
||||
try
|
||||
{
|
||||
Dictionary<string, string> alarmMap = new Dictionary<string, string>();
|
||||
|
||||
alarmMap.Add("111", "重量预警");
|
||||
alarmMap.Add("112", "重量报警");
|
||||
alarmMap.Add("121", "风速预警");
|
||||
alarmMap.Add("122", "风速报警");
|
||||
alarmMap.Add("131", "内限位报警");
|
||||
alarmMap.Add("132", "内限位预警");
|
||||
alarmMap.Add("133", "外限位预警");
|
||||
alarmMap.Add("134", "外限位报警");
|
||||
alarmMap.Add("141", "倾角预警");
|
||||
alarmMap.Add("142", "倾角报警");
|
||||
alarmMap.Add("151", "上限位预警");
|
||||
alarmMap.Add("152", "上限位报警");
|
||||
alarmMap.Add("201", "障碍物碰撞报警");
|
||||
alarmMap.Add("202", "塔机群碰撞报警");
|
||||
|
||||
var alarms = record.AlarmType.Replace("[", "").Replace("]", "").Split(',');
|
||||
string res = "";
|
||||
foreach (string alarm in alarms)
|
||||
{
|
||||
if (alarmMap.ContainsKey(alarm))
|
||||
{
|
||||
res += alarmMap[alarm] + ",";
|
||||
}
|
||||
}
|
||||
res = res.TrimEnd(',');
|
||||
|
||||
var user = db.Project_ProjectUser.FirstOrDefault(x => x.ProjectId == towerCrane.ProjectId && x.UnitId == Const.UnitId_CWCEC && x.RoleName == "安全总监");
|
||||
|
||||
APICommonService.SendSubscribeMessage(user.UserId, "塔吊预警", towerCrane.TowerCraneName + ":" + res, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue