DataServices 现场调试OK

This commit is contained in:
2025-11-26 16:46:48 +08:00
parent 979afae645
commit 010272aa0b
31 changed files with 1866 additions and 267 deletions

View File

@@ -85,7 +85,7 @@ namespace FATrace.App
tabPage3 = new TabPage();
btnLogin = new Button();
txtPassword = new TextBox();
txtUserName = new TextBox();
txtCheckUserName = new TextBox();
label17 = new Label();
label16 = new Label();
label15 = new Label();
@@ -103,6 +103,8 @@ namespace FATrace.App
dtpSearchStartTime = new DateTimePicker();
dataGridView1 = new DataGridView();
label22 = new Label();
txtOpName = new TextBox();
label28 = new Label();
statusStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)splitContainer1).BeginInit();
splitContainer1.Panel1.SuspendLayout();
@@ -369,11 +371,11 @@ namespace FATrace.App
//
// btnWeightPrint
//
btnWeightPrint.Font = new Font("Microsoft YaHei UI", 15.75F, FontStyle.Bold, GraphicsUnit.Point, 134);
btnWeightPrint.Font = new Font("Microsoft YaHei UI", 20F, FontStyle.Bold);
btnWeightPrint.ForeColor = SystemColors.ControlDarkDark;
btnWeightPrint.Location = new Point(741, 119);
btnWeightPrint.Location = new Point(670, 95);
btnWeightPrint.Name = "btnWeightPrint";
btnWeightPrint.Size = new Size(119, 47);
btnWeightPrint.Size = new Size(190, 71);
btnWeightPrint.TabIndex = 9;
btnWeightPrint.Text = "称重打印";
btnWeightPrint.UseVisualStyleBackColor = true;
@@ -735,9 +737,11 @@ namespace FATrace.App
//
// tabPage3
//
tabPage3.Controls.Add(txtOpName);
tabPage3.Controls.Add(label28);
tabPage3.Controls.Add(btnLogin);
tabPage3.Controls.Add(txtPassword);
tabPage3.Controls.Add(txtUserName);
tabPage3.Controls.Add(txtCheckUserName);
tabPage3.Controls.Add(label17);
tabPage3.Controls.Add(label16);
tabPage3.Controls.Add(label15);
@@ -753,7 +757,7 @@ namespace FATrace.App
btnLogin.BackColor = Color.SandyBrown;
btnLogin.Font = new Font("微软雅黑", 22F);
btnLogin.ForeColor = SystemColors.ButtonHighlight;
btnLogin.Location = new Point(329, 387);
btnLogin.Location = new Point(355, 372);
btnLogin.Name = "btnLogin";
btnLogin.Size = new Size(224, 79);
btnLogin.TabIndex = 7;
@@ -764,24 +768,24 @@ namespace FATrace.App
// txtPassword
//
txtPassword.Font = new Font("微软雅黑", 16F);
txtPassword.Location = new Point(365, 296);
txtPassword.Location = new Point(335, 296);
txtPassword.Name = "txtPassword";
txtPassword.Size = new Size(224, 36);
txtPassword.Size = new Size(289, 36);
txtPassword.TabIndex = 6;
//
// txtUserName
// txtCheckUserName
//
txtUserName.Font = new Font("微软雅黑", 16F);
txtUserName.Location = new Point(365, 218);
txtUserName.Name = "txtUserName";
txtUserName.Size = new Size(224, 36);
txtUserName.TabIndex = 5;
txtCheckUserName.Font = new Font("微软雅黑", 16F);
txtCheckUserName.Location = new Point(335, 218);
txtCheckUserName.Name = "txtCheckUserName";
txtCheckUserName.Size = new Size(97, 36);
txtCheckUserName.TabIndex = 5;
//
// label17
//
label17.AutoSize = true;
label17.Font = new Font("微软雅黑", 16F);
label17.Location = new Point(277, 296);
label17.Location = new Point(247, 296);
label17.Name = "label17";
label17.Size = new Size(62, 30);
label17.TabIndex = 4;
@@ -791,17 +795,17 @@ namespace FATrace.App
//
label16.AutoSize = true;
label16.Font = new Font("微软雅黑", 16F);
label16.Location = new Point(277, 219);
label16.Location = new Point(247, 219);
label16.Name = "label16";
label16.Size = new Size(84, 30);
label16.TabIndex = 3;
label16.Text = "用户名:";
label16.Text = "确认者:";
//
// label15
//
label15.AutoSize = true;
label15.Font = new Font("微软雅黑", 26.75F);
label15.Location = new Point(365, 128);
label15.Location = new Point(361, 128);
label15.Name = "label15";
label15.Size = new Size(164, 46);
label15.TabIndex = 2;
@@ -957,6 +961,24 @@ namespace FATrace.App
label22.Text = "历史数据";
label22.TextAlign = ContentAlignment.MiddleCenter;
//
// txtOpName
//
txtOpName.Font = new Font("微软雅黑", 16F);
txtOpName.Location = new Point(527, 218);
txtOpName.Name = "txtOpName";
txtOpName.Size = new Size(97, 36);
txtOpName.TabIndex = 9;
//
// label28
//
label28.AutoSize = true;
label28.Font = new Font("微软雅黑", 16F);
label28.Location = new Point(439, 219);
label28.Name = "label28";
label28.Size = new Size(84, 30);
label28.TabIndex = 8;
label28.Text = "操作者:";
//
// frmMain
//
AutoScaleDimensions = new SizeF(7F, 17F);
@@ -1039,7 +1061,7 @@ namespace FATrace.App
private Label label14;
private Button btnLogin;
private TextBox txtPassword;
private TextBox txtUserName;
private TextBox txtCheckUserName;
private Label label17;
private Label label16;
private Label label15;
@@ -1077,5 +1099,7 @@ namespace FATrace.App
private PictureBox pictureBox2;
private PictureBox pictureBox3;
private PictureBox pictureBox4;
private TextBox txtOpName;
private Label label28;
}
}

