Commit be668cdb authored by jingnan's avatar jingnan 👀

退库入库修改

parent 049502f0
...@@ -1574,6 +1574,16 @@ export function sumArray(array, key) { ...@@ -1574,6 +1574,16 @@ export function sumArray(array, key) {
} }
return sum / baseNum return sum / baseNum
} }
// 计算一些列数据的和或者差值
export function subNum(firstArg, ...restArgs) {
const baseNum = 1000 // 解决js计算精度丢失问题
let sum = firstArg* baseNum
for (let i = 0; i < restArgs.length; i++) {
sum += Number(restArgs[i]) * baseNum
}
return sum / baseNum
}
export default { export default {
treeFindBackArray, treeFindBackArray,
throttle, throttle,
...@@ -1657,5 +1667,6 @@ export default { ...@@ -1657,5 +1667,6 @@ export default {
deepClone, deepClone,
fileByIdDownload, fileByIdDownload,
findForm, findForm,
sumArray sumArray,
subNum
} }
...@@ -86,7 +86,7 @@ export default { ...@@ -86,7 +86,7 @@ export default {
submitEvent(addContinue) { submitEvent(addContinue) {
this.$refs['applyForm'].validate((valid) => { this.$refs['applyForm'].validate((valid) => {
if (valid && this.selection) { if (valid && this.selection) {
const maxAmount = this.selection.outsideAmount - this.selection.backedAmount - this.selection.backAmount - this.selection.scrapCount const maxAmount = this.$utils.subNum(this.selection.outsideAmount, -this.selection.backedAmount, -this.selection.backAmount, -this.selection.scrapCount)
if (this.applyForm.reqAmount > maxAmount) return this.$utils.showMessageWarning(`当前选中物料的退库数量不足!`) if (this.applyForm.reqAmount > maxAmount) return this.$utils.showMessageWarning(`当前选中物料的退库数量不足!`)
const inventoryData = this.selection.inventory const inventoryData = this.selection.inventory
const data = [{ const data = [{
...@@ -101,7 +101,8 @@ export default { ...@@ -101,7 +101,8 @@ export default {
'backedAmount': this.selection.backedAmount || 0, 'backedAmount': this.selection.backedAmount || 0,
'scrapCount': this.selection.scrapCount || 0, 'scrapCount': this.selection.scrapCount || 0,
'outsideAmount': this.selection.outsideAmount || 0, 'outsideAmount': this.selection.outsideAmount || 0,
'reqAmount': this.applyForm.reqAmount 'reqAmount': this.applyForm.reqAmount,
'reqNo': this.selection.jobOrder && this.selection.jobOrder.outStorageRequest && this.selection.jobOrder.outStorageRequest.reqNo || ''
}] }]
this.$emit('submitEvent', { formData: data, addContinue }) this.$emit('submitEvent', { formData: data, addContinue })
addContinue && this.cleanAddForm() addContinue && this.cleanAddForm()
......
...@@ -118,6 +118,9 @@ export default { ...@@ -118,6 +118,9 @@ export default {
item.testNo = item.backItem.inventory.testNo item.testNo = item.backItem.inventory.testNo
item.suppname = item.backItem.inventory.suppname item.suppname = item.backItem.inventory.suppname
} }
if (item.backItem.jobOrder && item.backItem.jobOrder.outStorageRequest) {
item.reqNo = item.backItem.jobOrder.outStorageRequest.reqNo || ''
}
} }
return item return item
}) })
...@@ -175,7 +178,7 @@ export default { ...@@ -175,7 +178,7 @@ export default {
type: 'success', type: 'success',
message: '删除成功!' message: '删除成功!'
}) })
this.tableData = this.tableData.filter(item => !this.selectionRows.map(item => item.extMaterialId).includes(item.extMaterialId)) this.tableData = this.tableData.filter(item => !this.selectionRows.map(item => item.backItemId).includes(item.backItemId))
}).catch((err) => { }).catch((err) => {
console.log(err) console.log(err)
}) })
...@@ -187,8 +190,10 @@ export default { ...@@ -187,8 +190,10 @@ export default {
}) })
}, },
submitEvent({ formData, addContinue }) { submitEvent({ formData, addContinue }) {
const extMaterialIds = this.tableData.map(item => item.extMaterialId).includes(formData[0].extMaterialId) const onlyFlag = this.tableData.find(item => item.reqNo !== formData[0].reqNo)
if (extMaterialIds) return this.$utils.showMessageWarning('相同物料不能重复添加,请重新选择!') if (onlyFlag) return this.$utils.showMessageWarning('只能添加同一单据下的数据,请重新选择!')
const extMaterialIds = this.tableData.map(item => item.backItemId).includes(formData[0].backItemId)
if (extMaterialIds) return this.$utils.showMessageWarning('相同数据不能重复添加,请重新选择!')
this.tableData.push(...formData) this.tableData.push(...formData)
this.dialogShow = addContinue || false this.dialogShow = addContinue || false
} }
......
...@@ -64,7 +64,7 @@ export default { ...@@ -64,7 +64,7 @@ export default {
if (this.parentType_Inject === 'scrapUse' && this.form.extSupportingItemVO && this.reqAmount > this.form.extSupportingItemVO.reqAmount) { if (this.parentType_Inject === 'scrapUse' && this.form.extSupportingItemVO && this.reqAmount > this.form.extSupportingItemVO.reqAmount) {
this.maxNum = this.form.extSupportingItemVO.reqAmount this.maxNum = this.form.extSupportingItemVO.reqAmount
} }
const maxAmount = this.form.outsideAmount - this.form.backedAmount - this.form.backAmount - this.form.scrapCount const maxAmount = this.$utils.subNum(this.form.outsideAmount, -this.form.backedAmount, -this.form.backAmount, -this.form.scrapCount)
if (this.parentType_Inject === '退库入库' && this.form.reqAmount > maxAmount) { if (this.parentType_Inject === '退库入库' && this.form.reqAmount > maxAmount) {
this.maxNum = maxAmount this.maxNum = maxAmount
} }
......
<!--
* @Author: gjn
* @Date: 2023-09-08 16:22:41
* @Description:领用出库签审对象_申请环节
-->
<template>
<div class="OutStorageUseApprovedObject">
<dee-as-com
style="border:none;"
model-name="OutStorageUse"
:lay-config="cmpOptions"
:basic-data="basicData"
/>
</div>
</template>
<script>
export default {
name: 'OutStorageUseApprovedObject',
components: {},
props: {
basicData: {
type: Object,
default: () => null
}
},
data() {
return {
cmpOptions: {
typeName: 'OutStorageUseItem',
layKey: 'OutStorageUseApprovedObject_apply'
}
}
},
computed: {},
watch: {},
created() {},
mounted() {},
// 组件方法
methods: {}
}
</script>
<style lang='scss'>
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment