Commit 48cabd0d authored by jingnan's avatar jingnan 👀

ERP相关_退库管理开发

parent 2154d366
......@@ -57,7 +57,11 @@ export default {
'form.sorties': {
handler(val) {
if (!this.basicData.id) {
this.$set(this.form, 'aoNo', '')
if (this.form.subTypeName === 'MatchStockBackRequest' || this.form.subTypeName === 'InternalStockBackRequest') {
this.$set(this.form, 'extProcessPlan', null)
} else {
this.$set(this.form, 'aoNo', '')
}
}
} },
value: {
......@@ -116,9 +120,16 @@ export default {
this.$api.searchApi(requestUrl, params).then(res => {
if (res.items && res.items.content.length) {
this.options = res.items.content.map((item) => {
return {
label: item[queryNo],
value: item[queryNo]
if (this.form.subTypeName === 'MatchStockBackRequest' || this.form.subTypeName === 'InternalStockBackRequest') {
return {
label: item[queryNo],
value: `${item[queryNo]}+${JSON.stringify(item)}`
}
} else {
return {
label: item[queryNo],
value: item[queryNo]
}
}
})
} else {
......
<template>
<div class="eRPAddInStorageBackItemDialog">
<dee-as-com
v-if="hasTop"
ref="topTable"
:lay-config="{ typeName: 'OutStorageMatchItem', layKey: 'addInStorageBackMatchItem_top' }"
:basic-data="basicData"
table-height="400px"
@row-click="handleRowClickTop"
/>
<dee-as-com
ref="bottomTable"
:table-height="hasTop?'300px':'500px'"
:lay-config="cmpOptions"
:basic-data="basicData"
@row-click="handleRowClickBottom"
/>
<el-form ref="applyForm" :rules="rules" :model="applyForm" class="applyForm">
<el-form-item :label="amountItemLabel" prop="reqAmount" label-width="100px">
<el-input-number v-model="applyForm.reqAmount" :placeholder="amountItemLabel" :min="0" size="small" />
</el-form-item>
<el-form-item class="foot-btn-box">
<el-button type="primary" @click="submitEvent(true)">添加</el-button>
<el-button type="primary" @click="submitEvent(false)">确认</el-button>
<el-button @click="cancelEvent">取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name: 'ERPAddInStorageBackItemDialog',
components: {},
props: {
basicData: {
type: Object,
default: () => {}
},
selectDatas: {
type: Array,
default: () => []
}
},
data() {
return {
selection: null,
defaultData: {},
applyForm: {},
amountItemLabel: '退库数量',
rules: {
reqAmount: [
{ required: true, message: '该项必填', trigger: 'blur' }
]
},
cmpOptions: { typeName: 'JobResponseSorting', layKey: 'add_MatchStockBackRequestItem' }
}
},
computed: {
hasTop() {
return this.basicData.subTypeName === 'MatchStockBackRequest' || this.basicData.subTypeName === 'InternalStockBackRequest'
}
},
watch: {
},
created() {
},
methods: {
handleRowClickTop({ row }) {
if (row.id) {
this.$refs.bottomTable.$refs.asCom.getData(row.id)
}
},
handleRowClickBottom(val) {
this.selection = val.row
},
submitEvent(addContinue) {
this.$refs['applyForm'].validate((valid) => {
if (valid && this.selection) {
const maxAmount = this.$utils.subNum(this.selection.outsideAmount, -this.selection.backedAmount, -this.selection.backAmount)
if (this.applyForm.reqAmount > maxAmount) return this.$utils.showMessageWarning(`当前选中物料的退库数量不足!`)
const inventoryData = this.selection.erpInventory
const data = [{
jobResponseSorting: this.selection,
'subTypeName': `${this.basicData.subTypeName}Item`,
'material': inventoryData.extMaterial,
'materialId': inventoryData.extMaterialId,
'testNo': inventoryData.testNo,
'batchNo': inventoryData.batchNumber,
'serialNo': inventoryData.serialNo,
'backAmount': this.selection.backAmount || 0,
'backedAmount': this.selection.backedAmount || 0,
'outsideAmount': this.selection.outsideAmount || 0,
'reqAmount': this.applyForm.reqAmount,
'reqNo': this.selection.erpSortingItem && this.selection.erpSortingItem.erpSorting && this.selection.erpSortingItem.erpSorting.reqNo || ''
}]
this.$emit('submitEvent', { formData: data, addContinue })
addContinue && this.cleanAddForm()
} else {
this.$utils.showMessageWarning(`至少选择一条物料并且${this.amountItemLabel}必填!`)
return false
}
})
},
cleanAddForm() {
this.$refs.bottomTable.$refs.asCom.getData()
this.applyForm = {}
},
cancelEvent() {
this.$emit('cancel')
}
}
}
</script>
<style lang='scss'>
.eRPAddInStorageBackItemDialog{
.applyForm{
margin-top: 30px;
.el-input-number{
width: 180px;
}
}
.foot-btn-box{
display: flex;
margin-top: 10px;
justify-content: center;
align-content: center;
}
}
</style>
<!--
* @Description:ERP_退库入库申请明细
-->
<template>
<div :style="layoutStyle" class="addInStorageBackItem">
<dee-as-com
ref="table"
:im-show-table-data="imShowTableData"
:basic-data="{...form,...basicData}"
:lay-config="cmpOptions"
table-height="auto"
:dis-business="true"
:result-data="tableData"
@tableToolHandler="tableToolHandler"
@selectionChange="selectionChange"
/>
<dee-dialog
:title="dialogTitle"
width="84%"
:dialog-visible="dialogShow"
@handleClose="dialogShow = false"
>
<component
:is="componentName"
:basic-data="{...form,...basicData}"
:select-datas="selectionRows"
:form="form"
@submitEvent="submitEvent"
@cancel="dialogShow = false"
/>
</dee-dialog>
</div>
</template>
<script>
import ERPAddInStorageBackItemDialog from './components/ERPAddInStorageBackItemDialog'
import { post } from '@/utils/http'
export default {
componentName: 'ERP_退库入库添加明细',
name: 'ERPAddInStorageBackItem',
components: { ERPAddInStorageBackItemDialog },
props: {
basicData: {
type: Object,
default: () => {}
},
form: {
type: Object,
default: () => {
return {}
}
},
imShowTableData: {
type: Array,
default: () => {
return []
}
},
layoutStyle: {
type: Object,
default: () => {
return {}
}
},
showBtn: {
type: Boolean,
default: true
}
},
data() {
return {
dialogShow: false,
selectionRows: [],
tableData: [],
dialogTitle: '',
componentName: '',
cmpOptions: {
typeName: 'RetirementItem',
layKey: 'defaultResult'
}
}
},
computed: {
},
watch: {
tableData: {
immediate: true,
deep: true,
handler(data) {
this.$emit('input', data)
}
},
'form.subTypeName': {
immediate: true,
deep: true,
handler(val) {
if (val && !this.basicData.id) {
this.tableData = []
}
}
},
basicData: {
immediate: true,
deep: true,
handler(val) {
if (val && val.id) {
if (val.retirementItems) {
this.tableData = val.retirementItems.map(item => {
item.operator = 'MODIFY'
if (item.jobResponseSorting) {
if (item.jobResponseSorting.erpSortingItem && item.jobResponseSorting.erpSortingItem.erpSorting) {
item.reqNo = item.jobResponseSorting.erpSortingItem.erpSorting.reqNo || ''
}
}
return item
})
}
}
}
}
},
created() {
},
provide() {
return {
parentType_Inject: '退库入库'
}
},
methods: {
tableToolHandler(val) {
const btnValue = val.key.btnValue
switch (btnValue) {
case 'add':
this.addHandle()
break
case 'remove':
this.remove()
break
default:
break
}
},
selectionChange(val) {
this.selectionRows = val
},
addHandle() {
this.$utils.findForm(this).validate((valid) => {
if (valid) {
this.openDialog('添加退库明细', 'ERPAddInStorageBackItemDialog')
} else {
this.$utils.showMessageWarning('请填写基本信息!')
}
})
},
openDialog(dialogTitle, componentName) {
this.dialogTitle = dialogTitle
this.componentName = componentName
this.dialogShow = true
},
remove() {
const ids = this.selectionRows.map(item => item.id)
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
post(`/RetirementItem/batch/deleteItem?`, ids).then(res => {
this.$message({
type: 'success',
message: '删除成功!'
})
this.tableData = this.tableData.filter(item => !this.selectionRows.map(item => item.jobResponseSorting.id).includes(item.jobResponseSorting.id))
}).catch((err) => {
console.log(err)
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
submitEvent({ formData, addContinue }) {
const onlyFlag = this.tableData.find(item => item.reqNo !== formData[0].reqNo)
if (onlyFlag) return this.$utils.showMessageWarning('只能添加同一单据下的数据,请重新选择!')
const extMaterialIds = this.tableData.map(item => item.jobResponseSorting.id).includes(formData[0].jobResponseSorting.id)
if (extMaterialIds) return this.$utils.showMessageWarning('相同数据不能重复添加,请重新选择!')
this.tableData.push(...formData)
this.dialogShow = addContinue || false
}
}
}
</script>
<style>
</style>
......@@ -113,12 +113,17 @@ export default {
{
taskType: '操作工确认',
type: 'ERP_operatorConfirm',
appId: 1626782774851
appId: 1626782774851 // 库房管理appId
},
{
taskType: '准备工出库调整',
type: 'ERP_SortAdjust',
appId: 1626782774851
},
{
taskType: '库内退库确认',
type: 'ERP_StockBackConfirm',
appId: 1626782774851
}
]
}
......@@ -210,11 +215,15 @@ export default {
get(`/indexTask/task/ProdTask`, {}).then(res => {
this.$set(this.quickAccessList[index], 'taskCount', res.items.count)
})
} if (item.type === 'ERP_SortAdjust' || item.type === 'ERP_operatorConfirm') {
} else if (item.type === 'ERP_SortAdjust' || item.type === 'ERP_operatorConfirm') {
post(`/ErpSorting/currentUserSortingTaskCount`, {}).then(res => {
const resKey = item.type === 'ERP_SortAdjust' ? '准备工任务数量' : '操作工任务数量'
this.$set(this.quickAccessList[index], 'taskCount', res.items[resKey])
})
} else if (item.type === 'ERP_StockBackConfirm') {
post(`/ErpRetirementRequest/searchBackTaskCount`, {}).then(res => {
this.$set(this.quickAccessList[index], 'taskCount', res.items)
})
} else {
const params = {
type: this.quickAccessList[index].type
......@@ -252,8 +261,21 @@ export default {
}
})
this.$store.dispatch('app/closeSideBar', false)
} else if (item.taskType === '准备工出库调整' || item.taskType === '操作工确认') {
const pageNo = item.taskType === '准备工出库调整' ? '101cb379-db51-4fd5-8a1f-eace2ca8dcc6' : '038a430e-facf-4fcb-9b98-2bf75c226681'
} else if (item.taskType === '准备工出库调整' || item.taskType === '操作工确认' || item.taskType === '库内退库确认') {
let pageNo = ''
switch (item.taskType) {
case '准备工出库调整':
pageNo = '101cb379-db51-4fd5-8a1f-eace2ca8dcc6'
break
case '操作工确认':
pageNo = '038a430e-facf-4fcb-9b98-2bf75c226681'
break
case '库内退库确认':
pageNo = '219cf48e-020a-4048-85d7-d5c2b83537f4'
break
default:
break
}
this.$router.push({
path: `/page/${pageNo}`,
query: {
......
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