diff --git a/DataBase/版本日志/SGGLDB_V2026-08-19-lpf.sql b/DataBase/版本日志/SGGLDB_V2026-08-19-lpf.sql new file mode 100644 index 00000000..f0866502 --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2026-08-19-lpf.sql @@ -0,0 +1,280 @@ +/* + SQL Server 2012 兼容脚本(数据库兼容级别 110)。 + 不使用 DROP IF EXISTS、STRING_AGG、STRING_SPLIT、CREATE OR ALTER 等 SQL Server 2012 之后新增的语法; + 错误重抛统一使用 RAISERROR。 +*/ +SET XACT_ABORT ON; + +BEGIN TRY +BEGIN TRANSACTION; + +DECLARE @Sql NVARCHAR(1000); + +/* 焊接任务单增加班组。 */ +IF COL_LENGTH('dbo.HJGL_WeldTask', 'TeamGroupId') IS NULL + ALTER TABLE dbo.HJGL_WeldTask ADD TeamGroupId NVARCHAR(50) NULL; + +/* 防腐委托改为关联任务单或热处理报告来源。 */ +IF COL_LENGTH('dbo.Tw_AntiCorrosionTrust', 'WeldTaskCode') IS NULL + ALTER TABLE dbo.Tw_AntiCorrosionTrust ADD WeldTaskCode NVARCHAR(200) NULL; + +IF COL_LENGTH('dbo.Tw_AntiCorrosionTrust', 'HotProessTrustId') IS NULL + ALTER TABLE dbo.Tw_AntiCorrosionTrust ADD HotProessTrustId NVARCHAR(50) NULL; + +/* + 新防腐委托仅使用焊接任务单或热处理委托作为来源。 + 旧来源列不再写入;该表尚无业务数据,无需迁移或回填旧来源。 +*/ +IF COL_LENGTH('dbo.Tw_AntiCorrosionTrust', 'OutputMasterId') IS NOT NULL + AND EXISTS + ( + SELECT 1 + FROM sys.columns + WHERE object_id = OBJECT_ID('dbo.Tw_AntiCorrosionTrust') + AND name = 'OutputMasterId' + AND is_nullable = 0 + ) + +DROP INDEX UX_Tw_AntiCorrosionTrust_OutputMasterId ON SGGLDB_SHJ.dbo.Tw_AntiCorrosionTrust; + + +BEGIN + ALTER TABLE dbo.Tw_AntiCorrosionTrust + ALTER COLUMN OutputMasterId NVARCHAR(50) NULL; +END; + +IF COL_LENGTH('dbo.Tw_AntiCorrosionTrustDetail', 'IsPostWeld') IS NULL +BEGIN + ALTER TABLE dbo.Tw_AntiCorrosionTrustDetail + ADD IsPostWeld BIT NOT NULL + CONSTRAINT DF_Tw_AntiCorrosionTrustDetail_IsPostWeld DEFAULT (0); +END; + +/* 下料检测增加坡口加工类型。 */ +IF COL_LENGTH('dbo.HJGL_PreWeldCuttingCheck', 'GrooveProcessType') IS NULL + ALTER TABLE dbo.HJGL_PreWeldCuttingCheck ADD GrooveProcessType NVARCHAR(100) NULL; + +/* 焊缝外观检测承接原组对记录中不属于组对工序的字段。 */ +IF COL_LENGTH('dbo.HJGL_WeldAppearanceCheck', 'WeldReinforcement') IS NULL + ALTER TABLE dbo.HJGL_WeldAppearanceCheck ADD WeldReinforcement DECIMAL(18,2) NULL; +IF COL_LENGTH('dbo.HJGL_WeldAppearanceCheck', 'WeldHeight') IS NULL + ALTER TABLE dbo.HJGL_WeldAppearanceCheck ADD WeldHeight DECIMAL(18,2) NULL; +IF COL_LENGTH('dbo.HJGL_WeldAppearanceCheck', 'WeldWidth') IS NULL + ALTER TABLE dbo.HJGL_WeldAppearanceCheck ADD WeldWidth DECIMAL(18,2) NULL; +IF COL_LENGTH('dbo.HJGL_WeldAppearanceCheck', 'SurfaceDefect') IS NULL + ALTER TABLE dbo.HJGL_WeldAppearanceCheck ADD SurfaceDefect NVARCHAR(500) NULL; +IF COL_LENGTH('dbo.HJGL_WeldAppearanceCheck', 'PreheatTemperature') IS NULL + ALTER TABLE dbo.HJGL_WeldAppearanceCheck ADD PreheatTemperature DECIMAL(18,2) NULL; +IF COL_LENGTH('dbo.HJGL_WeldAppearanceCheck', 'InterpassTemperature') IS NULL + ALTER TABLE dbo.HJGL_WeldAppearanceCheck ADD InterpassTemperature DECIMAL(18,2) NULL; +IF COL_LENGTH('dbo.HJGL_WeldAppearanceCheck', 'CheckCode') IS NULL + ALTER TABLE dbo.HJGL_WeldAppearanceCheck ADD CheckCode NVARCHAR(200) NULL; + +/* 焊接日报增加班组、专工两级审核留痕。 */ +IF COL_LENGTH('dbo.HJGL_WeldingDailyTempDetail', 'TeamAuditMan') IS NULL + ALTER TABLE dbo.HJGL_WeldingDailyTempDetail ADD TeamAuditMan NVARCHAR(50) NULL; +IF COL_LENGTH('dbo.HJGL_WeldingDailyTempDetail', 'TeamAuditDate') IS NULL + ALTER TABLE dbo.HJGL_WeldingDailyTempDetail ADD TeamAuditDate DATETIME NULL; +IF COL_LENGTH('dbo.HJGL_WeldingDailyTempDetail', 'ProfessionalAuditMan') IS NULL + ALTER TABLE dbo.HJGL_WeldingDailyTempDetail ADD ProfessionalAuditMan NVARCHAR(50) NULL; +IF COL_LENGTH('dbo.HJGL_WeldingDailyTempDetail', 'ProfessionalAuditDate') IS NULL + ALTER TABLE dbo.HJGL_WeldingDailyTempDetail ADD ProfessionalAuditDate DATETIME NULL; + +/* 焊接日报待审核阶段保存实际工艺快照,专工审核后再回写焊口。 */ +IF COL_LENGTH('dbo.HJGL_WeldingDailyTempDetail', 'WeldingMethodId') IS NULL + ALTER TABLE dbo.HJGL_WeldingDailyTempDetail ADD WeldingMethodId NVARCHAR(50) NULL; +IF COL_LENGTH('dbo.HJGL_WeldingDailyTempDetail', 'WeldTypeId') IS NULL + ALTER TABLE dbo.HJGL_WeldingDailyTempDetail ADD WeldTypeId NVARCHAR(50) NULL; +IF COL_LENGTH('dbo.HJGL_WeldingDailyTempDetail', 'WeldingWire') IS NULL + ALTER TABLE dbo.HJGL_WeldingDailyTempDetail ADD WeldingWire NVARCHAR(50) NULL; +IF COL_LENGTH('dbo.HJGL_WeldingDailyTempDetail', 'WeldingRod') IS NULL + ALTER TABLE dbo.HJGL_WeldingDailyTempDetail ADD WeldingRod NVARCHAR(50) NULL; + +/* 历史待审核记录按焊口当前工艺值补齐,保证升级后查询和审核行为一致。 */ +SET @Sql = N' +UPDATE temp + SET WeldingMethodId = COALESCE(temp.WeldingMethodId, joint.WeldingMethodId), + WeldTypeId = COALESCE(temp.WeldTypeId, joint.WeldTypeId), + WeldingWire = COALESCE(temp.WeldingWire, joint.WeldingWire), + WeldingRod = COALESCE(temp.WeldingRod, joint.WeldingRod) + FROM dbo.HJGL_WeldingDailyTempDetail temp + INNER JOIN dbo.HJGL_WeldJoint joint ON joint.WeldJointId = temp.WeldJointId + WHERE temp.WeldingMethodId IS NULL + OR temp.WeldTypeId IS NULL + OR temp.WeldingWire IS NULL + OR temp.WeldingRod IS NULL;'; +EXEC sys.sp_executesql @Sql; + +/* + 为本次新增字段补充数据库注释。 + 字段已存在时更新 MS_Description,不存在注释时新增,确保升级脚本可重复执行。 +*/ +DECLARE @ColumnComments TABLE +( + TableName SYSNAME NOT NULL, + ColumnName SYSNAME NOT NULL, + ColumnDescription NVARCHAR(500) NOT NULL, + SortIndex INT NOT NULL +); + +INSERT INTO @ColumnComments (TableName, ColumnName, ColumnDescription, SortIndex) +SELECT N'HJGL_WeldTask', N'TeamGroupId', N'班组ID', 1 UNION ALL +SELECT N'Tw_AntiCorrosionTrust', N'WeldTaskCode', N'来源焊接任务单编码', 2 UNION ALL +SELECT N'Tw_AntiCorrosionTrust', N'HotProessTrustId', N'来源热处理委托ID', 3 UNION ALL +SELECT N'Tw_AntiCorrosionTrustDetail', N'IsPostWeld', N'是否焊后防腐:0-否,1-是', 4 UNION ALL +SELECT N'HJGL_PreWeldCuttingCheck', N'GrooveProcessType', N'坡口加工类型', 5 UNION ALL +SELECT N'HJGL_WeldAppearanceCheck', N'WeldReinforcement', N'焊缝余高', 6 UNION ALL +SELECT N'HJGL_WeldAppearanceCheck', N'WeldHeight', N'焊缝高度', 7 UNION ALL +SELECT N'HJGL_WeldAppearanceCheck', N'WeldWidth', N'焊缝宽度', 8 UNION ALL +SELECT N'HJGL_WeldAppearanceCheck', N'SurfaceDefect', N'表面缺陷', 9 UNION ALL +SELECT N'HJGL_WeldAppearanceCheck', N'PreheatTemperature', N'预热温度', 10 UNION ALL +SELECT N'HJGL_WeldAppearanceCheck', N'InterpassTemperature', N'层间温度', 11 UNION ALL +SELECT N'HJGL_WeldingDailyTempDetail', N'TeamAuditMan', N'班组审核人ID', 12 UNION ALL +SELECT N'HJGL_WeldingDailyTempDetail', N'TeamAuditDate', N'班组审核时间', 13 UNION ALL +SELECT N'HJGL_WeldingDailyTempDetail', N'ProfessionalAuditMan', N'专工审核人ID', 14 UNION ALL +SELECT N'HJGL_WeldingDailyTempDetail', N'ProfessionalAuditDate', N'专工审核时间', 15 UNION ALL +SELECT N'HJGL_WeldingDailyTempDetail', N'WeldingMethodId', N'待审核焊接方法ID,专工审核后回写焊口', 16 UNION ALL +SELECT N'HJGL_WeldingDailyTempDetail', N'WeldTypeId', N'待审核焊缝类型ID,专工审核后回写焊口', 17 UNION ALL +SELECT N'HJGL_WeldingDailyTempDetail', N'WeldingWire', N'待审核焊丝ID,专工审核后回写焊口', 18 UNION ALL +SELECT N'HJGL_WeldingDailyTempDetail', N'WeldingRod', N'待审核焊条ID,专工审核后回写焊口', 19 UNION ALL +SELECT N'HJGL_WeldAppearanceCheck', N'CheckCode', N'焊缝外观检测编号,格式:FCC-单位工程名称-yyyyMMdd', 20; + +DECLARE @CommentTableName SYSNAME; +DECLARE @CommentColumnName SYSNAME; +DECLARE @ColumnDescription NVARCHAR(500); + +DECLARE ColumnComments CURSOR LOCAL FAST_FORWARD FOR + SELECT TableName, ColumnName, ColumnDescription + FROM @ColumnComments + ORDER BY SortIndex; +OPEN ColumnComments; +FETCH NEXT FROM ColumnComments INTO @CommentTableName, @CommentColumnName, @ColumnDescription; +WHILE @@FETCH_STATUS = 0 +BEGIN + IF COL_LENGTH(N'dbo.' + @CommentTableName, @CommentColumnName) IS NOT NULL + BEGIN + IF EXISTS + ( + SELECT 1 + FROM sys.extended_properties ep + INNER JOIN sys.columns c + ON c.object_id = ep.major_id + AND c.column_id = ep.minor_id + WHERE ep.class = 1 + AND ep.name = N'MS_Description' + AND ep.major_id = OBJECT_ID(N'dbo.' + @CommentTableName) + AND c.name = @CommentColumnName + ) + BEGIN + EXEC sys.sp_updateextendedproperty + @name = N'MS_Description', + @value = @ColumnDescription, + @level0type = N'SCHEMA', @level0name = N'dbo', + @level1type = N'TABLE', @level1name = @CommentTableName, + @level2type = N'COLUMN', @level2name = @CommentColumnName; + END + ELSE + BEGIN + EXEC sys.sp_addextendedproperty + @name = N'MS_Description', + @value = @ColumnDescription, + @level0type = N'SCHEMA', @level0name = N'dbo', + @level1type = N'TABLE', @level1name = @CommentTableName, + @level2type = N'COLUMN', @level2name = @CommentColumnName; + END; + END; + + FETCH NEXT FROM ColumnComments INTO @CommentTableName, @CommentColumnName, @ColumnDescription; +END; +CLOSE ColumnComments; +DEALLOCATE ColumnComments; + +/* 原有已审核记录直接视为两级审核完成,旧审核信息回填到专工审核。 */ +UPDATE dbo.HJGL_WeldingDailyTempDetail + SET AuditState = 2, + ProfessionalAuditMan = COALESCE(ProfessionalAuditMan, AuditMan), + ProfessionalAuditDate = COALESCE(ProfessionalAuditDate, AuditDate) + WHERE AuditState = 1; + +/* 组对记录只保留组对工序字段。 */ +IF EXISTS (SELECT 1 FROM sys.foreign_keys WHERE parent_object_id = OBJECT_ID('dbo.HJGL_PreWeldFitupCheck') AND name = 'FK_PreWeldFitupCheck_GrooveType') + ALTER TABLE dbo.HJGL_PreWeldFitupCheck DROP CONSTRAINT FK_PreWeldFitupCheck_GrooveType; + +DECLARE @FitupColumn SYSNAME; +DECLARE @FitupIndex SYSNAME; +DECLARE @DefaultConstraint SYSNAME; +DECLARE @FitupColumns TABLE +( + ColumnName SYSNAME NOT NULL, + SortIndex INT NOT NULL +); + +/* 使用 SQL Server 2012 支持的 UNION ALL 初始化待删除字段,避免依赖高版本语法。 */ +INSERT INTO @FitupColumns (ColumnName, SortIndex) +SELECT N'GrooveTypeId', 1 UNION ALL +SELECT N'GrooveProcessType', 2 UNION ALL +SELECT N'GrooveAngle', 3 UNION ALL +SELECT N'WeldReinforcement', 4 UNION ALL +SELECT N'WeldHeight', 5 UNION ALL +SELECT N'WeldWidth', 6 UNION ALL +SELECT N'SurfaceDefect', 7; + +DECLARE FitupColumns CURSOR LOCAL FAST_FORWARD FOR + SELECT ColumnName + FROM @FitupColumns + ORDER BY SortIndex; +OPEN FitupColumns; +FETCH NEXT FROM FitupColumns INTO @FitupColumn; +WHILE @@FETCH_STATUS = 0 +BEGIN + IF COL_LENGTH('dbo.HJGL_PreWeldFitupCheck', @FitupColumn) IS NOT NULL + BEGIN + WHILE 1 = 1 + BEGIN + SET @FitupIndex = NULL; + SELECT TOP (1) @FitupIndex = i.name + FROM sys.indexes i + INNER JOIN sys.index_columns ic ON ic.object_id = i.object_id AND ic.index_id = i.index_id + INNER JOIN sys.columns c ON c.object_id = ic.object_id AND c.column_id = ic.column_id + WHERE i.object_id = OBJECT_ID('dbo.HJGL_PreWeldFitupCheck') AND c.name = @FitupColumn + AND i.is_primary_key = 0 AND i.is_unique_constraint = 0; + IF @FitupIndex IS NULL BREAK; + SET @Sql = N'DROP INDEX ' + QUOTENAME(@FitupIndex) + N' ON dbo.HJGL_PreWeldFitupCheck'; + EXEC sys.sp_executesql @Sql; + END; + + SET @DefaultConstraint = NULL; + SELECT @DefaultConstraint = dc.name + FROM sys.default_constraints dc + INNER JOIN sys.columns c ON c.object_id = dc.parent_object_id AND c.column_id = dc.parent_column_id + WHERE dc.parent_object_id = OBJECT_ID('dbo.HJGL_PreWeldFitupCheck') AND c.name = @FitupColumn; + IF @DefaultConstraint IS NOT NULL + BEGIN + SET @Sql = N'ALTER TABLE dbo.HJGL_PreWeldFitupCheck DROP CONSTRAINT ' + QUOTENAME(@DefaultConstraint); + EXEC sys.sp_executesql @Sql; + END; + SET @Sql = N'ALTER TABLE dbo.HJGL_PreWeldFitupCheck DROP COLUMN ' + QUOTENAME(@FitupColumn); + EXEC sys.sp_executesql @Sql; + END; + FETCH NEXT FROM FitupColumns INTO @FitupColumn; +END; +CLOSE FitupColumns; +DEALLOCATE FitupColumns; + +COMMIT TRANSACTION; +END TRY +BEGIN CATCH + IF XACT_STATE() <> 0 + ROLLBACK TRANSACTION; + + DECLARE @ErrorMessage NVARCHAR(4000); + DECLARE @ErrorSeverity INT; + DECLARE @ErrorState INT; + + SELECT @ErrorMessage = ERROR_MESSAGE(), + @ErrorSeverity = ERROR_SEVERITY(), + @ErrorState = ERROR_STATE(); + + /* SQL Server 2012 使用 RAISERROR 重新抛出原始错误。 */ + RAISERROR(@ErrorMessage, @ErrorSeverity, @ErrorState); +END CATCH; diff --git a/SGGL/BLL/API/APIBaseInfoService.cs b/SGGL/BLL/API/APIBaseInfoService.cs index 9c364864..a5f5ede4 100644 --- a/SGGL/BLL/API/APIBaseInfoService.cs +++ b/SGGL/BLL/API/APIBaseInfoService.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; namespace BLL @@ -209,6 +210,36 @@ namespace BLL } } + /// + /// 按焊材类型获取焊接耗材,1为焊丝,2为焊条。 + /// + /// 焊材类型:1焊丝,2焊条 + /// 焊接耗材基础项 + public static List GetWeldingConsumables(string consumablesType) + { + if (consumablesType != "1" && consumablesType != "2") + { + throw new ArgumentException("焊材类型只能为1(焊丝)或2(焊条)"); + } + + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + // 与PC端焊材下拉框保持一致:ID作为值,名称作为显示文本,并按名称排序。 + return db.Base_Consumables + .Where(x => x.ConsumablesType == consumablesType) + .OrderBy(x => x.ConsumablesName) + .ThenBy(x => x.ConsumablesCode) + .ThenBy(x => x.ConsumablesId) + .Select(x => new Model.BaseInfoItem + { + BaseInfoId = x.ConsumablesId, + BaseInfoCode = x.ConsumablesCode, + BaseInfoName = x.ConsumablesName, + Remark = x.Remark + }).ToList(); + } + } + /// /// 获取探伤类型 /// @@ -1016,5 +1047,32 @@ namespace BLL } #endregion + /// + /// 按条码关键字查询入库条码明细。空关键字不返回全表数据。 + /// + public static Tuple, int> GetInputDetailBarCodes( + string barCodeKeyword, int pageIndex, int pageSize) + { + if (string.IsNullOrWhiteSpace(barCodeKeyword)) + { + return Tuple.Create(new List(), 0); + } + + string keyword = barCodeKeyword.Trim(); + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var query = db.Tw_InputDetailBarCode + .Where(x => x.BarCode != null && x.BarCode.Contains(keyword)); + int totalCount = query.Count(); + var data = query + .OrderBy(x => x.BarCode) + .ThenBy(x => x.Id) + .Skip((pageIndex - 1) * pageSize) + .Take(pageSize) + .ToList(); + return Tuple.Create(data, totalCount); + } + } + } } diff --git a/SGGL/BLL/API/APIPersonService.cs b/SGGL/BLL/API/APIPersonService.cs index 276579bd..c5f7130a 100644 --- a/SGGL/BLL/API/APIPersonService.cs +++ b/SGGL/BLL/API/APIPersonService.cs @@ -20,6 +20,8 @@ namespace BLL { var getUser = from x in db.SitePerson_Person join y in db.Person_Persons on x.IdentityCard equals y.IdentityCard + join team in db.ProjectData_TeamGroup on x.TeamGroupId equals team.TeamGroupId into teamGroup + from team in teamGroup.DefaultIfEmpty() where (y.Telephone == userInfo.Account || x.PersonName == userInfo.Account) && (y.Password == Funs.EncryptionPassword(userInfo.Password) || (x.IdentityCard != null && x.IdentityCard.Substring(x.IdentityCard.Length - 4) == userInfo.Password)) @@ -35,6 +37,8 @@ namespace BLL IdentityCard = x.IdentityCard, Account = y.Telephone, UnitName = db.Base_Unit.First(u => u.UnitId == x.UnitId).UnitName, + TeamGroupId = x.TeamGroupId, + TeamGroupName = team == null ? string.Empty : team.TeamGroupName, LoginProjectName = db.Base_Project.First(u => u.ProjectId == x.ProjectId).ProjectName, Telephone = y.Telephone, WorkPostId = x.WorkPostId, @@ -1626,4 +1630,4 @@ namespace BLL } } -} \ No newline at end of file +} diff --git a/SGGL/BLL/API/APIUserService.cs b/SGGL/BLL/API/APIUserService.cs index 7ece0536..438aa8e0 100644 --- a/SGGL/BLL/API/APIUserService.cs +++ b/SGGL/BLL/API/APIUserService.cs @@ -55,6 +55,15 @@ namespace BLL newItem.LoginProjectId = getSitePerson.ProjectId; } } + // 班组归属随项目变化,登录时必须按当前登录项目读取项目人员关系,不能直接使用人员主表信息。 + var loginSitePerson = db.SitePerson_Person.FirstOrDefault(x => x.PersonId == getUser.PersonId + && x.ProjectId == newItem.LoginProjectId && x.States == Const.ProjectPersonStates_1); + if (loginSitePerson != null) + { + newItem.TeamGroupId = loginSitePerson.TeamGroupId; + var teamGroup = db.ProjectData_TeamGroup.FirstOrDefault(x => x.TeamGroupId == loginSitePerson.TeamGroupId); + newItem.TeamGroupName = teamGroup == null ? string.Empty : teamGroup.TeamGroupName; + } newItem.LoginProjectName = ProjectService.GetProjectNameByProjectId(newItem.LoginProjectId); return newItem; } diff --git a/SGGL/BLL/API/HJGL/APIPipeJointService.cs b/SGGL/BLL/API/HJGL/APIPipeJointService.cs index 39478ac5..253af29c 100644 --- a/SGGL/BLL/API/HJGL/APIPipeJointService.cs +++ b/SGGL/BLL/API/HJGL/APIPipeJointService.cs @@ -151,6 +151,46 @@ namespace BLL } } + /// + /// 分页查询当前项目的全部焊口,不限制是否已生成焊接日报。 + /// + /// 项目ID + /// 管线号查询条件 + /// 焊口号查询条件 + /// 页码,从0开始 + /// 每页记录数 + /// 焊口列表 + public static List GetAllWeldJoints(string projectId, + string pipelineCode, string weldJointCode, int pageIndex, int pageSize) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + // 管线焊口选择需要包含未焊接焊口,因此不按 WeldingDailyId 过滤。 + var query = db.View_HJGL_WeldJoint.Where(x => x.ProjectId == projectId); + 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(); + } + } + #endregion 根据管线ID获取所有焊口信息 #region 获取焊工列表 diff --git a/SGGL/BLL/API/HJGL/APIPreWeldInspectionService.cs b/SGGL/BLL/API/HJGL/APIPreWeldInspectionService.cs index 93b8d734..c20bb432 100644 --- a/SGGL/BLL/API/HJGL/APIPreWeldInspectionService.cs +++ b/SGGL/BLL/API/HJGL/APIPreWeldInspectionService.cs @@ -91,8 +91,6 @@ namespace BLL { var data = (from f in db.HJGL_PreWeldFitupCheck join w in db.HJGL_WeldJoint on f.WeldJointId equals w.WeldJointId - join g in db.Base_GrooveType on f.GrooveTypeId equals g.GrooveTypeId into grooveTypes - from g in grooveTypes.DefaultIfEmpty() join p in db.Person_Persons on f.CheckPerson equals p.PersonId into persons from p in persons.DefaultIfEmpty() where f.WeldJointId == weldJointId @@ -104,17 +102,8 @@ namespace BLL WeldJointId = f.WeldJointId, PipelineCode = w.PipelineCode, WeldJointCode = w.WeldJointCode, - GrooveTypeId = f.GrooveTypeId, - GrooveTypeCode = g == null ? string.Empty : g.GrooveTypeCode, - GrooveTypeName = g == null ? string.Empty : g.GrooveTypeName, - GrooveProcessType = f.GrooveProcessType, - GrooveAngle = f.GrooveAngle, FitupGap = f.FitupGap, Misalignment = f.Misalignment, - WeldReinforcement = f.WeldReinforcement, - WeldHeight = f.WeldHeight, - WeldWidth = f.WeldWidth, - SurfaceDefect = f.SurfaceDefect, CheckPerson = f.CheckPerson, CheckPersonName = p == null ? string.Empty : p.PersonName, CheckTime = f.CheckTime, @@ -135,7 +124,7 @@ namespace BLL } /// - /// 按材料编码获取防腐检查记录 + /// 按入库条码获取材料信息及防腐检查记录 /// public static List GetAntiCorrosionChecksByMaterialCode(string barCode, string projectId) { diff --git a/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs b/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs index 4c424a84..74e2670d 100644 --- a/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs +++ b/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs @@ -296,7 +296,9 @@ namespace BLL newItem.weldingLocation, newItem.welderType, newItem.WeldingMethodId, - newItem.WeldTypeId); + newItem.WeldTypeId, + newItem.WeldingWire, + newItem.WeldingRod); if (!string.IsNullOrEmpty(res)) { return res; diff --git a/SGGL/BLL/API/HJGL/APIWeldReportService.cs b/SGGL/BLL/API/HJGL/APIWeldReportService.cs index b5dfc4af..7076594b 100644 --- a/SGGL/BLL/API/HJGL/APIWeldReportService.cs +++ b/SGGL/BLL/API/HJGL/APIWeldReportService.cs @@ -8,9 +8,6 @@ namespace BLL /// public static class APIWeldReportService { - /// - /// 获取焊接日报待审核列表。 - /// public static List GetPendingWeldingDailyTempDetailList( string projectId, string unitWorkId, string weldingDate, string pipelineCode, string welderCode) { @@ -18,26 +15,21 @@ namespace BLL ParseWeldingDate(weldingDate), pipelineCode, welderCode); } - /// - /// 查看单条焊接日报待审核明细。 - /// public static Model.WeldingDailyTempDetailItem GetPendingWeldingDailyTempDetail(string tempDetailId) { return WeldingDailyService.GetWeldingDailyTempDetailById(tempDetailId); } - /// - /// 批量审核通过焊接日报待审核明细。 - /// + public static string TeamAuditPendingWeldingDailyTempDetails(string[] tempDetailIds, string auditMan) + { + return WeldingDailyService.TeamAuditWeldingDailyTempDetails(tempDetailIds, auditMan); + } + public static string AuditPendingWeldingDailyTempDetails(string[] tempDetailIds, string auditMan) { - // 审核规则、建日报、组批及状态回写统一由PC端已经使用的公共服务处理。 return WeldingDailyService.AuditWeldingDailyTempDetails(tempDetailIds, auditMan); } - /// - /// 批量删除焊接日报待审核明细。 - /// public static string DeletePendingWeldingDailyTempDetails(string[] tempDetailIds) { return WeldingDailyService.DeleteWeldingDailyTempDetails(tempDetailIds); @@ -45,17 +37,13 @@ namespace BLL private static DateTime? ParseWeldingDate(string weldingDate) { - if (string.IsNullOrWhiteSpace(weldingDate)) - { - return null; - } + if (string.IsNullOrWhiteSpace(weldingDate)) return null; DateTime parsedDate; if (!DateTime.TryParse(weldingDate, out parsedDate)) { throw new ArgumentException("焊接日期格式不正确"); } - return parsedDate.Date; } } diff --git a/SGGL/BLL/BLL.csproj b/SGGL/BLL/BLL.csproj index c2182d63..5d35c895 100644 --- a/SGGL/BLL/BLL.csproj +++ b/SGGL/BLL/BLL.csproj @@ -920,4 +920,4 @@ --> - + \ No newline at end of file diff --git a/SGGL/BLL/CLGL/TwAntiCorrosionTrustService.cs b/SGGL/BLL/CLGL/TwAntiCorrosionTrustService.cs index 5ebf0b2f..0caced4a 100644 --- a/SGGL/BLL/CLGL/TwAntiCorrosionTrustService.cs +++ b/SGGL/BLL/CLGL/TwAntiCorrosionTrustService.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Data; using System.Linq; +using System.Transactions; namespace BLL { @@ -16,38 +17,58 @@ namespace BLL public static List GetListData(AntiCorrosionTrustOutput filter) { - var query = from t in Funs.DB.Tw_AntiCorrosionTrust - join uw in Funs.DB.WBS_UnitWork on t.UnitWorkId equals uw.UnitWorkId into uwJoin - from uw in uwJoin.DefaultIfEmpty() - join om in Funs.DB.Tw_OutputMaster on t.OutputMasterId equals om.Id into omJoin - from om in omJoin.DefaultIfEmpty() - join p in Funs.DB.Person_Persons on t.CreateMan equals p.PersonId into pJoin - from p in pJoin.DefaultIfEmpty() + filter = filter ?? new AntiCorrosionTrustOutput(); + var data = (from t in Funs.DB.Tw_AntiCorrosionTrust + join uw in Funs.DB.WBS_UnitWork on t.UnitWorkId equals uw.UnitWorkId into unitWorks + from uw in unitWorks.DefaultIfEmpty() + join p in Funs.DB.Person_Persons on t.CreateMan equals p.PersonId into persons + from p in persons.DefaultIfEmpty() where (string.IsNullOrEmpty(filter.Id) || t.Id == filter.Id) && (string.IsNullOrEmpty(filter.ProjectId) || t.ProjectId == filter.ProjectId) && (string.IsNullOrEmpty(filter.UnitWorkId) || t.UnitWorkId == filter.UnitWorkId) && (string.IsNullOrEmpty(filter.TrustCode) || t.TrustCode.Contains(filter.TrustCode)) - && (string.IsNullOrEmpty(filter.OutputMasterCode) || om.CusBillCode.Contains(filter.OutputMasterCode)) + && (string.IsNullOrEmpty(filter.WeldTaskCode) || t.WeldTaskCode.Contains(filter.WeldTaskCode)) orderby t.CreateDate descending, t.TrustCode descending select new AntiCorrosionTrustOutput { Id = t.Id, ProjectId = t.ProjectId, UnitWorkId = t.UnitWorkId, - UnitWorkName = uw.UnitWorkName, + UnitWorkName = uw == null ? string.Empty : uw.UnitWorkName, ConstructionPart = t.ConstructionPart, ConstructionProfessional = t.ConstructionProfessional, TrustCode = t.TrustCode, - OutputMasterId = t.OutputMasterId, - OutputMasterCode = om.CusBillCode, + WeldTaskCode = t.WeldTaskCode, + HotProessTrustId = t.HotProessTrustId, + OutputMasterCode = string.Empty, DemandDate = t.DemandDate, CompleteDate = t.CompleteDate, CreateMan = t.CreateMan, - CreateManName = p.PersonName, + CreateManName = p == null ? string.Empty : p.PersonName, CreateDate = t.CreateDate, Remark = t.Remark - }; - return query.ToList(); + }).ToList(); + + var taskCodes = data.Select(x => x.WeldTaskCode).Where(x => !string.IsNullOrEmpty(x)).Distinct().ToList(); + var taskTeams = Funs.DB.HJGL_WeldTask + .Where(x => taskCodes.Contains(x.TaskCode)) + .Select(x => new { x.ProjectId, x.TaskCode, x.TeamGroupId }) + .ToList() + .GroupBy(x => x.ProjectId + "|" + x.TaskCode) + .ToDictionary(x => x.Key, x => x.Select(y => y.TeamGroupId).FirstOrDefault(y => !string.IsNullOrEmpty(y))); + var teamIds = taskTeams.Values.Where(x => !string.IsNullOrEmpty(x)).Distinct().ToList(); + var teamNames = Funs.DB.ProjectData_TeamGroup.Where(x => teamIds.Contains(x.TeamGroupId)) + .ToDictionary(x => x.TeamGroupId, x => x.TeamGroupName); + foreach (var item in data.Where(x => !string.IsNullOrEmpty(x.WeldTaskCode))) + { + string teamId; + if (taskTeams.TryGetValue(item.ProjectId + "|" + item.WeldTaskCode, out teamId)) + { + item.TeamGroupId = teamId; + item.TeamGroupName = !string.IsNullOrEmpty(teamId) && teamNames.ContainsKey(teamId) ? teamNames[teamId] : string.Empty; + } + } + return data; } public static IEnumerable GetListData(AntiCorrosionTrustOutput filter, Grid grid) @@ -59,206 +80,153 @@ namespace BLL public static AntiCorrosionTrustOutput GetById(string id) { - if (string.IsNullOrEmpty(id)) - { - return null; - } - - return GetListData(new AntiCorrosionTrustOutput { Id = id }) - .FirstOrDefault(x => x.Id == id); + return string.IsNullOrEmpty(id) ? null : GetListData(new AntiCorrosionTrustOutput { Id = id }).FirstOrDefault(); } public static bool IsExistTrustCode(string trustCode, string id, string projectId) { - return Funs.DB.Tw_AntiCorrosionTrust.Any(x => x.TrustCode == trustCode - && x.ProjectId == projectId + return Funs.DB.Tw_AntiCorrosionTrust.Any(x => x.TrustCode == trustCode && x.ProjectId == projectId && (string.IsNullOrEmpty(id) || x.Id != id)); } public static string GenerateTrustCode(string unitWorkId) { var unitWork = UnitWorkService.GetUnitWorkByUnitWorkId(unitWorkId); - if (unitWork == null) - { - return string.Empty; - } - - var prefix = "SXHJ-ECFF-" + unitWork.UnitWorkName + "-"; - var maxSerial = Funs.DB.Tw_AntiCorrosionTrust - .Where(x => x.UnitWorkId == unitWorkId && x.TrustCode.StartsWith(prefix)) - .Select(x => x.TrustCode) - .ToList() - .Select(x => GetTrustCodeSerial(x)) - .DefaultIfEmpty(0) - .Max(); - + if (unitWork == null) return string.Empty; + string prefix = "SXHJ-ECFF-" + unitWork.UnitWorkName + "-"; + // 生成按钮和拆单均在事务中调用;锁定同一单位工程编号范围,避免并发取到相同流水号。 + var trustCodes = Funs.DB.ExecuteQuery( + "SELECT TrustCode FROM dbo.Tw_AntiCorrosionTrust WITH (UPDLOCK,HOLDLOCK) WHERE UnitWorkId={0}", + unitWorkId).ToList(); + int maxSerial = trustCodes.Where(x => x != null && x.StartsWith(prefix)) + .Select(GetTrustCodeSerial).DefaultIfEmpty(0).Max(); return prefix + (maxSerial + 1).ToString("000"); } - public static List GetAvailableOutputMasters(string projectId, string unitWorkId, string currentTrustId) + public static List GetAvailableWeldTasks(string projectId, string unitWorkId, string currentTrustId) { - var usedOutputIds = Funs.DB.Tw_AntiCorrosionTrust - .Where(x => x.ProjectId == projectId && (string.IsNullOrEmpty(currentTrustId) || x.Id != currentTrustId)) - .Select(x => x.OutputMasterId) - .ToList(); - - var query = from om in Funs.DB.Tw_OutputMaster - join plan in Funs.DB.Tw_InOutPlanMaster on om.InOutPlanMasterId equals plan.Id into planJoin - from plan in planJoin.DefaultIfEmpty() - join createPerson in Funs.DB.Person_Persons on om.CreateMan equals createPerson.PersonId into createJoin - from createPerson in createJoin.DefaultIfEmpty() - join reqUnit in Funs.DB.Base_Unit on om.ReqUnitId equals reqUnit.UnitId into unitJoin - from reqUnit in unitJoin.DefaultIfEmpty() - where om.ProjectId == projectId - && !usedOutputIds.Contains(om.Id) - && (string.IsNullOrEmpty(unitWorkId) || (plan.WeldTaskId != null && plan.WeldTaskId.Contains(unitWorkId))) - orderby om.CreateDate descending, om.CusBillCode descending - select new Tw_InOutMasterOutput - { - Id = om.Id, - ProjectId = om.ProjectId, - CusBillCode = om.CusBillCode, - InOutPlanMasterId = om.InOutPlanMasterId, - WarehouseId = om.WarehouseId, - WarehouseCode = om.WarehouseCode, - WarehouseName = om.WarehouseCode, - Source = om.Source, - TypeInt = om.TypeInt, - State = om.State, - CreateMan = om.CreateMan, - CreateManName = createPerson.PersonName, - CreateDate = om.CreateDate, - ReqUnitId = om.ReqUnitId, - ReqUnitName = reqUnit.UnitName, - Category = om.Category, - AuditMan = om.AuditMan, - AuditDate = om.AuditDate, - AuditMan2 = om.AuditMan2, - AuditDate2 = om.AuditDate2, - WarehouseMan = om.WarehouseMan, - WarehouseDate = om.WarehouseDate, - WeldTaskId = plan.WeldTaskId, - Remark = plan.Remark - }; - return query.ToList(); - } - - public static Tw_InOutMasterOutput GetOutputMasterById(string id) - { - if (string.IsNullOrEmpty(id)) - { - return null; - } - - var query = from om in Funs.DB.Tw_OutputMaster - join plan in Funs.DB.Tw_InOutPlanMaster on om.InOutPlanMasterId equals plan.Id into planJoin - from plan in planJoin.DefaultIfEmpty() - join reqUnit in Funs.DB.Base_Unit on om.ReqUnitId equals reqUnit.UnitId into unitJoin - from reqUnit in unitJoin.DefaultIfEmpty() - where om.Id == id - select new Tw_InOutMasterOutput - { - Id = om.Id, - ProjectId = om.ProjectId, - CusBillCode = om.CusBillCode, - InOutPlanMasterId = om.InOutPlanMasterId, - WarehouseId = om.WarehouseId, - WarehouseCode = om.WarehouseCode, - WarehouseName = om.WarehouseCode, - Source = om.Source, - TypeInt = om.TypeInt, - State = om.State, - CreateMan = om.CreateMan, - CreateDate = om.CreateDate, - ReqUnitId = om.ReqUnitId, - ReqUnitName = reqUnit.UnitName, - Category = om.Category, - AuditMan = om.AuditMan, - AuditDate = om.AuditDate, - AuditMan2 = om.AuditMan2, - AuditDate2 = om.AuditDate2, - WarehouseMan = om.WarehouseMan, - WarehouseDate = om.WarehouseDate, - WeldTaskId = plan.WeldTaskId, - Remark = plan.Remark - }; - return query.FirstOrDefault(); + var used = Funs.DB.Tw_AntiCorrosionTrust + .Where(x => x.ProjectId == projectId && x.WeldTaskCode != null + && (string.IsNullOrEmpty(currentTrustId) || x.Id != currentTrustId)) + .Select(x => x.WeldTaskCode).ToList(); + return WeldTaskService.GetTaskListByTeamGroup(projectId, null, unitWorkId) + .Where(x => !used.Contains(x.TaskCode)).ToList(); } public static List GetDetailList(string trustId) { - var query = from d in Funs.DB.Tw_AntiCorrosionTrustDetail - join m in Funs.DB.HJGL_MaterialCodeLib on d.MaterialCode equals m.MaterialCode into materialJoin - from m in materialJoin.DefaultIfEmpty() - where d.TrustId == trustId - orderby d.SortIndex - select new AntiCorrosionTrustDetailOutput - { - Id = d.Id, - TrustId = d.TrustId, - SortIndex = d.SortIndex, - MaterialCode = d.MaterialCode, - Code = m.Code, - MaterialName = m.MaterialName, - MaterialSpec = m.MaterialSpec, - MaterialDef = m.MaterialDef, - MaterialUnit = m.MaterialUnit, - Quantity = d.Quantity, - PaintCode = d.PaintCode, - Primer = d.Primer, - IntermediatePaint = d.IntermediatePaint, - Topcoat = d.Topcoat, - ColorCode = d.ColorCode, - Remark = d.Remark - }; - return query.ToList(); + return (from d in Funs.DB.Tw_AntiCorrosionTrustDetail + join m in Funs.DB.HJGL_MaterialCodeLib on d.MaterialCode equals m.MaterialCode into materials + from m in materials.DefaultIfEmpty() + where d.TrustId == trustId + orderby d.SortIndex + select new AntiCorrosionTrustDetailOutput + { + Id = d.Id, + TrustId = d.TrustId, + SortIndex = d.SortIndex, + MaterialCode = d.MaterialCode, + Code = m == null ? string.Empty : m.Code, + MaterialName = m == null ? string.Empty : m.MaterialName, + MaterialSpec = m == null ? string.Empty : m.MaterialSpec, + MaterialDef = m == null ? string.Empty : m.MaterialDef, + MaterialUnit = m == null ? string.Empty : m.MaterialUnit, + Quantity = d.Quantity, + PaintCode = d.PaintCode, + Primer = d.Primer, + IntermediatePaint = d.IntermediatePaint, + Topcoat = d.Topcoat, + ColorCode = d.ColorCode, + IsPostWeld = d.IsPostWeld, + Remark = d.Remark + }).ToList(); } - public static List GetDetailsByOutputMasterId(string outputMasterId) + public static List GetDetailsByTaskCode(string projectId, string taskCode) { - var outputDetails = Funs.DB.Tw_OutputDetail - .Where(x => x.OutputMasterId == outputMasterId) - .OrderBy(x => x.Id) - .ToList(); - var materialCodes = outputDetails.Select(x => x.MaterialCode).Where(x => !string.IsNullOrEmpty(x)).Distinct().ToList(); - var materials = Funs.DB.HJGL_MaterialCodeLib - .Where(x => materialCodes.Contains(x.MaterialCode)) - .ToDictionary(x => x.MaterialCode, x => x); + var weldJointIds = Funs.DB.HJGL_WeldTask + .Where(x => x.ProjectId == projectId && x.TaskCode == taskCode && x.WeldJointId != null) + .Select(x => x.WeldJointId).Distinct().ToList(); + return BuildDetailsByWeldJointIds(weldJointIds, false, false); + } - var index = 0; - var result = new List(); - foreach (var detail in outputDetails) - { - index++; - HJGL_MaterialCodeLib material = null; - if (!string.IsNullOrEmpty(detail.MaterialCode) && materials.ContainsKey(detail.MaterialCode)) - { - material = materials[detail.MaterialCode]; - } + public static List GetDetailsByHotProessTrustId(string hotProessTrustId) + { + var weldJointIds = Funs.DB.HJGL_HotProess_TrustItem + .Where(x => x.HotProessTrustId == hotProessTrustId && x.IsCompleted == true + && Funs.DB.HJGL_HotProess_Report.Any(r => r.HotProessTrustItemId == x.HotProessTrustItemId)) + .Select(x => x.WeldJointId).Where(x => x != null).Distinct().ToList(); + return BuildDetailsByWeldJointIds(weldJointIds, true, true); + } - // 防腐明细只保存材料主编码和数量,展示字段统一由材料编码库补齐。 - result.Add(new AntiCorrosionTrustDetailOutput + private static List BuildDetailsByWeldJointIds( + List weldJointIds, bool isPostWeld, bool fillComponentRemark) + { + if (weldJointIds == null || weldJointIds.Count == 0) return new List(); + var materials = (from pm in Funs.DB.HJGL_PipeLineMat + join material in Funs.DB.HJGL_MaterialCodeLib on pm.MaterialCode equals material.MaterialCode + join joint in Funs.DB.HJGL_WeldJoint on pm.WeldJointId equals joint.WeldJointId + join pipeline in Funs.DB.HJGL_Pipeline on joint.PipelineId equals pipeline.PipelineId into pipelines + from pipeline in pipelines.DefaultIfEmpty() + join paint in Funs.DB.Tw_PaintCodeDict on pipeline.PaintId equals paint.Id into paints + from paint in paints.DefaultIfEmpty() + where weldJointIds.Contains(pm.WeldJointId) && pm.MaterialCode != null + select new + { + pm.MaterialCode, + pm.Number, + pm.PrefabricatedComponents, + PaintId = pipeline == null ? null : pipeline.PaintId, + PaintCode = paint == null ? null : paint.PaintCode, + Primer = paint == null ? null : paint.Primer, + IntermediatePaint = paint == null ? null : paint.IntermediatePaint, + Topcoat = paint == null ? null : paint.Topcoat, + ColorCode = paint == null ? null : paint.ColorCode, + material.Code, + material.MaterialName, + material.MaterialSpec, + material.MaterialDef, + material.MaterialUnit + }).ToList(); + + int index = 0; + return materials.GroupBy(x => new { x.MaterialCode, x.PaintId }) + .OrderBy(x => x.Key.MaterialCode).ThenBy(x => x.Key.PaintId) + .Select(group => { - Id = SQLHelper.GetNewID(), - SortIndex = index, - MaterialCode = detail.MaterialCode, - Code = material == null ? string.Empty : material.Code, - MaterialName = material == null ? string.Empty : material.MaterialName, - MaterialSpec = material == null ? string.Empty : material.MaterialSpec, - MaterialDef = material == null ? string.Empty : material.MaterialDef, - MaterialUnit = material == null ? string.Empty : material.MaterialUnit, - Quantity = detail.ActNum ?? detail.PlanNum - }); - } - return result; + index++; + var first = group.First(); + string remark = string.Empty; + if (fillComponentRemark) + { + remark = string.Join("、", group.Select(x => x.PrefabricatedComponents) + .Where(x => !string.IsNullOrWhiteSpace(x)).Distinct().OrderBy(x => x)); + } + return new AntiCorrosionTrustDetailOutput + { + Id = SQLHelper.GetNewID(), + SortIndex = index, + MaterialCode = first.MaterialCode, + Code = first.Code, + MaterialName = first.MaterialName, + MaterialSpec = first.MaterialSpec, + MaterialDef = first.MaterialDef, + MaterialUnit = first.MaterialUnit, + Quantity = group.Sum(x => x.Number ?? 0), + PaintCode = first.PaintCode, + Primer = first.Primer, + IntermediatePaint = first.IntermediatePaint, + Topcoat = first.Topcoat, + ColorCode = first.ColorCode, + IsPostWeld = isPostWeld, + Remark = remark + }; + }).ToList(); } public static List GetPaintCodeList() { - return Funs.DB.Tw_PaintCodeDict - .Where(x => x.IsUsed) - .OrderBy(x => x.SortIndex) - .ThenBy(x => x.PaintCode) + return Funs.DB.Tw_PaintCodeDict.Where(x => x.IsUsed).OrderBy(x => x.SortIndex).ThenBy(x => x.PaintCode) .Select(x => new PaintCodeDictOutput { Id = x.Id, @@ -268,15 +236,129 @@ namespace BLL Topcoat = x.Topcoat, ColorCode = x.ColorCode, SortIndex = x.SortIndex - }) - .ToList(); + }).ToList(); } - public static void Save(AntiCorrosionTrustOutput trust, List details) + public static void Save(AntiCorrosionTrustOutput trust, List details, bool splitOnSubmit) { - var isNew = string.IsNullOrEmpty(trust.Id); - Tw_AntiCorrosionTrust entity; - if (isNew) + if (trust == null) throw new ArgumentNullException("trust"); + var validDetails = (details ?? new List()) + .Where(x => !string.IsNullOrWhiteSpace(x.MaterialCode)).OrderBy(x => x.SortIndex ?? int.MaxValue).ToList(); + if (validDetails.Count == 0) throw new ArgumentException("防腐委托单明细不能为空。"); + + using (var scope = new TransactionScope()) + { + if (string.IsNullOrEmpty(trust.Id)) + { + // 新单在保存事务内重新取号,页面预览编号不作为最终并发依据。 + trust.TrustCode = GenerateTrustCode(trust.UnitWorkId); + } + if (!splitOnSubmit || validDetails.Select(x => x.IsPostWeld).Distinct().Count() == 1) + { + var entity = SaveCategory(trust, validDetails, true, splitOnSubmit); + trust.Id = entity.Id; + } + else + { + bool originalCategory = validDetails.First().IsPostWeld; + var originalDetails = validDetails.Where(x => x.IsPostWeld == originalCategory).ToList(); + var splitDetails = validDetails.Where(x => x.IsPostWeld != originalCategory).ToList(); + var original = SaveCategory(trust, originalDetails, true, true); + Funs.DB.SubmitChanges(); + + var splitTrust = new AntiCorrosionTrustOutput + { + ProjectId = trust.ProjectId, + UnitWorkId = trust.UnitWorkId, + ConstructionPart = trust.ConstructionPart, + ConstructionProfessional = trust.ConstructionProfessional, + TrustCode = GenerateTrustCode(trust.UnitWorkId), + DemandDate = trust.DemandDate, + CompleteDate = trust.CompleteDate, + CreateMan = trust.CreateMan, + // 来源ID只保留在原单,保证同一来源可可靠防重。 + WeldTaskCode = null, + HotProessTrustId = null + }; + SaveCategory(splitTrust, splitDetails, false, true); + trust.Id = original.Id; + } + Funs.DB.SubmitChanges(); + scope.Complete(); + } + } + + public static string GenerateByTaskCode(string projectId, string taskCode, string createMan) + { + using (var scope = new TransactionScope()) + { + var existingId = Funs.DB.ExecuteQuery( + "SELECT Id FROM dbo.Tw_AntiCorrosionTrust WITH (UPDLOCK,HOLDLOCK) WHERE ProjectId={0} AND WeldTaskCode={1}", + projectId, taskCode).FirstOrDefault(); + if (!string.IsNullOrEmpty(existingId)) + { + scope.Complete(); + return existingId; + } + var task = WeldTaskService.GetTaskDetail(projectId, taskCode); + if (task == null) throw new ArgumentException("焊接任务单不存在。"); + var details = GetDetailsByTaskCode(projectId, taskCode); + if (details.Count == 0) throw new ArgumentException("任务单没有可生成防腐委托的焊口材料。"); + var trust = new AntiCorrosionTrustOutput + { + ProjectId = projectId, + UnitWorkId = task.UnitWorkId, + TrustCode = GenerateTrustCode(task.UnitWorkId), + WeldTaskCode = taskCode, + DemandDate = task.TaskDate, + CreateMan = createMan, + Remark = "原材料防腐" + }; + Save(trust, details, true); + scope.Complete(); + return trust.Id; + } + } + + public static string GenerateByHotProessTrustId(string hotProessTrustId, string createMan) + { + using (var scope = new TransactionScope()) + { + var existingId = Funs.DB.ExecuteQuery( + "SELECT Id FROM dbo.Tw_AntiCorrosionTrust WITH (UPDLOCK,HOLDLOCK) WHERE HotProessTrustId={0}", + hotProessTrustId).FirstOrDefault(); + if (!string.IsNullOrEmpty(existingId)) + { + scope.Complete(); + return existingId; + } + var hotTrust = Funs.DB.HJGL_HotProess_Trust.FirstOrDefault(x => x.HotProessTrustId == hotProessTrustId); + if (hotTrust == null) throw new ArgumentException("热处理委托不存在。"); + var details = GetDetailsByHotProessTrustId(hotProessTrustId); + if (details.Count == 0) throw new ArgumentException("当前热处理报告没有可生成防腐委托的已完成焊口材料。"); + var trust = new AntiCorrosionTrustOutput + { + ProjectId = hotTrust.ProjectId, + UnitWorkId = hotTrust.UnitWorkId, + TrustCode = GenerateTrustCode(hotTrust.UnitWorkId), + HotProessTrustId = hotProessTrustId, + CreateMan = createMan, + Remark = "管段防腐" + }; + Save(trust, details, true); + scope.Complete(); + return trust.Id; + } + } + + private static Tw_AntiCorrosionTrust SaveCategory( + AntiCorrosionTrustOutput trust, List details, + bool keepSource, bool applyCategoryRemark) + { + var entity = string.IsNullOrEmpty(trust.Id) + ? null + : Funs.DB.Tw_AntiCorrosionTrust.FirstOrDefault(x => x.Id == trust.Id); + if (entity == null) { entity = new Tw_AntiCorrosionTrust { @@ -287,42 +369,35 @@ namespace BLL }; Funs.DB.Tw_AntiCorrosionTrust.InsertOnSubmit(entity); } - else - { - entity = Funs.DB.Tw_AntiCorrosionTrust.FirstOrDefault(x => x.Id == trust.Id); - if (entity == null) - { - throw new Exception("防腐委托单不存在或已删除!"); - } - } + bool isPostWeld = details.First().IsPostWeld; entity.UnitWorkId = trust.UnitWorkId; entity.ConstructionPart = trust.ConstructionPart; entity.ConstructionProfessional = trust.ConstructionProfessional; entity.TrustCode = trust.TrustCode; - entity.OutputMasterId = trust.OutputMasterId; + entity.WeldTaskCode = keepSource ? trust.WeldTaskCode : null; + entity.HotProessTrustId = keepSource ? trust.HotProessTrustId : null; entity.DemandDate = trust.DemandDate; entity.CompleteDate = trust.CompleteDate; - entity.Remark = trust.Remark; + entity.Remark = applyCategoryRemark + ? (isPostWeld ? "管段防腐" : "原材料防腐") + : trust.Remark; var oldDetails = Funs.DB.Tw_AntiCorrosionTrustDetail.Where(x => x.TrustId == entity.Id).ToList(); Funs.DB.Tw_AntiCorrosionTrustDetail.DeleteAllOnSubmit(oldDetails); - var paintMap = GetPaintCodeList().ToDictionary(x => x.PaintCode ?? string.Empty, x => x); - var index = 0; - foreach (var detail in details.Where(x => !string.IsNullOrEmpty(x.MaterialCode))) + int index = 0; + foreach (var detail in details) { index++; - if (!string.IsNullOrEmpty(detail.PaintCode) && paintMap.ContainsKey(detail.PaintCode)) + PaintCodeDictOutput paint; + if (!string.IsNullOrEmpty(detail.PaintCode) && paintMap.TryGetValue(detail.PaintCode, out paint)) { - var paint = paintMap[detail.PaintCode]; detail.Primer = paint.Primer; detail.IntermediatePaint = paint.IntermediatePaint; detail.Topcoat = paint.Topcoat; detail.ColorCode = paint.ColorCode; } - - // 涂漆代码保存时按字典补齐,避免前端联动遗漏造成打印字段为空。 Funs.DB.Tw_AntiCorrosionTrustDetail.InsertOnSubmit(new Tw_AntiCorrosionTrustDetail { Id = SQLHelper.GetNewID(), @@ -335,12 +410,11 @@ namespace BLL IntermediatePaint = detail.IntermediatePaint, Topcoat = detail.Topcoat, ColorCode = detail.ColorCode, + IsPostWeld = detail.IsPostWeld, Remark = detail.Remark }); } - - Funs.DB.SubmitChanges(); - trust.Id = entity.Id; + return entity; } public static void DeleteById(string id) @@ -348,40 +422,33 @@ namespace BLL var details = Funs.DB.Tw_AntiCorrosionTrustDetail.Where(x => x.TrustId == id).ToList(); Funs.DB.Tw_AntiCorrosionTrustDetail.DeleteAllOnSubmit(details); var trust = Funs.DB.Tw_AntiCorrosionTrust.FirstOrDefault(x => x.Id == id); - if (trust != null) - { - Funs.DB.Tw_AntiCorrosionTrust.DeleteOnSubmit(trust); - } + if (trust != null) Funs.DB.Tw_AntiCorrosionTrust.DeleteOnSubmit(trust); Funs.DB.SubmitChanges(); } public static DataTable GetPrintMasterTable(string id) { var query = (from t in Funs.DB.Tw_AntiCorrosionTrust - join p in Funs.DB.Base_Project on t.ProjectId equals p.ProjectId into projectJoin - from p in projectJoin.DefaultIfEmpty() - join uw in Funs.DB.WBS_UnitWork on t.UnitWorkId equals uw.UnitWorkId into uwJoin - from uw in uwJoin.DefaultIfEmpty() - join om in Funs.DB.Tw_OutputMaster on t.OutputMasterId equals om.Id into omJoin - from om in omJoin.DefaultIfEmpty() - join createPerson in Funs.DB.Person_Persons on t.CreateMan equals createPerson.PersonId into personJoin - from createPerson in personJoin.DefaultIfEmpty() + join p in Funs.DB.Base_Project on t.ProjectId equals p.ProjectId into projects + from p in projects.DefaultIfEmpty() + join uw in Funs.DB.WBS_UnitWork on t.UnitWorkId equals uw.UnitWorkId into unitWorks + from uw in unitWorks.DefaultIfEmpty() + join person in Funs.DB.Person_Persons on t.CreateMan equals person.PersonId into persons + from person in persons.DefaultIfEmpty() where t.Id == id select new { - p.ProjectName, - uw.UnitWorkName, - uw.UnitWorkCode, + ProjectName = p == null ? string.Empty : p.ProjectName, + UnitWorkName = uw == null ? string.Empty : uw.UnitWorkName, + UnitWorkCode = uw == null ? string.Empty : uw.UnitWorkCode, t.ConstructionPart, t.ConstructionProfessional, t.TrustCode, - OutputMasterCode = om.CusBillCode, + OutputMasterCode = string.Empty, t.DemandDate, t.CompleteDate, - CreateManName = createPerson.PersonName - }) - .ToList() - .Select(x => new + CreateManName = person == null ? string.Empty : person.PersonName + }).ToList().Select(x => new { x.ProjectName, x.UnitWorkName, @@ -399,39 +466,33 @@ namespace BLL public static DataTable GetPrintDetailTable(string id) { - var query = from d in Funs.DB.Tw_AntiCorrosionTrustDetail - join m in Funs.DB.HJGL_MaterialCodeLib on d.MaterialCode equals m.MaterialCode into materialJoin - from m in materialJoin.DefaultIfEmpty() - where d.TrustId == id - orderby d.SortIndex - select new - { - d.SortIndex, - m.MaterialName, - m.Code, - m.MaterialSpec, - m.MaterialDef, - m.MaterialUnit, - d.Quantity, - d.PaintCode, - d.Primer, - d.IntermediatePaint, - d.Topcoat, - d.ColorCode, - d.Remark - }; - return ToDataTable(query.ToList(), "Data"); + var query = GetDetailList(id).Select(x => new + { + x.SortIndex, + x.Code, + x.MaterialName, + x.MaterialSpec, + x.MaterialDef, + x.MaterialUnit, + x.Quantity, + x.PaintCode, + x.Primer, + x.IntermediatePaint, + x.Topcoat, + x.ColorCode, + IsPostWeld = x.IsPostWeld ? "是" : "否", + x.Remark + }); + // FastReport 防腐委托模板的数据带固定绑定 Data,表名必须与模板保持一致。 + return ToDataTable(query, "Data"); } private static int GetTrustCodeSerial(string trustCode) { - if (string.IsNullOrEmpty(trustCode) || trustCode.Length < 3) - { - return 0; - } - + if (string.IsNullOrEmpty(trustCode)) return 0; + int index = trustCode.LastIndexOf('-'); int serial; - return int.TryParse(trustCode.Substring(trustCode.Length - 3), out serial) ? serial : 0; + return index >= 0 && int.TryParse(trustCode.Substring(index + 1), out serial) ? serial : 0; } private static DataTable ToDataTable(IEnumerable data, string tableName) @@ -440,10 +501,8 @@ namespace BLL var properties = typeof(T).GetProperties(); foreach (var property in properties) { - var propertyType = Nullable.GetUnderlyingType(property.PropertyType) ?? property.PropertyType; - table.Columns.Add(property.Name, propertyType); + table.Columns.Add(property.Name, Nullable.GetUnderlyingType(property.PropertyType) ?? property.PropertyType); } - foreach (var item in data) { var row = table.NewRow(); diff --git a/SGGL/BLL/CLGL/TwInOutplanmasterService.cs b/SGGL/BLL/CLGL/TwInOutplanmasterService.cs index b78e2985..ed53317d 100644 --- a/SGGL/BLL/CLGL/TwInOutplanmasterService.cs +++ b/SGGL/BLL/CLGL/TwInOutplanmasterService.cs @@ -1310,7 +1310,7 @@ namespace BLL MaterialName = g.Key.MaterialUnit, }; - var outPlanDetailListPiece = outMateriaList.Where(x => x.MaterialName.Contains("个"));//管件 + var outPlanDetailListPiece = outMateriaList.Where(x => x.MaterialName.Contains("个")|| x.MaterialName.Contains("片"));//管件 var outPlanDetailListOthere = outMateriaList.Where(x => x.MaterialName.Contains("米"));//管段 var weldTaskCode = WeldTaskService.GetWeldTaskById(weldTask.WeldTaskId)?.TaskCode; var taskPipeline = PipelineService.GetPipelineByPipelineId(weldTask.PipelineId); @@ -1347,8 +1347,8 @@ namespace BLL }; TwInOutplandetailService.Add(detail); } - // 管件申请单只保存单位为“个”的材料关联,并同步记录焊口ID,便于追溯出库材料归属。 - var twinoutplandetailRelationList = MaterDatial.Where(x => x.MaterialUnit.Contains("个")).Select(x => new Tw_InOutPlanDetail_Relation + // 管件申请单只保存单位为“个”和“片”的材料关联,并同步记录焊口ID,便于追溯出库材料归属。 + var twinoutplandetailRelationList = MaterDatial.Where(x => x.MaterialUnit.Contains("个") || x.MaterialUnit.Contains("片")).Select(x => new Tw_InOutPlanDetail_Relation { PipelineId = x.PipelineId, MaterialCode = x.MaterialCode, diff --git a/SGGL/BLL/Common/Funs.cs b/SGGL/BLL/Common/Funs.cs index 1ee0f22d..413054ec 100644 --- a/SGGL/BLL/Common/Funs.cs +++ b/SGGL/BLL/Common/Funs.cs @@ -947,7 +947,36 @@ namespace BLL return month; } + /// + /// ݵǰɴλˮŵ±š + /// + /// ǰѷ + /// ǰ׺ + /// ± + public static string GetThreeNumber(string maxNumber, string prefix) + { + if (string.IsNullOrEmpty(prefix)) + { + throw new ArgumentException("ǰ׺Ϊ", "prefix"); + } + if (string.IsNullOrEmpty(maxNumber)) + { + return prefix + "001"; + } + int serial; + if (maxNumber.Length < 3 + || !int.TryParse(maxNumber.Substring(maxNumber.Length - 3), out serial)) + { + throw new InvalidOperationException("ǰŵĺλЧˮţ" + maxNumber); + } + if (serial >= 999) + { + throw new InvalidOperationException("λˮ"); + } + + return prefix + (serial + 1).ToString("D3"); + } public static DateTime GetQuarterlyMonths(string year, string quarterly) { string startMonth = string.Empty; diff --git a/SGGL/BLL/HJGL/PointTrust/PointBatchService.cs b/SGGL/BLL/HJGL/PointTrust/PointBatchService.cs index 4fc01cc7..770692f9 100644 --- a/SGGL/BLL/HJGL/PointTrust/PointBatchService.cs +++ b/SGGL/BLL/HJGL/PointTrust/PointBatchService.cs @@ -127,6 +127,15 @@ namespace BLL /// 根据焊口id组批 /// public static string AddBatchByWeldJointId(string weldJointId, DateTime? weldingDate, string batchCondition) + { + return AddBatchByWeldJointId(weldJointId, weldingDate, batchCondition, null); + } + + /// + /// 根据焊口id组批,并在事务场景下复用现有数据库连接。 + /// + internal static string AddBatchByWeldJointId(string weldJointId, DateTime? weldingDate, + string batchCondition, SqlConnection sharedConnection) { string errlog = string.Empty; string[] condition = batchCondition.Split('|'); @@ -222,7 +231,9 @@ namespace BLL } SqlParameter[] parameter = listStr.ToArray(); - DataTable batchInfo = SQLHelper.GetDataTableRunText(strSql, parameter); + DataTable batchInfo = sharedConnection == null + ? SQLHelper.GetDataTableRunText(strSql, parameter) + : GetDataTableRunText(sharedConnection, strSql, parameter); string batchId = string.Empty; if (batchInfo.Rows.Count == 0) @@ -274,13 +285,17 @@ namespace BLL if (pipeline.PipeArea == PipelineService.PipeArea_FIELD) { perfix += "XC-"; - batch.PointBatchCode = BLL.SQLHelper.RunProcNewIdByProjectId("SpGetNewCode4ByProjectId", "dbo.HJGL_Batch_PointBatch", "PointBatchCode", project.ProjectId, perfix); + batch.PointBatchCode = sharedConnection == null + ? BLL.SQLHelper.RunProcNewIdByProjectId("SpGetNewCode4ByProjectId", "dbo.HJGL_Batch_PointBatch", "PointBatchCode", project.ProjectId, perfix) + : RunProcNewIdByProjectId(sharedConnection, "SpGetNewCode4ByProjectId", "dbo.HJGL_Batch_PointBatch", "PointBatchCode", project.ProjectId, perfix); } else if (pipeline.PipeArea == PipelineService.PipeArea_SHOP) { perfix += "GC-"; - batch.PointBatchCode = BLL.SQLHelper.RunProcNewIdByProjectId("SpGetNewCode4ByProjectId", "dbo.HJGL_Batch_PointBatch", "PointBatchCode", project.ProjectId, perfix); + batch.PointBatchCode = sharedConnection == null + ? BLL.SQLHelper.RunProcNewIdByProjectId("SpGetNewCode4ByProjectId", "dbo.HJGL_Batch_PointBatch", "PointBatchCode", project.ProjectId, perfix) + : RunProcNewIdByProjectId(sharedConnection, "SpGetNewCode4ByProjectId", "dbo.HJGL_Batch_PointBatch", "PointBatchCode", project.ProjectId, perfix); } } @@ -341,6 +356,43 @@ namespace BLL return errlog; } + private static DataTable GetDataTableRunText(SqlConnection connection, string sql, params SqlParameter[] parameters) + { + DataTable dataTable = new DataTable(); + using (SqlCommand command = new SqlCommand(sql, connection)) + using (SqlDataAdapter adapter = new SqlDataAdapter(command)) + { + command.CommandTimeout = 0; + command.CommandType = CommandType.Text; + if (parameters != null) + { + command.Parameters.AddRange(parameters); + } + adapter.Fill(dataTable); + } + return dataTable; + } + + private static string RunProcNewIdByProjectId(SqlConnection connection, string storedProcName, + string tableName, string columnName, string projectId, string prefix) + { + using (SqlCommand command = new SqlCommand(storedProcName, connection)) + { + command.CommandType = CommandType.StoredProcedure; + command.Parameters.AddRange(new[] + { + new SqlParameter("@tableName", tableName), + new SqlParameter("@columnName", columnName), + new SqlParameter("@projectId", projectId), + new SqlParameter("@prefix", prefix), + new SqlParameter("@returnVal", SqlDbType.VarChar, 50) + }); + command.Parameters["@returnVal"].Direction = ParameterDirection.Output; + command.ExecuteNonQuery(); + return command.Parameters["@returnVal"].Value.ToString(); + } + } + } diff --git a/SGGL/BLL/HJGL/WeldingManage/PreWeldInspectionService.cs b/SGGL/BLL/HJGL/WeldingManage/PreWeldInspectionService.cs index 8e8c110a..769f5442 100644 --- a/SGGL/BLL/HJGL/WeldingManage/PreWeldInspectionService.cs +++ b/SGGL/BLL/HJGL/WeldingManage/PreWeldInspectionService.cs @@ -53,6 +53,7 @@ namespace BLL WeldJointCode = x.w.WeldJointCode, CuttingLength = x.c.CuttingLength, GrooveForm = x.c.GrooveForm, + GrooveProcessType = x.c.GrooveProcessType, GrooveAngle = x.c.GrooveAngle, IsMaterialCodeBatchNoAccurate = x.c.IsMaterialCodeBatchNoAccurate, IsMaterialQuantityAccurate = x.c.IsMaterialQuantityAccurate, @@ -87,8 +88,6 @@ namespace BLL { var query = from f in db.HJGL_PreWeldFitupCheck join w in db.HJGL_WeldJoint on f.WeldJointId equals w.WeldJointId - join g in db.Base_GrooveType on f.GrooveTypeId equals g.GrooveTypeId into grooveTypes - from g in grooveTypes.DefaultIfEmpty() join p in db.Person_Persons on f.CheckPerson equals p.PersonId into persons from p in persons.DefaultIfEmpty() where string.IsNullOrEmpty(projectId) || f.ProjectId == projectId || w.ProjectId == projectId @@ -96,7 +95,6 @@ namespace BLL { f, w, - g, CheckPersonName = p == null ? string.Empty : p.PersonName }; @@ -120,17 +118,8 @@ namespace BLL WeldJointId = x.f.WeldJointId, PipelineCode = x.w.PipelineCode, WeldJointCode = x.w.WeldJointCode, - GrooveTypeId = x.f.GrooveTypeId, - GrooveTypeCode = x.g == null ? string.Empty : x.g.GrooveTypeCode, - GrooveTypeName = x.g == null ? string.Empty : x.g.GrooveTypeName, - GrooveProcessType = x.f.GrooveProcessType, - GrooveAngle = x.f.GrooveAngle, FitupGap = x.f.FitupGap, Misalignment = x.f.Misalignment, - WeldReinforcement = x.f.WeldReinforcement, - WeldHeight = x.f.WeldHeight, - WeldWidth = x.f.WeldWidth, - SurfaceDefect = x.f.SurfaceDefect, CheckPerson = x.f.CheckPerson, CheckPersonName = x.CheckPersonName, CheckTime = x.f.CheckTime, @@ -218,6 +207,7 @@ namespace BLL WeldJointCode = w.WeldJointCode, CuttingLength = c.CuttingLength, GrooveForm = c.GrooveForm, + GrooveProcessType = c.GrooveProcessType, GrooveAngle = c.GrooveAngle, IsMaterialCodeBatchNoAccurate = c.IsMaterialCodeBatchNoAccurate, IsMaterialQuantityAccurate = c.IsMaterialQuantityAccurate, @@ -293,6 +283,7 @@ namespace BLL check.ProjectId = string.IsNullOrEmpty(item.ProjectId) ? weldJoint.ProjectId : item.ProjectId; check.CuttingLength = item.CuttingLength; check.GrooveForm = item.GrooveForm; + check.GrooveProcessType = item.GrooveProcessType; check.GrooveAngle = item.GrooveAngle; check.IsMaterialCodeBatchNoAccurate = item.IsMaterialCodeBatchNoAccurate; check.IsMaterialQuantityAccurate = item.IsMaterialQuantityAccurate; @@ -381,11 +372,6 @@ namespace BLL { throw new ArgumentException("焊口ID不能为空。"); } - /* if (string.IsNullOrEmpty(item.GrooveTypeId)) - { - throw new ArgumentException("坡口类型不能为空。"); - }*/ - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { var weldJoint = db.HJGL_WeldJoint.FirstOrDefault(x => x.WeldJointId == item.WeldJointId); @@ -393,11 +379,6 @@ namespace BLL { throw new ArgumentException("未找到对应焊口。"); } - /* if (!db.Base_GrooveType.Any(x => x.GrooveTypeId == item.GrooveTypeId)) - { - throw new ArgumentException("坡口类型不存在。"); - }*/ - var check = string.IsNullOrEmpty(item.FitupCheckId) ? null : db.HJGL_PreWeldFitupCheck.FirstOrDefault(x => x.FitupCheckId == item.FitupCheckId); @@ -413,15 +394,8 @@ namespace BLL check.ProjectId = string.IsNullOrEmpty(item.ProjectId) ? weldJoint.ProjectId : item.ProjectId; check.WeldJointId = item.WeldJointId; - //check.GrooveTypeId = item.GrooveTypeId; - check.GrooveProcessType = item.GrooveProcessType; - check.GrooveAngle = item.GrooveAngle; check.FitupGap = item.FitupGap; check.Misalignment = item.Misalignment; - check.WeldReinforcement = item.WeldReinforcement; - check.WeldHeight = item.WeldHeight; - check.WeldWidth = item.WeldWidth; - check.SurfaceDefect = item.SurfaceDefect; check.CheckPerson = item.CheckPerson; check.CheckTime = item.CheckTime ?? DateTime.Now; check.CreateUser = item.CreateUser ?? item.CheckPerson; @@ -430,10 +404,7 @@ namespace BLL check.RectifyRequirement = item.RectifyRequirement; check.Remark = item.Remark; - // 组对检查需要同步回写焊口主表,保证焊口基础信息保持最新 - // weldJoint.GrooveTypeId = item.GrooveTypeId; - weldJoint.GrooveProcessType = item.GrooveProcessType; - weldJoint.GrooveAngle = item.GrooveAngle; + // 组对检查只同步组对间隙和错边量。 weldJoint.FitupGap = item.FitupGap; weldJoint.Misalignment = item.Misalignment; @@ -602,22 +573,37 @@ namespace BLL } /// - /// 按材料编码获取防腐记录列表 + /// 按入库条码获取材料信息及防腐记录列表 /// public static List GetAntiCorrosionChecksByMaterialCode(string barCode, string projectId) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { + var normalizedBarCode = string.IsNullOrWhiteSpace(barCode) ? string.Empty : barCode.Trim(); + var barCodeMaterial = (from code in db.Tw_InputDetailBarCode + join m in db.HJGL_MaterialCodeLib on code.MaterialCode equals m.MaterialCode into materialJoin + from m in materialJoin.DefaultIfEmpty() + where code.BarCode == normalizedBarCode + select new + { + code.MaterialCode, + Material = m + }).FirstOrDefault(); + if (barCodeMaterial == null) + { + return new List(); + } + + // 先按条码解析材料,再查询检查记录;无检查记录时仍需返回一条材料基础信息供扫码录入使用。 var query = from r in db.HJGL_AntiCorrosionCheckRecord join m in db.HJGL_MaterialCodeLib on r.MaterialCode equals m.MaterialCode into materialJoin from m in materialJoin.DefaultIfEmpty() - join code in db.Tw_InputDetailBarCode on m.MaterialCode equals code.MaterialCode into barCodeJoin - from code in barCodeJoin.DefaultIfEmpty() join paint in db.Tw_PaintCodeDict on r.PaintId equals paint.Id into paintJoin from paint in paintJoin.DefaultIfEmpty() join person in db.Person_Persons on r.CheckPerson equals person.PersonId into personJoin from person in personJoin.DefaultIfEmpty() - where code.BarCode == barCode && (string.IsNullOrEmpty(projectId) || r.ProjectId == projectId) + where r.MaterialCode == barCodeMaterial.MaterialCode && + (string.IsNullOrEmpty(projectId) || r.ProjectId == projectId) orderby r.CheckTime descending select new Model.AntiCorrosionCheckRecordItem { @@ -655,9 +641,29 @@ namespace BLL CreateTime = r.CreateTime }; var data = query.ToList(); + if (data.Count == 0) + { + var material = barCodeMaterial.Material; + data.Add(new Model.AntiCorrosionCheckRecordItem + { + ProjectId = projectId, + MaterialCode = barCodeMaterial.MaterialCode, + MaterialName = material == null ? string.Empty : material.MaterialName, + MaterialSpec = material == null ? string.Empty : material.MaterialSpec, + MaterialMade = material == null ? string.Empty : material.MaterialMade, + MaterialDef = material == null ? string.Empty : material.MaterialDef, + MaterialUnit = material == null ? string.Empty : material.MaterialUnit, + HeatNo = material == null ? string.Empty : material.HeatNo, + BatchNo = material == null ? string.Empty : material.BatchNo, + Code = material == null ? string.Empty : material.Code + }); + } foreach (var item in data) { - item.AttachUrl1 = GetInspectionAttachUrl(db, Const.Tw_AntiCorrosionCheckRecordMenuId, item.AntiCorrosionCheckId); + if (!string.IsNullOrEmpty(item.AntiCorrosionCheckId)) + { + item.AttachUrl1 = GetInspectionAttachUrl(db, Const.Tw_AntiCorrosionCheckRecordMenuId, item.AntiCorrosionCheckId); + } } return data; } diff --git a/SGGL/BLL/HJGL/WeldingManage/WeldAppearanceCheckService.cs b/SGGL/BLL/HJGL/WeldingManage/WeldAppearanceCheckService.cs index 5809e676..c4ee56c8 100644 --- a/SGGL/BLL/HJGL/WeldingManage/WeldAppearanceCheckService.cs +++ b/SGGL/BLL/HJGL/WeldingManage/WeldAppearanceCheckService.cs @@ -52,6 +52,7 @@ namespace BLL .Select(x => new Model.WeldAppearanceCheckItem { AppearanceCheckId = x.c.AppearanceCheckId, + CheckCode = x.c.CheckCode, ProjectId = x.c.ProjectId, WeldJointId = x.c.WeldJointId, PipelineCode = x.w.PipelineCode, @@ -62,6 +63,12 @@ namespace BLL CheckPersonName = x.CheckPersonName, CheckTime = x.c.CheckTime, Remark = x.c.Remark, + WeldReinforcement = x.c.WeldReinforcement, + WeldHeight = x.c.WeldHeight, + WeldWidth = x.c.WeldWidth, + SurfaceDefect = x.c.SurfaceDefect, + PreheatTemperature = x.c.PreheatTemperature, + InterpassTemperature = x.c.InterpassTemperature, CreateTime = x.c.CreateTime }).ToList(); PopulateAttachUrls(data); @@ -164,6 +171,16 @@ namespace BLL throw new ArgumentException("只能对已焊接焊口进行外观检测。"); } + string unitWorkName = (from pipeline in db.HJGL_Pipeline + join unitWork in db.WBS_UnitWork on pipeline.UnitWorkId equals unitWork.UnitWorkId + where pipeline.PipelineId == joint.PipelineId + select unitWork.UnitWorkName).FirstOrDefault(); + if (string.IsNullOrWhiteSpace(unitWorkName)) + { + throw new ArgumentException("焊口所属单位工程不存在,无法生成检测编号。"); + } + DateTime checkTime = item.CheckTime ?? DateTime.Now; + string id = string.IsNullOrWhiteSpace(item.AppearanceCheckId) ? Guid.NewGuid().ToString() : item.AppearanceCheckId; @@ -192,10 +209,18 @@ namespace BLL check.ProjectId = string.IsNullOrEmpty(item.ProjectId) ? joint.ProjectId : item.ProjectId; check.WeldJointId = item.WeldJointId; + // 检测编号由单位工程和检测日期统一生成,PC页面与WebAPI保存共用此规则。 + check.CheckCode = "FCC-" + unitWorkName.Trim() + "-" + checkTime.ToString("yyyyMMdd"); check.IsQualified = item.IsQualified; check.CheckPerson = item.CheckPerson; - check.CheckTime = item.CheckTime ?? DateTime.Now; + check.CheckTime = checkTime; check.Remark = item.Remark; + check.WeldReinforcement = item.WeldReinforcement; + check.WeldHeight = item.WeldHeight; + check.WeldWidth = item.WeldWidth; + check.SurfaceDefect = item.SurfaceDefect; + check.PreheatTemperature = item.PreheatTemperature; + check.InterpassTemperature = item.InterpassTemperature; db.SubmitChanges(); if (!string.IsNullOrWhiteSpace(item.AttachUrl)) @@ -250,6 +275,7 @@ namespace BLL select new Model.WeldAppearanceCheckItem { AppearanceCheckId = c.AppearanceCheckId, + CheckCode = c.CheckCode, ProjectId = c.ProjectId, WeldJointId = c.WeldJointId, PipelineCode = w.PipelineCode, @@ -260,6 +286,12 @@ namespace BLL CheckPersonName = p == null ? string.Empty : p.PersonName, CheckTime = c.CheckTime, Remark = c.Remark, + WeldReinforcement = c.WeldReinforcement, + WeldHeight = c.WeldHeight, + WeldWidth = c.WeldWidth, + SurfaceDefect = c.SurfaceDefect, + PreheatTemperature = c.PreheatTemperature, + InterpassTemperature = c.InterpassTemperature, CreateTime = c.CreateTime }; } diff --git a/SGGL/BLL/HJGL/WeldingManage/WeldTaskService.cs b/SGGL/BLL/HJGL/WeldingManage/WeldTaskService.cs index 11cb83f2..5256428a 100644 --- a/SGGL/BLL/HJGL/WeldingManage/WeldTaskService.cs +++ b/SGGL/BLL/HJGL/WeldingManage/WeldTaskService.cs @@ -112,6 +112,135 @@ namespace BLL return q.ToList(); } + /// + /// 按项目、班组查询逻辑任务单;同一TaskCode下的多条焊口记录合并为一张任务单。 + /// + public static List GetTaskListByTeamGroup(string projectId, string teamGroupId, string unitWorkId) + { + if (string.IsNullOrWhiteSpace(projectId)) + { + return new List(); + } + + var query = Funs.DB.HJGL_WeldTask.Where(x => x.ProjectId == projectId && x.TaskCode != null); + if (!string.IsNullOrWhiteSpace(teamGroupId)) + { + query = query.Where(x => x.TeamGroupId == teamGroupId); + } + if (!string.IsNullOrWhiteSpace(unitWorkId)) + { + query = query.Where(x => x.UnitWorkId == unitWorkId); + } + + var tasks = query.ToList() + .GroupBy(x => new { x.ProjectId, x.TaskCode }) + .Select(g => + { + var first = g.OrderBy(x => x.WeldTaskId).First(); + return new Model.WeldTaskListItem + { + ProjectId = g.Key.ProjectId, + TaskCode = g.Key.TaskCode, + UnitWorkId = first.UnitWorkId, + UnitId = first.UnitId, + TaskDate = first.TaskDate, + SerialNumber = first.SerialNumber, + TeamGroupId = g.Select(x => x.TeamGroupId).FirstOrDefault(x => !string.IsNullOrEmpty(x)), + WeldJointCount = g.Select(x => x.WeldJointId).Where(x => x != null).Distinct().Count() + }; + }) + .OrderByDescending(x => x.TaskDate) + .ThenByDescending(x => x.TaskCode) + .ToList(); + + var unitWorkIds = tasks.Select(x => x.UnitWorkId).Where(x => x != null).Distinct().ToList(); + var unitIds = tasks.Select(x => x.UnitId).Where(x => x != null).Distinct().ToList(); + var teamIds = tasks.Select(x => x.TeamGroupId).Where(x => x != null).Distinct().ToList(); + var unitWorkMap = Funs.DB.WBS_UnitWork.Where(x => unitWorkIds.Contains(x.UnitWorkId)).ToDictionary(x => x.UnitWorkId, x => x.UnitWorkName); + var unitMap = Funs.DB.Base_Unit.Where(x => unitIds.Contains(x.UnitId)).ToDictionary(x => x.UnitId, x => x.UnitName); + var teamMap = Funs.DB.ProjectData_TeamGroup.Where(x => teamIds.Contains(x.TeamGroupId)).ToDictionary(x => x.TeamGroupId, x => x.TeamGroupName); + foreach (var task in tasks) + { + task.UnitWorkName = task.UnitWorkId != null && unitWorkMap.ContainsKey(task.UnitWorkId) ? unitWorkMap[task.UnitWorkId] : string.Empty; + task.UnitName = task.UnitId != null && unitMap.ContainsKey(task.UnitId) ? unitMap[task.UnitId] : string.Empty; + task.TeamGroupName = task.TeamGroupId != null && teamMap.ContainsKey(task.TeamGroupId) ? teamMap[task.TeamGroupId] : string.Empty; + } + return tasks; + } + + public static Model.WeldTaskDetailItem GetTaskDetail(string projectId, string taskCode) + { + var tasks = Funs.DB.HJGL_WeldTask + .Where(x => x.ProjectId == projectId && x.TaskCode == taskCode) + .OrderBy(x => x.PipeLineSortIndex) + .ThenBy(x => x.WeldTaskId) + .ToList(); + var first = tasks.FirstOrDefault(); + if (first == null) return null; + + var summary = GetTaskListByTeamGroup(projectId, null, first.UnitWorkId) + .FirstOrDefault(x => x.TaskCode == taskCode); + if (summary == null) return null; + var jointIds = tasks.Select(x => x.WeldJointId).Where(x => x != null).Distinct().ToList(); + var jointMap = Funs.DB.View_HJGL_WeldJoint.Where(x => jointIds.Contains(x.WeldJointId)).ToDictionary(x => x.WeldJointId, x => x); + return new Model.WeldTaskDetailItem + { + ProjectId = first.ProjectId, + TaskCode = summary.TaskCode, + UnitWorkId = summary.UnitWorkId, + UnitWorkName = summary.UnitWorkName, + UnitId = summary.UnitId, + UnitName = summary.UnitName, + TaskDate = summary.TaskDate, + SerialNumber = summary.SerialNumber, + TeamGroupId = summary.TeamGroupId, + TeamGroupName = summary.TeamGroupName, + WeldJointCount = summary.WeldJointCount, + Joints = tasks.Select(x => + { + Model.View_HJGL_WeldJoint joint = null; + if (!string.IsNullOrEmpty(x.WeldJointId) && jointMap.ContainsKey(x.WeldJointId)) joint = jointMap[x.WeldJointId]; + return new Model.WeldTaskJointItem + { + WeldTaskId = x.WeldTaskId, + WeldJointId = x.WeldJointId, + PipelineId = joint == null ? null : joint.PipelineId, + PipelineCode = joint == null ? null : joint.PipelineCode, + WeldJointCode = joint == null ? null : joint.WeldJointCode, + JointAttribute = x.JointAttribute, + WeldingMode = x.WeldingMode, + WeldTypeCode = joint == null ? null : joint.WeldTypeCode, + Size = joint == null ? null : joint.Size, + CoverWelderId = x.CoverWelderId, + BackingWelderId = x.BackingWelderId + }; + }).ToList() + }; + } + + public static void UpdateTaskTeamGroup(string projectId, string taskCode, string teamGroupId) + { + var tasks = Funs.DB.HJGL_WeldTask.Where(x => x.ProjectId == projectId && x.TaskCode == taskCode).ToList(); + foreach (var task in tasks) + { + task.TeamGroupId = string.IsNullOrWhiteSpace(teamGroupId) || teamGroupId == Const._Null ? null : teamGroupId; + } + Funs.DB.SubmitChanges(); + } + + public static void GenerateOutPlanByTaskCode(string projectId, string taskCode, string personId) + { + var task = Funs.DB.HJGL_WeldTask.FirstOrDefault(x => x.ProjectId == projectId && x.TaskCode == taskCode); + if (task == null || !task.TaskDate.HasValue) + { + throw new ArgumentException("焊接任务单不存在或任务日期为空。"); + } + + // 沿用原方法,TaskCode只负责定位其所需的组合任务参数。 + TwInOutplanmasterService.GenOutPlanmasterByWeldTaskId( + task.UnitWorkId, task.UnitId, task.TaskDate.Value, task.SerialNumber, personId); + } + /// /// 增加焊接任务单信息 /// @@ -139,7 +268,8 @@ namespace BLL CanWeldingRodName = WeldTask.CanWeldingRodName, CanWeldingWireName = WeldTask.CanWeldingWireName, PipeLineSortIndex = WeldTask.PipeLineSortIndex, - SerialNumber = WeldTask.SerialNumber + SerialNumber = WeldTask.SerialNumber, + TeamGroupId = WeldTask.TeamGroupId }; @@ -172,6 +302,7 @@ namespace BLL newWeldTask.IsSaved = WeldTask.IsSaved; newWeldTask.SerialNumber = WeldTask.SerialNumber; newWeldTask.PipeLineSortIndex = WeldTask.PipeLineSortIndex; + newWeldTask.TeamGroupId = WeldTask.TeamGroupId; db.SubmitChanges(); } } diff --git a/SGGL/BLL/HJGL/WeldingManage/WeldingDailyService.cs b/SGGL/BLL/HJGL/WeldingManage/WeldingDailyService.cs index da5c0c90..516aec11 100644 --- a/SGGL/BLL/HJGL/WeldingManage/WeldingDailyService.cs +++ b/SGGL/BLL/HJGL/WeldingManage/WeldingDailyService.cs @@ -4,11 +4,37 @@ using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; +using System.Transactions; namespace BLL { public partial class WeldingDailyService { + private const string AutoHotProcessRemark = "焊接日报审核自动生成"; + private const int AuditStatePendingTeam = 0; + private const int AuditStatePendingProfessional = 1; + private const int AuditStateApproved = 2; + + private sealed class WeldingDailyTempSaveContext + { + public Model.View_HJGL_WeldJoint Joint { get; set; } + public Model.HJGL_WeldTask WeldTask { get; set; } + public DateTime WeldingDate { get; set; } + public string SubmitPersonId { get; set; } + public string CoverWelderId { get; set; } + public string BackingWelderId { get; set; } + public string JointAttribute { get; set; } + public string WeldingLocationId { get; set; } + public string ProjectId { get; set; } + public string UnitId { get; set; } + public string UnitWorkId { get; set; } + public string WeldingMode { get; set; } + public string WeldingMethodId { get; set; } + public string WeldTypeId { get; set; } + public string WeldingWire { get; set; } + public string WeldingRod { get; set; } + public int? WelderType { get; set; } + } /// ///获取焊接日报信息 /// @@ -312,34 +338,29 @@ namespace BLL return new List(); } - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + var query = QueryPendingWeldingDailyTempDetails().AsQueryable(); + query = query.Where(x => x.ProjectId == projectId); + if (!string.IsNullOrEmpty(unitWorkId)) { - var query = QueryPendingWeldingDailyTempDetails(db); - query = query.Where(x => x.ProjectId == projectId); - if (!string.IsNullOrEmpty(unitWorkId)) - { - query = query.Where(x => x.UnitWorkId == unitWorkId); - } - if (weldingDate.HasValue) - { - DateTime startDate = weldingDate.Value.Date; - DateTime endDate = startDate.AddDays(1); - query = query.Where(x => x.WeldingDate >= startDate && x.WeldingDate < endDate); - } - if (!string.IsNullOrEmpty(pipelineCode)) - { - query = query.Where(x => x.PipelineCode != null && x.PipelineCode.Contains(pipelineCode)); - } - if (!string.IsNullOrEmpty(welderCode)) - { - query = query.Where(x => (x.CoverWelderCode != null && x.CoverWelderCode.Contains(welderCode)) - || (x.BackingWelderCode != null && x.BackingWelderCode.Contains(welderCode))); - } - - var data = query.OrderBy(x => x.PipelineCode).ThenBy(x => x.WeldJointCode).ToList(); - SetWeldingDailyTempDetailAttachUrls(db, data); - return data; + query = query.Where(x => x.UnitWorkId == unitWorkId); } + if (weldingDate.HasValue) + { + DateTime startDate = weldingDate.Value.Date; + DateTime endDate = startDate.AddDays(1); + query = query.Where(x => x.WeldingDate >= startDate && x.WeldingDate < endDate); + } + if (!string.IsNullOrEmpty(pipelineCode)) + { + query = query.Where(x => x.PipelineCode != null && x.PipelineCode.Contains(pipelineCode)); + } + if (!string.IsNullOrEmpty(welderCode)) + { + query = query.Where(x => (x.CoverWelderCode != null && x.CoverWelderCode.Contains(welderCode)) + || (x.BackingWelderCode != null && x.BackingWelderCode.Contains(welderCode))); + } + + return query.OrderBy(x => x.PipelineCode).ThenBy(x => x.WeldJointCode).ToList(); } /// @@ -354,24 +375,19 @@ namespace BLL return null; } - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var data = QueryPendingWeldingDailyTempDetails(db) - .Where(x => x.TempDetailId == tempDetailId) - .Take(1) - .ToList(); - SetWeldingDailyTempDetailAttachUrls(db, data); - return data.FirstOrDefault(); - } + return QueryPendingWeldingDailyTempDetails().FirstOrDefault(x => x.TempDetailId == tempDetailId); } /// /// 构造待审核查询。PC端列表和接口列表、明细均从这里读取,确保字段映射和待审核状态一致。 /// - private static System.Linq.IQueryable QueryPendingWeldingDailyTempDetails(Model.SGGLDB db) + private static List QueryPendingWeldingDailyTempDetails() { - // 待审核模块只展示 AuditState=0;审核、删除仍复用本类下方已有批量业务方法。 - return from temp in db.HJGL_WeldingDailyTempDetail + List data; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + // 查询必须在数据上下文释放前物化,避免返回失效的延迟查询。 + data = (from temp in db.HJGL_WeldingDailyTempDetail join jotItem in db.View_HJGL_WeldJoint on temp.WeldJointId equals jotItem.WeldJointId into jotItems from jot in jotItems.DefaultIfEmpty() join coverItem in db.SitePerson_Person on temp.CoverWelderId equals coverItem.PersonId into coverItems @@ -380,9 +396,21 @@ namespace BLL from backingWelder in backingItems.DefaultIfEmpty() join locationItem in db.Base_WeldingLocation on temp.WeldingLocationId equals locationItem.WeldingLocationId into locationItems from location in locationItems.DefaultIfEmpty() + join weldTypeItem in db.Base_WeldType on temp.WeldTypeId equals weldTypeItem.WeldTypeId into weldTypeItems + from weldType in weldTypeItems.DefaultIfEmpty() + join weldingMethodItem in db.Base_WeldingMethod on temp.WeldingMethodId equals weldingMethodItem.WeldingMethodId into weldingMethodItems + from weldingMethod in weldingMethodItems.DefaultIfEmpty() + join weldingWireItem in db.Base_Consumables on temp.WeldingWire equals weldingWireItem.ConsumablesId into weldingWireItems + from weldingWire in weldingWireItems.DefaultIfEmpty() + join weldingRodItem in db.Base_Consumables on temp.WeldingRod equals weldingRodItem.ConsumablesId into weldingRodItems + from weldingRod in weldingRodItems.DefaultIfEmpty() join submitItem in db.Person_Persons on temp.SubmitPersonId equals submitItem.PersonId into submitItems from submitPerson in submitItems.DefaultIfEmpty() - where temp.AuditState == 0 + join teamAuditItem in db.Person_Persons on temp.TeamAuditMan equals teamAuditItem.PersonId into teamAuditItems + from teamAuditPerson in teamAuditItems.DefaultIfEmpty() + join professionalAuditItem in db.Person_Persons on temp.ProfessionalAuditMan equals professionalAuditItem.PersonId into professionalAuditItems + from professionalAuditPerson in professionalAuditItems.DefaultIfEmpty() + where temp.AuditState < AuditStateApproved select new Model.WeldingDailyTempDetailItem { TempDetailId = temp.TempDetailId, @@ -408,10 +436,14 @@ namespace BLL Size = jot == null ? (decimal?)null : jot.Size, Dia = jot == null ? (decimal?)null : jot.Dia, Thickness = jot == null ? (decimal?)null : jot.Thickness, - WeldTypeCode = jot == null ? null : jot.WeldTypeCode, - WeldingMethodCode = jot == null ? null : jot.WeldingMethodCode, - WeldingWireCode = jot == null ? null : jot.WeldingWireCode, - WeldingRodCode = jot == null ? null : jot.WeldingRodCode, + WeldTypeId = temp.WeldTypeId ?? (jot == null ? null : jot.WeldTypeId), + WeldTypeCode = weldType == null ? (jot == null ? null : jot.WeldTypeCode) : weldType.WeldTypeCode, + WeldingMethodId = temp.WeldingMethodId ?? (jot == null ? null : jot.WeldingMethodId), + WeldingMethodCode = weldingMethod == null ? (jot == null ? null : jot.WeldingMethodCode) : weldingMethod.WeldingMethodCode, + WeldingWire = temp.WeldingWire ?? (jot == null ? null : jot.WeldingWire), + WeldingWireCode = weldingWire == null ? (jot == null ? null : jot.WeldingWireCode) : weldingWire.ConsumablesCode, + WeldingRod = temp.WeldingRod ?? (jot == null ? null : jot.WeldingRod), + WeldingRodCode = weldingRod == null ? (jot == null ? null : jot.WeldingRodCode) : weldingRod.ConsumablesCode, SubmitPersonId = temp.SubmitPersonId, SubmitPersonName = submitPerson == null ? null : submitPerson.PersonName, SubmitDate = temp.SubmitDate, @@ -419,15 +451,24 @@ namespace BLL AuditState = temp.AuditState, AuditMan = temp.AuditMan, AuditDate = temp.AuditDate, - AuditRemark = temp.AuditRemark - }; + AuditRemark = temp.AuditRemark, + TeamAuditMan = temp.TeamAuditMan, + TeamAuditManName = teamAuditPerson == null ? null : teamAuditPerson.PersonName, + TeamAuditDate = temp.TeamAuditDate, + ProfessionalAuditMan = temp.ProfessionalAuditMan, + ProfessionalAuditManName = professionalAuditPerson == null ? null : professionalAuditPerson.PersonName, + ProfessionalAuditDate = temp.ProfessionalAuditDate, + AuditStateText = temp.AuditState == AuditStatePendingTeam ? "待班组审核" : "待专工审核" + }).ToList(); + } + SetWeldingDailyTempDetailAttachUrls(data); + return data; } /// /// 按待审核明细ID批量回写焊前、焊后附件地址。 /// - private static void SetWeldingDailyTempDetailAttachUrls(Model.SGGLDB db, - List data) + private static void SetWeldingDailyTempDetailAttachUrls(List data) { if (data == null || data.Count == 0) { @@ -439,12 +480,16 @@ namespace BLL x.TempDetailId + "#Before", x.TempDetailId + "#After" }).ToList(); - var attachUrlMap = db.AttachFile - .Where(x => x.MenuId == Const.HJGL_WeldReportMenuId && toKeyIds.Contains(x.ToKeyId)) - .Select(x => new { x.ToKeyId, x.AttachUrl }) - .ToList() - .GroupBy(x => x.ToKeyId) - .ToDictionary(x => x.Key, x => x.Select(y => y.AttachUrl).FirstOrDefault()); + Dictionary attachUrlMap; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + attachUrlMap = db.AttachFile + .Where(x => x.MenuId == Const.HJGL_WeldReportMenuId && toKeyIds.Contains(x.ToKeyId)) + .Select(x => new { x.ToKeyId, x.AttachUrl }) + .ToList() + .GroupBy(x => x.ToKeyId) + .ToDictionary(x => x.Key, x => x.Select(y => y.AttachUrl).FirstOrDefault()); + } foreach (var item in data) { @@ -479,14 +524,15 @@ namespace BLL /// 错误信息 public static string SaveWeldingDailyTempDetailByMobile(string weldJointId, string personId, string time, string weldingLocationId, int welderType) { - return SaveWeldingDailyTempDetailByMobile(weldJointId, personId, time, weldingLocationId, welderType, null, null); + return SaveWeldingDailyTempDetailByMobile(weldJointId, personId, time, weldingLocationId, welderType, null, null, null, null); } /// - /// 移动端按焊口保存焊接日报待审核明细,并按需同步焊接方法和焊缝类型。 + /// 移动端按焊口保存焊接日报待审核明细及实际焊接工艺快照。 /// public static string SaveWeldingDailyTempDetailByMobile(string weldJointId, string personId, string time, - string weldingLocationId, int welderType, string weldingMethodId, string weldTypeId) + string weldingLocationId, int welderType, string weldingMethodId, string weldTypeId, + string weldingWire, string weldingRod) { string res = string.Empty; using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) @@ -507,7 +553,7 @@ namespace BLL } var joint = db.View_HJGL_WeldJoint.FirstOrDefault(x => x.WeldJointId == weldJointId); - string err = CheckWeldingDailyTempJoint(db, joint, weldingLocationId); + string err = CheckWeldingDailyTempJoint(joint, weldingLocationId); if (!string.IsNullOrEmpty(err)) { return err; @@ -515,38 +561,39 @@ 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 (weldJoint == null) + { + return "焊口不存在"; + } - // 兼容旧版小程序:只有两个参数同时存在时才成对更新,避免焊口工艺信息出现半更新。 - if (!string.IsNullOrWhiteSpace(weldingMethodId) && !string.IsNullOrWhiteSpace(weldTypeId)) + string parameterError = ValidatePendingWeldingParameters(weldingMethodId, weldTypeId, weldingWire, weldingRod); + if (!string.IsNullOrEmpty(parameterError)) { - weldJoint.WeldingMethodId = weldingMethodId; - weldJoint.WeldTypeId = weldTypeId; + return parameterError; } - var pending = GetPendingTempDetail(db, weldJointId, weldingDate); - - string coverWelderId = pending != null ? pending.CoverWelderId : weldJoint.CoverWelderId; - string backingWelderId = pending != null ? pending.BackingWelderId : weldJoint.BackingWelderId; - if (welderType == 0) - { - coverWelderId = personId; - backingWelderId = personId; - } - else if (welderType == 1) - { - backingWelderId = personId; - } - else if (welderType == 2) - { - coverWelderId = personId; - } - else + if (welderType < 0 || welderType > 2) { return "焊工类型不正确"; } - SaveWeldingDailyTempDetail(db, joint, weldTask, weldingDate, personId, coverWelderId, backingWelderId, - joint.JointAttribute, weldingLocationId, joint.ProjectId, null, null, joint.WeldingMode); - db.SubmitChanges(); + SaveWeldingDailyTempDetail(new WeldingDailyTempSaveContext + { + Joint = joint, + WeldTask = weldTask, + WeldingDate = weldingDate, + SubmitPersonId = personId, + CoverWelderId = weldJoint.CoverWelderId, + BackingWelderId = weldJoint.BackingWelderId, + JointAttribute = joint.JointAttribute, + WeldingLocationId = weldingLocationId, + ProjectId = joint.ProjectId, + WeldingMode = joint.WeldingMode, + WeldingMethodId = weldingMethodId, + WeldTypeId = weldTypeId, + WeldingWire = weldingWire, + WeldingRod = weldingRod, + WelderType = welderType + }); } catch (Exception ex) { @@ -595,7 +642,7 @@ namespace BLL } var joint = db.View_HJGL_WeldJoint.FirstOrDefault(x => x.WeldJointId == weldJointId); - string err = CheckWeldingDailyTempJoint(db, joint, weldingLocationId); + string err = CheckWeldingDailyTempJoint(joint, weldingLocationId); if (!string.IsNullOrEmpty(err)) { return err; @@ -613,9 +660,21 @@ namespace BLL } var weldTask = db.HJGL_WeldTask.FirstOrDefault(x => x.WeldJointId == weldJointId); - SaveWeldingDailyTempDetail(db, joint, weldTask, weldingDate, submitPersonId, coverWelderId, backingWelderId, - jointAttribute, weldingLocationId, projectId, unitId, unitWorkId, weldingMode); - db.SubmitChanges(); + SaveWeldingDailyTempDetail(new WeldingDailyTempSaveContext + { + Joint = joint, + WeldTask = weldTask, + WeldingDate = weldingDate, + SubmitPersonId = submitPersonId, + CoverWelderId = coverWelderId, + BackingWelderId = backingWelderId, + JointAttribute = jointAttribute, + WeldingLocationId = weldingLocationId, + ProjectId = projectId, + UnitId = unitId, + UnitWorkId = unitWorkId, + WeldingMode = weldingMode + }); } catch (Exception ex) { @@ -627,7 +686,46 @@ namespace BLL } /// - /// 审核通过焊接日报待审核明细 + /// 班组审核焊接日报待审核明细,只记录班组审核留痕,不生成正式日报。 + /// + public static string TeamAuditWeldingDailyTempDetails(string[] tempDetailIds, string auditMan) + { + if (tempDetailIds == null || tempDetailIds.Length == 0) return "请选择要审核的记录"; + if (string.IsNullOrWhiteSpace(auditMan)) return "班组审核人不能为空"; + string errlog = string.Empty; + using (var scope = new TransactionScope()) + { + foreach (string id in tempDetailIds.Where(x => !string.IsNullOrEmpty(x)).Distinct()) + { + var detail = GetLockedWeldingDailyTempDetail(id); + if (detail == null) + { + errlog += "待审核记录不存在;"; + continue; + } + if (detail.AuditState != AuditStatePendingTeam) + { + errlog += "记录不是待班组审核状态;"; + continue; + } + if (!HasCompleteWelders(detail)) + { + // 班组审核后记录不再允许补录,必须在状态流转前保证两类焊工完整。 + errlog += "焊口待审核记录未选择完整焊工;"; + continue; + } + detail.TeamAuditMan = auditMan; + detail.TeamAuditDate = DateTime.Now; + detail.AuditState = AuditStatePendingProfessional; + } + Funs.DB.SubmitChanges(); + scope.Complete(); + } + return errlog; + } + + /// + /// 专工审核通过焊接日报待审核明细,并生成正式日报及热处理委托。 /// /// 待审核明细ID集合 /// 审核人 @@ -639,61 +737,90 @@ namespace BLL { return "请选择要审核的记录"; } + if (string.IsNullOrWhiteSpace(auditMan)) return "专工审核人不能为空"; - foreach (string tempDetailId in tempDetailIds.Where(x => !string.IsNullOrEmpty(x)).Distinct()) + var sharedConnection = (SqlConnection)Funs.DB.Connection; + bool closeConnection = sharedConnection.State != ConnectionState.Open; + try { - var tempDetail = Funs.DB.HJGL_WeldingDailyTempDetail.FirstOrDefault(x => x.TempDetailId == tempDetailId); - if (tempDetail == null) + using (var scope = new TransactionScope()) { - errlog += "待审核记录不存在;"; - continue; - } - if (tempDetail.AuditState != 0) - { - errlog += "焊口待审核记录已审核;"; - continue; - } - if (string.IsNullOrEmpty(tempDetail.CoverWelderId) || string.IsNullOrEmpty(tempDetail.BackingWelderId)) - { - errlog += "焊口待审核记录未选择完整焊工;"; - continue; - } + // 整个专工审核事务保持单一连接 + if (closeConnection) sharedConnection.Open(); + foreach (string tempDetailId in tempDetailIds.Where(x => !string.IsNullOrEmpty(x)).Distinct()) + { + var tempDetail = GetLockedWeldingDailyTempDetail(tempDetailId); + if (tempDetail == null) + { + errlog += "待审核记录不存在;"; + continue; + } + if (tempDetail.AuditState != AuditStatePendingProfessional || !tempDetail.TeamAuditDate.HasValue) + { + errlog += "焊口待审核记录尚未完成班组审核;"; + continue; + } + if (!HasCompleteWelders(tempDetail)) + { + errlog += "焊口待审核记录未选择完整焊工;"; + continue; + } - var weldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(tempDetail.WeldJointId); - if (weldJoint == null) - { - errlog += "焊口不存在;"; - continue; - } - if (!string.IsNullOrEmpty(weldJoint.WeldingDailyId)) - { - errlog += "焊口【" + weldJoint.WeldJointCode + "】已生成焊接日报;"; - continue; - } + var weldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(tempDetail.WeldJointId); + if (weldJoint == null) + { + errlog += "焊口不存在;"; + continue; + } + if (!string.IsNullOrEmpty(weldJoint.WeldingDailyId)) + { + errlog += "焊口【" + weldJoint.WeldJointCode + "】已生成焊接日报;"; + continue; + } - var batchC = BLL.Project_SysSetService.GetSysSetBySetId("5", tempDetail.ProjectId); - if (batchC == null) - { - errlog += "请设置项目的组批条件;"; - continue; - } + var batchC = BLL.Project_SysSetService.GetSysSetBySetId("5", tempDetail.ProjectId); + if (batchC == null) + { + errlog += "请设置项目的组批条件;"; + continue; + } - var weldingDaily = GetOrCreateWeldingDailyByTempDetail(tempDetail); - string itemErr = InsertWeldingDailyItem(tempDetail.WeldJointId, tempDetail.CoverWelderId, tempDetail.BackingWelderId, - tempDetail.JointAttribute, weldingDaily.WeldingDate, batchC.SetValue, true, weldingDaily.WeldingDailyId, - tempDetail.ProjectId, tempDetail.WeldingLocationId); - if (!string.IsNullOrEmpty(itemErr)) - { - errlog += itemErr; - continue; - } + var weldingDaily = GetOrCreateWeldingDailyByTempDetail(tempDetail); - BLL.HJGL_PipelineComponentjointService.UpdateStateByWeldJointId(tempDetail.WeldJointId, (DateTime)weldingDaily.WeldingDate);//更改预制口实际时间和状态 - PipelineService.UpdataDateByWeldJointId(tempDetail.WeldJointId);//更改安装口时间和状态 - tempDetail.AuditState = 1; - tempDetail.AuditMan = auditMan; - tempDetail.AuditDate = DateTime.Now; - Funs.DB.SubmitChanges(); + // 实际工艺参数在专工审核事务内才回写焊口,审核失败时与正式日报一起回滚。 + weldJoint.WeldingMethodId = FirstNotEmpty(tempDetail.WeldingMethodId, weldJoint.WeldingMethodId); + weldJoint.WeldTypeId = FirstNotEmpty(tempDetail.WeldTypeId, weldJoint.WeldTypeId); + weldJoint.WeldingWire = FirstNotEmpty(tempDetail.WeldingWire, weldJoint.WeldingWire); + weldJoint.WeldingRod = FirstNotEmpty(tempDetail.WeldingRod, weldJoint.WeldingRod); + Funs.DB.SubmitChanges(); + + string itemErr = InsertWeldingDailyItem(tempDetail.WeldJointId, tempDetail.CoverWelderId, tempDetail.BackingWelderId, + tempDetail.JointAttribute, weldingDaily.WeldingDate, batchC.SetValue, true, weldingDaily.WeldingDailyId, + tempDetail.ProjectId, tempDetail.WeldingLocationId, sharedConnection); + if (!string.IsNullOrEmpty(itemErr)) + { + // 正式日报、焊口状态、组批和自动热处理委托必须整体成功,任一步失败即回滚本次审核。 + throw new InvalidOperationException(itemErr); + } + + BLL.HJGL_PipelineComponentjointService.UpdateStateByWeldJointId(tempDetail.WeldJointId, (DateTime)weldingDaily.WeldingDate); + PipelineService.UpdataDateByWeldJointId(tempDetail.WeldJointId); + tempDetail.AuditState = AuditStateApproved; + tempDetail.ProfessionalAuditMan = auditMan; + tempDetail.ProfessionalAuditDate = DateTime.Now; + // 旧字段继续镜像专工审核信息,兼容历史查询和报表。 + tempDetail.AuditMan = auditMan; + tempDetail.AuditDate = tempDetail.ProfessionalAuditDate; + EnsureAutomaticHotProcessTrust(tempDetail, weldJoint, auditMan); + Funs.DB.SubmitChanges(); + } + scope.Complete(); + } + } + finally + { + // 在 TransactionScope 完成提交或回滚后再释放连接。 + if (closeConnection && sharedConnection.State != ConnectionState.Closed) sharedConnection.Close(); } return errlog; @@ -719,7 +846,7 @@ namespace BLL { continue; } - if (tempDetail.AuditState != 0) + if (tempDetail.AuditState != AuditStatePendingTeam) { errlog += "已审核记录不能删除;"; continue; @@ -730,66 +857,210 @@ namespace BLL return errlog; } - private static string CheckWeldingDailyTempJoint(Model.SGGLDB db, Model.View_HJGL_WeldJoint joint, string weldingLocationId) + /// + /// 将需要热处理的焊口归入焊接完成日期当天的自动热处理委托。 + /// + private static void EnsureAutomaticHotProcessTrust(Model.HJGL_WeldingDailyTempDetail tempDetail, + Model.HJGL_WeldJoint weldJoint, string auditMan) { - if (joint == null) + if (weldJoint.IsHotProess != true) return; + if (Funs.DB.HJGL_HotProess_TrustItem.Any(x => x.WeldJointId == weldJoint.WeldJointId)) return; + + DateTime processDate = tempDetail.WeldingDate.Date; + var trust = Funs.DB.HJGL_HotProess_Trust.FirstOrDefault(x => x.ProjectId == tempDetail.ProjectId + && x.UnitWorkId == tempDetail.UnitWorkId && x.ProessDate.HasValue + && x.ProessDate.Value >= processDate && x.ProessDate.Value < processDate.AddDays(1) + && x.Remark == AutoHotProcessRemark); + if (trust == null) { - return "焊口不存在"; + // 在当前事务内锁定同项目、单位工程编号范围,防止并发审核产生重复流水号。 + var lockedNumbers = Funs.DB.ExecuteQuery( + "SELECT HotProessTrustNo FROM dbo.HJGL_HotProess_Trust WITH (UPDLOCK,HOLDLOCK) WHERE ProjectId={0} AND UnitWorkId={1}", + tempDetail.ProjectId, tempDetail.UnitWorkId).ToList(); + var unitWork = Funs.DB.WBS_UnitWork.FirstOrDefault(x => x.UnitWorkId == tempDetail.UnitWorkId); + string unitWorkName = unitWork == null ? string.Empty : unitWork.UnitWorkName; + string prefix = "FCC-" + unitWorkName + "-RCL-SPCECC-"; + int serial = lockedNumbers.Where(x => !string.IsNullOrEmpty(x) && x.StartsWith(prefix)) + .Select(ParseTrailingSerial).DefaultIfEmpty(0).Max() + 1; + if (serial > 999) throw new InvalidOperationException("热处理委托编号三位流水号已用完。"); + + trust = new Model.HJGL_HotProess_Trust + { + HotProessTrustId = SQLHelper.GetNewID(), + HotProessTrustNo = prefix + serial.ToString("D3"), + ProessDate = processDate, + ProjectId = tempDetail.ProjectId, + UnitWorkId = tempDetail.UnitWorkId, + UnitId = tempDetail.UnitId, + Tabler = auditMan, + Remark = AutoHotProcessRemark + }; + Funs.DB.HJGL_HotProess_Trust.InsertOnSubmit(trust); } - if (!string.IsNullOrEmpty(joint.WeldingDailyId)) + + Funs.DB.HJGL_HotProess_TrustItem.InsertOnSubmit(new Model.HJGL_HotProess_TrustItem { - return "焊口【" + joint.WeldJointCode + "】已生成焊接日报,不能提交待审核"; - } - if (!string.IsNullOrEmpty(weldingLocationId)) + HotProessTrustItemId = SQLHelper.GetNewID(), + HotProessTrustId = trust.HotProessTrustId, + WeldJointId = weldJoint.WeldJointId, + IsCompleted = false + }); + } + + private static int ParseTrailingSerial(string code) + { + if (string.IsNullOrEmpty(code)) return 0; + int separator = code.LastIndexOf('-'); + int value; + return separator >= 0 && int.TryParse(code.Substring(separator + 1), out value) ? value : 0; + } + + private static string CheckWeldingDailyTempJoint(Model.View_HJGL_WeldJoint joint, string weldingLocationId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - var weldingLocationModel = db.Base_WeldingLocation.FirstOrDefault(x => x.WeldingLocationId == weldingLocationId); - if (weldingLocationModel == null) + if (joint == null) + { + return "焊口不存在"; + } + if (!string.IsNullOrEmpty(joint.WeldingDailyId)) + { + return "焊口【" + joint.WeldJointCode + "】已生成焊接日报,不能提交待审核"; + } + if (!string.IsNullOrEmpty(weldingLocationId) + && !db.Base_WeldingLocation.Any(x => x.WeldingLocationId == weldingLocationId)) { return "焊口位置不存在"; } + return string.Empty; } - return string.Empty; } - private static Model.HJGL_WeldingDailyTempDetail GetPendingTempDetail(Model.SGGLDB db, string weldJointId, DateTime weldingDate) + private static Model.HJGL_WeldingDailyTempDetail GetLockedWeldingDailyTempDetail(string tempDetailId) { - return db.HJGL_WeldingDailyTempDetail.FirstOrDefault(x => x.WeldJointId == weldJointId - && x.WeldingDate >= weldingDate.Date - && x.WeldingDate < weldingDate.Date.AddDays(1) - && x.AuditState == 0); - } - - private static void SaveWeldingDailyTempDetail(Model.SGGLDB db, Model.View_HJGL_WeldJoint joint, Model.HJGL_WeldTask weldTask, - DateTime weldingDate, string submitPersonId, string coverWelderId, string backingWelderId, string jointAttribute, - string weldingLocationId, string projectId, string unitId, string unitWorkId, string weldingMode) - { - var pending = GetPendingTempDetail(db, joint.WeldJointId, weldingDate); - if (pending == null) + // 审核事务内锁定状态行,避免并发审核覆盖审核人和状态。 + Funs.DB.ExecuteQuery( + "SELECT AuditState FROM dbo.HJGL_WeldingDailyTempDetail WITH (UPDLOCK,HOLDLOCK) WHERE TempDetailId={0}", tempDetailId) + .FirstOrDefault(); + var detail = Funs.DB.HJGL_WeldingDailyTempDetail.FirstOrDefault(x => x.TempDetailId == tempDetailId); + if (detail != null) { - pending = new Model.HJGL_WeldingDailyTempDetail - { - TempDetailId = Guid.NewGuid().ToString(), - WeldJointId = joint.WeldJointId, - WeldingDate = weldingDate.Date, - AuditState = 0, - SubmitDate = DateTime.Now - }; - db.HJGL_WeldingDailyTempDetail.InsertOnSubmit(pending); + Funs.DB.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, detail); } - - pending.ProjectId = !string.IsNullOrEmpty(projectId) ? projectId : joint.ProjectId; - pending.UnitId = !string.IsNullOrEmpty(unitId) ? unitId : (weldTask != null && !string.IsNullOrEmpty(weldTask.UnitId) ? weldTask.UnitId : joint.UnitId); - pending.UnitWorkId = !string.IsNullOrEmpty(unitWorkId) ? unitWorkId : joint.UnitWorkId; - pending.CoverWelderId = coverWelderId; - pending.BackingWelderId = backingWelderId; - pending.JointAttribute = !string.IsNullOrEmpty(jointAttribute) ? jointAttribute : joint.JointAttribute; - pending.WeldingLocationId = !string.IsNullOrEmpty(weldingLocationId) ? weldingLocationId : joint.WeldingLocationId; - pending.WeldingMode = !string.IsNullOrEmpty(weldingMode) ? weldingMode : joint.WeldingMode; - pending.SubmitPersonId = submitPersonId; - pending.SubmitDate = DateTime.Now; + return detail; } - private static Model.HJGL_WeldingDaily GetOrCreateWeldingDailyByTempDetail(Model.HJGL_WeldingDailyTempDetail tempDetail) + private static bool HasCompleteWelders(Model.HJGL_WeldingDailyTempDetail detail) + { + return detail != null + && !string.IsNullOrEmpty(detail.CoverWelderId) + && !string.IsNullOrEmpty(detail.BackingWelderId); + } + + private static void SaveWeldingDailyTempDetail(WeldingDailyTempSaveContext context) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + DateTime startDate = context.WeldingDate.Date; + DateTime endDate = startDate.AddDays(1); + var existingDetails = db.HJGL_WeldingDailyTempDetail + .Where(x => x.WeldJointId == context.Joint.WeldJointId + && x.WeldingDate >= startDate + && x.WeldingDate < endDate) + .ToList(); + if (existingDetails.Any(x => x.AuditState == AuditStatePendingProfessional)) + { + // 状态1已形成班组审核留痕,禁止再次提交生成另一条状态0记录。 + throw new InvalidOperationException("焊口【" + context.Joint.WeldJointCode + "】当日记录已完成班组审核,不能重复提交"); + } + + var pending = existingDetails.FirstOrDefault(x => x.AuditState == AuditStatePendingTeam); + if (pending == null) + { + pending = new Model.HJGL_WeldingDailyTempDetail + { + TempDetailId = Guid.NewGuid().ToString(), + WeldJointId = context.Joint.WeldJointId, + WeldingDate = context.WeldingDate.Date, + AuditState = AuditStatePendingTeam, + SubmitDate = DateTime.Now + }; + db.HJGL_WeldingDailyTempDetail.InsertOnSubmit(pending); + } + + string coverWelderId = context.CoverWelderId; + string backingWelderId = context.BackingWelderId; + if (context.WelderType.HasValue) + { + // 移动端支持打底、盖面分次提交,优先保留当前待审核记录已经提交的焊工。 + coverWelderId = !string.IsNullOrEmpty(pending.CoverWelderId) ? pending.CoverWelderId : coverWelderId; + backingWelderId = !string.IsNullOrEmpty(pending.BackingWelderId) ? pending.BackingWelderId : backingWelderId; + if (context.WelderType.Value == 0 || context.WelderType.Value == 2) + { + coverWelderId = context.SubmitPersonId; + } + if (context.WelderType.Value == 0 || context.WelderType.Value == 1) + { + backingWelderId = context.SubmitPersonId; + } + } + + pending.ProjectId = !string.IsNullOrEmpty(context.ProjectId) ? context.ProjectId : context.Joint.ProjectId; + pending.UnitId = !string.IsNullOrEmpty(context.UnitId) ? context.UnitId + : (context.WeldTask != null && !string.IsNullOrEmpty(context.WeldTask.UnitId) ? context.WeldTask.UnitId : context.Joint.UnitId); + pending.UnitWorkId = !string.IsNullOrEmpty(context.UnitWorkId) ? context.UnitWorkId : context.Joint.UnitWorkId; + pending.CoverWelderId = coverWelderId; + pending.BackingWelderId = backingWelderId; + pending.JointAttribute = !string.IsNullOrEmpty(context.JointAttribute) ? context.JointAttribute : context.Joint.JointAttribute; + pending.WeldingLocationId = !string.IsNullOrEmpty(context.WeldingLocationId) ? context.WeldingLocationId : context.Joint.WeldingLocationId; + pending.WeldingMode = !string.IsNullOrEmpty(context.WeldingMode) ? context.WeldingMode : context.Joint.WeldingMode; + // 同一焊口可能由打底、盖面分次提交;未传参数时保留已有快照,再回退到焊口当前值。 + pending.WeldingMethodId = FirstNotEmpty(context.WeldingMethodId, pending.WeldingMethodId, context.Joint.WeldingMethodId); + pending.WeldTypeId = FirstNotEmpty(context.WeldTypeId, pending.WeldTypeId, context.Joint.WeldTypeId); + pending.WeldingWire = FirstNotEmpty(context.WeldingWire, pending.WeldingWire, context.Joint.WeldingWire); + pending.WeldingRod = FirstNotEmpty(context.WeldingRod, pending.WeldingRod, context.Joint.WeldingRod); + pending.SubmitPersonId = context.SubmitPersonId; + pending.SubmitDate = DateTime.Now; + db.SubmitChanges(); + } + } + + private static string ValidatePendingWeldingParameters(string weldingMethodId, + string weldTypeId, string weldingWire, string weldingRod) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + if (!string.IsNullOrWhiteSpace(weldingMethodId) + && !db.Base_WeldingMethod.Any(x => x.WeldingMethodId == weldingMethodId)) + { + return "焊接方法不存在"; + } + if (!string.IsNullOrWhiteSpace(weldTypeId) + && !db.Base_WeldType.Any(x => x.WeldTypeId == weldTypeId)) + { + return "焊缝类型不存在"; + } + if (!string.IsNullOrWhiteSpace(weldingWire) + && !db.Base_Consumables.Any(x => x.ConsumablesId == weldingWire && x.ConsumablesType == "1")) + { + return "焊丝不存在或焊材类型不正确"; + } + if (!string.IsNullOrWhiteSpace(weldingRod) + && !db.Base_Consumables.Any(x => x.ConsumablesId == weldingRod && x.ConsumablesType == "2")) + { + return "焊条不存在或焊材类型不正确"; + } + return string.Empty; + } + } + + private static string FirstNotEmpty(params string[] values) + { + return values == null ? null : values.FirstOrDefault(x => !string.IsNullOrWhiteSpace(x)); + } + + private static Model.HJGL_WeldingDaily GetOrCreateWeldingDailyByTempDetail( + Model.HJGL_WeldingDailyTempDetail tempDetail) { var weldingDaily = Funs.DB.HJGL_WeldingDaily.FirstOrDefault(x => x.UnitWorkId == tempDetail.UnitWorkId && x.WeldingDate >= tempDetail.WeldingDate.Date @@ -802,10 +1073,18 @@ namespace BLL var submitUnitwork = Funs.DB.WBS_UnitWork.FirstOrDefault(x => x.UnitWorkId == tempDetail.UnitWorkId); string unitWorkName = submitUnitwork != null ? submitUnitwork.UnitWorkName : string.Empty; string perfix = string.Format("{0:yyyyMMdd}", tempDetail.WeldingDate) + "-" + unitWorkName + "-"; + // 直接读取当前最大编号并在内存中生成三位流水号,不再调用 SpGetThreeNumber。 + string maxNumber = Funs.DB.HJGL_WeldingDaily + .Where(x => x.ProjectId == tempDetail.ProjectId + && x.WeldingDailyCode != null + && x.WeldingDailyCode.StartsWith(perfix)) + .Select(x => x.WeldingDailyCode) + .OrderByDescending(x => x) + .FirstOrDefault(); weldingDaily = new Model.HJGL_WeldingDaily { WeldingDailyId = Guid.NewGuid().ToString(), - WeldingDailyCode = BLL.SQLHelper.RunProcNewId("SpGetThreeNumber", "dbo.HJGL_WeldingDaily", "WeldingDailyCode", tempDetail.ProjectId, perfix), + WeldingDailyCode = Funs.GetThreeNumber(maxNumber, perfix), WeldingDate = tempDetail.WeldingDate.Date, ProjectId = tempDetail.ProjectId, UnitWorkId = tempDetail.UnitWorkId, @@ -837,7 +1116,9 @@ namespace BLL /// 项目ID /// 焊接位置ID /// 错误信息 - private static string InsertWeldingDailyItem(string weldJointId, string coverWelderId, string backingWelderId, string jointAttribute, DateTime? weldingDate, string batchCondition, bool isSave, string weldingDailyId, string projectId, string weldingLocationId) + private static string InsertWeldingDailyItem(string weldJointId, string coverWelderId, string backingWelderId, + string jointAttribute, DateTime? weldingDate, string batchCondition, bool isSave, string weldingDailyId, + string projectId, string weldingLocationId, SqlConnection sharedConnection) { string errlog = string.Empty; var newWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(weldJointId); @@ -872,7 +1153,8 @@ namespace BLL // 更新焊口号 修改固定焊口号后 +G BLL.WeldJointService.UpdateWeldJointAddG(newWeldJoint.WeldJointId, newWeldJoint.JointAttribute, Const.BtnAdd); - errlog = PointBatchService.AddBatchByWeldJointId(weldJointId, weldingDate, batchCondition);//自动组批 + errlog = PointBatchService.AddBatchByWeldJointId( + weldJointId, weldingDate, batchCondition, sharedConnection);//自动组批 } } else diff --git a/SGGL/FineUIPro.Web/CLGL/AntiCorrosionCheckRecordEdit.aspx.cs b/SGGL/FineUIPro.Web/CLGL/AntiCorrosionCheckRecordEdit.aspx.cs index 775f7d87..f2ed9b6a 100644 --- a/SGGL/FineUIPro.Web/CLGL/AntiCorrosionCheckRecordEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/CLGL/AntiCorrosionCheckRecordEdit.aspx.cs @@ -97,10 +97,16 @@ namespace FineUIPro.Web.CLGL CreateUser = CurrUser.PersonId }; - AntiCorrosionCheckId = APIPreWeldInspectionService.SaveAntiCorrosionCheck(item); - - ShowNotify("保存成功!", MessageBoxIcon.Success); - PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); + try + { + AntiCorrosionCheckId = APIPreWeldInspectionService.SaveAntiCorrosionCheck(item); + ShowNotify("保存成功!", MessageBoxIcon.Success); + PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); + } + catch (ArgumentException ex) + { + ShowNotify(ex.Message, MessageBoxIcon.Warning); + } } protected void btnAttachUrl_Click(object sender, EventArgs e) diff --git a/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrust.aspx b/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrust.aspx index 7af47213..779598c9 100644 --- a/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrust.aspx +++ b/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrust.aspx @@ -45,7 +45,7 @@ - + @@ -85,8 +85,8 @@ - + diff --git a/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrust.aspx.cs b/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrust.aspx.cs index c72c93d6..53767878 100644 --- a/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrust.aspx.cs +++ b/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrust.aspx.cs @@ -28,7 +28,7 @@ namespace FineUIPro.Web.CLGL ProjectId = this.CurrUser.LoginProjectId, UnitWorkId = tvControlItem.SelectedNodeID, TrustCode = txtTrustCode.Text.Trim(), - OutputMasterCode = txtOutputMasterCode.Text.Trim() + WeldTaskCode = txtWeldTaskCode.Text.Trim() }; Grid1.DataSource = TwAntiCorrosionTrustService.GetListData(filter, Grid1); Grid1.RecordCount = TwAntiCorrosionTrustService.Count; diff --git a/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrust.aspx.designer.cs b/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrust.aspx.designer.cs index 1177f5a6..1e1bafc6 100644 --- a/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrust.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrust.aspx.designer.cs @@ -123,13 +123,13 @@ namespace FineUIPro.Web.CLGL protected global::FineUIPro.TextBox txtTrustCode; /// - /// txtOutputMasterCode 控件。 + /// txtWeldTaskCode 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.TextBox txtOutputMasterCode; + protected global::FineUIPro.TextBox txtWeldTaskCode; /// /// ToolbarFill1 控件。 diff --git a/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrustEdit.aspx b/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrustEdit.aspx index 485d3464..eb2c8190 100644 --- a/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrustEdit.aspx +++ b/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrustEdit.aspx @@ -51,8 +51,8 @@ - @@ -81,6 +81,13 @@ + + + + + + @@ -102,6 +109,15 @@ + + + + + + + + diff --git a/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrustEdit.aspx.cs b/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrustEdit.aspx.cs index 89f75728..f62509fe 100644 --- a/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrustEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrustEdit.aspx.cs @@ -22,6 +22,12 @@ namespace FineUIPro.Web.CLGL set { ViewState["UnitWorkId"] = value; } } + public string HotProessTrustId + { + get { return (string)ViewState["HotProessTrustId"]; } + set { ViewState["HotProessTrustId"] = value; } + } + public string PaintCodeJson { get @@ -54,7 +60,8 @@ namespace FineUIPro.Web.CLGL txtDemandDate.Text = string.Format("{0:yyyy-MM-dd}", trust.DemandDate); txtCompleteDate.Text = string.Format("{0:yyyy-MM-dd}", trust.CompleteDate); txtRemark.Text = trust.Remark; - InitOutputMasterDropDown(trust.OutputMasterId); + HotProessTrustId = trust.HotProessTrustId; + InitWeldTaskDropDown(trust.WeldTaskCode); BindGrid(TwAntiCorrosionTrustService.GetDetailList(TrustId)); } else @@ -66,30 +73,28 @@ namespace FineUIPro.Web.CLGL txtUnitWorkName.Text = unitWork.UnitWorkName; } txtTrustCode.Text = TwAntiCorrosionTrustService.GenerateTrustCode(UnitWorkId); - InitOutputMasterDropDown(null); + InitWeldTaskDropDown(Request.Params["TaskCode"]); BindGrid(new List()); + if (!string.IsNullOrEmpty(Request.Params["TaskCode"])) + { + drpWeldTask.SelectedValue = Request.Params["TaskCode"]; + BindGrid(TwAntiCorrosionTrustService.GetDetailsByTaskCode(this.CurrUser.LoginProjectId, Request.Params["TaskCode"])); + } } } - private void InitOutputMasterDropDown(string selectedOutputMasterId) + private void InitWeldTaskDropDown(string selectedTaskCode) { - drpOutputMaster.DataTextField = "CusBillCode"; - drpOutputMaster.DataValueField = "Id"; - var list = TwAntiCorrosionTrustService.GetAvailableOutputMasters(this.CurrUser.LoginProjectId, UnitWorkId, TrustId); - if (!string.IsNullOrEmpty(selectedOutputMasterId) && list.All(x => x.Id != selectedOutputMasterId)) + drpWeldTask.DataTextField = "Text"; + drpWeldTask.DataValueField = "TaskCode"; + var list = TwAntiCorrosionTrustService.GetAvailableWeldTasks(this.CurrUser.LoginProjectId, UnitWorkId, TrustId) + .Select(x => new { x.TaskCode, Text = x.TaskCode + "(" + x.TeamGroupName + ")" }).ToList(); + drpWeldTask.DataSource = list; + drpWeldTask.DataBind(); + Funs.FineUIPleaseSelect(drpWeldTask); + if (!string.IsNullOrEmpty(selectedTaskCode)) { - var current = TwAntiCorrosionTrustService.GetOutputMasterById(selectedOutputMasterId); - if (current != null) - { - list.Insert(0, current); - } - } - drpOutputMaster.DataSource = list; - drpOutputMaster.DataBind(); - Funs.FineUIPleaseSelect(drpOutputMaster); - if (!string.IsNullOrEmpty(selectedOutputMasterId)) - { - drpOutputMaster.SelectedValue = selectedOutputMasterId; + drpWeldTask.SelectedValue = selectedTaskCode; } } @@ -108,11 +113,11 @@ namespace FineUIPro.Web.CLGL Grid1.DataBind(); } - protected void drpOutputMaster_SelectedIndexChanged(object sender, EventArgs e) + protected void drpWeldTask_SelectedIndexChanged(object sender, EventArgs e) { - if (drpOutputMaster.SelectedValue != Const._Null) + if (drpWeldTask.SelectedValue != Const._Null) { - BindGrid(TwAntiCorrosionTrustService.GetDetailsByOutputMasterId(drpOutputMaster.SelectedValue)); + BindGrid(TwAntiCorrosionTrustService.GetDetailsByTaskCode(this.CurrUser.LoginProjectId, drpWeldTask.SelectedValue)); } else { @@ -122,7 +127,7 @@ namespace FineUIPro.Web.CLGL protected void btnSave_Click(object sender, EventArgs e) { - var trust = SaveTrust(); + var trust = SaveTrust(false); if (trust == null) { return; @@ -134,7 +139,7 @@ namespace FineUIPro.Web.CLGL protected void btnSubmit_Click(object sender, EventArgs e) { - var trust = SaveTrust(); + var trust = SaveTrust(true); if (trust == null) { return; @@ -144,16 +149,17 @@ namespace FineUIPro.Web.CLGL PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); } - private AntiCorrosionTrustOutput SaveTrust() + private AntiCorrosionTrustOutput SaveTrust(bool splitOnSubmit) { if (!CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.Tw_AntiCorrosionTrustMenuId, Const.BtnSave)) { ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); return null; } - if (drpOutputMaster.SelectedValue == Const._Null) + if (string.IsNullOrEmpty(TrustId) && string.IsNullOrEmpty(HotProessTrustId) + && drpWeldTask.SelectedValue == Const._Null) { - ShowNotify("请选择出库单编号!", MessageBoxIcon.Warning); + ShowNotify("请选择焊接任务单!", MessageBoxIcon.Warning); return null; } if (TwAntiCorrosionTrustService.IsExistTrustCode(txtTrustCode.Text.Trim(), TrustId, this.CurrUser.LoginProjectId)) @@ -170,7 +176,8 @@ namespace FineUIPro.Web.CLGL ConstructionPart = txtConstructionPart.Text.Trim(), ConstructionProfessional = txtConstructionProfessional.Text.Trim(), TrustCode = txtTrustCode.Text.Trim(), - OutputMasterId = drpOutputMaster.SelectedValue, + WeldTaskCode = drpWeldTask.SelectedValue == Const._Null ? null : drpWeldTask.SelectedValue, + HotProessTrustId = HotProessTrustId, DemandDate = Funs.GetNewDateTime(txtDemandDate.Text.Trim()), CompleteDate = Funs.GetNewDateTime(txtCompleteDate.Text.Trim()), CreateMan = this.CurrUser.PersonId, @@ -184,8 +191,16 @@ namespace FineUIPro.Web.CLGL return null; } - TwAntiCorrosionTrustService.Save(trust, details); - return trust; + try + { + TwAntiCorrosionTrustService.Save(trust, details, splitOnSubmit); + return trust; + } + catch (ArgumentException ex) + { + ShowNotify(ex.Message, MessageBoxIcon.Warning); + return null; + } } private List CollectGridDetailInfo() @@ -200,10 +215,11 @@ namespace FineUIPro.Web.CLGL result.Add(new AntiCorrosionTrustDetailOutput { Id = values.Value("Id"), - SortIndex = sortIndex, + SortIndex = values.Value("SortIndex") ?? sortIndex, MaterialCode = values.Value("MaterialCode"), Quantity = GetDecimal(values.Value("Quantity")), PaintCode = values.Value("PaintCode"), + IsPostWeld = values.Value("IsPostWeld") ?? false, Remark = values.Value("Remark") }); } diff --git a/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrustEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrustEdit.aspx.designer.cs index 42ee4c40..c7a6d544 100644 --- a/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrustEdit.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/CLGL/AntiCorrosionTrustEdit.aspx.designer.cs @@ -132,13 +132,13 @@ namespace FineUIPro.Web.CLGL protected global::FineUIPro.TextBox txtTrustCode; /// - /// drpOutputMaster 控件。 + /// drpWeldTask 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.DropDownList drpOutputMaster; + protected global::FineUIPro.DropDownList drpWeldTask; /// /// txtDemandDate 控件。 @@ -194,6 +194,16 @@ namespace FineUIPro.Web.CLGL /// protected global::FineUIPro.DropDownList drpPaintCodeEditor; + /// + /// drpIsPostWeldEditor 控件。 + /// + protected global::FineUIPro.DropDownList drpIsPostWeldEditor; + + /// + /// numSortIndexEditor 控件。 + /// + protected global::FineUIPro.NumberBox numSortIndexEditor; + /// /// txtDetailRemarkEditor 控件。 /// diff --git a/SGGL/FineUIPro.Web/File/Fastreport/焊口打印_80x42.frx b/SGGL/FineUIPro.Web/File/Fastreport/焊口打印_80x42.frx index 6f3dcfe3..1c04dd0b 100644 --- a/SGGL/FineUIPro.Web/File/Fastreport/焊口打印_80x42.frx +++ b/SGGL/FineUIPro.Web/File/Fastreport/焊口打印_80x42.frx @@ -1,5 +1,5 @@  - + using System; using System.Collections; using System.Collections.Generic; @@ -99,7 +99,7 @@ namespace FastReport } - + @@ -149,7 +149,7 @@ namespace FastReport - + diff --git a/SGGL/FineUIPro.Web/File/Fastreport/管道焊接任务单.frx b/SGGL/FineUIPro.Web/File/Fastreport/管道焊接任务单.frx index df01acda..a95874f8 100644 --- a/SGGL/FineUIPro.Web/File/Fastreport/管道焊接任务单.frx +++ b/SGGL/FineUIPro.Web/File/Fastreport/管道焊接任务单.frx @@ -1,5 +1,5 @@  - + using System; using System.Collections; using System.Collections.Generic; @@ -59,7 +59,7 @@ namespace FastReport } - + @@ -104,7 +104,7 @@ namespace FastReport - + @@ -150,7 +150,7 @@ namespace FastReport - + @@ -193,7 +193,7 @@ namespace FastReport - + diff --git a/SGGL/FineUIPro.Web/HJGL/HotProcessHard/HotProessReport.aspx b/SGGL/FineUIPro.Web/HJGL/HotProcessHard/HotProessReport.aspx index 677c0b66..8358e20e 100644 --- a/SGGL/FineUIPro.Web/HJGL/HotProcessHard/HotProessReport.aspx +++ b/SGGL/FineUIPro.Web/HJGL/HotProcessHard/HotProessReport.aspx @@ -93,6 +93,8 @@ + diff --git a/SGGL/FineUIPro.Web/HJGL/HotProcessHard/HotProessReport.aspx.cs b/SGGL/FineUIPro.Web/HJGL/HotProcessHard/HotProessReport.aspx.cs index 2b7d1114..ed3f370b 100644 --- a/SGGL/FineUIPro.Web/HJGL/HotProcessHard/HotProessReport.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/HotProcessHard/HotProessReport.aspx.cs @@ -26,6 +26,31 @@ namespace FineUIPro.Web.HJGL.HotProcessHard ViewState["HotProessTrustId"] = value; } } + + protected void btnGenerateAntiCorrosionTrust_Click(object sender, EventArgs e) + { + if (!CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, + Const.Tw_AntiCorrosionTrustMenuId, Const.BtnAdd)) + { + ShowNotify("您没有生成防腐委托单的权限!", MessageBoxIcon.Warning); + return; + } + if (string.IsNullOrEmpty(this.HotProessTrustId)) + { + ShowNotify("请选择热处理委托", MessageBoxIcon.Warning); + return; + } + + try + { + TwAntiCorrosionTrustService.GenerateByHotProessTrustId(this.HotProessTrustId, this.CurrUser.PersonId); + ShowNotify("防腐委托单生成成功", MessageBoxIcon.Success); + } + catch (ArgumentException ex) + { + ShowNotify(ex.Message, MessageBoxIcon.Warning); + } + } #endregion #region 加载页面 diff --git a/SGGL/FineUIPro.Web/HJGL/HotProcessHard/HotProessReport.aspx.designer.cs b/SGGL/FineUIPro.Web/HJGL/HotProcessHard/HotProessReport.aspx.designer.cs index 20c99fb4..9d8a43d0 100644 --- a/SGGL/FineUIPro.Web/HJGL/HotProcessHard/HotProessReport.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/HJGL/HotProcessHard/HotProessReport.aspx.designer.cs @@ -200,6 +200,11 @@ namespace FineUIPro.Web.HJGL.HotProcessHard { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.ToolbarFill ToolbarFill2; + + /// + /// btnGenerateAntiCorrosionTrust 控件。 + /// + protected global::FineUIPro.Button btnGenerateAntiCorrosionTrust; /// /// ToolbarSeparator1 控件。 diff --git a/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheck.aspx b/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheck.aspx index 01b9751f..aa5d81ed 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheck.aspx +++ b/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheck.aspx @@ -50,6 +50,9 @@ + + diff --git a/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx b/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx index 63744fcd..6c6f97f6 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx +++ b/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx @@ -32,6 +32,12 @@ + + + + + + diff --git a/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx.cs b/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx.cs index 367abc6c..97e65032 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx.cs @@ -78,6 +78,7 @@ namespace FineUIPro.Web.HJGL.PreWeld drpWeldJoint.SelectedValue = model.WeldJointId; numCuttingLength.Text = model.CuttingLength.HasValue ? model.CuttingLength.Value.ToString() : string.Empty; txtGrooveForm.Text = model.GrooveForm; + txtGrooveProcessType.Text = model.GrooveProcessType; numGrooveAngle.Text = model.GrooveAngle.HasValue ? model.GrooveAngle.Value.ToString() : string.Empty; chkMaterialCodeBatchNo.Checked = model.IsMaterialCodeBatchNoAccurate; chkMaterialQuantity.Checked = model.IsMaterialQuantityAccurate; @@ -121,6 +122,7 @@ namespace FineUIPro.Web.HJGL.PreWeld WeldJointId = drpWeldJoint.SelectedValue, CuttingLength = string.IsNullOrWhiteSpace(numCuttingLength.Text) ? (decimal?)null : Convert.ToDecimal(numCuttingLength.Text), GrooveForm = txtGrooveForm.Text.Trim(), + GrooveProcessType = txtGrooveProcessType.Text.Trim(), GrooveAngle = string.IsNullOrWhiteSpace(numGrooveAngle.Text) ? (decimal?)null : Convert.ToDecimal(numGrooveAngle.Text), IsMaterialCodeBatchNoAccurate = chkMaterialCodeBatchNo.Checked, IsMaterialQuantityAccurate = chkMaterialQuantity.Checked, @@ -134,22 +136,40 @@ namespace FineUIPro.Web.HJGL.PreWeld SpecialReviewerId = ddlSpecialReviewer.SelectedValue }; - CuttingCheckId = APIPreWeldInspectionService.SaveCuttingCheck(item); - ShowNotify("保存成功!", MessageBoxIcon.Success); - PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); + try + { + CuttingCheckId = APIPreWeldInspectionService.SaveCuttingCheck(item); + ShowNotify("保存成功!", MessageBoxIcon.Success); + PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); + } + catch (ArgumentException ex) + { + ShowNotify(ex.Message, MessageBoxIcon.Warning); + } } protected void btnReview_Click(object sender, EventArgs e) { - APIPreWeldInspectionService.ReviewCuttingCheck(new Model.PreWeldCuttingCheckReviewInput + try { - CuttingCheckId = CuttingCheckId, - ReviewerId = CurrUser.PersonId, - ReviewTime = DateTime.Now, - Remark = txtRemark.Text.Trim() - }); - ShowNotify("专项审核已完成!", MessageBoxIcon.Success); - PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); + APIPreWeldInspectionService.ReviewCuttingCheck(new Model.PreWeldCuttingCheckReviewInput + { + CuttingCheckId = CuttingCheckId, + ReviewerId = CurrUser.PersonId, + ReviewTime = DateTime.Now, + Remark = txtRemark.Text.Trim() + }); + ShowNotify("专项审核已完成!", MessageBoxIcon.Success); + PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); + } + catch (ArgumentException ex) + { + ShowNotify(ex.Message, MessageBoxIcon.Warning); + } + catch (InvalidOperationException ex) + { + ShowNotify(ex.Message, MessageBoxIcon.Warning); + } } protected void btnAttachUrl_Click(object sender, EventArgs e) diff --git a/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx.designer.cs index ee7102eb..c415bf09 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheckEdit.aspx.designer.cs @@ -68,6 +68,11 @@ namespace FineUIPro.Web.HJGL.PreWeld /// protected global::FineUIPro.TextBox txtGrooveForm; + /// + /// txtGrooveProcessType 控件。 + /// + protected global::FineUIPro.TextBox txtGrooveProcessType; + /// /// numGrooveAngle 控件。 /// diff --git a/SGGL/FineUIPro.Web/HJGL/PreWeld/FitupCheck.aspx b/SGGL/FineUIPro.Web/HJGL/PreWeld/FitupCheck.aspx index f6b18f85..5f3035fc 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreWeld/FitupCheck.aspx +++ b/SGGL/FineUIPro.Web/HJGL/PreWeld/FitupCheck.aspx @@ -44,33 +44,12 @@ - - - - - - - - - - - - - - diff --git a/SGGL/FineUIPro.Web/HJGL/PreWeld/FitupCheckEdit.aspx b/SGGL/FineUIPro.Web/HJGL/PreWeld/FitupCheckEdit.aspx index 6f80853e..0fd4b964 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreWeld/FitupCheckEdit.aspx +++ b/SGGL/FineUIPro.Web/HJGL/PreWeld/FitupCheckEdit.aspx @@ -20,25 +20,6 @@ - - - - - - - - - - - - - - - - - - @@ -51,30 +32,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - protected global::FineUIPro.DropDownList drpWeldJoint; - /// - /// drpGrooveType 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.DropDownList drpGrooveType; - - /// - /// txtGrooveProcessType 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.TextBox txtGrooveProcessType; - - /// - /// numGrooveAngle 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.NumberBox numGrooveAngle; - /// /// numFitupGap 控件。 /// @@ -95,42 +68,6 @@ namespace FineUIPro.Web.HJGL.PreWeld /// protected global::FineUIPro.NumberBox numMisalignment; - /// - /// numWeldReinforcement 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.NumberBox numWeldReinforcement; - - /// - /// numWeldHeight 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.NumberBox numWeldHeight; - - /// - /// numWeldWidth 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.NumberBox numWeldWidth; - - /// - /// txtSurfaceDefect 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.TextArea txtSurfaceDefect; - /// /// ddlCheckResult 控件。 /// diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/SelectTaskWeldJoint.aspx b/SGGL/FineUIPro.Web/HJGL/WeldingManage/SelectTaskWeldJoint.aspx index 2dd18a8b..3806bcba 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/SelectTaskWeldJoint.aspx +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/SelectTaskWeldJoint.aspx @@ -93,7 +93,8 @@ - + + diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/SelectTaskWeldJoint.aspx.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/SelectTaskWeldJoint.aspx.cs index 3a0e1572..0bd2c9c7 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/SelectTaskWeldJoint.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/SelectTaskWeldJoint.aspx.cs @@ -201,6 +201,13 @@ namespace FineUIPro.Web.HJGL.WeldingManage this.txtUnitWorkName.Text = UnitWork.UnitWorkName; } } + InitTeamGroupDropDown(); + var currentTask = Funs.DB.HJGL_WeldTask.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId + && x.TaskCode == this.txtTaskCode.Text.Trim()); + if (currentTask != null && !string.IsNullOrEmpty(currentTask.TeamGroupId)) + { + drpTeamGroup.SelectedValue = currentTask.TeamGroupId; + } this.InitTreeMenu();//加载树 } } @@ -385,6 +392,12 @@ namespace FineUIPro.Web.HJGL.WeldingManage Funs.FineUIPleaseSelect(drpFlowingSection); } + private void InitTeamGroupDropDown() + { + TeamGroupService.InitTeamGroupProjectUnitDropDownList( + drpTeamGroup, this.CurrUser.LoginProjectId, drpUnit.SelectedValue, true); + } + #endregion #region 管线查询 @@ -512,6 +525,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage NewTask.ProjectId = this.CurrUser.LoginProjectId; NewTask.UnitWorkId = this.UnitWorkId; NewTask.UnitId = drpUnit.SelectedValue; + NewTask.TeamGroupId = drpTeamGroup.SelectedValue == Const._Null ? null : drpTeamGroup.SelectedValue; NewTask.TaskCode = this.txtTaskCode.Text.Trim(); NewTask.SerialNumber = SerialNumber; @@ -595,6 +609,9 @@ namespace FineUIPro.Web.HJGL.WeldingManage BLL.WeldJointService.UpdateWeldJoint(weldJoint); BLL.WeldTaskService.AddWeldTask(NewTask); } + // 编辑任务单时同步更新同一TaskCode已有的全部焊口记录。 + BLL.WeldTaskService.UpdateTaskTeamGroup(this.CurrUser.LoginProjectId, + this.txtTaskCode.Text.Trim(), drpTeamGroup.SelectedValue); //string pipelineId = this.tvControlItem.SelectedNodeID; //var model = BLL.PipelineService.GetPipelineByPipelineId(pipelineId); //model.State = 1; @@ -646,7 +663,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage protected void drpUnit_SelectedIndexChanged(object sender, EventArgs e) { this.txtTaskCode.Text = BLL.WeldTaskService.GetTaskCodeByDate(this.CurrUser.LoginProjectId, this.txtTaskDate.Text, UnitWorkId, drpUnit.SelectedValue); - + InitTeamGroupDropDown(); } protected void drpJointAttribute_SelectedIndexChanged(object sender, EventArgs e) { @@ -708,4 +725,4 @@ namespace FineUIPro.Web.HJGL.WeldingManage } -} \ No newline at end of file +} diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/SelectTaskWeldJoint.aspx.designer.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/SelectTaskWeldJoint.aspx.designer.cs index 711c9172..8da9db2c 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/SelectTaskWeldJoint.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/SelectTaskWeldJoint.aspx.designer.cs @@ -194,6 +194,11 @@ namespace FineUIPro.Web.HJGL.WeldingManage /// protected global::FineUIPro.DropDownList drpUnit; + /// + /// drpTeamGroup 控件。 + /// + protected global::FineUIPro.DropDownList drpTeamGroup; + /// /// txtUnitWorkName 控件。 /// diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldAppearanceCheck.aspx b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldAppearanceCheck.aspx index 1845c7d6..6dd35924 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldAppearanceCheck.aspx +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldAppearanceCheck.aspx @@ -56,6 +56,12 @@ + + + + + + + + + + + + + + + + + + + + + + + + protected global::FineUIPro.DropDownList ddlQualified; + protected global::FineUIPro.NumberBox numWeldReinforcement; + protected global::FineUIPro.NumberBox numWeldHeight; + protected global::FineUIPro.NumberBox numWeldWidth; + protected global::FineUIPro.TextBox txtSurfaceDefect; + protected global::FineUIPro.NumberBox numPreheatTemperature; + protected global::FineUIPro.NumberBox numInterpassTemperature; + /// /// ddlCheckPerson 控件。 /// diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldReport.aspx b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldReport.aspx index d2663f66..25075e2e 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldReport.aspx +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldReport.aspx @@ -66,19 +66,8 @@ - <%-- - - - - - - - --%> - - + + + + - + + + @@ -297,12 +293,36 @@ + + + + + + + + + + + + + + + + @@ -330,10 +350,10 @@ + - diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldReport.aspx.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldReport.aspx.cs index e3d533f3..4297cea3 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldReport.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldReport.aspx.cs @@ -215,8 +215,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage OUTER APPLY ( SELECT TOP 1 temp.TempDetailId FROM dbo.HJGL_WeldingDailyTempDetail AS temp - WHERE temp.WeldJointId = jot.WeldJointId AND temp.AuditState = 1 - ORDER BY temp.AuditDate DESC, temp.SubmitDate DESC + WHERE temp.WeldJointId = jot.WeldJointId AND temp.AuditState = 2 + ORDER BY temp.ProfessionalAuditDate DESC, temp.SubmitDate DESC ) AS reportTemp LEFT JOIN dbo.AttachFile AS beforeAtt ON beforeAtt.MenuId = @WeldReportMenuId AND beforeAtt.ToKeyId = reportTemp.TempDetailId + '#Before' @@ -728,10 +728,45 @@ namespace FineUIPro.Web.HJGL.WeldingManage } /// - /// 待审核记录审核通过 + /// 班组审核 /// - protected void btnPendingAudit_Click(object sender, EventArgs e) + protected void btnPendingTeamAudit_Click(object sender, EventArgs e) { + if (!CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, + Const.HJGL_WeldReportMenuId, Const.BtnAuditing)) + { + ShowNotify("您没有审核权限,请与管理员联系!", MessageBoxIcon.Warning); + return; + } + if (GridPending.SelectedRowIDArray.Length == 0) + { + ShowNotify("请选择要审核的记录", MessageBoxIcon.Warning); + return; + } + + string errlog = BLL.WeldingDailyService.TeamAuditWeldingDailyTempDetails(GridPending.SelectedRowIDArray, this.CurrUser.PersonId); + this.BindPendingGrid(); + if (string.IsNullOrEmpty(errlog)) + { + ShowNotify("班组审核完成!", MessageBoxIcon.Success); + } + else + { + Alert.ShowInTop("部分记录处理失败:" + errlog, MessageBoxIcon.Warning); + } + } + + /// + /// 专工审核 + /// + protected void btnPendingProfessionalAudit_Click(object sender, EventArgs e) + { + if (!CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, + Const.HJGL_WeldReportMenuId, Const.BtnAuditing)) + { + ShowNotify("您没有审核权限,请与管理员联系!", MessageBoxIcon.Warning); + return; + } if (GridPending.SelectedRowIDArray.Length == 0) { ShowNotify("请选择要审核的记录", MessageBoxIcon.Warning); @@ -743,7 +778,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage this.BindPendingGrid(); if (string.IsNullOrEmpty(errlog)) { - ShowNotify("审核通过!", MessageBoxIcon.Success); + ShowNotify("专工审核完成!", MessageBoxIcon.Success); } else { diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldReport.aspx.designer.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldReport.aspx.designer.cs index 277e222b..fca1d596 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldReport.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldReport.aspx.designer.cs @@ -266,6 +266,15 @@ namespace FineUIPro.Web.HJGL.WeldingManage /// protected global::FineUIPro.DropDownList ddlPageSize; + /// + /// panelBottomRegion 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel panelBottomRegion; + /// /// GridPending 控件。 /// @@ -321,13 +330,22 @@ namespace FineUIPro.Web.HJGL.WeldingManage protected global::FineUIPro.ToolbarFill ToolbarFillPending; /// - /// btnPendingAudit 控件。 + /// btnPendingTeamAudit 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.Button btnPendingAudit; + protected global::FineUIPro.Button btnPendingTeamAudit; + + /// + /// btnPendingProfessionalAudit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnPendingProfessionalAudit; /// /// btnPendingDelete 控件。 diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx index a1b1b068..720e26dd 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx @@ -33,6 +33,13 @@ + + + + + + @@ -69,14 +76,17 @@ - + + + + @@ -85,8 +95,8 @@ - - + + --%> + + - + @@ -116,10 +128,10 @@ - - diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.cs index 29d189e6..a3d955d1 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.cs @@ -162,7 +162,12 @@ namespace FineUIPro.Web.HJGL.WeldingManage foreach (var q in unitWork2) { var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId); - if (string.IsNullOrEmpty(this.txtWeldJointCode.Text.Trim())) + // 左侧树的管线号和焊口号为组合筛选条件,任一条件为空时不限制对应字段。 + string weldJointCode = this.txtWeldJointCode.Text.Trim(); + string pipelineCode = this.txtTreePipelineCode.Text.Trim(); + bool hasWeldJointCode = !string.IsNullOrEmpty(weldJointCode); + bool hasPipelineCode = !string.IsNullOrEmpty(pipelineCode); + if (!hasWeldJointCode && !hasPipelineCode) { var a = (from x in Funs.DB.HJGL_WeldTask where x.UnitWorkId == q.UnitWorkId @@ -190,7 +195,9 @@ namespace FineUIPro.Web.HJGL.WeldingManage { var a = (from x in Funs.DB.HJGL_WeldTask join y in Funs.DB.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId - where x.UnitWorkId == q.UnitWorkId && y.WeldJointCode.Contains(this.txtWeldJointCode.Text.Trim()) + where x.UnitWorkId == q.UnitWorkId + && (!hasWeldJointCode || y.WeldJointCode.Contains(weldJointCode)) + && (!hasPipelineCode || y.PipelineCode.Contains(pipelineCode)) select x.TaskDate.Value.Date).Distinct().Count(); TreeNode tn2 = new TreeNode(); tn2.NodeID = q.UnitWorkId; @@ -204,7 +211,9 @@ namespace FineUIPro.Web.HJGL.WeldingManage { var date = (from x in Funs.DB.HJGL_WeldTask join y in Funs.DB.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId - where x.UnitWorkId == q.UnitWorkId && y.WeldJointCode.Contains(this.txtWeldJointCode.Text.Trim()) + where x.UnitWorkId == q.UnitWorkId + && (!hasWeldJointCode || y.WeldJointCode.Contains(weldJointCode)) + && (!hasPipelineCode || y.PipelineCode.Contains(pipelineCode)) select x.TaskDate.Value.Date).First(); this.txtTaskDateMonth.Text = string.Format("{0:yyyy-MM}", date); // BindNodes(tn1); @@ -229,7 +238,11 @@ namespace FineUIPro.Web.HJGL.WeldingManage } private void BindNodes(TreeNode node) { - if (string.IsNullOrEmpty(this.txtWeldJointCode.Text.Trim())) + string weldJointCode = this.txtWeldJointCode.Text.Trim(); + string pipelineCode = this.txtTreePipelineCode.Text.Trim(); + bool hasWeldJointCode = !string.IsNullOrEmpty(weldJointCode); + bool hasPipelineCode = !string.IsNullOrEmpty(pipelineCode); + if (!hasWeldJointCode && !hasPipelineCode) { var p = (from x in Funs.DB.HJGL_WeldTask where x.UnitWorkId == node.NodeID @@ -253,7 +266,9 @@ namespace FineUIPro.Web.HJGL.WeldingManage { var p = (from x in Funs.DB.HJGL_WeldTask join y in Funs.DB.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId - where x.UnitWorkId == node.NodeID && y.WeldJointCode.Contains(this.txtWeldJointCode.Text.Trim()) + where x.UnitWorkId == node.NodeID + && (!hasWeldJointCode || y.WeldJointCode.Contains(weldJointCode)) + && (!hasPipelineCode || y.PipelineCode.Contains(pipelineCode)) orderby x.TaskDate descending select new { x.TaskDate.Value.Date, x.UnitId, x.SerialNumber }).Distinct().ToList().OrderBy(x => x.SerialNumber); if (p.Count() > 0) @@ -278,13 +293,26 @@ namespace FineUIPro.Web.HJGL.WeldingManage this.InitTreeMenu(); } + /// + /// 任务单列表、任务单打印和焊口贴纸统一使用此顺序,避免同一任务单在不同入口显示顺序不一致。 + /// + private static List OrderWeldingTaskRows(IEnumerable weldingTasks) + { + return (weldingTasks ?? Enumerable.Empty()) + .OrderBy(x => x.PipeLineSortIndex) + .ThenBy(x => x.WeldJointCode) + .ThenBy(x => x.WeldTaskId) + .ToList(); + } + private void BindGrid(List weldingTask) { UpdateTotalSizeLabel(weldingTask); if (!string.IsNullOrEmpty(this.txtPipelineCode.Text.Trim())) { - weldingTask = weldingTask.Where(e => e.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())).OrderBy(x => x.PipeLineSortIndex).ToList(); + weldingTask = weldingTask.Where(e => e.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())).ToList(); } + weldingTask = OrderWeldingTaskRows(weldingTask); DataTable tb = this.LINQToDataTable(weldingTask); // 2.获取当前分页数据 @@ -366,7 +394,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage BLL.FastReportService.ResetData(); var pipelineIds = taskList.Select(x => x.PipelineId).Distinct().ToList(); var pipelines = Funs.DB.HJGL_Pipeline.Where(x => pipelineIds.Contains(x.PipelineId)).ToList(); - var result = taskList.OrderBy(x => x.PipeLineSortIndex).ThenBy(x => x.WeldJointCode).Select(x => + var result = OrderWeldingTaskRows(taskList).Select(x => { var pipeline = pipelines.FirstOrDefault(y => y.PipelineId == x.PipelineId); return new @@ -1301,6 +1329,10 @@ namespace FineUIPro.Web.HJGL.WeldingManage protected void btnSearch_Click(object sender, EventArgs e) { + if (string.IsNullOrEmpty( tvControlItem.SelectedNodeID)||tvControlItem.SelectedNodeID.Split('|').Length!=4) + { + return; + } //List GetWeldingTaskItem = this.CollectGridJointInfo(); DateTime? taskTime = Funs.GetNewDateTime(tvControlItem.SelectedNodeID.Split('|')[2]); if (taskTime != null) @@ -1375,6 +1407,10 @@ namespace FineUIPro.Web.HJGL.WeldingManage protected void rbIsAudit_SelectedIndexChanged(object sender, EventArgs e) { + if (string.IsNullOrEmpty(tvControlItem.SelectedNodeID) || tvControlItem.SelectedNodeID.Split('|').Length != 4) + { + return; + } DateTime? taskTime = Funs.GetNewDateTime(tvControlItem.SelectedNodeID.Split('|')[2]); if (taskTime != null) { @@ -1409,6 +1445,50 @@ namespace FineUIPro.Web.HJGL.WeldingManage } } + /// + /// 根据当前逻辑任务单生成防腐委托单。 + /// + protected void btnGenAntiCorrosionTrust_Click(object sender, EventArgs e) + { + if (!CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, + Const.Tw_AntiCorrosionTrustMenuId, Const.BtnAdd)) + { + ShowNotify("您没有生成防腐委托单的权限!", MessageBoxIcon.Warning); + return; + } + if (string.IsNullOrEmpty(tvControlItem.SelectedNodeID) || !tvControlItem.SelectedNodeID.Contains("|")) + { + ShowNotify("请选择任务单", MessageBoxIcon.Question); + return; + } + + string[] values = tvControlItem.SelectedNodeID.Split('|'); + DateTime taskDate; + if (values.Length < 4 || !DateTime.TryParse(values[2], out taskDate)) + { + ShowNotify("任务单参数不正确", MessageBoxIcon.Warning); + return; + } + var task = Funs.DB.HJGL_WeldTask.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId + && x.UnitWorkId == values[0] && x.UnitId == values[1] + && x.TaskDate.HasValue && x.TaskDate.Value.Date == taskDate.Date && x.SerialNumber == values[3]); + if (task == null) + { + ShowNotify("未找到任务单", MessageBoxIcon.Warning); + return; + } + + try + { + TwAntiCorrosionTrustService.GenerateByTaskCode(task.ProjectId, task.TaskCode, this.CurrUser.PersonId); + ShowNotify("防腐委托单生成成功", MessageBoxIcon.Success); + } + catch (ArgumentException ex) + { + ShowNotify(ex.Message, MessageBoxIcon.Warning); + } + } + protected void btnPrintJoint_Click(object sender, EventArgs e) { var rows = Grid1.SelectedRowIndexArray; @@ -1422,6 +1502,12 @@ namespace FineUIPro.Web.HJGL.WeldingManage { BLL.FastReportService.ResetData(); + var selectedTaskOrder = OrderWeldingTaskRows(GetCurrentTaskList()) + .Where(x => !string.IsNullOrEmpty(x.WeldJointId) && jointids.Contains(x.WeldJointId)) + .Select((x, index) => new { x.WeldJointId, Index = index }) + .GroupBy(x => x.WeldJointId) + .ToDictionary(x => x.Key, x => x.First().Index); + // 防腐等级维护在管线上,打印时由焊口关联管线,再通过防腐字典取得显示代码。 var result = (from weldJoint in Funs.DB.View_HJGL_WeldJoint where jointids.Contains(weldJoint.WeldJointId) @@ -1438,7 +1524,11 @@ namespace FineUIPro.Web.HJGL.WeldingManage SortIndex = weldJoint.WeldJointCode.Replace(weldJoint.PipelineCode + "/", ""), WeldJointPoint = weldJoint.WeldJointPoint, PaintCode = paint == null ? string.Empty : paint.PaintCode - }).OrderBy(x => x.pipelineCode).ThenBy(x => x.SortIndex).ToList(); + }).ToList() + .OrderBy(x => selectedTaskOrder.ContainsKey(x.WeldJointId) ? selectedTaskOrder[x.WeldJointId] : int.MaxValue) + .ThenBy(x => x.pipelineCode) + .ThenBy(x => x.SortIndex) + .ToList(); var tb = LINQToDataTable(result); if (tb != null && tb.Rows.Count > 0) { @@ -1495,8 +1585,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage DateTime? taskTime = Funs.GetNewDateTime(tvControlItem.SelectedNodeID.Split('|')[2]); if (taskTime != null) { - var weldTaskList = BLL.WeldTaskService.GetWeldingTaskList(this.CurrUser.LoginProjectId, tvControlItem.SelectedNodeID.Split('|')[0], tvControlItem.SelectedNodeID.Split('|')[1], Convert.ToDateTime(taskTime), this.rbIsAudit.SelectedValue, tvControlItem.SelectedNodeID.Split('|')[3]); - var pipelines = weldTaskList.OrderBy(x => x.PipeLineSortIndex).Select(x => x.PipelineId).Distinct().ToList(); + var weldTaskList = OrderWeldingTaskRows(BLL.WeldTaskService.GetWeldingTaskList(this.CurrUser.LoginProjectId, tvControlItem.SelectedNodeID.Split('|')[0], tvControlItem.SelectedNodeID.Split('|')[1], Convert.ToDateTime(taskTime), this.rbIsAudit.SelectedValue, tvControlItem.SelectedNodeID.Split('|')[3])); + var pipelines = weldTaskList.Select(x => x.PipelineId).Distinct().ToList(); if (pipelines.Any()) { @@ -1572,9 +1662,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage y.MaterialMade, y.MaterialSpec }).ToList(); - var sortedTaskList = weldTaskList.OrderBy(x => x.PipeLineSortIndex).ThenBy(x => x.WeldJointCode).ToList(); - - foreach (var task in sortedTaskList) + foreach (var task in weldTaskList) { var taskMaterials = printMaterials.Where(x => x.WeldJointId == task.WeldJointId) .OrderBy(x => x.Code).ToList(); diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.designer.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.designer.cs index acaed21f..6bcbeb25 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.designer.cs @@ -77,6 +77,24 @@ namespace FineUIPro.Web.HJGL.WeldingManage /// protected global::FineUIPro.Toolbar Toolbar1; + /// + /// txtTreePipelineCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTreePipelineCode; + + /// + /// Toolbar5 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar5; + /// /// txtWeldJointCode 控件。 /// @@ -150,13 +168,13 @@ namespace FineUIPro.Web.HJGL.WeldingManage protected global::FineUIPro.HiddenField hdTaskWeldJoint; /// - /// CreatWeldableWeldJoint 控件。 + /// lblTotalSize 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.Button CreatWeldableWeldJoint; + protected global::FineUIPro.Label lblTotalSize; /// /// rbIsAudit 控件。 @@ -213,13 +231,13 @@ namespace FineUIPro.Web.HJGL.WeldingManage protected global::FineUIPro.Button btnSearch; /// - /// lblTotalSize 控件。 + /// CreatWeldableWeldJoint 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.Label lblTotalSize; + protected global::FineUIPro.Button CreatWeldableWeldJoint; /// /// btnPassMaster 控件。 @@ -248,6 +266,15 @@ namespace FineUIPro.Web.HJGL.WeldingManage /// protected global::FineUIPro.Button btnGenOutPlanMaster; + /// + /// btnGenAntiCorrosionTrust 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnGenAntiCorrosionTrust; + /// /// btnSave 控件。 /// diff --git a/SGGL/FineUIPro.Web/common/Menu_HJGL.xml b/SGGL/FineUIPro.Web/common/Menu_HJGL.xml index a7ac0579..ef0f3f00 100644 --- a/SGGL/FineUIPro.Web/common/Menu_HJGL.xml +++ b/SGGL/FineUIPro.Web/common/Menu_HJGL.xml @@ -61,10 +61,10 @@ - - + + + - diff --git a/SGGL/Model/APIItem/HJGL/HJGL_PreWeldingDailyItem.cs b/SGGL/Model/APIItem/HJGL/HJGL_PreWeldingDailyItem.cs index a0ba823b..34873bb5 100644 --- a/SGGL/Model/APIItem/HJGL/HJGL_PreWeldingDailyItem.cs +++ b/SGGL/Model/APIItem/HJGL/HJGL_PreWeldingDailyItem.cs @@ -118,6 +118,16 @@ /// public string WeldTypeId { get; set; } + /// + /// 焊丝ID;兼容旧版小程序,可不传 + /// + public string WeldingWire { get; set; } + + /// + /// 焊条ID;兼容旧版小程序,可不传 + /// + public string WeldingRod { get; set; } + /// /// 焊前附件路径 /// diff --git a/SGGL/Model/APIItem/HJGL/PreWeldInspectionItem.cs b/SGGL/Model/APIItem/HJGL/PreWeldInspectionItem.cs index 3a3f6cc3..ccec2798 100644 --- a/SGGL/Model/APIItem/HJGL/PreWeldInspectionItem.cs +++ b/SGGL/Model/APIItem/HJGL/PreWeldInspectionItem.cs @@ -181,6 +181,11 @@ namespace Model /// public string GrooveForm { get; set; } + /// + /// 坡口加工类型 + /// + public string GrooveProcessType { get; set; } + /// /// 坡口角度 /// @@ -287,6 +292,11 @@ namespace Model /// public string GrooveForm { get; set; } + /// + /// 坡口加工类型 + /// + public string GrooveProcessType { get; set; } + /// /// 坡口角度 /// @@ -409,31 +419,6 @@ namespace Model /// public string WeldJointId { get; set; } - /// - /// 坡口类型ID - /// - public string GrooveTypeId { get; set; } - - /// - /// 坡口类型名称 - /// - public string GrooveTypeName { get; set; } - - /// - /// 坡口类型编码 - /// - public string GrooveTypeCode { get; set; } - - /// - /// 坡口加工类型 - /// - public string GrooveProcessType { get; set; } - - /// - /// 坡口角度 - /// - public decimal? GrooveAngle { get; set; } - /// /// 组对间隙 /// @@ -444,26 +429,6 @@ namespace Model /// public decimal? Misalignment { get; set; } - /// - /// 焊缝余高 - /// - public decimal? WeldReinforcement { get; set; } - - /// - /// 焊缝高度 - /// - public decimal? WeldHeight { get; set; } - - /// - /// 焊缝宽度 - /// - public decimal? WeldWidth { get; set; } - - /// - /// 表面缺陷 - /// - public string SurfaceDefect { get; set; } - /// /// 检查人ID /// @@ -535,51 +500,6 @@ namespace Model /// public string PipelineCode { get; set; } - /// - /// 坡口类型编码 - /// - public string GrooveTypeCode { get; set; } - - /// - /// 坡口类型ID - /// - public string GrooveTypeId { get; set; } - - /// - /// 坡口类型名称 - /// - public string GrooveTypeName { get; set; } - - /// - /// 焊缝余高 - /// - public decimal? WeldReinforcement { get; set; } - - /// - /// 焊缝高度 - /// - public decimal? WeldHeight { get; set; } - - /// - /// 焊缝宽度 - /// - public decimal? WeldWidth { get; set; } - - /// - /// 表面缺陷 - /// - public string SurfaceDefect { get; set; } - - /// - /// 坡口加工类型 - /// - public string GrooveProcessType { get; set; } - - /// - /// 坡口角度 - /// - public decimal? GrooveAngle { get; set; } - /// /// 组对间隙 /// diff --git a/SGGL/Model/APIItem/HJGL/WeldAppearanceCheckItem.cs b/SGGL/Model/APIItem/HJGL/WeldAppearanceCheckItem.cs index 70289640..35795991 100644 --- a/SGGL/Model/APIItem/HJGL/WeldAppearanceCheckItem.cs +++ b/SGGL/Model/APIItem/HJGL/WeldAppearanceCheckItem.cs @@ -14,11 +14,18 @@ namespace Model public string Remark { get; set; } public string AttachUrl { get; set; } public string CreateUser { get; set; } + public decimal? WeldReinforcement { get; set; } + public decimal? WeldHeight { get; set; } + public decimal? WeldWidth { get; set; } + public string SurfaceDefect { get; set; } + public decimal? PreheatTemperature { get; set; } + public decimal? InterpassTemperature { get; set; } } public class WeldAppearanceCheckItem { public string AppearanceCheckId { get; set; } + public string CheckCode { get; set; } public string ProjectId { get; set; } public string WeldJointId { get; set; } public string PipelineCode { get; set; } @@ -31,6 +38,12 @@ namespace Model public string Remark { get; set; } public string AttachUrl { get; set; } public DateTime CreateTime { get; set; } + public decimal? WeldReinforcement { get; set; } + public decimal? WeldHeight { get; set; } + public decimal? WeldWidth { get; set; } + public string SurfaceDefect { get; set; } + public decimal? PreheatTemperature { get; set; } + public decimal? InterpassTemperature { get; set; } } public class WeldAppearanceJointItem diff --git a/SGGL/Model/APIItem/HJGL/WeldTaskItem.cs b/SGGL/Model/APIItem/HJGL/WeldTaskItem.cs new file mode 100644 index 00000000..f396c408 --- /dev/null +++ b/SGGL/Model/APIItem/HJGL/WeldTaskItem.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; + +namespace Model +{ + public class WeldTaskListItem + { + public string ProjectId { get; set; } + public string TaskCode { get; set; } + public string UnitWorkId { get; set; } + public string UnitWorkName { get; set; } + public string UnitId { get; set; } + public string UnitName { get; set; } + public DateTime? TaskDate { get; set; } + public string SerialNumber { get; set; } + public string TeamGroupId { get; set; } + public string TeamGroupName { get; set; } + public int WeldJointCount { get; set; } + } + + public class WeldTaskJointItem + { + public string WeldTaskId { get; set; } + public string WeldJointId { get; set; } + public string PipelineId { get; set; } + public string PipelineCode { get; set; } + public string WeldJointCode { get; set; } + public string JointAttribute { get; set; } + public string WeldingMode { get; set; } + /// + /// 焊接类型 + /// + public string WeldTypeCode { get; set; } + /// + /// 达因 + /// + public decimal? Size { get; set; } + public string CoverWelderId { get; set; } + public string BackingWelderId { get; set; } + } + + public class WeldTaskDetailItem : WeldTaskListItem + { + public List Joints { get; set; } + } + + public class WeldTaskGenerateRequest + { + public string ProjectId { get; set; } + public string TaskCode { get; set; } + public string PersonId { get; set; } + } +} diff --git a/SGGL/Model/APIItem/HJGL/WeldingDailyTempDetailItem.cs b/SGGL/Model/APIItem/HJGL/WeldingDailyTempDetailItem.cs index f8b776ff..99f77783 100644 --- a/SGGL/Model/APIItem/HJGL/WeldingDailyTempDetailItem.cs +++ b/SGGL/Model/APIItem/HJGL/WeldingDailyTempDetailItem.cs @@ -127,21 +127,41 @@ namespace Model /// public string WeldTypeCode { get; set; } + /// + /// 焊缝类型ID。 + /// + public string WeldTypeId { get; set; } + /// /// 焊接方法编号。 /// public string WeldingMethodCode { get; set; } + /// + /// 焊接方法ID。 + /// + public string WeldingMethodId { get; set; } + /// /// 焊丝编号。 /// public string WeldingWireCode { get; set; } + /// + /// 焊丝ID。 + /// + public string WeldingWire { get; set; } + /// /// 焊条编号。 /// public string WeldingRodCode { get; set; } + /// + /// 焊条ID。 + /// + public string WeldingRod { get; set; } + /// /// 提交人ID。 /// @@ -191,6 +211,13 @@ namespace Model /// 审核备注。 /// public string AuditRemark { get; set; } + public string TeamAuditMan { get; set; } + public string TeamAuditManName { get; set; } + public DateTime? TeamAuditDate { get; set; } + public string ProfessionalAuditMan { get; set; } + public string ProfessionalAuditManName { get; set; } + public DateTime? ProfessionalAuditDate { get; set; } + public string AuditStateText { get; set; } } /// diff --git a/SGGL/Model/APIItem/UserItem.cs b/SGGL/Model/APIItem/UserItem.cs index 4d52d1cf..ed401468 100644 --- a/SGGL/Model/APIItem/UserItem.cs +++ b/SGGL/Model/APIItem/UserItem.cs @@ -75,6 +75,22 @@ set; } /// + /// 班组ID + /// + public string TeamGroupId + { + get; + set; + } + /// + /// 班组名称 + /// + public string TeamGroupName + { + get; + set; + } + /// /// 当前项目ID /// public string LoginProjectId diff --git a/SGGL/Model/CLGL/AntiCorrosionTrustDetailOutput.cs b/SGGL/Model/CLGL/AntiCorrosionTrustDetailOutput.cs index 6066c1b8..1c2c782d 100644 --- a/SGGL/Model/CLGL/AntiCorrosionTrustDetailOutput.cs +++ b/SGGL/Model/CLGL/AntiCorrosionTrustDetailOutput.cs @@ -17,6 +17,7 @@ namespace Model public string IntermediatePaint { get; set; } public string Topcoat { get; set; } public string ColorCode { get; set; } + public bool IsPostWeld { get; set; } public string Remark { get; set; } } } diff --git a/SGGL/Model/CLGL/AntiCorrosionTrustOutput.cs b/SGGL/Model/CLGL/AntiCorrosionTrustOutput.cs index 76e267c7..9587b904 100644 --- a/SGGL/Model/CLGL/AntiCorrosionTrustOutput.cs +++ b/SGGL/Model/CLGL/AntiCorrosionTrustOutput.cs @@ -11,7 +11,11 @@ namespace Model public string ConstructionPart { get; set; } public string ConstructionProfessional { get; set; } public string TrustCode { get; set; } - public string OutputMasterId { get; set; } + public string WeldTaskCode { get; set; } + public string HotProessTrustId { get; set; } + public string TeamGroupId { get; set; } + public string TeamGroupName { get; set; } + // 仅供旧打印模板兼容,数据库不再保留出库单关联。 public string OutputMasterCode { get; set; } public DateTime? DemandDate { get; set; } public DateTime? CompleteDate { get; set; } diff --git a/SGGL/Model/Model.BusinessExtensions.cs b/SGGL/Model/Model.BusinessExtensions.cs new file mode 100644 index 00000000..7a65597a --- /dev/null +++ b/SGGL/Model/Model.BusinessExtensions.cs @@ -0,0 +1,165 @@ +using System; +using System.Data.Linq.Mapping; + +namespace Model +{ + /// + /// 业务扩展字段独立于自动生成模型,避免后续刷新模型时丢失手工映射。 + /// + public partial class HJGL_WeldTask + { + private string _BusinessTeamGroupId; + + [Column(Name = "TeamGroupId", Storage = "_BusinessTeamGroupId", DbType = "NVarChar(50)")] + public string TeamGroupId + { + get { return _BusinessTeamGroupId; } + set + { + if (_BusinessTeamGroupId == value) return; + SendPropertyChanging(); + _BusinessTeamGroupId = value; + SendPropertyChanged("TeamGroupId"); + } + } + } + + public partial class Tw_AntiCorrosionTrust + { + private string _BusinessWeldTaskCode; + private string _BusinessHotProessTrustId; + + [Column(Name = "WeldTaskCode", Storage = "_BusinessWeldTaskCode", DbType = "NVarChar(200)")] + public string WeldTaskCode + { + get { return _BusinessWeldTaskCode; } + set + { + if (_BusinessWeldTaskCode == value) return; + SendPropertyChanging(); + _BusinessWeldTaskCode = value; + SendPropertyChanged("WeldTaskCode"); + } + } + + [Column(Name = "HotProessTrustId", Storage = "_BusinessHotProessTrustId", DbType = "NVarChar(50)")] + public string HotProessTrustId + { + get { return _BusinessHotProessTrustId; } + set + { + if (_BusinessHotProessTrustId == value) return; + SendPropertyChanging(); + _BusinessHotProessTrustId = value; + SendPropertyChanged("HotProessTrustId"); + } + } + } + + public partial class Tw_AntiCorrosionTrustDetail + { + private bool _BusinessIsPostWeld; + + [Column(Name = "IsPostWeld", Storage = "_BusinessIsPostWeld", DbType = "Bit NOT NULL", CanBeNull = false)] + public bool IsPostWeld + { + get { return _BusinessIsPostWeld; } + set + { + if (_BusinessIsPostWeld == value) return; + SendPropertyChanging(); + _BusinessIsPostWeld = value; + SendPropertyChanged("IsPostWeld"); + } + } + } + + public partial class HJGL_PreWeldCuttingCheck + { + private string _BusinessGrooveProcessType; + + [Column(Name = "GrooveProcessType", Storage = "_BusinessGrooveProcessType", DbType = "NVarChar(100)")] + public string GrooveProcessType + { + get { return _BusinessGrooveProcessType; } + set + { + if (_BusinessGrooveProcessType == value) return; + SendPropertyChanging(); + _BusinessGrooveProcessType = value; + SendPropertyChanged("GrooveProcessType"); + } + } + } + + public partial class HJGL_WeldAppearanceCheck + { + private decimal? _BusinessWeldReinforcement; + private decimal? _BusinessWeldHeight; + private decimal? _BusinessWeldWidth; + private string _BusinessSurfaceDefect; + private decimal? _BusinessPreheatTemperature; + private decimal? _BusinessInterpassTemperature; + private string _BusinessCheckCode; + + [Column(Name = "WeldReinforcement", Storage = "_BusinessWeldReinforcement", DbType = "Decimal(18,2)")] + public decimal? WeldReinforcement { get { return _BusinessWeldReinforcement; } set { SetBusinessValue(ref _BusinessWeldReinforcement, value, "WeldReinforcement"); } } + [Column(Name = "WeldHeight", Storage = "_BusinessWeldHeight", DbType = "Decimal(18,2)")] + public decimal? WeldHeight { get { return _BusinessWeldHeight; } set { SetBusinessValue(ref _BusinessWeldHeight, value, "WeldHeight"); } } + [Column(Name = "WeldWidth", Storage = "_BusinessWeldWidth", DbType = "Decimal(18,2)")] + public decimal? WeldWidth { get { return _BusinessWeldWidth; } set { SetBusinessValue(ref _BusinessWeldWidth, value, "WeldWidth"); } } + [Column(Name = "SurfaceDefect", Storage = "_BusinessSurfaceDefect", DbType = "NVarChar(500)")] + public string SurfaceDefect { get { return _BusinessSurfaceDefect; } set { SetBusinessValue(ref _BusinessSurfaceDefect, value, "SurfaceDefect"); } } + [Column(Name = "PreheatTemperature", Storage = "_BusinessPreheatTemperature", DbType = "Decimal(18,2)")] + public decimal? PreheatTemperature { get { return _BusinessPreheatTemperature; } set { SetBusinessValue(ref _BusinessPreheatTemperature, value, "PreheatTemperature"); } } + [Column(Name = "InterpassTemperature", Storage = "_BusinessInterpassTemperature", DbType = "Decimal(18,2)")] + public decimal? InterpassTemperature { get { return _BusinessInterpassTemperature; } set { SetBusinessValue(ref _BusinessInterpassTemperature, value, "InterpassTemperature"); } } + [Column(Name = "CheckCode", Storage = "_BusinessCheckCode", DbType = "NVarChar(200)")] + public string CheckCode { get { return _BusinessCheckCode; } set { SetBusinessValue(ref _BusinessCheckCode, value, "CheckCode"); } } + + private void SetBusinessValue(ref T field, T value, string propertyName) + { + if (Equals(field, value)) return; + SendPropertyChanging(); + field = value; + SendPropertyChanged(propertyName); + } + } + + public partial class HJGL_WeldingDailyTempDetail + { + private string _BusinessTeamAuditMan; + private DateTime? _BusinessTeamAuditDate; + private string _BusinessProfessionalAuditMan; + private DateTime? _BusinessProfessionalAuditDate; + private string _BusinessWeldingMethodId; + private string _BusinessWeldTypeId; + private string _BusinessWeldingWire; + private string _BusinessWeldingRod; + + [Column(Name = "TeamAuditMan", Storage = "_BusinessTeamAuditMan", DbType = "NVarChar(50)")] + public string TeamAuditMan { get { return _BusinessTeamAuditMan; } set { SetAuditValue(ref _BusinessTeamAuditMan, value, "TeamAuditMan"); } } + [Column(Name = "TeamAuditDate", Storage = "_BusinessTeamAuditDate", DbType = "DateTime")] + public DateTime? TeamAuditDate { get { return _BusinessTeamAuditDate; } set { SetAuditValue(ref _BusinessTeamAuditDate, value, "TeamAuditDate"); } } + [Column(Name = "ProfessionalAuditMan", Storage = "_BusinessProfessionalAuditMan", DbType = "NVarChar(50)")] + public string ProfessionalAuditMan { get { return _BusinessProfessionalAuditMan; } set { SetAuditValue(ref _BusinessProfessionalAuditMan, value, "ProfessionalAuditMan"); } } + [Column(Name = "ProfessionalAuditDate", Storage = "_BusinessProfessionalAuditDate", DbType = "DateTime")] + public DateTime? ProfessionalAuditDate { get { return _BusinessProfessionalAuditDate; } set { SetAuditValue(ref _BusinessProfessionalAuditDate, value, "ProfessionalAuditDate"); } } + [Column(Name = "WeldingMethodId", Storage = "_BusinessWeldingMethodId", DbType = "NVarChar(50)")] + public string WeldingMethodId { get { return _BusinessWeldingMethodId; } set { SetAuditValue(ref _BusinessWeldingMethodId, value, "WeldingMethodId"); } } + [Column(Name = "WeldTypeId", Storage = "_BusinessWeldTypeId", DbType = "NVarChar(50)")] + public string WeldTypeId { get { return _BusinessWeldTypeId; } set { SetAuditValue(ref _BusinessWeldTypeId, value, "WeldTypeId"); } } + [Column(Name = "WeldingWire", Storage = "_BusinessWeldingWire", DbType = "NVarChar(50)")] + public string WeldingWire { get { return _BusinessWeldingWire; } set { SetAuditValue(ref _BusinessWeldingWire, value, "WeldingWire"); } } + [Column(Name = "WeldingRod", Storage = "_BusinessWeldingRod", DbType = "NVarChar(50)")] + public string WeldingRod { get { return _BusinessWeldingRod; } set { SetAuditValue(ref _BusinessWeldingRod, value, "WeldingRod"); } } + + private void SetAuditValue(ref T field, T value, string propertyName) + { + if (Equals(field, value)) return; + SendPropertyChanging(); + field = value; + SendPropertyChanged(propertyName); + } + } +} diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index 14596411..ec694d54 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -21516,8 +21516,6 @@ namespace Model private EntitySet _HJGL_WeldJoint; - private EntitySet _HJGL_PreWeldFitupCheck; - #region 可扩展性方法定义 partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); @@ -21535,7 +21533,6 @@ namespace Model public Base_GrooveType() { this._HJGL_WeldJoint = new EntitySet(new Action(this.attach_HJGL_WeldJoint), new Action(this.detach_HJGL_WeldJoint)); - this._HJGL_PreWeldFitupCheck = new EntitySet(new Action(this.attach_HJGL_PreWeldFitupCheck), new Action(this.detach_HJGL_PreWeldFitupCheck)); OnCreated(); } @@ -21632,19 +21629,6 @@ namespace Model } } - [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_PreWeldFitupCheck_GrooveType", Storage="_HJGL_PreWeldFitupCheck", ThisKey="GrooveTypeId", OtherKey="GrooveTypeId", DeleteRule="NO ACTION")] - public EntitySet HJGL_PreWeldFitupCheck - { - get - { - return this._HJGL_PreWeldFitupCheck; - } - set - { - this._HJGL_PreWeldFitupCheck.Assign(value); - } - } - public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; @@ -21677,17 +21661,6 @@ namespace Model entity.Base_GrooveType = null; } - private void attach_HJGL_PreWeldFitupCheck(HJGL_PreWeldFitupCheck entity) - { - this.SendPropertyChanging(); - entity.Base_GrooveType = this; - } - - private void detach_HJGL_PreWeldFitupCheck(HJGL_PreWeldFitupCheck entity) - { - this.SendPropertyChanging(); - entity.Base_GrooveType = null; - } } [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Base_HSSEStandardListType")] @@ -107989,12 +107962,6 @@ namespace Model private string _WeldJointId; - private string _GrooveTypeId; - - private string _GrooveProcessType; - - private System.Nullable _GrooveAngle; - private System.Nullable _FitupGap; private System.Nullable _Misalignment; @@ -108009,22 +107976,12 @@ namespace Model private string _Remark; - private System.Nullable _WeldReinforcement; - - private System.Nullable _WeldHeight; - - private System.Nullable _WeldWidth; - - private string _SurfaceDefect; - private string _CheckResult; private string _UnqualifiedReason; private string _RectifyRequirement; - private EntityRef _Base_GrooveType; - #region 可扩展性方法定义 partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); @@ -108035,12 +107992,6 @@ namespace Model partial void OnProjectIdChanged(); partial void OnWeldJointIdChanging(string value); partial void OnWeldJointIdChanged(); - partial void OnGrooveTypeIdChanging(string value); - partial void OnGrooveTypeIdChanged(); - partial void OnGrooveProcessTypeChanging(string value); - partial void OnGrooveProcessTypeChanged(); - partial void OnGrooveAngleChanging(System.Nullable value); - partial void OnGrooveAngleChanged(); partial void OnFitupGapChanging(System.Nullable value); partial void OnFitupGapChanged(); partial void OnMisalignmentChanging(System.Nullable value); @@ -108055,14 +108006,6 @@ namespace Model partial void OnCreateTimeChanged(); partial void OnRemarkChanging(string value); partial void OnRemarkChanged(); - partial void OnWeldReinforcementChanging(System.Nullable value); - partial void OnWeldReinforcementChanged(); - partial void OnWeldHeightChanging(System.Nullable value); - partial void OnWeldHeightChanged(); - partial void OnWeldWidthChanging(System.Nullable value); - partial void OnWeldWidthChanged(); - partial void OnSurfaceDefectChanging(string value); - partial void OnSurfaceDefectChanged(); partial void OnCheckResultChanging(string value); partial void OnCheckResultChanged(); partial void OnUnqualifiedReasonChanging(string value); @@ -108073,7 +108016,6 @@ namespace Model public HJGL_PreWeldFitupCheck() { - this._Base_GrooveType = default(EntityRef); OnCreated(); } @@ -108137,70 +108079,6 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_GrooveTypeId", DbType="NVarChar(50)")] - public string GrooveTypeId - { - get - { - return this._GrooveTypeId; - } - set - { - if ((this._GrooveTypeId != value)) - { - if (this._Base_GrooveType.HasLoadedOrAssignedValue) - { - throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); - } - this.OnGrooveTypeIdChanging(value); - this.SendPropertyChanging(); - this._GrooveTypeId = value; - this.SendPropertyChanged("GrooveTypeId"); - this.OnGrooveTypeIdChanged(); - } - } - } - - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_GrooveProcessType", DbType="NVarChar(100)")] - public string GrooveProcessType - { - get - { - return this._GrooveProcessType; - } - set - { - if ((this._GrooveProcessType != value)) - { - this.OnGrooveProcessTypeChanging(value); - this.SendPropertyChanging(); - this._GrooveProcessType = value; - this.SendPropertyChanged("GrooveProcessType"); - this.OnGrooveProcessTypeChanged(); - } - } - } - - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_GrooveAngle", DbType="Decimal(18,2)")] - public System.Nullable GrooveAngle - { - get - { - return this._GrooveAngle; - } - set - { - if ((this._GrooveAngle != value)) - { - this.OnGrooveAngleChanging(value); - this.SendPropertyChanging(); - this._GrooveAngle = value; - this.SendPropertyChanged("GrooveAngle"); - this.OnGrooveAngleChanged(); - } - } - } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FitupGap", DbType="Decimal(18,2)")] public System.Nullable FitupGap { @@ -108341,86 +108219,6 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WeldReinforcement", DbType="Decimal(18,2)")] - public System.Nullable WeldReinforcement - { - get - { - return this._WeldReinforcement; - } - set - { - if ((this._WeldReinforcement != value)) - { - this.OnWeldReinforcementChanging(value); - this.SendPropertyChanging(); - this._WeldReinforcement = value; - this.SendPropertyChanged("WeldReinforcement"); - this.OnWeldReinforcementChanged(); - } - } - } - - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WeldHeight", DbType="Decimal(18,2)")] - public System.Nullable WeldHeight - { - get - { - return this._WeldHeight; - } - set - { - if ((this._WeldHeight != value)) - { - this.OnWeldHeightChanging(value); - this.SendPropertyChanging(); - this._WeldHeight = value; - this.SendPropertyChanged("WeldHeight"); - this.OnWeldHeightChanged(); - } - } - } - - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WeldWidth", DbType="Decimal(18,2)")] - public System.Nullable WeldWidth - { - get - { - return this._WeldWidth; - } - set - { - if ((this._WeldWidth != value)) - { - this.OnWeldWidthChanging(value); - this.SendPropertyChanging(); - this._WeldWidth = value; - this.SendPropertyChanged("WeldWidth"); - this.OnWeldWidthChanged(); - } - } - } - - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SurfaceDefect", DbType="NVarChar(500)")] - public string SurfaceDefect - { - get - { - return this._SurfaceDefect; - } - set - { - if ((this._SurfaceDefect != value)) - { - this.OnSurfaceDefectChanging(value); - this.SendPropertyChanging(); - this._SurfaceDefect = value; - this.SendPropertyChanged("SurfaceDefect"); - this.OnSurfaceDefectChanged(); - } - } - } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CheckResult", DbType="NVarChar(20)")] public string CheckResult { @@ -108481,40 +108279,6 @@ namespace Model } } - [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_PreWeldFitupCheck_GrooveType", Storage="_Base_GrooveType", ThisKey="GrooveTypeId", OtherKey="GrooveTypeId", IsForeignKey=true)] - public Base_GrooveType Base_GrooveType - { - get - { - return this._Base_GrooveType.Entity; - } - set - { - Base_GrooveType previousValue = this._Base_GrooveType.Entity; - if (((previousValue != value) - || (this._Base_GrooveType.HasLoadedOrAssignedValue == false))) - { - this.SendPropertyChanging(); - if ((previousValue != null)) - { - this._Base_GrooveType.Entity = null; - previousValue.HJGL_PreWeldFitupCheck.Remove(this); - } - this._Base_GrooveType.Entity = value; - if ((value != null)) - { - value.HJGL_PreWeldFitupCheck.Add(this); - this._GrooveTypeId = value.GrooveTypeId; - } - else - { - this._GrooveTypeId = default(string); - } - this.SendPropertyChanged("Base_GrooveType"); - } - } - } - public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; @@ -279112,8 +278876,6 @@ namespace Model private string _TrustCode; - private string _OutputMasterId; - private System.Nullable _DemandDate; private System.Nullable _CompleteDate; @@ -279140,8 +278902,6 @@ namespace Model partial void OnConstructionProfessionalChanged(); partial void OnTrustCodeChanging(string value); partial void OnTrustCodeChanged(); - partial void OnOutputMasterIdChanging(string value); - partial void OnOutputMasterIdChanged(); partial void OnDemandDateChanging(System.Nullable value); partial void OnDemandDateChanged(); partial void OnCompleteDateChanging(System.Nullable value); @@ -279279,26 +279039,6 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OutputMasterId", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] - public string OutputMasterId - { - get - { - return this._OutputMasterId; - } - set - { - if ((this._OutputMasterId != value)) - { - this.OnOutputMasterIdChanging(value); - this.SendPropertyChanging(); - this._OutputMasterId = value; - this.SendPropertyChanged("OutputMasterId"); - this.OnOutputMasterIdChanged(); - } - } - } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DemandDate", DbType="DateTime")] public System.Nullable DemandDate { diff --git a/SGGL/Model/Model.csproj b/SGGL/Model/Model.csproj index 457d33c6..55275336 100644 --- a/SGGL/Model/Model.csproj +++ b/SGGL/Model/Model.csproj @@ -106,6 +106,7 @@ + @@ -282,6 +283,7 @@ + @@ -340,4 +342,4 @@ --> - \ No newline at end of file + diff --git a/SGGL/WebAPI/Controllers/BaseInfoController.cs b/SGGL/WebAPI/Controllers/BaseInfoController.cs index 7de135d2..b40682c3 100644 --- a/SGGL/WebAPI/Controllers/BaseInfoController.cs +++ b/SGGL/WebAPI/Controllers/BaseInfoController.cs @@ -269,6 +269,27 @@ namespace WebAPI.Controllers return responeData; } + /// + /// 按类型获取焊接耗材。 + /// + /// 焊材类型:1焊丝,2焊条 + /// 焊接耗材列表 + public Model.ResponeData GetWeldingConsumables(string consumablesType) + { + var responeData = new Model.ResponeData(); + try + { + responeData.data = BLL.APIBaseInfoService.GetWeldingConsumables(consumablesType); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + /// /// 获取探伤类型 /// @@ -1369,5 +1390,29 @@ namespace WebAPI.Controllers return responeData; } #endregion + + /// + /// 分页查询入库条码明细。 + /// + [HttpGet] + public Model.ResponeData GetInputDetailBarCodes(string barCodeKeyword, int pageIndex = 1, int pageSize = 20) + { + var responeData = new Model.ResponeData(); + try + { + pageIndex = pageIndex < 1 ? 1 : pageIndex; + pageSize = pageSize < 1 ? 20 : Math.Min(pageSize, 200); + var result = APIBaseInfoService.GetInputDetailBarCodes(barCodeKeyword, pageIndex, pageSize); + int totalCount = result.Item2; + int pageCount = totalCount == 0 ? 0 : (int)Math.Ceiling(totalCount / (double)pageSize); + responeData.data = new { pageCount, totalCount, getDataList = result.Item1 }; + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + return responeData; + } } } diff --git a/SGGL/WebAPI/Controllers/HJGL/WeldingManage/AntiCorrosionCheckController.cs b/SGGL/WebAPI/Controllers/HJGL/WeldingManage/AntiCorrosionCheckController.cs index 5c2c025c..27745721 100644 --- a/SGGL/WebAPI/Controllers/HJGL/WeldingManage/AntiCorrosionCheckController.cs +++ b/SGGL/WebAPI/Controllers/HJGL/WeldingManage/AntiCorrosionCheckController.cs @@ -10,8 +10,10 @@ namespace WebAPI.Controllers.HJGL.WeldingManage public class AntiCorrosionCheckController : ApiController { /// - /// 根据材料编码获取当前材料的所有除锈防腐记录。 + /// 根据入库条码获取材料信息及当前材料的所有除锈防腐记录。 /// + /// 入库明细条码,保留原参数名兼容现有客户端。 + /// 项目ID。 public Model.ResponeData GetRecordsByMaterialCode(string materialCode, string projectId) { var responeData = new Model.ResponeData(); diff --git a/SGGL/WebAPI/Controllers/HJGL/WeldingManage/PipeJointController.cs b/SGGL/WebAPI/Controllers/HJGL/WeldingManage/PipeJointController.cs index 19c16272..3af31d02 100644 --- a/SGGL/WebAPI/Controllers/HJGL/WeldingManage/PipeJointController.cs +++ b/SGGL/WebAPI/Controllers/HJGL/WeldingManage/PipeJointController.cs @@ -103,6 +103,32 @@ namespace WebAPI.Controllers return responeData; } + /// + /// 分页查询当前项目的全部焊口。 + /// + /// 项目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 = APIPipeJointService.GetAllWeldJoints( + projectId, pipelineCode, weldJointCode, pageIndex, pageSize); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + /// /// 获取焊工列表 /// @@ -262,4 +288,4 @@ namespace WebAPI.Controllers #endregion } -} \ No newline at end of file +} diff --git a/SGGL/WebAPI/Controllers/HJGL/WeldingManage/PreWeldingDailyController.cs b/SGGL/WebAPI/Controllers/HJGL/WeldingManage/PreWeldingDailyController.cs index 5f0b86f5..22651107 100644 --- a/SGGL/WebAPI/Controllers/HJGL/WeldingManage/PreWeldingDailyController.cs +++ b/SGGL/WebAPI/Controllers/HJGL/WeldingManage/PreWeldingDailyController.cs @@ -380,7 +380,40 @@ namespace WebAPI.Controllers } /// - /// 批量审核通过焊接日报待审核明细。 + /// 批量完成班组审核。 + /// + [HttpPost] + public Model.ResponeData TeamAuditPendingWeldingDailyTempDetails( + [FromBody] Model.WeldingDailyTempDetailBatchRequest request) + { + var responeData = new Model.ResponeData(); + try + { + if (request == null) + { + responeData.code = 0; + responeData.message = "参数不能为空"; + return responeData; + } + + string errlog = APIWeldReportService.TeamAuditPendingWeldingDailyTempDetails( + request.TempDetailIds, request.AuditMan); + if (!string.IsNullOrEmpty(errlog)) + { + responeData.code = 0; + responeData.message = errlog; + } + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + return responeData; + } + + /// + /// 批量完成专工审核;未完成班组审核的记录不能处理。 /// /// 批量审核参数 /// 批量处理结果 diff --git a/SGGL/WebAPI/Controllers/HJGL/WeldingManage/WeldTaskController.cs b/SGGL/WebAPI/Controllers/HJGL/WeldingManage/WeldTaskController.cs new file mode 100644 index 00000000..d4d53ea1 --- /dev/null +++ b/SGGL/WebAPI/Controllers/HJGL/WeldingManage/WeldTaskController.cs @@ -0,0 +1,58 @@ +using BLL; +using System; +using System.Web.Http; + +namespace WebAPI.Controllers.HJGL.WeldingManage +{ + public class WeldTaskController : ApiController + { + [HttpGet] + public Model.ResponeData GetTaskListByTeamGroup(string projectId, string teamGroupId = null, string unitWorkId = null) + { + var response = new Model.ResponeData(); + try + { + response.data = WeldTaskService.GetTaskListByTeamGroup(projectId, teamGroupId, unitWorkId); + } + catch (Exception ex) + { + response.code = 0; + response.message = ex.Message; + } + return response; + } + + [HttpGet] + public Model.ResponeData GetTaskDetail(string projectId, string taskCode) + { + var response = new Model.ResponeData(); + try + { + response.data = WeldTaskService.GetTaskDetail(projectId, taskCode); + } + catch (Exception ex) + { + response.code = 0; + response.message = ex.Message; + } + return response; + } + + [HttpPost] + public Model.ResponeData GenerateOutPlan([FromBody] Model.WeldTaskGenerateRequest request) + { + var response = new Model.ResponeData(); + try + { + if (request == null) throw new ArgumentNullException("request"); + WeldTaskService.GenerateOutPlanByTaskCode(request.ProjectId, request.TaskCode, request.PersonId); + } + catch (Exception ex) + { + response.code = 0; + response.message = ex.Message; + } + return response; + } + } +} diff --git a/SGGL/WebAPI/WebAPI.csproj b/SGGL/WebAPI/WebAPI.csproj index 70e338ab..f2b9e637 100644 --- a/SGGL/WebAPI/WebAPI.csproj +++ b/SGGL/WebAPI/WebAPI.csproj @@ -217,6 +217,7 @@ +