diff --git a/.vs/SGGL_SeDin_New/v17/.wsuo b/.vs/SGGL_SeDin_New/v17/.wsuo index 2b6a9900..7f596900 100644 Binary files a/.vs/SGGL_SeDin_New/v17/.wsuo and b/.vs/SGGL_SeDin_New/v17/.wsuo differ diff --git a/.vs/SGGL_SeDin_New/v17/DocumentLayout.backup.json b/.vs/SGGL_SeDin_New/v17/DocumentLayout.backup.json index 290e6c8a..4cf91a0b 100644 --- a/.vs/SGGL_SeDin_New/v17/DocumentLayout.backup.json +++ b/.vs/SGGL_SeDin_New/v17/DocumentLayout.backup.json @@ -8,21 +8,13 @@ "VerticalTabListWidth": 256, "DocumentGroups": [ { - "DockedWidth": 386, + "DockedWidth": 200, "SelectedChildIndex": -1, "Children": [ { "$type": "Bookmark", "Name": "ST:0:0:{e506b91c-c606-466a-90a9-123d1d1e12b3}" }, - { - "$type": "Bookmark", - "Name": "ST:130:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" - }, - { - "$type": "Bookmark", - "Name": "ST:132:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" - }, { "$type": "Bookmark", "Name": "ST:133:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" @@ -51,14 +43,6 @@ "$type": "Bookmark", "Name": "ST:3:0:{f2bd8fb8-fc94-3dae-a733-fd993c73cc87}" }, - { - "$type": "Bookmark", - "Name": "ST:129:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" - }, - { - "$type": "Bookmark", - "Name": "ST:131:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" - }, { "$type": "Bookmark", "Name": "ST:0:0:{1a46fd64-28d5-434c-8eb3-17a02d419b53}" @@ -67,6 +51,18 @@ "$type": "Bookmark", "Name": "ST:0:0:{5726b0e3-1012-5233-81f9-d1fad48e7a56}" }, + { + "$type": "Bookmark", + "Name": "ST:137:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:138:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:136:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, { "$type": "Bookmark", "Name": "ST:2:0:{b9f91511-5ca5-40ec-9726-f3e3a7e534e2}" @@ -77,7 +73,7 @@ }, { "$type": "Bookmark", - "Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + "Name": "ST:129:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" } ] } diff --git a/DataBase/版本日志/SGGLDB_V2025-07-02-001-bwj.sql b/DataBase/版本日志/SGGLDB_V2025-07-02-001-bwj.sql new file mode 100644 index 00000000..d9bfa7b2 --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2025-07-02-001-bwj.sql @@ -0,0 +1,33 @@ + +alter table PTP_PipelineList add TestPackageNo varchar(50) +go + +ALTER VIEW [dbo].[View_TestPackage_PipelineList] +as +/*********ѹϸ**********/ +select l.PT_PipeId, +l.PTP_ID, +l.PipelineId, +l.TestPressure, +t.ProjectId, +t.TestPackageNo, +t.TestPackageName, +t.Remark, +t.UnitWorkId, +t.Tabler, +t.TableDate, +p.PipelineCode, +uw.UnitWorkCode, +uw.UnitWorkName, +uw.UnitId, +u.UnitCode, +u.UnitName, +t.adjustTestPressure +from PTP_PipelineList l +left join PTP_TestPackage as t on t.PTP_ID=l.PTP_ID +left join HJGL_Pipeline p on p.PipelineId = l.PipelineId +left join WBS_UnitWork uw on uw.UnitWorkId = t.UnitWorkId +left join Base_Unit u on u.UnitId =uw.UnitId +GO + + diff --git a/DataBase/版本日志/SGGLDB_V2025-07-10-001-bwj.sql b/DataBase/版本日志/SGGLDB_V2025-07-10-001-bwj.sql new file mode 100644 index 00000000..8b7c1f05 --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2025-07-10-001-bwj.sql @@ -0,0 +1,9 @@ + +insert into Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed) +values('244F69AE-EBD0-4DFA-A959-E13CE8D85968','ѹ','HJGL/TestPackage/TestPackageData.aspx',60,'A24B7926-EF69-456E-8A24-936D30384680','Menu_HJGL',0,1,1) +go + +alter table [dbo].[PTP_TestPackage] add PrintState int +go +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ӡ״̬δӡһ......δӡ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'PTP_TestPackage', @level2type=N'COLUMN',@level2name=N'PrintState' +GO \ No newline at end of file diff --git a/SGGL/BLL/BLL.csproj b/SGGL/BLL/BLL.csproj index 0c75a797..7495a1d5 100644 --- a/SGGL/BLL/BLL.csproj +++ b/SGGL/BLL/BLL.csproj @@ -56,6 +56,10 @@ ..\packages\EmitMapper.1.0.0\lib\EmitMapper.dll + + False + bin\Debug\FastReport.dll + False ..\FineUIPro\FineUIPro.dll diff --git a/SGGL/BLL/Common/ConstValue.cs b/SGGL/BLL/Common/ConstValue.cs index e316b5ee..955c41a4 100644 --- a/SGGL/BLL/Common/ConstValue.cs +++ b/SGGL/BLL/Common/ConstValue.cs @@ -92,6 +92,11 @@ namespace BLL { return Funs.DB.Sys_Const.FirstOrDefault(e => e.ConstValue == constValue && e.GroupId == groupId); } + + public static Sys_Const GetConstByConstText(string constText) + { + return Funs.DB.Sys_Const.FirstOrDefault(e => e.ConstText == constText); + } public static void DeleteConstValueBygroupId(string groupId) { var q = Funs.DB.Sys_Const.Where(x => x.GroupId == groupId); diff --git a/SGGL/BLL/Common/FastReport.cs b/SGGL/BLL/Common/FastReport.cs index e4e7aef1..a044c483 100644 --- a/SGGL/BLL/Common/FastReport.cs +++ b/SGGL/BLL/Common/FastReport.cs @@ -1,6 +1,12 @@ -using System.Collections.Generic; +using System.Web; +using System.Web.Security; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; using System.Data; -using System.Web; +using FastReport; + namespace BLL { public static class FastReportService @@ -30,5 +36,58 @@ namespace BLL } + /// + /// 合并报表后打印 + /// + /// 报表实体集 + /// 导出的路径 + public static void ExportMergeReport(List fastReportItems, string path, string printType) + { + Report report = new Report(); + report.PrintSettings.ShowDialog = false; //隐藏弹窗 + FastReport.EnvironmentSettings settings = new EnvironmentSettings(); + settings.ReportSettings.ShowProgress = false; //隐藏进度条 + for (int i = 0; i < fastReportItems.Count; i++) + { + report.Load(Funs.RootPath + fastReportItems[i].ReportPath); //加载报表 + + List dataTables = fastReportItems[i].DataTables; + Dictionary ParameterValues = fastReportItems[i].ParameterValues; + if (dataTables != null && dataTables.Count > 0) + { + for (int j = 0; j < dataTables.Count; j++) + { + report.RegisterData(dataTables[j], dataTables[j].TableName);//绑定数据源 + } + } + if (ParameterValues.Count > 0) + { + foreach (KeyValuePair kvp in ParameterValues) + { + report.SetParameterValue(kvp.Key, kvp.Value);//绑定参数 + } + } + if (i == 0) + { + report.Prepare(); + } + else + { + report.Prepare(true); + } + } + if (printType == "1") + { + FastReport.Export.Pdf.PDFExport exp = new FastReport.Export.Pdf.PDFExport(); + report.Export(exp, path); + } + else if (printType == "2") + { + FastReport.Export.OoXML.Word2007Export exportBase = new FastReport.Export.OoXML.Word2007Export(); + report.Export(export: exportBase, fileName: path.Replace(oldValue: "pdf", newValue: "docx")); + } + } + + } } diff --git a/SGGL/BLL/HJGL/PointTrust/Batch_BatchTrustItemService.cs b/SGGL/BLL/HJGL/PointTrust/Batch_BatchTrustItemService.cs index bfddb0e5..56fc3fb9 100644 --- a/SGGL/BLL/HJGL/PointTrust/Batch_BatchTrustItemService.cs +++ b/SGGL/BLL/HJGL/PointTrust/Batch_BatchTrustItemService.cs @@ -144,5 +144,21 @@ namespace BLL return isShow; } #endregion + + + /// + /// 根据委托Id删除明细 + /// + /// + public static void DeleteTrustItemByTrustBatchId(string trustBatchId) + { + Model.SGGLDB db = Funs.DB; + var trustBatchItems = from x in db.HJGL_Batch_BatchTrustItem where x.TrustBatchId == trustBatchId select x; + if (trustBatchItems != null) + { + db.HJGL_Batch_BatchTrustItem.DeleteAllOnSubmit(trustBatchItems); + db.SubmitChanges(); + } + } } } diff --git a/SGGL/BLL/HJGL/TestPackage/TestPackageEditService.cs b/SGGL/BLL/HJGL/TestPackage/TestPackageEditService.cs index a3314e5e..c1ddf1ef 100644 --- a/SGGL/BLL/HJGL/TestPackage/TestPackageEditService.cs +++ b/SGGL/BLL/HJGL/TestPackage/TestPackageEditService.cs @@ -455,5 +455,14 @@ namespace BLL db.SubmitChanges(); } } + + public static void AddPipelineLists(List pipelineList) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + db.PTP_PipelineList.InsertAllOnSubmit(pipelineList); + db.SubmitChanges(); + } + } } } diff --git a/SGGL/BLL/HSSE/CostGoods/CostManageService.cs b/SGGL/BLL/HSSE/CostGoods/CostManageService.cs index 5ba8d146..660ee615 100644 --- a/SGGL/BLL/HSSE/CostGoods/CostManageService.cs +++ b/SGGL/BLL/HSSE/CostGoods/CostManageService.cs @@ -386,28 +386,17 @@ namespace BLL select x; var projectModel=ProjectService.GetProjectByProjectId(projectId); var contractModel = CostManageService.GetCostManageById(costManageId); - decimal totalAmount = costData.Sum(x => x.SumMoney ?? 0); + //decimal totalAmount = costData.Sum(x => x.SumMoney ?? 0); var files = new List(); if (contractModel!=null) - { - var fileDetails = GetBase64FilesWithDetails(contractModel.CostManageId); - if (fileDetails != null && fileDetails.Count > 0) + { + var url = ConstValue.GetConstByConstText("PU_PUSH_URL")?.ConstValue; + if (string.IsNullOrEmpty(url)) { - files.AddRange(fileDetails); + message = "未配置推送接口地址"; + return message; + } - - // 构建请求体 - var requestBody = new - { - projectNumber = projectModel.ProjectCode, - contractNo = contractNum, - amountHSE = totalAmount.ToString(), - files = files - }; - var jsonBody = JsonConvert.SerializeObject(requestBody); - - // 调用HSE接口推送数据 - var url = "http://172.29.60.33:9037"; var requestGetTokenUrl = url + "/auth/getToken"; string requestGetTokenBody = "{\"username\": \"coadmin\",\"password\": \"coadminPu@2025\"}"; var response = Funs.RequestPost(requestGetTokenUrl, "", requestGetTokenBody); @@ -425,10 +414,55 @@ namespace BLL { message = "获取Pu系统Token失败,Token为空"; return message; - } + } Dictionary headers = new Dictionary(); headers.Add("Authorization", "Bearer " + accessToken); + #region 先获取当前费用是否已经推送过 + var getRequestUrl = url + "/pu_api/payCraftAmountToHSE/get"; + var getRequestbody= $"{{\"projectNumber\":\"{projectModel.ProjectCode}\",\"contractNo\":\"{contractNum}\"}}"; + APICommonService.SaveSysHttpLog("PU_GetPuPayCraftAmount", getRequestUrl, getRequestbody, "Requset"); + var getResponse = Funs.RequestPost(getRequestUrl, headers, getRequestbody); + APICommonService.SaveSysHttpLog("PU_GetPuPayCraftAmount", getRequestUrl, getResponse, "Response"); + var getResponseStr = JsonConvert.DeserializeObject(getResponse); + if (getResponseStr == null) + { + message = "推送数据到HSE系统失败"; + return message; + } + else if (getResponseStr["code"]?.ToString() != "200") + { + message = getResponseStr["message"]?.ToString(); + return message; + } + var getResponseOutput = JsonConvert.DeserializeObject>(getResponseStr["data"]?.ToString()) ; + if (getResponseOutput.Any() && getResponseOutput.Count(x=>x.itemNo== costManageId)>0) + { + message = "当前费用已推送,无需重复推送!"; + return message; + } + + #endregion + + #region 推送数据至Pu var requestUrl = url + "/pu_api/payCraftAmountToHSE/add"; + // 构建请求体 + var fileDetails = GetBase64FilesWithDetails(contractModel.CostManageId); + if (fileDetails != null && fileDetails.Count > 0) + { + files.AddRange(fileDetails); + } + List puAddApiInputs = new List() + { + new PuAddApiInput() + { + projectNumber = projectModel.ProjectCode, + itemId= costManageId, + contractNo = contractNum, + amountHSE = contractModel.SumMoney.ToString(), + files = files + } + }; + var jsonBody = JsonConvert.SerializeObject(puAddApiInputs); APICommonService.SaveSysHttpLog("PU_AddPuPayCraftAmount", requestUrl, jsonBody, "Requset"); var responseHSE = Funs.RequestPost(requestUrl, headers, jsonBody); var responseHSEStr = JsonConvert.DeserializeObject(responseHSE); @@ -438,16 +472,23 @@ namespace BLL message = "推送数据到HSE系统失败"; return message; } + else if ( string.IsNullOrEmpty(responseHSEStr["code"]?.ToString())) + { + message = responseHSE; + return message; + } else if (responseHSEStr["code"]?.ToString() != "200") { message = responseHSEStr["message"]?.ToString(); return message; } - else + else { message = ""; return message; } + #endregion + } return message; @@ -459,7 +500,6 @@ namespace BLL return "推送数据失败"; } } - /// /// 获取Base64编码的附件文件 /// @@ -468,37 +508,39 @@ namespace BLL var result = new List(); // 获取费用管理信息 var costManage = GetCostManageById(costManageId); - // 获取附件文件 - var attachments = AttachFileService.getFileUrl(costManageId); + var costItem = BLL.CostManageItemService.GetCostManageItemByCostManageId(costManageId); + foreach (var item in costItem) + { // 获取附件文件 + var attachments = AttachFileService.getFileUrl(item.CostManageItemId); - if (!string.IsNullOrEmpty(attachments)) - { - string[] filePaths = attachments.Split(','); - foreach (var filePath in filePaths) + if (!string.IsNullOrEmpty(attachments)) { - string fullPath = Funs.RootPath + filePath; - if (File.Exists(fullPath)) + string[] filePaths = attachments.Split(','); + foreach (var filePath in filePaths) { - FileInfo file = new FileInfo(fullPath); - byte[] fileBytes = File.ReadAllBytes(fullPath); - string base64Content = Convert.ToBase64String(fileBytes); - - result.Add(new Model.PuPayCraftAmountFileInput + string fullPath = Funs.RootPath + filePath; + if (File.Exists(fullPath)) { - name = file.Name, - content = base64Content, - thisamount = costManage?.SumMoney?.ToString() ?? "0", - date = costManage?.CostManageDate?.ToString("yyyy-MM-dd") ?? DateTime.Now.ToString("yyyy-MM-dd") - }); - } - else - { - /* message += $"附件文件路径 {fullPath} 不存在!"; - ErrLogInfo.WriteLog(message, $"File not found: {fullPath}");*/ + FileInfo file = new FileInfo(fullPath); + byte[] fileBytes = File.ReadAllBytes(fullPath); + string base64Content = Convert.ToBase64String(fileBytes); + + result.Add(new Model.PuPayCraftAmountFileInput + { + name = file.Name, + content = base64Content, + thisamount = item?.PriceMoney?.ToString() ?? "0", + date = costManage?.CompileDate?.ToString("yyyy-MM-dd") ?? DateTime.Now.ToString("yyyy-MM-dd") + }); + + continue;//只取第一个文件 + } } } } + + return result; } diff --git a/SGGL/FineUIPro.Web/File/Excel/DataIn/试压包导入模版.xlsx b/SGGL/FineUIPro.Web/File/Excel/DataIn/试压包导入模版.xlsx new file mode 100644 index 00000000..8eee13d8 Binary files /dev/null and b/SGGL/FineUIPro.Web/File/Excel/DataIn/试压包导入模版.xlsx differ diff --git a/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道压力包文件资料目录.frx b/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道压力包文件资料目录.frx new file mode 100644 index 00000000..42f0ebf2 --- /dev/null +++ b/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道压力包文件资料目录.frx @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道压力试验技术要求.frx b/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道压力试验技术要求.frx new file mode 100644 index 00000000..dc0a28f4 --- /dev/null +++ b/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道压力试验技术要求.frx @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道系统压力试验条件确认记录.frx b/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道系统压力试验条件确认记录.frx new file mode 100644 index 00000000..5abb8cb5 --- /dev/null +++ b/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道系统压力试验条件确认记录.frx @@ -0,0 +1,293 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道系统压力试验记录.frx b/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道系统压力试验记录.frx new file mode 100644 index 00000000..f29c6508 --- /dev/null +++ b/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道系统压力试验记录.frx @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道试压包尾项清单.frx b/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道试压包尾项清单.frx new file mode 100644 index 00000000..56cc5f45 --- /dev/null +++ b/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道试压包尾项清单.frx @@ -0,0 +1,175 @@ + + + using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Windows.Forms; +using System.Drawing; +using System.Data; +using FastReport; +using FastReport.Data; +using FastReport.Dialog; +using FastReport.Barcode; +using FastReport.Table; +using FastReport.Utils; + +namespace FastReport +{ + public class ReportScript + { + + private void Table2_ManualBuild(object sender, EventArgs e) + { + DataSourceBase rowData = Report.GetDataSource("Data"); + // init the data source + rowData.Init(); + + // print the first table row - it is a header + + // now enumerate the data source and print the table body + while (rowData.HasMoreRows) + { + // print the table body + Table2.PrintRow(0); + Table2.PrintColumns(); + + // go next data source row + rowData.Next(); + } + } + } +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道试压包文件资料.frx b/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道试压包文件资料.frx new file mode 100644 index 00000000..9af7e298 --- /dev/null +++ b/SGGL/FineUIPro.Web/File/Fastreport/JGZL/管道试压包文件资料.frx @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index 028f77fb..1e0adbfb 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -307,6 +307,9 @@ + + + @@ -1612,6 +1615,7 @@ + @@ -10991,6 +10995,13 @@ TestPackageCompleteEdit.aspx + + TestPackageData.aspx + ASPXCodeBehind + + + TestPackageData.aspx + TestPackageEdit.aspx ASPXCodeBehind @@ -16785,7 +16796,7 @@ - + diff --git a/SGGL/FineUIPro.Web/HJGL/NDT/NDTBatchImport.aspx.cs b/SGGL/FineUIPro.Web/HJGL/NDT/NDTBatchImport.aspx.cs index b080ccd1..3a322824 100644 --- a/SGGL/FineUIPro.Web/HJGL/NDT/NDTBatchImport.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/NDT/NDTBatchImport.aspx.cs @@ -1,6 +1,8 @@ -using BLL; +using Aspose.Words.Lists; +using BLL; using MiniExcelLibs; using Model; +using NPOI.SS.Util; using System; using System.Collections.Generic; using System.Data; @@ -141,19 +143,6 @@ namespace FineUIPro.Web.HJGL.NDT { if (e.EventArgument == "Confirm_OK") { - //string rootPath = Server.MapPath("~/"); - //string uploadfilepath = rootPath + Const.NDTBatchTemplateUrl; - //string filePath = Const.NDTBatchTemplateUrl; - //string fileName = Path.GetFileName(filePath); - //FileInfo info = new FileInfo(uploadfilepath); - //long fileSize = info.Length; - //Response.ClearContent(); - //Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8)); - //Response.ContentType = "excel/plain"; - //Response.ContentEncoding = System.Text.Encoding.UTF8; - //Response.AddHeader("Content-Length", fileSize.ToString().Trim()); - //Response.TransmitFile(uploadfilepath, 0, fileSize); - //Response.End(); string rootPath = Server.MapPath("~/"); string initTemplatePath = Const.NDTBatchTemplateUrl; string uploadfilepath = string.Empty; @@ -177,8 +166,8 @@ namespace FineUIPro.Web.HJGL.NDT NPOI.SS.UserModel.IWorkbook workbook; using (FileStream stream = new FileStream(newUrl, FileMode.Open, FileAccess.Read)) { - workbook = new NPOI.XSSF.UserModel.XSSFWorkbook(stream); - //workbook = new NPOI.HSSF.UserModel.HSSFWorkbook(stream); + workbook = new NPOI.XSSF.UserModel.XSSFWorkbook(stream);//.xlsx + //workbook = new NPOI.HSSF.UserModel.HSSFWorkbook(stream);//.xls } // 创建单元格样式 NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle(); @@ -188,17 +177,36 @@ namespace FineUIPro.Web.HJGL.NDT cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin; cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center; cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center; - cellStyle.WrapText = true;//自动换行 + cellStyle.WrapText = true;//自动换行 var font = workbook.CreateFont(); font.FontHeightInPoints = 10; cellStyle.SetFont(font); - // 第二步:创建新数据行 + //尾部样式 + NPOI.SS.UserModel.ICellStyle bottomStyle = workbook.CreateCellStyle(); + bottomStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin; + bottomStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin; + bottomStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin; + bottomStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin; + bottomStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Left; + bottomStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Top; + bottomStyle.WrapText = true;//自动换行 + var bottomfont = workbook.CreateFont(); + bottomfont.FontHeightInPoints = 10; + bottomStyle.SetFont(bottomfont); + + //第二步:创建新数据行 NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0); NPOI.SS.UserModel.IRow row = sheet.GetRow(0); NPOI.SS.UserModel.ICell cell; - // 添加数据 + //设置生成下拉框的行和列 + SetCellDropdownList(sheet, 6, 6, new List() { "合格", "不合格" }.ToArray());//是否合格 + SetCellDropdownList(sheet, 7, 7, new List() { "Ⅰ", "Ⅱ", "Ⅲ", "Ⅳ", "Ⅴ" }.ToArray());//评定级别 + var defects = from x in Funs.DB.Base_Defect select x.DefectName;//缺陷 + SetCellDropdownList(sheet, 8, 8, new List() { string.Join(",", defects.ToList())}.ToArray()); + + //添加数据 cell = row.CreateCell(7); cell.CellStyle = cellStyle; cell.SetCellValue(batchTrust.ProjectName);//工程名称 @@ -244,63 +252,351 @@ namespace FineUIPro.Web.HJGL.NDT if (!string.IsNullOrEmpty(batchTrustItemLists.FirstOrDefault().GrooveTypeCode)) { cell.SetCellValue(batchTrustItemLists.FirstOrDefault().GrooveTypeCode);//坡口形式 - } + } cell = row5.CreateCell(7); cell.CellStyle = cellStyle; cell.SetCellValue(batchTrust.DetectionRateValue + "%");//检测比例 - int i = 9; - foreach (var item in batchTrustItemLists) + //未满11行,填充空白行到11行;超过11行按实际行填充 + if (batchTrustItemLists.Count() < 11) { - // 第二步:创建新数据行 - row = sheet.CreateRow(i); - // 添加数据 + foreach (var item in batchTrustItemLists) + { + // 第二步:创建新数据行 + row = sheet.CreateRow(i); + // 添加数据 + cell = row.CreateCell(0); + cell.CellStyle = cellStyle; + cell.SetCellValue((i - 8).ToString());//序号 + + cell = row.CreateCell(1); + cell.CellStyle = cellStyle; + cell.SetCellValue(item.PipelineCode.ToString());//管线号 + + cell = row.CreateCell(2); + cell.CellStyle = cellStyle; + cell.SetCellValue(item.WeldJointCode);//焊口号 + + cell = row.CreateCell(3); + cell.CellStyle = cellStyle; + cell.SetCellValue(item.WelderCode);//焊工号 + + cell = row.CreateCell(4); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//检测总数 + + cell = row.CreateCell(5); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//合格数 + + cell = row.CreateCell(6); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//是否合格 + + cell = row.CreateCell(7); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//评定级别 + + cell = row.CreateCell(8); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//缺陷 + + cell = row.CreateCell(9); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//返修位置 + + cell = row.CreateCell(10); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//备注 + i++; + } + + for (int j = 0; j < 11 - batchTrustItemLists.Count(); j++) + { + // 第二步:创建新数据行 + row = sheet.CreateRow(i); + // 添加数据 + cell = row.CreateCell(0); + cell.CellStyle = cellStyle; + cell.SetCellValue((i - 8).ToString());//序号 + + cell = row.CreateCell(1); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//管线号 + + cell = row.CreateCell(2); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//焊口号 + + cell = row.CreateCell(3); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//焊工号 + + cell = row.CreateCell(4); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//检测总数 + + cell = row.CreateCell(5); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//合格数 + + cell = row.CreateCell(6); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//是否合格 + + cell = row.CreateCell(7); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//评定级别 + + cell = row.CreateCell(8); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//缺陷 + + cell = row.CreateCell(9); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//返修位置 + + cell = row.CreateCell(10); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//备注 + + i++; + } + + //尾部 签字盖章 + // 创建新数据行 + row = sheet.CreateRow(20); + row.HeightInPoints = 43; + CellRangeAddress region = new CellRangeAddress(20, 20, 0, 1); + sheet.AddMergedRegion(region); cell = row.CreateCell(0); - cell.CellStyle = cellStyle; - cell.SetCellValue((i - 8).ToString());//序号 + cell.SetCellValue("委托方单位:"); + cell.CellStyle = bottomStyle; cell = row.CreateCell(1); - cell.CellStyle = cellStyle; - cell.SetCellValue(item.PipelineCode.ToString());//管线号 + cell.CellStyle = bottomStyle; + region = new CellRangeAddress(20, 20, 2, 3); + sheet.AddMergedRegion(region); cell = row.CreateCell(2); - cell.CellStyle = cellStyle; - cell.SetCellValue(item.WeldJointCode);//焊口号 + cell.SetCellValue("评片人:"); + cell.CellStyle = bottomStyle; cell = row.CreateCell(3); - cell.CellStyle = cellStyle; - cell.SetCellValue(item.WelderCode);//焊工号 + cell.CellStyle = bottomStyle; + region = new CellRangeAddress(20, 20, 4, 6); + sheet.AddMergedRegion(region); cell = row.CreateCell(4); - cell.CellStyle = cellStyle; - cell.SetCellValue("");//检测总数 + cell.SetCellValue("检测方单位:"); + cell.CellStyle = bottomStyle; cell = row.CreateCell(5); - cell.CellStyle = cellStyle; - cell.SetCellValue("");//合格数 - + cell.CellStyle = bottomStyle; cell = row.CreateCell(6); - cell.CellStyle = cellStyle; - cell.SetCellValue("");//是否合格 + cell.CellStyle = bottomStyle; + region = new CellRangeAddress(20, 20, 7, 10); + sheet.AddMergedRegion(region); cell = row.CreateCell(7); - cell.CellStyle = cellStyle; - cell.SetCellValue("");//评定级别 + cell.SetCellValue("监理单位:"); + cell.CellStyle = bottomStyle; cell = row.CreateCell(8); - cell.CellStyle = cellStyle; - cell.SetCellValue("");//缺陷 - + cell.CellStyle = bottomStyle; cell = row.CreateCell(9); - cell.CellStyle = cellStyle; - cell.SetCellValue("");//返修位置 - + cell.CellStyle = bottomStyle; cell = row.CreateCell(10); - cell.CellStyle = cellStyle; - cell.SetCellValue("");//备注 - i++; + cell.CellStyle = bottomStyle; + + row = sheet.CreateRow(21); + row.HeightInPoints = 43; + region = new CellRangeAddress(21, 21, 0, 1); + sheet.AddMergedRegion(region); + cell = row.CreateCell(0); + cell.SetCellValue("日期:"); + cell.CellStyle = bottomStyle; + + cell = row.CreateCell(1); + cell.CellStyle = bottomStyle; + + region = new CellRangeAddress(21, 21, 2, 3); + sheet.AddMergedRegion(region); + cell = row.CreateCell(2); + cell.SetCellValue("日期:"); + cell.CellStyle = bottomStyle; + + cell = row.CreateCell(3); + cell.CellStyle = bottomStyle; + + region = new CellRangeAddress(21, 21, 4, 6); + sheet.AddMergedRegion(region); + cell = row.CreateCell(4); + cell.SetCellValue("日期:"); + cell.CellStyle = bottomStyle; + + cell = row.CreateCell(5); + cell.CellStyle = bottomStyle; + cell = row.CreateCell(6); + cell.CellStyle = bottomStyle; + + region = new CellRangeAddress(21, 21, 7, 10); + sheet.AddMergedRegion(region); + cell = row.CreateCell(7); + cell.SetCellValue("日期:"); + cell.CellStyle = bottomStyle; + + cell = row.CreateCell(8); + cell.CellStyle = bottomStyle; + cell = row.CreateCell(9); + cell.CellStyle = bottomStyle; + cell = row.CreateCell(10); + cell.CellStyle = bottomStyle; + } + else + { + foreach (var item in batchTrustItemLists) + { + // 第二步:创建新数据行 + row = sheet.CreateRow(i); + // 添加数据 + cell = row.CreateCell(0); + cell.CellStyle = cellStyle; + cell.SetCellValue((i - 8).ToString());//序号 + + cell = row.CreateCell(1); + cell.CellStyle = cellStyle; + cell.SetCellValue(item.PipelineCode.ToString());//管线号 + + cell = row.CreateCell(2); + cell.CellStyle = cellStyle; + cell.SetCellValue(item.WeldJointCode);//焊口号 + + cell = row.CreateCell(3); + cell.CellStyle = cellStyle; + cell.SetCellValue(item.WelderCode);//焊工号 + + cell = row.CreateCell(4); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//检测总数 + + cell = row.CreateCell(5); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//合格数 + + cell = row.CreateCell(6); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//是否合格 + + cell = row.CreateCell(7); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//评定级别 + + cell = row.CreateCell(8); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//缺陷 + + cell = row.CreateCell(9); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//返修位置 + + cell = row.CreateCell(10); + cell.CellStyle = cellStyle; + cell.SetCellValue("");//备注 + i++; + } + + //尾部 签字盖章 + // 创建新数据行 + row = sheet.CreateRow(i); + row.HeightInPoints = 43; + CellRangeAddress region = new CellRangeAddress(i, i, 0, 1); + sheet.AddMergedRegion(region); + cell = row.CreateCell(0); + cell.SetCellValue("委托方单位:"); + cell.CellStyle = bottomStyle; + + cell = row.CreateCell(1); + cell.CellStyle = bottomStyle; + + region = new CellRangeAddress(i, i, 2, 3); + sheet.AddMergedRegion(region); + cell = row.CreateCell(2); + cell.SetCellValue("评片人:"); + cell.CellStyle = bottomStyle; + + cell = row.CreateCell(3); + cell.CellStyle = bottomStyle; + + region = new CellRangeAddress(i, i, 4, 6); + sheet.AddMergedRegion(region); + cell = row.CreateCell(4); + cell.SetCellValue("检测方单位:"); + cell.CellStyle = bottomStyle; + + cell = row.CreateCell(5); + cell.CellStyle = bottomStyle; + cell = row.CreateCell(6); + cell.CellStyle = bottomStyle; + + region = new CellRangeAddress(i, i, 7, 10); + sheet.AddMergedRegion(region); + cell = row.CreateCell(7); + cell.SetCellValue("监理单位:"); + cell.CellStyle = bottomStyle; + + cell = row.CreateCell(8); + cell.CellStyle = bottomStyle; + cell = row.CreateCell(9); + cell.CellStyle = bottomStyle; + cell = row.CreateCell(10); + cell.CellStyle = bottomStyle; + + row = sheet.CreateRow(i + 1); + row.HeightInPoints = 43; + region = new CellRangeAddress(i + 1, i + 1, 0, 1); + sheet.AddMergedRegion(region); + cell = row.CreateCell(0); + cell.SetCellValue("日期:"); + cell.CellStyle = bottomStyle; + + cell = row.CreateCell(1); + cell.CellStyle = bottomStyle; + + region = new CellRangeAddress(i + 1, i + 1, 2, 3); + sheet.AddMergedRegion(region); + cell = row.CreateCell(2); + cell.SetCellValue("日期:"); + cell.CellStyle = bottomStyle; + + cell = row.CreateCell(3); + cell.CellStyle = bottomStyle; + + region = new CellRangeAddress(i + 1, i + 1, 4, 6); + sheet.AddMergedRegion(region); + cell = row.CreateCell(4); + cell.SetCellValue("日期:"); + cell.CellStyle = bottomStyle; + + cell = row.CreateCell(5); + cell.CellStyle = bottomStyle; + cell = row.CreateCell(6); + cell.CellStyle = bottomStyle; + + region = new CellRangeAddress(i + 1, i + 1, 7, 10); + sheet.AddMergedRegion(region); + cell = row.CreateCell(7); + cell.SetCellValue("日期:"); + cell.CellStyle = bottomStyle; + + cell = row.CreateCell(8); + cell.CellStyle = bottomStyle; + cell = row.CreateCell(9); + cell.CellStyle = bottomStyle; + cell = row.CreateCell(10); + cell.CellStyle = bottomStyle; } // 第三步:写入文件流 using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write)) @@ -322,7 +618,37 @@ namespace FineUIPro.Web.HJGL.NDT } } } + + /// + /// 设置单元格下拉框约束 + /// + /// + /// + /// + /// + public static void SetCellDropdownList(NPOI.SS.UserModel.ISheet sheet, int firstcol, int lastcol, string[] vals) + { + //设置生成下拉框的行和列 + var cellRegions = new CellRangeAddressList(1, 65535, firstcol, lastcol); + NPOI.SS.UserModel.IDataValidation validation = null; + + if (sheet.GetType().Name.Contains("XSSF")) // .xlsx + { + NPOI.XSSF.UserModel.XSSFDataValidationHelper helper = new NPOI.XSSF.UserModel.XSSFDataValidationHelper((NPOI.XSSF.UserModel.XSSFSheet)sheet);//获得一个数据验证Helper + //IDataValidation + validation = helper.CreateValidation( + helper.CreateExplicitListConstraint(vals), cellRegions);//创建约束 + } + else // HSSF .xls + { + //設置 下拉框內容 + NPOI.HSSF.UserModel.DVConstraint constraint = NPOI.HSSF.UserModel.DVConstraint.CreateExplicitListConstraint(vals); + validation = new NPOI.HSSF.UserModel.HSSFDataValidation(cellRegions, constraint); + } + sheet.AddValidationData(validation); + } #endregion + #region 将Dataset的数据导入数据库 /// /// 将Dataset的数据导入数据库 @@ -341,7 +667,7 @@ namespace FineUIPro.Web.HJGL.NDT responeData.message = "导入Excel格式错误!Excel只有" + count.ToString().Trim() + "列"; return responeData; } - if (pds.Count > 0 && pds != null) + if (pds.Count-2 > 0 && pds != null) { string NDEId = string.Empty; //string unitworkId = string.Empty; @@ -415,143 +741,138 @@ namespace FineUIPro.Web.HJGL.NDT ndes.Add(nde); } - for (int i = 9; i < pds.Count; i++) + for (int i = 9; i < pds.Count - 2; i++) { - HJGL_Batch_NDEItem item = new HJGL_Batch_NDEItem(); - item.NDEItemID = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_NDEItem)); - item.NDEID = NDEId; - var batchTrustItems = BLL.Batch_BatchTrustItemService.GetViewBatchTrustItem(this.TrustBatchId); - if (batchTrustItems != null) + if (!string.IsNullOrEmpty(pds[i].B.ToString()) && !string.IsNullOrEmpty(pds[i].C.ToString())) { - var trustItem = batchTrustItems.FirstOrDefault(x => x.PipelineCode == pds[i].B.ToString() && x.WeldJointCode == pds[i].C.ToString()); - if (trustItem != null) + HJGL_Batch_NDEItem item = new HJGL_Batch_NDEItem(); + item.NDEItemID = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_NDEItem)); + item.NDEID = NDEId; + var batchTrustItems = BLL.Batch_BatchTrustItemService.GetViewBatchTrustItem(this.TrustBatchId); + if (batchTrustItems != null) { - item.TrustBatchItemId = trustItem.TrustBatchItemId; - item.DetectionTypeId = trustItem.DetectionTypeId; - - //检测总数 - if (pds[i].E != null && !string.IsNullOrEmpty(pds[i].E.ToString())) + var trustItem = batchTrustItems.FirstOrDefault(x => x.PipelineCode == pds[i].B.ToString() && x.WeldJointCode == pds[i].C.ToString()); + if (trustItem != null) { - try + item.TrustBatchItemId = trustItem.TrustBatchItemId; + item.DetectionTypeId = trustItem.DetectionTypeId; + + //检测总数 + if (pds[i].E != null && !string.IsNullOrEmpty(pds[i].E.ToString())) { - item.TotalFilm = Funs.GetNewInt(pds[i].E.ToString()); - if (item.TotalFilm == null) + try + { + item.TotalFilm = Funs.GetNewInt(pds[i].E.ToString()); + if (item.TotalFilm == null) + { + result.Add("检测总数[" + pds[i].E.ToString() + "]格式错误"); + } + } + catch (Exception) { result.Add("检测总数[" + pds[i].E.ToString() + "]格式错误"); } } - catch (Exception) + //合格数 + if (pds[i].F != null && !string.IsNullOrEmpty(pds[i].F.ToString())) { - result.Add("检测总数[" + pds[i].E.ToString() + "]格式错误"); - } - } - //合格数 - if (pds[i].F != null && !string.IsNullOrEmpty(pds[i].F.ToString())) - { - try - { - item.PassFilm = Funs.GetNewInt(pds[i].F.ToString()); - if (item.PassFilm == null) + try + { + item.PassFilm = Funs.GetNewInt(pds[i].F.ToString()); + if (item.PassFilm == null) + { + result.Add("合格数[" + pds[i].F.ToString() + "]格式错误"); + } + } + catch (Exception) { result.Add("合格数[" + pds[i].F.ToString() + "]格式错误"); } } - catch (Exception) + //是否合格 + if (pds[i].G != null && !string.IsNullOrEmpty(pds[i].G.ToString())) { - result.Add("合格数[" + pds[i].F.ToString() + "]格式错误"); - } - } - //是否合格 - if (pds[i].G != null && !string.IsNullOrEmpty(pds[i].G.ToString())) - { - if (pds[i].G.ToString() == "合格" || pds[i].G.ToString() == "不合格") - { - item.CheckResult = pds[i].G.ToString() == "合格" ? "1" : "2"; - } - else - { - result.Add("是否合格[" + pds[i].G.ToString() + "]格式错误"); - } - } - //评定级别 - if (pds[i].H != null && !string.IsNullOrEmpty(pds[i].H.ToString())) - { - string gudgeGrade = pds[i].H.ToString(); - if (gudgeGrade != "Ⅰ" && gudgeGrade != "Ⅱ" && gudgeGrade != "Ⅲ" && gudgeGrade != "Ⅳ" && gudgeGrade != "Ⅴ") - { - result.Add("评定级别" + gudgeGrade + "错误"); - } - else - { - item.JudgeGrade = gudgeGrade; - } - } - //缺陷 - if (pds[i].I != null && !string.IsNullOrEmpty(pds[i].I.ToString())) - { - string checkDefects = pds[i].I.ToString(); - string defectIds = string.Empty; - string[] lists = checkDefects.Split(','); - foreach (var j in lists) - { - var u = defects.Where(x => x.DefectName == j.Trim()).FirstOrDefault(); - if (u == null) + if (pds[i].G.ToString() == "合格" || pds[i].G.ToString() == "不合格") { - result.Add("缺陷" + j.Trim() + "不存在"); + item.CheckResult = pds[i].G.ToString() == "合格" ? "1" : "2"; } else { - var q = BLL.Base_DefectService.GetDefectByDefectName(u.DefectName); - defectIds += q.DefectId + ","; + result.Add("是否合格[" + pds[i].G.ToString() + "]格式错误"); } } - if (!string.IsNullOrEmpty(defectIds)) + //评定级别 + if (pds[i].H != null && !string.IsNullOrEmpty(pds[i].H.ToString())) { - defectIds = defectIds.Substring(0, defectIds.LastIndexOf(",")); - item.CheckDefects = defectIds; + string gudgeGrade = pds[i].H.ToString(); + if (gudgeGrade != "Ⅰ" && gudgeGrade != "Ⅱ" && gudgeGrade != "Ⅲ" && gudgeGrade != "Ⅳ" && gudgeGrade != "Ⅴ") + { + result.Add("评定级别" + gudgeGrade + "错误"); + } + else + { + item.JudgeGrade = gudgeGrade; + } } - } - //返修位置 - if (pds[i].J != null && !string.IsNullOrEmpty(pds[i].J.ToString())) - { - item.RepairLocation = pds[i].J.ToString(); - } - if (pds[i].K != null && !string.IsNullOrEmpty(pds[i].K.ToString())) - { - item.Remark = pds[i].K.ToString(); - } - //报告日期 - if (pds[6].H != null && !string.IsNullOrEmpty(pds[6].H.ToString())) - { - try + //缺陷 + if (pds[i].I != null && !string.IsNullOrEmpty(pds[i].I.ToString())) { - item.ReportDate = Funs.GetNewDateTime(pds[6].H.ToString()); - if (item.ReportDate == null) + string checkDefects = pds[i].I.ToString(); + string defectIds = string.Empty; + string[] lists = checkDefects.Split(','); + foreach (var j in lists) + { + var u = defects.Where(x => x.DefectName == j.Trim()).FirstOrDefault(); + if (u == null) + { + result.Add("缺陷" + j.Trim() + "不存在"); + } + else + { + var q = BLL.Base_DefectService.GetDefectByDefectName(u.DefectName); + defectIds += q.DefectId + ","; + } + } + if (!string.IsNullOrEmpty(defectIds)) + { + defectIds = defectIds.Substring(0, defectIds.LastIndexOf(",")); + item.CheckDefects = defectIds; + } + } + //返修位置 + if (pds[i].J != null && !string.IsNullOrEmpty(pds[i].J.ToString())) + { + item.RepairLocation = pds[i].J.ToString(); + } + if (pds[i].K != null && !string.IsNullOrEmpty(pds[i].K.ToString())) + { + item.Remark = pds[i].K.ToString(); + } + //报告日期 + if (pds[6].H != null && !string.IsNullOrEmpty(pds[6].H.ToString())) + { + try + { + item.ReportDate = Funs.GetNewDateTime(pds[6].H.ToString()); + if (item.ReportDate == null) + { + result.Add("报告日期" + pds[6].H.ToString() + "格式错误"); + } + } + catch (Exception) { result.Add("报告日期" + pds[6].H.ToString() + "格式错误"); } } - catch (Exception) - { - result.Add("报告日期" + pds[6].H.ToString() + "格式错误"); - } } + else + { + result.Add("管线[" + pds[i].B.ToString() + "]焊口[" + pds[i].C.ToString() + "]" + "不存在该委托单中"); + } + item.SubmitDate = DateTime.Now; + ndeItems.Add(item); } - else - { - result.Add("管线[" + pds[i].B.ToString() + "]焊口[" + pds[i].C.ToString() + "]" + "不存在该委托单中"); - } - //var model = ndeItems.Where(x => x.TrustBatchItemId == item.TrustBatchItemId); - //if (model.Count() == 0) - //{ - item.SubmitDate = DateTime.Now; - ndeItems.Add(item); - //} - // } } - #region 数据验证和赋值 - - #endregion } } else diff --git a/SGGL/FineUIPro.Web/HJGL/PointTrust/TrustBatch.aspx.cs b/SGGL/FineUIPro.Web/HJGL/PointTrust/TrustBatch.aspx.cs index ecde9749..590a5b8e 100644 --- a/SGGL/FineUIPro.Web/HJGL/PointTrust/TrustBatch.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/PointTrust/TrustBatch.aspx.cs @@ -1032,7 +1032,7 @@ namespace FineUIPro.Web.HJGL.PointTrust protected void btnBack_Click(object sender, EventArgs e) { Model.SGGLDB db = Funs.DB; - string trustBatchId = string.Empty; + //string trustBatchId = string.Empty; var lists = this.Grid1.SelectedRowIDArray; if (lists.Count() > 0) { @@ -1047,8 +1047,10 @@ namespace FineUIPro.Web.HJGL.PointTrust var batchTrustItem = (from x in db.HJGL_Batch_BatchTrustItem where x.PointBatchItemId == pointBatchItemId select x).FirstOrDefault(); if (batchTrustItem != null) { - trustBatchId = batchTrustItem.TrustBatchId; - BLL.Batch_BatchTrustItemService.DeleteTrustItemByTrustBatchItemId(batchTrustItem.TrustBatchItemId); + //trustBatchId = batchTrustItem.TrustBatchId; + BLL.Batch_BatchTrustItemService.DeleteTrustItemByTrustBatchId(batchTrustItem.TrustBatchId); + BLL.Batch_BatchTrustService.DeleteBatchTrustById(batchTrustItem.TrustBatchId); + //BLL.Batch_BatchTrustItemService.DeleteTrustItemByTrustBatchItemId(batchTrustItem.TrustBatchItemId); } //修改点口中的委托状态 @@ -1057,17 +1059,25 @@ namespace FineUIPro.Web.HJGL.PointTrust { if (pointBatchItem.IsBuildTrust != null) { - pointBatchItem.IsBuildTrust = null; + pointBatchItem.IsBuildTrust = null;//是否委托 + pointBatchItem.PointState = null;//点口类型 + pointBatchItem.PointDate = null;//点口时间 + db.SubmitChanges(); + } + var pointBatch = BLL.PointBatchService.GetPointBatchById(pointBatchItem.PointBatchId); + if (pointBatch!=null) + { + pointBatch.IsClosed = null; db.SubmitChanges(); } } } - var trustItemList = BLL.Batch_BatchTrustItemService.GetBatchTrustItemByTrustBatchId(trustBatchId); - if (trustItemList.Count == 0) - { - BLL.Batch_BatchTrustService.DeleteBatchTrustById(trustBatchId); - } + //var trustItemList = BLL.Batch_BatchTrustItemService.GetBatchTrustItemByTrustBatchId(trustBatchId); + //if (trustItemList.Count == 0) + //{ + // BLL.Batch_BatchTrustService.DeleteBatchTrustById(trustBatchId); + //} PageInfo(); BindGrid(); ShowNotify("退回成功!", MessageBoxIcon.Success); diff --git a/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageData.aspx b/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageData.aspx new file mode 100644 index 00000000..e99e0005 --- /dev/null +++ b/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageData.aspx @@ -0,0 +1,92 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestPackageData.aspx.cs" Inherits="FineUIPro.Web.HJGL.TestPackage.TestPackageData" %> + + + + + + + 试压包资料 + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageData.aspx.cs b/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageData.aspx.cs new file mode 100644 index 00000000..31b0f69e --- /dev/null +++ b/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageData.aspx.cs @@ -0,0 +1,522 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data.SqlClient; +using System.Data; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.IO; +using Model; + +namespace FineUIPro.Web.HJGL.TestPackage +{ + public partial class TestPackageData : PageBase + { + #region 定义项 + /// + /// 试压包主键 + /// + public string PTP_ID + { + get + { + return (string)ViewState["PTP_ID"]; + } + set + { + ViewState["PTP_ID"] = value; + } + } + + /// + /// 单位工程Id + /// + public string UnitWorkId + { + get + { + return (string)ViewState["UnitWorkId"]; + } + set + { + ViewState["UnitWorkId"] = value; + } + } + #endregion + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString(); + this.InitTreeMenu();//加载树 + } + } + + #region 加载树装置-单位-工作区 + /// + /// 加载树 + /// + private void InitTreeMenu() + { + this.tvControlItem.Nodes.Clear(); + + TreeNode rootNode1 = new TreeNode(); + rootNode1.NodeID = "1"; + rootNode1.Text = "建筑工程"; + rootNode1.CommandName = "建筑工程"; + rootNode1.Selectable = false; + rootNode1.EnableClickEvent = true; + this.tvControlItem.Nodes.Add(rootNode1); + + TreeNode rootNode2 = new TreeNode(); + rootNode2.NodeID = "2"; + rootNode2.Text = "安装工程"; + rootNode2.CommandName = "安装工程"; + rootNode2.Expanded = true; + rootNode2.EnableClickEvent = true; + this.tvControlItem.Nodes.Add(rootNode2); + var pUnits = (from x in Funs.DB.Project_ProjectUnit where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList(); + // 获取当前用户所在单位 + var currUnit = pUnits.FirstOrDefault(x => x.UnitId == this.CurrUser.UnitId); + + var unitWorkList = (from x in Funs.DB.WBS_UnitWork + where x.ProjectId == this.CurrUser.LoginProjectId + && x.SuperUnitWork == null && x.UnitId != null && x.ProjectType != null + select x).ToList(); + //List testPackageLists = (from x in Funs.DB.PTP_TestPackage + //where x.ProjectId == this.CurrUser.LoginProjectId + //select x).ToList(); + List unitWork1 = null; + List unitWork2 = null; + + //// 当前为施工单位,只能操作本单位的数据 + //if (currUnit != null && currUnit.UnitType == Const.ProjectUnitType_2) + //{ + // unitWork1 = (from x in unitWorkList + // where x.UnitId == this.CurrUser.UnitId && x.ProjectType == "1" + // select x).ToList(); + // unitWork2 = (from x in unitWorkList + // where x.UnitId == this.CurrUser.UnitId && x.ProjectType == "2" + // select x).ToList(); + //} + //else + //{ + unitWork1 = (from x in unitWorkList where x.ProjectType == "1" select x).ToList(); + unitWork2 = (from x in unitWorkList where x.ProjectType == "2" select x).ToList(); + //} + + if (unitWork1.Count() > 0) + { + foreach (var q in unitWork1) + { + var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId); + TreeNode tn1 = new TreeNode(); + tn1.NodeID = q.UnitWorkId; + tn1.Text = q.UnitWorkName; + tn1.ToolTip = "施工单位:" + unitNamesUnitIds; + tn1.CommandName = "单位工程"; + tn1.EnableClickEvent = true; + rootNode1.Nodes.Add(tn1); + //var testPackageUnitList = testPackageLists.Where(x => x.UnitWorkId == q.UnitWorkId).ToList(); + //BindNodes(tn1, testPackageUnitList); + } + } + if (unitWork2.Count() > 0) + { + foreach (var q in unitWork2) + { + var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId); + TreeNode tn2 = new TreeNode(); + tn2.NodeID = q.UnitWorkId; + tn2.Text = q.UnitWorkName; + tn2.ToolTip = "施工单位:" + unitNamesUnitIds; + tn2.CommandName = "单位工程"; + tn2.EnableClickEvent = true; + rootNode2.Nodes.Add(tn2); + //var testPackageUnitList = testPackageLists.Where(x => x.UnitWorkId == q.UnitWorkId).ToList(); + //BindNodes(tn2, testPackageUnitList); + } + } + } + #endregion + + #region 点击TreeView + /// + /// 点击TreeView + /// + /// + /// + protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e) + { + this.UnitWorkId = tvControlItem.SelectedNodeID; + this.BindGrid(); + } + #endregion + + #region 数据绑定 + /// + /// 数据绑定 + /// + private void BindGrid() + { + string strSql = @" select t.PTP_ID, + t.ProjectId, + t.UnitId, + t.UnitWorkId, + t.TestPackageNo, + t.TestPackageName + from PTP_TestPackage t where t.ProjectId=@projectId and t.UnitWorkId=@unitWorkId"; + List listStr = new List(); + listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId)); + listStr.Add(new SqlParameter("@unitWorkId", this.UnitWorkId)); + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + // 2.获取当前分页数据 + //var table = this.GetPagedDataTable(Grid1, tb1); + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + Grid1.DataSource = table; + Grid1.DataBind(); + } + + #endregion + + #region 分页排序 + #region 页索引改变事件 + /// + /// 页索引改变事件 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + BindGrid(); + } + #endregion + + #region 排序 + /// + /// 排序 + /// + /// + /// + protected void Grid1_Sort(object sender, GridSortEventArgs e) + { + BindGrid(); + } + #endregion + + #region 分页选择下拉改变事件 + /// + /// 分页选择下拉改变事件 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + #endregion + #endregion + + #region 打印 + /// + /// 打印按钮 + /// + /// + /// + protected void btnPrint_Click(object sender, EventArgs e) + { + if (!string.IsNullOrEmpty(this.Grid1.SelectedRowID)) + { + this.PTP_ID = this.Grid1.SelectedRowID; + exportWord("1"); + } + else + { + Alert.ShowInTop("请选择一条试压包", MessageBoxIcon.Warning); + return; + } + } + + protected void exportWord(string type) + { + if (!string.IsNullOrEmpty(this.PTP_ID)) + { + var updateTestPackage = Funs.DB.PTP_TestPackage.FirstOrDefault(x => x.PTP_ID == this.PTP_ID); + if (updateTestPackage != null) + { + string rootPath = Server.MapPath("~/"); + BLL.FastReportService.ResetData(); + + if (this.drpPrintType.SelectedValue == "1")//pdf格式 + { + ListItem[] list = new ListItem[5]; + list[0] = new ListItem("0", "File\\Fastreport\\JGZL\\管道试压包文件资料.frx"); + list[1] = new ListItem("1", "File\\Fastreport\\JGZL\\管道压力试验技术要求.frx"); + list[2] = new ListItem("2", "File\\Fastreport\\JGZL\\管道压力包文件资料目录.frx"); + list[3] = new ListItem("3", "File\\Fastreport\\JGZL\\管道系统压力试验条件确认记录.frx"); + list[4] = new ListItem("4", "File\\Fastreport\\JGZL\\管道试压包尾项清单.frx"); + //list[5] = new ListItem("5", "File\\Fastreport\\JGZL\\管道系统压力试验记录.frx"); + //list[6] = new ListItem("6", "File\\Fastreport\\JGZL\\管道材料材质标识检查记录.frx"); + //list[7] = new ListItem("7", "File\\Fastreport\\JGZL\\管道焊接工作记录.frx"); + //list[8] = new ListItem("8", "File\\Fastreport\\JGZL\\管道无损检测数量统计表.frx"); + //list[9] = new ListItem("9", "File\\Fastreport\\JGZL\\无损检测结果汇总表.frx"); + + List FastReportItemList = new List(); + foreach (var item in list) + { + FastReportItemList.Add(GetFastReportItem(updateTestPackage, item.Text)); + } + + var Path = Funs.RootPath + "FileUpload/" + this.PTP_ID + ".pdf"; + + BLL.FastReportService.ExportMergeReport(FastReportItemList, Path, this.drpPrintType.SelectedValue); + FileInfo info = new FileInfo(Path); + long fileSize = info.Length; + + System.Web.HttpContext.Current.Response.Clear(); + System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed"; + System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode("交工资料.pdf", System.Text.Encoding.UTF8)); + System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString()); + System.Web.HttpContext.Current.Response.TransmitFile(Path, 0, fileSize); + System.Web.HttpContext.Current.Response.Flush(); + System.Web.HttpContext.Current.Response.Close(); + File.Delete(Path); + } + else if (this.drpPrintType.SelectedValue == "2")//word格式 + { + ListItem[] list = new ListItem[3]; + list[0] = new ListItem("0", "File\\Fastreport\\JGZL\\管道试压包文件资料.frx"); + list[1] = new ListItem("1", "File\\Fastreport\\JGZL\\管道压力试验技术要求.frx"); + list[2] = new ListItem("2", "File\\Fastreport\\JGZL\\管道压力包文件资料目录.frx"); + + List FastReportItemList = new List(); + foreach (var item in list) + { + FastReportItemList.Add(GetFastReportItem(updateTestPackage, item.Text)); + } + var PathA = Funs.RootPath + "FileUpload/" + this.PTP_ID + ".docx"; + BLL.FastReportService.ExportMergeReport(FastReportItemList, PathA, this.drpPrintType.SelectedValue); + Aspose.Words.Document doc1 = new Aspose.Words.Document(PathA); + + ListItem[] list2 = new ListItem[1]; + list2[0] = new ListItem("3", "File\\Fastreport\\JGZL\\管道系统压力试验条件确认记录.frx"); + List FastReportItemList2 = new List(); + foreach (var item in list2) + { + FastReportItemList2.Add(GetFastReportItem(updateTestPackage, item.Text)); + } + var PathB = Funs.RootPath + "FileUpload/" + this.PTP_ID + "2.docx"; + BLL.FastReportService.ExportMergeReport(FastReportItemList2, PathB, this.drpPrintType.SelectedValue); + Aspose.Words.Document doc2 = new Aspose.Words.Document(PathB); + + // 合并 Word DOcx 文档 + doc1.AppendDocument(doc2, Aspose.Words.ImportFormatMode.KeepSourceFormatting); + + + ListItem[] list3 = new ListItem[1]; + list3[0] = new ListItem("4", "File\\Fastreport\\JGZL\\管道试压包尾项清单.frx"); + List FastReportItemList3 = new List(); + foreach (var item in list3) + { + FastReportItemList3.Add(GetFastReportItem(updateTestPackage, item.Text)); + } + var PathC = Funs.RootPath + "FileUpload/" + this.PTP_ID + "3.docx"; + BLL.FastReportService.ExportMergeReport(FastReportItemList3, PathC, this.drpPrintType.SelectedValue); + Aspose.Words.Document doc3 = new Aspose.Words.Document(PathC); + // 合并 Word DOcx 文档 + doc1.AppendDocument(doc3, Aspose.Words.ImportFormatMode.KeepSourceFormatting); + + ListItem[] list4 = new ListItem[2]; + list4[0] = new ListItem("5", "File\\Fastreport\\JGZL\\管道系统压力试验记录.frx"); + list4[1] = new ListItem("6", "File\\Fastreport\\JGZL\\管道材料材质标识检查记录.frx"); + List FastReportItemList4 = new List(); + foreach (var item in list4) + { + FastReportItemList4.Add(GetFastReportItem(updateTestPackage, item.Text)); + } + var PathD = Funs.RootPath + "FileUpload/" + this.PTP_ID + "4.docx"; + BLL.FastReportService.ExportMergeReport(FastReportItemList4, PathD, this.drpPrintType.SelectedValue); + Aspose.Words.Document doc4 = new Aspose.Words.Document(PathD); + // 合并 Word DOcx 文档 + doc1.AppendDocument(doc4, Aspose.Words.ImportFormatMode.KeepSourceFormatting); + + ListItem[] list5 = new ListItem[3]; + list5[0] = new ListItem("7", "File\\Fastreport\\JGZL\\管道焊接工作记录.frx"); + list5[1] = new ListItem("8", "File\\Fastreport\\JGZL\\管道无损检测数量统计表.frx"); + list5[2] = new ListItem("9", "File\\Fastreport\\JGZL\\无损检测结果汇总表.frx"); + List FastReportItemList5 = new List(); + foreach (var item in list5) + { + FastReportItemList5.Add(GetFastReportItem(updateTestPackage, item.Text)); + } + var PathE = Funs.RootPath + "FileUpload/" + this.PTP_ID + "5.docx"; + BLL.FastReportService.ExportMergeReport(FastReportItemList5, PathE, this.drpPrintType.SelectedValue); + Aspose.Words.Document doc5 = new Aspose.Words.Document(PathE); + // 合并 Word DOcx 文档 + doc1.AppendDocument(doc5, Aspose.Words.ImportFormatMode.KeepSourceFormatting); + + //将合并的文档保存为 DOCX 文件 + doc1.Save(Funs.RootPath + "FileUpload/doc.docx"); + + var Path = Funs.RootPath + "FileUpload/doc.docx"; + FileInfo info = new FileInfo(Path); + long fileSize = info.Length; + + System.Web.HttpContext.Current.Response.Clear(); + System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed"; + System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode("交工资料.docx", System.Text.Encoding.UTF8)); + System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString()); + System.Web.HttpContext.Current.Response.TransmitFile(Path, 0, fileSize); + System.Web.HttpContext.Current.Response.Flush(); + System.Web.HttpContext.Current.Response.Close(); + File.Delete(Path); + File.Delete(PathA); + File.Delete(PathB); + File.Delete(PathC); + File.Delete(PathD); + File.Delete(PathE); + } + } + } + else + { + Alert.ShowInTop("请选择要打印的单据!", MessageBoxIcon.Warning); + return; + } + } + + + protected Model.FastReportItem GetFastReportItem(Model.PTP_TestPackage updateTestPackage, string printType) + { + string initTemplatePath = ""; + Model.FastReportItem fastReportItem = new Model.FastReportItem(); + switch (printType) + { + case "0"://管道试压包文件资料 + { + Dictionary keyValuePairs = new Dictionary(); + var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId); + var InstallationName = BLL.UnitWorkService.getUnitWorkByUnitWorkId(updateTestPackage.UnitWorkId).UnitWorkName; + keyValuePairs.Add("ProjectName", projectName); + keyValuePairs.Add("InstallationName", projectName + InstallationName); + keyValuePairs.Add("TestPackageNo", updateTestPackage.TestPackageNo); + BLL.FastReportService.AddFastreportParameter(keyValuePairs); + + initTemplatePath = "File\\Fastreport\\JGZL\\管道试压包文件资料.frx"; + fastReportItem.ReportPath = initTemplatePath; + fastReportItem.ParameterValues = keyValuePairs; + } + break; + case "1"://管道压力试验技术要求 + { + Dictionary keyValuePairs = new Dictionary(); + BLL.FastReportService.AddFastreportParameter(keyValuePairs); + + initTemplatePath = "File\\Fastreport\\JGZL\\管道压力试验技术要求.frx"; + fastReportItem.ReportPath = initTemplatePath; + fastReportItem.ParameterValues = keyValuePairs; + } + break; + case "2"://管道压力包文件资料目录 + { + Dictionary keyValuePairs = new Dictionary(); + BLL.FastReportService.AddFastreportParameter(keyValuePairs); + + initTemplatePath = "File\\Fastreport\\JGZL\\管道压力包文件资料目录.frx"; + fastReportItem.ReportPath = initTemplatePath; + fastReportItem.ParameterValues = keyValuePairs; + } + break; + case "3"://管道系统压力试验条件确认记录 + { + Dictionary keyValuePairs = new Dictionary(); + var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId); + var InstallationName = BLL.UnitWorkService.getUnitWorkByUnitWorkId(updateTestPackage.UnitWorkId).UnitWorkName; + keyValuePairs.Add("ProjectName", projectName); + keyValuePairs.Add("InstallationName", InstallationName); + keyValuePairs.Add("TestPackageNo", updateTestPackage.TestPackageNo); + keyValuePairs.Add("TestPackageName", updateTestPackage.TestPackageName); + BLL.FastReportService.AddFastreportParameter(keyValuePairs); + + initTemplatePath = "File\\Fastreport\\JGZL\\管道系统压力试验条件确认记录.frx"; + fastReportItem.ReportPath = initTemplatePath; + fastReportItem.ParameterValues = keyValuePairs; + } + break; + case "4"://管道试压包尾项清单 + { + string sql = @"select PT_PipeId,PTP_ID,pipelineList.PipelineId,pipeline.PipelineCode from PTP_PipelineList as pipelineList + left join HJGL_Pipeline pipeline on pipeline.PipelineId = pipelineList.PipelineId + where PTP_ID=@ptp_id"; + List listStr = new List + { + new SqlParameter("@ptp_id", this.PTP_ID), + }; + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(sql, parameter); + + DataTable dt = new DataTable(); + dt.TableName = "Data"; + dt.Columns.Add("SortNumber"); + dt.Columns.Add("PipelineCode"); + + for (int i = 0; i < tb.Rows.Count; i++) + { + var newRows = dt.NewRow(); + newRows["SortNumber"] = (i + 1).ToString(); + newRows["PipelineCode"] = tb.Rows[i]["PipelineCode"].ToString(); + + dt.Rows.Add(newRows); + } + BLL.FastReportService.AddFastreportTable(dt); + + Dictionary keyValuePairs = new Dictionary(); + keyValuePairs.Add("TestPackageNo", updateTestPackage.TestPackageNo); + BLL.FastReportService.AddFastreportParameter(keyValuePairs); + + initTemplatePath = "File\\Fastreport\\JGZL\\管道试压包尾项清单.frx"; + + List dataTables = new List(); + dataTables.Add(dt); + fastReportItem.ReportPath = initTemplatePath; + fastReportItem.ParameterValues = keyValuePairs; + fastReportItem.DataTables = dataTables; + } + break; + case "5"://管道系统压力试验记录 + { + + } + break; + case "6"://管道材料材质标识检查记录 + { + + } + break; + case "7"://管道焊接工作记录 + { + + } + break; + case "8"://管道无损检测数量统计表 + { + + } + break; + case "9"://无损检测结果汇总表 + { + + } + break; + } + return fastReportItem; + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageData.aspx.designer.cs b/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageData.aspx.designer.cs new file mode 100644 index 00000000..a8573895 --- /dev/null +++ b/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageData.aspx.designer.cs @@ -0,0 +1,152 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.HJGL.TestPackage +{ + + + public partial class TestPackageData + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// panelLeftRegion 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel panelLeftRegion; + + /// + /// tvControlItem 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Tree tvControlItem; + + /// + /// hdPTP_ID 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.HiddenField hdPTP_ID; + + /// + /// Panel2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel2; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// drpPrintType 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpPrintType; + + /// + /// btnPrint 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnPrint; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + } +} diff --git a/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageEdit.aspx b/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageEdit.aspx index 7438d6ff..e0b7b91f 100644 --- a/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageEdit.aspx +++ b/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageEdit.aspx @@ -111,7 +111,7 @@ -