事故警示调整
This commit is contained in:
@@ -177,27 +177,32 @@ namespace FineUIPro.Web.Accident
|
||||
string row1 = pds.Rows[i][1].ToString();
|
||||
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();
|
||||
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
|
||||
{
|
||||
DateTime date = Convert.ToDateTime(row2.Trim());
|
||||
DateTime date = Convert.ToDateTime(row3.Trim());
|
||||
}
|
||||
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
|
||||
{
|
||||
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())
|
||||
{
|
||||
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.Code = BLL.SQLHelper.RunProcNewId("SpGetNewCode5", "Accident_Warning", "Code", $"SG-");
|
||||
model.Title = pds.Rows[i][0].ToString().Trim();
|
||||
model.Address = pds.Rows[i][1].ToString().Trim();
|
||||
DateTime accDate = Convert.ToDateTime(pds.Rows[i][2].ToString().Trim());
|
||||
model.Type = pds.Rows[i][1].ToString().Trim();
|
||||
model.Address = pds.Rows[i][2].ToString().Trim();
|
||||
DateTime accDate = Convert.ToDateTime(pds.Rows[i][3].ToString().Trim());
|
||||
model.AccidentDate = accDate;
|
||||
model.AccidentMonthDay = accDate.ToString("MM-dd");
|
||||
model.ResponsibleUnit = pds.Rows[i][3].ToString().Trim();
|
||||
model.Content = pds.Rows[i][4].ToString().Trim();
|
||||
model.Remarks = pds.Rows[i][5].ToString().Trim();
|
||||
model.ResponsibleUnit = pds.Rows[i][4].ToString().Trim();
|
||||
model.Content = 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.CompileManName = this.CurrUser.UserName;
|
||||
model.CreateTime = DateTime.Now;
|
||||
|
||||
Reference in New Issue
Block a user