liding
2025-04-30 4ae5681e4a92c1cc98e811135098c71958c48a02
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<!--成品抽样页面-->
<template>
  <div style="padding: 10px 0">
    <div class="card">
      <div class="title">
        <el-button size="small" type="primary" @click="addTemQuarter">新增</el-button>
        <el-button size="small" type="primary" @click="quarterSample">可靠性抽样</el-button>
        <el-button size="small" type="primary" @click="handleStockList">刷新</el-button>
      </div>
      <el-table ref="finishedproducttransferTable" v-loading="tableLoading" :data="stockList"
        :header-cell-style="lineSideWarehouseTableHeaderCellStyle" :row-class-name="lineSideWarehouseTableRowClassName"
        class="finishedproducttransfer-table" height="calc(100vh - 240px)" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="45"></el-table-column>
        <el-table-column :show-overflow-tooltip="true" align="center" label="客户订单编号" prop="customerOrderNo" width="140">
          <template slot="header" slot-scope="scope">
            <div style="line-height: 14px;margin-bottom: 6px">客户订单编号</div>
            <div class="th" @click.stop>
              <el-input v-model="queryParamOne.customerOrderNo" clearable size="mini" type="text"
                @clear="handleStockList" @keyup.enter.native="handleStockList"></el-input>
            </div>
          </template>
          <template slot-scope="scope">
            <span>{{ scope.row.customerOrderNo }}</span>
          </template>
        </el-table-column>
        <el-table-column align="center" label="成品零件号" prop="partNo" width="140">
          <template slot="header" slot-scope="scope">
            <div style="line-height: 14px;margin-bottom: 6px">成品零件号</div>
            <div class="th" @click.stop>
              <el-input v-model="queryParamOne.partNo" clearable size="mini" type="text" @clear="handleStockList"
                @keyup.enter.native="handleStockList"></el-input>
            </div>
          </template>
          <template slot-scope="scope">
            <span>{{ scope.row.partNo }}</span>
          </template>
        </el-table-column>
        <el-table-column align="center" label="零件名称" prop="partName" width="140">
          <template slot="header" slot-scope="scope">
            <div style="line-height: 14px;margin-bottom: 6px">零件名称</div>
            <div class="th" @click.stop>
              <el-input v-model="queryParamOne.partName" clearable size="mini" type="text" @clear="handleStockList"
                @keyup.enter.native="handleStockList"></el-input>
            </div>
          </template>
          <template slot-scope="scope">
            <span>{{ scope.row.partName }}</span>
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" align="center" label="仓库" prop="warehouseName" width="140">
          <template slot="header" slot-scope="scope">
            <div style="line-height: 14px;margin-bottom: 6px">仓库</div>
            <div class="th" @click.stop>
              <el-input v-model="queryParamOne.warehouseName" clearable size="mini" type="text" @clear="handleStockList"
                @keyup.enter.native="handleStockList"></el-input>
            </div>
          </template>
          <template slot-scope="scope">
            <span>{{ scope.row.warehouseName }}</span>
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" align="center" label="库位号" prop="locationNo" width="140">
          <template slot="header" slot-scope="scope">
            <div style="line-height: 14px;margin-bottom: 6px">库位号</div>
            <div class="th" @click.stop>
              <el-input v-model="queryParamOne.locationNo" clearable size="mini" type="text" @clear="handleStockList"
                @keyup.enter.native="handleStockList"></el-input>
            </div>
          </template>
          <template slot-scope="scope">
            <span>{{ scope.row.locationNo }}</span>
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" align="center" label="库位名称" prop="locationName" width="140">
          <template slot="header" slot-scope="scope">
            <div style="line-height: 14px;margin-bottom: 6px">库位名称</div>
            <div class="th" @click.stop>
              <el-input v-model="queryParamOne.locationName" clearable size="mini" type="text" @clear="handleStockList"
                @keyup.enter.native="handleStockList"></el-input>
            </div>
          </template>
          <template slot-scope="scope">
            <span>{{ scope.row.locationName }}</span>
          </template>
        </el-table-column>
        <el-table-column align="center" label="批次号" prop="partBatchNo" width="140">
          <template slot="header" slot-scope="scope">
            <div style="line-height: 14px;margin-bottom: 6px">批次号</div>
            <div class="th" @click.stop>
              <el-input v-model="queryParamOne.partBatchNo" clearable size="mini" type="text" @clear="handleStockList"
                @keyup.enter.native="handleStockList"></el-input>
            </div>
          </template>
          <template slot-scope="scope">
            <span>{{ scope.row.partBatchNo }}</span>
          </template>
        </el-table-column>
        <el-table-column align="center" label="入库来源" prop="inSource" width="140">
          <template slot="header" slot-scope="scope">
            <div style="line-height: 14px;margin-bottom: 6px">入库来源</div>
            <div class="th" @click.stop>
              <el-input v-model="queryParamOne.inSource" clearable size="mini" type="text" @clear="handleStockList"
                @keyup.enter.native="handleStockList"></el-input>
            </div>
          </template>
          <template slot-scope="scope">
            <span>{{ scope.row.inSource }}</span>
          </template>
        </el-table-column>
        <el-table-column align="center" label="外护颜色" prop="outerColor" width="140">
          <template slot="header" slot-scope="scope">
            <div style="line-height: 14px;margin-bottom: 6px">外护颜色</div>
            <div class="th" @click.stop>
              <el-input v-model="queryParamOne.outerColor" clearable size="mini" type="text" @clear="handleStockList"
                @keyup.enter.native="handleStockList"></el-input>
            </div>
          </template>
          <template slot-scope="scope">
            <span>{{ scope.row.outerColor }}</span>
          </template>
        </el-table-column>
        <el-table-column align="center" label="库存数量" prop="stockQuantity" width="140">
        </el-table-column>
        <el-table-column align="center" label="可用库存数量" prop="availableStockQuantity" width="140">
          <template slot-scope="scope">
            <span>{{ scope.row.availableStockQuantity }}</span>
          </template>
        </el-table-column>
      </el-table>
      <div class="pagin-page" style="margin-top: 0;margin-bottom: 0;">
        <el-pagination background :current-page="queryReport.current" :page-size="queryReport.size"
          :page-sizes="[10, 15, 20, 50, 100]" :total="queryReport.total"
          layout="total, sizes, prev, pager, next, jumper" style="text-align:right;padding: 20px 16px;"
          @size-change="handleSizeChangeReport" @current-change="handleCurrentChangeReport">
        </el-pagination>
      </div>
    </div>
    <add-quarter-item ref="addQuarterItem"></add-quarter-item>
  </div>
