20240419 NCR、图纸收发导入
This commit is contained in:
@@ -126,7 +126,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
oleDBConn.Close();
|
||||
oleDBConn.Dispose();
|
||||
|
||||
AddDatasetToSQL(ds.Tables[0], 11);
|
||||
AddDatasetToSQL(ds.Tables[0], 12);
|
||||
hdCheckResult.Text = "1";
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -173,6 +173,11 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
|
||||
var cns = from x in Funs.DB.Base_CNProfessional select x;
|
||||
|
||||
var unitWorks = from x in Funs.DB.WBS_UnitWork
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.SuperUnitWork == null
|
||||
select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
{
|
||||
string row0 = pds.Rows[i][0].ToString();
|
||||
@@ -196,35 +201,23 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
}
|
||||
|
||||
string row2 = pds.Rows[i][2].ToString();
|
||||
if (string.IsNullOrEmpty(row2))
|
||||
if (!string.IsNullOrEmpty(row2))
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "图纸内容" + "," + "此项为必填项!" + "|";
|
||||
}
|
||||
|
||||
string row4 = pds.Rows[i][4].ToString();
|
||||
if (!string.IsNullOrEmpty(row4))
|
||||
{
|
||||
try
|
||||
string[] reunit = row2.Split(',');
|
||||
foreach (string unitWork in reunit)
|
||||
{
|
||||
Int32 date = Convert.ToInt32(row4.Trim());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "页数" + "," + "[" + row4 + "]错误!" + "|";
|
||||
var u = unitWorks.Where(x => x.UnitWorkName == unitWork.Trim()).FirstOrDefault();
|
||||
if (u == null)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "单位工程名称" + "," + "[" + unitWork.Trim() + "]不存在!" + "|";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string row5 = pds.Rows[i][5].ToString();
|
||||
if (!string.IsNullOrEmpty(row5))
|
||||
if (string.IsNullOrEmpty(row5))
|
||||
{
|
||||
try
|
||||
{
|
||||
DateTime date = Convert.ToDateTime(row5.Trim());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "接收日期" + "," + "[" + row5 + "]错误!" + "|";
|
||||
}
|
||||
result += (i + 2).ToString() + "," + "标识编号" + "," + "此项为必填项!" + "|";
|
||||
}
|
||||
|
||||
string row6 = pds.Rows[i][6].ToString();
|
||||
@@ -232,38 +225,53 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
try
|
||||
{
|
||||
DateTime date = Convert.ToDateTime(row6.Trim());
|
||||
Int32 date = Convert.ToInt32(row6.Trim());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "发送日期" + "," + "[" + row6 + "]错误!" + "|";
|
||||
result += (i + 2).ToString() + "," + "页数" + "," + "[" + row6 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
|
||||
string row7 = pds.Rows[i][7].ToString();
|
||||
if (!string.IsNullOrEmpty(row7))
|
||||
{
|
||||
string[] reunit = row7.Split(',');
|
||||
foreach (string unit in reunit)
|
||||
try
|
||||
{
|
||||
var u = units.Where(x => x.UnitName == unit).FirstOrDefault();
|
||||
if (u == null)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "接收单位" + "," + "[" + unit + "]不存在!" + "|";
|
||||
}
|
||||
DateTime date = Convert.ToDateTime(row7.Trim());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "接收日期" + "," + "[" + row7 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
|
||||
string row10 = pds.Rows[i][10].ToString();
|
||||
if (string.IsNullOrEmpty(row10))
|
||||
string row8 = pds.Rows[i][8].ToString();
|
||||
if (!string.IsNullOrEmpty(row8))
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "标识编号" + "," + "此项为必填项!" + "|";
|
||||
try
|
||||
{
|
||||
DateTime date = Convert.ToDateTime(row8.Trim());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "发送日期" + "," + "[" + row8 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
|
||||
string row9 = pds.Rows[i][9].ToString();
|
||||
if (!string.IsNullOrEmpty(row9))
|
||||
{
|
||||
string[] reunit = row9.Split(',');
|
||||
foreach (string unit in reunit)
|
||||
{
|
||||
var u = units.Where(x => x.UnitName == unit.Trim()).FirstOrDefault();
|
||||
if (u == null)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "接收单位" + "," + "[" + unit.Trim() + "]不存在!" + "|";
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// result += (i + 2).ToString() + "," + "报验编号" + "," + "该单位报验编号已存在!" + "|";
|
||||
//}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(result))
|
||||
{
|
||||
@@ -369,7 +377,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
oleDBConn.Close();
|
||||
oleDBConn.Dispose();
|
||||
|
||||
AddDatasetToSQL2(ds.Tables[0], 11);
|
||||
AddDatasetToSQL2(ds.Tables[0], 12);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -408,72 +416,84 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
|
||||
var cns = from x in Funs.DB.Base_CNProfessional select x;
|
||||
|
||||
var unitWorks = from x in Funs.DB.WBS_UnitWork
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.SuperUnitWork == null
|
||||
select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
{
|
||||
Model.Comprehensive_DesignDrawings oldViewInfo = new Model.Comprehensive_DesignDrawings();
|
||||
string row0 = pds.Rows[i][0].ToString().Trim();
|
||||
var cn = cns.Where(y => y.ProfessionalName == row0).FirstOrDefault();
|
||||
oldViewInfo = oldViewInfos.Where(x => x.RemarkCode == pds.Rows[i][10].ToString().Trim()
|
||||
oldViewInfo = oldViewInfos.Where(x => x.RemarkCode == pds.Rows[i][5].ToString().Trim()
|
||||
).FirstOrDefault();
|
||||
if (oldViewInfo == null)
|
||||
{
|
||||
Model.Comprehensive_DesignDrawings des = new Model.Comprehensive_DesignDrawings();
|
||||
des.DesignDrawingsId = SQLHelper.GetNewID(typeof(Model.Comprehensive_DesignDrawings));
|
||||
des.ProjectId = this.CurrUser.LoginProjectId;
|
||||
des.CNProfessionalId = cn.CNProfessionalId;
|
||||
des.DesignDrawingsCode = pds.Rows[i][1].ToString().Trim();
|
||||
des.DesignDrawingsContent = pds.Rows[i][2].ToString().Trim();
|
||||
des.Edition = pds.Rows[i][3].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][4].ToString().Trim()))
|
||||
des.CNProfessionalId = cn.CNProfessionalId;//专业名称
|
||||
des.DesignDrawingsCode = pds.Rows[i][1].ToString().Trim();//图纸编号
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][2].ToString().Trim()))//单位工程
|
||||
{
|
||||
des.PageNumber = Convert.ToInt32(pds.Rows[i][4].ToString().Trim());
|
||||
}
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][5].ToString().Trim()))
|
||||
{
|
||||
des.ReceiveDate = Convert.ToDateTime(pds.Rows[i][5].ToString().Trim());
|
||||
des.UnitWorkId = BLL.UnitWorkService.GetUnitWorkIdsByUnitWorkNames(this.CurrUser.LoginProjectId, pds.Rows[i][2].ToString().Trim());
|
||||
}
|
||||
des.DesignDrawingsContent = pds.Rows[i][3].ToString().Trim();//图纸内容
|
||||
des.Edition = pds.Rows[i][4].ToString().Trim();//版次
|
||||
des.RemarkCode = pds.Rows[i][5].ToString().Trim();//标志编号
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][6].ToString().Trim()))
|
||||
{
|
||||
des.SendDate = Convert.ToDateTime(pds.Rows[i][6].ToString().Trim());
|
||||
des.PageNumber = Convert.ToInt32(pds.Rows[i][6].ToString().Trim());//页数
|
||||
}
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][7].ToString().Trim()))
|
||||
{
|
||||
des.ReceiveUnits = UnitService.GetUnitIds(pds.Rows[i][7].ToString().Trim());
|
||||
des.ReceiveDate = Convert.ToDateTime(pds.Rows[i][7].ToString().Trim());//接收日期
|
||||
}
|
||||
des.ReceiveMan = pds.Rows[i][8].ToString().Trim();
|
||||
des.Remark = pds.Rows[i][9].ToString().Trim();
|
||||
des.RemarkCode = pds.Rows[i][10].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][8].ToString().Trim()))
|
||||
{
|
||||
des.SendDate = Convert.ToDateTime(pds.Rows[i][8].ToString().Trim());//发送日期
|
||||
}
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][9].ToString().Trim()))
|
||||
{
|
||||
des.ReceiveUnits = UnitService.GetUnitIds(pds.Rows[i][9].ToString().Trim());//接收单位
|
||||
}
|
||||
des.ReceiveMan = pds.Rows[i][10].ToString().Trim(); //接收人
|
||||
des.Remark = pds.Rows[i][11].ToString().Trim();//备注
|
||||
BLL.DesignDrawingsService.AddDesignDrawings(des);
|
||||
}
|
||||
else
|
||||
{
|
||||
oldViewInfo.CNProfessionalId = cn.CNProfessionalId;
|
||||
oldViewInfo.DesignDrawingsCode = pds.Rows[i][1].ToString().Trim();
|
||||
oldViewInfo.DesignDrawingsContent = pds.Rows[i][2].ToString().Trim();
|
||||
oldViewInfo.Edition = pds.Rows[i][3].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][4].ToString().Trim()))
|
||||
oldViewInfo.CNProfessionalId = cn.CNProfessionalId;//专业名称
|
||||
oldViewInfo.DesignDrawingsCode = pds.Rows[i][1].ToString().Trim();//图纸编号
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][2].ToString().Trim()))//单位工程
|
||||
{
|
||||
oldViewInfo.PageNumber = Convert.ToInt32(pds.Rows[i][4].ToString().Trim());
|
||||
}
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][5].ToString().Trim()))
|
||||
{
|
||||
oldViewInfo.ReceiveDate = Convert.ToDateTime(pds.Rows[i][5].ToString().Trim());
|
||||
oldViewInfo.UnitWorkId = BLL.UnitWorkService.GetUnitWorkIdsByUnitWorkNames(this.CurrUser.LoginProjectId, pds.Rows[i][2].ToString().Trim());
|
||||
}
|
||||
oldViewInfo.DesignDrawingsContent = pds.Rows[i][3].ToString().Trim();//图纸内容
|
||||
oldViewInfo.Edition = pds.Rows[i][4].ToString().Trim();//版次
|
||||
oldViewInfo.RemarkCode = pds.Rows[i][5].ToString().Trim();//标志编号
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][6].ToString().Trim()))
|
||||
{
|
||||
oldViewInfo.SendDate = Convert.ToDateTime(pds.Rows[i][6].ToString().Trim());
|
||||
oldViewInfo.PageNumber = Convert.ToInt32(pds.Rows[i][6].ToString().Trim());//页数
|
||||
}
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][7].ToString().Trim()))
|
||||
{
|
||||
oldViewInfo.ReceiveUnits = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitName == (pds.Rows[i][7].ToString().Trim())).UnitId;
|
||||
oldViewInfo.ReceiveDate = Convert.ToDateTime(pds.Rows[i][7].ToString().Trim());//接收日期
|
||||
}
|
||||
oldViewInfo.ReceiveMan = pds.Rows[i][8].ToString().Trim();
|
||||
oldViewInfo.Remark = pds.Rows[i][9].ToString().Trim();
|
||||
oldViewInfo.RemarkCode = pds.Rows[i][10].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][8].ToString().Trim()))
|
||||
{
|
||||
oldViewInfo.SendDate = Convert.ToDateTime(pds.Rows[i][8].ToString().Trim());//发送日期
|
||||
}
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][9].ToString().Trim()))
|
||||
{
|
||||
oldViewInfo.ReceiveUnits = UnitService.GetUnitIds(pds.Rows[i][9].ToString().Trim());//接收单位
|
||||
}
|
||||
oldViewInfo.ReceiveMan = pds.Rows[i][10].ToString().Trim(); //接收人
|
||||
oldViewInfo.Remark = pds.Rows[i][11].ToString().Trim();//备注
|
||||
BLL.DesignDrawingsService.UpdateDesignDrawings(oldViewInfo);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -484,7 +504,6 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
|
||||
#region 下载模板
|
||||
/// <summary>
|
||||
/// 下载模板按钮
|
||||
|
||||
Reference in New Issue
Block a user