Merge branch 'master' of http://47.104.102.122:3000/lpf/SGGL_SHJ
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar2" Position="Top" runat="server" ToolbarAlign="Left">
|
||||
<Items>
|
||||
<f:TextBox ID="txtMaterialCode" runat="server" Label="材料编码"
|
||||
<f:TextBox ID="txtCode" runat="server" Label="材料编码"
|
||||
EmptyText="输入查询条件" Width="300px" LabelWidth="120px"
|
||||
LabelAlign="Right">
|
||||
</f:TextBox>
|
||||
@@ -44,14 +44,18 @@
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Columns>
|
||||
<f:RenderField Width="200px" ColumnID="MaterialCode" DataField="MaterialCode"
|
||||
<f:RenderField Width="200px" ColumnID="Code" DataField="Code"
|
||||
FieldType="String" HeaderText="材料编码" HeaderTextAlign="Center"
|
||||
TextAlign="Left" SortField="MaterialCode">
|
||||
TextAlign="Left" SortField="Code">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="200px" ColumnID="HeatNo" DataField="HeatNo"
|
||||
FieldType="String" HeaderText="炉批号" HeaderTextAlign="Center"
|
||||
FieldType="String" HeaderText="炉号" HeaderTextAlign="Center"
|
||||
TextAlign="Left" SortField="HeatNo">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="200px" ColumnID="BatchNo" DataField="BatchNo"
|
||||
FieldType="String" HeaderText="批号" HeaderTextAlign="Center"
|
||||
TextAlign="Left" SortField="BatchNo">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="200px" ColumnID="MaterialName" DataField="MaterialName"
|
||||
FieldType="String" HeaderText="类型" HeaderTextAlign="Center"
|
||||
TextAlign="Left" SortField="MaterialName">
|
||||
@@ -93,7 +97,7 @@
|
||||
</f:Panel>
|
||||
<f:Window ID="Window1" Title="弹出窗体" Hidden="true" EnableIFrame="true"
|
||||
EnableMaximize="true" Target="Top" EnableResize="false" runat="server" OnClose="Window1_Close"
|
||||
IsModal="true" Width="700px" Height="400px">
|
||||
IsModal="true" Width="700px" Height="450px">
|
||||
</f:Window>
|
||||
|
||||
<f:Window ID="Window2" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
|
||||
|
||||
@@ -36,10 +36,10 @@ namespace FineUIPro.Web.HJGL.BaseInfo
|
||||
WHERE 1=1";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
|
||||
if (!string.IsNullOrEmpty(this.txtMaterialCode.Text.Trim()))
|
||||
if (!string.IsNullOrEmpty(this.txtCode.Text.Trim()))
|
||||
{
|
||||
strSql += " AND MaterialCode LIKE @MaterialCode";
|
||||
listStr.Add(new SqlParameter("@MaterialCode", "%" + this.txtMaterialCode.Text.Trim() + "%"));
|
||||
strSql += " AND Code LIKE @Code";
|
||||
listStr.Add(new SqlParameter("@Code", "%" + this.txtCode.Text.Trim() + "%"));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtMaterialName.Text.Trim()))
|
||||
{
|
||||
|
||||
@@ -58,13 +58,13 @@ namespace FineUIPro.Web.HJGL.BaseInfo {
|
||||
protected global::FineUIPro.Toolbar Toolbar2;
|
||||
|
||||
/// <summary>
|
||||
/// txtMaterialCode 控件。
|
||||
/// txtCode 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtMaterialCode;
|
||||
protected global::FineUIPro.TextBox txtCode;
|
||||
|
||||
/// <summary>
|
||||
/// txtMaterialName 控件。
|
||||
|
||||
@@ -15,14 +15,21 @@
|
||||
<Rows>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:TextBox ID="txtMaterialCode" runat="server" Label="材料编码"
|
||||
<f:TextBox ID="txtCode" runat="server" Label="材料编码"
|
||||
Required="true" MaxLength="50" ShowRedStar="true" FocusOnPageLoad="true" LabelWidth="100px">
|
||||
</f:TextBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:TextBox ID="txtHeatNo" runat="server" Label="炉批号"
|
||||
<f:TextBox ID="txtHeatNo" runat="server" Label="炉号"
|
||||
Required="true" MaxLength="50" ShowRedStar="true" LabelWidth="100px">
|
||||
</f:TextBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:TextBox ID="txtBatchNo" runat="server" Label="批号"
|
||||
Required="true" MaxLength="50" ShowRedStar="true" LabelWidth="100px">
|
||||
</f:TextBox>
|
||||
</Items>
|
||||
|
||||
@@ -23,18 +23,19 @@ namespace FineUIPro.Web.HJGL.BaseInfo
|
||||
Model.HJGL_MaterialCodeLib lib = BLL.MaterialCodeLibService.GetMaterialCodeLib(materialCode);
|
||||
if (lib != null)
|
||||
{
|
||||
this.txtMaterialCode.Text = materialCode;
|
||||
this.txtCode.Text = lib.Code;
|
||||
this.txtMaterialMade.Text = lib.MaterialMade;
|
||||
this.txtHeatNo.Text = lib.HeatNo;
|
||||
this.txtBatchNo.Text = lib.BatchNo;
|
||||
this.txtMaterialName.Text = lib.MaterialName;
|
||||
txtMaterialSpec.Text = lib.MaterialSpec;
|
||||
txtMaterialDef.Text = lib.MaterialDef;
|
||||
txtMaterialUnit.Text = lib.MaterialUnit;
|
||||
txtMaterialCode.Enabled = false;
|
||||
//txtMaterialCode.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtMaterialCode.Enabled = true;
|
||||
//txtMaterialCode.Enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,23 +53,25 @@ namespace FineUIPro.Web.HJGL.BaseInfo
|
||||
string materialCode = Request.Params["MaterialCode"];
|
||||
if (string.IsNullOrEmpty(materialCode))
|
||||
{
|
||||
var q = Funs.DB.HJGL_MaterialCodeLib.FirstOrDefault(x => x.MaterialCode == this.txtMaterialCode.Text.Trim());
|
||||
var q = Funs.DB.HJGL_MaterialCodeLib.FirstOrDefault(x => x.MaterialCode == materialCode);
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("此材料编码已存在!", MessageBoxIcon.Warning);
|
||||
Alert.ShowInTop("此材料编码、炉号、批号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Model.HJGL_MaterialCodeLib newLib = new Model.HJGL_MaterialCodeLib
|
||||
{
|
||||
MaterialCode = this.txtMaterialCode.Text.Trim(),
|
||||
MaterialCode = this.txtCode.Text.Trim() + "-" + this.txtHeatNo.Text.Trim() + "-" + this.txtBatchNo.Text.Trim(),
|
||||
HeatNo = this.txtHeatNo.Text.Trim(),
|
||||
BatchNo = this.txtBatchNo.Text.Trim(),
|
||||
MaterialName = this.txtMaterialName.Text.Trim(),
|
||||
MaterialSpec = this.txtMaterialSpec.Text.Trim(),
|
||||
MaterialMade = this.txtMaterialMade.Text.Trim(),
|
||||
MaterialDef = this.txtMaterialDef.Text.Trim(),
|
||||
MaterialUnit = txtMaterialUnit.Text.Trim()
|
||||
MaterialUnit = txtMaterialUnit.Text.Trim(),
|
||||
Code = this.txtCode.Text.Trim()
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty(materialCode))
|
||||
|
||||
@@ -40,13 +40,13 @@ namespace FineUIPro.Web.HJGL.BaseInfo {
|
||||
protected global::FineUIPro.Form SimpleForm1;
|
||||
|
||||
/// <summary>
|
||||
/// txtMaterialCode 控件。
|
||||
/// txtCode 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtMaterialCode;
|
||||
protected global::FineUIPro.TextBox txtCode;
|
||||
|
||||
/// <summary>
|
||||
/// txtHeatNo 控件。
|
||||
@@ -57,6 +57,15 @@ namespace FineUIPro.Web.HJGL.BaseInfo {
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtHeatNo;
|
||||
|
||||
/// <summary>
|
||||
/// txtBatchNo 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtBatchNo;
|
||||
|
||||
/// <summary>
|
||||
/// txtMaterialName 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -119,9 +119,21 @@
|
||||
FieldType="String" HeaderText="预制组件" HeaderTextAlign="Center"
|
||||
TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<f:RenderField HeaderText="材料编码" ColumnID="MaterialCode"
|
||||
<f:RenderField HeaderText="材料主编码" ColumnID="MaterialCode"
|
||||
DataField="MaterialCode" SortField="MaterialCode" FieldType="String" HeaderTextAlign="Center"
|
||||
TextAlign="Left" Width="100px">
|
||||
TextAlign="Left" Width="150px">
|
||||
</f:RenderField>
|
||||
<f:RenderField HeaderText="材料编码" ColumnID="Code"
|
||||
DataField="Code" SortField="Code" FieldType="String" HeaderTextAlign="Center"
|
||||
TextAlign="Left" Width="120px">
|
||||
</f:RenderField>
|
||||
<f:RenderField HeaderText="炉号" ColumnID="HeatNo"
|
||||
DataField="HeatNo" SortField="HeatNo" FieldType="String" HeaderTextAlign="Center"
|
||||
TextAlign="Left" Width="120px">
|
||||
</f:RenderField>
|
||||
<f:RenderField HeaderText="批号" ColumnID="BatchNo"
|
||||
DataField="BatchNo" SortField="BatchNo" FieldType="String" HeaderTextAlign="Center"
|
||||
TextAlign="Left" Width="120px">
|
||||
</f:RenderField>
|
||||
|
||||
<f:RenderField Width="100px" ColumnID="MaterialSpec" DataField="MaterialSpec" SortField="MaterialSpec"
|
||||
@@ -166,10 +178,22 @@
|
||||
<Columns>
|
||||
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号"
|
||||
Width="60px" HeaderTextAlign="Center" TextAlign="Center" />
|
||||
<f:RenderField HeaderText="材料编码" ColumnID="MaterialCode"
|
||||
<f:RenderField HeaderText="材料主编码" ColumnID="MaterialCode"
|
||||
DataField="MaterialCode" SortField="MaterialCode" FieldType="String" HeaderTextAlign="Center"
|
||||
TextAlign="Left" Width="150px">
|
||||
</f:RenderField>
|
||||
<f:RenderField HeaderText="材料编码" ColumnID="Code"
|
||||
DataField="Code" SortField="Code" FieldType="String" HeaderTextAlign="Center"
|
||||
TextAlign="Left" Width="120px">
|
||||
</f:RenderField>
|
||||
<f:RenderField HeaderText="炉号" ColumnID="HeatNo"
|
||||
DataField="HeatNo" SortField="HeatNo" FieldType="String" HeaderTextAlign="Center"
|
||||
TextAlign="Left" Width="120px">
|
||||
</f:RenderField>
|
||||
<f:RenderField HeaderText="批号" ColumnID="BatchNo"
|
||||
DataField="BatchNo" SortField="BatchNo" FieldType="String" HeaderTextAlign="Center"
|
||||
TextAlign="Left" Width="120px">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="100px" ColumnID="MaterialSpec" DataField="MaterialSpec" SortField="MaterialSpec"
|
||||
FieldType="String" HeaderText="规格" HeaderTextAlign="Center"
|
||||
TextAlign="Left">
|
||||
@@ -211,10 +235,22 @@
|
||||
<Columns>
|
||||
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号"
|
||||
Width="60px" HeaderTextAlign="Center" TextAlign="Center" />
|
||||
<f:RenderField HeaderText="材料编码" ColumnID="MaterialCode"
|
||||
<f:RenderField HeaderText="材料主编码" ColumnID="MaterialCode"
|
||||
DataField="MaterialCode" SortField="MaterialCode" FieldType="String" HeaderTextAlign="Center"
|
||||
TextAlign="Left" Width="150px">
|
||||
</f:RenderField>
|
||||
<f:RenderField HeaderText="材料编码" ColumnID="Code"
|
||||
DataField="Code" SortField="Code" FieldType="String" HeaderTextAlign="Center"
|
||||
TextAlign="Left" Width="120px">
|
||||
</f:RenderField>
|
||||
<f:RenderField HeaderText="炉号" ColumnID="HeatNo"
|
||||
DataField="HeatNo" SortField="HeatNo" FieldType="String" HeaderTextAlign="Center"
|
||||
TextAlign="Left" Width="120px">
|
||||
</f:RenderField>
|
||||
<f:RenderField HeaderText="批号" ColumnID="BatchNo"
|
||||
DataField="BatchNo" SortField="BatchNo" FieldType="String" HeaderTextAlign="Center"
|
||||
TextAlign="Left" Width="120px">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="100px" ColumnID="MaterialSpec" DataField="MaterialSpec" SortField="MaterialSpec"
|
||||
FieldType="String" HeaderText="规格" HeaderTextAlign="Center"
|
||||
TextAlign="Left">
|
||||
|
||||
@@ -90,26 +90,7 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
{
|
||||
foreach (var q in unitWork1)
|
||||
{
|
||||
string strSql = " SELECT DISTINCT [t0].[PipelineId] FROM [dbo].[HJGL_Pipeline] AS [t0]\r\nleft JOIN [dbo].[HJGL_PipeLineMat] AS [t1] ON [t0].[PipelineId] = [t1].[PipelineId]";
|
||||
strSql += "where [t0].[UnitWorkId] =@UnitWorkId ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@UnitWorkId", q.UnitWorkId));
|
||||
|
||||
if (!string.IsNullOrEmpty(txtMaterialCode.Text.Trim()))
|
||||
{
|
||||
strSql += " and [t1].[MaterialCode] like @MaterialCode";
|
||||
listStr.Add(new SqlParameter("@MaterialCode", "%" + txtMaterialCode.Text.Trim() + "%"));
|
||||
|
||||
}
|
||||
if (!string.IsNullOrEmpty(tvPipeCode.Text.Trim()))
|
||||
{
|
||||
strSql += " and [t0].[PipelineCode] like @PipelineCode";
|
||||
listStr.Add(new SqlParameter("@PipelineCode", "%" + tvPipeCode.Text.Trim() + "%"));
|
||||
|
||||
}
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
var a = dt.Rows.Count;
|
||||
var a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
|
||||
|
||||
//int a = (from x in DBpipeline
|
||||
// join y in dbpipeLineMat on x.PipelineId equals y.PipelineId
|
||||
@@ -121,16 +102,13 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
tn1.NodeID = q.UnitWorkId;
|
||||
tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
|
||||
tn1.ToolTip = "施工单位:" + unitNamesUnitIds;
|
||||
tn1.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
||||
tn1.CommandName = "单位工程";
|
||||
tn1.EnableExpandEvent = true;
|
||||
tn1.EnableClickEvent = true;
|
||||
rootNode1.Nodes.Add(tn1);
|
||||
if (a > 0)
|
||||
{
|
||||
// BindNodes(tn1);
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = "加载管线...";
|
||||
newNode.NodeID = "加载管线...";
|
||||
tn1.Nodes.Add(newNode);
|
||||
BindTestPackageNodes(tn1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,27 +117,7 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
|
||||
foreach (var q in unitWork2)
|
||||
{
|
||||
string strSql = " SELECT DISTINCT [t0].[PipelineId] FROM [dbo].[HJGL_Pipeline] AS [t0]\r\nleft JOIN [dbo].[HJGL_PipeLineMat] AS [t1] ON [t0].[PipelineId] = [t1].[PipelineId]";
|
||||
strSql += "where [t0].[UnitWorkId] =@UnitWorkId ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@UnitWorkId", q.UnitWorkId));
|
||||
|
||||
if (!string.IsNullOrEmpty(txtMaterialCode.Text.Trim()))
|
||||
{
|
||||
strSql += " and [t1].[MaterialCode] like @MaterialCode";
|
||||
listStr.Add(new SqlParameter("@MaterialCode", "%" + txtMaterialCode.Text.Trim() + "%"));
|
||||
|
||||
}
|
||||
if (!string.IsNullOrEmpty(tvPipeCode.Text.Trim()))
|
||||
{
|
||||
strSql += " and [t0].[PipelineCode] like @PipelineCode";
|
||||
listStr.Add(new SqlParameter("@PipelineCode", "%" + tvPipeCode.Text.Trim() + "%"));
|
||||
|
||||
}
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
|
||||
var a = dt.Rows.Count;
|
||||
var a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
|
||||
|
||||
//var b = (from x in Funs.DB.HJGL_Pipeline
|
||||
// join y in Funs.DB.HJGL_PipeLineMat on x.PipelineId equals y.PipelineId
|
||||
@@ -184,18 +142,14 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
// tn2.Expanded = true;
|
||||
//}
|
||||
tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
|
||||
tn2.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
||||
tn2.CommandName = "单位工程";
|
||||
tn2.EnableExpandEvent = true;
|
||||
tn2.EnableClickEvent = true;
|
||||
|
||||
rootNode2.Nodes.Add(tn2);
|
||||
if (a > 0)
|
||||
{
|
||||
// BindNodes(tn2);
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = "加载管线...";
|
||||
newNode.NodeID = "加载管线...";
|
||||
tn2.Nodes.Add(newNode);
|
||||
BindTestPackageNodes(tn2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -205,10 +159,99 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
#region 暂不有
|
||||
private void BindNodes(TreeNode node)
|
||||
{
|
||||
BLL.PipelineService.BindTreeNodes(node, this.tvPipeCode.Text.Trim(), txtMaterialCode.Text.Trim(), this.CurrUser.LoginProjectId, pageSize);
|
||||
var pipeline = GetTestPackagePipelineList(node.NodeID);
|
||||
var hJGL_WeldJoints = (from x in Funs.DB.HJGL_WeldJoint where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
|
||||
int pageindex = int.Parse(node.CommandName.Split('|')[0]);
|
||||
int pageCount = int.Parse(node.CommandName.Split('|')[1]);
|
||||
if (pageindex <= pageCount)
|
||||
{
|
||||
pipeline = pipeline.Skip(pageSize * (pageindex - 1)).Take(pageSize).ToList();
|
||||
foreach (var item in pipeline)
|
||||
{
|
||||
var jotCount = (from x in hJGL_WeldJoints where x.PipelineId == item.PipelineId select x).Count();
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = item.PipelineCode + "【" + jotCount.ToString() + " " + "焊口" + "】";
|
||||
newNode.NodeID = item.PipelineId;
|
||||
newNode.CommandName = "管线";
|
||||
newNode.EnableClickEvent = true;
|
||||
node.Nodes.Add(newNode);
|
||||
}
|
||||
if (pageindex < pageCount)
|
||||
{
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = "加载";
|
||||
newNode.NodeID = SQLHelper.GetNewID();
|
||||
newNode.CommandName = "加载";
|
||||
newNode.Icon = Icon.ArrowDown;
|
||||
newNode.EnableClickEvent = true;
|
||||
node.Nodes.Add(newNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private int GetUnitWorkTestPackagePipelineCount(string unitWorkId)
|
||||
{
|
||||
return (from x in Funs.DB.HJGL_Pipeline
|
||||
join y in Funs.DB.PTP_PipelineList on x.PipelineId equals y.PipelineId
|
||||
join z in Funs.DB.PTP_TestPackage on y.PTP_ID equals z.PTP_ID
|
||||
join m in Funs.DB.HJGL_PipeLineMat.Where(e => e.MaterialCode.Contains(txtMaterialCode.Text.Trim()))
|
||||
on x.PipelineId equals m.PipelineId into temp
|
||||
from m in temp.DefaultIfEmpty()
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.UnitWorkId == unitWorkId
|
||||
&& z.UnitWorkId == unitWorkId
|
||||
&& x.PipelineCode.Contains(tvPipeCode.Text.Trim())
|
||||
&& (string.IsNullOrEmpty(txtMaterialCode.Text.Trim()) || m != null)
|
||||
select x.PipelineId).Distinct().Count();
|
||||
}
|
||||
|
||||
private void BindTestPackageNodes(TreeNode unitWorkNode)
|
||||
{
|
||||
var testPackages = (from x in Funs.DB.PTP_TestPackage
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.UnitWorkId == unitWorkNode.NodeID
|
||||
orderby x.TestPackageNo
|
||||
select x).ToList();
|
||||
|
||||
foreach (var item in testPackages)
|
||||
{
|
||||
int pipelineCount = GetTestPackagePipelineList(item.PTP_ID).Count();
|
||||
if (pipelineCount == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = (string.IsNullOrEmpty(item.TestPackageNo) ? "未知" : item.TestPackageNo) + "【" + pipelineCount.ToString() + "】管线";
|
||||
newNode.NodeID = item.PTP_ID;
|
||||
newNode.CommandName = 1 + "|" + Funs.GetEndPageNumber(pipelineCount, pageSize);
|
||||
newNode.EnableClickEvent = true;
|
||||
newNode.EnableExpandEvent = true;
|
||||
unitWorkNode.Nodes.Add(newNode);
|
||||
|
||||
TreeNode loadNode = new TreeNode();
|
||||
loadNode.Text = "加载管线...";
|
||||
loadNode.NodeID = "加载管线...";
|
||||
newNode.Nodes.Add(loadNode);
|
||||
}
|
||||
}
|
||||
|
||||
private List<Model.HJGL_Pipeline> GetTestPackagePipelineList(string ptpId)
|
||||
{
|
||||
return (from x in Funs.DB.HJGL_Pipeline
|
||||
join y in Funs.DB.PTP_PipelineList on x.PipelineId equals y.PipelineId
|
||||
join m in Funs.DB.HJGL_PipeLineMat.Where(e => e.MaterialCode.Contains(txtMaterialCode.Text.Trim()))
|
||||
on x.PipelineId equals m.PipelineId into temp
|
||||
from m in temp.DefaultIfEmpty()
|
||||
where y.PTP_ID == ptpId
|
||||
&& x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.PipelineCode.Contains(tvPipeCode.Text.Trim())
|
||||
&& (string.IsNullOrEmpty(txtMaterialCode.Text.Trim()) || m != null)
|
||||
orderby x.PipelineCode
|
||||
select x).Distinct().ToList();
|
||||
}
|
||||
|
||||
protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
|
||||
{
|
||||
if (e.Node.Nodes[0].NodeID == "加载管线...")
|
||||
@@ -246,7 +289,7 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
this.hdUnitWorkId.Text = string.Empty;
|
||||
if (pipeline != null)
|
||||
{
|
||||
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
|
||||
this.hdUnitWorkId.Text = pipeline.UnitWorkId;
|
||||
|
||||
this.BindGrid1(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
|
||||
this.BindGrid2(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
|
||||
@@ -277,7 +320,7 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
/// </summary>
|
||||
private void BindGrid1(string pipelineId, string unitworkid)
|
||||
{
|
||||
string strSql = @" SELECT pipe.PipeLineMatId, lib.MaterialCode,lib.MaterialName,lib.MaterialUnit,
|
||||
string strSql = @" SELECT pipe.PipeLineMatId, lib.MaterialCode,lib.Code,lib.HeatNo,lib.BatchNo,lib.MaterialName,lib.MaterialUnit,
|
||||
lib.MaterialSpec,lib.MaterialMade,lib.MaterialDef,pipe.Number,pipe.PrefabricatedComponents
|
||||
FROM dbo.HJGL_PipeLineMat pipe
|
||||
LEFT JOIN dbo.HJGL_MaterialCodeLib lib ON lib.MaterialCode = pipe.MaterialCode
|
||||
@@ -312,7 +355,7 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
}
|
||||
private void BindGrid2(string pipelineId, string unitworkid)
|
||||
{
|
||||
string strSql = @" SELECT pipe.PipeLineMatId, lib.MaterialCode,lib.MaterialName,lib.MaterialUnit,
|
||||
string strSql = @" SELECT pipe.PipeLineMatId, lib.MaterialCode,lib.Code,lib.HeatNo,lib.BatchNo,lib.MaterialName,lib.MaterialUnit,
|
||||
lib.MaterialSpec,lib.MaterialMade,lib.MaterialDef,pipe.Number
|
||||
FROM dbo.HJGL_PipeLineMat pipe
|
||||
LEFT JOIN dbo.HJGL_MaterialCodeLib lib ON lib.MaterialCode = pipe.MaterialCode
|
||||
@@ -343,7 +386,7 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
|
||||
private void BindGrid3(string pipelineId, string unitworkid)
|
||||
{
|
||||
string strSql = @" SELECT pipe.PipeLineMatId, lib.MaterialCode,lib.MaterialName,lib.MaterialUnit,
|
||||
string strSql = @" SELECT pipe.PipeLineMatId, lib.MaterialCode,lib.Code,lib.HeatNo,lib.BatchNo,lib.MaterialName,lib.MaterialUnit,
|
||||
lib.MaterialSpec,lib.MaterialMade,lib.MaterialDef,pipe.Number,pipe.PrefabricatedComponents
|
||||
FROM dbo.HJGL_PipeLineMat pipe
|
||||
LEFT JOIN dbo.HJGL_MaterialCodeLib lib ON lib.MaterialCode = pipe.MaterialCode
|
||||
@@ -696,7 +739,7 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
protected void TabStrip1_TabIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
string pipelineid = "";
|
||||
if (this.tvControlItem.SelectedNode != null && this.tvControlItem.SelectedNode.CommandName != "单位工程")
|
||||
if (this.tvControlItem.SelectedNode != null && this.tvControlItem.SelectedNode.CommandName == "管线")
|
||||
{
|
||||
pipelineid = this.tvControlItem.SelectedNodeID;
|
||||
}
|
||||
@@ -1021,4 +1064,4 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,9 +34,21 @@
|
||||
</Toolbars>
|
||||
<Columns>
|
||||
<f:RenderField Width="200px" ColumnID="MaterialCode" DataField="MaterialCode"
|
||||
FieldType="String" HeaderText="材料编码" HeaderTextAlign="Center"
|
||||
FieldType="String" HeaderText="材料主编码" HeaderTextAlign="Center"
|
||||
TextAlign="Left" SortField="MaterialCode">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="150px" ColumnID="Code" DataField="Code"
|
||||
FieldType="String" HeaderText="材料编码" HeaderTextAlign="Center"
|
||||
TextAlign="Left" SortField="Code">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="120px" ColumnID="HeatNo" DataField="HeatNo"
|
||||
FieldType="String" HeaderText="炉号" HeaderTextAlign="Center"
|
||||
TextAlign="Left" SortField="HeatNo">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="120px" ColumnID="BatchNo" DataField="BatchNo"
|
||||
FieldType="String" HeaderText="批号" HeaderTextAlign="Center"
|
||||
TextAlign="Left" SortField="BatchNo">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="200px" ColumnID="MaterialNum" DataField="MaterialNum"
|
||||
FieldType="String" HeaderText="数量" HeaderTextAlign="Center"
|
||||
TextAlign="Left" SortField="MaterialNum">
|
||||
|
||||
@@ -88,6 +88,8 @@
|
||||
</f:Button>
|
||||
<f:Button ID="btnImportQRCode" Text="导入二维码信息" ToolTip="导入二维码信息" Icon="PackageIn" runat="server" OnClick="btnImportQRCode_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnImportComponentJoint" Text="导入组件焊口信息" ToolTip="导入组件焊口信息" Icon="PackageIn" runat="server" OnClick="btnImportComponentJoint_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnBatchAdd" Text="批量增加" Icon="TableAdd" Hidden="true"
|
||||
runat="server" OnClick="btnBatchAdd_Click">
|
||||
</f:Button>
|
||||
|
||||
@@ -89,23 +89,19 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
{
|
||||
foreach (var q in unitWork1)
|
||||
{
|
||||
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipeArea == "1" && x.PipelineCode.Contains(txtPipelineCode.Text.Trim()) select x).Count();
|
||||
int a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
|
||||
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
||||
TreeNode tn1 = new TreeNode();
|
||||
tn1.NodeID = q.UnitWorkId;
|
||||
tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
|
||||
tn1.ToolTip = "施工单位:" + unitNamesUnitIds;
|
||||
tn1.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
||||
tn1.CommandName = "单位工程";
|
||||
tn1.EnableClickEvent = true;
|
||||
tn1.EnableExpandEvent = true;
|
||||
rootNode1.Nodes.Add(tn1);
|
||||
if (a > 0)
|
||||
{
|
||||
// BindNodes(tn1);
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = "加载管线...";
|
||||
newNode.NodeID = "加载管线...";
|
||||
tn1.Nodes.Add(newNode);
|
||||
BindTestPackageNodes(tn1);
|
||||
}
|
||||
//if (a > 0)
|
||||
//{
|
||||
@@ -117,7 +113,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
{
|
||||
foreach (var q in unitWork2)
|
||||
{
|
||||
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipeArea == "1" && x.PipelineCode.Contains(txtPipelineCode.Text.Trim()) select x).Count();
|
||||
int a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
|
||||
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
||||
TreeNode tn2 = new TreeNode();
|
||||
tn2.NodeID = q.UnitWorkId;
|
||||
@@ -127,17 +123,13 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
tn2.Expanded = true;
|
||||
}
|
||||
tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
|
||||
tn2.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
||||
tn2.CommandName = "单位工程";
|
||||
tn2.EnableClickEvent = true;
|
||||
tn2.EnableExpandEvent = true;
|
||||
rootNode2.Nodes.Add(tn2);
|
||||
if (a > 0)
|
||||
{
|
||||
// BindNodes(tn1);
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = "加载管线...";
|
||||
newNode.NodeID = "加载管线...";
|
||||
tn2.Nodes.Add(newNode);
|
||||
BindTestPackageNodes(tn2);
|
||||
}
|
||||
//if (a > 0)
|
||||
//{
|
||||
@@ -152,10 +144,11 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
List<Model.HJGL_Pipeline> pipeline = new List<Model.HJGL_Pipeline>();
|
||||
var pipelines = from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.PipeArea == "1" select x;
|
||||
pipeline = (from x in pipelines
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == node.NodeID
|
||||
join y in Funs.DB.PTP_PipelineList on x.PipelineId equals y.PipelineId
|
||||
where y.PTP_ID == node.NodeID
|
||||
&& x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
|
||||
orderby x.PipelineCode
|
||||
select x).ToList();
|
||||
select x).Distinct().ToList();
|
||||
int pageindex = int.Parse(node.CommandName.Split('|')[0]);
|
||||
int pageCount = int.Parse(node.CommandName.Split('|')[1]);
|
||||
if (pageindex <= pageCount)
|
||||
@@ -187,6 +180,61 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
|
||||
|
||||
}
|
||||
|
||||
private int GetUnitWorkTestPackagePipelineCount(string unitWorkId)
|
||||
{
|
||||
return (from x in Funs.DB.HJGL_Pipeline
|
||||
join y in Funs.DB.PTP_PipelineList on x.PipelineId equals y.PipelineId
|
||||
join z in Funs.DB.PTP_TestPackage on y.PTP_ID equals z.PTP_ID
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.UnitWorkId == unitWorkId
|
||||
&& z.UnitWorkId == unitWorkId
|
||||
&& x.PipeArea == "1"
|
||||
&& x.PipelineCode.Contains(txtPipelineCode.Text.Trim())
|
||||
select x.PipelineId).Distinct().Count();
|
||||
}
|
||||
|
||||
private void BindTestPackageNodes(TreeNode unitWorkNode)
|
||||
{
|
||||
var testPackages = (from x in Funs.DB.PTP_TestPackage
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.UnitWorkId == unitWorkNode.NodeID
|
||||
orderby x.TestPackageNo
|
||||
select x).ToList();
|
||||
|
||||
foreach (var item in testPackages)
|
||||
{
|
||||
int pipelineCount = GetTestPackagePipelineCount(item.PTP_ID);
|
||||
if (pipelineCount == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = (string.IsNullOrEmpty(item.TestPackageNo) ? "未知" : item.TestPackageNo) + "【" + pipelineCount.ToString() + "】管线";
|
||||
newNode.NodeID = item.PTP_ID;
|
||||
newNode.CommandName = 1 + "|" + Funs.GetEndPageNumber(pipelineCount, pageSize);
|
||||
newNode.EnableClickEvent = true;
|
||||
newNode.EnableExpandEvent = true;
|
||||
unitWorkNode.Nodes.Add(newNode);
|
||||
|
||||
TreeNode loadNode = new TreeNode();
|
||||
loadNode.Text = "加载管线...";
|
||||
loadNode.NodeID = "加载管线...";
|
||||
newNode.Nodes.Add(loadNode);
|
||||
}
|
||||
}
|
||||
|
||||
private int GetTestPackagePipelineCount(string ptpId)
|
||||
{
|
||||
return (from x in Funs.DB.HJGL_Pipeline
|
||||
join y in Funs.DB.PTP_PipelineList on x.PipelineId equals y.PipelineId
|
||||
where y.PTP_ID == ptpId
|
||||
&& x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.PipeArea == "1"
|
||||
&& x.PipelineCode.Contains(txtPipelineCode.Text.Trim())
|
||||
select x.PipelineId).Distinct().Count();
|
||||
}
|
||||
#endregion
|
||||
protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
|
||||
{
|
||||
@@ -205,20 +253,26 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
/// <param name="e"></param>
|
||||
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
||||
{
|
||||
if (e.CommandName.Split('|').Length == 2)
|
||||
if (e.CommandName == "单位工程")
|
||||
{
|
||||
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNodeID;
|
||||
|
||||
WeldingDailyService.InitDownListByUnitWortId(drpWeldingDailyCode, true, this.tvControlItem.SelectedNodeID);
|
||||
|
||||
}
|
||||
else if (e.CommandName.Split('|').Length == 2)
|
||||
{
|
||||
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
|
||||
|
||||
WeldingDailyService.InitDownListByUnitWortId(drpWeldingDailyCode, true, this.hdUnitWorkId.Text);
|
||||
}
|
||||
else if (e.CommandName == "管线")
|
||||
{
|
||||
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
|
||||
this.hdUnitWorkId.Text = string.Empty;
|
||||
if (pipeline != null)
|
||||
{
|
||||
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
|
||||
this.hdUnitWorkId.Text = pipeline.UnitWorkId;
|
||||
}
|
||||
}
|
||||
else if (e.CommandName == "加载")
|
||||
@@ -255,12 +309,17 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
|
||||
|
||||
if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
|
||||
if (tvControlItem.SelectedNode.CommandName == "单位工程")
|
||||
{
|
||||
strSql += " and pipe.UnitWorkId =@UnitWorkId";
|
||||
listStr.Add(new SqlParameter("@UnitWorkId", this.tvControlItem.SelectedNodeID));
|
||||
|
||||
}
|
||||
else if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
|
||||
{
|
||||
strSql += " and exists(select 1 from PTP_PipelineList ptpPipe where ptpPipe.PipelineId = pipe.PipelineId and ptpPipe.PTP_ID = @PTP_ID)";
|
||||
listStr.Add(new SqlParameter("@PTP_ID", this.tvControlItem.SelectedNodeID));
|
||||
}
|
||||
else if (tvControlItem.SelectedNode.CommandName == "管线")
|
||||
{
|
||||
strSql += " and com.PipelineId = @PipelineId ";
|
||||
@@ -594,6 +653,12 @@ if (!string.IsNullOrEmpty(drpFlowingSection.SelectedValue) && drpFlowingSection.
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("PrePipelineQRCodeIn.aspx?", "导入 - ")));
|
||||
|
||||
}
|
||||
|
||||
protected void btnImportComponentJoint_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("PrePipelineComponentJointIn.aspx?", "导入 - ")));
|
||||
|
||||
}
|
||||
protected void btnSinglePreview_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -708,4 +773,4 @@ if (!string.IsNullOrEmpty(drpFlowingSection.SelectedValue) && drpFlowingSection.
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,6 +239,15 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImportQRCode;
|
||||
|
||||
/// <summary>
|
||||
/// btnImportComponentJoint 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImportComponentJoint;
|
||||
|
||||
/// <summary>
|
||||
/// btnBatchAdd 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PrePipelineComponentJointIn.aspx.cs" Inherits="FineUIPro.Web.HJGL.PreDesign.PrePipelineComponentJointIn" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" />
|
||||
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
|
||||
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar2" Position="Top" ToolbarAlign="Right" runat="server">
|
||||
<Items>
|
||||
<f:HiddenField ID="hdFileName" runat="server">
|
||||
</f:HiddenField>
|
||||
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" ToolTip="下载模板" Text="下载模板" OnClick="btnDownLoad_Click" EnablePostBack="true" EnableAjax="false">
|
||||
</f:Button>
|
||||
<f:ToolbarFill runat="server"></f:ToolbarFill>
|
||||
<f:Button ID="btnAudit" Icon="ApplicationEdit" runat="server" ToolTip="审核" Text="审核" ValidateForms="SimpleForm1"
|
||||
OnClick="btnAudit_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" Icon="ApplicationGet" runat="server" ToolTip="导入" Text="导入" ValidateForms="SimpleForm1"
|
||||
OnClick="btnImport_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="提交" Text="提交" ValidateForms="SimpleForm1"
|
||||
OnClick="btnSave_Click">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Rows>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:FileUpload runat="server" ID="fuAttachUrl" EmptyText="选择要导入的文件" Label="选择要导入的文件"
|
||||
LabelWidth="150px">
|
||||
</f:FileUpload>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="组件焊口信息"
|
||||
EnableCollapse="true" runat="server" BoxFlex="1" DataKeyNames="WeldJointId" AllowCellEditing="true"
|
||||
AllowColumnLocking="true" EnableColumnLines="true" ClicksToEdit="2" DataIDField="WeldJointId"
|
||||
AllowSorting="true" SortField="PipelineCode" SortDirection="ASC"
|
||||
AllowPaging="true" IsDatabasePaging="true" PageSize="15"
|
||||
EnableTextSelection="True">
|
||||
<Columns>
|
||||
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号"
|
||||
Width="60px" HeaderTextAlign="Center" TextAlign="Center" />
|
||||
<f:RenderField Width="180px" ColumnID="PipelineCode" DataField="PipelineCode" SortField="PipelineCode"
|
||||
FieldType="String" HeaderText="管线号" HeaderTextAlign="Center"
|
||||
TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="200px" ColumnID="PipelineComponentCode" DataField="PipelineComponentCode" SortField="PipelineComponentCode"
|
||||
FieldType="String" HeaderText="预制组件" HeaderTextAlign="Center"
|
||||
TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="200px" ColumnID="WeldJointCode" DataField="WeldJointCode" SortField="WeldJointCode"
|
||||
FieldType="String" HeaderText="焊口号" HeaderTextAlign="Center"
|
||||
TextAlign="Left">
|
||||
</f:RenderField>
|
||||
</Columns>
|
||||
<PageItems>
|
||||
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
|
||||
</f:ToolbarSeparator>
|
||||
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
|
||||
</f:ToolbarText>
|
||||
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
|
||||
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
|
||||
<f:ListItem Text="10" Value="10" />
|
||||
<f:ListItem Text="15" Value="15" />
|
||||
<f:ListItem Text="20" Value="20" />
|
||||
<f:ListItem Text="25" Value="25" />
|
||||
<f:ListItem Text="所有行" Value="10000" />
|
||||
</f:DropDownList>
|
||||
</PageItems>
|
||||
</f:Grid>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
</Rows>
|
||||
</f:Form>
|
||||
</form>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,336 @@
|
||||
using BLL;
|
||||
using MiniExcelLibs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.HJGL.PreDesign
|
||||
{
|
||||
public partial class PrePipelineComponentJointIn : PageBase
|
||||
{
|
||||
private string initPath = Const.ExcelUrl;
|
||||
|
||||
public static List<ComponentJointImportItem> ComponentJointList = new List<ComponentJointImportItem>();
|
||||
|
||||
public static string errorInfos = string.Empty;
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.hdFileName.Text = string.Empty;
|
||||
if (ComponentJointList != null)
|
||||
{
|
||||
ComponentJointList.Clear();
|
||||
}
|
||||
errorInfos = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnAudit_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (this.fuAttachUrl.HasFile == false)
|
||||
{
|
||||
ShowNotify("请您选择Excel文件!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string isXls = Path.GetExtension(this.fuAttachUrl.FileName).ToString().Trim().ToLower();
|
||||
if (isXls != ".xlsx")
|
||||
{
|
||||
ShowNotify("只可以选择Excel文件!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
ComponentJointList.Clear();
|
||||
errorInfos = string.Empty;
|
||||
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initFullPath = rootPath + initPath;
|
||||
if (!Directory.Exists(initFullPath))
|
||||
{
|
||||
Directory.CreateDirectory(initFullPath);
|
||||
}
|
||||
|
||||
this.hdFileName.Text = BLL.Funs.GetNewFileName() + isXls;
|
||||
string filePath = initFullPath + this.hdFileName.Text;
|
||||
this.fuAttachUrl.PostedFile.SaveAs(filePath);
|
||||
ImportXlsToData(filePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Alert alert = new Alert
|
||||
{
|
||||
Message = "'" + ex.Message + "'",
|
||||
Target = Target.Self
|
||||
};
|
||||
alert.Show();
|
||||
}
|
||||
}
|
||||
|
||||
private void ImportXlsToData(string fileName)
|
||||
{
|
||||
var rows = MiniExcel.QueryAsDataTable(fileName, useHeaderRow: true);
|
||||
Model.ResponeData responeData = AddDatasetToSQL(rows, 3);
|
||||
if (responeData.code == 1)
|
||||
{
|
||||
ShowNotify("审核完成,请点击导入!", MessageBoxIcon.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert alert = new Alert
|
||||
{
|
||||
Message = responeData.message,
|
||||
Target = Target.Self
|
||||
};
|
||||
alert.Show();
|
||||
}
|
||||
}
|
||||
|
||||
private Model.ResponeData AddDatasetToSQL(DataTable pds, int cols)
|
||||
{
|
||||
Model.ResponeData responeData = new Model.ResponeData();
|
||||
List<string> result = new List<string>();
|
||||
if (pds == null)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "导入数据为空!";
|
||||
return responeData;
|
||||
}
|
||||
|
||||
int ic = pds.Columns.Count;
|
||||
int ir = pds.Rows.Count;
|
||||
if (ic < cols || !pds.Columns.Contains("管线号") || !pds.Columns.Contains("预制组件") || !pds.Columns.Contains("焊口号"))
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "导入Excel格式错误!模板列必须包含:管线号、预制组件、焊口号";
|
||||
return responeData;
|
||||
}
|
||||
if (ir == 0)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "导入数据为空!";
|
||||
return responeData;
|
||||
}
|
||||
|
||||
var getPipeline = from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId select x;
|
||||
List<ComponentJointImportItem> importItems = new List<ComponentJointImportItem>();
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
{
|
||||
string pipelineCode = GetCellValue(pds.Rows[i], "管线号");
|
||||
string pipelineComponentCode = GetCellValue(pds.Rows[i], "预制组件");
|
||||
string weldJointCode = GetCellValue(pds.Rows[i], "焊口号");
|
||||
|
||||
if (string.IsNullOrEmpty(pipelineCode) && string.IsNullOrEmpty(pipelineComponentCode) && string.IsNullOrEmpty(weldJointCode))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(pipelineCode))
|
||||
{
|
||||
result.Add("第" + (i + 2).ToString() + "行,管线号,此项为必填项!");
|
||||
continue;
|
||||
}
|
||||
if (string.IsNullOrEmpty(pipelineComponentCode))
|
||||
{
|
||||
result.Add("第" + (i + 2).ToString() + "行,预制组件,此项为必填项!");
|
||||
continue;
|
||||
}
|
||||
if (string.IsNullOrEmpty(weldJointCode))
|
||||
{
|
||||
result.Add("第" + (i + 2).ToString() + "行,焊口号,此项为必填项!");
|
||||
continue;
|
||||
}
|
||||
|
||||
var pipeline = getPipeline.FirstOrDefault(x => x.PipelineCode == pipelineCode);
|
||||
if (pipeline == null)
|
||||
{
|
||||
result.Add("第" + (i + 2).ToString() + "行,不存在此管线号-" + pipelineCode);
|
||||
continue;
|
||||
}
|
||||
|
||||
var pipelineComponent = HJGL_PipelineComponentService.GetPipelineComponentByCodeandpipelineId(pipelineComponentCode, pipeline.PipelineId);
|
||||
if (pipelineComponent == null)
|
||||
{
|
||||
result.Add("第" + (i + 2).ToString() + "行,不存在此预制组件-" + pipelineComponentCode);
|
||||
continue;
|
||||
}
|
||||
|
||||
var weldJoint = WeldJointService.GetWeldJointsByWeldJointCode(pipeline.PipelineId, weldJointCode);
|
||||
if (weldJoint == null)
|
||||
{
|
||||
result.Add("第" + (i + 2).ToString() + "行,不存在此焊口号-" + weldJointCode);
|
||||
continue;
|
||||
}
|
||||
|
||||
importItems.Add(new ComponentJointImportItem
|
||||
{
|
||||
PipelineId = pipeline.PipelineId,
|
||||
PipelineCode = pipeline.PipelineCode,
|
||||
PipelineComponentId = pipelineComponent.PipelineComponentId,
|
||||
PipelineComponentCode = pipelineComponent.PipelineComponentCode,
|
||||
WeldJointId = weldJoint.WeldJointId,
|
||||
WeldJointCode = weldJoint.WeldJointCode
|
||||
});
|
||||
}
|
||||
|
||||
var conflictWeldJoints = importItems
|
||||
.GroupBy(x => x.WeldJointId)
|
||||
.Where(x => x.Select(y => y.PipelineComponentId).Distinct().Count() > 1)
|
||||
.Select(x => x.First().PipelineCode + "-" + x.First().WeldJointCode)
|
||||
.ToList();
|
||||
if (conflictWeldJoints.Count > 0)
|
||||
{
|
||||
result.Add("同一焊口不能导入到多个组件:" + string.Join("、", conflictWeldJoints));
|
||||
}
|
||||
|
||||
if (result.Count > 0)
|
||||
{
|
||||
ComponentJointList.Clear();
|
||||
errorInfos = string.Join("|", result.Distinct());
|
||||
responeData.code = 0;
|
||||
responeData.message = errorInfos;
|
||||
return responeData;
|
||||
}
|
||||
|
||||
ComponentJointList = importItems
|
||||
.GroupBy(x => new { x.PipelineComponentId, x.WeldJointId })
|
||||
.Select(x => x.First())
|
||||
.ToList();
|
||||
errorInfos = string.Empty;
|
||||
responeData.code = ComponentJointList.Count > 0 ? 1 : 0;
|
||||
responeData.message = ComponentJointList.Count > 0 ? string.Empty : "导入数据为空!";
|
||||
return responeData;
|
||||
}
|
||||
|
||||
protected void btnImport_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(errorInfos))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.hdFileName.Text))
|
||||
{
|
||||
if (ComponentJointList.Count > 0)
|
||||
{
|
||||
this.Grid1.Hidden = false;
|
||||
this.Grid1.DataIDField = "WeldJointId";
|
||||
this.Grid1.DataSource = ComponentJointList;
|
||||
this.Grid1.DataBind();
|
||||
Grid1.RecordCount = ComponentJointList.Count;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("请先审核要导入的文件!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("请先将错误数据修正,再重新导入提交!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(errorInfos))
|
||||
{
|
||||
ShowNotify("请先将错误数据修正,再重新导入提交!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ComponentJointList.Count > 0)
|
||||
{
|
||||
foreach (var item in ComponentJointList)
|
||||
{
|
||||
var componentJoint = BLL.HJGL_PipelineComponentjointService.GetHJGL_Pipeline_ComponentJointByWeldJointId(item.WeldJointId);
|
||||
if (componentJoint != null)
|
||||
{
|
||||
componentJoint.PipelineComponentCode = item.PipelineComponentCode;
|
||||
componentJoint.PipelineComponentId = item.PipelineComponentId;
|
||||
componentJoint.WeldJointCode = item.WeldJointCode;
|
||||
componentJoint.WeldJointId = item.WeldJointId;
|
||||
HJGL_PipelineComponentjointService.UpdateHJGL_Pipeline_ComponentJoint(componentJoint);
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.HJGL_Pipeline_ComponentJoint newComponentJoint = new Model.HJGL_Pipeline_ComponentJoint();
|
||||
newComponentJoint.Id = SQLHelper.GetNewID();
|
||||
newComponentJoint.PipelineComponentCode = item.PipelineComponentCode;
|
||||
newComponentJoint.PipelineComponentId = item.PipelineComponentId;
|
||||
newComponentJoint.WeldJointCode = item.WeldJointCode;
|
||||
newComponentJoint.WeldJointId = item.WeldJointId;
|
||||
newComponentJoint.State = 0;
|
||||
HJGL_PipelineComponentjointService.AddHJGL_Pipeline_ComponentJoint(newComponentJoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string filePath = rootPath + initPath + this.hdFileName.Text;
|
||||
if (filePath != string.Empty && System.IO.File.Exists(filePath))
|
||||
{
|
||||
System.IO.File.Delete(filePath);
|
||||
}
|
||||
ShowNotify("导入成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
|
||||
protected void btnDownLoad_Click(object sender, EventArgs e)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string tempDirectory = rootPath + @"File\Excel\Temp\";
|
||||
if (!Directory.Exists(tempDirectory))
|
||||
{
|
||||
Directory.CreateDirectory(tempDirectory);
|
||||
}
|
||||
string tempPath = tempDirectory + "组件焊口信息导入模板" + string.Format("{0:yyyyMMddHHmmss}", DateTime.Now) + ".xlsx";
|
||||
DataTable template = new DataTable();
|
||||
template.Columns.Add("管线号");
|
||||
template.Columns.Add("预制组件");
|
||||
template.Columns.Add("焊口号");
|
||||
MiniExcel.SaveAs(tempPath, template);
|
||||
|
||||
FileInfo info = new FileInfo(tempPath);
|
||||
long fileSize = info.Length;
|
||||
Response.ClearContent();
|
||||
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode("组件焊口信息导入模板.xlsx", System.Text.Encoding.UTF8));
|
||||
Response.ContentType = "excel/plain";
|
||||
Response.ContentEncoding = System.Text.Encoding.UTF8;
|
||||
Response.AddHeader("Content-Length", fileSize.ToString().Trim());
|
||||
Response.TransmitFile(tempPath, 0, fileSize);
|
||||
Response.Flush();
|
||||
Response.Close();
|
||||
File.Delete(tempPath);
|
||||
}
|
||||
|
||||
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
||||
this.Grid1.DataSource = ComponentJointList;
|
||||
this.Grid1.DataBind();
|
||||
Grid1.RecordCount = ComponentJointList.Count;
|
||||
}
|
||||
|
||||
private string GetCellValue(DataRow row, string columnName)
|
||||
{
|
||||
return Convert.ToString(row[columnName]).Replace("\n", "").Replace(" ", "").Replace("\t", "").Replace("\r", "").Trim();
|
||||
}
|
||||
|
||||
public class ComponentJointImportItem
|
||||
{
|
||||
public string PipelineId { get; set; }
|
||||
|
||||
public string PipelineCode { get; set; }
|
||||
|
||||
public string PipelineComponentId { get; set; }
|
||||
|
||||
public string PipelineComponentCode { get; set; }
|
||||
|
||||
public string WeldJointId { get; set; }
|
||||
|
||||
public string WeldJointCode { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.HJGL.PreDesign
|
||||
{
|
||||
|
||||
|
||||
public partial class PrePipelineComponentJointIn
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// SimpleForm1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Form SimpleForm1;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar2;
|
||||
|
||||
/// <summary>
|
||||
/// hdFileName 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.HiddenField hdFileName;
|
||||
|
||||
/// <summary>
|
||||
/// btnDownLoad 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnDownLoad;
|
||||
|
||||
/// <summary>
|
||||
/// btnAudit 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnAudit;
|
||||
|
||||
/// <summary>
|
||||
/// btnImport 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
/// <summary>
|
||||
/// btnSave 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSave;
|
||||
|
||||
/// <summary>
|
||||
/// fuAttachUrl 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.FileUpload fuAttachUrl;
|
||||
|
||||
/// <summary>
|
||||
/// Grid1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarSeparator1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarText1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarText ToolbarText1;
|
||||
|
||||
/// <summary>
|
||||
/// ddlPageSize 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList ddlPageSize;
|
||||
}
|
||||
}
|
||||
@@ -86,31 +86,24 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
int a = 0;
|
||||
if (cbAllPipeline.Checked)
|
||||
{
|
||||
a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim()) select x).Count();
|
||||
a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
|
||||
}
|
||||
else
|
||||
{
|
||||
a = (from x in Funs.DB.HJGL_Pipeline
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
|
||||
&& (from y in Funs.DB.HJGL_WeldJoint where y.PipelineId == x.PipelineId && y.IsTwoJoint == true select y).Count() > 0
|
||||
select x).Count();
|
||||
a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
|
||||
}
|
||||
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
||||
TreeNode tn1 = new TreeNode();
|
||||
tn1.NodeID = q.UnitWorkId;
|
||||
tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
|
||||
tn1.ToolTip = "施工单位:" + unitNamesUnitIds;
|
||||
tn1.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
||||
tn1.CommandName = "单位工程";
|
||||
tn1.EnableClickEvent = true;
|
||||
tn1.EnableExpandEvent = true;
|
||||
rootNode1.Nodes.Add(tn1);
|
||||
if (a > 0)
|
||||
{
|
||||
// BindNodes(tn1);
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = "加载管线...";
|
||||
newNode.NodeID = "加载管线...";
|
||||
tn1.Nodes.Add(newNode);
|
||||
BindTestPackageNodes(tn1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -121,14 +114,11 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
int a = 0;
|
||||
if (cbAllPipeline.Checked)
|
||||
{
|
||||
a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim()) select x).Count();
|
||||
a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
|
||||
}
|
||||
else
|
||||
{
|
||||
a = (from x in Funs.DB.HJGL_Pipeline
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
|
||||
&& (from y in Funs.DB.HJGL_WeldJoint where y.PipelineId == x.PipelineId && y.IsTwoJoint == true select y).Count() > 0
|
||||
select x).Count();
|
||||
a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
|
||||
}
|
||||
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
||||
TreeNode tn2 = new TreeNode();
|
||||
@@ -139,17 +129,13 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
tn2.Expanded = true;
|
||||
}
|
||||
tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
|
||||
tn2.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
||||
tn2.CommandName = "单位工程";
|
||||
tn2.EnableClickEvent = true;
|
||||
tn2.EnableExpandEvent = true;
|
||||
rootNode2.Nodes.Add(tn2);
|
||||
if (a > 0)
|
||||
{
|
||||
// BindNodes(tn1);
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = "加载管线...";
|
||||
newNode.NodeID = "加载管线...";
|
||||
tn2.Nodes.Add(newNode);
|
||||
BindTestPackageNodes(tn2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,27 +144,13 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
private void BindNodes(TreeNode node)
|
||||
{
|
||||
List<Model.HJGL_Pipeline> pipeline = new List<Model.HJGL_Pipeline>();
|
||||
pipeline = (from x in Funs.DB.HJGL_Pipeline
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == node.NodeID
|
||||
&& x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
|
||||
orderby x.PipelineCode
|
||||
select x).ToList();
|
||||
if (cbAllPipeline.Checked)
|
||||
{
|
||||
pipeline = (from x in Funs.DB.HJGL_Pipeline
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == node.NodeID
|
||||
&& x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
|
||||
orderby x.PipelineCode
|
||||
select x).ToList();
|
||||
pipeline = GetTestPackagePipelineList(node.NodeID);
|
||||
}
|
||||
else
|
||||
{
|
||||
pipeline = (from x in Funs.DB.HJGL_Pipeline
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == node.NodeID
|
||||
&& x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
|
||||
&& (from y in Funs.DB.HJGL_WeldJoint where y.PipelineId == x.PipelineId && y.IsTwoJoint == true select y).Count() > 0
|
||||
orderby x.PipelineCode
|
||||
select x).ToList();
|
||||
pipeline = GetTestPackagePipelineList(node.NodeID);
|
||||
}
|
||||
var hJGL_WeldJoints = (from x in Funs.DB.HJGL_WeldJoint where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
|
||||
|
||||
@@ -224,6 +196,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
newNode.Text = item.PipelineCode + "【" + jotCount.ToString() + " " + "焊口" + "】";
|
||||
newNode.ToolTip = "管线号【焊口数】";
|
||||
newNode.NodeID = item.PipelineId;
|
||||
newNode.CommandName = "管线";
|
||||
newNode.EnableClickEvent = true;
|
||||
node.Nodes.Add(newNode);
|
||||
}
|
||||
@@ -240,6 +213,65 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
}
|
||||
}
|
||||
|
||||
private int GetUnitWorkTestPackagePipelineCount(string unitWorkId)
|
||||
{
|
||||
var testPackages = (from x in Funs.DB.PTP_TestPackage
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.UnitWorkId == unitWorkId
|
||||
select x.PTP_ID).ToList();
|
||||
|
||||
return testPackages.Select(x => GetTestPackagePipelineList(x).Count()).Sum();
|
||||
}
|
||||
|
||||
private void BindTestPackageNodes(TreeNode unitWorkNode)
|
||||
{
|
||||
var testPackages = (from x in Funs.DB.PTP_TestPackage
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.UnitWorkId == unitWorkNode.NodeID
|
||||
orderby x.TestPackageNo
|
||||
select x).ToList();
|
||||
|
||||
foreach (var item in testPackages)
|
||||
{
|
||||
int pipelineCount = GetTestPackagePipelineList(item.PTP_ID).Count();
|
||||
if (pipelineCount == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = (string.IsNullOrEmpty(item.TestPackageNo) ? "未知" : item.TestPackageNo) + "【" + pipelineCount.ToString() + "】管线";
|
||||
newNode.NodeID = item.PTP_ID;
|
||||
newNode.CommandName = 1 + "|" + Funs.GetEndPageNumber(pipelineCount, pageSize);
|
||||
newNode.EnableClickEvent = true;
|
||||
newNode.EnableExpandEvent = true;
|
||||
unitWorkNode.Nodes.Add(newNode);
|
||||
|
||||
TreeNode loadNode = new TreeNode();
|
||||
loadNode.Text = "加载管线...";
|
||||
loadNode.NodeID = "加载管线...";
|
||||
newNode.Nodes.Add(loadNode);
|
||||
}
|
||||
}
|
||||
|
||||
private List<Model.HJGL_Pipeline> GetTestPackagePipelineList(string ptpId)
|
||||
{
|
||||
var pipeline = (from x in Funs.DB.HJGL_Pipeline
|
||||
join y in Funs.DB.PTP_PipelineList on x.PipelineId equals y.PipelineId
|
||||
where y.PTP_ID == ptpId
|
||||
&& x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
|
||||
orderby x.PipelineCode
|
||||
select x).Distinct().ToList();
|
||||
|
||||
if (!cbAllPipeline.Checked)
|
||||
{
|
||||
pipeline = pipeline.Where(x => (from y in Funs.DB.HJGL_WeldJoint where y.PipelineId == x.PipelineId && y.IsTwoJoint == true select y).Count() > 0).ToList();
|
||||
}
|
||||
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
#region 点击TreeView
|
||||
/// <summary>
|
||||
/// 点击TreeView
|
||||
@@ -263,12 +295,12 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
{
|
||||
if (pipeline != null)
|
||||
{
|
||||
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
|
||||
this.hdUnitWorkId.Text = pipeline.UnitWorkId;
|
||||
this.BindGrid();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNodeID;
|
||||
this.hdUnitWorkId.Text = e.CommandName.Split('|').Length == 2 ? this.tvControlItem.SelectedNode.ParentNode.NodeID : this.tvControlItem.SelectedNodeID;
|
||||
NoAuditBindGrid();
|
||||
}
|
||||
|
||||
@@ -362,8 +394,16 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
WHERE IsTwoJoint = 1";
|
||||
List<SqlParameter> listStr = new List<SqlParameter> { };
|
||||
|
||||
strSql += " AND UnitWorkId =@UnitWorkId";
|
||||
listStr.Add(new SqlParameter("@UnitWorkId", this.tvControlItem.SelectedNodeID));
|
||||
if (this.tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
|
||||
{
|
||||
strSql += " AND EXISTS(SELECT 1 FROM PTP_PipelineList ptpPipe WHERE ptpPipe.PipelineId = View_HJGL_WeldJoint.PipelineId AND ptpPipe.PTP_ID = @PTP_ID)";
|
||||
listStr.Add(new SqlParameter("@PTP_ID", this.tvControlItem.SelectedNodeID));
|
||||
}
|
||||
else
|
||||
{
|
||||
strSql += " AND UnitWorkId =@UnitWorkId";
|
||||
listStr.Add(new SqlParameter("@UnitWorkId", this.tvControlItem.SelectedNodeID));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.txtWeldJointCode.Text.Trim()))
|
||||
{
|
||||
@@ -417,12 +457,12 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
this.hdUnitWorkId.Text = string.Empty;
|
||||
if (pipeline != null)
|
||||
{
|
||||
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
|
||||
this.hdUnitWorkId.Text = pipeline.UnitWorkId;
|
||||
this.BindGrid();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNodeID;
|
||||
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.CommandName.Split('|').Length == 2 ? this.tvControlItem.SelectedNode.ParentNode.NodeID : this.tvControlItem.SelectedNodeID;
|
||||
NoAuditBindGrid();
|
||||
}
|
||||
|
||||
@@ -1228,12 +1268,12 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
this.hdUnitWorkId.Text = string.Empty;
|
||||
if (pipeline != null)
|
||||
{
|
||||
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
|
||||
this.hdUnitWorkId.Text = pipeline.UnitWorkId;
|
||||
this.BindGrid();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNodeID;
|
||||
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.CommandName.Split('|').Length == 2 ? this.tvControlItem.SelectedNode.ParentNode.NodeID : this.tvControlItem.SelectedNodeID;
|
||||
NoAuditBindGrid();
|
||||
}
|
||||
}
|
||||
@@ -1244,14 +1284,14 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
this.hdUnitWorkId.Text = string.Empty;
|
||||
if (pipeline != null)
|
||||
{
|
||||
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
|
||||
this.hdUnitWorkId.Text = pipeline.UnitWorkId;
|
||||
this.BindGrid();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNodeID;
|
||||
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.CommandName.Split('|').Length == 2 ? this.tvControlItem.SelectedNode.ParentNode.NodeID : this.tvControlItem.SelectedNodeID;
|
||||
NoAuditBindGrid();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,207 +133,12 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
}
|
||||
#endregion
|
||||
#region 将Dataset的数据导入数据库
|
||||
/// <summary>
|
||||
/// 将Dataset的数据导入数据库
|
||||
/// </summary>
|
||||
/// <param name="pds">数据集</param>
|
||||
/// <param name="Cols">数据集行数</param>
|
||||
/// <returns></returns>
|
||||
private Model.ResponeData AddDatasetToSQL(DataTable pds, int Cols)
|
||||
{
|
||||
Model.ResponeData responeData = new Model.ResponeData();
|
||||
List<string> result = new List<string>();
|
||||
|
||||
int ic, ir;
|
||||
ic = pds.Columns.Count;
|
||||
ir = pds.Rows.Count;
|
||||
if (ic < Cols)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "导入Excel格式错误!Excel只有" + ic.ToString().Trim() + "列";
|
||||
return responeData;
|
||||
}
|
||||
// DataRow[] dv = pds.Select("主项编号 <>'' and 管线号 <>'' and 材料编码 <>'' and 数量 <>''and 管线划分<>'' ");
|
||||
DataRow[] dv = pds.Select(" 管线号 <>'' and 材料编码 <>'' and 数量 <>'' ");
|
||||
|
||||
//导入数据库
|
||||
if (dv.Length > 0)
|
||||
{
|
||||
for (int i = 0; i < dv.Length; i++)
|
||||
{
|
||||
HJGL_PipeLineMat item = new HJGL_PipeLineMat();
|
||||
|
||||
#region 数据验证和赋值
|
||||
|
||||
|
||||
string unitworkId = string.Empty;
|
||||
unitworkId = Request.Params["UnitWorkId"];
|
||||
string PipeArea = string.Empty;//管线划分 1工厂预制 2现场施工
|
||||
|
||||
if (dv[i]["管线号"] != null && !string.IsNullOrEmpty(dv[i]["管线号"].ToString()))
|
||||
{
|
||||
var pipeline = from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == unitworkId && x.PipelineCode == dv[i]["管线号"].ToString().Trim() select x;
|
||||
if (pipeline.Count() > 0)
|
||||
{
|
||||
item.PipelineId = pipeline.First().PipelineId;
|
||||
PipeArea = pipeline.First().PipeArea;
|
||||
}
|
||||
else
|
||||
{
|
||||
// errorInfos += (i + 2) + "Line,"+ dv[i]["管线号"].ToString() + " [管线号] 不存在</br>";
|
||||
result.Add("不存在此管线号-" + dv[i]["管线号"].ToString());
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//errorInfos += (i + 2) + "Line, [管线号] 不能为空</br>";
|
||||
result.Add((i + 2) + "Line, [管线号] 不能为空</br>");
|
||||
}
|
||||
//if (dv[i]["管线划分"] != null && !string.IsNullOrEmpty(dv[i]["管线划分"].ToString()))
|
||||
//{
|
||||
// string txtPipeArea = "";
|
||||
// switch (PipeArea)
|
||||
// {
|
||||
// case "1":
|
||||
// txtPipeArea = "工厂预制";
|
||||
// break;
|
||||
// case "2":
|
||||
// txtPipeArea = "现场施工";
|
||||
// break;
|
||||
// default:
|
||||
// txtPipeArea = "无";
|
||||
// break;
|
||||
// }
|
||||
// if (!Equals(txtPipeArea, dv[i]["管线划分"].ToString().Trim()))
|
||||
// {
|
||||
// errorInfos += (i + 2) + "Line, [管线划分] 不匹配</br>";
|
||||
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// errorInfos += (i + 2) + "Line, [管线划分] 不能为空</br>";
|
||||
|
||||
//}
|
||||
|
||||
|
||||
if (dv[i]["材料编码"] != null && !string.IsNullOrEmpty(dv[i]["材料编码"].ToString()))
|
||||
{
|
||||
var lib = from x in Funs.DB.HJGL_MaterialCodeLib where x.MaterialCode == dv[i]["材料编码"].ToString() select x;
|
||||
if (lib.Count() > 0)
|
||||
{
|
||||
item.MaterialCode = dv[i]["材料编码"].ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
//errorInfos += (i + 2) + "Line," + dv[i]["材料编码"].ToString() + " [材料编码] 不存在</br>";
|
||||
result.Add("不存在此材料编码-" + dv[i]["材料编码"].ToString());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//errorInfos += (i + 2) + "Line, [材料编码] 不能为空</br>";
|
||||
result.Add((i + 2) + "Line, [材料编码] 不能为空</br>");
|
||||
}
|
||||
|
||||
if (dv[i]["数量"] != null && !string.IsNullOrEmpty(dv[i]["数量"].ToString()))
|
||||
{
|
||||
try
|
||||
{
|
||||
var number = Funs.GetNewDecimal(dv[i]["数量"].ToString());
|
||||
item.Number = number;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//errorInfos += "第" + (i + 2).ToString() + "行," + "数量格式输入有误</br>";
|
||||
result.Add("第" + (i + 2).ToString() + "行," + "数量格式输入有误</br>");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//errorInfos += (i + 2) + "Line, [数量] 不能为空</br>";
|
||||
result.Add((i + 2) + "Line, [数量] 不能为空</br>");
|
||||
}
|
||||
|
||||
if (PipeArea == "1")
|
||||
{
|
||||
if (dv[i]["预制组件"] != null && !string.IsNullOrEmpty(dv[i]["预制组件"].ToString()))
|
||||
{
|
||||
item.PrefabricatedComponents = dv[i]["预制组件"].ToString();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Add((i + 2) + "Line, [预制组件] 不能为空</br>");
|
||||
}
|
||||
}
|
||||
var model = matList.Where(x => x.PipelineId == item.PipelineId && x.MaterialCode == item.MaterialCode && x.PrefabricatedComponents == item.PrefabricatedComponents);
|
||||
if (model.Count() == 0)
|
||||
{
|
||||
matList.Add(item);
|
||||
|
||||
}
|
||||
//if (PipeArea == "1")//工厂预制
|
||||
//{
|
||||
|
||||
// var model= matList.Where(x => x.PrefabricatedComponents == item.PrefabricatedComponents && x.MaterialCode == item.MaterialCode);
|
||||
// if (model.Count()==0)
|
||||
// {
|
||||
// matList.Add(item);
|
||||
|
||||
// }
|
||||
|
||||
//} else if (PipeArea == "2")//现场施工
|
||||
//{
|
||||
// var model = matList.Where(x => x.PipelineId == item.PipelineId && x.MaterialCode == item.MaterialCode);
|
||||
// if (model.Count() == 0)
|
||||
// {
|
||||
// matList.Add(item);
|
||||
|
||||
// }
|
||||
//}
|
||||
//item.PipeLineMatId= SQLHelper.GetNewID(typeof(Model.HJGL_PipeLineMat));
|
||||
//if (!matList.Select(x => x.MaterialCode).Contains(item.MaterialCode))
|
||||
//{
|
||||
// matList.Add(item);
|
||||
//}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "没有数据";
|
||||
|
||||
}
|
||||
if (result.Count > 0)
|
||||
{
|
||||
// result = result.Substring(0, result.LastIndexOf("|"));
|
||||
errorInfos = string.Join("|", result.Distinct());
|
||||
//Alert alert = new Alert();
|
||||
//alert.Message = result;
|
||||
//alert.Target = Target.Self;
|
||||
//alert.Show();
|
||||
responeData.code = 0;
|
||||
responeData.message = errorInfos;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
private Model.ResponeData AddDatasetToSQL(List<dynamic> pds, int count)
|
||||
{
|
||||
Model.ResponeData responeData = new Model.ResponeData();
|
||||
List<string> result = new List<string>();
|
||||
|
||||
if (count < 4)
|
||||
if (count < 6)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "导入Excel格式错误!Excel只有" + count.ToString().Trim() + "列";
|
||||
@@ -377,16 +182,30 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
|
||||
if (pds[i].C != null && !string.IsNullOrEmpty(pds[i].C.ToString()))
|
||||
{
|
||||
string materialCode = pds[i].C.ToString();
|
||||
var lib = from x in Funs.DB.HJGL_MaterialCodeLib where x.MaterialCode == materialCode select x;
|
||||
if (lib.Count() > 0)
|
||||
string materialCode = pds[i].C.ToString().Trim();
|
||||
string furnaceNo = pds[i].D == null ? string.Empty : pds[i].D.ToString().Trim();
|
||||
string batchNo = pds[i].E == null ? string.Empty : pds[i].E.ToString().Trim();
|
||||
if (pds[i].D == null || string.IsNullOrEmpty(pds[i].D.ToString()))
|
||||
{
|
||||
item.MaterialCode = pds[i].C.ToString();
|
||||
result.Add((i + 2) + "Line, [炉号] 不能为空</br>");
|
||||
}
|
||||
else
|
||||
if (pds[i].E == null || string.IsNullOrEmpty(pds[i].E.ToString()))
|
||||
{
|
||||
result.Add("不存在此材料编码-" + pds[i].C.ToString());
|
||||
result.Add((i + 2) + "Line, [批号] 不能为空</br>");
|
||||
}
|
||||
if (!string.IsNullOrEmpty(materialCode) && !string.IsNullOrEmpty(furnaceNo) && !string.IsNullOrEmpty(batchNo))
|
||||
{
|
||||
string fullMaterialCode = materialCode + "-" + furnaceNo + "-" + batchNo;
|
||||
var lib = from x in Funs.DB.HJGL_MaterialCodeLib where x.MaterialCode == fullMaterialCode select x;
|
||||
if (lib.Count() > 0)
|
||||
{
|
||||
item.MaterialCode = fullMaterialCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Add("不存在此材料:" + fullMaterialCode);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -395,11 +214,11 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
result.Add((i + 2) + "Line, [材料编码] 不能为空</br>");
|
||||
}
|
||||
|
||||
if (pds[i].D != null && !string.IsNullOrEmpty(pds[i].D.ToString()))
|
||||
if (pds[i].F != null && !string.IsNullOrEmpty(pds[i].F.ToString()))
|
||||
{
|
||||
try
|
||||
{
|
||||
var number = Funs.GetNewDecimal(pds[i].D.ToString());
|
||||
var number = Funs.GetNewDecimal(pds[i].F.ToString());
|
||||
item.Number = number;
|
||||
}
|
||||
catch (Exception)
|
||||
@@ -674,4 +493,4 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,11 @@
|
||||
background-color: green;
|
||||
}
|
||||
|
||||
.f-grid-row.priority {
|
||||
background-color: #1e88e5;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.f-grid-row {
|
||||
font-size: smaller;
|
||||
}
|
||||
@@ -138,7 +143,9 @@
|
||||
<f:Toolbar ID="Toolbar3" Position="Top" runat="server" ToolbarAlign="Left">
|
||||
<Items>
|
||||
<f:Label ID="lbRate" runat="server" LabelWidth="100px" Hidden="true"></f:Label>
|
||||
<f:Label ID="lbNote" runat="server" LabelWidth="100px" Text="绿色为匹配率100%,红色为匹配率小于100%"></f:Label>
|
||||
<f:Label ID="lbNote" runat="server" LabelWidth="100px" Text="绿色为匹配率100%,红色为匹配率小于100%,蓝色为手动优先组件"></f:Label>
|
||||
<f:Button ID="btnPriorityComponents" Text="优先匹配选中组件" Icon="TabGo" runat="server" OnClick="btnPriorityComponents_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnGenTask" ToolTip="生成任务单" Icon="ApplicationViewIcons" runat="server" OnClick="btnGenTask_Click" ConfirmText="确定生成任务单吗?">
|
||||
</f:Button>
|
||||
<f:CheckBox ID="cbSelectCom" ShowLabel="false" runat="server" Text="默认勾选匹配100%" Checked="true">
|
||||
@@ -174,9 +181,9 @@
|
||||
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="材料匹配明细" EnableRowClickEvent="true"
|
||||
EnableCollapse="true" runat="server" BoxFlex="1" DataKeyNames="Id" ForceFit="true"
|
||||
EnableCollapse="true" runat="server" BoxFlex="1" DataKeyNames="Id,PipelineId,PrefabricatedComponents" ForceFit="true"
|
||||
EnableColumnLines="true" DataIDField="Id" AllowSorting="true" OnRowDataBound="Grid1_RowDataBound"
|
||||
SortField="Id" SortDirection="ASC" OnSort="Grid1_Sort">
|
||||
SortField="Id" SortDirection="ASC" OnSort="Grid1_Sort" EnableCheckBoxSelect="true">
|
||||
<Columns>
|
||||
<f:RenderField Width="200px" ColumnID="PipelineCode" DataField="PipelineCode" SortField="PipelineCode"
|
||||
FieldType="String" HeaderText="管线号" HeaderTextAlign="Center"
|
||||
|
||||
@@ -70,6 +70,24 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, HashSet<string>> priorityComponents
|
||||
{
|
||||
get
|
||||
{
|
||||
var value = ViewState["priorityComponents"] as Dictionary<string, HashSet<string>>;
|
||||
if (value == null)
|
||||
{
|
||||
value = new Dictionary<string, HashSet<string>>();
|
||||
ViewState["priorityComponents"] = value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["priorityComponents"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
@@ -86,6 +104,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
; HJGL_MaterialService.materialStockItems_FIELD = new List<Model.MaterialStockItem>();
|
||||
HJGL_MaterialService.materialStockItems_SHOP = new List<Model.MaterialStockItem>();
|
||||
dicSeclectPipeLine = new Dictionary<string, string>();
|
||||
priorityComponents = new Dictionary<string, HashSet<string>>();
|
||||
var pipeline = (from x in Funs.DB.HJGL_Pipeline
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x.FlowingSection).Distinct().ToList();
|
||||
@@ -155,22 +174,20 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
foreach (var q in unitWork1)
|
||||
{
|
||||
|
||||
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipeArea == PipeArea && x.WarehouseId == WarehouseId select x).Count();
|
||||
int a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
|
||||
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
||||
TreeNode tn1 = new TreeNode();
|
||||
tn1.NodeID = q.UnitWorkId;
|
||||
tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
|
||||
tn1.ToolTip = "施工单位:" + unitNamesUnitIds;
|
||||
tn1.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
||||
tn1.CommandName = "单位工程";
|
||||
tn1.EnableExpandEvent = true;
|
||||
tn1.EnableClickEvent = true;
|
||||
tn1.EnableCheckBox = false;
|
||||
rootNode1.Nodes.Add(tn1);
|
||||
if (a > 0)
|
||||
{
|
||||
// BindNodes(tn1);
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = "加载管线...";
|
||||
newNode.NodeID = "加载管线...";
|
||||
tn1.Nodes.Add(newNode);
|
||||
BindTestPackageNodes(tn1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,7 +195,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
{
|
||||
foreach (var q in unitWork2)
|
||||
{
|
||||
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipeArea == PipeArea && x.WarehouseId == WarehouseId select x).Count();
|
||||
int a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
|
||||
// var NowComPipelineCode = PipelineService.GetNoComPipelinesByUnitWordId(q.UnitWorkId);
|
||||
//int a = NowComPipelineCode.Count();
|
||||
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
||||
@@ -190,7 +207,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
tn2.Expanded = true;
|
||||
}
|
||||
tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
|
||||
tn2.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
||||
tn2.CommandName = "单位工程";
|
||||
tn2.EnableExpandEvent = true;
|
||||
tn2.EnableClickEvent = true;
|
||||
tn2.EnableCheckBox = false;
|
||||
@@ -198,11 +215,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
rootNode2.Nodes.Add(tn2);
|
||||
if (a > 0)
|
||||
{
|
||||
// BindNodes(tn2);
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = "加载管线...";
|
||||
newNode.NodeID = "加载管线...";
|
||||
tn2.Nodes.Add(newNode);
|
||||
BindTestPackageNodes(tn2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -215,22 +228,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
// node.Text += "|" + NowComPipelineCode.Count();
|
||||
|
||||
//}
|
||||
var CompleteInOutPlanDetail_RelationList = from x in Funs.DB.Tw_InOutPlanDetail_Relation
|
||||
join y in Funs.DB.Tw_InOutPlanMaster on x.InOutPlanMasterId equals y.Id
|
||||
where y.State == (int)TwConst.State.已完成 && y.WarehouseCode == drpWarehouse.SelectedValue
|
||||
select x;
|
||||
|
||||
var pipeline = (from x in Funs.DB.HJGL_Pipeline
|
||||
join y in CompleteInOutPlanDetail_RelationList on x.PipelineId equals y.PipelineId into temp
|
||||
from y in temp.DefaultIfEmpty()
|
||||
where y == null && x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == node.NodeID
|
||||
&& x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim()) && x.WarehouseId==WarehouseId
|
||||
orderby x.PipelineCode
|
||||
select x).ToList();
|
||||
if (!string.IsNullOrEmpty(drpFlowingSection.SelectedValue) && drpFlowingSection.SelectedValue != Const._Null)
|
||||
{
|
||||
pipeline = pipeline.Where(x => x.FlowingSection == drpFlowingSection.SelectedValue).ToList();
|
||||
}
|
||||
var pipeline = GetTestPackagePipelineList(node.NodeID);
|
||||
//pipeline= pipeline.Where(x => NowComPipelineCode.Contains(x.PipelineCode)).ToList();
|
||||
if (!node.Text.Contains("|"))
|
||||
{
|
||||
@@ -268,6 +266,74 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
}
|
||||
}
|
||||
|
||||
private int GetUnitWorkTestPackagePipelineCount(string unitWorkId)
|
||||
{
|
||||
var testPackageIds = (from x in Funs.DB.PTP_TestPackage
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == unitWorkId
|
||||
select x.PTP_ID).ToList();
|
||||
|
||||
return testPackageIds.Select(x => GetTestPackagePipelineList(x).Count()).Sum();
|
||||
}
|
||||
|
||||
private void BindTestPackageNodes(TreeNode unitWorkNode)
|
||||
{
|
||||
var testPackages = (from x in Funs.DB.PTP_TestPackage
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.UnitWorkId == unitWorkNode.NodeID
|
||||
orderby x.TestPackageNo
|
||||
select x).ToList();
|
||||
|
||||
foreach (var item in testPackages)
|
||||
{
|
||||
int pipelineCount = GetTestPackagePipelineList(item.PTP_ID).Count();
|
||||
if (pipelineCount == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = (string.IsNullOrEmpty(item.TestPackageNo) ? "未知" : item.TestPackageNo) + "【" + pipelineCount.ToString() + "】管线";
|
||||
newNode.NodeID = item.PTP_ID;
|
||||
newNode.CommandName = 1 + "|" + Funs.GetEndPageNumber(pipelineCount, pageSize);
|
||||
newNode.EnableClickEvent = true;
|
||||
newNode.EnableExpandEvent = true;
|
||||
newNode.EnableCheckBox = false;
|
||||
unitWorkNode.Nodes.Add(newNode);
|
||||
|
||||
TreeNode loadNode = new TreeNode();
|
||||
loadNode.Text = "加载管线...";
|
||||
loadNode.NodeID = "加载管线...";
|
||||
loadNode.EnableCheckBox = false;
|
||||
newNode.Nodes.Add(loadNode);
|
||||
}
|
||||
}
|
||||
|
||||
private List<Model.HJGL_Pipeline> GetTestPackagePipelineList(string ptpId)
|
||||
{
|
||||
var completeInOutPlanDetailRelationList = from x in Funs.DB.Tw_InOutPlanDetail_Relation
|
||||
join y in Funs.DB.Tw_InOutPlanMaster on x.InOutPlanMasterId equals y.Id
|
||||
where y.State == (int)TwConst.State.已完成 && y.WarehouseCode == drpWarehouse.SelectedValue
|
||||
select x;
|
||||
|
||||
var pipeline = (from x in Funs.DB.HJGL_Pipeline
|
||||
join p in Funs.DB.PTP_PipelineList on x.PipelineId equals p.PipelineId
|
||||
join y in completeInOutPlanDetailRelationList on x.PipelineId equals y.PipelineId into temp
|
||||
from y in temp.DefaultIfEmpty()
|
||||
where y == null
|
||||
&& p.PTP_ID == ptpId
|
||||
&& x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.PipeArea == PipeArea
|
||||
&& x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
|
||||
&& x.WarehouseId == WarehouseId
|
||||
orderby x.PipelineCode
|
||||
select x).ToList();
|
||||
if (!string.IsNullOrEmpty(drpFlowingSection.SelectedValue) && drpFlowingSection.SelectedValue != Const._Null)
|
||||
{
|
||||
pipeline = pipeline.Where(x => x.FlowingSection == drpFlowingSection.SelectedValue).ToList();
|
||||
}
|
||||
return pipeline.Distinct().ToList();
|
||||
}
|
||||
|
||||
protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
|
||||
{
|
||||
if (e.Node.Nodes[0].NodeID == "加载管线...")
|
||||
@@ -417,23 +483,66 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
}*/
|
||||
|
||||
}
|
||||
protected void Grid2_RowClick(object sender, GridRowClickEventArgs e)
|
||||
|
||||
private void BindMaterialDetail(string pipelineId)
|
||||
{
|
||||
var tb = tw_PipeMatMatchOutputs.Where(x => x.PipelineId == Grid2.SelectedRowID).ToList();
|
||||
var tb = tw_PipeMatMatchOutputs.Where(x => x.PipelineId == pipelineId).ToList();
|
||||
Grid1.DataSource = tb;
|
||||
Grid1.DataBind();
|
||||
|
||||
var selectList = new List<string>();
|
||||
for (int i = 0; i < Grid1.Rows.Count; i++)
|
||||
{
|
||||
var model = Grid1.Rows[i].DataItem as Tw_PipeMatMatchOutput;
|
||||
|
||||
if (model?.MatchRate < 1 || model?.MatchRate == null)
|
||||
if (model == null)
|
||||
{
|
||||
Grid1.Rows[i].RowCssClass = "red";
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (IsPriorityComponent(model.PipelineId, model.PrefabricatedComponents))
|
||||
{
|
||||
Grid1.Rows[i].RowCssClass = "priority";
|
||||
selectList.Add(model.Id);
|
||||
}
|
||||
else if (model.MatchRate < 1 || model.MatchRate == null)
|
||||
{
|
||||
Grid1.Rows[i].RowCssClass = "red";
|
||||
}
|
||||
}
|
||||
|
||||
Grid1.SelectedRowIDArray = selectList.ToArray();
|
||||
}
|
||||
|
||||
private bool IsPriorityComponent(string pipelineId, string prefabricatedComponents)
|
||||
{
|
||||
return !string.IsNullOrEmpty(pipelineId)
|
||||
&& !string.IsNullOrEmpty(prefabricatedComponents)
|
||||
&& priorityComponents.ContainsKey(pipelineId)
|
||||
&& priorityComponents[pipelineId].Contains(prefabricatedComponents);
|
||||
}
|
||||
|
||||
private Dictionary<string, List<string>> GetPriorityComponentList()
|
||||
{
|
||||
return priorityComponents
|
||||
.Where(x => x.Value != null && x.Value.Any())
|
||||
.ToDictionary(x => x.Key, x => x.Value.ToList());
|
||||
}
|
||||
|
||||
private void RefreshMatchResult()
|
||||
{
|
||||
tw_PipeMatMatchOutputs = TwArrivalStatisticsService.GetPipeMatMatch(
|
||||
this.CurrUser.LoginProjectId,
|
||||
dicSeclectPipeLine.Keys.ToList(),
|
||||
drpWarehouse.SelectedValue,
|
||||
GetPriorityComponentList());
|
||||
BindGrid3();
|
||||
BindGrid2();
|
||||
}
|
||||
|
||||
protected void Grid2_RowClick(object sender, GridRowClickEventArgs e)
|
||||
{
|
||||
BindMaterialDetail(Grid2.SelectedRowID);
|
||||
|
||||
}
|
||||
protected void Grid1_RowClick(object sender, GridRowClickEventArgs e)
|
||||
{
|
||||
@@ -473,7 +582,14 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
{
|
||||
Grid1.SortDirection = e.SortDirection;
|
||||
Grid1.SortField = e.SortField;
|
||||
BindGrid();
|
||||
if (!string.IsNullOrEmpty(Grid2.SelectedRowID) && tw_PipeMatMatchOutputs != null && tw_PipeMatMatchOutputs.Any())
|
||||
{
|
||||
BindMaterialDetail(Grid2.SelectedRowID);
|
||||
}
|
||||
else
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -491,7 +607,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
parameter3D.TagNum = "";
|
||||
parameter3D.ButtonType = "3";
|
||||
|
||||
if (this.tvControlItem.SelectedNode.CommandName.Split('|').Count() == 2)
|
||||
if (this.tvControlItem.SelectedNode.CommandName == "单位工程")
|
||||
{
|
||||
parameter3D.ModelName = HJGL_DataImportService.Getlatest3DModelNameByUnitWorkId(tvControlItem.SelectedNodeID);
|
||||
var pipeline = (from x in Funs.DB.HJGL_Pipeline
|
||||
@@ -517,7 +633,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
this.hdUnitWorkId.Text = string.Empty;
|
||||
if (pipeline != null)
|
||||
{
|
||||
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
|
||||
this.hdUnitWorkId.Text = pipeline.UnitWorkId;
|
||||
this.BindGrid();
|
||||
}
|
||||
|
||||
@@ -566,10 +682,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
dicSeclectPipeLine.Add(node.NodeID, node.Text);
|
||||
}
|
||||
}
|
||||
tw_PipeMatMatchOutputs = TwArrivalStatisticsService.GetPipeMatMatch(this.CurrUser.LoginProjectId, dicSeclectPipeLine.Keys.ToList(), drpWarehouse.SelectedValue);
|
||||
|
||||
BindGrid3();
|
||||
BindGrid2();
|
||||
RefreshMatchResult();
|
||||
}
|
||||
|
||||
protected void btnDeletePipelineMatchMat_Click(object sender, EventArgs e)
|
||||
@@ -579,6 +692,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
foreach (string rowId in Grid3.SelectedRowIDArray)
|
||||
{
|
||||
dicSeclectPipeLine.Remove(rowId);
|
||||
priorityComponents.Remove(rowId);
|
||||
var node = tvControlItem.FindNode(rowId);
|
||||
if (node != null)
|
||||
{
|
||||
@@ -586,25 +700,63 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
}
|
||||
}
|
||||
|
||||
tw_PipeMatMatchOutputs = TwArrivalStatisticsService.GetPipeMatMatch(this.CurrUser.LoginProjectId, dicSeclectPipeLine.Keys.ToList(), drpWarehouse.SelectedValue);
|
||||
|
||||
BindGrid3();
|
||||
BindGrid2();
|
||||
RefreshMatchResult();
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnPriorityComponents_Click(object sender, EventArgs e)
|
||||
{
|
||||
string selectedPipelineId = Grid2.SelectedRowID;
|
||||
if (string.IsNullOrEmpty(selectedPipelineId))
|
||||
{
|
||||
ShowNotify("请先在材料匹配列表选择管线!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
var selectedComponents = new HashSet<string>();
|
||||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||||
{
|
||||
if (Grid1.DataKeys[rowIndex].Length < 3)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
string pipelineId = Grid1.DataKeys[rowIndex][1]?.ToString();
|
||||
string componentCode = Grid1.DataKeys[rowIndex][2]?.ToString();
|
||||
if (pipelineId == selectedPipelineId && !string.IsNullOrEmpty(componentCode))
|
||||
{
|
||||
selectedComponents.Add(componentCode);
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedComponents.Any())
|
||||
{
|
||||
priorityComponents[selectedPipelineId] = selectedComponents;
|
||||
}
|
||||
else
|
||||
{
|
||||
priorityComponents.Remove(selectedPipelineId);
|
||||
}
|
||||
|
||||
RefreshMatchResult();
|
||||
BindMaterialDetail(selectedPipelineId);
|
||||
}
|
||||
|
||||
protected void btnGenTask_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid2.SelectedRowIDArray.Count() > 0)
|
||||
{
|
||||
SaveTask();
|
||||
ShowNotify("生成任务单成功!", MessageBoxIcon.Warning);
|
||||
// Alert.Show("生成任务单成功!", MessageBoxIcon.Warning);
|
||||
Grid1.DataSource = null;
|
||||
Grid1.DataBind();
|
||||
Grid2.DataSource = null;
|
||||
Grid2.DataBind();
|
||||
Grid3.DataSource = null;
|
||||
Grid3.DataBind();
|
||||
if (SaveTask())
|
||||
{
|
||||
ShowNotify("生成任务单成功!", MessageBoxIcon.Warning);
|
||||
// Alert.Show("生成任务单成功!", MessageBoxIcon.Warning);
|
||||
Grid1.DataSource = null;
|
||||
Grid1.DataBind();
|
||||
Grid2.DataSource = null;
|
||||
Grid2.DataBind();
|
||||
Grid3.DataSource = null;
|
||||
Grid3.DataBind();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -612,7 +764,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
}
|
||||
|
||||
}
|
||||
private void SaveTask()
|
||||
private bool SaveTask()
|
||||
{
|
||||
var weldingRods = from x in Funs.DB.Base_Consumables where x.ConsumablesType == "2" select x;
|
||||
var weldingWires = from x in Funs.DB.Base_Consumables where x.ConsumablesType == "1" select x;
|
||||
@@ -632,6 +784,21 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
{
|
||||
selectRowId = selectRowId.Where(x => x.JointAttribute == "预制口").ToList();
|
||||
}
|
||||
var priorityWeldJointIds = GetPriorityWeldJointIds(Grid2.SelectedRowIDArray.ToList());
|
||||
if (priorityWeldJointIds.Any())
|
||||
{
|
||||
if (priorityWeldJointIds.Any(x => !x.Value.Any()))
|
||||
{
|
||||
ShowNotify("选中组件未找到关联焊口,无法按组件生成任务单!", MessageBoxIcon.Warning);
|
||||
return false;
|
||||
}
|
||||
selectRowId = selectRowId.Where(x => !priorityWeldJointIds.ContainsKey(x.PipelineId) || priorityWeldJointIds[x.PipelineId].Contains(x.WeldJointId)).ToList();
|
||||
}
|
||||
if (!selectRowId.Any())
|
||||
{
|
||||
ShowNotify("未找到可生成任务单的焊口!", MessageBoxIcon.Warning);
|
||||
return false;
|
||||
}
|
||||
foreach (var weldjoint in selectRowId)
|
||||
{
|
||||
string canWeldingRodName = string.Empty;
|
||||
@@ -666,7 +833,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
if (oldWeldTask != null)
|
||||
{
|
||||
ShowNotify("所选焊口已存在任务单,无法保存!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
Model.HJGL_WeldJoint weldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(NewTask.WeldJointId);
|
||||
if (weldJoint != null)
|
||||
@@ -739,7 +906,36 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
BLL.WeldTaskService.AddWeldTask(NewTask);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private Dictionary<string, HashSet<string>> GetPriorityWeldJointIds(List<string> selectedPipelineIds)
|
||||
{
|
||||
var result = new Dictionary<string, HashSet<string>>();
|
||||
var selectedPriority = priorityComponents
|
||||
.Where(x => selectedPipelineIds.Contains(x.Key) && x.Value != null && x.Value.Any())
|
||||
.ToList();
|
||||
|
||||
foreach (var item in selectedPriority)
|
||||
{
|
||||
string pipelineId = item.Key;
|
||||
var componentCodes = item.Value.ToList();
|
||||
var weldJointIds = (from joint in Funs.DB.HJGL_Pipeline_ComponentJoint
|
||||
join weldJoint in Funs.DB.HJGL_WeldJoint on joint.WeldJointId equals weldJoint.WeldJointId
|
||||
join component in Funs.DB.HJGL_Pipeline_Component on joint.PipelineComponentId equals component.PipelineComponentId into componentJoin
|
||||
from componentItem in componentJoin.DefaultIfEmpty()
|
||||
where joint.WeldJointId != null
|
||||
&& weldJoint.PipelineId == pipelineId
|
||||
&& ((componentItem != null && componentCodes.Contains(componentItem.PipelineComponentCode))
|
||||
|| componentCodes.Contains(joint.PipelineComponentCode))
|
||||
select joint.WeldJointId).Distinct().ToList();
|
||||
|
||||
result[pipelineId] = new HashSet<string>(weldJointIds);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private bool IsCoverClass(string wpsClass, string matClass)
|
||||
{
|
||||
bool isCover = false;
|
||||
|
||||
@@ -257,6 +257,15 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Label lbNote;
|
||||
|
||||
/// <summary>
|
||||
/// btnPriorityComponents 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnPriorityComponents;
|
||||
|
||||
/// <summary>
|
||||
/// btnGenTask 控件。
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user