|
|
|
@ -62,52 +62,99 @@ namespace djy.Service.Ams
|
|
|
|
|
.WhereIf(hou != null, x => hou.Contains(x.GID))
|
|
|
|
|
.WhereIf(req.BDate != null, x => x.CreateTime >= req.BDate)
|
|
|
|
|
.WhereIf(req.EDate != null, x => x.CreateTime <= req.EDate).OrderByDescending(x => x.CreateTime);
|
|
|
|
|
var SASCCODEList = DbBus.Get(DbList.djydb).Select<company_new_param_value>().Where(x => x.ParaCode == "AMSSASCCODE").ToList();
|
|
|
|
|
var list = dto.Page(req.Page, req.Limit).ToList<AMSDto>();
|
|
|
|
|
if (list != null)
|
|
|
|
|
if (req.ReportState == "0")
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
result.count = dto.ToList().Count();
|
|
|
|
|
var SASCCODEList = DbBus.Get(DbList.djydb).Select<company_new_param_value>().Where(x => x.ParaCode == "AMSSASCCODE").ToList();
|
|
|
|
|
var list = dto.Page(req.Page, req.Limit).ToList<AMSDto>();
|
|
|
|
|
if (list != null)
|
|
|
|
|
{
|
|
|
|
|
var SASCCODE = SASCCODEList.Where(x => x.CompId == item.CompID).FirstOrDefault();
|
|
|
|
|
if (SASCCODE != null)
|
|
|
|
|
{
|
|
|
|
|
item.SASCCODE = SASCCODE.ItemCode;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
{
|
|
|
|
|
item.SASCCODE = "NIAV";
|
|
|
|
|
}
|
|
|
|
|
var hodto = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => x.IsDel != true && x.PID == item.GID)
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(req.Hid), x => x.GID == req.Hid)
|
|
|
|
|
.WhereIf(req.HBLNo != null, x => x.HBLNo.Contains(req.HBLNo.Trim()))
|
|
|
|
|
.WhereIf(req.ReportState == "0", x => x.ReportState == "未申报")
|
|
|
|
|
.WhereIf(req.ReportState == "1", x => x.ReportState != "未申报")
|
|
|
|
|
.WhereIf(req.ReportState != null && req.ReportState != "0" && req.ReportState != "1", x => ReportStates.Contains(x.ReportState))
|
|
|
|
|
.ToList<AMS_HouseDto>();
|
|
|
|
|
item.HouseDto = hodto;
|
|
|
|
|
if (hodto != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var it in hodto)
|
|
|
|
|
var SASCCODE = SASCCODEList.Where(x => x.CompId == item.CompID).FirstOrDefault();
|
|
|
|
|
if (SASCCODE != null)
|
|
|
|
|
{
|
|
|
|
|
item.SASCCODE = SASCCODE.ItemCode;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
item.SASCCODE = "NIAV";
|
|
|
|
|
}
|
|
|
|
|
var hodto = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => x.IsDel != true && x.PID == item.GID)
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(req.Hid), x => x.GID == req.Hid)
|
|
|
|
|
.WhereIf(req.HBLNo != null, x => x.HBLNo.Contains(req.HBLNo.Trim()))
|
|
|
|
|
.WhereIf(req.ReportState == "0", x => x.ReportState == "未申报")
|
|
|
|
|
.WhereIf(req.ReportState == "1", x => x.ReportState != "未申报")
|
|
|
|
|
.WhereIf(req.ReportState != null && req.ReportState != "0" && req.ReportState != "1", x => ReportStates.Contains(x.ReportState))
|
|
|
|
|
.ToList<AMS_HouseDto>();
|
|
|
|
|
item.HouseDto = hodto;
|
|
|
|
|
if (hodto != null)
|
|
|
|
|
{
|
|
|
|
|
var cnt = DbBus.Get(DbList.AMSCenter).Select<AMS_Cntrno>().Where(x => x.IsDel != true && x.HID == it.GID).ToList();
|
|
|
|
|
it.CntrnoDto = cnt;
|
|
|
|
|
var historyDto = DbBus.Get(DbList.AMSCenter).Select<AMS_MasterHistory>().Where(x => x.AM_ID == it.GID).OrderByDescending(x => x.SendTime).ToList();
|
|
|
|
|
it.HistoryDto = historyDto;
|
|
|
|
|
foreach (var it in hodto)
|
|
|
|
|
{
|
|
|
|
|
var cnt = DbBus.Get(DbList.AMSCenter).Select<AMS_Cntrno>().Where(x => x.IsDel != true && x.HID == it.GID).ToList();
|
|
|
|
|
it.CntrnoDto = cnt;
|
|
|
|
|
var historyDto = DbBus.Get(DbList.AMSCenter).Select<AMS_MasterHistory>().Where(x => x.AM_ID == it.GID).OrderByDescending(x => x.SendTime).ToList();
|
|
|
|
|
it.HistoryDto = historyDto;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
count += hodto.Count();
|
|
|
|
|
}
|
|
|
|
|
count += hodto.Count();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
result.data = list.Where(x => x.HouseDto != null && x.HouseDto.Count() > 0).ToList();
|
|
|
|
|
if (req.ReportState == "0")
|
|
|
|
|
{
|
|
|
|
|
result.count = list.Where(x => x.HouseDto != null && x.HouseDto.Count() > 0).ToList().Count();
|
|
|
|
|
result.data = list.Where(x => x.HouseDto != null && x.HouseDto.Count() > 0).ToList();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.count = count;
|
|
|
|
|
var g = dto.ToList().Select(x => x.GID).ToList();
|
|
|
|
|
result.count = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => x.IsDel != true && g.Contains(x.PID))
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(req.Hid), x => x.GID == req.Hid)
|
|
|
|
|
.WhereIf(req.HBLNo != null, x => x.HBLNo.Contains(req.HBLNo.Trim()))
|
|
|
|
|
.WhereIf(req.ReportState == "0", x => x.ReportState == "未申报")
|
|
|
|
|
.WhereIf(req.ReportState == "1", x => x.ReportState != "未申报")
|
|
|
|
|
.WhereIf(req.ReportState != null && req.ReportState != "0" && req.ReportState != "1", x => ReportStates.Contains(x.ReportState)).ToList()
|
|
|
|
|
.Count();
|
|
|
|
|
|
|
|
|
|
var SASCCODEList = DbBus.Get(DbList.djydb).Select<company_new_param_value>().Where(x => x.ParaCode == "AMSSASCCODE").ToList();
|
|
|
|
|
var list = dto.ToList<AMSDto>();
|
|
|
|
|
if (list != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
{
|
|
|
|
|
var SASCCODE = SASCCODEList.Where(x => x.CompId == item.CompID).FirstOrDefault();
|
|
|
|
|
if (SASCCODE != null)
|
|
|
|
|
{
|
|
|
|
|
item.SASCCODE = SASCCODE.ItemCode;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
item.SASCCODE = "NIAV";
|
|
|
|
|
}
|
|
|
|
|
var hodto = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => x.IsDel != true && x.PID == item.GID)
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(req.Hid), x => x.GID == req.Hid)
|
|
|
|
|
.WhereIf(req.HBLNo != null, x => x.HBLNo.Contains(req.HBLNo.Trim()))
|
|
|
|
|
.WhereIf(req.ReportState == "0", x => x.ReportState == "未申报")
|
|
|
|
|
.WhereIf(req.ReportState == "1", x => x.ReportState != "未申报")
|
|
|
|
|
.WhereIf(req.ReportState != null && req.ReportState != "0" && req.ReportState != "1", x => ReportStates.Contains(x.ReportState))
|
|
|
|
|
.ToList<AMS_HouseDto>();
|
|
|
|
|
item.HouseDto = hodto.ToList();
|
|
|
|
|
if (hodto != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var it in hodto)
|
|
|
|
|
{
|
|
|
|
|
var cnt = DbBus.Get(DbList.AMSCenter).Select<AMS_Cntrno>().Where(x => x.IsDel != true && x.HID == it.GID).ToList();
|
|
|
|
|
it.CntrnoDto = cnt;
|
|
|
|
|
var historyDto = DbBus.Get(DbList.AMSCenter).Select<AMS_MasterHistory>().Where(x => x.AM_ID == it.GID).OrderByDescending(x => x.SendTime).ToList();
|
|
|
|
|
it.HistoryDto = historyDto;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
result.data = list.Where(x => x.HouseDto != null && x.HouseDto.Count() > 0).Skip((req.Page-1) * req.Limit).Take(req.Limit).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|