Merge pull request 'fix: record pdf data mistake' (#330) from fix_record_pdf_print into @hera/dev

Reviewed-on: daoyoucloud/tachycode#330
Reviewed-by: sealday <zhanglin@daoyoucloud.com>
This commit is contained in:
sealday 2024-03-08 13:49:03 +08:00
commit f92d60ad8f
2 changed files with 11 additions and 9 deletions

View File

@ -459,7 +459,8 @@ const PreviewDocument = ({
<Text style={styles.tableCell2}>{item.name}</Text>
<Text style={styles.tableCell}>{!item.count ? '' : formatQuantity(item.count, 2) + item.unit}</Text>
<Text style={styles.tableCell}>
{printSetup === PrintSetup.Display && !item.product_id && !item.isTotal
{(printSetup === PrintSetup.Display && !item.product_id && !item.isTotal) ||
(printSetup === PrintSetup.Manual && !item.product_id && !item.isTotal)
? ''
: item.total
? formatQuantity(item.total, 2)
@ -520,7 +521,8 @@ const PreviewDocument = ({
{!item.left_count ? '' : formatQuantity(item.left_count, 2) + item.left_unit}
</Text>
<Text style={styles.tableCell}>
{printSetup === PrintSetup.Display && !item.left_product_id && !item.left_isTotal
{(printSetup === PrintSetup.Display && !item.left_product_id && !item.left_isTotal) ||
(printSetup === PrintSetup.Manual && !item.left_product_id && !item.left_isTotal)
? ''
: item.left_total
? formatQuantity(item.left_total, 2)
@ -541,7 +543,8 @@ const PreviewDocument = ({
{!item.right_count ? '' : formatQuantity(item.right_count, 2) + item.right_unit}
</Text>
<Text style={styles.tableCell}>
{printSetup === PrintSetup.Display && !item.right_product_id && !item.right_isTotal
{(printSetup === PrintSetup.Display && !item.right_product_id && !item.right_isTotal) ||
(printSetup === PrintSetup.Manual && !item.right_product_id && !item.right_isTotal)
? ''
: item.right_total
? formatQuantity(item.right_total, 2)

View File

@ -161,11 +161,11 @@ export class RecordPdfService {
}
return data;
});
// 无关联产品赔偿 (打印设置为正常显示时显示物料+赔偿维修,无关联赔偿不显示)
// 无关联产品赔偿, 人工录取的情况直接为空因为excludedFee已经处理正常情况取非手动录入情况数据excludedFee已经处理
const fee =
printSetup === PrintSetup.Manual
? fee_data.filter((item) => !item.product_id && item.count_source === SourcesType.staff)
: fee_data.filter((item) => !item.product_id);
? []
: fee_data.filter((item) => !item.product_id && item.count_source !== SourcesType.staff);
const no_product_fee = fee
.map((item) => {
// 购销/暂存/盘点无费用信息
@ -220,7 +220,7 @@ export class RecordPdfService {
})
.filter((item) => item && item.count);
// 注意把手动录入的加入
const manualData = printSetup === PrintSetup.Manual ? [] : recordData.record_fee_items;
const manualData = recordData.record_fee_items;
// 因为以往逻辑是根据规则查询,这个订单中数据智能单独查询
const excludedFee =
manualData
@ -235,9 +235,8 @@ export class RecordPdfService {
const feeRule = fee_data.find((fee) => fee.fee_product_id === item.product_id);
if (feeRule) {
data['total'] = feeRule.unit_price * item.count;
data['unit'] = feeRule.unit || '';
}
const findUnit = no_product_fee.find((fee) => fee.name === data.name);
data['unit'] = findUnit ? findUnit.unit : '';
return data;
})
.filter(Boolean) || [];