This commit is contained in:
2025-09-24 17:32:36 +08:00
19 changed files with 807 additions and 121 deletions
@@ -7,6 +7,12 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>排产计划</title>
<link href="../../res/css/common.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.color1 {
background:#ff0000;
}
</style>
</head>
<body>
<form id="form1" runat="server">
@@ -56,7 +62,7 @@
EnableColumnLines="true" ClicksToEdit="1" DataIDField="ProductionSchedulingPlanId"
AllowSorting="true" SortField="FlowNum,Material,Caliber" SortDirection="ASC" OnSort="Grid1_Sort"
AllowPaging="true" IsDatabasePaging="true" PageSize="15" OnPageIndexChange="Grid1_PageIndexChange"
EnableTextSelection="True">
EnableTextSelection="True" OnRowDataBound="Grid1_RowDataBound">
<Columns>
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号"
Width="60px" HeaderTextAlign="Center" TextAlign="Center" />
@@ -80,23 +86,23 @@
DataField="Dain" SortField="Dain" FieldType="Float" HeaderTextAlign="Center" TextAlign="Left"
Width="90px">
</f:RenderField>
<f:RenderField HeaderText="总达因" ColumnID="TotalDyne"
<f:RenderField HeaderText="总达因(按材质)" ColumnID="TotalDyne"
DataField="TotalDyne" SortField="TotalDyne" FieldType="String" HeaderTextAlign="Center" TextAlign="Left"
Width="90px">
Width="150px">
</f:RenderField>
<f:RenderField HeaderText="总优先级" ColumnID="TotalPriority"
<f:RenderField HeaderText="总达因(按材质)优先级" ColumnID="TotalPriority"
DataField="TotalPriority" SortField="TotalPriority" FieldType="String" HeaderTextAlign="Center" TextAlign="Left"
Width="100px">
Width="190px">
<Editor>
<f:TextBox ID="txtTotalPriority" runat="server"></f:TextBox>
</Editor>
</f:RenderField>
<f:RenderField HeaderText="优先级总达因" ColumnID="PriorityTotalDyne"
<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"
@@ -119,7 +125,7 @@
<f:NumberBox ID="txtDays" runat="server" NoDecimal="true" NoNegative="true" ></f:NumberBox>
</Editor>--%>
</f:RenderField>
<f:RenderField HeaderText="平均每工作量" ColumnID="AvgDailyWorkload"
<f:RenderField HeaderText="平均每日应完成工作量" ColumnID="AvgDailyWorkload"
DataField="AvgDailyWorkload" FieldType="Float" HeaderTextAlign="Center" TextAlign="Left"
Width="140px">
<Editor>
@@ -129,9 +135,9 @@
<f:RenderField HeaderText="当日已完成量" ColumnID="OnDayCompleteDyne"
DataField="OnDayCompleteDyne" FieldType="Float" HeaderTextAlign="Center" TextAlign="Left"
Width="120px">
<Editor>
<%--<Editor>
<f:NumberBox ID="NumberBox1" runat="server" NoNegative="true"></f:NumberBox>
</Editor>
</Editor>--%>
</f:RenderField>
<f:RenderField HeaderText="次日应完成量" ColumnID="NextDayCompleteDyne"
DataField="NextDayCompleteDyne" FieldType="Float" HeaderTextAlign="Center" TextAlign="Left"
@@ -196,7 +202,7 @@
}
function onGridDataLoad(event) {
this.mergeColumns(['FlowNum', 'Material', 'TotalDyne', 'TotalCompletedRate']);
this.mergeColumns(['FlowNum', 'Material', 'TotalDyne','TotalPriority','PriorityTotalDyne', 'TotalCompletedRate']);
}
//自动计算天数、平均每天工作量
@@ -223,10 +223,11 @@ namespace FineUIPro.Web.HJGL.PreDesign
{
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
{
string projectId = this.CurrUser.LoginProjectId;
if (tvControlItem.SelectedNode.CommandName == "流水段")
{
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@projectId", this.CurrUser.LoginProjectId));
listStr.Add(new SqlParameter("@projectId", projectId));
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNode.ParentNode.NodeID))
{
listStr.Add(new SqlParameter("@unitWorkId", this.tvControlItem.SelectedNode.ParentNode.NodeID));
@@ -252,7 +253,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
DataTable tb = SQLHelper.GetDataTableRunProc("Sp_ProductionSchedulingPlanStatistics", parameter);
//删除原有数据
BLL.ProductionSchedulingPlanService.DeleteProductionSchedulingPlanByUnitWorkIdAndFlowNum(this.CurrUser.LoginProjectId,this.tvControlItem.SelectedNode.ParentNode.Text, this.tvControlItem.SelectedNode.Text);
BLL.ProductionSchedulingPlanService.DeleteProductionSchedulingPlanByUnitWorkIdAndFlowNum(projectId, this.tvControlItem.SelectedNode.ParentNode.Text, this.tvControlItem.SelectedNode.Text);
for (int i = 0; i < tb.Rows.Count; i++)
{
string unitWorkId = tb.Rows[i]["UnitWorkId"].ToString();//单位工程
@@ -261,32 +262,52 @@ namespace FineUIPro.Web.HJGL.PreDesign
string material = tb.Rows[i]["Material"].ToString();//材质Text
string caliber = tb.Rows[i]["Caliber"].ToString();//寸径
var plan = BLL.ProductionSchedulingPlanService.GetProductionSchedulingPlan(this.CurrUser.LoginProjectId, flowingSection, unitWorkId, material, caliber);
var plan = BLL.ProductionSchedulingPlanService.GetProductionSchedulingPlan(projectId, flowingSection, unitWorkId, material, caliber);
if (plan == null)
{
Model.HJGL_ProductionSchedulingPlan newPlan = new HJGL_ProductionSchedulingPlan();
newPlan.ProductionSchedulingPlanId = SQLHelper.GetNewID(typeof(Model.HJGL_ProductionSchedulingPlan));
newPlan.ProjectId = this.CurrUser.LoginProjectId;
newPlan.ProjectId = projectId;
newPlan.PipelineId = unitWorkId;
newPlan.FlowNum = flowingSection;
newPlan.MainItemName = tb.Rows[i]["UnitWorkName"].ToString();
newPlan.Material = material;
newPlan.Caliber = caliber;
newPlan.Dain = BLL.WeldJointService.GetSizeSum(this.CurrUser.LoginProjectId, unitWorkId, flowingSection, steelType, caliber,"1");
newPlan.TotalDyne = BLL.WeldJointService.GetSizeSumByUnitWorkIdAndFlowingSection(this.CurrUser.LoginProjectId, unitWorkId, flowingSection,"1");
newPlan.CompletedCount = BLL.WeldJointService.GetSizeSum(this.CurrUser.LoginProjectId, unitWorkId, flowingSection, steelType, caliber, "2");
newPlan.Dain = BLL.WeldJointService.GetSizeSum(projectId, unitWorkId, flowingSection, steelType, caliber, "1");//达因数
var dyne = BLL.WeldJointService.GetSizeSumByUnitWorkIdAndFlowingSectionAndMaterial(projectId, unitWorkId, flowingSection, steelType);//总达因(按材质)
if (dyne != null)
{
newPlan.TotalDyne = dyne;
}
else
{
newPlan.TotalDyne = 0;
}
newPlan.PriorityTotalDyne = BLL.WeldJointService.GetSizeSumByUnitWorkIdAndFlowingSection(projectId, unitWorkId, flowingSection, "1");//总达因
//当日已完成量
var currentDay = BLL.WeldJointService.GetCurrentDaySizeSum(projectId, unitWorkId, flowingSection, steelType, caliber);
if (currentDay != null)
{
newPlan.OnDayCompleteDyne = currentDay;
}
else
{
newPlan.OnDayCompleteDyne = 0;
}
newPlan.CompletedCount = BLL.WeldJointService.GetSizeSum(projectId, unitWorkId, flowingSection, steelType, caliber, "2");//累计已完成量
if (newPlan.Dain > 0)
{
newPlan.CompletedRate = (newPlan.CompletedCount / newPlan.Dain) * 100;
newPlan.CompletedRate = (newPlan.CompletedCount / newPlan.Dain) * 100;//已完成百分比
}
else
{
newPlan.CompletedRate = 0;
}
if (newPlan.TotalDyne > 0)
if (newPlan.PriorityTotalDyne > 0)
{
decimal? completeDinSum = BLL.WeldJointService.GetSizeSumByUnitWorkIdAndFlowingSection(this.CurrUser.LoginProjectId, unitWorkId, flowingSection, "2");
newPlan.TotalCompletedRate = (completeDinSum / newPlan.TotalDyne) * 100;
decimal? completeDinSum = BLL.WeldJointService.GetSizeSumByUnitWorkIdAndFlowingSection(projectId, unitWorkId, flowingSection, "2");//完成总达因
newPlan.TotalCompletedRate = (completeDinSum / newPlan.PriorityTotalDyne) * 100;//已完成百分比汇总
}
else
{
@@ -299,7 +320,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
else if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)//单位工程
{
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@projectId", this.CurrUser.LoginProjectId));
listStr.Add(new SqlParameter("@projectId", projectId));
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNode.NodeID))
{
listStr.Add(new SqlParameter("@unitWorkId", this.tvControlItem.SelectedNode.NodeID));
@@ -317,7 +338,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
DataTable tb = SQLHelper.GetDataTableRunProc("Sp_ProductionSchedulingPlanStatistics", parameter);
//删除原有数据
BLL.ProductionSchedulingPlanService.DeleteProductionSchedulingPlanByUnitWork(this.CurrUser.LoginProjectId, this.tvControlItem.SelectedNode.Text);
BLL.ProductionSchedulingPlanService.DeleteProductionSchedulingPlanByUnitWork(projectId, this.tvControlItem.SelectedNode.Text);
for (int i = 0; i < tb.Rows.Count; i++)
{
string unitWorkId = tb.Rows[i]["UnitWorkId"].ToString();//单位工程
@@ -325,32 +346,51 @@ namespace FineUIPro.Web.HJGL.PreDesign
string steelType = tb.Rows[i]["SteelType"].ToString();//材质Value
string material = tb.Rows[i]["Material"].ToString();//材质Text
string caliber = tb.Rows[i]["Caliber"].ToString();//寸径
var plan = BLL.ProductionSchedulingPlanService.GetProductionSchedulingPlan(this.CurrUser.LoginProjectId, flowingSection, unitWorkId, material, caliber);
var plan = BLL.ProductionSchedulingPlanService.GetProductionSchedulingPlan(projectId, flowingSection, unitWorkId, material, caliber);
if (plan == null)
{
Model.HJGL_ProductionSchedulingPlan newPlan = new HJGL_ProductionSchedulingPlan();
newPlan.ProductionSchedulingPlanId = SQLHelper.GetNewID(typeof(Model.HJGL_ProductionSchedulingPlan));
newPlan.ProjectId = this.CurrUser.LoginProjectId;
newPlan.ProjectId = projectId;
newPlan.PipelineId = unitWorkId;
newPlan.FlowNum = flowingSection;
newPlan.MainItemName = tb.Rows[i]["UnitWorkName"].ToString();
newPlan.Material = material;
newPlan.Caliber = caliber;
newPlan.Dain = BLL.WeldJointService.GetSizeSum(this.CurrUser.LoginProjectId, unitWorkId, flowingSection, steelType, caliber, "1");
newPlan.TotalDyne = BLL.WeldJointService.GetSizeSumByUnitWorkIdAndFlowingSection(this.CurrUser.LoginProjectId, unitWorkId, flowingSection, "1");
newPlan.CompletedCount = BLL.WeldJointService.GetSizeSum(this.CurrUser.LoginProjectId, unitWorkId, flowingSection, steelType, caliber, "2");
newPlan.Dain = BLL.WeldJointService.GetSizeSum(projectId, unitWorkId, flowingSection, steelType, caliber, "1");//达因数
var dyne = BLL.WeldJointService.GetSizeSumByUnitWorkIdAndFlowingSectionAndMaterial(projectId, unitWorkId, flowingSection, steelType);//总达因(按材质)
if (dyne != null)
{
newPlan.TotalDyne = dyne;
}
else
{
newPlan.TotalDyne = 0;
}
newPlan.PriorityTotalDyne = BLL.WeldJointService.GetSizeSumByUnitWorkIdAndFlowingSection(projectId, unitWorkId, flowingSection, "1");//总达因
//当日已完成量
var currentDay = BLL.WeldJointService.GetCurrentDaySizeSum(projectId, unitWorkId, flowingSection, steelType, caliber);
if (currentDay != null)
{
newPlan.OnDayCompleteDyne = currentDay;
}
else
{
newPlan.OnDayCompleteDyne = 0;
}
newPlan.CompletedCount = BLL.WeldJointService.GetSizeSum(projectId, unitWorkId, flowingSection, steelType, caliber, "2");//累计已完成量
if (newPlan.Dain > 0)
{
newPlan.CompletedRate = (newPlan.CompletedCount / newPlan.Dain) * 100;
newPlan.CompletedRate = (newPlan.CompletedCount / newPlan.Dain) * 100;//已完成百分比
}
else
{
newPlan.CompletedRate = 0;
}
if (newPlan.TotalDyne > 0)
if (newPlan.PriorityTotalDyne > 0)
{
decimal? completeDinSum = BLL.WeldJointService.GetSizeSumByUnitWorkIdAndFlowingSection(this.CurrUser.LoginProjectId, unitWorkId, flowingSection, "2");
newPlan.TotalCompletedRate = (completeDinSum / newPlan.TotalDyne) * 100;
decimal? completeDinSum = BLL.WeldJointService.GetSizeSumByUnitWorkIdAndFlowingSection(projectId, unitWorkId, flowingSection, "2");//完成总达因
newPlan.TotalCompletedRate = (completeDinSum / newPlan.PriorityTotalDyne) * 100;//已完成百分比汇总
}
else
{
@@ -623,9 +663,21 @@ namespace FineUIPro.Web.HJGL.PreDesign
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
cellStyle.WrapText = true;//自动换行
NPOI.SS.UserModel.ICellStyle style11 = workbook.CreateCellStyle();
style11.DataFormat = NPOI.HSSF.UserModel.HSSFDataFormat.GetBuiltinFormat("0.00");//数字格式
style11.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
style11.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
style11.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
style11.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
style11.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Right;
style11.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
style11.WrapText = true;//自动换行
var font = workbook.CreateFont();
font.FontHeightInPoints = 11;
cellStyle.SetFont(font);
// 第二步:创建新数据行
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
@@ -653,20 +705,23 @@ namespace FineUIPro.Web.HJGL.PreDesign
cell.SetCellValue(item.Caliber);//口径
cell = row.CreateCell(4);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.Dain.HasValue ? item.Dain.ToString() : "");//达因数
//cell.CellStyle = cellStyle;
cell.SetCellValue(item.Dain.HasValue ? Convert.ToDouble(item.Dain) : 0);//达因数
cell.CellStyle = style11;
cell = row.CreateCell(5);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.TotalDyne.HasValue ? item.TotalDyne.ToString() : "");//总达因数
//cell.CellStyle = cellStyle;
cell.SetCellValue(item.TotalDyne.HasValue ? Convert.ToDouble(item.TotalDyne) : 0);//总达因数
cell.CellStyle = style11;
cell = row.CreateCell(6);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.TotalPriority);//总优先级
cell = row.CreateCell(7);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.PriorityTotalDyne.HasValue ? item.PriorityTotalDyne.ToString() : "");//优先级总达因
//cell.CellStyle = cellStyle;
cell.SetCellValue(item.PriorityTotalDyne.HasValue ? Convert.ToDouble(item.PriorityTotalDyne) : 0);//优先级总达因
cell.CellStyle = style11;
cell = row.CreateCell(8);
cell.CellStyle = cellStyle;
@@ -681,21 +736,25 @@ namespace FineUIPro.Web.HJGL.PreDesign
cell.SetCellValue(item.Days.HasValue ? item.Days.ToString() : "");//天数
cell = row.CreateCell(11);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.AvgDailyWorkload.HasValue ? item.AvgDailyWorkload.ToString() : "");//平均每天工作量
//cell.CellStyle = cellStyle;
cell.SetCellValue(item.AvgDailyWorkload.HasValue ? Convert.ToDouble(item.AvgDailyWorkload.ToString()) : 0);//平均每天工作量
cell.CellStyle = style11;
cell = row.CreateCell(12);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.OnDayCompleteDyne.HasValue ? item.OnDayCompleteDyne.ToString() : "");//当日已完成量
//cell.CellStyle = cellStyle;
cell.SetCellValue(item.OnDayCompleteDyne.HasValue ? Convert.ToDouble(item.OnDayCompleteDyne.ToString()) : 0);//当日已完成量
cell.CellStyle = style11;
cell = row.CreateCell(13);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.NextDayCompleteDyne.HasValue ? item.NextDayCompleteDyne.ToString() : "");//次日应完成量
//cell.CellStyle = cellStyle;
cell.SetCellValue(item.NextDayCompleteDyne.HasValue ? Convert.ToDouble(item.NextDayCompleteDyne.ToString()) : 0);//次日应完成量
cell.CellStyle = style11;
cell = row.CreateCell(14);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.CompletedCount.HasValue ? item.CompletedCount.ToString() : "");//累计已完成量
//cell.CellStyle = cellStyle;
cell.SetCellValue(item.CompletedCount.HasValue ? Convert.ToDouble(item.CompletedCount.ToString()) : 0);//累计已完成量
cell.CellStyle = style11;
cell = row.CreateCell(15);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.CompletedRate.HasValue ? item.CompletedRate.ToString() : "");//已完成百分比
@@ -828,5 +887,31 @@ namespace FineUIPro.Web.HJGL.PreDesign
}
}
#endregion
#region Grid行绑定事件
/// <summary>
/// 次日应完成量高于平均每日应完成工作量发出预警,预警要统一着色显示红色
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
{
DataRowView row = e.DataItem as DataRowView;
double avgDailyWorkload = 0;
double nextDayCompleteDyne = 0;
if (row["AvgDailyWorkload"] != null && !string.IsNullOrEmpty(row["AvgDailyWorkload"].ToString()))
{
avgDailyWorkload = Convert.ToDouble(row["AvgDailyWorkload"]);
}
if (row["NextDayCompleteDyne"] != null && !string.IsNullOrEmpty(row["NextDayCompleteDyne"].ToString()))
{
nextDayCompleteDyne = Convert.ToDouble(row["NextDayCompleteDyne"]);
}
if (avgDailyWorkload < nextDayCompleteDyne)
{
e.RowCssClass = "color1";
}
}
#endregion
}
}
@@ -147,15 +147,6 @@ namespace FineUIPro.Web.HJGL.PreDesign {
/// </remarks>
protected global::FineUIPro.TextBox txtTotalPriority;
/// <summary>
/// txtPriorityTotalDyne 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.NumberBox txtPriorityTotalDyne;
/// <summary>
/// txtPlanStartDate 控件。
/// </summary>
@@ -183,15 +174,6 @@ namespace FineUIPro.Web.HJGL.PreDesign {
/// </remarks>
protected global::FineUIPro.NumberBox txtAvgDailyWorkload;
/// <summary>
/// NumberBox1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.NumberBox NumberBox1;
/// <summary>
/// NumberBox2 控件。
/// </summary>