zrg
3 天以前 fb0d024283a24042e55c70019dffbcd104792135
pages/ZLGL/QualityReportStep/QualityReportStepBill.vue
@@ -4,9 +4,16 @@
      <view class="bill-main-area">
         <!-- 主表页签 -->
         <view class="bill-main-tabs">
            <view :class="mainTabSelected == 1 ? 'selected' : ''" @tap="mainTabSelected = 1">基本信息</view>
            <view :class="mainTabSelected == 2 ? 'selected' : ''" @tap="mainTabSelected = 2">扫描信息</view>
            <view :class="mainTabSelected == 3 ? 'selected' : ''" @tap="mainTabSelected = 3">制单信息</view>
            <view class="tabs-left">
               <view :class="mainTabSelected == 1 ? 'selected' : ''" @tap="mainTabSelected = 1">基本信息</view>
               <view :class="mainTabSelected == 2 ? 'selected' : ''" @tap="mainTabSelected = 2">扫描信息</view>
               <view :class="mainTabSelected == 3 ? 'selected' : ''" @tap="mainTabSelected = 3">制单信息</view>
               <view :class="mainTabSelected == 4 ? 'selected' : ''" @tap="mainTabSelected = 4">其他信息</view>
            </view>
            <view class="mode-switch-right">
               <text class="mode-text">{{ directInputMode ? '直接输入' : '双击累加' }}</text>
               <switch :checked="directInputMode" @change="onModeSwitchChange" color="#3a78ff" style="transform: scale(0.7);" />
            </view>
         </view>
         <!-- 主表内容 -->
         <view class="bill-main-contents">
@@ -80,30 +87,14 @@
                     <input type="text" disabled :value="hform.HMaterName" />
                  </view>
               </view>
               <view class="form-item">
                   <view class="left">源单数量</view>
                   <view class="right disabled">
                       <input type="number" v-model="hform.HSourceBillQty" />
                   </view>
               </view>
               <view class="form-item">
                  <view class="left">检验数量</view>
                  <view class="right">
                     <input type="number" v-model="hform.HCheckQty" :disabled="hasCheckQty" />
                  <view class="left">工序</view>
                  <view class="right disabled">
                     <input type="text" disabled :value="hform.HProcName" />
                  </view>
               </view>
               <view class="form-item">
                  <view class="left">生产班组</view>
                  <view class="right-select">
                     <zxz-uni-data-select
                        v-model="hform.HGroupID"
                        dataKey="班组名称"
                        dataValue="HItemID"
                        :filterable="true"
                        :localdata="HGroupList"
                        :clear="false"
                     ></zxz-uni-data-select>
                  </view>
               </view>
               <view class="form-item">
                  <view class="left">检验员</view>
@@ -119,29 +110,42 @@
                  </view>
               </view>
               
               <view class="form-item">
                  <view class="left">工序</view>
                  <view class="right disabled">
                     <input type="text" disabled :value="hform.HProcName" />
                  </view>
               </view>
               
               <view class="form-item">
                  <view class="left">生产资源</view>
                  <view class="right-select">
                     <zxz-uni-data-select
                        v-model="hform.HSourceID"
                        dataKey="生产资源名称"
                        dataValue="HItemID"
                        :filterable="true"
                        :localdata="HSourceList"
                        :clear="false"
                     ></zxz-uni-data-select>
                  </view>
                   <view class="left">源单数量</view>
                   <view class="right disabled">
                       <input type="number" v-model="hform.HSourceBillQty" />
                   </view>
               </view>
               
               <view class="form-item">
                  <view class="left">送检数量</view>
                  <view class="right">
                     <input type="number" v-model="hform.HCheckQty" :disabled="hasCheckQty" />
                  </view>
               </view>
               <view class="form-item">
                  <view class="left">不良数量</view>
                  <view class="right">
                     {{ totalNum }}
                  </view>
               </view>
               <view class="form-item">
                  <view class="left">合格数量</view>
                  <view class="right">
                     {{ hform.HCheckQty-totalNum }}
                  </view>
               </view>
               <view class="form-item">
                  <view class="left">不良率</view>
                  <view class="right">
                     {{ totalNum/(hform.HCheckQty==0?1:hform.HCheckQty) }}
                  </view>
               </view>
               <view class="form-item" style="width: 1350rpx;">
                  <view class="left">备注</view>
                  <view class="right">
                     <input type="text" v-model="hform.HRemark" value="" />
