焊接管理,工厂预制管理:安装清单

This commit is contained in:
夏菊 2025-05-12 18:23:44 +08:00
parent 58e33c9576
commit da7cda8948
4 changed files with 175 additions and 711 deletions

View File

@ -80,6 +80,16 @@ namespace BLL
{
return Funs.DB.HJGL_Pipeline.FirstOrDefault(e => e.PipelineId == pipelineId);
}
/// <summary>
/// 根据流水段获取管线信息
/// </summary>
/// <param name="flowingSection"></param>
/// <returns></returns>
public static Model.HJGL_Pipeline GetPipelineByFlowingSection(string flowingSection)
{
return Funs.DB.HJGL_Pipeline.FirstOrDefault(e => e.FlowingSection == flowingSection);
}
/// <summary>
/// 根据管线id获取管线状态
/// </summary>

View File

@ -48,124 +48,62 @@
<Toolbars>
<f:Toolbar ID="Toolbar3" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
<f:TextBox ID="txtPipelineCode2" runat="server" Label="管线号"
EmptyText="输入查询条件"
Width="240px" LabelWidth="100px" LabelAlign="Right">
</f:TextBox>
<f:TextBox ID="txtPipelineComponentCode" runat="server" Label="组件编号"
EmptyText="输入查询条件"
Width="240px" LabelWidth="100px" LabelAlign="Right">
</f:TextBox>
<f:DropDownList ID="drpState" Label="组件状态" runat="server"
ShowRedStar="true" Required="true" EnableEdit="true" LabelWidth="100px">
</f:DropDownList>
<f:DropDownList ID="drpProductionState" Label="生产状态" runat="server"
ShowRedStar="true" Required="true" EnableEdit="true" LabelWidth="100px">
</f:DropDownList>
<f:DropDownList ID="drpWeldingDailyCode" Label="日报编号" runat="server" AutoSelectFirstItem="true"
ShowRedStar="true" Required="true" EnableEdit="true" LabelWidth="100px">
</f:DropDownList>
<f:DropDownList ID="drpFlowingSection" Label="流水段" AutoPostBack="true"
runat="server" LabelWidth="80px"
Width="180px" LabelAlign="Left">
</f:DropDownList>
<f:ToolbarFill ID="ToolbarFill1" runat="server">
<f:ToolbarFill ID="ToolbarFill2" runat="server">
</f:ToolbarFill>
<f:Button ID="btnNew" Text="新增" Icon="Add" runat="server" OnClick="btnNew_Click" Hidden="true">
</f:Button>
<f:Button ID="btnSearch" Icon="SystemSearch" Text="查询"
EnablePostBack="true" runat="server" OnClick="btnSearch_Click">
</f:Button>
<f:Button ID="btnDelete" OnClick="btnDelete_Click" EnablePostBack="true"
ConfirmText="删除选中行?" ConfirmTarget="Top" runat="server"
Text="删除" Icon="Delete">
</f:Button>
</Items>
</f:Toolbar>
<f:Toolbar ID="Toolbar4" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
<f:ToolbarFill ID="ToolbarFill2" runat="server">
</f:ToolbarFill>
<f:Button ID="btnRectification" Text="整改" ToolTip="整改" Icon="Accept" runat="server" OnClick="btnRectification_Click">
</f:Button>
<f:Button ID="btnAccept" Text="验收" ToolTip="验收" Icon="Accept" runat="server" OnClick="btnAccept_Click">
</f:Button>
<f:Button ID="btnImportQRCode" Text="导入二维码信息" ToolTip="导入二维码信息" Icon="PackageIn" runat="server" OnClick="btnImportQRCode_Click">
</f:Button>
<f:Button ID="btnBatchAdd" Text="批量增加" Icon="TableAdd" Hidden="true"
runat="server" OnClick="btnBatchAdd_Click">
</f:Button>
<f:Button ID="btnSinglePreview" ToolTip="管道预制加工图" Icon="PageRed" Text="管道预制加工图"
EnablePostBack="true" OnClick="btnSinglePreview_Click" runat="server">
</f:Button>
<f:Button ID="btnPrint" runat="server" Icon="Printer" EnableAjax="false" Text="打印" ToolTip="打印" OnClick="btnPrint_Click"></f:Button>
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" Text="导出"
Icon="TableGo" EnableAjax="false" EnablePostBack="true">
Icon="TableGo" EnableAjax="false" EnablePostBack="true">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="组件信息" ForceFit="false"
EnableCollapse="true" runat="server" BoxFlex="1" DataKeyNames="PipelineComponentId" AllowCellEditing="true"
AllowColumnLocking="true" EnableColumnLines="true" ClicksToEdit="2" DataIDField="PipelineComponentId"
AllowSorting="true" SortField="PipelineComponentCode" SortDirection="ASC" OnSort="Grid1_Sort" OnRowCommand="Grid1_RowCommand"
AllowPaging="true" IsDatabasePaging="true" PageSize="15" OnPageIndexChange="Grid1_PageIndexChange" EnableCheckBoxSelect="true"
EnableTextSelection="True" EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick">
EnableCollapse="true" runat="server" BoxFlex="1" DataKeyNames="PipelineCode" AllowCellEditing="true"
AllowColumnLocking="true" EnableColumnLines="true" ClicksToEdit="2" DataIDField="PipelineCode"
AllowSorting="true" SortField="PipelineCode" SortDirection="ASC" OnSort="Grid1_Sort"
AllowPaging="true" IsDatabasePaging="true" PageSize="15" OnPageIndexChange="Grid1_PageIndexChange">
<Columns>
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号"
Width="60px" HeaderTextAlign="Center" TextAlign="Center" />
<f:WindowField ColumnID="PipelineComponentCode" HeaderTextAlign="Center" TextAlign="Left"
Width="180px" WindowID="Window1" HeaderText="组件编号" DataTextField="PipelineComponentCode"
DataIFrameUrlFields="PipelineComponentId" DataIFrameUrlFormatString="PrePipelineEdit.aspx?PipelineComponentId={0}"
Title="组件编号" DataToolTipField="PipelineComponentCode" SortField="PipelineComponentCode"
Locked="true">
</f:WindowField>
<%--<f:RenderField HeaderText="预制单位" ColumnID="PreUnit"
DataField="PreUnit" SortField="PreUnit" FieldType="String" HeaderTextAlign="Center"
TextAlign="Left" Width="240px">
</f:RenderField>--%>
<f:RenderField Width="200px" ColumnID="BoxNumber" DataField="BoxNumber" SortField="BoxNumber"
FieldType="String" HeaderText="物流箱号" HeaderTextAlign="Center"
<f:RenderField Width="220px" ColumnID="PipelineCode" DataField="PipelineCode" SortField="PipelineCode"
FieldType="String" HeaderText="管线号" HeaderTextAlign="Center"
TextAlign="Left" Locked="true">
</f:RenderField>
<f:RenderField Width="220px" ColumnID="PipelineComponentCode" DataField="PipelineComponentCode" SortField="PipelineComponentCode"
FieldType="String" HeaderText="组件编号" HeaderTextAlign="Center"
TextAlign="Left" Locked="true">
</f:RenderField>
<f:RenderField Width="320px" ColumnID="matdef" DataField="matdef"
FieldType="String" HeaderText="预制散件材料描述" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
<f:TemplateField ColumnID="tfState" Width="200px" HeaderText="组件状态" HeaderTextAlign="Center"
TextAlign="Left">
<ItemTemplate>
<asp:Label ID="lbstate" runat="server" Text='<%# ConvertState(Eval("State"))%>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:TemplateField ColumnID="tfProductionState" Width="200px" HeaderText="生产状态" HeaderTextAlign="Center"
TextAlign="Left">
<ItemTemplate>
<asp:Label ID="lbProductionState" runat="server" Text='<%# ConvertProductionState(Eval("ProductionState"))%>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderCheckField Width="100px" ColumnID="IsPrint" DataField="IsPrint" HeaderText="是否已打印" EnableColumnEdit="False" />
<f:RenderField Width="200px" ColumnID="FlowingSection" DataField="FlowingSection" SortField="FlowingSection"
FieldType="String" HeaderText="流水段"
HeaderTextAlign="Center"
<f:RenderField Width="80px" ColumnID="Number" DataField="Number"
FieldType="String" HeaderText="数量" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
<%-- <f:TemplateField ColumnID="tfImageUrl1" Width="180px" HeaderText="组件二维码" HeaderTextAlign="Center"
TextAlign="Left">
<ItemTemplate>
<asp:Label ID="lbImageUrl" runat="server" Text='<%# ConvertImageUrlByImage(Eval("QRCode"),Eval("PipelineComponentId")) %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>--%>
<f:LinkButtonField Width="100px" TextAlign="Center" CommandName="PreviewQRCode" Text="二维码" EnableAjax="false" />
<f:RenderField Width="200px" ColumnID="DrawingName" DataField="DrawingName" SortField="DrawingName"
FieldType="String" HeaderText="预制图纸名称" HeaderTextAlign="Center"
<f:RenderField Width="150px" ColumnID="PackagingCode" DataField="PackagingCode"
FieldType="String" HeaderText="所在包装编号" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
<f:RenderField Width="120px" ColumnID="PersonName" DataField="PersonName" FieldType="String"
HeaderText="验收人" HeaderTextAlign="Center" TextAlign="Center">
<f:RenderField Width="110px" ColumnID="TrainNumber" DataField="TrainNumber"
FieldType="String" HeaderText="车次" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
<f:RenderField Width="120px" ColumnID="ReceiveDate" DataField="ReceiveDate" FieldType="String"
HeaderText="验收时间" HeaderTextAlign="Center" TextAlign="Center">
<f:RenderField Width="150px" ColumnID="FlowingSection" DataField="FlowingSection"
FieldType="String" HeaderText="流水段" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
<f:RenderField Width="200px" ColumnID="Remark" DataField="Remark" SortField="Remark"
FieldType="String" HeaderText="备注" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
<f:LinkButtonField Width="120px" TextAlign="Center" CommandName="cmd_print" Text="预览打印" />
</Columns>
<PageItems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
@ -186,22 +124,6 @@
</f:Panel>
</Items>
</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="600px" Height="420px">
</f:Window>
<f:Window ID="Window2" Title="打印" Hidden="true" EnableIFrame="true"
EnableMaximize="true" Target="Top" EnableResize="false" runat="server"
IsModal="true" Width="1010px" Height="660px">
</f:Window>
<f:Window ID="Window3" Title="附件上传" Hidden="true" EnableIFrame="true"
EnableMaximize="true" Target="Top" EnableResize="false" runat="server"
IsModal="true" Width="1010px" Height="660px">
</f:Window>
<f:Window ID="Window4" Title="管道预制加工图" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="true" runat="server" IsModal="false" EnableDrag="false" AutoScroll="true"
Width="800px" Height="600px">
</f:Window>
</form>
<script type="text/javascript">

