小小儁爺
2024-11-14 6156331374cefbe908c5aeaebda911646c1d5f10
src/views/produce/productWarehouse.vue
@@ -32,6 +32,24 @@
        >
          <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.deptno"
                  :popper-append-to-body="false"
                  filterable
                  style="width: 200px"
                  placeholder="请选择"
                >
                  <!--                  @change="getProductInHouseOrderSearch"-->
                  <el-option
                    v-for="item in departmentArr"
                    :key="item.code"
                    :label="item.name"
                    :value="item.code"
                  />
                </el-select>
              </el-form-item>
              <el-form-item label="生产车间" style=" display: flex;">
                <el-select
                  v-model="form.wkshopcode"
@@ -68,6 +86,10 @@
                  style="width: 200px"
                />
              </el-form-item>
            </div>
            <div style="display: flex">
              <el-form-item
                label="销售订单"
                style="display: flex;"
@@ -78,9 +100,6 @@
                  style="width: 200px"
                />
              </el-form-item>
            </div>
            <div style="display: flex">
              <el-form-item label="产品编码" style=" display: flex;">
                <el-input v-model="form.partcode" placeholder="请输入" style="width: 200px" />
              </el-form-item>
@@ -130,10 +149,11 @@
            <el-form-item label="单据编号" style=" display: flex;">
              <el-input
                v-model="form.hbillno"
                readonly
                placeholder="请输入"
                style="width: 200px"
              />
              <!--              readonly-->
            </el-form-item>
            <el-form-item label="入库仓库" required style=" display: flex;">
@@ -147,23 +167,6 @@
              >
                <el-option
                  v-for="item in stockcodeArr"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="入库部门" required style=" display: flex;">
              <el-select
                v-model="form.deptno"
                :popper-append-to-body="false"
                filterable
                style="width: 200px"
                placeholder="请选择"
              >
                <el-option
                  v-for="item in departmentArr"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code"
@@ -235,39 +238,6 @@
                    label="序号"
                  />
                  <!--                  <el-table-column-->
                  <!--                    prop="stockcode"-->
                  <!--                    label="仓库"-->
                  <!--                    width="160"-->
                  <!--                    show-tooltip-when-overflow-->
                  <!--                  >-->
                  <!--                    <template slot-scope="{row}">-->
                  <!--                      <div>{{ row.stockcode ? stockcodeArr.find(i => i.code === row.stockcode).name : '/' }}</div>-->
                  <!--                      &lt;!&ndash;                      <div&ndash;&gt;-->
                  <!--                      &lt;!&ndash;                        v-if="!(row.index === tabClickIndex && tabClickLabel === '仓库')"&ndash;&gt;-->
                  <!--                      &lt;!&ndash;                      >&ndash;&gt;-->
                  <!--                      &lt;!&ndash;                        {{ row.stockcode ? stockcodeArr.find(i => i.code === row.stockcode).name : '/' }}&ndash;&gt;-->
                  <!--                      &lt;!&ndash;                      </div>&ndash;&gt;-->
                  <!--                      &lt;!&ndash;                      <el-select&ndash;&gt;-->
                  <!--                      &lt;!&ndash;                        v-if="row.index === tabClickIndex && tabClickLabel === '仓库'"&ndash;&gt;-->
                  <!--                      &lt;!&ndash;                        v-model="row.stockcode"&ndash;&gt;-->
                  <!--                      &lt;!&ndash;                        placeholder="请选择"&ndash;&gt;-->
                  <!--                      &lt;!&ndash;                      >&ndash;&gt;-->
                  <!--                      &lt;!&ndash;                        <el-option&ndash;&gt;-->
                  <!--                      &lt;!&ndash;                          v-for="item in stockcodeArr"&ndash;&gt;-->
                  <!--                      &lt;!&ndash;                          :key="item.code"&ndash;&gt;-->
                  <!--                      &lt;!&ndash;                          :label="item.name"&ndash;&gt;-->
                  <!--                      &lt;!&ndash;                          :value="item.code"&ndash;&gt;-->
                  <!--                      &lt;!&ndash;                        />&ndash;&gt;-->
                  <!--                      &lt;!&ndash;                      </el-select>&ndash;&gt;-->
                  <!--                    </template>-->
                  <!--                  </el-table-column>-->
                  <!--                  <el-table-column-->
                  <!--                    prop="inbarcode"-->
                  <!--                    label="入库条码"-->
                  <!--                    width="160"-->
                  <!--                    show-tooltip-when-overflow-->
                  <!--                  />-->
                  <el-table-column
                    prop="stockcode"
                    label="入库仓库"
