fix:成品出入库

This commit is contained in:
2023-06-20 17:31:02 +08:00
parent 1c60718e8c
commit f02f3e063e
13 changed files with 251 additions and 96 deletions

View File

@@ -219,6 +219,7 @@
<AddDtl
:dialog-show.sync="dtlShow"
:is-single="false"
@tableChanged="tableChanged2"
/>
@@ -368,30 +369,33 @@ export default {
this.nowrow.qty_unit_name = row.unit_name
this.nowrow.qty_unit_id = row.base_unit_id
},
tableChanged2(row) {
let same_mater = true
this.form.tableData.forEach((item) => {
if (item.base_bill_code === row.sale_code && item.base_bill_table === row.seq_no) {
same_mater = false
tableChanged2(rows) {
rows.forEach((row) => {
debugger
let same_mater = true
this.form.tableData.forEach((item) => {
if (item.base_bill_code === row.sale_code && item.base_bill_table === row.seq_no) {
same_mater = false
}
})
if (same_mater) {
const data = {}
data.material_id = row.material_id
data.material_code = row.material_code
data.material_name = row.material_name
data.material_spec = row.material_spec
data.plan_qty = row.sale_qty
data.qty_unit_name = row.qty_unit_name
data.qty_unit_id = row.qty_unit_id
data.base_billdtl_id = row.sale_id
data.base_bill_type = row.sale_type
data.base_bill_code = row.sale_code
data.base_bill_table = row.seq_no
data.edit = true
this.form.tableData.splice(-1, 0, data)
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(data.plan_qty)
}
})
if (same_mater) {
const data = {}
data.material_id = row.material_id
data.material_code = row.material_code
data.material_name = row.material_name
data.material_spec = row.material_spec
data.plan_qty = row.sale_qty
data.qty_unit_name = row.qty_unit_name
data.qty_unit_id = row.qty_unit_id
data.base_billdtl_id = row.sale_id
data.base_bill_type = row.sale_type
data.base_bill_code = row.sale_code
data.base_bill_table = row.seq_no
data.edit = true
this.form.tableData.splice(-1, 0, data)
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(data.plan_qty)
}
},
insertEvent(row) {
this.dtlShow = true

View File

@@ -61,10 +61,12 @@
v-loading="crud.loading"
:data="crud.data"
style="width: 100%;"
@select="handleSelectionChange"
@selection-change="crud.selectionChangeHandler"
@current-change="clickChange"
>
<el-table-column label="选择" width="55">
<el-table-column v-if="!isSingle" type="selection" width="55" />
<el-table-column v-if="isSingle" label="选择" width="55">
<template slot-scope="scope">
<el-radio v-model="tableRadio" :label="scope.row"><i /></el-radio>
</template>
@@ -127,6 +129,10 @@ export default {
},
opendtlParam: {
type: Object
},
isSingle: {
type: Boolean,
default: true
}
},
data() {
@@ -150,6 +156,7 @@ export default {
return true
},
open() {
this.query.status = '10'
this.crud.toQuery()
},
close() {
@@ -158,10 +165,31 @@ export default {
clickChange(item) {
this.tableRadio = item
},
handleSelectionChange(val, row) {
if (this.isSingle) {
if (val.length > 1) {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(val.pop())
} else {
this.checkrow = row
}
}
},
submit() {
this.$emit('update:dialogShow', false)
// 处理单选
if (this.isSingle && this.tableRadio) {
this.$emit('update:dialogShow', false)
this.$emit('tableChanged', this.tableRadio)
return
}
this.rows = this.$refs.multipleTable.selection
this.$emit('tableChanged', this.tableRadio)
if (this.rows.length <= 0) {
this.$message('请先勾选物料')
return
}
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
this.$emit('tableChanged', this.rows)
},
formterType(row) {
return this.dict.label.PCS_SAL_TYPE[row.sale_type]

View File

@@ -188,7 +188,7 @@
<el-table-column show-overflow-tooltip prop="stor_name" label="仓库" min-width="120" />
<el-table-column prop="product_area" label="生产车间" width="130" show-overflow-tooltip />
<el-table-column show-overflow-tooltip min-width="120" prop="biz_date" label="业务日期" />
<el-table-column label="总量" align="center" prop="total_qty">
<el-table-column label="总量" align="center" prop="total_qty">
<template slot-scope="scope">
{{ fun(scope.row.total_qty) }}
</template>
@@ -249,7 +249,10 @@ export default {
optShow: { add: true, reset: true },
idField: 'iostorinv_id',
url: '/api/productIn',
crudMethod: { ...productIn }
crudMethod: { ...productIn },
props: {
size: 10
}
})
},
mixins: [presenter(), header(), crud()],

View File

@@ -194,11 +194,13 @@
<AddDtl
:dialog-show.sync="dtlShow"
:is-single="false"
@tableChanged="tableChanged2"
/>
<AddIvt
:dialog-show.sync="ivtShow"
:is-single="false"
@tableChanged="tableChanged3"
/>
@@ -319,16 +321,32 @@ export default {
}
},
deleteRow(index, rows) {
const material_code = rows[index].material_code
let len = rows.length
while (len--) {
const obj = rows[len]
if (material_code === obj.material_code) {
const index = rows.indexOf(obj)
if (index > -1) { // 移除找到的指定元素
this.form.total_qty = parseFloat(this.form.total_qty) - parseFloat(rows[index].plan_qty)
rows.splice(index, 1)
this.form.detail_count = this.form.tableData.length
const source_bill_code = rows[index].source_bill_code
const base_billdtl_id = rows[index].base_billdtl_id
if (source_bill_code === undefined) {
let len = rows.length
while (len--) {
const obj = rows[len]
if (base_billdtl_id === obj.base_billdtl_id) {
const index = rows.indexOf(obj)
if (index > -1) { // 移除找到的指定元素
this.form.total_qty = parseFloat(this.form.total_qty) - parseFloat(rows[index].plan_qty)
rows.splice(index, 1)
this.form.detail_count = this.form.tableData.length
}
}
}
} else {
let len = rows.length
while (len--) {
const obj = rows[len]
if (source_bill_code === obj.source_bill_code) {
const index = rows.indexOf(obj)
if (index > -1) { // 移除找到的指定元素
this.form.total_qty = parseFloat(this.form.total_qty) - parseFloat(rows[index].plan_qty)
rows.splice(index, 1)
this.form.detail_count = this.form.tableData.length
}
}
}
}
@@ -341,58 +359,62 @@ export default {
this.nowrow.qty_unit_name = row.unit_name
this.nowrow.qty_unit_id = row.base_unit_id
},
tableChanged2(row) {
let same_mater = true
this.form.tableData.forEach((item) => {
if (item.source_bill_code === row.sale_code) {
same_mater = false
tableChanged2(rows) {
rows.forEach((row) => {
let same_mater = true
this.form.tableData.forEach((item) => {
if (item.source_bill_code === row.deliver_code) {
same_mater = false
}
})
if (same_mater) {
const data = {}
data.material_id = row.material_id
data.material_code = row.material_code
data.material_name = row.material_name
data.material_spec = row.material_spec
data.plan_qty = row.delivery_qty
data.qty_unit_name = row.qty_unit_name
data.qty_unit_id = row.qty_unit_id
data.source_billdtl_id = row.deliver_id
data.source_bill_type = row.deliver_type
data.source_bill_code = row.deliver_code
data.base_billdtl_id = row.sale_id
data.base_bill_code = row.sale_code
data.base_bill_table = row.sale_seq_no
data.edit = true
this.form.tableData.splice(-1, 0, data)
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(data.plan_qty)
this.form.detail_count = this.form.tableData.length
}
})
if (same_mater) {
const data = {}
data.material_id = row.material_id
data.material_code = row.material_code
data.material_name = row.material_name
data.material_spec = row.material_spec
data.plan_qty = row.delivery_qty
data.qty_unit_name = row.qty_unit_name
data.qty_unit_id = row.qty_unit_id
data.source_billdtl_id = row.deliver_id
data.source_bill_type = row.deliver_type
data.source_bill_code = row.deliver_code
data.base_billdtl_id = row.sale_id
data.base_bill_code = row.sale_code
data.base_bill_table = row.sale_seq_no
data.edit = true
this.form.tableData.splice(-1, 0, data)
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(data.plan_qty)
this.form.detail_count = this.form.tableData.length
}
},
tableChanged3(row) {
let same_mater = true
this.form.tableData.forEach((item) => {
if (item.sale_id === row.sale_id) {
same_mater = false
tableChanged3(rows) {
rows.forEach((row) => {
let same_mater = true
this.form.tableData.forEach((item) => {
if (item.base_billdtl_id === row.sale_id) {
same_mater = false
}
})
if (same_mater) {
const data = {}
data.material_id = row.material_id
data.material_code = row.material_code
data.material_name = row.material_name
data.material_spec = row.material_spec
data.plan_qty = row.canuse_qty
data.qty_unit_name = row.unit_name
data.qty_unit_id = row.measure_unit_id
data.base_billdtl_id = row.sale_id
data.base_bill_code = row.sale_code
data.base_bill_table = row.seq_no
data.edit = true
this.form.tableData.splice(-1, 0, data)
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(data.plan_qty)
this.form.detail_count = this.form.tableData.length
}
})
if (same_mater) {
const data = {}
data.material_id = row.material_id
data.material_code = row.material_code
data.material_name = row.material_name
data.material_spec = row.material_spec
data.plan_qty = row.canuse_qty
data.qty_unit_name = row.unit_name
data.qty_unit_id = row.measure_unit_id
data.base_billdtl_id = row.sale_id
data.base_bill_code = row.sale_code
data.base_bill_table = row.seq_no
data.edit = true
this.form.tableData.splice(-1, 0, data)
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(data.plan_qty)
this.form.detail_count = this.form.tableData.length
}
},
insertEvent(row) {
this.dtlShow = true

View File

@@ -72,7 +72,8 @@
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
@current-change="clickChange"
>
<el-table-column label="选择" width="55">
<el-table-column v-if="!isSingle" type="selection" width="55" />
<el-table-column v-if="isSingle" label="选择" width="55">
<template slot-scope="scope">
<el-radio v-model="tableRadio" :label="scope.row"><i /></el-radio>
</template>
@@ -137,6 +138,10 @@ export default {
},
storId: {
type: String
},
isSingle: {
type: Boolean,
default: true
}
},
data() {
@@ -172,14 +177,27 @@ export default {
},
open() {
this.crud.query.mater_type = this.opendtlParam
this.query.status = '10'
this.crud.toQuery()
},
clickChange(item) {
this.tableRadio = item
},
submit() {
this.$emit('update:dialogShow', false)
// 处理单选
if (this.isSingle && this.tableRadio) {
this.$emit('update:dialogShow', false)
this.$emit('tableChanged', this.tableRadio)
return
}
this.rows = this.$refs.multipleTable.selection
this.$emit('tableChanged', this.tableRadio)
if (this.rows.length <= 0) {
this.$message('请先勾选物料')
return
}
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
this.$emit('tableChanged', this.rows)
},
formatStatus(row, column) {
return this.dict.label.PCS_DELI_STATUS[row.status]

View File

@@ -81,7 +81,8 @@
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
@current-change="clickChange"
>
<el-table-column label="选择" width="55">
<el-table-column v-if="!isSingle" type="selection" width="55" />
<el-table-column v-if="isSingle" label="选择" width="55">
<template slot-scope="scope">
<el-radio v-model="tableRadio" :label="scope.row"><i /></el-radio>
</template>
@@ -148,6 +149,10 @@ export default {
},
storId: {
type: String
},
isSingle: {
type: Boolean,
default: true
}
},
data() {
@@ -183,14 +188,26 @@ export default {
},
open() {
this.crud.query.lock_type = '0'
this.crud.toQuery()
},
clickChange(item) {
this.tableRadio = item
},
submit() {
this.$emit('update:dialogShow', false)
// 处理单选
if (this.isSingle && this.tableRadio) {
this.$emit('update:dialogShow', false)
this.$emit('tableChanged', this.tableRadio)
return
}
this.rows = this.$refs.multipleTable.selection
this.$emit('tableChanged', this.tableRadio)
if (this.rows.length <= 0) {
this.$message('请先勾选物料')
return
}
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
this.$emit('tableChanged', this.rows)
}
}
}