schangxiang@126.com
2024-12-08 df485888ecb9f69c0051fc192b87aec700cc4f89
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>
    <view class="overflow" style="padding-bottom:100px">
        <!-- 顶部 -->
        <cu-custom bgColor="bg-white" :isBack="true">
            <block slot="backText"></block>
            <block slot="content">点到点</block>
        </cu-custom>
        <!-- 操作人 -->
        <!-- <view class="flex justify-end align-center padding_right30rpx padding_top12rpx">
            <text class="fontSize12rpx"> 操作人:{{operator}} </text>
        </view> -->
        <!-- 遮挡层 -->
        <modal-code ref="resmodal" :rescode='rescode' :resmessage='resmessage' />
        <view class="">
            <u-form labelPosition="left" :model="warehouse" label-width="260rpx" ref="warehouseRef">
                <u-row class="border_bottom margin_top10rpx  background_fff padding_left25rpx">
                    <u-col span="12">
                        <u-form-item label="来源库位编号:" class="uFormItem">
                            <u-input v-model.trim="warehouse.placeCode" placeholder="请录入或扫码"
                                @focus="warehouse.placeCode = ''" class="width padding_left25rpx" :focus="true"
                                @confirm="materialBlur(1)">
                            </u-input>
                        </u-form-item>
                    </u-col>
                </u-row>
                <u-row class="border_bottom margin_top10rpx  background_fff padding_left25rpx">
                    <u-col span="12">
                        <u-form-item label="容器编号:" class="uFormItem">
                            <u-input v-model.trim="warehouse.containerCode" placeholder="请录入或扫码"
                                @focus="warehouse.containerCode = ''" class="width padding_left25rpx"
                                @confirm="materialBlur(2)">
                            </u-input>
                        </u-form-item>
                    </u-col>
                </u-row>
        
                <u-row class="border_bottom margin_top10rpx  background_fff padding_left25rpx">
                    <u-col span="12">
                        <u-form-item required label="目标库区/库位:" class="uFormItem">
                            <u-input v-model.trim="placeCodeTrg" placeholder="请录入或扫码"
                                @focus="placeCodeTrg = ''" class="width padding_left25rpx">
                            </u-input>
                        </u-form-item>
                    </u-col>
                </u-row>
            </u-form>
            <view v-for="(item, eindex) in singlist" :key="eindex" class="margin_top10rpx">
                <u-swipe-action :show="item.show" :index="eindex" @click="longpredel" @open="open" @close="close"
                    :options="options">
                    <view v-show="item.placeCode || item.containerCode"
                        class="fontSize32rpx background_fff padding10" :class="item.isYueku == '是' ? 'bg_item' : ''"
                        style="width: 100vw">
                        <u-row v-show="item.placeCode">
                            <u-col span="12">
                                <view class="Wb_box">
                                    <text class="el_batchNo padding_left25rpx">
                                        来源库位:
                                    </text>
                                    <text class="el_batchVal">
 
                                        {{ item.placeCode }}
                                    </text>
                                </view>
                            </u-col>
                        </u-row>
                        <u-row v-show="item.placeCode">
                            <u-col span="12">
                                <view class="Wb_box">
                                    <text class="el_batchNo padding_left25rpx">
                                        来源库位是否虚拟:
                                    </text>
                                    <text class="el_batchVal">
                                        {{ item.isVirtually ? "是" : "否" }}
                                    </text>
                                </view>
                            </u-col>
                        </u-row>
                        <u-row v-show="item.containerCode">
                            <u-col span="12">
                                <view class="Wb_box">
                                    <text class="el_batchNo padding_left25rpx">
                                        容器编号:
                                    </text>
                                    <text class="el_batchVal">
                                        {{ item.containerCode }}
                                    </text>
                                </view>
                            </u-col>
                        </u-row>
 
                        <u-row v-show="item.placeCode || item.placeCode">
                            <u-col span="12">
                                <view class="Wb_box">
                                    <text class="el_batchNo padding_left25rpx">
                                        目标库位/库区:
                                    </text>
                                    <text class="el_batchVal">
                                        {{ placeCodeTrg }}
                                    </text>
                                </view>
                            </u-col>
                        </u-row>
 
                    </view>
                </u-swipe-action>
            </view>
 
            <button-modal :empTytowerShow='true' cleaningTitle="重置" garmenTitle='确认' @submit='submit' @reset='rest' />
        </view>
 
    </view>
</template>
 
