Browse Source

库存余额查询界面与导出一致

master
zhouhongjun 10 months ago
parent
commit
e9088d2e8f
  1. 116
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/balance.js
  2. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/vmi.js
  3. 32
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs

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

@ -1,6 +1,118 @@
import useVmi from "./vmi.js";
import balanSchema from "./vmi.js";
const schema = useVmi();
function balanceSchema() {
return {
title: "寄售库存",
type: "object",
properties: {
realPartCode: {
title: "厂内零件号",
type: "string",
rules: [
{
required: true,
},
],
},
// custPartCode: {
// title: "客户零件号",
// type: "string",
// rules: [
// {
// required: true,
// },
// ],
// },
// codeType,
// deliverBillType: Object.assign({ rules: [{ required: true }] }, deliverBillType),
qty: {
title: "数量",
type: "string",
input: "number",
rules: [
{
required: true,
},
],
},
billTime: {
title: "发运日期",
type: "string",
input: "datetime",
clearable: true,
},
// assembleData: {
// title: "订单日期",
// type: "string",
// input: "datetime",
// },
erpToLoc: {
title: "ERP库位",
type: "string",
rules: [
{
required: true,
},
],
},
// seq: {
// title: "EDI顺序号",
// type: "string",
// },
// orderNum: {
// title: "客户订单号",
// type: "string",
// rules: [
// {
// required: true,
// },
// ],
// },
// 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: Object.assign({ rules: [{ required: true }] }, deliverSubBillType),
vinCode: {
title: "EDI订单生产码",
type: "string",
rules: [
{
required: true,
},
],
},
// reMark: {
// title: "备注",
// type: "string",
// input: "textarea",
// },
},
};
}
const schema = balanceSchema();
const baseUrl = "settleaccount/vmi";
const queryUrl = `${baseUrl}/balance`;

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

@ -112,6 +112,8 @@ function useSchema() {
};
}
function useLogSchema() {
const result = useSchema();
result.properties = Object.assign(

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

@ -194,7 +194,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task<PagedResultDto<VmiBalanceDto>> Balance(RequestDto input)
public async Task<PagedResultDto<VmiBalanceNewDto>> Balance(RequestDto input)
{
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
@ -208,7 +208,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
query = string.IsNullOrEmpty(input.Sorting) ? query : DynamicQueryableExtensions.OrderBy(query, input.Sorting);
var query2 = query.GroupBy(o => new { o.ErpToLoc, o.RealPartCode, o.VinCode }).Select(o => new VmiBalanceDto { VinCode = o.Key.VinCode, ErpToLoc = o.Key.ErpToLoc, RealPartCode = o.Key.RealPartCode, Qty = o.Sum(o => o.ChangedQty), LastTime = o.Max(o => o.ChangedTime) }).Where(p => p.Qty != 0);
var query2 = query.GroupBy(o => new { o.ErpToLoc, o.RealPartCode, o.VinCode }).Select(o => new VmiBalanceNewDto { VinCode = o.Key.VinCode, ErpToLoc = o.Key.ErpToLoc, RealPartCode = o.Key.RealPartCode, Qty = o.Sum(o => o.ChangedQty), BillTime = o.Max(o => o.BillTime) }).Where(p => p.Qty != 0);
var totalCount = query2.Count();
//query = string.IsNullOrEmpty(input.Sorting) ? query : DynamicQueryableExtensions.OrderBy(query, input.Sorting);
//var query2 = query.GroupBy(o => new { o.ErpToLoc, o.RealPartCode,o.VinCode }).Select(o => new VmiBalanceDto { VinCode = o.Key.VinCode, ErpToLoc = o.Key.ErpToLoc, RealPartCode = o.Key.RealPartCode, Qty = o.Sum(o => o.Qty),LastTime=o.Max(o=>o.ChangedTime) });
@ -216,7 +216,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var entities = await query2.PageBy(input.SkipCount, input.MaxResultCount).ToListAsync().ConfigureAwait(false);
//var entities = await _balanceRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false);
//var totalCount = await _balanceRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false);
return new PagedResultDto<VmiBalanceDto>(totalCount, entities);
return new PagedResultDto<VmiBalanceNewDto>(totalCount, entities);
}
/// <summary>
@ -231,14 +231,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options;
using var db = new SettleAccountDbContext(options);
var query = db.Set<VmiLog>().FromSqlRaw("select VinCode,ErpToLoc,RealPartCode,ChangedQty ,ChangedTime from Set_VmiLog");
var query = db.Set<VmiLog>().FromSqlRaw("select VinCode,ErpToLoc,RealPartCode,ChangedQty ,BillTime from Set_VmiLog");
var filters = input.Filters.ToLambda<VmiLog>();
if (input.Filters.Count > 0)
{
query = query.Where(input.Filters.ToLambda<VmiLog>());
}
query = string.IsNullOrEmpty(input.Sorting) ? query : DynamicQueryableExtensions.OrderBy(query, input.Sorting);
var query2 = query.GroupBy(o => new { o.ErpToLoc, o.RealPartCode, o.VinCode }).Select(o => new VmiBalanceDto { VinCode = o.Key.VinCode, ErpToLoc = o.Key.ErpToLoc, RealPartCode = o.Key.RealPartCode, Qty = o.Sum(o => o.ChangedQty), LastTime = o.Max(o => o.ChangedTime) }).Where(p => p.Qty != 0);
var query2 = query.GroupBy(o => new { o.ErpToLoc, o.RealPartCode, o.VinCode }).Select(o => new VmiBalanceNewDto { VinCode = o.Key.VinCode, ErpToLoc = o.Key.ErpToLoc, RealPartCode = o.Key.RealPartCode, Qty = o.Sum(o => o.ChangedQty), BillTime = o.Max(o => o.BillTime) }).Where(p => p.Qty != 0);
var entities = query2.ToList();
// var entities = await _balanceRepository.GetListByFilterAsync(input.Filters).ConfigureAwait(false);
@ -1317,12 +1317,34 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
[Display(Name = "数量", Order = 4)]
public decimal Qty { get; set; }
[Display(Name = "最后更新时间", Order = 5)]
public DateTime? LastTime { get; set; }
}
public class VmiBalanceNewDto
{
[Display(Name = "生产码", Order = 1)]
public string VinCode { get; set; }
[Display(Name = "ERP库位", Order = 2)]
public string ErpToLoc { get; set; }
[Display(Name = "厂内零件号", Order = 3)]
public string RealPartCode { get; set; }//原始
[Display(Name = "数量", Order = 4)]
public decimal Qty { get; set; }
[Display(Name = "发运时间", Order = 5)]
public DateTime? BillTime { get; set; }
}

Loading…
Cancel
Save