Admin
4 天以前 bd6818fc9d40f343547bafca0743658f3c0379dc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
<template style = "width: 100%;height:100%">
 
  <!-- <el-button style="width:200px;height:100px;margin-top:100px;margin-left:100px" type="success" size="big" @click="generalFun">通信按钮</el-button> -->
  <div>
    <el-button class="btnStyle" type="success" size="big" @click="checkToNormalModel">切换到正常模式</el-button>
    <el-button class="btnStyle" type="danger" size="big" @click="checkToEmergeModel">切换到应急模式</el-button>
    <el-button class="btnStyle" type="success" size="big" @click="checkToEmptyIn">切换到空托入库</el-button>
    <el-button class="btnStyle" type="danger" size="big" @click="checkToBoxIn">切换到轴承入库</el-button>
  </div>
 
  <div>
    <div class="fontStyle">入库线体控制模式:{{inboundRunModelVal}}</div>
  </div>
 
  <div>
    <div class="fontStyle">入库线体当前模式:正常模式值:{{normalModelVal}},应急模式值:{{emergeModelVal}}</div>
  </div>
 
  <div>
    <div class="fontStyle">当前执行的模式为:{{inboundModel}}</div>
  </div>
 
  <div>
    <div class="fontStyle">三台穿梭车的状态:{{carStatusValue}}</div>
  </div>
 
  <div>
    <div class="fontStyle">测量设备状态:{{measureStatusValue}}</div>
  </div>
 
  <el-row type="flex" justify="left" align="middle" style="background-color:#ffffff">
    <div class="fontStyle">当前称重工位重量:{{currentWeight}}</div>
    <el-button style="width:150px;height:45px;margin-left:20px;margin-top:30px;" type="success" size="big" @click="weightCheckByManualOk">继续任务</el-button>
  </el-row>
 
  <el-row type="flex" justify="left" align="middle" style="background-color:#ffffff">
    <div class="fontStyle">入库检验托盘码结果:系统条码值:{{systemBarcode_30301}},PLC条码值:{{plcBarcode_30301}}</div>
    <el-button style="width:150px;height:45px;margin-left:20px;margin-top:30px;" type="success" size="big" @click="checkByManualOk">继续任务</el-button>
  </el-row>
 
 
  <div>
    <div class="fontStyle" style="color: red;">测量不合格数量:{{goodscount}}</div>
  </div>
  <div>
    <div class="fontStyle" style="color: red;">称重不合格数量:{{standarcount}}</div>
  </div>
  <div>
    <div class="fontStyle" style="color: red;">超期数量:{{dateDiffResultcount}}</div>
  </div>
</template>
 
