Răsfoiți Sursa

新增同步sap接口对接

LAPTOP-16IUEB3P\Lenovo 2 ani în urmă
părinte
comite
9267d9e6f5

+ 9 - 0
src/api/material/BOM.js

@@ -41,3 +41,12 @@ export async function detailPage (params) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+//SAP-bom同步 
+export async function syncBom () {
+  const res = await request.get(`/sap/sync/syncBom`);
+  if (res.data.code == 0) {
+    return res.data.code;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 8 - 1
src/api/material/list.js

@@ -39,4 +39,11 @@ export async function removeItem (data) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
+// SAP-物料同步
+export async function syncMateriel () {
+  const res = await request.get('/sap/sync/syncMateriel');
+  if (res.data.code == 0) {
+    return res.data.code;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 9 - 1
src/api/technology/route/index.js

@@ -105,5 +105,13 @@ export default {
     if (res.data.code == 0) {
       return res.data.message;
     }
-  }
+  },
+  
+  syncRouting: async () => {
+    const res = await request.get(`/sap/sync/syncRouting`);
+    if (res.data.code == 0) {
+      return res.data.code;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
 };

+ 9 - 0
src/api/technology/version/version.js

@@ -52,3 +52,12 @@ export async function saveBomList(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// 生产版本同步
+export async function syncVersion(data) {
+  const res = await request.get('/sap/sync/syncVersion');
+  if (res.data.code == 0) {
+    return res.data.code;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 25 - 1
src/views/material/manage/components/index-search.vue

@@ -48,6 +48,14 @@
             >重置</el-button
           >
 
+          <el-button
+            type="primary"
+            icon="el-icon-refresh-left"
+            class="ele-btn-icon"
+            @click='refreshData'
+            :loading="loading"
+          >刷新</el-button>
+
           <slot></slot>
         </el-form-item>
       </el-col>
@@ -56,6 +64,7 @@
 </template>
 
 <script>
+  import { syncMateriel } from '@/api/material/list';
   export default {
     data() {
       // 默认表单数据
@@ -66,7 +75,8 @@
       return {
         defaultWhere,
         // 表单数据
-        where: { ...defaultWhere }
+        where: { ...defaultWhere },
+        loading:false
       };
     },
     computed: {
@@ -84,6 +94,20 @@
       reset() {
         this.where = { ...this.defaultWhere };
         this.search();
+      },
+      // 刷新数据
+      refreshData(){
+          this.loading = true;
+          syncMateriel().then(res=>{
+             if(res=='0'){
+               this.loading = false;
+                this.$message.success('数据刷新成功!')
+                this.search()
+             }
+          })
+          .catch((e) => {
+            this.loading = false;
+          });
       }
     }
   };

+ 5 - 2
src/views/material/manage/index.vue

@@ -33,7 +33,9 @@
           @done="done"
         >
           <!-- 表头工具栏 -->
-          <template v-slot:toolbar> </template>
+<!--          <template v-slot:toolbar>
+
+          </template> -->
         </ele-pro-table>
 
         <template v-slot:content>
@@ -75,7 +77,7 @@
         // 是否显示编辑弹窗
         showEdit: false,
         // 编辑回显数据
-        editData: null
+        editData: null,
       };
     },
 
@@ -99,6 +101,7 @@
         this.$refs.listData.reload(where);
       },
 
+
     }
   };
 </script>

+ 30 - 6
src/views/material/materialBOM/index.vue

@@ -10,10 +10,17 @@
         tool-class="ele-toolbar-actions"
       >
         <!-- 表头工具栏 -->
-        <!-- <template v-slot:toolbar>
-          <el-button type="primary" @click="handelEdit('新建')">新建</el-button>
-          <el-button type="primary">复制</el-button>
-        </template>-->
+        <template v-slot:toolbar>
+          <!-- <el-button type="primary" @click="handelEdit('新建')">新建</el-button> -->
+          <el-button
+            size="small"
+            type="primary"
+            icon="el-icon-refresh-left"
+            class="ele-btn-icon"
+            @click='refreshData'
+            :loading="loading"
+          >刷新</el-button>
+        </template>
         <template v-slot:action="{ row }">
           <el-link type="primary" @click="handelEdit(row)">详情</el-link>
         </template>
@@ -26,7 +33,7 @@
 <script>
   import BOMSearch from './components/BOM-search.vue';
   import ViewDialog from './components/view-dialog.vue';
-  import { getPage } from '@/api/material/BOM';
+  import { getPage , syncBom } from '@/api/material/BOM';
 
   export default {
     name: 'SystemDictionary',
@@ -90,7 +97,8 @@
           '-1': '草稿',
           0: '已停用',
           1: '已发布'
-        }
+        },
+        loading:false
       };
     },
 
