diff --git a/SGGL/BLL/API/APIBaseInfoService.cs b/SGGL/BLL/API/APIBaseInfoService.cs index 2fac7f4b..ef753abe 100644 --- a/SGGL/BLL/API/APIBaseInfoService.cs +++ b/SGGL/BLL/API/APIBaseInfoService.cs @@ -935,5 +935,23 @@ namespace BLL return items; } #endregion + + #region 获取焊接位置 + /// + /// 获取焊接位置 + /// + /// + public static List GetWeldingLocationList() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_WeldingLocation + orderby x.WeldingLocationCode + select new Model.BaseInfoItem { BaseInfoId = x.WeldingLocationId, BaseInfoCode = x.WeldingLocationCode, BaseInfoName = x.WeldingLocationName }).ToList(); + return getDataLists; + } + } + #endregion + } } diff --git a/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs b/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs index 198c7671..39502289 100644 --- a/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs +++ b/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs @@ -308,6 +308,74 @@ namespace BLL return res; } + public static string SaveWeldingDailyByWeldJointId(string WeldJointId, string Personid, string time, string weldingLocation) + { + 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 weldingDaily = db.HJGL_WeldingDaily.FirstOrDefault(x => x.WeldingDate.Value.Date == Convert.ToDateTime(time).Date && x.UnitWorkId == joint.UnitWorkId); + var weldTask = db.HJGL_WeldTask.FirstOrDefault(x => x.WeldJointId == joint.WeldJointId); + var weldJoint = db.HJGL_WeldJoint.FirstOrDefault(x => x.WeldJointId == joint.WeldJointId); + 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(); + } + //更新焊口位置 + if (weldingDaily != null) + { + weldJoint.WeldingLocationId= weldingLocation; + WeldJointService.UpdateWeldJoint(weldJoint); + } + 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, Personid, Personid, 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/WebAPI/Controllers/BaseInfoController.cs b/SGGL/WebAPI/Controllers/BaseInfoController.cs index 8a947efa..fd81e265 100644 --- a/SGGL/WebAPI/Controllers/BaseInfoController.cs +++ b/SGGL/WebAPI/Controllers/BaseInfoController.cs @@ -1248,5 +1248,26 @@ namespace WebAPI.Controllers return responeData; } #endregion + + #region 获取焊接位置 + /// + /// 获取焊接位置 + /// + /// + public Model.ResponeData getWeldingLocation() + { + var responeData = new Model.ResponeData(); + try + { + responeData.data = APIBaseInfoService.GetWeldingLocationList(); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + return responeData; + } + #endregion } } diff --git a/SGGL/WebAPI/Controllers/HJGL/WeldingManage/PreWeldingDailyController.cs b/SGGL/WebAPI/Controllers/HJGL/WeldingManage/PreWeldingDailyController.cs index ab6696c7..86331a3d 100644 --- a/SGGL/WebAPI/Controllers/HJGL/WeldingManage/PreWeldingDailyController.cs +++ b/SGGL/WebAPI/Controllers/HJGL/WeldingManage/PreWeldingDailyController.cs @@ -169,6 +169,38 @@ namespace WebAPI.Controllers } return responeData; } + + /// + /// 根据焊口id保存到日报(增加焊接位置参数) + /// + /// + /// + /// + /// + /// + [HttpGet] + public Model.ResponeData SaveWeldingDailyByWeldJointId(string WeldJointId, string Personid, string time,string weldingLocation) + { + var responeData = new Model.ResponeData(); + try + { + string res = APIPreWeldingDailyService.SaveWeldingDailyByWeldJointId(WeldJointId, Personid, time, weldingLocation); + + if (!string.IsNullOrEmpty(res)) + { + responeData.code = 0; + responeData.message = res; + } + + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + return responeData; + } + #endregion #region 更新焊接日报焊口信息