chenhaozhe
2025-12-15 1de1ac13f61905480b81735c33030ee9e33c9f61
Merge branch 'Dev' of http://101.37.171.70:10101/r/~jhz/STUWMS into Dev

# Conflicts:
# manifest.json
7个文件已修改
685 ■■■■ 已修改文件
.hbuilderx/launch.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manifest.json 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/MJGL/shangmudan/MouldUpperBill.vue 643 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/MJGL/shangmudan/MouldUpperBillList.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/index.vue 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/login.vue 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/tiaomachaima/tiaomachaima2.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
.hbuilderx/launch.json
@@ -21,11 +21,11 @@
            "type" : "uni-app:app-ios"
        },
        {
            "customPlaygroundType" : "local",
            "customPlaygroundType" : "device",
            "localRepoPath" : "D:/WorkBench/ZY_APP_Dev/STUWMS/unpackage/debug",
            "openVueDevtools" : true,
            "packageName" : "com.shebeiguanli.www",
            "playground" : "custom",
            "playground" : "standard",
            "type" : "uni-app:app-android"
        }
    ]
manifest.json
@@ -2,8 +2,10 @@
    "name" : "智云LMES",
    "appid" : "__UNI__B002F49",
    "description" : "",
    "versionName" : "2.0.35",
    "versionCode" : 235,
    "transformPx" : false,
    /* 5+App特有相关 */
    "app-plus" : {
@@ -61,6 +63,7 @@
            },
            "icons" : {
                "android" : {
                    "hdpi" : "unpackage/res/icons/72x72.png",
                    "xhdpi" : "unpackage/res/icons/96x96.png",
                    "xxhdpi" : "unpackage/res/icons/144x144.png",
@@ -69,17 +72,21 @@
                "ios" : {
                    "appstore" : "unpackage/res/icons/1024x1024.png",
                    "ipad" : {
                        "app" : "unpackage/res/icons/76x76.png",
                        "app@2x" : "unpackage/res/icons/152x152.png",
                        "notification" : "unpackage/res/icons/20x20.png",
                        "notification@2x" : "unpackage/res/icons/40x40.png",
                        "proapp@2x" : "unpackage/res/icons/167x167.png",
                        "settings" : "unpackage/res/icons/29x29.png",
                        "settings@2x" : "unpackage/res/icons/58x58.png",
                        "spotlight" : "unpackage/res/icons/40x40.png",
                        "spotlight@2x" : "unpackage/res/icons/80x80.png"
                    },
                    "iphone" : {
                        "app@2x" : "unpackage/res/icons/120x120.png",
                        "app@3x" : "unpackage/res/icons/180x180.png",
                        "notification@2x" : "unpackage/res/icons/40x40.png",
@@ -162,6 +169,7 @@
        "landscape-secondary",
        //自然方向
        "default"
    ],
    "locale" : "zh-Hans"
}
pages/MJGL/shangmudan/MouldUpperBill.vue
@@ -4,12 +4,20 @@
            <view class="form-item">
                <view class="title">条码</view>
                <view class="right" style="width: 350rpx;">
                    <input v-model="hform.HBarCode" placeholder="请扫描(或输入)条码" @confirm="getCode(hform.HBarCode)" @blur="getCode(hform.HBarCode)"/>
                    <input type="text" :focus="HBarCodeFocus" v-model="hform.HBarCode" placeholder="请扫描(或输入)条码"
                        @confirm="getHBarCodeData(hform.HBarCode)" />
                </view>
                <uni-icons type="scan"
                    style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;"
                    size="20" @click="toScanCode"></uni-icons>
            </view>
            <view class="tabs">
                <view :class="tabs == 0 ? 'on':''" @tap="() => { tabs = 0; reFocusBarCode(); }">单据信息</view>
                <view :class="tabs == 1 ? 'on':''" @tap="() => { tabs = 1; reFocusBarCode(); }">模具信息</view>
            </view>
            <!-- 单据信息 -->
            <view v-if="tabs == 0">
            <view class="form-item">
                <view class="title">单据号:</view>
                <view class="righton">
@@ -27,49 +35,29 @@
            <view class="form-item">
                <view class="title"><text>*</text>使用部门:</view>
                <view class="right">
                    <uni-combox :candidates="arrayHDeptName" placeholder="请选择部门" v-model="hform.HDeptName" @input="HDeptNameChange"></uni-combox>
                        <uni-combox :candidates="arrayHDeptName" placeholder="请选择部门" v-model="hform.HDeptName"
                            @input="HDeptNameChange"></uni-combox>
                </view>
            </view>
            <view class="form-item">
                <view class="title"><text>*</text>操作员:</view>
                <view class="right">
                    <uni-combox :candidates="arrayHEmpName" placeholder="请选择操作员" v-model="hform.HEmpName" @input="HEmpNameChange"></uni-combox>
                        <uni-combox :candidates="arrayHEmpName" placeholder="请选择操作员" v-model="hform.HEmpName"
                            @input="HEmpNameChange"></uni-combox>
                </view>
            </view>
            <view class="form-item">
                <view class="title"><text>*</text>负责人:</view>
                <view class="right">
                    <uni-combox :candidates="arrayHEmpName" placeholder="请选择负责人" v-model="hform.HMangerName" @input="HManagerNameChange"></uni-combox>
                        <uni-combox :candidates="arrayHEmpName" placeholder="请选择负责人" v-model="hform.HMangerName"
                            @input="HManagerNameChange"></uni-combox>
                </view>
            </view>
            <view class="form-item">
                <view class="title">生产资源:</view>
                <view class="right">
                    <uni-combox :candidates="arrayHSourceName" placeholder="请选择生产资源" v-model="hform.HSourceName" @input="HSourceNameChange"></uni-combox>
                </view>
            </view>
            <view class="form-item">
                <view class="title">器具编码:</view>
                <view class="righton">
                    <input name="HMouldNumber" v-model="hform.HMouldNumber" disabled placeholder="请输入器具编码" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">器具名称:</view>
                <view class="righton">
                    <input name="HMouldName" v-model="hform.HMouldName" disabled placeholder="请输入器具名称" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">器具型号:</view>
                <view class="righton">
                    <input name="HMouldModel" v-model="hform.HMouldModel" disabled placeholder="请输入器具型号" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">数量:</view>
                <view class="righton">
                    <input name="HQty" v-model="hform.HQty" disabled placeholder="请输入数量" />
                        <uni-combox :candidates="arrayHSourceName" placeholder="请选择生产资源" v-model="hform.HSourceName"
                            @input="HSourceNameChange"></uni-combox>
                </view>
            </view>
            <view class="form-item">
@@ -78,7 +66,6 @@
                    <input name="HScanDate" disabled v-model="hform.HScanDate" placeholder="请选择" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">生产订单:</view>
                <view class="righton">
@@ -97,6 +84,15 @@
                <view class="right">
                    <textarea name="HRemark" v-model="hform.HRemark" auto-height placeholder="请输入备注"></textarea>
                </view>
                </view>
            </view>
            <!-- 模具信息 -->
            <view v-if="tabs == 1">
                <zb-table id="list-table" :checked-highlight="true" :fit="true"
                    :style="{height: `${listTableHeight}px`}" :columns="columns" :data="listData" :show-header="true"
                    :border="true" :row-key="row => row.index" @toggleRowSelection="handleSelect"
                    @toggleAllSelection="handleSelectAll" @rowClick="onTableRowClickHandler" />
            </view>
            
            <view class="tab_area"></view>
@@ -166,16 +162,24 @@
</template>
<script>
    import getDateTime from '@/utils/getdateTime.js';
    import { getUserInfo } from "@/utils/auth.js";
    import {
        getUserInfo
    } from "@/utils/auth.js";
    export default {
        data() {
            return {
                // 计算列表高度
                bottomBtnTop: 0,
                listTableTop: 0,
                tabs: 0,
                userInfo:getUserInfo(),
                serverUrl: uni.getStorageSync('serverUrl')||'http://47.96.97.237/API',
                linterid:'',
                HBillNo:'',
                btnType:1,//1新增,3修改
                showmore: false,
                HBarCodeFocus: false,
                
                arrayHDeptName:[],//部门
                HDeptNameList:[],
@@ -186,33 +190,79 @@
                
                
                isEdit: false,
                listOption: [], // 列表选项
                listData: [], // 表格数据
                selectedRows: [], // 表格选中的数据
                // 在columns配置中添加操作列
                columns: [ // 表格列配置
                    {
                        type: 'selection',
                        fixed: true,
                        width: 50
                    },
                    {
                        name: 'index',
                        label: '序号',
                        width: 60,
                        hidden: true
                    },
                    {
                        name: 'HMouldID',
                        label: 'HMouldID',
                        width: 100,
                        hidden: true
                    },
                    {
                        name: '器具数量',
                        label: '器具数量',
                        width: 120
                    },
                    {
                        name: '器具编码',
                        label: '器具编码',
                        width: 150
                    },
                    {
                        name: '器具名称',
                        label: '器具名称',
                        width: 120
                    },
                    {
                        name: '器具型号',
                        label: '器具型号',
                        width: 120
                    },
                    {
                        name: '器具条码',
                        label: '器具条码',
                        width: 120
                    }
                ],
                hform:{
                    HInterID:'',
                    HBillNo:'',
                    HDate:getDateTime.dateTimeStr('y-m-d'),
                    HBarCode:'',
                    HDeptName:'',
                    HDeptID:'',
                    HEmpName:'',
                    HEmpID:'',
                    HMangerName:'',
                    HMangerID:'',
                    HDeptName: uni.getStorageSync('HDeptName'),
                    HDeptID: uni.getStorageSync('HDeptID'),
                    HEmpName: uni.getStorageSync('HEmpName'),
                    HEmpID: uni.getStorageSync('HEmpID'),
                    HMangerName: uni.getStorageSync('HEmpName'),
                    HMangerID: uni.getStorageSync('HEmpID'),
                    
                    
                    HSourceName:'',
                    HSourceID:'',
                    HMouldNumber:'',
                    HMouldID:'',
                    HMouldName:'',
                    HMouldModel:'',
                    HQty:'',
                    HSourceID: '0',
                    HQty: '0',
                    HScanDate:getDateTime.dateTimeStr('y-m-d h:i:s'),
                    HMaterID: '0',
                    HICMOBillNo:'',
                    HICMOInterID:'',
                    HICMOEntryID:'',
                    HICMOInterID: '0',
                    HICMOEntryID: '0',
                    HProcExchBillNo:'',
                    HProcExchInterID:'',
                    HProcExchEntryID:'',
                    HProcExchInterID: '0',
                    HProcExchEntryID: '0',
                    HOrgID:uni.getStorageSync('OrganizationID'),
                    
                    HMaker:'',
@@ -231,7 +281,10 @@
            }
        },
        onLoad(e) {
            this.HBarCodeFocus = true
            this.getHDeptList()
            this.getHEmpList()
            this.getHSourceList()
            this.hform.HMaker = uni.getStorageSync('HUserName')
            console.log(e,this.userInfo)
            if(e.linterid){
@@ -239,13 +292,20 @@
                this.linterid = e.linterid
                this.HBillNo = e.HBillNo
                this.getEditData(e.linterid, e.HBillNo)
                this.getMouldDetailData(e.linterid, e.HBillNo);
            }else{
                this.getNewData()
            }
            this.getHDeptList()
            this.getHEmpList()
            this.getHSourceList()
            this.tabs = 0
        },
        // ==================== 计算属性 ====================
        computed: {
            // 计算表格高度
            listTableHeight: {
                get() {
                    return this.bottomBtnTop - this.listTableTop - 10
                }
            }
        },
        methods: {
            //扫码
@@ -261,12 +321,87 @@
                    this.getHBarCodeData(ret.resp_result)
                })
            },
            //光标
            async refreshBarCodeState() {
                this.HBarCodeFocus = false
                await this.$nextTick(() => {
                    this.HBarCodeFocus = true
                    this.hform.HBarCode = ""
                })
            },
            // 添加一个重新聚焦的方法
            reFocusBarCode() {
                this.HBarCodeFocus = false;
                this.$nextTick(() => {
                    this.HBarCodeFocus = true;
                });
            },
            // 表格行点击处理
            onTableRowClickHandler(row, index) {
                if (!this.listData[index].checked) {
                    this.$set(this.listData[index], 'checked', true)
                } else {
                    this.listData[index].checked = !this.listData[index].checked
                }
            },
            // 表格选择处理
            handleSelect(selected, array) {
                this.selectedRows = array
            },
            // 表格全选处理
            handleSelectAll(selected, array) {
                this.selectedRows = array
            },
            // 表格行删除
            deleteSelected() {
                if (this.selectedRows.length === 0) {
                    uni.showToast({
                        title: '请先选择要删除的模具',
                        icon: 'none'
                    })
                    return
                }
                // 显示确认对话框
                uni.showModal({
                    title: '确认删除',
                    content: `确定要删除选中的${this.selectedRows.length}条数据吗?`,
                    success: (res) => {
                        if (res.confirm) {
                            // 获取选中行的HMouldID集合
                            const selectedIds = this.selectedRows.map(row => row.HMouldID)
                            // 过滤掉选中的数据
                            this.listData = this.listData.filter(item =>
                                !selectedIds.includes(item.HMouldID)
                            )
                            // 重新计算序号
                            this.listData.forEach((item, index) => {
                                item.index = index + 1
                            })
                            // 清空选中状态
                            this.selectedRows = []
                            uni.showToast({
                                title: '删除成功',
                                icon: 'success'
                            })
                        }
                    }
                })
            },
            //日期
            HDateChange(e){
                console.log(e.detail.value)
                this.hform.HDate = e.detail.value
            },
            getHBarCodeData(HBarCode) {
                if (uni.getStorageSync('Organization') == "杭州斯莫尔磁性材料有限公司") {
                if(!this.hform.HSourceName){
                    uni.showToast({
                        title:'请先选择生产资源',
@@ -274,14 +409,16 @@
                    });
                    return;
                }
                }
                var HBillType = "";
                var barNo = "";
                if (HBarCode.length < 22) {
                    barNo = HBarCode.substr(0, 4);
                    switch (barNo) {
                        case "GXLX":
                    if (HBarCode.substr(0, 4) === "GXLX") {
                        HBillType = "3772";
                            break;
                    } else if (HBarCode.substr(0, 2) === "WP") {
                        HBillType = "3710";
                    } else if (HBarCode.substr(0, 4) === "SCRW") {
                        HBillType = "3710";
                    }
                }
@@ -318,20 +455,106 @@
                                case 1:
                                    this.hform.HSourceID = data.HItemID;
                                    this.hform.HSourceName = data.HName;
                                    this.refreshBarCodeState();
                                break;
                                case 2:
                                    this.hform.HICMOBillNo = data.单据号;
                                    this.hform.HICMOInterID = data.hmainid;
                                    this.hform.HICMOEntryID = data.HEntryID;
                                    this.hform.HMaterID = data.HMaterID;
                                    this.refreshBarCodeState();
                                    if (uni.getStorageSync('OrganizationID') == "100007" && uni.getStorageSync(
                                            'Organization') == "事业一处") {
                                        //获取器具清单
                                        this.GetMaterialMouldList();
                                    }
                                break;
                                case 3:
                                    this.hform.HMouldID = data.hmainid;
                                    this.hform.HMouldNumber = data.模具编号;
                                    this.hform.HMouldName = data.模具名称;
                                    this.hform.HMouldModel = data.模具型号;
                                    this.hform.HQty = 1;
                                    if (!this.hform.HICMOBillNo && !this.hform.HProcExchBillNo) {
                                        uni.showToast({
                                            title: '请先扫描生产工单',
                                            icon: 'none'
                                        });
                                        return;
                                    }
                                    // 先调用模具档案检查,校验通过后才添加数据
                                    this.getMould_FC().then(isValid => {
                                        if (isValid) {
                                            this.tabs = 1;
                                            // 检查模具是否已存在于表格中
                                            const existingIndex = this.listData.findIndex(item =>
                                                item.HMouldID === data.hmainid
                                            );
                                            if (uni.getStorageSync('OrganizationID') == "100007" && uni
                                                .getStorageSync('Organization') == "事业一处") {
                                                if (existingIndex === -1) {
                                                    // 如果不存在,添加到表格
                                                    uni.showToast({
                                                        title: '当前检具不在当前物料的检具清单中',
                                                        icon: 'none',
                                                        duration: 1500
                                                    });
                                                    this.refreshBarCodeState();
                                                } else {
                                                    // 如果已存在,检查器具数量
                                                    if (this.listData[existingIndex].器具数量 === 0) {
                                                        // 器具数量为0,更新条码并将数量变为1
                                                        this.listData[existingIndex].器具条码 = this.hform
                                                            .HBarCode;
                                                        this.listData[existingIndex].器具数量 = 1;
                                                        uni.showToast({
                                                            title: '扫描成功',
                                                            icon: 'success',
                                                            duration: 1500
                                                        });
                                                        this.refreshBarCodeState();
                                                    } else {
                                                        // 器具数量已为1,提示不允许重复扫描
                                                        uni.showToast({
                                                            title: '该模具已扫描,不允许重复扫描',
                                                            icon: 'none',
                                                            duration: 1500
                                                        });
                                                        this.refreshBarCodeState();
                                                    }
                                                }
                                            } else {
                                                if (existingIndex === -1) {
                                                    // 如果不存在,添加到表格
                                                    const newRow = {
                                                        index: this.listData.length + 1,
                                                        HMouldID: data.hmainid,
                                                        器具编码: data.模具编号,
                                                        器具名称: data.模具名称,
                                                        器具型号: data.模具型号,
                                                        器具条码: this.hform.HBarCode,
                                                        器具数量: 1,
                                                        checked: false // 默认不选中
                                                    };
                                                    this.listData.push(newRow);
                                                    this.refreshBarCodeState();
                                                } else {
                                                    // 如果已存在,提示用户
                                                    uni.showToast({
                                                        title: '该模具已扫描',
                                                        icon: 'none',
                                                        duration: 1500
                                                    });
                                                    this.refreshBarCodeState();
                                                }
                                            }
                                        } else {
                                            // 校验不通过,清空条码但不添加数据
                                            this.refreshBarCodeState();
                                        }
                                    }).catch(error => {
                                        console.log('校验失败:', error);
                                        this.refreshBarCodeState();
                                    });
                                break;
                                case 4:
@@ -341,6 +564,13 @@
                                    this.hform.HICMOBillNo = data.任务单号;
                                    this.hform.HICMOInterID = data.hicmointerid;
                                    this.hform.HICMOEntryID = data.HICMOEntryID;
                                    this.hform.HMaterID = data.HMaterID;
                                    this.refreshBarCodeState();
                                    if (uni.getStorageSync('OrganizationID') == "100007" && uni.getStorageSync(
                                            'Organization') == "事业一处") {
                                        //获取器具清单
                                        this.GetMaterialMouldList();
                                    }
                                break;
                                default:
                                    uni.showToast({
@@ -349,6 +579,7 @@
                                    });
                                break;
                            }
                        } else {
                            uni.showToast({
                                title: res.data.Message,
@@ -369,7 +600,10 @@
            getHDeptList(){
                uni.request({
                    url: this.serverUrl + '/PublicPageMethod/DeptList', 
                    data: { sWhere: "where HStopFlag=0 and HEndFlag=1 and HUSEORGID = " + uni.getStorageSync('OrganizationID') + "" },
                    data: {
                        sWhere: "where HStopFlag=0 and HEndFlag=1 and HUSEORGID = " + uni.getStorageSync(
                            'OrganizationID') + ""
                    },
                    success: (res) => {
                        if(res.data.count == 1){
                            this.HDeptNameList = res.data.data
@@ -405,7 +639,10 @@
            getHEmpList(){
                uni.request({
                    url: this.serverUrl + '/Web/GetEmployeeList_Json', 
                    data: { Employee: '',HGroupID:0 },
                    data: {
                        Employee: '',
                        HGroupID: 0
                    },
                    success: (res) => {
                        if(res.data.count == 1){
                            this.HEmpNameList = res.data.data
@@ -449,7 +686,9 @@
            getHSourceList(){
                uni.request({
                    url: this.serverUrl + '/api/newBill/getSourceList', 
                    data: { sWhere: '' },
                    data: {
                        sWhere: " and HUSEORGID = " + uni.getStorageSync('OrganizationID') + ""
                    },
                    success: (res) => {
                        if(res.data.code == 1){
                            this.HSourceNameList = res.data.data.Gy_Source
@@ -491,7 +730,10 @@
                var sWhere = " and hmainid='" + linterid + "'";
                uni.request({
                    url: this.serverUrl + '/Sc_MouldUpperBill/Sc_MouldUpperBillList', 
                    data: { sWhere: sWhere,user: uni.getStorageSync('HUserName') },
                    data: {
                        sWhere: sWhere,
                        user: uni.getStorageSync('HUserName')
                    },
                    success: (res) => {
                        console.log(1,res.data.data[0]);
                        if(res.data.code == 1){
@@ -511,10 +753,6 @@
                            
                            this.hform.HSourceID=data.HSourceID,
                            this.hform.HSourceName=data.生产资源,                            
                            this.hform.HMouldID=data.HMouldID,
                            this.hform.HMouldNumber=data.模具编码,
                            this.hform.HMouldName=data.模具名称,
                            this.hform.HMouldModel=data.模具规格,
                            this.hform.HQty=data.数量,
                            this.hform.HScanDate=data.上模扫码时间,
                            this.hform.HICMOBillNo=data.HICMOBillNo,
@@ -533,6 +771,7 @@
                            this.hform.HCheckDate= data.审核日期                            
                            this.hform.HDeleteMan= data.作废人
                            this.hform.HDeleteDate= data.作废日期
                        }else{
                            uni.showToast({
                                title:res.data.Message,
@@ -549,11 +788,117 @@
                    },
                });                
            },
            // 编辑获取模具明细的方法
            getMouldDetailData(linterid) {
                var sWhere = " and hmainid='" + linterid + "'";
                uni.request({
                    url: this.serverUrl + '/Sc_MouldUpperBill/Sc_MouldUpperBillList',
                    data: {
                        sWhere: sWhere,
                        user: uni.getStorageSync('HUserName')
                    },
                    success: (res) => {
                        if (res.data.code == 1 && res.data.data && res.data.data.length > 0) {
                            this.listData = [];
                            res.data.data.forEach((item, index) => {
                                this.listData.push({
                                    index: index + 1,
                                    HMouldID: item.HMouldID,
                                    器具编码: item.模具编码 || item.HMouldNumber,
                                    器具名称: item.模具名称 || item.HMouldName,
                                    器具型号: item.模具规格 || item.HMouldModel,
                                    器具条码: item.条形码 || item.HBarCode,
                                    器具数量: item.数量 || item.HBarCode
                                });
                            });
                            this.selectedRows = [...this.listData];
                        }
                    },
                    fail: (res) => {
                        console.log('获取模具明细失败:', res);
                    }
                });
            },
            // 提供工单的物料自动带出对应的产品器具清单
            GetMaterialMouldList() {
                var sWhere = " and HMaterID='" + this.hform.HMaterID + "'";
                uni.request({
                    url: this.serverUrl + '/Sc_MouldUpperBill/GetMaterialMouldList',
                    data: {
                        sWhere: sWhere,
                        user: uni.getStorageSync('HUserName')
                    },
                    success: (res) => {
                        if (res.data.code == 1 && res.data.data && res.data.data.length > 0) {
                            this.listData = [];
                            this.tabs=1;
                            res.data.data.forEach((item, index) => {
                                this.listData.push({
                                    index: index + 1,
                                    HMouldID: item.HMouldID,
                                    器具编码: item.模具编号 || item.HMouldNumber,
                                    器具名称: item.模具名称 || item.HMouldName,
                                    器具型号: item.模具型号 || item.HMouldModel,
                                    器具条码: item.条形码 || item.HBarCode,
                                    器具数量: 0
                                });
                            });
                            this.selectedRows = [...this.listData];
                        } else {
                            uni.showToast({
                                title: res.data.Message,
                                icon: 'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log('获取模具明细失败:', res);
                    }
                });
            },
            // 条码扫描时候判断是否是存在模具档案 并且是否存在产品器具清单
            getMould_FC() {
                return new Promise((resolve, reject) => {
                    uni.request({
                        url: this.serverUrl + '/Sc_MouldUpperBill/GetBarCode_FC',
                        data: {
                            HBarCode: this.hform.HBarCode,
                            HMaterID: this.hform.HMaterID
                        },
                        success: (res) => {
                            if (res.data.code == 1) {
                                // 校验通过
                                resolve(true);
                            } else {
                                // 校验不通过,显示错误信息
                                uni.showToast({
                                    title: res.data.Message || '模具档案校验失败',
                                    icon: 'none'
                                });
                                resolve(false);
                            }
                        },
                        fail: (res) => {
                            console.log('获取模具条码失败:', res);
                            uni.showToast({
                                title: '校验失败,请检查网络',
                                icon: 'none'
                            });
                            resolve(false);
                        }
                    });
                });
            },
            //新增
            getNewData(){
                uni.request({
                    url: this.serverUrl + '/Web/GetMAXNum', 
                    data: { HBillType: '3846' },
                    data: {
                        HBillType: '3846'
                    },
                    success: (res) => {
                        console.log(res.data)
                        if(res.data.count == 1){
@@ -578,22 +923,42 @@
                });
            },
            submit() {
                if(!this.hform.HBarCode){
                if (uni.getStorageSync('Organization') == "杭州斯莫尔磁性材料有限公司") {
                    if (!this.hform.HSourceName) {
                    uni.showToast({
                        title:'请扫描模具条形码',
                            title: '请先选择生产资源',
                            icon: 'none'
                        });
                        return;
                    }
                }
                if (this.listData.length === 0) {
                    uni.showToast({
                        title: '请至少添加一个模具',
                        icon:'none'
                    })
                }else if(!this.hform.HSourceName){
                }
                // 如果是事业一处组织,校验器具数量
                if (uni.getStorageSync('OrganizationID') === "100007" && uni.getStorageSync('Organization') === "事业一处") {
                    const zeroQtyItem = this.listData.find(item => {
                      // 考虑0、null、undefined等异常情况
                      const qty = Number(item.器具数量) || 0;
                      return qty <= 0;
                    });
                    if (zeroQtyItem) {
                      // 找到第一个数量异常项的位置(索引+1)
                      const index = this.listData.indexOf(zeroQtyItem) + 1;
                      const code = zeroQtyItem.器具编码 || '未知编码';
                    uni.showToast({
                        title:'请选择生产资源',
                        icon:'none'
                    })
                }else if(!this.hform.HMouldName){
                    uni.showToast({
                        title:'模具不能为空',
                        icon:'none'
                    })
                }else if(!this.hform.HEmpName){
                        title: `第${index}行【${code}】器具数量为0,请检查`,
                        icon: 'none',
                        duration: 3000
                      });
                      return;
                    }
                }
                if (!this.hform.HEmpName) {
                    uni.showToast({
                        title:'请选择操作员',
                        icon:'none'
@@ -603,29 +968,93 @@
                        title:'请选择负责人',
                        icon:'none'
                    })
                } else if (!this.hform.HDeptName) {
                    uni.showToast({
                        title: '请选择部门',
                        icon: 'none'
                    })
                }else{
                    uni.showLoading({
                        title:'请稍候'
                    })
                    var sMainStr = JSON.stringify(this.hform);
                    var sMainSub = sMainStr + ";" + uni.getStorageSync('HUserName')+";"+this.btnType;
                    console.log(sMainSub);
                    // ========== 第一步:构建主表数据 ==========
                    const mainData = {
                        HBillNo: this.hform.HBillNo,
                        HInterID: this.hform.HInterID,
                        HDate: this.hform.HDate,
                        // 扫码信息
                        HBarCode: this.hform.HBarCode,
                        // 部门信息
                        HDeptName: this.hform.HDeptName,
                        HDeptID: this.hform.HDeptID,
                        // 人员信息
                        HEmpName: this.hform.HEmpName,
                        HEmpID: this.hform.HEmpID,
                        HMangerName: this.hform.HMangerName,
                        HMangerID: this.hform.HMangerID,
                        // 其他信息
                        HRemark: this.hform.HRemark || "",
                        HOrgID: this.hform.HOrgID,
                        // 系统字段
                        HMaker: this.hform.HMaker || uni.getStorageSync('HUserName'),
                        hupdater: this.hform.HUpDater || uni.getStorageSync('HUserName'),
                        hchecker: this.hform.HChecker || "",
                        HMakeDate: this.hform.HMakeDate || getDateTime.dateTimeStr('y-m-d'),
                        hupdatedate: this.hform.HUpDateDate || getDateTime.dateTimeStr('y-m-d'),
                        hcheckdate: this.hform.HCheckDate || "",
                        hdeleteman: this.hform.HDeleteMan || "",
                        hdeletedate: this.hform.HDeleteDate || "",
                    };
                    // ========== 第二步:构建明细数据 ==========
                    const detailData = this.listData.map((item, index) => ({
                        HMouldID: item.HMouldID,
                        HMouldNumber: item.器具编码,
                        HMouldName: item.器具名称,
                        HMouldModel: item.器具型号,
                        HBarCode: item.器具条码,
                        HQty: 1, // 每个模具数量默认为1
                        // 从hform中复用的生产信息
                        HSourceID: this.hform.HSourceID,
                        HSourceName: this.hform.HSourceName,
                        HICMOInterID: this.hform.HICMOInterID || "0",
                        HICMOEntryID: this.hform.HICMOEntryID || "0",
                        HICMOBillNo: this.hform.HICMOBillNo || "",
                        LAY_TABLE_INDEX: index // 从0开始的索引
                    }));
                    // ========== 第三步:拼接完整数据 ==========
                    const submitStr = JSON.stringify(mainData) + ";" + JSON.stringify(detailData) + ";" + this.btnType +
                        ";" + uni.getStorageSync('HUserName');
                    console.log(submitStr);
                    uni.request({
                        url: this.serverUrl + '/Sc_MouldUpperBill/AddSc_MouldUpperBill_PDA',
                        url: this.serverUrl + '/Sc_MouldUpperBill/AddSc_MouldUpperBill_APP',
                        method:'POST',
                        dataType:"json",
                        data:{ oMain: sMainSub },
                        data: {
                            sMainSub: submitStr
                        },
                        success: (res) => {
                            console.log(1,res);
                            uni.hideLoading()
                            if(res.data.count == 1){
                                let pages = getCurrentPages();
                                let prePage = pages[pages.length - 2]; 
                                prePage.$vm.getList()
                                if(this.isEdit){
                                    setTimeout(()=>{
                                        uni.redirectTo({
                                            url:'/pages/weiwaigxIn/Cj_StationEntrustInBill?linterid=' + this.linterid + '&HBillNo=' + this.linterid
                                            url: '/pages/shangmudan/MouldUpperBill?linterid=' +
                                                this.linterid + '&HBillNo=' + this.HBillNo
                                        })
                                    },1000)
                                }else{
@@ -673,10 +1102,12 @@
        margin: 20rpx auto;
        padding-bottom: 240rpx;
    }
    .tab_area{
        width: 100%;
        height: 50rpx;
    }
    .other{
        margin-top: 8rpx;
        text-align: center;
@@ -684,34 +1115,41 @@
        padding: 4rpx 18rpx;
        color: #1890FF;
    }
    .form-item{
        display: flex;
        align-items: center;
        font-size: 30rpx;
        padding: 6rpx 0;
        .title{
            width: 208rpx;
            text{
                color: red;
                font-weight: bold;
            }
        }
        .right{
            width: 450rpx;
            border-radius: 22rpx;
            border: 1px solid #acacac;
        }
        .righton{
            width: 450rpx;
            border-radius: 22rpx;
            border: 1px solid #e4e4e4;
            background-color: #e4e4e4;
        }
        input{
            width: 100%;
            padding: 8rpx 20rpx;
            font-size: 30rpx;
        }
        textarea{
            width: 98%;
            padding: 8rpx 20rpx;
@@ -719,6 +1157,7 @@
        }
    }
    .bottom-btn{
        width: 100%;
        // height: 120rpx;
@@ -728,6 +1167,7 @@
        background-color: #fff;
        box-shadow: 0 2rpx 10rpx 2rpx rgba(0, 0, 0, 0.4);
        padding: 30rpx 40rpx 40rpx 40rpx;
        button{
            border-radius: 50rpx;
            width: 180rpx;
@@ -735,23 +1175,48 @@
            line-height: 66rpx;
            font-size: 28rpx;
        }
        .btn-a{
            background-color: #3A78FF;
            color: #fff;
        }
        .btn-b{
            background-color: #41a863;
            color: #fff;
        }
        .btn-c{
            background-color: #acacac;
            color: #fff;
            position: absolute;
            right: 120rpx;
        }
        .btn-d{
            background-color: #ff8901;
            color: #fff;
        }
    }
    .tabs {
        width: 100%;
        display: flex;
        border-bottom: 1px solid #ddd;
        margin: 20rpx 0;
        view {
            width: 25%;
            font-size: 30rpx;
            color: #555;
            text-align: center;
            padding: 16rpx 0;
        }
        .on {
            color: #3a78ff;
            font-weight: bold;
            border-bottom: 3px solid #3a78ff;
        }
    }
</style>
pages/MJGL/shangmudan/MouldUpperBillList.vue
@@ -281,11 +281,11 @@
                        this.sWhere += " and 关闭人<>''";
                    }
                }
                if (this.hform.BenginHCreateDate) {
                    this.sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + this.hform.BenginHCreateDate + "'";
                if (this.hform.HBeginDate) {
                    this.sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + this.hform.HBeginDate + "'";
                }
                if (this.hform.EndHCreateDate) {
                    this.sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + this.hform.EndHCreateDate + "'";
                if (this.hform.HEndDate) {
                    this.sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + this.hform.HEndDate + "'";
                }
                if (this.hform.HBillNo) {
                    this.sWhere += " and 单据号 like '%" + this.hform.HBillNo + "%'";
pages/index/index.vue
@@ -307,6 +307,13 @@
                        id: 35,
                        hidden: false,
                    },
                    {
                        img: '../../static/icon/icon8.png',
                        text: '上模单',
                        url: `/pages/MJGL/shangmudan/MouldUpperBill`,
                        id: 35,
                        hidden: false,
                    },
                ],
                // itemData: [{
                //         img: '../../static/icon/icon1.png',
pages/index/login.vue
@@ -298,6 +298,19 @@
                                uni.setStorageSync('login', "login");
                                uni.setStorageSync('Organization', this.Organization);
                                uni.setStorageSync('OrganizationID', this.HOrgName);
                                //存储部门 职员 仓库 等信息
                                uni.setStorageSync('HDeptID', res.data.data[0].HDeptID); //部门
                                uni.setStorageSync('HDeptName', res.data.data[0].HDeptName);
                                uni.setStorageSync('HEmpID', res.data.data[0].HEmpID); //职员
                                uni.setStorageSync('HEmpName', res.data.data[0].HEmpName);
                                uni.setStorageSync('HSCWHID', res.data.data[0].HSCWHID); //调入仓库
                                uni.setStorageSync('HSCWHName', res.data.data[0].HSCWHName);
                                uni.setStorageSync('HWhID', res.data.data[0].HWhID);//对应仓库
                                uni.setStorageSync('HWhName', res.data.data[0].HWhName);
                                uni.setStorageSync('HWorkCenterID', res.data.data[0].HWorkCenterID);//工作中心
                                uni.setStorageSync('HWorkCenterName', res.data.data[0].HWorkCenterName);
                                uni.setStorageSync('HSecManagerID', res.data.data[0].HSecManagerID); //对应验收
                                uni.setStorageSync('HSecManagerName', res.data.data[0].HSecManagerName);
                                this.CommonUtils.setServerUrl(this.serverUrl)
                                uni.reLaunch({
                                    url: '/pages/index/index'
pages/tiaomachaima/tiaomachaima2.vue
@@ -472,7 +472,7 @@
                    const item = printData;
                    // 凯贝奈特打印模板
                    this.printInfo = `! 0 200 200 500 1
                    this.printInfo = `! 0 200 200 400 1
                  PAGE-WIDTH 800
                  SETQRVER 2
                  B QR 450 120 Q 0 U 4