小小儁爺
2025-10-31 b195295f2007d52f4a22e679f8ca591b042de27a
1.生产入库、入库记录开发
已修改7个文件
1369 ■■■■ 文件已修改
src/api/ReportManager.js 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/WorkOrder.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/produce/productWarehouse.vue 464 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/produce/warehouseRecord.vue 843 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/workOrder/produceOrderList.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vue.config.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/ReportManager.js
@@ -18,6 +18,42 @@
  })
}
// 入库记录导出
export function StorageRecordExcelSearch(data) {
  return request({
    url: 'ReportManager/StorageRecordExcelSearch',
    method: 'get',
    params: data
  })
}
// 入库记录表头
export function InStorageRecordMainSearch(data) {
  return request({
    url: 'ReportManager/InStorageRecordMainSearch',
    method: 'get',
    params: data
  })
}
// 入库记录表体
export function InStorageRecordSubSearch(data) {
  return request({
    url: 'ReportManager/InStorageRecordSubSearch',
    method: 'get',
    params: data
  })
}
// 入库记录删除
export function DeleteMesInStorageRecord(data) {
  return request({
    url: 'ReportManager/DeleteMesInStorageRecord',
    method: 'post',
    data
  })
}
// 班组工资报表记录查询
export function GroupSalaryReportSearch(data) {
  return request({
src/api/WorkOrder.js
@@ -341,6 +341,15 @@
  })
}
// MES生产入库提交-存储过程版
export function InHouseOrderSpSeave(data) {
  return request({
    url: 'WorkOrder/InHouseOrderSpSeave',
    method: 'post',
    data
  })
}
// 生产入库获取部门信息
export function DeptSelectData() {
  return request({
src/main.js
@@ -44,8 +44,8 @@
Vue.prototype.$cellStyle = cellStyle() // 设置全局表体样式
Vue.prototype.$chanjetBaseUrl = 'https://openapi.chanjet.com'
Vue.prototype.$AppKey = 'Umm1gS5q'
Vue.prototype.$AppSecret = 'FFAD54C4FBF9AAF1AFA33BBF3DF52752'
Vue.prototype.$AppKey = 'MDth6eg6'
Vue.prototype.$AppSecret = '53C1F41C9D8D8E21C72944D884ADF78F'
// import 'lib-flexible' // 阿里可伸缩布局方案
// import 'lib-flexible-computer'
src/views/produce/productWarehouse.vue
@@ -32,6 +32,21 @@
        >
          <div class="elForm" style="display: flex;flex-direction: column;justify-content: flex-start">
            <div style="display: flex">
              <el-form-item label="单据类型" required style=" display: flex;">
                <el-select
                  v-model="form.issouceorder"
                  :popper-append-to-body="false"
                  :style="{minWidth:'100px',width:formItemWidth+'px'}"
                  placeholder="请选择"
                >
                  <el-option
                    v-for="item in issouceorderTypeArr"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  />
                </el-select>
              </el-form-item>
              <el-form-item label="生产车间" required style=" display: flex;">
                <el-select
                  v-model="form.wkshopcode"
@@ -69,6 +84,10 @@
                  :style="{minWidth:'100px',width:formItemWidth+'px'}"
                />
              </el-form-item>
            </div>
            <div style="display: flex">
              <el-form-item
                label="销售订单"
                style="display: flex;"
@@ -79,17 +98,26 @@
                  :style="{minWidth:'100px',width:formItemWidth+'px'}"
                />
              </el-form-item>
            </div>
            <div style="display: flex">
              <el-form-item label="产品编码" style=" display: flex;">
                <el-input v-model="form.partcode" placeholder="请输入" :style="{minWidth:'100px',width:formItemWidth+'px'}" />
                <el-input
                  v-model="form.partcode"
                  placeholder="请输入"
                  :style="{minWidth:'100px',width:formItemWidth+'px'}"
                />
              </el-form-item>
              <el-form-item label="产品名称" style=" display: flex;">
                <el-input v-model="form.partname" :style="{minWidth:'100px',width:formItemWidth+'px'}" placeholder="请输入" />
                <el-input
                  v-model="form.partname"
                  :style="{minWidth:'100px',width:formItemWidth+'px'}"
                  placeholder="请输入"
                />
              </el-form-item>
              <el-form-item label="产品规格" style=" display: flex;">
                <el-input v-model="form.partspec" :style="{minWidth:'100px',width:formItemWidth+'px'}" placeholder="请输入" />
                <el-input
                  v-model="form.partspec"
                  :style="{minWidth:'100px',width:formItemWidth+'px'}"
                  placeholder="请输入"
                />
              </el-form-item>
            </div>
@@ -221,30 +249,15 @@
                  highlight-current-row
                  :header-cell-style="this.$headerCellStyle"
                  :cell-style="this.$cellStyle"
                  @row-click="rowClick"
                  @selection-change="handleSelectionChange"
                >
                  <!--                  @selection-change="handleSelectionChange"-->
                  <!--                  @cell-dblclick="cellDblclick"-->
                  <!--                  @cell-click="cellClick"-->
                  <!--                  <el-table-column-->
                  <!--                    type="selection"-->
                  <!--                    width="50"-->
                  <!--                    fixed-->
                  <!--                  />-->
                  <el-table-column
                    type="selection"
                    width="50"
                    fixed
                  >
                    <template slot-scope="{row}">
                      <el-radio
                        v-model="radioSelected"
                        :label="row.sbid"
                        style="color: transparent;padding-left: 10px;"
                      />
                    </template>
                  </el-table-column>
                  />
                  <el-table-column
                    type="index"
                    width="50"
@@ -585,8 +598,10 @@
import { PrentOrganizationNoCompany, WareHouse } from '@/api/GeneralBasicData'
import {
  DeptSelectData,
  ProductInHouseOrderCodeSearch,
  ProductInHouseOrderSearch, TProductInHouseOrderSpSeave
  ProductInHouseOrderSearch,
  InHouseOrderSpSeave
} from '@/api/WorkOrder'
import { TSecLocaTree } from '@/api/basicSettings'
import { getTPlusToken, handleDatetime, handleDatetime2 } from '@/utils/global'
@@ -613,6 +628,8 @@
        partname: '', // 产品名称
        partspec: '', // 规格型号
        issouceorder: 'Y', // 是否有源单
        deptno: '', // 入库部门
        saleOrderCode: '', // 销售订单
        stockcode: '' // 入库仓库
@@ -633,26 +650,33 @@
      buttonSize: '',
      formItemWidth: 0,
      radioSelected: ''
      issouceorderTypeArr: [
        { value: 'Y', label: '有源单' },
        { value: 'N', label: '无源单' }
      ]
    }
  },
  watch: {},
  created() {
  },
  mounted() {
  async mounted() {
    window.addEventListener('resize', this.getHeight)
    this.getHeight()
    this.getPrentOrganizationNoCompany()
    this.getTSecLocaTree()
    this.getProductInHouseOrderCodeSearch()
    await this.getPrentOrganizationNoCompany()
    await this.getTSecLocaTree()
    await this.getProductInHouseOrderCodeSearch()
    // this.getDeptSelectData()
    // this.getProductInHouseOrderSearch()
  },
  methods: {
    // 获取入库部门
    async getDeptSelectData() {
      const { data: res } = await DeptSelectData()
      this.departmentArr = res
    },
    // 获取单据编号(入库单号)、流水号
    async getProductInHouseOrderCodeSearch() {
      const { data: res } = await ProductInHouseOrderCodeSearch({ rightcode: '0604' })
@@ -677,6 +701,7 @@
        return this.$message.info('生产车间不能为空!')
      }
      const data = {
        issouceorder: this.form.issouceorder,
        saleordercode: this.form.saleordercode, // 销售单号
        wkshopcode: this.form.wkshopcode, // 生产车间
        erpordercode: this.form.erpordercode, // 订单编号
@@ -710,98 +735,8 @@
    handleSelectionChange(val) {
      this.multipleSelection = val
    },
    //  行点击事件
    async rowClick(row, event, column) {
      this.radioSelected = row.sbid
      // const { data: res } = await SearchWorkStep({ wo_code: row.wo_code })
      // this.tableDataDetail = res
    },
    // 递交
    async  submit() {
      if (this.form.stockcode === '') {
        return this.$message.info('入库仓库不能为空!')
      }
      const openToken = await getTPlusToken() // 获取TPlus   token
      const obj = this.tableDataDetail.find(i => i.sbid === this.radioSelected)
      // 无源单
      if (!obj.saleOrderCode) {
        // const RDRecordDetails = []
        // this.tableDataSummary.forEach((i, index) => {
        //   RDRecordDetails.push({
        //     Code: index + 1, // 行号,从1开始自增长
        //     Inventory: {
        //       Code: i.materiel_code // 存货编码
        //     },
        //     BaseQuantity: i.stinhouseqty, // 主计量单位数量
        //     SNObject: {
        //       SnAccountDetails: [
        //         {
        //           SNCode: index.toString().padStart(4, '0')
        //         }
        //       ]
        //     }
        //   })
        // })
        const data = {
          'dto': {
            'IsModifiedCode': true,
            'ExternalCode': this.form.hbillno,
            'Code': this.form.hbillno,
            'VoucherType': {
              'Code': 'ST1002'
            },
            'VoucherDate': handleDatetime(new Date().getTime()),
            'BusiType': {
              'Code': '03'
            },
            'Warehouse': {
              'Code': this.form.stockcode
            },
            // 'Department': {
            //   'Code': this.form.wkshopcode,
            //   'Name': this.WorkShopArr.find(i => i.code === this.form.wkshopcode).name
            // },
            'RDRecordDetails': [
              {
                Code: 1, // 行号,从1开始自增长
                Inventory: {
                  Code: obj.partcode // 存货编码
                },
                BaseQuantity: obj.stinhouseqty, // 主计量单位数量
                SNObject: {
                  SnAccountDetails: [
                    {
                      // SNCode: index.toString().padStart(4, '0')
                      SNCode: '0001'
                    }
                  ]
                }
              }
            ]
          }
        }
        console.log(JSON.parse(JSON.stringify(data)))
        const res = await axios.post(Vue.prototype.$chanjetBaseUrl + '/tplus/api/v2/productReceive/Create',
          data, {
            headers: {
              'openToken': openToken,
              'appKey': Vue.prototype.$AppKey,
              'appSecret': Vue.prototype.$AppSecret,
              'Content-Type': 'application/json'
            }
          }
        )
        console.log(res)
        console.log(res.status)
      }
    },
    // 递交
    async  submitBack() {
    async submit() {
      // usercode
      // console.log(localStorage.getItem('username'))
@@ -814,81 +749,218 @@
      if (this.multipleSelection.find(i => i.stockid === '' || i.stockid === null)) {
        return this.$message.info('表格内入库仓库不能为空!')
      }
      const TableDetailData = []
      this.multipleSelection.forEach((i, index) => {
        TableDetailData.push({
          'hbillno': this.form.hbillno, // 入库单号
          'wocode': i.wo_code, // 工单号
          'rownumber': (index + 1).toString(), // 行号
          'sourceVoucherId': i.mpoid.toString(), // 来源单据id
          'sourceVoucherCode': i.m_po, // 来源单据编号
          'SourceVoucherDetailId': i.sbid.toString(), // 来源单据明细id
          'inbarcode': i.inbarcode, // 入库条码
          'idinventory': i.materiel_id.toString(), // 存货id
          'inventorycode': i.partcode, // 存货编码
          'idunit': i.unitid.toString(), // 计量单位id
          'unitcode': i.unitcode, // 计量单位编码
          idwarehouse: i.stockid.toString(), // 仓库id
          warehousecode: i.stockcode, // 仓库编码
          'saleOrderId': i.saleOrderid.toString(), // 销售单id
          'saleOrderCode': i.saleOrderCode, // 销售单号
          'saleOrderDetailId': i.saleOrderDetailId.toString(), // 销售单明细id
          'qty': i.good_qty.toString(), // 入库数量
          'stepcode': i.step_code, // 工序编码
          'style': i.style, // 报工类型:B(自制) S(外协)
          'status': '0' // 入库单状态:0(未审核) 1(已审核)
        })
      })
      const data = {
        'rightcode': '0604', // 功能编号
        'incbit': this.form.incbit, // 流水号
        'TableData': [
          [
            {
              'hbillno': this.form.hbillno, // 入库单号
              'madedate': handleDatetime(this.form.hbdate) + ' 00:00:00', // 制单日期(年月日 00:00:00)
              'hbdate': this.multipleSelection[this.multipleSelection.length - 1].voucherdate,
              sourceVoucherId: [...new Set(this.multipleSelection.map(i => i.mpoid))].length > 1 ? '' : this.multipleSelection[0].mpoid,
              sourceVoucherCode: [...new Set(this.multipleSelection.map(i => i.m_po))].length > 1 ? '' : this.multipleSelection[0].m_po,
              saleOrderCode: [...new Set(this.multipleSelection.map(i => i.saleOrderCode))].length > 1 ? '' : this.multipleSelection[0].saleOrderCode,
              'iddepartment': this.multipleSelection[0].dept_id, // 部门id
              'departmentcode': this.multipleSelection[0].dept_code, // 部门编码
              'idwarehouse': this.stockcodeArr.find(i => i.code === this.form.stockcode).noid, // 仓库id
              'warehousecode': this.form.stockcode, // 仓库编码
              'status': '0', // 入库单状态:0(未审核) 1(已审核)
              PurchaseOrderCode: '', // 采购订单号
              'remark': '', // 备注
              'create_user': localStorage.getItem('username'), // 创建人员
              'create_date': handleDatetime2(new Date()),
              'check_user': '', // 审核人员
              'check_date': ''// 审核时间
            }
          ],
          TableDetailData// 表体
        ]
      }
      // console.log(JSON.stringify(data))
      this.$store.state.app.buttonIsDisabled = true
      const res = await TProductInHouseOrderSpSeave(data)
      this.$store.state.app.buttonIsDisabled = false
      if (res.code === '200') {
        this.$message.success('入库成功!')
        this.multipleSelection = []
        // this.form.deptno = ''
        // this.form.stockcode = ''
        this.reset()
        // await this.getProductInHouseOrderSearch()
        await this.getProductInHouseOrderCodeSearch()
      const openToken = await getTPlusToken() // 获取TPlus   token
      // console.log(openToken)
      let res
      const a = 1
      if (openToken) {
        if (a === 2) {
          const RDRecordDetails = []
          this.multipleSelection.forEach((i, index) => {
            RDRecordDetails.push({
              Code: index + 1, // 行号,从1开始自增长
              Warehouse: {
                Code: i.stockcode
              },
              Inventory: {
                Code: i.partcode // 存货编码
              },
              BaseQuantity: i.stinhouseqty // 主计量单位数量
              // SNObject: {
              //   SnAccountDetails: [
              //     {
              //       SNCode: '00001'
              //     },
              //     {
              //       SNCode: '00002'
              //     }
              //   ]
              // }
            })
          })
          const D1 = {
            'dto': {
              'IsModifiedCode': true,
              'ExternalCode': this.form.hbillno,
              'Code': this.form.hbillno,
              'VoucherType': {
                'Code': 'ST1002'
              },
              'VoucherDate': handleDatetime(new Date().getTime()),
              'BusiType': {
                'Code': '03'
              },
              'Warehouse': {
                'Code': this.form.stockcode
              },
              'Department': {
                'Code': this.form.wkshopcode,
                'Name': this.WorkShopArr.find(i => i.torg_code === this.form.wkshopcode).torg_name
              },
              'RDRecordDetails': RDRecordDetails
            }
          }
          res = await axios.post(Vue.prototype.$chanjetBaseUrl + '/tplus/api/v2/productReceive/Create',
            D1, {
              headers: {
                'openToken': openToken,
                'appKey': Vue.prototype.$AppKey,
                'appSecret': Vue.prototype.$AppSecret,
                'Content-Type': 'application/json'
              }
            }
          )
        }
        // 目前都执行的这个
        if (a === 1) {
          const RDRecordDetails = []
          this.multipleSelection.forEach((i, index) => {
            RDRecordDetails.push({
              Code: index + 1, // 行号,从1开始自增长
              SourceVoucherId: i.mpoid ? i.mpoid : '', // 来源单据的单据ID
              BaseQuantity: i.stinhouseqty, // 主计量单位数量
              // SourceVoucherDetailId: i.sourceVoucherDetailId, // 来源单据的对应明细ID
              SourceVoucherDetailId: i.sbid ? i.sbid : '', // 来源单据的对应明细ID
              Inventory: {
                Code: i.partcode // 存货编码
              },
              IdSourceVoucherType: i.sbid ? 69 : ''
            })
          })
          const D2 = {
            'dto': {
              'Warehouse': {
                'Code': this.form.stockcode// 仓库编码
              },
              'Code': this.form.hbillno, // 单据编码
              'IsModifiedCode': true,
              'BusiType': {
                'Code': '03'// 业务类型编码
              },
              'Department': {
                'Code': this.form.wkshopcode// 部门编码
              },
              'VoucherDate': handleDatetime(new Date().getTime()), // 单据日期
              'RdStyle': {
                'Code': '21'// 出库类别编码
              },
              'RDRecordDetails': RDRecordDetails,
              // 'Clerk': {
              //   'Code': this.userArr.find(i => i.name === getCookie('username')).code // 业务员code
              //   // 'Code': '001' // 业务员code
              //   // 'Name': getCookie('username')
              // },
              'ExternalCode': this.form.hbillno,
              'VoucherType': {
                'Code': 'ST1002'
              }
            }
          }
          res = await axios.post(Vue.prototype.$chanjetBaseUrl + '/tplus/api/v2/ProductReceiveOpenApi/Create',
            D2, {
              headers: {
                'openToken': openToken,
                'appKey': Vue.prototype.$AppKey,
                'appSecret': Vue.prototype.$AppSecret,
                'Content-Type': 'application/json'
              }
            }
          )
        }
        // console.log(res)
        // console.log(res.data.code)
        // || res.data === null
        if (res.data.code === 0) {
          const TableDetailData = []
          this.multipleSelection.forEach((i, index) => {
            TableDetailData.push({
              'hbillno': this.form.hbillno, // 入库单号
              'wocode': i.wo_code, // 工单号
              'rownumber': (index + 1).toString(), // 行号
              'sourceVoucherId': i.mpoid ? i.mpoid.toString() : '', // 来源单据id
              'sourceVoucherCode': i.m_po, // 来源单据编号
              'SourceVoucherDetailId': i.sbid ? i.sbid.toString() : '', // 来源单据明细id
              'inbarcode': i.inbarcode, // 入库条码
              'idinventory': i.materiel_id ? i.materiel_id.toString() : '', // 存货id
              'inventorycode': i.partcode, // 存货编码
              'idunit': i.unitid ? i.unitid.toString() : '', // 计量单位id
              'unitcode': i.unitcode, // 计量单位编码
              idwarehouse: i.stockid, // 仓库id
              warehousecode: i.stockcode, // 仓库编码
              'saleOrderId': i.saleOrderid ? i.saleOrderid.toString() : '', // 销售单id
              'saleOrderCode': i.saleOrderCode, // 销售单号
              'saleOrderDetailId': i.saleOrderDetailId ? i.saleOrderDetailId.toString() : '', // 销售单明细id
              'qty': i.good_qty.toString(), // 入库数量
              'stepcode': i.step_code, // 工序编码
              'style': i.style, // 报工类型:B(自制) S(外协)
              'status': '0' // 入库单状态:0(未审核) 1(已审核)
            })
          })
          const data = {
            'rightcode': '0604', // 功能编号
            'incbit': this.form.incbit, // 流水号
            'TableData': [
              [
                {
                  'hbillno': this.form.hbillno, // 入库单号
                  'madedate': handleDatetime(this.form.hbdate) + ' 00:00:00', // 制单日期(年月日 00:00:00)
                  'hbdate': this.multipleSelection[this.multipleSelection.length - 1].voucherdate,
                  sourceVoucherId: [...new Set(this.multipleSelection.map(i => i.mpoid))].length > 1 ? '' : this.multipleSelection[0].mpoid,
                  sourceVoucherCode: [...new Set(this.multipleSelection.map(i => i.m_po))].length > 1 ? '' : this.multipleSelection[0].m_po,
                  saleOrderCode: [...new Set(this.multipleSelection.map(i => i.saleOrderCode))].length > 1 ? '' : this.multipleSelection[0].saleOrderCode,
                  'iddepartment': this.multipleSelection[0].dept_id, // 部门id
                  'departmentcode': this.multipleSelection[0].dept_code, // 部门编码
                  'idwarehouse': this.stockcodeArr.find(i => i.code === this.form.stockcode).noid, // 仓库id
                  'warehousecode': this.form.stockcode, // 仓库编码
                  'status': '0', // 入库单状态:0(未审核) 1(已审核)
                  PurchaseOrderCode: '', // 采购订单号
                  'remark': '', // 备注
                  'create_user': localStorage.getItem('username'), // 创建人员
                  'create_date': handleDatetime2(new Date()),
                  'check_user': '', // 审核人员
                  'check_date': ''// 审核时间
                }
              ],
              TableDetailData// 表体
            ]
          }
          // console.log(JSON.stringify(data))
          // this.$store.state.app.buttonIsDisabled = true
          const res = await InHouseOrderSpSeave(data)
          this.$store.state.app.buttonIsDisabled = false
          if (res.code === '200') {
            this.$message.success('入库成功!')
            this.multipleSelection = []
            // this.form.deptno = ''
            // this.form.stockcode = ''
            this.reset()
            // await this.getProductInHouseOrderSearch()
            await this.getProductInHouseOrderCodeSearch()
          }
        } else {
          // console.log(res.data)
          this.$store.state.app.buttonIsDisabled = false
          this.$message.error(res.data.message)
        }
      } else {
        this.$store.state.app.buttonIsDisabled = false
      }
    },
    // 重置
    reset() {
      // this.form.issouceorder = 'Y'
      this.form.saleordercode = '' // 销售单号
      this.form.wkshopcode = '' // 生产车间
      this.form.erpordercode = ''// 订单编号
@@ -1058,14 +1130,6 @@
::v-deep .el-tabs__item {
  padding-right: 0;
}
::v-deep .el-radio.is-bordered + .el-radio.is-bordered {
  margin: 10px 30px 0 0;
}
::v-deep .el-radio__label{
  display: none;
}
</style>
<style>
src/views/produce/warehouseRecord.vue
@@ -1,11 +1,848 @@
<template />
<template>
  <div>
    <div class="body" :style="{height:mainHeight+'px'}">
      <!--      <div class="bodyTopButtonGroup">-->
      <!--          <el-button v-waves :size="buttonSize" type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>-->
      <!--          <el-button v-waves :size="buttonSize" type="success" icon="el-icon-connection" @click="">派发</el-button>-->
      <!--      </div>-->
      <div class="bodyTopFormGroup" style="margin-top: 10px">
        <el-form
          ref="form"
          :model="form"
          :label-width="buttonSize==='medium'?'100px':'80px'"
          inline
          style="display: flex;"
        >
          <div class="elForm">
            <el-form-item label="入库单号" style="display: flex;">
              <el-input v-model="form.hbillno" placeholder="请输入" :style="{minWidth:'100px',width:formItemWidth+'px'}" />
            </el-form-item>
            <el-form-item label="单据日期" style="display: flex;align-items: center">
              <el-date-picker
                v-model="form.hbdate"
                type="daterange"
                range-separator="~"
                class="timeMini"
                size="mini"
                style="width: 200px;display: flex;line-height: 34px;height: 34px;"
                :clearable="false"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
              />
            </el-form-item>
            <el-form-item label="操作人员" style="display: flex;">
              <el-input v-model="form.username" :style="{minWidth:'100px',width:formItemWidth+'px'}" placeholder="请输入" />
            </el-form-item>
            <el-form-item label="操作时间" style="display: flex;align-items: center">
              <el-date-picker
                v-model="form.userdate"
                type="daterange"
                range-separator="~"
                class="timeMini"
                size="mini"
                style="width: 200px;display: flex;line-height: 34px;height: 34px;"
                :clearable="false"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
              />
            </el-form-item>
          </div>
          <div
            class="bodySearchReset"
            :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"
          >
            <el-button
              v-waves
              :size="buttonSize"
              type="primary"
              icon="el-icon-search"
              @click="getInStorageRecordMainSearch()"
            >查询
            </el-button>
            <el-button v-waves :size="buttonSize" type="info" icon="el-icon-refresh" @click="reset">重置</el-button>
          </div>
        </el-form>
        <div
          class="bodyTopFormExpand"
        >
          <!--          <svg-icon-->
          <!--            v-show="mouseHoverType==='mouseout'"-->
          <!--            style="cursor: pointer"-->
          <!--            :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"-->
          <!--            @mouseenter="mouseHoverType=$event.type"-->
          <!--          />-->
          <!--          <svg-icon-->
          <!--            v-show="mouseHoverType==='mouseenter'"-->
          <!--            style="cursor: pointer"-->
          <!--            :icon-class="!isExpandForm?'doubleDown':'doubleUp'"-->
          <!--            @click="isExpandForm=!isExpandForm"-->
          <!--            @mouseout="mouseHoverType=$event.type"-->
          <!--          />-->
        </div>
      </div>
      <div class="elTableDiv">
        <el-table
          ref="tableDataRef"
          class="tableFixed"
          :data="tableData"
          :height="isExpandForm?tableHeight:(tableHeight+80)+'px'"
          border
          :row-class-name="tableRowClassName"
          :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px'}"
          highlight-current-row
          :header-cell-style="this.$headerCellStyle"
          :cell-style="this.$cellStyle"
          @sort-change="sortChange"
          @row-click="rowClick"
        >
          <el-table-column
            prop="rowNum"
            width="50"
            label="序号"
            fixed
          />
          <el-table-column
            prop="hbillno"
            label="入库单号"
            show-tooltip-when-overflow
            sortable="custom"
          />
          <el-table-column
            prop="hbilltype"
            label="单据类型"
            show-tooltip-when-overflow
            sortable="custom"
          />
          <el-table-column
            prop="hbdate"
            label="单据日期"
            show-tooltip-when-overflow
            sortable="custom"
          />
          <el-table-column
            prop="create_user"
            show-tooltip-when-overflow
            label="创建人员"
            sortable="custom"
          />
          <el-table-column
            prop="create_date"
            label="创建时间"
            show-tooltip-when-overflow
            sortable="custom"
          />
          <el-table-column
            label="操作"
            width="160"
            fixed="right"
          >
            <template slot-scope="{row}">
              <div class="operationClass">
                <el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top">
                  <i class="el-icon-delete" :style="{color:$store.state.settings.theme}" @click.stop="del(row)" />
                </el-tooltip>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <!--分页-->
      <pagination
        :total="total"
        :page.sync="form.page"
        :limit.sync="form.rows"
        align="right"
        layout="total,prev, pager, next,sizes,jumper"
        popper-class="select_bottom"
        @pagination="getInStorageRecordMainSearch"
      />
      <div class="elTableDiv">
        <el-table
          ref="tableDataRef2"
          :data="tableDataDetail"
          border
          height="210px"
          :row-class-name="tableRowClassName"
          highlight-current-row
          :header-cell-style="this.$headerCellStyle"
          :cell-style="this.$cellStyle"
        >
          <el-table-column
            width="50"
            prop="rownumber"
            label="序号"
            fixed
          />
          <el-table-column
            prop="stockname"
            label="入库仓库"
            width="160"
            show-tooltip-when-overflow
          >
            <template slot-scope="{row}">
              <div v-if="row.stockname">{{ row.stockname }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="salecode"
            label="销售单号"
            min-width="160"
            show-tooltip-when-overflow
          >
            <template slot-scope="{row}">
              <div v-if="row.salecode">{{ row.salecode }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="mo_no"
            label="订单编号"
            min-width="160"
            show-tooltip-when-overflow
          >
            <template slot-scope="{row}">
              <div v-if="row.mo_no">{{ row.mo_no }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="wocode"
            label="工单编号"
            min-width="160"
            show-tooltip-when-overflow
          />
          <el-table-column
            prop="partcode"
            label="产品编码"
            width="160"
            show-tooltip-when-overflow
          />
          <el-table-column
            prop="partname"
            label="产品名称"
            width="160"
            show-tooltip-when-overflow
          />
          <el-table-column
            prop="partspec"
            label="产品规格"
            width="160"
            show-tooltip-when-overflow
          >
            <template slot-scope="{row}">
              <div v-if="row.partspec">{{ row.partspec }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="unitname"
            label="单位名称"
            width="160"
            show-tooltip-when-overflow
          >
            <template slot-scope="{row}">
              <div v-if="row.unitname">{{ row.unitname }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <!--          <el-table-column-->
          <!--            prop="wkshp_name"-->
          <!--            label="部门名称"-->
          <!--            width="160"-->
          <!--            show-tooltip-when-overflow-->
          <!--          >-->
          <!--            <template slot-scope="{row}">-->
          <!--              <div v-if="row.wkshp_name">{{ row.wkshp_name }}</div>-->
          <!--              <div v-else>/</div>-->
          <!--            </template>-->
          <!--          </el-table-column>-->
          <el-table-column
            prop="stepname"
            label="工序名称"
            min-width="160"
            show-tooltip-when-overflow
          >
            <template slot-scope="{row}">
              <div v-if="row.stepname">{{ row.stepname }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="qty"
            label="入库数量"
            min-width="95"
            show-tooltip-when-overflow
          >
            <template slot-scope="{row}">
              <div v-if="row.qty">{{ row.qty }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <!--          <el-table-column-->
          <!--            prop="plan_qty"-->
          <!--            label="工单数量"-->
          <!--            min-width="95"-->
          <!--            fixed="right"-->
          <!--            show-tooltip-when-overflow-->
          <!--          />-->
          <!--          <el-table-column-->
          <!--            prop="good_qty"-->
          <!--            label="完工数量"-->
          <!--            min-width="95"-->
          <!--            fixed="right"-->
          <!--            show-tooltip-when-overflow-->
          <!--          />-->
          <!--          <el-table-column-->
          <!--            prop="inhouseqty"-->
          <!--            label="已入库数量"-->
          <!--            min-width="95"-->
          <!--            fixed="right"-->
          <!--            show-tooltip-when-overflow-->
          <!--          />-->
          <!--          <el-table-column-->
          <!--            prop="stinhouseqty"-->
          <!--            label="待入库数量"-->
          <!--            min-width="130"-->
          <!--            fixed="right"-->
          <!--          >-->
          <!--            &lt;!&ndash;                    <template slot-scope="{row}">&ndash;&gt;-->
          <!--            &lt;!&ndash;                      <el-input-number v-model="row.stinhouseqty" :min="0" :max="row.good_qty" size="small" />&ndash;&gt;-->
          <!--            &lt;!&ndash;                    </template>&ndash;&gt;-->
          <!--          </el-table-column>-->
          <!--          <el-table-column-->
          <!--            label="操作"-->
          <!--            width="120"-->
          <!--            fixed="right"-->
          <!--          >-->
          <!--            <template slot-scope="{row}">-->
          <!--              <div class="operationClass">-->
          <!--                <el-tooltip v-del-tab-index class="item" effect="dark" content="SOP预览" placement="top">-->
          <!--                  <i-->
          <!--                    class="el-icon-files"-->
          <!--                    style="cursor: pointer;color:#42b983;margin-right: 15px"-->
          <!--                  />-->
          <!--                </el-tooltip>-->
          <!--              </div>-->
          <!--            </template>-->
          <!--          </el-table-column>-->
        </el-table>
      </div>
    </div>
  </div>
</template>
<script>
import Pagination from '@/components/Pagination'
import waves from '@/directive/waves'
import {
  DeleteMesInStorageRecord,
  InStorageRecordMainSearch,
  InStorageRecordSubSearch
} from '@/api/ReportManager'
import { getTPlusToken, handleDatetime, handleDatetime2 } from '@/utils/global'
import axios from 'axios'
import Vue from 'vue'
export default {
  name: 'WarehouseRecord'
  name: 'WorkOrderList',
  components: {
    Pagination
  },
  directives: { waves },
  data() {
    return {
      mouseHoverType: 'mouseout',
      mouseHoverTypeDialog: 'mouseout',
      isExpandForm: false,
      isIpad: false,
      mainHeight: 0,
      tableHeight: 0,
      username: '',
      form: {
        hbillno: '', // 入库单号
        hbdate: '', // 单据日期
        username: '', // 操作人员
        userdate: '', // 操作时间
        prop: 'hbillno', // 排序字段
        order: 'desc', // 排序字段
        page: 1, // 第几页
        rows: 20 // 每页多少条
      },
      tableData: [],
      total: 10,
      tableDataDetail: [],
      buttonSize: '',
      formItemWidth: 0
    }
  },
  activated() {
    window.addEventListener('resize', this.getHeight)
    this.getHeight()
  },
  created() {
    this.getInStorageRecordMainSearch()
  },
  mounted() {
    window.addEventListener('resize', this.getHeight)
    this.getHeight()
  },
  methods: {
    async getInStorageRecordMainSearch() {
      let tempDate = this.form.hbdate
      if (tempDate.length > 0) {
        tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1])
      }
      let tempDate2 = this.form.userdate
      if (tempDate2.length > 0) {
        tempDate2 = handleDatetime(tempDate2[0]) + '~' + handleDatetime(tempDate2[1])
      }
      const data = {
        hbillno: this.form.hbillno, // 入库单号
        hbdate: tempDate, // 单据日期
        username: this.form.username, // 操作人员
        userdate: tempDate2, // 操作时间
        prop: this.form.prop, // 排序字段
        order: this.form.order, // 排序字段
        page: this.form.page, // 第几页
        rows: this.form.rows // 每页多少条
      }
      const res = await InStorageRecordMainSearch(data)
      if (res.code === '200') {
        this.tableData = res.data
        this.total = res.count
        if (res.data.length > 0) {
          await this.getInStorageRecordSubSearch(res.data[0].hbillno)
        } else {
          this.tableDataDetail = []
        }
      }
    },
    async getInStorageRecordSubSearch(hbillno) {
      const { data: res } = await InStorageRecordSubSearch({ hbillno })
      this.tableDataDetail = res
    },
    rowClick(row, event, column) {
      this.getInStorageRecordSubSearch(row.hbillno)
    },
    reset() {
      this.form.hbillno = ''
      this.form.hbdate = ''
      this.form.username = ''
      this.form.userdate = ''
      this.getInStorageRecordMainSearch()
    },
    del(row) {
      this.$confirm('是否确认删除?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        getTPlusToken().then(openToken => {
          axios.post(Vue.prototype.$chanjetBaseUrl + '/tplus/api/v2/ProductReceiveOpenApi/Delete',
            { param: { 'voucherCode': row.hbillno }}, {
              headers: {
                'openToken': openToken,
                'appKey': Vue.prototype.$AppKey,
                'appSecret': Vue.prototype.$AppSecret,
                'Content-Type': 'application/json'
              }
            }
          ).then(r => {
            if (r.data.code === 0) {
              const data = []
              this.tableDataDetail.forEach(i => {
                data.push({
                  'hbillno': i.hbillno, // 入库单号
                  'inbarcode': i.inbarcode, // 入库条码
                  'sourceVoucherId': i.mo_id ? i.mo_id.toString() : '', // 来源单据ID
                  'sourceVoucherCode': i.mo_no ? i.mo_no : '', // 来源单据号
                  'sourceVoucherDetailId': i.sbid ? i.sbid.toString() : '', // 来源单据明细ID
                  'wocode': i.wocode, // 工单号
                  'stepcode': i.step_code, // 工序编码
                  'style': i.style, // 报工类型(B/S)
                  'qty': i.qty.toString(), // 入库数量
                  'idinventory': i.materiel_id ? i.materiel_id.toString() : '', // 存货ID
                  'idunit': i.unitid ? i.unitid.toString() : '', // 计量单位ID
                  'idwarehouse': i.stockid ? i.stockid.toString() : '', // 仓库ID
                  'create_user': localStorage.getItem('username'), // 操作人员
                  'create_date': handleDatetime2(new Date())// --操作时间
                })
              })
              // console.log(JSON.stringify(data))
              DeleteMesInStorageRecord(data).then(res => {
                if (res.code === '200') {
                  this.$message.success('删除成功!')
                  if (this.form.page > 1 && this.tableData.length === 1) {
                    this.form.page--
                  }
                  this.getInStorageRecordMainSearch()
                }
              })
            }
          })
        })
      }).catch(() => {
        this.$message.info('已取消删除')
      })
    },
    // 排序改变时
    sortChange({ column, prop, order }) {
      if (order === 'descending') {
        order = 'desc'
      } else if (order === 'ascending') {
        order = 'asc'
      } else {
        order = 'desc'
      }
      this.form.order = order
      this.form.prop = prop
      this.getStorageRecordSearch()
    },
    getHeight() {
      this.$nextTick(() => {
        this.mainHeight = window.innerHeight - 85
        this.tableHeight = this.mainHeight - 450
        this.formItemWidth = window.innerWidth / 10
        if (window.innerWidth <= 1500 || window.innerHeight <= 900) {
          this.buttonSize = 'small'
        } else {
          this.buttonSize = 'medium'
        }
        this.$refs.tableDataRef.doLayout()
        this.$refs.tableDataRef2.doLayout()
      })
    },
    tableRowClassName({ row, rowIndex }) {
      return 'custom-row'
    }
  }
}
</script>
<style scoped>
<style lang="scss" scoped>
$main_color: #42b983;
.stepSelectedValueClass {
  ::v-deep input {
    //min-height: 34px !important;
    height: 68px !important;
  }
}
.dialogVisibleRoute {
  .myCheckboxGroup {
    display: flex;
    flex-wrap: wrap;
    .myCheckbox {
      //border: 1px solid $main_color;
      border: 1px solid #eee;
      display: flex;
      min-width: 100px;
      padding: 10px;
      margin: 10px 30px 0 0;
      border-radius: 5px;
      cursor: default;
      .myCheckboxInput {
        margin: 1px 5px 0 0;
        cursor: pointer;
      }
    }
    //.myCheckbox{
    //  border: 1px solid $main_color;
    //}
    input[type=checkbox] {
      cursor: pointer;
      position: relative;
      width: 14px;
      height: 14px;
      font-size: 14px;
    }
    input[type=checkbox]::after {
      position: absolute;
      top: 0;
      //color: rgb(130, 35, 35);
      color: $main_color;
      width: 14px;
      height: 14px;
      display: inline-block;
      visibility: visible;
      padding-left: 0px;
      text-align: center;
      content: ' ';
      border-radius: 3px
    }
    input[type=checkbox]:checked::after {
      //content: "✓";
      content: "√";
      color: #fff;
      font-size: 12px;
      font-weight: bold;
      background-color: $main_color;
    }
  }
}
.dialogVisibleRoute {
  ::v-deep .el-dialog__body {
    padding: 20px 20px !important;
  }
}
.el-date-editor {
  font-size: 14px;
}
::v-deep .el-dialog__body {
  padding: 20px 100px !important;
}
.sop {
  ::v-deep .el-dialog__body {
    padding: 50px 80px !important;
  }
}
.dialogVisibleSearch ::v-deep .el-dialog__body {
  padding: 20px 20px !important;
}
.dialogVisibleConfirmClass ::v-deep .el-dialog__body {
  padding: 20px 20px !important;
}
::v-deep .el-table .caret-wrapper {
  transform: scale(0.8);
}
::v-deep .el-button--text {
  color: $main_color;
  font-size: 14px;
  cursor: pointer;
}
::v-deep .el-radio.is-bordered + .el-radio.is-bordered {
  margin: 10px 30px 0px 0;
}
.body ::v-deep .el-form-item {
  margin-bottom: 0;
}
.elForm ::v-deep .el-form-item {
  margin-bottom: 0;
}
.elTableDiv {
  ::v-deep .el-radio__label {
    display: none;
  }
}
.el-table::before {
  height: 0;
}
//.dialogVisibleConfirmClass >>>.el-table--border, .el-table--fit {
//  border-bottom: 2px solid #000 ;
//  //outline: #000 solid 2px !important;
//}
.tableDataPrint ::v-deep div.cell {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.formContent {
  width: 240px;
}
</style>
<style>
.formContent .el-form-item__label {
  color: #000 !important;
}
</style>
<!--公共页面样式-->
<style lang="scss" scoped>
$main_color: #42b983;
::v-deep .el-range-input {
  font-size: 14px !important;
}
::v-deep .el-range__icon {
  line-height: 28px !important;
}
::v-deep .el-range-separator {
  line-height: 28px !important;
}
::v-deep .el-range-input {
  font-size: 14px;
}
::v-deep .el-range-separator {
  display: flex;
  justify-content: center;
  align-items: center;
}
//::v-deep .el-button--primary, .el-button--default, .el-button--info {
//  height: 34px;
//  display: flex;
//  align-items: center;
//  padding: 0 15px;
//}
::v-deep .el-button--primary {
  //background-color: $main_color !important;
}
::v-deep .el-button--default {
  background-color: #f8f8fa;
  border: none;
}
::v-deep .el-input__inner {
  height: 34px;
  line-height: 34px;
  //color: #a7a7a7;
}
::v-deep .el-dialog__body {
  padding: 20px 100px !important;
}
::v-deep .dialogVisibleRoles .el-dialog__body {
  padding: 20px 20px !important;
}
::v-deep .importPickerClass .el-dialog__body {
  padding: 20px 20px !important;
}
::v-deep .el-dialog__footer {
  display: flex;
  justify-content: flex-end;
}
::v-deep .el-table .caret-wrapper {
  transform: scale(0.8);
}
::v-deep .cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
::v-deep .el-table::before {
  height: 0;
}
::v-deep .el-table__body-wrapper {
  background-color: #f8f8fa;
}
::v-deep .el-table__body .el-table__row.hover-row td {
  background-color: #eaecef;
}
::v-deep .el-form--inline .el-form-item__label {
  color: #a7a7a7;
}
.body ::v-deep .el-divider {
  border: 1px solid #eee;
  width: 99%;
  margin: 10px auto;
}
.body ::v-deep .el-form-item {
  margin-bottom: 0;
}
.userDialogVisible ::v-deep .el-form-item {
  margin-bottom: 0;
}
.dateMini {
  ::v-deep .el-input__inner {
    line-height: 34px;
    height: 34px;
    width: 200px;
    display: flex;
    font-size: 14px !important;
    align-items: center !important;
  }
  ::v-deep .el-input__prefix {
    margin-top: -3px;
  }
  //::v-deep .el-range__icon{
  //  line-height: 28px;
  //}
}
::v-deep .el-select__caret {
  display: flex;
  align-items: center;
  justify-content: center;
}
.tableFixed {
  ::v-deep .el-table__fixed-right {
    height: 100% !important;
  }
  ::v-deep .el-table__fixed {
    height: 100% !important;
  }
}
</style>
<style>
.el-table .custom-row {
  background: #f8f8fa;
}
</style>
src/views/workOrder/produceOrderList.vue
@@ -609,6 +609,7 @@
            v-model="dialogForm.ordernum"
            oninput="value=value.replace(/[^0-9.]/g,'')"
            style="width: 200px"
            disabled
          />
        </el-form-item>
@@ -785,6 +786,8 @@
        clerkuser: '', // 销售业务员
        saleOrderDeliveryDate: '', // 预计交付日期
        deptcode: '',
        paystartdate: '', //   预计开工日期
        payenddate: ''//  预计完工日期
@@ -1070,7 +1073,7 @@
            'saleordercode': i.saleOrderCode,
            // 'saleOrderDeliveryDate': i.saleOrderDeliveryDate
            'saleOrderDeliveryDate': handleDatetime(new Date()) + ' 00:00:00',
            deptcode: i.dept_code,
            'paystartdate': i.planstartdate,
            'payenddate': i.planenddate
          })
@@ -1140,6 +1143,8 @@
        this.dialogForm.paystartdate = row.planstartdate
        this.dialogForm.payenddate = row.planenddate
        this.dialogForm.deptcode = row.dept_code
      })
    },
    // 对话框关闭事件
@@ -1171,6 +1176,8 @@
        payenddate: '', // 预计完工日期
        paystartdate: '', // 预计开工日期
        deptcode: '',
        saleOrderDeliveryDate: '' // 预计交付日期
      }
@@ -1217,6 +1224,7 @@
            'payenddate': this.dialogForm.payenddate,
            'paystartdate': this.dialogForm.paystartdate,
            'relse_qty': this.dialogForm.relse_qty,
            deptcode: this.dialogForm.deptcode,
            'saleOrderDeliveryDate': handleDatetime(this.dialogForm.saleOrderDeliveryDate) + ' 00:00:00'
          }
vue.config.js
@@ -53,7 +53,8 @@
    proxy: {
      [process.env.VUE_APP_BASE_API]: {
        target: 'http://121.196.36.24:8048', // 本地
        // target: 'http://192.168.1.21:9000', // 阿鲁克(新)
        // target: 'http://192.168.21.19:8002', // 阿鲁克(新)
        // target: 'http://192.168.21.19:8003', // 阿鲁克(新)
        changeOrigin: true, // 请求跨域时,需 配置此项
        pathRewrite: { // 路径重写,替换target中的请求地址
          ['^' + process.env.VUE_APP_BASE_API]: '/api/'