Commit 510c7411 LN

1

1 个父辈 cecaecce
......@@ -52,6 +52,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
......
......@@ -72,6 +72,7 @@
this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.button1 = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.panel1.SuspendLayout();
......@@ -113,6 +114,7 @@
//
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel1.Controls.Add(this.button1);
this.panel1.Controls.Add(this.chbInstoreEnd);
this.panel1.Controls.Add(this.chkDebug);
this.panel1.Controls.Add(this.lblMoveInfo);
......@@ -475,6 +477,19 @@
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.button1.BackColor = System.Drawing.Color.White;
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.Location = new System.Drawing.Point(12, 490);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(105, 35);
this.button1.TabIndex = 272;
this.button1.Text = "测试";
this.button1.UseVisualStyleBackColor = false;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// FrmStore
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
......@@ -551,6 +566,7 @@
private System.Windows.Forms.Label lblMoveInfo;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.CheckBox chbInstoreEnd;
private System.Windows.Forms.Button button1;
}
}
......@@ -11,6 +11,7 @@ using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
......@@ -708,5 +709,41 @@ namespace OnlineStore.DUOStore
LogUtil.info(store.Name + " 切换 入库完成送出料架=" + store.OutstoreEndSendShelf);
}
private async void button1_Click(object sender, EventArgs e)
{
int contentLength = await AccessTheWebAsync();
this.logBox.Text+= $"\r\nLength of the downloaded string: {contentLength}.\r\n";
}
async Task<int> AccessTheWebAsync()
{
// You need to add a reference to System.Net.Http to declare client.
var client = new HttpClient();
// GetStringAsync returns a Task<string>. That means that when you await the
// task you'll get a string (urlContents).
Task<string> getStringTask = client.GetStringAsync("https://docs.microsoft.com/dotnet");
// You can do work here that doesn't rely on the string from GetStringAsync.
DoIndependentWork();
// The await operator suspends AccessTheWebAsync.
// - AccessTheWebAsync can't continue until getStringTask is complete.
// - Meanwhile, control returns to the caller of AccessTheWebAsync.
// - Control resumes here when getStringTask is complete.
// - The await operator then retrieves the string result from getStringTask.
string urlContents = await getStringTask;
// The return statement specifies an integer result.
// Any methods that are awaiting AccessTheWebAsync retrieve the length value.
return urlContents.Length;
}
private void DoIndependentWork()
{
Console.WriteLine("Working ... .... ");
this.logBox.Text += $"\r\nWorking ... .... .\r\n";
}
}
}
......@@ -76,7 +76,7 @@ namespace OnlineStore.DeviceLibrary
//判断急停
if (runStatus >= StoreRunStatus.HomeMoving)
{
if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
if (IOManager.IOValue(IO_Type.SuddenStop_BTN,0).Equals(IO_VALUE.LOW))
{
if (isInSuddenDown.Equals(false))
{
......@@ -113,12 +113,21 @@ namespace OnlineStore.DeviceLibrary
AutoInout.StopAuto();
mainTimer.Enabled = false;
alarmType = AlarmType.None;
//急停按钮和气压检测需要一起判断
IO_VALUE suddenBtn = IOValue(IO_Type.SuddenStop_BTN);
IO_VALUE airCheck = IOValue(IO_Type.Airpressure_Check);
if (suddenBtn.Equals(IO_VALUE.HIGH) && (airCheck.Equals(IO_VALUE.HIGH)))
if (IOManager.IOValue(IO_Type.SuddenStop_BTN, 0).Equals(IO_VALUE.LOW))
{
WarnMsg = "启动失败:急停没开";
LogUtil.error(" (" + Name + ")启动失败:急停没开!");
return false;
}
else if (IOManager.IOValue(IO_Type.Airpressure_Check, 0).Equals(IO_VALUE.LOW))
{
WarnMsg = "启动失败:没有气压信号";
LogUtil.error(" (" + Name + ")启动失败:没有气压信号!");
return false;
}
else
//if (suddenBtn.Equals(IO_VALUE.HIGH) && (airCheck.Equals(IO_VALUE.HIGH)))
{
//lastAirValue = airCheck;
lastAirCloseTime = DateTime.Now;
......@@ -141,20 +150,7 @@ namespace OnlineStore.DeviceLibrary
return true;
}
else
{
if (suddenBtn.Equals(IO_VALUE.LOW))
{
WarnMsg = "启动失败:急停没开";
LogUtil.error(" (" + Name + ")启动失败:急停没开!");
}
else
{
WarnMsg = "启动失败:没有气压信号";
LogUtil.error(" (" + Name + ")启动失败:没有气压信号!");
}
return false;
}
}
......
......@@ -379,7 +379,8 @@ namespace OnlineStore.DeviceLibrary
public IO_VALUE IOValue(string IoType)
{
return IOManager.IOValue(IoType, baseConfig.Id);
}
}
protected bool WaitIo(string ioType, IO_VALUE value, int timeOut, string errName = "")
{
return WaitUtil.Wait(timeOut, delegate () {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!