288 lines
15 KiB
C#
288 lines
15 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Data;
|
|
using Newtonsoft.Json.Linq;
|
|
using System.Data.SqlClient;
|
|
using BLL;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using System.Globalization;
|
|
using System.Data.Linq;
|
|
using System.Web.Security;
|
|
using System.Web.UI.WebControls;
|
|
using Model;
|
|
using System.Collections;
|
|
|
|
namespace FineUIPro.Web.HJGL.WeldingManage
|
|
{
|
|
public partial class PointManageMove : PageBase
|
|
{
|
|
#region 加载
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
LoadDropDownList();//加载下拉列表信息
|
|
BindGrid();
|
|
}
|
|
else
|
|
{
|
|
// 回发
|
|
string arg = GetRequestEventArgument();
|
|
if (arg.StartsWith("CheckSelectedClick$"))
|
|
{
|
|
JArray content = JArray.Parse(arg.Substring("CheckSelectedClick$".Length));
|
|
|
|
var leftBatch = BLL.HJGL_BO_BatchService.GetBatchById(this.drpLeftBatchId.SelectedValue);
|
|
if (leftBatch != null)
|
|
{
|
|
if (this.drpRightBatchId.SelectedValue != BLL.Const._Null && this.drpRightBatchId.SelectedValue != null)
|
|
{
|
|
var rightBatch = BLL.HJGL_BO_BatchService.GetBatchById(this.drpRightBatchId.SelectedValue);
|
|
var rightBatchDetail1 = Funs.DB.HJGL_BO_BatchDetail.FirstOrDefault(x => x.BatchId == this.drpRightBatchId.SelectedValue);
|
|
DateTime? vICheckDate = null;
|
|
if (rightBatchDetail1 != null)
|
|
{
|
|
if (rightBatchDetail1.VICheckDate != null)
|
|
{
|
|
vICheckDate = rightBatchDetail1.VICheckDate;
|
|
}
|
|
}
|
|
if (rightBatch != null)
|
|
{
|
|
var rightBatchDetails = BLL.HJGL_BO_BatchDetailService.GetBatchDetailByBatchId(this.drpRightBatchId.SelectedValue);
|
|
foreach (JObject item in content)
|
|
{
|
|
var batchDetail = BLL.HJGL_BO_BatchDetailService.GetBatchDetailById(item.Value<string>("id"));
|
|
var rightBatchDetail = rightBatchDetails.Where(x => x.JOT_ID == batchDetail.JOT_ID);
|
|
if (batchDetail != null && rightBatchDetail.Count() == 0)
|
|
{
|
|
BLL.HJGL_BO_BatchDetailService.DeleteBatchDetailById(batchDetail.BatchDetailId);
|
|
|
|
Model.HJGL_BO_BatchDetail newBatchDetail = new Model.HJGL_BO_BatchDetail();
|
|
newBatchDetail.BatchDetailId = SQLHelper.GetNewID(typeof(Model.HJGL_BO_BatchDetail));
|
|
newBatchDetail.BatchId = this.drpRightBatchId.SelectedValue;
|
|
newBatchDetail.ISO_ID = batchDetail.ISO_ID;
|
|
newBatchDetail.JOT_ID = batchDetail.JOT_ID;
|
|
newBatchDetail.NDT = batchDetail.NDT;
|
|
newBatchDetail.PointType = batchDetail.PointType;
|
|
newBatchDetail.PointDate = batchDetail.PointDate;
|
|
newBatchDetail.ConfirmDate = batchDetail.ConfirmDate;
|
|
newBatchDetail.CheckAddress = batchDetail.CheckAddress;
|
|
if (rightBatch.BatchIsClosed == true)
|
|
{
|
|
newBatchDetail.IsVI = true;
|
|
}
|
|
else
|
|
{
|
|
newBatchDetail.IsVI = null;
|
|
}
|
|
newBatchDetail.Checker = batchDetail.Checker;
|
|
newBatchDetail.Remark = batchDetail.Remark;
|
|
newBatchDetail.ToRepairId = batchDetail.ToRepairId;
|
|
newBatchDetail.VICheckDate = vICheckDate; //外观检测日期更新为目标批的外观检测日期
|
|
newBatchDetail.ReportFeedback = batchDetail.ReportFeedback;
|
|
BLL.HJGL_BO_BatchDetailService.AddBatchDetail(newBatchDetail);
|
|
}
|
|
}
|
|
ShowNotify("移动成功!", MessageBoxIcon.Success);
|
|
|
|
}
|
|
}
|
|
else //未选择目标下拉框,新增一条批信息
|
|
{
|
|
Model.HJGL_BO_Batch newBatch = new Model.HJGL_BO_Batch();
|
|
newBatch.BatchId = SQLHelper.GetNewID(typeof(Model.HJGL_BO_Batch));
|
|
newBatch.BatchCode = BLL.SQLHelper.RunProcFlowCode("SpGetFlowCode", "dbo.HJGL_BO_Batch", "BatchCode", leftBatch.ProjectId);
|
|
newBatch.ProjectId = leftBatch.ProjectId;
|
|
newBatch.InstallationId = leftBatch.InstallationId;
|
|
newBatch.ISC_ID = leftBatch.ISC_ID;
|
|
newBatch.ExecStandardId = leftBatch.ExecStandardId;
|
|
//newBatch.SER_ID = leftBatch.SER_ID;
|
|
newBatch.STE_ID = leftBatch.STE_ID;
|
|
newBatch.JOTY_ID = leftBatch.JOTY_ID;
|
|
newBatch.NDTR_ID = leftBatch.NDTR_ID;
|
|
newBatch.IsSpecial = leftBatch.IsSpecial;
|
|
newBatch.BatchStartDate = DateTime.Now;
|
|
BLL.HJGL_BO_BatchService.AddBatch(newBatch);
|
|
|
|
foreach (JObject item in content)
|
|
{
|
|
var batchDetail = BLL.HJGL_BO_BatchDetailService.GetBatchDetailById(item.Value<string>("id"));
|
|
if (batchDetail != null)
|
|
{
|
|
BLL.HJGL_BO_BatchDetailService.DeleteBatchDetailById(batchDetail.BatchDetailId);
|
|
|
|
Model.HJGL_BO_BatchDetail newBatchDetail = new Model.HJGL_BO_BatchDetail();
|
|
newBatchDetail.BatchDetailId = SQLHelper.GetNewID(typeof(Model.HJGL_BO_BatchDetail));
|
|
newBatchDetail.BatchId = newBatch.BatchId;
|
|
newBatchDetail.ISO_ID = batchDetail.ISO_ID;
|
|
newBatchDetail.JOT_ID = batchDetail.JOT_ID;
|
|
newBatchDetail.NDT = batchDetail.NDT;
|
|
newBatchDetail.PointType = batchDetail.PointType;
|
|
newBatchDetail.PointDate = batchDetail.PointDate;
|
|
newBatchDetail.ConfirmDate = batchDetail.ConfirmDate;
|
|
newBatchDetail.CheckAddress = batchDetail.CheckAddress;
|
|
newBatchDetail.IsVI = batchDetail.IsVI;
|
|
newBatchDetail.Checker = batchDetail.Checker;
|
|
newBatchDetail.Remark = batchDetail.Remark;
|
|
newBatchDetail.ToRepairId = batchDetail.ToRepairId;
|
|
newBatchDetail.VICheckDate = batchDetail.VICheckDate;
|
|
newBatchDetail.ReportFeedback = batchDetail.ReportFeedback;
|
|
BLL.HJGL_BO_BatchDetailService.AddBatchDetail(newBatchDetail);
|
|
}
|
|
}
|
|
ShowNotify("移动成功!", MessageBoxIcon.Success);
|
|
}
|
|
}
|
|
}
|
|
BindGrid();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 加载下拉列表信息
|
|
/// </summary>
|
|
private void LoadDropDownList()
|
|
{
|
|
///项目
|
|
this.drpLeftProject.DataTextField = "ProjectCode";
|
|
this.drpLeftProject.DataValueField = "ProjectId";
|
|
this.drpLeftProject.DataSource = BLL.Base_ProjectService.GetOnProjectListByUserId(this.CurrUser.UserId, "1");
|
|
this.drpLeftProject.DataBind();
|
|
this.drpLeftProject.SelectedValue = this.CurrUser.LoginProjectId;
|
|
|
|
if (this.drpLeftProject.SelectedValue != BLL.Const._Null)
|
|
{
|
|
this.drpLeftBatchId.DataTextField = "Text";
|
|
this.drpLeftBatchId.DataValueField = "Value";
|
|
var list = (from x in Funs.DB.HJGL_BO_Batch
|
|
where x.ProjectId == this.drpLeftProject.SelectedValue
|
|
orderby x.BatchCode
|
|
select x).ToList();
|
|
ListItem[] item = new ListItem[list.Count()];
|
|
for (int i = 0; i < list.Count(); i++)
|
|
{
|
|
item[i] = new ListItem(list[i].BatchCode + GetDate(list[i].BatchCloseDate), list[i].BatchId.ToString());
|
|
}
|
|
this.drpLeftBatchId.DataSource = item;
|
|
this.drpLeftBatchId.DataBind();
|
|
}
|
|
Funs.FineUIPleaseSelect(this.drpLeftBatchId);
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region 绑定数据
|
|
/// <summary>
|
|
/// 绑定数据
|
|
/// </summary>
|
|
private void BindGrid()
|
|
{
|
|
string strSql = @"SELECT BatchDetail.BatchDetailId, BatchDetail.BatchId, BatchDetail.JOT_ID,
|
|
iso.ISO_IsoNo,JointInfo.JOT_JointNo,Welder.WED_Code,
|
|
(CASE WHEN JointInfo.Jot_WeldingDate IS NOT NULL THEN JointInfo.Jot_WeldingDate
|
|
ELSE WeldReportMain.JOT_WeldDate END) AS JOT_WeldDate,
|
|
JointInfo.Sort1,JointInfo.Sort2,JointInfo.Sort3,JointInfo.Sort4,JointInfo.Sort5
|
|
FROM HJGL_BO_BatchDetail AS BatchDetail
|
|
LEFT JOIN HJGL_PW_JointInfo AS JointInfo ON JointInfo.JOT_ID = BatchDetail.JOT_ID
|
|
LEFT JOIN HJGL_PW_IsoInfo AS iso ON BatchDetail.ISO_ID = iso.ISO_ID
|
|
LEFT JOIN HJGL_BS_Welder AS Welder ON Welder.WED_ID = JointInfo.JOT_CellWelder
|
|
left join HJGL_BO_WeldReportMain AS WeldReportMain on WeldReportMain.DReportID=JointInfo.DReportID
|
|
WHERE BatchDetail.NDT IS null
|
|
AND BatchDetail.BatchId=@BatchId";
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
listStr.Add(new SqlParameter("@BatchId", this.drpLeftBatchId.SelectedValue));
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
//Grid1.RecordCount = tb.Rows.Count;
|
|
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|
var table = this.GetSortTable(Grid1, tb);
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
}
|
|
#endregion
|
|
|
|
#region DropDownList下拉选择事件
|
|
/// <summary>
|
|
/// 施工号下拉选择事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void drpLeftProject_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
this.drpLeftBatchId.Items.Clear();
|
|
if (this.drpLeftProject.SelectedValue != BLL.Const._Null)
|
|
{
|
|
this.drpLeftBatchId.DataTextField = "Text";
|
|
this.drpLeftBatchId.DataValueField = "Value";
|
|
var list = (from x in Funs.DB.HJGL_BO_Batch
|
|
where x.ProjectId == this.drpLeftProject.SelectedValue
|
|
orderby x.BatchCode
|
|
select x).ToList();
|
|
ListItem[] item = new ListItem[list.Count()];
|
|
for (int i = 0; i < list.Count(); i++)
|
|
{
|
|
item[i] = new ListItem(list[i].BatchCode + GetDate(list[i].BatchCloseDate), list[i].BatchId.ToString());
|
|
}
|
|
this.drpLeftBatchId.DataSource = item;
|
|
this.drpLeftBatchId.DataBind();
|
|
}
|
|
Funs.FineUIPleaseSelect(this.drpLeftBatchId);
|
|
this.drpLeftBatchId.SelectedValue = BLL.Const._Null;
|
|
}
|
|
|
|
private string GetDate(DateTime? batchCloseDate)
|
|
{
|
|
string date = string.Empty;
|
|
if (batchCloseDate != null)
|
|
{
|
|
date = "(" + string.Format("{0:yyyy-MM-dd}", batchCloseDate) + ")";
|
|
}
|
|
return date;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 批编号下拉选择事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void drpLeftBatchId_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
string leftBatchId = this.drpLeftBatchId.SelectedValue;
|
|
var leftBatch = BLL.HJGL_BO_BatchService.GetBatchById(leftBatchId);
|
|
var rightBatchList = (from x in Funs.DB.HJGL_BO_Batch
|
|
where x.InstallationId == leftBatch.InstallationId && x.ISC_ID == leftBatch.ISC_ID
|
|
&& x.ExecStandardId == leftBatch.ExecStandardId
|
|
&& x.STE_ID == leftBatch.STE_ID && x.JOTY_ID == leftBatch.JOTY_ID
|
|
&& x.NDTR_ID == leftBatch.NDTR_ID && x.IsSpecial == leftBatch.IsSpecial
|
|
&& x.BatchId != leftBatchId
|
|
orderby x.BatchCode
|
|
select x).ToList();
|
|
this.drpRightBatchId.Items.Clear();
|
|
this.drpRightBatchId.DataTextField = "Text";
|
|
this.drpRightBatchId.DataValueField = "Value";
|
|
ListItem[] item = new ListItem[rightBatchList.Count()];
|
|
for (int i = 0; i < rightBatchList.Count(); i++)
|
|
{
|
|
item[i] = new ListItem(rightBatchList[i].BatchCode + GetDate(rightBatchList[i].BatchCloseDate), rightBatchList[i].BatchId.ToString());
|
|
}
|
|
this.drpRightBatchId.DataSource = item;
|
|
this.drpRightBatchId.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpRightBatchId);
|
|
|
|
BindGrid();
|
|
|
|
Grid2.DataSource = null;
|
|
Grid2.DataBind();
|
|
}
|
|
#endregion
|
|
}
|
|
} |