事故警示调整

This commit is contained in:
夏菊 2025-12-23 09:58:51 +08:00
parent 81291b03f7
commit 19c093122b
10 changed files with 127 additions and 24 deletions

View File

@ -18,6 +18,7 @@ END
GO GO
drop table Accident_Warning
-- --
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'Accident_Warning') AND type = N'U') IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'Accident_Warning') AND type = N'U')
BEGIN BEGIN
@ -26,7 +27,9 @@ CREATE TABLE [dbo].[Accident_Warning](
[Code] [nvarchar](50) NOT NULL, [Code] [nvarchar](50) NOT NULL,
[Title] [nvarchar](100) NOT NULL, [Title] [nvarchar](100) NOT NULL,
[Content] [nvarchar](2000) NOT NULL, [Content] [nvarchar](2000) NOT NULL,
[Address] [nvarchar](50) NOT NULL, [Type] [nvarchar](50) NOT NULL,
[Address] [nvarchar](50) NULL,
[Source] [nvarchar](50) NULL,
[ResponsibleUnit] [nvarchar](200) NULL, [ResponsibleUnit] [nvarchar](200) NULL,
[AccidentDate] datetime NOT NULL, [AccidentDate] datetime NOT NULL,
[AccidentMonthDay] [nvarchar](50) NOT NULL, [AccidentMonthDay] [nvarchar](50) NOT NULL,
@ -43,7 +46,9 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'事故编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Accident_Warning', @level2type=N'COLUMN',@level2name=N'Code' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'事故编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Accident_Warning', @level2type=N'COLUMN',@level2name=N'Code'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'标题' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Accident_Warning', @level2type=N'COLUMN',@level2name=N'Title' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'标题' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Accident_Warning', @level2type=N'COLUMN',@level2name=N'Title'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'内容' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Accident_Warning', @level2type=N'COLUMN',@level2name=N'Content' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'内容' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Accident_Warning', @level2type=N'COLUMN',@level2name=N'Content'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ʹÊÀàÐÍ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Accident_Warning', @level2type=N'COLUMN',@level2name=N'Type'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'地点' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Accident_Warning', @level2type=N'COLUMN',@level2name=N'Address' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'地点' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Accident_Warning', @level2type=N'COLUMN',@level2name=N'Address'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'À´Ô´' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Accident_Warning', @level2type=N'COLUMN',@level2name=N'Source'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'责任单位' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Accident_Warning', @level2type=N'COLUMN',@level2name=N'ResponsibleUnit' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'责任单位' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Accident_Warning', @level2type=N'COLUMN',@level2name=N'ResponsibleUnit'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'事故日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Accident_Warning', @level2type=N'COLUMN',@level2name=N'AccidentDate' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'事故日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Accident_Warning', @level2type=N'COLUMN',@level2name=N'AccidentDate'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'事故日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Accident_Warning', @level2type=N'COLUMN',@level2name=N'AccidentMonthDay' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'事故日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Accident_Warning', @level2type=N'COLUMN',@level2name=N'AccidentMonthDay'

View File

@ -46,7 +46,9 @@ namespace BLL
Code = model.Code, Code = model.Code,
Title = model.Title, Title = model.Title,
Content = model.Content, Content = model.Content,
Type = model.Type,
Address = model.Address, Address = model.Address,
Source = model.Source,
ResponsibleUnit = model.ResponsibleUnit, ResponsibleUnit = model.ResponsibleUnit,
AccidentDate = model.AccidentDate, AccidentDate = model.AccidentDate,
AccidentMonthDay = model.AccidentMonthDay, AccidentMonthDay = model.AccidentMonthDay,
@ -71,7 +73,9 @@ namespace BLL
{ {
newModel.Title = model.Title; newModel.Title = model.Title;
newModel.Content = model.Content; newModel.Content = model.Content;
newModel.Type = model.Type;
newModel.Address = model.Address; newModel.Address = model.Address;
newModel.Source = model.Source;
newModel.ResponsibleUnit = model.ResponsibleUnit; newModel.ResponsibleUnit = model.ResponsibleUnit;
newModel.AccidentDate = model.AccidentDate; newModel.AccidentDate = model.AccidentDate;
newModel.AccidentMonthDay = model.AccidentMonthDay; newModel.AccidentMonthDay = model.AccidentMonthDay;

View File

@ -21,8 +21,8 @@
<Toolbars> <Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" runat="server" ToolbarAlign="Left"> <f:Toolbar ID="Toolbar2" Position="Top" runat="server" ToolbarAlign="Left">
<Items> <Items>
<f:TextBox runat="server" Label="查询条件" ID="txtSearch" EmptyText="输入事故编号、标题、地点" <f:TextBox runat="server" Label="查询条件" ID="txtSearch" EmptyText="输入事故编号、标题、类型、地点、来源"
Width="360px" LabelWidth="100px" LabelAlign="right"> Width="420px" LabelWidth="100px" LabelAlign="right">
</f:TextBox> </f:TextBox>
<f:DatePicker runat="server" Label="事故日期" ID="txtAccidentDateStart" LabelAlign="Right" <f:DatePicker runat="server" Label="事故日期" ID="txtAccidentDateStart" LabelAlign="Right"
LabelWidth="100px" Width="220px"> LabelWidth="100px" Width="220px">
@ -55,15 +55,19 @@
SortField="Code" FieldType="String" HeaderText="编号" HeaderTextAlign="Center" SortField="Code" FieldType="String" HeaderText="编号" HeaderTextAlign="Center"
TextAlign="Left"> TextAlign="Left">
</f:RenderField> </f:RenderField>
<f:RenderField Width="220px" ColumnID="Title" DataField="Title" <f:RenderField Width="200px" ColumnID="Title" DataField="Title"
FieldType="String" HeaderText="事故标题" HeaderTextAlign="Center" FieldType="String" HeaderText="事故标题" HeaderTextAlign="Center"
TextAlign="Left"> TextAlign="Left">
</f:RenderField> </f:RenderField>
<f:RenderField Width="140px" ColumnID="Type" DataField="Type"
SortField="Type" FieldType="String" HeaderText="事故类型" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
<f:RenderField Width="120px" ColumnID="AccidentDate" DataField="AccidentDate" <f:RenderField Width="120px" ColumnID="AccidentDate" DataField="AccidentDate"
SortField="AccidentDate" FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd" SortField="AccidentDate" FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd"
HeaderText="事故日期" HeaderTextAlign="Center" TextAlign="Center"> HeaderText="事故日期" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField> </f:RenderField>
<f:RenderField Width="220px" ColumnID="Address" DataField="Address" <f:RenderField Width="200px" ColumnID="Address" DataField="Address"
SortField="Address" FieldType="String" HeaderText="事故地点" HeaderTextAlign="Center" SortField="Address" FieldType="String" HeaderText="事故地点" HeaderTextAlign="Center"
TextAlign="Left"> TextAlign="Left">
</f:RenderField> </f:RenderField>
@ -71,6 +75,10 @@
FieldType="String" HeaderText="责任单位" HeaderTextAlign="Center" FieldType="String" HeaderText="责任单位" HeaderTextAlign="Center"
TextAlign="Left"> TextAlign="Left">
</f:RenderField> </f:RenderField>
<f:RenderField Width="160px" ColumnID="Source" DataField="Source"
FieldType="String" HeaderText="来源" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
<f:RenderField Width="140px" ColumnID="CompileManName" DataField="CompileManName" <f:RenderField Width="140px" ColumnID="CompileManName" DataField="CompileManName"
SortField="CompileManName" FieldType="String" HeaderText="编制人" HeaderTextAlign="Center" SortField="CompileManName" FieldType="String" HeaderText="编制人" HeaderTextAlign="Center"
TextAlign="Left"> TextAlign="Left">

View File

@ -64,9 +64,14 @@ namespace FineUIPro.Web.Accident
List<SqlParameter> listStr = new List<SqlParameter>(); List<SqlParameter> listStr = new List<SqlParameter>();
if (!string.IsNullOrEmpty(this.txtSearch.Text.Trim())) if (!string.IsNullOrEmpty(this.txtSearch.Text.Trim()))
{ {
sb.Append("and (Code like @txtSearch or Title like @txtSearch or Address like @txtSearch ) "); sb.Append("and (Code like @txtSearch or Title like @txtSearch or Type like @txtSearch or Address like @txtSearch or Source like @txtSearch ) ");
listStr.Add(new SqlParameter("@txtSearch", "%" + this.txtSearch.Text.Trim() + "%")); listStr.Add(new SqlParameter("@txtSearch", "%" + this.txtSearch.Text.Trim() + "%"));
} }
//if (!string.IsNullOrEmpty(this.txtType.Text.Trim()))
//{
// sb.Append("and (Type like @txtType ) ");
// listStr.Add(new SqlParameter("@txtType", "%" + this.txtType.Text.Trim() + "%"));
//}
if (!string.IsNullOrEmpty(this.txtAccidentDateStart.Text.Trim())) if (!string.IsNullOrEmpty(this.txtAccidentDateStart.Text.Trim()))
{ {
sb.Append("and AccidentDate >= @AccidentDateStart "); sb.Append("and AccidentDate >= @AccidentDateStart ");

View File

@ -177,27 +177,32 @@ namespace FineUIPro.Web.Accident
string row1 = pds.Rows[i][1].ToString(); string row1 = pds.Rows[i][1].ToString();
if (string.IsNullOrEmpty(row1)) if (string.IsNullOrEmpty(row1))
{ {
errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "事故地点", Reason = "此项为必填项!" }); errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "事故类型", Reason = "此项为必填项!" });
} }
string row2 = pds.Rows[i][2].ToString(); string row2 = pds.Rows[i][2].ToString();
if (!string.IsNullOrEmpty(row2)) if (string.IsNullOrEmpty(row2))
{
errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "事故地点", Reason = "此项为必填项!" });
}
string row3 = pds.Rows[i][3].ToString();
if (!string.IsNullOrEmpty(row3))
{ {
try try
{ {
DateTime date = Convert.ToDateTime(row2.Trim()); DateTime date = Convert.ToDateTime(row3.Trim());
} }
catch (Exception) catch (Exception)
{ {
errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "事故日期", Reason = $"[{row2}]错误!" }); errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "事故日期", Reason = $"[{row3}]错误!" });
} }
} }
else else
{ {
errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "事故日期", Reason = "此项为必填项!" }); errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "事故日期", Reason = "此项为必填项!" });
} }
if (!string.IsNullOrWhiteSpace(row0) && !string.IsNullOrWhiteSpace(row1) && !string.IsNullOrWhiteSpace(row2)) if (!string.IsNullOrWhiteSpace(row0) && !string.IsNullOrWhiteSpace(row1) && !string.IsNullOrWhiteSpace(row2) && !string.IsNullOrWhiteSpace(row3))
{ {
var acc = oldViewInfos.Where(x => x.Title == row0 && x.Address == row1 && x.AccidentDate == Convert.ToDateTime(row2.Trim())); var acc = oldViewInfos.Where(x => x.Title == row0 && x.Address == row1 && x.Type == row2 && x.AccidentDate == Convert.ToDateTime(row2.Trim()));
if (acc.Any()) if (acc.Any())
{ {
errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "事故标题", Reason = "此项事故已存在!" }); errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "事故标题", Reason = "此项事故已存在!" });
@ -322,13 +327,15 @@ namespace FineUIPro.Web.Accident
model.Id = SQLHelper.GetNewID(typeof(Model.Accident_Warning)); model.Id = SQLHelper.GetNewID(typeof(Model.Accident_Warning));
model.Code = BLL.SQLHelper.RunProcNewId("SpGetNewCode5", "Accident_Warning", "Code", $"SG-"); model.Code = BLL.SQLHelper.RunProcNewId("SpGetNewCode5", "Accident_Warning", "Code", $"SG-");
model.Title = pds.Rows[i][0].ToString().Trim(); model.Title = pds.Rows[i][0].ToString().Trim();
model.Address = pds.Rows[i][1].ToString().Trim(); model.Type = pds.Rows[i][1].ToString().Trim();
DateTime accDate = Convert.ToDateTime(pds.Rows[i][2].ToString().Trim()); model.Address = pds.Rows[i][2].ToString().Trim();
DateTime accDate = Convert.ToDateTime(pds.Rows[i][3].ToString().Trim());
model.AccidentDate = accDate; model.AccidentDate = accDate;
model.AccidentMonthDay = accDate.ToString("MM-dd"); model.AccidentMonthDay = accDate.ToString("MM-dd");
model.ResponsibleUnit = pds.Rows[i][3].ToString().Trim(); model.ResponsibleUnit = pds.Rows[i][4].ToString().Trim();
model.Content = pds.Rows[i][4].ToString().Trim(); model.Content = pds.Rows[i][5].ToString().Trim();
model.Remarks = pds.Rows[i][5].ToString().Trim(); model.Source = pds.Rows[i][6].ToString().Trim();
model.Remarks = pds.Rows[i][7].ToString().Trim();
model.CompileMan = this.CurrUser.UserId; model.CompileMan = this.CurrUser.UserId;
model.CompileManName = this.CurrUser.UserName; model.CompileManName = this.CurrUser.UserName;
model.CreateTime = DateTime.Now; model.CreateTime = DateTime.Now;

