小小儁爺
2024-08-29 7846034cd1a7f19f4f2c7c955542ee4f85bbb14a
src/views/produce/stepReport.vue
@@ -339,6 +339,7 @@
    </div>
    <!--    开报工、外协、不良处理-->
    <el-dialog
      v-el-drag-dialog
      :title="dialogTitle"
@@ -669,6 +670,12 @@
            align="center"
          />
          <el-table-column
            prop="eqp_name"
            label="设备/供应商"
            show-tooltip-when-overflow
            align="center"
          />
          <el-table-column
            prop="plan_qty"
            label="任务数量"
            show-tooltip-when-overflow
@@ -792,6 +799,84 @@
      </span>
    </el-dialog>
    <!--    流转小标签打印-->
    <!--打印预览页面  小标签-->
    <el-dialog
      v-el-drag-dialog
      title="预览"
      :visible.sync="dialogVisible2"
      width="1140"
      top="10vh"
      :close-on-click-modal="false"
      @close="dialogVisible2Close"
    >
      <!-- 要打印的区域 -->
      <div id="printMe2" style="padding: 30px;">
        <div
          style="display: flex;width: 280px;height: 150px;border: 1px solid #000;text-align: center;font-size: 10px;"
        >
          <div style="width: 90px;display: flex;flex-direction: column;border-right: 1px solid #000">
            <div
              style="display: flex;height: 90px;border-bottom:1px solid #000;
              justify-content: center;align-items: center;position: relative"
            >
              <div id="qrCode2" ref="qrCodeDiv2" style="overflow-y: hidden;height:60px;position: absolute;left: 14px;" />
            </div>
            <div
              style="display: flex;height: 30px;justify-content: flex-start;border-bottom:1px solid #000;align-items: center"
            >
              <div style="margin-left: 5px;width: 28px">数量:</div>
              {{ qrForm.startqty }}
            </div>
            <div style="display: flex;height: 30px;justify-content: flex-start;align-items: center">
              <div style="margin-left: 5px;width: 42px">处理人:</div>
              {{ qrForm.operator }}
            </div>
          </div>
          <div style="width:190px;display: flex;flex-direction: column">
            <div
              style="display: flex;height: 20%;border-bottom:1px solid #000;justify-content: flex-start;align-items: center;text-align: left"
            >
              <div style="width: 60px;margin-left: 5px;">工单编号:</div>
              <div>{{ qrForm.wo_code }}</div>
            </div>
            <div
              style="display: flex;height: 20%;border-bottom:1px solid #000;justify-content: flex-start;align-items: center ;text-align: left"
            >
              <div style="width: 60px;margin-left: 5px;">产品编码:</div>
              <div>{{ qrForm.partcode }}</div>
            </div>
            <div
              style="display: flex;height: 20%;border-bottom:1px solid #000 ;justify-content: flex-start;align-items: center;text-align: left"
            >
              <div style="width:60px;margin-left: 5px;">产品名称:</div>
              <div>{{ qrForm.partname }}</div>
            </div>
            <div
              style="display: flex;height: 20%;border-bottom:1px solid #000 ;justify-content: flex-start;align-items: center;text-align: left"
            >
              <div style="width:60px;margin-left: 5px;">{{ qrForm.nextstepname?'下道工序':'产品规格' }}:</div>
              <div>{{ qrForm.nextstepname?qrForm.nextstepname:qrForm.partspec?qrForm.partspec:'/' }}</div>
            </div>
            <div style="display: flex;height: 20%;justify-content: flex-start;align-items: center;text-align: left">
              <div style="width: 60px;margin-left: 5px;">处理时间:</div>
              <div>{{ qrForm.operatorTime }}</div>
            </div>
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button v-waves @click="dialogVisible2 = false">取 消</el-button>
          <el-button v-waves v-print="printObj2" type="primary">确 定</el-button>
        </div>
      </span>
    </el-dialog>
  </div>
