对接闽安系统 点击按钮提示正在上料

dep_nodyang
nodyang 1 year ago
parent 1f52509a44
commit d4223bf026

@ -22,7 +22,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using Mesnac.Action.ChemicalWeighing.LjMaterial; using Mesnac.Action.ChemicalWeighing.LjMaterial;
using Mesnac.Action.ChemicalWeighing.MinAn;
namespace Mesnac.Action.ChemicalWeighing.ManualControl namespace Mesnac.Action.ChemicalWeighing.ManualControl
{ {
@ -759,6 +759,20 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
if (SpiralOn1 == runtime.Sender) if (SpiralOn1 == runtime.Sender)
{ {
if (MinAnPlc.Heir1)
{
DialogResult result1 =
MessageBox.Show("1号罐正在上料", "温馨提示:", MessageBoxButtons.OK, MessageBoxIcon.Information);
if (result1 == DialogResult.OK)
{
return;
}
}
short valueSet; short valueSet;
short valueFast; short valueFast;
short valuePoint; short valuePoint;
@ -843,6 +857,17 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
if (SpiralOn2 == runtime.Sender) if (SpiralOn2 == runtime.Sender)
{ {
if (MinAnPlc.Heir2)
{
DialogResult result2 =
MessageBox.Show("2号罐正在上料", "温馨提示:", MessageBoxButtons.OK, MessageBoxIcon.Information);
if (result2 == DialogResult.OK)
{
return;
}
}
short valueSet; short valueSet;
short valueFast; short valueFast;
short valuePoint; short valuePoint;
@ -921,6 +946,17 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
if (SpiralOn3 == runtime.Sender) if (SpiralOn3 == runtime.Sender)
{ {
if (MinAnPlc.Heir3)
{
DialogResult result3 =
MessageBox.Show("3号罐正在上料", "温馨提示:", MessageBoxButtons.OK, MessageBoxIcon.Information);
if (result3 == DialogResult.OK)
{
return;
}
}
short valueSet; short valueSet;
short valueFast; short valueFast;
short valuePoint; short valuePoint;

@ -538,6 +538,7 @@
<Compile Include="MaterialManage\MaterialBarcodeAction.cs" /> <Compile Include="MaterialManage\MaterialBarcodeAction.cs" />
<Compile Include="MaterialManage\MaterialHelper.cs" /> <Compile Include="MaterialManage\MaterialHelper.cs" />
<Compile Include="MaterialManage\ModifyMaterialAction.cs" /> <Compile Include="MaterialManage\ModifyMaterialAction.cs" />
<Compile Include="MinAn\MinAnPlc.cs" />
<Compile Include="OliveEQSetting\InItDbAction.cs" /> <Compile Include="OliveEQSetting\InItDbAction.cs" />
<Compile Include="Pl\PlcConnect.cs" /> <Compile Include="Pl\PlcConnect.cs" />
<Compile Include="Product\ProductHelper.cs" /> <Compile Include="Product\ProductHelper.cs" />

@ -0,0 +1,39 @@
using DataBlockHelper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mesnac.Action.ChemicalWeighing.MinAn
{
public static class MinAnPlc
{
public static bool Heir1
{
get
{
return PlcConnect.Instance.ReadBool("M147.5").Content;
}
}
public static bool Heir2
{
get
{
return PlcConnect.Instance.ReadBool("M147.6").Content;
}
}
public static bool Heir3
{
get
{
return PlcConnect.Instance.ReadBool("M147.7").Content;
}
}
}
}

@ -12,6 +12,7 @@ using ICSharpCode.Core;
using Mesnac.Action.Base; using Mesnac.Action.Base;
using Mesnac.Action.ChemicalWeighing.LjReport.OpenDoor; using Mesnac.Action.ChemicalWeighing.LjReport.OpenDoor;
using Mesnac.Action.ChemicalWeighing.MinAn;
using Mesnac.Basic; using Mesnac.Basic;
using Mesnac.Codd.Session; using Mesnac.Codd.Session;
using Mesnac.Controls.Base; using Mesnac.Controls.Base;
@ -29,47 +30,25 @@ namespace Mesnac.Action.ChemicalWeighing.Test
public void timer1EventProcessor(object source, EventArgs e) public void timer1EventProcessor(object source, EventArgs e)
{ {
OpenDoorService.Insert(new OpenDoorEntity()
DialogResult result =
MessageBox.Show("正在上料", "温馨提示:", MessageBoxButtons.OK, MessageBoxIcon.Information);
if (result == DialogResult.OK)
{ {
DeviceId = 0, return;
OpenTime = DateTime.Now, }
CreateTime = DateTime.Now,
Status = 0 string a = MinAnPlc.Heir1.ToString();
}); string b = MinAnPlc.Heir2.ToString();
string c = MinAnPlc.Heir3.ToString();
} }
public void Run(RuntimeParameter runtime) public void Run(RuntimeParameter runtime)
{ {
base.RunIni(runtime); //必须调用 base.RunIni(runtime); //必须调用
var allDb=GetAllControls(); var allDb=GetAllControls();
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
if (dbHelper == null)
{
throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError);
}
// dbHelper.ClearParameter();
// dbHelper.CommandType = CommandType.Text;
// dbHelper.CommandText = sql;
int[] ssss = new int [] { };
var ss2s = BasePlcHelper.Instance.PlcReadByRunName("BU1BLT01_Set", out ssss);
Timer timer1 = new Timer();
timer1.Interval = 1000;
timer1.Enabled = true;
timer1.Tick += new EventHandler(timer1EventProcessor);//添加事件
mCButton = allDb.FirstOrDefault(x => x.Name == "MCButton1") as MCButton; mCButton = allDb.FirstOrDefault(x => x.Name == "MCButton1") as MCButton;
mCButton.Click += new EventHandler(timer1EventProcessor); mCButton.Click += new EventHandler(timer1EventProcessor);

Loading…
Cancel
Save