提交代码

This commit is contained in:
高飞 2024-07-24 11:36:38 +08:00
parent 2551f96820
commit 6f82435bd2
8 changed files with 356 additions and 9 deletions

View File

@ -4735,6 +4735,10 @@ namespace BLL
/// 月度计划情况模板文件原始虚拟路径
/// </summary>
public const string MonthPlanOutTemplateUrl = "File\\Excel\\DataOut\\月度计划情况.xlsx";
/// <summary>
/// 周进度计划模板文件原始虚拟路径
/// </summary>
public const string WeekPlanOutTemplateUrl = "File\\Excel\\DataOut\\周进度计划.xlsx";
#endregion
#endregion

View File

@ -450,3 +450,59 @@ IP地址:::1
出错时间:07/15/2024 13:19:20
出错时间:07/15/2024 13:19:20
错误信息开始=====>
错误类型:ChangeConflictException
错误信息:2 的 1 更新失败。
错误堆栈:
在 System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode)
在 System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
在 BLL.ProjectService.UpdateProject(Base_Project project) 位置 E:\工作\五环施工平台\CNCEC_SUBQHSE_WUHUAN\SGGL\BLL\ProjectData\ProjectService.cs:行号 193
在 FineUIPro.Web.ProjectData.ProjectSetSave.SaveData() 位置 E:\工作\五环施工平台\CNCEC_SUBQHSE_WUHUAN\SGGL\FineUIPro.Web\ProjectData\ProjectSetSave.aspx.cs:行号 284
在 FineUIPro.Web.ProjectData.ProjectSetSave.btnSave_Click(Object sender, EventArgs e) 位置 E:\工作\五环施工平台\CNCEC_SUBQHSE_WUHUAN\SGGL\FineUIPro.Web\ProjectData\ProjectSetSave.aspx.cs:行号 189
在 FineUIPro.Button.OnClick(EventArgs e)
在 (Button , EventArgs )
在 FineUIPro.Button.RaisePostBackEvent(String eventArgument)
在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
出错时间:07/23/2024 17:52:24
出错文件:http://localhost:8579/ProjectData/ProjectSetSave.aspx
IP地址:::1
操作人员:JT
出错时间:07/23/2024 17:52:24
错误信息开始=====>
错误类型:InvalidOperationException
错误信息:不能添加已经存在的实体。
错误堆栈:
在 System.Data.Linq.Table`1.InsertOnSubmit(TEntity entity)
在 System.Data.Linq.Table`1.InsertAllOnSubmit[TSubEntity](IEnumerable`1 entities)
在 BLL.BOSHENGMonitorService.AddPerson(String projectId, JArray arr, Sys_User user) 位置 E:\工作\五环施工平台\CNCEC_SUBQHSE_WUHUAN\SGGL\BLL\BoSheng\BOSHENGMonitorService.cs:行号 318
出错时间:07/23/2024 18:18:27
出错时间:07/23/2024 18:18:27
错误信息开始=====>
错误类型:InvalidOperationException
错误信息:不能添加已经存在的实体。
错误堆栈:
在 System.Data.Linq.Table`1.InsertOnSubmit(TEntity entity)
在 System.Data.Linq.Table`1.InsertAllOnSubmit[TSubEntity](IEnumerable`1 entities)
在 BLL.BOSHENGMonitorService.AddPerson(String projectId, JArray arr, Sys_User user) 位置 E:\工作\五环施工平台\CNCEC_SUBQHSE_WUHUAN\SGGL\BLL\BoSheng\BOSHENGMonitorService.cs:行号 318
出错时间:07/24/2024 10:37:35
出错时间:07/24/2024 10:37:35
错误信息开始=====>
错误类型:InvalidOperationException
错误信息:不能添加已经存在的实体。
错误堆栈:
在 System.Data.Linq.Table`1.InsertOnSubmit(TEntity entity)
在 System.Data.Linq.Table`1.InsertAllOnSubmit[TSubEntity](IEnumerable`1 entities)
在 BLL.BOSHENGMonitorService.AddPerson(String projectId, JArray arr, Sys_User user) 位置 E:\工作\五环施工平台\CNCEC_SUBQHSE_WUHUAN\SGGL\BLL\BoSheng\BOSHENGMonitorService.cs:行号 318
出错时间:07/24/2024 11:14:23
出错时间:07/24/2024 11:14:23

View File

@ -19056,7 +19056,7 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@ -334,7 +334,8 @@ namespace FineUIPro.Web.HSSE.SitePerson
}
else
{
if (this.drpIdcardType.SelectedValue == "SHENFEN_ZHENGJIAN" && (IdCard.Length != 18 && IdCard.Length != 15))
var project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
if (this.drpIdcardType.SelectedValue == "SHENFEN_ZHENGJIAN" && (IdCard.Length != 18 && IdCard.Length != 15) && (project.IsForeign == null || project.IsForeign == false))
{
ShowNotify("身份证号码位数不对!", MessageBoxIcon.Warning);
return;
@ -955,7 +956,8 @@ namespace FineUIPro.Web.HSSE.SitePerson
{
ShowNotify("输入的身份证号码已存在!", MessageBoxIcon.Warning);
}
if (this.drpIdcardType.SelectedValue == "SHENFEN_ZHENGJIAN")
var project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
if (this.drpIdcardType.SelectedValue == "SHENFEN_ZHENGJIAN" && (project.IsForeign == null || project.IsForeign == false))
{
if (!IDCardValid.CheckIDCard(idCard))
{

View File

@ -35,6 +35,9 @@
<f:Button ID="btnImport" ToolTip="导入" Icon="ApplicationGet" runat="server"
OnClick="btnImport_Click">
</f:Button>
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" Text="" ToolTip="导出" Icon="FolderUp"
EnableAjax="false" DisableControlBeforePostBack="false">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
@ -45,7 +48,7 @@
<f:Tab ID="Tab1" Title="本周计划完成情况" BodyPadding="5px" Layout="VBox" IconFont="Bookmark" runat="server"
TitleToolTip="本周计划完成情况">
<Items>
<f:Grid ID="Grid2" IsFluid="true" CssClass="blockpanel" ShowBorder="true" ShowHeader="false" runat="server" EnableCollapse="false" Height="500px"
<f:Grid ID="Grid2" IsFluid="true" CssClass="blockpanel" ShowBorder="true" ShowHeader="false" runat="server" EnableCollapse="false" Height="500px" PageSize="1000"
DataKeyNames="WeekPlanId" DataIDField="WeekPlanId" EnableColumnLines="true" ForceFit="true" AllowCellEditing="true" ClicksToEdit="1">
<Columns>
<f:TemplateField ColumnID="tfPageIndex" Width="55px" HeaderText="序号" HeaderTextAlign="Center" TextAlign="Center"

View File

@ -8,6 +8,8 @@ using System.Data;
using System.Data.SqlClient;
using BLL;
using Newtonsoft.Json.Linq;
using System.IO;
using NPOI.SS.Util;
namespace FineUIPro.Web.JDGL.Check
{
@ -290,5 +292,276 @@ where mp.ProjectId=@ProjectId2 and mp.WeekNo=@WeekNo2 order by mp.SortIndex";
{
BindGrid();
}
#region
/// 导出按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnOut_Click(object sender, EventArgs e)
{
if (Grid1.Rows.Count == 0)
{
ShowNotify("无数据可导出!", MessageBoxIcon.Warning);
return;
}
string rootPath = Server.MapPath("~/");
string initTemplatePath = string.Empty;
string uploadfilepath = string.Empty;
string newUrl = string.Empty;
string filePath = string.Empty;
initTemplatePath = Const.WeekPlanOutTemplateUrl;
uploadfilepath = rootPath + initTemplatePath;
newUrl = uploadfilepath.Replace(".xlsx", "(" + this.drpWeekNo.SelectedItem.Text + ").xlsx");
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);
}
Model.SGGLDB db = Funs.DB;
var units = from x in db.Base_Unit select x;
var users = from x in db.Sys_User select x;
string weekNo2 = string.Empty;
var weekPlan = Funs.DB.JDGL_WeekPlan.FirstOrDefault(x => x.WeekNo == this.drpWeekNo.SelectedValue);
if (weekPlan != null)
{
if (weekPlan.StartDate != null)
{
this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", weekPlan.StartDate);
}
if (weekPlan.EndDate != null)
{
this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", weekPlan.EndDate);
}
var lastWeekPlan = (from x in Funs.DB.JDGL_WeekPlan where x.ProjectId == this.CurrUser.LoginProjectId && x.StartDate < weekPlan.StartDate orderby x.StartDate descending select x).FirstOrDefault();
if (lastWeekPlan != null)
{
weekNo2 = lastWeekPlan.WeekNo;
}
}
else
{
this.txtStartDate.Text = string.Empty;
this.txtEndDate.Text = string.Empty;
}
string strSql = @"select mp.*,u.UnitName,us.UserName as DutyPersonName,uw.UnitWorkName,cn.ProfessionalName,case mp.IsOK when 1 then '已完成' when 0 then '未完成' else '' end as IsOKStr from [dbo].[JDGL_WeekPlan] mp
left join Base_Unit u on u.UnitId=mp.UnitId
left join Sys_User us on us.UserId=mp.DutyPerson
left join WBS_UnitWork uw on uw.UnitWorkId=mp.UnitWork
left join Base_CNProfessional cn on cn.CNProfessionalId=mp.Major
where mp.ProjectId=@ProjectId and mp.WeekNo=@WeekNo order by mp.SortIndex";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
string weekNo = string.Empty;
if (!string.IsNullOrEmpty(this.drpWeekNo.SelectedValue))
{
weekNo = this.drpWeekNo.SelectedValue;
}
listStr.Add(new SqlParameter("@WeekNo", weekNo));
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
string strSql2 = @"select mp.*,u.UnitName,us.UserName as DutyPersonName,uw.UnitWorkName,cn.ProfessionalName,case mp.IsOK when 1 then '已完成' when 0 then '未完成' else '' end as IsOKStr from [dbo].[JDGL_WeekPlan] mp
left join Base_Unit u on u.UnitId=mp.UnitId
left join Sys_User us on us.UserId=mp.DutyPerson
left join WBS_UnitWork uw on uw.UnitWorkId=mp.UnitWork
left join Base_CNProfessional cn on cn.CNProfessionalId=mp.Major
where mp.ProjectId=@ProjectId2 and mp.WeekNo=@WeekNo2 order by mp.SortIndex";
List<SqlParameter> listStr2 = new List<SqlParameter>();
listStr2.Add(new SqlParameter("@ProjectId2", this.CurrUser.LoginProjectId));
listStr2.Add(new SqlParameter("@WeekNo2", weekNo2));
SqlParameter[] parameter2 = listStr2.ToArray();
DataTable tb2 = SQLHelper.GetDataTableRunText(strSql2, parameter2);
// 创建单元格样式
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;
cellStyle.WrapText = true;
var font = workbook.CreateFont();
font.FontHeightInPoints = 11;
cellStyle.SetFont(font);
NPOI.SS.UserModel.ICellStyle cellStyleT = workbook.CreateCellStyle();
cellStyleT.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyleT.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyleT.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyleT.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyleT.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
cellStyleT.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
cellStyleT.WrapText = true;
var fontT = workbook.CreateFont();
fontT.FontHeightInPoints = 16;
cellStyleT.SetFont(fontT);
// 第二步:创建新数据行
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
NPOI.SS.UserModel.IRow row = null;
NPOI.SS.UserModel.ICell cell;
int i = 2;
for (int j = 0; j < tb2.Rows.Count; j++)
{
// 第二步:创建新数据行
row = sheet.CreateRow(i);
// 添加数据
cell = row.CreateCell(0);
cell.CellStyle = cellStyle;
cell.SetCellValue((i-1).ToString());
cell = row.CreateCell(1);
cell.CellStyle = cellStyle;
cell.SetCellValue(tb2.Rows[j]["UnitWorkName"].ToString());
cell = row.CreateCell(2);
cell.CellStyle = cellStyle;
cell.SetCellValue(tb2.Rows[j]["ProfessionalName"].ToString());
cell = row.CreateCell(3);
cell.CellStyle = cellStyle;
cell.SetCellValue(tb2.Rows[j]["WorkContent"].ToString());
cell = row.CreateCell(4);
cell.CellStyle = cellStyle;
cell.SetCellValue(tb2.Rows[j]["UnitName"].ToString());
cell = row.CreateCell(5);
cell.CellStyle = cellStyle;
cell.SetCellValue(tb2.Rows[j]["DutyPersonName"].ToString());
cell = row.CreateCell(6);
cell.CellStyle = cellStyle;
string planDate = string.Empty;
if (tb2.Rows[j]["PlanDate"] != DBNull.Value)
{
planDate = string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(tb2.Rows[j]["PlanDate"].ToString()));
}
cell.SetCellValue(planDate);
cell = row.CreateCell(7);
cell.CellStyle = cellStyle;
cell.SetCellValue(tb2.Rows[j]["IsOKStr"].ToString());
cell = row.CreateCell(8);
cell.CellStyle = cellStyle;
cell.SetCellValue(tb2.Rows[j]["Remark"].ToString());
i++;
}
row = sheet.CreateRow(i);
// 添加数据
cell = row.CreateCell(0);
cell.CellStyle = cellStyleT;
cell.SetCellValue("下周计划");
cell = row.CreateCell(1);
cell.CellStyle = cellStyleT;
cell.SetCellValue(string.Empty);
cell = row.CreateCell(2);
cell.CellStyle = cellStyleT;
cell.SetCellValue(string.Empty);
cell = row.CreateCell(3);
cell.CellStyle = cellStyleT;
cell.SetCellValue(string.Empty);
cell = row.CreateCell(4);
cell.CellStyle = cellStyleT;
cell.SetCellValue(string.Empty);
cell = row.CreateCell(5);
cell.CellStyle = cellStyleT;
cell.SetCellValue(string.Empty);
cell = row.CreateCell(6);
cell.CellStyle = cellStyleT;
cell.SetCellValue(string.Empty);
cell = row.CreateCell(7);
cell.CellStyle = cellStyleT;
cell.SetCellValue(string.Empty);
cell = row.CreateCell(8);
cell.CellStyle = cellStyleT;
cell.SetCellValue(string.Empty);
sheet.AddMergedRegion(new CellRangeAddress(i, i, 0, 8));
row.Height = (short)(30 * 17);
i++;
row = sheet.CreateRow(i);
cell = row.CreateCell(0);
cell.CellStyle = cellStyle;
cell.SetCellValue("序号");
cell = row.CreateCell(1);
cell.CellStyle = cellStyle;
cell.SetCellValue("工序/单位工程");
cell = row.CreateCell(2);
cell.CellStyle = cellStyle;
cell.SetCellValue("专业");
cell = row.CreateCell(3);
cell.CellStyle = cellStyle;
cell.SetCellValue("工作项");
cell = row.CreateCell(4);
cell.CellStyle = cellStyle;
cell.SetCellValue("责任单位");
cell = row.CreateCell(5);
cell.CellStyle = cellStyle;
cell.SetCellValue("五环责任人");
cell = row.CreateCell(6);
cell.CellStyle = cellStyle;
cell.SetCellValue("计划完成时间");
cell = row.CreateCell(7);
cell.CellStyle = cellStyle;
cell.SetCellValue("完成状态");
cell = row.CreateCell(8);
cell.CellStyle = cellStyle;
cell.SetCellValue("备注");
i++;
int a = 1;
for (int j = 0; j < tb.Rows.Count; j++)
{
// 第二步:创建新数据行
row = sheet.CreateRow(i);
// 添加数据
cell = row.CreateCell(0);
cell.CellStyle = cellStyle;
cell.SetCellValue(a.ToString());
cell = row.CreateCell(1);
cell.CellStyle = cellStyle;
cell.SetCellValue(tb.Rows[j]["UnitWorkName"].ToString());
cell = row.CreateCell(2);
cell.CellStyle = cellStyle;
cell.SetCellValue(tb.Rows[j]["ProfessionalName"].ToString());
cell = row.CreateCell(3);
cell.CellStyle = cellStyle;
cell.SetCellValue(tb.Rows[j]["WorkContent"].ToString());
cell = row.CreateCell(4);
cell.CellStyle = cellStyle;
cell.SetCellValue(tb.Rows[j]["UnitName"].ToString());
cell = row.CreateCell(5);
cell.CellStyle = cellStyle;
cell.SetCellValue(tb.Rows[j]["DutyPersonName"].ToString());
cell = row.CreateCell(6);
cell.CellStyle = cellStyle;
string planDate = string.Empty;
if (tb.Rows[j]["PlanDate"] != DBNull.Value)
{
planDate = string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(tb.Rows[j]["PlanDate"].ToString()));
}
cell.SetCellValue(planDate);
cell = row.CreateCell(7);
cell.CellStyle = cellStyle;
cell.SetCellValue(tb.Rows[j]["IsOKStr"].ToString());
cell = row.CreateCell(8);
cell.CellStyle = cellStyle;
cell.SetCellValue(tb.Rows[j]["Remark"].ToString());
i++;
a++;
}
// 第三步:写入文件流
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);
}
#endregion
}
}

View File

@ -120,6 +120,15 @@ namespace FineUIPro.Web.JDGL.Check {
/// </remarks>
protected global::FineUIPro.Button btnImport;
/// <summary>
/// btnOut 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnOut;
/// <summary>
/// TabStrip1 控件。
/// </summary>