pages/ZLGL/lailiaojianyan/POStockInCheckBill.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="请输入或扫描源单号"
@@ -35,14 +35,20 @@
                        </view>
                        <view class="icon-wrapper-big">
                            <uni-icons class="right-icon" type="scan" style="
                  background-color: #3a78ff;
                  padding: 6rpx;
                  color: #fff;
                  border-radius: 100%;
                " size="20" @click="toScanCode"></uni-icons>
                                background-color: #3a78ff;
                                padding: 6rpx;
                                color: #fff;
                                border-radius: 100%;" size="20" @click="toScanCode"></uni-icons>
                        </view>
                        <view class="icon-wrapper-big">
                            <uni-icons class="right-icon" type="search" style="
                                background-color: #3a78ff;
                                padding: 6rpx;
                                color: #fff;
                                border-radius: 100%;" size="20" @click="toBillSelector"></uni-icons>
                        </view>
                    </view>
                    <view class="form-item">
                        <view class="left">任务单号</view>
                        <view class="right disabled">
@@ -90,7 +96,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">
@@ -115,7 +121,7 @@
                        <view class="icon-wrapper-big"><uni-icons type="search" size="20"
                                @click="showSelectorModule(hform, 8)"></uni-icons></view>
                    </view>
                </view>
                <!-- 其他信息 -->
                <view class="bill-main-content" v-if="mainTabSelected == 2">
@@ -314,10 +320,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 }}
@@ -351,8 +358,58 @@
                        </uni-card>
                    </view>
                </view>
                <!-- 抽样检验 呈现 -->
                <!-- 不良原因 呈现 -->
                <view v-if="subTabSelected == 2">
                    <view class="buttons" @tap="addBadReason()">
                        <uni-icons type="plus" style="margin-right: 10rpx" size="22"></uni-icons>新增
                    </view>
                    <view class="over" v-if="badReasons.length  == 0">暂无数据</view>
                    <view class="list" v-else>
                        <uni-card v-for="(br, index) in badReasons" :key="index">
                            <view class="card-detail">
                                <view class="detail"> <text>序号:</text>{{ index+1 }} </view>
                                <view class="detail" style="min-width: 14em;">
                                    <view style="flex-shrink: 0"><text>不良原因代码:</text></view>
                                    <text>{{ br.HBadReasonNumber }} </text>
                                </view>
                                <view class="detail editable">
                                    <view style="flex-shrink: 0"><text>不良原因:</text></view>
                                    <text>{{ br.HBadReasonName }} </text>
                                    <view class="icon-wrapper"><uni-icons type="search" size="16"
                                            @click="showSelectorModule_BadReason(index, 9)"></uni-icons>
                                    </view>
                                </view>
                                <view class="detail editable">
                                    <view style="flex-shrink: 0"><text>数量:</text></view>
                                    <view class="editable-input">
                                        <input type="number" v-model="br.HQty" />
                                    </view>
                                </view>
                                <view class="detail editable">
                                    <view style="flex-shrink: 0"><text>检验员:</text></view>
                                    <text>{{ br.HCheckMan }} </text>
                                </view>
                                <view class="detail editable">
                                    <view style="flex-shrink: 0"><text>生产班组:</text></view>
                                    <text>{{ br.HGroupName }} </text>
                                </view>
                                <view class="detail editable">
                                    <view style="flex-shrink: 0"><text>生产资源:</text></view>
                                    <text>{{ br.HSourceName }} </text>
                                </view>
                            </view>
                            <view class="more">
                                <view class="part" style="color: #da0000" @tap.stop="delBadReason(br, index)">
                                    <uni-icons type="trash" style="color: #da0000; margin-right: 10rpx"
                                        size="18"></uni-icons>删除
                                </view>
                            </view>
                        </uni-card>
                    </view>
                </view>
                <!-- 抽样检验 呈现 -->
                <view v-if="subTabSelected == 3">
                    <view class="over" v-if="!checkItems || getObjLength(checkItems) == 0">暂无数据</view>
                    <view class="list" v-else>
                        <uni-card v-for="SamplingItem in checkItems" :key="SamplingItem.num">
@@ -456,6 +513,10 @@
            :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>
        <BadReasonPopupVue v-if="enablePopupModule == PopupModuleNameList[9]" ref="listPopup"
            @update="HBadReasonComplete"></BadReasonPopupVue>
    </view>