</template>
@@ -803,7 +888,7 @@
import {
  EditOrderNgStepSeave,
  MesOrderNgStepSearch,
  MesOrderNgSubStepSearch,
  MesOrderNgSubStepSearch, MesOrderStepDeviceCusstomer,
  MesOrderStepSearch, MesOrderStepStart,
  MesOrderWxStepSearch, SavaMesOrderStepIn, SavaMesOrderStepOut, SavaMesOrderStepReport
} from '@/api/WorkOrder'
@@ -818,7 +903,8 @@
import { nanoid } from 'nanoid'
import { LabelBarCode } from '@/api/systemSetting'
import { getCookie } from '@/utils/auth'
import { handleDatetime2 } from '@/utils/global'
import QRCode from 'qrcodejs2'
export default {
  name: 'SCKBG',
  components: {
@@ -936,8 +1022,41 @@
      defectTableData: [],
      badTableData: [],
      workOrderCurrentValue: ''
      workOrderCurrentValue: '',
      dialogVisible2: false, //
      qrForm: { // 打印内容
        qrvalue: '',
        startqty: '',
        wo_code: '',
        partcode: '',
        partname: '',
        partspec: '',
        nextstepname: '',
        operator: '', // 操作人
        operatorTime: ''// 操作时间
      },
      printObj2: {
        id: 'printMe2',
        popTitle: '打印模板',
        preview: false,
        extraHead: '<meta http-equiv="Content-Language" content="zh-cn"/>',
        closeCallback(vue) { // 关闭打印的回调事件(无法确定点击的是确认还是取消)
          console.log('11212', vue)
          // vue.dialogVisible = false
          vue.dialogVisible2 = false
          vue.dialogVisible = false
        },
        beforeOpenCallback(vue) {
          vue.printLoading = true
          console.log('打开之前')
        },
        openCallback(vue) {
          vue.printLoading = false
          console.log('执行了打印')
        }
      },
      xx: ''
    }
  },
  created() {
@@ -952,6 +1071,7 @@
    this.getAllSelectArr()
  },
  methods: {
    async getAllSelectArr() {
      const { data: res1 } = await GroupsPermissions()// 班组
      this.usergroupArr = res1
@@ -962,11 +1082,11 @@
      const { data: res3 } = await DefectPermissions() // 缺陷
      this.defectArr = res3
      const { data: res4 } = await EqpPermissions() // 设备
      this.eqpArr = res4
      const { data: res5 } = await CustomerPermissions() // 往来单位
      this.wxArr = res5
      // const { data: res4 } = await EqpPermissions() // 设备
      // this.eqpArr = res4
      //
      // const { data: res5 } = await CustomerPermissions() // 往来单位
      // this.wxArr = res5
      const { data: res6 } = await PrentOrganizationNoCompany()// 无公司的组织下拉
      this.wkshopcodeArr = res6
@@ -1123,6 +1243,18 @@
    },
    // 生产开报工:报工/外协(发料/收料)时条件判断及数据返回接口
    async getMesOrderStepStart(OperType, SelectType, wocode, stepcode) {
      const data2 = {
        OperType, wocode, stepcode
      }
      const { data: res2 } = await MesOrderStepDeviceCusstomer(data2)
      if (OperType === 'ZZ') {
        this.eqpArr = res2
      }
      if (OperType === 'WX') {
        this.wxArr = res2
      }
      const data = {
        OperType, SelectType, wocode, stepcode
      }
@@ -1252,12 +1384,23 @@
                badqty: i.badqty
              })
            })
            // let stepprice = null
            //
            // if (this.activeName === '生产列表') {
            //   stepprice = this.eqpArr.find(i => i.code === this.dialogForm.eqpcode) ? this.eqpArr.find(i => i.code === this.dialogForm.eqpcode).eqpprice : this.dialogForm.stepprice
            // }
            //
            // if (this.activeName === '外协发料' || this.activeName === '外协收料') {
            //   stepprice = this.wxArr.find(i => i.code === this.dialogForm.wxcode) ? this.wxArr.find(i => i.code === this.dialogForm.wxcode).eqpprice : this.dialogForm.stepprice
            // }
            const data = {
              mesordercode: this.dialogForm.wo_code,
              partcode: this.dialogForm.partnumber,
              stepseq: this.dialogForm.seq,
              stepcode: this.dialogForm.stepcode,
              stepprice: this.dialogForm.stepprice,
              stepprice: this.eqpArr.find(i => i.code === this.dialogForm.eqpcode) ? this.eqpArr.find(i => i.code === this.dialogForm.eqpcode).eqpprice : this.dialogForm.stepprice,
              eqpcode: this.dialogForm.eqpcode,
              inbarcode,
              reckway: this.dialogForm.reckway,
@@ -1284,6 +1427,12 @@
              await this.tabClick()
              this.$store.state.app.buttonIsDisabled = false
              this.dialogVisible = false
              // 自制报工打印标签口子已开好
              // if (JSON.parse(localStorage.getItem('mesSetting')).every) {
              //   this.dialogVisible2 = true
              //   this.ZZprint2(localStorage.getItem('username'))
              // }
            } else {
              this.$store.state.app.buttonIsDisabled = false
              this.$notify.error('报工失败!')
@@ -1369,7 +1518,7 @@
              partcode: this.dialogForm.partnumber,
              stepseq: this.dialogForm.seq,
              stepcode: this.dialogForm.stepcode,
              stepprice: this.wxArr.find(i => i.code === this.dialogForm.wxcode) ? this.wxArr.find(i => i.code === this.dialogForm.wxcode).eqpprice : this.dialogForm.stepprice,
              wxcode: this.dialogForm.wxcode,
              inbarcode,
              inuser: this.dialogForm.inuser,
@@ -1419,6 +1568,51 @@
        }
      })
    },
    dialogVisible2Close() {
      this.qrForm.qrvalue = ''
      this.qrForm.startqty = ''
      this.qrForm.wo_code = ''
      this.qrForm.partcode = ''
      this.qrForm.partname = ''
      this.qrForm.partspec = ''
      this.qrForm.nextstepname = ''
      this.qrForm.operator = ''
      this.qrForm.operatorTime = ''
      // this.$refs.qrCodeDiv2 = ''
    },
    ZZprint2(username) {
      if (this.dialogForm.nextstepcode !== '') {
        this.qrForm.qrvalue = this.dialogForm.wo_code + ';' + this.dialogForm.nextstepcode
      } else {
        this.qrForm.qrvalue = this.dialogForm.inbarcode
      }
      this.qrForm.startqty = this.dialogForm.startqty
      this.qrForm.wo_code = this.dialogForm.wo_code
      this.qrForm.partcode = this.dialogForm.partnumber
      this.qrForm.partname = this.dialogForm.partname
      this.qrForm.nextstepname = this.dialogForm.nextstepname
      this.qrForm.operator = username
      this.qrForm.operatorTime = handleDatetime2(new Date())
      this.$nextTick(() => {
        this.bindQRCode(this.qrForm.qrvalue)
      })
    },
    // 生成二维码
    bindQRCode(text) {
      new QRCode(this.$refs.qrCodeDiv2, {
        text: text,
        // width: 50,
        width: 60,
        // height: 50,
        height: 60,
        colorDark: '#000', // 二维码颜色
        colorLight: '#ffffff', // 二维码背景色
        correctLevel: QRCode.CorrectLevel.L// 容错率,L/M/H
      })
    },
    // 缺陷新增
    addDefect() {
      if (this.defectTableData.find(i => i.code.length === 0)) {