2023-04-28 天辰质量报验移植
This commit is contained in:
@@ -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], 11);
|
||||
hdCheckResult.Text = "1";
|
||||
@@ -135,6 +136,11 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
//return null;
|
||||
// return dt;
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Close();
|
||||
conn.Dispose();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -168,7 +174,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
where y.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x;
|
||||
|
||||
var cns = from x in Funs.DB.Base_DesignProfessional select x;
|
||||
var cns = from x in Funs.DB.Base_CNProfessional select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
{
|
||||
@@ -315,7 +321,6 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
string rootPath = Server.MapPath("~/");
|
||||
ImportXlsToData2(rootPath + initPath + this.hdFileName.Text);
|
||||
hdCheckResult.Text = string.Empty;
|
||||
ShowNotify("导入成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -335,21 +340,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)
|
||||
{
|
||||
@@ -359,11 +364,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], 11);
|
||||
}
|
||||
@@ -402,7 +407,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
where y.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x;
|
||||
|
||||
var cns = from x in Funs.DB.Base_DesignProfessional select x;
|
||||
var cns = from x in Funs.DB.Base_CNProfessional select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
{
|
||||
@@ -416,7 +421,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
Model.Comprehensive_DesignDrawings des = new Model.Comprehensive_DesignDrawings();
|
||||
des.DesignDrawingsId = SQLHelper.GetNewID(typeof(Model.Comprehensive_DesignDrawings));
|
||||
des.ProjectId = this.CurrUser.LoginProjectId;
|
||||
des.CNProfessionalId = cn.DesignProfessionalId;
|
||||
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();
|
||||
@@ -443,7 +448,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
}
|
||||
else
|
||||
{
|
||||
oldViewInfo.CNProfessionalId = cn.DesignProfessionalId;
|
||||
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();
|
||||
@@ -502,8 +507,8 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
if (e.EventArgument == "Confirm_OK")
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string uploadfilepath = rootPath + Const.DesignDrawingsDataInUrl;
|
||||
string filePath = Const.DesignDrawingsDataInUrl;
|
||||
string uploadfilepath = rootPath + Const.DesignChangeOrderDataInUrl;
|
||||
string filePath = Const.DesignChangeOrderDataInUrl;
|
||||
string fileName = Path.GetFileName(filePath);
|
||||
FileInfo info = new FileInfo(uploadfilepath);
|
||||
long fileSize = info.Length;
|
||||
|
||||
Reference in New Issue
Block a user