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;
            });
        });
    

      

  • 相关阅读:
    梯度下降算法 (转)
    机器学习
    杭电1097-A hard puzzle
    动态规划初步习题(紫书)
    4.21考试题解
    【bzoj4445 scoi2015】小凸想跑步
    【bzoj4444 scoi2015】国旗计划
    【bzoj4443 scoi2015】小凸玩矩阵
    【luogu P4007 清华集训2017】小Y和恐怖奴隶主
    【luoguP4006 清华集训2017】小Y和二叉树
  • 原文地址:https://www.cnblogs.com/nuaaydh/p/4354420.html
Copyright © 2011-2022 走看看