fix(打印功能): 修复打印后未更新产品列表和状态的问题
在打印预览对话框确认后,添加异步加载产品列表功能 打印成功后更新产品状态为已打印并记录操作日志
This commit is contained in:
@@ -14,6 +14,7 @@ using RIZO_Application.Models;
|
||||
using RIZO_Application.Models.Model;
|
||||
using RIZO_Application.Modules.ModuleName.Services.IServices;
|
||||
using RIZO_Application.Repository;
|
||||
using SqlSugar;
|
||||
|
||||
namespace RIZO_Application.Modules.ModuleName.Services
|
||||
{
|
||||
@@ -376,9 +377,21 @@ namespace RIZO_Application.Modules.ModuleName.Services
|
||||
bool success = await _printService.PrintLabelAsync(printDto);
|
||||
|
||||
// 如果打印成功,更新状态为已打印
|
||||
if (success && _useMockData)
|
||||
if (success)
|
||||
{
|
||||
product.LabelPrintStatus = "已打印";
|
||||
int recordUpdate = Context.Updateable(product).IgnoreColumns(ignoreAllNullColumns:true).ExecuteCommand();
|
||||
ProFinishedProductReceiptLog finishedProductReceiptLog = new ProFinishedProductReceiptLog
|
||||
{
|
||||
ReceiptNo = product.ReceiptNo,
|
||||
OperatedBy = product.LabelFrom,
|
||||
OperatedTime = DateTime.Now,
|
||||
OperationType = "PRINT",
|
||||
OperationContent = recordUpdate > 0 ? "入库单打印成功" : "入库单打印失败",
|
||||
OperationResult = recordUpdate > 0 ? "SUCCESS" : "FAIL",
|
||||
Remark = ""
|
||||
};
|
||||
Context.Insertable(finishedProductReceiptLog).ExecuteCommand();
|
||||
_eventAggregator
|
||||
.GetEvent<SystemLogEvent>()
|
||||
.Publish($"更新成品入库单状态为已打印: {product.ReceiptNo}");
|
||||
|
||||
@@ -208,11 +208,13 @@ namespace RIZO_Application.Modules.ModuleName.ViewModels
|
||||
{
|
||||
var parameters = new DialogParameters();
|
||||
parameters.Add("Product", SelectedProduct);
|
||||
_dialogService.ShowDialog("PrintPreviewDialog", parameters, r =>
|
||||
_dialogService.ShowDialog("PrintPreviewDialog", parameters, async r =>
|
||||
{
|
||||
if (r.Result == ButtonResult.OK)
|
||||
{
|
||||
// 打印逻辑已在弹窗中处理
|
||||
// 重新加载产品列表
|
||||
await LoadFinishedProductsAsync();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user