|
|
|
@ -76,6 +76,17 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- 第2.5行:是否强制整托出库 (扫描栈板后显示) - rqrq --> |
|
|
|
<div v-if="palletScanned" class="input-group"> |
|
|
|
<el-checkbox |
|
|
|
v-model="forceFullPalletOut" |
|
|
|
:disabled="palletTypeDisabled" |
|
|
|
@change="handleForceFullPalletOutChange" |
|
|
|
style="width: 100%;"> |
|
|
|
是否强制整托出库 |
|
|
|
</el-checkbox> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- 第三行:筛选条件 (扫描栈板后显示) --> |
|
|
|
<div v-if="palletScanned" class="input-group"> |
|
|
|
<label class="input-label">位置</label> |
|
|
|
@ -283,17 +294,17 @@ |
|
|
|
positionGrid.length === 4 ? 'position-grid-4' : 'position-grid-9' |
|
|
|
]"> |
|
|
|
<div |
|
|
|
v-for="(position, index) in positionGrid" |
|
|
|
v-for="(item, index) in positionGrid" |
|
|
|
:key="index" |
|
|
|
class="position-item" |
|
|
|
:class="{ |
|
|
|
'position-disabled': positionGridLoading || !availablePositions.includes(position), |
|
|
|
'position-selected': currentSelectedPosition === position, |
|
|
|
'position-disabled': positionGridLoading || !availablePositions.includes(item.position), |
|
|
|
'position-selected': currentSelectedPosition === item.position, |
|
|
|
'position-loading': positionGridLoading |
|
|
|
}" |
|
|
|
@click="handlePositionClick(position)" |
|
|
|
@click="handlePositionClick(item.position)" |
|
|
|
> |
|
|
|
{{ position }} |
|
|
|
{{ item.position }}({{ item.count }}) |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
@ -537,6 +548,7 @@ export default { |
|
|
|
currentPalletFamily: '', // 当前栈板大分类(固定不可改) |
|
|
|
currentPalletType: '', // 当前栈板类型 |
|
|
|
currentAutoSort: '', // 当前是否自动分拣 Y/N |
|
|
|
forceFullPalletOut: false, // 是否强制整托出库 - rqrq |
|
|
|
palletTypeOptions: [], // 托盘类型选项列表 |
|
|
|
palletTypeDisabled: false, // 栈板类型下拉框是否禁用(有明细数据时禁用) |
|
|
|
autoSortDisabled: false, // 自动分拣下拉框是否禁用 |
|
|
|
@ -558,7 +570,7 @@ export default { |
|
|
|
needRefreshOnClose: false, // 标记是否需要在关闭模态框时刷新 |
|
|
|
|
|
|
|
// 位置网格数据 - rqrq |
|
|
|
positionGrid: [], // 位置网格列表(用于显示4宫格或9宫格) |
|
|
|
positionGrid: [], // 位置网格列表(用于显示4宫格或9宫格),格式: [{position: '1', count: 2}, ...] |
|
|
|
availablePositions: [], // 可用位置列表 |
|
|
|
currentSelectedPosition: '', // 当前选中的位置 |
|
|
|
currentMixedMode: false, // 是否混装模式 |
|
|
|
@ -618,6 +630,7 @@ export default { |
|
|
|
this.currentPalletFamily = ''; |
|
|
|
this.currentPalletType = ''; |
|
|
|
this.currentAutoSort = ''; |
|
|
|
this.forceFullPalletOut = false; // 清空强制整托出库 - rqrq |
|
|
|
this.palletTypeOptions = []; |
|
|
|
this.palletTypeDisabled = false; |
|
|
|
this.autoSortDisabled = false; |
|
|
|
@ -843,13 +856,21 @@ export default { |
|
|
|
this.savePalletTypeAndAutoSort(); |
|
|
|
}, |
|
|
|
|
|
|
|
// 保存栈板类型和自动分拣标志 |
|
|
|
// 是否强制整托出库变更事件 - rqrq |
|
|
|
handleForceFullPalletOutChange() { |
|
|
|
console.log('是否强制整托出库变更 - rqrq,forceFullPalletOut=' + this.forceFullPalletOut); |
|
|
|
// 保存到数据库 |
|
|
|
this.savePalletTypeAndAutoSort(); |
|
|
|
}, |
|
|
|
|
|
|
|
// 保存栈板类型、自动分拣标志和存储类型 - rqrq |
|
|
|
savePalletTypeAndAutoSort() { |
|
|
|
updatePalletTypeAndAutoSort({ |
|
|
|
site: this.site, |
|
|
|
palletId: this.palletCode, |
|
|
|
palletType: this.currentPalletType, |
|
|
|
autoSort: this.currentAutoSort |
|
|
|
autoSort: this.currentAutoSort, |
|
|
|
forceFullPalletOut: this.forceFullPalletOut // 是否强制整托出库 - rqrq |
|
|
|
}).then(({ data }) => { |
|
|
|
if (data.code === 0) { |
|
|
|
this.$message.success('更新成功'); |
|
|
|
@ -1030,26 +1051,55 @@ export default { |
|
|
|
this.positionGridLoading = true; |
|
|
|
this.availablePositions = []; // 清空可用位置,全部禁用 |
|
|
|
|
|
|
|
getAvailablePositionsForLayer({ |
|
|
|
// 先获取当前层的所有明细数据,用于统计每个position的数量 - rqrq |
|
|
|
getPalletDetails({ |
|
|
|
site: this.site, |
|
|
|
palletId: this.palletCode, |
|
|
|
position: '', |
|
|
|
layer: this.scanLayer |
|
|
|
}).then(({ data }) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
const result = data.data; |
|
|
|
this.positionGrid = result.positions || []; |
|
|
|
this.availablePositions = result.availablePositions || []; |
|
|
|
console.log('位置网格加载完成 - 总位置:' + this.positionGrid.length + ',可用:' + this.availablePositions.length + ' - rqrq'); |
|
|
|
} else { |
|
|
|
this.$message.error(data.msg || '获取位置信息失败'); |
|
|
|
// 失败后保持全部禁用 - rqrq |
|
|
|
this.availablePositions = []; |
|
|
|
}).then(({ data: detailData }) => { |
|
|
|
// 统计每个position的数量 - rqrq |
|
|
|
const positionCountMap = {}; |
|
|
|
if (detailData && detailData.code === 0) { |
|
|
|
const details = detailData.details || []; |
|
|
|
details.forEach(detail => { |
|
|
|
const pos = detail.position; |
|
|
|
positionCountMap[pos] = (positionCountMap[pos] || 0) + 1; |
|
|
|
}); |
|
|
|
console.log('当前层(' + this.scanLayer + ')各位置数量统计 - rqrq:', positionCountMap); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取位置网格信息 - rqrq |
|
|
|
return getAvailablePositionsForLayer({ |
|
|
|
site: this.site, |
|
|
|
palletId: this.palletCode, |
|
|
|
layer: this.scanLayer |
|
|
|
}).then(({ data }) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
const result = data.data; |
|
|
|
const positions = result.positions || []; |
|
|
|
this.availablePositions = result.availablePositions || []; |
|
|
|
|
|
|
|
// 将positions转换为包含count的对象数组 - rqrq |
|
|
|
this.positionGrid = positions.map(position => ({ |
|
|
|
position: position, |
|
|
|
count: positionCountMap[position] || 0 |
|
|
|
})); |
|
|
|
|
|
|
|
console.log('位置网格加载完成 - 总位置:' + this.positionGrid.length + ',可用:' + this.availablePositions.length + ' - rqrq'); |
|
|
|
} else { |
|
|
|
this.$message.error(data.msg || '获取位置信息失败'); |
|
|
|
// 失败后保持全部禁用 - rqrq |
|
|
|
this.availablePositions = []; |
|
|
|
this.positionGrid = []; |
|
|
|
} |
|
|
|
}); |
|
|
|
}).catch(error => { |
|
|
|
console.error('获取位置信息失败:', error); |
|
|
|
this.$message.error('获取位置信息失败'); |
|
|
|
// 失败后保持全部禁用 - rqrq |
|
|
|
this.availablePositions = []; |
|
|
|
this.positionGrid = []; |
|
|
|
}).finally(() => { |
|
|
|
// 无论成功失败,都要解除加载状态 - rqrq |
|
|
|
this.positionGridLoading = false; |
|
|
|
|