【自动】修复排水的问题

wangsr
我叫锄头 12 months ago
parent 082249068a
commit e5497ecfc9

@ -75,6 +75,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo
dt = new DataTable();
dt.Columns.Add("机台", typeof(string));
dt.Columns.Add("总量", typeof(string));
dt.Columns.Add("搅拌次数", typeof(string));
MoreDataTable = new DataTable();
MoreDataTable.Columns.Add("设定重量", typeof(string));
@ -203,6 +204,10 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo
var totalWeight = list.Where(x => x.deviceno == i).Sum(x => x.value);
dr[1] = totalWeight.ToString();
var totalCount=list.Where(x => x.deviceno==i).Where(x=>x.value>400).Count();
dr[2] = totalCount.ToString();
dt.Rows.Add(dr);
}
var edr = dt.NewRow();

@ -175,7 +175,8 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
#endregion
LogInsertToDatabase("");
//读取停止按钮的状态
FillWaterStop();
#region 配置文件加载
var table = FreeSqlUnit.Instance.Select<ManualControlSetting>().Where("1 = 1").ToList();
@ -241,6 +242,79 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
timer.Tick += new EventHandler(ReadFromPlc);//添加事件
}
//GetAllDbMCControlsByOption(DbOptionTypes.Query);
private void FillWaterStop()
{
var query= GetAllDbMCControlsByOption(DbOptionTypes.Query);
MCButton WaterStop1= query.Where(t => t.BaseControl.MCKey != null
&& t.BaseControl.MCKey == "WaterStop1").FirstOrDefault().BaseControl as MCButton;
var plc = PlcConnect.Instance;
var waterStopBool1 = plc.ReadBool("DB2119.28.5").Content;
//如果等于1 文字取反
if (waterStopBool1)
{
WaterStop1.Text = "冷水称A恢复";
}
else
{
WaterStop1.Text = "冷水称A停止";
}
MCButton WaterStop2= query.Where(t => t.BaseControl.MCKey != null
&& t.BaseControl.MCKey == "WaterStop2").FirstOrDefault().BaseControl as MCButton;
var waterStopBool2 = plc.ReadBool("DB2119.8.5").Content;
//如果等于1 文字取反
if (waterStopBool2)
{
WaterStop2.Text = "热水称A恢复";
}
else
{
WaterStop2.Text = "热水称A停止";
}
MCButton WaterStop3= query.Where(t => t.BaseControl.MCKey != null
&& t.BaseControl.MCKey == "WaterStop3").FirstOrDefault().BaseControl as MCButton;
var waterStopBool3 = plc.ReadBool("DB2119.38.5").Content;
//如果等于1 文字取反
if (waterStopBool3)
{
WaterStop3.Text = "冷水称B恢复";
}
else
{
WaterStop3.Text = "冷水称B停止";
}
MCButton WaterStop4= query.Where(t => t.BaseControl.MCKey != null
&& t.BaseControl.MCKey == "WaterStop4").FirstOrDefault().BaseControl as MCButton;
var waterStopBool4 = plc.ReadBool("DB2119.18.5").Content;
//如果等于1 文字取反
if (waterStopBool4)
{
WaterStop3.Text = "热水称B恢复";
}
else
{
WaterStop3.Text = "热水称B停止";
}
}
#region 单选变色控制
private void Wet1_CheckedChanged(object sender, EventArgs e)
@ -307,6 +381,9 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
#endregion
#region 返回数据读取
private void Timer1_Tick()

