20250804 排产计划修改
This commit is contained in:
@@ -485,13 +485,13 @@ namespace BLL
|
||||
if (!string.IsNullOrEmpty(model.WeldJointCode))
|
||||
baseQuery = baseQuery.Where(x => x.WeldJointCode.Contains(model.WeldJointCode));
|
||||
|
||||
return baseQuery.ToList() ;
|
||||
return baseQuery.ToList();
|
||||
}
|
||||
public static (List<Model.View_HJGL_WeldJoint> Data, int Total)GetDataBymodel(Model.View_HJGL_WeldJoint model, int pageIndex = 0, int pageSize = 20)
|
||||
public static (List<Model.View_HJGL_WeldJoint> Data, int Total) GetDataBymodel(Model.View_HJGL_WeldJoint model, int pageIndex = 0, int pageSize = 20)
|
||||
{
|
||||
// 阶段一:构建基础查询
|
||||
var baseQuery = Funs.DB.View_HJGL_WeldJoint.AsQueryable();
|
||||
|
||||
|
||||
// 阶段二:构建动态查询条件
|
||||
if (!string.IsNullOrEmpty(model.ProjectId))
|
||||
baseQuery = baseQuery.Where(x => x.ProjectId == model.ProjectId);
|
||||
@@ -500,16 +500,16 @@ namespace BLL
|
||||
if (!string.IsNullOrEmpty(model.PipelineId))
|
||||
baseQuery = baseQuery.Where(x => x.PipelineId == model.PipelineId);
|
||||
if (!string.IsNullOrEmpty(model.PipelineCode))
|
||||
baseQuery = baseQuery.Where(x => x.PipelineCode .Contains(model.PipelineCode));
|
||||
baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(model.PipelineCode));
|
||||
if (!string.IsNullOrEmpty(model.WeldJointCode))
|
||||
baseQuery = baseQuery.Where(x => x.WeldJointCode.Contains( model.WeldJointCode));
|
||||
|
||||
baseQuery = baseQuery.Where(x => x.WeldJointCode.Contains(model.WeldJointCode));
|
||||
|
||||
// 阶段三:排序与分页控制(索引优化关键)
|
||||
var orderedQuery = baseQuery.OrderBy(x=>x.PipelineId).ThenBy(x => x.WeldJointCode);
|
||||
var orderedQuery = baseQuery.OrderBy(x => x.PipelineId).ThenBy(x => x.WeldJointCode);
|
||||
|
||||
// 阶段四:分页执行(数据库层面分页)
|
||||
var pagedData = orderedQuery
|
||||
.Skip((pageIndex ) * pageSize)
|
||||
.Skip((pageIndex) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToList();
|
||||
|
||||
@@ -542,7 +542,7 @@ namespace BLL
|
||||
var pagedData = orderedQuery
|
||||
.Skip((pageIndex) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToList();
|
||||
.ToList();
|
||||
|
||||
return pagedData;
|
||||
}
|
||||
@@ -629,5 +629,103 @@ namespace BLL
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据单位工程、流水号、材质、口径获取达因数
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="unitWorkId">单位工程</param>
|
||||
/// <param name="flowingSection">流水段</param>
|
||||
/// <param name="steelType">材质</param>
|
||||
/// <param name="caliber">口径</param>
|
||||
/// <param name="type">1-总达因,2-完成总达因</param>
|
||||
/// <returns></returns>
|
||||
public static decimal? GetSizeSum(string projectId, string unitWorkId, string flowingSection, string steelType, string caliber,string type)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
decimal? sizeSum = 0;
|
||||
int c = 0;
|
||||
if (!string.IsNullOrEmpty(caliber))
|
||||
{
|
||||
c = Convert.ToInt32(caliber.Substring(1, caliber.Length - 1));
|
||||
var weldjoints = (from x in db.HJGL_WeldJoint
|
||||
join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId
|
||||
join z in db.Base_Material on y.MaterialId equals z.MaterialId
|
||||
where x.ProjectId == projectId && y.UnitWorkId == unitWorkId && y.FlowingSection == flowingSection && z.SteelType == steelType
|
||||
&& y.PipeArea == "1" && x.JointAttribute == "预制口"
|
||||
//&& Convert.ToInt32(x.DNDia.Substring(2, x.DNDia.Length - 2)) < c
|
||||
select x);
|
||||
|
||||
foreach (var item in weldjoints)
|
||||
{
|
||||
int s = Convert.ToInt32(item.DNDia.Substring(2, item.DNDia.Length - 2));
|
||||
if (caliber.Substring(0, 1) == "<" && s < c)
|
||||
{
|
||||
if (type == "1")
|
||||
{
|
||||
sizeSum += item.Size;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item.WeldingDailyId))
|
||||
{
|
||||
sizeSum += item.Size;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (caliber.Substring(0, 1) == "≥" && s >= c)
|
||||
{
|
||||
if (type == "1")
|
||||
{
|
||||
sizeSum += item.Size;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item.WeldingDailyId))
|
||||
{
|
||||
sizeSum += item.Size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return sizeSum;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据单位工程、流水段获取总达因
|
||||
/// </summary>
|
||||
/// <param name="projectId">项目id</param>
|
||||
/// <param name="unitWorkId">单位工程</param>
|
||||
/// <param name="flowingSection">流水段</param>
|
||||
/// <param name="type">1-总达因,2-完成总达因</param>
|
||||
/// <returns></returns>
|
||||
public static decimal? GetSizeSumByUnitWorkIdAndFlowingSection(string projectId, string unitWorkId, string flowingSection,string type)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
decimal? sizeSum = 0;
|
||||
if (type == "1")
|
||||
{
|
||||
sizeSum = (from x in db.HJGL_WeldJoint
|
||||
join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId
|
||||
join z in db.Base_Material on y.MaterialId equals z.MaterialId
|
||||
where x.ProjectId == projectId && y.UnitWorkId == unitWorkId && y.FlowingSection == flowingSection
|
||||
&& y.PipeArea == "1" && x.JointAttribute == "预制口"
|
||||
select x.Size).Sum();
|
||||
}
|
||||
else
|
||||
{
|
||||
sizeSum = (from x in db.HJGL_WeldJoint
|
||||
join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId
|
||||
join z in db.Base_Material on y.MaterialId equals z.MaterialId
|
||||
where x.ProjectId == projectId && y.UnitWorkId == unitWorkId && y.FlowingSection == flowingSection
|
||||
&& y.PipeArea == "1" && x.JointAttribute == "预制口"
|
||||
&& x.WeldingDailyId != "" && x.WeldingDailyId != null
|
||||
select x.Size).Sum();
|
||||
}
|
||||
return sizeSum;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user