Files
SGGL_SHJ/SGGL/FineUIPro.Web/HJGL/PointTrust/TrustWeldJointAdjust.aspx.cs
T
lpf 443ae01d22 feat(hjgl): 完善委托焊口调整和返修扩透
支持调整委托焊口和退回委托,完善返修扩透操作,并更新对应页面资源。
2026-12-01 09:34:22 +08:00

94 lines
4.1 KiB
C#

using BLL;
using System;
using System.Data;
using System.Linq;
namespace FineUIPro.Web.HJGL.PointTrust
{
public partial class TrustWeldJointAdjust : PageBase
{
private string TrustBatchId
{
get { return (string)ViewState["TrustBatchId"]; }
set { ViewState["TrustBatchId"] = value; }
}
protected void Page_Load(object sender, EventArgs e)
{
Title = UiText.Get("T_焊口调整");
try
{
if (!CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId,
Const.HJGL_TrustBatchMenuId, Const.BtnGenerate))
{
btnSave.Enabled = false;
Alert.ShowInTop(UiText.Message("您没有调整委托焊口的权限!"), MessageBoxIcon.Warning);
return;
}
if (!IsPostBack)
{
TrustBatchId = Request.QueryString["TrustBatchId"];
using (var db = new Model.SGGLDB(Funs.ConnString))
{
var trust = db.HJGL_Batch_BatchTrust.FirstOrDefault(x =>
x.TrustBatchId == TrustBatchId && x.ProjectId == this.CurrUser.LoginProjectId);
if (trust == null)
{
btnSave.Enabled = false;
Alert.ShowInTop(UiText.Message("委托单不存在或不属于当前项目!"), MessageBoxIcon.Warning);
return;
}
if (trust.PointBatchId == null || trust.TrustType == "R")
{
btnSave.Enabled = false;
Alert.ShowInTop(UiText.Message("焊口调整仅适用于检验批委托单,返修委托请使用返修扩透流程!"), MessageBoxIcon.Warning);
return;
}
txtTrustBatchCode.Text = trust.TrustBatchCode;
}
DataTable items = Batch_BatchTrustItemService.GetTrustAdjustmentItems(this.CurrUser.LoginProjectId, TrustBatchId);
var currentItems = items.AsEnumerable().Where(x => !x.IsNull("TrustBatchItemId")).ToList();
ViewState["OriginalTrustBatchItemIds"] = currentItems.Select(x => x.Field<string>("TrustBatchItemId")).ToArray();
foreach (DataRow item in items.Rows)
{
item["ItemState"] = UiText.Message(item.Field<string>("ItemState"));
item["AdjustmentState"] = UiText.Message(item.Field<string>("AdjustmentState"));
}
Grid1.RecordCount = items.Rows.Count;
Grid1.DataSource = items;
Grid1.DataBind();
Grid1.SelectedRowIDArray = currentItems.Select(x => x.Field<string>("PointBatchItemId")).ToArray();
}
}
catch (Exception ex)
{
btnSave.Enabled = false;
Alert.ShowInTop(UiText.Message("加载焊口调整失败:" + ex.Message), MessageBoxIcon.Warning);
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
if (!btnSave.Enabled)
{
return;
}
try
{
string message = Batch_BatchTrustItemService.SaveAdjustedTrustItems(this.CurrUser.LoginProjectId, TrustBatchId,
Grid1.SelectedRowIDArray, (string[])ViewState["OriginalTrustBatchItemIds"]);
if (!string.IsNullOrEmpty(message))
{
Alert.ShowInTop(UiText.Message(message), MessageBoxIcon.Warning);
return;
}
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
catch (Exception ex)
{
Alert.ShowInTop(UiText.Message("保存焊口调整失败:" + ex.Message), MessageBoxIcon.Warning);
}
}
}
}