From 10ec50f8e9ded45e8b439114a17ed89297c948c7 Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期二, 13 七月 2021 15:04:51 +0800 Subject: [PATCH] 提交 --- zhengcaioa/Services/ExpertService.cs | 154 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 154 insertions(+), 0 deletions(-) diff --git a/zhengcaioa/Services/ExpertService.cs b/zhengcaioa/Services/ExpertService.cs index cb7a5f4..b1fb522 100644 --- a/zhengcaioa/Services/ExpertService.cs +++ b/zhengcaioa/Services/ExpertService.cs @@ -412,6 +412,10 @@ && (string.IsNullOrWhiteSpace(searchEntity.OrderNo) || a.OrderNo.Contains(searchEntity.OrderNo.Trim())) && (string.IsNullOrWhiteSpace(searchEntity.KhdwName) || ggg.Name.Contains(searchEntity.KhdwName.Trim())) && (string.IsNullOrWhiteSpace(searchEntity.Khlx) || ggg.Khlx == searchEntity.Khlx.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.isDispatch) || (searchEntity.isDispatch == "1" && hod.Id!=null) || (searchEntity.isDispatch == "0" && hod.Id == null) ) + && (string.IsNullOrWhiteSpace(searchEntity.ExpertId) || hod.ExpertId == searchEntity.ExpertId.Trim()) + + // && (string.IsNullOrWhiteSpace(searchEntity.HuifangStatus) || a.HuifangStatus.Contains(searchEntity.HuifangStatus.Trim())) // && (string.IsNullOrWhiteSpace(searchEntity.PingjiaStatus) || a.PingjiaStatus.Contains(searchEntity.PingjiaStatus.Trim())) @@ -466,7 +470,19 @@ if (string.IsNullOrEmpty(dispatch.Id)) { dispatch.Id = Guid.NewGuid().ToString(); + dipatchDTO.Id = dispatch.Id; _context.ExpertOrderDispatches.Add(dispatch); + } + else + { + var model = _context.ExpertOrderDispatches.Find(dispatch.Id); + model.Orderid = dipatchDTO.OrderId; + model.ExpertId = dipatchDTO.ExpertId; + model.Money = dipatchDTO.Money; + model.RecStatus = dipatchDTO.RecStatus; + model.Modifier = dipatchDTO.Modifier; + model.Modifytime = dipatchDTO.Modifytime.Value; + model.Sort = dipatchDTO.sort; } _context.SaveChanges(); resultEntity.ReturnID = dispatch.Id; @@ -483,7 +499,145 @@ #endregion + #region 涓撳缁撶畻 + /// <summary> + /// 鏌ヨ涓撳缁撶畻 + /// </summary> + /// <param name="searchEntity"></param> + /// <returns></returns> + public ResultDataEntity<ExpertOrderDipatchDTO> SearchJiesuan(ExpertOrderDipatchDTOSearch searchEntity) + { + ResultDataEntity<ExpertOrderDipatchDTO> data = new ResultDataEntity<ExpertOrderDipatchDTO>(); + List<ExpertOrderDipatchDTO> list = new List<ExpertOrderDipatchDTO>(); + + var listCode = (from a in _context.SysCodeDtls + join b in _context.SysCodes + on a.CodeId equals b.Id + where a.RecStatus == "A" + && b.RecStatus == "A" + select new CodeDataEntity() + { + CodeId = b.Id, + CodeTable = b.CodeTable, + CodeField = b.CodeField, + CodeSn = a.CodeSn, + Comments = a.Comments, + Contents = a.Contents, + RecStatus = a.RecStatus, + Sort = a.Sort + } + ); + DateTime PdTimestart = DateTime.Now; + DateTime PdTimeend = DateTime.Now; + if (!string.IsNullOrWhiteSpace(searchEntity.PdTime)) + { + string[] PdTimes = searchEntity.PdTime.Split("|"); + DateTime.TryParse(PdTimes[0], out PdTimestart); + DateTime.TryParse(PdTimes[1], out PdTimeend); + PdTimeend = PdTimeend.AddDays(1); + } + + var query = (from hod in _context.ExpertOrderDispatches.Where(x => x.RecStatus == "A") + + + join a in _context.CooperOrders on hod.Orderid equals a.Id + + join b in listCode.Where(x => x.CodeTable == "CooperOrder" && x.CodeField == "shouli_status") + on a.ShouliStatus equals b.CodeSn + into bsss + from bbb in bsss.DefaultIfEmpty() + + join f in listCode.Where(x => x.CodeTable == "CooperVisit" && x.CodeField == "jtype") + on a.OrderType equals f.CodeSn + into fsssss + from fff in fsssss.DefaultIfEmpty() + + + join k in listCode.Where(x => x.CodeTable == "system" && x.CodeField == "shifou") + on hod.Sort equals k.CodeSn + into ksssss + from kkk in ksssss.DefaultIfEmpty() + + + join ggg in _context.CooperatecustomCustomers + on a.Khdw equals ggg.Id + + + + + join expt in _context.Experts + on hod.ExpertId equals expt.Id + + + + where a.RecStatus == "A" + && (string.IsNullOrWhiteSpace(searchEntity.PdTime) || (hod.Createtime >= PdTimestart && hod.Createtime <= PdTimeend)) + && (string.IsNullOrWhiteSpace(searchEntity.ExpertId) || hod.ExpertId == searchEntity.ExpertId.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.OrderNo) || a.OrderNo.Contains(searchEntity.OrderNo.Trim())) + + && (string.IsNullOrWhiteSpace(searchEntity.Sort) || hod.Sort == searchEntity.Sort.Trim()) + + + + + + select new ExpertOrderDipatchDTO + { + Id = hod.Id, + XdTime = a.XdTime, + XdTimeName = a.XdTime.ToString("yyyy-MM-dd"), + OrderId = a.Id, + OrderNo = a.OrderNo, + Khdw = a.Khdw, + KhdwName = ggg.Name, + OrderType = a.OrderType, + OrderTypeName = fff.Comments, + + //OrderPro = a.OrderPro, + //OrderProName = hhh.Name, + //OrderNum = a.OrderNum, + + Shr = a.Shr, + ShrAddress = a.ShrAddress, + ShrTel = a.ShrTel, + Money = hod.Money, + Creater = hod.Creater, + Createtime = hod.Createtime, + CreatetimeName = hod.Createtime.ToString("yyyy-MM-dd"), + ExpertId = hod.ExpertId, + ExpertName = expt.Name, + RecStatus = hod.RecStatus, + Modifier = hod.Modifier, + Modifytime = hod.Modifytime, + sort = kkk.Comments, + + } + ).OrderByDescending(x => x.XdTime).ToList(); + + + + if (searchEntity.totalrows == 0) + searchEntity.totalrows = query.Count(); + var lianlist = query.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList(); + data.LoadData(searchEntity, lianlist); + return data; + } + #endregion + + + + + public ExpertOrderDipatchDTO GetDispatch(string id) + { + var entity = _context.ExpertOrderDispatches.Find(id); + if (entity.RecStatus != "A") + { + entity = new ExpertOrderDispatch(); + } + var exDTO = _mapper.Map<ExpertOrderDipatchDTO>(entity); + return exDTO; + } } } -- Gitblit v1.9.1