@ -785,122 +785,130 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
if (WaterStop1 == runtime.Sender)
{
switch (GelChooseA)
{
case 1:
PlcControl("DB2119.26.0", 1);
PlcControl("DB2119.28.5", true);
break;
case 2:
PlcControl("DB2119.26.0", 2);
PlcControl("DB2119.28.5", true);
break;
case 3:
PlcControl("DB2119.26.0", 3);
PlcControl("DB2119.28.5", true);
break;
case 4:
PlcControl("DB2119.26.0", 4);
PlcControl("DB2119.28.5", true);
break;
default:
MessageBox.Show("请选择一个糊化锅!");
return;
}
//switch (GelChooseA)
//{
// case 1:
// // PlcControl("DB2119.26.0", 1);
// //PlcControl("DB2119.28.5", true);
// break;
// case 2:
// // PlcControl("DB2119.26.0", 2);
// // PlcControl("DB2119.28.5", true);
// break;
// case 3:
// // PlcControl("DB2119.26.0", 3);
// // PlcControl("DB2119.28.5", true);
// break;
// case 4:
// //PlcControl("DB2119.26.0", 4);
// // PlcControl("DB2119.28.5", true);
// break;
// default:
// MessageBox.Show("请选择一个糊化锅!");
// return;
//}
MessageBox.Show("冷水称A已停止排水");
ManualLogControl("冷水称A停止排水");
MesnacServiceManager.Instance.LoggingService.Info("冷水称A停止排水");
WaterStopAction("DB2119.28.5", WaterStop1, "冷", "A");
//MessageBox.Show("冷水称A已停止排水");
//ManualLogControl("冷水称A停止排水");
//MesnacServiceManager.Instance.LoggingService.Info("冷水称A停止排水");
}
if (WaterStop2 == runtime.Sender)
{
switch (GelChooseA)
{
case 1:
PlcControl("DB2119.6.0", 1);
PlcControl("DB2119.8.5", true);
break;
case 2:
PlcControl("DB2119.6.0", 2);
PlcControl("DB2119.8.5", true);
break;
case 3:
PlcControl("DB2119.6.0", 3);
PlcControl("DB2119.8.5", true);
break;
case 4:
PlcControl("DB2119.6.0", 4);
PlcControl("DB2119.8.5", true);
break;
default:
MessageBox.Show("请选择一个糊化锅!");
return;
}
//switch (GelChooseA)
//{
// case 1:
// //PlcControl("DB2119.6.0", 1);
// // PlcControl("DB2119.8.5", true);
// break;
// case 2:
// // PlcControl("DB2119.6.0", 2);
// // PlcControl("DB2119.8.5", true);
// break;
// case 3:
// // PlcControl("DB2119.6.0", 3);
// //PlcControl("DB2119.8.5", true);
// break;
// case 4:
// // PlcControl("DB2119.6.0", 4);
// // PlcControl("DB2119.8.5", true);
// break;
// default:
// MessageBox.Show("请选择一个糊化锅!");
// return;
//}
MessageBox.Show("热水称A已停止排水");
ManualLogControl("热水称A停止排水");
MesnacServiceManager.Instance.LoggingService.Info("热水称A停止排水");
WaterStopAction("DB2119.8.5", WaterStop2, "热", "A");
//MessageBox.Show("热水称A已停止排水");
//ManualLogControl("热水称A停止排水");
//MesnacServiceManager.Instance.LoggingService.Info("热水称A停止排水");
}
if (WaterStop3 == runtime.Sender)
{
switch (GelChooseB)
{
case 5:
PlcControl("DB2119.36.0", 1);
PlcControl("DB2119.38.5", true);
break;
case 6:
PlcControl("DB2119.36.0", 2);
PlcControl("DB2119.38.5", true);
break;
case 7:
PlcControl("DB2119.36.0", 3);
PlcControl("DB2119.38.5", true);
break;
case 8:
PlcControl("DB2119.36.0", 4);
PlcControl("DB2119.38.5", true);
break;
default:
MessageBox.Show("请选择一个糊化锅!");
return;
}
//switch (GelChooseB)
//{
// case 5:
// // PlcControl("DB2119.36.0", 1);
// // PlcControl("DB2119.38.5", true);
// break;
// case 6:
// // PlcControl("DB2119.36.0", 2);
// // PlcControl("DB2119.38.5", true);
// break;
// case 7:
// //PlcControl("DB2119.36.0", 3);
// // PlcControl("DB2119.38.5", true);
// break;
// case 8:
// // PlcControl("DB2119.36.0", 4);
// //PlcControl("DB2119.38.5", true);
// break;
// default:
// MessageBox.Show("请选择一个糊化锅!");
// return;
//}
WaterStopAction("DB2119.38.5", WaterStop3, "冷", "B");
MessageBox.Show("冷水称B已停止排水");
ManualLogControl("冷水称B停止排水");
MesnacServiceManager.Instance.LoggingService.Info("冷水称B停止排水");
//MessageBox.Show("冷水称B已停止排水");
//ManualLogControl("冷水称B停止排水");
//MesnacServiceManager.Instance.LoggingService.Info("冷水称B停止排水");
}
if (WaterStop4 == runtime.Sender)
{
switch (GelChooseB)
{
case 5:
PlcControl("DB2119.16.0", 1);
PlcControl("DB2119.18.5", true);
break;
case 6:
PlcControl("DB2119.16.0", 2);
PlcControl("DB2119.18.5", true);
break;
case 7:
PlcControl("DB2119.16.0", 3);
PlcControl("DB2119.18.5", true);
break;
case 8:
PlcControl("DB2119.16.0", 4);
PlcControl("DB2119.18.5", true);
break;
default:
MessageBox.Show("请选择一个糊化锅!");
return;
}
//switch (GelChooseB)
//{
// case 5:
// // PlcControl("DB2119.16.0", 1);
// // PlcControl("DB2119.18.5", true);
// break;
// case 6:
// // PlcControl("DB2119.16.0", 2);
// // PlcControl("DB2119.18.5", true);
// break;
// case 7:
// // PlcControl("DB2119.16.0", 3);
// // PlcControl("DB2119.18.5", true);
// break;
// case 8:
// // PlcControl("DB2119.16.0", 4);
// //PlcControl("DB2119.18.5", true);
// break;
// default:
// MessageBox.Show("请选择一个糊化锅!");
// return;
//}
WaterStopAction("DB2119.18.5", WaterStop4, "热", "B");
MessageBox.Show("热水称B已停止排水");
ManualLogControl("热水称B停止排水");
MesnacServiceManager.Instance.LoggingService.Info("热水称B停止排水");
//MessageBox.Show("热水称B已停止排水");
//ManualLogControl("热水称B停止排水");
//MesnacServiceManager.Instance.LoggingService.Info("热水称B停止排水");
}
#endregion
@ -1569,6 +1577,45 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
private void WaterStopAction(string plcAddress,MCButton button,string h,string a)
{
//先读取plc地址
bool stopMe1 = PlcConnect.Instance.ReadBool(plcAddress).Content;
bool me1 = !stopMe1;
PlcControl(plcAddress, me1);
string txt = $"{h}水称{a}";
//如果Plc是1 就证明是点了停止称量
if (me1)
{
txt += "恢复";
}
else
{
txt += "停止";
}
button.Text = txt;
txt = $"{h}水称{a}";
//如果Plc是1 就证明是点了停止称量
if (!me1)
{
txt += "恢复";
}
else
{
txt += "停止";
}
MessageBox.Show(txt);
ManualLogControl(txt);
MesnacServiceManager.Instance.LoggingService.Info(txt);
}
#endregion
}

