cz 1 anno fa
parent
commit
1c5091c118

+ 19 - 7
src/views/EHSD/productLibrary/companyProduct/index.vue

@@ -630,7 +630,7 @@ const getTreeList = () => {
     });
 };
 const getTechnologyData = () => {
-  proxy.post("/technology/page").then((res) => {
+  proxy.post("/technology/page", { pageNum: 1, pageSize: 999 }).then((res) => {
     technologyData.value = res.rows;
   });
 };
@@ -692,13 +692,19 @@ const bomRules = ref({
 const bomSetting = (row) => {
   bomDialog.value = true;
   proxy.post("/productBomInfo/detail", { id: row.id }).then((res) => {
-    formData.bomData = res;
+    formData.bomData = {
+      id: res.id,
+      rawMaterialId: res.rawMaterialId,
+      productBomDetailList: [],
+    };
+    if (res.productBomDetailList && res.productBomDetailList.length > 0) {
+      formData.bomData.productBomDetailList = res.productBomDetailList.filter(
+        (x) => x.type == 2
+      );
+    } else {
+      formData.bomData.productBomDetailList = [];
+    }
   });
-  // formData.bomData = {
-  //   id: row.id,
-  //   rawMaterialId: "",
-  //   productBomDetailList: [],
-  // };
 };
 
 const submitBomForm = () => {
@@ -706,6 +712,11 @@ const submitBomForm = () => {
     if (!formData.bomData.productBomDetailList.length > 0) {
       return proxy.msgTip("请选择包材辅料", 2);
     }
+    formData.bomData.productBomDetailList.push({
+      materialId: formData.bomData.rawMaterialId,
+      type: 1,
+      quantity: 1,
+    });
     submitLoading.value = true;
     proxy.post("/productBomInfo/edit", formData.bomData).then(
       (res) => {
@@ -727,6 +738,7 @@ const selectMaterial = (row) => {
   );
   if (!flag) {
     formData.bomData.productBomDetailList.push({
+      type: 2,
       materialName: row.name,
       materialCode: row.customCode,
       materialId: row.id,

+ 55 - 29
src/views/MES/productionMaterial/index.vue

@@ -15,7 +15,12 @@
           select: selectRow,
        'select-all':selectRow
         }" @get-list="getList">
-
+            <template #pic="{ item }">
+              <div v-if="item.fileList &&item.fileList.length > 0">
+                <img :src="item.fileList[0].fileUrl" class="pic" @click="handleClickFile(item.fileList[0])" />
+              </div>
+              <div v-else></div>
+            </template>
           </byTable>
         </el-tab-pane>
         <el-tab-pane label="已备料" name="second">
@@ -46,11 +51,11 @@
                   <td style="width: 80px; text-align: center">数量</td>
                 </tr>
               </thead>
-              <tbody v-if="selectData && selectData.length > 0">
-                <tr v-for="(item, index) in selectData" :key="index">
+              <tbody v-if="printList && printList.length > 0">
+                <tr v-for="(item, index) in printList" :key="index">
                   <td style="text-align: center">{{ index +1}}</td>
-                  <td>{{ item.artworkName }}</td>
-                  <td>{{ item.skuSpecCode }}</td>
+                  <td>{{ item.materialName }}</td>
+                  <td>{{ item.materialCode }}</td>
                   <td style="text-align: center">{{ item.quantity }}</td>
                 </tr>
               </tbody>
@@ -84,6 +89,7 @@ const sourceList = ref({
     pageNum: 1,
     pageSize: 10,
     keyword: "",
+    status: "0",
   },
 });
 const treeData = ref([]);
@@ -109,78 +115,67 @@ const config = ref([
       width: 60,
     },
   },
-  {
-    attrs: {
-      label: "设计图",
-      prop: "code",
-    },
-  },
+
   {
     attrs: {
       label: "物料图片",
-      prop: "code",
+      slot: "pic",
     },
   },
   {
     attrs: {
       label: "物料编码",
-      prop: "code",
+      prop: "materialCode",
     },
   },
   {
     attrs: {
       label: "物料名称",
-      prop: "name",
+      prop: "materialName",
     },
   },
   {
     attrs: {
       label: "数量",
-      prop: "name",
+      prop: "quantity",
     },
   },
   {
     attrs: {
       label: "时间",
-      prop: "deptName",
+      prop: "preparationDeadline",
     },
   },
 ]);
 const configOne = ref([
   {
     attrs: {
-      label: "设计图",
-      prop: "code",
-    },
-  },
-  {
-    attrs: {
       label: "物料图片",
-      prop: "code",
+      slot: "pic",
     },
   },
   {
     attrs: {
       label: "物料编码",
-      prop: "code",
+      prop: "materialCode",
     },
   },
   {
     attrs: {
       label: "物料名称",
-      prop: "name",
+      prop: "materialName",
     },
   },
   {
     attrs: {
       label: "数量",
-      prop: "name",
+      prop: "quantity",
     },
   },
   {
     attrs: {
       label: "投产时间",
-      prop: "deptName",
+      prop: "productionTime",
     },
   },
 ]);
@@ -233,17 +228,27 @@ const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
   proxy
-    .post("/produceOrderDetail/page", sourceList.value.pagination)
+    .post("/materialPreparation/page", sourceList.value.pagination)
     .then((res) => {
       sourceList.value.data = res.rows.map((x) => ({ ...x, isCheck: true }));
       sourceList.value.pagination.total = res.total;
       setTimeout(() => {
         loading.value = false;
       }, 200);
+      const productIdList = res.rows.map((x) => x.materialId);
+      // 请求文件数据并回显
+      if (productIdList.length > 0) {
+        proxy.getFile(productIdList, sourceList.value.data, "materialId");
+      }
     });
 };
 
 const handleTabChange = (val) => {
+  if (val == "first") {
+    sourceList.value.pagination.status = "0";
+  } else {
+    sourceList.value.pagination.status = "1";
+  }
   getList();
 };
 
@@ -252,9 +257,23 @@ const selectRow = (data) => {
   selectData.value = data;
 };
 const printTime = ref("");
+const printList = ref([]);
 const openModal = () => {
-  dialogVisible.value = true;
+  let list = [];
+  for (let i = 0; i < selectData.value.length; i++) {
+    const e = selectData.value[i];
+    if (i == 0) {
+      list.push(e);
+    } else {
+      const index = list.findIndex((x) => x.materialId == e.materialId);
+      if (index > 0) {
+        list[index].quantity += e.quantity;
+      }
+    }
+  }
+  printList.value = list;
   printTime.value = moment().format("yyyy-MM-DD HH:mm:ss");
+  dialogVisible.value = true;
 };
 
 const submitForm = () => {
@@ -334,4 +353,11 @@ const printObj = ref({
     }
   }
 }
+.pic {
+  object-fit: contain;
+  width: 50px;
+  height: 50px;
+  cursor: pointer;
+  vertical-align: middle;
+}
 </style>

+ 1 - 0
src/views/product/material/index.vue

@@ -523,6 +523,7 @@ const getTreeList = () => {
   proxy
     .post("/productClassify/tree", { parentId: "", name: "", definition: "2" })
     .then((message) => {
+      message = message.map((x) => ({ ...x, id: x.id + "" }));
       treeListData.value = [
         {
           id: "",