• 新青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;
            });
        });
    

      

  • 相关阅读:
    作业2(4)求m和n之间的和
    作业2(3)计算x的n次方
    作业3(6)查询水果的单价。有 4 种水果,苹果(apples)、梨(pears)、桔子(oranges)和葡萄(grapes),
    作业3(5)输入五级制成绩(A-E),输出相应的百分制成绩(0-100)区间,要求使用 switch语句。
    作业3(4)循环输入多个年份 year,判断该年是否为闰年。判断闰年的条件是:能被 4 整除但不能被100 整除,或者能被 400 整除。输入-1退出程序执行
    P39-习题2-5
    P39-习题2-7
    计算N户电费
    P39-习题2-4
    P39-习题2-3
  • 原文地址:https://www.cnblogs.com/nuaaydh/p/4354420.html
Copyright © 2020-2023  润新知