wtt
2024-10-29 187db2c9b74f4908b143f73874cf72e4b2bd03e1
WebTM/views/³µ¼ä¹ÜÀí/²úÏß/MES_ProductionLinePackaging.html
@@ -39,6 +39,7 @@
                            </div>
                        </div>
                        <button type="button" lay-submit="" lay-filter="Print" id="Print" class="layui-btn layui-btn-radius">打印</button>
                        <button type="button" lay-submit="" lay-filter="Print2" id="Print2" hidden="hidden" ></button>
                        <div class="layui-inline" style="width: 200px;">
                            <div class="layui-input-block">
                                <select name="PrintName" lay-verify="required" id="PrintName">
@@ -52,6 +53,7 @@
                                <select name="LDM" lay-verify="required" id="LDM">
                                    <option value="DU3" selected>DU3</option>
                                    <option value="QDR">QDR</option>
                                    <option value="AAA">15车间</option>
                                    <option value="其他">其他</option>
                                </select>
                            </div>
@@ -64,6 +66,8 @@
                                    <option value="1607222-00-B">1607222-00-B</option>
                                    <option value="1943600-00-B">1943600-00-B</option>
                                    <option value="1941600-00-B">1941600-00-B</option>
                                    <option value="1941600-00-C">1941600-00-C</option>
                                    <option value="1943600-00-C">1943600-00-C</option>
                                    <option value="其他" selected>其他</option>
                                </select>
                            </div>
@@ -96,6 +100,12 @@
                                    <label class="layui-inline" style="width:60px;">子件条码</label>
                                    <div class="layui-inline">
                                        <input type="text" style="border-radius: 50px;width: 140%;" name="子件条码" id="SubBarcode" autocomplete="off" placeholder="请输入子件条码" class="layui-input">
                                    </div>
                                </div>
                                <div class="">
                                    <label class="layui-inline" style="width:60px;">是否混箱</label>
                                    <div class="layui-inline">
                                        <input type="checkbox" id="HMixedBox" name="HMixedBox" lay-skin="primary" value="" lay-filter="HMixedBox">
                                    </div>
                                </div>
                            </div>
@@ -437,6 +447,7 @@
                            return util.toDateString(time, "yyyy-MM-dd");
                        }
                    }
                    //, { field: 'HBarCode_Pack', title: '条形码', width: 145 }
                    , { field: 'HSourceBillNo', title: '条形码', width: 145 }
                    , { field: 'HBillNo', title: '源单单号', width: 125 }
                    , { field: 'HBarCode', title: '唯一码', width: 125 }
