dep
我叫锄头 11 months ago
commit a6d2120915

@ -289,7 +289,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
if (b)
{
int i = ControlsHelper.SingleSelect(RadioE);
LjLogControl.ManualLogControl("手动下黑粉料向" + i, 3, Convert.ToInt32(TextE.ManualWeight.MCValue.ToString()), i, 2);
LjLogControl.ManualLogControl("手动下黑粉料向" + i, Convert.ToInt32(TextE.ManualWeight.MCValue.ToString()), 3, i, 2);
MessageBox.Show("数据下传成功!");
}

@ -59,7 +59,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjMaterial
dbHelper.CommandText = insertUserSql;
foreach (var keyValuePair in dic)
{
dbHelper.AddParameter(keyValuePair.Key,keyValuePair.Value);
dbHelper.AddParameter(keyValuePair.Key, keyValuePair.Value);
}
DataTable table = dbHelper.ToDataTable();
return table;
@ -67,8 +67,9 @@ namespace Mesnac.Action.ChemicalWeighing.LjMaterial
public static void ExecuteNonQuery(string sql)
{
ExecuteNonQuery(sql,new Dictionary<string, object>());
ExecuteNonQuery(sql, new Dictionary<string, object>());
}
public static void ExecuteNonQuery(string sql, IDictionary<string, object> dic)
{
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
@ -83,7 +84,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjMaterial
dbHelper.CommandText = insertUserSql;
foreach (var keyValuePair in dic)
{
dbHelper.AddParameter(keyValuePair.Key,keyValuePair.Value);
dbHelper.AddParameter(keyValuePair.Key, keyValuePair.Value);
}
dbHelper.ExecuteNonQuery();

@ -149,6 +149,9 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.WetWaitTime
dt.Rows.Add(dr);
}
try
{
var edr = dt.NewRow();
edr[0] = "湿混等待时间总和";
edr[1] = TimeConvert(list.Sum(x => x.MixWaitTime));
@ -162,6 +165,12 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.WetWaitTime
edr2[1] = TimeConvert(list.Sum(x => x.MixWaitTime + x.RgvWaitTime));
dt.Rows.Add(edr2);
}
catch (OverflowException ex)
{
MessageBox.Show("算术值溢出!请检查数据是否有误");
}
}
/// <summary>
/// 详细数据计算

