198 lines
7.5 KiB
C#
198 lines
7.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// 无损委托
|
|
/// </summary>
|
|
public static class Batch_BatchTrustService
|
|
{
|
|
/// <summary>
|
|
/// 根据主键获取无损委托
|
|
/// </summary>
|
|
/// <param name="batchTrustID"></param>
|
|
/// <returns></returns>
|
|
public static Model.Batch_BatchTrust GetBatchTrustById(string trustBatchId)
|
|
{
|
|
return Funs.DB.Batch_BatchTrust.FirstOrDefault(e => e.TrustBatchId == trustBatchId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键获取无损委托视图
|
|
/// </summary>
|
|
/// <param name="batchTrustID"></param>
|
|
/// <returns></returns>
|
|
public static Model.View_Batch_BatchTrust GetBatchTrustViewById(string trustBatchId)
|
|
{
|
|
return Funs.DB.View_Batch_BatchTrust.FirstOrDefault(e => e.TrustBatchId == trustBatchId);
|
|
}
|
|
|
|
#region 更新委托单 检测状态
|
|
/// <summary>
|
|
/// 更新委托单 检测状态
|
|
/// </summary>
|
|
/// <param name="pointBatchId"></param>
|
|
/// <param name="isTrust"></param>
|
|
public static void UpdatTrustBatchtState(string trustBatchId, bool isCheck)
|
|
{
|
|
Model.HJGLDB db = Funs.DB;
|
|
Model.Batch_BatchTrust update = db.Batch_BatchTrust.FirstOrDefault(e => e.TrustBatchId == trustBatchId);
|
|
if (update != null)
|
|
{
|
|
update.IsCheck = isCheck;
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 添加无损委托
|
|
/// </summary>
|
|
/// <param name="batchTrust"></param>
|
|
public static void AddBatchTrust(Model.Batch_BatchTrust batchTrust)
|
|
{
|
|
Model.HJGLDB db = Funs.DB;
|
|
Model.Batch_BatchTrust newBatchTrust = new Model.Batch_BatchTrust
|
|
{
|
|
TrustBatchId = batchTrust.TrustBatchId,
|
|
TrustBatchCode = batchTrust.TrustBatchCode,
|
|
TrustDate = batchTrust.TrustDate,
|
|
ProjectId = batchTrust.ProjectId,
|
|
UnitId = batchTrust.UnitId,
|
|
InstallationId = batchTrust.InstallationId,
|
|
WorkAreaId = batchTrust.WorkAreaId,
|
|
PipelineId = batchTrust.PipelineId,
|
|
TrustType = batchTrust.TrustType,
|
|
DetectionTypeId = batchTrust.DetectionTypeId,
|
|
IsCheck = batchTrust.IsCheck,
|
|
TopointBatch = batchTrust.TopointBatch
|
|
};
|
|
|
|
db.Batch_BatchTrust.InsertOnSubmit(newBatchTrust);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改无损委托
|
|
/// </summary>
|
|
/// <param name="batchTrust"></param>
|
|
public static void UpdateBatchTrust(Model.Batch_BatchTrust batchTrust)
|
|
{
|
|
Model.HJGLDB db = Funs.DB;
|
|
Model.Batch_BatchTrust newBatchTrust = db.Batch_BatchTrust.FirstOrDefault(e => e.TrustBatchId == batchTrust.TrustBatchId);
|
|
if (newBatchTrust != null)
|
|
{
|
|
newBatchTrust.TrustBatchCode = batchTrust.TrustBatchCode;
|
|
newBatchTrust.TrustDate = batchTrust.TrustDate;
|
|
newBatchTrust.ProjectId = batchTrust.ProjectId;
|
|
newBatchTrust.UnitId = batchTrust.UnitId;
|
|
newBatchTrust.InstallationId = batchTrust.InstallationId;
|
|
newBatchTrust.WorkAreaId = batchTrust.WorkAreaId;
|
|
newBatchTrust.PipelineId = batchTrust.PipelineId;
|
|
newBatchTrust.TrustType = batchTrust.TrustType;
|
|
newBatchTrust.DetectionTypeId = batchTrust.DetectionTypeId;
|
|
newBatchTrust.IsCheck = batchTrust.IsCheck;
|
|
newBatchTrust.TopointBatch = batchTrust.TopointBatch;
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新批委托检测单位
|
|
/// </summary>
|
|
/// <param name="batchTrustId"></param>
|
|
/// <param name="ndeUnit"></param>
|
|
public static void BatchTrustNDEUnit(string batchTrustId, string ndeUnit)
|
|
{
|
|
Model.HJGLDB db = Funs.DB;
|
|
Model.Batch_BatchTrust newBatchTrust = db.Batch_BatchTrust.FirstOrDefault(e => e.TrustBatchId == batchTrustId);
|
|
if (newBatchTrust != null)
|
|
{
|
|
newBatchTrust.NDEUuit = ndeUnit;
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新批委托检测标准
|
|
/// </summary>
|
|
/// <param name="batchTrustId"></param>
|
|
/// <param name="testStandard"></param>
|
|
public static void BatchTrustTestStandard(string batchTrustId, string testStandard)
|
|
{
|
|
Model.HJGLDB db = Funs.DB;
|
|
Model.Batch_BatchTrust newBatchTrust = db.Batch_BatchTrust.FirstOrDefault(e => e.TrustBatchId == batchTrustId);
|
|
if (newBatchTrust != null)
|
|
{
|
|
newBatchTrust.TestStandard = testStandard;
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键删除无损委托
|
|
/// </summary>
|
|
/// <param name="batchTrustID"></param>
|
|
public static void DeleteBatchTrustById(string trustBatchId)
|
|
{
|
|
Model.HJGLDB db = Funs.DB;
|
|
Model.Batch_BatchTrust batchTrust = db.Batch_BatchTrust.FirstOrDefault(e => e.TrustBatchId == trustBatchId);
|
|
if (batchTrust != null)
|
|
{
|
|
db.Batch_BatchTrust.DeleteOnSubmit(batchTrust);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 无损委托委托单编号是否存在
|
|
/// </summary>
|
|
/// <param name="pointNo"></param>
|
|
/// <param name="pointId"></param>
|
|
/// <returns></returns>
|
|
public static bool IsExistTrustCode(string trustBatchCode, string trustBatchId, string projectId)
|
|
{
|
|
var q = Funs.DB.Batch_BatchTrust.FirstOrDefault(x => x.TrustBatchCode == trustBatchCode && x.ProjectId == projectId && x.TrustBatchId != trustBatchId);
|
|
if (q != null)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
#region 委托单下拉项
|
|
/// <summary>
|
|
/// 委托单下拉项
|
|
/// </summary>
|
|
/// <param name="dropName">下拉框名称</param>
|
|
/// <param name="isShowPlease">是否显示请选择</param>
|
|
/// <param name="ComponentsType">耗材类型</param>
|
|
public static void InitTrustBatchDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease, string unitId, string installationId, string detectionTypeId, string pipelineCode, string itemText)
|
|
{
|
|
dropName.DataValueField = "TrustBatchId";
|
|
dropName.DataTextField = "TrustBatchCode";
|
|
|
|
var q = from x in Funs.DB.View_Batch_BatchTrust
|
|
//join y in Funs.DB.Pipeline_Pipeline on x.PipelineId equals y.PipelineId
|
|
where x.UnitId == unitId && x.InstallationId == installationId && x.DetectionTypeId == detectionTypeId
|
|
&& (x.CancelNum==0 || (x.CancelNum>0) &&(x.AllNum> x.CancelNum))
|
|
&& x.CheckTrustBatchId == null
|
|
select x;
|
|
|
|
dropName.DataSource = q;
|
|
dropName.DataBind();
|
|
if (isShowPlease)
|
|
{
|
|
Funs.FineUIPleaseSelect(dropName, itemText);
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|