Beispiel #1
0
        public ActionResult Edit(int ID)
        {
            CustomerModel model  = new CustomerModel();
            CWICCard      cwiccd = new CWICCard();
            Customer      cust   = cwiccd.FindCust(ID);

            model.ID            = cust.ID;
            model.UserName      = cust.UserName;
            model.FamilyAddress = cust.FamilyAddress;
            model.MobilePhone   = cust.MobilePhone;
            model.PlateNum      = cust.PlateNum;
            model.Type          = cust.Type;
            model.Warehouse     = cust.Warehouse;
            model.LocAddress    = cust.LocAddress;
            model.Deadline      = cust.Deadline.ToString();

            ICCard iccd = cwiccd.Find(ic => ic.CustID == ID);

            if (iccd != null)
            {
                model.UserCode = iccd.UserCode;
                model.Status   = iccd.Status;
            }

            List <SelectListItem> items = new List <SelectListItem>();

            foreach (var tp in Enum.GetValues(typeof(EnmICCardType)))
            {
                SelectListItem item = new SelectListItem()
                {
                    Text = tp.ToString(), Value = tp.ToString()
                };
                items.Add(item);
            }
            ViewData["list"] = items;

            #region 查找指纹
            List <FingerPrint> printList = new CWFingerPrint().FindList(p => p.CustID == ID);
            if (printList.Count == 1)
            {
                model.FingerPrint1 = printList[0].SN_Number.ToString();
            }
            if (printList.Count == 2)
            {
                model.FingerPrint1 = printList[0].SN_Number.ToString();
                model.FingerPrint2 = printList[1].SN_Number.ToString();
            }
            if (printList.Count == 3)
            {
                model.FingerPrint1 = printList[0].SN_Number.ToString();
                model.FingerPrint2 = printList[1].SN_Number.ToString();
                model.FingerPrint3 = printList[2].SN_Number.ToString();
            }
            #endregion

            return(View(model));
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="custID"></param>
        /// <returns></returns>
        public ActionResult ChangeDeadline(int custID)
        {
            CWICCard            cwiccd   = new CWICCard();
            Customer            cust     = cwiccd.FindCust(custID);
            ChangeDeadlineModel deadline = new ChangeDeadlineModel
            {
                ID          = cust.ID,
                UserCode    = cust.UserName,
                Type        = cust.Type,
                OldDeadline = cust.Deadline,
                NewDeadline = DateTime.Parse("2017-1-1")
            };

            return(View(deadline));
        }
Beispiel #3
0
        public ActionResult Delete(int ID)
        {
            #region
            CWICCard cwiccd = new CWICCard();
            Customer cust   = cwiccd.FindCust(ID);
            if (cust != null)
            {
                ICCard iccd = cwiccd.Find(ic => ic.CustID == ID);
                if (iccd != null)
                {
                    iccd.CustID = 0;
                    Response _resp = cwiccd.Update(iccd);
                    if (_resp.Code == 0)
                    {
                        //记录
                    }
                }
                Response resp = cwiccd.Delete(ID);
                if (resp.Code == 0)
                {
                    var data = new
                    {
                        code    = 1,
                        message = "删除用户失败,请联系管理员!"
                    };
                    return(Json(data, JsonRequestBehavior.AllowGet));
                }

                #region  除相关指纹
                CWFingerPrint      fprint    = new CWFingerPrint();
                List <FingerPrint> fingerLst = fprint.FindList(p => p.CustID == ID);
                foreach (FingerPrint print in fingerLst)
                {
                    fprint.Delete(print.ID);
                }
                #endregion
            }
            #endregion
            var nback = new
            {
                code    = 2,
                message = "删除成功!"
            };
            return(Json(nback, JsonRequestBehavior.AllowGet));
        }
Beispiel #4
0
        /// <summary>
        /// 固定用户收费界面出车
        /// </summary>
        /// <returns></returns>
        public ActionResult FixGUIOutCar(int type, string uiccd, int warehouse, int hallID)
        {
            Response resp = new Response();

            #region
            Log log = LogFactory.GetLogger("FixGUIOutCar");
            try
            {
                CWICCard   cwiccd = new CWICCard();
                CWLocation cwlctn = new CWLocation();
                Customer   cust   = null;
                #region
                Location loc = null;
                if (type == 1)
                {
                    #region
                    ////是卡号
                    //ICCard iccd = cwiccd.Find(ic => ic.UserCode == uiccd);
                    //if (iccd == null)
                    //{
                    //    resp.Message = "不是本系统用卡,iccode - " + uiccd;
                    //    return Json(resp, JsonRequestBehavior.AllowGet);
                    //}
                    //if (iccd.CustID == 0)
                    //{
                    //    resp.Message = "当前用卡为临时用卡,无法完成操作! ICCode - " + uiccd;
                    //    return Json(resp, JsonRequestBehavior.AllowGet);
                    //}
                    //cust = cwiccd.FindCust(iccd.CustID);
                    #endregion
                    loc = cwlctn.FindLocation(l => l.ICCode == uiccd);
                }
                else if (type == 2)
                {
                    loc = cwlctn.FindLocation(l => l.PlateNum == uiccd);
                }
                if (loc == null)
                {
                    resp.Message = "当前用户没有存车! Proof - " + uiccd;
                    return(Json(resp, JsonRequestBehavior.AllowGet));
                }
                int             sno   = Convert.ToInt32(loc.ICCode);
                SaveCertificate scert = new CWSaveProof().Find(s => s.SNO == sno);
                if (scert != null)
                {
                    cust = new CWICCard().FindCust(scert.CustID);
                }
                if (type == 3)
                {
                    //是车主姓名
                    cust = cwiccd.FindCust(cc => cc.UserName == uiccd);
                }
                if (cust == null)
                {
                    resp.Message = "不是注册用户,无法进行操作!iccode - " + uiccd;
                    return(Json(resp, JsonRequestBehavior.AllowGet));
                }
                if (cust.Type == EnmICCardType.Temp)
                {
                    resp.Message = "临时用户,不在此界面缴费! iccode - " + uiccd;
                    return(Json(resp, JsonRequestBehavior.AllowGet));
                }
                if (DateTime.Compare(DateTime.Now, cust.Deadline) > 0)
                {
                    resp.Message = "当前用户已欠费,请缴费后出车! iccode - " + uiccd + " ,Deadline- " + cust.Deadline.ToString();
                    return(Json(resp, JsonRequestBehavior.AllowGet));
                }
                ////如果是以车牌或用户名取车,
                //if (type > 1)
                //{
                //    loc = cwlctn.FindLocation(lc => lc.PlateNum == cust.PlateNum);
                //    //以车牌找不到存车车辆,则以卡号进行查询
                //    if (loc == null)
                //    {
                //        //以绑定的卡号查询
                //        ICCard iccd = cwiccd.Find(ic => ic.CustID == cust.ID);
                //        if (iccd != null)
                //        {
                //            loc = cwlctn.FindLocation(l => l.ICCode == iccd.UserCode);
                //        }
                //    }
                //}
                #endregion
                resp = new CWTaskTransfer(hallID, warehouse).FixGUIGetCar(loc);
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
            }
            #endregion
            return(Json(resp, JsonRequestBehavior.AllowGet));
        }
Beispiel #5
0
        /// <summary>
        /// 查询用户信息
        /// </summary>
        /// <param name="type"></param>
        /// <param name="uiccd"></param>
        /// <returns></returns>
        public async Task <JsonResult> QueryCustInfo(int type, string uiccd)
        {
            Response resp = new Response();

            #region
            CWICCard cwiccd = new CWICCard();
            Customer cust   = null;
            if (type == 1)
            {
                //是卡号
                ICCard iccd = await cwiccd.FindAsync(ic => ic.UserCode == uiccd);

                if (iccd == null)
                {
                    resp.Message = "不是本系统用卡,iccode - " + uiccd;
                    return(Json(resp, JsonRequestBehavior.AllowGet));
                }
                if (iccd.CustID == 0)
                {
                    resp.Message = "当前用卡为临时用卡,无法完成操作! ICCode - " + uiccd;
                    return(Json(resp, JsonRequestBehavior.AllowGet));
                }
                cust = cwiccd.FindCust(iccd.CustID);
            }
            else if (type == 2)
            {
                //是车牌
                cust = await cwiccd.FindCustAsync(cc => cc.PlateNum == uiccd);
            }
            else if (type == 3)
            {
                //是车主姓名
                cust = await cwiccd.FindCustAsync(cc => cc.UserName == uiccd);
            }
            if (cust == null)
            {
                resp.Message = "当前用户不存在,无法进行操作!iccode - " + uiccd;
                return(Json(resp, JsonRequestBehavior.AllowGet));
            }
            if (cust.Type == EnmICCardType.Temp)
            {
                resp.Message = "临时用户,不在此界面缴费! iccode - " + uiccd;
                return(Json(resp, JsonRequestBehavior.AllowGet));
            }

            FixChargingRule rule = new CWTariff().FindFixCharge(fix => fix.Unit == EnmFeeUnit.Month && fix.ICType == cust.Type);
            if (rule == null)
            {
                resp.Message = "找不到(月份)收费规则,ICType - " + cust.Type.ToString();
                return(Json(resp, JsonRequestBehavior.AllowGet));
            }

            FixCustInfo info = new FixCustInfo
            {
                CustID       = cust.ID,
                Proof        = uiccd,
                ICType       = (int)cust.Type,
                CurrDeadline = cust.Deadline.ToString(),
                MonthFee     = rule.Fee
            };
            resp.Code    = 1;
            resp.Message = "查询成功";
            resp.Data    = info;

            TempData["CustInfo"] = info;
            #endregion
            return(Json(resp, JsonRequestBehavior.AllowGet));
        }
Beispiel #6
0
        public ActionResult Edit(CustomerModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            CWICCard cwiccd = new CWICCard();

            #region 验证用户名、车牌号
            //顾客姓名保证唯一的
            Customer other = cwiccd.FindCust(cu => cu.UserName == model.UserName && cu.ID != model.ID);
            if (other != null)
            {
                ModelState.AddModelError("", "当前顾客名-  " + model.UserName +
                                         " 已被占用,其车牌号- " + other.PlateNum + " ,请输入唯一的用户名!");
                return(View(model));
            }
            //车牌号码保证唯一的
            other = cwiccd.FindCust(cu => cu.PlateNum == model.PlateNum && cu.ID != model.ID);
            if (other != null)
            {
                ModelState.AddModelError("", "当前车牌号-  " + model.PlateNum +
                                         " 已被绑定,其顾客名- " + other.UserName + " ,请输入正确的车牌号!");
                return(View(model));
            }
            #endregion
            #region
            Customer cust    = cwiccd.FindCust(model.ID);
            Location origloc = null;
            //原来是否绑定
            if (cust.Type == EnmICCardType.FixedLocation)
            {
                origloc = new CWLocation().FindLocation(l => l.Warehouse == cust.Warehouse && l.Address == cust.LocAddress);
            }

            //是固定卡时
            if (model.Type == EnmICCardType.FixedLocation)
            {
                #region
                if (model.Warehouse == 0 || string.IsNullOrEmpty(model.LocAddress))
                {
                    ModelState.AddModelError("", "固定卡,请指定绑定的库区及车位号!");
                    return(View(model));
                }
                Location lctn = new CWLocation().FindLocation(lc => lc.Warehouse == model.Warehouse && lc.Address == model.LocAddress);
                if (lctn == null)
                {
                    ModelState.AddModelError("", "固定卡,请正确的库区及车位地址!");
                    return(View(model));
                }
                else
                {
                    //固定车位时,当前车位没有存车
                    if (lctn.Status != EnmLocationStatus.Space)
                    {
                        ModelState.AddModelError("", "当前车位:" + lctn.Address + " 已存车,卡号- " + lctn.ICCode + " ,请等待取车完成后再绑定!");
                        return(View(model));
                    }
                }

                Customer custo = cwiccd.FindCust(cc => cc.Warehouse == model.Warehouse && cc.LocAddress == model.LocAddress);
                if (custo != null)
                {
                    if (custo.ID != cust.ID)
                    {
                        ModelState.AddModelError("", "当前车位已被别的用户绑定");
                        return(View(model));
                    }
                }
                cust.Type       = model.Type;
                cust.Warehouse  = (int)model.Warehouse;
                cust.LocAddress = model.LocAddress;

                //释放原车位
                if (origloc != null)
                {
                    if (origloc.Address != lctn.Address)
                    {
                        SingleCallback.Instance().WatchFixLocation(origloc, 0, "", "", "");
                    }
                }
                //绑定当前车位
                SingleCallback.Instance().WatchFixLocation(lctn, 1, cust.UserName, cust.Deadline.ToString(), cust.PlateNum);
                #endregion
            }
            else
            {
                cust.Type       = model.Type;
                cust.Warehouse  = 0;
                cust.LocAddress = "";
                cust.StartDTime = DateTime.Parse("2017-1-1");
                cust.Deadline   = DateTime.Parse("2017-1-1");

                //释放原车位
                if (origloc != null)
                {
                    SingleCallback.Instance().WatchFixLocation(origloc, 0, "", "", "");
                }
            }

            ICCard oriIccd = cwiccd.Find(ic => ic.CustID == model.ID);
            ICCard newIccd = null;
            if (!string.IsNullOrEmpty(model.UserCode))
            {
                newIccd = cwiccd.Find(ic => ic.UserCode == model.UserCode);
                if (newIccd == null)
                {
                    ModelState.AddModelError("", "当前卡号没有注册!");
                    return(View(model));
                }
            }
            if (oriIccd == null)
            {
                //原先没有绑定的
                if (newIccd != null)
                {
                    newIccd.CustID = cust.ID;
                    cwiccd.Update(newIccd);
                }
            }
            else
            {
                if (newIccd == null)
                {
                    //释放原来卡号
                    //释放旧卡
                    oriIccd.CustID = 0;
                    cwiccd.Update(oriIccd);
                }
                else //两卡都存在
                {
                    //不是同一张卡
                    if (oriIccd.UserCode != newIccd.UserCode)
                    {
                        #region
                        if (newIccd.Status != EnmICCardStatus.Normal)
                        {
                            ModelState.AddModelError("", "卡已挂失或注销,无法绑定用户!");
                            return(View(model));
                        }
                        if (newIccd.CustID != 0)
                        {
                            Customer oricust = cwiccd.FindCust(newIccd.CustID);
                            if (oricust != null)
                            {
                                ModelState.AddModelError("", "该卡已被绑定,车主姓名:" + oricust.UserName);
                                return(View(model));
                            }
                        }
                        #endregion
                        //释放旧卡
                        oriIccd.CustID = 0;
                        cwiccd.Update(oriIccd);
                        //绑定新卡
                        newIccd.CustID = cust.ID;
                        cwiccd.Update(newIccd);
                    }
                }
            }

            //允许更新
            cust.PlateNum      = model.PlateNum;
            cust.MobilePhone   = model.MobilePhone;
            cust.UserName      = model.UserName;
            cust.FamilyAddress = model.FamilyAddress;

            cwiccd.UpdateCust(cust);


            #region 更新指纹
            CWFingerPrint cwfprint = new CWFingerPrint();
            if (model.FingerPrint1 != "")
            {
                int         fpvalue = Convert.ToInt32(model.FingerPrint1);
                FingerPrint fp      = cwfprint.Find(fi => fi.SN_Number == fpvalue);
                if (fp != null)
                {
                    if (fp.CustID == 0)
                    {
                        fp.CustID = cust.ID;
                        cwfprint.Update(fp);
                    }
                }
            }
            if (model.FingerPrint2 != "")
            {
                int         fpvalue = Convert.ToInt32(model.FingerPrint2);
                FingerPrint fp      = cwfprint.Find(fi => fi.SN_Number == fpvalue);
                if (fp != null)
                {
                    if (fp.CustID == 0)
                    {
                        fp.CustID = cust.ID;
                        cwfprint.Update(fp);
                    }
                }
            }
            if (model.FingerPrint3 != "")
            {
                int         fpvalue = Convert.ToInt32(model.FingerPrint3);
                FingerPrint fp      = cwfprint.Find(fi => fi.SN_Number == fpvalue);
                if (fp != null)
                {
                    if (fp.CustID == 0)
                    {
                        fp.CustID = cust.ID;
                        cwfprint.Update(fp);
                    }
                }
            }
            #endregion

            #endregion
            return(RedirectToAction("Index"));
        }
Beispiel #7
0
        public ActionResult Add(CustomerModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            CWICCard cwiccd = new CWICCard();
            //顾客姓名保证唯一的
            Customer other = cwiccd.FindCust(cu => cu.UserName == model.UserName);

            if (other != null)
            {
                ModelState.AddModelError("", "当前顾客名-  " + model.UserName + " 已被占用,其车牌号- " + other.PlateNum + " ,请输入唯一的用户名!");
                return(View(model));
            }
            string plate = "";

            foreach (char vl in model.PlateNum)
            {
                if (Char.IsLetter(vl))
                {
                    plate += char.ToUpper(vl);
                }
                else
                {
                    plate += vl;
                }
            }

            model.PlateNum = plate;

            //车牌号码保证唯一的
            other = cwiccd.FindCust(cu => cu.PlateNum == model.PlateNum);
            if (other != null)
            {
                ModelState.AddModelError("", "当前车牌号-  " + model.PlateNum + " 已被绑定,其顾客名- " + other.UserName + " ,请输入正确的车牌号!");
                return(View(model));
            }
            Location lctn = null;

            #region
            if (model.Type == EnmICCardType.FixedLocation)
            {
                if (model.Warehouse == 0 || string.IsNullOrEmpty(model.LocAddress))
                {
                    ModelState.AddModelError("", "固定车位卡,请指定绑定车位!");
                    return(View(model));
                }
                lctn = new CWLocation().FindLocation(lc => lc.Warehouse == model.Warehouse && lc.Address == model.LocAddress);
                if (lctn == null)
                {
                    ModelState.AddModelError("", "绑定车位不存在,地址-" + model.LocAddress);
                    return(View(model));
                }
                else
                {
                    //固定车位时,当前车位没有存车
                    if (lctn.Status != EnmLocationStatus.Space)
                    {
                        ModelState.AddModelError("", "当前车位:" + lctn.Address + " 已存车,卡号- " + lctn.ICCode + " ,请等待取车完成后再绑定!");
                        return(View(model));
                    }
                }
            }

            ICCard iccd = null;
            if (!string.IsNullOrEmpty(model.UserCode))
            {
                #region
                iccd = cwiccd.Find(ic => ic.UserCode == model.UserCode);
                if (iccd == null)
                {
                    ModelState.AddModelError("", "当前用户卡号没有注册,请确保该卡已完成制卡!");
                    return(View(model));
                }
                if (iccd.Status != EnmICCardStatus.Normal)
                {
                    ModelState.AddModelError("", "该卡已挂失或注销,无法完成操作!");
                    return(View(model));
                }
                if (iccd.CustID != 0)
                {
                    Customer cust = cwiccd.FindCust(iccd.CustID);
                    if (cust != null)
                    {
                        ModelState.AddModelError("", "该卡已被绑定,车主姓名:" + cust.UserName);
                        return(View(model));
                    }
                }
                #endregion
            }

            Customer addcust = new Customer();
            if (model.Type == EnmICCardType.FixedLocation)
            {
                Customer cust = cwiccd.FindCust(cc => cc.Warehouse == model.Warehouse && cc.LocAddress == model.LocAddress);
                if (cust != null)
                {
                    ModelState.AddModelError("", "该车位已被其他卡绑定,无法使用该车位- " + model.LocAddress + " ,Warehouse- " + model.Warehouse);
                    return(View(model));
                }
                addcust.Warehouse  = (int)model.Warehouse;
                addcust.LocAddress = model.LocAddress;
            }

            addcust.UserName      = model.UserName;
            addcust.PlateNum      = model.PlateNum;
            addcust.FamilyAddress = model.FamilyAddress;
            addcust.MobilePhone   = model.MobilePhone;
            addcust.Type          = EnmICCardType.Temp;
            if ((int)model.Type > 0)
            {
                addcust.Type = model.Type;
            }
            addcust.StartDTime = DateTime.Parse("2017-1-1");
            addcust.Deadline   = DateTime.Parse("2017-1-1");

            Response resp = cwiccd.AddCust(addcust);
            if (resp.Code == 1)
            {
                //如果有卡号,则绑定顾客于卡号
                if (iccd != null)
                {
                    iccd.CustID = addcust.ID;
                    resp        = cwiccd.Update(iccd);
                }

                #region 绑定指纹,更新指纹信息
                CWFingerPrint fprint = new CWFingerPrint();
                if (!string.IsNullOrEmpty(model.FingerPrint1))
                {
                    Int32       sn     = Convert.ToInt32(model.FingerPrint1);
                    FingerPrint finger = fprint.Find(p => p.SN_Number == sn);
                    if (finger != null)
                    {
                        finger.CustID = addcust.ID;
                        fprint.Update(finger);
                    }
                }
                if (!string.IsNullOrEmpty(model.FingerPrint2))
                {
                    Int32       sn     = Convert.ToInt32(model.FingerPrint2);
                    FingerPrint finger = fprint.Find(p => p.SN_Number == sn);
                    if (finger != null)
                    {
                        finger.CustID = addcust.ID;
                        fprint.Update(finger);
                    }
                }
                if (!string.IsNullOrEmpty(model.FingerPrint3))
                {
                    Int32       sn     = Convert.ToInt32(model.FingerPrint3);
                    FingerPrint finger = fprint.Find(p => p.SN_Number == sn);
                    if (finger != null)
                    {
                        finger.CustID = addcust.ID;
                        fprint.Update(finger);
                    }
                }
                #endregion
            }

            if (addcust.Type == EnmICCardType.FixedLocation)
            {
                SingleCallback.Instance().WatchFixLocation(lctn, 1, addcust.UserName, addcust.Deadline.ToString(), addcust.PlateNum);
            }

            #endregion
            return(RedirectToAction("Index"));
        }
Beispiel #8
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));
        }