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"
ref="palletInput"
/>
<button
class="action-btn secondary"
<button
class="action-btn secondary"
style="flex: 0.25; margin: 0;"
@click="handleCallPallet"
>
@ -41,39 +41,39 @@
<div style="display: flex; gap: 8px; align-items: end;">
<div style="flex: 1;">
<label class="input-label">位置</label>
<el-select
v-model="selectedPosition"
<el-select
v-model="selectedPosition"
placeholder="请选择位置"
style="width: 100%;"
@change="handlePositionChange"
>
<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"
/>
</el-select>
</div>
<div style="flex: 1;">
<label class="input-label">层数</label>
<el-select
v-model="selectedLayer"
<el-select
v-model="selectedLayer"
placeholder="请选择层数"
style="width: 100%;"
>
<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"
/>
</el-select>
</div>
<button
class="action-btn secondary"
<button
class="action-btn secondary"
style="margin: 0; white-space: nowrap;"
@click="refreshTable"
>
@ -84,16 +84,16 @@
<!-- 第三行扫进/扫出选择 (扫描栈板后显示) -->
<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>
</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"
>
扫描二维码
@ -112,8 +112,8 @@
<div class="col-serial">标签号</div>
<div class="col-part">物料编码</div>
</div>
<div
v-for="(detail, index) in detailList"
<div
v-for="(detail, index) in detailList"
:key="index"
class="table-row"
>
@ -137,37 +137,41 @@
:visible.sync="scanModalVisible"
width="90%"
: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 v-if="operationType === 'in'" class="modal-form">
<div class="input-group">
<label class="input-label">位置</label>
<el-select
v-model="scanPosition"
<el-select
v-model="scanPosition"
placeholder="请选择位置"
style="width: 100%;"
@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"
/>
</el-select>
</div>
<div class="input-group">
<label class="input-label">层数</label>
<el-select
v-model="scanLayer"
<el-select
v-model="scanLayer"
placeholder="请选择层数"
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"
/>
</el-select>
@ -189,7 +193,6 @@
</div>
<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>
</div>
</el-dialog>
@ -214,20 +217,21 @@ export default {
palletCode: '',
palletScanned: false,
operationType: 'in', // 'in' 'out'
//
selectedPosition: '',
selectedLayer: '',
positionOptions: [],
layerOptions: [],
//
scanModalVisible: false,
scanCode: '',
scanPosition: '',
scanLayer: '',
scanLayerOptions: [],
needRefreshOnClose: false, //
//
detailList: [],
};
@ -238,19 +242,16 @@ export default {
},
//
async handlePalletScan() {
handlePalletScan() {
if (!this.palletCode.trim()) {
this.$message.error('请输入栈板编码');
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) {
this.palletScanned = true;
this.positionOptions = data.positions || [];
@ -259,10 +260,10 @@ export default {
} else {
this.$message.error(data.msg || '栈板不存在');
}
} catch (error) {
}).catch(error => {
console.error('验证栈板失败:', error);
this.$message.error('验证栈板失败');
}
});
},
// Call -
@ -271,22 +272,20 @@ export default {
this.$message.info('Call栈板功能待实现');
},
//
async handlePositionChange() {
//
handlePositionChange() {
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) {
this.layerOptions = data.layers || [];
}
} catch (error) {
}).catch(error => {
console.error('获取层数失败:', error);
}
});
} else {
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) {
this.detailList = data.details || [];
} else {
this.detailList = [];
}
} catch (error) {
}).catch(error => {
console.error('获取栈板明细失败:', error);
this.detailList = [];
}
});
},
//
@ -321,7 +318,8 @@ export default {
this.scanPosition = '';
this.scanLayer = '';
this.scanLayerOptions = [];
this.needRefreshOnClose = false; //
this.$nextTick(() => {
if (this.$refs.scanInput) {
this.$refs.scanInput.focus();
@ -332,26 +330,32 @@ export default {
//
closeScanModal() {
this.scanModalVisible = false;
//
if (this.needRefreshOnClose) {
this.refreshTable();
this.needRefreshOnClose = false;
}
},
//
async handleScanPositionChange() {
//
handleScanPositionChange() {
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) {
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);
this.scanLayerOptions = [1];
}
});
} else {
this.scanLayerOptions = [];
}
@ -359,7 +363,7 @@ export default {
},
//
async handleLabelScan() {
handleLabelScan() {
if (!this.scanCode.trim()) {
this.$message.error('请输入标签编码');
return;
@ -376,46 +380,44 @@ export default {
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) {
this.$message.success('扫进成功');
this.closeScanModal();
this.refreshTable();
this.needRefreshOnClose = true; //
this.scanCode = ''; //
this.$refs.scanInput.focus();
} else {
this.$message.error(data.msg || '扫进失败');
}
} catch (error) {
}).catch(error => {
console.error('扫进失败:', error);
this.$message.error('扫进失败');
}
});
} 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) {
this.$message.success('扫出成功');
this.closeScanModal();
this.refreshTable();
this.needRefreshOnClose = true; //
this.scanCode = ''; //
this.$refs.scanInput.focus();
} else {
this.$message.error(data.msg || '扫出失败');
}
} catch (error) {
}).catch(error => {
console.error('扫出失败:', error);
this.$message.error('扫出失败');
}
});
}
},
},
@ -502,4 +504,22 @@ export default {
.dialog-footer {
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