コード例 #1
0
        public JsonResult GetSelParamIds(int layoutId)
        {
            var retData = new VM_Result_Data();

            try {
                var layout = bllLayout.GetModel(layoutId);
                var bllParamCode_Sensor = new MesWeb.BLL.T_SensorModule_T_ParameterCode();
                var bllSensor           = new MesWeb.BLL.T_SensorModule();
                var sensor = bllSensor.GetModel((int)layout.TableRowID);
                var paramCode_SensorList = bllParamCode_Sensor.GetModelList("SensorModuleID = " + sensor.SensorModuleID);
                var paramCodeIds         = new List <int?>();
                foreach (var item in paramCode_SensorList)
                {
                    paramCodeIds.Add(item.ParameterCodeID);
                }
                if (paramCodeIds.Count > 0)
                {
                    retData.Code     = RESULT_CODE.OK;
                    retData.Appendix = paramCodeIds;
                }
            } catch (Exception e) {
                log = LogFactory.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.FullName + ":" + MethodBase.GetCurrentMethod().Name);
                log.Error("获取模块参数失败!", e);
                retData.Content = "获取模块参数失败!";
            }
            return(Json(retData));
        }
コード例 #2
0
        protected List <VM_Fusioncharts_Line> getSensorLineChartList(int sensorModuleID, int machineID, int size = -1)
        {
            List <VM_Fusioncharts_Line> vmChartsList = new List <VM_Fusioncharts_Line>();
            var bllSensor = new MesWeb.BLL.T_SensorModule();
            var sensor    = bllSensor.GetModel(sensorModuleID);

            if (sensor != null)
            {
                var bllSensorParamCode  = new MesWeb.BLL.T_SensorModule_T_ParameterCode();
                var bllParamCode        = new MesWeb.BLL.T_ParameterCode();
                var sensorParamCodeList = bllSensorParamCode.GetModelList("SensorModuleID = " + sensor.SensorModuleID);
                var codeList            = new List <MesWeb.Model.T_ParameterCode>();
                foreach (var sensorCode in sensorParamCodeList)
                {
                    var paramCode = bllParamCode.GetModel((int)sensorCode.ParameterCodeID);
                    codeList.Add(paramCode);
                }
                vmChartsList = getParamsChartList(machineID, codeList.ToArray());
            }
            return(vmChartsList);
        }
コード例 #3
0
        public JsonResult GetParamChartProperties(int layoutId)
        {
            var retData = new VM_Result_Data();

            log = LogFactory.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.FullName + ":" + MethodBase.GetCurrentMethod().Name);
            var properties          = new List <VM_Highcharts_Property>();
            var bllParamCode        = new MesWeb.BLL.T_ParameterCode();
            var bllSensor_ParamCode = new MesWeb.BLL.T_SensorModule_T_ParameterCode();
            var bllSensor           = new MesWeb.BLL.T_SensorModule();
            var bllUnit             = new MesWeb.BLL.T_ParameterUnit();
            var bllParamCol         = new MesWeb.BLL.T_ParametersCol();

            try {
                var sensroLayout = bllLayout.GetModel(layoutId);
                if (sensroLayout.LayoutTypeID != (int)LAYOUT_TPYE.SENSOR_MODULE)
                {
                    retData.Content = "施工有误,请联系管理员";
                    log.Error("传感器模块参数错误");
                    return(Json(retData));
                }
                var machLayout   = GetParentLayout(layoutId);
                var machineId    = machLayout.TableRowID.Value;
                var sensor       = bllSensor.GetModel(sensroLayout.TableRowID.Value);
                var sensor_codes = bllSensor_ParamCode.GetModelList("SensorModuleID = " + sensor.SensorModuleID);
                foreach (var sc in sensor_codes)
                {
                    var property = new VM_Highcharts_Property();
                    //获取参数
                    var code = bllParamCode.GetModel(sc.ParameterCodeID.Value);
                    //是否能够画曲线
                    property.CanDrawChart = canDrawChart(code.ParameterCodeID);
                    //曲线类型,将drawType为一样的曲线画在同一图上
                    property.drawType    = code.ParameterType;
                    property.Title       = code.ParameterName;
                    property.ParamCodeId = code.ParameterCodeID;

                    //获取参数单位
                    if (code.ParameterUnitID.HasValue)
                    {
                        var unit = bllUnit.GetModel(code.ParameterUnitID.Value);
                        if (unit != null)
                        {
                            property.Symbol = unit.ParameterUnitSymbol;
                        }
                    }
                    else
                    {
                        property.Symbol = "未设置";
                    }
                    //获取参数最值
                    var paramCol = bllParamCol.GetModelList("ParameterCodeID = " + code.ParameterCodeID + "AND MachineID = " + machineId).FirstOrDefault();
                    if (paramCol != null)
                    {
                        property.MaxValue = float.Parse(paramCol.ParametersColMaxiumValue);
                        property.MinValue = float.Parse(paramCol.ParametersColMiniumValue);
                    }

                    //是否带有 CPK
                    if (Enum.IsDefined(typeof(CPK_PARAM_CODE), sc.ParameterCodeID))
                    {
                        property.IsCPK = true;
                    }
                    else
                    {
                        property.IsCPK = false;
                    }
                    properties.Add(property);
                }

                if (properties.Count > 0)
                {
                    retData.Code = RESULT_CODE.OK;
                    //每参数曲线基本值(最值,标题,单位等等)
                    //每个模块有多个参数,所以这里是一个properties集合
                    retData.Appendix = properties;
                    //给每个模块绑定传感器编号,便于接受485报警
                    retData.Content = sensor.SerialNum;
                }
            } catch (Exception e) {
                log.Error("获取模块参数失败", e);
                retData.Content = "获取模块参数失败";
            }
            return(Json(retData));
        }