From 414f0d54d6c955fb74f2a1ab7ea424a52275fe02 Mon Sep 17 00:00:00 2001 From: louis <869322496@qq.com> Date: Mon, 11 Mar 2024 14:12:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../materials_inventory.service.ts | 20 +++++++++---------- src/modules/product/product.entity.ts | 1 + 2 files changed, 11 insertions(+), 10 deletions(-) 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: '产品备注' })