410 lines
17 KiB
C#
410 lines
17 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_TrustManageEditService
|
||
{
|
||
/// <summary>
|
||
/// 根据委托Id获取用于委托的委托信息
|
||
/// </summary>
|
||
/// <param name="jot_id"></param>
|
||
/// <returns></returns>
|
||
public static Model.HJGL_CH_Trust GetCH_TrustByID(string CH_TrustID)
|
||
{
|
||
Model.SGGLDB db = Funs.DB;
|
||
var view = db.HJGL_CH_Trust.FirstOrDefault(e => e.CH_TrustID == CH_TrustID);
|
||
return view;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据委托Id获取用于委托的焊口视图信息
|
||
/// </summary>
|
||
/// <param name="jot_id"></param>
|
||
/// <returns></returns>
|
||
public static List<Model.HJGL_View_CH_TrustItem> GetView_CH_TrustItemByCH_TrustID(string CH_TrustID)
|
||
{
|
||
Model.SGGLDB db = Funs.DB;
|
||
var view = (from x in db.HJGL_View_CH_TrustItem where x.CH_TrustID == CH_TrustID select x).ToList();
|
||
return view;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据焊口Id获取用于委托的焊口视图信息
|
||
/// </summary>
|
||
/// <param name="jot_id"></param>
|
||
/// <returns></returns>
|
||
public static List<Model.HJGL_CH_TrustItem> GetCH_TrustItemByJOT_ID(string jot_id)
|
||
{
|
||
Model.SGGLDB db = Funs.DB;
|
||
var view = (from x in db.HJGL_CH_TrustItem 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_TrustItem GetCH_TrustItemByJOT_IDAndJotId(string CH_TrustID, string jot_id)
|
||
{
|
||
Model.SGGLDB db = Funs.DB;
|
||
var view = db.HJGL_CH_TrustItem.FirstOrDefault(x => x.CH_TrustID == CH_TrustID && x.JOT_ID == jot_id);
|
||
return view;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据id获取用于委托明细信息
|
||
/// </summary>
|
||
/// <param name="jot_id"></param>
|
||
/// <returns></returns>
|
||
public static Model.HJGL_CH_TrustItem GetCH_TrustItemById(string cH_TrustItemID)
|
||
{
|
||
Model.SGGLDB db = Funs.DB;
|
||
var view = db.HJGL_CH_TrustItem.FirstOrDefault(x => x.CH_TrustItemID == cH_TrustItemID);
|
||
return view;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据委托Id获取用于委托的焊口视图信息
|
||
/// </summary>
|
||
/// <param name="jot_id"></param>
|
||
/// <returns></returns>
|
||
public static List<Model.HJGL_CH_TrustItem> GetCH_TrustItemByCH_TrustID(string CH_TrustID)
|
||
{
|
||
Model.SGGLDB db = Funs.DB;
|
||
var view = (from x in db.HJGL_CH_TrustItem where x.CH_TrustID == CH_TrustID select x).ToList();
|
||
return view;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据焊口Id获取用于委托的焊口信息
|
||
/// </summary>
|
||
/// <param name="jot_id"></param>
|
||
/// <returns></returns>
|
||
public static Model.HJGL_View_CH_TrustItem GetView_CH_TrustItemByJotID(string jot_id, string projectId)
|
||
{
|
||
var view = Funs.DB.HJGL_View_CH_TrustItem.FirstOrDefault(e => e.JOT_ID == jot_id && e.ProjectId == projectId);
|
||
return view;
|
||
}
|
||
public static List<Model.HJGL_View_CH_TrustItem> GetView_CH_TrustItemByProjectId( string projectId)
|
||
{
|
||
var view = Funs.DB.HJGL_View_CH_TrustItem.Where(e => e.ProjectId == projectId).ToList();
|
||
return view;
|
||
}
|
||
/// <summary>
|
||
/// 增加委托信息
|
||
/// </summary>
|
||
/// <param name="cH_Trust">委托实体</param>
|
||
public static void AddCH_Trust(Model.HJGL_CH_Trust cH_Trust)
|
||
{
|
||
Model.SGGLDB db = Funs.DB;
|
||
Model.HJGL_CH_Trust newCH_Trust = new Model.HJGL_CH_Trust();
|
||
newCH_Trust.CH_TrustID = cH_Trust.CH_TrustID;
|
||
newCH_Trust.CH_TrustCode = cH_Trust.CH_TrustCode;
|
||
newCH_Trust.BatchId = cH_Trust.BatchId;
|
||
newCH_Trust.CH_TrustUnit = cH_Trust.CH_TrustUnit;
|
||
newCH_Trust.CH_TrustDate = cH_Trust.CH_TrustDate;
|
||
newCH_Trust.CH_TrustType = cH_Trust.CH_TrustType;
|
||
newCH_Trust.CH_TrustMan = cH_Trust.CH_TrustMan;
|
||
newCH_Trust.CH_Tabler = cH_Trust.CH_Tabler;
|
||
newCH_Trust.CH_TableDate = cH_Trust.CH_TableDate;
|
||
newCH_Trust.CH_UnitName = cH_Trust.CH_UnitName;
|
||
newCH_Trust.CH_WorkNo = cH_Trust.CH_WorkNo;
|
||
newCH_Trust.CH_ItemName = cH_Trust.CH_ItemName;
|
||
newCH_Trust.CH_SlopeType = cH_Trust.CH_SlopeType;
|
||
newCH_Trust.CH_ServiceTemp = cH_Trust.CH_ServiceTemp;
|
||
newCH_Trust.CH_Press = cH_Trust.CH_Press;
|
||
newCH_Trust.CH_WeldMethod = cH_Trust.CH_WeldMethod;
|
||
newCH_Trust.CH_NDTRate = cH_Trust.CH_NDTRate;
|
||
newCH_Trust.CH_NDTMethod = cH_Trust.CH_NDTMethod;
|
||
newCH_Trust.CH_NDTCriteria = cH_Trust.CH_NDTCriteria;
|
||
newCH_Trust.CH_AcceptGrade = cH_Trust.CH_AcceptGrade;
|
||
newCH_Trust.CH_Remark = cH_Trust.CH_Remark;
|
||
newCH_Trust.CH_CheckUnit = cH_Trust.CH_CheckUnit;
|
||
newCH_Trust.ProjectId = cH_Trust.ProjectId;
|
||
newCH_Trust.InstallationId = cH_Trust.InstallationId;
|
||
newCH_Trust.CH_RequestDate = cH_Trust.CH_RequestDate;
|
||
newCH_Trust.RepairItemRecordId = cH_Trust.RepairItemRecordId;
|
||
newCH_Trust.Flag = cH_Trust.Flag;
|
||
newCH_Trust.Record_Printer = cH_Trust.Record_Printer;
|
||
newCH_Trust.Record_PrintDate = cH_Trust.Record_PrintDate;
|
||
db.HJGL_CH_Trust.InsertOnSubmit(newCH_Trust);
|
||
db.SubmitChanges();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 修改焊接信息
|
||
/// </summary>
|
||
/// <param name="weldReport">焊接实体</param>
|
||
public static void UpdateCH_Trust(Model.HJGL_CH_Trust cH_Trust)
|
||
{
|
||
Model.SGGLDB db = Funs.DB;
|
||
Model.HJGL_CH_Trust newCH_Trust = db.HJGL_CH_Trust.FirstOrDefault(e => e.CH_TrustID == cH_Trust.CH_TrustID);
|
||
if (newCH_Trust != null)
|
||
{
|
||
newCH_Trust.CH_TrustID = cH_Trust.CH_TrustID;
|
||
newCH_Trust.CH_TrustCode = cH_Trust.CH_TrustCode;
|
||
newCH_Trust.CH_TrustUnit = cH_Trust.CH_TrustUnit;
|
||
newCH_Trust.CH_TrustDate = cH_Trust.CH_TrustDate;
|
||
newCH_Trust.CH_TrustType = cH_Trust.CH_TrustType;
|
||
newCH_Trust.CH_TrustMan = cH_Trust.CH_TrustMan;
|
||
newCH_Trust.CH_Tabler = cH_Trust.CH_Tabler;
|
||
newCH_Trust.CH_TableDate = cH_Trust.CH_TableDate;
|
||
newCH_Trust.CH_UnitName = cH_Trust.CH_UnitName;
|
||
newCH_Trust.CH_WorkNo = cH_Trust.CH_WorkNo;
|
||
newCH_Trust.CH_ItemName = cH_Trust.CH_ItemName;
|
||
newCH_Trust.CH_SlopeType = cH_Trust.CH_SlopeType;
|
||
newCH_Trust.CH_ServiceTemp = cH_Trust.CH_ServiceTemp;
|
||
newCH_Trust.CH_Press = cH_Trust.CH_Press;
|
||
newCH_Trust.CH_WeldMethod = cH_Trust.CH_WeldMethod;
|
||
newCH_Trust.CH_NDTRate = cH_Trust.CH_NDTRate;
|
||
newCH_Trust.CH_NDTMethod = cH_Trust.CH_NDTMethod;
|
||
newCH_Trust.CH_NDTCriteria = cH_Trust.CH_NDTCriteria;
|
||
newCH_Trust.CH_AcceptGrade = cH_Trust.CH_AcceptGrade;
|
||
newCH_Trust.CH_Remark = cH_Trust.CH_Remark;
|
||
newCH_Trust.CH_CheckUnit = cH_Trust.CH_CheckUnit;
|
||
newCH_Trust.ProjectId = cH_Trust.ProjectId;
|
||
newCH_Trust.InstallationId = cH_Trust.InstallationId;
|
||
newCH_Trust.CH_RequestDate = cH_Trust.CH_RequestDate;
|
||
newCH_Trust.Record_Printer = cH_Trust.Record_Printer;
|
||
newCH_Trust.Record_PrintDate = cH_Trust.Record_PrintDate;
|
||
newCH_Trust.ReRecord_Printer = cH_Trust.ReRecord_Printer;
|
||
newCH_Trust.ReRecord_PrintDate = cH_Trust.ReRecord_PrintDate;
|
||
db.SubmitChanges();
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据主键删除委托信息
|
||
/// </summary>
|
||
/// <param name="cH_TrustID">委托主键</param>
|
||
public static void DeleteCH_TrustByCH_TrustID(string cH_TrustID)
|
||
{
|
||
Model.SGGLDB db = Funs.DB;
|
||
Model.HJGL_CH_Trust cH_Trust = db.HJGL_CH_Trust.FirstOrDefault(e => e.CH_TrustID == cH_TrustID);
|
||
if (cH_Trust != null)
|
||
{
|
||
db.HJGL_CH_Trust.DeleteOnSubmit(cH_Trust);
|
||
db.SubmitChanges();
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据主键删除委托信息明细
|
||
/// </summary>
|
||
/// <param name="cH_TrustID">委托主键</param>
|
||
public static void DeleteCH_TrustItemByCH_TrustID(string cH_TrustID)
|
||
{
|
||
Model.SGGLDB db = Funs.DB;
|
||
var cH_Trust = from x in db.HJGL_CH_TrustItem where x.CH_TrustID == cH_TrustID select x;
|
||
if (cH_Trust != null)
|
||
{
|
||
//foreach (var item in cH_Trust)
|
||
//{
|
||
// var jo = Funs.DB.HJGL_PW_JointInfo.FirstOrDefault(x => x.JOT_ID == item.JOT_ID);
|
||
// jo.JOT_TrustFlag = "00";
|
||
// BLL.HJGL_PW_JointInfoService.UpdateJointInfo(jo);
|
||
// if (jo != null && jo.JOT_JointStatus == "102")
|
||
// {
|
||
// var ch = Funs.DB.HJGL_CH_CheckItem.FirstOrDefault(x => x.JOT_ID == jo.JOT_ID);
|
||
// if (ch == null)
|
||
// {
|
||
// jo.JOT_JointStatus = "100";
|
||
// BLL.HJGL_PW_JointInfoService.UpdateJointPoint(jo);
|
||
// }
|
||
// }
|
||
//}
|
||
|
||
db.HJGL_CH_TrustItem.DeleteAllOnSubmit(cH_Trust);
|
||
db.SubmitChanges();
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 增加委托信息明细
|
||
/// </summary>
|
||
/// <param name="trustItem">委托明细实体</param>
|
||
public static void AddCH_TrustItem(Model.HJGL_CH_TrustItem trustItem)
|
||
{
|
||
Model.SGGLDB db = Funs.DB;
|
||
Model.HJGL_CH_TrustItem newTrustItem = new Model.HJGL_CH_TrustItem();
|
||
newTrustItem.CH_TrustItemID = SQLHelper.GetNewID(typeof(Model.HJGL_CH_TrustItem));
|
||
newTrustItem.CH_TrustID = trustItem.CH_TrustID;
|
||
newTrustItem.JOT_ID = trustItem.JOT_ID;
|
||
newTrustItem.BatchDetailId = trustItem.BatchDetailId;
|
||
newTrustItem.States = trustItem.States;
|
||
newTrustItem.CHT_CheckItemId = trustItem.CHT_CheckItemId;
|
||
newTrustItem.CH_Remark = trustItem.CH_Remark;
|
||
db.HJGL_CH_TrustItem.InsertOnSubmit(newTrustItem);
|
||
db.SubmitChanges();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 委托单打印信息修改
|
||
/// </summary>
|
||
/// <param name="cH_Trust"></param>
|
||
public static void PrintCH_Trust(Model.HJGL_CH_Trust cH_Trust)
|
||
{
|
||
Model.SGGLDB db = Funs.DB;
|
||
Model.HJGL_CH_Trust newCH_Trust = db.HJGL_CH_Trust.FirstOrDefault(e => e.CH_TrustID == cH_Trust.CH_TrustID);
|
||
if (newCH_Trust != null)
|
||
{
|
||
newCH_Trust.CH_Printer = cH_Trust.CH_Printer;
|
||
newCH_Trust.CH_PrintDate = cH_Trust.CH_PrintDate;
|
||
db.SubmitChanges();
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 审核委托信息
|
||
/// </summary>
|
||
/// <param name="weldReport">焊接实体</param>
|
||
public static void AuditCH_Trust(Model.HJGL_CH_Trust cH_Trust)
|
||
{
|
||
Model.SGGLDB db = Funs.DB;
|
||
Model.HJGL_CH_Trust newCH_Trust = db.HJGL_CH_Trust.FirstOrDefault(e => e.CH_TrustID == cH_Trust.CH_TrustID);
|
||
if (newCH_Trust != null)
|
||
{
|
||
newCH_Trust.CH_TrustID = cH_Trust.CH_TrustID;
|
||
newCH_Trust.CH_AuditMan = cH_Trust.CH_AuditMan;
|
||
newCH_Trust.CH_AuditDate = cH_Trust.CH_AuditDate;
|
||
db.SubmitChanges();
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 合格等级下拉列表值
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public static ListItem[] GetAcceptGradeList()
|
||
{
|
||
ListItem[] list = new ListItem[5];
|
||
list[0] = new ListItem("Ⅰ", "1");
|
||
list[1] = new ListItem("Ⅱ", "2");
|
||
list[2] = new ListItem("Ⅲ", "3");
|
||
list[3] = new ListItem("Ⅳ", "4");
|
||
list[4] = new ListItem("Ⅴ", "5");
|
||
return list;
|
||
}
|
||
|
||
/// <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>
|
||
/// 根据装置Id获取委托数
|
||
/// </summary>
|
||
/// <param name="installationId"></param>
|
||
/// <returns></returns>
|
||
public static int GetTrustByInstallationId(string installationId)
|
||
{
|
||
var q = (from x in Funs.DB.HJGL_CH_Trust where x.InstallationId == installationId select x).ToList();
|
||
return q.Count();
|
||
}
|
||
|
||
/// <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_Trust.FirstOrDefault(x => x.CH_TrustCode == trustCode && x.ProjectId == projectId && x.CH_TrustID != trustID);
|
||
if (q != null)
|
||
{
|
||
return true;
|
||
}
|
||
else
|
||
{
|
||
return false;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据批Id获取委托信息
|
||
/// </summary>
|
||
/// <param name="projectId"></param>
|
||
/// <param name="batchId"></param>
|
||
/// <returns></returns>
|
||
public static Model.HJGL_CH_Trust GetTrustByBatchId(string batchId)
|
||
{
|
||
return Funs.DB.HJGL_CH_Trust.FirstOrDefault(e => e.BatchId == batchId);
|
||
}
|
||
|
||
public static List<Model.HJGL_View_ReCheckRecordPrint> GetReCheckRecordByProjectId(string projectId)
|
||
{
|
||
return (from x in Funs.DB.HJGL_View_ReCheckRecordPrint where x.ReRecord_PrintDate == null && x.ProjectId == projectId select x).ToList();
|
||
}
|
||
}
|
||
}
|