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

View File

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