@@ -522,7 +533,7 @@
                        return;
                    }
                    //判断装箱数量不能大于剩余数量
                    if (zxQty > icmoQtyNow) {
                    if (zxQty > icmoQtyNow && $("#HMixedBox").val()=="") {
                        playSound();
                        layer.msg("装箱数量不允许大于流转卡剩余数量!剩余数量为" + icmoQtyNow, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        return;
@@ -581,6 +592,24 @@
                }
            });
            form.on('checkbox(HMixedBox)', function (obj) {
                if (icmoQtyNow == 0) {
                    playSound();
                    layer.msg("剩余数量为" + icmoQtyNow + ",不允许混箱!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                    $("input[name='HMixedBox']").prop("checked", false);
                    form.render('checkbox');
                    return;
                }
                if (obj.value == "") {
                    $("#HMixedBox").val("1");
                } else {
                    $("#HMixedBox").val("");
                }
            });
            //子件条码回车方法
            $('#SubBarcode').on('keydown', function (event) {   //扫条形码
@@ -602,16 +631,30 @@
                        return;
                    }
                    if (LDM == "AAA" && SubBarcode.length != 50) {
                        playSound();
                        layer.alert("子件条码长度不为50位!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        return;
                    }
                    if (SubBarcode.match(/[^\x00-\xff]/g) != null) {
                        playSound();
                        layer.alert("必须是半角字符!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        return;
                    }
                    if (LDM != "其他" && BBM != "其他" && reg.test(SubBarcode)) {
                        playSound();
                        layer.alert("请查看子件条码大写是否正确!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        return;
                    if (SubBarcode.length == 50) {
                        if (LDM != "其他" && reg.test(SubBarcode)) {
                            playSound();
                            layer.alert("请查看子件条码大写是否正确!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                            return;
                        }
                    } else {
                        if (LDM != "其他" && BBM != "其他" && reg.test(SubBarcode)) {
                            playSound();
                            layer.alert("请查看子件条码大写是否正确!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                            return;
                        }
                    }
                    if (LDM != "其他" && BBM != "其他" && SubBarcode.indexOf(BBM) == -1) {
@@ -670,7 +713,7 @@
                        url: GetWEBURL() + "/LEMS/SNBarcodeProcCtrl",
                        type: "GET",
                        async: false,
                        data: { "SubBarcode": SubBarcode, "HProcExchBillNo": HProcExchBillNo },
                        data: { "SubBarcode": SubBarcode, "HProcExchBillNo": HProcExchBillNo, "HMixedBox": $("#HMixedBox").val(), "HBillNo": HBillNo2 },
                        success: function (result) {
                            if (result.count == 0) {
                                a = 1;
@@ -712,86 +755,93 @@
                                            layer.alert("包装数量已等于流转卡数量!不允许扫码!", { icon: 1 });
                                            return;
                                        } else {
                                            $.ajax({//表体存temp表
                                                url: GetWEBURL() + "/LEMS/SaveSubBarcode_Json",
                                                type: "GET",
                                                async: false,
                                                data: {
                                                    "HBillNo": HBillNo
                                                    , "SubBarcode": SubBarcode
                                                    , "HInterID": HInterID
                                                    , "HBillNo2": HBillNo2
                                                    , "HBillType": HBillType
                                                    , "sMaker": sMaker
                                                    , "HBarCode": $("#HBarCode_wym").val()
                                                    , "HNumber": $("#HNumber").val()
                                                    , "HName": $("#HMaterName").val()
                                                    , "HModel": $("#HModel").val()
                                                },
                                                success: function (result) {
                                                    var data = result.data;
                                                    if (result.Message == "该子件条码已存在") {
                                                        playSound();
                                                        layer.alert("该子件条码已存在", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                                                    } else {
                                                        if (data[0].Column1 == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                                                            $('#SubBarcode').val("");
                                                            $("#SubBarcode").focus();
                                                            table.reload('smjl-table', {
                                                                url: GetWEBURL1() + '/LEMS/Update_HBillNo_SubBarcodeList_Json'
                                                                , where: {
                                                                    HBillNo: HBillNo2
                                                                    , HBarCode: HBillNo
                                                                }
                                                            });
                                                            zxQtyFlag++;
                                                            pcmQtyFlag++
                                                            $("#zxQty").val("" + zxQtyFlag + "/" + zxQty + "");
                                                            $("#pcmQty").val("" + pcmQtyFlag + "/" + pcmQty + "");
                                                            layer.msg("扫描成功", { time: 5000, icon: 6 });
                                                            $.ajax({//查询条码档案表里的镭雕条码的合计数量方法
                                                                url: GetWEBURL() + "/LEMS/Select_Gy_BarCodeBill_HQty",
                                                                type: "GET",
                                                                async: false,
                                                                data: {
                                                                    "HBarCode": $("#HBarCode_wym").val()
                                                                },
                                                                success: function (result) {
                                                                    var HQty = result.data[0].HQty;
                                                                    HQty++;
                                                                    $.ajax({//更新条码档案表里的镭雕条码的合计数量方法
                                                                        url: GetWEBURL() + "/LEMS/Update_Gy_BarCodeBill_HQty",
                                                                        type: "GET",
                                                                        async: false,
                                                                        data: {
                                                                            "HBarCode": $("#HBarCode_wym").val(),
                                                                            "HQty": HQty
                                                                        },
                                                                        success: function (result) {
                                                                            var HQty = result.data;
                                                                            ZJTMFlag = true;
                                                                        }, error: function () {
                                                                            playSound();
                                                                            layer.alert("更新条码档案表里的镭雕条码的合计数量方法发生错误!", { icon: 5 });
                                                                        }
                                                                    });
                                                                }, error: function () {
                                                                    playSound();
                                                                    layer.alert("查询条码档案表里的镭雕条码的合计数量方法发生错误!", { icon: 5 });
                                                                }
                                                            });
                                                        } else {
                                            //判断装箱数量不能大于剩余数量
                                            if (AllHqty > icmoQtyNow && $("#HMixedBox").val() == "") {
                                                playSound();
                                                layer.msg("装箱数量不允许大于流转卡剩余数量!剩余数量为" + icmoQtyNow, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                                                return;
                                            } else {
                                                $.ajax({//表体存temp表
                                                    url: GetWEBURL() + "/LEMS/SaveSubBarcode_Json",
                                                    type: "GET",
                                                    async: false,
                                                    data: {
                                                        "HBillNo": HBillNo
                                                        , "SubBarcode": SubBarcode
                                                        , "HInterID": HInterID
                                                        , "HBillNo2": HBillNo2
                                                        , "HBillType": HBillType
                                                        , "sMaker": sMaker
                                                        , "HBarCode": $("#HBarCode_wym").val()
                                                        , "HNumber": $("#HNumber").val()
                                                        , "HName": $("#HMaterName").val()
                                                        , "HModel": $("#HModel").val()
                                                    },
                                                    success: function (result) {
                                                        var data = result.data;
                                                        if (result.Message == "该子件条码已存在") {
                                                            playSound();
                                                            // $("#verifycode").click();
                                                            //layer.msg(result.Message, { icon: 5 });
                                                            layer.alert("插入缓存表失败", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                                                            layer.alert("该子件条码已存在", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                                                        } else {
                                                            if (data[0].Column1 == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                                                                $('#SubBarcode').val("");
                                                                $("#SubBarcode").focus();
                                                                table.reload('smjl-table', {
                                                                    url: GetWEBURL1() + '/LEMS/Update_HBillNo_SubBarcodeList_Json'
                                                                    , where: {
                                                                        HBillNo: HBillNo2
                                                                        , HBarCode: HBillNo
                                                                    }
                                                                });
                                                                zxQtyFlag++;
                                                                pcmQtyFlag++
                                                                $("#zxQty").val("" + zxQtyFlag + "/" + zxQty + "");
                                                                $("#pcmQty").val("" + pcmQtyFlag + "/" + pcmQty + "");
                                                                layer.msg("扫描成功", { time: 5000, icon: 6 });
                                                                $.ajax({//查询条码档案表里的镭雕条码的合计数量方法
                                                                    url: GetWEBURL() + "/LEMS/Select_Gy_BarCodeBill_HQty",
                                                                    type: "GET",
                                                                    async: false,
                                                                    data: {
                                                                        "HBarCode": $("#HBarCode_wym").val()
                                                                    },
                                                                    success: function (result) {
                                                                        var HQty = result.data[0].HQty;
                                                                        HQty++;
                                                                        $.ajax({//更新条码档案表里的镭雕条码的合计数量方法
                                                                            url: GetWEBURL() + "/LEMS/Update_Gy_BarCodeBill_HQty",
                                                                            type: "GET",
                                                                            async: false,
                                                                            data: {
                                                                                "HBarCode": $("#HBarCode_wym").val(),
                                                                                "HQty": HQty
                                                                            },
                                                                            success: function (result) {
                                                                                var HQty = result.data;
                                                                                ZJTMFlag = true;
                                                                            }, error: function () {
                                                                                playSound();
                                                                                layer.alert("更新条码档案表里的镭雕条码的合计数量方法发生错误!", { icon: 5 });
                                                                            }
                                                                        });
                                                                    }, error: function () {
                                                                        playSound();
                                                                        layer.alert("查询条码档案表里的镭雕条码的合计数量方法发生错误!", { icon: 5 });
                                                                    }
                                                                });
                                                            } else {
                                                                playSound();
                                                                // $("#verifycode").click();
                                                                //layer.msg(result.Message, { icon: 5 });
                                                                layer.alert("插入缓存表失败", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                                                            }
                                                        }
                                                    }, error: function () {
                                                        playSound();
                                                        layer.alert("子件条码方法发生错误!", { icon: 5 });
                                                    }
                                                }, error: function () {
                                                    playSound();
                                                    layer.alert("子件条码方法发生错误!", { icon: 5 });
                                                }
                                            });
                                                });
                                            }
                                        }
                                    }, error: function () {
                                        playSound();
@@ -950,7 +1000,11 @@
                        }
                    });
                }
                $("#Print").click();
                if (LDM == "AAA") {
                    $("#Print2").click();
                } else {
                    $("#Print").click();
                }
                $("#HBarCode_White").val("");
                //子件条码数量已扫完 æ¡ç æ‰«å®ŒåŽ
                if (pcmQty == pcmQtyFlag) {
@@ -972,6 +1026,9 @@
                    //清空扫描记录的装箱数量
                    zxQtyFlag = 0;
                    pcmQtyFlag = 0;
                    $("#HMixedBox").val("");
                    $("input[name='HMixedBox']").prop("checked", false);
                    form.render('checkbox');
                    //获取单据号
                    getBillno();
                    //扫描条码
@@ -1028,7 +1085,7 @@
            });
            //打印按钮
            form.on('submit(Print)', function (data) {//退出
            form.on('submit(Print2)', function (data) {//退出
                //打开打印模板
                var linterid = $("#HInterID").val();
                //var linterid = "28973";
@@ -1058,9 +1115,9 @@
                                var report1 = "";
                                var parintName = $("#PrintName").val();
                                if (parintName == "斯莫尔") {
                                    report1 = urlAddRandomNo("../../views/grf/包装单物料标识卡(网页版).grf");
                                    report1 = urlAddRandomNo("../../grf/包装单物料标识卡(网页版).grf");
                                } else {
                                    report1 = urlAddRandomNo("../../views/grf/包装单物料标识卡(网页版)2.grf");
                                    report1 = urlAddRandomNo("../../grf/包装单物料标识卡(网页版)2.grf");
                                }
                                var args = {
@@ -1089,6 +1146,17 @@
                })
            });
            //打印按钮
            form.on('submit(Print)', function (data) {//退出
                //打开打印模板
                var linterid = $("#HInterID").val();
                var Type = "HBarCodePrint";
                var OpenTmp = "白标打印1";
                //var ReportViewer = document.getElementById("ReportViewer");
                window.open("../../基础资料/公用基础资料/HBarPlanPrint.html?linterid=" + linterid.toString() + "&Type=" + Type.toString() + "&OpenTmp=" + OpenTmp.toString());
                $("#Print2").click();
            });
            //监听表格中行工具事件
            table.on('tool(smjl-table)', function (obj) { //注:tool æ˜¯å·¥å…·æ¡äº‹ä»¶åï¼Œtest æ˜¯ table åŽŸå§‹å®¹å™¨çš„å±žæ€§ lay-filter="对应的值"
                var data = obj.data //获得当前行数据