浏览代码

添加质检、检斤校验

wangchao 3 年之前
父节点
当前提交
7cfbb20718

+ 4 - 0
demo.vue

@@ -55,6 +55,10 @@
 			uni.hideLoading()
 			uni.hideLoading()
 			this.$forceUpdate()//刷新data数据
 			this.$forceUpdate()//刷新data数据
 			that.$api.msg('添加成功')
 			that.$api.msg('添加成功')
+			that.$refs.uToast.show({
+				title: '提交成功',
+				type: 'success'
+			})
 			uni.setStorageSync("depotAcquisition_warehouseName",this.warehouseName)
 			uni.setStorageSync("depotAcquisition_warehouseName",this.warehouseName)
 			uni.getStorageSync("depotAcquisition_warehouseName")
 			uni.getStorageSync("depotAcquisition_warehouseName")
 			// 公司id
 			// 公司id

+ 104 - 62
pages/erpbusiness/acquisitionInspection/grossWeightDetail.vue

@@ -46,60 +46,95 @@
 	export default {
 	export default {
 		data() {
 		data() {
 			return {
 			return {
-				tabbar:true,
+				tabbar: true,
 				windowHeight: '',
 				windowHeight: '',
 				detailData: {
 				detailData: {
-					grossWeight:''
-				}
+					grossWeight: ''
+				},
+				purchasePriceList: []
 			}
 			}
 		},
 		},
-		onShow() {},
+		onShow() {
+			this.$api.doRequest('get', '/qualityInspectionManagement/api/goodsName', {
+				warehouseId: this.detailData.warehouseId
+			}).then(res => {
+				if (res.data.code == 200) {
+					this.purchasePriceList = res.data.data
+				}
+			})
+		},
 		onLoad(options) {
 		onLoad(options) {
 			uni.onWindowResize((res) => {
 			uni.onWindowResize((res) => {
-			    if(res.size.windowHeight < this.windowHeight){
-			        this.tabbar = false
-			    }else{
-			        this.tabbar = true
-			   }
-			   })
+				if (res.size.windowHeight < this.windowHeight) {
+					this.tabbar = false
+				} else {
+					this.tabbar = true
+				}
+			})
 			this.detailData = JSON.parse(options.detailData)
 			this.detailData = JSON.parse(options.detailData)
 			uni.getSystemInfo({
 			uni.getSystemInfo({
-				success:(res) => {
+				success: (res) => {
 					this.windowHeight = res.windowHeight;
 					this.windowHeight = res.windowHeight;
 					// console.log(res)
 					// console.log(res)
-					this.system = res.system  // ios
-					this.platform = res.platform  // 14.3
+					this.system = res.system // ios
+					this.platform = res.platform // 14.3
 				}
 				}
 			})
 			})
 			console.log(this.detailData)
 			console.log(this.detailData)
 		},
 		},
 		methods: {
 		methods: {
-			submit(){
+			submit() {
 				let that = this
 				let that = this
 				uni.showModal({
 				uni.showModal({
-					content:"确定提交检斤信息?",
-					success:function(res) {
-						   if (res.confirm) {
-						           that.$api.doRequest('post', '/weighingManagement/api/editGrossWeight',that.detailData).then(res => {
-						           	if(res.data.code==200){
-						           		that.$refs.uToast.show({
-						           			title: '提交成功',
-						           			type: 'success'
-						           		})
-										uni.navigateBack({
-										})
-						           	}else{
-						           		that.$refs.uToast.show({
-						           			title: '提交失败',
-						           			type: 'error',
-						           		})
-						           	}
-						           })
-						        } else if (res.cancel) {
-						            console.log('用户点击取消');
-						        }
-						console.log(that.detailData)
-				
+					content: "确定提交检斤信息?",
+					success: function(res) {
+						if (res.confirm) {
+							that.$api.doRequest('get', '/paymentManagement/cumulant', {
+								compId: JSON.parse(localStorage.getItem('pcUserInfo')).data.compId,
+								customerNumberCard: that.detailData.customerNumberCard,
+								goodsName: that.detailData.goodsName,
+							}).then(res => {
+								if (res.data.code == 200) {
+									for (let i = 0; i < that.purchasePriceList.length; i++) {
+										if (
+											that.detailData.goodsName == that.purchasePriceList[i]
+											.goodsName
+										) {
+											let count = (that.purchasePriceList[i].saleLimit -
+												res.data.data / 1000).toFixed(2)
+											if (count <= 0) {
+												count = 0
+												that.$api.msg('该客户累计销售' + this.detailData.goodsName + (
+														res.data.data / 1000).toFixed(2) +
+													'吨,还可售粮' +
+													count + '吨', )
+
+											} else {
+												that.$api.doRequest('post',
+													'/weighingManagement/api/editGrossWeight', that
+													.detailData).then(res => {
+													if (res.data.code == 200) {
+														that.$refs.uToast.show({
+															title: '提交成功',
+															type: 'success'
+														})
+														uni.navigateBack({})
+													} else {
+														that.$refs.uToast.show({
+															title: '提交失败',
+															type: 'error',
+														})
+													}
+												})
+
+											}
+										}
+									}
+								}
+							})
+						} else if (res.cancel) {
+							console.log('用户点击取消');
+						}
 					}
 					}
 				})
 				})
 			}
 			}
@@ -108,48 +143,55 @@
 </script>
 </script>
 
 
 <style scoped lang="scss">
 <style scoped lang="scss">
-	uni-page-body{
+	uni-page-body {
 		overflow: hidden;
 		overflow: hidden;
 	}
 	}
-	.warp{
+
+	.warp {
 		background: white;
 		background: white;
 		margin: 20rpx;
 		margin: 20rpx;
 		padding: 20rpx;
 		padding: 20rpx;
 		border-radius: 20rpx;
 		border-radius: 20rpx;
-		.title{
+
+		.title {
 			font-size: 28rpx;
 			font-size: 28rpx;
 			font-weight: 500;
 			font-weight: 500;
 			color: #333333;
 			color: #333333;
 		}
 		}
 	}
 	}
-.content{
-	.row{
-		display: flex;
-		justify-content: space-between;
-		padding:31rpx 0;
-		.right{
-			font-size: 28rpx;
-			font-weight: 600;
-			color: #333333;
+
+	.content {
+		.row {
+			display: flex;
+			justify-content: space-between;
+			padding: 31rpx 0;
+
+			.right {
+				font-size: 28rpx;
+				font-weight: 600;
+				color: #333333;
+			}
 		}
 		}
-	}
-	.row-bottom{
-		border: 0;
-		.right-bottom{
-			width: 300rpx;
-			text-align: right;
-			font-size: 28rpx;
-			font-weight: 600;
-			color: #333333;
+
+		.row-bottom {
+			border: 0;
+
+			.right-bottom {
+				width: 300rpx;
+				text-align: right;
+				font-size: 28rpx;
+				font-weight: 600;
+				color: #333333;
+			}
 		}
 		}
 	}
 	}
-}
-.submit{
+
+	.submit {
 		position: fixed;
 		position: fixed;
-		bottom:40rpx;
+		bottom: 40rpx;
 		width: 90%;
 		width: 90%;
 		background: #22C572;
 		background: #22C572;
 		border-radius: 50rpx;
 		border-radius: 50rpx;
-		
+
 	}
 	}
 </style>
 </style>

+ 91 - 48
pages/erpbusiness/acquisitionInspection/tareDetail.vue

@@ -42,7 +42,8 @@
 			</view>
 			</view>
 			<view v-if="detailData.qualityInspectionManagement.paramType == '2'" class="row row-bottom">
 			<view v-if="detailData.qualityInspectionManagement.paramType == '2'" class="row row-bottom">
 				<view class="left">扣重(公斤)</view>
 				<view class="left">扣重(公斤)</view>
-				<input class="right-bottom" placeholder="输入扣重" @input="changeInput" v-model="detailData.buckleMiscellaneous"></input>
+				<input class="right-bottom" placeholder="输入扣重" @input="changeInput"
+					v-model="detailData.buckleMiscellaneous"></input>
 			</view>
 			</view>
 			<view class="row row-bottom" style="border: 0;">
 			<view class="row row-bottom" style="border: 0;">
 				<view class="left">净重(公斤)</view>
 				<view class="left">净重(公斤)</view>
@@ -59,41 +60,76 @@
 		data() {
 		data() {
 			return {
 			return {
 				detailData: {
 				detailData: {
-					tare:0,
-					buckleMiscellaneous:0
+					tare: 0,
+					buckleMiscellaneous: 0
 				},
 				},
+				purchasePriceList: []
 			}
 			}
 		},
 		},
-		onShow() {},
+		onShow() {
+			this.$api.doRequest('get', '/qualityInspectionManagement/api/goodsName', {
+				warehouseId: this.detailData.warehouseId
+			}).then(res => {
+				if (res.data.code == 200) {
+					this.purchasePriceList = res.data.data
+				}
+			})
+		},
 		onLoad(options) {
 		onLoad(options) {
 			this.detailData = JSON.parse(options.detailData)
 			this.detailData = JSON.parse(options.detailData)
-			if(!this.detailData.buckleMiscellaneous){
+			if (!this.detailData.buckleMiscellaneous) {
 				this.detailData.buckleMiscellaneous = 0
 				this.detailData.buckleMiscellaneous = 0
 			}
 			}
 		},
 		},
 		methods: {
 		methods: {
-			changeInput(){
-				this.detailData.netWeight = (parseFloat(this.detailData.grossWeight)-parseFloat(this.detailData.tare)-parseFloat(this.detailData.buckleMiscellaneous)).toFixed(3)
+			changeInput() {
+				this.detailData.netWeight = (parseFloat(this.detailData.grossWeight) - parseFloat(this.detailData.tare) -
+					parseFloat(this.detailData.buckleMiscellaneous)).toFixed(3)
 			},
 			},
-			submit(){
+			submit() {
 				let that = this;
 				let that = this;
 				uni.showModal({
 				uni.showModal({
-					content:"确定提交检斤信息?",
+					content: "确定提交检斤信息?",
 					success() {
 					success() {
-						console.log(that.detailData)
-						that.$api.doRequest('post', '/weighingManagement/api/editTare',that.detailData).then(res => {
-							if(res.data.code==200){
-								that.$refs.uToast.show({
-									title: '提交成功',
-									type: 'success'
-								})
-								uni.navigateBack({
-								})
-							}else{
-								that.$refs.uToast.show({
-									title: '提交失败',
-									type: 'error',
-								})
+						that.$api.doRequest('get', '/paymentManagement/cumulant', {
+							compId: JSON.parse(localStorage.getItem('pcUserInfo')).data.compId,
+							customerNumberCard: that.detailData.customerNumberCard,
+							goodsName: that.detailData.goodsName,
+						}).then(res => {
+							if (res.data.code == 200) {
+								for (let i = 0; i < that.purchasePriceList.length; i++) {
+									if (
+										that.detailData.goodsName == that.purchasePriceList[i]
+										.goodsName
+									) {
+										let count = (that.purchasePriceList[i].saleLimit -
+											res.data.data / 1000).toFixed(2)
+										if (count <= 0) {
+											count = 0
+											that.$api.msg('该客户累计销售' + this.detailData.goodsName + (
+													res.data.data / 1000).toFixed(2) +
+												'吨,还可售粮' +
+												count + '吨', )
+
+										} else {
+											that.$api.doRequest('post', '/weighingManagement/api/editTare',
+												that.detailData).then(res => {
+												if (res.data.code == 200) {
+													that.$refs.uToast.show({
+														title: '提交成功',
+														type: 'success'
+													})
+													uni.navigateBack({})
+												} else {
+													that.$refs.uToast.show({
+														title: '提交失败',
+														type: 'error',
+													})
+												}
+											})
+										}
+									}
+								}
 							}
 							}
 						})
 						})
 					}
 					}
@@ -104,48 +140,55 @@
 </script>
 </script>
 
 
 <style scoped lang="scss">
 <style scoped lang="scss">
-	uni-page-body{
+	uni-page-body {
 		overflow: hidden;
 		overflow: hidden;
 	}
 	}
-	.warp{
+
+	.warp {
 		background: white;
 		background: white;
 		margin: 20rpx;
 		margin: 20rpx;
 		padding: 20rpx;
 		padding: 20rpx;
 		border-radius: 20rpx;
 		border-radius: 20rpx;
-		.title{
+
+		.title {
 			font-size: 28rpx;
 			font-size: 28rpx;
 			font-weight: 500;
 			font-weight: 500;
 			color: #333333;
 			color: #333333;
 		}
 		}
 	}
 	}
-.content{
-	.row{
-		display: flex;
-		justify-content: space-between;
-		padding:21rpx 0;
-		.right{
-			font-size: 28rpx;
-			// font-weight: 600;
-			color: #333333;
+
+	.content {
+		.row {
+			display: flex;
+			justify-content: space-between;
+			padding: 21rpx 0;
+
+			.right {
+				font-size: 28rpx;
+				// font-weight: 600;
+				color: #333333;
+			}
 		}
 		}
-	}
-	.row-bottom{
-		// border: 0;
-		.right-bottom{
-			width: 300rpx;
-			font-size: 28rpx;
-			font-weight: 600;
-			color: #333333;
-			text-align: right;
+
+		.row-bottom {
+
+			// border: 0;
+			.right-bottom {
+				width: 300rpx;
+				font-size: 28rpx;
+				font-weight: 600;
+				color: #333333;
+				text-align: right;
+			}
 		}
 		}
 	}
 	}
-}
-.submit{
+
+	.submit {
 		position: fixed;
 		position: fixed;
-		bottom:40rpx;
+		bottom: 40rpx;
 		width: 90%;
 		width: 90%;
 		background: #22C572;
 		background: #22C572;
 		border-radius: 50rpx;
 		border-radius: 50rpx;
-		
+
 	}
 	}
 </style>
 </style>

+ 49 - 21
pages/erpbusiness/add_quality_testing.vue

@@ -83,12 +83,13 @@
 					<u-picker :range="typeList" @confirm='typepicker($event)' v-model="show3" mode="selector">
 					<u-picker :range="typeList" @confirm='typepicker($event)' v-model="show3" mode="selector">
 					</u-picker>
 					</u-picker>
 				</view>
 				</view>
-				<view v-else  class="con-list">{{gridList.type}}</view>
+				<view v-else class="con-list">{{gridList.type}}</view>
 			</view>
 			</view>
 			<view v-if="gridList.type == '潮粮'" class="c-row">
 			<view v-if="gridList.type == '潮粮'" class="c-row">
 				<view class="title">净重单价(元/公斤)</view>
 				<view class="title">净重单价(元/公斤)</view>
 				<view class="con-list">
 				<view class="con-list">
-					<input v-model='gridList.tidalGrainPrice' disabled placeholder="自动获取,不可编辑" name="input" type="digit"></input>
+					<input v-model='gridList.tidalGrainPrice' disabled placeholder="自动获取,不可编辑" name="input"
+						type="digit"></input>
 				</view>
 				</view>
 			</view>
 			</view>
 			<view v-if="gridList.type == '干粮'" class="c-row">
 			<view v-if="gridList.type == '干粮'" class="c-row">
@@ -129,7 +130,8 @@
 				<view class="c-row ">
 				<view class="c-row ">
 					<view class="title">不完善粒(%)</view>
 					<view class="title">不完善粒(%)</view>
 					<view class="con-list">
 					<view class="con-list">
-						<input v-model='gridList.imperfectGrain' placeholder="请输入不完整粒占比" name="input" type="digit"></input>
+						<input v-model='gridList.imperfectGrain' placeholder="请输入不完整粒占比" name="input"
+							type="digit"></input>
 					</view>
 					</view>
 				</view>
 				</view>
 				<view class="c-row ">
 				<view class="c-row ">
@@ -179,7 +181,7 @@
 				feild: undefined,
 				feild: undefined,
 				id: 0,
 				id: 0,
 				show: false,
 				show: false,
-				edit:true,
+				edit: true,
 				selector: [],
 				selector: [],
 				show1: false,
 				show1: false,
 				inputContent: '',
 				inputContent: '',
@@ -491,14 +493,41 @@
 					confirmText: '提交',
 					confirmText: '提交',
 					success: function(res) {
 					success: function(res) {
 						if (res.confirm) {
 						if (res.confirm) {
-							that.$api.doRequest('post',
-									'/qualityInspectionManagement/api/addQualityInspection', that.gridList)
-								.then(res => {
-									if (res.data.code == 200) {
-										that.$api.msg('提交成功')
-										uni.navigateBack({})
-									} else {
-										hat.$api.msg('提交失败')
+							that.$api.doRequest('get', '/paymentManagement/cumulant', {
+									compId: JSON.parse(localStorage.getItem('pcUserInfo')).data.compId,
+									customerNumberCard: that.gridList.customerNumberCard,
+									goodsName: that.gridList.goodsName,
+								})
+								.then(response => {
+									if (response.data.code == 200) {
+										for (let i = 0; i < that.purchasePriceList.length; i++) {
+											if (
+												that.gridList.goodsName == that.purchasePriceList[i]
+												.goodsName
+											) {
+												let count = (that.purchasePriceList[i].saleLimit -
+													response.data.data / 1000).toFixed(2)
+												if (count <= 0) {
+													count = 0
+													that.$api.msg('该客户累计销售' + this.gridList.goodsName + (
+															response.data.data / 1000).toFixed(2) + '吨,还可售粮' +
+														count + '吨', )
+
+												} else {
+													that.$api.doRequest('post',
+															'/qualityInspectionManagement/api/addQualityInspection',
+															that.gridList)
+														.then(res => {
+															if (res.data.code == 200) {
+																that.$api.msg('提交成功')
+																uni.navigateBack({})
+															} else {
+																hat.$api.msg('提交失败')
+															}
+														})
+												}
+											}
+										}
 									}
 									}
 								})
 								})
 						}
 						}
@@ -515,15 +544,14 @@
 			goodspicker(e) {
 			goodspicker(e) {
 				console.log(e)
 				console.log(e)
 				// this.$set(this.gradeList,'grade',this.gradeList[e[0]].value)
 				// this.$set(this.gradeList,'grade',this.gradeList[e[0]].value)
-				if(this.goodsList[e[0]].goodsName=='玉米'){
-					this.gridList.type='干粮'
-					this.edit=true
-				}
-				else if(this.goodsList[e[0]].goodsName=='玉米(潮粮)'){
-					this.gridList.type='潮粮'
-					this.edit=true
-				}else{
-					this.edit=false
+				if (this.goodsList[e[0]].goodsName == '玉米') {
+					this.gridList.type = '干粮'
+					this.edit = true
+				} else if (this.goodsList[e[0]].goodsName == '玉米(潮粮)') {
+					this.gridList.type = '潮粮'
+					this.edit = true
+				} else {
+					this.edit = false
 				}
 				}
 				this.gridList.goodsName = this.goodsList[e[0]].goodsName
 				this.gridList.goodsName = this.goodsList[e[0]].goodsName
 				uni.setStorageSync('goodsName', this.gridList.goodsName)
 				uni.setStorageSync('goodsName', this.gridList.goodsName)

+ 0 - 1
pages/user/depotAcquisition/depotAcquisition.vue

@@ -79,7 +79,6 @@
 		},
 		},
 		// #ifndef MP
 		// #ifndef MP
 		onNavigationBarButtonTap(e) {
 		onNavigationBarButtonTap(e) {
-			debugger
 			const index = e.index;
 			const index = e.index;
 			if (index == 1) {
 			if (index == 1) {
 				uni.navigateBack()
 				uni.navigateBack()