313 lines
12 KiB
Plaintext
313 lines
12 KiB
Plaintext
<el-row id="opapp">
|
|
<el-card class="box-card" :span="16">
|
|
<el-table :data="tableData" ref="multipleTable" border style="width: 100%" @@selection-change="handleSelectionChange">
|
|
>
|
|
<el-table-column type="selection"
|
|
width="55">
|
|
</el-table-column>
|
|
<el-table-column prop="boxName" label="周转箱" align="center">
|
|
</el-table-column>
|
|
|
|
<el-table-column label="工位" align="center" prop="station">
|
|
<template slot-scope="scope">
|
|
<el-select v-model="scope.row.station" size="medium" style="width:100%">
|
|
<el-option v-for="item in station" :key="item.label" :label="item.label" :value="item.value">
|
|
</el-option>
|
|
</el-select>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<div style="margin-top: 20px">
|
|
<el-button type="primary" @@click="inOperation()">启动入库</el-button>
|
|
</div>
|
|
</el-card>
|
|
</el-row>
|
|
|
|
<script>
|
|
var app = new Vue({
|
|
el: "#opapp",
|
|
data() {
|
|
return {
|
|
station: [
|
|
{
|
|
label: 'left',
|
|
value: 1,
|
|
},
|
|
{
|
|
label: 'right',
|
|
value: 3,
|
|
},
|
|
|
|
],
|
|
// 表格数据
|
|
tableData: [
|
|
{
|
|
boxName: 'M00000001',
|
|
station: '',
|
|
},
|
|
{
|
|
boxName: 'E00000001',
|
|
station: '',
|
|
},
|
|
],
|
|
selectData: []
|
|
};
|
|
},
|
|
mounted: function () {
|
|
// 获取所有单据编码
|
|
// $.ajax({
|
|
// type: "post",
|
|
// dataType: "json",
|
|
// data:{},
|
|
// url: "/receipt/ReceiptIn/SelectReceiptCode",
|
|
// success: function (json) {
|
|
// app.options = json.Data;
|
|
// },
|
|
// error: function (json) {
|
|
// alert("加载失败");
|
|
// }
|
|
// });
|
|
},
|
|
methods: {
|
|
handleSelectionChange(val) {
|
|
val.forEach(row => {
|
|
if (row.station == '') {
|
|
this.$refs.multipleTable.toggleRowSelection(row);
|
|
this.$message({
|
|
message: "此周转箱没有选择站台!",
|
|
type: "warning",
|
|
duration: "5000",
|
|
});
|
|
}
|
|
});
|
|
this.selectData = val;
|
|
console.log(this.selectData);
|
|
},
|
|
// 呼叫料箱
|
|
callBox() {
|
|
var _this = this;
|
|
$.ajax({
|
|
type: "post",
|
|
dataType: "json",
|
|
data: {},
|
|
url: "/receipt/ReceiptSLIn/CallBox",
|
|
success: function (json) {
|
|
if (json.Code == 200) {
|
|
_this.$message({
|
|
message: "呼叫成功!",
|
|
});
|
|
// _this.resetForm('form');
|
|
} else {
|
|
_this.$message({
|
|
message: "呼叫失败!" + json.Msg,
|
|
type: "warning",
|
|
duration: "10000",
|
|
});
|
|
}
|
|
},
|
|
error: function (json) {
|
|
_this.$message({
|
|
message: "呼叫失败!",
|
|
type: "error",
|
|
duration: "10000",
|
|
});
|
|
},
|
|
});
|
|
},
|
|
// 扫描散料箱
|
|
scanBox(data) {
|
|
var _this = this;
|
|
$.ajax({
|
|
type: "post",
|
|
dataType: "json",
|
|
data: { boxCode: _this.form.code },
|
|
url: "/receipt/ReceiptSLIn/ScanBox",
|
|
success: function (json) {
|
|
if (json.Code != 200) {
|
|
_this.$message({
|
|
message: "扫描失败!" + json.Msg,
|
|
type: "warning",
|
|
duration: "10000",
|
|
});
|
|
}
|
|
else {
|
|
_this.$refs.uniqueCode.focus();
|
|
}
|
|
},
|
|
error: function (json) {
|
|
_this.$message({
|
|
message: "扫描失败!",
|
|
type: "error",
|
|
duration: "10000",
|
|
});
|
|
},
|
|
});
|
|
},
|
|
sizeFormatter(row) {
|
|
var rr = this.boxSize.filter((item) => item.value == row.size)[0].label;
|
|
return rr;
|
|
},
|
|
// 绑定
|
|
onSubmit() {
|
|
var _this = this;
|
|
|
|
// 提交已绑定数据
|
|
$.ajax({
|
|
type: "post",
|
|
dataType: "json",
|
|
data: { data: _this.bindingData },
|
|
url: "/receipt/ReceiptSLIn/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.boxSize = [];
|
|
this.bindingData = [];
|
|
},
|
|
// 选择尺寸后
|
|
changeSize() {
|
|
this.$refs.uniqueCode.focus();
|
|
},
|
|
// 扫描唯一码
|
|
scanUniqueCode(data) {
|
|
var _this = this;
|
|
// 1. 判断条件
|
|
if (this.form.code == "" || this.form.size == "") {
|
|
this.$message({
|
|
message: "请先扫描料箱箱编码并选择物料尺寸!",
|
|
type: "warning",
|
|
});
|
|
this.form.uniqueCode = "";
|
|
return;
|
|
}
|
|
//2. 判断唯一码是否合理,调用后台,并返回唯一码对应的数量
|
|
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/ReceiptSLIn/ScanUniqueCode",
|
|
success: function (json) {
|
|
if (json.Code != 200) {
|
|
_this.$message({
|
|
message: json.Msg,
|
|
type: "warning",
|
|
duration: "10000",
|
|
});
|
|
} else {
|
|
// 3.已扫描增加
|
|
_this.bindingData.push({
|
|
receiptCode: json.Data.ReceiptHeaderId,
|
|
boxCode: _this.form.code,
|
|
uniqueCode: data,
|
|
qty: json.Data.Qty - json.Data.CompletedQty,
|
|
bindQty: json.Data.Qty - json.Data.CompletedQty,
|
|
size: _this.form.size,
|
|
});
|
|
}
|
|
},
|
|
error: function (json) {
|
|
_this.$message({
|
|
message: "扫描失败!",
|
|
type: "error",
|
|
duration: "10000",
|
|
});
|
|
},
|
|
});
|
|
|
|
this.form.uniqueCode = "";
|
|
},
|
|
// 删除已绑定行
|
|
deleteRow(index, rows) {
|
|
rows.splice(index, 1);
|
|
},
|
|
handleEdit(index, row) {
|
|
console.log(index, row, this.bindingData);
|
|
if (row.qty < row.bindQty) {
|
|
this.$message({
|
|
message: "数量不能大于剩余绑定数量!" + row.qty,
|
|
type: "warning",
|
|
duration: "1000",
|
|
});
|
|
this.bindingData[index].bindQty = row.qty;
|
|
}
|
|
else if (row.bindQty <= 0) {
|
|
this.bindingData[index].bindQty = row.qty;
|
|
}
|
|
},
|
|
// 回库
|
|
back() {
|
|
var _this = this;
|
|
// 创建回库任务
|
|
if (_this.code == "") {
|
|
_this.$message({
|
|
message: "箱号为空,不能创建回库任务!",
|
|
type: "error",
|
|
duration: "1000",
|
|
});
|
|
return;
|
|
}
|
|
$.ajax({
|
|
type: "post",
|
|
dataType: "json",
|
|
data: { boxCode: _this.form.code, isFull: _this.form.isFull },
|
|
url: "/receipt/ReceiptSLIn/BoxBack",
|
|
success: function (json) {
|
|
if (json.Code != 200) {
|
|
_this.$message({
|
|
message: "回库任务创建失败!" + json.Msg,
|
|
type: "warning",
|
|
duration: "10000",
|
|
});
|
|
} else {
|
|
_this.$message({
|
|
message: "回库任务创建成功!"
|
|
});
|
|
_this.resetForm('form');
|
|
}
|
|
},
|
|
error: function (json) {
|
|
_this.$message({
|
|
message: "回库任务创建失败!",
|
|
type: "error",
|
|
duration: "10000",
|
|
});
|
|
},
|
|
});
|
|
}
|
|
},
|
|
});
|
|
</script>
|