예제 #1
0
        public ActionResult TempGet(string iccode, int hallID, bool isplate)
        {
            Response resp = new Response();
            //先查找车位,后获取库区号
            Location lct = null;

            if (isplate)
            {
                lct = new CWLocation().FindLocation(l => l.PlateNum == iccode);
            }
            else
            {
                lct = new CWLocation().FindLocation(l => l.ICCode == iccode);
            }
            if (lct != null)
            {
                int warehouse = lct.Warehouse;
                resp = new CWTaskTransfer(hallID, warehouse).TempGetCar(lct.ICCode);
            }
            else
            {
                resp.Code    = 0;
                resp.Message = "找不到取车车位";
            }
            return(Json(new ReturnModel()
            {
                code = resp.Code, message = resp.Message
            }));
        }
예제 #2
0
        public JsonResult TestSubmitFPrint(int wh, int hall, string FPrint)
        {
            Response resp = new Response();

            byte[] psTZ = FPrintBase64.Base64FingerDataToHex(FPrint.Trim());
            resp = new CWTaskTransfer(hall, wh).DealFingerPrintMessage(psTZ);
            return(Json(resp));
        }
예제 #3
0
        public ActionResult GetCar(int warehouse, string address, int hallID)
        {
            Response    resp = new CWTaskTransfer(hallID, warehouse).ManualGetCar(warehouse, address);
            ReturnModel ret  = new ReturnModel
            {
                code    = resp.Code,
                message = resp.Message
            };

            return(Json(ret));
        }
예제 #4
0
        public async Task <JsonResult> TempUserOutCar()
        {
            Response resp = new Response();
            Log      log  = LogFactory.GetLogger("TempUserOutCar");

            #region
            try
            {
                string iccd      = Request.Form["iccode"];
                string isplate   = Request.Form["isplate"];
                string warehouse = Request.Form["wh"];
                string hallID    = Request.Form["hallID"];
                string indate    = Request.Form["indate"];
                string spantime  = Request.Form["spantime"];
                string needfee   = Request.Form["needfee"];
                string actualfee = Request.Form["actualfee"];
                string coinfee   = Request.Form["coinfee"];

                CWLocation cwlctn = new CWLocation();
                Location   loc    = null;
                #region
                if (Convert.ToBoolean(isplate))
                {
                    //是车牌号
                    loc = await cwlctn.FindLocationAsync(l => l.PlateNum == iccd);
                }
                else
                {
                    #region
                    //ICCard icard = new CWICCard().Find(ic=>ic.UserCode==iccd);
                    //if (icard == null)
                    //{
                    //    resp.Message = "不是本系统用卡,ICCode - " + iccd;
                    //    return Json(resp);
                    //}
                    //if(icard.Status==EnmICCardStatus.Lost||
                    //    icard.Status == EnmICCardStatus.Disposed)
                    //{
                    //    resp.Message = "卡已挂失或注销,ICCode - " + iccd;
                    //    return Json(resp);
                    //}
                    #endregion
                    //是卡号
                    loc = await cwlctn.FindLocationAsync(l => l.ICCode == iccd);
                }
                if (loc == null)
                {
                    resp.Message = "找不到取车位,proof - " + iccd;
                    return(Json(resp));
                }
                #endregion
                int    wh    = Convert.ToInt16(warehouse);
                int    hcode = Convert.ToInt32(hallID);
                Device hall  = await new CWDevice().FindAsync(d => d.Warehouse == wh && d.DeviceCode == hcode);
                if (hall == null)
                {
                    resp.Message = "找不到出库车厅,wh - " + warehouse + " , code - " + hallID;
                    return(Json(resp));
                }
                resp = new CWTaskTransfer(hcode, wh).OCreateTempUserOfOutCar(loc);
                if (resp.Code == 1)
                {
                    string oprt = User.Identity.Name;
                    //保存收费记录
                    TempUserChargeLog templog = new TempUserChargeLog
                    {
                        Proof       = loc.ICCode,
                        Plate       = loc.PlateNum,
                        Warehouse   = wh,
                        Address     = loc.Address,
                        InDate      = loc.InDate.ToString(),
                        OutDate     = DateTime.Now.ToString(),
                        SpanTime    = spantime,
                        NeedFee     = needfee,
                        ActualFee   = actualfee,
                        CoinChange  = coinfee,
                        OprtCode    = oprt,
                        RecordDTime = DateTime.Now
                    };
                    await new CWTariffLog().AddTempLogAsync(templog);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
                resp.Message = "系统异常";
            }
            #endregion
            return(Json(resp));
        }
예제 #5
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));
        }