</template>
 
<script>
 
import AddQuarterItem from "./components/addQuarterItem.vue";
import { getIfsStock } from "@/api/business/finishedProductSampling";
import { mapGetters } from "vuex";
 
export default {
  name: 'FinishedProductSampling',
  data() {
    return {
      stockList: [],
      queryParamOne: {
        partNo: null,
        partName: null,
        warehouseName: null,
        locationName: null,
        locationNo: null,
        partBatchNo: null,
        stockQuantity: null,
        availableStockQuantity: null,
        outerColor: null,
        customerOrderNo: null,
        inSource: null,
      },
      queryReport: {
        current: 1,
        size: 20,
        total: 0
      },
      tableLoading: false,
      multipleSelection: [], // table所选中的对象
      showEditForm: false,
      showMoveForm: false,
      showMoveAllForm: false,
      erpfinishstock: {},
      isAvaliable: false,
      isPackage: false,
      quarterTemItems: [],
      operationType: ''
    }
  },
  components: { AddQuarterItem },
  mounted() {
    this.getIfsStock()
  },
  updated() {
    this.$nextTick(() => {
      this.$refs.finishedproducttransferTable.doLayout()
    })
  },
  computed: {
    ...mapGetters(["nickName"]),
  },
  methods: {
    // 可靠性抽样
    quarterSample() {
      this.$refs.addQuarterItem.openDia(this.quarterTemItems, 'add')
    },
    addTemQuarter() {
      if (this.multipleSelection.length > 0) {
        const multipleSelection = JSON.parse(JSON.stringify(this.multipleSelection))
        if (multipleSelection.length > 0) {
          multipleSelection.forEach(item => {
            if (item.partName.includes(' ')) {
              const list = item.partName.match(/^(\S+)\s(.*)/).slice(1)
              console.log('list', list)
              item.productType = list[0]
              item.spotCheckNumber = list[1]
            }
            item.dutyUser = this.nickName
            item.itemRemark = item.partBatchNo;
            this.quarterTemItems.push(item)
          })
        }
        this.$message.success('暂存成功')
        this.$refs.finishedproducttransferTable.clearSelection()
      } else {
        this.$message.warning('请选择数据')
      }
    },
    // 获取数据列表
    getIfsStock() {
      this.tableLoading = true
      this.stockList = []
      const newReqParam = this.getFinalParam()
      getIfsStock(newReqParam).then((response) => {
        this.tableLoading = false
        const resData = response.data
        this.queryReport.total = resData.total
        const resStockList = resData.data
        resStockList.forEach((item) => {
          this.stockList.push({
            partNo: item.PART_NO,
            partName: item.PART_DESC,
            warehouseName: item.WAREHOUSE_ID,
            locationName: item.LOCATION_DESC,
            locationNo: item.LOCATION_NO,
            partBatchNo: item.LOT_BATCH_NO,
            stockQuantity: item.QTY_ONHAND,
            availableStockQuantity: item.QTY_AVAILABLE,
            outerColor: item.ATTR4,
            customerOrderNo: item.ATTR6,
            inSource: item.ATTR23,
          })
        })
      }).catch(() => {
        this.tableLoading = false
      })
    },
    getFinalParam() {
      const newReqParam = {
        partNo: this.queryParamOne.partNo,
        partDescription: this.queryParamOne.partName,
        warehouse: this.queryParamOne.warehouseName
          ? this.queryParamOne.warehouseName + '%'
          : null,
        locDesc: this.queryParamOne.locationName,
        locNo: this.queryParamOne.locationNo,
        lotBatchNo: this.queryParamOne.partBatchNo,
        quantityFlag: this.queryParamOne.stockQuantity,
        outerColor: this.queryParamOne.outerColor,
        otcOrderNo: this.queryParamOne.customerOrderNo,
        availableStockQuantity: this.queryParamOne.availableStockQuantity,
        inSource: this.queryParamOne.inSource,
        page: this.queryReport.current,
        limit: this.queryReport.size
      }
      return newReqParam
    },
    lineSideWarehouseTableHeaderCellStyle({ row, column, rowIndex, columnIndex }) {
      let headerStyle = 'background:#FAFAFA;color:#666;'
      if (columnIndex === 0) {
        headerStyle += 'border-radius: 6px 0px 0px 0px;'
      } else if (columnIndex === 13) {
        headerStyle += 'border-radius: 0px 6px 0px 0px;'
      }
      return headerStyle
    },
    lineSideWarehouseTableRowClassName({ row, rowIndex }) {
      if (rowIndex % 2 === 1) {
        return 'stripe-row'
      } else {
        return ''
      }
    },
    handleSizeChangeReport(val) {
      this.queryReport.size = val
      this.queryReport.current = 1
      this.getIfsStock()
    },
    handleCurrentChangeReport(val) {
      this.queryReport.current = val
      this.getIfsStock()
    },
    handleStockList() {
      this.queryReport.current = 1
      this.getIfsStock()
    },
    handleSelectionChange(val) {
      this.multipleSelection = val
    }
  }
}
</script>
 
<style scoped>
>>>.el-table__header {
  height: 70px;
}
 
.card {
  height: calc(100% - 40px);
  background: #ffffff;
  padding: 10px;
}
 
.title {
  text-align: right;
  margin-bottom: 10px;
}
</style>