public JsonResult FindAlarmsLst(int warehouse, int devicecode)
        {
            List <Alarm>     stateList = new CWDevice().FindAlarmList(d => d.Warehouse == warehouse && d.DeviceCode == devicecode);
            List <BackAlarm> dispLst   = new List <BackAlarm>();

            for (int i = 0; i < stateList.Count; i++)
            {
                Alarm alarm = stateList[i];
                if (alarm.Value == 1)
                {
                    if (!alarm.Description.Contains("备用"))
                    {
                        if (alarm.Color == EnmAlarmColor.Green)
                        {
                            BackAlarm back = new BackAlarm {
                                Type        = 1,
                                Description = alarm.Description
                            };
                            dispLst.Add(back);
                        }
                        else if (alarm.Color == EnmAlarmColor.Red)
                        {
                            BackAlarm back = new BackAlarm
                            {
                                Type        = 2,
                                Description = alarm.Description
                            };
                            dispLst.Add(back);
                        }
                    }
                }
            }

            return(Json(dispLst, JsonRequestBehavior.AllowGet));
        }
        public ActionResult FindDeviceList(int?pageSize, int?pageIndex,
                                           string sortOrder, string sortName,
                                           string warehouse, string code)
        {
            CWDevice      cwdevice = new CWDevice();
            Page <Device> page     = new Page <Device>();

            if (pageSize != null)
            {
                page.PageSize = (int)pageSize;
            }
            if (pageIndex != null)
            {
                page.PageIndex = (int)pageIndex;
            }
            OrderParam orderParam = null;

            if (!string.IsNullOrEmpty(sortName))
            {
                orderParam = new OrderParam();
                orderParam.PropertyName = sortName;
                if (!string.IsNullOrEmpty(sortOrder))
                {
                    orderParam.Method = sortOrder.ToLower() == "asc" ? OrderMethod.Asc : OrderMethod.Desc;
                }
                else
                {
                    orderParam.Method = OrderMethod.Asc;
                }
            }
            if (warehouse != "0" && code != "0")
            {
                int wh  = Convert.ToInt32(warehouse);
                int smg = Convert.ToInt32(code);

                page = cwdevice.FindPageList(page, (dev => dev.Warehouse == wh && dev.DeviceCode == smg), orderParam);
                var data = new
                {
                    total = page.TotalNumber,
                    rows  = page.ItemLists
                };
                return(Json(data));
            }
            page = cwdevice.FindPageList(page, (dev => true), orderParam);
            var value = new
            {
                total = page.TotalNumber,
                rows  = page.ItemLists
            };

            return(Json(value));
        }
