瀏覽代碼

关联金蝶财务系统物料功能模块
同步金蝶物料功能
商品库存修改可以编辑

hcf 1 年之前
父節點
當前提交
4f834391d8
共有 3 個文件被更改,包括 324 次插入73 次删除
  1. 22 1
      src/api/currency.ts
  2. 272 71
      src/views/audit/productManagement/index.vue
  3. 30 1
      src/views/audit/sku/index.vue

+ 22 - 1
src/api/currency.ts

@@ -94,6 +94,25 @@ function getMaterialInventory(data? : any) {
 		params: data
 	})
 }
+
+// 同步财务系统物料到OMS
+function syncMaterialByKingdeeToOmsy(data? : any) {
+	return request({
+		url: '/supply/financeApi/syncMaterialByKingdeeToOms',
+		method: 'GET',
+		params: data
+	})
+}
+
+// 根据时间段获取财务系统物料信息(获取金蝶物料列表)
+function getFinancialCode(data? : any) {
+	return request({
+		url: '/supply/financeApi/getFinancialCode',
+		method: 'GET',
+		params: data
+	})
+}
+
 export default {
 	treeList,
 	treeUseList,
@@ -106,5 +125,7 @@ export default {
 	deleteList,
 	delCategoryId,
 	WMSPushProducts,
-	getMaterialInventory
+	getMaterialInventory,
+	syncMaterialByKingdeeToOmsy,
+	getFinancialCode
 }

+ 272 - 71
src/views/audit/productManagement/index.vue

@@ -14,6 +14,7 @@
 		<div class="detil" v-show="isShow==='add'" key="item3">
 			<by-tool :propConfig="toolConfig" @clickHandle="insideTools" ref="byTool" />
 			<div class="box-shadow">
+				<el-button style="margin-bottom: 20px;" type="primary" icon="el-icon-sort" @click="openVxeData">关联金蝶财务系统物料</el-button>
 				<by-form :propConfig="formConfig" ref="form">
 					<template v-slot:description>
 						<el-input type="textarea" :rows="5" placeholder="请输入内容" v-model="textarea">
@@ -110,14 +111,59 @@
 			</div>
 		</div>
 		<!-- 选择物料 -->
-		<productModal ref="product" :mulit="true" @confirm="confirmProduct" />
+		<!-- <productModal ref="product" :mulit="true" @confirm="confirmProduct" /> -->
 		
-		<vxe-modal v-model="vxeValue" width="60%" height="70%" show-zoom resize transfer show-footer>
+		<vxe-modal v-model="vxeValue" width="48%" height="88%" show-zoom resize transfer show-footer>
 			<template #title>
-				<span>选择物料</span>
+				<span>关联金蝶财务系统物料</span>
 			</template>
 			<template #default>
-				<by-table :propConfig="config" ref="form" style="margin-top: 10px;"></by-table>
+				<el-form ref="tableSearchForm" :inline="true" :model="tableSearchForm" label-width="80px">
+					<el-form-item label="标题">
+						<el-input style="width: 220px;" v-model="tableSearchForm.fname" placeholder="请输入标题" clearable></el-input>
+					</el-form-item>
+					<el-form-item label="财务编号">
+						<el-input style="width: 220px;" v-model="tableSearchForm.fnumber" placeholder="请输入财务编号" clearable></el-input>
+					</el-form-item>
+					<el-form-item label="开始时间">
+						<el-date-picker style="width: 220px;" v-model="tableSearchForm.stime" type="date" placeholder="选择日期" :clearable="false" value-format="yyyy-MM-dd"></el-date-picker>
+					</el-form-item>
+					<el-form-item label="结束时间">
+						<el-date-picker style="width: 220px;" v-model="tableSearchForm.etime" type="date" placeholder="选择日期" :clearable="false" value-format="yyyy-MM-dd"></el-date-picker>
+					</el-form-item>
+					<el-form-item>
+						<el-button type="primary" @click="tableSearchOnSubmit">搜索</el-button>
+						<el-button @click="resetTableSearch">重置</el-button>
+					</el-form-item>
+				</el-form>
+				<el-table
+				    ref="multipleTable" 
+				    :data="newtableData"
+					v-loading="tableloading"
+					stripe
+					border
+				    style="width: 100%"
+					:header-cell-style="{ background: '#f3f6fd', color: '#555'}">
+				    <el-table-column
+						width="55">
+						<template slot-scope="scope">
+					        <el-radio v-model="tableRadio" :label="scope.row" @input="handleSelectionChange">{{""}}</el-radio>
+					    </template>
+				    </el-table-column>
+				    <el-table-column prop="fname" label="标题"></el-table-column>
+				    <el-table-column prop="fnumber" label="财务编号"></el-table-column>
+				    <el-table-column prop="fbaseUnitName" label="单位"></el-table-column>
+				    <el-table-column prop="fbaseUnitCode" label="单位编码"></el-table-column>
+				</el-table>
+				<el-pagination
+					style="margin-top: 25px;"
+					background
+					layout="prev, pager, next"
+					:page-size="tablePageSize"
+					:current-page="tablePageNum"
+					:total="tableDataTotal"
+					@current-change="currentChange">
+				</el-pagination>
 			</template>
 			<template #footer>
 				<div class="btn">
@@ -127,6 +173,23 @@
 			</template>
 		</vxe-modal>
 		
+		<el-dialog
+			title="同步金蝶物料"
+			v-loading="dateLoading"
+			:visible.sync="dateDialogVisible"
+			:close-on-click-modal='false'
+			:close-on-press-escape='false'
+			:show-close='false'
+			width="518px">
+			<el-date-picker	v-model="stime" type="date" placeholder="选择日期" value-format="yyyy-MM-dd"></el-date-picker>
+			<span style="margin: 0 12px;">至</span>
+			<el-date-picker	v-model="etime" type="date" readonly placeholder="选择日期"></el-date-picker>
+			<span slot="footer" class="dialog-footer">
+				<el-button @click="dateDialogVisible = false">取 消</el-button>
+				<el-button type="primary" @click="dateConfirm">确 定</el-button>
+			</span>
+		</el-dialog>
+		
 	</div>
 </template>
 <script lang="ts">
@@ -169,6 +232,11 @@
 		attributeId : any = ''
 		intercept : any = ''
 		makeupList : any = [] // 组合商品列表
+		
+		dateDialogVisible = false
+		dateLoading = false
+		stime = null
+		etime = new Date()
 		// tab
 		toolConfig = {
 			tools: {
@@ -197,7 +265,7 @@
 			},
 			columns: [
 				{
-					width: '150px',
+					// width: '150px',
 					title: '标题',
 					field: 'skuTitle',
 					component: 'by-input',
@@ -209,7 +277,7 @@
 					}
 				},
 				{
-					width: '120px',
+					// width: '150px',
 					title: '副标题',
 					field: 'skuSubtitle',
 					component: 'by-input',
@@ -221,7 +289,7 @@
 					}
 				},
 				{
-					width: '140px',
+					// width: '150px',
 					title: '物料编码',
 					field: 'skuCode',
 					component: 'by-input',
@@ -237,7 +305,7 @@
 				// 	component: selectKin
 				// },
 				{
-					width: '140px',
+					// width: '150px',
 					title: '财务编号',
 					field: 'financialCode',
 					component: 'by-input',
@@ -362,21 +430,21 @@
 					title: '体积/cm³',
 					field: 'volume',
 				},
-				{
-					width: '100px',
-					title: '操作',
-					action: true,
-					plugins: [{
-						icon: 'el-icon-edit',
-						name: '选择物料',
-						audit: '',
-						event: {
-							click: () => {
-								(this as any).openVxeData(1)
-							}
-						}
-					}]
-				}
+				// {
+				// 	width: '100px',
+				// 	title: '操作',
+				// 	action: true,
+				// 	// plugins: [{
+				// 	// 	icon: 'el-icon-edit',
+				// 	// 	name: '选择物料',
+				// 	// 	audit: '',
+				// 	// 	event: {
+				// 	// 		click: () => {
+				// 	// 			(this as any).openVxeData(1)
+				// 	// 		}
+				// 	// 	}
+				// 	// }]
+				// }
 			]
 		}
 		tableConfig : any = {
@@ -554,25 +622,28 @@
 					width: '180px',
 					title: '操作',
 					action: true,
-					plugins: [{
-						icon: 'el-icon-edit',
-						name: '选择物料',
-						audit: '',
-						event: {
-							click: () => {
-								(this as any).openVxeData(2)
-							}
-						}
-					},{
-						icon: 'el-icon-delete',
-						name: '删除',
-						audit: '',
-						event: {
-							click: (item : any) => {
-								(this as any).doDeleteTable(item)
+					plugins: [
+						// {
+						// 	icon: 'el-icon-edit',
+						// 	name: '选择物料',
+						// 	audit: '',
+						// 	event: {
+						// 		click: () => {
+						// 			(this as any).openVxeData(2)
+						// 		}
+						// 	}
+						// },
+						{
+							icon: 'el-icon-delete',
+							name: '删除',
+							audit: '',
+							event: {
+								click: (item : any) => {
+									(this as any).doDeleteTable(item)
+								}
 							}
-						}
-					}]
+						},
+					]
 				}
 			]
 		}
