/// <summary> /// 手动入库 /// </summary> public int ManInLocation(string addrs, string iccode, string carSize, int distance, DateTime InDate) { try { CLocation lct = this.SelectLctFromAddrs(addrs); CICCard iccd = new CICCard(); //在使用seticcard时是对象间赋值,应先生成新对象, iccd = new CWICCard().SelectByUserCode(iccode); if (lct == null || iccd == null) { return(101); } if (iccd.Status != CICCard.EnmICCardStatus.Normal) { return(106); } if (lct.Type != CLocation.EnmLocationType.Normal || lct.Status != CLocation.EnmLocationStatus.Space) { return(102); //该车位不合格 } if (lct.ICCardCode != "") { return(103); //车位上有车 } CLocation lctn = this.SelectLctFromICCode(iccd.Code); if (lctn != null) { return(104); //该卡已存车 } if (carSize.CompareTo(lct.Size) > 0) { return(105);//外形不合格 } lct.SetICCard(iccd); lct.Distance = distance; lct.CarSize = carSize; lct.InDate = InDate; lct.Status = CLocation.EnmLocationStatus.Occupy; string msg = "数据入库- 源车位:" + lct.Address + " 状态:" + lct.Status.ToString() + " 卡号:" + lct.ICCardCode; new CWSException(msg, 0); CWData.myDB.ManUpdateLocation(lct); return(100); } catch (Exception ex) { HttpRuntime.Cache.Remove("CLocations"); throw ex; } }
/// <summary> /// 车位数据手动出库 /// </summary> /// <param name="address"></param> /// <returns></returns> public int ManualOutLocation(string address) { try { CLocation lct = Locations.Find(c => c.Address == address); if (lct != null) { if (lct.Type == CLocation.EnmLocationType.Normal) { if (lct.Status != CLocation.EnmLocationStatus.Space) { lct.Status = CLocation.EnmLocationStatus.Space; lct.SetICCard(null); lct.CarSize = ""; lct.Distance = 0; lct.InDate = CObject.DefDatetime; string msg = "数据出库- 车位:" + lct.Address + " 状态:" + lct.Status.ToString() + " 卡号:" + lct.ICCardCode; new CWSException(msg, 0); CWData.myDB.ManUpdateLocation(lct); return(100); } else { return(103); } } else { return(102); // } } return(101); //找不到车位 } catch (Exception ex) { HttpRuntime.Cache.Remove("CLocations"); throw ex; } }
/// <summary> /// 车位数据的手动挪移 /// </summary> /// <param name="fAddrs"></param> /// <param name="tAddrs"></param> /// <returns></returns> public int ManualTransposeLocation(string fAddrs, string tAddrs) { try { CLocation frLct = this.SelectLctFromAddrs(fAddrs); CLocation toLct = this.SelectLctFromAddrs(tAddrs); if (frLct != null && toLct != null) { if (frLct.Type == CLocation.EnmLocationType.Normal && toLct.Type == CLocation.EnmLocationType.Normal) { if (frLct.Status != CLocation.EnmLocationStatus.Occupy) { return(103); } if (toLct.Status != CLocation.EnmLocationStatus.Space) { return(104); } if (frLct.CarSize.CompareTo(toLct.Size) > 0) { return(105); } if (frLct.ICCardCode == "") { return(103); } CICCard iccd = new CICCard(); iccd = new CWICCard().SelectByUserCode(frLct.ICCardCode); toLct.SetICCard(iccd); toLct.Status = CLocation.EnmLocationStatus.Occupy; toLct.Distance = frLct.Distance; toLct.CarSize = frLct.CarSize; toLct.InDate = DateTime.Now; string mss = "数据挪移- 目的车位:" + toLct.Address + " 状态:" + toLct.Status.ToString() + " 卡号:" + toLct.ICCardCode; new CWSException(mss, 0); frLct.Status = CLocation.EnmLocationStatus.Space; frLct.SetICCard(null); frLct.Distance = 0; frLct.CarSize = ""; frLct.InDate = CObject.DefDatetime; string msg = "数据挪移- 源车位:" + frLct.Address + " 状态:" + frLct.Status.ToString() + " 卡号:" + frLct.ICCardCode; new CWSException(msg, 0); CWData.myDB.ManTransportLocation(frLct, toLct); return(100); } else { return(102); //车位不可用 } } else { return(101); } } catch (Exception ex) { HttpRuntime.Cache.Remove("CLocations"); throw ex; } }