库存盘点DB

库存盘点DB
pull/2/head
siontion 9 months ago
parent 98ef234623
commit 6ed9814af5

@ -0,0 +1,825 @@
<template>
<!-- 出库 -->
<el-card class="hl-card" style="position: relative">
<template #header>
<span v-text="dialogTitle"></span>
</template>
<div class="abstatus">
<img src="/src/assets/imgs/status/status2.png" v-if="formData.status == 2" alt="" />
<img src="/src/assets/imgs/status/statuszf.png" v-else-if="formData.status == 3" alt="" />
<span v-else></span>
</div>
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="200px" v-loading="formLoading"
v-bind:disabled="isShowBtnOther">
<!-- 基础信息 -->
<el-card class="hl-card-info">
<template #header>
<div class="hl-card-info-icona"></div><span class="hl-card-info-text">基础信息</span>
</template>
<el-row>
<el-col :span="8">
<el-row>
<el-col :span="24">
<el-form-item prop="stockNo" label="盘点单号">
<el-input v-model="formData.stockNo" disabled placeholder="系统自动生成" class="!w-400px" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item prop="whId" label="盘点仓库" required>
<el-select v-model="formData.whId" placeholder="下拉选择" clearable disabled class="!w-400px"
@change="handleWh">
<el-option v-for="dict in whList" :key="dict.id" :label="dict.whName" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-col>
<el-col :span="8">
<el-row>
<el-col :span="24">
<el-form-item prop="status" label="单据状态">
<el-select v-model="formData.status" placeholder="下拉选择" clearable class="!w-400px" disabled>
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_MAT_CHECK_STATUS)"
:key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item prop="checkType" label="盘点类型">
<el-select v-model="formData.checkType" clearable class="!w-400px" disabled>
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_MAT_CHECK_TYPE)" :key="dict.value"
:label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-col>
<el-col :span="8">
<el-row>
<el-col :span="24">
<el-form-item label="排除库存为0的物料?" prop="noZero">
<el-radio-group v-model="formData.noZero" disabled>
<el-radio v-for="dict in getIntDictOptions(DICT_TYPE.HELI_COMMON_IS_OR_NOT)" :key="dict.value"
:label="dict.value">
{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<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-form-item>
</el-col>
</el-row>
</el-col>
</el-row>
<el-row>
<el-col :span="20">
<el-form-item label="备注" prop="description">
<el-input type="textarea" v-model="formData.description" show-word-limit maxlength="200" disabled />
</el-form-item>
</el-col>
</el-row>
</el-card>
<!-- 物料信息 -->
<el-card class="hl-card-info">
<template #header>
<div class="hl-card-info-icona"></div><span class="hl-card-info-text">物料信息</span>
</template>
<el-row>
<el-col>
<el-card class="hl-incard">
<el-col>
<el-button class="hl-addbutton" type="primary" size="large" @click="onAddItem"></el-button>
</el-col>
<el-form ref="matSubFormRef" :model="formData.matItemDOList" :rules="subFormRules"
v-loading="subFormLoading" label-width="0">
<el-table :data="formData.matItemDOList" class="hl-table">
<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="matType" label="物料类型" min-width="120" align="center">
<template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_TYPE" :value="scope.row.matType"
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="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">
<template #header> <span class="hl-table_header">*</span>出库库区 </template>
<template #default="scope">
<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)"
disabled="">
<el-option v-for="dict in rgList" :key="dict.id" :label="dict.rgName" :value="dict.id" />
</el-select>
</el-form-item>
</template>
</el-table-column>
<el-table-column prop="pnId" min-width="140" align="center">
<template #header> <span class="hl-table_header">*</span>出库库位 </template>
<template #default="scope">
<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-option v-for="dict in scope.row.pnlist" :key="dict.id" :label="dict.pnName"
:value="dict.id" />
</el-select>
</el-form-item>
</template>
</el-table-column>
<el-table-column prop="matRest" label="库存数量" 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 #default="scope">
<el-form-item :prop="`${scope.$index}.storageOkQty`" :rules="subFormRules.storageOkQty"
class="mb-0px!">
<el-input v-model="scope.row.storageOkQty" />
</el-form-item>
</template>
</el-table-column>
<el-table-column prop="lotNo" min-width="120" label="批次号" 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">
<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)"
v-if="isShowBtnDelete">
删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-form>
</el-card>
</el-col>
</el-row>
</el-card>
<!-- 附件信息 -->
<el-card class="hl-card-info">
<template #header>
<div class="hl-card-info-icona"></div><span class="hl-card-info-text">附件信息</span>
</template>
<el-row>
<el-col>
<el-card class="hl-incard">
<el-col>
<el-upload ref="matUploadRef" :file-list="matUploadFiles" multiple :limit="10" :action="uploadUrl"
:headers="{
Authorization: 'Bearer ' + getAccessToken(),
'tenant-id': getTenantId()
}" name="files" :show-file-list="false" :auto-upload="false" :data="matUploadData"
:on-change="matUploadChange" class="upload-file-uploader">
<el-button type="primary">
<Icon icon="ep:upload-filled" />上传
</el-button>
</el-upload>
</el-col>
<el-table :data="formData.attachments" class="hl-table">
<el-table-column prop="name" label="文件名称" align="center">
<!-- <template #default="scope">
<a :href="scope.row.url" target="_blank" style="color: #409eff">{{ scope.row.name }} </a>
</template> -->
</el-table-column>
<el-table-column prop="createTime" align="center" label="上传日期" :formatter="dateFormatter" />
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button link type="danger" size="small" v-if="isShowBtnDelete"
@click="handleDeleteAttachment(scope.$index, scope.row.businessFileType)">
删除
</el-button>
<el-button link type="primary" size="small"
@click="downloadAttachment(scope.row.name, scope.row.url)">
下载
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
</el-card>
<!-- 系统信息 -->
<el-card class="hl-card-info">
<template #header>
<div class="hl-card-info-icona"></div><span class="hl-card-info-text">系统信息</span>
</template>
<el-row justify="center">
<el-col :span="8">
<el-form-item prop="creator" label="创建人">
{{ userList.find((user) => user.id == formData.creator)?.nickname }}
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item prop="createTime" label="创建时间">
{{ formatDate(formData.createTime, 'YYYY-MM-DD HH:mm') }}
</el-form-item>
</el-col>
</el-row>
<el-row justify="center">
<el-col :span="8">
<el-form-item prop="outbound" label="出库人">
{{ userList.find((user) => user.id == formData.outbound)?.nickname }}
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item prop="outboundTime" label="出库时间">
{{ formatDate(formData.outboundTime, 'YYYY-MM-DD HH:mm') }}
</el-form-item>
</el-col>
</el-row>
<el-row justify="center">
<el-col :span="8">
<el-form-item prop="cancel" label="作废人">
{{ userList.find((user) => user.id == formData.cancel)?.nickname }}
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item prop="cancelTime" label="作废时间">
{{ formatDate(formData.cancelTime, 'YYYY-MM-DD HH:mm') }}
</el-form-item>
</el-col>
</el-row>
</el-card>
</el-form>
<div class="text-center hl-footer">
<el-button @click="() => router.go(-1)" size="large"> </el-button>
<el-button @click="submitForm" v-if="isShowBtnGroup" type="success" :disabled="formLoading" size="large">
</el-button>
<el-button @click="handleStatus(2)" v-if="isShowBtnGroup" type="primary" :disabled="formLoading" size="large">
</el-button>
<el-button @click="handleStatus(3)" v-if="isShowBtnCancel" type="danger" :disabled="formLoading" size="large">
</el-button>
</div>
</el-card>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { useRoute } from 'vue-router'
import { dateFormatter, formatDate } from '@/utils/formatTime'
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import { getAccessToken, getTenantId } from '@/utils/auth'
import { useUserStore } from '@/store/modules/user'
import * as CheckApi from '@/api/heli/storagecheck'
import * as CheckMatApi from '@/api/heli/storagecheckmat'
import * as UserApi from '@/api/system/user'
import * as MatApi from '@/api/heli/material'
import * as WhApi from '@/api/heli/warehouse'
import * as RgApi from '@/api/heli/rg'
import * as PnApi from '@/api/heli/pn'
import type { UploadUserFile } from 'element-plus'
import { deleteFile, downloadFile, getFilePage } from '@/api/infra/file'
import download from '@/utils/download'
const reload = inject('reload')
const { t } = useI18n() //
const message = useMessage() //
const { query } = useRoute()
const router = useRouter()
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formData = ref({
id: undefined,
stockNo: undefined,
checkType: undefined,
checkTime: undefined,
status:undefined,
noZero: undefined,
whId: undefined,
description: undefined,
creator: undefined,
createTime: undefined,
keeper: undefined,
keeperTime: undefined,
outbound: undefined,
outboundTime: undefined,
cancel: undefined,
cancelTime: undefined,
matItemDOList: [],
attachments: []
})
const formRules = reactive({
// name: [{ required: true, message: '', trigger: 'blur' }],
status: [{ required: true, message: '启用状态不能为空', trigger: 'blur' }],
stockInType: [{ required: true, message: '出库类型不能为空', trigger: 'blur' }],
whId: [{ required: true, message: '出库仓库不能为空', trigger: 'blur' }]
})
const formRef = ref() // Ref
const matSubFormRef = ref() // Ref
const subFormLoading = ref(false) //
const subFormRules = reactive({
matId: [{ required: true, message: '物料不能为空', trigger: 'blur' }],
rgId: [{ required: true, message: '库区不能为空', trigger: 'blur' }],
pnId: [{ required: true, message: '库位不能为空', trigger: 'blur' }],
storageOkQty: [{ required: true, message: '盘点数量不能为空', trigger: 'blur' }]
})
const handleStatus = async (num) => {
//
await formRef.value.validate()
if (formData.value.matItemDOList.length === 0) {
message.alertWarning('请添加物料信息!')
return
}
//
try {
await matSubFormRef.value.validate()
} catch (e) {
return
}
//
await saveFormData()
formData.value.status = num
const dataUpdate = formData.value as unknown as CheckApi.StorageVO
if (num == 2) {
dataUpdate.outbound = useUserStore().getUser.id
} else {
dataUpdate.cancel = useUserStore().getUser.id
}
await CheckApi.updateStorageStatus(dataUpdate)
message.success(t('common.updateSuccess'))
switch (num) {
case 1:
isShowBtnGroup.value = true
isShowBtnCancel.value = false
isShowBtnOther.value = true
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
}
query.id = storageid.value
query.type = 'update'
reload()
}
const userList = ref<UserApi.UserVO[]>([]) //
// ==================== =======================================
const uploadUrl = ref(import.meta.env.VITE_UPLOAD_BATCH_URL)
const matUploadRef = ref()
const matUploadFiles = ref<UploadUserFile[]>([])
const matUploadData = ref({
businessType: 'STORAGECHECK',
businessId: formData.value.id,
businessFileType: ''
})
const matUploadChange = (file, files) => {
matUploadFiles.value = files
refreshAttachments(files, '')
}
const refreshAttachments = (files, type) => {
formData.value.attachments = formData.value.attachments.filter((value, index, array) => {
return value.id
})
for (let i = 0; i < files.length; i++) {
let file = files[i]
file.businessFileType = type
file.createTime = new Date()
formData.value.attachments.push(file)
}
//
formData.value.attachments.sort((v1, v2) => {
return v1.createTime - v2.createTime > 0
})
}
//
const handleDeleteAttachment = async (index, type) => {
const deletedAttachments = formData.value.attachments.splice(index, 1)
for (let i = 0; i < deletedAttachments.length; i++) {
const attachment = deletedAttachments[i]
if (attachment.id) {
//
await deleteFile(attachment.id)
}
//
matUploadFiles.value = matUploadFiles.value.filter((file1) => {
return file1.name != attachment.name || file1.businessFileType != type
})
}
}
//
const downloadAttachment = async (name, url) => {
if (url) {
const data = await downloadFile(url)
download.any(data, name)
}
}
// ==================== =======================================
const storageid = ref()
var commonResult = ''
/** 提交表单 */
const emit = defineEmits(['success']) // success
const saveFormData = async () => {
//
formLoading.value = true
try {
//
formData.value.matItemDOList.forEach((item) => {
item.stockId = storageid.value
item.whId = formData.value.whId
})
const dataMats = formData.value.matItemDOList as unknown as CheckMatApi.StorageCheckMatVO[]
await CheckMatApi.createStorageMatBatch(dataMats, storageid.value)
if (formData.value.matItemDOList.length > 0) {
//
matUploadData.value.businessId = storageid
matUploadRef.value!.submit()
}
message.success(t(commonResult))
} finally {
formLoading.value = false
}
}
const submitForm = async () => {
//
await formRef.value.validate()
if (formData.value.matItemDOList.length === 0) {
message.alertWarning('请添加物料信息!')
return
}
//
try {
await matSubFormRef.value.validate()
} catch (e) {
return
}
//
await saveFormData()
//
query.id = storageid.value
query.type = 'update'
reload()
}
var matCount = 1
const onAddItem = () => {
if (formData.value.whId) {
const newData = {
//
cid: matCount,
stockId: 0,
matId: '',
matName: '',
matCode: '',
matType: '',
matSpec: '',
matUnit: '',
whId: '',
rgId: '',
pnId: '',
pnlist: ref([]),
storageOkQty: '',
lotNo: '',
description: '',
productBomItemValueDOList: []
}
matCount = matCount + 1
formData.value.matItemDOList.push(newData)
} else {
message.alertWarning('请选择出库仓库')
}
}
//
const handleDelete2 = (index: number) => {
formData.value.matItemDOList.splice(index, 1)
}
//
const warehouseList = ref([])
//
var rgList = 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 queryParamsRPn = reactive({
pageNo: 1,
pageSize: 99,
rgId: scope.row.rgId,
pnStatus: 1
})
const dataPn = await PnApi.getPnPage(queryParamsRPn)
scope.row.pnid = ''
scope.row.pnlist = dataPn.list
//-------------------
}
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 isShowBtnCancel = ref(false)
const isShowBtnOther = ref(false)
const isShowBtnDelete = ref(true)
const btnWhClickable = ref(false)
const matLastData = ref([])
/** 初始化 **/
onMounted(async () => {
btnWhClickable.value = query.type === 'update' ? true : false
matLastData.value = await CheckMatApi.getStorageMatList()
//
let matParams = {
pageNo: 1,
pageSize: 99,
status: '1'
}
const dataMat = await MatApi.getMaterialPage(matParams)
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()
})
</script>
<style>
a {
color: #409eff;
text-decoration: none;
}
</style>