@@ -921,15 +992,15 @@
 					search: true,
 					refresh: true,
 				},
-				// customTools: [
-				// 	{
-				// 		name: '同步到财务系统', icon: 'el-icon-top', audit: [''], event: {
-				// 			click: () => {
-				// 				(this as any).syncSystem()
-				// 			}
-				// 		}
-				// 	},
-				// ]
+				customTools: [
+					{
+						name: '同步金蝶物料', icon: 'el-icon-top', audit: [''], event: {
+							click: () => {
+								(this as any).syncSystem()
+							}
+						}
+					},
+				]
 			},
 			table: {
 				attr: {
@@ -985,11 +1056,32 @@
 				}]
 			},
 		}
+		
+		tableloading = false
+		tableRadio: any = {}
+		tableData: any = []
+		newtableData: any = []
+		tableSearchForm: any = {}
+		tableDataTotal: any = 0
+		tablePageSize: any = 10
+		tablePageNum: any = 1
+		
 		mounted() {
 			this.getAttribute()
 			this.timer = setInterval(() => {
 				this.getDataList()
 			}, 500)
+			
+			// 获取关联金蝶财务系统物料列表
+			var t = new Date();
+			var y = t.getFullYear();
+			var m:any = t.getMonth()+1;
+			if(m<10){m='0'+m}
+			var d:any = t.getDate()
+			if(d<10){d='0'+d}
+			this.tableSearchForm.stime = '2020-01-01';
+			this.tableSearchForm.etime = y+'-'+m+'-'+d;
+			this.getFinancialCode()
 		}
 		// 确定商品新增
 		confirmProduct(e : any) {
@@ -1072,20 +1164,20 @@
 					console.log('多规格表格数据 ==> ', this.tableList);
 					for (let v of this.tableList) {
 						if (!v.price) return this.$message.warning('物料属性价格必填');
-						if (parseInt(v.price) <= 0) return this.$message.warning('物料属性价格不能小于1');
+						// if (parseInt(v.price) <= 0) return this.$message.warning('物料属性价格不能小于1');
 						if (!v.unit) return this.$message.warning('物料属性单位必填');
 						if (!v.stock) return this.$message.warning('物料属性库存必填');
-						if (parseInt(v.stock) <= 0) return this.$message.warning('物料属性库存必须为自然数');
+						// if (parseInt(v.stock) <= 0) return this.$message.warning('物料属性库存必须为自然数');
 						if (!v.shelfLife) return this.$message.warning('物料属性保质期必填');
-						if (parseInt(v.shelfLife) <= 0) return this.$message.warning('物料属性保质期必须为自然数');
+						// if (parseInt(v.shelfLife) <= 0) return this.$message.warning('物料属性保质期必须为自然数');
 						if (!v.weight) return this.$message.warning('物料属性重量必填');
-						if (parseInt(v.weight) <= 0) return this.$message.warning('物料属性重量不能小于1');
+						// if (parseInt(v.weight) <= 0) return this.$message.warning('物料属性重量不能小于1');
 						if (!v.length) return this.$message.warning('物料属性长度必填');
-						if (parseInt(v.length) <= 0) return this.$message.warning('物料属性长度不能小于1');
+						// if (parseInt(v.length) <= 0) return this.$message.warning('物料属性长度不能小于1');
 						if (!v.width) return this.$message.warning('物料属性宽度必填');
-						if (parseInt(v.width) <= 0) return this.$message.warning('物料属性宽度不能小于1');
+						// if (parseInt(v.width) <= 0) return this.$message.warning('物料属性宽度不能小于1');
 						if (!v.height) return this.$message.warning('物料属性高度必填');
-						if (parseInt(v.height) <= 0) return this.$message.warning('物料属性高度不能小于1');
+						// if (parseInt(v.height) <= 0) return this.$message.warning('物料属性高度不能小于1');
 					};
 					data = { maindataMaterialReceiveParam: query, maindataMaterialSkus: this.tableList }
 					let newArray : any = []
@@ -1115,18 +1207,18 @@
 						// if (parseInt(v.price) <= 0) return this.$message.warning('物料价格不能小于1');
 						if (parseInt(v.price) < 0) return this.$message.warning('物料价格不能为负数');
 						if (!v.unit) return this.$message.warning('物料单位必填');
-						if (!v.stock) return this.$message.warning('物料库存必填');
-						if (parseInt(v.stock) <= 0) return this.$message.warning('物料库存必须为自然数');
+						// if (!v.stock) return this.$message.warning('物料库存必填');
+						// if (parseInt(v.stock) <= 0) return this.$message.warning('物料库存必须为自然数');
 						if (!v.shelfLife) return this.$message.warning('物料保质期必填');
-						if (parseInt(v.shelfLife) <= 0) return this.$message.warning('物料保质期必须为自然数');
+						// if (parseInt(v.shelfLife) <= 0) return this.$message.warning('物料保质期必须为自然数');
 						if (!v.weight) return this.$message.warning('物料重量必填');
-						if (parseInt(v.weight) <= 0) return this.$message.warning('物料重量不能小于1');
+						// if (parseInt(v.weight) <= 0) return this.$message.warning('物料重量不能小于1');
 						if (!v.length) return this.$message.warning('物料长必填');
-						if (parseInt(v.length) <= 0) return this.$message.warning('物料长不能小于1');
+						// if (parseInt(v.length) <= 0) return this.$message.warning('物料长不能小于1');
 						if (!v.width) return this.$message.warning('物料宽必填');
-						if (parseInt(v.width) <= 0) return this.$message.warning('物料宽不能小于1');
+						// if (parseInt(v.width) <= 0) return this.$message.warning('物料宽不能小于1');
 						if (!v.height) return this.$message.warning('物料高必填');
-						if (parseInt(v.height) <= 0) return this.$message.warning('物料高不能小于1');
+						// if (parseInt(v.height) <= 0) return this.$message.warning('物料高不能小于1');
 					};
 					data.maindataMaterialSkus[0].isDeleted = 0;
 					data.maindataMaterialReceiveParam.attributeList = ""
