小小儁爺
2025-11-19 0552bde02a9f07f52bcff9a044b9de3e64f868be
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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
<template>
    <view>
        <page-nav title="完工检验"></page-nav>
 
        <view v-if="processArr.length===0">
            <div class="sacnBody">
                <div class="scanImg" @click="topScanClick"></div>
                <div class="scanText">扫描工序任务码</div>
            </div>
        </view>
 
 
        <view v-if="processArr.length!==0" class="mainContent" style="height: 1340rpx;overflow: auto">
            <view>
                <u-gap height="10" bgColor="#eff0f1"></u-gap>
                <view class="head" style="height: 386rpx;overflow: auto;">
                    <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 class="flex_column contentFont">
                                <view>{{processObj.wo_code}}</view>
                                <view>{{processObj.partcode}}</view>
                                <view>{{processObj.partname}}</view>
                                <view>{{processObj.partspec?processObj.partspec:'/'}}</view>
                                <view>{{processObj.stepcode}}</view>
                                <view>{{processObj.stepname}}</view>
                            </view>
                        </view>
                    </view>
                </view>
 
                <u-gap height="10" bgColor="#eff0f1"></u-gap>
 
                <view class="head" style="height: 290rpx;overflow: auto;">
                    <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 class="flex_column contentFont">
                                <view>{{processObj.checkstandname}}</view>
                                <view>{{processObj.sampmethod==='FIXED'?'固时抽检':'比例抽检'}}</view>
                                <view>{{processObj.good_qty}}</view>
 
 
                                <u-number-box inputWidth='50' v-model="processObj.sampscare" min='1'
                                    :max='processObj.good_qty' class="contentFont"
                                    @change="samplesChange"></u-number-box>
                            </view>
                        </view>
                    </view>
                </view>
 
 
                <u-gap height="10" bgColor="#eff0f1"></u-gap>
                <view class="head" style="">
                    <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="marginBottom20 marginTop10"
                        style="display: flex;justify-content: space-around;align-items: center;">
                        <u-button type="primary" :disabled="checkNumber===1" @click="preTo"
                            style="width: 160rpx;height: 60rpx;" plain text="上一件"></u-button>
                        <view style="">{{checkNumber}}/{{processObj.sampscare}}</view>
                        <u-button type="primary"
                            :disabled="checkNumber===processObj.sampscare||processArr%processArr.filter(i=>i.isPlain!=='').length===0"
                            @click="nextTo" style="width: 160rpx;height: 60rpx; " plain text="下一件"></u-button>
                    </view>
 
                    <u-gap height="6" style="width: 96%;margin-left: 2%;" bgColor="#eff0f1"></u-gap>
 
 
                    <view class="marginLeft20 marginRight20 marginTop20" style="margin-bottom: 132rpx;">
                        <view class="marginBottom20 flex_column" v-for="(item,index) in processArr"
                            v-if="item.checkNumber===checkNumber" :key="item.name+index+checkNumber">
 
 
                            <view class="flex_between marginLeft20 ">
                                <view class="titleFont">{{item.name}}</view>
 
                                <view class="contentFont" v-if="item.numberjudge==='N'"
                                    style="display: flex;width: 280rpx;">
 
                                    <u-button type="success" style="width: 130rpx;margin-left: 10%;height: 56rpx;"
                                        shape="circle" @click="item.isPlain=true;$forceUpdate()" :plain='!item.isPlain'
                                        text="合格"></u-button>
                                    <!-- :disabled="item.required==='Y'&&!item.real_value" -->
 
                                    <u-button type="warning" style="width: 130rpx;margin-left: 4%;height: 56rpx;"
                                        shape="circle" :plain='item.isPlain' @click="item.isPlain=false;$forceUpdate()"
                                        text="不合格"></u-button>
                                    <!-- :disabled="item.required==='Y'&&!item.real_value" -->
 
                                </view>
 
                            </view>
 
                            <view class="flex_between marginLeft20 ">
                                <view class="flex_column titleFont">
                                    <view v-if="item.standvalue">标准值</view>
                                    <view v-if="item.uppervalue">上限值</view>
                                    <view v-if="item.lowervalue">下限值</view>
                                </view>
                                <view class="flex_column titleFont marginRight20">
                                    <view v-if="item.standvalue">{{item.standvalue}}</view>
                                    <view v-if="item.uppervalue">{{item.uppervalue}}</view>
                                    <view v-if="item.lowervalue">{{item.lowervalue}}</view>
                                </view>
                            </view>
 
                            <view class="titleFont marginLeft20 marginRight20">
                                <view v-if="item.stepcheckitem_desc">描述 {{item.stepcheckitem_desc}}</view>
                            </view>
 
                            <view class="flex_between marginLeft20  marginTop10 marginBottom20">
                                <view class="titleFont  " style="display: flex;align-items: center;"
                                    v-if="item.numberjudge==='Y'">
                                    <view class="titleFont marginRight20">
                                        实测值
                                    </view>
 
                                    <view class="inputClass " style="width:40%;">
                                        <u--input style="" :adjustPosition='false' placeholder="请输入" border="surround"
                                            v-model="item.real_value" @change='val=>realValueBlur(val,item)'></u--input>
                                    </view>
 
                                    <view style="display: flex;width: 280rpx;margin-left: 12rpx;">
                                        <u-button type="success" style="width: 130rpx;margin-left: 10%;height: 56rpx;"
                                            shape="circle" @click="item.isPlain=true;$forceUpdate()"
                                            :disabled="item.required==='Y'&&!item.real_value" :plain='!item.isPlain'
                                            text="合格"></u-button>
 
 
                                        <u-button type="warning" style="width: 130rpx;margin-left: 4%;height: 56rpx;"
                                            shape="circle" :plain='item.isPlain'
                                            :disabled="item.required==='Y'&&!item.real_value"
                                            @click="item.isPlain=false;$forceUpdate()" text="不合格"></u-button>
                                    </view>
                                </view>
 
                            </view>
 
                            <!-- <view class=" marginLeft20 marginRight20 marginTop10">
                                <view class="titleFont"> 描述:{{item.stepcheckitem_desc}}</view>
                            </view>
                            <view class=" marginLeft20 marginRight20 marginTop10 marginBottom20"
                                style="display: flex;align-items: center;">
                                <view class="contentFont"> 备注:</view>
                                <view class="inputClass " style="">
                                    <u--input style="" placeholder="请输入" border="surround"
                                        v-model="item.stepcheckitem_remark"></u--input>
                                </view>
                            </view> -->
 
                            <u-gap height="6"
                                v-if="(index+1)%processArr.map(i=>i.checkNumber===1).filter(i=>i).length!==0"
                                style="width: 96%;margin-left: 2%;" bgColor="#eff0f1"></u-gap>
 
                        </view>
                    </view>
 
                </view>
 
 
 
 
            </view>
        </view>
 
        <view class="footer" v-if="processArr.length!==0">
            <u-button v-if="processArr.length!==0" type="primary" size='large'
                :disabled="!(processArr.filter(i=>i.isPlain==='').length===0)" :hairline="true" @click="navigateTo"
                text="下一步"></u-button>
        </view>
 
 
 
    </view>
