Bläddra i källkod

Merge branch 'master' of http://git.zthymaoyi.com/gdc/yiliangyiyun-app

gjy 2 år sedan
förälder
incheckning
7f08ae63cd

+ 399 - 122
pages/erpbusiness/add_quality_testing.vue

@@ -845,6 +845,12 @@
 					}
 
 				}
+				else if(res.data.code != 200){
+					uni.showModal({
+						content:res.data.message,
+						showCancel:false
+					})
+				}
 			})
 			console.log(this.gridList)
 			this.gridListInit = this.gridList
@@ -1626,9 +1632,280 @@
 						'acquisitionQuality.initial')) {
 					text = "确定提交钎样信息?"
 					this.gridList.brazer = 1
+					uni.showModal({
+						content: text,
+						showCancel: true,
+						confirmText: '提交',
+						success: function(res) {
+							if (res.confirm) {
+								that.gridList.serviceManagementType = that.typevalue
+								if (that.typevalue == 3) {
+									that.$api.doRequest('get', '/paymentManagement/cumulant', {
+											compId: uni.getStorageSync('pcUserInfo').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)
+														console.log(count, that.purchasePriceList[i].saleLimit,
+															response.data.data)
+					
+														if (Number(count) <= 0) {
+															count = 0
+															that.$api.msg('该客户累计销售' + that.gridList.goodsName +
+																(
+																	response.data.data / 1000).toFixed(2) +
+																'吨,还可售粮' +
+																count + '吨', )
+					
+														} else {
+															that.gridList.inOutFlag = 2
+															that.$api.doRequest('post',
+																	'/warehouseInOutInfo/InOutWarehouse',
+																	that.gridList)
+																.then(res => {
+																	if (that.utils.getCurrectRoles(
+																			'acquisitionQuality.qview')) {
+																		if (!that.utils.getCurrectRoles(
+																				'acquisitionQuality.initial'
+																				)) {
+																			that.gridList.statusFlag = 7
+																		} else {
+																			that.gridList.statusFlag = 0
+																		}
+																	}
+																	that.gridList.warehouseInOutId = res
+																		.data.data
+																	that.$api.doRequest('post',
+																			'/qualityInspectionManagement/api/addQualityInspection',
+																			that.gridList)
+																		.then(res => {
+																			if (res.data.code == 200) {
+																				that.$api.msg('提交成功')
+																				that.gridList
+																					.warehouseId = that
+																					.cangid
+																				that.gridList.compId =
+																					uni.getStorageSync(
+																						'pcUserInfo')
+																					.compId
+																				uni.setStorageSync(
+																					"quality_print",
+																					that.gridList)
+																				if (that.utils
+																					.getCurrectRoles(
+																						'acquisitionQuality.initial'
+																						)) {
+																					that.isShowPrint =
+																						true
+																				} else {
+																					uni.navigateBack({})
+																				}
+					
+																				console.log(
+																					'that.gridList',
+																					that.gridList)
+																				// uni.navigateBack({})
+																			} else {
+																				that.$api.msg('提交失败')
+																			}
+																		})
+																})
+														}
+													}
+												}
+											}
+										})
+								} else {
+									
+									that.gridList.inOutFlag = 2
+									that.$api.doRequest('post',
+											'/warehouseInOutInfo/InOutWarehouse',
+											that.gridList)
+										.then(res => {
+					
+											that.gridList.warehouseInOutId = res.data.data
+											that.$api.doRequest('post',
+													'/qualityInspectionManagement/api/addQualityInspection',
+													that.gridList)
+												.then(res => {
+													if (res.data.code == 200) {
+														that.$api.msg('提交成功')
+														that.gridList.warehouseId = that.cangid
+														that.gridList.compId = uni.getStorageSync(
+															'pcUserInfo').compId
+														uni.setStorageSync("quality_print", that.gridList)
+														if (that.utils.getCurrectRoles(
+																'acquisitionQuality.initial')) {
+															that.isShowPrint = true
+														} else {
+															uni.navigateBack({})
+														}
+					
+														console.log('that.gridList', that.gridList)
+														// uni.navigateBack({})
+													} else {
+														that.$api.msg('提交失败')
+													}
+												})
+										})
+								}
+					
+							}
+						}
+					})
 				} else {
 					text = "确定提交质检信息?"
 					this.gridList.brazer = 0
+					this.$api.doRequest('get', '/qualityInspectionManagement/api/goodsName', {
+						warehouseId: this.cangid
+					}).then(res => {
+						if(res.data.code != 200 && that.typevalue == 3){
+							uni.showModal({
+								content:res.data.message,
+								showCancel:false
+							})
+							return;
+						}
+						else{
+							uni.showModal({
+								content: text,
+								showCancel: true,
+								confirmText: '提交',
+								success: function(res) {
+									if (res.confirm) {
+										that.gridList.serviceManagementType = that.typevalue
+										if (that.typevalue == 3) {
+											that.$api.doRequest('get', '/paymentManagement/cumulant', {
+													compId: uni.getStorageSync('pcUserInfo').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)
+																console.log(count, that.purchasePriceList[i].saleLimit,
+																	response.data.data)
+							
+																if (Number(count) <= 0) {
+																	count = 0
+																	that.$api.msg('该客户累计销售' + that.gridList.goodsName +
+																		(
+																			response.data.data / 1000).toFixed(2) +
+																		'吨,还可售粮' +
+																		count + '吨', )
+							
+																} else {
+																	that.gridList.inOutFlag = 2
+																	that.$api.doRequest('post',
+																			'/warehouseInOutInfo/InOutWarehouse',
+																			that.gridList)
+																		.then(res => {
+																			if (that.utils.getCurrectRoles(
+																					'acquisitionQuality.qview')) {
+																				if (!that.utils.getCurrectRoles(
+																						'acquisitionQuality.initial'
+																						)) {
+																					that.gridList.statusFlag = 7
+																				} else {
+																					that.gridList.statusFlag = 0
+																				}
+																			}
+																			that.gridList.warehouseInOutId = res
+																				.data.data
+																			that.$api.doRequest('post',
+																					'/qualityInspectionManagement/api/addQualityInspection',
+																					that.gridList)
+																				.then(res => {
+																					if (res.data.code == 200) {
+																						that.$api.msg('提交成功')
+																						that.gridList
+																							.warehouseId = that
+																							.cangid
+																						that.gridList.compId =
+																							uni.getStorageSync(
+																								'pcUserInfo')
+																							.compId
+																						uni.setStorageSync(
+																							"quality_print",
+																							that.gridList)
+																						if (that.utils
+																							.getCurrectRoles(
+																								'acquisitionQuality.initial'
+																								)) {
+																							that.isShowPrint =
+																								true
+																						} else {
+																							uni.navigateBack({})
+																						}
+							
+																						console.log(
+																							'that.gridList',
+																							that.gridList)
+																						// uni.navigateBack({})
+																					} else {
+																						that.$api.msg('提交失败')
+																					}
+																				})
+																		})
+																}
+															}
+														}
+													}
+												})
+										} else {
+											
+											that.gridList.inOutFlag = 2
+											that.$api.doRequest('post',
+													'/warehouseInOutInfo/InOutWarehouse',
+													that.gridList)
+												.then(res => {
+							
+													that.gridList.warehouseInOutId = res.data.data
+													that.$api.doRequest('post',
+															'/qualityInspectionManagement/api/addQualityInspection',
+															that.gridList)
+														.then(res => {
+															if (res.data.code == 200) {
+																that.$api.msg('提交成功')
+																that.gridList.warehouseId = that.cangid
+																that.gridList.compId = uni.getStorageSync(
+																	'pcUserInfo').compId
+																uni.setStorageSync("quality_print", that.gridList)
+																if (that.utils.getCurrectRoles(
+																		'acquisitionQuality.initial')) {
+																	that.isShowPrint = true
+																} else {
+																	uni.navigateBack({})
+																}
+							
+																console.log('that.gridList', that.gridList)
+																// uni.navigateBack({})
+															} else {
+																that.$api.msg('提交失败')
+															}
+														})
+												})
+										}
+							
+									}
+								}
+							})
+						}
+					})
 				}
 
 				// if (!this.gridList.storageTagNo) {
