小小儁爺
2025-11-18 aab92bb255f1cbd758cb9d96a89bfc73133bfb4a
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
<template>
    <view>
        <page-nav title="入厂检验"></page-nav>
 
        <view class="mainContent">
            <view>
                <u-gap height="10" bgColor="#eff0f1"></u-gap>
                <view class="head">
                    <view class="head_block">
                        <view class="head_left">
                            <view class="head_bar"></view>
                            <view class="head_title" style="font-weight: bolder;">
                                物料信息
                            </view>
                        </view>
                    </view>
 
                    <view class="marginLeft20 marginRight20">
                        <view class="marginBottom20" style="display: flex;">
                            <view class="flex_column titleFont">
                                <view>单据编号:</view>
                                <view>物料标签:</view>
                                <view>物料编码:</view>
                                <view>物料名称:</view>
                                <view>物料规格:</view>
                                <view>供方信息:</view>
                                <view>采购批次:</view>
                                <view>质量状态:</view>
                                <view>物料数量:</view>
                            </view>
                            <view class="flex_column contentFont">
                                <view>{{purchorderArr.hbillno}}</view>
                                <view>{{purchorderArr.labcode}}</view>
                                <view>{{purchorderArr.partcode}}</view>
                                <view>{{purchorderArr.partname}}</view>
                                <view>{{purchorderArr.partspec}}</view>
                                <view class="ellipsis" style="width: 460rpx;">{{purchorderArr.customername}}</view>
                                <view>{{purchorderArr.hbatchno}}</view>
                                <view style="display: flex;align-items: center;">
                                    <u-icon :name="isPlain?'checkmark-circle-fill':'close-circle-fill'"
                                        :color="isPlain?'#55ff00':'#FF0000'" size="20"></u-icon>
                                    <view style="margin-left: 10rpx;">
                                        {{isPlain?'合格':'不合格'}}
                                    </view>
 
 
                                </view>
                                <view>{{purchorderArr.hqty}}</view>
                            </view>
                        </view>
                    </view>
 
 
                </view>
 
                <u-gap height="20" bgColor="#eff0f1"></u-gap>
                <view class="head">
                    <view class="head_block">
                        <view class="head_left">
                            <view class="head_bar"></view>
                            <view class="head_title" style="font-weight: bolder;">
                                检验结果
                            </view>
                        </view>
                    </view>
 
                    <view class="marginLeft20 marginRight20 marginBottom20">
                        <view class="" style="display: flex;">
                            <view class="flex_column titleFont">
                                <view>样本数量:</view>
                                <view>合格数量:</view>
                                <view>不合格数量:</view>
                            </view>
                            <view class="flex_column contentFont">
                                <view>{{purchorderArr.sampleqty}} 个</view>
                                <view>{{purchorderArr.goodqty}} 个</view>
                                <view>{{purchorderArr.sampleqty-purchorderArr.goodqty}} 个</view>
                            </view>
                        </view>
 
 
                        <view style="display: flex;margin-top: 30rpx;">
                            <u-button type="primary" @click="isPlain=true" style="width: 200rpx;margin-left: 0%; "
                                :plain="!isPlain" text="合格"></u-button>
                            <u-button type="warning" @click="isPlain=false" style="width: 200rpx;margin-left: 10%; "
                                :plain="isPlain" text="不合格"></u-button>
                        </view>
 
                    </view>
 
 
                </view>
 
 
                <u-gap height="20" bgColor="#eff0f1"></u-gap>
 
                <view class="head">
                    <view class="head_block marginBottom10">
                        <view class="head_left">
                            <view class="head_bar"></view>
                            <view class="head_title" style="font-weight: bolder;">
                                同步至相同批次
                            </view>
                        </view>
                        <view class="marginRight20">
                            <u-switch v-model="switchValue" size="23"></u-switch>
                        </view>
                    </view>
                </view>
            </view>
        </view>
 
        <u-button type="primary" size='large' :hairline="true" :loading="isDisabledSubmitButton" @click="submit"
            loadingText="正在提交,请稍等..." text="确认提交"></u-button>
 
    </view>
