安全不符合项清单
This commit is contained in:
+4
-1
@@ -301,6 +301,7 @@
|
||||
<Compile Include="BaseInfo\UnitTypeService.cs" />
|
||||
<Compile Include="BaseInfo\WorkPostService.cs" />
|
||||
<Compile Include="BaseInfo\WorkStageService.cs" />
|
||||
<Compile Include="Check\HSE\CheckProblemSafetyService.cs" />
|
||||
<Compile Include="Common\AttachFileService.cs" />
|
||||
<Compile Include="Common\Captcha.cs" />
|
||||
<Compile Include="Common\CodeRecordsService.cs" />
|
||||
@@ -1206,7 +1207,9 @@
|
||||
<ItemGroup>
|
||||
<WCFMetadataStorage Include="Service References\CNCECHSSEService\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Folder Include="Check\QMS\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\Microsoft.Extensions.Logging.Abstractions.6.0.0\build\Microsoft.Extensions.Logging.Abstractions.targets" Condition="Exists('..\packages\Microsoft.Extensions.Logging.Abstractions.6.0.0\build\Microsoft.Extensions.Logging.Abstractions.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
|
||||
@@ -91,16 +91,16 @@ namespace BLL
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 教材库下拉框
|
||||
/// 问题分类明细项下拉框
|
||||
/// </summary>
|
||||
/// <param name="dropName">下拉框名字</param>
|
||||
/// <param name="workPostId">职务Id</param>
|
||||
/// <param name="classifyId">分类Id</param>
|
||||
/// <param name="isShowPlease">是否显示请选择</param>
|
||||
public static void InitClassifyItemDownList(FineUIPro.DropDownList dropName, string workPostId, bool isShowPlease)
|
||||
public static void InitClassifyItemDownList(FineUIPro.DropDownList dropName, string classifyId, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "ClassifyItemId";
|
||||
dropName.DataTextField = "ClassifyItemName";
|
||||
dropName.DataSource = GetClassifyItemList(workPostId);
|
||||
dropName.DataSource = GetClassifyItemList(classifyId);
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
|
||||
@@ -85,12 +85,12 @@ namespace BLL
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型下拉框(末级)
|
||||
/// 类型下拉框
|
||||
/// </summary>
|
||||
/// <param name="dropName"></param>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="isShowPlease"></param>
|
||||
public static void InitClassifyIsEndDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
|
||||
public static void InitClassifyDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "ClassifyId";
|
||||
dropName.DataTextField = "ClassifyName";
|
||||
|
||||
@@ -95,16 +95,16 @@ namespace BLL
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 教材库下拉框
|
||||
/// 问题性质明细下拉框
|
||||
/// </summary>
|
||||
/// <param name="dropName">下拉框名字</param>
|
||||
/// <param name="workPostId">职务Id</param>
|
||||
/// <param name="natureId">性质Id</param>
|
||||
/// <param name="isShowPlease">是否显示请选择</param>
|
||||
public static void InitNatureItemDownList(FineUIPro.DropDownList dropName, string workPostId, bool isShowPlease)
|
||||
public static void InitNatureItemDownList(FineUIPro.DropDownList dropName, string natureId, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "NatureItemId";
|
||||
dropName.DataTextField = "NatureItemName";
|
||||
dropName.DataSource = GetNatureItemList(workPostId);
|
||||
dropName.DataTextField = "NatureItemContent";
|
||||
dropName.DataSource = GetNatureItemList(natureId);
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
@@ -115,14 +115,14 @@ namespace BLL
|
||||
/// <summary>
|
||||
/// 获取下拉项
|
||||
/// </summary>
|
||||
/// <param name="classifyId"></param>
|
||||
/// <param name="natureId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Base_SafetyProblemNatureItem> GetNatureItemList(string classifyId)
|
||||
public static List<Model.Base_SafetyProblemNatureItem> GetNatureItemList(string natureId)
|
||||
{
|
||||
var lst = (from x in Funs.DB.Base_SafetyProblemNatureItem orderby x.NatureItemCode select x).ToList();
|
||||
if (!string.IsNullOrWhiteSpace(classifyId))
|
||||
if (!string.IsNullOrWhiteSpace(natureId))
|
||||
{
|
||||
lst = lst.Where(x => x.NatureId == classifyId).ToList();
|
||||
lst = lst.Where(x => x.NatureId == natureId).ToList();
|
||||
}
|
||||
return lst;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace BLL
|
||||
/// <param name="dropName"></param>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="isShowPlease"></param>
|
||||
public static void InitNatureIsEndDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
|
||||
public static void InitNatureDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "NatureId";
|
||||
dropName.DataTextField = "NatureName";
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
using System;
|
||||
using Model;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 安全不符合项清单
|
||||
/// </summary>
|
||||
public static class CheckProblemSafetyService
|
||||
{
|
||||
#region Fields
|
||||
|
||||
public static Dictionary<string, int> StateMap = new Dictionary<string, int>
|
||||
{
|
||||
{ "整改中" ,(int)StateInt.整改中},
|
||||
{ "已闭环" ,(int)StateInt.已闭环},
|
||||
};
|
||||
|
||||
#endregion Fields
|
||||
|
||||
#region Enums
|
||||
|
||||
public enum StateInt : int
|
||||
{
|
||||
整改中 = 1,
|
||||
已闭环 = 0
|
||||
}
|
||||
|
||||
#endregion Enums
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// 根据ID获取检查记录
|
||||
/// </summary>
|
||||
/// <param name="checkId">检查记录ID</param>
|
||||
/// <returns>检查记录</returns>
|
||||
public static Model.CheckProblem_Safety GetCheckProblemById(string checkId)
|
||||
{
|
||||
return Funs.DB.CheckProblem_Safety.FirstOrDefault(e => e.CheckId == checkId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加检查记录
|
||||
/// </summary>
|
||||
/// <param name="model">检查记录</param>
|
||||
public static void AddCheckProblem(Model.CheckProblem_Safety model)
|
||||
{
|
||||
using (Model.CNPCDB db = new Model.CNPCDB(Funs.ConnString))
|
||||
{
|
||||
Model.CheckProblem_Safety newModel = new Model.CheckProblem_Safety
|
||||
{
|
||||
CheckId = model.CheckId,
|
||||
UnitId = model.UnitId,
|
||||
UnitName = model.UnitName,
|
||||
ProjectId = model.ProjectId,
|
||||
ProjectName = model.ProjectName,
|
||||
State = model.State,
|
||||
Address = model.Address,
|
||||
Description = model.Description,
|
||||
UnitType = model.UnitType,
|
||||
AssemblyName = model.AssemblyName,
|
||||
//CheckUserId = model.CheckUserId,
|
||||
//CheckUserName = model.CheckUserName,
|
||||
CheckTeamUser = model.CheckTeamUser,
|
||||
CheckDate = model.CheckDate,
|
||||
LimitDate = model.LimitDate,
|
||||
CloseTime = model.CloseTime,
|
||||
RectificationUserId = model.RectificationUserId,
|
||||
RectificationUserName = model.RectificationUserName,
|
||||
PMUserId = model.PMUserId,
|
||||
PMUserName = model.PMUserName,
|
||||
ClassifyId = model.ClassifyId,
|
||||
ClassifyItemId = model.ClassifyItemId,
|
||||
NatureId = model.NatureId,
|
||||
NatureItemId = model.NatureItemId,
|
||||
AttachUrl = model.AttachUrl,
|
||||
RectificationUrl = model.RectificationUrl,
|
||||
Remark = model.Remark,
|
||||
CompileMan = model.CompileMan,
|
||||
CompileManName = model.CompileManName,
|
||||
CompileDate = DateTime.Now
|
||||
};
|
||||
db.CheckProblem_Safety.InsertOnSubmit(newModel);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新检查记录
|
||||
/// </summary>
|
||||
/// <param name="model">检查记录</param>
|
||||
public static void UpdateCheckProblem(Model.CheckProblem_Safety model)
|
||||
{
|
||||
using (Model.CNPCDB db = new Model.CNPCDB(Funs.ConnString))
|
||||
{
|
||||
Model.CheckProblem_Safety newModel = db.CheckProblem_Safety.FirstOrDefault(e => e.CheckId == model.CheckId);
|
||||
if (newModel != null)
|
||||
{
|
||||
newModel.CheckDate = model.CheckDate;
|
||||
newModel.UnitId = model.UnitId;
|
||||
newModel.UnitName = model.UnitName;
|
||||
newModel.ProjectId = model.ProjectId;
|
||||
newModel.ProjectName = model.ProjectName;
|
||||
newModel.State = model.State;
|
||||
newModel.Address = model.Address;
|
||||
newModel.Description = model.Description;
|
||||
newModel.UnitType = model.UnitType;
|
||||
newModel.AssemblyName = model.AssemblyName;
|
||||
//newModel.CheckUserId = model.CheckUserId;
|
||||
//newModel.CheckUserName = model.CheckUserName;
|
||||
newModel.CheckTeamUser = model.CheckTeamUser;
|
||||
newModel.CheckDate = model.CheckDate;
|
||||
newModel.LimitDate = model.LimitDate;
|
||||
newModel.CloseTime = model.CloseTime;
|
||||
newModel.RectificationUserId = model.RectificationUserId;
|
||||
newModel.RectificationUserName = model.RectificationUserName;
|
||||
newModel.PMUserId = model.PMUserId;
|
||||
newModel.PMUserName = model.PMUserName;
|
||||
newModel.ClassifyId = model.ClassifyId;
|
||||
newModel.ClassifyItemId = model.ClassifyItemId;
|
||||
newModel.NatureId = model.NatureId;
|
||||
newModel.NatureItemId = model.NatureItemId;
|
||||
newModel.AttachUrl = model.AttachUrl;
|
||||
newModel.RectificationUrl = model.RectificationUrl;
|
||||
newModel.Remark = model.Remark;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string ConvertState(int state)
|
||||
{
|
||||
string result = string.Empty;
|
||||
result = StateMap.First(c => c.Value == state).Key;
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除检查记录
|
||||
/// </summary>
|
||||
/// <param name="checkId">检查记录ID</param>
|
||||
public static void DeleteCheckProblemById(string checkId)
|
||||
{
|
||||
using (Model.CNPCDB db = new Model.CNPCDB(Funs.ConnString))
|
||||
{
|
||||
var model = db.CheckProblem_Safety.FirstOrDefault(e => e.CheckId == checkId);
|
||||
if (model != null)
|
||||
{
|
||||
// 删除附件
|
||||
if (!string.IsNullOrEmpty(model.AttachUrl))
|
||||
{
|
||||
BLL.UploadFileService.DeleteFile(Funs.RootPath, model.AttachUrl);
|
||||
}
|
||||
// 删除附件
|
||||
if (!string.IsNullOrEmpty(model.RectificationUrl))
|
||||
{
|
||||
BLL.UploadFileService.DeleteFile(Funs.RootPath, model.RectificationUrl);
|
||||
}
|
||||
//// 删除编码记录
|
||||
//BLL.CodeRecordsService.DeleteCodeRecordsByDataId(checkId);
|
||||
// 删除附件
|
||||
BLL.CommonService.DeleteAttachFileById(checkId);
|
||||
|
||||
db.CheckProblem_Safety.DeleteOnSubmit(model);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据项目和时间段获取检查数量
|
||||
/// </summary>
|
||||
/// <param name="projectId">项目ID</param>
|
||||
/// <param name="startTime">开始时间</param>
|
||||
/// <param name="endTime">结束时间</param>
|
||||
/// <returns>检查数量</returns>
|
||||
public static int GetCount(string projectId, DateTime startTime, DateTime endTime)
|
||||
{
|
||||
return (from x in Funs.DB.CheckProblem_Safety
|
||||
where x.ProjectId == projectId && x.CheckDate >= startTime && x.CheckDate <= endTime
|
||||
select x).Count();
|
||||
}
|
||||
//public static int GetCount(string checkMainType)
|
||||
//{
|
||||
// return (from x in Funs.DB.CheckProblem_Safety
|
||||
// where x.CheckMainType == checkMainType
|
||||
// select x.CheckProblemId).Count();
|
||||
//}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否可以删除检查记录
|
||||
/// </summary>
|
||||
/// <param name="checkId">检查记录ID</param>
|
||||
/// <returns>true=可以删除,false=不能删除</returns>
|
||||
public static bool CanDeleteCheckProblem(string checkId)
|
||||
{
|
||||
var model = GetCheckProblemById(checkId);
|
||||
if (model == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// 只有"整改中"状态可以删除,其他状态不能删除
|
||||
return model.State == (int)StateInt.整改中;
|
||||
}
|
||||
|
||||
|
||||
#endregion Methods
|
||||
}
|
||||
}
|
||||
@@ -1806,8 +1806,29 @@ namespace BLL
|
||||
public const string ProjectProjectMapMenuId = "F266456A-991F-45A3-BCD6-CF2515D71E39";
|
||||
#endregion
|
||||
|
||||
|
||||
#region 不符合项
|
||||
|
||||
#region 不符合项导入模版
|
||||
|
||||
/// <summary>
|
||||
/// 安全危害因素数据导入模板
|
||||
/// </summary>
|
||||
public const string CheckProblemSafetyDataInTemplateUrl = "File\\Excel\\DataIn\\安全不符合项清单导入模板.xlsx";
|
||||
|
||||
#endregion
|
||||
|
||||
#region 不符合项菜单
|
||||
|
||||
/// <summary>
|
||||
/// HSE不符合清单
|
||||
/// </summary>
|
||||
public const string SafetyCheckProblemMenuId = "664ACF2F-6750-4389-AF11-F429010FC9A7";
|
||||
|
||||
#endregion
|
||||
|
||||
#region 不符合项基础字典
|
||||
|
||||
/// <summary>
|
||||
/// 安全问题分类
|
||||
/// </summary>
|
||||
@@ -1827,6 +1848,8 @@ namespace BLL
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region 岗位培训
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -10,8 +10,6 @@ namespace BLL
|
||||
|
||||
public static class LoginService
|
||||
{
|
||||
public static CNPCDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 用户登录成功方法
|
||||
/// </summary>
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
namespace BLL
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Model;
|
||||
using System;
|
||||
|
||||
public static class ProjectPageDataService
|
||||
{
|
||||
public static CNPCDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
///获取移动端首页
|
||||
/// </summary>
|
||||
|
||||
@@ -202,6 +202,7 @@
|
||||
select x).ToList();
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 项目属性下拉框
|
||||
/// </summary>
|
||||
@@ -458,6 +459,31 @@
|
||||
}
|
||||
|
||||
#region 项目表下拉框
|
||||
|
||||
/// <summary>
|
||||
/// 项目表下拉框
|
||||
/// </summary>
|
||||
/// <param name="dropName">下拉框名字</param>
|
||||
/// <param name="isShowPlease">是否显示请选择</param>
|
||||
public static void InitProjectDropDownList(FineUIPro.DropDownList dropName, string unitId, bool isShowPlease)
|
||||
{
|
||||
var IsThisUnit = CommonService.GetThisUnitId() == unitId ? true : false;
|
||||
dropName.DataValueField = "ProjectId";
|
||||
dropName.DataTextField = "ProjectName";
|
||||
if (IsThisUnit)
|
||||
{
|
||||
dropName.DataSource = GetProjectWorkList();
|
||||
}
|
||||
else
|
||||
{
|
||||
dropName.DataSource =GetProjectWorkList(unitId);
|
||||
}
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 项目表下拉框
|
||||
/// </summary>
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
|
||||
public static class ProjectUserService
|
||||
{
|
||||
public static CNPCDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
///获取项目用户信息
|
||||
/// </summary>
|
||||
@@ -59,8 +57,8 @@
|
||||
UnitId = projectUser.UnitId,
|
||||
RoleId = projectUser.RoleId,
|
||||
IsPost = projectUser.IsPost,
|
||||
MainCNProfessionalId=projectUser.MainCNProfessionalId,
|
||||
ViceCNProfessionalId=projectUser.ViceCNProfessionalId
|
||||
MainCNProfessionalId = projectUser.MainCNProfessionalId,
|
||||
ViceCNProfessionalId = projectUser.ViceCNProfessionalId
|
||||
};
|
||||
//newProjectUser.RoleName = projectUser.RoleName;
|
||||
db.Project_ProjectUser.InsertOnSubmit(newProjectUser);
|
||||
@@ -154,7 +152,7 @@
|
||||
|
||||
public static List<Sys_User> GetProjectUserByUnitidAndProjectId(string ProjectId, string UnitId, string RoleId)
|
||||
{
|
||||
var ids = Funs.DB.Project_ProjectUser.Where(e => e.ProjectId == ProjectId &&( UnitId==""|| e.UnitId == UnitId)&&(RoleId==""||e.RoleId.Contains(RoleId)) ).Select(u => u.UserId).ToList();
|
||||
var ids = Funs.DB.Project_ProjectUser.Where(e => e.ProjectId == ProjectId && (UnitId == "" || e.UnitId == UnitId) && (RoleId == "" || e.RoleId.Contains(RoleId))).Select(u => u.UserId).ToList();
|
||||
return Funs.DB.Sys_User.Where(u => ids.Contains(u.UserId)).ToList();
|
||||
}
|
||||
|
||||
@@ -170,5 +168,28 @@
|
||||
where x.ProjectId == ProjectId && y.IdentityCard == IdentityCard
|
||||
select x).FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据项目Id获取项目所有在岗用户
|
||||
/// </summary>
|
||||
/// <param name="ProjectId"></param>
|
||||
/// <param name="UnitId"></param>
|
||||
/// <param name="RoleId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Sys_User> GetProjectUserByProjectId(string ProjectId, string UnitId, string RoleId)
|
||||
{
|
||||
var pUsers = Funs.DB.Project_ProjectUser.Where(e => e.ProjectId == ProjectId && e.IsPost == true).ToList();
|
||||
if (!string.IsNullOrWhiteSpace(UnitId))
|
||||
{
|
||||
pUsers = pUsers.Where(x => x.UnitId == UnitId).ToList();
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(RoleId))
|
||||
{
|
||||
pUsers = pUsers.Where(x => x.RoleId == RoleId).ToList();
|
||||
}
|
||||
var ids = pUsers.Select(u => u.UserId).ToList();
|
||||
return Funs.DB.Sys_User.Where(u => ids.Contains(u.UserId)).ToList();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -124,13 +124,11 @@ namespace BLL
|
||||
#region 执行任务
|
||||
public static void ExecuteTasks(string InterFaceTaskId)
|
||||
{
|
||||
|
||||
var model = GetInterFaceTaskById(InterFaceTaskId);
|
||||
var InterFaceSetlIds = model.InterFaceSetLists.Split(',');
|
||||
foreach (var item in InterFaceSetlIds)
|
||||
{
|
||||
ExecuteTasksByInterFaceSetlId(item);
|
||||
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
@@ -149,7 +147,7 @@ namespace BLL
|
||||
if (InterfaceSetModel.IsSingleRequest == true)
|
||||
{
|
||||
var taskData = GetSingleRequestData(InterfaceSetModel.InterFaceUrl, InterfaceSetModel.RequestJsonBody, InterfaceSetModel.UrlReqMethod);
|
||||
bool taskSuccess = taskData.code == 1;
|
||||
bool taskSuccess = taskData != null && taskData.code == 1;
|
||||
InterFaceLogService.WriteInterFaceLog(InterFaceSetlId, InterfaceSetModel.RequestJsonBody, JsonConvert.SerializeObject(taskData), InterFaceLogService.Type1, taskSuccess);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using FineUIPro;
|
||||
using Model;
|
||||
using Newtonsoft.Json;
|
||||
using NPOI.POIFS.Crypt.Dsig;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -11,8 +10,6 @@ namespace BLL
|
||||
{
|
||||
public static class CQMSDataService
|
||||
{
|
||||
public static CNPCDB db = Funs.DB;
|
||||
|
||||
#region 获取列表
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -11,8 +11,6 @@ namespace BLL
|
||||
{
|
||||
public static class HJGLData_HJGLService
|
||||
{
|
||||
public static CNPCDB db = Funs.DB;
|
||||
|
||||
#region 获取列表
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -4,16 +4,12 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Model;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public static class Project_HJGLData_DefectService
|
||||
{
|
||||
public static CNPCDB db = Funs.DB;
|
||||
|
||||
|
||||
#region 获取列表
|
||||
|
||||
/// <summary>
|
||||
@@ -23,6 +19,7 @@ namespace BLL
|
||||
|
||||
public static List<Project_HJGLData_Defect> GetProject_HJGLData_DefectByModle(Project_HJGLData_Defect table)
|
||||
{
|
||||
var db = Funs.DB;
|
||||
var q = from x in db.Project_HJGLData_Defect
|
||||
where
|
||||
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
|
||||
@@ -49,23 +46,24 @@ namespace BLL
|
||||
if (count == 0) return null;
|
||||
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
||||
return from x in q
|
||||
select new
|
||||
{
|
||||
x.Id,
|
||||
x.ProjectId,
|
||||
x.UnitId,
|
||||
x.CollCropCode,
|
||||
x.UnitName,
|
||||
x.ReportDate,
|
||||
x.DefectName,
|
||||
x.DefectNum
|
||||
};
|
||||
select new
|
||||
{
|
||||
x.Id,
|
||||
x.ProjectId,
|
||||
x.UnitId,
|
||||
x.CollCropCode,
|
||||
x.UnitName,
|
||||
x.ReportDate,
|
||||
x.DefectName,
|
||||
x.DefectNum
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static Project_HJGLData_Defect GetProject_HJGLData_DefectById(string Id)
|
||||
{
|
||||
var db = Funs.DB;
|
||||
return db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == Id);
|
||||
}
|
||||
|
||||
@@ -75,17 +73,18 @@ namespace BLL
|
||||
/// <param name="reportDate"></param>
|
||||
/// <param name="projectid"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Project_HJGLData_Defect> GetProject_HJGLData_DefectByDate(DateTime? reportDate,
|
||||
string projectid)
|
||||
public static List<Project_HJGLData_Defect> GetProject_HJGLData_DefectByDate(DateTime? reportDate, string projectid)
|
||||
{
|
||||
var db = Funs.DB;
|
||||
var q = from x in db.Project_HJGLData_Defect
|
||||
where x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid
|
||||
select x;
|
||||
where x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid
|
||||
select x;
|
||||
return q.ToList();
|
||||
}
|
||||
|
||||
public static void AddProject_HJGLData_Defect(Project_HJGLData_Defect newtable)
|
||||
{
|
||||
var db = Funs.DB;
|
||||
var table = new Project_HJGLData_Defect
|
||||
{
|
||||
Id = newtable.Id,
|
||||
@@ -103,12 +102,14 @@ namespace BLL
|
||||
|
||||
public static void AddBulkProject_HJGLData_Defect(List<Project_HJGLData_Defect> newtables)
|
||||
{
|
||||
var db = Funs.DB;
|
||||
db.Project_HJGLData_Defect.InsertAllOnSubmit(newtables);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
public static void UpdateProject_HJGLData_Defect(Project_HJGLData_Defect newtable)
|
||||
{
|
||||
var db = Funs.DB;
|
||||
var table = db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == newtable.Id);
|
||||
if (table != null)
|
||||
{
|
||||
@@ -126,6 +127,7 @@ namespace BLL
|
||||
|
||||
public static void DeleteProject_HJGLData_DefectById(string Id)
|
||||
{
|
||||
var db = Funs.DB;
|
||||
var table = db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == Id);
|
||||
if (table != null)
|
||||
{
|
||||
@@ -136,8 +138,8 @@ namespace BLL
|
||||
|
||||
public static void DeleteProject_HJGLData_DefectByDate(DateTime? reportDate)
|
||||
{
|
||||
var table = db.Project_HJGLData_Defect.Where(x =>
|
||||
x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0);
|
||||
var db = Funs.DB;
|
||||
var table = db.Project_HJGLData_Defect.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0);
|
||||
if (table != null)
|
||||
{
|
||||
db.Project_HJGLData_Defect.DeleteAllOnSubmit(table);
|
||||
@@ -147,8 +149,8 @@ namespace BLL
|
||||
|
||||
public static void DeleteProject_HJGLData_DefectByDate(DateTime? reportDate, string projectid)
|
||||
{
|
||||
var table = db.Project_HJGLData_Defect.Where(x =>
|
||||
x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid);
|
||||
var db = Funs.DB;
|
||||
var table = db.Project_HJGLData_Defect.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid);
|
||||
if (table != null)
|
||||
{
|
||||
db.Project_HJGLData_Defect.DeleteAllOnSubmit(table);
|
||||
@@ -162,11 +164,12 @@ namespace BLL
|
||||
/// <returns></returns>
|
||||
public static bool IsReportByToday(string projectid, string type)
|
||||
{
|
||||
var db = Funs.DB;
|
||||
var result = false;
|
||||
var q = (from x in Funs.DB.Project_HJGLData_Defect
|
||||
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date &&
|
||||
x.ProjectId == projectid && x.DefectName == type
|
||||
select x).ToList();
|
||||
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date &&
|
||||
x.ProjectId == projectid && x.DefectName == type
|
||||
select x).ToList();
|
||||
if (q != null && q.Count > 0) result = true;
|
||||
return result;
|
||||
}
|
||||
@@ -178,25 +181,27 @@ namespace BLL
|
||||
/// <returns></returns>
|
||||
public static Project_HJGLData_Defect getTodayProject_HJGLData_Defect(string projectid, string type)
|
||||
{
|
||||
var db = Funs.DB;
|
||||
var q = (from x in Funs.DB.Project_HJGLData_Defect
|
||||
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date &&
|
||||
x.ProjectId == projectid && x.DefectName == type
|
||||
select x).FirstOrDefault();
|
||||
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date &&
|
||||
x.ProjectId == projectid && x.DefectName == type
|
||||
select x).FirstOrDefault();
|
||||
return q;
|
||||
}
|
||||
|
||||
public static List<HJGLDataDefectItems> getTodayProject_HJGLData_Defect()
|
||||
{
|
||||
var db = Funs.DB;
|
||||
var q = (from x in Funs.DB.Project_HJGLData_Defect
|
||||
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
|
||||
group x by x.DefectName
|
||||
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
|
||||
group x by x.DefectName
|
||||
into g
|
||||
select new HJGLDataDefectItems
|
||||
{
|
||||
Id = SQLHelper.GetNewID(),
|
||||
DefectName = g.Key,
|
||||
DefectNum = g.Sum(p => p.DefectNum)
|
||||
}).ToList();
|
||||
select new HJGLDataDefectItems
|
||||
{
|
||||
Id = SQLHelper.GetNewID(),
|
||||
DefectName = g.Key,
|
||||
DefectNum = g.Sum(p => p.DefectNum)
|
||||
}).ToList();
|
||||
return q;
|
||||
}
|
||||
|
||||
@@ -214,19 +219,19 @@ namespace BLL
|
||||
var baseUnit = UnitService.GetUnitByUnitId(thisUnitId);
|
||||
var data = (from x in db.CH_CheckItem
|
||||
join y in db.CH_Check on x.CHT_CheckID equals y.CHT_CheckID
|
||||
where projectids.Contains(y.ProjectId)
|
||||
group x by new { x.Defects_Definition, y.ProjectId }
|
||||
where projectids.Contains(y.ProjectId)
|
||||
group x by new { x.Defects_Definition, y.ProjectId }
|
||||
into g
|
||||
select new
|
||||
{
|
||||
UnitId = thisUnitId,
|
||||
CollCropCode = baseUnit.CollCropCode,
|
||||
UnitName = baseUnit.UnitName,
|
||||
ProjectId = g.Key.ProjectId,
|
||||
ReportDate = DateTime.Now.Date,
|
||||
DefectName = g.Key.Defects_Definition,
|
||||
DefectNum = g.Count(x => x.Defects_Definition == g.Key.Defects_Definition)
|
||||
}).ToList();
|
||||
select new
|
||||
{
|
||||
UnitId = thisUnitId,
|
||||
CollCropCode = baseUnit.CollCropCode,
|
||||
UnitName = baseUnit.UnitName,
|
||||
ProjectId = g.Key.ProjectId,
|
||||
ReportDate = DateTime.Now.Date,
|
||||
DefectName = g.Key.Defects_Definition,
|
||||
DefectNum = g.Count(x => x.Defects_Definition == g.Key.Defects_Definition)
|
||||
}).ToList();
|
||||
DeleteProject_HJGLData_DefectByDate(DateTime.Now.Date); //删除当前所有
|
||||
var projectHjglDataDefect = new List<Project_HJGLData_Defect>();
|
||||
foreach (var item in data
|
||||
@@ -255,14 +260,15 @@ namespace BLL
|
||||
/// <param name="projectid"></param>
|
||||
public static void StatisticalData(string projectid)
|
||||
{
|
||||
var db = Funs.DB;
|
||||
var thisUnitId = string.Empty;
|
||||
var thisUnit = CommonService.GetIsThisUnit();
|
||||
if (thisUnit != null) thisUnitId = thisUnit.UnitId;
|
||||
var base_Unit = UnitService.GetUnitByUnitId(thisUnitId);
|
||||
var list = from x in db.CH_CheckItem
|
||||
join y in db.CH_Check on x.CHT_CheckID equals y.CHT_CheckID
|
||||
where y.ProjectId == projectid
|
||||
select x;
|
||||
join y in db.CH_Check on x.CHT_CheckID equals y.CHT_CheckID
|
||||
where y.ProjectId == projectid
|
||||
select x;
|
||||
var types = (from x in list select x.Defects_Definition).Distinct().ToList();
|
||||
foreach (var t in types)
|
||||
if (!string.IsNullOrEmpty(t))
|
||||
|
||||
Reference in New Issue
Block a user