数量盘点入库

This commit is contained in:
binbin_pan 2024-04-01 17:51:01 +08:00 committed by liang.chao
parent 867aab7c4f
commit e8969befbc
1 changed files with 179 additions and 74 deletions

View File

@ -197,7 +197,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="7"> <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 <el-input-number
v-model="codeForm.num" v-model="codeForm.num"
placeholder="请输入待入库总数" placeholder="请输入待入库总数"
@ -215,7 +215,7 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="7"> <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 <el-input
v-model="codeForm.codePrefix" v-model="codeForm.codePrefix"
placeholder="请输入前缀" placeholder="请输入前缀"
@ -227,7 +227,7 @@
</el-col> </el-col>
<el-col :span="10"> <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 <el-input
v-model="codeForm.codeSuffixStart" v-model="codeForm.codeSuffixStart"
clearable clearable
@ -237,7 +237,7 @@
@input="changeInput(codeForm.codeSuffixStart)" @input="changeInput(codeForm.codeSuffixStart)"
/> />
</el-form-item> </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 <el-input
v-model="codeForm.codeSuffixEnd" v-model="codeForm.codeSuffixEnd"
clearable clearable
@ -249,7 +249,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="7"> <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 <el-input-number
v-model="codeForm.buyPrice" v-model="codeForm.buyPrice"
:precision="2" :precision="2"
@ -266,7 +266,7 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="7"> <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 <el-select
v-model="codeForm.codeFactory" v-model="codeForm.codeFactory"
placeholder="请选择厂家" placeholder="请选择厂家"
@ -283,7 +283,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="10"> <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 <el-date-picker
v-model="codeForm.thisCheckFixTime" v-model="codeForm.thisCheckFixTime"
type="date" type="date"
@ -294,7 +294,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="7"> <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 <el-date-picker
v-model="codeForm.nextCheckFixTime" v-model="codeForm.nextCheckFixTime"
type="date" type="date"
@ -308,12 +308,12 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="7"> <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-input v-model="codeForm.checkMan" placeholder="请输入检验人" clearable style="width: 220px;" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="isNumCheck ? 7 : 10">
<el-form-item label="备注" label-width="130px" prop="remarks"> <el-form-item label="备注" label-width="130px" prop="remarks">
<el-input <el-input
v-model="codeForm.remarks" v-model="codeForm.remarks"
@ -322,7 +322,7 @@
maxlength="200" maxlength="200"
rows="4" rows="4"
show-word-limit show-word-limit
style="width: 400px" :style="{ width: isNumCheck ? '220px' : '400px' }"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
@ -365,21 +365,22 @@
>导出</el-button> >导出</el-button>
</el-col> </el-col>
</el-row> --> </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 type="selection" width="55" align="center" /> -->
<el-table-column label="序号" align="center" type="index" /> <el-table-column label="序号" align="center" type="index" />
<el-table-column label="设备编码" align="center" prop="maCode" :show-overflow-tooltip="true"> <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> <el-input v-model="row.maCode" placeholder="请输入设备编码"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="出厂编码" align="center" prop="outFacCode" :show-overflow-tooltip="true"> <el-table-column label="出厂编码" align="center" prop="outFacCode" :show-overflow-tooltip="true">
<template v-slot:default="{ row }"> <template v-slot:default="{ row }" v-if="!isNumCheck">
<el-input v-model="row.outFacCode" placeholder="请输入设备编码"></el-input> <el-input v-model="row.outFacCode" placeholder="请输入出厂编码"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="生产厂家" align="center" prop="maVender" :show-overflow-tooltip="true"> <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-select v-model="row.maVender" placeholder="请选择生产厂家" clearable filterable>
<el-option <el-option
v-for="item in supplierList" v-for="item in supplierList"
@ -391,7 +392,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="检验日期" align="center" prop="thisCheckFixTime" :show-overflow-tooltip="true"> <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 <el-date-picker
v-model="row.thisCheckFixTime" v-model="row.thisCheckFixTime"
type="date" type="date"
@ -402,7 +403,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="下次检验日期" align="center" prop="nextCheckFixTime" :show-overflow-tooltip="true"> <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 <el-date-picker
v-model="row.nextCheckFixTime" v-model="row.nextCheckFixTime"
type="date" type="date"
@ -413,7 +414,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="单价" align="center" prop="buyPrice" :show-overflow-tooltip="true"> <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 <el-input-number
v-model="row.buyPrice" v-model="row.buyPrice"
:precision="2" :precision="2"
@ -457,6 +458,43 @@
</el-table-column> </el-table-column>
</el-table> </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 <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
@ -511,6 +549,9 @@ export default {
returnList: [], returnList: [],
// //
codeTableList: [], codeTableList: [],
//
numTableList: [],
numTable: {},
// //
title: "", title: "",
// //
@ -523,6 +564,8 @@ export default {
codeOpen: false, codeOpen: false,
// //
dateRange: [], dateRange: [],
isNumCheck: false,
isAdd: false,
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
@ -642,7 +685,9 @@ export default {
this.deviceType = {} this.deviceType = {}
this.reset(); this.reset();
this.codeTableList = [] this.codeTableList = []
this.numTableList = []
this.$refs['codeForm'].clearValidate() this.$refs['codeForm'].clearValidate()
this.isNumCheck = false;
}, },
// //
reset() { reset() {
@ -681,17 +726,27 @@ export default {
}, },
/** 填充编码盘点表单 */ /** 填充编码盘点表单 */
fillCodeForm() { fillCodeForm() {
console.log('🚀 ~ fillCodeForm ~ this.isNumCheck:', this.isNumCheck);
// //
this.$refs['codeForm'].validate(valid => { this.$refs['codeForm'].validate(valid => {
if (!valid) return if (!valid) return
console.log('🚀 ~ fillCodeForm ~ this.codeForm:', this.codeForm); console.log('🚀 ~ fillCodeForm ~ this.codeForm:', this.codeForm);
// this.codeTableList // this.codeTableList
this.codeTableList = [] this.codeTableList = []
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 // this.codeForm.num, this.codeTableListthis.codeForm
for (let i = 0; i < this.codeForm.num; i++) { for (let i = 0; i < this.codeForm.num; i++) {
// : // :
let suffix = (parseInt(this.codeForm.codeSuffixStart) + i).toString().padStart(this.codeForm.codeSuffixStart?.length, '0') let suffix = (parseInt(this.codeForm.codeSuffixStart) + i).toString().padStart(this.codeForm.codeSuffixStart?.length, '0')
console.log('🚀 ~ fillCodeForm ~ suffix:', suffix); // console.log('🚀 ~ fillCodeForm ~ suffix:', suffix);
suffix = isNaN(suffix) ? '' : suffix suffix = isNaN(suffix) ? '' : suffix
const maCode = `${this.codeForm.codePrefix || ''}${suffix}` const maCode = `${this.codeForm.codePrefix || ''}${suffix}`
// //
@ -715,6 +770,7 @@ export default {
buyPrice buyPrice
}) })
} }
}
}) })
}, },
/** 输入框改变 */ /** 输入框改变 */
@ -743,12 +799,14 @@ export default {
}, },
/** 新增数量盘点按钮操作 */ /** 新增数量盘点按钮操作 */
handleNumberAdd() { handleNumberAdd() {
this.isNumCheck = true;
this.reset(); this.reset();
this.numberOpen = true; this.codeOpen = true;
this.title = "数量盘点入库"; this.title = "数量盘点入库";
}, },
/** 新增编号盘点按钮操作 */ /** 新增编号盘点按钮操作 */
handleCodeAdd() { handleCodeAdd() {
this.isNumCheck = false;
this.reset(); this.reset();
this.codeOpen = true; this.codeOpen = true;
this.title = "编码盘点入库"; this.title = "编码盘点入库";
@ -773,10 +831,32 @@ export default {
submitForm: function() { submitForm: function() {
this.$refs['codeForm'].validate(valid => { this.$refs['codeForm'].validate(valid => {
if (valid) { if (valid) {
let SavePutInfoDto = {}
console.log('🚀 ~ this.codeForm:', this.codeForm); console.log('🚀 ~ this.codeForm:', this.codeForm);
console.log('🚀 ~ this.codeTableList:', this.codeTableList); console.log('🚀 ~ this.codeTableList:', this.codeTableList);
console.log('🚀 ~ this.numTableList:', this.numTableList);
if (this.isNumCheck) {
// //
const SavePutInfoDto = { 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, // isCode: true, //
putInType: this.codeForm.putInType, putInType: this.codeForm.putInType,
typeId: this.codeForm.typeId, typeId: this.codeForm.typeId,
@ -803,6 +883,7 @@ export default {
this.deviceType = {} this.deviceType = {}
}) })
} }
}
}) })
/* this.$refs["form"].validate(valid => { /* this.$refs["form"].validate(valid => {
if (valid) { if (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) { handleDelete(row) {
const dictIds = row.dictId || this.ids; const dictIds = row.dictId || this.ids;
@ -875,12 +977,14 @@ export default {
) )
console.log('🚀 ~ deviceTypeChange ~ this.leaseApplyDetails:', this.leaseApplyDetails); console.log('🚀 ~ deviceTypeChange ~ this.leaseApplyDetails:', this.leaseApplyDetails);
// this.deviceType = {} // this.deviceType = {}
this.numTable = this.handelTableItemData(nodes[0])
}, },
//// ////
handelTableItemData(node){ handelTableItemData(node){
const template = JSON.parse(JSON.stringify(this.leaseApplyDetailsItem)) const template = JSON.parse(JSON.stringify(this.leaseApplyDetailsItem))
// template.createBy = this.user.name // 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 this.codeForm.typeId = node.data.id
template.num = node.data.num template.num = node.data.num
template.companyId = node.data.companyId template.companyId = node.data.companyId
@ -888,6 +992,7 @@ export default {
template.unitCn = node.data.unitName template.unitCn = node.data.unitName
template.typeCn = node.pathLabels[2] template.typeCn = node.pathLabels[2]
template.guigeCn = node.pathLabels[3] template.guigeCn = node.pathLabels[3]
template.putInStoreNum = 1
if(this.taskId){ if(this.taskId){
const index = this.leaseApplyInfoList.find(key => key.companyId == node.data.companyId) const index = this.leaseApplyInfoList.find(key => key.companyId == node.data.companyId)