ysy 1 年間 前
コミット
18b4e8bcf1
3 ファイル変更107 行追加25 行削除
  1. 27 1
      api/pda/workOrder.js
  2. 65 9
      pages/pda/feeding/details.vue
  3. 15 15
      pages/pda/jobBooking/components/jobBom.vue

+ 27 - 1
api/pda/workOrder.js

@@ -610,4 +610,30 @@ export async function getCache(params) {
 		return data.data;
 	}
 	return Promise.reject(data.message);
-}
+}
+
+// pda投料保存缓存
+
+export async function feedSaveCache(params) {
+	const data = await postJ(
+		Vue.prototype.apiUrl + `/pda/mes/feed/saveCache`, params, true,
+	);
+
+	if (data.code == 0) {
+		return data.data;
+	}
+	return Promise.reject(data.message);
+}
+
+
+// pda投料查缓存
+export async function feedGetCache(params) {
+	const data = await postJ(
+		Vue.prototype.apiUrl + `/pda/mes/feed/getCache`, params, true,
+	);
+
+	if (data.code == 0) {
+		return data.data;
+	}
+	return Promise.reject(data.message);
+}

+ 65 - 9
pages/pda/feeding/details.vue

@@ -70,7 +70,8 @@
 		</view>
 
 		<view class="bottom-wrapper">
-			<view class="btn_box" @click="save">一键投料</view>
+			<view class="btn_box" @click="save(1)">缓存</view>
+			<view class="btn_box" @click="save(2)">一键投料</view>
 		</view>
 
 
@@ -96,7 +97,9 @@
 	import {
 		workorderList,
 		getByCode,
-		scanLedger
+		scanLedger,
+		feedSaveCache,
+		feedGetCache
 	} from '@/api/pda/workOrder.js'
 
 	import {
@@ -221,7 +224,7 @@
 		methods: {
 			scrolltolower() {},
 
-			save() {
+			async save(type) {
 
 				this.List.forEach(f => {
 					f.instanceList.forEach(e => {
@@ -234,6 +237,13 @@
 
 
 
+				const isCache = await this.checkCache(type)
+
+				if (!isCache) {
+					return false
+				}
+
+
 				batchSave(this.List).then(res => {
 
 					uni.redirectTo({
@@ -243,6 +253,28 @@
 				})
 			},
 
+
+
+			checkCache(type) {
+				uni.hideLoading();
+				return new Promise((resolve) => {
+					if (type == 1) {
+						feedSaveCache(this.List).then(rr => {
+							uni.showToast({
+								title: `已经缓存`,
+								icon: 'none'
+							})
+						})
+						resolve(false)
+					} else if (type == 2) {
+						resolve(true)
+					}
+
+				})
+			},
+
+
+
 			getList() {
 				workorderList({
 					ids: this.idsList,
@@ -280,7 +312,7 @@
 								} else if (f.rootCategoryLevelId == 26) {
 									m.revolvingDiskList.push(f)
 								} else if ([23, 2, 9, 28].includes(Number(f
-									.rootCategoryLevelId))) {
+										.rootCategoryLevelId))) {
 									m.semiProductList.push(f)
 								}
 
@@ -311,6 +343,8 @@
 							...m
 						}
 					})
+				}).finally(() => {
+					this.getCacheFn()
 				})
 			},
 
@@ -326,7 +360,6 @@
 				// this.scanData('SCJHGD20240117002', type, id)
 				// return false
 
-
 				uni.scanCode({
 					success: (res) => {
 						this.scanData(res.result, type, id)
@@ -456,7 +489,7 @@
 									})
 									return false
 								}
-								
+
 								_arr.forEach((e, index) => {
 									if (e.workOrderId == id) {
 										_arr[index].turnover = _arr[index].turnover.concat(res)
@@ -464,12 +497,12 @@
 								})
 								this.List = _arr
 								this.$forceUpdate()
-								
+
 							}
 						})
 
 
-			
+
 					}
 
 
@@ -526,6 +559,18 @@
 
 			},
 
+			getCacheFn() {
+				let parma = {
+					workOrderIds: this.idsList,
+					taskId: this.taskId
+				}
+
+				feedGetCache(parma).then(res => {
+			
+				})
+			},
+
+
 			handAdd(id) {
 				const storageKey = Date.now() + "";
 				uni.setStorageSync(storageKey, this.List || []);
@@ -580,8 +625,14 @@
 	}
 
 	.bottom-wrapper {
+		width: 100%;
+		display: flex;
+		align-items: center;
+		justify-content: space-around;
+
+
 		.btn_box {
-			width: 750rpx;
+			width: 50%;
 			height: 88rpx;
 			line-height: 88rpx;
 			background: $theme-color;
@@ -590,9 +641,14 @@
 			font-style: normal;
 			font-weight: 400;
 			color: #fff;
+
+			&:first-child {
+				border-right: 2rpx solid #fff;
+			}
 		}
 	}
 
+
 	.operate_box {
 
 		position: fixed;

+ 15 - 15
pages/pda/jobBooking/components/jobBom.vue

@@ -167,21 +167,21 @@
 
 			setFormedNum(num) {
 				this.item.workReportInfo.formedNum = num
-			
-			
-			let weight = Number(this.item.workReportInfo.formedNum) * Number(this.item.singleWeight) * Number(this
-				.item.weightMultiple)
-			
-			if (['G', 'g', '克'].includes(this.item.singleWeightUnit)) {
-				weight = parseFloat((weight / 1000).toFixed(2))
-			} else {
-				weight = parseFloat(weight.toFixed(2))
-			}
-			
-			this.$set(this.item.workReportInfo, 'formedWeight', weight)
-			
-			
-			this.$forceUpdate()
+
+
+				let weight = Number(this.item.workReportInfo.formedNum) * Number(this.item.singleWeight) * Number(this
+					.item.weightMultiple)
+
+				if (['G', 'g', '克'].includes(this.item.singleWeightUnit)) {
+					weight = parseFloat((weight / 1000).toFixed(2))
+				} else {
+					weight = parseFloat(weight.toFixed(2))
+				}
+
+				this.$set(this.item.workReportInfo, 'formedWeight', weight)
+
+
+				this.$forceUpdate()
 			},