ysy před 2 roky
rodič
revize
b149f2142c

+ 15 - 0
api/pda/workOrder.js

@@ -388,6 +388,21 @@ export async function sampleTurnoverReview(params) {
 }
 
 
+// PDA抽样质检 ( 获取工序参数)
+export async function paramByTaskId(taskId) {
+	const data = await get(
+		Vue.prototype.apiUrl + `/main/taskqualityparam/listByTaskId/${taskId}`
+	);
+
+	if (data.code == 0) {
+		return data.data;
+	}
+	return Promise.reject(data.message);
+}
+
+
+
+
 // PDA  入库查询
 export async function listPDAToWarehouse(params) {
 	const data = await postJ(

+ 0 - 1
pages/pda/feeding/components/deviceBom.vue

@@ -13,7 +13,6 @@
 		<view class="material ">
 
 			<view class="content_table" v-for="(item,index) in list" :key='index'>
-
 				<view class="item">
 					<view class="lable rx-cc">工位名称</view>
 					<view class="content">

+ 1 - 3
pages/pda/feeding/components/instanceBom.vue

@@ -36,9 +36,6 @@
 
 
 
-
-
-
 					<view class="item" v-for="(itm, index) in tableH(mate.rootCategoryLevelId)" :key="index">
 						<view class="lable rx-cc">{{ itm.label }}</view>
 						<view class="content">{{ mate[itm.prop] }}</view>
@@ -271,6 +268,7 @@
 					if (e.check) {
 						e['deviceId'] = this.formData.deviceId
 						e['deviceName'] = this.formData.deviceName
+						e['check'] = false
 					}
 
 				})

+ 114 - 108
pages/pda/sample/components/sampleBom.vue

@@ -18,7 +18,6 @@
 
 
 
-
 				<view class="item rx-sc">
 					<view class="rx ww55 ">
 						<view class="lable  rx-cc">数量</view>
@@ -66,38 +65,48 @@
 
 			<view class="content_table2" v-if="item.sampleList.length > 0">
 				<view class="head row rx-sc">
-					<view class="item ww15">类型</view>
-					<view class="item ww20">数量</view>
-					<view class="item ww55">处置</view>
+					<view class="item ww15">货位</view>
+					<view class="item ww30">类型</view>
+					<view class="item ww45">处置</view>
 					<view class="item ww15">操作</view>
 				</view>
 
 				<view class="table">
 
-					<view class="tr row rx-sc" v-for="(it, index) in item.sampleList" :key='index'>
+					<view v-for="(it, index) in item.sampleList" :key='index'>
+						<view class="tr row rx-sc ">
+							<view class="item ww15 content_num">
+								{{ it.code }}
+							</view>
 
+							<view class="item ww30 content_num">
+								<zxz-uni-data-select v-model="it.selectType" :localdata="rangeList"
+									:disabled="isDetails" @change="hendleReuseNum"></zxz-uni-data-select>
+							</view>
+
+							<view class="item ww45  content_num">
+								<zxz-uni-data-select :localdata="warehouseList" :disabled="isDetails"
+									v-if='it.selectType == 2' v-model="it.warehouseId" dataValue='id' dataKey="name"
+									filterable format='{name}'></zxz-uni-data-select>
 
-						<view class="item ww15 content_num">
-							{{ it.selectType == 1 ? '回用' : it.selectType == 2 ? '入库' : ''  }}
-						</view>
 
-						<view class="item ww20 content_num">
-							<input class="uni-input" v-if='!isDetails' v-model="it.num" @input="hendleReuseNum(it)"></input>
-							<view v-else> {{ it.num }}</view>
+							</view>
+							<view class="item ww15">
+								<view class="left rx-ss" @click="getDelete(index)">
+									<uni-icons custom-prefix="iconfont" v-if="!isDetails" type="icon-shanchu" size="20"
+										color="#fa3534"></uni-icons>
+								</view>
+							</view>
 						</view>
 
-						<view class="item ww55  content_num">
-							<zxz-uni-data-select :localdata="warehouseList" :disabled="isDetails"
-								v-if='it.selectType != 1' v-model="it.warehouseId" dataValue='id' dataKey="name"
-								filterable format='{name}'></zxz-uni-data-select>
 
