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
<template>
  <u-modal
    v-model="show"
    ref="uModal"
    title=""
    :show-cancel-button="true"
    @confirm="confirm"
    @cancel="cancel"
    :async-close="true"
  >
    <view class="packing-registration-param">
      <scroll-view scroll-y="true" style="height: 100%">
        <view class="packing-registration-param-view">
          <view class="packing-registration-param-item param-extra">
            <view class="packing-registration-param-item-left">
              <text class="item-one">批次号</text>
            </view>
            <view class="packing-registration-param-item-right">
              <u-input
                class="item-one item-two"
                v-model="form.overallLength"
                disabled
              />
            </view>
          </view>
          <view class="packing-registration-param-item param-extra">
            <view class="packing-registration-param-item-left">
              <text class="item-one">产品描述</text>
            </view>
            <view class="packing-registration-param-item-right">
              <u-input
                class="item-one item-two"
                v-model="form.proposedLocation"
                disabled
              />
            </view>
          </view>
          <view class="packing-registration-param-item param-extra">
            <view class="packing-registration-param-item-left">
              <text class="item-one">零件位</text>
            </view>
            <view class="packing-registration-param-item-right">
              <u-input
                class="item-one item-two"
                v-model="form.reelNumber"
                disabled
              />
            </view>
          </view>
          <view class="packing-registration-param-item param-extra">
            <view class="packing-registration-param-item-left">
              <text class="item-one">毛重</text>
            </view>
            <view class="packing-registration-param-item-right">
              <u-input
                class="item-one item-two"
                v-model="form.reelWeight"
                disabled
              />
            </view>
          </view>
          <view class="packing-registration-param-item param-extra">
            <view class="packing-registration-param-item-left">
              <text class="item-one">盘重</text>
            </view>
            <view class="packing-registration-param-item-right">
              <u-input
                class="item-one item-two"
                v-model="form.grossWeight"
                disabled
              />
            </view>
          </view>
          <view class="packing-registration-param-item param-extra">
            <view class="packing-registration-param-item-left">
              <text class="item-one">净重</text>
            </view>
            <view class="packing-registration-param-item-right">
              <u-input
                class="item-one item-two"
                v-model="form.netWeight"
                disabled
              />
            </view>
          </view>
          <view class="packing-registration-param-item param-extra">
            <view class="packing-registration-param-item-left">
              <text class="item-one">核磅重量</text>
            </view>
            <view class="packing-registration-param-item-right">
              <u-input class="item-one item-two" v-model="form.name" />
            </view>
          </view>
          <view class="packing-registration-param-item param-extra">
            <view class="packing-registration-param-item-left">
              <text class="item-one">叉车重量</text>
            </view>
            <view class="packing-registration-param-item-right">
              <u-input class="item-one item-two" v-model="form.outerDiameter" />
            </view>
          </view>
          <view class="packing-registration-param-item param-extra">
            <view class="packing-registration-param-item-left">
              <text class="item-one">长度</text>
            </view>
            <view class="packing-registration-param-item-right">
              <u-input class="item-one item-two" v-model="form.voltage" />
            </view>
          </view>
          <view class="packing-registration-param-item param-extra">
            <view class="packing-registration-param-item-left">
              <text class="item-one">盘号</text>
            </view>
            <view class="packing-registration-param-item-right">
              <u-input class="item-one item-two" v-model="form.speed" />
            </view>
          </view>
        </view>
      </scroll-view>
    </view>
  </u-modal>
</template>
 
