/// <summary> /// LED 查询库内空余车位及可分配大车位 /// </summary> /// <param name="pSpace"></param> /// <param name="pBigSpace"></param> /// <returns></returns> public int GetSpaceLctsAndBigLcts(out int pSpace, out int pBigSpace) { pBigSpace = 0; pSpace = 0; try { CWICCard wiccd = new CWICCard(); foreach (CLocation lct in Locations) { if (lct.Type == CLocation.EnmLocationType.Normal && lct.Status == CLocation.EnmLocationStatus.Space) { if (wiccd.FindFixICCard(lct.Address) == null) { pSpace++; } } if (lct.Type == CLocation.EnmLocationType.Normal && lct.Status == CLocation.EnmLocationStatus.Space && lct.Size == "112") { if (wiccd.FindFixICCard(lct.Address) == null) { pBigSpace++; } } } return(0); } catch (Exception ex) { HttpRuntime.Cache.Remove("CLocations"); throw ex; } }
/// <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> public int SelectSpaceLctCounts(out int total, out int space, out int occupy, out int fixLct, out int spaceBigLct) { total = 0; space = 0; occupy = 0; fixLct = 0; spaceBigLct = 0; try { CWICCard wiccd = new CWICCard(); foreach (CLocation lct in Locations) { if (lct.Type == CLocation.EnmLocationType.Normal && lct.Status != CLocation.EnmLocationStatus.Init) { total++; } if (lct.Type == CLocation.EnmLocationType.Normal && lct.Status == CLocation.EnmLocationStatus.Space) { if (wiccd.FindFixICCard(lct.Address) == null) { space++; } } if (lct.Type == CLocation.EnmLocationType.Normal && (lct.Status != CLocation.EnmLocationStatus.Init && lct.Status != CLocation.EnmLocationStatus.Space)) { occupy++; } if (lct.Type == CLocation.EnmLocationType.Normal || lct.Type == CLocation.EnmLocationType.Disable) { if (wiccd.FindFixICCard(lct.Address) != null) { fixLct++; } } if (lct.Type == CLocation.EnmLocationType.Normal && lct.Status == CLocation.EnmLocationStatus.Space && lct.Size == "112") { if (wiccd.FindFixICCard(lct.Address) == null) { spaceBigLct++; } } } } catch (Exception ex) { HttpRuntime.Cache.Remove("CLocations"); throw ex; } return(0); }
/// <summary> /// 临时取物,需等待其他的车厅作业全部完成才允许添加 /// </summary> /// <param name="iccode"></param> /// <param name="hall_ID"></param> /// <returns></returns> public int TempGetCar(string iccode, int hall_ID) { CICCard iccd = new CWICCard().SelectByUserCode(iccode); if (iccd == null) { return(109); } if (iccd.Status == CICCard.EnmICCardStatus.Disposed || iccd.Status == CICCard.EnmICCardStatus.Lost) { return(110); } CLocation lct = new CWLocation().SelectLctFromICCode(iccode); //依存车卡号查询存车位 if (lct == null) { return(101); } CSMG hall = new CWSMG().SelectSMG(hall_ID); if (hall.HallType != CSMG.EnmHallType.EnterorExit) //车厅类型 { return(102); } if (!new CWSMG().CheckHallMode(hall.ID)) //判断车厅模式 { return(103); } if (!new CWSMG().CheckAcceptNewCommand(hall.ID)) //车厅是否可接收新指令 { return(104); } CMasterTask mtsk = new CWTask().GetMasterTaskFromICCode(iccode); if (mtsk != null) { return(105); //该卡正在作业 } int GetCarCount = new CWTask().GetMasterTaskNumOfHid(hall.ID, CMasterTask.EnmMasterTaskType.GetCar); if (GetCarCount > 0) { return(106); //需待其他车厅的取车作业完成才允许添加 } int rit = new CWTask().OTemp_GetCar(hall.ID, hall.Address, iccd, lct); return(rit); }
/// <summary> /// 查询空余车位,状态字用 /// </summary> /// <returns></returns> public int GetSpaceLocations() { try { int pSpace = 0; CWICCard wiccd = new CWICCard(); foreach (CLocation lct in Locations) { if (lct.Type == CLocation.EnmLocationType.Normal && lct.Status == CLocation.EnmLocationStatus.Space) { if (wiccd.FindFixICCard(lct.Address) == null) { pSpace++; } } } return(pSpace); } catch (Exception ex) { HttpRuntime.Cache.Remove("CLocations"); throw ex; } }
/// <summary> /// 临时卡取车-界面收费出车 /// </summary> /// <param name="hallID">车厅号</param> /// <returns></returns> public int OCreateTempICcardGetCar(string iccode, out int hallID) { hallID = 0; CICCard iccd = new CWICCard().SelectByUserCode(iccode); if (iccd.Status == CICCard.EnmICCardStatus.Lost || iccd.Status == CICCard.EnmICCardStatus.Disposed) { return(107); } CLocation lct = new CWLocation().SelectLctFromICCode(iccode); //依存车卡号查询车位 if (lct == null) { return(101); //该卡没有存车 } CWSMG wsmg = new CWSMG(); CSMG[] etvs = wsmg.SelectSMGsOfType(CSMG.EnmSMGType.ETV); CSMG[] halls = wsmg.SelectSMGsCanGetCar(); //选择模式为进出、出车且可用的车厅集合 CSMG etv; //所选ETV CSMG hall; //所选Hall //分配车厅、ETV new IEGBLL.AllocateETV.GetFeeOutAllocate().AllocateEtvAndHall(etvs, halls, lct, out etv, out hall); if (etv == null || hall == null) { return(102); //没有可用的ETV或车厅 } //车厅模式 if (!wsmg.CheckHallMode(hall.ID)) { return(103); } //ETV模式 if (!wsmg.CheckEtvMode(etv.ID)) { return(104); } CMasterTask mtsk = motsk.GetMasterTaskFromICCode(iccode); if (mtsk != null) { return(105); //当前卡号正在实行 } int getCarCount = motsk.GetMTskCountFromHall(hall.ID, CMasterTask.EnmMasterTaskType.GetCar); if (getCarCount > CWData.MaxGetCarCount) { return(106); //当前作业已满 } string mse = "收费出车- 分配ETV" + etv.ID + " 取车位:" + lct.Address + " 出车厅:" + hall.ID; new CWSException(mse, 0); string etvAddrs = wsmg.GetEtvCurrAddress(etv.ID); //生成作业 motsk.OTempICcdGetCar(hall.ID, etv.ID, iccode, hall.Address, lct, etvAddrs); hallID = hall.ID; return(100); }
/// <summary> /// 刷卡取车处理 /// </summary> /// <param name="physicCard">物理卡号</param> public void DealCardMessage(string physicCard) { //检查车厅模式是否全自动 if (!(new CWSMG()).CheckHallMode(moHall.ID)) { motsk.AddNotification(moHall.ID, "5.wav"); return; } CICCard iccd = new CWICCard().SelectByPhysicCard(physicCard); if (iccd == null) { //不是本系统用卡 motsk.AddNotification(moHall.ID, "6.wav"); return; } if (iccd.Status == CICCard.EnmICCardStatus.Lost || iccd.Status == CICCard.EnmICCardStatus.Disposed) { //卡已注销或挂失 motsk.AddNotification(moHall.ID, "7.wav"); return; } //判断该卡在其他车厅有没有进行作业 if ((new CWTask()).CheckSameMTaskInHallFromICCd(iccd.Code, moHall.ID)) { motsk.AddNotification(moHall.ID, "8.wav"); return; } CLocation lct = new CWLocation().SelectLctFromICCode(iccd.Code); //获取该车厅的取车数量 int getCarCount = motsk.GetMTskCountFromHall(moHall.ID, CMasterTask.EnmMasterTaskType.GetCar); #region 进车厅 if (moHall.HallType == CSMG.EnmHallType.Entance) { if (lct == null) { if (moHall.nIsWorking != 0) { //获取车厅子作业 CTask tsk = motsk.GetCTaskFromtskID(moHall.nIsWorking); if (tsk.Status == CTask.EnmTaskStatus.ICarInWaitFirstSwipeCard) //等待第一次刷卡 { //处理第一次刷卡 motsk.DealISwipedFirstCard(tsk.ID, iccd.Code); } else if (tsk.Status == CTask.EnmTaskStatus.IFirstSwipedWaitforCheckSize) //等待第二次刷卡 { //处理第二次刷卡 if (tsk.ICCardCode != iccd.Code) { motsk.AddNotification(tsk.HID, "20.wav"); return; } motsk.DealISwipedSecondCard(tsk.ID, iccd.Code); } else { //刷卡错误请重新刷卡 或该卡正在作业请稍后 motsk.AddNotification(moHall.ID, "9.wav"); } } else { CMasterTask mtsk = motsk.GetMasterTaskFromICCode(iccd.Code); if (mtsk != null) { //该卡正在作业,请稍后 motsk.AddNotification(moHall.ID, "9.wav"); return; } //车厅无车,不能存车 motsk.AddNotification(moHall.ID, "10.wav"); } } else { //请到出车厅刷卡取车 motsk.AddNotification(moHall.ID, "11.wav"); return; } } #endregion #region 出车厅 if (moHall.HallType == CSMG.EnmHallType.Exit) { if (lct != null) { CMasterTask mtsk = motsk.GetMasterTaskFromICCode(iccd.Code); if (mtsk == null) { if (getCarCount > CWData.MaxGetCarCount) { //取车人数多,请稍后 motsk.AddNotification(moHall.ID, "12.wav"); return; } if (CWData.ChargeEnable) //收费功能开启 { if (iccd.Type == CICCard.EnmICCardType.Temp) //临时卡 { motsk.AddNotification(moHall.ID, "29.wav"); return; } else if (iccd.Type == CICCard.EnmICCardType.Fixed || iccd.Type == CICCard.EnmICCardType.FixedLocation) { if (iccd.DueDtime > DateTime.Now) //定期卡,使用期限到 { motsk.AddNotification(moHall.ID, "31.wav"); return; } } } //建立刷卡取车作业 motsk.DealOswipedFirstCard(moHall.ID, iccd, lct); } else { //正在出库请稍后 motsk.AddNotification(moHall.ID, "13.wav"); } } else { //该卡没有存车 motsk.AddNotification(moHall.ID, "14.wav"); } } #endregion #region 进出车厅 if (moHall.HallType == CSMG.EnmHallType.EnterorExit) { #region 存车 if (lct == null) //应该是进车状态 { if (moHall.nIsWorking != 0) { //获取车厅子作业 CTask tsk = motsk.GetCTaskFromtskID(moHall.nIsWorking); if (tsk.Status == CTask.EnmTaskStatus.ICarInWaitFirstSwipeCard) //等待第一次刷卡 { //处理第一次刷卡 motsk.DealISwipedFirstCard(tsk.ID, iccd.Code); } else if (tsk.Status == CTask.EnmTaskStatus.IFirstSwipedWaitforCheckSize) //等待第二次刷卡 { //处理第二次刷卡 if (tsk.ICCardCode != iccd.Code) { motsk.AddNotification(tsk.HID, "20.wav"); } else { motsk.DealISwipedSecondCard(tsk.ID, iccd.Code); } } else if (tsk.Status == CTask.EnmTaskStatus.OCarOutWaitforDriveaway) //处理取物后存车,第三次刷卡 { motsk.DealISwipeThirdCard(tsk, iccd); } else { //刷卡错误请重新刷卡 或该卡正在作业请稍后 motsk.AddNotification(moHall.ID, "9.wav"); } } else { CMasterTask mtsk = motsk.GetMasterTaskFromICCode(iccd.Code); if (mtsk != null) { //该卡正在作业,请稍后 motsk.AddNotification(moHall.ID, "9.wav"); return; } //车厅无车,不能存车 motsk.AddNotification(moHall.ID, "10.wav"); } } #endregion #region 取车 else //应该是刷卡取车 { CMasterTask mtsk = motsk.GetMasterTaskFromICCode(iccd.Code); if (mtsk == null) { if (getCarCount > CWData.MaxGetCarCount) { //取车人数多,请稍后 motsk.AddNotification(moHall.ID, "12.wav"); return; } if (CWData.ChargeEnable) //收费功能开启 { if (iccd.Type == CICCard.EnmICCardType.Temp) //临时卡 { motsk.AddNotification(moHall.ID, "29.wav"); return; } else if (iccd.Type == CICCard.EnmICCardType.Fixed || iccd.Type == CICCard.EnmICCardType.FixedLocation) { if (iccd.DueDtime > DateTime.Now) //定期卡,使用期限到 { motsk.AddNotification(moHall.ID, "31.wav"); return; } } } //建立刷卡取车作业 motsk.DealOswipedFirstCard(moHall.ID, iccd, lct); } else { //正在出库请稍后 motsk.AddNotification(moHall.ID, "13.wav"); } } #endregion } #endregion }
/// <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; } }