chenhaozhe
2026-03-07 3fe05aa9c7396a8dadcd94a00dec6610bbf53c25
pages/ZLGL/shoujianjianyan/firstCheckBill.vue
@@ -27,7 +27,7 @@
                            </uni-datetime-picker>
                        </view>
                    </view>
<view class="form-item">
                    <view class="form-item">
                        <view class="left">源单单号</view>
                        <view class="right" :class="!hasSourceBill?'':'disabled'">
                            <input type="text" :disabled="hasSourceBill" placeholder="请输入或扫描源单号"
@@ -38,22 +38,21 @@
                                :class="!hasSourceBill?'enable-icon-button':'disable-icon-button'"
                                :disabled="hasSourceBill" size="20" @click="toScanCode"></uni-icons>
                        </view>
                  <view class="icon-wrapper-big">
                      <uni-icons class="right-icon" type="search"
                          :class="!hasSourceBill?'enable-icon-button':'disable-icon-button'"
                          :disabled="hasSourceBill" size="20" @click="toBillSelector"></uni-icons>
                  </view>
                        <view class="icon-wrapper-big">
                            <uni-icons class="right-icon" type="search"
                                :class="!hasSourceBill?'enable-icon-button':'disable-icon-button'"
                                :disabled="hasSourceBill" size="20" @click="toBillSelector"></uni-icons>
                        </view>
                    </view>
                    <view class="form-item">
                        <view class="left">任务单号</view>
                        <view class="right disabled">
                            <input type="text" :value="hform.HICMOBillNo" disabled />
                        </view>
                        <view class="icon-wrapper-big"><uni-icons type="search" size="20"
                     :class="!hasSourceBill?'enable-icon-button':'disable-icon-button'"
                     :disabled="hasSourceBill"
                                @click="showSelectorModule(hform, 5)"></uni-icons></view>
                                :class="!hasSourceBill?'enable-icon-button':'disable-icon-button'"
                                :disabled="hasSourceBill" @click="showSelectorModule(hform, 5)"></uni-icons></view>
                    </view>
                    <view class="form-item">
                        <view class="left">流转卡号</view>
@@ -62,7 +61,14 @@
                        </view>
                        <view class="icon-wrapper-big"><uni-icons type="search" size="20"
                                :class="!hasSourceBill?'enable-icon-button':'disable-icon-button'"
                                :disabled="hasSourceBill"@click="showSelectorModule(hform, 6)"></uni-icons></view>
                                :disabled="hasSourceBill" @click="showSelectorModule(hform, 6)"></uni-icons></view>
                    </view>
                    <view class="form-item">
                        <view class="left">取样单号</view>
                        <view class="right disabled">
                            <input type="text" disabled :value="hform.HTakeSampleCheckBillNo" />
                            <input type="text" style="display: none;" disabled :value="hform.HTakeSampleCheckBillID" />
                        </view>
                    </view>
                    <view class="form-item">
                        <view class="left">产品代码</view>
@@ -70,7 +76,8 @@
                            <input type="text" disabled :value="hform.HMaterNumber" />
                        </view>
                        <view class="icon-wrapper-big">
                            <uni-icons type="search" size="20":class="!hasSourceBill?'enable-icon-button':'disable-icon-button'"
                            <uni-icons type="search" size="20"
                                :class="!hasSourceBill?'enable-icon-button':'disable-icon-button'"
                                :disabled="hasSourceBill" @click="showSelectorModule(hform, 4)"></uni-icons>
                        </view>
                    </view>
@@ -80,14 +87,14 @@
                            <input type="text" disabled :value="hform.HMaterName" />
                        </view>
                    </view>
               <view class="form-item">
                   <view class="left">检验数量</view>
                   <view class="right">
                       <input type="number" v-model="hform.HCheckQty" />
                   </view>
               </view>
                    <view class="form-item">
                        <view class="left">检验员</view>
                        <view class="left required">检验数量</view>
                        <view class="right">
                            <input type="number" v-model="hform.HCheckQty" />
                        </view>
                    </view>
                    <view class="form-item">
                        <view class="left required">检验员</view>
                        <view class="right">
                            <uni-combox :candidates="GyFirstCheckEmpNameList" placeholder="请选择检验员"
                                v-model="hform.HFirstCheckEmpName"
@@ -102,7 +109,7 @@
                        <view class="icon-wrapper-big"><uni-icons type="search" size="20"
                                @click="showSelectorModule(hform, 7)"></uni-icons></view>
                    </view>
                    <view class="form-item">
                        <view class="left">判断结论</view>
                        <view class="right none-border">
@@ -126,9 +133,9 @@
                        </view>
                        <view class="icon-wrapper-big"><uni-icons type="search" size="20"
                                :class="!hasSourceBill?'enable-icon-button':'disable-icon-button'"
                                :disabled="hasSourceBill"@click="showSelectorModule(hform, 8)"></uni-icons></view>
                                :disabled="hasSourceBill" @click="showSelectorModule(hform, 8)"></uni-icons></view>
                    </view>
                </view>
                <!-- 其他信息 -->
                <view class="bill-main-content" v-if="mainTabSelected == 2">