View File

@ -1,15 +1,11 @@
using BLL;
using MiniExcelLibs;
using Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Web;
namespace FineUIPro.Web.HJGL.PreDesign
{
@ -24,17 +20,6 @@ namespace FineUIPro.Web.HJGL.PreDesign
{
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
this.InitTreeMenu();//加载树
HJGL_PipelineComponentService.InitMainItemDownList(drpState, true);
HJGL_PipelineComponentService.InitMainItemDownProductionStateList(drpProductionState, true);
var pipeline = (from x in Funs.DB.HJGL_Pipeline
where x.ProjectId == this.CurrUser.LoginProjectId
select x.FlowingSection).Distinct().ToList();
this.drpFlowingSection.DataTextField = "Value";
this.drpFlowingSection.DataValueField = "Value";
this.drpFlowingSection.DataSource = pipeline;
this.drpFlowingSection.DataBind();
Funs.FineUIPleaseSelect(drpFlowingSection);
}
}
@ -121,11 +106,12 @@ 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 = (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.FlowingSection).Distinct().Count();
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
TreeNode tn2 = new TreeNode();
tn2.NodeID = q.UnitWorkId;
tn2.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
//tn2.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
tn2.Text = q.UnitWorkName;
if (q.UnitWorkId == this.hdUnitWorkId.Text)
{
tn2.Expanded = true;
@ -153,43 +139,43 @@ namespace FineUIPro.Web.HJGL.PreDesign
private void BindNodes(TreeNode node)
{
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 && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
orderby x.PipelineCode
select x).ToList();
int pageindex = int.Parse(node.CommandName.Split('|')[0]);
int pageCount = int.Parse(node.CommandName.Split('|')[1]);
if (pageindex <= pageCount)
List<string> flowingSection = new List<string>();
//List<Model.HJGL_Pipeline> pipeline = new List<Model.HJGL_Pipeline>();
var list = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.PipeArea == "1" && x.UnitWorkId == node.NodeID && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim()) select x.FlowingSection).ToList();
flowingSection = list.Where(x => !string.IsNullOrWhiteSpace(x) == true).Distinct().OrderBy(x => x).ToList();
//int pageindex = int.Parse(node.CommandName.Split('|')[0]);
//int pageCount = int.Parse(node.CommandName.Split('|')[1]);
//if (pageindex <= pageCount)
//{
// flowingSection = flowingSection.Skip(pageSize * (pageindex - 1)).Take(pageSize).ToList();
foreach (var item in flowingSection)
{
pipeline = pipeline.Skip(pageSize * (pageindex - 1)).Take(pageSize).ToList();
foreach (var item in pipeline)
{
var comCount = (from x in Funs.DB.HJGL_Pipeline_Component where x.PipelineId == item.PipelineId select x).Count();
TreeNode newNode = new TreeNode();
newNode.Text = item.PipelineCode + "【" + comCount.ToString() + " " + "组件" + "】";
newNode.ToolTip = "管线号【组件数】";
newNode.CommandName = "管线";
newNode.NodeID = item.PipelineId;
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);
}
//var comCount = (from x in Funs.DB.HJGL_Pipeline_Component where x.PipelineId == item.PipelineId select x).Count();
TreeNode newNode = new TreeNode();
//newNode.Text = item.PipelineCode + "【" + comCount.ToString() + " " + "组件" + "】";
newNode.Text = item;
newNode.ToolTip = "流水段";
newNode.CommandName = "流水段";
newNode.NodeID = SQLHelper.GetNewID();
newNode.EnableClickEvent = true;
node.Nodes.Add(newNode);
}
// if (pageindex < pageCount)
// {
// TreeNode newNode = new TreeNode();
// newNode.Text = "加载";
// newNode.NodeID = "加载";
// //newNode.NodeID = SQLHelper.GetNewID();
// newNode.CommandName = "加载";
// newNode.Icon = Icon.ArrowDown;
// newNode.EnableClickEvent = true;
// node.Nodes.Add(newNode);
// }
//}
}
#endregion
protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
{
if (e.Node.Nodes[0].NodeID == "加载流水段...")
@ -197,8 +183,8 @@ namespace FineUIPro.Web.HJGL.PreDesign
e.Node.Nodes.Clear();
BindNodes(e.Node);
}
}
#region TreeView
/// <summary>
/// 点击TreeView
@ -207,30 +193,15 @@ 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 == "管线")
{
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByFlowingSection(this.tvControlItem.SelectedNode.Text);
this.hdUnitWorkId.Text = string.Empty;
if (pipeline != null)
{
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
}
}
else if (e.CommandName == "加载")
{
string CommandName = e.Node.ParentNode.CommandName;
e.Node.ParentNode.CommandName = (int.Parse(CommandName.Split('|')[0]) + 1) + "|" + int.Parse(CommandName.Split('|')[1]);
TreeNode treeNode = e.Node.ParentNode;
treeNode.Nodes.Remove(e.Node);
BindNodes(e.Node.ParentNode);
}
this.BindGrid();
}
#endregion
@ -240,67 +211,9 @@ namespace FineUIPro.Web.HJGL.PreDesign
/// 数据绑定
/// </summary>
private void BindGrid()
{
if (tvControlItem.SelectedNode == null) return;
string strSql = @" SELECT distinct com.PipelineComponentId,com.PipelineComponentCode,com.BoxNumber,com.Remark,
com.PipelineId, punit.UnitName AS PreUnit,aunit.UnitName AS AssembleUnit,com.IsPrint,
com.QRCode,com.State,com.ProductionState,pipe.PlanStartDate,pipe.FlowingSection,com.DrawingName,com.ReceiveDate,
person.PersonName
FROM HJGL_Pipeline_Component com
LEFT JOIN HJGL_Pipeline pipe ON pipe.PipelineId =com.PipelineId
LEFT JOIN dbo.Base_Unit punit ON punit.UnitId=com.PreUnit
LEFT JOIN dbo.Base_Unit aunit ON aunit.UnitId=com.AssembleUnit
LEFT JOIN Person_Persons person on com.ReceiveMan=person.PersonId
LEFT JOIN HJGL_WeldJoint joint on joint.PipelineId =com.PipelineId
WHERE 1=1 ";
List<SqlParameter> listStr = new List<SqlParameter>();
if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
{
strSql += " and pipe.UnitWorkId =@UnitWorkId";
listStr.Add(new SqlParameter("@UnitWorkId", this.tvControlItem.SelectedNodeID));
}
else if (tvControlItem.SelectedNode.CommandName == "管线")
{
strSql += " and com.PipelineId = @PipelineId ";
listStr.Add(new SqlParameter("@PipelineId", this.tvControlItem.SelectedNodeID));
}
if (drpWeldingDailyCode.SelectedValue != Const._Null && !string.IsNullOrEmpty(drpWeldingDailyCode.SelectedValue))
{
strSql += " and joint.WeldingDailyId = @WeldingDailyId ";
listStr.Add(new SqlParameter("@WeldingDailyId", drpWeldingDailyCode.SelectedValue));
}
if (!string.IsNullOrEmpty(txtPipelineComponentCode.Text))
{
strSql += " AND com.PipelineComponentCode like @PipelineComponentCode";
listStr.Add(new SqlParameter("@PipelineComponentCode", "%" + this.txtPipelineComponentCode.Text.Trim() + "%"));
}
if (drpState.SelectedValue != Const._Null)
{
strSql += " AND com.State =@State";
listStr.Add(new SqlParameter("@State", drpState.SelectedValue));
}
if (drpProductionState.SelectedValue != Const._Null)
{
strSql += " AND com.ProductionState =@ProductionState";
listStr.Add(new SqlParameter("@ProductionState", drpProductionState.SelectedValue.ToString()));
}
if (!string.IsNullOrEmpty(drpFlowingSection.SelectedValue) && drpFlowingSection.SelectedValue != Const._Null)
{
strSql += " AND pipe.FlowingSection =@FlowingSection";
listStr.Add(new SqlParameter("@FlowingSection", drpFlowingSection.SelectedValue.ToString()));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
DataTable tb = BindData();
GridDataTable = tb;
// 2.获取当前分页数据
Grid1.RecordCount = tb.Rows.Count;
@ -308,6 +221,78 @@ namespace FineUIPro.Web.HJGL.PreDesign
Grid1.DataSource = table;
Grid1.DataBind();
}
/// <summary>
/// 查询数据
/// </summary>
/// <returns></returns>
private DataTable BindData()
{
string strSql = @"WITH cte as (select pipeline.PipelineCode as PipelineCode,
comonent.PipelineComponentCode as PipelineComponentCode,
'' as matdef,
packdetail.Number as Number,
pack.PackagingCode as PackagingCode,
trainnumber.TrainNumber as TrainNumber,
pipeline.FlowingSection as FlowingSection,
pipeline.UnitWorkId as UnitWorkId
from HJGL_Pipeline pipeline
left join HJGL_PackagingManageDetail packdetail on pipeline.PipelineId = packdetail.PipelineId
left join HJGL_Pipeline_Component comonent
on packdetail.PipelineComponentId = comonent.PipelineComponentId
left join HJGL_PackagingManage pack on packdetail.PackagingManageId = pack.PackagingManageId
left join HJGL_TrainNumberManage trainnumber on pack.TrainNumberId = TrainNumber.Id
where (packdetail.PipelineComponentId is not null or packdetail.PipelineComponentId != '')
union all
select pipeline.PipelineCode as PipelineCode,
packdetail.MaterialCode as PipelineComponentCode,
matlib.MaterialDef as matdef,
packdetail.Number as Number,
pack.PackagingCode as PackagingCode,
trainnumber.TrainNumber as TrainNumber,
pipeline.FlowingSection as FlowingSection,
pipeline.UnitWorkId as UnitWorkId
from HJGL_Pipeline pipeline
left join HJGL_PackagingManageDetail packdetail on pipeline.PipelineId = packdetail.PipelineId
left join HJGL_MaterialCodeLib matlib on packdetail.MaterialCode = matlib.MaterialCode
left join HJGL_PackagingManage pack on packdetail.PackagingManageId = pack.PackagingManageId
left join HJGL_TrainNumberManage trainnumber on pack.TrainNumberId = TrainNumber.Id
where (packdetail.PipelineComponentId is null or packdetail.PipelineComponentId = ''))
SELECT * FROM cte WHERE 1=1 ";
List<SqlParameter> listStr = new List<SqlParameter>();
if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
{
strSql += " and cte.UnitWorkId =@UnitWorkId";
listStr.Add(new SqlParameter("@UnitWorkId", this.tvControlItem.SelectedNodeID));
}
else if (tvControlItem.SelectedNode.CommandName == "流水段")
{
strSql += " and cte.FlowingSection = @FlowingSection ";
listStr.Add(new SqlParameter("@FlowingSection", this.tvControlItem.SelectedNode.Text));
}
if (!string.IsNullOrEmpty(txtPipelineCode2.Text))
{
strSql += " AND cte.PipelineCode like @PipelineCode";
listStr.Add(new SqlParameter("@PipelineCode", "%" + this.txtPipelineCode2.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(txtPipelineComponentCode.Text))
{
strSql += " AND cte.PipelineComponentCode like @PipelineComponentCode";
listStr.Add(new SqlParameter("@PipelineComponentCode", "%" + this.txtPipelineComponentCode.Text.Trim() + "%"));
}
//if (!string.IsNullOrEmpty(drpFlowingSection.SelectedValue) && drpFlowingSection.SelectedValue != Const._Null)
//{
// strSql += " AND cte.FlowingSection =@FlowingSection";
// listStr.Add(new SqlParameter("@FlowingSection", drpFlowingSection.SelectedValue.ToString()));
//}
strSql += " ORDER BY PipelineCode,PipelineComponentCode ";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
return tb;
}
#endregion
#region
@ -347,166 +332,11 @@ namespace FineUIPro.Web.HJGL.PreDesign
BindGrid();
}
#endregion
#endregion
#region 线
/// <summary>
/// Grid双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.HJGL_PrePipelineMenuId, BLL.Const.BtnModify))
{
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PrePipelineEdit.aspx?PipelineComponentId={0}", Grid1.SelectedRowID, "编辑 - ")));
}
else
{
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
protected void btnPrint_Click(object sender, EventArgs e)
{
if (Print(Grid1.SelectedRowIDArray))
{
#region
HJGL_PipelineComponentService.UpdateIsPrint(Grid1.SelectedRowIDArray); //打印后修改打印状态
}
}
private bool Print(string[] PipelineComponentId)
{
BLL.FastReportService.ResetData();
var result = HJGL_PipelineComponentService.GetPrintModelByPipelineComponentIds(PipelineComponentId, null, false);
var tb = LINQToDataTable(result);
if (tb != null && tb.Rows.Count > 0)
{
tb.TableName = "Table1";
}
else
{
ShowNotify("请查看组件是否上传二维码!", MessageBoxIcon.Question);
return false;
}
BLL.FastReportService.AddFastreportTable(tb);
string initTemplatePath = "";
string rootPath = Server.MapPath("~/");
initTemplatePath = "File\\Fastreport\\组件打印.frx";
if (File.Exists(rootPath + initTemplatePath))
{
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("~/Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
}
return true;
}
/// <summary>
/// 增加焊口信息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnNew_Click(object sender, EventArgs e)
{
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_PrePipelineMenuId, Const.BtnAdd))
{
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
if (pipeline != null)
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PrePipelineEdit.aspx?PipelineId={0}", this.tvControlItem.SelectedNodeID, "新增 - ")));
}
else
{
ShowNotify("请选择管线!", MessageBoxIcon.Warning);
}
}
else
{
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
/// <summary>
/// 批量增加焊口信息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnBatchAdd_Click(object sender, EventArgs e)
{
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_PrePipelineMenuId, Const.BtnAdd))
{
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
if (pipeline != null)
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PrePipelineBatchEdit.aspx?PipelineId={0}", this.tvControlItem.SelectedNodeID, "新增 - ")));
}
else
{
ShowNotify("请选择管线!", MessageBoxIcon.Warning);
}
}
else
{
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
/// <summary>
/// 删除按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnDelete_Click(object sender, EventArgs e)
{
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_PrePipelineMenuId, Const.BtnDelete))
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
return;
}
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
BLL.HJGL_PipelineComponentService.DeletePipelineComponent(rowID);
ShowNotify("删除成功!", MessageBoxIcon.Success);
}
//this.InitTreeMenu();//加载树
this.BindGrid();
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == "PreviewQRCode")
{
var ID = e.RowID;
var q = HJGL_PipelineComponentService.GetPipelineComponentById(ID);
string path = "";
if (!string.IsNullOrEmpty(q.QRCode))
{
path = BLL.CreateQRCodeService.CreateCode_Simple(q.QRCode, ID);
if (!string.IsNullOrEmpty(path))
{
string filepath = Funs.SGGLUrl + path.Replace("\\", "//");
ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script type='text/javascript'>window.open('" + filepath + "');</script>");
}
}
}
}
protected void btnSearch_Click(object sender, EventArgs e)
{
BindGrid();
@ -514,17 +344,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
#endregion
#region
/// <summary>
/// 关闭弹出窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
//this.InitTreeMenu();//加载树
this.BindGrid();
}
#region
/// <summary>
/// 查询
@ -538,40 +358,9 @@ namespace FineUIPro.Web.HJGL.PreDesign
protected void btnTreeFind_Click1(object sender, EventArgs e)
{
this.InitTreeMenu();
}
#endregion
/// <summary>
/// 搜索
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public string ConvertImageUrlByImage(object str, object id)
{
string path = string.Empty;
if (!string.IsNullOrEmpty(str.ToString()))
{
path = BLL.CreateQRCodeService.CreateCode_Simple(str.ToString(), id.ToString());
path = HttpUtility.HtmlDecode(BLL.UploadAttachmentService.ShowImage("../../", path));
}
return path;
}
public string ConvertState(object state)
{
string StateName = string.Empty;
if (state != null)
{
if (!string.IsNullOrEmpty(state.ToString()))
{
string txt = HJGL_PipelineComponentService.GetState().FirstOrDefault(x => x.Value == state.ToString()).Text;
return txt;
}
}
return StateName;
}
public string ConvertProductionState(object state)
{
string StateName = string.Empty;
@ -579,95 +368,13 @@ namespace FineUIPro.Web.HJGL.PreDesign
{
if (!string.IsNullOrEmpty(state.ToString()))
{
string txt = HJGL_PipelineComponentService.GetProductionState().FirstOrDefault(x => x.Value == state.ToString()).Text;
return txt;
}
}
return StateName;
}
protected void btnImportQRCode_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("PrePipelineQRCodeIn.aspx?", "导入 - ")));
}
protected void btnSinglePreview_Click(object sender, EventArgs e)
{
//string httpUrl = @"FileUpload\HJGL_DataImport\095e9691-99c2-4f70-8e67-e70c8fa6be9c\2022-06\管道焊接工作记录.pdf";
//var newurl = Funs.SGGLUrl + httpUrl.Replace(Funs.RootPath, "");
var id = Grid1.SelectedRowID;
if (string.IsNullOrEmpty(id))
{
ShowNotify("请选择相对应的管道预制加工图", MessageBoxIcon.Warning);
return;
}
var SingleName = (from x in Funs.DB.HJGL_Pipeline_Component where x.PipelineComponentId == id select (x.DrawingName)).FirstOrDefault();
var filemodel = BLL.HJGL_DataImportService.GetLatestFileByFileName(SingleName, "3", this.CurrUser.LoginProjectId);
if (filemodel != null)
{
string httpUrl = filemodel.FilePath;
PageContext.RegisterStartupScript(Window4.GetShowReference(String.Format("~/AttachFile/Look.aspx?fileUrl={0}", httpUrl, "查看 -")));
}
else
{
ShowNotify("请上传相关管道预制加工图", MessageBoxIcon.Warning);
return;
}
}
protected void btnAccept_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIDArray.Length > 0)
{
foreach (var item in Grid1.SelectedRowIDArray)
{
var model = HJGL_PipelineComponentService.GetPipelineComponentById(item);
if (model.ProductionState == 2)
{
BLL.APIPipelineComponentService.GetComponentConfirmArrival(PipelineComponentId: item, this.CurrUser.PersonId, ""); ;
}
}
ShowNotify("操作成功", MessageBoxIcon.Success);
BindGrid();
}
else
{
ShowNotify("请选择需要验收的数据", MessageBoxIcon.Warning);
}
}
protected void btnRectification_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIDArray.Length > 0)
{
foreach (var item in Grid1.SelectedRowIDArray)
{
var model = HJGL_PipelineComponentService.GetPipelineComponentById(item);
if (model.State == HJGL_PipelineComponentService.StatePenRec)
{
model.State = HJGL_PipelineComponentService.StateRec;
HJGL_PipelineComponentService.UpdatePipelineComponent(model);
}
}
ShowNotify("操作成功", MessageBoxIcon.Success);
BindGrid();
}
else
{
ShowNotify("请选择需要整改的数据", MessageBoxIcon.Warning);
}
}
protected void btnOut_Click(object sender, EventArgs e)
{
@ -676,21 +383,20 @@ namespace FineUIPro.Web.HJGL.PreDesign
var q = (from x in GridDataTable.AsEnumerable()
select new
{
线 = x.Field<string>("PipelineCode"),
= x.Field<string>("PipelineComponentCode"),
= x.Field<string>("BoxNumber"),
= ConvertState(x.Field<object>("State")),
= ConvertProductionState(x.Field<object>("ProductionState")),
线 = x.Field<DateTime?>("PlanStartDate"),
= x.Field<string>("DrawingName"),
= x.Field<string>("PersonName"),
= x.Field<DateTime?>("ReceiveDate"),
= !string.IsNullOrWhiteSpace(x.Field<string>("matdef")) ? x.Field<string>("matdef") : "-",
= x.Field<string>("Number"),
= x.Field<string>("PackagingCode"),
= x.Field<string>("TrainNumber"),
= x.Field<string>("FlowingSection")
});
string path = Funs.RootPath + @"File\Excel\Temp\PrePipeline.xlsx";
path = path.Replace(".xlsx", string.Format("{0:yyyy-MM-dd-HH-mm}", DateTime.Now) + ".xlsx");
string path = Funs.RootPath + @"File\Excel\Temp\PrePipelineInstallList.xlsx";
path = path.Replace(".xlsx", string.Format("{0:yyyy-MM-dd-HHmm}", DateTime.Now) + ".xlsx");
MiniExcel.SaveAs(path, q);
string fileName = "组件信息.xlsx";
string fileName = $"安装清单({(string.Format("{0:yyyy-MM-dd-HHmm}", DateTime.Now))}.xlsx";
FileInfo info = new FileInfo(path);
long fileSize = info.Length;
System.Web.HttpContext.Current.Response.Clear();
@ -702,9 +408,6 @@ namespace FineUIPro.Web.HJGL.PreDesign
System.Web.HttpContext.Current.Response.Close();
File.Delete(path);
}
}
}
}