@@ -140,7 +148,23 @@
               });
           })
           .catch(() => {});
+      },
+
+      // 刷新数据
+      refreshData(){
+          this.loading = true;
+          syncBom().then(res=>{
+             if(res=='0'){
+               this.loading = false;
+                this.$message.success('数据刷新成功!')
+                this.reload()
+             }
+          })
+          .catch((e) => {
+            this.loading = false;
+          });
       }
+
     }
   };
 </script>

+ 24 - 8
src/views/technology/route/index.vue

@@ -12,17 +12,16 @@
         row-key="id"
       >
         <!-- 表头工具栏 -->
-<!--        <template v-slot:toolbar>
+       <template v-slot:toolbar>
           <el-button
             size="small"
             type="primary"
-            icon="el-icon-plus"
+            icon="el-icon-refresh-left"
             class="ele-btn-icon"
-            @click="openEdit()"
-          >
-            新建
-          </el-button>
-        </template> -->
+            @click='refreshData'
+            :loading="loading"
+          >刷新</el-button>
+        </template>
 
         <!-- 状态列 -->
         <template v-slot:status="{ row }">
@@ -174,7 +173,8 @@
           { label: '草稿', value: -1 },
           { label: '失效', value: 0 },
           { label: '生效', value: 1 }
-        ]
+        ],
+        loading:false
       };
     },
     methods: {
@@ -252,7 +252,23 @@
               });
           })
           .catch(() => {});
+      },
+      
+      // 刷新数据
+      refreshData(){
+          this.loading = true;
+          route.syncRouting().then(res=>{
+             if(res=='0'){
+               this.loading = false;
+                this.$message.success('数据刷新成功!')
+                this.reload()
+             }
+          })
+          .catch((e) => {
+            this.loading = false;
+          });
       }
+      
     }
   };
 </script>

+ 15 - 3
src/views/technology/version/index.vue

@@ -18,6 +18,7 @@
             type="primary"
             icon="el-icon-refresh-left"
             class="ele-btn-icon"
+            :loading="loading"
             @click="toRefresh()"
           >
             刷新
@@ -48,7 +49,7 @@
 
 <script>
   import UserSearch from './components/user-search.vue';
-  import { pageList } from '@/api/technology/version/version.js';
+  import { pageList , syncVersion } from '@/api/technology/version/version.js';
   export default {
     name: 'technologyVersion',
     components: {
@@ -123,7 +124,8 @@
           { label: '草稿', value: -1 },
           { label: '失效', value: 0 },
           { label: '生效', value: 1 }
-        ]
+        ],
+        loading:false
       };
     },
     methods: {
@@ -142,7 +144,17 @@
       // },
       /* 点击刷新 */
       toRefresh(){
-
+         this.loading = true;
+         syncVersion().then(res=>{
+            if(res=='0'){
+              this.loading = false;
+               this.$message.success('数据刷新成功!')
+               this.reload()
+            }
+         })
+         .catch((e) => {
+           this.loading = false;
+         });
       },
       /* 刷新表格 */
       reload(where) {