ysy il y a 2 ans
Parent
commit
a461b84743

+ 12 - 0
api/pda/workOrder.js

@@ -245,3 +245,15 @@ export async function listWorkReport(params) {
 	return Promise.reject(data.message);
 }
 
+
+// 根据工单工序获取普通质检工序投料的废品数量
+
+export async function junkCount(id,taskId) {
+	const data = await get(
+		Vue.prototype.apiUrl + `/pda/mes/feed/junkCount/${id}/${taskId}`,
+	);
+	if (data.code == 0) {
+		return data.data;
+	}
+	return Promise.reject(data.message);
+}

+ 195 - 0
pages/pda/sample/components/diagramLast.vue

@@ -0,0 +1,195 @@
+<template>
+	<view>
+
+
+		<view class="material ">
+
+			<view class="content_table">
+				<view class="item">
+					<view class="lable rx-cc">工序名称</view>
+					<view class="content">
+						{{item.diagramLast.taskTypeName}}
+					</view>
+				</view>
+
+
+
+				<view class="item rx-sc">
+					<view class="rx ww55 ">
+						<view class="lable  rx-cc">合格数量</view>
+						<view class="content rx-sc">
+							<view>{{ item.formedNum }}</view>
+						</view>
+					</view>
+
+					<view class="rx ww45">
+						<view class="lable rx-cc ww80">重量</view>
+						<view class="content">
+							{{ item.formedWeight}} {{item.unit}}
+						</view>
+					</view>
+
+				</view>
+
+				<view class="item">
+					<view class="lable rx-cc">已质检数量</view>
+					<view class="content">
+						{{ feedCount }}
+					</view>
+				</view>
+
+
+
+
+
+
+
+
+
+
+			</view>
+
+		</view>
+
+
+
+
+	</view>
+</template>
+
+<script>
+	export default {
+		props: {
+			item: {
+				type: Object,
+				default: () => {}
+			},
+
+			count: {
+				type: Number,
+				default: 0
+			}
+
+
+
+
+
+		},
+
+		watch: {
+			count: {
+				immediate: true,
+				deep: true,
+				handler(val) {
+					console.log(val)
+					this.feedCount = val
+
+				}
+			}
+		},
+		data() {
+			return {
+				feedCount: 0
+			}
+		},
+		created() {
+
+		},
+		methods: {
+
+
+
+
+
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.material {
+		margin-top: 10rpx;
+
+
+
+		.content_table {
+			width: 100%;
+			border: 2rpx solid $border-color;
+
+			.item {
+				display: flex;
+				border-bottom: 2rpx solid $border-color;
+
+
+				.lable {
+					width: 156rpx;
+					text-align: center;
+					background-color: #F7F9FA;
+					font-size: 26rpx;
+					border-right: 2rpx solid $border-color;
+					flex-shrink: 0;
+				}
+
+				.lable150 {
+					width: 156rpx !important;
+					font-size: 24rpx;
+				}
+
+				.ww80 {
+					width: 80rpx;
+				}
+
+				.content {
+					width: 518rpx;
+					min-height: 64rpx;
+					font-size: 28rpx;
+					line-height: 28rpx;
+					font-style: normal;
+					font-weight: 400;
+					padding: 18rpx 8rpx;
+					box-sizing: border-box;
+					word-wrap: break-word;
+					flex-grow: 1 !important;
+
+
+					.unit {
+						padding: 0 4rpx;
+						font-size: 24rpx;
+						color: #404446;
+					}
+
+					.penalize {
+						width: 200rpx;
+						line-height: 60rpx;
+						background: $theme-color;
+						font-size: 24rpx;
+						text-align: center;
+						color: #fff;
+					}
+
+				}
+
+
+				.pd4 {
+					padding: 4rpx 8rpx;
+				}
+
+
+
+				&:last-child {
+					border-bottom: none;
+				}
+			}
+
+			.ww55 {
+				width: 55%;
+			}
+
+			.ww45 {
+				width: 45%;
+			}
+		}
+
+
+
+	}
+</style>

+ 70 - 31
pages/pda/sample/components/inspectionBom.vue

@@ -9,43 +9,52 @@
 
 		<view class="content_table2">
 			<view class="head row rx-sc">
-				<view class="item ww35">名称</view>
-				<view class="item ww45">废品数量 ({{ count|| 0 }})</view>
-				<view class="item ww20">操作</view>
+				<view class="item ww30">类型</view>
+				<view class="item ww20">废品数量</view>
+				<view class="item ww40">处置</view>
+				<view class="item ww10">操作</view>
 			</view>
 
 			<view class="table">
-				<u-list @scrolltolower="scrolltolower" class="z_list">
-					<view class="tr row rx-sc" v-for="(it, idx) in inspectionList" :key='idx'>
-						<view class="item ww35">
-							{{ it.name }}
-						</view>
-						<view class="item ww45 content_num">
-							<input class="uni-input" v-model="it.quantity" type="number" @input="onKeyInput"></input>
-						</view>
+
+				<view class="tr row rx-sc" v-for="(it, idx) in inspectionList" :key='idx'>
+					<view class="item ww30">
+						{{ it.name }}
+					</view>
+					<view class="item ww20 content_num" >
+					
+						<input v-if='it.id != -1' class="uni-input" v-model="it.quantity" type="number" @input="onKeyInput"></input>
+					     <view v-else>{{ it.quantity || 0}}</view>
+					</view>
+					<view class="item ww40 content_num" v-if='it.id != -1'>
+						<zxz-uni-data-select :localdata="warehouseList" v-model="it.warehouseId" dataValue='id'
+							dataKey="name" filterable format='{name}'></zxz-uni-data-select>
+					</view>
 
 
-						<view class="ww20 rx-ac">
-							<uni-icons custom-prefix="iconfont" type="icon-shanchu" size="20" color="#fa3534"
-								@click="handleDel(idx)"></uni-icons>
-							<uni-icons type="eye-filled" size="20" @click="handleView(it)"></uni-icons>
-						</view>
 
+					<view class="ww10 rx-ac">
+						<uni-icons custom-prefix="iconfont" v-if='it.id != -1' type="icon-shanchu" size="20" color="#fa3534"
+							@click="handleDel(idx)"></uni-icons>
 
 					</view>
-				</u-list>
 
-			</view>
 
+				</view>
 
 
+			</view>
+			
+			
+		
+			
 
 
-		</view>
 
 
 
 
+		</view>
 
 
 		<!-- <ba-tree-picker ref="treePicker" :selectedData='selectedData' key="verify" :multiple="false"
@@ -57,6 +66,12 @@
 
 <script>
 	import baTreePicker from '@/components/ba-tree-picker/ba-tree-picker.vue'
+
+	import {
+
+		getWarehouseList,
+
+	} from '@/api/pda/workOrder.js'
 	export default {
 
 		components: {
@@ -66,6 +81,11 @@
 			inspectionList: {
 				type: Array,
 				default: () => []
+			},
+			
+			normalQuality: {
+				type: Object,
+				default: () => {}
 			}
 		},
 		data() {
@@ -76,11 +96,12 @@
 
 
 				count: 0,
+				warehouseList: []
 			}
 		},
 
 		created() {
-
+			this.getWarehouse()
 		},
 
 		methods: {
@@ -104,7 +125,13 @@
 			onKeyInput() {
 				this.count = 0
 				this.inspectionList.map(L => {
-					this.count = Number(this.count) + Number(L.quantity)
+					if(Number(L.quantity) > 0 && Number(L.quantity) != NaN && L.id != -1) {
+							this.count = Number(this.count) + Number(L.quantity)
+							this.inspectionList[this.inspectionList.length - 1]['quantity'] = 	this.count
+							this.normalQuality['quantity'] = this.count
+					}
+				
+			
 				})
 			},
 
@@ -112,7 +139,16 @@
 
 			},
 
-			scrolltolower() {},
+			getWarehouse() {
+				getWarehouseList().then(res => {
+					this.warehouseList = res
+
+				})
+
+			}
+
+
+
 		}
 
 
@@ -187,17 +223,24 @@
 				color: $theme-color;
 			}
 