-							<view v-if="it.selectType == 1"  class="turnover_btn"> </view>
-						</view>
-						<view class="item ww15">
-							<view class="left rx-ss" @click="getDelete(index)">
-								<uni-icons custom-prefix="iconfont" v-if="!isDetails" type="icon-shanchu" size="20"
-									color="#fa3534"></uni-icons>
+						<view class="tr row  rx-sc wrap" style="margin-bottom: 30rpx;">
+
+							<view class="item ww25 content_num cx-cc" v-for="(p, i) in it.paramList" :key="index + i">
+								<view class="name">{{p.name}}</view>
+								 <input v-model="p.value" style="width: 168rpx ;"></input>
 							</view>
+
 						</view>
 
 					</view>
@@ -105,8 +114,6 @@
 
 
 
-
-
 				</view>
 
 
@@ -149,8 +156,8 @@
 
 
 		</u-popup>
-		
-		
+
+
 
 
 
@@ -165,7 +172,7 @@
 
 	export default {
 		components: {
-		
+
 		},
 		props: {
 			item: {
@@ -185,6 +192,11 @@
 			turnoverList: {
 				type: Array,
 				default: () => []
+			},
+
+			paramList: {
+				type: Array,
+				default: () => []
 			}
 
 
@@ -197,9 +209,10 @@
 				immediate: true,
 				deep: true,
 				handler(newVal) {
-					console.log(newVal)
+
 					this.turnoverCount = 0
 
+
 					newVal.forEach(f => {
 						if (f.extInfo && f.extInfo.positionList && f.extInfo.positionList.length > 0) {
 							f.extInfo.positionList.forEach(o => {
@@ -210,6 +223,37 @@
 
 							})
 						}
+
+						this.mergedArray = []
+						if (f.extInfo && f.extInfo.positionList && f.extInfo.positionList.length > 0) {
+							f.extInfo.positionList.forEach(obj => {
+								if (Object.prototype.hasOwnProperty.call(obj, 'sampleNum') && obj
+									.sampleNum > 1) {
+									for (let i = 0; i < obj.sampleNum; i++) {
+										// 创建对象的副本,以避免引用相同的对象
+										const objCopy = {
+											...obj,
+										paramList: JSON.parse(JSON.stringify(this.paramList)) 
+										};
+										// 可以选择删除 num 属性,如果不需要在最终结果中保留它
+										delete objCopy.sampleNum;
+										this.mergedArray.push(objCopy);
+									}
+								} else if (obj.sampleNum == 1) {
+									// 如果 sampleNum 等于 1,直接推入数组(可以选择删除 sampleNum 属性)
+									const objCopy = {
+										...obj,
+										paramList: JSON.parse(JSON.stringify(this.paramList)) 
+									};
+
+									this.mergedArray.push(objCopy);
+								}
+								// 如果 num 小于 1,则不执行任何操作(根据需求调整)
+							});
+						}
+
+						console.log(this.mergedArray)
+
 					})
 
 
@@ -232,12 +276,13 @@
 						text: "入库"
 					},
 					{
-					value: 3,
-					text: "损耗"	
+						value: 3,
+						text: "损耗"
 					}
 				],
 
-				turnoverCount: 0
+				turnoverCount: 0,
+				mergedArray: []
 			}
 		},
 		created() {
@@ -257,6 +302,7 @@
 
 			penalize() {
 
+
 				if (Number(this.item.sampleNum <= 0)) {
 					uni.showToast({
 						icon: 'none',
@@ -264,71 +310,35 @@
 					})
 					return false
 				}
-
-				this.show = true
+				this.item.sampleList = JSON.parse(JSON.stringify(this.mergedArray))   
+				this.$forceUpdate()
 
 
 			},
 
-			save() {
-				this.show = false
-				if (this.selectType) {
-					 
-					 if(this.selectType == 1) {
-						 
-						 let isFals =  this.item.sampleList.some(m => m.selectType == 1)
-						 if(isFals) {
-						 	uni.showToast({
-						 		icon: 'none',
-						 		title: '已经存在回用类型'
-						 	})
-						 	return false
-						 } else {
-							
-							  this.$set(this.item, 'showReuseTurnover', true)
-							 this.item.sampleList.push({
-							 	selectType: this.selectType,
-							 	num: null,
-							 	warehouseId: null
-							 }) 
-						 }
-						 
-						 
-					 } else {
-						this.item.sampleList.push({
-							selectType: this.selectType,
-							num: null,
-							warehouseId: null
-						}) 
-					 }
-					
-			
-					
-			
-				} else {
-					uni.showToast({
-						icon: 'none',
-						title: '请先选项处置方法'
-					})
-				}
-
-
-
-
-
-			},
 
 			getDelete(idx) {
 				this.item.sampleList.splice(idx, 1)
 			},
-			
-			hendleReuseNum(it) {
-				if(it.selectType == 1) {
-						this.$set(this.item, 'reuseNum', it.num)
-				}
+
+			hendleReuseNum() {
+				let count = 0
+                 if(this.item.sampleList.length > 0) {
+					 this.item.sampleList.forEach(f=> {
+						if (Object.prototype.hasOwnProperty.call(f, 'selectType') && f.selectType == 1) {
+							count = count + 1
+						}
+						 
+					 })
+				 }
+				   if(count > 0) {
+					   	this.$set(this.item, 'reuseNum', count)
+					
+							
+				   }
 			
 			},
-			
+
 
 
 		}
@@ -474,6 +484,9 @@
 			width: 100%;
 			margin-top: 8rpx;
 
+			.wrap {
+				flex-wrap: wrap;
+			}
 
 			.row {
 				width: 100%;
@@ -491,6 +504,10 @@
 					width: 40rpx;
 				}
 
+				.ww25 {
+					width: 25%;
+				}
+
 				.ww30 {
 					width: 30%;
 				}
@@ -503,6 +520,11 @@
 					width: 35%;
 				}
 
