From a032064afc52843cdb92d28ffa5d22a40b2bf167 Mon Sep 17 00:00:00 2001
From: wangqing <945983254@qq.com>
Date: Wed, 26 Jun 2024 01:24:42 +0800
Subject: [PATCH] 1
---
.../RunningLogManagementEdit.aspx | 4 +-
.../RunningLogManagementEdit.aspx.cs | 303 +++++++++---------
.../RunningLogManagementList.aspx | 17 +-
.../RunningLogManagementList.aspx.cs | 105 +++---
4 files changed, 221 insertions(+), 208 deletions(-)
diff --git a/SGGL/FineUIPro.Web/TestRun/ProduceTestRun/RunningLogManagementEdit.aspx b/SGGL/FineUIPro.Web/TestRun/ProduceTestRun/RunningLogManagementEdit.aspx
index 89dadea0..38282c09 100644
--- a/SGGL/FineUIPro.Web/TestRun/ProduceTestRun/RunningLogManagementEdit.aspx
+++ b/SGGL/FineUIPro.Web/TestRun/ProduceTestRun/RunningLogManagementEdit.aspx
@@ -173,7 +173,7 @@
@@ -219,7 +219,7 @@
diff --git a/SGGL/FineUIPro.Web/TestRun/ProduceTestRun/RunningLogManagementEdit.aspx.cs b/SGGL/FineUIPro.Web/TestRun/ProduceTestRun/RunningLogManagementEdit.aspx.cs
index d6ead992..7f635d59 100644
--- a/SGGL/FineUIPro.Web/TestRun/ProduceTestRun/RunningLogManagementEdit.aspx.cs
+++ b/SGGL/FineUIPro.Web/TestRun/ProduceTestRun/RunningLogManagementEdit.aspx.cs
@@ -1,6 +1,7 @@
using BLL;
using FineUIPro.Web.DataShow;
using FineUIPro.Web.ProjectData;
+using Microsoft.Office.Interop.Word;
using Model;
using Newtonsoft.Json.Linq;
using NPOI.SS.Formula.Functions;
@@ -20,13 +21,13 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
///
/// 日志
///
- public string RunningId { get { return (string)ViewState["RunningId"]; } set { ViewState["RunningId"] = value; } }
+ public string MainId { get { return (string)ViewState["MainId"]; } set { ViewState["MainId"] = value; } }
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
- this.RunningId = Request["RunningId"];
+ this.MainId = Request["MainId"];
PageBase();
}
}
@@ -101,28 +102,25 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
ddlSuccessionUser.DataSource = users;
ddlSuccessionUser.DataBind();
ddlSuccessionUser.SelectedValue = this.CurrUser.UserId;
- List options = new List();
- var model = Funs.DB.Running_LogManagement.FirstOrDefault(x => x.RunningId == this.RunningId);
- if (model != null)
+ var mainModel = Funs.DB.Running_LogMain.FirstOrDefault(x => x.MainId == this.MainId);
+ if (mainModel != null)
{
- options.Add(model.SystemId);
- txtJobNo.Text = model.JobNo;
- ddlShiftUser.SelectedValue = model.ShiftUser;
- ddlSuccessionUser.SelectedValue = model.SuccessionUser;
- txtStartData.Text = model.StartData.Value.ToString("yyyy-MM-dd HH:mm:ss");
- txtEndData.Text = model.EndData.Value.ToString("yyyy-MM-dd HH:mm:ss");
- txtHandoverCare.Text = model.HandoverCare;
- var dataInstall = alllist.FirstOrDefault(x => x.PreRunId == model.InstallationId);
- if (dataInstall.PreRunName == "公用工程")
- {
- rdbEngineeringOperation.SelectedValueArray = options.ToArray();
- EngineeringDataBrid();
- }
- if (dataInstall.PreRunName == "工艺装置")
- {
- rdbDeviceOption.SelectedValueArray = options.ToArray();
- DriveDataBrid();
- }
+ var managements = Funs.DB.Running_LogManagement.Where(x => x.MainId == this.MainId).ToList();
+ var manaModel = managements.FirstOrDefault();
+ var options = managements.ConvertAll(x => x.SystemId);
+ txtJobNo.Text = mainModel.JobNo;
+ ddlShiftUser.SelectedValue = manaModel.ShiftUser;
+ ddlSuccessionUser.SelectedValue = manaModel.SuccessionUser;
+ txtStartData.Text = mainModel.StartData.Value.ToString("yyyy-MM-dd HH:mm:ss");
+ txtEndData.Text = mainModel.EndData.Value.ToString("yyyy-MM-dd HH:mm:ss");
+ txtHandoverCare.Text = manaModel.HandoverCare;
+
+
+ rdbEngineeringOperation.SelectedValueArray = options.ToArray();
+ EngineeringDataBrid();
+ rdbDeviceOption.SelectedValueArray = options.ToArray();
+ DriveDataBrid();
+
gvOperationBrid();
gvMaintenanceBrid();
}
@@ -241,25 +239,39 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
ShowNotify("请添加维护问题!", MessageBoxIcon.Warning);
return;
}
-
+ var main = Funs.DB.Running_LogMain.FirstOrDefault(x => x.MainId == this.MainId);
var addlist = new List();
var addoptionlist = new List();
var addmaintenancelist = new List();
- var ids = list.ConvertAll(x => x.RunningId);
- var existlist = Funs.DB.Running_LogManagement.Where(x => ids.Contains(x.RunningId)).ToList();
+ //删除系统日志记录
+ var deleteRunnings = Funs.DB.Running_LogManagement.Where(x => x.MainId == this.MainId);
+ if (deleteRunnings.Count() > 0)
+ {
+ Funs.DB.Running_LogManagement.DeleteAllOnSubmit(deleteRunnings);
+ Funs.DB.SubmitChanges();
+ }
+ bool add = false;
+ if (main == null)
+ {
+ add = true;
+ main = new Running_LogMain();
+ main.MainId = Guid.NewGuid().ToString();
+ main.AddUser = this.CurrUser.UserId;
+ main.AddTime = DateTime.Now;
+ }
+ main.ProjectId = this.CurrUser.LoginProjectId;
+ main.JobNo = txtJobNo.Text;
+ main.ShiftType = ddlShiftType.SelectedValue;
+ main.StartData = DateTime.Parse(txtStartData.Text);
+ main.EndData = DateTime.Parse(txtEndData.Text);
+ if (add) Funs.DB.Running_LogMain.InsertOnSubmit(main);
+ //子系统
foreach (var item in list)
{
- bool add = false;
- var model = existlist.FirstOrDefault(x => x.RunningId == this.RunningId);
- if (model == null)
- {
- add = true;
- model = new Running_LogManagement();
- model.RunningId = Guid.NewGuid().ToString();
- model.ProjectId = this.CurrUser.LoginProjectId;
- model.AddUser = this.CurrUser.UserId;
- model.AddTime = DateTime.Now;
- }
+ var model = new Running_LogManagement();
+ model.RunningId = Guid.NewGuid().ToString();
+ model.ProjectId = this.CurrUser.LoginProjectId;
+ model.MainId = main.MainId;
model.InstallationId = item.InstallationId;
model.ProcessesId = item.ProcessesId;
model.SystemId = item.SystemId;
@@ -272,58 +284,50 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
model.EndData = DateTime.Parse(txtEndData.Text);
model.Situation = item.Situation;
model.Remarks = item.Remarks;
-
- foreach (var itemoption in optionlist)
- {
- addoptionlist.Add(new Running_Operation()
- {
- OperationId = Guid.NewGuid().ToString(),
- RunningId = model.RunningId,
- InstallationId = item.InstallationId,
- ProcessesId = item.ProcessesId,
- SystemId = item.SystemId,
- OperationReason = itemoption.OperationReason,
- OperationHandle = itemoption.OperationHandle,
- ProjectId = this.CurrUser.LoginProjectId,
- AddUser = this.CurrUser.UserId,
- AddTime = DateTime.Now,
- });
- }
- foreach (var itemmain in maintenancelist)
- {
- addmaintenancelist.Add(new Running_Maintenance()
- {
- MaintenanceId = Guid.NewGuid().ToString(),
- RunningId = model.RunningId,
- InstallationId = item.InstallationId,
- ProcessesId = item.ProcessesId,
- SystemId = item.SystemId,
- MaintenanceReason = itemmain.MaintenanceReason,
- MaintenanceHandle = itemmain.MaintenanceHandle,
- ProjectId = this.CurrUser.LoginProjectId,
- AddUser = this.CurrUser.UserId,
- AddTime = DateTime.Now,
- });
- }
- if (add)
- {
- Funs.DB.SubmitChanges();
- addlist.Add(model);
- }
- else
- {
- Funs.DB.SubmitChanges();
- }
+ model.AddUser = this.CurrUser.UserId;
+ model.AddTime = DateTime.Now;
+ model.Sort = item.Sort;
+ addlist.Add(model);
}
+ //操作问题
+ foreach (var itemoption in optionlist)
+ {
+ addoptionlist.Add(new Running_Operation()
+ {
+ OperationId = Guid.NewGuid().ToString(),
+ MainId = main.MainId,
+ OperationReason = itemoption.OperationReason,
+ OperationHandle = itemoption.OperationHandle,
+ ProjectId = this.CurrUser.LoginProjectId,
+ AddUser = this.CurrUser.UserId,
+ AddTime = DateTime.Now,
+ });
+ }
+ //维护问题
+ foreach (var itemmain in maintenancelist)
+ {
+ addmaintenancelist.Add(new Running_Maintenance()
+ {
+ MaintenanceId = Guid.NewGuid().ToString(),
+ MainId = main.MainId,
+ MaintenanceReason = itemmain.MaintenanceReason,
+ MaintenanceHandle = itemmain.MaintenanceHandle,
+ ProjectId = this.CurrUser.LoginProjectId,
+ AddUser = this.CurrUser.UserId,
+ AddTime = DateTime.Now,
+ });
+ }
+
+
if (addlist.Count > 0) Funs.DB.Running_LogManagement.InsertAllOnSubmit(addlist);
- var runIds = list.ConvertAll(x => x.RunningId);
- var deleteOperas = Funs.DB.Running_Operation.Where(x => runIds.Contains(x.RunningId)).ToList();
+
+ var deleteOperas = Funs.DB.Running_Operation.Where(x => x.MainId == this.MainId).ToList();
if (deleteOperas.Count > 0)
{
Funs.DB.Running_Operation.DeleteAllOnSubmit(deleteOperas);
Funs.DB.SubmitChanges();
}
- var deleteMaints = Funs.DB.Running_Maintenance.Where(x => runIds.Contains(x.RunningId)).ToList();
+ var deleteMaints = Funs.DB.Running_Maintenance.Where(x => x.MainId == this.MainId).ToList();
if (deleteMaints.Count > 0)
{
Funs.DB.Running_Maintenance.DeleteAllOnSubmit(deleteMaints);
@@ -342,40 +346,45 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
///
public void EngineeringDataBrid(List list = null)
{
- if (list == null) list = new List();
var engineeringModel = Funs.DB.PreRun_SysDevice.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId && x.PreRunLevel == 1 && x.PreRunName.Trim() == "公用工程");
if (engineeringModel == null)
{
+ list = new List();
gvEngineeringOption.DataSource = list;
gvEngineeringOption.DataBind();
return;
}
- var query = from a in Funs.DB.Running_LogManagement
- join b in Funs.DB.PreRun_SysDevice on a.SystemId equals b.PreRunId
- where a.RunningId == this.RunningId && a.InstallationId == engineeringModel.PreRunId
- select new Running_LogManagementDto
- {
- RunningId = a.RunningId,
- ProjectId = a.ProjectId,
- InstallationId = a.InstallationId,
- ProcessesId = a.ProcessesId,
- SystemId = a.SystemId,
- SystemName = b.PreRunName,
- JobNo = a.JobNo,
- ShiftType = a.ShiftType,
- ShiftUser = a.ShiftUser,
- SuccessionUser = a.SuccessionUser,
- StartData = a.StartData,
- EndData = a.EndData,
- Situation = a.Situation,
- Remarks = a.Remarks,
- HandoverCare = a.HandoverCare,
- AddUser = a.AddUser,
- AddTime = a.AddTime
- };
+ if (list == null)
+ {
+ list = new List();
+ var query = from a in Funs.DB.Running_LogManagement
+ join b in Funs.DB.PreRun_SysDevice on a.SystemId equals b.PreRunId
+ where a.MainId == this.MainId && a.InstallationId == engineeringModel.PreRunId
+ orderby a.Sort ascending
+ select new Running_LogManagementDto
+ {
+ RunningId = a.RunningId,
+ ProjectId = a.ProjectId,
+ InstallationId = a.InstallationId,
+ ProcessesId = a.ProcessesId,
+ SystemId = a.SystemId,
+ SystemName = b.PreRunName,
+ JobNo = a.JobNo,
+ ShiftType = a.ShiftType,
+ ShiftUser = a.ShiftUser,
+ SuccessionUser = a.SuccessionUser,
+ StartData = a.StartData,
+ EndData = a.EndData,
+ Situation = a.Situation,
+ Remarks = a.Remarks,
+ HandoverCare = a.HandoverCare,
+ AddUser = a.AddUser,
+ AddTime = a.AddTime
+ };
- var data = query.ToList();
- if (data.Count > 0) list.AddRange(data);
+ var data = query.ToList();
+ if (data.Count > 0) list.AddRange(data);
+ }
gvEngineeringOption.DataSource = list;
gvEngineeringOption.DataBind();
}
@@ -404,6 +413,7 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
Remarks = values.Value("Remarks"),
AddUser = CurrUser.UserId,
AddTime = DateTime.Now,
+ Sort = i + 1
});
}
return massQuestionLs;
@@ -414,40 +424,46 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
///
public void DriveDataBrid(List list = null)
{
- if (list == null) list = new List();
var deviceModel = Funs.DB.PreRun_SysDevice.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId && x.PreRunLevel == 1 && x.PreRunName.Trim() == "工艺装置");
if (deviceModel == null)
{
+ list = new List();
gvDeviceOption.DataSource = list;
gvDeviceOption.DataBind();
return;
}
- var query = from a in Funs.DB.Running_LogManagement
- join b in Funs.DB.PreRun_SysDevice on a.SystemId equals b.PreRunId
- where a.RunningId == this.RunningId && a.InstallationId == deviceModel.PreRunId
- select new Running_LogManagementDto
- {
- RunningId = a.RunningId,
- ProjectId = a.ProjectId,
- InstallationId = a.InstallationId,
- ProcessesId = a.ProcessesId,
- SystemId = a.SystemId,
- SystemName = b.PreRunName,
- JobNo = a.JobNo,
- ShiftType = a.ShiftType,
- ShiftUser = a.ShiftUser,
- SuccessionUser = a.SuccessionUser,
- StartData = a.StartData,
- EndData = a.EndData,
- Situation = a.Situation,
- Remarks = a.Remarks,
- HandoverCare = a.HandoverCare,
- AddUser = a.AddUser,
- AddTime = a.AddTime
- };
+ if (list == null)
+ {
+ list = new List();
+ var query = from a in Funs.DB.Running_LogManagement
+ join b in Funs.DB.PreRun_SysDevice on a.SystemId equals b.PreRunId
+ where a.MainId == this.MainId && a.InstallationId == deviceModel.PreRunId
+ orderby a.Sort ascending
+ select new Running_LogManagementDto
+ {
+ RunningId = a.RunningId,
+ ProjectId = a.ProjectId,
+ InstallationId = a.InstallationId,
+ ProcessesId = a.ProcessesId,
+ SystemId = a.SystemId,
+ SystemName = b.PreRunName,
+ JobNo = a.JobNo,
+ ShiftType = a.ShiftType,
+ ShiftUser = a.ShiftUser,
+ SuccessionUser = a.SuccessionUser,
+ StartData = a.StartData,
+ EndData = a.EndData,
+ Situation = a.Situation,
+ Remarks = a.Remarks,
+ HandoverCare = a.HandoverCare,
+ AddUser = a.AddUser,
+ AddTime = a.AddTime,
+ Sort = a.Sort
+ };
- var data = query.ToList();
- if (data.Count > 0) list.AddRange(data);
+ var data = query.ToList();
+ if (data.Count > 0) list.AddRange(data);
+ }
gvDeviceOption.DataSource = list;
gvDeviceOption.DataBind();
}
@@ -476,6 +492,7 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
Remarks = values.Value("Remarks"),
AddUser = CurrUser.UserId,
AddTime = DateTime.Now,
+ Sort = i + 1
});
}
return massQuestionLs;
@@ -493,7 +510,8 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
///
public void gvOperationBrid()
{
- var list = Funs.DB.Running_Operation.Where(x => x.RunningId == this.RunningId).ToList();
+ var query = from a in Funs.DB.Running_Operation join b in Funs.DB.Running_LogMain on a.MainId equals b.MainId select a;
+ var list = query.ToList();
gvOperation.DataSource = list;
gvOperation.DataBind();
}
@@ -513,11 +531,8 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
massQuestionLs.Add(new Running_Operation
{
OperationId = IsStrVal(this.gvOperation.Rows[i].DataKeys[0]),
- RunningId = IsStrVal(this.gvOperation.Rows[i].DataKeys[1]),
- ProjectId = this.CurrUser.LoginProjectId,
- InstallationId = IsStrVal(this.gvOperation.Rows[i].DataKeys[2]),
- ProcessesId = IsStrVal(this.gvOperation.Rows[i].DataKeys[3]),
- SystemId = IsStrVal(this.gvOperation.Rows[i].DataKeys[4]),
+ MainId = IsStrVal(this.gvOperation.Rows[i].DataKeys[1]),
+ ProjectId = this.CurrUser.LoginProjectId,
OperationReason = values.Value("OperationReason"),
OperationHandle = values.Value("OperationHandle"),
AddUser = CurrUser.UserId,
@@ -581,7 +596,8 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
///
public void gvMaintenanceBrid()
{
- var list = Funs.DB.Running_Maintenance.Where(x => x.RunningId == this.RunningId).ToList();
+ var query = from a in Funs.DB.Running_Maintenance join b in Funs.DB.Running_LogMain on a.MainId equals b.MainId select a;
+ var list = query.ToList();
gvMaintenance.DataSource = list;
gvMaintenance.DataBind();
}
@@ -601,11 +617,8 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
massQuestionLs.Add(new Running_Maintenance
{
MaintenanceId = IsStrVal(this.gvMaintenance.Rows[i].DataKeys[0]),
- RunningId = IsStrVal(this.gvMaintenance.Rows[i].DataKeys[1]),
+ MainId = IsStrVal(this.gvMaintenance.Rows[i].DataKeys[1]),
ProjectId = this.CurrUser.LoginProjectId,
- InstallationId = IsStrVal(this.gvMaintenance.Rows[i].DataKeys[2]),
- ProcessesId = IsStrVal(this.gvMaintenance.Rows[i].DataKeys[3]),
- SystemId = IsStrVal(this.gvMaintenance.Rows[i].DataKeys[4]),
MaintenanceReason = values.Value("MaintenanceReason"),
MaintenanceHandle = values.Value("MaintenanceHandle"),
AddUser = CurrUser.UserId,
diff --git a/SGGL/FineUIPro.Web/TestRun/ProduceTestRun/RunningLogManagementList.aspx b/SGGL/FineUIPro.Web/TestRun/ProduceTestRun/RunningLogManagementList.aspx
index ff84b5d7..315d61db 100644
--- a/SGGL/FineUIPro.Web/TestRun/ProduceTestRun/RunningLogManagementList.aspx
+++ b/SGGL/FineUIPro.Web/TestRun/ProduceTestRun/RunningLogManagementList.aspx
@@ -68,7 +68,7 @@
+ runat="server" BoxFlex="1" DataKeyNames="MainId" AllowCellEditing="true" ClicksToEdit="2" DataIDField="MainId" AllowSorting="true" OnSort="Grid1_Sort" EnableColumnLines="true" ForceFit="true" AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange" EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" AllowFilters="true" EnableTextSelection="True" EnableMultiSelect="false" EnableCheckBoxSelect="true">
@@ -103,19 +103,9 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
@@ -138,7 +128,6 @@
-
diff --git a/SGGL/FineUIPro.Web/TestRun/ProduceTestRun/RunningLogManagementList.aspx.cs b/SGGL/FineUIPro.Web/TestRun/ProduceTestRun/RunningLogManagementList.aspx.cs
index 78739ad3..88bfc842 100644
--- a/SGGL/FineUIPro.Web/TestRun/ProduceTestRun/RunningLogManagementList.aspx.cs
+++ b/SGGL/FineUIPro.Web/TestRun/ProduceTestRun/RunningLogManagementList.aspx.cs
@@ -14,6 +14,7 @@ using NPOI.SS.Util;
using NPOI.XSSF.UserModel;
using Model;
using NPOI.SS.Formula.Functions;
+using FineUIPro.Web.ProjectData;
namespace FineUIPro.Web.TestRun.ProduceTestRun
{
@@ -80,17 +81,17 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
public void BindGrid()
{
var years = DateTime.Now.Year;
- string strSql = @"select a.RunningId,a.ProjectId,project.ProjectName as ProjectName,a.InstallationId,a.ProcessesId,a.SystemId,inst.PreRunName as InstallationName,proce.PreRunName as ProcessesName,syst.PreRunName as SystemName,a.JobNo,a.ShiftType,(case a.ShiftType when 1 then '白班' else '夜班' end) as ShiftTypeName,a.ShiftUser,shiftuser.UserName as ShiftUserName,a.SuccessionUser,successuser.UserName as SuccessionUserName,a.StartData,a.EndData,a.AddUser,a.AddTime,a.Sort from Running_LogManagement as a inner join Sys_User as shiftuser on shiftuser.UserId=a.ShiftUser inner join Sys_User as successuser on successuser.UserId=a.SuccessionUser inner join Base_Project as project on project.ProjectId=a.ProjectId inner join PreRun_SysDevice as inst on inst.PreRunId=a.InstallationId inner join PreRun_SysDevice as proce on proce.PreRunId=a.ProcessesId inner join PreRun_SysDevice as syst on syst.PreRunId=a.SystemId where a.ProjectId=@ProjectId ";
+ string strSql = @"select a.MainId,a.ProjectId,project.ProjectName as ProjectName,a.JobNo,a.ShiftType,(case a.ShiftType when 1 then '白班' else '夜班' end) as ShiftTypeName,a.StartData,a.EndData,a.AddUser,a.AddTime from Running_LogMain as a inner join Base_Project as project on project.ProjectId=a.ProjectId where a.ProjectId=@ProjectId ";
List listStr = new List();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
- if (!string.IsNullOrWhiteSpace(this.tvControlItem.SelectedNodeID))
- {
- if (this.tvControlItem.SelectedNodeID != "0" && !string.IsNullOrWhiteSpace(this.tvControlItem.SelectedNodeID))
- {
- strSql += " and a.InstallationId=@InstallationId";
- listStr.Add(new SqlParameter("@InstallationId", this.tvControlItem.SelectedNodeID));
- }
- }
+ //if (!string.IsNullOrWhiteSpace(this.tvControlItem.SelectedNodeID))
+ //{
+ // if (this.tvControlItem.SelectedNodeID != "0" && !string.IsNullOrWhiteSpace(this.tvControlItem.SelectedNodeID))
+ // {
+ // strSql += " and a.InstallationId=@InstallationId";
+ // listStr.Add(new SqlParameter("@InstallationId", this.tvControlItem.SelectedNodeID));
+ // }
+ //}
if (!string.IsNullOrWhiteSpace(txtStartData.Text))
{
strSql += " and a.StartData>=@StartData";
@@ -107,16 +108,16 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
strSql += " and a.ShiftType=@ShiftType";
listStr.Add(new SqlParameter("@ShiftType", ddlShiftType.SelectedValue));
}
- strSql += " order by inst.PreRunLevel,inst.Sort,proce.Sort,syst.Sort asc";
+ strSql += " order by a.StartData asc";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
- if (Funs.DB.Running_LogManagement.Count(x => x.StartData.Value.Year == years) > 0)
+ if (Funs.DB.Running_LogMain.Count(x => x.StartData.Value.Year == years) > 0)
{
- var minTime = Funs.DB.Running_LogManagement.Where(x => x.StartData.Value.Year == years).Min(m => m.StartData);
+ var minTime = Funs.DB.Running_LogMain.Where(x => x.StartData.Value.Year == years).Min(m => m.StartData);
lblminTime.Text = $"{years}年日志最小日期:{minTime.Value.ToString("yyyy-MM-dd")}";
}
else
@@ -184,7 +185,7 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
///
protected void btnAdd_Click(object sender, EventArgs e)
{
- PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("RunningLogManagementEdit.aspx?RunningId=", "新增 - ")));
+ PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("RunningLogManagementEdit.aspx?MainId=", "新增 - ")));
}
///
@@ -197,7 +198,7 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
- PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("RunningLogManagementEdit.aspx?RunningId={0}", Grid1.SelectedRowID, "编辑 - ")));
+ PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("RunningLogManagementEdit.aspx?MainId={0}", Grid1.SelectedRowID, "编辑 - ")));
}
///
@@ -211,10 +212,10 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
return;
}
var ids = Grid1.SelectedRowIDArray.ToList();
- var list = Funs.DB.Running_LogManagement.Where(x => ids.Contains(x.RunningId)).ToList();
+ var list = Funs.DB.Running_LogMain.Where(x => ids.Contains(x.MainId)).ToList();
if (list.Count > 0)
{
- Funs.DB.Running_LogManagement.DeleteAllOnSubmit(list);
+ Funs.DB.Running_LogMain.DeleteAllOnSubmit(list);
Funs.DB.SubmitChanges();
BindGrid();
Alert.ShowInTop("删除成功!", MessageBoxIcon.Success);
@@ -231,7 +232,7 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
Alert.ShowInTop("请至少选择记录,最大只可选择一条!", MessageBoxIcon.Warning);
return;
}
- var runningId = this.Grid1.Rows[Grid1.SelectedRowIndex].DataKeys[0].ToString();
+ var mainId = this.Grid1.Rows[Grid1.SelectedRowIndex].DataKeys[0].ToString();
string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
//导出文件
@@ -245,14 +246,20 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
join b in Funs.DB.Base_Project on a.ProjectId equals b.ProjectId
join c in Funs.DB.Sys_User on a.ShiftUser equals c.UserId
join d in Funs.DB.Sys_User on a.SuccessionUser equals d.UserId
- where a.RunningId == runningId
+ join init in Funs.DB.PreRun_SysDevice on a.InstallationId equals init.PreRunId
+ join sys in Funs.DB.PreRun_SysDevice on a.SystemId equals sys.PreRunId
+ where a.MainId == mainId
+ orderby a.Sort ascending
select new
{
a.RunningId,
+ a.MainId,
a.ProjectId,
a.InstallationId,
+ InstallationName = init.PreRunName,
a.ProcessesId,
a.SystemId,
+ SystemName = sys.PreRunName,
a.JobNo,
a.ShiftType,
ShiftTypeName = a.ShiftType == "1" ? "白班" : "夜班",
@@ -269,17 +276,18 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
a.AddTime,
a.Sort
};
- var model = data.FirstOrDefault();
- if (model != null)
+ var list = data.ToList();
+ if (list.Count > 0)
{
+ var firstModel = list.FirstOrDefault();
//操作问题
- var operations = Funs.DB.Running_Operation.Where(x => x.RunningId == model.RunningId).ToList();
+ var operations = Funs.DB.Running_Operation.Where(x => x.MainId == mainId).ToList();
//维护问题
- var maintes = Funs.DB.Running_Maintenance.Where(x => x.RunningId == model.RunningId).ToList();
- string ReportFileName = $"{filePath}Production report({DateTime.Now.ToString("yyyy-MM-dd")} {model.ShiftUserName}).xlsx";
+ var maintes = Funs.DB.Running_Maintenance.Where(x => x.MainId == mainId).ToList();
+ string ReportFileName = $"{filePath}Production report({DateTime.Now.ToString("yyyy-MM-dd")} {firstModel.ShiftUserName}).xlsx";
int rowIndex = 0;
XSSFWorkbook hssfworkbook = new XSSFWorkbook();
- XSSFSheet ws = (XSSFSheet)hssfworkbook.CreateSheet($"Production report({DateTime.Now.ToString("yyyy-MM-dd")} {model.ShiftUserName})");
+ XSSFSheet ws = (XSSFSheet)hssfworkbook.CreateSheet($"Production report({DateTime.Now.ToString("yyyy-MM-dd")} {firstModel.ShiftUserName})");
#region 列宽
@@ -341,7 +349,7 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
//行5
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 0, 5);
ws.AddMergedRegion(region);
- ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue($"Shift:({model.ShiftUserName}) Succession:({model.SuccessionUserName}) {model.StartData.Value.ToString("yyyy-MM-dd")}— {model.EndData.Value.ToString("yyyy-MM-dd")}");
+ ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue($"Shift:({firstModel.ShiftUserName}) Succession:({firstModel.SuccessionUserName}) {firstModel.StartData.Value.ToString("yyyy-MM-dd")}— {firstModel.EndData.Value.ToString("yyyy-MM-dd")}");
ws.GetRow(rowIndex + 4).GetCell(0).CellStyle = styleBold;
//行6
region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 0, 3);
@@ -359,25 +367,29 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
var dataIndex = 5;
- ws = ExcelCreateRowTitle(ws, hssfworkbook, style, dataIndex + 1, dataIndex + 1, 0, 5);
- region = new CellRangeAddress(dataIndex + 1, dataIndex + 1, 0, 3);
- ws.AddMergedRegion(region);
- ws.GetRow(dataIndex + 1).GetCell(0).SetCellValue("DW Station 脱盐水");
- ws.GetRow(dataIndex + 1).GetCell(0).CellStyle = styleLeftBold;
- region = new CellRangeAddress(dataIndex + 1, dataIndex + 1, 4, 5);
- ws.AddMergedRegion(region);
- ws.GetRow(dataIndex + 1).GetCell(4).SetCellValue("");
- ws.GetRow(dataIndex + 1).GetCell(4).CellStyle = leftStyle;
- ws = ExcelCreateRowTitle(ws, hssfworkbook, style, dataIndex + 2, dataIndex + 2, 0, 5, 90);
- region = new CellRangeAddress(dataIndex + 2, dataIndex + 2, 0, 3);
- ws.AddMergedRegion(region);
- ws.GetRow(dataIndex + 2).GetCell(0).SetCellValue(model.Situation);
- ws.GetRow(dataIndex + 2).GetCell(0).CellStyle = leftStyle;
- region = new CellRangeAddress(dataIndex + 2, dataIndex + 2, 4, 5);
- ws.AddMergedRegion(region);
- ws.GetRow(dataIndex + 2).GetCell(4).SetCellValue(model.Remarks);
- ws.GetRow(dataIndex + 2).GetCell(4).CellStyle = leftStyle;
- dataIndex += 2;
+ foreach (var item in list)
+ {
+ ws = ExcelCreateRowTitle(ws, hssfworkbook, style, dataIndex + 1, dataIndex + 1, 0, 5);
+ region = new CellRangeAddress(dataIndex + 1, dataIndex + 1, 0, 3);
+ ws.AddMergedRegion(region);
+ ws.GetRow(dataIndex + 1).GetCell(0).SetCellValue(item.SystemName);
+ ws.GetRow(dataIndex + 1).GetCell(0).CellStyle = styleLeftBold;
+ region = new CellRangeAddress(dataIndex + 1, dataIndex + 1, 4, 5);
+ ws.AddMergedRegion(region);
+ ws.GetRow(dataIndex + 1).GetCell(4).SetCellValue("");
+ ws.GetRow(dataIndex + 1).GetCell(4).CellStyle = leftStyle;
+ ws = ExcelCreateRowTitle(ws, hssfworkbook, style, dataIndex + 2, dataIndex + 2, 0, 5, 90);
+ region = new CellRangeAddress(dataIndex + 2, dataIndex + 2, 0, 3);
+ ws.AddMergedRegion(region);
+ ws.GetRow(dataIndex + 2).GetCell(0).SetCellValue(item.Situation);
+ ws.GetRow(dataIndex + 2).GetCell(0).CellStyle = leftStyle;
+ region = new CellRangeAddress(dataIndex + 2, dataIndex + 2, 4, 5);
+ ws.AddMergedRegion(region);
+ ws.GetRow(dataIndex + 2).GetCell(4).SetCellValue(item.Remarks);
+ ws.GetRow(dataIndex + 2).GetCell(4).CellStyle = leftStyle;
+ dataIndex += 2;
+ }
+
ws = ExcelCreateRowTitle(ws, hssfworkbook, style, dataIndex + 1, dataIndex + 1, 0, 5);
region = new CellRangeAddress(dataIndex + 1, dataIndex + 1, 0, 5);
@@ -387,11 +399,10 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
ws = ExcelCreateRowTitle(ws, hssfworkbook, style, dataIndex + 2, dataIndex + 2, 0, 5, 30);
region = new CellRangeAddress(dataIndex + 2, dataIndex + 2, 0, 5);
ws.AddMergedRegion(region);
- ws.GetRow(dataIndex + 2).GetCell(0).SetCellValue(model.HandoverCare);
+ ws.GetRow(dataIndex + 2).GetCell(0).SetCellValue(firstModel.HandoverCare);
ws.GetRow(dataIndex + 2).GetCell(0).CellStyle = leftStyle;
dataIndex += 2;
-
ws = ExcelCreateRowTitle(ws, hssfworkbook, style, dataIndex + 1, dataIndex + 1, 0, 5);
region = new CellRangeAddress(dataIndex + 1, dataIndex + 1, 0, 5);
ws.AddMergedRegion(region);
@@ -449,7 +460,7 @@ namespace FineUIPro.Web.TestRun.ProduceTestRun
Response.Charset = "GB2312";
Response.ContentEncoding = System.Text.Encoding.UTF8;
// 添加头信息,为"文件下载/另存为"对话框指定默认文件名
- Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode($"Production report({DateTime.Now.ToString("yyyy-MM-dd")} {model.ShiftUserName}).xlsx"));
+ Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode($"Production report({DateTime.Now.ToString("yyyy-MM-dd")} {firstModel.ShiftUserName}).xlsx"));
// 添加头信息,指定文件大小,让浏览器能够显示下载进度
Response.AddHeader("Content-Length", filet.Length.ToString());
// 指定返回的是一个不能被客户端读取的流,必须被下载