diff --git a/src/modules/materials_inventory/materials_inventory.service.ts b/src/modules/materials_inventory/materials_inventory.service.ts index c305d57..09ea420 100644 --- a/src/modules/materials_inventory/materials_inventory.service.ts +++ b/src/modules/materials_inventory/materials_inventory.service.ts @@ -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) => { diff --git a/src/modules/product/product.entity.ts b/src/modules/product/product.entity.ts index 6b0ea0b..cc90a05 100644 --- a/src/modules/product/product.entity.ts +++ b/src/modules/product/product.entity.ts @@ -30,6 +30,7 @@ export class ProductEntity extends CommonEntity { name: 'remark', type: 'varchar', length: 255, + nullable: true, comment: '备注' }) @ApiProperty({ description: '产品备注' })