1
huangxiaoqiang
10 天以前 8e49faa42ff419efa0641478702ce7d5f8455bd9
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
<template>
    <div :class="update()" :style="{ left: left, top: top, marginBottom: 0 + 'px', marginTop: 0 + 'px' }"
        @click="mouseClick" v-loading.fullscreen.lock="fullscreenLoading">
        <img v-if="imgType === '2'" src="../../public/lines.png" />
        <img v-if="imgType === '1'" src="../../public/lines2.png" />
        <label v-if="equipNo" class="equip-no">{{ equipNo }}</label>
    </div>
    <el-dialog v-model="dialogVisible" title="输送线信息查看" :before-close="handleClose">
        <el-form ref="$form" :model="lineItemInfo" label-position="left" label-width="100px" size="medium">
            <el-row :gutter="20" type="flex" justify="start" align="top" tag="div">
                <el-col :span="12" :offset="0" :push="0" :pull="0" tag="div">
                    <el-form-item label="设备编号:">
                        <j-el-description :value="equipNo" type="primary" ellipsis></j-el-description>
                    </el-form-item>
                </el-col>
                <el-col :span="12" :offset="0" :push="0" :pull="0" tag="div">
                    <el-form-item label="是否有盘:">
                        <j-el-description :value="lineItemInfo.r_Line_HasPallet" type="primary" ellipsis></j-el-description>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :gutter="20" type="flex" justify="start" align="top" tag="div">
                <el-col :span="12" :offset="0" :push="0" :pull="0" tag="div">
                    <el-form-item label="托盘条码:">
                        <j-el-description :value="lineItemInfo.r_Line_Barcode" type="primary" ellipsis></j-el-description>
                    </el-form-item>
                </el-col>
                <el-col :span="12" :offset="0" :push="0" :pull="0" tag="div">
                    <el-form-item label="报警代码:">
                        <j-el-description :value="lineItemInfo.r_Line_ErrorCode" type="primary" ellipsis></j-el-description>
                    </el-form-item>
                </el-col>
            </el-row>
 
        </el-form><el-divider />
        <h4 style="margin-bottom: 20px;">手动操作</h4>
        <el-form ref="form" :model="form" label-width="100px">
            <el-row :gutter="20" type="flex" justify="start" align="top" tag="div">
                <el-col :span="16" :offset="0" :push="0" :pull="0" tag="div">
                    <el-form-item label="任  务  命  令" prop="TargetAddress">
                        <el-select size="large" v-model="form.TaskType" placeholder="请选择任务命令">
                            <el-option label="入库" value="1" />
                            <el-option label="出库" value="2" />
                        </el-select>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :gutter="20" type="flex" justify="start" align="top" tag="div">
                <el-col :span="16" :offset="0" :push="0" :pull="0" tag="div">
                    <el-form-item label="下一目标地址:">
                        <el-input size="large" v-model="form.SourceAddress" placeholder="请输入起点行列层" />
                    </el-form-item>
                </el-col>
            </el-row>
        </el-form>
        <el-divider />
        <el-row :gutter="20" type="flex" justify="start" align="top" tag="div">
            <el-col :span="4" :offset="0" :push="0" :pull="0" tag="div">
                <el-button type="primary" size="small" plain @click="SendCommand">
                    <i class="el-icon-check">发送命令</i>
                </el-button>
            </el-col>
            <el-col :span="4" :offset="0" :push="0" :pull="0" tag="div">
                <el-button type="warning" size="small" plain @click="ConveyorLineReset">
                    <i class="el-icon-check">复位</i>
                </el-button>
 
            </el-col>
            <el-col :span="4" :offset="0" :push="0" :pull="0" tag="div">
                <el-button type="danger" size="small" plain @click="ConveyorLineEmergencyStop">
                    <i class="el-icon-check">停止</i>
                </el-button>
            </el-col>
            <el-col :span="4" :offset="0" :push="0" :pull="0" tag="div">
                <el-button type="danger" size="small" plain @click="ConveyorLineReturn">
                    <i class="el-icon-check">退回</i>
                </el-button>
            </el-col>
            <el-col :span="4" :offset="0" :push="0" :pull="0" tag="div">
                <el-button type="danger" size="small" plain @click="ConveyorLineCancel">
                    <i class="el-icon-check">取消任务</i>
                </el-button>
            </el-col>
            <el-col :span="4" :offset="0" :push="0" :pull="0" tag="div">
                <el-button type="danger" size="small" plain @click="ConveyorLineInitialize">
                    <i class="el-icon-check">工位初始化</i>
                </el-button>
            </el-col>
        </el-row>
        <template #footer>
            <div class="dialog-footer">
                <el-button @click="dialogVisible = false">取消</el-button>
                <el-button type="primary" @click="dialogVisible = false">
                    确认
                </el-button>
            </div>
        </template>
    </el-dialog>
</template>
 
