20240430 质量综合管理导入导出
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="施工技术交底管理" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="ConTechnologyDisclosureId" AllowCellEditing="true" EnableColumnLines="true"
|
||||
ClicksToEdit="2" DataIDField="ConTechnologyDisclosureId" AllowSorting="true" SortField="CompileDate"
|
||||
ClicksToEdit="2" DataIDField="ConTechnologyDisclosureId" AllowSorting="true" SortField="RemarkCode"
|
||||
SortDirection="DESC" OnSort="Grid1_Sort"
|
||||
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="true">
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
public void BindGrid()
|
||||
{
|
||||
string strSql = @"select C.ConTechnologyDisclosureId, C.ProjectId, C.CNProfessionalId, C.DisclosureCode, C.DisclosureName,C.UnitId,C.DisclosureMan,C.DisclosureDate, C.UnitWorkId,C.AttendMan,
|
||||
C.CompileMan, C.CompileDate, C.RemarkCode,CN.ProfessionalName,u.UnitName
|
||||
C.CompileMan, C.CompileDate, C.RemarkCode,CN.ProfessionalName,u.UnitName,C.RemarkCode
|
||||
from Comprehensive_ConTechnologyDisclosure C
|
||||
left join Base_CNProfessional CN on C.CNProfessionalId=CN.CNProfessionalId
|
||||
left join Base_Unit u on u.UnitId = C.UnitId
|
||||
@@ -262,7 +262,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
lists = lists.OrderBy(x => x.RemarkCode);
|
||||
if (lists != null)
|
||||
{
|
||||
string projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
string projectName = BLL.ProjectService.GetShortNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
newUrl = uploadfilepath.Replace("施工技术交底管理导入模板", "施工技术交底管理("+projectName+DateTime.Now.ToString("yyyyMMdd")+")");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
{
|
||||
string strSql = @"select DataDistributionId, ProjectId, SendDate, FileCode, FileName, Status,
|
||||
SendMan, ReceivingUnit, ReceivingMan, (case when FileType='1' then '纸质' ELSE '电子' end)AS FileType, CopiesCount, (case when IsReply='True' then '是' else '否' end) as IsReply, ReplyCode,
|
||||
ReplyDate, Remark, AttachUrl, CompileMan, CompileDate,CN.ProfessionalName
|
||||
ReplyDate, Remark, AttachUrl, CompileMan, CompileDate,CN.ProfessionalName
|
||||
from Comprehensive_DataDistribution C
|
||||
left join Base_CNProfessional CN on C.CNProfessionalId=CN.CNProfessionalId
|
||||
where C.ProjectId = @ProjectId";
|
||||
|
||||
@@ -350,7 +350,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
lists = lists.OrderBy(x => x.RemarkCode);
|
||||
if (lists != null)
|
||||
{
|
||||
string projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
string projectName = BLL.ProjectService.GetShortNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
newUrl = uploadfilepath.Replace("资料收发文登记记录导入模板", "资料收发文登记记录(" + projectName + "" + DateTime.Now.ToString("yyyyMMdd") + ")");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="设计变更单" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="DesignChangeOrderId" AllowCellEditing="true" EnableColumnLines="true"
|
||||
ClicksToEdit="2" DataIDField="DesignChangeOrderId" AllowSorting="true" SortField="ChangeOrderCode"
|
||||
ClicksToEdit="2" DataIDField="DesignChangeOrderId" AllowSorting="true" SortField="RemarkCode"
|
||||
SortDirection="DESC" OnSort="Grid1_Sort"
|
||||
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="true">
|
||||
|
||||
@@ -45,7 +45,8 @@ namespace FineUIPro.Web.Comprehensive
|
||||
C.ImplementationFrontState,
|
||||
CN.ProfessionalName,
|
||||
C.Status,
|
||||
C.CompleteDate
|
||||
C.CompleteDate,
|
||||
C.RemarkCode
|
||||
from Comprehensive_DesignChangeOrder C "
|
||||
+ @" left join Base_CNProfessional CN on C.CNProfessionalId=CN.CNProfessionalId "
|
||||
+ @" where C.ProjectId = @ProjectId";
|
||||
@@ -314,7 +315,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
lists = lists.OrderBy(x => x.RemarkCode);
|
||||
if (lists != null)
|
||||
{
|
||||
string projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
string projectName = BLL.ProjectService.GetShortNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
newUrl = uploadfilepath.Replace("设计变更单导入模板", "设计变更单(" + projectName + DateTime.Now.ToString("yyyyMMdd") + ")");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="设计交底管理" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="DesignDetailsId" AllowCellEditing="true" EnableColumnLines="true" ClicksToEdit="2" DataIDField="DesignDetailsId" AllowSorting="true"
|
||||
SortField="DesignDetailsCode" SortDirection="DESC" OnSort="Grid1_Sort" AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
SortField="RemarCode" SortDirection="DESC" OnSort="Grid1_Sort" AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="ToolSearch" Position="Top" runat="server" ToolbarAlign="Left">
|
||||
@@ -29,6 +29,9 @@
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" ToolTip="导入" Hidden="true" Icon="PackageIn" runat="server" OnClick="btnImport_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
|
||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
namespace FineUIPro.Web.Comprehensive
|
||||
{
|
||||
@@ -26,7 +27,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
public void BindGrid()
|
||||
{
|
||||
string strSql = @"select DesignDetailsId,DesignDetailsCode, DetailsMan, DetailsDate, UnitWorkId,Status,
|
||||
UnitName, AttachUrl, CompileMan, CN.ProfessionalName
|
||||
UnitName, AttachUrl, CompileMan, CN.ProfessionalName,C.RemarCode
|
||||
from Comprehensive_DesignDetails C
|
||||
left join Base_CNProfessional CN on C.CNProfessionalId=CN.CNProfessionalId
|
||||
where C.ProjectId = @ProjectId";
|
||||
@@ -230,6 +231,35 @@ namespace FineUIPro.Web.Comprehensive
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static string ConvertState(object Status)
|
||||
{
|
||||
if (Status != null)
|
||||
{
|
||||
if (Status.ToString().Trim() == BLL.Const.Comprehensive_ReCompile)
|
||||
{
|
||||
return "重报";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_ReJect)
|
||||
{
|
||||
return "驳回";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_Compile)
|
||||
{
|
||||
return "编制";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_Audit)
|
||||
{
|
||||
return "待审批";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_Complete)
|
||||
{
|
||||
return "审批完成";
|
||||
}
|
||||
}
|
||||
|
||||
return "编制";
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取按钮权限
|
||||
@@ -271,36 +301,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static string ConvertState(object Status)
|
||||
{
|
||||
if (Status != null)
|
||||
{
|
||||
if (Status.ToString().Trim() == BLL.Const.Comprehensive_ReCompile)
|
||||
{
|
||||
return "重报";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_ReJect)
|
||||
{
|
||||
return "驳回";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_Compile)
|
||||
{
|
||||
return "编制";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_Audit)
|
||||
{
|
||||
return "待审批";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_Complete)
|
||||
{
|
||||
return "审批完成";
|
||||
}
|
||||
}
|
||||
|
||||
return "编制";
|
||||
}
|
||||
|
||||
|
||||
#region 导入
|
||||
/// <summary>
|
||||
/// 导入按钮
|
||||
@@ -312,5 +313,145 @@ namespace FineUIPro.Web.Comprehensive
|
||||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("DesignDetailsDataIn.aspx", "导入 - ")));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 导出按钮
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = Const.DesignDetailsTemplateUrl;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
|
||||
var lists = (from x in Funs.DB.Comprehensive_DesignDetails
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x);
|
||||
if (sdrpCNProfessionalId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
lists = lists.Where(x => x.CNProfessionalId == sdrpCNProfessionalId.SelectedValue);
|
||||
}
|
||||
lists = lists.OrderBy(x => x.RemarCode);
|
||||
if (lists != null)
|
||||
{
|
||||
string projectName = BLL.ProjectService.GetShortNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
newUrl = uploadfilepath.Replace("设计交底管理导入模板", "设计交底管理(" + projectName+ DateTime.Now.ToString("yyyyMMdd") + ")");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
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);
|
||||
}
|
||||
// 创建单元格样式
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
|
||||
cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font = workbook.CreateFont();
|
||||
font.FontHeightInPoints = 11;
|
||||
cellStyle.SetFont(font);
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle0 = workbook.CreateCellStyle();
|
||||
cellStyle0.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle0.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font0 = workbook.CreateFont();
|
||||
font0.FontHeightInPoints = 12;
|
||||
font0.IsBold = true;
|
||||
cellStyle0.SetFont(font0);
|
||||
// 第二步:创建新数据行
|
||||
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
|
||||
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
|
||||
NPOI.SS.UserModel.ICell cell;
|
||||
int i = 2;
|
||||
foreach (var item in lists)
|
||||
{
|
||||
// 第二步:创建新数据行
|
||||
row = sheet.CreateRow(i);
|
||||
// 添加数据
|
||||
cell = row.CreateCell(0);
|
||||
cell.CellStyle = cellStyle;
|
||||
string proName = string.Empty;
|
||||
var cnp = BLL.CNProfessionalService.GetCNProfessional(item.CNProfessionalId);
|
||||
if (cnp != null)
|
||||
{
|
||||
proName = cnp.ProfessionalName;
|
||||
}
|
||||
cell.SetCellValue(proName);//专业
|
||||
|
||||
cell = row.CreateCell(1);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.DesignDetailsCode);//文件号
|
||||
|
||||
cell = row.CreateCell(2);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.DetailsMan);//交底人
|
||||
|
||||
cell = row.CreateCell(3);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.DetailsDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.DetailsDate) : "");//交底日期
|
||||
|
||||
cell = row.CreateCell(4);
|
||||
cell.CellStyle = cellStyle;
|
||||
string unitWorkName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.UnitWorkId))
|
||||
{
|
||||
unitWorkName = ConvertUnitWork(item.UnitWorkId);
|
||||
}
|
||||
cell.SetCellValue(unitWorkName);//单位工程
|
||||
|
||||
cell = row.CreateCell(5);
|
||||
cell.CellStyle = cellStyle;
|
||||
string unitName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.UnitName))
|
||||
{
|
||||
unitName = ConvertCarryUnit(item.UnitName);
|
||||
}
|
||||
cell.SetCellValue(unitName);//参加单位
|
||||
|
||||
cell = row.CreateCell(6);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.JoinPersonNum.HasValue ? item.JoinPersonNum.ToString() : "");//参加人数
|
||||
|
||||
cell = row.CreateCell(7);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.RemarCode.HasValue ? item.RemarCode.ToString() : "");//标志编号
|
||||
|
||||
i++;
|
||||
}
|
||||
// 第三步:写入文件流
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
workbook.Write(stream);
|
||||
workbook.Close();
|
||||
}
|
||||
string fileName = Path.GetFileName(newUrl);
|
||||
FileInfo info = new FileInfo(newUrl);
|
||||
long fileSize = info.Length;
|
||||
Response.Clear();
|
||||
Response.ContentType = "application/x-zip-compressed";
|
||||
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
Response.TransmitFile(newUrl, 0, fileSize);
|
||||
Response.Flush();
|
||||
Response.Close();
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("当前无记录,无法导出!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -93,6 +93,15 @@ namespace FineUIPro.Web.Comprehensive {
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnOut;
|
||||
|
||||
/// <summary>
|
||||
/// lblPageIndex 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
&& x.SuperUnitWork == null
|
||||
select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
string row0 = pds.Rows[i][0].ToString();
|
||||
if (!string.IsNullOrEmpty(row0))
|
||||
@@ -255,6 +255,17 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "标志编号" + "," + "此项为必填项!" + "|";
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
int t = Convert.ToInt32(row7);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "标志编号" + "," + "[" + row7 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(result))
|
||||
{
|
||||
@@ -404,13 +415,13 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
&& x.SuperUnitWork == null
|
||||
select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
Model.Comprehensive_DesignDetails oldViewInfo = new Model.Comprehensive_DesignDetails();
|
||||
string row0 = pds.Rows[i][0].ToString().Trim();
|
||||
var cn = cns.Where(y => y.ProfessionalName == row0).FirstOrDefault();
|
||||
|
||||
oldViewInfo = oldViewInfos.Where(x => x.RemarCode == pds.Rows[i][7].ToString().Trim()
|
||||
oldViewInfo = oldViewInfos.Where(x => x.RemarCode ==Funs.GetNewInt(pds.Rows[i][7].ToString().Trim())
|
||||
).FirstOrDefault();
|
||||
if (oldViewInfo == null)
|
||||
{
|
||||
@@ -430,7 +441,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
des.UnitName = BLL.UnitService.GetUnitIds(pds.Rows[i][5].ToString().Trim());
|
||||
}
|
||||
des.JoinPersonNum = Funs.GetNewInt(pds.Rows[i][6].ToString().Trim());
|
||||
des.RemarCode = pds.Rows[i][7].ToString().Trim();
|
||||
des.RemarCode = Funs.GetNewInt(pds.Rows[i][7].ToString().Trim());
|
||||
des.CompileMan = this.CurrUser.UserId;
|
||||
des.CompileDate = DateTime.Now;
|
||||
des.Status = BLL.Const.Comprehensive_Compile;
|
||||
|
||||
@@ -39,7 +39,8 @@
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:NumberBox runat="server" ID="txtJoinPersonNum" NoDecimal="true" NoNegative="true" Label="参与人数" LabelAlign="Right" LabelWidth="140px"></f:NumberBox>
|
||||
<f:TextBox ID="TextBox1" runat="server" Label="" MaxLength="50" Required="true" ShowRedStar="true" Hidden="true"></f:TextBox>
|
||||
<%--<f:TextBox ID="TextBox1" runat="server" Label="" MaxLength="50" Required="true" ShowRedStar="true" Hidden="true"></f:TextBox>--%>
|
||||
<f:NumberBox ID="txtRemarkCode" runat="server" Label="标志编号" LabelAlign="Right" LabelWidth="140px" Required="true" ShowRedStar="true" NoDecimal="true" NoNegative="true"></f:NumberBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
|
||||
@@ -71,6 +71,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
this.txtJoinPersonNum.Text = designDetails.JoinPersonNum.ToString();
|
||||
}
|
||||
this.txtRemarkCode.Text = designDetails.RemarCode.HasValue ? designDetails.RemarCode.ToString() : "";
|
||||
var auditApprove = DesignDetailsApproveService.GetAuditApprove(designDetails.DesignDetailsId, BLL.Const.Comprehensive_Audit);
|
||||
if (auditApprove != null)
|
||||
{
|
||||
@@ -133,6 +134,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
this.drpUnitWorks.Readonly = true;
|
||||
|
||||
this.drpAudit.Readonly = true;
|
||||
this.txtRemarkCode.Readonly = true;
|
||||
|
||||
//this.btnAttach.Enabled = false;
|
||||
|
||||
@@ -174,6 +176,12 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var q = Funs.DB.Comprehensive_DesignDetails.FirstOrDefault(x => x.RemarCode == Funs.GetNewInt(this.txtRemarkCode.Text.Trim()) && (x.DesignDetailsId != this.DesignDetailsId || (this.DesignDetailsId == null && x.DesignDetailsId != null)));
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("标志编号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
Model.Comprehensive_DesignDetails designDetails = new Model.Comprehensive_DesignDetails();
|
||||
designDetails.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue))
|
||||
@@ -214,6 +222,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
unitIds = unitIds.Substring(0, unitIds.LastIndexOf(","));
|
||||
}
|
||||
designDetails.UnitName = unitIds;
|
||||
designDetails.RemarCode = Funs.GetNewInt(this.txtRemarkCode.Text.Trim());
|
||||
if (string.IsNullOrEmpty(this.DesignDetailsId))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.hdAttachUrl.Text))
|
||||
@@ -254,6 +263,13 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var q = Funs.DB.Comprehensive_DesignDetails.FirstOrDefault(x => x.RemarCode == Funs.GetNewInt(this.txtRemarkCode.Text.Trim()) && (x.DesignDetailsId != this.DesignDetailsId || (this.DesignDetailsId == null && x.DesignDetailsId != null)));
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("标志编号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
Model.Comprehensive_DesignDetails designDetails = new Model.Comprehensive_DesignDetails();
|
||||
designDetails.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue))
|
||||
@@ -294,6 +310,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
unitIds = unitIds.Substring(0, unitIds.LastIndexOf(","));
|
||||
}
|
||||
designDetails.UnitName = unitIds;
|
||||
designDetails.RemarCode = Funs.GetNewInt(this.txtRemarkCode.Text.Trim());
|
||||
if (string.IsNullOrEmpty(this.DesignDetailsId))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.hdAttachUrl.Text))
|
||||
|
||||
@@ -103,13 +103,13 @@ namespace FineUIPro.Web.CQMS.Comprehensive {
|
||||
protected global::FineUIPro.NumberBox txtJoinPersonNum;
|
||||
|
||||
/// <summary>
|
||||
/// TextBox1 控件。
|
||||
/// txtRemarkCode 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox TextBox1;
|
||||
protected global::FineUIPro.NumberBox txtRemarkCode;
|
||||
|
||||
/// <summary>
|
||||
/// Panel2 控件。
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="图纸收发记录" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="DesignDrawingsId" AllowCellEditing="true" EnableColumnLines="true" ClicksToEdit="2" DataIDField="DesignDrawingsId" AllowSorting="true"
|
||||
SortField="DesignDrawingsCode" SortDirection="DESC" OnSort="Grid1_Sort" AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
SortField="RemarkCode" SortDirection="DESC" OnSort="Grid1_Sort" AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="ToolSearch" Position="Top" runat="server" ToolbarAlign="Left">
|
||||
@@ -35,6 +35,9 @@
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" ToolTip="导入" Hidden="true" Icon="PackageIn" runat="server" OnClick="btnImport_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
|
||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.Comprehensive
|
||||
@@ -272,6 +273,36 @@ namespace FineUIPro.Web.Comprehensive
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static string ConvertState(object Status)
|
||||
{
|
||||
if (Status != null)
|
||||
{
|
||||
if (Status.ToString().Trim() == BLL.Const.Comprehensive_ReCompile)
|
||||
{
|
||||
return "重报";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_ReJect)
|
||||
{
|
||||
return "驳回";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_Compile)
|
||||
{
|
||||
return "编制";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_Audit)
|
||||
{
|
||||
return "待审批";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_Complete)
|
||||
{
|
||||
return "审批完成";
|
||||
}
|
||||
}
|
||||
|
||||
return "编制";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 获取按钮权限
|
||||
@@ -314,33 +345,177 @@ namespace FineUIPro.Web.Comprehensive
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static string ConvertState(object Status)
|
||||
#region 导出按钮
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Status != null)
|
||||
{
|
||||
if (Status.ToString().Trim() == BLL.Const.Comprehensive_ReCompile)
|
||||
{
|
||||
return "重报";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_ReJect)
|
||||
{
|
||||
return "驳回";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_Compile)
|
||||
{
|
||||
return "编制";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_Audit)
|
||||
{
|
||||
return "待审批";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_Complete)
|
||||
{
|
||||
return "审批完成";
|
||||
}
|
||||
}
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = Const.DesignDrawingsDataInUrl;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
|
||||
return "编制";
|
||||
var lists = (from x in Funs.DB.Comprehensive_DesignDrawings
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x);
|
||||
if (sdrpCNProfessionalId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
lists = lists.Where(x => x.CNProfessionalId == sdrpCNProfessionalId.SelectedValue);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.stxtReceiveDate.Text.Trim()))
|
||||
{
|
||||
lists = lists.Where(x => x.ReceiveDate ==Funs.GetNewDateTime(stxtReceiveDate.Text.Trim()));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.stxtSendDate.Text.Trim()))
|
||||
{
|
||||
lists = lists.Where(x => x.SendDate == Funs.GetNewDateTime(stxtSendDate.Text.Trim()));
|
||||
}
|
||||
lists = lists.OrderBy(x => x.RemarkCode);
|
||||
if (lists != null)
|
||||
{
|
||||
string projectName = BLL.ProjectService.GetShortNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
newUrl = uploadfilepath.Replace("图纸收发记录导入模板", "图纸收发记录(" + projectName + DateTime.Now.ToString("yyyyMMdd") + ")");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
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);
|
||||
}
|
||||
// 创建单元格样式
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
|
||||
cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font = workbook.CreateFont();
|
||||
font.FontHeightInPoints = 11;
|
||||
cellStyle.SetFont(font);
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle0 = workbook.CreateCellStyle();
|
||||
cellStyle0.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle0.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font0 = workbook.CreateFont();
|
||||
font0.FontHeightInPoints = 12;
|
||||
font0.IsBold = true;
|
||||
cellStyle0.SetFont(font0);
|
||||
// 第二步:创建新数据行
|
||||
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
|
||||
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
|
||||
NPOI.SS.UserModel.ICell cell;
|
||||
int i = 2;
|
||||
foreach (var item in lists)
|
||||
{
|
||||
// 第二步:创建新数据行
|
||||
row = sheet.CreateRow(i);
|
||||
// 添加数据
|
||||
//cell = row.CreateCell(0);
|
||||
//cell.CellStyle = cellStyle;
|
||||
//string unitName = string.Empty;
|
||||
//if (!string.IsNullOrEmpty(item.UnitId))
|
||||
//{
|
||||
// unitName = BLL.UnitService.GetUnitNameByUnitId(item.UnitId);
|
||||
//}
|
||||
//cell.SetCellValue(unitName);//报批单位
|
||||
|
||||
cell = row.CreateCell(0);
|
||||
cell.CellStyle = cellStyle;
|
||||
string proName = string.Empty;
|
||||
var cnp = BLL.CNProfessionalService.GetCNProfessional(item.CNProfessionalId);
|
||||
if (cnp != null)
|
||||
{
|
||||
proName = cnp.ProfessionalName;
|
||||
}
|
||||
cell.SetCellValue(proName);//专业
|
||||
|
||||
cell = row.CreateCell(1);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.DesignDrawingsCode);//设计图纸编号
|
||||
|
||||
cell = row.CreateCell(2);
|
||||
cell.CellStyle = cellStyle;
|
||||
string unitWorkName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.UnitWorkId))
|
||||
{
|
||||
unitWorkName = ConvertUnitWork(item.UnitWorkId);
|
||||
}
|
||||
cell.SetCellValue(unitWorkName);//单位工程
|
||||
|
||||
cell = row.CreateCell(3);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.DesignDrawingsContent);//图纸内容
|
||||
|
||||
cell = row.CreateCell(4);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.Edition);//版次
|
||||
|
||||
cell = row.CreateCell(5);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.PageNumber.HasValue ? item.PageNumber.ToString() : "");//页数
|
||||
|
||||
cell = row.CreateCell(6);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ReceiveDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.ReceiveDate) : "");//接收日期
|
||||
|
||||
cell = row.CreateCell(7);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.SendDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.SendDate) : "");//发送日期
|
||||
|
||||
cell = row.CreateCell(8);
|
||||
cell.CellStyle = cellStyle;
|
||||
string unitName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.ReceiveUnits))
|
||||
{
|
||||
unitName = ConvertCarryUnit(item.ReceiveUnits);
|
||||
}
|
||||
cell.SetCellValue(unitName);//接收单位
|
||||
|
||||
cell = row.CreateCell(9);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ReceiveMan);//接收人
|
||||
|
||||
cell = row.CreateCell(10);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.Remark);//备注
|
||||
|
||||
cell = row.CreateCell(11);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.RemarkCode.HasValue ? item.RemarkCode.ToString() : "");//标志编号
|
||||
|
||||
i++;
|
||||
}
|
||||
// 第三步:写入文件流
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
workbook.Write(stream);
|
||||
workbook.Close();
|
||||
}
|
||||
string fileName = Path.GetFileName(newUrl);
|
||||
FileInfo info = new FileInfo(newUrl);
|
||||
long fileSize = info.Length;
|
||||
Response.Clear();
|
||||
Response.ContentType = "application/x-zip-compressed";
|
||||
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
Response.TransmitFile(newUrl, 0, fileSize);
|
||||
Response.Flush();
|
||||
Response.Close();
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("当前无记录,无法导出!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -7,13 +7,11 @@
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.Comprehensive
|
||||
{
|
||||
|
||||
|
||||
public partial class DesignDrawings
|
||||
{
|
||||
|
||||
namespace FineUIPro.Web.Comprehensive {
|
||||
|
||||
|
||||
public partial class DesignDrawings {
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
@@ -22,7 +20,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
@@ -31,7 +29,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Panel1 控件。
|
||||
/// </summary>
|
||||
@@ -40,7 +38,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Grid1 控件。
|
||||
/// </summary>
|
||||
@@ -49,7 +47,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ToolSearch 控件。
|
||||
/// </summary>
|
||||
@@ -58,7 +56,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar ToolSearch;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// sdrpCNProfessionalId 控件。
|
||||
/// </summary>
|
||||
@@ -67,7 +65,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList sdrpCNProfessionalId;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// stxtReceiveDate 控件。
|
||||
/// </summary>
|
||||
@@ -76,7 +74,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DatePicker stxtReceiveDate;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// stxtSendDate 控件。
|
||||
/// </summary>
|
||||
@@ -85,7 +83,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DatePicker stxtSendDate;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnSearch 控件。
|
||||
/// </summary>
|
||||
@@ -94,7 +92,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSearch;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnNew 控件。
|
||||
/// </summary>
|
||||
@@ -103,7 +101,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnNew;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnImport 控件。
|
||||
/// </summary>
|
||||
@@ -112,7 +110,16 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnOut;
|
||||
|
||||
/// <summary>
|
||||
/// lblPageIndex 控件。
|
||||
/// </summary>
|
||||
@@ -121,7 +128,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblPageIndex;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Label2 控件。
|
||||
/// </summary>
|
||||
@@ -130,7 +137,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label Label2;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Label3 控件。
|
||||
/// </summary>
|
||||
@@ -139,7 +146,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label Label3;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtStatus 控件。
|
||||
/// </summary>
|
||||
@@ -148,7 +155,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label txtStatus;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// lbtnFileUrl 控件。
|
||||
/// </summary>
|
||||
@@ -157,7 +164,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.LinkButton lbtnFileUrl;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarText1 控件。
|
||||
/// </summary>
|
||||
@@ -166,7 +173,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarText ToolbarText1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ddlPageSize 控件。
|
||||
/// </summary>
|
||||
@@ -175,7 +182,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList ddlPageSize;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Window1 控件。
|
||||
/// </summary>
|
||||
@@ -184,7 +191,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Window2 控件。
|
||||
/// </summary>
|
||||
@@ -193,7 +200,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window2;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// WindowAtt 控件。
|
||||
/// </summary>
|
||||
@@ -202,7 +209,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window WindowAtt;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Menu1 控件。
|
||||
/// </summary>
|
||||
@@ -211,7 +218,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Menu Menu1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuModify 控件。
|
||||
/// </summary>
|
||||
@@ -220,7 +227,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.MenuButton btnMenuModify;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuDel 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
&& x.SuperUnitWork == null
|
||||
select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
string row0 = pds.Rows[i][0].ToString();
|
||||
if (string.IsNullOrEmpty(row0))
|
||||
@@ -215,9 +215,16 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
}
|
||||
|
||||
string row5 = pds.Rows[i][5].ToString();
|
||||
if (string.IsNullOrEmpty(row5))
|
||||
if (!string.IsNullOrEmpty(row5))
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "标识编号" + "," + "此项为必填项!" + "|";
|
||||
try
|
||||
{
|
||||
Int32 date = Convert.ToInt32(row5.Trim());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "页数" + "," + "[" + row5 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
|
||||
string row6 = pds.Rows[i][6].ToString();
|
||||
@@ -225,11 +232,11 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
try
|
||||
{
|
||||
Int32 date = Convert.ToInt32(row6.Trim());
|
||||
DateTime date = Convert.ToDateTime(row6.Trim());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "页数" + "," + "[" + row6 + "]错误!" + "|";
|
||||
result += (i + 2).ToString() + "," + "接收日期" + "," + "[" + row6 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,27 +249,14 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "接收日期" + "," + "[" + row7 + "]错误!" + "|";
|
||||
result += (i + 2).ToString() + "," + "发送日期" + "," + "[" + row7 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
|
||||
string row8 = pds.Rows[i][8].ToString();
|
||||
if (!string.IsNullOrEmpty(row8))
|
||||
{
|
||||
try
|
||||
{
|
||||
DateTime date = Convert.ToDateTime(row8.Trim());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "发送日期" + "," + "[" + row8 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
|
||||
string row9 = pds.Rows[i][9].ToString();
|
||||
if (!string.IsNullOrEmpty(row9))
|
||||
{
|
||||
string[] reunit = row9.Split(',');
|
||||
string[] reunit = row8.Split(',');
|
||||
foreach (string unit in reunit)
|
||||
{
|
||||
var u = units.Where(x => x.UnitName == unit.Trim()).FirstOrDefault();
|
||||
@@ -272,6 +266,23 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string row11 = pds.Rows[i][11].ToString();
|
||||
if (string.IsNullOrEmpty(row11))
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "标识编号" + "," + "此项为必填项!" + "|";
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
int t = Convert.ToInt32(row11);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "标识编号" + "," + "[" + row11 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(result))
|
||||
{
|
||||
@@ -421,12 +432,12 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
&& x.SuperUnitWork == null
|
||||
select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
Model.Comprehensive_DesignDrawings oldViewInfo = new Model.Comprehensive_DesignDrawings();
|
||||
string row0 = pds.Rows[i][0].ToString().Trim();
|
||||
var cn = cns.Where(y => y.ProfessionalName == row0).FirstOrDefault();
|
||||
oldViewInfo = oldViewInfos.Where(x => x.RemarkCode == pds.Rows[i][5].ToString().Trim()
|
||||
oldViewInfo = oldViewInfos.Where(x => x.RemarkCode ==Funs.GetNewInt(pds.Rows[i][11].ToString().Trim())
|
||||
).FirstOrDefault();
|
||||
if (oldViewInfo == null)
|
||||
{
|
||||
@@ -441,25 +452,25 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
}
|
||||
des.DesignDrawingsContent = pds.Rows[i][3].ToString().Trim();//图纸内容
|
||||
des.Edition = pds.Rows[i][4].ToString().Trim();//版次
|
||||
des.RemarkCode = pds.Rows[i][5].ToString().Trim();//标志编号
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][5].ToString().Trim()))
|
||||
{
|
||||
des.PageNumber = Convert.ToInt32(pds.Rows[i][5].ToString().Trim());//页数
|
||||
}
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][6].ToString().Trim()))
|
||||
{
|
||||
des.PageNumber = Convert.ToInt32(pds.Rows[i][6].ToString().Trim());//页数
|
||||
des.ReceiveDate = Convert.ToDateTime(pds.Rows[i][6].ToString().Trim());//接收日期
|
||||
}
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][7].ToString().Trim()))
|
||||
{
|
||||
des.ReceiveDate = Convert.ToDateTime(pds.Rows[i][7].ToString().Trim());//接收日期
|
||||
des.SendDate = Convert.ToDateTime(pds.Rows[i][7].ToString().Trim());//发送日期
|
||||
}
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][8].ToString().Trim()))
|
||||
{
|
||||
des.SendDate = Convert.ToDateTime(pds.Rows[i][8].ToString().Trim());//发送日期
|
||||
des.ReceiveUnits = UnitService.GetUnitIds(pds.Rows[i][8].ToString().Trim());//接收单位
|
||||
}
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][9].ToString().Trim()))
|
||||
{
|
||||
des.ReceiveUnits = UnitService.GetUnitIds(pds.Rows[i][9].ToString().Trim());//接收单位
|
||||
}
|
||||
des.ReceiveMan = pds.Rows[i][10].ToString().Trim(); //接收人
|
||||
des.Remark = pds.Rows[i][11].ToString().Trim();//备注
|
||||
des.ReceiveMan = pds.Rows[i][9].ToString().Trim(); //接收人
|
||||
des.Remark = pds.Rows[i][10].ToString().Trim();//备注
|
||||
des.RemarkCode = Funs.GetNewInt(pds.Rows[i][11].ToString().Trim());//标志编号
|
||||
des.Status = BLL.Const.Comprehensive_Compile;
|
||||
des.CompileMan = this.CurrUser.UserId;
|
||||
BLL.DesignDrawingsService.AddDesignDrawings(des);
|
||||
@@ -474,25 +485,25 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
}
|
||||
oldViewInfo.DesignDrawingsContent = pds.Rows[i][3].ToString().Trim();//图纸内容
|
||||
oldViewInfo.Edition = pds.Rows[i][4].ToString().Trim();//版次
|
||||
oldViewInfo.RemarkCode = pds.Rows[i][5].ToString().Trim();//标志编号
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][5].ToString().Trim()))
|
||||
{
|
||||
oldViewInfo.PageNumber = Convert.ToInt32(pds.Rows[i][5].ToString().Trim());//页数
|
||||
}
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][6].ToString().Trim()))
|
||||
{
|
||||
oldViewInfo.PageNumber = Convert.ToInt32(pds.Rows[i][6].ToString().Trim());//页数
|
||||
oldViewInfo.ReceiveDate = Convert.ToDateTime(pds.Rows[i][6].ToString().Trim());//接收日期
|
||||
}
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][7].ToString().Trim()))
|
||||
{
|
||||
oldViewInfo.ReceiveDate = Convert.ToDateTime(pds.Rows[i][7].ToString().Trim());//接收日期
|
||||
oldViewInfo.SendDate = Convert.ToDateTime(pds.Rows[i][7].ToString().Trim());//发送日期
|
||||
}
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][8].ToString().Trim()))
|
||||
{
|
||||
oldViewInfo.SendDate = Convert.ToDateTime(pds.Rows[i][8].ToString().Trim());//发送日期
|
||||
oldViewInfo.ReceiveUnits = UnitService.GetUnitIds(pds.Rows[i][8].ToString().Trim());//接收单位
|
||||
}
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][9].ToString().Trim()))
|
||||
{
|
||||
oldViewInfo.ReceiveUnits = UnitService.GetUnitIds(pds.Rows[i][9].ToString().Trim());//接收单位
|
||||
}
|
||||
oldViewInfo.ReceiveMan = pds.Rows[i][10].ToString().Trim(); //接收人
|
||||
oldViewInfo.Remark = pds.Rows[i][11].ToString().Trim();//备注
|
||||
oldViewInfo.ReceiveMan = pds.Rows[i][9].ToString().Trim(); //接收人
|
||||
oldViewInfo.Remark = pds.Rows[i][10].ToString().Trim();//备注
|
||||
oldViewInfo.RemarkCode = Funs.GetNewInt(pds.Rows[i][11].ToString().Trim());//标志编号
|
||||
oldViewInfo.CompileMan = this.CurrUser.UserId;
|
||||
oldViewInfo.Status = BLL.Const.Comprehensive_Compile;
|
||||
BLL.DesignDrawingsService.UpdateDesignDrawings(oldViewInfo);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:TextBox ID="txtRemarkCode" runat="server" Label="标识编号" MaxLength="50" LabelAlign="Right" LabelWidth="130px"></f:TextBox>
|
||||
<f:TextBox ID="txtRemarkCode" runat="server" Label="标识编号" MaxLength="50" LabelAlign="Right" LabelWidth="130px" Required="true" ShowRedStar="true"></f:TextBox>
|
||||
<f:NumberBox ID="txtPageNumber" Label="页数" runat="server" NoDecimal="true" LabelAlign="Right" LabelWidth="130px" NoNegative="true">
|
||||
</f:NumberBox>
|
||||
</Items>
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
}
|
||||
this.txtReceiveMan.Text = designDrawings.ReceiveMan;
|
||||
this.txtRemark.Text = designDrawings.Remark;
|
||||
this.txtRemarkCode.Text = designDrawings.RemarkCode;
|
||||
this.txtRemarkCode.Text = designDrawings.RemarkCode.HasValue ? designDrawings.RemarkCode.ToString() : "";
|
||||
|
||||
|
||||
var currApprove = DesignDrawingsApproveService.GetCurrentApprove(designDrawings.DesignDrawingsId);
|
||||
@@ -171,6 +171,12 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var q = Funs.DB.Comprehensive_DesignDrawings.FirstOrDefault(x => x.RemarkCode == Funs.GetNewInt(this.txtRemarkCode.Text.Trim()) && (x.DesignDrawingsId != this.DesignDrawingsId || (this.DesignDrawingsId == null && x.DesignDrawingsId != null)));
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("标志编号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
Model.Comprehensive_DesignDrawings designDrawings = new Model.Comprehensive_DesignDrawings();
|
||||
designDrawings.ProjectId = this.CurrUser.LoginProjectId;
|
||||
@@ -184,7 +190,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
designDrawings.ReceiveMan = this.txtReceiveMan.Text.Trim();
|
||||
designDrawings.Remark = this.txtRemark.Text.Trim();
|
||||
designDrawings.CompileMan = this.CurrUser.UserId;
|
||||
designDrawings.RemarkCode = this.txtRemarkCode.Text.Trim();
|
||||
designDrawings.RemarkCode = Funs.GetNewInt(this.txtRemarkCode.Text.Trim());
|
||||
if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue))
|
||||
{
|
||||
designDrawings.AuditMan = drpAudit.SelectedValue;
|
||||
@@ -251,6 +257,12 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var q = Funs.DB.Comprehensive_DesignDrawings.FirstOrDefault(x => x.RemarkCode == Funs.GetNewInt(this.txtRemarkCode.Text.Trim()) && (x.DesignDrawingsId != this.DesignDrawingsId || (this.DesignDrawingsId == null && x.DesignDrawingsId != null)));
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("标志编号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
Model.Comprehensive_DesignDrawings designDrawings = new Model.Comprehensive_DesignDrawings();
|
||||
designDrawings.ProjectId = this.CurrUser.LoginProjectId;
|
||||
designDrawings.CNProfessionalId = this.drpCNProfessionalId.SelectedValue;
|
||||
@@ -263,7 +275,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
designDrawings.ReceiveMan = this.txtReceiveMan.Text.Trim();
|
||||
designDrawings.Remark = this.txtRemark.Text.Trim();
|
||||
designDrawings.CompileMan = this.CurrUser.UserId;
|
||||
designDrawings.RemarkCode = this.txtRemarkCode.Text.Trim();
|
||||
designDrawings.RemarkCode =Funs.GetNewInt(this.txtRemarkCode.Text.Trim());
|
||||
if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue))
|
||||
{
|
||||
designDrawings.AuditMan = drpAudit.SelectedValue;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="施工组织设计及施工方案" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="GeneralPlanApprovalId" AllowCellEditing="true" EnableColumnLines="true"
|
||||
ClicksToEdit="2" DataIDField="GeneralPlanApprovalId" AllowSorting="true" SortField="PlanCode"
|
||||
ClicksToEdit="2" DataIDField="GeneralPlanApprovalId" AllowSorting="true" SortField="RemarkCode"
|
||||
SortDirection="DESC" OnSort="Grid1_Sort"
|
||||
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="true">
|
||||
@@ -34,6 +34,9 @@
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" ToolTip="导入" Icon="PackageIn" runat="server" OnClick="btnImport_Click" Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
|
||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.Comprehensive
|
||||
@@ -33,7 +34,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
{
|
||||
string strSql = @"select GeneralPlanApprovalId, ProjectId, C.UnitId,PlanCode,C.CNProfessionalId,
|
||||
PlanName, ApprovalDate, AuditMan, ApprovalMan, ImplementationDeviation,CompileMan,
|
||||
CompileDate, UnitWorkId,CN.ProfessionalName,u.UnitName
|
||||
CompileDate, UnitWorkId,CN.ProfessionalName,u.UnitName,C.RemarkCode
|
||||
from Comprehensive_GeneralPlanApproval C
|
||||
left join Base_CNProfessional CN on C.CNProfessionalId=CN.CNProfessionalId
|
||||
left join Base_Unit u on u.UnitId = c.UnitId
|
||||
@@ -271,5 +272,161 @@ namespace FineUIPro.Web.Comprehensive
|
||||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("GeneralPlanApprovalDataIn.aspx", "导入 - ")));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 导出按钮
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = Const.GeneralPlanApprovalTemplateUrl;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
|
||||
var lists = (from x in Funs.DB.Comprehensive_GeneralPlanApproval
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x);
|
||||
if (sdrpUnitId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
lists = lists.Where(x => x.UnitId == sdrpUnitId.SelectedValue);
|
||||
}
|
||||
if (this.drpProfessionalId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
lists = lists.Where(x => x.CNProfessionalId == drpProfessionalId.SelectedValue);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtPlanName.Text.Trim()))
|
||||
{
|
||||
lists = lists.Where(x => x.PlanName.Contains(this.txtPlanName.Text.Trim()));
|
||||
}
|
||||
lists = lists.OrderBy(x => x.RemarkCode);
|
||||
if (lists != null)
|
||||
{
|
||||
string projectName = BLL.ProjectService.GetShortNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
newUrl = uploadfilepath.Replace("施工组织设计及施工方案导入模板", "施工组织设计及施工方案(" + projectName + DateTime.Now.ToString("yyyyMMdd") + ")");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
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);
|
||||
}
|
||||
// 创建单元格样式
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
|
||||
cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font = workbook.CreateFont();
|
||||
font.FontHeightInPoints = 11;
|
||||
cellStyle.SetFont(font);
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle0 = workbook.CreateCellStyle();
|
||||
cellStyle0.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle0.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font0 = workbook.CreateFont();
|
||||
font0.FontHeightInPoints = 12;
|
||||
font0.IsBold = true;
|
||||
cellStyle0.SetFont(font0);
|
||||
// 第二步:创建新数据行
|
||||
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
|
||||
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
|
||||
NPOI.SS.UserModel.ICell cell;
|
||||
int i = 2;
|
||||
foreach (var item in lists)
|
||||
{
|
||||
// 第二步:创建新数据行
|
||||
row = sheet.CreateRow(i);
|
||||
// 添加数据
|
||||
cell = row.CreateCell(0);
|
||||
cell.CellStyle = cellStyle;
|
||||
string unitName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.UnitId))
|
||||
{
|
||||
unitName = BLL.UnitService.GetUnitNameByUnitId(item.UnitId);
|
||||
}
|
||||
cell.SetCellValue(unitName);//报批单位
|
||||
|
||||
cell = row.CreateCell(1);
|
||||
cell.CellStyle = cellStyle;
|
||||
string proName = string.Empty;
|
||||
var cnp = BLL.CNProfessionalService.GetCNProfessional(item.CNProfessionalId);
|
||||
if (cnp != null)
|
||||
{
|
||||
proName = cnp.ProfessionalName;
|
||||
}
|
||||
cell.SetCellValue(proName);//专业
|
||||
|
||||
cell = row.CreateCell(2);
|
||||
cell.CellStyle = cellStyle;
|
||||
string unitWorkName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.UnitWorkId))
|
||||
{
|
||||
unitWorkName = ConvertUnitWork(item.UnitWorkId);
|
||||
}
|
||||
cell.SetCellValue(unitWorkName);//单位工程
|
||||
|
||||
cell = row.CreateCell(3);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.PlanCode);//编号
|
||||
|
||||
cell = row.CreateCell(4);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.PlanName);//方案名称
|
||||
|
||||
cell = row.CreateCell(5);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ApprovalDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.ApprovalDate) : "");//审批日期
|
||||
|
||||
cell = row.CreateCell(6);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.AuditMan);//审核人
|
||||
|
||||
cell = row.CreateCell(7);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ApprovalMan);//批准人
|
||||
|
||||
cell = row.CreateCell(8);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ImplementationDeviation);//施工总结
|
||||
|
||||
cell = row.CreateCell(9);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.RemarkCode.HasValue ? item.RemarkCode.ToString() : "");//标志编号
|
||||
|
||||
i++;
|
||||
}
|
||||
// 第三步:写入文件流
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
workbook.Write(stream);
|
||||
workbook.Close();
|
||||
}
|
||||
string fileName = Path.GetFileName(newUrl);
|
||||
FileInfo info = new FileInfo(newUrl);
|
||||
long fileSize = info.Length;
|
||||
Response.Clear();
|
||||
Response.ContentType = "application/x-zip-compressed";
|
||||
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
Response.TransmitFile(newUrl, 0, fileSize);
|
||||
Response.Flush();
|
||||
Response.Close();
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("当前无记录,无法导出!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -111,6 +111,15 @@ namespace FineUIPro.Web.Comprehensive {
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnOut;
|
||||
|
||||
/// <summary>
|
||||
/// lblPageIndex 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
&& x.SuperUnitWork == null
|
||||
select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
string row0 = pds.Rows[i][0].ToString();
|
||||
if (string.IsNullOrEmpty(row0))
|
||||
@@ -246,6 +246,17 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "标志编号" + "," + "此项为必填项!" + "|";
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
int t = Convert.ToInt32(row9);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "标志编号" + "," + "[" + row9 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(result))
|
||||
{
|
||||
@@ -395,13 +406,13 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
&& x.SuperUnitWork == null
|
||||
select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
Model.Comprehensive_GeneralPlanApproval oldViewInfo = new Model.Comprehensive_GeneralPlanApproval();
|
||||
string row0 = pds.Rows[i][0].ToString().Trim();
|
||||
string row1 = pds.Rows[i][1].ToString().Trim();
|
||||
var cn = cns.Where(y => y.ProfessionalName == row1).FirstOrDefault();
|
||||
oldViewInfo = oldViewInfos.Where(x => x.RemarkCode == pds.Rows[i][9].ToString().Trim()
|
||||
oldViewInfo = oldViewInfos.Where(x => x.RemarkCode == Funs.GetNewInt(pds.Rows[i][9].ToString().Trim())
|
||||
).FirstOrDefault();
|
||||
if (oldViewInfo == null)
|
||||
{
|
||||
@@ -419,8 +430,8 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
des.ApprovalDate = Funs.GetNewDateTime(pds.Rows[i][5].ToString().Trim());
|
||||
des.AuditMan = pds.Rows[i][6].ToString().Trim();
|
||||
des.ApprovalMan = pds.Rows[i][7].ToString().Trim();
|
||||
des.ImplementationDeviation = pds.Rows[i][8].ToString().Trim();
|
||||
des.RemarkCode = pds.Rows[i][9].ToString().Trim();
|
||||
des.ImplementationDeviation = pds.Rows[i][8].ToString().Trim();
|
||||
des.RemarkCode = Funs.GetNewInt(pds.Rows[i][9].ToString().Trim());
|
||||
des.CompileMan = this.CurrUser.UserId;
|
||||
des.CompileDate = DateTime.Now;
|
||||
BLL.GeneralPlanApprovalService.AddGeneralPlanApproval(des);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<Items>
|
||||
<f:DropDownList ID="drpUnitId" runat="server" Label="报批单位" Required="true" ShowRedStar="true" LabelWidth="130px">
|
||||
</f:DropDownList>
|
||||
<f:DropDownList ID="drpCNProfessionalId" runat="server" Label="专业" LabelWidth="130px"></f:DropDownList>
|
||||
<f:DropDownList ID="drpCNProfessionalId" runat="server" Label="专业" LabelWidth="130px" Required="true" ShowRedStar="true"></f:DropDownList>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
@@ -55,6 +55,7 @@
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
<f:NumberBox ID="txtRemarkCode" runat="server" Label="标志编号" LabelAlign="Right" LabelWidth="130px" Required="true" ShowRedStar="true" NoDecimal="true" NoNegative="true"></f:NumberBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
</Rows>
|
||||
|
||||
@@ -64,6 +64,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
this.txtAuditMan.Text = generalPlanApproval.AuditMan;
|
||||
this.txtApprovalMan.Text = generalPlanApproval.ApprovalMan;
|
||||
this.txtImplementationDeviation.Text = generalPlanApproval.ImplementationDeviation;
|
||||
this.txtRemarkCode.Text = generalPlanApproval.RemarkCode.HasValue ? generalPlanApproval.RemarkCode.ToString() : "";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -90,6 +91,12 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var q = Funs.DB.Comprehensive_GeneralPlanApproval.FirstOrDefault(x => x.RemarkCode == Funs.GetNewInt(this.txtRemarkCode.Text.Trim()) && (x.GeneralPlanApprovalId != this.GeneralPlanApprovalId || (this.GeneralPlanApprovalId == null && x.GeneralPlanApprovalId != null)));
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("标志编号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
Model.Comprehensive_GeneralPlanApproval generalPlanApproval = new Model.Comprehensive_GeneralPlanApproval();
|
||||
generalPlanApproval.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (this.drpUnitId.SelectedValue != BLL.Const._Null)
|
||||
@@ -120,6 +127,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
ids = ids.Substring(0, ids.LastIndexOf(","));
|
||||
}
|
||||
generalPlanApproval.UnitWorkId = ids;
|
||||
generalPlanApproval.RemarkCode = Funs.GetNewInt(this.txtRemarkCode.Text.Trim());
|
||||
if (string.IsNullOrEmpty(this.GeneralPlanApprovalId))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.hdAttachUrl.Text))
|
||||
|
||||
+9
@@ -147,6 +147,15 @@ namespace FineUIPro.Web.CQMS.Comprehensive {
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnAttach;
|
||||
|
||||
/// <summary>
|
||||
/// txtRemarkCode 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox txtRemarkCode;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar1 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -309,7 +309,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
lists = lists.OrderBy(x => x.RemarkCode);
|
||||
if (lists != null)
|
||||
{
|
||||
var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
var projectName = BLL.ProjectService.GetShortNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
newUrl = uploadfilepath.Replace("设备材料报验导入模板", "设备材料报验(" + projectName + "" + DateTime.Now.ToString("yyyyMMdd") + ")");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" EnableAjax="false" ShowHeader="false" Title="机具报验" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="InspectionMachineId" AllowCellEditing="true" ClicksToEdit="2" DataIDField="InspectionMachineId" AllowSorting="true" SortField="InspectionMachineCode"
|
||||
runat="server" BoxFlex="1" DataKeyNames="InspectionMachineId" AllowCellEditing="true" ClicksToEdit="2" DataIDField="InspectionMachineId" AllowSorting="true" SortField="RemarkCode"
|
||||
SortDirection="DESC" EnableColumnLines="true" ForceFit="true" AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnRowDataBound="Grid1_RowDataBound"
|
||||
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True">
|
||||
<Toolbars>
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
{
|
||||
string strSql = @"select InspectionMachineId, InspectionMachineCode, U.UnitName,CN.ProfessionalName ,Status,
|
||||
InspectionMachineName, SpecificationModel, NextTestDate, TestCycle, C.InspectionDate,
|
||||
InspectionDate CompileDate, (CASE WHEN IsVerification=1 THEN '是' WHEN IsVerification=0 THEN '否' ELSE '' END) AS IsVerification, InspectionType, LeaveDate, UnitsCount
|
||||
InspectionDate CompileDate, (CASE WHEN IsVerification=1 THEN '是' WHEN IsVerification=0 THEN '否' ELSE '' END) AS IsVerification, InspectionType, LeaveDate, UnitsCount,C.RemarkCode
|
||||
from Comprehensive_InspectionMachine C
|
||||
left join Base_Unit U on C.UnitId=U.UnitId
|
||||
left join Base_CNProfessional CN on C.CNProfessionalId=CN.CNProfessionalId
|
||||
@@ -328,7 +328,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
lists = lists.OrderBy(x => x.RemarkCode);
|
||||
if (lists != null)
|
||||
{
|
||||
string projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
string projectName = BLL.ProjectService.GetShortNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
newUrl = uploadfilepath.Replace("机具报验导入模板", "机具报验("+ projectName+DateTime.Now.ToString("yyyyMMdd")+ ")");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="人员报验" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="InspectionPersonId" AllowCellEditing="true" EnableColumnLines="true"
|
||||
ClicksToEdit="2" DataIDField="InspectionPersonId" AllowSorting="true" SortField="InspectionPersonCode"
|
||||
ClicksToEdit="2" DataIDField="InspectionPersonId" AllowSorting="true" SortField="RemarkCode"
|
||||
SortDirection="DESC" OnSort="Grid1_Sort" OnRowCommand="Grid1_RowCommand"
|
||||
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange" OnRowDataBound="Grid1_RowDataBound"
|
||||
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="true" OnPreRowDataBound="Grid1_PreRowDataBound">
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
string strSql = @"select InspectionPersonId, InspectionPersonCode, PersonName, Status,
|
||||
CertificateNumber, QualifiedProjectCode, ValidityDate, ApprovalTime,
|
||||
DepartureTime, AttachUrl,CompileMan, CompileDate,
|
||||
IsOnSite, UnitWorkId,U.UnitName,CN.ProfessionalName ,P.PostName
|
||||
IsOnSite, UnitWorkId,U.UnitName,CN.ProfessionalName ,P.PostName,C.RemarkCode
|
||||
from Comprehensive_InspectionPerson C
|
||||
left join Base_Unit U on C.UnitId=U.UnitId
|
||||
left join Base_CNProfessional CN on C.CNProfessionalId=CN.CNProfessionalId
|
||||
@@ -395,7 +395,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
lists = lists.OrderBy(x => x.RemarkCode);
|
||||
if (lists != null)
|
||||
{
|
||||
string projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
string projectName = BLL.ProjectService.GetShortNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
newUrl = uploadfilepath.Replace("人员报验导入模板", "人员报验(" + projectName + DateTime.Now.ToString("yyyyMMdd") + ")");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="检验试验计划" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="Id" AllowCellEditing="true" EnableColumnLines="true"
|
||||
ClicksToEdit="2" DataIDField="Id" AllowSorting="true" SortField="PlanCode"
|
||||
ClicksToEdit="2" DataIDField="Id" AllowSorting="true" SortField="RemarkCode"
|
||||
SortDirection="DESC" OnSort="Grid1_Sort"
|
||||
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="true">
|
||||
@@ -35,6 +35,9 @@
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" ToolTip="导入" Hidden="true" Icon="PackageIn" runat="server" OnClick="btnImport_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
|
||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
@@ -31,7 +32,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// </summary>
|
||||
public void BindGrid()
|
||||
{
|
||||
string strSql = @"select C.*,CN.ProfessionalName,C.CNProfessionalId,C.UnitId,u.UnitName
|
||||
string strSql = @"select C.*,CN.ProfessionalName,C.CNProfessionalId,C.UnitId,u.UnitName,C.RemarkCode
|
||||
from Inspection_Test_Plan C
|
||||
left join Base_CNProfessional CN on C.CNProfessionalId=CN.CNProfessionalId
|
||||
left join Base_Unit as u on u.UnitId = C.UnitId
|
||||
@@ -237,5 +238,148 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("InspectionTestPlanDataIn.aspx", "导入 - ")));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 导出按钮
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = Const.InspectionTestPlanTemplateUrl;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
|
||||
var lists = (from x in Funs.DB.Inspection_Test_Plan
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x);
|
||||
if (sdrpUnitId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
lists = lists.Where(x => x.UnitId == sdrpUnitId.SelectedValue);
|
||||
}
|
||||
if (drpCNPr.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
lists = lists.Where(x => x.CNProfessionalId == drpCNPr.SelectedValue);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtPlanName.Text.Trim()))
|
||||
{
|
||||
lists = lists.Where(x => x.PlanName.Contains(this.txtPlanName.Text.Trim()));
|
||||
}
|
||||
lists = lists.OrderBy(x => x.RemarkCode);
|
||||
if (lists != null)
|
||||
{
|
||||
string projectName = BLL.ProjectService.GetShortNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
newUrl = uploadfilepath.Replace("检验试验计划导入模板.xls", "检验试验计划(" + projectName + DateTime.Now.ToString("yyyyMMdd") + ").xls");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
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);
|
||||
}
|
||||
// 创建单元格样式
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
|
||||
cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font = workbook.CreateFont();
|
||||
font.FontHeightInPoints = 11;
|
||||
cellStyle.SetFont(font);
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle0 = workbook.CreateCellStyle();
|
||||
cellStyle0.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle0.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font0 = workbook.CreateFont();
|
||||
font0.FontHeightInPoints = 12;
|
||||
font0.IsBold = true;
|
||||
cellStyle0.SetFont(font0);
|
||||
// 第二步:创建新数据行
|
||||
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
|
||||
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
|
||||
NPOI.SS.UserModel.ICell cell;
|
||||
int i = 2;
|
||||
foreach (var item in lists)
|
||||
{
|
||||
// 第二步:创建新数据行
|
||||
row = sheet.CreateRow(i);
|
||||
// 添加数据
|
||||
cell = row.CreateCell(0);
|
||||
cell.CellStyle = cellStyle;
|
||||
string unitName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.UnitId))
|
||||
{
|
||||
unitName = BLL.UnitService.GetUnitNameByUnitId(item.UnitId);
|
||||
}
|
||||
cell.SetCellValue(unitName);//报批单位
|
||||
|
||||
cell = row.CreateCell(1);
|
||||
cell.CellStyle = cellStyle;
|
||||
string proName = string.Empty;
|
||||
var cnp = BLL.CNProfessionalService.GetCNProfessional(item.CNProfessionalId);
|
||||
if (cnp != null)
|
||||
{
|
||||
proName = cnp.ProfessionalName;
|
||||
}
|
||||
cell.SetCellValue(proName);//专业
|
||||
|
||||
cell = row.CreateCell(2);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.PlanCode);//编号
|
||||
|
||||
cell = row.CreateCell(3);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.PlanName);//检验试验计划名称
|
||||
|
||||
cell = row.CreateCell(4);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ApprovalDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.ApprovalDate) : "");//审批日期
|
||||
|
||||
cell = row.CreateCell(5);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ApprovalMan);//审批人
|
||||
|
||||
cell = row.CreateCell(6);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.AuditMan);//审核人
|
||||
|
||||
cell = row.CreateCell(7);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.RemarkCode.HasValue ? item.RemarkCode.ToString() : "");//标志编号
|
||||
|
||||
i++;
|
||||
}
|
||||
// 第三步:写入文件流
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
workbook.Write(stream);
|
||||
workbook.Close();
|
||||
}
|
||||
string fileName = Path.GetFileName(newUrl);
|
||||
FileInfo info = new FileInfo(newUrl);
|
||||
long fileSize = info.Length;
|
||||
Response.Clear();
|
||||
Response.ContentType = "application/x-zip-compressed";
|
||||
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
Response.TransmitFile(newUrl, 0, fileSize);
|
||||
Response.Flush();
|
||||
Response.Close();
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("当前无记录,无法导出!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -111,6 +111,15 @@ namespace FineUIPro.Web.CQMS.Comprehensive {
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnOut;
|
||||
|
||||
/// <summary>
|
||||
/// lblPageIndex 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -170,7 +170,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
|
||||
var cns = from x in Funs.DB.Base_CNProfessional select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
string row0 = pds.Rows[i][0].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(row0))
|
||||
@@ -195,6 +195,10 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
result += (i + 2).ToString() + "," + "专业名称" + "," + "[" + row1 + "]不存在!" + "|";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "专业名称" + "," + "此项为必填项!" + "|";
|
||||
}
|
||||
|
||||
string row2 = pds.Rows[i][2].ToString();
|
||||
if (string.IsNullOrEmpty(row2))
|
||||
@@ -220,6 +224,17 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "标志编号" + "," + "此项为必填项!" + "|";
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
int t = Convert.ToInt32(row7);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "标志编号" + "," + "[" + row7 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(result))
|
||||
{
|
||||
@@ -363,9 +378,9 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
var oldViewInfos = from x in Funs.DB.Inspection_Test_Plan
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x;
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
var oldViewInfo = oldViewInfos.Where(x => x.RemarkCode == pds.Rows[i][7].ToString().Trim()).FirstOrDefault();
|
||||
var oldViewInfo = oldViewInfos.Where(x => x.RemarkCode == Funs.GetNewInt(pds.Rows[i][7].ToString().Trim())).FirstOrDefault();
|
||||
if (oldViewInfo == null)
|
||||
{
|
||||
Model.Inspection_Test_Plan Ins = new Model.Inspection_Test_Plan();
|
||||
@@ -384,7 +399,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
Ins.ApprovalDate = Funs.GetNewDateTime(pds.Rows[i][4].ToString().Trim());
|
||||
Ins.AuditMan = pds.Rows[i][5].ToString().Trim();
|
||||
Ins.ApprovalMan= pds.Rows[i][6].ToString().Trim();
|
||||
Ins.RemarkCode= pds.Rows[i][7].ToString().Trim();
|
||||
Ins.RemarkCode= Funs.GetNewInt(pds.Rows[i][7].ToString().Trim());
|
||||
Ins.CreateMan = this.CurrUser.UserId;
|
||||
Ins.CreateDate = DateTime.Now;
|
||||
BLL.InspectionTestPlanService.Insert(Ins);
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:TextBox ID="txtApprovalMan" runat="server" Label="审批人" MaxLength="50" LabelWidth="130px" LabelAlign="right"></f:TextBox>
|
||||
<f:Label ID="Label13" runat="server"></f:Label>
|
||||
<f:NumberBox ID="txtRemarkCode" runat="server" Label="标志编号" LabelAlign="Right" LabelWidth="130px" Required="true" ShowRedStar="true" NoDecimal="true" NoNegative="true"></f:NumberBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
this.txtAuditMan.Text = model.AuditMan;
|
||||
this.txtApprovalMan.Text = model.ApprovalMan;
|
||||
this.txtRemarks.Text = model.Remarks;
|
||||
this.txtRemarkCode.Text = model.RemarkCode.HasValue ? model.RemarkCode.ToString() : "";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -104,6 +105,12 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var q = Funs.DB.Inspection_Test_Plan.FirstOrDefault(x => x.RemarkCode == Funs.GetNewInt(this.txtRemarkCode.Text.Trim()) && (x.Id != this.Id || (this.Id == null && x.Id != null)));
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("标志编号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var majorPlanApproval = new Model.Inspection_Test_Plan();
|
||||
majorPlanApproval.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (this.drpUnitId.SelectedValue != BLL.Const._Null)
|
||||
@@ -124,7 +131,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
majorPlanApproval.AuditMan = this.txtAuditMan.Text.Trim();
|
||||
majorPlanApproval.ApprovalMan = this.txtApprovalMan.Text.Trim();
|
||||
majorPlanApproval.Remarks = this.txtRemarks.Text.Trim();
|
||||
|
||||
majorPlanApproval.RemarkCode = Funs.GetNewInt(this.txtRemarkCode.Text.Trim());
|
||||
|
||||
if (string.IsNullOrEmpty(this.Id))
|
||||
{
|
||||
|
||||
+25
-27
@@ -7,13 +7,11 @@
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
|
||||
|
||||
public partial class InspectionTestPlanEdit
|
||||
{
|
||||
|
||||
namespace FineUIPro.Web.CQMS.Comprehensive {
|
||||
|
||||
|
||||
public partial class InspectionTestPlanEdit {
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
@@ -22,7 +20,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
@@ -31,7 +29,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// SimpleForm1 控件。
|
||||
/// </summary>
|
||||
@@ -40,7 +38,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Form SimpleForm1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// drpUnitId 控件。
|
||||
/// </summary>
|
||||
@@ -49,7 +47,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpUnitId;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// drpCNProfessionalId 控件。
|
||||
/// </summary>
|
||||
@@ -58,7 +56,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpCNProfessionalId;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtPlanCode 控件。
|
||||
/// </summary>
|
||||
@@ -67,7 +65,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtPlanCode;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtPlanName 控件。
|
||||
/// </summary>
|
||||
@@ -76,7 +74,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtPlanName;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtApprovalDate 控件。
|
||||
/// </summary>
|
||||
@@ -85,7 +83,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DatePicker txtApprovalDate;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtAuditMan 控件。
|
||||
/// </summary>
|
||||
@@ -94,7 +92,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtAuditMan;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtApprovalMan 控件。
|
||||
/// </summary>
|
||||
@@ -103,16 +101,16 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtApprovalMan;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Label13 控件。
|
||||
/// txtRemarkCode 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Label Label13;
|
||||
|
||||
protected global::FineUIPro.NumberBox txtRemarkCode;
|
||||
|
||||
/// <summary>
|
||||
/// txtRemarks 控件。
|
||||
/// </summary>
|
||||
@@ -121,7 +119,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextArea txtRemarks;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Panel2 控件。
|
||||
/// </summary>
|
||||
@@ -130,7 +128,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel2;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Label1 控件。
|
||||
/// </summary>
|
||||
@@ -139,7 +137,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Label Label1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnAttach 控件。
|
||||
/// </summary>
|
||||
@@ -148,7 +146,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnAttach;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar1 控件。
|
||||
/// </summary>
|
||||
@@ -157,7 +155,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// hdAttachUrl 控件。
|
||||
/// </summary>
|
||||
@@ -166,7 +164,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.HiddenField hdAttachUrl;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnSave 控件。
|
||||
/// </summary>
|
||||
@@ -175,7 +173,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSave;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// WindowAtt 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="超过一定规模的危大施工方案" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="MajorPlanApprovalId" AllowCellEditing="true" EnableColumnLines="true"
|
||||
ClicksToEdit="2" DataIDField="MajorPlanApprovalId" AllowSorting="true" SortField="PlanCode"
|
||||
ClicksToEdit="2" DataIDField="MajorPlanApprovalId" AllowSorting="true" SortField="RemarkCode"
|
||||
SortDirection="DESC" OnSort="Grid1_Sort"
|
||||
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="true">
|
||||
@@ -34,6 +34,9 @@
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" ToolTip="导入" Icon="PackageIn" runat="server" OnClick="btnImport_Click" Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
|
||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.Comprehensive
|
||||
@@ -34,7 +35,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
string strSql = @"select MajorPlanApprovalId, ProjectId, PlanCode, PlanName, ReviewMan, ApprovalDate,
|
||||
AuditMan, ApprovalMan, ImplementationDeviation, AttachUrl, CompileMan, CompileDate,
|
||||
UnitWorkId,CN.ProfessionalName,C.CNProfessionalId,C.UnitId,u.UnitName ,
|
||||
case IsReview when 1 then '是' else '否' end as IsReview
|
||||
case IsReview when 1 then '是' else '否' end as IsReview,C.RemarkCode
|
||||
from Comprehensive_MajorPlanApproval C
|
||||
left join Base_CNProfessional CN on C.CNProfessionalId=CN.CNProfessionalId
|
||||
left join Base_Unit as u on u.UnitId = C.UnitId
|
||||
@@ -272,5 +273,169 @@ namespace FineUIPro.Web.Comprehensive
|
||||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("MajorPlanApprovalDataIn.aspx", "导入 - ")));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 导出按钮
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = Const.MajorPlanApprovalTemplateUrl;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
|
||||
var lists = (from x in Funs.DB.Comprehensive_MajorPlanApproval
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x);
|
||||
if (sdrpUnitId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
lists = lists.Where(x => x.UnitId == sdrpUnitId.SelectedValue);
|
||||
}
|
||||
if (drpCNPr.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
lists = lists.Where(x => x.CNProfessionalId == drpCNPr.SelectedValue);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtPlanName.Text.Trim()))
|
||||
{
|
||||
lists = lists.Where(x => x.PlanName.Contains(this.txtPlanName.Text.Trim()));
|
||||
}
|
||||
lists = lists.OrderBy(x => x.RemarkCode);
|
||||
if (lists != null)
|
||||
{
|
||||
string projectName = BLL.ProjectService.GetShortNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
newUrl = uploadfilepath.Replace("超过一定规模的危大施工方案导入模板", "超过一定规模的危大施工方案(" + projectName + DateTime.Now.ToString("yyyyMMdd") + ")");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
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);
|
||||
}
|
||||
// 创建单元格样式
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
|
||||
cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font = workbook.CreateFont();
|
||||
font.FontHeightInPoints = 11;
|
||||
cellStyle.SetFont(font);
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle0 = workbook.CreateCellStyle();
|
||||
cellStyle0.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle0.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font0 = workbook.CreateFont();
|
||||
font0.FontHeightInPoints = 12;
|
||||
font0.IsBold = true;
|
||||
cellStyle0.SetFont(font0);
|
||||
// 第二步:创建新数据行
|
||||
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
|
||||
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
|
||||
NPOI.SS.UserModel.ICell cell;
|
||||
int i = 2;
|
||||
foreach (var item in lists)
|
||||
{
|
||||
// 第二步:创建新数据行
|
||||
row = sheet.CreateRow(i);
|
||||
// 添加数据
|
||||
cell = row.CreateCell(0);
|
||||
cell.CellStyle = cellStyle;
|
||||
string unitName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.UnitId))
|
||||
{
|
||||
unitName = BLL.UnitService.GetUnitNameByUnitId(item.UnitId);
|
||||
}
|
||||
cell.SetCellValue(unitName);//报批单位
|
||||
|
||||
cell = row.CreateCell(1);
|
||||
cell.CellStyle = cellStyle;
|
||||
string proName = string.Empty;
|
||||
var cnp = BLL.CNProfessionalService.GetCNProfessional(item.CNProfessionalId);
|
||||
if (cnp != null)
|
||||
{
|
||||
proName = cnp.ProfessionalName;
|
||||
}
|
||||
cell.SetCellValue(proName);//专业
|
||||
|
||||
cell = row.CreateCell(2);
|
||||
cell.CellStyle = cellStyle;
|
||||
string unitWorkName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.UnitWorkId))
|
||||
{
|
||||
unitWorkName = ConvertUnitWork(item.UnitWorkId);
|
||||
}
|
||||
cell.SetCellValue(unitWorkName);//单位工程
|
||||
|
||||
cell = row.CreateCell(3);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.PlanCode);//编号
|
||||
|
||||
cell = row.CreateCell(4);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.PlanName);//方案名称
|
||||
|
||||
cell = row.CreateCell(5);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ReviewMan);//评审人员
|
||||
|
||||
cell = row.CreateCell(6);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ApprovalDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.ApprovalDate) : "");//审批日期
|
||||
|
||||
cell = row.CreateCell(7);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.AuditMan);//审核人
|
||||
|
||||
cell = row.CreateCell(8);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ApprovalMan);//批准人
|
||||
|
||||
cell = row.CreateCell(9);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ExpertReviewMan);//专家评审人员
|
||||
|
||||
cell = row.CreateCell(10);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.IsReview == true ? "是" : "否");//是否通过专家评审
|
||||
|
||||
cell = row.CreateCell(11);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.RemarkCode.HasValue ? item.RemarkCode.ToString() : "");//标志编号
|
||||
|
||||
i++;
|
||||
}
|
||||
// 第三步:写入文件流
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
workbook.Write(stream);
|
||||
workbook.Close();
|
||||
}
|
||||
string fileName = Path.GetFileName(newUrl);
|
||||
FileInfo info = new FileInfo(newUrl);
|
||||
long fileSize = info.Length;
|
||||
Response.Clear();
|
||||
Response.ContentType = "application/x-zip-compressed";
|
||||
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
Response.TransmitFile(newUrl, 0, fileSize);
|
||||
Response.Flush();
|
||||
Response.Close();
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("当前无记录,无法导出!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -111,6 +111,15 @@ namespace FineUIPro.Web.Comprehensive {
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnOut;
|
||||
|
||||
/// <summary>
|
||||
/// lblPageIndex 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
&& x.SuperUnitWork == null
|
||||
select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
string row0 = pds.Rows[i][0].ToString();
|
||||
if (string.IsNullOrEmpty(row0))
|
||||
@@ -400,13 +400,13 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
&& x.SuperUnitWork == null
|
||||
select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
Model.Comprehensive_MajorPlanApproval oldViewInfo = new Model.Comprehensive_MajorPlanApproval();
|
||||
string row0 = pds.Rows[i][0].ToString().Trim();
|
||||
string row1 = pds.Rows[i][1].ToString().Trim();
|
||||
var cn = cns.Where(y => y.ProfessionalName == row1).FirstOrDefault();
|
||||
oldViewInfo = oldViewInfos.Where(x => x.RemarkCode == pds.Rows[i][11].ToString().Trim()
|
||||
oldViewInfo = oldViewInfos.Where(x => x.RemarkCode == Funs.GetNewInt(pds.Rows[i][11].ToString().Trim())
|
||||
).FirstOrDefault();
|
||||
if (oldViewInfo == null)
|
||||
{
|
||||
@@ -427,7 +427,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
des.ApprovalMan = pds.Rows[i][8].ToString().Trim();
|
||||
des.ExpertReviewMan = pds.Rows[i][9].ToString().Trim();
|
||||
des.IsReview = pds.Rows[i][10].ToString().Trim() == "是" ? true : false;
|
||||
des.RemarkCode = pds.Rows[i][11].ToString().Trim();
|
||||
des.RemarkCode = Funs.GetNewInt(pds.Rows[i][11].ToString().Trim());
|
||||
des.CompileMan = this.CurrUser.UserId;
|
||||
des.CompileDate = DateTime.Now;
|
||||
BLL.MajorPlanApprovalService.AddMajorPlanApproval(des);
|
||||
|
||||
@@ -53,8 +53,8 @@
|
||||
<f:RadioItem Text="是" Value="true" Selected="true" />
|
||||
<f:RadioItem Text="否" Value="false" />
|
||||
</f:RadioButtonList>
|
||||
|
||||
<f:Label Hidden="true" runat="server"></f:Label>
|
||||
<f:NumberBox ID="txtRemarkCode" runat="server" Label="标志编号" LabelAlign="Right" LabelWidth="130px" Required="true" ShowRedStar="true" NoDecimal="true" NoNegative="true"></f:NumberBox>
|
||||
<%--<f:Label Hidden="true" runat="server"></f:Label>--%>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
this.txtApprovalMan.Text = majorPlanApproval.ApprovalMan;
|
||||
//this.txtImplementationDeviation.Text = majorPlanApproval.ImplementationDeviation;
|
||||
this.txtExpertReviewMan.Text = majorPlanApproval.ExpertReviewMan;
|
||||
|
||||
this.txtRemarkCode.Text = majorPlanApproval.RemarkCode.HasValue ? majorPlanApproval.RemarkCode.ToString() : "";
|
||||
this.rblIsReview.SelectedValue = majorPlanApproval.IsReview.HasValue && majorPlanApproval.IsReview == true ? "true" : "false";
|
||||
}
|
||||
else
|
||||
@@ -90,6 +90,12 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var q = Funs.DB.Comprehensive_MajorPlanApproval.FirstOrDefault(x => x.RemarkCode == Funs.GetNewInt(this.txtRemarkCode.Text.Trim()) && (x.MajorPlanApprovalId != this.MajorPlanApprovalId || (this.MajorPlanApprovalId == null && x.MajorPlanApprovalId != null)));
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("标志编号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
Model.Comprehensive_MajorPlanApproval majorPlanApproval = new Model.Comprehensive_MajorPlanApproval();
|
||||
majorPlanApproval.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (this.drpUnitId.SelectedValue != BLL.Const._Null)
|
||||
@@ -131,7 +137,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
majorPlanApproval.IsReview = false;
|
||||
}
|
||||
|
||||
majorPlanApproval.RemarkCode = Funs.GetNewInt(this.txtRemarkCode.Text.Trim());
|
||||
if (string.IsNullOrEmpty(this.MajorPlanApprovalId))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.hdAttachUrl.Text))
|
||||
|
||||
+34
-27
@@ -7,13 +7,11 @@
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
|
||||
|
||||
public partial class MajorPlanApprovalEdit
|
||||
{
|
||||
|
||||
namespace FineUIPro.Web.CQMS.Comprehensive {
|
||||
|
||||
|
||||
public partial class MajorPlanApprovalEdit {
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
@@ -22,7 +20,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
@@ -31,7 +29,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// SimpleForm1 控件。
|
||||
/// </summary>
|
||||
@@ -40,7 +38,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Form SimpleForm1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// drpUnitId 控件。
|
||||
/// </summary>
|
||||
@@ -49,7 +47,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpUnitId;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// drpCNProfessionalId 控件。
|
||||
/// </summary>
|
||||
@@ -58,7 +56,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpCNProfessionalId;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// drpUnitWorkIds 控件。
|
||||
/// </summary>
|
||||
@@ -67,7 +65,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpUnitWorkIds;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtPlanCode 控件。
|
||||
/// </summary>
|
||||
@@ -76,7 +74,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtPlanCode;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtPlanName 控件。
|
||||
/// </summary>
|
||||
@@ -85,7 +83,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtPlanName;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtReviewMan 控件。
|
||||
/// </summary>
|
||||
@@ -94,7 +92,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtReviewMan;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtApprovalDate 控件。
|
||||
/// </summary>
|
||||
@@ -103,7 +101,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DatePicker txtApprovalDate;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtAuditMan 控件。
|
||||
/// </summary>
|
||||
@@ -112,7 +110,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtAuditMan;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtApprovalMan 控件。
|
||||
/// </summary>
|
||||
@@ -121,7 +119,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtApprovalMan;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtExpertReviewMan 控件。
|
||||
/// </summary>
|
||||
@@ -130,7 +128,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtExpertReviewMan;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// rblIsReview 控件。
|
||||
/// </summary>
|
||||
@@ -139,7 +137,16 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.RadioButtonList rblIsReview;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtRemarkCode 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox txtRemarkCode;
|
||||
|
||||
/// <summary>
|
||||
/// Panel2 控件。
|
||||
/// </summary>
|
||||
@@ -148,7 +155,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel2;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Label1 控件。
|
||||
/// </summary>
|
||||
@@ -157,7 +164,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Label Label1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnAttach 控件。
|
||||
/// </summary>
|
||||
@@ -166,7 +173,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnAttach;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar1 控件。
|
||||
/// </summary>
|
||||
@@ -175,7 +182,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// hdAttachUrl 控件。
|
||||
/// </summary>
|
||||
@@ -184,7 +191,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.HiddenField hdAttachUrl;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnSave 控件。
|
||||
/// </summary>
|
||||
@@ -193,7 +200,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSave;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// WindowAtt 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="NCR管理" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="NCRManagementId" AllowCellEditing="true" EnableColumnLines="true"
|
||||
ClicksToEdit="2" DataIDField="NCRManagementId" AllowSorting="true" SortField="NCRCode"
|
||||
ClicksToEdit="2" DataIDField="NCRManagementId" AllowSorting="true" SortField="RemarkCode"
|
||||
SortDirection="DESC" OnSort="Grid1_Sort"
|
||||
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="true">
|
||||
@@ -34,6 +34,9 @@
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" ToolTip="导入" Icon="PackageIn" runat="server" OnClick="btnImport_Click" Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
|
||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
|
||||
@@ -30,7 +31,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
{
|
||||
string strSql = @"select NCRManagementId, ProjectId, SendUnit, NCRCode, Contents,Problem,Measure,IssuedDate, ReceiveUnit,Status,
|
||||
ClosedDate, CompleteDate, ResponsibleMan, AttachUrl, ImplementationFrontState,
|
||||
CompileMan, UnitWorkId,CN.ProfessionalName,C.CNProfessionalId,u.UnitName
|
||||
CompileMan, UnitWorkId,CN.ProfessionalName,C.CNProfessionalId,u.UnitName,C.RemarkCode
|
||||
from Comprehensive_NCRManagement C
|
||||
left join Base_CNProfessional CN on C.CNProfessionalId=CN.CNProfessionalId
|
||||
left join Base_Unit u on u.UnitId = C.SendUnit
|
||||
@@ -245,6 +246,35 @@ namespace FineUIPro.Web.Comprehensive
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static string ConvertState(object Status)
|
||||
{
|
||||
if (Status != null)
|
||||
{
|
||||
if (Status.ToString().Trim() == BLL.Const.Comprehensive_ReCompile)
|
||||
{
|
||||
return "重报";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_ReJect)
|
||||
{
|
||||
return "驳回";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_Compile)
|
||||
{
|
||||
return "编制";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_Audit)
|
||||
{
|
||||
return "待审批";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_Complete)
|
||||
{
|
||||
return "审批完成";
|
||||
}
|
||||
}
|
||||
|
||||
return "编制";
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 导入
|
||||
@@ -299,33 +329,186 @@ namespace FineUIPro.Web.Comprehensive
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static string ConvertState(object Status)
|
||||
#region 导出按钮
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Status != null)
|
||||
{
|
||||
if (Status.ToString().Trim() == BLL.Const.Comprehensive_ReCompile)
|
||||
{
|
||||
return "重报";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_ReJect)
|
||||
{
|
||||
return "驳回";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_Compile)
|
||||
{
|
||||
return "编制";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_Audit)
|
||||
{
|
||||
return "待审批";
|
||||
}
|
||||
else if (Status.ToString().Trim() == BLL.Const.Comprehensive_Complete)
|
||||
{
|
||||
return "审批完成";
|
||||
}
|
||||
}
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = Const.NCRManagementDataInUrl;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
|
||||
return "编制";
|
||||
var lists = (from x in Funs.DB.Comprehensive_NCRManagement
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x);
|
||||
if (sdrpUnitId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
lists = lists.Where(x => x.SendUnit == sdrpUnitId.SelectedValue);
|
||||
}
|
||||
if (this.drpProfessionalId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
lists = lists.Where(x => x.CNProfessionalId == drpProfessionalId.SelectedValue);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtNCRCode.Text.Trim()))
|
||||
{
|
||||
lists = lists.Where(x => x.NCRCode.Contains(this.txtNCRCode.Text.Trim()));
|
||||
}
|
||||
lists = lists.OrderBy(x => x.RemarkCode);
|
||||
if (lists != null)
|
||||
{
|
||||
string projectName = BLL.ProjectService.GetShortNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
newUrl = uploadfilepath.Replace("NCR管理导入模板", "NCR管理(" + projectName + DateTime.Now.ToString("yyyyMMdd") + ")");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
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);
|
||||
}
|
||||
// 创建单元格样式
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
|
||||
cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font = workbook.CreateFont();
|
||||
font.FontHeightInPoints = 11;
|
||||
cellStyle.SetFont(font);
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle0 = workbook.CreateCellStyle();
|
||||
cellStyle0.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle0.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font0 = workbook.CreateFont();
|
||||
font0.FontHeightInPoints = 12;
|
||||
font0.IsBold = true;
|
||||
cellStyle0.SetFont(font0);
|
||||
// 第二步:创建新数据行
|
||||
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
|
||||
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
|
||||
NPOI.SS.UserModel.ICell cell;
|
||||
int i = 2;
|
||||
foreach (var item in lists)
|
||||
{
|
||||
// 第二步:创建新数据行
|
||||
row = sheet.CreateRow(i);
|
||||
// 添加数据
|
||||
cell = row.CreateCell(0);
|
||||
cell.CellStyle = cellStyle;
|
||||
string unitName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.SendUnit))
|
||||
{
|
||||
unitName = BLL.UnitService.GetUnitNameByUnitId(item.SendUnit);
|
||||
}
|
||||
cell.SetCellValue(unitName);//发出单位
|
||||
|
||||
cell = row.CreateCell(1);
|
||||
cell.CellStyle = cellStyle;
|
||||
string proName = string.Empty;
|
||||
var cnp = BLL.CNProfessionalService.GetCNProfessional(item.CNProfessionalId);
|
||||
if (cnp != null)
|
||||
{
|
||||
proName = cnp.ProfessionalName;
|
||||
}
|
||||
cell.SetCellValue(proName);//专业
|
||||
|
||||
cell = row.CreateCell(2);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.NCRCode);//NCR单号
|
||||
|
||||
cell = row.CreateCell(3);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.Contents);//主要内容
|
||||
|
||||
cell = row.CreateCell(4);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.IssuedDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.IssuedDate) : "");//下发日期
|
||||
|
||||
cell = row.CreateCell(5);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.Problem);//问题类别
|
||||
|
||||
cell = row.CreateCell(6);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.Measure);//改进措施
|
||||
|
||||
cell = row.CreateCell(7);
|
||||
cell.CellStyle = cellStyle;
|
||||
string unitWorkName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.UnitWorkId))
|
||||
{
|
||||
unitWorkName = ConvertUnitWork(item.UnitWorkId);
|
||||
}
|
||||
cell.SetCellValue(unitWorkName);//单位工程
|
||||
|
||||
cell = row.CreateCell(8);
|
||||
cell.CellStyle = cellStyle;
|
||||
string receiveUnitName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.ReceiveUnit))
|
||||
{
|
||||
receiveUnitName = ConvertCarryUnit(item.ReceiveUnit);
|
||||
}
|
||||
cell.SetCellValue(receiveUnitName);//接收单位
|
||||
|
||||
cell = row.CreateCell(9);
|
||||
cell.CellStyle = cellStyle;
|
||||
string state = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.ImplementationFrontState))
|
||||
{
|
||||
state = item.ImplementationFrontState;
|
||||
}
|
||||
cell.SetCellValue(state);//实施状态
|
||||
|
||||
cell = row.CreateCell(10);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ResponsibleMan);//责任人
|
||||
|
||||
cell = row.CreateCell(11);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ClosedDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.ClosedDate) : "");//要求封闭日期
|
||||
|
||||
cell = row.CreateCell(12);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.CompleteDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.CompleteDate) : "");//完成日期
|
||||
|
||||
cell = row.CreateCell(13);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.RemarkCode.HasValue ? item.RemarkCode.ToString() : "");//标志编号
|
||||
|
||||
i++;
|
||||
}
|
||||
// 第三步:写入文件流
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
workbook.Write(stream);
|
||||
workbook.Close();
|
||||
}
|
||||
string fileName = Path.GetFileName(newUrl);
|
||||
FileInfo info = new FileInfo(newUrl);
|
||||
long fileSize = info.Length;
|
||||
Response.Clear();
|
||||
Response.ContentType = "application/x-zip-compressed";
|
||||
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
Response.TransmitFile(newUrl, 0, fileSize);
|
||||
Response.Flush();
|
||||
Response.Close();
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("当前无记录,无法导出!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -7,13 +7,11 @@
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.Comprehensive
|
||||
{
|
||||
|
||||
|
||||
public partial class NCRManagement
|
||||
{
|
||||
|
||||
namespace FineUIPro.Web.Comprehensive {
|
||||
|
||||
|
||||
public partial class NCRManagement {
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
@@ -22,7 +20,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
@@ -31,7 +29,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Panel1 控件。
|
||||
/// </summary>
|
||||
@@ -40,7 +38,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Grid1 控件。
|
||||
/// </summary>
|
||||
@@ -49,7 +47,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ToolSearch 控件。
|
||||
/// </summary>
|
||||
@@ -58,7 +56,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar ToolSearch;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// sdrpUnitId 控件。
|
||||
/// </summary>
|
||||
@@ -67,7 +65,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList sdrpUnitId;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// drpProfessionalId 控件。
|
||||
/// </summary>
|
||||
@@ -76,7 +74,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpProfessionalId;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtNCRCode 控件。
|
||||
/// </summary>
|
||||
@@ -85,7 +83,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtNCRCode;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnSearch 控件。
|
||||
/// </summary>
|
||||
@@ -94,7 +92,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSearch;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnNew 控件。
|
||||
/// </summary>
|
||||
@@ -103,7 +101,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnNew;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnImport 控件。
|
||||
/// </summary>
|
||||
@@ -112,7 +110,16 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnOut;
|
||||
|
||||
/// <summary>
|
||||
/// lblPageIndex 控件。
|
||||
/// </summary>
|
||||
@@ -121,7 +128,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblPageIndex;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Label2 控件。
|
||||
/// </summary>
|
||||
@@ -130,7 +137,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label Label2;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Label3 控件。
|
||||
/// </summary>
|
||||
@@ -139,7 +146,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label Label3;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtStatus 控件。
|
||||
/// </summary>
|
||||
@@ -148,7 +155,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label txtStatus;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// lbtnFileUrl 控件。
|
||||
/// </summary>
|
||||
@@ -157,7 +164,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.LinkButton lbtnFileUrl;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarText1 控件。
|
||||
/// </summary>
|
||||
@@ -166,7 +173,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarText ToolbarText1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ddlPageSize 控件。
|
||||
/// </summary>
|
||||
@@ -175,7 +182,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList ddlPageSize;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Window1 控件。
|
||||
/// </summary>
|
||||
@@ -184,7 +191,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Window2 控件。
|
||||
/// </summary>
|
||||
@@ -193,7 +200,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window2;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// WindowAtt 控件。
|
||||
/// </summary>
|
||||
@@ -202,7 +209,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window WindowAtt;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Menu1 控件。
|
||||
/// </summary>
|
||||
@@ -211,7 +218,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Menu Menu1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuModify 控件。
|
||||
/// </summary>
|
||||
@@ -220,7 +227,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.MenuButton btnMenuModify;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuDel 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
&& x.SuperUnitWork == null
|
||||
select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
string row0 = pds.Rows[i][0].ToString();
|
||||
if (string.IsNullOrEmpty(row0))
|
||||
@@ -304,6 +304,17 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "标志编号" + "," + "此项为必填项!" + "|";
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
int t = Convert.ToInt32(row13);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "标志编号" + "," + "[" + row13 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(result))
|
||||
{
|
||||
@@ -453,13 +464,13 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
&& x.SuperUnitWork == null
|
||||
select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
Model.Comprehensive_NCRManagement oldViewInfo = new Model.Comprehensive_NCRManagement();
|
||||
string row0 = pds.Rows[i][0].ToString().Trim();
|
||||
string row1 = pds.Rows[i][1].ToString().Trim();
|
||||
var cn = cns.Where(y => y.ProfessionalName == row1).FirstOrDefault();
|
||||
oldViewInfo = oldViewInfos.Where(x => x.RemarkCode == pds.Rows[i][13].ToString().Trim()
|
||||
oldViewInfo = oldViewInfos.Where(x => x.RemarkCode ==Funs.GetNewInt( pds.Rows[i][13].ToString().Trim())
|
||||
).FirstOrDefault();
|
||||
if (oldViewInfo == null)
|
||||
{
|
||||
@@ -495,7 +506,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
des.CompleteDate = Convert.ToDateTime(pds.Rows[i][12].ToString().Trim());
|
||||
}
|
||||
des.RemarkCode = pds.Rows[i][13].ToString().Trim();
|
||||
des.RemarkCode = Funs.GetNewInt(pds.Rows[i][13].ToString().Trim());
|
||||
des.Status = BLL.Const.Comprehensive_Compile;
|
||||
des.CompileMan = this.CurrUser.UserId;
|
||||
BLL.NCRManagementService.AddNCRManagement(des);
|
||||
|
||||
@@ -27,12 +27,6 @@
|
||||
</f:DatePicker>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:TextArea ID="txtContents" runat="server" Label="主要内容" MaxLength="500" LabelAlign="Right" LabelWidth="130px"></f:TextArea>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:DropDownList ID="ddlProblem" runat="server" Label="问题类别" LabelAlign="Right" LabelWidth="130px">
|
||||
@@ -43,7 +37,13 @@
|
||||
<f:ListItem Value="不按设计要求施工" Text="不按设计要求施工" />
|
||||
<f:ListItem Value="不按程序施工" Text="不按程序施工" />
|
||||
<f:ListItem Value="成品保护不到位" Text="成品保护不到位" />
|
||||
</f:DropDownList>
|
||||
</f:DropDownList>
|
||||
<f:NumberBox ID="txtRemarkCode" runat="server" Label="标志编号" LabelAlign="Right" LabelWidth="130px" Required="true" ShowRedStar="true" NoDecimal="true" NoNegative="true"></f:NumberBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:TextArea ID="txtContents" runat="server" Label="主要内容" MaxLength="500" LabelAlign="Right" LabelWidth="130px"></f:TextArea>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
@@ -51,8 +51,6 @@
|
||||
<f:TextArea ID="txtMeasure" runat="server" Label="改进措施" MaxLength="500" LabelAlign="Right" LabelWidth="130px"></f:TextArea>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
|
||||
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:DropDownList ID="drpUnitWorkIds" runat="server" Label="单位工程名称" EnableCheckBoxSelect="true" EnableMultiSelect="true" LabelWidth="130px" AutoSelectFirstItem="false" LabelAlign="Right"></f:DropDownList>
|
||||
@@ -64,8 +62,7 @@
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
|
||||
<Items>
|
||||
<f:DropDownList ID="ddlImplementationFrontState" runat="server" Label="实施状态" Required="true" LabelAlign="Right" LabelWidth="130px">
|
||||
<f:ListItem Value="" Text="-请选择-" Selected="true" />
|
||||
<f:ListItem Value="整改中" Text="整改中" />
|
||||
@@ -94,12 +91,9 @@
|
||||
<f:Button ID="btnAttach" Icon="TableCell" EnablePostBack="true" Text="附件" runat="server" OnClick="btnAttach_Click">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
</f:Panel>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
|
||||
|
||||
|
||||
<f:FormRow MarginTop="10px">
|
||||
<Items>
|
||||
<f:DropDownList runat="server" Width="300px" Label="专业工程师确认" LabelWidth="130px" ID="drpAudit" ShowRedStar="true" Required="true" EmptyText="--请选择--">
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
this.ddlProblem.SelectedValue = nCRManagement.Problem;
|
||||
}
|
||||
this.txtMeasure.Text = nCRManagement.Measure;
|
||||
|
||||
this.txtRemarkCode.Text = nCRManagement.RemarkCode.HasValue ? nCRManagement.RemarkCode.ToString() : "";
|
||||
|
||||
this.txtResponsibleMan.Text = nCRManagement.ResponsibleMan;
|
||||
//this.txtImplementationFrontState.Text = nCRManagement.ImplementationFrontState;
|
||||
@@ -153,6 +153,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
this.drpAudit.Readonly = true;
|
||||
this.ddlProblem.Readonly = true;
|
||||
//this.btnAttach.Enabled = false;
|
||||
this.txtRemarkCode.Readonly = true;
|
||||
|
||||
|
||||
}
|
||||
@@ -199,6 +200,13 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
var q = Funs.DB.Comprehensive_NCRManagement.FirstOrDefault(x => x.RemarkCode == Funs.GetNewInt(this.txtRemarkCode.Text.Trim()) && (x.NCRManagementId != this.NCRManagementId || (this.NCRManagementId == null && x.NCRManagementId != null)));
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("标志编号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
Model.Comprehensive_NCRManagement nCRManagement = new Model.Comprehensive_NCRManagement();
|
||||
nCRManagement.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue))
|
||||
@@ -264,6 +272,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
unitIds = unitIds.Substring(0, unitIds.LastIndexOf(","));
|
||||
}
|
||||
nCRManagement.ReceiveUnit = unitIds;
|
||||
nCRManagement.RemarkCode = Funs.GetNewInt(this.txtRemarkCode.Text.Trim());
|
||||
if (string.IsNullOrEmpty(this.NCRManagementId))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.hdAttachUrl.Text))
|
||||
@@ -318,6 +327,12 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var q = Funs.DB.Comprehensive_NCRManagement.FirstOrDefault(x => x.RemarkCode == Funs.GetNewInt(this.txtRemarkCode.Text.Trim()) && (x.NCRManagementId != this.NCRManagementId || (this.NCRManagementId == null && x.NCRManagementId != null)));
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("标志编号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
Model.Comprehensive_NCRManagement nCRManagement = new Model.Comprehensive_NCRManagement();
|
||||
nCRManagement.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue))
|
||||
|
||||
@@ -75,15 +75,6 @@ namespace FineUIPro.Web.CQMS.Comprehensive {
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DatePicker txtIssuedDate;
|
||||
|
||||
/// <summary>
|
||||
/// txtContents 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextArea txtContents;
|
||||
|
||||
/// <summary>
|
||||
/// ddlProblem 控件。
|
||||
/// </summary>
|
||||
@@ -93,6 +84,24 @@ namespace FineUIPro.Web.CQMS.Comprehensive {
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList ddlProblem;
|
||||
|
||||
/// <summary>
|
||||
/// txtRemarkCode 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox txtRemarkCode;
|
||||
|
||||
/// <summary>
|
||||
/// txtContents 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextArea txtContents;
|
||||
|
||||
/// <summary>
|
||||
/// txtMeasure 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="压力管道管理" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="PressurePipeId" AllowCellEditing="true" EnableColumnLines="true"
|
||||
ClicksToEdit="2" DataIDField="PressurePipeId" AllowSorting="true"
|
||||
SortDirection="DESC" OnSort="Grid1_Sort"
|
||||
SortDirection="DESC" OnSort="Grid1_Sort" SortField="RemarkCode"
|
||||
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="true">
|
||||
<Toolbars>
|
||||
@@ -32,6 +32,9 @@
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" ToolTip="导入" Icon="PackageIn" runat="server" OnClick="btnImport_Click" Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
|
||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
@@ -96,7 +99,7 @@
|
||||
</f:Panel>
|
||||
<f:Window ID="Window1" Title="压力管道管理" Hidden="true" EnableIFrame="true" EnableMaximize="true"
|
||||
Target="Parent" EnableResize="false" runat="server" IsModal="true" OnClose="Window1_Close"
|
||||
Width="900px" Height="320px">
|
||||
Width="900px" Height="400px">
|
||||
</f:Window>
|
||||
<f:Window ID="Window2" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
|
||||
Target="Top" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="true"
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.Comprehensive
|
||||
@@ -48,7 +49,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
public void BindGrid()
|
||||
{
|
||||
string strSql = @"select PressurePipeId, EstimateNumber, ActualNumber, PackageNumber, Status,
|
||||
CompletePackageNumber, PressurePipeNumber, IssuedReportNumber, CompileMan,U.UnitName
|
||||
CompletePackageNumber, PressurePipeNumber, IssuedReportNumber, CompileMan,U.UnitName,C.RemarkCode
|
||||
from Comprehensive_PressurePipe C
|
||||
left join Base_Unit U on C.UnitId=U.UnitId
|
||||
where C.Projctid = @ProjectId";
|
||||
@@ -272,5 +273,138 @@ namespace FineUIPro.Web.Comprehensive
|
||||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("PressurePipeDataIn.aspx", "导入 - ")));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 导出按钮
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = Const.PressurePipeTemplateUrl;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
|
||||
var lists = (from x in Funs.DB.Comprehensive_PressurePipe
|
||||
where x.Projctid == this.CurrUser.LoginProjectId
|
||||
select x);
|
||||
if (sdrpUnitId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
lists = lists.Where(x => x.UnitId == sdrpUnitId.SelectedValue);
|
||||
}
|
||||
lists = lists.OrderBy(x => x.RemarkCode);
|
||||
if (lists != null)
|
||||
{
|
||||
string projectName = BLL.ProjectService.GetShortNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
newUrl = uploadfilepath.Replace("压力管道管理导入模板", "压力管道管理(" + projectName + DateTime.Now.ToString("yyyyMMdd") + ")");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
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);
|
||||
}
|
||||
// 创建单元格样式
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
|
||||
cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font = workbook.CreateFont();
|
||||
font.FontHeightInPoints = 11;
|
||||
cellStyle.SetFont(font);
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle0 = workbook.CreateCellStyle();
|
||||
cellStyle0.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle0.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font0 = workbook.CreateFont();
|
||||
font0.FontHeightInPoints = 12;
|
||||
font0.IsBold = true;
|
||||
cellStyle0.SetFont(font0);
|
||||
// 第二步:创建新数据行
|
||||
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
|
||||
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
|
||||
NPOI.SS.UserModel.ICell cell;
|
||||
int i = 2;
|
||||
foreach (var item in lists)
|
||||
{
|
||||
// 第二步:创建新数据行
|
||||
row = sheet.CreateRow(i);
|
||||
// 添加数据
|
||||
cell = row.CreateCell(0);
|
||||
cell.CellStyle = cellStyle;
|
||||
string unitName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.UnitId))
|
||||
{
|
||||
unitName = BLL.UnitService.GetUnitNameByUnitId(item.UnitId);
|
||||
}
|
||||
cell.SetCellValue(unitName);//所属单位
|
||||
|
||||
cell = row.CreateCell(1);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.EstimateNumber.HasValue ? item.EstimateNumber.ToString() : "");//预计压力管道条数
|
||||
|
||||
cell = row.CreateCell(2);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ActualNumber.HasValue ? item.ActualNumber.ToString() : "");//实际压力管道条数
|
||||
|
||||
cell = row.CreateCell(3);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.PackageNumber.HasValue ? item.PackageNumber.ToString() : "");//试压包数量
|
||||
|
||||
cell = row.CreateCell(4);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.CompletePackageNumber.HasValue ? item.CompletePackageNumber.ToString() : "");//已完成试压包数量
|
||||
|
||||
cell = row.CreateCell(5);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.PressurePipeNumber.HasValue ? item.PressurePipeNumber.ToString() : "");//已完成试压压力管道条数
|
||||
|
||||
cell = row.CreateCell(6);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.IssuedReportNumber.HasValue ? item.IssuedReportNumber.ToString() : "");//已完成监检报告条数
|
||||
|
||||
cell = row.CreateCell(7);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ReportTime.HasValue ? string.Format("{0:yyyy-MM-dd}", item.ReportTime) : "");//填报日期
|
||||
|
||||
cell = row.CreateCell(8);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.RemarkCode.HasValue ? item.RemarkCode.ToString() : "");//标志编号
|
||||
|
||||
i++;
|
||||
}
|
||||
// 第三步:写入文件流
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
workbook.Write(stream);
|
||||
workbook.Close();
|
||||
}
|
||||
string fileName = Path.GetFileName(newUrl);
|
||||
FileInfo info = new FileInfo(newUrl);
|
||||
long fileSize = info.Length;
|
||||
Response.Clear();
|
||||
Response.ContentType = "application/x-zip-compressed";
|
||||
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
Response.TransmitFile(newUrl, 0, fileSize);
|
||||
Response.Flush();
|
||||
Response.Close();
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("当前无记录,无法导出!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -93,6 +93,15 @@ namespace FineUIPro.Web.Comprehensive {
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnOut;
|
||||
|
||||
/// <summary>
|
||||
/// lblPageIndex 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
where y.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
string row0 = pds.Rows[i][0].ToString();
|
||||
if (string.IsNullOrEmpty(row0))
|
||||
@@ -283,6 +283,17 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "标志编号" + "," + "此项为必填项!" + "|";
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
int t = Convert.ToInt32(row8);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "标志编号" + "," + "[" + row8 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(result))
|
||||
{
|
||||
@@ -425,11 +436,11 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
where y.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
Model.Comprehensive_PressurePipe oldViewInfo = new Model.Comprehensive_PressurePipe();
|
||||
string row0 = pds.Rows[i][0].ToString().Trim();
|
||||
oldViewInfo = oldViewInfos.Where(x => x.RemarkCode == pds.Rows[i][8].ToString().Trim()
|
||||
oldViewInfo = oldViewInfos.Where(x => x.RemarkCode ==Funs.GetNewInt( pds.Rows[i][8].ToString().Trim())
|
||||
).FirstOrDefault();
|
||||
if (oldViewInfo == null)
|
||||
{
|
||||
@@ -444,7 +455,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
des.PressurePipeNumber = Funs.GetNewInt(pds.Rows[i][5].ToString().Trim());
|
||||
des.IssuedReportNumber = Funs.GetNewInt(pds.Rows[i][6].ToString().Trim());
|
||||
des.ReportTime = Funs.GetNewDateTime(pds.Rows[i][7].ToString().Trim());
|
||||
des.RemarkCode = pds.Rows[i][8].ToString().Trim();
|
||||
des.RemarkCode = Funs.GetNewInt(pds.Rows[i][8].ToString().Trim());
|
||||
des.CompileMan = this.CurrUser.UserId;
|
||||
des.Status = BLL.Const.Comprehensive_Compile;
|
||||
BLL.PressurePipeService.AddPressurePipe(des);
|
||||
|
||||
@@ -40,10 +40,16 @@
|
||||
<Items>
|
||||
<f:NumberBox ID="txtIssuedReportNumber" Label="已完成监检报告条数" runat="server" NoDecimal="true" LabelWidth="150px" NoNegative="true">
|
||||
</f:NumberBox>
|
||||
<f:NumberBox ID="txtRemarkCode" runat="server" Label="标志编号" LabelAlign="Right" LabelWidth="180px" Required="true" ShowRedStar="true" NoDecimal="true" NoNegative="true"></f:NumberBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:Panel ID="Panel2" ShowHeader="false" ShowBorder="false" Layout="Column" CssClass="" runat="server">
|
||||
<Items>
|
||||
<f:Label ID="Label1" runat="server" Label="上传附件"
|
||||
LabelAlign="Right" LabelWidth="180px">
|
||||
LabelAlign="Right" LabelWidth="150px">
|
||||
</f:Label>
|
||||
<f:Button ID="btnAttach" Icon="TableCell" EnablePostBack="true" Text="附件" runat="server" OnClick="btnAttach_Click">
|
||||
</f:Button>
|
||||
@@ -52,13 +58,12 @@
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
|
||||
|
||||
<f:FormRow MarginTop="10px">
|
||||
<Items>
|
||||
<f:DropDownList runat="server" Width="300px" Label="专业工程师确认" LabelWidth="130px" ID="drpAudit" ShowRedStar="true" Required="true" EmptyText="--请选择--">
|
||||
<f:DropDownList runat="server" Width="300px" Label="专业工程师确认" LabelWidth="150px" ID="drpAudit" ShowRedStar="true" Required="true" EmptyText="--请选择--">
|
||||
</f:DropDownList>
|
||||
<f:DatePicker runat="server" DateFormatString="yyyy-MM-dd" Label="填报日期" ID="txtReportTime"
|
||||
LabelAlign="Right" LabelWidth="130px">
|
||||
LabelAlign="Right" LabelWidth="180px">
|
||||
</f:DatePicker>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
this.txtReportTime.Text = string.Format("{0:yyyy-MM-dd}", pressurePipe.ReportTime);
|
||||
}
|
||||
|
||||
this.txtRemarkCode.Text = pressurePipe.RemarkCode.HasValue ? pressurePipe.RemarkCode.ToString() : "";
|
||||
var currApprove = PressurePipeApproveService.GetCurrentApprove(pressurePipe.PressurePipeId);
|
||||
if (currApprove != null)
|
||||
{
|
||||
@@ -119,6 +119,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
this.txtPressurePipeNumber.Readonly = true;
|
||||
this.drpUnit.Readonly = true;
|
||||
this.txtReportTime.Readonly = true;
|
||||
this.txtRemarkCode.Readonly = true;
|
||||
|
||||
this.drpAudit.Readonly = true;
|
||||
|
||||
@@ -163,6 +164,13 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
Alert.ShowInTop("请选择所属单位!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var q = Funs.DB.Comprehensive_PressurePipe.FirstOrDefault(x => x.RemarkCode == Funs.GetNewInt(this.txtRemarkCode.Text.Trim()) && (x.PressurePipeId != this.PressurePipeId || (this.PressurePipeId == null && x.PressurePipeId != null)));
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("标志编号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
Model.Comprehensive_PressurePipe pressurePipe = new Model.Comprehensive_PressurePipe();
|
||||
pressurePipe.Projctid = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue))
|
||||
@@ -201,7 +209,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
pressurePipe.ReportTime = Convert.ToDateTime(this.txtReportTime.Text);
|
||||
}
|
||||
|
||||
pressurePipe.RemarkCode = Funs.GetNewInt(this.txtRemarkCode.Text.Trim());
|
||||
if (string.IsNullOrEmpty(this.PressurePipeId))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.hdAttachUrl.Text))
|
||||
@@ -242,6 +250,12 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
Alert.ShowInTop("请选择所属单位!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var q = Funs.DB.Comprehensive_PressurePipe.FirstOrDefault(x => x.RemarkCode == Funs.GetNewInt(this.txtRemarkCode.Text.Trim()) && (x.PressurePipeId != this.PressurePipeId || (this.PressurePipeId == null && x.PressurePipeId != null)));
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("标志编号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
Model.Comprehensive_PressurePipe pressurePipe = new Model.Comprehensive_PressurePipe();
|
||||
pressurePipe.Projctid = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue))
|
||||
@@ -280,6 +294,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
pressurePipe.ReportTime = Convert.ToDateTime(this.txtReportTime.Text);
|
||||
}
|
||||
pressurePipe.RemarkCode = Funs.GetNewInt(this.txtRemarkCode.Text.Trim());
|
||||
if (string.IsNullOrEmpty(this.PressurePipeId))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.hdAttachUrl.Text))
|
||||
|
||||
@@ -7,13 +7,11 @@
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
|
||||
|
||||
public partial class PressurePipeEdit
|
||||
{
|
||||
|
||||
namespace FineUIPro.Web.CQMS.Comprehensive {
|
||||
|
||||
|
||||
public partial class PressurePipeEdit {
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
@@ -22,7 +20,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
@@ -31,7 +29,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// SimpleForm1 控件。
|
||||
/// </summary>
|
||||
@@ -40,7 +38,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Form SimpleForm1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// drpUnit 控件。
|
||||
/// </summary>
|
||||
@@ -49,7 +47,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpUnit;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtEstimateNumber 控件。
|
||||
/// </summary>
|
||||
@@ -58,7 +56,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox txtEstimateNumber;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtActualNumber 控件。
|
||||
/// </summary>
|
||||
@@ -67,7 +65,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox txtActualNumber;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtPackageNumber 控件。
|
||||
/// </summary>
|
||||
@@ -76,7 +74,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox txtPackageNumber;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtCompletePackageNumber 控件。
|
||||
/// </summary>
|
||||
@@ -85,7 +83,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox txtCompletePackageNumber;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtPressurePipeNumber 控件。
|
||||
/// </summary>
|
||||
@@ -94,7 +92,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox txtPressurePipeNumber;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtIssuedReportNumber 控件。
|
||||
/// </summary>
|
||||
@@ -103,7 +101,16 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox txtIssuedReportNumber;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtRemarkCode 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox txtRemarkCode;
|
||||
|
||||
/// <summary>
|
||||
/// Panel2 控件。
|
||||
/// </summary>
|
||||
@@ -112,7 +119,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel2;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Label1 控件。
|
||||
/// </summary>
|
||||
@@ -121,7 +128,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Label Label1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnAttach 控件。
|
||||
/// </summary>
|
||||
@@ -130,7 +137,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnAttach;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// drpAudit 控件。
|
||||
/// </summary>
|
||||
@@ -139,7 +146,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpAudit;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtReportTime 控件。
|
||||
/// </summary>
|
||||
@@ -148,7 +155,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DatePicker txtReportTime;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// agree 控件。
|
||||
/// </summary>
|
||||
@@ -157,7 +164,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.FormRow agree;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// rblIsAgree 控件。
|
||||
/// </summary>
|
||||
@@ -166,7 +173,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.RadioButtonList rblIsAgree;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// options 控件。
|
||||
/// </summary>
|
||||
@@ -175,7 +182,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.FormRow options;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtidea 控件。
|
||||
/// </summary>
|
||||
@@ -184,7 +191,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextArea txtidea;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar1 控件。
|
||||
/// </summary>
|
||||
@@ -193,7 +200,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// hdAttachUrl 控件。
|
||||
/// </summary>
|
||||
@@ -202,7 +209,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.HiddenField hdAttachUrl;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnSave 控件。
|
||||
/// </summary>
|
||||
@@ -211,7 +218,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSave;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnSubmit 控件。
|
||||
/// </summary>
|
||||
@@ -220,7 +227,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSubmit;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// WindowAtt 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="质量事故处理记录" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="QualityAccidentId" AllowCellEditing="true" EnableColumnLines="true"
|
||||
ClicksToEdit="2" DataIDField="QualityAccidentId" AllowSorting="true" SortField="Time"
|
||||
ClicksToEdit="2" DataIDField="QualityAccidentId" AllowSorting="true" SortField="RemarkCode"
|
||||
SortDirection="DESC" OnSort="Grid1_Sort"
|
||||
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="true">
|
||||
@@ -27,6 +27,9 @@
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" ToolTip="导入" Icon="PackageIn" runat="server" OnClick="btnImport_Click" Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
|
||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.Comprehensive
|
||||
@@ -31,7 +32,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
{
|
||||
string strSql = @"select QualityAccidentId, time, Place, DirectEconomicLoss, RemedialMeasures,Status,
|
||||
ResponsibilityDetermination, CorrectiveActions, AttachUrl, CompileMan, CompileDate,
|
||||
UnitWorkId,U.UnitName
|
||||
UnitWorkId,U.UnitName,C.RemarkCode
|
||||
from Comprehensive_QualityAccident C
|
||||
left join Base_Unit U on C.UnitId=U.UnitId
|
||||
where C.ProjectId = @ProjectId";
|
||||
@@ -282,5 +283,139 @@ namespace FineUIPro.Web.Comprehensive
|
||||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("QualityAccidentDataIn.aspx", "导入 - ")));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 导出按钮
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = Const.QualityAccidentTemplateUrl;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
|
||||
var lists = (from x in Funs.DB.Comprehensive_QualityAccident
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x);
|
||||
lists = lists.OrderBy(x => x.RemarkCode);
|
||||
if (lists != null)
|
||||
{
|
||||
string projectName = BLL.ProjectService.GetShortNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
newUrl = uploadfilepath.Replace("质量事故处理记录导入模板", "质量事故处理记录(" + projectName + DateTime.Now.ToString("yyyyMMdd") + ")");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
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);
|
||||
}
|
||||
// 创建单元格样式
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
|
||||
cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font = workbook.CreateFont();
|
||||
font.FontHeightInPoints = 11;
|
||||
cellStyle.SetFont(font);
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle0 = workbook.CreateCellStyle();
|
||||
cellStyle0.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle0.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font0 = workbook.CreateFont();
|
||||
font0.FontHeightInPoints = 12;
|
||||
font0.IsBold = true;
|
||||
cellStyle0.SetFont(font0);
|
||||
// 第二步:创建新数据行
|
||||
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
|
||||
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
|
||||
NPOI.SS.UserModel.ICell cell;
|
||||
int i = 2;
|
||||
foreach (var item in lists)
|
||||
{
|
||||
// 第二步:创建新数据行
|
||||
row = sheet.CreateRow(i);
|
||||
// 添加数据
|
||||
cell = row.CreateCell(0);
|
||||
cell.CellStyle = cellStyle;
|
||||
string unitName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.UnitId))
|
||||
{
|
||||
unitName = BLL.UnitService.GetUnitNameByUnitId(item.UnitId);
|
||||
}
|
||||
cell.SetCellValue(unitName);//责任单位
|
||||
|
||||
cell = row.CreateCell(1);
|
||||
cell.CellStyle = cellStyle;
|
||||
string unitWorkName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.UnitWorkId))
|
||||
{
|
||||
unitWorkName = ConvertUnitWork(item.UnitWorkId);
|
||||
}
|
||||
cell.SetCellValue(unitWorkName);//单位工程
|
||||
|
||||
cell = row.CreateCell(2);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.Time.HasValue ? string.Format("{0:yyyy-MM-dd}",item.Time) : "");//时间
|
||||
|
||||
cell = row.CreateCell(3);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.Place);//地点
|
||||
|
||||
cell = row.CreateCell(4);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.DirectEconomicLoss);//直接经济损失(估计)原因及性质
|
||||
|
||||
cell = row.CreateCell(5);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.RemedialMeasures);//采取补救措施
|
||||
|
||||
cell = row.CreateCell(6);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ResponsibilityDetermination);//事故责任认定
|
||||
|
||||
cell = row.CreateCell(7);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.CorrectiveActions);//最终整改措施
|
||||
|
||||
cell = row.CreateCell(8);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.RemarkCode.HasValue ? item.RemarkCode.ToString() : "");//标志编号
|
||||
|
||||
i++;
|
||||
}
|
||||
// 第三步:写入文件流
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
workbook.Write(stream);
|
||||
workbook.Close();
|
||||
}
|
||||
string fileName = Path.GetFileName(newUrl);
|
||||
FileInfo info = new FileInfo(newUrl);
|
||||
long fileSize = info.Length;
|
||||
Response.Clear();
|
||||
Response.ContentType = "application/x-zip-compressed";
|
||||
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
Response.TransmitFile(newUrl, 0, fileSize);
|
||||
Response.Flush();
|
||||
Response.Close();
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("当前无记录,无法导出!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -75,6 +75,15 @@ namespace FineUIPro.Web.Comprehensive {
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnOut;
|
||||
|
||||
/// <summary>
|
||||
/// lblPageIndex 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -176,7 +176,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
&& x.SuperUnitWork == null
|
||||
select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
string row0 = pds.Rows[i][0].ToString();
|
||||
if (string.IsNullOrEmpty(row0))
|
||||
@@ -224,6 +224,17 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "标志编号" + "," + "此项为必填项!" + "|";
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
int t = Convert.ToInt32(row8);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "标志编号" + "," + "[" + row8 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(result))
|
||||
{
|
||||
@@ -371,11 +382,11 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
&& x.SuperUnitWork == null
|
||||
select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
Model.Comprehensive_QualityAccident oldViewInfo = new Model.Comprehensive_QualityAccident();
|
||||
string row0 = pds.Rows[i][0].ToString().Trim();
|
||||
oldViewInfo = oldViewInfos.Where(x => x.RemarkCode == pds.Rows[i][8].ToString().Trim()
|
||||
oldViewInfo = oldViewInfos.Where(x => x.RemarkCode ==Funs.GetNewInt(pds.Rows[i][8].ToString().Trim())
|
||||
).FirstOrDefault();
|
||||
if (oldViewInfo == null)
|
||||
{
|
||||
@@ -393,7 +404,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
des.RemedialMeasures = pds.Rows[i][5].ToString().Trim();
|
||||
des.ResponsibilityDetermination =pds.Rows[i][6].ToString().Trim();
|
||||
des.CorrectiveActions = pds.Rows[i][7].ToString().Trim();
|
||||
des.RemarkCode = pds.Rows[i][8].ToString().Trim();
|
||||
des.RemarkCode = Funs.GetNewInt(pds.Rows[i][8].ToString().Trim());
|
||||
des.CompileMan = this.CurrUser.UserId;
|
||||
des.CompileDate = DateTime.Now;
|
||||
des.Status = BLL.Const.Comprehensive_Compile;
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
<f:NumberBox ID="txtRemarkCode" runat="server" Label="标志编号" LabelAlign="Right" LabelWidth="120px" Required="true" ShowRedStar="true" NoDecimal="true" NoNegative="true"></f:NumberBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
this.drpUnitWorkId.SelectedValueArray = pressurePipe.UnitWorkId.Split(',');
|
||||
}
|
||||
|
||||
this.txtRemarkCode.Text = pressurePipe.RemarkCode.HasValue ? pressurePipe.RemarkCode.ToString() : "";
|
||||
var currApprove = QualityAccidentApproveService.GetCurrentApprove(pressurePipe.QualityAccidentId);
|
||||
if (currApprove != null)
|
||||
{
|
||||
@@ -114,7 +114,8 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
this.txtTime.Readonly = true;
|
||||
this.drpUnit.Readonly = true;
|
||||
this.drpUnitWorkId.Readonly = true;
|
||||
this.drpAudit.Readonly = true;
|
||||
this.drpAudit.Readonly = true;
|
||||
this.txtRemarkCode.Readonly = true;
|
||||
//this.btnAttach.Enabled = false;
|
||||
|
||||
}
|
||||
@@ -151,6 +152,12 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
if (drpUnit.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
var q = Funs.DB.Comprehensive_QualityAccident.FirstOrDefault(x => x.RemarkCode == Funs.GetNewInt(this.txtRemarkCode.Text.Trim()) && (x.QualityAccidentId != this.QualityAccidentId || (this.QualityAccidentId == null && x.QualityAccidentId != null)));
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("标志编号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
Model.Comprehensive_QualityAccident pressurePipe = new Model.Comprehensive_QualityAccident();
|
||||
pressurePipe.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue))
|
||||
@@ -182,6 +189,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
ids = ids.Substring(0, ids.LastIndexOf(","));
|
||||
}
|
||||
pressurePipe.UnitWorkId = ids;
|
||||
pressurePipe.RemarkCode = Funs.GetNewInt(this.txtRemarkCode.Text.Trim());
|
||||
if (string.IsNullOrEmpty(this.QualityAccidentId))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.hdAttachUrl.Text))
|
||||
@@ -224,6 +232,12 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
if (drpUnit.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
var q = Funs.DB.Comprehensive_QualityAccident.FirstOrDefault(x => x.RemarkCode == Funs.GetNewInt(this.txtRemarkCode.Text.Trim()) && (x.QualityAccidentId != this.QualityAccidentId || (this.QualityAccidentId == null && x.QualityAccidentId != null)));
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("标志编号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
Model.Comprehensive_QualityAccident pressurePipe = new Model.Comprehensive_QualityAccident();
|
||||
pressurePipe.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue))
|
||||
@@ -255,6 +269,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
ids = ids.Substring(0, ids.LastIndexOf(","));
|
||||
}
|
||||
pressurePipe.UnitWorkId = ids;
|
||||
pressurePipe.RemarkCode =Funs.GetNewInt( this.txtRemarkCode.Text.Trim());
|
||||
if (string.IsNullOrEmpty(this.QualityAccidentId))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.hdAttachUrl.Text))
|
||||
|
||||
+38
-31
@@ -7,13 +7,11 @@
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
|
||||
|
||||
public partial class QualityAccidentEdit
|
||||
{
|
||||
|
||||
namespace FineUIPro.Web.CQMS.Comprehensive {
|
||||
|
||||
|
||||
public partial class QualityAccidentEdit {
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
@@ -22,7 +20,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
@@ -31,7 +29,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// SimpleForm1 控件。
|
||||
/// </summary>
|
||||
@@ -40,7 +38,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Form SimpleForm1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// drpUnit 控件。
|
||||
/// </summary>
|
||||
@@ -49,7 +47,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpUnit;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// drpUnitWorkId 控件。
|
||||
/// </summary>
|
||||
@@ -58,7 +56,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpUnitWorkId;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtTime 控件。
|
||||
/// </summary>
|
||||
@@ -67,7 +65,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DatePicker txtTime;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtPlace 控件。
|
||||
/// </summary>
|
||||
@@ -76,7 +74,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtPlace;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtDirectEconomicLoss 控件。
|
||||
/// </summary>
|
||||
@@ -85,7 +83,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextArea txtDirectEconomicLoss;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtRemedialMeasures 控件。
|
||||
/// </summary>
|
||||
@@ -94,7 +92,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextArea txtRemedialMeasures;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtResponsibilityDetermination 控件。
|
||||
/// </summary>
|
||||
@@ -103,7 +101,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextArea txtResponsibilityDetermination;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtCorrectiveActions 控件。
|
||||
/// </summary>
|
||||
@@ -112,7 +110,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextArea txtCorrectiveActions;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Panel2 控件。
|
||||
/// </summary>
|
||||
@@ -121,7 +119,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel2;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Label1 控件。
|
||||
/// </summary>
|
||||
@@ -130,7 +128,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Label Label1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnAttach 控件。
|
||||
/// </summary>
|
||||
@@ -139,7 +137,16 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnAttach;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtRemarkCode 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox txtRemarkCode;
|
||||
|
||||
/// <summary>
|
||||
/// drpAudit 控件。
|
||||
/// </summary>
|
||||
@@ -148,7 +155,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpAudit;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// agree 控件。
|
||||
/// </summary>
|
||||
@@ -157,7 +164,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.FormRow agree;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// rblIsAgree 控件。
|
||||
/// </summary>
|
||||
@@ -166,7 +173,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.RadioButtonList rblIsAgree;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// options 控件。
|
||||
/// </summary>
|
||||
@@ -175,7 +182,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.FormRow options;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtidea 控件。
|
||||
/// </summary>
|
||||
@@ -184,7 +191,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextArea txtidea;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar1 控件。
|
||||
/// </summary>
|
||||
@@ -193,7 +200,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarFill1 控件。
|
||||
/// </summary>
|
||||
@@ -202,7 +209,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarFill ToolbarFill1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// hdAttachUrl 控件。
|
||||
/// </summary>
|
||||
@@ -211,7 +218,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.HiddenField hdAttachUrl;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnSave 控件。
|
||||
/// </summary>
|
||||
@@ -220,7 +227,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSave;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnSubmit 控件。
|
||||
/// </summary>
|
||||
@@ -229,7 +236,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSubmit;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// WindowAtt 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="图纸收发记录" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="Id" AllowCellEditing="true" EnableColumnLines="true" ClicksToEdit="2" DataIDField="Id" AllowSorting="true"
|
||||
SortField="CreateDate" SortDirection="DESC" OnSort="Grid1_Sort" AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
SortField="RemarkCode" SortDirection="DESC" OnSort="Grid1_Sort" AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="ToolSearch" Position="Top" runat="server" ToolbarAlign="Left">
|
||||
@@ -31,6 +31,9 @@
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" ToolTip="导入" Icon="PackageIn" runat="server" OnClick="btnImport_Click" Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
|
||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
@@ -325,5 +326,145 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("ReviewDrawingsDataIn.aspx", "导入 - ")));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 导出按钮
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = Const.ReviewDrawingsTemplateUrl;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
|
||||
var lists = (from x in Funs.DB.Comprehensive_ReviewDrawings
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x);
|
||||
if (sdrpCNProfessionalId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
lists = lists.Where(x => x.CNProfessionalId == sdrpCNProfessionalId.SelectedValue);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtDraCode.Text.Trim()))
|
||||
{
|
||||
lists = lists.Where(x => x.DraCode.Contains(this.txtDraCode.Text.Trim()));
|
||||
}
|
||||
lists = lists.OrderBy(x => x.RemarkCode);
|
||||
if (lists != null)
|
||||
{
|
||||
string projectName = BLL.ProjectService.GetShortNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
newUrl = uploadfilepath.Replace("图纸会审管理导入模板", "图纸会审管理(" + projectName + DateTime.Now.ToString("yyyyMMdd") + ")");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
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);
|
||||
}
|
||||
// 创建单元格样式
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
|
||||
cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font = workbook.CreateFont();
|
||||
font.FontHeightInPoints = 11;
|
||||
cellStyle.SetFont(font);
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle0 = workbook.CreateCellStyle();
|
||||
cellStyle0.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle0.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font0 = workbook.CreateFont();
|
||||
font0.FontHeightInPoints = 12;
|
||||
font0.IsBold = true;
|
||||
cellStyle0.SetFont(font0);
|
||||
// 第二步:创建新数据行
|
||||
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
|
||||
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
|
||||
NPOI.SS.UserModel.ICell cell;
|
||||
int i = 2;
|
||||
foreach (var item in lists)
|
||||
{
|
||||
// 第二步:创建新数据行
|
||||
row = sheet.CreateRow(i);
|
||||
// 添加数据
|
||||
cell = row.CreateCell(0);
|
||||
cell.CellStyle = cellStyle;
|
||||
string proName = string.Empty;
|
||||
var cnp = BLL.CNProfessionalService.GetCNProfessional(item.CNProfessionalId);
|
||||
if (cnp != null)
|
||||
{
|
||||
proName = cnp.ProfessionalName;
|
||||
}
|
||||
cell.SetCellValue(proName);//专业
|
||||
|
||||
cell = row.CreateCell(1);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.DraCode);//编号
|
||||
|
||||
cell = row.CreateCell(2);
|
||||
cell.CellStyle = cellStyle;
|
||||
string unitWorkName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.UnitWorkId))
|
||||
{
|
||||
unitWorkName = ConvertUnitWork(item.UnitWorkId);
|
||||
}
|
||||
cell.SetCellValue(unitWorkName);//单位工程
|
||||
|
||||
cell = row.CreateCell(3);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ReviewDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.ReviewDate) : "");//图纸会审日期
|
||||
|
||||
cell = row.CreateCell(4);
|
||||
cell.CellStyle = cellStyle;
|
||||
string unitName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.ReceiveUnits))
|
||||
{
|
||||
unitName = ConvertCarryUnit(item.ReceiveUnits);
|
||||
}
|
||||
cell.SetCellValue(unitName);//参加单位
|
||||
|
||||
cell = row.CreateCell(5);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.Remarks);//备注
|
||||
|
||||
cell = row.CreateCell(6);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.RemarkCode.HasValue ? item.RemarkCode.ToString() : "");//标志编号
|
||||
|
||||
i++;
|
||||
}
|
||||
// 第三步:写入文件流
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
workbook.Write(stream);
|
||||
workbook.Close();
|
||||
}
|
||||
string fileName = Path.GetFileName(newUrl);
|
||||
FileInfo info = new FileInfo(newUrl);
|
||||
long fileSize = info.Length;
|
||||
Response.Clear();
|
||||
Response.ContentType = "application/x-zip-compressed";
|
||||
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
Response.TransmitFile(newUrl, 0, fileSize);
|
||||
Response.Flush();
|
||||
Response.Close();
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("当前无记录,无法导出!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -102,6 +102,15 @@ namespace FineUIPro.Web.CQMS.Comprehensive {
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnOut;
|
||||
|
||||
/// <summary>
|
||||
/// lblPageIndex 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
&& x.SuperUnitWork == null
|
||||
select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
string row0 = pds.Rows[i][0].ToString();
|
||||
if (string.IsNullOrEmpty(row0))
|
||||
@@ -250,6 +250,17 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "标志编号" + "," + "此项为必填项!" + "|";
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
int t = Convert.ToInt32(row6);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "标志编号" + "," + "[" + row6 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(result))
|
||||
{
|
||||
@@ -399,12 +410,12 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
&& x.SuperUnitWork == null
|
||||
select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
Model.Comprehensive_ReviewDrawings oldViewInfo = new Model.Comprehensive_ReviewDrawings();
|
||||
string row0 = pds.Rows[i][0].ToString().Trim();
|
||||
var cn = cns.Where(y => y.ProfessionalName == row0).FirstOrDefault();
|
||||
oldViewInfo = oldViewInfos.Where(x => x.RemarkCode == pds.Rows[i][6].ToString().Trim()
|
||||
oldViewInfo = oldViewInfos.Where(x => x.RemarkCode == Funs.GetNewInt(pds.Rows[i][6].ToString().Trim())
|
||||
).FirstOrDefault();
|
||||
if (oldViewInfo == null)
|
||||
{
|
||||
@@ -426,7 +437,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
des.ReceiveUnits = BLL.UnitService.GetUnitIds(pds.Rows[i][4].ToString().Trim());
|
||||
}
|
||||
des.Remarks = pds.Rows[i][5].ToString().Trim();
|
||||
des.RemarkCode = pds.Rows[i][6].ToString().Trim();
|
||||
des.RemarkCode = Funs.GetNewInt(pds.Rows[i][6].ToString().Trim());
|
||||
des.CreateMan = this.CurrUser.UserId;
|
||||
des.CreateDate = DateTime.Now;
|
||||
des.Status = BLL.Const.Comprehensive_Compile;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:DropDownList ID="drpUnitIds" runat="server" Label="参加单位" EnableCheckBoxSelect="true" EnableMultiSelect="true" LabelWidth="130px" AutoSelectFirstItem="false" LabelAlign="Right"></f:DropDownList>
|
||||
|
||||
<f:NumberBox ID="txtRemarkCode" runat="server" Label="标志编号" LabelAlign="Right" LabelWidth="130px" Required="true" ShowRedStar="true" NoDecimal="true" NoNegative="true"></f:NumberBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
this.drpUnitIds.SelectedValueArray = model.ReceiveUnits.Split(',');
|
||||
}
|
||||
this.txtRemarks.Text = model.Remarks;
|
||||
|
||||
this.txtRemarkCode.Text = model.RemarkCode.HasValue ? model.RemarkCode.ToString() : "";
|
||||
|
||||
var currApprove = DesignDrawingsApproveService.GetCurrentApprove(model.Id);
|
||||
if (currApprove != null)
|
||||
@@ -122,6 +122,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
this.txtRemarks.Readonly = true;
|
||||
this.txtReviewDate.Readonly = true;
|
||||
this.drpAudit.Readonly = true;
|
||||
this.txtRemarkCode.Readonly = true;
|
||||
//this.btnAttach.Enabled = false;
|
||||
|
||||
}
|
||||
@@ -206,13 +207,17 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (drpCNProfessionalId.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
var q = Funs.DB.Comprehensive_ReviewDrawings.FirstOrDefault(x => x.RemarkCode == Funs.GetNewInt(this.txtRemarkCode.Text.Trim()) && (x.Id != this.Id || (this.Id == null && x.Id != null)));
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("标志编号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var designDrawings = new Model.Comprehensive_ReviewDrawings();
|
||||
designDrawings.ProjectId = this.CurrUser.LoginProjectId;
|
||||
designDrawings.CNProfessionalId = this.drpCNProfessionalId.SelectedValue;
|
||||
@@ -248,6 +253,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
unitIds = unitIds.Substring(0, unitIds.LastIndexOf(","));
|
||||
}
|
||||
designDrawings.ReceiveUnits = unitIds;
|
||||
designDrawings.RemarkCode = Funs.GetNewInt(this.txtRemarkCode.Text.Trim());
|
||||
if (!string.IsNullOrEmpty(this.Id))
|
||||
{
|
||||
designDrawings.Id = this.Id;
|
||||
@@ -287,6 +293,12 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var q = Funs.DB.Comprehensive_ReviewDrawings.FirstOrDefault(x => x.RemarkCode == Funs.GetNewInt(this.txtRemarkCode.Text.Trim()) && (x.Id != this.Id || (this.Id == null && x.Id != null)));
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("标志编号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var designDrawings = new Model.Comprehensive_ReviewDrawings();
|
||||
designDrawings.ProjectId = this.CurrUser.LoginProjectId;
|
||||
designDrawings.CNProfessionalId = this.drpCNProfessionalId.SelectedValue;
|
||||
@@ -322,6 +334,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
unitIds = unitIds.Substring(0, unitIds.LastIndexOf(","));
|
||||
}
|
||||
designDrawings.ReceiveUnits = unitIds;
|
||||
designDrawings.RemarkCode = Funs.GetNewInt(this.txtRemarkCode.Text.Trim());
|
||||
if (!string.IsNullOrEmpty(this.Id))
|
||||
{
|
||||
designDrawings.Id = this.Id;
|
||||
|
||||
+35
-28
@@ -7,13 +7,11 @@
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
|
||||
|
||||
public partial class ReviewDrawingsEdit
|
||||
{
|
||||
|
||||
namespace FineUIPro.Web.CQMS.Comprehensive {
|
||||
|
||||
|
||||
public partial class ReviewDrawingsEdit {
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
@@ -22,7 +20,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
@@ -31,7 +29,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// SimpleForm1 控件。
|
||||
/// </summary>
|
||||
@@ -40,7 +38,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Form SimpleForm1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// drpCNProfessionalId 控件。
|
||||
/// </summary>
|
||||
@@ -49,7 +47,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpCNProfessionalId;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// drpUnitWorkIds 控件。
|
||||
/// </summary>
|
||||
@@ -58,7 +56,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpUnitWorkIds;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtDraCode 控件。
|
||||
/// </summary>
|
||||
@@ -67,7 +65,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtDraCode;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtReviewDate 控件。
|
||||
/// </summary>
|
||||
@@ -76,7 +74,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DatePicker txtReviewDate;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// drpUnitIds 控件。
|
||||
/// </summary>
|
||||
@@ -85,7 +83,16 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpUnitIds;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtRemarkCode 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox txtRemarkCode;
|
||||
|
||||
/// <summary>
|
||||
/// txtRemarks 控件。
|
||||
/// </summary>
|
||||
@@ -94,7 +101,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextArea txtRemarks;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Panel2 控件。
|
||||
/// </summary>
|
||||
@@ -103,7 +110,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel2;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Label1 控件。
|
||||
/// </summary>
|
||||
@@ -112,7 +119,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Label Label1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnAttach 控件。
|
||||
/// </summary>
|
||||
@@ -121,7 +128,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnAttach;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// drpAudit 控件。
|
||||
/// </summary>
|
||||
@@ -130,7 +137,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpAudit;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// agree 控件。
|
||||
/// </summary>
|
||||
@@ -139,7 +146,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.FormRow agree;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// rblIsAgree 控件。
|
||||
/// </summary>
|
||||
@@ -148,7 +155,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.RadioButtonList rblIsAgree;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// options 控件。
|
||||
/// </summary>
|
||||
@@ -157,7 +164,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.FormRow options;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtidea 控件。
|
||||
/// </summary>
|
||||
@@ -166,7 +173,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextArea txtidea;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar1 控件。
|
||||
/// </summary>
|
||||
@@ -175,7 +182,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// hdAttachUrl 控件。
|
||||
/// </summary>
|
||||
@@ -184,7 +191,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.HiddenField hdAttachUrl;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnSave 控件。
|
||||
/// </summary>
|
||||
@@ -193,7 +200,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSave;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnSubmit 控件。
|
||||
/// </summary>
|
||||
@@ -202,7 +209,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSubmit;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// WindowAtt 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="现场签证管理" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="VisaId" AllowCellEditing="true" EnableColumnLines="true"
|
||||
ClicksToEdit="2" DataIDField="VisaId" AllowSorting="true" SortField="VisaCode"
|
||||
ClicksToEdit="2" DataIDField="VisaId" AllowSorting="true" SortField="RemarkCode"
|
||||
SortDirection="DESC" OnSort="Grid1_Sort"
|
||||
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="true">
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
{
|
||||
string strSql = @"select VisaId,VisaCode, VisaReson, VisaDate, Status,
|
||||
EstimatedCost, Confirmation, ConstructionManager, ControlManager, ProcessingState,
|
||||
AccountingExpenses,VisaContent, Remark, U.UnitName,CN.ProfessionalName ,SignMan,AuditMan,unitWork.UnitWorkName
|
||||
AccountingExpenses,VisaContent, Remark, U.UnitName,CN.ProfessionalName ,SignMan,AuditMan,unitWork.UnitWorkName,C.RemarkCode
|
||||
from Comprehensive_SiteVisaManagement C
|
||||
left join Base_Unit U on C.UnitId=U.UnitId
|
||||
left join Base_CNProfessional CN on C.CNProfessionalId=CN.CNProfessionalId
|
||||
@@ -310,7 +310,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
lists = lists.OrderBy(x => x.RemarkCode);
|
||||
if (lists != null)
|
||||
{
|
||||
string projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
string projectName = BLL.ProjectService.GetShortNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
newUrl = uploadfilepath.Replace("现场签证管理导入模板", "现场签证管理(" + projectName + DateTime.Now.ToString("yyyyMMdd") + ")");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="特种设备管理" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="SpecialEquipmentId" AllowCellEditing="true" EnableColumnLines="true"
|
||||
ClicksToEdit="2" DataIDField="SpecialEquipmentId" AllowSorting="true"
|
||||
SortDirection="DESC" OnSort="Grid1_Sort"
|
||||
SortDirection="DESC" OnSort="Grid1_Sort" SortField="RemarkCode"
|
||||
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="true">
|
||||
<Toolbars>
|
||||
@@ -34,6 +34,9 @@
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" ToolTip="导入" Icon="PackageIn" runat="server" OnClick="btnImport_Click" Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
|
||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
@@ -98,7 +101,7 @@
|
||||
</f:Panel>
|
||||
<f:Window ID="Window1" Title="特种设备管理" Hidden="true" EnableIFrame="true" EnableMaximize="true"
|
||||
Target="Parent" EnableResize="false" runat="server" IsModal="true" OnClose="Window1_Close"
|
||||
Width="800px" Height="320px">
|
||||
Width="800px" Height="400px">
|
||||
</f:Window>
|
||||
<f:Window ID="Window2" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
|
||||
Target="Top" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="true"
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.Comprehensive
|
||||
@@ -32,7 +33,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
public void BindGrid()
|
||||
{
|
||||
string strSql = @"select C.SpecialEquipmentId, ProjectId,C.EquipmentId, SunNumber, Status,
|
||||
InformNumber, SubmitDataNumber, MonitoringReportNumber, CompileMan,U.UnitName,eq.SpecialEquipmentName,PositionNum
|
||||
InformNumber, SubmitDataNumber, MonitoringReportNumber, CompileMan,U.UnitName,eq.SpecialEquipmentName,PositionNum,C.RemarkCode
|
||||
from Comprehensive_SpecialEquipment C
|
||||
left join Base_Unit U on C.UnitId=U.UnitId
|
||||
left join Base_SpecialEquipment eq on eq.SpecialEquipmentId = C.EquipmentId
|
||||
@@ -262,5 +263,151 @@ namespace FineUIPro.Web.Comprehensive
|
||||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("SpecialEquipmentDataIn.aspx", "导入 - ")));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 导出按钮
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = Const.SpecialEquipmentTemplateUrl;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
|
||||
var lists = (from x in Funs.DB.Comprehensive_SpecialEquipment
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x);
|
||||
if (sdrpUnitId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
lists = lists.Where(x => x.UnitId == sdrpUnitId.SelectedValue);
|
||||
}
|
||||
if (drpEquipmentId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
lists = lists.Where(x => x.EquipmentId == drpEquipmentId.SelectedValue);
|
||||
}
|
||||
lists = lists.OrderBy(x => x.RemarkCode);
|
||||
if (lists != null)
|
||||
{
|
||||
string projectName = BLL.ProjectService.GetShortNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
newUrl = uploadfilepath.Replace("特种设备管理导入模板", "特种设备管理(" + projectName + DateTime.Now.ToString("yyyyMMdd") + ")");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
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);
|
||||
}
|
||||
// 创建单元格样式
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
|
||||
cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font = workbook.CreateFont();
|
||||
font.FontHeightInPoints = 11;
|
||||
cellStyle.SetFont(font);
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle0 = workbook.CreateCellStyle();
|
||||
cellStyle0.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle0.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font0 = workbook.CreateFont();
|
||||
font0.FontHeightInPoints = 12;
|
||||
font0.IsBold = true;
|
||||
cellStyle0.SetFont(font0);
|
||||
// 第二步:创建新数据行
|
||||
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
|
||||
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
|
||||
NPOI.SS.UserModel.ICell cell;
|
||||
int i = 2;
|
||||
foreach (var item in lists)
|
||||
{
|
||||
// 第二步:创建新数据行
|
||||
row = sheet.CreateRow(i);
|
||||
// 添加数据
|
||||
cell = row.CreateCell(0);
|
||||
cell.CellStyle = cellStyle;
|
||||
string unitName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.UnitId))
|
||||
{
|
||||
unitName = BLL.UnitService.GetUnitNameByUnitId(item.UnitId);
|
||||
}
|
||||
cell.SetCellValue(unitName);//所属单位
|
||||
|
||||
cell = row.CreateCell(1);
|
||||
cell.CellStyle = cellStyle;
|
||||
string specialEquipmentName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.EquipmentId))
|
||||
{
|
||||
var specialEquipment = BLL.SpecialEquipmentService.GetSpecialEquipmentById(item.EquipmentId);
|
||||
if (specialEquipment!=null)
|
||||
{
|
||||
specialEquipmentName = specialEquipment.SpecialEquipmentName;
|
||||
}
|
||||
}
|
||||
cell.SetCellValue(specialEquipmentName);//设备名称
|
||||
|
||||
cell = row.CreateCell(2);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.SunNumber.HasValue ? item.SunNumber.ToString() : "");//总数量
|
||||
|
||||
cell = row.CreateCell(3);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.InformNumber.HasValue ? item.InformNumber.ToString() : "");//告知数量
|
||||
|
||||
cell = row.CreateCell(4);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.SubmitDataNumber.HasValue ? item.SubmitDataNumber.ToString() : "");//提交资料数量
|
||||
|
||||
cell = row.CreateCell(5);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.MonitoringReportNumber.HasValue ? item.MonitoringReportNumber.ToString() : "");//监检报告数量
|
||||
|
||||
cell = row.CreateCell(6);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.PositionNum);//位号
|
||||
|
||||
cell = row.CreateCell(7);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ReportTime.HasValue ? string.Format("{0:yyyy-MM-dd}", item.ReportTime) : "");//填报日期
|
||||
|
||||
cell = row.CreateCell(8);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.RemarkCode.HasValue ? item.RemarkCode.ToString() : "");//标志编号
|
||||
|
||||
i++;
|
||||
}
|
||||
// 第三步:写入文件流
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
workbook.Write(stream);
|
||||
workbook.Close();
|
||||
}
|
||||
string fileName = Path.GetFileName(newUrl);
|
||||
FileInfo info = new FileInfo(newUrl);
|
||||
long fileSize = info.Length;
|
||||
Response.Clear();
|
||||
Response.ContentType = "application/x-zip-compressed";
|
||||
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
Response.TransmitFile(newUrl, 0, fileSize);
|
||||
Response.Flush();
|
||||
Response.Close();
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("当前无记录,无法导出!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -102,6 +102,15 @@ namespace FineUIPro.Web.Comprehensive {
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnOut;
|
||||
|
||||
/// <summary>
|
||||
/// lblPageIndex 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
where x.IsSpecial == true
|
||||
select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
string row0 = pds.Rows[i][0].ToString();
|
||||
if (string.IsNullOrEmpty(row0))
|
||||
@@ -275,6 +275,17 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "标志编号" + "," + "此项为必填项!" + "|";
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
int t = Convert.ToInt32(row8);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "标志编号" + "," + "[" + row8 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(result))
|
||||
{
|
||||
@@ -421,12 +432,12 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
where x.IsSpecial == true
|
||||
select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
Model.Comprehensive_SpecialEquipment oldViewInfo = new Model.Comprehensive_SpecialEquipment();
|
||||
string row0 = pds.Rows[i][0].ToString().Trim();
|
||||
string row1 = pds.Rows[i][1].ToString().Trim();
|
||||
oldViewInfo = oldViewInfos.Where(x => x.RemarkCode == pds.Rows[i][8].ToString().Trim()
|
||||
oldViewInfo = oldViewInfos.Where(x => x.RemarkCode == Funs.GetNewInt(pds.Rows[i][8].ToString().Trim())
|
||||
).FirstOrDefault();
|
||||
if (oldViewInfo == null)
|
||||
{
|
||||
@@ -441,7 +452,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
des.MonitoringReportNumber = Funs.GetNewInt(pds.Rows[i][5].ToString().Trim());
|
||||
des.PositionNum = pds.Rows[i][6].ToString().Trim();
|
||||
des.ReportTime = Funs.GetNewDateTime(pds.Rows[i][7].ToString().Trim());
|
||||
des.RemarkCode = pds.Rows[i][8].ToString().Trim();
|
||||
des.RemarkCode = Funs.GetNewInt(pds.Rows[i][8].ToString().Trim());
|
||||
des.CompileMan = this.CurrUser.UserId;
|
||||
des.Status = BLL.Const.Comprehensive_Compile;
|
||||
BLL.SpecialEquipmentServices.AddEquipment(des);
|
||||
|
||||
@@ -33,7 +33,12 @@
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:TextBox ID="txtPositionNum" runat="server" Label="位号" LabelWidth="130px" LabelAlign="Right"></f:TextBox>
|
||||
<f:TextBox ID="txtPositionNum" runat="server" Label="位号" LabelWidth="130px" LabelAlign="Right"></f:TextBox>
|
||||
<f:NumberBox ID="txtRemarkCode" runat="server" Label="标志编号" LabelAlign="Right" LabelWidth="130px" Required="true" ShowRedStar="true"></f:NumberBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:Panel ID="Panel2" ShowHeader="false" ShowBorder="false" Layout="Column" CssClass="" runat="server">
|
||||
<Items>
|
||||
<f:Label ID="Label1" runat="server" Label="上传附件"
|
||||
|
||||
@@ -66,6 +66,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
this.txtReportTime.Text = string.Format("{0:yyyy-MM-dd}", specialEquipment.ReportTime);
|
||||
}
|
||||
this.txtRemarkCode.Text = specialEquipment.RemarkCode.HasValue ? specialEquipment.RemarkCode.ToString() : "";
|
||||
|
||||
var currApprove = SpecialEquipmentApproveService.GetCurrentApprove(specialEquipment.SpecialEquipmentId);
|
||||
if (currApprove != null)
|
||||
@@ -125,6 +126,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
this.txtPositionNum.Readonly = true;
|
||||
|
||||
this.drpAudit.Readonly = true;
|
||||
this.txtRemarkCode.Readonly = true;
|
||||
|
||||
// this.btnAttach.Enabled = false;
|
||||
|
||||
@@ -167,6 +169,12 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
Alert.ShowInTop("请选择所属单位!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var q = Funs.DB.Comprehensive_SpecialEquipment.FirstOrDefault(x => x.RemarkCode == Funs.GetNewInt(this.txtRemarkCode.Text.Trim()) && (x.SpecialEquipmentId != this.SpecialEquipmentId || (this.SpecialEquipmentId == null && x.SpecialEquipmentId != null)));
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("标志编号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
Model.Comprehensive_SpecialEquipment specialEquipment = new Model.Comprehensive_SpecialEquipment();
|
||||
specialEquipment.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue))
|
||||
@@ -202,7 +210,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
specialEquipment.ReportTime = Convert.ToDateTime(this.txtReportTime.Text);
|
||||
}
|
||||
specialEquipment.PositionNum = this.txtPositionNum.Text.Trim();
|
||||
|
||||
specialEquipment.RemarkCode = Funs.GetNewInt(this.txtRemarkCode.Text.Trim());
|
||||
if (string.IsNullOrEmpty(this.SpecialEquipmentId))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.hdAttachUrl.Text))
|
||||
@@ -242,6 +250,12 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
Alert.ShowInTop("请选择所属单位!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var q = Funs.DB.Comprehensive_SpecialEquipment.FirstOrDefault(x => x.RemarkCode == Funs.GetNewInt(this.txtRemarkCode.Text.Trim()) && (x.SpecialEquipmentId != this.SpecialEquipmentId || (this.SpecialEquipmentId == null && x.SpecialEquipmentId != null)));
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("标志编号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
Model.Comprehensive_SpecialEquipment specialEquipment = new Model.Comprehensive_SpecialEquipment();
|
||||
specialEquipment.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue))
|
||||
@@ -277,6 +291,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
specialEquipment.ReportTime = Convert.ToDateTime(this.txtReportTime.Text);
|
||||
}
|
||||
specialEquipment.PositionNum = this.txtPositionNum.Text.Trim();
|
||||
specialEquipment.RemarkCode = Funs.GetNewInt(this.txtRemarkCode.Text.Trim());
|
||||
if (string.IsNullOrEmpty(this.SpecialEquipmentId))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.hdAttachUrl.Text))
|
||||
|
||||
@@ -102,6 +102,15 @@ namespace FineUIPro.Web.CQMS.Comprehensive {
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtPositionNum;
|
||||
|
||||
/// <summary>
|
||||
/// txtRemarkCode 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox txtRemarkCode;
|
||||
|
||||
/// <summary>
|
||||
/// Panel2 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="培训记录" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="TrainingRecordsId" AllowCellEditing="true" EnableColumnLines="true" ClicksToEdit="2" DataIDField="TrainingRecordsId" AllowSorting="true"
|
||||
SortField="" SortDirection="DESC" OnSort="Grid1_Sort" AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
SortField="RemarkCode" SortDirection="DESC" OnSort="Grid1_Sort" AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="ToolSearch" Position="Top" runat="server" ToolbarAlign="Left">
|
||||
|
||||
@@ -43,7 +43,8 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
C.Hours,
|
||||
C.KeynoteSpeaker,
|
||||
C.Remark,
|
||||
CN.ProfessionalName"
|
||||
CN.ProfessionalName,
|
||||
C.RemarkCode"
|
||||
+ @" FROM Comprehensive_TrainingRecords C "
|
||||
+ @" LEFT JOIN Base_CNProfessional CN ON C.CNProfessionalId=CN.CNProfessionalId"
|
||||
+ @" WHERE C.ProjectId = @ProjectId";
|
||||
@@ -231,7 +232,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
lists = lists.OrderBy(x => x.RemarkCode);
|
||||
if (lists != null)
|
||||
{
|
||||
string projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
string projectName = BLL.ProjectService.GetShortNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
newUrl = uploadfilepath.Replace("培训记录导入模板", "培训记录(" + projectName + DateTime.Now.ToString("yyyyMMdd") + ")");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
|
||||
Reference in New Issue
Block a user