feat: 导出功能优化

This commit is contained in:
louis 2024-03-11 14:12:57 +08:00
parent b07434e536
commit 414f0d54d6
2 changed files with 11 additions and 10 deletions

View File

@ -220,7 +220,7 @@ export class MaterialsInventoryService {
// 结存库存数量
balanceQuantity = calcNumber(
currentQuantity,
calcNumber(inRecord.quantity, outRecord.quantity, 'subtract'),
calcNumber(inRecord.quantity, outRecord?.quantity || 0, 'subtract'),
'add'
);
number++;
@ -233,19 +233,19 @@ export class MaterialsInventoryService {
parseFloat(`${inRecord.unitPrice || 0}`),
calcNumber(currentQuantity, inRecord.unitPrice || 0, 'multiply'),
inRecord.time,
inRecord.quantity,
inRecord.quantity || 0,
parseFloat(`${inRecord.unitPrice || 0}`),
parseFloat(`${inRecord.amount || 0}`),
outRecord?.time || '',
outRecord?.quantity || '',
parseFloat(`${outRecord.unitPrice || 0}`),
parseFloat(`${outRecord.amount || 0}`),
outRecord?.quantity || 0,
parseFloat(`${outRecord?.unitPrice || 0}`),
parseFloat(`${outRecord?.amount || 0}`),
balanceQuantity,
parseFloat(`${outRecord.unitPrice || 0}`),
calcNumber(balanceQuantity, outRecord.unitPrice || 0, 'multiply'),
outRecord?.agent || '',
parseFloat(`${inRecord?.unitPrice || 0}`),
calcNumber(balanceQuantity, inRecord?.unitPrice || 0, 'multiply'),
`${inRecord?.agent || ''}/${outRecord?.agent || ''}`,
outRecord?.issuanceNumber || '',
outRecord?.remark || ''
`${inRecord?.remark || ''}/${outRecord?.remark || ''}`
]);
}
sheet.getCell('A1').font = { size: HEADER_FONT_SIZE };
@ -268,7 +268,7 @@ export class MaterialsInventoryService {
sheet.columns.forEach((column, index: number) => {
let maxColumnLength = 0;
const autoWidth = ['B', 'C', 'U'];
const autoWidth = ['B', 'C', 'S', 'U'];
if (String.fromCharCode(65 + index) === 'B') maxColumnLength = 20;
if (autoWidth.includes(String.fromCharCode(65 + index))) {
column.eachCell({ includeEmpty: true }, (cell, rowIndex) => {

View File

@ -30,6 +30,7 @@ export class ProductEntity extends CommonEntity {
name: 'remark',
type: 'varchar',
length: 255,
nullable: true,
comment: '备注'
})
@ApiProperty({ description: '产品备注' })