<script>
import ButtonModal from '@/components/buttonModal.vue'
import ModalCode from '@/components/ModalCode.vue'
import { getWmsContainerPage, handlePostToPost } from '@/api/hander/hander.js'
import {
    getwmsPlace
} from '@/api/putIn/artificial.js'
export default {
    data() {
        return {
            renameFocus: true,
            detailshow: false,
            rescode: 0,
            autoFoucs: true,
            resmessage: "",
            current: 0, //滑块默认值
            singlist: [
                {
                    placeCode: "",
                    isVirtually: "",
                    containerCode: "",
                    isVirtuallyTrg: "",
                }
            ], //物料详情
            placeCodeTrg:"",
            materlist: {}, //物料详情数据
            warehouse: {
                snCode: ''
            },
            warehouseRules: {
                snCode: [{
                    required: true,
                    message: '物料跟踪码不能为空',
                    trigger: 'blur'
                }]
            },
            options: []
        };
    },
    components: {
        ButtonModal,
        ModalCode,
    },
    onLoad() {
    },
    onReady() {
        this.$refs.warehouseRef.setRules(this.warehouseRules)
    },
    mounted() {
        this.operator = JSON.parse(uni.getStorageSync('userInfo')).name
    },
    methods: {
        //物料查询
        materialBlur(pram) {
            if (this.warehouse.placeCode == "" && this.warehouse.containerCode == "") {
                this.resmessage = "请扫来源库位编号或者容器编号!";
                this.rescode = 400;
                this.showBtn = 0;
                this.$refs.resmodal.show = true;
                return
            }
 
            // 1 来源库位编号 
            if (pram == 1 ) {
                this.singlist[0].containerCode = ""
                this.warehouse.containerCode =""
                getwmsPlace({
                    PlaceCodeForpda: this.warehouse.placeCode,
                    page: 1,
                    pageSize: 1
                }).then((res) => {
                    if (res.code == 200) {
                        var arrList = res.result.items;
                        if (pram == 1) { //1 来源库位编号 
                            this.singlist[0].placeCode = "";
                            this.singlist[0].isVirtually = "";
                        }
                        if (arrList.length == 0) {
                            this.resmessage = "暂无数据";
                            this.rescode = 400;
                            this.showBtn = 0;
                            this.$refs.resmodal.show = true;
                        }
                        if (Array.isArray(arrList) && arrList.length >= 1) {
                            if (arrList[0].isDisabled) {
                                this.resmessage = "库位被禁用了";
                                this.rescode = 400;
                                this.showBtn = 0;
                                this.$refs.resmodal.show = true;
                                return
                            }
                            if (pram == 1) { //1 来源库位编号 
                                this.singlist[0].placeCode = arrList[0].placeCode;
                                this.singlist[0].isVirtually = arrList[0].isVirtually;
                            }
                        } else {
                            this.resmessage = "暂无数据";
                            this.rescode = 400;
                            this.showBtn = 0;
                            this.$refs.resmodal.show = true;
                        }
                    } else {
                        this.resmessage = res.message
                        this.rescode = res.code
                        this.$refs.resmodal.show = true
                    }
                })
 
            }
 
            // 容器编号
            if (pram == 2) {
                this.singlist[0].containerCode = ""
                this.singlist[0].placeCode = "";
                this.singlist[0].isVirtually = "";
                this.warehouse.placeCode ="";
                getWmsContainerPage({
                    page: 1,
                    pageSize: 1,
                    containerCode: this.warehouse.containerCode
                }).then((res) => {
                    if (res.code == 200) {
                        var arrList = res.result.items;
                        if (arrList.length == 0) {
                            this.resmessage = "暂无数据";
                            this.rescode = 400;
                            this.showBtn = 0;
                            this.$refs.resmodal.show = true;
                        }
                        if (Array.isArray(arrList) && arrList.length >= 1) {
                            if (arrList[0].isDisabled) {
                                this.resmessage = "容器被禁用了";
                                this.rescode = 400;
                                this.showBtn = 0;
                                this.$refs.resmodal.show = true;
                                return
                            }
                            this.singlist[0].containerCode = arrList[0].containerCode;
                        } else {
                            this.resmessage = "暂无数据";
                            this.rescode = 400;
                            this.showBtn = 0;
                            this.$refs.resmodal.show = true;
                        }
                    }
                });
            }
 
        },
 
        //删除详情
        longpredel(index, eindex) {
            if (eindex == 0) {
                uni.showModal({
                    title: "提示",
                    content: "是否确认删除?",
                    showCancel: true,
                    cancelColor: "#333333",
                    success: (res) => {
                        if (res.confirm) {
                            this.singlist.splice(index, 1)
                        } else if (res.cancel) {
                        }
                    },
                });
            } else {
                this.materlist = this.singlist[index]
                this.detailshow = true
            }
        },
        //卡片选中
        click(e) {
            e.cardNum = true
            this.$forceUpdate()
        },
        // 如果打开一个的时候,不需要关闭其他,则无需实现本方法
        open(index) {
            // 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制,
            // 原本为'false',再次设置为'false'会无效
            this.singlist[index].cardNum = true;
            this.singlist[index].show = true;
            this.singlist.map((val, idx) => {
                if (index != idx) this.singlist[idx].show = false;
            })
            this.$forceUpdate()
        },
        close(index) {
            this.singlist[index].show = false;
            this.singlist[index].cardNum = false;
            this.$forceUpdate()
        },
 
        //确认
        submit() {
        
            if(!this.placeCodeTrg){
                uni.showToast({
                    title: "请扫码库区/库位",
                    icon: "none",
                    duration: 2000,
                });
            }
            if(!this.warehouse.placeCode && !this.warehouse.containerCode){
                uni.showToast({
                    title: "请扫码来源库位编号/容器编号",
                    icon: "none",
                    duration: 2000,
                });
            }
            uni.showModal({
                title: '提示',
                content: '是否确认点到点?',
                showCancel: true,
                cancelColor: '#333333',
                success: (res => {
                    if (res.confirm) {
                        var param = {
                            "SourcePlaceCode":this.warehouse.placeCode,
                            "ContainerCode":this.warehouse.containerCode,
                            "ToPlaceCode":this.placeCodeTrg,
                        };
                        handlePostToPost(param).then((res) => {
                            this.rescode = res.code
                            this.resmessage = res.message
                            this.$refs.resmodal.show = true
                            if (res.code == 200) {
                                this.resmessage = "点到点成功"
                                this.renameFocus = true
                                this.rest()
                            }
                        })
 
                    } else if (res.cancel) {
 
                    }
                })
            });
 
        },
        //清楚选中
        rest() {
            this.warehouse.placeCode = '';
            this.warehouse.containerCode = '';
            this.placeCodeTrg = '';
            this.autoFoucs = true
            this.singlist = [
                {
                    placeCode: "",
                    isVirtually: "",
                    containerCode: "",
                    isVirtuallyTrg: "",
                }
            ];
        }
    }
}
</script>
 
<style lang="scss">
.title-wrap {
    background-color: white;
    margin-top: 10px;
}
</style>