Browse Source

更新寄售库存导出接口

master
wanggang 1 year ago
parent
commit
6e16565603
  1. 6
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/form/form-input.js
  2. 60
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/table/index.js
  3. 359
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/invoice/invoice_map_group.js
  4. 68
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs

6
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/form/form-input.js

@ -31,7 +31,11 @@ export default {
</el-select> </el-select>
</template> </template>
<template v-else-if="getInput(schema)==='month'||getInput(schema)==='datetime'"> <template v-else-if="getInput(schema)==='month'||getInput(schema)==='datetime'">
<el-date-picker v-model="model[prop]" :type="schema.input" :value-format="schema.format" /> <el-date-picker
v-model="model[prop]"
:type="schema.input"
:value-format="schema.format??'YYYY-MM-DD HH:mm:ss'"
/>
</template> </template>
<template v-else-if="getInput(schema)==='number'"> <template v-else-if="getInput(schema)==='number'">
<el-input :disabled="getDisabled()" :placeholder="schema.title" v-model="model[prop]" type="number" /> <el-input :disabled="getDisabled()" :placeholder="schema.title" v-model="model[prop]" type="number" />

60
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/table/index.js

@ -1,16 +1,29 @@
import html from "html"; import html from "html";
import { reactive, ref } from "vue";
export default { export default {
template: html`<div class="app-table el-table"> template: html`<div class="app-table el-table" ref="tableRef">
<div class="row"> <div class="row">
<div class="cell el-table__cell" v-for="item in columns"> <div class="cell el-table__cell" v-for="item in columns">
<div class="cell">{{item.title}}</div> <div class="cell" style="text-align:center;" v-if="item.input==='selection'">
<input
class="el-checkbox__input"
type="checkbox"
v-model="checkAll"
:indeterminate="checkAllIndeterminate"
@click="checkAllClick($event)"
/>
</div> </div>
<div class="cell" v-else-if="!item.hidden">{{item.title}}</div>
</div> </div>
<div v-for="row in data" class="row"> </div>
<div v-for="(row,index) in model" class="row">
<template v-for="(val,key) in row"> <template v-for="(val,key) in row">
<div class="cell el-table__cell" v-if="columns.find(o=>o.dataKey===key)"> <div class="cell el-table__cell" v-for="item in columns">
<div class="cell">{{val}}</div> <div class="cell" style="text-align:center;" v-if="item.input==='selection'">
<input class="el-checkbox__input row" type="checkbox" :value="index" />
</div>
<div class="cell" v-else-if="!item.hidden">{{row[item.dataKey]}}</div>
</div> </div>
</template> </template>
</div> </div>
@ -19,12 +32,12 @@ export default {
.app-table { .app-table {
display: table; display: table;
content-visibility: visible; content-visibility: visible;
border-top: var(--el-table-border);
border-left: var(--el-table-border);
} }
.app-table .row { .app-table .row {
display: table-row; display: table-row;
background-color: var(--el-table-tr-bg-color); background-color: var(--el-table-tr-bg-color);
border-top: var(--el-table-border);
border-left: var(--el-table-border);
} }
.app-table .cell.el-table__cell { .app-table .cell.el-table__cell {
display: table-cell; display: table-cell;
@ -34,6 +47,35 @@ export default {
} }
</style>`, </style>`,
props: ["modelValue", "columns", "data"], props: ["modelValue", "columns", "data"],
emit: ["update:modelValue"], setup(props) {
setup(props, context) {}, const model = reactive(props.data);
const tableRef = ref(null);
const getSelection = () => {
return Array.from(tableRef.value.querySelectorAll("input.row:checked")).map((o) => parseInt(o.value));
};
const clearSelection = () => {
Array.from(tableRef.value.querySelectorAll("input:checked")).forEach((o) => (o.checked = false));
};
const checkAll = ref(false);
const checkAllIndeterminate = ref(false);
const checkAllClick = (e) => {
checkAll.value = !checkAll.value;
if (checkAll.value) {
Array.from(tableRef.value.querySelectorAll("input.row:not(:checked)")).forEach((o) => (o.checked = true));
} else {
Array.from(tableRef.value.querySelectorAll("input.row:checked)")).forEach((o) => (o.checked = false));
}
const checkdCount = Array.from(tableRef.value.querySelectorAll("input.row:checked")).length;
checkAllIndeterminate.value = checkdCount > 0 && checkdCount < props.data.length;
};
return {
model,
tableRef,
checkAll,
checkAllIndeterminate,
checkAllClick,
getSelection,
clearSelection,
};
},
}; };

359
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/invoice/invoice_map_group.js

@ -1,4 +1,5 @@
import AppList from "../../../components/list/index.js"; import AppList from "../../../components/list/index.js";
import AppForm from "../../../components/form/index.js";
import html from "html"; import html from "html";
import { reactive, ref } from "vue"; import { reactive, ref } from "vue";
import useConfig from "../../../models/invoice/invoice_map_group.js"; import useConfig from "../../../models/invoice/invoice_map_group.js";
@ -6,101 +7,103 @@ import request from "../../../request/index.js";
import AppTable from "../../components/table/index.js"; import AppTable from "../../components/table/index.js";
import { ElMessageBox } from "element-plus"; import { ElMessageBox } from "element-plus";
import { post } from "../../../request/index.js"; import { post } from "../../../request/index.js";
import { schemaToModel } from "html";
export default { export default {
components: { AppList, AppTable }, components: { AppList, AppForm, AppTable },
template: html`<app-list :config="config" @command="onCommand" /> template: html`<app-list :config="config" @command="onCommand" />
<el-drawer v-model="drawer" destroy-on-close size="50%" class="page-drawer"> <el-drawer v-model="drawer" destroy-on-close size="50%" class="page-drawer">
<template #header> <span class="el-dialog__title"> 结算明细 </span> </template> <template #header> <span class="el-dialog__title"> 结算明细 </span> </template>
<el-row style="height:calc(100vh - 160px);" v-loading="loading"> <el-row style="height:calc(100vh - 160px);" v-loading="loading">
<el-col> <el-col>
<el-tabs> <el-tabs>
<el-tab-pane label="发票和结算分组对应关系" v-if="model.invoicE_WAIT_DETAIL.length"> <el-tab-pane label="发票和结算分组对应关系" v-if="model.invoicE_MAP_GROUP.length">
<el-scrollbar> <el-scrollbar>
<app-table :data="model.invoicE_WAIT_DETAIL" :columns="columns1" /> <app-table :data="model.invoicE_MAP_GROUP" :columns="columns2" />
</el-scrollbar> </el-scrollbar>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="已结分组包含不可结算零件" v-if="model.invoicE_MAP_GROUP.length"> <el-tab-pane label="发票明细" v-if="model.invoicE_WAIT_DETAIL.length">
<el-scrollbar> <el-scrollbar>
<app-table :data="model.invoicE_MAP_GROUP" :columns="columns2" /> <app-table :data="model.invoicE_WAIT_DETAIL" :columns="columns1" />
</el-scrollbar> </el-scrollbar>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="invoicE_NOT_SETTLE" v-if="model.invoicE_NOT_SETTLE.length"> <el-tab-pane label="已结分组包含不可结算零件" v-if="model.invoicE_NOT_SETTLE.length">
<el-scrollbar> <el-scrollbar>
<app-table :data="model.invoicE_NOT_SETTLE" :columns="columns3" /> <app-table :data="model.invoicE_NOT_SETTLE" :columns="columns3" />
</el-scrollbar> </el-scrollbar>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="发票调整明细" v-if="model.adJ_DETAIL.length">
<el-scrollbar>
<app-table :data="model.adJ_DETAIL" :columns="columns4" />
</el-scrollbar>
</el-tab-pane>
</el-tabs> </el-tabs>
</el-col> </el-col>
</el-row> </el-row>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button type="primary" @click="drawer=false"> 返回 </el-button> <el-button type="primary" @click="drawer=false"> 返回 </el-button>
<el-button <el-button type="primary" @click="showSetupDialog" v-if="model.adJ_DETAIL.length===0&&prop==='invbillNum'">
type="primary" 重开发票
@click="dialogVisible = true"
v-if="model.adJ_DETAIL.length===0&&prop==='invbillNum'"
>
重开
</el-button> </el-button>
<el-dialog v-model="dialogVisible" title="发票调整明细" width="50%" :before-close="handleClose">
<template #title>
<div style="display: flex; justify-content: space-between; align-items: center;">
<span>发票调整明细</span>
<span>
<el-button type="primary" @click="innerVisible = true" style="margin-left: auto;">新建</el-button>
<el-button type="primary" @click="openImport = true" style="margin-left: 10px;">导入 </el-button>
<el-button type="primary" @click="deleteRow" style="margin-left: 10px;">删除</el-button>
<el-button type="primary" @click="dialogVisible = false" style="margin-left: 10px;">关闭</el-button>
</span> </span>
</div>
</template> </template>
<el-table :data="invoiceValue" @selection-change="handleSelectionChange"> </el-drawer>
<el-table-column width="50" type="selection"> <el-dialog class="re-open" v-model="dialogVisible" align-center destroy-on-close style="width:50%;height:50%">
<!-- <el-checkbox v-model="selectedRows" /> --> <template #header>发票重开</template>
</el-table-column> <el-steps :active="setupRef" align-center style="height:60px;">
<el-table-column property="oldInvBillNum" label="作废发票号" /> <el-step title="调整明细列表" />
<el-table-column property="invBillNum" label="发票号" /> <el-step title="发票明细对比" />
<el-table-column property="settleDate" label="下线日期" /> <el-step title="发票预览" />
<el-table-column property="invGroupNum" label="发票分组号" /> </el-steps>
<el-table-column property="lu" label="零件号" /> <el-row style="padding:14px 0;height:60px;">
<el-table-column property="pn" label="标识号" /> <el-col>
<el-table-column property="qty" label="数量" /> <el-button type="primary" @click="addAdj">新建</el-button>
<el-table-column property="groupNum" label="结算分组" /> <el-button type="primary" @click="importAdj">导入</el-button>
</el-table> <el-button type="primary" @click="deleteAdj">删除</el-button>
<el-dialog v-model="innerVisible" width="45%" title="新建数据"> </el-col>
<el-form :inline="true" :model="formInline" label-width="100px"> </el-row>
<span> <el-scrollbar>
<el-button type="primary" @click="submitForm">提交</el-button> <el-row style="height:100%;">
<el-button type="primary" @click="">下一页</el-button> <el-col style="height:calc(100% - 180px);">
<app-table ref="adjListRef" :data="adjList" :columns="columns5" />
</el-col>
</el-row>
</el-scrollbar>
<template #footer>
<span class="dialog-footer">
<el-button type="primary" @click="setupRef-=1" v-if="setupRef>1">上一步</el-button>
</span> </span>
<el-form-item label="作废发票号"> <span class="dialog-footer">
<el-input v-model="formInline.oldInvBillNum"></el-input> <el-button type="primary" @click="setupRef+=1" v-if="setupRef<3">下一步</el-button>
</el-form-item> <el-button type="primary" @click="submitReOpen" v-if="setupRef==3">确定</el-button>
<el-form-item label="发票号"> </span>
<el-input v-model.number="formInline.invBillNum " type="string"></el-input> </template>
</el-form-item> </el-dialog>
<el-form-item label="下线日期"> <el-dialog v-model="addDialogVisible" align-center destroy-on-close style="width:380px;height:480px;">
<el-input v-model.number="formInline.settleDate " type="string"></el-input> <template #header>添加调整明细</template>
</el-form-item> <el-scrollbar>
<el-form-item label="发票分组号"> <el-row>
<el-input v-model.number="formInline.invGroupNum " type="string"></el-input> <el-col>
</el-form-item> <app-form
<el-form-item label="零件号"> ref="addAdjFormRef"
<el-input v-model.number="formInline.lu" type="string"></el-input> v-if="addDialogVisible&&adjModel"
</el-form-item> :schema="adjSchema"
<el-form-item label="标识号"> v-model="adjModel"
<el-input v-model.number="formInline.pn" type="string"></el-input> :hideButton="true"
</el-form-item> inline
<el-form-item label="数量"> @submit=""
<el-input v-model.number="formInline.qty" type="number"></el-input> />
</el-form-item> </el-col>
<el-form-item label="结算分组"> </el-row>
<el-input v-model.number="formInline.groupNum " type="string"></el-input> </el-scrollbar>
</el-form-item> <template #footer>
</el-form> <span class="dialog-footer">
<el-button type="primary" @click="submitAdj">确定</el-button>
</span>
</template>
</el-dialog> </el-dialog>
<el-dialog v-model="openImport" width="30%"> <el-dialog v-model="importDialogVisible" align-center destroy-on-close style="width:50%;height:50%">
<app-form> <app-form>
<div> <div>
<el-form-item :label="$t('文件')" label-width="80px"> <el-form-item :label="$t('文件')" label-width="80px">
@ -118,12 +121,7 @@ export default {
</div> </div>
<el-button type="primary" @click="openImportHandler" style="margin-left: 10px;">确定</el-button> <el-button type="primary" @click="openImportHandler" style="margin-left: 10px;">确定</el-button>
</app-form> </app-form>
</el-dialog> </el-dialog>`,
<el-button type="primary" @click="dialogVisible = false" style="margin-left: 10px;">下一页</el-button>
</el-dialog>
</span>
</template>
</el-drawer>`,
styles: html` <style> styles: html` <style>
.page-drawer .el-tab-pane { .page-drawer .el-tab-pane {
width: 100%; width: 100%;
@ -134,6 +132,17 @@ export default {
width: 100%; width: 100%;
height: calc(100vh - 160px - 40px); height: calc(100vh - 160px - 40px);
} }
.re-open .el-dialog__footer {
display: flex;
justify-content: space-between;
}
.el-dialog__body {
height: calc(100% - 120px);
}
.re-open .el-scrollbar,
.re-open .el-scrollbar__view {
height: calc(100% - 120px);
}
</style>`, </style>`,
setup() { setup() {
const fileList = ref([]); const fileList = ref([]);
@ -154,45 +163,11 @@ export default {
} }
await post(url, formData, method); await post(url, formData, method);
}; };
const formInline = reactive({
oldInvBillNum: "",
invBillNum: "",
settleDate: "",
invGroupNum: "",
lu: "",
pn: "",
qty: null,
groupNum: "",
});
//create //create
const invoiceValue = ref([]); const invoiceValue = ref([]);
const submitForm = () => { const addDialogVisible = ref(false);
const newFormInline = { ...formInline }; const importDialogVisible = ref(false);
invoiceValue.value.push(newFormInline);
Object.keys(formInline).forEach((key) => {
delete formInline[key];
});
innerVisible.value = false;
};
//delete
const selectedRows = ref([]);
const deleteRow = async () => {
const indexes = selectedRows.value.map((row) => invoiceValue.value.indexOf(row));
indexes.forEach((index) => {
invoiceValue.value.splice(index, 10000000000);
});
selectedRows.value = [];
};
const innerVisible = ref(false);
const openImport = ref(false);
const dialogVisible = ref(false); const dialogVisible = ref(false);
const handleClose = (done) => {
ElMessageBox.confirm("确认关闭")
.then(() => {
done();
})
.catch(() => {});
};
const config = useConfig(); const config = useConfig();
const drawer = ref(false); const drawer = ref(false);
const loading = ref(false); const loading = ref(false);
@ -213,6 +188,28 @@ export default {
loading.value = false; loading.value = false;
}; };
const columns1 = [ const columns1 = [
{
dataKey: "version",
title: "期间",
},
{
dataKey: "invbillNum",
title: "发票号",
},
{
dataKey: "invGroupNum",
title: "发票分组号",
},
{
dataKey: "settleGroupNum",
title: "结算分组号",
},
{
dataKey: "amt",
title: "金额",
},
];
const columns2 = [
{ {
key: "version", key: "version",
dataKey: "version", dataKey: "version",
@ -247,15 +244,11 @@ export default {
title: "业务分类", title: "业务分类",
}, },
]; ];
const columns2 = [ const columns3 = [
{ {
dataKey: "version", dataKey: "version",
title: "期间", title: "期间",
}, },
{
dataKey: "invbillNum",
title: "发票号",
},
{ {
dataKey: "invGroupNum", dataKey: "invGroupNum",
title: "发票分组号", title: "发票分组号",
@ -265,32 +258,127 @@ export default {
title: "结算分组号", title: "结算分组号",
}, },
{ {
dataKey: "amt", dataKey: "lu",
title: "金额", title: "可结算分组号",
},
{
dataKey: "lu1",
title: "不可结算分组号",
}, },
]; ];
const columns3 = [ const columns4 = [
{ {
dataKey: "version", dataKey: "oldInvBillNum",
title: "期间", title: "作废发票号",
},
{
dataKey: "invBillNum",
title: "发票号",
},
{
dataKey: "settleDate",
title: "下线日期",
}, },
{ {
dataKey: "invGroupNum", dataKey: "invGroupNum",
title: "发票分组号", title: "发票分组号",
}, },
{ {
dataKey: "settleGroupNum", dataKey: "lu",
title: "结算分组号", title: "零件号",
}, },
{ {
dataKey: "lu", dataKey: "pn",
title: "可结算分组号", title: "标识号",
}, },
{ {
dataKey: "lu1", dataKey: "qty",
title: "不可结算分组号", title: "数量",
},
{
dataKey: "groupNum",
title: "结算分组",
}, },
]; ];
const columns5 = columns4.filter((o) => o.dataKey !== "oldInvBillNum" && o.dataKey !== "invGroupNum");
columns5.unshift({
input: "selection",
});
//
const setupRef = ref(1);
const adjListRef = ref(null);
const adjList = ref([]);
const showSetupDialog = () => {
adjList.value = [];
for (let i = 0; i < 100; i++) {
adjList.value.push({ invBillNum: i });
}
setupRef.value = 1;
dialogVisible.value = true;
};
const deleteAdj = () => {
const list = adjListRef.value.getSelection();
list.forEach((o) => adjList.value.splice(o, 1));
adjListRef.value.clearSelection();
};
const adjSchema = {
type: "object",
properties: {
invBillNum: {
type: "string",
title: "发票号",
rules: [{ required: true }],
},
settleDate: {
type: "string",
title: "下线日期",
input: "datetime",
rules: [{ required: true }],
},
lu: {
type: "string",
title: "零件号",
rules: [{ required: true }],
},
pn: {
type: "string",
title: "标识号",
rules: [{ required: true }],
},
qty: {
type: "string",
title: "数量",
input: "number",
rules: [{ required: true }],
},
groupNum: {
type: "string",
title: "结算分组",
rules: [{ required: true }],
},
},
};
const defaultAdjModel = schemaToModel(adjSchema);
const adjModel = ref(Object.assign({}, defaultAdjModel));
const addAdjFormRef = ref(null);
const addAdj = () => {
adjModel.value = Object.assign({}, defaultAdjModel);
addDialogVisible.value = true;
};
const submitAdj = async () => {
try {
const valid = await addAdjFormRef.value.validate();
if (valid) {
adjList.value.unshift(JSON.parse(JSON.stringify(adjModel.value)));
addDialogVisible.value = false;
}
} catch (error) {
console.log(error);
}
};
const importAdj = async () => {
importDialogVisible.value = true;
};
return { return {
config, config,
onCommand, onCommand,
@ -300,17 +388,26 @@ export default {
columns1, columns1,
columns2, columns2,
columns3, columns3,
innerVisible, columns4,
columns4,
columns5,
addDialogVisible,
dialogVisible, dialogVisible,
handleClose,
prop, prop,
formInline,
submitForm,
invoiceValue, invoiceValue,
deleteRow, importDialogVisible,
selectedRows,
openImport,
openImportHandler, openImportHandler,
setupRef,
showSetupDialog,
adjList,
adjListRef,
deleteAdj,
addAdj,
submitAdj,
addAdjFormRef,
adjSchema,
adjModel,
importAdj,
}; };
}, },
}; };

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

@ -229,7 +229,7 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran
o.factory == data.factory && o.factory == data.factory &&
o.Configcode == data.Configcode); o.Configcode == data.Configcode);
var log = new VmiLog var log = new VmiLog(GuidGenerator.Create())
{ {
LogType = logType, LogType = logType,
ChangedType = VmiType.In, ChangedType = VmiType.In,
@ -308,7 +308,7 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran
o.OrderNum == data.OrderNum && o.OrderNum == data.OrderNum &&
o.factory == data.factory && o.factory == data.factory &&
o.Configcode == data.Configcode); o.Configcode == data.Configcode);
var log = new VmiLog var log = new VmiLog(GuidGenerator.Create())
{ {
LogType = logType, LogType = logType,
ChangedType = VmiType.Out, ChangedType = VmiType.Out,
@ -415,8 +415,12 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran
[HttpPost] [HttpPost]
public async Task<string> BalanceExport(RequestDto input) public async Task<string> BalanceExport(RequestDto input)
{ {
var entities = await _balanceRepository.WhereIf(input.Filters?.Count != 0, input.Filters.ToLambda<VmiBalance>()) IQueryable<VmiBalance> query = _balanceRepository.WhereIf(input.Filters?.Count != 0, input.Filters.ToLambda<VmiBalance>());
.ToListAsync().ConfigureAwait(false); if (!string.IsNullOrEmpty(input.Sorting))
{
query = DynamicQueryableExtensions.OrderBy(query, input.Sorting);
}
var entities = await query.ToListAsync().ConfigureAwait(false);
var fileName = $"库存余额_{DateTime.Now.ToString("yyyy-MM-dd_HH:mm:ss")}.xlsx"; 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); await _fileContainer.SaveAsync(fileName, content, true).ConfigureAwait(false);
@ -424,34 +428,54 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran
} }
/// <summary> /// <summary>
/// 补货数据导出 /// 库存事务查询
/// </summary> /// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost] [HttpPost]
public async Task<string> ReplenishedExportAsync(RequestDto input) public async Task<PagedResultDto<VmiLog>> Log(LogRequestDto input)
{ {
var entities = await _logRepository.WhereIf(input.Filters?.Count != 0, input.Filters.ToLambda<VmiLog>()) var entities = await _logRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false);
.ToListAsync().ConfigureAwait(false); var totalCount = await _logRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false);
var fileName = $"补货数据_{DateTime.Now.ToString("yyyy-MM-dd_HH:mm:ss")}.xlsx"; return new PagedResultDto<VmiLog>(totalCount, entities);
var content = this.GetContent(entities, "补货数据_"); //return QueryLogFromTSDb(input);
}
/// <summary>
/// 库存事务导出
/// </summary>
[HttpPost]
public async Task<string> LogExport(RequestDto input)
{
IQueryable<VmiLog> query = _logRepository.WhereIf(input.Filters?.Count != 0, input.Filters.ToLambda<VmiLog>());
if (!string.IsNullOrEmpty(input.Sorting))
{
query = DynamicQueryableExtensions.OrderBy(query, input.Sorting);
}
var entities = await query.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); await _fileContainer.SaveAsync(fileName, content, true).ConfigureAwait(false);
return fileName; return fileName;
} }
/// <summary> /// <summary>
/// 库存事务查询 /// 补货数据导出
/// </summary> /// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost] [HttpPost]
public async Task<PagedResultDto<VmiLog>> Log(LogRequestDto input) public async Task<string> ReplenishedExportAsync(RequestDto input)
{ {
var query = _logRepository.WhereIf(input.Filters?.Count != 0, input.Filters.ToLambda<VmiLog>()) IQueryable<VmiLog> query = _logRepository.WhereIf(input.Filters?.Count != 0, input.Filters.ToLambda<VmiLog>());
.WhereIf(input.LogTypes?.Count != 0, o => input.LogTypes.Contains(o.LogType)); query = query.Where(o => o.IsReplenished.HasValue && o.IsReplenished.Value == true);
var totalCount = await query.CountAsync().ConfigureAwait(false); if (!string.IsNullOrEmpty(input.Sorting))
query = string.IsNullOrEmpty(input.Sorting) ? query : DynamicQueryableExtensions.OrderBy(query, input.Sorting); {
var entities = query.Skip(input.SkipCount).Take(input.MaxResultCount).ToList(); query = DynamicQueryableExtensions.OrderBy(query, input.Sorting);
return new PagedResultDto<VmiLog>(totalCount, entities); }
//return QueryLogFromTSDb(input); var entities = await query.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;
} }
private PagedResultDto<VmiLog> QueryLogFromTSDb(RequestDto input) private PagedResultDto<VmiLog> QueryLogFromTSDb(RequestDto input)
@ -547,7 +571,7 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran
{ {
log.LogType = VmiLogType.Type600; log.LogType = VmiLogType.Type600;
log.ChangedType = VmiType.Out; log.ChangedType = VmiType.Out;
log.Qty=-log.Qty; log.Qty = -log.Qty;
await this.Out(VmiLogType.Type600, null, log).ConfigureAwait(false); await this.Out(VmiLogType.Type600, null, log).ConfigureAwait(false);
} }
} }

Loading…
Cancel
Save