@@ -156,13 +163,6 @@
                                v-model="hform.HShiftsName" @update:modelValue="HWorkShiftChange"></uni-combox>
                        </view>
                    </view>
                    <!-- <view class="form-item">
                        <view class="left">生产班次</view>
                        <view class="right">
                            <uni-combox :candidates="GyWorkShiftNameList" placeholder="请选择生产班次"
                                v-model="hform.HShiftsName" @update:modelValue="HWorkShiftChange"></uni-combox>
                        </view>
                    </view> -->
                    <view class="form-item">
                        <view class="left">异常临时处理方案</view>
                        <view class="right">
@@ -327,10 +327,11 @@
                                    <text>单位:</text>{{ checkItem.HUnit }}
                                </view>
                                <!-- 只有定量分析才启用检验值 -->
                                <view class="detail editable" v-show="checkItem.HAnalysisMethod == 2">
                                <view class="detail editable" v-show="checkItem.HAnalysisMethod == 2">
                                    <text>检验值:</text>
                                    <input type="text" class="editable-input" @blur="calcHResult(checkItem)" v-model="checkItem.HInspectValQ" />
                                    <input type="text" class="editable-input" @blur="calcHResult(checkItem)"
                                        v-model="checkItem.HInspectValQ" />
                                </view>
                                <view class="detail" v-if="checkItem.HQCNote">
                                    <text>检验记录:</text>{{ checkItem.HQCNote }}
@@ -444,10 +445,10 @@
        </view>
        <view style="height: 120rpx"></view>
        <view class="bottom-btn">
            <button class="btn-a" size="mini" @tap="submit">提交</button>
            <button class="btn-a" size="mini" @tap.stop="submit">提交</button>
            <view style="flex: 1"></view>
            <button class="btn-a" size="mini" @tap="addNew">新增</button>
            <button class="btn-c" size="mini" @tap="goBack">退出</button>
            <button class="btn-a" size="mini" @tap.stop="addNew">新增</button>
            <button class="btn-c" size="mini" @tap.stop="goBack">退出</button>
        </view>
        <SampleSchemePopupVue v-if="enablePopupModule == PopupModuleNameList[1]" ref="listPopup"
            @update="SampleSchemeComplete" :bindKey="currentChechItemIDCache">
@@ -469,8 +470,15 @@
            :bindKey="0"></ProcessPopupVue>
        <CheckProjectPopupVue v-if="enablePopupModule == PopupModuleNameList[7]" ref="listPopup"
            @update="HQCSchemeComplete" :bindKey="0"></CheckProjectPopupVue>
      <BillListPopupVue ref="billList" :HBillType="hform.HBillType" :HSourceBillType="hform.HSourceBillType"
          :HStockOrgID="hform.HStockOrgID" @BillSelectComplete="HandleBillSelectComplete"></BillListPopupVue>
        <BillListPopupVue ref="billList" :HBillType="hform.HBillType" :HSourceBillType="hform.HSourceBillType"
            :HStockOrgID="hform.HStockOrgID" @BillSelectComplete="HandleBillSelectComplete"></BillListPopupVue>
        <uni-popup ref="popup" background-color="#fff">
            <view class="popup-content">
                <view class="tit">异常类型</view>
                <view class="item" v-for="(item,index) in popList" :key="index" @tap="toAbnm(item)">{{item}}</view>
            </view>
        </uni-popup>
    </view>
</template>
@@ -488,7 +496,7 @@
    import ProcExchBillPopupVue from "../../../components/ZLGL/ProcExchBillPopup.vue";
    import ProcessPopupVue from "../../../components/ZLGL/ProcessPopup.vue";
    import CheckProjectPopupVue from "../../../components/ZLGL/CheckProjectPopup.vue";
   import BillListPopupVue from "../../../components/BillListPopup/BillListPopup.vue";
    import BillListPopupVue from "../../../components/BillListPopup/BillListPopup.vue";
    import {
        getUserInfo
    } from "../../../utils/auth";
