151 lines
6.1 KiB
Plaintext
151 lines
6.1 KiB
Plaintext
@model HHWMS.Web.ReceiptHeaderVM
|
|
|
|
<el-row id="count" :gutter="20">
|
|
<el-col :span="14">
|
|
<el-card class="box-card">
|
|
<el-table :data="tableData" height="450" border
|
|
style="width: 100%">
|
|
<el-table-column label="唯一码" width="220" 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="MaterialSpec"></el-table-column>
|
|
<el-table-column label="批次" align="center" prop="Batch"></el-table-column>
|
|
<el-table-column label="数量" align="center" prop="Qty"></el-table-column>
|
|
</el-table>
|
|
</el-card>
|
|
</el-col>
|
|
<el-col :span="10">
|
|
<el-card class="box-card">
|
|
<el-form ref="form" :model="form" label-width="100px">
|
|
<el-form-item label="唯一码" prop="uniqueCode">
|
|
<el-input v-model="form.uniqueCode" ref="uniqueCode" placeholder="唯一码" @@change="scanUniqueCode"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="物料码" prop="materialCode">
|
|
<el-input v-model="form.materialCode"placeholder="物料码" readonly></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="规格型号" prop="materialSpec">
|
|
<el-input v-model="form.materialSpec" placeholder="规格型号" readonly></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="批次" prop="batch">
|
|
<el-input v-model="form.batch" placeholder="批次" readonly></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="数量" prop="qty">
|
|
<el-input v-model.number="form.qty" ref="qty" :placeholder="qtyPlaceholder"></el-input>
|
|
</el-form-item>
|
|
<el-form-item style="float:right">
|
|
<el-button type="primary" @@click="onSubmit">确定</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-card>
|
|
</el-col>
|
|
</el-row>
|
|
<script>
|
|
var str = "";
|
|
@{
|
|
<text>str = @Model.Entity.ID; </text>
|
|
}
|
|
|
|
var app = new Vue({
|
|
el: "#count",
|
|
data() {
|
|
return {
|
|
form: {
|
|
uniqueCode: "",
|
|
materialCode: "",
|
|
materialSpec: "",
|
|
batch: "",
|
|
qty: ""
|
|
},
|
|
tableData: [],
|
|
qtyPlaceholder:"数量"
|
|
};
|
|
},
|
|
mounted: function () {
|
|
// 获取所有单据明细
|
|
$.ajax({
|
|
type: "post",
|
|
dataType: "json",
|
|
data:{ id: str },
|
|
url: "/receipt/ReceiptHeader/SelectReceiptDetailsByCode",
|
|
success: function (json) {
|
|
app.tableData = json.Data;
|
|
},
|
|
error: function (json) {
|
|
console.log("加载失败");
|
|
}
|
|
});
|
|
this.$nextTick(() => {
|
|
this.$refs.uniqueCode.focus()
|
|
})
|
|
},
|
|
methods: {
|
|
// 绑定
|
|
onSubmit() {
|
|
var _this = this;
|
|
var qty = _this.form.qty;
|
|
if (qty == "")
|
|
qty = parseInt(_this.qtyPlaceholder);
|
|
// 提交已绑定数据
|
|
$.ajax({
|
|
type: "post",
|
|
dataType: "json",
|
|
data: { code: str, uniqueCode: _this.form.uniqueCode, qty: qty },
|
|
url: "/receipt/ReceiptHeader/CountCommit",
|
|
success: function (json) {
|
|
if (json.Code == 200) {
|
|
_this.$message({
|
|
message: "点数成功!",
|
|
});
|
|
var isExit = _this.tableData.findIndex(function (value) {
|
|
return value.UniqueCode == _this.form.uniqueCode;
|
|
});
|
|
_this.tableData[isExit].Qty = qty;
|
|
_this.$refs['form'].resetFields();
|
|
_this.qtyPlaceholder = "数量";
|
|
_this.$refs.uniqueCode.focus();
|
|
} else {
|
|
_this.$message({
|
|
message: "失败!",
|
|
type: "warning",
|
|
duration: "10000",
|
|
});
|
|
}
|
|
},
|
|
error: function (json) {
|
|
_this.$message({
|
|
message: "失败!",
|
|
type: "error",
|
|
duration: "10000",
|
|
});
|
|
},
|
|
});
|
|
},
|
|
|
|
// 扫描唯一码
|
|
scanUniqueCode(data) {
|
|
var _this = this;
|
|
|
|
//1. 判断唯一码是否合理,调用后台,并返回唯一码对应的数量
|
|
var isExit = this.tableData.findIndex(function (value) {
|
|
return value.UniqueCode == data;
|
|
})
|
|
if (isExit != -1) {
|
|
var dd = this.tableData[isExit];
|
|
this.form.materialCode = dd.MaterialCode;
|
|
this.form.materialSpec = dd.MaterialSpec;
|
|
this.form.batch = dd.Batch;
|
|
this.qtyPlaceholder = dd.Qty;
|
|
_this.$refs.qty.focus();
|
|
}
|
|
else {
|
|
this.$message({
|
|
message: '唯一码' + data + '在此入库单据中不存在!',
|
|
type: 'warning'
|
|
});
|
|
this.$refs['form'].resetFields();
|
|
return;
|
|
}
|
|
},
|
|
},
|
|
});
|
|
</script>
|