@@ -1652,135 +1929,135 @@
 				// 	return
 				// }
 
-				uni.showModal({
-					content: text,
-					showCancel: true,
-					confirmText: '提交',
-					success: function(res) {
-						if (res.confirm) {
-							that.gridList.serviceManagementType = that.typevalue
-							if (that.typevalue == 3) {
-								that.$api.doRequest('get', '/paymentManagement/cumulant', {
-										compId: uni.getStorageSync('pcUserInfo').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)
-													console.log(count, that.purchasePriceList[i].saleLimit,
-														response.data.data)
+				// uni.showModal({
+				// 	content: text,
+				// 	showCancel: true,
+				// 	confirmText: '提交',
+				// 	success: function(res) {
+				// 		if (res.confirm) {
+				// 			that.gridList.serviceManagementType = that.typevalue
+				// 			if (that.typevalue == 3) {
+				// 				that.$api.doRequest('get', '/paymentManagement/cumulant', {
+				// 						compId: uni.getStorageSync('pcUserInfo').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)
+				// 									console.log(count, that.purchasePriceList[i].saleLimit,
+				// 										response.data.data)
 
-													if (Number(count) <= 0) {
-														count = 0
-														that.$api.msg('该客户累计销售' + that.gridList.goodsName +
-															(
-																response.data.data / 1000).toFixed(2) +
-															'吨,还可售粮' +
-															count + '吨', )
+				// 									if (Number(count) <= 0) {
+				// 										count = 0
+				// 										that.$api.msg('该客户累计销售' + that.gridList.goodsName +
+				// 											(
+				// 												response.data.data / 1000).toFixed(2) +
+				// 											'吨,还可售粮' +
+				// 											count + '吨', )
 
-													} else {
-														that.gridList.inOutFlag = 2
-														that.$api.doRequest('post',
-																'/warehouseInOutInfo/InOutWarehouse',
-																that.gridList)
-															.then(res => {
-																if (that.utils.getCurrectRoles(
-																		'acquisitionQuality.qview')) {
-																	if (!that.utils.getCurrectRoles(
-																			'acquisitionQuality.initial'
-																			)) {
-																		that.gridList.statusFlag = 7
-																	} else {
-																		that.gridList.statusFlag = 0
-																	}
-																}
-																that.gridList.warehouseInOutId = res
-																	.data.data
-																that.$api.doRequest('post',
-																		'/qualityInspectionManagement/api/addQualityInspection',
-																		that.gridList)
-																	.then(res => {
-																		if (res.data.code == 200) {
-																			that.$api.msg('提交成功')
-																			that.gridList
-																				.warehouseId = that
-																				.cangid
-																			that.gridList.compId =
-																				uni.getStorageSync(
-																					'pcUserInfo')
-																				.compId
-																			uni.setStorageSync(
-																				"quality_print",
-																				that.gridList)
-																			if (that.utils
-																				.getCurrectRoles(
-																					'acquisitionQuality.initial'
-																					)) {
-																				that.isShowPrint =
-																					true
-																			} else {
-																				uni.navigateBack({})
-																			}
+				// 									} else {
+				// 										that.gridList.inOutFlag = 2
+				// 										that.$api.doRequest('post',
+				// 												'/warehouseInOutInfo/InOutWarehouse',
+				// 												that.gridList)
+				// 											.then(res => {
+				// 												if (that.utils.getCurrectRoles(
+				// 														'acquisitionQuality.qview')) {
+				// 													if (!that.utils.getCurrectRoles(
+				// 															'acquisitionQuality.initial'
+				// 															)) {
+				// 														that.gridList.statusFlag = 7
+				// 													} else {
+				// 														that.gridList.statusFlag = 0
+				// 													}
+				// 												}
+				// 												that.gridList.warehouseInOutId = res
+				// 													.data.data
+				// 												that.$api.doRequest('post',
+				// 														'/qualityInspectionManagement/api/addQualityInspection',
+				// 														that.gridList)
+				// 													.then(res => {
+				// 														if (res.data.code == 200) {
+				// 															that.$api.msg('提交成功')
+				// 															that.gridList
+				// 																.warehouseId = that
+				// 																.cangid
+				// 															that.gridList.compId =
+				// 																uni.getStorageSync(
+				// 																	'pcUserInfo')
+				// 																.compId
+				// 															uni.setStorageSync(
+				// 																"quality_print",
+				// 																that.gridList)
+				// 															if (that.utils
+				// 																.getCurrectRoles(
+				// 																	'acquisitionQuality.initial'
+				// 																	)) {
+				// 																that.isShowPrint =
+				// 																	true
+				// 															} else {
+				// 																uni.navigateBack({})
+				// 															}
 
-																			console.log(
-																				'that.gridList',
-																				that.gridList)
-																			// uni.navigateBack({})
-																		} else {
-																			that.$api.msg('提交失败')
-																		}
-																	})
-															})
-													}
-												}
-											}
-										}
-									})
-							} else {
+				// 															console.log(
+				// 																'that.gridList',
+				// 																that.gridList)
+				// 															// uni.navigateBack({})
+				// 														} else {
+				// 															that.$api.msg('提交失败')
+				// 														}
+				// 													})
+				// 											})
+				// 									}
+				// 								}
+				// 							}
+				// 						}
+				// 					})
+				// 			} else {
 								
-								that.gridList.inOutFlag = 2
-								that.$api.doRequest('post',
-										'/warehouseInOutInfo/InOutWarehouse',
-										that.gridList)
-									.then(res => {
+				// 				that.gridList.inOutFlag = 2
+				// 				that.$api.doRequest('post',
+				// 						'/warehouseInOutInfo/InOutWarehouse',
+				// 						that.gridList)
+				// 					.then(res => {
 
-										that.gridList.warehouseInOutId = res.data.data
-										that.$api.doRequest('post',
-												'/qualityInspectionManagement/api/addQualityInspection',
-												that.gridList)
-											.then(res => {
-												if (res.data.code == 200) {
-													that.$api.msg('提交成功')
-													that.gridList.warehouseId = that.cangid
-													that.gridList.compId = uni.getStorageSync(
-														'pcUserInfo').compId
-													uni.setStorageSync("quality_print", that.gridList)
-													if (that.utils.getCurrectRoles(
-															'acquisitionQuality.initial')) {
-														that.isShowPrint = true
-													} else {
-														uni.navigateBack({})
-													}
+				// 						that.gridList.warehouseInOutId = res.data.data
+				// 						that.$api.doRequest('post',
+				// 								'/qualityInspectionManagement/api/addQualityInspection',
+				// 								that.gridList)
+				// 							.then(res => {
+				// 								if (res.data.code == 200) {
+				// 									that.$api.msg('提交成功')
+				// 									that.gridList.warehouseId = that.cangid
+				// 									that.gridList.compId = uni.getStorageSync(
+				// 										'pcUserInfo').compId
+				// 									uni.setStorageSync("quality_print", that.gridList)
+				// 									if (that.utils.getCurrectRoles(
+				// 											'acquisitionQuality.initial')) {
+				// 										that.isShowPrint = true
+				// 									} else {
+				// 										uni.navigateBack({})
+				// 									}
 
-													console.log('that.gridList', that.gridList)
-													// uni.navigateBack({})
-												} else {
-													that.$api.msg('提交失败')
-												}
-											})
-									})
-							}
+				// 									console.log('that.gridList', that.gridList)
+				// 									// uni.navigateBack({})
+				// 								} else {
+				// 									that.$api.msg('提交失败')
+				// 								}
+				// 							})
+				// 					})
+				// 			}
 
