学 赵
1 year ago
40 changed files with 6848 additions and 839 deletions
@ -1,139 +1,26 @@ |
|||
import useVmi from "./vmi.js"; |
|||
|
|||
const schema = useVmi(); |
|||
|
|||
const baseUrl = "settleaccount/vmi"; |
|||
const queryUrl = `${baseUrl}/backup`; |
|||
const detailsUrl = `${baseUrl}/get/%s`; |
|||
const createUrl = `${baseUrl}/create`; |
|||
const updateUrl = `${baseUrl}/update/%s`; |
|||
const deleteUrl = `${baseUrl}/delete-list`; |
|||
const importUrl = `${baseUrl}/code-setting-upload-excel-import`; |
|||
const exportUrl = `${baseUrl}/backup-export`; |
|||
const invokeUrl = "settleaccount/vmi/invoke"; |
|||
const queryMethod = "POST"; |
|||
const detailsMethod = "POST"; |
|||
const createMethod = "POST"; |
|||
const updateMethod = "POST"; |
|||
const deleteMethod = "POST"; |
|||
const importMethod = "POST"; |
|||
const exportMethod = "POST"; |
|||
const invokeMethod = "POST"; |
|||
import useBalance from "./balance.js"; |
|||
|
|||
export default function () { |
|||
return { |
|||
query: { |
|||
url: queryUrl, |
|||
method: queryMethod, |
|||
hasFilter: true, |
|||
autoSubmit: true, |
|||
disableQueryOnLoad: true, |
|||
schema: { |
|||
title: "时点库存余额查询", |
|||
type: "object", |
|||
properties: { |
|||
const result = useBalance(); |
|||
result.query.disableQueryOnLoad = true; |
|||
//result.query.autoSubmit = true;
|
|||
result.query.schema.properties = Object.assign( |
|||
{ |
|||
name: { |
|||
title: "时间", |
|||
title: "备份时间", |
|||
type: "string", |
|||
input: "select", |
|||
url: "settleaccount/vmi/snapshot", |
|||
value: "description", |
|||
label: "name", |
|||
defaultSelected: true, |
|||
//defaultSelected: true,
|
|||
clearable: false, |
|||
}, |
|||
filters: { |
|||
title: "项目", |
|||
type: "array", |
|||
hidden: true, |
|||
items: { |
|||
type: "object", |
|||
properties: { |
|||
logic: { |
|||
type: "int", |
|||
}, |
|||
column: { |
|||
type: "string", |
|||
}, |
|||
action: { |
|||
type: "int", |
|||
}, |
|||
value: { |
|||
type: "string", |
|||
}, |
|||
}, |
|||
}, |
|||
default: [ |
|||
{ |
|||
logic: "and", |
|||
column: "erpToLoc", |
|||
action: "like", |
|||
value: null, |
|||
readOnly: true, |
|||
}, |
|||
{ |
|||
logic: "and", |
|||
column: "realPartCode", |
|||
action: "like", |
|||
value: null, |
|||
readOnly: true, |
|||
}, |
|||
{ |
|||
logic: "and", |
|||
column: "vinCode", |
|||
action: "like", |
|||
value: null, |
|||
readOnly: true, |
|||
}, |
|||
{ |
|||
logic: "and", |
|||
column: "codeType", |
|||
action: "equal", |
|||
value: null, |
|||
readOnly: true, |
|||
}, |
|||
{ |
|||
logic: "and", |
|||
column: "deliverBillType", |
|||
action: "equal", |
|||
value: null, |
|||
readOnly: true, |
|||
}, |
|||
], |
|||
}, |
|||
skipCount: { |
|||
hidden: true, |
|||
default: 0, |
|||
}, |
|||
maxResultCount: { |
|||
hidden: true, |
|||
default: 10, |
|||
}, |
|||
sorting: { |
|||
hidden: true, |
|||
}, |
|||
}, |
|||
}, |
|||
}, |
|||
table: { |
|||
schema: schema, |
|||
}, |
|||
edit: { |
|||
detailsUrl, |
|||
createUrl, |
|||
updateUrl, |
|||
deleteUrl, |
|||
importUrl, |
|||
exportUrl, |
|||
invokeUrl, |
|||
detailsMethod, |
|||
createMethod, |
|||
updateMethod, |
|||
deleteMethod, |
|||
importMethod, |
|||
exportMethod, |
|||
invokeMethod, |
|||
schema: schema, |
|||
}, |
|||
}; |
|||
result.query.schema.properties |
|||
); |
|||
result.query.url = "settleaccount/vmi/backup"; |
|||
result.edit.exportUrl = "settleaccount/vmi/backup-export"; |
|||
result.edit.backupUrl = "settleaccount/vmi/vmi-backup/invoke"; |
|||
return result; |
|||
} |
|||
|
@ -1,69 +0,0 @@ |
|||
const options1 = [ |
|||
{ value: 0, label: "无" }, |
|||
{ value: 1, label: "JIS件" }, |
|||
{ value: 2, label: "JIT直供件" }, |
|||
{ value: 3, label: "印度件" }, |
|||
{ value: 4, label: "北汽4S备件" }, |
|||
]; |
|||
const options2 = [ |
|||
{ value: "01", label: "前保" }, |
|||
{ value: " 02", label: "后保" }, |
|||
{ value: "03", label: " 左门槛" }, |
|||
{ value: "04", label: "右门槛" }, |
|||
{ value: "05", label: "扰流板" }, |
|||
{ value: "06", label: "前左轮眉" }, |
|||
{ value: "07", label: "前右轮眉 " }, |
|||
{ value: "08", label: "后左轮眉" }, |
|||
{ value: "09", label: "后右轮眉" }, |
|||
]; |
|||
const options3 = [ |
|||
{ value: 0, label: "无" }, |
|||
{ value: 1, label: "保险杠BBAC" }, |
|||
{ value: 2, label: "保险杠HBPO" }, |
|||
{ value: 3, label: "买单件保险杠BBAC" }, |
|||
{ value: 4, label: "买单件保险杠HBPO" }, |
|||
{ value: 5, label: "买单件小件BBAC" }, |
|||
{ value: 6, label: "买单件小件HBPO" }, |
|||
{ value: 7, label: "小件BBAC" }, |
|||
{ value: 8, label: "小件HBPO" }, |
|||
{ value: 9, label: "JIT直供件BBAC" }, |
|||
{ value: 10, label: "JIT直供件HBPO" }, |
|||
]; |
|||
const billType = { |
|||
title: "发货类型", |
|||
type: "number", |
|||
input: "select", |
|||
options: options1, |
|||
clearable: true, |
|||
rules: [ |
|||
{ |
|||
required: true, |
|||
}, |
|||
], |
|||
}; |
|||
const codeType = { |
|||
title: "生产码类型", |
|||
type: "string", |
|||
input: "select", |
|||
options: options2, |
|||
clearable: true, |
|||
rules: [ |
|||
{ |
|||
required: true, |
|||
}, |
|||
], |
|||
}; |
|||
const subBillType = { |
|||
title: "发货子类型", |
|||
type: "number", |
|||
input: "select", |
|||
options: options3, |
|||
clearable: true, |
|||
rules: [ |
|||
{ |
|||
required: true, |
|||
}, |
|||
], |
|||
}; |
|||
|
|||
export { billType, codeType, subBillType }; |
@ -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`<app-list :config="config" @command="onCommand" />`, |
|||
template: html`<app-list ref="appListRef" :config="config" @command="onCommand" />`, |
|||
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 = config.edit.backupUrl; |
|||
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 }; |
|||
}, |
|||
}; |
|||
|
@ -1,116 +0,0 @@ |
|||
using System; |
|||
using System.Linq; |
|||
using System.Linq.Dynamic.Core; |
|||
using System.Threading.Tasks; |
|||
using EFCore.BulkExtensions; |
|||
using Microsoft.AspNetCore.SignalR; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using SettleAccount.Job.SignalR; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ; |
|||
|
|||
/// <summary>
|
|||
/// 消息表定时清理
|
|||
/// </summary>
|
|||
public class VmiAsyncMessageService : ApplicationService, IJobService, ITransientDependency |
|||
{ |
|||
private readonly IServiceProvider _serviceProvider; |
|||
|
|||
public VmiAsyncMessageService(IServiceProvider serviceProvider) |
|||
{ |
|||
this._serviceProvider = serviceProvider; |
|||
} |
|||
|
|||
public Task Invoke(IServiceProvider serviceProvider) |
|||
{ |
|||
using var scope = _serviceProvider.CreateScope(); |
|||
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>(); |
|||
db.Set<VmiMessage>().Where(o => o.isConsumed).BatchDelete(); |
|||
var count = db.Set<VmiMessage>().Where(o => !o.isConsumed).Count(); |
|||
scope.ServiceProvider.GetService<IHubContext<PageHub>>().Clients.All.ServerToClient("VmiBalance", count.ToString(), ""); |
|||
return Task.CompletedTask; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 库存事务定时备份
|
|||
/// </summary>
|
|||
public class VmiLogbackupService : ApplicationService, IJobService, ITransientDependency |
|||
{ |
|||
private readonly IServiceProvider _serviceProvider; |
|||
|
|||
public VmiLogbackupService(IServiceProvider serviceProvider) |
|||
{ |
|||
this._serviceProvider = serviceProvider; |
|||
} |
|||
|
|||
public Task Invoke(IServiceProvider serviceProvider) |
|||
{ |
|||
using var scope = _serviceProvider.CreateScope(); |
|||
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>(); |
|||
using var transaction = db.Database.BeginTransaction(); |
|||
try |
|||
{ |
|||
var task = db.Set<VmiSyncTask>().FirstOrDefault(o => o.Number == "Set_VmiLog"); |
|||
if (task != null) |
|||
{ |
|||
var now = DateTime.Now; |
|||
task.LastUpdate = now; |
|||
var query = db.Set<VmiLog>().Where(o => o.UpdatedTime >= task.LastUpdate && o.UpdatedTime < now); |
|||
foreach (var item in query) |
|||
{ |
|||
//同步到questdb
|
|||
} |
|||
} |
|||
} |
|||
catch |
|||
{ |
|||
transaction.Rollback(); |
|||
throw; |
|||
} |
|||
return Task.CompletedTask; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 库存余额定时备份
|
|||
/// </summary>
|
|||
public class VmiLogBalanceService : ApplicationService, IJobService, ITransientDependency |
|||
{ |
|||
private readonly IServiceProvider _serviceProvider; |
|||
|
|||
public VmiLogBalanceService(IServiceProvider serviceProvider) |
|||
{ |
|||
this._serviceProvider = serviceProvider; |
|||
} |
|||
|
|||
public Task Invoke(IServiceProvider serviceProvider) |
|||
{ |
|||
using var scope = _serviceProvider.CreateScope(); |
|||
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>(); |
|||
using var transaction = db.Database.BeginTransaction(); |
|||
try |
|||
{ |
|||
var task = db.Set<VmiSyncTask>().FirstOrDefault(o => o.Number == "Set_VmiBalance"); |
|||
if (task != null) |
|||
{ |
|||
var now = DateTime.Now; |
|||
task.LastUpdate = now; |
|||
var query = db.Set<VmiBalance>().Where(o => o.UpdatedTime >= task.LastUpdate && o.UpdatedTime < now); |
|||
foreach (var item in query) |
|||
{ |
|||
//同步到questdb
|
|||
} |
|||
} |
|||
} |
|||
catch |
|||
{ |
|||
transaction.Rollback(); |
|||
throw; |
|||
} |
|||
return Task.CompletedTask; |
|||
} |
|||
} |
@ -1,33 +0,0 @@ |
|||
using System; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
|||
|
|||
public class VmiSyncTask : Entity<Guid> |
|||
{ |
|||
public VmiSyncTask() |
|||
{ |
|||
ConcurrencyStamp = Guid.NewGuid().ToString("N"); |
|||
} |
|||
|
|||
public VmiSyncTask(Guid id) : base(id) |
|||
{ |
|||
ConcurrencyStamp = Guid.NewGuid().ToString("N"); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 任务名称
|
|||
/// </summary>
|
|||
public string Name { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 同步数据时间戳初始起点
|
|||
/// </summary>
|
|||
public string Number { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 最后同步时间
|
|||
/// </summary>
|
|||
public DateTime LastUpdate { get; set; } |
|||
public string ConcurrencyStamp { get; set; } |
|||
} |
@ -1,12 +0,0 @@ |
|||
using System; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
|||
|
|||
public class VmiShardingRecord : Entity<Guid> |
|||
{ |
|||
public string MainTable { get; set; } |
|||
public string ShardingTable { get; set; } |
|||
public DateTime Start { get; set; } |
|||
public DateTime End { get; set; } |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,186 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Migrations |
|||
{ |
|||
public partial class vmi18 : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "Set_VmiSyncTask"); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"), |
|||
columns: new[] { "ConcurrencyStamp", "Name" }, |
|||
values: new object[] { "89413f316dbf4647954b6669de927488", "同步结算库存" }); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"), |
|||
columns: new[] { "ConcurrencyStamp", "Name" }, |
|||
values: new object[] { "ebb73d81d23c4ed9a6ae59730d163f4b", "事务消息监控" }); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"), |
|||
column: "ConcurrencyStamp", |
|||
value: "e581ee4de97a46b1a1c0ba75a101c064"); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"), |
|||
column: "ConcurrencyStamp", |
|||
value: "a7be915b8a5541c58081c668219edfb7"); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"), |
|||
column: "ConcurrencyStamp", |
|||
value: "1fb801f3cbff422082d888ee8b5dab64"); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"), |
|||
column: "ConcurrencyStamp", |
|||
value: "df723d768280494e88d49734cc6e55e5"); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"), |
|||
column: "ConcurrencyStamp", |
|||
value: "93962cebd40f490b9df08b215b2c7bd2"); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"), |
|||
column: "ConcurrencyStamp", |
|||
value: "1c542463eb8746db949bcda48eabdbd8"); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"), |
|||
column: "ConcurrencyStamp", |
|||
value: "c5b29d7fa18e4b9cb8bc1e354d10c3ac"); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"), |
|||
columns: new[] { "ConcurrencyStamp", "Name" }, |
|||
values: new object[] { "25ec0d7c647f42d88882c4187af74201", "库存快照备份" }); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"), |
|||
column: "ConcurrencyStamp", |
|||
value: "7bbeaa02b39947c089eda7f4b05babb9"); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.CreateTable( |
|||
name: "Set_VmiSyncTask", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true), |
|||
LastUpdate = table.Column<DateTime>(type: "datetime2", nullable: false), |
|||
Name = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|||
Number = table.Column<string>(type: "nvarchar(max)", nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_Set_VmiSyncTask", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"), |
|||
columns: new[] { "ConcurrencyStamp", "Name" }, |
|||
values: new object[] { "b282d04b720a4453bac838a6d2702c5e", "同步库存" }); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"), |
|||
columns: new[] { "ConcurrencyStamp", "Name" }, |
|||
values: new object[] { "af7e13c541954124a384db3d957e96f8", "消息监控" }); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"), |
|||
column: "ConcurrencyStamp", |
|||
value: "1c63ae9d135a409da20ef2956f075921"); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"), |
|||
column: "ConcurrencyStamp", |
|||
value: "7d2a76e6327d46f4a93d15d91794de13"); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"), |
|||
column: "ConcurrencyStamp", |
|||
value: "448472749b8e4be587a6c8a9079bb4c1"); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"), |
|||
column: "ConcurrencyStamp", |
|||
value: "ffca086d0a884f118ec61e00c1ea11cf"); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"), |
|||
column: "ConcurrencyStamp", |
|||
value: "9758552b36a24d20bc4fd3efaa2c828a"); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"), |
|||
column: "ConcurrencyStamp", |
|||
value: "7ac5c23ffc254496b3bfeac777aceb78"); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"), |
|||
column: "ConcurrencyStamp", |
|||
value: "a9ef4db8c8c547ff880badc98ecb3fb7"); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"), |
|||
columns: new[] { "ConcurrencyStamp", "Name" }, |
|||
values: new object[] { "38598fb3653c48be8f63119787de2df8", "库存快照" }); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"), |
|||
column: "ConcurrencyStamp", |
|||
value: "298ad96e7d61427ba492ccdb1db7e900"); |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue