Эх сурвалжийг харах

Merge branch '生产备料-按事业部区分'

lxf 1 жил өмнө
parent
commit
b62a4e5d1e

+ 32 - 5
src/views/shengde/productionSystem/productionOperation/batching/already.vue

@@ -13,6 +13,17 @@
       <el-form-item label="BOM品名" prop="nameChinese">
         <el-input placeholder="请输入" v-model="queryParams.nameChinese" clearable size="small" @keyup.enter.native="handleQuery" />
       </el-form-item>
+      <el-form-item label="事业部" prop="subsidiaryId">
+        <el-select v-model="queryParams.subsidiaryId" placeholder="请选择事业部" size="small" style="width: 100%" @change="handleQuery">
+          <el-option v-for="item in companyList" :key="item.id" :label="item.name" :value="item.id" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="SKU品号" prop="productColorCode">
+        <el-input placeholder="请输入" v-model="queryParams.productColorCode" clearable size="small" @keyup.enter.native="handleQuery" />
+      </el-form-item>
+      <el-form-item label="幅宽 (cm)" prop="width">
+        <el-input placeholder="请输入" v-model="queryParams.width" clearable size="small" @keyup.enter.native="handleQuery" />
+      </el-form-item>
       <el-form-item>
         <el-button size="small" @click="handleQuery" class="searchBtn">搜索</el-button>
         <el-button size="small" @click="resetQuery">重置</el-button>
@@ -41,6 +52,7 @@
           </div>
         </template>
       </el-table-column>
+      <el-table-column label="事业部" prop="subsidiaryName" align="left" width="120" />
       <el-table-column label="BOM品号" prop="specCode" align="left" width="140">
         <template slot-scope="scope">
           <div>
@@ -55,15 +67,21 @@
         </template>
       </el-table-column>
       <el-table-column label="BOM品名" prop="nameChinese" align="left" min-width="300" />
-      <el-table-column label="订单号" prop="contractCode" align="left" width="150" />
-      <el-table-column label="万里牛单号" prop="tradeNo" width="140" />
+      <el-table-column label="SKU品号" prop="productColorCode" width="160" />
+      <el-table-column label="SKU品名" prop="productColorName" min-width="200" />
+      <el-table-column label="尺寸 (长*宽*高)" prop="productColorCode" width="180">
+        <template slot-scope="scope">
+          <div>{{ scope.row.length }} * {{ scope.row.width }} * {{ scope.row.height }}</div>
+        </template>
+      </el-table-column>
       <el-table-column label="件数" width="80">
         <template slot-scope="scope">
           <span>{{ Number(scope.row.quantity) }}</span>
         </template>
       </el-table-column>
       <el-table-column label="投产时间" prop="putTime" align="center" width="140" />
-      <el-table-column label="SKU品名" prop="productColorName" width="280" />
+      <el-table-column label="订单号" prop="contractCode" align="left" width="150" />
+      <el-table-column label="万里牛单号" prop="tradeNo" width="140" />
       <el-table-column label="操作" align="center" fixed="right" width="100">
         <template slot-scope="scope">
           <div class="miniBtn">
@@ -130,6 +148,7 @@ Vue.use(Print)
 import { mapGetters } from 'vuex'
 import * as API from '@/api/shengde/productionSystem/productionOperation/batching/index'
 import { getUid } from '@/util/saas.js'
+import { getSubsidiaryList } from '@/api/shengde/subsidiary/bill/bill'
 
 export default {
   name: 'already',
@@ -147,6 +166,9 @@ export default {
         // beginTime: '',
         // endTime: '',
         status: '1',
+        subsidiaryId: '',
+        productColorCode: '',
+        width: '',
       },
       tableList: [],
       total: null,
@@ -159,11 +181,16 @@ export default {
       },
       QRcodeList: [],
       qrList: [],
+      companyList: [],
     }
   },
   computed: mapGetters(['dictData']),
   created() {},
