change - 下传混炼完毕数据

dep
wangsr 12 months ago
parent 7c05455c2c
commit 1a2531d391

@ -1016,8 +1016,8 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
/// <param name="DryW">重量</param> /// <param name="DryW">重量</param>
/// <param name="DryT">公差</param> /// <param name="DryT">公差</param>
/// <param name="recipes">物料集合</param> /// <param name="recipes">物料集合</param>
/// <param name="steps">步骤集合</param>
/// <param name="materials">数据库物料记录</param> /// <param name="materials">数据库物料记录</param>
/// <param name="RadioE">产线选择单选框</param>
private static void DryerGetValue(MCCombobox DryM, MCTextBox DryW, MCTextBox DryT, private static void DryerGetValue(MCCombobox DryM, MCTextBox DryW, MCTextBox DryT,
List<RecipePlcView> recipes, List<DeviceMaterrial> materials, MCRadioButtonEntity RadioE) List<RecipePlcView> recipes, List<DeviceMaterrial> materials, MCRadioButtonEntity RadioE)
{ {
@ -1026,6 +1026,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
float w = Convert.ToSingle(DryW.MCValue.ToString()); float w = Convert.ToSingle(DryW.MCValue.ToString());
float t = Convert.ToSingle(DryT.MCValue.ToString()); float t = Convert.ToSingle(DryT.MCValue.ToString());
//验证公差不能小于0.1
if (b != -1 && t < 0.1) if (b != -1 && t < 0.1)
{ {
TFlag = 1; TFlag = 1;
@ -1042,6 +1043,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
DeviceMaterrial deviceMaterial1 = new DeviceMaterrial() DeviceMaterrial deviceMaterial1 = new DeviceMaterrial()
{ {
DeviceId = ControlsHelper.DrySelect(RadioE),
MaterrialId = b, MaterrialId = b,
Type = 1, Type = 1,
Code = StockMaterrialDbHelp.GetCodeById(b) Code = StockMaterrialDbHelp.GetCodeById(b)

@ -26,6 +26,8 @@ using Mesnac.Action.ChemicalWeighing.MinAn;
using Mesnac.Action.ChemicalWeighing.FreeDb; using Mesnac.Action.ChemicalWeighing.FreeDb;
using Mesnac.Action.ChemicalWeighing.InterfaceDocking; using Mesnac.Action.ChemicalWeighing.InterfaceDocking;
using Mesnac.Action.ChemicalWeighing.Report; using Mesnac.Action.ChemicalWeighing.Report;
using Mesnac.Action.ChemicalWeighing.InterfaceDocking.DockingEntity;
using Mesnac.Core.Service;
namespace Mesnac.Action.ChemicalWeighing.MainDetailControl namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
{ {
@ -46,6 +48,10 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
int LineKindFlag = 0; int LineKindFlag = 0;
int no = 0;
Dictionary<int, int> WetStatus = new Dictionary<int, int>();
//读取报表 //读取报表
ushort ReadFlag = 0; ushort ReadFlag = 0;
@ -268,6 +274,13 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
timer.Dispose(); timer.Dispose();
} }
no += 1;
if (no > 5)
{
no = 0;
Timer1_Tick();
}
LineKindFlag += 1; LineKindFlag += 1;
if (LineKindFlag >= 300) if (LineKindFlag >= 300)
{ {
@ -1814,7 +1827,85 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
#endregion #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
} }
} }

@ -27,7 +27,7 @@ namespace Mesnac.Action.ChemicalWeighing.Report
MCDateTimePicker StartDate; MCDateTimePicker StartDate;
MCDateTimePicker EndDate; MCDateTimePicker EndDate;
MCDataGridView LogForm; DbMCControl LogForm;
MCCombobox Line; MCCombobox Line;
@ -45,14 +45,14 @@ namespace Mesnac.Action.ChemicalWeighing.Report
SelectByText = control.FirstOrDefault(x => x != null && x.Name == "SelectByText") as MCButton; SelectByText = control.FirstOrDefault(x => x != null && x.Name == "SelectByText") as MCButton;
StartDate = control.FirstOrDefault(x => x != null && x.Name == "StartDate") as MCDateTimePicker; StartDate = control.FirstOrDefault(x => x != null && x.Name == "StartDate") as MCDateTimePicker;
EndDate = control.FirstOrDefault(x => x != null && x.Name == "EndDate") 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; SelectText = control.FirstOrDefault(x => x != null && x.Name == "SelectText") as MCTextBox;
Line = control.FirstOrDefault(x => x != null && x.Name == "Line") as MCCombobox; Line = control.FirstOrDefault(x => x != null && x.Name == "Line") as MCCombobox;
if (LogForm != null) if (LogForm != null)
{ {
LogForm.DataSource = null; LogForm.BaseControl.BindDataSource = null;
LogForm.DataSource = LjLogControl.ManualLogSelect(""); LogForm.BaseControl.BindDataSource = LjLogControl.ManualLogSelect("");
} }
DataTable dataTable = new DataTable(); DataTable dataTable = new DataTable();
@ -117,8 +117,8 @@ namespace Mesnac.Action.ChemicalWeighing.Report
{ {
if (LogForm != null) if (LogForm != null)
{ {
LogForm.DataSource = null; LogForm.BaseControl.BindDataSource = null;
LogForm.DataSource = LjLogControl.ManualLogSelect(key); LogForm.BaseControl.BindDataSource = LjLogControl.ManualLogSelect(key);
} }
} }
@ -127,8 +127,8 @@ namespace Mesnac.Action.ChemicalWeighing.Report
{ {
if (LogForm != null) if (LogForm != null)
{ {
LogForm.DataSource = null; LogForm.BaseControl.BindDataSource = null;
LogForm.DataSource = LjLogControl.ManualLogSelect(key, deviceNo); LogForm.BaseControl.BindDataSource = LjLogControl.ManualLogSelect(key, deviceNo);
} }
} }
@ -137,8 +137,8 @@ namespace Mesnac.Action.ChemicalWeighing.Report
{ {
if (LogForm != null) if (LogForm != null)
{ {
LogForm.DataSource = null; LogForm.BaseControl.BindDataSource = null;
LogForm.DataSource = LjLogControl.ManualLogSelect(startTime, endTime); LogForm.BaseControl.BindDataSource = LjLogControl.ManualLogSelect(startTime, endTime);
} }
} }

@ -28,7 +28,7 @@ namespace DataBlockHelper
SiemensS7Net s7 = new SiemensS7Net(siemensPLCS); SiemensS7Net s7 = new SiemensS7Net(siemensPLCS);
s7.SetPersistentConnection(); s7.SetPersistentConnection();
//s7.IpAddress = "172.18.4.100"; //s7.IpAddress = "172.18.4.100";
s7.IpAddress = "192.168.1.110"; s7.IpAddress = "192.168.4.100";
s7.Port = 102; s7.Port = 102;
var su = s7.ConnectServer(); var su = s7.ConnectServer();

@ -14,7 +14,7 @@
<Property name="SelectionChangedActionList"> <Property name="SelectionChangedActionList">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAHAAAABwMAAAAAAQAAAAQAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAANBAs=</Binary> <Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAHAAAABwMAAAAAAQAAAAQAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAANBAs=</Binary>
</Property> </Property>
<Property name="MCKey">[DataSource1].[ManualLogGridView]</Property> <Property name="MCKey">[DataSource1].[ManualLogGridView1]</Property>
<Property name="MCDataSourceID" /> <Property name="MCDataSourceID" />
<Property name="IsDbControl">True</Property> <Property name="IsDbControl">True</Property>
<Property name="InitDataSource" /> <Property name="InitDataSource" />
@ -25,6 +25,7 @@
<Property name="DbOptionType">None</Property> <Property name="DbOptionType">None</Property>
<Property name="MCVisible">True</Property> <Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property> <Property name="MCEnabled">True</Property>
<Property name="AutoGenerateColumns">False</Property>
<Property name="MultiSelect">False</Property> <Property name="MultiSelect">False</Property>
<Property name="Location">310, 12</Property> <Property name="Location">310, 12</Property>
<Property name="Name">LogForm</Property> <Property name="Name">LogForm</Property>

Loading…
Cancel
Save