@@ -228,6 +232,35 @@
                  </view>
               </view>
            </view>
            <!-- 其他信息 -->
            <view class="bill-main-content" v-if="mainTabSelected == 4">
               <view class="form-item">
                  <view class="left">生产班组</view>
                  <view class="right-select">
                     <zxz-uni-data-select
                        v-model="hform.HGroupID"
                        dataKey="班组名称"
                        dataValue="HItemID"
                        :filterable="true"
                        :localdata="HGroupList"
                        :clear="false"
                     ></zxz-uni-data-select>
                  </view>
               </view>
               <view class="form-item">
                  <view class="left">生产资源</view>
                  <view class="right-select">
                     <zxz-uni-data-select
                        v-model="hform.HSourceID"
                        dataKey="生产资源名称"
                        dataValue="HItemID"
                        :filterable="true"
                        :localdata="HSourceList"
                        :clear="false"
                     ></zxz-uni-data-select>
                  </view>
               </view>
            </view>
         </view>
      </view>
      <!-- 子表区域 -->
@@ -250,7 +283,7 @@
               <view >
                  <view>{{ item.不良原因代码 }}</view>
                  <view>{{ item.不良原因名称 }}</view>
                  <view>汇报总数:{{ item.num }}</view>
                  <view style="color:brown;">汇报总数:{{ item.num }}</view>
               </view>
            </view>
         </view>
@@ -265,6 +298,32 @@
      
      <BillListPopupVue ref="billList" :HBillType="hform.HBillType" :HSourceBillType="hform.HSourceBillType"
         :HStockOrgID="hform.HStockOrgID" @BillSelectComplete="HandleBillSelectComplete"></BillListPopupVue>
      <!-- 直接输入数量弹窗 -->
      <uni-popup ref="inputQtyPopup" type="center">
         <view class="input-qty-popup">
            <view class="popup-title">输入不良数量</view>
            <view class="popup-content">
               <view class="popup-info">
                  <text class="popup-label">不良原因:</text>
                  <text class="popup-value">{{ currentItem && currentItem.不良原因名称 || '' }}</text>
               </view>
               <view class="popup-info">
                  <text class="popup-label">当前数量:</text>
                  <text class="popup-value">{{ currentItem && currentItem.num || 0 }}</text>
               </view>
               <view class="popup-input-row">
                  <text class="popup-label">输入数量:</text>
                  <input class="popup-input" type="number" v-model="inputQtyValue" placeholder="请输入数量" />
               </view>
            </view>
            <view class="popup-buttons">
               <button class="btn-c" size="mini" @tap="cancelInputQty">取消</button>
               <view style="flex: 1;"></view>
               <button class="btn-a" size="mini" @tap="confirmInputQty">确认</button>
            </view>
         </view>
      </uni-popup>
   </view>
