|
|
@@ -41,6 +41,11 @@
|
|
|
stripe
|
|
|
:header-cell-style="{ background: '#EEEEEE', border: 'none' }"
|
|
|
>
|
|
|
+ <el-table-column label="二维码" prop="qrcode" min-width="100" align="center">
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
+ <el-link v-if="row.id && !row.isEdit" type="primary" @click="generateQrcode(row, '库区')">二维码</el-link>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="库区编号" prop="code" min-width="120">
|
|
|
<template slot-scope="{ row, $index }">
|
|
|
<el-form-item
|
|
|
@@ -179,7 +184,7 @@
|
|
|
<span v-else>{{ scope.row.extInfo[0].areaLength }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="库区宽(cm)" min-width="120">
|
|
|
+ <el-table-column label="库区宽(cm)" min-width="120" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
:prop="
|
|
|
@@ -201,7 +206,7 @@
|
|
|
<span v-else>{{ scope.row.extInfo[0].areaWidth }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="库区高(cm)" min-width="120">
|
|
|
+ <el-table-column label="库区高(cm)" min-width="120" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
:prop="
|
|
|
@@ -223,7 +228,7 @@
|
|
|
<span v-else>{{ scope.row.extInfo[0].areaHigh }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="货架数量" min-width="120">
|
|
|
+ <el-table-column label="货架数量" min-width="100" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
:prop="
|
|
|
@@ -268,7 +273,7 @@
|
|
|
<span v-else>{{ scope.row.areaBarcode }}</span>
|
|
|
</template>
|
|
|
</el-table-column> -->
|
|
|
- <el-table-column label="备注" min-width="120">
|
|
|
+ <el-table-column label="备注" min-width="120" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
:prop="'warehouseAreasSaveList.' + scope.$index + 'remark'"
|
|
|
@@ -285,7 +290,7 @@
|
|
|
<span v-else>{{ scope.row.remark }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" fixed="right" width="150">
|
|
|
+ <el-table-column label="操作" fixed="right" width="170" align="center">
|
|
|
<template slot-scope="{ row, $index }">
|
|
|
<el-button
|
|
|
type="text"
|
|
|
@@ -297,6 +302,11 @@
|
|
|
<el-button type="text" v-else @click="addShelf(row, $index)"
|
|
|
>添加货架</el-button
|
|
|
>
|
|
|
+
|
|
|
+ <!-- <el-button type="text" v-if="!row.isEdit" @click="editArea(row, $index)"
|
|
|
+ >编辑</el-button
|
|
|
+ > -->
|
|
|
+
|
|
|
<el-button type="text" @click="remove1($index, row)"
|
|
|
>删除库区</el-button
|
|
|
>
|
|
|
@@ -327,11 +337,17 @@
|
|
|
stripe
|
|
|
:header-cell-style="{ background: '#EEEEEE', border: 'none' }"
|
|
|
>
|
|
|
+ <el-table-column label="二维码" prop="qrcode" min-width="100" align="center">
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
+ <el-link v-if="row.id && !row.isEdit" type="primary" @click="generateQrcode(row, '货架')">二维码</el-link>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column
|
|
|
label="库区编号"
|
|
|
prop="reservoirAreaCode"
|
|
|
+ align="center"
|
|
|
></el-table-column>
|
|
|
- <el-table-column label="货架编号" prop="code" min-width="120">
|
|
|
+ <el-table-column label="货架编号" prop="code" min-width="120" align="center">
|
|
|
<template slot-scope="{ row, $index }">
|
|
|
<el-form-item
|
|
|
:prop="'areaGoodsshelvesList.' + $index + '.code'"
|
|
|
@@ -347,7 +363,7 @@
|
|
|
<span v-else>{{ row.code }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="货架行数" min-width="120">
|
|
|
+ <el-table-column label="货架行数" min-width="120" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
:prop="
|
|
|
@@ -376,7 +392,7 @@
|
|
|
<span v-else>{{ scope.row.extInfo[0].line }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="货架列数" min-width="120">
|
|
|
+ <el-table-column label="货架列数" min-width="120" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
:prop="
|
|
|
@@ -405,7 +421,7 @@
|
|
|
<span v-else>{{ scope.row.extInfo[0].column }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="货架长(cm)" min-width="120">
|
|
|
+ <el-table-column label="货架长(cm)" min-width="120" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
:prop="
|
|
|
@@ -427,7 +443,7 @@
|
|
|
<span v-else>{{ scope.row.extInfo[0].areaLength }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="货架宽(cm)" min-width="120">
|
|
|
+ <el-table-column label="货架宽(cm)" min-width="120" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
:prop="
|
|
|
@@ -449,7 +465,7 @@
|
|
|
<span v-else>{{ scope.row.extInfo[0].areaWidth }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="货架高(cm)" min-width="120">
|
|
|
+ <el-table-column label="货架高(cm)" min-width="120" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
:prop="
|
|
|
@@ -471,7 +487,7 @@
|
|
|
<span v-else>{{ scope.row.extInfo[0].areaHigh }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="货位数量" prop="" min-width="120">
|
|
|
+ <el-table-column label="货位数量" prop="" min-width="120" align="center">
|
|
|
<template slot-scope="{ row }">
|
|
|
{{ setNUm(row) }}
|
|
|
</template>
|
|
|
@@ -480,6 +496,7 @@
|
|
|
label="是否规则"
|
|
|
prop="isRegular"
|
|
|
min-width="120"
|
|
|
+ align="center"
|
|
|
>
|
|
|
<template slot-scope="{ row }">
|
|
|
<el-select
|
|
|
@@ -506,7 +523,7 @@
|
|
|
label="货架条码"
|
|
|
prop="goodsshelvesBarcode"
|
|
|
></el-table-column> -->
|
|
|
- <el-table-column label="备注" min-width="120">
|
|
|
+ <el-table-column label="备注" min-width="120" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
:prop="'areaGoodsshelvesList.' + scope.$index + '.remark'"
|
|
|
@@ -521,7 +538,7 @@
|
|
|
<span v-else>{{ scope.row.remark }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" fixed="right" min-width="120">
|
|
|
+ <el-table-column label="操作" fixed="right" min-width="120" align="center">
|
|
|
<template slot-scope="{ $index, row }">
|
|
|
<el-button
|
|
|
type="text"
|
|
|
@@ -561,7 +578,12 @@
|
|
|
:header-cell-style="{ background: '#EEEEEE', border: 'none' }"
|
|
|
>
|
|
|
<!-- <el-table-column type="selection" width="55"> </el-table-column> -->
|
|
|
- <el-table-column label="货架编号" prop="goodsShelvesCode">
|
|
|
+ <el-table-column label="二维码" prop="qrcode" min-width="100" align="center">
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
+ <el-link v-if="row.id && !row.isEdit" type="primary" @click="generateQrcode(row, '货位')">二维码</el-link>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="货架编号" prop="goodsShelvesCode" align="center">
|
|
|
<template slot-scope="{ row }">
|
|
|
{{ row.warehouseAreaCode + '-' + row.warehouseAreaGoodsCode }}
|
|
|
</template>
|
|
|
@@ -570,6 +592,7 @@
|
|
|
label="货位编号"
|
|
|
prop="goodsAllocationCode"
|
|
|
min-width="120"
|
|
|
+ align="center"
|
|
|
>
|
|
|
<template slot-scope="{ row, $index }">
|
|
|
<el-form-item
|
|
|
@@ -588,7 +611,7 @@
|
|
|
<span v-else>{{ row.goodsAllocationCode }}</span>
|
|
|
</template></el-table-column
|
|
|
>
|
|
|
- <el-table-column label="货位长(cm)" min-width="120">
|
|
|
+ <el-table-column label="货位长(cm)" min-width="120" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
:prop="
|
|
|
@@ -615,7 +638,7 @@
|
|
|
}}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="货位宽(cm)" min-width="120">
|
|
|
+ <el-table-column label="货位宽(cm)" min-width="120" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
:prop="
|
|
|
@@ -640,7 +663,7 @@
|
|
|
}}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="货位高(cm)" min-width="120">
|
|
|
+ <el-table-column label="货位高(cm)" min-width="120" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
:prop="
|
|
|
@@ -665,7 +688,7 @@
|
|
|
}}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="限重(kg)" min-width="120">
|
|
|
+ <el-table-column label="限重(kg)" min-width="120" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<!-- :rules="areaLocationRules.weightLimit"
|
|
|
:prop="
|
|
|
@@ -685,7 +708,7 @@
|
|
|
<span v-else>{{ scope.row.extInfo[0].weightLimit }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="基本货位容积(cm³)" min-width="120">
|
|
|
+ <el-table-column label="基本货位容积(cm³)" min-width="120" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
:prop="
|
|
|
@@ -735,13 +758,15 @@
|
|
|
<el-button @click="handleMine" type="primary">确 定</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
+ <!-- 二维码 -->
|
|
|
+ <qsCode ref="qsCodeRef"></qsCode>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
// import selectTree from '@/components/selectTree';
|
|
|
import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
|
|
|
-
|
|
|
+ import qsCode from './components/qsCode.vue'
|
|
|
import {
|
|
|
warehouseDefinition_areaType,
|
|
|
warehouseDefinition_areaAttribute,
|
|
|
@@ -752,13 +777,16 @@
|
|
|
|
|
|
// import { throttle } from 'lodash';
|
|
|
export default {
|
|
|
+ components: {
|
|
|
+ qsCode
|
|
|
+ },
|
|
|
// components: { selectTree },
|
|
|
filters: {
|
|
|
filterAreaType: useDictLabelFilter
|
|
|
},
|
|
|
data() {
|
|
|
// const msg = throttle(
|
|
|
- // () => this.$message.error('货架总体积不能大于库区体积!'),
|
|
|
+ // () => this.$message.warning('货架总体积不能大于库区体积!'),
|
|
|
// 500
|
|
|
// );
|
|
|
|
|
|
@@ -808,6 +836,7 @@
|
|
|
};
|
|
|
|
|
|
return {
|
|
|
+ editType: '',
|
|
|
warehouseDefinition_isRegular,
|
|
|
warehouseDefinition_areaType,
|
|
|
warehouseDefinition_areaAttribute,
|
|
|
@@ -853,6 +882,11 @@
|
|
|
}
|
|
|
},
|
|
|
areaLocationRules: {
|
|
|
+ goodsAllocationCode: {
|
|
|
+ required: true,
|
|
|
+ message: '请输入货位编号',
|
|
|
+ trigger: 'blur'
|
|
|
+ },
|
|
|
code: {
|
|
|
required: true,
|
|
|
message: '请输入货位编号',
|
|
|
@@ -971,8 +1005,10 @@
|
|
|
let kqArr = [];
|
|
|
for (const key in warehouseAreasSaveList) {
|
|
|
kqArr.push({
|
|
|
+ id: warehouseAreasSaveList[key].id,
|
|
|
name: warehouseAreasSaveList[key].name,
|
|
|
code: warehouseAreasSaveList[key].code,
|
|
|
+ isEdit: false,
|
|
|
extInfo: [
|
|
|
{
|
|
|
areaType: warehouseAreasSaveList[key].type,
|
|
|
@@ -1213,7 +1249,7 @@
|
|
|
row.reservoirAreaCode === item.reservoirAreaCode
|
|
|
).length > 1
|
|
|
) {
|
|
|
- return this.$message.error('货架编号不能重复!');
|
|
|
+ return this.$message.warning('货架编号不能重复!');
|
|
|
}
|
|
|
const savedSum = this.areaForm.areaGoodsshelvesList
|
|
|
.filter((t) => t.reservoirAreaCode === row.reservoirAreaCode)
|
|
|
@@ -1238,7 +1274,7 @@
|
|
|
row.extInfo[0].areaWidth *
|
|
|
row.extInfo[0].areaHigh
|
|
|
) {
|
|
|
- return this.$message.error('货架总体积不能大于库区体积!');
|
|
|
+ return this.$message.warning('货架总体积不能大于库区体积!');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1253,48 +1289,92 @@
|
|
|
},
|
|
|
generateAllocation(num, obj) {
|
|
|
console.log(obj);
|
|
|
- const pre =
|
|
|
- this.areaForm.allocationReqList[
|
|
|
- this.areaForm.allocationReqList.length - 1
|
|
|
- ];
|
|
|
-
|
|
|
- for (var i = 0; i < num; i++) {
|
|
|
- this.areaForm.allocationReqList.push({
|
|
|
- warehouseAreaCode: obj.reservoirAreaCode,
|
|
|
- warehouseAreaGoodsCode: obj.code,
|
|
|
- goodsAllocationCode: obj.code + '-' + (i + 1),
|
|
|
- // allocationBarcode: '',
|
|
|
- code: obj.code + '-' + (i + 1),
|
|
|
+ const rows = Number(obj.extInfo[0].line); // 行数
|
|
|
+ const cols = Number(obj.extInfo[0].column); // 列数
|
|
|
+
|
|
|
+ // 按行优先遍历:行从1到rows,列从1到cols
|
|
|
+ for (let row = 1; row <= rows; row++) {
|
|
|
+ for (let col = 1; col <= cols; col++) {
|
|
|
+ // 货位编号规则:货架编号-行号-列号
|
|
|
+ const allocationCode = `${obj.code}-${row}-${col}`;
|
|
|
+
|
|
|
+ this.areaForm.allocationReqList.push({
|
|
|
+ warehouseAreaCode: obj.reservoirAreaCode,
|
|
|
+ warehouseAreaGoodsCode: obj.code,
|
|
|
+ goodsAllocationCode: allocationCode,
|
|
|
+ // allocationBarcode: '',
|
|
|
+ code: allocationCode,
|
|
|
|
|
|
- extInfo: [
|
|
|
- {
|
|
|
- goodsAllocationWide: Number(obj.extInfo[0].areaWidth),
|
|
|
- goodsAllocationHigh: Number(
|
|
|
- obj.extInfo[0].areaHigh / Number(obj.extInfo[0].line)
|
|
|
- ).toFixed(0),
|
|
|
- goodsAllocationLength: Number(
|
|
|
- obj.extInfo[0].areaLength / Number(obj.extInfo[0].column)
|
|
|
- ).toFixed(0),
|
|
|
- weightLimit: '',
|
|
|
- volumeUnit:
|
|
|
- Number(
|
|
|
- obj.extInfo[0].areaLength / Number(obj.extInfo[0].column)
|
|
|
- ).toFixed(0) *
|
|
|
- Number(
|
|
|
- obj.extInfo[0].areaHigh / Number(obj.extInfo[0].line)
|
|
|
- ).toFixed(0) *
|
|
|
- Number(obj.extInfo[0].areaWidth)
|
|
|
- }
|
|
|
- ],
|
|
|
- goodsShelvesCode: obj.code,
|
|
|
- reservoirAreaCode: obj.reservoirAreaCode,
|
|
|
- warehouseId: this.formData.id, //?
|
|
|
+ extInfo: [
|
|
|
+ {
|
|
|
+ goodsAllocationWide: Number(obj.extInfo[0].areaWidth),
|
|
|
+ goodsAllocationHigh: Number(
|
|
|
+ obj.extInfo[0].areaHigh / rows
|
|
|
+ ).toFixed(0),
|
|
|
+ goodsAllocationLength: Number(
|
|
|
+ obj.extInfo[0].areaLength / cols
|
|
|
+ ).toFixed(0),
|
|
|
+ weightLimit: '',
|
|
|
+ volumeUnit:
|
|
|
+ Number(obj.extInfo[0].areaLength / cols).toFixed(0) *
|
|
|
+ Number(obj.extInfo[0].areaHigh / rows).toFixed(0) *
|
|
|
+ Number(obj.extInfo[0].areaWidth)
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ goodsShelvesCode: obj.code,
|
|
|
+ reservoirAreaCode: obj.reservoirAreaCode,
|
|
|
+ warehouseId: this.formData.id,
|
|
|
|
|
|
- type: 3,
|
|
|
- isEdit: true
|
|
|
- });
|
|
|
+ type: 3,
|
|
|
+ isEdit: true
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
+ // generateAllocation(num, obj) {
|
|
|
+ // console.log(obj);
|
|
|
+ // const pre =
|
|
|
+ // this.areaForm.allocationReqList[
|
|
|
+ // this.areaForm.allocationReqList.length - 1
|
|
|
+ // ];
|
|
|
+
|
|
|
+ // for (var i = 0; i < num; i++) {
|
|
|
+ // this.areaForm.allocationReqList.push({
|
|
|
+ // warehouseAreaCode: obj.reservoirAreaCode,
|
|
|
+ // warehouseAreaGoodsCode: obj.code,
|
|
|
+ // goodsAllocationCode: obj.code + '-' + (i + 1),
|
|
|
+ // // allocationBarcode: '',
|
|
|
+ // code: obj.code + '-' + (i + 1),
|
|
|
+
|
|
|
+ // extInfo: [
|
|
|
+ // {
|
|
|
+ // goodsAllocationWide: Number(obj.extInfo[0].areaWidth),
|
|
|
+ // goodsAllocationHigh: Number(
|
|
|
+ // obj.extInfo[0].areaHigh / Number(obj.extInfo[0].line)
|
|
|
+ // ).toFixed(0),
|
|
|
+ // goodsAllocationLength: Number(
|
|
|
+ // obj.extInfo[0].areaLength / Number(obj.extInfo[0].column)
|
|
|
+ // ).toFixed(0),
|
|
|
+ // weightLimit: '',
|
|
|
+ // volumeUnit:
|
|
|
+ // Number(
|
|
|
+ // obj.extInfo[0].areaLength / Number(obj.extInfo[0].column)
|
|
|
+ // ).toFixed(0) *
|
|
|
+ // Number(
|
|
|
+ // obj.extInfo[0].areaHigh / Number(obj.extInfo[0].line)
|
|
|
+ // ).toFixed(0) *
|
|
|
+ // Number(obj.extInfo[0].areaWidth)
|
|
|
+ // }
|
|
|
+ // ],
|
|
|
+ // goodsShelvesCode: obj.code,
|
|
|
+ // reservoirAreaCode: obj.reservoirAreaCode,
|
|
|
+ // warehouseId: this.formData.id, //?
|
|
|
+
|
|
|
+ // type: 3,
|
|
|
+ // isEdit: true
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // },
|
|
|
saveArea(index) {
|
|
|
this.hjForm = { code: '', type: 1 };
|
|
|
if (
|
|
|
@@ -1303,7 +1383,7 @@
|
|
|
item.code === this.areaForm.warehouseAreasSaveList[index].code
|
|
|
).length > 1
|
|
|
) {
|
|
|
- return this.$message.error('库区编号不能重复!');
|
|
|
+ return this.$message.warning('库区编号不能重复!');
|
|
|
}
|
|
|
this.hjCodeIndex = index;
|
|
|
this.hjCodeFalg = true;
|
|
|
@@ -1403,7 +1483,7 @@
|
|
|
(item) => item.reservoirAreaCode === reservoirAreaCode
|
|
|
).length === 1
|
|
|
) {
|
|
|
- return this.$message.error('至少保留一个货架!');
|
|
|
+ return this.$message.warning('至少保留一个货架!');
|
|
|
}
|
|
|
if (this.savedShelves.includes(id)) {
|
|
|
let list = this.areaForm.allocationReqList
|
|
|
@@ -1413,7 +1493,7 @@
|
|
|
const res = await existGoods(list);
|
|
|
|
|
|
if (res?.success && res.data) {
|
|
|
- return this.$message.error('此货架下货位有关联货物,无法删除!');
|
|
|
+ return this.$message.warning('此货架下货位有关联货物,无法删除!');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1446,18 +1526,24 @@
|
|
|
// warehouseAreasSaveList: res.reservoirAreaList || [], //库区
|
|
|
// areaGoodsshelvesList: res.goodsShelvesList || [], //货架
|
|
|
// allocationReqList: res.goodsAllocationList || [] //货位
|
|
|
+ console.log('removeGoods1~~', idx, id, code, reservoirAreaCode);
|
|
|
if (
|
|
|
this.areaForm.areaGoodsshelvesList.filter(
|
|
|
(item) => item.reservoirAreaCode === reservoirAreaCode
|
|
|
).length === 1
|
|
|
) {
|
|
|
- return this.$message.error('至少保留一个货架!');
|
|
|
+ return this.$message.warning('至少保留一个货架!');
|
|
|
}
|
|
|
|
|
|
this.$confirm(`是否删除这个货架?`).then(async () => {
|
|
|
+ // 删除前统计该库区的货架数量
|
|
|
+ const beforeCount = this.areaForm.areaGoodsshelvesList.filter(
|
|
|
+ (item) => item.reservoirAreaCode === reservoirAreaCode
|
|
|
+ ).length;
|
|
|
+
|
|
|
if (id) {
|
|
|
- const res = await warehouseDefinition.isDelete(id);
|
|
|
- if (res == 1) {
|
|
|
+ const res = await warehouseDefinition.isGoodsshelvesCanDelete(id);
|
|
|
+ if (res) {
|
|
|
this.areaForm.areaGoodsshelvesList =
|
|
|
this.areaForm.areaGoodsshelvesList.filter(
|
|
|
(item) => item.code !== code
|
|
|
@@ -1466,9 +1552,11 @@
|
|
|
this.areaForm.allocationReqList.filter(
|
|
|
(item) => item.goodsShelvesCode !== code
|
|
|
);
|
|
|
+ // 更新对应库区的货架数量
|
|
|
+ this.updateAreaSubCount(reservoirAreaCode, beforeCount);
|
|
|
this.$message.warning('已在本地删除,保存之后生效!');
|
|
|
} else {
|
|
|
- this.$message.warning('此数据可能有关联数据,暂时无法删除!');
|
|
|
+ this.$message.warning('该货架已上架产品,无法删除。');
|
|
|
}
|
|
|
} else {
|
|
|
this.areaForm.areaGoodsshelvesList =
|
|
|
@@ -1479,17 +1567,38 @@
|
|
|
this.areaForm.allocationReqList.filter(
|
|
|
(item) => item.goodsShelvesCode !== code
|
|
|
);
|
|
|
-
|
|
|
+ // 更新对应库区的货架数量
|
|
|
+ this.updateAreaSubCount(reservoirAreaCode, beforeCount);
|
|
|
this.$message.success('删除成功!');
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ updateAreaSubCount(reservoirAreaCode, beforeCount) {
|
|
|
+ // 删除后统计该库区的货架数量
|
|
|
+ const afterCount = this.areaForm.areaGoodsshelvesList.filter(
|
|
|
+ (item) => item.reservoirAreaCode === reservoirAreaCode
|
|
|
+ ).length;
|
|
|
+ // 更新库区的货架数量
|
|
|
+ const areaIndex = this.areaForm.warehouseAreasSaveList.findIndex(
|
|
|
+ (item) => item.code === reservoirAreaCode
|
|
|
+ );
|
|
|
+ if (areaIndex !== -1) {
|
|
|
+ this.areaForm.warehouseAreasSaveList[areaIndex].subCount = afterCount;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ editArea(row, index) {
|
|
|
+ this.editType = 'edit';
|
|
|
+ row.isEdit = true;
|
|
|
+ this.$set(this.areaForm.warehouseAreasSaveList[index], 'isEdit', true);
|
|
|
+ console.log('editArea~~', row, index, this.areaForm.warehouseAreasSaveList[index]);
|
|
|
+ },
|
|
|
remove1(index, { id, code }) {
|
|
|
+ console.log('remove1~~', index, id, code);
|
|
|
this.$confirm(`是否删除这个库区`)
|
|
|
.then(async () => {
|
|
|
if (id) {
|
|
|
- const res = await warehouseDefinition.isDelete(id);
|
|
|
- if (res == 1) {
|
|
|
+ const res = await warehouseDefinition.isAreaCanDelete(id);
|
|
|
+ if (res) {
|
|
|
this.areaForm.warehouseAreasSaveList.splice(index, 1);
|
|
|
this.areaForm.areaGoodsshelvesList =
|
|
|
this.areaForm.areaGoodsshelvesList.filter(
|
|
|
@@ -1501,7 +1610,7 @@
|
|
|
);
|
|
|
this.$message.warning('已在本地删除,保存之后生效!');
|
|
|
} else {
|
|
|
- this.$message.warning('此数据可能有关联数据,暂时无法删除!');
|
|
|
+ this.$message.warning('该库区已上架产品,无法删除。');
|
|
|
}
|
|
|
} else {
|
|
|
this.areaForm.warehouseAreasSaveList.splice(index, 1);
|
|
|
@@ -1535,7 +1644,7 @@
|
|
|
const res = await existGoods(list);
|
|
|
|
|
|
if (res?.success && res.data) {
|
|
|
- return this.$message.error('此库区下货位有关联货物,无法删除!');
|
|
|
+ return this.$message.warning('此库区下货位有关联货物,无法删除!');
|
|
|
}
|
|
|
}
|
|
|
// 货架code
|
|
|
@@ -1558,6 +1667,7 @@
|
|
|
this.areaForm.warehouseAreasSaveList.splice(index, 1);
|
|
|
},
|
|
|
addArea() {
|
|
|
+ this.editType = 'add';
|
|
|
const pre =
|
|
|
this.areaForm.warehouseAreasSaveList[
|
|
|
this.areaForm.warehouseAreasSaveList.length - 1
|
|
|
@@ -1594,23 +1704,23 @@
|
|
|
delete this.formData.reservoirAreaList;
|
|
|
|
|
|
if (this.areaForm.warehouseAreasSaveList.length === 0) {
|
|
|
- return this.$message.error('请添加库区');
|
|
|
+ return this.$message.warning('请添加库区');
|
|
|
}
|
|
|
// ===dakai
|
|
|
if (
|
|
|
this.areaForm.warehouseAreasSaveList.length > 0 &&
|
|
|
this.areaForm.allocationReqList.length === 0
|
|
|
) {
|
|
|
- return this.$message.error('请添加货位');
|
|
|
+ return this.$message.warning('请添加货位');
|
|
|
}
|
|
|
if (
|
|
|
this.areaForm.warehouseAreasSaveList.length > 0 &&
|
|
|
this.areaForm.areaGoodsshelvesList.length === 0
|
|
|
) {
|
|
|
- return this.$message.error('请添加货架');
|
|
|
+ return this.$message.warning('请添加货架');
|
|
|
}
|
|
|
if (!this.checkVolume()) {
|
|
|
- return this.$message.error('货架总体积不能大于库区体积!');
|
|
|
+ return this.$message.warning('货架总体积不能大于库区体积!');
|
|
|
}
|
|
|
|
|
|
// let obj = {};
|
|
|
@@ -1631,13 +1741,21 @@
|
|
|
// }
|
|
|
|
|
|
let codeS=this.areaForm.allocationReqList?.map(item=>{
|
|
|
- return item.reservoirAreaCode+'_'+item.goodsShelvesCode+'_'+item.goodsAllocationCode
|
|
|
+ return item.reservoirAreaCode+'_'+item.warehouseAreaGoodsCode+'_'+item.goodsAllocationCode
|
|
|
})
|
|
|
- if(codeS){
|
|
|
- codeS=Array.from(new Set(codeS))
|
|
|
- }
|
|
|
- if(codeS?.length!=this.areaForm.allocationReqList?.length){
|
|
|
- return this.$message.error('货位编号不能重复!');
|
|
|
+ // 找出重复的货位编号
|
|
|
+ const duplicateCodes = [];
|
|
|
+ const codeCount = {};
|
|
|
+ codeS?.forEach(code => {
|
|
|
+ codeCount[code] = (codeCount[code] || 0) + 1;
|
|
|
+ if (codeCount[code] === 2) {
|
|
|
+ duplicateCodes.push(code);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log('duplicateCodes', this.areaForm.allocationReqList, codeS, duplicateCodes);
|
|
|
+ if(duplicateCodes.length > 0){
|
|
|
+ return this.$message.warning(`货位编号重复:${duplicateCodes.join('、')}!`);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1793,6 +1911,16 @@
|
|
|
newArr.push({ ...arr[key].extInfo[0], ...arr[key] });
|
|
|
}
|
|
|
return newArr;
|
|
|
+ },
|
|
|
+ generateQrcode(row, type) {
|
|
|
+ console.log(row);
|
|
|
+ if(row.isEdit){
|
|
|
+ this.$message.warning('请先保存库区');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.qsCodeRef.open(row, type);
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|