diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/form/form-input.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/form/form-input.js
index 37ed61b0..99a4a65f 100644
--- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/form/form-input.js
+++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/form/form-input.js
@@ -15,7 +15,7 @@ export default {
{{dayjs(model[prop]).format('YYYY-MM-DD HH:mm:ss')}}
******
{{options.find(o=>o.value==model[prop])?.label??model[prop]}}
- {{model[prop]}}
+ {{model[prop]}}
diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/request/index.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/request/index.js
index 5ec0d0d2..37aa7ea2 100644
--- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/request/index.js
+++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/request/index.js
@@ -29,6 +29,7 @@ async function getResult(response) {
[204, "无返回值"],
[400, "请求参数错误"],
[401, "未登录"],
+ [415, "不支持的内容类型"],
[403, "权限不足"],
[500, "服务器异常"],
[503, "服务不可用"],
@@ -57,7 +58,7 @@ async function getResult(response) {
console.log(error);
}
if (!result.errors) {
- result.errors = result.message;
+ result.errors = result.message ?? result.status;
}
}
return result;
diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/backup.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/backup.js
index 927bc8fd..887b5448 100644
--- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/backup.js
+++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/backup.js
@@ -1,15 +1,35 @@
import AppList from "../../../components/list/index.js";
import html from "html";
+import { ref, nextTick } from "vue";
import useConfig from "../../../models/vmi/backup.js";
+import { useAppStore } from "../../store/index.js";
+import request from "../../request/index.js";
export default {
components: { AppList },
- template: html``,
+ template: html``,
setup() {
+ const appListRef = ref(null);
const config = useConfig();
+ const appStore = useAppStore();
const onCommand = async (item, rows) => {
- console.log(item.path, item, rows);
+ if (item.path === "invoke") {
+ const url = "settleaccount/vmi/vmi-backup/invoke";
+ await appListRef.value.onClick(
+ async () => {
+ const result = await request(url, null, { method: "POST" }, true);
+ if (!result.errors) {
+ appStore.isRefreshing = true;
+ nextTick(() => {
+ appStore.isRefreshing = false;
+ });
+ }
+ },
+ `是否手动进行备份?`,
+ false
+ );
+ }
};
- return { config, onCommand };
+ return { appListRef, config, onCommand };
},
};
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
index d8624c42..5e2b5a24 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
@@ -8,7 +8,6 @@ using System.IO;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Reflection;
-using System.Threading;
using System.Threading.Tasks;
using ClosedXML.Excel;
using LinqToDB.Data;
@@ -44,7 +43,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ;
[Route("api/settleaccount/[controller]/[action]")]
public class VmiAppService : ApplicationService, IJobService, ITransientDependency
{
- public static SemaphoreSlim backupLock = new SemaphoreSlim(1);
+ public static object backupLock = new object();
private readonly IConfiguration _cfg;
private readonly IServiceProvider _serviceProvider;
private readonly INormalEfCoreRepository _balanceRepository;
@@ -159,25 +158,19 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
///
[HttpPost("invoke")]
[DisableValidation]
- public virtual async Task VmiBackup()
+ public virtual IActionResult VmiBackup()
{
- if (backupLock.CurrentCount == 1)
+ lock (backupLock)
{
- return new JsonResult(new { Code = 500, Message = "备份程序正在运行" });
- }
- await backupLock.WaitAsync().ConfigureAwait(false);
- try
- {
- await Invoke(_serviceProvider).ConfigureAwait(false);
- return new JsonResult(new { Code = 200, Message = "备份成功" });
- }
- catch (Exception ex)
- {
- return new JsonResult(new { Code = 500, Message = ex.Message, Data = ex.ToString() });
- }
- finally
- {
- backupLock.Release();
+ try
+ {
+ Invoke(_serviceProvider).Wait();
+ return new JsonResult(new { Code = 200, Message = "备份成功" });
+ }
+ catch (Exception ex)
+ {
+ return new JsonResult(new { Code = 500, Message = ex.Message, Data = ex.ToString() });
+ }
}
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
index e594e2af..bca7bc8d 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
@@ -1327,7 +1327,7 @@ namespace Win.Sfs.SettleAccount
o.Configcode
})).IsUnique();
}));
- builder.Entity().HasData(new VmiBalance(Guid.NewGuid()) { DeliverBillType = EnumDeliverBjBmpBillType.JIS件, RealPartCode = "PartCode", VinCode = "VinCode", ErpToLoc = "ErpToLoc", OrderNum = "OrderNum" });
+ //builder.Entity().HasData(new VmiBalance(Guid.NewGuid()) { DeliverBillType = EnumDeliverBjBmpBillType.JIS件, RealPartCode = "PartCode", VinCode = "VinCode", ErpToLoc = "ErpToLoc", OrderNum = "OrderNum" });
builder.Entity(b =>
{