学 赵 1 year ago
parent
commit
b5375b8a14
  1. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json
  2. 4
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/list/index.js
  3. 4
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/input/jie-suan-detail.js
  4. 6
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/input/jie-suan.js
  5. 9
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/commerce.js
  6. 3
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/finance.js
  7. 38
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/inventory-detail.js
  8. 8
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/inventory.js
  9. 61
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/business.js
  10. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/index.js
  11. 9
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/utils.js
  12. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/styles/site.css
  13. 6
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js
  14. 6
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/commerce.js
  15. 7
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/finance.js
  16. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SA_DTO.cs
  17. 45
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SA_DTO.cs
  18. 46
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs
  19. 67
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs
  20. 223
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs
  21. 40
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
  22. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
  23. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json

@ -70,7 +70,7 @@
"AuthServer": {
"Authority": "http://localhost:44378",
"Authority": "http://dev.ccwin-in.com:10582",
"ClientId": "basic-web",
"ClientSecret": "1q2w3e*"
},

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

@ -33,9 +33,10 @@ export default {
</app-form>
<template v-for="item in buttons">
<el-button
:class="item.meta.htmlClass??'el-button--primary'"
v-if="item.meta.isTop"
@click="click(item,selectedRows)"
:class="item.meta.htmlClass??'el-button--primary'"
v-show="!item.meta.show||item.meta.show(selectedRows,queryModel)"
:disabled="item.meta.disabled && item.meta.disabled.constructor === Function && item.meta.disabled(selectedRows,queryModel)"
>
<el-icon v-if="item.meta.icon"><svg-icon :name="item.meta.icon" /></el-icon>
@ -126,6 +127,7 @@ export default {
<el-button
:class="item.meta.htmlClass??'el-button--primary'"
v-if="!item.meta.isTop"
v-show="!item.meta.show||item.meta.show(scope.row,queryModel)"
@click="click(item,[scope.row])"
:disabled="item.meta.disabled && item.meta.disabled(scope.row)"
>

4
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/input/jie-suan-detail.js

@ -39,9 +39,9 @@ const schema = {
export default function (businessType) {
let service = null;
if (businessType === "JisBBAC") {
if (businessType === "JisBBAC" || businessType === "MaiDanJianBBAC") {
service = "bbac_sa_detail_service";
} else if (businessType === "JisHBPO") {
} else if (businessType === "JisHBPO" || businessType === "MaiDanJianHBPO") {
service = "hbpo_sa_detail_service";
} else {
service = "pub_sa_detail_service";

6
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/input/jie-suan.js

@ -5,7 +5,7 @@ const schema = {
type: "object",
properties: {
version,
state,
//state,
billNum: {
title: "结算单号",
type: "string",
@ -68,10 +68,10 @@ const querySchema = {
export default function (businessType, meta) {
let service = null;
let detailService = null;
if (businessType === "JisBBAC") {
if (businessType === "JisBBAC" || businessType === "MaiDanJianBBAC") {
service = "bbac_sa_service";
detailService = "bbac_sa_detail_service";
} else if (businessType === "JisHBPO") {
} else if (businessType === "JisHBPO" || businessType === "MaiDanJianHBPO") {
service = "hbpo_sa_service";
detailService = "hbpo_sa_detail_service";
} else {

9
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/commerce.js

@ -33,7 +33,7 @@ const schema = {
invoiceState: {
title: "发票状态",
type: "string",
input: "select",
input: "tabs",
options: [
{ value: 1, label: "正常" },
{ value: 2, label: "报废" },
@ -116,6 +116,13 @@ export default function (businessType, type) {
value: null,
readOnly: true,
},
{
logic: "and",
column: "invoiceState",
action: "equal",
value: null,
readOnly: true,
},
],
},
skipCount: {

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

@ -1,8 +1,7 @@
//财务审核
import version from "../version.js";
import { state2 } from "../state.js";
import businessType from "../businessType.js";
import invoiceState from "../invoiceState.js";
import { businessType, invoiceState } from "../_options.js";
const state = Object.assign({}, state2);
state.input = "tabs";

38
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/inventory-detail.js

@ -71,43 +71,7 @@ export default function (businessType) {
},
},
},
default: [
{
logic: "and",
column: "version",
action: "equal",
value: null,
readOnly: true,
},
{
logic: "and",
column: "billNum",
action: "equal",
value: null,
readOnly: true,
},
{
logic: "and",
column: "settleBillNum",
action: "equal",
value: null,
readOnly: true,
},
{
logic: "and",
column: "invGroupNum",
action: "equal",
value: null,
readOnly: true,
},
{
logic: "and",
column: "state",
action: "equal",
value: null,
readOnly: true,
},
],
default: [],
},
skipCount: {
hidden: true,

8
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/inventory.js

@ -20,7 +20,6 @@ const schema = {
invGroupNum: {
title: "发票分组号",
type: "string",
link: true,
},
site: {
title: "地点",
@ -95,13 +94,6 @@ export default function (businessType) {
value: null,
readOnly: true,
},
{
logic: "and",
column: "settleBillNum",
action: "equal",
value: null,
readOnly: true,
},
{
logic: "and",
column: "invGroupNum",

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

@ -2,16 +2,21 @@ import createRoute, { createPage, createButton } from "./utils.js";
// #region 数据输入
function createInputJieSuanShuju(path, business, client, title = "结算数据") {
return {
const routes = {
...createPage(path, `title=${title}&businessType=${business}&client=${client}`),
component: "/input/jie-suan",
children: [
createButton("query", "title=查询&isTop=true"),
createButton("import", "title=导入&isTop=true"),
//createButton("import", "title=导入&isTop=true"),
createButton("export", "title=导出&pattern=row&key=billNum"),
createButton("delete", "title=删除&isTop=true"),
//createButton("delete", "title=删除&isTop=true"),
],
};
if (business !== "MaiDanJianBBAC" && business !== "MaiDanJianHBPO") {
routes.children.push(createButton("import", "title=导入&isTop=true"));
routes.children.push(createButton("delete", "title=删除&isTop=true"));
}
return routes;
}
function createInputFaYunShuJu(path, business, client, title = "发运数据") {
@ -85,10 +90,27 @@ function createCommerceCheckList(path, business, client, title = "商务审批")
component: "/settle/commerce",
children: [
createButton("query", "title=查询&isTop=true"),
createButton("approval", "title=商务审核通过&isTop=true"),
createButton("reject", "title=退回"),
createButton(
"approval",
"title=商务审核通过&isTop=true",
(_, q) => q.filters.some((o) => o.column === "state" && o.value === 1) && q.filters.some((o) => o.column === "invoiceState" && o.value === 1)
),
createButton(
"reject",
"title=退回",
(_, q) => q.filters.some((o) => o.column === "state" && o.value === 1) && q.filters.some((o) => o.column === "invoiceState" && o.value === 1)
),
createButton("export-group", "title=导出发票分组&pattern=paged"),
createButton("receive", "title=客户已收票&isTop=true"),
createButton(
"receive",
"title=客户已收票&isTop=true",
(_, q) => q.filters.some((o) => o.column === "state" && o.value === 3) && q.filters.some((o) => o.column === "invoiceState" && o.value === 1)
),
createButton(
"bao-fei",
"title=报废&isTop=true",
(_, q) => q.filters.some((o) => o.column === "state" && (o.value === 3 || o.value === 4)) && q.filters.some((o) => o.column === "invoiceState" && o.value === 1)
),
],
};
}
@ -224,10 +246,10 @@ export default [
{
...createRoute("settlement", "title=结算开票"),
children: [
createUsableSettleList("hbpo_jit_pub_can_sa_service", "ZhiGongJianBBAC", "hbpo", "直供件-HBPO 可结算单"),
createUnableSettleList("hbpo_jit_pub_not_sa_service", "ZhiGongJianBBAC", "hbpo", "直供件-HBPO 不可结算明细"),
createCommerceCheckList("hbpo_jit_pub_ba_service", "ZhiGongJianBBAC", "hbpo", "直供件-HBPO 商务审批"),
createVmiOutCheckList("hbpo_jit_pub_pd_service", "ZhiGongJianBBAC", "hbpo", "直供件-HBPO 寄售库库存扣减审批"),
createUsableSettleList("hbpo_jit_pub_can_sa_service", "ZhiGongJianHBPO", "hbpo", "直供件-HBPO 可结算单"),
createUnableSettleList("hbpo_jit_pub_not_sa_service", "ZhiGongJianHBPO", "hbpo", "直供件-HBPO 不可结算明细"),
createCommerceCheckList("hbpo_jit_pub_ba_service", "ZhiGongJianHBPO", "hbpo", "直供件-HBPO 商务审批"),
createVmiOutCheckList("hbpo_jit_pub_pd_service", "ZhiGongJianHBPO", "hbpo", "直供件-HBPO 寄售库库存扣减审批"),
],
},
],
@ -338,10 +360,23 @@ export default [
component: "/settle/finance",
children: [
createButton("query", "title=查询&isTop=true"),
createButton("import", "title=导入开票文件&isTop=true"),
createButton("approval", "title=财务审核通过&isTop=true"),
createButton(
"import",
"title=导入开票文件&isTop=true",
(_, q) => q.filters.some((o) => o.column === "state" && o.value === 3) && q.filters.some((o) => o.column === "invoiceState" && o.value === 1)
),
createButton(
"approval",
"title=财务审核通过&isTop=true",
(_, q) => q.filters.some((o) => o.column === "state" && o.value === 2) && q.filters.some((o) => o.column === "invoiceState" && o.value === 1)
),
createButton("export-group", "title=导出发票分组&pattern=paged"),
createButton("reject", "title=退回&isTop=true"),
createButton("approval", "title=发票重开"),
createButton(
"reject",
"title=退回&isTop=true",
(_, q) => q.filters.some((o) => o.column === "state" && o.value === 2) && q.filters.some((o) => o.column === "invoiceState" && o.value === 1)
),
createButton("sync", "title=同步到QAD&isTop=true"),
],
},

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/index.js

@ -85,7 +85,7 @@ const refreshRouter = async () => {
await connect();
const appStore = useAppStore();
const permissions = appStore.user.permissions;
const serverRoutes = JSON.parse(JSON.stringify(remoteRoutes));
const serverRoutes = Object.assign([], remoteRoutes);
const setPermission = (list, parent = null) => {
list.forEach((o) => {
// full path

9
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/utils.js

@ -25,12 +25,15 @@ function createPage(path, meta = null, component = null) {
};
}
function createButton(path, meta = null, component = null) {
return {
function createButton(path, meta = null, show = null) {
const result = {
path,
component,
meta: Object.assign(createDefaultRoute("button", "file"), qs.parse(meta)),
};
if (show) {
result.meta.show = show;
}
return result;
}
export default createRoute;

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/styles/site.css

@ -96,7 +96,7 @@ a.logo {
}
.el-form--inline .el-form-item__content {
width: 192px;
min-width: 192px;
/* height: 32px; */
}

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

@ -42,7 +42,9 @@ export default {
<template #footer>
<span class="dialog-footer">
<el-button type="primary" @click="show=false"> 返回 </el-button>
<el-button type="primary" @click="showSetupDialog" v-if="isBusiness&&data.invbillNum&&model.adJ_DETAIL.length===0"> 重开发票 </el-button>
<el-button type="primary" @click="showSetupDialog" v-if="isBusiness&&data.invbillNum&&model.adJ_DETAIL.length===0&&row.invoiceState===1&&(row.state===3||row.state===4)">
重开发票号
</el-button>
</span>
</template>
</el-drawer>
@ -173,7 +175,7 @@ export default {
background: yellow;
}
</style>`,
props: ["modelValue", "data", "isBusiness", "businessType"],
props: ["modelValue", "row", "data", "isBusiness", "businessType"],
emit: ["update:modelValue"],
setup(props, context) {
const show = ref(props.modelValue);

6
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/commerce.js

@ -9,10 +9,11 @@ import AppCheck from "./_check.js";
export default {
components: { AppList, AppCheck },
template: html`<app-list ref="appListRef" :config="config" @command="onCommand" />
<app-check v-if="visable" v-model="visable" :businessType="businessType" :data="data" :isBusiness="true" />`,
<app-check v-if="visable" v-model="visable" :businessType="businessType" :row="row" :data="data" :isBusiness="true" />`,
setup() {
const appListRef = ref(null);
const visable = ref(false);
const row = ref(null);
const data = ref(null);
const route = useRoute();
const businessType = route.meta.businessType;
@ -50,11 +51,12 @@ export default {
}
});
} else if (item.path === "invbillNum" || item.path === "invGroupNum") {
row.value = rows[0];
data.value = { [item.path]: rows[0][item.path] };
visable.value = true;
}
console.log(item.path, item, rows);
};
return { appListRef, config, onCommand, visable, data, businessType };
return { appListRef, config, onCommand, visable, row, data, businessType };
},
};

7
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/finance.js

@ -8,10 +8,12 @@ import AppCheck from "./_check.js";
export default {
components: { AppList, AppCheck },
template: html`<app-list ref="appListRef" :config="config" @command="onCommand" /> <app-check v-if="visable" v-model="visable" :businessType="businessType" :data="data" />`,
template: html`<app-list ref="appListRef" :config="config" @command="onCommand" />
<app-check v-if="visable" v-model="visable" :businessType="businessType" :row="row" :data="data" />`,
setup() {
const appListRef = ref(null);
const visable = ref(false);
const row = ref(null);
const data = ref(null);
const route = useRoute();
const businessType = route.meta.businessType;
@ -49,11 +51,12 @@ export default {
}
});
} else if (item.path === "invbillNum" || item.path === "invGroupNum") {
row.value = rows[0];
data.value = { [item.path]: rows[0][item.path] };
visable.value = true;
}
console.log(item.path, item, rows);
};
return { appListRef, config, onCommand, visable, data, businessType };
return { appListRef, config, onCommand, visable, row, data, businessType };
},
};

4
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SA_DTO.cs

@ -129,8 +129,8 @@ public class BBAC_SA_DETAIL_IMPORT_DTO
/// 结算日期
/// </summary>
[Display(Name = "Posting Date")]
[ImporterHeader(Name = "Posting Date", Format = "yyyy/MM/dd HH:mm:ss")]
public DateTime SettleDate { set; get; }
[ImporterHeader(Name = "Posting Date")]
public string SettleDate { set; get; }
/// <summary>
/// 结算分组号

45
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SA_DTO.cs

@ -107,7 +107,10 @@ public class HBPOSaImportRequestDto
/// 文件
/// </summary>
public IFormFileCollection Files { get; set; }
/// <summary>
/// 业务类别
/// </summary>
public EnumBusinessType BusinessType { get; set; }
/// <summary>
/// 期间
/// </summary>
@ -175,6 +178,46 @@ public class HBPO_SA_DETAIL_IMPORT_DTO
public string PN { get; set; }
}
/// <summary>
/// 买单件HBPO导入
/// </summary>
public class MaiDanJianHBPOImportDto
{
/// <summary>
/// 结算日期
/// </summary>
[Display(Name = "买单日期")]
[ImporterHeader(Name = "买单日期")]
public DateTime SettleDate { set; get; }
/// <summary>
/// 客户零件号
/// </summary>
[Display(Name = "零件号")]
[Required(ErrorMessage = "{0}不能为空")]
[ImporterHeader(Name = "零件号")]
public string LU { get; set; }
/// <summary>
/// 生产号
/// </summary>
[Display(Name = "现产品生产号")]
[ImporterHeader(Name = "现产品生产号")]
[Required(ErrorMessage = "{0}不能为空")]
public string PN { get; set; }
/// <summary>
/// 数量
/// </summary>
[Display(Name = "数量")]
[ImporterHeader(Name = "数量")]
public decimal Qty { get; set; }
/// <summary>
/// 结算分组号
/// </summary>
[Display(Name = "五联单号")]
[ImporterHeader(Name = "五联单号")]
[Required(ErrorMessage = "{0}不能为空")]
public string GroupNum { get; set; }
}
/// <summary>
/// 结算明细导出请求
/// </summary>

46
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs

@ -57,12 +57,10 @@ public class PUB_SAImportRequestDto
/// 文件
/// </summary>
public IFormFileCollection Files { get; set; }
/// <summary>
/// 业务类别
/// </summary>
public EnumBusinessType BusinessType { get; set; }
/// <summary>
/// 期间
/// </summary>
@ -165,50 +163,6 @@ public class ZhiGongJianHBPOImportDto
public string GroupNum { get; set; }
}
/// <summary>
/// 买单件HBPO导入
/// </summary>
public class MaiDanJianHBPOImportDto
{
/// <summary>
/// 结算日期
/// </summary>
[Display(Name = "买单日期")]
[ImporterHeader(Name = "买单日期")]
public DateTime SettleDate { set; get; }
/// <summary>
/// 客户零件号
/// </summary>
[Display(Name = "零件号")]
[Required(ErrorMessage = "{0}不能为空")]
[ImporterHeader(Name = "零件号")]
public string LU { get; set; }
/// <summary>
/// 生产号
/// </summary>
[Display(Name = "现产品生产号")]
[ImporterHeader(Name = "现产品生产号")]
[Required(ErrorMessage = "{0}不能为空")]
public string PN { get; set; }
/// <summary>
/// 数量
/// </summary>
[Display(Name = "数量")]
[ImporterHeader(Name = "数量")]
public decimal Qty { get; set; }
/// <summary>
/// 结算分组号
/// </summary>
[Display(Name = "五联单号")]
[ImporterHeader(Name = "五联单号")]
[Required(ErrorMessage = "{0}不能为空")]
public string GroupNum { get; set; }
}
/// <summary>
/// 备件导入
/// </summary>

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

@ -83,12 +83,6 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
/// </summary>
private readonly EnumBusinessType _businessType = EnumBusinessType.JisBBAC;
/// <summary>
/// 地点
/// </summary>
[Display(Name = "地点")]
public string Site { get; set; }
/// <summary>
/// 构造
/// </summary>
@ -116,6 +110,15 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
_tbRePartsRelationshipRepository = tbRePartsRelationshipRepository;
}
/// <summary>
/// 地点
/// </summary>
public string Site { get; set; }
/// <summary>
/// 期间
/// </summary>
public int Version { get; set; }
#region 导入、导出
/// <summary>
/// 导入
@ -124,6 +127,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
public async Task<IActionResult> ImportAsync([FromForm] BBACSaImportRequestDto bbacSaImportRequestDto)
{
Site = bbacSaImportRequestDto.Site;
Version = bbacSaImportRequestDto.Version;
#region 导入数据转换、数据校验
ExportImporter _exportImporter = new ExportImporter();
var importDtos = await _exportImporter.UploadExcelImport<BBAC_SA_DETAIL_IMPORT_DTO>(bbacSaImportRequestDto.Files, _excelImportService).ConfigureAwait(false);
@ -140,7 +144,16 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
importBBACSaDetails.ForEach(importBBACSaDetail =>
{
importBBACSaDetail.Version = bbacSaImportRequestDto.Version;
List<string> lus = importBBACSaDetail.LU.Split(" ").ToList();
importBBACSaDetail.LU = lus[0].Replace(" ", "");
if (lus.Count > 1)
{
lus.RemoveAt(0);
var luAssemble = lus.Select(t => t.Replace(" ", ""));
importBBACSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index);
}
importBBACSaDetail.Version = Version;
importBBACSaDetail.Site = Site;
});
@ -197,8 +210,13 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
[HttpPost]
public async Task<PagedResultDto<BBAC_SA_DTO>> GetListAsync(RequestDto input)
{
var entities = await _bbacSaRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true);
var totalCount = await _bbacSaRepository.GetCountByFilterAsync(input.Filters);
var businessTypeFilterConditions = input.Filters.FindAll(t => t.Column.ToLower() == "businesstype");
businessTypeFilterConditions.ForEach(t =>
{
t.Value = EnumBusinessType.JisBBAC.ToString();
});
var entities = await _bbacSaRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false);
var totalCount = await _bbacSaRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<BBAC_SA>, List<BBAC_SA_DTO>>(entities);
return new PagedResultDto<BBAC_SA_DTO>(totalCount, dtos);
}
@ -298,23 +316,23 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
//删除
if (bbacSas.Any())
{
await _bbacSaRepository.DeleteManyAsync(bbacSas);
await _bbacSaRepository.DeleteManyAsync(bbacSas).ConfigureAwait(false);
}
if (bbacSaDetails.Any())
{
await _bbacSaDetailRepository.DbContext.BulkDeleteAsync(bbacSaDetails);
await _bbacSaDetailRepository.DbContext.BulkDeleteAsync(bbacSaDetails).ConfigureAwait(false);
}
if (bbacCanSas.Any())
{
await _bbacCanSaRepository.DeleteManyAsync(bbacCanSas);
await _bbacCanSaRepository.DeleteManyAsync(bbacCanSas).ConfigureAwait(false);
}
if (bbacCanSaDetails.Any())
{
await _bbacCanSaDetailRepository.DbContext.BulkDeleteAsync(bbacCanSaDetails);
await _bbacCanSaDetailRepository.DbContext.BulkDeleteAsync(bbacCanSaDetails).ConfigureAwait(false);
}
if (bbacNotSaDetails.Any())
{
await _bbacNotSaDetailRepository.DbContext.BulkDeleteAsync(bbacNotSaDetails);
await _bbacNotSaDetailRepository.DbContext.BulkDeleteAsync(bbacNotSaDetails).ConfigureAwait(false);
}
}
#endregion
@ -331,9 +349,10 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
var bbacSa = new BBAC_SA()
{
BillNum = bbacSaBillNum,
State = "1",
State = "0",
BusinessType = _businessType,
Site = Site
Site = Site,
Version = Version
};
//可结算单号
var bbacCanSaBillNum = OrderNumberGenerator.GenerateOrderNumber("C");
@ -345,7 +364,8 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
SettleBillNum = bbacSaBillNum,
State = SettleBillState.,
BusinessType = _businessType,
Site = Site
Site = Site,
Version = Version
};
//可结算明细
var bbacCanSaDetails = new List<BBAC_CAN_SA_DETAIL>();
@ -399,8 +419,8 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
#endregion
#region 添加入库
await _bbacSaRepository.InsertAsync(bbacSa);
await _bbacSaDetailRepository.DbContext.BulkInsertAsync(bbacSaDetails);
await _bbacSaRepository.InsertAsync(bbacSa).ConfigureAwait(false);
await _bbacSaDetailRepository.DbContext.BulkInsertAsync(bbacSaDetails).ConfigureAwait(false);
if (bbacCanSaDetails.Count > 0)
{
bbacCanSaDetails.ForEach(bbacCanSaDetail =>
@ -409,8 +429,8 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
bbacCanSaDetail.BusinessType = _businessType;
});
await _bbacCanSaRepository.InsertAsync(bbacCanSa);
await _bbacCanSaDetailRepository.DbContext.BulkInsertAsync(bbacCanSaDetails);
await _bbacCanSaRepository.InsertAsync(bbacCanSa).ConfigureAwait(false);
await _bbacCanSaDetailRepository.DbContext.BulkInsertAsync(bbacCanSaDetails).ConfigureAwait(false);
}
if (bbacNotSaDetails.Count > 0)
{
@ -419,7 +439,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
bbacNotSaDetail.BusinessType = _businessType;
});
await _bbacNotSaDetailRepository.InsertManyAsync(bbacNotSaDetails);
await _bbacNotSaDetailRepository.DbContext.BulkInsertAsync(bbacNotSaDetails).ConfigureAwait(false);
}
if (materialRelationships.Count > 0)
{
@ -443,8 +463,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
List<BBAC_CAN_SA_DETAIL> bbacCanSaDetails = new List<BBAC_CAN_SA_DETAIL>();
//不可结算
List<BBAC_NOT_SA_DETAIL> bbacNotSaDetails = new List<BBAC_NOT_SA_DETAIL>();
var bbacSaEntity = await _bbacSaRepository.FirstOrDefaultAsync(t => t.Id.Equals(id)).ConfigureAwait(false);
//var bbacSaEntity = await _bbacSaRepository.FindAsync(id).ConfigureAwait(false);
var bbacSaEntity = await _bbacSaRepository.FindAsync(id).ConfigureAwait(false);
if (bbacSaEntity != null)
{
//结算单据

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

@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using DocumentFormat.OpenXml.Bibliography;
using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
@ -104,6 +106,11 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
_tbRePartsRelationshipRepository = tbRePartsRelationshipRepository;
}
/// <summary>
/// 期间
/// </summary>
public int Version { get; set; }
#region 导入、导出
/// <summary>
/// 导入
@ -111,68 +118,20 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
[HttpPost]
public async Task<IActionResult> ImportAsync([FromForm] HBPOSaImportRequestDto hbpoSaImportRequestDto)
{
#region 导入数据转换、数据校验
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.UploadExcelImport<HBPO_SA_DETAIL_IMPORT_DTO>(hbpoSaImportRequestDto.Files, _excelImportService).ConfigureAwait(false);
var importHBOPSaDetails = ObjectMapper.Map<List<HBPO_SA_DETAIL_IMPORT_DTO>, List<HBPO_SA_DETAIL>>(result);
importHBOPSaDetails.ForEach(importHBOPSaDetail =>
{
importHBOPSaDetail.Version = hbpoSaImportRequestDto.Version;
});
//Site包含CN1 亦庄
//Site包含CN5 顺义
var importCN1HBOPSaDetails = importHBOPSaDetails.FindAll(t => t.Site.Contains("CN1"));
var importCN5HBOPSaDetails = importHBOPSaDetails.FindAll(t => t.Site.Contains("CN5"));
//数据校验
var checkList = new List<ErrorExportDto>();
//结算分组号
var hbpoSaGroupNums = importHBOPSaDetails.Select(t => t.GroupNum).Distinct();
//已存在的结算分组号
var havHBPOSaGroupNums = (await _hbpoSaDetailRepository.GetListAsync(t => hbpoSaGroupNums.Contains(t.GroupNum))).Select(t => t.GroupNum).Distinct();
if (havHBPOSaGroupNums.Any() == true)
{
foreach (var item in havHBPOSaGroupNums)
{
checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"结算分组号{item}已存在", string.Empty));
}
}
if (!checkList.Any())
{
//验证客户对应厂内零件号是否存在
//导入的零件号集合
var importPubSaLUs = (importCN1HBOPSaDetails.Select(t => t.LU).Union(importCN5HBOPSaDetails.Select(t => t.LU))).Distinct();
var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaLUs.Contains(t.SettleMaterialCode)).ConfigureAwait(false);
var materialRelationshipEntitySettleMaterialCodes = materialRelationshipEntitys.Select(t => t.SettleMaterialCode).Distinct();
//不存在的客户零件号(差集)
var noExistSettleMaterialCodes = importPubSaLUs.Except(materialRelationshipEntitySettleMaterialCodes);
noExistSettleMaterialCodes.ForEach(t =>
{
checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"客户零件号【{t}】对应厂内零件号系统中不存在", string.Empty));
});
}
if (checkList.Count > 0)
{
string fileName = await ExportErrorReportAsync(checkList);
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName });
}
#endregion
if (importCN1HBOPSaDetails.Any())
{
await SaDataHandleAsync(importCN1HBOPSaDetails, "CN1");
}
if (importCN5HBOPSaDetails.Any())
IActionResult result = new JsonResult(new { Code = 400 });
Version = hbpoSaImportRequestDto.Version;
switch (hbpoSaImportRequestDto.BusinessType)
{
await SaDataHandleAsync(importCN5HBOPSaDetails, "CN5");
case EnumBusinessType.JisHBPO:
result = await ImportJisHBPOAsync(hbpoSaImportRequestDto.Files).ConfigureAwait(false);
break;
case EnumBusinessType.MaiDanJianHBPO:
result = await ImportMaiDanJianHBPOAsync(hbpoSaImportRequestDto.Files).ConfigureAwait(false);
break;
default:
break;
}
return new JsonResult(new { Code = 200, Message = "导入成功" });
return result;
}
#endregion
@ -249,6 +208,74 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
#endregion
#region 私有方法
/// <summary>
/// JisHBPO导入
/// </summary>
private async Task<IActionResult> ImportJisHBPOAsync([FromForm] IFormFileCollection files)
{
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.UploadExcelImport<HBPO_SA_DETAIL_IMPORT_DTO>(files, _excelImportService).ConfigureAwait(false);
var importHBOPSaDetails = ObjectMapper.Map<List<HBPO_SA_DETAIL_IMPORT_DTO>, List<HBPO_SA_DETAIL>>(result);
HandleSaDetails(importHBOPSaDetails);
//Site包含CN1 亦庄
//Site包含CN5 顺义
var importCN1HBOPSaDetails = importHBOPSaDetails.FindAll(t => t.Site.Contains("CN1"));
var importCN5HBOPSaDetails = importHBOPSaDetails.FindAll(t => t.Site.Contains("CN5"));
#region 数据校验
var checkList = await CheckAsync(importHBOPSaDetails).ConfigureAwait(false);
if (checkList.Count > 0)
{
string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName });
}
#endregion
if (importCN1HBOPSaDetails.Any())
{
await SaDataHandleAsync(importCN1HBOPSaDetails, "CN1").ConfigureAwait(false);
}
if (importCN5HBOPSaDetails.Any())
{
await SaDataHandleAsync(importCN5HBOPSaDetails, "CN5").ConfigureAwait(false);
}
return new JsonResult(new { Code = 200, Message = "导入成功" });
}
/// <summary>
/// 买单件HBPO导入
/// </summary>
private async Task<IActionResult> ImportMaiDanJianHBPOAsync([FromForm] IFormFileCollection files)
{
#region 导入数据转换
var exportImporter = new ExportImporter();
var importResults = await exportImporter.UploadExcelImport<MaiDanJianHBPOImportDto>(files, _excelImportService).ConfigureAwait(false);
var importMaiDanHBPOSaDetails = ObjectMapper.Map<List<MaiDanJianHBPOImportDto>, List<HBPO_SA_DETAIL>>(importResults);
#endregion
if (!importMaiDanHBPOSaDetails.Any())
{
return new JsonResult(new { Code = 200, Message = "导入成功" });
}
HandleSaDetails(importMaiDanHBPOSaDetails);
#region 数据校验
var checkList = await CheckAsync(importMaiDanHBPOSaDetails).ConfigureAwait(false);
if (checkList.Count > 0)
{
string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName });
}
#endregion
await SaDataHandleAsync(importMaiDanHBPOSaDetails, "").ConfigureAwait(false);
return new JsonResult(new { Code = 200, Message = "导入成功" });
}
/// <summary>
/// 结算数据处理
/// </summary>
@ -260,9 +287,10 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
var hbpoSa = new HBPO_SA()
{
BillNum = hbpoSaBillNum,
State = "1",
State = "0",
BusinessType = _businessType,
Site = site,
Version = Version
};
//可结算单号
var hbpoCanSaBillNum = OrderNumberGenerator.GenerateOrderNumber("C");
@ -275,6 +303,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
State = SettleBillState.,
BusinessType = _businessType,
Site = site,
Version = Version
};
//可结算明细
var hbpoCanSaDetails = new List<HBPO_CAN_SA_DETAIL>();
@ -357,15 +386,15 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
private async Task<(List<HBPO_SA> hbpoSas, List<HBPO_SA_DETAIL> hbpoSaDetails, List<HBPO_CAN_SA> hbpoCanSas, List<HBPO_CAN_SA_DETAIL> hbpoCanSaDetails, List<HBPO_NOT_SA_DETAIL> hbpoNotSaDetails)> GetHBPOSaDelItemsAsync(Guid id)
{
//结算主表
List<HBPO_SA> hbpoSas = new List<HBPO_SA>();
var hbpoSas = new List<HBPO_SA>();
//结算明细
List<HBPO_SA_DETAIL> hbpoSaDetails = new List<HBPO_SA_DETAIL>();
var hbpoSaDetails = new List<HBPO_SA_DETAIL>();
//可结算主表
List<HBPO_CAN_SA> hbpoCanSas = new List<HBPO_CAN_SA>();
var hbpoCanSas = new List<HBPO_CAN_SA>();
//可结算明细
List<HBPO_CAN_SA_DETAIL> hbpoCanSaDetails = new List<HBPO_CAN_SA_DETAIL>();
var hbpoCanSaDetails = new List<HBPO_CAN_SA_DETAIL>();
//不可结算
List<HBPO_NOT_SA_DETAIL> hbpoNotSaDetails = new List<HBPO_NOT_SA_DETAIL>();
var hbpoNotSaDetails = new List<HBPO_NOT_SA_DETAIL>();
var hbpoSaEntity = await _hbpoSaRepository.FirstOrDefaultAsync(t => t.Id.Equals(id)).ConfigureAwait(false);
if (hbpoSaEntity != null)
@ -373,7 +402,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
//结算单据
string hbpoSaBillNum = hbpoSaEntity.BillNum;
hbpoCanSas = await _hbpoCanSaRepository.GetListAsync(t => t.SettleBillNum == hbpoSaBillNum);
hbpoCanSas = await _hbpoCanSaRepository.GetListAsync(t => t.SettleBillNum == hbpoSaBillNum).ConfigureAwait(false);
//验证可结算主表状态
if (hbpoCanSas.Any() && hbpoCanSas.Any(t => t.State != SettleBillState.))
{
@ -388,5 +417,65 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
return (hbpoSas, hbpoSaDetails, hbpoCanSas, hbpoCanSaDetails, hbpoNotSaDetails);
}
/// <summary>
/// 结算数据处理
/// </summary>
private void HandleSaDetails(List<HBPO_SA_DETAIL> hbpoSaDetails)
{
hbpoSaDetails.ForEach(hbpoSaDetail =>
{
hbpoSaDetail.SetId(GuidGenerator.Create());
var lus = hbpoSaDetail.LU.Split(" ").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.Version = Version;
});
}
/// <summary>
/// 数据校验
/// </summary>
private async Task<List<ErrorExportDto>> CheckAsync(List<HBPO_SA_DETAIL> hbpoSaDetails)
{
#region 数据校验
//数据校验
var checkList = new List<ErrorExportDto>();
//结算分组号
var saGroupNums = hbpoSaDetails.Select(t => t.GroupNum).Distinct();
//已存在的结算分组号
var havPubSaGroupNums = (await _hbpoSaDetailRepository.GetListAsync(t => saGroupNums.Contains(t.GroupNum))).Select(t => t.GroupNum).Distinct();
if (havPubSaGroupNums.Any() == true)
{
foreach (var item in havPubSaGroupNums)
{
checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"结算分组号{item}已存在", string.Empty));
}
}
if (!checkList.Any())
{
//验证客户对应厂内零件号是否存在
//导入的零件号集合
var importSaLUs = hbpoSaDetails.Select(t => t.LU).Distinct();
var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importSaLUs.Contains(t.SettleMaterialCode)).ConfigureAwait(false);
var materialRelationshipEntitySettleMaterialCodes = materialRelationshipEntitys.Select(t => t.SettleMaterialCode).Distinct();
//不存在的客户零件号(差集)
var noExistSettleMaterialCodes = importSaLUs.Except(materialRelationshipEntitySettleMaterialCodes);
noExistSettleMaterialCodes.ForEach(t =>
{
checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"客户零件号【{t}】对应厂内零件号系统中不存在", string.Empty));
});
}
return checkList;
#endregion
}
#endregion
}

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

