494 lines
23 KiB
C#
494 lines
23 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_WeldReportService
|
|
{
|
|
/// <summary>
|
|
/// 根据检查编号查询焊接日报信息
|
|
/// </summary>
|
|
/// <param name="checkCode">检查编号</param>
|
|
/// <returns>焊接日报信息</returns>
|
|
public static Model.HJGL_BO_WeldReportMain GetWeldReportByDReportID(string dReportID)
|
|
{
|
|
return Funs.DB.HJGL_BO_WeldReportMain.FirstOrDefault(x => x.DReportID == dReportID);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据焊接日报主键获取焊接日报信息
|
|
/// </summary>
|
|
/// <param name="weldReportNo">焊接日报编号</param>
|
|
/// <returns>焊接日报信息</returns>
|
|
public static bool IsExistDailyReportNO(string weldReportNo, string dReportID, string projectId)
|
|
{
|
|
var q = Funs.DB.HJGL_BO_WeldReportMain.FirstOrDefault(x => x.JOT_DailyReportNo == weldReportNo && x.ProjectId == projectId && x.DReportID != dReportID);
|
|
if (q != null)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据焊工获取当日焊接日报号
|
|
/// </summary>
|
|
/// <param name="welder">焊工ID</param>
|
|
/// <returns></returns>
|
|
public static string GetDailyReportByWelder(string welder, DateTime jot_WeldDate)
|
|
{
|
|
string dreportId = string.Empty;
|
|
var q = from x in Funs.DB.HJGL_PW_JointInfo
|
|
join y in Funs.DB.HJGL_BO_WeldReportMain on x.DReportID equals y.DReportID
|
|
where x.DReportID != null && x.JOT_CellWelder == welder && y.JOT_WeldDate == jot_WeldDate
|
|
select x.DReportID;
|
|
if (q.Count() > 0)
|
|
{
|
|
dreportId = q.First();
|
|
}
|
|
return dreportId;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 增加焊接日报信息
|
|
/// </summary>
|
|
/// <param name="weldReport">焊接日报实体</param>
|
|
public static void AddWeldReport(Model.HJGL_BO_WeldReportMain weldReport)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_BO_WeldReportMain newWeldReport = new Model.HJGL_BO_WeldReportMain();
|
|
newWeldReport.DReportID = weldReport.DReportID;
|
|
newWeldReport.ProjectId = weldReport.ProjectId;
|
|
newWeldReport.InstallationId = weldReport.InstallationId;
|
|
newWeldReport.BSU_ID = weldReport.BSU_ID;
|
|
newWeldReport.JOT_WeldDate = weldReport.JOT_WeldDate;
|
|
newWeldReport.JOT_DailyReportNo = weldReport.JOT_DailyReportNo;
|
|
newWeldReport.CHT_Tabler = weldReport.CHT_Tabler;
|
|
newWeldReport.CHT_TableDate = weldReport.CHT_TableDate;
|
|
newWeldReport.JOT_Remark = weldReport.JOT_Remark;
|
|
|
|
db.HJGL_BO_WeldReportMain.InsertOnSubmit(newWeldReport);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改焊接日报信息
|
|
/// </summary>
|
|
/// <param name="weldReport">焊接日报实体</param>
|
|
public static void UpdateWeldReport(Model.HJGL_BO_WeldReportMain weldReport)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_BO_WeldReportMain newWeldReport = db.HJGL_BO_WeldReportMain.First(e => e.DReportID == weldReport.DReportID);
|
|
newWeldReport.BSU_ID = weldReport.BSU_ID;
|
|
newWeldReport.JOT_WeldDate = weldReport.JOT_WeldDate;
|
|
newWeldReport.JOT_DailyReportNo = weldReport.JOT_DailyReportNo;
|
|
newWeldReport.CHT_Tabler = weldReport.CHT_Tabler;
|
|
newWeldReport.CHT_TableDate = weldReport.CHT_TableDate;
|
|
newWeldReport.JOT_Remark = weldReport.JOT_Remark;
|
|
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据焊接日报主键删除一个焊接日报信息
|
|
/// </summary>
|
|
/// <param name="weldReportCode">焊接日报主键</param>
|
|
public static void DeleteWeldReportByDReportID(string dReportID)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_BO_WeldReportMain weldReport = db.HJGL_BO_WeldReportMain.FirstOrDefault(e => e.DReportID == dReportID);
|
|
if (weldReport != null)
|
|
{
|
|
db.HJGL_BO_WeldReportMain.DeleteOnSubmit(weldReport);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据单位Id获取焊接日报数
|
|
/// </summary>
|
|
/// <param name="unitId"></param>
|
|
/// <returns></returns>
|
|
public static int GetWeldReportByUnitId(string unitId)
|
|
{
|
|
var q = (from x in Funs.DB.HJGL_BO_WeldReportMain where x.BSU_ID == unitId select x).ToList();
|
|
return q.Count();
|
|
}
|
|
/// <summary>
|
|
/// 根据装置Id获取焊接日报数
|
|
/// </summary>
|
|
/// <param name="p"></param>
|
|
/// <returns></returns>
|
|
public static int GetWeldReportByInstallationId(string installationId)
|
|
{
|
|
var q = (from x in Funs.DB.HJGL_BO_WeldReportMain where x.InstallationId == installationId select x).ToList();
|
|
return q.Count();
|
|
}
|
|
|
|
///// <summary>
|
|
///// 日报信息
|
|
///// </summary>
|
|
//public static List<Model.HJGL_SpRpWeldReportItem> getWeldReportItem
|
|
//{
|
|
// get;
|
|
// set;
|
|
//}
|
|
|
|
/// <summary>
|
|
/// 根据项目状态获取焊接日报信息
|
|
/// </summary>
|
|
/// <param name="ManagerTotalId"></param>
|
|
/// <returns></returns>
|
|
public static List<Model.HJGL_SpRpWeldReportItem> GetWeldReportItem(string dreportID)
|
|
{
|
|
List<Model.HJGL_SpRpWeldReportItem> returnViewMatch = new List<Model.HJGL_SpRpWeldReportItem>();
|
|
var jotLists = from x in Funs.DB.HJGL_PW_JointInfo
|
|
where x.DReportID == dreportID
|
|
select x;
|
|
if (jotLists.Count() > 0)
|
|
{
|
|
foreach (var item in jotLists)
|
|
{
|
|
Model.HJGL_SpRpWeldReportItem newWeldReportItem = new Model.HJGL_SpRpWeldReportItem();
|
|
newWeldReportItem.JOT_ID = item.JOT_ID;
|
|
newWeldReportItem.JOT_JointNo = item.JOT_JointNo;
|
|
var isoInfo = BLL.HJGL_PW_IsoInfoService.GetIsoInfoByIsoInfoId(item.ISO_ID);
|
|
if (isoInfo != null)
|
|
{
|
|
newWeldReportItem.ISO_IsoNo = isoInfo.ISO_IsoNo;
|
|
newWeldReportItem.ISO_Id = isoInfo.ISO_ID;
|
|
|
|
//var rate = BLL.HJGL_DetectionService.GetNDTRateByNDTRID(isoInfo.NDTR_ID);
|
|
//if (rate != null)
|
|
//{
|
|
// newWeldReportItem.NDTR_Name = rate.NDTR_Name;
|
|
//}
|
|
}
|
|
|
|
var cellWelder = BLL.HJGL_PersonManageService.GetWelderByWenId(item.JOT_CellWelder);
|
|
if (cellWelder != null)
|
|
{
|
|
newWeldReportItem.JOT_CellWelderCode = cellWelder.WED_Code;
|
|
newWeldReportItem.JOT_CellWelderID = cellWelder.WED_ID;
|
|
}
|
|
var floorWelder = BLL.HJGL_PersonManageService.GetWelderByWenId(item.JOT_FloorWelder);
|
|
if (floorWelder != null)
|
|
{
|
|
newWeldReportItem.JOT_FloorWelderCode = floorWelder.WED_Code;
|
|
newWeldReportItem.JOT_FloorWelderID = floorWelder.WED_ID;
|
|
}
|
|
if (item.WLO_Code == "F")
|
|
{
|
|
newWeldReportItem.WLO_CodeName = "现场安装";
|
|
newWeldReportItem.WLO_CodeID = "F";
|
|
}
|
|
else
|
|
{
|
|
newWeldReportItem.WLO_CodeName = "预制";
|
|
newWeldReportItem.WLO_CodeID = "S";
|
|
}
|
|
newWeldReportItem.JOT_JointAttribute = item.JOT_JointAttribute;
|
|
|
|
if (item.JOT_JointAttribute == "固定")
|
|
{
|
|
newWeldReportItem.JOT_Location = "5G";
|
|
}
|
|
else
|
|
{
|
|
newWeldReportItem.JOT_Location = "1G";
|
|
}
|
|
|
|
newWeldReportItem.JOT_Location = item.JOT_Location;
|
|
newWeldReportItem.JOT_Size = item.JOT_Size;
|
|
newWeldReportItem.JOT_DoneDin = item.JOT_DoneDin;
|
|
newWeldReportItem.JOT_Dia = item.JOT_Dia;
|
|
newWeldReportItem.JOT_Sch = item.JOT_Sch;
|
|
if (!string.IsNullOrEmpty(item.WME_ID))
|
|
{
|
|
var weldingMethod = BLL.HJGL_WeldingMethodService.GetWeldMethodByWMEID(item.WME_ID);
|
|
if (weldingMethod != null)
|
|
{
|
|
newWeldReportItem.WME_ID = weldingMethod.WME_ID;
|
|
newWeldReportItem.WME_Name = weldingMethod.WME_Name;
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(item.JOT_WeldMat))
|
|
{
|
|
var weldMat = BLL.HJGL_ConsumablesService.getConsumablesByConsumablesId(item.JOT_WeldMat);
|
|
if (weldMat!=null)
|
|
{
|
|
newWeldReportItem.JOT_WeldMat = weldMat.WMT_ID;
|
|
newWeldReportItem.WeldMatCode = weldMat.WMT_MatCode;
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(item.JOT_WeldSilk))
|
|
{
|
|
var weldSilk = BLL.HJGL_ConsumablesService.getConsumablesByConsumablesId(item.JOT_WeldSilk);
|
|
if (weldSilk!=null)
|
|
{
|
|
newWeldReportItem.JOT_WeldSilk = weldSilk.WMT_ID;
|
|
newWeldReportItem.WeldSilkCode = weldSilk.WMT_MatCode;
|
|
}
|
|
}
|
|
returnViewMatch.Add(newWeldReportItem);
|
|
}
|
|
}
|
|
|
|
return returnViewMatch;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查找后返回集合增加到列表集团中
|
|
/// </summary>
|
|
/// <param name="hdItemsString"></param>
|
|
/// <returns></returns>
|
|
public static List<Model.HJGL_SpRpWeldReportItem> GetWeldReportAddItem(string hdItemsString)
|
|
{
|
|
List<Model.HJGL_SpRpWeldReportItem> returnViewMatch = new List<Model.HJGL_SpRpWeldReportItem>(); //= getWeldReportItem;
|
|
if (!string.IsNullOrEmpty(hdItemsString))
|
|
{
|
|
List<string> list = Funs.GetStrListByStr(hdItemsString, '#');
|
|
if (list.Count() >0)
|
|
{
|
|
//string CellWelderCode = string.Empty;
|
|
//string FloorWelderCode = string.Empty;
|
|
|
|
//string welderLists = list[0];
|
|
//List<string> welderIds = Funs.GetStrListByStr(welderLists, '|');
|
|
//if (welderIds.Count() == 2)
|
|
//{
|
|
// var welderCell = BLL.HJGL_PersonManageService.GetWelderByWenId(welderIds[0]);
|
|
// if (welderCell != null)
|
|
// {
|
|
// CellWelderCode = welderCell.WED_Code;
|
|
// }
|
|
// var welderFloor = BLL.HJGL_PersonManageService.GetWelderByWenId(welderIds[1]);
|
|
// if (welderFloor != null)
|
|
// {
|
|
// FloorWelderCode = welderFloor.WED_Code;
|
|
// }
|
|
//}
|
|
|
|
//string jotIdLists = list[1];
|
|
//List<string> jotIds = Funs.GetStrListByStr(jotIdLists, '|');
|
|
foreach (var jot in list)
|
|
{
|
|
string[] jotItem = jot.Split('|');
|
|
//if (returnViewMatch.FirstOrDefault(x => x.JOT_ID == jotItem) == null)
|
|
//{
|
|
var jotInfo = BLL.HJGL_PW_JointInfoService.GetJointInfoByJotID(jotItem[0]);
|
|
if (jotInfo != null)
|
|
{
|
|
Model.HJGL_SpRpWeldReportItem newWeldReportItem = new Model.HJGL_SpRpWeldReportItem();
|
|
newWeldReportItem.JOT_ID = jotInfo.JOT_ID;
|
|
newWeldReportItem.JOT_JointNo = jotInfo.JOT_JointNo;
|
|
var isoInfo = BLL.HJGL_PW_IsoInfoService.GetIsoInfoByIsoInfoId(jotInfo.ISO_ID);
|
|
if (isoInfo != null)
|
|
{
|
|
newWeldReportItem.ISO_IsoNo = isoInfo.ISO_IsoNo;
|
|
newWeldReportItem.ISO_Id = isoInfo.ISO_ID;
|
|
|
|
}
|
|
var welderCell = BLL.HJGL_PersonManageService.GetWelderByWenId(jotItem[1]);
|
|
if (welderCell != null)
|
|
{
|
|
newWeldReportItem.JOT_CellWelderCode = welderCell.WED_Code;
|
|
newWeldReportItem.JOT_CellWelderID = jotItem[1];
|
|
}
|
|
var welderFloor = BLL.HJGL_PersonManageService.GetWelderByWenId(jotItem[2]);
|
|
if (welderFloor != null)
|
|
{
|
|
newWeldReportItem.JOT_FloorWelderCode = welderFloor.WED_Code; ;
|
|
newWeldReportItem.JOT_FloorWelderID = jotItem[2];
|
|
}
|
|
|
|
// 如存在日报,默认还是原日报焊工
|
|
//if (!string.IsNullOrEmpty(jotInfo.DReportID))
|
|
//{
|
|
// newWeldReportItem.JOT_CellWelderID = jotInfo.JOT_CellWelder;
|
|
// newWeldReportItem.JOT_FloorWelderID = jotInfo.JOT_FloorWelder;
|
|
// var welderCell = BLL.HJGL_PersonManageService.GetWelderByWenId(jotInfo.JOT_CellWelder);
|
|
// if (welderCell != null)
|
|
// {
|
|
// newWeldReportItem.JOT_CellWelderCode = welderCell.WED_Code;
|
|
// }
|
|
// var floorCell = BLL.HJGL_PersonManageService.GetWelderByWenId(jotInfo.JOT_FloorWelder);
|
|
// if (floorCell != null)
|
|
// {
|
|
// newWeldReportItem.JOT_FloorWelderCode = floorCell.WED_Code;
|
|
// }
|
|
//}
|
|
|
|
if (jotInfo.WLO_Code == "F")
|
|
{
|
|
newWeldReportItem.WLO_CodeName = "现场安装";
|
|
newWeldReportItem.WLO_CodeID = "F";
|
|
}
|
|
else
|
|
{
|
|
newWeldReportItem.WLO_CodeName = "预制";
|
|
newWeldReportItem.WLO_CodeID = "S";
|
|
}
|
|
|
|
newWeldReportItem.JOT_JointAttribute = jotInfo.JOT_JointAttribute;
|
|
|
|
var joty = BLL.HJGL_WeldService.GetJointTypeByID(jotInfo.JOTY_ID);
|
|
|
|
if (jotInfo.JOT_JointAttribute == "固定")
|
|
{
|
|
if (joty != null && (joty.JOTY_Group == "2" || joty.JOTY_Group == "3"))
|
|
{
|
|
newWeldReportItem.JOT_Location = "5F";
|
|
}
|
|
else
|
|
{
|
|
newWeldReportItem.JOT_Location = "5G";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (joty != null && (joty.JOTY_Group == "2" || joty.JOTY_Group == "3"))
|
|
{
|
|
newWeldReportItem.JOT_Location = "1F";
|
|
}
|
|
else
|
|
{
|
|
newWeldReportItem.JOT_Location = "1G";
|
|
}
|
|
}
|
|
|
|
newWeldReportItem.JOT_Size = jotInfo.JOT_Size;
|
|
newWeldReportItem.JOT_DoneDin = jotInfo.JOT_Size;
|
|
newWeldReportItem.JOT_Dia = jotInfo.JOT_Dia;
|
|
newWeldReportItem.JOT_Sch = jotInfo.JOT_Sch;
|
|
if (!string.IsNullOrEmpty(jotInfo.WME_ID))
|
|
{
|
|
var weldingMethod = BLL.HJGL_WeldingMethodService.GetWeldMethodByWMEID(jotInfo.WME_ID);
|
|
if (weldingMethod != null)
|
|
{
|
|
newWeldReportItem.WME_ID = weldingMethod.WME_ID;
|
|
newWeldReportItem.WME_Name = weldingMethod.WME_Name;
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(jotInfo.JOT_WeldMat))
|
|
{
|
|
var weldMat = BLL.HJGL_ConsumablesService.getConsumablesByConsumablesId(jotInfo.JOT_WeldMat);
|
|
if (weldMat != null)
|
|
{
|
|
newWeldReportItem.JOT_WeldMat = weldMat.WMT_ID;
|
|
newWeldReportItem.WeldMatCode = weldMat.WMT_MatCode;
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(jotInfo.JOT_WeldSilk))
|
|
{
|
|
var weldSilk = BLL.HJGL_ConsumablesService.getConsumablesByConsumablesId(jotInfo.JOT_WeldSilk);
|
|
if (weldSilk != null)
|
|
{
|
|
newWeldReportItem.JOT_WeldSilk = weldSilk.WMT_ID;
|
|
newWeldReportItem.WeldSilkCode = weldSilk.WMT_MatCode;
|
|
}
|
|
}
|
|
returnViewMatch.Add(newWeldReportItem);
|
|
//}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return returnViewMatch;
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 获取未焊接焊口信息
|
|
/// </summary>
|
|
/// <param name="ManagerTotalId"></param>
|
|
/// <returns></returns>
|
|
public static List<Model.HJGL_SpRpWeldReportItem> GetWeldReportItemFind(string projectId, string DReportID, string iso_id)
|
|
{
|
|
List<Model.HJGL_SpRpWeldReportItem> returnViewMatch = new List<Model.HJGL_SpRpWeldReportItem>();
|
|
// 组批条件的字段不能为空
|
|
var jotLists = from x in Funs.DB.HJGL_PW_JointInfo
|
|
join y in Funs.DB.HJGL_PW_IsoInfo on x.ISO_ID equals y.ISO_ID
|
|
where x.InstallationId != null && x.JOTY_ID != null && x.NDTR_ID != null && x.IsSpecial != null
|
|
&& y.ISC_ID != null && y.SER_ID != null && y.STE_ID != null && y.ISO_Executive != null
|
|
&& x.ProjectId == projectId && x.ISO_ID == iso_id
|
|
&& (x.DReportID == null || x.DReportID == DReportID)
|
|
select x;
|
|
|
|
// 预提交焊口
|
|
var pre_JotId = from x in Funs.DB.HJGL_BO_PreWeldReportMain
|
|
join y in Funs.DB.HJGL_PW_JointInfo on x.JOT_ID equals y.JOT_ID
|
|
where x.ProjectId == projectId && y.ISO_ID == iso_id
|
|
select x.JOT_ID;
|
|
if (jotLists.Count() > 0)
|
|
{
|
|
foreach (var item in jotLists)
|
|
{
|
|
if (!pre_JotId.Contains(item.JOT_ID))
|
|
{
|
|
Model.HJGL_SpRpWeldReportItem newWeldReportItem = new Model.HJGL_SpRpWeldReportItem();
|
|
newWeldReportItem.JOT_ID = item.JOT_ID;
|
|
newWeldReportItem.JOT_JointNo = item.JOT_JointNo;
|
|
newWeldReportItem.JOT_JointAttribute = item.JOT_JointAttribute;
|
|
var installation = BLL.Project_InstallationService.GetInstallationByInstallationId(item.InstallationId);
|
|
if (installation != null)
|
|
{
|
|
newWeldReportItem.InstallationName = installation.InstallationName;
|
|
newWeldReportItem.InstallationId = installation.InstallationId;
|
|
}
|
|
if (!string.IsNullOrEmpty(item.STE_ID))//材质
|
|
{
|
|
var ste = BLL.HJGL_MaterialService.GetSteelBySteID(item.STE_ID);
|
|
if (ste != null)
|
|
{
|
|
newWeldReportItem.STE_Code = ste.STE_Code;
|
|
newWeldReportItem.STE_ID = ste.STE_ID;
|
|
}
|
|
}
|
|
newWeldReportItem.JOT_Dia = item.JOT_Dia; //外径
|
|
newWeldReportItem.JOT_Sch = item.JOT_Sch; //壁厚
|
|
if (!string.IsNullOrEmpty(item.JOT_WeldMat))//焊条
|
|
{
|
|
var WeldMat = BLL.HJGL_ConsumablesService.getConsumablesByConsumablesId(item.JOT_WeldMat);
|
|
if (WeldMat != null)
|
|
{
|
|
newWeldReportItem.JOT_WeldMat = WeldMat.WMT_MatCode;
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(item.JOT_WeldSilk))//焊丝
|
|
{
|
|
var WeldSilk = BLL.HJGL_ConsumablesService.getConsumablesByConsumablesId(item.JOT_WeldSilk);
|
|
if (WeldSilk != null)
|
|
{
|
|
newWeldReportItem.JOT_WeldSilk = WeldSilk.WMT_MatCode;
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(item.WME_ID))//焊接方法
|
|
{
|
|
var weldMethod = BLL.HJGL_WeldingMethodService.GetWeldMethodByWMEID(item.WME_ID);
|
|
if (weldMethod != null)
|
|
{
|
|
newWeldReportItem.WME_Name = weldMethod.WME_Name;
|
|
}
|
|
}
|
|
newWeldReportItem.IS_Proess = item.IS_Proess;
|
|
newWeldReportItem.ProessTypes = item.ProessTypes;
|
|
returnViewMatch.Add(newWeldReportItem);
|
|
}
|
|
}
|
|
}
|
|
return returnViewMatch;
|
|
}
|
|
|
|
}
|
|
}
|