1.生产入库无源单提交测试OK   生产入库开发完成2.MES工单 流程单新增工单编码二维码
已修改3个文件
349 ■■■■■ 文件已修改
src/views/produceManager/produceStartOrder.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/produceManager/productWarehouse.vue 333 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/produceManager/workOrder.vue 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/produceManager/produceStartOrder.vue
@@ -2274,7 +2274,7 @@
            // 当为末道的时候
            if (this.dialogForm.nextstepcode === '') {
              const D = {
                rightcode: '2064',
                rightcode: '1078',
                partcode: this.dialogForm.partcode,
                qty: this.dialogForm.startqty,
                onelabqty: this.dialogForm.startqty
src/views/produceManager/productWarehouse.vue
@@ -141,6 +141,7 @@
                  v-model="form.saleOrderCode"
                  readonly
                  style="width: 200px"
                  @change="getProductInHouseOrderSearch"
                />
                <!--                disabled-->
              </el-form-item>
@@ -148,13 +149,13 @@
            <div style="display: flex">
              <el-form-item label="产品编码" style=" display: flex;">
                <el-input v-model="form.partcode" placeholder="请输入" style="width: 200px" />
                <el-input v-model="form.partcode" placeholder="请输入" style="width: 200px" @change="getProductInHouseOrderSearch" />
              </el-form-item>
              <el-form-item label="产品名称" style=" display: flex;">
                <el-input v-model="form.partname" style="width: 200px" placeholder="请输入" />
                <el-input v-model="form.partname" style="width: 200px" placeholder="请输入" @change="getProductInHouseOrderSearch" />
              </el-form-item>
              <el-form-item label="产品规格" style=" display: flex;">
                <el-input v-model="form.partspec" style="width: 200px" placeholder="请输入" />
                <el-input v-model="form.partspec" style="width: 200px" placeholder="请输入" @change="getProductInHouseOrderSearch" />
              </el-form-item>
              <el-form-item
                label="工单日期"
@@ -170,6 +171,7 @@
                  :clearable="false"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期"
                  @change="getProductInHouseOrderSearch"
                />
              </el-form-item>
            </div>
@@ -288,9 +290,9 @@
                  :header-cell-style="this.$headerCellStyle"
                  :cell-style="this.$cellStyle"
                  @selection-change="handleSelectionChange"
                  @cell-dblclick="cellDblclick"
                  @cell-click="cellClick"
                >
                  <!--                  @cell-dblclick="cellDblclick"-->
                  <!--                  @cell-click="cellClick"-->
                  <el-table-column
                    type="selection"
                    width="50"
@@ -447,17 +449,17 @@
                    label="序号"
                  />
                  <el-table-column
                    prop="stockname"
                    label="仓库"
                    width="110"
                  >
                    <template slot-scope="{row}">
                      <div v-if="row.stockname">{{ row.stockname }}</div>
                      <div v-else>/</div>
                    </template>
                  <!--                  <el-table-column-->
                  <!--                    prop="stockname"-->
                  <!--                    label="仓库"-->
                  <!--                    width="110"-->
                  <!--                  >-->
                  <!--                    <template slot-scope="{row}">-->
                  <!--                      <div v-if="row.stockname">{{ row.stockname }}</div>-->
                  <!--                      <div v-else>/</div>-->
                  <!--                    </template>-->
                  </el-table-column>
                  <!--                  </el-table-column>-->
                  <el-table-column
                    prop="inbarcode"
                    label="入库条码"
@@ -568,15 +570,15 @@
                    fixed
                    label="序号"
                  />
                  <el-table-column
                    prop="stockcode"
                    label="仓库"
                    width="110"
                  >
                    <template slot-scope="{row}">
                      <div>{{ stockcodeArr.find(i => i.code === row.stockcode).name }}</div>
                    </template>
                  </el-table-column>
                  <!--                  <el-table-column-->
                  <!--                    prop="stockcode"-->
                  <!--                    label="仓库"-->
                  <!--                    width="110"-->
                  <!--                  >-->
                  <!--                    <template slot-scope="{row}">-->
                  <!--                      <div>{{ stockcodeArr.find(i => i.code === row.stockcode).name }}</div>-->
                  <!--                    </template>-->
                  <!--                  </el-table-column>-->
                  <!--                    <template slot-scope="{row}">-->
                  <!--                      <div v-if="row.stockname">{{ row.stockname }}</div>-->
                  <!--                      <div v-else>/</div>-->
@@ -793,12 +795,16 @@
    documentTypeChange(val) {
      this.form.erpordercode = ''
      this.form.wkshopcode = ''
      this.reset()
    },
    // 生产车间改变
    async wkshopcodeChange(val) {
      this.form.erpordercode = ''
      this.form.mesordercode = ''
      this.form.saleOrderCode = ''
      this.tableDataDetail = []
      this.tableDataSummary = []
      this.multipleSelection = []
      const data = {
        ordertype: this.form.documentType,
        wkshopcode: val
@@ -857,6 +863,7 @@
      this.form.partname = ''
      this.form.partspec = ''
      this.form.orderdate = ''
      this.form.stockcode = ''
      this.tableDataDetail = []
      this.tableDataSummary = []
@@ -904,93 +911,114 @@
      //   this.$refs.tableDataRef.doLayout()
      // })
      const stockcodeArr = [...new Set(this.multipleSelection.map(i => i.stockcode))]// 数组去重
      // const stockcodeArr = [...new Set(this.multipleSelection.map(i => i.stockcode))]// 数组去重
      // const partcodeArr = [...new Set(this.multipleSelection.map(i => i.partcode))]// 数组去重
      const partcodeArr = [...new Set(this.multipleSelection.map(i => i.partcode))]// 数组去重
      const newData = []
      const Array2D = []
      // const Array2D = []
      //
      // stockcodeArr.forEach(i => {
      //   Array2D.push(this.multipleSelection.filter(j => j.stockcode === i))
      // })
      stockcodeArr.forEach(i => {
        Array2D.push(this.multipleSelection.filter(j => j.stockcode === i))
      })
      Array2D.forEach(k => {
        const partcodeArr = [...new Set(k.map(j => j.partcode))]
        partcodeArr.forEach(i => {
          const t = k.find(j => j.partcode === i)
          let sum = 0
          const good_qty = k.filter(j => j.partcode === i).map(j => parseFloat(j.good_qty)).reduce((pre, curr) => {
            sum = pre + curr
            return sum
          })
          sum = 0
          const inhouseqty = k.filter(j => j.partcode === i).map(j => parseFloat(j.inhouseqty)).reduce((pre, curr) => {
            sum = pre + curr
            return sum
          })
          sum = 0
          const stinhouseqty = k.filter(j => j.partcode === i).map(j => parseFloat(j.stinhouseqty)).reduce((pre, curr) => {
            sum = pre + curr
            return sum
          })
          newData.push(
            {
              stockcode: t.stockcode,
              partcode: t.partcode,
              partname: t.partname,
              partspec: t.partspec,
              qty: t.qty,
              good_qty,
              inhouseqty,
              stinhouseqty,
              unitid: t.unitid,
              unitname: t.unitname,
              sourceVoucherDetailId: t.sbid,
              saleOrderDetailId: t.saleOrderDetailId,
              ManufactureOrderDetailId: t.sbid,
              stck_id: this.stockcodeArr.find(i => i.code === t.stockcode).id,
              SourceVoucherDetailIdByMergedFlow: t.sbid,
              materiel_code: t.partcode,
              warehouse: t.stockcode,
              materiel_id: t.materiel_id
            }
          )
        })
      })
      // Array2D.forEach(k => {
      //   const partcodeArr = [...new Set(k.map(j => j.partcode))]
      //   partcodeArr.forEach(i => {
      //     const t = k.find(j => j.partcode === i)
      //     let sum = 0
      //     const good_qty = k.filter(j => j.partcode === i).map(j => parseFloat(j.good_qty)).reduce((pre, curr) => {
      //       sum = pre + curr
      //       return sum
      //     })
      //     sum = 0
      //     const inhouseqty = k.filter(j => j.partcode === i).map(j => parseFloat(j.inhouseqty)).reduce((pre, curr) => {
      //       sum = pre + curr
      //       return sum
      //     })
      //     sum = 0
      //     const stinhouseqty = k.filter(j => j.partcode === i).map(j => parseFloat(j.stinhouseqty)).reduce((pre, curr) => {
      //       sum = pre + curr
      //       return sum
      //     })
      //     newData.push(
      //       {
      //         stockcode: t.stockcode,
      //         partcode: t.partcode,
      //         partname: t.partname,
      //         partspec: t.partspec,
      //         qty: t.qty,
      //         good_qty,
      //         inhouseqty,
      //         stinhouseqty,
      //         unitid: t.unitid,
      //         unitname: t.unitname,
      //         sourceVoucherDetailId: t.sbid,
      //         saleOrderDetailId: t.saleOrderDetailId,
      //         ManufactureOrderDetailId: t.sbid,
      //         stck_id: this.stockcodeArr.find(i => i.code === t.stockcode).id,
      //         SourceVoucherDetailIdByMergedFlow: t.sbid,
      //         materiel_code: t.partcode,
      //         warehouse: t.stockcode,
      //         materiel_id: t.materiel_id
      //       }
      //     )
      //   })
      // })
      // console.log(Array2D, 'Array2D')
      // console.log(newData, 'newData')
      // partcodeArr.forEach(i => {
      //   const t = this.multipleSelection.find(j => j.partcode === i)
      //   let sum = 0
      //   const good_qty = this.multipleSelection.filter(j => j.partcode === i).map(j => parseFloat(j.good_qty)).reduce((pre, curr) => {
      //     sum = pre + curr
      //     return sum
      //   })
      //   sum = 0
      //   const inhouseqty = this.multipleSelection.filter(j => j.partcode === i).map(j => parseFloat(j.inhouseqty)).reduce((pre, curr) => {
      //     sum = pre + curr
      //     return sum
      //   })
      //   sum = 0
      //   const stinhouseqty = this.multipleSelection.filter(j => j.partcode === i).map(j => parseFloat(j.stinhouseqty)).reduce((pre, curr) => {
      //     sum = pre + curr
      //     return sum
      //   })
      //   newData.push(
      //     {
      //       partcode: i,
      //       partname: t.partname,
      //       partspec: t.partspec,
      //       qty: t.qty,
      //       good_qty,
      //       inhouseqty,
      //       stinhouseqty
      //     }
      //   )
      // })
      this.tableDataSummary = newData.flat()
      partcodeArr.forEach(i => {
        const t = this.multipleSelection.find(j => j.partcode === i)
        let sum = 0
        const good_qty = this.multipleSelection.filter(j => j.partcode === i).map(j => parseFloat(j.good_qty)).reduce((pre, curr) => {
          sum = pre + curr
          return sum
        })
        sum = 0
        const inhouseqty = this.multipleSelection.filter(j => j.partcode === i).map(j => parseFloat(j.inhouseqty)).reduce((pre, curr) => {
          sum = pre + curr
          return sum
        })
        sum = 0
        const stinhouseqty = this.multipleSelection.filter(j => j.partcode === i).map(j => parseFloat(j.stinhouseqty)).reduce((pre, curr) => {
          sum = pre + curr
          return sum
        })
        newData.push(
          {
            // partcode: i,
            // partname: t.partname,
            // partspec: t.partspec,
            // qty: t.qty,
            // good_qty,
            // inhouseqty,
            // stinhouseqty
            stockcode: t.stockcode,
            partcode: t.partcode,
            partname: t.partname,
            partspec: t.partspec,
            qty: t.qty,
            good_qty,
            inhouseqty,
            stinhouseqty,
            unitid: t.unitid,
            unitname: t.unitname,
            sourceVoucherDetailId: t.sbid,
            saleOrderDetailId: t.saleOrderDetailId,
            ManufactureOrderDetailId: t.sbid,
            stck_id: t.stockcode ? this.stockcodeArr.find(i => i.code === t.stockcode).id : '/',
            SourceVoucherDetailIdByMergedFlow: t.sbid,
            materiel_code: t.partcode,
            warehouse: t.stockcode,
            materiel_id: t.materiel_id
          }
        )
      })
      // this.tableDataSummary = newData.flat()
      this.tableDataSummary = newData
    },
    async submit() {
@@ -1000,12 +1028,13 @@
      if (this.multipleSelection.length === 0) {
        return this.$message.error('未选择产品!')
      }
      await this.tabClick()
      const openToken = await getTPlusToken() // 获取TPlus   token
      // const openToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJpc3YiLCJpc3MiOiJjaGFuamV0IiwidXNlcklkIjoiMzkwNTU0MDg2NTMwMjYxIiwib3JnSWQiOiIxMjM0OTc5MDE3MjIxMDM3IiwiYWNjZXNzX3Rva2VuIjoiYmstOGIwNDUxNzEtMDk5Yy00ODFlLTgyZDEtY2Q5NWQ2MjUzZGUwIiwiYXVkIjoiaXN2IiwibmJmIjoxNjg2MDQ3NTgyLCJhcHBJZCI6IjU4Iiwic2NvcGUiOiJhdXRoX2FsbCIsImlkIjoiNjA5Y2ZhYzItNzZmOC00NzJiLWI2NGEtMDg1NmRjMWZmYTg4IiwiZXhwIjoxNjg2NTY1OTgyLCJpYXQiOjE2ODYwNDc1ODIsIm9yZ0FjY291bnQiOiJ1dXhicGtzbTBibmgifQ.slZ_ix3DoGBX2WUX1TOiwe7jCEqDHf9Kc-Gn6cVCFZk'
      this.$store.state.app.buttonIsDisabled = true
      await this.tabClick()
      const openToken = await getTPlusToken() // 获取TPlus   token
      // const openToken =
      // 有源单
      if (this.form.documentType === 'Y') {
        const RDRecordDetails = []
@@ -1204,8 +1233,92 @@
        )
        if (res.data === null) {
          this.$message.success('入库成功!')
          this.$store.state.app.buttonIsDisabled = false
          this.multipleSelection.forEach(i => {
            i.stockname = this.stockcodeArr.find(j => j.code === i.stockcode).name
            i.id = this.stockcodeArr.find(j => j.code === i.stockcode).id
          })
          const head = {
            rightcode: '2064',
            hbillno: this.form.hbillno,
            incbit: this.form.incbit,
            wkshpcode: this.form.wkshopcode,
            sourceVoucherId: this.form.documentType === 'Y' ? this.tableDataDetail[0].mpoid : this.tableDataDetail[0].wo_id, // 下午把这个参数加上
            sourceVoucherCode: this.form.documentType === 'Y' ? this.tableDataDetail[0].m_po : this.tableDataDetail[0].wo_code,
            saleOrderId: this.tableDataDetail[0].saleOrderid,
            saleOrderCode: this.tableDataDetail[0].saleOrderCode,
            rdDirectionFlag: 1,
            makerid: this.userArr.find(i => i.name === getCookie('username')).id,
            maker: getCookie('username'),
            accountingyear: new Date().getFullYear(),
            VoucherYear: new Date().getFullYear(),
            VoucherPeriod: new Date().getMonth() + 1,
            ManufactureOrderCode: this.form.documentType === 'Y' ? this.tableDataDetail[0].m_po : this.tableDataDetail[0].wo_code,
            idbusitype: '03',
            iddepartment: this.WorkShopArr.find(i => i.code === this.form.wkshopcode).id,
            idrdstyle: 21,
            idwarehouse: '',
            voucherState: 181,
            idvouchertype: 15,
            voucherdate: handleDatetime(new Date().getTime()),
            madedate: handleDatetime(new Date().getTime()),
            createdtime: handleDatetime2(new Date().getTime()),
            DataSource: '56133',
            idsourcevouchertype: 69
          }
          const subsum = []
          this.tableDataSummary.forEach((i, index) => {
            subsum.push({
              code: index.toString().padStart(4, '0'),
              rownumber: index + 1,
              arrivalQuantity: i.qty,
              quantity: i.stinhouseqty,
              compositionQuantity: i.stinhouseqty + i.unitname,
              baseQuantity: i.stinhouseqty,
              sourceVoucherId: this.form.documentType === 'Y' ? this.tableDataDetail[0].mpoid : '',
              // sourceVoucherCode: this.form.documentType === 'Y' ? this.tableDataDetail[0].m_po : this.tableDataDetail[0].wo_code,
              sourceVoucherCode: '',
              sourceVoucherDetailId: i.sourceVoucherDetailId,
              idsourcevouchertype: 69,
              saleOrderId: this.tableDataDetail[0].saleOrderid,
              saleOrderCode: this.tableDataDetail[0].saleOrderCode,
              saleOrderDetailId: i.saleOrderDetailId,
              ManufactureOrderId: this.form.documentType === 'Y' ? this.tableDataDetail[0].mpoid : '',
              ManufactureOrderCode: this.form.documentType === 'Y' ? this.tableDataDetail[0].m_po : this.tableDataDetail[0].wo_code,
              ManufactureOrderDetailId: i.ManufactureOrderDetailId,
              idbusiTypeByMergedFlow: 3,
              idinventory: i.materiel_id,
              idbaseunit: i.unitid,
              idunit: i.unitid,
              idwarehouse: i.stck_id,
              SourceVoucherIdByMergedFlow: this.tableDataDetail[0].mpoid,
              SourceVoucherCodeByMergedFlow: this.tableDataDetail[0].m_po,
              SourceVoucherDetailIdByMergedFlow: i.SourceVoucherDetailIdByMergedFlow,
              idsourceVoucherTypeByMergedFlow: 69,
              createdtime: handleDatetime2(new Date().getTime()),
              DataSource: '56133',
              materiel_code: i.materiel_code,
              warehouse: i.warehouse
            })
          })
          const data = {
            head, sub: this.multipleSelection, subsum
          }
          console.log(data, 2)
          const r1 = await ProductInHouseOrderSeave(data)
          if (r1.code === '200') {
            this.$message.success('入库成功!')
            this.$store.state.app.buttonIsDisabled = false
            await this.getProductInHouseOrderCodeSearch()
            await this.wkshopcodeChange(this.form.wkshopcode)
            this.tableDataDetail = []
            this.tableDataSummary = []
            this.multipleSelection = []
            this.form.stockcode = ''
            this.$store.state.app.buttonIsDisabled = false
          }
        } else {
          this.$message.error('入库失败!')
          this.$store.state.app.buttonIsDisabled = false
src/views/produceManager/workOrder.vue
@@ -557,7 +557,7 @@
        </el-form-item>
        <el-form-item
          v-if="operation==='add'"
          label="产品名称"
          label="产品名称/编码"
          prop="partcode"
        >
          <el-select
@@ -572,7 +572,7 @@
            <el-option
              v-for="item in partArr"
              :key="item.partcode"
              :label="item.partname"
              :label="item.partname+'/'+item.partcode"
              :value="item.partcode"
            />
          </el-select>
@@ -1278,13 +1278,13 @@
          </div>
          <div
            id="qrCode"
            style="width: 22%;height:97px;
            style="width: 22%;height:90px;
            margin-top: 20px;
            overflow-y: scroll;display: flex;
            justify-content: center;
            position: relative;"
          >
            <!--            <div id="qrCode0" ref="qrCodeDiv0" />-->
            <div id="qrCode0" ref="qrCodeDiv0" />
          </div>
          <div style="background-color: #fff;width: 20px;height:120px; position: absolute;right: 0" />
          <div
@@ -2673,12 +2673,12 @@
            res3.forEach(i => {
              this.bindQRCode(i.seq, i.stepqrcode, 'small')
            })
            // this.bindQRCode('0', this.formApprove.mesordercode, 'big')
            this.bindQRCode('0', this.formApprove.mesordercode, 'big')
            const div = document.getElementById('qrCode')
            // 这么多代码只需要这一句实现我们所需要的功能,定位div滚动条位置在底部,scrollHeight计算出div的高度,再scrollTop 设置滚动条的高度为多少
            // div.scrollTop = div.scrollHeight // 滚动条位于最底部
            div.scrollTop = 0 // 滚动条位于最顶部
            div.scrollTop = div.scrollHeight // 滚动条位于最底部
            // div.scrollTop = 0 // 滚动条位于最顶部
          })
          this.dialogVisibleApprove = true
        }