20250804 排产计划修改

This commit is contained in:
2025-08-04 10:44:32 +08:00
parent 32c935b3c2
commit 98a8c1ebb4
11 changed files with 576 additions and 217 deletions
@@ -255,22 +255,43 @@ namespace FineUIPro.Web.HJGL.PreDesign
BLL.ProductionSchedulingPlanService.DeleteProductionSchedulingPlanByUnitWorkIdAndFlowNum(this.CurrUser.LoginProjectId,this.tvControlItem.SelectedNode.ParentNode.Text, this.tvControlItem.SelectedNode.Text);
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());
string unitWorkId = tb.Rows[i]["UnitWorkId"].ToString();//单位工程
string flowingSection = tb.Rows[i]["FlowingSection"].ToString();//流水号
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);
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.PipelineId = unitWorkId;
newPlan.FlowNum = flowingSection;
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());
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");
if (newPlan.Dain > 0)
{
newPlan.CompletedRate = (newPlan.CompletedCount / newPlan.Dain) * 100;
}
else
{
newPlan.CompletedRate = 0;
}
if (newPlan.TotalDyne > 0)
{
decimal? completeDinSum = BLL.WeldJointService.GetSizeSumByUnitWorkIdAndFlowingSection(this.CurrUser.LoginProjectId, unitWorkId, flowingSection, "2");
newPlan.TotalCompletedRate = (completeDinSum / newPlan.TotalDyne) * 100;
}
else
{
newPlan.TotalCompletedRate = 0;
}
BLL.ProductionSchedulingPlanService.AddProductionSchedulingPlan(newPlan);
}
}
@@ -299,22 +320,43 @@ namespace FineUIPro.Web.HJGL.PreDesign
BLL.ProductionSchedulingPlanService.DeleteProductionSchedulingPlanByUnitWork(this.CurrUser.LoginProjectId, this.tvControlItem.SelectedNode.Text);
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());
string unitWorkId = tb.Rows[i]["UnitWorkId"].ToString();//单位工程
string flowingSection = tb.Rows[i]["FlowingSection"].ToString();//流水号
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);
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.PipelineId = unitWorkId;
newPlan.FlowNum = flowingSection;
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());
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");
if (newPlan.Dain > 0)
{
newPlan.CompletedRate = (newPlan.CompletedCount / newPlan.Dain) * 100;
}
else
{
newPlan.CompletedRate = 0;
}
if (newPlan.TotalDyne > 0)
{
decimal? completeDinSum = BLL.WeldJointService.GetSizeSumByUnitWorkIdAndFlowingSection(this.CurrUser.LoginProjectId, unitWorkId, flowingSection, "2");
newPlan.TotalCompletedRate = (completeDinSum / newPlan.TotalDyne) * 100;
}
else
{
newPlan.TotalCompletedRate = 0;
}
BLL.ProductionSchedulingPlanService.AddProductionSchedulingPlan(newPlan);
}
}
@@ -393,7 +435,9 @@ namespace FineUIPro.Web.HJGL.PreDesign
w.ProjectType,
p.CompletedCount,
p.CompletedRate,
p.TotalCompletedRate
p.TotalCompletedRate,
p.OnDayCompleteDyne,
p.NextDayCompleteDyne
FROM HJGL_ProductionSchedulingPlan p
left join WBS_UnitWork w on w.UnitWorkId=p.PipelineId
WHERE 1=1 ";
@@ -518,6 +562,11 @@ namespace FineUIPro.Web.HJGL.PreDesign
newPlan.PlanEndDate = Funs.GetNewDateTime(values.Value<string>("PlanEndDate"));
newPlan.Days = Funs.GetNewInt(values.Value<string>("Days"));
newPlan.AvgDailyWorkload = Funs.GetNewDecimal(values.Value<string>("AvgDailyWorkload"));
newPlan.OnDayCompleteDyne = Funs.GetNewDecimal(values.Value<string>("OnDayCompleteDyne"));
newPlan.NextDayCompleteDyne = Funs.GetNewDecimal(values.Value<string>("NextDayCompleteDyne"));
newPlan.CompletedCount = Funs.GetNewInt(values.Value<string>("CompletedCount"));
newPlan.CompletedRate = Funs.GetNewDecimal(values.Value<string>("CompletedRate"));
newPlan.TotalCompletedRate = Funs.GetNewDecimal(values.Value<string>("TotalCompletedRate"));
BLL.ProductionSchedulingPlanService.UpdateProductionSchedulingPlan(newPlan);
}
}
@@ -546,9 +595,9 @@ namespace FineUIPro.Web.HJGL.PreDesign
}
else if (tvControlItem.SelectedNode.CommandName == "流水段")
{
lists = lists.Where(x => x.FlowNum == this.tvControlItem.SelectedNode.Text);
lists = lists.Where(x => x.MainItemName == this.tvControlItem.SelectedNode.ParentNode.Text && x.FlowNum == this.tvControlItem.SelectedNode.Text);
}
lists = lists.OrderBy(x => x.Caliber).OrderBy(x => x.Material).OrderBy(x => x.FlowNum).OrderBy(x => x.MainItemName);
if (lists != null)
{
newUrl = uploadfilepath.Replace("排产计划导出模板", "排产计划-" + this.tvControlItem.SelectedNode.Text + "-" + DateTime.Now.ToString("yyyyMMdd"));
@@ -636,13 +685,21 @@ namespace FineUIPro.Web.HJGL.PreDesign
cell = row.CreateCell(12);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.CompletedCount.HasValue ? item.CompletedCount.ToString() : "");//已完成量
cell.SetCellValue(item.OnDayCompleteDyne.HasValue ? item.OnDayCompleteDyne.ToString() : "");//当日已完成量
cell = row.CreateCell(13);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.NextDayCompleteDyne.HasValue ? item.NextDayCompleteDyne.ToString() : "");//次日应完成量
cell = row.CreateCell(14);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.CompletedCount.HasValue ? item.CompletedCount.ToString() : "");//累计已完成量
cell = row.CreateCell(15);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.CompletedRate.HasValue ? item.CompletedRate.ToString() : "");//已完成百分比
cell = row.CreateCell(14);
cell = row.CreateCell(16);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.TotalCompletedRate.HasValue ? item.TotalCompletedRate.ToString() : "");//已完成百分比汇总