public ActionResult EditCarInfoForm(CarInfo carInfo, string Hid_TerNo, string Hid_OldCarno, string TypeName, string flag) { new LogMessage().Save("CarNo:" + carInfo.CarNo + ";"); UserInfo user = (UserInfo)Session["LoginUser"]; if (carInfo.Businessdivisionid != null || carInfo.Businessdivisionid.Trim() != "") { DeptInfo di = deptInfoBll.GetDeptInfo(carInfo.Businessdivisionid); carInfo.CarDeptcode = di.Businessdivisioncode; } carInfo.Description = carInfo.Description.Trim(); string carhbinfo = ""; if (carInfo.CarColor != "" || TypeName != "") { string cartypename = ""; if (TypeName.Split('-').Length == 1) { cartypename = TypeName.Split('-')[0]; } else { cartypename = TypeName.Split('-')[2] == null ? "" : TypeName.Split('-')[2]; } carhbinfo = cartypename + "|" + carInfo.CarColor + "|||||||||||||||||||||||||||||"; } RealtimeData rdinfo = realtimedatabll.GetRealtimeData(Hid_TerNo); if (rdinfo.Rawdataid != null && rdinfo.Rawdataid != "") { string NewCarno = carInfo.CarNo; carInfo.CarNo = Hid_OldCarno; string kku = carInfoBll.UpdateCarType(carInfo, TypeName); ViewBag.Result = kku; //修改联动车辆发送的指令 Transfers.ClintSendCommData(1107, "551", "", Hid_OldCarno, "", "", "", "", "", "", "", carInfo.CarDeptcode, NewCarno, carhbinfo, carInfo.CarAdminName, carInfo.CarFrame, "", "", user.UserName); System.Threading.Thread.Sleep(2000); } else { ArrayList arr = new ArrayList(); arr.Add(carInfo); string kku = carInfoBll.UpdateCarInfo(arr, TypeName); ViewBag.Result = kku; //修改普通车辆发送的指令 TerminalInfoBLL terbll = new TerminalInfoBLL(); IList <TerminalInfo> terinfolist = terbll.GetTerminalInfoByCarId(carInfo.CarId); foreach (TerminalInfo terinfo in terinfolist) { if (terinfo != null && terinfo.TerNo != "") { Transfers.ClintSendCommData(1107, "50", "", terinfo.TerNo, "", "", "", "", "", "", "", carInfo.CarDeptcode, carInfo.CarNo, carhbinfo, carInfo.CarAdminName, carInfo.CarFrame, "", "", user.UserName); } } } ViewBag.flag = flag; return(View()); }
public List <DeptInfo> GetGroupDeptList2(string DeptId) { List <DeptInfoView> DepList = new List <DeptInfoView>(); List <DeptInfo> DepListAll = new List <DeptInfo>(); List <DeptInfo> TreeLists = new List <DeptInfo>(); List <DeptInfoView> TreeListAll = new List <DeptInfoView>(); TerminalInfoBLL terbll = new TerminalInfoBLL(); if (DeptId != null) { DeptInfo di = _iDeptInfoDao.GetDeptInfoById(DeptId); DeptInfoView d = new DeptInfoView(); d.Isdel = "0"; d.DepType = "1"; d.Fatherid = DeptId; d.Businessdivisioncode = di.Businessdivisioncode; DepList = (List <DeptInfoView>)GetGroupDeptInfoPage(d); if (DepList != null) { foreach (DeptInfoView div in DepList) { DeptInfo DepObj = new DeptInfo(); DepObj.Businessdivisionid = div.Businessdivisionid; DepObj.Businessdivisionname = div.Businessdivisionname; DepObj.Businessdivisioncode = div.Businessdivisioncode; DepObj.Fatherid = div.Fatherid; DeptInfo fa = new DeptInfo(); fa.Businessdivisionid = div.Fatherid; fa.Businessdivisionname = div.Fbusinessdivisionname; fa.Businessdivisioncode = div.Fbusinessdivisioncode; DepObj.FatherDepartmentObj = fa; DepListAll.Add(DepObj); } TreeLists = DepListAll.FindAll(x => x.Fatherid == di.Businessdivisionid); foreach (DeptInfo deptInfo in TreeLists) { List <DeptInfo> deplist = new List <DeptInfo>(); IList <TerminalInfo> terlist = terbll.GetTerminalInfoByDeptId(deptInfo.Businessdivisionid); if (terlist != null) { foreach (TerminalInfo terinfo in terlist) { DeptInfo TerDep = new DeptInfo(); TerDep.Businessdivisionid = terinfo.DeptId; TerDep.Businessdivisionname = terinfo.TerNo; TerDep.Businessdivisioncode = terinfo.TerDeptcode; deplist.Add(TerDep); } } deptInfo.ListDepartmentSub = deplist; } } return(TreeLists); } else { return(null); } }
public ActionResult CarInfoForm(CarInfo carInfo, string Hid_FieldsVal, string TerGuid, string TypeName) { if (carInfo.CarNo != null && carInfo.CarNo.Trim() != "") { new LogMessage().Save("CarNo:" + carInfo.CarNo + ";"); ArrayList arr = new ArrayList(); carInfo.CarId = System.Guid.NewGuid().ToString(); if (carInfo.Businessdivisionid != null || carInfo.Businessdivisionid.Trim() != "") { DeptInfo di = deptInfoBll.GetDeptInfo(carInfo.Businessdivisionid); carInfo.CarDeptcode = di.Businessdivisioncode; } else { ViewBag.Result = "所属企业不正确或者为空"; return(View()); } arr.Add(carInfo); if (TerGuid != null && TerGuid.Trim() != "") { arr.Add(TerGuid); } else { ViewBag.Result = "终端号不正确或者为空"; return(View()); } string kku = carInfoBll.InsertCarInfo(arr, TypeName); ViewBag.Result = kku; //绑定车辆终端 UserInfo user = (UserInfo)Session["LoginUser"]; string carhbinfo = ""; if (carInfo.CarColor != "" || TypeName != "") { string cartypename = ""; if (TypeName.Split('-').Length == 3) { cartypename = TypeName.Split('-')[2]; } else { cartypename = TypeName; } carhbinfo = cartypename + "|" + carInfo.CarColor + "|||||||||||||||||||||||||||||"; } string[] terguids = TerGuid.Split(','); foreach (string terguid in terguids) { TerminalInfoBLL terbll = new TerminalInfoBLL(); TerminalInfo terinfo = terbll.GetTerminalInfo(terguid); if (terinfo != null && terinfo.TerNo != "") { Transfers.ClintSendCommData(1107, "50", "", terinfo.TerNo, "", "", "", "", "", "", "", carInfo.CarDeptcode, carInfo.CarNo, carhbinfo, carInfo.CarAdminName, carInfo.CarFrame, "", "", user.UserName); } } //刷新车辆 //Transfers.ClintSendCommData(1160, "1108", "", "", "", "", "", "", "", "", "", "1", "2", "", "", "", "", "", ""); return(View()); } else { ViewBag.Result = "false"; return(View()); } }