盘点功能完善

This commit is contained in:
lsymicc
2026-09-15 23:10:35 +08:00
parent 39632ef960
commit 42104d892b
25 changed files with 728 additions and 85 deletions

View File

@@ -46,7 +46,8 @@ export function delJob(jobId) {
// 手动作废作业
export function cancelJob(jobId) {
return request({
url: '/pd/inJob/cancel/' + jobId,
// url: '/pd/inJob/cancel/' + jobId,
url: '/in/job/cancel/' + jobId,
method: 'put'
})
}
@@ -54,7 +55,8 @@ export function cancelJob(jobId) {
// 手动完成作业
export function completeJob(jobId) {
return request({
url: '/pd/inJob/complete/' + jobId,
// url: '/pd/inJob/complete/' + jobId,
url: '/in/job/complete/' + jobId,
method: 'put'
})
}

View File

@@ -46,7 +46,8 @@ export function delJob(jobId) {
// 手动作废作业
export function cancelJob(jobId) {
return request({
url: '/pd/outJob/cancel/' + jobId,
// url: '/pd/outJob/cancel/' + jobId,
url: '/in/job/cancel/' + jobId,
method: 'put'
})
}
@@ -54,7 +55,7 @@ export function cancelJob(jobId) {
// 手动完成作业
export function completeJob(jobId) {
return request({
url: '/pd/outJob/complete/' + jobId,
url: '/in/job/complete/' + jobId,
method: 'put'
})
}

View File

@@ -82,12 +82,22 @@
<el-card shadow="never" class="section-card" style="margin-top:16px;">
<div slot="header" class="card-header">
<span><i class="el-icon-goods"></i> 物料明细</span>
<el-button
type="primary"
size="mini"
icon="el-icon-plus"
:disabled="!mainForm.warehouseId"
@click="openCargoDialog"
v-show="mainForm.pdType==1"
v-hasPermi="['bas:cargospace:list']"
>选择货位</el-button>
<el-button
type="primary"
size="mini"
icon="el-icon-plus"
:disabled="!mainForm.warehouseId"
@click="openStockDialog"
v-show="mainForm.pdType==2 || !mainForm.pdType"
v-hasPermi="['bas:stock:list']"
>选择库存</el-button>
</div>
@@ -244,6 +254,129 @@
</div>
</el-dialog>
<!-- ===== 货位选择弹框 ===== -->
<el-dialog
title="选择盘点货位"
:visible.sync="cargoDialogVisible"
width="900px"
append-to-body
top="6vh"
@open="onCargoDialogOpen"
>
<!-- 搜索栏 -->
<div class="stock-search">
<el-input
v-model="cargoQuery.warehouseId"
placeholder="仓库ID"
size="small"
clearable
style="width:140px;margin-right:8px;"
@keyup.enter.native="searchCargo"
/>
<el-input
v-model="cargoQuery.cargoSpaceId"
placeholder="货位编号"
size="small"
clearable
style="width:160px;margin-right:8px;"
@keyup.enter.native="searchCargo"
/>
<el-input
v-model="cargoQuery.cargoAreaId"
placeholder="货区编号"
size="small"
clearable
style="width:140px;margin-right:8px;"
@keyup.enter.native="searchCargo"
/>
<el-input
v-model="cargoQuery.trayCode"
placeholder="托盘号"
size="small"
clearable
style="width:130px;margin-right:8px;"
@keyup.enter.native="searchCargo"
/>
<el-input
v-model="cargoQuery.status"
placeholder="状态"
size="small"
clearable
style="width:130px;margin-right:8px;"
@keyup.enter.native="searchCargo"
/>
<el-input
v-model="cargoQuery.thePlatoon"
placeholder="排"
size="small"
clearable
style="width:130px;margin-right:8px;"
@keyup.enter.native="searchCargo"
/>
<el-input
v-model="cargoQuery.theColumn"
placeholder="列"
size="small"
clearable
style="width:130px;margin-right:8px;"
@keyup.enter.native="searchCargo"
/>
<el-input
v-model="cargoQuery.theFloor"
placeholder="层"
size="small"
clearable
style="width:130px;margin-right:8px;"
@keyup.enter.native="searchCargo"
/>
<el-button type="primary" size="small" icon="el-icon-search" @click="searchCargo">搜索</el-button>
<el-button size="small" icon="el-icon-refresh" @click="resetCargoSearch">重置</el-button>
</div>
<!-- 库存表格(多选) -->
<el-table
ref="cargoTable"
v-loading="cargoLoading"
:data="cargoList"
size="small"
border
stripe
style="width:100%;margin-top:10px;"
:header-cell-style="{ background:'#f5f7fa', color:'#606266' }"
@selection-change="onCargoSelectionChange"
>
<el-table-column type="selection" width="45" align="center" :selectable="isCargoSelectable" />
<el-table-column label="仓库" prop="warehouseName" align="center" width="120"/>
<el-table-column label="货位" prop="cargoSpaceId" align="center" width="100" />
<el-table-column label="货区" prop="cargoAreaId" align="center" width="120" />
<el-table-column label="托盘号" prop="trayCode" align="center" min-width="130" show-overflow-tooltip />
<el-table-column label="状态" prop="status" align="center" min-width="130" />
<el-table-column label="排" prop="thePlatoon" align="center" width="120" />
<el-table-column label="列" prop="theColumn" align="center" width="120"/>
<el-table-column label="层" prop="theFloor" align="center" width="90" />
</el-table>
<!-- 弹框分页 -->
<pagination
v-show="cargoTotal > 0"
:total="cargoTotal"
:page.sync="cargoQuery.pageNum"
:limit.sync="cargoQuery.pageSize"
@pagination="fetchCargoList"
style="margin-top:4px;"
/>
<div slot="footer" class="dialog-footer">
<span style="float:left;color:#606266;font-size:13px;line-height:32px;">
已选 <strong style="color:#409eff;">{{ selectedCargos.length }}</strong> 条库存记录
</span>
<el-button @click="cargoDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="confirmCargos" :disabled="selectedCargos.length === 0">
确认添加
</el-button>
</div>
</el-dialog>
</div>
</template>
@@ -251,6 +384,7 @@
import { saveWithDetails } from '@/api/pd/stockpd'
import { listWarehouse } from '@/api/bas/warehouse'
import { listStock } from '@/api/bas/stock'
import { listCargospace } from '@/api/bas/cargospace'
export default {
name: 'CreateStockpd',
@@ -293,7 +427,26 @@ export default {
productName: null,
lotNo: null
},
selectedStocks: []
selectedStocks: [],
// ---------- 货位弹框 ----------
cargoDialogVisible: false,
cargoLoading: false,
cargoList: [],
cargoTotal: 0,
cargoQuery: {
pageNum: 1,
pageSize: 8,
warehouseId: null,
cargoSpaceId: null,
cargoAreaId: null,
trayCode: null,
thePlatoon: null,
theColumn: null,
theFloor: null,
},
selectedCargos: []
}
},
@@ -391,6 +544,68 @@ export default {
this.stockDialogVisible = false
},
// ===== 货位弹框 =====
openCargoDialog() {
this.cargoDialogVisible = true
},
onCargoDialogOpen() {
this.resetCargoSearch()
this.cargoQuery.warehouseId = this.mainForm.warehouseId
this.fetchCargoList()
},
searchCargo() {
this.cargoQuery.pageNum = 1
this.fetchCargoList()
},
resetCargoSearch() {
this.cargoQuery.cargoSpaceId = null
this.cargoQuery.trayCode = null
this.cargoQuery.status = null
this.cargoQuery.pageNum = 1
},
fetchCargoList() {
this.cargoLoading = true
listCargospace(this.cargoQuery).then(res => {
this.cargoList = res.rows || []
this.cargoTotal = res.total || 0
this.cargoLoading = false
// 回显已选中行
this.$nextTick(() => {
if (this.$refs.cargoTable) {
this.cargoList.forEach(row => {
const already = this.detailLines.some(l => l.cargoSpaceId === row.cargoSpaceId)
if (already) {
this.$refs.cargoTable.toggleRowSelection(row, true)
}
})
}
})
}).catch(() => { this.cargoLoading = false })
},
onCargoSelectionChange(selection) {
this.selectedCargos = selection
},
// 已在明细行中的库存记录置为不可重复勾选
isCargoSelectable(row) {
return !this.detailLines.some(l => l.cargoSpaceId === row.cargoSpaceId)
},
confirmCargos() {
this.selectedCargos.forEach(s => {
if (!this.detailLines.some(l => l.cargoSpaceId === s.cargoSpaceId)) {
this.detailLines.push({
cargoSpaceId: s.cargoSpaceId || '',
trayCode: s.trayCode || '',
thePlatoon: s.thePlatoon,
theColumn: s.theColumn,
theFloor: s.theFloor,
status: s.status,
theType: s.theType,
})
}
})
this.cargoDialogVisible = false
},
// ===== 明细行操作 =====
removeLine(index) {
this.detailLines.splice(index, 1)
@@ -408,7 +623,7 @@ export default {
}
// 3. 数量校验
const invalidLine = this.detailLines.find(l => !l.pdQuantity || l.pdQuantity <= 0)
if (invalidLine) {
if (invalidLine && mainForm.pdType==2) {
this.$modal.msgWarning(`物料【${invalidLine.productName}】的盘点数量必须大于 0`)
return
}