From 10ada97c04a399429285003bfcf97bbf8b24e940 Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期一, 21 十一月 2022 14:41:52 +0800 Subject: [PATCH] 项目查询 --- zhengcaioa/Services/ProjectService.cs | 47 ++++++++++++++- zhengcaioa/DTO/ProjectDTO.cs | 2 zhengcaioa/zhengcaioa/Views/Project/Add.cshtml | 3 + zhengcaioa/zhengcaioa/Views/Shared/_Layout_Search.cshtml | 6 +- zhengcaioa/zhengcaioa/Controllers/ProjectController.cs | 45 ++++++++++++++ zhengcaioa/zhengcaioa/Views/Project/Select.cshtml | 18 +++-- 6 files changed, 103 insertions(+), 18 deletions(-) diff --git a/zhengcaioa/DTO/ProjectDTO.cs b/zhengcaioa/DTO/ProjectDTO.cs index a468957..82eff3e 100644 --- a/zhengcaioa/DTO/ProjectDTO.cs +++ b/zhengcaioa/DTO/ProjectDTO.cs @@ -190,5 +190,7 @@ public string Chuanbiaofenxi { get; set; } public string Shifouqueren { get; set; } + public string Wanshan { get; set; } + } } diff --git a/zhengcaioa/Services/ProjectService.cs b/zhengcaioa/Services/ProjectService.cs index 02ce881..6b8ba4d 100644 --- a/zhengcaioa/Services/ProjectService.cs +++ b/zhengcaioa/Services/ProjectService.cs @@ -612,21 +612,58 @@ //} + if (!string.IsNullOrEmpty(searchEntity.Wanshan)) + { + if (searchEntity.Wanshan == "A") + { + sql.Append(" and ( a.[drhx] is null or exists ( select b.[Id] from [CooperatecustomCustomer] b where b.rec_status='A' and a.[drhx] = b.[name] union select c.[Id] from [IntentionCustomer] c where c.rec_status='A' and a.[drhx] = c.[name] ) ) "); + + sql.Append(" and ( a.[drhx] is null or exists ( select b.[Id] from [CooperatecustomCustomer] b where b.rec_status='A' and a.[dshx] = b.[name] union select c.[Id] from [IntentionCustomer] c where c.rec_status='A' and a.[dshx] = c.[name] ) ) "); + + sql.Append(" and ( a.[drhx] is null or exists ( select b.[Id] from [CooperatecustomCustomer] b where b.rec_status='A' and a.[caigourenname] = b.[name] union select c.[Id] from [IntentionCustomer] c where c.rec_status='A' and a.[caigourenname] = c.[name] ) ) "); + + sql.Append(" and ( a.[drhx] is null or exists ( select b.[Id] from [CooperatecustomCustomer] b where b.rec_status='A' and a.[dailiname] = b.[name] union select c.[Id] from [IntentionCustomer] c where c.rec_status='A' and a.[dailiname] = c.[name] ) ) "); + + sql.Append(" and ( a.[drhx] is null or exists ( select b.[Id] from [CooperatecustomCustomer] b where b.rec_status='A' and a.[drhx] = b.[name] union select c.[Id] from [IntentionCustomer] c where c.rec_status='A' and a.[drhx] = c.[name] ) ) "); + + sql.Append(" and ( (select count(b.zhongbiaoId) from [Projectzhongbiao] b where a.[Id]=b.[ProjectId] ) = 0 or ( (select count(b.zhongbiaoId) from [Projectzhongbiao] b where a.[Id]=b.[ProjectId] ) = ( select count(b.zhongbiaoId) from [Projectzhongbiao] b where a.[Id]=b.[ProjectId] and exists ( select d.[Id] from [CooperatecustomCustomer] d where d.rec_status='A' and b.[names] = d.[name] union select c.[Id] from [IntentionCustomer] c where c.rec_status='A' and b.[names] = c.[name] ) ))) "); + sql.Append(" and ( (select count(b.youxiaoId) from [Projectyouxiao] b where a.[Id]=b.[ProjectId] ) = 0 or ( (select count(b.youxiaoId) from [Projectyouxiao] b where a.[Id]=b.[ProjectId] ) = ( select count(b.youxiaoId) from [Projectyouxiao] b where a.[Id]=b.[ProjectId] and exists ( select d.[Id] from [CooperatecustomCustomer] d where d.rec_status='A' and b.[namesyouxiao] = d.[name] union select c.[Id] from [IntentionCustomer] c where c.rec_status='A' and b.[namesyouxiao] = c.[name] ) ))) "); + sql.Append(" and ( (select count(b.reasonId) from [Projectreason] b where a.[Id]=b.[ProjectId] ) = 0 or ( (select count(b.reasonId) from [Projectreason] b where a.[Id]=b.[ProjectId] ) = ( select count(b.reasonId) from [Projectreason] b where a.[Id]=b.[ProjectId] and exists ( select d.[Id] from [CooperatecustomCustomer] d where d.rec_status='A' and b.[reasonname] = d.[name] union select c.[Id] from [IntentionCustomer] c where c.rec_status='A' and b.[reasonname] = c.[name] ) ))) "); + } + else + { + sql.Append(" and not ( ( a.[drhx] is null or exists ( select b.[Id] from [CooperatecustomCustomer] b where b.rec_status='A' and a.[drhx] = b.[name] union select c.[Id] from [IntentionCustomer] c where c.rec_status='A' and a.[drhx] = c.[name] ) ) "); + + sql.Append(" and ( a.[drhx] is null or exists ( select b.[Id] from [CooperatecustomCustomer] b where b.rec_status='A' and a.[dshx] = b.[name] union select c.[Id] from [IntentionCustomer] c where c.rec_status='A' and a.[dshx] = c.[name] ) ) "); + + sql.Append(" and ( a.[drhx] is null or exists ( select b.[Id] from [CooperatecustomCustomer] b where b.rec_status='A' and a.[caigourenname] = b.[name] union select c.[Id] from [IntentionCustomer] c where c.rec_status='A' and a.[caigourenname] = c.[name] ) ) "); + + sql.Append(" and ( a.[drhx] is null or exists ( select b.[Id] from [CooperatecustomCustomer] b where b.rec_status='A' and a.[dailiname] = b.[name] union select c.[Id] from [IntentionCustomer] c where c.rec_status='A' and a.[dailiname] = c.[name] ) ) "); + + sql.Append(" and ( a.[drhx] is null or exists ( select b.[Id] from [CooperatecustomCustomer] b where b.rec_status='A' and a.[drhx] = b.[name] union select c.[Id] from [IntentionCustomer] c where c.rec_status='A' and a.[drhx] = c.[name] ) ) "); + + sql.Append(" and ( (select count(b.zhongbiaoId) from [Projectzhongbiao] b where a.[Id]=b.[ProjectId] ) = 0 or ( (select count(b.zhongbiaoId) from [Projectzhongbiao] b where a.[Id]=b.[ProjectId] ) = ( select count(b.zhongbiaoId) from [Projectzhongbiao] b where a.[Id]=b.[ProjectId] and exists ( select d.[Id] from [CooperatecustomCustomer] d where d.rec_status='A' and b.[names] = d.[name] union select c.[Id] from [IntentionCustomer] c where c.rec_status='A' and b.[names] = c.[name] ) ))) "); + sql.Append(" and ( (select count(b.youxiaoId) from [Projectyouxiao] b where a.[Id]=b.[ProjectId] ) = 0 or ( (select count(b.youxiaoId) from [Projectyouxiao] b where a.[Id]=b.[ProjectId] ) = ( select count(b.youxiaoId) from [Projectyouxiao] b where a.[Id]=b.[ProjectId] and exists ( select d.[Id] from [CooperatecustomCustomer] d where d.rec_status='A' and b.[namesyouxiao] = d.[name] union select c.[Id] from [IntentionCustomer] c where c.rec_status='A' and b.[namesyouxiao] = c.[name] ) ))) "); + sql.Append(" and ( (select count(b.reasonId) from [Projectreason] b where a.[Id]=b.[ProjectId] ) = 0 or ( (select count(b.reasonId) from [Projectreason] b where a.[Id]=b.[ProjectId] ) = ( select count(b.reasonId) from [Projectreason] b where a.[Id]=b.[ProjectId] and exists ( select d.[Id] from [CooperatecustomCustomer] d where d.rec_status='A' and b.[reasonname] = d.[name] union select c.[Id] from [IntentionCustomer] c where c.rec_status='A' and b.[reasonname] = c.[name] ) ))) ) "); + } + } - - var query = _context.Projects + var query = _context.Projects .FromSqlRaw(sql.ToString()).OrderByDescending(x=>x.StartTime) .ToList(); - - + + + + + //if (searchEntity.totalrows == 0) - searchEntity.totalrows = query.Count(); + searchEntity.totalrows = query.Count(); var lianlist = query.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList(); list = _mapper.Map<List<ProjectDTO>>(lianlist); diff --git a/zhengcaioa/zhengcaioa/Controllers/ProjectController.cs b/zhengcaioa/zhengcaioa/Controllers/ProjectController.cs index e074cec..2ce14a0 100644 --- a/zhengcaioa/zhengcaioa/Controllers/ProjectController.cs +++ b/zhengcaioa/zhengcaioa/Controllers/ProjectController.cs @@ -389,6 +389,9 @@ ViewBag.Baomingtimebegin = DateTime.Now.AddMonths(-6).ToString("yyyy-MM-dd"); ViewBag.Baomingtimeend = DateTime.Now.ToString("yyyy-MM-dd"); + + ViewBag.wanshan = _liaotianService.GetSYScode("Project", "wanshan").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + return View(); } @@ -452,6 +455,15 @@ } } + var feibiaoliyous = cDocumet.QuerySelectorAll("div").Where(m => m.Id == "_notice_content_reason-reason"); + if (feibiaoliyous != null && feibiaoliyous.ToList().Count > 0) + { + var feibiaoliyou = feibiaoliyous.First(); + projectDTO.Fbyy = feibiaoliyou.TextContent.Replace("\n", "").Replace("\t", ""); + projectDTO.Fblx = "缁堟閲囪喘"; + } + + var Numbers = cDocumet.QuerySelectorAll("h4"); foreach(var Number in Numbers ) { @@ -479,6 +491,7 @@ { var Fbyy = Number.QuerySelector("span"); projectDTO.Fbyy = Fbyy.TextContent.Trim(); + projectDTO.Fblx = "鍋滄璇勫"; } } var Caigourennames = cDocumet.QuerySelectorAll("span").Where(m => m.Id == "_notice_content_noticePurchase-purchaserOrgName"); @@ -567,6 +580,14 @@ } projectDTO.StartTimestr = timestr; } + + var tittle = document.QuerySelector("h1"); + if (tittle != null) + { + string tittlestr = tittle.TextContent; + + projectDTO.Name = tittlestr; + } var table = document.QuerySelector("table").QuerySelectorAll("tr"); if (table != null) { @@ -587,14 +608,34 @@ } } - else if (select != null && select.TextContent.IndexOf("椤圭洰鍚嶇О") >= 0) + //else if (select != null && select.TextContent.IndexOf("椤圭洰鍚嶇О") >= 0) + //{ + // if (table[i + 1] != null) + // { + // var td1 = table[i + 1].QuerySelector("td"); + // if (td1 != null) + // { + // projectDTO.Name = table[i + 1].QuerySelector("td").TextContent.Trim();//OuterHtml + // } + // } + + //} + else if (select != null && select.TextContent.IndexOf("椤圭洰缁堟鐨勫師鍥�") >= 0) { if (table[i + 1] != null) { var td1 = table[i + 1].QuerySelector("td"); if (td1 != null) { - projectDTO.Name = table[i + 1].QuerySelector("td").TextContent.Trim();//OuterHtml + projectDTO.Fbyy = table[i + 1].QuerySelector("td").TextContent.Trim();//OuterHtml + if (projectDTO.Fbyy.IndexOf("缁堟")<0) + { + projectDTO.Fblx = "鍋滄璇勫"; + } + else + { + projectDTO.Fblx = "缁堟閲囪喘"; + } } } diff --git a/zhengcaioa/zhengcaioa/Views/Project/Add.cshtml b/zhengcaioa/zhengcaioa/Views/Project/Add.cshtml index affdf9b..0560fe1 100644 --- a/zhengcaioa/zhengcaioa/Views/Project/Add.cshtml +++ b/zhengcaioa/zhengcaioa/Views/Project/Add.cshtml @@ -942,6 +942,9 @@ Caigouyusuan.val(data.CaigouyusuanName); var Fbyy = $("#Fbyy"); Fbyy.val(data.Fbyy); + var Fblx = $("#Fblx"); + Fblx.val(data.Fblx); + var Name = $("#Name"); Name.val(data.Name); var Zhuanjia = $("#Zhuanjia"); diff --git a/zhengcaioa/zhengcaioa/Views/Project/Select.cshtml b/zhengcaioa/zhengcaioa/Views/Project/Select.cshtml index 424536a..76e8649 100644 --- a/zhengcaioa/zhengcaioa/Views/Project/Select.cshtml +++ b/zhengcaioa/zhengcaioa/Views/Project/Select.cshtml @@ -16,7 +16,7 @@ var ShiFouyReasonname = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.ShiFouyReasonname))'; var Baomingtimebegin = '@Html.Raw(ViewBag.Baomingtimebegin)'; var Baomingtimeend = '@Html.Raw(ViewBag.Baomingtimeend)'; - + var wanshan = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.wanshan))'; loseherght = 110; dataCol = [ { label: 'id', name: 'Id', labtype: 'txt', hidden: true }, @@ -101,7 +101,7 @@ label: '璐ㄧ枒', name: 'Zhiyistatus', labtype: 'txt', hidden: false, width: 60, formatter: function (cellvalue, options, rowObject) { - + return "<a onclick=\"OpenWindow('" + rowObject.Name + "','98%','100%', '/Project/Add?id=" + rowObject.Id + "')\" >" + cellvalue + "</a>"; } @@ -110,7 +110,7 @@ label: '鎶曡瘔', name: 'Tousustatus', labtype: 'txt', hidden: false, width: 60, formatter: function (cellvalue, options, rowObject) { - + return "<a onclick=\"OpenWindow('" + rowObject.Name + "','98%','100%', '/Project/Add?id=" + rowObject.Id + "')\" >" + cellvalue + "</a>"; } @@ -129,7 +129,7 @@ { label: '椤圭洰鍚嶇О', name: 'Name', labtype: 'txt', hidden: false }, { label: '璇勫涓撳', name: 'Zhuanjia', labtype: 'txt', hidden: false/*, cwidth: '8.5%', cccwidth: '15%' */ }, - { label: '閲囪喘浠g悊浜�', name: 'Caigourenname', labtype: 'txt', hidden: false }, + { label: '閲囪喘浜�', name: 'Caigourenname', labtype: 'txt', hidden: false }, { label: '閲囪喘浠g悊鏈烘瀯', name: 'Dailiname', labtype: 'txt', hidden: false }, { label: '閲囪喘鏂瑰紡', name: 'Cgfs', labtype: 'combox', hidden: false, data: JSON.parse(projectDropDown) }, @@ -146,9 +146,11 @@ { label: '鍒嗗樊澶т簬', name: 'Fenchadayu', labtype: 'txt', hidden: false/*, cwidth: '8.5%', cccwidth: '15%' */ }, { label: '渚涘簲鍟嗘暟閲�', name: 'Shuliang', labtype: 'txt', hidden: false/*, cwidth: '8.5%', cccwidth: '15%' */ }, //{ label: '浠峰樊灏忎簬', name: 'Baojiachaxiaoyu', labtype: 'txt', hidden: false/*, cwidth: '8.5%', cccwidth: '15%' */ }, - { label: '鏄惁纭', name: 'Shifouqueren', labtype: 'combox', hidden: false, data: JSON.parse(flbx) }, - - + { label: '鏄惁纭', name: 'Shifouqueren', labtype: 'combox', hidden: false, data: JSON.parse(flbx) }, + { label: '渚涘簲鍟嗕俊鎭�', name: 'Wanshan', labtype: 'combox', hidden: false, data: JSON.parse(wanshan) }, + + + ]; var _pageAdd = function () { OpenWindow("鏂板椤圭洰", "98%", "90%", "/Project/Add/"); @@ -293,7 +295,7 @@ $("#PBSReasonname").parent().after("<br>"); $("#PBSCreater").parent().next().remove(); $("#PBSFenchadayu").parent().after("<br>"); - + $("#PBSShifouqueren").parent().next().remove(); $("#PBSStartTimestarend").val(Baomingtimeend); diff --git a/zhengcaioa/zhengcaioa/Views/Shared/_Layout_Search.cshtml b/zhengcaioa/zhengcaioa/Views/Shared/_Layout_Search.cshtml index a46e601..0011c7f 100644 --- a/zhengcaioa/zhengcaioa/Views/Shared/_Layout_Search.cshtml +++ b/zhengcaioa/zhengcaioa/Views/Shared/_Layout_Search.cshtml @@ -30,7 +30,7 @@ if (MaxCol>0) { } else { - MaxCol = 20; + MaxCol = 30; } </script> @@ -100,12 +100,12 @@ <a class="btn btn-default btn-outline @(item.OpenType==1? "J_menuItem": "")" @(item.OpenType == 2 ? "target=_blank" : "") @(item.OpenType != 0 ? "href=" + item.ActionUrl + "" : "") @(item.OpenType == 0 ? "onclick=_page" + item.ActionFun + "()" : "")> <!--<i class="glyphicon glyphicon-search"></i>--><i class="@item.PageIco"></i> <span class="bold">@item.ActionName</span> </a> - if (item.ActionFun == "Search") + @*if (item.ActionFun == "Search") { <a id="searchmorendatabtn" class="btn btn-default btn-outline @(item.OpenType == 1 ? "J_menuItem" : "")" @(item.OpenType == 2 ? "target=_blank" : "") @(item.OpenType != 0 ? "href=" + item.ActionUrl + "" : "") @(item.OpenType == 0 ? "onclick=_pageSearchMoren()" : "")> <i class="fa fa-search-plus"></i> <span class="bold">楂樼骇</span> </a> - } + }*@ } </div> -- Gitblit v1.9.1