@@ -506,7 +514,7 @@
            ProcExchBillPopupVue,
            ProcessPopupVue,
            CheckProjectPopupVue,
         BillListPopupVue,
            BillListPopupVue,
        },
        computed: {
            judgeConclusion: {
@@ -551,6 +559,9 @@
                // 检验员
                GyFirstCheckEmpList: [],
                GyFirstCheckEmpNameList: [],
                // 不良类型
                popList: [],
                badReasonBackTypeList: [],
                // 检验方案
                arrayAnalysisMethod: [{
@@ -581,19 +592,20 @@
                // 源单类型
                HSourceBillType: "工序进站接收单",
                HSourceBillTypeValueList: ["3790", "3793", "3710", "3772"],
                HSourceBillTypeValueList: ["3790", "3793", "3710", "3772", "7521"],
                HSourceBillTypeNameList: [
                    "工序进站接收单",
                    "工序委外接收单",
                    "生产订单",
                    "工序流转卡",
                    "取样单",
                ],
                // 主表属性
                hform: {
               HBillType: '7505',
                    HBillType: '7505',
                    HSourceBillType: "3790",
                    HSourceBillNo: "",
               HSourceBillQty: 0,
                    HSourceBillQty: 0,
                    HBillNo: "",
                    HInterID: "0",
                    HDate: dayjs(new Date()).format("YYYY-MM-DD"),
@@ -636,9 +648,9 @@
                    HDeleteDate: "",
                    HResult: 1,
                    HAnalysisMethod: "",
               HCheckQty: 0,
                    HCheckQty: 0,
                    HResDec: "",
                    HStatus: 1,
@@ -646,8 +658,8 @@
                    HMainSourceInterID: "0",
                    HMainSourceEntryID: "1",
                    HMainSourceBillNo: "",
               HStockOrgID: uni.getStorageSync('OrganizationID'),
                    HStockOrgID: uni.getStorageSync('OrganizationID'),
                },
                // 检验项目和抽样检验 值
                checkItems: {},
@@ -659,49 +671,49 @@
        },
        methods: {
            // 检验值 计算是否合格
            calcHResult(item){
            calcHResult(item) {
                // 非抽检条件下判断结论
                console.log('item: ',item);
                if(!item.HSampleSchemeID) {
                console.log('item: ', item);
                if (!item.HSampleSchemeID) {
                    return
                }
                if(item.HInspectValQ >= item.HDownLimit && item.HInspectValQ <= item.HUpLimit){
                if (item.HInspectValQ >= item.HDownLimit && item.HInspectValQ <= item.HUpLimit) {
                    this.checkItems[item.num].HResult = 1
                    return
                }
                this.checkItems[item.num].HResult = 2
            },
         // 读取缓存
         loadCache() {
             const pages = getCurrentPages()
             // 获取页面栈中的最后一个元素,也就是当前显示的页面
             const currentPage = pages[pages.length - 1]
             let HBillTypeCache = uni.getStorageSync(`${currentPage.route.split("/").pop()}_HSourceBillTypeCache`)
             if (HBillTypeCache) {
                 this.HSourceBillType = HBillTypeCache.HSourceBillTypeName
                 this.hform.HSourceBillType = HBillTypeCache.HSourceBillType
                 this.hform.HMainSourceBillType = HBillTypeCache.HSourceBillType
             }
         },
            // 读取缓存
            loadCache() {
                const pages = getCurrentPages()
                // 获取页面栈中的最后一个元素,也就是当前显示的页面
                const currentPage = pages[pages.length - 1]
                let HBillTypeCache = uni.getStorageSync(`${currentPage.route.split("/").pop()}_HSourceBillTypeCache`)
                if (HBillTypeCache) {
                    this.HSourceBillType = HBillTypeCache.HSourceBillTypeName
                    this.hform.HSourceBillType = HBillTypeCache.HSourceBillType
                    this.hform.HMainSourceBillType = HBillTypeCache.HSourceBillType
                }
            },
            // 源单类型选择
            HSourceBillTypeNameChange(e) {
                this.HSourceBillType = this.HSourceBillTypeNameList[e.detail.value];
                this.hform.HSourceBillType = this.HSourceBillTypeValueList[e.detail.value];
            const pages = getCurrentPages()
            // 获取页面栈中的最后一个元素,也就是当前显示的页面
            const currentPage = pages[pages.length - 1]
            // 选择源单类型后 缓存当前页面选择
            uni.setStorageSync(`${currentPage.route.split("/").pop()}_HSourceBillTypeCache`, {
                HSourceBillTypeName: this.HSourceBillType,
                HSourceBillType: this.hform.HSourceBillType
            })
                const pages = getCurrentPages()
                // 获取页面栈中的最后一个元素,也就是当前显示的页面
                const currentPage = pages[pages.length - 1]
                // 选择源单类型后 缓存当前页面选择
                uni.setStorageSync(`${currentPage.route.split("/").pop()}_HSourceBillTypeCache`, {
                    HSourceBillTypeName: this.HSourceBillType,
                    HSourceBillType: this.hform.HSourceBillType
                })
            },
         // 根据源单类型选择单据
         toBillSelector() {
             this.$refs['billList'].showPopup()
         },
            // 根据源单类型选择单据
            toBillSelector() {
                this.$refs['billList'].showPopup()
            },
            toScanCode() {
                MpaasScan.scanCode((res) => {
                    if (res) {
@@ -720,10 +732,10 @@
                        HInterID: 0,
                        HEntryID: 0,
                        Mode: 1, //扫码模式
                  user:getUserInfo()["Czymc"]
                        user: getUserInfo()["Czymc"]
                    }
                })
                console.log(res)
                let {
                    data,
@@ -731,30 +743,107 @@
                    count
                } = res.data
                if (count == 1) {
                    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.HMainSourceInterID = data[0].HInterID
                    this.hform.HMainSourceEntryID = data[0].HEntryID
                    this.hform.HQCSchemeName = data[0].检验方案名称
                    this.hform.HQCSchemeID = data[0].检验方案ID
                    this.hform.HSourceBillQty = data[0].HSourceBillQty
                    this.hasSourceBill = true
               this.hform.HICMOBillNo= data[0].任务单号
               this.hform.HICMOInterID= data[0].HICMOInterID
               this.hform.HICMOEntryID= data[0].HICMOEntryID
               this.hform.HICMOQty= data[0].生产数量
               this.hform.HProcExchBillNo= data[0].单据号
               this.hform.HProcExchInterID= data[0].HInterID
               this.hform.HProcExchEntryID= data[0].HEntryID
               this.hform.HProcExchQty= data[0].流转卡数量
               this.hform.HSourceName= data[0].生产资源
               this.hform.HSourceID= data[0].HSourceID
               this.hform.HProcID= data[0].HProcID
               this.hform.HProcName= data[0].当前工序
                    if (this.hform.HSourceBillType == "3772") {
                        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.HMainSourceInterID = data[0].HInterID
                        this.hform.HMainSourceEntryID = data[0].HEntryID
                        this.hform.HQCSchemeName = data[0].检验方案名称
                        this.hform.HQCSchemeID = data[0].检验方案ID
                        this.hform.HSourceBillQty = data[0].HSourceBillQty
                        this.hasSourceBill = true
                        this.hform.HICMOBillNo = data[0].任务单号
                        this.hform.HICMOInterID = data[0].HICMOInterID
                        this.hform.HICMOEntryID = data[0].HICMOEntryID
                        this.hform.HICMOQty = data[0].生产数量
                        this.hform.HProcExchBillNo = data[0].单据号
                        this.hform.HProcExchInterID = data[0].HInterID
                        this.hform.HProcExchEntryID = data[0].HEntryID
                        this.hform.HProcExchQty = data[0].流转卡数量
                        this.hform.HSourceName = data[0].生产资源
                        this.hform.HSourceID = data[0].HSourceID
                        this.hform.HProcID = data[0].HProcID
                        this.hform.HProcName = data[0].当前工序
                    } else if (this.hform.HSourceBillType == "7521") {
                        this.hform.HMaterID = data[0]['HMaterID']
                        this.hform.HMaterName = data[0]['产品名称']
                        this.hform.HMaterNumber = data[0]['产品代码']
                        this.hform.HMainSourceBillNo = data[0].单据号
                        this.hform.HSourceBillNo = data[0].单据号
                        this.hform.HMainSourceInterID = data[0].HInterID
                        this.hform.HMainSourceEntryID = data[0].HEntryID
                        this.hform.HQCSchemeName = data[0].检验方案名称
                        this.hform.HQCSchemeID = data[0].检验方案ID
                        this.hform.HSourceBillQty = data[0].检验数量
                        this.hform.HICMOBillNo = data[0].任务单号
                        this.hform.HICMOInterID = data[0].HICMOInterID
                        this.hform.HICMOEntryID = data[0].HICMOEntryID
                        this.hform.HICMOQty = data[0].生产数量
                        this.hform.HProcExchBillNo = data[0].HProcExchBillNo
                        this.hform.HProcExchInterID = data[0].HProcExchInterID
                        this.hform.HProcExchEntryID = data[0].HProcExchEntryID
                        this.hform.HProcExchQty = data[0].流转卡数量
                        this.hform.HSourceName = data[0].生产资源
                        this.hform.HSourceID = data[0].HSourceID
                        this.hform.HTakeSampleCheckBillNo = data[0].单据号
                        this.hform.HTakeSampleCheckBillID = data[0].HInterID
                        this.hform.HProcID = data[0].HProcID
                        this.hform.HProcName = data[0].工序名称
                        this.hform.HCheckQty = data[0].检验数量
                    } else if (this.hform.HSourceBillType == "3790") {
                        this.hform.HMaterID = data[0]['HMaterID']
                        this.hform.HMaterName = data[0]['产品名称']
                        this.hform.HMaterNumber = data[0]['产品代码']
                        this.hform.HMainSourceBillNo = data[0].单据号
                        this.hform.HSourceBillNo = data[0].单据号
                        this.hform.HMainSourceInterID = data[0].HInterID
                        this.hform.HMainSourceEntryID = data[0].HEntryID
                        this.hform.HQCSchemeName = data[0].检验方案名称
                        this.hform.HQCSchemeID = data[0].检验方案ID
                        this.hform.HSourceBillQty = data[0].检验数量
                        this.hform.HICMOBillNo = data[0].任务单号
                        this.hform.HICMOInterID = data[0].HICMOInterID
                        this.hform.HICMOEntryID = data[0].HICMOEntryID
                        this.hform.HICMOQty = data[0].生产数量
                        this.hform.HCheckQty = data[0].进站数量
                        this.hform.HProcExchBillNo = data[0].HProcExchBillNo
                        this.hform.HProcExchInterID = data[0].HProcExchInterID
                        this.hform.HProcExchEntryID = data[0].HProcExchEntryID
                        this.hform.HProcExchQty = data[0].流转卡数量
                        this.hform.HSourceName = data[0].生产资源
                        this.hform.HSourceID = data[0].HSourceID
                        this.hform.HProcID = data[0].HProcID
                        this.hform.HProcName = data[0].当前工序
                        this.hform.HTakeSampleCheckBillNo = data[0].单据号
                        this.hform.HTakeSampleCheckBillID = data[0].HInterID
                    } else {
                        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.HMainSourceInterID = data[0].HInterID
                        this.hform.HMainSourceEntryID = data[0].HEntryID
                        this.hform.HQCSchemeName = data[0].检验方案名称
                        this.hform.HQCSchemeID = data[0].检验方案ID
                        this.hform.HSourceBillQty = data[0].HSourceBillQty
                        this.hasSourceBill = true
                        this.hform.HICMOBillNo = data[0].任务单号
                        this.hform.HICMOInterID = data[0].HICMOInterID
                        this.hform.HICMOEntryID = data[0].HICMOEntryID
                        this.hform.HICMOQty = data[0].生产数量
                        this.hform.HProcExchBillNo = data[0].单据号
                        this.hform.HProcExchInterID = data[0].HInterID
                        this.hform.HProcExchEntryID = data[0].HEntryID
                        this.hform.HProcExchQty = data[0].流转卡数量
                        this.hform.HSourceName = data[0].生产资源
                        this.hform.HSourceID = data[0].HSourceID
                        this.hform.HProcID = data[0].HProcID
                        this.hform.HProcName = data[0].当前工序
                    }
                    this.get_CheckItem();
                } else {
                    CommonUtils.showTips({
@@ -762,80 +851,124 @@
                        message: Message
                    })
                }
                // if (
                //     (uni.getStorageSync("OrganizationID") == "7667152" &&
                //         uni.getStorageSync("Organization") == "CMR Technology Mexico S.A. de C.V.") ||
                //     (uni.getStorageSync("OrganizationID") == "100199" &&
                //         uni.getStorageSync("Organization") == "杭州斯莫尔磁性材料有限公司")
                // ) {
                //     await this.GetCheckItemID(); // 客户为斯莫尔,进入按照质检方案表头上的物料绑定带出默认方案
                // }
            },
         async HandleBillSelectComplete(e) {
             try {
                 let res = await CommonUtils.doRequest2Async({
                     url: "/WEBSController/get_CheckBillBarCode_Json_CheckItem",
                     data: {
                         HBillType: this.hform.HBillType,
                         HSourceBillType: this.hform.HSourceBillType,
                         HBarCode: "",
                         HInterID: e?.HInterID,
                         HEntryID: e?.HEntryID,
                         Mode: 2 ,//选单模式
                     user:getUserInfo()["Czymc"]
                     }
                 })
                 let {
                     data,
                     Message,
                     count
                 } = res.data
                 if (count == 1) {
                     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.HMainSourceInterID = data[0].HInterID
                     this.hform.HMainSourceEntryID = data[0].HEntryID
                     this.hform.HQCSchemeName = data[0].检验方案名称
                     this.hform.HQCSchemeID = data[0].检验方案ID
                     this.hform.HSourceBillQty = data[0].HSourceBillQty
                     this.hform.HICMOBillNo= data[0].任务单号
                     this.hform.HICMOInterID= data[0].HICMOInterID
                     this.hform.HICMOEntryID= data[0].HICMOEntryID
                     this.hform.HICMOQty= data[0].生产数量
                     this.hform.HProcExchBillNo= data[0].单据号
                     this.hform.HProcExchInterID= data[0].HInterID
                     this.hform.HProcExchEntryID= data[0].HEntryID
                     this.hform.HProcExchQty= data[0].流转卡数量
                     this.hform.HSourceName= data[0].生产资源
                     this.hform.HSourceID= data[0].HSourceID
                     this.hform.HProcID= data[0].HProcID
                     this.hform.HProcName= data[0].当前工序
                     this.get_CheckItem();
                     this.hasSourceBill = true
                     this.$refs['billList'].exit()
                 } else {
                     CommonUtils.showTips({
                         title: '温馨提示',
                         message: Message
                     })
                 }
             } catch (err) {
                 CommonUtils.showTips({
                     title: '温馨提示',
                     message: "源单下推错误: " + err
                 })
             }
         },
            async HandleBillSelectComplete(e) {
                console.log('e: ', e);
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: "/WEBSController/get_CheckBillBarCode_Json_CheckItem",
                        data: {
                            HBillType: this.hform.HBillType,
                            HSourceBillType: this.hform.HSourceBillType,
                            HBarCode: "",
                            HInterID: e?.HInterID,
                            HEntryID: e?.HEntryID,
                            Mode: 2, //选单模式
                            user: getUserInfo()["Czymc"]
                        }
                    })
                    let {
                        data,
                        Message,
                        count
                    } = res.data
                    if (count == 1) {
                        if (this.hform.HSourceBillType == "3772") {
                            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.HMainSourceInterID = data[0].HInterID
                            this.hform.HMainSourceEntryID = data[0].HEntryID
                            this.hform.HQCSchemeName = data[0].检验方案名称
                            this.hform.HQCSchemeID = data[0].检验方案ID
                            this.hform.HSourceBillQty = data[0].HSourceBillQty
                            this.hform.HICMOBillNo = data[0].任务单号
                            this.hform.HICMOInterID = data[0].HICMOInterID
                            this.hform.HICMOEntryID = data[0].HICMOEntryID
                            this.hform.HICMOQty = data[0].生产数量
                            this.hform.HProcExchBillNo = data[0].单据号
                            this.hform.HProcExchInterID = data[0].HInterID
                            this.hform.HProcExchEntryID = data[0].HEntryID
                            this.hform.HProcExchQty = data[0].流转卡数量
                            this.hform.HSourceName = data[0].生产资源
                            this.hform.HSourceID = data[0].HSourceID
                            this.hform.HProcID = data[0].HProcID
                            this.hform.HProcName = data[0].当前工序
                        } else if (this.hform.HSourceBillType == "7521") {
                            this.hform.HMaterID = data[0]['HMaterID']
                            this.hform.HMaterName = data[0]['产品名称']
                            this.hform.HMaterNumber = data[0]['产品代码']
                            this.hform.HMainSourceBillNo = data[0].单据号
                            this.hform.HSourceBillNo = data[0].单据号
                            this.hform.HMainSourceInterID = data[0].HInterID
                            this.hform.HMainSourceEntryID = data[0].HEntryID
                            this.hform.HQCSchemeName = data[0].检验方案名称
                            this.hform.HQCSchemeID = data[0].检验方案ID
                            this.hform.HSourceBillQty = data[0].检验数量
                            this.hform.HICMOBillNo = data[0].任务单号
                            this.hform.HICMOInterID = data[0].HICMOInterID
                            this.hform.HICMOEntryID = data[0].HICMOEntryID
                            this.hform.HICMOQty = data[0].生产数量
                            this.hform.HProcExchBillNo = data[0].HProcExchBillNo
                            this.hform.HProcExchInterID = data[0].HProcExchInterID
                            this.hform.HProcExchEntryID = data[0].HProcExchEntryID
                            this.hform.HProcExchQty = data[0].流转卡数量
                            this.hform.HSourceName = data[0].生产资源
                            this.hform.HSourceID = data[0].HSourceID
                            this.hform.HProcID = data[0].HProcID
                            this.hform.HProcName = data[0].当前工序
                            this.hform.HTakeSampleCheckBillNo = data[0].单据号
                            this.hform.HTakeSampleCheckBillID = data[0].HInterID
                        } else {
                            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.HMainSourceInterID = data[0].HInterID
                            this.hform.HMainSourceEntryID = data[0].HEntryID
                            this.hform.HQCSchemeName = data[0].检验方案名称
                            this.hform.HQCSchemeID = data[0].检验方案ID
                            this.hform.HSourceBillQty = data[0].HSourceBillQty
                            this.hform.HICMOBillNo = data[0].任务单号
                            this.hform.HICMOInterID = data[0].HICMOInterID
                            this.hform.HICMOEntryID = data[0].HICMOEntryID
                            this.hform.HICMOQty = data[0].生产数量
                            this.hform.HProcExchBillNo = data[0].单据号
                            this.hform.HProcExchInterID = data[0].HInterID
                            this.hform.HProcExchEntryID = data[0].HEntryID
                            this.hform.HProcExchQty = data[0].流转卡数量
                            this.hform.HSourceName = data[0].生产资源
                            this.hform.HSourceID = data[0].HSourceID
                            this.hform.HProcID = data[0].HProcID
                            this.hform.HProcName = data[0].当前工序
                        }
                        console.log('获取源单:', data)
                        this.get_CheckItem();
                        this.hasSourceBill = true
                        this.$refs['billList'].exit()
                    } else {
                        CommonUtils.showTips({
                            title: '温馨提示',
                            message: Message
                        })
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: '温馨提示',
                        message: "源单下推错误: " + err
                    })
                }
            },
            async GetCheckItemID() {
                if (!this.hform.HMaterName && !this.hform.HProcName) {
                    try {
@@ -1082,15 +1215,66 @@
                    });
                }
            },
            async LoadingInformation_TakeSampleCheckBill(linterid) {
                // 取样单
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: "/QC_FirstPieceCheckBill/get_TakeSampleCheckBill",
                        data: {
                            HInterID: linterid,
                            user: getUserInfo()["Czymc"],
                        },
                    });
                    let {
                        count,
                        Message,
                        data
                    } = res.data;
                    if (count != 1) {
                        CommonUtils.showTips({
                            title: "温馨提示",
                            message: `获取取样单 错误: ${Message}`,
                        });
                        return;
                    }
                    this.hform.HProcExchBillNo = data[0].流转卡号;
                    this.hform.HProcExchInterID = data[0].HProcExchInterID;
                    this.hform.HProcExchEntryID = data[0].HProcExchEntryID;
                    this.hform.HProcExchQty = data[0].流转卡数量 || 0;
                    this.hform.HICMOBillNo = data[0].任务单;
                    this.hform.HICMOInterID = data[0].HICMOInterID;
                    this.hform.HICMOQty = data[0].HICMOQty;
                    this.hform.HSourceName = data[0].生产资源;
                    this.hform.HSourceID = data[0].HSourceID;
                    this.hform.HMaterID = data[0].HMaterID;
                    this.hform.HMaterName = data[0].产品名称;
                    this.hform.HMainSourceBillNo = data[0].单据号;
                    this.hform.HMainSourceBillType = data[0].HBillType;
                    this.hform.HMainSourceInterID = data[0].HInterID;
                    this.hform.HICMOEntryID = data[0].HICMOEntryID || 1;
                    this.hform.HQCSchemeName = data[0].检验方案名称;
                    this.hform.HQCSchemeID = data[0].检验方案ID;
                    this.hform.HProcName = data[0].工序名称;
                    this.hform.HCheckQty = data[0].取样数量
                    this.hform.HProcID = data[0].HProcID
                    this.hasSourceBill = true
                    this.get_CheckItem();
                } catch (err) {
                    CommonUtils.showTips({
                        title: "温馨提示",
                        message: `获取取样单 错误: ${err}`,
                    });
                }
            },
            // 检验员初始化
            async InitHEmp() {
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: "/Gy_Employee/list",
                        data: {
                            sWhere: `  and 组织名称 = '${uni.getStorageSync(
              "Organization"
            )}' and 禁用标记 = ''and 审核人 !='' order by 部门代码`,
                            sWhere: `  and 组织名称 = '${uni.getStorageSync("Organization")}' and 禁用标记 = ''and 审核人 !='' and HDeptID = ${uni.getStorageSync("HDeptID")}`,
                            user: getUserInfo()["Czymc"],
                            Organization: uni.getStorageSync("Organization"),
                        },
@@ -1137,9 +1321,7 @@
                    let res = await CommonUtils.doRequest2Async({
                        url: "/Gy_ShiftsController/Get_Gy_WorkShiftList",
                        data: {
                            sWhere: ` and 禁用标记 = '' and ISNULL(审核人,'')  != '' and 使用组织名称 = '${uni.getStorageSync(
              "Organization"
            )}'`,
                            sWhere: ` and 禁用标记 = '' and ISNULL(审核人,'')  != '' and 使用组织名称 = '${uni.getStorageSync("Organization")}'`,
                            HMaker: getUserInfo()["Czymc"],
                        },
                    });
@@ -1168,7 +1350,6 @@
                }
            },
            async HWorkShiftChange(e) {
                console.log("选中班次: ", e);
                let index = this.GyWorkShiftList.findIndex((elem) => elem["班次名称"] == e);
                if (index == -1) {
                    this.hform.HWorkShiftID = 0;
@@ -1179,7 +1360,6 @@
                this.hform.HWorkShiftID = this.GySourceList[index]["HInterID"];
                this.hform.HWorkShiftName = this.GySourceList[index]["班次名称"];
            },
            // 生产资源更新
            // 生产资源初始化
            async InitHSource() {
                try {
@@ -1665,7 +1845,7 @@
                            CheckProjectID: this.hform.HQCSchemeID || 0,
                            HBatchQty: this.hform.HProcExchQty || 0,
                            HMaterID: this.hform.HMaterID,
                            HBillType: '生产入库检方案'
                            HBillType: '首件检方案'
                        },
                    });
