|
|
|
|
@ -2,7 +2,10 @@ |
|
|
|
|
<div class="app-container"> |
|
|
|
|
<!-- 盘点录入 --> |
|
|
|
|
<div class="search-box"> |
|
|
|
|
<el-form :inline="true" :model="enterForm"> |
|
|
|
|
<el-form |
|
|
|
|
:inline="true" |
|
|
|
|
:model="enterForm" |
|
|
|
|
> |
|
|
|
|
<el-form-item label="单据编号"> |
|
|
|
|
<el-input |
|
|
|
|
v-model="enterForm.invOrderNo" |
|
|
|
|
@ -10,9 +13,26 @@ |
|
|
|
|
clearable |
|
|
|
|
></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="物料"> |
|
|
|
|
<el-input |
|
|
|
|
v-model="enterForm.invOrderNo" |
|
|
|
|
placeholder="请输入物料" |
|
|
|
|
clearable |
|
|
|
|
></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="货位"> |
|
|
|
|
<el-input |
|
|
|
|
v-model="enterForm.locationCode" |
|
|
|
|
placeholder="请输货位" |
|
|
|
|
clearable |
|
|
|
|
></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item> |
|
|
|
|
<el-button type="primary" @click="queryTable">搜索</el-button> |
|
|
|
|
<el-button |
|
|
|
|
type="primary" |
|
|
|
|
@click="queryTable" |
|
|
|
|
>搜索</el-button> |
|
|
|
|
<el-button @click="resetQuery">重置</el-button> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
@ -25,16 +45,14 @@ |
|
|
|
|
type="primary" |
|
|
|
|
@click="calce" |
|
|
|
|
:disabled="!handleSelect.length != 0" |
|
|
|
|
>取消盘点</el-button |
|
|
|
|
> |
|
|
|
|
>取消盘点</el-button> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="1.5"> |
|
|
|
|
<el-button |
|
|
|
|
type="primary" |
|
|
|
|
:disabled="!handleSelect.length != 0" |
|
|
|
|
@click="generateThePlan" |
|
|
|
|
>保存</el-button |
|
|
|
|
> |
|
|
|
|
>执行</el-button> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
</div> |
|
|
|
|
@ -101,21 +119,16 @@ |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<script> |
|
|
|
|
import { tableConfig } from "./config.js"; |
|
|
|
|
import { list, cancel, entrySave } from "@/api/libraryManage/inventory"; |
|
|
|
|
import { Debounce, getDictLabel } from "@/utils/index"; |
|
|
|
|
import { tableConfig } from './config.js' |
|
|
|
|
import { list, cancel, entrySave } from '@/api/libraryManage/inventory' |
|
|
|
|
import { Debounce, getDictLabel } from '@/utils/index' |
|
|
|
|
export default { |
|
|
|
|
name: "", |
|
|
|
|
dicts: [ |
|
|
|
|
"goods_storage_conditions", |
|
|
|
|
"goods_classify", |
|
|
|
|
"goods_unit", |
|
|
|
|
"inv_type_dict", |
|
|
|
|
], |
|
|
|
|
name: '', |
|
|
|
|
dicts: ['goods_storage_conditions', 'goods_classify', 'goods_unit', 'inv_type_dict'], |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
enterForm: { |
|
|
|
|
invOrderNo: "", |
|
|
|
|
invOrderNo: '' |
|
|
|
|
}, |
|
|
|
|
selectData: [], |
|
|
|
|
tableForm: { tableData: [] }, |
|
|
|
|
@ -125,115 +138,98 @@ export default { |
|
|
|
|
paging: { |
|
|
|
|
page: 1, // 当前页 |
|
|
|
|
size: 10, // 页面大小 |
|
|
|
|
total: 0, |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
total: 0 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted() {}, |
|
|
|
|
async created() { |
|
|
|
|
this.queryTable(); |
|
|
|
|
this.queryTable() |
|
|
|
|
|
|
|
|
|
this.tableConfig = await this.getTableHeaderCom( |
|
|
|
|
"busin_inventory_add", |
|
|
|
|
tableConfig.call(this), |
|
|
|
|
"configEntry" |
|
|
|
|
); |
|
|
|
|
this.tableConfig = await this.getTableHeaderCom('busin_inventory_add', tableConfig.call(this), 'configEntry') |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
// 表格的数据 |
|
|
|
|
queryTable() { |
|
|
|
|
// if (!this.enterForm.invOrderNo) return this.$message("单据编号必填!"); |
|
|
|
|
this.loading = true; |
|
|
|
|
this.loading = true |
|
|
|
|
list({ |
|
|
|
|
invWay: "open", |
|
|
|
|
...this.enterForm, |
|
|
|
|
invWay: 'open', |
|
|
|
|
...this.enterForm |
|
|
|
|
}) |
|
|
|
|
.then((response) => { |
|
|
|
|
if (response.code === 200) { |
|
|
|
|
this.loading = false; |
|
|
|
|
this.tableForm.tableData = response.rows; |
|
|
|
|
this.loading = false |
|
|
|
|
this.tableForm.tableData = response.rows |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.catch(() => { |
|
|
|
|
this.loading = false; |
|
|
|
|
}); |
|
|
|
|
this.loading = false |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 表格复选框选中 |
|
|
|
|
handleselection(val) { |
|
|
|
|
this.selectData = val; |
|
|
|
|
this.handleSelect = val.map((ele) => ele.id); |
|
|
|
|
this.selectData = val |
|
|
|
|
this.handleSelect = val.map((ele) => ele.id) |
|
|
|
|
}, |
|
|
|
|
// 重置 |
|
|
|
|
resetQuery() { |
|
|
|
|
this.enterForm = {}; |
|
|
|
|
this.enterForm = {} |
|
|
|
|
}, |
|
|
|
|
onCalc3(row, prop) { |
|
|
|
|
if (row.storageClassify === "0") { |
|
|
|
|
if (row.storageClassify === '0') { |
|
|
|
|
//整散分开 |
|
|
|
|
if ( |
|
|
|
|
prop === "invCase" && |
|
|
|
|
Number(row.invCase) !== 0 && |
|
|
|
|
Number(row.invPiece) !== 0 |
|
|
|
|
) { |
|
|
|
|
this.$message.warning("整件和零散数不能同时录入"); |
|
|
|
|
if (prop === 'invCase' && Number(row.invCase) !== 0 && Number(row.invPiece) !== 0) { |
|
|
|
|
this.$message.warning('整件和零散数不能同时录入') |
|
|
|
|
// row.invCase = 0; |
|
|
|
|
} else if ( |
|
|
|
|
prop === "invPiece" && |
|
|
|
|
Number(row.invCase) !== 0 && |
|
|
|
|
Number(row.invPiece) !== 0 |
|
|
|
|
) { |
|
|
|
|
this.$message.warning("整件和零散数不能同时录入"); |
|
|
|
|
} else if (prop === 'invPiece' && Number(row.invCase) !== 0 && Number(row.invPiece) !== 0) { |
|
|
|
|
this.$message.warning('整件和零散数不能同时录入') |
|
|
|
|
// row.invPiece = 0; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// //整散合一 |
|
|
|
|
} |
|
|
|
|
// 计算数量(件装量不可输入,只有件数,零散数可以输入。数量是根据件数*件装量+零散数算出来的) |
|
|
|
|
const [invCase, invPiece] = [row.invCase || 0, row.invPiece || 0]; |
|
|
|
|
row.invQty = Math.round( |
|
|
|
|
Number(invCase) * Number(row.packageQty) + Number(invPiece) |
|
|
|
|
); |
|
|
|
|
const [invCase, invPiece] = [row.invCase || 0, row.invPiece || 0] |
|
|
|
|
row.invQty = Math.round(Number(invCase) * Number(row.packageQty) + Number(invPiece)) |
|
|
|
|
}, |
|
|
|
|
onCalc2(row) { |
|
|
|
|
// 算出件数和零散数 件数=数量/包装数 零散数=数量%包装数 |
|
|
|
|
const [invQty, packageQty] = [row.invQty || 0, row.packageQty || 0]; |
|
|
|
|
row.invCase = Number(Math.floor(invQty / packageQty)); //向下取整 1.5 1 |
|
|
|
|
row.invPiece = Number(invQty - packageQty * row.invCase); |
|
|
|
|
const [invQty, packageQty] = [row.invQty || 0, row.packageQty || 0] |
|
|
|
|
row.invCase = Number(Math.floor(invQty / packageQty)) //向下取整 1.5 1 |
|
|
|
|
row.invPiece = Number(invQty - packageQty * row.invCase) |
|
|
|
|
}, |
|
|
|
|
// 部分校验 |
|
|
|
|
validateField(form, index, prop) { |
|
|
|
|
let result = true; |
|
|
|
|
let result = true |
|
|
|
|
for (let item of this.$refs[form].fields) { |
|
|
|
|
if (prop) { |
|
|
|
|
if ( |
|
|
|
|
item.prop.split(".")[1] == index && |
|
|
|
|
item.prop.split(".")[2] !== prop |
|
|
|
|
) { |
|
|
|
|
if (item.prop.split('.')[1] == index && item.prop.split('.')[2] !== prop) { |
|
|
|
|
this.$refs[form].validateField(item.prop, (err) => { |
|
|
|
|
if (err != "") { |
|
|
|
|
result = false; |
|
|
|
|
if (err != '') { |
|
|
|
|
result = false |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (item.prop.split(".")[1] == index) { |
|
|
|
|
if (item.prop.split('.')[1] == index) { |
|
|
|
|
this.$refs[form].validateField(item.prop, (err) => { |
|
|
|
|
if (err != "") { |
|
|
|
|
result = false; |
|
|
|
|
if (err != '') { |
|
|
|
|
result = false |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// if (!result) break; |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
return result |
|
|
|
|
}, |
|
|
|
|
// 保存 |
|
|
|
|
async generateThePlan() { |
|
|
|
|
let arr = []; |
|
|
|
|
let arr = [] |
|
|
|
|
this.selectData.forEach((ele, index) => { |
|
|
|
|
arr.push(this.validateField("tableForm", index)); |
|
|
|
|
}); |
|
|
|
|
arr.push(this.validateField('tableForm', index)) |
|
|
|
|
}) |
|
|
|
|
if (arr.some((k) => !k)) { |
|
|
|
|
// 校验的某一行有不通过的就都不通过 |
|
|
|
|
} else { |
|
|
|
|
@ -241,20 +237,20 @@ export default { |
|
|
|
|
// let valid2 = this.selectData.some((ele) => Number(ele.invPiece) === 0); |
|
|
|
|
// let valid3 = this.selectData.some((ele) => Number(ele.invQty) === 0); |
|
|
|
|
// if (!valid1 && !valid2 && !valid3) { |
|
|
|
|
let arr2 = []; |
|
|
|
|
let arr2 = [] |
|
|
|
|
this.selectData.forEach((ele, index) => { |
|
|
|
|
let obj = { |
|
|
|
|
id: ele.id, |
|
|
|
|
invQty: ele.invQty, |
|
|
|
|
invCase: ele.invCase, |
|
|
|
|
invPiece: ele.invPiece, |
|
|
|
|
}; |
|
|
|
|
arr2.push(obj); |
|
|
|
|
}); |
|
|
|
|
invPiece: ele.invPiece |
|
|
|
|
} |
|
|
|
|
arr2.push(obj) |
|
|
|
|
}) |
|
|
|
|
// 获取货主ids |
|
|
|
|
const { rows } = await entrySave(arr2); |
|
|
|
|
this.$message.success("操作成功"); |
|
|
|
|
this.queryTable(); |
|
|
|
|
const { rows } = await entrySave(arr2) |
|
|
|
|
this.$message.success('操作成功') |
|
|
|
|
this.queryTable() |
|
|
|
|
// } else { |
|
|
|
|
// this.$message.warning("必填项不能为0"); |
|
|
|
|
// } |
|
|
|
|
@ -262,13 +258,13 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 取消盘点 |
|
|
|
|
calce() { |
|
|
|
|
this.$confirm("是否确认删除所选明细?", "提示", { |
|
|
|
|
confirmButtonText: "确定", |
|
|
|
|
cancelButtonText: "取消", |
|
|
|
|
type: "warning", |
|
|
|
|
this.$confirm('是否确认删除所选明细?', '提示', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'warning' |
|
|
|
|
}).then(async () => { |
|
|
|
|
this.remove(this.handleSelect); |
|
|
|
|
}); |
|
|
|
|
this.remove(this.handleSelect) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 取消盘点请求 |
|
|
|
|
remove() { |
|
|
|
|
@ -276,17 +272,17 @@ export default { |
|
|
|
|
.then((response) => { |
|
|
|
|
if (response.code === 200) { |
|
|
|
|
this.$message({ |
|
|
|
|
message: "操作成功!", |
|
|
|
|
type: "success", |
|
|
|
|
}); |
|
|
|
|
this.queryTable(); |
|
|
|
|
message: '操作成功!', |
|
|
|
|
type: 'success' |
|
|
|
|
}) |
|
|
|
|
this.queryTable() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.catch(() => { |
|
|
|
|
this.loading = false; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
this.loading = false |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped></style> |
|
|
|
|
|