+				.ww45 {
+					width: 45%;
+				}
+
+
 				.ww55 {
 					width: 55%;
 				}
@@ -510,11 +532,11 @@
 				.ww15 {
 					width: 15%;
 				}
-				
-				.turnover_btn{
-				color: $theme-color;
-				font-size: 24rpx;
-				padding-left: 12rpx;
+
+				.turnover_btn {
+					color: $theme-color;
+					font-size: 24rpx;
+					padding-left: 12rpx;
 				}
 			}
 
@@ -534,6 +556,8 @@
 
 
 
+
+
 			.tr {
 				border-top: 2rpx solid #E3E5E5;
 				border-left: 2rpx solid #E3E5E5;
@@ -577,22 +601,4 @@
 
 
 	}
-
-	.popup_box {
-		width: 78vw;
-		padding: 32rpx;
-
-
-	}
-
-
-
-	.operate_box {
-		margin-top: 32rpx;
-		padding: 10rpx 100rpx;
-
-		/deep/ .u-button {
-			width: 160rpx;
-		}
-	}
 </style>

+ 22 - 4
pages/pda/sample/index/index.vue

@@ -21,10 +21,10 @@
 
 
 					<sampleBom :item='item.quality' v-if='item.quality' :isDetails='false'
-						:turnoverList='item.turnover'></sampleBom>
+						:turnoverList='item.turnover' :paramList='paramList'></sampleBom>
 
 
-					<reuseTurnoverBom v-if='item.quality.showReuseTurnover' :list='item.turnover' :wordItem='item'
+					<reuseTurnoverBom v-if='item.quality && item.quality.showReuseTurnover' :list='item.turnover' :wordItem='item'
 						:reuseNum='item.quality.reuseNum'>
 					</reuseTurnoverBom>
 
@@ -47,7 +47,8 @@
 	import {
 		workorderList,
 		scanLedger,
-		sampleTurnoverReview
+		sampleTurnoverReview,
+		paramByTaskId
 	} from '@/api/pda/workOrder.js'
 
 
@@ -73,7 +74,9 @@
 				List: [],
 				count: 0,
 
-				isLastJob: true
+				isLastJob: true,
+				
+				paramList: []
 			}
 		},
 
@@ -82,6 +85,8 @@
 			this.id = options.workOrderId
 			this.taskId = options.taskId
 			this.getList()
+			
+			
 
 		},
 		onShow() {
@@ -105,6 +110,7 @@
 			});
 		},
 		methods: {
+	
 			getList() {
 				workorderList({
 					ids: [this.id],
@@ -129,6 +135,8 @@
 							m['turnover'] = []
 							this.getSampleTurnover()
 						}
+						
+							this.getParam(res[0].currentTaskDiagram.sourceTaskId)
 
 						m.feedType = 2
 						delete m.id
@@ -137,7 +145,17 @@
 						}
 					})
 				})
+				
+			
 			},
+			
+			
+			getParam(sourceTaskId) {
+				paramByTaskId(sourceTaskId).then(res => {
+					this.paramList = res
+				})
+			},
+			
 
 			getSampleTurnover() {
 				let param = {