|
|
@@ -244,13 +244,13 @@
|
|
|
</template>
|
|
|
|
|
|
<!-- 数量 -->
|
|
|
- <template v-slot:packingQuantity="{ row, $index }">
|
|
|
+ <template v-slot:quantity="{ row, $index }">
|
|
|
<template v-if="row.isSave">
|
|
|
- {{ row.packingQuantity }}
|
|
|
+ {{ row.quantity }}
|
|
|
</template>
|
|
|
<el-form-item
|
|
|
v-else
|
|
|
- :prop="'productList.' + $index + '.packingQuantity'"
|
|
|
+ :prop="'productList.' + $index + '.quantity'"
|
|
|
:rules="{
|
|
|
required: true,
|
|
|
message: '请输入数量',
|
|
|
@@ -258,12 +258,12 @@
|
|
|
}"
|
|
|
>
|
|
|
<el-input
|
|
|
- :ref="'packingQuantity' + $index"
|
|
|
+ :ref="'quantity' + $index"
|
|
|
type="number"
|
|
|
@keyup.native="
|
|
|
- moveFocus($event, $index, 'packingQuantity', '产品', row)
|
|
|
+ moveFocus($event, $index, 'quantity', '产品', row)
|
|
|
"
|
|
|
- v-model="row.packingQuantity"
|
|
|
+ v-model="row.quantity"
|
|
|
@input="computeNum(row, $index, true)"
|
|
|
>
|
|
|
</el-input>
|
|
|
@@ -271,13 +271,13 @@
|
|
|
</template>
|
|
|
|
|
|
<!-- 单位 -->
|
|
|
- <template v-slot:packingUnit="{ row, $index }">
|
|
|
+ <template v-slot:unit="{ row, $index }">
|
|
|
<template v-if="row.isSave">
|
|
|
- {{ row.packingUnit }}
|
|
|
+ {{ row.unit }}
|
|
|
</template>
|
|
|
<el-form-item
|
|
|
v-else
|
|
|
- :prop="'productList.' + $index + '.packingUnit'"
|
|
|
+ :prop="'productList.' + $index + '.unit'"
|
|
|
:rules="{
|
|
|
required: true,
|
|
|
message: '请选择单位',
|
|
|
@@ -285,7 +285,7 @@
|
|
|
}"
|
|
|
>
|
|
|
<el-select
|
|
|
- v-model="row.packingUnitId"
|
|
|
+ v-model="row.unitId"
|
|
|
placeholder="请选择"
|
|
|
@change="computeNum(row, $index)"
|
|
|
>
|
|
|
@@ -319,7 +319,7 @@
|
|
|
:min="0"
|
|
|
controls-position="right"
|
|
|
@change="inputsingleWeight(row, $index)"
|
|
|
- :disabled="row.weightUnit == row.packingUnit"
|
|
|
+ :disabled="row.weightUnit == row.unit"
|
|
|
:controls="false"
|
|
|
style="width: 100%"
|
|
|
></el-input-number>
|
|
|
@@ -337,7 +337,7 @@
|
|
|
placeholder="请输入"
|
|
|
type="number"
|
|
|
@input="inputWeight(row, $index)"
|
|
|
- :disabled="row.weightUnit == row.packingUnit"
|
|
|
+ :disabled="row.weightUnit == row.unit"
|
|
|
></el-input>
|
|
|
</template>
|
|
|
|
|
|
@@ -1144,16 +1144,30 @@
|
|
|
// 数量
|
|
|
{
|
|
|
label: '数量',
|
|
|
- prop: 'packingQuantity',
|
|
|
- slot: 'packingQuantity',
|
|
|
+ prop: 'quantity',
|
|
|
+ slot: 'quantity',
|
|
|
align: 'center',
|
|
|
width: 100
|
|
|
},
|
|
|
// 单位
|
|
|
{
|
|
|
label: '单位',
|
|
|
+ prop: 'unit',
|
|
|
+ slot: 'unit',
|
|
|
+ align: 'center',
|
|
|
+ width: 100
|
|
|
+ },
|
|
|
+ // 数量
|
|
|
+ {
|
|
|
+ label: '包装数量',
|
|
|
+ prop: 'packingQuantity',
|
|
|
+ align: 'center',
|
|
|
+ width: 100
|
|
|
+ },
|
|
|
+ // 单位
|
|
|
+ {
|
|
|
+ label: '包装单位',
|
|
|
prop: 'packingUnit',
|
|
|
- slot: 'packingUnit',
|
|
|
align: 'center',
|
|
|
width: 100
|
|
|
},
|
|
|
@@ -1453,17 +1467,17 @@
|
|
|
async computeNum(row, index, isClear) {
|
|
|
console.log('row, index', row, index);
|
|
|
let data = row.packingSpecificationOption.find(
|
|
|
- (item) => item.id == row.packingUnitId
|
|
|
+ (item) => item.id == row.unitId
|
|
|
);
|
|
|
- row.packingUnit = data.conversionUnit;
|
|
|
+ row.unit = data.conversionUnit;
|
|
|
// 清空仓库(包装数量输入)
|
|
|
if (isClear) {
|
|
|
- if (row.packingQuantity < 0) {
|
|
|
- this.$set(this.productList[index], 'packingQuantity', 1);
|
|
|
+ if (row.quantity < 0) {
|
|
|
+ this.$set(this.productList[index], 'quantity', 1);
|
|
|
}
|
|
|
}
|
|
|
//如果有包装数量和包装单位
|
|
|
- if (row.packingQuantity && row.packingUnit) {
|
|
|
+ if (row.quantity && row.unit) {
|
|
|
//获取仓库
|
|
|
const res = await warehouseDefinition.list({
|
|
|
// inventoryType: this.form.categoryLevelTopId
|
|
|
@@ -1478,7 +1492,7 @@
|
|
|
let table1 = [];
|
|
|
table1.push({
|
|
|
measureQuantity: row.measureQuantity,
|
|
|
- packingQuantity: row.packingQuantity,
|
|
|
+ packingQuantity: row.quantity,
|
|
|
warehouseName: name,
|
|
|
warehouseId: res[0].id
|
|
|
});
|
|
|
@@ -1501,14 +1515,14 @@
|
|
|
|
|
|
console.log(row, 'rowwwwwwwwwwwwww');
|
|
|
|
|
|
- let total = Number(row.packingQuantity);
|
|
|
+ let total = Number(row.quantity);
|
|
|
console.log(total, '111');
|
|
|
if (
|
|
|
- row.packingUnit == row.measureUnit &&
|
|
|
+ row.unit == row.measureUnit &&
|
|
|
row.measureUnit == '立方' &&
|
|
|
row.netWeight
|
|
|
) {
|
|
|
- total = Number(row.packingQuantity) * row.netWeight;
|
|
|
+ total = Number(row.quantity) * row.netWeight;
|
|
|
console.log(
|
|
|
total,
|
|
|
'单位是立方,计量单位也是立方,如果有单重,就计量数量x单重=总重'
|
|
|
@@ -1535,7 +1549,7 @@
|
|
|
console.log(packingBoolen, 'packingBoolen');
|
|
|
console.log(measureBoolen, 'measureBoolen');
|
|
|
|
|
|
- if (packingBoolen && measureBoolen && row.packingUnit != 'L') {
|
|
|
+ if (packingBoolen && measureBoolen && row.unit != 'L') {
|
|
|
row.weight = total;
|
|
|
console.log(total, '6');
|
|
|
}
|
|
|
@@ -1543,19 +1557,53 @@
|
|
|
if (row.measureUnit == row.weightUnit) {
|
|
|
weight = row.measureQuantity;
|
|
|
// 如果重量单位和包装单位一致,则单重0
|
|
|
- if (row.weightUnit == row.packageUnit) {
|
|
|
+ if (row.weightUnit == row.unit) {
|
|
|
row.singleWeight = 0;
|
|
|
} else {
|
|
|
row.singleWeight =
|
|
|
- Math.trunc(
|
|
|
- (row.measureQuantity / row.packingQuantity) * 10000
|
|
|
- ) / 10000;
|
|
|
+ Math.trunc((row.measureQuantity / row.quantity) * 10000) /
|
|
|
+ 10000;
|
|
|
}
|
|
|
} else if (row.singleWeight) {
|
|
|
weight = row.measureQuantity * Number(row.singleWeight);
|
|
|
}
|
|
|
this.$set(this.productList[index], 'weight', weight);
|
|
|
+ this.$set(
|
|
|
+ this.productList[index],
|
|
|
+ 'packingQuantity',
|
|
|
+ this.setPNum(row)
|
|
|
+ );
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ setPNum(row) {
|
|
|
+ let pNum = 0;
|
|
|
+ if (row.unitId) {
|
|
|
+ let splitIndex = row.packingSpecificationOption.findIndex(
|
|
|
+ (item) => item.id == row.unitId
|
|
|
+ );
|
|
|
+ if (splitIndex == 0) {
|
|
|
+ pNum = Math.ceil(
|
|
|
+ row.measureQuantity /
|
|
|
+ row.packingSpecificationOption[1]?.packageCell
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if (splitIndex == 1) {
|
|
|
+ pNum = row.quantity;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (; splitIndex > 1; splitIndex--) {
|
|
|
+ pNum = Math.ceil(
|
|
|
+ row.quantity *
|
|
|
+ row.packingSpecificationOption[splitIndex].packageCell
|
|
|
+ );
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ pNum = Math.ceil(
|
|
|
+ row.measureQuantity / row.packingSpecificationOption[1]?.packageCell
|
|
|
+ );
|
|
|
}
|
|
|
+ return pNum;
|
|
|
},
|
|
|
// 获取动态表头
|
|
|
getFieldModel() {
|
|
|
@@ -1568,7 +1616,9 @@
|
|
|
showOverflowTooltip: true
|
|
|
};
|
|
|
});
|
|
|
- this.newColumns = [...newRes].filter(item => item.prop != 'extField.packingSpecification');
|
|
|
+ this.newColumns = [...newRes].filter(
|
|
|
+ (item) => item.prop != 'extField.packingSpecification'
|
|
|
+ );
|
|
|
});
|
|
|
},
|
|
|
// 初始化信息
|
|
|
@@ -1652,16 +1702,19 @@
|
|
|
await storageApi.getCategoryPackageDisposition({
|
|
|
categoryIds: res.map((item) => item.id)
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
let packingSpecificationOption = res.map((item) => {
|
|
|
return {
|
|
|
id: item.id,
|
|
|
packingSpecification: packingSpecification
|
|
|
.filter((ite) => item.id == ite.categoryId)
|
|
|
.sort((a, b) => a.sort - b.sort)
|
|
|
- }
|
|
|
+ };
|
|
|
});
|
|
|
- console.log(packingSpecificationOption,'packingSpecificationOption')
|
|
|
+ console.log(
|
|
|
+ packingSpecificationOption,
|
|
|
+ 'packingSpecificationOption'
|
|
|
+ );
|
|
|
|
|
|
this.productList = this.saleProductList.map(
|
|
|
(filtersItem, index) => {
|
|
|
@@ -1670,16 +1723,21 @@
|
|
|
detailItem.code == filtersItem.productCode ||
|
|
|
detailItem.code == filtersItem.categoryCode
|
|
|
);
|
|
|
- const packingSpecificationItem = packingSpecificationOption.find(packingSpecificationItem=>packingSpecificationItem.id==filtersItem.productId||packingSpecificationItem.id==filtersItem.categoryId)?.packingSpecification
|
|
|
+ const packingSpecificationItem =
|
|
|
+ packingSpecificationOption.find(
|
|
|
+ (packingSpecificationItem) =>
|
|
|
+ packingSpecificationItem.id == filtersItem.productId ||
|
|
|
+ packingSpecificationItem.id == filtersItem.categoryId
|
|
|
+ )?.packingSpecification;
|
|
|
|
|
|
// 显示规格
|
|
|
let packingSpecificationLabel = packingSpecificationItem
|
|
|
- .map((item) => {
|
|
|
- if (item.sort > 0) {
|
|
|
- return `${item.packageCell}${item.packageUnit}/${item.conversionUnit}`;
|
|
|
- }
|
|
|
- })
|
|
|
- .filter((item) => !!item);
|
|
|
+ .map((item) => {
|
|
|
+ if (item.sort > 0) {
|
|
|
+ return `${item.packageCell}${item.packageUnit}/${item.conversionUnit}`;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .filter((item) => !!item);
|
|
|
|
|
|
const newSpecificationOption = packingSpecificationItem;
|
|
|
console.log(
|
|
|
@@ -1703,17 +1761,27 @@
|
|
|
filtersItem.sendTotalWeight ||
|
|
|
filtersItem.receiveTotalWeight;
|
|
|
}
|
|
|
- let packingQuantity =
|
|
|
+ let quantity =
|
|
|
filtersItem.totalCountNew ||
|
|
|
filtersItem.purchaseCount ||
|
|
|
filtersItem.totalCount ||
|
|
|
0;
|
|
|
- console.log(packingQuantity, 'packingQudasdasdantity');
|
|
|
- let packingUnit =
|
|
|
- filtersItem.purchaseUnit || filtersItem.measuringUnit || '';
|
|
|
|
|
|
+ let unit =
|
|
|
+ filtersItem.purchaseUnit || filtersItem.measuringUnit || '';
|
|
|
let unitPrice = filtersItem.singlePrice || 0;
|
|
|
let pricingWay = filtersItem.pricingWay || '';
|
|
|
+ let packingQuantity = this.setPNum({
|
|
|
+ unitId: filtersItem.purchaseUnitId || filtersItem.saleUnitId,
|
|
|
+ packingSpecificationOption: newSpecificationOption, // 包装规格选项
|
|
|
+ measureQuantity:
|
|
|
+ filtersItem &&
|
|
|
+ filtersItem.isAllPackageData &&
|
|
|
+ filtersItem.isAllPackageData == 1
|
|
|
+ ? filtersItem.quantity
|
|
|
+ : measureQuantity, // 计量数量
|
|
|
+ quantity
|
|
|
+ });
|
|
|
let singleWeight =
|
|
|
filtersItem.singleWeight ||
|
|
|
this.detailProductList[0]?.singleWeight ||
|
|
|
@@ -1745,7 +1813,7 @@
|
|
|
} else {
|
|
|
batchNo = batchNo1;
|
|
|
}
|
|
|
- console.log(newSpecificationOption,'dsd')
|
|
|
+ console.log(newSpecificationOption, 'dsd');
|
|
|
|
|
|
return {
|
|
|
index: this.productList.length + index,
|
|
|
@@ -1768,7 +1836,12 @@
|
|
|
packingSpecification: item.packingSpecification, // 包装规格
|
|
|
packingSpecificationOption: newSpecificationOption, // 包装规格选项
|
|
|
packingSpecificationLabel: packingSpecificationLabel, // 包装规格显示
|
|
|
- // minPackingQuantity: minPackingQuantity, // 最小包装单元数量
|
|
|
+ quantity:
|
|
|
+ filtersItem &&
|
|
|
+ filtersItem.isAllPackageData &&
|
|
|
+ filtersItem.isAllPackageData == 1
|
|
|
+ ? filtersItem.packingCount
|
|
|
+ : quantity,
|
|
|
packingQuantity:
|
|
|
filtersItem &&
|
|
|
filtersItem.isAllPackageData &&
|
|
|
@@ -1780,7 +1853,14 @@
|
|
|
filtersItem.isAllPackageData &&
|
|
|
filtersItem.isAllPackageData == 1
|
|
|
? filtersItem.packingUnit
|
|
|
- : packingUnit, // 单位
|
|
|
+ : item.packingUnit, // 单位
|
|
|
+
|
|
|
+ unit:
|
|
|
+ filtersItem &&
|
|
|
+ filtersItem.isAllPackageData &&
|
|
|
+ filtersItem.isAllPackageData == 1
|
|
|
+ ? filtersItem.packingUnit
|
|
|
+ : unit, // 单位
|
|
|
measureQuantity:
|
|
|
filtersItem &&
|
|
|
filtersItem.isAllPackageData &&
|
|
|
@@ -1794,14 +1874,9 @@
|
|
|
filtersItem.isAllPackageData == 1
|
|
|
? filtersItem.measuringUnit
|
|
|
: item.measuringUnit, // 计量单位
|
|
|
- packingUnitId:
|
|
|
- filtersItem.purchaseUnitId || filtersItem.saleUnitId,
|
|
|
- modelKey: filtersItem.modelKey
|
|
|
- ? filtersItem.modelKey
|
|
|
- : '', // 机型
|
|
|
- colorKey: filtersItem.colorKey
|
|
|
- ? filtersItem.colorKey
|
|
|
- : '', // 颜色
|
|
|
+ unitId: filtersItem.purchaseUnitId || filtersItem.saleUnitId,
|
|
|
+ modelKey: filtersItem.modelKey ? filtersItem.modelKey : '', // 机型
|
|
|
+ colorKey: filtersItem.colorKey ? filtersItem.colorKey : '', // 颜色
|
|
|
measureType: item.measureType, // 计量方式
|
|
|
netWeight: item.netWeight > -1 ? item.netWeight : 0, // 净重
|
|
|
singleWeight: singleWeight || 0, // 单重重量
|
|
|
@@ -1855,13 +1930,14 @@
|
|
|
this.detailList.forEach((item) => {
|
|
|
const key = `${item.productCode}_${item.batchNo}_${item.colorKey}_${item.warehouseId}_${item.modelType}`;
|
|
|
const existIndex = mergedList.findIndex(
|
|
|
- (m) => `${m.productCode}_${m.batchNo}_${m.colorKey}_${m.warehouseId}_${m.modelType}` === key
|
|
|
+ (m) =>
|
|
|
+ `${m.productCode}_${m.batchNo}_${m.colorKey}_${m.warehouseId}_${m.modelType}` ===
|
|
|
+ key
|
|
|
);
|
|
|
if (existIndex > -1) {
|
|
|
mergedList[existIndex].quantity += item.quantity;
|
|
|
mergedList[existIndex].packingWeight += item.packingWeight;
|
|
|
mergedList[existIndex].packingQuantity += item.packingQuantity;
|
|
|
-
|
|
|
} else {
|
|
|
mergedList.push({ ...item });
|
|
|
}
|
|
|
@@ -1901,9 +1977,12 @@
|
|
|
packingSpecification: packingSpecification
|
|
|
.filter((ite) => item.id == ite.categoryId)
|
|
|
.sort((a, b) => a.sort - b.sort)
|
|
|
- }
|
|
|
+ };
|
|
|
});
|
|
|
- console.log(packingSpecificationOptions,'packingSpecificationOptions')
|
|
|
+ console.log(
|
|
|
+ packingSpecificationOptions,
|
|
|
+ 'packingSpecificationOptions'
|
|
|
+ );
|
|
|
// this.packingSpecificationOption = res.map((item) => {
|
|
|
// return packingSpecification
|
|
|
// .filter((ite) => item.id == ite.categoryId)
|
|
|
@@ -1955,9 +2034,20 @@
|
|
|
// }
|
|
|
// })
|
|
|
// .filter((item) => !!item);
|
|
|
- const packingSpecificationItem = packingSpecificationOptions.find(packingSpecificationItem=>packingSpecificationItem.id==filtersItem.productId)?.packingSpecification
|
|
|
+ const packingSpecificationItem =
|
|
|
+ packingSpecificationOptions.find(
|
|
|
+ (packingSpecificationItem) =>
|
|
|
+ packingSpecificationItem.id == filtersItem.productId
|
|
|
+ )?.packingSpecification;
|
|
|
|
|
|
- console.log('packingSpecificationLabel~~~~~~', this.detailList, res, packingSpecification, packingSpecificationOptions, packingSpecificationItem);
|
|
|
+ console.log(
|
|
|
+ 'packingSpecificationLabel~~~~~~',
|
|
|
+ this.detailList,
|
|
|
+ res,
|
|
|
+ packingSpecification,
|
|
|
+ packingSpecificationOptions,
|
|
|
+ packingSpecificationItem
|
|
|
+ );
|
|
|
|
|
|
let packingQuantity =
|
|
|
filtersItem.totalCountNew ||
|
|
|
@@ -1966,14 +2056,13 @@
|
|
|
0;
|
|
|
console.log(packingQuantity, 'packingQudasdasdantity');
|
|
|
// 显示规格
|
|
|
- let packingSpecificationLabel = packingSpecificationItem?.map((item) => {
|
|
|
- if (item.sort > 0) {
|
|
|
- return `${item.packageCell}${item.packageUnit}/${item.conversionUnit}`;
|
|
|
- }
|
|
|
- })
|
|
|
- .filter((item) => !!item);
|
|
|
-
|
|
|
-
|
|
|
+ let packingSpecificationLabel = packingSpecificationItem
|
|
|
+ ?.map((item) => {
|
|
|
+ if (item.sort > 0) {
|
|
|
+ return `${item.packageCell}${item.packageUnit}/${item.conversionUnit}`;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .filter((item) => !!item);
|
|
|
|
|
|
const newSpecificationOption = packingSpecificationItem;
|
|
|
|
|
|
@@ -2078,12 +2167,9 @@
|
|
|
: '', // 机型
|
|
|
batchNo: filtersItem?.batchNo || batchNo, // 批次号
|
|
|
supplierListOptions: supplierList[item.id], // 供应商列表
|
|
|
- supplierId:
|
|
|
- filtersItem?.supplierId || item.supplierId, // 供应商id
|
|
|
- supplierCode:
|
|
|
- filtersItem?.supplierCode || item.supplierCode,
|
|
|
- supplierName:
|
|
|
- filtersItem?.supplierName || item.supplierName, // 供应商名称
|
|
|
+ supplierId: filtersItem?.supplierId || item.supplierId, // 供应商id
|
|
|
+ supplierCode: filtersItem?.supplierCode || item.supplierCode,
|
|
|
+ supplierName: filtersItem?.supplierName || item.supplierName, // 供应商名称
|
|
|
approvalNumber: item.approvalNumber, // 批准文号
|
|
|
productionRequirements: filtersItem.productionRequirements,
|
|
|
packingSpecification: item.packingSpecification, // 包装规格
|
|
|
@@ -2096,7 +2182,9 @@
|
|
|
// ).length
|
|
|
// : this.detailList.length || this.form.detailList.length, // 包装数量
|
|
|
|
|
|
- packingQuantity: this.isMoreProduct ? filtersItem.packingQuantity : filtersItem.packingQuantity || this.detailList.length,
|
|
|
+ packingQuantity: this.isMoreProduct
|
|
|
+ ? filtersItem.packingQuantity
|
|
|
+ : filtersItem.packingQuantity || this.detailList.length,
|
|
|
packingUnit: packingUnit, // 单位
|
|
|
measureQuantity: this.isMoreProduct
|
|
|
? filtersItem.quantity
|
|
|
@@ -2428,7 +2516,7 @@
|
|
|
switch (type) {
|
|
|
case '产品':
|
|
|
listLength = this.productList.length;
|
|
|
- keyfield = ['batchNo', 'packingQuantity', 'unitPrice', 'purpose'];
|
|
|
+ keyfield = ['batchNo', 'quantity', 'unitPrice', 'purpose'];
|
|
|
break;
|
|
|
case '包装':
|
|
|
listLength = this.showPackingList.length;
|
|
|
@@ -3074,8 +3162,9 @@
|
|
|
packingSpecificationLabel: packingSpecificationLabel, // 包装规格显示
|
|
|
minPackingQuantity: '', // 最小包装单元数量
|
|
|
packingQuantity: '', // 包装数量
|
|
|
- packingUnit: item.measuringUnit, // 单位
|
|
|
- packingUnitId: newSpecificationOption[index].find(
|
|
|
+ packingUnit: item.packingUnit, // 包装数量
|
|
|
+ unit: item.measuringUnit, // 单位
|
|
|
+ unitId: newSpecificationOption[index].find(
|
|
|
(v) => v.conversionUnit == item.measuringUnit
|
|
|
)?.id, // 单位
|
|
|
measureQuantity: 0, // 计量数量
|
|
|
@@ -3099,8 +3188,8 @@
|
|
|
let list = this.productList.map(async (row, index) => {
|
|
|
let fileds = [
|
|
|
`productList.${index}.batchNo`,
|
|
|
- `productList.${index}.packingQuantity`,
|
|
|
- `productList.${index}.packingUnit`,
|
|
|
+ `productList.${index}.quantity`,
|
|
|
+ `productList.${index}.unit`,
|
|
|
`productList.${index}.warehouseId`
|
|
|
];
|
|
|
if (row.isSave) {
|
|
|
@@ -3245,8 +3334,8 @@
|
|
|
return new Promise(async (resolve) => {
|
|
|
let fileds = [
|
|
|
`productList.${index}.batchNo`,
|
|
|
- `productList.${index}.packingQuantity`,
|
|
|
- `productList.${index}.packingUnit`,
|
|
|
+ `productList.${index}.quantity`,
|
|
|
+ `productList.${index}.unit`,
|
|
|
`productList.${index}.warehouseId`
|
|
|
];
|
|
|
|
|
|
@@ -3355,24 +3444,22 @@
|
|
|
|
|
|
// 处理单位为KG类的情况
|
|
|
if (packingBoolen) {
|
|
|
- if (!row.isUnpack && row.packingUnit == '立方') {
|
|
|
+ if (!row.isUnpack && row.unit == '立方') {
|
|
|
packingNum = 1;
|
|
|
} else {
|
|
|
let filterArr = row.packingSpecificationOption.filter((item) => {
|
|
|
return (
|
|
|
- item.packageUnit == row.packingUnit &&
|
|
|
+ item.packageUnit == row.unit &&
|
|
|
item.packageUnit != item.conversionUnit
|
|
|
);
|
|
|
});
|
|
|
if (filterArr?.length) {
|
|
|
- packingNum = Math.ceil(
|
|
|
- row.packingQuantity / filterArr[0].packageCell
|
|
|
- );
|
|
|
+ packingNum = Math.ceil(row.quantity / filterArr[0].packageCell);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// 处理单位不为KG类,计量单位为KG类的情况
|
|
|
- let measureNum = row.packingQuantity;
|
|
|
+ let measureNum = row.quantity;
|
|
|
let num = 0;
|
|
|
|
|
|
if (measureBoolen) {
|
|
|
@@ -3395,7 +3482,7 @@
|
|
|
row.packingSpecificationOption[1]?.packageCell
|
|
|
);
|
|
|
} else {
|
|
|
- num = row.packingQuantity;
|
|
|
+ num = row.quantity;
|
|
|
}
|
|
|
}
|
|
|
console.log(packingNum, measureNum, num, '加油加油加油');
|
|
|
@@ -3407,8 +3494,8 @@
|
|
|
}
|
|
|
// 不拆包
|
|
|
if (!row.isUnpack) {
|
|
|
- if (row.packingUnit != row.measureUnit) {
|
|
|
- let pNum = row.packingQuantity;
|
|
|
+ if (row.unit != row.measureUnit) {
|
|
|
+ let pNum = row.quantity;
|
|
|
const { data } = await storageApi.getAssetNum([
|
|
|
{
|
|
|
assetCode: row.categoryCode + row.index,
|
|
|
@@ -3429,9 +3516,9 @@
|
|
|
}
|
|
|
} else {
|
|
|
if (!packingNum) {
|
|
|
- if (row.packingUnitId) {
|
|
|
+ if (row.unitId) {
|
|
|
let splitIndex = row.packingSpecificationOption.findIndex(
|
|
|
- (item) => item.id == row.packingUnitId
|
|
|
+ (item) => item.id == row.unitId
|
|
|
);
|
|
|
if (splitIndex == 0) {
|
|
|
packingNum = Math.ceil(
|
|
|
@@ -3440,12 +3527,12 @@
|
|
|
);
|
|
|
}
|
|
|
if (splitIndex == 1) {
|
|
|
- packingNum = row.packingQuantity;
|
|
|
+ packingNum = row.quantity;
|
|
|
}
|
|
|
|
|
|
for (; splitIndex > 1; splitIndex--) {
|
|
|
packingNum = Math.ceil(
|
|
|
- row.packingQuantity *
|
|
|
+ row.quantity *
|
|
|
row.packingSpecificationOption[splitIndex].packageCell
|
|
|
);
|
|
|
}
|
|
|
@@ -3469,6 +3556,7 @@
|
|
|
]);
|
|
|
|
|
|
this.generateWrappers(row, index, data);
|
|
|
+ this.$set(this.productList[index], 'packingQuantity', data.length);
|
|
|
}
|
|
|
this.$set(this.productList[index], 'isSave', true);
|
|
|
this.$set(this.productList[index], 'warehouseId', row.warehouseId);
|
|
|
@@ -3509,11 +3597,11 @@
|
|
|
console.log(measureBoolen, 'measureBoolen');
|
|
|
//行内选择仓库
|
|
|
if (idx > -1 && type != 'batch') {
|
|
|
- if (row.packingQuantity > 0) {
|
|
|
+ if (row.quantity > 0) {
|
|
|
//不拆
|
|
|
if (!row.isUnpack) {
|
|
|
//计量和包装单位相同
|
|
|
- if (row.measureUnit == row.packingUnit) {
|
|
|
+ if (row.measureUnit == row.unit) {
|
|
|
let pNum = 0;
|
|
|
let mNum = row.measureQuantity;
|
|
|
this.$refs.wareHouseDailogRef.open(
|
|
|
@@ -3525,7 +3613,7 @@
|
|
|
// this.form.categoryLevelTopId
|
|
|
);
|
|
|
} else {
|
|
|
- let pNum = row.packingQuantity;
|
|
|
+ let pNum = row.quantity;
|
|
|
let mNum = row.measureQuantity;
|
|
|
this.$refs.wareHouseDailogRef.open(
|
|
|
pNum,
|
|
|
@@ -3537,99 +3625,106 @@
|
|
|
);
|
|
|
}
|
|
|
} else {
|
|
|
- if (packingBoolen) {
|
|
|
- console.log(
|
|
|
- packingBoolen,
|
|
|
- 'packingBoolen',
|
|
|
- row.packageUnit,
|
|
|
- row.isUnpack
|
|
|
- );
|
|
|
-
|
|
|
- let filterArr = row.packingSpecificationOption.filter(
|
|
|
- (item) => {
|
|
|
- return (
|
|
|
- item.packageUnit == row.packingUnit &&
|
|
|
- item.packageUnit != item.conversionUnit
|
|
|
- );
|
|
|
- }
|
|
|
- );
|
|
|
+ let num = Math.ceil(
|
|
|
+ row.measureQuantity /
|
|
|
+ row.packingSpecificationOption[1]?.packageCell
|
|
|
+ );
|
|
|
|
|
|
- let num = Math.ceil(
|
|
|
- row.packingQuantity / filterArr[0].packageCell
|
|
|
- );
|
|
|
- this.$refs.wareHouseDailogRef.open(
|
|
|
- num,
|
|
|
+ this.$refs.wareHouseDailogRef.open(
|
|
|
+ num,
|
|
|
row.measureQuantity,
|
|
|
idx,
|
|
|
row.warehouseId,
|
|
|
row.warehouseName + ''
|
|
|
- // this.form.categoryLevelTopId
|
|
|
- );
|
|
|
- } else {
|
|
|
- console.log(measureBoolen, 'measureBoolen');
|
|
|
- let num = row.packingQuantity;
|
|
|
- if (measureBoolen) {
|
|
|
- let splitIndex = row.packingSpecificationOption.findIndex(
|
|
|
- (item) =>
|
|
|
- item.conversionUnit == row.packingUnit &&
|
|
|
- item.packageUnit != item.conversionUnit
|
|
|
- );
|
|
|
- for (; splitIndex > 1; splitIndex--) {
|
|
|
- num = this.$math.format(
|
|
|
- num *
|
|
|
- row.packingSpecificationOption[splitIndex].packageCell,
|
|
|
- 14
|
|
|
- );
|
|
|
- }
|
|
|
- this.$refs.wareHouseDailogRef.open(
|
|
|
- num,
|
|
|
- row.measureQuantity,
|
|
|
- idx,
|
|
|
- row.warehouseId,
|
|
|
- row.warehouseName + ''
|
|
|
- // this.form.categoryLevelTopId
|
|
|
- );
|
|
|
- } else {
|
|
|
- if (
|
|
|
- row.measureType != 1 &&
|
|
|
- row.measureUnit == row.packingUnit
|
|
|
- ) {
|
|
|
- let pNum = 0;
|
|
|
- let mNum = row.measureQuantity;
|
|
|
- this.$refs.wareHouseDailogRef.open(
|
|
|
- pNum,
|
|
|
- mNum,
|
|
|
- idx,
|
|
|
- row.warehouseId,
|
|
|
- row.warehouseName + ''
|
|
|
- // this.form.categoryLevelTopId
|
|
|
- );
|
|
|
- } else {
|
|
|
- if (row.packingSpecificationOption[1]?.packageCell) {
|
|
|
- let num = Math.ceil(
|
|
|
- row.measureQuantity /
|
|
|
- row.packingSpecificationOption[1]?.packageCell
|
|
|
- );
|
|
|
- this.$refs.wareHouseDailogRef.open(
|
|
|
- num,
|
|
|
- row.measureQuantity,
|
|
|
- idx,
|
|
|
- row.warehouseId,
|
|
|
- row.warehouseName + ''
|
|
|
- );
|
|
|
- } else {
|
|
|
- this.$refs.wareHouseDailogRef.open(
|
|
|
- row.packingQuantity,
|
|
|
- row.measureQuantity,
|
|
|
- idx,
|
|
|
- row.warehouseId,
|
|
|
- row.warehouseName + ''
|
|
|
- );
|
|
|
- }
|
|
|
- console.log(num, 'num');
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ );
|
|
|
+ // if (packingBoolen) {
|
|
|
+ // console.log(
|
|
|
+ // packingBoolen,
|
|
|
+ // 'packingBoolen',
|
|
|
+ // row.packageUnit,
|
|
|
+ // row.isUnpack
|
|
|
+ // );
|
|
|
+
|
|
|
+ // let filterArr = row.packingSpecificationOption.filter(
|
|
|
+ // (item) => {
|
|
|
+ // return (
|
|
|
+ // item.packageUnit == row.unit &&
|
|
|
+ // item.packageUnit != item.conversionUnit
|
|
|
+ // );
|
|
|
+ // }
|
|
|
+ // );
|
|
|
+
|
|
|
+ // let num = Math.ceil(row.quantity / filterArr[0].packageCell);
|
|
|
+ // this.$refs.wareHouseDailogRef.open(
|
|
|
+ // num,
|
|
|
+ // row.measureQuantity,
|
|
|
+ // idx,
|
|
|
+ // row.warehouseId,
|
|
|
+ // row.warehouseName + ''
|
|
|
+ // // this.form.categoryLevelTopId
|
|
|
+ // );
|
|
|
+ // } else {
|
|
|
+ // console.log(measureBoolen, 'measureBoolen');
|
|
|
+ // let num = row.quantity;
|
|
|
+ // if (measureBoolen) {
|
|
|
+ // let splitIndex = row.packingSpecificationOption.findIndex(
|
|
|
+ // (item) =>
|
|
|
+ // item.conversionUnit == row.unit &&
|
|
|
+ // item.packageUnit != item.conversionUnit
|
|
|
+ // );
|
|
|
+ // for (; splitIndex > 1; splitIndex--) {
|
|
|
+ // num = this.$math.format(
|
|
|
+ // num *
|
|
|
+ // row.packingSpecificationOption[splitIndex].packageCell,
|
|
|
+ // 14
|
|
|
+ // );
|
|
|
+ // }
|
|
|
+ // this.$refs.wareHouseDailogRef.open(
|
|
|
+ // num,
|
|
|
+ // row.measureQuantity,
|
|
|
+ // idx,
|
|
|
+ // row.warehouseId,
|
|
|
+ // row.warehouseName + ''
|
|
|
+ // // this.form.categoryLevelTopId
|
|
|
+ // );
|
|
|
+ // } else {
|
|
|
+ // if (row.measureType != 1 && row.measureUnit == row.unit) {
|
|
|
+ // let pNum = 0;
|
|
|
+ // let mNum = row.measureQuantity;
|
|
|
+ // this.$refs.wareHouseDailogRef.open(
|
|
|
+ // pNum,
|
|
|
+ // mNum,
|
|
|
+ // idx,
|
|
|
+ // row.warehouseId,
|
|
|
+ // row.warehouseName + ''
|
|
|
+ // // this.form.categoryLevelTopId
|
|
|
+ // );
|
|
|
+ // } else {
|
|
|
+ // if (row.packingSpecificationOption[1]?.packageCell) {
|
|
|
+ // let num = Math.ceil(
|
|
|
+ // row.measureQuantity /
|
|
|
+ // row.packingSpecificationOption[1]?.packageCell
|
|
|
+ // );
|
|
|
+ // this.$refs.wareHouseDailogRef.open(
|
|
|
+ // num,
|
|
|
+ // row.measureQuantity,
|
|
|
+ // idx,
|
|
|
+ // row.warehouseId,
|
|
|
+ // row.warehouseName + ''
|
|
|
+ // );
|
|
|
+ // } else {
|
|
|
+ // this.$refs.wareHouseDailogRef.open(
|
|
|
+ // row.quantity,
|
|
|
+ // row.measureQuantity,
|
|
|
+ // idx,
|
|
|
+ // row.warehouseId,
|
|
|
+ // row.warehouseName + ''
|
|
|
+ // );
|
|
|
+ // }
|
|
|
+ // console.log(num, 'num');
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|
|
|
} else {
|
|
|
this.$message.error('请先填写包装数量!');
|
|
|
@@ -3640,17 +3735,14 @@
|
|
|
console.log(idx, `idx`);
|
|
|
console.log(type, 'type');
|
|
|
// 批量设置
|
|
|
- if (row.some((item) => !item.packingQuantity)) {
|
|
|
+ if (row.some((item) => !item.quantity)) {
|
|
|
this.$message.error('请先填写所有行的包装数量!');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
for (let i = 0; i < row.length; i++) {
|
|
|
//测量单位等于包装单位
|
|
|
- if (
|
|
|
- row[i].measureType != 1 &&
|
|
|
- row[i].measureUnit === row[i].packingUnit
|
|
|
- ) {
|
|
|
+ if (row[i].measureType != 1 && row[i].measureUnit === row[i].unit) {
|
|
|
row[i].packingQuantity2 = 0;
|
|
|
console.log(row[i].packingQuantity2);
|
|
|
} else {
|
|
|
@@ -3781,12 +3873,12 @@
|
|
|
packingBoolen,
|
|
|
'packingBoolenpackingBoolenpackingBoolenpackingBoolenpackingBoolenpackingBoolen'
|
|
|
);
|
|
|
- if (!row.isUnpack && row.packingUnit == '立方') {
|
|
|
+ if (!row.isUnpack && row.unit == '立方') {
|
|
|
num = 1;
|
|
|
} else {
|
|
|
filterArr = row.packingSpecificationOption.filter((item) => {
|
|
|
return (
|
|
|
- item.packageUnit == row.packingUnit &&
|
|
|
+ item.packageUnit == row.unit &&
|
|
|
item.packageUnit != item.conversionUnit
|
|
|
);
|
|
|
});
|
|
|
@@ -3798,7 +3890,7 @@
|
|
|
// 处理单位不为KG类,计量单位为KG类的情况
|
|
|
let splitIndex = row.packingSpecificationOption.findIndex(
|
|
|
(item) =>
|
|
|
- item.conversionUnit == row.packingUnit &&
|
|
|
+ item.conversionUnit == row.unit &&
|
|
|
item.packageUnit != item.conversionUnit
|
|
|
);
|
|
|
for (; splitIndex > 1; splitIndex--) {
|
|
|
@@ -3815,7 +3907,7 @@
|
|
|
);
|
|
|
filterArr = row.packingSpecificationOption.filter((item) => {
|
|
|
return (
|
|
|
- item.packageUnit == row.packingUnit &&
|
|
|
+ item.packageUnit == row.unit &&
|
|
|
item.packageUnit != item.conversionUnit
|
|
|
);
|
|
|
});
|
|
|
@@ -3832,10 +3924,10 @@
|
|
|
// 处理单位为KG类,计算每桶KG值
|
|
|
if (packingBoolen) {
|
|
|
measureQuantity =
|
|
|
- Number(row.packingQuantity) >
|
|
|
+ Number(row.quantity) >
|
|
|
this.$math.format(filterArr[0].packageCell * (index + 1), 14)
|
|
|
? filterArr[0].packageCell
|
|
|
- : Number(row.packingQuantity) -
|
|
|
+ : Number(row.quantity) -
|
|
|
this.$math.format(filterArr[0].packageCell * index, 14);
|
|
|
console.log(measureQuantity, 'measureQuantit1111y');
|
|
|
} else {
|
|
|
@@ -3849,7 +3941,7 @@
|
|
|
} else if (measureBoolen) {
|
|
|
let splitIndex = row.packingSpecificationOption.findIndex(
|
|
|
(item) =>
|
|
|
- item.conversionUnit == row.packingUnit &&
|
|
|
+ item.conversionUnit == row.unit &&
|
|
|
item.packageUnit != item.conversionUnit
|
|
|
);
|
|
|
for (; splitIndex > 0; splitIndex--) {
|