From eacff2ef7312ff9ecfc098a508bac36329e96f14 Mon Sep 17 00:00:00 2001 From: Houjie <714924425@qq.com> Date: 星期三, 10 九月 2025 09:46:52 +0800 Subject: [PATCH] 线边库-入库 --- pages/eam/production/report/report.vue | 336 +++++++++++++++++++++++++++---------------------------- 1 files changed, 164 insertions(+), 172 deletions(-) diff --git a/pages/eam/production/report/report.vue b/pages/eam/production/report/report.vue index c603703..9e44610 100644 --- a/pages/eam/production/report/report.vue +++ b/pages/eam/production/report/report.vue @@ -4,12 +4,12 @@ <block slot="backText">杩斿洖</block> <block slot="content">鎶ュ伐</block> <block slot="right"> - <view @click="printHandel"> + <view v-show="isShow" @click="printHandel"> <image class="search" src="/static/icon_dayin.png" style="width: 25px; height: 25px;" alt="鎵撳嵃鎸夐挳" /> </view> </block> </cu-custom> - + <!-- 楠ㄦ灦灞� --> <view v-if="loading" class="skeleton-container"> <view class="skeleton-group"> @@ -31,7 +31,7 @@ <view class="skeleton-input"></view> </view> </view> - + <view class="skeleton-group"> <view class="skeleton-divider"></view> <view class="skeleton-item"> @@ -59,53 +59,29 @@ <view class="skeleton-datetime"></view> </view> </view> - + <view class="skeleton-button"></view> </view> - + <!-- 瀹為檯鍐呭 --> <view v-else class="container"> - <uni-forms - ref="form" - :modelValue="formData" - :rules="rules" - validate-trigger="bind" - err-show-type="undertext"> + <uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext"> <uni-group top="1"> <view class="divider"><text>宸ュ崟淇℃伅</text></view> - <uni-forms-item :label-width="100" name="workOrderNumber" label="鍗曟嵁缂栧彿:"> - <uni-easyinput v-model="formData.workOrderNumber" :disabled="true" /> + <uni-forms-item :label-width="100" name="workOrderNumber" label="鎶ュ伐宸ュ崟:"> + <uni-data-select v-model="workOrderNumber" :localdata="productionOrderList" + @change="changeProductionOrder" placeholder="璇烽�夋嫨" /> </uni-forms-item> - <uni-forms-item :label-width="100" name="materialCode" label="鐗╂枡缂栫爜:"> - <uni-easyinput v-model="formData.materialCode" :disabled="true" /> - </uni-forms-item> - - <uni-forms-item :label-width="100" name="materialDescription" label="鐗╂枡鎻忚堪:"> - <uni-easyinput v-model="formData.materialDescription" :disabled="true" /> - </uni-forms-item> - <uni-forms-item :label-width="100" name="plannedQuantity" label="璁″垝鏁伴噺:"> - <uni-easyinput v-model="formData.plannedQuantity" :disabled="true" /> - </uni-forms-item> - - <view class="divider"><text>鎶ュ伐淇℃伅</text></view> - - <uni-forms-item :label-width="140" required name="inspectionOrderNumber" - label="鎶ュ伐鍗曞彿:"> - <uni-easyinput v-model="formData.inspectionOrderNumber" placeholder="绯荤粺鐢熸垚" :disabled="true" /> - </uni-forms-item> - <uni-forms-item :label-width="140" required name="process" label="浠撳簱"> - <uni-data-select v-model="formData.process" :localdata="SpareList" @change="changeisSpareList" + <uni-forms-item :label-width="100" name="reportCode" label="鐢熶骇 璁㈠崟:"> + <uni-data-select v-model="reportCode" :localdata="reportCodeList" @change="changeReportCodeList" placeholder="璇烽�夋嫨" /> </uni-forms-item> - <uni-forms-item :label-width="140" required name="inspectionQuantity" label="鎶ュ伐鏁伴噺:"> - <uni-number-box v-model="formData.inspectionQuantity" /> + + <uni-forms-item :label-width="100" name="materialDescription" label="浜х嚎:"> + <uni-easyinput v-model="formData.materialDescription" :disabled="true" /> </uni-forms-item> - <uni-forms-item :label-width="140" required name="inspectionPlan" label="妫�楠屼汉鍛�"> - <uni-data-select v-model="formData.inspectionPlan" :localdata="SpareList" - @change="changeisSpareList" placeholder="璇烽�夋嫨" /> - </uni-forms-item> - <uni-forms-item :label-width="140" required name="inspectionTime" label="鎶ュ伐鏃堕棿"> - <uni-datetime-picker type="datetime" v-model="formData.inspectionTime" /> + <uni-forms-item :label-width="100" name="plannedQuantity" label="鎶ュ伐鏁伴噺:"> + <uni-number-box :min="0" :max="9999" v-model="formData.plannedQuantity" /> </uni-forms-item> </uni-group> </uni-forms> @@ -115,7 +91,7 @@ @click.stop="ProductionTask()" hover-class="is-hover">纭畾</view> </view> </view> - + <pdaScanVue></pdaScanVue> </view> </template> @@ -123,7 +99,9 @@ <script> import pdaScanVue from "@/components/mes/pdaScan.vue"; import QRCode from 'qrcode'; - + import { + mapGetters + } from "vuex"; export default { components: { pdaScanVue @@ -132,16 +110,12 @@ return { loading: true, isShow: false, + materialNumber: '', isSubmitting: false, // 闃查噸澶嶆彁浜� - SpareList: [{ - text: "鏄�", - value: 1 - }, - { - text: "鍚�", - value: 0 - } - ], + productionOrderList: [], + reportCodeList: [], + reportCode: '', + workOrderNumber: '', scrollLeft: 0, formData: { workOrderNumber: '1111111', @@ -160,48 +134,12 @@ produceDate: '', workshop: '瑁呴厤杞﹂棿3鍙风嚎' }, - // 琛ㄥ崟楠岃瘉瑙勫垯 - rules: { - process: { - rules: [{ - required: true, - errorMessage: '璇烽�夋嫨宸ュ簭' - }] - }, - inspectionType: { - rules: [{ - required: true, - errorMessage: '璇烽�夋嫨妫�楠岀被鍨�' - }] - }, - inspectionPlan: { - rules: [{ - required: true, - errorMessage: '璇烽�夋嫨妫�楠屾柟妗�' - }] - }, - inspectionTime: { - rules: [{ - required: true, - errorMessage: '璇烽�夋嫨妫�楠屾椂闂�' - }] - }, - inspectionQuantity: { - rules: [{ - required: true, - errorMessage: '璇疯緭鍏ラ�佹鏁伴噺' - }, { - format: 'number', - errorMessage: '閫佹鏁伴噺蹇呴』涓烘暟瀛�' - }] - } - }, + NavBarColor: this.NavBarColor, url: { - upload: "/eam/sysFiles/batch_upload", - stallList: "/eam/eamRepairOrder/queryById", - getEquipmentList: 'eam/equipment/list', - approval: '/eam/eamRepairOrder/perform' + getEquipmentList: 'mes/mesProductionWorkOrder/list', + approval: '/mes/productionOrder/selectReportWorkOrderList', + add: 'mes/mesWorkReporting/add' }, styles: { color: '#2979FF', @@ -211,6 +149,7 @@ } }, computed: { + ...mapGetters(["currentLineName", "username", "currentLineId"]), top() { return this.CustomBar * 2 + 160 }, @@ -221,37 +160,100 @@ return style }, }, - mounted() { - /** - * 涓婃枡涓嬫枡鏍规嵁鐗╂枡绫诲瀷鍒ゆ柇锛堥澶栦俊鎭�)---鎵爜/鎵嬪姩杈撳叆 ---锛堟墜鍔ㄨ緭鍏ヨ皟鐢ㄦ帴鍙h繑鍥炲簱瀛樹俊鎭級 鎵爜淇℃伅鎻愪氦鍚庣锛屽湪閲嶆柊璧嬪�� 鍒ゆ柇鐗╂枡绫诲瀷- 鏄剧ず鐗规畩灞炴�у�硷紝 搴撳瓨淇℃伅涔熻淇濆瓨 - */ - const currentLineType = this.$store.getters.currentLineType; - console.log('褰撳墠浜х嚎绫诲瀷锛�', currentLineType); - /** - * 瑁呴厤 ASSEMBLE - * 鍐呮硶鍏癐NNERFLANGE - * 澶栨硶鍏癘UTERFLANGE - * 鐑鐞咹EATTREATMENT - */ - }, created() { - // 鍒濆鍖栫敓浜ф棩鏈熶负褰撳墠鏃ユ湡 - this.formData.produceDate = this.formatDate(new Date()); - - // 妯℃嫙鏁版嵁鍔犺浇 - setTimeout(() => { - this.loading = false; - }, 1000); + this.formData.materialDescription = this.currentLineName; + this.getRelatedProdOrder(); + }, methods: { - // 鏍煎紡鍖栨棩鏈� - formatDate(date) { - const year = date.getFullYear(); - const month = String(date.getMonth() + 1).padStart(2, '0'); - const day = String(date.getDate()).padStart(2, '0'); - return `${year}-${month}-${day}`; + changeReportCodeList(e) { + this.reportCode = e; }, - + changeProductionOrder(e) { + this.workOrderNumber = e; + // 閫氳繃 selectedValue 鍖归厤 productionOrderList 涓殑椤� + const selectedItem = this.productionOrderList.find( + item => item.value === this.workOrderNumber + ); + if (selectedItem) { + // 鑾峰彇 materialNumber + this.materialNumber = selectedItem.materialNumber; + console.log('閫変腑椤圭殑 materialNumber:', this.materialNumber); + + // 鑾峰彇绱㈠紩锛堝彲閫夛紝鑻ラ渶瑕佺储寮曪級 + const index = this.productionOrderList.findIndex( + item => item.value === this.workOrderNumber + ); + console.log('閫変腑椤圭殑绱㈠紩:', index); + } + + this.getReportCodeList(this.materialNumber); + }, + getReportCodeList(code) { + this.$http.get(this.url.approval, { + params: { + materialNumber: code, + } + }).then(res => { + if (res.data.success) { + this.loading = false; + this.reportCodeList = res.data.result + } else { + uni.showModal({ + title: "鎻愮ず", + content: res.data.message, + confirmText: '纭畾', + showCancel: false, + }) + } + }).catch(() => { + this.$tip.loaded(); + uni.showToast({ + icon: "error", + title: res.data.message, + duration: 2000 + }); + }); + + + }, + getRelatedProdOrder() { + this.$http.get(this.url.getEquipmentList, { + params: { + workOrderStatus: "EXECUTING", + factoryId: this.currentLineId + + } + }).then(res => { + if (res.data.success) { + this.loading = false; + this.productionOrderList = (res.data.result.records || []).map(line => ({ + value: line.value, + text: line.text, + materialNumber: line.materialNumber // 纭繚鏄犲皠type瀛楁 + })); + console.log(this.productionOrderList) + + } else { + uni.showModal({ + title: "鎻愮ず", + content: res.data.message, + confirmText: '纭畾', + showCancel: false, + }) + } + }).catch(() => { + this.$tip.loaded(); + uni.showToast({ + icon: "error", + title: res.data.message, + duration: 2000 + }); + }); + + + }, + // 鐐瑰嚮鎵撳嵃鎸夐挳锛氱敓鎴怘TML棰勮骞惰烦杞� async printHandel() { // 1. 楠岃瘉琛ㄥ崟淇℃伅 @@ -263,48 +265,47 @@ }); return; } - + try { - uni.showLoading({ title: '鐢熸垚棰勮涓�...' }); - + uni.showLoading({ + title: '鐢熸垚棰勮涓�...' + }); + // 2. 鏀堕泦鎵撳嵃鏁版嵁 const tagData = this.getReportPrintData(); - + // 3. 璺宠浆鑷抽瑙堥〉锛屽苟鎼哄甫鎵撳嵃鏁版嵁 await uni.navigateTo({ url: `/pages/finished-product-preview/finished-product-preview?tagData=${encodeURIComponent(JSON.stringify(tagData))}` }); - + uni.hideLoading(); } catch (error) { uni.hideLoading(); console.error('鐢熸垚棰勮澶辫触:', error); - uni.showToast({ title: '棰勮鐢熸垚澶辫触', icon: 'none' }); + uni.showToast({ + title: '棰勮鐢熸垚澶辫触', + icon: 'none' + }); } }, // 鐢熸垚鎴愬搧鎵樻爣绛炬暟鎹紙浼樺寲鍚庯級 - getReportPrintData() { - const { formData } = this; - return { - - material: '120034535', - batch: '25098814', - model: 'G3-2B259', - quantity: 216, - inspectDate: '20250408', - inspector: '鐜嬬京/鍚堟牸', - date: '2025.08.22' - - // batchNo: "25158878", - // productModel: "涓変唬杞瘋杞存壙鍗曞厓\\G3-639", - // palletNo: "11236979", - // quantity: "107", - // workshop: "3003", - // code: "1200143912506070086", - // planNum:"10016456466565" - }; - }, + getReportPrintData() { + const { + formData + } = this; + return { + + material: '120034535', + batch: '25098814', + model: 'G3-2B259', + quantity: 216, + inspectDate: '20250408', + inspector: '鐜嬬京/鍚堟牸', + date: '2025.08.22' + }; + }, changeisSpareList(e) { this.formData.isSpare = e; @@ -325,28 +326,18 @@ mask: true, title: "鎻愪氦涓�..." }); - try { - // 琛ㄥ崟楠岃瘉 - await this.$refs.form.validate(); - this.isSubmitting = true; - // 鍙戦�佹姤宸ヨ姹� - const response = await this.$http.post(this.url.approval, { - workOrderNumber: this.formData.workOrderNumber, - materialCode: this.formData.materialCode, - materialDescription: this.formData.materialDescription, - plannedQuantity: this.formData.plannedQuantity, - inspectionOrderNumber: this.formData.inspectionOrderNumber, - process: this.formData.process, - inspectionType: this.formData.inspectionType, - inspectionQuantity: this.formData.inspectionQuantity, - inspectionPlan: this.formData.inspectionPlan, - inspectionTime: this.formData.inspectionTime + const response = await this.$http.post(this.url.add, { + factoryId: this.currentLineId, + orderId: this.reportCode, + quantity: this.formData.plannedQuantity, + workOrderId: this.workOrderNumber }); if (response.data.success) { + this.isShow = true; uni.showToast({ icon: "success", title: '鎻愪氦鎴愬姛', @@ -442,16 +433,16 @@ margin-top: 45px; height: auto; } - + /* 楠ㄦ灦灞忔牱寮� */ .skeleton-container { padding: 20rpx; } - + .skeleton-group { margin-bottom: 40rpx; } - + .skeleton-divider { height: 40rpx; width: 300rpx; @@ -461,13 +452,13 @@ animation: skeleton-loading 1.4s ease infinite; margin-bottom: 30rpx; } - + .skeleton-item { display: flex; align-items: center; margin-bottom: 30rpx; } - + .skeleton-label { width: 160rpx; height: 40rpx; @@ -477,7 +468,7 @@ animation: skeleton-loading 1.4s ease infinite; margin-right: 20rpx; } - + .skeleton-input { flex: 1; height: 60rpx; @@ -486,7 +477,7 @@ border-radius: 8rpx; animation: skeleton-loading 1.4s ease infinite; } - + .skeleton-select { flex: 1; height: 60rpx; @@ -495,7 +486,7 @@ border-radius: 8rpx; animation: skeleton-loading 1.4s ease infinite; } - + .skeleton-datetime { flex: 1; height: 60rpx; @@ -504,7 +495,7 @@ border-radius: 8rpx; animation: skeleton-loading 1.4s ease infinite; } - + .skeleton-button { width: 90%; height: 80rpx; @@ -514,13 +505,14 @@ animation: skeleton-loading 1.4s ease infinite; margin: 40rpx auto; } - + @keyframes skeleton-loading { 0% { background-position: 100% 50%; } + 100% { background-position: 0 50%; } } -</style> +</style> \ No newline at end of file -- Gitblit v1.9.3