fix(workorder): 修复工单状态判断逻辑并优化代码结构
- 修正站点和班组选择框的禁用条件判断 - 将满箱检查逻辑从MQTT消息处理中提取为独立方法 - 移除调试用的console.log语句 - 优化代码格式和注释
This commit is contained in:
@@ -24,13 +24,15 @@
|
|||||||
<div class="workorder-card-action-box">
|
<div class="workorder-card-action-box">
|
||||||
<div>
|
<div>
|
||||||
<span>站点: </span>
|
<span>站点: </span>
|
||||||
<el-select :disabled="formStatus === 2" style="width: 140px" v-model="site" placeholder="请选择站点" @change="selectChange">
|
<el-select :disabled="formStatus !== 1" style="width: 140px" v-model="site" placeholder="请选择站点"
|
||||||
|
@change="selectChange">
|
||||||
<el-option v-for="item in siteOptions" :key="item.code" :label="item.name" :value="item.code"></el-option>
|
<el-option v-for="item in siteOptions" :key="item.code" :label="item.name" :value="item.code"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span>班组: </span>
|
<span>班组: </span>
|
||||||
<el-select :disabled="formStatus === 2" style="width: 140px" v-model="team" placeholder="请选择班组" @change="selectChange">
|
<el-select :disabled="formStatus !== 1" style="width: 140px" v-model="team" placeholder="请选择班组"
|
||||||
|
@change="selectChange">
|
||||||
<el-option v-for="item in teamOptions" :key="item.code" :label="item.name" :value="item.code"></el-option>
|
<el-option v-for="item in teamOptions" :key="item.code" :label="item.name" :value="item.code"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
@@ -86,17 +88,16 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</el-card>
|
</el-card>
|
||||||
<StartWorkOrderDialog
|
<StartWorkOrderDialog ref="StartWorkOrderDialogRef" @showWarningMessage="showErrorMessage"
|
||||||
ref="StartWorkOrderDialogRef"
|
@changeFormStatus="changeFormStatus" @startWorkOrder="handleStartWorkOrder" @refresh="doRefresh" />
|
||||||
@showWarningMessage="showErrorMessage"
|
<ScanPackageLabelDialog ref="ScanPackageLabelDialogRef" @changeFormStatus="changeFormStatus"
|
||||||
@changeFormStatus="changeFormStatus"
|
@showWarningMessage="showErrorMessage" @submit="handleStartWorkOrder" />
|
||||||
@startWorkOrder="handleStartWorkOrder"
|
<EndWorkOrderDialog ref="EndWorkOrderDialogRef" @changeFormStatus="changeFormStatus"
|
||||||
@refresh="doRefresh"
|
@endWorkOrder="handleEndWorkOrder" />
|
||||||
/>
|
<GenerateLabelDialog ref="GenerateLabelDialogRef" @generateLabelSuccess="handleGenerateLabelSuccess">
|
||||||
<ScanPackageLabelDialog ref="ScanPackageLabelDialogRef" @changeFormStatus="changeFormStatus" @showWarningMessage="showErrorMessage" @submit="handleStartWorkOrder" />
|
</GenerateLabelDialog>
|
||||||
<EndWorkOrderDialog ref="EndWorkOrderDialogRef" @changeFormStatus="changeFormStatus" @endWorkOrder="handleEndWorkOrder" />
|
<SpecialPrintDialog ref="SpecialPrintDialogRef" @SpecialPrintSuccess="handleGenerateLabelSuccess">
|
||||||
<GenerateLabelDialog ref="GenerateLabelDialogRef" @generateLabelSuccess="handleGenerateLabelSuccess"></GenerateLabelDialog>
|
</SpecialPrintDialog>
|
||||||
<SpecialPrintDialog ref="SpecialPrintDialogRef" @SpecialPrintSuccess="handleGenerateLabelSuccess"></SpecialPrintDialog>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -124,7 +125,7 @@ export default {
|
|||||||
|
|
||||||
teamOptions: [],
|
teamOptions: [],
|
||||||
siteOptions: [],
|
siteOptions: [],
|
||||||
// 站点工单执行状态 1-初始状态(扫外箱标签) 2-工单执行中(扫内标签)
|
// 站点工单执行状态 1-初始状态(扫外箱标签) 2-工单执行中(扫内标签)3-扫外箱标签
|
||||||
formStatus: 1,
|
formStatus: 1,
|
||||||
team: '',
|
team: '',
|
||||||
site: '',
|
site: '',
|
||||||
@@ -230,25 +231,15 @@ export default {
|
|||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.formData = res.data
|
this.formData = res.data
|
||||||
this.formDataChange(res.data)
|
this.formDataChange(res.data)
|
||||||
|
this.checkPackageIsFull()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
changeFormStatus(type) {
|
changeFormStatus(type) {
|
||||||
this.formStatus = type
|
this.formStatus = type
|
||||||
},
|
},
|
||||||
async setMqttMessage(LabelCode, ComNo, SiteNo) {
|
// 后台检查,满箱弹出弹出
|
||||||
console.log(this.formStatus)
|
async checkPackageIsFull() {
|
||||||
if (SiteNo !== this.site) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// 解析结果
|
|
||||||
if (this.formStatus === 1) {
|
|
||||||
// 扫外箱标签模式
|
|
||||||
this.$refs.StartWorkOrderDialogRef.handleScanBoxOutLabel(LabelCode, ComNo)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// 扫内标签模式
|
|
||||||
if (this.formStatus === 2) {
|
|
||||||
const workorder = this.formData.workOrder
|
const workorder = this.formData.workOrder
|
||||||
const checkRes1 = await QcBackEndApi.CheckPackageIsFullAndNeedScanPackageLabel({ workorder })
|
const checkRes1 = await QcBackEndApi.CheckPackageIsFullAndNeedScanPackageLabel({ workorder })
|
||||||
// 需要扫箱标签
|
// 需要扫箱标签
|
||||||
@@ -260,14 +251,26 @@ export default {
|
|||||||
}
|
}
|
||||||
this.changeFormStatus(3)
|
this.changeFormStatus(3)
|
||||||
this.$refs.ScanPackageLabelDialogRef.open(obj)
|
this.$refs.ScanPackageLabelDialogRef.open(obj)
|
||||||
|
return true;
|
||||||
//this.$refs.ScanPackageLabelDialogRef.handleScanPackageLabel(LabelCode, ComNo)
|
|
||||||
return
|
|
||||||
} else if (typeof checkRes1.data === 'string' && checkRes1.data.includes('功能异常')) {
|
} else if (typeof checkRes1.data === 'string' && checkRes1.data.includes('功能异常')) {
|
||||||
this.showErrorMessage(3, res.data)
|
this.showErrorMessage(3, res.data)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async setMqttMessage(LabelCode, ComNo, SiteNo) {
|
||||||
|
//console.log(this.formStatus)
|
||||||
|
if (SiteNo !== this.site) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 解析结果
|
||||||
|
if (this.formStatus === 1) {
|
||||||
|
// 扫外箱标签模式
|
||||||
|
this.$refs.StartWorkOrderDialogRef.handleScanBoxOutLabel(LabelCode, ComNo)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 扫内标签模式
|
// 扫内标签模式
|
||||||
|
if (this.formStatus === 2) {
|
||||||
|
// 扫内标签模式(调换位置)
|
||||||
this.handleScanInnerLabel(LabelCode, ComNo)
|
this.handleScanInnerLabel(LabelCode, ComNo)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -277,6 +280,7 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 扫内标签的情况
|
// 扫内标签的情况
|
||||||
async handleScanInnerLabel(label = '', comNo = '未知串口') {
|
async handleScanInnerLabel(label = '', comNo = '未知串口') {
|
||||||
const params = {
|
const params = {
|
||||||
@@ -419,10 +423,13 @@ export default {
|
|||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.workorder-label {
|
.workorder-label {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
word-wrap: break-word; /* 允许长单词或 URL 地址换行到下一行 */
|
word-wrap: break-word;
|
||||||
word-break: break-all; /* 允许在单词内换行 */
|
/* 允许长单词或 URL 地址换行到下一行 */
|
||||||
|
word-break: break-all;
|
||||||
|
/* 允许在单词内换行 */
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
mqttClient: null,
|
mqttClient: null,
|
||||||
mqttClientId: emqxUtil.title + 'BackEnd' + Math.random().toString(16).substring(1, 10),
|
mqttClientId: emqxUtil.title + 'BackEnd-' + Math.random().toString(16).substring(1, 10),
|
||||||
formData: {
|
formData: {
|
||||||
workOrder: '',
|
workOrder: '',
|
||||||
partnumber: '',
|
partnumber: '',
|
||||||
@@ -178,8 +178,6 @@ export default {
|
|||||||
that.mqttClient.on('message', function (topic, message) {
|
that.mqttClient.on('message', function (topic, message) {
|
||||||
if (topic === _topic.SiteComLabelCode) {
|
if (topic === _topic.SiteComLabelCode) {
|
||||||
const objData = emqxUtil.parseJSON(message)
|
const objData = emqxUtil.parseJSON(message)
|
||||||
console.log(objData)
|
|
||||||
|
|
||||||
that.doMqttAction(objData)
|
that.doMqttAction(objData)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user