135 lines
5.8 KiB
C#
135 lines
5.8 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Web;
|
|||
|
using System.Web.UI;
|
|||
|
using System.Web.UI.WebControls;
|
|||
|
using BLL;
|
|||
|
|
|||
|
namespace FineUIPro.Web.WeldingProcess.TrustManage
|
|||
|
{
|
|||
|
public partial class RTTrustReplace : PageBase
|
|||
|
{
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
LoadData();
|
|||
|
BLL.Base_DetectionTypeService.InitDetectionType(drpRtReplace, Resources.Lan.PleaseSelect, true);
|
|||
|
string batchTrustItemId = Request.Params["BatchTrustItemId"];
|
|||
|
|
|||
|
if (!string.IsNullOrEmpty(batchTrustItemId))
|
|||
|
{
|
|||
|
var tItem = BLL.Batch_BatchTrustItemService.GetBatchTrustItemById(batchTrustItemId);
|
|||
|
var jot = BLL.Pipeline_WeldJointService.GetWeldJointByWeldJointId(tItem.WeldJointId);
|
|||
|
if (jot != null)
|
|||
|
{
|
|||
|
var pipe = BLL.Pipeline_PipelineService.GetPipelineByPipelineId(jot.PipelineId);
|
|||
|
var rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(pipe.DetectionRateId);
|
|||
|
txtReplaceJoint.Text = "管线号:" + pipe.PipelineCode + " 焊口号:" + jot.WeldJointCode + " 检测比例:" + rate.DetectionRateCode;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
protected void drpRtReplace_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (drpRtReplace.SelectedValue != Const._Null)
|
|||
|
{
|
|||
|
string batchTrustItemId = Request.Params["BatchTrustItemId"];
|
|||
|
string batchCode = string.Empty;
|
|||
|
string acceptLevel = string.Empty;
|
|||
|
if (!string.IsNullOrEmpty(batchTrustItemId))
|
|||
|
{
|
|||
|
var tItem = BLL.Batch_BatchTrustItemService.GetBatchTrustItemById(batchTrustItemId);
|
|||
|
var batch = BLL.Batch_BatchTrustService.GetBatchTrustById(tItem.TrustBatchId);
|
|||
|
batchCode = batch.TrustBatchCode;
|
|||
|
|
|||
|
var pointItem = BLL.Batch_PointBatchItemService.GetPointBatchItemByPointBatchItemId(tItem.PointBatchItemId);
|
|||
|
if (pointItem != null)
|
|||
|
{
|
|||
|
acceptLevel = pointItem.AcceptLevel;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// PAUT
|
|||
|
if (batchCode != string.Empty)
|
|||
|
{
|
|||
|
if (drpRtReplace.SelectedValue == "53fafe61-cb36-45d3-aa25-0815ba556604")
|
|||
|
{
|
|||
|
|
|||
|
txtTrustCode.Text = batchCode.Replace("RT", "PAUT");
|
|||
|
txtAcceptLevel.Text = "Ⅱ";
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
txtTrustCode.Text = batchCode.Replace("RT", "PT");
|
|||
|
txtAcceptLevel.Text = "Ⅰ";
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
protected void btnSave_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
string batchTrustItemId = Request.Params["BatchTrustItemId"];
|
|||
|
|
|||
|
if (!string.IsNullOrEmpty(batchTrustItemId) && drpRtReplace.SelectedValue!=Const._Null)
|
|||
|
{
|
|||
|
var tItem = BLL.Batch_BatchTrustItemService.GetBatchTrustItemById(batchTrustItemId);
|
|||
|
var batch = BLL.Batch_BatchTrustService.GetBatchTrustById(tItem.TrustBatchId);
|
|||
|
var pointItem = BLL.Batch_PointBatchItemService.GetPointBatchItemByPointBatchItemId(tItem.PointBatchItemId);
|
|||
|
|
|||
|
Model.Batch_BatchTrust newBatchTrust = new Model.Batch_BatchTrust();
|
|||
|
|
|||
|
newBatchTrust.TrustBatchCode = txtTrustCode.Text.Trim();
|
|||
|
|
|||
|
string trustBatchId = SQLHelper.GetNewID(typeof(Model.Batch_BatchTrust));
|
|||
|
newBatchTrust.TrustBatchId = trustBatchId;
|
|||
|
|
|||
|
newBatchTrust.TrustDate = DateTime.Now;
|
|||
|
newBatchTrust.ProjectId = batch.ProjectId;
|
|||
|
newBatchTrust.UnitId = batch.UnitId;
|
|||
|
newBatchTrust.InstallationId = batch.InstallationId;
|
|||
|
newBatchTrust.WorkAreaId = batch.WorkAreaId;
|
|||
|
newBatchTrust.DetectionTypeId = drpRtReplace.SelectedValue;
|
|||
|
newBatchTrust.PipelineId = batch.PipelineId;
|
|||
|
newBatchTrust.TopointBatch = pointItem.PointBatchId;
|
|||
|
BLL.Batch_BatchTrustService.AddBatchTrust(newBatchTrust); // 新增委托单
|
|||
|
|
|||
|
// 更新替换焊口委托明细
|
|||
|
tItem.TrustBatchId = trustBatchId;
|
|||
|
tItem.CreateDate = DateTime.Now;
|
|||
|
|
|||
|
// 更新原委托单对应的点口批
|
|||
|
string[] strArray = batch.TopointBatch.Split(',');
|
|||
|
if (strArray.Distinct().Count() > 1)
|
|||
|
{
|
|||
|
batch.TopointBatch = batch.TopointBatch.Replace(pointItem.PointBatchId, "").Replace(",,", ",");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
batch.TopointBatch = strArray.FirstOrDefault();
|
|||
|
}
|
|||
|
// 更新替换焊口点口明细的合格等级
|
|||
|
pointItem.AcceptLevel = txtAcceptLevel.Text;
|
|||
|
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
|
|||
|
BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_BatchTrustMenuId, Const.BtnRTTrustReplace, tItem.WeldJointId);
|
|||
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|||
|
ShowNotify(Resources.Lan.SaveSuccessfully, MessageBoxIcon.Success);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Alert.ShowInTop("请选择替换的委托类型!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void LoadData()
|
|||
|
{
|
|||
|
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|