小小儁爺
2024-10-29 642ae743bc6009e4ae95e6e47831396ba54bcde7
src/views/produce/stepReport.vue
@@ -883,8 +883,14 @@
  EditOrderNgStepSeave,
  MesOrderNgStepSearch,
  MesOrderNgSubStepSearch,
  MesOrderStepSearch, MesOrderStepStart,
  MesOrderWxStepSearch, SavaMesOrderStepIn, SavaMesOrderStepOut, SavaMesOrderStepReport
  MesOrderStepSearch,
  MesOrderStepStart,
  MesOrderWxStepSearch,
  ProductInHouseOrderCodeSearch,
  ProductInHouseOrderSeave,
  SavaMesOrderStepIn,
  SavaMesOrderStepOut,
  SavaMesOrderStepReport
} from '@/api/WorkOrder'
import {
  CustomerPermissions,
@@ -897,8 +903,9 @@
import { nanoid } from 'nanoid'
import { LabelBarCode } from '@/api/systemSetting'
import { getCookie } from '@/utils/auth'
import { handleDatetime2 } from '@/utils/global'
import { handleDatetime, handleDatetime2 } from '@/utils/global'
import QRCode from 'qrcodejs2'
export default {
  name: 'StepReport',
  components: {
@@ -1050,10 +1057,14 @@
          console.log('执行了打印')
        }
      },
      xx: ''
      rowData: {}
    }
  },
  activated() {   window.addEventListener('resize', this.getHeight)   this.getHeight() }, created() {
  activated() {
    window.addEventListener('resize', this.getHeight)
    this.getHeight()
  },
  created() {
  },
  mounted() {
@@ -1169,9 +1180,11 @@
    // 报工
    report(row) {
      if (row) {
        this.rowData = row
        this.getMesOrderStepStart('ZZ', '', row.wo_code, row.stepcode)
      } else {
        const temp = this.tableData.find(i => i.id === this.radioSelected)
        this.rowData = temp
        this.getMesOrderStepStart('ZZ', '', temp.wo_code, temp.stepcode)
      }
    },
@@ -1187,9 +1200,11 @@
    // 收料
    takeIn(row) {
      if (row) {
        this.rowData = row
        this.getMesOrderStepStart('WX', 'IN', row.wo_code, row.stepcode)
      } else {
        const temp = this.tableData.find(i => i.id === this.radioSelected)
        this.rowData = temp
        this.getMesOrderStepStart('WX', 'IN', temp.wo_code, temp.stepcode)
      }
    },
@@ -1394,6 +1409,11 @@
            const res = await SavaMesOrderStepReport(data)
            if (res.code === '200') {
              this.$notify.success('报工成功!')
              if (this.rowData.isend === 'Y') {
                await this.handleProductInHouseOrderSeave('B', inbarcode)
              }
              // await this.search()
              await this.tabClick()
              this.$store.state.app.buttonIsDisabled = false
@@ -1503,6 +1523,9 @@
            const res = await SavaMesOrderStepIn(data)
            if (res.code === '200') {
              this.$notify.success('收料成功!')
              if (this.rowData.isend === 'Y') {
                await this.handleProductInHouseOrderSeave('S', inbarcode)
              }
              // await this.search()
              await this.tabClick()
              this.$store.state.app.buttonIsDisabled = false
@@ -1553,6 +1576,56 @@
      // this.$refs.qrCodeDiv2 = ''
    },
    async handleProductInHouseOrderSeave(type, inbarcode) {
      const { data: res2 } = await ProductInHouseOrderCodeSearch({ rightcode: '0604' })
      const TableDetailData = []
      TableDetailData.push({
        'hbillno': res2[0], // 入库单号
        'rownumber': this.rowData.sbid.toString(), // 行号
        'inbarcode': inbarcode, // 入库条码
        'mo_id': this.rowData.sbid.toString(), // 订单id(行号)
        'mo_no': this.rowData.m_po, // 订单号
        'wocode': this.rowData.wo_code, // 工单号
        'partcode': this.rowData.partcode, // 产品编码
        'unitcode': this.rowData.unitcode, // 单位编码
        'unit_rate': '1', // 单位换算率
        'stockcode': this.rowData.stockcode, // 仓库编码
        'qty': type === 'B' ? this.dialogForm.startqty.toString() : this.dialogForm.sqty.toString(), // 入库数量
        'price': '0', // 入库单价
        'saleid': this.rowData.saleOrderDetailId.toString(), // 销售单id(行号)
        'salecode': this.rowData.saleOrderCode, // 销售单号
        'status': '0', // 入库单状态:0(未审核) 1(已审核)
        'stepcode': this.rowData.stepcode, // 工序编码
        'style': type// 报工类型:B(自制) S(外协)
      })
      const data = {
        'rightcode': '0604', // 功能编号
        'incbit': res2[1], // 流水号
        'TableData': [
          [
            {
              'hbillno': res2[0], // 入库单号
              'hbdate': handleDatetime(new Date()),
              'deptno': this.rowData.dept_code, // 入库部门
              'storehouse_code': this.rowData.stockcode, // 仓库编码
              'status': '0', // 入库单状态:0(未审核) 1(已审核)
              'remark': '', // 备注
              'create_user': localStorage.getItem('username'), // 创建人员
              'create_date': handleDatetime2(new Date()),
              'check_user': '', // 审核人员
              'check_date': ''// 审核时间
            }
          ],
          TableDetailData// 表体
        ]
      }
      await ProductInHouseOrderSeave(data)
    },
    ZZprint2(username) {
      if (this.dialogForm.nextstepcode !== '') {
        this.qrForm.qrvalue = this.dialogForm.wo_code + ';' + this.dialogForm.nextstepcode