刘磊
2025-04-19 2f18780a16a68f7fc67dd3bca61b8d0aed7c8e1a
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
<template>
    <view>
        <view>
            <u-table font-size="25">
                <u-tr>
                    <u-td>
                        <xfl-select :list="UserArray" :initValue="this.$UserTool.UserInfo.userName" :clearable="false" :disabled="true">
                        </xfl-select>
                    </u-td>
                    <u-td width="25%">现在时间:</u-td>
                    <u-td width="25%">{{DateTime}}</u-td>
                </u-tr>
            </u-table>
        </view>
        <view style="padding: 20rpx 0rpx">
            <u-table>
                <u-tr>
                    <u-td width="25%">呼叫数量</u-td>
                    <u-td width="50%" >
                        <u-input  type="number" v-model="EmptyTrayNum" :border="true"  placeholder="请输入呼叫数量,默认1"></u-input> 
                    </u-td>
                    <u-td width="25%">
                        <u-button type="primary" @click="Save">呼叫</u-button>
                    </u-td>
                </u-tr>
            </u-table>
        </view>
            <view style="padding: 0rpx 0rpx">
                <!-- <text class="u-text-left">出库任务列表:每页{{pageSize}}条,共{{total}}条</text> -->
                <u-table font-size="22">
                    <u-tr style="height: 50px;">
                        <u-th class="tdth" width="10%">序列</u-th>
                        <u-th class="tdth" width="25%">托盘号</u-th>
                        <u-th class="tdth" width="25%">货位号</u-th>
                        <u-th class="tdth" width="20%">执行状态</u-th>
                        <u-th class="tdth" width="20%">操作</u-th>
                    </u-tr>
                    <u-tr style="height: 50px;" v-for="(item,index) in TaskArray" @click.native="TableItemCheck(item)">
                        <!-- @dblclick.native="TableItemCheck(item)" -->
                        <u-td width="10%">{{index+1}}</u-td><!-- {{(current-1)*pageSize+(index+1)}} -->
                        <u-td width="25%">{{item.barcode}}</u-td>
                        <u-td width="25%">{{item.locationId}}</u-td>
                        <u-td width="20%">{{item.state}}</u-td>
                        <u-td width="20%"><u-button style="height: 25px;width: 55px;" class="deleteBtn" type="primary" @click="CancelTask(index)">取消</u-button></u-td>
                    </u-tr>
                </u-table>
            </view>
            <uni-pagination @change="handlePage" :total="total" :pageSize="pageSize" :current="current">
            </uni-pagination>
        </view>
    </view>
</template>
 
<script>
    var _this;
    var _user;
    export default {
        data() {
            return {
                DateTime: '',
                CurrentUser: '', //当前用户
                EmptyTrayNum: '', //空托盘数
                total: 0,
                pageSize: 10,
                current: 1,
                TaskArray: []
            }
        },
        methods: {
            
            //取消某一个空托盘出库
            CancelTask(index){
                uni.showModal({
                    title: '提示',
                    content: '确认要取消该条呼叫记录吗?',
                    success: function(res) {
                        if (res.confirm) {
                            var task = _this.TaskArray[index];
                            let data = {
                                mainData: 
                                {
                                    "barcode": task.barcode
                                }
                            };
                            _this.$AjaxRequest.Params('post', 'Dt_taskinfo/CancelATask', data, _user
                                .token);
                            _this.$AjaxRequest.Request().then(function(result) {
                                if (result.data.status) {
                                    
                                    uni.showToast({
                                        title: "取消成功!",
                                        duration: 2000
                                    });
                                    
                                    _this.$AjaxRequest.Params('post', 'Dt_taskinfo/GetEmptyPalletTaskList', data, _user
                                        .token);
                                    _this.$AjaxRequest.Request().then(function(result) {
                                        if (result.data.status) {
                                            _this.TaskArray = result.data.data;
                                        } else {
                                            
                                        }
                                    }).catch(function(err) {
                                        
                                    });
                                    
                                } else {
                                    uni.showToast({
                                        icon: 'none',
                                        title: "请求错误:" + result.data.message,
                                        duration: 2000
                                    });
                                }
                            }).catch(function(err) {
                                uni.showToast({
                                    icon: 'none',
                                    title: "请求后台异常,错误信息." + err.errMsg,
                                    duration: 2000
                                });
                            });
                        }else if (res.cancel) {}
                    }
                });
            },
            
            setTimer() {
                if (this.timer == null) {
                    this.timer = setInterval(() => {
                        this.DateTime = this.$DateTool.getDate();
                    }, 1000)
                }
            },
            Save() {
                if ('' == _this.EmptyTrayNum) {
                    // uni.showToast({
                    //     icon: 'none',
                    //     title: "请输入呼叫数量",
                    //     duration: 2000
                    // });
                    // return;
                    _this.EmptyTrayNum = 1;
                }
                
                uni.showModal({
                    title: '提示',
                    content: '确认要呼叫该数量的空托盘吗?',
                    success: function(res) {
                        if (res.confirm) {
                            let data = {
                                mainData: 
                                {
                                    "callNumber": _this.EmptyTrayNum
                                }
                            };
                            _this.$AjaxRequest.Params('post', 'VV_ContainerInfo_EmptyPallet/CallEmptyPallet', data, _user
                                .token);
                            _this.$AjaxRequest.Request().then(function(result) {
                                if (result.data.status) {
                                    uni.showToast({
                                        title: "呼叫成功!",
                                        duration: 2000
                                    });
                                    
                                    _this.$AjaxRequest.Params('post', 'Dt_taskinfo/GetEmptyPalletTaskList', data, _user
                                        .token);
                                    _this.$AjaxRequest.Request().then(function(result) {
                                        if (result.data.status) {
                                            _this.TaskArray = result.data.data;
                                        } else {
                                            
                                        }
                                    }).catch(function(err) {
                                        
                                    });
                                } else {
                                    uni.showToast({
                                        icon: 'none',
                                        title: "请求错误:" + result.data.message,
                                        duration: 2000
                                    });
                                }
                            }).catch(function(err) {
                                uni.showToast({
                                    icon: 'none',
                                    title: "请求后台异常,错误信息." + err.errMsg,
                                    duration: 2000
                                });
                            });
                        }else if (res.cancel) {}
                    }
                });
            }
        },
        created: function() {
            //this.date = this.$DateTool.getDate();
            // 每次进入界面时,先清除之前的所有定时器,然后启动新的定时器
            clearInterval(this.timer)
            this.timer = null;
            this.setTimer();
            _user = this.$UserTool.UserInfo;
            this.CurrentUser = _user.userName;
            this.UserArray = [this.$UserTool.AllUserInfo];
            
            this.$AjaxRequest.Params('post', 'Dt_taskinfo/GetEmptyPalletTaskList', null, _user
                .token);
            this.$AjaxRequest.Request().then(function(result) {
                if (result.data.status) {
                    _this.TaskArray = result.data.data;
                } else {
                    
                }
            }).catch(function(err) {
                
            });
        },
        destroyed: function() {
            // 每次离开当前界面时,清除定时器
            clearInterval(this.timer);
            this.timer = null;
        },
        mounted() {
            _this = this;
            
            
        }
    }
</script>
 
<style scoped lang="scss">
    .tdHeight {
        height: 80rpx;
    }
</style>