Browse Source

提交栈板

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

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

@ -26,8 +26,8 @@
@keyup.enter.native="handlePalletScan" @keyup.enter.native="handlePalletScan"
ref="palletInput" ref="palletInput"
/> />
<button
class="action-btn secondary"
<button
class="action-btn secondary"
style="flex: 0.25; margin: 0;" style="flex: 0.25; margin: 0;"
@click="handleCallPallet" @click="handleCallPallet"
> >
@ -41,39 +41,39 @@
<div style="display: flex; gap: 8px; align-items: end;"> <div style="display: flex; gap: 8px; align-items: end;">
<div style="flex: 1;"> <div style="flex: 1;">
<label class="input-label">位置</label> <label class="input-label">位置</label>
<el-select
v-model="selectedPosition"
<el-select
v-model="selectedPosition"
placeholder="请选择位置" placeholder="请选择位置"
style="width: 100%;" style="width: 100%;"
@change="handlePositionChange" @change="handlePositionChange"
> >
<el-option label="ALL" value=""></el-option> <el-option label="ALL" value=""></el-option>
<el-option
v-for="position in positionOptions"
:key="position"
:label="position"
<el-option
v-for="position in positionOptions"
:key="position"
:label="position"
:value="position" :value="position"
/> />
</el-select> </el-select>
</div> </div>
<div style="flex: 1;"> <div style="flex: 1;">
<label class="input-label">层数</label> <label class="input-label">层数</label>
<el-select
v-model="selectedLayer"
<el-select
v-model="selectedLayer"
placeholder="请选择层数" placeholder="请选择层数"
style="width: 100%;" style="width: 100%;"
> >
<el-option label="ALL" value=""></el-option> <el-option label="ALL" value=""></el-option>
<el-option
v-for="layer in layerOptions"
:key="layer"
:label="`第${layer}层`"
<el-option
v-for="layer in layerOptions"
:key="layer"
:label="`第${layer}层`"
:value="layer" :value="layer"
/> />
</el-select> </el-select>
</div> </div>
<button
class="action-btn secondary"
<button
class="action-btn secondary"
style="margin: 0; white-space: nowrap;" style="margin: 0; white-space: nowrap;"
@click="refreshTable" @click="refreshTable"
> >
@ -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
class="action-btn secondary"
style="margin: 0; white-space: nowrap;"
<button
class="action-btn secondary"
style="margin: 0; white-space: nowrap; flex-shrink: 0;"
@click="showScanModal" @click="showScanModal"
> >
扫描二维码 扫描二维码
@ -112,8 +112,8 @@
<div class="col-serial">标签号</div> <div class="col-serial">标签号</div>
<div class="col-part">物料编码</div> <div class="col-part">物料编码</div>
</div> </div>
<div
v-for="(detail, index) in detailList"
<div
v-for="(detail, index) in detailList"
:key="index" :key="index"
class="table-row" class="table-row"
> >
@ -137,37 +137,41 @@
: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">
<!-- 扫进时显示位置和层数选择 --> <!-- 扫进时显示位置和层数选择 -->
<div v-if="operationType === 'in'" class="modal-form"> <div v-if="operationType === 'in'" class="modal-form">
<div class="input-group"> <div class="input-group">
<label class="input-label">位置</label> <label class="input-label">位置</label>
<el-select
v-model="scanPosition"
<el-select
v-model="scanPosition"
placeholder="请选择位置" placeholder="请选择位置"
style="width: 100%;" style="width: 100%;"
@change="handleScanPositionChange" @change="handleScanPositionChange"
> >
<el-option
v-for="position in positionOptions"
:key="position"
:label="position"
<el-option
v-for="position in positionOptions"
:key="position"
:label="position"
:value="position" :value="position"
/> />
</el-select> </el-select>
</div> </div>
<div class="input-group"> <div class="input-group">
<label class="input-label">层数</label> <label class="input-label">层数</label>
<el-select
v-model="scanLayer"
<el-select
v-model="scanLayer"
placeholder="请选择层数" placeholder="请选择层数"
style="width: 100%;" style="width: 100%;"
> >
<el-option
v-for="layer in scanLayerOptions"
:key="layer"
:label="`第${layer}层`"
<el-option
v-for="layer in scanLayerOptions"
:key="layer"
:label="`第${layer}层`"
:value="layer" :value="layer"
/> />
</el-select> </el-select>
@ -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>
@ -214,20 +217,21 @@ export default {
palletCode: '', palletCode: '',
palletScanned: false, palletScanned: false,
operationType: 'in', // 'in' 'out' operationType: 'in', // 'in' 'out'
// //
selectedPosition: '', selectedPosition: '',
selectedLayer: '', selectedLayer: '',
positionOptions: [], positionOptions: [],
layerOptions: [], layerOptions: [],
// //
scanModalVisible: false, scanModalVisible: false,
scanCode: '', scanCode: '',
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,7 +318,8 @@ 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) {
this.$refs.scanInput.focus(); this.$refs.scanInput.focus();
@ -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;
} }
</style>
/* 修复模态框层级问题 */
::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>
Loading…
Cancel
Save