提交代码
This commit is contained in:
@@ -25,7 +25,10 @@
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar1" runat="server">
|
||||
<Items>
|
||||
<f:FileUpload runat="server" ID="fileData" LabelAlign="Right" EmptyText="请选择Excel文件" Label="附件" Required="true" ButtonIcon="Add" ShowRedStar="true"></f:FileUpload>
|
||||
<f:Button ID="btnImport" runat="server" OnClick="btnImport_Click" Text="导入"></f:Button>
|
||||
<f:ToolbarFill ID="ToolbarFill" runat="server"></f:ToolbarFill>
|
||||
<f:Button ID="btnExport" runat="server" Icon="ApplicationGo" Text="导出" ToolTip="导出" OnClick="btnExport_Click"></f:Button>
|
||||
<f:Button ID="btnSave" Text="保存" ToolTip="保存" Icon="FilmSave" runat="server" OnClick="btnSave_Click"></f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
@@ -42,6 +45,12 @@
|
||||
<f:ListItem Value="0" Text="未通过" />
|
||||
</f:DropDownList>
|
||||
</Editor>
|
||||
</f:RenderField>
|
||||
<f:RenderField HeaderText="备注" ColumnID="Remark" DataField="Remark" SortField="Remark"
|
||||
FieldType="String" HeaderTextAlign="Center" TextAlign="Center" Width="300px">
|
||||
<Editor>
|
||||
<f:TextBox runat="server" ID="txtRemark"></f:TextBox>
|
||||
</Editor>
|
||||
</f:RenderField>
|
||||
</Columns>
|
||||
</f:Grid>
|
||||
|
||||
@@ -1,18 +1,23 @@
|
||||
using BLL;
|
||||
using Model;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NPOI.SS.UserModel;
|
||||
using NPOI.SS.Util;
|
||||
using NPOI.XSSF.UserModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
{
|
||||
public partial class InspectWanderAboutConfirm : PageBase
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// 检查表主键
|
||||
/// </summary>
|
||||
public string SubInspectId
|
||||
{
|
||||
@@ -21,7 +26,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// 类型
|
||||
/// </summary>
|
||||
public int ConfirmType
|
||||
{
|
||||
@@ -29,12 +34,39 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
set { ViewState["ConfirmType"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型名称
|
||||
/// </summary>
|
||||
public string ConfirmTypeName
|
||||
{
|
||||
get { return (string)ViewState["ConfirmTypeName"]; }
|
||||
set { ViewState["ConfirmTypeName"] = value; }
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.SubInspectId = Request.Params["SubInspectId"];
|
||||
this.ConfirmType = int.Parse(Request.Params["ConfirmType"]);
|
||||
|
||||
if (this.ConfirmType == 1)
|
||||
{
|
||||
this.ConfirmTypeName = "分包商";
|
||||
}
|
||||
if (this.ConfirmType == 2)
|
||||
{
|
||||
this.ConfirmTypeName = "承包商";
|
||||
}
|
||||
if (this.ConfirmType == 3)
|
||||
{
|
||||
this.ConfirmTypeName = "监理";
|
||||
}
|
||||
if (this.ConfirmType == 4)
|
||||
{
|
||||
this.ConfirmTypeName = "业主";
|
||||
}
|
||||
|
||||
this.BindGrid();
|
||||
}
|
||||
}
|
||||
@@ -60,26 +92,27 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
model.WorkInspectName = item.WorkInspectName;
|
||||
model.ConfirmType = this.ConfirmType;
|
||||
model.InspectionIllustrate = item.InspectionIllustrate;
|
||||
model.ConfirmTypeName = this.ConfirmTypeName;
|
||||
//1=分包商2=承包商3=监理4=业主
|
||||
if (this.ConfirmType == 1)
|
||||
{
|
||||
model.IsPass = item.SubcontractorIsPass;
|
||||
model.ConfirmTypeName = "分包商";
|
||||
model.Remark = item.SubcontractorRemark;
|
||||
}
|
||||
if (this.ConfirmType == 2)
|
||||
{
|
||||
model.IsPass = item.ContractorIsPass;
|
||||
model.ConfirmTypeName = "承包商";
|
||||
model.Remark = item.ContractorRemark;
|
||||
}
|
||||
if (this.ConfirmType == 3)
|
||||
{
|
||||
model.IsPass = item.SupervisionIsPass;
|
||||
model.ConfirmTypeName = "监理";
|
||||
model.Remark = item.SupervisionRemark;
|
||||
}
|
||||
if (this.ConfirmType == 4)
|
||||
{
|
||||
model.IsPass = item.OwnerIsPass;
|
||||
model.ConfirmTypeName = "业主";
|
||||
model.Remark = item.OwnerRemark;
|
||||
}
|
||||
data.Add(model);
|
||||
}
|
||||
@@ -127,18 +160,22 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
if (this.ConfirmType == 1)
|
||||
{
|
||||
model.SubcontractorIsPass = int.Parse(values.Value<string>("IsPass"));
|
||||
model.SubcontractorRemark = values.Value<string>("Remark");
|
||||
}
|
||||
else if (this.ConfirmType == 2)
|
||||
{
|
||||
model.ContractorIsPass = int.Parse(values.Value<string>("IsPass"));
|
||||
model.ContractorRemark = values.Value<string>("Remark");
|
||||
}
|
||||
else if (this.ConfirmType == 3)
|
||||
{
|
||||
model.SupervisionIsPass = int.Parse(values.Value<string>("IsPass"));
|
||||
model.SupervisionRemark = values.Value<string>("Remark");
|
||||
}
|
||||
else if (this.ConfirmType == 4)
|
||||
{
|
||||
model.OwnerIsPass = int.Parse(values.Value<string>("IsPass"));
|
||||
model.OwnerRemark = values.Value<string>("Remark");
|
||||
}
|
||||
}
|
||||
Funs.DB.SubmitChanges();
|
||||
@@ -243,6 +280,10 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
/// 是否通过
|
||||
/// </summary>
|
||||
public int? IsPass { get; set; }
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Remark { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -253,5 +294,528 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导出
|
||||
/// </summary>
|
||||
protected void btnExport_Click(object sender, EventArgs e)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
|
||||
//导出文件
|
||||
string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\";
|
||||
if (!Directory.Exists(filePath))
|
||||
{
|
||||
Directory.CreateDirectory(filePath);
|
||||
}
|
||||
string ReportFileName = filePath + this.ConfirmTypeName + "确认签字.xlsx";
|
||||
//获取工作包检查表
|
||||
var termData = from a in Funs.DB.PreRun_SubInspectTerm
|
||||
join b in Funs.DB.Base_Project on a.ProjectId equals b.ProjectId
|
||||
join c in Funs.DB.PreRun_WorkPackage on a.WorkPackId equals c.WorkPackId
|
||||
join zz in Funs.DB.PreRun_SysDevice on a.InstallationId equals zz.PreRunId//装置
|
||||
join gx in Funs.DB.PreRun_SysDevice on a.ProcessesId equals gx.PreRunId//工序
|
||||
join xt in Funs.DB.PreRun_SysDevice on a.SystemId equals xt.PreRunId//系统
|
||||
select new { a.SubInspectId, a.ProjectId, b.ProjectName, b.ShortName, b.ProjectCode, a.InstallationId, a.ProcessesId, a.SystemId, a.SubSystemId, a.WorkPackId, a.InspectResult, a.Subcontractor, a.Contractor, a.Supervision, a.Owner, a.InspectionIsAllPass, a.SubcontractorIsAllPass, a.ContractorIsAllPass, a.SupervisionIsAllPass, a.OwnerIsAllPass, a.WorkPackType, a.PropertyTechnologyId, a.InspectTime, a.AddUser, a.AddTime, c.WorkPackName, zzName = zz.PreRunName, gxName = gx.PreRunName, xtName = xt.PreRunName };
|
||||
if (termData != null)
|
||||
{
|
||||
var termModel = termData.FirstOrDefault();
|
||||
//获取工作包检查项表
|
||||
var termItems = Funs.DB.PreRun_SubInspectTermItem.Where(x => x.SubInspectId == this.SubInspectId).OrderBy(x => x.Sort).ToList();
|
||||
//获取管道或者设备号
|
||||
var termCodes = string.Empty;
|
||||
//1=管道2=设备
|
||||
var ids = termModel.PropertyTechnologyId.Split(',').ToList();
|
||||
if (termModel.WorkPackType == 1)
|
||||
{
|
||||
var codeDatas = Funs.DB.PreRun_PropertySysPiping.Where(x => ids.Contains(x.PropertyId)).ToList();
|
||||
if (codeDatas.Count > 0)
|
||||
{
|
||||
termCodes = string.Join(",", codeDatas.ConvertAll(x => x.PipingCode));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var codeDatas = Funs.DB.PreRun_TechnologySysPiping.Where(x => ids.Contains(x.TechnologyId)).ToList();
|
||||
if (codeDatas.Count > 0)
|
||||
{
|
||||
termCodes = string.Join(",", codeDatas.ConvertAll(x => x.TagNumber));
|
||||
}
|
||||
}
|
||||
|
||||
int rowIndex = 0;
|
||||
XSSFWorkbook hssfworkbook = new XSSFWorkbook();
|
||||
XSSFSheet ws = (XSSFSheet)hssfworkbook.CreateSheet(this.ConfirmTypeName + "确认签字");
|
||||
|
||||
#region 列宽
|
||||
|
||||
ws.SetColumnWidth(0, (7 * 256));
|
||||
ws.SetColumnWidth(1, (4 * 256));
|
||||
ws.SetColumnWidth(2, (4 * 256));
|
||||
ws.SetColumnWidth(3, (4 * 256));
|
||||
ws.SetColumnWidth(4, (10 * 256));
|
||||
ws.SetColumnWidth(5, (10 * 256));
|
||||
ws.SetColumnWidth(6, (10 * 256));
|
||||
ws.SetColumnWidth(7, (10 * 256));
|
||||
ws.SetColumnWidth(8, (3 * 256));
|
||||
ws.SetColumnWidth(9, (3 * 256));
|
||||
ws.SetColumnWidth(10, (3 * 256));
|
||||
ws.SetColumnWidth(11, (3 * 256));
|
||||
ws.SetColumnWidth(12, (3 * 256));
|
||||
ws.SetColumnWidth(13, (3 * 256));
|
||||
ws.SetColumnWidth(14, (3 * 256));
|
||||
ws.SetColumnWidth(15, (3 * 256));
|
||||
ws.SetColumnWidth(16, (3 * 256));
|
||||
ws.SetColumnWidth(17, (3 * 256));
|
||||
|
||||
#endregion
|
||||
|
||||
#region 样式
|
||||
//头部样式居中
|
||||
ICellStyle titleStyle = SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 14, true, true);
|
||||
//头部样式靠左
|
||||
ICellStyle leftTitleStyle = SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 14, true, true);
|
||||
//公共样式
|
||||
ICellStyle style = SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10.5, true);
|
||||
//公共样式靠左
|
||||
ICellStyle leftStyle = SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10.5, true);
|
||||
//公共样式靠左上对其
|
||||
ICellStyle leftTopStyle = SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Top, HorizontalAlignment.Left, 10.5, true);
|
||||
//公共样式加粗
|
||||
ICellStyle styleBold = SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10.5, true, true);
|
||||
|
||||
#endregion
|
||||
|
||||
#region 头部
|
||||
|
||||
ws = ExcelCreateRowTitle(ws, hssfworkbook, style, rowIndex, rowIndex + 5, 0, 17);
|
||||
//行1
|
||||
var region = new CellRangeAddress(rowIndex, rowIndex + 2, 0, 0);
|
||||
ws.AddMergedRegion(region);
|
||||
byte[] bytes = File.ReadAllBytes(Server.MapPath("~/") + "Images\\Template.png");
|
||||
int pictureIdx = hssfworkbook.AddPicture(bytes, PictureType.JPEG);
|
||||
IDrawing patriarch = ws.CreateDrawingPatriarch();
|
||||
IClientAnchor anchor = patriarch.CreateAnchor(0, 0, 0, 0, 0, rowIndex, 1, rowIndex + 2);
|
||||
IPicture pict = patriarch.CreatePicture(anchor, pictureIdx);
|
||||
//pict.Resize();
|
||||
region = new CellRangeAddress(rowIndex, rowIndex + 2, 1, 3);
|
||||
ws.AddMergedRegion(region);
|
||||
ws.GetRow(rowIndex).GetCell(1).SetCellValue("中国五环工程有限公司");
|
||||
ws.GetRow(rowIndex).GetCell(1).CellStyle =
|
||||
ws.GetRow(rowIndex).GetCell(2).CellStyle =
|
||||
ws.GetRow(rowIndex).GetCell(3).CellStyle = leftTitleStyle;
|
||||
region = new CellRangeAddress(rowIndex, rowIndex, 4, 7);
|
||||
ws.AddMergedRegion(region);
|
||||
ws.GetRow(rowIndex).GetCell(4).SetCellValue(termModel.ProjectName);
|
||||
ws.GetRow(rowIndex).GetCell(4).CellStyle = style;
|
||||
region = new CellRangeAddress(rowIndex, rowIndex, 8, 12);
|
||||
ws.AddMergedRegion(region);
|
||||
ws.GetRow(rowIndex).GetCell(8).SetCellValue("项目号");
|
||||
ws.GetRow(rowIndex).GetCell(8).CellStyle = style;
|
||||
region = new CellRangeAddress(rowIndex, rowIndex, 13, 17);
|
||||
ws.AddMergedRegion(region);
|
||||
ws.GetRow(rowIndex).GetCell(13).SetCellValue(termModel.ProjectCode);
|
||||
ws.GetRow(rowIndex).GetCell(13).CellStyle = style;
|
||||
region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 4, 7);
|
||||
ws.AddMergedRegion(region);
|
||||
ws.GetRow(rowIndex + 1).GetCell(4).SetCellValue($"({termModel.zzName})({termModel.gxName}/{termModel.xtName})");
|
||||
ws.GetRow(rowIndex + 1).GetCell(4).CellStyle = style;
|
||||
region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 8, 12);
|
||||
ws.AddMergedRegion(region);
|
||||
ws.GetRow(rowIndex + 1).GetCell(8).SetCellValue("(文件号)");
|
||||
ws.GetRow(rowIndex + 1).GetCell(8).CellStyle = style;
|
||||
region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 13, 17);
|
||||
ws.AddMergedRegion(region);
|
||||
ws.GetRow(rowIndex + 1).GetCell(13).SetCellValue("");
|
||||
ws.GetRow(rowIndex + 1).GetCell(13).CellStyle = style;
|
||||
region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 4, 7);
|
||||
ws.AddMergedRegion(region);
|
||||
ws.GetRow(rowIndex + 2).GetCell(4).SetCellValue($"{termModel.WorkPackName}条件检查表");
|
||||
ws.GetRow(rowIndex + 2).GetCell(4).CellStyle = titleStyle;
|
||||
region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 8, 12);
|
||||
ws.AddMergedRegion(region);
|
||||
ws.GetRow(rowIndex + 2).GetCell(8).SetCellValue("第 1 页");
|
||||
ws.GetRow(rowIndex + 2).GetCell(8).CellStyle = style;
|
||||
region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 13, 17);
|
||||
ws.AddMergedRegion(region);
|
||||
ws.GetRow(rowIndex + 2).GetCell(13).SetCellValue("共 1 页");
|
||||
ws.GetRow(rowIndex + 2).GetCell(13).CellStyle = style;
|
||||
//行4,行5
|
||||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 0, 2);
|
||||
ws.AddMergedRegion(region);
|
||||
ws.GetRow(rowIndex + 3).GetCell(0).CellStyle = style;
|
||||
ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue(termModel.WorkPackType == 1 ? "管道号" : "设备号");
|
||||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 3, 11);
|
||||
ws.AddMergedRegion(region);
|
||||
ws.GetRow(rowIndex + 3).GetCell(3).CellStyle = leftStyle;
|
||||
ws.GetRow(rowIndex + 3).GetCell(3).SetCellValue(termCodes);
|
||||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 12, 17);
|
||||
ws.AddMergedRegion(region);
|
||||
ws.GetRow(rowIndex + 3).GetCell(12).CellStyle = style;
|
||||
ws.GetRow(rowIndex + 3).GetCell(12).SetCellValue("检查日期");
|
||||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 12, 17);
|
||||
ws.AddMergedRegion(region);
|
||||
ws.GetRow(rowIndex + 4).GetCell(12).CellStyle = style;
|
||||
ws.GetRow(rowIndex + 4).GetCell(12).SetCellValue(DateTime.Now.ToString("yyyy年MM月dd日"));
|
||||
//行6
|
||||
ws.GetRow(rowIndex + 5).GetCell(0).CellStyle = styleBold;
|
||||
ws.GetRow(rowIndex + 5).GetCell(0).SetCellValue("序号");
|
||||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 1, 7);
|
||||
ws.AddMergedRegion(region);
|
||||
ws.GetRow(rowIndex + 5).GetCell(1).CellStyle = styleBold;
|
||||
ws.GetRow(rowIndex + 5).GetCell(1).SetCellValue("检查项目");
|
||||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 8, 12);
|
||||
ws.AddMergedRegion(region);
|
||||
ws.GetRow(rowIndex + 5).GetCell(8).CellStyle = styleBold;
|
||||
ws.GetRow(rowIndex + 5).GetCell(8).SetCellValue("结果");
|
||||
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 13, 17);
|
||||
ws.AddMergedRegion(region);
|
||||
ws.GetRow(rowIndex + 5).GetCell(13).CellStyle = styleBold;
|
||||
ws.GetRow(rowIndex + 5).GetCell(13).SetCellValue("备注");
|
||||
|
||||
#endregion
|
||||
|
||||
#region 表格
|
||||
|
||||
var start = rowIndex + 6;
|
||||
var end = rowIndex + 5 + termItems.Count;
|
||||
|
||||
ws = ExcelCreateRowTitle(ws, hssfworkbook, style, start, end, 0, 17);
|
||||
|
||||
//合并单元格
|
||||
for (int hb = start; hb <= end; hb++)
|
||||
{
|
||||
region = new CellRangeAddress(hb, hb, 1, 7);
|
||||
ws.AddMergedRegion(region);
|
||||
region = new CellRangeAddress(hb, hb, 8, 12);
|
||||
ws.AddMergedRegion(region);
|
||||
region = new CellRangeAddress(hb, hb, 13, 17);
|
||||
ws.AddMergedRegion(region);
|
||||
}
|
||||
|
||||
//数据
|
||||
int num = 1;
|
||||
var dataIndex = 6;
|
||||
foreach (var item in termItems)
|
||||
{
|
||||
//序号
|
||||
ws.GetRow(dataIndex).GetCell(0).SetCellValue(num);
|
||||
//检查项目
|
||||
ws.GetRow(dataIndex).GetCell(1).SetCellValue(item.WorkInspectName);
|
||||
ws.GetRow(dataIndex).GetCell(1).CellStyle = leftStyle;
|
||||
//结果
|
||||
ws.GetRow(dataIndex).GetCell(8).SetCellValue("");
|
||||
//备注
|
||||
ws.GetRow(dataIndex).GetCell(13).SetCellValue("");
|
||||
dataIndex++;
|
||||
num++;
|
||||
}
|
||||
rowIndex = start + termItems.Count;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 尾部
|
||||
|
||||
ws = ExcelCreateRowTitle(ws, hssfworkbook, style, rowIndex, rowIndex, 0, 17, 100);
|
||||
//行1
|
||||
ws.GetRow(rowIndex).GetCell(0).SetCellValue("结论");
|
||||
region = new CellRangeAddress(rowIndex, rowIndex, 1, 17);
|
||||
ws.AddMergedRegion(region);
|
||||
ws.GetRow(rowIndex).GetCell(1).SetCellValue("是否同意进行冲洗吹扫(包括整改意见):");
|
||||
ws.GetRow(rowIndex).GetCell(1).CellStyle = leftTopStyle;
|
||||
//行2
|
||||
ws = ExcelCreateRowTitle(ws, hssfworkbook, style, rowIndex + 1, rowIndex + 1, 0, 17, 80);
|
||||
ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("检查人员");
|
||||
region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 1, 4);
|
||||
ws.AddMergedRegion(region);
|
||||
ws.GetRow(rowIndex + 1).GetCell(1).SetCellValue("施工单位:");
|
||||
ws.GetRow(rowIndex + 1).GetCell(1).CellStyle = leftTopStyle;
|
||||
region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 5, 6);
|
||||
ws.AddMergedRegion(region);
|
||||
ws.GetRow(rowIndex + 1).GetCell(5).SetCellValue("总承包商:");
|
||||
ws.GetRow(rowIndex + 1).GetCell(5).CellStyle = leftTopStyle;
|
||||
region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 7, 11);
|
||||
ws.AddMergedRegion(region);
|
||||
ws.GetRow(rowIndex + 1).GetCell(7).SetCellValue("监理:");
|
||||
ws.GetRow(rowIndex + 1).GetCell(7).CellStyle = leftTopStyle;
|
||||
region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 12, 17);
|
||||
ws.AddMergedRegion(region);
|
||||
ws.GetRow(rowIndex + 1).GetCell(12).SetCellValue("业主:");
|
||||
ws.GetRow(rowIndex + 1).GetCell(12).CellStyle = leftTopStyle;
|
||||
|
||||
#endregion
|
||||
|
||||
ws.PrintSetup.Landscape = false;
|
||||
ws.PrintSetup.PaperSize = 9;
|
||||
ws.ForceFormulaRecalculation = true;
|
||||
using (FileStream filess = File.OpenWrite(ReportFileName))
|
||||
{
|
||||
hssfworkbook.Write(filess);
|
||||
}
|
||||
FileInfo filet = new FileInfo(ReportFileName);
|
||||
Response.Clear();
|
||||
Response.Charset = "GB2312";
|
||||
Response.ContentEncoding = System.Text.Encoding.UTF8;
|
||||
// 添加头信息,为"文件下载/另存为"对话框指定默认文件名
|
||||
Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(this.ConfirmTypeName + "确认签字.xlsx"));
|
||||
// 添加头信息,指定文件大小,让浏览器能够显示下载进度
|
||||
Response.AddHeader("Content-Length", filet.Length.ToString());
|
||||
// 指定返回的是一个不能被客户端读取的流,必须被下载
|
||||
Response.ContentType = "application/ms-excel";
|
||||
// 把文件流发送到客户端
|
||||
Response.WriteFile(filet.FullName);
|
||||
// 停止页面的执行
|
||||
Response.End();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导入
|
||||
/// </summary>
|
||||
protected void btnImport_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (this.fileData.HasFile == false)
|
||||
{
|
||||
ShowNotify("请选择excel文件!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string IsXls = Path.GetExtension(this.fileData.FileName).ToString().Trim().ToLower();
|
||||
if (IsXls != ".xls" && IsXls != ".xlsx")
|
||||
{
|
||||
ShowNotify("excel文件类型错误!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initFullPath = rootPath + Const.ExcelUrl;
|
||||
if (!Directory.Exists(initFullPath))
|
||||
{
|
||||
Directory.CreateDirectory(initFullPath);
|
||||
}
|
||||
//指定上传文件名称
|
||||
string fileUrl = BLL.Funs.GetNewFileName() + IsXls;
|
||||
//上传文件路径
|
||||
string filePath = initFullPath + fileUrl;
|
||||
//文件上传服务器
|
||||
this.fileData.PostedFile.SaveAs(filePath);
|
||||
//文件上传服务器后的名称
|
||||
string fileName = rootPath + Const.ExcelUrl + fileUrl;
|
||||
//读取Excel
|
||||
DataSet ds = NPOIHelper.ExcelToDataSet(fileName, out string message, false);
|
||||
if (ds == null)
|
||||
{
|
||||
ShowNotify("模板错误,请从系统下载正确的模板!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(message))
|
||||
{
|
||||
ShowNotify(message, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (ds.Tables[0].Rows.Count > 6)
|
||||
{
|
||||
var fileVerify = VerifyFile(ds);
|
||||
if (!fileVerify)
|
||||
{
|
||||
ShowNotify("请使用导出的Excel作为模板!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
List<PreRun_SubInspectTermItem> list = new List<PreRun_SubInspectTermItem>();
|
||||
//数据导入
|
||||
for (int i = 6; i < ds.Tables[0].Rows.Count; i++)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(ds.Tables[0].Rows[i][1].ToString())) continue;
|
||||
if (string.IsNullOrWhiteSpace(ds.Tables[0].Rows[i][8].ToString())) continue;
|
||||
var model = Funs.DB.PreRun_SubInspectTermItem.FirstOrDefault(x => x.WorkInspectName.Trim() == ds.Tables[0].Rows[i][1].ToString().Trim());
|
||||
if (model == null) continue;
|
||||
var resultStr = ds.Tables[0].Rows[i][8].ToString();
|
||||
var remark = ds.Tables[0].Rows[i][13].ToString();
|
||||
var isPass = 0;
|
||||
if (resultStr.Trim() == "通过")
|
||||
{
|
||||
isPass = 1;
|
||||
}
|
||||
if (this.ConfirmType == 1)
|
||||
{
|
||||
model.SubcontractorIsPass = isPass;
|
||||
if (!string.IsNullOrWhiteSpace(remark))
|
||||
{
|
||||
model.SubcontractorRemark = remark;
|
||||
}
|
||||
}
|
||||
else if (this.ConfirmType == 2)
|
||||
{
|
||||
model.ContractorIsPass = isPass;
|
||||
if (!string.IsNullOrWhiteSpace(remark))
|
||||
{
|
||||
model.ContractorRemark = remark;
|
||||
}
|
||||
}
|
||||
else if (this.ConfirmType == 3)
|
||||
{
|
||||
model.SupervisionIsPass = isPass;
|
||||
if (!string.IsNullOrWhiteSpace(remark))
|
||||
{
|
||||
model.SupervisionRemark = remark;
|
||||
}
|
||||
}
|
||||
else if (this.ConfirmType == 4)
|
||||
{
|
||||
model.OwnerIsPass = isPass;
|
||||
if (!string.IsNullOrWhiteSpace(remark))
|
||||
{
|
||||
model.OwnerRemark = remark;
|
||||
}
|
||||
}
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("文件无数据!", MessageBoxIcon.Warning);
|
||||
}
|
||||
var subModel = Funs.DB.PreRun_SubInspectTerm.FirstOrDefault(x => x.SubInspectId == this.SubInspectId);
|
||||
if (subModel != null)
|
||||
{
|
||||
//1=分包商2=承包商3=监理4=业主
|
||||
if (this.ConfirmType == 1)
|
||||
{
|
||||
if (Funs.DB.PreRun_SubInspectTermItem.Count(x => x.SubInspectId == this.SubInspectId && x.SubcontractorIsPass.GetValueOrDefault() != 1) == 0)
|
||||
{
|
||||
subModel.SubcontractorIsAllPass = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
subModel.SubcontractorIsAllPass = 0;
|
||||
}
|
||||
}
|
||||
else if (this.ConfirmType == 2)
|
||||
{
|
||||
if (Funs.DB.PreRun_SubInspectTermItem.Count(x => x.SubInspectId == this.SubInspectId && x.ContractorIsPass.GetValueOrDefault() != 1) == 0)
|
||||
{
|
||||
subModel.ContractorIsAllPass = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
subModel.ContractorIsAllPass = 0;
|
||||
}
|
||||
}
|
||||
else if (this.ConfirmType == 3)
|
||||
{
|
||||
if (Funs.DB.PreRun_SubInspectTermItem.Count(x => x.SubInspectId == this.SubInspectId && x.SupervisionIsPass.GetValueOrDefault() != 1) == 0)
|
||||
{
|
||||
subModel.SupervisionIsAllPass = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
subModel.SupervisionIsAllPass = 0;
|
||||
}
|
||||
}
|
||||
else if (this.ConfirmType == 4)
|
||||
{
|
||||
if (Funs.DB.PreRun_SubInspectTermItem.Count(x => x.SubInspectId == this.SubInspectId && x.OwnerIsPass.GetValueOrDefault() != 1) == 0)
|
||||
{
|
||||
subModel.OwnerIsAllPass = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
subModel.OwnerIsAllPass = 0;
|
||||
}
|
||||
}
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
BindGrid();
|
||||
fileData.Reset();
|
||||
ShowNotify("导入成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowNotify(ex.Message, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
#region 私有方法
|
||||
|
||||
private bool VerifyFile(DataSet ds)
|
||||
{
|
||||
var result = true;
|
||||
|
||||
if (ds.Tables[0].Rows[5][0].ToString() != "序号") result = false;
|
||||
if (ds.Tables[0].Rows[5][1].ToString() != "检查项目") result = false;
|
||||
if (ds.Tables[0].Rows[5][8].ToString() != "结果") result = false;
|
||||
if (ds.Tables[0].Rows[5][13].ToString() != "备注") result = false;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取某一列的所有值
|
||||
/// </summary>
|
||||
/// <typeparam name="T">列数据类型</typeparam>
|
||||
/// <param name="dtSource">数据表</param>
|
||||
/// <param name="filedName">列名</param>
|
||||
/// <returns></returns>
|
||||
public static List<T> GetColumnValues<T>(DataTable dtSource, string filedName)
|
||||
{
|
||||
return (from r in dtSource.AsEnumerable() select r.Field<T>(filedName)).ToList<T>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证datatable某列是否存在重复
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool HasRepeatData(DataTable dt, string[] colName)
|
||||
{
|
||||
bool flag = false;
|
||||
DataView myDataView = new DataView(dt);
|
||||
if (myDataView.ToTable(true, colName).Rows.Count < dt.Rows.Count)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建样式
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static ICellStyle SetExcelStyle(XSSFWorkbook wb, BorderStyle Bottom, BorderStyle Left, BorderStyle Right, BorderStyle Top, VerticalAlignment VerAig, HorizontalAlignment HorAig, double FontSize, bool WrapText = true, bool Bold = false, string FontName = "宋体")
|
||||
{
|
||||
ICellStyle style = wb.CreateCellStyle();
|
||||
style.BorderBottom = Bottom;
|
||||
style.BorderLeft = Left;
|
||||
style.BorderRight = Right;
|
||||
style.BorderTop = Top;
|
||||
style.VerticalAlignment = VerAig;
|
||||
style.Alignment = HorAig;
|
||||
IFont font = wb.CreateFont();
|
||||
font.FontHeightInPoints = FontSize;
|
||||
font.IsBold = Bold;
|
||||
font.FontName = FontName;
|
||||
style.SetFont(font);
|
||||
style.WrapText = WrapText;
|
||||
return style;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建头部
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private XSSFSheet ExcelCreateRowTitle(XSSFSheet ws, XSSFWorkbook hssfworkbook, ICellStyle style, int sRows, int eRows, int cStart, int cEnd, float height = 21)
|
||||
{
|
||||
for (int i = sRows; i <= eRows; i++)
|
||||
{
|
||||
ws.CreateRow(i);
|
||||
ws.GetRow(i).HeightInPoints = height;
|
||||
for (int j = cStart; j <= cEnd; j++)
|
||||
{
|
||||
ws.GetRow(i).CreateCell(j);
|
||||
ws.GetRow(i).CreateCell(j).CellStyle = style;
|
||||
}
|
||||
}
|
||||
return ws;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+36
@@ -59,6 +59,24 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar1;
|
||||
|
||||
/// <summary>
|
||||
/// fileData 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.FileUpload fileData;
|
||||
|
||||
/// <summary>
|
||||
/// btnImport 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarFill 控件。
|
||||
/// </summary>
|
||||
@@ -68,6 +86,15 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarFill ToolbarFill;
|
||||
|
||||
/// <summary>
|
||||
/// btnExport 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnExport;
|
||||
|
||||
/// <summary>
|
||||
/// btnSave 控件。
|
||||
/// </summary>
|
||||
@@ -86,6 +113,15 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList ddlrenderIsPass;
|
||||
|
||||
/// <summary>
|
||||
/// txtRemark 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtRemark;
|
||||
|
||||
/// <summary>
|
||||
/// Window1 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</f:Tree>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="true" EnableCollapse="true" runat="server" DataIDField="SubItemId" DataKeyNames="SubItemId,WorkInspectId,SubInspectId,WorkPackId,InstallationId,ProcessesId,SystemId,SubSystemId" AllowSorting="true" SortField="Sort" SortDirection="ASC" EnableColumnLines="true" AllowCellEditing="true" EnableMultiSelect="true" AllowFilters="true" OnSort="Grid1_Sort" EnableTextSelection="True" EnableCheckBoxSelect="true" OnRowCommand="Grid1_RowCommand" KeepCurrentSelection="true" IsDatabasePaging="true" BoxFlex="1">
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="true" EnableCollapse="true" runat="server" DataIDField="TermItemId" DataKeyNames="TermItemId,SubItemId,WorkInspectId,SubInspectId,WorkPackId,InstallationId,ProcessesId,SystemId,SubSystemId" AllowSorting="true" SortField="Sort" SortDirection="ASC" EnableColumnLines="true" AllowCellEditing="true" AllowFilters="true" OnSort="Grid1_Sort" OnRowCommand="Grid1_RowCommand" IsDatabasePaging="true" BoxFlex="1">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar1" runat="server">
|
||||
<Items>
|
||||
@@ -63,7 +63,7 @@
|
||||
</f:DropDownBox>
|
||||
<f:ToolbarFill ID="ToolbarFill" runat="server"></f:ToolbarFill>
|
||||
<f:Button ID="btnAdd" ToolTip="新增" Text="新增" Icon="Add" runat="server" OnClick="btnAdd_Click"></f:Button>
|
||||
<f:Button ID="btnSave" Text="保存" ToolTip="保存" Icon="FilmSave" runat="server" ValidateForms="" OnClick="btnSave_Click"></f:Button>
|
||||
<f:Button ID="btnSave" Text="保存" ToolTip="保存" Icon="FilmSave" runat="server" OnClientClick="if(!isValid()){return false;}" OnClick="btnSave_Click"></f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
@@ -111,45 +111,79 @@
|
||||
</f:Panel>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
// 返回false,来阻止浏览器右键菜单
|
||||
function onRowContextMenu(event, rowId) {
|
||||
return false;
|
||||
}
|
||||
function reloadGrid() {
|
||||
__doPostBack(null, 'reloadGrid');
|
||||
}
|
||||
//检查人
|
||||
var ddlInspectedUser = '<%= ddlInspectedUser.ClientID %>';
|
||||
function renderInspectedUser(value) {
|
||||
if (value == -1) {
|
||||
return '';
|
||||
} else {
|
||||
return F(ddlInspectedUser).getTextByValue(value);
|
||||
// 返回false,来阻止浏览器右键菜单
|
||||
function onRowContextMenu(event, rowId) {
|
||||
return false;
|
||||
}
|
||||
function reloadGrid() {
|
||||
__doPostBack(null, 'reloadGrid');
|
||||
}
|
||||
//检查人
|
||||
var ddlInspectedUser = '<%= ddlInspectedUser.ClientID %>';
|
||||
function renderInspectedUser(value) {
|
||||
if (value == -1) {
|
||||
return '';
|
||||
} else {
|
||||
return F(ddlInspectedUser).getTextByValue(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var ddbSysPipingClientID = '<%= ddbSysPiping.ClientID %>';
|
||||
var cbSysPipingClientID = '<%= cbSysPiping.ClientID %>';
|
||||
function onSelectAllClick() {
|
||||
var cbSysPiping = F(cbSysPipingClientID);
|
||||
$.each(cbSysPiping.items, function (index, item) {
|
||||
item.setValue(true);
|
||||
});
|
||||
var ddbSysPipingClientID = '<%= ddbSysPiping.ClientID %>';
|
||||
var cbSysPipingClientID = '<%= cbSysPiping.ClientID %>';
|
||||
function onSelectAllClick() {
|
||||
var cbSysPiping = F(cbSysPipingClientID);
|
||||
$.each(cbSysPiping.items, function (index, item) {
|
||||
item.setValue(true);
|
||||
});
|
||||
|
||||
// 将数据控件中的值同步到输入框
|
||||
F(ddbSysPipingClientID).syncToBox();
|
||||
}
|
||||
// 将数据控件中的值同步到输入框
|
||||
F(ddbSysPipingClientID).syncToBox();
|
||||
}
|
||||
|
||||
function onClearAllClick() {
|
||||
var cbSysPiping = F(cbSysPipingClientID);
|
||||
$.each(cbSysPiping.items, function (index, item) {
|
||||
item.setValue(false);
|
||||
});
|
||||
|
||||
// 将数据控件中的值同步到输入框
|
||||
F(ddbSysPipingClientID).syncToBox();
|
||||
}
|
||||
|
||||
//验证
|
||||
function isValid() {
|
||||
debugger;
|
||||
var grid1 = F('<%= Grid1.ClientID %>');
|
||||
var valid = true, modifiedData = grid1.getMergedData();
|
||||
|
||||
$.each(modifiedData, function (index, rowData) {
|
||||
debugger;
|
||||
// rowData.id: 行ID
|
||||
// rowData.status: 行状态(newadded, modified, deleted)
|
||||
// rowData.values: 行中修改单元格对象,比如 { "Name": "刘国2", "Gender": 0, "EntranceYear": 2003 }
|
||||
if (rowData.status === 'deleted') {
|
||||
return true; // continue
|
||||
}
|
||||
var name = rowData.values['InspectedUser'];
|
||||
// 更改了姓名列,并且为空字符串
|
||||
// 如果typeof(name)=='undefined',则表示姓名没有更改,需要排除在外!!
|
||||
if (typeof (name) != 'undefined' && $.trim(name) == '') {
|
||||
F.alert({
|
||||
message: '检查人不能为空!',
|
||||
ok: function () {
|
||||
grid1.startEdit(rowData.id, 'InspectedUser');
|
||||
}
|
||||
});
|
||||
|
||||
valid = false;
|
||||
|
||||
return false; // break
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function onClearAllClick() {
|
||||
var cbSysPiping = F(cbSysPipingClientID);
|
||||
$.each(cbSysPiping.items, function (index, item) {
|
||||
item.setValue(false);
|
||||
});
|
||||
|
||||
// 将数据控件中的值同步到输入框
|
||||
F(ddbSysPipingClientID).syncToBox();
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
/// </summary>
|
||||
public void BindGrid(bool typechange = true)
|
||||
{
|
||||
var result = new List<Brid_SubInspectTermItem>();
|
||||
var result = new List<PreRun_SubInspectTermItem>();
|
||||
var workPackId = this.tvControlItem.SelectedNodeID.Split('|')[0];
|
||||
var subSystemId = this.tvControlItem.SelectedNodeID.Split('|')[1];
|
||||
var subInspectId = string.Empty;
|
||||
@@ -258,7 +258,8 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
var model = new Brid_SubInspectTermItem();
|
||||
var model = new PreRun_SubInspectTermItem();
|
||||
model.TermItemId = item.TermItemId;
|
||||
model.SubItemId = item.SubItemId;
|
||||
model.ProjectId = item.ProjectId;
|
||||
model.WorkPackId = item.WorkPackId;
|
||||
@@ -272,44 +273,46 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
model.InspectionResults = item.InspectionResults;
|
||||
model.InspectionIllustrate = item.InspectionIllustrate;
|
||||
model.Sort = item.Sort;
|
||||
model.isChick = true;
|
||||
result.Add(model);
|
||||
}
|
||||
}
|
||||
//获取预加载的数据
|
||||
var defaultDatas = Funs.DB.PreRun_WorkInspectTemplate.Where(s => s.WorkPackId == workPackId).OrderBy(x => x.Sort).ToList();
|
||||
if (defaultDatas.Count > 0)
|
||||
else
|
||||
{
|
||||
int index = list.Count + 1;
|
||||
foreach (var item in defaultDatas)
|
||||
//获取预加载的数据
|
||||
var defaultDatas = Funs.DB.PreRun_WorkInspectTemplate.Where(s => s.WorkPackId == workPackId).OrderBy(x => x.Sort).ToList();
|
||||
if (defaultDatas.Count > 0)
|
||||
{
|
||||
if (list.Count(x => x.WorkInspectName == item.WorkInspectName) == 0)
|
||||
int index = list.Count + 1;
|
||||
foreach (var item in defaultDatas)
|
||||
{
|
||||
var model = new Brid_SubInspectTermItem();
|
||||
model.SubItemId = Guid.NewGuid().ToString();
|
||||
model.ProjectId = this.CurrUser.LoginProjectId;
|
||||
model.WorkPackId = item.WorkPackId;
|
||||
model.WorkInspectId = item.WorkInspectId;
|
||||
model.WorkInspectName = item.WorkInspectName;
|
||||
model.InstallationId = subSysModel.InstallationId;
|
||||
model.ProcessesId = subSysModel.ProcessesId;
|
||||
model.SystemId = subSysModel.SystemId;
|
||||
model.SubSystemId = subSysModel.PreRunId;
|
||||
model.Sort = index + 1;
|
||||
model.isChick = false;
|
||||
result.Add(model);
|
||||
index++;
|
||||
if (list.Count(x => x.WorkInspectName == item.WorkInspectName) == 0)
|
||||
{
|
||||
var model = new PreRun_SubInspectTermItem();
|
||||
model.TermItemId = Guid.NewGuid().ToString();
|
||||
model.SubItemId = Guid.NewGuid().ToString();
|
||||
model.ProjectId = this.CurrUser.LoginProjectId;
|
||||
model.WorkPackId = item.WorkPackId;
|
||||
model.WorkInspectId = item.WorkInspectId;
|
||||
model.WorkInspectName = item.WorkInspectName;
|
||||
model.InstallationId = subSysModel.InstallationId;
|
||||
model.ProcessesId = subSysModel.ProcessesId;
|
||||
model.SystemId = subSysModel.SystemId;
|
||||
model.SubSystemId = subSysModel.PreRunId;
|
||||
model.Sort = index + 1;
|
||||
result.Add(model);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Grid1.DataSource = result;
|
||||
Grid1.DataBind();
|
||||
if (result.Count(x => x.isChick) > 0)
|
||||
{
|
||||
//默认选中行
|
||||
var checkids = result.Where(x => x.isChick).Select(a => a.SubItemId);
|
||||
Grid1.SelectedRowIDArray = checkids.ToArray();
|
||||
}
|
||||
//if (result.Count(x => x.isChick) > 0)
|
||||
//{
|
||||
// //默认选中行
|
||||
// var checkids = result.Where(x => x.isChick).Select(a => a.SubItemId);
|
||||
// Grid1.SelectedRowIDArray = checkids.ToArray();
|
||||
//}
|
||||
//检查人绑定
|
||||
var userList = from user in Funs.DB.Sys_User join projectrole in Funs.DB.Project_ProjectUser on user.UserId equals projectrole.UserId where projectrole.ProjectId == this.CurrUser.LoginProjectId select user;
|
||||
|
||||
@@ -345,7 +348,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
if (e.CommandName == "Delete")
|
||||
{
|
||||
string rowID = e.RowID;
|
||||
var model = Funs.DB.PreRun_SubInspectTermItem.FirstOrDefault(p => p.SubItemId == rowID);
|
||||
var model = Funs.DB.PreRun_SubInspectTermItem.FirstOrDefault(p => p.TermItemId == rowID);
|
||||
if (model != null)
|
||||
{
|
||||
Funs.DB.PreRun_SubInspectTermItem.DeleteOnSubmit(model);
|
||||
@@ -356,7 +359,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
else
|
||||
{
|
||||
var list = gvList();
|
||||
list.RemoveAll(x => x.SubItemId == rowID);
|
||||
list.RemoveAll(x => x.TermItemId == rowID);
|
||||
Grid1.DataSource = list;
|
||||
Grid1.DataBind();
|
||||
ShowNotify("删除成功!");
|
||||
@@ -398,12 +401,6 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
ShowNotify("请选择设备!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
ShowNotify("请选择一条数据!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
var workPackId = this.tvControlItem.SelectedNodeID.Split('|')[0];
|
||||
var subSystemId = this.tvControlItem.SelectedNodeID.Split('|')[1];
|
||||
var subInspectId = string.Empty;
|
||||
@@ -412,22 +409,19 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
subInspectId = this.tvControlItem.SelectedNodeID.Split('|').Last();
|
||||
}
|
||||
var workPackType = int.Parse(ddlWorkPackType.SelectedValue);
|
||||
|
||||
List<PreRun_SubInspectTerm> subTrems = new List<PreRun_SubInspectTerm>();
|
||||
List<PreRun_SubInspectTermItem> subTremItems = new List<PreRun_SubInspectTermItem>();
|
||||
|
||||
//foreach (var item in ddbSysPiping.Values)
|
||||
//{
|
||||
var subTrem = Funs.DB.PreRun_SubInspectTerm.FirstOrDefault(x => x.SubInspectId == subInspectId);
|
||||
var termItems = Funs.DB.PreRun_SubInspectTermItem.Where(x => x.SubInspectId == subInspectId).ToList();
|
||||
JArray mergedData = Grid1.GetMergedData();
|
||||
foreach (JObject mergedRow in mergedData)
|
||||
{
|
||||
string status = mergedRow.Value<string>("status");
|
||||
JObject values = mergedRow.Value<JObject>("values");
|
||||
int i = mergedRow.Value<int>("index");
|
||||
var subItemId = this.Grid1.Rows[i].DataKeys[0].ToString();
|
||||
var workInspectId = this.Grid1.Rows[i].DataKeys[1].ToString();
|
||||
if (!Grid1.SelectedRowIndexArray.Contains(i)) continue;
|
||||
var termItemId = this.Grid1.Rows[i].DataKeys[0].ToString();
|
||||
var subItemId = this.Grid1.Rows[i].DataKeys[1].ToString();
|
||||
var workInspectId = this.Grid1.Rows[i].DataKeys[2].ToString();
|
||||
|
||||
//获取子系统信息
|
||||
var list = new List<PreRun_SubInspectTermItem>();
|
||||
@@ -460,15 +454,14 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
subTrem.Subcontractor = ddlfbs.SelectedValue;
|
||||
subTrem.Contractor = ddlcbs.SelectedValue;
|
||||
subTrem.Supervision = ddljl.SelectedValue;
|
||||
subTrem.Owner = ddlyz.SelectedValue;
|
||||
subTrem.Owner = ddlyz.SelectedValue;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
var model = Funs.DB.PreRun_SubInspectTermItem.FirstOrDefault(x => x.SubInspectId == subInspectId);
|
||||
var model = Funs.DB.PreRun_SubInspectTermItem.FirstOrDefault(x => x.TermItemId == termItemId);
|
||||
if (model == null)
|
||||
{
|
||||
model = new PreRun_SubInspectTermItem();
|
||||
model.TermItemId = Guid.NewGuid().ToString();
|
||||
model.TermItemId = termItemId;
|
||||
model.SubItemId = subItemId;
|
||||
model.SubInspectId = subTrem.SubInspectId;
|
||||
model.WorkPackId = workPackId;
|
||||
@@ -500,11 +493,19 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
}
|
||||
}
|
||||
|
||||
Funs.DB.PreRun_SubInspectTerm.InsertAllOnSubmit(subTrems);
|
||||
Funs.DB.PreRun_SubInspectTermItem.InsertAllOnSubmit(subTremItems);
|
||||
if (subTrems != null) Funs.DB.PreRun_SubInspectTerm.InsertAllOnSubmit(subTrems);
|
||||
if (subTremItems.Count > 0) Funs.DB.PreRun_SubInspectTermItem.InsertAllOnSubmit(subTremItems);
|
||||
Funs.DB.SubmitChanges();
|
||||
if (Funs.DB.PreRun_SubInspectTermItem.Count(x => x.SubInspectId == subTrem.SubInspectId && x.InspectionResults.GetValueOrDefault() != 1) == 0)
|
||||
{
|
||||
subTrem.InspectionIsAllPass = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
subTrem.InspectionIsAllPass = 0;
|
||||
}
|
||||
Funs.DB.SubmitChanges();
|
||||
this.InitTreeMenu();
|
||||
//BindGrid();
|
||||
ShowNotify("保存成功!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -526,6 +527,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
if (subSysModel != null)
|
||||
{
|
||||
var model = new PreRun_SubInspectTermItem();
|
||||
model.TermItemId = Guid.NewGuid().ToString();
|
||||
model.SubItemId = Guid.NewGuid().ToString();
|
||||
model.ProjectId = this.CurrUser.LoginProjectId;
|
||||
model.WorkPackId = workPackId;
|
||||
@@ -554,17 +556,18 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
string status = mergedRow.Value<string>("status");
|
||||
JObject values = mergedRow.Value<JObject>("values");
|
||||
int i = mergedRow.Value<int>("index");
|
||||
var subItemId = this.Grid1.Rows[i].DataKeys[0].ToString();
|
||||
var workInspectId = this.Grid1.Rows[i].DataKeys[1] != null ? this.Grid1.Rows[i].DataKeys[1].ToString() : string.Empty; ;
|
||||
var subInspectId = this.Grid1.Rows[i].DataKeys[2] != null ? this.Grid1.Rows[i].DataKeys[2].ToString() : string.Empty;
|
||||
var workPackId = this.Grid1.Rows[i].DataKeys[3].ToString();
|
||||
var installationId = this.Grid1.Rows[i].DataKeys[4].ToString();
|
||||
var processesId = this.Grid1.Rows[i].DataKeys[4].ToString();
|
||||
var systemId = this.Grid1.Rows[i].DataKeys[4].ToString();
|
||||
var subSystemId = this.Grid1.Rows[i].DataKeys[4].ToString();
|
||||
var termItemId = this.Grid1.Rows[i].DataKeys[0].ToString();
|
||||
var subItemId = this.Grid1.Rows[i].DataKeys[1].ToString();
|
||||
var workInspectId = this.Grid1.Rows[i].DataKeys[2] != null ? this.Grid1.Rows[i].DataKeys[2].ToString() : string.Empty; ;
|
||||
var subInspectId = this.Grid1.Rows[i].DataKeys[3] != null ? this.Grid1.Rows[i].DataKeys[3].ToString() : string.Empty;
|
||||
var workPackId = this.Grid1.Rows[i].DataKeys[4].ToString();
|
||||
var installationId = this.Grid1.Rows[i].DataKeys[5].ToString();
|
||||
var processesId = this.Grid1.Rows[i].DataKeys[6].ToString();
|
||||
var systemId = this.Grid1.Rows[i].DataKeys[7].ToString();
|
||||
var subSystemId = this.Grid1.Rows[i].DataKeys[8].ToString();
|
||||
|
||||
var model = new PreRun_SubInspectTermItem();
|
||||
model = new PreRun_SubInspectTermItem();
|
||||
model.TermItemId = termItemId;
|
||||
model.SubItemId = subItemId;
|
||||
model.SubInspectId = subInspectId;
|
||||
model.WorkPackId = workPackId;
|
||||
@@ -608,17 +611,6 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定实体
|
||||
/// </summary>
|
||||
public class Brid_SubInspectTermItem : PreRun_SubInspectTermItem
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否选中
|
||||
/// </summary>
|
||||
public bool isChick { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型
|
||||
/// </summary>
|
||||
|
||||
@@ -256,6 +256,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
string IsXls = Path.GetExtension(this.fileData.FileName).ToString().Trim().ToLower();
|
||||
if (IsXls != ".xls" && IsXls != ".xlsx")
|
||||
{
|
||||
fileData.Reset();
|
||||
ShowNotify("excel文件类型错误!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
@@ -277,6 +278,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
DataSet ds = NPOIHelper.ExcelToDataSet(fileName, out string message, false);
|
||||
if (ds == null)
|
||||
{
|
||||
fileData.Reset();
|
||||
ShowNotify("模板错误,请从系统下载正确的模板!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
@@ -290,12 +292,14 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
var fileVerify = PropertyVerifyFile(ds);
|
||||
if (!fileVerify)
|
||||
{
|
||||
fileData.Reset();
|
||||
ShowNotify("请获取正确模板!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var columVerify = HasRepeatData(ds.Tables[0], new string[] { "A" });
|
||||
if (columVerify)
|
||||
{
|
||||
fileData.Reset();
|
||||
ShowNotify("模板中存在管道号相同或管道号为空的数据!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
@@ -317,6 +321,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(ds.Tables[0].Rows[i][0].ToString()))
|
||||
{
|
||||
fileData.Reset();
|
||||
ShowNotify($"第{i}行管道号为空", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
@@ -350,13 +355,16 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
}
|
||||
else
|
||||
{
|
||||
fileData.Reset();
|
||||
ShowNotify("文件无数据!", MessageBoxIcon.Warning);
|
||||
}
|
||||
fileData.Reset();
|
||||
ZxtgdBrid();
|
||||
ShowNotify("导入成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
fileData.Reset();
|
||||
ShowNotify(ex.Message, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
@@ -494,6 +502,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
string IsXls = Path.GetExtension(this.filegyData.FileName).ToString().Trim().ToLower();
|
||||
if (IsXls != ".xls" && IsXls != ".xlsx")
|
||||
{
|
||||
filegyData.Reset();
|
||||
ShowNotify("excel文件类型错误!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
@@ -515,6 +524,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
DataSet ds = NPOIHelper.ExcelToDataSet(fileName, out string message, false);
|
||||
if (ds == null)
|
||||
{
|
||||
filegyData.Reset();
|
||||
ShowNotify("模板错误,请从系统下载正确的模板!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
@@ -528,6 +538,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
var fileVerify = TechnologyVerifyFile(ds);
|
||||
if (!fileVerify)
|
||||
{
|
||||
filegyData.Reset();
|
||||
ShowNotify("请获取正确模板!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
@@ -554,6 +565,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
filegyData.Reset();
|
||||
ShowNotify($"{i}行数据存在错误!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
@@ -616,6 +628,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
}
|
||||
if (list.GroupBy(x => x.TagNumber).Count() != list.Count)
|
||||
{
|
||||
filegyData.Reset();
|
||||
ShowNotify("模板中存在设备位号相同的数据!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
@@ -625,13 +638,16 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
}
|
||||
else
|
||||
{
|
||||
filegyData.Reset();
|
||||
ShowNotify("文件无数据!", MessageBoxIcon.Warning);
|
||||
}
|
||||
filegyData.Reset();
|
||||
ZxtgyBrid();
|
||||
ShowNotify("导入成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
filegyData.Reset();
|
||||
ShowNotify(ex.Message, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user