-  mounted() {},
+  mounted() {
+    getSubsidiaryList({ pageNum: 1, pageSize: 9999 }).then((res) => {
+      this.companyList = res.data.data.records
+    })
+  },
   methods: {
     pageInit() {
       this.getList()
@@ -211,7 +238,7 @@ export default {
             let obj = { ...this.rowData, sort: i, uid: getUid() }
             arr.push(obj)
           }
-          console.log(arr);
+          console.log(arr)
           this.QRcodeList = arr
           this.$nextTick(() => {
             for (let i = 0; i < this.QRcodeList.length; i++) {

+ 78 - 27
src/views/shengde/productionSystem/productionOperation/batching/stay.vue

@@ -13,6 +13,17 @@
       <el-form-item label="BOM品名" prop="nameChinese">
         <el-input placeholder="请输入" v-model="queryParams.nameChinese" clearable size="small" @keyup.enter.native="handleQuery" />
       </el-form-item>
+      <el-form-item label="事业部" prop="subsidiaryId">
+        <el-select v-model="queryParams.subsidiaryId" placeholder="请选择事业部" size="small" style="width: 100%" @change="handleQuery">
+          <el-option v-for="item in companyList" :key="item.id" :label="item.name" :value="item.id" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="SKU品号" prop="productColorCode">
+        <el-input placeholder="请输入" v-model="queryParams.productColorCode" clearable size="small" @keyup.enter.native="handleQuery" />
+      </el-form-item>
+      <el-form-item label="幅宽 (cm)" prop="width">
+        <el-input placeholder="请输入" v-model="queryParams.width" clearable size="small" @keyup.enter.native="handleQuery" />
+      </el-form-item>
       <el-form-item label="投产时间">
         <el-col :span="11">
           <el-date-picker
@@ -92,7 +103,8 @@
           </div>
         </template>
       </el-table-column>
-      <el-table-column label="BOM品号" prop="specCode" align="left" width="180">
+      <el-table-column label="事业部" prop="subsidiaryName" align="left" width="120" />
+      <el-table-column label="BOM品号" prop="specCode" align="left" width="160">
         <template slot-scope="scope">
           <div>
             <el-tag type="warning" size="mini" v-if="scope.row.bookSign">{{ getName(scope.row) }}</el-tag>
@@ -107,6 +119,13 @@
         </template>
       </el-table-column>
       <el-table-column label="BOM品名" prop="nameChinese" align="left" min-width="200" />
+      <el-table-column label="SKU品号" prop="productColorCode" width="160" />
+      <el-table-column label="SKU品名" prop="productColorName" min-width="200" />
+      <el-table-column label="尺寸 (长*宽*高)" width="180">
+        <template slot-scope="scope">
+          <div>{{ scope.row.length }} * {{ scope.row.width }} * {{ scope.row.height }}</div>
+        </template>
+      </el-table-column>
       <el-table-column label="件数" width="80">
         <template slot-scope="scope">
           <span>{{ Number(scope.row.quantity) }}</span>
@@ -115,7 +134,6 @@
       <el-table-column label="投产时间" prop="putTime" align="center" width="140" />
       <el-table-column label="订单号" prop="contractCode" width="150" />
       <el-table-column label="万里牛单号" prop="tradeNo" width="140" />
-      <el-table-column label="SKU品名" prop="productColorName" width="280" />
     </el-table>
 
     <div style="display: none">
@@ -159,20 +177,22 @@
         <table border class="table">
           <thead>
             <tr>
-              <td>编号</td>
-              <td>物料品号</td>
-              <td>物料品名</td>
-              <td>数量</td>
-              <td>备注</td>
+              <td style="width: 6%; text-align: center">编号</td>
+              <td style="width: 18%">物料品号</td>
+              <td style="width: 38%">物料品名</td>
+              <td style="width: 18%">SKU品号</td>
+              <td style="width: 10%; text-align: center">数量小计</td>
+              <td style="width: 10%; text-align: center">数量总计</td>
             </tr>
           </thead>
-          <tbody>
-            <tr v-for="(item, index) in printBomList" :key="index">
-              <td style="width: 8%">{{ index + 1 }}</td>
-              <td style="width: 20%">{{ item.specCode }}</td>
-              <td style="width: 35%">{{ item.nameChinese }}</td>
-              <td style="width: 12%">{{ item.quantity }}</td>
-              <td style="width: 25%"></td>
+          <tbody v-for="(item, index) in printBomList" :key="index">
+            <tr v-for="(itemSKU, indexSKU) in item.SKUList" :key="indexSKU">
+              <td :rowspan="item.SKUList.length" v-if="indexSKU === 0" style="text-align: center">{{ index + 1 }}</td>
+              <td :rowspan="item.SKUList.length" v-if="indexSKU === 0">{{ item.specCode }}</td>
+              <td :rowspan="item.SKUList.length" v-if="indexSKU === 0">{{ item.nameChinese }}</td>
+              <td>{{ itemSKU.productColorCode }}</td>
+              <td style="text-align: center">{{ itemSKU.quantity }}</td>
+              <td :rowspan="item.SKUList.length" v-if="indexSKU === 0" style="text-align: center">{{ item.quantity }}</td>
             </tr>
           </tbody>
         </table>
@@ -211,6 +231,7 @@ import { getUid } from '@/util/saas.js'
 import * as API from '@/api/shengde/productionSystem/productionOperation/batching/index'
 import { mapGetters } from 'vuex'
 import QuickDelivery from '@/components/shengde/quickDelivery/index'
+import { getSubsidiaryList } from '@/api/shengde/subsidiary/bill/bill'
 
 export default {
   name: 'stay',
@@ -220,7 +241,7 @@ export default {
       pathPrefix: process.env.VUE_APP_IMG_URL,
       queryParams: {
         pageNum: 1,
-        pageSize: 99999,
+        pageSize: 9999,
         contractCode: '',
         tradeNo: '',
         specCode: '',
@@ -228,6 +249,9 @@ export default {
         beginTime: '',
         endTime: '',
         status: '0',
+        subsidiaryId: '',
+        productColorCode: '',
+        width: '',
       },
       loading: false,
       tableList: [],
@@ -255,13 +279,18 @@ export default {
         quantity: 0,
         contractCount: 0,
       },
+      companyList: [],
     }
   },
   created() {
     this.bookSign = this.dictData.filter((item) => item.code === 'book_sign')[0].children
     this.bookSignAndNo = this.bookSignAndNo.concat(this.bookSign)
   },
-  mounted() {},
+  mounted() {
+    getSubsidiaryList({ pageNum: 1, pageSize: 9999 }).then((res) => {
+      this.companyList = res.data.data.records
+    })
+  },
   computed: mapGetters(['dictData']),
   methods: {
     pageInit() {
@@ -318,19 +347,41 @@ export default {
     outExcel() {
       if (!this.excelList.length > 0) return this.msgInfo('请选择要打印的备料单!')
       this.printTime = ''
-      let arr = this.sortOut(this.excelList, 'bomColorId') //根据bom规格id进行数据归类
-      //对相同的bom规格id的数据中的数量进行汇总
-      arr.sort((a, b) => b.sort - a.sort)
-      for (let i = 0; i < arr.length; i++) {
-        const iele = arr[i]
-        let sum = 0
-        for (let j = 0; j < iele.children.length; j++) {
-          const jele = iele.children[j]
-          sum = sum + Number(jele.quantity)
+      let arr = this.excelList.filter((item) => item.dataResource === 1)
+      let demoList = []
+      if (arr && arr.length > 0) {
+        let bomColorList = Array.from(new Set(arr.map((item) => item.bomColorId)))
+        for (let i = 0; i < bomColorList.length; i++) {
+          let list = arr.filter((item) => item.bomColorId === bomColorList[i])
+          let productColorList = Array.from(new Set(list.map((item) => item.productColorId)))
+          let sum = 0
+          let demoListTwo = []
+          for (let j = 0; j < productColorList.length; j++) {
+            let sumTwo = 0
+            let listTwo = list.filter((item) => item.productColorId === productColorList[j])
+            for (let y = 0; y < listTwo.length; y++) {
+              if (listTwo[y].quantity) {
+                sumTwo = Number(parseFloat(Number(sumTwo) + Number(listTwo[y].quantity)).toFixed(0))
+              }
+            }
+            demoListTwo.push({
+              productColorCode: listTwo[0].productColorCode,
+              quantity: sumTwo,
+            })
+            sum = Number(parseFloat(Number(sum) + Number(sumTwo)).toFixed(0))
+          }
+
+          demoList.push({
+            specCode: list[0].specCode,
+            nameChinese: list[0].nameChinese,
+            quantity: sum,
+            SKUList: demoListTwo,
+          })
         }
-        iele.quantity = sum
+      } else {
+        return this.msgInfo('请选择主材进行打印!')
       }
-      this.printBomList = arr
+      this.printBomList = demoList
       this.$nextTick(() => {
         this.$confirm('确认打印吗?', '警告', {
           confirmButtonText: '确定',