@@ -1339,9 +1431,29 @@
 				}
 			}).catch(() => loading.close());
 		}
-		// 同步到财务系统
+		// 同步金蝶物料
 		syncSystem() {
-
+			(this as any).dateDialogVisible = true
+		}
+		dateConfirm(){
+			if((this as any).stime){
+				(this as any).dateLoading = true;
+				api.syncMaterialByKingdeeToOmsy({stime: (this as any).stime}).then((res : any) => {
+					if(res.code === 200){
+						(this as any).dateDialogVisible = false;
+						(this as any).dateLoading = false;
+						this.$message.success('同步金蝶物料成功');
+					}else{
+						(this as any).dateLoading = false;
+						this.$message.error(res.msg);
+					}
+				}).catch(()=>{
+					(this as any).dateLoading = false;
+				})
+			}else{
+				this.$message.warning('请选择时间');
+			}
+			
 		}
 		// 立即生成
 		generateNow() {
@@ -1448,14 +1560,103 @@
 				})
 			}).catch(() => { });
 		}
-		// 打开物料选择
+		// 关联金蝶财务系统物料选择
+		handleSelectionChange(row: any){
+			console.log(row)
+			this.tableRadio = row
+		}
+		// 关联金蝶财务系统物料列表搜索
+		tableSearchOnSubmit(){
+			this.getFinancialCode()
+		}
+		// 关联金蝶财务系统物料列表重置
+		resetTableSearch(){
+			var t = new Date();
+			var y = t.getFullYear();
+			var m:any = t.getMonth()+1;
+			if(m<10){m='0'+m}
+			var d:any = t.getDate()
+			if(d<10){d='0'+d}
+			this.tableSearchForm.fname = null;
+			this.tableSearchForm.fnumber = null;
+			this.tableSearchForm.stime = '2020-01-01';
+			this.tableSearchForm.etime = y+'-'+m+'-'+d;
+			this.getFinancialCode()
+		}
+		// 关联金蝶财务系统物料表格分页
+		currentChange(e: any){
+			this.newtableData = this.tableData.slice((e-1)*this.tablePageSize, e*this.tablePageSize)
+		}
+		// 打开关联金蝶财务系统物料选择
 		openVxeData(){
-			this.vxeValue = true
+			this.vxeValue = true;
 		}