<script>
import VolForm from "@/components/basic/VolForm.vue";
import VolBox from "@/components/basic/VolBox.vue";
export default {
  components: {VolForm,VolBox},   
  
  data() {
    return { 
      timer:'', 
      normalModelVal:"",
      emergeModelVal:"",
      inboundRunModelVal:"",  //手动、单机、联机
      inboundModel:"",
      carStatusValue:"",
      measureStatusValue:"",
      currentWeight:"",
      currentWeight_RFID:"",
      systemBarcode_30301:"",
      plcBarcode_30301:"",
      taskNum_30301:"",
      station_30301:"",
      goodscount:0,
      standarcount:0,
      dateDiffResultcount:0,
    };
  },
 
  mounted() { 
    this.timer = setInterval(this.getInboundLineModel, 5000);   
    setTimeout(() => {
      
      this.openWebSocket();
 
    }, 1000)
    this.gevvcontian();
  },
 
  methods:{
 
    //开启webscoket服务,接受站台消息
    openWebSocket () {
      const _this = this;
      //初始化websocket
     // const ws = new WebSocket("ws://127.0.0.1:9111/");
      const ws = new WebSocket("ws://192.168.1.10:9111/");
      ws.onopen = function () {
        console.log("websocket开启成功");
      };
 
      ws.onmessage = function (evt) {
        var msgData = evt.data;
        var jsonObj = JSON.parse(msgData);
 
        //debugger;
        var keys = Object.keys(jsonObj);
        if (keys.includes('checkBarcode')) {
          _this.systemBarcode_30301 = jsonObj.systemRFID;
          _this.plcBarcode_30301 = jsonObj.lineRFID;
          _this.taskNum_30301 = jsonObj.taskNumber;
          _this.station_30301 = jsonObj.station;
        }
        if(keys.includes('currentWeight')){
          _this.currentWeight = jsonObj.currentWeight;
          _this.currentWeight_RFID = jsonObj.currentWeight_RFID;
        }
        if(keys.includes('measure')){
          _this.measureStatusValue = jsonObj.measureStatusValue;
        }
      };
 
      ws.onclose = function () {
        // 关闭 websocket
      };
    },
 
    generalFun(){
 
      var para = {};
 
      this.http.post("/api/Dt_locationinfo/InsertLocationInfo",para,"请求发送中...").then(x=>{
        if(x.status===true){
          this.$Message.success("成功");
        } else {
            this.$Message.error(x.message);
        }
      })
    },
 
    //获取超期数据
    gevvcontian(){
      this.http.post("/api/VV_ContainerInfo/Getgqrkts", null, false).then(x => {
        this.goodscount=x.data.goodscount;
        this.standarcount=x.data.standarcount;
        this.dateDiffResultcount=x.data.dateDiffResultcount;
      });
    },
 
    //获取当前入库线体模式
    getInboundLineModel(){
 
      var para = {};
 
      this.http.post("/api/ToWCS/GetInboundLineCurrentModel",para,null).then(x=>{
        if(x.status===true){
          
          this.normalModelVal = x.data["normal"];
          this.emergeModelVal = x.data["emerge"];
          this.inboundRunModelVal = x.data["controlModel"]; 
          this.carStatusValue = x.data["carStatus"];
          this.measureStatusValue = x.data["measureStatus"];
 
        } else {
            //this.$Message.error(x.message);
        }
      })
 
      this.http.post("/api/Dt_general_info/GetInboundModel",null,null).then(x=>{
        if(x.status===true){
          
          this.inboundModel = x.data;
 
        } else {
            //this.$Message.error(x.message);
        }
      })
    },
 
 
    //切换到正常模式
    checkToNormalModel(){
      this.$confirm("确定要切换到正常模式吗", "请注意!", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        center: true,
      }).then(() => {
          var para = {
          MainData:
            {  
              model:"normal",
            },
          };
 
          this.http.post("/api/ToWCS/ChangeInboundLineModel",para,"模式切换中...").then(x=>{
            if(x.status===true){
              this.$Message.success("已切换到正常模式");
            } else {
                this.$Message.error(x.message);
            }
          })
      });
      
    },
 
    //切换到应急模式
    checkToEmergeModel(){
      this.$confirm("确定要切换到应急模式吗", "请注意!", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        center: true,
      }).then(() => {
          var para = {
          MainData:
            {  
              model:"emerge",
            },
          };
 
          this.http.post("/api/ToWCS/ChangeInboundLineModel",para,"模式切换中...").then(x=>{
            if(x.status===true){
              this.$Message.success("已切换到应急模式");
            } else {
                this.$Message.error(x.message);
            }
          })
      });
      
    },
 
    //切换到空托入库
    checkToEmptyIn(){
      this.$confirm("确定要切换到空托入库吗", "请注意!", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        center: true,
      }).then(() => {
          var para = {
          MainData:
            {  
              model:"empty",
            },
          };
 
          this.http.post("/api/Dt_general_info/ChangeInboundModel",para,"切换中...").then(x=>{
            if(x.status===true){
              this.$Message.success("已切换到空托入库");
            } else {
                this.$Message.error(x.message);
            }
          })
      });
      
    },
 
 
    //切换到轴承入库
    checkToBoxIn(){
      this.$confirm("确定要切换到轴承入库吗", "请注意!", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        center: true,
      }).then(() => {
          var para = {
          MainData:
            {  
              model:"box",
            },
          };
 
          this.http.post("/api/Dt_general_info/ChangeInboundModel",para,"切换中...").then(x=>{
            if(x.status===true){
              this.$Message.success("已切换到轴承入库");
            } else {
                this.$Message.error(x.message);
            }
          })
      });
      
    },
 
    //上报托盘码不一致后,由人工核验后继续继续任务
    checkByManualOk(){
 
      this.$confirm("系统记录托盘码和线体读取到的不一致,确定要继续任务吗", "请注意!", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        center: true,
      }).then(() => {
            var para = {
            MainData:
            {  
              systemRFID:this.systemBarcode_30301,
              lineRFID:this.plcBarcode_30301,
              taskNumber:this.taskNum_30301,
              station:this.station_30301,
            },
          };
 
          this.http.post("/api/ToWCS/CheckBarcodeSameOk",para,"指令下发中...").then(x=>{
            if(x.status===true){
              this.$Message.success("下发成功");
            } else {
                this.$Message.error(x.message);
            }
          })
      });
    },
 
 
    //得到称重值后,手动继续任务
    weightCheckByManualOk(){
 
      this.$confirm("确认重量值在合理范围之内吗", "请注意!", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        center: true,
      }).then(() => {
            var para = {
            MainData:
            {  
              barcode:this.currentWeight_RFID,
            },
          };
 
          this.http.post("/api/ToWCS/WeightCheckOk",para,"指令下发中...").then(x=>{
            if(x.status===true){
              this.$Message.success("下发成功");
            } else {
                this.$Message.error(x.message);
            }
          })
      });
    },
    
  },
 
  beforeUnmount(){    
  },
 
};
 
 
</script>
 
 
 
<style>
 
  .btnStyle{
    width:150px;
    height:45px;
    margin-top:50px;
    margin-left:50px
  }
 
  .fontStyle{
    margin-left:50px;
    margin-top:30px;
    font-size:20px;
    color: rgb(56, 55, 55);
  }
 
 
  .forside{
    display: flex;
    justify-content: space-between;
  }
 
  
</style>