View File

@ -28,14 +28,20 @@
</f:FormRow> </f:FormRow>
<f:FormRow> <f:FormRow>
<Items> <Items>
<f:TextBox ID="txtAddress" runat="server" Label="事故地点" LabelAlign="Right" ShowRedStar="true" Required="true" <f:TextBox ID="txtType" runat="server" Label="事故类型" LabelAlign="Right" ShowRedStar="true" Required="true" MaxLength="50">
MaxLength="50">
</f:TextBox> </f:TextBox>
<f:DatePicker ID="txtAccidentDate" runat="server" Label="事故日期" LabelAlign="Right" ShowRedStar="true" Required="true" <f:DatePicker ID="txtAccidentDate" runat="server" Label="事故日期" LabelAlign="Right" ShowRedStar="true" Required="true" EnableEdit="true">
EnableEdit="true">
</f:DatePicker> </f:DatePicker>
</Items> </Items>
</f:FormRow> </f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtAddress" runat="server" Label="事故地点" LabelAlign="Right" ShowRedStar="true" Required="true" MaxLength="50">
</f:TextBox>
<f:TextBox ID="txtSource" runat="server" Label="事故来源" LabelAlign="Right" MaxLength="50">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow> <f:FormRow>
<Items> <Items>
<f:TextBox ID="txtResponsibleUnit" runat="server" Label="责任单位" LabelAlign="Right" MaxLength="50"> <f:TextBox ID="txtResponsibleUnit" runat="server" Label="责任单位" LabelAlign="Right" MaxLength="50">

