This commit is contained in:
2024-06-05 08:24:19 +08:00
parent 1677a6d714
commit 3990f747ce
67 changed files with 6774 additions and 1645 deletions
@@ -3,7 +3,11 @@ using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web.ModelBinding;
using System.Web.UI.DataVisualization.Charting;
using System.Windows.Forms;
using BLL;
using Model;
using Newtonsoft.Json.Linq;
namespace FineUIPro.Web.WeldingProcess.TestPackageManage
@@ -103,6 +107,7 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
}
}
this.PageInfoLoad(); ///加载页面
}
}
#endregion
@@ -170,6 +175,14 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
}
this.txtRemark.Text = testPackageManage.Remark;
var items = Funs.DB.PTP_PipelineList.Where(t => t.PTP_ID == testPackageManage.PTP_ID)
.Select(t=>t.WorkAreaId).FirstOrDefault();
if (items != null)
{
drpWorkArea.SelectedValue = items;
}
this.BindGrid(); ////初始化页面
this.ShowGridItem();
}
@@ -192,22 +205,51 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
/// </summary>
private void BindGrid()
{
string strSql = @"SELECT IsoInfo.ProjectId,IsoInfo.WorkAreaId,WorkArea.WorkAreaCode,IsoInfo.PipelineId,IsoInfo.PipelineCode,
IsoInfo.DesignPressure,IsoInfo.DesignTemperature, WorkArea.InstallationId,IsoInfo.UnitId,
IsoInfo.TestPressure,IsoInfo.TestTemperature,bs.MediumName,IsoInfo.SingleNumber,
IsoInfo.Specification,IsoInfo.PipingClassId,IsoInfo.MainMaterialId,IsoList.PT_PipeId,IsoList.PTP_ID
FROM dbo.Pipeline_Pipeline AS IsoInfo
LEFT JOIN DBO.Project_WorkArea AS WorkArea ON IsoInfo.WorkAreaId =WorkArea.WorkAreaId
LEFT JOIN dbo.Base_Medium AS bs ON bs.MediumId = IsoInfo.MediumId
LEFT JOIN dbo.PTP_PipelineList AS IsoList ON IsoList.PipelineId = IsoInfo.PipelineId
string strSql = string.Empty;
if (string.IsNullOrEmpty(this.PTP_ID))
{
strSql = @"SELECT
IsoInfo.ProjectId,IsoInfo.WorkAreaId,WorkArea.WorkAreaCode,IsoInfo.PipelineId,IsoInfo.PipelineCode,
IsoInfo.DesignPressure,IsoInfo.DesignTemperature, WorkArea.InstallationId,IsoInfo.UnitId,
IsoInfo.TestPressure,IsoInfo.TestTemperature,bs.MediumName,IsoInfo.SingleNumber,
'全部' as WeldJointCode
FROM dbo.Pipeline_Pipeline AS IsoInfo
LEFT JOIN DBO.Project_WorkArea AS WorkArea ON IsoInfo.WorkAreaId =WorkArea.WorkAreaId
LEFT JOIN dbo.Base_Medium AS bs ON bs.MediumId = IsoInfo.MediumId
WHERE IsoInfo.ProjectId= @ProjectId AND IsoInfo.UnitId= @UnitId
AND WorkArea.InstallationId= @InstallationId AND (IsoList.PTP_ID IS NULL OR IsoList.PTP_ID = @PTP_ID)";
AND WorkArea.InstallationId= @InstallationId AND
IsoInfo.PipelineId not in(
select PipelineId from PTP_PipelineList where PipelineId=IsoInfo.PipelineId and
WorkAreaId=IsoInfo.WorkAreaId and isAll=1
)
";
}
else
{
strSql = @"SELECT
IsoInfo.ProjectId,IsoInfo.WorkAreaId,WorkArea.WorkAreaCode,IsoInfo.PipelineId,IsoInfo.PipelineCode,
IsoInfo.DesignPressure,IsoInfo.DesignTemperature, WorkArea.InstallationId,IsoInfo.UnitId,
IsoInfo.TestPressure,IsoInfo.TestTemperature,bs.MediumName,IsoInfo.SingleNumber,
IsoList.isAll,(case when (isnull(IsoList.WeldJonintCode,'')='') then '全部' else IsoList.WeldJonintCode end) as WeldJointCode
FROM dbo.Pipeline_Pipeline AS IsoInfo
LEFT JOIN DBO.Project_WorkArea AS WorkArea ON IsoInfo.WorkAreaId =WorkArea.WorkAreaId
LEFT JOIN dbo.Base_Medium AS bs ON bs.MediumId = IsoInfo.MediumId
LEFT JOIN dbo.PTP_PipelineList AS IsoList ON IsoList.PipelineId = IsoInfo.PipelineId
and IsoInfo.WorkAreaId=IsoList.WorkAreaId and IsoList.PTP_ID=@PTP_ID
WHERE IsoInfo.ProjectId= @ProjectId AND IsoInfo.UnitId= @UnitId
AND WorkArea.InstallationId= @InstallationId ";
}
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
listStr.Add(new SqlParameter("@PTP_ID", this.PTP_ID));
listStr.Add(new SqlParameter("@UnitId", this.drpUnit.SelectedValue));
listStr.Add(new SqlParameter("@InstallationId", this.drpInstallation.SelectedValue));
if (!string.IsNullOrEmpty(this.PTP_ID))
{
listStr.Add(new SqlParameter("@PTP_ID", this.PTP_ID));
}
if (this.drpWorkArea.SelectedValue != Const._Null && drpWorkArea.SelectedValue!=null)
{
strSql += " AND IsoInfo.WorkAreaId = @WorkAreaId";
@@ -276,6 +318,20 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
//}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
if (string.IsNullOrEmpty(this.PTP_ID))
{
foreach (DataRow dr in tb.Rows)
{
string pipelineId = dr["PipelineId"].ToString();
string joinCodeList = dr["WeldJointCode"].ToString();
int count = countWeldJointCode(pipelineId);
int baseCount = countBaseWeldJointCode(pipelineId);
if (count == baseCount)
{
dr.Delete();
}
}
}
// 2.获取当前分页数据
//var table = this.GetPagedDataTable(Grid1, tb1);
Grid1.RecordCount = tb.Rows.Count;
@@ -283,8 +339,34 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
}
}
private int countBaseWeldJointCode(string pipelineId)
{
string sql = "select count(1) from Pipeline_WeldJoint where PipelineId=@PipelineId";
SqlParameter[] parameters = new SqlParameter[] {
new SqlParameter("@PipelineId",pipelineId)
};
int count = SQLHelper.getIntValue(sql, parameters);
return count;
}
private int countWeldJointCode(string pipelineId)
{
string sql = @"select WeldJointCode=(stuff((select ','+ WeldJonintCode from PTP_PipelineList where PipelineId=@PipelineId and isALL=0 for xml path('')),1,1,''))";
SqlParameter[] parameters = new SqlParameter[] {
new SqlParameter("@PipelineId",pipelineId)
};
string strCode = SQLHelper.GetStr(sql, parameters);
if(!string.IsNullOrEmpty(strCode) )
{
string[] arr=strCode.Split(',');
return arr==null?0:arr.Length;
}
else
{
return 0;
}
}
/// <summary>
/// 对GV 赋值
/// </summary>
@@ -347,6 +429,7 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
this.CollectGridJointInfo();
this.BindGrid();
this.ShowGridItem();
}
#endregion
@@ -491,15 +574,53 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
BLL.TestPackageManageEditService.AddTestPackage(testPackage);
BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.TestPackageManageEditMenuId, Const.BtnAdd, this.PTP_ID);
}
foreach (var item in listSelects)
JArray teamGroupData = Grid1.GetMergedData();
if (listSelects.Count > 0)
{
Model.PTP_PipelineList newitem = new Model.PTP_PipelineList();
newitem.PTP_ID = this.PTP_ID;
newitem.PipelineId = item;
BLL.TestPackageManageEditService.AddPipelineList(newitem);
BLL.TestPackageManageEditService.DeletePipelineListByPTP_ID(testPackage.PTP_ID);
}
foreach (JObject teamGroupRow in teamGroupData)
{
string PipelineId = teamGroupRow["id"].ToString();
string status = teamGroupRow.Value<string>("status");
if (listSelects.Contains(PipelineId))
{
JObject values = teamGroupRow.Value<JObject>("values");
string WeldJonintCodes = values.Value<string>("WeldJointCode");
string workAreaId = values.Value<string>("WorkAreaId");
if (string.IsNullOrEmpty(WeldJonintCodes))
WeldJonintCodes = "全部";
//处理剩下来的口
List<string> listJointCode = new List<string>();
var tempData = Funs.DB.PTP_PipelineList.Where(t=>t.PipelineId== PipelineId && t.IsAll==false).Select(t => t.WeldJonintCode).ToList();
foreach (var item in tempData)
{
if (!string.IsNullOrEmpty(item))
{
string[] arr=item.Split(',');
for (int i = 0; i < arr.Length; i++)
{
listJointCode.Add(arr[i]);
}
}
}
if(WeldJonintCodes=="全部" && listJointCode.Count > 0)
{
var nextJointCode = Funs.DB.Pipeline_WeldJoint.Where(t => t.PipelineId == PipelineId && !listJointCode.Contains(t.WeldJointCode))
.Select(t => t.WeldJointCode).ToList().ToArray();
WeldJonintCodes = String.Join(",", nextJointCode.ToArray());
}
Model.PTP_PipelineList newitem = new Model.PTP_PipelineList();
newitem.PTP_ID = this.PTP_ID;
newitem.PipelineId = PipelineId;
newitem.IsAll = WeldJonintCodes=="全部" ? true : false;
newitem.WeldJonintCode = WeldJonintCodes;
newitem.WorkAreaId = workAreaId;
BLL.TestPackageManageEditService.AddPipelineList(newitem);
}
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(this.PTP_ID)
+ ActiveWindow.GetHidePostBackReference());
@@ -511,6 +632,7 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
}
}
#endregion
#region Grid页面信息
/// <summary>
@@ -532,7 +654,15 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
listSelects.Add(rowID);
}
}
}
#endregion
#region Grid2列表
#endregion
#region Grid
@@ -599,6 +729,9 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
this.BindGrid();
this.ShowGridItem();
}
#endregion
}
}