zouyu
2023-11-10 789bd1e36e88e09a45fa24fa1569330ada4c45b7
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
<template>
  <el-dialog
    width="70%"
    title="标签信息"
    top="3vh"
    :visible.sync="innerVisible"
    append-to-body
    @close="$emit('update:currshowlist', false)"
    :show="currshowlist"
    :close-on-click-modal="false"
    class="small-warehousing-label-dialog"
  >
    <el-form :model="dataForm" ref="dataForm" label-width="90px" class="l-mes">
      <el-row>
        <el-col :span="12">
          <el-form-item label="零件号" prop="partNo">
            <el-input v-model="dataForm.partNo" disabled></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="零件描述" prop="partName">
            <el-input v-model="dataForm.partName" disabled></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="SN号" prop="outBatchNo"
            ><el-input
              v-model="dataForm.outBatchNo"
              placeholder="SN号"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="IFS批次号" prop="ifsBatchNo"
            ><el-input
              v-model="dataForm.ifsBatchNo"
              placeholder="IFS批次号"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="生产数量" prop="productQty">
            <el-input
              v-model="dataForm.productQty"
              placeholder="生产数量"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="单位" prop="unit"
            ><el-input v-model="dataForm.unit" placeholder="单位"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="innerVisible = false">取消</el-button>
      <el-button type="primary" v-thinclick="`printData`">打印</el-button>
    </span>
  </el-dialog>