View File

@ -92,7 +92,9 @@ namespace FineUIPro.Web.Accident
model.Code = this.txtCode.Text.Trim(); model.Code = this.txtCode.Text.Trim();
model.Title = this.txtTitle.Text.Trim(); model.Title = this.txtTitle.Text.Trim();
model.Content = this.txtContent.Text.Trim(); model.Content = this.txtContent.Text.Trim();
model.Type = this.txtType.Text.Trim();
model.Address = this.txtAddress.Text.Trim(); model.Address = this.txtAddress.Text.Trim();
model.Source = this.txtSource.Text.Trim();
model.ResponsibleUnit = this.txtResponsibleUnit.Text.Trim(); model.ResponsibleUnit = this.txtResponsibleUnit.Text.Trim();
model.Remarks = this.txtRemarks.Text.Trim(); model.Remarks = this.txtRemarks.Text.Trim();
model.AccidentDate = Funs.GetNewDateTimeOrNow(this.txtAccidentDate.Text.Trim()); model.AccidentDate = Funs.GetNewDateTimeOrNow(this.txtAccidentDate.Text.Trim());

View File

@ -60,13 +60,13 @@ namespace FineUIPro.Web.Accident
protected global::FineUIPro.TextBox txtTitle; protected global::FineUIPro.TextBox txtTitle;
/// <summary> /// <summary>
/// txtAddress 控件。 /// txtType 控件。
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// 自动生成的字段。 /// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks> /// </remarks>
protected global::FineUIPro.TextBox txtAddress; protected global::FineUIPro.TextBox txtType;
/// <summary> /// <summary>
/// txtAccidentDate 控件。 /// txtAccidentDate 控件。
@ -77,6 +77,24 @@ namespace FineUIPro.Web.Accident
/// </remarks> /// </remarks>
protected global::FineUIPro.DatePicker txtAccidentDate; protected global::FineUIPro.DatePicker txtAccidentDate;
/// <summary>
/// txtAddress 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtAddress;
/// <summary>
/// txtSource 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtSource;
/// <summary> /// <summary>
/// txtResponsibleUnit 控件。 /// txtResponsibleUnit 控件。
/// </summary> /// </summary>