@@ -428,131 +398,94 @@
              </div>
            </el-tab-pane>
            <el-tab-pane label="汇总">
              <div class="elTableDiv" style="margin: 0 auto 10px;">
                <el-table
                  ref="tableDataRef"
                  class="tableFixed"
                  :data="tableDataSummary"
                  :height="(tableHeight-25)+'px'"
                  border
                  :row-class-name="tableRowClassName2"
                  :style="{width: 100+'%',height:(tableHeight-25)+'px',}"
                  highlight-current-row
                  :header-cell-style="this.$headerCellStyle"
                  :cell-style="this.$cellStyle"
                >
                  <el-table-column
                    type="index"
                    width="50"
                    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>-->
                  <!--                    <template slot-scope="{row}">-->
                  <!--                      <div v-if="row.stockname">{{ row.stockname }}</div>-->
                  <!--                      <div v-else>/</div>-->
                  <!--                    </template>-->
            <!--            <el-tab-pane label="汇总">-->
            <!--              <div class="elTableDiv" style="margin: 0 auto 10px;">-->
            <!--                <el-table-->
            <!--                  ref="tableDataRef"-->
            <!--                  class="tableFixed"-->
            <!--                  :data="tableDataSummary"-->
            <!--                  :height="(tableHeight-25)+'px'"-->
            <!--                  border-->
            <!--                  :row-class-name="tableRowClassName2"-->
            <!--                  :style="{width: 100+'%',height:(tableHeight-25)+'px',}"-->
            <!--                  highlight-current-row-->
            <!--                  :header-cell-style="this.$headerCellStyle"-->
            <!--                  :cell-style="this.$cellStyle"-->
            <!--                >-->
            <!--                  <el-table-column-->
            <!--                    type="index"-->
            <!--                    width="50"-->
            <!--                    fixed-->
            <!--                    label="序号"-->
            <!--                  />-->
                  <!--                  </el-table-column>-->
                  <!--                  <el-table-column-->
                  <!--                    prop="inbarcode"-->
                  <!--                    label="入库条码"-->
                  <!--                    width="160"-->
                  <!--                    show-tooltip-when-overflow-->
                  <!--                  />-->
                  <!--                  <el-table-column-->
                  <!--                    prop="m_po"-->
                  <!--                    label="订单编号"-->
                  <!--                    width="160"-->
                  <!--                    show-tooltip-when-overflow-->
                  <!--                  >-->
                  <!--                    <template slot-scope="{row}">-->
                  <!--                      <div v-if="row.m_po">{{ row.m_po }}</div>-->
                  <!--                      <div v-else>/</div>-->
                  <!--                    </template>-->
                  <!--                  </el-table-column>-->
                  <!--                  <el-table-column-->
                  <!--                    prop="wo_code"-->
                  <!--                    label="工单编号"-->
                  <!--                    width="160"-->
                  <!--                    show-tooltip-when-overflow-->
                  <!--                  />-->
                  <el-table-column
                    prop="partcode"
                    label="产品编码"
                    min-width="160"
                    show-tooltip-when-overflow
                  />
                  <el-table-column
                    prop="partname"
                    label="产品名称"
                    min-width="160"
                    show-tooltip-when-overflow
                  />
                  <el-table-column
                    prop="partspec"
                    label="产品规格"
                    min-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="partcode"-->
            <!--                    label="产品编码"-->
            <!--                    min-width="160"-->
            <!--                    show-tooltip-when-overflow-->
            <!--                  />-->
            <!--                  <el-table-column-->
            <!--                    prop="partname"-->
            <!--                    label="产品名称"-->
            <!--                    min-width="160"-->
            <!--                    show-tooltip-when-overflow-->
            <!--                  />-->
            <!--                  <el-table-column-->
            <!--                    prop="partspec"-->
            <!--                    label="产品规格"-->
            <!--                    min-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="qty"
                    label="订单数量"
                    min-width="95"
            <!--                  <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"
            <!--                    show-tooltip-when-overflow-->
            <!--                  >-->
            <!--                    <template slot-scope="{row}">-->
            <!--                      <div v-if="row.qty">{{ row.qty }}</div>-->
            <!--                      <div v-else>/</div>-->
            <!--                    </template>-->
            <!--                  </el-table-column>-->
            <!--                  &lt;!&ndash;                  <el-table-column&ndash;&gt;-->
            <!--                  &lt;!&ndash;                    prop="plan_qty"&ndash;&gt;-->
            <!--                  &lt;!&ndash;                    label="工单数量"&ndash;&gt;-->
            <!--                  &lt;!&ndash;                    min-width="95"&ndash;&gt;-->
            <!--                  &lt;!&ndash;                    fixed="right"&ndash;&gt;-->
            <!--                  &lt;!&ndash;                    show-tooltip-when-overflow&ndash;&gt;-->
            <!--                  &lt;!&ndash;                  />&ndash;&gt;-->
            <!--                  <el-table-column-->
            <!--                    prop="good_qty"-->
            <!--                    label="完工数量"-->
            <!--                    min-width="95"-->
                    show-tooltip-when-overflow
                  />
                  <el-table-column
                    prop="inhouseqty"
                    label="已入库数量"
                    min-width="95"
            <!--                    show-tooltip-when-overflow-->
            <!--                  />-->
            <!--                  <el-table-column-->
            <!--                    prop="inhouseqty"-->
            <!--                    label="已入库数量"-->
            <!--                    min-width="95"-->
                    show-tooltip-when-overflow
                  />
                  <el-table-column
                    prop="stinhouseqty"
                    label="可入库数量"
                    min-width="95"
            <!--                    show-tooltip-when-overflow-->
            <!--                  />-->
            <!--                  <el-table-column-->
            <!--                    prop="stinhouseqty"-->
            <!--                    label="可入库数量"-->
            <!--                    min-width="95"-->
                    show-tooltip-when-overflow
                  />
                </el-table>
              </div>
            </el-tab-pane>
            <!--                    show-tooltip-when-overflow-->
            <!--                  />-->
            <!--                </el-table>-->
            <!--              </div>-->
            <!--            </el-tab-pane>-->
          </el-tabs>
        </div>
