|
|
@@ -279,6 +279,7 @@
|
|
|
"
|
|
|
v-model="row.packingQuantity"
|
|
|
@input="computeNum(row, $index, true)"
|
|
|
+ :disabled="row.isSave"
|
|
|
>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
@@ -300,6 +301,7 @@
|
|
|
required
|
|
|
>
|
|
|
<el-select
|
|
|
+ :disabled="row.isSave"
|
|
|
v-model="row.packingUnit"
|
|
|
placeholder="请选择"
|
|
|
@change="computeNum(row, $index)"
|
|
|
@@ -346,13 +348,41 @@
|
|
|
:show-overflow-tooltip="true"
|
|
|
></el-table-column>
|
|
|
<el-table-column
|
|
|
- label="重量"
|
|
|
+ label="总重"
|
|
|
align="center"
|
|
|
prop="weight"
|
|
|
+ width="160"
|
|
|
:show-overflow-tooltip="true"
|
|
|
>
|
|
|
<template slot-scope="{ row, $index }">
|
|
|
- {{ row.weight }}
|
|
|
+ <el-input
|
|
|
+ :disabled="row.isSave"
|
|
|
+ v-model="row.weight"
|
|
|
+ placeholder="请输入"
|
|
|
+ @input="inputWeight(row, $index)"
|
|
|
+ ></el-input>
|
|
|
+ <template slot="append">
|
|
|
+ {{ row.measureUnit }}
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="单重"
|
|
|
+ align="center"
|
|
|
+ width="160"
|
|
|
+ prop=""
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
+ >
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
+ <el-input-number
|
|
|
+ :disabled="row.isSave"
|
|
|
+ v-model="row.singleWeight"
|
|
|
+ placeholder="请输入"
|
|
|
+ :precision="2"
|
|
|
+ :step="0.1"
|
|
|
+ :min="0"
|
|
|
+ @input="inputsingleWeight(row, $index)"
|
|
|
+ ></el-input-number>
|
|
|
<template slot="append">
|
|
|
{{ row.measureUnit }}
|
|
|
</template>
|
|
|
@@ -440,6 +470,17 @@
|
|
|
</el-select>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="供应商代号"
|
|
|
+ align="center"
|
|
|
+ prop="supplierCode"
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
+ width="100"
|
|
|
+ >
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
+ {{ row.supplierCode }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column
|
|
|
label="仓库"
|
|
|
align="center"
|
|
|
@@ -600,6 +641,8 @@
|
|
|
prop="warehouseName"
|
|
|
width="200"
|
|
|
></el-table-column>
|
|
|
+ <el-table-column label="供应商代号" prop="supplierCode" width="130">
|
|
|
+ </el-table-column>
|
|
|
<el-table-column
|
|
|
label="物料代号"
|
|
|
prop="materielDesignation"
|
|
|
@@ -1182,6 +1225,20 @@
|
|
|
row.supplierName = row.supplierListOptions.filter(
|
|
|
(item) => item.id == val
|
|
|
)[0].name;
|
|
|
+ row.supplierCode = row.supplierListOptions.filter(
|
|
|
+ (item) => item.id == val
|
|
|
+ )[0].serialNo;
|
|
|
+ },
|
|
|
+ inputsingleWeight(row, index) {
|
|
|
+ row.weight = row.singleWeight * row.measureQuantity;
|
|
|
+ },
|
|
|
+ inputWeight(row, index) {
|
|
|
+ if (isNaN(row.weight) || row.weight < 0) {
|
|
|
+ row.weight = 1;
|
|
|
+ }
|
|
|
+ row.singleWeight = row.measureQuantity
|
|
|
+ ? row.weight / row.measureQuantity
|
|
|
+ : 0;
|
|
|
},
|
|
|
// 计算最小单元数量
|
|
|
async computeNum(row, index, isClear) {
|
|
|
@@ -1207,6 +1264,7 @@
|
|
|
// // );
|
|
|
// }
|
|
|
}
|
|
|
+ //如果有包装数量和包装单位
|
|
|
if (row.packingQuantity && row.packingUnit) {
|
|
|
//获取仓库
|
|
|
const res = await warehouseDefinition.list({
|
|
|
@@ -1231,18 +1289,23 @@
|
|
|
this.$set(this.productList[index], 'warehouseId', '');
|
|
|
this.$set(this.productList[index], 'warehouseName', '');
|
|
|
}
|
|
|
-
|
|
|
+ // -----------------------------------------------------------------
|
|
|
let startIndex = row.packingSpecificationOption.findIndex((ite) => {
|
|
|
return (
|
|
|
row.measuringUnit == ite.packingUnit &&
|
|
|
ite.packingUnit != ite.conversionUnit
|
|
|
);
|
|
|
});
|
|
|
- console.log(startIndex);
|
|
|
+ console.log('startIndex-----', startIndex);
|
|
|
let endIndex = row.packingSpecificationOption.findIndex(
|
|
|
(ite) => row.packingUnit == ite.conversionUnit
|
|
|
);
|
|
|
- console.log(endIndex);
|
|
|
+ console.log('endIndex-----', endIndex);
|
|
|
+ // 除了计量单位是KG以外计算总重 总重量 = 单重singleWeight * 数量measureQuantity(计量数量);
|
|
|
+ if (row.measuringUnit == 'KG') {
|
|
|
+ row.weight = row.singleWeight * row.measureQuantity;
|
|
|
+ }
|
|
|
+ // packingQuantity 包装数量
|
|
|
let total = row.packingQuantity;
|
|
|
for (; startIndex < endIndex; endIndex--) {
|
|
|
total = this.$math.format(
|
|
|
@@ -1250,6 +1313,7 @@
|
|
|
14
|
|
|
);
|
|
|
}
|
|
|
+ //计量数量
|
|
|
row.measureQuantity = this.changeCount(total);
|
|
|
// 判断单位和计量单位是否为不拆物料层规格
|
|
|
let packingBoolen = !!this.getDict('不拆物料层规格', row.packingUnit)
|
|
|
@@ -1408,7 +1472,10 @@
|
|
|
: []
|
|
|
};
|
|
|
});
|
|
|
- console.log('this.productList-----------', this.productList);
|
|
|
+ console.log(
|
|
|
+ 'this.productList-----------------------',
|
|
|
+ this.productList
|
|
|
+ );
|
|
|
// 获取包装维度数据
|
|
|
const arr = [];
|
|
|
for (const key in this.productList) {
|
|
|
@@ -1933,6 +2000,11 @@
|
|
|
0
|
|
|
);
|
|
|
this.$set(this.productList[productIndex], 'weight', totalWeight);
|
|
|
+ this.$set(
|
|
|
+ this.productList[productIndex],
|
|
|
+ 'singleWeight',
|
|
|
+ totalWeight / this.productList[productIndex].measureQuantity
|
|
|
+ );
|
|
|
// 修改拆分物料
|
|
|
this.materialList.map((item, index) => {
|
|
|
if (item.parentIndex === row.index) {
|
|
|
@@ -2009,6 +2081,7 @@
|
|
|
},
|
|
|
// 重量限制
|
|
|
weightInput(value, row, type) {
|
|
|
+ console.log(row, 'rowrowrowrowrowrowrowrowrowrowrowrow222');
|
|
|
const newValue = value.replace(/[^\d.]/g, ''); // 保留数字和小数点
|
|
|
const decimalCount = (newValue.match(/\./g) || []).length; // 计算小数点的个数
|
|
|
if (row.weight < 0) {
|
|
|
@@ -2149,6 +2222,7 @@
|
|
|
const supplierList = await storageApi.contactQueryByCategoryIdsAPI({
|
|
|
categoryIds: data.map((item) => item.id)
|
|
|
});
|
|
|
+ console.log(supplierList, '供应商列表');
|
|
|
// 获取包装规格
|
|
|
let packingSpecification =
|
|
|
await storageApi.getCategoryPackageDisposition({
|
|
|
@@ -2159,11 +2233,7 @@
|
|
|
.filter((ite) => item.id == ite.categoryId)
|
|
|
.sort((a, b) => a.sort - b.sort);
|
|
|
});
|
|
|
- console.log(
|
|
|
- 'this.packingSpecificationOption-------',
|
|
|
- this.packingSpecificationOption
|
|
|
- );
|
|
|
- console.log('this.productList.length------', this.productList.length);
|
|
|
+ console.log('yeyyeyey----------------', data);
|
|
|
let productList = data.map((item, index) => {
|
|
|
// 显示规格
|
|
|
let packingSpecificationLabel = this.packingSpecificationOption[index]
|
|
|
@@ -2190,6 +2260,7 @@
|
|
|
supplierListOptions: supplierList[item.id], // 供应商列表
|
|
|
supplierId: '', // 供应商id
|
|
|
supplierName: '', // 供应商名称
|
|
|
+ supplierCode: '',
|
|
|
approvalNumber: item.approvalNumber, // 批准文号
|
|
|
packingSpecification: item.packingSpecification, // 包装规格
|
|
|
packingSpecificationOption: this.packingSpecificationOption[index], // 包装规格选项
|
|
|
@@ -2201,6 +2272,7 @@
|
|
|
measureUnit: item.measuringUnit, // 计量单位
|
|
|
netWeight: item.netWeight > -1 ? item.netWeight : 0, // 净重
|
|
|
weight: 0, // 重量
|
|
|
+ singleWeight: item.measuringUnit != 'KG' ? item.netWeight : 0, //单重 进来获取净重
|
|
|
weightUnit: item.weightUnit, // 重量单位
|
|
|
totalMoney: '', // 总价
|
|
|
price: item.price, // 单价
|
|
|
@@ -2698,12 +2770,11 @@
|
|
|
},
|
|
|
// 生成包装
|
|
|
generateWrappers(row, productIndex, packingCodeList) {
|
|
|
- console.log('是否拆包----', row.isUnpack);
|
|
|
- console.log('包装规格----', row.packingSpecificationOption);
|
|
|
+ console.log('包装数据--------', row);
|
|
|
+ // console.log('是否拆包----', row.isUnpack);
|
|
|
+ // console.log('包装规格----', row.packingSpecificationOption);
|
|
|
console.log('计量单位----', row.measureUnit);
|
|
|
- console.log('包装数量----', row.packingQuantity);
|
|
|
console.log('包装编码----', packingCodeList);
|
|
|
- console.log('包装数据----', row);
|
|
|
let packingList = [];
|
|
|
let obj = this.getNowDate();
|
|
|
let productionDate = '';
|
|
|
@@ -2773,10 +2844,6 @@
|
|
|
let measureQuantity = 1;
|
|
|
// 处理单位为KG类,计算每桶KG值
|
|
|
if (packingBoolen) {
|
|
|
- console.log(
|
|
|
- this.$math.format(filterArr[0].packageCell * (index + 1), 14)
|
|
|
- );
|
|
|
- console.log(row.packingQuantity);
|
|
|
measureQuantity =
|
|
|
Number(row.packingQuantity) >
|
|
|
this.$math.format(filterArr[0].packageCell * (index + 1), 14)
|
|
|
@@ -2828,6 +2895,7 @@
|
|
|
categoryCode: row.categoryCode, // 产品编码
|
|
|
categoryModel: row.categoryModel, // 物品型号
|
|
|
specification: row.specification, // 规格
|
|
|
+ supplierCode: row.supplierCode, // 供应商编码
|
|
|
brandNum: row.brandNum, // 牌号
|
|
|
parentIndex: row.index, // 产品索引
|
|
|
batchNo: row.batchNo, // 批次号
|
|
|
@@ -2877,9 +2945,11 @@
|
|
|
let outBoolen = !!this.getDict('不拆物料层规格', item.measureUnit)
|
|
|
.dictValue;
|
|
|
if (outBoolen) {
|
|
|
+ conosle.log(item.measureQuantity, '计量单位为KG类,包装数量');
|
|
|
// 计量单位为KG类,直接替换
|
|
|
item.weight = item.measureQuantity;
|
|
|
} else {
|
|
|
+ console.log('计量单位为不为KG类======================');
|
|
|
// 计量单位为不为KG类,重新统计计算
|
|
|
let inBoolen = !!this.getDict(
|
|
|
'不拆物料层规格',
|
|
|
@@ -2893,27 +2963,43 @@
|
|
|
);
|
|
|
}
|
|
|
);
|
|
|
+
|
|
|
console.log(startIndex);
|
|
|
let endIndex = item.packingSpecificationOption.findIndex(
|
|
|
(ite) => item.packingUnit == ite.conversionUnit
|
|
|
);
|
|
|
console.log(endIndex);
|
|
|
- let total = item.packingQuantity;
|
|
|
- for (; startIndex < endIndex; endIndex--) {
|
|
|
- total = this.$math.format(
|
|
|
- item.packingSpecificationOption[endIndex].packageCell * total,
|
|
|
- 14
|
|
|
- );
|
|
|
- }
|
|
|
- if (inBoolen) {
|
|
|
- // 第二层为KG类
|
|
|
- item.weight = total;
|
|
|
- } else {
|
|
|
- // 第二层不为KG类
|
|
|
- item.weight = this.$math.format(total * item.netWeight, 14);
|
|
|
+ if (measureBoolen) {
|
|
|
+ let total = item.packingQuantity;
|
|
|
+ for (; startIndex < endIndex; endIndex--) {
|
|
|
+ total = this.$math.format(
|
|
|
+ item.packingSpecificationOption[endIndex].packageCell * total,
|
|
|
+ 14
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ if (inBoolen) {
|
|
|
+ // 第二层为KG类
|
|
|
+ item.weight = total;
|
|
|
+ } else {
|
|
|
+ // 第二层不为KG类
|
|
|
+ item.weight = this.$math.format(total * item.netWeight, 14);
|
|
|
+ }
|
|
|
+ } else if (!measureBoolen) {
|
|
|
+ if (inBoolen) {
|
|
|
+ // 第二层为KG类
|
|
|
+ item.weight = item.measureQuantity;
|
|
|
+ } else {
|
|
|
+ // 第二层不为KG类
|
|
|
+ item.weight = item.measureQuantity * row.singleWeight;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
packingList.push(item);
|
|
|
+ console.log(
|
|
|
+ packingList,
|
|
|
+ 'packingList!!!!!!!!!!!!!!!!!!'
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
// 单独点击保存并插入对应位置(包装)
|