lxf 1 year ago
parent
commit
982e1be425
1 changed files with 117 additions and 49 deletions
  1. 117 49
      src/views/production/operation/batching/index.vue

+ 117 - 49
src/views/production/operation/batching/index.vue

@@ -72,39 +72,47 @@
     </el-card>
 
     <el-dialog title="打印" v-if="openPrint" v-model="openPrint" width="1000px">
-      <div style="height: calc(100vh - 174px); overflow-y: auto; overflow-x: hidden">
-        <div class="printBomList" id="printMe">
-          <div class="t">生产备料单</div>
-          <div class="time" style="text-align: right">
-            {{ printTime }}
+      <div v-loading="loadingPrint">
+        <div style="height: calc(100vh - 174px); overflow-y: auto; overflow-x: hidden">
+          <div class="printBomList" id="printMe">
+            <div class="t">生产备料单</div>
+            <div class="time" style="text-align: right">
+              {{ printTime }}
+            </div>
+            <table border="1" cellspacing="0" class="table">
+              <thead>
+                <tr>
+                  <td style="width: 50px; text-align: center">编号</td>
+                  <td style="width: 120px">图稿类型</td>
+                  <td style="width: 120px">规格</td>
+                  <td style="width: 120px">颜色</td>
+                  <td style="width: 120px">BOM品号</td>
+                  <td>图稿名称</td>
+                  <td style="width: 130px">SKU品号</td>
+                  <td style="width: 90px; text-align: center">数量小计</td>
+                  <td style="width: 90px; text-align: center">数量总计</td>
+                </tr>
+              </thead>
+              <tbody v-if="formData && formData.length > 0">
+                <tr v-for="(item, index) in formData" :key="index">
+                  <td style="text-align: center">{{ item.index }}</td>
+                  <td>{{ dictKeyValue(item.machinedPanel, useUserStore().allDict["charge_item"]) }}</td>
+                  <td :rowspan="item.specIndex" v-if="item.specStatus">{{ item.spec }}</td>
+                  <td :rowspan="item.colourIndex" v-if="item.colourStatus">{{ item.colour }}</td>
+                  <td :rowspan="item.bomIndex" v-if="item.bomStatus">{{ item.bomSpecCode }}</td>
+                  <td>{{ item.artworkName }}</td>
+                  <td>{{ item.skuSpecCode }}</td>
+                  <td style="text-align: center">{{ item.quantity }}</td>
+                  <td :rowspan="item.bomIndex" v-if="item.bomStatus" style="text-align: center">{{ item.totalQuantity }}</td>
+                </tr>
+              </tbody>
+            </table>
           </div>
-          <table border="1" cellspacing="0" class="table">
-            <thead>
-              <tr>
-                <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 v-for="(item, index) in sourceList.data" :key="index">
-              <tr v-for="(itemSKU, indexSKU) in item.skuInfoList" :key="indexSKU">
-                <td :rowspan="item.skuInfoList.length" v-if="indexSKU === 0" style="text-align: center">{{ index + 1 }}</td>
-                <td :rowspan="item.skuInfoList.length" v-if="indexSKU === 0">{{ item.bomSpecCode }}</td>
-                <td :rowspan="item.skuInfoList.length" v-if="indexSKU === 0">{{ item.bomSpecName }}</td>
-                <td>{{ itemSKU.skuSpecCode }}</td>
-                <td style="text-align: center">{{ itemSKU.quantity }}</td>
-                <td :rowspan="item.skuInfoList.length" v-if="indexSKU === 0" style="text-align: center">{{ item.totalQuantity }}</td>
-              </tr>
-            </tbody>
-          </table>
         </div>
-      </div>
-      <div style="text-align: center; margin: 10px">
-        <el-button @click="openPrint = false" size="large">取消</el-button>
-        <el-button type="primary" v-print="printObj" size="large">打印</el-button>
+        <div style="text-align: center; margin: 10px">
+          <el-button @click="openPrint = false" size="large">取消</el-button>
+          <el-button type="primary" v-print="printObj" size="large">打印</el-button>
+        </div>
       </div>
     </el-dialog>
 
