3.25 测试
改端子扫码,产线页面,主页
This commit is contained in:
1 parent
bd70f38e1a
commit
083c4ec3ac
16 files changed
+1016
-877
No files matched your search
@@ -12,6 +12,7 @@ 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;
|
||||
|
||||
@@ -25,12 +26,12 @@ namespace WindowsFormsApp1
|
||||
/// </summary>
|
||||
int index = 0;
|
||||
public string ReturnValue { get; set; }
|
||||
public ApiClient ApiClient = new ApiClient();
|
||||
public ScanForm_SSQ()
|
||||
{
|
||||
InitializeComponent();
|
||||
//Init.ScanPort.DataReceived += SerialPort_DataReceived;
|
||||
Init.ScanPort.DataReceived += SerialPort_DataReceived_SSQ;
|
||||
LOt号.Visible = false;
|
||||
|
||||
}
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -39,9 +40,25 @@ namespace WindowsFormsApp1
|
||||
MessageBox.Show("扫码为空,请确认!");
|
||||
return;
|
||||
}
|
||||
|
||||
LogExecute.logNet.WriteDebug($"{ReturnValue}上线点击");
|
||||
//this.Close();
|
||||
//请求后端接口,index代表位置
|
||||
//更新下数据库和init里面的keyvalue值
|
||||
var PlcData = new plcdata();
|
||||
var OtherData = new otherdata();
|
||||
OtherData.locationindex = index;
|
||||
OtherData.opindex = 1;
|
||||
OtherData.JS_SN = ReturnValue;
|
||||
|
||||
var result = ApiClient.CallFunctionByName("Glue_CheckOut", PlcData, OtherData);
|
||||
if (result.Success && result.Mesresult == mesresult.PASS)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
//失败逻辑
|
||||
}
|
||||
//更新下数据库和init里面的keyvalue值,缓存
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
@@ -51,8 +68,25 @@ namespace WindowsFormsApp1
|
||||
MessageBox.Show("扫码为空,请确认!");
|
||||
return;
|
||||
}
|
||||
LogExecute.logNet.WriteDebug($"{ReturnValue}下线点击");
|
||||
this.Close();
|
||||
//请求后端接口,index代表位置
|
||||
//更新下数据库和init里面的keyvalue值
|
||||
var PlcData = new plcdata();
|
||||
var OtherData = new otherdata();
|
||||
OtherData.locationindex = index;
|
||||
OtherData.opindex = 1;
|
||||
OtherData.JS_SN = ReturnValue;
|
||||
|
||||
var result = ApiClient.CallFunctionByName("Glue_CheckOut", PlcData, OtherData);
|
||||
if (result.Success)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
//失败逻辑
|
||||
}
|
||||
//更新下数据库和init里面的keyvalue值,删除缓存
|
||||
}
|
||||
|
||||
private void timer1_Tick(object sender, EventArgs e)
|
||||
@@ -67,7 +101,7 @@ namespace WindowsFormsApp1
|
||||
}
|
||||
}
|
||||
|
||||
public void SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
||||
public void SerialPort_DataReceived_SSQ(object sender, SerialDataReceivedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -135,5 +169,10 @@ namespace WindowsFormsApp1
|
||||
button1.BackColor = SystemColors.Control;
|
||||
}
|
||||
}
|
||||
|
||||
private void ScanForm_SSQ_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
FormHelp.RemoveAllEventHandlers(Init.ScanPort, "DataReceived");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user