Browse Source

update

master
wanggang 1 year ago
parent
commit
992fe88630
  1. 9
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/list/index.js
  2. 262
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/inventory/adjust.js
  3. 139
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/inventory/backup.js
  4. 123
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/inventory/balance.js
  5. 248
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/inventory/log.js
  6. 88
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/inventory/vmi.js
  7. 8
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/adjust.js
  8. 8
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/backup.js
  9. 4
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/balance.js
  10. 0
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/inventory.js
  11. 22
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/vmi.js
  12. 111
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs

9
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/list/index.js

@ -23,9 +23,12 @@ export default {
<el-col>
<app-form inline mode="query" label-position="left" :schema="config.query.schema" v-model="queryModel" @submit="load" :hideButton="true" :isQueryForm="true">
<template v-for="item in filterList.filter(o=>!o.hidden&&o.readOnly)">
<el-form-item :label="config.edit.schema.properties[item.column].title">
<app-form-input v-model="item" :schema="config.edit.schema.properties[item.column]" prop="value" />
</el-form-item>
<template v-if="config.edit.schema.properties[item.column]?.title">
<el-form-item :label="config.edit.schema.properties[item.column].title">
<app-form-input v-model="item" :schema="config.edit.schema.properties[item.column]" prop="value" />
</el-form-item>
</template>
<div v-else>{{item.column}}</div>
</template>
</app-form>
<template v-for="item in buttons">

262
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/inventory/adjust.js

@ -1,262 +0,0 @@
import { billType, codeType, subBillType } from "./inventory.js";
const schema = {
title: "寄售库存调整",
type: "object",
properties: {
logType: {
title: "库存事务分类",
type: "string",
default: "Type500",
hidden: true,
},
changedType: {
title: "变动类型",
type: "string",
default: "in",
hidden: true,
},
partCode: {
title: "LU零件号",
type: "string",
rules: [
{
required: true,
},
],
},
customerPartCode: {
title: "客户零件号",
type: "string",
rules: [
{
required: true,
},
],
},
codeType,
billType,
qty: {
title: "数量",
type: "number",
input: "number",
},
billTime: {
title: "发运日期",
type: "string",
input: "datetime",
},
changedNumber: {
title: "变动单号",
type: "string",
rules: [
{
required: true,
},
],
},
changedTime: {
title: "变动时间",
type: "string",
input: "datetime",
},
deliverTime: {
title: "订单日期",
type: "string",
input: "datetime",
},
erpToLoc: {
title: "ERP库位",
type: "string",
rules: [
{
required: true,
},
],
},
orderNum: {
title: "EDI原始订单号",
type: "string",
rules: [
{
required: true,
},
],
},
changedBy: {
title: "变动人",
type: "string",
rules: [
{
required: true,
},
],
},
subBillType,
reMark: {
title: "备注",
type: "string",
input: "textarea",
},
vinCode: {
title: "EDI订单生产码",
type: "string",
rules: [
{
required: true,
},
],
},
billNum: {
title: "WMS发运单号",
type: "string",
rules: [
{
required: true,
},
],
},
},
};
const baseUrl = "settleaccount/vmi";
const queryUrl = `${baseUrl}/log`;
const detailsUrl = `${baseUrl}/get/%s`;
const createUrl = "settleaccount/vmi/edit-balance";
const updateUrl = `${baseUrl}/update/%s`;
const deleteUrl = `${baseUrl}/delete-list`;
const importUrl = `${baseUrl}/import`;
const exportUrl = `${baseUrl}/export`;
const queryMethod = "POST";
const detailsMethod = "POST";
const createMethod = "POST";
const updateMethod = "POST";
const deleteMethod = "POST";
const importMethod = "POST";
const exportMethod = "POST";
export default function () {
return {
query: {
url: queryUrl,
method: queryMethod,
hasFilter: true,
schema: {
title: "通用代码",
type: "object",
properties: {
logTypes: { type: "array", hidden: true, default: ["Type500", "Type600"] },
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: "createdDate",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "lu",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "tmpe4",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "vinCode",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "codeType",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "proType",
action: "like",
value: null,
readOnly: true,
},
// {
// logic: "and",
// column: "logType",
// action: "in",
// value: "Type500, Type600",
// 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,
detailsMethod,
createMethod,
updateMethod,
deleteMethod,
importMethod,
exportMethod,
schema: schema,
},
};
}

139
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/inventory/backup.js

@ -1,139 +0,0 @@
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";
export default function () {
return {
query: {
url: queryUrl,
method: queryMethod,
hasFilter: true,
autoSubmit: true,
disableQueryOnLoad: true,
schema: {
title: "时点库存余额查询",
type: "object",
properties: {
name: {
title: "时间",
type: "string",
input: "select",
url: "settleaccount/vmi/snapshot",
value: "name",
label: "name",
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: "partCode",
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: "billType",
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,
},
};
}

123
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/inventory/balance.js

@ -1,123 +0,0 @@
import useVmi from "./vmi.js";
const schema = useVmi();
const baseUrl = "settleaccount/vmi";
const queryUrl = `${baseUrl}/balance`;
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}/balance-export`;
const queryMethod = "POST";
const detailsMethod = "POST";
const createMethod = "POST";
const updateMethod = "POST";
const deleteMethod = "POST";
const importMethod = "POST";
const exportMethod = "POST";
export default function () {
return {
query: {
url: queryUrl,
method: queryMethod,
hasFilter: true,
schema: {
title: "寄售库存",
type: "object",
properties: {
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: "partCode",
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: "billType",
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,
detailsMethod,
createMethod,
updateMethod,
deleteMethod,
importMethod,
exportMethod,
schema: schema,
},
};
}

248
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/inventory/log.js

@ -1,248 +0,0 @@
import { billType, codeType, subBillType } from "./inventory.js";
//变动单据号、发生时间、生产码类型、、订单号、库位、变动数、EDI顺序号、备注、变动类型(In、Out标识)、发货类型(JIS\JIT\买单件\备件等)、
//实扣LU零件号、实扣客户零件号、结算LU零件号、结算客户零件号、实扣生产码、结算生产码
//库位、开始结束时间段、发货类型、生产码、生产码类型、LU零件号、订单号
const options = [
{ value: null, label: "" },
{ value: true, label: "是" },
{ value: false, label: "否" },
];
const schema = {
title: "库存事务日志",
type: "object",
properties: {
partCode: {
title: "LU零件号",
type: "string",
},
customerPartCode: {
title: "客户零件号",
type: "string",
},
codeType,
billType,
qty: {
title: "数量",
type: "number",
},
billTime: {
title: "发运日期",
type: "string",
input: "datetime",
},
deliverTime: {
title: "订单日期",
type: "string",
input: "datetime",
},
erpToLoc: {
title: "ERP库位",
type: "string",
},
seq: {
title: "EDI顺序号",
type: "string",
},
orderNum: {
title: "客户订单号",
type: "string",
},
uniqueCode: {
title: "塑件唯一码",
type: "string",
},
matchNumber: {
title: "EDI总成号",
type: "string",
},
pjsNum: {
title: "PJIS生产顺序号",
type: "string",
},
changedNumber: {
title: "变动单号",
type: "string",
},
changedTime: {
title: "变动时间",
type: "string",
input: "datetime",
},
changedBy: {
title: "变动人",
type: "string",
},
partCode2: {
title: "结算厂内零件号",
type: "string",
},
realCode: {
title: "WMS实发生产码",
type: "string",
},
vinCode: {
title: "EDI订单生产码",
type: "string",
},
settlementVinCode: {
title: "结算生产码",
type: "string",
},
subBillType,
isReplenished: {
title: "是否补货",
type: "boolean",
input: "select",
options,
},
configcode: {
title: "配置码",
type: "string",
},
},
};
const baseUrl = "settleaccount/vmi";
const queryUrl = `${baseUrl}/log`;
const detailsUrl = `${baseUrl}/get/%s`;
const createUrl = `${baseUrl}/create`;
const updateUrl = `${baseUrl}/update/%s`;
const deleteUrl = `${baseUrl}/delete-list`;
const importUrl = `${baseUrl}/log-import`;
const exportUrl = `${baseUrl}/log-export`;
const queryMethod = "POST";
const detailsMethod = "POST";
const createMethod = "POST";
const updateMethod = "POST";
const deleteMethod = "POST";
const importMethod = "POST";
const exportMethod = "POST";
export default function () {
return {
query: {
url: queryUrl,
method: queryMethod,
hasFilter: true,
schema: {
title: "通用代码",
type: "object",
properties: {
// logTypes: { type: "array", hidden: true, default: ["Type200", "Type400"] },
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: "billType",
action: "equal",
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: "partCode",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "orderNum",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "billTime",
action: "biggerThanOrEqual",
value: null,
readOnly: true,
hidden: true,
},
{
logic: "and",
column: "billTime",
action: "smallThanOrEqual",
value: null,
readOnly: true,
hidden: true,
},
],
},
skipCount: {
hidden: true,
default: 0,
},
maxResultCount: {
hidden: true,
default: 10,
},
sorting: {
hidden: true,
},
},
},
},
table: {
schema: schema,
},
edit: {
detailsUrl,
createUrl,
updateUrl,
deleteUrl,
importUrl,
exportUrl,
detailsMethod,
createMethod,
updateMethod,
deleteMethod,
importMethod,
exportMethod,
schema: schema,
},
};
}

88
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/inventory/vmi.js

@ -1,88 +0,0 @@
import { codeType, deliverBillType, deliverSubBillType } from "../_options.js";
export default function () {
return {
title: "寄售库存",
type: "object",
properties: {
// id: {
// type: "string",
// hidden: true,
// showForList: false,
// },
// lu: {
// title: "LU零件号",
// type: "string",
// },
realPartCode: {
title: "LU零件号",
type: "string",
},
custPartCode: {
title: "客户零件号",
type: "string",
},
codeType,
deliverBillType,
qty: {
title: "数量",
type: "string",
},
billTime: {
title: "发运日期",
type: "string",
input: "datetime",
},
assembleData: {
title: "订单日期",
type: "string",
input: "datetime",
},
erpToLoc: {
title: "ERP库位",
type: "string",
},
seq: {
title: "EDI顺序号",
type: "string",
},
orderNum: {
title: "客户订单号",
type: "string",
},
uniqueCode: {
title: "塑件唯一码",
type: "string",
},
matchNumber: {
title: "EDI总成号",
type: "string",
},
pjsNum: {
title: "PJIS生产顺序号",
type: "string",
},
realCode: {
title: "实际生产码",
type: "string",
},
configcode: {
title: "配置码",
type: "string",
},
// factory: {
// title: "工厂",
// type: "string",
// },
// deliverSubBillType,
vinCode: {
title: "EDI订单生产码",
type: "string",
},
reMark: {
title: "备注",
type: "string",
},
},
};
}

8
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/adjust.js

@ -60,8 +60,8 @@ export default function () {
},
{
logic: "and",
column: "billType",
action: "equal",
column: "realPartCode",
action: "like",
value: null,
readOnly: true,
},
@ -81,8 +81,8 @@ export default function () {
},
{
logic: "and",
column: "partCode",
action: "like",
column: "deliverBillType",
action: "equal",
value: null,
readOnly: true,
},

8
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/backup.js

@ -1,6 +1,6 @@
import useSchema from "./vmi.js";
import useVmi from "./vmi.js";
const schema = useSchema();
const schema = useVmi();
const baseUrl = "settleaccount/vmi";
const queryUrl = `${baseUrl}/backup`;
@ -73,7 +73,7 @@ export default function () {
},
{
logic: "and",
column: "partCode",
column: "realPartCode",
action: "like",
value: null,
readOnly: true,
@ -94,7 +94,7 @@ export default function () {
},
{
logic: "and",
column: "billType",
column: "deliverBillType",
action: "equal",
value: null,
readOnly: true,

4
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/balance.js

@ -1,6 +1,6 @@
import useSchema from "./vmi.js";
import useVmi from "./vmi.js";
const schema = useSchema();
const schema = useVmi();
const baseUrl = "settleaccount/vmi";
const queryUrl = `${baseUrl}/balance`;

0
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/inventory/inventory.js → code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/inventory.js

22
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/vmi.js

@ -5,16 +5,16 @@ function useSchema() {
title: "寄售库存",
type: "object",
properties: {
partCode: {
realPartCode: {
title: "LU零件号",
type: "string",
},
customerPartCode: {
custPartCode: {
title: "客户零件号",
type: "string",
},
codeType,
billType: deliverBillType,
deliverBillType,
qty: {
title: "数量",
type: "string",
@ -24,7 +24,7 @@ function useSchema() {
type: "string",
input: "datetime",
},
deliverTime: {
assembleData: {
title: "订单日期",
type: "string",
input: "datetime",
@ -53,8 +53,8 @@ function useSchema() {
title: "PJIS生产顺序号",
type: "string",
},
reMark: {
title: "备注",
realCode: {
title: "实际生产码",
type: "string",
},
configcode: {
@ -65,17 +65,13 @@ function useSchema() {
title: "工厂",
type: "string",
},
subBillType: deliverSubBillType,
realCode: {
title: "WMS实发生产码",
type: "string",
},
deliverSubBillType,
vinCode: {
title: "EDI订单生产码",
type: "string",
},
settlementVinCode: {
title: "结算生产码",
reMark: {
title: "备注",
type: "string",
},
},

111
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs

@ -6,9 +6,11 @@ using System.IO;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Reflection;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using ClosedXML.Excel;
using EFCore.BulkExtensions;
using LinqToDB.Data;
using LinqToDB.EntityFrameworkCore;
using Magicodes.ExporterAndImporter.Core;
@ -687,3 +689,112 @@ public class LogRequestDto : RequestDto
{
public List<VmiLogType> LogTypes { get; set; } = new List<VmiLogType>();
}
public class VmiAsyncBalanceService : ApplicationService, IJobService, ITransientDependency
{
private readonly IServiceProvider _serviceProvider;
public VmiAsyncBalanceService(IServiceProvider serviceProvider)
{
this._serviceProvider = serviceProvider;
}
public async Task Invoke(IServiceProvider serviceProvider)
{
using var scope = _serviceProvider.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>();
var query = db.Set<VmiMessage>();
using var dc = db.CreateLinqToDBConnection();
dc.BeginTransaction();
try
{
var repo = db.Set<VmiBalance>();
foreach (var message in query)
{
var log = JsonSerializer.Deserialize<VmiLog>(message.Message);
var balance = db.Set<VmiBalance>().FirstOrDefault(
o => o.DeliverBillType == log.DeliverBillType &&
o.CodeType == log.CodeType &&
o.DeliverBillType == log.DeliverBillType &&
o.VinCode == log.VinCode &&
o.ErpToLoc == log.ErpToLoc &&
o.OrderNum == log.OrderNum &&
o.factory == log.factory &&
o.Configcode == log.Configcode);
if (balance == null)
{
balance = new VmiBalance(GuidGenerator.Create());
balance.InjectFrom(log);
await repo.AddAsync(balance).ConfigureAwait(false);
log.InjectFrom(balance);
}
else
{
var logType = log.LogType;
var qty = balance.Qty + log.Qty;
if (logType == VmiLogType.Type100)
{
//发运入库,负库存字段需要更新
if (balance.Qty < decimal.Zero)
{
balance.InjectFrom(log);
}
}
else if (logType == VmiLogType.Type300)
{
//反结入库,只更新库存
}
else if (logType == VmiLogType.Type500)
{
//调整入库,更新库存和其他字段
balance.InjectFrom(log);
}
// 更新库存
balance.Qty = qty;
if (balance.Qty == decimal.Zero)
{
//删除0库存
repo.Remove(balance);
}
if (logType == VmiLogType.Type100 && balance.Qty < decimal.Zero && log.Qty > 0)
{
//更新补货
var log2 = db.Set<VmiLog>().FirstOrDefault(o => o.Id == log.Id);
if (log2 != null)
{
log2.IsReplenished = true;
}
}
}
message.isConsumed = true;
}
dc.Transaction.Commit();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
dc.Transaction.Rollback();
throw;
}
}
}
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;
}
}

Loading…
Cancel
Save