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
<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>
        <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="warehouse.ContainerCode = ''" @blur="getConDetail"
                           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-form>
        <view style="margin-bottom: 180rpx;margin-top: 10rpx;">
            <view v-for="(item, eindex) in singlist" :key="eindex" style="width: 100vw;">
                <u-swipe-action :show="item.show" :index="eindex" @click="longpress" :options="[]" style="width: 100vw;">
                    <view class="item u-border-bottom">
                        <!-- 此层wrap在此为必写的,否则可能会出现标题定位错误 -->
                        <view class="title-wrap fontSize32rpx background_fff">
                            <view class="fontSize32rpx" style="background-color: #fff;">
                                <u-row class="padding15">
                                    <u-col span="12" class="flex color_f18202">
                                        <view class="idindex">
                                            {{eindex+1}}
                                        </view>
                                        <text class="padding_left10rpx">{{item.wareMaterialCode}}</text>
                                    </u-col>
                                </u-row>
                                <u-row class="padding15">
                                    <u-col span="6" class="" style="text-align: right;">
                                        批次:{{item.barNo}}
                                    </u-col>
                                    <u-col span="6" class="color_f18202" style="text-align: right;">
                                        数量:{{item.quantity - item.occQuantity}}
                                    </u-col>
                                </u-row>
                            </view>
                        </view>
                    </view>
                </u-swipe-action>
            </view>
        </view>
        <modal-code ref="resmodal" :rescode='rescode' :resmessage='resmessage' />
        <button-modal :subShow='true' garmenTitle='重置' @submit='submit' />
    </view>
</template>
 
<script>
    import ModalCode from '../../components/ModalCode.vue'
    import ButtonModal from '../../components/buttonModal.vue'
    import {containerReturn,getContainerDetail} from '@/api/sort.js'
    export default {
        data() {
            return {
                rescode: 0,
                resmessage: "",
                focu: false,
                singlist: [], //容器内物料详情
                warehouse: { //入库请求参数
                    ContainerCode: '',
                    StorehouseCode: '',
                    TaskType: 0
                },
                warehouseRules: {
                    ContainerCode: [{required: true,message: '容器编号不能为空',trigger: 'blur'}],
                    StorehouseCode: [{required: true,message: '入库口不能为空',trigger: 'blur'}],
                },
                operator: '', //当前登录人
                
            };
        },
        components: {
            ModalCode,
            ButtonModal
        },
        onLoad: function (option) { //option为object类型,会序列化上个页面传递的参数
            if(option.containerCode) {
                this.warehouse.ContainerCode = option.containerCode
            }
            if(option.taskType) {
                this.warehouse.TaskType = parseInt(option.taskType)
            }
        },
        onReady() {
            this.$refs.warehouseRef.setRules(this.warehouseRules)
            console.log(this.warehouse)
        },
        mounted() {
            this.operator = JSON.parse(uni.getStorageSync('userInfo')).name
        },
        methods: {
            //获取容器下物料详情
            getConDetail(){
                if(this.warehouse.ContainerCode.trim().length > 0) {
                    getContainerDetail({ContainerCode: this.warehouse.ContainerCode}).then(res => {
                        console.log(res)
                        if(Array.isArray(res.data) && res.data.length > 0) {
                            this.singlist = res.data;
                        }else {
                            this.rescode = 400
                            this.resmessage = '暂无数据'
                            this.$refs.resmodal.show = true
                            this.singlist=[]
                        }
                    })
                }
            },
            //出入库口扫描
            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
                        this.getConDetail()
                    },
                    fail:(err) => {
                        this.rescode = 400
                        this.resmessage = `扫描失败${JSON.stringify(err)}`
                        this.$refs.resmodal.show = true
                    }
                })
            },
            //容器回库
            submit() {
                this.singlist = [];
                this.warehouse.ContainerCode = ''
            }
        }
 
    }
</script>
 
<style lang="scss">
 
</style>