This commit is contained in:
2024-05-08 17:17:11 +08:00
parent 0696f555b2
commit 2f1fca4df2
4528 changed files with 635638 additions and 0 deletions
@@ -0,0 +1,353 @@
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_HardTestReportService
{
/// <summary>
/// 根据硬度检测报告Id获取用于硬度检测报告的硬度检测报告信息
/// </summary>
/// <param name="jot_id"></param>
/// <returns></returns>
public static Model.HJGL_CH_HardTestReport GetCH_HardTestReportByID(string hardTestReportId)
{
Model.SGGLDB db = Funs.DB;
var view = db.HJGL_CH_HardTestReport.FirstOrDefault(e => e.HardTestReportId == hardTestReportId);
return view;
}
/// <summary>
/// 根据硬度检测报告明细Id获取用于硬度检测报告的硬度检测报告明细信息
/// </summary>
/// <param name="jot_id"></param>
/// <returns></returns>
public static Model.HJGL_CH_HardTestReportItem GetCH_HardTestReportItemByID(string hardTestReportItemId)
{
Model.SGGLDB db = Funs.DB;
var view = db.HJGL_CH_HardTestReportItem.FirstOrDefault(e => e.HardTestReportItemId == hardTestReportItemId);
return view;
}
/// <summary>
/// 根据硬度检测报告明细Id获取用于硬度检测报告的硬度检测报告明细信息
/// </summary>
/// <param name="jot_id"></param>
/// <returns></returns>
public static Model.HJGL_View_CH_HardTestReportItem GetViewHardTestReportItemByID(string hardTestReportItemId)
{
Model.SGGLDB db = Funs.DB;
var view = db.HJGL_View_CH_HardTestReportItem.FirstOrDefault(e => e.HardTestReportItemId == hardTestReportItemId);
return view;
}
/// <summary>
/// 根据管线Id获取编号信息
/// </summary>
/// <param name="iso_id"></param>
/// <returns></returns>
public static string GetHardTestReportCodeByISO_ID(string iso_Id, DateTime date)
{
string reportCode = string.Empty;
Model.SGGLDB db = Funs.DB;
var report = (from x in db.HJGL_CH_HardTestReport where x.ISO_ID == iso_Id orderby x.HotHardCode descending select x).FirstOrDefault();
if (report != null)
{
if (!report.HardTestReportCode.Contains("续表"))
{
reportCode = report.HardTestReportCode + "续表1";
}
else
{
string oldPartCode = report.HardTestReportCode.Substring(report.HardTestReportCode.IndexOf("表") + 1);
int num = Funs.GetNewIntOrZero(oldPartCode);
string newNum = (num + 1).ToString();
reportCode = report.HardTestReportCode.Substring(0, report.HardTestReportCode.IndexOf("表") + 1) + newNum;
}
}
else
{
var dayReports = (from x in db.HJGL_CH_HardTestReport where x.TestDate.Value.Date == date.Date orderby x.TestDate select x).ToList();
if (dayReports.Count() == 0)
{
reportCode = "C" + string.Format("{0:yyyyMMdd}", date) + "-1";
}
else
{
var dateDayReports = (from x in db.HJGL_CH_HardTestReport where x.HardTestReportCode.Contains(string.Format("{0:yyyyMMdd}", date)) && !x.HardTestReportCode.Contains("续表") orderby x.TestDate descending select x).ToList();
if (dateDayReports.Count == 0) //编号包含当天字符串的记录为空无记录
{
reportCode = "C" + string.Format("{0:yyyyMMdd}", date) + "-1";
}
else //不为空记录时,去除编号中的续表字段后,排序取得最大编号-N,再+1即为返回值
{
string hardTestReportCode = dateDayReports.First().HardTestReportCode;
if (hardTestReportCode.Contains("续表"))
{
hardTestReportCode = hardTestReportCode.Substring(0, hardTestReportCode.IndexOf("续"));
}
string oldPartCode = hardTestReportCode.Substring(hardTestReportCode.IndexOf("-") + 1);
int num = Funs.GetNewIntOrZero(oldPartCode);
string newNum = (num + 1).ToString();
reportCode = hardTestReportCode.Substring(0, hardTestReportCode.IndexOf("-") + 1) + newNum;
}
}
}
return reportCode;
}
/// <summary>
/// 根据硬度检测报告Id获取用于硬度检测报告的焊口视图信息
/// </summary>
/// <param name="jot_id"></param>
/// <returns></returns>
public static List<Model.HJGL_View_CH_HardTestReportItem> GetView_CH_HardTestReportItemByCH_HardTestReportID(string hardTestReportId)
{
Model.SGGLDB db = Funs.DB;
var view = (from x in db.HJGL_View_CH_HardTestReportItem where x.HardTestReportId == hardTestReportId select x).ToList();
return view;
}
/// <summary>
/// 根据焊口Id获取硬度检测报告明细信息
/// </summary>
/// <param name="jot_id"></param>
/// <returns></returns>
public static Model.HJGL_CH_HardTestReportItem GetHardTestReportItemByJotIDAndHotProessTrustId(string jot_id, string hotProessTrustId)
{
var view = Funs.DB.HJGL_CH_HardTestReportItem.FirstOrDefault(e => e.JOT_ID == jot_id && e.HotProessTrustId == hotProessTrustId);
return view;
}
/// <summary>
/// 根据焊口Id获取用于硬度检测报告的焊口视图信息
/// </summary>
/// <param name="jot_id"></param>
/// <returns></returns>
public static List<Model.HJGL_CH_HardTestReportItem> GetCH_HardTestReportItemByJOT_ID(string jot_id)
{
Model.SGGLDB db = Funs.DB;
var view = (from x in db.HJGL_CH_HardTestReportItem 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_HardTestReportItem GetCH_HardTestReportItemByJOT_IDAndJotId(string hardTestReportId, string jot_id)
{
Model.SGGLDB db = Funs.DB;
var view = db.HJGL_CH_HardTestReportItem.FirstOrDefault(x => x.HardTestReportId == hardTestReportId && x.JOT_ID == jot_id);
return view;
}
/// <summary>
/// 根据硬度检测报告Id获取用于硬度检测报告的焊口视图信息
/// </summary>
/// <param name="jot_id"></param>
/// <returns></returns>
public static List<Model.HJGL_CH_HardTestReportItem> GetCH_HardTestReportItemByHotProessTrustID(string hardTestReportId)
{
Model.SGGLDB db = Funs.DB;
var view = (from x in db.HJGL_CH_HardTestReportItem where x.HardTestReportId == hardTestReportId select x).ToList();
return view;
}
/// <summary>
/// 根据焊口Id获取用于硬度检测报告的焊口信息
/// </summary>
/// <param name="jot_id"></param>
/// <returns></returns>
public static Model.HJGL_View_CH_HardTestReportItem GetView_CH_HardTestReportItemByJotID(string jot_id, string projectId)
{
var view = Funs.DB.HJGL_View_CH_HardTestReportItem.FirstOrDefault(e => e.JOT_ID == jot_id && e.ProjectId == projectId);
return view;
}
/// <summary>
/// 增加硬度检测报告信息
/// </summary>
/// <param name="cH_Trust">硬度检测报告实体</param>
public static void AddCH_HardTestReport(Model.HJGL_CH_HardTestReport cH_Trust)
{
Model.SGGLDB db = Funs.DB;
Model.HJGL_CH_HardTestReport newCH_HardTestReport = new Model.HJGL_CH_HardTestReport();
newCH_HardTestReport.HardTestReportId = cH_Trust.HardTestReportId;
newCH_HardTestReport.HardTestReportCode = cH_Trust.HardTestReportCode;
newCH_HardTestReport.ProjectId = cH_Trust.ProjectId;
newCH_HardTestReport.ISO_ID = cH_Trust.ISO_ID;
newCH_HardTestReport.TrustUnitId = cH_Trust.TrustUnitId;
newCH_HardTestReport.TestDate = cH_Trust.TestDate;
newCH_HardTestReport.InstrumentType = cH_Trust.InstrumentType;
newCH_HardTestReport.EquipmentId = cH_Trust.EquipmentId;
newCH_HardTestReport.TestStandard = cH_Trust.TestStandard;
newCH_HardTestReport.AuditMan = cH_Trust.AuditMan;
newCH_HardTestReport.TestMan = cH_Trust.TestMan;
newCH_HardTestReport.HotHardCode = cH_Trust.HotHardCode;
newCH_HardTestReport.ContractUnit = cH_Trust.ContractUnit;
newCH_HardTestReport.HotProessState = cH_Trust.HotProessState;
newCH_HardTestReport.SurfaceAppearance = cH_Trust.SurfaceAppearance;
newCH_HardTestReport.TestMethod = cH_Trust.TestMethod;
newCH_HardTestReport.MaterialStandard = cH_Trust.MaterialStandard;
newCH_HardTestReport.TestRate = cH_Trust.TestRate;
newCH_HardTestReport.TestCount = cH_Trust.TestCount;
newCH_HardTestReport.STE_ID = cH_Trust.STE_ID;
newCH_HardTestReport.FileType = cH_Trust.FileType;
db.HJGL_CH_HardTestReport.InsertOnSubmit(newCH_HardTestReport);
db.SubmitChanges();
}
/// <summary>
/// 修改焊接信息
/// </summary>
/// <param name="weldReport">焊接实体</param>
public static void UpdateCH_HardTestReport(Model.HJGL_CH_HardTestReport cH_Trust)
{
Model.SGGLDB db = Funs.DB;
Model.HJGL_CH_HardTestReport newCH_HardTestReport = db.HJGL_CH_HardTestReport.FirstOrDefault(e => e.HardTestReportId == cH_Trust.HardTestReportId);
if (newCH_HardTestReport != null)
{
newCH_HardTestReport.ISO_ID = cH_Trust.ISO_ID;
newCH_HardTestReport.TrustUnitId = cH_Trust.TrustUnitId;
newCH_HardTestReport.InstrumentType = cH_Trust.InstrumentType;
newCH_HardTestReport.EquipmentId = cH_Trust.EquipmentId;
newCH_HardTestReport.TestStandard = cH_Trust.TestStandard;
newCH_HardTestReport.AuditMan = cH_Trust.AuditMan;
newCH_HardTestReport.TestMan = cH_Trust.TestMan;
newCH_HardTestReport.IsPrintTrust = cH_Trust.IsPrintTrust;
newCH_HardTestReport.IsPrintReport = cH_Trust.IsPrintReport;
newCH_HardTestReport.PrintTrustDate = cH_Trust.PrintTrustDate;
newCH_HardTestReport.PrintReportDate = cH_Trust.PrintReportDate;
newCH_HardTestReport.HotHardCode = cH_Trust.HotHardCode;
newCH_HardTestReport.ContractUnit = cH_Trust.ContractUnit;
newCH_HardTestReport.HotProessState = cH_Trust.HotProessState;
newCH_HardTestReport.SurfaceAppearance = cH_Trust.SurfaceAppearance;
newCH_HardTestReport.TestMethod = cH_Trust.TestMethod;
newCH_HardTestReport.MaterialStandard = cH_Trust.MaterialStandard;
newCH_HardTestReport.TestRate = cH_Trust.TestRate;
newCH_HardTestReport.TestCount = cH_Trust.TestCount;
newCH_HardTestReport.STE_ID = cH_Trust.STE_ID;
newCH_HardTestReport.TrustName = cH_Trust.TrustName;
newCH_HardTestReport.ReportName = cH_Trust.ReportName;
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除硬度检测报告信息
/// </summary>
/// <param name="hardTestReportId">硬度检测报告主键</param>
public static void DeleteCH_HardTestReportByCH_HardTestReportID(string hardTestReportId)
{
Model.SGGLDB db = Funs.DB;
Model.HJGL_CH_HardTestReport cH_Trust = db.HJGL_CH_HardTestReport.FirstOrDefault(e => e.HardTestReportId == hardTestReportId);
if (cH_Trust != null)
{
db.HJGL_CH_HardTestReport.DeleteOnSubmit(cH_Trust);
db.SubmitChanges();
}
}
public static void DeleteCH_HardTestReportItem(string hardTestReportItemId)
{
Model.SGGLDB db = Funs.DB;
Model.HJGL_CH_HardTestReportItem reportItem = db.HJGL_CH_HardTestReportItem.FirstOrDefault(e => e.HardTestReportItemId == hardTestReportItemId);
if (reportItem != null)
{
db.HJGL_CH_HardTestReportItem.DeleteOnSubmit(reportItem);
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除硬度检测报告信息明细
/// </summary>
/// <param name="cH_TrustID">硬度检测报告主键</param>
public static void DeleteCH_HardTestReportItemByCH_HardTestReportID(string hotProessTrustId)
{
Model.SGGLDB db = Funs.DB;
var cH_Trust = from x in db.HJGL_CH_HardTestReportItem where x.HardTestReportId == hotProessTrustId select x;
if (cH_Trust != null)
{
foreach (var item in cH_Trust)
{
//回写焊口硬度委托时间
BLL.HJGL_PW_JointInfoService.WriteBackHardTrustDate(item.JOT_ID, null);
}
db.HJGL_CH_HardTestReportItem.DeleteAllOnSubmit(cH_Trust);
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除硬度检测报告信息明细
/// </summary>
/// <param name="cH_TrustID">硬度检测报告主键</param>
public static void DeleteCH_HardTestReportItemByHotProessTrustId(string hotProessTrustId, string jot_id)
{
Model.SGGLDB db = Funs.DB;
var cH_Trust = from x in db.HJGL_CH_HardTestReportItem where x.HotProessTrustId == hotProessTrustId && x.JOT_ID == jot_id select x;
if (cH_Trust != null)
{
foreach (var item in cH_Trust)
{
//回写焊口硬度委托时间
BLL.HJGL_PW_JointInfoService.WriteBackHardTrustDate(item.JOT_ID, null);
}
db.HJGL_CH_HardTestReportItem.DeleteAllOnSubmit(cH_Trust);
db.SubmitChanges();
}
}
/// <summary>
/// 增加硬度检测报告信息明细
/// </summary>
/// <param name="trustItem">硬度检测报告明细实体</param>
public static void AddCH_HardTestReportItem(Model.HJGL_CH_HardTestReportItem trustItem)
{
Model.SGGLDB db = Funs.DB;
Model.HJGL_CH_HardTestReportItem newTrustItem = new Model.HJGL_CH_HardTestReportItem();
newTrustItem.HardTestReportItemId = trustItem.HardTestReportItemId;
newTrustItem.HardTestReportId = trustItem.HardTestReportId;
newTrustItem.JOT_ID = trustItem.JOT_ID;
newTrustItem.TestPart = trustItem.TestPart;
newTrustItem.HardNessValue = trustItem.HardNessValue;
newTrustItem.Remark = trustItem.Remark;
newTrustItem.SortIndex = trustItem.SortIndex;
newTrustItem.HotProessTrustId = trustItem.HotProessTrustId;
newTrustItem.Flag = trustItem.Flag;
newTrustItem.IsShow = trustItem.IsShow;
db.HJGL_CH_HardTestReportItem.InsertOnSubmit(newTrustItem);
db.SubmitChanges();
}
/// <summary>
/// 更新硬度检测报告信息明细
/// </summary>
/// <param name="trustItem">硬度检测报告明细实体</param>
public static void UpdateCH_HardTestReportItem(Model.HJGL_CH_HardTestReportItem trustItem)
{
Model.SGGLDB db = Funs.DB;
Model.HJGL_CH_HardTestReportItem newItem = db.HJGL_CH_HardTestReportItem.FirstOrDefault(e => e.HardTestReportItemId == trustItem.HardTestReportItemId);
if (newItem != null)
{
newItem.HardTestReportId = trustItem.HardTestReportId;
newItem.HardNessValue = trustItem.HardNessValue;
newItem.Remark = trustItem.Remark;
newItem.Flag = trustItem.Flag;
newItem.NewFlag = trustItem.NewFlag;
db.SubmitChanges();
}
}
}
}
@@ -0,0 +1,113 @@
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_HardTestResultService
{
/// <summary>
/// 根据硬度检验Id获取用于硬度检验结果反馈
/// </summary>
/// <param name="jot_id"></param>
/// <returns></returns>
public static Model.HJGL_CH_HardTestResult GetHardTestResultByID(string HardTestResultId)
{
Model.SGGLDB db = Funs.DB;
var view = db.HJGL_CH_HardTestResult.FirstOrDefault(e => e.HardTestResultId == HardTestResultId);
return view;
}
/// <summary>
/// 根据硬度检验委托Id和焊口id获取用于硬度检验结果反馈
/// </summary>
/// <param name="jot_id"></param>
/// <returns></returns>
public static Model.HJGL_CH_HardTestResult GetHardTestResultByHardTestReportIdAndJotID(string hardTestReportId, string jot_id)
{
Model.SGGLDB db = Funs.DB;
var view = db.HJGL_CH_HardTestResult.FirstOrDefault(e => e.HardTestReportId == hardTestReportId && e.JOT_ID == jot_id);
return view;
}
/// <summary>
/// 增加硬度检验结果反馈
/// </summary>
/// <param name="hotProess">硬度检验实体</param>
public static void AddHardTestResult(Model.HJGL_CH_HardTestResult hotProess)
{
Model.SGGLDB db = Funs.DB;
Model.HJGL_CH_HardTestResult newTestPackage = new Model.HJGL_CH_HardTestResult();
newTestPackage.HardTestResultId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HardTestResult));
newTestPackage.HardTestReportId = hotProess.HardTestReportId;
newTestPackage.JOT_ID = hotProess.JOT_ID;
newTestPackage.IsOK = hotProess.IsOK;
newTestPackage.ResultDate = hotProess.ResultDate;
newTestPackage.CannotCheck = hotProess.CannotCheck;
newTestPackage.Remark = hotProess.Remark;
db.HJGL_CH_HardTestResult.InsertOnSubmit(newTestPackage);
db.SubmitChanges();
}
/// <summary>
/// 修改硬度检验结果反馈
/// </summary>
/// <param name="weldReport">硬度检验实体</param>
public static void UpdateHardTestResult(Model.HJGL_CH_HardTestResult hotProess)
{
Model.SGGLDB db = Funs.DB;
Model.HJGL_CH_HardTestResult newTestPackage = db.HJGL_CH_HardTestResult.FirstOrDefault(e => e.HardTestResultId == hotProess.HardTestResultId);
if (newTestPackage != null)
{
newTestPackage.JOT_ID = hotProess.JOT_ID;
newTestPackage.IsOK = hotProess.IsOK;
newTestPackage.ResultDate = hotProess.ResultDate;
newTestPackage.CannotCheck = hotProess.CannotCheck;
newTestPackage.Remark = hotProess.Remark;
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除硬度检验结果反馈
/// </summary>
/// <param name="hotProessID">硬度检验主键</param>
public static void DeleteHardTestResultByHardTestResultID(string hotProessResultId)
{
Model.SGGLDB db = Funs.DB;
Model.HJGL_CH_HardTestResult hotProess = db.HJGL_CH_HardTestResult.FirstOrDefault(e => e.HardTestResultId == hotProessResultId);
if (hotProess != null)
{
db.HJGL_CH_HardTestResult.DeleteOnSubmit(hotProess);
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除硬度检验结果反馈明细
/// </summary>
/// <param name="hotProessID">硬度检验主键</param>
public static void DeleteHardTestResultsyHardTestReportId(string HardTestReportId)
{
Model.SGGLDB db = Funs.DB;
var items = from x in db.HJGL_CH_HardTestResult where x.HardTestReportId == HardTestReportId select x;
if (items != null)
{
foreach (var item in items)
{
//回写硬度合格及反馈时间
BLL.HJGL_PW_JointInfoService.WriteBackHardTestResultOKAndDate(item.JOT_ID, null);
if (item.IsOK == null && item.CannotCheck == null && string.IsNullOrEmpty(item.Remark) && item.ResultDate == null)
{
db.HJGL_CH_HardTestResult.DeleteOnSubmit(item);
db.SubmitChanges();
}
}
}
}
}
}