yusijie
2025-11-12 424e086ae251e26a420ee11521a3aadbc3265e02
小卫过站解绑模块
2个文件已修改
378 ■■■■ 已修改文件
WebTM/views/车间管理/单品过站_小卫/Cj_ProcessItemStationPlatform_UnbindEdit.html 354 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/车间管理/单品过站_小卫/Cj_ProcessItemStationPlatform_UnbindList.html 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/³µ¼ä¹ÜÀí/µ¥Æ·¹ýÕ¾_СÎÀ/Cj_ProcessItemStationPlatform_UnbindEdit.html
@@ -44,7 +44,7 @@
                        </div>
                    </div>
                    <!--右上框架-->
                    <div class="layui-tab layui-tab-card" style="width: 50.5%; height: calc(25vh); float: right;">
                    <div class="layui-tab layui-tab-card" style="width: 50.5%; height: calc(30vh); float: right;">
                        <ul class="layui-tab-title">
                            <li class="layui-this">新流程选择</li>
                        </ul>
@@ -52,25 +52,26 @@
                            <div class="layui-input-block" style="display: inline-block; margin-left:0px;">
                                <label class="layui-form-label" style="padding-left:0px" id="">生产订单号:</label>
                                <input type="text" class="layui-input" name="HICMOBillNo" lay-verify="HICMOBillNo" autocomplete="off" placeholder="请键入后回车" id="HICMOBillNo" style="width: 500px;">
                                <input type="text" class="layui-input" name="HICMOInterID" lay-verify="HICMOInterID" style="display:none;">
                                <input type="text" class="layui-input" name="HICMOEntryID" lay-verify="HICMOEntryID" style="display:none;">
                            </div>
                            <div class="layui-inline-block" style="margin-top:10px;">
                                <label class="layui-form-label">下一工序:</label>
                                <div class="layui-input-inline">
                                    <select name="HProcName" id="HProcName" lay-verify="HProcName">
                                        <option value="工序1" selected>工序1</option>
                                        <option value="工序2">工序2</option>
                                    <select name="HProcID" id="HProcID" lay-verify="HProcID">
                                        <!--动态渲染组织-->
                                    </select>
                                </div>
                            </div>
                            <div class="layui-row" style="margin-top:20px;margin-left:5px;">
                                <button class="layui-btn layui-btn-normal" style="float:left" type="button" lay-submit="" lay-filter="btnExit" id="btnExit">解除包装关系</button>
                                <button class="layui-btn layui-btn-normal" style="float:left" type="button" lay-submit="" lay-filter="btnExit" id="btnExit">拆除物料</button>
                                <button class="layui-btn layui-btn-normal" style="float:left" type="button" lay-submit="" lay-filter="btnDelBarRelation" id="btnDelBarRelation">解除包装关系</button>
                                <button class="layui-btn layui-btn-normal" style="float:left" type="button" lay-submit="" lay-filter="btnDelBind" id="btnDelBind">拆除物料</button>
                            </div>
                        </div>
                    </div>
                    <!--右下框架-->
                    <div class="layui-tab layui-tab-card" style="float: right; width: 50.5%; height: calc(55vh); ">
                    <div class="layui-tab layui-tab-card" style="float: right; width: 50.5%; height: calc(40vh); ">
                        <ul class="layui-tab-title">
                            <li class="layui-this">关键件绑定记录</li>
                        </ul>         