@@ -626,7 +559,7 @@
    this.getProductInHouseOrderCodeSearch()
    this.getDeptSelectData()
    this.getProductInHouseOrderSearch()
    // this.getProductInHouseOrderSearch()
  },
  methods: {
    // 获取入库部门
@@ -652,6 +585,9 @@
    },
    // 获取大列表查询
    async getProductInHouseOrderSearch() {
      if (this.form.deptno === '') {
        return this.$message.info('入库部门不能为空!')
      }
      const data = {
        saleordercode: this.form.saleordercode, // 销售单号
        wkshopcode: this.form.wkshopcode, // 生产车间
@@ -659,7 +595,8 @@
        mesordercode: this.form.mesordercode, // 工单编号
        partcode: this.form.partcode, // 产品编码
        partname: this.form.partname, // 产品名称
        partspec: this.form.partspec // 规格型号
        partspec: this.form.partspec, // 规格型号
        deptno: this.form.deptno// 入库部门
      }
      const { data: res } = await ProductInHouseOrderSearch(data)
@@ -675,18 +612,29 @@
    },
    // 复选框切换
    handleSelectionChange() {
    handleSelectionChange(val) {
      this.multipleSelection = val
    },
    // 递交
    async  submit() {
      // usercode
      // console.log(localStorage.getItem('username'))
      if (this.multipleSelection.length === 0) {
        return this.$message.info('请先勾选单据!')
      }
      if (this.form.stockcode === '') {
        return this.$message.info('入库仓库不能为空!')
      }
      if (this.form.deptno === '') {
        return this.$message.info('入库部门不能为空!')
      }
      const TableDetailData = []
      this.tableDataDetail.forEach((i, index) => {
      this.multipleSelection.forEach((i, index) => {
        TableDetailData.push({
          'hbillno': this.form.hbillno, // 入库单号
          'rownumber': i.sbid.toString(), // 行号
          'rownumber': (index + 1).toString(), // 行号
          'inbarcode': i.inbarcode, // 入库条码
          'mo_id': i.sbid.toString(), // 订单id(行号)
          'mo_no': i.m_po, // 订单号
@@ -695,7 +643,8 @@
          'unitcode': i.unitcode, // 单位编码
          'unit_rate': '1', // 单位换算率
          'stockcode': i.stockcode, // 仓库编码
          'qty': i.qty.toString(), // 入库数量
          // 'qty': i.qty.toString(), // 入库数量
          'qty': i.good_qty.toString(), // 入库数量
          'price': '0', // 入库单价
          'saleid': i.saleOrderDetailId.toString(), // 销售单id(行号)
          'salecode': i.saleOrderCode, // 销售单号
@@ -725,11 +674,18 @@
          TableDetailData// 表体
        ]
      }
      console.log(JSON.stringify(data))
      this.$store.state.app.buttonIsDisabled = true
      const res = await ProductInHouseOrderSeave(data)
      console.log(res)
      this.$store.state.app.buttonIsDisabled = false
      if (res.code === '200') {
        this.$message.success('入库成功!')
        this.multipleSelection = []
        // this.form.deptno = ''
        // this.form.stockcode = ''
        // await this.getProductInHouseOrderSearch()
        this.reset()
        await this.getProductInHouseOrderCodeSearch()
      }
    },
    // 重置
    reset() {
@@ -740,6 +696,8 @@
      this.form.partcode = ''// 产品编码
      this.form.partname = '' // 产品名称
      this.form.partspec = '' // 规格型号
      this.form.deptno = '' // 规格型号
      this.tableDataDetail = []
    },
    // 获取页面高度
    getHeight() {