214 lines
9.8 KiB
C#
214 lines
9.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// 硬度委托
|
|
/// </summary>
|
|
public static class Hard_TrustService
|
|
{
|
|
/// <summary>
|
|
/// 根据主键获取硬度委托
|
|
/// </summary>
|
|
/// <param name="hardTrustID"></param>
|
|
/// <returns></returns>
|
|
public static Model.HJGL_Hard_Trust GetHardTrustById(string hardTrustID)
|
|
{
|
|
return Funs.DB.HJGL_Hard_Trust.FirstOrDefault(e => e.HardTrustID == hardTrustID);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加硬度委托
|
|
/// </summary>
|
|
/// <param name="hardTrust"></param>
|
|
public static void AddHardTrust(Model.HJGL_Hard_Trust hardTrust)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_Hard_Trust newHardTrust = new Model.HJGL_Hard_Trust();
|
|
newHardTrust.HardTrustID = hardTrust.HardTrustID;
|
|
newHardTrust.HardTrustNo = hardTrust.HardTrustNo;
|
|
newHardTrust.HardTrustUnit = hardTrust.HardTrustUnit;
|
|
newHardTrust.HardTrustDate = hardTrust.HardTrustDate;
|
|
newHardTrust.AuditMan = hardTrust.AuditMan;
|
|
newHardTrust.AuditDate = hardTrust.AuditDate;
|
|
newHardTrust.HardnessRate = hardTrust.HardnessRate;
|
|
newHardTrust.HardnessMethod = hardTrust.HardnessMethod;
|
|
newHardTrust.CheckUnit = hardTrust.CheckUnit;
|
|
newHardTrust.ProjectId = hardTrust.ProjectId;
|
|
newHardTrust.DetectionTime = hardTrust.DetectionTime;
|
|
newHardTrust.Sendee = hardTrust.Sendee;
|
|
newHardTrust.Standards = hardTrust.Standards;
|
|
newHardTrust.InspectionNum = hardTrust.InspectionNum;
|
|
newHardTrust.CheckNum = hardTrust.CheckNum;
|
|
newHardTrust.TestWeldNum = hardTrust.TestWeldNum;
|
|
newHardTrust.HardTrustMan = hardTrust.HardTrustMan;
|
|
newHardTrust.CheckName = hardTrust.CheckName;
|
|
newHardTrust.AcceptStandard = hardTrust.AcceptStandard;
|
|
newHardTrust.EquipmentModel = hardTrust.EquipmentModel;
|
|
newHardTrust.InstallationId = hardTrust.InstallationId;
|
|
newHardTrust.WorkAreaId = hardTrust.WorkAreaId;
|
|
db.HJGL_Hard_Trust.InsertOnSubmit(newHardTrust);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改硬度委托
|
|
/// </summary>
|
|
/// <param name="hardTrust"></param>
|
|
public static void UpdateHardTrust(Model.HJGL_Hard_Trust hardTrust)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_Hard_Trust newHardTrust = db.HJGL_Hard_Trust.FirstOrDefault(e => e.HardTrustID == hardTrust.HardTrustID);
|
|
if (newHardTrust != null)
|
|
{
|
|
newHardTrust.HardTrustNo = hardTrust.HardTrustNo;
|
|
newHardTrust.HardTrustUnit = hardTrust.HardTrustUnit;
|
|
newHardTrust.HardTrustDate = hardTrust.HardTrustDate;
|
|
newHardTrust.AuditMan = hardTrust.AuditMan;
|
|
newHardTrust.AuditDate = hardTrust.AuditDate;
|
|
newHardTrust.HardnessRate = hardTrust.HardnessRate;
|
|
newHardTrust.HardnessMethod = hardTrust.HardnessMethod;
|
|
newHardTrust.CheckUnit = hardTrust.CheckUnit;
|
|
newHardTrust.ProjectId = hardTrust.ProjectId;
|
|
newHardTrust.DetectionTime = hardTrust.DetectionTime;
|
|
newHardTrust.Sendee = hardTrust.Sendee;
|
|
newHardTrust.Standards = hardTrust.Standards;
|
|
newHardTrust.InspectionNum = hardTrust.InspectionNum;
|
|
newHardTrust.CheckNum = hardTrust.CheckNum;
|
|
newHardTrust.TestWeldNum = hardTrust.TestWeldNum;
|
|
newHardTrust.HardTrustMan = hardTrust.HardTrustMan;
|
|
newHardTrust.CheckName = hardTrust.CheckName;
|
|
newHardTrust.AcceptStandard = hardTrust.AcceptStandard;
|
|
newHardTrust.EquipmentModel = hardTrust.EquipmentModel;
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键删除硬度委托
|
|
/// </summary>
|
|
/// <param name="hardTrustID"></param>
|
|
public static void DeleteHardTrustById(string hardTrustID)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_Hard_Trust hardTrust = db.HJGL_Hard_Trust.FirstOrDefault(e => e.HardTrustID == hardTrustID);
|
|
if (hardTrust != null)
|
|
{
|
|
db.HJGL_Hard_Trust.DeleteOnSubmit(hardTrust);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 硬度委托委托单编号是否存在
|
|
/// </summary>
|
|
/// <param name="pointNo"></param>
|
|
/// <param name="pointId"></param>
|
|
/// <returns></returns>
|
|
public static bool IsExistTrustCode(string hardTrustNo, string hardTrustID, string projectId)
|
|
{
|
|
var q = Funs.DB.HJGL_Hard_Trust.FirstOrDefault(x => x.HardTrustNo == hardTrustNo && x.ProjectId == projectId && x.HardTrustID != hardTrustID);
|
|
if (q != null)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查找后返回集合增加到列表集团中
|
|
/// </summary>
|
|
/// <param name="hdItemsString"></param>
|
|
/// <returns></returns>
|
|
public static List<Model.View_HJGL_Hard_TrustItem> GetHardTrustAddItem(string hdItemsString)
|
|
{
|
|
var jointInfos = from x in Funs.DB.View_JointInfo select x;
|
|
List<Model.View_HJGL_Hard_TrustItem> returnViewMatch = new List<Model.View_HJGL_Hard_TrustItem>();
|
|
if (!string.IsNullOrEmpty(hdItemsString))
|
|
{
|
|
List<string> jotIds = Funs.GetStrListByStr(hdItemsString, '|');
|
|
foreach (var jotItem in jotIds)
|
|
{
|
|
string[] strs = jotItem.Split(',');
|
|
var jotInfo = jointInfos.FirstOrDefault(x => x.JOT_ID == strs[0]);
|
|
Model.View_HJGL_Hard_TrustItem newItem = new Model.View_HJGL_Hard_TrustItem();
|
|
newItem.HardTrustItemID = SQLHelper.GetNewID(typeof(Model.View_HJGL_Hard_TrustItem));
|
|
newItem.WeldJointId = jotInfo.JOT_ID;
|
|
newItem.HotProessTrustItemId = strs[1];
|
|
newItem.ISO_IsoNo = jotInfo.ISO_IsoNo;
|
|
newItem.JOT_JointNo = jotInfo.JOT_JointNo;
|
|
newItem.WelderCode = jotInfo.WED_Code1;
|
|
newItem.JOT_JointDesc = jotInfo.JOT_JointDesc;
|
|
newItem.MaterialCode = jotInfo.STE_Name1;
|
|
newItem.ISO_IsoNumber = jotInfo.ISO_IsoNumber;
|
|
newItem.JOT_Remark = jotInfo.JOT_Remark;
|
|
returnViewMatch.Add(newItem);
|
|
}
|
|
}
|
|
return returnViewMatch;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据项目状态获取硬度委托委托明细信息
|
|
/// </summary>
|
|
/// <param name="ManagerTotalId"></param>
|
|
/// <returns></returns>
|
|
public static List<Model.View_HJGL_Hard_TrustItem> GetHardTrustItem(string hardTrustID)
|
|
{
|
|
List<Model.View_HJGL_Hard_TrustItem> returnViewMatch = (from x in Funs.DB.View_HJGL_Hard_TrustItem
|
|
where x.HardTrustID == hardTrustID
|
|
select x).ToList();
|
|
return returnViewMatch;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查找需要硬度委托的焊口信息
|
|
/// </summary>
|
|
/// <param name="projectId"></param>
|
|
/// <param name="hardTrustID"></param>
|
|
/// <param name="iso_id"></param>
|
|
/// <returns></returns>
|
|
public static List<Model.View_HJGL_Hard_TrustItem> GetHardTrustFind(string projectId, string hardTrustID, string pipelineId)
|
|
{
|
|
///根据已经热处理且需要硬度检测且未进行硬度检测的焊口获取焊口视图集合
|
|
var weldJoints = (from x in Funs.DB.HJGL_HotProess_TrustItem
|
|
join y in Funs.DB.View_JointInfo
|
|
on x.WeldJointId equals y.JOT_ID
|
|
where y.ISO_ID == pipelineId && x.IsHardness == true && x.IsTrust == null
|
|
select new {
|
|
WeldJointId = y.JOT_ID,
|
|
PipelineCode = y.ISO_IsoNo,
|
|
WeldJointCode = y.JOT_JointNo,
|
|
WelderCode = y.WED_Code1,
|
|
Specification = y.JOT_JointDesc,
|
|
MaterialCode = y.STE_Name1,
|
|
SingleNumber = y.ISO_IsoNumber,
|
|
Remark=y.JOT_Remark,
|
|
HotProessTrustItemId = x.HotProessTrustItemId,
|
|
}).Distinct().ToList();
|
|
List<Model.View_HJGL_Hard_TrustItem> returnViewMatch = new List<Model.View_HJGL_Hard_TrustItem>();
|
|
foreach (var item in weldJoints)
|
|
{
|
|
Model.View_HJGL_Hard_TrustItem newItem = new Model.View_HJGL_Hard_TrustItem();
|
|
newItem.WeldJointId = item.WeldJointId;
|
|
newItem.ISO_IsoNo = item.PipelineCode;
|
|
newItem.JOT_JointNo = item.WeldJointCode;
|
|
newItem.WelderCode = item.WelderCode;
|
|
newItem.JOT_JointDesc = item.Specification;
|
|
newItem.MaterialCode = item.MaterialCode;
|
|
newItem.ISO_IsoNumber = item.SingleNumber;
|
|
newItem.JOT_Remark = item.Remark;
|
|
newItem.HotProessTrustItemId = item.HotProessTrustItemId;
|
|
returnViewMatch.Add(newItem);
|
|
}
|
|
return returnViewMatch;
|
|
}
|
|
}
|
|
}
|