</template>
@@ -479,6 +540,8 @@
    import {
        MpaasScan
    } from "../../../utils/mpaasScan";
    import BillListPopupVue from "../../../components/BillListPopup/BillListPopup.vue";
    import BadReasonPopupVue from "../../../components/ZLGL/BadReasonPopup.vue";
    export default {
        components: {
            InspectValueTemplateVue,
@@ -490,6 +553,8 @@
            ProcExchBillPopupVue,
            ProcessPopupVue,
            CheckProjectPopupVue,
            BillListPopupVue,
            BadReasonPopupVue
        },
        computed: {
            judgeConclusion: {
@@ -500,8 +565,9 @@
        },
        data() {
            return {
                operationType: 1,
                billList: null,
                operationType: 1,
                mainTabSelected: 1,
                subTabSelected: 1,
@@ -520,6 +586,7 @@
                    "ProcExchBill",
                    "QCScheme",
                    "Process",
                    "BadReason"
                ],
                // 当前操作的检验单ID缓存
                currentChechItemIDCache: -1,
@@ -558,22 +625,27 @@
                    },
                    2: {
                        id: "2",
                        name: "不良原因",
                    },
                    3: {
                        id: "3",
                        name: "抽样检验",
                    },
                },
                // 源单类型
                HSourceBillType: "工序进站接收单",
                HSourceBillTypeValueList: ["3790", "3793", "3710", "3772"],
                HSourceBillType: "收料通知单",
                HSourceBillTypeValueList: ["1103", "1102", "1201"],
                HSourceBillTypeNameList: [
                    "工序进站接收单",
                    "工序委外接收单",
                    "生产订单",
                    "工序流转卡",
                    "收料通知单",
                    "采购订单",
                    "采购入库单",
                ],
                // 主表属性
                hform: {
                    HSourceBillType: "3790",
                    HBillType: '7503',
                    HSourceBillType: "1103",
                    HSourceBillNo: "",
                    HBillNo: "",
                    HInterID: "0",
@@ -625,6 +697,8 @@
                    HMainSourceInterID: "0",
                    HMainSourceEntryID: "1",
                    HMainSourceBillNo: "",
                    HStockOrgID: uni.getStorageSync('OrganizationID')
                },
                // 检验项目和抽样检验 值
                checkItems: {},
@@ -632,22 +706,95 @@
                InspectModules: {},
                // 检测值
                InspectValues: {},
                // 不良原因
                badReasons: [],
            };
        },
        methods: {
            // 新增不良原因
            addBadReason() {
                this.badReasons.push({
                    'HBadReasonNumber': 0,
                    'HBadReasonNumber': "",
                    'HBadReasonHName': "",
                    'HCheckMan': this.hform.HFirstCheckEmp,
                    'HQty': 0,
                    'HGroupName': this.hform.HGroupName || "",
                    'HSourceName': this.hform.HSourceName
                })
            },
            delBadReason(badReason, index) {
                console.log('badReason: ', badReason);
                this.badReasons.splice(index, 1)
            },
            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 //选单模式
                        }
                    })
                    console.log(res)
                    let {
                        data,
                        Message,
                        count
                    } = res.data
                    if (count == 1) {
                        this.hform.HMaterID = data[0]['HMaterID']
                        this.hform.HMaterName = data[0]['HMaterName']
                        this.hform.HMaterNumber = data[0]['HMaterNumber']
                        this.hform.HMainSourceBillNo = 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.get_CheckItem();
                        this.$refs['billList'].exit()
                    } else {
                        CommonUtils.showTips({
                            title: '温馨提示',
                            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(); // 客户为斯莫尔,进入按照质检方案表头上的物料绑定带出默认方案
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: '温馨提示',
                        message: "源单下推错误: " + err
                    })
                }
            },
            // 检验值 计算是否合格
            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 = true
                    return
                }
                this.checkItems[item.num].HResult = false
            },
            // 源单类型选择
