/// <summary> /// 批量新增设备 /// </summary> /// <param name="model"></param> /// <returns></returns> public async Task <TData <string> > SaveForm(TerInforBateAddParam model) { TData <string> obj = new TData <string>(); obj.SetDefault(); List <TerInforBateAdd> models = new List <TerInforBateAdd>(); int number = model.StartNumber; for (int i = 0; i < model.Count; i++) { TerInforBateAdd ter = new TerInforBateAdd(); { await ter.Create(); } ter.TerNumber = (number) + ""; ter.TerName = model.TerName; ter.TerPartId = model.TerPartId; models.Add(ter); } List <string> numbers = models.Select(p => p.TerNumber).ToList(); List <TerInforEntity> list = await terInforService.GetListByNumber(numbers); if (list.Count > 0) { string nubmess = string.Join(",", list.Select(p => p.TerNumber).ToList()); obj.Message = string.Format("{0}编号已经存在", nubmess); } else { int count = await terInforService.SaveForm(models); if (count > 0) { obj.Tag = 1; obj.Refresh(); } } return(obj); }
public async Task <ActionResult> BateSaveFormJson(TerInforBateAddParam entity) { TData <string> obj = await terInforBLL.SaveForm(entity); return(Json(obj)); }