库存盘点

库存盘点
pull/2/head
siontion 9 months ago
parent 7b2cdca3b3
commit 413d0adf4e

@ -74,7 +74,8 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="盘点开始日期" prop="checkTime"> <el-form-item label="盘点开始日期" prop="checkTime">
<el-date-picker v-model="formData.checkTime" value-format="YYYY-MM-DD" type="date" disabled class="!w-220px" /> <el-date-picker v-model="formData.checkTime" value-format="YYYY-MM-DD" type="date" disabled
class="!w-220px" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -103,46 +104,24 @@
v-loading="subFormLoading" label-width="0"> v-loading="subFormLoading" label-width="0">
<el-table :data="formData.matItemDOList" class="hl-table"> <el-table :data="formData.matItemDOList" class="hl-table">
<el-table-column prop="cid" label="序号" :width="80" /> <el-table-column prop="cid" label="序号" :width="80" />
<el-table-column prop="matId" min-width="140" align="center">
<template #header> <span class="hl-table_header">*</span>物料名称 </template>
<template #default="scope">
<el-form-item :prop="`${scope.$index}.matId`" :rules="subFormRules.matId" class="mb-0px!">
<el-select v-model="scope.row.matId" placeholder="物料名称" :remote-method="remoteMatCodeSearch"
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-select>
</el-form-item>
</template>
</el-table-column>
<el-table-column prop="matCode" label="物料编码" min-width="120" align="center" /> <el-table-column prop="matCode" label="物料编码" min-width="120" align="center" />
<el-table-column prop="matType" label="物料类型" min-width="120" align="center"> <el-table-column prop="matName" label="物料名称" min-width="140" align="center" />
<template #default="scope"> <el-table-column prop="matType" label="物料类型" min-width="120" align="center" />
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_TYPE" :value="scope.row.matType" <el-table-column prop="shortName" label="物料简称" min-width="120" align="center" />
v-if="scope.row.matType ? true : false" />
</template>
</el-table-column>
<el-table-column prop="matSpec" label="规格/型号" min-width="120" align="center" /> <el-table-column prop="matSpec" label="规格/型号" min-width="120" align="center" />
<el-table-column prop="matBrand" label="品牌" min-width="120" align="center" />
<el-table-column prop="matUnit" label="系统单位" min-width="120" align="center">
<template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_UNIT" :value="scope.row.matUnit"
v-if="scope.row.matUnit ? true : false" />
</template>
</el-table-column>
<el-table-column prop="rgId" min-width="120" align="center"> <el-table-column prop="rgId" min-width="120" align="center">
<template #header> <span class="hl-table_header">*</span>出库库区 </template> <template #header> <span class="hl-table_header">*</span>库区 </template>
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.rgId`" :rules="subFormRules.rgId" class="mb-0px!"> <el-form-item :prop="`${scope.$index}.rgId`" :rules="subFormRules.rgId" class="mb-0px!">
<el-select v-model="scope.row.rgId" placeholder="" style="width: 100%" @change="handleRg(scope)" <el-select v-model="scope.row.rgId" placeholder="" style="width: 100%" @change="handleRg(scope)">
disabled="">
<el-option v-for="dict in rgList" :key="dict.id" :label="dict.rgName" :value="dict.id" /> <el-option v-for="dict in rgList" :key="dict.id" :label="dict.rgName" :value="dict.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="pnId" min-width="140" align="center"> <el-table-column prop="pnId" min-width="140" align="center">
<template #header> <span class="hl-table_header">*</span>出库库位 </template> <template #header> <span class="hl-table_header">*</span>库位 </template>
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.pnId`" :rules="subFormRules.pnId" class="mb-0px!"> <el-form-item :prop="`${scope.$index}.pnId`" :rules="subFormRules.pnId" class="mb-0px!">
<el-select v-model="scope.row.pnId" placeholder="" style="width: 100%"> <el-select v-model="scope.row.pnId" placeholder="" style="width: 100%">
@ -152,9 +131,10 @@
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="lotNo" min-width="120" label="批次号" align="center" />
<el-table-column prop="matRest" label="库存数量" min-width="120" align="center" /> <el-table-column prop="matRest" label="库存数量" min-width="120" align="center" />
<el-table-column prop="storageOkQty" min-width="120" align="center"> <el-table-column prop="storageOkQty" min-width="120" align="center">
<template #header> <span class="hl-table_header">*</span>出库数量</template> <template #header> <span class="hl-table_header">*</span>盘点数量</template>
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.storageOkQty`" :rules="subFormRules.storageOkQty" <el-form-item :prop="`${scope.$index}.storageOkQty`" :rules="subFormRules.storageOkQty"
class="mb-0px!"> class="mb-0px!">
@ -162,27 +142,14 @@
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="lotNo" min-width="120" label="批次号" align="center" /> <el-table-column prop="matUnit" label="库存单位" min-width="120" align="center" />
<el-table-column prop="description" min-width="180" label="备注" align="center">
<template #default="scope">
<el-input v-model="scope.row.description" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="240"> <el-table-column label="操作" align="center" width="240">
<template #default="scope"> <template #default="scope">
<!-- <el-button v-if="!scope.row.editable" type="primary" size="small" link
@click="handleEdit(scope.$index)">
编辑
</el-button>
<el-button link v-else type="success" size="small" @click="handleSave(scope.$index)">
保存
</el-button>
<el-button link type="primary" @click="handlefuke(scope.$index, scope.row)">复制</el-button> -->
<el-button link type="danger" size="small" @click.prevent="handleDelete2(scope.$index)" <el-button link type="danger" size="small" @click.prevent="handleDelete2(scope.$index)"
v-if="isShowBtnDelete"> v-if="isShowBtnDelete">
删除 删除
</el-button> </el-button>
<el-button link type="primary" @click="handleCopy(scope.$index, scope.row)">复制</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -328,7 +295,7 @@ const formData = ref({
stockNo: undefined, stockNo: undefined,
checkType: undefined, checkType: undefined,
checkTime: undefined, checkTime: undefined,
status:undefined, status: undefined,
noZero: undefined, noZero: undefined,
whId: undefined, whId: undefined,
description: undefined, description: undefined,
@ -417,7 +384,7 @@ const handleStatus = async (num) => {
isShowBtnOther.value = false isShowBtnOther.value = false
isShowBtnDelete.value = false isShowBtnDelete.value = false
} }
query.id = storageid.value query.id = formData.value.id
query.type = 'update' query.type = 'update'
reload() reload()
} }
@ -476,7 +443,6 @@ const downloadAttachment = async (name, url) => {
} }
// ==================== ======================================= // ==================== =======================================
const storageid = ref()
var commonResult = '' var commonResult = ''
/** 提交表单 */ /** 提交表单 */
@ -489,15 +455,15 @@ const saveFormData = async () => {
try { try {
// //
formData.value.matItemDOList.forEach((item) => { formData.value.matItemDOList.forEach((item) => {
item.stockId = storageid.value item.stockId = formData.value.id
item.whId = formData.value.whId item.whId = formData.value.whId
}) })
const dataMats = formData.value.matItemDOList as unknown as CheckMatApi.StorageCheckMatVO[] const dataMats = formData.value.matItemDOList as unknown as CheckMatApi.StorageCheckMatVO[]
await CheckMatApi.createStorageMatBatch(dataMats, storageid.value) await CheckMatApi.createStorageMatBatch(dataMats, formData.value.id)
if (formData.value.matItemDOList.length > 0) { if (formData.value.matItemDOList.length > 0) {
// //
matUploadData.value.businessId = storageid matUploadData.value.businessId = formData.value.id
matUploadRef.value!.submit() matUploadRef.value!.submit()
} }
message.success(t(commonResult)) message.success(t(commonResult))
@ -521,87 +487,56 @@ const submitForm = async () => {
// //
await saveFormData() await saveFormData()
// //
query.id = storageid.value query.id = formData.value.id
query.type = 'update' query.type = 'update'
reload() reload()
} }
var matCount = 1 var matCount = 1
const onAddItem = () => { const onAddItem = () => {
if (formData.value.whId) { const newData = {
const newData = { //
// cid: matCount,
cid: matCount, isCopy: 0,
stockId: 0, stockId: 0,
matId: '', matId: '',
matName: '', matName: '',
matCode: '', matCode: '',
matType: '', matType: '',
matSpec: '', matSpec: '',
matUnit: '', matUnit: '',
whId: '', matRest: '',
rgId: '', whId: '',
pnId: '', rgId: '',
pnlist: ref([]), pnId: '',
storageOkQty: '', pnlist: ref([]),
lotNo: '', storageOkQty: '',
description: '', lotNo: '',
productBomItemValueDOList: [] description: '',
} productBomItemValueDOList: []
matCount = matCount + 1
formData.value.matItemDOList.push(newData)
} else {
message.alertWarning('请选择出库仓库')
} }
matCount = matCount + 1
formData.value.matItemDOList.push(newData)
} }
// //
const handleDelete2 = (index: number) => { const handleDelete2 = (index: number) => {
formData.value.matItemDOList.splice(index, 1) var itemDelteing = formData.value.matItemDOList[index]
if (itemDelteing.isCopy == 0) {
message.alertWarning("原始物料不能删除")
} else {
formData.value.matItemDOList.splice(index, 1)
}
} }
// //
const warehouseList = ref([]) const whList = ref([])
// //
var rgList = ref([]) var rgList = ref([])
// //
var pnList = ref([]) var pnList = ref([])
const handleWh = async (wid) => {
//-------------------
const queryParamsRg = reactive({
pageNo: 1,
pageSize: 99,
whId: wid
})
const dataRg = await RgApi.getRgPage(queryParamsRg)
rgList.value = []
pnList.value = []
rgList.value = dataRg.list
const matLastRemoteData = await CheckMatApi.getStorageMatList()
let matParams = {
pageNo: 1,
pageSize: 99,
status: '1'
}
const dataMat = await MatApi.getMaterialPage(matParams)
matList.value = []
matList.value = dataMat.list.filter(
(item) =>
matLastRemoteData.find((fish) => fish.matId === item.id && fish.whId == wid) !== undefined
)
formData.value.matItemDOList = []
// formData.value.matItemDOList.forEach(item => {
// item.rgId = ''
// item.pnId = ''
// item.pnlist.value = []
// })
//-------------------
}
const handleRg = async (scope) => { const handleRg = async (scope) => {
//------------------- //-------------------
const queryParamsRPn = reactive({ const queryParamsRPn = reactive({
@ -616,203 +551,20 @@ const handleRg = async (scope) => {
//------------------- //-------------------
} }
const matList = ref<MatApi.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 CheckMatApi.getStorageMatList()
const dataMat = await MatApi.getMaterialPage(matParams)
matList.value = []
matList.value = dataMat.list.filter(
(item) =>
matLastRemoteData.find(
(fish) => fish.matId === item.id && fish.whId == formData.value.whId
) !== undefined
)
matSelectLoading.value = false
}
const handleMatCode = async (scope, matid) => {
if (matid && matLastData.value.find((item) => item.matId === matid)) {
const matVo = matLastData.value.find((item) => item.matId === matid)
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
const queryParamsRPn = reactive({
pageNo: 1,
pageSize: 99,
rgId: scope.row.rgId,
pnStatus: 1
})
const dataPn = await PnApi.getPnPage(queryParamsRPn)
scope.row.pnlist = dataPn.list
} 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 = []
}
}
const isShowBtnGroup = ref(true) const isShowBtnGroup = ref(true)
const isShowBtnCancel = ref(false) const isShowBtnCancel = ref(false)
const isShowBtnOther = ref(false) const isShowBtnOther = ref(false)
const isShowBtnDelete = ref(true) const isShowBtnDelete = ref(true)
const btnWhClickable = ref(false)
const matLastData = ref([])
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
btnWhClickable.value = query.type === 'update' ? true : false //
let attParams = {
matLastData.value = await CheckMatApi.getStorageMatList()
//
let matParams = {
pageNo: 1, pageNo: 1,
pageSize: 99, pageSize: 99,
status: '1' businessId: query.id,
businessType: 'STORAGECHECK'
} }
const dataMat = await MatApi.getMaterialPage(matParams) formData.value.attachments = (await getFilePage(attParams)).list
matList.value = []
matList.value = dataMat.list
dialogTitle.value = t('action.' + query.type)
dialogTitle.value = query.type === 'review' ? '查看' : dialogTitle.value
//-------------------
const data = await WhApi.getWarehouseSimpList()
warehouseList.value = data
//-------------------
if (query.id) {
//
formData.value = await CheckApi.getStorage(query.id)
switch (formData.value.status) {
case 1:
isShowBtnGroup.value = true
isShowBtnCancel.value = false
isShowBtnDelete.value = true
break
case 2:
isShowBtnGroup.value = false
isShowBtnCancel.value = true
isShowBtnOther.value = false
isShowBtnDelete.value = false
break
case 3:
isShowBtnGroup.value = false
isShowBtnCancel.value = false
isShowBtnOther.value = false
isShowBtnDelete.value = false
break
default:
break
}
//
if (query.type === 'review') {
isShowBtnGroup.value = false
isShowBtnCancel.value = false
isShowBtnOther.value = false
isShowBtnDelete.value = false
}
//
const queryParamsRg = reactive({
pageNo: 1,
pageSize: 99,
status: 1,
whId: formData.value.whId
})
const dataRg = await RgApi.getRgPage(queryParamsRg)
rgList.value = []
rgList.value = dataRg.list
//
const queryParamsPn = reactive({
pageNo: 1,
pageSize: 99
})
const dataPn = await PnApi.getPnPage(queryParamsPn)
pnList.value = []
pnList.value = dataPn.list
//
const queryParamsMat = reactive({
pageNo: 1,
pageSize: 99,
stockId: query.id
})
const dataMats = await CheckMatApi.getStorageMatPage(queryParamsMat)
formData.value.matItemDOList = dataMats.list
//
const queryParamsMat2 = reactive({
pageNo: 1,
pageSize: 99,
status: 1
})
const matVos = await MatApi.getMaterialPage(queryParamsMat2)
formData.value.matItemDOList.forEach((item) => {
item.cid = matCount
item.matId = matVos.list.find((record) => record.id === item.matId)?.id
//item.matCode = matVos.list.find( (record) => record.id === item.matId)?.id
item.matCode = matVos.list.find((record) => record.id == item.matId)?.code
item.matSpec = matVos.list.find((record) => record.id == item.matId)?.spec
item.matType = matVos.list.find((record) => record.id == item.matId)?.materialType
item.matUnit = matVos.list.find((record) => record.id == item.matId)?.unit
item.pnlist = pnList.value.filter((pn) => pn.rgId == item.rgId)
item.matRest = matLastData.value.find(
(rest) => rest.rgId == item.rgId && rest.pnId == item.pnId
)?.matRest
item.matRest = item.matRest == undefined ? 0 : item.matRest
matCount = matCount + 1
// item = matLastData.value.find((rest) => rest.rgId === item.rgId && rest.pnId === item.pnId)
// item.pnlist = pnList.value.filter((pn) => pn.rgId === item.rgId)
// item.cid = matCount
// matCount = matCount + 1
})
//
let attParams = {
pageNo: 1,
pageSize: 99,
businessId: query.id,
businessType: 'STORAGE'
}
formData.value.attachments = (await getFilePage(attParams)).list
}
// //
userList.value = await UserApi.getSimpleUserList() userList.value = await UserApi.getSimpleUserList()
}) })

Loading…
Cancel
Save