opt:1.入库接口推送需增加料框明细表,入库单据根据载具号自动合成一个单据;2.手持组盘按明细组盘,入库显示料框明细;
This commit is contained in:
170
nladmin-ui/src/views/wms/basedata/group/ViewDialog.vue
Normal file
170
nladmin-ui/src/views/wms/basedata/group/ViewDialog.vue
Normal file
@@ -0,0 +1,170 @@
|
||||
<!--suppress ALL -->
|
||||
<template>
|
||||
<el-dialog
|
||||
append-to-body
|
||||
title="组盘详情"
|
||||
:visible.sync="dialogVisible"
|
||||
fullscreen
|
||||
@close="close"
|
||||
@open="open"
|
||||
>
|
||||
<el-form
|
||||
ref="form"
|
||||
style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;"
|
||||
:inline="true"
|
||||
:model="form"
|
||||
size="mini"
|
||||
label-width="100px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="载具编码" prop="storagevehicle_code">
|
||||
<el-input v-model="form.storagevehicle_code" disabled placeholder="系统生成" style="width: 210px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料编码" prop="material_code">
|
||||
<el-input v-model="form.material_code" disabled style="width: 210px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料名称" prop="material_name">
|
||||
<el-input v-model="form.material_name" disabled style="width: 210px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="批次" prop="pcsn">
|
||||
<el-input v-model="form.pcsn" disabled style="width: 210px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-input v-model="dict.label.GROUP_STATUS[form.status]" disabled style="width: 210px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="组盘数量" prop="qty">
|
||||
<el-input v-model="form.qty" disabled clearable style="width: 210px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" disabled clearable style="width: 210px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="组盘人" prop="create_name">
|
||||
<el-input v-model="form.create_name" disabled clearable style="width: 210px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="组盘时间" prop="create_time">
|
||||
<el-input v-model="form.create_time" disabled clearable style="width: 210px" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="crud-opts2">
|
||||
<span class="role-span2">单据明细</span>
|
||||
</div>
|
||||
<el-card class="box-card" shadow="never" :body-style="{padding:'0'}">
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="tableDtl"
|
||||
style="width: 100%;"
|
||||
max-height="300"
|
||||
size="mini"
|
||||
border
|
||||
:highlight-current-row="true"
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
>
|
||||
<el-table-column prop="mater_frame" label="料框号" min-width="140" />
|
||||
<el-table-column prop="qty" label="料框数量" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { crud } from '@crud/crud'
|
||||
import crudFormData from './group'
|
||||
|
||||
export default {
|
||||
name: 'ViewDialog',
|
||||
mixins: [crud()],
|
||||
dicts: ['base_data', 'ST_INV_IN_TYPE', 'io_bill_status', 'IS_OR_NOT', 'GROUP_STATUS'],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
rowmst: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
tableDtl: [],
|
||||
form: {},
|
||||
formStatus: [
|
||||
{
|
||||
value: '10',
|
||||
label: '生成'
|
||||
},
|
||||
{
|
||||
value: '20',
|
||||
label: '执行中'
|
||||
},
|
||||
{
|
||||
value: '99',
|
||||
label: '完成'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
},
|
||||
rowmst: {
|
||||
handler(newValue) {
|
||||
this.form = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
|
||||
},
|
||||
setForm(row) {
|
||||
this.dialogVisible = true
|
||||
this.form = row
|
||||
this.queryTableDtl(row.group_id)
|
||||
},
|
||||
close() {
|
||||
this.dialogVisible = false
|
||||
},
|
||||
status_Format(row, column) {
|
||||
return this.dict.label.io_bill_status[row.status]
|
||||
},
|
||||
merge_Format(row, column) {
|
||||
return this.dict.label.IS_OR_NOT[row.is_merge]
|
||||
},
|
||||
queryTableDtl(group_id) {
|
||||
crudFormData.getdtl(group_id).then(res => {
|
||||
this.tableDtl = res
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.crud-opts2 {
|
||||
padding: 0;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.crud-opts2 .el-dialog__title2 {
|
||||
line-height: 24px;
|
||||
font-size: 20px;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.crud-opts2 .role-span2 {
|
||||
padding: 0px 0px 20px 0px;
|
||||
}
|
||||
|
||||
.crud-opts2 {
|
||||
padding: 10px 0px 0px 50px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -24,4 +24,11 @@ export function edit(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del }
|
||||
export function getdtl(id) {
|
||||
return request({
|
||||
url: 'api/group/getdtl/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getdtl }
|
||||
|
||||
@@ -2,62 +2,62 @@
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<el-row>
|
||||
<el-col :span="4">
|
||||
物料查询:
|
||||
<el-input
|
||||
v-model="query.material_code"
|
||||
clearable
|
||||
style="width: 150px"
|
||||
size="mini"
|
||||
placeholder="物料编码、名称"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
<el-row>
|
||||
<el-col :span="4">
|
||||
物料查询:
|
||||
<el-input
|
||||
v-model="query.material_code"
|
||||
clearable
|
||||
style="width: 150px"
|
||||
size="mini"
|
||||
placeholder="物料编码、名称"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
批次查询:
|
||||
<el-input
|
||||
v-model="query.pcsn"
|
||||
clearable
|
||||
style="width: 150px"
|
||||
size="mini"
|
||||
placeholder="批次"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
载具编码:
|
||||
<el-input
|
||||
v-model="query.storagevehicle_code"
|
||||
clearable
|
||||
style="width: 150px"
|
||||
size="mini"
|
||||
placeholder="载具编码"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
组盘状态:
|
||||
<el-select
|
||||
v-model="query.status"
|
||||
clearable
|
||||
style="width: 150px"
|
||||
size="mini"
|
||||
placeholder="状态"
|
||||
class="filter-item"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.GROUP_STATUS"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
批次查询:
|
||||
<el-input
|
||||
v-model="query.pcsn"
|
||||
clearable
|
||||
style="width: 150px"
|
||||
size="mini"
|
||||
placeholder="批次"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
载具编码:
|
||||
<el-input
|
||||
v-model="query.storagevehicle_code"
|
||||
clearable
|
||||
style="width: 150px"
|
||||
size="mini"
|
||||
placeholder="载具编码"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
组盘状态:
|
||||
<el-select
|
||||
v-model="query.status"
|
||||
clearable
|
||||
style="width: 150px"
|
||||
size="mini"
|
||||
placeholder="状态"
|
||||
class="filter-item"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.GROUP_STATUS"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<rrOperation />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<rrOperation />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<!--新增表格-->
|
||||
@@ -71,19 +71,19 @@
|
||||
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="110px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="物料编码" prop="material_code" >
|
||||
<el-input v-model="form.material_code" @focus="getMaterial" style="width: 200px;" :disabled="crud.status.edit > 0" />
|
||||
<el-form-item label="物料编码" prop="material_code">
|
||||
<el-input v-model="form.material_code" style="width: 200px;" :disabled="crud.status.edit > 0" @focus="getMaterial" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="物料名称" prop="material_name">
|
||||
<el-input disabled v-model="form.material_name" style="width: 200px;" />
|
||||
<el-form-item label="物料名称" prop="material_name">
|
||||
<el-input v-model="form.material_name" disabled style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="规格" prop="material_spec">
|
||||
<el-form-item label="规格" prop="material_spec">
|
||||
<label slot="label">规 格</label>
|
||||
<el-input disabled v-model="form.material_spec" style="width: 200px;" />
|
||||
<el-input v-model="form.material_spec" disabled style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -101,7 +101,7 @@
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="物料数量" prop="qty">
|
||||
<el-input-number v-model="form.qty" style="width: 200px;" />
|
||||
<el-input v-model="form.qty" disabled style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -134,11 +134,41 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-button type="primary" @click="insertEvent">添加料框</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-if="form.dtlList && form.dtlList.length" style="margin-top: 10px;">
|
||||
<el-col :span="8"><div class="dtl-header-center"><strong>料框号</strong></div></el-col>
|
||||
<el-col :span="8"><div class="dtl-header-center"><strong>数量</strong></div></el-col>
|
||||
<el-col :span="8"><div style="padding-left: 220px;"><strong>操作</strong></div></el-col>
|
||||
</el-row>
|
||||
<div v-for="(item, index) in form.dtlList" :key="index" style="margin-top: 6px;">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label=" " label-width="110px">
|
||||
<el-input v-model="item.mater_frame" size="mini" placeholder="请输入料框号" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label=" " label-width="110px">
|
||||
<el-input-number v-model="item.qty" size="mini" :min="0" :step="1" :precision="3" controls-position="right" style="width: 200px;" @change="onQtyChange" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label=" " label-width="110px" class="op-field">
|
||||
<el-button type="danger" size="mini" icon="el-icon-delete" @click="removeDtl(index)">删除</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
@@ -149,7 +179,14 @@
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column prop="storagevehicle_code" label="载具编码" :min-width="flexWidth('storagevehicle_code',crud.data,'载具编码')" />
|
||||
<el-table-column prop="storagevehicle_code" label="载具编码" :min-width="flexWidth('storagevehicle_code',crud.data,'载具编码')">
|
||||
<template slot-scope="scope">
|
||||
<el-link type="warning" @click="toView(scope.row)">{{
|
||||
scope.row.storagevehicle_code
|
||||
}}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="material_code" label="物料编码" :min-width="flexWidth('material_code',crud.data,'物料编码')" />
|
||||
<el-table-column prop="material_name" label="物料名称" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
|
||||
<el-table-column prop="pcsn" label="批次" :min-width="flexWidth('pcsn',crud.data,'批次')" />
|
||||
@@ -179,6 +216,7 @@
|
||||
</div>
|
||||
<!--放引用的组件-->
|
||||
<MaterialDialog :dialog-show.sync="materialDialog" @materialChoose="materialChoose" />
|
||||
<ViewDialog ref="viewDialog" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -190,6 +228,7 @@ import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import MaterialDialog from '@/views/wms/basedata/material/MaterialDialog'
|
||||
import ViewDialog from '@/views/wms/basedata/group/ViewDialog.vue'
|
||||
|
||||
const defaultForm = {
|
||||
group_id: null,
|
||||
@@ -207,11 +246,12 @@ const defaultForm = {
|
||||
create_name: null,
|
||||
create_time: null,
|
||||
ext_code: null,
|
||||
ext_type: null
|
||||
ext_type: null,
|
||||
dtlList: []
|
||||
}
|
||||
export default {
|
||||
name: 'Group',
|
||||
components: { pagination, MaterialDialog, crudOperation, rrOperation, udOperation },
|
||||
components: { ViewDialog, pagination, MaterialDialog, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
tableEnums: ['md_pb_measureunit#unit_name#measure_unit_id'],
|
||||
// 数据字典
|
||||
@@ -233,6 +273,8 @@ export default {
|
||||
return {
|
||||
permission: {},
|
||||
materialDialog: false,
|
||||
dtlShow: false,
|
||||
opendtlParam: null,
|
||||
classes: [],
|
||||
rules: {
|
||||
}
|
||||
@@ -243,6 +285,42 @@ export default {
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
// 提交前清洗 dtlList,仅保留填写完整的行
|
||||
[CRUD.HOOK.beforeSubmit]() {
|
||||
if (this.form && Array.isArray(this.form.dtlList)) {
|
||||
const cleanList = this.form.dtlList
|
||||
.filter(item => item && item.mater_frame && item.mater_frame.toString().trim() !== '' && Number(item.qty) >= 0)
|
||||
.map(item => ({
|
||||
mater_frame: item.mater_frame.toString().trim(),
|
||||
qty: item.qty
|
||||
}))
|
||||
// 检查料框号重复
|
||||
const seen = new Set()
|
||||
const dups = []
|
||||
cleanList.forEach(it => {
|
||||
const key = it.mater_frame
|
||||
if (seen.has(key)) {
|
||||
dups.push(key)
|
||||
} else {
|
||||
seen.add(key)
|
||||
}
|
||||
})
|
||||
if (dups.length > 0) {
|
||||
const uniq = Array.from(new Set(dups))
|
||||
this.$message.error(`存在重复的料框号:${uniq.join(', ')}`)
|
||||
return false
|
||||
}
|
||||
// 数量为0禁止提交
|
||||
const zeroQty = cleanList.filter(it => Number(it.qty) === 0)
|
||||
if (zeroQty.length > 0) {
|
||||
this.$message.error('存在数量为0的料框,不能提交')
|
||||
return false
|
||||
}
|
||||
this.form.dtlList = cleanList
|
||||
this.recalcTotalQty()
|
||||
}
|
||||
return true
|
||||
},
|
||||
formattStatus(row) {
|
||||
return this.dict.label.GROUP_STATUS[row.status]
|
||||
},
|
||||
@@ -259,6 +337,39 @@ export default {
|
||||
this.form.material_id = row.material_id
|
||||
this.form.material_code = row.material_code
|
||||
this.form.material_spec = row.material_spec
|
||||
},
|
||||
async insertEvent(row) {
|
||||
if (!this.form.dtlList) {
|
||||
this.$set(this.form, 'dtlList', [])
|
||||
}
|
||||
this.form.dtlList.push({ mater_frame: null, qty: null })
|
||||
this.recalcTotalQty()
|
||||
},
|
||||
removeDtl(index) {
|
||||
if (this.form && Array.isArray(this.form.dtlList)) {
|
||||
this.form.dtlList.splice(index, 1)
|
||||
}
|
||||
this.recalcTotalQty()
|
||||
},
|
||||
onQtyChange() {
|
||||
this.recalcTotalQty()
|
||||
},
|
||||
recalcTotalQty() {
|
||||
if (!this.form || !Array.isArray(this.form.dtlList)) {
|
||||
this.form.qty = null
|
||||
return
|
||||
}
|
||||
const sum = this.form.dtlList.reduce((acc, cur) => {
|
||||
const val = Number(cur && cur.qty)
|
||||
if (!isNaN(val) && val >= 0) return acc + val
|
||||
return acc
|
||||
}, 0)
|
||||
this.form.qty = Number(sum.toFixed(3))
|
||||
},
|
||||
toView(row) {
|
||||
if (row !== null) {
|
||||
this.$refs.viewDialog.setForm(row)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -266,4 +377,23 @@ export default {
|
||||
|
||||
<style scoped>
|
||||
|
||||
.centered-field >>> .el-form-item__content {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.centered-field >>> .el-input__inner,
|
||||
.centered-field >>> .el-input-number .el-input__inner {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.dtl-header-center {
|
||||
padding-left: 110px;
|
||||
width: 300px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.op-field >>> .el-form-item__content {
|
||||
padding-left: 90px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user