|
|
@@ -249,6 +249,12 @@
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column label="物料代号" prop="materielCode">
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
+ {{ row.extInfo.materielCode }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
<el-table-column
|
|
|
label="数量"
|
|
|
align="center"
|
|
|
@@ -403,25 +409,26 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
label="单价"
|
|
|
- prop="price"
|
|
|
+ prop="unitPrice"
|
|
|
width="200"
|
|
|
align="center"
|
|
|
>
|
|
|
<template slot-scope="{ row, $index }">
|
|
|
<template v-if="row.isSave">
|
|
|
- {{ row.price }}元/{{ row.measureUnit }}
|
|
|
+ {{ row.unitPrice ? row.unitPrice + '/元' : '' }}
|
|
|
</template>
|
|
|
<el-form-item v-else>
|
|
|
<el-input
|
|
|
type="number"
|
|
|
- :ref="'price' + $index"
|
|
|
+ :ref="'unitPrice' + $index"
|
|
|
@keyup.native="
|
|
|
- moveFocus($event, $index, 'price', '产品', row)
|
|
|
+ moveFocus($event, $index, 'unitPrice', '产品', row)
|
|
|
"
|
|
|
- v-model.number="row.price"
|
|
|
+ v-model.number="row.unitPrice"
|
|
|
placeholder="非必填"
|
|
|
@input="
|
|
|
- (value) => (row.price = value.replace(/[^0-9.]+/g, ''))
|
|
|
+ (value) =>
|
|
|
+ (row.unitPrice = value.replace(/[^0-9.]+/g, ''))
|
|
|
"
|
|
|
>
|
|
|
<template slot="append">
|
|
|
@@ -676,9 +683,9 @@
|
|
|
@keyup.native="
|
|
|
moveFocus($event, $index, 'packing_clientCode', '包装', row)
|
|
|
"
|
|
|
- v-model="row.clientCode"
|
|
|
+ v-model="row.extInfo.clientCode"
|
|
|
></el-input>
|
|
|
- <span v-else> {{ row.clientCode }}</span>
|
|
|
+ <span v-else> {{ row.extInfo.clientCode }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="刻码" prop="engrave" width="140">
|
|
|
@@ -851,9 +858,9 @@
|
|
|
@keyup.native="
|
|
|
moveFocus($event, $index, 'material_clientCode', '物料', row)
|
|
|
"
|
|
|
- v-model="row.clientCode"
|
|
|
+ v-model="row.extInfo.clientCode"
|
|
|
></el-input>
|
|
|
- <span v-else>{{ row.clientCode }}</span>
|
|
|
+ <span v-else>{{ row.extInfo.clientCode }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="刻码" prop="engrave" width="140">
|
|
|
@@ -1091,7 +1098,7 @@
|
|
|
this.getListItems();
|
|
|
this.initUserInfo();
|
|
|
this.getNowFormatDate();
|
|
|
- if (this.$route.query.id) {
|
|
|
+ if (this.$route.query.id && !this.$route.query.name) {
|
|
|
storageApi
|
|
|
.getApplystorageDetailById(this.$route.query.id)
|
|
|
.then(async (data) => {
|
|
|
@@ -1118,7 +1125,7 @@
|
|
|
weight: item.packingWeight, // 重量
|
|
|
weightUnit: item.weightUnit, // 重量单位
|
|
|
totalMoney: '', // 总价
|
|
|
- price: item.price, // 单价
|
|
|
+ unitPrice: item.unitPrice, // 单价
|
|
|
purpose: item.purpose, // 用途
|
|
|
isUnpack: item.isUnpack, // 是否允许拆包
|
|
|
warehouseId: item.warehouseId, // 仓库Id
|
|
|
@@ -1232,14 +1239,32 @@
|
|
|
)[0].serialNo;
|
|
|
},
|
|
|
inputsingleWeight(row, index) {
|
|
|
- row.weight = row.singleWeight * row.measureQuantity;
|
|
|
+ if (
|
|
|
+ row.weight === null ||
|
|
|
+ row.weight === undefined ||
|
|
|
+ isNaN(row.weight) ||
|
|
|
+ row.weight < 0
|
|
|
+ ) {
|
|
|
+ row.weight = 0;
|
|
|
+ } else {
|
|
|
+ if (row.singleWeight && row.singleWeight > 0) {
|
|
|
+ row.weight = Number(row.singleWeight) * Number(row.measureQuantity);
|
|
|
+ } else {
|
|
|
+ row.weight = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
inputWeight(row, index) {
|
|
|
- if (isNaN(row.weight) || row.weight < 0) {
|
|
|
- row.weight = 1;
|
|
|
+ if (
|
|
|
+ row.weight === null ||
|
|
|
+ row.weight === undefined ||
|
|
|
+ isNaN(row.weight) ||
|
|
|
+ row.weight < 0
|
|
|
+ ) {
|
|
|
+ row.weight = 0;
|
|
|
}
|
|
|
row.singleWeight = row.measureQuantity
|
|
|
- ? row.weight / row.measureQuantity
|
|
|
+ ? Number(row.weight) / row.measureQuantity
|
|
|
: 0;
|
|
|
},
|
|
|
// 计算最小单元数量
|
|
|
@@ -1253,6 +1278,7 @@
|
|
|
} else if (row.packingQuantity > 9999) {
|
|
|
this.$set(this.productList[index], 'packingQuantity', 9999);
|
|
|
}
|
|
|
+
|
|
|
// else {
|
|
|
// const reg = /^[0-9]+\.[0-9]+$/;
|
|
|
// console.log(reg.test(row.packingQuantity));
|
|
|
@@ -1309,10 +1335,12 @@
|
|
|
14
|
|
|
);
|
|
|
}
|
|
|
+ console.log(total, 'total');
|
|
|
// 除了计量单位是KG以外计算总重 总重量 = 单重singleWeight * 数量measureQuantity(计量数量);
|
|
|
if (row.measuringUnit != 'KG') {
|
|
|
row.weight = row.singleWeight * row.measureQuantity;
|
|
|
}
|
|
|
+ console.log(row.measuringUnit, 'row.measuringUnit');
|
|
|
//计量数量
|
|
|
row.measureQuantity = this.changeCount(total);
|
|
|
// 判断单位和计量单位是否为不拆物料层规格
|
|
|
@@ -1362,9 +1390,6 @@
|
|
|
return {
|
|
|
...item,
|
|
|
index,
|
|
|
- // packingQuantity: 1,
|
|
|
- // minPackingQuantity: item.measureQuantity,
|
|
|
- // measureUnit: item.measuringUnit,
|
|
|
batchNo,
|
|
|
id: '',
|
|
|
warehouseIds: [item.warehouseId],
|
|
|
@@ -1403,7 +1428,8 @@
|
|
|
'this.packingSpecificationOption-----------',
|
|
|
this.packingSpecificationOption
|
|
|
);
|
|
|
- this.productList = data.map((productItem, productIndex) => {
|
|
|
+ console.log(data, 'datadatadatadatadata');
|
|
|
+ data.map((productItem, productIndex) => {
|
|
|
// 显示规格
|
|
|
let packingSpecificationLabel = this.packingSpecificationOption[
|
|
|
productIndex
|
|
|
@@ -1414,68 +1440,82 @@
|
|
|
}
|
|
|
})
|
|
|
.filter((item) => !!item);
|
|
|
- return {
|
|
|
- ...productItem,
|
|
|
- index: this.productList.length + productIndex,
|
|
|
- isSave:
|
|
|
- productItem.outInDetailRecordRequestList?.length > 0
|
|
|
- ? true
|
|
|
- : false,
|
|
|
- netWeight: productItem.netWeight > 0 ? productItem.netWeight : 0,
|
|
|
- batchNo: batchNo, // 批次号
|
|
|
- warehouseIds: [productItem.warehouseId], // 仓库Id
|
|
|
- warehouseNames: [productItem.warehouseName], // 仓库名称
|
|
|
- packingSpecificationOption:
|
|
|
- this.packingSpecificationOption[productIndex], // 包装规格选项
|
|
|
- packingSpecificationLabel: packingSpecificationLabel, // 包装规格显示
|
|
|
- outInDetailRecordRequestList:
|
|
|
- productItem.outInDetailRecordRequestList?.length > 0
|
|
|
- ? productItem.outInDetailRecordRequestList.map(
|
|
|
- (packingItem, packingIndex) => {
|
|
|
- return {
|
|
|
- ...packingItem,
|
|
|
- index:
|
|
|
- this.productList.length +
|
|
|
- productIndex +
|
|
|
- '-' +
|
|
|
- packingIndex, // 包装索引
|
|
|
- batchNo: batchNo, // 批次号
|
|
|
- parentIndex: this.productList.length + productIndex, // 物品索引
|
|
|
- categoryName: productItem.categoryName,
|
|
|
- categoryCode: productItem.categoryCode,
|
|
|
- materialDetailList:
|
|
|
- packingItem.materialDetailList.map(
|
|
|
- (materialItem, materialIndex) => {
|
|
|
- return {
|
|
|
- ...materialItem,
|
|
|
- index:
|
|
|
- this.productList.length +
|
|
|
- productIndex +
|
|
|
- '-' +
|
|
|
- packingIndex +
|
|
|
- '——' +
|
|
|
- materialIndex, // 包装索引
|
|
|
- parentIndex:
|
|
|
- this.productList.length +
|
|
|
- productIndex +
|
|
|
- '-' +
|
|
|
- packingIndex, // 物品索引
|
|
|
- batchNo: batchNo, // 批次号
|
|
|
- categoryName: productItem.categoryName,
|
|
|
- categoryCode: productItem.categoryCode
|
|
|
- };
|
|
|
- }
|
|
|
- )
|
|
|
- };
|
|
|
- }
|
|
|
- )
|
|
|
- : []
|
|
|
- };
|
|
|
+ console.log(productItem, 'productItem');
|
|
|
+
|
|
|
+ // let r= {
|
|
|
+ // ...productItem,
|
|
|
+ productItem.weight = productItem.weight;
|
|
|
+
|
|
|
+ // productItem.singleWeight = 0;
|
|
|
+ productItem.index = this.productList.length + productIndex;
|
|
|
+ productItem.isSave =
|
|
|
+ productItem.outInDetailRecordRequestList?.length > 0
|
|
|
+ ? true
|
|
|
+ : false;
|
|
|
+ productItem.netWeight =
|
|
|
+ productItem.netWeight > 0 ? productItem.netWeight : 0;
|
|
|
+ productItem.materielCode = productItem.materielCode;
|
|
|
+ productItem.batchNo = batchNo; // 批次号
|
|
|
+ productItem.warehouseIds = [productItem.warehouseId]; // 仓库Id
|
|
|
+ productItem.warehouseNames = [productItem.warehouseName]; // 仓库名称
|
|
|
+ productItem.packingSpecificationOption =
|
|
|
+ this.packingSpecificationOption[productIndex]; // 包装规格选项
|
|
|
+ productItem.packingSpecificationLabel = packingSpecificationLabel; // 包装规格显示
|
|
|
+ productItem.outInDetailRecordRequestList =
|
|
|
+ productItem.outInDetailRecordRequestList?.length > 0
|
|
|
+ ? productItem.outInDetailRecordRequestList.map(
|
|
|
+ (packingItem, packingIndex) => {
|
|
|
+ return {
|
|
|
+ ...packingItem,
|
|
|
+ index:
|
|
|
+ this.productList.length +
|
|
|
+ productIndex +
|
|
|
+ '-' +
|
|
|
+ packingIndex, // 包装索引
|
|
|
+ batchNo: batchNo, // 批次号
|
|
|
+ parentIndex: this.productList.length + productIndex, // 物品索引
|
|
|
+ categoryName: productItem.categoryName,
|
|
|
+ categoryCode: productItem.categoryCode,
|
|
|
+ materialDetailList:
|
|
|
+ packingItem.materialDetailList.map(
|
|
|
+ (materialItem, materialIndex) => {
|
|
|
+ return {
|
|
|
+ ...materialItem,
|
|
|
+ index:
|
|
|
+ this.productList.length +
|
|
|
+ productIndex +
|
|
|
+ '-' +
|
|
|
+ packingIndex +
|
|
|
+ '——' +
|
|
|
+ materialIndex, // 包装索引
|
|
|
+ parentIndex:
|
|
|
+ this.productList.length +
|
|
|
+ productIndex +
|
|
|
+ '-' +
|
|
|
+ packingIndex, // 物品索引
|
|
|
+ batchNo: batchNo, // 批次号
|
|
|
+ categoryName: productItem.categoryName,
|
|
|
+ categoryCode: productItem.categoryCode
|
|
|
+ };
|
|
|
+ }
|
|
|
+ )
|
|
|
+ };
|
|
|
+ }
|
|
|
+ )
|
|
|
+ : [];
|
|
|
});
|
|
|
- console.log(
|
|
|
- 'this.productList-----------------------',
|
|
|
- this.productList
|
|
|
- );
|
|
|
+
|
|
|
+ // this.productList = data;
|
|
|
+ this.productList = data.map((item) => {
|
|
|
+ if (item.weight === null || item.weight === undefined) {
|
|
|
+ item.weight = 0;
|
|
|
+ }
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ // this.productList.map((v) => {
|
|
|
+ // v.weight = isNaN(v.weight);
|
|
|
+ // });
|
|
|
+
|
|
|
// 获取包装维度数据
|
|
|
const arr = [];
|
|
|
for (const key in this.productList) {
|
|
|
@@ -1583,7 +1623,7 @@
|
|
|
switch (type) {
|
|
|
case '产品':
|
|
|
listLength = this.productList.length;
|
|
|
- keyfield = ['batchNo', 'packingQuantity', 'price', 'purpose'];
|
|
|
+ keyfield = ['batchNo', 'packingQuantity', 'unitPrice', 'purpose'];
|
|
|
break;
|
|
|
case '包装':
|
|
|
listLength = this.showPackingList.length;
|
|
|
@@ -1837,7 +1877,7 @@
|
|
|
weight: 0, // 重量
|
|
|
weightUnit: item.weightUnit, // 重量单位
|
|
|
totalMoney: '', // 总价
|
|
|
- price: item.price, // 单价
|
|
|
+ unitPrice: item.unitPrice, // 单价
|
|
|
purpose: functionType[item.code], // 用途
|
|
|
isUnpack: item.isUnpack // 是否允许拆包
|
|
|
};
|
|
|
@@ -2082,7 +2122,6 @@
|
|
|
},
|
|
|
// 重量限制
|
|
|
weightInput(value, row, type) {
|
|
|
- console.log(row, 'rowrowrowrowrowrowrowrowrowrowrowrow222');
|
|
|
const newValue = value.replace(/[^\d.]/g, ''); // 保留数字和小数点
|
|
|
const decimalCount = (newValue.match(/\./g) || []).length; // 计算小数点的个数
|
|
|
if (row.weight < 0) {
|
|
|
@@ -2109,14 +2148,14 @@
|
|
|
}
|
|
|
},
|
|
|
//计算金额
|
|
|
- calcSumTotal(measureQuantity, price, row) {
|
|
|
+ calcSumTotal(measureQuantity, unitPrice, row) {
|
|
|
//最小包装单元,包装数量,单价
|
|
|
const total = {
|
|
|
measureQuantity: Number(measureQuantity > 0 ? measureQuantity : 0),
|
|
|
- price: Number(price > 0 ? price : 0)
|
|
|
+ unitPrice: Number(unitPrice > 0 ? unitPrice : 0)
|
|
|
};
|
|
|
let number = Number(
|
|
|
- this.$math.format(total.measureQuantity * total.price, 14)
|
|
|
+ this.$math.format(total.measureQuantity * total.unitPrice, 14)
|
|
|
);
|
|
|
|
|
|
row.totalMoney = number;
|
|
|
@@ -2276,7 +2315,7 @@
|
|
|
singleWeight: item.measuringUnit != 'KG' ? item.netWeight : 0, //单重 进来获取净重
|
|
|
weightUnit: item.weightUnit, // 重量单位
|
|
|
totalMoney: '', // 总价
|
|
|
- price: item.price, // 单价
|
|
|
+ unitPrice: item.unitPrice, // 单价
|
|
|
purpose: '', // 用途
|
|
|
isUnpack: item.isUnpack, // 是否允许拆包
|
|
|
categoryLevelPathIdParent: item.categoryLevelPathIdParent
|
|
|
@@ -2904,7 +2943,7 @@
|
|
|
brandNum: row.brandNum, // 牌号
|
|
|
parentIndex: row.index, // 产品索引
|
|
|
batchNo: row.batchNo, // 批次号
|
|
|
- packageNo: packingCodeList[index].onlyCode, // 包装编码
|
|
|
+ packageNo: packingCodeList[index]?.onlyCode, // 包装编码
|
|
|
packingQuantity: 1, // 包装数量
|
|
|
packingUnit: row.isUnpack
|
|
|
? packingBoolen
|
|
|
@@ -2982,7 +3021,7 @@
|
|
|
14
|
|
|
);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (inBoolen) {
|
|
|
// 第二层为KG类
|
|
|
item.weight = total;
|