This commit is contained in:
qianhao.xu 2025-04-08 18:05:58 +08:00
parent be1c77de18
commit 2e35df01c7

View File

@ -61,7 +61,7 @@ namespace linesider_screen_bankend.Controller
// 使用 using 语句确保资源正确释放
using (var bartender = new BartenderPrintHelper())
{
var variables = new Dictionary<string, string>
{
{ "partnumber", workorderInfo.Specification },
@ -88,10 +88,16 @@ namespace linesider_screen_bankend.Controller
}
// 返回成功响应
await this.HttpContext.SendApiSuccessAsync(null);
}
else
{
// 返回成功响应
await this.HttpContext.SendApiFailAsync(500, "工单不在数据库");
}
}
catch (Exception ex)
@ -144,11 +150,16 @@ namespace linesider_screen_bankend.Controller
.Where(x => x.Workorder == workorder)
.First();
if (workorderInfo == null)
{
// 返回成功响应
await this.HttpContext.SendApiFailAsync(500, "工单不在数据库");
return;
}
// 使用 using 语句确保资源正确释放
using (var bartender = new BartenderPrintHelper())
{
var variables = new Dictionary<string, string>
{
{ "partnumber", workorderInfo.Specification },
@ -175,7 +186,7 @@ namespace linesider_screen_bankend.Controller
}
// 返回成功响应
await this.HttpContext.SendApiSuccessAsync(null);
}
@ -206,10 +217,16 @@ namespace linesider_screen_bankend.Controller
ProWorkorder workorderInfo = SqlSugarHelper.Db.Queryable<ProWorkorder>()
.Where(x => x.Workorder == workorder)
.First();
if (workorderInfo == null)
{
// 返回成功响应
await this.HttpContext.SendApiFailAsync(500, "工单不在数据库");
return;
}
// 使用 using 语句确保资源正确释放
using (var bartender = new BartenderPrintHelper())
{
var variables = new Dictionary<string, string>
{
{ "partnumber", workorderInfo.Specification },
@ -236,7 +253,7 @@ namespace linesider_screen_bankend.Controller
}
// 返回成功响应
await this.HttpContext.SendApiSuccessAsync(null);
}