566 lines
25 KiB
C#
566 lines
25 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
using Newtonsoft.Json.Linq;
|
|
using System.Web;
|
|
using BLL;
|
|
|
|
namespace FineUIPro.Web.HJGL.CheckManage
|
|
{
|
|
public partial class NoRTCheckManage : PageBase
|
|
{
|
|
#region 加载页面
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
|
|
if (CurrUser.Account == Const.Gly)
|
|
{
|
|
btnModify.Hidden = false;
|
|
}
|
|
this.drpProjectId.DataTextField = "ProjectCode";
|
|
this.drpProjectId.DataValueField = "ProjectId";
|
|
this.drpProjectId.DataSource = BLL.Base_ProjectService.GetOnProjectListByUserId(this.CurrUser.UserId, "1");
|
|
this.drpProjectId.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpProjectId);
|
|
|
|
this.drpNdtType.DataTextField = "NDT_Code";
|
|
this.drpNdtType.DataValueField = "NDT_ID";
|
|
this.drpNdtType.DataSource = BLL.HJGL_TestingService.GetNoRtNDTTypeNameList();
|
|
this.drpNdtType.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpNdtType);
|
|
|
|
this.drpState.DataTextField = "Text";
|
|
this.drpState.DataValueField = "Value";
|
|
this.drpState.DataSource = BLL.DropListService.CheckStatesList();
|
|
this.drpState.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpState);
|
|
|
|
this.InitTreeMenu();//加载树
|
|
this.BindGrid();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 加载树项目
|
|
/// <summary>
|
|
/// 加载树
|
|
/// </summary>
|
|
private void InitTreeMenu()
|
|
{
|
|
this.tvControlItem.Nodes.Clear();
|
|
TreeNode rootNode = new TreeNode();
|
|
rootNode.Text = "项目";
|
|
rootNode.ToolTip = "项目";
|
|
rootNode.NodeID = "0";
|
|
rootNode.Expanded = true;
|
|
this.tvControlItem.Nodes.Add(rootNode);
|
|
|
|
List<Model.Base_Project> projects = BLL.Base_ProjectService.GetOnProjectListByUserId(this.CurrUser.UserId, "1");
|
|
if (this.drpProjectId.SelectedValue != null && this.drpProjectId.SelectedValue != "null")
|
|
{
|
|
projects = projects.Where(e => e.ProjectId == this.drpProjectId.SelectedValue).ToList();
|
|
}
|
|
foreach (var item in projects)
|
|
{
|
|
TreeNode rootProjectNode = new TreeNode();//定义根节点
|
|
rootProjectNode.Text = item.ProjectCode;
|
|
rootProjectNode.NodeID = item.ProjectId;
|
|
rootProjectNode.EnableClickEvent = true;
|
|
rootProjectNode.Expanded = true;
|
|
rootProjectNode.ToolTip = item.ProjectName;
|
|
rootNode.Nodes.Add(rootProjectNode);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 点击TreeView
|
|
/// <summary>
|
|
/// 点击TreeView
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
|
{
|
|
HttpCookie projectCookie = new HttpCookie("SelectedProject");
|
|
projectCookie["projectId"] = tvControlItem.SelectedNodeID;
|
|
projectCookie.Expires = DateTime.Now.AddMonths(1);
|
|
Response.Cookies.Add(projectCookie);
|
|
this.BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 数据绑定
|
|
/// <summary>
|
|
/// 数据绑定
|
|
/// </summary>
|
|
private void BindGrid()
|
|
{
|
|
string projectIds = BLL.Base_ProjectService.GetStrProjectIds(this.CurrUser.UserId, "1");
|
|
|
|
string strSql = @"SELECT trustDetail.CH_TrustItemID,Trust.BatchId,JointInfo.ISO_ID,
|
|
trustDetail.JOT_ID,ndtType.NDT_Code AS NDT,BatchDetail.PointDate,
|
|
(case when BatchDetail.PointType='2' then 'K' else null End) PointType,
|
|
trustDetail.States,BatchDetail.ConfirmDate,BatchDetail.CheckAddress,
|
|
trustDetail.ShootMan,equ.EquipmentName,trustDetail.UnableCheck,trustDetail.UnableCheckReason,
|
|
BatchDetail.IsVI,BatchDetail.Checker,BatchDetail.Remark,trustDetail.FeedbackMan,
|
|
trustDetail.FeedbackDate,Batch.BatchCode,Trust.CH_TrustDate,Unit.UnitName,
|
|
IsoInfo.ISO_IsoNo,JointInfo.JOT_JointNo,Project.ProjectCode,Project.ProjectName,
|
|
JointInfo.Sort1,JointInfo.Sort2,JointInfo.Sort3,JointInfo.Sort4,JointInfo.Sort5,
|
|
(CASE WHEN trustDetail.States='3' OR trustDetail.States='4' then
|
|
(SELECT STUFF(( SELECT ',' + qua.FilmNum FROM dbo.HJGL_BO_QualityRating qua
|
|
WHERE (qua.Remake=1 OR qua.IsPass='不合格') AND qua.CH_TrustItemID=trustDetail.CH_TrustItemID
|
|
ORDER BY qua.FilmNum FOR XML PATH('')), 1, 1, '')) ELSE '' END) AS FilmNums
|
|
FROM dbo.HJGL_CH_TrustItem trustDetail
|
|
LEFT JOIN dbo.HJGL_CH_Trust AS Trust ON Trust.CH_TrustID = trustDetail.CH_TrustID
|
|
LEFT JOIN dbo.HJGL_BO_Batch AS Batch ON Trust.BatchId = Batch.BatchId
|
|
LEFT JOIN dbo.HJGL_BO_BatchDetail BatchDetail ON trustDetail.BatchDetailId = BatchDetail.BatchDetailId
|
|
LEFT JOIN dbo.HJGL_PW_JointInfo AS JointInfo ON JointInfo.JOT_ID = trustDetail.JOT_ID
|
|
LEFT JOIN dbo.HJGL_PW_IsoInfo AS IsoInfo ON IsoInfo.ISO_ID = JointInfo.ISO_ID
|
|
LEFT JOIN dbo.HJGL_BS_NDTType ndtType on ndtType.NDT_ID=Trust.CH_NDTMethod
|
|
LEFT JOIN dbo.HJGL_BS_Equipment AS equ ON equ.EquipmentId = trustDetail.EquipmentId
|
|
LEFT JOIN dbo.Base_Unit AS Unit ON Unit.UnitId = IsoInfo.BSU_ID
|
|
LEFT JOIN dbo.Base_Project AS Project ON Project.ProjectId = Trust.ProjectId
|
|
WHERE Trust.CH_NDTMethod <> '20d2cbca-8b3d-434b-b1c1-181796986fa5' ";
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
|
|
{
|
|
strSql += " AND Trust.ProjectId = @ProjectId";
|
|
listStr.Add(new SqlParameter("@ProjectId", this.tvControlItem.SelectedNodeID));
|
|
}
|
|
else
|
|
{
|
|
if (this.GetCookiesProjectId != string.Empty)
|
|
{
|
|
strSql += " AND Trust.ProjectId = @ProjectId";
|
|
listStr.Add(new SqlParameter("@ProjectId", this.GetCookiesProjectId));
|
|
}
|
|
else
|
|
{
|
|
strSql += " AND Trust.ProjectId = @ProjectId";
|
|
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
|
}
|
|
}
|
|
//else
|
|
//{
|
|
// strSql += " AND CHARINDEX(Trust.ProjectId,@ProjectId)>0 ";
|
|
// listStr.Add(new SqlParameter("@ProjectId", projectIds));
|
|
//}
|
|
|
|
if (!string.IsNullOrEmpty(this.txtBatchCode.Text.Trim()))
|
|
{
|
|
strSql += " AND Batch.BatchCode LIKE @BatchCode";
|
|
listStr.Add(new SqlParameter("@BatchCode", "%" + this.txtBatchCode.Text.Trim() + "%"));
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtIsoNo.Text.Trim()))
|
|
{
|
|
strSql += " AND IsoInfo.ISO_IsoNo LIKE @IsoNo";
|
|
listStr.Add(new SqlParameter("@IsoNo", "%" + this.txtIsoNo.Text.Trim() + "%"));
|
|
}
|
|
if (this.drpNdtType.SelectedValue != "null")
|
|
{
|
|
strSql += " AND Trust.CH_NDTMethod = @NdtType";
|
|
listStr.Add(new SqlParameter("@NdtType", this.drpNdtType.SelectedValue));
|
|
}
|
|
if (this.drpState.SelectedValue != "null")
|
|
{
|
|
strSql += " AND trustDetail.States = @States";
|
|
listStr.Add(new SqlParameter("@States", this.drpState.SelectedValue));
|
|
}
|
|
else
|
|
{
|
|
strSql += " AND trustDetail.States <> '2' ";
|
|
}
|
|
if (this.ckbIsExp.Checked)
|
|
{
|
|
strSql += " AND BatchDetail.PointType = @PointType";
|
|
listStr.Add(new SqlParameter("@PointType", "2"));
|
|
}
|
|
if (this.ckbIsFilm.Checked)
|
|
{
|
|
strSql += " AND (select count(*) from dbo.HJGL_BO_QualityRating qua where qua.CH_TrustItemID =trustDetail.CH_TrustItemID)>0";
|
|
}
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
// 2.获取当前分页数据
|
|
//var table = this.GetPagedDataTable(Grid1, tb1);
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
for (int i = 0; i < this.Grid1.Rows.Count; i++)
|
|
{
|
|
if (string.IsNullOrEmpty(this.Grid1.Rows[i].Values[12].ToString()))
|
|
{
|
|
this.Grid1.Rows[i].Values[12] = this.CurrUser.UserName;
|
|
}
|
|
if (string.IsNullOrEmpty(this.Grid1.Rows[i].Values[14].ToString()))
|
|
{
|
|
this.Grid1.Rows[i].Values[14] = string.Format("{0:yyyy-MM-dd HH:mm}", DateTime.Now);
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 分页排序
|
|
#region 页索引改变事件
|
|
/// <summary>
|
|
/// 页索引改变事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 排序
|
|
/// <summary>
|
|
/// 排序
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 分页选择下拉改变事件
|
|
/// <summary>
|
|
/// 分页选择下拉改变事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
#endregion
|
|
|
|
#region 查询
|
|
///<summary>
|
|
///查询
|
|
///</summary>
|
|
///<param name="sender"></param>
|
|
///<param name="e"></param>
|
|
protected void drpProjectId_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
this.InitTreeMenu();
|
|
}
|
|
|
|
protected void TextBox_TextChanged(object sender, EventArgs e)
|
|
{
|
|
this.BindGrid();
|
|
}
|
|
|
|
protected void drpNdtType_OnSelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
this.BindGrid();
|
|
}
|
|
|
|
protected void drpState_OnSelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
this.BindGrid();
|
|
}
|
|
|
|
protected void ckbIsExp_OnCheckedChanged(object sender, EventArgs e)
|
|
{
|
|
this.BindGrid();
|
|
}
|
|
|
|
protected void ckbIsFilm_OnCheckedChanged(object sender, EventArgs e)
|
|
{
|
|
this.BindGrid();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Grid绑定事件
|
|
/// <summary>
|
|
/// Grid1绑定事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
|
|
{
|
|
string trustItemID = Grid1.DataKeys[e.RowIndex][0].ToString();
|
|
System.Web.UI.WebControls.RadioButtonList cblCheckState = (System.Web.UI.WebControls.RadioButtonList)(this.Grid1.Rows[e.RowIndex].FindControl("cblCheckState"));//检测状态
|
|
|
|
cblCheckState.Items.AddRange(BLL.DropListService.CheckStatesList());
|
|
|
|
var trustDetail = BLL.HJGL_TrustManageEditService.GetCH_TrustItemById(trustItemID);
|
|
var trust = BLL.HJGL_TrustManageEditService.GetCH_TrustByID(trustDetail.CH_TrustID);
|
|
if (trustDetail != null)
|
|
{
|
|
if (!string.IsNullOrEmpty(trustDetail.States))
|
|
{
|
|
for (int i = 0; i < cblCheckState.Items.Count; i++)
|
|
{
|
|
if (cblCheckState.Items[i].Value == trustDetail.States)
|
|
{
|
|
cblCheckState.Items[i].Selected = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
///// <summary>
|
|
///// 关闭弹出窗口
|
|
///// </summary>
|
|
///// <param name="sender"></param>
|
|
///// <param name="e"></param>
|
|
//protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
//{
|
|
// List<string> list = Funs.GetStrListByStr(hdItemsString.Text, '|');
|
|
// this.txtBatchCode.Text = list[0];
|
|
// this.txtIsoNo.Text = list[1];
|
|
// this.drpNdtType.SelectedValue = list[2];
|
|
// this.drpState.SelectedValue = list[3];
|
|
// this.BindGrid();
|
|
// this.hdItemsString.Text = string.Empty;
|
|
//}
|
|
|
|
//#region 质量等级评定
|
|
///// <summary>
|
|
///// 质量等级评定
|
|
///// </summary>
|
|
///// <param name="sender"></param>
|
|
///// <param name="e"></param>
|
|
//protected void btnMenuQualityRating_Click(object sender, EventArgs e)
|
|
//{
|
|
// if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HJGL_CheckMenuId, BLL.Const.BtnSave))
|
|
// {
|
|
// string strList = this.txtBatchCode.Text.Trim() + "|" + this.txtIsoNo.Text.Trim() + "|" + this.drpNdtType.SelectedValue + "|" + this.drpState.SelectedValue;
|
|
// string window = String.Format("QualityRating.aspx?trustItemID={0}&strList={1}", Grid1.SelectedRowID, strList, "编辑 - ");
|
|
// PageContext.RegisterStartupScript(Window1.GetSaveStateReference(hdItemsString.ClientID) + Window1.GetShowReference(window));
|
|
// //PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("QualityRating.aspx?trustItemID={0}", Grid1.SelectedRowID, "编辑 - ")));
|
|
// }
|
|
// else
|
|
// {
|
|
// Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
// }
|
|
//}
|
|
//#endregion
|
|
|
|
//#region 返修通知单
|
|
///// <summary>
|
|
///// 返修通知单
|
|
///// </summary>
|
|
///// <param name="sender"></param>
|
|
///// <param name="e"></param>
|
|
//protected void btnMenuRepairNotice_Click(object sender, EventArgs e)
|
|
//{
|
|
// if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HJGL_CheckMenuId, BLL.Const.BtnSave))
|
|
// {
|
|
// var q = BLL.HJGL_CH_TrustItemService.GetTrustItemByID(Grid1.SelectedRowID);
|
|
// if (q != null && q.States == "4") // 待返修
|
|
// {
|
|
// string strList = this.txtBatchCode.Text.Trim() + "|" + this.txtIsoNo.Text.Trim() + "|" + this.drpNdtType.SelectedValue + "|" + this.drpState.SelectedValue;
|
|
// string window = String.Format("RepairNotice.aspx?trustItemID={0}&strList={1}", Grid1.SelectedRowID, strList, "编辑 - ");
|
|
// PageContext.RegisterStartupScript(Window1.GetSaveStateReference(hdItemsString.ClientID) + Window1.GetShowReference(window));
|
|
// //PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("RepairNotice.aspx?trustItemID={0}", Grid1.SelectedRowID, "编辑 - ")));
|
|
// }
|
|
// else
|
|
// {
|
|
// Alert.ShowInTop("非待返修状态,不能生成返修委托单!", MessageBoxIcon.Warning);
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
// }
|
|
//}
|
|
//#endregion
|
|
|
|
/// <summary>
|
|
/// 提交
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_CheckMenuId, Const.BtnSave))
|
|
{
|
|
JArray MergedData = Grid1.GetMergedData();
|
|
foreach (JObject modifiedRow in MergedData)
|
|
{
|
|
int index = modifiedRow.Value<int>("index");
|
|
JObject values = modifiedRow.Value<JObject>("values");
|
|
string feedbackMan = values.Value<string>("FeedbackMan");
|
|
string feedbackDate = values.Value<string>("FeedbackDate");
|
|
bool unableCheck = Convert.ToBoolean(values.Value<string>("UnableCheck"));
|
|
string unableCheckReason = values.Value<string>("UnableCheckReason");
|
|
|
|
string trustItemId = Grid1.DataKeys[index][0].ToString();
|
|
System.Web.UI.WebControls.RadioButtonList cblCheckState = (System.Web.UI.WebControls.RadioButtonList)(this.Grid1.Rows[index].FindControl("cblCheckState"));//检测状态
|
|
string state = cblCheckState.SelectedValue.Trim();
|
|
Model.HJGL_CH_TrustItem trustItem = BLL.HJGL_CH_TrustItemService.GetTrustItemByID(trustItemId);
|
|
var trust = BLL.HJGL_TrustManageEditService.GetCH_TrustByID(trustItem.CH_TrustID);
|
|
if (state != "1") // 非待检测状态
|
|
{
|
|
if (trustItem.States != "1" && trustItem.States != state) //改变状态,并且原状态非待检测状态
|
|
{
|
|
trustItem.States = state;
|
|
trustItem.FeedbackMan = this.CurrUser.UserName;
|
|
trustItem.FeedbackDate = DateTime.Now;
|
|
}
|
|
else
|
|
{
|
|
trustItem.States = state;
|
|
if (!string.IsNullOrEmpty(feedbackMan))
|
|
{
|
|
trustItem.FeedbackMan = feedbackMan;
|
|
}
|
|
else
|
|
{
|
|
trustItem.FeedbackMan = this.CurrUser.UserName;
|
|
}
|
|
if (!string.IsNullOrEmpty(feedbackDate))
|
|
{
|
|
trustItem.FeedbackDate = Convert.ToDateTime(feedbackDate);
|
|
}
|
|
else
|
|
{
|
|
trustItem.FeedbackDate = DateTime.Now;
|
|
}
|
|
}
|
|
BLL.HJGL_PW_JointInfoService.JointCheckStateWriteBack(trustItem.JOT_ID, trust.CH_NDTMethod, state);
|
|
BLL.HJGL_PW_JointInfoService.JointRTFeedbackDateWriteBack(trustItem.JOT_ID, trust.CH_NDTMethod, trustItem.FeedbackDate);
|
|
}
|
|
else
|
|
{
|
|
if (trustItem.States == "1") //待检测状态,并且原状态也是待检测状态则设为空
|
|
{
|
|
trustItem.FeedbackMan = null;
|
|
trustItem.FeedbackDate = null;
|
|
BLL.HJGL_PW_JointInfoService.JointRTFeedbackDateWriteBack(trustItem.JOT_ID, trust.CH_NDTMethod, null);
|
|
}
|
|
}
|
|
|
|
trustItem.UnableCheck = unableCheck;
|
|
if (!string.IsNullOrEmpty(unableCheckReason))
|
|
{
|
|
trustItem.UnableCheckReason = unableCheckReason;
|
|
}
|
|
BLL.HJGL_CH_TrustItemService.UpdateTrustItem(trustItem);
|
|
}
|
|
|
|
BindGrid();
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改为待检测状态
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnModify_Click(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请选择要修改状态的记录", MessageBoxIcon.Information);
|
|
return;
|
|
}
|
|
string trustItem = Grid1.SelectedRowID;
|
|
var q = BLL.HJGL_CH_TrustItemService.GetTrustItemByID(Grid1.SelectedRowID);
|
|
var trust = BLL.HJGL_TrustManageEditService.GetCH_TrustByID(q.CH_TrustID);
|
|
var qua = from x in Funs.DB.HJGL_BO_QualityRating where x.CH_TrustItemID == trustItem select x;
|
|
var repairRecord= from x in Funs.DB.HJGL_CH_RepairItemRecord where x.TrustItemID == trustItem select x;
|
|
var repair= from x in Funs.DB.HJGL_CH_Repair where x.TrustItemID == trustItem select x;
|
|
if (repairRecord.Count() > 0)
|
|
{
|
|
foreach (var r in repairRecord)
|
|
{
|
|
var repairItem = from x in Funs.DB.HJGL_CH_RepairItem where x.RepairItemRecordId ==r.RepairItemRecordId select x;
|
|
if (repairItem.Count() > 0)
|
|
{
|
|
var quaRepair = from x in Funs.DB.HJGL_BO_QualityRatingRepair where x.CH_RepairItemId == repairItem.First().CH_RepairItemId select x;
|
|
if (quaRepair.Count() > 0)
|
|
{
|
|
Funs.DB.HJGL_BO_QualityRatingRepair.DeleteAllOnSubmit(quaRepair);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
Funs.DB.HJGL_CH_RepairItem.DeleteAllOnSubmit(repairItem);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
if (repair.Count() > 0)
|
|
{
|
|
Funs.DB.HJGL_CH_Repair.DeleteAllOnSubmit(repair);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
if (repairRecord.Count() > 0)
|
|
{
|
|
Funs.DB.HJGL_CH_RepairItemRecord.DeleteAllOnSubmit(repairRecord);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
if (qua.Count() > 0)
|
|
{
|
|
Funs.DB.HJGL_BO_QualityRating.DeleteAllOnSubmit(qua);
|
|
|
|
}
|
|
|
|
q.States = "1";
|
|
Funs.DB.SubmitChanges();
|
|
BLL.HJGL_PW_JointInfoService.JointCheckStateWriteBack(q.JOT_ID, trust.CH_NDTMethod, "1");
|
|
|
|
BindGrid();
|
|
Alert.ShowInTop("已修改为待检测状态!", MessageBoxIcon.Success);
|
|
|
|
}
|
|
|
|
#region 查看质量等级评定
|
|
/// <summary>
|
|
/// 查看质量等级评定
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSee_Click(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请选择一条信息", MessageBoxIcon.Information);
|
|
return;
|
|
}
|
|
string trustItemId = Grid1.SelectedRowID;
|
|
if (!string.IsNullOrEmpty(trustItemId))
|
|
{
|
|
var trustItem = BLL.HJGL_CH_TrustItemService.GetTrustItemByID(trustItemId);
|
|
if (trustItem != null)
|
|
{
|
|
var trust = BLL.HJGL_TrustManageEditService.GetCH_TrustByID(trustItem.CH_TrustID);
|
|
if (trust != null)
|
|
{
|
|
if (!string.IsNullOrEmpty(trust.CH_NDTMethod))
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("QualityRatingView.aspx?trustItemID={0}&ndtType={1}", trustItemId, trust.CH_NDTMethod, "编辑 - ")));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |