20250609 排产计划

This commit is contained in:
2025-06-09 17:20:34 +08:00
parent a980bb43f3
commit eef442181b
10 changed files with 858 additions and 479 deletions
@@ -12,60 +12,52 @@
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
<f:Panel ID="Panel1" runat="server" ShowBorder="false" ShowHeader="false" Layout="Region">
<Items>
<items>
<f:Panel runat="server" ID="panelLeftRegion" RegionPosition="Left" RegionSplit="true"
EnableCollapse="true" Width="300px" Title="WBS目录"
ShowBorder="true" Layout="VBox" ShowHeader="true" AutoScroll="true" BodyPadding="5px"
IconFont="ArrowCircleLeft">
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
<f:TextBox ID="txtPipelineCode" runat="server" Label="管线"
EmptyText="输入查询条件" Width="280px" LabelWidth="60px">
</f:TextBox>
<f:HiddenField runat="server" ID="hdUnitWorkId"></f:HiddenField>
</Items>
</f:Toolbar>
<toolbars>
<f:Toolbar runat="server" ToolbarAlign="Right">
<Items>
<items>
<f:NumberBox ID="txtSize" runat="server" Label="口径" Width="180px" LabelWidth="60px" LabelAlign="Right" NoDecimal="true" NoNegative="true"></f:NumberBox>
<f:Button ID="btnStatics" runat="server" Text="统计" Icon="ChartPie" OnClick="btnStatics_Click"></f:Button>
<f:HiddenField runat="server" ID="hdUnitWorkId"></f:HiddenField>
<f:ToolbarFill runat="server"></f:ToolbarFill>
<f:Button ID="btnTreeFind" ToolTip="查询" Icon="SystemSearch"
EnablePostBack="true" OnClick="btnTreeFind_Click" runat="server">
</f:Button>
</Items>
</items>
</f:Toolbar>
</Toolbars>
<Items>
</toolbars>
<items>
<f:Tree ID="tvControlItem" ShowHeader="false" Height="560px" Title="单位工程"
OnNodeCommand="tvControlItem_NodeCommand" runat="server" ShowBorder="false" EnableCollapse="true"
EnableSingleClickExpand="false" AutoLeafIdentification="true" OnNodeExpand="tvControlItem_TreeNodeExpanded"
EnableTextSelection="true">
</f:Tree>
</Items>
</items>
</f:Panel>
<f:Panel runat="server" ID="panelCenterRegion" RegionPosition="Center" ShowBorder="true"
Layout="VBox" ShowHeader="false" BodyPadding="5px" IconFont="PlusCircle" Title="排产计划"
TitleToolTip="排产计划" AutoScroll="true">
<Toolbars>
<toolbars>
<f:Toolbar ID="Toolbar3" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
<items>
<f:ToolbarFill ID="ToolbarFill1" runat="server">
</f:ToolbarFill>
<f:Button ID="btnSave" runat="server" OnClick="btnSave_Click" Text="保存" Icon="SystemSave"></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>
</items>
</f:Toolbar>
</Toolbars>
<Items>
</toolbars>
<items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="排产计划" ForceFit="false"
EnableCollapse="true" runat="server" BoxFlex="1" DataKeyNames="ProductionSchedulingPlanId" AllowCellEditing="true"
AllowColumnLocking="true" EnableColumnLines="true" ClicksToEdit="1" DataIDField="ProductionSchedulingPlanId"
AllowSorting="true" SortField="FlowNum" SortDirection="ASC" OnSort="Grid1_Sort"
AllowPaging="true" IsDatabasePaging="true" PageSize="15" OnPageIndexChange="Grid1_PageIndexChange"
EnableTextSelection="True">
<Columns>
<columns>
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号"
Width="60px" HeaderTextAlign="Center" TextAlign="Center" />
<f:RenderField HeaderText="流水段号" ColumnID="FlowNum"
@@ -95,50 +87,65 @@
<f:RenderField HeaderText="总优先级" ColumnID="TotalPriority"
DataField="TotalPriority" SortField="TotalPriority" FieldType="String" HeaderTextAlign="Center" TextAlign="Left"
Width="100px">
<Editor>
<editor>
<f:TextBox ID="txtTotalPriority" runat="server"></f:TextBox>
</Editor>
</editor>
</f:RenderField>
<f:RenderField HeaderText="优先级总达因" ColumnID="PriorityTotalDyne"
DataField="PriorityTotalDyne" SortField="PriorityTotalDyne" FieldType="Float" HeaderTextAlign="Center" TextAlign="Left"
Width="120px">
<Editor>
<editor>
<f:NumberBox ID="txtPriorityTotalDyne" runat="server"></f:NumberBox>
</Editor>
</editor>
</f:RenderField>
<f:RenderField HeaderText="计划开始时间" ColumnID="PlanStartDate"
DataField="PlanStartDate" SortField="PlanStartDate" FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd" HeaderTextAlign="Center" TextAlign="Left"
Width="120px">
<Editor>
<editor>
<f:DatePicker ID="txtPlanStartDate" runat="server"></f:DatePicker>
</Editor>
</editor>
</f:RenderField>
<f:RenderField HeaderText="计划结束时间" ColumnID="PlanEndDate"
DataField="PlanEndDate" SortField="PlanEndDate" FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd" HeaderTextAlign="Center" TextAlign="Left"
Width="120px">
<Editor>
<editor>
<f:DatePicker ID="txtPlanEndDate" runat="server"></f:DatePicker>
</Editor>
</editor>
</f:RenderField>
<f:RenderField HeaderText="天数" ColumnID="Days"
DataField="Days" SortField="Days" FieldType="Int" HeaderTextAlign="Center" TextAlign="Left"
Width="90px">
<Editor>
<editor>
<f:NumberBox ID="txtDays" runat="server" NoDecimal="true" NoNegative="true"></f:NumberBox>
</Editor>
</editor>
</f:RenderField>
<f:RenderField HeaderText="平均每天工作量" ColumnID="AvgDailyWorkload"
DataField="AvgDailyWorkload" SortField="AvgDailyWorkload" FieldType="Float" HeaderTextAlign="Center" TextAlign="Left"
Width="120px">
<Editor>
<editor>
<f:NumberBox ID="txtAvgDailyWorkload" runat="server" NoNegative="true"></f:NumberBox>
</Editor>
</editor>
</f:RenderField>
</Columns>
<Listeners>
<f:RenderField HeaderText="已完成量" ColumnID="CompletedCount"
DataField="CompletedCount" SortField="CompletedCount" FieldType="String" HeaderTextAlign="Center" TextAlign="Left"
Width="120px">
</f:RenderField>
<f:RenderField HeaderText="已完成百分比" ColumnID="CompletedRate"
DataField="CompletedRate" SortField="CompletedRate" FieldType="String" HeaderTextAlign="Center" TextAlign="Left"
Width="120px">
</f:RenderField>
<f:RenderField HeaderText="已完成百分比汇总" ColumnID="TotalCompletedRate"
DataField="TotalCompletedRate" SortField="TotalCompletedRate" FieldType="String" HeaderTextAlign="Center" TextAlign="Left"
Width="120px">
</f:RenderField>
</columns>
<listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
</listeners>
<listeners>
<f:Listener Event="dataload" Handler="onGridDataLoad" />
</Listeners>
<PageItems>
</listeners>
<pageitems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
</f:ToolbarSeparator>
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
@@ -151,14 +158,26 @@
<f:ListItem Text="25" Value="25" />
<f:ListItem Text="所有行" Value="10000" />
</f:DropDownList>
</PageItems>
</pageitems>
</f:Grid>
</Items>
</items>
</f:Panel>
</Items>
</items>
</f:Panel>
<f:Menu ID="Menu1" runat="server">
<f:MenuButton ID="btnMenuDelete" OnClick="btnMenuDelete_Click" EnablePostBack="true" Icon="Delete"
ConfirmText="删除选中行?" ConfirmTarget="Parent" runat="server" Text="删除">
</f:MenuButton>
</f:Menu>
</form>
<script type="text/javascript">
var menuID = '<%= Menu1.ClientID %>';
// 返回false,来阻止浏览器右键菜单
function onRowContextMenu(event, rowId) {
F(menuID).show(); //showAt(event.pageX, event.pageY);
return false;
}
function reloadGrid() {
__doPostBack(null, 'reloadGrid');
}
@@ -1,7 +1,9 @@
using BLL;
using FineUIPro.Web.ProjectData;
using MiniExcelLibs;
using Model;
using Newtonsoft.Json.Linq;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Data;
@@ -11,6 +13,7 @@ using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Web;
using System.Web.WebSockets;
@@ -83,7 +86,7 @@ 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.FlowingSection).Distinct().Count();
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipeArea == "1" select x.FlowingSection).Distinct().Count();
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
TreeNode tn1 = new TreeNode();
tn1.NodeID = q.UnitWorkId;
@@ -112,7 +115,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.FlowingSection).Distinct().Count();
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipeArea == "1" select x.FlowingSection).Distinct().Count();
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
TreeNode tn2 = new TreeNode();
tn2.NodeID = q.UnitWorkId;
@@ -147,7 +150,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
{
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();
var list = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.PipeArea == "1" && x.UnitWorkId == node.NodeID 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]);
@@ -199,16 +202,16 @@ namespace FineUIPro.Web.HJGL.PreDesign
/// <param name="e"></param>
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
{
if (e.CommandName == "流水段")
{
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;
SaveProductionSchedulingPlan();
}
}
//if (e.CommandName == "流水段")
//{
// 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;
// SaveProductionSchedulingPlan();
// }
//}
this.BindGrid();
}
@@ -220,23 +223,145 @@ namespace FineUIPro.Web.HJGL.PreDesign
{
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
{
List<Model.View_HJGL_ProductionSchedulingPlanStatistics> lists = (from x in Funs.DB.View_HJGL_ProductionSchedulingPlanStatistics.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.FlowingSection == this.tvControlItem.SelectedNode.Text) select x).ToList();
foreach (var item in lists)
if (tvControlItem.SelectedNode.CommandName == "流水段")
{
var plan = BLL.ProductionSchedulingPlanService.GetProductionSchedulingPlan(this.CurrUser.LoginProjectId, item.FlowingSection, item.UnitWorkName, item.Material, item.Caliber);
if (plan == null)
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@projectId", this.CurrUser.LoginProjectId));
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNode.ParentNode.NodeID))
{
Model.HJGL_ProductionSchedulingPlan newPlan = new HJGL_ProductionSchedulingPlan();
newPlan.ProductionSchedulingPlanId = SQLHelper.GetNewID(typeof(Model.HJGL_ProductionSchedulingPlan));
newPlan.ProjectId = this.CurrUser.LoginProjectId;
//newPlan.PipelineId = this.tvControlItem.SelectedNodeID;
newPlan.FlowNum = item.FlowingSection;
newPlan.MainItemName = item.UnitWorkName;
newPlan.Material = item.Material;
newPlan.Caliber = item.Caliber;
newPlan.Dain = item.Dia;
newPlan.TotalDyne = lists.Sum(x => x.Dia);
BLL.ProductionSchedulingPlanService.AddProductionSchedulingPlan(newPlan);
listStr.Add(new SqlParameter("@unitWorkId", this.tvControlItem.SelectedNode.ParentNode.NodeID));
}
else
{
listStr.Add(new SqlParameter("@unitWorkId", null));
}
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNode.Text))
{
listStr.Add(new SqlParameter("@flowingSection", this.tvControlItem.SelectedNode.Text));
}
else
{
listStr.Add(new SqlParameter("@flowingSection", null));
}
if (!string.IsNullOrEmpty(this.txtSize.Text.Trim()))
{
listStr.Add(new SqlParameter("@caliber", this.txtSize.Text.Trim()));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunProc("Sp_ProductionSchedulingPlanStatistics", parameter);
for (int i = 0; i < tb.Rows.Count; i++)
{
//decimal totalDia = 0;
//totalDia += Convert.ToDecimal(tb.Rows[i]["Dia"].ToString());//总达因
var plan = BLL.ProductionSchedulingPlanService.GetProductionSchedulingPlan(this.CurrUser.LoginProjectId, tb.Rows[i]["FlowingSection"].ToString(), tb.Rows[i]["UnitWorkId"].ToString(), tb.Rows[i]["Material"].ToString(), tb.Rows[i]["Caliber"].ToString());
if (plan == null)
{
Model.HJGL_ProductionSchedulingPlan newPlan = new HJGL_ProductionSchedulingPlan();
newPlan.ProductionSchedulingPlanId = SQLHelper.GetNewID(typeof(Model.HJGL_ProductionSchedulingPlan));
newPlan.ProjectId = this.CurrUser.LoginProjectId;
newPlan.PipelineId = tb.Rows[i]["UnitWorkId"].ToString();//装置ID
newPlan.FlowNum = tb.Rows[i]["FlowingSection"].ToString();
newPlan.MainItemName = tb.Rows[i]["UnitWorkName"].ToString();
newPlan.Material = tb.Rows[i]["Material"].ToString();
newPlan.Caliber = tb.Rows[i]["Caliber"].ToString();
newPlan.Dain = Funs.GetNewDecimalOrZero(tb.Rows[i]["Dia"].ToString());
newPlan.TotalDyne = Funs.GetNewDecimalOrZero(tb.Rows[i]["TotalDia"].ToString());
newPlan.CompletedCount = Funs.GetNewIntOrZero(tb.Rows[i]["cTotalCount"].ToString());
newPlan.CompletedRate = Funs.GetNewDecimalOrZero(tb.Rows[i]["rate"].ToString());
newPlan.TotalCompletedRate = Funs.GetNewDecimalOrZero(tb.Rows[i]["Srate"].ToString());
BLL.ProductionSchedulingPlanService.AddProductionSchedulingPlan(newPlan);
}
}
}
else if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)//单位工程
{
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@projectId", this.CurrUser.LoginProjectId));
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNode.NodeID))
{
listStr.Add(new SqlParameter("@unitWorkId", this.tvControlItem.SelectedNode.NodeID));
}
else
{
listStr.Add(new SqlParameter("@unitWorkId", null));
}
if (!string.IsNullOrEmpty(this.txtSize.Text.Trim()))
{
listStr.Add(new SqlParameter("@caliber", this.txtSize.Text.Trim()));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunProc("Sp_ProductionSchedulingPlanStatistics", parameter);
for (int i = 0; i < tb.Rows.Count; i++)
{
var plan = BLL.ProductionSchedulingPlanService.GetProductionSchedulingPlan(this.CurrUser.LoginProjectId, tb.Rows[i]["FlowingSection"].ToString(), tb.Rows[i]["UnitWorkId"].ToString(), tb.Rows[i]["Material"].ToString(), tb.Rows[i]["Caliber"].ToString());
if (plan == null)
{
Model.HJGL_ProductionSchedulingPlan newPlan = new HJGL_ProductionSchedulingPlan();
newPlan.ProductionSchedulingPlanId = SQLHelper.GetNewID(typeof(Model.HJGL_ProductionSchedulingPlan));
newPlan.ProjectId = this.CurrUser.LoginProjectId;
newPlan.PipelineId = tb.Rows[i]["UnitWorkId"].ToString();//装置ID
newPlan.FlowNum = tb.Rows[i]["FlowingSection"].ToString();
newPlan.MainItemName = tb.Rows[i]["UnitWorkName"].ToString();
newPlan.Material = tb.Rows[i]["Material"].ToString();
newPlan.Caliber = tb.Rows[i]["Caliber"].ToString();
newPlan.Dain = Funs.GetNewDecimalOrZero(tb.Rows[i]["Dia"].ToString());
newPlan.TotalDyne = Funs.GetNewDecimalOrZero(tb.Rows[i]["TotalDia"].ToString());
newPlan.CompletedCount = Funs.GetNewIntOrZero(tb.Rows[i]["cTotalCount"].ToString());
newPlan.CompletedRate = Funs.GetNewDecimalOrZero(tb.Rows[i]["rate"].ToString());
newPlan.TotalCompletedRate = Funs.GetNewDecimalOrZero(tb.Rows[i]["Srate"].ToString());
BLL.ProductionSchedulingPlanService.AddProductionSchedulingPlan(newPlan);
}
}
}
else if (this.tvControlItem.SelectedNodeID == "1" || this.tvControlItem.SelectedNodeID == "2")
{
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@projectId", this.CurrUser.LoginProjectId));
if (!string.IsNullOrEmpty(this.hdUnitWorkId.Text))
{
listStr.Add(new SqlParameter("@unitWorkId", this.hdUnitWorkId.Text));
}
else
{
listStr.Add(new SqlParameter("@unitWorkId", null));
}
if (!string.IsNullOrEmpty(this.txtSize.Text.Trim()))
{
listStr.Add(new SqlParameter("@caliber", this.txtSize.Text.Trim()));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunProc("Sp_ProductionSchedulingPlanStatistics", parameter);
for (int i = 0; i < tb.Rows.Count; i++)
{
if (!string.IsNullOrEmpty(tb.Rows[i]["FlowingSection"].ToString()))
{
var plan = BLL.ProductionSchedulingPlanService.GetProductionSchedulingPlan(this.CurrUser.LoginProjectId, tb.Rows[i]["FlowingSection"].ToString(), tb.Rows[i]["UnitWorkId"].ToString(), tb.Rows[i]["Material"].ToString(), tb.Rows[i]["Caliber"].ToString());
if (plan == null)
{
Model.HJGL_ProductionSchedulingPlan newPlan = new HJGL_ProductionSchedulingPlan();
newPlan.ProductionSchedulingPlanId = SQLHelper.GetNewID(typeof(Model.HJGL_ProductionSchedulingPlan));
newPlan.ProjectId = this.CurrUser.LoginProjectId;
newPlan.PipelineId = tb.Rows[i]["UnitWorkId"].ToString();//装置ID
newPlan.FlowNum = tb.Rows[i]["FlowingSection"].ToString();
newPlan.MainItemName = tb.Rows[i]["UnitWorkName"].ToString();
newPlan.Material = tb.Rows[i]["Material"].ToString();
newPlan.Caliber = tb.Rows[i]["Caliber"].ToString();
newPlan.Dain = Funs.GetNewDecimalOrZero(tb.Rows[i]["Dia"].ToString());
newPlan.TotalDyne = Funs.GetNewDecimalOrZero(tb.Rows[i]["TotalDia"].ToString());
newPlan.CompletedCount = Funs.GetNewIntOrZero(tb.Rows[i]["cTotalCount"].ToString());
newPlan.CompletedRate = Funs.GetNewDecimalOrZero(tb.Rows[i]["rate"].ToString());
newPlan.TotalCompletedRate = Funs.GetNewDecimalOrZero(tb.Rows[i]["Srate"].ToString());
BLL.ProductionSchedulingPlanService.AddProductionSchedulingPlan(newPlan);
}
}
}
}
}
@@ -264,22 +389,35 @@ namespace FineUIPro.Web.HJGL.PreDesign
p.PlanStartDate,
p.PlanEndDate,
p.Days,
p.AvgDailyWorkload
p.AvgDailyWorkload,
w.ProjectType,
p.CompletedCount,
p.CompletedRate,
p.TotalCompletedRate
FROM HJGL_ProductionSchedulingPlan p
left join WBS_UnitWork w on w.UnitWorkId=p.PipelineId
WHERE 1=1 ";
List<SqlParameter> listStr = new List<SqlParameter>();
if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
{
strSql += " and p.MainItemName =@UnitWorkId";
listStr.Add(new SqlParameter("@UnitWorkId", this.tvControlItem.SelectedNode.Text));
strSql += " and p.PipelineId =@UnitWorkId";
listStr.Add(new SqlParameter("@UnitWorkId", this.tvControlItem.SelectedNode.NodeID));
}
else if (tvControlItem.SelectedNode.CommandName == "流水段")
{
strSql += " and p.FlowNum = @FlowNum ";
strSql += "and p.PipelineId =@UnitWorkId and p.FlowNum = @FlowNum ";
listStr.Add(new SqlParameter("@UnitWorkId", this.tvControlItem.SelectedNode.ParentNode.NodeID));
listStr.Add(new SqlParameter("@FlowNum", this.tvControlItem.SelectedNode.Text));
}
else if (tvControlItem.SelectedNodeID == "1")
{
strSql += "and w.ProjectType ='1' ";
}
else if (tvControlItem.SelectedNodeID == "2")
{
strSql += "and w.ProjectType ='2' ";
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
@@ -332,10 +470,10 @@ namespace FineUIPro.Web.HJGL.PreDesign
#endregion
#region
protected void btnSearch_Click(object sender, EventArgs e)
{
BindGrid();
}
//protected void btnSearch_Click(object sender, EventArgs e)
//{
// BindGrid();
//}
#endregion
@@ -345,15 +483,15 @@ namespace FineUIPro.Web.HJGL.PreDesign
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void TextBox_TextChanged(object sender, EventArgs e)
{
this.BindGrid();
}
protected void btnTreeFind_Click(object sender, EventArgs e)
{
this.InitTreeMenu();
//protected void TextBox_TextChanged(object sender, EventArgs e)
//{
// this.BindGrid();
//}
//protected void btnTreeFind_Click(object sender, EventArgs e)
//{
// this.InitTreeMenu();
}
//}
#endregion
#region
@@ -470,7 +608,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
cell = row.CreateCell(5);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.TotalDyne.HasValue?item.TotalDyne.ToString():"");//总达因数
cell.SetCellValue(item.TotalDyne.HasValue ? item.TotalDyne.ToString() : "");//总达因数
cell = row.CreateCell(6);
cell.CellStyle = cellStyle;
@@ -490,12 +628,24 @@ namespace FineUIPro.Web.HJGL.PreDesign
cell = row.CreateCell(10);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.Days.HasValue?item.Days.ToString():"");//天数
cell.SetCellValue(item.Days.HasValue ? item.Days.ToString() : "");//天数
cell = row.CreateCell(11);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.AvgDailyWorkload.HasValue ? item.AvgDailyWorkload.ToString():"");//平均每天工作量
cell.SetCellValue(item.AvgDailyWorkload.HasValue ? item.AvgDailyWorkload.ToString() : "");//平均每天工作量
cell = row.CreateCell(12);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.CompletedCount.HasValue ? item.CompletedCount.ToString() : "");//已完成量
cell = row.CreateCell(13);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.CompletedRate.HasValue ? item.CompletedRate.ToString() : "");//已完成百分比
cell = row.CreateCell(14);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.TotalCompletedRate.HasValue ? item.TotalCompletedRate.ToString() : "");//已完成百分比汇总
i++;
}
// 第三步:写入文件流
@@ -522,5 +672,103 @@ namespace FineUIPro.Web.HJGL.PreDesign
}
}
#endregion
#region
/// <summary>
/// 统计
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnStatics_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.txtSize.Text.Trim()))
{
//单位工程
if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
{
///根据流水段获取管线信息
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByUnitWorkId(this.tvControlItem.SelectedNode.NodeID);
this.hdUnitWorkId.Text = string.Empty;
if (pipeline != null)
{
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.NodeID;
SaveProductionSchedulingPlan();
}
}
else if (tvControlItem.SelectedNode.CommandName == "流水段")
{
///根据流水段获取管线信息
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;
SaveProductionSchedulingPlan();
}
}
else
{
var unitWorkList = (from x in Funs.DB.WBS_UnitWork
where x.ProjectId == this.CurrUser.LoginProjectId
&& x.SuperUnitWork == null && x.UnitId != null && x.ProjectType != null
select x).ToList();
List<Model.WBS_UnitWork> unitWorks = null;
//List<Model.WBS_UnitWork> unitWork2 = null;
//
if (this.tvControlItem.SelectedNodeID == "1")
{
unitWorks = (from x in unitWorkList where x.ProjectType == "1" select x).ToList();
}
else if (this.tvControlItem.SelectedNodeID == "2")
{
unitWorks = (from x in unitWorkList where x.ProjectType == "2" select x).ToList();
}
foreach (var item in unitWorks)
{
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByUnitWorkId(item.UnitWorkId);
this.hdUnitWorkId.Text = string.Empty;
if (pipeline != null)
{
this.hdUnitWorkId.Text = item.UnitWorkId;
SaveProductionSchedulingPlan();
}
}
}
this.BindGrid();
}
else
{
Alert.ShowInTop("请输入口径!", MessageBoxIcon.Warning);
return;
}
}
#endregion
#region
/// <summary>
/// 删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
var model = BLL.ProductionSchedulingPlanService.GetProductionSchedulingPlanById(rowID);
if (model != null)
{
BLL.ProductionSchedulingPlanService.DeleteProductionSchedulingPlanById(rowID);
}
}
BindGrid();
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
}
}
#endregion
}
}
@@ -51,22 +51,22 @@ namespace FineUIPro.Web.HJGL.PreDesign
protected global::FineUIPro.Panel panelLeftRegion;
/// <summary>
/// Toolbar1 控件。
/// txtSize 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
protected global::FineUIPro.NumberBox txtSize;
/// <summary>
/// txtPipelineCode 控件。
/// btnStatics 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtPipelineCode;
protected global::FineUIPro.Button btnStatics;
/// <summary>
/// hdUnitWorkId 控件。
@@ -77,15 +77,6 @@ namespace FineUIPro.Web.HJGL.PreDesign
/// </remarks>
protected global::FineUIPro.HiddenField hdUnitWorkId;
/// <summary>
/// btnTreeFind 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnTreeFind;
/// <summary>
/// tvControlItem 控件。
/// </summary>
@@ -229,5 +220,23 @@ namespace FineUIPro.Web.HJGL.PreDesign
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList ddlPageSize;
/// <summary>
/// Menu1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnMenuDelete 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuDelete;
}
}