This commit is contained in:
2025-11-20 15:13:29 +08:00
parent b48e0b79dd
commit 979afae645
28 changed files with 1299 additions and 345 deletions

View File

@@ -206,6 +206,8 @@ namespace FATrace.App
private async void frmMain_Load(object sender, EventArgs e) // 将加载事件改为 async 以便等待连接
{
this.TabControlMain.SelectedIndex = 1;
// 初始化打印机对象
CurZebraPrint = new ZebraPrint(_printerIp, _printerPort);
@@ -275,6 +277,8 @@ namespace FATrace.App
await CheckDbStatusAsync();
await CheckPrinterStatusAsync();
});
}
/// <summary>
@@ -604,6 +608,37 @@ namespace FATrace.App
}
}
/// <summary>
/// 清零当前的原料
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnClearRaw_Click(object sender, EventArgs e)
{
DialogResult result = MessageBox.Show("您确定清零当前的原料?", "Confirmation",
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.No)
{
return;
}
if (CurSelectedRawProInput == null)
{
MessageBox.Show("请选中原料后再操作。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
var UpdatedData = FSqlContext.FDb.Update<RawProInput>()
.Set(a => a.RawState, RawSplitState.SplitComplete)
.Where(a => a.Id == CurSelectedRawProInput.Id)
.ExecuteUpdated();
if (UpdatedData.Count() > 0)
{
ClearInput();
}
}
/// <summary>
/// 称重打印数据
/// </summary>
@@ -613,9 +648,15 @@ namespace FATrace.App
{
if (CurSelectedRawProInput == null)
{
MessageBox.Show("请先选择要称重的产品", "称重通信错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
MessageBox.Show("请先选择要称重的产品", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (string.IsNullOrEmpty(CurSelectedRawProInput.RawName) || string.IsNullOrEmpty(CurSelectedRawProInput.Batch) || string.IsNullOrEmpty(CurSelectedRawProInput.RawCode))
{
MessageBox.Show("选择的产品信息无数据,请信息输入后再操作", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
//新的剩余重量 Kg
var NewRemainWeight = CurSelectedRawProInput.RemainWeight - CurWeight / 1000;
@@ -654,6 +695,9 @@ namespace FATrace.App
{
Batch = CurSelectedRawProInput.Batch,
InBagCode = Code,
BoxCode = Code + ",A",
OpUser = CurrentOperationNo,
CheckUser = CurrentOperationNo,
RawCode = CurSelectedRawProInput.RawCode,
ShelfLife = CurSelectedRawProInput.ShelfLife,
RawName = CurSelectedRawProInput.RawName,
@@ -962,7 +1006,10 @@ namespace FATrace.App
private void btnSysConfig_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(CurrentOperationNo))
{
}
}
private void btnExit_Click(object sender, EventArgs e)
@@ -1001,7 +1048,14 @@ namespace FATrace.App
private void btnMain_Click(object sender, EventArgs e)
{
TabControlMain.SelectedIndex = 0;
if (!string.IsNullOrEmpty(CurrentOperationNo))
{
TabControlMain.SelectedIndex = 0;
}
else
{
MessageBox.Show("请登录后再操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void btnHistoryData_Click(object sender, EventArgs e)
@@ -1016,7 +1070,6 @@ namespace FATrace.App
#endregion
#region
private void btnSearchHistoryData_Click(object sender, EventArgs e)
@@ -1169,6 +1222,15 @@ namespace FATrace.App
#endregion
private void frmMain_FormClosed(object sender, FormClosedEventArgs e)
{
//CurZebraPrint.Close();
if (_scaleTcp != null)
{
_scaleTcp!.StopAsync();
}
}
}
}