@@ -58,6 +58,9 @@ | |||
<NoWin32Manifest>true</NoWin32Manifest> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<Reference Include="DBEngine"> | |||
<HintPath>..\..\工作文件\老版系统文件\化验数据采集Old\福泉采集\采集服务\化验数据采集\化验数据采集\bin\Debug\DBEngine.dll</HintPath> | |||
</Reference> | |||
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\log4net.2.0.8\lib\net40-full\log4net.dll</HintPath> | |||
</Reference> | |||
@@ -90,6 +93,12 @@ | |||
<DependentUpon>ActivationForm.cs</DependentUpon> | |||
</Compile> | |||
<Compile Include="FormSizeHelper.cs" /> | |||
<Compile Include="frmStartEndSubstring.cs"> | |||
<SubType>Form</SubType> | |||
</Compile> | |||
<Compile Include="frmStartEndSubstring.Designer.cs"> | |||
<DependentUpon>frmStartEndSubstring.cs</DependentUpon> | |||
</Compile> | |||
<Compile Include="SelectTableType.cs" /> | |||
<Compile Include="SourceSettingTextBoxDecrible.cs" /> | |||
<Compile Include="frmAddSubtract.cs"> | |||
@@ -164,11 +173,11 @@ | |||
<Compile Include="frmSplitParam.Designer.cs"> | |||
<DependentUpon>frmSplitParam.cs</DependentUpon> | |||
</Compile> | |||
<Compile Include="frmStartEndSubstring.cs"> | |||
<Compile Include="frmSubstring.cs"> | |||
<SubType>Form</SubType> | |||
</Compile> | |||
<Compile Include="frmStartEndSubstring.Designer.cs"> | |||
<DependentUpon>frmStartEndSubstring.cs</DependentUpon> | |||
<Compile Include="frmSubstring.Designer.cs"> | |||
<DependentUpon>frmSubstring.cs</DependentUpon> | |||
</Compile> | |||
<Compile Include="frmSyncParams.cs"> | |||
<SubType>Form</SubType> | |||
@@ -226,6 +235,9 @@ | |||
<EmbeddedResource Include="frmStartEndSubstring.resx"> | |||
<DependentUpon>frmStartEndSubstring.cs</DependentUpon> | |||
</EmbeddedResource> | |||
<EmbeddedResource Include="frmSubstring.resx"> | |||
<DependentUpon>frmSubstring.cs</DependentUpon> | |||
</EmbeddedResource> | |||
<EmbeddedResource Include="frmSyncParams.resx"> | |||
<DependentUpon>frmSyncParams.cs</DependentUpon> | |||
</EmbeddedResource> | |||
@@ -1,6 +1,7 @@ | |||
using CnasSynchronousCommon; | |||
using CnasSynchronusDAL; | |||
using CnasSynchrousModel; | |||
using DBEngine; | |||
using Oracle.ManagedDataAccess.Client; | |||
using System; | |||
using System.Collections.Generic; | |||
@@ -196,6 +197,19 @@ WHERE | |||
} | |||
return dt; | |||
} | |||
public static DataTable AccSql(InstrumentDataSourceInfo fileUrl,string sql) | |||
{ | |||
IDataClient dataClient = new SQLiteDataClient(); | |||
SqlConnection destConn = new SqlConnection(); | |||
dataClient.Open(fileUrl.Path); | |||
destConn.Open(); | |||
DataTable dt = dataClient.GetDataTable(sql); | |||
destConn.Close(); | |||
return dt; | |||
} | |||
#endregion | |||
#region 手动模式调取方法 | |||
@@ -15,7 +15,7 @@ namespace CNAS_DBSync | |||
{ | |||
public SyncInstrumentItemInfo syncInstrument; | |||
private ComboBox cbxConditionValue; | |||
private List<string> lstConditionValueType = new List<string>() { "等于", "连接", "若...则...", "截取", "除以", "乘以", "小数位数","数值相加(减)","截断开头(结尾)" }; | |||
private List<string> lstConditionValueType = new List<string>() { "等于", "连接", "若...则...", "截取", "除以", "乘以", "小数位数","数值相加(减)","截断开头(结尾)","位数截取" }; | |||
public frmCNASValue(SyncInstrumentItemInfo syncInstrument) | |||
{ | |||
@@ -218,6 +218,9 @@ namespace CNAS_DBSync | |||
cnasFixed.Condition = MapCondition.IFThen; | |||
break; | |||
case "截取": | |||
cnasFixed.Condition = MapCondition.Split; | |||
break; | |||
case "位数截取": | |||
cnasFixed.Condition = MapCondition.SubString; | |||
break; | |||
case "除以": | |||
@@ -262,9 +265,12 @@ namespace CNAS_DBSync | |||
case MapCondition.Multiplied: | |||
strCurrentCondition = "乘以"; | |||
break; | |||
case MapCondition.SubString: | |||
case MapCondition.Split: | |||
strCurrentCondition = "截取"; | |||
break; | |||
case MapCondition.SubString: | |||
strCurrentCondition = "位数截取"; | |||
break; | |||
case MapCondition.DecimalDigits: | |||
strCurrentCondition = "小数位数"; | |||
break; | |||
@@ -368,6 +374,40 @@ namespace CNAS_DBSync | |||
} | |||
} | |||
if (dgvCnas.Rows[e.RowIndex].Cells["condition"].Value.ToString() == "截取") | |||
{ | |||
CnasConditionMapValue cnasFixed = new CnasConditionMapValue | |||
{ | |||
TableName = dgvCnas.Rows[e.RowIndex].Cells["TableName"].Value.ToString(), | |||
ColumnName = dgvCnas.Rows[e.RowIndex].Cells["TableColumn"].Value.ToString(), | |||
Condition = MapCondition.Split | |||
}; | |||
if (dgvCnas.Rows[e.RowIndex].Cells["Value"].Value != null) | |||
cnasFixed.Value = dgvCnas.Rows[e.RowIndex].Cells["Value"].Value.ToString(); | |||
frmStartEndSubstring frmSplitParam = new frmStartEndSubstring(cnasFixed); | |||
if (frmSplitParam.ShowDialog() == DialogResult.OK) | |||
{ | |||
if (frmSplitParam.conditionvalue.Value != null && frmSplitParam.conditionvalue.Value.ToString() != "") | |||
{ | |||
dgvCnas.Rows[e.RowIndex].Cells["Value"].Value = frmSplitParam.conditionvalue.Value; | |||
//将数据插入到数据源中 | |||
var query = syncInstrument.lstFixedValue.Where(s => s.TableName == cnasFixed.TableName && s.ColumnName == cnasFixed.ColumnName).ToList<CnasConditionMapValue>(); | |||
if (query.Count >= 1) | |||
{ | |||
query[0].Condition = cnasFixed.Condition; | |||
query[0].Value = frmSplitParam.conditionvalue.Value; | |||
} | |||
else | |||
{ | |||
cnasFixed.Value = frmSplitParam.conditionvalue.Value; | |||
syncInstrument.lstFixedValue.Add(cnasFixed); | |||
} | |||
} | |||
} | |||
} | |||
if (dgvCnas.Rows[e.RowIndex].Cells["condition"].Value.ToString() == "位数截取") | |||
{ | |||
CnasConditionMapValue cnasFixed = new CnasConditionMapValue | |||
{ | |||
@@ -412,7 +452,7 @@ namespace CNAS_DBSync | |||
if (dgvCnas.Rows[e.RowIndex].Cells["Value"].Value != null) | |||
cnasFixed.Value = dgvCnas.Rows[e.RowIndex].Cells["Value"].Value.ToString(); | |||
frmStartEndSubstring frmStartEnd = new frmStartEndSubstring(cnasFixed); | |||
frmSubstring frmStartEnd = new frmSubstring(cnasFixed); | |||
if (frmStartEnd.ShowDialog() == DialogResult.OK) | |||
{ | |||
if (frmStartEnd.conditionvalue.Value != null && frmStartEnd.conditionvalue.Value.ToString() != "") | |||
@@ -48,17 +48,16 @@ | |||
this.pnlAll.Controls.Add(this.groupBox1); | |||
this.pnlAll.Dock = System.Windows.Forms.DockStyle.Fill; | |||
this.pnlAll.Location = new System.Drawing.Point(0, 0); | |||
this.pnlAll.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); | |||
this.pnlAll.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); | |||
this.pnlAll.Name = "pnlAll"; | |||
this.pnlAll.Size = new System.Drawing.Size(581, 305); | |||
this.pnlAll.Size = new System.Drawing.Size(436, 188); | |||
this.pnlAll.TabIndex = 2; | |||
// | |||
// btnOK | |||
// | |||
this.btnOK.Location = new System.Drawing.Point(457, 239); | |||
this.btnOK.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); | |||
this.btnOK.Location = new System.Drawing.Point(336, 149); | |||
this.btnOK.Name = "btnOK"; | |||
this.btnOK.Size = new System.Drawing.Size(120, 38); | |||
this.btnOK.Size = new System.Drawing.Size(90, 30); | |||
this.btnOK.TabIndex = 1; | |||
this.btnOK.Text = "确定"; | |||
this.btnOK.UseVisualStyleBackColor = true; | |||
@@ -74,11 +73,9 @@ | |||
this.groupBox1.Controls.Add(this.label2); | |||
this.groupBox1.Controls.Add(this.label1); | |||
this.groupBox1.Controls.Add(this.txtPrama1); | |||
this.groupBox1.Location = new System.Drawing.Point(16, 15); | |||
this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); | |||
this.groupBox1.Location = new System.Drawing.Point(12, 12); | |||
this.groupBox1.Name = "groupBox1"; | |||
this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); | |||
this.groupBox1.Size = new System.Drawing.Size(552, 216); | |||
this.groupBox1.Size = new System.Drawing.Size(414, 131); | |||
this.groupBox1.TabIndex = 0; | |||
this.groupBox1.TabStop = false; | |||
this.groupBox1.Text = "截断开头/结尾字符参数"; | |||
@@ -86,10 +83,9 @@ | |||
// label3 | |||
// | |||
this.label3.AutoSize = true; | |||
this.label3.Location = new System.Drawing.Point(20, 170); | |||
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); | |||
this.label3.Location = new System.Drawing.Point(15, 96); | |||
this.label3.Name = "label3"; | |||
this.label3.Size = new System.Drawing.Size(504, 15); | |||
this.label3.Size = new System.Drawing.Size(401, 12); | |||
this.label3.TabIndex = 10; | |||
this.label3.Text = "(说明:若操作字符串中不存在或存在多个截断字符,则直接返回初始字符串)"; | |||
// | |||
@@ -99,68 +95,61 @@ | |||
this.cbxPrama2.Items.AddRange(new object[] { | |||
"S", | |||
"E"}); | |||
this.cbxPrama2.Location = new System.Drawing.Point(100, 104); | |||
this.cbxPrama2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); | |||
this.cbxPrama2.Location = new System.Drawing.Point(75, 59); | |||
this.cbxPrama2.Name = "cbxPrama2"; | |||
this.cbxPrama2.Size = new System.Drawing.Size(160, 23); | |||
this.cbxPrama2.Size = new System.Drawing.Size(121, 20); | |||
this.cbxPrama2.TabIndex = 9; | |||
// | |||
// label5 | |||
// | |||
this.label5.AutoSize = true; | |||
this.label5.Location = new System.Drawing.Point(265, 110); | |||
this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); | |||
this.label5.Location = new System.Drawing.Point(199, 64); | |||
this.label5.Name = "label5"; | |||
this.label5.Size = new System.Drawing.Size(139, 15); | |||
this.label5.Size = new System.Drawing.Size(107, 12); | |||
this.label5.TabIndex = 7; | |||
this.label5.Text = "(开头(S)/结尾(E))"; | |||
// | |||
// label4 | |||
// | |||
this.label4.AutoSize = true; | |||
this.label4.Location = new System.Drawing.Point(267, 44); | |||
this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); | |||
this.label4.Location = new System.Drawing.Point(200, 35); | |||
this.label4.Name = "label4"; | |||
this.label4.Size = new System.Drawing.Size(83, 15); | |||
this.label4.Size = new System.Drawing.Size(65, 12); | |||
this.label4.TabIndex = 6; | |||
this.label4.Text = "(截断字符)"; | |||
// | |||
// label2 | |||
// | |||
this.label2.AutoSize = true; | |||
this.label2.Location = new System.Drawing.Point(24, 109); | |||
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); | |||
this.label2.Location = new System.Drawing.Point(18, 63); | |||
this.label2.Name = "label2"; | |||
this.label2.Size = new System.Drawing.Size(60, 15); | |||
this.label2.Size = new System.Drawing.Size(47, 12); | |||
this.label2.TabIndex = 3; | |||
this.label2.Text = "参数2:"; | |||
// | |||
// label1 | |||
// | |||
this.label1.AutoSize = true; | |||
this.label1.Location = new System.Drawing.Point(24, 42); | |||
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); | |||
this.label1.Location = new System.Drawing.Point(18, 34); | |||
this.label1.Name = "label1"; | |||
this.label1.Size = new System.Drawing.Size(60, 15); | |||
this.label1.Size = new System.Drawing.Size(47, 12); | |||
this.label1.TabIndex = 1; | |||
this.label1.Text = "参数1:"; | |||
// | |||
// txtPrama1 | |||
// | |||
this.txtPrama1.Location = new System.Drawing.Point(100, 39); | |||
this.txtPrama1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); | |||
this.txtPrama1.Location = new System.Drawing.Point(75, 31); | |||
this.txtPrama1.Name = "txtPrama1"; | |||
this.txtPrama1.Size = new System.Drawing.Size(160, 25); | |||
this.txtPrama1.Size = new System.Drawing.Size(121, 21); | |||
this.txtPrama1.TabIndex = 0; | |||
// | |||
// frmStartEndSubstring | |||
// | |||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); | |||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); | |||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | |||
this.ClientSize = new System.Drawing.Size(581, 305); | |||
this.ClientSize = new System.Drawing.Size(436, 188); | |||
this.Controls.Add(this.pnlAll); | |||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; | |||
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); | |||
this.Name = "frmStartEndSubstring"; | |||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; | |||
this.Text = "截断开头/结尾"; | |||
@@ -0,0 +1,188 @@ | |||
namespace CNAS_DBSync | |||
{ | |||
partial class frmSubstring | |||
{ | |||
/// <summary> | |||
/// Required designer variable. | |||
/// </summary> | |||
private System.ComponentModel.IContainer components = null; | |||
/// <summary> | |||
/// Clean up any resources being used. | |||
/// </summary> | |||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> | |||
protected override void Dispose(bool disposing) | |||
{ | |||
if (disposing && (components != null)) | |||
{ | |||
components.Dispose(); | |||
} | |||
base.Dispose(disposing); | |||
} | |||
#region Windows Form Designer generated code | |||
/// <summary> | |||
/// Required method for Designer support - do not modify | |||
/// the contents of this method with the code editor. | |||
/// </summary> | |||
private void InitializeComponent() | |||
{ | |||
this.pnlAll = new System.Windows.Forms.Panel(); | |||
this.btnOK = new System.Windows.Forms.Button(); | |||
this.groupBox1 = new System.Windows.Forms.GroupBox(); | |||
this.label3 = new System.Windows.Forms.Label(); | |||
this.cbxPrama2 = new System.Windows.Forms.ComboBox(); | |||
this.label5 = new System.Windows.Forms.Label(); | |||
this.label4 = new System.Windows.Forms.Label(); | |||
this.label2 = new System.Windows.Forms.Label(); | |||
this.label1 = new System.Windows.Forms.Label(); | |||
this.txtPrama1 = new System.Windows.Forms.TextBox(); | |||
this.pnlAll.SuspendLayout(); | |||
this.groupBox1.SuspendLayout(); | |||
this.SuspendLayout(); | |||
// | |||
// pnlAll | |||
// | |||
this.pnlAll.Controls.Add(this.btnOK); | |||
this.pnlAll.Controls.Add(this.groupBox1); | |||
this.pnlAll.Dock = System.Windows.Forms.DockStyle.Fill; | |||
this.pnlAll.Location = new System.Drawing.Point(0, 0); | |||
this.pnlAll.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); | |||
this.pnlAll.Name = "pnlAll"; | |||
this.pnlAll.Size = new System.Drawing.Size(581, 305); | |||
this.pnlAll.TabIndex = 2; | |||
// | |||
// btnOK | |||
// | |||
this.btnOK.Location = new System.Drawing.Point(457, 239); | |||
this.btnOK.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); | |||
this.btnOK.Name = "btnOK"; | |||
this.btnOK.Size = new System.Drawing.Size(120, 38); | |||
this.btnOK.TabIndex = 1; | |||
this.btnOK.Text = "确定"; | |||
this.btnOK.UseVisualStyleBackColor = true; | |||
this.btnOK.Click += new System.EventHandler(this.btnOK_Click); | |||
// | |||
// groupBox1 | |||
// | |||
this.groupBox1.BackColor = System.Drawing.SystemColors.Control; | |||
this.groupBox1.Controls.Add(this.label3); | |||
this.groupBox1.Controls.Add(this.cbxPrama2); | |||
this.groupBox1.Controls.Add(this.label5); | |||
this.groupBox1.Controls.Add(this.label4); | |||
this.groupBox1.Controls.Add(this.label2); | |||
this.groupBox1.Controls.Add(this.label1); | |||
this.groupBox1.Controls.Add(this.txtPrama1); | |||
this.groupBox1.Location = new System.Drawing.Point(16, 15); | |||
this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); | |||
this.groupBox1.Name = "groupBox1"; | |||
this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); | |||
this.groupBox1.Size = new System.Drawing.Size(552, 216); | |||
this.groupBox1.TabIndex = 0; | |||
this.groupBox1.TabStop = false; | |||
this.groupBox1.Text = "截断开头/结尾字符参数"; | |||
// | |||
// label3 | |||
// | |||
this.label3.AutoSize = true; | |||
this.label3.Location = new System.Drawing.Point(20, 170); | |||
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); | |||
this.label3.Name = "label3"; | |||
this.label3.Size = new System.Drawing.Size(504, 15); | |||
this.label3.TabIndex = 10; | |||
this.label3.Text = "(说明:若操作字符串中不存在或存在多个截断字符,则直接返回初始字符串)"; | |||
// | |||
// cbxPrama2 | |||
// | |||
this.cbxPrama2.FormattingEnabled = true; | |||
this.cbxPrama2.Items.AddRange(new object[] { | |||
"S", | |||
"E"}); | |||
this.cbxPrama2.Location = new System.Drawing.Point(100, 104); | |||
this.cbxPrama2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); | |||
this.cbxPrama2.Name = "cbxPrama2"; | |||
this.cbxPrama2.Size = new System.Drawing.Size(160, 23); | |||
this.cbxPrama2.TabIndex = 9; | |||
// | |||
// label5 | |||
// | |||
this.label5.AutoSize = true; | |||
this.label5.Location = new System.Drawing.Point(265, 110); | |||
this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); | |||
this.label5.Name = "label5"; | |||
this.label5.Size = new System.Drawing.Size(139, 15); | |||
this.label5.TabIndex = 7; | |||
this.label5.Text = "(开头(S)/结尾(E))"; | |||
// | |||
// label4 | |||
// | |||
this.label4.AutoSize = true; | |||
this.label4.Location = new System.Drawing.Point(267, 44); | |||
this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); | |||
this.label4.Name = "label4"; | |||
this.label4.Size = new System.Drawing.Size(83, 15); | |||
this.label4.TabIndex = 6; | |||
this.label4.Text = "(截断字符)"; | |||
// | |||
// label2 | |||
// | |||
this.label2.AutoSize = true; | |||
this.label2.Location = new System.Drawing.Point(24, 109); | |||
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); | |||
this.label2.Name = "label2"; | |||
this.label2.Size = new System.Drawing.Size(60, 15); | |||
this.label2.TabIndex = 3; | |||
this.label2.Text = "参数2:"; | |||
// | |||
// label1 | |||
// | |||
this.label1.AutoSize = true; | |||
this.label1.Location = new System.Drawing.Point(24, 42); | |||
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); | |||
this.label1.Name = "label1"; | |||
this.label1.Size = new System.Drawing.Size(60, 15); | |||
this.label1.TabIndex = 1; | |||
this.label1.Text = "参数1:"; | |||
// | |||
// txtPrama1 | |||
// | |||
this.txtPrama1.Location = new System.Drawing.Point(100, 39); | |||
this.txtPrama1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); | |||
this.txtPrama1.Name = "txtPrama1"; | |||
this.txtPrama1.Size = new System.Drawing.Size(160, 25); | |||
this.txtPrama1.TabIndex = 0; | |||
// | |||
// frmStartEndSubstring | |||
// | |||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); | |||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | |||
this.ClientSize = new System.Drawing.Size(581, 305); | |||
this.Controls.Add(this.pnlAll); | |||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; | |||
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); | |||
this.Name = "frmStartEndSubstring"; | |||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; | |||
this.Text = "截断开头/结尾"; | |||
this.Load += new System.EventHandler(this.frmStartEndSubstring_Load); | |||
this.pnlAll.ResumeLayout(false); | |||
this.groupBox1.ResumeLayout(false); | |||
this.groupBox1.PerformLayout(); | |||
this.ResumeLayout(false); | |||
} | |||
#endregion | |||
private System.Windows.Forms.Panel pnlAll; | |||
private System.Windows.Forms.Button btnOK; | |||
private System.Windows.Forms.GroupBox groupBox1; | |||
private System.Windows.Forms.Label label3; | |||
private System.Windows.Forms.ComboBox cbxPrama2; | |||
private System.Windows.Forms.Label label5; | |||
private System.Windows.Forms.Label label4; | |||
private System.Windows.Forms.Label label2; | |||
private System.Windows.Forms.Label label1; | |||
private System.Windows.Forms.TextBox txtPrama1; | |||
} | |||
} |
@@ -0,0 +1,64 @@ | |||
using CnasSynchrousModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
using System.Data; | |||
using System.Drawing; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Windows.Forms; | |||
namespace CNAS_DBSync | |||
{ | |||
public partial class frmSubstring : Form | |||
{ | |||
public CnasConditionMapValue conditionvalue { get; set; } | |||
public frmSubstring(CnasConditionMapValue conditionvalue) | |||
{ | |||
InitializeComponent(); | |||
this.conditionvalue = conditionvalue; | |||
} | |||
private void frmStartEndSubstring_Load(object sender, EventArgs e) | |||
{ | |||
if (this.conditionvalue == null) return; | |||
if (this.conditionvalue.Value == null) return; | |||
if (this.conditionvalue.Condition != MapCondition.SubstringStartEnd) return; | |||
//根据旧值显示控件默认值 | |||
if (this.conditionvalue.Value.ToString() != "") | |||
{ | |||
string[] strConditionValues = this.conditionvalue.Value.ToString().Split(new string[] { "{", ",", "}" }, StringSplitOptions.RemoveEmptyEntries); | |||
if (strConditionValues.Length == 2) | |||
{ | |||
this.txtPrama1.Text = strConditionValues[0]; | |||
this.cbxPrama2.Text = strConditionValues[1]; | |||
} | |||
} | |||
} | |||
private void btnOK_Click(object sender, EventArgs e) | |||
{ | |||
if (this.txtPrama1.Text == "") | |||
{ | |||
MessageBox.Show("参数1不能为空。"); | |||
return; | |||
} | |||
if (this.cbxPrama2.Text == "") | |||
{ | |||
MessageBox.Show("参数2不能为空。"); | |||
return; | |||
} | |||
if (this.cbxPrama2.Text != "S" && this.cbxPrama2.Text != "E") | |||
{ | |||
MessageBox.Show("参数2不符合规则,请重新选择。"); | |||
return; | |||
} | |||
this.conditionvalue.Value = "{" + this.txtPrama1.Text + "," + this.cbxPrama2.Text + "}"; | |||
this.DialogResult = DialogResult.OK; | |||
this.Close(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,120 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<root> | |||
<!-- | |||
Microsoft ResX Schema | |||
Version 2.0 | |||
The primary goals of this format is to allow a simple XML format | |||
that is mostly human readable. The generation and parsing of the | |||
various data types are done through the TypeConverter classes | |||
associated with the data types. | |||
Example: | |||
... ado.net/XML headers & schema ... | |||
<resheader name="resmimetype">text/microsoft-resx</resheader> | |||
<resheader name="version">2.0</resheader> | |||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | |||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | |||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | |||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | |||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | |||
<value>[base64 mime encoded serialized .NET Framework object]</value> | |||
</data> | |||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | |||
<comment>This is a comment</comment> | |||
</data> | |||
There are any number of "resheader" rows that contain simple | |||
name/value pairs. | |||
Each data row contains a name, and value. The row also contains a | |||
type or mimetype. Type corresponds to a .NET class that support | |||
text/value conversion through the TypeConverter architecture. | |||
Classes that don't support this are serialized and stored with the | |||
mimetype set. | |||
The mimetype is used for serialized objects, and tells the | |||
ResXResourceReader how to depersist the object. This is currently not | |||
extensible. For a given mimetype the value must be set accordingly: | |||
Note - application/x-microsoft.net.object.binary.base64 is the format | |||
that the ResXResourceWriter will generate, however the reader can | |||
read any of the formats listed below. | |||
mimetype: application/x-microsoft.net.object.binary.base64 | |||
value : The object must be serialized with | |||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | |||
: and then encoded with base64 encoding. | |||
mimetype: application/x-microsoft.net.object.soap.base64 | |||
value : The object must be serialized with | |||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter | |||
: and then encoded with base64 encoding. | |||
mimetype: application/x-microsoft.net.object.bytearray.base64 | |||
value : The object must be serialized into a byte array | |||
: using a System.ComponentModel.TypeConverter | |||
: and then encoded with base64 encoding. | |||
--> | |||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | |||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | |||
<xsd:element name="root" msdata:IsDataSet="true"> | |||
<xsd:complexType> | |||
<xsd:choice maxOccurs="unbounded"> | |||
<xsd:element name="metadata"> | |||
<xsd:complexType> | |||
<xsd:sequence> | |||
<xsd:element name="value" type="xsd:string" minOccurs="0" /> | |||
</xsd:sequence> | |||
<xsd:attribute name="name" use="required" type="xsd:string" /> | |||
<xsd:attribute name="type" type="xsd:string" /> | |||
<xsd:attribute name="mimetype" type="xsd:string" /> | |||
<xsd:attribute ref="xml:space" /> | |||
</xsd:complexType> | |||
</xsd:element> | |||
<xsd:element name="assembly"> | |||
<xsd:complexType> | |||
<xsd:attribute name="alias" type="xsd:string" /> | |||
<xsd:attribute name="name" type="xsd:string" /> | |||
</xsd:complexType> | |||
</xsd:element> | |||
<xsd:element name="data"> | |||
<xsd:complexType> | |||
<xsd:sequence> | |||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | |||
</xsd:sequence> | |||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | |||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | |||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | |||
<xsd:attribute ref="xml:space" /> | |||
</xsd:complexType> | |||
</xsd:element> | |||
<xsd:element name="resheader"> | |||
<xsd:complexType> | |||
<xsd:sequence> | |||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||
</xsd:sequence> | |||
<xsd:attribute name="name" type="xsd:string" use="required" /> | |||
</xsd:complexType> | |||
</xsd:element> | |||
</xsd:choice> | |||
</xsd:complexType> | |||
</xsd:element> | |||
</xsd:schema> | |||
<resheader name="resmimetype"> | |||
<value>text/microsoft-resx</value> | |||
</resheader> | |||
<resheader name="version"> | |||
<value>2.0</value> | |||
</resheader> | |||
<resheader name="reader"> | |||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
</resheader> | |||
<resheader name="writer"> | |||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
</resheader> | |||
</root> |
@@ -373,6 +373,7 @@ namespace CNAS_DBSync | |||
case DataSourceType.Kingbase: | |||
dtTableType = SelectTableType.KingSql(strTableName_Instru); | |||
break; | |||
default: | |||
strTableName_Instru = matchedInstrument.SyncInstrumentDSInfo.InstrumentDataSourceType.ToString(); | |||
@@ -481,10 +482,10 @@ namespace CNAS_DBSync | |||
{ | |||
cbxCNASColumn.Text = this.txtInstrumentColumn.Text = currentSyncItem.CnasInstrumentColumn; | |||
} | |||
else | |||
{ | |||
cbxCNASColumn.Text = this.txtInstrumentColumn.Text = ""; | |||
} | |||
//else | |||
//{ | |||
// cbxCNASColumn.Text = this.txtInstrumentColumn.Text = ""; | |||
//} | |||
} | |||
} | |||
} | |||
@@ -778,6 +779,11 @@ namespace CNAS_DBSync | |||
sqlName = KingbaseFormat.AutoSql.KingbaseViewName; | |||
sql = KingbaseFormat.AutoSql.KingbaseViewSql; | |||
break; | |||
case DataSourceType.Access: | |||
AccessFormat = FileOperation.GetFormatConfigData<AccessFormatConfig>("AccessFormatConfig.xml"); | |||
sqlName = AccessFormat.AutoSql.AccessViewName; | |||
sql = AccessFormat.AutoSql.AccessViewSql; | |||
break; | |||
default: | |||
break; | |||
} | |||
@@ -822,7 +828,13 @@ namespace CNAS_DBSync | |||
dataTableStruct = SelectTableType.KingSql(sql); | |||
break; | |||
case DataSourceType.Access: | |||
//根据手动输入来源库的表名加载字段 | |||
dataTableStruct = SelectTableType.AccSql(currentSyncItem.SyncInstrumentDSInfo, sql); | |||
break; | |||
default: | |||
break; | |||
} | |||
DataTable dtInstruShow = new DataTable(); | |||
@@ -186,6 +186,9 @@ namespace CnasSynchronusClient | |||
case MapCondition.SubString: | |||
ChangeSubStringConditonValue(item, drNewTarget); | |||
break; | |||
case MapCondition.Split: | |||
ChangeSplitnValue(item, drNewTarget); | |||
break; | |||
case MapCondition.SubstringStartEnd: | |||
ChangeStartEndSubStringConditonValue(item, drNewTarget); | |||
break; | |||
@@ -521,6 +524,50 @@ namespace CnasSynchronusClient | |||
} | |||
} | |||
/// <summary> | |||
/// 处理Split类型固定值 | |||
/// </summary> | |||
/// <param name="item"></param> | |||
/// <param name="dtReadySource"></param> | |||
/// <param name="drSource"></param> | |||
/// <param name="drNewTarget"></param> | |||
private void ChangeSplitnValue(CnasConditionMapValue item, DataRow drNewTarget) | |||
{ | |||
try | |||
{ | |||
if (item.Value != null && item.Value.ToString() != "") | |||
{ | |||
string[] strValues = item.Value.ToString().Split(new string[] { "{", ",", "}" }, StringSplitOptions.RemoveEmptyEntries); | |||
if (strValues.Length == 2) | |||
{ | |||
string[] strInputValues = drNewTarget[item.ColumnName].ToString().Split(new string[] { strValues[0] }, StringSplitOptions.RemoveEmptyEntries); | |||
//if (strInputValues.Length == 1) | |||
//{ | |||
// var list = strInputValues[0].Substring(Convert.ToInt32(strValues[0]), Convert.ToInt32(strValues[1])); | |||
// drNewTarget[item.ColumnName] = list; | |||
//} | |||
if (strInputValues.Length == 2) //只处理分割后有两部分的 | |||
{ | |||
if (strValues[1] == "L") | |||
{ | |||
drNewTarget[item.ColumnName] = strInputValues[0]; | |||
} | |||
else if (strValues[1] == "R") | |||
{ | |||
drNewTarget[item.ColumnName] = strInputValues[1]; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
AppLog.Error(ex.Message); | |||
} | |||
} | |||
private void ChangeAddSubtractConditonValue(List<CnasConditionMapValue> lstConditionMaps, CnasConditionMapValue item, DataTable dtReadySource, DataRow drSource, DataRow drNewTarget) | |||
{ | |||
try | |||
@@ -41,6 +41,7 @@ namespace CnasSynchrousModel | |||
Multiplied, | |||
DecimalDigits, | |||
AddSubtract, | |||
SubstringStartEnd | |||
SubstringStartEnd, | |||
Split | |||
} | |||
} |
@@ -1,109 +0,0 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<configuration> | |||
<configSections> | |||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> | |||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> | |||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> | |||
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<section name="CNAS_DBSync.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> | |||
</sectionGroup> | |||
</configSections> | |||
<connectionStrings> | |||
<add name="CoreDb" connectionString="Driver={IBM DB2 ODBC DRIVER};DataBase=SAMPLE; HostName=127.0.0.1; Protocol=TCPIP;Port=50000;Uid=db2admin;Pwd=123" /> | |||
<add name="CNAS_DBSync.Properties.Settings.ConnectionString" connectionString="Data Source=C:\DEV\CNAS\CNASClient\CNAS_DBSync\dll\database.db" providerName="Devart.Data.SQLite" /> | |||
</connectionStrings> | |||
<appSettings> | |||
<add key="TargetDBType" value="Mysql" /> | |||
<add key="InitalOperationPwd" value="zIU7s3Rawog=" /> | |||
<add key="GetMacMethod" value="1" /> | |||
<add key="StartGeneralVersion" value="1" /> | |||
<add key="StartWebApiUrl" value="1" /> | |||
<add key="WebApiUrl" value="http://localhost:60101/api" /> | |||
</appSettings> | |||
<entityFramework> | |||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> | |||
<parameters> | |||
<parameter value="mssqllocaldb" /> | |||
</parameters> | |||
</defaultConnectionFactory> | |||
<providers> | |||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> | |||
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" /> | |||
</providers> | |||
</entityFramework> | |||
<system.data> | |||
<DbProviderFactories> | |||
<remove invariant="System.Data.SQLite.EF6" /> | |||
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" /> | |||
<remove invariant="System.Data.SQLite" /><add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /></DbProviderFactories> | |||
</system.data> | |||
<log4net> | |||
<logger name="Log"> | |||
<level value="INFO" /> | |||
<appender-ref ref="RollingLog" /> | |||
</logger> | |||
<logger name="Err"> | |||
<level value="ERROR" /> | |||
<appender-ref ref="RollingErr" /> | |||
</logger> | |||
<appender name="RollingLog" type="log4net.Appender.RollingFileAppender"> | |||
<file value="Log\" /> | |||
<appendToFile value="true" /> | |||
<rollingStyle value="Date" /> | |||
<datePattern value="yyyyMMdd'.txt'" /> | |||
<staticLogFileName value="false" /> | |||
<layout type="log4net.Layout.PatternLayout"> | |||
<conversionPattern value="记录时间:%d 线程ID:[%thread]- 操作信息:%m%n" /> | |||
</layout> | |||
<filter type="log4net.Filter.LevelRangeFilter"> | |||
<param name="LevelMin" value="INFO" /> | |||
<param name="LevelMax" value="INFO" /> | |||
</filter> | |||
</appender> | |||
<appender name="RollingErr" type="log4net.Appender.RollingFileAppender"> | |||
<file value="ErrorLog\" /> | |||
<appendToFile value="true" /> | |||
<rollingStyle value="Date" /> | |||
<datePattern value="yyyyMMdd'.txt'" /> | |||
<staticLogFileName value="false" /> | |||
<layout type="log4net.Layout.PatternLayout"> | |||
<conversionPattern value="记录时间:%d 线程ID:[%thread]- 错误描述:%m%n" /> | |||
</layout> | |||
<filter type="log4net.Filter.LevelRangeFilter"> | |||
<param name="LevelMin" value="ERROR" /> | |||
<param name="LevelMax" value="ERROR" /> | |||
</filter> | |||
</appender> | |||
</log4net> | |||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /></startup><applicationSettings> | |||
<CNAS_DBSync.Properties.Settings> | |||
<setting name="SyncParamSize" serializeAs="String"> | |||
<value /> | |||
</setting> | |||
</CNAS_DBSync.Properties.Settings> | |||
</applicationSettings> | |||
<runtime> | |||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | |||
<dependentAssembly> | |||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> | |||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> | |||
</dependentAssembly> | |||
<dependentAssembly> | |||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> | |||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> | |||
</dependentAssembly> | |||
<dependentAssembly> | |||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> | |||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" /> | |||
</dependentAssembly> | |||
<dependentAssembly> | |||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> | |||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" /> | |||
</dependentAssembly> | |||
<dependentAssembly> | |||
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> | |||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> | |||
</dependentAssembly> | |||
</assemblyBinding> | |||
</runtime> | |||
</configuration> |
@@ -1 +0,0 @@ | |||
<?xml version="1.0" encoding="utf-8"?><AccessFormatConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><AccessSuffix>.mdb</AccessSuffix><AccessFileVersion>0</AccessFileVersion><AccessFileDateColumnFormat>yyyyMMddHHmmss</AccessFileDateColumnFormat><AccessFileTableNameFormat>MM</AccessFileTableNameFormat><AccessFileNameFormat /><ReadAccessFileMode>0</ReadAccessFileMode><AutoSql><AccessViewName /><AccessViewSql /></AutoSql></AccessFormatConfig> |