<template>
|
<div>
|
<!-- 人工入库 -->
|
<vol-box
|
:lazy="true"
|
:width="400"
|
:height="300"
|
v-model="inbound.model"
|
title="人工入库"
|
:onModelClose="cancelIn"
|
>
|
<div style="padding: 10px 20px">
|
<vol-form
|
ref="sendInTask"
|
:formRules="inbound.data"
|
:formFields="inbound.fields"
|
></vol-form>
|
</div>
|
<template #footer>
|
<div>
|
<el-button
|
type="danger"
|
size="big"
|
icon="md-checkmark-circle"
|
long
|
@click="SendInTask"
|
>确认入库</el-button
|
>
|
<el-button
|
type="primary"
|
size="big"
|
icon="md-checkmark-circle"
|
long
|
@click="cancelIn"
|
>取消</el-button
|
>
|
</div>
|
</template>
|
</vol-box>
|
<!-- 人工出库 -->
|
<vol-box
|
:lazy="true"
|
:width="400"
|
:height="300"
|
v-model="outbound.model"
|
title="人工出库"
|
:onModelClose="cancelOut"
|
>
|
<div style="padding: 10px 20px">
|
<vol-form
|
ref="sendInTask"
|
:formRules="outbound.data"
|
:formFields="outbound.fields"
|
></vol-form>
|
</div>
|
<template #footer>
|
<div>
|
<el-button
|
type="danger"
|
size="big"
|
icon="md-checkmark-circle"
|
long
|
@click="SendOutTask"
|
>确认入库</el-button
|
>
|
<el-button
|
type="primary"
|
size="big"
|
icon="md-checkmark-circle"
|
long
|
@click="cancelOut"
|
>取消</el-button
|
>
|
</div>
|
</template>
|
</vol-box>
|
<!-- 人工移库 -->
|
<vol-box
|
:lazy="true"
|
:width="400"
|
:height="300"
|
v-model="transfer.model"
|
title="人工移库"
|
:onModelClose="cancelTransfer"
|
>
|
<div style="padding: 10px 20px">
|
<vol-form
|
ref="sendInTask"
|
:formRules="transfer.data"
|
:formFields="transfer.fields"
|
></vol-form>
|
</div>
|
<template #footer>
|
<div>
|
<el-button
|
type="danger"
|
size="big"
|
icon="md-checkmark-circle"
|
long
|
@click="SendTransfer"
|
>确认入库</el-button
|
>
|
<el-button
|
type="primary"
|
size="big"
|
icon="md-checkmark-circle"
|
long
|
@click="cancelTransfer"
|
>取消</el-button
|
>
|
</div>
|
</template>
|
</vol-box>
|
</div>
|
</template>
|
<script>
|
import VolBox from "@/components/basic/VolBox.vue";
|
import VolForm from "@/components/basic/VolForm.vue";
|
//这里使用的vue2语法,也可以写成vue3语法
|
export default {
|
components: { "vol-box": VolBox, "vol-form": VolForm },
|
methods: {},
|
data() {
|
return {
|
inbound: {
|
model: false,
|
fields: {
|
cmd: 3001,
|
src_station: 1001,
|
dest_station: null,
|
CarId: '',
|
},
|
data: [
|
[
|
{
|
type: "select",
|
required: true,
|
title: "入库站点",
|
field: "src_station",
|
data: [
|
{ key: 1001, value: "八厂" },
|
{ key: 1002, value: "九厂" },
|
],
|
},
|
],
|
[
|
{
|
type: "number",
|
required: true,
|
title: "终点库位",
|
field: "dest_station"
|
},
|
],
|
[
|
{
|
type: "text",
|
required: true,
|
title: "料车编号",
|
field: "CarId",
|
},
|
],
|
],
|
},
|
outbound: {
|
model: false,
|
fields: {
|
cmd: 102,
|
src_station: null,
|
dest_station: 1001,
|
CarId: '',
|
},
|
data: [
|
[
|
{
|
type: "number",
|
required: true,
|
title: "来源库位",
|
field: "src_station"
|
},
|
],
|
[
|
{
|
type: "select",
|
required: true,
|
title: "出库站点",
|
field: "dest_station",
|
data: [
|
{ key: 1001, value: "八厂" },
|
{ key: 1002, value: "九厂" },
|
],
|
},
|
],
|
[
|
{
|
type: "text",
|
required: true,
|
title: "料车编号",
|
field: "CarId",
|
},
|
],
|
],
|
},
|
transfer: {
|
model: false,
|
fields: {
|
cmd: 103,
|
src_station: null,
|
dest_station: null,
|
CarId: '',
|
},
|
data: [
|
[
|
{
|
type: "number",
|
required: true,
|
title: "来源库位",
|
field: "src_station"
|
},
|
],
|
[
|
{
|
type: "number",
|
required: true,
|
title: "终点库位",
|
field: "dest_station"
|
},
|
],
|
[
|
{
|
type: "text",
|
required: true,
|
title: "料车编号",
|
field: "CarId",
|
},
|
],
|
],
|
},
|
};
|
},
|
computed: {
|
isValidInDest() {
|
const regex = /^[0-9]{1,5}$/;
|
return regex.test(this.inbound.fields.dest_station);
|
},
|
isValidoutSrc() {
|
const regex = /^[0-9]{1,5}$/;
|
return regex.test(this.outbound.fields.src_station);
|
},
|
isValidTranSrc() {
|
const regex = /^[0-9]{1,5}$/;
|
return regex.test(this.transfer.fields.src_station);
|
},
|
isValidTranDest() {
|
const regex = /^[0-9]{1,5}$/;
|
return regex.test(this.transfer.fields.dest_station);
|
}
|
},
|
methods: {
|
//人工入库
|
open(type) {
|
switch (type) {
|
case "inbound":
|
this.inbound.model = true;
|
break;
|
case "outbound":
|
this.outbound.model = true;
|
break;
|
case "transfer":
|
this.transfer.model = true;
|
break;
|
default:
|
break;
|
}
|
},
|
cancelIn(){
|
this.$refs.sendInTask.reset()
|
this.inbound.model = false;
|
let param = {
|
cmd: this.inbound.fields.cmd,
|
src_station: this.inbound.fields.src_station,
|
dest_station: this.inbound.fields.dest_station,
|
carId: this.inbound.fields.CarId,
|
};
|
console.log(param);
|
},
|
cancelOut(){
|
this.$refs.sendInTask.reset()
|
this.outbound.model = false;
|
let param = {
|
cmd: this.outbound.fields.cmd,
|
src_station: this.outbound.fields.src_station,
|
dest_station: this.outbound.fields.dest_station,
|
carId: this.inbound.fields.CarId,
|
};
|
console.log(param);
|
},
|
cancelTransfer(){
|
this.$refs.sendInTask.reset()
|
this.transfer.model = false;
|
let param = {
|
cmd: this.transfer.fields.cmd,
|
src_station: this.transfer.fields.src_station,
|
dest_station: this.transfer.fields.dest_station,
|
carId: this.transfer.fields.CarId,
|
};
|
console.log(param);
|
},
|
//人工入库
|
SendInTask() {
|
if (this.inbound.fields.src_station==''||this.inbound.fields.dest_station==0||this.inbound.fields.CarId=='') {
|
return this.$Message.error(
|
"请输入符合条件的参数"
|
);
|
}
|
if (!this.isValidInDest) {
|
return this.$Message.error(
|
"终点库位只包含数字且最大长度为5位"
|
);
|
}
|
let param = {
|
cmd: this.inbound.fields.cmd,
|
src_station: this.inbound.fields.src_station,
|
dest_station: this.inbound.fields.dest_station,
|
carId: this.inbound.fields.CarId,
|
};
|
this.http
|
.post("/api/Task/ReceiveWCSTask", param, "任务创建中...")
|
.then((x) => {
|
if (x.status == true) {
|
this.$Message.success("新建入库任务成功");
|
//关闭弹框
|
this.inbound.model = false;
|
//清空表单
|
this.$refs.sendInTask.reset();
|
this.$parent.refresh();
|
} else {
|
this.$Message.error(x.message);
|
}
|
});
|
},
|
//人工出库
|
SendOutTask() {
|
if (this.outbound.fields.src_station==0||this.outbound.fields.dest_station==''||this.outbound.fields.CarId=='') {
|
return this.$Message.error(
|
"请输入符合条件的参数"
|
);
|
}
|
if (!this.isValidoutSrc) {
|
return this.$Message.error(
|
"来源库位只包含数字且最大长度为5位"
|
);
|
}
|
let param = {
|
cmd: this.outbound.fields.cmd,
|
src_station: this.outbound.fields.src_station,
|
dest_station: this.outbound.fields.dest_station,
|
carId: this.outbound.fields.CarId,
|
};
|
this.http
|
.post("/api/Task/ReceiveWCSTask", param, "任务创建中...")
|
.then((x) => {
|
if (x.status == true) {
|
this.$Message.success("新建出库任务成功");
|
//关闭弹框
|
this.outbound.model = false;
|
//清空表单
|
this.$refs.sendInTask.reset();
|
this.$parent.refresh();
|
} else {
|
this.$Message.error(x.message);
|
}
|
});
|
},
|
//人工移库库
|
SendTransfer() {
|
if (this.transfer.fields.src_station==0||this.transfer.fields.dest_station==0||this.transfer.fields.CarId=='') {
|
return this.$Message.error(
|
"请输入符合条件的参数"
|
);
|
}
|
if (!this.isValidTranSrc) {
|
return this.$Message.error(
|
"来源库位只包含数字且最大长度为5位"
|
);
|
}
|
if (!this.isValidTranDest) {
|
return this.$Message.error(
|
"终点库位只包含数字且最大长度为5位"
|
);
|
}
|
let param = {
|
cmd: this.transfer.fields.cmd,
|
src_station: this.transfer.fields.src_station,
|
dest_station: this.transfer.fields.dest_station,
|
carId: this.transfer.fields.CarId,
|
};
|
this.http
|
.post("/api/Task/ReceiveWCSTask", param, "任务创建中...")
|
.then((x) => {
|
if (x.status == true) {
|
this.$Message.success("新建移库任务成功");
|
//关闭弹框
|
this.transfer.model = false;
|
//清空表单
|
this.$refs.sendInTask.reset();
|
this.$parent.refresh();
|
} else {
|
this.$Message.error(x.message);
|
}
|
});
|
},
|
},
|
};
|
</script>
|