20250924 修改排产计划

This commit is contained in:
2025-09-24 15:27:48 +08:00
parent f24e6a366e
commit 6e6f3d42fd
5 changed files with 215 additions and 77 deletions
@@ -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
{
@@ -636,7 +676,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
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);
@@ -846,5 +886,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
}
}