|
|
|
@ -106,7 +106,7 @@
|
|
|
|
|
<el-select v-model="scope.row.matId" placeholder="物料名称" :remote-method="remoteMatCodeSearch" v-bind:disabled="ctrView || ctrSave"
|
|
|
|
|
remote-show-suffix remote clearable reserve-keyword filterable :loading="matSelectLoading"
|
|
|
|
|
@change="(val) => handleMatCode(scope, val)" class="!w-180px">
|
|
|
|
|
<el-option v-for="item in matList" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
|
|
<el-option v-for="item in scope.row.matList" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</template>
|
|
|
|
@ -563,6 +563,7 @@ const submitForm = async () => {
|
|
|
|
|
|
|
|
|
|
var matCount = 1
|
|
|
|
|
const onAddItem = () => {
|
|
|
|
|
|
|
|
|
|
if (formData.value.whId) {
|
|
|
|
|
const newData = {
|
|
|
|
|
// 新数据的属性
|
|
|
|
@ -581,7 +582,8 @@ const onAddItem = () => {
|
|
|
|
|
storageOkQty: '',
|
|
|
|
|
lotNo: '',
|
|
|
|
|
description: '',
|
|
|
|
|
productBomItemValueDOList: []
|
|
|
|
|
productBomItemValueDOList: [],
|
|
|
|
|
matList : matList.value
|
|
|
|
|
}
|
|
|
|
|
matCount = matCount + 1
|
|
|
|
|
|
|
|
|
@ -612,6 +614,31 @@ const handleWh = async (wid) => {
|
|
|
|
|
|
|
|
|
|
// 获得库位列表
|
|
|
|
|
pnList.value = (await PnApi.getSimpList()).filter( pn => pn.wh_id == wid)
|
|
|
|
|
|
|
|
|
|
//await getMatList()
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
const getMatList = async (name) =>{
|
|
|
|
|
// 获得物料列表
|
|
|
|
|
let matParams = {
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
status: '1'
|
|
|
|
|
}
|
|
|
|
|
if(name){
|
|
|
|
|
matParams.name = name
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//const matLastRemoteData = await StorageMatApi.getStorageMatList(0)
|
|
|
|
|
|
|
|
|
|
const dataMat = await MaterialApi.getMaterialPage(matParams)
|
|
|
|
|
matList.value = dataMat.list
|
|
|
|
|
// matList.value = dataMat.list.filter(
|
|
|
|
|
// (item) =>
|
|
|
|
|
// matLastRemoteData.find(
|
|
|
|
|
// (fish) => fish.matId === item.id && fish.whId == formData.value.whId
|
|
|
|
|
// ) !== undefined
|
|
|
|
|
// )
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handlePn = async (scope) =>{
|
|
|
|
@ -638,68 +665,29 @@ const handlePn = async (scope) =>{
|
|
|
|
|
|
|
|
|
|
} else{
|
|
|
|
|
scope.row.rgId = ''
|
|
|
|
|
scope.row.matRest = ''
|
|
|
|
|
scope.row.matRest = '0'
|
|
|
|
|
message.alertWarning('当前库位无库存数量可出库')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const matList = ref<MaterialApi.MaterialVO[]>([]) // 物料列表
|
|
|
|
|
|
|
|
|
|
const matSelectLoading = ref(false)
|
|
|
|
|
const remoteMatCodeSearch = async (name) => {
|
|
|
|
|
matSelectLoading.value = true
|
|
|
|
|
// 获得用户列表
|
|
|
|
|
let matParams = {
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
name: name,
|
|
|
|
|
status: '1'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const matLastRemoteData = await StorageMatApi.getStorageMatList(0)
|
|
|
|
|
|
|
|
|
|
const dataMat = await MaterialApi.getMaterialPage(matParams)
|
|
|
|
|
matList.value = []
|
|
|
|
|
matList.value = dataMat.list.filter(
|
|
|
|
|
(item) =>
|
|
|
|
|
matLastRemoteData.find(
|
|
|
|
|
(fish) => fish.matId === item.id && fish.whId == formData.value.whId
|
|
|
|
|
) !== undefined
|
|
|
|
|
)
|
|
|
|
|
// 获得物料列表
|
|
|
|
|
await getMatList(name)
|
|
|
|
|
matSelectLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleMatCode = async (scope, matid) => {
|
|
|
|
|
if (matid && matLastData.value.find((item) => item.matId === matid && item.whId== formData.value.whId)) {
|
|
|
|
|
const matVo = matLastData.value.find((item) => item.matId === matid && item.whId== formData.value.whId)
|
|
|
|
|
scope.row.matId = matVo.matId
|
|
|
|
|
scope.row.matName = matVo.matName
|
|
|
|
|
scope.row.matCode = matVo.matCode
|
|
|
|
|
scope.row.matSpec = matVo.matSpec
|
|
|
|
|
scope.row.matType = matVo.materialType
|
|
|
|
|
scope.row.matUnit = matVo.matUnit
|
|
|
|
|
// scope.row.rgId = matVo.rgId
|
|
|
|
|
// scope.row.pnId = matVo.pnId
|
|
|
|
|
// scope.row.matRest = matVo.matRest
|
|
|
|
|
// scope.row.storageOkQty = matVo.storageOkQty
|
|
|
|
|
// scope.row.lotNo = matVo.lotNo
|
|
|
|
|
// scope.row.description = matVo.description
|
|
|
|
|
scope.row.matId = scope.row.matList.find((item) => item.id === matid)?.id
|
|
|
|
|
scope.row.matName = scope.row.matList.find((item) => item.id === matid)?.name
|
|
|
|
|
scope.row.matCode = scope.row.matList.find((item) => item.id === matid)?.code
|
|
|
|
|
scope.row.matSpec = scope.row.matList.find((item) => item.id === matid)?.spec
|
|
|
|
|
scope.row.matType = scope.row.matList.find((item) => item.id === matid)?.materialType
|
|
|
|
|
scope.row.matUnit = scope.row.matList.find((item) => item.id === matid)?.unit
|
|
|
|
|
|
|
|
|
|
scope.row.pnlist = pnList.value.filter(row => row.id == row.rgId)
|
|
|
|
|
} else {
|
|
|
|
|
scope.row.matId = ''
|
|
|
|
|
scope.row.matName = ''
|
|
|
|
|
scope.row.matCode = ''
|
|
|
|
|
scope.row.matSpec = ''
|
|
|
|
|
scope.row.matType = ''
|
|
|
|
|
scope.row.matUnit = ''
|
|
|
|
|
scope.row.rgId = ''
|
|
|
|
|
scope.row.pnId = ''
|
|
|
|
|
scope.row.matRest = ''
|
|
|
|
|
scope.row.storageOkQty = ''
|
|
|
|
|
scope.row.lotNo = ''
|
|
|
|
|
scope.row.description = ''
|
|
|
|
|
scope.row.pnlist = []
|
|
|
|
|
}
|
|
|
|
|
scope.row.pnlist = pnList.value.filter(pn => pn.wh_id == formData.value.whId && matLastData.value.filter( mat => mat.matId == matid).length>0)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const matLastData = ref([])
|
|
|
|
@ -753,32 +741,41 @@ const initStatus = async (status) => {
|
|
|
|
|
btnCancel.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const matList = ref<MaterialApi.MaterialVO[]>([]) // 物料列表
|
|
|
|
|
const matEditList = ref<MaterialApi.MaterialVO[]>([]) // 物料列表
|
|
|
|
|
const userList = ref<UserApi.UserVO[]>([]) // 用户列表
|
|
|
|
|
const matSimpList = ref([]) // 物料基本信息列表
|
|
|
|
|
const matSimpVirtualList = ref([]) // 物料基本信息列表
|
|
|
|
|
/** 初始化 **/
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
|
|
|
|
|
// 获取当前最新库存信息
|
|
|
|
|
matLastData.value = await StorageMatApi.getStorageMatList(0)
|
|
|
|
|
// 页面标题展示
|
|
|
|
|
dialogTitle.value = query.type === 'review' ? '查看' : t('action.' + query.type)
|
|
|
|
|
|
|
|
|
|
//- 获取仓库全数据
|
|
|
|
|
whList.value = await WarehouseApi.getWarehouseSimpList()
|
|
|
|
|
|
|
|
|
|
//获取状态为启用的物料信息
|
|
|
|
|
await getMatList(name)
|
|
|
|
|
|
|
|
|
|
// 获取当前最新库存信息
|
|
|
|
|
matLastData.value = await StorageMatApi.getStorageMatList(0)
|
|
|
|
|
|
|
|
|
|
// 编辑时获取入库单据信息,包括基础信息、物料信息、附件信息
|
|
|
|
|
if (query.id) {
|
|
|
|
|
|
|
|
|
|
// 获取原始物料信息
|
|
|
|
|
matSimpList.value = await MaterialApi.getSimpList()
|
|
|
|
|
matSimpVirtualList.value = await MaterialApi.getSimpVirtualList()
|
|
|
|
|
|
|
|
|
|
matEditList.value = matSimpList.value //matSimpList.value.filter( mat => matLastData.value.filter( row => row.matId == mat.id).length>0)
|
|
|
|
|
|
|
|
|
|
matList.value = matSimpList.value.filter( mat => matLastData.value.filter( row => row.matId == mat.id).length>0)
|
|
|
|
|
|
|
|
|
|
// 编辑时获取入库单据信息,包括基础信息、物料信息、附件信息
|
|
|
|
|
if (query.id) {
|
|
|
|
|
|
|
|
|
|
// 获取库存信息
|
|
|
|
|
formData.value = await StorageApi.getStorage(query.id)
|
|
|
|
|
if(formData.value.vmatName){
|
|
|
|
|
matEditList.value = matSimpVirtualList.value
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 页面控件可视初始化
|
|
|
|
|
await initStatus(formData.value.status)
|
|
|
|
@ -802,22 +799,23 @@ onMounted(async () => {
|
|
|
|
|
// 填充物料原始信息
|
|
|
|
|
formData.value.matItemDOList.forEach((item) => {
|
|
|
|
|
item.cid = matCount
|
|
|
|
|
item.matId = matSimpList.value.find((record) => record.id === item.matId)?.id
|
|
|
|
|
item.matCode = matSimpList.value.find( (record) => record.id === item.matId)?.code
|
|
|
|
|
item.matName = matSimpList.value.find((record) => record.id === item.matId)?.name
|
|
|
|
|
item.matSpec = matSimpList.value.find((record) => record.id === item.matId)?.spec
|
|
|
|
|
item.matType = matSimpList.value.find((record) => record.id === item.matId)?.material_type
|
|
|
|
|
item.matUnit = matSimpList.value.find((record) => record.id === item.matId)?.unit
|
|
|
|
|
item.matId = matEditList.value.find((record) => record.id === item.matId)?.id
|
|
|
|
|
item.matCode = matEditList.value.find( (record) => record.id === item.matId)?.code
|
|
|
|
|
item.matName = matEditList.value.find((record) => record.id === item.matId)?.name
|
|
|
|
|
item.matSpec = matEditList.value.find((record) => record.id === item.matId)?.spec
|
|
|
|
|
item.matType = matEditList.value.find((record) => record.id === item.matId)?.material_type
|
|
|
|
|
item.matUnit = matEditList.value.find((record) => record.id === item.matId)?.unit
|
|
|
|
|
item.matRest = matLastData.value.find( row => row.matId == item.matId && row.pnId == item.pnId)?.matRest
|
|
|
|
|
item.matRest = (item.matRest==undefined || item.matRest.length==0)?0:item.matRest
|
|
|
|
|
item.pnlist = pnList.value.filter((pn) => pn.rg_id === item.rgId)
|
|
|
|
|
item.pnlist = pnList.value.filter((pn) => pn.wh_id === item.whId)
|
|
|
|
|
item.matList = matEditList.value.filter((record) => record.id === item.matId)
|
|
|
|
|
matCount = matCount + 1
|
|
|
|
|
})
|
|
|
|
|
matList.value = matSimpList.value.filter( mat => matLastData.value.filter( row => row.matId == mat.id).length>0 || formData.value.matItemDOList.filter(fan => fan.matId == mat.id).length>0)
|
|
|
|
|
// matList.value = matSimpList.value.filter( mat => matLastData.value.filter( row => row.matId == mat.id).length>0 || formData.value.matItemDOList.filter(fan => fan.matId == mat.id).length>0)
|
|
|
|
|
|
|
|
|
|
if(matList.value.length == 0){
|
|
|
|
|
matList.value = matSimpVirtualList.value.filter( mat => matLastData.value.filter( row => row.matId == mat.id).length>0 || formData.value.matItemDOList.filter(fan => fan.matId == mat.id).length>0)
|
|
|
|
|
}
|
|
|
|
|
// if(matList.value.length == 0){
|
|
|
|
|
// matList.value = matSimpVirtualList.value.filter( mat => matLastData.value.filter( row => row.matId == mat.id).length>0 || formData.value.matItemDOList.filter(fan => fan.matId == mat.id).length>0)
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// 附件信息
|
|
|
|
|
let attParams = {
|
|
|
|
|