@@ -1688,7 +1868,7 @@
                                HUnit: data[i]["单位名称"],
                                HQCNote: "",
                                HAnalysisMethod: data[i]["分析方法"],
                                HResult: data[i]["默认结论"],
                                HResult: data[i]["HResult"],
                                HMax: "",
                                HMin: "",
                                HAvg: "",
@@ -1792,6 +1972,12 @@
                    });
                    return false;
                }
                if (this.hform.HCheckQty == 0) {
                    CommonUtils.showTips({
                        message: "检验数量不得为0!",
                    });
                    return false;
                }
                for (let key in this.checkItems) {
                    if (!this.checkItems[key].HQCCheckItemID) {
@@ -1874,9 +2060,8 @@
                        checkItemsArray.push(checkItem);
                    }
                    console.log('checkItemsArray: ', checkItemsArray);
                    let sMainSub = `${JSON.stringify(this.hform)};${JSON.stringify(
          checkItemsArray
        )};${this.operationType};${getUserInfo()["Czymc"]};${InspectValuesTrans[0]}`;
                    let sMainSub =
                        `${JSON.stringify(this.hform)};${JSON.stringify(checkItemsArray)};${this.operationType};${getUserInfo()["Czymc"]};${InspectValuesTrans[0]}`;
                    console.log("this.checkItems: ", this.checkItems);
                    let res = await CommonUtils.doRequest2Sync({
@@ -1894,26 +2079,53 @@
                    let {
                        count,
                        Message,
                        data
                        data,
                        Verify = 'N'
                    } = res.data;
                    if (count == 1) {
                        // 判断是否自动审核
                        if (Verify == 'Y') {
                            let AuditSuccess = await this.auditBill()
                            if (AuditSuccess) {
                                console.log("审核成功");
                            } else {
                                uni.showToast({
                                    icon: 'none',
                                    title: '审核失败'
                                })
                            }
                        }
                        // 判断 该单据是否为不合格单据,如果为不合格单据,则跳转到异常反馈单
                        if (this.hform.HLastResult == false) {
                            this.$refs.popup.open('center')
                            return
                        }
                        // 根据 提交返回 的是否允许显示提示信息 判断是直接新增单据还是提示信息
                        if(res.data.NotShowTips) {
                            this.addNew()
                            return
                        }
                        uni.showModal({
                            title: "提示",
                            content: res.data.Message + "。是否继续新增?",
                            content: res.data.Message + "。是否返回?",
                            success: (res) => {
                                if (res.confirm) {
                                    console.log("用户点击取消");
                                    setTimeout(() => {
                                        uni.navigateBack();
                                    }, 50)
                                } else if (res.cancel) {
                                    console.log("用户点击确定");
                                    uni.redirectTo({
                                        url: "/pages/ZLGL/shoujianjianyan/form?operationType=1",
                                    });
                                } else if (res.cancel) {
                                    console.log("用户点击取消");
                                    // setTimeout(() => {
                                    //     uni.navigateBack();
                                    // }, 50)
                                }
                            },
                        });
                    } else {
                        CommonUtils.showTips({
                            title: "温馨提示",
@@ -1925,6 +2137,32 @@
                        title: "温馨提示",
                        message: `首件检验单保存错误: ${err}`,
                    });
                }
            },
            toAbnm(item) {
                this.$refs.popup.close()
                uni.redirectTo({
                    url: '/pages/baogong/OA_ErrMsgBackBill?HICMOBillNo=' + this.hform.HICMOBillNo +
                        '&HSourceName=' + this.hform.HSourceName +
                        '&HSourceBillNo=' + this.hform.HSourceBillNo +
                        '&HType=' + item +
                        '&OperationType=4&linterid=&HSouceBillType='
                })
            },
            async auditBill() {
                let res = await CommonUtils.doRequest2Async({
                    url: "/QC_ValueTable/QC_FirstPieceCheckValue",
                    data: {
                        HInterID: this.hform.HInterID,
                        IsAudit: 0,
                        CurUserName: getUserInfo()['Czymc']
                    }
                })
                if (res.data.count == 1) {
                    return true
                } else {
                    return false
                }
            },
            addNew() {
@@ -2088,20 +2326,68 @@
                    });
                }
            },
            async getErrMsgBackType() {
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: '/Gy_BadReason/Gy_ErrMsgBackTypeList',
                        data: {
                            sWhere: ` and  使用组织名称 = '${uni.getStorageSync('Organization')}'`,
                            user: getUserInfo()['Czymc']
                        }
                    })
                    let {
                        data,
                        count,
                        Message
                    } = res.data
                    if (count == 1) {
                        this.popList = Array.from(data).map(item => item['异常反馈类型名称'])
                        this.badReasonBackTypeList = data
                    } else {
                        CommonUtils.showTips({
                            title: '温馨提示',
                            message: `获取异常反馈类型失败: ${Message}`
                        })
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: '温馨提示',
                        message: `获取异常反馈类型失败: ${err}`
                    })
                }
            },
        },
        async onLoad(e) {
            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) {
            } else if (this.operationType == 2) {
                //有源单下推
                await this.getMaxBillNo();
                if (e.HSouceBillType == "7521") {
                    if (uni.getStorageSync('Organization') == "宁波市华舟包装有限公司") {
                        this.HSourceBillType = "取样单"; // 显示名称
                        this.hform.HSourceBillType = "7521"; // 对应的值
                        this.hform.HSourceBillNo = e.HBillNo
                    }
                    this.hform.HTakeSampleCheckBillNo = e.HBillNo;
                    this.hform.HTakeSampleCheckBillID = e.linterid;
                    //取样单查询数据
                    await this.LoadingInformation_TakeSampleCheckBill(e.linterid);
                }
            } else if (this.operationType == 3) {
                this.hform.HInterID = e.linterid || 0;
                await this.RoadBillMain();
            }
            await this.InitHSource();
            await this.InitHWorkShift();
            await this.InitHEmp();
         await this.loadCache();
            await this.loadCache();
            await this.getErrMsgBackType()
        },
    };