<script>
import { defineComponent } from "vue";
import JElDescription from "./JElDescription";
export default defineComponent({
    components: {
        JElDescription
    },
    props: {
        equipNoFontColor: {
            type: String,
            default: "blue",
        },
        equipNo: {
            type: String,
            default: "0",
        },
        imgType: {
            type: String,
            default: "1",
        },
        positionX: {
            type: Int32Array,
            default: 1,
        },
        positionY: {
            type: Int32Array,
            default: 1,
        },
        url: {
            type: String,
            default: "",
        },
        condition: {
            type: Boolean,
            default: false,
        },
    },
    data() {
        return {
            left: "500px",
            top: "400px",
            dialogVisible: false,
            lineItemInfo: {
                r_Line_Barcode: "",
                r_Line_HasPallet: "",
                r_Line_TaskNum: "",
                r_Line_ErrorCode: "",
                r_Line_Target: "",
            },
            form: {
                TaskType: "",
                TargetAddress: "",
                DeviceCode: "",
            },
        };
    },
    mounted() {
        const axisX = (this.positionX - 1) * 40 + 100;
        const axisY = (this.positionY - 1) + 50;
        this.$nextTick(() => {
            this.left = `${axisX}px`;
            this.top = `${axisY}px`;
        });
    },
    methods: {
        mouseClick() {
            this.fullscreenLoading = true;
            this.dialogVisible = true;
            // 处理点击事件
            this.http.post("api/DeviceInfo/GetConveyorLineInfo?DeviceChildCode=" + this.equipNo, null, "")
                .then((x) => {
                    if (x.status) {
                        this.lineItemInfo = x.data;
                    } else {
                        this.$message({
                            type: "error",
                            message: x.message,
                        });
                    }
                });
 
            this.fullscreenLoading = false;
        },
 
        SendCommand() {
            this.fullscreenLoading = true;
            this.form.DeviceCode=this.equipNo;
            this.http.post("api/DeviceInfo/ConveyorLineHandTask" ,this.form)
                .then((x) => {
                    if (!x.status) {
                        this.$message.error(x.message);
                    } else {
                        this.$Message.success(x.message);
                    }
                })
                .finally(() => {
                    this.fullscreenLoading = false;
                });
        }, 
        ConveyorLineReset() {
            this.fullscreenLoading = true;
            this.http.post("api/DeviceInfo/ConveyorLineReset?DeviceChildCode=" + this.equipNo, null, "")
                .then((x) => {
                    if (!x.status) {
                        this.$message.error(x.message);
                    } else {
                        this.$Message.success(x.message);
 
                    }
                })
                .finally(() => {
                    this.fullscreenLoading = false;
                });
        },
        ConveyorLineEmergencyStop() {
            this.fullscreenLoading = true;
            this.http.post("api/DeviceInfo/ConveyorLineEmergencyStop?DeviceChildCode=" + this.equipNo, null, "")
                .then((x) => {
                    if (!x.status) {
                        this.$message.error(x.message);
                    } else {
                        this.$Message.success(x.message);
 
                    }
                })
                .finally(() => {
                    this.fullscreenLoading = false;
                });
        }, 
        ConveyorLineReturn() {
            this.fullscreenLoading = true;
            this.http.post("api/DeviceInfo/ConveyorLineReturn?DeviceChildCode=" + this.equipNo, null, "")
                .then((x) => {
                    if (!x.status) {
                        this.$message.error(x.message);
                    } else {
                        this.$Message.success(x.message);
                    }
                })
                .finally(() => {
                    this.fullscreenLoading = false;
                });
        },
        ConveyorLineCancel() {
            this.fullscreenLoading = true;
            this.http.post("api/DeviceInfo/ConveyorLineCancel?DeviceChildCode=" + this.equipNo, null, "")
                .then((x) => {
                    if (!x.status) {
                        this.$message.error(x.message);
                    } else {
                        this.$Message.success(x.message);
                    }
                })
                .finally(() => {
                    this.fullscreenLoading = false;
                });
        },
        ConveyorLineInitialize() {
            this.fullscreenLoading = true;
            this.http.post("api/DeviceInfo/ConveyorLineInitialize?DeviceChildCode=" + this.equipNo, null, "")
                .then((x) => {
                    if (!x.status) {
                        this.$message.error(x.message);
                    } else {
                        this.$Message.success(x.message);
                    }
                })
                .finally(() => {
                    this.fullscreenLoading = false;
                });
        },
        update() {
            return !this.condition ? 'custom-img' : 'custom-img-color'
        },
        startTimer() {
            // 开启定时器,每3秒执行一次
            this.timer1 = setInterval(() => {
                update();
            }, 500);
        },
    },
});
</script>
 
<style scoped>
.custom-img {
    position: relative;
    display: inline-block;
    /* background-color:  #d9ecff ; */
}
 
.custom-img-color {
    position: relative;
    display: inline-block;
    background-color: #05fa7f;
    color: white;
    text-align: center;
}
 
/* .custom-img-color::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: #05fa7f;
  border-radius: 50%;  
} */
 
.custom-img img {
    width: 40px;
    height: 40px;
}
 
.custom-img-color img {
    width: 40px;
    height: 40px;
}
 
.equip-no {
    position: absolute;
    top: 15px;
    font-size: 12px;
    margin-left: -35px;
}
</style>