1
Huangxiaoqiang-03
2024-11-11 d100db102ded4dc2047f1b92f4ed0ed4c18d8ee4
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
<template>
    <view>
        <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem">
        </uni-segmented-control>
        <view v-show="current === 0">
            <uni-list-item direction="column" v-for="item in orderDetail" :key="item.palletCode">
                <template v-slot:body>
                    <view class="uni-list-box">
                        <checkbox @click="click(item)" style="margin-right: 20px;"></checkbox>
                        <view class="uni-content">
                            <view style="font-size: 18px;">物料编码:{{item.materielCode}}</view>
                            <view style="font-size: 18px;">物料名称:{{item.materielName}}</view>
                            <view style="font-size: 18px;">托盘编码:{{item.palletCode}}</view>
                            <view style="font-size: 18px;">货位编码:{{item.locationCode}}</view>
                            <view style="font-size: 18px;">可用数量:{{item.useableQuantity}}</view>
                        </view>
                    </view>
                </template>
            </uni-list-item>
            <button @click="OutBound" type="primary" size="default" style="margin-top: 2%;">出库</button>
            <u-toast ref="uToasts" />
        </view>
        <view v-show="current === 1">
            <uni-list-item direction="column" v-for="item in orderDetail" :key="item.palletCode">
                <template v-slot:body>
                    <view class="uni-list-box">
                        <checkbox @click="clicks(item)" style="margin-right: 20px;"></checkbox>
                        <view class="uni-content">
                            <view style="font-size: 18px;">物料编码:{{item.materielCode}}</view>
                            <view style="font-size: 18px;">物料名称:{{item.materielName}}</view>
                            <view style="font-size: 18px;">托盘编码:{{item.palletCode}}</view>
                            <view style="font-size: 18px;">货位编码:{{item.locationCode}}</view>
                            <view style="font-size: 18px;">可用数量:{{item.useableQuantity}}</view>
                        </view>
                    </view>
                </template>
            </uni-list-item>
            <button @click="LockOutboundStock" type="primary" size="default" style="margin-top: 2%;">锁定</button>
            <u-toast ref="uToast" />
        </view>
        
    </view>
    </view>
</template>
 
<script>
    const innerAudioContext = uni.createInnerAudioContext();
    export default {
        data() {
            return {
                items: ['指定出库', "锁定库存"],
                current: 0,
                materielCode: "",
                label: "",
                orderDetail: [],
                focus: false,
                key: [],
                keys: [],
                id:"",
            }
        },
        onShow() {},
        onLoad(res) {
            this.focus = false;
            this.addressFocus = false;
            this.materielCode = res.materielCode;
            this.id = res.id;
            this.getData();
        },
        methods: {
            voiceSpeech(src) {
                innerAudioContext.src = src; 
                innerAudioContext.play();
            },
            getData() {
                var postData = this.materielCode;
                this.$u.post('/api/StockInfo/GetStockSelectViews', postData).then((res) => {
                    this.orderDetail = res;
                    
                })
            },
            OutBound() {
                var postData = this.key;
                this.$u.post('/api/Task/GenerateOutboundTask?id='+this.id, postData).then(res => {
                    if (res.status) {
                        this.items = [];
                        this.$refs.uToasts.show({
                            title: res.message,
                            type: "error"
                        })
                    } else {
                        this.$refs.uToasts.show({
                            title: res.message,
                            type: "error"
                        })
                    }
                }).catch(err => {
                    this.$refs.uToast.show({
                        title: err.message,
                        type: "error"
                    })
                })
            },
            LockOutboundStock() {
                var postData = this.keys;
                this.$u.post('/api/OutboundOrderDetail/LockOutboundStock?id='+this.id, postData).then(res => {
                    if (res.status) {
                        this.items = [];
                        uni.$showMsg(res.message);
                        setTimeout(() => {
                            this.addressFocus = false;
                        }, 200);
                    } else {
                        this.$refs.uToast.show({
                            title: res.message,
                            type: "error"
                        })
                    }
                }).catch(err => {
                    this.$refs.uToast.show({
                        title: err.message,
                        type: "error"
                    })
                })
            },
            click(e) {
                if (this.key.find(x => x.palletCode == e.palletCode)) {
                    this.key.map((item, index) => {
                        if (item.palletCode == e.palletCode) {
                            this.key.splice(index, 1);
                        }
                    })
                } else {
                    this.key.push(e);
                }
            },
            clicks(e) {
                if (this.keys.find(x => x.palletCode == e.palletCode)) {
                    this.keys.map((item, index) => {
                        if (item.palletCode == e.palletCode) {
                            this.keys.splice(index, 1);
                        }
                    })
                } else {
                    this.keys.push(e);
                }
            },
            onClickItem(e) {
                this.focus = false;
                this.addressFocus = false;
                if (this.current !== e.currentIndex) {
                    this.current = e.currentIndex;
                    if (this.current == 2) {
                        this.getData();
                    }
                }
            },
        }
    }
</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>