diff --git a/DataBase/版本日志/SGGLDB_V2026-08-07-lpf.sql b/DataBase/版本日志/SGGLDB_V2026-08-07-lpf.sql new file mode 100644 index 00000000..fcd502ed --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2026-08-07-lpf.sql @@ -0,0 +1,315 @@ +/* + 焊接日报、下料专项审核、焊缝外观检测 + 日期:2026-08-07 +*/ +IF COL_LENGTH(N'dbo.HJGL_PreWeldCuttingCheck', N'ReviewState') IS NULL +BEGIN + ALTER TABLE dbo.HJGL_PreWeldCuttingCheck + ADD ReviewState INT NOT NULL CONSTRAINT DF_HJGL_PreWeldCuttingCheck_ReviewState DEFAULT (0); +END; +GO + +IF COL_LENGTH(N'dbo.HJGL_PreWeldCuttingCheck', N'SpecialReviewerId') IS NULL + ALTER TABLE dbo.HJGL_PreWeldCuttingCheck ADD SpecialReviewerId NVARCHAR(50) NULL; +IF COL_LENGTH(N'dbo.HJGL_PreWeldCuttingCheck', N'ReviewerId') IS NULL + ALTER TABLE dbo.HJGL_PreWeldCuttingCheck ADD ReviewerId NVARCHAR(50) NULL; +IF COL_LENGTH(N'dbo.HJGL_PreWeldCuttingCheck', N'ReviewTime') IS NULL + ALTER TABLE dbo.HJGL_PreWeldCuttingCheck ADD ReviewTime DATETIME NULL; +GO + +IF OBJECT_ID(N'dbo.HJGL_PreWeldCuttingCheckMaterial', N'U') IS NULL +BEGIN + CREATE TABLE dbo.HJGL_PreWeldCuttingCheckMaterial + ( + CuttingCheckMaterialId NVARCHAR(50) NOT NULL CONSTRAINT PK_HJGL_PreWeldCuttingCheckMaterial PRIMARY KEY, + CuttingCheckId NVARCHAR(50) NOT NULL, + PipeLineMatId NVARCHAR(50) NOT NULL, + MaterialSide INT NOT NULL, + OriginalMainCode NVARCHAR(100) NULL, + ReportedMainCode NVARCHAR(100) NULL, + IsBatchChanged BIT NOT NULL CONSTRAINT DF_HJGL_PreWeldCuttingCheckMaterial_IsBatchChanged DEFAULT (0), + CONSTRAINT FK_HJGL_PreWeldCuttingCheckMaterial_Check FOREIGN KEY (CuttingCheckId) + REFERENCES dbo.HJGL_PreWeldCuttingCheck(CuttingCheckId) + ); + CREATE INDEX IX_HJGL_PreWeldCuttingCheckMaterial_Check + ON dbo.HJGL_PreWeldCuttingCheckMaterial(CuttingCheckId, MaterialSide); + CREATE INDEX IX_HJGL_PreWeldCuttingCheckMaterial_Material + ON dbo.HJGL_PreWeldCuttingCheckMaterial(PipeLineMatId, IsBatchChanged); +END; +GO + +IF OBJECT_ID(N'dbo.HJGL_WeldAppearanceCheck', N'U') IS NULL +BEGIN + CREATE TABLE dbo.HJGL_WeldAppearanceCheck + ( + AppearanceCheckId NVARCHAR(50) NOT NULL CONSTRAINT PK_HJGL_WeldAppearanceCheck PRIMARY KEY, + ProjectId NVARCHAR(50) NOT NULL, + WeldJointId NVARCHAR(50) NOT NULL, + IsQualified BIT NOT NULL, + CheckPerson NVARCHAR(50) NOT NULL, + CheckTime DATETIME NOT NULL, + Remark NVARCHAR(500) NULL, + CreateUser NVARCHAR(50) NULL, + CreateTime DATETIME NOT NULL, + ModifyUser NVARCHAR(50) NULL, + ModifyTime DATETIME NULL, + CONSTRAINT FK_HJGL_WeldAppearanceCheck_WeldJoint FOREIGN KEY (WeldJointId) + REFERENCES dbo.HJGL_WeldJoint(WeldJointId) + ); + CREATE INDEX IX_HJGL_WeldAppearanceCheck_JointLatest + ON dbo.HJGL_WeldAppearanceCheck(WeldJointId, CheckTime DESC, CreateTime DESC); + CREATE INDEX IX_HJGL_WeldAppearanceCheck_Project + ON dbo.HJGL_WeldAppearanceCheck(ProjectId, CheckTime DESC); +END; +GO + +IF NOT EXISTS (SELECT 1 FROM dbo.Sys_Menu WHERE MenuId = N'A4C8F8A1-1A27-4B63-A6DF-3F8AAE67C901') +BEGIN + INSERT dbo.Sys_Menu(MenuId, MenuName, Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed) + VALUES(N'A4C8F8A1-1A27-4B63-A6DF-3F8AAE67C901', N'焊缝外观检测记录', + N'HJGL/WeldingManage/WeldAppearanceCheck.aspx', 60, + N'4D36E99E-B3D8-4C61-826A-CBD98EC51515', N'Menu_HJGL', 0, 1, 1); +END; +GO + +DECLARE @AppearanceMenuId NVARCHAR(50) = N'A4C8F8A1-1A27-4B63-A6DF-3F8AAE67C901'; +IF NOT EXISTS (SELECT 1 FROM dbo.Sys_ButtonToMenu WHERE MenuId=@AppearanceMenuId AND ButtonName=N'新增') + INSERT dbo.Sys_ButtonToMenu(ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES(NEWID(), @AppearanceMenuId, N'新增', 1); +IF NOT EXISTS (SELECT 1 FROM dbo.Sys_ButtonToMenu WHERE MenuId=@AppearanceMenuId AND ButtonName=N'保存') + INSERT dbo.Sys_ButtonToMenu(ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES(NEWID(), @AppearanceMenuId, N'保存', 2); +IF NOT EXISTS (SELECT 1 FROM dbo.Sys_ButtonToMenu WHERE MenuId=@AppearanceMenuId AND ButtonName=N'修改') + INSERT dbo.Sys_ButtonToMenu(ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES(NEWID(), @AppearanceMenuId, N'修改', 3); +IF NOT EXISTS (SELECT 1 FROM dbo.Sys_ButtonToMenu WHERE MenuId=@AppearanceMenuId AND ButtonName=N'删除') + INSERT dbo.Sys_ButtonToMenu(ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES(NEWID(), @AppearanceMenuId, N'删除', 4); +GO + +ALTER view [dbo].[View_HJGL_WeldJoint] as + SELECT jot.[ProjectId] --项目Id + , pipe.[UnitWorkId] --单位工程Id + , uw.UnitWorkName --单位工程 + , pipe.[UnitId] --单位Id + , unit.UnitName --单位 + , jot.[PipelineCode] --管线号 + , pipe.[SingleNumber] --单线图号 + , pipe.[SingleName] --图纸名称 + , pipe.[MediumId] --介质Id + , medium.MediumCode + , medium.MediumName --介质名称 + , pipe.[PipingClassId] --管道等级Id + , pipingClass.PipingClassCode --管道等级 + , pipe.[DetectionRateId] --探伤比例Id + , dr.DetectionRateCode --探伤比例(例如5,10,20) + , pipe.DetectionType --探伤类型Id(可能多个,中间用|分隔) + , STUFF((SELECT ',' + DetectionTypeCode + FROM Base_DetectionType + WHERE CHARINDEX('|' + LTRIM(DetectionTypeId) + '|', '|' + pipe.DetectionType + '|') > 0 + FOR XML PATH('')), 1, 1, '') AS DetectionTypeStr --探伤类型(可能多个,中间用,分隔) + , pipe.DesignTemperature --设计温度℃ + , pipe.DesignPress --设计压力Mpa(g) + , pipe.TestMedium --压力试验介质Id + , tm.MediumName AS TestMediumName --压力试验介质 + , pipe.TestPressure --压力试验压力Mpa(g) + , pipe.PressurePipingClassId --压力管道级别Id + , ppc.PressurePipingClassCode --压力管道级别 + , pipe.PipeLenth --管线长度(m) + , pipe.LeakMedium --泄露性试验介质Id + , tm2.MediumName AS LeakMediumName --泄露性试验介质 + , pipe.LeakPressure --泄露性试验压力Mpa(g) + , pipe.PCMedium --吹洗要求Id + , pm.PurgeMethodCode --吹洗要求 + , pipe.VacuumPressure --真空试验压力Kpa(a) + , pipe.MaterialId --材质Id + , mat.MaterialCode AS PipeMaterialCode --材质 + , pipe.Remark AS PipeRemark --备注 + , jot.FlowingSection as FlowingSection --流水段 + , jot.[WeldJointId] --焊口Id + , jot.[WeldJointCode] --焊口号 + , jot.[Material1Id] --材质1Id + , mat1.MaterialCode AS Material1Code --材质1 + , jot.[Material2Id] --材质2Id + , mat2.MaterialCode AS Material2Code --材质2 + , jot.[Dia] --外径 + , jot.DNDia --DN公称直径 + , jot.[Size] --达因 + , jot.[Thickness] --壁厚 + , jot.[Specification] --规格 + , jot.[WeldTypeId] --焊缝类型Id + , WeldType.WeldTypeCode --焊缝类型 + , jot.[DetectionTypeId] --检测类型Id + , ndt.DetectionTypeCode --检测类型 + , jot.[Components1Id] --组件1号Id + , com1.ComponentsCode AS ComponentsCode1 --组件1号 + , jot.[Components2Id] --组件2号Id + , com2.ComponentsCode AS ComponentsCode2 --组件2号 + , jot.DesignIsHotProess --是否热处理 + , CASE jot.DesignIsHotProess WHEN 1 THEN '是' ELSE '否' END AS DesignIsHotProessStr --是否热处理 + , jot.[WeldingMethodId] --焊接方法Id + , WeldingMethod.WeldingMethodCode --焊接方法 + , jot.WPQId --WPS的Id + , wps.WPQCode --WPS编号 + , jot.MatchableWPQ --可匹配WPQ + , jot.[GrooveTypeId] --坡口类型Id + , GrooveType.GrooveTypeCode --坡口类型 + , jot.[WeldingRod] --焊条Id + , rod.ConsumablesCode AS WeldingRodCode --焊条 + , jot.[WeldingWire] --焊丝Id + , wire.ConsumablesCode AS WeldingWireCode --焊丝 + , jot.PreTemperature --预热温度 + , jot.[JointAttribute] --焊口属性 + , jot.TwoJointType --二次焊口新增类型 + , pipe.PipeArea --工厂预制/现场安装 + , daily.WeldingDate as WeldingDateD + , CONVERT(VARCHAR(100), daily.WeldingDate, 23) AS WeldingDate --焊接日期 + , BackingWelder.WelderCode AS BackingWelderCode --打底焊工 + , CoverWelder.WelderCode AS CoverWelderCode --盖面焊工 + , CoverWelderTeamGroup.TeamGroupName as CoverWelderTeamGroupName ----盖面焊工班组 + , BackingWelderTeamGroup.TeamGroupName as BackingWelderTeamGroupName --打底焊工班组 + , (CASE (SELECT COUNT(*) + FROM [dbo].[HJGL_HotProess_TrustItem] hpti + WHERE hpti.WeldJointId = jot.WeldJointId) + WHEN 0 THEN '' + ELSE (SELECT TOP 1 ISNULL(ReportNo, '') + FROM [dbo].[HJGL_HotProess_Trust] hpt + LEFT JOIN [dbo].[HJGL_HotProess_TrustItem] hpti + ON hpti.HotProessTrustId = hpt.HotProessTrustId + WHERE hpti.WeldJointId = jot.WeldJointId) END) AS HotProessReportNo --热处理报告编号 + , (CASE (SELECT TOP 1 IsCompleted + FROM [dbo].[HJGL_HotProess_TrustItem] hpti + WHERE hpti.WeldJointId = jot.WeldJointId) + WHEN 1 THEN '完成' + WHEN 0 THEN '未完成' + ELSE '未热处理' END) AS HotProessResult --热处理检测结果 + , (CASE (SELECT COUNT(*) + FROM [dbo].HJGL_Hard_TrustItem hti + WHERE hti.WeldJointId = jot.WeldJointId) + WHEN 0 THEN '' + ELSE (SELECT TOP 1 ISNULL(InspectionNum, '') + FROM [dbo].HJGL_Hard_Trust ht + LEFT JOIN [dbo].HJGL_Hard_TrustItem hti ON hti.HardTrustID = ht.HardTrustID + WHERE hti.WeldJointId = jot.WeldJointId) END) AS HardReportNo --硬度报告编号 + , (CASE (SELECT TOP 1 IsPass + FROM [dbo].HJGL_Hard_TrustItem hti + WHERE hti.WeldJointId = jot.WeldJointId) + WHEN 1 THEN '合格' + WHEN 0 THEN '不合格' + ELSE '待检测' END) AS HardResult --硬度检测结果 + , (CASE (SELECT COUNT(*) + FROM [dbo].HJGL_Batch_BatchTrustItem bti + WHERE bti.WeldJointId = jot.WeldJointId) + WHEN 0 THEN '' + ELSE (SELECT TOP 1 TrustBatchCode + FROM [dbo].HJGL_Batch_BatchTrust bt + LEFT JOIN [dbo].HJGL_Batch_BatchTrustItem bti ON bti.TrustBatchId = bt.TrustBatchId + WHERE bti.WeldJointId = jot.WeldJointId) END) AS TrustBatchCode --委托单编号 + , (CASE (SELECT COUNT(*) + FROM [dbo].HJGL_Batch_NDEItem ndei + LEFT JOIN [dbo].HJGL_Batch_BatchTrustItem bti ON bti.TrustBatchItemId = ndei.TrustBatchItemId + WHERE bti.WeldJointId = jot.WeldJointId) + WHEN 0 THEN '' + ELSE (SELECT TOP 1 ISNULL(NDECode, '') + FROM [dbo].HJGL_Batch_NDE nde + LEFT JOIN [dbo].HJGL_Batch_NDEItem ndei ON ndei.NDEID = nde.NDEID + LEFT JOIN [dbo].HJGL_Batch_BatchTrustItem bti + ON bti.TrustBatchItemId = ndei.TrustBatchItemId + WHERE bti.WeldJointId = jot.WeldJointId) END) AS NDECode --检测单编号 + , (CASE (SELECT TOP 1 CheckResult + FROM [dbo].HJGL_Batch_NDEItem ndei + LEFT JOIN [dbo].HJGL_Batch_BatchTrustItem bti ON bti.TrustBatchItemId = ndei.TrustBatchItemId + WHERE bti.WeldJointId = jot.WeldJointId) + WHEN '1' THEN '合格' + WHEN '2' THEN '不合格' + ELSE '' END) AS CheckResult --检测结果 + , appearance.IsQualified AS WeldAppearanceIsQualified + , CASE WHEN appearance.IsQualified = 1 THEN N'合格' + WHEN appearance.IsQualified = 0 THEN N'不合格' + ELSE N'未检测' END AS WeldAppearanceResult + , jot.PipelineId + , jot.[JointArea] + , jot.[WeldingLocationId] + , jot.[HeartNo1] + , jot.[HeartNo2] + , jot.[IsHotProess] + , jot.[WeldingDailyId] + , jot.[BackingWelderId] + , jot.[CoverWelderId] + , jot.WeldingMode + , jot.Remark + , jot.IsTwoJoint + , jot.SubmitMan + , jot.AuditMan + , jot.AuditMan2 + , jot.AuditDate + , jot.AuditDate2 + , jot.WeldJointPoint + , task.TaskCode + , WeldingLocation.WeldingLocationCode + , CASE WHEN jot.WeldingDailyId IS NULL THEN '否' ELSE '是' END AS IsWelding + , CASE WHEN jot.WeldingDailyId IS NULL THEN '未完成' ELSE '已完成' END AS IsWeldOK + , CASE WHEN jot.IsHotProess = 1 THEN '是' ELSE '否' END AS IsHotProessStr + , BackingWelder.PersonName AS BackingWelderName + , CoverWelder.PersonName AS CoverWelderName + , (CASE + WHEN CoverWelder.WelderCode IS NOT NULL AND BackingWelder.WelderCode IS NOT NULL + THEN CoverWelder.WelderCode + '/' + BackingWelder.WelderCode + ELSE (ISNULL(CoverWelder.WelderCode, '') + ISNULL(BackingWelder.WelderCode, '')) END) AS WelderCode + , --焊工 + (CASE + WHEN mat1.MaterialCode IS NOT NULL AND mat2.MaterialCode IS NOT NULL + THEN mat1.MaterialCode + '/' + mat2.MaterialCode + ELSE (ISNULL(mat1.MaterialCode, '') + ISNULL(mat2.MaterialCode, '')) END) AS MaterialCode + , --材质 + + daily.WeldingDailyCode + , pointItem.PointBatchId + , point.PointBatchCode + , (CASE + WHEN pointItem.PointState = '1' THEN '已点口' + WHEN pointItem.PointState = '2' THEN '已扩透' + ELSE '' END) AS IsPoint + FROM [dbo].[HJGL_WeldJoint] jot + LEFT JOIN dbo.HJGL_Pipeline pipe ON pipe.PipelineId = jot.PipelineId + LEFT JOIN dbo.HJGL_WeldTask task ON task.WeldJointId = jot.WeldJointId + LEFT JOIN dbo.WBS_UnitWork uw ON uw.UnitWorkId = pipe.UnitWorkId + LEFT JOIN dbo.HJGL_WeldingDaily AS daily ON daily.WeldingDailyId = jot.WeldingDailyId + LEFT JOIN dbo.Base_Unit unit ON unit.UnitId = daily.UnitId + LEFT JOIN Base_WeldType AS WeldType ON WeldType.WeldTypeId = jot.WeldTypeId + LEFT JOIN dbo.Base_DetectionRate dr ON dr.DetectionRateId = pipe.DetectionRateId + LEFT JOIN Base_TestMedium tm ON tm.TestMediumId = pipe.TestMedium + LEFT JOIN Base_TestMedium tm2 ON tm2.TestMediumId = pipe.LeakMedium + LEFT JOIN Base_PurgeMethod pm ON pm.PurgeMethodId = pipe.PCMedium + LEFT JOIN Base_PressurePipingClass ppc ON ppc.PressurePipingClassId = pipe.PressurePipingClassId + LEFT JOIN Base_Material AS mat ON mat.MaterialId = pipe.MaterialId + LEFT JOIN Base_Material AS mat1 ON mat1.MaterialId = jot.Material1Id + LEFT JOIN Base_Material AS mat2 ON mat2.MaterialId = jot.Material2Id + LEFT JOIN Base_WeldingMethod AS WeldingMethod ON WeldingMethod.WeldingMethodId = jot.WeldingMethodId + LEFT JOIN Base_WeldingLocation AS WeldingLocation + ON WeldingLocation.WeldingLocationId = jot.WeldingLocationId + LEFT JOIN Base_Consumables AS wire ON wire.ConsumablesId = jot.WeldingWire + LEFT JOIN Base_Consumables AS rod ON rod.ConsumablesId = jot.WeldingRod + LEFT JOIN Base_GrooveType AS GrooveType ON GrooveType.GrooveTypeId = jot.GrooveTypeId + LEFT JOIN Base_Components AS com1 ON com1.ComponentsId = jot.Components1Id + LEFT JOIN Base_Components AS com2 ON com2.ComponentsId = jot.Components2Id + LEFT JOIN SitePerson_Person AS BackingWelder + ON BackingWelder.PersonId = jot.BackingWelderId and BackingWelder.ProjectId = jot.ProjectId + LEFT JOIN SitePerson_Person AS CoverWelder + ON CoverWelder.PersonId = jot.CoverWelderId and CoverWelder.ProjectId = jot.ProjectId + LEFT JOIN Base_PipingClass AS pipingClass ON pipingClass.PipingClassId = pipe.PipingClassId + LEFT JOIN dbo.Base_Medium medium ON medium.MediumId = pipe.MediumId + LEFT JOIN dbo.Base_DetectionType ndt ON ndt.DetectionTypeId = jot.DetectionTypeId + LEFT JOIN dbo.WPQ_WPQList wps ON wps.WPQId = jot.WPQId + LEFT JOIN dbo.HJGL_Batch_PointBatchItem pointItem ON pointItem.WeldJointId = jot.WeldJointId + LEFT JOIN dbo.HJGL_Batch_PointBatch point ON point.PointBatchId = pointItem.PointBatchId + LEFT JOIN dbo.ProjectData_TeamGroup AS CoverWelderTeamGroup + on CoverWelderTeamGroup.TeamGroupId = jot.CoverWelderTeamGroupId and + CoverWelderTeamGroup.ProjectId = jot.ProjectId + LEFT JOIN dbo.ProjectData_TeamGroup AS BackingWelderTeamGroup + on BackingWelderTeamGroup.TeamGroupId = jot.BackingWelderTeamGroupId and + BackingWelderTeamGroup.ProjectId = jot.ProjectId + OUTER APPLY + ( + SELECT TOP 1 checkItem.IsQualified + FROM dbo.HJGL_WeldAppearanceCheck checkItem + WHERE checkItem.WeldJointId = jot.WeldJointId + ORDER BY checkItem.CheckTime DESC, checkItem.CreateTime DESC, checkItem.AppearanceCheckId DESC + ) appearance; +GO diff --git a/DataBase/菜单初始化脚本/1-5-1焊缝外观检测记录.sql b/DataBase/菜单初始化脚本/1-5-1焊缝外观检测记录.sql new file mode 100644 index 00000000..24816465 --- /dev/null +++ b/DataBase/菜单初始化脚本/1-5-1焊缝外观检测记录.sql @@ -0,0 +1,20 @@ +/* 焊接过程管理:焊缝外观检测记录 */ +IF NOT EXISTS (SELECT 1 FROM dbo.Sys_Menu WHERE MenuId = N'A4C8F8A1-1A27-4B63-A6DF-3F8AAE67C901') +BEGIN + INSERT dbo.Sys_Menu(MenuId, MenuName, Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed) + VALUES(N'A4C8F8A1-1A27-4B63-A6DF-3F8AAE67C901', N'焊缝外观检测记录', + N'HJGL/WeldingManage/WeldAppearanceCheck.aspx', 60, + N'4D36E99E-B3D8-4C61-826A-CBD98EC51515', N'Menu_HJGL', 0, 1, 1); +END; +GO + +DECLARE @MenuId NVARCHAR(50) = N'A4C8F8A1-1A27-4B63-A6DF-3F8AAE67C901'; +IF NOT EXISTS (SELECT 1 FROM dbo.Sys_ButtonToMenu WHERE MenuId=@MenuId AND ButtonName=N'新增') + INSERT dbo.Sys_ButtonToMenu(ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES(NEWID(), @MenuId, N'新增', 1); +IF NOT EXISTS (SELECT 1 FROM dbo.Sys_ButtonToMenu WHERE MenuId=@MenuId AND ButtonName=N'保存') + INSERT dbo.Sys_ButtonToMenu(ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES(NEWID(), @MenuId, N'保存', 2); +IF NOT EXISTS (SELECT 1 FROM dbo.Sys_ButtonToMenu WHERE MenuId=@MenuId AND ButtonName=N'修改') + INSERT dbo.Sys_ButtonToMenu(ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES(NEWID(), @MenuId, N'修改', 3); +IF NOT EXISTS (SELECT 1 FROM dbo.Sys_ButtonToMenu WHERE MenuId=@MenuId AND ButtonName=N'删除') + INSERT dbo.Sys_ButtonToMenu(ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES(NEWID(), @MenuId, N'删除', 4); +GO diff --git a/SGGL/BLL/API/HJGL/APIPreWeldInspectionService.cs b/SGGL/BLL/API/HJGL/APIPreWeldInspectionService.cs index 84d66d7e..d390bfd5 100644 --- a/SGGL/BLL/API/HJGL/APIPreWeldInspectionService.cs +++ b/SGGL/BLL/API/HJGL/APIPreWeldInspectionService.cs @@ -47,7 +47,9 @@ namespace BLL where m.WeldJointId == weldJointId select new Model.PreWeldMaterialItem { - MaterialCode = lib.MaterialCode, + PipeLineMatId = m.PipeLineMatId, + MainCode = m.MaterialCode, + MaterialCode = m.MaterialCode, MaterialName = lib.MaterialName, MaterialSpec = lib.MaterialSpec, MaterialMade = lib.MaterialMade, @@ -55,12 +57,16 @@ namespace BLL MaterialUnit = lib.MaterialUnit, HeatNo = lib.HeatNo, BatchNo = lib.BatchNo, - }).ToList() + }).ToList() }; var item = query.FirstOrDefault(); if (item != null) { + for (int index = 0; index < item.preWeldMaterialItems.Count; index++) + { + item.preWeldMaterialItems[index].MaterialSide = index + 1; + } SetInspectionAttachUrl(db, item); } @@ -73,44 +79,7 @@ namespace BLL /// public static List GetCuttingChecksByWeldJointId(string weldJointId) { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var data = (from c in db.HJGL_PreWeldCuttingCheck - join w in db.HJGL_WeldJoint on c.WeldJointId equals w.WeldJointId - join p in db.Person_Persons on c.CheckPerson equals p.PersonId into persons - from p in persons.DefaultIfEmpty() - where c.WeldJointId == weldJointId - orderby c.CheckTime descending - select new Model.PreWeldCuttingCheckItem - { - CuttingCheckId = c.CuttingCheckId, - ProjectId = c.ProjectId, - WeldJointId = c.WeldJointId, - PipelineCode = w.PipelineCode, - WeldJointCode = w.WeldJointCode, - CuttingLength = c.CuttingLength, - GrooveForm = c.GrooveForm, - GrooveAngle = c.GrooveAngle, - IsMaterialCodeBatchNoAccurate = c.IsMaterialCodeBatchNoAccurate, - IsMaterialQuantityAccurate = c.IsMaterialQuantityAccurate, - IsQualified = c.IsQualified, - CheckPerson = c.CheckPerson, - CheckPersonName = p == null ? string.Empty : p.PersonName, - CheckTime = c.CheckTime, - CreateUser = c.CreateUser, - CreateTime = c.CreateTime, - AttachUrl1 = null, - CheckResult = c.CheckResult, - UnqualifiedReason = c.UnqualifiedReason, - RectifyRequirement = c.RectifyRequirement, - Remark = c.Remark - }).ToList(); - foreach (var item in data) - { - item.AttachUrl1 = GetAttachUrl(db, Const.HJGL_PreWeldCuttingCheckMenuId, item.CuttingCheckId); - } - return data; - } + return PreWeldInspectionService.GetCuttingCheckItemsByWeldJointId(weldJointId); } /// @@ -189,6 +158,26 @@ namespace BLL return PreWeldInspectionService.SaveCuttingCheck(item); } + public static string ReviewCuttingCheck(Model.PreWeldCuttingCheckReviewInput item) + { + return PreWeldInspectionService.ReviewCuttingCheck(item); + } + + public static List GetSpecialReviewers(string projectId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + return (from x in db.SitePerson_Person + where x.ProjectId == projectId && x.States == Const.ProjectPersonStates_1 + orderby x.PersonName + select new Model.BaseInfoItem + { + BaseInfoId = x.PersonId, + BaseInfoName = x.PersonName + }).Distinct().ToList(); + } + } + /// /// 保存组对检查 /// diff --git a/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs b/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs index 180a31ff..4c424a84 100644 --- a/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs +++ b/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs @@ -289,7 +289,14 @@ namespace BLL return "参数不能为空"; } - string res = BLL.WeldingDailyService.SaveWeldingDailyTempDetailByMobile(newItem.WeldJointId, newItem.Personid, newItem.time, newItem.weldingLocation, newItem.welderType); + string res = BLL.WeldingDailyService.SaveWeldingDailyTempDetailByMobile( + newItem.WeldJointId, + newItem.Personid, + newItem.time, + newItem.weldingLocation, + newItem.welderType, + newItem.WeldingMethodId, + newItem.WeldTypeId); if (!string.IsNullOrEmpty(res)) { return res; diff --git a/SGGL/BLL/BLL.csproj b/SGGL/BLL/BLL.csproj index d06c89e6..c2182d63 100644 --- a/SGGL/BLL/BLL.csproj +++ b/SGGL/BLL/BLL.csproj @@ -464,6 +464,7 @@ + diff --git a/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs b/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs index adb8ce8e..55365b14 100644 --- a/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs +++ b/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs @@ -42,6 +42,18 @@ namespace BLL g.Key, RealNum = g.Sum(x => x.ActNum) ?? 0, }).ToList(); + ///实际材料出库数量列表 + var RealOutMateriaList = (from x in db.Tw_OutputDetail + join master in db.Tw_OutputMaster on x.OutputMasterId equals master.Id + where master.ProjectId == projectid && master.WarehouseId == WarehouseId + group x by x.MaterialCode + into g + where (string.IsNullOrEmpty(materialCode) || g.Key.Contains(materialCode)) + select new + { + g.Key, + OutputNum = g.Sum(x => x.ActNum) ?? 0, + }).ToList(); //库存数量 var tw_MaterialStock = (from x in db.Tw_MaterialStock where x.WarehouseId == WarehouseId && x.ProjectId == projectid @@ -50,6 +62,7 @@ namespace BLL var needMateriaList = NeedOutMateriaList.ToList(); var materialCodeList = needMateriaList.Select(x => x.Key) .Union(RealInMateriaList.Select(x => x.Key)) + .Union(RealOutMateriaList.Select(x => x.Key)) .Distinct() .ToList(); @@ -62,6 +75,8 @@ namespace BLL from x in needGroup.DefaultIfEmpty() join y in RealInMateriaList on code equals y.Key into realGroup from y in realGroup.DefaultIfEmpty() + join o in RealOutMateriaList on code equals o.Key into outputGroup + from o in outputGroup.DefaultIfEmpty() join z in materialInfoList on code equals z.MaterialCode into infoGroup from z in infoGroup.DefaultIfEmpty() join m in tw_MaterialStock on code equals m.PipeLineMatCode into stockGroup @@ -73,6 +88,7 @@ namespace BLL StockNum = m == null ? 0 : (decimal)m.StockNum, NeedNum = x == null ? 0 : x.NeedNum, RealNum = y == null ? 0 : y.RealNum, + OutputNum = o == null ? 0 : o.OutputNum, Code = z == null ? null : z.Code, HeatNo = z == null ? null : z.HeatNo, BatchNo = z == null ? null : z.BatchNo, @@ -449,7 +465,8 @@ namespace BLL } /// - /// 获取单位工程下当前区域内同时存在已焊口和未焊口的组件汇总。 + /// 获取单位工程下当前区域的组件导出汇总。 + /// 每个组件返回一行;未焊达因量按未焊口统计,材料信息按当前区域组件材料明细统计。 /// public static List GetPartialWeldedComponents(string projectId, string unitWorkId, string pipeArea, string warehouseCode) { @@ -476,17 +493,53 @@ namespace BLL z.UnitWorkId, m.UnitWorkName, x.PrefabricatedComponents, + x.MaterialCode, + x.MaterialCode2, + x.Number, w.WeldJointId, + w.Size, w.WeldingDailyId }).ToList(); - var partialComponents = componentWeldRows + var materialCodes = componentWeldRows + .Where(x => !string.IsNullOrEmpty(x.MaterialCode)) + .Select(x => x.MaterialCode) + .Distinct() + .ToList(); + var materialCodeLibByMaterialCode = materialCodes.Any() + ? db.HJGL_MaterialCodeLib + .Where(x => materialCodes.Contains(x.MaterialCode)) + .ToList() + .GroupBy(x => x.MaterialCode) + .ToDictionary(x => x.Key, x => x.First()) + : new Dictionary(); + + var componentExports = componentWeldRows .GroupBy(x => new { x.PipelineId, x.PipelineCode, x.UnitWorkId, x.UnitWorkName, x.PrefabricatedComponents }) .Select(group => { var weldJoints = group.GroupBy(x => x.WeldJointId).Select(x => x.First()).ToList(); int weldedCount = weldJoints.Count(x => !string.IsNullOrEmpty(x.WeldingDailyId)); int totalCount = weldJoints.Count; + // 材料编码优先采用匹配页面使用的 MaterialCode2,数量按当前区域组件材料明细汇总。 + var componentMaterialRows = group + .Where(x => (x.Number ?? 0) > 0) + .ToList(); + var materialGroups = componentMaterialRows + .Select(x => new + { + MaterialCode = GetExportMaterialCode(x.MaterialCode, x.MaterialCode2, materialCodeLibByMaterialCode), + Quantity = x.Number ?? 0 + }) + .Where(x => !string.IsNullOrEmpty(x.MaterialCode)) + .GroupBy(x => x.MaterialCode) + .OrderBy(x => x.Key) + .Select(x => new + { + MaterialCode = x.Key, + Quantity = x.Sum(y => y.Quantity) + }) + .ToList(); return new Tw_PartialWeldedComponentOutput { UnitWorkId = group.Key.UnitWorkId, @@ -498,26 +551,30 @@ namespace BLL PipeAreaText = pipeArea == PipelineService.PipeArea_SHOP ? "工厂预制" : "现场安装", TotalWeldJointCount = totalCount, WeldedWeldJointCount = weldedCount, - UnweldedWeldJointCount = totalCount - weldedCount + UnweldedWeldJointCount = totalCount - weldedCount, + UnweldedDin = weldJoints + .Where(x => string.IsNullOrEmpty(x.WeldingDailyId)) + .Sum(x => x.Size ?? 0), + MaterialCode = string.Join("\n", materialGroups.Select(x => x.MaterialCode)), + MaterialQuantity = string.Join("\n", materialGroups.Select(x => x.Quantity.ToString())) }; }) - .Where(x => x.WeldedWeldJointCount > 0 && x.UnweldedWeldJointCount > 0) .OrderBy(x => x.PipelineCode) .ThenBy(x => x.PrefabricatedComponents) .ToList(); - if (!partialComponents.Any()) + if (!componentExports.Any()) { - return partialComponents; + return componentExports; } // 导出匹配率复用页面匹配规则,保证区域、未焊口及续作组件优先级完全一致。 - var pipelineIds = partialComponents.Select(x => x.PipelineId).Distinct().ToList(); + var pipelineIds = componentExports.Select(x => x.PipelineId).Distinct().ToList(); var matchOutputs = GetPipeMatMatch(projectId, pipelineIds, warehouseCode, null, pipeArea); var componentRates = matchOutputs .GroupBy(x => GetComponentKey(x.PipelineId, x.PrefabricatedComponents)) .ToDictionary(x => x.Key, x => x.First().ComponentMatchRate ?? 0); - foreach (var component in partialComponents) + foreach (var component in componentExports) { decimal componentRate; componentRates.TryGetValue(GetComponentKey(component.PipelineId, component.PrefabricatedComponents), out componentRate); @@ -525,10 +582,24 @@ namespace BLL component.ComponentMatchRateString = Math.Round(componentRate * 100, 2).ToString() + "%"; } - return partialComponents; + return componentExports; } } + private static string GetExportMaterialCode(string materialCode, string materialCode2, Dictionary materialCodeLibByMaterialCode) + { + if (!string.IsNullOrEmpty(materialCode2)) + { + return materialCode2; + } + + HJGL_MaterialCodeLib materialLib; + return !string.IsNullOrEmpty(materialCode) + && materialCodeLibByMaterialCode.TryGetValue(materialCode, out materialLib) + ? materialLib.Code + : materialCode; + } + private static string GetJointAttributeByPipeArea(string pipeArea) { if (pipeArea == PipelineService.PipeArea_SHOP) diff --git a/SGGL/BLL/CLGL/TwInputdetailService.cs b/SGGL/BLL/CLGL/TwInputdetailService.cs index 188ec6cf..605c70d3 100644 --- a/SGGL/BLL/CLGL/TwInputdetailService.cs +++ b/SGGL/BLL/CLGL/TwInputdetailService.cs @@ -133,11 +133,19 @@ namespace BLL join mat in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals mat.MaterialCode into mm from mat in mm.DefaultIfEmpty() join y in Funs.DB.Tw_InputMaster on x.InputMasterId equals y.Id + join warehouse in Funs.DB.Base_Warehouse on y.WarehouseId equals warehouse.WarehouseId into warehouses + from warehouse in warehouses.DefaultIfEmpty() + join person in Funs.DB.Person_Persons on y.CreateMan equals person.PersonId into persons + from person in persons.DefaultIfEmpty() where inputMasterIds.Contains(x.InputMasterId) orderby y.CusBillCode, x.SortIndex select new { - 入库单编号 = y.CusBillCode, + y.CusBillCode, + WarehouseName = warehouse == null ? y.WarehouseCode : warehouse.WarehouseName, + y.TypeInt, + CreateManName = person == null ? y.CreateMan : person.PersonName, + y.CreateDate, 材料主编码 = x.MaterialCode, 材料编码 = mat.Code, 炉号 = mat.HeatNo, @@ -146,8 +154,26 @@ namespace BLL 材料描述 = mat.MaterialDef, 计划数量 = x.PlanNum, 实际数量 = x.ActNum, + y.Remark }; - return q; + // 类型字典无法转换为 SQL,先完成数据库查询,再生成固定顺序的 Excel 列。 + return q.ToList().Select(x => new + { + 编号 = x.CusBillCode, + 仓库 = x.WarehouseName, + 类型 = TwConst.TypeIntMap.FirstOrDefault(y => y.Value == x.TypeInt).Key, + 发起人 = x.CreateManName, + 发起时间 = x.CreateDate, + x.材料主编码, + x.材料编码, + x.炉号, + x.批号, + x.材料名称, + x.材料描述, + x.计划数量, + x.实际数量, + 备注 = x.Remark + }).ToList(); } } } diff --git a/SGGL/BLL/CLGL/TwOutputdetailService..cs b/SGGL/BLL/CLGL/TwOutputdetailService..cs index 03079244..22af7c42 100644 --- a/SGGL/BLL/CLGL/TwOutputdetailService..cs +++ b/SGGL/BLL/CLGL/TwOutputdetailService..cs @@ -151,13 +151,26 @@ namespace BLL public static IEnumerable GetPrintListByOutputMasterIds(List outputMasterIds) { var q = from x in Funs.DB.Tw_OutputDetail - join y in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode + join y in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode into materials + from y in materials.DefaultIfEmpty() join master in Funs.DB.Tw_OutputMaster on x.OutputMasterId equals master.Id + join plan in Funs.DB.Tw_InOutPlanMaster on master.InOutPlanMasterId equals plan.Id into plans + from plan in plans.DefaultIfEmpty() + join warehouse in Funs.DB.Base_Warehouse on master.WarehouseId equals warehouse.WarehouseId into warehouses + from warehouse in warehouses.DefaultIfEmpty() + join person in Funs.DB.Person_Persons on master.CreateMan equals person.PersonId into persons + from person in persons.DefaultIfEmpty() + join unit in Funs.DB.Base_Unit on master.ReqUnitId equals unit.UnitId into units + from unit in units.DefaultIfEmpty() where outputMasterIds.Contains(x.OutputMasterId) orderby master.CusBillCode select new { - 出库单编号 = master.CusBillCode, + master.CusBillCode, + WarehouseName = warehouse == null ? master.WarehouseCode : warehouse.WarehouseName, + master.TypeInt, + CreateManName = person == null ? master.CreateMan : person.PersonName, + master.CreateDate, 材料主编码 = x.MaterialCode, 材料编码 = y.Code, 炉号 = y.HeatNo, @@ -166,8 +179,30 @@ namespace BLL 材料描述 = y.MaterialDef, 计划数量 = x.PlanNum, 实际数量 = x.ActNum, + master.WarehouseDate, + ReqUnitName = unit == null ? master.ReqUnitId : unit.UnitName, + Remark = plan == null ? null : plan.Remark }; - return q; + // 类型字典无法转换为 SQL,先完成数据库查询,再生成固定顺序的 Excel 列。 + return q.ToList().Select(x => new + { + 编号 = x.CusBillCode, + 仓库 = x.WarehouseName, + 类型 = TwConst.TypeIntMap.FirstOrDefault(y => y.Value == x.TypeInt).Key, + 发起人 = x.CreateManName, + 发起时间 = x.CreateDate, + x.材料主编码, + x.材料编码, + x.炉号, + x.批号, + x.材料名称, + x.材料描述, + x.计划数量, + x.实际数量, + 出库时间 = x.WarehouseDate, + 领用单位 = x.ReqUnitName, + 备注 = x.Remark + }).ToList(); } } diff --git a/SGGL/BLL/Common/Const.cs b/SGGL/BLL/Common/Const.cs index f7f2f3de..e58c48d2 100644 --- a/SGGL/BLL/Common/Const.cs +++ b/SGGL/BLL/Common/Const.cs @@ -2944,6 +2944,8 @@ namespace BLL /// 下料抽检记录台账 /// public const string HJGL_PreWeldCuttingCheckMenuId = "D1B5A8B7-5D2A-4C51-9B7E-6A2F15B7F002"; + /// 焊缝外观检测记录菜单ID + public const string HJGL_WeldAppearanceCheckMenuId = "A4C8F8A1-1A27-4B63-A6DF-3F8AAE67C901"; /// /// 组对抽检列表台账 diff --git a/SGGL/BLL/HJGL/WeldingManage/PreWeldInspectionService.cs b/SGGL/BLL/HJGL/WeldingManage/PreWeldInspectionService.cs index c884ae2c..b26fef3b 100644 --- a/SGGL/BLL/HJGL/WeldingManage/PreWeldInspectionService.cs +++ b/SGGL/BLL/HJGL/WeldingManage/PreWeldInspectionService.cs @@ -9,6 +9,9 @@ namespace BLL /// public static class PreWeldInspectionService { + public const int CuttingReviewCompleted = 0; + public const int CuttingReviewPending = 1; + public const int CuttingReviewApproved = 2; /// /// 获取下料检查台账 /// @@ -62,13 +65,14 @@ namespace BLL CheckResult = x.c.CheckResult, UnqualifiedReason = x.c.UnqualifiedReason, RectifyRequirement = x.c.RectifyRequirement, - Remark = x.c.Remark + Remark = x.c.Remark, + ReviewState = x.c.ReviewState, + SpecialReviewerId = x.c.SpecialReviewerId, + ReviewerId = x.c.ReviewerId, + ReviewTime = x.c.ReviewTime }) .ToList(); - foreach (var item in data) - { - item.AttachUrl1 = GetInspectionAttachUrl(db, Const.HJGL_PreWeldCuttingCheckMenuId, item.CuttingCheckId); - } + PopulateCuttingCheckDetails(db, data); return Tuple.Create(data, total); } @@ -195,6 +199,48 @@ namespace BLL } } + public static List GetCuttingCheckItemsByWeldJointId(string weldJointId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var data = (from c in db.HJGL_PreWeldCuttingCheck + join w in db.HJGL_WeldJoint on c.WeldJointId equals w.WeldJointId + join p in db.Person_Persons on c.CheckPerson equals p.PersonId into persons + from p in persons.DefaultIfEmpty() + where c.WeldJointId == weldJointId + orderby c.CheckTime descending, c.CreateTime descending + select new Model.PreWeldCuttingCheckItem + { + CuttingCheckId = c.CuttingCheckId, + ProjectId = c.ProjectId, + WeldJointId = c.WeldJointId, + PipelineCode = w.PipelineCode, + WeldJointCode = w.WeldJointCode, + CuttingLength = c.CuttingLength, + GrooveForm = c.GrooveForm, + GrooveAngle = c.GrooveAngle, + IsMaterialCodeBatchNoAccurate = c.IsMaterialCodeBatchNoAccurate, + IsMaterialQuantityAccurate = c.IsMaterialQuantityAccurate, + IsQualified = c.IsQualified, + CheckPerson = c.CheckPerson, + CheckPersonName = p == null ? string.Empty : p.PersonName, + CheckTime = c.CheckTime, + CreateUser = c.CreateUser, + CreateTime = c.CreateTime, + CheckResult = c.CheckResult, + UnqualifiedReason = c.UnqualifiedReason, + RectifyRequirement = c.RectifyRequirement, + Remark = c.Remark, + ReviewState = c.ReviewState, + SpecialReviewerId = c.SpecialReviewerId, + ReviewerId = c.ReviewerId, + ReviewTime = c.ReviewTime + }).ToList(); + PopulateCuttingCheckDetails(db, data); + return data; + } + } + /// /// 按焊口获取组对记录 /// @@ -259,12 +305,69 @@ namespace BLL check.UnqualifiedReason = item.UnqualifiedReason; check.RectifyRequirement = item.RectifyRequirement; check.Remark = item.Remark; + bool requiresSpecialReview = !item.IsMaterialCodeBatchNoAccurate; + if (requiresSpecialReview && string.IsNullOrWhiteSpace(item.SpecialReviewerId)) + { + throw new ArgumentException("材料编码或批次不准确时必须选择专项审核办理人。"); + } + if (requiresSpecialReview && !db.SitePerson_Person.Any(x => x.ProjectId == check.ProjectId + && x.PersonId == item.SpecialReviewerId && x.States == Const.ProjectPersonStates_1)) + { + throw new ArgumentException("专项审核办理人不属于当前项目或已停用。"); + } + + check.ReviewState = requiresSpecialReview ? CuttingReviewPending : CuttingReviewCompleted; + check.SpecialReviewerId = requiresSpecialReview ? item.SpecialReviewerId : null; + check.ReviewerId = null; + check.ReviewTime = null; + SaveCuttingMaterialSnapshots(db, check, item.Materials); + SyncCuttingReviewTodo(db, check, item.CreateUser ?? item.CheckPerson); db.SubmitChanges(); SaveInspectionAttachUrl(item.AttachUrl1, Const.HJGL_PreWeldCuttingCheckMenuId, check.CuttingCheckId); return check.CuttingCheckId; } } + public static string ReviewCuttingCheck(Model.PreWeldCuttingCheckReviewInput item) + { + if (item == null || string.IsNullOrWhiteSpace(item.CuttingCheckId)) + { + throw new ArgumentException("下料检查记录ID不能为空。"); + } + + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var check = db.HJGL_PreWeldCuttingCheck.FirstOrDefault(x => x.CuttingCheckId == item.CuttingCheckId); + if (check == null) + { + throw new ArgumentException("未找到下料检查记录。"); + } + if (check.ReviewState != CuttingReviewPending) + { + throw new InvalidOperationException("该专项审核已办理或无需办理。"); + } + if (string.IsNullOrWhiteSpace(item.ReviewerId) || check.SpecialReviewerId != item.ReviewerId) + { + throw new InvalidOperationException("当前人员不是该专项审核的办理人。"); + } + + if (item.Materials != null) + { + SaveCuttingMaterialSnapshots(db, check, item.Materials); + } + if (!string.IsNullOrWhiteSpace(item.Remark)) + { + check.Remark = item.Remark; + } + check.ReviewState = CuttingReviewApproved; + check.ReviewerId = item.ReviewerId; + check.ReviewTime = item.ReviewTime ?? DateTime.Now; + CompleteCuttingReviewTodo(db, check.CuttingCheckId, item.ReviewerId); + db.SubmitChanges(); + return check.CuttingCheckId; + } + } + /// /// 保存组对检查;传入主键时修改对应记录,否则新增一条记录 /// @@ -711,6 +814,133 @@ namespace BLL } } + private static void SaveCuttingMaterialSnapshots(Model.SGGLDB db, Model.HJGL_PreWeldCuttingCheck check, + IList materials) + { + var currentMaterials = db.HJGL_PipeLineMat + .Where(x => x.WeldJointId == check.WeldJointId) + .OrderBy(x => x.PipeLineMatId) + .ToList(); + var inputs = materials ?? currentMaterials.Select((x, index) => new Model.PreWeldCuttingMaterialInput + { + PipeLineMatId = x.PipeLineMatId, + MaterialSide = index + 1, + ReportedMainCode = x.MaterialCode + }).ToList(); + + var existing = db.HJGL_PreWeldCuttingCheckMaterial + .Where(x => x.CuttingCheckId == check.CuttingCheckId) + .ToList(); + var originalCodeMap = existing.GroupBy(x => x.PipeLineMatId) + .ToDictionary(x => x.Key, x => x.First().OriginalMainCode); + db.HJGL_PreWeldCuttingCheckMaterial.DeleteAllOnSubmit(existing); + + int side = 0; + foreach (var input in inputs) + { + side++; + var material = currentMaterials.FirstOrDefault(x => x.PipeLineMatId == input.PipeLineMatId); + if (material == null) + { + throw new ArgumentException("反馈材料不属于当前焊口。"); + } + string reportedMainCode = string.IsNullOrWhiteSpace(input.ReportedMainCode) + ? material.MaterialCode + : input.ReportedMainCode.Trim(); + db.HJGL_PreWeldCuttingCheckMaterial.InsertOnSubmit(new Model.HJGL_PreWeldCuttingCheckMaterial + { + CuttingCheckMaterialId = Guid.NewGuid().ToString(), + CuttingCheckId = check.CuttingCheckId, + PipeLineMatId = material.PipeLineMatId, + MaterialSide = input.MaterialSide > 0 ? input.MaterialSide : side, + // 专项审核再次保存时保留首次提交快照,避免原始主编码被当前正式数据覆盖。 + OriginalMainCode = originalCodeMap.ContainsKey(material.PipeLineMatId) + ? originalCodeMap[material.PipeLineMatId] + : material.MaterialCode, + ReportedMainCode = reportedMainCode, + IsBatchChanged = !string.Equals(material.MaterialCode, reportedMainCode, StringComparison.OrdinalIgnoreCase) + }); + } + } + + private static void SyncCuttingReviewTodo(Model.SGGLDB db, Model.HJGL_PreWeldCuttingCheck check, string creator) + { + var todos = db.Workflow_TodoItems.Where(x => x.FlowId == check.CuttingCheckId + && x.WorkflowName == "下料抽检专项审核").ToList(); + db.Workflow_TodoItems.DeleteAllOnSubmit(todos); + if (check.ReviewState != CuttingReviewPending) + { + return; + } + + db.Workflow_TodoItems.InsertOnSubmit(new Model.Workflow_TodoItems + { + Id = SQLHelper.GetNewID(), + SysCode = WorkflowTodoitemsService.SysCode, + FlowId = check.CuttingCheckId, + RequestName = "下料抽检结果不准确,请专项审核", + WorkflowName = "下料抽检专项审核", + NodeName = "专项审核", + PCUrl = "HJGL/PreWeld/CuttingCheckEdit.aspx?CuttingCheckId=" + check.CuttingCheckId + "&review=1", + AppUrl = "/pages/hjgl/preWeld/cuttingCheckReview?cuttingCheckId=" + check.CuttingCheckId, + Creator = creator, + CreateDateTime = DateTime.Now, + Receiver = check.SpecialReviewerId, + ReceiveDateTime = DateTime.Now, + Status = (int)WorkflowTodoitemsService.Status.待办 + }); + } + + private static void CompleteCuttingReviewTodo(Model.SGGLDB db, string cuttingCheckId, string reviewerId) + { + var todo = db.Workflow_TodoItems.FirstOrDefault(x => x.FlowId == cuttingCheckId + && x.Receiver == reviewerId + && x.WorkflowName == "下料抽检专项审核" + && x.Status == (int)WorkflowTodoitemsService.Status.待办); + if (todo != null) + { + todo.Status = (int)WorkflowTodoitemsService.Status.已办; + } + } + + private static void PopulateCuttingCheckDetails(Model.SGGLDB db, IList data) + { + if (data == null || data.Count == 0) + { + return; + } + + var ids = data.Select(x => x.CuttingCheckId).ToList(); + var snapshots = db.HJGL_PreWeldCuttingCheckMaterial + .Where(x => ids.Contains(x.CuttingCheckId)) + .ToList(); + var personIds = data.SelectMany(x => new[] { x.SpecialReviewerId, x.ReviewerId }) + .Where(x => !string.IsNullOrEmpty(x)).Distinct().ToList(); + var personNames = db.Person_Persons.Where(x => personIds.Contains(x.PersonId)) + .ToDictionary(x => x.PersonId, x => x.PersonName); + + foreach (var item in data) + { + item.AttachUrl1 = GetInspectionAttachUrl(db, Const.HJGL_PreWeldCuttingCheckMenuId, item.CuttingCheckId); + item.ReviewStateText = item.ReviewState == CuttingReviewPending + ? "待专项审核" + : item.ReviewState == CuttingReviewApproved ? "专项审核完成" : "普通完成"; + string name; + item.SpecialReviewerName = personNames.TryGetValue(item.SpecialReviewerId ?? string.Empty, out name) ? name : string.Empty; + item.ReviewerName = personNames.TryGetValue(item.ReviewerId ?? string.Empty, out name) ? name : string.Empty; + item.Materials = snapshots.Where(x => x.CuttingCheckId == item.CuttingCheckId) + .OrderBy(x => x.MaterialSide) + .Select(x => new Model.PreWeldCuttingMaterialItem + { + PipeLineMatId = x.PipeLineMatId, + MaterialSide = x.MaterialSide, + OriginalMainCode = x.OriginalMainCode, + ReportedMainCode = x.ReportedMainCode, + IsBatchChanged = x.IsBatchChanged + }).ToList(); + } + } + /// /// 根据菜单和记录ID获取检查附件地址 /// diff --git a/SGGL/BLL/HJGL/WeldingManage/WeldAppearanceCheckService.cs b/SGGL/BLL/HJGL/WeldingManage/WeldAppearanceCheckService.cs new file mode 100644 index 00000000..5809e676 --- /dev/null +++ b/SGGL/BLL/HJGL/WeldingManage/WeldAppearanceCheckService.cs @@ -0,0 +1,292 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace BLL +{ + /// + /// 焊缝外观检测业务服务。 + /// + public static class WeldAppearanceCheckService + { + /// + /// 分页查询焊缝外观检测记录。 + /// + /// 项目ID。 + /// 管线号查询条件。 + /// 焊口号查询条件。 + /// 合格状态,1为合格,0为不合格,空为全部。 + /// 页码,从0开始。 + /// 每页记录数。 + /// 外观检测记录及总记录数。 + public static Tuple, int> GetList(string projectId, + string pipelineCode, string weldJointCode, string qualified, int pageIndex, int pageSize) + { + var db = Funs.DB; + var query = from c in db.HJGL_WeldAppearanceCheck + join w in db.HJGL_WeldJoint on c.WeldJointId equals w.WeldJointId + join p in db.Person_Persons on c.CheckPerson equals p.PersonId into persons + from p in persons.DefaultIfEmpty() + where string.IsNullOrEmpty(projectId) || c.ProjectId == projectId + select new { c, w, CheckPersonName = p == null ? string.Empty : p.PersonName }; + + if (!string.IsNullOrWhiteSpace(pipelineCode)) + { + query = query.Where(x => x.w.PipelineCode.Contains(pipelineCode)); + } + if (!string.IsNullOrWhiteSpace(weldJointCode)) + { + query = query.Where(x => x.w.WeldJointCode.Contains(weldJointCode)); + } + if (qualified == "1" || qualified == "0") + { + bool isQualified = qualified == "1"; + query = query.Where(x => x.c.IsQualified == isQualified); + } + + int total = query.Count(); + var data = query.OrderByDescending(x => x.c.CheckTime) + .ThenByDescending(x => x.c.CreateTime) + .Skip(pageIndex * pageSize) + .Take(pageSize) + .Select(x => new Model.WeldAppearanceCheckItem + { + AppearanceCheckId = x.c.AppearanceCheckId, + ProjectId = x.c.ProjectId, + WeldJointId = x.c.WeldJointId, + PipelineCode = x.w.PipelineCode, + WeldJointCode = x.w.WeldJointCode, + IsQualified = x.c.IsQualified, + QualifiedText = x.c.IsQualified ? "合格" : "不合格", + CheckPerson = x.c.CheckPerson, + CheckPersonName = x.CheckPersonName, + CheckTime = x.c.CheckTime, + Remark = x.c.Remark, + CreateTime = x.c.CreateTime + }).ToList(); + PopulateAttachUrls(data); + return Tuple.Create(data, total); + } + + /// + /// 分页查询当前项目中已焊接的焊口。 + /// + /// 项目ID。 + /// 管线号查询条件。 + /// 焊口号查询条件。 + /// 页码,从0开始。 + /// 每页记录数。 + /// 已焊接焊口列表。 + public static List GetWeldedJoints(string projectId, + string pipelineCode, string weldJointCode, int pageIndex, int pageSize) + { + var db = Funs.DB; + var query = db.View_HJGL_WeldJoint.Where(x => x.ProjectId == projectId && x.WeldingDailyId != null); + if (!string.IsNullOrWhiteSpace(pipelineCode)) + { + query = query.Where(x => x.PipelineCode.Contains(pipelineCode)); + } + if (!string.IsNullOrWhiteSpace(weldJointCode)) + { + query = query.Where(x => x.WeldJointCode.Contains(weldJointCode)); + } + return query.OrderBy(x => x.PipelineCode).ThenBy(x => x.WeldJointCode) + .Skip(pageIndex * pageSize).Take(pageSize) + .Select(x => new Model.WeldAppearanceJointItem + { + WeldJointId = x.WeldJointId, + ProjectId = x.ProjectId, + PipelineCode = x.PipelineCode, + WeldJointCode = x.WeldJointCode, + WeldTypeCode = x.WeldTypeCode, + WeldingMethodCode = x.WeldingMethodCode, + WeldingDate = x.WeldingDateD + }).ToList(); + } + + /// + /// 查询焊口基础信息及历史外观检测记录。 + /// + /// 焊口ID。 + /// 焊口详情及外观检测历史。 + public static Model.WeldAppearanceJointItem GetJointDetail(string weldJointId) + { + var db = Funs.DB; + var joint = db.View_HJGL_WeldJoint.Where(x => x.WeldJointId == weldJointId) + .Select(x => new Model.WeldAppearanceJointItem + { + WeldJointId = x.WeldJointId, + ProjectId = x.ProjectId, + PipelineCode = x.PipelineCode, + WeldJointCode = x.WeldJointCode, + WeldTypeCode = x.WeldTypeCode, + WeldingMethodCode = x.WeldingMethodCode, + WeldingDate = x.WeldingDateD + }).FirstOrDefault(); + if (joint != null) + { + joint.History = GetHistory(weldJointId); + } + return joint; + } + + /// + /// 根据记录ID查询焊缝外观检测记录。 + /// + /// 外观检测记录ID。 + /// 焊缝外观检测记录。 + public static Model.WeldAppearanceCheckItem GetById(string appearanceCheckId) + { + var item = GetHistoryQuery().FirstOrDefault(x => x.AppearanceCheckId == appearanceCheckId); + if (item != null) + { + item.AttachUrl = GetAttachUrl(item.AppearanceCheckId); + } + return item; + } + + /// + /// 新增或修改焊缝外观检测记录。 + /// + /// 外观检测结果及附件信息。 + /// 外观检测记录ID。 + public static string Save(Model.WeldAppearanceCheckInput item) + { + if (item == null || string.IsNullOrWhiteSpace(item.WeldJointId)) + { + throw new ArgumentException("焊口不能为空。"); + } + + var db = Funs.DB; + var joint = db.HJGL_WeldJoint.FirstOrDefault(x => x.WeldJointId == item.WeldJointId); + if (joint == null || joint.WeldingDailyId == null) + { + throw new ArgumentException("只能对已焊接焊口进行外观检测。"); + } + + string id = string.IsNullOrWhiteSpace(item.AppearanceCheckId) + ? Guid.NewGuid().ToString() + : item.AppearanceCheckId; + var check = db.HJGL_WeldAppearanceCheck.FirstOrDefault(x => x.AppearanceCheckId == id); + bool hasExistingPhoto = db.AttachFile.Any(x => x.MenuId == Const.HJGL_WeldAppearanceCheckMenuId && x.ToKeyId == id); + if (string.IsNullOrWhiteSpace(item.AttachUrl) && !hasExistingPhoto) + { + throw new ArgumentException("请至少上传一张外观检测照片。"); + } + + if (check == null) + { + check = new Model.HJGL_WeldAppearanceCheck + { + AppearanceCheckId = id, + CreateTime = DateTime.Now, + CreateUser = string.IsNullOrEmpty(item.CreateUser) ? item.CheckPerson : item.CreateUser + }; + db.HJGL_WeldAppearanceCheck.InsertOnSubmit(check); + } + else + { + check.ModifyUser = string.IsNullOrEmpty(item.CreateUser) ? item.CheckPerson : item.CreateUser; + check.ModifyTime = DateTime.Now; + } + + check.ProjectId = string.IsNullOrEmpty(item.ProjectId) ? joint.ProjectId : item.ProjectId; + check.WeldJointId = item.WeldJointId; + check.IsQualified = item.IsQualified; + check.CheckPerson = item.CheckPerson; + check.CheckTime = item.CheckTime ?? DateTime.Now; + check.Remark = item.Remark; + db.SubmitChanges(); + + if (!string.IsNullOrWhiteSpace(item.AttachUrl)) + { + UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(item.AttachUrl, 10, null), + item.AttachUrl, Const.HJGL_WeldAppearanceCheckMenuId, id); + } + return id; + } + + /// + /// 删除焊缝外观检测记录及其附件。 + /// + /// 外观检测记录ID。 + public static void Delete(string appearanceCheckId) + { + var db = Funs.DB; + var check = db.HJGL_WeldAppearanceCheck.FirstOrDefault(x => x.AppearanceCheckId == appearanceCheckId); + if (check == null) + { + return; + } + db.HJGL_WeldAppearanceCheck.DeleteOnSubmit(check); + db.SubmitChanges(); + CommonService.DeleteAttachFileById(Const.HJGL_WeldAppearanceCheckMenuId, appearanceCheckId); + } + + /// + /// 查询指定焊口的历史外观检测记录。 + /// + /// 焊口ID。 + /// 按检测时间倒序排列的历史记录。 + private static List GetHistory(string weldJointId) + { + var data = GetHistoryQuery().Where(x => x.WeldJointId == weldJointId) + .OrderByDescending(x => x.CheckTime).ThenByDescending(x => x.CreateTime).ToList(); + PopulateAttachUrls(data); + return data; + } + + /// + /// 构建焊缝外观检测记录查询。 + /// + /// 焊缝外观检测记录查询对象。 + private static IQueryable GetHistoryQuery() + { + var db = Funs.DB; + return from c in db.HJGL_WeldAppearanceCheck + join w in db.HJGL_WeldJoint on c.WeldJointId equals w.WeldJointId + join p in db.Person_Persons on c.CheckPerson equals p.PersonId into persons + from p in persons.DefaultIfEmpty() + select new Model.WeldAppearanceCheckItem + { + AppearanceCheckId = c.AppearanceCheckId, + ProjectId = c.ProjectId, + WeldJointId = c.WeldJointId, + PipelineCode = w.PipelineCode, + WeldJointCode = w.WeldJointCode, + IsQualified = c.IsQualified, + QualifiedText = c.IsQualified ? "合格" : "不合格", + CheckPerson = c.CheckPerson, + CheckPersonName = p == null ? string.Empty : p.PersonName, + CheckTime = c.CheckTime, + Remark = c.Remark, + CreateTime = c.CreateTime + }; + } + + /// + /// 为外观检测记录补充附件地址。 + /// + /// 外观检测记录。 + private static void PopulateAttachUrls(IList data) + { + foreach (var item in data) + { + item.AttachUrl = GetAttachUrl(item.AppearanceCheckId); + } + } + + /// + /// 查询外观检测记录的附件地址。 + /// + /// 外观检测记录ID。 + /// 附件地址。 + private static string GetAttachUrl(string id) + { + var db = Funs.DB; + var url = db.AttachFile.Where(x => x.MenuId == Const.HJGL_WeldAppearanceCheckMenuId && x.ToKeyId == id) + .Select(x => x.AttachUrl).FirstOrDefault(); + return string.IsNullOrEmpty(url) ? url : url.Replace('\\', '/'); + } + } +} diff --git a/SGGL/BLL/HJGL/WeldingManage/WeldingDailyService.cs b/SGGL/BLL/HJGL/WeldingManage/WeldingDailyService.cs index eada6c80..da5c0c90 100644 --- a/SGGL/BLL/HJGL/WeldingManage/WeldingDailyService.cs +++ b/SGGL/BLL/HJGL/WeldingManage/WeldingDailyService.cs @@ -478,6 +478,15 @@ namespace BLL /// 焊工类型 0 全部 1 打底 2 盖面 /// 错误信息 public static string SaveWeldingDailyTempDetailByMobile(string weldJointId, string personId, string time, string weldingLocationId, int welderType) + { + return SaveWeldingDailyTempDetailByMobile(weldJointId, personId, time, weldingLocationId, welderType, null, null); + } + + /// + /// 移动端按焊口保存焊接日报待审核明细,并按需同步焊接方法和焊缝类型。 + /// + public static string SaveWeldingDailyTempDetailByMobile(string weldJointId, string personId, string time, + string weldingLocationId, int welderType, string weldingMethodId, string weldTypeId) { string res = string.Empty; using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) @@ -506,6 +515,13 @@ namespace BLL var weldTask = db.HJGL_WeldTask.FirstOrDefault(x => x.WeldJointId == joint.WeldJointId); var weldJoint = db.HJGL_WeldJoint.FirstOrDefault(x => x.WeldJointId == joint.WeldJointId); + + // 兼容旧版小程序:只有两个参数同时存在时才成对更新,避免焊口工艺信息出现半更新。 + if (!string.IsNullOrWhiteSpace(weldingMethodId) && !string.IsNullOrWhiteSpace(weldTypeId)) + { + weldJoint.WeldingMethodId = weldingMethodId; + weldJoint.WeldTypeId = weldTypeId; + } var pending = GetPendingTempDetail(db, weldJointId, weldingDate); string coverWelderId = pending != null ? pending.CoverWelderId : weldJoint.CoverWelderId; diff --git a/SGGL/FineUIPro.Web/CLGL/ArrivalStatistics.aspx b/SGGL/FineUIPro.Web/CLGL/ArrivalStatistics.aspx index 3e1f0ab4..8166476a 100644 --- a/SGGL/FineUIPro.Web/CLGL/ArrivalStatistics.aspx +++ b/SGGL/FineUIPro.Web/CLGL/ArrivalStatistics.aspx @@ -90,6 +90,9 @@ + + diff --git a/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx b/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx index 25ca93f9..420fb174 100644 --- a/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx +++ b/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx @@ -57,7 +57,7 @@ - diff --git a/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx.cs b/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx.cs index 5edb9e9c..0fd9079c 100644 --- a/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx.cs +++ b/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx.cs @@ -266,26 +266,29 @@ namespace FineUIPro.Web.CLGL /// protected void btnOut_Click(object sender, EventArgs e) { - if (Grid1.SelectedRowIDArray.Length > 0) + if (Grid1.SelectedRowIDArray.Length == 0) { - var printModel = TwInputdetailService.GePrintListByInputMasterIds(Grid1.SelectedRowIDArray.ToList()); - string path = Funs.RootPath + @"File\Excel\Temp\InputDetail.xlsx"; - path = path.Replace(".xlsx", string.Format("{0:yyyy-MM-dd-HH-mm}", DateTime.Now) + ".xlsx"); - - MiniExcel.SaveAs(path, printModel); - - string fileName = "入库明细表.xlsx"; - FileInfo info = new FileInfo(path); - long fileSize = info.Length; - System.Web.HttpContext.Current.Response.Clear(); - System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed"; - System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8)); - System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString()); - System.Web.HttpContext.Current.Response.TransmitFile(path, 0, fileSize); - System.Web.HttpContext.Current.Response.Flush(); - System.Web.HttpContext.Current.Response.Close(); - File.Delete(path); + Alert.ShowInTop("请至少选择一张入库单", MessageBoxIcon.Warning); + return; } + + var printModel = TwInputdetailService.GePrintListByInputMasterIds(Grid1.SelectedRowIDArray.ToList()); + string path = Funs.RootPath + @"File\Excel\Temp\InputDetail.xlsx"; + path = path.Replace(".xlsx", string.Format("{0:yyyy-MM-dd-HH-mm}", DateTime.Now) + ".xlsx"); + + MiniExcel.SaveAs(path, printModel); + + string fileName = "入库明细表.xlsx"; + FileInfo info = new FileInfo(path); + long fileSize = info.Length; + System.Web.HttpContext.Current.Response.Clear(); + System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed"; + System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8)); + System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString()); + System.Web.HttpContext.Current.Response.TransmitFile(path, 0, fileSize); + System.Web.HttpContext.Current.Response.Flush(); + System.Web.HttpContext.Current.Response.Close(); + File.Delete(path); } /// diff --git a/SGGL/FineUIPro.Web/CLGL/MaterialStock.aspx.cs b/SGGL/FineUIPro.Web/CLGL/MaterialStock.aspx.cs index 9b9dc3fc..96526621 100644 --- a/SGGL/FineUIPro.Web/CLGL/MaterialStock.aspx.cs +++ b/SGGL/FineUIPro.Web/CLGL/MaterialStock.aspx.cs @@ -225,8 +225,7 @@ namespace FineUIPro.Web.CLGL string filename = Funs.GetNewFileName(); Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("材料库存表" + filename, System.Text.Encoding.UTF8) + ".xls"); Response.ContentType = "application/excel"; - Response.ContentEncoding = System.Text.Encoding.UTF8; - this.Grid1.PageSize = 500; + Response.ContentEncoding = System.Text.Encoding.UTF8; this.BindGrid(); Response.Write(GetGridTableHtml(Grid1)); Response.End(); diff --git a/SGGL/FineUIPro.Web/CLGL/OutputMaster.aspx b/SGGL/FineUIPro.Web/CLGL/OutputMaster.aspx index 8640e859..c49f1372 100644 --- a/SGGL/FineUIPro.Web/CLGL/OutputMaster.aspx +++ b/SGGL/FineUIPro.Web/CLGL/OutputMaster.aspx @@ -87,7 +87,7 @@ - @@ -97,6 +97,7 @@ diff --git a/SGGL/FineUIPro.Web/CLGL/OutputMaster.aspx.cs b/SGGL/FineUIPro.Web/CLGL/OutputMaster.aspx.cs index c82bdf38..0b84b22d 100644 --- a/SGGL/FineUIPro.Web/CLGL/OutputMaster.aspx.cs +++ b/SGGL/FineUIPro.Web/CLGL/OutputMaster.aspx.cs @@ -672,30 +672,29 @@ namespace FineUIPro.Web.CLGL protected void btnOut_Click(object sender, EventArgs e) { - if (Grid1.SelectedRowIDArray.Length > 0) + if (Grid1.SelectedRowIDArray.Length == 0) { - var sheets = new Dictionary - { - ["出库明细"] = TwOutputdetailService.GetPrintListByOutputMasterIds(Grid1.SelectedRowIDArray.ToList()), - ["管线材料明细"] = TwInoutplandetailRelationService.GetPrintListByOutputMasterIds(Grid1.SelectedRowIDArray.ToList()) - }; - string path = Funs.RootPath + @"File\Excel\Temp\OutputDetail.xlsx"; - path = path.Replace(".xlsx", string.Format("{0:yyyy-MM-dd-HH-mm}", DateTime.Now) + ".xlsx"); - - MiniExcel.SaveAs(path, sheets); - - string fileName = "出库明细表.xlsx"; - FileInfo info = new FileInfo(path); - long fileSize = info.Length; - System.Web.HttpContext.Current.Response.Clear(); - System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed"; - System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8)); - System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString()); - System.Web.HttpContext.Current.Response.TransmitFile(path, 0, fileSize); - System.Web.HttpContext.Current.Response.Flush(); - System.Web.HttpContext.Current.Response.Close(); - File.Delete(path); + Alert.ShowInTop("请至少选择一张出库单", MessageBoxIcon.Warning); + return; } + + var printModel = TwOutputdetailService.GetPrintListByOutputMasterIds(Grid1.SelectedRowIDArray.ToList()); + string path = Funs.RootPath + @"File\Excel\Temp\OutputDetail.xlsx"; + path = path.Replace(".xlsx", string.Format("{0:yyyy-MM-dd-HH-mm}", DateTime.Now) + ".xlsx"); + + MiniExcel.SaveAs(path, printModel); + + string fileName = "出库明细表.xlsx"; + FileInfo info = new FileInfo(path); + long fileSize = info.Length; + System.Web.HttpContext.Current.Response.Clear(); + System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed"; + System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8)); + System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString()); + System.Web.HttpContext.Current.Response.TransmitFile(path, 0, fileSize); + System.Web.HttpContext.Current.Response.Flush(); + System.Web.HttpContext.Current.Response.Close(); + File.Delete(path); } } } diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index 66a80cd3..ce278d01 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -1727,6 +1727,8 @@ + + @@ -11726,6 +11728,20 @@ WeldReport.aspx ASPXCodeBehind + + WeldAppearanceCheck.aspx + ASPXCodeBehind + + + WeldAppearanceCheck.aspx + + + WeldAppearanceCheckEdit.aspx + ASPXCodeBehind + + + WeldAppearanceCheckEdit.aspx + WeldReport.aspx diff --git a/SGGL/FineUIPro.Web/HJGL/DataImport/MaterialInformation.aspx b/SGGL/FineUIPro.Web/HJGL/DataImport/MaterialInformation.aspx index e712935e..fd346d17 100644 --- a/SGGL/FineUIPro.Web/HJGL/DataImport/MaterialInformation.aspx +++ b/SGGL/FineUIPro.Web/HJGL/DataImport/MaterialInformation.aspx @@ -7,6 +7,9 @@ 材料信息 +
@@ -105,7 +108,7 @@ EnableCollapse="true" runat="server" BoxFlex="1" DataKeyNames="PipeLineMatId" EnableColumnLines="true" DataIDField="PipeLineMatId" AllowSorting="true" EnableCheckBoxSelect="true" SortField="PrefabricatedComponents" SortDirection="ASC" OnSort="Grid1_Sort" - EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick"> + EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" OnRowDataBound="MaterialGrid_RowDataBound"> @@ -175,7 +178,7 @@ EnableCollapse="true" runat="server" BoxFlex="1" DataKeyNames="PipeLineMatId" EnableColumnLines="true" DataIDField="PipeLineMatId" AllowSorting="true" SortField="PipeLineMatId" SortDirection="ASC" OnSort="Grid2_Sort" EnableCheckBoxSelect="true" - EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid2_RowDoubleClick"> + EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid2_RowDoubleClick" OnRowDataBound="MaterialGrid_RowDataBound"> @@ -238,7 +241,7 @@ ISNULL(pipe.MaterialCode,'') THEN 1 ELSE 0 END AS BIT) HasChange + FROM dbo.HJGL_PreWeldCuttingCheckMaterial s + INNER JOIN dbo.HJGL_PreWeldCuttingCheck c ON c.CuttingCheckId=s.CuttingCheckId + WHERE s.PipeLineMatId=pipe.PipeLineMatId AND c.ReviewState=2 + ORDER BY c.ReviewTime DESC, c.CheckTime DESC, c.CuttingCheckId DESC + ) reviewChange WHERE line.UnitWorkId=@UnitWorkId and pipe.PipeArea='1' and pipe.PrefabricatedComponents !='' "; List listStr = new List(); //if (!string.IsNullOrEmpty(txtMaterialCode.Text.Trim())) @@ -373,12 +380,19 @@ namespace FineUIPro.Web.HJGL.DataImport ISNULL(lib.MaterialDef, libCode.MaterialDef) AS MaterialDef, pipe.Number, CASE pipe.PipeArea WHEN '1' THEN N'工厂预制' WHEN '2' THEN N'现场安装' END AS PipeAreaText, - weld.WeldJointCode + weld.WeldJointCode, ISNULL(reviewChange.HasChange, 0) AS HasReviewedBatchChange FROM dbo.HJGL_PipeLineMat pipe LEFT JOIN dbo.HJGL_MaterialCodeLib lib ON lib.MaterialCode = pipe.MaterialCode LEFT JOIN HJGL_Pipeline line ON pipe.PipelineId=line.PipelineId OUTER APPLY (SELECT TOP 1 * FROM dbo.HJGL_MaterialCodeLib codeLib WHERE codeLib.ProjectId=line.ProjectId AND codeLib.Code=pipe.MaterialCode2 ORDER BY codeLib.MaterialCode) libCode LEFT JOIN dbo.HJGL_WeldJoint weld ON weld.WeldJointId = pipe.WeldJointId + OUTER APPLY ( + SELECT TOP 1 CAST(CASE WHEN ISNULL(s.ReportedMainCode,'') <> ISNULL(pipe.MaterialCode,'') THEN 1 ELSE 0 END AS BIT) HasChange + FROM dbo.HJGL_PreWeldCuttingCheckMaterial s + INNER JOIN dbo.HJGL_PreWeldCuttingCheck c ON c.CuttingCheckId=s.CuttingCheckId + WHERE s.PipeLineMatId=pipe.PipeLineMatId AND c.ReviewState=2 + ORDER BY c.ReviewTime DESC, c.CheckTime DESC, c.CuttingCheckId DESC + ) reviewChange WHERE line.UnitWorkId=@UnitWorkId and pipe.PipeArea='2' "; List listStr = new List(); if (!string.IsNullOrEmpty(pipelineId)) @@ -413,12 +427,19 @@ namespace FineUIPro.Web.HJGL.DataImport ISNULL(lib.MaterialDef, libCode.MaterialDef) AS MaterialDef, pipe.Number,pipe.PrefabricatedComponents, CASE pipe.PipeArea WHEN '1' THEN N'工厂预制' WHEN '2' THEN N'现场安装' END AS PipeAreaText, - weld.WeldJointCode + weld.WeldJointCode, ISNULL(reviewChange.HasChange, 0) AS HasReviewedBatchChange FROM dbo.HJGL_PipeLineMat pipe LEFT JOIN dbo.HJGL_MaterialCodeLib lib ON lib.MaterialCode = pipe.MaterialCode LEFT JOIN HJGL_Pipeline line ON pipe.PipelineId=line.PipelineId OUTER APPLY (SELECT TOP 1 * FROM dbo.HJGL_MaterialCodeLib codeLib WHERE codeLib.ProjectId=line.ProjectId AND codeLib.Code=pipe.MaterialCode2 ORDER BY codeLib.MaterialCode) libCode LEFT JOIN dbo.HJGL_WeldJoint weld ON weld.WeldJointId = pipe.WeldJointId + OUTER APPLY ( + SELECT TOP 1 CAST(CASE WHEN ISNULL(s.ReportedMainCode,'') <> ISNULL(pipe.MaterialCode,'') THEN 1 ELSE 0 END AS BIT) HasChange + FROM dbo.HJGL_PreWeldCuttingCheckMaterial s + INNER JOIN dbo.HJGL_PreWeldCuttingCheck c ON c.CuttingCheckId=s.CuttingCheckId + WHERE s.PipeLineMatId=pipe.PipeLineMatId AND c.ReviewState=2 + ORDER BY c.ReviewTime DESC, c.CheckTime DESC, c.CuttingCheckId DESC + ) reviewChange WHERE line.UnitWorkId=@UnitWorkId and pipe.PipeArea='1' and (pipe.PrefabricatedComponents is null or pipe.PrefabricatedComponents='') "; List listStr = new List(); //if (!string.IsNullOrEmpty(txtMaterialCode.Text.Trim())) @@ -450,6 +471,19 @@ namespace FineUIPro.Web.HJGL.DataImport #endregion + /// + /// 最新专项审核反馈主编码与当前材料主编码不一致时整行标红。 + /// + protected void MaterialGrid_RowDataBound(object sender, GridRowEventArgs e) + { + var row = e.DataItem as DataRowView; + if (row != null && row.Row.Table.Columns.Contains("HasReviewedBatchChange") + && Convert.ToBoolean(row["HasReviewedBatchChange"])) + { + e.RowCssClass = "batch-changed-review"; + } + } + #region 分页排序 #region 排序 diff --git a/SGGL/FineUIPro.Web/HJGL/InfoQuery/JointQuery.aspx b/SGGL/FineUIPro.Web/HJGL/InfoQuery/JointQuery.aspx index c1ecbeea..b1d25630 100644 --- a/SGGL/FineUIPro.Web/HJGL/InfoQuery/JointQuery.aspx +++ b/SGGL/FineUIPro.Web/HJGL/InfoQuery/JointQuery.aspx @@ -112,6 +112,9 @@ + + diff --git a/SGGL/FineUIPro.Web/HJGL/InfoQuery/JointQuery.aspx.cs b/SGGL/FineUIPro.Web/HJGL/InfoQuery/JointQuery.aspx.cs index 37e4847f..dc11971a 100644 --- a/SGGL/FineUIPro.Web/HJGL/InfoQuery/JointQuery.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/InfoQuery/JointQuery.aspx.cs @@ -626,6 +626,7 @@ namespace FineUIPro.Web.HJGL.InfoQuery 管线号 = x.PipelineCode, 焊口号 = x.WeldJointCode, 完成状态 = x.IsWeldOK, + 焊缝是否合格 = x.WeldAppearanceResult, 单位名称 = x.UnitName, 流水段 = x.FlowingSection, 任务单编号 = x.TaskCode, @@ -709,6 +710,7 @@ namespace FineUIPro.Web.HJGL.InfoQuery { 焊口号 = x.WeldJointCode, 完成状态 = x.IsWeldOK, + 焊缝是否合格 = x.WeldAppearanceResult, 单位名称 = x.UnitName, 流水段 = x.FlowingSection, 任务单编号 = x.TaskCode, diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipelineEdit.aspx b/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipelineEdit.aspx index 0440ccf5..188d6007 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipelineEdit.aspx +++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipelineEdit.aspx @@ -43,7 +43,7 @@ - diff --git a/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheck.aspx b/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheck.aspx index 54a065f2..01b9751f 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheck.aspx +++ b/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheck.aspx @@ -68,6 +68,12 @@ + + + + diff --git a/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx b/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx index 455f3d9f..63744fcd 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx +++ b/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx @@ -52,6 +52,18 @@ + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx.cs b/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx.cs index d918a627..367abc6c 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx.cs @@ -20,10 +20,12 @@ namespace FineUIPro.Web.HJGL.PreWeld CuttingCheckId = Request.Params["CuttingCheckId"]; BindWeldJoint(); BindCheckPerson(); + BindSpecialReviewer(); ddlCheckResult.SelectedValue = "合格"; if (!string.IsNullOrEmpty(CuttingCheckId)) { BindData(); + btnReview.Hidden = Request.Params["review"] != "1"; } else { @@ -57,6 +59,14 @@ namespace FineUIPro.Web.HJGL.PreWeld Person_PersonsService.InitUserProjectIdUnitIdRoleIdDropDownList(drpCheckPerson, CurrUser.LoginProjectId, null, null, true); } + private void BindSpecialReviewer() + { + ddlSpecialReviewer.DataTextField = "BaseInfoName"; + ddlSpecialReviewer.DataValueField = "BaseInfoId"; + ddlSpecialReviewer.DataSource = APIPreWeldInspectionService.GetSpecialReviewers(CurrUser.LoginProjectId); + ddlSpecialReviewer.DataBind(); + } + private void BindData() { var model = PreWeldInspectionService.GetCuttingCheckById(CuttingCheckId); @@ -83,6 +93,17 @@ namespace FineUIPro.Web.HJGL.PreWeld txtUnqualifiedReason.Text = model.UnqualifiedReason; txtRectifyRequirement.Text = model.RectifyRequirement; txtRemark.Text = model.Remark; + if (!string.IsNullOrEmpty(model.SpecialReviewerId)) + { + ddlSpecialReviewer.SelectedValue = model.SpecialReviewerId; + } + var detail = PreWeldInspectionService.GetCuttingCheckItemsByWeldJointId(model.WeldJointId) + .FirstOrDefault(x => x.CuttingCheckId == CuttingCheckId); + if (detail != null && detail.Materials != null) + { + txtMaterialFeedback.Text = string.Join("\r\n", detail.Materials.Select(x => string.Format( + "第{0}侧:{1} → {2}", x.MaterialSide, x.OriginalMainCode, x.ReportedMainCode))); + } } protected void btnSave_Click(object sender, EventArgs e) @@ -109,7 +130,8 @@ namespace FineUIPro.Web.HJGL.PreWeld CreateUser = CurrUser.PersonId, UnqualifiedReason = txtUnqualifiedReason.Text.Trim(), RectifyRequirement = txtRectifyRequirement.Text.Trim(), - Remark = txtRemark.Text.Trim() + Remark = txtRemark.Text.Trim(), + SpecialReviewerId = ddlSpecialReviewer.SelectedValue }; CuttingCheckId = APIPreWeldInspectionService.SaveCuttingCheck(item); @@ -117,6 +139,19 @@ namespace FineUIPro.Web.HJGL.PreWeld PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); } + protected void btnReview_Click(object sender, EventArgs e) + { + APIPreWeldInspectionService.ReviewCuttingCheck(new Model.PreWeldCuttingCheckReviewInput + { + CuttingCheckId = CuttingCheckId, + ReviewerId = CurrUser.PersonId, + ReviewTime = DateTime.Now, + Remark = txtRemark.Text.Trim() + }); + ShowNotify("专项审核已完成!", MessageBoxIcon.Success); + PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); + } + protected void btnAttachUrl_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(CuttingCheckId)) diff --git a/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx.designer.cs index 05a38999..ee7102eb 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx.designer.cs @@ -95,6 +95,10 @@ namespace FineUIPro.Web.HJGL.PreWeld /// protected global::FineUIPro.CheckBox chkMaterialQuantity; + protected global::FineUIPro.DropDownList ddlSpecialReviewer; + + protected global::FineUIPro.TextArea txtMaterialFeedback; + /// /// ddlCheckResult 控件。 /// @@ -176,6 +180,8 @@ namespace FineUIPro.Web.HJGL.PreWeld /// protected global::FineUIPro.Button btnSave; + protected global::FineUIPro.Button btnReview; + /// /// btnClose 控件。 /// diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/PipelineMatIn.aspx.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/PipelineMatIn.aspx.cs index b806d85f..24d7a11f 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/PipelineMatIn.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/PipelineMatIn.aspx.cs @@ -523,7 +523,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage && x.PipelineId == item.PipelineId && x.PrefabricatedComponents == item.PrefabricatedComponents && x.PipeArea == item.PipeArea - && (string.IsNullOrEmpty(item.MaterialCode) || x.MaterialCode == item.MaterialCode) + // && (string.IsNullOrEmpty(item.MaterialCode) || x.MaterialCode == item.MaterialCode) select x; if (pipeLineMat.Count() == 0 || pipeLineMat == null) { @@ -533,12 +533,13 @@ namespace FineUIPro.Web.HJGL.WeldingManage else { var oldPipeLineMat = pipeLineMat.First(); - item.PipeLineMatId = oldPipeLineMat.PipeLineMatId; - if (string.IsNullOrEmpty(item.MaterialCode)) + oldPipeLineMat.Number=item.Number; + oldPipeLineMat.MaterialCode2 = item.MaterialCode2; + if (!string.IsNullOrEmpty(item.MaterialCode)) { - item.MaterialCode = oldPipeLineMat.MaterialCode; + oldPipeLineMat.MaterialCode = item.MaterialCode; } - BLL.PipelineMatService.UpdatePipeLineMat(item); + BLL.PipelineMatService.UpdatePipeLineMat(oldPipeLineMat); } BLL.HJGL_PipelineComponentService.SyncPipelineComponentByMatId(item.PipeLineMatId); } diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldAppearanceCheck.aspx b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldAppearanceCheck.aspx new file mode 100644 index 00000000..1845c7d6 --- /dev/null +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldAppearanceCheck.aspx @@ -0,0 +1,106 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WeldAppearanceCheck.aspx.cs" Inherits="FineUIPro.Web.HJGL.WeldingManage.WeldAppearanceCheck" %> + + + + + 焊缝外观检测记录 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
public int welderType { get; set; } + /// + /// 焊接方法ID;兼容旧版小程序,可不传 + /// + public string WeldingMethodId { get; set; } + + /// + /// 焊缝类型ID;兼容旧版小程序,可不传 + /// + public string WeldTypeId { get; set; } + /// /// 焊前附件路径 /// diff --git a/SGGL/Model/APIItem/HJGL/PreWeldInspectionItem.cs b/SGGL/Model/APIItem/HJGL/PreWeldInspectionItem.cs index c12a2bf0..3a3f6cc3 100644 --- a/SGGL/Model/APIItem/HJGL/PreWeldInspectionItem.cs +++ b/SGGL/Model/APIItem/HJGL/PreWeldInspectionItem.cs @@ -102,6 +102,20 @@ namespace Model /// public class PreWeldMaterialItem { + /// + /// 管线材料ID + /// + public string PipeLineMatId { get; set; } + + /// + /// 焊口侧序号 + /// + public int MaterialSide { get; set; } + + /// + /// 材料主编码 + /// + public string MainCode { get; set; } /// /// 材料编码 @@ -221,6 +235,16 @@ namespace Model /// 备注 /// public string Remark { get; set; } + + /// + /// 专项审核办理人;材料编码或批次不准确时必填 + /// + public string SpecialReviewerId { get; set; } + + /// + /// 两侧材料主编码反馈 + /// + public List Materials { get; set; } } /// @@ -332,6 +356,37 @@ namespace Model /// 备注 /// public string Remark { get; set; } + + public int ReviewState { get; set; } + public string ReviewStateText { get; set; } + public string SpecialReviewerId { get; set; } + public string SpecialReviewerName { get; set; } + public string ReviewerId { get; set; } + public string ReviewerName { get; set; } + public DateTime? ReviewTime { get; set; } + public List Materials { get; set; } + } + + public class PreWeldCuttingMaterialInput + { + public string PipeLineMatId { get; set; } + public int MaterialSide { get; set; } + public string ReportedMainCode { get; set; } + } + + public class PreWeldCuttingMaterialItem : PreWeldCuttingMaterialInput + { + public string OriginalMainCode { get; set; } + public bool IsBatchChanged { get; set; } + } + + public class PreWeldCuttingCheckReviewInput + { + public string CuttingCheckId { get; set; } + public string ReviewerId { get; set; } + public DateTime? ReviewTime { get; set; } + public string Remark { get; set; } + public List Materials { get; set; } } /// diff --git a/SGGL/Model/APIItem/HJGL/WeldAppearanceCheckItem.cs b/SGGL/Model/APIItem/HJGL/WeldAppearanceCheckItem.cs new file mode 100644 index 00000000..70289640 --- /dev/null +++ b/SGGL/Model/APIItem/HJGL/WeldAppearanceCheckItem.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; + +namespace Model +{ + public class WeldAppearanceCheckInput + { + public string AppearanceCheckId { get; set; } + public string ProjectId { get; set; } + public string WeldJointId { get; set; } + public bool IsQualified { get; set; } + public string CheckPerson { get; set; } + public DateTime? CheckTime { get; set; } + public string Remark { get; set; } + public string AttachUrl { get; set; } + public string CreateUser { get; set; } + } + + public class WeldAppearanceCheckItem + { + public string AppearanceCheckId { get; set; } + public string ProjectId { get; set; } + public string WeldJointId { get; set; } + public string PipelineCode { get; set; } + public string WeldJointCode { get; set; } + public bool IsQualified { get; set; } + public string QualifiedText { get; set; } + public string CheckPerson { get; set; } + public string CheckPersonName { get; set; } + public DateTime CheckTime { get; set; } + public string Remark { get; set; } + public string AttachUrl { get; set; } + public DateTime CreateTime { get; set; } + } + + public class WeldAppearanceJointItem + { + public string WeldJointId { get; set; } + public string ProjectId { get; set; } + public string PipelineCode { get; set; } + public string WeldJointCode { get; set; } + public string WeldTypeCode { get; set; } + public string WeldingMethodCode { get; set; } + public DateTime? WeldingDate { get; set; } + public List History { get; set; } + } +} diff --git a/SGGL/Model/CLGL/Tw_ArrivalStatisticsOutPut.cs b/SGGL/Model/CLGL/Tw_ArrivalStatisticsOutPut.cs index 2ba8370e..82add49e 100644 --- a/SGGL/Model/CLGL/Tw_ArrivalStatisticsOutPut.cs +++ b/SGGL/Model/CLGL/Tw_ArrivalStatisticsOutPut.cs @@ -19,6 +19,7 @@ namespace Model public decimal StockNum { get; set; } public decimal NeedNum { get; set; } public decimal RealNum { get; set; } + public decimal OutputNum { get; set; } public decimal MatchRate { get; set; } public string MatchRateString { get; set; } } diff --git a/SGGL/Model/CLGL/Tw_PipeMatMatchOutput.cs b/SGGL/Model/CLGL/Tw_PipeMatMatchOutput.cs index e63bfefb..e7905f0b 100644 --- a/SGGL/Model/CLGL/Tw_PipeMatMatchOutput.cs +++ b/SGGL/Model/CLGL/Tw_PipeMatMatchOutput.cs @@ -52,7 +52,7 @@ namespace Model } /// - /// 单位工程下部分已焊接组件的导出汇总。 + /// 单位工程下组件导出汇总。 /// public class Tw_PartialWeldedComponentOutput { @@ -66,6 +66,12 @@ namespace Model public int TotalWeldJointCount { get; set; } public int WeldedWeldJointCount { get; set; } public int UnweldedWeldJointCount { get; set; } + /// 未焊焊口的达因量。 + public decimal? UnweldedDin { get; set; } + /// 组件材料编码,多个编码使用换行分隔。 + public string MaterialCode { get; set; } + /// 与材料编码按顺序对应的组件材料数量。 + public string MaterialQuantity { get; set; } public decimal? ComponentMatchRate { get; set; } public string ComponentMatchRateString { get; set; } } diff --git a/SGGL/Model/HJGL/HJGLQualityExtensions.cs b/SGGL/Model/HJGL/HJGLQualityExtensions.cs new file mode 100644 index 00000000..e0edbb5d --- /dev/null +++ b/SGGL/Model/HJGL/HJGLQualityExtensions.cs @@ -0,0 +1,105 @@ +using System; +using System.Data.Linq; +using System.Data.Linq.Mapping; + +namespace Model +{ + public partial class SGGLDB + { + public Table HJGL_PreWeldCuttingCheckMaterial + { + get { return GetTable(); } + } + + public Table HJGL_WeldAppearanceCheck + { + get { return GetTable(); } + } + } + + public partial class HJGL_PreWeldCuttingCheck + { + [Column(DbType = "Int NOT NULL")] + public int ReviewState { get; set; } + + [Column(DbType = "NVarChar(50)")] + public string SpecialReviewerId { get; set; } + + [Column(DbType = "NVarChar(50)")] + public string ReviewerId { get; set; } + + [Column(DbType = "DateTime")] + public DateTime? ReviewTime { get; set; } + } + + [Table(Name = "dbo.HJGL_PreWeldCuttingCheckMaterial")] + public class HJGL_PreWeldCuttingCheckMaterial + { + [Column(IsPrimaryKey = true, CanBeNull = false, DbType = "NVarChar(50) NOT NULL")] + public string CuttingCheckMaterialId { get; set; } + + [Column(CanBeNull = false, DbType = "NVarChar(50) NOT NULL")] + public string CuttingCheckId { get; set; } + + [Column(CanBeNull = false, DbType = "NVarChar(50) NOT NULL")] + public string PipeLineMatId { get; set; } + + [Column(DbType = "Int NOT NULL")] + public int MaterialSide { get; set; } + + [Column(DbType = "NVarChar(100)")] + public string OriginalMainCode { get; set; } + + [Column(DbType = "NVarChar(100)")] + public string ReportedMainCode { get; set; } + + [Column(DbType = "Bit NOT NULL")] + public bool IsBatchChanged { get; set; } + } + + [Table(Name = "dbo.HJGL_WeldAppearanceCheck")] + public class HJGL_WeldAppearanceCheck + { + [Column(IsPrimaryKey = true, CanBeNull = false, DbType = "NVarChar(50) NOT NULL")] + public string AppearanceCheckId { get; set; } + + [Column(CanBeNull = false, DbType = "NVarChar(50) NOT NULL")] + public string ProjectId { get; set; } + + [Column(CanBeNull = false, DbType = "NVarChar(50) NOT NULL")] + public string WeldJointId { get; set; } + + [Column(DbType = "Bit NOT NULL")] + public bool IsQualified { get; set; } + + [Column(CanBeNull = false, DbType = "NVarChar(50) NOT NULL")] + public string CheckPerson { get; set; } + + [Column(DbType = "DateTime NOT NULL")] + public DateTime CheckTime { get; set; } + + [Column(DbType = "NVarChar(500)")] + public string Remark { get; set; } + + [Column(DbType = "NVarChar(50)")] + public string CreateUser { get; set; } + + [Column(DbType = "DateTime NOT NULL")] + public DateTime CreateTime { get; set; } + + [Column(DbType = "NVarChar(50)")] + public string ModifyUser { get; set; } + + [Column(DbType = "DateTime")] + public DateTime? ModifyTime { get; set; } + } + + public partial class View_HJGL_WeldJoint + { + [Column(DbType = "Bit")] + public bool? WeldAppearanceIsQualified { get; set; } + + [Column(DbType = "NVarChar(10) NOT NULL", CanBeNull = false)] + public string WeldAppearanceResult { get; set; } + } +} diff --git a/SGGL/Model/Model.csproj b/SGGL/Model/Model.csproj index 4cb6a34b..f7998ed6 100644 --- a/SGGL/Model/Model.csproj +++ b/SGGL/Model/Model.csproj @@ -128,6 +128,7 @@ + @@ -280,6 +281,7 @@ + diff --git a/SGGL/WebAPI/Controllers/HJGL/WeldingManage/PreWeldCuttingCheckController.cs b/SGGL/WebAPI/Controllers/HJGL/WeldingManage/PreWeldCuttingCheckController.cs index 32082671..624088f9 100644 --- a/SGGL/WebAPI/Controllers/HJGL/WeldingManage/PreWeldCuttingCheckController.cs +++ b/SGGL/WebAPI/Controllers/HJGL/WeldingManage/PreWeldCuttingCheckController.cs @@ -47,5 +47,42 @@ namespace WebAPI.Controllers.HJGL.WeldingManage return responeData; } + + /// + /// 获取当前项目可选择的专项审核办理人。 + /// + public Model.ResponeData GetSpecialReviewers(string projectId) + { + var responeData = new Model.ResponeData(); + try + { + responeData.data = APIPreWeldInspectionService.GetSpecialReviewers(projectId); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + return responeData; + } + + /// + /// 办结下料抽检专项审核。 + /// + [HttpPost] + public Model.ResponeData ReviewRecord([FromBody] Model.PreWeldCuttingCheckReviewInput item) + { + var responeData = new Model.ResponeData(); + try + { + responeData.data = APIPreWeldInspectionService.ReviewCuttingCheck(item); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + return responeData; + } } } diff --git a/SGGL/WebAPI/Controllers/HJGL/WeldingManage/WeldAppearanceCheckController.cs b/SGGL/WebAPI/Controllers/HJGL/WeldingManage/WeldAppearanceCheckController.cs new file mode 100644 index 00000000..f67fb8e0 --- /dev/null +++ b/SGGL/WebAPI/Controllers/HJGL/WeldingManage/WeldAppearanceCheckController.cs @@ -0,0 +1,81 @@ +using BLL; +using System; +using System.Web.Http; + +namespace WebAPI.Controllers.HJGL.WeldingManage +{ + /// + /// 焊缝外观检测接口。 + /// + public class WeldAppearanceCheckController : ApiController + { + /// + /// 分页查询当前项目中已焊接的焊口。 + /// + /// 项目ID。 + /// 管线号查询条件。 + /// 焊口号查询条件。 + /// 页码,从0开始。 + /// 每页记录数。 + /// 已焊接焊口列表。 + public Model.ResponeData GetWeldedJoints(string projectId, string pipelineCode = "", string weldJointCode = "", int pageIndex = 0, int pageSize = 20) + { + var responeData = new Model.ResponeData(); + try + { + responeData.data = WeldAppearanceCheckService.GetWeldedJoints( + projectId, pipelineCode, weldJointCode, pageIndex, pageSize); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + + /// + /// 查询焊口基础信息及历史外观检测记录。 + /// + /// 焊口ID。 + /// 焊口详情及外观检测历史。 + public Model.ResponeData GetJointDetail(string weldJointId) + { + var responeData = new Model.ResponeData(); + try + { + responeData.data = WeldAppearanceCheckService.GetJointDetail(weldJointId); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + + /// + /// 保存焊缝外观检测记录。 + /// + /// 外观检测结果、检测人、检测时间及照片信息。 + /// 外观检测记录ID。 + [HttpPost] + public Model.ResponeData SaveRecord([FromBody] Model.WeldAppearanceCheckInput item) + { + var responeData = new Model.ResponeData(); + try + { + responeData.data = WeldAppearanceCheckService.Save(item); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + } +} diff --git a/SGGL/WebAPI/WebAPI.csproj b/SGGL/WebAPI/WebAPI.csproj index db27a6dd..70e338ab 100644 --- a/SGGL/WebAPI/WebAPI.csproj +++ b/SGGL/WebAPI/WebAPI.csproj @@ -216,6 +216,7 @@ +