@ -10,6 +10,7 @@ using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mesnac.Action.ChemicalWeighing.LjReport.WetWaitTime
{
@ -225,6 +226,8 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.WetWaitTime
dt.Rows.Add(dr);
}
try
{
var edr = dt.NewRow();
edr[0] = "湿混等待时间总和";
edr[1] = TimeConvert(list.Sum(x => x.MixWaitTime));
@ -238,6 +241,11 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.WetWaitTime
edr2[1] = TimeConvert(list.Sum(x => x.MixWaitTime + x.RgvWaitTime));
dt.Rows.Add(edr2);
}
catch (OverflowException ex)
{
MessageBox.Show("算术值溢出!请检查数据是否有误");
}
}
private string TimeConvert(int t)
{

@ -62,6 +62,21 @@ namespace Mesnac.Action.ChemicalWeighing.Report
return DBHelp.GetTable(sql);
}
/// <summary>
/// 去年数据的转移
/// </summary>
public static void LastYearDataCut()
{
int nowYear = DateTime.Now.Year;
string sql = $"insert into Manual_Log_{nowYear - 1} " +
$"select logtext, logtime, userid, value, valuekind, deviceno, devicekind, createdate " +
$"from Manual_Log where logtime < '{nowYear}-01-01 00:00:00'";
DBHelp.ExecuteNonQuery(sql);
sql = $"delete from Manual_Log where logtime < '{nowYear}-01-01 00:00:00'";
DBHelp.ExecuteNonQuery(sql);
}
private static string BaseSelect(string sql)
{
string s = "select top 500 id, logtext, logtime, value, deviceno from Manual_Log " + sql +

@ -32,6 +32,7 @@ namespace Mesnac.Action.ChemicalWeighing.Report
MCButton ManualControl;
MCButton Refresh;
MCButton SelectByText;
MCButton LastYearDataMove;
//HslSwitch HslSwitch1;
//HslSwitch HslSwitch2;
@ -63,6 +64,7 @@ namespace Mesnac.Action.ChemicalWeighing.Report
ManualControl = control.FirstOrDefault(x => x != null && x.Name == "ManualControl") as MCButton;
Refresh = control.FirstOrDefault(x => x != null && x.Name == "Refresh") as MCButton;
SelectByText = control.FirstOrDefault(x => x != null && x.Name == "SelectByText") as MCButton;
LastYearDataMove = control.FirstOrDefault(x => x != null && x.Name == "LastYearDataMove") 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 = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "ManualLogGridView1").FirstOrDefault();
@ -109,66 +111,21 @@ namespace Mesnac.Action.ChemicalWeighing.Report
ManualControl.Click += ManualControlSelect;
Refresh.Click += RefreshAction;
SelectByText.Click += SelectByTextAction;
LastYearDataMove.Click += DataMoveAction;
}
/// <summary>
/// 下发送料请求按钮点击
/// 转移去年的数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void RequestDownloadClick(object sender, EventArgs e)
private void DataMoveAction(object sender, EventArgs e)
{
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);
}
/// <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);
});
}
/// <summary>
/// 消除报警按钮点击
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void EliAlarmsClick(object sender, EventArgs e)
{
if (MessageBox.Show("确认要切割数据?", "三次提醒 3/1", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; }
if (MessageBox.Show("确认要切割数据?", "三次提醒 3/2", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; }
if (MessageBox.Show("确认要切割数据?", "三次提醒 3/3", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; }
LjLogControl.LastYearDataCut();
MessageBox.Show("数据切割成功");
}
/// <summary>

@ -1,5 +1,70 @@
<Object type="Mesnac.Gui.Common.FrmRunTemplate, Mesnac.Gui.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="LjLogForm" children="Controls">
<Object type="Mesnac.Controls.Default.MCLabel, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="MCLabel2" children="Controls">
<Property name="Format">
</Property>
<Property name="TextName" />
<Property name="NewFillColor">Red</Property>
<Property name="OldFillColor">DarkGray</Property>
<Property name="MCKey" />
<Property name="MCDataSourceID" />
<Property name="IsDbControl">False</Property>
<Property name="InitDataSource" />
<Property name="ActionDataSource" />
<Property name="BindDataSource" />
<Property name="DbOptionType">None</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="Text">每年年初点击</Property>
<Property name="Location">121, 816</Property>
<Property name="Name">MCLabel2</Property>
<Property name="Size">77, 12</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCLabel, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="MCLabel1" children="Controls">
<Property name="Format">
</Property>
<Property name="TextName" />
<Property name="NewFillColor">Red</Property>
<Property name="OldFillColor">DarkGray</Property>
<Property name="MCKey" />
<Property name="MCDataSourceID" />
<Property name="IsDbControl">False</Property>
<Property name="InitDataSource" />
<Property name="ActionDataSource" />
<Property name="BindDataSource" />
<Property name="DbOptionType">None</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="Text">切割今年以前的日志数据,防止日志数据库过大</Property>
<Property name="Location">12, 792</Property>
<Property name="Name">MCLabel1</Property>
<Property name="Size">251, 12</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="LastYearDataMove" children="Controls">
<Property name="ClickActionList">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL</Binary>
</Property>
<Property name="MCKey" />
<Property name="MCDataSourceID" />
<Property name="IsDbControl">False</Property>
<Property name="InitDataSource" />
<Property name="ActionDataSource" />
<Property name="BindDataSource" />
<Property name="DbOptionType">None</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="MCPurview">False</Property>
<Property name="Format">
</Property>
<Property name="TextName" />
<Property name="NewFillColor">Red</Property>
<Property name="OldFillColor">DarkGray</Property>
<Property name="Text">日志数据切割</Property>
<Property name="Location">12, 807</Property>
<Property name="Name">LastYearDataMove</Property>
<Property name="Size">103, 31</Property>
<Property name="TabIndex">14</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCDataGridView, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="LogForm" children="Controls">
<Property name="DisplayAllColumn">False</Property>
<Property name="DgvColumn">

@ -25,12 +25,11 @@
<Property name="DbOptionType">None</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="AutoGenerateColumns">False</Property>
<Property name="MultiSelect">False</Property>
<Property name="Location">348, 12</Property>
<Property name="Name">MoreData</Property>
<Property name="Size">530, 622</Property>
<Property name="TabIndex">7</Property>
<Property name="TabIndex">9</Property>
</Object>
<Object type="System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="GroupBox1" children="Controls">
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="DataExport" children="Controls">

Loading…
Cancel
Save