예제 #6
0
        public JsonResult TestSubmitICCard(int wh, int hall, string physcode)
        {
            Response resp = new CWTaskTransfer(hall, wh).DealFingerICCardMessage(physcode);

            return(Json(resp));
        }
예제 #7
0
        public JsonResult IcCard()
        {
            int    isGetCar = 0;
            string plateNum = "";
            string sound    = "";

            Response resp = new Response();
            Log      log  = LogFactory.GetLogger("IcCard");

            try
            {
                byte[] bytes = new byte[Request.InputStream.Length];
                Request.InputStream.Read(bytes, 0, bytes.Length);
                string req = System.Text.Encoding.Default.GetString(bytes);
                log.Debug("有卡号信息上传,解析流得到字符串 - " + req);

                JavaScriptSerializer js     = new JavaScriptSerializer();
                AIOICCard            iccard = js.Deserialize <AIOICCard>(req);

                string warehouse = "1";
                string hallID    = iccard.equipmentID;
                string ccode     = iccard.cardInfo;

                int wh = 1;
                if (!string.IsNullOrEmpty(warehouse))
                {
                    wh = Convert.ToInt32(warehouse);
                }
                int hall = 0;
                if (!string.IsNullOrEmpty(hallID))
                {
                    hall = Convert.ToInt32(hallID);
                }
                if (hall < 10)
                {
                    resp.Message = "车厅号不正确,hallID- " + hallID;
                    return(Json(resp));
                }
                log.Debug("一体机刷卡信息中,warehouse - " + warehouse + " ,hallID - " + hall);
                resp = new CWTaskTransfer(hall, wh).DealFingerICCardMessage(ccode);
                if (resp.Code == 1)
                {
                    ZhiWenResult result = resp.Data as ZhiWenResult;
                    isGetCar = result.IsTakeCar;
                    plateNum = result.PlateNum;
                    sound    = result.Sound;
                }
                log.Debug("一体机刷卡,返回 - " + resp.Message);
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
            }
            var json = new
            {
                status    = resp.Code,
                msg       = resp.Message,
                isTakeCar = isGetCar,
                carBrand  = plateNum,
                counter   = 0,
                sound     = sound
            };

            return(Json(json));
        }
예제 #8
0
        public JsonResult ZhiWen()
        {
            int      isGetCar = 0;
            string   plateNum = "";
            Response resp     = new Response();
            Log      log      = LogFactory.GetLogger("ZhiWen");

            try
            {
                byte[] bytes = new byte[Request.InputStream.Length];
                Request.InputStream.Read(bytes, 0, bytes.Length);
                string req = System.Text.Encoding.Default.GetString(bytes);
                log.Debug("有指纹信息上传!");

                JavaScriptSerializer js     = new JavaScriptSerializer();
                AIOFingerPrint       fpring = js.Deserialize <AIOFingerPrint>(req);

                string warehouse   = "1";
                string hallID      = fpring.equipmentID;
                string fingerPrint = fpring.zhiWenInfo;

                int wh = 1;
                if (!string.IsNullOrEmpty(warehouse))
                {
                    wh = Convert.ToInt32(warehouse);
                }
                int hall = 0;
                if (!string.IsNullOrEmpty(hallID))
                {
                    hall = Convert.ToInt32(hallID);
                }
                log.Debug("指纹信息中,warehouse - " + warehouse + " ,hallID - " + hall);
                if (hall < 10)
                {
                    resp.Message = "车厅号不正确,hallID- " + hallID;
                    return(Json(resp));
                }

                string[] arrayFinger = fingerPrint.Trim().Split(' ');
                byte[]   psTZ        = new byte[arrayFinger.Length];
                for (int i = 0; i < arrayFinger.Length; i++)
                {
                    psTZ[i] = Convert.ToByte(arrayFinger[i].Trim(), 16);
                }

                log.Debug("接收到的指纹数量- " + psTZ.Length);
                if (psTZ.Length > 380)
                {
                    resp = new CWTaskTransfer(hall, wh).DealFingerPrintMessage(psTZ);
                    if (resp.Code == 1)
                    {
                        ZhiWenResult result = resp.Data as ZhiWenResult;
                        isGetCar = result.IsTakeCar;
                        plateNum = result.PlateNum;
                    }
                }
                else
                {
                    resp.Message = "上传的指纹特性数量不正确,Length- " + psTZ.Length;
                }
                log.Debug("指纹上传返回值 - " + resp.Message);
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
                resp.Message = "系统异常";
            }

            var json = new
            {
                status    = resp.Code,
                msg       = resp.Message,
                isTakeCar = isGetCar,
                carBrand  = plateNum,
                counter   = 0,
                sound     = ""
            };

            return(Json(json));
        }