@ -127,23 +127,12 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
_version = pubSaImportRequestDto.Version;
switch (pubSaImportRequestDto.BusinessType)
{
case EnumBusinessType.None:
break;
case EnumBusinessType.JisBBAC:
break;
case EnumBusinessType.JisHBPO:
break;
case EnumBusinessType.ZhiGongJianBBAC:
result = await ImportZhiGongJianBBACAsync(pubSaImportRequestDto.Files).ConfigureAwait(false);
break;
case EnumBusinessType.ZhiGongJianHBPO:
result = await ImportZhiGongJianHBPOAsync(pubSaImportRequestDto.Files).ConfigureAwait(false);
break;
case EnumBusinessType.MaiDanJianBBAC:
break;
case EnumBusinessType.MaiDanJianHBPO:
result = await ImportMaiDanJianHBPOAsync(pubSaImportRequestDto.Files).ConfigureAwait(false);
break;
case EnumBusinessType.BeiJian:
result = await ImportBeiJianAsync(pubSaImportRequestDto.Files).ConfigureAwait(false);
break;
@ -296,35 +285,6 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.ZhiGongJianHBPO).ConfigureAwait(false);
}
/// <summary>
/// 买单件HBPO导入
/// </summary>
private async Task<IActionResult> ImportMaiDanJianHBPOAsync([FromForm] IFormFileCollection files)
{
#region 导入数据转换
ExportImporter _exportImporter = new ExportImporter();
var importResults = await _exportImporter.UploadExcelImport<MaiDanJianHBPOImportDto>(files, _excelImportService).ConfigureAwait(false);
var importPubSaDetails = ObjectMapper.Map<List<MaiDanJianHBPOImportDto>, List<PUB_SA_DETAIL>>(importResults);
#endregion
if (!importPubSaDetails.Any())
{
return new JsonResult(new { Code = 200, Message = "导入成功" });
}
#region 数据校验
var checkList = await CheckAsync(importPubSaDetails);
if (checkList.Count > 0)
{
string fileName = await ExportErrorReportAsync(checkList);
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName });
}
#endregion
return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.BeiJian).ConfigureAwait(false);
}
/// <summary>
/// 备件导入
/// </summary>

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