Beispiel #3
0
        public async Task <ContentResult> UpdateDevice()
        {
            try
            {
                byte[] bytes = new byte[Request.InputStream.Length];
                Request.InputStream.Read(bytes, 0, bytes.Length);
                string req = System.Text.Encoding.Default.GetString(bytes);

                Device smg = JsonConvert.DeserializeObject <Device>(req);

                CWDevice cwdevice = new CWDevice();
                Device   current  = await cwdevice.FindAsync(d => d.Warehouse == smg.Warehouse && d.DeviceCode == smg.DeviceCode);

                if (current != null)
                {
                    bool isReset = false;
                    if (smg.Mode != current.Mode &&
                        smg.Mode == EnmModel.Automatic &&
                        current.Type == EnmSMGType.Hall)
                    {
                        isReset = true;
                    }

                    current.IsAvailabe = smg.IsAvailabe;
                    current.IsAble     = smg.IsAble;
                    current.RunStep    = smg.RunStep;
                    current.InStep     = smg.InStep;
                    current.OutStep    = smg.OutStep;
                    current.Mode       = smg.Mode;
                    current.Address    = smg.Address;

                    cwdevice.Update(current);

                    if (isReset && current.TaskID != 0)
                    {
                        await new CWTask().ResetHallOnlyHasTaskAsync(current.Warehouse, current.DeviceCode);
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
            }

            return(Content("success"));
        }
Beispiel #4
0
        /// <summary>
        /// 获取移动设备清单
        /// </summary>
        /// <returns></returns>
        public JsonResult GetEtvsName()
        {
            List <SelectItem> itemsLst = new List <SelectItem>();

            #region
            List <Device> hallsLst = new CWDevice().FindList(dv => dv.Type == EnmSMGType.ETV);
            foreach (Device dev in hallsLst)
            {
                SelectItem item = new SelectItem
                {
                    OptionValue = dev.DeviceCode.ToString(),
                    OptionText  = dev.DeviceCode.ToString() + " #ETV"
                };
                itemsLst.Add(item);
            }
            #endregion
            return(Json(itemsLst, JsonRequestBehavior.AllowGet));
        }
Beispiel #5
0
        /// <summary>
        /// 填充出车厅
        /// </summary>
        public JsonResult GetOutHallName()
        {
            List <SelectItem> itemsLst = new List <SelectItem>();

            #region
            List <Device> hallsLst = new CWDevice().FindList(dv => dv.Type == EnmSMGType.Hall &&
                                                             (dv.HallType == EnmHallType.EnterOrExit || dv.HallType == EnmHallType.Exit));
            foreach (Device dev in hallsLst)
            {
                SelectItem item = new SelectItem
                {
                    OptionValue = dev.DeviceCode.ToString(),
                    OptionText  = (dev.DeviceCode - 10).ToString() + " #车厅"
                };
                itemsLst.Add(item);
            }
            #endregion
            return(Json(itemsLst, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Edit(int ID, int IsAble, string HallType)
        {
            Response resp = new Response();
            Log      log  = LogFactory.GetLogger("POST Edit");

            try
            {
                Device smg = new CWDevice().Find(dev => dev.ID == ID);
                if (smg == null)
                {
                    return(RedirectToAction("Index"));
                }
                if (IsAble > 1)
                {
                    ModelState.AddModelError("", "<可用性> 只允许输入:0、1  两种");
                    return(View(smg));
                }
                smg.IsAble = IsAble;
                if (smg.Type == EnmSMGType.Hall)
                {
                    EnmHallType htype = EnmHallType.Init;
                    bool        nback = Enum.TryParse(HallType, out htype);
                    if (nback)
                    {
                        smg.HallType = htype;
                    }
                    else
                    {
                        ModelState.AddModelError("", " <车厅类型> 不正确,只允许输入:Entrance、Exit、EnterOrExit 三种");
                        return(View(smg));
                    }
                }
                resp = new CWDevice().Update(smg);
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult GetSelectItemName(int warehouse)
        {
            List <SelectItem> items = new List <SelectItem>();
            //先以一个库算,后面做联动查询的
            List <Device> devLst = new CWDevice().FindList(d => d.Warehouse == warehouse);

            foreach (Device dev in devLst)
            {
                if (dev.DeviceCode > 10)
                {
                    items.Add(new SelectItem {
                        OptionValue = dev.DeviceCode.ToString(), OptionText = "车厅 " + (dev.DeviceCode - 10).ToString()
                    });
                }
                else
                {
                    items.Add(new SelectItem {
                        OptionValue = dev.DeviceCode.ToString(), OptionText = "TV" + dev.DeviceCode.ToString()
                    });
                }
            }
            return(Json(items, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Detail(int?ID)
        {
            Device smg = new CWDevice().Find(dev => dev.ID == ID);

            return(View(smg));
        }
        /// <summary>
        /// 自由分配车厅,以取车位的区域、ETV作用范围来决定
        /// 车厅分配原则:
        ///  一、两车厅都可用的;
        ///     如果两个车厅都空闲;
        ///     1、如果两ETV都空闲可用,则从哪里刷卡,哪里出车;
        ///     2、如果有一台ETV空闲可用,如果可达车位,则选择与ETV区域一致的车厅出车;
        ///     3、如果两台ETV都忙,则分配与车位区域一致的车厅出车 ;
        ///  二、只有一个车厅可用的,则只能选一个;
        /// </summary>
        /// <param name="mohall"></param>
        /// <param name="loc"></param>
        /// <param name=""></param>
        /// <returns></returns>
        public Device Allocate(Device mohall, Location loc)
        {
            CWDevice cwdevice = new CWDevice();
            CWTask   cwtask   = new CWTask();

            List <Device> nEtvList  = cwdevice.FindList(d => d.Type == EnmSMGType.ETV);
            WorkScope     workscope = new WorkScope(nEtvList);
            int           hallColmn = Convert.ToInt32(mohall.Address.Substring(1, 2));
            int           locColmn  = loc.LocColumn;
            //找出模式是全自动的出车厅的集合
            List <Device> hallsLst = cwdevice.FindList(h => h.Type == EnmSMGType.Hall &&
                                                       h.HallType != EnmHallType.Entrance &&
                                                       h.Mode == EnmModel.Automatic);

            if (hallsLst.Count == 2)
            {
                List <Device>   availEtvsLst    = nEtvList.FindAll(e => e.IsAble == 1);
                List <WorkTask> hastaskWorkTask = cwtask.FindQueueList(mtsk => mtsk.IsMaster == 2);
                #region
                List <Device> freeHallsLst = hallsLst.FindAll(h => h.TaskID == 0 && hastaskWorkTask.Exists(mtsk => mtsk.DeviceCode == h.DeviceCode) == false).OrderBy(d => Math.Abs(d.Region - loc.Region)).ToList();
                //如果两个车厅都空闲的
                if (freeHallsLst.Count == 2)
                {
                    #region
                    if (availEtvsLst.Count == 2)
                    {
                        return(mohall);
                    }
                    else if (availEtvsLst.Count == 1)
                    {
                        #region
                        Device cetv  = availEtvsLst[0];
                        CScope scope = workscope.GetEtvScope(cetv);
                        if (locColmn >= scope.LeftCol && locColmn <= scope.RightCol)
                        {
                            //优先刷卡车厅
                            if ((hallColmn >= scope.LeftCol && hallColmn <= scope.RightCol))
                            {
                                return(mohall);
                            }
                            //如果没有的,则再查找
                            foreach (Device ha in freeHallsLst)
                            {
                                int hallCol = Convert.ToInt32(ha.Address.Substring(1, 2));
                                if (hallCol >= scope.LeftCol && hallCol <= scope.RightCol)
                                {
                                    return(ha);
                                }
                            }
                        }
                        #endregion
                    }
                    #endregion
                }
                else if (freeHallsLst.Count == 1)
                {
                    Device hall = freeHallsLst[0];
                    #region
                    //在空闲的车厅刷卡
                    if (hall.DeviceCode == mohall.DeviceCode &&
                        hall.Warehouse == mohall.Warehouse)
                    {
                        #region
                        if (availEtvsLst.Count == 2)
                        {
                            return(mohall);
                        }
                        else if (availEtvsLst.Count == 1)
                        {
                            Device cetv  = availEtvsLst[0];
                            CScope scope = workscope.GetEtvScope(cetv);
                            if (locColmn >= scope.LeftCol && locColmn <= scope.RightCol)
                            {
                                if ((hallColmn >= scope.LeftCol && hallColmn <= scope.RightCol))
                                {
                                    return(mohall);
                                }
                            }
                        }
                        #endregion
                    }
                    else
                    {
                        #region
                        //不在空闲的车厅刷卡
                        if (availEtvsLst.Count == 2)
                        {
                            //取车位与空闲车厅是一个区的
                            if (hall.Region == loc.Region)
                            {
                                return(hall);
                            }
                            else
                            {
                                //或在公共区域内,也允许空闲的车厅去接车
                                int min = 7;
                                int max = 12;
                                if (locColmn > min && locColmn < max)
                                {
                                    return(hall);
                                }
                                else
                                {
                                    return(mohall);
                                }
                            }
                        }
                        else if (availEtvsLst.Count == 1)
                        {
                            Device cetv  = availEtvsLst[0];
                            CScope scope = workscope.GetEtvScope(cetv);

                            int hcolmn = Convert.ToInt32(hall.Address.Substring(1, 2));

                            if (locColmn >= scope.LeftCol && locColmn <= scope.RightCol)
                            {
                                if ((hcolmn >= scope.LeftCol && hcolmn <= scope.RightCol))
                                {
                                    return(hall);
                                }
                            }
                        }
                        #endregion
                    }
                    #endregion
                }

                List <Device> busyHallsLst = hallsLst.FindAll(h => h.TaskID != 0 || hastaskWorkTask.Exists(mtsk => mtsk.DeviceCode == h.DeviceCode)).OrderBy(d => Math.Abs(d.Region - loc.Region)).ToList();
                //如果两个都忙
                if (busyHallsLst.Count == 2)
                {
                    if (availEtvsLst.Count == 2)
                    {
                        return(busyHallsLst[0]);
                    }
                    else if (availEtvsLst.Count == 1)
                    {
                        #region
                        Device cetv  = availEtvsLst[0];
                        CScope scope = workscope.GetEtvScope(cetv);
                        if (locColmn >= scope.LeftCol && locColmn <= scope.RightCol)
                        {
                            //如果没有的,则再查找
                            foreach (Device ha in busyHallsLst)
                            {
                                int hallCol = Convert.ToInt32(ha.Address.Substring(1, 2));
                                if (hallCol >= scope.LeftCol && hallCol <= scope.RightCol)
                                {
                                    return(ha);
                                }
                            }
                        }
                        #endregion
                    }
                }
                #endregion
            }

            #region 找不到最佳出车厅,则选择当前车厅
            Device moEtv = null;
            foreach (Device etv in nEtvList)
            {
                if (etv.IsAble == 1)
                {
                    CScope scope = workscope.GetEtvScope(etv);
                    if ((hallColmn >= scope.LeftCol && hallColmn <= scope.RightCol) &&
                        (locColmn >= scope.LeftCol && locColmn <= scope.RightCol))
                    {
                        moEtv = etv;
                        break;
                    }
                }
            }
            if (moEtv == null)
            {
                return(null);
            }
            return(mohall);

            #endregion
        }
Beispiel #10
0
        public ActionResult RemoteTempGetInterface()
        {
            Response resp = new Response();

            #region
            Log log = LogFactory.GetLogger("RemoteTempGetInterface");
            try
            {
                byte[] bytes = new byte[Request.InputStream.Length];
                Request.InputStream.Read(bytes, 0, bytes.Length);
                string req = System.Text.Encoding.UTF8.GetString(bytes);
                //显示,记录
                log.Info(req);
                JObject jo = (JObject)JsonConvert.DeserializeObject(req);

                string plate = jo["platenum"].ToString();
                if (string.IsNullOrEmpty(plate))
                {
                    log.Info("参数错误,车牌为空的!");
                    resp.Message = "参数错误";
                    return(Json(resp));
                }
                Location loc = new CWLocation().FindLocation(lc => lc.PlateNum == plate);
                if (loc == null)
                {
                    log.Error("APP取物时,找不到取车位,plate - " + plate);
                    resp.Message = "没有存车";
                    return(Json(resp));
                }
                CWTask        motsk = new CWTask();
                ImplementTask task  = motsk.Find(tk => tk.ICCardCode == loc.ICCode);
                if (task != null)
                {
                    log.Error("APP取物时,车位正在作业,iccode - " + loc.ICCode + " ,plate - " + plate);
                    resp.Message = "正在作业";
                    return(Json(resp));
                }
                WorkTask queue = motsk.FindQueue(qu => qu.ICCardCode == loc.ICCode);
                if (queue != null)
                {
                    log.Error("APP取物时,已经加入队列,iccode - " + loc.ICCode + " ,plate - " + plate);
                    resp.Message = "已经加入队列";
                    return(Json(resp));
                }
                if (loc.Type != EnmLocationType.Normal)
                {
                    log.Error("APP取物时,车位已被禁用,address - " + loc.Address);
                    resp.Message = "车位已被禁用";
                    return(Json(resp));
                }
                //分配车厅
                int hallcode = new CWDevice().AllocateHall(loc, false);

                Device moHall = new CWDevice().Find(d => d.DeviceCode == hallcode);
                if (moHall != null)
                {
                    resp = motsk.TempGetCar(moHall, loc);
                }
                else
                {
                    resp.Message = "找不到合适车厅";
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
                resp.Message = "系统异常";
            }
            #endregion
            return(Json(resp));
        }
Beispiel #11
0
        /// <summary>
        /// APP,扫码或其它存车,
        /// </summary>
        /// <returns></returns>
        public ActionResult SaveCarInterface()
        {
            Response resp = new Response();

            #region
            Log log = LogFactory.GetLogger("SaveCarInterface");
            try
            {
                byte[] bytes = new byte[Request.InputStream.Length];
                Request.InputStream.Read(bytes, 0, bytes.Length);
                string req = System.Text.Encoding.UTF8.GetString(bytes);
                //显示,记录
                log.Info(req);
                JObject jo = (JObject)JsonConvert.DeserializeObject(req);

                string warehouse = jo["warehouse"].ToString();
                string hallID    = jo["hallID"].ToString();
                string iccode    = jo["iccode"].ToString();
                string plate     = jo["plateNum"].ToString();

                if (string.IsNullOrEmpty(hallID))
                {
                    log.Error("APP存车,hallID为空!");
                    resp.Message = "参数错误,hallID为空!";
                    return(Json(resp));
                }
                if (string.IsNullOrEmpty(plate))
                {
                    log.Error("APP存车,车牌号为空!");
                    resp.Message = "参数错误,车牌号为空!";
                    return(Json(resp));
                }

                int wh   = 1;
                int code = Convert.ToInt32(hallID);

                CWDevice cwdevice = new CWDevice();
                CWTask   motsk    = new CWTask();

                Device moHall = cwdevice.Find(dev => dev.Warehouse == wh && dev.DeviceCode == code);
                if (moHall == null)
                {
                    log.Error("APP存车时, 找不到车厅设备. warehouse - " + warehouse + " ,hallID - " + hallID);
                    resp.Message = "找不到车厅";
                    return(Json(resp));
                }
                if (moHall.Mode != EnmModel.Automatic)
                {
                    log.Error("APP存车时, 车厅不是全自动. warehouse - " + warehouse + " ,hallID - " + hallID);
                    resp.Message = "车厅不是全自动";
                    return(Json(resp));
                }
                if (moHall.HallType == EnmHallType.Entrance ||
                    moHall.HallType == EnmHallType.EnterOrExit)
                {
                    if (moHall.TaskID == 0)
                    {
                        //车厅无车,不能存车
                        log.Error("APP存车时, 车厅无车,不能存车. ");
                        resp.Message = "车厅无车,不能存车";
                        return(Json(resp));
                    }
                    ImplementTask tsk = motsk.Find(moHall.TaskID);
                    if (tsk == null)
                    {
                        log.Error("APP存车时, 依车厅TaskID找不到作业信息,TaskID-" + moHall.TaskID + "  hallCode-" + moHall.DeviceCode);
                        //系统故障
                        resp.Message = "系统异常,找不到作业";
                        return(Json(resp));
                    }
                    if (tsk.Status != EnmTaskStatus.ICarInWaitFirstSwipeCard &&
                        tsk.Status != EnmTaskStatus.TempOCarOutWaitforDrive)
                    {
                        log.Error("APP存车时,不是处于刷卡阶段");
                        resp.Message = "不是处于刷卡阶段";
                        return(Json(resp));
                    }
                    if (tsk.PlateNum != plate)
                    {
                        log.Error("APP存车时,入库识别车牌与给定车牌不一致");
                        resp.Message = "APP绑定车牌与车辆车牌不一致";
                        return(Json(resp));
                    }

                    CWICCard cwiccd = new CWICCard();

                    if (tsk.Type == EnmTaskType.SaveCar)
                    {
                        string   physiccode = "1234567890";
                        Customer cust       = cwiccd.FindCust(cc => cc.PlateNum == plate);
                        if (cust != null)
                        {
                            ICCard iccd = cwiccd.Find(ic => ic.CustID == cust.ID);
                            if (iccd != null)
                            {
                                iccode     = iccd.UserCode;
                                physiccode = iccd.PhysicCode;
                            }
                        }
                        CWSaveProof cwsaveproof = new CWSaveProof();
                        if (string.IsNullOrEmpty(iccode))
                        {
                            iccode = cwsaveproof.GetMaxSNO().ToString();
                        }

                        SaveCertificate scert = new SaveCertificate();
                        scert.IsFingerPrint = 2;
                        scert.Proof         = physiccode;
                        scert.SNO           = Convert.ToInt32(iccode);
                        //添加凭证到存车库中
                        Response respe = cwsaveproof.Add(scert);

                        tsk.PlateNum = plate;
                        //更新作业状态为第二次刷卡,启动流程
                        motsk.DealISwipedSecondCard(tsk, iccode);

                        resp.Code    = 1;
                        resp.Message = "流程进行中";
                        return(Json(resp));
                    }
                    else if (tsk.Type == EnmTaskType.TempGet)
                    {
                        motsk.DealAPPSwipeThreeCard(tsk);
                    }
                }
                else
                {
                    log.Error("APP存车时,不是进(进出)车厅");
                    resp.Message = "不是进(进出)车厅";
                    return(Json(resp));
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                resp.Message = "系统异常";
            }
            #endregion
            return(Json(resp));
        }
Beispiel #12
0
        /// <summary>
        /// APP,远程取车,只允许使用车牌取车
        /// </summary>
        /// <returns></returns>
        public ActionResult RemoteGetCarInterface()
        {
            Response resp = new Response();
            Log      log  = LogFactory.GetLogger("RemoteGetCarInterface");

            #region
            try
            {
                CWDevice cwdevice = new CWDevice();

                byte[] bytes = new byte[Request.InputStream.Length];
                Request.InputStream.Read(bytes, 0, bytes.Length);
                string req = System.Text.Encoding.UTF8.GetString(bytes);
                //显示,记录
                log.Info(req);
                JObject jo        = (JObject)JsonConvert.DeserializeObject(req);
                string  warehouse = jo["warehouse"].ToString();
                string  hallID    = jo["hallID"].ToString();
                string  plate     = jo["plateNum"].ToString();

                if (string.IsNullOrEmpty(plate))
                {
                    log.Error("车牌号为空的!");
                    resp.Message = "参数错误";
                    return(Json(resp));
                }
                #region 暂不用
                //int wh = Convert.ToInt32(warehouse);
                //int hcode = Convert.ToInt32(hallID);

                //Device moHall = cwdevice.Find(d => d.Warehouse == wh && d.DeviceCode == hcode);
                //if (moHall == null)
                //{
                //    log.Error("APP取车时,查找不到车厅,warehouse- " + warehouse + " ,hallID- " + hallID);
                //    resp.Message = "找不到车厅";
                //    return Json(resp);
                //}
                //if (moHall.Mode != EnmModel.Automatic)
                //{
                //    log.Error("APP取车时,车厅模式不是全自动 , Mode - " + moHall.Mode.ToString());
                //    resp.Message = "车厅不是全自动";
                //    return Json(resp);
                //}
                //if (moHall.HallType == EnmHallType.Entrance)
                //{
                //    log.Error("APP取车时,车厅不是出车厅,halltype - " + moHall.HallType.ToString());
                //    resp.Message = "车厅不是全自动";
                //    return Json(resp);
                //}
                #endregion
                Location loc = new CWLocation().FindLocation(lc => lc.PlateNum == plate);
                if (loc == null)
                {
                    log.Error("APP取车时,找不到取车位,plate - " + plate);
                    resp.Message = "没有存车";
                    return(Json(resp));
                }
                CWTask        motsk = new CWTask();
                ImplementTask task  = motsk.Find(tk => tk.ICCardCode == loc.ICCode && tk.IsComplete == 0);
                if (task != null)
                {
                    log.Error("APP取车时,车位正在作业,iccode - " + loc.ICCode + " ,plate - " + plate);
                    resp.Message = "正在作业";
                    return(Json(resp));
                }
                WorkTask queue = motsk.FindQueue(qu => qu.ICCardCode == loc.ICCode);
                if (queue != null)
                {
                    log.Error("APP取车时,已经加入队列,iccode - " + loc.ICCode + " ,plate - " + plate);
                    resp.Message = "已经加入队列";
                    return(Json(resp));
                }
                if (loc.Type != EnmLocationType.Normal)
                {
                    log.Error("APP取车时,车位已被禁用,address - " + loc.Address);
                    resp.Message = "车位已被禁用";
                    return(Json(resp));
                }
                if (loc.Status != EnmLocationStatus.Occupy)
                {
                    log.Error("APP取车时,当前车位正在任务业,address - " + loc.Address + " ,status - " + loc.Status.ToString());
                    resp.Message = "车位已被禁用";
                    return(Json(resp));
                }
                int mcount = new CWTask().FindQueueList(q => q.IsMaster == 2).Count();
                if (mcount > 6)
                {
                    log.Error("APP取车时,取车队列已满");
                    resp.Message = "取车队列已满";
                    return(Json(resp));
                }

                //分配车厅
                int    hallcode = new CWDevice().AllocateHall(loc, false);
                Device moHall   = new CWDevice().Find(d => d.DeviceCode == hallcode);

                if (moHall != null)
                {
                    resp = motsk.DealOSwipedCard(moHall, loc);

                    log.Info("APP取车,取车车位 - " + loc.Address + " ,出车车厅 - " + moHall.DeviceCode);
                }
                else
                {
                    resp.Message = "找不到合适车厅";
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
                resp.Message = "系统异常";
            }
            #endregion
            return(Json(resp));
        }