/// <summary> /// 质量异议新增 /// </summary> /// <param name="qmDto"></param> public TMQ_QUALITY_MAIN QualitysInser(TMQ_QUALITY_MAINDTO qmDto) { TMQ_QUALITY_MAIN ef = AutoMapper.Mapper.Map <TMQ_QUALITY_MAIN>(qmDto); TMQ_QUALITY_MAIN_LOG logEf = AUTOMAPING.Mapping <TMQ_QUALITY_MAIN_LOG>(ef); Insert(logEf); return(Insert(ef)); }
/// <summary> /// 获取质量反馈信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public TMQ_QUALITY_MAINDTO GetQuality(string id) { TMQ_QUALITY_MAINDTO dto = AutoMapper.Mapper.Map <TMQ_QUALITY_MAINDTO>(_Quality.FirstOrDefault(x => x.C_ID.Equals(id))); List <TMQ_QUALITY_STL_GRD> stls = _QualityStlGrd.Where(x => x.C_QUALITY_ID.Equals(id)).ToList(); List <TMQ_QUALITY_STL_GRDDTO> stlDtos = MAPPING.ConvertEntityToDtoList <TMQ_QUALITY_STL_GRD, TMQ_QUALITY_STL_GRDDTO>(stls); if (stlDtos != null && stlDtos.Count > 0) { dto.QualityStlGrds = stlDtos; } return(dto); }
/// <summary> /// 质量异议修改 /// </summary> /// <param name="qmDto"></param> public void QualitysUpdate(TMQ_QUALITY_MAINDTO qmDto) { TMQ_QUALITY_MAIN ef = AutoMapper.Mapper.Map <TMQ_QUALITY_MAIN>(qmDto); ef.D_MOD_DT = DateTime.Now; Update(ef); QualitysDetailDelete(qmDto.C_ID); //给子表赋值主表主键 if (qmDto.QualityStlGrds != null && qmDto.QualityStlGrds.Count > 0) { foreach (var item in qmDto.QualityStlGrds) { item.C_QUALITY_ID = qmDto.C_ID; } QualitysDetailInser(qmDto.QualityStlGrds); } }
/// <summary> /// 获取质量问题反馈列表(分页) /// </summary> /// <param name="qmDto"></param> /// <param name="type"></param> /// <returns></returns> public PageResult <TMQ_QUALITY_MAIN> GetQualitys(TMQ_QUALITY_MAINDTO qmDto, int type) { Expression <Func <TMQ_QUALITY_MAIN, bool> > where = null; where = where.And <TMQ_QUALITY_MAIN>(x => x.N_STATUS >= 0); if (qmDto.Start != DateTime.MinValue) { DateTime startTime = Convert.ToDateTime(qmDto.Start.ToString("yyyy-MM-dd")); where = where.And <TMQ_QUALITY_MAIN>(x => x.D_MOD_DT > startTime); } if (qmDto.End != DateTime.MinValue) { DateTime endTime = Convert.ToDateTime(qmDto.End.AddDays(1).ToString("yyyy-MM-dd")); where = where.And <TMQ_QUALITY_MAIN>(x => x.D_MOD_DT < endTime); } if (qmDto.N_FLAG != null) { where = where.And <TMQ_QUALITY_MAIN>(x => x.N_FLAG == qmDto.N_FLAG); } if (!string.IsNullOrWhiteSpace(qmDto.C_CUST_NAME)) { qmDto.C_CUST_NAME = qmDto.C_CUST_NAME.Trim(); where = where.And <TMQ_QUALITY_MAIN>(x => x.C_CUST_NAME.Contains(qmDto.C_CUST_NAME)); } if (!string.IsNullOrWhiteSpace(qmDto.C_TEL)) { qmDto.C_TEL = qmDto.C_TEL.Trim(); where = where.And <TMQ_QUALITY_MAIN>(x => x.C_TEL.Contains(qmDto.C_TEL)); } Expression <Func <TMQ_QUALITY_MAIN, DateTime> > order = null; order = t => t.D_MOD_DT; return(QueryPage <TMQ_QUALITY_MAIN, DateTime>(where, qmDto.BasePage.PageSize, qmDto.BasePage.PageIndex, order, false)); }