This commit is contained in:
2024-05-25 17:32:50 +08:00
6 changed files with 653 additions and 149 deletions
@@ -21,7 +21,7 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
}
void BindGrid()
{
var list=Funs.DB.PTP_TestPackage_ImportErrorLog.Where(t=>t.BatchNo == batchNo).OrderBy(t=>t.TestPackageNo).ToList();
var list = Funs.DB.PTP_TestPackage_ImportErrorLog.Where(t => t.BatchNo == batchNo).OrderBy(t => t.RowId).ToList();
this.Grid1.DataSource = list;
this.Grid1.DataBind();
}
@@ -8,8 +8,7 @@
<title>委托单导入</title>
<link href="../res/css/common.css" rel="stylesheet" type="text/css" />
<style>
.f-grid-row .f-grid-cell-inner
{
.f-grid-row .f-grid-cell-inner {
white-space: normal;
word-break: break-all;
}
@@ -17,50 +16,79 @@
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" OnCustomEvent="PageManager1_CustomEvent" />
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" ToolbarAlign="Right" runat="server">
<Items>
<f:Button ID="btnAudit" Icon="ApplicationEdit" Text="审核" runat="server" ToolTip="审核" ValidateForms="SimpleForm1"
OnClick="btnAudit_Click">
</f:Button>
<f:Button ID="btnImport" Icon="ApplicationGet" Text="导入" runat="server" ToolTip="导入" ValidateForms="SimpleForm1"
OnClick="btnImport_Click">
</f:Button>
<f:Button ID="btnDownLoad" runat="server" Text="下载模板" Icon="ApplicationGo" ToolTip="下载模板" OnClick="btnDownLoad_Click">
</f:Button>
<%--<f:Button ID="btnOut" Icon="Pencil" runat="server" Text="导出" ToolTip="导出错误列表" ValidateForms="SimpleForm1"
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" OnCustomEvent="PageManager1_CustomEvent" />
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" ToolbarAlign="Right" runat="server">
<Items>
<f:Button ID="btnAudit" Icon="ApplicationEdit" Text="审核" runat="server" ToolTip="审核" ValidateForms="SimpleForm1"
OnClick="btnAudit_Click">
</f:Button>
<f:Button ID="btnImport" Icon="ApplicationGet" Text="导入" runat="server" ToolTip="导入" ValidateForms="SimpleForm1"
OnClick="btnImport_Click">
</f:Button>
<f:Button ID="btnDownLoad" runat="server" Text="下载模板" Icon="ApplicationGo" ToolTip="下载模板" OnClick="btnDownLoad_Click">
</f:Button>
<%--<f:Button ID="btnOut" Icon="Pencil" runat="server" Text="导出" ToolTip="导出错误列表" ValidateForms="SimpleForm1"
OnClick="btnOut_Click" Hidden="true"></f:Button>--%>
</Items>
</f:Toolbar>
</Toolbars>
<Rows>
<f:FormRow>
<Items>
<f:FileUpload runat="server" ID="fuAttachUrl" EmptyText="选择要导入的文件" Label="选择要导入的文件"
LabelWidth="150px">
</f:FileUpload>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:HiddenField ID="hdFileName" runat="server">
</f:HiddenField>
<f:HiddenField ID="hdCheckResult" runat="server">
</f:HiddenField>
<f:Label ID="lbResult" runat="server" Label="审核结果"></f:Label>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<%--<f:Label ID="lblBottom" runat="server" Text="说明:规则是">
</Items>
</f:Toolbar>
</Toolbars>
<Rows>
<f:FormRow>
<Items>
<f:FileUpload runat="server" ID="fuAttachUrl" EmptyText="选择要导入的文件" Label="选择要导入的文件"
LabelWidth="150px">
</f:FileUpload>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:HiddenField ID="hdFileName" runat="server">
</f:HiddenField>
<f:HiddenField ID="hdCheckResult" runat="server">
</f:HiddenField>
<f:Label ID="lbResult" runat="server" Label="审核结果"></f:Label>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<%--<f:Label ID="lblBottom" runat="server" Text="说明:规则是">
</f:Label>--%>
</Items>
</f:FormRow>
</Rows>
</f:Form>
</Items>
</f:FormRow>
</Rows>
<Rows>
<f:FormRow>
<Items>
<f:Grid ID="Grid1" ShowBorder="true" Hidden="true" ShowHeader="false" Title="委托单导入错误日志" runat="server" EnableCollapse="false"
DataKeyNames="ID" PageSize="100" AllowPaging="true">
<Columns>
<f:RowNumberField />
<f:RenderField ColumnID="RowID" Width="80px" DataField="RowID" HeaderText="行号" />
<f:RenderField ColumnID="TrustBatchCode" MinWidth="80" DataField="TrustBatchCode" HeaderText="委托单编号" />
<f:RenderField ColumnID="InstallCode" MinWidth="80" DataField="InstallCode" HeaderText="装置编号" />
<f:RenderField ColumnID="AreaCode" MinWidth="80" DataField="AreaCode" HeaderText="区域编号" />
<f:RenderField ColumnID="PipelineCode" MinWidth="80" DataField="PipelineCode" HeaderText="管线号" />
<f:RenderField ColumnID="WeldJointCode" MinWidth="80" DataField="WeldJointCode" HeaderText="焊口号" />
<f:RenderField ColumnID="DetectionType" MinWidth="80" DataField="DetectionType" HeaderText="探伤类型" />
<f:RenderField ColumnID="TrustDate" MinWidth="80" DataField="TrustDate" HeaderText="委托日期" />
<f:RenderField ColumnID="UnitCode" MinWidth="80" DataField="UnitCode" HeaderText="检测单位编号" />
<f:RenderField ColumnID="SurfaceState" MinWidth="80" DataField="SurfaceState" HeaderText="表面状态" />
<f:RenderField ColumnID="Opportunity" MinWidth="80" DataField="Opportunity" HeaderText="检测时机" />
<f:TemplateField HeaderText="错误原因" MinWidth="500">
<ItemTemplate>
<asp:Label ID="lablRemark" runat="server" Text='<%#Eval("Remark") %>' ForeColor="Red"></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderField ColumnID="CreatedTime" MinWidth="150" DataField="CreatedTime" HeaderText="导入时间" />
</Columns>
</f:Grid>
</Items>
</f:FormRow>
</Rows>
</f:Form>
</form>
</body>
</html>
@@ -8,6 +8,7 @@ using System.Web.UI;
using BLL;
using FineUIPro.Web.common.ProjectSet;
using FineUIPro.Web.Common.ProjectSet;
using Model;
namespace FineUIPro.Web.WeldingProcess.TrustManage
{
@@ -88,15 +89,19 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
if (ds.Tables.Count > 0)
{
string result = string.Empty;
List<Model.Batch_BatchTrust> trustList= new List<Model.Batch_BatchTrust>();
List<Model.Batch_BatchTrust> trustList = new List<Model.Batch_BatchTrust>();
var units = from x in Funs.DB.Base_Unit select x;
var area = from x in Funs.DB.Project_WorkArea where x.ProjectId == this.CurrUser.LoginProjectId select x;
var installation = from x in Funs.DB.Project_Installation where x.ProjectId == this.CurrUser.LoginProjectId select x;
var trustIn = from x in Funs.DB.View_TrustBathcIn where x.ProjectId == this.CurrUser.LoginProjectId select x;
var pipeList = from x in Funs.DB.Pipeline_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId select x;
List<Model.TrustBatchImportErrorLog> logListData = new List<Model.TrustBatchImportErrorLog>();
string BatchNo = DateTime.Now.ToString("yyyyMMddHHmmss");
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
string result = string.Empty;
var log = new Model.TrustBatchImportErrorLog();
string col0 = ds.Tables[0].Rows[i][0].ToString().Trim();
string col1 = ds.Tables[0].Rows[i][1].ToString().Trim();
string col2 = ds.Tables[0].Rows[i][2].ToString().Trim();
@@ -107,18 +112,33 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
string col7 = ds.Tables[0].Rows[i][7].ToString().Trim();
string col8 = ds.Tables[0].Rows[i][8].ToString().Trim();
string col9 = ds.Tables[0].Rows[i][9].ToString().Trim();
log.Id = SQLHelper.GetNewID(typeof(TrustBatchImportErrorLog));
log.RowID = (i + 2);
log.BatchNo = BatchNo;
log.TrustBatchCode = col0;
log.InstallCode = col1;
log.AreaCode = col2;
log.PipelineCode = col3;
log.WeldJointCode = col4;
log.DetectionType = col5;
log.TrustDate = col6;
log.UnitCode = col7;
log.SurfaceState = col8;
log.Opportunity = col9;
log.CreatedTime = DateTime.Now;
Model.Batch_BatchTrust t = new Model.Batch_BatchTrust();
if (string.IsNullOrEmpty(col0))
{
result += "第" + (i + 2).ToString() + "行," + "委托单号" + "," + "此项为必填项!" + "|";
result += "委托单号此项为必填项!" + "|";
}
else
{
var oldTrust = Funs.DB.Batch_BatchTrust.FirstOrDefault(x => x.TrustBatchCode == col0);
if (oldTrust != null)
{
result += "第" + (i + 2).ToString() + "行," + "委托单号" + "," + "[" + col0 + "]已存在!" + "|";
result += "委托单号 [" + col0 + "]已存在!" + "|";
}
else
{
@@ -132,7 +152,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
Model.Project_Installation ins = installation.FirstOrDefault(x => x.InstallationCode == col1);
if (ins == null)
{
result += "第" + (i + 2).ToString() + "行," + "装置编号" + "," + "[" + col1 + "]不存在!" + "|";
result += "装置编号 [" + col1 + "]不存在!" + "|";
}
else
{
@@ -142,7 +162,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
}
else
{
result += "第" + (i + 2).ToString() + "行," + "装置编号" + "," + "此项为必填项!" + "|";
result += "装置编号此项为必填项!" + "|";
}
string workAreaId = string.Empty;
@@ -151,7 +171,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
Model.Project_WorkArea workArea = area.FirstOrDefault(x => x.WorkAreaCode == col2 && x.InstallationId == installationId);
if (workArea == null)
{
result += "第" + (i + 2).ToString() + "行," + "区域编号" + "," + "[" + col2 + "]不存在!" + "|";
result += "区域编号 [" + col2 + "]不存在!" + "|";
}
else
{
@@ -161,7 +181,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
}
else
{
result += "第" + (i + 2).ToString() + "行," + "区域编号" + "," + "此项为必填项!" + "|";
result += "区域编号此项为必填项!" + "|";
}
string pipelineId = string.Empty;
@@ -170,7 +190,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
var pipe = pipeList.FirstOrDefault(x => x.PipelineCode == col3 && x.WorkAreaId == workAreaId);
if (pipe == null)
{
result += "第" + (i + 2).ToString() + "行," + "该区域管线号" + "," + "[" + col3 + "]不存在!" + "|";
result += "该区域管线号 [" + col3 + "]不存在!" + "|";
}
else
{
@@ -180,7 +200,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
}
else
{
result += "第" + (i + 2).ToString() + "行," + "管线号" + "," + "此项为必填项!" + "|";
result += "管线号此项为必填项!" + "|";
}
string weldJointId = string.Empty;
@@ -189,23 +209,23 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
var weldJoint = from x in Funs.DB.Pipeline_WeldJoint where x.PipelineId == pipelineId && x.WeldJointCode == col4 select x;
if (weldJoint.Count() == 0)
{
result += "第" + (i + 2).ToString() + "行," + "焊口号" + "," + "[" + col4 + "]不存在!" + "|";
result += "焊口号 [" + col4 + "]不存在!" + "|";
}
else if (weldJoint.Count() == 1)
{
weldJointId = weldJoint.First().WeldJointId;
t.WeldingMethodId=weldJoint.First().WeldingMethodId;
t.WeldingMethodId = weldJoint.First().WeldingMethodId;
t.GrooveTypeId = weldJoint.First().GrooveTypeId;
}
else
{
result += "第" + (i + 2).ToString() + "行," + "焊口号" + "," + "[" + col4 + "]重复!" + "|";
result += "焊口号 [" + col4 + "]重复!" + "|";
}
}
else
{
result += "第" + (i + 2).ToString() + "行," + "焊口号" + "," + "此项为必填项!" + "|";
result += "焊口号此项为必填项!" + "|";
}
string ndeId = string.Empty;
@@ -214,7 +234,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
var nde = Funs.DB.Base_DetectionType.FirstOrDefault(x => x.DetectionTypeCode == col5);
if (nde == null)
{
result += "第" + (i + 2).ToString() + "行," + "探伤类型" + "," + "[" + col5 + "]错误!" + "|";
result += "探伤类型[" + col5 + "]错误!" + "|";
}
else
@@ -225,19 +245,19 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
}
else
{
result += "第" + (i + 2).ToString() + "行," + "探伤类型" + "," + "此项为必填项!" + "|";
result += "探伤类型此项为必填项!" + "|";
}
var pointBatchItem = trustIn.FirstOrDefault(x => x.InstallationId == installationId && x.WorkAreaId == workAreaId && x.PipelineId == pipelineId && x.WeldJointId == weldJointId && x.DetectionTypeId == ndeId);
if (pointBatchItem == null)
{
result += "第" + (i + 2).ToString() + "行," + "检验批中不存在对应焊口信息" + "|";
result += "检验批中不存在对应焊口信息" + "|";
}
else
{
if (pointBatchItem.TrustBatchItemId != null)
{
result += "第" + (i + 2).ToString() + "行," + "焊口已委托" + "|";
result += "焊口已委托" + "|";
}
else
{
@@ -254,12 +274,12 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
}
catch (Exception)
{
result += "第" + (i + 2).ToString() + "行," + "委托日期" + "," + "[" + col6 + "]错误!" + "|";
result += "委托日期 [" + col6 + "]错误!" + "|";
}
}
else
{
result += "第" + (i + 2).ToString() + "行," + "委托日期" + "," + "此项为必填项!" + "|";
result += "委托日期此项为必填项!" + "|";
}
if (!string.IsNullOrEmpty(col7))
@@ -267,7 +287,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
Model.Base_Unit unit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitCode == col7);
if (unit == null)
{
result += "第" + (i + 2).ToString() + "行," + "检测单位编号" + "," + "[" + col7 + "]错误!" + "|";
result += "检测单位编号[" + col7 + "]错误!" + "|";
}
else
{
@@ -276,31 +296,35 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
}
else
{
result += "第" + (i + 2).ToString() + "行," + "检测单位" + "," + "此项为必填项!" + "|";
result += "检测单位此项为必填项!" + "|";
}
if (!string.IsNullOrEmpty(col8))
{
if (col8!= "打磨" && col8 != "机加工" && col8 != "喷砂" && col8 != "漆面")
if (col8 != "打磨" && col8 != "机加工" && col8 != "喷砂" && col8 != "漆面")
{
result += "第" + (i + 2).ToString() + "行," + "表面检测需录入:打磨、机加工、喷砂、漆面" + "|";
result += "表面检测需录入:打磨、机加工、喷砂、漆面" + "|";
}
}
if (!string.IsNullOrEmpty(col9))
{
if (col9 != "焊后" && col9 != "打磨后" && col9 != "热处理后" && col9 != "坡口准备" && col9 != "清根后" && col9 != "压力试验后" && col9 != "其他")
{
result += "第" + (i + 2).ToString() + "行," + "检测时机需录入:焊后、打磨后、热处理后、坡口准备、清根后、压力试验后、其他" + "|";
result += "检测时机需录入:焊后、打磨后、热处理后、坡口准备、清根后、压力试验后、其他" + "|";
}
}
log.Remark = result;
logListData.Add(log);
trustList.Add(t);
}
var trustCodeList=trustList.Select(p=>p.TrustBatchCode).Distinct();
var trustCodeList = trustList.Select(p => p.TrustBatchCode).Distinct();
foreach (var trustCode in trustCodeList)
{
string result = string.Empty;
var t = from x in trustList where x.TrustBatchCode == trustCode select x;
var logInfo = logListData.FirstOrDefault(x => x.TrustBatchCode == trustCode);
if (t.Select(x => x.InstallationId).Distinct().Count() > 1)
{
result += "委托单" + trustCode + "装置不一至" + "|";
@@ -329,17 +353,18 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
{
result += "委托单" + trustCode + "委托日期不一至" + "|";
}
if (logInfo != null)
{
logInfo.Remark += result;
}
}
if (!string.IsNullOrEmpty(result))
if (logListData.Where(t => t.Remark != "").Any())
{
if (result.Contains("|"))
{
result = result.Substring(0, result.LastIndexOf("|"));
}
errorInfos = result;
lbResult.Text = result;
Funs.DB.TrustBatchImportErrorLog.InsertAllOnSubmit(logListData);
Funs.DB.SubmitChanges();
this.Grid1.Hidden = false;
this.BindGrid1(BatchNo);
}
else
{
@@ -350,6 +375,12 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
}
void BindGrid1(string batchNo)
{
var result = Funs.DB.TrustBatchImportErrorLog.Where(t => t.BatchNo == batchNo).OrderBy(t => t.RowID).ToList();
this.Grid1.DataSource = result;
this.Grid1.DataBind();
}
#endregion
@@ -112,5 +112,23 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label lbResult;
/// <summary>
/// Grid1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// lablRemark 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lablRemark;
}
}
@@ -227,7 +227,7 @@
</f:Window>
<f:Window ID="Window4" Title="委托单导入" Hidden="true" EnableIFrame="true"
EnableMaximize="true" Target="Parent" EnableResize="true" runat="server" IsModal="false" OnClose="Window4_Close"
CloseAction="HidePostBack" Width="1024px" Height="640px">
CloseAction="HidePostBack" Width="1200px" Height="640px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<f:MenuButton ID="btnMenuCancel" OnClick="btnMenuCancel_Click" EnablePostBack="true"