Commit 994ccf5e authored by jingnan's avatar jingnan 👀

入库流程-缺少入库操作,缺少库位操作bug修改

parent ff239f71
...@@ -1584,6 +1584,14 @@ export function subNum(firstArg, ...restArgs) { ...@@ -1584,6 +1584,14 @@ export function subNum(firstArg, ...restArgs) {
} }
return sum / baseNum return sum / baseNum
} }
// 获取目标响应数据
export function getTargetJobResponses(item, responseName) {
if (item.inventoryJobResponses && item.inventoryJobResponses.length) {
const targetInventory = item.inventoryJobResponses.find(el => el.subTypeName === responseName)
return targetInventory || null
}
}
export default { export default {
treeFindBackArray, treeFindBackArray,
throttle, throttle,
...@@ -1668,5 +1676,6 @@ export default { ...@@ -1668,5 +1676,6 @@ export default {
fileByIdDownload, fileByIdDownload,
findForm, findForm,
sumArray, sumArray,
subNum subNum,
getTargetJobResponses
} }
/**
* @Description: 库位选择组件
* @author xioln
* @date 2023-07-21
*/
<template>
<div class="warehouse-select">
<el-select
v-if="basicData||scope.row.jobOrder&&scope.row.jobOrder.storageZoneId"
v-model="selectVal"
:loading="tableColumnSelect"
size="small"
placeholder="请选择库位"
filterable
:disabled="!scope.row.isRoot"
remote
loading-text="数据正在加载中..."
:remote-method="(query) => remoteMethod(query, storageZoneId)"
@focus="locationList = []"
@change="save"
>
<el-option v-for="item in locationList" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</div>
</template>
<script>
export default {
// name: 'WarehouseSelect', // name写在组件的最前方,自定义组件为必填
components: {},
props: {
basicData: {
type: Object,
default: () => null
},
scope: {
type: Object,
default: () => null
}
},
data() {
return {
storageZoneId: '',
selectVal: '',
tableColumnSelect: false,
locationList: [],
// 库位搜索节流
remoteFlag: true
}
},
computed: {},
watch: {
basicData: {
immediate: true,
deep: true,
handler: function(val) {
val && (this.storageZoneId = val.storageZoneId)
}
},
'scope.row': {
immediate: true,
deep: true,
handler: function(val) {
this.selectVal = val.exWorkUnitName
}
}
},
created() {
// 初始化数据
},
methods: {
// 搜索库位
remoteMethod(query) {
if (!this.storageZoneId) return
if (query.length < 3) return
if (this.remoteFlag) {
this.remoteFlag = false
this.tableColumnSelect = true
const params = {
'pageFrom': 1,
'pageSize': 10,
'searchItems': {
'children': [
{
'items': [
{
'fieldName': 'extCenterId', 'operator': 'EQ', 'value': this.storageZoneId
},
{
'fieldName': 'extcode', 'operator': 'LIKE', 'value': query
}
],
'operator': 'AND'
}
],
'items': [],
'operator': 'AND'
},
'openProps': []
}
this.$api.searchApi('ExtDxProductWorkUnit', params).then(res => {
if (res.items && res.items.content.length) {
this.locationList = res.items.content.map((item) => {
return {
label: item.extcode,
value: `${item.id}+${item.extcode}`
}
})
} else {
this.locationList = []
}
})
.catch((err) => console.log(err))
.finally(() => {
this.loading = false
this.remoteFlag = true
this.tableColumnSelect = false
})
} else {
this.$utils.showMessageWarning('上一步请求正在查询中,请稍后')
}
},
save(v) {
if (!this.selectVal) this.$utils.showMessageWarning('请选择库位')
this.$emit('save', { extWorkUnitId: this.selectVal, currentRow: this.scope.row })
// 适配验收入库确认批量签审
if (this.scope.row.subTypeName === 'JobResponseInEntry') {
const resValue = this.selectVal.split('+')[0]
this.$emit('input', resValue)
this.saveExtWorkUnit(resValue)
}
},
saveExtWorkUnit(resValue) {
if (!resValue) return this.$utils.showMessageWarning('请选择库位')
const params = {
id: this.scope.row.id,
operator: 'MODIFY',
extWorkUnitId: resValue,
extWorkUnitIdType: 'ExtDxProductWorkUnit'
}
this.$api.recursion('JobResponseInStorage', params).then(res => {
this.$utils.showMessageSuccess('保存成功')
this.$bus.$emit('reloadModuleList')
})
}
}
}
</script>
<style lang='scss'></style>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<script> <script>
import { post } from '@/utils/http' import { post } from '@/utils/http'
import EditDrawer from './component/editDrawer.vue' import EditDrawer from './component/editDrawer.vue'
import WarehouseSelect from './component/warehouseSelect.vue'
export default { export default {
// componentName: '验收入库申请流程详情', // componentName: '验收入库申请流程详情',
name: 'PurchasingWarehousingProcessView', // name写在组件的最前方,自定义组件为必填 name: 'PurchasingWarehousingProcessView', // name写在组件的最前方,自定义组件为必填
...@@ -43,7 +43,22 @@ export default { ...@@ -43,7 +43,22 @@ export default {
data() { data() {
return { return {
tableData: [], tableData: [],
columns: [ optionsTree: {
rowKey: 'id',
'tree-props': { children: 'children' }
},
timerId: null,
pagination: {
currentPage: 1,
pageSize: 20,
total: 0,
pageSizes: [10, 20, 50, 100]
}
}
},
computed: {
columns() {
const tableConlumn = [
{ title: '序号', key: 'parentIndex', align: 'center', headerAlign: 'center' }, { title: '序号', key: 'parentIndex', align: 'center', headerAlign: 'center' },
{ title: '操作', key: 'operate', align: 'center', component: { { title: '操作', key: 'operate', align: 'center', component: {
show: true, show: true,
...@@ -74,6 +89,23 @@ export default { ...@@ -74,6 +89,23 @@ export default {
} }
}}, }},
{ title: '单据编号', key: 'inventoryReq.reqNo', width: '120', align: 'center', headerAlign: 'center' }, { title: '单据编号', key: 'inventoryReq.reqNo', width: '120', align: 'center', headerAlign: 'center' },
{
title: '库位',
key: 'exWorkUnitName',
width: '150',
component: {
name: WarehouseSelect,
show: true,
props: {
basicData: this.basicData
},
handler: {
save: ({ extWorkUnitId, currentRow }) => {
this.setParams(extWorkUnitId, currentRow)
}
}
}
},
{ title: '所属设备', key: 'subEquipment', headerAlign: 'center', align: 'center' }, { title: '所属设备', key: 'subEquipment', headerAlign: 'center', align: 'center' },
{ {
title: '物料类型', key: 'typeName', align: 'center', headerAlign: 'center', formatter: (row, column, cellValue, index) => { title: '物料类型', key: 'typeName', align: 'center', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
...@@ -144,21 +176,14 @@ export default { ...@@ -144,21 +176,14 @@ export default {
return row.createTime && row.createTime.split(' ')[0] return row.createTime && row.createTime.split(' ')[0]
} }
} }
], ]
optionsTree: { if (this.basicData.subTypeName === 'InStoragePurchaseItem' && this.basicData.state === 'In_Confirm') {
rowKey: 'id', return tableConlumn
'tree-props': { children: 'children' } } else {
}, return tableConlumn.filter(item => item.title !== '库位')
timerId: null,
pagination: {
currentPage: 1,
pageSize: 20,
total: 0,
pageSizes: [10, 20, 50, 100]
} }
} }
}, },
computed: {},
watch: { watch: {
}, },
created() { created() {
...@@ -177,6 +202,30 @@ export default { ...@@ -177,6 +202,30 @@ export default {
}) })
}, },
methods: { methods: {
setParams(extWorkUnitId, currentRow) {
if (currentRow.inventoryJobResponses && currentRow.inventoryJobResponses.length) {
const targetInventory = this.$utils.getTargetJobResponses(currentRow, 'JobResponseInEntry')
if (!targetInventory) return this.$utils.showMessageWarning('该数据下不存在入库确认响应!')
if (!extWorkUnitId.split('+')[0]) return this.$utils.showMessageWarning('请选择库位')
const params = {
id: targetInventory.id,
operator: 'MODIFY',
extWorkUnitId: extWorkUnitId.split('+')[0],
extWorkUnitIdType: 'ExtDxProductWorkUnit'
}
this.saveWorkUnit(params)
if (currentRow.children && currentRow.children.length) {
currentRow.children.map(child => {
this.setParams(extWorkUnitId, child)
})
}
}
},
saveWorkUnit(params) {
this.$api.recursion('JobResponseInStorage', params).then(res => {
this.searchInStorageRequestItem()
})
},
// 编辑采购入库明细查询InStorageRequestItem/search // 编辑采购入库明细查询InStorageRequestItem/search
searchInStorageRequestItem() { searchInStorageRequestItem() {
const param = { const param = {
...@@ -204,7 +253,13 @@ export default { ...@@ -204,7 +253,13 @@ export default {
] ]
}, },
'openProps': [{ 'name': 'extMaterial', 'openProps': [{ 'name': 'resType2' }, { 'name': 'extUnit' }] }, { 'name': 'extDxSipplier' }, { 'name': 'storageZone' }, { 'name': 'inventoryReq' }], 'openProps': [
{ 'name': 'inventoryJobResponses',
'openProps': [
{ 'name': 'extWorkUnit' }
]
},
{ 'name': 'extMaterial', 'openProps': [{ 'name': 'resType2' }, { 'name': 'extUnit' }] }, { 'name': 'extDxSipplier' }, { 'name': 'storageZone' }, { 'name': 'inventoryReq' }],
'sortItem': [ 'sortItem': [
{ {
'fieldName': 'modifyTime', 'fieldName': 'modifyTime',
...@@ -234,7 +289,11 @@ export default { ...@@ -234,7 +289,11 @@ export default {
{ 'name': 'extDxSipplier' }, { 'name': 'extDxSipplier' },
{ 'name': 'storageZone' }, { 'name': 'storageZone' },
{ 'name': 'inventoryReq' }, { 'name': 'inventoryReq' },
{ 'name': 'inventoryJobResponses' } { 'name': 'inventoryJobResponses',
'openProps': [
{ 'name': 'extWorkUnit' }
]
}
], ],
'sortItem': [ 'sortItem': [
{ {
...@@ -256,9 +315,17 @@ export default { ...@@ -256,9 +315,17 @@ export default {
treeTableNoArrange(tableData) { treeTableNoArrange(tableData) {
tableData.forEach((item, i) => { tableData.forEach((item, i) => {
item.parentIndex = i + 1 item.parentIndex = i + 1
const targetInventory = this.$utils.getTargetJobResponses(item, 'JobResponseInEntry')
if (targetInventory) {
item.exWorkUnitName = targetInventory.extWorkUnit && targetInventory.extWorkUnit.extcode || ''
}
if (item.children) { if (item.children) {
item.children.forEach((child, j) => { item.children.forEach((child, j) => {
child.parentIndex = item.parentIndex + '.' + (j + 1) child.parentIndex = item.parentIndex + '.' + (j + 1)
const targetInventory = this.$utils.getTargetJobResponses(child, 'JobResponseInEntry')
if (targetInventory) {
child.exWorkUnitName = targetInventory.extWorkUnit && targetInventory.extWorkUnit.extcode || ''
}
}) })
} }
}) })
......
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