<template>
|
<view class="example">
|
<uni-segmented-control :current="current" :values="list" @clickItem="onClickItem" styleType="button"
|
activeColor="#5500ff"></uni-segmented-control>
|
<view v-show="current===0">
|
<uni-section title="上料任务添加" type="line" padding style="height: calc(100vh - 100px);">
|
<uni-forms ref="form" :modelValue="baseFormData" :rules="formRules">
|
<uni-forms-item label-width="120" label="正极/负极" name="sexs" required>
|
<uni-data-checkbox v-model="baseFormData.sexQ" :localdata="sexss" @change="checkbox" />
|
|
</uni-forms-item><uni-forms-item label-width="120" label="物流线" name="sexs" required>
|
<uni-data-checkbox v-model="baseFormData.sexQ2" :localdata="sexss2" @change="checkbox" />
|
</uni-forms-item>
|
<uni-forms-item label="设备类型" label-width="120" required name="classes">
|
<uni-data-picker placeholder="请选择设备类型" popup-title="请选择需要上料的设备类型" :localdata="dataTreeType"
|
v-model="baseFormData.classesType" @change="onchange">
|
</uni-data-picker>
|
</uni-forms-item>
|
<uni-forms-item label="缓存架条码" label-width="120" required name="HCJInput">
|
<!-- <uni-easyinput v-model="baseFormData.HCJInput" placeholder="请扫描缓存架条码" /> -->
|
<uni-data-picker placeholder="请选择缓存架条码" popup-title="请选择缓存架条码" :localdata="HCJInputTree"
|
v-model="baseFormData.HCJInput" @change="input">
|
</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,'form')">
|
添加任务
|
</u-button>
|
</uni-section>
|
</view>
|
<view v-show="current===1">
|
<uni-section title="下料任务添加" type="line" padding style="height: calc(100vh - 100px);">
|
<uni-forms ref="form1" :modelValue="baseFormData" :rules="formRules">
|
<uni-forms-item label-width="120" label="正极/负极" name="sexs" required>
|
<uni-data-checkbox v-model="baseFormData.sexQ" :localdata="sexss" @change="checkbox" />
|
</uni-forms-item>
|
</uni-forms-item><uni-forms-item label-width="120" label="物流线" name="sexs" required>
|
<uni-data-checkbox v-model="baseFormData.sexQ2" :localdata="sexss2" @change="checkbox" />
|
</uni-forms-item>
|
<uni-forms-item label="设备类型" label-width="120" required name="classes">
|
<uni-data-picker placeholder="请选择设备类型" popup-title="请选择需要下料的设备类型" :localdata="dataTreeType1"
|
v-model="baseFormData.classesType" @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" @change="input">
|
</uni-data-picker>
|
</uni-forms-item>
|
<uni-forms-item label="缓存架条码" label-width="120" required name="HCJInput">
|
<!-- <uni-easyinput v-model="baseFormData.HCJInput" placeholder="请扫描缓存架条码" /> -->
|
<uni-data-picker placeholder="请选择缓存架条码" popup-title="请选择缓存架条码" :localdata="HCJInputTree"
|
v-model="baseFormData.HCJInput">
|
</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,'form1')">
|
添加任务
|
</u-button>
|
</uni-section>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
baseFormData: {
|
HCJInput: '',
|
classes: '',
|
sexQ: 'ZJ',
|
sexQ2: '1',
|
classesType: ''
|
},
|
HCJInputTree: [],
|
sexss: [{
|
text: '正极',
|
value: 'ZJ'
|
}, {
|
text: '负极',
|
value: 'FJ'
|
}],
|
sexss2: [{
|
text: '一线',
|
value: '1'
|
}, {
|
text: '二线',
|
value: '2'
|
}],
|
dataTreeType: [{
|
text: "涂布",
|
value: "TB",
|
},
|
{
|
text: "辊压",
|
value: "GY",
|
}, {
|
text: "分切",
|
value: "FQ",
|
}
|
],
|
dataTreeType1: [{
|
text: "涂布",
|
value: "TB",
|
},
|
{
|
text: "辊压",
|
value: "GY",
|
}
|
],
|
dataTree: [],
|
formRules: {
|
classes: {
|
rules: [{
|
required: true,
|
errorMessage: '设备编号不能为空'
|
}]
|
},
|
HCJInput: {
|
rules: [{
|
required: true,
|
errorMessage: '缓存架不能为空'
|
}]
|
}
|
},
|
formRules1: {
|
classes: {
|
rules: [{
|
required: true,
|
errorMessage: '设备编号不能为空'
|
}]
|
},
|
HCJInput: {
|
rules: [{
|
required: true,
|
errorMessage: '缓存架不能为空'
|
}]
|
}
|
},
|
list: ['上料任务', '下料任务'],
|
current: 0
|
}
|
},
|
onLoad() {
|
this.onload(0)
|
},
|
methods: {
|
onClickItem(e) {
|
if (this.current != e.currentIndex) {
|
this.current = e.currentIndex;
|
}
|
this.dataTree = [];
|
this.HCJInputTree = []
|
this.baseFormData.HCJInput = '';
|
this.baseFormData.classes = '';
|
this.baseFormData.classesType = '';
|
this.baseFormData.sexQ = 'ZJ';
|
this.baseFormData.sexQ2 = '1';
|
this.HCJInputTree = [];
|
},
|
onchange(e) {
|
const value = e.detail.value
|
this.onload(this.current)
|
},
|
checkbox(e) {
|
this.onload(this.current)
|
},
|
submit(root, ref) {
|
this.$refs[ref].validate().then((res) => {
|
this.$t.message.loading()
|
let bz = this.baseFormData.HCJInput.split('-')[0];
|
let sbCode = bz + '-' + this.baseFormData.classes
|
let AgvCode = bz == "ZJSL" ? "正极1号AGV" : "负极1号AGV"
|
let formDataParam = {}
|
if (root == 1) {
|
formDataParam = {
|
AgvCode: AgvCode,
|
AgvFromAddress: this.baseFormData.HCJInput,
|
AgvToAddress: sbCode,
|
AgvBarcode: '',
|
AgvGrade: "1",
|
AgvTaskQty: '1',
|
AgvTaskState: "Create",
|
AgvTaskType: 'TaskType_Outbound',
|
AgvWorkType: '1',
|
AgvLine: this.baseFormData.sex2
|
}
|
} else {
|
let sd = bz.replace('S', 'X')
|
let sbCode1 = sd + '-' + this.baseFormData.classes
|
formDataParam = {
|
AgvCode: AgvCode,
|
AgvFromAddress: sbCode1,
|
AgvToAddress: this.baseFormData.HCJInput,
|
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()
|
console.log(res);
|
if (res.status) {
|
this.baseFormData.HCJInput = '';
|
this.baseFormData.classes = '';
|
this.baseFormData.classesType = '';
|
this.baseFormData.sexQ = 'ZJ';
|
this.baseFormData.sexQ2 = '1';
|
this.$t.message.toast(res.message);
|
this.HCJInputTree = [];
|
// setTimeout(() => {
|
console.log(this.HCJInputTree)
|
// }, 100);
|
|
} else {
|
this.baseFormData.HCJInput = '';
|
this.baseFormData.classes = '';
|
this.baseFormData.classesType = '';
|
this.baseFormData.sexQ = 'ZJ';
|
this.baseFormData.sexQ2 = '1';
|
this.HCJInputTree = [];
|
this.$t.message.toast(res.message)
|
}
|
|
|
}).catch((err) => {
|
this.baseFormData.HCJInput = '';
|
this.baseFormData.classes = '';
|
this.baseFormData.classesType = '';
|
this.baseFormData.sexQ = 'ZJ';
|
this.baseFormData.sexQ2 = '1';
|
this.$t.message.toast(res.message)
|
})
|
})
|
},
|
onload(index) {
|
if (index === 0) {
|
|
|
let upcode = '';
|
if (this.baseFormData.sexQ == 'ZJ')
|
upcode = 'ZJSL-' + this.baseFormData.classesType + 'HCJ001'
|
else
|
upcode = 'FJSL-' + this.baseFormData.classesType + 'HCJ001'
|
let formDataParam = {
|
UpperCode: upcode,
|
Type: this.baseFormData.classesType,
|
LocationState: "LocationState_Stored",
|
RunLine: this.baseFormData.sexQ2
|
}
|
this.$u.post('/api/PDA/GetDynamicAsync', formDataParam).then(res => {
|
|
if (res != undefined) {
|
this.HCJInputTree = res;
|
} else {
|
this.HCJInputTree = [];
|
this.$t.message.toast("暂无有货缓存架")
|
}
|
})
|
} else if (index === 1) {
|
if (this.baseFormData.classesType === 'TB') {
|
this.dataTree = [{
|
text: "涂布设备1号",
|
value: "TBSB001",
|
},
|
{
|
text: "涂布设备2号",
|
value: "TBSB002",
|
},
|
]
|
} else if (this.baseFormData.classesType === 'GY') {
|
this.dataTree = [{
|
text: "辊压设备1号",
|
value: "GYSB001",
|
},
|
{
|
text: "辊压设备2号",
|
value: "GYSB002",
|
},
|
]
|
}
|
}
|
},
|
input() {
|
if (this.current === 0) {
|
if (this.baseFormData.classesType === 'TB') {
|
this.dataTree = [{
|
text: "涂布设备1号",
|
value: "TBSB001",
|
},
|
{
|
text: "涂布设备2号",
|
value: "TBSB002",
|
},
|
]
|
} else if (this.baseFormData.classesType === 'GY') {
|
this.dataTree = [{
|
text: "辊压设备1号",
|
value: "GYSB001",
|
},
|
{
|
text: "辊压设备2号",
|
value: "GYSB002",
|
},
|
]
|
} else if (this.baseFormData.classesType === 'FQ') {
|
this.dataTree = [{
|
text: "分切设备1号",
|
value: "FQSB001",
|
},
|
{
|
text: "分切设备2号",
|
value: "FQSB002",
|
}
|
]
|
}
|
} else if (this.current === 1) {
|
let upcode = '';
|
let type = ''
|
if (this.baseFormData.classesType === 'TB')
|
type = 'GY'
|
else if (this.baseFormData.classesType === 'GY')
|
type = 'FQ'
|
if (this.baseFormData.sexQ == 'ZJ')
|
upcode = 'ZJSL-' + type + 'HCJ001'
|
else
|
upcode = 'FJSL-' + type + 'HCJ001'
|
let formDataParam = {
|
UpperCode: upcode,
|
Type: type,
|
LocationState: "LocationState_Empty",
|
RunLine: this.baseFormData.sexQ2
|
}
|
this.$u.post('/api/PDA/GetDynamicAsync', formDataParam).then(res => {
|
if (res != undefined) {
|
this.HCJInputTree = res;
|
} else {
|
this.HCJInputTree = [];
|
this.$t.message.toast("暂无有货缓存架")
|
}
|
})
|
}
|
}
|
},
|
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.example {
|
padding: 15px;
|
background-color: #fff;
|
}
|
</style>
|