</template>
@@ -287,6 +346,11 @@
         BillListPopupVue,
      },
      computed: {
         // 计算 num 合计
         totalNum() {
           if (!this.HBadReasonList || this.HBadReasonList.length === 0) return 0;
           return this.HBadReasonList.reduce((sum, item) => sum + (item.num || 0), 0);
         }
      },
      data() {
         return {
@@ -294,7 +358,12 @@
            //上一次点击时间
            lastClickTime: 0,
            operationType: 1,
            // 直接输入模式开关
            directInputMode: true,
            // 弹窗相关
            currentItem: null,
            inputQtyValue: '',
            mainTabSelected: 1,
            subTabSelected: 0,
@@ -349,6 +418,7 @@
               HCheckQty: 0,
               //源单信息
               HSourceBillQty: 0,
               HSourceBillNo:'',
               HSourceBillType: "3772",
               //流转卡信息
               HICMOBillNo: "",
@@ -402,6 +472,11 @@
         },
         //不良原因单击
         reasonClick(item) {
            // 直接输入模式下,单击直接弹出输入框
            if (this.directInputMode) {
               this.showDirectInputDialog(item);
               return;
            }
             const now = Date.now();
             if (now - this.lastClickTime < 300) {
               // 双击逻辑
@@ -412,6 +487,37 @@
               this.handleSingleClick(item);
               this.lastClickTime = now;
             }
         },
         // 模式切换
         onModeSwitchChange(e) {
            this.directInputMode = e.detail.value;
         },
         // 显示直接输入数量的弹窗
         showDirectInputDialog(item) {
            this.currentItem = item;
            this.inputQtyValue = String(item.num || 0);
            this.$refs.inputQtyPopup.open();
         },
         // 取消输入
         cancelInputQty() {
            this.$refs.inputQtyPopup.close();
            this.currentItem = null;
            this.inputQtyValue = '';
         },
         // 确认输入
         confirmInputQty() {
            const inputQty = parseInt(this.inputQtyValue);
            if (isNaN(inputQty) || inputQty < 0) {
               uni.showToast({
                  title: '请输入有效数量',
                  icon: 'none'
               });
               return;
            }
            this.submitBarCodeWithQty(this.currentItem, inputQty);
            this.$refs.inputQtyPopup.close();
            this.currentItem = null;
            this.inputQtyValue = '';
         },
         handleSingleClick(item) {
            console.log('单击:', item.不良原因名称);
@@ -461,12 +567,18 @@
         toScanCode() {
            MpaasScan.scanCode((res) => {
               if (res) {
                  this.getSourceBillInfo(HBarCode);
                  this.getSourceBillInfo(res);
               }
            });
         },
         async getGy_BadReasonList() {
            let sWhere = ` and HUSEORGID = '${uni.getStorageSync('OrganizationID')}' and ISNULL(审核人,'')  != '' order by 不良原因代码`
            let sWhere = ` and HUSEORGID = '${uni.getStorageSync('OrganizationID')}' and ISNULL(审核人,'')  != '' `
            if (this.serverUrl == 'http://122.228.39.234:7177/API/') {
                //海诚根据物料分组设置不良原因
               sWhere += (" and HDeptID="+this.hform.HDeptID+" order by 不良原因代码")
            }else{
               sWhere += " order by 不良原因代码"
            }
            let res = await CommonUtils.doRequest2Async({
               url: "/Gy_BadReason/list",
               data: {
@@ -493,7 +605,7 @@
                  }      
               })
               this.HBadReasonList = data;
               this.getHisReportList();//获取历史记录
            } else {
               CommonUtils.showTips({
                  title: '温馨提示',
@@ -523,12 +635,19 @@
               count
            } = res.data
            if (count == 1) {
               if(data[0]['HBack']==1){
                  CommonUtils.showTips({
                     title: '温馨提示',
                     message: data[0]['HBackRemark']
                  })
                  return;
               }
               this.hform.HMaterID = data[0]['HMaterID']
               this.hform.HMaterName = data[0]['产品名称']
               this.hform.HMaterNumber = data[0]['产品代码']
               //源单信息
               this.hform.HMainSourceBillNo = data[0]['HBillNo']
               this.hform.HSourceBillNo = data[0]['HBillNo']
               this.hform.HMainSourceBillNo = data[0]['单据号']
               this.hform.HSourceBillNo = data[0]['单据号']
               this.hform.HMainSourceInterID = data[0].HInterID
               this.hform.HMainSourceEntryID = data[0].HEntryID
               this.hform.HSourceBillQty = data[0].流转卡数量
@@ -547,7 +666,8 @@
               this.hform.HProcID= data[0].HProcID
               this.hform.HProcName= data[0].当前工序
               this.hform.HDeptID= data[0].HWorkShopID
               this.getGy_BadReasonList();
            } else {
               CommonUtils.showTips({
                  title: '温馨提示',
@@ -583,13 +703,21 @@
                     count
                 } = res.data
                 if (count == 1) {
                  //如果源单数量超出提示
                  if(data[0]['HBack']==1){
                     CommonUtils.showTips({
                        title: '温馨提示',
                        message: data[0]['HBackRemark']
                     })
                     return;
                  }
                     console.log('获取源单:', data)
                     this.hform.HMaterID = data[0]['HMaterID']
                     this.hform.HMaterName = data[0]['产品名称']
                     this.hform.HMaterNumber = data[0]['产品代码']
                     //源单信息
                     this.hform.HMainSourceBillNo = data[0]['HBillNo']
                     this.hform.HSourceBillNo = data[0]['HBillNo']
                     this.hform.HSourceBillNo = data[0]['单据号']
                     this.hform.HMainSourceInterID = data[0].HInterID
                     this.hform.HMainSourceEntryID = data[0].HEntryID
                     this.hform.HSourceBillQty = data[0].流转卡数量
@@ -610,6 +738,7 @@
                     this.hform.HProcName= data[0].当前工序
                  this.hform.HDeptID= data[0].HWorkShopID
                     this.$refs['billList'].exit()
                  this.getGy_BadReasonList();
                 } else {
                     CommonUtils.showTips({
                         title: '温馨提示',
@@ -633,22 +762,25 @@
                  url: "/Sc_QualityReportBill/get_BarCodeDetail",
                  data: {
                     HInterID: this.hform.HInterID,
                  },
               });
               let {
                  data,
                  Message,
                  count
               } = res.data;
               if (count == 1) {
                  console.log("data: ", data);
                  this.HisReportList = data;
                  // 统计各不良原因的数量并更新到 HBadReasonList
                  this.updateBadReasonNumFromHisReport();
               } else {
                  this.HisReportList = [];
                  this.clearBadReasonNum();
                  CommonUtils.showTips({
                     title: "温馨提示",
                     message: `获取历史扫码记录失败: ${Message}`,
@@ -660,6 +792,33 @@
                  message: `获取历史扫码记录失败: ${err}`,
               });
            }
         },
         // 从 HisReportList 统计更新 HBadReasonList 的 num
         updateBadReasonNumFromHisReport() {
            // 先清空所有 num
            this.HBadReasonList.forEach(item => {
               this.$set(item, 'num', 0);
            });
            // 统计 HisReportList 中各不良原因的数量
            if (this.HisReportList && this.HisReportList.length > 0) {
               this.HisReportList.forEach(hisItem => {
                  // 根据 HBadReasonID 匹配
                  const matchedItem = this.HBadReasonList.find(
                     badItem => badItem.不良原因代码 == hisItem.HBadReasonNumber
                  );
                  if (matchedItem) {
                     const currentNum = matchedItem.num || 0;
                     this.$set(matchedItem, 'num', currentNum + hisItem.HBadReasonHQty||1);
                  }
               });
            }
         },
         // 清空 HBadReasonList 的 num
         clearBadReasonNum() {
            this.HBadReasonList.forEach(item => {
               this.$set(item, 'num', 0);
            });
         },
         //删除历史记录
         delReason(item) {
@@ -709,7 +868,7 @@
               let res = await CommonUtils.doRequest2Async({
                  url: "/Gy_Employee/list",
                  data: {
                     sWhere: ` and 组织名称 = '${uni.getStorageSync("Organization")}' and 禁用标记 = ''and 审核人 !='' order by 部门代码`,
                     sWhere: ` and 禁用标记 = ''  and HDeptID = ${uni.getStorageSync("HDeptID")}`,
                     user: getUserInfo()["Czymc"],
                     Organization: uni.getStorageSync("Organization"),
                  },
@@ -744,7 +903,7 @@
               let res = await CommonUtils.doRequest2Async({
                  url: "/Gy_Source/list",
                  data: {
                     sWhere: `and 禁用标记 != 'Y' and ISNULL(审核人,'')  != '' and 组织 = '${uni.getStorageSync("Organization")}'`,
                     sWhere: `and 禁用标记 != 'Y' and 组织 = '${uni.getStorageSync("Organization")}'`,
                     user: getUserInfo()["Czymc"],
                  },
               });
@@ -776,7 +935,7 @@
               let res = await CommonUtils.doRequest2Async({
                  url: "/Gy_Group/list",
                  data: {
                     sWhere: `and 禁用标记 != 'Y' and ISNULL(审核人,'')  != '' and 组织 = '${uni.getStorageSync("Organization")}'`,
                     sWhere: `and 禁用标记 != 'Y' and 组织 = '${uni.getStorageSync("Organization")}'`,
                     user: getUserInfo()["Czymc"],
                  },
               });
@@ -862,6 +1021,9 @@
                  ,HMakeDate:this.hform.HMakeDate
                  ,HReportType:1
                  ,HSourceBillType:this.hform.HSourceBillType
                  ,HSourceBillNo:this.hform.HSourceBillNo
                  ,HSourceInterID:this.hform.HMainSourceInterID
                  ,HSourceEntryID:this.hform.HMainSourceEntryID
                  ,HBadReasonHQty:1
                  ,HQty:this.hform.HCheckQty
               }
@@ -890,14 +1052,85 @@
                     title: "保存成功",
                     message: `保存成功`,
                  });
                  if(!item.num){
                     this.$set(item, 'num', 1);
                  }else{
                     this.$set(item, 'num', item.num++);
                  }
                  //this.$set(item, 'num', newValue);
                  // 刷新历史记录,num会自动从HisReportList统计更新
                  this.getHisReportList();
                  this.hasCheckQty=true;
               } else {
                  CommonUtils.showTips({
                     title: "温馨提示",
                     message: `不良原因保存错误: ${Message}`,
                  });
               }
            } catch (err) {
               CommonUtils.showTips({
                  title: "温馨提示",
                  message: `不良原因保存错误: ${err}`,
               });
            }
         },
         //提交不良原因扫码记录缓存(直接输入数量)
         async submitBarCodeWithQty(item, qty){
            if(!this.checkSubmitValidate()){
               return
            }
            try {
               let oMainObject = {
                  HInterID:this.hform.HInterID
                  ,HBillNo:this.hform.HBillNo
                  ,HBillType:this.hform.HBillType
                  ,HDate:new Date()
                  ,HICMOBillNo:this.hform.HICMOBillNo
                  ,HICMOInterID:this.hform.HICMOInterID
                  ,HICMOEntryID:this.hform.HICMOEntryID
                  ,HProcExchBillNo:this.hform.HProcExchBillNo
                  ,HProcExchInterID:this.hform.HProcExchInterID
                  ,HProcExchEntryID:this.hform.HProcExchEntryID
                  ,HProcID:this.hform.HProcID
                  ,HMaterID:this.hform.HMaterID
                  ,HSourceID:this.hform.HSourceID
                  ,HGroupID:this.hform.HGroupID
                  ,HDeptID:this.hform.HDeptID
                  ,HCheckManID:this.hform.HEmpID
                  ,HBadReasonID:item.HItemID
                  ,HBarCode:item.不良原因代码
                  ,HMaker:this.hform.HMaker
                  ,HMakeDate:this.hform.HMakeDate
                  ,HReportType:1
                  ,HSourceBillType:this.hform.HSourceBillType
                  ,HSourceBillNo:this.hform.HSourceBillNo
                  ,HSourceInterID:this.hform.HMainSourceInterID
                  ,HSourceEntryID:this.hform.HMainSourceEntryID
                  ,HBadReasonHQty:qty
                  ,HQty:this.hform.HCheckQty
               }
               var sMainStr = JSON.stringify(oMainObject);
               var oMain = sMainStr + ';' + this.operationType;
               let res = await CommonUtils.doRequest2Sync({
                  url: "/Sc_QualityReportBill/set_SaveBarCode",
                  data: {
                     oMain: oMain,
                  },
                  method: "POST",
               });
               if (!res) {
                  return;
               }
               let {
                  count,
                  Message,
                  data
               } = res.data;
               if (count == 1) {
                  CommonUtils.showTips({
                     title: "保存成功",
                     message: `保存成功,数量: ${qty}`,
                  });
                  // 刷新历史记录,num会自动从HisReportList统计更新
                  this.getHisReportList();
                  this.hasCheckQty = true;
               } else {
                  CommonUtils.showTips({
                     title: "温馨提示",
@@ -944,6 +1177,13 @@
            // if (!this.checkSubmitValidate()) {
            //    return;
            // }
            if(this.HisReportList.length<=0){
               CommonUtils.showTips({
                  title: "温馨提示",
                  message: `请输入检验信息`,
               });
               return
            }
            try {
               console.log('this.$refs: ', this.$refs);
@@ -1006,195 +1246,102 @@
         goBack() {
            uni.navigateBack();
         },
         async RoadBillMain() {
            try {
               let res = await CommonUtils.doRequest2Async({
                  url: "/QC_ProcessCheckBill/QC_ProcessCheckBill_Edit",
                  data: {
                     sWhere: ` and hmainid=${this.hform.HInterID}`,
                     user: getUserInfo()["Czymc"],
                  },
               });
               let {
                  data,
                  count,
                  Message
               } = res.data;
               if (count == 1) {
                  console.log("RoadBillMain: : ", data);
                  Object.assign(this.hform, {
                     HInterID: data[0].hmainid,
                     HBillNo: data[0].单据号,
                     HDate: dayjs(data[0].日期).format("YYYY-MM-DD"),
                     HSourceID: data[0].HSourceID,
                     HSourceName: data[0].生产资源名称,
                     HICMOBillNo: data[0].任务单号,
                     HICMOQty: data[0].任务单数量,
                     HICMOInterID: data[0].HICMOInterID,
                     HICMOEntryID: data[0].HICMOEntryID || 1,
                     HMaterID: data[0].HMaterID,
                     HMaterName: data[0].物料名称,
                     HMaterNumber: data[0].物料代码,
                     HProcID: data[0].HProcID,
                     HProcName: data[0].HProcName,
                     HProcExchQty: data[0].HProcExchQty || 0,
                     HProcExchBillNo: data[0].HProcExchBillNo,
                     HProcExchInterID: data[0].HProcExchInterID,
                     HProcExchEntryID: data[0].HProcExchEntryID || 0,
                     HFirstCheckEmp: data[0].HFirstCheckEmp,
                     HFirstCheckEmpName: data[0].质检员名称,
                     HQCSchemeID: data[0].检验方案ID,
                     HQCSchemeName: data[0].检验方案名称,
                     HRemark: data[0].表头备注,
                     HMaker: data[0].制单人,
                     HMakeDate: data[0].制单日期,
                     HChecker: data[0].审核人,
                     HCheckDate: data[0].审核日期,
                     HCloseMan: data[0].关闭人,
                     HCloseDate: data[0].关闭日期,
                     HUpDateDate: data[0].修改日期,
                     HDeleteDate: data[0].作废日期,
                     HSampleSchemeID: data[0].HSampleSchemeID,
                     HSampleSchemeName: data[0].抽样方案名称,
                     HSampleQty: data[0].样本量,
                     HSampleQty2: data[0].样本量,
                     HSampleDamageQty: data[0].样本破坏数,
                     HSamplingType: data[0].抽样类型,
                     HAcceptQty: data[0].允许数,
                     HInspectionLevel: data[0].检验水平,
                     HRejectQty: data[0].拒绝数,
                     HStrictness: data[0].严格度,
                     HSampleUnRightQty: data[0].样本不合格数 || 0,
                     HSampleUnRightQty2: data[0].样本不合格数,
                     HAQL: data[0].AQL,
                     HUnitID: data[0].HUnitID,
                     HUnit: data[0].单位,
                     HInspectValB: data[0].检测值基础资料,
                     HInspectVal: data[0].检测值,
                     HTargetValB: data[0].目标值基础资料,
                     HTargetVal: data[0].目标值,
                     HUpLimit: data[0].上限值,
                     HDownLimit: data[0].下限值,
                     HUpOffSet: data[0].上偏差,
                     HDownOffSet: data[0].下偏差,
                     HEntryID: data[0].hsubid,
                     HQCCheckItemName: data[0].检验项目名称,
                     HQCCheckItemID: data[0].HQCCheckItemID,
                     HShiftsID: data[0].HShiftsID,
                     HShiftsName: data[0].班次名称,
                     HErrTreatment: data[0].异常临时处理方案,
                     HBatchNo: data[0].批号,
                     HCheckerResult: data[0].判定结论 == "合格" ? true : false,
                     HTakeSampleCheckBillID: data[0].HTakeSampleCheckBillID,
                     HTakeSampleCheckBillNo: data[0].HTakeSampleCheckBillNo,
                     HAnalysisMethod: function() {
                        if (data[0].HAnalysisMethod == 1) {
                           return '定性检验'
                        } else if (data[0].HAnalysisMethod == 2) {
                           return '定量检验'
                        } else {
                           return '其他检验'
                        }
                     }(),
                  });
                  for (let i = 0; i < data.length; i++) {
                     this.addCheckItem({
                        HQCCheckItemID: data[i].HQCCheckItemID,
                        HQCCheckItemNumber: data[i].检验项目代码,
                        HQCCheckItemName: data[i].检验项目名称,
                        HInspectInstruMentID: data[i].HInspectInstruMentID,
                        HInspectInstruMentNumber: data[i].检验仪器代码,
                        HInspectInstruMentName: data[i].检验仪器名称,
                        HQCStd: data[i].检验标准,
                        HUnit: data[i].单位名称,
                        HQCNote: data[i].检验记录,
                        HResult: data[i].结论 == "合格" ? 1 : 0,
                        HMax: data[i].最大值,
                        HMin: data[i].最小值,
                        HAvg: data[i].平均值,
                        HRemark: data[i].表体备注,
                        HAnalysisMethod: data[i].分析方法 == "定性分析" ?
                           1 : data[i].分析方法 == "定量分析" ?
                           2 : 3,
                        HKeyInspect: data[i].重点检查 == "否" ? false : true,
                        HSampleSchemeID: data[i].HSampleSchemeID,
                        HUnitID: data[i].HUnitID,
                        HInspectVal: data[i].检测值,
                        HTargetVal: data[i].目标值,
                        HUpLimit: data[i].上限值,
                        HDownLimit: data[i].下限值,
                        HUpOffSet: data[i].上偏差,
                        HDownOffSet: data[i].下偏差,
                        HSampleDamageQty: data[i].样本破坏数,
                        HSampleSchemeName: data[i].抽样方案名称,
                        HSampleQty: data[i].样本量,
                        HSampleDamageQty: data[i].样本破坏数,
                        HAcceptQty: data[i].允许数,
                        HInspectionLevel: 0,
                        HRejectQty: data[i].拒绝数,
                        HStrictness: 0,
                        HSampleUnRightQty: data[i].样本不合格数,
                        HAQL: data[i].AQL,
                        HSamplingType: 0,
                        HSamplingType: data[i].抽样类型,
                        HStrictness: data[i].严格度,
                        HInspectResultToSee: data[i].检验结果
                     });
                  }
                  this.hasSourceBill = true
               } else {
                  CommonUtils.showTips({
                     title: "温馨提示",
                     message: `加载单据失败: ${Message}`,
                  });
               }
            } catch (err) {
               CommonUtils.showTips({
                  title: "温馨提示",
                  message: `加载单据失败: ${err}`,
               });
         // 设置为自动
         setAuto() {
            if (uni.getSystemInfoSync().platform === 'android' ||
                 uni.getSystemInfoSync().platform === 'ios') {
               plus.screen.unlockOrientation();
            }
         },
         // 设置为竖屏
         setPortrait() {
           if (uni.getSystemInfoSync().platform === 'android' ||
              uni.getSystemInfoSync().platform === 'ios') {
            plus.screen.lockOrientation('portrait');
           }
         },
      },
      async onLoad(e) {
         //this.setAuto();
         this.operationType = e.operationType || 1;
         this.hform.HInterID = e.linterid || 0;
         if (this.operationType == 1) {
            await this.getMaxBillNo();
         } else if (this.operationType == 2) {
         } else if (this.operationType == 3) {
            await this.RoadBillMain();
         }
         this.getGy_BadReasonList();
         }
         //this.getGy_BadReasonList();
         await this.InitHSource();
         await this.InitHEmp();
         await this.InitHGroup();
         await this.loadCache();
      },
      onUnload(){
         this.setPortrait();
      }
   };
</script>
<style lang="scss" scoped>
   input {
      width: inherit;
      font-size: 26rpx;
      font-size: 30rpx;
   }
   .uni-input {
      padding: 0;
   }
   .bill-main-tabs,
   .bill-main-tabs {
      box-sizing: border-box;
      width: 100%;
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid #ddd;
      padding: 20rpx 10rpx;
      .tabs-left {
         display: flex;
         flex-direction: row;
         flex-wrap: nowrap;
         gap: 20rpx;
         flex-shrink: 0;
         overflow-x: auto;
         white-space: nowrap;
         view {
            width: auto;
            font-size: 30rpx;
            color: #555;
            text-align: center;
            padding: 16rpx 0;
         }
         .selected {
            color: #3a78ff;
            font-weight: bold;
            border-bottom: 3px solid #3a78ff;
         }
      }
      .mode-switch-right {
         display: flex;
         flex-direction: row;
         align-items: center;
         gap: 10rpx;
         flex-shrink: 0;
         padding-right: 10rpx;
         .mode-text {
            font-size: 24rpx;
            color: #666;
         }
      }
   }
   .bill-sub-tabs {
      box-sizing: border-box;
      width: 100%;
@@ -1210,7 +1357,7 @@
      view {
         width: auto;
         font-size: 26rpx;
         font-size: 30rpx;
         color: #555;
         text-align: center;
         padding: 16rpx 0;
@@ -1220,6 +1367,93 @@
         color: #3a78ff;
         font-weight: bold;
         border-bottom: 3px solid #3a78ff;
      }
   }
   /* 直接输入数量弹窗样式 */
   .input-qty-popup {
      background-color: #fff;
      border-radius: 20rpx;
      padding: 30rpx;
      width: 600rpx;
      box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.15);
      .popup-title {
         font-size: 32rpx;
         font-weight: bold;
         color: #333;
         text-align: center;
         padding-bottom: 20rpx;
         border-bottom: 1px solid #eee;
      }
      .popup-content {
         padding: 20rpx 0;
         .popup-info {
            display: flex;
            align-items: center;
            padding: 10rpx 0;
            .popup-label {
               font-size: 28rpx;
               color: #666;
               width: 180rpx;
            }
            .popup-value {
               font-size: 28rpx;
               color: #333;
            }
         }
         .popup-input-row {
            display: flex;
            align-items: center;
            padding: 15rpx 0;
            margin-top: 10rpx;
            .popup-label {
               font-size: 28rpx;
               color: #666;
               width: 180rpx;
            }
            .popup-input {
               flex: 1;
               height: 60rpx;
               border: 1px solid #acacac;
               border-radius: 10rpx;
               padding: 0 15rpx;
               font-size: 28rpx;
            }
         }
      }
      .popup-buttons {
         display: flex;
         flex-direction: row;
         gap: 10rpx;
         padding-top: 20rpx;
         border-top: 1px solid #eee;
         button {
            border-radius: 50rpx;
            width: 150rpx;
            height: 60rpx;
            line-height: 60rpx;
            font-size: 28rpx;
         }
         .btn-a {
            background-color: #3a78ff;
            color: #fff;
         }
         .btn-c {
            background-color: #acacac;
            color: #fff;
         }
      }
   }
@@ -1233,10 +1467,10 @@
      /* 可选:设置换行后的对齐方式 */
      align-content: flex-start; /* 多行对齐方式 */
      .form-item {
         width: 600rpx;
         width: 650rpx;
         display: flex;
         align-items: center;
         font-size: 26rpx;
         font-size: 30rpx;
         padding: 6rpx 0;
          margin-right: 20rpx;
         .left {
@@ -1251,7 +1485,7 @@
         .right {
            // width: 450rpx;
            padding: 8rpx 20rpx;
            font-size: 26rpx;
            font-size: 30rpx;
            flex: 1;
            border-radius: 22rpx;
            border: 1px solid #acacac;
@@ -1262,18 +1496,19 @@
               .uni-input-placeholder,
               .uni-input-input {
                  font-size: 26rpx;
                  font-size: 30rpx;
               }
            }
            .uni-combox::v-deep input {
               height: inherit;
               font-size: 26rpx;
               font-size: 30rpx;
            }
         }
         .right-select {
            //padding: 8rpx 20rpx;
            font-size: 26rpx;
            font-size: 30rpx;
            flex: 1;
            
         }
@@ -1345,7 +1580,7 @@
         width: 180rpx;
         height: 66rpx;
         line-height: 66rpx;
         font-size: 26rpx;
         font-size: 30rpx;
      }
      .btn-a {
@@ -1377,19 +1612,19 @@
         gap: 10rpx 0;
         input {
            font-size: 26rpx;
            font-size: 30rpx;
         }
         .detail {
            // width: 50%;
            box-sizing: border-box;
            font-size: 26rpx;
            font-size: 30rpx;
            color: #555;
            padding-right: 20rpx;
            text {
               color: #999;
               font-size: 26rpx;
               font-size: 30rpx;
            }
         }
@@ -1497,18 +1732,20 @@
   
   .reason-item-flex {
     /* 方块基础样式 */
     background-color: #f5f5f5;
     background-color: #55ffff;
     border-radius: 8px;
     padding: 12px 16px;
     box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
     transition: all 0.3s ease;
      border-width: 2px;      /* 边框宽度 */
          border-style: solid;     /* 边框样式 */
          border-color: #333;      /* 边框颜色 */
     /* 文字样式 */
     font-size: 14px;
     font-size: 30rpx;
     color: #333;
     text-align: center;
     
     width: 300rpx;
     width: 350rpx;
     
     /* 确保内容不换行时居中 */
     display: flex;
@@ -1520,6 +1757,7 @@
     0% {
       transform: scale(1);
       box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
      border-color: #0000ff;      /* 边框颜色 */
     }
     50% {
       transform: scale(0.95);