</script>
@@ -2236,7 +2522,7 @@
        }
        .btn-c {
            background-color: #acacac;
            background-color: #FFA500;
            color: #fff;
            // position: absolute;
            // right: 120rpx;
@@ -2380,18 +2666,49 @@
        background-color: #f0d6e3;
        border: none;
    }
   .enable-icon-button {
       background-color: #3a78ff;
       padding: 6rpx;
       color: #fff;
       border-radius: 100%;
   }
   .disable-icon-button {
       background-color: lightgray;
       padding: 6rpx;
       color: #fff;
       border-radius: 100%;
       pointer-events: none;
   }
    .enable-icon-button {
        background-color: #3a78ff;
        padding: 6rpx;
        color: #fff;
        border-radius: 100%;
    }
    .disable-icon-button {
        background-color: lightgray;
        padding: 6rpx;
        color: #fff;
        border-radius: 100%;
        pointer-events: none;
    }
    .required::after {
        content: "*";
        color: red;
        margin-left: 4px;
        font-weight: bold;
    }
    .popup-content {
        width: 500rpx;
        border-radius: 20rpx;
        text-align: center;
        padding-bottom: 20rpx;
        .tit {
            height: 120rpx;
            line-height: 120rpx;
            font-size: 34rpx;
            color: #222;
            font-weight: bold;
        }
        .item {
            height: 88rpx;
            line-height: 88rpx;
            border-top: 1px solid #eee;
            font-size: 32rpx;
            color: #444;
        }
    }
</style>