diff --git a/DataBase/版本日志/SGGLDB_V2025-10-23-001-bwj.sql b/DataBase/版本日志/SGGLDB_V2025-10-23-001-bwj.sql
new file mode 100644
index 00000000..35dcfa2d
--- /dev/null
+++ b/DataBase/版本日志/SGGLDB_V2025-10-23-001-bwj.sql
@@ -0,0 +1,123 @@
+ALTER PROCEDURE [dbo].[Sp_HJGL_ProductionPlanStatistics]
+ @projectId nvarchar(50)=null
+AS
+BEGIN
+ SET NOCOUNT ON; --
+
+ -- ʹCTEԤȹ˺;ۺ
+ WITH PipelineFiltered AS (
+ SELECT UnitWorkId, FlowingSection, PipelineId
+ FROM HJGL_Pipeline
+ WHERE PipeArea='1'
+ AND FlowingSection IS NOT NULL
+ AND FlowingSection != ''
+ AND (@projectId IS NULL OR UnitWorkId IN (
+ SELECT UnitWorkId FROM WBS_UnitWork WHERE ProjectId = @projectId
+ ))
+ ),
+
+ -- Ԥܴ
+ TotalDiaCTE AS (
+ SELECT p.UnitWorkId, p.FlowingSection, SUM(wj.Size) as TotalDia
+ FROM HJGL_WeldJoint wj
+ INNER JOIN PipelineFiltered p ON p.PipelineId = wj.PipelineId
+ WHERE wj.JointAttribute='Ԥƿ'
+ GROUP BY p.UnitWorkId, p.FlowingSection
+ ),
+
+ -- ɹ
+ CurrentDayCompletedCTE AS (
+ SELECT p.UnitWorkId, p.FlowingSection, SUM(wj.Size) as CurrentDayCompletedDia
+ FROM HJGL_WeldJoint wj
+ INNER JOIN PipelineFiltered p ON p.PipelineId = wj.PipelineId
+ INNER JOIN HJGL_WeldingDaily wd ON wd.WeldingDailyId = wj.WeldingDailyId
+ WHERE wj.JointAttribute='Ԥƿ'
+ AND wj.WeldingDailyId IS NOT NULL
+ AND wd.WeldingDate >= CAST(GETDATE() AS DATE) -- ŻڱȽϣʹڷΧ
+ AND wd.WeldingDate < DATEADD(DAY, 1, CAST(GETDATE() AS DATE))
+ GROUP BY p.UnitWorkId, p.FlowingSection
+ ),
+
+ -- ۼ
+ TotalCompletedCTE AS (
+ SELECT p.UnitWorkId, p.FlowingSection, SUM(wj.Size) as totalCompletedDia
+ FROM HJGL_WeldJoint wj
+ INNER JOIN PipelineFiltered p ON p.PipelineId = wj.PipelineId
+ WHERE wj.JointAttribute='Ԥƿ'
+ AND wj.WeldingDailyId IS NOT NULL
+ GROUP BY p.UnitWorkId, p.FlowingSection
+ ),
+
+ -- ǰ
+ WelderCountCTE AS (
+ SELECT p.UnitWorkId, p.FlowingSection,
+ COUNT(DISTINCT pp.PersonId) as WelderCount -- ʹDISTINCTظ
+ FROM Person_Persons pp
+ INNER JOIN HJGL_WeldJoint wj ON wj.BackingWelderId = pp.PersonId
+ INNER JOIN PipelineFiltered p ON p.PipelineId = wj.PipelineId
+ WHERE wj.JointAttribute='Ԥƿ'
+ AND wj.WeldingDailyId IS NOT NULL
+ GROUP BY p.UnitWorkId, p.FlowingSection
+ )--,
+
+ ---- Ԥ
+ --WarningWelderCountCTE AS (
+ -- SELECT p.UnitWorkId, p.FlowingSection,
+ -- COUNT(DISTINCT pp.PersonId) as WarningWelderCount
+ -- FROM Person_Persons pp
+ -- INNER JOIN HJGL_WeldJoint wj ON wj.BackingWelderId = pp.PersonId
+ -- INNER JOIN PipelineFiltered p ON p.PipelineId = wj.PipelineId
+ -- INNER JOIN Welder_WelderQualify wq ON wq.WelderId = pp.PersonId
+ -- WHERE wj.JointAttribute='Ԥƿ'
+ -- AND wj.WeldingDailyId IS NOT NULL
+ -- AND wq.LimitDate < GETDATE() -- ʸԤ
+ -- GROUP BY p.UnitWorkId, p.FlowingSection
+ --)
+
+ SELECT DISTINCT
+ unitWork.UnitWorkId,
+ unitWork.UnitWorkCode,
+ unitWork.UnitWorkName,
+ unitWork.ProjectId,
+ pipeline.FlowingSection,
+ isnull(total.TotalDia,0) as TotalDia,--Ԥܴ
+ p.PlanStartDate,--ƻʼ
+ p.PlanEndDate,--ƻ
+ --(DATEDIFF(day, p.PlanStartDate, p.PlanEndDate) +1) as TotalDays,--
+ --(case when p.PlanEndDate>= getdate() then (DATEDIFF(day, p.PlanStartDate, p.PlanEndDate)-(DATEDIFF(day,p.PlanStartDate,GETDATE()))) else '' end) as RemainingDays,--ʣ
+ --(case when DATEDIFF(day, p.PlanStartDate, p.PlanEndDate)>0 then cast(isnull(total.TotalDia,0)/DATEDIFF(day, p.PlanStartDate, p.PlanEndDate) as decimal(18,2)) else 0 end) as AvgDayCompleteDia, --ƽÿӦɹ
+ ISNULL(currentDay.CurrentDayCompletedDia,0) as CurrentDayCompletedDia, --ɹ
+
+ --cast(case when (case when p.PlanEndDate>= getdate() then (DATEDIFF(day, p.PlanStartDate, p.PlanEndDate)-(DATEDIFF(day,p.PlanStartDate,GETDATE()))) else 0 end)>0 then
+ --(isnull(total.TotalDia,0)-isnull(totalCompleted.totalCompletedDia,0))/ (case when p.PlanEndDate>= getdate() then (DATEDIFF(day, p.PlanStartDate, p.PlanEndDate)-(DATEDIFF(day,p.PlanStartDate,GETDATE()))) else 0 end) else 0 end as decimal(18,2)) as NextDayComplete, --Ӧ
+
+ isnull(totalCompleted.totalCompletedDia,0) as totalCompletedDia, --ۼ
+ cast(cast((case when isnull(total.TotalDia,0)>0 then
+ (isnull(totalCompleted.totalCompletedDia,0) / isnull(total.TotalDia,0)*100) else 0 end) as decimal(18,2)) as varchar(10))+'%' as CompletedRate, --ɰٷֱ
+ welder.WelderCount, --ǰ
+ --warningWelder.WarningWelderCount --Ԥ
+ (case when welder.WelderCount>0 then cast((ISNULL(currentDay.CurrentDayCompletedDia,0)/welder.WelderCount) as decimal(18,2)) else 0 end) as WarningWelderCount--չЧ
+ FROM WBS_UnitWork AS unitWork
+ INNER JOIN PipelineFiltered pipeline ON pipeline.UnitWorkId = unitWork.UnitWorkId -- ʹINNER JOINΪpipelineݱ
+ --LEFT JOIN HJGL_ProductionSchedulingPlan p ON p.PipelineId = unitWork.UnitWorkId AND p.FlowNum = pipeline.FlowingSection
+ --Ųƻ
+ left join (select min(PlanStartDate) as PlanStartDate,max(PlanEndDate) as PlanEndDate,PipelineId,FlowNum from HJGL_ProductionSchedulingPlan
+ group by PipelineId,FlowNum
+ ) as p on p.PipelineId=unitWork.UnitWorkId and p.FlowNum = pipeline.FlowingSection
+
+ --Ԥܴ
+ LEFT JOIN TotalDiaCTE total ON total.UnitWorkId = unitWork.UnitWorkId AND total.FlowingSection = pipeline.FlowingSection
+ --ɹ
+ LEFT JOIN CurrentDayCompletedCTE currentDay ON currentDay.UnitWorkId = unitWork.UnitWorkId AND currentDay.FlowingSection = pipeline.FlowingSection
+ --ۼ
+ LEFT JOIN TotalCompletedCTE totalCompleted ON totalCompleted.UnitWorkId = unitWork.UnitWorkId AND totalCompleted.FlowingSection = pipeline.FlowingSection
+ --ǰ
+ LEFT JOIN WelderCountCTE welder ON welder.UnitWorkId = unitWork.UnitWorkId AND welder.FlowingSection = pipeline.FlowingSection
+ --Ԥ
+ --LEFT JOIN WarningWelderCountCTE warningWelder ON warningWelder.UnitWorkId = unitWork.UnitWorkId AND warningWelder.FlowingSection = pipeline.FlowingSection
+ WHERE (@projectId IS NULL OR unitWork.ProjectId = @projectId)
+ AND pipeline.FlowingSection IS NOT NULL
+END
+GO
+
+
diff --git a/SGGL/BLL/HJGL/PreDesign/ProductionSchedulingPlanService.cs b/SGGL/BLL/HJGL/PreDesign/ProductionSchedulingPlanService.cs
index e31fa98a..46eb918f 100644
--- a/SGGL/BLL/HJGL/PreDesign/ProductionSchedulingPlanService.cs
+++ b/SGGL/BLL/HJGL/PreDesign/ProductionSchedulingPlanService.cs
@@ -19,15 +19,41 @@ namespace BLL
return Funs.DB.HJGL_ProductionSchedulingPlan.FirstOrDefault(e => e.ProductionSchedulingPlanId == productionSchedulingPlanId);
}
-
+ ///
+ /// 根据单位工程、流水段、材质、口径获取排产计划
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public static Model.HJGL_ProductionSchedulingPlan GetProductionSchedulingPlan(string loginProjectId, string flowingSection, string unitWorkId, string material, string caliber)
{
return Funs.DB.HJGL_ProductionSchedulingPlan.FirstOrDefault(e => e.ProjectId == loginProjectId && e.FlowNum == flowingSection && e.PipelineId == unitWorkId && e.Material == material && e.Caliber == caliber);
}
- public static List GetProductionSchedulingPlanByMaterialLists(string loginProjectId, string flowingSection, string unitWorkId, string material)
+ ///
+ /// 根据单位工程、流水段获取排产计划信息
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static List GetProductionSchedulingPlanByFlowingSection(string loginProjectId, string flowingSection, string unitWorkId)
{
- return (from x in Funs.DB.HJGL_ProductionSchedulingPlan where x.ProjectId == loginProjectId && x.FlowNum == flowingSection && x.PipelineId == unitWorkId && x.Material == material select x).ToList();
+ return (from x in Funs.DB.HJGL_ProductionSchedulingPlan where x.ProjectId == loginProjectId && x.FlowNum == flowingSection && x.PipelineId == unitWorkId select x).ToList();
+ }
+
+ ///
+ /// 根据单位工程获取排产计划信息
+ ///
+ ///
+ ///
+ ///
+ public static List GetProductionSchedulingPlanByUnitWorkId(string loginProjectId, string unitWorkId)
+ {
+ return (from x in Funs.DB.HJGL_ProductionSchedulingPlan where x.ProjectId == loginProjectId && x.PipelineId == unitWorkId select x).ToList();
}
///
diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/ProductionSchedulingPlan.aspx b/SGGL/FineUIPro.Web/HJGL/PreDesign/ProductionSchedulingPlan.aspx
index 06f1bfd1..a26d1829 100644
--- a/SGGL/FineUIPro.Web/HJGL/PreDesign/ProductionSchedulingPlan.aspx
+++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/ProductionSchedulingPlan.aspx
@@ -50,7 +50,7 @@
EnableCollapse="false" runat="server" BoxFlex="1" DataKeyNames="UnitWorkId,FlowingSection" AllowCellEditing="true"
EnableColumnLines="true" ClicksToEdit="1" DataIDField=""
AllowSorting="true" SortField="UnitWorkName,FlowingSection" SortDirection="ASC"
- AllowPaging="true" IsDatabasePaging="true" PageSize="15"
+ AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnSort="Grid2_Sort" OnPageIndexChange="Grid2_PageIndexChange"
EnableTextSelection="True" Height="300px" OnRowDataBound="Grid2_RowDataBound">
-
-
- --%>
+
+
+
+
+
+ <%--
-
- --%>
+
+
+
+
+
+ <%--
-
+ --%>
+
+
+
+
+
-
-
+ --%>
+
+
+
+
+
@@ -107,8 +127,8 @@
DataField="WelderCount" FieldType="Int" HeaderTextAlign="Center" TextAlign="Left"
Width="120px">
-
@@ -135,8 +155,8 @@
EnableCollapse="true" runat="server" BoxFlex="1" DataKeyNames="ProductionSchedulingPlanId" AllowCellEditing="true"
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" OnRowDataBound="Grid1_RowDataBound" >
+ AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
+ EnableTextSelection="True" OnRowDataBound="Grid1_RowDataBound">
@@ -304,12 +324,12 @@
const daysDifference = timeDifference / (1000 * 60 * 60 * 24);
//平均每日应完成量=达因数/天数
const avgDailyWorkload = dain / (daysDifference + 1);
-
+
const currentTime = Math.abs(endDate - Date.now());//获取剩余天数(毫秒)
const daysTime = Math.ceil(currentTime / (1000 * 60 * 60 * 24));//将时间差转换为天数
if (daysTime > 0) {
- //次日应完成量=剩余工程量(达因数-累计已完成量)/剩余天数(结束时间-当前时间)
+ //次日应完成量=剩余工程量(达因数-累计已完成量)/剩余天数(结束时间-当前时间)
var nextDayCompleteDyne = (dain - completedCount) / daysTime;
}
@@ -317,9 +337,6 @@
me.updateCellValue(rowId, 'AvgDailyWorkload', avgDailyWorkload.toFixed(2));//平均每天工作量
me.updateCellValue(rowId, 'NextDayCompleteDyne', nextDayCompleteDyne.toFixed(2));//次日应完成量
}
-
-
-
}