Files
zhougf 5b1912ff07 计数:已操作的改个颜色
打印:两个二维码打到一个标签上,显示唯一码内容
货架入库:自动滚到最新数据,添加托盘信息
分解单据:不查找货架库库存
货架出库:添加导出excel
2024-04-29 16:21:44 +08:00

199 lines
7.5 KiB
Plaintext

<el-row id="shelfapp">
<el-card class="box-card" :span="16">
<el-form ref="form" :model="form" label-width="100px" @@submit.native.prevent>
<el-row>
<el-col :span="16">
<el-form-item label="位置" prop="locationCode">
<el-input v-model="form.locationCode"
ref="locationCode">
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="16">
<el-form-item label="唯一码" prop="uniqueCode">
<el-input v-model="form.uniqueCode"
@@change="scanUniqueCode"
ref="uniqueCode">
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-table :data="bindingData"
ref="tableData"
stripe max-height="450" border style="width: 100%">
<el-table-column type="index"
width="50">
</el-table-column>
<el-table-column fixed="left" label="操作" width="120" align="center">
<template slot-scope="scope">
<el-button @@click.native.prevent="deleteRow(scope.$index, bindingData)"
type="text"
size="small">
移除
</el-button>
</template>
</el-table-column>
<el-table-column label="位置"
align="center"
prop="boxCode">
</el-table-column>
<el-table-column label="唯一码"
align="center"
prop="uniqueCode">
</el-table-column>
<el-table-column label="物料码"
align="center"
prop="materialCode">
</el-table-column>
<el-table-column label="名称"
align="center"
prop="materialName">
</el-table-column>
<el-table-column label="数量"
align="center"
prop="bindQty">
</el-table-column>
</el-table>
<el-form-item style="float: right">
<el-button type="primary" @@click="onSubmit">入库</el-button>
<el-button @@click="resetForm('form')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</el-row>
<script>
var app = new Vue({
el: "#shelfapp",
data() {
return {
form: {
uniqueCode: "",
locationCode: ""
},
bindingData: []
};
},
mounted: function () {
// 获取所有单据编码
// $.ajax({
// type: "post",
// dataType: "json",
// data:{},
// url: "/receipt/ReceiptIn/SelectReceiptCode",
// success: function (json) {
// app.options = json.Data;
// },
// error: function (json) {
// alert("加载失败");
// }
// });
},
methods: {
// 绑定
onSubmit() {
var _this = this;
// 提交已绑定数据
$.ajax({
type: "post",
dataType: "json",
data: { data: _this.bindingData },
url: "/receipt/ReceiptShelfIn/BindingData",
success: function (json) {
if (json.Code == 200) {
_this.$message({
message: "入库成功!",
});
_this.bindingData = [];
} else {
_this.$message({
message: "入库失败!",
type: "warning",
duration: "10000",
});
}
},
error: function (json) {
_this.$message({
message: "入库失败!",
type: "error",
duration: "10000",
});
},
});
},
// 重置
resetForm(formName) {
this.$refs[formName].resetFields();
this.bindingData = [];
},
// 扫描唯一码
scanUniqueCode(data) {
var _this = this;
//1. 判断唯一码是否合理,调用后台,并返回唯一码对应的数量
var isExit = this.bindingData.findIndex(function (value) {
return value.uniqueCode == data;
})
if (isExit != -1) {
this.$message({
message: '唯一码' + data + '已绑定!',
type: 'warning'
});
this.form.uniqueCode = '';
return;
}
$.ajax({
type: "post",
dataType: "json",
data: { uniqueCode: _this.form.uniqueCode },
url: "/receipt/ReceiptShelfIn/ScanUniqueCode",
success: function (json) {
if (json.Code != 200) {
_this.$message({
message: json.Msg,
type: "warning",
duration: "10000",
});
_this.form.uniqueCode = '';
} else {
// 3.已扫描增加
_this.bindingData.push({
receiptCode: json.Data.ReceiptHeaderId,
uniqueCode: json.Data.UniqueCode,
materialCode: json.Data.MaterialCode,
materialName: json.Data.MaterialName,
batch: json.Data.Batch,
bindQty: json.Data.Qty,
boxCode: _this.form.locationCode
});
_this.$nextTick(() => {
_this.$refs.tableData.bodyWrapper.scrollTop = _this.$refs.tableData.bodyWrapper.scrollHeight
})
}
},
error: function (json) {
_this.$message({
message: "扫描失败!",
type: "error",
duration: "10000",
});
},
});
this.form.uniqueCode = "";
},
// 删除已绑定行
deleteRow(index, rows) {
rows.splice(index, 1);
},
},
});
</script>