@@ -101,12 +102,21 @@
</html>
<script>
    var params = get_UrlVars();
    if (typeof (params[params[0]]) == "undefined") {
        var OperationType = 1;//操作类型
        var closeType = 2;  //关闭类型
    } else {
        var OperationType = params[params[0]];//操作类型
        var HBarcode_SN = params[params[1]];//重工条码
        var HBarCodeID = params[params[2]];//条码ID
    }
    layui.config({
        base: '../../../layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
        //#region å…¬å…±å˜é‡
        var $ = layui.$
@@ -124,12 +134,8 @@
        var option2 = [];
        //#endregion
        //#region è¿›å…¥é¡µé¢å³åŠ è½½
        var params = get_UrlVars();
        //#region è¿›å…¥é¡µé¢å³åŠ è½½
        set_ClearBill();
        //#endregion
        //#region è§¦å‘事件:包括form.on(){}格式的所有点击事件、选择事件等
@@ -154,91 +160,7 @@
                    break;
            };
        });
        //批次码回车方法
        $('#HBarCode_Batch').on('keydown', function (event) {
            var HBarCode = $('#HBarCodeSN').val();
            var HBardCodeProcExchBillNo = $('#HBardCodeProcExchBillNo').val();
            if (event.keyCode == 13) {
                if (!HBardCodeProcExchBillNo) {
                    layer.msg(get_MessageError("[0000-2-034]请先扫流转卡!", sessionStorage["HTranSlate"]))
                    return;
                } else {
                    HBarCode = HBarCode.toUpperCase();
                    if (!HBarCode) {
                        layer.msg(get_MessageError("[0000-2-019]条形码不能为空!", sessionStorage["HTranSlate"]))
                        return;
                    } else {
                        if (HBarCode.length != 29 && HBarCode.length != 50) {
                            layer.alert(get_MessageError("[3791-2-012]子件条码长度不为29位或50位!", sessionStorage["HTranSlate"]), { icon: 5, btn: [get_MessageError('[0000-2-035]退出', sessionStorage["HTranSlate"])], time: 100000, offset: 't' });
                            return;
                        }
                        if (HBarCode.match(/[^\x00-\xff]/g) != null) {
                            layer.alert(get_MessageError("[3791-2-013]必须是半角字符!", sessionStorage["HTranSlate"]), { icon: 5, btn: [get_MessageError('[0000-2-035]退出', sessionStorage["HTranSlate"])], time: 100000, offset: 't' });
                            return;
                        }
                    }
                }
                for (var i = 0; i < option.data.length; i++) {
                    if (option.data[i]["HBatchNo"] == "") {
                        layer.msg(get_MessageError("[3791-2-014]当前工序批次不能为空!", sessionStorage["HTranSlate"]))
                        return;
                    }
                }
                txtHICMOBillNoDown(HBarCode);
            }
        });
        //镭雕码回车方法
        $('#HBarCode_SN').on('keydown', function (event) {
            var HBarCode = $('#HBardCodeProcExchBillNo').val();
            if (event.keyCode == 13) {
                if (!HBarCode) {
                    layer.msg(get_MessageError("[0000-1-057]流转卡不能为空!", sessionStorage["HTranSlate"]))
                    return;
                }
                setIntervalIndex = setInterval(setIntervalList, 30000);
                get_BomList(HBarCode);
                //if (option.data != 0) {
                //    //保存到临时表
                //    get_AddBomTempList();
                //}
                //查询不良记录
                get_BadRecords();
                //查询合格记录
                get_HGRecords();
            }
        });
        //选择操作员
        form.on('submit(btnHEmp)', function () {
            btnHEmp();
        });
        //选择生产资源
        form.on('submit(btnHSource)', function () {
            btnHSource();
        });
        //选择生产班组按钮
        form.on('submit(btnHGroup)', function () {
            btnHGroup();
        });
        //选择生产车间按钮
        form.on('submit(btnHDept)', function () {
            btnHDept();
        });
        //选择工序按钮
        form.on('submit(btnHProc)', function () {
            btnHProc();
        });
        //退出
        form.on('submit(btnExit)', function (data) {
            if (params[1] != null) {
@@ -248,61 +170,29 @@
            }
        });
        //解除包装关系
        form.on('submit(btnDelBarRelation)', function (data) {
            get_DelRelation(1);
        });
        //拆除物料
        form.on('submit(btnDelBind)', function (data) {
            get_DelRelation(2);
        });
        //#endregion
        //#region æ­¤é¡µé¢æ‰€æœ‰çš„æ–¹æ³•
        //初始化界面
        function set_ClearBill() {
            //进入页面默认光标在流转卡上
            $("#HBardCodeProcExchBillNo").focus();
            //制单人
            $("#HMaker").val(sessionStorage["HUserName"]);
            $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd"));
            //通过登录用户获取默认值
            GetDefValByUser();
        function set_ClearBill() {
            //初始化表格
            set_InitGrid();
            //
            //get_Display();
            //查询重工条码信息
            get_Display();
        }
        //#region é€šè¿‡ç™»å½•用户获取默认值
        function GetDefValByUser() {
            var index = layer.load();
            $.ajax({
                url: GetWEBURL() + "/Cj_StationInBill/GetDefValByUser",
                type: "GET",
                async: false,
                data: { "Czybm": sessionStorage["Czybm"], "Czymc": sessionStorage["HUserName"] },
                success: function (result) {
                    var data = result.data[0];
                    form.val("formData", {
                        "HSourceID": data.HSourceID,
                        "HSourceName": data.生产资源名称,
                        "HGroupID": data.HGroupID,
                        "HGroupName": data.生产班组名称,
                        "HEmpID": data.HEmpID,
                        "HEmpName": data.操作员名称,
                        "HDeptID": data.HDeptID,
                        "HDeptName": data.部门名称,
                        "HProcNumber": data.工序代码,
                        "HProcName": data.工序名称,
                        "HProcID": data.HProcID
                    });
                    layer.close(index);
                }
                , error: function () {
                    layer.close(index);
                    layer.alert(get_MessageError("[0000-1-002]接口请求失败!", sessionStorage["HTranSlate"]), { icon: 5 });
                }
            })
        }
            //#endregion
        //关键件清单
        //表格初始化
        function set_InitGrid() {
            option= {
                elem: '#mainTable_SN'
@@ -310,21 +200,24 @@
                , totalRow: true
                , cellMinWidth: 120
                , data: []
                , height: 285
                , height: 'full-180'
                , limit: 10
                , cols: [[
                    { type: 'numbers', title: '序号' }
                    , { field: 'HBarCodeID', title: '条码ID', hide: true }
                    , { field: '工单条码', title: '工单条码' }
                    , { field: 'DSN', title: 'DSN' }
                ]]
            }
            table.render(option);
            option2 = {
                elem: '#mainTable_Bind'
                , page: false
                , totalRow: true
                , cellMinWidth: 120
                , data: []
                , height: 385
                , height: 'full-410'
                , limit: 10
                , cols: [[
                    { type: 'numbers', title: '序号' }
@@ -333,129 +226,56 @@
                    , { field: '关键件条码', title: '关键件条码' }
                ]]
            }
            table.render(option);
            table.render(option2);
        }
        //条码回车查询
        function txtHICMOBillNoDown(HBarCode) {
            var HProcExchBillNo = $("#HProcExchBillNo").val();
            var indexs = layer.load();
            $.ajax({
                type: "GET",
                url: GetWEBURL() + "/Cj_SingleStation/SNHBardCodeList",
                async: false,
                data: { "HBarCode": HBarCode, "HProcExchBillNo": HProcExchBillNo, "user": sessionStorage["HUserName"], "HOrgID": sessionStorage["OrganizationID"] },
                dataType: "json",
                success: function (data1) {
                    if (data1.count == 1) {
                        layer.close(indexs);
                        var index = layer.load();
                        $.ajax({
                            type: "GET",
                            url: GetWEBURL() + "/Cj_SingleStation/HBardCodeSNList",
                            async: false,
                            data: { "HBarCode": HBarCode, "user": sessionStorage["HUserName"] },
                            dataType: "json",
                            success: function (data1) {
                                if (data1.count == 1) {
                                    layer.close(index);
                                    $("#HBarCode_P").val(HBarCode);
                                    if (AllowLoadData()) {
                                        //保存数据
                                        set_AddAssemblyBill();
                                    }
                                }
                                else {
                                    layer.close(index);
                                    layer.msg(get_MessageError(data1.Message, sessionStorage["HTranSlate"]), { icon: 5, btn: [get_MessageError('[0000-2-008]确认', sessionStorage["HTranSlate"])], time: 100000, offset: 't', skin: 'layui-layer-lan', title: get_MessageError("[0000-2-009]温馨提示", sessionStorage["HTranSlate"]) });
                                }
                                $("#HBarCodeSN").val("");
                            },
                            error: function (err) {
                                layer.close(index);
                                layer.msg(get_MessageError("错误:" + err, sessionStorage["HTranSlate"]), { icon: 5, btn: [get_MessageError('[0000-2-008]确认', sessionStorage["HTranSlate"])], time: 100000, offset: 't', skin: 'layui-layer-lan', title: get_MessageError("[0000-2-009]温馨提示", sessionStorage["HTranSlate"]) });
                            }
                        });
                    }
                    else {
                        layer.close(indexs);
                        layer.msg(get_MessageError(data1.Message, sessionStorage["HTranSlate"]));
                    }
                    //光标跳转到SN条码文本框上
                    //$("#HBarCodeSN").focus();
                    $("#HBarCodeSN").val("");
                },
                error: function (err) {
                    layer.close(indexs);
                    layer.msg(get_MessageError("错误:" + err, sessionStorage["HTranSlate"]), { icon: 5, btn: [get_MessageError('[0000-2-008]确认', sessionStorage["HTranSlate"])], time: 100000, offset: 't', skin: 'layui-layer-lan', title: get_MessageError("[0000-2-009]温馨提示", sessionStorage["HTranSlate"]) });
                }
            });
        }
        //加载网格
        function get_Display() {
            var ajaxLoad = layer.load();
            $.ajax({
                url: GetWEBURL() + '/Cg_POOrderBill/list',
                url: GetWEBURL() + '/Cj_SingleStation/UnbindBarInfo',
                async: false,
                type: "GET",
                data: { "sWhere": '', "user": sessionStorage["HUserName"] },
                data: { "HBarCodeIDs": HBarCodeID, "user": sessionStorage["HUserName"] },
                success: function (data1) {
                    if (data1.count == 1) {
                        var data = [];//列字段数据
                        var col = [];
                        var titleData=[]
                        var totalArray = ["数量", "关联数量", "未关联数量", "打印条码数量", "未打印条码数量", "实收数量", "金额"];
                        //给空的数组赋值
                        for (var key in data1.list) {
                            data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
                        var data_SN = data1.data.h_p_Sc_UnbindBarInfo; //重工SN码信息
                        var data_Bind = data1.data.h_p_Sc_UnbindBarInfo1; //关键件绑定信息
                        var data_ICMO = data1.data.h_p_Sc_UnbindBarInfo2; //生产订单信息
                        var OptionData_SN = [];
                        var OptionData_Bind = [];
                        for (var i = 0; i < data_SN.length; i++) {
                            OptionData_SN.push({
                                "HBarCodeID": data_SN[i].HItemID, "工单条码": data_SN[i].HBarCode, "DSN": data_SN[i].HBarCode
                            });
                        }
                        //在列表左边添加勾选框
                        col.push({ type: 'checkbox', fixed: 'left', totalRowText: '合计' });
                        for (var i = 0; i < data.length; i++) {
                            // if (data[i].name == 'HInterID' || data[i].name == 'HBillType' || data[i].name == 'hmainid') {
                            if ($.inArray(data[i].name, titleData) > -1) {
                                col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //隐藏id列
                            }
                            else if ($.inArray(data[i].name, totalArray) > -1) { //计算列
                                col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, totalRow: true, width: 120 });
                            } else if (data[i].name == '单据号') {//添加超链接
                                col.push({
                                    field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200, event: '单据号', templet: function (d) {
                                        return '<span style="color: blue;">' + d.单据号 + '</span>'
                                    }, style: 'cursor: pointer;'
                                });
                            } else if (data[i].name == '当前审核项目') {//添加超链接
                                col.push({
                                    field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200, event: '当前审核项目', templet: function (d) {
                                        return '<span style="color: blue;">' + d.当前审核项目 + '</span>'
                                    }, style: 'cursor: pointer;'
                                });
                            } else {
                                switch (data[i].Type) {
                                    //int
                                    case 'DateTime':
                                        col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + (data[i].name == "行关闭日期" ? "行关闭人" : data[i].name) + " ==''?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd HH:mm:ss')}}</div>", width: 200 });
                                        break;
                                    default:
                                        col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200 });
                                }
                            }
                        }
                        option.cols = [col]
                        option.data = data1.data;
                        //刷新表格数据
                        DisPlay_HideColumn(HModName, sessionStorage["HUserName"], option, []);
                        option.data = OptionData_SN;
                        table.render(option);
                        for (var i = 0; i < data_Bind.length; i++) {
                            OptionData_Bind.push({
                                "物料代码": data_Bind[i].关键件物料代码, "物料名称": data_Bind[i].关键件物料名称, "关键件条码": data_Bind[i].关键件条码
                            })
                        }
                        option2.data = OptionData_Bind;
                        table.render(option2);
                        if (data_ICMO.length > 0) {
                            $("#HICMOInterID").val(data_ICMO[0].HICMOInterID);
                            $("#HICMOEntryID").val(data_ICMO[0].HICMOEntryID);
                            $("#HICMOBillNo").val(data_ICMO[0].生产订单号);
                            var Organization = "";
                            for (var i = 0; i < data_ICMO.length; i++) {
                                Organization += '<option  style="color:blue;" value="' + data_ICMO[i].工序ID + '">' + data_ICMO[i].工序名称 + '</option>';
                            }
                            $("#HProcID").append(Organization);
                            form.render('select');
                        }
                        layer.close(ajaxLoad);
                        //layer.alert("查询成功", { icon: 1 });
                    } else {
                        layer.close(ajaxLoad);
                        layer.alert(data1.code + data1.Message, { icon: 5 });
@@ -467,6 +287,32 @@
            });
        }
        //解除包装关系、拆除物料(1:解除包装关系;2.拆除物料)
        function get_DelRelation(HType) {
            var ajaxLoad = layer.load();
            var HProcID = $("#HProcID").val();
            var HICMOInterID = $("#HICMOInterID").val();
            var HICMOEntryID = $("#HICMOEntryID").val();
            $.ajax({
                url: GetWEBURL() + '/Cj_SingleStation/DelRelation',
                async: false,
                type: "GET",
                data: { "HBarCodeIDs": HBarCodeID, "HICMOInterID": HICMOInterID, "HICMOEntryID": HICMOEntryID, "HProcID": HProcID, "HType": HType, "user": sessionStorage["HUserName"] },
                success: function (data1) {
                    if (data1.count == 1) {
                        layer.alert(data1.Message, { icon: 1 });
                        layer.close(ajaxLoad);
                    } else {
                        layer.alert(data1.Message, { icon: 5 });
                        layer.close(ajaxLoad);
                    }
                }, error: function () {
                    layer.close(ajaxLoad);
                    layer.alert("接口请求失败!", { icon: 5 });
                }
            });
        }
        //非空验证
        function AllowLoadData() {
WebTM/views/³µ¼ä¹ÜÀí/µ¥Æ·¹ýÕ¾_СÎÀ/Cj_ProcessItemStationPlatform_UnbindList.html
@@ -342,7 +342,7 @@
            function get_Display(sWhere) {
                var ajaxLoad = layer.load();
                $.ajax({
                    url: GetWEBURL() + '/Sc_KeyElementBinding/list',
                    url: GetWEBURL() + '/Cj_SingleStation/UnbindBarList',
                    async: false,
                    type: "GET",
                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"]},
@@ -364,15 +364,7 @@
                                }
                                else if ($.inArray(data[i].name, totalArray) > -1) {
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, totalRow: true, width: 120 });
                                } else if (data[i].name == '单据号') {
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200, event: '单据号', filter: true});
                                }
                                else if (data[i].name == '配件条码') {
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200, event: '配件条码', filter: true });
                                }
                                else if (data[i].name == '日期') {
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', filter: { type: 'date[yyyy-MM-dd HH:mm:ss]' }, sort: true, width: 200 });
                                }
                                }
                                else {
                                    switch (data[i].Type) {
                                        //int
@@ -394,8 +386,8 @@
                                , page: true
                                , totalRow: true
                                , cellMinWidth: 90
                                , limit: 50
                                , limits: [50, 500, 5000, 20000]
                                , limit: 200
                                , limits: [50, 200, 500, 5000, 20000]
                                , done: function (res, curr, count) {
                                    soulTable.render(this);
                                }
@@ -511,7 +503,7 @@
                    sWhere += " and ç”Ÿäº§è®¢å•号 like '%" + HICMOBillNo + "%'";
                }
                if (HBarcode_SN) {
                    sWhere += " and SN码 like '%" + HBarcode_SN + "%'";
                    sWhere += " and DSN like '%" + HBarcode_SN + "%'";
                }
                if (HBarcode_ZB) {
                    sWhere += " and æ ˆæ¿ç  like '%" + HBarcode_ZB + "%'";
@@ -572,8 +564,10 @@
                    , data = checkStatus.data;
                if (checkStatus.data.length >= 1) {
                    HSN = [];
                    HBarCodeID = [];
                    for (var i = 0; i < data.length; i++) {
                        HSN.push(data[i].产品条码);
                        HSN.push(data[i].DSN);
                        HBarCodeID.push(data[i].HBarInterID);
                    }
                    layer.open({
@@ -584,7 +578,7 @@
                        , shade: 0.6 //遮罩透明度
                        , maxmin: true //允许全屏最小化
                        , anim: 0 //0-6的动画形式,-1不开启
                        , content: './Cj_ProcessItemStationPlatform_UnbindEdit.html?OperationType=3&HBarcode_SN=' + HSN.toString()
                        , content: './Cj_ProcessItemStationPlatform_UnbindEdit.html?OperationType=3&HBarcode_SN=' + HSN.toString() + '&HBarCodeID=' + HBarCodeID.toString()
                        , resize: false,
                        end: function () {
                            //刷新页面,