20240428 修改资料收发文登记记录导入导出

This commit is contained in:
毕文静 2024-04-28 17:40:20 +08:00
parent 0aefcb309d
commit fc56b1f6c2
10 changed files with 63 additions and 29 deletions

View File

@ -21,17 +21,6 @@ namespace BLL
return Funs.DB.Comprehensive_DataReceivingDoc.FirstOrDefault(e => e.DataReceivingDocId == dataReceivingDocId); return Funs.DB.Comprehensive_DataReceivingDoc.FirstOrDefault(e => e.DataReceivingDocId == dataReceivingDocId);
} }
/// <summary>
/// 根据编号和名称获取资料收发文登记记录
/// </summary>
/// <param name="fileCode"></param>
/// <param name="fileName"></param>
/// <returns></returns>
public static Model.Comprehensive_DataReceivingDoc GetDataReceivingDocByCodeAndName(string fileCode, string fileName)
{
return Funs.DB.Comprehensive_DataReceivingDoc.FirstOrDefault(e => e.FileCode == fileCode && e.FileName == fileName);
}
/// <summary> /// <summary>
/// 添加资料收发文登记记录 /// 添加资料收发文登记记录
/// </summary> /// </summary>
@ -103,6 +92,7 @@ namespace BLL
newDoc.CompileDate = doc.CompileDate; newDoc.CompileDate = doc.CompileDate;
newDoc.Status = doc.Status; newDoc.Status = doc.Status;
newDoc.AuditMan = doc.AuditMan; newDoc.AuditMan = doc.AuditMan;
newDoc.RemarkCode = doc.RemarkCode;
Funs.DB.SubmitChanges(); Funs.DB.SubmitChanges();
} }
} }

View File

@ -3322,11 +3322,6 @@ namespace BLL
/// </summary> /// </summary>
public const string InspectionMachineTempUrl = "File\\Excel\\CQMS\\机具报验模板.xls"; public const string InspectionMachineTempUrl = "File\\Excel\\CQMS\\机具报验模板.xls";
/// <summary>
/// 资料收发文登记记录模板文件原始虚拟路径
/// </summary>
public const string DataReceivingDocTempUrl = "File\\Excel\\CQMS\\资料收发文登记记录模板.xls";
/// <summary> /// <summary>
/// 培训记录模板文件原始虚拟路径 /// 培训记录模板文件原始虚拟路径
/// </summary> /// </summary>

View File

@ -330,7 +330,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
protected void btnOut_Click(object sender, EventArgs e) protected void btnOut_Click(object sender, EventArgs e)
{ {
string rootPath = Server.MapPath("~/"); string rootPath = Server.MapPath("~/");
string initTemplatePath = Const.DataReceivingDocTempUrl; string initTemplatePath = Const.CQMS_DataReceivingDocTempUrl;
string uploadfilepath = string.Empty; string uploadfilepath = string.Empty;
string newUrl = string.Empty; string newUrl = string.Empty;
uploadfilepath = rootPath + initTemplatePath; uploadfilepath = rootPath + initTemplatePath;
@ -346,10 +346,11 @@ namespace FineUIPro.Web.CQMS.Comprehensive
{ {
lists = lists.Where(x => x.FileName.Contains(this.stxtFileName.Text.Trim())); lists = lists.Where(x => x.FileName.Contains(this.stxtFileName.Text.Trim()));
} }
lists = lists.OrderBy(x => x.FileCode); lists = lists.OrderBy(x => x.RemarkCode);
if (lists != null) if (lists != null)
{ {
newUrl = uploadfilepath.Replace("资料收发文登记记录模板.xls", "资料收发文登记记录.xls"); string projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
newUrl = uploadfilepath.Replace("资料收发文登记记录导入模板", "资料收发文登记记录(" + projectName + "" + DateTime.Now.ToString("yyyyMMdd") + ")");
File.Copy(uploadfilepath, newUrl); File.Copy(uploadfilepath, newUrl);
// 第一步:读取文件流 // 第一步:读取文件流
NPOI.SS.UserModel.IWorkbook workbook; NPOI.SS.UserModel.IWorkbook workbook;
@ -384,7 +385,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0); NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
NPOI.SS.UserModel.IRow row = sheet.GetRow(0); NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
NPOI.SS.UserModel.ICell cell; NPOI.SS.UserModel.ICell cell;
int i = 1; int i = 3;
foreach (var item in lists) foreach (var item in lists)
{ {
// 第二步:创建新数据行 // 第二步:创建新数据行
@ -511,6 +512,10 @@ namespace FineUIPro.Web.CQMS.Comprehensive
} }
cell.SetCellValue(isO);//是否存档 cell.SetCellValue(isO);//是否存档
cell = row.CreateCell(19);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.RemarkCode);//标志编号
i++; i++;
} }
// 第三步:写入文件流 // 第三步:写入文件流

