From f4502924bb5f94b381d6ed3c5df68d8573eb39bd Mon Sep 17 00:00:00 2001 From: fei550 <1420031550@qq.com> Date: Fri, 10 Apr 2026 14:06:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20SaveWeldingDailyByWeldJointId=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=89=93=E5=BA=95=E5=92=8C=E7=9B=96=E9=9D=A2?= =?UTF-8?q?=E7=84=8A=E5=B7=A5=E5=88=86=E5=88=AB=E6=8C=87=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增 welderType 参数(0 全部/1 打底/2 盖面), welderType 为 1 或 2 时仅填充对应焊工字段, WeldingDate 保存和自动组批仅在打底与盖面都填充后执行。 --- .../BLL/API/HJGL/APIPreWeldingDailyService.cs | 109 ++++++++++++++++++ .../HSSE/EduTrain/TestRecord.aspx | 2 +- .../PreWeldingDailyController.cs | 32 +++++ 3 files changed, 142 insertions(+), 1 deletion(-) diff --git a/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs b/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs index 39502289..e55bb2f6 100644 --- a/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs +++ b/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs @@ -376,6 +376,115 @@ namespace BLL return res; } + /// + /// 保存焊接日报(支持打底和盖面焊工分别指定) + /// + /// 焊口ID + /// 焊工人员ID + /// 日期 + /// 焊接位置ID + /// 焊工类型 0 全部 1 打底 2 盖面 + /// + public static string SaveWeldingDailyByWeldJointId(string WeldJointId, string Personid, string time, string weldingLocation, int welderType) + { + string res = ""; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + try + { + var peson = db.Person_Persons.FirstOrDefault(x => x.PersonId == Personid); + if (peson == null) + { + res = "人员不存在"; + return res; + } + var joint = db.View_HJGL_WeldJoint.FirstOrDefault(x => x.WeldJointId == WeldJointId); + if (joint == null) + { + res = "焊口不存在"; + return res; + } + var weldingLocationModel = db.Base_WeldingLocation.FirstOrDefault(x => x.WeldingLocationId == weldingLocation); + if (weldingLocationModel == null) + { + res = "焊口位置不存在"; + return res; + } + var weldTask = db.HJGL_WeldTask.FirstOrDefault(x => x.WeldJointId == joint.WeldJointId); + var weldJoint = db.HJGL_WeldJoint.FirstOrDefault(x => x.WeldJointId == joint.WeldJointId); + + // 根据焊工类型确定盖面/打底焊工ID,以及是否两者都已填充 + string coverWelderId; + string backingWelderId; + bool bothWeldersFilled; + + if (welderType == 0) + { + // 全部:打底和盖面都是同一人 + coverWelderId = Personid; + backingWelderId = Personid; + bothWeldersFilled = true; + } + else if (welderType == 1) + { + // 打底:只更新backingWelderId,coverWelderId取焊口已有值 + weldJoint.BackingWelderId = Personid; + coverWelderId = weldJoint.CoverWelderId; + backingWelderId = Personid; + bothWeldersFilled = !string.IsNullOrEmpty(coverWelderId) && !string.IsNullOrEmpty(backingWelderId); + } + else // welderType == 2 + { + // 盖面:只更新coverWelderId,backingWelderId取焊口已有值 + weldJoint.CoverWelderId = Personid; + coverWelderId = Personid; + backingWelderId = weldJoint.BackingWelderId; + bothWeldersFilled = !string.IsNullOrEmpty(coverWelderId) && !string.IsNullOrEmpty(backingWelderId); + } + + // 更新焊口位置 + weldJoint.WeldingLocationId = weldingLocation; + WeldJointService.UpdateWeldJoint(weldJoint); + + // 只有打底和盖面都填充了时才保存WeldingDate和进批 + if (bothWeldersFilled) + { + var weldingDaily = db.HJGL_WeldingDaily.FirstOrDefault(x => x.WeldingDate.Value.Date == Convert.ToDateTime(time).Date && x.UnitWorkId == joint.UnitWorkId); + if (weldingDaily == null) + { + string perfix = string.Format("{0:yyyyMMdd}", System.DateTime.Now) + "-" + peson.PersonName + "-"; + weldingDaily = new Model.HJGL_WeldingDaily(); + weldingDaily.WeldingDailyId = Guid.NewGuid().ToString(); + weldingDaily.WeldingDailyCode = BLL.SQLHelper.RunProcNewId("SpGetThreeNumber", "dbo.HJGL_WeldingDaily", "WeldingDailyCode", joint.ProjectId, perfix); + weldingDaily.WeldingDate = Convert.ToDateTime(time).Date; + weldingDaily.ProjectId = joint.ProjectId; + weldingDaily.UnitWorkId = joint.UnitWorkId; + weldingDaily.UnitId = weldTask?.UnitId; + weldingDaily.Tabler = Personid; + weldingDaily.TableDate = Convert.ToDateTime(time).Date; + db.HJGL_WeldingDaily.InsertOnSubmit(weldingDaily); + db.SubmitChanges(); + } + BLL.HJGL_PipelineComponentjointService.UpdateStateByWeldJointId(WeldJointId, (DateTime)weldingDaily.WeldingDate);//更改预制口实际时间和状态 + PipelineService.UpdataDateByWeldJointId(WeldJointId);//更改安装口时间和状态 + var batchC = BLL.Project_SysSetService.GetSysSetBySetId("5", joint.ProjectId); + if (batchC != null) + { + string batchCondition = batchC.SetValue; + InsertWeldingDailyItem(WeldJointId, coverWelderId, backingWelderId, joint.JointAttribute, weldingDaily.WeldingDate, batchCondition, true, weldingDaily.WeldingDailyId, joint.ProjectId); + } + BLL.WeldJointService.UpdateWeldJointAddG(WeldJointId, joint.JointAttribute, Const.BtnAdd); + } + } + catch (Exception ex) + { + APICommonService.SaveSysAPILog("erro", ex.ToString(), "-1"); + } + + } + return res; + } + #region 保存焊接日报明细 /// /// 保存焊接日报明细 diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/TestRecord.aspx b/SGGL/FineUIPro.Web/HSSE/EduTrain/TestRecord.aspx index ec17725f..7d7a2e8e 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/TestRecord.aspx +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/TestRecord.aspx @@ -134,7 +134,7 @@ - + diff --git a/SGGL/WebAPI/Controllers/HJGL/WeldingManage/PreWeldingDailyController.cs b/SGGL/WebAPI/Controllers/HJGL/WeldingManage/PreWeldingDailyController.cs index 86331a3d..27e2ca3a 100644 --- a/SGGL/WebAPI/Controllers/HJGL/WeldingManage/PreWeldingDailyController.cs +++ b/SGGL/WebAPI/Controllers/HJGL/WeldingManage/PreWeldingDailyController.cs @@ -201,6 +201,38 @@ namespace WebAPI.Controllers return responeData; } + /// + /// 根据焊口id保存到日报 + /// + /// 焊口号 + /// 人员ID + /// 时间 + /// 焊接位置 + /// 焊工类型 + /// + [HttpGet] + public Model.ResponeData SaveWeldingDailyByWeldJointId(string WeldJointId, string Personid, string time,string weldingLocation,int welderType) + { + var responeData = new Model.ResponeData(); + try + { + string res = APIPreWeldingDailyService.SaveWeldingDailyByWeldJointId(WeldJointId, Personid, time, weldingLocation, welderType); + + if (!string.IsNullOrEmpty(res)) + { + responeData.code = 0; + responeData.message = res; + } + + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + return responeData; + } + #endregion #region 更新焊接日报焊口信息