快乐的昕的电脑
2025-10-21 b4f58d63fc5b29fc3f23caafe4d4299ab5a47546
components/WorkOrderPrint.vue
@@ -29,11 +29,11 @@
                        <td>{{ order.daa003 || '-' }}</td>
                        <td>{{ planQtyDisplay }}</td>
                        <td>{{ machineNo || '-' }}</td>
                        <td>{{ initCjNum }}</td><!--初始采集数-->
                        <td>{{ currentCjNum }}</td><!--报工时采集数-->
                        <td>{{ calculatedTotalProduction }}</td><!--报工数(计算)-->
                        <td>{{ calculatedDefectiveCount }}</td><!--不良数-->
                        <td>{{ sQuantity }}</td><!--良品数(计算)-->
                        <td>{{ order.initCjNum }}</td><!--初始采集数-->
                        <td>{{ order.currentCjNum }}</td><!--报工时采集数-->
                        <td>{{ order.currentCjNum - order.initCjNum }}</td><!--报工数(计算)-->
                        <td>{{ realTimeDefectiveCount }}</td><!--不良数-->
                        <td>{{ realTimeOkCount }}</td><!--良品数(计算)-->
                     </tr>
                     <!-- 历史报工记录行 -->
                     <tr v-for="(r, idx) in reportingHistory" :key="idx">
@@ -59,7 +59,7 @@
         <!-- 下面原有内容保持不变 -->
         <view class="status-row">
            <view class="status-box">
            <!--<view class="status-box">
               <text>机台面板数:</text>
               <input v-model="productionCount" class="highlight" disabled />
            </view>
@@ -80,7 +80,7 @@
            <view class="status-box result-box">
               <text>已生产数:</text>
               <input v-model="calculatedTotalProduction" class="highlight" disabled />
            </view>
            </view>-->
            <view class="btn-group">
               <button class="refresh-btn-inline" @click="refresh">刷新</button>
               <button v-if="isGeneratingBarcode" class="reset-btn-inline" @click="resetGenerateState">重置</button>
@@ -144,10 +144,11 @@
            </view>
         </view>
         <view class="bottom-section">
         <!-- 禁用按钮:‘保存并生效'、‘取消’ -->
         <!--<view class="bottom-section">
            <button class="save-btn" @click="save">保存并生效</button>
            <button class="cancel-btn" @click="cancel">取消</button>
         </view>
         </view>-->
         <!-- 保留旧弹窗 -->
         <view v-if="isShow" class="overlay">
@@ -215,7 +216,19 @@
            reportingHistory: []
         }
      },
        computed: {
      computed: {
           //良品数实时计算
            realTimeDefectiveCount() {
                // 优先用输入框的值,否则用接口数据
                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); },
@@ -329,6 +342,7 @@
            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; }
@@ -336,12 +350,14 @@
            const amount = Number(this.customAmount);
            this.$post({
               url: "/MesInvItemBarcodes/AddBFToBarcodes",
               data: {
                  orderNo: this.orderNo,
                  orderId: this.orderId,
                  bf: amount,
                  staffNo: staffNo
               }
                    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('报废数量填写成功');