-						}
-					}
-				})
+				// 		}
+				// 	}
+				// })
 			},
 			gradepicker(e) {
 				console.log(e)

+ 67 - 45
pages/erpbusiness/edit_quality_testing.vue

@@ -561,6 +561,7 @@
 					dryGrainPrice: '',
 					carNumber: '',
 					carModel: '',
+					serviceManagementType:'3'
 				},
 				managementType: '',
 				warehouseName: '',
@@ -738,6 +739,26 @@
 						that.warehouseList = res.data.data.warehousePositionInfoList
 
 					})
+					//质检货名下拉
+					this.$api.doRequest('get', '/qualityInspectionManagement/api/goodsName', {
+						warehouseId: this.cangid
+					}).then(res => {
+						if (res.data.data) {
+							that.goodsList = res.data.data
+							if (that.goodsList.length > 0) {
+								that.gridList.goodsName = that.goodsList[0].goodsName
+								uni.setStorageSync('purchasePriceList', that.goodsList)
+								that.purchasePriceList = uni.getStorageSync('purchasePriceList')
+							}
+						}
+						else if(res.data.code != 200 && that.gridList.serviceManagementType==3){
+							uni.showModal({
+								content:res.data.message,
+								showCancel:false
+							})
+						}
+						
+					})
 				}
 			})
 			this.$api.doRequest('get', 'commonSysParameter/getInfo', {
@@ -747,20 +768,7 @@
 					that.carModeList = res.data.data
 				}
 			})