+
+			.ww30 {
+				width: 30%;
+
+			}
+
 			.ww20 {
 				width: 20%;
+
 			}
 
-			.ww35 {
-				width: 35%;
+			.ww40 {
+				width: 40%;
 
 			}
 
-			.ww45 {
-				width: 45%;
+			.ww10 {
+				width: 10%;
 			}
 		}
 
@@ -224,7 +267,7 @@
 
 			.item {
 				font-size: 24rpx;
-				min-height: 64rpx;
+				min-height: 76rpx;
 				display: flex;
 				align-items: center;
 				border-right: 2rpx solid #E3E5E5;
@@ -254,8 +297,4 @@
 		}
 
 	}
-
-	.z_list {
-		max-height: 400rpx;
-	}
 </style>

+ 3 - 0
pages/pda/sample/index/index.vue

@@ -28,6 +28,8 @@
 		workorderList,
 
 	} from '@/api/pda/workOrder.js'
+	
+
 	import workOrderBom from '../../feeding/components/workOrderBom.vue'
 	import sampleBom from '../components/sampleBom.vue'
 	import {
@@ -63,6 +65,7 @@
 					this.List = res.map(m => {
 						m.workOrderId = m.id
 						m.quality['sampleList'] = []
+						m.feedType = 2
 						delete m.id
 						return {
 							...m

+ 158 - 8
pages/pda/sample/inspection/index.vue

@@ -10,7 +10,24 @@
 				<view class="card_box" v-for="(item,index) in List" :key="index">
 					<workOrderBom :item='item' v-if='item' @handleScan='handleWordScan'></workOrderBom>
 
-					<inspectionBom :inspectionList='inspectionList'></inspectionBom>
+					<deviceBom v-if='item.equipmentList.length != 0' :workOrderId='item.workOrderId'
+						:list='item.equipmentList' @scanIt='scanIt'></deviceBom>
+					<view class="operate_box rx-sc">
+						<u-button size="small" class="u-reset-button" type="success"
+							@click="handAdd(item.workOrderId)">手动添加</u-button>
+						<u-button size="small" class="u-reset-button" type="success"
+							@click="scanIt(item.workOrderId)">扫一扫</u-button>
+					</view>
+
+					<diagramLast :item='item.normalQuality' v-if='item' :count='feedCount'></diagramLast>
+
+
+					<inspectionBom :inspectionList='inspectionList' :normalQuality='item.normalQuality'></inspectionBom>
+
+
+
+
+
 				</view>
 			</u-list>
 		</view>
@@ -28,8 +45,9 @@
 <script>
 	import {
 		workorderList,
-		getLastTreeByPid
-
+		getLastTreeByPid,
+		scanLedger,
+		junkCount
 	} from '@/api/pda/workOrder.js'
 	import {
 		batchSave
@@ -37,20 +55,28 @@
 
 	import workOrderBom from '../../feeding/components/workOrderBom.vue'
 	import inspectionBom from '../components/inspectionBom.vue'
+	import deviceBom from '../../feeding/components/deviceBom.vue'
+	import diagramLast from '../components/diagramLast.vue'
+
 	export default {
 		components: {
 			workOrderBom,
-			inspectionBom
+			inspectionBom,
+			deviceBom,
+			diagramLast
 		},
 		data() {
 			return {
 				title: null,
 				id: null,
 				taskId: null,
+
 				inspectionId: null,
 				inspectionName: null,
 				List: [],
-				inspectionList: []
+				inspectionList: [],
+
+				feedCount: 0,
 			}
 		},
 
@@ -60,31 +86,81 @@
 			this.taskId = options.taskId
 			this.getList()
 
+			this.getCount()
 			this.getLastTree()
 		},
 
+		onShow() {
+			uni.$off("setSelectList");
+
+			uni.$on("setSelectList", (selectList, id) => {
+
+				this.List.forEach(m => {
+					if (m.workOrderId == id) {
+						let equipmentList = [] // 生产设备
+
+						selectList.forEach(f => {
+							if (f.rootCategoryLevelId == 4) {
+								equipmentList = equipmentList.concat(f)
+							}
+						})
+
+						this.$set(m, 'equipmentList', equipmentList)
+
+					}
+
+				})
+
+			})
+		},
+
 		methods: {
 			getList() {
 				workorderList({
 					ids: [this.id],
-					taskId: this.taskId
+					taskId: this.taskId,
+
 				}).then(res => {
 					this.List = res.map(m => {
 						m.workOrderId = m.id
+						m.instanceList = [] // 物料
+						m.equipmentList = [] // 设备
+						m.modelList = [] // 模具
+						m.aridRegionList = [] // 干燥区
+
+						m.normalQuality.quantity = 0
+						m.feedType = 3
+
 						delete m.id
+
+						if (this.taskId) {
+							m.taskId = this.taskId
+						}
 						return {
 							...m
 						}
 					})
 				})
 			},
-			
+
+			getCount() {
+				junkCount(this.id, this.taskId).then(res => {
+					this.feedCount = res
+
+				})
+			},
+
 			getLastTree() {
 				getLastTreeByPid(this.$route.query.inspectionId).then(res => {
 					this.inspectionList = res
+
+					this.inspectionList.push({
+						id: -1,
+						name: '废品总数量'
+					})
 				})
 			},
-			
+
 
 
 			scrolltolower() {},
@@ -94,6 +170,80 @@
 					title: '不支持换工单'
 				})
 			},
+
+			scanIt(id) {
+				console.log(id)
+
+
+				// this.scanItData('CX-PW-FZ-002995001', id)
+				// return false
+
+				let _this = this
+				uni.scanCode({
+					success: function(res) {
+						_this.scanItData(res.result, id)
+					}
+				})
+			},
+
+			scanItData(result, id) {
+				scanLedger(result).then(res => {
+					console.log(res)
+					let _arr = []
+					if (res.length == 1 && res[0].rootCategoryLevelId == 4) { // 设备
+						_arr = this.List
+						_arr.forEach((e, index) => {
+							if (e.workOrderId == id) {
+								_arr[index].equipmentList = res
+							}
+						})
+						this.List = _arr
+						this.$forceUpdate()
+
+					}
+
+				})
+
+			},
+
+			save() {
+
+				if (this.List[0].normalQuality.quantity <= 0) {
+
+					uni.showToast({
+						icon: 'none',
+						title: '废品数量大于0'
+					})
+					return false
+				}
+
+				if (this.List[0].normalQuality.formedNum - this.List[0].normalQuality.quantity - this.feedCount < 0) {
+					uni.showToast({
+						icon: 'none',
+						title: '已质检数量不能大于合格数量'
+					})
+					return false
+				}
+
+
+				this.List[0].normalQuality.inspectionList = this.inspectionList
+
+				batchSave(this.List).then(res => {
+					uni.navigateBack()
+				})
+			},
+
+
+			handAdd(id) {
+				console.log(id)
+				const storageKey = Date.now() + "";
+				uni.setStorageSync(storageKey, this.List || []);
+				uni.navigateTo({
+					url: `/pages/pda/workOrder/search/index?id=${id}&storageKey=${storageKey}&isType=feed&taskId=${this.taskId}`
+				})
+			},
+
+
 		}
 	}
 </script>

+ 6 - 0
pages/pda/workOrder/extrusionMolding/index.vue

@@ -85,6 +85,12 @@
 					<text>{{ info.planStartTime }}</text>
 				</view>
 
+				<view class="item_list rx-bc">
+					<text class="lable">计划结束时间</text>
+					<text>{{ info.planCompleteTime }}</text>
+				</view>
+
+
 
 
 			</u-list>