From d7fe8ae3888c8e2b1eea3c1e3769be0d42a21cc9 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期一, 16 十月 2023 09:03:47 +0800
Subject: [PATCH] Merge branch '1.0.3' of http://139.186.142.91:10010/r/productDev/dmMes into 1.0.3

---
 minipro_standard/pages_adjust/pages/workOrderReporting/workOrderReporting.vue |  374 +++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 304 insertions(+), 70 deletions(-)

diff --git a/minipro_standard/pages_adjust/pages/workOrderReporting/workOrderReporting.vue b/minipro_standard/pages_adjust/pages/workOrderReporting/workOrderReporting.vue
index 85ca4fc..7f7965e 100644
--- a/minipro_standard/pages_adjust/pages/workOrderReporting/workOrderReporting.vue
+++ b/minipro_standard/pages_adjust/pages/workOrderReporting/workOrderReporting.vue
@@ -1,7 +1,7 @@
 <template>
 	<view>
 		<view class="tips-label">褰撳墠浠诲姟闇�瑕佽川妫�锛涗骇鍑哄悗锛岃鑰愬績绛夊緟璐ㄦ鍛樻楠岋紝骞舵牴鎹楠岀粨鏋滆皟鏁翠骇鍑烘暟鎹悗鍐嶆姤宸ャ��</view>
-		<workOrderInfo :orederMessage="{proUserList:[]}" />
+		<workOrderInfo :orederMessage="info" />
 		<!-- <u-tabs :list="tab" lineColor="#305ED5" :activeStyle="{color:'#305ED5'}" lineWidth="50%" :itemStyle="{width: '50%', boxSizing: 'border-box', height: '88rpx'}" @click="click"></u-tabs> -->
 		<view class="bg_cate">
 			<view @click="clickIten(index)" :class="typeView == index ? 'bg_cate_item active' : 'bg_cate_item'"
@@ -14,7 +14,9 @@
 						<div class="bg_list_item_top_left_x bg_m"></div>
 						<span>鎶曟枡鏄庣粏</span>
 					</div>
-					<div class="bg_list_item_top_right" @click="jumpTL">
+					<!-- proxy.$auth('h5:workorderinput:create') &&  -->
+					<div class="bg_list_item_top_right" @click="jumpTL"
+						v-if="info.bomType !== 1 || info.bomType == 0 || !info.bomType">
 						<!-- v-if="proxy.$auth('h5:workorderinput:create') && (info.bomType !== 1 || info.bomType == 0 || !info.bomType)" -->
 						<!-- <img src="@/assets/icon/gongdan_ic_shoudong@2x.png" alt="" /> -->
 						<!-- <img src="@/static/gongdan_ic_shoudong@2x.ong" alt="" /> -->
@@ -170,24 +172,24 @@
 					</div>
 				</div>
 			</div>
-
 		</div>
 		<div class="details_dj" v-if="typeView === 1">
 
 			<div class="details_dj_list">
-				<u-swipe-action>
-					<u-swipe-action-item v-for="(item, index) in djData" :key="index" :options="options"
-						@click="dele(item.id)">
-						<div class="details_dj_list_item">
-							<span>{{ item.attrName }}锛歿{ item.val }}</span>
-							<span>{{ item.userName }} {{ item.createTime }}</span>
-						</div>
-					</u-swipe-action-item>
-				</u-swipe-action>
+				<scroll-view scroll-y="true" refresher-enabled="true" @scrolltolower="getLists">
+					<u-swipe-action v-for="(item, index) in djData" :key="index">
+						<u-swipe-action-item :options="options" @click="dele(item.id)">
+							<div class="details_dj_list_item">
+								<span>{{ item.attrName }}锛歿{ item.val }}</span>
+								<span>{{ item.userName }} {{ item.createTime }}</span>
+							</div>
+						</u-swipe-action-item>
+					</u-swipe-action>
+				</scroll-view>
 			</div>
 		</div>
 		<!-- v-if="info.status === 2 || info.procedureNeedcheck === 1" -->
