コード例 #1
0
        /// <summary>
        /// 显示我作为购买者名下的所有设备列表
        /// </summary>
        private void ShowMyDevices()
        {
            var items = EquipmentInstance.FindList(f => f.Customer == me.id && f.Deleted == false);
            var html  = "";

            foreach (var item in items)
            {
                var eng = EquipmentInstance.GetEngStatus(item);
                html += "<dl class=\"invest-type\" id=\"" + item.id.ToString() + "\">" +
                        "            <dt>" +
                        "                <span class=\"iconleft\">" +
                        "                    <img class=\"img-rounded ex\" src=\"" + item.TB_EquipmentModel.TB_EquipmentType.Image + "\">" +
                        "                </span>" + EquipmentInstance.GetFullNumber(item) +
                        "                <em class=\"status\">" + item.TB_EquipmentModel.TB_EquipmentType.Name + "</em>" +
                        "            </dt>" +
                        "            <dd>" +
                        "                <span class=\"text-" + (eng.Equals("ON") ? "success" : "danger") + "\"><span class=\"signal cell-engine\"></span> Engine " + eng + "</span>" +
                        "                <em class=\"status\"><span class=\"glyphicon glyphicon-time\"></span> " + EquipmentBLL.GetRuntime(item.Runtime + item.InitializedRuntime, item.CompensatedHours.Value) + "</em>" +
                        "            </dd>" +
                        "            <dd>" +
                        "                <span class=\"text-info\"><span class=\"signal cell-signal-" + Utility.ASU2Signal(item.Signal.Value) + "\"></span> Signal: " + Utility.ASU2DBM(item.Signal.Value) + "dBm(ASU: " + item.Signal + ")</span>" +
                        "                <div class=\"total-num\">" + Utility.GetOnlineStyle(item.OnlineStyle, item.OnlineTime, false) + "</div>" +
                        "            </dd>" +
                        "            <dd class=\"desc\"><span class=\"glyphicon glyphicon-globe\"></span> " + item.GpsAddress + "</dd>" +
                        "</dl>";
            }
            equipmentItems.InnerHtml = html;
        }
コード例 #2
0
        /// <summary>
        /// 查找定位地址属于某个省份的设备列表
        /// </summary>
        /// <returns></returns>
        private string HandleEquipmentProvinceQuest()
        {
            var ret  = "[]";
            var list = EquipmentInstance.FindList(f => f.GpsAddress.IndexOf(data) >= 0 && f.Deleted == false);
            var objs = new List <TempEquipment>();

            foreach (var obj in list)
            {
                objs.Add(new TempEquipment(obj));
            }
            ret = JsonConverter.ToJson(objs);
            return(ret);
        }
コード例 #3
0
        private void ShowCount()
        {
            var list = EquipmentInstance.FindList(f => f.Deleted == false);

            // 统计野外
            var total = 0;
            // 统计销售的
            var count = list.Count(c => c.TB_EquipmentStatusName.IsItOutstorage == true);

            countSold.InnerText = count.ToString();
            total += count;
            // 统计租赁的
            count = list.Count(c => c.TB_EquipmentStatusName.IsItRental == true);
            countRental.InnerText = count.ToString();
            total += count;
            totalField.InnerText = total.ToString();
            // 统计野外现在正启动着的
            count = list.Count(c => (c.TB_EquipmentStatusName.IsItRental == true ||
                                     c.TB_EquipmentStatusName.IsItOutstorage == true) &&
                               c.Voltage.IndexOf("G2") >= 0);
            countWorking.InnerText = count.ToString();
            // 统计野外未启动的
            countIdle.InnerText = (total - count).ToString();

            // 统计库存的
            total = 0;
            // 统计新产品
            count = list.Count(c => c.TB_EquipmentStatusName.IsItInventory == true && c.StoreTimes <= 1);
            countNew.InnerText = count.ToString();
            total += count;
            // 统计租赁回收的
            count = list.Count(c => c.TB_EquipmentStatusName.IsItInventory == true && c.StoreTimes > 1);
            countFleet.InnerText = count.ToString();
            total += count;
            totalInventory.InnerText = total.ToString();

            // 统计正在维修的
            total = list.Count(c => c.TB_EquipmentStatusName.IsItOverhaul == true);
            totalRepair.InnerText   = total.ToString();
            countOverhaul.InnerText = total.ToString();
        }