@ -33,30 +33,13 @@ namespace Mesnac.Action.ChemicalWeighing.Test
HslSwitch hslSwitch;
HslLedDisplay hslLed;
public void timer1EventProcessor(object source, EventArgs e)
{
DB2105Helper db2105Helper = new DB2105Helper();
var lis = db2105Helper.ReadReadyG1;
lis = db2105Helper.ReadReadyG2;
lis = db2105Helper.ReadReadyG3;
lis = db2105Helper.ReadReadyG4;
lis = db2105Helper.ReadReadyG5;
lis = db2105Helper.ReadReadyG6;
lis = db2105Helper.ReadReadyG7;
lis = db2105Helper.ReadReadyG8;
var liss = db2105Helper.ReadReadyM1;
liss = db2105Helper.ReadReadyM2;
liss = db2105Helper.ReadReadyM3;
liss = db2105Helper.ReadReadyM4;
liss = db2105Helper.ReadReadyM5;
liss = db2105Helper.ReadReadyM6;
liss = db2105Helper.ReadReadyM7;
liss = db2105Helper.ReadReadyM8;
var yw= Db3000Helper.ReadModel();
hslLed.DisplayText = DateTime.Now.ToString("mm:ss");
}
@ -74,7 +57,7 @@ namespace Mesnac.Action.ChemicalWeighing.Test
hslSwitch.OnSwitchChanged += HslSwitch_OnSwitchChanged;
hslLed= allDb.FirstOrDefault(x => x.Name == "HslLedDisplay1") as HslLedDisplay;
//MCButton1
//OpenDoorService