@ -53,7 +53,7 @@
{{ whList.find((tag) => tag.id === scope.row.whId)?.wh_name }}
</template>
</el-table-column>
<el-table-column label="盘点开始时间" align="center" prop="checkTime" width="180px">
<el-table-column label="盘点开始时间" align="center" prop="checkTime" width="180px">
<template #default="scope">
<span>{{ formatDate(scope.row.checkTime, 'YYYY-MM-DD') }}</span>
</template>
@ -70,12 +70,11 @@
</el-table-column>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button link type="primary" @click="openForm('update', scope.row.id)"
v-hasPermi="['heli:storage-check:update']">
<el-button link type="primary" @click="openDetail('update', scope.row.id)">
编辑
</el-button>
<el-button link type="danger" @click="handleDelete(scope.row.id)" v-hasPermi="['heli:storage-check:delete']">
删除
<el-button link type="primary" @click="openDetail('review', scope.row.id)">
查看
</el-button>
</template>
</el-table-column>
@ -99,6 +98,7 @@ import * as WarehouseApi from '@/api/heli/warehouse'
defineOptions({ name: 'StorageCheck' })
const router = useRouter() //
const message = useMessage() //
const { t } = useI18n() //
@ -163,6 +163,11 @@ const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 详情操作 新增/查看 */
const openDetail = (active: string, id?: number) => {
router.push({ path: '/inventory/check', query: { type: active, id: id } })
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {

@ -109,7 +109,7 @@ CREATE TABLE `wms_storage_check_mat` (
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=122 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='盘点物料表';
CREATE ALGORITHM = UNDEFINED DEFINER = `root` @`%` SQL SECURITY DEFINER VIEW `v_storage_material_log` AS
CREATE OR REPLACE VIEW v_storage_material_log AS
select 0 AS `deleted`,`lg`.`id` AS `id`,`lg`.`creator` AS `creator`,`lg`.`create_time` AS `create_time`,`lg`.`updater` AS `updater`,`lg`.`update_time` AS `update_time`,
`lg`.`tenant_id` AS `tenant_id`,`lg`.`status` AS `status`,`mat`.`code` AS `mat_code`,`mat`.`name` AS `mat_name`,
(select `system_dict_data`.`label` from `system_dict_data` where ((`system_dict_data`.`dict_type` = 'heli_material_type') and (`system_dict_data`.`value` = `mat`.`material_type`))) AS `mat_type`,
@ -129,7 +129,7 @@ from (((((`wms_storage_log` `lg`
left join `wms_pn` `pn` on((`lg`.`pn_id` = `pn`.`id`)))
where ((`st`.`deleted` = 0) and (`mat`.`deleted` = 0) and (`wh`.`deleted` = 0) and (`rg`.`deleted` = 0) and (`pn`.`deleted` = 0));
CREATE ALGORITHM = UNDEFINED DEFINER = `root` @`%` SQL SECURITY DEFINER VIEW `v_storage_material_now` AS
CREATE OR REPLACE VIEW v_storage_material_now AS
select `t`.`deleted` AS `deleted`,`t`.`id` AS `id`,`t`.`creator` AS `creator`,`t`.`create_time` AS `create_time`,`t`.`updater` AS `updater`,`t`.`update_time` AS `update_time`,`t`.`tenant_id` AS `tenant_id`,
`t`.`mat_code` AS `mat_code`,`t`.`mat_name` AS `mat_name`,`t`.`mat_type` AS `mat_type`,`t`.`mat_spec` AS `mat_spec`,`t`.`mat_unit` AS `mat_unit`,`t`.`mat_brand` AS `mat_brand`,
`t`.`wh_id` AS `wh_id`,`t`.`wh_name` AS `wh_name`,`t`.`rg_id` AS `rg_id`,`t`.`rg_name` AS `rg_name`,`t`.`pn_id` AS `pn_id`,`t`.`pn_name` AS `pn_name`,`t`.`lot_no` AS `lot_no`,`t`.`short_name` AS `short_name`,
@ -144,4 +144,17 @@ from (
`wh`.`id` AS `wh_id`,`wh`.`wh_name` AS `wh_name`,`rg`.`id` AS `rg_id`,`rg`.`rg_name` AS `rg_name`,`pn`.`id` AS `pn_id`,`pn`.`pn_name` AS `pn_name`,
(case when (isnull(`lg`.`lot_no`) = 1) then '' else `lg`.`lot_no` end) AS `lot_no`,(case when ((`st`.`stock_type` = 1) and (`lg`.`status` = 2)) then `lg`.`storage_ok_qty` when ((`st`.`stock_type` = 1) and (`lg`.`status` = 3)) then (-(1) * `lg`.`storage_ok_qty`) when ((`st`.`stock_type` = 2) and (`lg`.`status` = 2)) then (-(1) * `lg`.`storage_ok_qty`) when ((`st`.`stock_type` = 2) and (`lg`.`status` = 3)) then `lg`.`storage_ok_qty` else `lg`.`storage_ok_qty` end) AS `storage_ok_qty`
from (((((`mes-heli`.`wms_storage_log` `lg` left join `mes-heli`.`wms_storage` `st` on((`lg`.`stock_id` = `st`.`id`))) left join `mes-heli`.`base_material` `mat` on((`lg`.`mat_id` = `mat`.`id`))) left join `mes-heli`.`wms_wh` `wh` on((`lg`.`wh_id` = `wh`.`id`))) left join `mes-heli`.`wms_rg` `rg` on((`lg`.`rg_id` = `rg`.`id`))) left join `mes-heli`.`wms_pn` `pn` on((`lg`.`pn_id` = `pn`.`id`))) where ((`st`.`deleted` = 0) and (`mat`.`deleted` = 0) and (`wh`.`deleted` = 0) and (`rg`.`deleted` = 0) and (`pn`.`deleted` = 0))) `t`
group by `t`.`deleted`,`t`.`id`,`t`.`creator`,`t`.`create_time`,`t`.`updater`,`t`.`update_time`,`t`.`tenant_id`,`t`.`mat_code`,`t`.`mat_name`,`t`.`mat_type`,`t`.`mat_spec`,`t`.`mat_unit`,`t`.`mat_brand`,`t`.`wh_id`,`t`.`wh_name`,`t`.`rg_id`,`t`.`rg_name`,`t`.`pn_id`,`t`.`pn_name`,`t`.`lot_no`,`t`.`short_name`;
group by `t`.`deleted`,`t`.`id`,`t`.`creator`,`t`.`create_time`,`t`.`updater`,`t`.`update_time`,`t`.`tenant_id`,`t`.`mat_code`,`t`.`mat_name`,`t`.`mat_type`,`t`.`mat_spec`,`t`.`mat_unit`,`t`.`mat_brand`,`t`.`wh_id`,`t`.`wh_name`,`t`.`rg_id`,`t`.`rg_name`,`t`.`pn_id`,`t`.`pn_name`,`t`.`lot_no`,`t`.`short_name`;
CREATE OR REPLACE VIEW v_storage_material_amount AS
select `t`.`tenant_id` AS `tenant_id`,`t`.`mat_id` AS `mat_id`,`t`.`mat_name` AS `mat_name`,`t`.`mat_code` AS `mat_code`,`t`.`wh_id` AS `wh_id`,`t`.`rg_id` AS `rg_id`,`t`.`pn_id` AS `pn_id`,
`t`.`spec` AS `spec`,`t`.`unit` AS `unit`,`t`.`material_type` AS `material_type`,`t`.`lot_no` AS `lot_no`,'' AS `storage_ok_qty`,sum(`t`.`storage_ok_qty`) AS `mat_rest`
from (
select `st`.`stock_type` AS `stock_type`,`mat`.`tenant_id` AS `tenant_id`,`mat`.`mat_id` AS `mat_id`,`bm`.`code` AS `mat_code`,`bm`.`name` AS `mat_name`,`mat`.`wh_id` AS `wh_id`,`mat`.`rg_id` AS `rg_id`,`mat`.`pn_id` AS `pn_id`,`mat`.`lot_no` AS `lot_no`,`bm`.`spec` AS `spec`,`bm`.`unit` AS `unit`,`bm`.`material_type` AS `material_type`,
(case when ((`st`.`status` = 2) and (`st`.`stock_type` = 1)) then `mat`.`storage_ok_qty` when ((`st`.`status` = 3) and (`st`.`stock_type` = 1)) then (-(1) * `mat`.`storage_ok_qty`) when ((`st`.`status` = 2) and (`st`.`stock_type` = 2)) then (-(1) * `mat`.`storage_ok_qty`) when ((`st`.`status` = 3) and (`st`.`stock_type` = 2)) then `mat`.`storage_ok_qty` else 0 end) AS `storage_ok_qty`
from ((`mes-heli`.`wms_storage_mat` `mat`
left join `mes-heli`.`wms_storage` `st` on((`mat`.`stock_id` = `st`.`id`)))
left join `mes-heli`.`base_material` `bm` on((`mat`.`mat_id` = `bm`.`id`)))
where ((`mat`.`deleted` = 0) and (`st`.`status` <> 1) and (`st`.`deleted` = 0) and (`bm`.`deleted` = 0) and (`bm`.`status` = 1))
) `t` group by `t`.`mat_id`;
Loading…
Cancel
Save