wangxinhui
18 小时以前 67348f250a1b7970059698002949a5e0a5f3c52f
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
<template>
    <view>
        <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem">
        </uni-segmented-control>
        <view class="content">
            <view v-if="current === 0" class="headerstyle">
                <view class="itemstyle">
                    <uni-forms label-width="180">
                        <uni-forms-item label="条码:">
                            <uni-easyinput type="text" placeholder="请扫描托盘条码" ref='midInput' :focus="!focus"
                                v-model="barcode" @confirm="barcodeInput" />
                        </uni-forms-item>
                        <uni-forms-item label="物料:">
                            <uni-easyinput type="text" placeholder="请输入物料" ref='midInput' v-model="materSn" />
                        </uni-forms-item>
                        <uni-forms-item label="直径:">
                            <uni-easyinput type="text" placeholder="请输入直径(mm)" ref='midInput' v-model="thickness" />
                        </uni-forms-item>
                        <uni-forms-item label="幅宽:">
                            <uni-easyinput type="text" placeholder="请输入幅宽(mm)" ref='midInput' v-model="wide" />
                        </uni-forms-item>
                        <uni-forms-item label="重量:">
                            <uni-easyinput type="text" trim="all" placeholder="请输入重量(kg)" ref='midInput'
                                v-model="weight" />
                        </uni-forms-item>
                        <uni-forms-item>
                            <button @click="submit" type="primary" size="default" style="margin-top: 2%;">组盘</button>
                        </uni-forms-item>
                    </uni-forms>
                </view>
            </view>
            <view v-if="current === 1" class="headerstyle" >
                <view class="itemstyle">
                    <uni-forms label-width="120">
                        <uni-forms-item label="托盘条码">
                            <uni-easyinput type="text" :focus="!addressFocus" v-model="inboundBarcode"
                                placeholder="请扫描托盘条码" ref='midInput' @input="inputChangebarcode" />
                        </uni-forms-item>
                        <uni-forms-item label="地址条码">
                            <uni-easyinput type="text" v-model="address" :disabled="addressdisabled"
                                placeholder="请扫描地址条码" ref='midInput' :focus="addressFocus" />
                        </uni-forms-item>
                        <uni-forms-item>
                            <button @click="inbound" type="primary" size="default" style="margin-top: 2%;">入库确认</button>
                        </uni-forms-item>
                    </uni-forms>
                </view>
            </view>
        </view>
        <u-toast ref="uToast" />
    </view>
</template>
 
<script>
    const innerAudioContext = uni.createInnerAudioContext();
    export default {
        data() {
            return {
                items: ['组盘', '入库'], //, '单据信息', '解盘'
                materSn:"",
                wide:"",
                weight:"",
                thickness:"",
                barcode: "",
                focus:false,
                inboundBarcode: "",
                address: "",
                addressdisabled: true,
                addressFocus: false,
                current: 0,
                orderNo: "",
                warehouseId: "",
                Test: false,
            }
        },
        onShow() {},
        onLoad(res) {
            this.focus = false;
            this.addressFocus = false;
            this.warehouseId = res.warehouseId;
            if (this.warehouseId == 1) { 
                this.items=['组盘'];
            }
        },
        methods: {
            barcodeInput() {
                this.$nextTick(function(x) {
                    if (this.barcode.length > 0) {
                        this.focus = true;
                    }
                })
            },
            inbound() {
                if (this.inboundBarcode == "") {
                    this.$refs.uToast.show({
                        title: "请扫描托盘条码",
                        type: "error"
                    })
                    return;
                }
                if (this.address == "") {
                    this.$refs.uToast.show({
                        title: "请扫描地址条码",
                        type: "error"
                    })
                    return;
                }
                var postData = {
                    MainData: {
                        "barcode": this.inboundBarcode,
                        "startPoint": this.address,
                        "warehouseId": this.warehouseId
                    }
                }
                this.$u.post('/api/Task/RequestInboundTask', postData).then(res => {
                    if (res.status) {
                        this.inboundBarcode = "";
                        if (this.warehouseId != 5 && this.warehouseId != 3) this.address = "";
                        this.stockInfoDetail = [];
                        //获取总数量
                        this.Summmary = 0;
                        setTimeout(() => {
                            this.addressFocus = false;
                            this.$refs.uToast.show({
                                title: "成功",
                                type: "success"
                            })
                        }, 200);
                    } else {
                        this.$refs.uToast.show({
                            title: res.message,
                            type: "error"
                        })
                    }
                }).catch(err => {
                    this.$refs.uToast.show({
                        title: err.message,
                        type: "error"
                    })
                })
            },
            submit() {
                if (this.barcode == "") {
                    this.$refs.uToast.show({
                        title: "请扫描条码",
                        type: 'error'
                    })
                    return;
                }
                this.$u.post('/api/StockInfo/ManualMaterielGroup' ,{
                    MainData: {
                        "palletCode": this.barcode,
                        "thickness": this.thickness,
                        "weight": this.weight,
                        "wide": this.wide,
                        "materSn": this.materSn,
                        // "isFull": this.check
                        "warehouseId": this.warehouseId
                    },
                }).then(res => {
                    this.Testcheck = false;
                    if (res.status) {
                        this.$refs.uToast.show({
                            title: "组盘成功",
                            type: "success"
                        })
                        this.focus = false;
                        this.barcode = "";
                        this.matInfos = [];
                        this.sns = [];
                        this.matTotal = [];
                    } else {
                        this.$refs.uToast.show({
                            title: res.message,
                            type: "error"
                        })
                    }
                })
            }
        }
    }
</script>
 
<style lang="scss">
    @import '@/common/uni-ui.scss';
 
    .content {
        display: flex;
        height: 150px;
    }
 
    .content-text {
        font-size: 14px;
        color: #666;
    }
 
    .itemstyle {
        margin-top: 30px;
        margin-left: 5%;
    }
 
    .headerstyle {
        width: 90%;
    }
</style>