zoukankan      html  css  js  c++  java
  • 新青PU51126-填写数量

      $().ready(function () {
            var indx_target;
            var indx_ID;
           var indx_kcsl;
            var grid = document.all.grdTest;
    
         var myJSON = {
        value1: '',
        value2: '',
        value3: '',
        load: function () {       
        },
        serialize: function () {
            var json = "";
            for (var key in this) {
                if (typeof this[key] != 'function') {
                    json += (json != "" ? "," : "") + key + ":'" + this[key] + "'";
                }
            }
            //json = '[{' + json + '}]';
           json = '{' + json + '}';
            return json;
        }
    }
    
            $("#grdTest th").each(function(index) {
                if ( $(this).html().indexOf("实发数量") > 0 )  {
                    indx_target = index;
                }
            });
    
    $("#grdTest th").each(function(index) {
                if ( $(this).html().indexOf("库存数量") > 0 )  {
                    indx_kcsl = index;
                }
            });
    
            $("#grdTest th").each(function(index) {
                if ($(this).html().indexOf("流水号") > 0) {
                    indx_ID = index;
                }
            });
    
            $("#grdTest tr").find("td:eq(" + indx_target + ")").change(function (e){	
            var rowIndex =  $(this).parent().parent().find("tr").index($(this).parent()[0]); 
            var strPK = grid.rows[rowIndex*1].cells[indx_ID*1].innerText;
    
            var strSFSL= grid.rows[rowIndex*1].cells[indx_target*1].childNodes[0].value;
            var strKCSL = grid.rows[rowIndex*1].cells[indx_kcsl*1].innerText;
            if (_urlInfo.CS2 == '审核') {
                    alert('审核状态不能修改');
                    return false;
                }
    if (strSFSL * 1 == null) {
                            alert('数量不能为空');
    grid.rows[rowIndex*1].cells[indx_target*1].childNodes[0].value= null;
    strSFSL= null;
                            return false;
                        }
                        if (strSFSL * 1 <= 0) {
                            alert('数量不能为0或负数');
    grid.rows[rowIndex*1].cells[indx_target*1].childNodes[0].value= null;
    strSFSL= null;
                            return false;
                        }
                        if (parseInt(strKCSL) < parseInt(strSFSL)) {
                            alert('库存数量不能小于实发数量');
    grid.rows[rowIndex*1].cells[indx_target*1].childNodes[0].value= null;
    strSFSL= null;
                            return false;
                        }
    if (typeof(myJSON) != 'undefined') {
        myJSON.value1 = strSFSL;//(strSFSL*1>0)?strSFSL:null;
        myJSON.value2 = strPK;
        myJSON.value3 = 13;
        //var data = myJSON.serialize();
    }
                $.ajax({
                    type: "POST",
                    contentType: "application/json",
                    url: "LYR.aspx/GetWish",	     
    	      data:myJSON.serialize(),				
                    dataType: 'json',
                    success: function (result) {
                        var json = eval(result.d);
                        if (json == "1") {
                            grid.rows[rowIndex*1].cells[indx_target*1].childNodes[0].value= strSFSL;			   }
                        if (json == "0") {
                            alert('数量没有添加成功');
                        }
                        return false;
                    } //success: function(result) 
                }); //$.ajax
                return false;
            });
        });
    

      

  • 相关阅读:
    向存储过程中传入列表参数
    TRUNCATE TABLE (Transact-SQL)
    Program.cs
    联想G40-30 安装win10系统
    完美解决github访问速度慢[转]
    关于Visual studio 2017安装方法的若干问题
    [转载] 中国象棋软件-引擎实现(七)测试程序
    [转载] 中国象棋软件-引擎实现(六)局面评估
    [转载] 中国象棋软件-引擎实现(五)历史启发及着法排序
    [转载] 中国象棋软件-引擎实现(四)搜索算法
  • 原文地址:https://www.cnblogs.com/nuaaydh/p/4354420.html
Copyright © 2011-2022 走看看