/// <summary> /// 道闸设备开闸 /// </summary> /// <param name="channelCode"></param> /// <param name="strArr"></param> public static void OpenGate(ProcessRecord recordInfo) { var temp = CommHelper.GetOrgInfos(recordInfo.CHN_CODE, false); if (null != temp) { var par = temp.Where(x => x.channelType == enumChannelType.par).LastOrDefault(); var chargMap = par.ListChargMap.Where(x => x.carType == (int)recordInfo.CarType).FirstOrDefault(); int[] roadType = chargMap.roadGateType; var childrenList = GetOrgInfos(recordInfo.CHN_CODE); if (null != childrenList && childrenList.Count > 0) { //查找道闸设备 var roadGateDevice = childrenList.Where(x => x.productLine == enumProductLine.RoadGate).FirstOrDefault(); if (null != roadGateDevice && !string.IsNullOrEmpty(roadGateDevice.IP)) { //if (roadGateDevice.Online) //{ var tempControlPanel = EngineContext.Current.Resolve <IControlPanel>(roadGateDevice.deviceType.ToString()); if (null != tempControlPanel) { LogHelper.Log.Info("道闸设备【" + roadGateDevice.ORGANIZATION_NAME + "】" + ";车牌号:" + recordInfo.INOUT_RECODE.VEHICLE_NO + ";发送开闸命令时间:" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); tempControlPanel.OpenGate(roadGateDevice.IP, roadGateDevice.Port, roadType); recordInfo.OPERATER_TYPE = enumOperaterType.OpenGate; ThreadMessageTransact.Instance.triggerEvent(recordInfo, false); } //} //else // LogHelper.Log.Info("道闸设备【" + roadGateDevice.ORGANIZATION_NAME + "】不在线!"); } else //找父节点 ----- (一般是主控板) { var boardDevice = childrenList.Where(x => x.productLine == enumProductLine.MasterBoard).FirstOrDefault(); if (null != boardDevice && !string.IsNullOrEmpty(boardDevice.IP)) { //if (boardDevice.Online) //{ var tempControlPanel = EngineContext.Current.Resolve <IControlPanel>(boardDevice.deviceType.ToString()); if (null != tempControlPanel) { LogHelper.Log.Info("道闸设备【" + boardDevice.ORGANIZATION_NAME + "】" + ";车牌号:" + recordInfo.INOUT_RECODE.VEHICLE_NO + ";发送开闸命令时间:" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); tempControlPanel.OpenGate(boardDevice.IP, boardDevice.Port, roadType); recordInfo.OPERATER_TYPE = enumOperaterType.OpenGate; ThreadMessageTransact.Instance.triggerEvent(recordInfo, false); } //} //else // LogHelper.Log.Info("道闸设备【" + boardDevice.ORGANIZATION_NAME + "】不在线!"); } } } } }
/// <summary> /// 道闸设备开闸 /// </summary> /// <param name="channelCode"></param> /// <param name="strArr"></param> public static void ShowLED(Equipment device, string[] strArr, LedInfoMap info) { if (string.IsNullOrEmpty(device.IP)) { var Org = CommHelper.GetOrgInfos(device.ORGANIZATION_CODE, false); device = Org.Where(x => x.deviceType == enumDeviceType.LonixControlPanelI).LastOrDefault(); } if (null != device) { var tempLedScreen = EngineContext.Current.Resolve <ILEDScreen>(); if (null != tempLedScreen) { tempLedScreen.ShowLedScreen(device.IP, device.Port, strArr, info.displayMode, info.serialNo + 1, info.displayColor); } } }
/// <summary> /// 是否缴纳物业费 /// </summary> /// <returns></returns> public static PropertyExpend GetPropertyExpend(string vehicleNo) { PropertyExpend propertyExpend = null; try { CalendarInfo calendarInfo = new CalendarInfo(); //获取当前工作站 string url = ConfigurationManager.AppSettings["serverUrl"].ToString(); string authCode = CommHelper.Str(6); string token = CommHelper.Md5(CommHelper.StringToHexString(authCode)).ToUpper(); string data = "authCode=" + authCode + "&token=" + token + "&vehicleNo=" + vehicleNo; string result = CommHelper.Post(url + "/propertyExpendQuery.eif?", data); propertyExpend = CommHelper.FromJsonTo <PropertyExpend>(result); } catch { return(null); } return(propertyExpend); }
/// <summary> /// 获取节假日 /// </summary> /// <param name="node"></param> /// <param name="recordInfo"></param> /// <param name="result"></param> public static bool getWorkingDaysVal() { try { DateTime dtCurr = DateTime.Now; var calendarInfo = CommHelper.GetWorkingDays(dtCurr.ToString("yyyy-MM-dd")); if (0 == calendarInfo.dayFlag) { return(true); } else { if (dtCurr > Convert.ToDateTime(calendarInfo.beginTime) && dtCurr < Convert.ToDateTime(calendarInfo.endTime)) { return(true); } else { return(false); } } } catch { return(false); } }
/// <summary> /// 获取节假日信息 /// </summary> /// <returns></returns> public static CalendarInfo GetWorkingDays(string dateTime) { CalendarInfo calendarInfo = null; //获取当前工作站 string url = ConfigurationManager.AppSettings["serverUrl"].ToString(); string authCode = CommHelper.Str(6); string token = CommHelper.Md5(CommHelper.StringToHexString(authCode)).ToUpper(); string data = "authCode=" + authCode + "&token=" + token + "&dateTime=" + dateTime; string result = CommHelper.Post(url + "/workingDaysVal.eif?", data); WorkingDays workDay = CommHelper.FromJsonTo <WorkingDays>(result); if (workDay != null) { if (workDay.resStatus == 1) { calendarInfo = workDay.calendarInfo; } else { LogHelper.Log.Error(workDay.resRemark); } } return(calendarInfo); }
/// <summary> /// 登入 /// </summary> /// <param name="userName"></param> /// <param name="pwd"></param> /// <returns></returns> public static bool Login(string userName, string pwd) { bool isLogin = false; try { if (!ConfigHelper.LoginFromLocal) { string url = ConfigurationManager.AppSettings["serverUrl"].ToString(); string authCode = CommHelper.Str(6); string token = CommHelper.Md5(CommHelper.StringToHexString(authCode)).ToUpper(); string data = "authCode=" + authCode + "&token=" + token + "&userAccount=" + userName + "&userPwd=" + pwd; string result = CommHelper.Post(url + "/loginAuth.eif?", data); returnUserInfo userInfo = CommHelper.FromJsonTo <returnUserInfo>(result); if (userInfo.resStatus == 1) { if (null != userInfo.userInfo) { GlobalEnvironment.LocalUserInfo = new CR_PARK_EXCHANGE(); GlobalEnvironment.LocalUserInfo.ID = Guid.NewGuid().ToString("N"); GlobalEnvironment.LocalUserInfo.USER_ID = userInfo.userInfo.id; GlobalEnvironment.LocalUserInfo.USER_ACCOUNT = userInfo.userInfo.userAccount; GlobalEnvironment.LocalUserInfo.USER_NAME = userInfo.userInfo.userName; GlobalEnvironment.LocalUserInfo.LOGIN_TIME = DateTime.Now; GlobalEnvironment.LocalUserInfo.EIXT_TIME = DateTime.Now; GlobalEnvironment.LocalUserInfo.EIXT_NUM = 0; GlobalEnvironment.LocalUserInfo.ENTER_NUM = 0; GlobalEnvironment.LocalUserInfo.DUE_MONEY = 0; GlobalEnvironment.LocalUserInfo.PER_MONEY = 0; GlobalEnvironment.LocalUserInfo.WORK_STATUS = 0; isLogin = true; } } } else { //var temp = EngineContext.Current.Resolve<IBAS_SYSTEM_USER>(); //var model = temp.Login(userName, pwd); //if (null != model) //{ // GlobalEnvironment.LocalUserInfo = new CR_PARK_EXCHANGE(); // GlobalEnvironment.LocalUserInfo.ID = model.ID; // GlobalEnvironment.LocalUserInfo.USER_ACCOUNT = userName; // GlobalEnvironment.LocalUserInfo.USER_NAME = model.USER_NAME; // GlobalEnvironment.LocalUserInfo.LOGIN_TIME = DateTime.Now; // GlobalEnvironment.LocalUserInfo.EIXT_NUM = 0; // GlobalEnvironment.LocalUserInfo.ENTER_NUM = 0; // isLogin = true; //} GlobalEnvironment.LocalUserInfo = new CR_PARK_EXCHANGE(); GlobalEnvironment.LocalUserInfo.ID = "afdfad"; GlobalEnvironment.LocalUserInfo.USER_ACCOUNT = "Admin"; GlobalEnvironment.LocalUserInfo.USER_NAME = "Admin"; GlobalEnvironment.LocalUserInfo.LOGIN_TIME = DateTime.Now; GlobalEnvironment.LocalUserInfo.EIXT_NUM = 0; GlobalEnvironment.LocalUserInfo.ENTER_NUM = 0; isLogin = true; } } catch (Exception ex) { LogHelper.Log.Error(ex.Message); } return(isLogin); }
/// <summary> /// 获取工作站所有设备 /// </summary> /// <param name="WORKSTATION_CODE"></param> /// <returns></returns> public static List <Equipment> GetCurrentWorkStationOrgs(string WorkStationCode) { return(CommHelper.GetOrgInfos(WorkStationCode).Concat(CommHelper.GetOrgInfos(WorkStationCode, false)).OrderBy(x => x.ORG_LEVEL).ToList()); }