public ActionResult TransferLoc()
        {
            string wh = Request.Form["txtTransWh"];

            if (string.IsNullOrEmpty(wh))
            {
                return(Content("库区为空,传输数据丢失!"));
            }
            int        warehouse = Convert.ToInt32(wh);
            string     fromAddrs = Request.Form["txtFrom"];
            string     toAddrs   = Request.Form["txtTo"];
            CWLocation cwlctn    = new CWLocation();
            Location   fromLoc   = cwlctn.FindLocation(lc => lc.Warehouse == warehouse && lc.Address == fromAddrs);

            if (fromLoc == null)
            {
                return(Content("找不到源车位-" + fromAddrs));
            }
            Location toLoc = cwlctn.FindLocation(lc => lc.Warehouse == warehouse && lc.Address == toAddrs);

            if (toLoc == null)
            {
                return(Content("找不到目的车位-" + toLoc));
            }
            int ret = new CWLocation().TransportLoc(fromLoc, toLoc);

            if (ret == 1)
            {
                return(Content("操作成功!"));
            }
            else
            {
                return(Content("操作引发异常!"));
            }
        }
Beispiel #2
0
        public ActionResult QueryParkingFee()
        {
            ParkingFeeInfo resp = new ParkingFeeInfo();

            #region
            Log log = LogFactory.GetLogger("QueryParkingFee");
            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  iccode = jo["iccode"].ToString();
                string  plate  = jo["plateNum"].ToString();

                CWLocation cwlctn = new CWLocation();
                Location   loc    = null;
                if (!string.IsNullOrEmpty(plate))
                {
                    loc = cwlctn.FindLocation(lc => lc.PlateNum == plate);
                }
                if (loc == null)
                {
                    if (!string.IsNullOrEmpty(iccode))
                    {
                        loc = cwlctn.FindLocation(lc => lc.ICCode == iccode);
                    }
                }
                if (loc == null)
                {
                    log.Error("APP查询费用时, 找不到取车位, plate - " + plate + " ,iccode-" + iccode);
                    resp.Message = "没有存车";
                    return(Json(resp));
                }
                float    fee = 0;
                Response res = new CWTariff().CalculateTempFee(loc.InDate, DateTime.Now, out fee);
                if (res.Code == 1)
                {
                    resp.Code     = 1;
                    resp.Message  = "查询费用成功";
                    resp.Fee      = fee;
                    resp.InDtime  = loc.InDate.ToString();
                    resp.OutDtime = DateTime.Now.ToString();
                }
                else
                {
                    log.Error("APP查询费用,系统异常- " + resp.Message);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
                resp.Message = "系统异常";
            }
            #endregion
            return(Json(resp));
        }
Beispiel #3
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 #4
0
        /// <summary>
        /// APP,预定、取消预定车位
        /// </summary>
        /// <returns></returns>
        public ActionResult RemoteBookLoc()
        {
            Response resp = new Response();
            Log      log  = LogFactory.GetLogger("RemoteBookLoc");

            #region
            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  type  = jo["ptype"].ToString();
                string  wh    = jo["warehouse"].ToString();
                string  proof = jo["proof"].ToString();
                string  plate = jo["platenum"].ToString();

                if (string.IsNullOrEmpty(proof) ||
                    string.IsNullOrEmpty(type))
                {
                    log.Error("参数错误,车位尺寸或接口类型 有为空的!");
                    resp.Message = "参数错误";
                    return(Json(resp));
                }
                if (string.IsNullOrEmpty(plate))
                {
                    log.Error("参数错误:车位预定时,车牌为空的!");
                    resp.Message = "参数错误";
                    return(Json(resp));
                }
                CWLocation cwlctn = new CWLocation();

                int deftype = Convert.ToInt32(type);
                //车位预定
                if (deftype == 3)
                {
                    Location lctn = cwlctn.FindLocation(l => l.PlateNum == plate);
                    if (lctn != null)
                    {
                        if (lctn.Status == EnmLocationStatus.Book)
                        {
                            resp.Message = "当前车辆已预约";
                        }
                        else
                        {
                            resp.Message = "当前车辆已存车";
                        }
                        log.Error("当前车辆已存在,不允许预约!");
                        return(Json(resp));
                    }

                    string checkcode = "122";
                    if (proof == "111")
                    {
                        checkcode = "121";
                    }
                    Location loc = new AllocateLocByBook().AllocateLoc(checkcode);
                    if (loc != null)
                    {
                        loc.Status   = EnmLocationStatus.Book;
                        loc.PlateNum = plate;
                        loc.InDate   = DateTime.Now;
                        cwlctn.UpdateLocation(loc);

                        resp.Code    = 1;
                        resp.Message = "预定成功";

                        log.Info("预定成功, checkcode - " + proof + " ,address - " + loc.Address + " ,locsize - " + loc.LocSize);
                    }
                    else
                    {
                        resp.Message = "找不到合适车位";
                    }
                }
                else if (deftype == 4)
                {
                    Location loc = cwlctn.FindLocation(lc => lc.PlateNum == plate && lc.Status == EnmLocationStatus.Book);
                    if (loc != null)
                    {
                        loc.Status   = EnmLocationStatus.Space;
                        loc.PlateNum = "";
                        loc.InDate   = DateTime.Parse("2017-1-1");
                        cwlctn.UpdateLocation(loc);

                        resp.Code    = 1;
                        resp.Message = "取消预定成功";
                    }
                    else
                    {
                        resp.Message = "车辆没有预定车位";
                    }
                }
                else
                {
                    resp.Message = "接口类型不正确,type- " + type;
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
                resp.Message = "系统异常";
            }
            #endregion
            return(Json(resp));
        }
Beispiel #5
0
        public ActionResult RemoteCancelGetCarIFace()
        {
            Response resp = new Response();
            Log      log  = LogFactory.GetLogger("RemoteCancelGetCarIFace");

            #region 取消取车
            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  iccode = jo["iccode"].ToString();
                string  plate  = jo["platenum"].ToString();

                CWTask     motask = new CWTask();
                CWLocation cwlctn = new CWLocation();
                #region  用
                //if (!string.IsNullOrEmpty(iccode))
                //{
                //    WorkTask mtsk = motask.FindQueue(mt => mt.ICCardCode == iccode);
                //    if (mtsk != null)
                //    {
                //        Location loc = cwlctn.FindLocation(lc => lc.ICCode == iccode);
                //        loc.Status = EnmLocationStatus.Occupy;
                //        cwlctn.UpdateLocation(loc);

                //        resp = motask.DeleteQueue(mtsk.ID);
                //        return Json(resp);
                //    }
                //}
                #endregion
                if (!string.IsNullOrEmpty(plate))
                {
                    Location loc = cwlctn.FindLocation(lc => lc.PlateNum == plate);
                    if (loc != null)
                    {
                        WorkTask mtsk = motask.FindQueue(mt => mt.ICCardCode == loc.ICCode);
                        if (mtsk != null)
                        {
                            loc.Status = EnmLocationStatus.Occupy;
                            cwlctn.UpdateLocation(loc);

                            motask.DeleteQueue(mtsk.ID);
                            resp.Code    = 1;
                            resp.Message = "取消成功";
                            return(Json(resp));
                        }
                        else
                        {
                            resp.Code    = 1;
                            resp.Message = "当前车辆还没有取车";
                        }
                    }
                    else
                    {
                        resp.Message = "车辆不在库里";
                    }
                }
                else
                {
                    resp.Message = "车牌不允许为空";
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
            }
            #endregion
            return(Json(resp));
        }