春风项目四线(合箱线、总装线)
yyt
2024-05-23 0ae327c0c3e6bf00e332f231c50a3bcbb0a7fb4c
提交 | 用户 | 时间
f4d049 1 <template>
H 2   <div class="app-container">
a0aea8 3     <el-card   class="box-card"  style="height: 60px" >
f4d049 4       <template>
a0aea8 5         <div class="container" type="flex" justify="center" style="text-align:center">
H 6 <!--          <el-row   type="flex" justify="center" style="text-align:center;height: 12px" >-->
7 <!--            <el-col  type="flex" justify="center"  :span="14" style="text-align:center">-->
941264 8           <el-divider><span style="font-size:22px;color:black"><strong>发动机数据检查</strong></span></el-divider>
a0aea8 9 <!--            </el-col>-->
H 10 <!--          </el-row>-->
f4d049 11         </div>
H 12       </template>
13     </el-card>
b51361 14    <el-row :gutter="0"  >
W 15      <el-col :span="14">
a0aea8 16        <el-card   class="box-card" style="margin-top: 5px" >
H 17              <el-form ref="form" :model="form"  label-width="25%"   >
18                <el-form-item prop="engineNo" style="margin-top: 16px">
19                <span slot="label" style="font-size:22px;color:black;"><strong>发动机号</strong></span>
3946f8 20                  <el-input style="font-size:20px" v-model="form.engineNo" placeholder="请输入发动机号" clearable  @keyup.space.native="EngineNohandleChange" >
95fb19 21                    <el-button slot="append" plain type="info" @click="EngineNohandleChange(form.engineNo)" icon="el-icon-search"></el-button>
8f6607 22                  </el-input>
f4d049 23                </el-form-item>
H 24              </el-form>
a0aea8 25              <el-form ref="form" :model="form"  label-width="25%"  >
H 26                <el-form-item   prop="productType"style="margin-top: 30px" >
27                   <span slot="label" style="font-size:22px;color:black"><strong>机型</strong></span>
28                  <el-input disabled style="font-size:20px"  value="form.productType" v-model="form.productType" placeholder="" />
f4d049 29                </el-form-item>
H 30              </el-form>
a0aea8 31              <el-form ref="form" :model="form"  label-width="25%"  >
H 32                <el-form-item   prop="orderNo" style="margin-top: 30px">
33                <span  slot="label" style="font-size:22px;color:black"><strong>工单编号</strong></span>
34                  <el-input disabled style="font-size:20px" v-model="form.orderNo" placeholder="" />
f4d049 35                </el-form-item>
H 36              </el-form>
a0aea8 37              <el-form ref="form" :model="form"  label-width="25%"  >
H 38                <el-form-item   prop="currentWorkstation" style="margin-top: 30px">
39                <span slot="label" style="font-size:22px;color:black"><strong>质量状态</strong></span>
40                  <el-input disabled style="font-size:20px" v-model:value="form.add" placeholder="" />
f4d049 41                </el-form-item>
H 42              </el-form>
43          <el-divider></el-divider>
a0aea8 44
f4d049 45          <el-row :gutter="10" class="mb8" type="flex" justify="center"  style="text-align: center">
H 46            <el-col :span="1.5">
c6aaad 47              <el-button plain  type="primary" style="width:400px;height:160px" v-hasPermi="['bs:formula:add']" @click="forceUpload">
b51361 48                <span   class="el-icon-thumb"   style="font-size:40px;color:black"></span>
c6aaad 49                <span style="font-size:45px;color:black" ><strong>强制上线</strong></span>
dbe5f1 50              </el-button>
f4d049 51            </el-col>
H 52          </el-row>
53        </el-card>
54      </el-col>
8f6607 55
a0aea8 56      <el-col :span="10"  inline style="margin-top: 5px">
941264 57          <el-card class="custom-content"  style="height: 264px">
a0aea8 58          <el-col :span="14">
8f6607 59            <span style="font-size:25px"><strong>质量状态</strong></span>
H 60            <el-divider></el-divider>
4b6839 61            {{this.form.engineCheckList}}
8f6607 62          </el-col>
H 63          </el-card>
941264 64          <el-card class="custom-content" style="height: 264px" >
a0aea8 65          <el-col :span="14"style="  ">
8f6607 66            <span style="font-size:25px"><strong>最终结果</strong></span>
H 67            <el-divider></el-divider>
68            {{queryParams.productType}}
69          </el-col>
70          </el-card>
f4d049 71      </el-col>
H 72    </el-row>
73   </div>
74 </template>
75 <script>
8f6607 76
5a05af 77 import { listOrderScheduling, forceUploadMethod, getUrl, getOrderScheduling, delOrderScheduling, addOrderScheduling, updateOrderScheduling } from "@/api/main/bs/orderScheduling/orderScheduling";
95fb19 78 import { listPassingStationCollection, getPassingStationCollection, delPassingStationCollection, addPassingStationCollection, updatePassingStationCollection } from "@/api/main/da/passingStationCollection/passingStationCollection";
H 79 import {listLineInfo} from "@/api/main/bs/lineInfo/lineInfo";
059083 80 import WebSocketReconnect from "@/utils/WebsocketTool";
W 81
82 // let websocket = null
83 // //判断当前浏览器是否支持WebSocket
84 // if ('WebSocket' in window) {
85 //   //连接WebSocket节点
86 //   websocket = new WebSocketReconnect('ws://127.0.0.1:8086/websocket/111122')
87 // } else {
88 //   alert('浏览器不支持webSocket')
89 // }
90 // //接收到消息的回调方法
91 // websocket.socket.onmessage = function (event) {
92 //   let data = event.data
93 //   console.log('后端传递的数据:' + data)
94 //   if (data != null && data !== ''){
95 //     this.result = JSON.parse(data)
96 //     console.log('this.result',this.result)
97 //     // this.form.engineNo = this.result.server_message
98 //     this.transEngineNo = this.result.server_message
99 //     console.log('this.transEngineNo11111111111',this.transEngineNo)
100 //   }
101 //
102 // }
103 // //监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常。
104 // window.onbeforeunload = function () {
105 //   websocket.close()
106 // }
107 // //关闭连接
108 // function closeWebSocket() {
109 //   websocket.close()
110 // }
111 // //发送消息
112 // function send() {
113 //   websocket.socket.send({ kk: 123 })
114 // }
8f6607 115
f4d049 116 export default {
8f6607 117   components: { },
H 118   options: [],
f4d049 119   props: [],
H 120   data() {
121     return {
5a05af 122       websocketUrl: '',
059083 123       websocket: null,
W 124       result: {},
125       transEngineNo: '',
95fb19 126       options: [],
H 127       total: 0,
128       engineCheckList:[],
8f6607 129       showFlag:false,
95fb19 130       buttondisabled:true,
059083 131       mess:'',
8f6607 132       // 查询参数
H 133       queryParams: {
134         pageNum: 1,
135         pageSize: 10,
136         engineNo: null,
95fb19 137         productType:null,
H 138         orderNo:null,
139         qualityStatus:null,
140         currentWorkstation: null,
4b6839 141         add: null,
H 142         engineCheckList:'暂无数据',
8f6607 143       },
H 144       // 表单参数
95fb19 145       form: {
H 146         engineNo: null,
147         productType:null,
148         orderNo:null,
149         qualityStatus:null,
150         currentWorkstation: null,
4b6839 151         add: null,
H 152         engineCheckList:'暂无数据',
95fb19 153       },
4b6839 154       add: null,
8f6607 155     };
f4d049 156   },
H 157   computed: {},
059083 158   watch: {
W 159     // transEngineNo:{
160     //   handler(newVal,oldVal) {
161     //     console.log('newVal',newVal)
162     //     console.log('oldVal',oldVal)
163     //     this.form.engineNo = newVal
164     //     console.log('11111111111111')
165     //     console.log('this.form.engineNo',this.form.engineNo)
166     //   },
167     //   immediate:true
168     // }
169   },
5a05af 170   created() {
W 171
172   },
059083 173   mounted() {
5a05af 174     this.getWebUrl()
W 175
059083 176   },
8f6607 177   methods: {
5a05af 178     getWebUrl(){
W 179       console.log("1111")
180       getUrl().then(res=>{
181         console.log("res",res)
182         this.websocketUrl = res
183         this.initWebSocket()
184       })
185     },
c6aaad 186     forceUpload() {
W 187       console.log('0000', this.form.engineNo)
188       if (this.form.engineNo !== null) {
189         forceUploadMethod(this.form.engineNo).then(res => {
190
191         })
192       } else {
193         this.$message({
194           message: '请输入发动机条码',
195           type: 'error',
196           offset: 300
197         })
198       }
199     },
059083 200     initWebSocket: function (){
W 201       //判断当前浏览器是否支持WebSocket
202       if ('WebSocket' in window) {
203         //连接WebSocket节点
5a05af 204         console.log("9999",this.websocketUrl)
W 205         this.websocket = new WebSocketReconnect(this.websocketUrl)
059083 206
W 207         //接收到消息的回调方法
208         this.websocket.socket.onmessage = (event) => {
209           let data = event.data
210           console.log('后端传递的数据:' + data)
211           if (data != null && data !== ''){
212             this.result = JSON.parse(data)
213             console.log('this.result',this.result)
214             this.form.engineNo = this.result.server_message
215             // this.transEngineNo = this.result.server_message
3946f8 216             console.log('this.transEngineNo11111111111',this.form.engineNo)
W 217             if (this.form.engineNo !== null && this.form.engineNo !== ''){
218               this.EngineNohandleChange()
219             }
059083 220           }
W 221         }
222 //监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常。
223         window.onbeforeunload = function () {
224           this.websocket.close()
225         }
226 //关闭连接
227         function closeWebSocket() {
228           this.websocket.close()
229         }
230 //发送消息
231         function send() {
232           this.websocket.socket.send({ kk: 123 })
233         }
234       } else {
235         alert('浏览器不支持webSocket')
236       }
237     },
4b6839 238     reset() {
H 239       this.form = {
240         engineNo:null,
95fb19 241         productType:null,
H 242         orderNo:null,
243         qualityStatus:null,
244         currentWorkstation: null,
4b6839 245         add: null,
H 246         engineCheckList:'暂无数据',
247       };
248       this.resetForm("form");
249     },
8f6607 250     EngineNohandleChange(){
3946f8 251       console.log("EngineNohandleChange")
dbe5f1 252       if(this.form.engineNo !== null && this.form.engineNo !== undefined){
4b6839 253         let OrderSchedulingParam = {engineNo: null}
95fb19 254         OrderSchedulingParam.engineNo = this.form.engineNo;
H 255         listOrderScheduling(OrderSchedulingParam).then(response => {
c6aaad 256           console.log(response)
4b6839 257           if(response.total === 1 ){
H 258             this.form.productType = response.rows[0].model
259             this.form.orderNo = response.rows[0].orderNo
260             this.form.qualityStatus = response.rows[0].qualityStatus
261             this.form.currentWorkstation = response.rows[0].currentWorkstation
262             this.form.add= response.rows[0].currentWorkstation+ response.rows[0].qualityStatus
263             if(this.form.qualityStatus ==='不合格'){
264               this.buttondisabled = false;
265             }
266             else{
267               this.buttondisabled = true;
268             }
269           }
270           else{
271             this.reset();
272             this.buttondisabled = true
a873f8 273             const h = this.$createElement;
H 274             this.$message({
275               message: h('p',null, [
276                        h('span', null, '警告 '),
277                        h('i', { style: 'color: black' }, '输入的发动机号有误'),
278                        h()]),
279               type: 'error',
280               center: true,
281               offset:300
282             });
283           }
8f6607 284         });
4b6839 285         let PassingStationCollectionParam = {sfcCode: null}
H 286         PassingStationCollectionParam.sfcCode = this.form.engineNo;
95fb19 287         listPassingStationCollection(PassingStationCollectionParam).then(ponse =>{
4b6839 288           this.engineCheckList = ponse.rows.locationCode ;
H 289           if(ponse.rows.length >= 1 && this.form.engineNo !== undefined){
290             this.form.engineCheckList = ''
291             for (let i = 0; i < ponse.rows.length; i++) {
292               this.form.engineCheckList += '   工位:'+ ponse.rows[i].locationCode+'['+ponse.rows[i].outRsSign+']'
293             }
294           }
295           else{
296             this.form.engineCheckList = '暂无数据'
297           }
95fb19 298         });
dbe5f1 299       }
8f6607 300     },
4b6839 301
95fb19 302
8f6607 303   },
H 304   }
305
f4d049 306
H 307 </script>
4b6839 308 <style scoped>
H 309 ::v-deep .el-input__inner{
a0aea8 310   height: 40px;
4b6839 311 }
H 312 ::v-deep .el-form-item__label {
a0aea8 313   line-height: 40px;
4b6839 314 }
a0aea8 315 .custom-content {
H 316   height: 50%; /* 设置高度为50% */
317 }
a873f8 318 /*.my-custom-modal .el-dialog__wrapper {*/
H 319 /*  width: 400px; !* 设置宽度 *!*/
320 /*  height: 200px; !* 设置高度 *!*/
321 /*  top: 50px; !* 设置距离页面顶部的位置 *!*/
322 /*  left: 50px; !* 设置距离页面左侧的位置 *!*/
323 /*}*/
4b6839 324 </style>