/// <summary> /// 使用明进康刷卡器时,由物理卡号查询用户信息 /// </summary> /// <param name="code"></param> /// <param name="isPhysc"></param> /// <returns></returns> public ActionResult FindCardOfGUI(string iccode, bool isPhysc) { CWICCard cwiccd = new CWICCard(); ICCard iccd = null; if (isPhysc) { iccd = cwiccd.Find(ic => ic.PhysicCode == iccode); } else { iccd = cwiccd.Find(ic => ic.UserCode == iccode); } if (iccd == null) { iccd = new ICCard(); if (isPhysc) { //如果查找不到该卡号,则查询下存车指纹库内,是否有,有的话,其编号多少 SaveCertificate scert = new CWSaveProof().Find(s => s.Proof == iccode); if (scert != null) { iccd.PhysicCode = iccode; iccd.UserCode = scert.SNO.ToString(); iccd.Status = EnmICCardStatus.Init; iccd.CreateDate = DateTime.Parse("2017-1-1"); iccd.LossDate = DateTime.Parse("2017-1-1"); iccd.LogoutDate = DateTime.Parse("2017-1-1"); } } } return(Json(iccd, JsonRequestBehavior.AllowGet)); }
/// <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)); }
/// <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)); }