schangxiang@126.com
2025-05-20 55f646920b4e394f4aa18cb98f2260c82d0ecff9
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
<template>
    <default-header-page-layout ref="page" title="空托绑定">
        <view class="page-frame with-action-user-row" :style="{height:pageBodyHeight+'px'}" v-if="pageBodyHeight">
            <action-user-row />
            <view class="with-action-user-row-page-content">
                <!-- 托盘 -->
                <scan-input-form-item :clearable="true" :hasScan="false" :hasSearch="false" class="forma-item" label="托盘编号" v-model="form.containerNo"/>
                <!-- 库位 -->
                <selectItem  
                    :selectData="placeList" :value.sync="form.placeNo" label="库位编号" labelField="placeNo"
                    valueField="placeNo" @update:value="getPlaceNo"/>
 
<div v-if="materialInfoShow">
                    <scan-input-form-item class="forma-item" label="库存信息" :content="false" />
                    <materialInfo :materialData="materialData" />
                    
                </div>
                        
            </view>
 
 
        </view>
        <template v-slot:footer>
            <view class="bottom-btns-row">
                <view class="btn-frame">
                    <u-button v-if="btnAbled" type="primary" text="绑 定" @click="onConfirm">
                    </u-button>
                </view>
            </view>
        </template>
    </default-header-page-layout>
</template>
 
<script>
    import DefaultHeaderPageLayout from '@/components/DefaultHeaderPageLayout.vue'
    import ActionUserRow from '@/components/ActionUserRow.vue'
    import ScanInputFormItem from '@/components/ScanInputFormItem.vue'
    import EasySelectFormItem from '@/components/EasySelectFormItem.vue'
    import EasyPicker from '@/components/EasyPicker.vue'
    import selectItem from '@/components/selectItem.vue'
    import materialInfo from './modules/materialInfo.vue'
    import {emptyContainerBindKTHCPlace} from '@/api/emptyIn.js'
    import {
        getMaterialDetail
    } from '@/api/common.js'
    import {
        palceList
    } from '@/service/mixins/mixins.js'
    import {
        parseDic,
        $alert,
        $successInfo,
        getDicList
    } from '@/static/js/utils/index.js'
let initInterVal=null;
    export default {
        name: 'emptyInPage',
        components: {
            DefaultHeaderPageLayout,
            ActionUserRow,
            ScanInputFormItem,
            EasySelectFormItem,
            EasyPicker,
            selectItem,
            materialInfo
        },
        data() {
            return {
                pageBodyHeight: 0,
                form: {
                    containerNo: '',
                    placeNo: ''
                },
                materialData: []    
            }
        },
        computed: {
            btnAbled() {
                return Boolean(this.form.placeNo)&&Boolean(this.form.containerNo);
            },
            materialInfoShow(){
                return Boolean(this.form.placeNo) ;
            }
        },
        mixins: [palceList],
        methods: {
            getPlaceNo(val,obj){
                console.log(val,obj,'111');
                this.getMaterialDetail(obj.id);
            },
            //获取物料信息
            async getMaterialDetail(id){
                try{
                    let {result}=await getMaterialDetail({id})
                    this.materialData=result.wmsMaterialStocks;
                    console.log(result,'data');
                }catch(e){
                    //TODO handle the exception
                    console.log(e);
                }
            },
            // 清除托盘信息
            onClearContainter() {
                this.form.containerCode = ''
            },
            // 清除单据号
            onClearNO() {
 
            },
            
            // 入库
            async onConfirm() {
                uni.showModal({
                    title: '入库确认',
                    content: '确定执行入库操作吗?',
                    showCancel: true,
                    cancelText: '取消',
                    confirmText: '确定',
                    success: async (type) => {
                        let {
                            confirm,
                            cancel
                        } = type
                        if (confirm) {
                            console.log(this.form);
                            try{
                                await emptyContainerBindKTHCPlace(this.form)
                                $alert("空托绑定成功");
                                this.form={}
                                this.materialData=[]
                            }catch(e){
                                //TODO handle the exception
                                console.log(e);
                            }
                        }
                    }
                })
 
                // this.onClearContainter()
                // this.onClearNO()
            },
            // 获取枚举信息
            async getSysEnumData() {
                try {
                    let {
                        data
                    } = await getSysEnumData({
                        enumName: 'ContainerStatus'
                    })
                    this.ContainerStatus = data
                } catch (e) {
                    //TODO handle the exception
                    console.log(e);
                }
            },
            checkChange(item) {
                item.checked = !item.checked
            },
            /* 页面初始化获取页面body高度的定时器 */
            startInitInterval(callback) {
                initInterVal = setInterval(() => {
                    if (this.pageBodyHeight) {
                        this.clearInitInterval()
                        callback && callback()
                    } else {
                        this.pageBodyHeight = this.$refs.page.getBodyHeight()
                    }
                }, 200)
            },
            /* 清除定时器 */
            clearInitInterval() {
                try {
                    clearInterval(initInterVal)
                    initInterVal = null
                } catch (e) {
                    //TODO handle the exception
                }
            }
        },
        onReady() {
            this.startInitInterval(() => {
                /* 页面初始化后需要执行的代码在这边调用 */
                // this.getLinesOptions()
                // this.selectOptions.models = getDicList(this.$store,'assemble_taskmodel')
                this.getPalceList({
                    areaCode: 'KTHC',
                    aisle:3
                })
                console.log(this.placeList);
            })
        },
        onUnload() {
            this.clearInitInterval()
        }
    }
</script>
 
<style scoped lang="scss">
    .forma-item {
        margin-bottom: 24rpx;
    }
 
    .only-watch-container {
        background-color: #D0DDD8;
        min-height: 90rpx;
        display: flex;
 
        &>.label {
            color: $u-tips-color;
            font-size: 32rpx;
            flex-shrink: 0;
            padding-left: 20rpx;
            padding-top: 22rpx;
        }
 
        &>.content {
            width: 1px;
            flex-grow: 1;
            display: flex;
            align-items: center;
            font-size: 30rpx;
            padding: 8rpx 0;
        }
    }
 
    .bottom-btns-row {
        display: flex;
        padding: 10rpx 20rpx;
        background-color: #fff;
 
        .btn-frame {
            width: 1%;
            box-sizing: border-box;
            flex-grow: 1;
        }
    }
</style>