Przeglądaj źródła

销售订单出库第一版

AlanWong 2 lat temu
rodzic
commit
dcdd5cd90c

+ 12 - 4
src/api/order.ts

@@ -25,6 +25,13 @@ function saveList(data : any, url : any) {
 		data: data
 	})
 }
+function outbound(data : any, url : any) {
+	return request({
+		url: '/supply/' + url + '/outbound',
+		method: 'POST',
+		data: data
+	})
+}
 // 提交数据
 function submitTo(data : any, url : any) {
 	return request({
@@ -83,10 +90,10 @@ function splitOrder(data : any, url : any) {
 		data: data
 	})
 }
-// 退
-function backOrder(data : any, url : any, mid : any) {
+// 终止订
+function stoporder(data : any, url : any) {
 	return request({
-		url: '/supply/' + url + '/backOrder?mid=' + mid,
+		url: '/supply/' + url + '/stoporder',
 		method: 'POST',
 		data: data
 	})
@@ -102,12 +109,13 @@ export default {
 	treeList,
 	pageList,
 	saveList,
+	outbound,
 	updateList,
 	deleteList,
 	selectDeleteList,
 	ordersaccepting,
 	splitOrder,
-	backOrder,
+	stoporder,
 	submitTo,
 	cancelSubmission,
 	getbusinessType

+ 1 - 1
src/benyun/components/byBill/byBill.vue

@@ -275,7 +275,7 @@
 			let d : Array<any> = [];
 			const code = 'source_' + n;
 			if (this.$refs[code]) {
-				d = (this.$refs[code] as any)[0]?.getTableValue()
+				d = (this.$refs[code] as any)[0]?.getSelectTable()
 			}
 			return d;
 		}

+ 2 - 0
src/views/audit/orderTask/components/focus.vue

@@ -28,6 +28,8 @@
 		confirm(e : any) {
 			this.value = e[0].name;
 			this.$emit('getSupplierModal', e[0])
+			// this.$emit('onChange', e[0])
+			
 		}
 	}
 </script>

+ 71 - 34
src/views/audit/outbound/index.vue

@@ -89,7 +89,7 @@
 							{
 								name: '引单', icon: 'el-icon-bottom', audit: [''], event: {
 									click: () => {
-										// (this as any).onAdd('all')
+										(this as any).citationOrder()
 									}
 								}
 							},
@@ -101,14 +101,13 @@
 							size: 'mini',
 							seq: true,
 							align: 'left',
-							radio: true
+							checkbox: true
 						},
 						columns: [
 							{
 								width: 144,
 								title: '单据编号',
 								field: 'orderNumber',
-								isDetail: true,
 							},
 							// {
 							// 	width: 50,
@@ -164,11 +163,11 @@
 					attr: {
 						size: 'small',
 						readonly: false,
-						rules: {
-							outOrderNo: [{
-								required: true, message: '请输入单据编号', trigger: 'blur'
-							}]
-						}
+						// rules: {
+						// 	outOrderNo: [{
+						// 		required: true, message: '请输入单据编号', trigger: 'blur'
+						// 	}]
+						// }
 					},
 					columns: [
 						[
@@ -658,7 +657,7 @@
 							}
 						},
 						{
-							name: '删除', icon: 'el-icon-top', audit: [''], event: {
+							name: '删除', icon: 'el-icon-delete', audit: [''], event: {
 								click: () => {
 									(this as any).onDelete('all')
 								}
@@ -877,6 +876,17 @@
 				this.getDataList()
 			}, 500)
 		}
+		// 引单
+		citationOrder() {
+			console.log();
+			let data : any = (this as any).$refs.bill.getSourceTableSelectData(0);
+			console.log(data);
+			(this.$refs.bill as any).showTab = 'bill';
+			setTimeout(() => {
+				(this.$refs.bill as any).setBillFormValue(data[0]); // 设置单据表单数据
+				(this.$refs.bill as any).setBillTableValue(data[0].suborderList, 0);// 设置第1张单据表格数据
+			}, 0)
+		}
 		// 获取机构数据
 		getSupplierModal(e : any) {
 			this.supplierInfo = e;
@@ -923,12 +933,16 @@
 			console.log('保存 ==>', this.tabType);
 			(this as any).$refs.bill.$refs.billForm.validate().then(() => {
 				let query = (this.$refs.bill as any).getBillFormValue(); // 获取单据数据
+				console.log(query);
 				// 供应商数据
 				if (!query.organizationName) query.organizationName = this.supplierInfo.name;
 				if (!query.organizationId) query.organizationId = this.supplierInfo.id;
 				if (!query.organizationName) return this.$message.warning('请选择机构名称');
 				// 子表数据
-				query.suborderList = this.tableData;
+				// query.suborderList = this.tableData;
+				query.purchaseOrderId = query.id;
+				query.suborderList = (this.$refs.bill as any).getBillTableData(0);
+				query.businessType = "销售类型";
 				if (query.suborderList.length > 0) {
 					for (let v of query.suborderList) {
 						console.log(v.prePrice);
@@ -936,12 +950,17 @@
 						if (!v.unitPrice || v.unitPrice <= 0) return this.$message.warning('请输入正确物料单价');
 						if (v.prePrice.length <= 0 || v.prePrice < 0) return this.$message.warning('请输入正确优惠金额');
 						v.taskOrderId = query.id;
-						v.storehouseName = '我是仓库';
-						v.storehouseId = 2;
-						v.storingLocationName = '我是仓位';
-						v.storingLocationId = 4;
+						v.purchaseSuborderId = v.id;
+						v.storehouseName = '三号仓库';
+						v.storehouseId = 3;
+						v.storingLocationName = '七号仓位';
+						v.storingLocationId = 7;
 					}
 				};
+				query.suborderList.map((v : any) => {
+					delete v.id;
+				});
+				delete query.id;
 				// 表格删除
 				query.suborderList.map((v : any, i : any) => {
 					if (v.isDeleted === 1 && !v.id) {
@@ -949,30 +968,35 @@
 					}
 				});
 				if (query.deliveryData) query.deliveryData = query.deliveryData + ' 00:00:00';
-				console.log('保存参数query ==> ', query);
-
+				console.log('出库参数query ==> ', query);
+				api.outbound(query, 'supplyOutOrder').then((res : any) => {
+					if (res.code === 200) {
+						this.$message.success(res.msg);
+						this.getDataList();
+						(this.$refs.bill as any).showTab = 'all';
+						(this.$refs.bill as any).setBillFormValue({});
+					} else this.$message.error(res.msg);
+				})
 				if (this.isAdd) {
-					query.submitState = 0
-					console.log('保存进草稿箱 ==>', query);
-					api.saveList(query, 'supplyOutOrder').then((res : any) => {
-						if (res.code === 200) {
-							this.$message.success(res.msg);
-							this.getDataList();
-							(this.$refs.bill as any).showTab = 'all';
-							(this.$refs.bill as any).setBillFormValue({});
-						} else this.$message.error(res.msg);
-					})
+					// api.saveList(query, 'supplyOutOrder').then((res : any) => {
+					// 	if (res.code === 200) {
+					// 		this.$message.success(res.msg);
+					// 		this.getDataList();
+					// 		(this.$refs.bill as any).showTab = 'all';
+					// 		(this.$refs.bill as any).setBillFormValue({});
+					// 	} else this.$message.error(res.msg);
+					// })
 				} else if (this.tabType === 'all' || this.tabType === 'draftsBox') {
 					if (this.tabType === 'draftsBox') query.submitState = 0;
 					console.log('保存 ==>', query);
-					api.updateList(query, 'supplyOutOrder').then((res : any) => {
-						if (res.code === 200) {
-							this.$message.success(res.msg);
-							this.getDataList();
-							(this.$refs.bill as any).showTab = 'all';
-							(this.$refs.bill as any).setBillFormValue({});
-						} else this.$message.error(res.msg);
-					})
+					// api.updateList(query, 'supplyOutOrder').then((res : any) => {
+					// 	if (res.code === 200) {
+					// 		this.$message.success(res.msg);
+					// 		this.getDataList();
+					// 		(this.$refs.bill as any).showTab = 'all';
+					// 		(this.$refs.bill as any).setBillFormValue({});
+					// 	} else this.$message.error(res.msg);
+					// })
 				};
 			})
 		}
@@ -1064,6 +1088,19 @@
 			console.log('切换tab ==> ', e);
 			this.tabType = e;
 			// submitState: 提交状态
+			if (e === 'source') {
+				api.pageList({}, 'supplyPurchaseOrder').then((res : any) => {
+					if (res.code === 200) {
+						(this.$refs.bill as any).setSourceTableData(0, res.data.records);
+						let page = {
+							pageNo: res.data.current, //当前页
+							pageSize: res.data.size, //每页条数
+							total: res.data.total //总条数
+						};
+						(this.$refs.bill as any).setSourcePage(0, page)
+					} else this.failHandle(res)
+				})
+			}
 			if (e === 'all') this.getPageList({ pageSize: 10, pageNo: 1 }, 'all'); // 草稿箱数据
 			if (e === 'draftsBox') this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据
 			if (e === 'smt') this.getPageList({ submitState: 1 }, 'smt'); // 已提交数据

+ 2 - 2
src/views/audit/saleOrder/components/orderType.vue

@@ -1,8 +1,8 @@
 <template>
 	<div @click="onChange" class="orderType">
 		{{propValue}}
-		<div class="typeText" v-if="parentValue.isMaster===1" key="master1">拆</div>
-		<div class="typeText typeText2" v-else key="master2">拆</div>
+		<div class="typeText" v-if="parentValue.isMaster===1" key="master1">拆</div>
+		<div class="typeText typeText2" v-else key="master2">拆</div>
 	</div>
 </template>
 

+ 4 - 5
src/views/audit/saleOrder/index.vue

@@ -653,13 +653,12 @@
 		doBackOrder() {
 			let selectData = (this as any).$refs.bill.getTableSelectData('all');
 			if (selectData.length > 1) return this.$message.warning('只能选择一条退单数据')
-			let ids = '';
+			let ids:any = [];
 			if (selectData.length > 0) {
 				selectData.map((v : any) => {
-					ids += v.id + ','
+					ids.push(v.id);
 				})
 			} else return this.$message({ type: 'warning', message: '请选择退单数据' })
-			ids = ids.slice(0, ids.length - 1);
 			selectData[0].suborderList.map((v : any) => {
 				delete v.id;
 			})
@@ -669,7 +668,7 @@
 				type: 'warning',
 				center: true
 			}).then(() => {
-				api.backOrder(selectData[0].suborderList, 'supplyPurchaseOrder', ids).then((res : any) => {
+				api.stoporder({ids:ids}, 'supplyPurchaseOrder').then((res : any) => {
 					if (res.code === 200) {
 						this.$message.success('退单成功!');
 						this.getDataList();
@@ -700,7 +699,7 @@
 				type: 'warning',
 				center: true
 			}).then(() => {
-				api.backOrder(e.suborderList, 'supplyPurchaseOrder', e.id).then((res : any) => {
+				api.stoporder([e.id], 'supplyPurchaseOrder').then((res : any) => {
 					if (res.code === 200) {
 						this.$message.success('退单成功!');
 						this.getDataList();

+ 1 - 1
src/views/audit/warehousing/components/businessType.vue

@@ -28,7 +28,7 @@
 			});
 		}
 		change(e : any) {
-			this.$emit('getbusinessType', e)
+			this.$emit('onChange', e)
 		}
 	}
 </script>

+ 15 - 5
src/views/audit/warehousing/components/towInOne.vue

@@ -47,8 +47,11 @@
 					compConfig: {
 						attr: {
 							placeholder: '请选择仓库',
-							clearable: true
-						}
+							retConfig: {
+								storehouseName: 'name',
+								storehouseId: 'id'
+							},
+						},
 					}
 				}, {
 					span: 11,
@@ -58,7 +61,10 @@
 					compConfig: {
 						attr: {
 							placeholder: '请选择仓位',
-							clearable: true
+							retConfig: {
+								storingLocationName: 'name',
+								storingLocationId: 'id'
+							},
 						}
 					}
 				}]
@@ -78,8 +84,12 @@
 			this.vxeValue = true;
 		}
 		// 确定仓库仓位
-		doConfirm(e : any) {
-			console.log((this as any).$refs.form.getValue());
+		doConfirm() {
+			let data : any = (this as any).$refs.form.getValue();
+			data.towInOne = data.storehouseName + ',' + data.storingLocationName;
+			if (!data.storehouseId || !data.storingLocationId) return this.$message.warning('仓库仓位为必填项');
+			this.$emit('onChange', data);
+			this.vxeValue = false;
 		}
 	}
 </script>

+ 20 - 27
src/views/audit/warehousing/index.vue

@@ -2,7 +2,7 @@
 	<div>
 		<by-bill ref="bill" :propConfig="config" @search="search" @onAdd="onAdd" @onDelete="onDelete" @onRefresh="resert"
 			@resert="resert" @detail="openEdit" @onSave="onSave" @clickTab="clickTab" @onChangeRow="onChangeRow"
-			@pagination="pagination" @getSupplierModal="getSupplierModal" @getbusinessType="getbusinessType">
+			@pagination="pagination" @getSupplierModal="getSupplierModal">
 		</by-bill>
 		<!-- 选择物料 -->
 		<productModal ref="product" :mulit="true" @confirm="confirmProduct" />
@@ -289,9 +289,9 @@
 							field: 'operator',
 						},
 						{
-							width: 250,
-							title: '备注',
-							field: 'remark',
+							width: 90,
+							title: '业务类型',
+							field: 'businessType',
 						},
 						{
 							width: 110,
@@ -408,9 +408,9 @@
 							field: 'operator',
 						},
 						{
-							width: 250,
-							title: '备注',
-							field: 'remark',
+							width: 90,
+							title: '业务类型',
+							field: 'businessType',
 						},
 						{
 							width: 110,
@@ -527,9 +527,9 @@
 							field: 'operator',
 						},
 						{
-							width: 250,
-							title: '备注',
-							field: 'remark',
+							width: 90,
+							title: '业务类型',
+							field: 'businessType',
 						},
 						{
 							width: 120,
@@ -644,9 +644,9 @@
 							field: 'operator',
 						},
 						{
-							width: 250,
-							title: '备注',
-							field: 'remark',
+							width: 90,
+							title: '业务类型',
+							field: 'businessType',
 						},
 						{
 							width: 110,
@@ -665,7 +665,6 @@
 						}
 					]
 				}
-
 			}
 		}
 		created() {
@@ -677,11 +676,6 @@
 		getSupplierModal(e : any) {
 			this.supplierInfo = e;
 		}
-		// 获取业务类型
-		getbusinessType(e : any) {
-			console.log(e);
-			this.businessType = e;
-		}
 		// 监听表格数据变化
 		onChangeRow(e : any) {
 			e.totalPrice = parseFloat((e.number * e.unitPrice).toFixed(2));
@@ -723,12 +717,11 @@
 			// console.log('保存 ==>', this.tabType);
 			(this as any).$refs.bill.$refs.billForm.validate().then(() => {
 				let query = (this.$refs.bill as any).getBillFormValue(); // 获取单据数据
+				console.log('单据表单数据 ==> ', query);
 				// 供应商数据
 				if (!query.organizationName) query.organizationName = this.supplierInfo.name;
 				if (!query.organizationId) query.organizationId = this.supplierInfo.id;
-				if (!query.businessType) query.businessType = this.businessType;
 				if (!query.organizationName) return this.$message.warning('请选择机构名称');
-				if (!query.businessType) return this.$message.warning('请选择业务类型');
 				// 子表数据
 				query.suborderList = this.tableData;
 				if (query.suborderList.length > 0) {
@@ -737,10 +730,6 @@
 						if (!v.unitPrice || v.unitPrice <= 0) return this.$message.warning('请输入正确物料单价');
 						if (v.prePrice.length <= 0 || v.prePrice < 0) return this.$message.warning('请输入正确优惠金额');
 						if (query.id) v.taskOrderId = query.id;
-						v.storehouseName = '我是仓库';
-						v.storehouseId = 2;
-						v.storingLocationName = '我是仓位';
-						v.storingLocationId = 4;
 					}
 				};
 				// 表格删除
@@ -853,8 +842,12 @@
 			readonly.tool.tools = {};
 			readonly.tableConfig[0].table.columns = readonly.tableConfig[0].table.columns.filter((v : any) => v.title != '操作');
 			readonly.tableConfig[0].tool.tools = {};
-			console.log(readonly.tableConfig[0].table.columns.slice(0, -1));
+			// console.log(readonly.tableConfig[0].table.columns.slice(0, -1));
 			let data = e.suborderList;
+			data.map((v : any, i : any) => {
+				if (!v.prePrice) v.prePrice = '0';
+				v.towInOne = v.storehouseName + ',' + v.storingLocationName; // 仓库仓位
+			});
 			(this.$refs.bill as any).setBillConfig(readonly);
 			(this.$refs.bill as any).setBillFormValue(e);// 设置单据表单数据
 			(this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
@@ -946,7 +939,7 @@
 		}
 		// 刷新/重置
 		resert(e : any) {
-			let data:any = e.type ? e.type : e;
+			let data : any = e.type ? e.type : e;
 			(this as any).$refs.bill.$refs[data].clearSearch();
 			if (data === 'all') this.getPageList({}, 'all'); // 综合数据
 			if (data === 'draftsBox') this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据