diff --git a/CleanMachineHMI/DataBase/clearMac.db b/CleanMachineHMI/DataBase/clearMac.db index a6fc025..5d32175 100644 Binary files a/CleanMachineHMI/DataBase/clearMac.db and b/CleanMachineHMI/DataBase/clearMac.db differ diff --git a/CleanMachineHMI/Utils/ByteTransformBase.cs b/CleanMachineHMI/Utils/ByteTransformBase.cs new file mode 100644 index 0000000..007858b --- /dev/null +++ b/CleanMachineHMI/Utils/ByteTransformBase.cs @@ -0,0 +1,536 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CleanMachineHMI.Utils +{ + public class ByteTransformBase + { + public DataFormat DataFormat + { + get; + set; + } + + public bool IsStringReverseByteWord + { + get; + set; + } + + // + // 摘要: + // 实例化一个默认的对象 + // Instantiate a default object + public ByteTransformBase() + { + DataFormat = DataFormat.DCBA; + } + + // + // 摘要: + // 使用指定的数据解析来实例化对象 + // Instantiate the object using the specified data parsing + // + // 参数: + // dataFormat: + // 数据规则 + public ByteTransformBase(DataFormat dataFormat) + { + DataFormat = dataFormat; + } + + public virtual bool TransBool(byte[] buffer, int index) + { + return (buffer[index] & 1) == 1; + } + + + + public virtual byte TransByte(byte[] buffer, int index) + { + return buffer[index]; + } + + public virtual byte[] TransByte(byte[] buffer, int index, int length) + { + byte[] array = new byte[length]; + Array.Copy(buffer, index, array, 0, length); + return array; + } + + public virtual short TransInt16(byte[] buffer, int index) + { + return BitConverter.ToInt16(buffer, index); + } + + public virtual short[] TransInt16(byte[] buffer, int index, int length) + { + short[] array = new short[length]; + for (int i = 0; i < length; i++) + { + array[i] = TransInt16(buffer, index + 2 * i); + } + + return array; + } + + + + public virtual ushort TransUInt16(byte[] buffer, int index) + { + return BitConverter.ToUInt16(buffer, index); + } + + public virtual ushort[] TransUInt16(byte[] buffer, int index, int length) + { + ushort[] array = new ushort[length]; + for (int i = 0; i < length; i++) + { + array[i] = TransUInt16(buffer, index + 2 * i); + } + + return array; + } + + + + public virtual int TransInt32(byte[] buffer, int index) + { + return BitConverter.ToInt32(ByteTransDataFormat4(buffer, index), 0); + } + + public virtual int[] TransInt32(byte[] buffer, int index, int length) + { + int[] array = new int[length]; + for (int i = 0; i < length; i++) + { + array[i] = TransInt32(buffer, index + 4 * i); + } + + return array; + } + + + + public virtual uint TransUInt32(byte[] buffer, int index) + { + return BitConverter.ToUInt32(ByteTransDataFormat4(buffer, index), 0); + } + + public virtual uint[] TransUInt32(byte[] buffer, int index, int length) + { + uint[] array = new uint[length]; + for (int i = 0; i < length; i++) + { + array[i] = TransUInt32(buffer, index + 4 * i); + } + + return array; + } + + + + public virtual long TransInt64(byte[] buffer, int index) + { + return BitConverter.ToInt64(ByteTransDataFormat8(buffer, index), 0); + } + + public virtual long[] TransInt64(byte[] buffer, int index, int length) + { + long[] array = new long[length]; + for (int i = 0; i < length; i++) + { + array[i] = TransInt64(buffer, index + 8 * i); + } + + return array; + } + + + + public virtual ulong TransUInt64(byte[] buffer, int index) + { + return BitConverter.ToUInt64(ByteTransDataFormat8(buffer, index), 0); + } + + public virtual ulong[] TransUInt64(byte[] buffer, int index, int length) + { + ulong[] array = new ulong[length]; + for (int i = 0; i < length; i++) + { + array[i] = TransUInt64(buffer, index + 8 * i); + } + + return array; + } + + + public virtual float TransSingle(byte[] buffer, int index) + { + return BitConverter.ToSingle(ByteTransDataFormat4(buffer, index), 0); + } + + public virtual float[] TransSingle(byte[] buffer, int index, int length) + { + float[] array = new float[length]; + for (int i = 0; i < length; i++) + { + array[i] = TransSingle(buffer, index + 4 * i); + } + + return array; + } + + + + public virtual double TransDouble(byte[] buffer, int index) + { + return BitConverter.ToDouble(ByteTransDataFormat8(buffer, index), 0); + } + + public virtual double[] TransDouble(byte[] buffer, int index, int length) + { + double[] array = new double[length]; + for (int i = 0; i < length; i++) + { + array[i] = TransDouble(buffer, index + 8 * i); + } + + return array; + } + + + + + + public virtual string TransString(byte[] buffer, Encoding encoding) + { + return encoding.GetString(buffer); + } + + + + + public virtual byte[] TransByte(byte value) + { + return new byte[1] + { + value + }; + } + + public virtual byte[] TransByte(short value) + { + return TransByte(new short[1] + { + value + }); + } + + public virtual byte[] TransByte(short[] values) + { + if (values == null) + { + return null; + } + + byte[] array = new byte[values.Length * 2]; + for (int i = 0; i < values.Length; i++) + { + BitConverter.GetBytes(values[i]).CopyTo(array, 2 * i); + } + + return array; + } + + public virtual byte[] TransByte(ushort value) + { + return TransByte(new ushort[1] + { + value + }); + } + + public virtual byte[] TransByte(ushort[] values) + { + if (values == null) + { + return null; + } + + byte[] array = new byte[values.Length * 2]; + for (int i = 0; i < values.Length; i++) + { + BitConverter.GetBytes(values[i]).CopyTo(array, 2 * i); + } + + return array; + } + + public virtual byte[] TransByte(int value) + { + return TransByte(new int[1] + { + value + }); + } + + public virtual byte[] TransByte(int[] values) + { + if (values == null) + { + return null; + } + + byte[] array = new byte[values.Length * 4]; + for (int i = 0; i < values.Length; i++) + { + ByteTransDataFormat4(BitConverter.GetBytes(values[i])).CopyTo(array, 4 * i); + } + + return array; + } + + public virtual byte[] TransByte(uint value) + { + return TransByte(new uint[1] + { + value + }); + } + + public virtual byte[] TransByte(uint[] values) + { + if (values == null) + { + return null; + } + + byte[] array = new byte[values.Length * 4]; + for (int i = 0; i < values.Length; i++) + { + ByteTransDataFormat4(BitConverter.GetBytes(values[i])).CopyTo(array, 4 * i); + } + + return array; + } + + public virtual byte[] TransByte(long value) + { + return TransByte(new long[1] + { + value + }); + } + + public virtual byte[] TransByte(long[] values) + { + if (values == null) + { + return null; + } + + byte[] array = new byte[values.Length * 8]; + for (int i = 0; i < values.Length; i++) + { + ByteTransDataFormat8(BitConverter.GetBytes(values[i])).CopyTo(array, 8 * i); + } + + return array; + } + + public virtual byte[] TransByte(ulong value) + { + return TransByte(new ulong[1] + { + value + }); + } + + public virtual byte[] TransByte(ulong[] values) + { + if (values == null) + { + return null; + } + + byte[] array = new byte[values.Length * 8]; + for (int i = 0; i < values.Length; i++) + { + ByteTransDataFormat8(BitConverter.GetBytes(values[i])).CopyTo(array, 8 * i); + } + + return array; + } + + public virtual byte[] TransByte(float value) + { + return TransByte(new float[1] + { + value + }); + } + + public virtual byte[] TransByte(float[] values) + { + if (values == null) + { + return null; + } + + byte[] array = new byte[values.Length * 4]; + for (int i = 0; i < values.Length; i++) + { + ByteTransDataFormat4(BitConverter.GetBytes(values[i])).CopyTo(array, 4 * i); + } + + return array; + } + + public virtual byte[] TransByte(double value) + { + return TransByte(new double[1] + { + value + }); + } + + public virtual byte[] TransByte(double[] values) + { + if (values == null) + { + return null; + } + + byte[] array = new byte[values.Length * 8]; + for (int i = 0; i < values.Length; i++) + { + ByteTransDataFormat8(BitConverter.GetBytes(values[i])).CopyTo(array, 8 * i); + } + + return array; + } + + + + // + // 摘要: + // 反转多字节的数据信息 + // + // 参数: + // value: + // 数据字节 + // + // index: + // 起始索引,默认值为0 + // + // 返回结果: + // 实际字节信息 + protected byte[] ByteTransDataFormat4(byte[] value, int index = 0) + { + byte[] array = new byte[4]; + switch (DataFormat) + { + case DataFormat.ABCD: + array[0] = value[index + 3]; + array[1] = value[index + 2]; + array[2] = value[index + 1]; + array[3] = value[index]; + break; + case DataFormat.BADC: + array[0] = value[index + 2]; + array[1] = value[index + 3]; + array[2] = value[index]; + array[3] = value[index + 1]; + break; + case DataFormat.CDAB: + array[0] = value[index + 1]; + array[1] = value[index]; + array[2] = value[index + 3]; + array[3] = value[index + 2]; + break; + case DataFormat.DCBA: + array[0] = value[index]; + array[1] = value[index + 1]; + array[2] = value[index + 2]; + array[3] = value[index + 3]; + break; + } + + return array; + } + + // + // 摘要: + // 反转多字节的数据信息 + // + // 参数: + // value: + // 数据字节 + // + // index: + // 起始索引,默认值为0 + // + // 返回结果: + // 实际字节信息 + protected byte[] ByteTransDataFormat8(byte[] value, int index = 0) + { + byte[] array = new byte[8]; + switch (DataFormat) + { + case DataFormat.ABCD: + array[0] = value[index + 7]; + array[1] = value[index + 6]; + array[2] = value[index + 5]; + array[3] = value[index + 4]; + array[4] = value[index + 3]; + array[5] = value[index + 2]; + array[6] = value[index + 1]; + array[7] = value[index]; + break; + case DataFormat.BADC: + array[0] = value[index + 6]; + array[1] = value[index + 7]; + array[2] = value[index + 4]; + array[3] = value[index + 5]; + array[4] = value[index + 2]; + array[5] = value[index + 3]; + array[6] = value[index]; + array[7] = value[index + 1]; + break; + case DataFormat.CDAB: + array[0] = value[index + 1]; + array[1] = value[index]; + array[2] = value[index + 3]; + array[3] = value[index + 2]; + array[4] = value[index + 5]; + array[5] = value[index + 4]; + array[6] = value[index + 7]; + array[7] = value[index + 6]; + break; + case DataFormat.DCBA: + array[0] = value[index]; + array[1] = value[index + 1]; + array[2] = value[index + 2]; + array[3] = value[index + 3]; + array[4] = value[index + 4]; + array[5] = value[index + 5]; + array[6] = value[index + 6]; + array[7] = value[index + 7]; + break; + } + + return array; + } + + + + public override string ToString() + { + return $"ByteTransformBase[{DataFormat}]"; + } + } +} diff --git a/CleanMachineHMI/Utils/DataFormat.cs b/CleanMachineHMI/Utils/DataFormat.cs new file mode 100644 index 0000000..6c5e9d7 --- /dev/null +++ b/CleanMachineHMI/Utils/DataFormat.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CleanMachineHMI.Utils +{ + public enum DataFormat + { + // + // 摘要: + // 按照顺序排序 + ABCD, + // + // 摘要: + // 按照单字反转 + BADC, + // + // 摘要: + // 按照双字反转 + CDAB, + // + // 摘要: + // 按照倒序排序 + DCBA + } +} diff --git a/CleanMachineHMI/Utils/PlcOperationHelper.cs b/CleanMachineHMI/Utils/PlcOperationHelper.cs index 91dfff9..6e4cbda 100644 --- a/CleanMachineHMI/Utils/PlcOperationHelper.cs +++ b/CleanMachineHMI/Utils/PlcOperationHelper.cs @@ -174,8 +174,8 @@ namespace CleanMachineHMI RefreshPlcItem_Y(ref haschange); stopWatch.Stop(); - - TimeSpan ts = stopWatch.Elapsed; + + TimeSpan ts = stopWatch.Elapsed; LogHelper.WriteLog($"读取PLC时间:{ts.Milliseconds}", LogTypeEum.Run); if (haschange) { @@ -189,7 +189,7 @@ namespace CleanMachineHMI // thEvent.Set(); // ShowWarningMsg(); int sleeptime = 100 - ts.Milliseconds; - if (sleeptime<0) + if (sleeptime < 0) { sleeptime = 0; } @@ -407,14 +407,16 @@ namespace CleanMachineHMI ////高位 short 的字节数组。 //byte[] tmpByt_2 = BitConverter.GetBytes(readBytArr_D[plcItemDeviationAddress + 1]); ////组合为int32的字节数组。 - //byte[] tmpByt_3 = new byte[] { tmpByt_1[0], tmpByt_1[1], tmpByt_2[0], tmpByt_2[1] }; + // byte[] tmpByt_3 = new byte[] { tmpByt_1[0], tmpByt_1[1], tmpByt_2[0], tmpByt_2[1] }; + + ////readBytArr_D[plcItemDeviationAddress + 1] << 16 + - //item.PlcItemValue = BitConverter.ToUInt32(tmpByt_3, 0).ToString(); + //value = BitConverter.ToInt32(tmpByt_3, 0).ToString(); #endregion #region 方法二 :Short数组转换为int数据 20201014 孙亚龙 //相较而言 使用位移的算法效率更高一些。 - value = ((readBytArr_D[plcItemDeviationAddress + 1] << 16) + readBytArr_D[plcItemDeviationAddress]).ToString(); + value = ((readBytArr_D[plcItemDeviationAddress + 1] << 16) + readBytArr_D[plcItemDeviationAddress]).ToString(); #endregion @@ -952,7 +954,16 @@ namespace CleanMachineHMI } else { - return short.Parse(item.PlcItemValue); + if (item.PlcItemDataLength == 2) + { + return int.Parse(item.PlcItemValue); + } + else + { + + + return short.Parse(item.PlcItemValue); + } } } @@ -1010,7 +1021,15 @@ namespace CleanMachineHMI } else { - retObj = short.Parse(item_D.PlcItemValue); + if (item_D.PlcItemDataLength == 2) + { + retObj = int.Parse(item_D.PlcItemValue); + } + else + { + retObj = short.Parse(item_D.PlcItemValue); + } + } break; case PlcItemTypeDesc.X: diff --git a/CleanMachineHMI/frmMainNew.cs b/CleanMachineHMI/frmMainNew.cs index cb585e1..b08405c 100644 --- a/CleanMachineHMI/frmMainNew.cs +++ b/CleanMachineHMI/frmMainNew.cs @@ -569,113 +569,123 @@ namespace CleanMachineHMI } } - string sqlParam = $@"SELECT * FROM SYS_PARAMETER"; - DataTable dtParam = LeadDbHelperSQLite.Query(sqlParam).Tables[0]; - if (dtParam != null && dtParam.Rows.Count > 0) + + int SysRunTime = (int)PlcOperationHelper.Instance.ReadPlcItem("SysRuningTime", PlcItemTypeDesc.D); + int Minutes = SysRunTime / 60; + BeginInvoke(new Action(() => { - int sysRuningTimeLen = Convert.ToInt32(dtParam.Select("PARAMETER_CODE = 'SysRuningTimeLen'")[0]["PARAMETER_VALUE"]); - int scrapRate = Convert.ToInt32(dtParam.Select("PARAMETER_CODE = 'ScrapRate'")[0]["PARAMETER_VALUE"]); - int maintainItemTime = Convert.ToInt32(dtParam.Select("PARAMETER_CODE = 'MaintainItemTime'")[0]["PARAMETER_VALUE"]); - int maintainAlarmTime = Convert.ToInt32(dtParam.Select("PARAMETER_CODE = 'MaintainAlarmTime'")[0]["PARAMETER_VALUE"]); - int maintainQuitTime = Convert.ToInt32(dtParam.Select("PARAMETER_CODE = 'MaintainQuitTime'")[0]["PARAMETER_VALUE"]); - int maintainFlag = Convert.ToInt32(dtParam.Select("PARAMETER_CODE = 'MaintainFlag'")[0]["PARAMETER_VALUE"]); - string maintainRelieveCode = dtParam.Select("PARAMETER_CODE = 'MaintainRelieveCode'")[0]["PARAMETER_VALUE"].ToString(); - if (maintainFlag == 0) - { - bool isRun = (bool)PlcOperationHelper.Instance.ReadPlcItem("CleanMacRunStatusNew", PlcItemTypeDesc.M); - if (isRun) - { + kryptonLabel1.Text = Minutes + " Minutes"; + })); - if (timerRunNUm == 60) - { - sysRuningTimeLen++; - if (sysRuningTimeLen < maintainItemTime) - { - //pictureBox1.Visible = false; - BeginInvoke(new Action(() => { pictureBox1.Visible = false; })); - } - else if (sysRuningTimeLen >= maintainItemTime && sysRuningTimeLen < maintainAlarmTime) - { - //pictureBox1.Visible = true; - BeginInvoke(new Action(() => { pictureBox1.Visible = true; })); - } - else if (sysRuningTimeLen >= maintainAlarmTime && sysRuningTimeLen < maintainQuitTime) - { - //BeginInvoke(new Action(() => - //{ - // pictureBox1.Visible = true; - // if (!sysAlarmFrmShowFlag) - // { - // sysAlarmFrmShowFlag = true; - // frmSysExitAlarm frm = new frmSysExitAlarm(); - // //frm.showMsg = "机器即将于" + (maintainQuitTime - sysRuningTimeLen) + "分钟后退出。"; - // frm.showMsg = $"The machine will exit in {(maintainQuitTime - sysRuningTimeLen)} minutes."; - // frm.TopLevel = true; - // frm.ShowDialog(); - // } - //})); - } - else if (sysRuningTimeLen >= maintainQuitTime) - { - //BeginInvoke(new Action(() => - //{ - // pictureBox1.Visible = true; - // string sql = "SELECT 1 FROM CM_WORKING_PALLET WHERE WORKING_STATUS = 0"; - // DataTable dt = LeadDbHelperSQLite.Query(sql).Tables[0]; - // if (dt != null && dt.Rows.Count > 0) - // { - // if (!sysAlarmFrmShowFlag) - // { - // sysAlarmFrmShowFlag = true; - // frmSysExitAlarm frm = new frmSysExitAlarm(); - // frm.showMsg = $"The machine maintenance time has exceeded: [{(maintainQuitTime - sysRuningTimeLen)}] minutes, please complete the current operation tray as soon as possible, and carry out equipment maintenance !!!!!!"; - // frm.TopLevel = true; - // frm.ShowDialog(); - // } - // } - // else - // { - // string sqlUpdateParam = $@"update SYS_PARAMETER set PARAMETER_VALUE = '1' WHERE PARAMETER_CODE = 'MaintainFlag'"; - // LeadDbHelperSQLite.ExecuteSql(sqlUpdateParam); - // PlcOperationHelper.Instance.WritePlcItem("StopSys", "True", PlcItemTypeDesc.M); - // PlcOperationHelper.Instance.WritePlcItem("StopSys", "False", PlcItemTypeDesc.M); - // PlcOperationHelper.Instance.WritePlcItem("ResetSys", "True", PlcItemTypeDesc.M); - // PlcOperationHelper.Instance.WritePlcItem("ResetSys", "False", PlcItemTypeDesc.M); - // Environment.Exit(0); - // } - //})); - } - string sqlUpdateRunTimeLen = $@"UPDATE SYS_PARAMETER set PARAMETER_VALUE = '{sysRuningTimeLen}' WHERE PARAMETER_CODE = 'SysRuningTimeLen'"; - LeadDbHelperSQLite.ExecuteSql(sqlUpdateRunTimeLen); - BeginInvoke(new Action(() => - { - kryptonLabel1.Text = sysRuningTimeLen + " Minutes"; - })); - timerRunNUm = 1; - } - else - { - timerRunNUm++; - BeginInvoke(new Action(() => - { - kryptonLabel1.Text = sysRuningTimeLen + " Minutes"; - })); - } - } + + //string sqlParam = $@"SELECT * FROM SYS_PARAMETER"; + //DataTable dtParam = LeadDbHelperSQLite.Query(sqlParam).Tables[0]; + //if (dtParam != null && dtParam.Rows.Count > 0) + //{ + // int sysRuningTimeLen = Convert.ToInt32(dtParam.Select("PARAMETER_CODE = 'SysRuningTimeLen'")[0]["PARAMETER_VALUE"]); + // int scrapRate = Convert.ToInt32(dtParam.Select("PARAMETER_CODE = 'ScrapRate'")[0]["PARAMETER_VALUE"]); + // int maintainItemTime = Convert.ToInt32(dtParam.Select("PARAMETER_CODE = 'MaintainItemTime'")[0]["PARAMETER_VALUE"]); + // int maintainAlarmTime = Convert.ToInt32(dtParam.Select("PARAMETER_CODE = 'MaintainAlarmTime'")[0]["PARAMETER_VALUE"]); + // int maintainQuitTime = Convert.ToInt32(dtParam.Select("PARAMETER_CODE = 'MaintainQuitTime'")[0]["PARAMETER_VALUE"]); + // int maintainFlag = Convert.ToInt32(dtParam.Select("PARAMETER_CODE = 'MaintainFlag'")[0]["PARAMETER_VALUE"]); + // string maintainRelieveCode = dtParam.Select("PARAMETER_CODE = 'MaintainRelieveCode'")[0]["PARAMETER_VALUE"].ToString(); + // if (maintainFlag == 0) + // { + // bool isRun = (bool)PlcOperationHelper.Instance.ReadPlcItem("CleanMacRunStatusNew", PlcItemTypeDesc.M); + + // if (isRun) + // { + + // if (timerRunNUm == 60) + // { + // sysRuningTimeLen++; + // if (sysRuningTimeLen < maintainItemTime) + // { + // //pictureBox1.Visible = false; + // BeginInvoke(new Action(() => { pictureBox1.Visible = false; })); + // } + // else if (sysRuningTimeLen >= maintainItemTime && sysRuningTimeLen < maintainAlarmTime) + // { + // //pictureBox1.Visible = true; + // BeginInvoke(new Action(() => { pictureBox1.Visible = true; })); + // } + // else if (sysRuningTimeLen >= maintainAlarmTime && sysRuningTimeLen < maintainQuitTime) + // { + // //BeginInvoke(new Action(() => + // //{ + // // pictureBox1.Visible = true; + // // if (!sysAlarmFrmShowFlag) + // // { + // // sysAlarmFrmShowFlag = true; + // // frmSysExitAlarm frm = new frmSysExitAlarm(); + // // //frm.showMsg = "机器即将于" + (maintainQuitTime - sysRuningTimeLen) + "分钟后退出。"; + // // frm.showMsg = $"The machine will exit in {(maintainQuitTime - sysRuningTimeLen)} minutes."; + // // frm.TopLevel = true; + // // frm.ShowDialog(); + // // } + // //})); + // } + // else if (sysRuningTimeLen >= maintainQuitTime) + // { + // //BeginInvoke(new Action(() => + // //{ + // // pictureBox1.Visible = true; + // // string sql = "SELECT 1 FROM CM_WORKING_PALLET WHERE WORKING_STATUS = 0"; + // // DataTable dt = LeadDbHelperSQLite.Query(sql).Tables[0]; + // // if (dt != null && dt.Rows.Count > 0) + // // { + // // if (!sysAlarmFrmShowFlag) + // // { + // // sysAlarmFrmShowFlag = true; + // // frmSysExitAlarm frm = new frmSysExitAlarm(); + // // frm.showMsg = $"The machine maintenance time has exceeded: [{(maintainQuitTime - sysRuningTimeLen)}] minutes, please complete the current operation tray as soon as possible, and carry out equipment maintenance !!!!!!"; + // // frm.TopLevel = true; + // // frm.ShowDialog(); + // // } + // // } + // // else + // // { + // // string sqlUpdateParam = $@"update SYS_PARAMETER set PARAMETER_VALUE = '1' WHERE PARAMETER_CODE = 'MaintainFlag'"; + // // LeadDbHelperSQLite.ExecuteSql(sqlUpdateParam); + // // PlcOperationHelper.Instance.WritePlcItem("StopSys", "True", PlcItemTypeDesc.M); + // // PlcOperationHelper.Instance.WritePlcItem("StopSys", "False", PlcItemTypeDesc.M); + // // PlcOperationHelper.Instance.WritePlcItem("ResetSys", "True", PlcItemTypeDesc.M); + // // PlcOperationHelper.Instance.WritePlcItem("ResetSys", "False", PlcItemTypeDesc.M); + // // Environment.Exit(0); + // // } + // //})); + // } + // string sqlUpdateRunTimeLen = $@"UPDATE SYS_PARAMETER set PARAMETER_VALUE = '{sysRuningTimeLen}' WHERE PARAMETER_CODE = 'SysRuningTimeLen'"; + // LeadDbHelperSQLite.ExecuteSql(sqlUpdateRunTimeLen); + // BeginInvoke(new Action(() => + // { + // kryptonLabel1.Text = sysRuningTimeLen + " Minutes"; + // })); + // timerRunNUm = 1; + // } + // else + // { + // timerRunNUm++; + // BeginInvoke(new Action(() => + // { + // kryptonLabel1.Text = sysRuningTimeLen + " Minutes"; + // })); + // } + // } - } - else - { - BeginInvoke(new Action(() => - { - pictureBox1.Visible = true; - })); - } - } + // } + // else + // { + // BeginInvoke(new Action(() => + // { + // pictureBox1.Visible = true; + // })); + // } + //} #region 定期清理历史业务数据 -- 数据保存2个月