<script>
export default {
  props: {
    operationTaskList: {
      type: Object,
      required: true,
      default: () => ({}),
    },
  },
  data() {
    return {
      show: false,
      form: {},
    };
  },
  methods: {
    confirm() {
      if (!this.form.outerDiameter) {
        this.$u.toast("请输入核磅重量");
        this.$refs.uModal.clearLoading(); // 清除加载状态
        return;
      }
      if (!this.form.voltage) {
        this.$u.toast("请输入叉车重量");
        this.$refs.uModal.clearLoading(); // 清除加载状态
        return;
      }
      // PDA 扫码核磅规则:
      // (1).铜杆
      //    正磅差:0-3kg 可直接提交
      //          4-10kg 皮重不变
      //    如果为 4kg 净重加 2kg、毛重加 2kg
      //    如果为 5kg 净重加 3kg、毛重加 4kg
      //    如果为 6kg 净重加 4kg、毛重加 4kg
      //    以此类推
      //    添加弹窗提示:更改合格证毛重为..(改后的值)、净重为..(改后的净重)
      //    超过 10kg提示生产核查(不能提交)
      //    负磅差(要加负号):净重不变
      //    -10kg 以内
      //    核磅重量-2(新的毛重)皮重(新的毛重-净重)超过 10kg提示生产核查(不能提交)
      // (2).导体
      //    正磅差:0-3kg可直接提交
      //    超过 3kg及 负磅差提示生产核查(不能提交)
      // (3).导体2.6
      //     士0.5kg 都可直接提交
      //      超过0.5 提示生产核查
      //磅差计算:核榜-叉车盘-毛重
      Number(this.form.h);
      const magnetic =
        Number(this.form.h) - Number(this.form.children) - Number(this.form.m);
      uni.showModal({
        title: "提示",
        content: "磅差为:" + magnetic,
        showCancel: false,
        success: function () {
          switch (this.operationTaskList.productType) {
            case "铜杆":
              if (magnetic > 0 && magnetic < 3) {
                this.verifySubmission(this.form);
              }
              if (magnetic == 4) {
                this.form.grossWeight = Number(this.form.grossWeight) + 2;
                this.form.netWeight = Number(this.form.netWeight) + 2;
                this.$u.toast(
                  "更改合格证毛重为:" +
                    this.form.grossWeight +
                    "净重为:" +
                    this.form.netWeight
                );
                this.verifySubmission(this.form);
              }
              if (magnetic == 5) {
                this.form.grossWeight = Number(this.form.grossWeight) + 3;
                this.form.netWeight = Number(this.form.netWeight) + 3;
                this.$u.toast(
                  "更改合格证毛重为:" +
                    this.form.grossWeight +
                    "净重为:" +
                    this.form.netWeight
                );
                this.verifySubmission(this.form);
              }
              if (magnetic == 6) {
                this.form.grossWeight = Number(this.form.grossWeight) + 4;
                this.form.netWeight = Number(this.form.netWeight) + 4;
                this.$u.toast(
                  "更改合格证毛重为:" +
                    this.form.grossWeight +
                    "净重为:" +
                    this.form.netWeight
                );
                this.verifySubmission(this.form);
              }
              if (magnetic == 7) {
                this.form.grossWeight = Number(this.form.grossWeight) + 5;
                this.form.netWeight = Number(this.form.netWeight) + 5;
                this.$u.toast(
                  "更改合格证毛重为:" +
                    this.form.grossWeight +
                    "净重为:" +
                    this.form.netWeight
                );
                this.verifySubmission(this.form);
              }
              if (magnetic == 8) {
                this.form.grossWeight = Number(this.form.grossWeight) + 6;
                this.form.netWeight = Number(this.form.netWeight) + 6;
                this.$u.toast(
                  "更改合格证毛重为:" +
                    this.form.grossWeight +
                    "净重为:" +
                    this.form.netWeight
                );
                this.verifySubmission(this.form);
              }
              if (magnetic == 9) {
                this.form.grossWeight = Number(this.form.grossWeight) + 7;
                this.form.netWeight = Number(this.form.netWeight) + 7;
                this.$u.toast(
                  "更改合格证毛重为:" +
                    this.form.grossWeight +
                    "净重为:" +
                    this.form.netWeight
                );
                this.verifySubmission(this.form);
              }
              if (magnetic == 10) {
                this.form.grossWeight = Number(this.form.grossWeight) + 8;
                this.form.netWeight = Number(this.form.netWeight) + 8;
                this.$u.toast(
                  "更改合格证毛重为:" +
                    this.form.grossWeight +
                    "净重为:" +
                    this.form.netWeight
                );
                this.verifySubmission(this.form);
              }
              if (magnetic > 10) {
                this.$u.toast("生产核查");
              }
              break;
            // case "导体":
            //   if (magnetic > 0 && magnetic < 3) {
            //     this.verifySubmission(this.form);
            //   } else {
            //     this.$u.toast("生产核查");
            //   }
            //   break;
            // case "导体2.6":
            //   if (magnetic > -0.5 && magnetic < 0.5) {
            //     this.verifySubmission(this.form);
            //   } else {
            //     this.$u.toast("生产核查");
            //   }
            //   break;
          }
        },
      });
    },
    // 校验后提交
    verifySubmission(Obj) {
      this.$emit("update", Obj);
    },
    cancel() {
      this.show = false;
      this.form = {};
    },
    open(val) {
      this.show = true;
      this.form = val;
    },
  },
};
</script>
 
<style lang="scss" scoped>
::v-deep .u-model__title {
  padding-top: 0 !important;
}
 
::v-deep .u-input__input {
  text-align: right !important;
}
 
.packing-registration-param {
  padding: 40rpx 30rpx 10rpx 30rpx;
  height: 350px;
  overflow: hidden;
 
  .packing-registration-param-title {
    display: flex;
    flex-direction: row;
    align-items: center;
    margin-bottom: 30rpx;
 
    .title-label {
      margin-left: 14rpx;
      font-size: 34rpx;
      font-weight: bold;
      color: #283e65;
    }
  }
 
  .packing-registration-param-view {
    height: 177rpx;
    background-color: #fff;
    border-radius: 10rpx;
    padding: 0rpx 23rpx;
    margin-bottom: 30rpx;
 
    .packing-registration-param-item {
      height: 90rpx;
      border: 1px solid #adc8e4;
      line-height: 90rpx;
      display: flex;
      justify-content: space-between;
      border: none;
 
      .packing-registration-param-item-left {
        .item-one {
          font-size: 30rpx;
          color: #666666;
        }
      }
 
      .packing-registration-param-item-right {
        display: flex;
        justify-content: space-between;
 
        .item-one {
          font-size: 15rpx;
          color: #060505;
          margin-right: 6rpx;
        }
 
        .item-two {
          font-size: 15rpx;
          color: #a6b4cc;
          margin-right: 6rpx;
        }
 
        .item-three {
          font-size: 30rpx;
          color: #214ded;
          margin-right: 6rpx;
        }
      }
    }
 
    .param-extra {
      border-bottom: 1px solid #ededed;
    }
  }
}
</style>