-		// 确定仓库仓位
+		// 获取关联金蝶财务系统物料列表
+		getFinancialCode(){
+			this.tableloading = true;
+			api.getFinancialCode(this.tableSearchForm).then((res : any) => {
+				if(res.code==200){
+					this.tableloading = false;
+					this.tableData = res.data
+					if(this.tableSearchForm.fname || this.tableSearchForm.fnumber){
+						let newData =  [];
+						if(this.tableSearchForm.fname){
+							newData = this.tableData.filter((v : any) => v.fname.indexOf(this.tableSearchForm.fname) != -1);
+						}
+						if(this.tableSearchForm.fnumber){
+							newData = this.tableData.filter((v : any) => v.fnumber.indexOf(this.tableSearchForm.fnumber) != -1);
+						}
+						if(this.tableSearchForm.fname && this.tableSearchForm.fnumber){
+							newData = this.tableData.filter((v : any) => v.fname.indexOf(this.tableSearchForm.fname) != -1 && v.fnumber.indexOf(this.tableSearchForm.fnumber) != -1);
+						}
+						this.tableDataTotal = newData.length
+						this.newtableData = newData.slice(0, this.tablePageNum*this.tablePageSize)
+					}else{
+						this.tableDataTotal = this.tableData.length
+						this.newtableData = this.tableData.slice(0, this.tablePageNum*this.tablePageSize)
+					}
+				}else{
+					this.$message.error(res.msg);
+					this.tableloading = false;
+				}
+			})
+		}
+		// 确定关联金蝶财务系统物料
 		doConfirm() {
-			// let data : any = (this as any).$refs.form.getValue();
-			// this.$emit('onChange', data);
+			console.log(this.tableRadio)
+			if(JSON.stringify(this.tableRadio) === "{}" || this.tableRadio === null || this.tableRadio === {}) { return this.$message.warning('请选择物料'); }
+			// 表单赋值赋值
+			var val2 = (this as any).$refs.form.getValue();
+			console.log(val2)
+			val2.name = this.tableRadio.fname;
+			val2.shortName = this.tableRadio.fname;
+			// 物料属性赋值
+			var val = (this as any).$refs.singeTable.getValue();
+			if(JSON.stringify(val[0]) === "{}" || val[0] === null){
+				val = [{
+					skuTitle: this.tableRadio.fname,
+					skuSubtitle: this.tableRadio.fname,
+					skuCode: '',
+					financialCode: this.tableRadio.fnumber,
+					price: '0',
+					unit: this.tableRadio.fbaseUnitName,
+					unitCode: this.tableRadio.fbaseUnitCode,
+					shelfLife: '0',
+					weight: '0',
+					length: '0',
+					width: '0',
+					height: '0',
+					volume: '0',
+				}];
+			}else{
+				val.skuTitle = this.tableRadio.fname;
+				val.skuSubtitle = this.tableRadio.skuSubtitle;
+				val.financialCode = this.tableRadio.financialCode;
+				val.unit = this.tableRadio.unit;
+				val.unitCode = this.tableRadio.unitCode;
+			}
+			(this as any).$refs.singeTable.setValue(val);
+			(this as any).$refs.form.setValue(val2);
 			this.vxeValue = false;
 		}
 		// 切换组合商品