View File

@ -15205,8 +15205,12 @@ namespace Model
private string _Content; private string _Content;
private string _Type;
private string _Address; private string _Address;
private string _Source;
private string _ResponsibleUnit; private string _ResponsibleUnit;
private System.DateTime _AccidentDate; private System.DateTime _AccidentDate;
@ -15233,8 +15237,12 @@ namespace Model
partial void OnTitleChanged(); partial void OnTitleChanged();
partial void OnContentChanging(string value); partial void OnContentChanging(string value);
partial void OnContentChanged(); partial void OnContentChanged();
partial void OnTypeChanging(string value);
partial void OnTypeChanged();
partial void OnAddressChanging(string value); partial void OnAddressChanging(string value);
partial void OnAddressChanged(); partial void OnAddressChanged();
partial void OnSourceChanging(string value);
partial void OnSourceChanged();
partial void OnResponsibleUnitChanging(string value); partial void OnResponsibleUnitChanging(string value);
partial void OnResponsibleUnitChanged(); partial void OnResponsibleUnitChanged();
partial void OnAccidentDateChanging(System.DateTime value); partial void OnAccidentDateChanging(System.DateTime value);
@ -15336,7 +15344,27 @@ namespace Model
} }
} }
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Address", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Type", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
public string Type
{
get
{
return this._Type;
}
set
{
if ((this._Type != value))
{
this.OnTypeChanging(value);
this.SendPropertyChanging();
this._Type = value;
this.SendPropertyChanged("Type");
this.OnTypeChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Address", DbType="NVarChar(50)")]
public string Address public string Address
{ {
get get
@ -15356,6 +15384,26 @@ namespace Model
} }
} }
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Source", DbType="NVarChar(50)")]
public string Source
{
get
{
return this._Source;
}
set
{
if ((this._Source != value))
{
this.OnSourceChanging(value);
this.SendPropertyChanging();
this._Source = value;
this.SendPropertyChanged("Source");
this.OnSourceChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResponsibleUnit", DbType="NVarChar(200)")] [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResponsibleUnit", DbType="NVarChar(200)")]
public string ResponsibleUnit public string ResponsibleUnit
{ {