@@ -229,12 +237,6 @@ const searchConfigTwo = computed(() => {
 const config = computed(() => {
   return [
     {
-      type: "selection",
-      attrs: {
-        checkAtt: "isCheck",
-      },
-    },
-    {
       attrs: {
         label: "BOM品号",
         prop: "bomSpecCode",
@@ -356,18 +358,7 @@ const getList = async (req, status) => {
   }
   loading.value = true;
   proxy.post("/stockPreparation/uncompletedList", sourceList.value.pagination).then((res) => {
-    if (res && res.length > 0) {
-      sourceList.value.data = Object.freeze(
-        res.map((item) => {
-          return {
-            ...item,
-            isCheck: false,
-          };
-        })
-      );
-    } else {
-      sourceList.value.data = res;
-    }
+    sourceList.value.data = res;
     setTimeout(() => {
       loading.value = false;
     }, 200);
@@ -425,9 +416,86 @@ const openFile = (path) => {
 };
 const openPrint = ref(false);
 const printTime = ref("");
+const formData = ref([]);
+const loadingPrint = ref(false);
 const outExcel = () => {
+  formData.value = [];
   printTime.value = moment().format("yyyy-MM-DD HH:mm:ss");
+  loadingPrint.value = true;
   openPrint.value = true;
+  proxy.post("/stockPreparation/printUncompletedList", sourceList.value.pagination).then((res) => {
+    if (res && res.length > 0) {
+      for (let i = 0; i < res.length; i++) {
+        if (res[i].colourGroupingInfoList && res[i].colourGroupingInfoList.length > 0) {
+          res[i].specIndex = 0;
+          for (let j = 0; j < res[i].colourGroupingInfoList.length; j++) {
+            res[i].colourGroupingInfoList[j].colourIndex = 0;
+            let colourGroupingInfoList = res[i].colourGroupingInfoList[j];
+            if (colourGroupingInfoList.uncompletedVoList && colourGroupingInfoList.uncompletedVoList.length > 0) {
+              for (let x = 0; x < colourGroupingInfoList.uncompletedVoList.length; x++) {
+                res[i].colourGroupingInfoList[j].uncompletedVoList[x].bomIndex = 0;
+                let uncompletedVoList = colourGroupingInfoList.uncompletedVoList[x];
+                if (uncompletedVoList.skuInfoList && uncompletedVoList.skuInfoList.length > 0) {
+                  for (let y = 0; y < uncompletedVoList.skuInfoList.length; y++) {
+                    res[i].specIndex++;
+                    res[i].colourGroupingInfoList[j].colourIndex++;
+                    res[i].colourGroupingInfoList[j].uncompletedVoList[x].bomIndex++;
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+    let list = [];
+    if (res && res.length > 0) {
+      let index = 0;
+      for (let i = 0; i < res.length; i++) {
+        if (res[i].colourGroupingInfoList && res[i].colourGroupingInfoList.length > 0) {
+          let specStatus = true;
+          for (let j = 0; j < res[i].colourGroupingInfoList.length; j++) {
+            let colourStatus = true;
+            let colourGroupingInfoList = res[i].colourGroupingInfoList[j];
+            if (colourGroupingInfoList.uncompletedVoList && colourGroupingInfoList.uncompletedVoList.length > 0) {
+              for (let x = 0; x < colourGroupingInfoList.uncompletedVoList.length; x++) {
+                let bomStatus = true;
+                let uncompletedVoList = colourGroupingInfoList.uncompletedVoList[x];
+                if (uncompletedVoList.skuInfoList && uncompletedVoList.skuInfoList.length > 0) {
+                  for (let y = 0; y < uncompletedVoList.skuInfoList.length; y++) {
+                    let skuInfoList = uncompletedVoList.skuInfoList[y];
+                    index++;
+                    list.push({
+                      index: index,
+                      spec: res[i].spec,
+                      colour: colourGroupingInfoList.colour,
+                      bomSpecCode: uncompletedVoList.bomSpecCode,
+                      artworkName: skuInfoList.artworkName,
+                      skuSpecCode: skuInfoList.skuSpecCode,
+                      machinedPanel: skuInfoList.machinedPanel,
+                      quantity: skuInfoList.quantity,
+                      totalQuantity: uncompletedVoList.totalQuantity,
+                      specStatus: specStatus,
+                      specIndex: res[i].specIndex,
+                      colourStatus: colourStatus,
+                      colourIndex: res[i].colourGroupingInfoList[j].colourIndex,
+                      bomStatus: bomStatus,
+                      bomIndex: res[i].colourGroupingInfoList[j].uncompletedVoList[x].bomIndex,
+                    });
+                    specStatus = false;
+                    colourStatus = false;
+                    bomStatus = false;
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+    formData.value = Object.freeze(list);
+    loadingPrint.value = false;
+  });
 };
 const printObj = ref({
   id: "printMe",