From 5949b176eff7fa739ec2f341860c2f1a4803c176 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期五, 21 十一月 2025 15:15:07 +0800
Subject: [PATCH] 新增:调机报工
---
components/WorkOrderPrint.vue | 895 ++++++++++++++++++++++++++++++-----------------------------
1 files changed, 460 insertions(+), 435 deletions(-)
diff --git a/components/WorkOrderPrint.vue b/components/WorkOrderPrint.vue
index a850cc2..d9222e4 100644
--- a/components/WorkOrderPrint.vue
+++ b/components/WorkOrderPrint.vue
@@ -1,21 +1,21 @@
<template>
- <view class="page wide-layout" :class="{'has-overlay': (isShowUserSelect || isShow || barcodeIsShow)}">
- <view class="status-section">
- <!-- 鎶ュ伐璁板綍琛ㄩ儴鍒嗭紝鍦ㄦ爣棰樿娣诲姞鍒锋柊鎸夐挳 -->
- <view class="report-table-wrapper">
- <view class="report-header">
- <view class="report-title">鎶ュ伐璁板綍琛�</view>
- <view class="header-buttons">
- <button class="refresh-btn-header" @click="refresh">鍒锋柊</button>
- <button v-if="isGeneratingBarcode" class="reset-btn-header" @click="resetGenerateState">閲嶇疆</button>
- </view>
- </view>
+ <view class="page wide-layout" :class="{'has-overlay': (isShowUserSelect || isShow || barcodeIsShow)}">
+ <view class="status-section">
+ <!-- 鎶ュ伐璁板綍琛ㄩ儴鍒嗭紝鍦ㄦ爣棰樿娣诲姞鍒锋柊鎸夐挳 -->
+ <view class="report-table-wrapper">
+ <view class="report-header">
+ <view class="report-title">鎶ュ伐璁板綍琛�</view>
+ <view class="header-buttons">
+ <button class="refresh-btn-header" @click="refresh">鍒锋柊</button>
+ <button v-if="isGeneratingBarcode" class="reset-btn-header" @click="resetGenerateState">閲嶇疆</button>
+ </view>
+ </view>
- <!-- 鏁伴噰鎬讳骇閲� -->
- <view class="section-title">褰撳墠鏁伴噰浜ч噺鎶ュ伐璁板綍</view>
- <div class="table-scroll">
- <table class="report-table">
- <thead>
+ <!-- 鏁伴噰鎬讳骇閲� -->
+ <view class="section-title">褰撳墠鏁伴噰浜ч噺鎶ュ伐璁板綍</view>
+ <div class="table-scroll">
+ <table class="report-table">
+ <thead>
<tr>
<th>鏃堕棿</th>
<th>鎶ュ伐浜�</th>
@@ -30,8 +30,8 @@
<th>涓嶈壇鏁�</th>
<th>鑹搧鏁帮紙璁$畻锛�</th>
</tr>
- </thead>
- <tbody>
+ </thead>
+ <tbody>
<tr class="summary-row highlight-row">
<td>{{ nowTime }}</td>
<td>{{ staffDisplay || '-' }}</td>
@@ -46,246 +46,247 @@
<td>{{ realTimeDefectiveCount }}</td>
<td>{{ realTimeOkCount }}</td>
</tr>
- </tbody>
- </table>
- </div>
+ </tbody>
+ </table>
+ </div>
- <!-- 鍘嗗彶鎶ュ伐璁板綍 -->
- <view class="section-title history-title">鍘嗗彶鎶ュ伐璁板綍</view>
- <div class="table-scroll">
- <table class="report-table">
- <thead>
- <tr>
- <th>鏃堕棿</th>
- <th>鎶ュ伐浜�</th>
- <th>宸ュ崟鍙�</th>
- <th>浜у搧鍚嶇О</th>
- <th>璁″垝鐢熶骇鏁�</th>
- <th>鏈哄彴鍙�</th>
- <th>鍒濆閲囬泦鏁�</th>
- <th>鎶ュ伐鏃堕噰闆嗘暟</th>
- <th>鎶ュ伐鏁帮紙璁$畻锛�</th>
- <th>涓嶈壇鏁�</th>
- <th>鑹搧鏁帮紙璁$畻锛�</th>
- </tr>
- </thead>
- <tbody>
- <tr v-for="(r, idx) in reportingHistory" :key="idx">
- <td>{{ r.bgDate }}</td>
- <td>{{ r.staff || '-' }}</td>
- <td>{{ r.orderNo || '-' }}</td>
- <td>{{ order.daa003 || '-' }}</td>
- <td>{{ planQtyDisplay }}</td>
- <td>{{ r.machineNo || '-' }}</td>
- <td>{{ r.initialValue }}</td>
- <td>{{ r.productionCount }}</td>
- <td>{{ r.totalProduction }}</td>
- <td>{{ r.BfQty }}</td>
- <td>{{ r.OkQty }}</td>
- </tr>
- <tr v-if="!reportingHistory.length">
- <td colspan="11" class="no-data">鏆傛棤鍘嗗彶鎶ュ伐璁板綍</td>
- </tr>
- </tbody>
- </table>
- </div>
- </view>
+ <!-- 鍘嗗彶鎶ュ伐璁板綍 -->
+ <view class="section-title history-title">鍘嗗彶鎶ュ伐璁板綍</view>
+ <div class="table-scroll">
+ <table class="report-table">
+ <thead>
+ <tr>
+ <th>鏃堕棿</th>
+ <th>鎶ュ伐浜�</th>
+ <th>宸ュ崟鍙�</th>
+ <th>浜у搧鍚嶇О</th>
+ <th>璁″垝鐢熶骇鏁�</th>
+ <th>鏈哄彴鍙�</th>
+ <th>鍒濆閲囬泦鏁�</th>
+ <th>鎶ュ伐鏃堕噰闆嗘暟</th>
+ <th>鎶ュ伐鏁帮紙璁$畻锛�</th>
+ <th>涓嶈壇鏁�</th>
+ <th>鑹搧鏁帮紙璁$畻锛�</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr v-for="(r, idx) in reportingHistory" :key="idx">
+ <td>{{ r.bgDate }}</td>
+ <td>{{ r.staff || '-' }}</td>
+ <td>{{ r.orderNo || '-' }}</td>
+ <td>{{ order.daa003 || '-' }}</td>
+ <td>{{ planQtyDisplay }}</td>
+ <td>{{ r.machineNo || '-' }}</td>
+ <td>{{ r.initialValue }}</td>
+ <td>{{ r.productionCount }}</td>
+ <td>{{ r.totalProduction }}</td>
+ <td>{{ r.BfQty }}</td>
+ <td>{{ r.OkQty }}</td>
+ </tr>
+ <tr v-if="!reportingHistory.length">
+ <td colspan="11" class="no-data">鏆傛棤鍘嗗彶鎶ュ伐璁板綍</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </view>
- <!-- 绉婚櫎浜嗗師鏉ョ殑鐘舵�佽涓殑鎸夐挳缁� -->
- <view class="status-row">
- <!--<view class="status-box">
- <text>鏈哄彴闈㈡澘鏁帮細</text>
- <input v-model="productionCount" class="highlight" disabled />
- </view>
- <view class="status-box">
- <text>褰撳墠閲囬泦鏁帮細</text>
- <input v-model="calculatedCurrentCount" class="highlight" disabled />
- </view>
- <view class="operator-box">-</view>
- <view class="status-box standalone-box">
- <text>宸叉墦鍗版潯鐮佹暟锛�</text>
- <input v-model="sQuantity" class="highlight" disabled />
- </view>
- <view class="operator-box">=</view>
- <view class="status-box">
- <text>鏈洪噰涓嶈壇鏁帮細</text>
- <input v-model="calculatedDefectiveCount" class="highlight" disabled />
- </view>
- <view class="status-box result-box">
- <text>宸茬敓浜ф暟锛�</text>
- <input v-model="calculatedTotalProduction" class="highlight" disabled />
- </view>-->
- </view>
+ <!-- 绉婚櫎浜嗗師鏉ョ殑鐘舵�佽涓殑鎸夐挳缁� -->
+ <view class="status-row">
+ <!--<view class="status-box">
+ <text>鏈哄彴闈㈡澘鏁帮細</text>
+ <input v-model="productionCount" class="highlight" disabled />
+ </view>
+ <view class="status-box">
+ <text>褰撳墠閲囬泦鏁帮細</text>
+ <input v-model="calculatedCurrentCount" class="highlight" disabled />
+ </view>
+ <view class="operator-box">-</view>
+ <view class="status-box standalone-box">
+ <text>宸叉墦鍗版潯鐮佹暟锛�</text>
+ <input v-model="sQuantity" class="highlight" disabled />
+ </view>
+ <view class="operator-box">=</view>
+ <view class="status-box">
+ <text>鏈洪噰涓嶈壇鏁帮細</text>
+ <input v-model="calculatedDefectiveCount" class="highlight" disabled />
+ </view>
+ <view class="status-box result-box">
+ <text>宸茬敓浜ф暟锛�</text>
+ <input v-model="calculatedTotalProduction" class="highlight" disabled />
+ </view>-->
+ </view>
- <view class="flex-row gap-lg">
- <!-- 褰撳墠鎶ュ伐浜洪儴鍒� -->
- <view class="current-user-section">
- <text>褰撳墠鎶ュ伐浜猴細</text>
- <text class="current-user-name">{{ staffDisplay || '鏈�夋嫨' }}</text>
- <button class="select-user-btn" @click="isShowUserSelect = true">閫変汉</button>
- </view>
+ <view class="flex-row gap-lg">
+ <!-- 褰撳墠鎶ュ伐浜洪儴鍒� -->
+ <view class="current-user-section">
+ <text>褰撳墠鎶ュ伐浜猴細</text>
+ <text class="current-user-name">{{ staffDisplay || '鏈�夋嫨' }}</text>
+ <button class="select-user-btn" @click="isShowUserSelect = true">閫変汉</button>
+ </view>
- <!-- 涓嶈壇鏁伴噺閮ㄥ垎 -->
- <view class="defective-section">
- <text>涓嶈壇鏁伴噺锛�</text>
- <input v-model="customAmount" class="inp bad-input" placeholder="璇疯緭鍏ユ暟閲�" />
- </view>
+ <!-- 涓嶈壇鏁伴噺閮ㄥ垎 -->
+ <view class="defective-section">
+ <text>涓嶈壇鏁伴噺锛�</text>
+ <input v-model="customAmount" class="inp bad-input" placeholder="璇疯緭鍏ユ暟閲�" />
+ </view>
- <!-- 纭鎻愪氦鎸夐挳 -->
- <view class="submit-section">
- <button class="details-btn" @click="confirmCustomAmount">纭鎻愪氦</button>
- </view>
- </view>
+ <!-- 纭鎻愪氦鍜岃皟鏈烘姤宸ユ寜閽� -->
+ <view class="submit-section">
+ <button class="details-btn" @click="confirmCustomAmount">纭鎻愪氦</button>
+ <button class="details-btn" @click="confirmTiaojiBaogong">璋冩満鎶ュ伐</button>
+ </view>
+ </view>
- <!-- 閫変汉寮圭獥 -->
- <view v-if="isShowUserSelect" class="overlay">
- <view class="popup user-select-popup">
- <!-- 鎼滅储鏍� -->
- <view class="user-search-bar">
- <input v-model.trim="userSearch"
- type="text"
- class="user-search-input"
- placeholder="杈撳叆宸ュ彿鎴栧鍚嶆悳绱�"
- @keydown.enter.prevent />
- <button v-if="userSearch" class="user-search-clear" @click="userSearch=''">娓呯┖</button>
- <view class="user-search-info">
- 鍖归厤锛歿{ filteredUsers.length }} / {{ users.length }}
- </view>
- </view>
- <view class="user-list-scroll">
- <template v-if="filteredUsers.length">
- <view class="user-list-grid">
- <button v-for="(u, index) in filteredUsers"
- :key="index"
- :class="['user-list-btn', {'selected': u===staffNo}]"
- @click="selectUser(u)">
- <span class="user-code">{{ u.split(':')[0] }}</span>
- <span class="user-name">{{ u.split(':')[1] }}</span>
- </button>
- </view>
- </template>
- <view v-else class="no-user-result">
- 鏈壘鍒板尮閰嶄汉鍛�
- </view>
- </view>
- <view class="user-popup-footer">
- <button class="clean-btn wide-btn" @click="isShowUserSelect = false">鍏抽棴</button>
- </view>
- </view>
- </view>
+ <!-- 閫変汉寮圭獥 -->
+ <view v-if="isShowUserSelect" class="overlay">
+ <view class="popup user-select-popup">
+ <!-- 鎼滅储鏍� -->
+ <view class="user-search-bar">
+ <input v-model.trim="userSearch"
+ type="text"
+ class="user-search-input"
+ placeholder="杈撳叆宸ュ彿鎴栧鍚嶆悳绱�"
+ @keydown.enter.prevent />
+ <button v-if="userSearch" class="user-search-clear" @click="userSearch=''">娓呯┖</button>
+ <view class="user-search-info">
+ 鍖归厤锛歿{ filteredUsers.length }} / {{ users.length }}
+ </view>
+ </view>
+ <view class="user-list-scroll">
+ <template v-if="filteredUsers.length">
+ <view class="user-list-grid">
+ <button v-for="(u, index) in filteredUsers"
+ :key="index"
+ :class="['user-list-btn', {'selected': u===staffNo}]"
+ @click="selectUser(u)">
+ <span class="user-code">{{ u.split(':')[0] }}</span>
+ <span class="user-name">{{ u.split(':')[1] }}</span>
+ </button>
+ </view>
+ </template>
+ <view v-else class="no-user-result">
+ 鏈壘鍒板尮閰嶄汉鍛�
+ </view>
+ </view>
+ <view class="user-popup-footer">
+ <button class="clean-btn wide-btn" @click="isShowUserSelect = false">鍏抽棴</button>
+ </view>
+ </view>
+ </view>
- <!-- 绂佺敤鎸夐挳锛氣�樹繚瀛樺苟鐢熸晥'銆佲�樺彇娑堚�� -->
- <!--<view class="bottom-section">
- <button class="save-btn" @click="save">淇濆瓨骞剁敓鏁�</button>
- <button class="cancel-btn" @click="cancel">鍙栨秷</button>
- </view>-->
- <!-- 淇濈暀鏃у脊绐� -->
- <view v-if="isShow" class="overlay">
- <view class="popup">
- <view class="bottom-section1">
- <button class="clean-btn" type="warn" @click="deleteBarcode">鍏抽棴</button>
- </view>
- <view class="reason-section">
- <text>鎶ュ伐浜猴細</text>
- <view class="reason-buttons">
- <button v-for="(u,index) in users" :key="index"
- :class="{'reason-btn':true,'selected': user===u}"
- @click="toggleUser(u)">
- {{ formatUser(u) }}
- </button>
- </view>
- </view>
- </view>
- </view>
+ <!-- 绂佺敤鎸夐挳锛氣�樹繚瀛樺苟鐢熸晥'銆佲�樺彇娑堚�� -->
+ <!--<view class="bottom-section">
+ <button class="save-btn" @click="save">淇濆瓨骞剁敓鏁�</button>
+ <button class="cancel-btn" @click="cancel">鍙栨秷</button>
+ </view>-->
+ <!-- 淇濈暀鏃у脊绐� -->
+ <view v-if="isShow" class="overlay">
+ <view class="popup">
+ <view class="bottom-section1">
+ <button class="clean-btn" type="warn" @click="deleteBarcode">鍏抽棴</button>
+ </view>
+ <view class="reason-section">
+ <text>鎶ュ伐浜猴細</text>
+ <view class="reason-buttons">
+ <button v-for="(u,index) in users" :key="index"
+ :class="{'reason-btn':true,'selected': user===u}"
+ @click="toggleUser(u)">
+ {{ formatUser(u) }}
+ </button>
+ </view>
+ </view>
+ </view>
+ </view>
- <view v-if="barcodeIsShow" class="overlay">
- <view class="popup">
- <uni-table ref="table" border stripe emptyText="鏆傛棤鏇村鏁版嵁" class="table1">
- <uni-tr>
- <uni-th align="center" style="font-size:40px;">鐢熸垚鏃堕棿</uni-th>
- <uni-th align="center" style="width:39%;font-size:40px;">鏉$爜</uni-th>
- <uni-th align="center" style="font-size:40px;">鎶ュ伐浜�</uni-th>
- <uni-th align="center" style="font-size:40px;">鎶ュ伐鏁伴噺</uni-th>
- </uni-tr>
- <uni-tr v-for="(item,index) in reportingList" :key="index">
- <uni-td align="center"><input type="text" v-model="item.bgDate" style="width:26vh;" /></uni-td>
- <uni-td align="center"><input v-model="item.itemNoCade" style="width:40vh;" /></uni-td>
- <uni-td align="center"><input v-model="item.staffName" /></uni-td>
- <uni-td align="center"><input v-model="item.okQty" /></uni-td>
- </uni-tr>
- </uni-table>
- <view><button class="clean-btn" type="warn" @click="barcodeIsShow=false">鍏抽棴</button></view>
- </view>
- </view>
- </view>
- </view>
+ <view v-if="barcodeIsShow" class="overlay">
+ <view class="popup">
+ <uni-table ref="table" border stripe emptyText="鏆傛棤鏇村鏁版嵁" class="table1">
+ <uni-tr>
+ <uni-th align="center" style="font-size:40px;">鐢熸垚鏃堕棿</uni-th>
+ <uni-th align="center" style="width:39%;font-size:40px;">鏉$爜</uni-th>
+ <uni-th align="center" style="font-size:40px;">鎶ュ伐浜�</uni-th>
+ <uni-th align="center" style="font-size:40px;">鎶ュ伐鏁伴噺</uni-th>
+ </uni-tr>
+ <uni-tr v-for="(item,index) in reportingList" :key="index">
+ <uni-td align="center"><input type="text" v-model="item.bgDate" style="width:26vh;" /></uni-td>
+ <uni-td align="center"><input v-model="item.itemNoCade" style="width:40vh;" /></uni-td>
+ <uni-td align="center"><input v-model="item.staffName" /></uni-td>
+ <uni-td align="center"><input v-model="item.okQty" /></uni-td>
+ </uni-tr>
+ </uni-table>
+ <view><button class="clean-btn" type="warn" @click="barcodeIsShow=false">鍏抽棴</button></view>
+ </view>
+ </view>
+ </view>
+ </view>
</template>
<script>
- import { printTemplate3 } from "../utils/printTemplate";
+ import { printTemplate3 } from "../utils/printTemplate";
- export default {
- props: { orderNo: String, orderId: Number, machineNo: String },
- data() {
- return {
- isShowUserSelect: false,
- currentUser: '',
- barcodeAmount: '',
- users: [], userForm: [], staff: [], user: {},
- productionCount: 0, printedCount: 0, defectiveCount: 0, order: {},
- icount: 1, bqty: 0, sQuantity: 0, kgQty: 0, initialValue: 0, qqty: 0,
- ngStaid: 0, bufferData: '', dataToPrint: [], isLoading: false, but: false,
- DAA003List: [], lineList: [], isShow: false, barcodeIsShow: false, barcodeList: [],
- staffNo: '', printStr: '', printMac: '', bluetoothSocket: {}, device: '', uuid: '',
- printNum: 1, reportingList: [], printLoading: false, customAmount: '',
- isGeneratingBarcode: false, lastGenerateTime: 0, generateRequestId: null,
- nowTimeTimer: null, nowTime: '',
+ export default {
+ props: { orderNo: String, orderId: Number, machineNo: String },
+ data() {
+ return {
+ isShowUserSelect: false,
+ currentUser: '',
+ barcodeAmount: '',
+ users: [], userForm: [], staff: [], user: {},
+ productionCount: 0, printedCount: 0, defectiveCount: 0, order: {},
+ icount: 1, bqty: 0, sQuantity: 0, kgQty: 0, initialValue: 0, qqty: 0,
+ ngStaid: 0, bufferData: '', dataToPrint: [], isLoading: false, but: false,
+ DAA003List: [], lineList: [], isShow: false, barcodeIsShow: false, barcodeList: [],
+ staffNo: '', printStr: '', printMac: '', bluetoothSocket: {}, device: '', uuid: '',
+ printNum: 1, reportingList: [], printLoading: false, customAmount: '',
+ isGeneratingBarcode: false, lastGenerateTime: 0, generateRequestId: null,
+ nowTimeTimer: null, nowTime: '',
userSearch: '',
refreshTimer: null, // 鏂板锛氳嚜鍔ㄥ埛鏂板畾鏃跺櫒
- /* 鏂板锛氬巻鍙叉姤宸ヨ褰曟暟缁� */
+ /* 鏂板锛氬巻鍙叉姤宸ヨ褰曟暟缁� */
reportingHistory: []
- }
- },
- computed: {
- //鑹搧鏁板疄鏃惰绠�
- realTimeDefectiveCount() {
- // 浼樺厛鐢ㄨ緭鍏ユ鐨勫�硷紝鍚﹀垯鐢ㄦ帴鍙f暟鎹�
- const val = Number(this.customAmount);
- if (!isNaN(val) && this.customAmount !== '') return val;
- return this.calculatedDefectiveCount;
- },
- realTimeOkCount() {
- // 鑹搧鏁� = 鎶ュ伐鏁帮紙璁$畻锛� - 涓嶈壇鏁�
- const total = (this.order.currentCjNum || 0) - (this.order.initCjNum || 0);
- return total - this.realTimeDefectiveCount;
- },
- calculatedCurrentCount() { return (this.productionCount || 0) - (this.initialValue || 0); },
- calculatedTotalProduction() { return (this.kgQty || 0); }, // 鑻ラ渶鎭㈠鏃ч�昏緫鍙敤 (this.kgQty||0)+this.calculatedCurrentCount
- calculatedDefectiveCount() { return this.calculatedTotalProduction - (this.sQuantity || 0); },
- planQtyDisplay() { return this.order.planQty || this.order.planQuantity || this.order.daa008 || 0; },
- staffDisplay() {
- if (!this.staffNo) return '';
- const segs = this.staffNo.split(':');
- return segs.length > 1 ? `${segs[0]} ${segs[1]}` : this.staffNo;
- },
- filteredUsers() {
- if (!this.userSearch) return this.users;
- const kw = this.userSearch.trim().toLowerCase();
- return this.users.filter(u => u.toLowerCase().includes(kw));
- }
- },
- created() {
- this.initializeData();
- this.fetchData(true);
- this.init();
- this.getXS0101();
- this.updateNowTime();
- // 绉掔骇鍒锋柊锛涘涓嶉渶鍔ㄦ�佽烦绉掑彲鏀逛负 60000
+ }
+ },
+ computed: {
+ //鑹搧鏁板疄鏃惰绠�
+ realTimeDefectiveCount() {
+ // 浼樺厛鐢ㄨ緭鍏ユ鐨勫�硷紝鍚﹀垯鐢ㄦ帴鍙f暟鎹�
+ const val = Number(this.customAmount);
+ if (!isNaN(val) && this.customAmount !== '') return val;
+ return this.calculatedDefectiveCount;
+ },
+ realTimeOkCount() {
+ // 鑹搧鏁� = 鎶ュ伐鏁帮紙璁$畻锛� - 涓嶈壇鏁�
+ const total = (this.order.currentCjNum || 0) - (this.order.initCjNum || 0);
+ return total - this.realTimeDefectiveCount;
+ },
+ calculatedCurrentCount() { return (this.productionCount || 0) - (this.initialValue || 0); },
+ calculatedTotalProduction() { return (this.kgQty || 0); }, // 鑻ラ渶鎭㈠鏃ч�昏緫鍙敤 (this.kgQty||0)+this.calculatedCurrentCount
+ calculatedDefectiveCount() { return this.calculatedTotalProduction - (this.sQuantity || 0); },
+ planQtyDisplay() { return this.order.planQty || this.order.planQuantity || this.order.daa008 || 0; },
+ staffDisplay() {
+ if (!this.staffNo) return '';
+ const segs = this.staffNo.split(':');
+ return segs.length > 1 ? `${segs[0]} ${segs[1]}` : this.staffNo;
+ },
+ filteredUsers() {
+ if (!this.userSearch) return this.users;
+ const kw = this.userSearch.trim().toLowerCase();
+ return this.users.filter(u => u.toLowerCase().includes(kw));
+ }
+ },
+ created() {
+ this.initializeData();
+ this.fetchData(true);
+ this.init();
+ this.getXS0101();
+ this.updateNowTime();
+ // 绉掔骇鍒锋柊锛涘涓嶉渶鍔ㄦ�佽烦绉掑彲鏀逛负 60000
this.nowTimeTimer = setInterval(this.updateNowTime, 1000);
// 鏂板锛氭瘡鍒嗛挓鑷姩鍒锋柊鏁版嵁锛�60000姣 = 1鍒嗛挓锛�
this.startAutoRefresh();
- },
+ },
beforeDestroy() {
if (this.nowTimeTimer) clearInterval(this.nowTimeTimer);
// 鏂板锛氭竻鐞嗚嚜鍔ㄥ埛鏂板畾鏃跺櫒
@@ -310,27 +311,27 @@
}
},
- formatUser(u) {
- if (!u) return '';
- const segs = u.split(':');
- return segs.length > 1 ? `${segs[0]} ${segs[1]}` : u;
- },
- selectUser(u) { this.staffNo = u; this.isShowUserSelect = false; this.userSearch = ''; },
- /* 淇敼锛氬鍔犵 */
- updateNowTime() {
- const d = new Date(), p = n => n.toString().padStart(2, '0');
- this.nowTime = `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`;
- },
- initializeData() {
- this.productionCount = this.printedCount = this.defectiveCount = 0;
- this.icount = 1; this.bqty = 0; this.sQuantity = 0; this.kgQty = 0;
- this.initialValue = 0; this.qqty = 0;
- this.isGeneratingBarcode = false; this.lastGenerateTime = 0; this.generateRequestId = null;
- },
- resetGenerateState() {
- this.isGeneratingBarcode = false; this.generateRequestId = null; this.lastGenerateTime = 0;
- this.$showMessage("宸查噸缃潯鐮佺敓鎴愮姸鎬�");
- },
+ formatUser(u) {
+ if (!u) return '';
+ const segs = u.split(':');
+ return segs.length > 1 ? `${segs[0]} ${segs[1]}` : u;
+ },
+ selectUser(u) { this.staffNo = u; this.isShowUserSelect = false; this.userSearch = ''; },
+ /* 淇敼锛氬鍔犵 */
+ updateNowTime() {
+ const d = new Date(), p = n => n.toString().padStart(2, '0');
+ this.nowTime = `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`;
+ },
+ initializeData() {
+ this.productionCount = this.printedCount = this.defectiveCount = 0;
+ this.icount = 1; this.bqty = 0; this.sQuantity = 0; this.kgQty = 0;
+ this.initialValue = 0; this.qqty = 0;
+ this.isGeneratingBarcode = false; this.lastGenerateTime = 0; this.generateRequestId = null;
+ },
+ resetGenerateState() {
+ this.isGeneratingBarcode = false; this.generateRequestId = null; this.lastGenerateTime = 0;
+ this.$showMessage("宸查噸缃潯鐮佺敓鎴愮姸鎬�");
+ },
// 淇敼锛氬湪鎵嬪姩鍒锋柊鏃朵篃閲嶇疆鑷姩鍒锋柊璁℃椂鍣�
refresh() {
this.$sendPostRequest({
@@ -349,181 +350,205 @@
this.$showMessage("鍒锋柊澶辫触锛岃妫�鏌ョ綉缁滆繛鎺�");
});
},
- onDaa003Change(v) {
- let o = this.lineList[this.DAA003List.indexOf(v)];
- this.orderId = o.id; this.orderNo = o.daa001;
- uni.setStorageSync('machine', this.machineNo);
- uni.setStorageSync('orderId', this.orderId);
- uni.setStorageSync('orderNo', this.orderNo);
- this.fetchData(false);
- },
- fetchData(flag) {
- if (!this.orderId && !this.orderNo) return;
- this.getOrderById();
- this.getWomdaaPrintById();
- this.getReportingHistory(); // 鏂板锛氭瘡娆″埛鏂板悓姝ュ巻鍙�
- if (flag) {
- this.$post({ url: "/Womdaa/GetWomdaasByShow", data: { machineNo: this.machineNo } })
- .then(res => {
- this.lineList = res.data.tbBillList;
- this.DAA003List = res.data.tbBillList.map(i => i.daa003);
- });
- }
- },
- /* 鏂板锛氳幏鍙栧巻鍙叉姤宸ヨ褰� */
- /* 淇敼锛氳鑼冨巻鍙叉椂闂村埌绉� */
- getReportingHistory() {
- if (!this.orderNo) { this.reportingHistory = []; return; }
- const fmtSec = v => {
- if (!v) return '';
- // 鍏煎鍚庣鍙兘杩斿洖鐨勪笉鍚屾牸寮�
- const d = new Date(typeof v === 'string' ? v.replace(/-/g, '/') : v);
- if (isNaN(d.getTime())) return v; // 鏃犳硶瑙f瀽鍒欏師鏍疯繑鍥�
- const p = n => n.toString().padStart(2, '0');
- return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`;
- };
- this.$post({
- url: "/Womdaa/GetByBillNoBG",
- data: { billNo: this.orderNo, machineNo: this.machineNo || null }
- }).then(res => {
- const list = res?.data?.tbBillList || res?.data || [];
- this.reportingHistory = list.map(r => {
- // 渚濇嵁浣犳暟鎹簱瀛楁鍋氭槧灏勶紙涓嬮潰瀛楁鍚嶆寜甯歌鍛藉悕涓句緥锛岄渶瑕佹寜瀹為檯鏀癸級
- return {
- bgDate: r.bgDate || '', // 鎶ュ伐鏃堕棿
- staff: (r.staffNo ? (r.staffNo + ' ' + (r.staffName || '')) : (r.staffName || '')),//鎶ュ伐浜�
- orderNo: r.billNo,//宸ュ崟鍙�
- machineNo: r.machineNo,//鏈哄彴鍙�
- initialValue: r.csQty ?? 0,//鍒濆閲囬泦鏁�
- productionCount: r.cjQty ?? 0,//鎶ュ伐鏃堕噰闆嗘暟
- totalProduction: (r.cjQty - r.csQty) ?? 0,//鎶ュ伐鏁帮紙璁$畻锛�
- BfQty: r.bfQty,//涓嶈壇鏁�
- OkQty: r.okQty//鑹搧鏁帮紙璁$畻锛�
- }
- });
- }).catch(() => { this.reportingHistory = []; });
- },
- toggleUser(u) {
- if (!u) return;
- this.user = this.user === u ? null : u;
- this.staffNo = this.user;
- },
- //閫夋嫨鎶ュ伐浜�
- confirmCustomAmount() {
- if (!this.customAmount || isNaN(Number(this.customAmount))) { this.$showMessage('璇疯緭鍏ユ湁鏁堢殑鏁伴噺'); return; }
- if (!this.staffNo) { this.$showMessage('璇烽�夋嫨鎶ュ伐浜�'); return; }
- const staffNo = this.staffNo.split(':')[0];
- const amount = Number(this.customAmount);
- this.$post({
- url: "/MesInvItemBarcodes/AddBFToBarcodes",
- data: {
- orderNo: this.orderNo,
- orderId: this.orderId,
- bf: amount,
- staffNo: staffNo,
- initCjNum: this.order.initCjNum, // 鍒濆閲囬泦鏁�
- currentCjNum: this.order.currentCjNum // 鎶ュ伐鏃堕噰闆嗘暟
- }
- }).then(res => {
- if (res.status == 1) { this.$showMessage(res.message); return; }
- this.$showMessage('鎶ュ簾鏁伴噺濉啓鎴愬姛');
- this.fetchData(true); // 鑷姩鍒锋柊鍘嗗彶
- this.customAmount = '';
- }).catch(() => this.$showMessage('鎶ュ簾鏁伴噺濉啓澶辫触锛岃閲嶈瘯'));
- },
- save() {
- if (!this.staffNo) { this.$showMessage('璇烽�夋嫨鎶ュ伐浜�'); return; }
- uni.showToast({ title: '淇濆瓨鎴愬姛', icon: 'success' });
- this.getReportingHistory(); // 淇濆瓨鍚庝篃鍙埛鏂�
- },
- cancel() { uni.showToast({ title: '鍙栨秷鎿嶄綔', icon: 'none' }); },
- getOrderById() {
- this.$post({ url: "/Womdaa/GetWomdaaById", data: { orderId: this.orderId, orderNo: this.orderNo } })
- .then(res => {
- this.order = res.data.tbBillList;
- this.printedCount = res.data.tbBillList.bgqty || 0;
- this.defectiveCount = res.data.tbBillList.blQty || 0;
- this.productionCount = this.order.todayOutput || 0;
- });
- },
- getXS0101() {
- this.$post({ url: "/MesStaff/GetAllXS0101" })
- .then(res => {
- this.staff = res.data.tbBillList;
- this.users = this.staff.map(s => s.staffNo + ":" + s.staffName);
- });
- },
- getWomdaaPrintById() {
- this.$post({ url: "/Womdaa/GetWomdaaPrintById", data: { orderId: this.orderId } })
- .then(res => {
- if (!res?.data?.tbBillList) return;
- const d = res.data.tbBillList;
- this.bqty = d.bqty;
- this.icount = 1;
- this.sQuantity = d.sQuantity || 0;
- this.initialValue = d.initialValue || 0;
- this.kgQty = d.kgQty || 0;
- this.barcodeAmount = d.qqty || 0;
- if (this.bqty === 0) this.Completed();
- }).catch(() => { });
- },
- Completed() {
- this.$post({ url: "/MesOrderSta/Completed", data: { orderId: this.orderId, orderNo: this.orderNo } });
- },
- init() {
- try {
- const v = this.getAndroidVersion();
- v >= 12 ? this.initForAndroid12Plus() : this.initForAndroidLegacy();
- } catch (e) { console.error(e); }
- },
- getAndroidVersion() {
- try { var Build = plus.android.importClass("android.os.Build"); return Build.VERSION.SDK_INT; }
- catch { return 30; }
- },
- initForAndroid12Plus() {
- try {
- var main = plus.android.runtimeMainActivity();
- var BluetoothManager = plus.android.importClass("android.bluetooth.BluetoothManager");
- var Context = plus.android.importClass("android.content.Context");
- var UUID = plus.android.importClass("java.util.UUID");
- this.uuid = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
- var mgr = main.getSystemService(Context.BLUETOOTH_SERVICE);
- var adp = mgr.getAdapter();
- if (adp && adp.isDiscovering()) adp.cancelDiscovery();
- this.printMac = uni.getStorageSync('printMac');
- var mac = this.printMac || "DC:1D:30:91:06:52";
- if (adp) {
- this.device = adp.getRemoteDevice(mac);
- plus.android.importClass(this.device);
- }
- } catch (e) { this.initForAndroidLegacy(); }
- },
- initForAndroidLegacy() {
- try {
- var BluetoothAdapter = plus.android.importClass("android.bluetooth.BluetoothAdapter");
- var UUID = plus.android.importClass("java.util.UUID");
- this.uuid = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
- var BAdapter = BluetoothAdapter.getDefaultAdapter();
- if (BAdapter) BAdapter.cancelDiscovery();
- this.printMac = uni.getStorageSync('printMac');
- var mac = this.printMac || "DC:1D:30:91:06:52";
- if (BAdapter) {
- this.device = BAdapter.getRemoteDevice(mac);
- plus.android.importClass(this.device);
- this.bluetoothSocket = this.device.createInsecureRfcommSocketToServiceRecord(this.uuid);
- plus.android.importClass(this.bluetoothSocket);
- }
- } catch (e) { }
- },
- deleteBarcode() {
- this.isShow = false;
- this.isGeneratingBarcode = false;
- this.generateRequestId = null;
- this.bufferData = ''; this.dataToPrint = [];
- this.staffNo = null; this.user = ''; this.barcodeAmount = ''; this.icount = 1; this.staff = null;
- }
- }
- }
+ onDaa003Change(v) {
+ let o = this.lineList[this.DAA003List.indexOf(v)];
+ this.orderId = o.id; this.orderNo = o.daa001;
+ uni.setStorageSync('machine', this.machineNo);
+ uni.setStorageSync('orderId', this.orderId);
+ uni.setStorageSync('orderNo', this.orderNo);
+ this.fetchData(false);
+ },
+ fetchData(flag) {
+ if (!this.orderId && !this.orderNo) return;
+ this.getOrderById();
+ this.getWomdaaPrintById();
+ this.getReportingHistory(); // 鏂板锛氭瘡娆″埛鏂板悓姝ュ巻鍙�
+ if (flag) {
+ this.$post({ url: "/Womdaa/GetWomdaasByShow", data: { machineNo: this.machineNo } })
+ .then(res => {
+ this.lineList = res.data.tbBillList;
+ this.DAA003List = res.data.tbBillList.map(i => i.daa003);
+ });
+ }
+ },
+ /* 鏂板锛氳幏鍙栧巻鍙叉姤宸ヨ褰� */
+ /* 淇敼锛氳鑼冨巻鍙叉椂闂村埌绉� */
+ getReportingHistory() {
+ if (!this.orderNo) { this.reportingHistory = []; return; }
+ const fmtSec = v => {
+ if (!v) return '';
+ // 鍏煎鍚庣鍙兘杩斿洖鐨勪笉鍚屾牸寮�
+ const d = new Date(typeof v === 'string' ? v.replace(/-/g, '/') : v);
+ if (isNaN(d.getTime())) return v; // 鏃犳硶瑙f瀽鍒欏師鏍疯繑鍥�
+ const p = n => n.toString().padStart(2, '0');
+ return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`;
+ };
+ this.$post({
+ url: "/Womdaa/GetByBillNoBG",
+ data: { billNo: this.orderNo, machineNo: this.machineNo || null }
+ }).then(res => {
+ const list = res?.data?.tbBillList || res?.data || [];
+ this.reportingHistory = list.map(r => {
+ // 渚濇嵁浣犳暟鎹簱瀛楁鍋氭槧灏勶紙涓嬮潰瀛楁鍚嶆寜甯歌鍛藉悕涓句緥锛岄渶瑕佹寜瀹為檯鏀癸級
+ return {
+ bgDate: r.bgDate || '', // 鎶ュ伐鏃堕棿
+ staff: (r.staffNo ? (r.staffNo + ' ' + (r.staffName || '')) : (r.staffName || '')),//鎶ュ伐浜�
+ orderNo: r.billNo,//宸ュ崟鍙�
+ machineNo: r.machineNo,//鏈哄彴鍙�
+ initialValue: r.csQty ?? 0,//鍒濆閲囬泦鏁�
+ productionCount: r.cjQty ?? 0,//鎶ュ伐鏃堕噰闆嗘暟
+ totalProduction: (r.cjQty - r.csQty) ?? 0,//鎶ュ伐鏁帮紙璁$畻锛�
+ BfQty: r.bfQty,//涓嶈壇鏁�
+ OkQty: r.okQty//鑹搧鏁帮紙璁$畻锛�
+ }
+ });
+ }).catch(() => { this.reportingHistory = []; });
+ },
+ toggleUser(u) {
+ if (!u) return;
+ this.user = this.user === u ? null : u;
+ this.staffNo = this.user;
+ },
+ //閫夋嫨鎶ュ伐浜�
+ confirmCustomAmount() {
+ if (!this.customAmount || isNaN(Number(this.customAmount))) { this.$showMessage('璇疯緭鍏ユ湁鏁堢殑鏁伴噺'); return; }
+ if (!this.staffNo) { this.$showMessage('璇烽�夋嫨鎶ュ伐浜�'); return; }
+ const staffNo = this.staffNo.split(':')[0];
+ const amount = Number(this.customAmount);
+ this.$post({
+ url: "/MesInvItemBarcodes/AddBFToBarcodes",
+ data: {
+ orderNo: this.orderNo,
+ orderId: this.orderId,
+ bf: amount,
+ staffNo: staffNo,
+ initCjNum: this.order.initCjNum, // 鍒濆閲囬泦鏁�
+ currentCjNum: this.order.currentCjNum // 鎶ュ伐鏃堕噰闆嗘暟
+ }
+ }).then(res => {
+ if (res.status == 1) { this.$showMessage(res.message); return; }
+ this.$showMessage('鎶ュ簾鏁伴噺濉啓鎴愬姛');
+ this.fetchData(true); // 鑷姩鍒锋柊鍘嗗彶
+ this.customAmount = '';
+ }).catch(() => this.$showMessage('鎶ュ簾鏁伴噺濉啓澶辫触锛岃閲嶈瘯'));
+ },
+ // 鏂板锛氳皟鏈烘姤宸�
+ confirmTiaojiBaogong() {
+ if (!this.customAmount || isNaN(Number(this.customAmount))) { this.$showMessage('璇疯緭鍏ユ湁鏁堢殑鏁伴噺'); return; }
+ if (!this.staffNo) { this.$showMessage('璇烽�夋嫨鎶ュ伐浜�'); return; }
+ const staffNo = this.staffNo.split(':')[0];
+ const amount = Number(this.customAmount);
+ this.$post({
+ url: "/MesInvItemBarcodes/AddBFToBarcodes", // 濡傛湁璋冩満涓撶敤鎺ュ彛璇锋浛鎹�
+ data: {
+ orderNo: this.orderNo,
+ orderId: this.orderId,
+ bf: amount,
+ staffNo: staffNo,
+ initCjNum: this.order.initCjNum,
+ currentCjNum: this.order.currentCjNum,
+ type: 'tiaoji' // 鍙姞鍖哄垎瀛楁锛屽悗绔闇�鍖哄垎璋冩満鎶ュ伐
+ }
+ }).then(res => {
+ if (res.status == 1) { this.$showMessage(res.message); return; }
+ this.$showMessage('璋冩満鎶ュ伐鎴愬姛');
+ this.fetchData(true);
+ this.customAmount = '';
+ }).catch(() => this.$showMessage('璋冩満鎶ュ伐澶辫触锛岃閲嶈瘯'));
+ },
+ save() {
+ if (!this.staffNo) { this.$showMessage('璇烽�夋嫨鎶ュ伐浜�'); return; }
+ uni.showToast({ title: '淇濆瓨鎴愬姛', icon: 'success' });
+ this.getReportingHistory(); // 淇濆瓨鍚庝篃鍙埛鏂�
+ },
+ cancel() { uni.showToast({ title: '鍙栨秷鎿嶄綔', icon: 'none' }); },
+ getOrderById() {
+ this.$post({ url: "/Womdaa/GetWomdaaById", data: { orderId: this.orderId, orderNo: this.orderNo } })
+ .then(res => {
+ this.order = res.data.tbBillList;
+ this.printedCount = res.data.tbBillList.bgqty || 0;
+ this.defectiveCount = res.data.tbBillList.blQty || 0;
+ this.productionCount = this.order.todayOutput || 0;
+ });
+ },
+ getXS0101() {
+ this.$post({ url: "/MesStaff/GetAllXS0101" })
+ .then(res => {
+ this.staff = res.data.tbBillList;
+ this.users = this.staff.map(s => s.staffNo + ":" + s.staffName);
+ });
+ },
+ getWomdaaPrintById() {
+ this.$post({ url: "/Womdaa/GetWomdaaPrintById", data: { orderId: this.orderId } })
+ .then(res => {
+ if (!res?.data?.tbBillList) return;
+ const d = res.data.tbBillList;
+ this.bqty = d.bqty;
+ this.icount = 1;
+ this.sQuantity = d.sQuantity || 0;
+ this.initialValue = d.initialValue || 0;
+ this.kgQty = d.kgQty || 0;
+ this.barcodeAmount = d.qqty || 0;
+ if (this.bqty === 0) this.Completed();
+ }).catch(() => { });
+ },
+ Completed() {
+ this.$post({ url: "/MesOrderSta/Completed", data: { orderId: this.orderId, orderNo: this.orderNo } });
+ },
+ init() {
+ try {
+ const v = this.getAndroidVersion();
+ v >= 12 ? this.initForAndroid12Plus() : this.initForAndroidLegacy();
+ } catch (e) { console.error(e); }
+ },
+ getAndroidVersion() {
+ try { var Build = plus.android.importClass("android.os.Build"); return Build.VERSION.SDK_INT; }
+ catch { return 30; }
+ },
+ initForAndroid12Plus() {
+ try {
+ var main = plus.android.runtimeMainActivity();
+ var BluetoothManager = plus.android.importClass("android.bluetooth.BluetoothManager");
+ var Context = plus.android.importClass("android.content.Context");
+ var UUID = plus.android.importClass("java.util.UUID");
+ this.uuid = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
+ var mgr = main.getSystemService(Context.BLUETOOTH_SERVICE);
+ var adp = mgr.getAdapter();
+ if (adp && adp.isDiscovering()) adp.cancelDiscovery();
+ this.printMac = uni.getStorageSync('printMac');
+ var mac = this.printMac || "DC:1D:30:91:06:52";
+ if (adp) {
+ this.device = adp.getRemoteDevice(mac);
+ plus.android.importClass(this.device);
+ }
+ } catch (e) { this.initForAndroidLegacy(); }
+ },
+ initForAndroidLegacy() {
+ try {
+ var BluetoothAdapter = plus.android.importClass("android.bluetooth.BluetoothAdapter");
+ var UUID = plus.android.importClass("java.util.UUID");
+ this.uuid = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
+ var BAdapter = BluetoothAdapter.getDefaultAdapter();
+ if (BAdapter) BAdapter.cancelDiscovery();
+ this.printMac = uni.getStorageSync('printMac');
+ var mac = this.printMac || "DC:1D:30:91:06:52";
+ if (BAdapter) {
+ this.device = BAdapter.getRemoteDevice(mac);
+ plus.android.importClass(this.device);
+ this.bluetoothSocket = this.device.createInsecureRfcommSocketToServiceRecord(this.uuid);
+ plus.android.importClass(this.bluetoothSocket);
+ }
+ } catch (e) { }
+ },
+ deleteBarcode() {
+ this.isShow = false;
+ this.isGeneratingBarcode = false;
+ this.generateRequestId = null;
+ this.bufferData = ''; this.dataToPrint = [];
+ this.staffNo = null; this.user = ''; this.barcodeAmount = ''; this.icount = 1; this.staff = null;
+ }
+ }
+ }
</script>
<style scoped>
--
Gitblit v1.9.3