@ -1664,6 +1664,21 @@
</DataBinding>
</Component>
<Component Name="HslLedDisplay" Namespace="Mesnac.Controls.HslLedDisplay" Asm="Mesnac.Controls.ChemicalWeighing.dll">
<Propertys>
<Property Name="Location" Caption="位置" Group=""/>
<Property Name="Name" Caption="名称" Group=""/>
<Property Name="Size" Caption="大小" Group=""/>
<Property Name="Status" Caption="状态" Group=""/>
</Propertys>
<DataBinding>
</DataBinding>
</Component>
<Component Name="DailyTank" Namespace="Mesnac.Controls.ChemicalWeighing" Asm="Mesnac.Controls.ChemicalWeighing.dll">
<Propertys>
<Property Name="Location" Caption="λÖÃ" Group=""/>

@ -1,6 +1,11 @@
<Object type="Mesnac.Gui.Common.FrmRunTemplate, Mesnac.Gui.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="Form1" children="Controls">
<Object type="System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="Panel1" children="Controls">
<Object type="Mesnac.Controls.ChemicalWeighing.HslLedDisplay, Mesnac.Controls.ChemicalWeighing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="HslLedDisplay1" children="Controls">
<Property name="Location">448, 67</Property>
<Property name="Name">HslLedDisplay1</Property>
<Property name="Size">325, 58</Property>
</Object>
<Object type="Mesnac.Controls.ChemicalWeighing.HslSwitch, Mesnac.Controls.ChemicalWeighing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="HsSwitch1" children="Controls">
<Property name="Location">726, 199</Property>
<Property name="Name">HsSwitch1</Property>

@ -116,6 +116,9 @@
<ToolComponent chineseName="自定义小车" assembly="3" enabled="True" class="Mesnac.Controls.ChemicalWeighing.HslTruck" />
<ToolComponent chineseName="HslLanternAlarm" assembly="3" enabled="True" class="Mesnac.Controls.ChemicalWeighing.HslLanternAlarm" />
<ToolComponent chineseName="HslLanternSimple" assembly="3" enabled="True" class="Mesnac.Controls.ChemicalWeighing.HslLanternSimple" />
<ToolComponent chineseName="HslLedDisplay" assembly="3" enabled="True" class="Mesnac.Controls.ChemicalWeighing.HslLedDisplay" />
<ToolComponent chineseName="HslSwitch" assembly="3" enabled="True" class="Mesnac.Controls.ChemicalWeighing.HslSwitch" />
<!--<ToolComponent chineseName="管道" assembly="3" enabled="True" class="Mesnac.Controls.ChemicalWeighing.HslPipeLine" />-->
<ToolComponent chineseName="3管道" assembly="3" enabled="True" class="Mesnac.Controls.ChemicalWeighing.HslPipeLineThree" />

Loading…
Cancel
Save