Commit d483b75a 刘韬

123

1 个父辈 e490badd
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
...@@ -56,6 +57,7 @@ ...@@ -56,6 +57,7 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<StartupObject> <StartupObject>
...@@ -73,7 +75,7 @@ ...@@ -73,7 +75,7 @@
<GenerateManifests>false</GenerateManifests> <GenerateManifests>false</GenerateManifests>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest> <ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Common.Logging"> <Reference Include="Common.Logging">
...@@ -129,6 +131,9 @@ ...@@ -129,6 +131,9 @@
<Reference Include="System.Management" /> <Reference Include="System.Management" />
<Reference Include="System.Runtime.Serialization.Formatters.Soap" /> <Reference Include="System.Runtime.Serialization.Formatters.Soap" />
<Reference Include="System.Transactions" /> <Reference Include="System.Transactions" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\portable-net40+sl4+win8+wp8\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web" /> <Reference Include="System.Web" />
<Reference Include="System.Web.Services" /> <Reference Include="System.Web.Services" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
...@@ -243,6 +248,30 @@ ...@@ -243,6 +248,30 @@
<Compile Include="MetroTestResult.Designer.cs"> <Compile Include="MetroTestResult.Designer.cs">
<DependentUpon>MetroTestResult.cs</DependentUpon> <DependentUpon>MetroTestResult.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="NewCode\CaliDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="NewCode\CaliDialog.Designer.cs">
<DependentUpon>CaliDialog.cs</DependentUpon>
</Compile>
<Compile Include="NewCode\FrmAdjustQuotiety2.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="NewCode\FrmAdjustQuotiety2.designer.cs">
<DependentUpon>FrmAdjustQuotiety2.cs</DependentUpon>
</Compile>
<Compile Include="NewCode\FrmTestManage2.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="NewCode\FrmTestManage2.designer.cs">
<DependentUpon>FrmTestManage2.cs</DependentUpon>
</Compile>
<Compile Include="NewCode\ucCalibration.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="NewCode\ucCalibration.Designer.cs">
<DependentUpon>ucCalibration.cs</DependentUpon>
</Compile>
<Compile Include="Properties\Resources.Designer.cs"> <Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
...@@ -503,6 +532,19 @@ ...@@ -503,6 +532,19 @@
<EmbeddedResource Include="MetroTestResult.resx"> <EmbeddedResource Include="MetroTestResult.resx">
<DependentUpon>MetroTestResult.cs</DependentUpon> <DependentUpon>MetroTestResult.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="NewCode\CaliDialog.resx">
<DependentUpon>CaliDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="NewCode\FrmAdjustQuotiety2.resx">
<DependentUpon>FrmAdjustQuotiety2.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="NewCode\FrmTestManage2.resx">
<DependentUpon>FrmTestManage2.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="NewCode\ucCalibration.resx">
<DependentUpon>ucCalibration.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\LResource.ja-JP.resx"> <EmbeddedResource Include="Properties\LResource.ja-JP.resx">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
...@@ -527,7 +569,7 @@ ...@@ -527,7 +569,7 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Properties\app.manifest"> <None Include="app.manifest">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</None> </None>
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
......
此文件类型无法预览
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
<value>161, 17</value> <value>161, 17</value>
</metadata> </metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnStopAdjusting.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="btnAutoCalibration.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AADT00lEQVR4Xuz9V7Al1b3ve66H+9JxOuK8 JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AADT00lEQVR4Xuz9V7Al1b3ve66H+9JxOuK8
...@@ -1034,7 +1034,7 @@ ...@@ -1034,7 +1034,7 @@
UhxauVjrTxwvaQBEen563fVJsuA6Op4Aiixigt3rpnQAAAAASUVORK5CYII= UhxauVjrTxwvaQBEen563fVJsuA6Op4Aiixigt3rpnQAAAAASUVORK5CYII=
</value> </value>
</data> </data>
<data name="BtnStartTest.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="btn_OK.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AADT00lEQVR4Xuz9V7Al1b3ve66H+9JxOuK8 JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AADT00lEQVR4Xuz9V7Al1b3ve66H+9JxOuK8
...@@ -1944,7 +1944,7 @@ ...@@ -1944,7 +1944,7 @@
UhxauVjrTxwvaQBEen563fVJsuA6Op4Aiixigt3rpnQAAAAASUVORK5CYII= UhxauVjrTxwvaQBEen563fVJsuA6Op4Aiixigt3rpnQAAAAASUVORK5CYII=
</value> </value>
</data> </data>
<data name="btnFinishCalibration.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="btn_Input.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AADT00lEQVR4Xuz9V7Al1b3ve66H+9JxOuK8 JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AADT00lEQVR4Xuz9V7Al1b3ve66H+9JxOuK8
...@@ -2854,7 +2854,7 @@ ...@@ -2854,7 +2854,7 @@
UhxauVjrTxwvaQBEen563fVJsuA6Op4Aiixigt3rpnQAAAAASUVORK5CYII= UhxauVjrTxwvaQBEen563fVJsuA6Op4Aiixigt3rpnQAAAAASUVORK5CYII=
</value> </value>
</data> </data>
<data name="btn_OK.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="btn_Export.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AADT00lEQVR4Xuz9V7Al1b3ve66H+9JxOuK8 JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AADT00lEQVR4Xuz9V7Al1b3ve66H+9JxOuK8
...@@ -3764,7 +3764,7 @@ ...@@ -3764,7 +3764,7 @@
UhxauVjrTxwvaQBEen563fVJsuA6Op4Aiixigt3rpnQAAAAASUVORK5CYII= UhxauVjrTxwvaQBEen563fVJsuA6Op4Aiixigt3rpnQAAAAASUVORK5CYII=
</value> </value>
</data> </data>
<data name="btn_Input.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="BtnReConnect.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AADT00lEQVR4Xuz9V7Al1b3ve66H+9JxOuK8 JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AADT00lEQVR4Xuz9V7Al1b3ve66H+9JxOuK8
...@@ -4674,7 +4674,7 @@ ...@@ -4674,7 +4674,7 @@
UhxauVjrTxwvaQBEen563fVJsuA6Op4Aiixigt3rpnQAAAAASUVORK5CYII= UhxauVjrTxwvaQBEen563fVJsuA6Op4Aiixigt3rpnQAAAAASUVORK5CYII=
</value> </value>
</data> </data>
<data name="btn_Export.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="btnStopAdjusting.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AADT00lEQVR4Xuz9V7Al1b3ve66H+9JxOuK8 JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AADT00lEQVR4Xuz9V7Al1b3ve66H+9JxOuK8
...@@ -5584,7 +5584,7 @@ ...@@ -5584,7 +5584,7 @@
UhxauVjrTxwvaQBEen563fVJsuA6Op4Aiixigt3rpnQAAAAASUVORK5CYII= UhxauVjrTxwvaQBEen563fVJsuA6Op4Aiixigt3rpnQAAAAASUVORK5CYII=
</value> </value>
</data> </data>
<data name="btnAutoCalibration.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="BtnStartTest.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AADT00lEQVR4Xuz9V7Al1b3ve66H+9JxOuK8 JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AADT00lEQVR4Xuz9V7Al1b3ve66H+9JxOuK8
...@@ -6494,7 +6494,7 @@ ...@@ -6494,7 +6494,7 @@
UhxauVjrTxwvaQBEen563fVJsuA6Op4Aiixigt3rpnQAAAAASUVORK5CYII= UhxauVjrTxwvaQBEen563fVJsuA6Op4Aiixigt3rpnQAAAAASUVORK5CYII=
</value> </value>
</data> </data>
<data name="BtnReConnect.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="btnFinishCalibration.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AADT00lEQVR4Xuz9V7Al1b3ve66H+9JxOuK8 JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AADT00lEQVR4Xuz9V7Al1b3ve66H+9JxOuK8
...@@ -12,8 +12,6 @@ namespace App ...@@ -12,8 +12,6 @@ namespace App
{ {
public partial class FrmSplash : FrmBase public partial class FrmSplash : FrmBase
{ {
public FrmSplash() public FrmSplash()
{ {
InitializeComponent(); InitializeComponent();
...@@ -28,12 +26,28 @@ namespace App ...@@ -28,12 +26,28 @@ namespace App
label1.Text = getMsg("msg-" + value.ToString()); label1.Text = getMsg("msg-" + value.ToString());
} }
} }
public string ShowText
{
set
{
label1.Text = value.ToString();
}
}
public int CountDown public int CountDown
{ {
set set
{ {
label2.Text = value.ToString()+"s"; if (value > 0)
label2.Text = value.ToString() + "s";
else
label2.Text = "";
}
}
public bool CanCancel
{
set
{
btn_cancel.Visible = true;
} }
} }
...@@ -41,6 +55,10 @@ namespace App ...@@ -41,6 +55,10 @@ namespace App
{ {
this.ControlBox = false; this.ControlBox = false;
} }
private void btn_cancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -34,14 +34,15 @@ ...@@ -34,14 +34,15 @@
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.userControl11 = new loadingControl.UserControl1(); this.userControl11 = new loadingControl.UserControl1();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.btn_cancel = new System.Windows.Forms.Button();
this.SuspendLayout(); this.SuspendLayout();
// //
// label1 // label1
// //
this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.Location = new System.Drawing.Point(10, 173); this.label1.Location = new System.Drawing.Point(10, 176);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(233, 50); this.label1.Size = new System.Drawing.Size(233, 21);
this.label1.TabIndex = 0; this.label1.TabIndex = 0;
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
// //
...@@ -67,11 +68,25 @@ ...@@ -67,11 +68,25 @@
this.label2.TabIndex = 2; this.label2.TabIndex = 2;
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
// //
// btn_cancel
//
this.btn_cancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_cancel.Location = new System.Drawing.Point(85, 200);
this.btn_cancel.Name = "btn_cancel";
this.btn_cancel.Size = new System.Drawing.Size(82, 26);
this.btn_cancel.TabIndex = 3;
this.btn_cancel.Text = "取消";
this.btn_cancel.UseVisualStyleBackColor = true;
this.btn_cancel.Visible = false;
this.btn_cancel.Click += new System.EventHandler(this.btn_cancel_Click);
//
// FrmSplash // FrmSplash
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(250, 231); this.ClientSize = new System.Drawing.Size(250, 231);
this.ControlBox = true;
this.Controls.Add(this.btn_cancel);
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
this.Controls.Add(this.userControl11); this.Controls.Add(this.userControl11);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
...@@ -79,7 +94,9 @@ ...@@ -79,7 +94,9 @@
this.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); this.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.Name = "FrmSplash"; this.Name = "FrmSplash";
this.Padding = new System.Windows.Forms.Padding(27, 120, 27, 40); this.Padding = new System.Windows.Forms.Padding(27, 120, 27, 40);
this.ShowInTaskbar = false;
this.Text = ""; this.Text = "";
this.TopMost = true;
this.Load += new System.EventHandler(this.FrmSplash_Load); this.Load += new System.EventHandler(this.FrmSplash_Load);
this.ResumeLayout(false); this.ResumeLayout(false);
...@@ -91,5 +108,6 @@ ...@@ -91,5 +108,6 @@
private System.Windows.Forms.PictureBox pictureBox; private System.Windows.Forms.PictureBox pictureBox;
private loadingControl.UserControl1 userControl11; private loadingControl.UserControl1 userControl11;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btn_cancel;
} }
} }
\ No newline at end of file \ No newline at end of file
此文件类型无法预览
此文件类型无法预览
...@@ -12,10 +12,11 @@ using Dal; ...@@ -12,10 +12,11 @@ using Dal;
namespace App namespace App
{ {
using FrmTestManageSwitch = FrmTestManage2;
public partial class MetroDynamicTesting : FrmBase public partial class MetroDynamicTesting : FrmBase
{ {
private bool isTest = true;//判断上一个状态是否为暂停测试 private bool isTest = true;//判断上一个状态是否为暂停测试
FrmTestManage newForm; FrmTestManageSwitch newForm;
private LoginManager _loginManager; private LoginManager _loginManager;
public MetroDynamicTesting(LoginManager loginManager) public MetroDynamicTesting(LoginManager loginManager)
...@@ -49,7 +50,7 @@ namespace App ...@@ -49,7 +50,7 @@ namespace App
this.lbl_time.Text = getMsg("FrmMDIRightNavigateBarlbl_Date")+":"; this.lbl_time.Text = getMsg("FrmMDIRightNavigateBarlbl_Date")+":";
} }
// //
public void AddToDynamicPanel(FrmTestManage form) public void AddToDynamicPanel(FrmTestManageSwitch form)
{ {
try try
{ {
...@@ -131,9 +132,9 @@ namespace App ...@@ -131,9 +132,9 @@ namespace App
private void CutOffTest() private void CutOffTest()
{ {
if (newForm is FrmTestManage) if (newForm is FrmTestManageSwitch)
{ {
((FrmTestManage)newForm).CutOffTest(); ((FrmTestManageSwitch)newForm).CutOffTest();
return; return;
} }
} }
......
...@@ -14,8 +14,10 @@ using Dal; ...@@ -14,8 +14,10 @@ using Dal;
namespace App namespace App
{ {
using FrmAdjustQuotietyA = FrmAdjustQuotiety2;
public partial class MetroMDI : FrmBase public partial class MetroMDI : FrmBase
{ {
private readonly TheMachine theMachine; private readonly TheMachine theMachine;
private LoginManager _loginManager; private LoginManager _loginManager;
private float minWidth; private float minWidth;
...@@ -130,9 +132,8 @@ namespace App ...@@ -130,9 +132,8 @@ namespace App
private void Setting_Click(object sender, EventArgs e) private void Setting_Click(object sender, EventArgs e)
{ {
this._loginManager.IsExit = false; this._loginManager.IsExit = false;
FrmAdjustQuotiety.returnValue = -100;
//打开校准参数 //打开校准参数
FrmAdjustQuotiety frm = new FrmAdjustQuotiety("",_loginManager); FrmAdjustQuotietyA frm = new FrmAdjustQuotietyA("",_loginManager);
//frm.Owner = this; //frm.Owner = this;
this.ShowInTaskbar = false; this.ShowInTaskbar = false;
frm.ShowInTaskbar = true; frm.ShowInTaskbar = true;
...@@ -319,9 +320,8 @@ namespace App ...@@ -319,9 +320,8 @@ namespace App
private void label5_Click(object sender, EventArgs e) private void label5_Click(object sender, EventArgs e)
{ {
this._loginManager.IsExit = false; this._loginManager.IsExit = false;
FrmAdjustQuotiety.returnValue = -100;
//打开校准参数 //打开校准参数
FrmAdjustQuotiety frm = new FrmAdjustQuotiety("", _loginManager); FrmAdjustQuotietyA frm = new FrmAdjustQuotietyA("", _loginManager);
//frm.Owner = this; //frm.Owner = this;
this.ShowInTaskbar = false; this.ShowInTaskbar = false;
frm.ShowInTaskbar = true; frm.ShowInTaskbar = true;
......
...@@ -14,9 +14,11 @@ using Microsoft.VisualBasic; ...@@ -14,9 +14,11 @@ using Microsoft.VisualBasic;
using MachineDll; using MachineDll;
using Common.Logging; using Common.Logging;
using System.Reflection; using System.Reflection;
using System.Threading;
namespace App namespace App
{ {
using FrmTestManageSwitch = FrmTestManage2;
public partial class MetroProduct : FrmBase public partial class MetroProduct : FrmBase
{ {
int pb_OldHeight; int pb_OldHeight;
...@@ -61,132 +63,35 @@ namespace App ...@@ -61,132 +63,35 @@ namespace App
Init(); Init();
} }
private class MachineCheckReceiveData : IReceiveData
{
private Byte[] _ReceiveValue;
public void NewReceiveData(int receivedCount, Byte[] receiveValue)
{
fuction.CreateParaConfig("", "currency", Const.PARA_READDATATYPE, "PLC");
_ReceiveValue = receiveValue;
string temp = "";
int index = 6;
for (int i = 1; i < _ReceiveValue.Length; i++)//0~5
{
if (Convert.ToChar(_ReceiveValue[i]).ToString() == "+")
{
index = i;
break;
}
temp = temp + Convert.ToChar(_ReceiveValue[i]);
}
double.TryParse(temp, out returnValue);
}
public void NewReceiveIOData(double receiveValue)
{
fuction.CreateParaConfig("", "currency", Const.PARA_READDATATYPE, "IO");
returnValue = receiveValue;
}
}
private System.Timers.Timer checkReturnValueTimer;
private TheMachine theMachine; private TheMachine theMachine;
private MachineCheckReceiveData mcrd;
private string readDataType; private string readDataType;
public void checkMachineState() public void checkMachineState()
{ {
try if (Program.IsDebug)
{
theMachine = GetMachineFromMe.GetMachine;
string portName = fuction.GetParameterByParaName(Const.PARA_PORT, "currency");//读保存的COM口
readDataType = fuction.GetParameterByParaName(Const.PARA_READDATATYPE, "currency");//读取数据方式
//LOGGER.Debug("save port is " + portName);
//LOGGER.Debug("test word ");
if (theMachine._ItsSerialPort != null)
{
//LOGGER.Debug("theMachine._ItsSerialPort != null");
theMachine._ItsSerialPort = null;
SerialPortSetting.PortName = portName;
theMachine.StartConnection();//串口通信
if (theMachine.GetControllor != null)
{
if (("PLC").Equals(readDataType))
{ {
theMachine.GetControllor.CloseY0(); passCheck();
System.Threading.Thread.Sleep(1500); return;
theMachine.GetControllor.CloseY1();
System.Threading.Thread.Sleep(1500);
theMachine.GetControllor.CloseY2();
}
else if (("IO").Equals(readDataType))
{
theMachine.GetControllor.CloseAll();
LOGGER.Info("IO CloseAll");
} }
} try
theMachine.StopReading();
closeTheMachine();
}
//LOGGER.Debug("after check _itserialport");
if (theMachine == null)
{ {
//LOGGER.Debug("theMachine == null");
theMachine = GetMachineFromMe.GetMachine; theMachine = GetMachineFromMe.GetMachine;
} string portName = fuction.GetParameterByParaName(Const.PARA_PORT, "currency");//读保存的COM口
//LOGGER.Debug("after check _thMachine is null "); readDataType = fuction.GetParameterByParaName(Const.PARA_READDATATYPE, "currency");//读取数据方式
SerialPortSetting.PortName = theMachine.TestConnection();//读连接的COM theMachine = GetMachineFromMe.NewMachine(portName,readDataType);
//LOGGER.Debug("after set portName");
if (SerialPortSetting.PortName == "")//端口未连接(USB口)
{
//LOGGER.Debug("no port connect ");
unPassCheck(1);
//MessageBox.Show(getMsg("CheckUSB"), getMsg("msg-Information"), MessageBoxButtons.OK);//请确认USB口与计算机是否连接!
return;
}
//LOGGER.Debug("after check port is connect ");
if (!(SerialPortSetting.PortName.Trim().Contains(portName)))
{
//LOGGER.Debug("port isnot contains portname");
unPassCheck(2);//端口设置有问题
//MessageBox.Show(getMsg("CheckSettingPort"), getMsg("msg-Information"), MessageBoxButtons.OK);//请确认端口设置是否正确!
return;
}
else
{
//LOGGER.Debug("port contains portName");
SerialPortSetting.PortName = portName;
}
//LOGGER.Debug("after check port is contains portName");
theMachine._ItsSerialPort = null;
//LOGGER.Debug("after set _itsSerialPort is null");
if (theMachine.StartConnection())//判断串口是否连接 if (theMachine.StartConnection())//判断串口是否连接
{ {
Thread.Sleep(1000);
Checking(); Checking();
mcrd = new MachineCheckReceiveData(); if (theMachine.GetData() > 0)
theMachine.AddClients(mcrd);
if (("PLC").Equals(readDataType))
{
theMachine.StartReading();
}
else if (("IO").Equals(readDataType))
{ {
theMachine.StartReadingIO(); passCheck();
}
else if (("0").Equals(readDataType) || ("").Equals(readDataType) || readDataType == null)//尚未记录何种类型数据读取方式
{
theMachine.StartReadingIO();
} }
if (checkReturnValueTimer == null) else {
{ unPassCheck(3);
checkReturnValueTimer = new System.Timers.Timer();
checkReturnValueTimer.Elapsed += new System.Timers.ElapsedEventHandler(checkData);//两秒后检测是否有数据读入
checkReturnValueTimer.Interval = 5000;
} }
checkReturnValueTimer.Start();
} }
} }
catch (Exception ex) catch (Exception ex)
...@@ -195,29 +100,6 @@ namespace App ...@@ -195,29 +100,6 @@ namespace App
} }
} }
public void checkData(object source, System.Timers.ElapsedEventArgs e)
{
checkReturnValueTimer.Stop();
theMachine.StopReading();
theMachine.RemoveClients(mcrd);
if (returnValue != -100)//读到数据,串口连接着
{
passCheck();
//returnValue = -100;
}
else//未讲到数据,串口未连接
{
if (("0").Equals(readDataType) || ("").Equals(readDataType) || readDataType == null)//尚未记录何种类型数据读取方式
{
fuction.CreateParaConfig("", "currency", Const.PARA_READDATATYPE, "NotCheckedOut");//未查检出读取数据类型,所以此刻串口与设备未连接或者设备未上电
theMachine.StartReading();
checkReturnValueTimer.Start();
return;
}
//MessageBox.Show(getMsg("CheckSerialPort"), getMsg("msg-Information"), MessageBoxButtons.OK);//请确认串口与机器是否连接!
unPassCheck(3);
}
}
private void passCheck()//检查通过 private void passCheck()//检查通过
{ {
this.lblShowState.Visible = false; this.lblShowState.Visible = false;
...@@ -300,8 +182,9 @@ namespace App ...@@ -300,8 +182,9 @@ namespace App
} }
private void closeTheMachine()//关闭机器 private void closeTheMachine()//关闭机器
{ {
if (theMachine == null)
return;
theMachine.CloseConnection(); theMachine.CloseConnection();
theMachine._ItsSerialPort = null;
} }
public void Init() public void Init()
{ {
...@@ -1188,7 +1071,7 @@ Const.MESSAGEBOX_TITLE_NOTE, "", Const.ERROR_NUM_OVER0); ...@@ -1188,7 +1071,7 @@ Const.MESSAGEBOX_TITLE_NOTE, "", Const.ERROR_NUM_OVER0);
break; break;
} }
} }
FrmTestManage frmTestManage = new FrmTestManage("", Const.ISHEAT_NOTHEAT, cmb_TestSolvent.Text, testingKind, _loginManager); FrmTestManageSwitch frmTestManage = new FrmTestManageSwitch("", Const.ISHEAT_NOTHEAT, cmb_TestSolvent.Text, testingKind, _loginManager);
//FrmTestFunction frmTestFunction = new FrmTestFunction(cmb_TestSolvent.Text, testingKind, _loginManager); //FrmTestFunction frmTestFunction = new FrmTestFunction(cmb_TestSolvent.Text, testingKind, _loginManager);
if (this.ParentForm is MetroDynamicTesting) if (this.ParentForm is MetroDynamicTesting)
{ {
......
...@@ -13,11 +13,12 @@ using Dal; ...@@ -13,11 +13,12 @@ using Dal;
namespace App namespace App
{ {
using FrmTestManageSwitch = FrmTestManage2;
public partial class MetroStaticTesting : FrmBase public partial class MetroStaticTesting : FrmBase
{ {
private bool isTest = true;//上一个状态是否在测试测试,默认为是 private bool isTest = true;//上一个状态是否在测试测试,默认为是
private LoginManager _loginManager; private LoginManager _loginManager;
FrmTestManage newForm; FrmTestManageSwitch newForm;
public MetroStaticTesting(LoginManager loginManager) public MetroStaticTesting(LoginManager loginManager)
{ {
//Control.CheckForIllegalCrossThreadCalls = false; //Control.CheckForIllegalCrossThreadCalls = false;
...@@ -53,7 +54,7 @@ namespace App ...@@ -53,7 +54,7 @@ namespace App
this.lbl_time.Text = getMsg("FrmMDIRightNavigateBarlbl_Date") + ":"; this.lbl_time.Text = getMsg("FrmMDIRightNavigateBarlbl_Date") + ":";
} }
public void AddToStaticPanel(FrmTestManage form) public void AddToStaticPanel(FrmTestManageSwitch form)
{ {
this.staticTestingShow.Location = new Point(12, -50); this.staticTestingShow.Location = new Point(12, -50);
this.staticTestingShow.Size = new System.Drawing.Size(this.mdiPanel.Width - 24, this.mdiPanel.Height-20); this.staticTestingShow.Size = new System.Drawing.Size(this.mdiPanel.Width - 24, this.mdiPanel.Height-20);
...@@ -120,9 +121,9 @@ namespace App ...@@ -120,9 +121,9 @@ namespace App
} }
private void CutOffTest() private void CutOffTest()
{ {
if (newForm is FrmTestManage) if (newForm is FrmTestManageSwitch)
{ {
((FrmTestManage)newForm).CutOffTest(); ((FrmTestManageSwitch)newForm).CutOffTest();
return; return;
} }
} }
...@@ -138,7 +139,7 @@ namespace App ...@@ -138,7 +139,7 @@ namespace App
} }
private void PauseTest() private void PauseTest()
{ {
if (newForm is FrmTestManage) if (newForm is FrmTestManageSwitch)
{ {
//if (((FrmTestManage)newForm).IsRealStart) //if (((FrmTestManage)newForm).IsRealStart)
//{ //{
......

namespace App
{
partial class CaliDialog
{
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CaliDialog));
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label_d = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// btnOK
//
this.btnOK.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnOK.BackgroundImage")));
this.btnOK.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.btnOK.FlatAppearance.BorderSize = 0;
this.btnOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnOK.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOK.Location = new System.Drawing.Point(256, 276);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(127, 40);
this.btnOK.TabIndex = 163;
this.btnOK.Text = "确认";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnCancel
//
this.btnCancel.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnCancel.BackgroundImage")));
this.btnCancel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.btnCancel.FlatAppearance.BorderSize = 0;
this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCancel.Location = new System.Drawing.Point(494, 276);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(127, 40);
this.btnCancel.TabIndex = 163;
this.btnCancel.Text = "跳过";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(81, 97);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(487, 21);
this.label1.TabIndex = 164;
this.label1.Text = "请加以下下浓度试剂后点击确认, 如不打算校准本浓度可以选择跳过.";
//
// label_d
//
this.label_d.AutoSize = true;
this.label_d.Font = new System.Drawing.Font("微软雅黑", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label_d.ForeColor = System.Drawing.Color.Red;
this.label_d.Location = new System.Drawing.Point(266, 132);
this.label_d.Name = "label_d";
this.label_d.Size = new System.Drawing.Size(117, 42);
this.label_d.TabIndex = 165;
this.label_d.Text = "0.2 ml";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(237, 204);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(156, 21);
this.label2.TabIndex = 164;
this.label2.Text = "当前累计浓度:0.0 ml";
//
// CaliDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(660, 347);
this.Controls.Add(this.label_d);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Location = new System.Drawing.Point(0, 0);
this.Name = "CaliDialog";
this.Text = "请按要求操作";
this.TopMost = true;
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label_d;
private System.Windows.Forms.Label label2;
}
}
\ No newline at end of file \ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace App
{
public partial class CaliDialog : FrmBase
{
public CaliDialog()
{
InitializeComponent();
}
public void setTxt(double qq,double Current_concentration, bool canIgnore) {
label_d.Text = qq.ToString("0.0 ml");
label2.Text = $"当前累计浓度:{Current_concentration:0.00} ml";
if (!canIgnore)
btnCancel.Visible = false;
}
public static DialogResult Show(double qq,double Current_concentration, bool canIgnore) {
var dailog = new CaliDialog();
dailog.setTxt(qq, Current_concentration, canIgnore);
dailog.TopMost = true;
return dailog.ShowDialog();
}
private void btnOK_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
}
private void btnCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
}
}
此文件的差异太大,无法显示。
此文件的差异太大,无法显示。
此文件类型无法预览
<?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>
<metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>116, 19</value>
</metadata>
<metadata name="tabStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>65</value>
</metadata>
</root>
\ No newline at end of file \ No newline at end of file
此文件的差异太大,无法显示。
...@@ -11,7 +11,7 @@ using System.Reflection; ...@@ -11,7 +11,7 @@ using System.Reflection;
namespace App namespace App
{ {
static class Program public static class Program
{ {
#region #region
///// <summary> ///// <summary>
...@@ -39,6 +39,7 @@ namespace App ...@@ -39,6 +39,7 @@ namespace App
static LoginManager _loginManager; static LoginManager _loginManager;
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static bool IsDebug=false;
/// <summary> /// <summary>
/// 应用程序的主入口点。 /// 应用程序的主入口点。
/// </summary> /// </summary>
...@@ -47,6 +48,12 @@ namespace App ...@@ -47,6 +48,12 @@ namespace App
{ {
//Application.EnableVisualStyles(); //Application.EnableVisualStyles();
//Application.SetCompatibleTextRenderingDefault(false); //Application.SetCompatibleTextRenderingDefault(false);
var largs = new List<string>(Args);
if (largs.Contains("debug"))
IsDebug = true;
System.Environment.CurrentDirectory = Application.StartupPath;
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadExcetption); Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadExcetption);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrencyDomain_UnhandledException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrencyDomain_UnhandledException);
......
...@@ -30,6 +30,6 @@ using log4net.Config; ...@@ -30,6 +30,6 @@ using log4net.Config;
// 内部版本号 // 内部版本号
// 修订号 // 修订号
// //
[assembly: AssemblyVersion("3.3.3.5")] [assembly: AssemblyVersion("3.3.4.0")]
[assembly: AssemblyFileVersion("3.3.3.5")] [assembly: AssemblyFileVersion("3.3.4.0")]
[assembly: log4net.Config.DOMConfigurator(ConfigFileExtension = "config", Watch = true)] [assembly: log4net.Config.DOMConfigurator(ConfigFileExtension = "config", Watch = true)]
...@@ -717,16 +717,16 @@ ...@@ -717,16 +717,16 @@
<data name="FrmMDIrb_TestPort" xml:space="preserve"> <data name="FrmMDIrb_TestPort" xml:space="preserve">
<value>测试端口</value> <value>测试端口</value>
</data> </data>
<data name="FrmAdjustQuotietybtn_Export" xml:space="preserve"> <data name="FrmAdjustQuotiety2btn_Export" xml:space="preserve">
<value>导出</value> <value>导出</value>
</data> </data>
<data name="FrmAdjustQuotietybtn_Input" xml:space="preserve"> <data name="FrmAdjustQuotiety2btn_Input" xml:space="preserve">
<value>导入</value> <value>导入</value>
</data> </data>
<data name="FrmAdjustQuotietybtn_OK" xml:space="preserve"> <data name="FrmAdjustQuotiety2btn_OK" xml:space="preserve">
<value>确定</value> <value>确定</value>
</data> </data>
<data name="FrmAdjustQuotietybtn_Cancel" xml:space="preserve"> <data name="FrmAdjustQuotiety2btn_Cancel" xml:space="preserve">
<value>取消</value> <value>取消</value>
</data> </data>
<data name="FrmAdjust" xml:space="preserve"> <data name="FrmAdjust" xml:space="preserve">
......
...@@ -19,7 +19,7 @@ namespace App.Properties { ...@@ -19,7 +19,7 @@ namespace App.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。 // (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources { internal class Resources {
...@@ -47,8 +47,8 @@ namespace App.Properties { ...@@ -47,8 +47,8 @@ namespace App.Properties {
} }
/// <summary> /// <summary>
/// 使用此强类型资源类,为所有资源查找 /// 重写当前线程的 CurrentUICulture 属性,对
/// 重写当前线程的 CurrentUICulture 属性 /// 使用此强类型资源类的所有资源查找执行重写
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture { internal static global::System.Globalization.CultureInfo Culture {
...@@ -641,7 +641,7 @@ namespace App.Properties { ...@@ -641,7 +641,7 @@ namespace App.Properties {
} }
/// <summary> /// <summary>
/// 查找类似于 (Icon) 的 System.Drawing.Icon 类型的本地化资源。 /// 查找类似于 (图标) 的 System.Drawing.Icon 类型的本地化资源。
/// </summary> /// </summary>
internal static System.Drawing.Icon logo { internal static System.Drawing.Icon logo {
get { get {
...@@ -677,7 +677,7 @@ namespace App.Properties { ...@@ -677,7 +677,7 @@ namespace App.Properties {
/// ///
/// ... ado.net/XML headers &amp; schema ... /// ... ado.net/XML headers &amp; schema ...
/// &lt;resheader name=&quot;resmimetype&quot;&gt;text/microsoft-resx&lt;/resheader&gt; /// &lt;resheader name=&quot;resmimetype&quot;&gt;text/microsoft-resx&lt;/resheader&gt;
/// &lt;resheader n [字符串的其余部分被截断]&quot;; 的本地化字符串。 /// &lt;resheader name=&quot;version&quot;&gt;2. [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary> /// </summary>
internal static string LResource_en_US { internal static string LResource_en_US {
get { get {
...@@ -702,7 +702,7 @@ namespace App.Properties { ...@@ -702,7 +702,7 @@ namespace App.Properties {
/// ///
/// ... ado.net/XML headers &amp; schema ... /// ... ado.net/XML headers &amp; schema ...
/// &lt;resheader name=&quot;resmimetype&quot;&gt;text/microsoft-resx&lt;/resheader&gt; /// &lt;resheader name=&quot;resmimetype&quot;&gt;text/microsoft-resx&lt;/resheader&gt;
/// &lt;resheader n [字符串的其余部分被截断]&quot;; 的本地化字符串。 /// &lt;resheader name=&quot;version&quot;&gt;2. [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary> /// </summary>
internal static string LResource_ja_JP { internal static string LResource_ja_JP {
get { get {
...@@ -727,7 +727,7 @@ namespace App.Properties { ...@@ -727,7 +727,7 @@ namespace App.Properties {
/// ///
/// ... ado.net/XML headers &amp; schema ... /// ... ado.net/XML headers &amp; schema ...
/// &lt;resheader name=&quot;resmimetype&quot;&gt;text/microsoft-resx&lt;/resheader&gt; /// &lt;resheader name=&quot;resmimetype&quot;&gt;text/microsoft-resx&lt;/resheader&gt;
/// &lt;resheader n [字符串的其余部分被截断]&quot;; 的本地化字符串。 /// &lt;resheader name=&quot;version&quot;&gt;2. [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary> /// </summary>
internal static string LResource_zh_CN { internal static string LResource_zh_CN {
get { get {
......
...@@ -12,7 +12,7 @@ namespace App.Properties { ...@@ -12,7 +12,7 @@ namespace App.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
......
...@@ -44,6 +44,13 @@ namespace App ...@@ -44,6 +44,13 @@ namespace App
MessageBox.Show(text, caption, MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(text, caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
public static void ShowInfo(IWin32Window win32Window, string captionStr, int textId)
{
string caption = GetMsgText(captionStr);
string text = GetMsgText(textId.ToString());
MessageBox.Show(win32Window,text, caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
/// <summary> /// <summary>
/// 询问消息框 /// 询问消息框
...@@ -55,7 +62,13 @@ namespace App ...@@ -55,7 +62,13 @@ namespace App
return MessageBox.Show(text, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes; return MessageBox.Show(text, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes;
} }
public static bool ShowQuestion(IWin32Window win32Window, string captionStr, int textId)
{
string caption = GetMsgText(captionStr);
string text = GetMsgText(textId.ToString());
return MessageBox.Show(win32Window, text, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes;
}
public static bool ShowQuestionForDeleteProduce(string captionStr, string info) public static bool ShowQuestionForDeleteProduce(string captionStr, string info)
{ {
string caption = GetMsgText(captionStr); string caption = GetMsgText(captionStr);
...@@ -68,14 +81,31 @@ namespace App ...@@ -68,14 +81,31 @@ namespace App
/// <summary> /// <summary>
/// 警告消息框 /// 警告消息框
/// </summary> /// </summary>
public static bool ShowWarning(string captionStr, int textId) public static bool ShowWarning(IWin32Window win32Window, string captionStr, int textId)
{ {
string caption = GetMsgText(captionStr); string caption = GetMsgText(captionStr);
string text = GetMsgText(textId.ToString()); string text = GetMsgText(textId.ToString());
return MessageBox.Show(text, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) == DialogResult.Yes; return MessageBox.Show(win32Window,text, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) == DialogResult.Yes;
} }
public static bool ShowWarning(string captionStr, int textId)
{
return ShowWarning(null,captionStr, textId);
}
public static void ShowError(Form win32Window ,string captionStr, string name, int textId) {
if (win32Window.InvokeRequired)
{
win32Window.Invoke(new Action(() =>
{
ShowError(captionStr, name, textId);
}));
}
else {
ShowError(captionStr, name, textId);
}
}
/// <summary> /// <summary>
/// 错误消息框 /// 错误消息框
/// </summary> /// </summary>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="MetroFramework-1.3.0.0" version="1.3.0.0" targetFramework="net40" /> <package id="MetroFramework-1.3.0.0" version="1.3.0.0" targetFramework="net40" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net40" />
</packages> </packages>
\ No newline at end of file \ No newline at end of file
...@@ -5,6 +5,7 @@ namespace MachineDll ...@@ -5,6 +5,7 @@ namespace MachineDll
public static class GetMachineFromMe public static class GetMachineFromMe
{ {
private static TheMachine _TheMachine; private static TheMachine _TheMachine;
private static TheMachine _TheMachine2;
public static TheMachine GetMachine public static TheMachine GetMachine
{ {
...@@ -21,5 +22,18 @@ namespace MachineDll ...@@ -21,5 +22,18 @@ namespace MachineDll
} }
} }
} }
public static TheMachine NewMachine(string port,string readdatatype)
{
if (_TheMachine2 == null)
{
_TheMachine2 = new TheMachine(port, readdatatype);
return _TheMachine2;
}
else
{
return _TheMachine2;
}
}
} }
} }
//所有控制机器发送指令的类 //所有控制机器发送指令的类
using System.Threading; using System.Threading;
using System; using System;
using System.Collections.Generic;
using System.IO;
namespace MachineDll namespace MachineDll
{ {
public class MachineControllor public class MachineControllor
{ {
private readonly SerialPortSetting _ItsSerialPort; private readonly SerialPortSetting _ItsSerialPort;
bool IsDebug = false;
public MachineControllor(SerialPortSetting itsSerialPort) List<double> simulate_data;
List<double>.Enumerator simulate_data_Enumerator;
public MachineControllor(SerialPortSetting itsSerialPort, bool isdebug = false)
{ {
IsDebug = isdebug;
_ItsSerialPort = itsSerialPort; _ItsSerialPort = itsSerialPort;
if (File.Exists("simulate_data.txt"))
{
try
{
var s = File.ReadAllLines("simulate_data.txt");
simulate_data = new List<double>();
foreach (var ss in s)
{
if (double.TryParse(ss, out double ts))
simulate_data.Add(ts);
}
}
catch { }
}
else {
simulate_data = new List<double>() {1,2,3,4,5,6,7,8 };
}
simulate_data_Enumerator = simulate_data.GetEnumerator();
} }
#region NewControlPorts #region NewControlPorts
public void OpenY0() public void OpenY0()
{ {
if (IsDebug)
return;
_ItsSerialPort.SendString("%01#WCSY00001**"); _ItsSerialPort.SendString("%01#WCSY00001**");
} }
public void CloseY0() public void CloseY0()
{ {
if (IsDebug)
return;
_ItsSerialPort.SendString("%01#WCSY00000**"); _ItsSerialPort.SendString("%01#WCSY00000**");
} }
public void OpenY1() public void OpenY1()
{ {
if (IsDebug)
return;
_ItsSerialPort.SendString("%01#WCSY00011**"); _ItsSerialPort.SendString("%01#WCSY00011**");
} }
public void CloseY1() public void CloseY1()
{ {
if (IsDebug)
return;
_ItsSerialPort.SendString("%01#WCSY00010**"); _ItsSerialPort.SendString("%01#WCSY00010**");
} }
public void OpenY2() public void OpenY2()
{ {
if (IsDebug)
return;
_ItsSerialPort.SendString("%01#WCSY00021**"); _ItsSerialPort.SendString("%01#WCSY00021**");
} }
public void CloseY2() public void CloseY2()
{ {
if (IsDebug)
return;
_ItsSerialPort.SendString("%01#WCSY00020**"); _ItsSerialPort.SendString("%01#WCSY00020**");
} }
public void OpenY1Y2() public void OpenY1Y2()
{//过滤 {//过滤
if (IsDebug)
return;
_ItsSerialPort.SendIOString("01 0F 00 64 00 04 01 06 CF 5C"); _ItsSerialPort.SendIOString("01 0F 00 64 00 04 01 06 CF 5C");
} }
public void OpenY0Y2() public void OpenY0Y2()
{//清洗 {//清洗
if (IsDebug)
return;
_ItsSerialPort.SendIOString("01 0F 00 64 00 04 01 05 8F 5D"); _ItsSerialPort.SendIOString("01 0F 00 64 00 04 01 05 8F 5D");
} }
public void CloseAll() public void CloseAll()
{//关闭 {//关闭
if (IsDebug)
return;
_ItsSerialPort.SendIOString("01 0F 00 64 00 04 01 00 4F 5E"); _ItsSerialPort.SendIOString("01 0F 00 64 00 04 01 00 4F 5E");
} }
public double SendAIString() public double SendAIString()
{//读AI数据 {//读AI数据
if (IsDebug) {
simulate_data_Enumerator.MoveNext();
return simulate_data_Enumerator.Current;
}
double data = _ItsSerialPort.ReadAIString("01 03 02 58 00 08 C4 67"); double data = _ItsSerialPort.ReadAIString("01 03 02 58 00 08 C4 67");
return data; return data;
} }
......
此文件类型无法预览
...@@ -240,7 +240,7 @@ namespace MachineDll ...@@ -240,7 +240,7 @@ namespace MachineDll
//#endregion //#endregion
#region Function - Read Registers #region Function - Read Registers
public bool SendFuction(byte address, byte funType ,ushort start, ushort registers, ref short[] values) public bool SendFuction(byte address, byte funType ,ushort start, ushort registers, ref byte[] values)
{ {
//LOGGER.Debug("modbus into sendFuction "); //LOGGER.Debug("modbus into sendFuction ");
//Ensure port is open: //Ensure port is open:
...@@ -263,6 +263,8 @@ namespace MachineDll ...@@ -263,6 +263,8 @@ namespace MachineDll
//LOGGER.Debug("modbus,after write data and before get data"); //LOGGER.Debug("modbus,after write data and before get data");
Thread.Sleep(200); Thread.Sleep(200);
response = GetResponse(); response = GetResponse();
if (response == null)
return false;
} }
catch (Exception err) catch (Exception err)
{ {
...@@ -273,13 +275,15 @@ namespace MachineDll ...@@ -273,13 +275,15 @@ namespace MachineDll
//Evaluate message: //Evaluate message:
if ((response.Length == (5 + 2 * registers)) && CheckResponse(response)) if ((response.Length == (5 + 2 * registers)) && CheckResponse(response))
{ {
values = response;
//LOGGER.Info("response:"+ BitConverter.ToSingle(doubleBytes,0));
//Return requested register values:返回请求的寄存器 //Return requested register values:返回请求的寄存器
for (int i = 0; i < (response.Length - 5) / 2; i++) //for (int i = 0; i < (response.Length - 5) / 2; i++)
{ //{
values[i] = response[2 * i + 3]; // values[i] = response[2 * i + 3];
values[i] <<= 8; // values[i] <<= 8;
values[i] += response[2 * i + 4]; // values[i] += response[2 * i + 4];
} //}
//modbusStatus = "Read successful"; //modbusStatus = "Read successful";
return true; return true;
} }
...@@ -291,8 +295,9 @@ namespace MachineDll ...@@ -291,8 +295,9 @@ namespace MachineDll
} }
else else
{ {
LOGGER.Debug("modbus Serial port not open");
//modbusStatus = "Serial port not open"; //modbusStatus = "Serial port not open";
return false; return true;
} }
} }
......
...@@ -40,14 +40,6 @@ namespace MachineDll ...@@ -40,14 +40,6 @@ namespace MachineDll
} }
} }
return port; return port;
//if (port != "")
//{
// MessageBox.Show(port + "¶Ë¿ÚÊÇ¿ÉÓõÄ");
//}
//else
//{
// MessageBox.Show("ÇëÈ·È϶˿ÚÊÇ·ñÁ¬½Ó");
//}
} }
public bool StartConnection() public bool StartConnection()
...@@ -156,20 +148,29 @@ namespace MachineDll ...@@ -156,20 +148,29 @@ namespace MachineDll
byte fuctionType = byte.Parse(dataString[1], System.Globalization.NumberStyles.HexNumber);//功能码 byte fuctionType = byte.Parse(dataString[1], System.Globalization.NumberStyles.HexNumber);//功能码
ushort registerAdd = ushort.Parse(dataString[2] + dataString[3], System.Globalization.NumberStyles.HexNumber);//寄存器地址 ushort registerAdd = ushort.Parse(dataString[2] + dataString[3], System.Globalization.NumberStyles.HexNumber);//寄存器地址
ushort registerQty = ushort.Parse(dataString[4] + dataString[5], System.Globalization.NumberStyles.HexNumber);//寄存器个数 ushort registerQty = ushort.Parse(dataString[4] + dataString[5], System.Globalization.NumberStyles.HexNumber);//寄存器个数
short[] values = new short[registerQty]; byte[] values = new byte[registerQty];
Modbus mb = new Modbus(_ItsSerialPort); Modbus mb = new Modbus(_ItsSerialPort);
//LOGGER.Debug("serialPortSetting ,before into sendFuction"); //LOGGER.Debug("serialPortSetting ,before into sendFuction");
while (!mb.SendFuction(slaveID, fuctionType, registerAdd, registerQty, ref values)) ; //while (!mb.SendFuction(slaveID, fuctionType, registerAdd, registerQty, ref values)) ;
var re = mb.SendFuction(slaveID, fuctionType, registerAdd, registerQty, ref values);
byte[] doubleBytes =
{
values[4], values[3],values[6],values[5]
};
float dataToFloat = BitConverter.ToSingle(doubleBytes, 0);
var dataConvert = CurrentConversion(dataToFloat);
LOGGER.Debug("IO Return: " + string.Join(",", values)); LOGGER.Debug($"IO Return: {re}, org:{dataToFloat},cov:{dataConvert},");
//AI1通道 ////AI1通道
string data = values[1].ToString("X").PadLeft(4,'0') + "" + values[0].ToString("X").PadLeft(4,'0'); //string data = values[1].ToString("X").PadLeft(4,'0') + "" + values[0].ToString("X").PadLeft(4,'0');
//AI2通道 ////AI2通道
//string data = values[3].ToString("X").PadLeft(4, '0') + "" + values[2].ToString("X").PadLeft(4, '0'); ////string data = values[3].ToString("X").PadLeft(4, '0') + "" + values[2].ToString("X").PadLeft(4, '0');
float dataToFloat = StringToFloat(data); //float dataToFloat = StringToFloat(data);
return CurrentConversion(dataToFloat); return dataConvert;
//return dataToFloat; //return dataToFloat;
} }
...@@ -182,7 +183,7 @@ namespace MachineDll ...@@ -182,7 +183,7 @@ namespace MachineDll
* (IO返回数据-IO起始数据)/(量程一共分为多少格)*跳线设置量程 * (IO返回数据-IO起始数据)/(量程一共分为多少格)*跳线设置量程
*/ */
LOGGER.Debug("IO Value: " + dataToFloat); //LOGGER.Debug("IO Value: " + dataToFloat);
if (dataToFloat < 4000) if (dataToFloat < 4000)
dataToFloat = 4000; dataToFloat = 4000;
Fuction fuction = new Fuction(); Fuction fuction = new Fuction();
......
...@@ -8,6 +8,9 @@ namespace MachineDll ...@@ -8,6 +8,9 @@ namespace MachineDll
{ {
public class TheMachine public class TheMachine
{ {
enum MachineType {
IO,PLC
}
//接受到的数据 //接受到的数据
private int _ReadCount; private int _ReadCount;
...@@ -16,10 +19,20 @@ namespace MachineDll ...@@ -16,10 +19,20 @@ namespace MachineDll
public SerialPortSetting _ItsSerialPort; public SerialPortSetting _ItsSerialPort;
private readonly List<IReceiveData> itsClietns = new List<IReceiveData>(); private readonly List<IReceiveData> itsClietns = new List<IReceiveData>();
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
MachineType machineType= MachineType.IO;
public bool IsDebug = false;
//防止该类被外部引用实例化 //防止该类被外部引用实例化
//唯一访问的入口点是单一实例,以防不测 //唯一访问的入口点是单一实例,以防不测
internal TheMachine() public TheMachine() {
}
public TheMachine(string port,string type = "IO")
{
if (("PLC").Equals(type))
{ {
machineType = MachineType.PLC;
}
LOGGER.Info($"port={port},machineType={machineType}");
SerialPortSetting.PortName = port;
} }
public SerialPortSetting ItsSerialPort public SerialPortSetting ItsSerialPort
...@@ -56,19 +69,27 @@ namespace MachineDll ...@@ -56,19 +69,27 @@ namespace MachineDll
public bool StartConnection() public bool StartConnection()
{ {
if (IsDebug)
{
_ItsControllor = new MachineControllor(_ItsSerialPort, IsDebug);
return true;
}
bool isConnection = false; bool isConnection = false;
_ItsControllor = new MachineControllor(_ItsSerialPort);
if (_ItsSerialPort == null) if (_ItsSerialPort == null)
{ {
//LOGGER.Debug("_ItsSerialPort is null"); //LOGGER.Debug("_ItsSerialPort is null");
try try
{ {
_ItsSerialPort = new SerialPortSetting(); _ItsSerialPort = new SerialPortSetting();
isConnection = _ItsSerialPort.StartConnection();
_ItsControllor = new MachineControllor(_ItsSerialPort); _ItsControllor = new MachineControllor(_ItsSerialPort);
isConnection = _ItsSerialPort.StartConnection();
} }
catch (Exception ex) catch (Exception ex)
{ {
//LOGGER.Warn(ex.StackTrace); LOGGER.Error(ex.ToString());
} }
//LOGGER.Debug("new one _ItsSerialPort object"); //LOGGER.Debug("new one _ItsSerialPort object");
} }
...@@ -99,7 +120,7 @@ namespace MachineDll ...@@ -99,7 +120,7 @@ namespace MachineDll
public bool StartReading() public bool StartReading()
{ {
if (_ItsSerialPort == null) if (_ItsSerialPort == null && !IsDebug)
{ {
MessageBox.Show("串口未连接,请先连接串口"); MessageBox.Show("串口未连接,请先连接串口");
} }
...@@ -195,7 +216,7 @@ namespace MachineDll ...@@ -195,7 +216,7 @@ namespace MachineDll
public bool StartReadingIO() public bool StartReadingIO()
{ {
if (_ItsSerialPort == null) if (_ItsSerialPort == null && !IsDebug)
{ {
MessageBox.Show("串口未连接,请先连接串口"); MessageBox.Show("串口未连接,请先连接串口");
} }
...@@ -214,7 +235,7 @@ namespace MachineDll ...@@ -214,7 +235,7 @@ namespace MachineDll
} }
private void StartReadIOFromBuffer(object sender, EventArgs e) private void StartReadIOFromBuffer(object sender, EventArgs e)
{ {
if (_ItsSerialPort != null && _ItsSerialPort.PortIsOpen()) if (IsDebug || _ItsSerialPort != null && _ItsSerialPort.PortIsOpen())
{ {
double receiveIOValue = this.GetControllor.SendAIString(); double receiveIOValue = this.GetControllor.SendAIString();
IOTellClients(receiveIOValue); IOTellClients(receiveIOValue);
...@@ -230,6 +251,102 @@ namespace MachineDll ...@@ -230,6 +251,102 @@ namespace MachineDll
} }
} }
} }
/// <summary>
/// 打开过滤
/// </summary>
public void OpenFilter() {
if (machineType == MachineType.PLC)
{
_ItsControllor.CloseY0();
System.Threading.Thread.Sleep(1000);
_ItsControllor.OpenY1();
System.Threading.Thread.Sleep(500);
_ItsControllor.OpenY1();
System.Threading.Thread.Sleep(1000);
_ItsControllor.OpenY2();
System.Threading.Thread.Sleep(500);
_ItsControllor.OpenY2();
System.Threading.Thread.Sleep(1000);
}
else
_ItsControllor.OpenY1Y2();
}
/// <summary>
/// 打开清洗
/// </summary>
public void OpenWash() {
if (machineType == MachineType.PLC)
{
_ItsControllor.OpenY0();
System.Threading.Thread.Sleep(500);
_ItsControllor.OpenY0();
System.Threading.Thread.Sleep(1000);
_ItsControllor.OpenY2();
System.Threading.Thread.Sleep(500);
_ItsControllor.OpenY2();
System.Threading.Thread.Sleep(1000);
}
else
_ItsControllor.OpenY0Y2();
}
/// <summary>
/// 关闭
/// </summary>
public void Close() {
if (machineType == MachineType.PLC)
{
_ItsControllor.CloseY2();
System.Threading.Thread.Sleep(1000);
_ItsControllor.CloseY1();
}
else
_ItsControllor.CloseAll();
}
public double GetData()
{
if (machineType == MachineType.PLC)
{
double returnValue = -1;
byte[] byte1 = new byte[1];
byte1[0] = 0x80;
_ItsSerialPort.SendByteNew(byte1);//BuffType.ADDRESS.ToString());
System.Threading.Thread.Sleep(200);
byte[] flag = _ItsSerialPort.ReadByte();
if (flag.Length == 0)
{
return returnValue;
} }
if ((int)flag[0] == 6)//握手成功
{
byte1 = new byte[1];
byte1[0] = 0x0;
_ItsSerialPort.SendByteNew(byte1);//BuffType.COMMAND1.ToString());
System.Threading.Thread.Sleep(200);
var reciveValue = _ItsSerialPort.ReadByte();
string temp = "";
for (int i = 1; i < reciveValue.Length; i++)//0~5
{
if (Convert.ToChar(reciveValue[i]).ToString() == "+")
{
break;
}
temp = temp + Convert.ToChar(reciveValue[i]);
}
double.TryParse(temp, out returnValue);
}
return returnValue;
}
else
{
return _ItsControllor.SendAIString();
}
}
}
} }
\ No newline at end of file \ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!