fix(warehouse): 修复复合架规则验证和拆分逻辑
调整复合架规则的数据结构,增加列数配置 添加复合架规则的合法性验证条件 修改拆分逻辑以根据配置的行数进行拆分 移除调试用的console.log语句
This commit is contained in:
@@ -121,9 +121,10 @@ export default {
|
|||||||
compositeRules: {
|
compositeRules: {
|
||||||
// 测试库区
|
// 测试库区
|
||||||
'2002207449418686465': {
|
'2002207449418686465': {
|
||||||
big: 19 * 5,
|
col: 5,
|
||||||
small: 29 * 5,
|
big: 19,
|
||||||
rows: [1, 2, 3, 4, 5]
|
small: 29,
|
||||||
|
rows: [0, 1, 2, 3, 4]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
dialogOpen: false,
|
dialogOpen: false,
|
||||||
@@ -139,7 +140,20 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
// 当前的库区是否支持复合架
|
// 当前的库区是否支持复合架
|
||||||
isComposite() {
|
isComposite() {
|
||||||
// 如果存在id则支持,不存在
|
if (!this.compositeRules[this.id]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 检车规则是否合法,
|
||||||
|
// 1. (small - big) / 2 = rows.length
|
||||||
|
if ((this.compositeRules[this.id].small - this.compositeRules[this.id].big) / 2 !== this.compositeRules[this.id].rows.length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 2. row中最大的值小于等于big
|
||||||
|
const maxRow = Math.max(...this.compositeRules[this.id].rows);
|
||||||
|
if (maxRow > this.compositeRules[this.id].big) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return this.compositeRules[this.id];
|
return this.compositeRules[this.id];
|
||||||
},
|
},
|
||||||
sortedColumnKeys() {
|
sortedColumnKeys() {
|
||||||
@@ -243,7 +257,6 @@ export default {
|
|||||||
// 向父组件发送切换事件,由父组件更新columns数据
|
// 向父组件发送切换事件,由父组件更新columns数据
|
||||||
// 如果切换为合并状态,调用handleMergeWarehouse方法
|
// 如果切换为合并状态,调用handleMergeWarehouse方法
|
||||||
// 需要二次确认
|
// 需要二次确认
|
||||||
console.log(this.columns[column])
|
|
||||||
const columnData = this.columns[column] || {};
|
const columnData = this.columns[column] || {};
|
||||||
const columnFlag = columnData.layer1?.[0]?.actualWarehouseCode?.substring(0, 4) || ''; // 取前四位
|
const columnFlag = columnData.layer1?.[0]?.actualWarehouseCode?.substring(0, 4) || ''; // 取前四位
|
||||||
|
|
||||||
@@ -289,10 +302,12 @@ export default {
|
|||||||
const splitIds = [];
|
const splitIds = [];
|
||||||
const layer1Warehouses = columnData.layer1 || [];
|
const layer1Warehouses = columnData.layer1 || [];
|
||||||
const layer2Warehouses = columnData.layer2 || [];
|
const layer2Warehouses = columnData.layer2 || [];
|
||||||
const maxSplitCount = 5; // 最多拆分5个
|
// 将对应的行拆分
|
||||||
for (let i = 0; i < maxSplitCount; i++) {
|
const currentRule = this.compositeRules[this.id];
|
||||||
if (layer1Warehouses[i]) splitIds.push(layer1Warehouses[i].actualWarehouseId);
|
const rows = currentRule?.rows || []; // 最多拆分5个
|
||||||
if (layer2Warehouses[i]) splitIds.push(layer2Warehouses[i].actualWarehouseId);
|
for (let i = 0; i < rows.length; i++) {
|
||||||
|
if (layer1Warehouses[i]) splitIds.push(layer1Warehouses[rows[i]].actualWarehouseId);
|
||||||
|
if (layer2Warehouses[i]) splitIds.push(layer2Warehouses[rows[i]].actualWarehouseId);
|
||||||
}
|
}
|
||||||
payload.splitIds = splitIds;
|
payload.splitIds = splitIds;
|
||||||
console.log(payload)
|
console.log(payload)
|
||||||
|
|||||||
Reference in New Issue
Block a user