public ActionResult CreateStation(TStationEntity stationInfoEntity)
        {
            var result = false;
            ReturnJsonMessage msg = new ReturnJsonMessage();
            var stationLsit = tStationRepository.GetList();
            if (stationInfoEntity != null)
            {
                #region 验证
                if (stationLsit != null && stationLsit.Count(l => l.StationCode == stationInfoEntity.StationCode && l.StationId != stationInfoEntity.StationId) > 0)
                {
                    msg.Text = "编码已经存在";
                    msg.Value = "error";
                    return Json(msg);
                }
                if (stationLsit != null && stationLsit.Count(l => l.StationName == stationInfoEntity.StationName && l.StationId != stationInfoEntity.StationId) > 0)
                {
                    msg.Text = "名称已经存在";
                    msg.Value = "error";
                    return Json(msg);
                }
                if (stationLsit != null && stationLsit.Count(l => l.StationFullName == stationInfoEntity.StationFullName && l.StationId != stationInfoEntity.StationId) > 0)
                {
                    msg.Text = "全称已经存在";
                    msg.Value = "error";
                    return Json(msg);
                }
                #endregion

                if (stationInfoEntity.StationId == 0)
                {
                    result = tStationRepository.AddTStation(stationInfoEntity);
                }
                else
                {
                    var stationModel = stationLsit.FirstOrDefault(l => l.StationId == stationInfoEntity.StationId);
                    stationModel.StationCode = stationInfoEntity.StationCode;
                    stationModel.StationName = stationInfoEntity.StationName;
                    stationModel.StationFullName = stationInfoEntity.StationFullName;

                    stationModel.LineCode = stationInfoEntity.LineCode;
                    stationModel.LineName = stationInfoEntity.LineName;
                    stationModel.StationIndex = stationInfoEntity.StationIndex;
                    stationModel.JianKongPoint = stationInfoEntity.JianKongPoint;
                    stationModel.GoodBtnId = stationInfoEntity.GoodBtnId;
                    stationModel.BadBtnId = stationInfoEntity.BadBtnId;
                    //stationModel.BadBtnId = stationInfoEntity.StationFullName;

                    result = tStationRepository.UpdateTStation(stationModel);
                }
            }


            msg.Text = result ? "保存成功" : "保存失败";
            msg.Value = result ? "success" : "error";

            return Json(msg);
        }
        public ActionResult CreateStation(string stationcode)
        {
            var model = new TStationEntity();
            List<SelectListItem> spanSltlist = new List<SelectListItem>();
            spanSltlist.Add(new SelectListItem { Text = "--请选择--", Value = "" });
            var lineList = tLineRepository.GetList().Distinct(l => l.LCode);
            if (lineList != null)
            {
                foreach (var info in lineList)
                {
                    spanSltlist.Add(new SelectListItem { Text = info.LName, Value = info.LCode.ToString() });
                }
            }
            ViewBag.LineList = spanSltlist;

            if (!string.IsNullOrWhiteSpace(stationcode))
            {
                model = tStationRepository.GetSingle(stationcode);
            }
            return View(model);
        }
 public ActionResult BondCounter(string stationcode, int type = 0)
 {
     List<SelectListItem> spanSltlist = new List<SelectListItem>();
     spanSltlist.Add(new SelectListItem { Text = "--请选择--", Value = "" });
     var counterList = tCounterRepository.GetList().Where(c => c.Status == 0);
     if (counterList != null)
     {
         foreach (var info in counterList)
         {
             spanSltlist.Add(new SelectListItem { Text = info.CountNo, Value = info.CountNo.ToString() });
         }
     }
     ViewBag.CounterList = spanSltlist;
     ViewBag.Type = type;
     var model = new TStationEntity();
     if (!string.IsNullOrWhiteSpace(stationcode))
     {
         model = tStationRepository.GetSingle(stationcode);
     }
     return View(model);
 }