/// <summary> /// 更新agv小车信息 /// </summary> /// <param name="inputDtos"></param> /// <returns></returns> public async Task <OperationResult> Update(params AgvInfoInputDto[] inputDtos) { inputDtos.CheckNotNull("inputDtos"); foreach (AgvInfoInputDto dtoData in inputDtos) { if (string.IsNullOrEmpty(dtoData.CarNo)) { return(new OperationResult(OperationResultType.Error, "请正确填写车辆编号,该组数据不被存储。")); } if (string.IsNullOrEmpty(dtoData.CarNo)) { return(new OperationResult(OperationResultType.Error, "请正确填写车辆名称,该组数据不被存储。")); } if (AgvInfoRepository.CheckExists(x => x.CarNo == dtoData.CarNo && x.Id != dtoData.Id)) { return(new OperationResult(OperationResultType.Error, $"车辆编号 {dtoData.CarNo} 的数据已存在,该组数据不被存储。")); } if (AgvInfoRepository.CheckExists(x => x.CarName == dtoData.CarName && x.Id != dtoData.Id)) { return(new OperationResult(OperationResultType.Error, $"车辆名称 {dtoData.CarName} 的数据已存在,该组数据不被存储。")); } } AgvInfoRepository.UnitOfWork.BeginTransaction(); var result = await AgvInfoRepository.UpdateAsync(inputDtos); AgvInfoRepository.UnitOfWork.Commit(); return(result); }
/// <summary> /// 检查实体是否存在 /// </summary> /// <param name="predicate"></param> /// <param name="id"></param> /// <returns></returns> public bool CheckAgvInfoExists(Expression <Func <AgvInfo, bool> > predicate, Guid id) { return(AgvInfoRepository.CheckExists(predicate, id)); }