From 3262eb334953a1b208aa4a50584442a3804912d9 Mon Sep 17 00:00:00 2001
From: LR-20210131IOQH\Administrator <jackcold@163.com>
Date: 星期日, 27 六月 2021 13:09:43 +0800
Subject: [PATCH] Merge branch 'master' of http://47.108.235.38:8080/r/zhengcaioa
---
zhengcaioa/Services/ProjectService.cs | 93 ++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 85 insertions(+), 8 deletions(-)
diff --git a/zhengcaioa/Services/ProjectService.cs b/zhengcaioa/Services/ProjectService.cs
index 9efb610..4097033 100644
--- a/zhengcaioa/Services/ProjectService.cs
+++ b/zhengcaioa/Services/ProjectService.cs
@@ -27,6 +27,16 @@
ResultEntity resultEntity = new ResultEntity();
try
{
+ var checkUserSn = _context.Projects.Where(x => x.Name == projectDTO.Name && x.RecStatus == "A" && x.Id != projectDTO.Id).FirstOrDefault();
+ if (checkUserSn != null && (string.IsNullOrWhiteSpace(projectDTO.Id) || (!string.IsNullOrWhiteSpace(projectDTO.Id) && checkUserSn.Id != projectDTO.Id)))
+ {
+ resultEntity.Result = false;
+ resultEntity.Message = "椤圭洰閲嶅";
+ return resultEntity;
+ }
+
+
+
var project = _mapper.Map<Project>(projectDTO);
// var ZhuanjiaList = projectDTO.ZhuanjiaList;
//if(ZhuanjiaList!=null&& ZhuanjiaList.Length > 0)
@@ -262,7 +272,7 @@
List<ProjectDTO> list = new List<ProjectDTO>();
//绛涢��
StringBuilder sql = new StringBuilder();
- sql.Append("SELECT distinct a.[Id],a.[start_time] ,b.[name] +'-'+c.[name]+'-'+d.[name] Sheng ,a.city ,a.[area_id],a.cgfs, a.[name] ,a.[number],a.creater,a.createtime,a.modifier,a.modifytime ,a.[drhx],a.[drhx_price],a.[dshx],a.[dshx_price],a.[remark],a.[rec_status],a.[toubiaocishu] ,a.[question] ,a.[zhongbiaocishu],a.[feibiaocishu],a.[zhongbiaojine],a.[Fblx],a.[Fbyy] , a.[zhuanjia] , a.[caigourenname], a.[caigourenaddress], a.[caigourencontact], a.[dailiname], a.[dailiaddress], a.[dailicontact] "); //zhuanjia = stuff((select ','+name from [Zhuanjia] f where CHARINDEX(f.id,a.[zhuanjia]) >0 for xml path('')), 1,1, '')
+ sql.Append("SELECT distinct a.[Id],a.[start_time] ,b.[name] +'-'+c.[name]+'-'+d.[name] Sheng ,a.city ,a.[area_id],a.cgfs, a.[name] ,a.[number],a.creater,a.createtime,a.modifier,a.modifytime ,a.[drhx],a.[drhx_price],a.[dshx],a.[dshx_price],a.[remark],a.[rec_status] ,a.[question] ,a.[zhongbiaocishu],a.[feibiaocishu],a.[zhongbiaojine],a.[Fblx],a.[Fbyy] , a.[zhuanjia] , a.[caigourenname], a.[caigourenaddress], a.[caigourencontact], a.[dailiname], a.[dailiaddress], a.[dailicontact] ,toubiaocishu = stuff((select '銆�'+ f.[names] from [Projectzhongbiao] f where f.[ProjectId] = a.[Id] for xml path('')), 1,1, '') "); //zhuanjia = stuff((select ','+name from [Zhuanjia] f where CHARINDEX(f.id,a.[zhuanjia]) >0 for xml path('')), 1,1, '')
sql.Append("FROM [Project] a ");
sql.Append("left join [Area] b on a.[sheng] = b.[codeID] ");
sql.Append("left join [Area] c on a.[city] = c.[codeID] ");
@@ -276,17 +286,84 @@
}
- if (!string.IsNullOrWhiteSpace(searchEntity.StartTimestar))
+ if (!string.IsNullOrWhiteSpace(searchEntity.NamesToubiao))
{
- sql.Append(" and a.start_time >='"+ searchEntity.StartTimestar.Trim().Replace("'","''") + "'");
-
- }
- if (!string.IsNullOrWhiteSpace(searchEntity.StartTimeend))
- {
- sql.Append(" and a.start_time <='" + DateTime.Parse(searchEntity.StartTimeend.Trim().Replace("'", "''")).AddDays(1).ToString("yyyy-MM-dd") + "'"); ;
+ sql.Append(" and ( exists (select b.[ProjectId] from [Projectzhongbiao] b where a.[Id]=b.[ProjectId] and b.[names] like '%" + searchEntity.NamesToubiao + "%') ");
+
+ sql.Append(" or exists (select c.[ProjectId] from [Projectreason] c where a.[Id]=c.[ProjectId] and c.[reasonname] like '%" + searchEntity.NamesToubiao + "%') ");
+
+ sql.Append(" or exists (select d.[ProjectId] from [Projectyouxiao] d where a.[Id]=d.[ProjectId] and d.[namesyouxiao] like '%" + searchEntity.NamesToubiao + "%') ");
+
+ sql.Append(" or a.[drhx] like '%" + searchEntity.NamesToubiao + "%' ");
+
+ sql.Append(" or a.[dshx] like '%" + searchEntity.NamesToubiao + "%' ");
+
+ sql.Append(" )");
}
+ if (!string.IsNullOrWhiteSpace(searchEntity.Reasonname))
+ {
+ sql.Append(" and exists (select b.[ProjectId] from [Projectreason] b where a.[Id]=b.[ProjectId] and b.[reasonname] like '%" + searchEntity.Reasonname + "%') ");
+
+ }
+
+ if (!string.IsNullOrWhiteSpace(searchEntity.ShiFouyReasonname))
+ {
+ if (searchEntity.ShiFouyReasonname == "A")
+ {
+ sql.Append(" and exists (select b.[ProjectId] from [Projectreason] b where a.[Id]=b.[ProjectId] ) ");
+
+ }
+ else
+ {
+ sql.Append(" and not exists (select b.[ProjectId] from [Projectreason] b where a.[Id]=b.[ProjectId] ) ");
+ }
+
+
+ }
+
+
+ if (!string.IsNullOrWhiteSpace(searchEntity.fblx))
+ {
+ if (searchEntity.fblx == "A")
+ {
+ sql.Append(" and a.fblx is not null ");
+ }
+ else
+ {
+ sql.Append(" and a.fblx is null ");
+ }
+
+
+ }
+
+ DateTime StartTimestarstart = DateTime.Now;
+ DateTime StartTimestarend = DateTime.Now;
+ if (!string.IsNullOrWhiteSpace(searchEntity.StartTimestar))
+ {
+ string[] StartTimestars = searchEntity.StartTimestar.Split("|");
+ DateTime.TryParse(StartTimestars[0], out StartTimestarstart);
+ DateTime.TryParse(StartTimestars[1], out StartTimestarend);
+ //Createtimeend = Createtimeend.AddDays(1);
+ }
+
+
+ if (!string.IsNullOrWhiteSpace(searchEntity.StartTimestar))
+ {
+ sql.Append(" and a.start_time >='" + StartTimestarstart.ToString("yyyy-MM-dd") + "'");
+
+ }
+ if (!string.IsNullOrWhiteSpace(searchEntity.StartTimestar))
+ {
+ sql.Append(" and a.start_time <='" + StartTimestarend.AddDays(1).ToString("yyyy-MM-dd") + "'");
+
+ }
+
+
+
+
+
if (!string.IsNullOrWhiteSpace(searchEntity.Sheng))
{
sql.Append(" and a.[sheng] = '" + searchEntity.Sheng.Trim().Replace("'", "''") + "' ");
--
Gitblit v1.9.1