fix: 小结理论重量更正,报价总金额工单修改,购销单pdf工单修改,订单导入hook停用,出库入筛选基地仓库

This commit is contained in:
lyx 2024-03-12 21:33:51 +08:00
parent 1f6b802b61
commit 2245cd84e7
4 changed files with 25 additions and 24 deletions

View File

@ -199,7 +199,7 @@ const summary = (event: RecordItems, rules: any[], ruleWeight: any) => {
calc.name = category.name;
calc.count = count;
calc.unit = unit;
calc.weight = event.product.weight;
calc.weight = event.product.weight * event.count;
} else {
// 2. 存在规则(实际重量情况不计算)
const plain = rules.find((item) =>

View File

@ -40,8 +40,7 @@ export const RecordTotalPrice = (props) => {
const computeTotalPrice = () => {
const about_product = form.values.items.filter(
(item) =>
(item?.product && item?.product?.category_id == leaseData?.product?.category_id) ||
(leaseData?.product?.id > 99999 && item?.product?.id == leaseData?.product?.id - 99999),
item.product?.id === leaseData.product?.id || item.product?.category_id === leaseData.product?.id - 99999,
);
if (!leaseData || !about_product) {
return;
@ -49,13 +48,13 @@ export const RecordTotalPrice = (props) => {
let allPrice = 0;
const rule = leaseData.conversion_logic;
if (!rule) return;
if (rule.id == ConversionLogics.ActualWeight) {
if (rule.id === ConversionLogics.ActualWeight) {
// 分组总量项
const weightItem = groupWeight.find(
(item) => item.products?.find((product) => product?.id == leaseData.product?.category_id),
const weightItem = groupWeight.find((item) =>
item.products?.find((product) => product?.id === leaseData.product?.category_id),
);
// 存在该分组相关产品items
const effectiveData = about_product.find((item) => item.product?.category_id == leaseData.product?.category_id);
const effectiveData = about_product.find((item) => item.product?.category_id === leaseData.product?.category_id);
if (!effectiveData) return;
if (weightItem && weightItem.weight) {
allPrice = weightItem.weight * (leaseData.unit_price || 0);
@ -66,26 +65,26 @@ export const RecordTotalPrice = (props) => {
for (const item of about_product) {
const foundProduct = reqProduct.data.data.find((product) => product.id === item.product.id).category;
const price = leaseData.unit_price || 0;
if (rule.id == ConversionLogics.Keep) {
if (rule.id === ConversionLogics.Keep) {
allPrice += price * (item.count || 0);
} else if (rule.id == ConversionLogics.Product) {
} else if (rule.id === ConversionLogics.Product) {
if (foundProduct.convertible && !item.product?.ratio) {
console.error('产品缺少换算比例', item.product?.label);
}
const total = foundProduct.convertible ? item?.count * item.product?.ratio : item?.count;
allPrice += price * (total || 0);
} else if (rule.id == ConversionLogics.ProductWeight) {
} else if (rule.id === ConversionLogics.ProductWeight) {
allPrice += (price * (item.product?.weight || 0) * (item.count || 0)) / 1000;
} else {
const weightRule = reqWeightRules.data.data.find(
(weight_item) =>
weight_item.logic_id == rule.id &&
(weight_item.product_id == item.product?.id ||
weight_item.product_id == item.product?.category_id + 99999),
weight_item.logic_id === rule.id &&
(weight_item.product_id === item.product?.id ||
weight_item.product_id === item.product?.category_id + 99999),
);
if (weightRule && weightRule.conversion_logic_id == ConversionLogics.Keep) {
if (weightRule && weightRule.conversion_logic_id === ConversionLogics.Keep) {
allPrice += price * (item.count || 0) * (weightRule.weight || 0);
} else if (weightRule && weightRule.conversion_logic_id == ConversionLogics.Product) {
} else if (weightRule && weightRule.conversion_logic_id === ConversionLogics.Product) {
if (foundProduct.convertible && !item.product?.ratio) {
console.error('产品缺少换算比例', item.product?.label);
}
@ -132,7 +131,7 @@ export const RecordTotalPrice = (props) => {
computeTotalPrice();
}
}, [leaseData, products, groupWeight, recordWeight, reqProduct.loading, reqWeightRules.loading]);
return <span>{all_price == 0 ? '-' : formatCurrency(all_price, 2)}</span>;
return <span>{all_price === 0 ? '-' : formatCurrency(all_price, 2)}</span>;
};
RecordTotalPrice.displayName = 'RecordTotalPrice';

View File

@ -384,9 +384,11 @@ const PreviewDocument = ({
priceRule.map((item) => (
<View key={'key'} style={styles.tableContent}>
<Text style={styles.tableCell2}>{item.name}</Text>
<Text style={styles.tableCell}>{item?.unit_price && item.unit_price + '元/' + item.unit}</Text>
<Text style={styles.tableCell}>
{item.count}
{item?.unit_price && formatQuantity(item.unit_price, 2) + '元/' + item.unit}
</Text>
<Text style={styles.tableCell}>
{formatQuantity(item.count, 2)}
{item.unit}
</Text>
<Text style={styles.tableCell}>{formatCurrency(item.all_price, 2)}</Text>
@ -415,20 +417,20 @@ const PreviewDocument = ({
<View key={'key'} style={styles.tableContent}>
<Text style={styles.tableCell2}>{item.left_name}</Text>
<Text style={styles.tableCell}>
{item?.left_unit_price && item.left_unit_price + '元/' + item.left_unit}
{item?.left_unit_price && formatQuantity(item.left_unit_price, 2) + '元/' + item.left_unit}
</Text>
<Text style={styles.tableCell}>
{item.left_count}
{formatQuantity(item.left_count, 2)}
{item.left_unit}
</Text>
<Text style={styles.tableCell}>{formatCurrency(item.left_all_price, 2)}</Text>
<Text style={styles.tableCell}>{item.left_comment || ''}</Text>
<Text style={styles.tableCell2}>{item.right_name}</Text>
<Text style={styles.tableCell}>
{item?.right_unit_price && item.unit_price + '元/' + item.right_unit}
{item?.right_unit_price && formatQuantity(item.right_unit_price, 2) + '元/' + item.right_unit}
</Text>
<Text style={styles.tableCell}>
{item.right_count}
{formatQuantity(item.right_count)}
{item.right_unit}
</Text>
<Text style={styles.tableCell}>

View File

@ -17,7 +17,7 @@ export class RecordService {
// 订单发生变化时更新对应结算单的状态(需要重新计算)
this.db.on('records.afterSave', this.updateSettlementStatus.bind(this));
// 老系统导入信息系统数据record_import存储数据并根据record_import数据创建对应的单子
this.db.on('record_import.afterCreate', this.importRecord.bind(this));
// this.db.on('record_import.afterCreate', this.importRecord.bind(this));
}
/**
*
@ -510,7 +510,7 @@ export class RecordService {
// 租赁入库, out_stock = 合同中project_id, in_stock = 合同中项目的associated_company_id => 项目表id
const associatedCompanyProject = await this.db
.getRepository('project')
.findOne({ where: { company_id: contractProject.associated_company_id } });
.findOne({ where: { company_id: contractProject.associated_company_id, category: '1' } });
if (values.record_category === RecordTypes.rentInStock) {
out_stock = contractProject.dataValues;