@@ -662,61 +809,109 @@
                    }
                });
            },
            // 根据源单类型选择单据
            toBillSelector() {
                this.$refs['billList'].showPopup()
            },
            async getSourceBillInfo(HBarCode) {
                console.log('HBarCode: ', HBarCode);
                let res = await CommonUtils.doRequest2Async({
                    url: "/WEBSController/get_CheckBillBarCode_Json_CheckItem",
                    data: {
                        HBillType: this.hform.HBillType,
                        HSourceBillType: this.hform.HSourceBillType,
                        HBarCode: HBarCode,
                        HInterID: 0,
                        HEntryID: 0,
                        Mode: 1 //扫码模式
                    }
                })
                console.log(res)
                let {
                    data,
                    Message,
                    count
                } = res.data
                if (count == 1) {
                    this.hform.HMaterID = data[0]['HMaterID']
                    this.hform.HMaterName = data[0]['HMaterName']
                    this.hform.HMaterNumber = data[0]['HMaterNumber']
                    this.hform.HMainSourceBillNo = 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.get_CheckItem();
                } else {
                    CommonUtils.showTips({
                        title: '温馨提示',
                        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(); // 客户为斯莫尔,进入按照质检方案表头上的物料绑定带出默认方案
                }
                // 根据单据类型,调用不同的下推函数
                if (this.hform.HSourceBillType == 3790) {
                    // 工序进站接收单列表首检
                    await this.LoadingInformation_StationInBill(HBarCode);
                    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(); // 客户为斯莫尔,进入按照质检方案表头上的物料绑定带出默认方案
                    }
                    return;
                }
                if (this.hform.HSourceBillType == 3793) {
                    // 工序委外接收单列表首检
                    await this.LoadingInformation_StationEntrustOutBill(HBarCode);
                    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(); // 客户为斯莫尔,进入按照质检方案表头上的物料绑定带出默认方案
                    }
                    return;
                }
                if (this.hform.HSourceBillType == 3710) {
                    // 生产订单列表首检
                    await this.LoadingInformation_ICMO(HBarCode);
                    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(); // 客户为斯莫尔,进入按照质检方案表头上的物料绑定带出默认方案
                    }
                    return;
                }
                if (this.hform.HSourceBillType == 3772) {
                    // 工序流转卡列表首检
                    await this.LoadingInformation_ProcExchange(HBarCode);
                    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(); // 客户为斯莫尔,进入按照质检方案表头上的物料绑定带出默认方案
                    }
                    return;
                }
                //if (this.hform.HSourceBillType == 3790) {
                //    // 工序进站接收单列表首检
                //    await this.LoadingInformation_StationInBill(HBarCode);
                //    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(); // 客户为斯莫尔,进入按照质检方案表头上的物料绑定带出默认方案
                //    }
                //    return;
                //}
                //if (this.hform.HSourceBillType == 3793) {
                //    // 工序委外接收单列表首检
                //    await this.LoadingInformation_StationEntrustOutBill(HBarCode);
                //    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(); // 客户为斯莫尔,进入按照质检方案表头上的物料绑定带出默认方案
                //    }
                //    return;
                //}
                //if (this.hform.HSourceBillType == 3710) {
                //    // 生产订单列表首检
                //    await this.LoadingInformation_ICMO(HBarCode);
                //    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(); // 客户为斯莫尔,进入按照质检方案表头上的物料绑定带出默认方案
                //    }
                //    return;
                //}
                //if (this.hform.HSourceBillType == 3772) {
                //    // 工序流转卡列表首检
                //    await this.LoadingInformation_ProcExchange(HBarCode);
                //    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(); // 客户为斯莫尔,进入按照质检方案表头上的物料绑定带出默认方案
                //    }
                //    return;
                //}
            },
            async GetCheckItemID() {
                if (!this.hform.HMaterName && !this.hform.HProcName) {
@@ -1125,6 +1320,12 @@
                this.$refs.listPopup.showPopup();
            },
            async showSelectorModule_BadReason(item, index){
                this.enablePopupModule = this.PopupModuleNameList[index];
                console.log("this.$refs: ", this.$refs);
                await this.$nextTick();
                this.$refs.listPopup.showPopup(index);
            },
            getAnalysisMethodDisplay(val) {
                console.log("AnalysisMethod: ", val);
                if (val) {
@@ -1411,6 +1612,10 @@
                    await this.get_QC_TakeSampleCheckBillList();
                }
            },
            // 不良原因回调
            async HBadReasonComplete(e) {
                console.log('e: ',e);
            },
            async get_QC_TakeSampleCheckBillList() {
                // 取样单查询
                let HProcID = this.hform.HProcID;
@@ -1546,6 +1751,8 @@
                        data: {
                            CheckProjectID: this.hform.HQCSchemeID || 0,
                            HBatchQty: this.hform.HProcExchQty || 0,
                            HMaterID: this.hform.HMaterID,
                            HBillType: '来料检方案'
                        },
                    });
@@ -1784,7 +1991,7 @@
                                if (res.confirm) {
                                    console.log("用户点击确定");
                                    uni.redirectTo({
                                        url: "/pages/ZLGL/shoujianjianyan/form?operationType=1",
                                        url: "/pages/ZLGL/lailiaojianyan/POStockInCheckBill?operationType=1",
                                    });
                                } else if (res.cancel) {
                                    console.log("用户点击取消");
@@ -1809,7 +2016,7 @@
            },
            addNew() {
                uni.redirectTo({
                    url: "/pages/ZLGL/shoujianjianyan/firstCheckBill?operationType=1",
                    url: "/pages/ZLGL/lailiaojianyan/POStockInCheckBill?operationType=1",
                });
            },
            goBack() {
@@ -2168,6 +2375,7 @@
            justify-content: space-between;
            align-items: center;
            line-height: 120%;
            padding: 20rpx 10rpx;
            gap: 10rpx 0;
            input {