</template>
 
 
<script>
    import {
        MesOrderStepCheckSearch,
        MesOrderStepCheckItemList
    } from '../../config/api.js';
 
    export default {
        onLoad(option) {
            this.getStepCheckSearch(option.orderstep)
        },
 
        onPullDownRefresh() {
            setTimeout(() => {
                this.init(() => {
                    uni.stopPullDownRefresh();
                })
            }, 1000);
        },
 
        data() {
            return {
 
                processObj: {
                    // wocode: '',
                    // partcode: '',
                    // partname: '',
                    // partspec: '',
                    // stepcode: '',
                    // stepname: '',
                    // checkstandcode: '',
                    // checkstandname: '',
                    // check_type: '',
                    // sampmethod: '', // FIXED(固时抽检)  SCARE(比例抽检)
                    // sampscare: '',
                    // qualitystatus: '',
                    // good_qty: '', // 指的报工数量
                    // sampleqty: '',
                    // goodqty: '', // 合格数量
                    // ngqty: '', // 不良数量
                }, //工序检验对象
                processArr: [], //工序检验数组
 
 
                checkNumber: 1, //检验项目中的检验数量  现在处于第几个
            }
        },
        created() {
 
        },
        mounted() {
            this.init()
 
            // this.getStepCheckSearch('MO-2024-01-0004_2;101')
 
        },
        methods: {
            init() {
                uni.stopPullDownRefresh();
            },
 
            async getStepCheckSearch(orderstepqrcode) {
                console.log('执行了')
                // 检验方式FirstCheck(首检) PatroCheck(巡检) EndCheck(完工检)
                const data = {
                    // 'MO-2023-05-0003_1;Step06'
                    orderstepqrcode,
                    checktype: 'EndCheck',
                    // stu_torgcode: uni.getStorageSync('stu_torgcode')
                }
                // const res = await MesOrderStepCheckSearch(this.global.formatData(data))
                const res = await MesOrderStepCheckSearch(data)
 
 
                if (res.code === '200') {
                    this.processObj = {
                        wo_code: res.data.labcont[0].wo_code,
                        partcode: res.data.labcont[0].partcode,
                        partname: res.data.labcont[0].partname,
                        partspec: res.data.labcont[0].partspec,
                        stepcode: res.data.labcont[0].stepcode,
                        stepname: res.data.labcont[0].stepname,
                        good_qty: res.data.labcont[0].good_qty,
                        checkstandcode: res.data.chekstand[0].checkstandcode,
                        checkstandname: res.data.chekstand[0].checkstandname,
                        sampmethod: res.data.chekstand[0].sampmethod,
                        sampscare: res.data.chekstand[0].sampmethod === 'FIXED' ? res.data.chekstand[0].sampscare :
                            Math.ceil(res.data.labcont[0].good_qty * res.data.chekstand[0].sampscare / 100)
                    }
 
                    this.processObj.sampscare = this.processObj.sampscare <= this.processObj.good_qty ? this.processObj
                        .sampscare : this.processObj.good_qty
 
 
                    await this.getStepCheckItemList(this.processObj.checkstandcode)
 
                } else {
                    setTimeout(() => {
                        uni.navigateBack({
                            delta: 1, //返回层数,1则上页   
                        })
                    }, 1000)
                }
            },
 
            async getStepCheckItemList(checkstandcode) {
                const data = {
                    checkstandcode
                }
                const res = await MesOrderStepCheckItemList(data)
 
                this.processArr = []
 
                for (var i = 0; i < this.processObj.sampscare; i++) {
                    res.data.forEach(j => {
                        this.processArr.push({
                            checkNumber: i + 1,
                            stepcheckitem_seq: j.stepcheckitem_seq,
                            name: j.name,
                            code: j.code,
                            standvalue: j.standvalue,
                            lowervalue: j.lowervalue,
                            uppervalue: j.uppervalue,
                            real_value: j.real_value,
                            unit: j.unit,
                            stepcheckitem_desc: j.stepcheckitem_desc,
                            stepcheckitem_remark: '',
                            isPlain: '',
                            required: j.required, //是否必填
                            numberjudge: j.numberjudge, //数值判断
                        })
                    })
                }
 
 
            },
 
            // 样本数量值改变时
            samplesChange(val) {
 
                console.log(val.value)
                const t = this.processArr.filter(i => i.checkNumber === 1)
                let len = this.processArr.length / t.length
 
                // 件数减少时
                if (val.value < this.processArr.length / t.length) {
                    this.processArr.reverse()
                    const a = this.processArr.splice(0, t.length * (len - val.value))
                    this.processArr.reverse()
                    if (this.checkNumber > val.value) {
                        this.checkNumber = val.value
                    }
                }
 
 
                // 件数变多时
                if (val.value > this.processArr.length / t.length) {
 
                    for (var i = val.value; i > len; i--) {
                        t.forEach(j => {
                            this.processArr.push({
                                checkNumber: i,
                                stepcheckitem_seq: j.stepcheckitem_seq,
                                name: j.name,
                                code: j.code,
                                standvalue: j.standvalue,
                                lowervalue: j.lowervalue,
                                uppervalue: j.uppervalue,
                                real_value: '',
                                unit: j.unit,
                                stepcheckitem_desc: j.stepcheckitem_desc,
                                stepcheckitem_remark: '',
                                isPlain: '',
                                required: j.required, //是否必填
                                numberjudge: j.numberjudge, //数值判断
                            })
                        })
                    }
 
                    this.processArr.sort((a, b) => a.checkNumber - b.checkNumber)
 
                }
 
                // console.log(this.processArr, 1)
                // console.log(this.processArr.length, 1)
                this.$forceUpdate()
            },
 
 
            // 上一件
            preTo() {
                if (this.checkNumber > 1) {
                    this.checkNumber--
                }
            },
 
            //下一件
            nextTo() {
                if (this.checkNumber < this.processObj.sampscare) {
                    this.checkNumber++
                }
                this.$forceUpdate()
            },
 
 
            // 实测值输入时失焦状态
            realValueBlur(val, item) {
                console.log(val === '', item)
 
 
                if (val.value !== '') {
                    if (item.numberjudge === 'Y') { //如果需要进行数值判断
 
                        if (item.uppervalue === '' && item.lowervalue === '') { //上限值为空,下限值为空
                            if (parseFloat(val) === parseFloat(item.standvalue)) {
                                item.isPlain = true
                            } else {
                                item.isPlain = false
                            }
                        }
 
 
                        if (item.uppervalue !== '' && item.lowervalue !== '') { //上限值不为空,下限值不为空
                            if (parseFloat(val) >= parseFloat(item.lowervalue) && parseFloat(val) <=
                                parseFloat(item.uppervalue)) {
                                item.isPlain = true
                            } else {
                                item.isPlain = false
                            }
                        }
 
 
                        if (item.uppervalue !== '' && item.lowervalue === '') { //上限值不为空,下限值为空
                            if (parseFloat(val) <= parseFloat(item.uppervalue)) {
                                item.isPlain = true
                            } else {
                                item.isPlain = false
                            }
                        }
 
                        if (item.uppervalue === '' && item.lowervalue !== '') { //上限值为空,下限值不为空
                            if (parseFloat(val) >= parseFloat(item.lowervalue)) {
                                item.isPlain = true
                            } else {
                                item.isPlain = false
                            }
                        }
 
                    }
                }
 
 
                if (val === '') {
                    item.isPlain = ''
                }
                // this.$forceUpdate()
            },
 
 
 
            // 下一步
            navigateTo() {
                // 计算OK值
                let goodqty = 0;
                for (var i = 0; i < this.processObj.sampscare; i++) {
                    let flag = this.processArr.filter(j => j.checkNumber === i + 1).every(j => j.isPlain)
                    if (flag) {
                        goodqty++
                    }
                }
 
 
                uni.navigateTo({
                    url: './wgjy2?processObj=' + JSON.stringify(this.processObj) +
                        '&processArr=' + JSON.stringify(this.processArr) + '&goodqty=' + goodqty
                });
 
 
            },
 
            // 扫码
            topScanClick() {
                let that = this;
 
                uni.scanCode({
                    onlyFromCamera: true,
                    // scanType: ['barCode', 'qrCode'],
                    scanType: ['qrCode'],
                    success: function(res) {
                        console.log('条码类型:' + res.scanType);
                        console.log('条码内容:' + res.result);
                        that.getStepCheckSearch(res.result)
                        // that.scanContent = res.result;
                        // let flag = false
                        // that.processArr.forEach(item => {
                        //     if (item.hbarcode === res.result) {
                        //         flag = true
                        //     }
                        // })
                        // if (flag) {
                        //     that.$u.toast('此条码已扫描,已在列表中!')
                        // } else {
                        //     //处理扫码事件
                        //     // that.getStepCheckSearch(that.scanContent);
                        // }
                    },
                    complete: function(res) {
 
                    },
                    fail: function(res) {
                        console.log('条码类型:' + res.scanType);
                        console.log('条码内容:' + res.result);
                    }
 
                });
            },
 
            fromSubmitData() {
                this.processObj = {}
                this.processArr = []
                this.checkNumber = 1
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    @import url('@/style/global.css');
 
    ::v-deep .uicon-arrow-left>span {
        display: block;
    }
 
    ::v-deep .u-input {
        padding: 6rpx 18rpx !important;
    }
 
    ::v-deep .u-number-box__minus {
        height: 50rpx !important;
    }
 
    ::v-deep .u-number-box__input {
        height: 50rpx !important;
 
    }
 
    ::v-deep .u-number-box__plus {
        height: 50rpx !important;
    }
</style>