-			//质检货名下拉
-			this.$api.doRequest('get', '/qualityInspectionManagement/api/goodsName', {
-				warehouseId: this.cangid
-			}).then(res => {
-				if (res.data.data) {
-					that.goodsList = res.data.data
-					if (that.goodsList.length > 0) {
-						that.gridList.goodsName = that.goodsList[0].goodsName
-						uni.setStorageSync('purchasePriceList', that.goodsList)
-						that.purchasePriceList = uni.getStorageSync('purchasePriceList')
-					}
-				}
-				
-			})
+			
 			this.gridList.grade = this.gradeList[0].value
 			this.gridList.gradeKey = this.gradeList[0].key
 		},
@@ -1349,40 +1357,54 @@
 					reMildewGrain:that.gridList.reMildewGrain,
 				}
 				console.log(this.gridList)
-				uni.showModal({
-					content: text,
-					showCancel: true,
-					confirmText: '提交',
-					success: function(res) {
-						if (res.confirm) {
-								that.$api.doRequest('post',
-									'/qualityInspectionManagement/api/editQualityInspection', that.gridList)
-								.then(res => {
-									uni.setStorageSync("quality_print", that.gridList)
-									that.gridList.id=kid
-									that.gridList.statusFlag=1
-									that.$api.doRequest('post',
-											'/warehouseInOutInfo/InOutWarehouse',
-											that.gridList)
+				this.$api.doRequest('get', '/qualityInspectionManagement/api/goodsName', {
+					warehouseId: this.cangid
+				}).then(res => {
+					if(res.data.code != 200 && that.gridList.serviceManagementType==3){
+						uni.showModal({
+							content:res.data.message,
+							showCancel:false
+						})
+						return;
+					}
+					else{
+						uni.showModal({
+							content: text,
+							showCancel: true,
+							confirmText: '提交',
+							success: function(res) {
+								if (res.confirm) {
+										that.$api.doRequest('post',
+											'/qualityInspectionManagement/api/editQualityInspection', that.gridList)
 										.then(res => {
-									if (res.data.code == 200) {
-										that.$api.msg('编辑质检成功')
-										that.gridList.warehouseId = that.cangid
-										
-										console.log('that.gridList', that.gridList)
-										if(that.utils.getCurrectRoles('acquisitionQuality.initial')){
-											that.isShowPrint = true
-										}else{
-											uni.navigateBack({delta:1})
-										}
-										// uni.getStorageSync("depotAcquisition_warehouseName")
-										// uni.navigateBack({})
-									}
-								})
-							})
-						}
+											uni.setStorageSync("quality_print", that.gridList)
+											that.gridList.id=kid
+											that.gridList.statusFlag=1
+											that.$api.doRequest('post',
+													'/warehouseInOutInfo/InOutWarehouse',
+													that.gridList)
+												.then(res => {
+											if (res.data.code == 200) {
+												that.$api.msg('编辑质检成功')
+												that.gridList.warehouseId = that.cangid
+												
+												console.log('that.gridList', that.gridList)
+												if(that.utils.getCurrectRoles('acquisitionQuality.initial')){
+													that.isShowPrint = true
+												}else{
+													uni.navigateBack({delta:1})
+												}
+												// uni.getStorageSync("depotAcquisition_warehouseName")
+												// uni.navigateBack({})
+											}
+										})
+									})
+								}
+							}
+						})
 					}
 				})
+				
 			},
 			gradepicker(e) {
 				console.log(e)

+ 3 - 0
pages/user/set_wechatNo.vue

@@ -67,6 +67,9 @@
 									}
 								})
 							}
+							else{
+								that.$api.msg(res.data.message);
+							}
 						})
 					.catch(res => {
 						if(res.errmsg){