|
|
@@ -83,7 +83,7 @@
|
|
|
@click="listSaveArrs">批量保存</el-button>
|
|
|
<el-button v-if="productList.length != 0 && this.packingList.length == 0" type="success" plain
|
|
|
style="margin-bottom: 20px; float: right; margin-right: 20px" size="mini"
|
|
|
- @click="handleWareHouse(productList[0])">批量选择仓库</el-button>
|
|
|
+ @click="handleWareHouse(productList, '', 'batch')">批量选择仓库</el-button>
|
|
|
<el-table :header-cell-style="rowClass" :max-height="300" border ref="productListTable" :data="productList"
|
|
|
tooltip-effect="dark">
|
|
|
<el-table-column label="序号" type="index" width="50" align="center">
|
|
|
@@ -290,19 +290,19 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="序号" type="index" width="50">
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="编码" prop="categoryCode" width="130" :show-overflow-tooltip="true"></el-table-column>
|
|
|
- <el-table-column label="名称" prop="categoryName" width="150" :show-overflow-tooltip="true"></el-table-column>
|
|
|
- <el-table-column label="批次号" prop="batchNo" width="70"></el-table-column>
|
|
|
- <el-table-column label="包装编码" prop="packageNo" width="200" :show-overflow-tooltip="true"></el-table-column>
|
|
|
+ <el-table-column label="批次号" prop="batchNo" width="80" :show-overflow-tooltip="true"></el-table-column>
|
|
|
+ <el-table-column label="包装编码" prop="packageNo" width="130" :show-overflow-tooltip="true"></el-table-column>
|
|
|
+ <el-table-column label="名称" prop="categoryName" width="120" :show-overflow-tooltip="true"></el-table-column>
|
|
|
+ <el-table-column label="编码" prop="categoryCode" width="120" :show-overflow-tooltip="true"></el-table-column>
|
|
|
+ <el-table-column label="型号" prop="categoryModel" width="80" :show-overflow-tooltip="true"></el-table-column>
|
|
|
+ <el-table-column label="规格" prop="specification" width="80" :show-overflow-tooltip="true"></el-table-column>
|
|
|
+ <el-table-column label="牌号" prop="brandNum" width="80" :show-overflow-tooltip="true"></el-table-column>
|
|
|
+
|
|
|
<el-table-column label="包装数量" prop="packingQuantity" width="80"></el-table-column>
|
|
|
<el-table-column label="包装单位" prop="packingUnit"></el-table-column>
|
|
|
<el-table-column label="计量数量" prop="measureQuantity" :show-overflow-tooltip="true"></el-table-column>
|
|
|
<el-table-column label="计量单位" prop="measureUnit"></el-table-column>
|
|
|
- <!-- <el-table-column label="允许拆包" prop="isUnpack">
|
|
|
- <template slot-scope="{ row, $index }">
|
|
|
- {{ row.isUnpack ? '是' : '否' }}
|
|
|
- </template>
|
|
|
- </el-table-column> -->
|
|
|
+
|
|
|
<el-table-column label="仓库" :show-overflow-tooltip="true" prop="warehouseName" width="200"></el-table-column>
|
|
|
<el-table-column label="供应商" align="center" prop="supplierName" width="200" :show-overflow-tooltip="true">
|
|
|
</el-table-column>
|
|
|
@@ -323,17 +323,6 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="客户代号" prop="clientCode">
|
|
|
- <!-- <template slot-scope="{ row, $index }">
|
|
|
- <el-input
|
|
|
- v-if="!row.isPack"
|
|
|
- :ref="'packing_clientCode' + $index"
|
|
|
- @keyup.native="
|
|
|
- moveFocus($event, $index, 'packing_clientCode', '包装', row)
|
|
|
- "
|
|
|
- v-model="row.extInfo.clientCode"
|
|
|
- ></el-input>
|
|
|
- <span v-else> {{ row.extInfo.clientCode }}</span>
|
|
|
- </template> -->
|
|
|
</el-table-column>
|
|
|
<el-table-column label="刻码" prop="engrave" width="140">
|
|
|
<template slot-scope="{ row, $index }">
|
|
|
@@ -1800,6 +1789,7 @@ export default {
|
|
|
},
|
|
|
// 添加物品明细
|
|
|
async addGoods(data) {
|
|
|
+ console.log(data, 'datadatadatadatadatadatadata111')
|
|
|
this.proData = data;
|
|
|
// 获取批次号
|
|
|
const batchNo = await getCode('lot_number_code');
|
|
|
@@ -1836,6 +1826,7 @@ export default {
|
|
|
index +
|
|
|
1
|
|
|
: this.productList.length + index,
|
|
|
+
|
|
|
categoryId: item.id, // 物品id
|
|
|
categoryName: item.name, // 物品名称
|
|
|
categoryCode: item.code, // 物品编码
|
|
|
@@ -2231,11 +2222,12 @@ export default {
|
|
|
// 生成包装
|
|
|
generateWrappers(row, productIndex, packingCodeList) {
|
|
|
|
|
|
- if (!row.isUnpack) {
|
|
|
- // 直接生成物品层数据,不生成包装层
|
|
|
+ // 判断是否拆包,如果是不拆包,计量单位=包装单位,则不生成包装层数据
|
|
|
+ if (!row.isUnpack && row.measureUnit == row.packingUnit) {
|
|
|
+ // 直接生成物品层数据
|
|
|
this.productList[productIndex].measureQuantity = row.measureQuantity;
|
|
|
this.productList[productIndex].weight = row.weight;
|
|
|
- return; // 跳过生成包装明细
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
console.log('包装数据--------', row);
|
|
|
@@ -2377,7 +2369,9 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
console.log(filterArr[0], 'filterArr[0]')
|
|
|
+
|
|
|
let item = {
|
|
|
+
|
|
|
index: row.index + '-' + index, // 包装索引
|
|
|
warehouseId: row.warehouseId, // 仓库id
|
|
|
warehouseName: row.warehouseName, // 仓库名称
|
|
|
@@ -2545,13 +2539,12 @@ export default {
|
|
|
this.deletePackingAndMaterial(row);
|
|
|
},
|
|
|
// 打开仓库弹框
|
|
|
- handleWareHouse(row, idx) {
|
|
|
- console.log(row, `rowrowrowrow打开仓库弹框`)
|
|
|
+ handleWareHouse(row, idx, type) {
|
|
|
+
|
|
|
if (row.isSave) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
let packingBoolen = !!this.getDict('不拆物料层规格', row.packingUnit)
|
|
|
.dictValue;
|
|
|
let measureBoolen = !!this.getDict('不拆物料层规格', row.measureUnit)
|
|
|
@@ -2559,7 +2552,7 @@ export default {
|
|
|
console.log(packingBoolen, 'packingBoolen')
|
|
|
console.log(measureBoolen, 'measureBoolen')
|
|
|
|
|
|
- if (idx > -1) {
|
|
|
+ if (idx > -1 && type != 'batch') {
|
|
|
if (row.packingQuantity > 0) {
|
|
|
console.log(packingBoolen, '111')
|
|
|
if (!row.isUnpack && row.measureUnit == row.packingUnit) {
|
|
|
@@ -2634,39 +2627,75 @@ export default {
|
|
|
this.$message.error('请先填写包装数量!');
|
|
|
}
|
|
|
} else {
|
|
|
+ //批量
|
|
|
+ console.log(row, `row`)
|
|
|
+ console.log(idx, `idx`)
|
|
|
+ console.log(type, 'type')
|
|
|
// 批量设置
|
|
|
let boolen = this.productList.every(
|
|
|
(item) =>
|
|
|
item.packingQuantity == this.productList[0].packingQuantity
|
|
|
);
|
|
|
+ console.log(boolen, 'boolen')
|
|
|
if (boolen) {
|
|
|
- if (row.packingQuantity > 0) {
|
|
|
- if (packingBoolen) {
|
|
|
- let filterArr = row.packingSpecificationOption.filter(
|
|
|
- (item) => {
|
|
|
- return (
|
|
|
- item.packingUnit == row.packingUnit &&
|
|
|
- item.packingUnit != item.conversionUnit
|
|
|
- );
|
|
|
- }
|
|
|
- );
|
|
|
- let num = Math.ceil(
|
|
|
- row.packingQuantity / filterArr[0].packageCell
|
|
|
- );
|
|
|
- this.$refs.wareHouseDailogRef.open(num, idx);
|
|
|
- } else {
|
|
|
- this.$refs.wareHouseDailogRef.open(
|
|
|
- row.isUnpack
|
|
|
- ? measureBoolen
|
|
|
- ? row.packingQuantity
|
|
|
- : row.measureQuantity
|
|
|
- : row.packingQuantity,
|
|
|
- idx
|
|
|
- );
|
|
|
- }
|
|
|
+
|
|
|
+ if (row.some(item => !item.packingQuantity)) {
|
|
|
+ this.$message.error('请先填写所有行的包装数量!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ console.log(packingBoolen, 'packingBoolen')
|
|
|
+ if (packingBoolen) {
|
|
|
+ let filterArr = row.packingSpecificationOption.filter(
|
|
|
+ (item) => {
|
|
|
+ return (
|
|
|
+ item.packingUnit == row.packingUnit &&
|
|
|
+ item.packingUnit != item.conversionUnit
|
|
|
+ );
|
|
|
+ }
|
|
|
+ );
|
|
|
+ let num = Math.ceil(
|
|
|
+ row.packingQuantity / filterArr[0].packageCell
|
|
|
+ );
|
|
|
+ let mNum = row?.measureQuantity
|
|
|
+ this.$refs.wareHouseDailogRef.open(num, mNum, idx);
|
|
|
} else {
|
|
|
- this.$message.error('请先填写包装数量!');
|
|
|
+ //如果此行不拆包,并且测量单位=包装单位 packingQuantity=0
|
|
|
+
|
|
|
+ row.forEach(item => {
|
|
|
+ if (!item.isUnpack && item.measureUnit === item.packingUnit) {
|
|
|
+ item.packingQuantity2 = 0;
|
|
|
+ } else {
|
|
|
+ item.packingQuantity2 = item.packingQuantity;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ console.log(row, 'rowrowrowrowrowrow我看看')
|
|
|
+ const pNum = row.reduce((sum, item) => {
|
|
|
+ if (item.packingQuantity2 !== undefined && item.packingQuantity2 !== null) {
|
|
|
+ return sum + Number(item.packingQuantity2);
|
|
|
+ }
|
|
|
+ return sum;
|
|
|
+ }, 0);
|
|
|
+
|
|
|
+ const mNum = row.reduce((sum, item) => {
|
|
|
+ if (item.measureQuantity !== undefined && item.measureQuantity !== null) {
|
|
|
+ return sum + Number(item.measureQuantity);
|
|
|
+ }
|
|
|
+ return sum;
|
|
|
+ }, 0);
|
|
|
+ console.log(pNum, 'pppp')
|
|
|
+ console.log(mNum, 'mmmmm')
|
|
|
+ // row.isUnpack
|
|
|
+ // ? measureBoolen
|
|
|
+ // ? row.packingQuantity
|
|
|
+ // : row.measureQuantity
|
|
|
+ // : row.packingQuantity,
|
|
|
+ this.$refs.wareHouseDailogRef.open(
|
|
|
+ pNum,
|
|
|
+ mNum,
|
|
|
+ 0
|
|
|
+ );
|
|
|
}
|
|
|
+
|
|
|
} else {
|
|
|
this.$message.error('请保证产品包装数量一致!');
|
|
|
}
|