public ActionResult UpdateTask(string ids, string BillNO) { ReturnJsonMessage msg = new ReturnJsonMessage(); string[] sid; if (string.IsNullOrWhiteSpace(ids)) { msg.Text = "请选择数据"; msg.Value = "error"; return(Json(msg)); } else { sid = ids.Split(','); } if (string.IsNullOrWhiteSpace(BillNO)) { msg.Text = "请选择任务单"; msg.Value = "error"; return(Json(msg)); } var result = tRecordDetailRepository.UpdateTask(sid, BillNO); msg.Text = result ? "保存成功" : "保存失败"; msg.Value = result ? "success" : "error"; return(Json(msg)); }
public ActionResult DeleteCounter(int id) { var result = false; ReturnJsonMessage msg = new ReturnJsonMessage(); var model = tCounterRepository.GetSingle(id); if (model.Status == 1) { msg.Text = "已启用设备,请先解除绑定"; msg.Value = "error"; return(Json(msg)); } result = tCounterRepository.DelTCounter(id); msg.Text = result ? "删除成功" : "删除失败"; msg.Value = result ? "success" : "error"; return(Json(msg)); }
public ActionResult CreateUser(UserInfoEntity userInfoEntity) { var result = false; if (userInfoEntity != null) { if (userInfoEntity.UserId == 0) { userInfoEntity.PassWord = CommonHelper.Md5(userInfoEntity.PassWord); userInfoEntity.CreateDate = DateTime.Now; userInfoEntity.UserState = 1; result = userInfoRepository.AddReturnInt(userInfoEntity) > 0; } else { var uerModel = userInfoRepository.GetSingle(userInfoEntity.UserId); uerModel.UserName = userInfoEntity.UserName; uerModel.UserSex = userInfoEntity.UserSex; uerModel.UserPhone = userInfoEntity.UserPhone; uerModel.UserMail = userInfoEntity.UserMail; uerModel.UserAddress = userInfoEntity.UserAddress; //uerModel.PassWord = CommonHelper.Md5(userInfoEntity.PassWord); result = userInfoRepository.Update(uerModel); } } ReturnJsonMessage msg = new ReturnJsonMessage(); msg.Text = result ? "保存成功" : "保存失败"; msg.Value = result ? "success" : "error"; return(Json(msg)); }
public ActionResult DeleteCounterBatch(int[] ids) { var result = false; ReturnJsonMessage msg = new ReturnJsonMessage(); if (ids.Length > 0) { foreach (var id in ids) { var model = tCounterRepository.GetSingle(id); if (model.Status == 1) { msg.Text = "已启用设备,请先解除绑定"; msg.Value = "error"; return(Json(msg)); } } result = tCounterRepository.DelTCounterBatch(ids); } msg.Text = result ? "删除成功" : "删除失败"; msg.Value = result ? "success" : "error"; return(Json(msg)); }
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 UnBindStation(int id, string code, int type) { ReturnJsonMessage msg = new ReturnJsonMessage(); var result = false; result = tStationRepository.UnBindStation(id, code, type); msg.Text = result ? "解绑成功" : "解绑失败"; msg.Value = result ? "success" : "error"; return Json(msg); }
public ActionResult UpdateStatu(int id, int statu) { var result = false; result = tStationRepository.UpdateStatu(id, statu); ReturnJsonMessage msg = new ReturnJsonMessage(); msg.Text = result ? "操作成功" : "操作失败"; msg.Value = result ? "success" : "error"; return Json(msg); }
public ActionResult DeleteWorker(int id) { var result = false; result = tWorkerRepository.DelTWorker(id); ReturnJsonMessage msg = new ReturnJsonMessage(); msg.Text = result ? "删除成功" : "删除失败"; msg.Value = result ? "success" : "error"; return(Json(msg)); }
public ActionResult ChangePassWord(int UserId, string newpassword) { var model = userInfoRepository.GetSingle(UserId); newpassword = CommonHelper.Md5(newpassword); var result = userInfoRepository.UpdateUserPassWord(UserId, newpassword); ReturnJsonMessage msg = new ReturnJsonMessage(); msg.Text = result ? "修改成功" : "修改失败"; msg.Value = result ? "success" : "error"; return(Json(msg)); }
public ActionResult CreateLine(TLineEntity lineInfoEntity) { var result = false; ReturnJsonMessage msg = new ReturnJsonMessage(); var lineLsit = tLineRepository.GetList(); if (lineInfoEntity != null) { #region 验证 if (lineLsit != null && lineLsit.Count(l => l.LCode == lineInfoEntity.LCode && l.LId != lineInfoEntity.LId) > 0) { msg.Text = "编码已经存在"; msg.Value = "error"; return(Json(msg)); } if (lineLsit != null && lineLsit.Count(l => l.LName == lineInfoEntity.LName && l.LId != lineInfoEntity.LId) > 0) { msg.Text = "名称已经存在"; msg.Value = "error"; return(Json(msg)); } if (lineLsit != null && lineLsit.Count(l => l.LFullName == lineInfoEntity.LFullName && l.LId != lineInfoEntity.LId) > 0) { msg.Text = "全称已经存在"; msg.Value = "error"; return(Json(msg)); } #endregion if (lineInfoEntity.LId == 0) { result = tLineRepository.AddReturnInt(lineInfoEntity) > 0; } else { var lineModel = lineLsit.FirstOrDefault(l => l.LCode == lineInfoEntity.LCode); lineModel.LName = lineInfoEntity.LName; lineModel.LFullName = lineInfoEntity.LFullName; lineModel.LType = lineInfoEntity.LType; result = tLineRepository.Update(lineModel); } } msg.Text = result ? "保存成功" : "保存失败"; msg.Value = result ? "success" : "error"; return(Json(msg)); }
public ActionResult DeleteWorkerBatch(int[] ids) { var result = false; ReturnJsonMessage msg = new ReturnJsonMessage(); if (ids.Length > 0) { result = tWorkerRepository.DelTWorkerBatch(ids); } msg.Text = result ? "删除成功" : "删除失败"; msg.Value = result ? "success" : "error"; return(Json(msg)); }
public ActionResult BondCounter(int StationId, string GoodBtnId, string BadBtnId, int type) { ReturnJsonMessage msg = new ReturnJsonMessage(); var result = false; if (string.IsNullOrWhiteSpace(GoodBtnId) && string.IsNullOrWhiteSpace(BadBtnId)) { msg.Text = "请选择设备"; msg.Value = "error"; return Json(msg); } result = tStationRepository.BondCounter(StationId, GoodBtnId, BadBtnId, type); msg.Text = result ? "绑定成功" : "绑定失败"; msg.Value = result ? "success" : "error"; return Json(msg); }
public ActionResult CreateWorker(TWorkerEntity workerInfoEntity, string[] LineCode) { var result = false; ReturnJsonMessage msg = new ReturnJsonMessage(); if (workerInfoEntity != null) { var model = tWorkerRepository.GetList().FirstOrDefault(w => w.WNo == workerInfoEntity.WNo && w.WId != workerInfoEntity.WId); if (model != null) { msg.Text = "员工编号不能重复"; msg.Value = "error"; return(Json(msg)); } if (workerInfoEntity.WId == 0) { result = tWorkerRepository.AddTWorker(workerInfoEntity, LineCode); } else { var uerModel = tWorkerRepository.GetSingle(workerInfoEntity.WId); uerModel.WName = workerInfoEntity.WName; uerModel.WNo = workerInfoEntity.WNo; uerModel.WSex = workerInfoEntity.WSex; uerModel.WDescript = workerInfoEntity.WDescript; uerModel.LineCode = workerInfoEntity.LineCode; uerModel.LineList = new List <TWorkerLineEntity>(); foreach (var code in LineCode) { uerModel.LineList.Add(new TWorkerLineEntity() { WId = uerModel.WId, LCode = code }); } result = tWorkerRepository.UpdateTWorker(uerModel); } } msg.Text = result ? "保存成功" : "保存失败"; msg.Value = result ? "success" : "error"; return(Json(msg)); }
public ActionResult ChangeWorker(int id, int wid, string wname) { var result = false; ReturnJsonMessage msg = new ReturnJsonMessage(); if (wid == 0 || string.IsNullOrWhiteSpace(wname)) { msg.Text = "参数错误"; msg.Value = "error"; return(Json(msg)); } var schedule = tWorkScheduleRepository.GetSingle(id); schedule.WId = wid; schedule.WName = wname; result = tWorkScheduleRepository.UpdateTWorkSchedule(schedule); msg.Text = result ? "保存成功" : "保存失败"; msg.Value = result ? "success" : "error"; return(Json(msg)); }
public ActionResult SaveUploadFile() { ReturnJsonMessage returnJsonMessage = new ReturnJsonMessage(); HttpFileCollectionBase imgUpFile = Request.Files; if (imgUpFile == null || imgUpFile.Count == 0) { return(Content("上传文件不能为空", "text/html;charset=UTF-8")); } try { var pictureMD5 = CommonHelper.GetMD5HashFromFile(imgUpFile[0].InputStream); var pictureInfo = pictureInfoRepository.GetPictureInfoByFileMD5(pictureMD5); if (pictureInfo != null && pictureInfo.Id > 0)//存在 { returnJsonMessage.Text = "true"; returnJsonMessage.Value = pictureInfo.Id.ToString(); } else//不存在 { string filePath = UploadHelper.SaveFileMethod(imgUpFile[0]); var newPictureInfo = new PictureInfoEntity(); newPictureInfo.CreateTime = DateTime.Now; newPictureInfo.FileMD5 = pictureMD5; newPictureInfo.FilePath = filePath; newPictureInfo.OldName = imgUpFile[0].FileName; var id = pictureInfoRepository.Add(newPictureInfo);//新增图片 returnJsonMessage.Text = "true"; returnJsonMessage.Value = id.ToString(); } } catch (Exception ex) { returnJsonMessage.Text = "false"; returnJsonMessage.Value = ex.Message; } return(Content(JsonHelper.Serializer(returnJsonMessage)));//返回图片id }
public ActionResult DeleteStation(int id) { var result = false; ReturnJsonMessage msg = new ReturnJsonMessage(); var model = tStationRepository.GetTStation(id); if (model != null && (!string.IsNullOrWhiteSpace(model.GoodBtnId) || !string.IsNullOrWhiteSpace(model.BadBtnId))) { msg.Text = "请先解绑设备后再进行删除"; msg.Value = msg.Value = "error"; return Json(msg); } else { result = tStationRepository.DelTStation(id); } msg.Text = result ? "删除成功" : "删除失败"; msg.Value = result ? "success" : "error"; return Json(msg); }
public ActionResult CreateWorker(TWorkerEntity workerInfoEntity) { var result = false; ReturnJsonMessage msg = new ReturnJsonMessage(); if (workerInfoEntity != null) { var model = tWorkerRepository.GetList().FirstOrDefault(w => w.WNo == workerInfoEntity.WNo && w.WId != workerInfoEntity.WId); if (model != null) { msg.Text = "员工编号不能重复"; msg.Value = "error"; return(Json(msg)); } if (workerInfoEntity.WId == 0) { result = tWorkerRepository.AddReturnInt(workerInfoEntity) > 0; } else { var uerModel = tWorkerRepository.GetSingle(workerInfoEntity.WId); uerModel.WName = workerInfoEntity.WName; uerModel.WNo = workerInfoEntity.WNo; uerModel.WSex = workerInfoEntity.WSex; uerModel.WDescript = workerInfoEntity.WDescript; uerModel.LineCode = workerInfoEntity.LineCode; result = tWorkerRepository.Update(uerModel); } } msg.Text = result ? "保存成功" : "保存失败"; msg.Value = result ? "success" : "error"; return(Json(msg)); }
public ActionResult CreateCounter(TCounterEntity counterInfoEntity) { var result = false; ReturnJsonMessage msg = new ReturnJsonMessage(); var counterLsit = tCounterRepository.GetList(); if (counterInfoEntity != null) { #region 验证 if (counterLsit != null && counterLsit.Count(l => l.CountNo == counterInfoEntity.CountNo && l.CId != counterInfoEntity.CId) > 0) { msg.Text = "编码已经存在"; msg.Value = "error"; return(Json(msg)); } #endregion if (counterInfoEntity.CId == 0) { result = tCounterRepository.AddReturnInt(counterInfoEntity) > 0; } else { var counterModel = counterLsit.FirstOrDefault(l => l.CId == counterInfoEntity.CId); counterModel.CountNo = counterInfoEntity.CountNo; counterModel.Status = counterInfoEntity.Status; result = tCounterRepository.Update(counterModel); } } msg.Text = result ? "保存成功" : "保存失败"; msg.Value = result ? "success" : "error"; return(Json(msg)); }