using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web.UI.WebControls; namespace BLL { /// /// 焊口管理 /// public class PW_JointInfoService { /// /// 根据焊口Id获取焊口信息 /// /// /// public static Model.PW_JointInfo GetJointInfoByJotID(string jot_id) { return Funs.DB.PW_JointInfo.FirstOrDefault(e => e.JOT_ID == jot_id); } public static List GetJOTSchList() { List res = new List(); var q = from x in Funs.DB.PW_JointInfo select x.JOT_Sch; var list = q.Distinct().OrderBy(x=>x).ToList(); foreach (string item in list){ res.Add(new ListItem(item, item)); } return res; } /// /// 添加 /// /// public static string AddJointInfo(Model.PW_JointInfo jointInfo) { if (!IsExitJointNo(jointInfo.ProjectId, jointInfo.ISO_ID, jointInfo.JOT_JointNo)) { string newKeyID = SQLHelper.GetNewID(typeof(Model.PW_JointInfo)); Model.PW_JointInfo newJointInfo = new Model.PW_JointInfo(); newJointInfo.JOT_ID = newKeyID; newJointInfo.ProjectId = jointInfo.ProjectId; newJointInfo.JOT_JointNo = jointInfo.JOT_JointNo; newJointInfo.DReportID = jointInfo.DReportID; newJointInfo.ISO_ID = jointInfo.ISO_ID; newJointInfo.MaterialId = jointInfo.MaterialId; newJointInfo.MaterialId2 = jointInfo.MaterialId2; newJointInfo.JOT_CellWelder = jointInfo.JOT_CellWelder; newJointInfo.JOT_FloorWelder = jointInfo.JOT_FloorWelder; newJointInfo.WLO_Code = jointInfo.WLO_Code; newJointInfo.JOT_DoneDin = jointInfo.JOT_DoneDin; newJointInfo.JOT_FloorGroup = jointInfo.JOT_FloorGroup; newJointInfo.JOT_CellGroup = jointInfo.JOT_CellGroup; newJointInfo.IS_Compute = jointInfo.IS_Compute; newJointInfo.JOT_NDTResult = jointInfo.JOT_NDTResult; newJointInfo.JOT_Component1 = jointInfo.JOT_Component1; newJointInfo.JOT_Component2 = jointInfo.JOT_Component2; newJointInfo.JOT_HeartNo1 = jointInfo.JOT_HeartNo1; newJointInfo.JOT_HeartNo2 = jointInfo.JOT_HeartNo2; newJointInfo.JOT_WeldMat = jointInfo.JOT_WeldMat; newJointInfo.JOT_JointStatus = "100"; newJointInfo.JOT_FaceCheckResult = jointInfo.JOT_FaceCheckResult; newJointInfo.JOT_FaceCheckDate = jointInfo.JOT_FaceCheckDate; newJointInfo.JOT_PHWTDate = jointInfo.JOT_PHWTDate; newJointInfo.JOT_PHWTReportNo = jointInfo.JOT_PHWTReportNo; newJointInfo.JOT_PHWTResult = jointInfo.JOT_PHWTResult; newJointInfo.JOT_FaceChecker = jointInfo.JOT_FaceChecker; newJointInfo.JOT_Dia = jointInfo.JOT_Dia; newJointInfo.DetectionRateId = jointInfo.DetectionRateId; newJointInfo.DetectionTypeId = jointInfo.DetectionTypeId; newJointInfo.Extend_Length = jointInfo.Extend_Length; if (jointInfo.JOT_Size.HasValue) { newJointInfo.JOT_Size = jointInfo.JOT_Size; } else { newJointInfo.JOT_Size = 0; } newJointInfo.JOT_Sch = jointInfo.JOT_Sch; newJointInfo.JOT_FactSch = jointInfo.JOT_FactSch; newJointInfo.JOT_JointFlag = jointInfo.JOT_JointFlag; newJointInfo.JOT_TrustFlag = jointInfo.JOT_TrustFlag; newJointInfo.JOT_BecauseJointNo = jointInfo.JOT_BecauseJointNo; newJointInfo.JOT_JointDesc = jointInfo.JOT_JointDesc; newJointInfo.JOT_WeldSilk = jointInfo.JOT_WeldSilk; newJointInfo.JOTY_ID = jointInfo.JOTY_ID; newJointInfo.JOT_CheckFlag = jointInfo.JOT_CheckFlag; newJointInfo.JOT_RepairFlag = jointInfo.JOT_RepairFlag; newJointInfo.WME_ID = jointInfo.WME_ID; newJointInfo.JST_ID = jointInfo.JST_ID; newJointInfo.JOT_BelongPipe = jointInfo.JOT_BelongPipe; newJointInfo.JOT_CheckResult = jointInfo.JOT_CheckResult; newJointInfo.JOT_Electricity = jointInfo.JOT_Electricity; newJointInfo.JOT_Voltage = jointInfo.JOT_Voltage; newJointInfo.IS_Proess = jointInfo.IS_Proess; newJointInfo.JOT_ProessDate = jointInfo.JOT_ProessDate; newJointInfo.JOT_HotRpt = jointInfo.JOT_HotRpt; newJointInfo.JOT_PrepareTemp = jointInfo.JOT_PrepareTemp; newJointInfo.JOT_CellTemp = jointInfo.JOT_CellTemp; newJointInfo.JOT_LastTemp = jointInfo.JOT_LastTemp; newJointInfo.JOT_JointAttribute = jointInfo.JOT_JointAttribute; newJointInfo.JOT_CellWeldRules = jointInfo.JOT_CellWeldRules; newJointInfo.JOT_FloorWeldRules = jointInfo.JOT_FloorWeldRules; newJointInfo.Fix1_FloorWeld = jointInfo.Fix1_FloorWeld; newJointInfo.Fix1_CellWelder = jointInfo.Fix1_CellWelder; newJointInfo.Fix2_FloorWeld = jointInfo.Fix2_FloorWeld; newJointInfo.Fix2_CellWelder = jointInfo.Fix2_CellWelder; newJointInfo.PW_PointID = jointInfo.PW_PointID; newJointInfo.NDT_ID = jointInfo.NDT_ID; newJointInfo.CH_RepairID1 = jointInfo.CH_RepairID1; newJointInfo.CH_RepairID2 = jointInfo.CH_RepairID2; newJointInfo.Fix1_date = jointInfo.Fix1_date; newJointInfo.Fix2_date = jointInfo.Fix2_date; newJointInfo.JOT_Location = jointInfo.JOT_Location; newJointInfo.IS_Proess = jointInfo.IS_Proess; newJointInfo.JOT_Remark = jointInfo.JOT_Remark; newJointInfo.WeldingGasProtection = jointInfo.WeldingGasProtection; newJointInfo.WeldingSpeed = jointInfo.WeldingSpeed; newJointInfo.ActualPrepareTemp = jointInfo.ActualPrepareTemp; newJointInfo.ComponentNum = jointInfo.ComponentNum; Funs.DB.PW_JointInfo.InsertOnSubmit(newJointInfo); Funs.DB.SubmitChanges(); return newJointInfo.JOT_ID; } return ""; } /// /// 修改 /// /// public static void UpdateJointInfo(Model.PW_JointInfo jointInfo) { Model.PW_JointInfo newJointInfo = Funs.DB.PW_JointInfo.FirstOrDefault(e => e.JOT_ID == jointInfo.JOT_ID); if (newJointInfo != null) { newJointInfo.JOT_JointNo = jointInfo.JOT_JointNo; //newJointInfo.DReportID = jointInfo.DReportID; newJointInfo.ISO_ID = jointInfo.ISO_ID; newJointInfo.MaterialId = jointInfo.MaterialId; newJointInfo.MaterialId2 = jointInfo.MaterialId2; //newJointInfo.JOT_CellWelder = jointInfo.JOT_CellWelder; //newJointInfo.JOT_FloorWelder = jointInfo.JOT_FloorWelder; //newJointInfo.WLO_Code = jointInfo.WLO_Code; newJointInfo.JOT_DoneDin = jointInfo.JOT_DoneDin; //newJointInfo.JOT_FloorGroup = jointInfo.JOT_FloorGroup; //newJointInfo.JOT_CellGroup = jointInfo.JOT_CellGroup; //newJointInfo.IS_Compute = jointInfo.IS_Compute; newJointInfo.Extend_Length = jointInfo.Extend_Length; newJointInfo.JOT_NDTResult = jointInfo.JOT_NDTResult; newJointInfo.JOT_Component1 = jointInfo.JOT_Component1; newJointInfo.DetectionRateId = jointInfo.DetectionRateId; newJointInfo.DetectionTypeId = jointInfo.DetectionTypeId; newJointInfo.JOT_Component2 = jointInfo.JOT_Component2; newJointInfo.JOT_HeartNo1 = jointInfo.JOT_HeartNo1; newJointInfo.JOT_HeartNo2 = jointInfo.JOT_HeartNo2; newJointInfo.JOT_WeldMat = jointInfo.JOT_WeldMat; newJointInfo.JOT_JointStatus = jointInfo.JOT_JointStatus; //newJointInfo.JOT_FaceCheckResult = jointInfo.JOT_FaceCheckResult; //newJointInfo.JOT_FaceCheckDate = jointInfo.JOT_FaceCheckDate; //newJointInfo.JOT_PHWTDate = jointInfo.JOT_PHWTDate; //newJointInfo.JOT_PHWTReportNo = jointInfo.JOT_PHWTReportNo; //newJointInfo.JOT_PHWTResult = jointInfo.JOT_PHWTResult; newJointInfo.JOT_FaceChecker = jointInfo.JOT_FaceChecker; newJointInfo.JOT_Dia = jointInfo.JOT_Dia; newJointInfo.JOT_Size = jointInfo.JOT_Size; newJointInfo.JOT_Sch = jointInfo.JOT_Sch; newJointInfo.JOT_FactSch = jointInfo.JOT_FactSch; //newJointInfo.JOT_JointFlag = jointInfo.JOT_JointFlag; //newJointInfo.JOT_TrustFlag = jointInfo.JOT_TrustFlag; newJointInfo.JOT_BecauseJointNo = jointInfo.JOT_BecauseJointNo; newJointInfo.JOT_JointDesc = jointInfo.JOT_JointDesc; newJointInfo.JOT_WeldSilk = jointInfo.JOT_WeldSilk; newJointInfo.JOTY_ID = jointInfo.JOTY_ID; //newJointInfo.JOT_CheckFlag = jointInfo.JOT_CheckFlag; //newJointInfo.JOT_RepairFlag = jointInfo.JOT_RepairFlag; newJointInfo.WME_ID = jointInfo.WME_ID; newJointInfo.JST_ID = jointInfo.JST_ID; newJointInfo.JOT_BelongPipe = jointInfo.JOT_BelongPipe; newJointInfo.JOT_CheckResult = jointInfo.JOT_CheckResult; newJointInfo.JOT_Electricity = jointInfo.JOT_Electricity; newJointInfo.JOT_Voltage = jointInfo.JOT_Voltage; newJointInfo.IS_Proess = jointInfo.IS_Proess; newJointInfo.JOT_ProessDate = jointInfo.JOT_ProessDate; newJointInfo.JOT_HotRpt = jointInfo.JOT_HotRpt; newJointInfo.JOT_PrepareTemp = jointInfo.JOT_PrepareTemp; newJointInfo.JOT_CellTemp = jointInfo.JOT_CellTemp; newJointInfo.JOT_LastTemp = jointInfo.JOT_LastTemp; //newJointInfo.JOT_JointAttribute = jointInfo.JOT_JointAttribute; newJointInfo.JOT_CellWeldRules = jointInfo.JOT_CellWeldRules; newJointInfo.JOT_FloorWeldRules = jointInfo.JOT_FloorWeldRules; //newJointInfo.Fix1_FloorWeld = jointInfo.Fix1_FloorWeld; //newJointInfo.Fix1_CellWelder = jointInfo.Fix1_CellWelder; //newJointInfo.Fix2_FloorWeld = jointInfo.Fix2_FloorWeld; //newJointInfo.Fix2_CellWelder = jointInfo.Fix2_CellWelder; //newJointInfo.PW_PointID = jointInfo.PW_PointID; newJointInfo.NDT_ID = jointInfo.NDT_ID; //newJointInfo.CH_RepairID1 = jointInfo.CH_RepairID1; //newJointInfo.CH_RepairID2 = jointInfo.CH_RepairID2; //newJointInfo.Fix1_date = jointInfo.Fix1_date; //newJointInfo.Fix2_date = jointInfo.Fix2_date; newJointInfo.IS_Proess = jointInfo.IS_Proess; newJointInfo.JOT_Remark = jointInfo.JOT_Remark; //newJointInfo.JOT_Location = jointInfo.JOT_Location; newJointInfo.WeldingGasProtection = jointInfo.WeldingGasProtection; newJointInfo.ActualPrepareTemp = jointInfo.ActualPrepareTemp; newJointInfo.WeldingSpeed = jointInfo.WeldingSpeed; newJointInfo.ComponentNum = jointInfo.ComponentNum; Funs.DB.SubmitChanges(); } } /// /// 修改更新导入焊口 /// /// public static void UpdateExportJoint(Model.PW_JointInfo jointInfo) { Model.PW_JointInfo newJointInfo = Funs.DB.PW_JointInfo.FirstOrDefault(e => e.JOT_ID == jointInfo.JOT_ID); if (newJointInfo != null) { newJointInfo.MaterialId = jointInfo.MaterialId; newJointInfo.MaterialId2 = jointInfo.MaterialId2; newJointInfo.JOTY_ID = jointInfo.JOTY_ID; newJointInfo.WLO_Code = jointInfo.WLO_Code; newJointInfo.JOT_JointAttribute = jointInfo.JOT_JointAttribute; newJointInfo.JOT_Size = jointInfo.JOT_Size; newJointInfo.JOT_JointDesc = jointInfo.JOT_JointDesc; newJointInfo.JOT_Sch = jointInfo.JOT_Sch; newJointInfo.WME_ID = jointInfo.WME_ID; newJointInfo.JOT_WeldMat = jointInfo.JOT_WeldMat; newJointInfo.JOT_WeldSilk = jointInfo.JOT_WeldSilk; newJointInfo.JST_ID = jointInfo.JST_ID; newJointInfo.JOT_Component1 = jointInfo.JOT_Component1; newJointInfo.JOT_Component2 = jointInfo.JOT_Component2; newJointInfo.JOT_HeartNo1 = jointInfo.JOT_HeartNo1; newJointInfo.JOT_HeartNo2 = jointInfo.JOT_HeartNo2; newJointInfo.JOT_BelongPipe = jointInfo.JOT_BelongPipe; newJointInfo.JOT_PrepareTemp = jointInfo.JOT_PrepareTemp; newJointInfo.IS_Proess = jointInfo.IS_Proess; newJointInfo.JOT_HotRpt = jointInfo.JOT_HotRpt; newJointInfo.JOT_Location = jointInfo.JOT_Location; newJointInfo.JOT_Dia = jointInfo.JOT_Dia; newJointInfo.WeldingGasProtection = jointInfo.WeldingGasProtection; newJointInfo.DetectionTypeId = jointInfo.DetectionTypeId; newJointInfo.DetectionRateId = jointInfo.DetectionRateId; Funs.DB.SubmitChanges(); } } /// /// 修改点口后焊接信息 /// /// public static void UpdateJointPoint(Model.PW_JointInfo jointInfo) { Model.PW_JointInfo newJointInfo = Funs.DB.PW_JointInfo.FirstOrDefault(e => e.JOT_ID == jointInfo.JOT_ID); if (newJointInfo != null) { newJointInfo.JOT_JointStatus = jointInfo.JOT_JointStatus; newJointInfo.PW_PointID = jointInfo.PW_PointID; Funs.DB.SubmitChanges(); } } /// /// 批量添加焊口信息 /// /// public static void AddJointInfoFatch(Model.PW_JointInfo jointInfo) { Model.PW_JointInfo newJointInfo = new Model.PW_JointInfo(); string NewKeyID = SQLHelper.GetNewID(typeof(Model.PW_JointInfo)); newJointInfo.JOT_ID = NewKeyID; newJointInfo.ProjectId = jointInfo.ProjectId; newJointInfo.ISO_ID = jointInfo.ISO_ID; newJointInfo.JOT_JointNo = jointInfo.JOT_JointNo; newJointInfo.WLO_Code = jointInfo.WLO_Code; newJointInfo.MaterialId = jointInfo.MaterialId; newJointInfo.MaterialId2 = jointInfo.MaterialId2; newJointInfo.JOT_JointDesc = jointInfo.JOT_JointDesc; newJointInfo.JOTY_ID = jointInfo.JOTY_ID; newJointInfo.JOT_Size = jointInfo.JOT_Size; newJointInfo.JOT_Dia = jointInfo.JOT_Dia; newJointInfo.JOT_JointAttribute = jointInfo.JOT_JointAttribute; newJointInfo.JOT_Sch = jointInfo.JOT_Sch; newJointInfo.JOT_TrustFlag = jointInfo.JOT_TrustFlag; newJointInfo.JOT_CheckFlag = jointInfo.JOT_CheckFlag; newJointInfo.JOT_JointStatus = jointInfo.JOT_JointStatus; newJointInfo.JOT_WeldMat = jointInfo.JOT_WeldMat; newJointInfo.JOT_WeldSilk = jointInfo.JOT_WeldSilk; newJointInfo.WME_ID = jointInfo.WME_ID; newJointInfo.IS_Proess = jointInfo.IS_Proess; newJointInfo.DetectionTypeId = jointInfo.DetectionTypeId; newJointInfo.DetectionRateId = jointInfo.DetectionRateId; Funs.DB.PW_JointInfo.InsertOnSubmit(newJointInfo); Funs.DB.SubmitChanges(); } /// /// 删除 /// /// public static void DeleteJointInfo(string jot_id) { Model.PW_JointInfo jointInfo = Funs.DB.PW_JointInfo.FirstOrDefault(e => e.JOT_ID == jot_id); if (jointInfo!=null) { Funs.DB.PW_JointInfo.DeleteOnSubmit(jointInfo); Funs.DB.SubmitChanges(); } } /// /// 删除管线下焊口信息 /// /// public static void DeleteJointInfoByIsoId(string iso_id) { var jointInfos = Funs.DB.PW_JointInfo.Where(e => e.ISO_ID == iso_id); if (jointInfos != null) { Funs.DB.PW_JointInfo.DeleteAllOnSubmit(jointInfos); Funs.DB.SubmitChanges(); } } #region 批量删除 /// /// 批量删除 /// /// public static Model.ResponeData DelAllJots(string projectId, string isoId,string JointNo) { var responeData = new Model.ResponeData(); try { int pcount = 0; IQueryable getDataList = Funs.DB.PW_JointInfo.Where(x => x.ProjectId == projectId && x.ISO_ID == isoId); if (!string.IsNullOrEmpty(JointNo)) { getDataList = getDataList.Where(x => x.JOT_JointNo.Contains(JointNo)); } pcount = getDataList.Count(); if (pcount == 0) { responeData.code = 0; responeData.message = "没有符合条件数据!"; } else { var getDJot = getDataList.FirstOrDefault(x => x.DReportID != null); if (getDJot != null) { responeData.code = 0; responeData.message = "存在已做日报的焊口!"; } else { Funs.DB.PW_JointInfo.DeleteAllOnSubmit(getDataList); Funs.DB.SubmitChanges(); responeData.code = 1; responeData.message = "删除焊口:" + pcount.ToString() + "个。"; } } } catch (Exception ex) { responeData.code = 0; responeData.message = ex.Message; } return responeData; } #endregion /// /// 修改 /// /// public static void UpdateJointInfoByDReport(Model.PW_JointInfo jointInfo) { Model.PW_JointInfo newJointInfo = Funs.DB.PW_JointInfo.FirstOrDefault(e => e.JOT_ID == jointInfo.JOT_ID); if (newJointInfo != null) { newJointInfo.JOT_JointNo = jointInfo.JOT_JointNo; newJointInfo.DReportID = jointInfo.DReportID; newJointInfo.JOT_CellWelder = jointInfo.JOT_CellWelder; newJointInfo.JOT_FloorWelder = jointInfo.JOT_FloorWelder; newJointInfo.WLO_Code = jointInfo.WLO_Code; newJointInfo.JOT_DoneDin = jointInfo.JOT_DoneDin; newJointInfo.JOT_JointAttribute = jointInfo.JOT_JointAttribute; newJointInfo.JOT_JointStatus = jointInfo.JOT_JointStatus; newJointInfo.JOT_Location = jointInfo.JOT_Location; newJointInfo.JOT_Electricity = jointInfo.JOT_Electricity; newJointInfo.JOT_Voltage = jointInfo.JOT_Voltage; newJointInfo.WeldingSpeed = jointInfo.WeldingSpeed; newJointInfo.JOT_PrepareTemp = jointInfo.JOT_PrepareTemp; newJointInfo.ActualPrepareTemp = jointInfo.ActualPrepareTemp; newJointInfo.JOT_CellTemp = jointInfo.JOT_CellTemp; newJointInfo.JOT_LastTemp = jointInfo.JOT_LastTemp; Funs.DB.SubmitChanges(); } } /// /// 更新焊口号 固定焊口号后 +G /// /// 焊口id /// 焊口属性 /// 日报操作(增加、删除) public static void UpdateJointNoAddG(string jotId, string jointAttribute, string operateState) { if (operateState == Const.BtnDelete || jointAttribute != "固定") { Model.PW_JointInfo deleteJointInfo = Funs.DB.PW_JointInfo.FirstOrDefault(e => e.JOT_ID == jotId); if (deleteJointInfo.JOT_JointNo.Last() == 'G') { deleteJointInfo.JOT_JointNo = deleteJointInfo.JOT_JointNo.Substring(0, deleteJointInfo.JOT_JointNo.Length - 1); Funs.DB.SubmitChanges(); } } else { Model.PW_JointInfo addJointInfo = Funs.DB.PW_JointInfo.FirstOrDefault(e => e.JOT_ID == jotId); if (addJointInfo.JOT_JointNo.Last() != 'G') { addJointInfo.JOT_JointNo += "G"; } Funs.DB.SubmitChanges(); } } public static void UpdateJointNoAddGForApi(string jotId, string jointAttribute, string operateState) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { if (operateState == Const.BtnDelete || jointAttribute != "固定") { Model.PW_JointInfo deleteJointInfo = db.PW_JointInfo.FirstOrDefault(e => e.JOT_ID == jotId); if (deleteJointInfo.JOT_JointNo.Last() == 'G') { deleteJointInfo.JOT_JointNo = deleteJointInfo.JOT_JointNo.Substring(0, deleteJointInfo.JOT_JointNo.Length - 1); db.SubmitChanges(); } } else { Model.PW_JointInfo addJointInfo = db.PW_JointInfo.FirstOrDefault(e => e.JOT_ID == jotId); if (addJointInfo.JOT_JointNo.Last() != 'G') { addJointInfo.JOT_JointNo += "G"; } db.SubmitChanges(); } } } /// /// 根据焊接日报ID获取焊接日期 /// /// /// public static DateTime GetReportDateByDReportID(string dReportID) { return (from y in Funs.DB.BO_WeldReportMain where y.DReportID == dReportID select y.JOT_WeldDate).FirstOrDefault(); } /// /// 根据日报告号获取未切除焊口信息 /// /// /// public static List GetJointInfosByDReportID(string DReportID) { return (from x in Funs.DB.PW_JointInfo where x.DReportID == DReportID && x.JOT_JointStatus != "104" select x).ToList(); } /// /// 根据日报获取焊口信息 /// /// /// public static List GetJointInfosAllByDReportID(string DReportID) { return (from x in Funs.DB.PW_JointInfo where x.DReportID == DReportID select x).ToList(); } /// /// 根据点口编号获取未切除焊口信息 /// /// /// public static List GetViewJointInfosByPointID(string PW_PointID) { return (from x in Funs.DB.View_JointInfo where x.PW_PointID == PW_PointID && x.JOT_JointStatus != "104" orderby x.WorkAreaCode,x.ISO_IsoNo,x.JOT_JointNo select x).ToList(); } public static List GetDistinctViewJointInfosByPointID(string PW_PointID) { List res = new List(); var q = (from x in Funs.DB.PW_JointInfo where x.PW_PointID == PW_PointID && x.JOT_JointStatus != "104" orderby x.ISO_ID, x.JOT_JointNo select x).ToList(); foreach (var item in q) { Model.View_JointInfo jot = new Model.View_JointInfo(); jot.ISO_ID = item.ISO_ID; jot.JOT_ID = item.JOT_ID; var iso = Funs.DB.PW_IsoInfo.FirstOrDefault(x => x.ISO_ID == item.ISO_ID); if (iso != null) { jot.ISO_IsoNo = iso.ISO_IsoNo; var area = Funs.DB.ProjectData_WorkArea.FirstOrDefault(x => x.WorkAreaId == iso.WorkAreaId); if (area != null) { jot.WorkAreaCode = area.WorkAreaCode; } } jot.JOT_JointNo = item.JOT_JointNo; jot.JOTY_ID = item.JOTY_ID; jot.WLO_Code = item.WLO_Code; jot.JOT_JointAttribute = item.JOT_JointAttribute; jot.JOT_Size = item.JOT_Size; jot.JOT_JointDesc = item.JOT_JointDesc; jot.JOT_Sch = item.JOT_Sch; jot.WME_ID = item.WME_ID; jot.JOT_HeartNo1 = item.JOT_HeartNo1; jot.JOT_HeartNo2 = item.JOT_HeartNo2; jot.JOT_BelongPipe = item.JOT_BelongPipe; jot.JOT_PrepareTemp = item.JOT_PrepareTemp; jot.IS_Proess = item.IS_Proess; jot.JOT_HotRpt = item.JOT_HotRpt; jot.JOT_Location = item.JOT_Location; jot.JOT_Dia = item.JOT_Dia; var cellWelder = Funs.DB.BS_Welder.FirstOrDefault(x => x.WED_ID == item.JOT_CellWelder); if (cellWelder != null) { jot.WED_Code1 = cellWelder.WED_Code; } var floorWelder = Funs.DB.BS_Welder.FirstOrDefault(x => x.WED_ID == item.JOT_FloorWelder); if (floorWelder != null) { jot.WED_Code2 = floorWelder.WED_Code; } jot.DetectionTypeId = item.DetectionTypeId; jot.DetectionRateId = item.DetectionRateId; res.Add(jot); } return res;// (from x in Funs.DB.View_JointInfo where x.PW_PointID == PW_PointID && x.JOT_JointStatus != "104" orderby x.WorkAreaCode, x.ISO_IsoNo, x.JOT_JointNo select x).ToList(); } /// /// 根据点口号获取焊口信息 /// /// /// public static List GetJointInfosAllByPointID(string PW_PointID) { return (from x in Funs.DB.PW_JointInfo where x.PW_PointID == PW_PointID select x).ToList(); } /// /// 根据管线Id获取已焊接的焊口信息 /// /// /// public static string GetDeReportByJotID(string iso_id) { return (from x in Funs.DB.PW_JointInfo where x.ISO_ID == iso_id && x.DReportID != null select x.DReportID).FirstOrDefault(); } /// /// 根据焊口号、管线号及区域号获取焊口信息 /// /// 焊口号 /// /// /// public static Model.PW_JointInfo GetJointInfoByJointNoAndIsoNoAndBAW_ID(string projectId, string bAW_ID, string isoNo, string jointNo) { return (from x in Funs.DB.PW_JointInfo join y in Funs.DB.PW_IsoInfo on x.ISO_ID equals y.ISO_ID where x.ProjectId == projectId && y.WorkAreaId == bAW_ID && y.ISO_IsoNo == isoNo && x.JOT_JointNo == jointNo select x).FirstOrDefault(); } /// /// 根据焊口信息查找焊口信息 /// /// /// public static string GetJointInfoByJOTNO(string iso_id, string jot_no) { return (from x in Funs.DB.PW_JointInfo where x.ISO_ID == iso_id && x.JOT_JointNo == jot_no select x.JOT_JointNo).FirstOrDefault(); } /// /// 根据焊接日报获取焊口数 /// /// /// public static int GetJointInfoByDReportId(string dreportId) { var q = (from x in Funs.DB.PW_JointInfo where x.DReportID == dreportId select x).ToList(); return q.Count(); } /// /// 根据管线判断该管线下焊口是否已焊接 /// /// /// public static bool IsExistJointInfoWeld(string iso_id) { var q = from x in Funs.DB.PW_JointInfo where x.ISO_ID == iso_id && x.DReportID != null select x; if (q.Count() > 0) { return true; } else { return false; } } /// /// 判断是否存在相同焊口号 /// /// /// /// /// /// /// public static bool IsExitJointNo(string projectId, string iso_Id, string jointNo) { var q = from x in Funs.DB.PW_JointInfo where x.ProjectId == projectId && x.ISO_ID == iso_Id && x.JOT_JointNo == jointNo select x; if (q.Count() > 0) { return true; } else { return false; } } /// /// 根据管线Id获取点口不为空的焊口数量 /// /// /// public static int GetJointCountByIsoIdPoint(string iso_Id) { return (from x in Funs.DB.PW_JointInfo where x.ISO_ID == iso_Id && x.PW_PointID != null select x).Count(); } /// /// 根据管线焊口属性获取点口不为空的焊口数量 /// /// /// /// public static int GetJointCountByIsoIdJointAttribute(string iso_Id, string jointAttribute) { return (from x in Funs.DB.PW_JointInfo where x.ISO_ID == iso_Id && x.PW_PointID != null && x.JOT_JointAttribute == jointAttribute select x).Count(); } /// /// 根据焊口Id获取焊口视图信息 /// /// /// public static Model.View_JointInfo GetViewJointInfoByJotId(string jot_Id) { return Funs.DB.View_JointInfo.FirstOrDefault(e => e.JOT_ID == jot_Id); } } }