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
@@ -330,7 +330,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
protected void btnOut_Click(object sender, EventArgs e)
{
string rootPath = Server.MapPath("~/");
string initTemplatePath = Const.DataReceivingDocTempUrl;
string initTemplatePath = Const.CQMS_DataReceivingDocTempUrl;
string uploadfilepath = string.Empty;
string newUrl = string.Empty;
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.OrderBy(x => x.FileCode);
lists = lists.OrderBy(x => x.RemarkCode);
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);
// 第一步:读取文件流
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.IRow row = sheet.GetRow(0);
NPOI.SS.UserModel.ICell cell;
int i = 1;
int i = 3;
foreach (var item in lists)
{
// 第二步:创建新数据行
@@ -511,6 +512,10 @@ namespace FineUIPro.Web.CQMS.Comprehensive
}
cell.SetCellValue(isO);//是否存档
cell = row.CreateCell(19);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.RemarkCode);//标志编号
i++;
}
// 第三步:写入文件流
@@ -172,7 +172,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 = 2; i < ir; i++)
{
string row0 = pds.Rows[i][0].ToString();
if (string.IsNullOrEmpty(row0))
@@ -263,7 +263,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
string row9 = pds.Rows[i][9].ToString();
if (string.IsNullOrEmpty(row9))
{
result += (i + 2).ToString() + "," + "发出日期" + "," + "此项为必填项!" + "|";
result += (i + 2).ToString() + "," + "上报日期" + "," + "此项为必填项!" + "|";
}
else
{
@@ -273,7 +273,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
}
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();
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;
for (int i = 0; i < ir; i++)
for (int i = 2; i < ir; i++)
{
Model.Comprehensive_DataReceivingDoc oldViewInfo = new Model.Comprehensive_DataReceivingDoc();
var cn = cns.Where(y => y.ProfessionalName == pds.Rows[i][4].ToString().Trim()).FirstOrDefault();
@@ -60,10 +60,10 @@
<Items>
<f:FormRow ColumnWidths="33% 67%">
<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">
</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>
</f:FormRow>
<f:FormRow>
@@ -115,6 +115,13 @@
</f:GroupPanel>
</Items>
</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>
<Items>
<f:Panel ID="Panel2" ShowHeader="false" ShowBorder="false" Layout="Column" CssClass="" runat="server">
@@ -72,6 +72,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
this.txtIssueCopies.Readonly = true;
this.txtIssueUnitReceiver.Readonly = true;
this.rblIsOnFile.Readonly = true;
this.txtRemarkCode.Readonly = true;
//this.drpAudit.Readonly = true;
//this.btnAttach.Enabled = false;
}
@@ -152,6 +153,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
this.rblIsOnFile.SelectedValue = "false";
}
}
this.txtRemarkCode.Text = dataReceivingDoc.RemarkCode;
//var currApprove = DataReceivingDocApproveService.GetCurrentApprove(dataReceivingDoc.DataReceivingDocId);
//if (currApprove != null)
@@ -210,6 +212,13 @@ namespace FineUIPro.Web.CQMS.Comprehensive
Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning);
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();
dataReceivingDoc.ProjectId = this.CurrUser.LoginProjectId;
dataReceivingDoc.FileCode = this.txtFileCode.Text.Trim();
@@ -265,6 +274,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
{
dataReceivingDoc.IsOnFile = Convert.ToBoolean(this.rblIsOnFile.SelectedValue);
}
dataReceivingDoc.RemarkCode = this.txtRemarkCode.Text.Trim();
//if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue))
//{
// dataReceivingDoc.AuditMan = drpAudit.SelectedValue;
@@ -264,6 +264,33 @@ namespace FineUIPro.Web.CQMS.Comprehensive {
/// </remarks>
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>
/// Toolbar1 控件。
/// </summary>