更改大部分页面,更改各个扫码逻辑
This commit is contained in:
1 parent
2bd24f5316
commit
1670395816
34 files changed
+2420
-1425
No files matched your search
@@ -87,12 +87,6 @@
|
||||
<Compile Include="form\editForm\Line_Insert.Designer.cs">
|
||||
<DependentUpon>Line_Insert.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="form\editForm\LinePLC_Insert.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="form\editForm\LinePLC_Insert.Designer.cs">
|
||||
<DependentUpon>LinePLC_Insert.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="form\editForm\MESUrl_Insert.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -153,12 +147,6 @@
|
||||
<Compile Include="form\editForm\FLow_Insert.Designer.cs">
|
||||
<DependentUpon>FLow_Insert.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="form\LinePLC_Manage.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="form\LinePLC_Manage.Designer.cs">
|
||||
<DependentUpon>LinePLC_Manage.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="form\Line_Manage.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -177,6 +165,18 @@
|
||||
<Compile Include="form\Angleaddress_Manage.Designer.cs">
|
||||
<DependentUpon>Angleaddress_Manage.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="form\ScanForm_DZ.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="form\ScanForm_DZ.Designer.cs">
|
||||
<DependentUpon>ScanForm_DZ.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="form\ScanForm_SSQ.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="form\ScanForm_SSQ.Designer.cs">
|
||||
<DependentUpon>ScanForm_SSQ.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="form\Torqueaddress_Manage.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -231,10 +231,10 @@
|
||||
<Compile Include="form\MESUrl.Designer.cs">
|
||||
<DependentUpon>MESUrl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="mod\database\t_pressurecurve.cs" />
|
||||
<Compile Include="mod\database\t_flow.cs" />
|
||||
<Compile Include="mod\database\t_interface.cs" />
|
||||
<Compile Include="mod\database\t_keyvalue.cs" />
|
||||
<Compile Include="mod\database\t_lineplc.cs" />
|
||||
<Compile Include="mod\database\t_line.cs" />
|
||||
<Compile Include="mod\database\t_angleaddress.cs" />
|
||||
<Compile Include="mod\database\t_torqueaddress.cs" />
|
||||
@@ -265,9 +265,6 @@
|
||||
<EmbeddedResource Include="form\editForm\Line_Insert.resx">
|
||||
<DependentUpon>Line_Insert.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="form\editForm\LinePLC_Insert.resx">
|
||||
<DependentUpon>LinePLC_Insert.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="form\editForm\MESUrl_Insert.resx">
|
||||
<DependentUpon>MESUrl_Insert.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@@ -298,9 +295,6 @@
|
||||
<EmbeddedResource Include="form\Flow_Manage.resx">
|
||||
<DependentUpon>Flow_Manage.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="form\LinePLC_Manage.resx">
|
||||
<DependentUpon>LinePLC_Manage.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="form\Line_Manage.resx">
|
||||
<DependentUpon>Line_Manage.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@@ -310,6 +304,12 @@
|
||||
<EmbeddedResource Include="form\Angleaddress_Manage.resx">
|
||||
<DependentUpon>Angleaddress_Manage.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="form\ScanForm_DZ.resx">
|
||||
<DependentUpon>ScanForm_DZ.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="form\ScanForm_SSQ.resx">
|
||||
<DependentUpon>ScanForm_SSQ.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="form\Torqueaddress_Manage.resx">
|
||||
<DependentUpon>Torqueaddress_Manage.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
Generated
+680
-331
File diff suppressed because it is too large.
Load diff
+190
-63
@@ -27,9 +27,6 @@ namespace WindowsFormsApp1
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
//private Thread thread_plc1;
|
||||
//private Thread thread_plc2;
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -44,10 +41,19 @@ namespace WindowsFormsApp1
|
||||
|
||||
FormRecover();
|
||||
|
||||
线别.Text = "线别:" + Init.t_Line.linename;
|
||||
段别.Text = "段别:" + Init.t_Line.linemode;
|
||||
机台编号.Text = "机台编号:" + Init.t_Line.linecode;
|
||||
操作人员ID.Text = "操作人员ID:" + Init.t_User.username;
|
||||
linename.Text = Init.t_Line.linename;
|
||||
linecode.Text = Init.t_Line.linecode;
|
||||
linetype.Text = Init.t_Line.linetype;
|
||||
linemode.Text = Init.t_Line.linemode;
|
||||
lineremark1.Text = Init.t_Line.lineremark1;
|
||||
lineremark2.Text = Init.t_Line.lineremark2;
|
||||
lineremark3.Text = Init.t_Line.lineremark3;
|
||||
lineremark4.Text = Init.t_Line.lineremark4;
|
||||
lineremark5.Text = Init.t_Line.lineremark5;
|
||||
lineremark6.Text = Init.t_Line.lineremark6;
|
||||
lineremark7.Text = Init.t_Line.lineremark7;
|
||||
|
||||
操作人员ID.Text = Init.t_User.username;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +68,7 @@ namespace WindowsFormsApp1
|
||||
break;
|
||||
}
|
||||
|
||||
ChangeBarcode();
|
||||
|
||||
if (Plc == null)
|
||||
{
|
||||
@@ -74,8 +81,9 @@ namespace WindowsFormsApp1
|
||||
var openresult = siemensHelp.OpenConn();
|
||||
if (!openresult.Success)
|
||||
{
|
||||
PLC链接状态.Text = "PLC链接状态:NG";
|
||||
PLC链接状态.BackColor = Color.Red;
|
||||
//PLC链接状态.Text = "PLC链接状态:NG";
|
||||
//PLC链接状态.BackColor = Color.Red;
|
||||
PLC_Form(Plc, plcstate.NG, DateTime.Now);
|
||||
LogExecute.logNet.WriteError($"{Plc.plcip}建立S7连接失败");
|
||||
continue;
|
||||
}
|
||||
@@ -83,15 +91,16 @@ namespace WindowsFormsApp1
|
||||
List<t_plcaddress> plcaddress = Init.t_Plcaddresses.FindAll(a => a.plcid == Plc.id);
|
||||
List<t_angleaddress> angleaddress = Init.t_Angleaddresses.FindAll(a => a.plcid == Plc.id);
|
||||
List<t_torqueaddress> torqueaddress = Init.t_Torqueaddresses.FindAll(a => a.plcid == Plc.id);
|
||||
|
||||
List<t_pressurecurve> pressurecurveaddress = Init.t_Pressurecurves.FindAll(a => a.plcid == Plc.id);
|
||||
|
||||
plcdata PlcData = new plcdata();
|
||||
|
||||
var resdresult = siemensHelp.ReadAddress(plcaddress, PlcData);
|
||||
if (!resdresult.Success)
|
||||
{
|
||||
PLC链接状态.Text = "PLC链接状态:NG";
|
||||
PLC链接状态.BackColor = Color.Red;
|
||||
//PLC链接状态.Text = "PLC链接状态:NG";
|
||||
//PLC链接状态.BackColor = Color.Red;
|
||||
PLC_Form(Plc, plcstate.NG, DateTime.Now);
|
||||
LogExecute.logNet.WriteError($"{Plc.plcip}读取全部地址处理错误:处理停止");
|
||||
continue;
|
||||
}
|
||||
@@ -101,17 +110,19 @@ namespace WindowsFormsApp1
|
||||
var haertresult = siemensHelp.WriteAddress(plcaddress, PlcData);
|
||||
if (!haertresult.Success)
|
||||
{
|
||||
PLC链接状态.Text = "PLC链接状态:NG";
|
||||
PLC链接状态.BackColor = Color.Red;
|
||||
//PLC链接状态.Text = "PLC链接状态:NG";
|
||||
//PLC链接状态.BackColor = Color.Red;
|
||||
PLC_Form(Plc, plcstate.NG, DateTime.Now);
|
||||
LogExecute.logNet.WriteError($"{Plc.plcip}写入心跳错误:处理停止");
|
||||
continue;
|
||||
}
|
||||
|
||||
DateTime Plc_Time = DateTime.Now;
|
||||
|
||||
PLC链接状态.Text = "PLC链接状态:OK";
|
||||
PLC链接状态.BackColor = SystemColors.Control;
|
||||
PLC通讯时间.Text = "PLC通讯时间:" + Plc_Time.ToString("MM-dd HH:mm:ss");
|
||||
//PLC链接状态.Text = "PLC链接状态:OK";
|
||||
//PLC链接状态.BackColor = SystemColors.Control;
|
||||
//PLC通讯时间.Text = "PLC通讯时间:" + Plc_Time.ToString("MM-dd HH:mm:ss");
|
||||
PLC_Form(Plc, plcstate.OK, Plc_Time);
|
||||
#endregion
|
||||
|
||||
ApiClient apiClient = new ApiClient();
|
||||
@@ -119,7 +130,7 @@ namespace WindowsFormsApp1
|
||||
|
||||
#region 机台状态及报警
|
||||
//机台状态
|
||||
机台状态.Text = "机台状态:" + Enum.GetName(typeof(plcstatus), Init.Plcstatus);
|
||||
//机台状态.Text = "机台状态:" + Enum.GetName(typeof(plcstatus), Init.Plcstatus);
|
||||
int oldstatus = Init.Plcstatus;
|
||||
if (PlcData.Read_Status != 0)
|
||||
{
|
||||
@@ -159,7 +170,7 @@ namespace WindowsFormsApp1
|
||||
//机台报警
|
||||
if (PlcData.Read_Status == (short)plcstatus.停机)
|
||||
{
|
||||
机台状态.BackColor = Color.Red;
|
||||
//机台状态.BackColor = Color.Red;
|
||||
if (oldstatus != (short)plcstatus.停机)
|
||||
{
|
||||
//反馈报警
|
||||
@@ -196,7 +207,7 @@ namespace WindowsFormsApp1
|
||||
}
|
||||
else
|
||||
{
|
||||
机台状态.BackColor = SystemColors.Control;
|
||||
//机台状态.BackColor = SystemColors.Control;
|
||||
}
|
||||
#endregion
|
||||
#region 判断及查找流程
|
||||
@@ -214,8 +225,9 @@ namespace WindowsFormsApp1
|
||||
var writeresult = siemensHelp.WriteAddress(plcaddress, PlcData);
|
||||
if (!writeresult.Success)
|
||||
{
|
||||
PLC链接状态.Text = "PLC链接状态:NG";
|
||||
PLC链接状态.BackColor = Color.Red;
|
||||
//PLC链接状态.Text = "PLC链接状态:NG";
|
||||
//PLC链接状态.BackColor = Color.Red;
|
||||
PLC_Form(Plc, plcstate.NG, DateTime.Now);
|
||||
LogExecute.logNet.WriteError($"{Plc.plcip}写入地址处理错误:处理停止");
|
||||
}
|
||||
continue;
|
||||
@@ -254,9 +266,36 @@ namespace WindowsFormsApp1
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (nowflow.dzscan)
|
||||
{
|
||||
//扫码
|
||||
ScanForm_DZ scanForm = new ScanForm_DZ();
|
||||
DialogResult scan_result = scanForm.ShowDialog();
|
||||
if (scan_result == DialogResult.OK)
|
||||
{
|
||||
string returnValue = scanForm.ReturnValue;
|
||||
otherdata.JS_SN = returnValue;
|
||||
|
||||
Init.ScanString = returnValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (nowflow.finalpressurecurve)
|
||||
{
|
||||
//压力曲线
|
||||
var pressurecurveaddress_result = siemensHelp.ReadAddress(pressurecurveaddress);
|
||||
if (!pressurecurveaddress_result.Success)
|
||||
{
|
||||
//PLC链接状态.Text = "PLC链接状态:NG";
|
||||
//PLC链接状态.BackColor = Color.Red;
|
||||
PLC_Form(Plc, plcstate.NG, DateTime.Now);
|
||||
LogExecute.logNet.WriteError($"{Plc.plcip}压力曲线数据地址处理错误:处理停止");
|
||||
continue;
|
||||
}
|
||||
otherdata.FinalPressureCurve = pressurecurveaddress_result.Data;
|
||||
}
|
||||
//if (nowflow.finaltorquecurve)
|
||||
//{
|
||||
@@ -268,8 +307,9 @@ namespace WindowsFormsApp1
|
||||
var finaltorquevalue_result = siemensHelp.ReadAddress(torqueaddress);
|
||||
if (!finaltorquevalue_result.Success)
|
||||
{
|
||||
PLC链接状态.Text = "PLC链接状态:NG";
|
||||
PLC链接状态.BackColor = Color.Red;
|
||||
//PLC链接状态.Text = "PLC链接状态:NG";
|
||||
//PLC链接状态.BackColor = Color.Red;
|
||||
PLC_Form(Plc, plcstate.NG, DateTime.Now);
|
||||
LogExecute.logNet.WriteError($"{Plc.plcip}螺丝枪扭力数据地址处理错误:处理停止");
|
||||
continue;
|
||||
}
|
||||
@@ -286,8 +326,9 @@ namespace WindowsFormsApp1
|
||||
var finalanglevaluue_result = siemensHelp.ReadAddress(angleaddress);
|
||||
if (!finalanglevaluue_result.Success)
|
||||
{
|
||||
PLC链接状态.Text = "PLC链接状态:NG";
|
||||
PLC链接状态.BackColor = Color.Red;
|
||||
//PLC链接状态.Text = "PLC链接状态:NG";
|
||||
//PLC链接状态.BackColor = Color.Red;
|
||||
PLC_Form(Plc, plcstate.NG, DateTime.Now);
|
||||
LogExecute.logNet.WriteError($"{Plc.plcip}螺丝枪角度数据地址处理错误:处理停止");
|
||||
continue;
|
||||
}
|
||||
@@ -301,13 +342,20 @@ namespace WindowsFormsApp1
|
||||
|
||||
#region 调用后端接口
|
||||
var result = apiClient.CallFunctionByName(nowinterface.code, PlcData, otherdata);
|
||||
if (result.IsShow)
|
||||
{
|
||||
MES提示信息.Visible = true;
|
||||
MES提示信息.Text = DateTime.Now.ToString("HH:mm:ss") + ":" + result.Msg;
|
||||
}
|
||||
|
||||
if (result.Success)
|
||||
{
|
||||
var writeresult = siemensHelp.WriteAddress(plcaddress, PlcData);
|
||||
if (!writeresult.Success)
|
||||
{
|
||||
PLC链接状态.Text = "PLC链接状态:NG";
|
||||
PLC链接状态.BackColor = Color.Red;
|
||||
//PLC链接状态.Text = "PLC链接状态:NG";
|
||||
//PLC链接状态.BackColor = Color.Red;
|
||||
PLC_Form(Plc, plcstate.NG, DateTime.Now);
|
||||
LogExecute.logNet.WriteError($"{Plc.plcip}写入地址处理错误:处理停止");
|
||||
continue;
|
||||
}
|
||||
@@ -347,20 +395,27 @@ namespace WindowsFormsApp1
|
||||
}
|
||||
|
||||
#region 开始及结束处理按钮
|
||||
|
||||
private void 开始处理_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (开始处理.Text == "开始处理")
|
||||
{
|
||||
|
||||
SQLiteHelper<t_plc> sQLiteHelper_plc = new db.SQLiteHelper<t_plc>();
|
||||
var plc_sqlresult = sQLiteHelper_plc.QueryAll();
|
||||
var plc_sqlresult = sQLiteHelper_plc.QuerySingle(a=>a.id == Init.t_Line.plcid);
|
||||
if (!plc_sqlresult.Success)
|
||||
{
|
||||
MessageBox.Show("无法初始化PLC信息,无法开始处理!");
|
||||
return;
|
||||
}
|
||||
var plc_result = plc_sqlresult.Data.FindAll(a => Init.t_Lineplcs.Select(p => p.plcid).Contains(a.id));
|
||||
|
||||
SQLiteHelper<t_keyvalue> sQLiteHelper_key = new db.SQLiteHelper<t_keyvalue>();
|
||||
var key_sqlresult = sQLiteHelper_key.QueryAll();
|
||||
if (!key_sqlresult.Success)
|
||||
{
|
||||
MessageBox.Show("无法初始化信息信息,无法开始处理!");
|
||||
return;
|
||||
}
|
||||
|
||||
SQLiteHelper<t_flow> sQLiteHelper_flow = new db.SQLiteHelper<t_flow>();
|
||||
var flow_result = sQLiteHelper_flow.Query(a => a.flowid == Init.t_Line.flowid);
|
||||
@@ -394,6 +449,14 @@ namespace WindowsFormsApp1
|
||||
return;
|
||||
}
|
||||
|
||||
SQLiteHelper<t_pressurecurve> sQLiteHelper_pressurecurve = new db.SQLiteHelper<t_pressurecurve>();
|
||||
var pressurecurve_result = sQLiteHelper_pressurecurve.QueryAll();
|
||||
if (!pressurecurve_result.Success)
|
||||
{
|
||||
MessageBox.Show("无法初始化压力曲线信息,无法开始处理!");
|
||||
return;
|
||||
}
|
||||
|
||||
SQLiteHelper<t_interface> sQLiteHelper_interface = new db.SQLiteHelper<t_interface>();
|
||||
var interface_result = sQLiteHelper_interface.QueryAll();
|
||||
if (!interface_result.Success)
|
||||
@@ -418,7 +481,9 @@ namespace WindowsFormsApp1
|
||||
Init.t_Plcaddresses = address_result.Data;
|
||||
Init.t_Angleaddresses = angleaddress_result.Data;
|
||||
Init.t_Torqueaddresses = torqueaddress_result.Data;
|
||||
Init.t_Pressurecurves = pressurecurve_result.Data;
|
||||
Init.t_Interfaces = interface_result.Data;
|
||||
Init.t_Keyvalues = key_sqlresult.Data;
|
||||
#endregion
|
||||
#region 初始化COM口服务
|
||||
try
|
||||
@@ -463,6 +528,8 @@ namespace WindowsFormsApp1
|
||||
底部注释2.Text = "气密仪COM-Ready";
|
||||
底部注释2.Visible = true;
|
||||
}
|
||||
|
||||
胶水上下线.Enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -474,19 +541,17 @@ namespace WindowsFormsApp1
|
||||
#endregion
|
||||
|
||||
Init.threadHelps = new List<ThreadHelp>();
|
||||
foreach (var plc in plc_result)
|
||||
var plc = plc_sqlresult.Data;
|
||||
plc.plchelp = new SiemensHelp(plc.plcip, plc.timeout);
|
||||
ThreadHelp threadHelp = new ThreadHelp();
|
||||
if (!threadHelp.isrunning1)
|
||||
{
|
||||
plc.plchelp = new SiemensHelp(plc.plcip, plc.timeout);
|
||||
ThreadHelp threadHelp = new ThreadHelp();
|
||||
if (!threadHelp.isrunning1)
|
||||
{
|
||||
threadHelp.cancellationTokenSource1 = new CancellationTokenSource();
|
||||
threadHelp.Thread = new Thread(() => build(plc, threadHelp.cancellationTokenSource1.Token));
|
||||
threadHelp.Thread.Start();
|
||||
threadHelp.isrunning1 = true;
|
||||
}
|
||||
Init.threadHelps.Add(threadHelp);
|
||||
threadHelp.cancellationTokenSource1 = new CancellationTokenSource();
|
||||
threadHelp.Thread = new Thread(() => build(plc, threadHelp.cancellationTokenSource1.Token));
|
||||
threadHelp.Thread.Start();
|
||||
threadHelp.isrunning1 = true;
|
||||
}
|
||||
Init.threadHelps.Add(threadHelp);
|
||||
|
||||
开始处理.Text = "停止处理";
|
||||
开始处理.BackColor = Color.Red;
|
||||
@@ -546,12 +611,6 @@ namespace WindowsFormsApp1
|
||||
lINE_Manage.ShowDialog();
|
||||
}
|
||||
|
||||
private void 产线关联PLC管理ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
LinePLC_Manage lINEPLC_Manage = new LinePLC_Manage();
|
||||
lINEPLC_Manage.ShowDialog();
|
||||
}
|
||||
|
||||
private void 系统参数配置ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
KeyValue keyValue = new KeyValue();
|
||||
@@ -656,16 +715,15 @@ namespace WindowsFormsApp1
|
||||
MES通讯时间.Text = "MES通讯时间:None";
|
||||
MES通讯时间.BackColor = SystemColors.Control;
|
||||
|
||||
PLC链接状态.Text = "PLC链接状态:None";
|
||||
PLC链接状态.BackColor = SystemColors.Control;
|
||||
PLC1名称.Visible = false;
|
||||
|
||||
PLC通讯时间.Text = "PLC通讯时间:None";
|
||||
PLC通讯时间.BackColor = SystemColors.Control;
|
||||
PLC1状态.Visible = false;
|
||||
|
||||
机台状态.Text = "机台状态:None";
|
||||
机台状态.BackColor = SystemColors.Control;
|
||||
PLC1机台状态.Visible = false;
|
||||
|
||||
胶水上下线.Enabled = false;
|
||||
PLC1时间.Visible = false;
|
||||
|
||||
//胶水上下线.Enabled = false;
|
||||
|
||||
MES提示信息.Visible = false;
|
||||
LOT号.Visible = false;
|
||||
@@ -693,6 +751,83 @@ namespace WindowsFormsApp1
|
||||
底部注释4.Visible = false;
|
||||
底部注释5.Visible = false;
|
||||
|
||||
剩余寿命.Visible = false;
|
||||
barcode1.Visible = false;
|
||||
barcode2.Visible = false;
|
||||
barcode3.Visible = false;
|
||||
barcode4.Visible = false;
|
||||
barcode5.Visible = false;
|
||||
barcode6.Visible = false;
|
||||
barcode7.Visible = false;
|
||||
barcode8.Visible = false;
|
||||
barcode9.Visible = false;
|
||||
|
||||
}
|
||||
|
||||
public void ChangeBarcode()
|
||||
{
|
||||
剩余寿命.Visible = true;
|
||||
barcode1.Visible = true;
|
||||
barcode2.Visible = true;
|
||||
barcode3.Visible = true;
|
||||
barcode4.Visible = true;
|
||||
barcode5.Visible = true;
|
||||
barcode6.Visible = true;
|
||||
barcode7.Visible = true;
|
||||
barcode8.Visible = true;
|
||||
barcode9.Visible = true;
|
||||
|
||||
var power = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Power");
|
||||
var i_barcode1 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode1");
|
||||
var i_barcode2 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode2");
|
||||
var i_barcode3 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode3");
|
||||
var i_barcode4 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode4");
|
||||
var i_barcode5 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode5");
|
||||
var i_barcode6 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode6");
|
||||
var i_barcode7 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode7");
|
||||
var i_barcode8 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode8");
|
||||
var i_barcode9 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode9");
|
||||
|
||||
剩余寿命.Text = power == null ? "": power.value;
|
||||
barcode1.Text = i_barcode1 == null ? "":i_barcode1.value;
|
||||
barcode2.Text = i_barcode2 == null ? "":i_barcode2.value;
|
||||
barcode3.Text = i_barcode3 == null ? "":i_barcode3.value;
|
||||
barcode4.Text = i_barcode4 == null ? "":i_barcode4.value;
|
||||
barcode5.Text = i_barcode5 == null ? "":i_barcode5.value;
|
||||
barcode6.Text = i_barcode6 == null ? "":i_barcode6.value;
|
||||
barcode7.Text = i_barcode7 == null ? "":i_barcode7.value;
|
||||
barcode8.Text = i_barcode8 == null ? "":i_barcode8.value;
|
||||
barcode9.Text = i_barcode9 == null ? "":i_barcode9.value;
|
||||
}
|
||||
|
||||
public void PLC_Form(t_plc plc, plcstate state, DateTime time)
|
||||
{
|
||||
string plcname = plc.plcname + ":" + plc.plcip;
|
||||
string datetime = time.ToString("HH:mm:ss");
|
||||
PLC1名称.Visible = true;
|
||||
PLC1状态.Visible = true;
|
||||
PLC1机台状态.Visible = true;
|
||||
PLC1时间.Visible = true;
|
||||
PLC1名称.Text = plcname;
|
||||
PLC1状态.Text = state.ToString();
|
||||
PLC1机台状态.Text = Enum.GetName(typeof(plcstatus), Init.Plcstatus);
|
||||
PLC1时间.Text = datetime;
|
||||
if (PLC1状态.Text == plcstate.NG.ToString())
|
||||
{
|
||||
PLC1状态.BackColor = Color.Red;
|
||||
}
|
||||
else
|
||||
{
|
||||
PLC1状态.BackColor = SystemColors.Control;
|
||||
}
|
||||
if (PLC1机台状态.Text == plcstatus.停机.ToString())
|
||||
{
|
||||
PLC1机台状态.BackColor = Color.Red;
|
||||
}
|
||||
else
|
||||
{
|
||||
PLC1机台状态.BackColor = SystemColors.Control;
|
||||
}
|
||||
}
|
||||
|
||||
public void MES_MsgfORM(string name, mesresult result, DateTime dateTime)
|
||||
@@ -808,14 +943,8 @@ namespace WindowsFormsApp1
|
||||
#region 其他业务处理
|
||||
private void 胶水上下线_Click(object sender, EventArgs e)
|
||||
{
|
||||
ScanForm scanForm = new ScanForm();
|
||||
ScanForm_SSQ scanForm = new ScanForm_SSQ();
|
||||
DialogResult result = scanForm.ShowDialog();
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
string returnValue = scanForm.ReturnValue;
|
||||
MessageBox.Show($"返回值是:{returnValue}");
|
||||
//调用三防漆之类的接口
|
||||
}
|
||||
}
|
||||
public void AirtightPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
||||
{
|
||||
@@ -896,8 +1025,6 @@ namespace WindowsFormsApp1
|
||||
LogExecute.logNet.WriteError($"通过气密仪获取到压力参数失败,错误原因{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
@@ -46,9 +46,11 @@ namespace WindowsFormsApp1
|
||||
|
||||
public static List<t_angleaddress> t_Angleaddresses;
|
||||
public static List<t_torqueaddress> t_Torqueaddresses;
|
||||
public static List<t_pressurecurve> t_Pressurecurves;
|
||||
|
||||
public static List<t_keyvalue> t_Keyvalues;
|
||||
|
||||
public static t_line t_Line;
|
||||
public static List<t_lineplc> t_Lineplcs;
|
||||
public static List<ThreadHelp> threadHelps;
|
||||
|
||||
public static string ScanString;
|
||||
|
||||
+44
-75
@@ -34,10 +34,6 @@
|
||||
this.关闭 = new System.Windows.Forms.Button();
|
||||
this.查询 = new System.Windows.Forms.Button();
|
||||
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.id = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.plcname = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.code = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
@@ -47,6 +43,8 @@
|
||||
this.addresstype = new System.Windows.Forms.DataGridViewComboBoxColumn();
|
||||
this.addresstypelegth = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.remark = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@@ -83,8 +81,8 @@
|
||||
this.dataGridView1.AllowUserToDeleteRows = false;
|
||||
dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.dataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
|
||||
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
|
||||
@@ -114,77 +112,16 @@
|
||||
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle3;
|
||||
this.dataGridView1.Location = new System.Drawing.Point(6, 127);
|
||||
this.dataGridView1.Location = new System.Drawing.Point(6, 5);
|
||||
this.dataGridView1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.dataGridView1.Name = "dataGridView1";
|
||||
this.dataGridView1.ReadOnly = true;
|
||||
this.dataGridView1.RowHeadersWidth = 72;
|
||||
this.tableLayoutPanel1.SetRowSpan(this.dataGridView1, 3);
|
||||
this.tableLayoutPanel1.SetRowSpan(this.dataGridView1, 4);
|
||||
this.dataGridView1.RowTemplate.Height = 23;
|
||||
this.dataGridView1.Size = new System.Drawing.Size(1624, 682);
|
||||
this.dataGridView1.Size = new System.Drawing.Size(1624, 804);
|
||||
this.dataGridView1.TabIndex = 8;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("宋体", 14.14286F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label1.Location = new System.Drawing.Point(4, 27);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(253, 68);
|
||||
this.label1.TabIndex = 12;
|
||||
this.label1.Text = "选择需要编辑的PLC编号:";
|
||||
//
|
||||
// comboBox1
|
||||
//
|
||||
this.comboBox1.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBox1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.comboBox1.FormattingEnabled = true;
|
||||
this.comboBox1.Location = new System.Drawing.Point(278, 40);
|
||||
this.comboBox1.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.comboBox1.Name = "comboBox1";
|
||||
this.comboBox1.Size = new System.Drawing.Size(409, 41);
|
||||
this.comboBox1.TabIndex = 13;
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 3;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15.07911F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 74.9177F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10.00319F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.button1, 2, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.comboBox1, 1, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.关闭, 2, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.查询, 2, 0);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 4;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 45F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(1818, 814);
|
||||
this.tableLayoutPanel1.TabIndex = 14;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button1.Location = new System.Drawing.Point(1650, 541);
|
||||
this.button1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(153, 56);
|
||||
this.button1.TabIndex = 15;
|
||||
this.button1.Text = "新增";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// id
|
||||
//
|
||||
this.id.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
@@ -270,7 +207,42 @@
|
||||
this.remark.Name = "remark";
|
||||
this.remark.ReadOnly = true;
|
||||
//
|
||||
// PlcAddress_Manage
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 3;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15.07911F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 74.9177F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10.00319F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.button1, 2, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.关闭, 2, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.查询, 2, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 0);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 4;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 45F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(1818, 814);
|
||||
this.tableLayoutPanel1.TabIndex = 14;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button1.Location = new System.Drawing.Point(1650, 541);
|
||||
this.button1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(153, 56);
|
||||
this.button1.TabIndex = 15;
|
||||
this.button1.Text = "新增";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// Angleaddress_Manage
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
@@ -278,14 +250,13 @@
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.Name = "PlcAddress_Manage";
|
||||
this.Name = "Angleaddress_Manage";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "PLCADDRESS_Manage";
|
||||
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||
this.Load += new System.EventHandler(this.PLCADDRESS_Manage_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@@ -295,8 +266,6 @@
|
||||
private System.Windows.Forms.Button 关闭;
|
||||
private System.Windows.Forms.Button 查询;
|
||||
private System.Windows.Forms.DataGridView dataGridView1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.ComboBox comboBox1;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn id;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace WindowsFormsApp1.form
|
||||
|
||||
private void 查询_Click(object sender, EventArgs e)
|
||||
{
|
||||
GetInfo((int)comboBox1.SelectedValue);
|
||||
GetInfo();
|
||||
}
|
||||
|
||||
private void 保存_Click(object sender, EventArgs e)
|
||||
@@ -33,7 +33,7 @@ namespace WindowsFormsApp1.form
|
||||
if (result.Success)
|
||||
{
|
||||
MessageBox.Show("更新成功");
|
||||
GetInfo((int)comboBox1.SelectedValue);
|
||||
GetInfo();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -62,13 +62,6 @@ namespace WindowsFormsApp1.form
|
||||
return;
|
||||
}
|
||||
|
||||
var list = result_combox.Data.FindAll(a => Init.t_Lineplcs.Select(p => p.plcid).Contains(a.id));
|
||||
|
||||
// 绑定数据源到 ComboBox
|
||||
comboBox1.DataSource = list;
|
||||
comboBox1.DisplayMember = "plcname";
|
||||
comboBox1.ValueMember = "id";
|
||||
|
||||
var result1 = new List<object>
|
||||
{
|
||||
new {name = "read",value = "read"},
|
||||
@@ -134,7 +127,7 @@ namespace WindowsFormsApp1.form
|
||||
fLOW_Insert.dataid = selectid;
|
||||
fLOW_Insert.Operation = OperationType.Edit;
|
||||
fLOW_Insert.ShowDialog();
|
||||
GetInfo((int)comboBox1.SelectedValue);
|
||||
GetInfo();
|
||||
|
||||
}
|
||||
else if (e.ColumnIndex == 10)
|
||||
@@ -153,12 +146,12 @@ namespace WindowsFormsApp1.form
|
||||
{
|
||||
MessageBox.Show("删除失败");
|
||||
}
|
||||
GetInfo((int)comboBox1.SelectedValue);
|
||||
GetInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void GetInfo(int plcid)
|
||||
public void GetInfo()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -166,7 +159,7 @@ namespace WindowsFormsApp1.form
|
||||
SQLiteHelper<t_angleaddress> sQLiteHelper = new db.SQLiteHelper<t_angleaddress>();
|
||||
SQLiteHelper<t_plc> sQLiteHelper1 = new db.SQLiteHelper<t_plc>();
|
||||
var result_plc = sQLiteHelper1.QueryAll();
|
||||
var result = sQLiteHelper.Query(a=>a.plcid == plcid);
|
||||
var result = sQLiteHelper.Query(a=>a.plcid == Init.t_Line.plcid);
|
||||
if (result.Success)
|
||||
{
|
||||
List<object> list = new List<object>();
|
||||
@@ -203,7 +196,7 @@ namespace WindowsFormsApp1.form
|
||||
{
|
||||
Angleaddress_Insert fLOW_Insert = new Angleaddress_Insert();
|
||||
fLOW_Insert.ShowDialog();
|
||||
GetInfo((int)comboBox1.SelectedValue);
|
||||
GetInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
-37
@@ -34,14 +34,18 @@
|
||||
this.关闭 = new System.Windows.Forms.Button();
|
||||
this.查询 = new System.Windows.Forms.Button();
|
||||
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.新增 = new System.Windows.Forms.Button();
|
||||
this.id = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.linename = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.linecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.linetype = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.linemode = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.lineremark1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.lineremark2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.lineremark3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.flowname = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.新增 = new System.Windows.Forms.Button();
|
||||
this.plcname = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@@ -96,7 +100,11 @@
|
||||
this.linecode,
|
||||
this.linetype,
|
||||
this.linemode,
|
||||
this.flowname});
|
||||
this.lineremark1,
|
||||
this.lineremark2,
|
||||
this.lineremark3,
|
||||
this.flowname,
|
||||
this.plcname});
|
||||
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window;
|
||||
dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
@@ -115,6 +123,40 @@
|
||||
this.dataGridView1.Size = new System.Drawing.Size(1584, 819);
|
||||
this.dataGridView1.TabIndex = 7;
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 2;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 90F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.关闭, 1, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.查询, 1, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.新增, 1, 2);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 4;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 40F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(1774, 829);
|
||||
this.tableLayoutPanel1.TabIndex = 11;
|
||||
//
|
||||
// 新增
|
||||
//
|
||||
this.新增.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.新增.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.新增.Location = new System.Drawing.Point(1604, 542);
|
||||
this.新增.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.新增.Name = "新增";
|
||||
this.新增.Size = new System.Drawing.Size(162, 72);
|
||||
this.新增.TabIndex = 11;
|
||||
this.新增.Text = "新增";
|
||||
this.新增.UseVisualStyleBackColor = true;
|
||||
this.新增.Click += new System.EventHandler(this.新增_Click);
|
||||
//
|
||||
// id
|
||||
//
|
||||
this.id.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
@@ -160,6 +202,39 @@
|
||||
this.linemode.Name = "linemode";
|
||||
this.linemode.ReadOnly = true;
|
||||
//
|
||||
// lineremark1
|
||||
//
|
||||
this.lineremark1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.lineremark1.DataPropertyName = "lineremark1";
|
||||
this.lineremark1.HeaderText = "备用显示1";
|
||||
this.lineremark1.MinimumWidth = 9;
|
||||
this.lineremark1.Name = "lineremark1";
|
||||
this.lineremark1.ReadOnly = true;
|
||||
this.lineremark1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
this.lineremark1.ToolTipText = "lineremark1";
|
||||
//
|
||||
// lineremark2
|
||||
//
|
||||
this.lineremark2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.lineremark2.DataPropertyName = "lineremark2";
|
||||
this.lineremark2.HeaderText = "备用显示2";
|
||||
this.lineremark2.MinimumWidth = 9;
|
||||
this.lineremark2.Name = "lineremark2";
|
||||
this.lineremark2.ReadOnly = true;
|
||||
this.lineremark2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
this.lineremark2.ToolTipText = "lineremark2";
|
||||
//
|
||||
// lineremark3
|
||||
//
|
||||
this.lineremark3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.lineremark3.DataPropertyName = "lineremark3";
|
||||
this.lineremark3.HeaderText = "备用显示3";
|
||||
this.lineremark3.MinimumWidth = 9;
|
||||
this.lineremark3.Name = "lineremark3";
|
||||
this.lineremark3.ReadOnly = true;
|
||||
this.lineremark3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
this.lineremark3.ToolTipText = "lineremark3";
|
||||
//
|
||||
// flowname
|
||||
//
|
||||
this.flowname.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
@@ -172,41 +247,18 @@
|
||||
this.flowname.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
this.flowname.ToolTipText = "flowname";
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
// plcname
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 2;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 90F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.关闭, 1, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.查询, 1, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.新增, 1, 2);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 4;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 40F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(1774, 829);
|
||||
this.tableLayoutPanel1.TabIndex = 11;
|
||||
this.plcname.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.plcname.DataPropertyName = "plcname";
|
||||
this.plcname.HeaderText = "关联PLC";
|
||||
this.plcname.MinimumWidth = 9;
|
||||
this.plcname.Name = "plcname";
|
||||
this.plcname.ReadOnly = true;
|
||||
this.plcname.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
this.plcname.ToolTipText = "plcname";
|
||||
//
|
||||
// 新增
|
||||
//
|
||||
this.新增.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.新增.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.新增.Location = new System.Drawing.Point(1604, 542);
|
||||
this.新增.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.新增.Name = "新增";
|
||||
this.新增.Size = new System.Drawing.Size(162, 72);
|
||||
this.新增.TabIndex = 11;
|
||||
this.新增.Text = "新增";
|
||||
this.新增.UseVisualStyleBackColor = true;
|
||||
this.新增.Click += new System.EventHandler(this.新增_Click);
|
||||
//
|
||||
// LINE_Manage
|
||||
// Line_Manage
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
@@ -214,7 +266,7 @@
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.Name = "LINE_Manage";
|
||||
this.Name = "Line_Manage";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "LINE_Mange";
|
||||
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||
@@ -237,6 +289,10 @@
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn linecode;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn linetype;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn linemode;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn lineremark1;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn lineremark2;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn lineremark3;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn flowname;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn plcname;
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ namespace WindowsFormsApp1.form
|
||||
DataGridViewRow row = dataGridView.Rows[e.RowIndex];
|
||||
|
||||
int selectid = int.Parse(row.Cells[0].Value.ToString());
|
||||
if (e.ColumnIndex == 6)
|
||||
if (e.ColumnIndex == 10)
|
||||
{
|
||||
Line_Insert fLOW_Insert = new Line_Insert();
|
||||
fLOW_Insert.dataid = selectid;
|
||||
@@ -72,9 +72,11 @@ namespace WindowsFormsApp1.form
|
||||
{
|
||||
SQLiteHelper<t_line> sQLiteHelper = new db.SQLiteHelper<t_line>();
|
||||
SQLiteHelper<t_flow> sQLiteHelper1 = new db.SQLiteHelper<t_flow>();
|
||||
var result_flow = sQLiteHelper1.QueryAll();
|
||||
SQLiteHelper<t_plc> sQLiteHelper2 = new db.SQLiteHelper<t_plc>();
|
||||
var result_flow = sQLiteHelper1.Query(a=>a.flowid == Init.t_Line.flowid);
|
||||
var result_line = sQLiteHelper.Query(a=>a.id == Init.t_Line.id);
|
||||
if (!result_line.Success || !result_flow.Success)
|
||||
var result_plc = sQLiteHelper2.Query(a=>a.id == Init.t_Line.plcid);
|
||||
if (!result_line.Success || !result_flow.Success || !result_plc.Success)
|
||||
{
|
||||
MessageBox.Show("查询失败!");
|
||||
return;
|
||||
@@ -85,6 +87,7 @@ namespace WindowsFormsApp1.form
|
||||
foreach (var line in result_line.Data)
|
||||
{
|
||||
var flowname = result_flow.Data.FirstOrDefault(a=>a.flowid == line.flowid);
|
||||
var plcname = result_plc.Data.FirstOrDefault(a=>a.id == line.plcid);
|
||||
list.Add( new
|
||||
{
|
||||
id = line.id,
|
||||
@@ -94,6 +97,10 @@ namespace WindowsFormsApp1.form
|
||||
linetype = line.linetype,
|
||||
linemode = line.linemode,
|
||||
flowname = flowname.flowname,
|
||||
plcname = plcname.plcname,
|
||||
lineremark1 = line.lineremark1,
|
||||
lineremark2 = line.lineremark2,
|
||||
lineremark3 = line.lineremark3,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,19 @@
|
||||
<metadata name="linemode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="lineremark1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="lineremark2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="lineremark3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="flowname.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="plcname.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
||||
-206
@@ -1,206 +0,0 @@
|
||||
namespace WindowsFormsApp1.form
|
||||
{
|
||||
partial class LinePLC_Manage
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.关闭 = new System.Windows.Forms.Button();
|
||||
this.查询 = new System.Windows.Forms.Button();
|
||||
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||
this.id = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.linename = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.flowname = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.新增 = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// 关闭
|
||||
//
|
||||
this.关闭.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.关闭.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.关闭.Location = new System.Drawing.Point(1604, 709);
|
||||
this.关闭.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.关闭.Name = "关闭";
|
||||
this.关闭.Size = new System.Drawing.Size(162, 72);
|
||||
this.关闭.TabIndex = 10;
|
||||
this.关闭.Text = "关闭";
|
||||
this.关闭.UseVisualStyleBackColor = true;
|
||||
this.关闭.Click += new System.EventHandler(this.关闭_Click);
|
||||
//
|
||||
// 查询
|
||||
//
|
||||
this.查询.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.查询.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.查询.Location = new System.Drawing.Point(1604, 46);
|
||||
this.查询.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.查询.Name = "查询";
|
||||
this.查询.Size = new System.Drawing.Size(162, 72);
|
||||
this.查询.TabIndex = 8;
|
||||
this.查询.Text = "查询";
|
||||
this.查询.UseVisualStyleBackColor = true;
|
||||
this.查询.Click += new System.EventHandler(this.查询_Click);
|
||||
//
|
||||
// dataGridView1
|
||||
//
|
||||
this.dataGridView1.AllowUserToAddRows = false;
|
||||
this.dataGridView1.AllowUserToDeleteRows = false;
|
||||
dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.dataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
|
||||
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
|
||||
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.id,
|
||||
this.linename,
|
||||
this.flowname});
|
||||
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window;
|
||||
dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle3;
|
||||
this.dataGridView1.Location = new System.Drawing.Point(6, 5);
|
||||
this.dataGridView1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.dataGridView1.Name = "dataGridView1";
|
||||
this.dataGridView1.ReadOnly = true;
|
||||
this.dataGridView1.RowHeadersWidth = 72;
|
||||
this.tableLayoutPanel1.SetRowSpan(this.dataGridView1, 4);
|
||||
this.dataGridView1.RowTemplate.Height = 23;
|
||||
this.dataGridView1.Size = new System.Drawing.Size(1584, 819);
|
||||
this.dataGridView1.TabIndex = 7;
|
||||
//
|
||||
// id
|
||||
//
|
||||
this.id.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.id.DataPropertyName = "id";
|
||||
this.id.HeaderText = "序号";
|
||||
this.id.MinimumWidth = 9;
|
||||
this.id.Name = "id";
|
||||
this.id.ReadOnly = true;
|
||||
//
|
||||
// linename
|
||||
//
|
||||
this.linename.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.linename.DataPropertyName = "linename";
|
||||
this.linename.HeaderText = "产线名称";
|
||||
this.linename.MinimumWidth = 9;
|
||||
this.linename.Name = "linename";
|
||||
this.linename.ReadOnly = true;
|
||||
//
|
||||
// flowname
|
||||
//
|
||||
this.flowname.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.flowname.DataPropertyName = "plcname";
|
||||
this.flowname.HeaderText = "关联PLC";
|
||||
this.flowname.MinimumWidth = 9;
|
||||
this.flowname.Name = "flowname";
|
||||
this.flowname.ReadOnly = true;
|
||||
this.flowname.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.flowname.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
this.flowname.ToolTipText = "plcname";
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 2;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 90F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.关闭, 1, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.查询, 1, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.新增, 1, 2);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 4;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 40F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(1774, 829);
|
||||
this.tableLayoutPanel1.TabIndex = 11;
|
||||
//
|
||||
// 新增
|
||||
//
|
||||
this.新增.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.新增.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.新增.Location = new System.Drawing.Point(1604, 542);
|
||||
this.新增.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.新增.Name = "新增";
|
||||
this.新增.Size = new System.Drawing.Size(162, 72);
|
||||
this.新增.TabIndex = 11;
|
||||
this.新增.Text = "新增";
|
||||
this.新增.UseVisualStyleBackColor = true;
|
||||
this.新增.Click += new System.EventHandler(this.新增_Click);
|
||||
//
|
||||
// LINEPLC_Manage
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1774, 829);
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.Name = "LINEPLC_Manage";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "LINE_Mange";
|
||||
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||
this.Load += new System.EventHandler(this.LINE_Manage_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button 关闭;
|
||||
private System.Windows.Forms.Button 查询;
|
||||
private System.Windows.Forms.DataGridView dataGridView1;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.Button 新增;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn id;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn linename;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn flowname;
|
||||
}
|
||||
}
|
||||
@@ -1,148 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using WindowsFormsApp1.db;
|
||||
using WindowsFormsApp1.mod;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace WindowsFormsApp1.form
|
||||
{
|
||||
public partial class LinePLC_Manage : Form
|
||||
{
|
||||
public LinePLC_Manage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void 查询_Click(object sender, EventArgs e)
|
||||
{
|
||||
GetInfo();
|
||||
}
|
||||
|
||||
private void 关闭_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void LINE_Manage_Load(object sender, EventArgs e)
|
||||
{
|
||||
dataGridView1.AutoGenerateColumns = false;
|
||||
|
||||
// 添加修改按钮列
|
||||
DataGridViewButtonColumn modifyColumn = new DataGridViewButtonColumn();
|
||||
modifyColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
modifyColumn.Name = "ModifyColumn";
|
||||
modifyColumn.HeaderText = "修改";
|
||||
modifyColumn.Text = "修改";
|
||||
modifyColumn.UseColumnTextForButtonValue = true;
|
||||
dataGridView1.Columns.Add(modifyColumn);
|
||||
|
||||
// 添加删除按钮列
|
||||
DataGridViewButtonColumn deleteColumn = new DataGridViewButtonColumn();
|
||||
deleteColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
deleteColumn.Name = "DeleteColumn";
|
||||
deleteColumn.HeaderText = "删除";
|
||||
deleteColumn.Text = "删除";
|
||||
deleteColumn.UseColumnTextForButtonValue = true;
|
||||
dataGridView1.Columns.Add(deleteColumn);
|
||||
|
||||
dataGridView1.CellContentClick += DataGridView1_CellContentClick;
|
||||
GetInfo();
|
||||
}
|
||||
private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
// 检查点击的是否为按钮列
|
||||
if (e.RowIndex >= 0)
|
||||
{
|
||||
DataGridView dataGridView = (DataGridView)sender;
|
||||
DataGridViewRow row = dataGridView.Rows[e.RowIndex];
|
||||
|
||||
int selectid = int.Parse(row.Cells[0].Value.ToString());
|
||||
if (e.ColumnIndex == 3)
|
||||
{
|
||||
LinePLC_Insert fLOW_Insert = new LinePLC_Insert();
|
||||
fLOW_Insert.dataid = selectid;
|
||||
fLOW_Insert.Operation = OperationType.Edit;
|
||||
fLOW_Insert.ShowDialog();
|
||||
GetInfo();
|
||||
|
||||
}
|
||||
else if (e.ColumnIndex == 4)
|
||||
{
|
||||
DialogResult result = MessageBox.Show("你确定要删除数据吗?", "确认提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
||||
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
SQLiteHelper<t_lineplc> sQLiteHelper = new db.SQLiteHelper<t_lineplc>();
|
||||
var delresult = sQLiteHelper.Delete(selectid);
|
||||
if (delresult.Success)
|
||||
{
|
||||
MessageBox.Show("删除成功");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("删除失败");
|
||||
}
|
||||
GetInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void GetInfo()
|
||||
{
|
||||
try
|
||||
{
|
||||
SQLiteHelper<t_plc> sQLiteHelper = new db.SQLiteHelper<t_plc>();
|
||||
SQLiteHelper<t_line> sQLiteHelper1 = new db.SQLiteHelper<t_line>();
|
||||
SQLiteHelper<t_lineplc> sQLiteHelper2 = new db.SQLiteHelper<t_lineplc>();
|
||||
var result_plc = sQLiteHelper.QueryAll();
|
||||
var result_line = sQLiteHelper1.QueryAll();
|
||||
var result_lineplc = sQLiteHelper2.QueryAll();
|
||||
|
||||
|
||||
if (!result_line.Success || !result_plc.Success || !result_lineplc.Success)
|
||||
{
|
||||
MessageBox.Show("查询失败!");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
List<object> list = new List<object>();
|
||||
foreach (var line in result_lineplc.Data)
|
||||
{
|
||||
var linename = result_line.Data.FirstOrDefault(a=>a.id == line.lineid);
|
||||
var plcname = result_plc.Data.FirstOrDefault(a => a.id == line.plcid);
|
||||
list.Add( new
|
||||
{
|
||||
id = line.id,
|
||||
lineid = line.lineid,
|
||||
plcid = line.plcid,
|
||||
linename = linename.linename,
|
||||
plcname = plcname.plcname,
|
||||
});
|
||||
}
|
||||
|
||||
dataGridView1.DataSource = null;
|
||||
dataGridView1.DataSource = list;
|
||||
dataGridView1.Refresh();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void 新增_Click(object sender, EventArgs e)
|
||||
{
|
||||
LinePLC_Insert fLOW_Insert = new LinePLC_Insert();
|
||||
fLOW_Insert.ShowDialog();
|
||||
GetInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,17 +42,8 @@ namespace WindowsFormsApp1
|
||||
}
|
||||
else
|
||||
{
|
||||
SQLiteHelper<t_lineplc> sQLiteHelper_lineplc = new db.SQLiteHelper<t_lineplc>();
|
||||
var lineplc_result = sQLiteHelper_lineplc.Query(a => a.lineid == result_combox.Data.id);
|
||||
if (!lineplc_result.Success)
|
||||
{
|
||||
MessageBox.Show("无法初始化PLC-产线关联信息!");
|
||||
return;
|
||||
}
|
||||
|
||||
Init.t_User = result.Data;
|
||||
Init.t_Line = result_combox.Data;
|
||||
Init.t_Lineplcs = lineplc_result.Data;
|
||||
DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
+40
-71
@@ -34,10 +34,6 @@
|
||||
this.关闭 = new System.Windows.Forms.Button();
|
||||
this.查询 = new System.Windows.Forms.Button();
|
||||
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.id = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.plcname = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.code = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
@@ -47,6 +43,8 @@
|
||||
this.addresstype = new System.Windows.Forms.DataGridViewComboBoxColumn();
|
||||
this.addresstypelegth = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.remark = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@@ -114,77 +112,16 @@
|
||||
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle3;
|
||||
this.dataGridView1.Location = new System.Drawing.Point(6, 127);
|
||||
this.dataGridView1.Location = new System.Drawing.Point(6, 5);
|
||||
this.dataGridView1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.dataGridView1.Name = "dataGridView1";
|
||||
this.dataGridView1.ReadOnly = true;
|
||||
this.dataGridView1.RowHeadersWidth = 72;
|
||||
this.tableLayoutPanel1.SetRowSpan(this.dataGridView1, 3);
|
||||
this.tableLayoutPanel1.SetRowSpan(this.dataGridView1, 4);
|
||||
this.dataGridView1.RowTemplate.Height = 23;
|
||||
this.dataGridView1.Size = new System.Drawing.Size(1624, 682);
|
||||
this.dataGridView1.Size = new System.Drawing.Size(1624, 804);
|
||||
this.dataGridView1.TabIndex = 8;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("宋体", 14.14286F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label1.Location = new System.Drawing.Point(4, 27);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(253, 68);
|
||||
this.label1.TabIndex = 12;
|
||||
this.label1.Text = "选择需要编辑的PLC编号:";
|
||||
//
|
||||
// comboBox1
|
||||
//
|
||||
this.comboBox1.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBox1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.comboBox1.FormattingEnabled = true;
|
||||
this.comboBox1.Location = new System.Drawing.Point(278, 40);
|
||||
this.comboBox1.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.comboBox1.Name = "comboBox1";
|
||||
this.comboBox1.Size = new System.Drawing.Size(409, 41);
|
||||
this.comboBox1.TabIndex = 13;
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 3;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15.07911F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 74.9177F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10.00319F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.button1, 2, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.comboBox1, 1, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.关闭, 2, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.查询, 2, 0);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 4;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 45F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(1818, 814);
|
||||
this.tableLayoutPanel1.TabIndex = 14;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button1.Location = new System.Drawing.Point(1650, 541);
|
||||
this.button1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(153, 56);
|
||||
this.button1.TabIndex = 15;
|
||||
this.button1.Text = "新增";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// id
|
||||
//
|
||||
this.id.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
@@ -270,6 +207,41 @@
|
||||
this.remark.Name = "remark";
|
||||
this.remark.ReadOnly = true;
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 3;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15.07911F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 74.9177F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10.00319F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.button1, 2, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.关闭, 2, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.查询, 2, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 0);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 4;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 45F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(1818, 814);
|
||||
this.tableLayoutPanel1.TabIndex = 14;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button1.Location = new System.Drawing.Point(1650, 541);
|
||||
this.button1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(153, 56);
|
||||
this.button1.TabIndex = 15;
|
||||
this.button1.Text = "新增";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// PlcAddress_Manage
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
|
||||
@@ -285,7 +257,6 @@
|
||||
this.Load += new System.EventHandler(this.PLCADDRESS_Manage_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@@ -295,8 +266,6 @@
|
||||
private System.Windows.Forms.Button 关闭;
|
||||
private System.Windows.Forms.Button 查询;
|
||||
private System.Windows.Forms.DataGridView dataGridView1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.ComboBox comboBox1;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn id;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace WindowsFormsApp1.form
|
||||
|
||||
private void 查询_Click(object sender, EventArgs e)
|
||||
{
|
||||
GetInfo((int)comboBox1.SelectedValue);
|
||||
GetInfo();
|
||||
}
|
||||
|
||||
private void 保存_Click(object sender, EventArgs e)
|
||||
@@ -33,7 +33,7 @@ namespace WindowsFormsApp1.form
|
||||
if (result.Success)
|
||||
{
|
||||
MessageBox.Show("更新成功");
|
||||
GetInfo((int)comboBox1.SelectedValue);
|
||||
GetInfo();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -62,13 +62,6 @@ namespace WindowsFormsApp1.form
|
||||
return;
|
||||
}
|
||||
|
||||
var list = result_combox.Data.FindAll(a => Init.t_Lineplcs.Select(p => p.plcid).Contains(a.id));
|
||||
|
||||
// 绑定数据源到 ComboBox
|
||||
comboBox1.DataSource = list;
|
||||
comboBox1.DisplayMember = "plcname";
|
||||
comboBox1.ValueMember = "id";
|
||||
|
||||
var result1 = new List<object>
|
||||
{
|
||||
new {name = "read",value = "read"},
|
||||
@@ -134,7 +127,7 @@ namespace WindowsFormsApp1.form
|
||||
fLOW_Insert.dataid = selectid;
|
||||
fLOW_Insert.Operation = OperationType.Edit;
|
||||
fLOW_Insert.ShowDialog();
|
||||
GetInfo((int)comboBox1.SelectedValue);
|
||||
GetInfo();
|
||||
|
||||
}
|
||||
else if (e.ColumnIndex == 10)
|
||||
@@ -153,12 +146,12 @@ namespace WindowsFormsApp1.form
|
||||
{
|
||||
MessageBox.Show("删除失败");
|
||||
}
|
||||
GetInfo((int)comboBox1.SelectedValue);
|
||||
GetInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void GetInfo(int plcid)
|
||||
public void GetInfo()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -166,7 +159,7 @@ namespace WindowsFormsApp1.form
|
||||
SQLiteHelper<t_plcaddress> sQLiteHelper = new db.SQLiteHelper<t_plcaddress>();
|
||||
SQLiteHelper<t_plc> sQLiteHelper1 = new db.SQLiteHelper<t_plc>();
|
||||
var result_plc = sQLiteHelper1.QueryAll();
|
||||
var result = sQLiteHelper.Query(a=>a.plcid == plcid);
|
||||
var result = sQLiteHelper.Query(a=>a.plcid == Init.t_Line.plcid);
|
||||
if (result.Success)
|
||||
{
|
||||
List<object> list = new List<object>();
|
||||
@@ -203,7 +196,7 @@ namespace WindowsFormsApp1.form
|
||||
{
|
||||
PlcAddress_Insert fLOW_Insert = new PlcAddress_Insert();
|
||||
fLOW_Insert.ShowDialog();
|
||||
GetInfo((int)comboBox1.SelectedValue);
|
||||
GetInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -118,13 +118,11 @@ namespace WindowsFormsApp1.form
|
||||
try
|
||||
{
|
||||
SQLiteHelper<t_plc> sQLiteHelper = new db.SQLiteHelper<t_plc>();
|
||||
var result = sQLiteHelper.QueryAll();
|
||||
var result = sQLiteHelper.Query(a=>a.id == Init.t_Line.plcid);
|
||||
if (result.Success)
|
||||
{
|
||||
var list = result.Data.FindAll(a=>Init.t_Lineplcs.Select(p=>p.plcid).Contains(a.id));
|
||||
|
||||
dataGridView1.DataSource = null;
|
||||
dataGridView1.DataSource = list;
|
||||
dataGridView1.DataSource = result.Data;
|
||||
dataGridView1.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
+382
@@ -0,0 +1,382 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using WindowsFormsApp1.server;
|
||||
|
||||
namespace WindowsFormsApp1
|
||||
{
|
||||
partial class ScanForm_DZ
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.button3 = new System.Windows.Forms.Button();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.确认 = new System.Windows.Forms.Button();
|
||||
this.取消 = new System.Windows.Forms.Button();
|
||||
this.端子2结果 = new System.Windows.Forms.Label();
|
||||
this.端子3结果 = new System.Windows.Forms.Label();
|
||||
this.端子1 = new System.Windows.Forms.Label();
|
||||
this.端子2 = new System.Windows.Forms.Label();
|
||||
this.端子3 = new System.Windows.Forms.Label();
|
||||
this.端子1结果 = new System.Windows.Forms.Label();
|
||||
this.请扫描条码 = new System.Windows.Forms.Label();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.端子1校验 = new System.Windows.Forms.Label();
|
||||
this.端子2校验 = new System.Windows.Forms.Label();
|
||||
this.端子3校验 = new System.Windows.Forms.Label();
|
||||
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.tableLayoutPanel1);
|
||||
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.groupBox1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.groupBox1.Location = new System.Drawing.Point(0, 0);
|
||||
this.groupBox1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Padding = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.groupBox1.Size = new System.Drawing.Size(1647, 704);
|
||||
this.groupBox1.TabIndex = 5;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "端子扫码";
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 9;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.button3, 7, 4);
|
||||
this.tableLayoutPanel1.Controls.Add(this.button2, 7, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.button1, 7, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.确认, 1, 6);
|
||||
this.tableLayoutPanel1.Controls.Add(this.取消, 6, 6);
|
||||
this.tableLayoutPanel1.Controls.Add(this.端子2结果, 6, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.端子3结果, 6, 4);
|
||||
this.tableLayoutPanel1.Controls.Add(this.端子1, 3, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.端子2, 3, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.端子3, 3, 4);
|
||||
this.tableLayoutPanel1.Controls.Add(this.端子1结果, 6, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.请扫描条码, 2, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label6, 1, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label7, 1, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label8, 1, 4);
|
||||
this.tableLayoutPanel1.Controls.Add(this.端子1校验, 5, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.端子2校验, 5, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.端子3校验, 5, 4);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(6, 37);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 8;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 17F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 17F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 17F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 17F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 17F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(1635, 662);
|
||||
this.tableLayoutPanel1.TabIndex = 0;
|
||||
//
|
||||
// button3
|
||||
//
|
||||
this.button3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.button3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button3.Location = new System.Drawing.Point(1390, 372);
|
||||
this.button3.Name = "button3";
|
||||
this.button3.Size = new System.Drawing.Size(157, 106);
|
||||
this.button3.TabIndex = 14;
|
||||
this.button3.Text = "清空条码";
|
||||
this.button3.UseVisualStyleBackColor = true;
|
||||
this.button3.Click += new System.EventHandler(this.button3_Click);
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.button2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button2.Location = new System.Drawing.Point(1390, 260);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(157, 106);
|
||||
this.button2.TabIndex = 13;
|
||||
this.button2.Text = "清空条码";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click_1);
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button1.Location = new System.Drawing.Point(1390, 148);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(157, 106);
|
||||
this.button1.TabIndex = 12;
|
||||
this.button1.Text = "清空条码";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click_1);
|
||||
//
|
||||
// 确认
|
||||
//
|
||||
this.确认.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.确认.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.确认.Location = new System.Drawing.Point(84, 517);
|
||||
this.确认.Name = "确认";
|
||||
this.确认.Size = new System.Drawing.Size(321, 106);
|
||||
this.确认.TabIndex = 2;
|
||||
this.确认.Text = "确认";
|
||||
this.确认.UseVisualStyleBackColor = true;
|
||||
this.确认.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// 取消
|
||||
//
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.取消, 2);
|
||||
this.取消.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.取消.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.取消.Location = new System.Drawing.Point(1227, 517);
|
||||
this.取消.Name = "取消";
|
||||
this.取消.Size = new System.Drawing.Size(320, 106);
|
||||
this.取消.TabIndex = 3;
|
||||
this.取消.Text = "取消";
|
||||
this.取消.UseVisualStyleBackColor = true;
|
||||
this.取消.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// 端子2结果
|
||||
//
|
||||
this.端子2结果.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.端子2结果.AutoSize = true;
|
||||
this.端子2结果.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.端子2结果.Location = new System.Drawing.Point(1274, 292);
|
||||
this.端子2结果.Name = "端子2结果";
|
||||
this.端子2结果.Size = new System.Drawing.Size(62, 42);
|
||||
this.端子2结果.TabIndex = 7;
|
||||
this.端子2结果.Text = "NG";
|
||||
//
|
||||
// 端子3结果
|
||||
//
|
||||
this.端子3结果.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.端子3结果.AutoSize = true;
|
||||
this.端子3结果.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.端子3结果.Location = new System.Drawing.Point(1274, 404);
|
||||
this.端子3结果.Name = "端子3结果";
|
||||
this.端子3结果.Size = new System.Drawing.Size(62, 42);
|
||||
this.端子3结果.TabIndex = 8;
|
||||
this.端子3结果.Text = "OK";
|
||||
//
|
||||
// 端子1
|
||||
//
|
||||
this.端子1.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.端子1.AutoSize = true;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.端子1, 2);
|
||||
this.端子1.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.端子1.Location = new System.Drawing.Point(645, 180);
|
||||
this.端子1.Name = "端子1";
|
||||
this.端子1.Size = new System.Drawing.Size(260, 42);
|
||||
this.端子1.TabIndex = 1;
|
||||
this.端子1.Text = "12112312312";
|
||||
//
|
||||
// 端子2
|
||||
//
|
||||
this.端子2.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.端子2.AutoSize = true;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.端子2, 2);
|
||||
this.端子2.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.端子2.Location = new System.Drawing.Point(645, 292);
|
||||
this.端子2.Name = "端子2";
|
||||
this.端子2.Size = new System.Drawing.Size(260, 42);
|
||||
this.端子2.TabIndex = 6;
|
||||
this.端子2.Text = "12112312312";
|
||||
//
|
||||
// 端子3
|
||||
//
|
||||
this.端子3.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.端子3.AutoSize = true;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.端子3, 2);
|
||||
this.端子3.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.端子3.Location = new System.Drawing.Point(645, 404);
|
||||
this.端子3.Name = "端子3";
|
||||
this.端子3.Size = new System.Drawing.Size(260, 42);
|
||||
this.端子3.TabIndex = 5;
|
||||
this.端子3.Text = "12112312312";
|
||||
//
|
||||
// 端子1结果
|
||||
//
|
||||
this.端子1结果.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.端子1结果.AutoSize = true;
|
||||
this.端子1结果.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.端子1结果.Location = new System.Drawing.Point(1274, 180);
|
||||
this.端子1结果.Name = "端子1结果";
|
||||
this.端子1结果.Size = new System.Drawing.Size(62, 42);
|
||||
this.端子1结果.TabIndex = 4;
|
||||
this.端子1结果.Text = "OK";
|
||||
//
|
||||
// 请扫描条码
|
||||
//
|
||||
this.请扫描条码.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.请扫描条码.AutoSize = true;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.请扫描条码, 3);
|
||||
this.请扫描条码.Font = new System.Drawing.Font("宋体", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.请扫描条码.ForeColor = System.Drawing.Color.Red;
|
||||
this.请扫描条码.Location = new System.Drawing.Point(508, 61);
|
||||
this.请扫描条码.Name = "请扫描条码";
|
||||
this.请扫描条码.Size = new System.Drawing.Size(452, 56);
|
||||
this.请扫描条码.TabIndex = 0;
|
||||
this.请扫描条码.Text = "请扫描端子条码:";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label6.Location = new System.Drawing.Point(160, 180);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(169, 42);
|
||||
this.label6.TabIndex = 9;
|
||||
this.label6.Text = "端子1:";
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label7.Location = new System.Drawing.Point(160, 292);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(169, 42);
|
||||
this.label7.TabIndex = 10;
|
||||
this.label7.Text = "端子2:";
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label8.Location = new System.Drawing.Point(160, 404);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(169, 42);
|
||||
this.label8.TabIndex = 11;
|
||||
this.label8.Text = "端子3:";
|
||||
//
|
||||
// 端子1校验
|
||||
//
|
||||
this.端子1校验.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.端子1校验.AutoSize = true;
|
||||
this.端子1校验.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.端子1校验.Location = new System.Drawing.Point(1111, 180);
|
||||
this.端子1校验.Name = "端子1校验";
|
||||
this.端子1校验.Size = new System.Drawing.Size(62, 42);
|
||||
this.端子1校验.TabIndex = 15;
|
||||
this.端子1校验.Text = "OK";
|
||||
//
|
||||
// 端子2校验
|
||||
//
|
||||
this.端子2校验.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.端子2校验.AutoSize = true;
|
||||
this.端子2校验.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.端子2校验.Location = new System.Drawing.Point(1111, 292);
|
||||
this.端子2校验.Name = "端子2校验";
|
||||
this.端子2校验.Size = new System.Drawing.Size(62, 42);
|
||||
this.端子2校验.TabIndex = 16;
|
||||
this.端子2校验.Text = "NG";
|
||||
//
|
||||
// 端子3校验
|
||||
//
|
||||
this.端子3校验.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.端子3校验.AutoSize = true;
|
||||
this.端子3校验.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.端子3校验.Location = new System.Drawing.Point(1111, 404);
|
||||
this.端子3校验.Name = "端子3校验";
|
||||
this.端子3校验.Size = new System.Drawing.Size(62, 42);
|
||||
this.端子3校验.TabIndex = 17;
|
||||
this.端子3校验.Text = "OK";
|
||||
//
|
||||
// timer1
|
||||
//
|
||||
this.timer1.Enabled = true;
|
||||
this.timer1.Interval = 800;
|
||||
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
|
||||
//
|
||||
// ScanForm_DZ
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1647, 704);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.Name = "ScanForm_DZ";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "扫码界面";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ScanForm_FormClosing);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
private void ScanForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
FormHelp.RemoveAllEventHandlers(Init.ScanPort, "DataReceived");
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.Label 请扫描条码;
|
||||
private System.Windows.Forms.Label 端子1;
|
||||
private System.Windows.Forms.Button 确认;
|
||||
private System.Windows.Forms.Button 取消;
|
||||
private System.Windows.Forms.Timer timer1;
|
||||
private System.Windows.Forms.Label 端子2结果;
|
||||
private System.Windows.Forms.Label 端子3结果;
|
||||
private System.Windows.Forms.Label 端子2;
|
||||
private System.Windows.Forms.Label 端子3;
|
||||
private System.Windows.Forms.Label 端子1结果;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.Label label8;
|
||||
private System.Windows.Forms.Button button3;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Label 端子1校验;
|
||||
private System.Windows.Forms.Label 端子2校验;
|
||||
private System.Windows.Forms.Label 端子3校验;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO.Ports;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using WindowsFormsApp1.db;
|
||||
using WindowsFormsApp1.mod;
|
||||
using WindowsFormsApp1.mod.database;
|
||||
using WindowsFormsApp1.mod.server;
|
||||
using WindowsFormsApp1.server;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace WindowsFormsApp1
|
||||
{
|
||||
public partial class ScanForm_DZ : Form
|
||||
{
|
||||
public ApiClient ApiClient = new ApiClient();
|
||||
public ScanForm_DZ()
|
||||
{
|
||||
InitializeComponent();
|
||||
Init.ScanPort.DataReceived += SerialPort_DataReceived;
|
||||
端子1.Text = "";
|
||||
端子2.Text = "";
|
||||
端子3.Text = "";
|
||||
|
||||
}
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.DialogResult = DialogResult.Cancel;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void timer1_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (请扫描条码.ForeColor == Color.Red)
|
||||
{
|
||||
请扫描条码.ForeColor = Color.RosyBrown;
|
||||
}
|
||||
else
|
||||
{
|
||||
请扫描条码.ForeColor = Color.Red;
|
||||
}
|
||||
}
|
||||
|
||||
public void SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!Init.ScanPort.IsOpen)
|
||||
{
|
||||
Init.ScanPort?.Open();
|
||||
}
|
||||
// 读取串口接收到的数据
|
||||
var dataBuilder = new StringBuilder();
|
||||
while(Init.ScanPort.BytesToRead > 0)
|
||||
{
|
||||
System.Threading.Thread.Sleep(100);
|
||||
dataBuilder.Append(Init.ScanPort.ReadExisting());
|
||||
}
|
||||
var barcode = dataBuilder.ToString();
|
||||
if (端子1.Text == barcode || 端子2.Text == barcode || 端子3.Text == barcode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (string.IsNullOrWhiteSpace(端子1.Text))
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
端子1.Text = barcode;
|
||||
}));
|
||||
var result = ApiClient.CallFunctionByName("nowinterface.code", null, new otherdata() { JS_SN = barcode });
|
||||
if (result.Success)
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
端子1校验.Text = "校验OK";
|
||||
}));
|
||||
//继续调用接口
|
||||
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
button1.Visible = false;
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
端子1校验.Text = "校验NG";
|
||||
}));
|
||||
}
|
||||
}
|
||||
else if (string.IsNullOrWhiteSpace(端子2.Text))
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
端子2.Text = barcode;
|
||||
}));
|
||||
var result = ApiClient.CallFunctionByName("nowinterface.code", null, new otherdata() { JS_SN = barcode });
|
||||
if (result.Success)
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
端子2校验.Text = "校验OK";
|
||||
}));
|
||||
//继续调用接口
|
||||
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
button2.Visible = false;
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
端子2校验.Text = "校验NG";
|
||||
}));
|
||||
}
|
||||
}
|
||||
else if (string.IsNullOrWhiteSpace(端子3.Text))
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
端子3.Text = barcode;
|
||||
}));
|
||||
var result = ApiClient.CallFunctionByName("nowinterface.code", null, new otherdata() { JS_SN = barcode });
|
||||
if (result.Success)
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
端子3校验.Text = "校验OK";
|
||||
}));
|
||||
|
||||
//继续调用接口
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
button3.Visible = false;
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
端子3校验.Text = "校验NG";
|
||||
}));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//if (this.InvokeRequired)
|
||||
//{
|
||||
// this.Invoke(new Action(() =>
|
||||
// {
|
||||
// 端子1.Text = ReturnValue;
|
||||
// 端子1.Visible = true;
|
||||
// }));
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// 端子1.Text = ReturnValue;
|
||||
// 端子1.Visible = true;
|
||||
//}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"读取数据时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void button1_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
端子1.Text = "";
|
||||
}
|
||||
|
||||
private void button2_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
端子2.Text = "";
|
||||
}
|
||||
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
端子3.Text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
@@ -117,4 +117,7 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
+196
@@ -0,0 +1,196 @@
|
||||
namespace WindowsFormsApp1
|
||||
{
|
||||
partial class ScanForm_SSQ
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.请扫描条码 = new System.Windows.Forms.Label();
|
||||
this.LOt号 = new System.Windows.Forms.Label();
|
||||
this.确认 = new System.Windows.Forms.Button();
|
||||
this.取消 = new System.Windows.Forms.Button();
|
||||
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.tableLayoutPanel1);
|
||||
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.groupBox1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.groupBox1.Location = new System.Drawing.Point(0, 0);
|
||||
this.groupBox1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Padding = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.groupBox1.Size = new System.Drawing.Size(1647, 704);
|
||||
this.groupBox1.TabIndex = 5;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "物料扫码";
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 5;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.button1, 1, 4);
|
||||
this.tableLayoutPanel1.Controls.Add(this.button2, 3, 4);
|
||||
this.tableLayoutPanel1.Controls.Add(this.请扫描条码, 1, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.LOt号, 1, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.确认, 1, 6);
|
||||
this.tableLayoutPanel1.Controls.Add(this.取消, 3, 6);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(6, 37);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 8;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 4.588645F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 13.76593F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 18.35458F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.06084F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 13.76593F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.50806F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 13.76593F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 17.19009F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(1635, 662);
|
||||
this.tableLayoutPanel1.TabIndex = 0;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.button1.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button1.Location = new System.Drawing.Point(184, 304);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(539, 85);
|
||||
this.button1.TabIndex = 4;
|
||||
this.button1.Text = "位置1";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click_1);
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.button2.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button2.Location = new System.Drawing.Point(910, 304);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(539, 85);
|
||||
this.button2.TabIndex = 5;
|
||||
this.button2.Text = "位置2";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click_1);
|
||||
//
|
||||
// 请扫描条码
|
||||
//
|
||||
this.请扫描条码.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.请扫描条码.AutoSize = true;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.请扫描条码, 3);
|
||||
this.请扫描条码.Font = new System.Drawing.Font("宋体", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.请扫描条码.ForeColor = System.Drawing.Color.Red;
|
||||
this.请扫描条码.Location = new System.Drawing.Point(647, 47);
|
||||
this.请扫描条码.Name = "请扫描条码";
|
||||
this.请扫描条码.Size = new System.Drawing.Size(338, 56);
|
||||
this.请扫描条码.TabIndex = 0;
|
||||
this.请扫描条码.Text = "请扫描条码:";
|
||||
//
|
||||
// LOt号
|
||||
//
|
||||
this.LOt号.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.LOt号.AutoSize = true;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.LOt号, 3);
|
||||
this.LOt号.Font = new System.Drawing.Font("宋体", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.LOt号.Location = new System.Drawing.Point(544, 153);
|
||||
this.LOt号.Name = "LOt号";
|
||||
this.LOt号.Size = new System.Drawing.Size(544, 56);
|
||||
this.LOt号.TabIndex = 1;
|
||||
this.LOt号.Text = "LOt号:12112312312";
|
||||
//
|
||||
// 确认
|
||||
//
|
||||
this.确认.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.确认.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.确认.Location = new System.Drawing.Point(184, 457);
|
||||
this.确认.Name = "确认";
|
||||
this.确认.Size = new System.Drawing.Size(539, 85);
|
||||
this.确认.TabIndex = 2;
|
||||
this.确认.Text = "上线";
|
||||
this.确认.UseVisualStyleBackColor = true;
|
||||
this.确认.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// 取消
|
||||
//
|
||||
this.取消.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.取消.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.取消.Location = new System.Drawing.Point(910, 457);
|
||||
this.取消.Name = "取消";
|
||||
this.取消.Size = new System.Drawing.Size(539, 85);
|
||||
this.取消.TabIndex = 3;
|
||||
this.取消.Text = "下线";
|
||||
this.取消.UseVisualStyleBackColor = true;
|
||||
this.取消.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// timer1
|
||||
//
|
||||
this.timer1.Enabled = true;
|
||||
this.timer1.Interval = 800;
|
||||
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
|
||||
//
|
||||
// ScanForm_SSQ
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1647, 704);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.Name = "ScanForm_SSQ";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "扫码界面";
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.Label 请扫描条码;
|
||||
private System.Windows.Forms.Label LOt号;
|
||||
private System.Windows.Forms.Button 确认;
|
||||
private System.Windows.Forms.Button 取消;
|
||||
private System.Windows.Forms.Timer timer1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO.Ports;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using WindowsFormsApp1.db;
|
||||
using WindowsFormsApp1.mod;
|
||||
using WindowsFormsApp1.mod.database;
|
||||
using WindowsFormsApp1.server;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace WindowsFormsApp1
|
||||
{
|
||||
public partial class ScanForm_SSQ : Form
|
||||
{
|
||||
// 自定义属性,用于存储返回值
|
||||
/// <summary>
|
||||
/// 0代表无位置
|
||||
/// </summary>
|
||||
int index = 0;
|
||||
public string ReturnValue { get; set; }
|
||||
public ScanForm_SSQ()
|
||||
{
|
||||
InitializeComponent();
|
||||
//Init.ScanPort.DataReceived += SerialPort_DataReceived;
|
||||
LOt号.Visible = false;
|
||||
|
||||
}
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(ReturnValue))
|
||||
{
|
||||
MessageBox.Show("扫码为空,请确认!");
|
||||
return;
|
||||
}
|
||||
|
||||
//请求后端接口,index代表位置
|
||||
//更新下数据库和init里面的keyvalue值
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(ReturnValue))
|
||||
{
|
||||
MessageBox.Show("扫码为空,请确认!");
|
||||
return;
|
||||
}
|
||||
//请求后端接口,index代表位置
|
||||
//更新下数据库和init里面的keyvalue值
|
||||
}
|
||||
|
||||
private void timer1_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (请扫描条码.ForeColor == Color.Red)
|
||||
{
|
||||
请扫描条码.ForeColor = Color.RosyBrown;
|
||||
}
|
||||
else
|
||||
{
|
||||
请扫描条码.ForeColor = Color.Red;
|
||||
}
|
||||
}
|
||||
|
||||
public void SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!Init.ScanPort.IsOpen)
|
||||
{
|
||||
Init.ScanPort?.Open();
|
||||
}
|
||||
// 读取串口接收到的数据
|
||||
var dataBuilder = new StringBuilder();
|
||||
while(Init.ScanPort.BytesToRead > 0)
|
||||
{
|
||||
System.Threading.Thread.Sleep(100);
|
||||
dataBuilder.Append(Init.ScanPort.ReadExisting());
|
||||
}
|
||||
ReturnValue = dataBuilder.ToString();
|
||||
|
||||
if (this.InvokeRequired)
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
LOt号.Text = ReturnValue;
|
||||
LOt号.Visible = true;
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
LOt号.Text = ReturnValue;
|
||||
LOt号.Visible = true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"读取数据时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void button1_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
if (button1.BackColor == Color.Red)
|
||||
{
|
||||
index = 0;
|
||||
button1.BackColor = SystemColors.Control;
|
||||
button2.BackColor = SystemColors.Control;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = 1;
|
||||
button1.BackColor = Color.Red;
|
||||
button2.BackColor = SystemColors.Control;
|
||||
}
|
||||
}
|
||||
|
||||
private void button2_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
if (button2.BackColor == Color.Red)
|
||||
{
|
||||
index = 0;
|
||||
button2.BackColor = SystemColors.Control;
|
||||
button1.BackColor = SystemColors.Control;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = 2;
|
||||
button2.BackColor = Color.Red;
|
||||
button1.BackColor = SystemColors.Control;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,13 +117,7 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="linename.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="flowname.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
+45
-75
@@ -34,10 +34,6 @@
|
||||
this.关闭 = new System.Windows.Forms.Button();
|
||||
this.查询 = new System.Windows.Forms.Button();
|
||||
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.id = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.plcname = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.code = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
@@ -47,6 +43,8 @@
|
||||
this.addresstype = new System.Windows.Forms.DataGridViewComboBoxColumn();
|
||||
this.addresstypelegth = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.remark = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@@ -83,8 +81,8 @@
|
||||
this.dataGridView1.AllowUserToDeleteRows = false;
|
||||
dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.dataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
|
||||
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
|
||||
@@ -114,77 +112,16 @@
|
||||
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle3;
|
||||
this.dataGridView1.Location = new System.Drawing.Point(6, 127);
|
||||
this.dataGridView1.Location = new System.Drawing.Point(6, 5);
|
||||
this.dataGridView1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.dataGridView1.Name = "dataGridView1";
|
||||
this.dataGridView1.ReadOnly = true;
|
||||
this.dataGridView1.RowHeadersWidth = 72;
|
||||
this.tableLayoutPanel1.SetRowSpan(this.dataGridView1, 3);
|
||||
this.tableLayoutPanel1.SetRowSpan(this.dataGridView1, 4);
|
||||
this.dataGridView1.RowTemplate.Height = 23;
|
||||
this.dataGridView1.Size = new System.Drawing.Size(1624, 682);
|
||||
this.dataGridView1.Size = new System.Drawing.Size(1624, 804);
|
||||
this.dataGridView1.TabIndex = 8;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("宋体", 14.14286F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label1.Location = new System.Drawing.Point(4, 27);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(253, 68);
|
||||
this.label1.TabIndex = 12;
|
||||
this.label1.Text = "选择需要编辑的PLC编号:";
|
||||
//
|
||||
// comboBox1
|
||||
//
|
||||
this.comboBox1.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBox1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.comboBox1.FormattingEnabled = true;
|
||||
this.comboBox1.Location = new System.Drawing.Point(278, 40);
|
||||
this.comboBox1.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.comboBox1.Name = "comboBox1";
|
||||
this.comboBox1.Size = new System.Drawing.Size(409, 41);
|
||||
this.comboBox1.TabIndex = 13;
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 3;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15.07911F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 74.9177F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10.00319F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.button1, 2, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.comboBox1, 1, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.关闭, 2, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.查询, 2, 0);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 4;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 45F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(1818, 814);
|
||||
this.tableLayoutPanel1.TabIndex = 14;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button1.Location = new System.Drawing.Point(1650, 541);
|
||||
this.button1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(153, 56);
|
||||
this.button1.TabIndex = 15;
|
||||
this.button1.Text = "新增";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// id
|
||||
//
|
||||
this.id.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
@@ -270,7 +207,43 @@
|
||||
this.remark.Name = "remark";
|
||||
this.remark.ReadOnly = true;
|
||||
//
|
||||
// PlcAddress_Manage
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 3;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15.07911F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 74.9177F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10.00319F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.button1, 2, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.关闭, 2, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.查询, 2, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 0);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 4;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 45F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(1818, 814);
|
||||
this.tableLayoutPanel1.TabIndex = 14;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button1.Location = new System.Drawing.Point(1650, 541);
|
||||
this.button1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(153, 56);
|
||||
this.button1.TabIndex = 15;
|
||||
this.button1.Text = "新增";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// Torqueaddress_Manage
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
@@ -278,14 +251,13 @@
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.Name = "PlcAddress_Manage";
|
||||
this.Name = "Torqueaddress_Manage";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "PLCADDRESS_Manage";
|
||||
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||
this.Load += new System.EventHandler(this.PLCADDRESS_Manage_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@@ -295,8 +267,6 @@
|
||||
private System.Windows.Forms.Button 关闭;
|
||||
private System.Windows.Forms.Button 查询;
|
||||
private System.Windows.Forms.DataGridView dataGridView1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.ComboBox comboBox1;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn id;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace WindowsFormsApp1.form
|
||||
|
||||
private void 查询_Click(object sender, EventArgs e)
|
||||
{
|
||||
GetInfo((int)comboBox1.SelectedValue);
|
||||
GetInfo();
|
||||
}
|
||||
|
||||
private void 保存_Click(object sender, EventArgs e)
|
||||
@@ -33,7 +33,7 @@ namespace WindowsFormsApp1.form
|
||||
if (result.Success)
|
||||
{
|
||||
MessageBox.Show("更新成功");
|
||||
GetInfo((int)comboBox1.SelectedValue);
|
||||
GetInfo();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -62,13 +62,6 @@ namespace WindowsFormsApp1.form
|
||||
return;
|
||||
}
|
||||
|
||||
var list = result_combox.Data.FindAll(a => Init.t_Lineplcs.Select(p => p.plcid).Contains(a.id));
|
||||
|
||||
// 绑定数据源到 ComboBox
|
||||
comboBox1.DataSource = list;
|
||||
comboBox1.DisplayMember = "plcname";
|
||||
comboBox1.ValueMember = "id";
|
||||
|
||||
var result1 = new List<object>
|
||||
{
|
||||
new {name = "read",value = "read"},
|
||||
@@ -134,7 +127,7 @@ namespace WindowsFormsApp1.form
|
||||
fLOW_Insert.dataid = selectid;
|
||||
fLOW_Insert.Operation = OperationType.Edit;
|
||||
fLOW_Insert.ShowDialog();
|
||||
GetInfo((int)comboBox1.SelectedValue);
|
||||
GetInfo();
|
||||
|
||||
}
|
||||
else if (e.ColumnIndex == 10)
|
||||
@@ -153,12 +146,12 @@ namespace WindowsFormsApp1.form
|
||||
{
|
||||
MessageBox.Show("删除失败");
|
||||
}
|
||||
GetInfo((int)comboBox1.SelectedValue);
|
||||
GetInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void GetInfo(int plcid)
|
||||
public void GetInfo()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -166,7 +159,7 @@ namespace WindowsFormsApp1.form
|
||||
SQLiteHelper<t_torqueaddress> sQLiteHelper = new db.SQLiteHelper<t_torqueaddress>();
|
||||
SQLiteHelper<t_plc> sQLiteHelper1 = new db.SQLiteHelper<t_plc>();
|
||||
var result_plc = sQLiteHelper1.QueryAll();
|
||||
var result = sQLiteHelper.Query(a=>a.plcid == plcid);
|
||||
var result = sQLiteHelper.Query(a=>a.plcid == Init.t_Line.plcid);
|
||||
if (result.Success)
|
||||
{
|
||||
List<object> list = new List<object>();
|
||||
@@ -203,7 +196,7 @@ namespace WindowsFormsApp1.form
|
||||
{
|
||||
Torqueaddress_Insert fLOW_Insert = new Torqueaddress_Insert();
|
||||
fLOW_Insert.ShowDialog();
|
||||
GetInfo((int)comboBox1.SelectedValue);
|
||||
GetInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,170 +0,0 @@
|
||||
namespace WindowsFormsApp1.form
|
||||
{
|
||||
partial class LinePLC_Insert
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.产线 = new System.Windows.Forms.ComboBox();
|
||||
this.PLC = new System.Windows.Forms.ComboBox();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 6;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.button1, 1, 8);
|
||||
this.tableLayoutPanel1.Controls.Add(this.button2, 3, 8);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label4, 1, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label6, 1, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.产线, 2, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.PLC, 2, 3);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 10;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(1087, 854);
|
||||
this.tableLayoutPanel1.TabIndex = 0;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.button1, 2);
|
||||
this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button1.Location = new System.Drawing.Point(228, 683);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(194, 79);
|
||||
this.button1.TabIndex = 14;
|
||||
this.button1.Text = "保存";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.button2, 2);
|
||||
this.button2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button2.Location = new System.Drawing.Point(664, 683);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(190, 79);
|
||||
this.button2.TabIndex = 15;
|
||||
this.button2.Text = "取消";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label4.Location = new System.Drawing.Point(154, 113);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(124, 28);
|
||||
this.label4.TabIndex = 3;
|
||||
this.label4.Text = "产线名称";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label6.Location = new System.Drawing.Point(161, 283);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(110, 28);
|
||||
this.label6.TabIndex = 5;
|
||||
this.label6.Text = "关联PLC";
|
||||
//
|
||||
// 产线
|
||||
//
|
||||
this.产线.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.产线, 3);
|
||||
this.产线.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.产线.FormattingEnabled = true;
|
||||
this.产线.Location = new System.Drawing.Point(341, 113);
|
||||
this.产线.Name = "产线";
|
||||
this.产线.Size = new System.Drawing.Size(619, 36);
|
||||
this.产线.TabIndex = 31;
|
||||
//
|
||||
// PLC
|
||||
//
|
||||
this.PLC.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.PLC, 3);
|
||||
this.PLC.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.PLC.FormattingEnabled = true;
|
||||
this.PLC.Location = new System.Drawing.Point(341, 283);
|
||||
this.PLC.Name = "PLC";
|
||||
this.PLC.Size = new System.Drawing.Size(619, 36);
|
||||
this.PLC.TabIndex = 32;
|
||||
//
|
||||
// LinePLC_Insert
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1087, 854);
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Name = "LinePLC_Insert";
|
||||
this.Text = "Form_Insert";
|
||||
this.Load += new System.EventHandler(this.FLOW_Insert_Load);
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.ComboBox 产线;
|
||||
private System.Windows.Forms.ComboBox PLC;
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using WindowsFormsApp1.db;
|
||||
using WindowsFormsApp1.mod;
|
||||
|
||||
namespace WindowsFormsApp1.form
|
||||
{
|
||||
public partial class LinePLC_Insert : Form
|
||||
{
|
||||
public OperationType Operation { get; set; }
|
||||
public int dataid { get; set; }
|
||||
|
||||
public LinePLC_Insert()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
//保存
|
||||
if (产线.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("产线不可为空");
|
||||
}
|
||||
if (PLC.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("PLC不可为空");
|
||||
}
|
||||
|
||||
t_lineplc t_Flow = new t_lineplc();
|
||||
t_Flow.lineid = (int)产线.SelectedValue;
|
||||
t_Flow.plcid = (int)PLC.SelectedValue;
|
||||
|
||||
|
||||
SQLiteHelper<t_lineplc> sQLiteHelper1 = new db.SQLiteHelper<t_lineplc>();
|
||||
if (Operation == OperationType.Edit)
|
||||
{
|
||||
t_Flow.id = dataid;
|
||||
sQLiteHelper1.Update(t_Flow);
|
||||
}
|
||||
else
|
||||
{
|
||||
sQLiteHelper1.Insert(t_Flow);
|
||||
}
|
||||
MessageBox.Show("保存成功");
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
//取消
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void FLOW_Insert_Load(object sender, EventArgs e)
|
||||
{
|
||||
SQLiteHelper<t_line> sQLiteHelper1 = new db.SQLiteHelper<t_line>();
|
||||
var result_combox1 = sQLiteHelper1.QueryAll();
|
||||
if (!result_combox1.Success)
|
||||
{
|
||||
MessageBox.Show("查询失败");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 绑定数据源到 ComboBox
|
||||
产线.DataSource = result_combox1.Data;
|
||||
产线.DisplayMember = "linename";
|
||||
产线.ValueMember = "id";
|
||||
|
||||
|
||||
SQLiteHelper<t_plc> sQLiteHelper2 = new db.SQLiteHelper<t_plc>();
|
||||
var result_combox2 = sQLiteHelper2.QueryAll();
|
||||
if (!result_combox2.Success)
|
||||
{
|
||||
MessageBox.Show("查询失败");
|
||||
return;
|
||||
}
|
||||
|
||||
PLC.DataSource = result_combox2.Data;
|
||||
PLC.DisplayMember = "plcname";
|
||||
PLC.ValueMember = "id";
|
||||
|
||||
if (Operation == OperationType.Edit)
|
||||
{
|
||||
SQLiteHelper<t_lineplc> sQLiteHelper = new db.SQLiteHelper<t_lineplc>();
|
||||
var result = sQLiteHelper.QuerySingle(a=>a.id == dataid);
|
||||
if (!result.Success)
|
||||
{
|
||||
MessageBox.Show("查询失败");
|
||||
return;
|
||||
}
|
||||
var DataToEdit = result.Data;
|
||||
SelectItemByValue1(产线, DataToEdit.lineid.ToString());
|
||||
SelectItemByValue2(PLC, DataToEdit.plcid.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void SelectItemByValue1(ComboBox comboBox1, string value)
|
||||
{
|
||||
foreach (t_line item in comboBox1.Items)
|
||||
{
|
||||
if (item.id.ToString() == value)
|
||||
{
|
||||
comboBox1.SelectedItem = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SelectItemByValue2(ComboBox comboBox1, string value)
|
||||
{
|
||||
foreach (t_plc item in comboBox1.Items)
|
||||
{
|
||||
if (item.id.ToString() == value)
|
||||
{
|
||||
comboBox1.SelectedItem = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+114
-12
@@ -41,6 +41,14 @@
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.产线编号 = new System.Windows.Forms.TextBox();
|
||||
this.关联流程 = new System.Windows.Forms.ComboBox();
|
||||
this.备用显示1 = new System.Windows.Forms.TextBox();
|
||||
this.备用显示2 = new System.Windows.Forms.TextBox();
|
||||
this.备用显示3 = new System.Windows.Forms.TextBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.关联PLC = new System.Windows.Forms.ComboBox();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -65,6 +73,14 @@
|
||||
this.tableLayoutPanel1.Controls.Add(this.label7, 1, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.产线编号, 2, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.关联流程, 2, 5);
|
||||
this.tableLayoutPanel1.Controls.Add(this.备用显示1, 4, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.备用显示2, 4, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.备用显示3, 4, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label5, 3, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label6, 3, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label8, 3, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label9, 1, 6);
|
||||
this.tableLayoutPanel1.Controls.Add(this.关联PLC, 2, 6);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
@@ -123,11 +139,10 @@
|
||||
// 名称
|
||||
//
|
||||
this.名称.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.名称, 3);
|
||||
this.名称.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.名称.Location = new System.Drawing.Point(364, 108);
|
||||
this.名称.Location = new System.Drawing.Point(328, 108);
|
||||
this.名称.Name = "名称";
|
||||
this.名称.Size = new System.Drawing.Size(573, 39);
|
||||
this.名称.Size = new System.Drawing.Size(211, 39);
|
||||
this.名称.TabIndex = 16;
|
||||
//
|
||||
// label4
|
||||
@@ -166,21 +181,19 @@
|
||||
// 模组
|
||||
//
|
||||
this.模组.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.模组, 3);
|
||||
this.模组.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.模组.Location = new System.Drawing.Point(364, 363);
|
||||
this.模组.Location = new System.Drawing.Point(328, 363);
|
||||
this.模组.Name = "模组";
|
||||
this.模组.Size = new System.Drawing.Size(573, 39);
|
||||
this.模组.Size = new System.Drawing.Size(211, 39);
|
||||
this.模组.TabIndex = 20;
|
||||
//
|
||||
// 产线类型
|
||||
//
|
||||
this.产线类型.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.产线类型, 3);
|
||||
this.产线类型.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.产线类型.Location = new System.Drawing.Point(364, 278);
|
||||
this.产线类型.Location = new System.Drawing.Point(328, 278);
|
||||
this.产线类型.Name = "产线类型";
|
||||
this.产线类型.Size = new System.Drawing.Size(573, 39);
|
||||
this.产线类型.Size = new System.Drawing.Size(211, 39);
|
||||
this.产线类型.TabIndex = 17;
|
||||
//
|
||||
// label7
|
||||
@@ -197,11 +210,10 @@
|
||||
// 产线编号
|
||||
//
|
||||
this.产线编号.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.产线编号, 3);
|
||||
this.产线编号.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.产线编号.Location = new System.Drawing.Point(364, 193);
|
||||
this.产线编号.Location = new System.Drawing.Point(328, 193);
|
||||
this.产线编号.Name = "产线编号";
|
||||
this.产线编号.Size = new System.Drawing.Size(573, 39);
|
||||
this.产线编号.Size = new System.Drawing.Size(211, 39);
|
||||
this.产线编号.TabIndex = 30;
|
||||
//
|
||||
// 关联流程
|
||||
@@ -215,6 +227,88 @@
|
||||
this.关联流程.Size = new System.Drawing.Size(573, 36);
|
||||
this.关联流程.TabIndex = 31;
|
||||
//
|
||||
// 备用显示1
|
||||
//
|
||||
this.备用显示1.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.备用显示1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.备用显示1.Location = new System.Drawing.Point(762, 108);
|
||||
this.备用显示1.Name = "备用显示1";
|
||||
this.备用显示1.Size = new System.Drawing.Size(211, 39);
|
||||
this.备用显示1.TabIndex = 32;
|
||||
//
|
||||
// 备用显示2
|
||||
//
|
||||
this.备用显示2.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.备用显示2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.备用显示2.Location = new System.Drawing.Point(762, 193);
|
||||
this.备用显示2.Name = "备用显示2";
|
||||
this.备用显示2.Size = new System.Drawing.Size(211, 39);
|
||||
this.备用显示2.TabIndex = 33;
|
||||
//
|
||||
// 备用显示3
|
||||
//
|
||||
this.备用显示3.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.备用显示3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.备用显示3.Location = new System.Drawing.Point(762, 278);
|
||||
this.备用显示3.Name = "备用显示3";
|
||||
this.备用显示3.Size = new System.Drawing.Size(211, 39);
|
||||
this.备用显示3.TabIndex = 34;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label5.Location = new System.Drawing.Point(581, 113);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(138, 28);
|
||||
this.label5.TabIndex = 35;
|
||||
this.label5.Text = "备用显示1";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label6.Location = new System.Drawing.Point(581, 198);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(138, 28);
|
||||
this.label6.TabIndex = 36;
|
||||
this.label6.Text = "备用显示2";
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label8.Location = new System.Drawing.Point(581, 283);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(138, 28);
|
||||
this.label8.TabIndex = 37;
|
||||
this.label8.Text = "备用显示3";
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label9.Location = new System.Drawing.Point(161, 538);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(110, 28);
|
||||
this.label9.TabIndex = 38;
|
||||
this.label9.Text = "关联PLC";
|
||||
//
|
||||
// 关联PLC
|
||||
//
|
||||
this.关联PLC.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.关联PLC, 3);
|
||||
this.关联PLC.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.关联PLC.FormattingEnabled = true;
|
||||
this.关联PLC.Location = new System.Drawing.Point(364, 538);
|
||||
this.关联PLC.Name = "关联PLC";
|
||||
this.关联PLC.Size = new System.Drawing.Size(573, 36);
|
||||
this.关联PLC.TabIndex = 39;
|
||||
//
|
||||
// Line_Insert
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
|
||||
@@ -246,5 +340,13 @@
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.TextBox 产线编号;
|
||||
private System.Windows.Forms.ComboBox 关联流程;
|
||||
private System.Windows.Forms.TextBox 备用显示1;
|
||||
private System.Windows.Forms.TextBox 备用显示2;
|
||||
private System.Windows.Forms.TextBox 备用显示3;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.Label label8;
|
||||
private System.Windows.Forms.Label label9;
|
||||
private System.Windows.Forms.ComboBox 关联PLC;
|
||||
}
|
||||
}
|
||||
@@ -46,11 +46,31 @@ namespace WindowsFormsApp1.form
|
||||
MessageBox.Show("模组不能为空");
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(备用显示1.Text))
|
||||
{
|
||||
MessageBox.Show("备用显示1不能为空");
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(备用显示2.Text))
|
||||
{
|
||||
MessageBox.Show("备用显示2不能为空");
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(备用显示3.Text))
|
||||
{
|
||||
MessageBox.Show("备用显示3不能为空");
|
||||
return;
|
||||
}
|
||||
if (关联流程.SelectedValue == null || (int)关联流程.SelectedValue == 0)
|
||||
{
|
||||
MessageBox.Show("关联流程不能为空");
|
||||
return;
|
||||
}
|
||||
if (关联PLC.SelectedValue == null || (int)关联PLC.SelectedValue == 0)
|
||||
{
|
||||
MessageBox.Show("关联PLC不能为空");
|
||||
return;
|
||||
}
|
||||
|
||||
t_line t_Flow = new t_line();
|
||||
t_Flow.linename = 名称.Text;
|
||||
@@ -58,6 +78,11 @@ namespace WindowsFormsApp1.form
|
||||
t_Flow.linecode = 产线编号.Text;
|
||||
t_Flow.linemode = 模组.Text;
|
||||
t_Flow.flowid = (int)关联流程.SelectedValue;
|
||||
t_Flow.plcid = (int)关联PLC.SelectedValue;
|
||||
t_Flow.lineremark1 = 备用显示1.Text;
|
||||
t_Flow.lineremark2 = 备用显示2.Text;
|
||||
t_Flow.lineremark3 = 备用显示3.Text;
|
||||
|
||||
|
||||
SQLiteHelper<t_line> sQLiteHelper1 = new db.SQLiteHelper<t_line>();
|
||||
if (Operation == OperationType.Edit)
|
||||
@@ -82,8 +107,10 @@ namespace WindowsFormsApp1.form
|
||||
private void FLOW_Insert_Load(object sender, EventArgs e)
|
||||
{
|
||||
SQLiteHelper<t_flow> sQLiteHelper1 = new db.SQLiteHelper<t_flow>();
|
||||
SQLiteHelper<t_plc> sQLiteHelper2 = new db.SQLiteHelper<t_plc>();
|
||||
var result_combox1 = sQLiteHelper1.QueryAll();
|
||||
if (!result_combox1.Success)
|
||||
var result_combox2 = sQLiteHelper2.QueryAll();
|
||||
if (!result_combox1.Success || !result_combox2.Success)
|
||||
{
|
||||
MessageBox.Show("查询失败");
|
||||
return;
|
||||
@@ -103,6 +130,23 @@ namespace WindowsFormsApp1.form
|
||||
关联流程.DisplayMember = "flowname";
|
||||
关联流程.ValueMember = "id";
|
||||
|
||||
|
||||
List<plc_combox> list2 = new List<plc_combox>();
|
||||
var plcresult = result_combox2.Data;
|
||||
foreach (var group in plcresult)
|
||||
{
|
||||
list2.Add(new plc_combox
|
||||
{
|
||||
id = group.id,
|
||||
plcname = group.plcname
|
||||
});
|
||||
}
|
||||
|
||||
// 绑定数据源到 ComboBox
|
||||
关联PLC.DataSource = list2;
|
||||
关联PLC.DisplayMember = "plcname";
|
||||
关联PLC.ValueMember = "id";
|
||||
|
||||
if (Operation == OperationType.Edit)
|
||||
{
|
||||
SQLiteHelper<t_line> sQLiteHelper = new db.SQLiteHelper<t_line>();
|
||||
@@ -117,7 +161,11 @@ namespace WindowsFormsApp1.form
|
||||
产线编号.Text = DataToEdit.linecode;
|
||||
产线类型.Text = DataToEdit.linetype;
|
||||
模组.Text = DataToEdit.linemode;
|
||||
备用显示1.Text = DataToEdit.lineremark1;
|
||||
备用显示2.Text = DataToEdit.lineremark2;
|
||||
备用显示3.Text = DataToEdit.lineremark3;
|
||||
SelectItemByValue(关联流程, DataToEdit.flowid.ToString());
|
||||
SelectItemByValue2(关联PLC, DataToEdit.plcid.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,11 +180,29 @@ namespace WindowsFormsApp1.form
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SelectItemByValue2(ComboBox comboBox1, string value)
|
||||
{
|
||||
foreach (plc_combox item in comboBox1.Items)
|
||||
{
|
||||
if (item.id.ToString() == value)
|
||||
{
|
||||
comboBox1.SelectedItem = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class flow_combox
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string flowname{ get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
public class plc_combox
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string plcname { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -71,5 +71,9 @@ namespace WindowsFormsApp1.mod
|
||||
/// 气密参数
|
||||
/// </summary>
|
||||
public bool airtight { get; set; }
|
||||
/// <summary>
|
||||
/// 端子是否扫码
|
||||
/// </summary>
|
||||
public bool dzscan { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,15 @@ namespace WindowsFormsApp1.mod
|
||||
public string linecode { get; set; }
|
||||
public string linetype { get; set; }
|
||||
public string linemode { get; set; }
|
||||
public string lineremark1 { get; set; }
|
||||
public string lineremark2 { get; set; }
|
||||
public string lineremark3 { get; set; }
|
||||
public string lineremark4 { get; set; }
|
||||
public string lineremark5 { get; set; }
|
||||
public string lineremark6 { get; set; }
|
||||
public string lineremark7 { get; set; }
|
||||
|
||||
public int flowid { get; set; }
|
||||
public int plcid { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SQLite;
|
||||
|
||||
namespace WindowsFormsApp1.mod
|
||||
{
|
||||
[Table("lineplc")]
|
||||
public class t_lineplc
|
||||
{
|
||||
[PrimaryKey, AutoIncrement]
|
||||
public int id { get; set; }
|
||||
public int lineid { get; set; }
|
||||
public int plcid { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SQLite;
|
||||
|
||||
namespace WindowsFormsApp1.mod
|
||||
{
|
||||
/// <summary>
|
||||
/// 压力曲线 实体类
|
||||
/// </summary>
|
||||
[Table("pressurecurve")]
|
||||
public class t_pressurecurve
|
||||
{
|
||||
[PrimaryKey, AutoIncrement]
|
||||
public int id { get; set; }
|
||||
public int plcid { get; set; }
|
||||
|
||||
public string code { get; set; }
|
||||
public string type { get; set; }
|
||||
public string dbaddress { get; set; }
|
||||
public string addresstype { get; set; }
|
||||
public int addresstypelegth { get; set; }
|
||||
public int addressoffset { get; set; }
|
||||
public string remark { get; set; }
|
||||
public string value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,12 @@ namespace WindowsFormsApp1.mod
|
||||
NONE
|
||||
};
|
||||
|
||||
public enum plcstate
|
||||
{
|
||||
NG,
|
||||
OK
|
||||
};
|
||||
|
||||
public enum plcstatus
|
||||
{
|
||||
运行 = (short)1,
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace WindowsFormsApp1.server
|
||||
public static ILogNet logNet = new LogNetDateTime("C:\\Log\\Logs", GenerateMode.ByEveryDay);
|
||||
public static ILogNet PlclogNet = new LogNetDateTime("C:\\Log\\PlcLogs", GenerateMode.ByEveryDay);
|
||||
public static ILogNet ApilogNet = new LogNetDateTime("C:\\Log\\Apilogs", GenerateMode.ByEveryHour);
|
||||
public static ILogNet QMlogNet = new LogNetDateTime("C:\\Log\\QMlogs", GenerateMode.ByEveryHour);
|
||||
public static HslCommunication.BasicFramework.SoftNumericalOrder softNumericalOrder = new HslCommunication.BasicFramework.SoftNumericalOrder("", "yyyyMMdd", 4, @"\numericalOrder.txt");
|
||||
|
||||
public LogExecute()
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace WindowsFormsApp1.server
|
||||
private SiemensS7Net siemensS7Net;
|
||||
private string ip;
|
||||
private int timeout;
|
||||
private static bool ConnectB = false;
|
||||
private bool ConnectB = false;
|
||||
public SiemensHelp(string ip,int timeout)
|
||||
{
|
||||
this.ip = ip;
|
||||
@@ -580,5 +580,110 @@ namespace WindowsFormsApp1.server
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 读取压力
|
||||
public BllResult<List<float>> ReadAddress(List<t_pressurecurve> address)
|
||||
{
|
||||
var ulist = address.GroupBy(a => a.dbaddress).ToList();
|
||||
foreach (var u in ulist)
|
||||
{
|
||||
var readresult = ReadOneDB(u.ToList());
|
||||
if (!readresult.Success)
|
||||
{
|
||||
return BllResult<List<float>>.Error(readresult.Msg);
|
||||
}
|
||||
}
|
||||
List<float> list = new List<float>();
|
||||
foreach (var add in address.OrderBy(a => a.addressoffset))
|
||||
{
|
||||
list.Add(float.Parse(add.value));
|
||||
}
|
||||
return BllResult<List<float>>.Sucess(list, "成功");
|
||||
}
|
||||
private BllResult ReadOneDB(List<t_pressurecurve> address)
|
||||
{
|
||||
address = address.OrderBy(a => a.addressoffset).ToList();
|
||||
OperateResult<byte[]> read;
|
||||
if (address.Count == 1)
|
||||
{
|
||||
string startaddress = address[0].dbaddress + "." + address[0].addressoffset.ToString();
|
||||
read = siemensS7Net.Read(startaddress, Convert.ToUInt16(address[0].addresstypelegth));
|
||||
}
|
||||
else
|
||||
{
|
||||
double admax = address.Select(a => a.addressoffset).Max();
|
||||
double admin = address.Select(a => a.addressoffset).Min();
|
||||
ushort length = (ushort)(Math.Floor(admax - admin) + address.Last().addresstypelegth);
|
||||
string startaddress = address[0].dbaddress + "." + admin.ToString();
|
||||
read = siemensS7Net.Read(startaddress, length);
|
||||
}
|
||||
if (read.IsSuccess)
|
||||
{
|
||||
if (TransforWCSDataToAddressData(address, read).Success)
|
||||
{
|
||||
return BllResult.Sucess(address, "成功");
|
||||
}
|
||||
else
|
||||
{
|
||||
return BllResult.Error(address, "成功");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return BllResult.Error(read.Message);
|
||||
}
|
||||
}
|
||||
private BllResult TransforWCSDataToAddressData(List<t_pressurecurve> address, OperateResult<byte[]> read)
|
||||
{
|
||||
try
|
||||
{
|
||||
//按偏移量排序
|
||||
address = address.OrderBy(a => a.addressoffset).ToList();
|
||||
int startindex = address[0].addressoffset;
|
||||
for (int i = 0; i < address.Count; i++)
|
||||
{
|
||||
int index = address[i].addressoffset - startindex;
|
||||
switch (address[i].addresstype)
|
||||
{
|
||||
case "byte":
|
||||
address[i].value = ByteTransform.TransByte(read.Content, index).ToString();
|
||||
break;
|
||||
|
||||
case "real":
|
||||
address[i].value = ByteTransform.TransSingle(read.Content, index).ToString();
|
||||
break;
|
||||
|
||||
case "lword":
|
||||
address[i].value = Convert.ToString(ByteTransform.TransInt64(read.Content, index), 16); ;
|
||||
break;
|
||||
|
||||
case "int":
|
||||
address[i].value = ByteTransform.TransInt16(read.Content, index).ToString();
|
||||
break;
|
||||
|
||||
case "uint":
|
||||
address[i].value = ByteTransform.TransInt16(read.Content, index).ToString();
|
||||
break;
|
||||
|
||||
case "dint":
|
||||
address[i].value = Convert.ToString(ByteTransform.TransInt32(read.Content, index), 10);
|
||||
break;
|
||||
|
||||
case "string":
|
||||
address[i].value = Encoding.ASCII.GetString(read.Content, index, address[i].addresstypelegth);
|
||||
break;
|
||||
|
||||
default:
|
||||
return BllResult.Error("找不到未知的数据类型");
|
||||
}
|
||||
}
|
||||
return BllResult.Sucess(address);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BllResult.Error($"转换WCS数据失败{ex.Message}");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user