@ -162,12 +162,11 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
try
{
var now = DateTime.Now;
var time = now.ToString("yyyy-MM-dd_HH:mm");
var table = $"Set_VmiBalance_{time}";
var table = $"Set_VmiBalance_{now.ToString("yyyy_MM_dd_HH_mm_ss")}";
var snapshot = db.Set<VmiSnapshot>().Where(o => o.Name == table).FirstOrDefault();
if (snapshot == null)
{
snapshot = new VmiSnapshot { Name = time, Start = now, Description = table };
snapshot = new VmiSnapshot { Name = now.ToString("yyyy-MM-dd HH:mm:ss"), Start = now, Description = table };
db.Set<VmiSnapshot>().Add(snapshot);
db.SaveChanges();
var result = db.Database.ExecuteSqlRaw($"select * into {table} from Set_VmiBalance;");

5
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs

@ -1025,7 +1025,8 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum));
CreateMap<BBAC_SA_DETAIL, BBAC_SA_DETAIL_EXPORT_DTO>();
CreateMap<BBAC_SA_DETAIL_IMPORT_DTO, BBAC_SA_DETAIL>();
CreateMap<BBAC_SA_DETAIL_IMPORT_DTO, BBAC_SA_DETAIL>()
.ForMember(x => x.SettleDate, y => y.MapFrom(y => DateTime.ParseExact(y.SettleDate, "dd.MM.yyyy", System.Globalization.CultureInfo.CurrentCulture)));
}
/// <summary>
@ -1068,6 +1069,7 @@ namespace Win.Sfs.SettleAccount
CreateMap<HBPO_SA_DETAIL, HBPO_SA_DETAIL_EXPORT_DTO>();
CreateMap<HBPO_SA_DETAIL_IMPORT_DTO, HBPO_SA_DETAIL>();
CreateMap<MaiDanJianHBPOImportDto, HBPO_SA_DETAIL>();
}
/// <summary>
@ -1102,7 +1104,6 @@ namespace Win.Sfs.SettleAccount
CreateMap<ZhiGongJianBBACImportDto, PUB_SA_DETAIL>();
CreateMap<ZhiGongJianHBPOImportDto, PUB_SA_DETAIL>();
CreateMap<MaiDanJianHBPOImportDto, PUB_SA_DETAIL>();
CreateMap<BeiJianImportDto, PUB_SA_DETAIL>()
.ForMember(x => x.ExtraProperties, y => y.MapFrom(d =>
new Dictionary<string, object>()

Loading…
Cancel
Save