</template>
 
 
<script>
    // import {
 
 
    // } from '../../config/api.js';
    const App = getApp()
    export default {
        onLoad(option) {
 
            let t1 = JSON.parse(JSON.parse(option.passPurchorderObj))
 
            let t2 = JSON.parse(option.purchorderDetailArr)
 
            let t3 = JSON.parse(option.purchorderObj)
 
            let t4 = JSON.parse(option.passToNext)
 
            console.log(t1, 1)
            console.log(t2, 2)
            console.log(t3, 3)
            console.log(t4, 4)
 
            this.purchorderArr.hbillno = t1.hbillno
            this.purchorderArr.partcode = t1.partcode
            this.purchorderArr.partname = t1.partname
            this.purchorderArr.partspec = t1.partspec ? t1.partspec : '/'
 
 
 
            this.purchorderArr.customercode = t4.hcustomercode
            this.purchorderArr.customername = t4.hcustomername
            this.purchorderArr.hqty = t4.hqty
            this.purchorderArr.sampmethod = t4.sampmethod
            this.purchorderArr.labcode = t4.hbarcode
            this.purchorderArr.hbatchno = t4.hbatchno ? t4.hbatchno : '/'
 
 
 
            this.purchorderArr.sampleqty = option.sampleqty
            this.purchorderArr.goodqty = option.goodqty
 
 
            this.passPurchorderDetailArr = t2
 
            this.passPurchorderBZObj = t3
 
 
 
        },
 
        onPullDownRefresh() {
            setTimeout(() => {
                this.init(() => {
                    uni.stopPullDownRefresh();
                })
            }, 1000);
        },
 
        data() {
            return {
                isDisabledSubmitButton: false,
 
                purchorderArr: {
                    hbillno: 'CG20221018000001', //单据编号
                    labcode: 'ZG20221018000001', //物料标签
                    partcode: 'ZG-Y-001', //物料编码
                    partname: 'ZG原材料001', //物料名称
                    partspec: 'ZG#30*50', //物料规格
                    customername: 'ZG外协供应商', //供方信息
                    customercode: '0101101', //供方编码
                    hbatchno: '/', //采购批次
                    qualitystatus: '/', //质量状态
                    hqty: 0, //物料数量
 
 
                    sampleqty: 0, //抽样数量
                    goodqty: 0, //合格数量
                    ngqty: 0, //不合格数量
                },
 
                passPurchorderDetailArr: [], //页面二传过来的值   每个子项的值
 
                passPurchorderBZObj: [], //页面二传过来的值   每个子项的值
 
 
                isPlain: true,
                switchValue: true,
            }
        },
        created() {
 
        },
        mounted() {
            this.init()
 
 
            this.isPlain = this.purchorderArr.sampleqty === this.purchorderArr.goodqty
 
        },
        methods: {
            init() {
                uni.stopPullDownRefresh();
            },
            submit() {
                const header = {
                    // 'Content-Type': 'multipart/form-data',
                    'Content-Type': 'application/x-www-form-urlencoded',
                    'rediskey': uni.getStorageSync('rediskey'),
                    'admin': uni.getStorageSync('usercode'),
                    'username': encodeURIComponent(uni.getStorageSync('username')),
                    'navTabId': uni.getStorageSync('usercode'),
                    'userid': uni.getStorageSync('userid'),
                    'guid': uni.getStorageSync('guid'),
                    'usertype': 'APP'
                }
 
                let checkitemcont = []
 
 
                this.passPurchorderDetailArr.forEach((i, index) => {
                    checkitemcont.push({
                        checknum: i.checkNumber + '/' + this.passPurchorderDetailArr.length / this
                            .passPurchorderDetailArr.filter(j => j.checkNumber === 1).length,
                        checkiem_seq: i.stepcheckitem_seq,
                        checkitem_code: i.code,
                        checkitem_name: i.name,
                        check_value: i.real_value ? i.real_value : '',
                        check_result: i.isPlain ? 'OK' : 'NG',
                        checkitem_descr: i.stepcheckitem_remark
                    })
                })
 
 
                let formData = {
                    hbillno: this.purchorderArr.hbillno,
                    labcode: this.purchorderArr.labcode,
                    checkstandcode: this.passPurchorderBZObj.checkstandcode,
                    check_type: 'InCheck',
                    sampmethod: this.passPurchorderBZObj.sampmethod,
                    partcode: this.purchorderArr.partcode,
                    customercode: this.purchorderArr.customercode,
                    batchno: this.purchorderArr.hbatchno === '/' ? '' : this.purchorderArr.hbatchno, //批次
                    qualitystatus: this.isPlain ? 'OK' : 'NG',
                    labqty: parseFloat(this.purchorderArr.hqty),
 
                    sampleqty: parseFloat(this.purchorderArr.sampleqty),
                    goodqty: parseFloat(this.purchorderArr.goodqty),
                    ngqty: parseFloat(this.purchorderArr.sampleqty) - parseFloat(this.purchorderArr.goodqty),
                    issyncbatch: this.switchValue ? 'Y' : 'N', //是否同批次
 
                    admin: uni.getStorageSync('usercode'),
                    checkitemcont: JSON.stringify(checkitemcont)
                }
 
                console.log(formData, 888)
 
                this.isDisabledSubmitButton = true
                uni.uploadFile({
                    url: this.$baseUrl + '/AppQualityManagement/InFactoryCheckSave',
                    files: [{
                        "uri": "/"
                    }],
                    header: header,
                    formData: formData,
                    success: (res) => {
                        console.log(res, 999)
                        let result = JSON.parse(res.data)
                        if (res.statusCode == 200 && result.code == '200') {
                            uni.$u.toast('提交成功!')
 
                            // uni.navigateTo({
                            //     url: './rcjy?partcode=' + this.purchorderArr.partcode + '&hbatchno=' +
                            //         this.purchorderArr.hbatchno + '&issyncbatch=' + this.switchValue +
                            //         '&labcode=' + this.purchorderArr.labcode + '&hbillno=' + this
                            //         .purchorderArr.hbillno
                            // })
 
 
                            let prevPage = getCurrentPages()[getCurrentPages().length - 3]; // 上上一页面实例
                            const data = {
                                issyncbatch: this.switchValue ? 'Y' : 'N',
                                partcode: this.purchorderArr.partcode,
                                hbatchno: this.purchorderArr.hbatchno,
                                labcode: this.purchorderArr.labcode,
                                hbillno: this.purchorderArr.hbillno
                            }
                            prevPage.$vm.fromSubmitData(data) // 调用上上一页 定义的方法
                            uni.navigateBack({
                                delta: 2, //返回层数,2则上上页    使用这种方法以免感觉页面跳动的感觉
                            })
 
                        } else {
                            uni.$u.toast(result.Message)
                        }
                        this.isDisabledSubmitButton = false
                    },
                    fail(res) {
                        console.log(res, 1000)
                        uni.$u.toast('提交失败!')
                        this.isDisabledSubmitButton = false
                    },
                })
 
 
 
 
 
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    @import url('@/style/global.css');
 
    ::v-deep .uicon-arrow-left>span {
        display: block;
    }
</style>