|
|
@@ -2,7 +2,7 @@
|
|
|
<div class="ele-body warehouseAdd">
|
|
|
<el-card shadoe="never">
|
|
|
<header>
|
|
|
- <span class="title">{{ formData.code }} {{ formData.name }}</span>
|
|
|
+ <span class="title">{{ titleObj.code }} {{ titleObj.name }}</span>
|
|
|
<div>
|
|
|
<el-button @click="$router.go(-1)">返回</el-button>
|
|
|
<el-button type="primary" @click="submit" :loading="loading"
|
|
|
@@ -909,18 +909,19 @@
|
|
|
shelfObj: {},
|
|
|
longWidthHeightBol: false,
|
|
|
savedWarehouse: [],
|
|
|
- savedShelves: []
|
|
|
+ savedShelves: [],
|
|
|
+ titleObj: {},
|
|
|
+ warehouseVO: {}
|
|
|
};
|
|
|
},
|
|
|
computed: {},
|
|
|
created() {
|
|
|
const { query } = this.$route;
|
|
|
- this.formData.code = query.code;
|
|
|
- this.formData.name = query.name;
|
|
|
+ this.titleObj.code = query.code;
|
|
|
+ this.titleObj.name = query.name;
|
|
|
this.formData.id = query.id;
|
|
|
this.getDetail(query.id);
|
|
|
},
|
|
|
-
|
|
|
methods: {
|
|
|
setNUm(row) {
|
|
|
let result = Number.isNaN(row.extInfo[0].line * row.extInfo[0].column)
|
|
|
@@ -929,15 +930,81 @@
|
|
|
row.subCount = result;
|
|
|
return result;
|
|
|
},
|
|
|
+ handleHouse(obj) {
|
|
|
+ const {
|
|
|
+ warehouseAreasSaveList,
|
|
|
+ areaGoodsshelvesList,
|
|
|
+ allocationReqList
|
|
|
+ } = obj;
|
|
|
+ let kqArr = [];
|
|
|
+ for (const key in warehouseAreasSaveList) {
|
|
|
+ kqArr.push({
|
|
|
+ name: warehouseAreasSaveList[key].name,
|
|
|
+ code: warehouseAreasSaveList[key].code,
|
|
|
+ extInfo: [
|
|
|
+ {
|
|
|
+ areaType: warehouseAreasSaveList[key].type,
|
|
|
+ attribute: warehouseAreasSaveList[key].attribute,
|
|
|
+ address: warehouseAreasSaveList[key].address,
|
|
|
+ areaLength: warehouseAreasSaveList[key].areaLength,
|
|
|
+ areaWidth: warehouseAreasSaveList[key].areaWide,
|
|
|
+ areaHigh: warehouseAreasSaveList[key].areaHigh
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ subCount: warehouseAreasSaveList[key].num,
|
|
|
+ remark: warehouseAreasSaveList[key].areaRemark
|
|
|
+ });
|
|
|
+ }
|
|
|
+ let hjArr = [];
|
|
|
+ for (const key in areaGoodsshelvesList) {
|
|
|
+ hjArr.push({
|
|
|
+ reservoirAreaCode: areaGoodsshelvesList[key].warehouseAreaCode,
|
|
|
+ code: areaGoodsshelvesList[key].goodsshelvesCode,
|
|
|
+ extInfo: [
|
|
|
+ {
|
|
|
+ line: areaGoodsshelvesList[key].goodsshelvesLine,
|
|
|
+ column: areaGoodsshelvesList[key].goodsshelvesColumn,
|
|
|
+ areaLength: areaGoodsshelvesList[key].goodsshelvesLength,
|
|
|
+ areaWidth: areaGoodsshelvesList[key].goodsshelvesWide,
|
|
|
+ areaHigh: areaGoodsshelvesList[key].goodsshelvesHigh,
|
|
|
+ isRegular: areaGoodsshelvesList[key].isRegular
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ remark: areaGoodsshelvesList[key].goodsshelvesRemark
|
|
|
+ });
|
|
|
+ }
|
|
|
+ let hwArr = [];
|
|
|
+ for (const key in allocationReqList) {
|
|
|
+ hwArr.push({
|
|
|
+ reservoirAreaCode: allocationReqList[key].warehouseAreaCode,
|
|
|
+ goodsShelvesCode: allocationReqList[key].goodsAllocationCode,
|
|
|
+ code: allocationReqList[key].warehouseAreaCode,
|
|
|
+ extInfo: [
|
|
|
+ {
|
|
|
+ goodsAllocationLength:
|
|
|
+ allocationReqList[key].goodsAllocationLength,
|
|
|
+ goodsAllocationWide: allocationReqList[key].goodsAllocationWide,
|
|
|
+ goodsAllocationHigh: allocationReqList[key].goodsAllocationHigh,
|
|
|
+ weightLimit: allocationReqList[key].weightLimit,
|
|
|
+ volumeUnit: allocationReqList[key].volumeUnit
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ });
|
|
|
+ }
|
|
|
+ console.log('货架', allocationReqList);
|
|
|
+ return { kq: kqArr, hj: hjArr, hw: hwArr };
|
|
|
+ },
|
|
|
async getDetail(id) {
|
|
|
- const res = await warehouseDefinition.getById({ id });
|
|
|
-
|
|
|
+ const res = await warehouseDefinition.warehouseDetail(id);
|
|
|
+ this.warehouseVO = res.warehouseVO; //仓库基本信息
|
|
|
+ const { kq, hj, hw } = this.handleHouse(res);
|
|
|
+ // console.log(this.handleHouse(res));
|
|
|
this.areaForm = {
|
|
|
- warehouseAreasSaveList: res.reservoirAreaList || [], //库区
|
|
|
- areaGoodsshelvesList: res.goodsShelvesList || [], //货架
|
|
|
- allocationReqList: res.goodsAllocationList || [] //货位
|
|
|
+ warehouseAreasSaveList: kq || [], //库区
|
|
|
+ areaGoodsshelvesList: hj || [], //货架
|
|
|
+ allocationReqList: hw || [] //货位
|
|
|
};
|
|
|
-
|
|
|
+ console.log('===', this.areaForm);
|
|
|
this.formData = res;
|
|
|
//已保存库区货位 ,删除时判断
|
|
|
this.savedWarehouse = this.areaForm.warehouseAreasSaveList.length
|
|
|
@@ -1387,7 +1454,6 @@
|
|
|
this.areaForm.areaGoodsshelvesList.filter(
|
|
|
(item) => item.reservoirAreaCode !== code
|
|
|
);
|
|
|
-
|
|
|
this.areaForm.allocationReqList =
|
|
|
this.areaForm.allocationReqList.filter(
|
|
|
(item) =>
|
|
|
@@ -1435,6 +1501,7 @@
|
|
|
if (this.areaForm.warehouseAreasSaveList.length === 0) {
|
|
|
return this.$message.error('请添加库区');
|
|
|
}
|
|
|
+ // ===dakai
|
|
|
if (
|
|
|
this.areaForm.warehouseAreasSaveList.length > 0 &&
|
|
|
this.areaForm.allocationReqList.length === 0
|
|
|
@@ -1447,9 +1514,9 @@
|
|
|
) {
|
|
|
return this.$message.error('请添加货架');
|
|
|
}
|
|
|
- // if (!this.checkVolume()) {
|
|
|
- // return this.$message.error('货架总体积不能大于库区体积!');
|
|
|
- // }
|
|
|
+ if (!this.checkVolume()) {
|
|
|
+ return this.$message.error('货架总体积不能大于库区体积!');
|
|
|
+ }
|
|
|
|
|
|
let obj = {};
|
|
|
for (const item of this.areaForm.allocationReqList) {
|
|
|
@@ -1480,35 +1547,43 @@
|
|
|
// goodsShelvesList: this.areaForm.areaGoodsshelvesList,
|
|
|
// reservoirAreaList: this.areaForm.warehouseAreasSaveList
|
|
|
// };
|
|
|
- let arr = [
|
|
|
- ...this.areaForm.allocationReqList,
|
|
|
- ...this.areaForm.areaGoodsshelvesList,
|
|
|
- ...this.areaForm.warehouseAreasSaveList
|
|
|
- ];
|
|
|
+ // let arr = [
|
|
|
+ // ...this.areaForm.allocationReqList, //货位
|
|
|
+ // ...this.areaForm.areaGoodsshelvesList, //货架
|
|
|
+ // ...this.areaForm.warehouseAreasSaveList //库区
|
|
|
+ // ];
|
|
|
// arr.forEach((item) => {
|
|
|
// if ('isEdit' in item) {
|
|
|
// delete item.isEdit;
|
|
|
// }
|
|
|
// });
|
|
|
|
|
|
- const arrMap = arr.map((item) => {
|
|
|
- return {
|
|
|
- warehouseId: item.warehouseId,
|
|
|
- code: item.code,
|
|
|
- extInfo: item.extInfo,
|
|
|
- goodsShelvesCode: item.goodsShelvesCode,
|
|
|
- name: item.name,
|
|
|
- remark: item.remark,
|
|
|
- reservoirAreaCode: item.reservoirAreaCode,
|
|
|
- subCount: item.subCount,
|
|
|
- type: item.type
|
|
|
- };
|
|
|
- });
|
|
|
+ // const arrMap = arr.map((item) => {
|
|
|
+ // return {
|
|
|
+ // warehouseId: item.warehouseId,
|
|
|
+ // code: item.code,
|
|
|
+ // extInfo: item.extInfo,
|
|
|
+ // goodsShelvesCode: item.goodsShelvesCode,
|
|
|
+ // name: item.name,
|
|
|
+ // remark: item.remark,
|
|
|
+ // reservoirAreaCode: item.reservoirAreaCode,
|
|
|
+ // subCount: item.subCount,
|
|
|
+ // type: item.type
|
|
|
+ // };
|
|
|
+ // });
|
|
|
+ const newObj = {
|
|
|
+ allocationList: this.areaForm.allocationReqList, //货位
|
|
|
+ areaGoodsshelvesList: this.areaForm.areaGoodsshelvesList, //货架
|
|
|
+ areasList: this.areaForm.warehouseAreasSaveList //库区
|
|
|
+ };
|
|
|
+ // ...this.areaForm.allocationReqList, //货位
|
|
|
+ // ...this.areaForm.areaGoodsshelvesList, //货架
|
|
|
+ // ...this.areaForm.warehouseAreasSaveList //库区
|
|
|
|
|
|
this.loading = true;
|
|
|
try {
|
|
|
let res = await warehouseDefinition.warehouseareaSave(
|
|
|
- arrMap
|
|
|
+ this.handleNewSource(newObj)
|
|
|
);
|
|
|
|
|
|
if (res.data.code == 0) {
|
|
|
@@ -1539,7 +1614,72 @@
|
|
|
const obj = this.areaForm.areaGoodsshelvesList.find((item) => {
|
|
|
item.id === pid;
|
|
|
});
|
|
|
+ console.log('1', obj && obj.reservoirAreaCode + '-' + goodsShelvesCode);
|
|
|
+ console.log('2', this.areaForm.areaGoodsshelvesList);
|
|
|
return obj && obj.reservoirAreaCode + '-' + goodsShelvesCode;
|
|
|
+ },
|
|
|
+ //重新处理数据,之前代码不敢动
|
|
|
+ handleNewSource(arr) {
|
|
|
+ //areasList库区
|
|
|
+ //areaGoodsshelvesList货架
|
|
|
+ //allocationList货位
|
|
|
+ const { areasList, areaGoodsshelvesList, allocationList } = arr;
|
|
|
+ let areasListArr = this.objExit(areasList).map((item) => {
|
|
|
+ return {
|
|
|
+ code: item.code,
|
|
|
+ name: item.name,
|
|
|
+ type: item.areaType,
|
|
|
+ attribute: item.attribute,
|
|
|
+ address: item.address,
|
|
|
+ areaLength: item.areaLength,
|
|
|
+ areaWidth: item.areaWidth,
|
|
|
+ areaHigh: item.areaHigh,
|
|
|
+ num: item.subCount,
|
|
|
+ areaRemark: item.remark
|
|
|
+ };
|
|
|
+ });
|
|
|
+ let areaGoodsshelvesListArr = this.objExit(areaGoodsshelvesList).map(
|
|
|
+ (item) => {
|
|
|
+ return {
|
|
|
+ warehouseAreaCode: item.reservoirAreaCode,
|
|
|
+ goodsshelvesCode: item.code,
|
|
|
+ goodsshelvesLine: item.line,
|
|
|
+ goodsshelvesColumn: item.column,
|
|
|
+ goodsshelvesLength: item.areaLength,
|
|
|
+ goodsshelvesWide: item.areaWidth,
|
|
|
+ goodsshelvesHigh: item.areaHigh,
|
|
|
+ inUseAllocationNumber: item.subCount,
|
|
|
+ isRegular: item.isRegular,
|
|
|
+ goodsshelvesRemark: item.remark
|
|
|
+ };
|
|
|
+ }
|
|
|
+ );
|
|
|
+ let allocationListArr = this.objExit(allocationList).map((item) => {
|
|
|
+ return {
|
|
|
+ warehouseAreaCode: item.reservoirAreaCode,
|
|
|
+ goodsAllocationCode: item.goodsShelvesCode,
|
|
|
+ goodsAllocationLength: item.goodsAllocationLength,
|
|
|
+ goodsAllocationWide: item.goodsAllocationWide,
|
|
|
+ goodsAllocationHigh: item.goodsAllocationHigh,
|
|
|
+ weightLimit: item.goodsAllocationHigh,
|
|
|
+ inUseAllocationNumber: item.weightLimit,
|
|
|
+ volumeUnit: item.volumeUnit
|
|
|
+ };
|
|
|
+ });
|
|
|
+ let params = {
|
|
|
+ areasList: areasListArr,
|
|
|
+ goodsshelvesList: areaGoodsshelvesListArr,
|
|
|
+ allocationList: allocationListArr,
|
|
|
+ warehousePO: this.warehouseVO
|
|
|
+ };
|
|
|
+ return params;
|
|
|
+ },
|
|
|
+ objExit(arr) {
|
|
|
+ let newArr = [];
|
|
|
+ for (const key in arr) {
|
|
|
+ newArr.push({ ...arr[key].extInfo[0], ...arr[key] });
|
|
|
+ }
|
|
|
+ return newArr;
|
|
|
}
|
|
|
}
|
|
|
};
|