+ 30 - 1
src/views/audit/sku/index.vue

@@ -51,18 +51,39 @@
 					width: '200px',
 					title: '标题',
 					field: 'skuTitle',
+					component: 'by-input',
+					compConfig: {
+						attr: {
+							size: 'mini',
+							placeholder: ' '
+						},
+					}
 
 				},
 				{
 					width: '200px',
 					title: '副标题',
 					field: 'skuSubtitle',
+					component: 'by-input',
+					compConfig: {
+						attr: {
+							size: 'mini',
+							placeholder: ' '
+						},
+					}
 
 				},
 				{
 					width: '140px',
 					title: '物料编码',
 					field: 'skuCode',
+					component: 'by-input',
+					compConfig: {
+						attr: {
+							size: 'mini',
+							placeholder: ' '
+						},
+					}
 
 				},
 				{
@@ -81,6 +102,7 @@
 					width: '90px',
 					title: '价格',
 					field: 'price',
+					component: 'by-input',
 					compConfig: {
 						attr: {
 							size: 'mini',
@@ -94,6 +116,7 @@
 					width: '90px',
 					title: '单位',
 					field: 'unit',
+					component: 'by-input',
 					compConfig: {
 						attr: {
 							size: 'mini',
@@ -105,6 +128,7 @@
 					width: '90px',
 					title: '单位编码',
 					field: 'unitCode',
+					component: 'by-input',
 					compConfig: {
 						attr: {
 							size: 'mini',
@@ -116,6 +140,7 @@
 					width: '110px',
 					title: '保质期(天)',
 					field: 'shelfLife',
+					component: 'by-input',
 					compConfig: {
 						attr: {
 							size: 'mini',
@@ -128,6 +153,7 @@
 					width: '90px',
 					title: '重量/kg',
 					field: 'weight',
+					component: 'by-input',
 					compConfig: {
 						attr: {
 							size: 'mini',
@@ -140,6 +166,7 @@
 					width: '90px',
 					title: '长/cm',
 					field: 'length',
+					component: 'by-input',
 					compConfig: {
 						attr: {
 							size: 'mini',
@@ -152,6 +179,7 @@
 					width: '90px',
 					title: '宽/cm',
 					field: 'width',
+					component: 'by-input',
 					compConfig: {
 						attr: {
 							size: 'mini',
@@ -164,6 +192,7 @@
 					width: '90px',
 					title: '高/cm',
 					field: 'height',
+					component: 'by-input',
 					compConfig: {
 						attr: {
 							size: 'mini',
@@ -173,7 +202,7 @@
 					}
 				},
 				{
-					width: '90px',
+					// width: '90px',
 					title: '体积/cm³',
 					field: 'volume',
 				},