ysy 2 жил өмнө
parent
commit
39c6bfcf37

+ 23 - 0
api/pda/workOrder.js

@@ -586,5 +586,28 @@ export async function skipTask(params) {
 
 
 
+// pda报工保存缓存
 
+export async function saveCache(params) {
+	const data = await postJ(
+		Vue.prototype.apiUrl + `/pda/mes/workreport/saveCache`, params, true,
+	);
+
+	if (data.code == 0) {
+		return data.data;
+	}
+	return Promise.reject(data.message);
+}
 
+// pda报工查缓存
+
+export async function getCache(params) {
+	const data = await postJ(
+		Vue.prototype.apiUrl + `/pda/mes/workreport/getCache`, params, true,
+	);
+
+	if (data.code == 0) {
+		return data.data;
+	}
+	return Promise.reject(data.message);
+}

+ 72 - 8
pages/pda/jobBooking/index/index.vue

@@ -37,15 +37,15 @@
 
 
 					<semiProductJobBom
-						v-if='objData.semiProductList &&  objData.semiProductList.length != 0 && taskType != 4 && taskType != 6'
+						v-if='objData.semiProductList && objData.semiProductList.length != 0 && taskType != 4 && taskType != 6'
 						:item='objData' :list='objData.semiProductList'></semiProductJobBom>
 
 
 					<oneJobQualityBom
-						v-if='objData.semiProductList &&  objData.semiProductList.length != 0 && taskType ==6 && clientEnvironmentId == 3'
+						v-if='objData.semiProductList && objData.semiProductList.length != 0 && taskType == 6 && clientEnvironmentId == 3'
 						:item='objData' :list='objData.semiProductList'></oneJobQualityBom>
 
-					<byProductBom v-if='objData.productRecycleList.length != 0 ' :list='objData.productRecycleList'
+					<byProductBom v-if='objData.productRecycleList.length != 0' :list='objData.productRecycleList'
 						@penalize='penalize'>
 					</byProductBom>
 
@@ -58,10 +58,10 @@
 						:remainingTime='remainingTime' @handleScan='handleScan' :isType='true'></aridRegion>
 
 					<packingBom :taskId='taskId' :workOrderId='id' :objData='objData' ref="packRef"
-						v-if='taskType == 4 && clientEnvironmentId != 3  && objData'></packingBom>
+						v-if='taskType == 4 && clientEnvironmentId != 3 && objData'></packingBom>
 
 					<packingTgBom
-						v-if='objData.pickOutInList &&  objData.pickOutInList.length != 0 && taskType == 4  &&  clientEnvironmentId == 3'
+						v-if='objData.pickOutInList && objData.pickOutInList.length != 0 && taskType == 4 && clientEnvironmentId == 3'
 						:list='objData.pickOutInList' :item='objData'></packingTgBom>
 
 
@@ -134,6 +134,8 @@
 	import {
 		scanLedger,
 		getWarehouseList,
+		saveCache,
+		getCache
 	} from '@/api/pda/workOrder.js'
 
 
@@ -298,9 +300,9 @@
 
 					if (res.length >= 1 && res[0].rootCategoryLevelId == 5) { // 磨具
 						if (this.objData.modelList.length == 0) {
-							
-							
-							
+
+
+
 							this.objData.modelList = res
 							this.$forceUpdate()
 						} else {
@@ -492,6 +494,10 @@
 
 				}).finally(() => {
 					this.isLoad = true
+
+					if (this.clientEnvironmentId == 2 && this.taskType == 1) {
+						this.getCacheFn()
+					}
 				})
 			},
 
@@ -659,6 +665,16 @@
 				}
 
 
+				if (this.clientEnvironmentId == 2 && this.taskType == 1) {
+					const isCache = await this.checkCache()
+
+					if (!isCache) {
+						return false
+					}
+				}
+
+
+
 
 				jobSave(this.objData).then(res => {
 
@@ -783,7 +799,55 @@
 
 
 			},
+
+			checkCache() {
+				uni.hideLoading();
+				return new Promise((resolve) => {
+					uni.showModal({
+						title: '提示',
+						content: '报工是否缓存!',
+						cancelText: '报工',
+						confirmText: '缓存', //这块是确定按钮的文字
+						success: res => {
+							if (res.confirm) {
+								saveCache(this.objData).then(rr => {
+									uni.showToast({
+										title: `已经缓存`,
+										icon: 'none'
+									})
+								})
+								resolve(false)
+							} else {
+								resolve(true)
+
+							}
+						}
+					})
+
+				})
+			},
+
+
+			getCacheFn() {
+				let parma = {
+					workOrderId: this.id,
+					taskId: this.taskId
+				}
+
+				getCache(parma).then(res => {
+					this.objData['product'] = res.extInfo.product
+					this.objData['workReportInfo'] = res.extInfo.workReportInfo
+					this.objData['notFormedList'] = res.extInfo.notFormedList
+					this.objData['turnover'] = res.extInfo.turnover
+					this.objData['productRecycleList'] = res.extInfo.productRecycleList
+
+
+				})
+			},
+
+
 		}
+
 	}
 </script>