diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs
index fe30380..ca2356d 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs
@@ -1016,8 +1016,8 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
/// 重量
/// 公差
/// 物料集合
- /// 步骤集合
/// 数据库物料记录
+ /// 产线选择单选框
private static void DryerGetValue(MCCombobox DryM, MCTextBox DryW, MCTextBox DryT,
List recipes, List materials, MCRadioButtonEntity RadioE)
{
@@ -1026,6 +1026,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
float w = Convert.ToSingle(DryW.MCValue.ToString());
float t = Convert.ToSingle(DryT.MCValue.ToString());
+ //验证公差不能小于0.1
if (b != -1 && t < 0.1)
{
TFlag = 1;
@@ -1042,6 +1043,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
DeviceMaterrial deviceMaterial1 = new DeviceMaterrial()
{
+ DeviceId = ControlsHelper.DrySelect(RadioE),
MaterrialId = b,
Type = 1,
Code = StockMaterrialDbHelp.GetCodeById(b)
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs
index 31681bd..b4b4ce5 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs
@@ -26,6 +26,8 @@ using Mesnac.Action.ChemicalWeighing.MinAn;
using Mesnac.Action.ChemicalWeighing.FreeDb;
using Mesnac.Action.ChemicalWeighing.InterfaceDocking;
using Mesnac.Action.ChemicalWeighing.Report;
+using Mesnac.Action.ChemicalWeighing.InterfaceDocking.DockingEntity;
+using Mesnac.Core.Service;
namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
{
@@ -46,6 +48,10 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
int LineKindFlag = 0;
+ int no = 0;
+
+ Dictionary WetStatus = new Dictionary();
+
//读取报表
ushort ReadFlag = 0;
@@ -268,6 +274,13 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
timer.Dispose();
}
+ no += 1;
+ if (no > 5)
+ {
+ no = 0;
+ Timer1_Tick();
+ }
+
LineKindFlag += 1;
if (LineKindFlag >= 300)
{
@@ -1814,7 +1827,85 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
#endregion
+ #region 返回数据读取
+
+ private void Timer1_Tick()
+ {
+
+ 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);
+
+ }
+
+ private void Time(int deviceNo, int statu)
+ {
+ //OpenDoorService.Insert(new OpenDoorEntity()
+ //{
+ // DeviceId = deviceNo,
+ // OpenTime = DateTime.Now,
+ // CreateTime = DateTime.Now,
+ // Status = statu
+ //});
+
+ if (WetStatus.ContainsKey(deviceNo) == false)
+ {
+ WetStatus.Add(deviceNo, statu);
+ DonwloadWetState(deviceNo, statu);
+ }
+
+ if (WetStatus[deviceNo] != statu)
+ {
+ WetStatus[deviceNo] = statu;
+ DonwloadWetState(deviceNo, statu);
+ }
+ }
+
+ private void DonwloadWetState(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();
+ // MesnacServiceManager.Instance.LoggingService.Info($"湿混机{deviceNo}下发请求");
+ string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity);
+ // LjManualLog.ManualLogControl($"湿混机{deviceNo}返回数据 " + returnTest);
+ MesnacServiceManager.Instance.LoggingService.Info($"湿混机{deviceNo}返回数据" + returnTest);
+ });
+ }
+
+ #endregion
}
}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/LjLogReport.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/LjLogReport.cs
index 80a9df4..ea21771 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/LjLogReport.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/LjLogReport.cs
@@ -27,7 +27,7 @@ namespace Mesnac.Action.ChemicalWeighing.Report
MCDateTimePicker StartDate;
MCDateTimePicker EndDate;
- MCDataGridView LogForm;
+ DbMCControl LogForm;
MCCombobox Line;
@@ -45,14 +45,14 @@ namespace Mesnac.Action.ChemicalWeighing.Report
SelectByText = control.FirstOrDefault(x => x != null && x.Name == "SelectByText") as MCButton;
StartDate = control.FirstOrDefault(x => x != null && x.Name == "StartDate") as MCDateTimePicker;
EndDate = control.FirstOrDefault(x => x != null && x.Name == "EndDate") as MCDateTimePicker;
- LogForm = control.FirstOrDefault(x => x != null && x.Name == "LogForm") as MCDataGridView;
+ LogForm = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "ManualLogGridView1").FirstOrDefault();
SelectText = control.FirstOrDefault(x => x != null && x.Name == "SelectText") as MCTextBox;
Line = control.FirstOrDefault(x => x != null && x.Name == "Line") as MCCombobox;
if (LogForm != null)
{
- LogForm.DataSource = null;
- LogForm.DataSource = LjLogControl.ManualLogSelect("");
+ LogForm.BaseControl.BindDataSource = null;
+ LogForm.BaseControl.BindDataSource = LjLogControl.ManualLogSelect("");
}
DataTable dataTable = new DataTable();
@@ -117,8 +117,8 @@ namespace Mesnac.Action.ChemicalWeighing.Report
{
if (LogForm != null)
{
- LogForm.DataSource = null;
- LogForm.DataSource = LjLogControl.ManualLogSelect(key);
+ LogForm.BaseControl.BindDataSource = null;
+ LogForm.BaseControl.BindDataSource = LjLogControl.ManualLogSelect(key);
}
}
@@ -127,8 +127,8 @@ namespace Mesnac.Action.ChemicalWeighing.Report
{
if (LogForm != null)
{
- LogForm.DataSource = null;
- LogForm.DataSource = LjLogControl.ManualLogSelect(key, deviceNo);
+ LogForm.BaseControl.BindDataSource = null;
+ LogForm.BaseControl.BindDataSource = LjLogControl.ManualLogSelect(key, deviceNo);
}
}
@@ -137,8 +137,8 @@ namespace Mesnac.Action.ChemicalWeighing.Report
{
if (LogForm != null)
{
- LogForm.DataSource = null;
- LogForm.DataSource = LjLogControl.ManualLogSelect(startTime, endTime);
+ LogForm.BaseControl.BindDataSource = null;
+ LogForm.BaseControl.BindDataSource = LjLogControl.ManualLogSelect(startTime, endTime);
}
}
diff --git a/DataBlockHelper/PlcConnect.cs b/DataBlockHelper/PlcConnect.cs
index b76a347..c3c3fa3 100644
--- a/DataBlockHelper/PlcConnect.cs
+++ b/DataBlockHelper/PlcConnect.cs
@@ -28,7 +28,7 @@ namespace DataBlockHelper
SiemensS7Net s7 = new SiemensS7Net(siemensPLCS);
s7.SetPersistentConnection();
//s7.IpAddress = "172.18.4.100";
- s7.IpAddress = "192.168.1.110";
+ s7.IpAddress = "192.168.4.100";
s7.Port = 102;
var su = s7.ConnectServer();
diff --git a/Main/MCEdit/Data/MCProject/nodeForm/LjLogForm.xml b/Main/MCEdit/Data/MCProject/nodeForm/LjLogForm.xml
index 7029c8b..a45d498 100644
--- a/Main/MCEdit/Data/MCProject/nodeForm/LjLogForm.xml
+++ b/Main/MCEdit/Data/MCProject/nodeForm/LjLogForm.xml
@@ -14,7 +14,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAHAAAABwMAAAAAAQAAAAQAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAANBAs=
- [DataSource1].[ManualLogGridView]
+ [DataSource1].[ManualLogGridView1]
True
@@ -25,6 +25,7 @@
None
True
True
+ False
False
310, 12
LogForm