更新一次

1114
nodyang@aliyun.com 4 days ago
parent eea74e8f8c
commit 5ba6fa3a80

@ -16,7 +16,7 @@ namespace DB.Service
/// </summary> /// </summary>
public class UpdateLogService public class UpdateLogService
{ {
public bool AddOrUpdateLog(UserDto user,string address,uint value) public bool AddOrUpdateLog(UserDto user,string address,int value)
{ {
UpdateLog log = new UpdateLog UpdateLog log = new UpdateLog
{ {

@ -88,6 +88,7 @@ namespace RfidWeb
} }
UserManager.Add(one); UserManager.Add(one);
var info= PlcConnect.Instance.Write(HmiPointInfo.Safety_level, int.Parse(one.RoleLevel.ToString()));
this.DialogResult = DialogResult.No; this.DialogResult = DialogResult.No;
this.Close(); this.Close();

@ -14,6 +14,7 @@ using RfidWeb.Frm;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Security.Policy;
using System.Windows.Forms; using System.Windows.Forms;
using Tool; using Tool;
@ -90,13 +91,12 @@ namespace RfidWeb
this.Invoke(() => this.Invoke(() =>
{ {
//不存在 //不存在
if (!isExit) if (!isExit)
{ {
labUser.ForeColor= System.Drawing.SystemColors.Window; labUser.ForeColor= System.Drawing.SystemColors.Window;
labUser.Text = "未登录(未授权)"; labUser.Text = "未登录(未授权)";
PlcConnect.Instance.Write(HmiPointInfo.Safety_level, int.Parse("0"));
} }
else else
{ {
@ -142,7 +142,7 @@ namespace RfidWeb
var strings = dic.Keys; var strings = dic.Keys;
foreach (var se in strings) foreach (var se in strings)
{ {
var res = plc.ReadUInt32(se); var res = plc.ReadInt32(se);
if (res.IsSuccess) if (res.IsSuccess)
{ {
string name = dic[se]; string name = dic[se];
@ -262,10 +262,15 @@ namespace RfidWeb
if (FrmDialog.ShowDialog(this, "退出登录", "提示窗体", true) if (FrmDialog.ShowDialog(this, "退出登录", "提示窗体", true)
== System.Windows.Forms.DialogResult.OK) == System.Windows.Forms.DialogResult.OK)
{ {
cache.Remove(CacheKeyManager.User); cache.Remove(CacheKeyManager.HmiUser);
PlcConnect.Instance.Write(HmiPointInfo.Safety_level, int.Parse("0"));
btnShow_Click(new object(), EventArgs.Empty); btnShow_Click(new object(), EventArgs.Empty);
} }
} }
else
{
CheckLogin();
}
} }
private void buttonUpdateLog_Click(object sender, EventArgs e) private void buttonUpdateLog_Click(object sender, EventArgs e)

@ -45,17 +45,17 @@ namespace RfidWeb.Frm
{ {
dicA.Clear(); dicA.Clear();
textBoxExFeedingMotorSpeed.Text=HmiPoint.GetFeedingMotorSpeed.ToString(); textBoxExFeedingMotorSpeed.Text=HmiPointInfo.GetFeedingMotorSpeed.ToString();
textBoxExLaminatedMotorSpeed.Text= HmiPoint.GetLaminatedMotorSpeed.ToString(); textBoxExLaminatedMotorSpeed.Text= HmiPointInfo.GetLaminatedMotorSpeed.ToString();
double result = HmiPoint.GetSWSS / 10.0; double result = HmiPointInfo.GetSWSS / 10.0;
textBoxExSWSD.Text = result.ToString(); textBoxExSWSD.Text = result.ToString();
textBoxExFelt.Text = HmiPoint.GetFeltBeltMotorSpeed.ToString(); textBoxExFelt.Text = HmiPointInfo.GetFeltBeltMotorSpeed.ToString();
textBoxReceiving.Text = HmiPoint.GeReceivingMotorSpeed.ToString(); textBoxReceiving.Text = HmiPointInfo.GeReceivingMotorSpeed.ToString();
dicA["A"] = textBoxExFeedingMotorSpeed.Text; dicA["A"] = textBoxExFeedingMotorSpeed.Text;
dicA["B"] = textBoxExLaminatedMotorSpeed.Text; dicA["B"] = textBoxExLaminatedMotorSpeed.Text;
dicA["C"] = HmiPoint.GetSWSS.ToString(); dicA["C"] = HmiPointInfo.GetSWSS.ToString();
dicA["D"] = textBoxExFelt.Text; dicA["D"] = textBoxExFelt.Text;
dicA["E"] = textBoxReceiving.Text; dicA["E"] = textBoxReceiving.Text;
@ -69,31 +69,31 @@ namespace RfidWeb.Frm
var a = textBoxExFeedingMotorSpeed.Text; var a = textBoxExFeedingMotorSpeed.Text;
if (a != dicA["A"]) if (a != dicA["A"])
{ {
plc.Write(HmiPoint.feeding_motor_speed, uint.Parse(a)); plc.Write(HmiPointInfo.feeding_motor_speed, int.Parse(a));
} }
var b = textBoxExLaminatedMotorSpeed.Text; var b = textBoxExLaminatedMotorSpeed.Text;
if (b != dicA["B"]) if (b != dicA["B"])
{ {
plc.Write(HmiPoint.Laminated_motor_speed, uint.Parse(b)); plc.Write(HmiPointInfo.Laminated_motor_speed, int.Parse(b));
} }
var c = UInt32.Parse((Convert.ToDouble(textBoxExSWSD.Text) * 10).ToString()).ToString(); var c = UInt32.Parse((Convert.ToDouble(textBoxExSWSD.Text) * 10).ToString()).ToString();
if (c != dicA["C"]) if (c != dicA["C"])
{ {
plc.Write(HmiPoint.SWSS, uint.Parse(c)); plc.Write(HmiPointInfo.SWSS, int.Parse(c));
} }
var d = textBoxExFelt.Text; var d = textBoxExFelt.Text;
if (d != dicA["D"]) if (d != dicA["D"])
{ {
plc.Write(HmiPoint.Felt_belt_motor_speed, uint.Parse(d)); plc.Write(HmiPointInfo.Felt_belt_motor_speed, int.Parse(d));
} }
var ee = textBoxExFelt.Text; var ee = textBoxExFelt.Text;
if (ee != dicA["E"]) if (ee != dicA["E"])
{ {
plc.Write(HmiPoint.Receiving_Electric_motor_speed, uint.Parse(ee)); plc.Write(HmiPointInfo.Receiving_Electric_motor_speed, int.Parse(ee));
} }
MessageBox.Show("保存成功"); MessageBox.Show("保存成功");
@ -105,172 +105,172 @@ namespace RfidWeb.Frm
{ {
dicB.Clear(); dicB.Clear();
txtCUTTING_SET_TEMPERATURE1_1.Text = HmiPoint.GetCUTTING_SET_TEMPERATURE1_1.ToString(); txtCUTTING_SET_TEMPERATURE1_1.Text = HmiPointInfo.GetCUTTING_SET_TEMPERATURE1_1.ToString();
dicB["CUTTING_SET_TEMPERATURE1_1"] = txtCUTTING_SET_TEMPERATURE1_1.Text; dicB["CUTTING_SET_TEMPERATURE1_1"] = txtCUTTING_SET_TEMPERATURE1_1.Text;
txtCUTTING_SET_TEMPERATURE1_2.Text = HmiPoint.GetCUTTING_SET_TEMPERATURE1_2.ToString(); txtCUTTING_SET_TEMPERATURE1_2.Text = HmiPointInfo.GetCUTTING_SET_TEMPERATURE1_2.ToString();
dicB["CUTTING_SET_TEMPERATURE1_2"] = txtCUTTING_SET_TEMPERATURE1_2.Text; dicB["CUTTING_SET_TEMPERATURE1_2"] = txtCUTTING_SET_TEMPERATURE1_2.Text;
txtCUTTING_SET_TEMPERATURE1_3.Text = HmiPoint.GetCUTTING_SET_TEMPERATURE1_3.ToString(); txtCUTTING_SET_TEMPERATURE1_3.Text = HmiPointInfo.GetCUTTING_SET_TEMPERATURE1_3.ToString();
dicB["CUTTING_SET_TEMPERATURE1_3"] = txtCUTTING_SET_TEMPERATURE1_3.Text; dicB["CUTTING_SET_TEMPERATURE1_3"] = txtCUTTING_SET_TEMPERATURE1_3.Text;
txtCUTTING_SET_TEMPERATURE1_4.Text = HmiPoint.GetCUTTING_SET_TEMPERATURE1_4.ToString(); txtCUTTING_SET_TEMPERATURE1_4.Text = HmiPointInfo.GetCUTTING_SET_TEMPERATURE1_4.ToString();
dicB["CUTTING_SET_TEMPERATURE1_4"] = txtCUTTING_SET_TEMPERATURE1_4.Text; dicB["CUTTING_SET_TEMPERATURE1_4"] = txtCUTTING_SET_TEMPERATURE1_4.Text;
txtCUTTING_SET_TEMPERATURE2_1.Text = HmiPoint.GetCUTTING_SET_TEMPERATURE2_1.ToString(); txtCUTTING_SET_TEMPERATURE2_1.Text = HmiPointInfo.GetCUTTING_SET_TEMPERATURE2_1.ToString();
dicB["CUTTING_SET_TEMPERATURE2_1"] = txtCUTTING_SET_TEMPERATURE2_1.Text; dicB["CUTTING_SET_TEMPERATURE2_1"] = txtCUTTING_SET_TEMPERATURE2_1.Text;
txtCUTTING_SET_TEMPERATURE2_2.Text = HmiPoint.GetCUTTING_SET_TEMPERATURE2_2.ToString(); txtCUTTING_SET_TEMPERATURE2_2.Text = HmiPointInfo.GetCUTTING_SET_TEMPERATURE2_2.ToString();
dicB["CUTTING_SET_TEMPERATURE2_2"] = txtCUTTING_SET_TEMPERATURE2_2.Text; dicB["CUTTING_SET_TEMPERATURE2_2"] = txtCUTTING_SET_TEMPERATURE2_2.Text;
txtCUTTING_SET_TEMPERATURE2_3.Text = HmiPoint.GetCUTTING_SET_TEMPERATURE2_3.ToString(); txtCUTTING_SET_TEMPERATURE2_3.Text = HmiPointInfo.GetCUTTING_SET_TEMPERATURE2_3.ToString();
dicB["CUTTING_SET_TEMPERATURE2_3"] = txtCUTTING_SET_TEMPERATURE2_3.Text; dicB["CUTTING_SET_TEMPERATURE2_3"] = txtCUTTING_SET_TEMPERATURE2_3.Text;
txtCUTTING_SET_TEMPERATURE2_4.Text = HmiPoint.GetCUTTING_SET_TEMPERATURE2_4.ToString(); txtCUTTING_SET_TEMPERATURE2_4.Text = HmiPointInfo.GetCUTTING_SET_TEMPERATURE2_4.ToString();
dicB["CUTTING_SET_TEMPERATURE2_4"] = txtCUTTING_SET_TEMPERATURE2_4.Text; dicB["CUTTING_SET_TEMPERATURE2_4"] = txtCUTTING_SET_TEMPERATURE2_4.Text;
txtCUTTING_SET_TIME1_1.Text = HmiPoint.GetCUTTING_SET_TIME1_1.ToString(); txtCUTTING_SET_TIME1_1.Text = HmiPointInfo.GetCUTTING_SET_TIME1_1.ToString();
dicB["CUTTING_SET_TIME1_1"] = txtCUTTING_SET_TIME1_1.Text; dicB["CUTTING_SET_TIME1_1"] = txtCUTTING_SET_TIME1_1.Text;
txtCUTTING_SET_TIME1_2.Text = HmiPoint.GetCUTTING_SET_TIME1_2.ToString(); txtCUTTING_SET_TIME1_2.Text = HmiPointInfo.GetCUTTING_SET_TIME1_2.ToString();
dicB["CUTTING_SET_TIME1_2"] = txtCUTTING_SET_TIME1_2.Text; dicB["CUTTING_SET_TIME1_2"] = txtCUTTING_SET_TIME1_2.Text;
txtCUTTING_SET_TIME1_3.Text = HmiPoint.GetCUTTING_SET_TIME1_3.ToString(); txtCUTTING_SET_TIME1_3.Text = HmiPointInfo.GetCUTTING_SET_TIME1_3.ToString();
dicB["CUTTING_SET_TIME1_3"] = txtCUTTING_SET_TIME1_3.Text; dicB["CUTTING_SET_TIME1_3"] = txtCUTTING_SET_TIME1_3.Text;
txtCUTTING_SET_TIME1_4.Text = HmiPoint.GetCUTTING_SET_TIME1_4.ToString(); txtCUTTING_SET_TIME1_4.Text = HmiPointInfo.GetCUTTING_SET_TIME1_4.ToString();
dicB["CUTTING_SET_TIME1_4"] = txtCUTTING_SET_TIME1_4.Text; dicB["CUTTING_SET_TIME1_4"] = txtCUTTING_SET_TIME1_4.Text;
txtCUTTING_SET_TIME2_1.Text = HmiPoint.GetCUTTING_SET_TIME2_1.ToString(); txtCUTTING_SET_TIME2_1.Text = HmiPointInfo.GetCUTTING_SET_TIME2_1.ToString();
dicB["CUTTING_SET_TIME2_1"] = txtCUTTING_SET_TIME2_1.Text; dicB["CUTTING_SET_TIME2_1"] = txtCUTTING_SET_TIME2_1.Text;
txtCUTTING_SET_TIME2_2.Text = HmiPoint.GetCUTTING_SET_TIME2_2.ToString(); txtCUTTING_SET_TIME2_2.Text = HmiPointInfo.GetCUTTING_SET_TIME2_2.ToString();
dicB["CUTTING_SET_TIME2_2"] = txtCUTTING_SET_TIME2_2.Text; dicB["CUTTING_SET_TIME2_2"] = txtCUTTING_SET_TIME2_2.Text;
txtCUTTING_SET_TIME2_3.Text = HmiPoint.GetCUTTING_SET_TIME2_3.ToString(); txtCUTTING_SET_TIME2_3.Text = HmiPointInfo.GetCUTTING_SET_TIME2_3.ToString();
dicB["CUTTING_SET_TIME2_3"] = txtCUTTING_SET_TIME2_3.Text; dicB["CUTTING_SET_TIME2_3"] = txtCUTTING_SET_TIME2_3.Text;
txtCUTTING_SET_TIME2_4.Text = HmiPoint.GetCUTTING_SET_TIME2_4.ToString(); txtCUTTING_SET_TIME2_4.Text = HmiPointInfo.GetCUTTING_SET_TIME2_4.ToString();
dicB["CUTTING_SET_TIME2_4"] = txtCUTTING_SET_TIME2_4.Text; dicB["CUTTING_SET_TIME2_4"] = txtCUTTING_SET_TIME2_4.Text;
} }
private void button7_Click(object sender, EventArgs e) private void button7_Click(object sender, EventArgs e)
{ {
var plc = PlcConnect.Instance; var plc = PlcConnect.Instance;
var CUTTING_SET_TEMPERATURE1_1= HmiPoint.GetCUTTING_SET_TEMPERATURE1_1.ToString(); var CUTTING_SET_TEMPERATURE1_1= HmiPointInfo.GetCUTTING_SET_TEMPERATURE1_1.ToString();
if (CUTTING_SET_TEMPERATURE1_1 != dicB["CUTTING_SET_TEMPERATURE1_1"]) if (CUTTING_SET_TEMPERATURE1_1 != dicB["CUTTING_SET_TEMPERATURE1_1"])
{ {
plc.Write(HmiPoint.CUTTING_SET_TEMPERATURE1_1, uint.Parse(CUTTING_SET_TEMPERATURE1_1)); plc.Write(HmiPointInfo.CUTTING_SET_TEMPERATURE1_1, int.Parse(CUTTING_SET_TEMPERATURE1_1));
} }
var CUTTING_SET_TEMPERATURE1_2 = HmiPoint.GetCUTTING_SET_TEMPERATURE1_2.ToString(); var CUTTING_SET_TEMPERATURE1_2 = HmiPointInfo.GetCUTTING_SET_TEMPERATURE1_2.ToString();
if (CUTTING_SET_TEMPERATURE1_2 != dicB["CUTTING_SET_TEMPERATURE1_2"]) if (CUTTING_SET_TEMPERATURE1_2 != dicB["CUTTING_SET_TEMPERATURE1_2"])
{ {
plc.Write(HmiPoint.CUTTING_SET_TEMPERATURE1_2, uint.Parse(CUTTING_SET_TEMPERATURE1_2)); plc.Write(HmiPointInfo.CUTTING_SET_TEMPERATURE1_2, int.Parse(CUTTING_SET_TEMPERATURE1_2));
} }
var CUTTING_SET_TEMPERATURE1_3 = HmiPoint.GetCUTTING_SET_TEMPERATURE1_3.ToString(); var CUTTING_SET_TEMPERATURE1_3 = HmiPointInfo.GetCUTTING_SET_TEMPERATURE1_3.ToString();
if (CUTTING_SET_TEMPERATURE1_3 != dicB["CUTTING_SET_TEMPERATURE1_3"]) if (CUTTING_SET_TEMPERATURE1_3 != dicB["CUTTING_SET_TEMPERATURE1_3"])
{ {
plc.Write(HmiPoint.CUTTING_SET_TEMPERATURE1_3, uint.Parse(CUTTING_SET_TEMPERATURE1_3)); plc.Write(HmiPointInfo.CUTTING_SET_TEMPERATURE1_3, int.Parse(CUTTING_SET_TEMPERATURE1_3));
} }
var CUTTING_SET_TEMPERATURE1_4 = HmiPoint.GetCUTTING_SET_TEMPERATURE1_4.ToString(); var CUTTING_SET_TEMPERATURE1_4 = HmiPointInfo.GetCUTTING_SET_TEMPERATURE1_4.ToString();
if (CUTTING_SET_TEMPERATURE1_4 != dicB["CUTTING_SET_TEMPERATURE1_4"]) if (CUTTING_SET_TEMPERATURE1_4 != dicB["CUTTING_SET_TEMPERATURE1_4"])
{ {
plc.Write(HmiPoint.CUTTING_SET_TEMPERATURE1_4, uint.Parse(CUTTING_SET_TEMPERATURE1_4)); plc.Write(HmiPointInfo.CUTTING_SET_TEMPERATURE1_4, int.Parse(CUTTING_SET_TEMPERATURE1_4));
} }
var CUTTING_SET_TEMPERATURE2_1 = HmiPoint.GetCUTTING_SET_TEMPERATURE2_1.ToString(); var CUTTING_SET_TEMPERATURE2_1 = HmiPointInfo.GetCUTTING_SET_TEMPERATURE2_1.ToString();
if (CUTTING_SET_TEMPERATURE2_1 != dicB["CUTTING_SET_TEMPERATURE2_1"]) if (CUTTING_SET_TEMPERATURE2_1 != dicB["CUTTING_SET_TEMPERATURE2_1"])
{ {
plc.Write(HmiPoint.CUTTING_SET_TEMPERATURE2_1, uint.Parse(CUTTING_SET_TEMPERATURE2_1)); plc.Write(HmiPointInfo.CUTTING_SET_TEMPERATURE2_1, int.Parse(CUTTING_SET_TEMPERATURE2_1));
} }
var CUTTING_SET_TEMPERATURE2_2 = HmiPoint.GetCUTTING_SET_TEMPERATURE2_2.ToString(); var CUTTING_SET_TEMPERATURE2_2 = HmiPointInfo.GetCUTTING_SET_TEMPERATURE2_2.ToString();
if (CUTTING_SET_TEMPERATURE2_2 != dicB["CUTTING_SET_TEMPERATURE2_2"]) if (CUTTING_SET_TEMPERATURE2_2 != dicB["CUTTING_SET_TEMPERATURE2_2"])
{ {
plc.Write(HmiPoint.CUTTING_SET_TEMPERATURE2_2, uint.Parse(CUTTING_SET_TEMPERATURE2_2)); plc.Write(HmiPointInfo.CUTTING_SET_TEMPERATURE2_2, int.Parse(CUTTING_SET_TEMPERATURE2_2));
} }
var CUTTING_SET_TEMPERATURE2_3 = HmiPoint.GetCUTTING_SET_TEMPERATURE2_3.ToString(); var CUTTING_SET_TEMPERATURE2_3 = HmiPointInfo.GetCUTTING_SET_TEMPERATURE2_3.ToString();
if (CUTTING_SET_TEMPERATURE2_3 != dicB["CUTTING_SET_TEMPERATURE2_3"]) if (CUTTING_SET_TEMPERATURE2_3 != dicB["CUTTING_SET_TEMPERATURE2_3"])
{ {
plc.Write(HmiPoint.CUTTING_SET_TEMPERATURE2_3, uint.Parse(CUTTING_SET_TEMPERATURE2_3)); plc.Write(HmiPointInfo.CUTTING_SET_TEMPERATURE2_3, int.Parse(CUTTING_SET_TEMPERATURE2_3));
} }
var CUTTING_SET_TEMPERATURE2_4 = HmiPoint.GetCUTTING_SET_TEMPERATURE2_4.ToString(); var CUTTING_SET_TEMPERATURE2_4 = HmiPointInfo.GetCUTTING_SET_TEMPERATURE2_4.ToString();
if (CUTTING_SET_TEMPERATURE2_4 != dicB["CUTTING_SET_TEMPERATURE2_4"]) if (CUTTING_SET_TEMPERATURE2_4 != dicB["CUTTING_SET_TEMPERATURE2_4"])
{ {
plc.Write(HmiPoint.CUTTING_SET_TEMPERATURE2_4, uint.Parse(CUTTING_SET_TEMPERATURE2_4)); plc.Write(HmiPointInfo.CUTTING_SET_TEMPERATURE2_4, int.Parse(CUTTING_SET_TEMPERATURE2_4));
} }
var CUTTING_SET_TIME1_1 = HmiPoint.GetCUTTING_SET_TIME1_1.ToString(); var CUTTING_SET_TIME1_1 = HmiPointInfo.GetCUTTING_SET_TIME1_1.ToString();
if (CUTTING_SET_TIME1_1 != dicB["CUTTING_SET_TIME1_1"]) if (CUTTING_SET_TIME1_1 != dicB["CUTTING_SET_TIME1_1"])
{ {
plc.Write(HmiPoint.CUTTING_SET_TIME1_1, uint.Parse(CUTTING_SET_TIME1_1)); plc.Write(HmiPointInfo.CUTTING_SET_TIME1_1, int.Parse(CUTTING_SET_TIME1_1));
} }
var CUTTING_SET_TIME1_2 = HmiPoint.GetCUTTING_SET_TIME1_2.ToString(); var CUTTING_SET_TIME1_2 = HmiPointInfo.GetCUTTING_SET_TIME1_2.ToString();
if (CUTTING_SET_TIME1_2 != dicB["CUTTING_SET_TIME1_2"]) if (CUTTING_SET_TIME1_2 != dicB["CUTTING_SET_TIME1_2"])
{ {
plc.Write(HmiPoint.CUTTING_SET_TIME1_2, uint.Parse(CUTTING_SET_TIME1_2)); plc.Write(HmiPointInfo.CUTTING_SET_TIME1_2, int.Parse(CUTTING_SET_TIME1_2));
} }
var CUTTING_SET_TIME1_3 = HmiPoint.GetCUTTING_SET_TIME1_3.ToString(); var CUTTING_SET_TIME1_3 = HmiPointInfo.GetCUTTING_SET_TIME1_3.ToString();
if (CUTTING_SET_TIME1_3 != dicB["CUTTING_SET_TIME1_3"]) if (CUTTING_SET_TIME1_3 != dicB["CUTTING_SET_TIME1_3"])
{ {
plc.Write(HmiPoint.CUTTING_SET_TIME1_3, uint.Parse(CUTTING_SET_TIME1_3)); plc.Write(HmiPointInfo.CUTTING_SET_TIME1_3, int.Parse(CUTTING_SET_TIME1_3));
} }
var CUTTING_SET_TIME1_4 = HmiPoint.GetCUTTING_SET_TIME1_4.ToString(); var CUTTING_SET_TIME1_4 = HmiPointInfo.GetCUTTING_SET_TIME1_4.ToString();
if (CUTTING_SET_TIME1_4 != dicB["CUTTING_SET_TIME1_4"]) if (CUTTING_SET_TIME1_4 != dicB["CUTTING_SET_TIME1_4"])
{ {
plc.Write(HmiPoint.CUTTING_SET_TIME1_4, uint.Parse(CUTTING_SET_TIME1_4)); plc.Write(HmiPointInfo.CUTTING_SET_TIME1_4, int.Parse(CUTTING_SET_TIME1_4));
} }
var CUTTING_SET_TIME2_1 = HmiPoint.GetCUTTING_SET_TIME2_1.ToString(); var CUTTING_SET_TIME2_1 = HmiPointInfo.GetCUTTING_SET_TIME2_1.ToString();
if (CUTTING_SET_TIME2_1 != dicB["CUTTING_SET_TIME2_1"]) if (CUTTING_SET_TIME2_1 != dicB["CUTTING_SET_TIME2_1"])
{ {
plc.Write(HmiPoint.CUTTING_SET_TIME2_1, uint.Parse(CUTTING_SET_TIME2_1)); plc.Write(HmiPointInfo.CUTTING_SET_TIME2_1, int.Parse(CUTTING_SET_TIME2_1));
} }
var CUTTING_SET_TIME2_2 = HmiPoint.GetCUTTING_SET_TIME2_2.ToString(); var CUTTING_SET_TIME2_2 = HmiPointInfo.GetCUTTING_SET_TIME2_2.ToString();
if (CUTTING_SET_TIME2_2 != dicB["CUTTING_SET_TIME2_2"]) if (CUTTING_SET_TIME2_2 != dicB["CUTTING_SET_TIME2_2"])
{ {
plc.Write(HmiPoint.CUTTING_SET_TIME2_2, uint.Parse(CUTTING_SET_TIME2_2)); plc.Write(HmiPointInfo.CUTTING_SET_TIME2_2, int.Parse(CUTTING_SET_TIME2_2));
} }
var CUTTING_SET_TIME2_3 = HmiPoint.GetCUTTING_SET_TIME2_3.ToString(); var CUTTING_SET_TIME2_3 = HmiPointInfo.GetCUTTING_SET_TIME2_3.ToString();
if (CUTTING_SET_TIME2_3 != dicB["CUTTING_SET_TIME2_3"]) if (CUTTING_SET_TIME2_3 != dicB["CUTTING_SET_TIME2_3"])
{ {
plc.Write(HmiPoint.CUTTING_SET_TIME2_3, uint.Parse(CUTTING_SET_TIME2_3)); plc.Write(HmiPointInfo.CUTTING_SET_TIME2_3, int.Parse(CUTTING_SET_TIME2_3));
} }
var CUTTING_SET_TIME2_4 = HmiPoint.GetCUTTING_SET_TIME2_4.ToString(); var CUTTING_SET_TIME2_4 = HmiPointInfo.GetCUTTING_SET_TIME2_4.ToString();
if (CUTTING_SET_TIME2_4 != dicB["CUTTING_SET_TIME2_4"]) if (CUTTING_SET_TIME2_4 != dicB["CUTTING_SET_TIME2_4"])
{ {
plc.Write(HmiPoint.CUTTING_SET_TIME2_4, uint.Parse(CUTTING_SET_TIME2_4)); plc.Write(HmiPointInfo.CUTTING_SET_TIME2_4, int.Parse(CUTTING_SET_TIME2_4));
} }
MessageBox.Show("保存成功"); MessageBox.Show("保存成功");

@ -11,6 +11,7 @@ using System.Windows.Forms;
using DB.Entity; using DB.Entity;
using DB.Service; using DB.Service;
using Tool; using Tool;
using Tool.Model;
namespace RfidWeb.Frm namespace RfidWeb.Frm
{ {
@ -44,12 +45,31 @@ namespace RfidWeb.Frm
this.Close(); this.Close();
} }
private void btnOK_BtnClick(object sender, EventArgs e) bool IsValidNumber(string input)
{ {
// 检查是否是纯数字
if (int.TryParse(input, out int number))
{
// 检查范围是否符合
return number > 0 && number < 2000;
}
return false;
}
fromPlan.Num = ucNo.InputText.ToInt(); private void btnOK_BtnClick(object sender, EventArgs e)
{
var code = ucNo.InputText.ToInt();
fromPlan.Num = code;
fromPlan.Code=ucCode.InputText.ToString(); fromPlan.Code=ucCode.InputText.ToString();
if (IsValidNumber(ucNo.InputText))
{
MessageBox.Show("请输入0-2000 有效范围");
return;
}
if (id == 0) if (id == 0)
{ {
@ -60,6 +80,8 @@ namespace RfidWeb.Frm
fromPlanService.Update(fromPlan); fromPlanService.Update(fromPlan);
} }
PlcConnect.Instance.Write(HmiPointInfo.Product_counter_CH, int.Parse(code.ToString()));
this.Close(); this.Close();
} }
} }

@ -49,7 +49,7 @@ namespace RfidWeb.Frm
stopwatc.Restart(); stopwatc.Restart();
this.Invoke(() => this.Invoke(() =>
{ {
btnStatus.Text = HmiPoint.GetStateText(); btnStatus.Text = HmiPointInfo.GetStateText();
}); });
FillAlarmGrid(); FillAlarmGrid();
FillPromptGrid(); FillPromptGrid();
@ -288,20 +288,20 @@ namespace RfidWeb.Frm
{ {
//HmiPoint //HmiPoint
hslLabelCombofeedingMotorSpeed.TextValue = HmiPoint.GetFeedingMotorSpeed.ToString(); hslLabelCombofeedingMotorSpeed.TextValue = HmiPointInfo.GetFeedingMotorSpeed.ToString();
hslLabelComboLaminated.TextValue = HmiPoint.GetLaminatedMotorSpeed.ToString(); hslLabelComboLaminated.TextValue = HmiPointInfo.GetLaminatedMotorSpeed.ToString();
hslLabelComboFelt.TextValue = HmiPoint.GetFeltBeltMotorSpeed.ToString(); hslLabelComboFelt.TextValue = HmiPointInfo.GetFeltBeltMotorSpeed.ToString();
hslLabelComboReceiving.TextValue = HmiPoint.GeReceivingMotorSpeed.ToString(); hslLabelComboReceiving.TextValue = HmiPointInfo.GeReceivingMotorSpeed.ToString();
hslLabelComboProduct_counter2.TextValue = HmiPoint.GetProduct_counter2.ToString(); hslLabelComboProduct_counter2.TextValue = HmiPointInfo.GetProduct_counter2.ToString();
hslLabelComboCQ_Chip1_counter.TextValue = HmiPoint.GetCQ_Chip1_counter.ToString(); hslLabelComboCQ_Chip1_counter.TextValue = HmiPointInfo.GetCQ_Chip1_counter.ToString();
hslLabelComboCQ_Chip2_counter.TextValue = HmiPoint.GetCQ_Chip2_counter.ToString(); hslLabelComboCQ_Chip2_counter.TextValue = HmiPointInfo.GetCQ_Chip2_counter.ToString();
hslLabelComboQDWD1SS.TextValue = HmiPoint.GetQDWD1SS.ToString(); hslLabelComboQDWD1SS.TextValue = HmiPointInfo.GetQDWD1SS.ToString();
hslLabelComboQDWD2SS.TextValue = HmiPoint.GetQDWD2SS.ToString(); hslLabelComboQDWD2SS.TextValue = HmiPointInfo.GetQDWD2SS.ToString();
double result = HmiPoint.GetSWSS / 10.0; double result = HmiPointInfo.GetSWSS / 10.0;
hslLabelComboSWSS.TextValue = result.ToString(); hslLabelComboSWSS.TextValue = result.ToString();

@ -15,12 +15,13 @@ namespace RfidWeb
/// </summary> /// </summary>
public static class UserManager public static class UserManager
{ {
private static string key => CacheKeyManager.User; private static string key => CacheKeyManager.HmiUser;
private static ICache cache = Cache.Default; private static ICache cache = Cache.Default;
public static void Add(UserDto dto) public static void Add(UserDto dto)
{ {
cache.Set(key, dto, TimeSpan.FromMinutes(5)); cache.Set(key, dto, TimeSpan.FromDays(2));
} }
public static UserDto GetUser() public static UserDto GetUser()
@ -37,7 +38,7 @@ namespace RfidWeb
{ {
if (IsExit()) if (IsExit())
{ {
cache.SetExpire(key, TimeSpan.FromMinutes(5)); cache.SetExpire(key, TimeSpan.FromDays(2));
} }
} }
} }

@ -58,7 +58,7 @@ namespace Tool.Model
{ {
PlcBoolModel BoolModel = new PlcBoolModel(); PlcBoolModel BoolModel = new PlcBoolModel();
var readUInt32 = PlcConnect.Instance.ReadUInt32(a); var readUInt32 = PlcConnect.Instance.ReadInt32(a);
var bo = readUInt32.IsSuccess; var bo = readUInt32.IsSuccess;
var context = readUInt32.Content; var context = readUInt32.Content;
if (bo) if (bo)
@ -72,7 +72,7 @@ namespace Tool.Model
} }
readUInt32 = PlcConnect.Instance.ReadUInt32(b); readUInt32 = PlcConnect.Instance.ReadInt32(b);
bo = readUInt32.IsSuccess; bo = readUInt32.IsSuccess;
context = readUInt32.Content; context = readUInt32.Content;
if (bo) if (bo)

@ -4,7 +4,7 @@
{ {
public static readonly string UpdateLog = "UpdateLog"; public static readonly string UpdateLog = "UpdateLog";
public static readonly string User = "HmiUser"; public static readonly string HmiUser = "HmiUser";
public static readonly string AesPwd = "nodyang"; public static readonly string AesPwd = "nodyang";

@ -10,7 +10,7 @@ namespace Tool.Model
public List<bool> GetDb() public List<bool> GetDb()
{ {
bool[] bitArray = new bool[32]; bool[] bitArray = new bool[32];
var readUInt32 = PlcConnect.Instance.ReadUInt32("estop_temporary_storage"); var readUInt32 = PlcConnect.Instance.ReadInt32("estop_temporary_storage");
var bo = readUInt32.IsSuccess; var bo = readUInt32.IsSuccess;
var context = readUInt32.Content; var context = readUInt32.Content;
if (bo) if (bo)

@ -8,14 +8,14 @@ using HslCommunication;
namespace Tool.Model namespace Tool.Model
{ {
public class HmiPoint public class HmiPointInfo
{ {
/// <summary> /// <summary>
/// DInt 供料电机速度 /// DInt 供料电机速度
/// </summary> /// </summary>
public static readonly string feeding_motor_speed = "feeding_motor_speed"; public static readonly string feeding_motor_speed = "feeding_motor_speed";
public static UInt32 GetFeedingMotorSpeed => GetValue(feeding_motor_speed); public static Int32 GetFeedingMotorSpeed => GetValue(feeding_motor_speed);
/// <summary> /// <summary>
@ -24,7 +24,7 @@ namespace Tool.Model
public static readonly string Laminated_motor_speed = "Laminated_motor_speed"; public static readonly string Laminated_motor_speed = "Laminated_motor_speed";
public static UInt32 GetLaminatedMotorSpeed => GetValue(Laminated_motor_speed); public static Int32 GetLaminatedMotorSpeed => GetValue(Laminated_motor_speed);
/// <summary> /// <summary>
@ -33,7 +33,7 @@ namespace Tool.Model
public static readonly string Felt_belt_motor_speed = "Felt_belt_motor_speed"; public static readonly string Felt_belt_motor_speed = "Felt_belt_motor_speed";
public static UInt32 GetFeltBeltMotorSpeed => GetValue(Felt_belt_motor_speed); public static Int32 GetFeltBeltMotorSpeed => GetValue(Felt_belt_motor_speed);
/// <summary> /// <summary>
@ -41,7 +41,7 @@ namespace Tool.Model
/// </summary> /// </summary>
public static readonly string Receiving_Electric_motor_speed = "Receiving_Electric_motor_speed"; public static readonly string Receiving_Electric_motor_speed = "Receiving_Electric_motor_speed";
public static UInt32 GeReceivingMotorSpeed => GetValue(Receiving_Electric_motor_speed); public static Int32 GeReceivingMotorSpeed => GetValue(Receiving_Electric_motor_speed);
/// <summary> /// <summary>
@ -49,20 +49,20 @@ namespace Tool.Model
/// </summary> /// </summary>
public static readonly string Product_counter2 = "Product_counter2"; public static readonly string Product_counter2 = "Product_counter2";
public static UInt32 GetProduct_counter2 => GetValue(Product_counter2); public static Int32 GetProduct_counter2 => GetValue(Product_counter2);
/// <summary> /// <summary>
/// 裁切1生产数量 /// 裁切1生产数量
/// </summary> /// </summary>
public static readonly string CQ_Chip1_counter = "CQ_Chip1_counter"; public static readonly string CQ_Chip1_counter = "CQ_Chip1_counter";
public static UInt32 GetCQ_Chip1_counter => GetValue(CQ_Chip1_counter); public static Int32 GetCQ_Chip1_counter => GetValue(CQ_Chip1_counter);
/// <summary> /// <summary>
/// 裁切2生产数量 /// 裁切2生产数量
/// </summary> /// </summary>
public static readonly string CQ_Chip2_counter = "CQ_Chip2_counter"; public static readonly string CQ_Chip2_counter = "CQ_Chip2_counter";
public static UInt32 GetCQ_Chip2_counter => GetValue(CQ_Chip2_counter); public static Int32 GetCQ_Chip2_counter => GetValue(CQ_Chip2_counter);
/// <summary> /// <summary>
@ -70,109 +70,121 @@ namespace Tool.Model
/// </summary> /// </summary>
public static readonly string QDWD1SS = "QDWD1SS"; public static readonly string QDWD1SS = "QDWD1SS";
public static UInt32 GetQDWD1SS => GetValue(QDWD1SS); public static Int32 GetQDWD1SS => GetValue(QDWD1SS);
/// <summary> /// <summary>
/// 裁刀1温度 /// 裁刀1温度
/// </summary> /// </summary>
public static readonly string QDWD2SS = "QDWD2SS"; public static readonly string QDWD2SS = "QDWD2SS";
public static UInt32 GetQDWD2SS => GetValue(QDWD2SS); public static Int32 GetQDWD2SS => GetValue(QDWD2SS);
/// <summary> /// <summary>
/// 设备内部温度 /// 设备内部温度
/// </summary> /// </summary>
public static readonly string SWSS = "SWSS"; public static readonly string SWSS = "SWSS";
public static UInt32 GetSWSS => GetValue(SWSS); public static Int32 GetSWSS => GetValue(SWSS);
private static UInt32 GetValue(string key) private static Int32 GetValue(string key)
{ {
var plc = PlcConnect.Instance; var plc = PlcConnect.Instance;
var result = plc.ReadUInt32(key); var result = plc.ReadInt32(key);
return result.IsSuccess ? result.Content : (uint)0; return result.IsSuccess ? result.Content : 0;
} }
public static readonly string CUTTING_SET_TEMPERATURE1_1 = "CUTTING_SET_TEMPERATURE1_1"; public static readonly string CUTTING_SET_TEMPERATURE1_1 = "CUTTING_SET_TEMPERATURE1_1";
public static UInt32 GetCUTTING_SET_TEMPERATURE1_1 => GetValue(CUTTING_SET_TEMPERATURE1_1); public static Int32 GetCUTTING_SET_TEMPERATURE1_1 => GetValue(CUTTING_SET_TEMPERATURE1_1);
public static readonly string CUTTING_SET_TEMPERATURE1_2 = "CUTTING_SET_TEMPERATURE1_2"; public static readonly string CUTTING_SET_TEMPERATURE1_2 = "CUTTING_SET_TEMPERATURE1_2";
public static UInt32 GetCUTTING_SET_TEMPERATURE1_2 => GetValue(CUTTING_SET_TEMPERATURE1_2); public static Int32 GetCUTTING_SET_TEMPERATURE1_2 => GetValue(CUTTING_SET_TEMPERATURE1_2);
public static readonly string CUTTING_SET_TEMPERATURE1_3 = "CUTTING_SET_TEMPERATURE1_3"; public static readonly string CUTTING_SET_TEMPERATURE1_3 = "CUTTING_SET_TEMPERATURE1_3";
public static UInt32 GetCUTTING_SET_TEMPERATURE1_3 => GetValue(CUTTING_SET_TEMPERATURE1_3); public static Int32 GetCUTTING_SET_TEMPERATURE1_3 => GetValue(CUTTING_SET_TEMPERATURE1_3);
public static readonly string CUTTING_SET_TEMPERATURE1_4 = "CUTTING_SET_TEMPERATURE1_4"; public static readonly string CUTTING_SET_TEMPERATURE1_4 = "CUTTING_SET_TEMPERATURE1_4";
public static UInt32 GetCUTTING_SET_TEMPERATURE1_4 => GetValue(CUTTING_SET_TEMPERATURE1_4); public static Int32 GetCUTTING_SET_TEMPERATURE1_4 => GetValue(CUTTING_SET_TEMPERATURE1_4);
public static readonly string CUTTING_SET_TEMPERATURE2_1 = "CUTTING_SET_TEMPERATURE2_1"; public static readonly string CUTTING_SET_TEMPERATURE2_1 = "CUTTING_SET_TEMPERATURE2_1";
public static UInt32 GetCUTTING_SET_TEMPERATURE2_1 => GetValue(CUTTING_SET_TEMPERATURE2_1); public static Int32 GetCUTTING_SET_TEMPERATURE2_1 => GetValue(CUTTING_SET_TEMPERATURE2_1);
public static readonly string CUTTING_SET_TEMPERATURE2_2 = "CUTTING_SET_TEMPERATURE2_2"; public static readonly string CUTTING_SET_TEMPERATURE2_2 = "CUTTING_SET_TEMPERATURE2_2";
public static UInt32 GetCUTTING_SET_TEMPERATURE2_2 => GetValue(CUTTING_SET_TEMPERATURE2_2); public static Int32 GetCUTTING_SET_TEMPERATURE2_2 => GetValue(CUTTING_SET_TEMPERATURE2_2);
public static readonly string CUTTING_SET_TEMPERATURE2_3 = "CUTTING_SET_TEMPERATURE2_3"; public static readonly string CUTTING_SET_TEMPERATURE2_3 = "CUTTING_SET_TEMPERATURE2_3";
public static UInt32 GetCUTTING_SET_TEMPERATURE2_3 => GetValue(CUTTING_SET_TEMPERATURE2_3); public static Int32 GetCUTTING_SET_TEMPERATURE2_3 => GetValue(CUTTING_SET_TEMPERATURE2_3);
public static readonly string CUTTING_SET_TEMPERATURE2_4 = "CUTTING_SET_TEMPERATURE2_4"; public static readonly string CUTTING_SET_TEMPERATURE2_4 = "CUTTING_SET_TEMPERATURE2_4";
public static UInt32 GetCUTTING_SET_TEMPERATURE2_4 => GetValue(CUTTING_SET_TEMPERATURE2_4); public static Int32 GetCUTTING_SET_TEMPERATURE2_4 => GetValue(CUTTING_SET_TEMPERATURE2_4);
public static readonly string CUTTING_SET_TIME1_1 = "CUTTING_SET_TIME1_1"; public static readonly string CUTTING_SET_TIME1_1 = "CUTTING_SET_TIME1_1";
public static UInt32 GetCUTTING_SET_TIME1_1 => GetValue(CUTTING_SET_TIME1_1); public static Int32 GetCUTTING_SET_TIME1_1 => GetValue(CUTTING_SET_TIME1_1);
public static readonly string CUTTING_SET_TIME1_2 = "CUTTING_SET_TIME1_2"; public static readonly string CUTTING_SET_TIME1_2 = "CUTTING_SET_TIME1_2";
public static UInt32 GetCUTTING_SET_TIME1_2 => GetValue(CUTTING_SET_TIME1_2); public static Int32 GetCUTTING_SET_TIME1_2 => GetValue(CUTTING_SET_TIME1_2);
public static readonly string CUTTING_SET_TIME1_3 = "CUTTING_SET_TIME1_3"; public static readonly string CUTTING_SET_TIME1_3 = "CUTTING_SET_TIME1_3";
public static UInt32 GetCUTTING_SET_TIME1_3 => GetValue(CUTTING_SET_TIME1_3); public static Int32 GetCUTTING_SET_TIME1_3 => GetValue(CUTTING_SET_TIME1_3);
public static readonly string CUTTING_SET_TIME1_4 = "CUTTING_SET_TIME1_4"; public static readonly string CUTTING_SET_TIME1_4 = "CUTTING_SET_TIME1_4";
public static UInt32 GetCUTTING_SET_TIME1_4 => GetValue(CUTTING_SET_TIME1_4); public static Int32 GetCUTTING_SET_TIME1_4 => GetValue(CUTTING_SET_TIME1_4);
public static readonly string CUTTING_SET_TIME2_1 = "CUTTING_SET_TIME2_1"; public static readonly string CUTTING_SET_TIME2_1 = "CUTTING_SET_TIME2_1";
public static UInt32 GetCUTTING_SET_TIME2_1 => GetValue(CUTTING_SET_TIME2_1); public static Int32 GetCUTTING_SET_TIME2_1 => GetValue(CUTTING_SET_TIME2_1);
public static readonly string CUTTING_SET_TIME2_2 = "CUTTING_SET_TIME2_2"; public static readonly string CUTTING_SET_TIME2_2 = "CUTTING_SET_TIME2_2";
public static UInt32 GetCUTTING_SET_TIME2_2 => GetValue(CUTTING_SET_TIME2_2); public static Int32 GetCUTTING_SET_TIME2_2 => GetValue(CUTTING_SET_TIME2_2);
public static readonly string CUTTING_SET_TIME2_3 = "CUTTING_SET_TIME2_3"; public static readonly string CUTTING_SET_TIME2_3 = "CUTTING_SET_TIME2_3";
public static UInt32 GetCUTTING_SET_TIME2_3 => GetValue(CUTTING_SET_TIME2_3); public static Int32 GetCUTTING_SET_TIME2_3 => GetValue(CUTTING_SET_TIME2_3);
public static readonly string CUTTING_SET_TIME2_4 = "CUTTING_SET_TIME2_4"; public static readonly string CUTTING_SET_TIME2_4 = "CUTTING_SET_TIME2_4";
public static UInt32 GetCUTTING_SET_TIME2_4 => GetValue(CUTTING_SET_TIME2_4); public static Int32 GetCUTTING_SET_TIME2_4 => GetValue(CUTTING_SET_TIME2_4);
/// <summary>
/// 计划的数量
/// </summary>
public static readonly string Product_counter_CH = "Product_counter_CH";
/// <summary>
/// 安全级别
/// </summary>
public static readonly string Safety_level = "Safety_level";
public static String GetStateText() public static String GetStateText()
{ {
string text = ""; string text = "";
var plc = PlcConnect.Instance; var plc = PlcConnect.Instance;
var result = plc.ReadUInt32("status_indicator"); var result = plc.ReadInt32("status_indicator");
if (result.IsSuccess) if (result.IsSuccess)
{ {
var context = result.Content; var context = result.Content;

@ -13,7 +13,7 @@ namespace Tool.Model
public List<bool> GetDb() public List<bool> GetDb()
{ {
bool[] bitArray = new bool[32]; bool[] bitArray = new bool[32];
var readUInt32 = PlcConnect.Instance.ReadUInt32("Prompt_alarm"); var readUInt32 = PlcConnect.Instance.ReadInt32("Prompt_alarm");
var bo = readUInt32.IsSuccess; var bo = readUInt32.IsSuccess;
var context = readUInt32.Content; var context = readUInt32.Content;
if (bo) if (bo)

Loading…
Cancel
Save