<template>
|
<view>
|
|
<view class="container" style="display: flex;
|
flex-direction: row;
|
flex-wrap: nowrap;
|
align-content: flex-start;
|
justify-content: flex-start;">
|
<!-- 上部:工单选择和机台信息 -->
|
<view class="top-order" style=" display:inline-block;">
|
<view class="form-row4">
|
<view class="form-row" style="display: flex;
|
flex-direction: column;
|
flex-wrap: nowrap;
|
justify-content: flex-start;
|
align-items: center;">
|
<view class="form-item">
|
<label>工单编号:</label>
|
<input class="inp" type="text" v-model="order.daa001" disabled="true" />
|
</view>
|
<view class="form-item">
|
<label>刀具名称:</label><!--刀具名称???-->
|
<input class="inp" type="text" v-model="order.moldId" disabled="true" />
|
</view>
|
<view class="form-item">
|
<label>工单数量:</label>
|
<input class="inp" type="text" v-model="order.daa008" disabled="true" />
|
</view>
|
<view class="form-item">
|
<label>开工数采:</label><!--开工数采:开工时的累计生产数???-->
|
<input class="inp" type="text" v-model="order.daa004" disabled="true" />
|
</view>
|
</view>
|
<view class="form-row3">
|
<view class="form-item">
|
<label>产品名称:</label>
|
<!--<input class="inp" type="text" v-model="order.daa003" disabled="true" />-->
|
<superwei-combox :candidates="DAA003List" v-model="order.daa003" @select="onDaa003Change"
|
class="inp" style="font-size: 20px;"></superwei-combox>
|
</view>
|
<view class="form-item">
|
<label>刀具编号:</label><!--刀具编号???-->
|
<input class="inp" type="text" v-model="order.moldId" disabled="true" />
|
</view>
|
<view class="form-item">
|
<label>刀具规格:</label><!--刀具规格???-->
|
<input class="inp" type="text" v-model="order.moldId" disabled="true" />
|
</view>
|
<view class="form-item">
|
<label>当前数采:</label><!--当前数采:当前时间的累计生产数???-->
|
<input class="inp" type="text" v-model="order.daa004" disabled="true" />
|
</view>
|
</view>
|
<view class="form-row3">
|
<view class="form-item">
|
<label>产品编码:</label><!--产品编码???-->
|
<input class="inp" type="text" v-model="order.daa004" disabled="true" />
|
</view>
|
<view class="form-item">
|
<label>产品规格:</label><!--开工数采:开工时的累计生产数???-->
|
<input class="inp" type="text" v-model="order.daa004" disabled="true" />
|
</view>
|
<view class="form-item">
|
<label>报工数量:</label>
|
<input class="inp" type="text" v-model="order.daa011" disabled="true" />
|
</view>
|
</view>
|
</view>
|
</view>
|
<view class="form-row1">
|
<view class="form-item" style=" display:inline-block;">
|
<label>工单状态:</label>
|
<input class="inp1" type="text" v-model="order.daa018" disabled="true" />
|
<!-- 刷新按钮 -->
|
<button @click="handleRefresh" class="refresh-btn">刷新</button>
|
</view>
|
<view class="form-item">
|
<label>机台编号:</label>
|
<input class="inp2" type="text" v-model="order.machineNo" disabled="true" />
|
</view>
|
</view>
|
</view>
|
|
<!-- 中部:品质检验 -->
|
<view class="section card">
|
<view class="form-row">
|
<view class="form-item">
|
<label style="color: red;">日停机次数(时长超5分钟):</label>
|
<input class="inp" style="width: 40%;" type="number" v-model="todayFaultNum" disabled="true" />
|
</view>
|
<view class="form-item">
|
<label>日停机时长(mi):</label>
|
<input class="inp" type="text" v-model="todayRunTime" disabled="true" />
|
</view>
|
<view class="form-item">
|
<label>设备稼动率:</label>
|
<input class="inp" type="text" v-model="utilizationRate" disabled="true" />
|
</view>
|
</view>
|
<view class="form-row">
|
<view class="form-item">
|
<label>生产时间开始:</label>
|
<input class="inp" type="text" v-model="startTime" disabled="true" />
|
</view>
|
<view class="form-item">
|
<label>生产时间结束:</label>
|
<input class="inp" type="text" v-model="endTime" disabled="true" />
|
</view>
|
<view class="form-item">
|
<label>生产时长(mi):</label>
|
<input class="inp" type="text" v-model="productionDuration" disabled="true" />
|
</view>
|
</view>
|
</view>
|
|
<!-- 下部:运行状态 -->
|
<view class="section card">
|
<view class="form-row">
|
<view class="form-item">
|
<label>最近首检时间:</label>
|
<input class="inp" type="text" v-model="lastInitialCheck" disabled="true" />
|
</view>
|
<view class="form-item">
|
<label>首检结论:</label>
|
<input class="inp" type="text" v-model="initialConclusion" disabled="true" />
|
</view>
|
<view class="form-item">
|
<label>巡检次数:</label><!--首检次数???-->
|
<input class="inp" type="number" v-model="patrolCount" disabled="true" />
|
</view>
|
</view>
|
<view class="form-row">
|
<view class="form-item">
|
<label>最近巡检时间:</label>
|
<input class="inp" type="text" v-model="lastPatrolCheck" disabled="true" />
|
</view>
|
<view class="form-item">
|
<label>巡检结论:</label>
|
<input class="inp" type="text" v-model="patrolConclusion" disabled="true" />
|
</view>
|
<view class="form-item">
|
<label>巡检次数:</label>
|
<input class="inp" type="number" v-model="patrolCount" disabled="true" />
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
name: "WorkOrder",
|
props: {
|
orderNo: String,
|
orderId: Number,
|
deviceNumber: String,
|
machineNo: String,
|
},
|
data() {
|
return {
|
order: {},
|
orderStatus: '开工',
|
|
collectedAmount: 0,
|
todayFaultNum: 0,
|
todayRunTime: '',
|
utilizationRate: '',
|
startTime: '',
|
endTime: '',
|
productionDuration: '',
|
lastInitialCheck: '',
|
initialConclusion: '',
|
lastPatrolCheck: '',
|
patrolConclusion: '',
|
patrolCount: 0,
|
timer: null, // Timer reference
|
|
DAA003List: [],
|
lineList: [],
|
};
|
},
|
created() {
|
|
this.fetchData(true);
|
|
this.sumbit();
|
|
this.init();
|
|
},
|
mounted() {
|
this.fetchData(false); // Initial fetch
|
this.timer = setInterval(this.fetchData, 120000); // Call fetchData every 3 minutes
|
},
|
beforeDestroy() {
|
clearInterval(this.timer); // Clear the timer on component destruction
|
},
|
methods: {
|
|
init() {
|
this.$post({
|
url: "/MesOrderSta/init",
|
data: {
|
orderId: this.orderId,
|
orderNo: this.orderNo,
|
machineNo: this.machineNo
|
}
|
}).then(res => {
|
this.findByOrderId();
|
});
|
|
this.$post({
|
url: "/MesOrderSelect/AddMesOrderSelect",
|
data: {
|
machineNo: this.machineNo,
|
}
|
}).then(res => {
|
|
})
|
},
|
// 添加刷新按钮的处理方法
|
handleRefresh() {
|
this.$sendPostRequest({
|
url: "http://192.168.0.94:9095/Numerical/RefreshDev",
|
data: {
|
machineNo: this.order.machineNo
|
},
|
contentType: "application/json"
|
}).then(res1 => {
|
if (res1.code == 200) {
|
this.fetchData(true); // 重新请求数据
|
this.sumbit(); // 重新提交相关数据
|
} else {
|
this.$showMessage("同步失败");
|
}
|
});
|
},
|
|
|
onDaa003Change(event) {
|
|
let orde = this.lineList[this.DAA003List.indexOf(event)];
|
|
this.orderId = orde.id;
|
this.orderNo = orde.daa001;
|
|
//切换为新的id
|
uni.setStorageSync('machine', this.machineNo);
|
uni.setStorageSync('orderId', this.orderId);
|
uni.setStorageSync('orderNo', this.orderNo);
|
|
this.fetchData(false);
|
|
this.sumbit();
|
},
|
sumbit() {
|
|
this.$post({
|
url: "/MesOrderSta/FindByOrderNo",
|
data: {
|
orderId: this.orderId,
|
orderNo: this.orderNo
|
}
|
}).then(res => {
|
let statusForm = res.data.tbBillList;
|
|
this.startTime = res.data.tbBillList.startTime;
|
this.endTime = res.data.tbBillList.endTime;
|
|
this.productionDuration = "0m";
|
|
if (this.startTime) {
|
|
let date1 = new Date(this.startTime);
|
let date2 = new Date();
|
if (this.endTime) {
|
date2 = new Date(this.endTime);
|
}
|
|
// 计算两个日期之间的差异(以毫秒为单位)
|
let differenceInMilliseconds = date2 - date1;
|
|
this.productionDuration = (differenceInMilliseconds / 60000).toFixed(2);
|
}
|
|
|
// this.$post({
|
// url: "/MesOrderSta/Binding",
|
// data: {
|
// id: statusForm.id,
|
// orderId: this.orderId,
|
// machineNo: this.machineNo
|
// }
|
// }).then(res1 => {
|
|
// })
|
});
|
},
|
fetchData(flag) {
|
//let machine = uni.getStorageSync('machine');
|
// let orderId = uni.getStorageSync('orderId');
|
// let orderNo = uni.getStorageSync('orderNo');
|
|
// if (orderId) {
|
// this.orderId = orderId;
|
// } else {
|
// if (!this.orderId) {
|
// this.orderId = uni.getStorageSync('id');
|
// }
|
|
// }
|
|
// if (orderNo) {
|
// this.orderNo = orderNo;
|
// } else {
|
// if (!this.orderNo) {
|
// this.orderNo = uni.getStorageSync('daa001');
|
// }
|
// }
|
|
// if (machine) {
|
// this.machineNo = machine;
|
// } else {
|
// if (!this.machineNo) {
|
// this.machineNo = uni.getStorageSync('machineNo');
|
// }
|
// }
|
|
|
if (!this.orderId && !this.orderNo) {
|
return;
|
}
|
|
this.getOrderById();
|
this.getSJByOrder();
|
this.getXJByOrder();
|
|
if (flag) {
|
this.$post({
|
url: "/Womdaa/GetWomdaasByShow",
|
data: {
|
machineNo: this.machineNo
|
}
|
}).then(res => {
|
this.lineList = res.data.tbBillList;
|
this.DAA003List = res.data.tbBillList.map(item => item.daa003);
|
})
|
}
|
},
|
formatDate(date) {
|
let year = date.getFullYear(); // 获取年份
|
let month = String(date.getMonth() + 1).padStart(2, '0'); // 获取月份并补零
|
let day = String(date.getDate()).padStart(2, '0'); // 获取日期并补零
|
return `${year}-${month}-${day}`; // 返回格式化后的字符串
|
},
|
getOrderById() {
|
this.$post({
|
url: "/Womdaa/GetWomdaaById",
|
data: {
|
orderId: this.orderId,
|
orderNo: this.orderNo
|
}
|
}).then(res => {
|
|
if (res.data.tbBillList == null) {
|
this.$showMessage("工单不存在或者未开工,请检查");
|
// 保证order为对象,避免模板报错
|
this.order = {
|
daa001: '',
|
moldId: '',
|
daa008: '',
|
daa004: '',
|
daa003: '',
|
daa011: '',
|
daa018: '',
|
machineNo: '',
|
engineeringNo: '',
|
todayOutput: 0,
|
todayRunTime: '',
|
todayFaultNum: 0,
|
jdl: '',
|
};
|
return;
|
}
|
|
this.order = res.data.tbBillList;
|
|
uni.setStorageSync('engineeringNo', this.order.engineeringNo);
|
|
this.orderStatus = this.order.daa018;
|
this.collectedAmount = this.order.todayOutput;
|
|
if (!this.order.todayOutput) {
|
this.collectedAmount = 0;
|
}
|
|
this.todayRunTime = this.order.todayRunTime;
|
if (!this.order.todayRunTime) {
|
this.todayRunTime = "0";
|
}
|
|
//this.productionDuration = (this.order.todayOnlineTime / 3600).toFixed(2) + "h";
|
this.todayFaultNum = this.order.todayFaultNum;
|
this.utilizationRate = this.order.jdl + '%';
|
// this.startTime = this.order.workStartDate;
|
// this.endTime = this.order.workEndDate;
|
let title = this.machineNo + '号机台 工单号' + this.order.daa001 + ',已采集' + this.collectedAmount;
|
this.setTitle(title);
|
})
|
},
|
setTitle(title) {
|
// 修改页面标题的方法,uni-app中可以通过api直接设置当前页面的标题
|
uni.setNavigationBarTitle({
|
title: title
|
});
|
},
|
getSJByOrder() {
|
this.$post({
|
url: "/MesQaItemsDetect02/FindSJByOrderNo",
|
data: {
|
orderNo: this.orderNo
|
}
|
}).then(res => {
|
//this.order = res.data.tbBillList;
|
this.lastInitialCheck = res.data.tbBillList.fcheckDate;
|
this.initialConclusion = res.data.tbBillList.fcheckResu;
|
})
|
},
|
getXJByOrder() {
|
this.$post({
|
url: "/MesQaItemsDetect02/FindXJByOrderNo",
|
data: {
|
orderNo: this.orderNo
|
}
|
}).then(res => {
|
//this.order = res.data.tbBillList;
|
this.lastPatrolCheck = res.data.tbBillList.fcheckDate;
|
this.patrolConclusion = res.data.tbBillList.fcheckResu;
|
this.patrolCount = res.data.tbBillList.xjCount;
|
})
|
}
|
}
|
}
|
</script>
|
|
<style>
|
.top-order {
|
margin-bottom: 1vh;
|
}
|
|
.refresh-btn {
|
position: absolute;
|
top: -11px;
|
right: 21px;
|
/* padding: 10px 20px; */
|
cursor: pointer;
|
float: right;
|
background-color: #00A2E9;
|
color: white;
|
border: none;
|
font-size: 29px;
|
border-radius: 15px;
|
margin-top: -23px;
|
padding-left: 25px;
|
padding-right: 25px;
|
margin-top: 9px;
|
margin-bottom: 20px;
|
}
|
|
.refresh-btn:hover {
|
background-color: #00A2E9;
|
}
|
|
.form-row {
|
display: flex;
|
justify-content: space-between;
|
margin-bottom: 1.5vh;
|
}
|
|
.form-item {
|
width: 100%;
|
padding: 4px;
|
margin: 10px 10px;
|
}
|
|
.inp {
|
float: left;
|
width: 63%;
|
padding: 0.5vh;
|
border: 1px solid #ccc;
|
border-radius: 0.5vw;
|
margin-top: 0.3vh;
|
font-size: 1.3vw;
|
/* Larger font for inputs */
|
}
|
|
|
.status-block p {
|
margin: 1vh 0;
|
font-size: 1.5vw;
|
font-weight: bold;
|
}
|
|
/* 卡片样式 */
|
.card {
|
background-color: #fff;
|
border-radius: 0.8vw;
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
padding: 1.5vh;
|
border: 1px solid black;
|
margin-top: -1vh;
|
margin-bottom: 2vh;
|
font-size: 1.5vw;
|
/* Base font size for card content */
|
}
|
|
/* 卡片标题在左上角 */
|
.card-header {
|
position: absolute;
|
top: -1vh;
|
left: 2vw;
|
background-color: #ffffff;
|
padding: 0.5vh 1vw;
|
border-radius: 0.5vw;
|
font-weight: bold;
|
font-size: 1.8vw;
|
/* Larger font for headers */
|
}
|
|
.form-item label {
|
float: left;
|
margin-top: 8px;
|
font-size: 1.5vw;
|
/* Larger font for labels */
|
display: inline-block;
|
margin-bottom: 0.5vh;
|
color: #333;
|
}
|
|
|
.status-row label,
|
.check-row label {
|
width: 30%;
|
padding-right: 1vw;
|
text-align: right;
|
font-size: 1.5vw;
|
/* Increased font for labels in status sections */
|
}
|
|
.status-row input,
|
.check-row input {
|
width: 65%;
|
font-size: 1.5vw;
|
}
|
|
.form-row2 {
|
display: flex;
|
float: left;
|
margin-left: -65px;
|
flex-direction: column;
|
margin-top: -13px;
|
line-height: 48px;
|
align-content: flex-start;
|
|
}
|
|
.form-row3 {
|
display: flex;
|
flex-direction: column;
|
flex-wrap: nowrap;
|
align-content: flex-start;
|
justify-content: flex-start;
|
align-items: flex-start;
|
margin-bottom: 2.5vh
|
}
|
|
.form-row4 {
|
display: flex;
|
flex-direction: row;
|
flex-wrap: nowrap;
|
}
|
|
.inp1 {
|
width: 42%;
|
height: 3.5em;
|
font-weight: bolder;
|
margin-top: -41px;
|
font-size: 39px;
|
text-align: center;
|
color: red;
|
}
|
|
.inp2 {
|
float: right;
|
width: 220px;
|
height: 220px;
|
border-radius: 100%;
|
text-align: center;
|
margin-top: -42px;
|
/* margin-left: 37px; */
|
font-size: 96px;
|
background-color: #476ee1fc;
|
color: #ffffff;
|
margin-right: 172px;
|
}
|
</style>
|