2023-04-28 天辰质量报验移植

This commit is contained in:
2023-04-28 17:46:41 +08:00
parent dbfd7086e1
commit 03c6364f47
171 changed files with 17248 additions and 2071 deletions
@@ -96,21 +96,22 @@ namespace FineUIPro.Web.CQMS.Comprehensive
/// <param name="filename">Excel文件路径名</param>
private void ImportXlsToData(string fileName)
{
//支持.xls和.xlsx,即包括office2010等版本的 HDR=Yes代表第一行是标题,不是数据;
string cmdText = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties='Excel 12.0; HDR=Yes; IMEX=1'";
//建立连接
OleDbConnection conn = new OleDbConnection(string.Format(cmdText, fileName));
try
{
string oleDBConnString = String.Empty;
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
oleDBConnString += "Data Source=";
oleDBConnString += fileName;
oleDBConnString += ";Extended Properties=Excel 8.0;";
OleDbConnection oleDBConn = null;
//打开连接
if (conn.State == ConnectionState.Broken || conn.State == ConnectionState.Closed)
{
conn.Open();
}
OleDbDataAdapter oleAdMaster = null;
DataTable m_tableName = new DataTable();
DataSet ds = new DataSet();
oleDBConn = new OleDbConnection(oleDBConnString);
oleDBConn.Open();
m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
m_tableName = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (m_tableName != null && m_tableName.Rows.Count > 0)
{
@@ -120,11 +121,11 @@ namespace FineUIPro.Web.CQMS.Comprehensive
}
string sqlMaster;
sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]";
oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn);
oleAdMaster = new OleDbDataAdapter(sqlMaster, conn);
oleAdMaster.Fill(ds, "m_tableName");
oleAdMaster.Dispose();
oleDBConn.Close();
oleDBConn.Dispose();
conn.Close();
conn.Dispose();
AddDatasetToSQL(ds.Tables[0], 10);
hdCheckResult.Text = "1";
@@ -135,6 +136,11 @@ namespace FineUIPro.Web.CQMS.Comprehensive
//return null;
// return dt;
}
finally
{
conn.Close();
conn.Dispose();
}
}
#endregion
@@ -289,7 +295,6 @@ namespace FineUIPro.Web.CQMS.Comprehensive
string rootPath = Server.MapPath("~/");
ImportXlsToData2(rootPath + initPath + this.hdFileName.Text);
hdCheckResult.Text = string.Empty;
ShowNotify("导入成功!", MessageBoxIcon.Success);
}
else
{
@@ -309,21 +314,21 @@ namespace FineUIPro.Web.CQMS.Comprehensive
/// <param name="filename">Excel文件路径名</param>
private void ImportXlsToData2(string fileName)
{
//支持.xls和.xlsx,即包括office2010等版本的 HDR=Yes代表第一行是标题,不是数据;
string cmdText = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties='Excel 12.0; HDR=Yes; IMEX=1'";
//建立连接
OleDbConnection conn = new OleDbConnection(string.Format(cmdText, fileName));
try
{
string oleDBConnString = String.Empty;
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
oleDBConnString += "Data Source=";
oleDBConnString += fileName;
oleDBConnString += ";Extended Properties=Excel 8.0;";
OleDbConnection oleDBConn = null;
//打开连接
if (conn.State == ConnectionState.Broken || conn.State == ConnectionState.Closed)
{
conn.Open();
}
OleDbDataAdapter oleAdMaster = null;
DataTable m_tableName = new DataTable();
DataSet ds = new DataSet();
oleDBConn = new OleDbConnection(oleDBConnString);
oleDBConn.Open();
m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
m_tableName = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (m_tableName != null && m_tableName.Rows.Count > 0)
{
@@ -333,11 +338,11 @@ namespace FineUIPro.Web.CQMS.Comprehensive
}
string sqlMaster;
sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]";
oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn);
oleAdMaster = new OleDbDataAdapter(sqlMaster, conn);
oleAdMaster.Fill(ds, "m_tableName");
oleAdMaster.Dispose();
oleDBConn.Close();
oleDBConn.Dispose();
conn.Close();
conn.Dispose();
AddDatasetToSQL2(ds.Tables[0], 4);
}
@@ -374,52 +379,68 @@ namespace FineUIPro.Web.CQMS.Comprehensive
var cns = from x in Funs.DB.Base_CNProfessional select x;
var installations = from x in Funs.DB.WBS_UnitWork where x.ProjectId == this.CurrUser.LoginProjectId select x;
var oldViewInfos = from x in Funs.DB.Comprehensive_SiteVisaManagement
var oldViewInfos = from x in Funs.DB.Comprehensive_DesignChangeOrder
where x.ProjectId == this.CurrUser.LoginProjectId
select x;
for (int i = 0; i < ir; i++)
{
var oldViewInfo = oldViewInfos.Where(x => x.VisaCode == pds.Rows[i][1].ToString().Trim()).FirstOrDefault();
var oldViewInfo = oldViewInfos.Where(x => x.ChangeOrderCode == pds.Rows[i][2].ToString().Trim()).FirstOrDefault();
if (oldViewInfo == null)
{
Model.Comprehensive_SiteVisaManagement Ins = new Model.Comprehensive_SiteVisaManagement();
Model.Comprehensive_DesignChangeOrder Ins = new Model.Comprehensive_DesignChangeOrder();
Ins.ProjectId = this.CurrUser.LoginProjectId;
if (!string.IsNullOrEmpty(pds.Rows[i][0].ToString().Trim()))
{
Ins.UnitId = Funs.DB.Base_Unit.First(e => e.UnitName == pds.Rows[i][0].ToString().Trim()).UnitId;
Ins.CNProfessionalId = Funs.DB.Base_CNProfessional.First(e => e.ProfessionalName == pds.Rows[i][0].ToString().Trim()).CNProfessionalId;
}
Ins.VisaCode = pds.Rows[i][1].ToString().Trim();
Ins.VisaContent = pds.Rows[i][2].ToString().Trim();
string row3 = pds.Rows[i][3].ToString().Trim();
if (!string.IsNullOrEmpty(row3))
if (!string.IsNullOrEmpty(pds.Rows[i][1].ToString().Trim()))
{
Ins.ProcessingState = row3;
}
else
{
Ins.ProcessingState = "未实施";
}
if (!string.IsNullOrEmpty(pds.Rows[i][4].ToString().Trim()))
{
Ins.UnitWorkId = installations.First(e => e.UnitWorkName == pds.Rows[i][4].ToString().Trim()).UnitWorkId;
Ins.UnitWorkId = Funs.DB.WBS_UnitWork.First(e => e.UnitWorkName == pds.Rows[i][1].ToString().Trim()).UnitWorkId;
}
Ins.ChangeOrderCode = pds.Rows[i][2].ToString().Trim();
Ins.ChangeReason = pds.Rows[i][3].ToString().Trim();
Ins.Contents = pds.Rows[i][4].ToString().Trim();
if (!string.IsNullOrEmpty(pds.Rows[i][5].ToString().Trim()))
{
Ins.CNProfessionalId = Funs.DB.Base_CNProfessional.First(e => e.ProfessionalName == pds.Rows[i][5].ToString().Trim()).CNProfessionalId;
Ins.IssuedDate = Convert.ToDateTime(pds.Rows[i][5].ToString().Trim());
}
if (!string.IsNullOrEmpty(pds.Rows[i][6].ToString().Trim()))
{
Ins.VisaDate = Convert.ToDateTime(pds.Rows[i][6].ToString().Trim());
Ins.ApprovalDate = Convert.ToDateTime(pds.Rows[i][6].ToString().Trim());
}
Ins.SignMan = pds.Rows[i][7].ToString().Trim();
Ins.AuditMan = pds.Rows[i][8].ToString().Trim();
Ins.Remark = pds.Rows[i][9].ToString().Trim();
Ins.VisaId = SQLHelper.GetNewID(typeof(Model.Comprehensive_SiteVisaManagement));
Ins.CompileMan = this.CurrUser.UserId;
BLL.SiteVisaManagementService.AddSiteVisaManagement(Ins);
if (!string.IsNullOrEmpty(pds.Rows[i][7].ToString().Trim()))
{
Ins.UnitId = BLL.UnitService.GetUnitByUnitId(pds.Rows[i][7].ToString().Trim()).UnitId;
}
Ins.ImplementationFrontState = pds.Rows[i][8].ToString().Trim();
string row9 = pds.Rows[i][9].ToString().Trim();
if (!string.IsNullOrEmpty(row9))
{
if (row9 == "未实施")
{
Ins.HandleState = "1";
}
if (row9 == "进行中")
{
Ins.HandleState = "2";
}
if (row9 == "已完成")
{
Ins.HandleState = "3";
}
}
Ins.DesignChangeOrderId = SQLHelper.GetNewID(typeof(Model.Comprehensive_DesignChangeOrder));
Ins.CompileMan = this.CurrUser.UserId;
Ins.CompileDate = DateTime.Now.Date;
BLL.DesignChangeOrderService.AddDesignChangeOrder(Ins);
}
}