username@email.com
2021-07-16 265f38a3f69276ae97690da64fb8e42be3a940e5
zhengcaioa/Services/CooperOrderService.cs
@@ -720,7 +720,7 @@
        public List<CooperOrderDTO> GetList(string userid, DateTime datemin, DateTime datemax)
        {
            var entity = _context.CooperOrders.Where(x => x.RecStatus == "A" && x.Creater == userid && x.Shoulitime >= datemin && x.Shoulitime < datemax).ToList();
            var entity = _context.CooperOrders.Where(x => x.RecStatus == "A" && x.ShouliStatus != "0" && x.Creater == userid && x.Createtime >= datemin && x.Createtime < datemax).ToList();
@@ -729,5 +729,177 @@
            return result;
        }
        public List<CooperOrderDTO> GetListtongji(string userid, DateTime datemin, DateTime datemax)
        {
            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
                            });
            var entity = (from a in _context.CooperOrders.Where(x => x.RecStatus == "A" && x.ShouliStatus != "0" && x.Creater == userid && x.Createtime >= datemin && x.Createtime < datemax)
                                          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 c in listCode.Where(x => x.CodeTable == "CooperOrder" && x.CodeField == "huifang_status")
                                        on a.HuifangStatus equals c.CodeSn
                                        into csss
                                         from ccc in csss.DefaultIfEmpty()
                                         join d in listCode.Where(x => x.CodeTable == "CooperOrder" && x.CodeField == "pingjia_status")
                                       on a.PingjiaStatus equals d.CodeSn
                                       into dsss
                                         from ddd in dsss.DefaultIfEmpty()
                                         join e in listCode.Where(x => x.CodeTable == "system" && x.CodeField == "shifou")
                                        on a.ChedanStatus equals e.CodeSn
                                        into esssss
                                         from eee in esssss.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 g in _context.CooperatecustomCustomers.Where(x => x.RecStatus == "A")
                                          on a.Khdw equals g.Id
                                         into gsss
                                         from ggg in gsss.DefaultIfEmpty()
                                         join h in _context.Projects.Where(x => x.RecStatus == "A")
                                        on a.OrderPro equals h.Id
                                       into hsss
                                         from hhh in hsss.DefaultIfEmpty()
                                         join i in listCode.Where(x => x.CodeTable == "system" && x.CodeField == "shifou")
                                       on a.WangongStatus equals i.CodeSn
                                       into isssss
                                         from iii in isssss.DefaultIfEmpty()
                                         join j in listCode.Where(x => x.CodeTable == "system" && x.CodeField == "shifou")
                                       on a.SonghuoStatus equals j.CodeSn
                                       into jsssss
                                         from jjj in jsssss.DefaultIfEmpty()
                                         join k in _context.Oayouhuis.Where(x => x.Recstatus == "A")
                                      on a.Id equals k.CooperOrderId
                                      into ksssss
                                         from kkk in ksssss.DefaultIfEmpty()
                                         join l in _context.FiBooks
                                    on a.OrderType1 equals l.Id
                                    into lsssss
                                         from lll in lsssss.DefaultIfEmpty()
                                         join m in _context.FiMembers
                                   on a.OrderType1 equals m.Id
                                   into msssss
                                         from mmm in msssss.DefaultIfEmpty()
                                         select new CooperOrderDTO
                                         {
                                             Id = a.Id,
                                             XdTime = a.XdTime,
                                             XdTimeName = a.XdTime.ToString("yyyy-MM-dd"),
                                             OrderNo = a.OrderNo,
                                             Khdw = a.Khdw,
                                             KhdwName = ggg.Name,
                                             OrderType = a.OrderType,
                                             OrderTypeName = fff.Comments,
                                             OrderPro = a.OrderPro,
                                             OrderProName = hhh.Name,
                                             OrderNum = a.OrderNum,
                                             Price = a.Price,
                                             Money = a.Money,
                                             Shr = a.Shr,
                                             ShrAddress = a.ShrAddress,
                                             ShrTel = a.ShrTel,
                                             Remark = a.Remark,
                                             Creater = a.Creater,
                                             Createtime = a.Createtime,
                                             RecStatus = a.RecStatus,
                                             Modifier = a.Modifier,
                                             Modifytime = a.Modifytime,
                                             ShouliStatus = a.ShouliStatus,
                                             ShouliStatusName = bbb.Comments,
                                             Shoulier = a.Shoulier,
                                             Shoulitime = a.Shoulitime,
                                             ChedanStatus = a.ChedanStatus,
                                             ChedanStatusName = eee.Comments,
                                             Chedaner = a.Chedaner,
                                             Chedantime = a.Chedantime,
                                             Chedan = a.Chedan,
                                             HuifangStatus = a.HuifangStatus,
                                             HuifangStatusName = ccc.Comments,
                                             Huifanger = a.Huifanger,
                                             Huifangtime = a.Huifangtime,
                                             Huifangremark = a.Huifangremark,
                                             PingjiaStatus = a.PingjiaStatus,
                                             PingjiaStatusName = ddd.Comments,
                                             Pingjiaer = a.Pingjiaer,
                                             Pingjiatime = a.Pingjiatime,
                                             Youhui = a.Youhui,
                                             Youhuier = a.Youhuier,
                                             Youhuitime = a.Youhuitime,
                                             SonghuoStatusName = jjj.Comments,
                                             SonghuoStatus = a.SonghuoStatus,
                                             Songhuoer = a.Songhuoer,
                                             Songhuotime = a.Songhuotime,
                                             WangongStatusName = iii.Comments,
                                             WangongStatus = a.WangongStatus,
                                             Wangonger = a.Wangonger,
                                             Wangongtime = a.Wangongtime,
                                             YouhuiStatus = kkk.Id,
                                             OrderType1 = a.OrderType1,
                                             OrderType2 = a.OrderType2,
                                             OrderType1Name = string.IsNullOrEmpty(lll.BookName) ? string.IsNullOrEmpty(mmm.MemberType) ? a.OrderType1 : mmm.MemberType : lll.BookName,
                                             SonghuoGongsi = a.SonghuoGongsi,
                                             SonghuoDanhao = a.SonghuoDanhao,
                                             SonghuoTime1 = a.SonghuoTime1,
                                             HuifangJdr = a.HuifangJdr,
                                             HuifangKehuyijian = a.HuifangKehuyijian,
                                         }
                ).OrderByDescending(x => x.OrderNo).ToList();
            return entity;
        }
    }
}