638 lines
30 KiB
C#
638 lines
30 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Collections;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace BLL
|
|
{
|
|
public class HJGL_CH_HotProessTrustService
|
|
{
|
|
/// <summary>
|
|
/// 根据项目状态获取热处理委托明细信息
|
|
/// </summary>
|
|
/// <param name="ManagerTotalId"></param>
|
|
/// <returns></returns>
|
|
public static List<Model.HJGL_View_CH_HotProessTrustItem> GetHotProessTrustItem(string projectId, string trustId)
|
|
{
|
|
List<Model.HJGL_View_CH_HotProessTrustItem> returnViewMatch = (from x in Funs.DB.HJGL_View_CH_HotProessTrustItem
|
|
where x.ProjectId == projectId && x.HotProessTrustId == trustId
|
|
select x).ToList();
|
|
return returnViewMatch;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查找后返回集合增加到列表集团中
|
|
/// </summary>
|
|
/// <param name="hdItemsString"></param>
|
|
/// <returns></returns>
|
|
public static List<Model.HJGL_View_CH_HotProessTrustItem> GetHotProessTrustAddItem(string hdItemsString)
|
|
{
|
|
var jointInfos = from x in Funs.DB.HJGL_View_JointInfo select x;
|
|
var jointInfoAndIsoInfos = from x in Funs.DB.HJGL_View_JointInfoAndIsoInfo select x;
|
|
List<Model.HJGL_View_CH_HotProessTrustItem> returnViewMatch = new List<Model.HJGL_View_CH_HotProessTrustItem>(); //getHotProessTrustItem;
|
|
if (!string.IsNullOrEmpty(hdItemsString))
|
|
{
|
|
List<string> jotIds = Funs.GetStrListByStr(hdItemsString, '|');
|
|
foreach (var jotItem in jotIds)
|
|
{
|
|
string[] strs = jotItem.Split(',');
|
|
//if (returnViewMatch.FirstOrDefault(x => x.JOT_ID == jotItem) == null)
|
|
//{
|
|
var jotInfo = jointInfos.FirstOrDefault(x => x.JOT_ID == strs[0]);
|
|
var jotAndIsoInfo = jointInfoAndIsoInfos.FirstOrDefault(x => x.JOT_ID == strs[0]);
|
|
if (jotAndIsoInfo != null)
|
|
{
|
|
Model.HJGL_View_CH_HotProessTrustItem newItem = new Model.HJGL_View_CH_HotProessTrustItem();
|
|
newItem.HotProessTrustItemId = SQLHelper.GetNewID(typeof(Model.HJGL_View_CH_HotProessTrustItem));
|
|
newItem.JOT_ID = jotAndIsoInfo.JOT_ID;
|
|
newItem.ISO_IsoNo = jotAndIsoInfo.ISO_IsoNo;
|
|
newItem.JOT_JointNo = jotAndIsoInfo.JOT_JointNo;
|
|
newItem.JOT_JointDesc = jotInfo.JOT_JointDesc;
|
|
newItem.STE_Code = jotInfo.STE_Name1;
|
|
newItem.TrustDate = DateTime.Now;
|
|
if (strs.Length > 1)
|
|
{
|
|
newItem.HardTestResultId = strs[1];
|
|
}
|
|
if (strs.Length > 2)
|
|
{
|
|
newItem.HardRepairMark = strs[2];
|
|
}
|
|
if (!string.IsNullOrEmpty(newItem.HardRepairMark))
|
|
{
|
|
newItem.JOT_JointNo = jotAndIsoInfo.JOT_JointNo + newItem.HardRepairMark;
|
|
}
|
|
returnViewMatch.Add(newItem);
|
|
}
|
|
//}
|
|
}
|
|
}
|
|
|
|
return returnViewMatch;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取未完全热处理焊口信息
|
|
/// </summary>
|
|
/// <param name="ManagerTotalId"></param>
|
|
/// <returns></returns>
|
|
public static List<Model.HJGL_View_CH_HotProessTrustItem> GetHotProessTrustFind(string projectId, string trustId, string iso_id)
|
|
{
|
|
var jointInfos = from x in Funs.DB.HJGL_View_JointInfo select x;
|
|
var jointInfoAndIsoInfos = from x in Funs.DB.HJGL_View_JointInfoAndIsoInfo select x;
|
|
List<Model.HJGL_View_CH_HotProessTrustItem> returnViewMatch = new List<Model.HJGL_View_CH_HotProessTrustItem>();
|
|
var jotLists = from x in Funs.DB.HJGL_PW_JointInfo
|
|
where x.ProjectId == projectId && x.ISO_ID == iso_id
|
|
select x;
|
|
var hotProessTrustItems = from x in Funs.DB.HJGL_CH_HotProessTrustItem
|
|
join z in Funs.DB.HJGL_PW_JointInfo
|
|
on x.JOT_ID equals z.JOT_ID
|
|
where z.ProjectId == projectId && z.ISO_ID == iso_id
|
|
select x;
|
|
var totalHotProessResult = from x in Funs.DB.HJGL_CH_HotProessResult
|
|
join y in Funs.DB.HJGL_PW_JointInfo
|
|
on x.JOT_ID equals y.JOT_ID
|
|
where y.ISO_ID == iso_id
|
|
select x;
|
|
if (jotLists.Count() > 0)
|
|
{
|
|
foreach (var item in jotLists)
|
|
{
|
|
var jothotProessTrustItems = from x in hotProessTrustItems where x.JOT_ID == item.JOT_ID select x;
|
|
bool isShow = false;
|
|
if (item.IS_Proess == "1") //需要热处理
|
|
{
|
|
if (jothotProessTrustItems.Count() == 0) //未进行过热处理
|
|
{
|
|
isShow = true;
|
|
}
|
|
else //已进行过热处理
|
|
{
|
|
string oldProessTypes = item.ProessTypes.Replace("|", "");
|
|
string proessTypes = string.Empty;
|
|
foreach (var jothotProessTrustItem in jothotProessTrustItems)
|
|
{
|
|
proessTypes += jothotProessTrustItem.ProessTypes;
|
|
}
|
|
proessTypes = proessTypes.Replace("|", "");
|
|
if (oldProessTypes.Length > proessTypes.Length) //未将所有热处理类型委托完
|
|
{
|
|
isShow = true;
|
|
}
|
|
else //已处理完但最终结果反馈未合格的也要显示
|
|
{
|
|
//该口已存在的结果反馈记录集合
|
|
var hotProseeResults = from x in totalHotProessResult where x.JOT_ID == item.JOT_ID select x;
|
|
foreach (var hotProseeResult in hotProseeResults)
|
|
{
|
|
if (hotProseeResult.IsOK == false) //存在结果反馈不合格的记录
|
|
{
|
|
var oldTrustId = hotProseeResult.HotProessTrustId; //不合格记录的热处理委托Id
|
|
var oldItem = hotProessTrustItems.FirstOrDefault(x => x.JOT_ID == item.JOT_ID && x.HotProessTrustId == oldTrustId);
|
|
var otherItems = from x in hotProessTrustItems where x.JOT_ID == item.JOT_ID && x.HotProessTrustId != oldTrustId && x.ProessTypes.Contains(oldItem.ProessTypes) select x;
|
|
if (otherItems.Count() == 0) //不合格后尚未再次进行热处理委托
|
|
{
|
|
isShow = true;
|
|
}
|
|
else
|
|
{
|
|
List<string> trustIds = (from x in otherItems select x.HotProessTrustId).ToList();
|
|
var otherHotProseeResults = from x in totalHotProessResult where trustIds.Contains(x.HotProessTrustId) && x.JOT_ID == item.JOT_ID select x;
|
|
if (otherHotProseeResults.Count() > 0 && otherHotProseeResults.Count(x => x.IsOK == false) == otherHotProseeResults.Count()) //所有后续的结果反馈都不合格,则继续显示
|
|
{
|
|
isShow = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (isShow)
|
|
{
|
|
var jotInfo = jointInfos.FirstOrDefault(x => x.JOT_ID == item.JOT_ID);
|
|
var jotAndIsoInfo = jointInfoAndIsoInfos.FirstOrDefault(x => x.JOT_ID == item.JOT_ID);
|
|
if (jotAndIsoInfo != null)
|
|
{
|
|
var date = BLL.HJGL_WeldReportService.GetWeldReportByDReportID(jotAndIsoInfo.DReportID);
|
|
Model.HJGL_View_CH_HotProessTrustItem newItem = new Model.HJGL_View_CH_HotProessTrustItem();
|
|
newItem.JOT_ID = jotAndIsoInfo.JOT_ID;
|
|
newItem.ISO_ID = jotAndIsoInfo.ISO_ID;
|
|
newItem.ISO_IsoNo = jotAndIsoInfo.ISO_IsoNo;
|
|
newItem.JOT_JointNo = jotAndIsoInfo.JOT_JointNo;
|
|
if (date != null && date.JOT_WeldDate != null)
|
|
{
|
|
newItem.JOT_WeldDate = date.JOT_WeldDate;
|
|
}
|
|
newItem.NewJotId = jotAndIsoInfo.JOT_ID;
|
|
newItem.JOT_JointDesc = jotInfo.JOT_JointDesc;
|
|
newItem.STE_Code = jotInfo.STE_Name1;
|
|
newItem.DReportID = jotAndIsoInfo.DReportID;
|
|
returnViewMatch.Add(newItem);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//硬度不合格口记录
|
|
var noPassHardLists = (from x in Funs.DB.HJGL_PW_JointInfo
|
|
join z in Funs.DB.HJGL_CH_HardTestResult on x.JOT_ID equals z.JOT_ID
|
|
join a in Funs.DB.HJGL_CH_HotProessTrustItem on z.JOT_ID equals a.JOT_ID
|
|
where x.ProjectId == projectId && x.ISO_ID == iso_id && a.HardTestResultId == null && z.IsOK == false
|
|
select new { x.JOT_ID, z.HardTestReportId }).Distinct().ToList();
|
|
foreach (var item in noPassHardLists)
|
|
{
|
|
Model.HJGL_CH_HotProessTrustItem newhotProessTrustItem = (from x in hotProessTrustItems
|
|
where x.JOT_ID == item.JOT_ID && x.HardTestResultId == item.HardTestReportId
|
|
select x).FirstOrDefault(); //上次硬度不合格口是否生成热处理委托记录
|
|
if (newhotProessTrustItem == null)
|
|
{
|
|
var jotInfo = jointInfos.FirstOrDefault(x => x.JOT_ID == item.JOT_ID);
|
|
var jotAndIsoInfo = jointInfoAndIsoInfos.FirstOrDefault(x => x.JOT_ID == item.JOT_ID);
|
|
if (jotAndIsoInfo != null)
|
|
{
|
|
Model.HJGL_View_CH_HotProessTrustItem newItem = new Model.HJGL_View_CH_HotProessTrustItem();
|
|
newItem.JOT_ID = jotAndIsoInfo.JOT_ID;
|
|
newItem.ISO_ID = jotAndIsoInfo.ISO_ID;
|
|
newItem.ISO_IsoNo = jotAndIsoInfo.ISO_IsoNo;
|
|
newItem.JOT_JointNo = jotAndIsoInfo.JOT_JointNo;
|
|
newItem.JOT_JointDesc = jotInfo.JOT_JointDesc;
|
|
newItem.STE_Code = jotInfo.STE_Name1;
|
|
newItem.HardTestResultId = item.HardTestReportId;
|
|
newItem.DReportID = jotAndIsoInfo.DReportID;
|
|
//之前热处理委托主表主键
|
|
var oldHotProessTrustId = (from x in Funs.DB.HJGL_CH_HardTestReportItem
|
|
join y in Funs.DB.HJGL_CH_HardTestResult
|
|
on x.HardTestReportId equals y.HardTestReportId
|
|
where x.JOT_ID == item.JOT_ID && y.HardTestReportId == item.HardTestReportId
|
|
select x.HotProessTrustId).FirstOrDefault();
|
|
//之前热处理委托明细记录
|
|
Model.HJGL_CH_HotProessTrustItem oldHotProessTrustItem = (from x in hotProessTrustItems
|
|
where x.JOT_ID == item.JOT_ID && x.HotProessTrustId == oldHotProessTrustId && x.ProessTypes.Contains("4")
|
|
select x).FirstOrDefault();
|
|
if (oldHotProessTrustItem != null)
|
|
{
|
|
if (string.IsNullOrEmpty(oldHotProessTrustItem.HardRepairMark))
|
|
{
|
|
newItem.HardRepairMark = "F1";
|
|
}
|
|
else
|
|
{
|
|
newItem.HardRepairMark = "F2";
|
|
}
|
|
}
|
|
newItem.NewJotId = jotAndIsoInfo.JOT_ID + ',' + newItem.HardRepairMark;
|
|
newItem.JOT_JointNo = jotAndIsoInfo.JOT_JointNo + newItem.HardRepairMark;
|
|
returnViewMatch.Add(newItem);
|
|
}
|
|
}
|
|
}
|
|
return returnViewMatch;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据热处理委托Id获取用于热处理委托的热处理委托信息
|
|
/// </summary>
|
|
/// <param name="jot_id"></param>
|
|
/// <returns></returns>
|
|
public static Model.HJGL_CH_HotProessTrust GetCH_HotProessTrustByID(string hotProessTrustID)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
var view = db.HJGL_CH_HotProessTrust.FirstOrDefault(e => e.HotProessTrustId == hotProessTrustID);
|
|
return view;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据热处理委托Id获取用于热处理委托的焊口视图信息
|
|
/// </summary>
|
|
/// <param name="jot_id"></param>
|
|
/// <returns></returns>
|
|
public static List<Model.HJGL_View_CH_HotProessTrustItem> GetView_CH_HotProessTrustItemByCH_HotProessTrustID(string hotProessTrustID)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
var view = (from x in db.HJGL_View_CH_HotProessTrustItem where x.HotProessTrustId == hotProessTrustID select x).ToList();
|
|
return view;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据焊口Id获取用于热处理委托的焊口视图信息
|
|
/// </summary>
|
|
/// <param name="jot_id"></param>
|
|
/// <returns></returns>
|
|
public static List<Model.HJGL_CH_HotProessTrustItem> GetCH_HotProessTrustItemByJOT_ID(string jot_id)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
var view = (from x in db.HJGL_CH_HotProessTrustItem where x.JOT_ID == jot_id select x).ToList();
|
|
return view;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据焊口Id和热处理委托id获取用于热处理委托明细是否存在
|
|
/// </summary>
|
|
/// <param name="jot_id"></param>
|
|
/// <returns></returns>
|
|
public static Model.HJGL_CH_HotProessTrustItem GetCH_HotProessTrustItemByHotProessTrustIdAndJotId(string hotProessTrustID, string jot_id)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
var view = db.HJGL_CH_HotProessTrustItem.FirstOrDefault(x => x.HotProessTrustId == hotProessTrustID && x.JOT_ID == jot_id);
|
|
return view;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据热处理委托Id获取用于热处理委托的焊口视图信息
|
|
/// </summary>
|
|
/// <param name="jot_id"></param>
|
|
/// <returns></returns>
|
|
public static List<Model.HJGL_CH_HotProessTrustItem> GetCH_HotProessTrustItemByHotProessTrustID(string hotProessTrustID)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
var view = (from x in db.HJGL_CH_HotProessTrustItem where x.HotProessTrustId == hotProessTrustID select x).ToList();
|
|
return view;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据焊口Id获取用于热处理委托的焊口信息
|
|
/// </summary>
|
|
/// <param name="jot_id"></param>
|
|
/// <returns></returns>
|
|
public static Model.HJGL_View_CH_HotProessTrustItem GetView_CH_HotProessTrustItemByJotID(string jot_id, string projectId)
|
|
{
|
|
var view = Funs.DB.HJGL_View_CH_HotProessTrustItem.FirstOrDefault(e => e.JOT_ID == jot_id && e.ProjectId == projectId);
|
|
return view;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 增加热处理委托信息
|
|
/// </summary>
|
|
/// <param name="cH_Trust">热处理委托实体</param>
|
|
public static void AddCH_HotProessTrust(Model.HJGL_CH_HotProessTrust cH_Trust)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_CH_HotProessTrust newCH_HotProessTrust = new Model.HJGL_CH_HotProessTrust();
|
|
newCH_HotProessTrust.HotProessTrustId = cH_Trust.HotProessTrustId;
|
|
newCH_HotProessTrust.ProjectId = cH_Trust.ProjectId;
|
|
newCH_HotProessTrust.HotProessTrustCode = cH_Trust.HotProessTrustCode;
|
|
newCH_HotProessTrust.ProjectName = cH_Trust.ProjectName;
|
|
newCH_HotProessTrust.ConstructionNo = cH_Trust.ConstructionNo;
|
|
newCH_HotProessTrust.TrustUnitId = cH_Trust.TrustUnitId;
|
|
newCH_HotProessTrust.TrstManId = cH_Trust.TrstManId;
|
|
newCH_HotProessTrust.CreateDate = DateTime.Now;
|
|
newCH_HotProessTrust.TrustType = cH_Trust.TrustType;
|
|
|
|
db.HJGL_CH_HotProessTrust.InsertOnSubmit(newCH_HotProessTrust);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改焊接信息
|
|
/// </summary>
|
|
/// <param name="weldReport">焊接实体</param>
|
|
public static void UpdateCH_HotProessTrust(Model.HJGL_CH_HotProessTrust cH_Trust)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_CH_HotProessTrust newCH_HotProessTrust = db.HJGL_CH_HotProessTrust.FirstOrDefault(e => e.HotProessTrustId == cH_Trust.HotProessTrustId);
|
|
if (newCH_HotProessTrust != null)
|
|
{
|
|
newCH_HotProessTrust.HotProessTrustCode = cH_Trust.HotProessTrustCode;
|
|
newCH_HotProessTrust.ProjectName = cH_Trust.ProjectName;
|
|
newCH_HotProessTrust.ConstructionNo = cH_Trust.ConstructionNo;
|
|
newCH_HotProessTrust.TrustUnitId = cH_Trust.TrustUnitId;
|
|
newCH_HotProessTrust.TrstManId = cH_Trust.TrstManId;
|
|
newCH_HotProessTrust.IsPrint = cH_Trust.IsPrint;
|
|
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键删除热处理委托信息
|
|
/// </summary>
|
|
/// <param name="cH_TrustID">热处理委托主键</param>
|
|
public static void DeleteCH_HotProessTrustByCH_HotProessTrustID(string hotProessTrustId)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_CH_HotProessTrust cH_Trust = db.HJGL_CH_HotProessTrust.FirstOrDefault(e => e.HotProessTrustId == hotProessTrustId);
|
|
if (cH_Trust != null)
|
|
{
|
|
db.HJGL_CH_HotProessTrust.DeleteOnSubmit(cH_Trust);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键删除热处理委托信息明细
|
|
/// </summary>
|
|
/// <param name="cH_TrustID">热处理委托主键</param>
|
|
public static void DeleteCH_HotProessTrustItemByCH_HotProessTrustID(string hotProessTrustId)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
var cH_Trust = from x in db.HJGL_CH_HotProessTrustItem where x.HotProessTrustId == hotProessTrustId select x;
|
|
if (cH_Trust != null)
|
|
{
|
|
foreach (var c in cH_Trust)
|
|
{
|
|
//回写焊口热处理委托时间
|
|
BLL.HJGL_PW_JointInfoService.WriteBackHotProessTrustDate(c.JOT_ID, null);
|
|
}
|
|
db.HJGL_CH_HotProessTrustItem.DeleteAllOnSubmit(cH_Trust);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 增加热处理委托信息明细
|
|
/// </summary>
|
|
/// <param name="trustItem">热处理委托明细实体</param>
|
|
public static void AddCH_HotProessTrustItem(Model.HJGL_CH_HotProessTrustItem trustItem)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_CH_HotProessTrustItem newTrustItem = new Model.HJGL_CH_HotProessTrustItem();
|
|
newTrustItem.HotProessTrustItemId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HotProessTrustItem));
|
|
newTrustItem.HotProessTrustId = trustItem.HotProessTrustId;
|
|
newTrustItem.JOT_ID = trustItem.JOT_ID;
|
|
newTrustItem.ProessTypes = trustItem.ProessTypes;
|
|
newTrustItem.TrustDate = trustItem.TrustDate;
|
|
newTrustItem.IsComplete = trustItem.IsComplete;
|
|
newTrustItem.Remark = trustItem.Remark;
|
|
newTrustItem.TrustItemID = trustItem.TrustItemID;
|
|
newTrustItem.HardTestResultId = trustItem.HardTestResultId;
|
|
newTrustItem.HardRepairMark = trustItem.HardRepairMark;
|
|
var oldTrustItem = Funs.DB.HJGL_CH_HotProessTrustItem.FirstOrDefault(x => x.JOT_ID == newTrustItem.JOT_ID && x.ProessTypes == newTrustItem.ProessTypes && x.HotProessTrustId == newTrustItem.HotProessTrustId);
|
|
if (oldTrustItem == null)
|
|
{
|
|
db.HJGL_CH_HotProessTrustItem.InsertOnSubmit(newTrustItem);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新焊口热处理委托情况
|
|
/// </summary>
|
|
/// <param name="type">type1-录入审核2取消删除</param>
|
|
public static void UpdateJOT_TrustFlag(string JOT_ID, string type)
|
|
{
|
|
var jointInfo = Funs.DB.HJGL_PW_JointInfo.FirstOrDefault(x => x.JOT_ID == JOT_ID);
|
|
if (jointInfo != null)
|
|
{
|
|
if (type == "1")
|
|
{
|
|
if (String.IsNullOrEmpty(jointInfo.JOT_TrustFlag) || jointInfo.JOT_TrustFlag == "00")
|
|
{
|
|
jointInfo.JOT_TrustFlag = "01";
|
|
}
|
|
else if (jointInfo.JOT_TrustFlag == "01")
|
|
{
|
|
jointInfo.JOT_TrustFlag = "02";
|
|
}
|
|
else if (jointInfo.JOT_TrustFlag == "02")
|
|
{
|
|
jointInfo.JOT_TrustFlag = "11";
|
|
}
|
|
else if (jointInfo.JOT_TrustFlag == "11")
|
|
{
|
|
jointInfo.JOT_TrustFlag = "12";
|
|
}
|
|
else if (jointInfo.JOT_TrustFlag == "12")
|
|
{
|
|
jointInfo.JOT_TrustFlag = "21";
|
|
}
|
|
else if (jointInfo.JOT_TrustFlag == "21")
|
|
{
|
|
jointInfo.JOT_TrustFlag = "22";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (jointInfo.JOT_TrustFlag == "22")
|
|
{
|
|
jointInfo.JOT_TrustFlag = "21";
|
|
}
|
|
else if (jointInfo.JOT_TrustFlag == "21")
|
|
{
|
|
jointInfo.JOT_TrustFlag = "12";
|
|
}
|
|
else if (jointInfo.JOT_TrustFlag == "12")
|
|
{
|
|
jointInfo.JOT_TrustFlag = "11";
|
|
}
|
|
else if (jointInfo.JOT_TrustFlag == "11")
|
|
{
|
|
jointInfo.JOT_TrustFlag = "02";
|
|
}
|
|
else if (jointInfo.JOT_TrustFlag == "02")
|
|
{
|
|
jointInfo.JOT_TrustFlag = "01";
|
|
}
|
|
else
|
|
{
|
|
jointInfo.JOT_TrustFlag = "00";
|
|
}
|
|
}
|
|
}
|
|
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 热处理委托单编号是否存在
|
|
/// </summary>
|
|
/// <param name="pointNo"></param>
|
|
/// <param name="pointId"></param>
|
|
/// <returns></returns>
|
|
public static bool IsExistTrustCode(string trustCode, string trustID, string projectId)
|
|
{
|
|
var q = Funs.DB.HJGL_CH_HotProessTrust.FirstOrDefault(x => x.HotProessTrustCode == trustCode && x.ProjectId == projectId && x.HotProessTrustId != trustID);
|
|
if (q != null)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据已经处理的项获取剩余需要加载的热处理项
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static ListItem[] GetNeedProessTypes(string jointProessTypes, List<string> doProessTypes, string hotProessTrustId, string jotId, string hotProessTrustItemId)
|
|
{
|
|
if (string.IsNullOrEmpty(hotProessTrustId))
|
|
{
|
|
if (!string.IsNullOrEmpty(jointProessTypes))
|
|
{
|
|
List<string> jointProessTypestrs = jointProessTypes.Split('|').ToList();
|
|
foreach (var doProessType in doProessTypes)
|
|
{
|
|
jointProessTypestrs.Remove(doProessType);
|
|
}
|
|
ListItem[] item = new ListItem[jointProessTypestrs.Count()];
|
|
for (int i = 0; i < jointProessTypestrs.Count(); i++)
|
|
{
|
|
item[i] = new ListItem(GetProessTypesName(jointProessTypestrs[i]), jointProessTypestrs[i].ToString());
|
|
}
|
|
return item;
|
|
}
|
|
return null;
|
|
}
|
|
else
|
|
{
|
|
Model.HJGL_CH_HotProessTrustItem trustItem = (from x in Funs.DB.HJGL_CH_HotProessTrustItem where x.HotProessTrustItemId == hotProessTrustItemId select x).FirstOrDefault();
|
|
if (trustItem != null)
|
|
{
|
|
List<string> jointProessTypestrs = trustItem.ProessTypes.Split('|').ToList();
|
|
ListItem[] item = new ListItem[jointProessTypestrs.Count()];
|
|
for (int i = 0; i < jointProessTypestrs.Count(); i++)
|
|
{
|
|
item[i] = new ListItem(GetProessTypesName(jointProessTypestrs[i]), jointProessTypestrs[i].ToString());
|
|
}
|
|
return item;
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据已经处理的项获取剩余需要加载的热处理项(压力容器)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static ListItem[] GetWeldNeedProessTypes(string jointProessTypes, List<string> doProessTypes, string hotProessTrustId, string jotId, string hotProessTrustItemId)
|
|
{
|
|
if (string.IsNullOrEmpty(hotProessTrustId))
|
|
{
|
|
if (!string.IsNullOrEmpty(jointProessTypes))
|
|
{
|
|
List<string> jointProessTypestrs = jointProessTypes.Split('|').ToList();
|
|
foreach (var doProessType in doProessTypes)
|
|
{
|
|
jointProessTypestrs.Remove(doProessType);
|
|
}
|
|
ListItem[] item = new ListItem[jointProessTypestrs.Count()];
|
|
for (int i = 0; i < jointProessTypestrs.Count(); i++)
|
|
{
|
|
item[i] = new ListItem(GetProessTypesName(jointProessTypestrs[i]), jointProessTypestrs[i].ToString());
|
|
}
|
|
return item;
|
|
}
|
|
return null;
|
|
}
|
|
else
|
|
{
|
|
Model.PV_CH_HotProessTrustItem trustItem = (from x in Funs.DB.PV_CH_HotProessTrustItem where x.HotProessTrustItemId == hotProessTrustItemId select x).FirstOrDefault();
|
|
if (trustItem != null)
|
|
{
|
|
List<string> jointProessTypestrs = trustItem.ProessTypes.Split('|').ToList();
|
|
ListItem[] item = new ListItem[jointProessTypestrs.Count()];
|
|
for (int i = 0; i < jointProessTypestrs.Count(); i++)
|
|
{
|
|
item[i] = new ListItem(GetProessTypesName(jointProessTypestrs[i]), jointProessTypestrs[i].ToString());
|
|
}
|
|
return item;
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
public static string GetProessTypesName(string proessType)
|
|
{
|
|
string name = string.Empty;
|
|
if (proessType == "1")
|
|
{
|
|
name = "预热";
|
|
}
|
|
else if (proessType == "2")
|
|
{
|
|
name = "消氢";
|
|
}
|
|
else if (proessType == "3")
|
|
{
|
|
name = "后热";
|
|
}
|
|
else if (proessType == "4")
|
|
{
|
|
name = "消应力热处理";
|
|
}
|
|
else if (proessType == "5")
|
|
{
|
|
name = "稳定化处理";
|
|
}
|
|
return name;
|
|
}
|
|
|
|
public static string GetProessTypesId(string proessTypesName)
|
|
{
|
|
string id = string.Empty;
|
|
if (proessTypesName == "预热")
|
|
{
|
|
id = "1";
|
|
}
|
|
else if (proessTypesName == "消氢")
|
|
{
|
|
id = "2";
|
|
}
|
|
else if (proessTypesName == "后热")
|
|
{
|
|
id = "3";
|
|
}
|
|
else if (proessTypesName == "消应力热处理")
|
|
{
|
|
id = "4";
|
|
}
|
|
else if (proessTypesName == "稳定化处理")
|
|
{
|
|
id = "5";
|
|
}
|
|
return id;
|
|
}
|
|
}
|
|
}
|