duhe
2025-09-17 19e6c5000df386eac36ea3c2e310d3e98ca2cc71
WebTM/views/ÖÊÁ¿¹ÜÀí/PNL¼ìÑéÐÅÏ¢/QC_CheckNote_PNL_TempEdit.html
@@ -215,6 +215,7 @@
            var HBarCode_PNL = params[params[3]]; //PNL条码编号
            var HSetNo = params[params[4]]; //set号
            var HPCSNo = params[params[5]]; //PCS号
            var HBadReason_Params = decodeURIComponent(params[params[6]]) ; //不良原因
        }
        layui.config({
@@ -260,7 +261,8 @@
            }
            else if (OperationType == 3) {//编辑
                roadBillMain();
            } else if (OperationType == 4) {//直方图新增
            }
            else if (OperationType == 4) {//直方图新增
                set_AddFNew();
                $("#HBarCode").val(HBarCode_PNL);
                $("#HSetNo").val(HSetNo);
@@ -269,12 +271,14 @@
                document.getElementById("HBarCode").setAttribute("disabled", "disabled");
                document.getElementById("HSetNo").setAttribute("disabled", "disabled");
                document.getElementById("HPCSNo").setAttribute("disabled", "disabled");
            } else if (OperationType == 5) {//直方图编辑
            }
            else if (OperationType == 5) {//直方图编辑
                roadBillMain();
                document.getElementById("HBarCode").setAttribute("disabled", "disabled");
                document.getElementById("HSetNo").setAttribute("disabled", "disabled");
                document.getElementById("HPCSNo").setAttribute("disabled", "disabled");
            } else if (OperationType == 6) {//直方图-avi æ–°å¢ž
            }
            else if (OperationType == 6) {//直方图-avi æ–°å¢ž
                set_AddFNew();
                $("#HBarCode").val(HBarCode_PNL);
                $("#HSetNo").val(HSetNo);
@@ -286,6 +290,36 @@
                document.getElementById("HPCSNo").setAttribute("disabled", "disabled");
                document.getElementById("HCheckProc").setAttribute("disabled", "disabled");
                form.render('select');
            }
            else if (OperationType == 7) {//直方图-avi å³å‡»æ–°å¢ž
                set_AddFNew();
                $("#HBarCode").val(HBarCode_PNL);
                $("#HSetNo").val(HSetNo);
                $("#HPCSNo").val(HPCSNo);
                $("#HCheckProc").val("AVI");
                $("#HBadReason").val(HBadReason_Params);
                document.getElementById("HBarCode").setAttribute("disabled", "disabled");
                document.getElementById("HSetNo").setAttribute("disabled", "disabled");
                document.getElementById("HPCSNo").setAttribute("disabled", "disabled");
                document.getElementById("HCheckProc").setAttribute("disabled", "disabled");
                form.render('select');
                saver();
            }
            else if (OperationType == 8) {//直方图-avi å³å‡»æ–°å¢ž
                set_AddFNew();
                $("#HBarCode").val(HBarCode_PNL);
                $("#HSetNo").val(HSetNo);
                $("#HPCSNo").val(HPCSNo);
                $("#HCheckProc").val("MRB");
                $("#HBadReason").val(HBadReason_Params);
                document.getElementById("HBarCode").setAttribute("disabled", "disabled");
                document.getElementById("HSetNo").setAttribute("disabled", "disabled");
                document.getElementById("HPCSNo").setAttribute("disabled", "disabled");
                document.getElementById("HCheckProc").setAttribute("disabled", "disabled");
                form.render('select');
                saver();
            }
            else {
                layer.alert("未知操作类型!", { icon: 5 });
@@ -306,8 +340,13 @@
                let url = GetWEBURL()
                if (OperationType == 3 || OperationType == 5) {
                    url += "/QC_CheckNote_PNL_TempController/EditBill"
                } else if (OperationType == 1 || OperationType == 2 || OperationType == 4 || OperationType == 6) {
                } else if (OperationType == 1 || OperationType == 2 || OperationType == 4 || OperationType == 6 || OperationType == 7 || OperationType == 8) {
                    url += "/QC_CheckNote_PNL_TempController/AddBill"
                    if (!judgeRepeatDataByPNLAndPCS()) {
                        layer.msg("该PCS已经存在不良记录,禁止重复标记!!", { icon: 5 });
                        return;
                    }
                }
                $.ajax(
                    {
@@ -492,12 +531,100 @@
                });
            }
            //#region ä¿å­˜æ–¹æ³•
            function saver() {
                //获取表单数据
                var data = {};
                var form = document.getElementById('form');
                for (var i = 0; i < form.elements.length; i++) {
                    var element = form.elements[i];
                    if (element.id) { // ç¡®ä¿å…ƒç´ æœ‰name属性
                        data[element.id] = element.value;
                    }
                }
                data['HPageIndex'] = $("#HPageIndex option:selected").data('value');
                var sMainStr = JSON.stringify(data) + ';' + sessionStorage["HUserName"]
                let url = GetWEBURL()
                if (OperationType == 3 || OperationType == 5) {
                    url += "/QC_CheckNote_PNL_TempController/EditBill"
                } else if (OperationType == 1 || OperationType == 2 || OperationType == 4 || OperationType == 6 || OperationType == 7 || OperationType == 8) {
                    url += "/QC_CheckNote_PNL_TempController/AddBill"
                }
                $.ajax({
                    type: "POST",
                    url: url, //方法所在页面和方法名
                    async: false,
                    data: { "oMain": sMainStr },
                    dataType: "json",
                    success: function (data) {
                        if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            layer.msg(data.Message, { icon: 1 });
                            $('#add-btn').addClass("layui-btn-disabled").attr("disabled", true);
                        }
                        else {
                            f_alert(data.Message);
                            console.log("Reason" + sMainStr);
                        }
                        layer.closeAll("loading");
                    },
                    error: function (err) {
                        f_alert("错误:" + err);
                        console.log("Reason" + sMainStr);
                    }
                });
                if (OperationType == 7 || OperationType == 8) {
                    if (linterid == undefined) {
                        //关闭页签
                        Pub_Close(2);
                    }
                    else {
                        //关闭页签
                        Pub_Close(1);
                    }
                }
            }
            //#endregion
            //
            function f_alert(sMsg) {
                layer.alert(sMsg, { icon: 5 });
            }
            //#region åˆ¤æ–­è¯¥PNL下的该PCS是否已经存在不良记录。若存在,则不允许继续生成。
            function judgeRepeatDataByPNLAndPCS() {
                var flag = true;
                var HBarCode_Temp = $("#HBarCode").val();
                var HPCSNo_Temp = $("#HPCSNo").val();
                var sql = "select HBarCode from QC_CheckNote_PNL_Temp where HBarCode = '" + HBarCode_Temp + "' and HPCSNo = '" + HPCSNo_Temp + "' ";
                sql += " union select HBarCode from QC_CheckNote_PNL_His where HBarCode = '" + HBarCode_Temp + "' and HPCSNo = '" + HPCSNo_Temp + "' ";
                var ModRightNameCheck = "";
                $.ajax({
                    url: GetWEBURL() + '/CommonModel/searchMethod',
                    async: false,
                    type: "GET",
                    data: { "sql": sql, "user": sessionStorage["HUserName"], "ModRightNameCheck": ModRightNameCheck },
                    success: function (data1) {
                        if (data1.count == 1) {
                            if (data1.data.length > 0) {
                                flag = false;
                            }
                        } else {
                            flag = false;
                        }
                    }, error: function (e) {
                        flag = false;
                    }
                });
                return flag;
            }
            //#endregion
        });
        //#endregion