AlanWong 1 year ago
parent
commit
fc89da7477
3 changed files with 77 additions and 20 deletions
  1. 11 1
      src/api/currency.ts
  2. 1 0
      src/views/audit/outbound/index.vue
  3. 65 19
      src/views/audit/sku/index.vue

+ 11 - 1
src/api/currency.ts

@@ -78,6 +78,15 @@ function delCategoryId(data : any, url : any) {
 		params: data
 	})
 }
+// 物料同步财务系统
+function WMSPushProducts(data : any) {
+	return request({
+		url: '/omsOrder/WMSwork/WMSPushProducts',
+		method: 'POST',
+		params: data
+	})
+}
+
 export default {
 	treeList,
 	treeUseList,
@@ -88,5 +97,6 @@ export default {
 	saveList,
 	updateList,
 	deleteList,
-	delCategoryId
+	delCategoryId,
+	WMSPushProducts
 }

+ 1 - 0
src/views/audit/outbound/index.vue

@@ -1017,6 +1017,7 @@
 						delete v.id;
 					});
 					delete query.id;
+					query.financeType = 'kingdee';
 					api.outbound(query, 'supplyOutOrder').then((res : any) => {
 						loading.close();
 						if (res.code === 200) {

+ 65 - 19
src/views/audit/sku/index.vue

@@ -24,6 +24,7 @@
 		isShow : any = 'home'
 		timeNum = 0;
 		calculateCount = 0;
+		baseInfo : any = ''
 		timer : any = null
 		toolConfig = {
 			tools: {
@@ -31,13 +32,13 @@
 				save: true,
 			},
 			customTools: [
-				// {
-				// 	name: '同步到财务系统', icon: 'el-icon-top', audit: [''], event: {
-				// 		click: () => {
-				// 			(this as any).syncSystem()
-				// 		}
-				// 	}
-				// },
+				{
+					name: '同步WMS', icon: 'el-icon-top', audit: [''], event: {
+						click: () => {
+							(this as any).syncSystem2()
+						}
+					}
+				},
 			]
 		}
 		skuConfig : any = {
@@ -181,7 +182,7 @@
 		config : any = {
 			search: {
 				attr: {
-					size: 'mini'
+					size: 'mini',
 				},
 				columns: [
 					[
@@ -218,21 +219,23 @@
 					search: true,
 					refresh: true,
 				},
-				// customTools: [
-				// 	{
-				// 		name: '同步到财务系统', icon: 'el-icon-top', audit: [''], event: {
-				// 			click: () => {
-				// 				(this as any).syncSystem()
-				// 			}
-				// 		}
-				// 	},
-				// ]
+				customTools: [
+					{
+						name: '同步WMS', icon: 'el-icon-top', audit: [''], event: {
+							click: () => {
+								(this as any).syncSystem()
+							}
+						}
+					},
+				]
 			},
 			table: {
 				attr: {
 					size: 'mini',
 					align: 'left',
-					height: '620'
+					height: '620',
+					checkbox: true,
+					triggerRowCheck:'row'
 				},
 				columns: [
 					{
@@ -340,7 +343,49 @@
 			this.config.table.attr.height = window.innerHeight - 320;
 			(this as any).$refs.moduleView.$refs[tableId].recalculate();
 		}
-
+		// 同步财务系统
+		syncSystem() {
+			let selectData = (this as any).$refs.moduleView.getSelectData();
+			if (selectData.length > 0) {
+				// if (selectData.length > 1) return this.$message.warning('只能同步一条数据');
+				// if (selectData[0].financialCode) return this.$message.warning('此数据已同步WMS');
+				this.$confirm('确定同步WMS吗', '注意', {
+					confirmButtonText: '确定',
+					cancelButtonText: '取消',
+					type: 'warning',
+					center: true
+				}).then(() => {
+					let ids = '';
+					selectData.map((v : any) => {
+						ids += v.id + ','
+					})
+					ids = ids.slice(0, ids.length - 1);
+					let loading = this.$loading({ target: '.main-container' });
+					api.WMSPushProducts({ ids: ids }).then((res : any) => {
+						if (res.code === 200) {
+							this.$message.success('同步WMS成功');
+							loading.close();
+						} else loading.close();
+					}).catch(() => loading.close());
+				}).catch(() => this.$message.info('已取消同步WMS'));
+			} else this.$message.warning('请选择同步数据');
+		}
+		syncSystem2() {
+			this.$confirm('确定同步WMS吗', '注意', {
+				confirmButtonText: '确定',
+				cancelButtonText: '取消',
+				type: 'warning',
+				center: true
+			}).then(() => {
+				let loading = this.$loading({ target: '.main-container' });
+				api.WMSPushProducts({ ids: this.baseInfo.id }).then((res : any) => {
+					if (res.code === 200) {
+						this.$message.success('同步WMS成功');
+						loading.close();
+					} else loading.close();
+				}).catch(() => loading.close());
+			}).catch(() => this.$message.info('已取消同步WMS'));
+		}
 		// 保存
 		doFormData() {
 			let data : any = (this as any).$refs.addFormId.getValue()
@@ -387,6 +432,7 @@
 			let loading = this.$loading({ target: '.main-container' });
 			api.single({ id: e.id }, 'maindataMaterialSku').then((res : any) => {
 				if (res.code === 200) {
+					this.baseInfo = res.data;
 					this.isShow = 'detail';
 					loading.close();
 					setTimeout(() => { (this as any).$refs.addFormId.setValue([res.data]) }, 0);