View File

@ -113,6 +113,15 @@ namespace FineUIPro.Web.HJGL.PreDesign
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar3;
/// <summary>
/// txtPipelineCode2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtPipelineCode2;
/// <summary>
/// txtPipelineComponentCode 控件。
/// </summary>
@ -122,87 +131,6 @@ namespace FineUIPro.Web.HJGL.PreDesign
/// </remarks>
protected global::FineUIPro.TextBox txtPipelineComponentCode;
/// <summary>
/// drpState 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpState;
/// <summary>
/// drpProductionState 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpProductionState;
/// <summary>
/// drpWeldingDailyCode 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpWeldingDailyCode;
/// <summary>
/// drpFlowingSection 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpFlowingSection;
/// <summary>
/// ToolbarFill1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// btnNew 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnNew;
/// <summary>
/// btnSearch 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSearch;
/// <summary>
/// btnDelete 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnDelete;
/// <summary>
/// Toolbar4 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar4;
/// <summary>
/// ToolbarFill2 控件。
/// </summary>
@ -213,58 +141,13 @@ namespace FineUIPro.Web.HJGL.PreDesign
protected global::FineUIPro.ToolbarFill ToolbarFill2;
/// <summary>
/// btnRectification 控件。
/// btnSearch 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnRectification;
/// <summary>
/// btnAccept 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnAccept;
/// <summary>
/// btnImportQRCode 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImportQRCode;
/// <summary>
/// btnBatchAdd 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnBatchAdd;
/// <summary>
/// btnSinglePreview 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSinglePreview;
/// <summary>
/// btnPrint 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnPrint;
protected global::FineUIPro.Button btnSearch;
/// <summary>
/// btnOut 控件。
@ -284,24 +167,6 @@ namespace FineUIPro.Web.HJGL.PreDesign
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// lbstate 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lbstate;
/// <summary>
/// lbProductionState 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lbProductionState;
/// <summary>
/// ToolbarSeparator1 控件。
/// </summary>
@ -328,41 +193,5 @@ namespace FineUIPro.Web.HJGL.PreDesign
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList ddlPageSize;
/// <summary>
/// Window1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window1;
/// <summary>
/// Window2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window2;
/// <summary>
/// Window3 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window3;
/// <summary>
/// Window4 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window4;
}
}