/// <summary> /// 添加,修改车位的入库时间, /// </summary> /// <param name="rcd"></param> /// <returns></returns> public Response Add(RemotePayFeeRcd rcd) { Log log = LogFactory.GetLogger("CWRemoteServer add"); Response resp = new Response(); try { CWLocation cwlctn = new CWLocation(); Location loc = cwlctn.FindLocation(lc => lc.ICCode == rcd.strICCardID); if (loc == null) { loc = cwlctn.FindLocation(lc => lc.PlateNum == rcd.strPlateNum); } if (loc != null) { //修改车位的入库时间 loc.InDate = DateTime.Now; cwlctn.UpdateLocation(loc); rcd.Warehouse = loc.Warehouse; rcd.LocAddress = loc.Address; log.Info("云服务下发付款成功通知,strICCardID- " + rcd.strICCardID + " ,strPlateNum- " + rcd.strPlateNum + " ,wh- " + loc.Warehouse + " ,address- " + loc.Address); return(manager.Add(rcd)); } else { resp.Message = "找不到存车卡号"; log.Info("云服务下发缴费通知时,在库内找不到对应车位,strICCardID- " + rcd.strICCardID + " ,strPlateNum- " + rcd.strPlateNum); } } catch (Exception ex) { resp.Message = "出现异常- " + ex.ToString(); log.Error(ex.ToString()); } return(resp); }
/// <summary> /// 存车时,分配车位及ETV /// </summary> /// <param name="checkCode">外形尺寸</param> /// <param name="cust">顾客</param> /// <param name="hall">车厅</param> /// <param name="smg">ETV 设备号</param> /// <returns></returns> public Location IAllocateLocation(string checkCode, Customer cust, Device hall, out int smg) { Log log = LogFactory.GetLogger("AllocateLocation.IAllocateLocation"); smg = 0; int warehouse = hall.Warehouse; int hallCode = hall.DeviceCode; int hallCol = Convert.ToInt32(hall.Address.Substring(1, 2)); Location lct = null; CWTask cwtask = new CWTask(); CWLocation cwlctn = new CWLocation(); if (cust.Type == EnmICCardType.Temp || cust.Type == EnmICCardType.Periodical) { #region 判断是否是预定了车位 lct = cwlctn.FindLocation(cc => cc.Type == EnmLocationType.Normal && cc.Status == EnmLocationStatus.Book && cc.PlateNum == cust.PlateNum); if (lct != null) { log.Info("当前车牌已预定车位,address-" + lct.Address + " ,wh- " + lct.Warehouse + " ,plate- " + cust.PlateNum + " ,cust- " + cust.UserName); if (compareSize(lct.LocSize, checkCode) >= 0) { //分配ETV Device dev = PXDAllocateEtvOfFixLoc(hall, lct); if (dev != null) { smg = dev.DeviceCode; } return(lct); } else { log.Info("当前预定车位,address-" + lct.Address + " ,wh- " + lct.Warehouse + " ,locsize- " + lct.LocSize + ",carsize- " + checkCode + " 尺寸不合适,按临时卡分配"); //释放预定的车位 lct.Status = EnmLocationStatus.Space; lct.PlateNum = ""; lct.InDate = DateTime.Parse("2017-1-1"); cwlctn.UpdateLocation(lct); //按临时车位处理 lct = this.PXDAllocate(hall, checkCode, out smg); } } else //没有预定车位,按临时车处理 { lct = this.PXDAllocate(hall, checkCode, out smg); } #endregion } else if (cust.Type == EnmICCardType.FixedLocation) { if (cust.Warehouse != warehouse) { //车辆停在其他库区 cwtask.AddNofication(warehouse, hallCode, "16.wav"); return(null); } lct = new CWLocation().FindLocation(l => l.Warehouse == cust.Warehouse && l.Address == cust.LocAddress); if (lct == null) { cwtask.AddNofication(warehouse, hallCode, "20.wav"); log.Error("固定车位时,依地址找不到对应车位,address - " + cust.LocAddress); return(null); } if (lct != null) { if (compareSize(lct.LocSize, checkCode) < 0) { //车位尺寸与车辆不匹配 cwtask.AddNofication(warehouse, hallCode, "61.wav"); return(null); } } if (lct.Type != EnmLocationType.Normal) { cwtask.AddNofication(warehouse, hallCode, "69.wav"); return(null); } //如果是重列车位,判断前面车位是否是正常的 if (lct.NeedBackup == 1) { string fwdaddrs = (lct.LocSide - 2).ToString() + lct.Address.Substring(1); Location forward = new CWLocation().FindLocation(l => l.Address == fwdaddrs); if (forward != null) { if (forward.Type != EnmLocationType.Normal) { //前面车位已被禁用 cwtask.AddNofication(warehouse, hallCode, "15.wav"); return(null); } } } //分配ETV Device dev = PXDAllocateEtvOfFixLoc(hall, lct); if (dev != null) { smg = dev.DeviceCode; } } return(lct); }