View File

@ -172,7 +172,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
var cns = from x in Funs.DB.Base_CNProfessional select x; var cns = from x in Funs.DB.Base_CNProfessional select x;
for (int i = 0; i < ir; i++) for (int i = 2; i < ir; i++)
{ {
string row0 = pds.Rows[i][0].ToString(); string row0 = pds.Rows[i][0].ToString();
if (string.IsNullOrEmpty(row0)) if (string.IsNullOrEmpty(row0))
@ -263,7 +263,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
string row9 = pds.Rows[i][9].ToString(); string row9 = pds.Rows[i][9].ToString();
if (string.IsNullOrEmpty(row9)) if (string.IsNullOrEmpty(row9))
{ {
result += (i + 2).ToString() + "," + "发出日期" + "," + "此项为必填项!" + "|"; result += (i + 2).ToString() + "," + "上报日期" + "," + "此项为必填项!" + "|";
} }
else else
{ {
@ -273,7 +273,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
} }
catch (Exception) catch (Exception)
{ {
result += (i + 2).ToString() + "," + "发出日期" + "," + "格式错误!" + "|"; result += (i + 2).ToString() + "," + "上报日期" + "," + "格式错误!" + "|";
} }
} }
@ -286,7 +286,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
var unit = units.Where(x => x.UnitName == u.Trim()).FirstOrDefault(); var unit = units.Where(x => x.UnitName == u.Trim()).FirstOrDefault();
if (unit == null) if (unit == null)
{ {
result += (i + 2).ToString() + "," + "接收单位" + "," + "[" + u.Trim() + "]不存在!" + "|"; result += (i + 2).ToString() + "," + "上报接收单位" + "," + "[" + u.Trim() + "]不存在!" + "|";
} }
} }
} }
@ -511,7 +511,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
var cns = from x in Funs.DB.Base_CNProfessional select x; var cns = from x in Funs.DB.Base_CNProfessional select x;
for (int i = 0; i < ir; i++) for (int i = 2; i < ir; i++)
{ {
Model.Comprehensive_DataReceivingDoc oldViewInfo = new Model.Comprehensive_DataReceivingDoc(); Model.Comprehensive_DataReceivingDoc oldViewInfo = new Model.Comprehensive_DataReceivingDoc();
var cn = cns.Where(y => y.ProfessionalName == pds.Rows[i][4].ToString().Trim()).FirstOrDefault(); var cn = cns.Where(y => y.ProfessionalName == pds.Rows[i][4].ToString().Trim()).FirstOrDefault();

View File

@ -60,10 +60,10 @@
<Items> <Items>
<f:FormRow ColumnWidths="33% 67%"> <f:FormRow ColumnWidths="33% 67%">
<Items> <Items>
<f:DatePicker runat="server" DateFormatString="yyyy-MM-dd" Label="发出日期" ID="txtSendDate" <f:DatePicker runat="server" DateFormatString="yyyy-MM-dd" Label="上报日期" ID="txtSendDate"
LabelAlign="Right" LabelWidth="130px"> LabelAlign="Right" LabelWidth="130px">
</f:DatePicker> </f:DatePicker>
<f:DropDownList ID="drpReceiveUnit" runat="server" Label="接收单位" EnableCheckBoxSelect="true" EnableMultiSelect="true" AutoSelectFirstItem="false" LabelAlign="Right" LabelWidth="130px"></f:DropDownList> <f:DropDownList ID="drpReceiveUnit" runat="server" Label="上报接收单位" EnableCheckBoxSelect="true" EnableMultiSelect="true" AutoSelectFirstItem="false" LabelAlign="Right" LabelWidth="130px"></f:DropDownList>
</Items> </Items>
</f:FormRow> </f:FormRow>
<f:FormRow> <f:FormRow>
@ -115,6 +115,13 @@
</f:GroupPanel> </f:GroupPanel>
</Items> </Items>
</f:FormRow> </f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtRemarkCode" runat="server" Label="标志编号" Required="true" ShowRedStar="true" LabelAlign="Right" LabelWidth="130px"></f:TextBox>
<f:Label ID="Label1" runat="server"></f:Label>
<f:Label ID="Label3" runat="server"></f:Label>
</Items>
</f:FormRow>
<%--<f:FormRow> <%--<f:FormRow>
<Items> <Items>
<f:Panel ID="Panel2" ShowHeader="false" ShowBorder="false" Layout="Column" CssClass="" runat="server"> <f:Panel ID="Panel2" ShowHeader="false" ShowBorder="false" Layout="Column" CssClass="" runat="server">

View File

@ -72,6 +72,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
this.txtIssueCopies.Readonly = true; this.txtIssueCopies.Readonly = true;
this.txtIssueUnitReceiver.Readonly = true; this.txtIssueUnitReceiver.Readonly = true;
this.rblIsOnFile.Readonly = true; this.rblIsOnFile.Readonly = true;
this.txtRemarkCode.Readonly = true;
//this.drpAudit.Readonly = true; //this.drpAudit.Readonly = true;
//this.btnAttach.Enabled = false; //this.btnAttach.Enabled = false;
} }
@ -152,6 +153,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
this.rblIsOnFile.SelectedValue = "false"; this.rblIsOnFile.SelectedValue = "false";
} }
} }
this.txtRemarkCode.Text = dataReceivingDoc.RemarkCode;
//var currApprove = DataReceivingDocApproveService.GetCurrentApprove(dataReceivingDoc.DataReceivingDocId); //var currApprove = DataReceivingDocApproveService.GetCurrentApprove(dataReceivingDoc.DataReceivingDocId);
//if (currApprove != null) //if (currApprove != null)
@ -210,6 +212,13 @@ namespace FineUIPro.Web.CQMS.Comprehensive
Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning); Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning);
return; return;
} }
var q = Funs.DB.Comprehensive_DataReceivingDoc.FirstOrDefault(x => x.RemarkCode == this.txtRemarkCode.Text.Trim() && (x.DataReceivingDocId != this.DataReceivingDocId || (this.DataReceivingDocId == null && x.DataReceivingDocId != null)));
if (q != null)
{
Alert.ShowInTop("标志编号已存在!", MessageBoxIcon.Warning);
return;
}
Model.Comprehensive_DataReceivingDoc dataReceivingDoc = new Model.Comprehensive_DataReceivingDoc(); Model.Comprehensive_DataReceivingDoc dataReceivingDoc = new Model.Comprehensive_DataReceivingDoc();
dataReceivingDoc.ProjectId = this.CurrUser.LoginProjectId; dataReceivingDoc.ProjectId = this.CurrUser.LoginProjectId;
dataReceivingDoc.FileCode = this.txtFileCode.Text.Trim(); dataReceivingDoc.FileCode = this.txtFileCode.Text.Trim();
@ -265,6 +274,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
{ {
dataReceivingDoc.IsOnFile = Convert.ToBoolean(this.rblIsOnFile.SelectedValue); dataReceivingDoc.IsOnFile = Convert.ToBoolean(this.rblIsOnFile.SelectedValue);
} }
dataReceivingDoc.RemarkCode = this.txtRemarkCode.Text.Trim();
//if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue)) //if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue))
//{ //{
// dataReceivingDoc.AuditMan = drpAudit.SelectedValue; // dataReceivingDoc.AuditMan = drpAudit.SelectedValue;