View File

@@ -182,9 +182,14 @@ namespace FATrace.App
}
/// <summary>
/// 当前用户名
/// 当前确认者用户名
/// </summary>
public string CurrentOperationNo { get; set; } = string.Empty;
public string CurrentCheckUserNo { get; set; } = string.Empty;
/// <summary>
/// 当前操作者用户名
/// </summary>
public string CurrentOpUserNo { get; set; } = string.Empty;
public string CurrentOperationNoUserLevel { get; set; } = string.Empty;
@@ -696,13 +701,14 @@ namespace FATrace.App
Batch = CurSelectedRawProInput.Batch,
InBagCode = Code,
BoxCode = Code + ",A",
OpUser = CurrentOperationNo,
CheckUser = CurrentOperationNo,
OpUser = CurrentOpUserNo,
CheckUser = CurrentCheckUserNo,
RawCode = CurSelectedRawProInput.RawCode,
ShelfLife = CurSelectedRawProInput.ShelfLife,
RawName = CurSelectedRawProInput.RawName,
RemainWeight = NewRemainWeight,
Weight = CurWeight,
DeliveryDate= DateTime.Now.ToString("yyyy-MM-dd"),
WeightTime = DateTime.Now,
StockWeight = CurSelectedRawProInput.Weight,
}).ExecuteAffrows();
@@ -714,7 +720,7 @@ namespace FATrace.App
txtRemainWeight.Text = CurSelectedRawProInput.RemainWeight.ToString();
//称重检查如果剩余重量为0进行提示当剩余的重量小于称重的重量进行提示
if (CurSelectedRawProInput.RemainWeight < CurWeight / 1000)
if (CurSelectedRawProInput.RemainWeight < CurWeight / 1000.0)
{
//剩余的重量小于称重的重量,进行提示,强制进行清零
Task.Run(() =>
@@ -928,9 +934,14 @@ namespace FATrace.App
{
try
{
if (string.IsNullOrEmpty(txtUserName.Text))
if (string.IsNullOrEmpty(txtCheckUserName.Text))
{
MessageBox.Show("请输入用户名称", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
MessageBox.Show("请输入确认者用户名称", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (string.IsNullOrEmpty(txtOpName.Text))
{
MessageBox.Show("请输入操作者用户名称", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (string.IsNullOrEmpty(txtPassword.Text))
@@ -939,17 +950,17 @@ namespace FATrace.App
return;
}
var ListUser = FSqlContext.FDb.Select<TbUser>().Where(a => a.UserName == txtUserName.Text.Trim()).ToList();
var ListUser = FSqlContext.FDb.Select<TbUser>().Where(a => a.UserName == txtCheckUserName.Text.Trim()).ToList();
if (ListUser != null && ListUser.Count() > 0)
{
if (ListUser.FirstOrDefault().Password == txtPassword.Text.Trim())
{
MessageBox.Show("登录成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
Main_PopUserNameEvent(txtPassword.Text.Trim(), ListUser.FirstOrDefault().AccessLevel);
Main_PopUserNameEvent(txtCheckUserName.Text.Trim(), txtOpName.Text.Trim(), ListUser.FirstOrDefault().AccessLevel);
this.TabControlMain.SelectedIndex = 0;
txtUserName.Text = "";
txtCheckUserName.Text = "";
txtPassword.Text = "";
//PopUserNameEvent(txtUserName.Text.Trim());
//this.Close();
@@ -977,15 +988,17 @@ namespace FATrace.App
/// 用户登录的事件发布方法
/// </summary>
/// <param name="UserName"></param>
private void Main_PopUserNameEvent(string UserName, string UserLevel)
private void Main_PopUserNameEvent(string CheckUserName, string OpUserName, string UserLevel)
{
try
{
CurrentOperationNo = UserName;
CurrentCheckUserNo = CheckUserName;
CurrentOpUserNo = OpUserName;
CurrentOperationNoUserLevel = UserLevel;
Invoke(new Action(() =>
{
tslCurrentUser.Text = "当前用户:" + CurrentOperationNo;
tslCurrentUser.Text = "确认者用户:" + CurrentCheckUserNo;
tslCurrentUser.BackColor = Color.Green;
tslCurrentUser.ForeColor = Color.White;
}));
@@ -1006,7 +1019,7 @@ namespace FATrace.App
private void btnSysConfig_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(CurrentOperationNo))
if (!string.IsNullOrEmpty(CurrentCheckUserNo))
{
}
@@ -1048,7 +1061,7 @@ namespace FATrace.App
private void btnMain_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(CurrentOperationNo))
if (!string.IsNullOrEmpty(CurrentCheckUserNo))
{
TabControlMain.SelectedIndex = 0;
}