add - 手动控制添加请求接料按钮

dep
wangsr 12 months ago
parent 399af4525e
commit 765dedaf93

@ -180,6 +180,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
LogInsertToDatabase(""); LogInsertToDatabase("");
//读取停止按钮的状态 //读取停止按钮的状态
FillWaterStop(); FillWaterStop();
#region 配置文件加载 #region 配置文件加载
var table = FreeSqlUnit.Instance.Select<ManualControlSetting>().Where("1 = 1").ToList(); var table = FreeSqlUnit.Instance.Select<ManualControlSetting>().Where("1 = 1").ToList();
@ -250,9 +251,9 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
private void FillWaterStop() private void FillWaterStop()
{ {
var query= GetAllDbMCControlsByOption(DbOptionTypes.Query); var query = GetAllDbMCControlsByOption(DbOptionTypes.Query);
MCButton WaterStop1= query.Where(t => t.BaseControl.MCKey != null MCButton WaterStop1 = query.Where(t => t.BaseControl.MCKey != null
&& t.BaseControl.MCKey == "WaterStop1").FirstOrDefault().BaseControl as MCButton; && t.BaseControl.MCKey == "WaterStop1").FirstOrDefault().BaseControl as MCButton;
var plc = PlcConnect.Instance; var plc = PlcConnect.Instance;
var waterStopBool1 = plc.ReadBool("DB2119.28.5").Content; var waterStopBool1 = plc.ReadBool("DB2119.28.5").Content;
@ -266,7 +267,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
WaterStop1.Text = "冷水称A停止"; WaterStop1.Text = "冷水称A停止";
} }
MCButton WaterStop2= query.Where(t => t.BaseControl.MCKey != null MCButton WaterStop2 = query.Where(t => t.BaseControl.MCKey != null
&& t.BaseControl.MCKey == "WaterStop2").FirstOrDefault().BaseControl as MCButton; && t.BaseControl.MCKey == "WaterStop2").FirstOrDefault().BaseControl as MCButton;
@ -282,7 +283,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
} }
MCButton WaterStop3= query.Where(t => t.BaseControl.MCKey != null MCButton WaterStop3 = query.Where(t => t.BaseControl.MCKey != null
&& t.BaseControl.MCKey == "WaterStop3").FirstOrDefault().BaseControl as MCButton; && t.BaseControl.MCKey == "WaterStop3").FirstOrDefault().BaseControl as MCButton;
@ -297,7 +298,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
WaterStop3.Text = "冷水称B停止"; WaterStop3.Text = "冷水称B停止";
} }
MCButton WaterStop4= query.Where(t => t.BaseControl.MCKey != null MCButton WaterStop4 = query.Where(t => t.BaseControl.MCKey != null
&& t.BaseControl.MCKey == "WaterStop4").FirstOrDefault().BaseControl as MCButton; && t.BaseControl.MCKey == "WaterStop4").FirstOrDefault().BaseControl as MCButton;
@ -315,9 +316,6 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
} }
#region 单选变色控制 #region 单选变色控制
private void Wet1_CheckedChanged(object sender, EventArgs e) private void Wet1_CheckedChanged(object sender, EventArgs e)
@ -384,9 +382,6 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
#endregion #endregion
#region 返回数据读取 #region 返回数据读取
private void Timer1_Tick() private void Timer1_Tick()
@ -504,7 +499,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
} }
if (DB2119.Hotwater_A.Dos_End) if (DB2119.Hotwater_A.Dos_End)
{ {
if(PlcControl("DB2119.8.3", false)) if (PlcControl("DB2119.8.3", false))
{ {
ManualLogControl("热水称A称量结束", DB2119.Hotwater_A.Value_Initial, 2, 1, 1); ManualLogControl("热水称A称量结束", DB2119.Hotwater_A.Value_Initial, 2, 1, 1);
} }

@ -26,6 +26,7 @@ using Mesnac.Action.ChemicalWeighing.MinAn;
using System.Xml.Serialization; using System.Xml.Serialization;
using System.Threading; using System.Threading;
using DataBlockHelper.DBHelpers; using DataBlockHelper.DBHelpers;
using System.Diagnostics;
namespace Mesnac.Action.ChemicalWeighing.ManualControl namespace Mesnac.Action.ChemicalWeighing.ManualControl
{ {
@ -133,6 +134,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
MCButton Focus; MCButton Focus;
MCButton SaveSetting; MCButton SaveSetting;
MCButton LoadSetting; MCButton LoadSetting;
MCButton DownloadRequest;
#endregion #endregion
@ -142,10 +144,6 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
IBaseControl keywords; IBaseControl keywords;
DB2119Helper DB2119;
public void Run(RuntimeParameter runtime) public void Run(RuntimeParameter runtime)
{ {
base.RunIni(runtime); //必须要调用 base.RunIni(runtime); //必须要调用
@ -157,8 +155,6 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
SingleSelect(); SingleSelect();
BottomSelect(runtime); BottomSelect(runtime);
DB2119 = new DB2119Helper();
} }
#region 控件获取导入 #region 控件获取导入
@ -259,6 +255,8 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
SaveSetting = GetButtonControl("SaveSetting"); SaveSetting = GetButtonControl("SaveSetting");
LoadSetting = GetButtonControl("LoadSetting"); LoadSetting = GetButtonControl("LoadSetting");
DownloadRequest = GetButtonControl("DownloadRequest");
} }
#endregion #endregion
@ -365,6 +363,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
Focus.Focus(); Focus.Focus();
DB2119Helper DB2119 = new DB2119Helper(); DB2119Helper DB2119 = new DB2119Helper();
Db3000Helper DB3000 = new Db3000Helper();
#region 消除报警 #region 消除报警
if (EliAlarms == runtime.Sender) if (EliAlarms == runtime.Sender)
@ -1011,7 +1010,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
{ {
var record = FreeSqlUnit.Instance.Select<ManualLogEntity>() var record = FreeSqlUnit.Instance.Select<ManualLogEntity>()
.Where(x => x.valuekind == 3 && x.devicekind == 2 && x.deviceno == 1 && x.value > 350).ToList().LastOrDefault(); .Where(x => x.valuekind == 3 && x.devicekind == 2 && x.deviceno == 1 && x.value > 350).ToList().LastOrDefault();
if(record == null) { return; } if (record == null) { return; }
if ((DateTime.Now - record.logtime).Value.TotalMinutes < 15) if ((DateTime.Now - record.logtime).Value.TotalMinutes < 15)
{ {
if (MessageBox.Show("距离上次下料大于350KG不足15分钟 确认下料?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) if (MessageBox.Show("距离上次下料大于350KG不足15分钟 确认下料?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
@ -1447,6 +1446,54 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
#endregion #endregion
#region 下发请求
if(DownloadRequest == runtime.Sender)
{
bool mixok1 = PlcConnect.Instance.ReadBool("DB3000.0.0").Content;
Time(1, mixok1 ? 1 : 0);
bool mixok2 = PlcConnect.Instance.ReadBool("DB3000.0.1").Content;
Time(2, mixok2 ? 1 : 0);
bool mixok3 = PlcConnect.Instance.ReadBool("DB3000.0.2").Content;
Time(3, mixok3 ? 1 : 0);
bool mixok4 = PlcConnect.Instance.ReadBool("DB3000.0.3").Content;
Time(4, mixok4 ? 1 : 0);
bool mixok5 = PlcConnect.Instance.ReadBool("DB3000.0.4").Content;
Time(5, mixok5 ? 1 : 0);
bool mixok6 = PlcConnect.Instance.ReadBool("DB3000.0.5").Content;
Time(6, mixok6 ? 1 : 0);
bool mixok7 = PlcConnect.Instance.ReadBool("DB3000.0.6").Content;
Trace.WriteLine("7号信号:" + mixok7);
Time(7, mixok7 ? 1 : 0);
bool mixok8 = PlcConnect.Instance.ReadBool("DB3000.0.7").Content;
Trace.WriteLine("8号信号:" + mixok8);
Time(8, mixok8 ? 1 : 0);
}
#endregion
}
/// <summary>
/// 下发请求
/// </summary>
/// <param name="deviceNo"></param>
/// <param name="statu"></param>
private void Time(int deviceNo, int statu)
{
TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity()
{
reqCode = System.Guid.NewGuid().ToString(),
reqTime = DateTime.Now,
deviceNo = deviceNo.ToString(),
state = statu.ToString(),
};
//即使网络不同 也不会影响上位机的使用
ThreadPool.QueueUserWorkItem(delegate
{
HttpResponse httpResponse = new HttpResponse();
string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity);
MesnacServiceManager.Instance.LoggingService.Info($"湿混机{deviceNo}返回数据" + returnTest);
});
} }
#endregion #endregion

@ -1,5 +1,29 @@
<Object type="Mesnac.Gui.Common.FrmRunTemplate, Mesnac.Gui.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="ManualWaterControl" children="Controls"> <Object type="Mesnac.Gui.Common.FrmRunTemplate, Mesnac.Gui.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="ManualWaterControl" children="Controls">
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="DownloadRequest" children="Controls">
<Property name="ClickActionList">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAEAAAAIAAAABwMAAAAAAQAAAAQAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAJBAAAAA0DBQQAAAAhTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uAwAAABU8R1VJRD5rX19CYWNraW5nRmllbGQVPE5hbWU+a19fQmFja2luZ0ZpZWxkFzxSZW1hcms+a19fQmFja2luZ0ZpZWxkAQEBAgAAAAYFAAAAIDhBNkE3NzM4OTg2NDRFQjlBQ0FGQkRDOEZENjZERjNDBgYAAAAM5oyJ6ZKu5LqL5Lu2BgcAAAAM5oyJ6ZKu5LqL5Lu2Cw==</Binary>
</Property>
<Property name="MCKey">DownloadRequest</Property>
<Property name="MCDataSourceID" />
<Property name="IsDbControl">False</Property>
<Property name="InitDataSource" />
<Property name="ActionDataSource" />
<Property name="BindDataSource" />
<Property name="DbOptionType">Query</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="MCPurview">False</Property>
<Property name="Format" />
<Property name="TextName" />
<Property name="NewFillColor">Red</Property>
<Property name="OldFillColor">DarkGray</Property>
<Property name="Text">下发送料请求</Property>
<Property name="Location">702, 356</Property>
<Property name="Name">DownloadRequest</Property>
<Property name="Size">148, 44</Property>
<Property name="TabIndex">39</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="EliAlarms" children="Controls"> <Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="EliAlarms" children="Controls">
<Property name="ClickActionList"> <Property name="ClickActionList">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAEAAAACAAAABwMAAAAAAQAAA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ZENjZERjNDBgYAAAAM5oyJ6ZKu5LqL5Lu2BgcAAAAM5oyJ6ZKu5LqL5Lu2Cw==</Binary>
@ -19,7 +43,7 @@
<Property name="NewFillColor">Red</Property> <Property name="NewFillColor">Red</Property>
<Property name="OldFillColor">DarkGray</Property> <Property name="OldFillColor">DarkGray</Property>
<Property name="Text">消除报警</Property> <Property name="Text">消除报警</Property>
<Property name="Location">702, 317</Property> <Property name="Location">702, 276</Property>
<Property name="Name">EliAlarms</Property> <Property name="Name">EliAlarms</Property>
<Property name="Size">148, 44</Property> <Property name="Size">148, 44</Property>
<Property name="TabIndex">30</Property> <Property name="TabIndex">30</Property>

Loading…
Cancel
Save