学 赵 1 year ago
parent
commit
b7362b6ecb
  1. BIN
      MinIO.zip
  2. 3
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Program.cs
  3. 4
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/list/index.js
  4. 3
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/code-setting.js
  5. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/ke-hu.js
  6. 1
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/role.js
  7. 4
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/user.js
  8. 4
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/version.js
  9. 1
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/input/edi.js
  10. 3
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/cost.js
  11. 132
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/sum.js
  12. 4
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/business.js
  13. 4
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js
  14. 44
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/sum.js
  15. 18
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs
  16. 16
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs
  17. 21
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs
  18. 25
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
  19. 62
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
  20. 50
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs
  21. 49
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs
  22. 20
      code/src/Modules/SettleAccount/src/SettleAccount.Domain.Shared/Enums/EnumWMSSend.cs
  23. 44
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs

BIN
MinIO.zip

Binary file not shown.

3
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Program.cs

@ -1,4 +1,5 @@
using System;
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
@ -15,7 +16,7 @@ public class Program
.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true, reloadOnChange: true);
Log.Logger = new LoggerConfiguration()
.WriteTo.Async(c => c.File("Logs/logs.txt"
.WriteTo.Async(c => c.File(Path.Combine(Directory.GetCurrentDirectory(), "../Logs/logs.txt")
, rollingInterval: RollingInterval.Day
, rollOnFileSizeLimit: true
, fileSizeLimitBytes: 30 * 1024 * 1024))

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

@ -91,7 +91,7 @@ export default {
</el-table-column>
</template>
<template v-else>
<template v-if="showColumn(item,key)">
<template v-if="!item.hideForList&&showColumn(item,key)">
<el-table-column :prop="key" sortable="custom" :sort-orders="['descending', 'ascending', null]" :filters="getFilters(item,key)">
<template #header="scope">{{item.title}}</template>
<template #default="scope">
@ -411,7 +411,7 @@ export default {
const getColumns = (schema) => {
Object.keys(schema.properties).forEach((propertyName) => {
const property = schema.properties[propertyName];
if (property.showForList || (property.type !== "object" && property.type !== "array" && !property.hidden)) {
if (!property.hideForList || (property.type !== "object" && property.type !== "array" && !property.hidden)) {
columns.value.push({ name: propertyName, title: property.title, checked: true });
}
});

3
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/code-setting.js

@ -6,7 +6,6 @@ const schema = {
title: "项目",
type: "string",
readOnly: true,
showForList: true,
rules: [
{
required: true,
@ -17,7 +16,6 @@ const schema = {
title: "值",
type: "string",
readOnly: true,
showForList: true,
rules: [
{
required: true,
@ -28,7 +26,6 @@ const schema = {
title: "描述",
type: "string",
input: "textarea",
showForList: true,
rules: [
{
required: true,

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/ke-hu.js

@ -6,7 +6,6 @@ const schema = {
title: "业务类别",
type: "string",
readOnly: true,
showForList: true,
rules: [
{
required: true,
@ -17,7 +16,6 @@ const schema = {
title: "库位",
type: "string",
readOnly: true,
showForList: true,
rules: [
{
required: true,

1
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/role.js

@ -6,7 +6,6 @@ const schema = {
name: {
title: "角色名",
type: "string",
showForList: true,
readOnly: true,
rules: [
{

4
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/user.js

@ -7,7 +7,6 @@ const schema = {
title: "用户名",
type: "string",
readOnly: true,
showForList: true,
rules: [
{
required: true,
@ -37,7 +36,6 @@ const schema = {
name: {
title: "姓名",
type: "string",
showForList: true,
rules: [
{
required: true,
@ -48,7 +46,6 @@ const schema = {
phoneNumber: {
title: "电话",
type: "string",
showForList: true,
rules: [
{
required: true,
@ -59,7 +56,6 @@ const schema = {
email: {
title: "邮箱",
type: "string",
showForList: true,
rules: [{ required: true }, { pattern: "^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z]{2,4})+$", message: "%s必须是正确的格式" }],
},
roleNames: {

4
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/version.js

@ -6,7 +6,6 @@ const schema = {
title: "年度",
type: "string",
hidden: true,
showForList: true,
rules: [
{
required: true,
@ -17,7 +16,6 @@ const schema = {
title: "期间",
type: "string",
hidden: true,
showForList: true,
rules: [
{
required: true,
@ -29,7 +27,6 @@ const schema = {
type: "string",
input: "month",
format: "YYYYMM",
showForList: true,
watch: "(model,value)=>{model.year=value.substr(0,4);model.period=value.substr(4,2);}",
rules: [
{
@ -41,7 +38,6 @@ const schema = {
state: {
title: "状态",
type: "boolean",
showForList: true,
default: true,
rules: [
{

1
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/input/edi.js

@ -41,7 +41,6 @@ const schema = {
id: {
type: "string",
hidden: true,
showForList: false,
},
},
};

3
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/cost.js

@ -6,7 +6,6 @@ const schema = {
title: "项目",
type: "string",
readOnly: true,
showForList: true,
rules: [
{
required: true,
@ -17,7 +16,6 @@ const schema = {
title: "值",
type: "string",
readOnly: true,
showForList: true,
rules: [
{
required: true,
@ -28,7 +26,6 @@ const schema = {
title: "描述",
type: "string",
input: "textarea",
showForList: true,
rules: [
{
required: true,

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

@ -0,0 +1,132 @@
import useVmi from "./vmi.js";
const schema = Object.assign({}, useVmi());
Object.keys(schema.properties).forEach((o) => {
if (o !== "erpToLoc" && o !== "realPartCode" && o !== "qty") {
schema.properties[o].hideForList = true;
}
});
const baseUrl = "settleaccount/vmi";
const queryUrl = `${baseUrl}/balance-sum`;
const exportUrl = `${baseUrl}/balance-sum-export`;
const queryMethod = "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: "billTime",
action: "biggerThanOrEqual",
value: null,
readOnly: true,
title: "发运开始",
},
{
logic: "and",
column: "billTime",
action: "smallThan",
value: null,
readOnly: true,
title: "发运结束",
},
{
logic: "and",
column: "erpToLoc",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "realPartCode",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "custPartCode",
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: {
exportUrl,
exportMethod,
schema: schema,
},
};
}

4
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/business.js

@ -404,6 +404,10 @@ export default [
...createPage("balance", "title=库存余额查询"),
children: [createButton("query", "title=查询&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")],
},
{
...createPage("sum", "title=库存余额汇总"),
children: [createButton("query", "title=查询&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")],
},
{
...createPage("backup", "title=时点库存余额查询"),
children: [

4
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js

@ -234,6 +234,10 @@ export default {
type: "string",
title: "零件号",
},
partDesc: {
type: "string",
title: "零件描述",
},
price: {
type: "number",
title: "单价",

44
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/sum.js

@ -0,0 +1,44 @@
import AppList from "../../components/list/index.js";
import html from "html";
import { ref, onMounted, onUnmounted } from "vue";
import { useRoute } from "vue-router";
import { ElNotification } from "element-plus";
import request from "../../request/index.js";
export default {
components: { AppList },
template: html`<app-list v-if="config" :config="config" @command="onCommand" />`,
setup() {
const config = ref(null);
const route = useRoute();
const onCommand = async (item, rows) => {
console.log(item.path, item, rows);
};
const showMessage = async (data) => {
await ElNotification.closeAll();
ElNotification({
position: "bottom-right",
title: "提示",
message: `待同步库存数量: ${data}`,
duration: 0,
});
};
const event = "VmiBalance";
onMounted(async () => {
const model = "vmi/sum";
const useConfig = (await import(`../../models/${model}.js`)).default;
config.value = useConfig(route.meta?.businessType, route.meta);
const result = await request("settleaccount/vmi-async-message/get-message-count", null, { method: "POST" });
if (!result.errors) {
showMessage(result.data);
}
PubSub.subscribe(event, async (_, data) => {
if (route.path === "/vmi/sum") {
showMessage(data);
}
});
});
onUnmounted(() => PubSub.unsubscribe(event));
return { config, onCommand };
},
};

18
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs

@ -122,14 +122,12 @@ public class PriceListImportDto
[ImporterHeader(IsIgnore = true)]
[ExcelImporterHeadDesc(Row = 1, Cell = 1)]
public string Date { get; set; }
/// <summary>
/// 合同号
/// </summary>
[ImporterHeader(IsIgnore = true)]
[ExcelImporterHeadDesc(Row = 2, Cell = 1)]
public string ContractNo { get; set; }
/// <summary>
/// 零件号
/// </summary>
@ -137,30 +135,36 @@ public class PriceListImportDto
[Required(ErrorMessage = "{0}是必填项")]
[ImporterHeader(Name = "*Part No.")]
public string PartNo { get; set; }
/// <summary>
/// 价格
/// </summary>
[ImporterHeader(Name = "Total Price (Old)")]
public string TotalPrice { get; set; }
public decimal TotalPrice { get; set; }
/// <summary>
/// 开始时间
/// </summary>
[ImporterHeader(Name = "*Valid From")]
public DateTime ValidFrom { get; set; }
/// <summary>
/// 结束时间
/// </summary>
[ImporterHeader(Name = "*Valid To")]
public DateTime ValidTo { get; set; }
/// <summary>
/// 客户编码
/// </summary>
[ImporterHeader(Name = "*Plant")]
public string Plant { get; set; }
/// <summary>
/// ES1
/// </summary>
[ImporterHeader(Name = "ES1")]
public string ES1 { get; set; }
/// <summary>
/// ES2
/// </summary>
[ImporterHeader(Name = "ES2")]
public string ES2 { get; set; }
}
public class PriceListRequestDto : PagedAndSortedResultRequestDto

16
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization;
@ -324,14 +325,15 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
{
bbacSaDetails.ForEach(bbacSaDetail =>
{
var lus = bbacSaDetail.LU.Split(" ").ToList();
var lus = bbacSaDetail.LU.Split(new string(' ', 4)).ToList();
bbacSaDetail.LU = lus[0].Replace(" ", "");
if (lus.Count > 1)
{
lus.RemoveAt(0);
var luAssemble = lus.Select(t => t.Replace(" ", ""));
bbacSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index);
bbacSaDetail.LU += luAssemble.Aggregate(new string(' ', 6), (current, index) => current + index);
}
bbacSaDetail.PN = Regex.Replace(bbacSaDetail.PN, "['‘’]", "");
});
return GroupPnLu(bbacSaDetails);
@ -404,10 +406,16 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
bbacSaDetails.ForEach(bbacSaDetail =>
{
//根据物料号、结算日期获取价格
var priceListEntity = priceListEntitys.FirstOrDefault(t => t.LU == bbacSaDetail.LU && bbacSaDetail.SettleDate >= t.BeginTime && bbacSaDetail.SettleDate <= t.EndTime);
//根据物料号、结算日期获取价格
var priceListEntity = priceListEntitys
.Where(t => t.LU == bbacSaDetail.LU)
.Where(t => bbacSaDetail.SettleDate >= t.BeginTime && bbacSaDetail.SettleDate <= t.EndTime)
.OrderByDescending(t => t.Date)
.ThenByDescending(t => t.CreationTime)
.FirstOrDefault();
bbacSaDetail.Price = priceListEntity?.Price ?? 0;
bbacSaDetail.PartCode = materialRelationshipEntitys.FirstOrDefault(t => t.SettleMaterialCode == bbacSaDetail.LU)?.ErpMaterialCode ?? bbacSaDetail.LU.Replace(" ", "-");
bbacSaDetail.PartCode = materialRelationshipEntitys.FirstOrDefault(t => t.SettleMaterialCode == bbacSaDetail.LU)?.ErpMaterialCode ?? bbacSaDetail.LU.Replace(new string(' ', 6), "-");
});
#endregion

21
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs

@ -1,9 +1,8 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using DocumentFormat.OpenXml.Bibliography;
using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
@ -286,14 +285,15 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
hbpoSaDetails.ForEach(hbpoSaDetail =>
{
hbpoSaDetail.SetId(GuidGenerator.Create());
var lus = hbpoSaDetail.LU.Split(" ").ToList();
var lus = hbpoSaDetail.LU.Split(new string(' ', 4)).ToList();
hbpoSaDetail.LU = lus[0].Replace(" ", "");
if (lus.Count > 1)
{
lus.RemoveAt(0);
var luAssemble = lus.Select(t => t.Replace(" ", ""));
hbpoSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index);
hbpoSaDetail.LU += luAssemble.Aggregate(new string(' ', 6), (current, index) => current + index);
}
hbpoSaDetail.PN = Regex.Replace(hbpoSaDetail.PN, "['‘’]", "");
hbpoSaDetail.CustomerPartCodeNoSpace = hbpoSaDetail.LU.Replace(" ", "");
hbpoSaDetail.Version = Version;
});
@ -354,13 +354,13 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
hbpoSaDetails.ForEach(hbpoSaDetail =>
{
hbpoSaDetail.SetId(GuidGenerator.Create());
List<string> lus = hbpoSaDetail.LU.Split(" ").ToList();
List<string> lus = hbpoSaDetail.LU.Split(new string(' ', 4)).ToList();
hbpoSaDetail.LU = lus[0].Replace(" ", "");
if (lus.Count > 1)
{
lus.RemoveAt(0);
var luAssemble = lus.Select(t => t.Replace(" ", ""));
hbpoSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index);
hbpoSaDetail.LU += luAssemble.Aggregate(new string(' ', 6), (current, index) => current + index);
}
hbpoSaDetail.BillNum = hbpoSaBillNum;
@ -376,10 +376,15 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
hbpoSaDetails.ForEach(hbpoSaDetail =>
{
//根据物料号、结算日期获取价格
var priceListEntity = priceListEntitys.FirstOrDefault(t => t.LU == hbpoSaDetail.LU && hbpoSaDetail.SettleDate >= t.BeginTime && hbpoSaDetail.SettleDate <= t.EndTime);
var priceListEntity = priceListEntitys
.Where(t => t.LU == hbpoSaDetail.LU)
.Where(t => hbpoSaDetail.SettleDate >= t.BeginTime && hbpoSaDetail.SettleDate <= t.EndTime)
.OrderByDescending(t => t.Date)
.ThenByDescending(t => t.CreationTime)
.FirstOrDefault();
hbpoSaDetail.Price = priceListEntity?.Price ?? 0;
hbpoSaDetail.PartCode = materialRelationshipEntitys.FirstOrDefault(t => t.SettleMaterialCode == hbpoSaDetail.LU)?.ErpMaterialCode ?? hbpoSaDetail.LU.Replace(" ", "-");
hbpoSaDetail.PartCode = materialRelationshipEntitys.FirstOrDefault(t => t.SettleMaterialCode == hbpoSaDetail.LU)?.ErpMaterialCode ?? hbpoSaDetail.LU.Replace(new string(' ', 6), "-");
});
#endregion

25
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs

@ -3,14 +3,13 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using EFCore.BulkExtensions;
using Magicodes.ExporterAndImporter.Core.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using OfficeOpenXml;
using SettleAccount.Domain.BQ;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
@ -25,7 +24,6 @@ using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.Filter;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ;
@ -398,14 +396,15 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
{
pubSaDetails.ForEach(pubSaDetail =>
{
var lus = pubSaDetail.LU.Split(" ").ToList();
var lus = pubSaDetail.LU.Split(new string(' ', 4)).ToList();
pubSaDetail.LU = lus[0].Replace(" ", "");
if (lus.Count > 1)
{
lus.RemoveAt(0);
var luAssemble = lus.Select(t => t.Replace(" ", ""));
pubSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index);
pubSaDetail.LU += luAssemble.Aggregate(new string(' ', 6), (current, index) => current + index);
}
pubSaDetail.PN = Regex.Replace(pubSaDetail.PN, "['‘’]", "");
});
return GroupPnLu(pubSaDetails);
@ -440,7 +439,6 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
importPubSaDetail.KeyCode = importPubSaDetail.PN + importPubSaDetail.LU;
importPubSaDetail.Version = _version;
importPubSaDetail.BusinessType = businessType;
importPubSaDetail.Site = "工厂";
});
var lus = pubSaDetails.Select(t => t.LU).Distinct().ToList();
if (businessType == EnumBusinessType.BeiJian)
@ -450,7 +448,12 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
pubSaDetails.ForEach(importPubSaDetail =>
{
//根据物料号、结算日期获取价格
var priceListEntity = priceListEntitys.Find(t => t.LU == importPubSaDetail.LU && importPubSaDetail.SettleDate >= t.BeginDate && importPubSaDetail.SettleDate <= t.EndDate);
var priceListEntity = priceListEntitys
.Where(t => t.LU == importPubSaDetail.LU)
.Where(t => importPubSaDetail.SettleDate >= t.BeginDate && importPubSaDetail.SettleDate <= t.EndDate)
.OrderByDescending(t => t.Date)
.ThenByDescending(t => t.CreationTime)
.FirstOrDefault();
importPubSaDetail.Price = priceListEntity?.Price ?? 0;
});
}
@ -461,7 +464,11 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
pubSaDetails.ForEach(importPubSaDetail =>
{
//根据物料号、结算日期获取价格
var priceListEntity = priceListEntitys.FirstOrDefault(t => t.LU == importPubSaDetail.LU && importPubSaDetail.SettleDate >= t.BeginTime && importPubSaDetail.SettleDate <= t.EndTime);
var priceListEntity = priceListEntitys
.Where(t => t.LU == importPubSaDetail.LU)
.Where(t => importPubSaDetail.SettleDate >= t.BeginTime && importPubSaDetail.SettleDate <= t.EndTime)
.OrderByDescending(t => t.Date)
.FirstOrDefault();
importPubSaDetail.Price = priceListEntity?.Price ?? 0;
});
}
@ -473,7 +480,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
var seAllMaterialRelationships = materialRelationshipEntitys.Union(materialRelationships);
pubSaDetails.ForEach(pubSaDetail =>
{
pubSaDetail.PartCode = materialRelationshipEntitys.FirstOrDefault(t => t.SettleMaterialCode == pubSaDetail.LU)?.ErpMaterialCode ?? pubSaDetail.LU.Replace(" ", "-");
pubSaDetail.PartCode = materialRelationshipEntitys.FirstOrDefault(t => t.SettleMaterialCode == pubSaDetail.LU)?.ErpMaterialCode ?? pubSaDetail.LU.Replace(new string(' ', 6), "-");
});
#endregion

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

@ -37,6 +37,7 @@ using Volo.Abp.Users;
using Volo.Abp.Validation;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Syncs;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.Shared;
using Win.Sfs.Shared.Filter;
@ -169,7 +170,55 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
{
var entities = await _balanceRepository.GetListByFilterAsync(input.Filters).ConfigureAwait(false);
var fileName = $"库存余额_{DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")}.xlsx";
var content = this.GetContent(entities, "库存备份");
var content = this.GetContent(entities, "库存余额");
await _fileContainer.SaveAsync(fileName, content, true).ConfigureAwait(false);
return fileName;
}
/// <summary>
/// 1.2库存余额汇总查询
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task<PagedResultDto<VmiBalanceSumDto>> BalanceSum(RequestDto input)
{
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<VmiBalance>().FromSqlRaw("select * from Set_VmiBalance");
var filters = input.Filters.ToLambda<VmiBalance>();
if (input.Filters.Count > 0)
{
query = query.Where(input.Filters.ToLambda<VmiBalance>());
}
query = string.IsNullOrEmpty(input.Sorting) ? query : DynamicQueryableExtensions.OrderBy(query, input.Sorting);
var query2 = query.GroupBy(o => new { o.ErpToLoc, o.RealPartCode }).Select(o => new VmiBalanceSumDto { ErpToLoc = o.Key.ErpToLoc,RealPartCode = o.Key.RealPartCode, Qty = o.Sum(o => o.Qty) });
var totalCount = query2.Count();
var entities = await query2.PageBy(input.SkipCount, input.MaxResultCount).ToListAsync().ConfigureAwait(false);
return new PagedResultDto<VmiBalanceSumDto>(totalCount, entities);
}
/// <summary>
/// 1.2库存余额汇总导出
/// </summary>
[HttpPost]
public async Task<string> BalanceSumExport(RequestDto input)
{
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<VmiBalance>().FromSqlRaw("select * from Set_VmiBalance");
var filters = input.Filters.ToLambda<VmiBalance>();
if (input.Filters.Count > 0)
{
query = query.Where(input.Filters.ToLambda<VmiBalance>());
}
query = string.IsNullOrEmpty(input.Sorting) ? query : DynamicQueryableExtensions.OrderBy(query, input.Sorting);
var query2 = query.GroupBy(o => new { o.ErpToLoc, o.RealPartCode }).Select(o => new VmiBalanceSumDto { ErpToLoc = o.Key.ErpToLoc, RealPartCode = o.Key.RealPartCode, Qty = o.Sum(o => o.Qty) });
var totalCount = query2.Count();
var entities = await query2.PageBy(input.SkipCount, input.MaxResultCount).ToListAsync().ConfigureAwait(false); var fileName = $"库存余额_{DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")}.xlsx";
var content = this.GetContent(entities, "库存汇总");
await _fileContainer.SaveAsync(fileName, content, true).ConfigureAwait(false);
return fileName;
}
@ -602,3 +651,14 @@ public class LogRequestDto : RequestDto
{
public List<VmiLogType> LogTypes { get; set; } = new List<VmiLogType>();
}
public class VmiBalanceSumDto
{
[Display(Name = "ERP库位", Order = 13)]
public string ErpToLoc { get; set; }
[Display(Name = "厂内零件号", Order = 6)]
public string RealPartCode { get; set; }//原始
[Display(Name = "数量", Order = 10)]
public decimal Qty { get; set; }
}

50
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs

@ -77,57 +77,9 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
_checkls.Add("1046");
_checkls.Add("104T");
result = result.Where(p => _checkls.Contains(p.Plant)).ToList();
result.ForEach(t => t.PartNo = t.PartNo + new string(' ', 6) + t.ES1 + t.ES2);
var entityList = ObjectMapper.Map<List<PriceListImportDto>, List<PriceList>>(result);
entityList = entityList.GroupBy(p => new { p.LU, p.ClientCode, p.BeginTime, p.EndTime }).Select(p => p.FirstOrDefault()).ToList();
var contractNo = entityList.FirstOrDefault().ContractNo;
#region 校验
if (entityList.Any())
{
var query = from item1 in entityList
join item2 in entityList
on new { item1.LU } equals new { item2.LU }
where (item1.BeginTime > item2.BeginTime && item1.EndTime < item2.EndTime) || (item2.BeginTime > item1.BeginTime && item2.EndTime < item1.EndTime) || (item1.BeginTime == item2.BeginTime && item1.EndTime != item2.EndTime) || (item1.BeginTime != item2.BeginTime && item1.EndTime == item2.EndTime)
select item1.LU;
var repeat = query.Distinct().ToList();
foreach (var item in repeat)
{
checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item},时间区间存在交集", string.Empty));
}
}
if (checkList.Count > 0)
{
string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { code = ApplicationConsts.ImportFailCode, message = "导入失败", fileName = fileName });
}
#endregion
var lus = entityList.Select(p => p.LU);
var prices = _priceListRepository.Where(t => lus.Contains(t.LU) && t.ContractNo != contractNo).ToList();
if (prices.Any())
{
var query = from item1 in entityList
join item2 in prices
on new { item1.LU } equals new { item2.LU }
where (item1.BeginTime >= item2.BeginTime && item1.EndTime <= item2.EndTime) || (item2.BeginTime >= item1.BeginTime && item2.EndTime <= item1.EndTime)
select item1.LU;
var repeat = query.Distinct().ToList();
foreach (var item in repeat)
{
checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item},时间区间与系统内数据存在交集", string.Empty));
}
}
if (checkList.Count > 0)
{
string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { code = ApplicationConsts.ImportFailCode, message = "导入失败", fileName = fileName });
}
var priceListModelEntitys = _priceListRepository.Where(t => t.ContractNo == contractNo && lus.Contains(t.LU)).ToList();
if (priceListModelEntitys.Any())
{
await _priceListRepository.DeleteManyAsync(priceListModelEntitys).ConfigureAwait(false);
}
foreach (var item in entityList)
{

49
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs

@ -57,55 +57,6 @@ public class PriceListAppServiceBJ : SettleAccountApplicationBase<PriceListBJ>
var entityList = ObjectMapper.Map<List<PriceListBJImportDto>, List<PriceListBJ>>(result);
entityList = entityList.GroupBy(p => new { p.LU, p.ClientCode, p.BeginDate, p.EndDate }).Select(p => p.FirstOrDefault()).ToList();
var contractNo = entityList.FirstOrDefault().ContractNo;
#region 校验
if (entityList.Any())
{
var query = from item1 in entityList
join item2 in entityList
on new { item1.LU } equals new { item2.LU }
where (item1.BeginDate > item2.BeginDate && item1.EndDate < item2.EndDate) || (item2.BeginDate > item1.BeginDate && item2.EndDate < item1.EndDate) || (item1.BeginDate == item2.BeginDate && item1.EndDate != item2.EndDate) || (item1.BeginDate != item2.BeginDate && item1.EndDate == item2.EndDate)
select item1.LU;
var repeat = query.Distinct().ToList();
foreach (var item in query)
{
checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item},时间区间存在交集", string.Empty));
}
}
if (checkList.Count > 0)
{
string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { code = ApplicationConsts.ImportFailCode, message = "导入失败", fileName = fileName });
}
#endregion
var lus = entityList.Select(p => p.LU);
var prices = _repository.Where(t => lus.Contains(t.LU) && t.ContractNo != contractNo).ToList();
if (prices.Any())
{
var query = from item1 in entityList
join item2 in prices
on new { item1.LU } equals new { item2.LU }
where (item1.BeginDate >= item2.BeginDate && item1.EndDate <= item2.EndDate) || (item2.BeginDate >= item1.BeginDate && item2.EndDate <= item1.EndDate)
select item1.LU;
var repeat = query.Distinct().ToList();
foreach (var item in repeat)
{
checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item},时间区间与系统内数据存在交集", string.Empty));
}
}
if (checkList.Count > 0)
{
string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { code = ApplicationConsts.ImportFailCode, message = "导入失败", fileName = fileName });
}
var priceListModelEntitys = _repository.Where(t => t.ContractNo == contractNo && lus.Contains(t.LU)).ToList();
if (priceListModelEntitys.Any())
{
await _repository.DeleteManyAsync(priceListModelEntitys).ConfigureAwait(false);
}
foreach (var item in entityList)
{

20
code/src/Modules/SettleAccount/src/SettleAccount.Domain.Shared/Enums/EnumWMSSend.cs

@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations;
namespace Win.Sfs.SettleAccount.Enums;
/// <summary>
/// WMS发运
/// </summary>
public enum EnumWMSSend
{
/// <summary>
/// 未定义
/// </summary>
[Display(Name = "未定义")]
None = 0,
/// <summary>
/// WMS多发
/// </summary>
[Display(Name = "WMS多发")]
WMSRepeat = 1,
}

44
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs

@ -206,6 +206,27 @@ public class SaSeEdiCompareDetailExportJisBBAC : SaSeEdiCompareDetailExport, ISa
[ValueMapping("无结算有发运(有EDI数据)", 5)]
[ValueMapping("无结算有发运(无EDI数据)", 6)]
public EnumSaSeEdiCompareCategory Category { get; set; }
[Display(Name = "WMS多发")]
[ExporterHeader(DisplayName = "WMS多发")]
[ValueMapping("", 0)]
[ValueMapping("WMS多发", 1)]
public EnumWMSSend WMSSend
{
get
{
return (Category, SaSeQty < 0) switch
{
(EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi, true) => EnumWMSSend.WMSRepeat,
(EnumSaSeEdiCompareCategory.HaveSaHaveSeNotHaveEdi, true) => EnumWMSSend.WMSRepeat,
_ => EnumWMSSend.None
};
}
}
[Display(Name = "价格信息")]
[ExporterHeader(DisplayName = "价格信息")]
[ValueMapping("有价格信息", true)]
[ValueMapping("无价格信息", false)]
public bool IsHavePrice => FixPrice != null && FixPrice != 0;
/// <summary>
/// 交货单号
/// </summary>
@ -297,7 +318,7 @@ public class SaSeEdiCompareDetailExportJisBBAC : SaSeEdiCompareDetailExport, ISa
[ExporterHeader(DisplayName = "Edi数量")]
public decimal EdiQty { get; set; }
/// <summary>
/// 结算与EDI量差
/// 结算与WMS发货量差
/// </summary>
[ExporterHeader(DisplayName = "结算与WMS发货量差")]
public decimal SaSeQty => SAQty - SEQty;
@ -366,6 +387,27 @@ public class SaSeEdiCompareDetailExportJisHBPO : SaSeEdiCompareDetailExport, ISa
[ValueMapping("无结算有发运(有EDI数据)", 5)]
[ValueMapping("无结算有发运(无EDI数据)", 6)]
public EnumSaSeEdiCompareCategory Category { get; set; }
[Display(Name = "WMS多发")]
[ExporterHeader(DisplayName = "WMS多发")]
[ValueMapping("", 0)]
[ValueMapping("WMS多发", 1)]
public EnumWMSSend WMSSend
{
get
{
return (Category, SaSeQty < 0) switch
{
(EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi, true) => EnumWMSSend.WMSRepeat,
(EnumSaSeEdiCompareCategory.HaveSaHaveSeNotHaveEdi, true) => EnumWMSSend.WMSRepeat,
_ => EnumWMSSend.None
};
}
}
[Display(Name = "价格信息")]
[ExporterHeader(DisplayName = "价格信息")]
[ValueMapping("有价格信息", true)]
[ValueMapping("无价格信息", false)]
public bool IsHavePrice => FixPrice != null && FixPrice != 0;
/// <summary>
/// 交货单号
/// </summary>

Loading…
Cancel
Save