数量盘点入库

This commit is contained in:
binbin_pan 2024-04-01 17:51:01 +08:00
parent a421a118f0
commit a56b7d44ea
1 changed files with 179 additions and 74 deletions

View File

@ -197,7 +197,7 @@
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item label="待入库总数" label-width="130px" prop="num">
<el-form-item label="待入库总数" label-width="130px" prop="num" v-if="!isNumCheck">
<el-input-number
v-model="codeForm.num"
placeholder="请输入待入库总数"
@ -215,7 +215,7 @@
<el-row :gutter="20">
<el-col :span="7">
<el-form-item label="前缀" label-width="130px" prop="codePrefix">
<el-form-item label="前缀" label-width="130px" prop="codePrefix" v-if="!isNumCheck">
<el-input
v-model="codeForm.codePrefix"
placeholder="请输入前缀"
@ -227,7 +227,7 @@
</el-col>
<el-col :span="10">
<el-form-item label="后缀范围" label-width="130px" prop="codeSuffixStart">
<el-form-item label="后缀范围" label-width="130px" prop="codeSuffixStart" v-if="!isNumCheck">
<el-input
v-model="codeForm.codeSuffixStart"
clearable
@ -237,7 +237,7 @@
@input="changeInput(codeForm.codeSuffixStart)"
/>
</el-form-item>
<el-form-item label="~" label-width="auto" prop="codeSuffixEnd">
<el-form-item label="~" label-width="auto" prop="codeSuffixEnd" v-if="!isNumCheck">
<el-input
v-model="codeForm.codeSuffixEnd"
clearable
@ -249,7 +249,7 @@
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item label="单价" label-width="130px" prop="buyPrice">
<el-form-item label="单价" label-width="130px" prop="buyPrice" v-if="!isNumCheck">
<el-input-number
v-model="codeForm.buyPrice"
:precision="2"
@ -266,7 +266,7 @@
<el-row :gutter="20">
<el-col :span="7">
<el-form-item label="选择厂家" label-width="130px" prop="codeFactory">
<el-form-item label="选择厂家" label-width="130px" prop="codeFactory" v-if="!isNumCheck">
<el-select
v-model="codeForm.codeFactory"
placeholder="请选择厂家"
@ -283,7 +283,7 @@
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="检验时间" label-width="130px" prop="thisCheckFixTime">
<el-form-item label="检验时间" label-width="130px" prop="thisCheckFixTime" v-if="!isNumCheck">
<el-date-picker
v-model="codeForm.thisCheckFixTime"
type="date"
@ -294,7 +294,7 @@
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item label="下次检验时间" label-width="130px" prop="nextCheckFixTime">
<el-form-item label="下次检验时间" label-width="130px" prop="nextCheckFixTime" v-if="!isNumCheck">
<el-date-picker
v-model="codeForm.nextCheckFixTime"
type="date"
@ -308,12 +308,12 @@
<el-row :gutter="20">
<el-col :span="7">
<el-form-item label="检验人" label-width="130px" prop="checkMan">
<el-form-item label="检验人" label-width="130px" prop="checkMan" v-if="!isNumCheck">
<el-input v-model="codeForm.checkMan" placeholder="请输入检验人" clearable style="width: 220px;" />
</el-form-item>
</el-col>
<el-col :span="10">
<el-col :span="isNumCheck ? 7 : 10">
<el-form-item label="备注" label-width="130px" prop="remarks">
<el-input
v-model="codeForm.remarks"
@ -322,7 +322,7 @@
maxlength="200"
rows="4"
show-word-limit
style="width: 400px"
:style="{ width: isNumCheck ? '220px' : '400px' }"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
@ -365,21 +365,22 @@
>导出</el-button>
</el-col>
</el-row> -->
<el-table v-loading="loading" :data="codeTableList" @selection-change="handleSelectionChange" :stripe="true" :border="true">
<el-table v-loading="loading" :data="codeTableList" v-if="!isNumCheck"
@selection-change="handleSelectionChange" :stripe="true" :border="true">
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<el-table-column label="序号" align="center" type="index" />
<el-table-column label="设备编码" align="center" prop="maCode" :show-overflow-tooltip="true">
<template v-slot:default="{ row }">
<template v-slot:default="{ row }" v-if="!isNumCheck">
<el-input v-model="row.maCode" placeholder="请输入设备编码"></el-input>
</template>
</el-table-column>
<el-table-column label="出厂编码" align="center" prop="outFacCode" :show-overflow-tooltip="true">
<template v-slot:default="{ row }">
<el-input v-model="row.outFacCode" placeholder="请输入设备编码"></el-input>
<template v-slot:default="{ row }" v-if="!isNumCheck">
<el-input v-model="row.outFacCode" placeholder="请输入出厂编码"></el-input>
</template>
</el-table-column>
<el-table-column label="生产厂家" align="center" prop="maVender" :show-overflow-tooltip="true">
<template v-slot:default="{ row }">
<template v-slot:default="{ row }" v-if="!isNumCheck">
<el-select v-model="row.maVender" placeholder="请选择生产厂家" clearable filterable>
<el-option
v-for="item in supplierList"
@ -391,7 +392,7 @@
</template>
</el-table-column>
<el-table-column label="检验日期" align="center" prop="thisCheckFixTime" :show-overflow-tooltip="true">
<template v-slot:default="{ row }">
<template v-slot:default="{ row }" v-if="!isNumCheck">
<el-date-picker
v-model="row.thisCheckFixTime"
type="date"
@ -402,7 +403,7 @@
</template>
</el-table-column>
<el-table-column label="下次检验日期" align="center" prop="nextCheckFixTime" :show-overflow-tooltip="true">
<template v-slot:default="{ row }">
<template v-slot:default="{ row }" v-if="!isNumCheck">
<el-date-picker
v-model="row.nextCheckFixTime"
type="date"
@ -413,7 +414,7 @@
</template>
</el-table-column>
<el-table-column label="单价" align="center" prop="buyPrice" :show-overflow-tooltip="true">
<template v-slot:default="{ row }">
<template v-slot:default="{ row }" v-if="!isNumCheck">
<el-input-number
v-model="row.buyPrice"
:precision="2"
@ -457,6 +458,43 @@
</el-table-column>
</el-table>
<!-- 数量入库 -->
<el-table v-loading="loading" :data="numTableList" border stripe v-if="isNumCheck">
<el-table-column label="序号" align="center" type="index" />
<el-table-column prop="typeCn" label="设备名称" align="center" :show-overflow-tooltip="true">
</el-table-column>
<el-table-column prop="guigeCn" label="规格型号" align="center" :show-overflow-tooltip="true">
</el-table-column>
<el-table-column prop="num" label="当前库存" align="center" :show-overflow-tooltip="true">
</el-table-column>
<el-table-column prop="num" label="入库数量" align="center" :show-overflow-tooltip="true">
<template v-slot:default="{ row }">
<el-input-number v-model="row.putInStoreNum" placeholder="请输入入库数量" @blur="handlePutBlur(row)"
clearable :controls="false" :min="1" style="width: 10vw;" />
</template>
</el-table-column>
<el-table-column prop="unitCn" label="计量单位" align="center" :show-overflow-tooltip="true">
</el-table-column>
<el-table-column prop="remark" label="备注" align="center" :show-overflow-tooltip="true">
<template v-slot:default="{ row }">
<el-input v-model="row.remark" placeholder="请输入备注" align="center" :show-overflow-tooltip="true" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot:default="{ $index }">
<el-popconfirm
title="确定删除吗?"
icon="el-icon-info"
placement="top"
@confirm="handleDeleteRow($index)"
@cancel="cancelPop"
>
<el-button slot="reference" size="mini" type="text" icon="el-icon-delete">删除</el-button>
</el-popconfirm>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
@ -511,6 +549,9 @@ export default {
returnList: [],
//
codeTableList: [],
//
numTableList: [],
numTable: {},
//
title: "",
//
@ -523,6 +564,8 @@ export default {
codeOpen: false,
//
dateRange: [],
isNumCheck: false,
isAdd: false,
//
queryParams: {
pageNum: 1,
@ -642,7 +685,9 @@ export default {
this.deviceType = {}
this.reset();
this.codeTableList = []
this.numTableList = []
this.$refs['codeForm'].clearValidate()
this.isNumCheck = false;
},
//
reset() {
@ -681,39 +726,50 @@ export default {
},
/** 填充编码盘点表单 */
fillCodeForm() {
console.log('🚀 ~ fillCodeForm ~ this.isNumCheck:', this.isNumCheck);
//
this.$refs['codeForm'].validate(valid => {
if (!valid) return
console.log('🚀 ~ fillCodeForm ~ this.codeForm:', this.codeForm);
// this.codeTableList
this.codeTableList = []
// this.codeForm.num, this.codeTableListthis.codeForm
for (let i = 0; i < this.codeForm.num; i++) {
// :
let suffix = (parseInt(this.codeForm.codeSuffixStart) + i).toString().padStart(this.codeForm.codeSuffixStart?.length, '0')
console.log('🚀 ~ fillCodeForm ~ suffix:', suffix);
suffix = isNaN(suffix) ? '' : suffix
const maCode = `${this.codeForm.codePrefix || ''}${suffix}`
//
const outFacCode = ''
//
const maVender = this.supplierList.find(item => item.supplierId == this.codeForm.codeFactory)?.supplier || ''
// : codeForm.thisCheckFixTime, yyyy-MM-dd
let thisCheckFixTime = new Date(this.codeForm.thisCheckFixTime).toLocaleDateString('zh-CN', {year: 'numeric', month: '2-digit', day: '2-digit'}).replace(/\//g, '-')
if (thisCheckFixTime == 'Invalid Date') thisCheckFixTime = ''
// : codeForm.nextCheckFixTime
let nextCheckFixTime = new Date(this.codeForm.nextCheckFixTime).toLocaleDateString('zh-CN', {year: 'numeric', month: '2-digit', day: '2-digit'}).replace(/\//g, '-')
if (nextCheckFixTime == 'Invalid Date') nextCheckFixTime = ''
// : codeForm.buyPrice
const buyPrice = this.codeForm.buyPrice || 0
this.codeTableList.push({
maCode,
outFacCode,
maVender,
thisCheckFixTime,
nextCheckFixTime,
buyPrice
})
if (this.isNumCheck) {
// this.numTableList this.numTable , ,
if (this.numTableList.some(item => item.typeId == this.codeForm.typeId)) {
this.$message.error('请勿重复添加')
return
}
console.log('🚀 ~ fillCodeForm ~ this.numTable:', this.numTable);
this.numTableList.push(this.numTable)
} else {
// this.codeForm.num, this.codeTableListthis.codeForm
for (let i = 0; i < this.codeForm.num; i++) {
// :
let suffix = (parseInt(this.codeForm.codeSuffixStart) + i).toString().padStart(this.codeForm.codeSuffixStart?.length, '0')
// console.log('🚀 ~ fillCodeForm ~ suffix:', suffix);
suffix = isNaN(suffix) ? '' : suffix
const maCode = `${this.codeForm.codePrefix || ''}${suffix}`
//
const outFacCode = ''
//
const maVender = this.supplierList.find(item => item.supplierId == this.codeForm.codeFactory)?.supplier || ''
// : codeForm.thisCheckFixTime, yyyy-MM-dd
let thisCheckFixTime = new Date(this.codeForm.thisCheckFixTime).toLocaleDateString('zh-CN', {year: 'numeric', month: '2-digit', day: '2-digit'}).replace(/\//g, '-')
if (thisCheckFixTime == 'Invalid Date') thisCheckFixTime = ''
// : codeForm.nextCheckFixTime
let nextCheckFixTime = new Date(this.codeForm.nextCheckFixTime).toLocaleDateString('zh-CN', {year: 'numeric', month: '2-digit', day: '2-digit'}).replace(/\//g, '-')
if (nextCheckFixTime == 'Invalid Date') nextCheckFixTime = ''
// : codeForm.buyPrice
const buyPrice = this.codeForm.buyPrice || 0
this.codeTableList.push({
maCode,
outFacCode,
maVender,
thisCheckFixTime,
nextCheckFixTime,
buyPrice
})
}
}
})
},
@ -743,12 +799,14 @@ export default {
},
/** 新增数量盘点按钮操作 */
handleNumberAdd() {
this.isNumCheck = true;
this.reset();
this.numberOpen = true;
this.codeOpen = true;
this.title = "数量盘点入库";
},
/** 新增编号盘点按钮操作 */
handleCodeAdd() {
this.isNumCheck = false;
this.reset();
this.codeOpen = true;
this.title = "编码盘点入库";
@ -773,35 +831,58 @@ export default {
submitForm: function() {
this.$refs['codeForm'].validate(valid => {
if (valid) {
let SavePutInfoDto = {}
console.log('🚀 ~ this.codeForm:', this.codeForm);
console.log('🚀 ~ this.codeTableList:', this.codeTableList);
//
const SavePutInfoDto = {
isCode: true, //
putInType: this.codeForm.putInType,
typeId: this.codeForm.typeId,
num: this.codeForm.num,
remarks: this.codeForm.remarks || '',
machIneDtoList: this.codeTableList,
checkMan: this.codeForm.checkMan || '',
console.log('🚀 ~ this.numTableList:', this.numTableList);
if (this.isNumCheck) {
//
SavePutInfoDto = {
isCode: false,
putInType: this.codeForm.putInType,
remarks: this.codeForm.remarks || '',
machIneDtoList: this.numTableList,
}
console.log('🚀 ~ submitForm: ~ SavePutInfoDto-isNum', SavePutInfoDto)
//
inputByCode(SavePutInfoDto).then(response => {
this.$message.success('入库成功')
this.codeOpen = false
this.getList()
this.resetCodeForm()
this.reset()
this.numTableList = []
this.deviceType = {}
})
} else {
//
SavePutInfoDto = {
isCode: true, //
putInType: this.codeForm.putInType,
typeId: this.codeForm.typeId,
num: this.codeForm.num,
remarks: this.codeForm.remarks || '',
machIneDtoList: this.codeTableList,
checkMan: this.codeForm.checkMan || '',
}
console.log('🚀 ~ submitForm: ~ SavePutInfoDto', SavePutInfoDto)
if (this.codeTableList.length == 0) {
this.$message.error('请点击填充按钮, 填充数据')
return
}
//
inputByCode(SavePutInfoDto).then(response => {
this.$message.success('入库成功')
this.codeOpen = false
this.getList()
this.resetCodeForm()
this.reset()
this.codeTableList = []
this.deviceType = {}
})
}
console.log('🚀 ~ submitForm: ~ SavePutInfoDto', SavePutInfoDto)
if (this.codeTableList.length == 0) {
this.$message.error('请点击填充按钮, 填充数据')
return
}
//
inputByCode(SavePutInfoDto).then(response => {
this.$message.success('入库成功')
this.codeOpen = false
this.getList()
this.resetCodeForm()
this.reset()
this.codeTableList = []
this.deviceType = {}
})
}
})
/* this.$refs["form"].validate(valid => {
@ -822,6 +903,27 @@ export default {
}
}); */
},
//
handlePutBlur(row) {
if (row.putInStoreNum > row.num) {
this.$message.error('入库数量不能大于当前库存')
row.putInStoreNum = row.num
}
if (!row.putInStoreNum) {
this.$message.warning('入库数量不能为空')
row.putInStoreNum = 1
}
},
//
handleDeleteRow(index) {
this.numTableList.splice(index, 1)
setTimeout(() => {
this.$message.success('删除成功')
}, 50)
},
cancelPop() {
this.$message.info('取消删除')
},
/** 删除按钮操作 */
handleDelete(row) {
const dictIds = row.dictId || this.ids;
@ -875,12 +977,14 @@ export default {
)
console.log('🚀 ~ deviceTypeChange ~ this.leaseApplyDetails:', this.leaseApplyDetails);
// this.deviceType = {}
this.numTable = this.handelTableItemData(nodes[0])
},
////
handelTableItemData(node){
const template = JSON.parse(JSON.stringify(this.leaseApplyDetailsItem))
// template.createBy = this.user.name
console.log('🚀 ~ handelTableItemData ~ node.data, node.data.id:', node.data, node.data.id);
console.log('🚀 ~ handelTableItemData ~ node.data, node.data.id:', node.data, node.data.id, node);
this.codeForm.typeId = node.data.id
template.num = node.data.num
template.companyId = node.data.companyId
@ -888,6 +992,7 @@ export default {
template.unitCn = node.data.unitName
template.typeCn = node.pathLabels[2]
template.guigeCn = node.pathLabels[3]
template.putInStoreNum = 1
if(this.taskId){
const index = this.leaseApplyInfoList.find(key => key.companyId == node.data.companyId)