-		<template>
+		<template v-if="info.status === 2 || info.procedureNeedcheck === 1">
 			<div class="bh_zw"></div>
 			<div class="bg_footer bg_f7">
 				<div class="bg_footer_submit bg_m" v-if="typeView == 0" @click="submit">纭鎶ュ伐</div>
@@ -205,11 +207,10 @@
 				<view class="c2 b tc">涓嶈壇椤�</view>
 				<view class="content bl_list">
 					<div class="bl_list_item" v-for="(item, i) in cateList" :key="i" @click="changeChecked(i)">
-						<div class="bl_list_item_left">
-							<u-checkbox-group>
-								<u-checkbox  :key="index" :checked="item.active" :label="item.name"
-									:name="item.name">
-								</u-checkbox>
+						<div class="bl_list_item_left">
+							<u-checkbox-group @change="changeChecked(i)">
+								<u-checkbox :key="index" :checked="item.active" :label="item.name" :name="item.name">
+								</u-checkbox>
 							</u-checkbox-group>
 						</div>
 						<div class="bl_list_item_right">
@@ -227,6 +228,29 @@
 
 <script>
 	import workOrderInfo from '@/components/workOrderInfo.vue'
+	import {
+		getBarcodeContent,
+		queryById,
+		getOrocessRecord,
+		deleteCT,
+		updateById,
+		comfirmDone,
+		comfirmDoneStandard,
+		getListByCondition,
+		allForStandard,
+		pageDJ,
+		deletedj,
+		dealWorkorderRecordStandard,
+		getWorkorderRecordListStandard
+	} from '@/util/api/WorkOrderAPI'
+	import {
+		categoryExtList,
+		queryOne,
+		queryList
+	} from '@/util/api/PlanningAPI'
+	import {
+		REGULAR
+	} from '@/util/utils'
 	export default {
 		components: {
 			workOrderInfo
@@ -242,7 +266,7 @@
 				],
 				form: {
 					time: '',
-					efective: [],
+					defective: [],
 					defectiveName: '',
 					durationName: '0灏忔椂0鍒嗛挓',
 					duration: 0,
@@ -252,54 +276,48 @@
 				TimeShow: false,
 				badShow: false,
 				typeView: 0,
-				feedingData: [{
-					id: 0,
-					materialName: '澧欎綋鐮�',
-					procedureName: '鍘嬪埗',
-					qualityType: 1,
-					locationName: 'CP-01',
-					batch: '20230713',
-					num: 2,
-					maxNum: 10,
-					unitAttribute: 1,
-					unitName: '鍧�'
-				}],
+				workorderId: '',
+				info: {},
+				feedingData: [],
 				options: [{
 					text: '鍒犻櫎',
 					style: {
 						backgroundColor: 'red',
 					}
 				}],
-				arrType: [{
-						name: '璁℃椂',
-						type: 1,
-						salary: 1000,
-					},
-					{
-						name: '璁′欢',
-						type: 0,
-						salary: 100
-					},
-				],
+				arrType: [],
 				// 浜у嚭鍚堟牸/涓嶈壇
 				produceFrom: {
 					qualifiedId: '',
 					qualified: '', // 鍚堟牸
 					undesirableId: '',
-					undesirable: 5 // 涓嶈壇
+					undesirable: '' // 涓嶈壇
 				},
-				djData: [{
-					attrName: '鍑烘按鏃堕棿',
-					val: '2022-05-28 16:3',
-					userName: '寮犱笁 ',
-					createTime: '2022-05-28 16:32:'
-				}],
-				cateList: [{
-					active: false,
-					name: '姣涘埡',
-					num: 0
-				}]
+				triggered: false,
+				finished: true,
+				djData: [],
+				cateList: [],
+				pages: {
+					capacity: 10,
+					page: 1,
+					total: 0
+				}
 			};
+		},
+		onLoad(obj) {
+			this.workorderId = obj.id
+			this.queryByIds()
+			this.getOrocessRecords()
+			this.getData()
+			uni.$on('spotAdd', () => {
+				if (this.typeView == 1) {
+					this.pages.page = 1
+					this.pageDJs()
+				}
+			})
+			uni.$on('addMaterial', () => {
+				this.getOrocessRecords()
+			})
 		},
 		computed: {
 			expectedSalary() {
@@ -343,11 +361,64 @@
 			}
 		},
 		methods: {
+			queryByIds() {
+				queryById(this.workorderId)
+					.then(res => {
+						this.info = res.data
+						queryList({
+							deleted: 0,
+							departId: res.data.factoryId,
+							materialId: res.data.materialId,
+							procedureId: res.data.procedureId
+						}).then(result => {
+							if (result.code === 200) {
+								if (result.data && result.data.length > 0) {
+									result.data.forEach((item, index) => {
+										item.name = item.type == 0 ? '璁′欢' : '璁℃椂'
+										item.id = item.type
+										item.active = index == 0
+									})
+									this.arrType = result.data
+								} else {
+									this.arrType = []
+								}
+							}
+						})
+					})
+			},
+			getOrocessRecords() {
+				this.feedingData = []
+				allForStandard({
+					workorderId: this.workorderId,
+					type: 0
+				}).then(res => {
+					if (res.code === 200) {
+						this.feedingData = res.data
+					}
+				})
+			},
+			getData() {
+				categoryExtList({
+					cateType: "3"
+				}).then(res => {
+					if (res.code === 200) {
+						res.data.forEach(item => {
+							item.active = false
+							item.num = ''
+						})
+						this.cateList = res.data
+					}
+				})
+			},
 			click() {
 
 			},
 			clickIten(index) {
 				this.typeView = index
+				if (this.typeView == 1) {
+					this.pages.page = 1
+					this.pageDJs()
+				}
 			},
 			timeConfirm({
 				value
@@ -410,31 +481,194 @@
 				//   }
 				// })
 			},
+			changeCC(downType, num, recordId) {
+				if (!num) return
+				console.log(Number(this.produceFrom.qualified) + Number(this.produceFrom.undesirable))
+				if ((Number(this.produceFrom.qualified) + Number(this.produceFrom.undesirable)) > this.info.planNum) {
+					uni.showToast({
+						title: '浜у嚭鏁伴噺涓嶈兘澶т簬璁″垝鏁伴噺',
+						duration: 2000,
+						icon: 'none'
+					})
+					return
+				}
+				if (num >= 0) {
+					this.form.defective = []
+					this.form.defectiveName = ''
+					// dealWorkorderRecordStandard({
+					//     downType, num, recordId, workorderId: route.query.id
+					// }).then(res => {
+					//     if (res.code === 200) {
+					//         getOrocessRecordCC()
+					//     }
+					// })
+				} else {
+					if (downType == 0) {
+						this.produceFrom.qualified = 0
+					} else {
+						this.produceFrom.undesirable = 0
+					}
+					uni.showToast({
+						title: '浜у嚭鏁伴噺涓嶈兘灏忎簬',
+						duration: 2000,
+						icon: 'none'
+					})
+				}
+			},
 			clickPerformanceType(item, index) {
 				this.form.index = index
 				this.form.type = item.type
 			},
-			submit() {},
-			jumpdj() {},
-			pageDJs() {},
-			dele(id) {
-				// deletedj(id)
-				//     .then(res => {
-				//       if (res.code === 200) {
-				//         djData.value = []
-				//         finished.value = false
-				//         page.page = 1
-				//         djData.value = []
-				//         pageDJs()
-				//       }
-				//     })
+			submit() {
+				let createUnqualifiedDTOList = this.form.defective.map((item) => {
+					return {
+						categoryId: item.id,
+						unQualifiedNum: item.num
+					}
+				})
+				let createWorkorderRecordDTO = {
+					workorderId: this.workorderId,
+					duration: this.form.duration ? this.form.duration : 0,
+					qualifiedNum: this.produceFrom.qualified ? this.produceFrom.qualified : 0,
+					unQualifiedNum: this.produceFrom.undesirable ? this.produceFrom.undesirable : 0
+				}
+				// id: route.query.id
+				comfirmDoneStandard({
+					createUnqualifiedDTOList,
+					createWorkorderRecordDTO
+				}).then(res => {
+					if (res.code === 200) {
+						uni.$u.toast('鎶ュ伐鎴愬姛')
+						setTimeout(() => {
+							uni.navigateBack({
+								data: 2
+							})
+						}, 2000)
+					}
+				})
 			},
-			confirm() {
-				// console.log('confirm');
+			jumpdj() {
+				uni.navigateTo({
+					url: `/pages_adjust/pages/spotCheck/spotCheck?id=${this.workorderId}`
+				})
+			},
+			getLists() {
+				if (!this.finished) {
+					return
+				}
+				this.finished = false
+				this.pages.page += 1
+				this.pageDJs()
+			},
+			pageDJs() {
+
+				pageDJ({
+						capacity: this.pages.capacity,
+						page: this.pages.page,
+						model: {
+							workorderId: this.workorderId
+						}
+					}).then(res => {
+						let {
+							data
+						} = res
+						if (data.page == 1) {
+							this.djData = []
+						}
+						this.djData.push(...data.records)
+						// loading.value = false
+					}).catch(err => {
+						// loading.value = false
+						// finished.value = true
+					})
+					.finally(() => {
+						this.finished = true
+					})
+			},
+			dele(id) {
+				deletedj(id)
+					.then(res => {
+						if (res.code === 200) {
+							this.finished = true
+							this.pages.page = 1
+							this.pageDJs()
+						}
+					})
+			},
+			confirm() {
+				let isOpen = false
+				this.cateList.forEach((item, index) => {
+					if (item.active) {
+						isOpen = true
+					}
+				})
+				if (!isOpen) {
+					uni.showToast({
+						title: '璇烽�夋嫨涓嶈壇椤�',
+						duration: 2000,
+						icon: 'none'
+					})
+					return
+				}
+				let arr = []
+				let total = 0
+				let name = ''
+				this.cateList.forEach((item, index) => {
+					if (item.active) {
+						if (item.num <= 0) {
+							uni.showToast({
+								title: '涓嶈壇鏁伴噺蹇呴』澶т簬0',
+								duration: 2000,
+								icon: 'none'
+							})
+							return
+						}
+						total = total += item.num
+						arr.push(item)
+						name += item.name + item.num + '锛�'
+					}
+				})
+				if (total != Number(this.produceFrom.undesirable)) {
+					uni.showToast({
+						title: '涓嶈壇鏁板繀椤荤瓑浜庝骇鍑轰笉鑹暟',
+						duration: 2000,
+						icon: 'none'
+					})
+					return
+				}
+				this.form.defective = arr
+				this.form.defectiveName = name
 				this.badShow = false
 			},
 			changeChecked(i) {
 				this.cateList[i].active = !this.cateList[i].active
+			},
+			jumpTL() {
+				uni.navigateTo({
+					// url: ''
+					url: `/pages_adjust/pages/manualFeed/manualFeed?id=${this.workorderId}`
+				})
+			},
+			deleItem(id, type) {
+				uni.showModal({
+					title: '鎻愮ず',
+					content: '纭畾鍒犻櫎姝ゆ潯璁板綍鍚楋紵',
+					success: (res) => {
+						if (res.confirm) {
+							console.log('鐢ㄦ埛鐐瑰嚮纭畾');
+							deleteCT(id)
+								.then(res => {
+									this.getOrocessRecords()
+									// if (type === 'C') {
+									// 	this.getOrocessRecordCC()
+									// } else if (type === 'T') {
+									// 	this.getOrocessRecords()
+									// }
+								})
+								.catch(err => {})
+						}
+					}
+				})
 			}
 		}
 	}

--
Gitblit v1.9.3