</template>
<script>
import { mapGetters } from 'vuex'
import { getObj } from '@/api/basic/part'
import getLodop from '@/util/lodop'
import { getYearAndMonth } from '@/util/date'
import { judgeLabelMark } from '@/api/warehouse/check'
export default {
  props: {
    currshowlist: {
      type: Boolean,
      default: false
    },
    printLabelInfo: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  data() {
    return {
      innerVisible: false,
      dataForm: {},
      partInfo: null
    }
  },
  watch: {
    currshowlist() {
      this.innerVisible = this.currshowlist
      if (this.currshowlist) {
        this.$nextTick(() => {
          getObj(this.printLabelInfo.partId).then((response) => {
            const resData = response.data
            this.partInfo = resData.data
          })
          this.dataForm = {
            partNo: this.printLabelInfo.partNo,
            partName: this.printLabelInfo.partName,
            outBatchNo: this.printLabelInfo.outBatchNo,
            ifsBatchNo: this.printLabelInfo.ifsBatchNo,
            productQty: this.printLabelInfo.productQty,
            lotTrackingIfs: this.printLabelInfo.lotTrackingIfs,
            unit: this.printLabelInfo.unit
          }
          console.log('this.dataForm', this.dataForm)
        })
      }
    }
  },
  computed: {
    ...mapGetters(['userInfo'])
  },
  methods: {
    printData() {
      // 找出所有要打印的SN的list
      const snList = []
      snList.push(this.dataForm.outBatchNo)
      // 查询是否正在盘点
      judgeLabelMark(snList).then((resp) => {
        const respData = resp.data
        const markArr = respData.data
        let markFlag = true
        markFlag = markArr.includes(this.dataForm.outBatchNo)
        if (markFlag) {
          this.beginPrint(true)
        } else {
          this.beginPrint(false)
        }
      })
    },
    beginPrint(isCheck) {
      this.LODOP = getLodop()
      this.dataForm.lotTrackingIfs = this.partInfo.lotTrackingIfs
      console.log(this.dataForm)
      const qr = {
        part_no: this.dataForm.partNo,
        lot_batch_no: this.dataForm.ifsBatchNo,
        qty_arrived: this.dataForm.productQty,
        wdr: this.dataForm.outBatchNo,
        unit_meas: this.dataForm.unit,
        sn_no: this.dataForm.outBatchNo
      }
      const qrStr = JSON.stringify(qr)
      if (isCheck) {
        const currYearAndMonth = getYearAndMonth()
        this.LODOP.SET_LICENSES(
          '南通市鑫阳软件开发有限公司',
          '60F8E5078AE17DEB340C94BC7E83CAFF',
          '',
          ''
        )
        this.LODOP.PRINT_INITA(0, -1, 500, 300, '')
        this.LODOP.SET_PRINT_PAGESIZE(0, 1000, 600, '')
        this.LODOP.SET_PRINT_MODE('PRINT_NOCOLLATE', 1)
        this.LODOP.ADD_PRINT_TEXT(37, 45, 63, 20, '数量:')
        this.LODOP.SET_PRINT_STYLEA(0, 'FontSize', 10)
        this.LODOP.SET_PRINT_STYLEA(0, 'Alignment', 2)
        this.LODOP.SET_PRINT_STYLEA(0, 'Bold', 1)
        this.LODOP.SET_PRINT_STYLEA(0, 'Angle', 270)
        this.LODOP.ADD_PRINT_TEXT(
          63,
          46,
          134,
          20,
          this.dataForm.productQty + ' ' + this.dataForm.unit
        )
        this.LODOP.SET_PRINT_STYLEA(0, 'FontSize', 10)
        this.LODOP.SET_PRINT_STYLEA(0, 'Alignment', 2)
        this.LODOP.SET_PRINT_STYLEA(0, 'Bold', 1)
        this.LODOP.SET_PRINT_STYLEA(0, 'Angle', 270)
        this.LODOP.ADD_PRINT_TEXT(37, 92, 63, 20, 'SN号:')
        this.LODOP.SET_PRINT_STYLEA(0, 'FontSize', 10)
        this.LODOP.SET_PRINT_STYLEA(0, 'Alignment', 2)
        this.LODOP.SET_PRINT_STYLEA(0, 'Bold', 1)
        this.LODOP.SET_PRINT_STYLEA(0, 'Angle', 270)
        this.LODOP.ADD_PRINT_TEXT(69, 93, 134, 20, this.dataForm.outBatchNo)
        this.LODOP.SET_PRINT_STYLEA(0, 'FontSize', 10)
        this.LODOP.SET_PRINT_STYLEA(0, 'Alignment', 2)
        this.LODOP.SET_PRINT_STYLEA(0, 'Bold', 1)
        this.LODOP.SET_PRINT_STYLEA(0, 'Angle', 270)
        this.LODOP.ADD_PRINT_TEXT(23, 140, 77, 20, '零件号:')
        this.LODOP.SET_PRINT_STYLEA(0, 'FontSize', 10)
        this.LODOP.SET_PRINT_STYLEA(0, 'Alignment', 2)
        this.LODOP.SET_PRINT_STYLEA(0, 'Bold', 1)
        this.LODOP.SET_PRINT_STYLEA(0, 'Angle', 270)
        this.LODOP.ADD_PRINT_TEXT(57, 141, 182, 22, this.dataForm.partNo)
        this.LODOP.SET_PRINT_STYLEA(0, 'FontSize', 10)
        this.LODOP.SET_PRINT_STYLEA(0, 'Alignment', 2)
        this.LODOP.SET_PRINT_STYLEA(0, 'Bold', 1)
        this.LODOP.SET_PRINT_STYLEA(0, 'Angle', 270)
        this.LODOP.ADD_PRINT_BARCODE(45, 215, 149, 181, 'QRCode', qrStr)
        this.LODOP.SET_PRINT_STYLEA(0, 'FontSize', 10)
        this.LODOP.SET_PRINT_STYLEA(0, 'QRCodeVersion', 7)
        this.LODOP.SET_PRINT_STYLEA(0, 'QRCodeErrorLevel', 'L')
        this.LODOP.ADD_PRINT_LINE(215, 20, 215, 163, 0, 2)
        this.LODOP.ADD_PRINT_LINE(215, 197, 215, 360, 0, 2)
        this.LODOP.ADD_PRINT_TEXT(208, 163, 34, 15, currYearAndMonth)
        this.LODOP.SET_PRINT_STYLEA(0, 'Alignment', 2)
        this.LODOP.ADD_PRINT_LINE(225, 20, 225, 360, 0, 2)
        // this.LODOP.PREVIEW()
        this.LODOP.PRINT()
      } else {
        this.LODOP.SET_LICENSES(
          '南通市鑫阳软件开发有限公司',
          '60F8E5078AE17DEB340C94BC7E83CAFF',
          '',
          ''
        )
        this.LODOP.PRINT_INITA(0, -1, 500, 300, '')
        this.LODOP.SET_PRINT_PAGESIZE(0, 1000, 600, '')
        this.LODOP.SET_PRINT_MODE('PRINT_NOCOLLATE', 1)
        this.LODOP.ADD_PRINT_TEXT(37, 45, 63, 20, '数量:')
        this.LODOP.SET_PRINT_STYLEA(0, 'FontSize', 10)
        this.LODOP.SET_PRINT_STYLEA(0, 'Alignment', 2)
        this.LODOP.SET_PRINT_STYLEA(0, 'Bold', 1)
        this.LODOP.SET_PRINT_STYLEA(0, 'Angle', 270)
        this.LODOP.ADD_PRINT_TEXT(
          63,
          46,
          134,
          20,
          this.dataForm.productQty + ' ' + this.dataForm.unit
        )
        this.LODOP.SET_PRINT_STYLEA(0, 'FontSize', 10)
        this.LODOP.SET_PRINT_STYLEA(0, 'Alignment', 2)
        this.LODOP.SET_PRINT_STYLEA(0, 'Bold', 1)
        this.LODOP.SET_PRINT_STYLEA(0, 'Angle', 270)
        this.LODOP.ADD_PRINT_TEXT(37, 92, 63, 20, 'SN号:')
        this.LODOP.SET_PRINT_STYLEA(0, 'FontSize', 10)
        this.LODOP.SET_PRINT_STYLEA(0, 'Alignment', 2)
        this.LODOP.SET_PRINT_STYLEA(0, 'Bold', 1)
        this.LODOP.SET_PRINT_STYLEA(0, 'Angle', 270)
        this.LODOP.ADD_PRINT_TEXT(69, 93, 134, 20, this.dataForm.outBatchNo)
        this.LODOP.SET_PRINT_STYLEA(0, 'FontSize', 10)
        this.LODOP.SET_PRINT_STYLEA(0, 'Alignment', 2)
        this.LODOP.SET_PRINT_STYLEA(0, 'Bold', 1)
        this.LODOP.SET_PRINT_STYLEA(0, 'Angle', 270)
        this.LODOP.ADD_PRINT_TEXT(23, 140, 77, 20, '零件号:')
        this.LODOP.SET_PRINT_STYLEA(0, 'FontSize', 10)
        this.LODOP.SET_PRINT_STYLEA(0, 'Alignment', 2)
        this.LODOP.SET_PRINT_STYLEA(0, 'Bold', 1)
        this.LODOP.SET_PRINT_STYLEA(0, 'Angle', 270)
        this.LODOP.ADD_PRINT_TEXT(57, 141, 182, 22, this.dataForm.partNo)
        this.LODOP.SET_PRINT_STYLEA(0, 'FontSize', 10)
        this.LODOP.SET_PRINT_STYLEA(0, 'Alignment', 2)
        this.LODOP.SET_PRINT_STYLEA(0, 'Bold', 1)
        this.LODOP.SET_PRINT_STYLEA(0, 'Angle', 270)
        this.LODOP.ADD_PRINT_BARCODE(45, 215, 149, 181, 'QRCode', qrStr)
        this.LODOP.SET_PRINT_STYLEA(0, 'FontSize', 10)
        this.LODOP.SET_PRINT_STYLEA(0, 'QRCodeVersion', 7)
        this.LODOP.SET_PRINT_STYLEA(0, 'QRCodeErrorLevel', 'L')
        // this.LODOP.PREVIEW()
        this.LODOP.PRINT()
      }
    }
  }
}
</script>
<style scoped></style>