代码修改

This commit is contained in:
2022-06-28 18:30:56 +08:00
parent 4b908ac5da
commit 4f2bcc8cec
10 changed files with 333 additions and 94 deletions

View File

@@ -56,10 +56,8 @@
<el-table-column show-overflow-tooltip prop="material_spec" label="规格" align="center"/>
<el-table-column show-overflow-tooltip prop="material_model" label="型号" align="center"/>
<el-table-column show-overflow-tooltip prop="plan_qty" :formatter="crud.formatNum3" label="数量" align="center"/>
<el-table-column show-overflow-tooltip prop="assign_qty" :formatter="crud.formatNum3" label="已出数量"
align="center"/>
<el-table-column show-overflow-tooltip prop="unassign_qty" :formatter="crud.formatNum3" label="未出数量"
align="center"/>
<el-table-column show-overflow-tooltip prop="assign_qty" :formatter="crud.formatNum3" label="已出数量" align="center"/>
<el-table-column show-overflow-tooltip prop="unassign_qty" :formatter="crud.formatNum3" label="未出数量" align="center"/>
<el-table-column show-overflow-tooltip prop="qty_unit_name" label="单位" align="center"/>
</el-table>
</el-card>
@@ -86,7 +84,7 @@
type="warning"
icon="el-icon-check"
size="mini"
@click="createCode()"
@click="openStructIvt()"
>
手动分配
</el-button>
@@ -100,16 +98,6 @@
>
删除分配
</el-button>
<el-button
slot="left"
class="filter-item"
type="primary"
icon="el-icon-plus"
size="mini"
@click="divStruct()"
>
确认
</el-button>
</span>
</div>
<el-card class="box-card" shadow="never" :body-style="{padding:'0'}">
@@ -134,19 +122,19 @@
</el-table>
</el-card>
<StructDiv ref="child" :dialog-show.sync="structShow" :sect-prop="sectProp" @tableChanged="tableChanged"/>
<StructIvt :dialog-show.sync="structShow" :open-array="ivtParam" :rowmst="openRow" @StructIvtClosed="queryTableDtl"/>
</el-dialog>
</template>
<script>
import CRUD, { crud } from '@crud/crud'
import crudSectattr from '@/api/wms/basedata/st/sectattr'
import StructDiv from '@/views/wms/sb/inbill/StructDialog'
import sparePart from '@/api/wms/sb/sparepart'
import StructIvt from '@/views/wms/sb/outbill/StructIvt'
import sparePart from '@/api/wms/sb/sparepartout'
export default {
name: 'DivDialog',
components: { StructDiv },
components: { StructIvt },
mixins: [crud()],
dicts: ['io_bill_status'],
props: {
@@ -173,11 +161,13 @@ export default {
dialogVisible: false,
stor_id: '',
sect_id: '',
ivtParam: [],
sectProp: null,
structShow: false,
bucketObj: null,
sects: [],
sect_val: null,
openRow: {},
form: {
dtl_row: null,
tableMater: []
@@ -198,25 +188,18 @@ export default {
crudSectattr.getSect({ 'is_attachment': '1', 'sect_type_attr': '00' }).then(res => {
this.sects = res.content
})
/*let area_type = ''
if (this.billType === '000101' || this.billType === '000102' || this.billType === '000201' || this.billType === '000202' || this.billType === '000305') {
area_type = '\'21\''
},
openStructIvt() {
if (!this.form.dtl_row) {
this.crud.notify('请选择一条出库明细', CRUD.NOTIFICATION_TYPE.INFO)
return
}
if (this.billType === '000301' || this.billType === '000303' || this.billType === '000304') {
area_type = '\'37\''
}
if (this.billType === '000302') {
area_type = '\'26\',\'32\',\'33\',\'34\''
}
if (this.billType === '000601') {
area_type = '\'29\''
}
if (this.billType === '000401') {
area_type = '\'21\',\'26\',\'29\',\'31\',\'35\',\'32\',\'33\',\'34\''
}
crudPoint.getPoint({ 'area_type': area_type }).then(res => {
this.pointlist = res
})*/
debugger
sparePart.getStructIvt(this.form.dtl_row).then(res => {
this.ivtParam = res
this.structShow = true
this.openRow = this.form.dtl_row
})
},
toDelete(data) {
data.pop = true
@@ -231,6 +214,7 @@ export default {
this.$refs['form2'].resetFields()
},
clcikRow(row, column, event) {
debugger
this.form.dtl_row = row
sparePart.getIODtl({ 'bill_code': this.form.dtl_row.bill_code }).then(res => {
this.openParam = res
@@ -291,6 +275,11 @@ export default {
})
})
},
queryTableDtl() {
sparePart.getIODtl({ 'bill_code': this.form.dtl_row.bill_code }).then(res => {
this.openParam = res
})
},
disConfirm() {
debugger
let rows = this.$refs.dis_table.selection
@@ -343,20 +332,6 @@ export default {
this.bucketObj = row
this.form.bucketunique = row.bucketunique
this.form.storage_qty = row.storage_qty
},
divStruct() {
debugger
let rows = this.$refs.dis_table.selection
if (rows.length == 0) {
this.crud.notify('请至少勾选一条记录!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
if (!this.sect_id || !this.stor_id) {
this.crud.notify('请先选择备件库区!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
this.structShow = true
this.$refs.child.getMsg(false)
}
}
}

View File

@@ -0,0 +1,241 @@
<template>
<el-dialog
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
:show-close="false"
fullscreen
@close="close"
@open="open"
>
<span slot="title" class="dialog-footer">
<div class="crud-opts2">
<span class="el-dialog__title2">出库手工分配</span>
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<el-button slot="left" type="info" @click="dialogVisible = false">关闭</el-button>
<el-button slot="left" type="primary" @click="submit">保存</el-button>
</span>
</div>
</span>
<div class="crud-opts2">
<span class="role-span">可分配库存</span>
<div class="crud-opts-form">
<el-form ref="form2" :inline="true" :model="queryrow" size="mini">
<el-form-item label="备品备件" prop="material_name">
<el-input
v-model="queryrow.material_name"
disabled
/>
</el-form-item>
<el-form-item label="待分配" prop="unassign_qty">
<el-input-number
v-model="queryrow.unassign_qty"
:controls="false"
:precision="3"
:min="0"
disabled
/>
</el-form-item>
<el-form-item label="已分配" prop="assign_qty">
<el-input-number
v-model="queryrow.assign_qty"
:controls="false"
:precision="3"
:min="0"
disabled
/>
</el-form-item>
<el-form-item label="库区" prop="sect_id">
<el-cascader
placeholder="请选择"
:options="sects"
:props="{ checkStrictly: true }"
clearable
@change="sectQueryChange"
/>
</el-form-item>
<el-form-item label="关键字" prop="remark">
<el-input
v-model="queryrow.remark"
clearable
style="width: 220px"
size="mini"
placeholder="货位编码、名称或载具号"
prefix-icon="el-icon-search"
class="filter-item"
/>
</el-form-item>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="queryStruct">搜索</el-button>
</el-form>
</div>
</div>
<!--表格渲染-->
<el-table
ref="table"
:data="tableDtl"
style="width: 100%;"
max-height="400"
border
:highlight-current-row="true"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="selection" width="55" />
<el-table-column show-overflow-tooltip prop="sect_name" label="库区" align="center" />
<el-table-column show-overflow-tooltip prop="struct_name" label="仓位" align="center" />
<el-table-column show-overflow-tooltip prop="sparepart_only_id" label="唯一标识" align="center" />
<el-table-column show-overflow-tooltip prop="material_name" label="物料编码" align="center" />
<el-table-column show-overflow-tooltip prop="material_code" label="物料名称" align="center" />
<el-table-column show-overflow-tooltip prop="pcsn" label="批次号" align="center" />
<el-table-column show-overflow-tooltip prop="ivt_qty" label="库存数量" align="center" />
<el-table-column show-overflow-tooltip prop="qty_unit_name" label="单位" align="center" />
<el-table-column show-overflow-tooltip prop="instorage_time" label="入库时间" align="center" />
</el-table>
</el-dialog>
</template>
<script>
import CRUD, { header } from '@crud/crud'
import crudSectattr from '@/api/wms/basedata/st/sectattr'
import checkoutbill from '@/api/wms/st/core/outbill/checkoutbill'
export default {
name: 'StructIvt',
components: { },
mixins: [header()],
props: {
dialogShow: {
type: Boolean,
default: false
},
rowmst: {
type: Object
},
openArray: {
type: Array,
default: () => { return [] }
}
},
data() {
return {
dialogVisible: false,
dialogVisible2: false,
queryrow: {},
sects: [],
tableDtl: []
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
},
openArray: {
handler(newValue, oldValue) {
this.tableDtl = newValue
}
},
rowmst: {
handler(newValue, oldValue) {
this.queryrow = newValue
}
}
},
methods: {
open() {
crudSectattr.getSect({ is_materialstore: '1' }).then(res => {
this.sects = res.content
})
},
queryStruct() {
this.queryrow.unassign_qty = parseFloat(this.queryrow.unassign_qty) + parseFloat(this.queryrow.assign_qty)
this.queryrow.assign_qty = 0
checkoutbill.getStructIvt(this.queryrow).then(res => {
this.tableDtl = res
})
},
sectQueryChange(val) {
if (val.length === 1) {
this.queryrow.stor_id = val[0]
this.queryrow.sect_id = ''
}
if (val.length === 0) {
this.queryrow.sect_id = ''
this.queryrow.stor_id = ''
}
if (val.length === 2) {
this.queryrow.stor_id = val[0]
this.queryrow.sect_id = val[1]
}
},
handleEdit(index, row) {
// 判断是否可以关闭编辑状态
if (!row.edit) {
if (row.plan_qty > this.queryrow.unassign_qty) {
this.crud.notify('出库重量不能超过未分配数', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (row.plan_qty > row.canuse_qty) {
this.crud.notify('出库重量不能超过库存可出重量', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (row.plan_qty === 0) {
this.crud.notify('出库重量为0不能保存', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
}
row.edit = !row.edit
if (row.edit) {
this.queryrow.unassign_qty = parseFloat(this.queryrow.unassign_qty) - row.plan_qty
this.queryrow.assign_qty = parseFloat(this.queryrow.assign_qty) + row.plan_qty
} else {
this.queryrow.unassign_qty = parseFloat(this.queryrow.unassign_qty) + row.plan_qty
this.queryrow.assign_qty = parseFloat(this.queryrow.assign_qty) - row.plan_qty
}
this.tableDtl.splice(index, 1, row) // 通过splice 替换数据 触发视图更新
},
close() {
this.$emit('update:dialogShow', false)
this.$emit('StructIvtClosed')
},
submit() {
if (parseFloat(this.queryrow.assign_qty) === 0) {
this.crud.notify('请分配后再提交', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (parseFloat(this.queryrow.unassign_qty) === 0) {
const rows = []
this.tableDtl.forEach((item) => {
if (item.edit) {
rows.push(item)
}
})
checkoutbill.manualDiv({ 'row': this.queryrow, 'rows': rows }).then(res => {
this.$emit('update:dialogShow', false)
this.$emit('StructIvtClosed')
})
} else {
this.$confirm('未分配重量不为0,是否继续提交?')
.then(_ => {
const rows = []
this.tableDtl.forEach((item) => {
if (item.edit) {
rows.push(item)
}
})
checkoutbill.manualDiv({ 'row': this.queryrow, 'rows': rows }).then(res => {
this.$emit('update:dialogShow', false)
this.$emit('StructIvtClosed')
})
})
.catch(_ => {
})
}
}
}
}
</script>