コード例 #4
0
        /// <summary>
        /// 处理设备相关的查询
        /// </summary>
        private void HandleEquipmentQuery()
        {
            var ret = "[]";

            switch (cmd)
            {
            case "fullnumber":
                // 查询完整的设备号码(如DX300LC-20000)
                var numbers = EquipmentInstance.FindList(f => (f.TB_EquipmentModel.Code + f.Number).Equals(data) && f.Deleted == false).ToList();
                ret = JsonConverter.ToJson(numbers);
                break;

            case "query":
                var query     = JsonConverter.ToObject <TB_Equipment>(data);
                var queryList = EquipmentInstance.FindList(f =>
                                                           (query.Model > 0 ? f.Model == query.Model : f.Model > 0) &&
                                                           f.Number.IndexOf(query.Number) >= 0 && f.Deleted == false).ToList();
                ret = JsonConverter.ToJson(queryList);
                break;

            case "number":
                // 通过号码模糊查询
                var ns  = EquipmentInstance.FindList(f => f.Number.IndexOf(data) >= 0 && f.Deleted == false).ToList();
                var tmp = new List <TempEquipment>();
                foreach (var t in ns)
                {
                    tmp.Add(new TempEquipment(t));
                }
                ret = JsonConverter.ToJson(tmp);
                break;

            case "notbind":
                var obj  = JsonConverter.ToObject <TB_Equipment>(data);
                var list = EquipmentInstance.FindList(f =>
                                                      (obj.Model > 0 ? f.Model == obj.Model : f.Model > 0) &&
                                                      f.Number.IndexOf(obj.Number) >= 0 && f.Terminal == (int?)null && f.Deleted == false).ToList();
                break;

            case "old-in-store":
                // 2手或租赁设备入库查询
                var queryObj = JsonConverter.ToObject <TB_Equipment>(data);
                if (queryObj.Number.IndexOf('-') >= 0)
                {
                    queryObj.Number = queryObj.Number.Substring(queryObj.Number.LastIndexOf('-') + 1);
                }
                var olds = EquipmentInstance.FindList(f => (queryObj.Model > 0 ? f.Model == queryObj.Model : f.Model > 0) &&
                                                      f.Number.IndexOf(queryObj.Number) >= 0 && f.Deleted == false).OrderBy(o => o.Number).Take(5).ToList();
                ret = JsonConverter.ToJson(olds);
                break;

            case "storage":
                // 查询出入库记录
                ret = HandleEquipmentStorage();
                break;

            case "6004":
                ret = HandleEquipment6004();
                break;

            case "positions":
                ret = HandleEquipmentPositionHistory();
                break;

            case "alarms":
                ret = HandleEquipmentAlarmHistory();
                break;

            case "faults":
                ret = HandleEquipmentEposFaultHistory();
                break;

            case "worktime":
                ret = HandleQueryEquipmentWorktime();
                break;

            case "province":
                ret = HandleEquipmentProvinceQuest();
                break;

            case "worktime2excel":
                // 工作时间导入到excel请求
                ret = HandleQueryEquipmentWorkTime2Excel();
                break;

            case "worktime2excelquery":
                // 查询excel导出状态
                ret = HandleQueryWorkTime2ExcelStatus();
                break;

            case "equipments2excel":
                // 设备列表导出到excel
                ret = HandleExportEquipmentListToExcel();
                break;

            case "terminals2excel":
                // 终端列表导出到excel
                ret = HandleExportTerminalListToExcel();
                break;

            case "as":
                // 查询以设备号码为基准的终端安装、拆卸历史记录
                ret = HandleEquipmentBindHistory();
                break;

            default:
                ret = "{\"status\":-1,\"desc\":\"No function to handle your request.\"}";
                break;
            }
            ResponseJson(ret);
        }