View File

@ -264,6 +264,33 @@ namespace FineUIPro.Web.CQMS.Comprehensive {
/// </remarks> /// </remarks>
protected global::FineUIPro.RadioButtonList rblIsOnFile; protected global::FineUIPro.RadioButtonList rblIsOnFile;
/// <summary>
/// txtRemarkCode 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtRemarkCode;
/// <summary>
/// Label1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label Label1;
/// <summary>
/// Label3 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label Label3;
/// <summary> /// <summary>
/// Toolbar1 控件。 /// Toolbar1 控件。
/// </summary> /// </summary>

View File

@ -77,7 +77,7 @@
<add verb="GET" path="res.axd" type="FineUIPro.ResourceHandler, FineUIPro" validate="false"/> <add verb="GET" path="res.axd" type="FineUIPro.ResourceHandler, FineUIPro" validate="false"/>
<add path="ChartImg.axd" verb="GET,POST,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/> <add path="ChartImg.axd" verb="GET,POST,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers> </httpHandlers>
<compilation debug="false" targetFramework="4.6.1"/> <compilation debug="true" targetFramework="4.6.1"/>
<httpRuntime requestValidationMode="2.0" maxRequestLength="2147483647" executionTimeout="36000"/> <httpRuntime requestValidationMode="2.0" maxRequestLength="2147483647" executionTimeout="36000"/>
<authentication mode="Forms"> <authentication mode="Forms">
<forms loginUrl="Login.aspx" name="PUBLISHERCOOKIE" protection="All" timeout="1440" path="/"/> <forms loginUrl="Login.aspx" name="PUBLISHERCOOKIE" protection="All" timeout="1440" path="/"/>