Browse Source

提交栈板

master
常熟吴彦祖 5 months ago
parent
commit
b7d1385dee
  1. 174
      src/views/modules/automatedWarehouse/palletPacking.vue

174
src/views/modules/automatedWarehouse/palletPacking.vue

@ -84,16 +84,16 @@
<!-- 第三行扫进/扫出选择 (扫描栈板后显示) --> <!-- 第三行扫进/扫出选择 (扫描栈板后显示) -->
<div v-if="palletScanned" class="input-group"> <div v-if="palletScanned" class="input-group">
<div style="display: flex; gap: 8px; align-items: center;">
<div style="flex: 1;">
<el-radio-group v-model="operationType">
<el-radio label="in">扫进</el-radio>
<el-radio label="out">扫出</el-radio>
<div style="display: flex; gap: 8px; align-items: center; flex-wrap: nowrap;">
<div style="flex: 1; min-width: 0;">
<el-radio-group v-model="operationType" style="display: flex; flex-wrap: nowrap;">
<el-radio label="in" style="margin-right: 0px; white-space: nowrap;">扫进</el-radio>
<el-radio label="out" style="white-space: nowrap;">扫出</el-radio>
</el-radio-group> </el-radio-group>
</div> </div>
<button <button
class="action-btn secondary" class="action-btn secondary"
style="margin: 0; white-space: nowrap;"
style="margin: 0; white-space: nowrap; flex-shrink: 0;"
@click="showScanModal" @click="showScanModal"
> >
扫描二维码 扫描二维码
@ -137,6 +137,10 @@
:visible.sync="scanModalVisible" :visible.sync="scanModalVisible"
width="90%" width="90%"
:close-on-click-modal="false" :close-on-click-modal="false"
:show-close="false"
:modal="true"
:modal-append-to-body="true"
:append-to-body="true"
> >
<div class="scan-modal-content"> <div class="scan-modal-content">
<!-- 扫进时显示位置和层数选择 --> <!-- 扫进时显示位置和层数选择 -->
@ -189,7 +193,6 @@
</div> </div>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<button class="action-btn secondary" @click="handleLabelScan">确定</button>
<button class="action-btn secondary" style="margin-left: 10px;" @click="closeScanModal">取消</button> <button class="action-btn secondary" style="margin-left: 10px;" @click="closeScanModal">取消</button>
</div> </div>
</el-dialog> </el-dialog>
@ -227,6 +230,7 @@ export default {
scanPosition: '', scanPosition: '',
scanLayer: '', scanLayer: '',
scanLayerOptions: [], scanLayerOptions: [],
needRefreshOnClose: false, //
// //
detailList: [], detailList: [],
@ -238,19 +242,16 @@ export default {
}, },
// //
async handlePalletScan() {
handlePalletScan() {
if (!this.palletCode.trim()) { if (!this.palletCode.trim()) {
this.$message.error('请输入栈板编码'); this.$message.error('请输入栈板编码');
return; return;
} }
try {
//
const { data } = await checkPalletExists({
site: this.site,
palletId: this.palletCode
});
checkPalletExists({
site: this.site,
palletId: this.palletCode
}).then(({ data }) => {
if (data.code === 0) { if (data.code === 0) {
this.palletScanned = true; this.palletScanned = true;
this.positionOptions = data.positions || []; this.positionOptions = data.positions || [];
@ -259,10 +260,10 @@ export default {
} else { } else {
this.$message.error(data.msg || '栈板不存在'); this.$message.error(data.msg || '栈板不存在');
} }
} catch (error) {
}).catch(error => {
console.error('验证栈板失败:', error); console.error('验证栈板失败:', error);
this.$message.error('验证栈板失败'); this.$message.error('验证栈板失败');
}
});
}, },
// Call - // Call -
@ -271,22 +272,20 @@ export default {
this.$message.info('Call栈板功能待实现'); this.$message.info('Call栈板功能待实现');
}, },
//
async handlePositionChange() {
//
handlePositionChange() {
if (this.selectedPosition) { if (this.selectedPosition) {
try {
const { data } = await getLayersByPosition({
site: this.site,
palletId: this.palletCode,
position: this.selectedPosition
});
getLayersByPosition({
site: this.site,
palletId: this.palletCode,
position: this.selectedPosition
}).then(({ data }) => {
if (data.code === 0) { if (data.code === 0) {
this.layerOptions = data.layers || []; this.layerOptions = data.layers || [];
} }
} catch (error) {
}).catch(error => {
console.error('获取层数失败:', error); console.error('获取层数失败:', error);
}
});
} else { } else {
this.layerOptions = []; this.layerOptions = [];
} }
@ -294,24 +293,22 @@ export default {
}, },
// //
async refreshTable() {
try {
const { data } = await getPalletDetails({
site: this.site,
palletId: this.palletCode,
position: this.selectedPosition,
layer: this.selectedLayer
});
refreshTable() {
getPalletDetails({
site: this.site,
palletId: this.palletCode,
position: this.selectedPosition,
layer: this.selectedLayer
}).then(({ data }) => {
if (data.code === 0) { if (data.code === 0) {
this.detailList = data.details || []; this.detailList = data.details || [];
} else { } else {
this.detailList = []; this.detailList = [];
} }
} catch (error) {
}).catch(error => {
console.error('获取栈板明细失败:', error); console.error('获取栈板明细失败:', error);
this.detailList = []; this.detailList = [];
}
});
}, },
// //
@ -321,6 +318,7 @@ export default {
this.scanPosition = ''; this.scanPosition = '';
this.scanLayer = ''; this.scanLayer = '';
this.scanLayerOptions = []; this.scanLayerOptions = [];
this.needRefreshOnClose = false; //
this.$nextTick(() => { this.$nextTick(() => {
if (this.$refs.scanInput) { if (this.$refs.scanInput) {
@ -332,26 +330,32 @@ export default {
// //
closeScanModal() { closeScanModal() {
this.scanModalVisible = false; this.scanModalVisible = false;
//
if (this.needRefreshOnClose) {
this.refreshTable();
this.needRefreshOnClose = false;
}
}, },
//
async handleScanPositionChange() {
//
handleScanPositionChange() {
if (this.scanPosition) { if (this.scanPosition) {
try {
const { data } = await getLayersByPosition({
site: this.site,
palletId: this.palletCode,
position: this.scanPosition
});
getLayersByPosition({
site: this.site,
palletId: this.palletCode,
position: this.scanPosition
}).then(({ data }) => {
if (data.code === 0) { if (data.code === 0) {
const maxLayer = Math.max(...(data.layers || [0]));
this.scanLayerOptions = Array.from({length: maxLayer + 1}, (_, i) => i + 1);
const maxLayer = data.layers && data.layers.length > 0
? Math.max(...data.layers)
: 0;
this.scanLayerOptions = Array.from({ length: maxLayer+1 }, (_, i) => i + 1)
} }
} catch (error) {
}).catch(error => {
console.error('获取层数失败:', error); console.error('获取层数失败:', error);
this.scanLayerOptions = [1]; this.scanLayerOptions = [1];
}
});
} else { } else {
this.scanLayerOptions = []; this.scanLayerOptions = [];
} }
@ -359,7 +363,7 @@ export default {
}, },
// //
async handleLabelScan() {
handleLabelScan() {
if (!this.scanCode.trim()) { if (!this.scanCode.trim()) {
this.$message.error('请输入标签编码'); this.$message.error('请输入标签编码');
return; return;
@ -376,46 +380,44 @@ export default {
return; return;
} }
try {
const { data } = await savePalletDetail({
site: this.site,
palletId: this.palletCode,
position: this.scanPosition,
layer: this.scanLayer,
serialNo: this.scanCode
});
savePalletDetail({
site: this.site,
palletId: this.palletCode,
position: this.scanPosition,
layer: this.scanLayer,
serialNo: this.scanCode
}).then(({ data }) => {
if (data.code === 0) { if (data.code === 0) {
this.$message.success('扫进成功'); this.$message.success('扫进成功');
this.closeScanModal();
this.refreshTable();
this.needRefreshOnClose = true; //
this.scanCode = ''; //
this.$refs.scanInput.focus();
} else { } else {
this.$message.error(data.msg || '扫进失败'); this.$message.error(data.msg || '扫进失败');
} }
} catch (error) {
}).catch(error => {
console.error('扫进失败:', error); console.error('扫进失败:', error);
this.$message.error('扫进失败'); this.$message.error('扫进失败');
}
});
} else { } else {
// //
try {
const { data } = await deletePalletDetail({
site: this.site,
palletId: this.palletCode,
serialNo: this.scanCode
});
deletePalletDetail({
site: this.site,
palletId: this.palletCode,
serialNo: this.scanCode
}).then(({ data }) => {
if (data.code === 0) { if (data.code === 0) {
this.$message.success('扫出成功'); this.$message.success('扫出成功');
this.closeScanModal();
this.refreshTable();
this.needRefreshOnClose = true; //
this.scanCode = ''; //
this.$refs.scanInput.focus();
} else { } else {
this.$message.error(data.msg || '扫出失败'); this.$message.error(data.msg || '扫出失败');
} }
} catch (error) {
}).catch(error => {
console.error('扫出失败:', error); console.error('扫出失败:', error);
this.$message.error('扫出失败'); this.$message.error('扫出失败');
}
});
} }
}, },
}, },
@ -502,4 +504,22 @@ export default {
.dialog-footer { .dialog-footer {
text-align: center; text-align: center;
} }
/* 修复模态框层级问题 */
::v-deep .el-dialog__wrapper {
z-index: 2000 !important;
}
::v-deep .el-overlay {
z-index: 2000 !important;
}
/* 修复单选框样式 */
::v-deep .el-radio {
margin-right: 8px !important;
}
::v-deep .el-radio__label {
font-size: 14px;
}
</style> </style>
Loading…
Cancel
Save