diff --git a/SGGL/BLL/API/APIPersonService.cs b/SGGL/BLL/API/APIPersonService.cs index cb0ea5b0..d8a342be 100644 --- a/SGGL/BLL/API/APIPersonService.cs +++ b/SGGL/BLL/API/APIPersonService.cs @@ -1517,5 +1517,31 @@ namespace BLL return strValues; } + public static string getStrTrainingTestRecordByPersonId(string personId) + { + string strValues = string.Empty; + var getDataLists = from x in Funs.DB.Training_TestRecord + join z in Funs.DB.Training_TestPlan on x.TestPlanId equals z.TestPlanId + where x.TestManId == personId + orderby z.PlanDate descending + select new + { + z.PlanName, + z.PlanDate, + CheckResultName = x.TestScores >=60 ? "合格" : "不合格", + z.TestPlanId, + }; + if (getDataLists.Count() > 0) + { + foreach (var item in getDataLists) + { + string strV = string.Format("{0:yyyy-MM-dd HH:mm}", item.PlanDate) + " " + item.PlanName + " " + item.CheckResultName + ";"; + strValues += strV; + } + } + + return strValues; + } + } } \ No newline at end of file diff --git a/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs b/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs index 85306403..5ac03dab 100644 --- a/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs +++ b/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs @@ -1,5 +1,6 @@  using Model; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; @@ -125,9 +126,7 @@ namespace BLL { var twPipeMatMatchOutputs = new List(); var pipelineModel = PipelineService.GetPipelineByPipelineId(pipelineId); - string warehouseCode = PipelineService - .GetPipeArea().FirstOrDefault(x => x.Value == pipelineModel.PipeArea.ToString()) - ?.Text; + string warehouseCode = BLL.Base_WarehouseService.GetWarehouseByWarehouseId(PipelineService.GetPipelineByPipelineId(pipelineModel.PipelineId).WarehouseId).WarehouseName; // 获取所需材料列表 var requiredMaterials = (from x in db.HJGL_PipeLineMat join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode @@ -152,7 +151,9 @@ namespace BLL ).ToList(); twPipeMatMatchOutputs = GetMatMatchOutput(requiredMaterials, warehouseCode, pipelineModel.ProjectId); - var result = twPipeMatMatchOutputs.Count == 0 ? 0 : twPipeMatMatchOutputs.Sum(x => x.MatchRate) / twPipeMatMatchOutputs.Count; + var result = twPipeMatMatchOutputs.Any() + ? twPipeMatMatchOutputs.Average(x => x.MatchRate) + : 0; return result; } } diff --git a/SGGL/BLL/CLGL/TwInOutplanmasterService.cs b/SGGL/BLL/CLGL/TwInOutplanmasterService.cs index 39b09813..94db0e6a 100644 --- a/SGGL/BLL/CLGL/TwInOutplanmasterService.cs +++ b/SGGL/BLL/CLGL/TwInOutplanmasterService.cs @@ -750,7 +750,7 @@ namespace BLL ProjectId = weldTask.ProjectId, // CusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + UnitService.GetUnitCodeByUnitId(weldTask.UnitId) + "-" + UnitWorkService.getUnitWorkByUnitWorkId(weldTask.UnitWorkId)?.UnitWorkCode + "AP-PF01", CusBillCode = TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode, TwConst.TypeInt.领料出库, TwConst.Category.管件), - WarehouseCode = PipelineService.GetPipeArea().Where(x => x.Value == PipelineService.GetPipelineByPipelineId(weldTask.PipelineId).PipeArea).Select(x => x.Text).FirstOrDefault(), + WarehouseCode = BLL.Base_WarehouseService.GetWarehouseByWarehouseId(PipelineService.GetPipelineByPipelineId(weldTask.PipelineId).WarehouseId).WarehouseName, Source = 1, InOutType = (int)TwConst.InOutType.出库, TypeInt = (int)TwConst.TypeInt.领料出库, @@ -789,7 +789,7 @@ namespace BLL Id = Guid.NewGuid().ToString(), ProjectId = weldTask.ProjectId, CusBillCode = TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode, TwConst.TypeInt.领料出库, TwConst.Category.管段), - WarehouseCode = PipelineService.GetPipeArea().Where(x => x.Value == PipelineService.GetPipelineByPipelineId(weldTask.PipelineId).PipeArea).Select(x => x.Text).FirstOrDefault(), + WarehouseCode = BLL.Base_WarehouseService.GetWarehouseByWarehouseId(PipelineService.GetPipelineByPipelineId(weldTask.PipelineId).WarehouseId).WarehouseName, Source = 1, InOutType = (int)TwConst.InOutType.出库, TypeInt = (int)TwConst.TypeInt.领料出库, diff --git a/SGGL/BLL/HSSE/HiddenInspection/HSSE_Hazard_HazardRegisterService.cs b/SGGL/BLL/HSSE/HiddenInspection/HSSE_Hazard_HazardRegisterService.cs index 6c23875f..c89a0a70 100644 --- a/SGGL/BLL/HSSE/HiddenInspection/HSSE_Hazard_HazardRegisterService.cs +++ b/SGGL/BLL/HSSE/HiddenInspection/HSSE_Hazard_HazardRegisterService.cs @@ -45,7 +45,10 @@ namespace BLL public static IEnumerable getListData(string projectId, string checkMan, string type, string workAreaName, string responsibilityUnitName, DateTime? startTime, DateTime? endTime, DateTime? startRectificationTime, DateTime? endRectificationTime , string states, string personId, string unitId, Grid Grid1) { - IQueryable getDataList = getDataLists; + var db= Funs.DB; + IQueryable getDataList = from x in db.View_Hazard_HazardRegisterList + where x.ProblemTypes == "1" + select x; if (!string.IsNullOrEmpty(projectId)) { getDataList = getDataList.Where(e => e.ProjectId == projectId); @@ -101,7 +104,7 @@ namespace BLL return null; } getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); - return from x in getDataList + return (from x in getDataList select new { x.HazardRegisterId, @@ -122,7 +125,7 @@ namespace BLL x.CheckManName, x.RegisterDate, x.StatesStr, - }; + }).ToList(); } #endregion diff --git a/SGGL/BLL/HSSE/SitePerson/PersonInOutService.cs b/SGGL/BLL/HSSE/SitePerson/PersonInOutService.cs index 54997fca..7c8e0d29 100644 --- a/SGGL/BLL/HSSE/SitePerson/PersonInOutService.cs +++ b/SGGL/BLL/HSSE/SitePerson/PersonInOutService.cs @@ -1,4 +1,5 @@ using FineUIPro; +using Model; using System; using System.Collections; using System.Collections.Generic; @@ -18,12 +19,8 @@ namespace BLL { get; set; - } - - /// - /// 定义变量 - /// - private static IQueryable getDataLists = from x in Funs.DB.SitePerson_PersonInOut select x; + } + /// /// 获取分页列表 @@ -37,7 +34,8 @@ namespace BLL /// public static IEnumerable getListData(string projectId, string unitId, string name, string idCard, string inOutWay, DateTime? startDate, DateTime? endDate, Grid Grid1) { - IQueryable getDataList = getDataLists.Where(x => x.ProjectId == projectId && (inOutWay == "0" || x.InOutWay == inOutWay)); + IQueryable getDataList = from x in Funs.DB.SitePerson_PersonInOut select x; + getDataList = getDataList.Where(x => x.ProjectId == projectId && (inOutWay == "0" || x.InOutWay == inOutWay)); if (!string.IsNullOrEmpty(unitId) && unitId != Const._Null) { getDataList = getDataList.Where(e => e.UnitId == unitId); @@ -183,6 +181,88 @@ namespace BLL } } } + public static void AddPersonInOut(List personInOutList) + { + using (Model.SGGLDB db1 = new Model.SGGLDB(Funs.ConnString)) + { + List personIds = new List(); + List newPersonInOutList = new List(); + List needInsertPersonInOutList = new List(); + foreach (var personInOut in personInOutList) + { + Model.SitePerson_PersonInOut newPersonInOut = new Model.SitePerson_PersonInOut + { + PersonInOutId = SQLHelper.GetNewID(), + IsIn = personInOut.IsIn ?? true, + ChangeTime = personInOut.ChangeTime, + InOutWay = personInOut.InOutWay ?? Const.InOutWay_Other, + WorkAreaId = personInOut.WorkAreaId, + WorkAreaName = personInOut.WorkAreaName, + OldID = personInOut.OldID, + Address = personInOut.Address, + Remark = personInOut.Remark, + }; + if (!string.IsNullOrEmpty(personInOut.PersonId)) + { + personIds.Add(personInOut.PersonId); + } + if (!string.IsNullOrEmpty(personInOut.IdentityCard)) + { + personIds.Add(personInOut.IdentityCard); + } + newPersonInOutList.Add(personInOut); + } + + List person_Peoples = new List(); + person_Peoples.AddRange(db1.SitePerson_Person.Where(x => x.ProjectId == personInOutList[0].ProjectId && personIds.Contains(x.PersonId)).ToList()); + person_Peoples.AddRange(db1.SitePerson_Person.Where(x => x.ProjectId == personInOutList[0].ProjectId && personIds.Contains(x.IdentityCard)).ToList()); + foreach (var newPersonInOut in newPersonInOutList) + { + Model.SitePerson_Person getPerson = new Model.SitePerson_Person(); + getPerson = person_Peoples.FirstOrDefault(x => x.PersonId == newPersonInOut.PersonId || x.IdentityCard == newPersonInOut.IdentityCard); + if (getPerson != null && !string.IsNullOrEmpty(getPerson.PersonId)) + { + newPersonInOut.ProjectId = getPerson.ProjectId; + newPersonInOut.PersonId = getPerson.PersonId; + newPersonInOut.PersonName = getPerson.PersonName; + newPersonInOut.IdentityCard = getPerson.IdentityCard; + newPersonInOut.UnitId = getPerson.UnitId; + newPersonInOut.UnitName = UnitService.GetUnitNameByUnitId(getPerson.UnitId); + newPersonInOut.WorkPostId = getPerson.WorkPostId; + if (!string.IsNullOrEmpty(getPerson.WorkPostId)) + { + var getWorkPost = WorkPostService.GetWorkPostById(getPerson.WorkPostId); + if (getWorkPost != null) + { + newPersonInOut.WorkPostName = getWorkPost.WorkPostName; + newPersonInOut.PostType = getWorkPost.PostType; + } + } + if (string.IsNullOrEmpty(newPersonInOut.WorkAreaName) && !string.IsNullOrEmpty(newPersonInOut.WorkAreaId)) + { + newPersonInOut.WorkAreaName = UnitWorkService.GetUnitWorkName(newPersonInOut.WorkAreaId); + } + } + + if (!getPerson.OutTime.HasValue || getPerson.OutTime > DateTime.Now) + { + //// 插入当日记录表 + needInsertPersonInOutList.Add(newPersonInOut); + } + } + db1.SitePerson_PersonInOut.InsertAllOnSubmit(newPersonInOutList); + db1.SubmitChanges(); + + if (needInsertPersonInOutList.Count>0) + { + //// 插入当日记录表 + PersonInOutService.InsertPersonInOutNowNow(needInsertPersonInOutList); + } + } + + } + + #endregion #region 插入当日出入记录表 @@ -273,6 +353,104 @@ namespace BLL } } } + public static void InsertPersonInOutNowNow(List PersonInOuts) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + List unitIds = new List(); + List newPersonInOutList = new List(); + foreach (var PersonInOut in PersonInOuts) + { + Model.SitePerson_PersonInOutNow newPersonInOut = new Model.SitePerson_PersonInOutNow + { + PersonInOutId = PersonInOut.PersonInOutId, + ProjectId = PersonInOut.ProjectId, + UnitId = PersonInOut.UnitId, + UnitName = PersonInOut.UnitName, + PersonId = PersonInOut.PersonId, + PersonName = PersonInOut.PersonName, + IsIn = PersonInOut.IsIn, + ChangeTime = PersonInOut.ChangeTime, + WorkPostId = PersonInOut.WorkPostId, + WorkPostName = PersonInOut.WorkPostName, + PostType = PersonInOut.PostType, + Name = PersonInOut.PersonName, + IdentityCard = PersonInOut.IdentityCard, + IdcardNumber = PersonInOut.IdentityCard, + CheckType = "ZHENGCHANG_KAOQINLEIBIE", + CheckWay = "FACE_FANGSHI", + InOutWay = PersonInOut.InOutWay, + Address = PersonInOut.Address, + Remark = PersonInOut.Remark, + }; + unitIds.Add(PersonInOut.UnitId); + newPersonInOutList.Add(newPersonInOut); + } + db.SitePerson_PersonInOutNow.InsertAllOnSubmit(newPersonInOutList); + db.SubmitChanges(); + + string proCode = ProjectService.GetContractNoByProjectId(PersonInOuts[0].ProjectId); + var getRealNameP = db.RealName_Project.FirstOrDefault(x => x.ProCode == proCode); + + /// 监理 业主 不进入 + var getPUnitS = db.Project_ProjectUnit.Where(x => x.ProjectId == PersonInOuts[0].ProjectId && unitIds.Contains(x.UnitId)).ToList(); + + foreach (var newPersonInOut in newPersonInOutList) + { + var getPUnit = getPUnitS.FirstOrDefault(x => x.UnitId == newPersonInOut.UnitId); + if (getPUnit.UnitType != Const.ProjectUnitType_3 && getPUnit.UnitType != Const.ProjectUnitType_4 && getPUnit.IsSynchro == true) + { + if (getRealNameP != null && newPersonInOut.ChangeTime.HasValue) + { + var getNow = db.RealName_PersonInOutNow.FirstOrDefault(x => x.PersonInOutId == newPersonInOut.PersonInOutId); + if (getNow == null) + { + int hour = newPersonInOut.ChangeTime.Value.Hour; + bool isIn = newPersonInOut.IsIn ?? true; + DateTime date = newPersonInOut.ChangeTime.Value; + var getMorning = db.RealName_PersonInOutNow.FirstOrDefault(x => x.PersonId == newPersonInOut.PersonId + && ((x.ChangeTime.Value.Hour < 12 && hour < 12) || (x.ChangeTime.Value.Hour >= 12 && hour >= 12)) + && x.ChangeTime >= date.Date && x.ChangeTime.Value < date.Date.AddDays(1) + && ((x.IsIn == true && x.ChangeTime < date) || (x.IsIn == false && x.ChangeTime > date))); + if (getMorning == null) + { + Model.RealName_PersonInOutNow newR = new Model.RealName_PersonInOutNow + { + PersonInOutId = newPersonInOut.PersonInOutId, + ProjectId = newPersonInOut.ProjectId, + UnitId = newPersonInOut.UnitId, + PersonId = newPersonInOut.PersonId, + IsIn = newPersonInOut.IsIn, + ChangeTime = newPersonInOut.ChangeTime, + WorkPostId = newPersonInOut.WorkPostId, + PostType = newPersonInOut.PostType, + ProCode = proCode, + Name = newPersonInOut.PersonName, + IdcardType = "SHENFEN_ZHENGJIAN", + IdcardNumber = newPersonInOut.IdentityCard, + CheckType = "ZHENGCHANG_KAOQINLEIBIE", + CheckWay = "FACE_FANGSHI", + }; + db.RealName_PersonInOutNow.InsertOnSubmit(newR); + + } + } + } + } + } + db.SubmitChanges(); + var getLastList = from x in db.SitePerson_PersonInOutNow + where x.ChangeTime <= PersonInOuts[0].ChangeTime.Value.AddHours(-48) + select x; + if (getLastList.Count() > 0) + { + db.SitePerson_PersonInOutNow.DeleteAllOnSubmit(getLastList); + db.SubmitChanges(); + } + } + } + + #endregion #region 更新人员出入记录 diff --git a/SGGL/FineUIPro.Web/CLGL/InPlanMaster.aspx.cs b/SGGL/FineUIPro.Web/CLGL/InPlanMaster.aspx.cs index a2455755..3b0232d4 100644 --- a/SGGL/FineUIPro.Web/CLGL/InPlanMaster.aspx.cs +++ b/SGGL/FineUIPro.Web/CLGL/InPlanMaster.aspx.cs @@ -280,17 +280,28 @@ namespace FineUIPro.Web.CLGL } string planId = Grid1.SelectedRowID; var planMaster = BLL.TwInOutplanmasterService.GetById(planId); - if (planMaster.State != (int)TwConst.State.已完成) + switch (planMaster.State) { - Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning); - return; - } - else - { - TwInputmasterService.RevokeGenInMasterByPlanId(planId); - BindGrid(); - ShowNotify("撤销入库单成功!", MessageBoxIcon.Success); - } + case (int)TwConst.State.已审核: + planMaster.State= (int)TwConst.State.待审核; + planMaster.AuditMan = null; + planMaster.AuditDate = null; + TwInOutplanmasterService.Update(planMaster); + BindGrid(); + ShowNotify("撤销审核成功!", MessageBoxIcon.Success); + + break; + case (int)TwConst.State.已完成: + TwInputmasterService.RevokeGenInMasterByPlanId(planId); + BindGrid(); + ShowNotify("撤销入库单成功!", MessageBoxIcon.Success); + break; + + + default: + Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning); + break; + } } protected void btnSearch_Click(object sender, EventArgs e) diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index 223f44ea..d98a37e8 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -17017,7 +17017,10 @@ - + + + + diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.cs index 01992a81..15d9cfe6 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.cs @@ -1316,8 +1316,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage } } - - protected void btnPrintJoint_Click(object sender, EventArgs e) { var rows = Grid1.SelectedRowIndexArray; diff --git a/SGGL/FineUIPro.Web/HSSE/HiddenInspection/HiddenRectificationList.aspx b/SGGL/FineUIPro.Web/HSSE/HiddenInspection/HiddenRectificationList.aspx index 953968eb..84c16e77 100644 --- a/SGGL/FineUIPro.Web/HSSE/HiddenInspection/HiddenRectificationList.aspx +++ b/SGGL/FineUIPro.Web/HSSE/HiddenInspection/HiddenRectificationList.aspx @@ -69,6 +69,7 @@ + <%-- --%> private void BindGrid() { - string strSql = "SELECT LicenseManager.LicenseManagerId,LicenseManager.ProjectId,LicenseManager.LicenseTypeId,CodeRecords.Code AS LicenseManagerCode,LicenseManager.LicenseManageName,LicenseManager.UnitId,LicenseManager.LicenseManageContents,LicenseManager.CompileMan,LicenseManager.CompileDate,LicenseManager.States,LicenseManager.ProjectCode,LicenseManager.ProjectName,LicenseManager.LicenseTypeName,LicenseManager.UnitName,LicenseManager.PersonName,LicenseManager.WorkAreaName,LicenseManager.StartDate,LicenseManager.EndDate" + string strSql = "SELECT LicenseManager.LicenseManagerId,LicenseManager.ProjectId,LicenseManager.LicenseTypeId,CodeRecords.Code AS LicenseManagerCode,LicenseManager.LicenseManageName,LicenseManager.UnitId,LicenseManager.LicenseManageContents,LicenseManager.CompileMan,LicenseManager.CompileDate,LicenseManager.States,LicenseManager.ProjectCode,LicenseManager.ProjectName,LicenseManager.LicenseTypeName,LicenseManager.UnitName,LicenseManager.UserName,LicenseManager.WorkAreaName,LicenseManager.StartDate,LicenseManager.EndDate" + @" ,(CASE WHEN LicenseManager.States = " + BLL.Const.State_0 + " OR LicenseManager.States IS NULL THEN '待['+OperatePerson.PersonName+']提交' WHEN LicenseManager.States = " + BLL.Const.State_2 + " THEN '审核/审批完成' ELSE '待['+OperatePerson.PersonName+']办理' END) AS FlowOperateName,LicenseManager.SourceDes" + @" FROM View_License_LicenseManager AS LicenseManager " + @" LEFT JOIN Sys_CodeRecords AS CodeRecords ON LicenseManager.LicenseManagerId=CodeRecords.DataId " diff --git a/SGGL/FineUIPro.Web/common/mainMenu_HJGL3.aspx.cs b/SGGL/FineUIPro.Web/common/mainMenu_HJGL3.aspx.cs index f5ee4fe7..e96b1dee 100644 --- a/SGGL/FineUIPro.Web/common/mainMenu_HJGL3.aspx.cs +++ b/SGGL/FineUIPro.Web/common/mainMenu_HJGL3.aspx.cs @@ -51,11 +51,11 @@ namespace FineUIPro.Web.common this.tvControlItem.Nodes.Add(rootNode2); // 优化:一次性获取所有管线统计数据,避免 N+1 查询 - var pipelineCountByUnitWork = (from x in Funs.DB.HJGL_Pipeline + var pipelineCountByUnitWork = (from x in Funs.DB.View_HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId group x by x.UnitWorkId into g - select new { UnitWorkId = g.Key, Count = g.Count() }) - .ToDictionary(x => x.UnitWorkId, x => x.Count); + select new { UnitWorkId = g.Key, Count = g.Count(), TotalDin = g.Sum(x => x.TotalDin) }) + .ToDictionary(x => x.UnitWorkId, x => new { x.Count, x.TotalDin }); var pUnits = (from x in Funs.DB.Project_ProjectUnit where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList(); // 获取当前用户所在单位 @@ -74,14 +74,14 @@ namespace FineUIPro.Web.common if (unitWork1.Count() > 0) { - foreach (var q in unitWork1) + foreach (var q in unitWork1) { // 优化:从内存字典中获取管线数量,避免数据库查询 - int a = pipelineCountByUnitWork.ContainsKey(q.UnitWorkId) ? pipelineCountByUnitWork[q.UnitWorkId] : 0; + int a = pipelineCountByUnitWork.ContainsKey(q.UnitWorkId) ? pipelineCountByUnitWork[q.UnitWorkId].Count : 0; var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId); TreeNode tn1 = new TreeNode(); tn1.NodeID = q.UnitWorkId; - tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线"; + tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线" ; tn1.ToolTip = "施工单位:" + unitNamesUnitIds; tn1.EnableClickEvent = true; rootNode1.Nodes.Add(tn1); @@ -92,11 +92,11 @@ namespace FineUIPro.Web.common foreach (var q in unitWork2) { // 优化:从内存字典中获取管线数量,避免数据库查询 - int a = pipelineCountByUnitWork.ContainsKey(q.UnitWorkId) ? pipelineCountByUnitWork[q.UnitWorkId] : 0; + int a = pipelineCountByUnitWork.ContainsKey(q.UnitWorkId) ? pipelineCountByUnitWork[q.UnitWorkId].Count : 0; var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId); TreeNode tn2 = new TreeNode(); tn2.NodeID = q.UnitWorkId; - tn2.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线"; + tn2.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线" ; tn2.ToolTip = "施工单位:" + unitNamesUnitIds; tn2.EnableClickEvent = true; rootNode2.Nodes.Add(tn2); @@ -257,6 +257,7 @@ JointData AS ( j.Size, j.WeldingDailyId, j.JointAttribute, + j.PipelineId, p.PipeArea, p.UnitWorkId FROM dbo.HJGL_WeldJoint j @@ -323,6 +324,7 @@ JointData AS ( j.Size, j.WeldingDailyId, j.JointAttribute, + j.PipelineId, p.PipeArea, p.UnitWorkId FROM dbo.HJGL_WeldJoint j diff --git a/SGGL/Model/APIItem/PersonInOutItem.cs b/SGGL/Model/APIItem/PersonInOutItem.cs new file mode 100644 index 00000000..88f99de0 --- /dev/null +++ b/SGGL/Model/APIItem/PersonInOutItem.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model.APIItem +{ + public class PersonInOutItem + { + public string projectId { get; set; } + public string idCard { get; set; } + public int isIn { get; set; } + public DateTime changeTime { get; set; } + public string deviceIp { get; set; } + + + } +} diff --git a/SGGL/Model/Model.csproj b/SGGL/Model/Model.csproj index 59ed38c4..9e994fc2 100644 --- a/SGGL/Model/Model.csproj +++ b/SGGL/Model/Model.csproj @@ -156,6 +156,7 @@ + diff --git a/SGGL/WebAPI/Controllers/PersonController.cs b/SGGL/WebAPI/Controllers/PersonController.cs index 24cd115f..38334cfc 100644 --- a/SGGL/WebAPI/Controllers/PersonController.cs +++ b/SGGL/WebAPI/Controllers/PersonController.cs @@ -1,6 +1,7 @@ using BLL; using Model; using System; +using System.Collections.Generic; using System.Configuration; using System.IO; using System.Linq; @@ -112,7 +113,7 @@ namespace WebAPI.Controllers /// 页码(从1开始) /// 是否返回全部数据 /// - public Model.ResponeData getPersonByFilter([FromUri] Model.ProjectPersonInput filter, int? pagesize = 15, int? pageindex = 1, bool? returnAll = false) + public Model.ResponeData getPersonByFilter([FromUri] Model.ProjectPersonInput filter, int? pagesize = 15, int? pageindex = 1, bool ? returnAll = false) { var responeData = new Model.ResponeData(); try @@ -382,12 +383,12 @@ namespace WebAPI.Controllers /// 培训类型ID(可为空) /// 分页 /// - public Model.ResponeData getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string trainTypeId, int pageIndex, string startDate, string endDate) + public Model.ResponeData getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string trainTypeId, int pageIndex) { var responeData = new Model.ResponeData(); try { - var getDataList = APIPersonService.getTrainingPersonListByTrainTypeId(projectId, unitIds, workPostIds, trainTypeId, null).OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList(); + var getDataList = APIPersonService.getTrainingPersonListByTrainTypeId(projectId, unitIds, workPostIds, trainTypeId,null).OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList(); int pageCount = getDataList.Count; if (pageCount > 0 && pageIndex > 0) { @@ -413,12 +414,12 @@ namespace WebAPI.Controllers /// /// /// - public Model.ResponeData getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string trainTypeId, string name, int pageIndex) + public Model.ResponeData getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string trainTypeId,string name, int pageIndex) { var responeData = new Model.ResponeData(); try { - var getDataList = APIPersonService.getTrainingPersonListByTrainTypeId(projectId, unitIds, workPostIds, trainTypeId, name).OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList(); + var getDataList = APIPersonService.getTrainingPersonListByTrainTypeId(projectId, unitIds, workPostIds, trainTypeId,name).OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList(); int pageCount = getDataList.Count; if (pageCount > 0 && pageIndex > 0) { @@ -693,6 +694,9 @@ namespace WebAPI.Controllers /// /// /// + /// + [HttpGet] + public Model.ResponeData getPersonInOut(string projectId, string idCard, int isIn, DateTime changeTime) { var responeData = new Model.ResponeData(); @@ -705,7 +709,7 @@ namespace WebAPI.Controllers IdentityCard = idCard, IsIn = isIn == 1 ? true : false, ChangeTime = changeTime, - InOutWay = Const.InOutWay_1, + InOutWay = Const.InOutWay_1 }; PersonInOutService.AddPersonInOut(newInOut); @@ -719,6 +723,41 @@ namespace WebAPI.Controllers } return responeData; } + [HttpPost] + public Model.ResponeData getPersonInOut([FromBody] List personInOutItem) + { + var responeData = new Model.ResponeData(); + if (personInOutItem.Count > 0) + { + try + { + List newInOutList = new List(); + foreach (var item in personInOutItem) + { + Model.SitePerson_PersonInOut newInOut = new Model.SitePerson_PersonInOut + { + ProjectId = item.projectId, + IdentityCard = item.idCard, + IsIn = item.isIn == 1 ? true : false, + ChangeTime = item.changeTime, + InOutWay = Const.InOutWay_1, + Address = item.deviceIp + }; + newInOutList.Add(newInOut); + } + PersonInOutService.AddPersonInOut(newInOutList); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + } + return responeData; + } + + + #endregion #region 保存人员出入记录 @@ -779,7 +818,7 @@ namespace WebAPI.Controllers join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId join persons in Funs.DB.Person_Persons on x.IdentityCard equals persons.IdentityCard where x.ProjectId == projectId && !x.ExchangeTime.HasValue - && x.States == Const.ProjectPersonStates_1 && x.CardNo.Length > 5 && persons.PhotoUrl != null + && x.States == Const.ProjectPersonStates_1 && x.CardNo.Length> 5 && persons.PhotoUrl != null select new { x.PersonId, @@ -798,7 +837,7 @@ namespace WebAPI.Controllers TrainRecord = APIPersonService.getStrTrainRecordByPersonId(x.PersonId), x.ExchangeTime, x.ExchangeTime2, - PhotoUrl = persons.PhotoUrl.Replace('\\', '/'), + PhotoUrl=persons.PhotoUrl.Replace('\\', '/'), }).Take(200).ToList(); } catch (Exception ex) @@ -813,16 +852,15 @@ namespace WebAPI.Controllers var responeData = new Model.ResponeData(); try { - // var trainingIds = Funs.DB.EduTrain_TrainRecord.Where(x => projectId == projectId).Select(x => x.TrainingId).ToList(); - // var personIds = Funs.DB.EduTrain_TrainRecordDetail.Where(x => trainingIds.Contains(x.TrainingId)).Select(x=>x.PersonId).ToList(); ; + // var trainingIds = Funs.DB.EduTrain_TrainRecord.Where(x => projectId == projectId).Select(x => x.TrainingId).ToList(); + // var personIds = Funs.DB.EduTrain_TrainRecordDetail.Where(x => trainingIds.Contains(x.TrainingId)).Select(x=>x.PersonId).ToList(); ; responeData.data = (from x in Funs.DB.SitePerson_Person join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId - join persons in Funs.DB.Person_Persons on x.IdentityCard equals persons.IdentityCard - join traindetail in Funs.DB.EduTrain_TrainRecordDetail on x.PersonId equals traindetail.PersonId - join train in Funs.DB.EduTrain_TrainRecord on traindetail.TrainingId equals train.TrainingId - where x.ProjectId == projectId && !x.ExchangeTime.HasValue && train.ProjectId == projectId - && x.States == Const.ProjectPersonStates_1 && x.CardNo.Length > 5 && persons.PhotoUrl != null + join persons in Funs.DB.Person_Persons on x.IdentityCard equals persons.IdentityCard + join traindetail in Funs.DB.Training_TestRecord on x.PersonId equals traindetail.TestManId + where x.ProjectId == projectId && !x.ExchangeTime.HasValue && traindetail.ProjectId == projectId + && x.States == Const.ProjectPersonStates_1 && x.CardNo.Length > 5 && persons.PhotoUrl != null && traindetail.TestScores >= 60 // where personIds.Contains(x.PersonId) select new { @@ -841,15 +879,15 @@ namespace WebAPI.Controllers Funs.DB.ProjectData_TeamGroup.First(z => z.TeamGroupId == x.TeamGroupId).TeamGroupName, persons.Telephone, persons.Address, - TrainRecord = APIPersonService.getStrTrainRecordByPersonId(x.PersonId), + TrainRecord = APIPersonService.getStrTrainingTestRecordByPersonId(x.PersonId), x.ExchangeTime, - x.ExchangeTime2, + x.ExchangeTime2, x.AuditorDate, PhotoUrl = persons.PhotoUrl.Replace('\\', '/'), IsUsed = x.States == Const.ProjectPersonStates_1 ? 1 : 0, - BlackList = 0 + BlackList = 0 }).Take(200).ToList(); - + } catch (Exception ex) { @@ -927,7 +965,7 @@ namespace WebAPI.Controllers /// /// /// - public Model.ResponeData getUpdatePersonExchangeTime(string projectId, string idCard, string type) + public Model.ResponeData getUpdatePersonExchangeTime(string projectId,string idCard, string type) { var responeData = new Model.ResponeData(); try @@ -940,9 +978,9 @@ namespace WebAPI.Controllers else { responeData.code = 1; - responeData.message = "当前项目不存在身份证为:" + idCard.ToString() + "的人员!"; + responeData.message = "当前项目不存在身份证为:" + idCard.ToString() +"的人员!"; } - + } catch (Exception ex) { @@ -985,6 +1023,10 @@ namespace WebAPI.Controllers } #endregion + + + + #region 获取人员信息出入场记录-查询 /// /// 获取人员信息出入场记录 @@ -1071,7 +1113,7 @@ namespace WebAPI.Controllers responeData.code = 0; responeData.message = "StartTime和EndTime为必填参数!"; return responeData; - } + } // 验证时间范围 if (filter.StartTime > filter.EndTime) {