<template>
|
<view class="example">
|
<!-- <u-tabs :list="list" :is-Scroll="false" :current="current2" @change="change"></u-tabs> -->
|
<uni-segmented-control :current="current2" :values="list" @clickItem="change" styleType="button"
|
activeColor="#4cd964"></uni-segmented-control>
|
<view v-show="current2===0">
|
<uni-section title="选择极卷库有货缓存架,选择冲叠车间无货缓存架" type="line" padding style="height: calc(100vh - 100px);">
|
<uni-forms ref="form" :modelValue="baseFormData" :rules="formRules">
|
<!-- <uni-forms-item label="缓存架条码" label-width="120" required name="HCJInput">
|
<uni-easyinput v-model="baseFormData.HCJInput" placeholder="请扫描缓存架条码" @input="input" />
|
</uni-forms-item> -->
|
<uni-forms-item label-width="120" label="正负极" name="sexs" required>
|
<uni-data-checkbox v-model="baseFormData.sex" :localdata="sexs" @change="checkbox" />
|
</uni-forms-item>
|
<uni-forms-item label-width="120" label="物流线" name="sexs" required>
|
<uni-data-checkbox v-model="baseFormData.sex2" :localdata="sexs2" @change="checkbox" />
|
</uni-forms-item>
|
<uni-forms-item label="缓存架条码" label-width="120" required name="HCJInput">
|
<uni-data-picker placeholder="请选择极卷库缓存架条码" popup-title="请选择极卷库缓存架条码" :localdata="HCJInputTree"
|
v-model="baseFormData.HCJInput" @change="onchange">
|
</uni-data-picker>
|
</uni-forms-item>
|
<uni-forms-item label="1F冲叠条码" label-width="120" required name="classes">
|
<uni-data-picker placeholder="请选择1F冲叠缓存架条码" popup-title="请选择1F冲叠缓存架条码" :localdata="dataTree"
|
v-model="baseFormData.classes">
|
</uni-data-picker>
|
</uni-forms-item>
|
</uni-forms>
|
<u-button type="success" size="default" shape="circle" :ripple="true" ripple-bg-color="#909399"
|
@click="submit(0)">
|
添加任务
|
</u-button>
|
</uni-section>
|
</view>
|
<view v-show="current2===1">
|
<uni-section title="选择冲叠车间无货缓存架,选择极卷库有货缓存架" type="line" padding style="height: calc(100vh - 100px);">
|
<uni-forms ref="form" :modelValue="baseFormData" :rules="formRules">
|
<!-- <uni-forms-item label="缓存架条码" label-width="120" required name="HCJInput">
|
<uni-easyinput v-model="baseFormData.HCJInput" placeholder="请扫描缓存架条码" @input="input" />
|
</uni-forms-item> -->
|
<uni-forms-item label-width="120" label="正负极" name="sexs" required>
|
<uni-data-checkbox v-model="baseFormData.sex" :localdata="sexs" @change="checkbox" />
|
</uni-forms-item>
|
<uni-forms-item label-width="120" label="物流线" name="sexs" required>
|
<uni-data-checkbox v-model="baseFormData.sex2" :localdata="sexs2" @change="checkbox" />
|
</uni-forms-item>
|
<uni-forms-item label="缓存架条码" label-width="120" required name="HCJInput">
|
<uni-data-picker placeholder="请选择冲叠车间缓存架条码" popup-title="请选择冲叠车间缓存架条码" :localdata="HCJInputTree"
|
v-model="baseFormData.HCJInput" @change="onchange">
|
</uni-data-picker>
|
</uni-forms-item>
|
<uni-forms-item label="极卷库条码" label-width="120" required name="classes">
|
<uni-data-picker placeholder="请选择极卷库缓存架条码" popup-title="请选择极卷库缓存架条码" :localdata="dataTree"
|
v-model="baseFormData.classes">
|
</uni-data-picker>
|
</uni-forms-item>
|
</uni-forms>
|
<u-button type="success" size="default" shape="circle" :ripple="true" ripple-bg-color="#909399"
|
@click="submit(1)">
|
添加任务
|
</u-button>
|
</uni-section>
|
</view>
|
<view v-show="current2===2">
|
<uni-section title="扫描冲叠车间缓存架,选择冲叠设备" type="line" padding style="height: calc(100vh - 100px);">
|
<uni-forms ref="form" :modelValue="baseFormData" :rules="formRules">
|
<!-- <uni-forms-item label="缓存架条码" label-width="120" required name="HCJInput">
|
<uni-easyinput v-model="baseFormData.HCJInput" placeholder="请扫描缓存架条码" @input="input" />
|
</uni-forms-item> -->
|
<uni-forms-item label-width="120" label="正负极" name="sexs" required>
|
<uni-data-checkbox v-model="baseFormData.sex" :localdata="sexs" @change="checkbox" />
|
</uni-forms-item>
|
<uni-forms-item label-width="120" label="物流线" name="sexs" required>
|
<uni-data-checkbox v-model="baseFormData.sex2" :localdata="sexs2" @change="checkbox" />
|
</uni-forms-item>
|
<uni-forms-item label="缓存架条码" label-width="120" required name="HCJInput">
|
<uni-data-picker placeholder="请选择冲叠车间缓存架条码" popup-title="请选择冲叠车间缓存架条码" :localdata="HCJInputTree"
|
v-model="baseFormData.HCJInput" @change="onchange">
|
</uni-data-picker>
|
</uni-forms-item>
|
<uni-forms-item label="1F冲叠设备" label-width="120" required name="classes">
|
<uni-data-picker placeholder="请选择冲叠设备" popup-title="请选择冲叠设备" :localdata="dataTree"
|
v-model="baseFormData.classes">
|
</uni-data-picker>
|
<!-- <uni-data-picker
|
placeholder="请选择冲叠设备"
|
popup-title="请选择冲叠设备"
|
:localdata="dataTree"
|
v-model="baseFormData.classes"
|
></uni-data-picker> -->
|
</uni-forms-item>
|
</uni-forms>
|
<u-button type="success" size="default" shape="circle" :ripple="true" ripple-bg-color="#909399"
|
@click="submit(2)">
|
添加任务
|
</u-button>
|
</uni-section>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
baseFormData: {
|
HCJInput: '',
|
classes: '',
|
sex: 'ZJ',
|
sex2: '1'
|
},
|
list: ['极卷库', '冲叠车间', '冲叠设备'],
|
dataTree: [],
|
|
HCJInputTree: [],
|
sexs: [{
|
text: '正极',
|
value: 'ZJ'
|
}, {
|
text: '负极',
|
value: 'FJ'
|
}],
|
sexs2: [{
|
text: '一线',
|
value: '1'
|
}, {
|
text: '二线',
|
value: '2'
|
}],
|
formRules: {
|
classes: {
|
rules: [{
|
required: true,
|
errorMessage: '设备编号不能为空'
|
}]
|
},
|
HCJInput: {
|
rules: [{
|
required: true,
|
errorMessage: '缓存架不能为空'
|
}]
|
},
|
},
|
current2: 0,
|
flag: false
|
}
|
},
|
onLoad() {
|
this.onload(0)
|
},
|
methods: {
|
change(index) {
|
if (this.current2 != index.currentIndex) {
|
if (index.currentIndex == 2) {
|
this.current2 = index.currentIndex;
|
this.flag = true;
|
this.onload(this.current2)
|
} else {
|
this.current2 = index.currentIndex;
|
this.flag = false
|
this.onload(this.current2)
|
}
|
|
}
|
this.baseFormData.HCJInput = '';
|
this.baseFormData.classes = '';
|
this.baseFormData.sex = 'ZJ';
|
this.baseFormData.sex2 = '1';
|
this.dataTree = [];
|
this.HCJInputTree = [];
|
},
|
checkbox(e) {
|
this.onload(this.current2)
|
},
|
onchange(e) {
|
const value = e.detail.value
|
this.input(value[0].value)
|
},
|
input(e) {
|
// console.log(e)
|
if (e.length === 13 && e.includes('JJHCJ')) {
|
let formDataParam = {
|
UpperCode: e,
|
Type: "1-CDHCJ",
|
LocationState: "LocationState_Empty",
|
RunLine: this.baseFormData.sex2
|
}
|
this.$u.post('/api/PDA/GetDynamicAsync', formDataParam).then(res => {
|
if (res != undefined) {
|
this.dataTree = [];
|
this.dataTree = res;
|
} else {
|
this.dataTree = [];
|
this.$t.message.toast("暂无有货缓存架")
|
}
|
})
|
} else if (e.length === 15 && e.includes('1-') && e.includes('CDHCJ')) {
|
if (this.flag) {
|
let formDataParam = {
|
DeviceUpCode: e
|
}
|
this.$u.get('/api/PDA/GetDevDynamicAsync', formDataParam).then(res => {
|
if (res != undefined) {
|
this.dataTree = res;
|
} else {
|
this.dataTree = [];
|
this.$t.message.toast("暂无有货缓存架")
|
}
|
})
|
} else {
|
let formDataParam = {
|
UpperCode: e,
|
Type: "JJHCJ",
|
LocationState: "LocationState_Stored",
|
RunLine: this.baseFormData.sex2
|
}
|
this.$u.post('/api/PDA/GetDynamicAsync', formDataParam).then(res => {
|
if (res != undefined) {
|
this.dataTree = res;
|
} else {
|
this.dataTree = [];
|
this.$t.message.toast("暂无有货缓存架")
|
}
|
})
|
}
|
}
|
},
|
submit(index) {
|
this.$refs.form.validate().then((res) => {
|
debugger;
|
this.$t.message.loading()
|
// if (this.flag) {
|
// if (this.baseFormData.HCJInput.includes('1-') && this.baseFormData.HCJInput.includes(
|
// 'CDHCJ')) {
|
// let s = this.baseFormData.HCJInput.replace("SL", "XL");
|
// this.baseFormData.HCJInput = s
|
// }
|
// }
|
// else {
|
// if (this.baseFormData.HCJInput.includes('1F-CDHCJ')) {
|
// let s = this.baseFormData.HCJInput.replace("XL", "SL");
|
// this.baseFormData.HCJInput = this.baseFormData.classes
|
// this.baseFormData.classes = s
|
// }
|
// }
|
let AgvCode = "中段1号AGV"
|
let formDataParam = {}
|
formDataParam = {
|
AgvCode: AgvCode,
|
AgvFromAddress: this.baseFormData.HCJInput,
|
AgvToAddress: this.baseFormData.classes,
|
AgvBarcode: '',
|
AgvGrade: "1",
|
AgvTaskQty: '1',
|
AgvTaskState: "Create",
|
AgvTaskType: 'TaskType_Outbound',
|
AgvWorkType: '1',
|
AgvLine: this.baseFormData.sex2
|
}
|
this.$u.post('/api/PDA/CreatePDATask', formDataParam).then(res => {
|
this.$t.message.closeLoading()
|
if (res.status) {
|
this.$t.message.toast(res.message)
|
// setTimeout(() => {
|
// var HCJInputTreedata=this.HCJInputTree.filter(x => x.value !=this.baseFormData.HCJInput);
|
// this.HCJInputTree=HCJInputTreedata;
|
// var dataTreedata=this.dataTree.filter(x => x.value !=this.baseFormData.classes);
|
// this.dataTree =dataTreedata;
|
// }, 100);
|
setTimeout(() => {
|
this.baseFormData.HCJInput = '';
|
this.baseFormData.classes = '';
|
this.baseFormData.sex = 'ZJ';
|
this.dataTree = [];
|
this.HCJInputTree = [];
|
this.baseFormData.sex2 = '1';
|
this.onload(index);
|
}, 100);
|
} else {
|
this.$t.message.toast(res.message)
|
setTimeout(() => {
|
this.baseFormData.HCJInput = '';
|
this.baseFormData.classes = '';
|
this.baseFormData.sex = 'ZJ';
|
this.dataTree = [];
|
this.HCJInputTree = [];
|
this.baseFormData.sex2 = '1';
|
this.onload(index);
|
}, 100);
|
}
|
|
|
}).catch((err) => {
|
this.$t.message.toast(res.message)
|
setTimeout(() => {
|
this.baseFormData.HCJInput = '';
|
this.baseFormData.classes = '';
|
this.baseFormData.sex = 'ZJ';
|
this.dataTree = [];
|
this.HCJInputTree = [];
|
this.baseFormData.sex2 = '1';
|
this.onload(index);
|
}, 100);
|
})
|
|
});
|
|
},
|
onload(index) {
|
if (index === 0) {
|
let upcode = '';
|
if (this.baseFormData.sex == 'ZJ')
|
upcode = 'ZJSL-JJHCJ001'
|
else
|
upcode = 'FJSL-JJHCJ001'
|
let formDataParam = {
|
UpperCode: upcode,
|
Type: "JJHCJ",
|
LocationState: "LocationState_Stored",
|
RunLine: this.baseFormData.sex2
|
}
|
this.$u.post('/api/PDA/GetDynamicAsync', formDataParam).then(res => {
|
if (res != undefined) {
|
this.HCJInputTree = res;
|
console.log(this.HCJInputTree)
|
} else {
|
this.HCJInputTree = []
|
this.$t.message.toast("暂无有货缓存架")
|
}
|
})
|
} else if (index === 1) {
|
let upcode = '';
|
if (this.baseFormData.sex == 'ZJ')
|
upcode = '1-ZJSL-CDHCJ001'
|
else
|
upcode = '1-FJSL-CDHCJ001'
|
let formDataParam = {
|
UpperCode: upcode,
|
Type: "1-CDHCJ",
|
LocationState: "LocationState_Empty",
|
RunLine: this.baseFormData.sex2
|
}
|
this.$u.post('/api/PDA/GetDynamicAsync', formDataParam).then(res => {
|
console.log(res)
|
if (res != undefined) {
|
this.HCJInputTree = res;
|
} else {
|
this.HCJInputTree = [];
|
this.$t.message.toast("暂无有货缓存架")
|
}
|
})
|
} else if (index === 2) {
|
let upcode = '';
|
if (this.baseFormData.sex == 'ZJ')
|
upcode = '1-ZJSL-CDHCJ001'
|
else
|
upcode = '1-FJSL-CDHCJ001'
|
let formDataParam = {
|
UpperCode: upcode,
|
Type: "1-CDHCJ",
|
LocationState: "LocationState_Stored",
|
RunLine: this.baseFormData.sex2
|
}
|
this.$u.post('/api/PDA/GetDynamicAsync', formDataParam).then(res => {
|
if (res != undefined) {
|
this.HCJInputTree = res;
|
} else {
|
this.HCJInputTree = [];
|
this.$t.message.toast("暂无有货缓存架");
|
}
|
})
|
}
|
}
|
}
|
}
|
</script>
|
|
<style>
|
.example {
|
padding: 15px;
|
background-color: #fff;
|
}
|
</style>
|