add:新增成品入库功能
This commit is contained in:
205
mes/qd/src/views/wms/pub/StructDialog.vue
Normal file
205
mes/qd/src/views/wms/pub/StructDialog.vue
Normal file
@@ -0,0 +1,205 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="货位选择"
|
||||
append-to-body
|
||||
:visible.sync="dialogVisible"
|
||||
destroy-on-close
|
||||
width="1000px"
|
||||
@close="close"
|
||||
@open="open"
|
||||
>
|
||||
<!-- 搜索 -->
|
||||
<el-row>
|
||||
<el-col :span="6">
|
||||
<el-cascader
|
||||
v-model="query.sect"
|
||||
placeholder="所属库区"
|
||||
:options="sects"
|
||||
:props="{ checkStrictly: true }"
|
||||
clearable
|
||||
@change="sectQueryChange"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-input
|
||||
v-model="query.point_code"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
size="mini"
|
||||
placeholder="输入点位编码、名称"
|
||||
prefix-icon="el-icon-search"
|
||||
class="filter-item"
|
||||
/> </el-col>
|
||||
|
||||
<el-col :span="6">
|
||||
<rrOperation />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
style="width: 100%;"
|
||||
border
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
@select="handleSelectionChange"
|
||||
@select-all="onSelectAll"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="point_code" label="点位编码" />
|
||||
<el-table-column prop="point_name" label="点位名称" />
|
||||
<el-table-column prop="region_name" label="区域名称" />
|
||||
<el-table-column prop="product_area" label="生产区域" />
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import CRUD, { header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import crudRegion from '@/api/wms/sch/region'
|
||||
|
||||
export default {
|
||||
name: 'StructDialog',
|
||||
components: { rrOperation, pagination },
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '点位',
|
||||
optShow: {},
|
||||
url: 'api/region/getPointQuery',
|
||||
idField: 'region_code',
|
||||
sort: 'region_code,desc',
|
||||
query: { search: '', is_lock: '1', lock_type: '', sect_id: '', stor_id: '' },
|
||||
crudMethod: { ...crudRegion }
|
||||
})
|
||||
},
|
||||
mixins: [presenter(), header()],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
sectProp: {
|
||||
type: Object
|
||||
},
|
||||
storId: {
|
||||
type: String,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
sects: [],
|
||||
classes: [],
|
||||
dialogVisible: false,
|
||||
sect: {},
|
||||
checkrow: {},
|
||||
rows: [],
|
||||
dialogDis: true,
|
||||
lock: ''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue, oldValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
},
|
||||
sectProp: {
|
||||
handler(newValue, oldValue) {
|
||||
debugger
|
||||
this.sect = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 接受父组件传值
|
||||
* @param msg
|
||||
*/
|
||||
getMsg(msg) {
|
||||
this.dialogDis = msg
|
||||
this.lock = '1'
|
||||
},
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
this.query.lock_type = this.lock
|
||||
return true
|
||||
},
|
||||
open() {
|
||||
crudRegion.getRegionSelect({ 'stor_id': this.storId }).then(res => {
|
||||
this.sects = res.content
|
||||
})
|
||||
if (this.sect) {
|
||||
this.query.sect = this.sect
|
||||
if (this.sect.length === 1) {
|
||||
this.query.stor_id = this.sect[0]
|
||||
this.query.stor_id = this.storId
|
||||
}
|
||||
if (this.sect.length === 0) {
|
||||
this.query.sect_id = ''
|
||||
this.query.stor_id = ''
|
||||
}
|
||||
if (this.sect.length === 2) {
|
||||
this.query.stor_id = this.sect[0]
|
||||
this.query.sect_id = this.sect[1]
|
||||
}
|
||||
}
|
||||
this.query.is_lock = '1'
|
||||
this.query.lock_type = this.lock
|
||||
this.query.is_used = '1'
|
||||
debugger
|
||||
this.query.stor_id = this.storId
|
||||
this.crud.toQuery()
|
||||
},
|
||||
handleSelectionChange(val, row) {
|
||||
if (val.length > 1) {
|
||||
this.$refs.table.clearSelection()
|
||||
this.$refs.table.toggleRowSelection(val.pop())
|
||||
} else {
|
||||
this.checkrow = row
|
||||
}
|
||||
},
|
||||
sectQueryChange(val) {
|
||||
if (val.length === 1) {
|
||||
this.crud.query.stor_id = val[0]
|
||||
this.crud.query.sect_id = ''
|
||||
}
|
||||
if (val.length === 0) {
|
||||
this.crud.query.sect_id = ''
|
||||
this.crud.query.stor_id = ''
|
||||
}
|
||||
if (val.length === 2) {
|
||||
this.crud.query.stor_id = val[0]
|
||||
this.crud.query.sect_id = val[1]
|
||||
}
|
||||
},
|
||||
onSelectAll() {
|
||||
this.$refs.table.clearSelection()
|
||||
},
|
||||
close() {
|
||||
this.crud.resetQuery()
|
||||
this.query.sect = null
|
||||
this.$emit('update:dialogShow', false)
|
||||
},
|
||||
submit() {
|
||||
this.rows = this.$refs.table.selection
|
||||
if (this.rows.length <= 0) {
|
||||
this.$message('请先勾选仓位')
|
||||
return
|
||||
}
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('tableChanged', this.checkrow)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
<span class="crud-opts-right2">
|
||||
<!--左侧插槽-->
|
||||
<slot name="left"/>
|
||||
<!-- <el-button
|
||||
<el-button
|
||||
slot="left"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
@@ -109,7 +109,7 @@
|
||||
@click="confirmvehicle()"
|
||||
>
|
||||
组盘确认
|
||||
</el-button>-->
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="left"
|
||||
:loading="divBtn"
|
||||
@@ -152,6 +152,7 @@
|
||||
max-height="300"
|
||||
border
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
@row-click="clcikRowDis"
|
||||
>
|
||||
<el-table-column show-overflow-tooltip type="index" label="序号" align="center" />
|
||||
<el-table-column show-overflow-tooltip prop="material_code" label="物料编码" align="center" />
|
||||
@@ -175,22 +176,20 @@
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<!-- <StructDiv ref="child" :stor-id="storId" :dialog-show.sync="structShow" :sect-prop="sectProp"-->
|
||||
<!-- @tableChanged="tableChanged"/>-->
|
||||
|
||||
<StructDiv ref="child" :stor-id="storId" :dialog-show.sync="structShow" :sect-prop="sectProp" @tableChanged="tableChanged"/>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CRUD, { crud } from '@crud/crud'
|
||||
// import StructDiv from '@/views/wms/pub/StructDialog'
|
||||
import StructDiv from '@/views/wms/pub/StructDialog'
|
||||
import crudProductIn from '@/views/wms/st/productIn/productin'
|
||||
import crudPoint from '@/api/wms/sch/point'
|
||||
import crudRegion from '@/api/wms/sch/region'
|
||||
|
||||
export default {
|
||||
name: 'DivDialog',
|
||||
components: { },
|
||||
components: { StructDiv },
|
||||
mixins: [crud()],
|
||||
dicts: ['IO_BILL_STATUS'],
|
||||
props: {
|
||||
@@ -229,12 +228,13 @@ export default {
|
||||
bucketShow: false,
|
||||
sects: [],
|
||||
sect_val: null,
|
||||
dis_row: null,
|
||||
form: {
|
||||
dtl_row: null,
|
||||
bucketunique: '',
|
||||
storage_qty: '',
|
||||
sect_id: '',
|
||||
stor_id: '',
|
||||
point_code: null,
|
||||
storagevehicle_code: '',
|
||||
checked: true,
|
||||
tableMater: []
|
||||
},
|
||||
@@ -282,6 +282,9 @@ export default {
|
||||
this.form.tableMater = res
|
||||
})
|
||||
},
|
||||
clcikRowDis(row, column, event) {
|
||||
this.dis_row = row
|
||||
},
|
||||
vehicleCheck() {
|
||||
if (!this.form.dtl_row) {
|
||||
this.crud.notify('请选择一条入库明细', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
@@ -349,22 +352,15 @@ export default {
|
||||
}
|
||||
},
|
||||
confirmvehicle() {
|
||||
if (this.form.tableMater.length <= 0) {
|
||||
this.crud.notify('至少添加一条载具明细', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
if (this.dis_row === null) {
|
||||
this.crud.notify('请先选择一条分配明细!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
const carrier_no = this.form.tableMater[0].storagevehicle_code
|
||||
const flag = this.form.tableMater.every(mater => mater.storagevehicle_code === carrier_no)
|
||||
if (!flag) {
|
||||
this.crud.notify('请选择唯一载具进行组盘!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
if (this.dis_row.storagevehicle_code === '') {
|
||||
this.crud.notify('载具号不能为空', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
const flag2 = this.form.tableMater.some(mater => mater.point_code !== this.form.point_code && mater.point_code)
|
||||
if (flag2) {
|
||||
this.crud.notify('请选择相同入库点!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
crudProductIn.confirmvehicle(this.form).then(res => {
|
||||
crudProductIn.confirmvehicle(this.dis_row).then(res => {
|
||||
crudProductIn.getIODtl({ 'bill_code': this.form.dtl_row.bill_code }).then(res => {
|
||||
this.openParam = res
|
||||
})
|
||||
@@ -411,14 +407,15 @@ export default {
|
||||
}
|
||||
},
|
||||
tableChanged(row) {
|
||||
this.form.sect_id = this.sect_id
|
||||
this.form.stor_id = this.stor_id
|
||||
// 新增一行物料时,给行进行赋值
|
||||
for (let i = 0; i < this.form.tableMater.length; i++) {
|
||||
this.form.tableMater[i].struct_code = row.struct_code
|
||||
this.form.tableMater[i].sect_id = row.sect_id
|
||||
this.form.tableMater[i].struct_id = row.struct_id
|
||||
this.form.tableMater[i].struct_name = row.struct_name
|
||||
this.form.tableMater[i].sect_code = row.sect_code
|
||||
this.form.tableMater[i].sect_name = row.sect_name
|
||||
this.form.tableMater[i].struct_id = row.point_id
|
||||
this.form.tableMater[i].struct_code = row.point_code
|
||||
this.form.tableMater[i].struct_name = row.point_name
|
||||
this.form.tableMater[i].region_code = row.region_code
|
||||
this.form.tableMater[i].region_name = row.region_name
|
||||
this.form.tableMater.splice(i, 1, this.form.tableMater[i]) // 通过splice 替换数据 触发视图更新
|
||||
}
|
||||
crudProductIn.divStruct(this.form).then(res => {
|
||||
@@ -429,7 +426,6 @@ export default {
|
||||
})
|
||||
},
|
||||
bucketChange(row) {
|
||||
debugger
|
||||
this.bucketObj = row
|
||||
this.form.bucketunique = row.bucketunique
|
||||
this.form.storage_qty = row.storage_qty
|
||||
@@ -455,8 +451,8 @@ export default {
|
||||
})
|
||||
},
|
||||
divStruct() {
|
||||
if (this.form.tableMater.length === 0) {
|
||||
this.crud.notify('请先选择一条明细!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
if (this.dis_row === null) {
|
||||
this.crud.notify('请先选择一条分配明细!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
// 如果勾选了,直接跳后台
|
||||
|
||||
Reference in New Issue
Block a user