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
<template>
    <view class="overflow">
        <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>
        <!-- <view class="text-bold width fontSize32rpx" style="padding: 10rpx 10rpx;background-color: #d6d6d6;"
            v-if="renameFocus">
            <view class="flex justify-between align-center">
                <text class="width23 padding10">入库单号</text>
                <text>{{putCode}}</text>
            </view>
        </view> -->
        <u-form labelPosition="top" :model="warehouse" ref="warehouseRef">
            <u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
                <u-col span="10">
                    <u-form-item label="容器编号:" prop="ContainerCode" required 
                        style="font-size: 16px;font-weight: bold;padding: 0 0 10rpx;">
                        <input v-model="warehouse.ContainerCode" placeholder="请录入或扫码" @focus="focu=true"
                           style="font-weight: bolder;margin-left: 15rpx;"
                            class="width padding_left30rpx">
                        </input>
                        <u-icon name="close-circle-fill" color="#848484" v-if="warehouse.containerCode && focu"
                            @click="warehouse.containerCode=''"></u-icon>
                    </u-form-item>
                </u-col>
                <u-col span="2">
                    <u-icon class="iconfont icon-saoma fontSize60rpx" @click="containerScane"></u-icon>
                </u-col>
            </u-row>
            
            <u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
                <u-col span="12">
                    <u-form-item label="栅格数:" prop="GridNumber" required 
                      style="font-size: 16px;font-weight: bold;padding: 0 0 10rpx;">
                        <input v-model="warehouse.GridNumber" type="number" placeholder="请录入栅格数" required  
                        style="font-weight: bolder;margin-left: 15rpx;" 
                        class="width padding_left30rpx">
                        </input>
                    </u-form-item>
                </u-col>
            </u-row>
            
            <u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
                <u-col span="10">
                    <u-form-item label="入库口:" prop="StorehouseCode" required 
                      style="font-size: 16px;font-weight: bold;padding: 0 0 10rpx;">
                        <input v-model="warehouse.StorehouseCode" placeholder="请录入或扫码" required  
                        style="font-weight: bolder;margin-left: 15rpx;" 
                        class="width padding_left30rpx">
                        </input>
                    </u-form-item>
                </u-col>
                <u-col span="2">
                    <u-icon class="iconfont icon-saoma fontSize60rpx" @click="wareScane"></u-icon>
                </u-col>
            </u-row>
        </u-form>
        <modal-code ref="resmodal" :rescode='rescode' :resmessage='resmessage' />
        <button-modal :subShow='true' garmenTitle='确认入库' @submit='submit' />
    </view>
</template>
 
<script>
    import {getDate} from '../../../utils/dateTime.js'
    import ModalCode from '../../../components/ModalCode.vue'
    import ButtonModal from '../../../components/buttonModal.vue'
    import {trayPutStorage} from '@/api/container/index.js'
    export default {
        data() {
            return {
                rescode: 0,
                resmessage: "",
                focu: false,
                warehouse: { //入库请求参数
                    ContainerCode: '',
                    StorehouseCode: '',
                    GridNumber: '1'
                },
                warehouseRules: {
                    ContainerCode: [{required: true,message: '容器编号不能为空',trigger: 'blur'}],
                    StorehouseCode: [{required: true,message: '入库口不能为空',trigger: 'blur'}],
                    GridNumber: [{required: true,message: '栅格数不能为空',trigger: 'blur'}],
                },
                operator: '', //
                
            };
        },
        components: {
            ModalCode,
            ButtonModal
        },
        onReady() {
            this.$refs.warehouseRef.setRules(this.warehouseRules)
        },
        mounted() {
            this.operator = JSON.parse(uni.getStorageSync('userInfo')).name
        },
        methods: {
            //出入库口扫描
            wareScane() {
                uni.scanCode({
                    scanType: ['barCode','qrCode'],
                    autoDecodeCharset: true,
                    success:(res) => {
                        this.warehouseRules.StorehouseCode = res.result.trim()
                    },
                    fail:(err) => {
                        this.rescode = 400
                        this.resmessage = `扫描失败${JSON.stringify(err)}`
                        this.$refs.resmodal.show = true
                    }
                })
            },
            //容器扫描
            containerScane() {
                uni.scanCode({
                    scanType: ['barCode','qrCode'],
                    autoDecodeCharset: true,
                    success:(res) => {
                        this.warehouse.ContainerCode = res.result
                    },
                    fail:(err) => {
                        this.rescode = 400
                        this.resmessage = `扫描失败${JSON.stringify(err)}`
                        this.$refs.resmodal.show = true
                    }
                })
            },
            submit() {
                this.$refs.warehouseRef.validate(valid => {
                    if (valid) {
                        trayPutStorage(this.warehouse).then((res) => {
                            this.$refs.resmodal.show = true
                            this.rescode = res.code
                            this.resmessage = res.message
                            this.$refs.warehouseRef.resetFields()
                        })
                    }
                })
            }
        }
 
    }
</script>
 
<style lang="scss">
 
</style>