LR-20210131IOQH\Administrator
2021-08-10 11e11a51839529b17f70927524e086e90adf692d
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)
@@ -292,17 +302,68 @@
            }
            if (!string.IsNullOrWhiteSpace(searchEntity.StartTimestar))
            if (!string.IsNullOrWhiteSpace(searchEntity.Reasonname))
            {
                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 [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("'", "''") + "' ");