更改FTP文件导入
This commit is contained in:
@@ -664,23 +664,24 @@ namespace FATrace.App
|
||||
|
||||
//确认数据
|
||||
// 显示消息框,并等待用户响应
|
||||
DialogResult result = MessageBox.Show("确定要【打印】操作吗?", "确认操作", MessageBoxButtons.OKCancel);
|
||||
if (result==DialogResult.Cancel)
|
||||
DialogResult result = frmMessage.ShowConfirm("确定要【打印】操作吗?", "确认操作", this);
|
||||
if (result == DialogResult.Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (CurWeight<2.0)
|
||||
if (CurWeight < 2.0)
|
||||
{
|
||||
//确认数据
|
||||
// 显示消息框,并等待用户响应
|
||||
DialogResult resultWeightCheck = MessageBox.Show("检测到当前的重量小于2g,确定要【打印】操作吗?", "确认操作", MessageBoxButtons.OKCancel);
|
||||
DialogResult resultWeightCheck = frmMessage.ShowConfirm("检测到当前的重量小于2g,确定要【打印】操作吗?", "确认操作", this);
|
||||
if (resultWeightCheck == DialogResult.Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//新的剩余重量 Kg
|
||||
var NewRemainWeight = CurSelectedRawProInput.RemainWeight - CurWeight / 1000.0;
|
||||
|
||||
@@ -726,7 +727,7 @@ namespace FATrace.App
|
||||
RawName = CurSelectedRawProInput.RawName,
|
||||
RemainWeight = NewRemainWeight,
|
||||
Weight = CurWeight,
|
||||
DeliveryDate= DateTime.Now.ToString("yyyy-MM-dd"),
|
||||
DeliveryDate = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||
WeightTime = DateTime.Now,
|
||||
StockWeight = CurSelectedRawProInput.Weight,
|
||||
}).ExecuteAffrows();
|
||||
@@ -786,13 +787,19 @@ namespace FATrace.App
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 格式化重量显示,整数部分至少2位(不足补0),小数部分固定2位
|
||||
/// 格式化重量显示,自动适配整数部分位数(2-4位),小数部分固定2位
|
||||
/// </summary>
|
||||
/// <param name="weight">原始重量值</param>
|
||||
/// <returns>格式化后的重量字符串(如:09.50, 81.10, 100.00)</returns>
|
||||
/// /// <returns>格式化后的重量字符串(如:09.50, 81.10, 100.00, 1000.00)</returns>
|
||||
private string FormatWeight(double weight)
|
||||
{
|
||||
return weight.ToString("00.00");
|
||||
// 根据重量值大小决定格式
|
||||
if (weight >= 1000)
|
||||
return weight.ToString("0000.00"); // 四位整数:1000.00-9999.99
|
||||
else if (weight >= 100)
|
||||
return weight.ToString("000.00"); // 三位整数:100.00-999.99
|
||||
else
|
||||
return weight.ToString("00.00"); // 两位整数:00.00-99.99
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1276,5 +1283,62 @@ namespace FATrace.App
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重新打印之前最新的一个
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btnReprint_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (CurSelectedRawProInput == null)
|
||||
{
|
||||
MessageBox.Show("请先选择要称重的产品", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
var LastData = FSqlContext.FDb.Select<RawProUse>().OrderByDescending(a => a.WeightTime).First();
|
||||
if (LastData == null)
|
||||
{
|
||||
MessageBox.Show("没有找到最新的消息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
// 显示消息框,并等待用户响应
|
||||
DialogResult result = frmMessage.ShowConfirm($"确定要【重复打印】{LastData.InBagCode} 条码数据吗?", "确认操作", this);
|
||||
if (result == DialogResult.Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 执行打印
|
||||
try
|
||||
{
|
||||
UpdateStatusLabel(tslPrintState, "正在打印...", Color.Goldenrod, Color.White);
|
||||
CurZebraPrint.PrintWeight(LastData.InBagCode!, CurSelectedRawProInput.RawName!,
|
||||
CurWeight,
|
||||
CurSelectedRawProInput.Batch!,
|
||||
CurSelectedRawProInput.ShelfLife
|
||||
);
|
||||
SetPrinterStatusOk("打印成功");
|
||||
logger.Info($"打印成功:{CurSelectedRawProInput.RawName} {CurWeight}g 批号{CurSelectedRawProInput.Batch}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SetPrinterStatusFail($"打印失败:{ex.Message}");
|
||||
logger.Error(ex, "打印失败");
|
||||
MessageBox.Show($"打印失败:{ex.Message}", "打印机错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error(String.Format("ErrSource : {0} ErrMsg : {1}", ex.StackTrace.ToString(), ex.Message.ToString()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user