⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 delegationedit.aspx

📁 尚洋仓库管理系统,对仓库
💻 ASPX
📖 第 1 页 / 共 3 页
字号:
            addClickEvent(row);
            
            var cell=row.insertCell();
            cell.className="td1";
            cell.innerText=document.all("txtId").value;

            cell=row.insertCell();
            cell.className="td1";                
            cell.innerText=document.all("txtStuffNo").value;
            
            cell=row.insertCell();
            cell.className="td1";
            cell.innerText=document.all("txtStuffName").value+" ";
            
            cell=row.insertCell();
            cell.className="td1";
            cell.innerText=document.all("txtStuffSpec").value+" ";
              
              
            cell=row.insertCell();
            cell.className="td1";                
            cell.innerText=document.all("txtQuantity").value;
            
            cell=row.insertCell();
            cell.className="td1";
            cell.innerText=document.all("txtPrice").value+" ";
            
            cell=row.insertCell();
            cell.className="td1";
            cell.innerText=document.all("txtUnit").value+" ";
              
              
            cell=row.insertCell();
            cell.className="td1";
            cell.innerText=document.all("txtPrice").value*document.all("txtQuantity").value;
                
        }
    }
     function addMoveEvent(obj)
    {
        obj.attachEvent("onmouseover",function(){RowMouseOver(obj);});
    }
    function addOutEvent(obj)
    {
        obj.attachEvent("onmouseout",function(){RowMouseOut(obj);});
    }
    function addClickEvent(obj)
    {
        obj.attachEvent("onclick",function(){modifyRecord(obj);});
    }
    
    function modifyRecord(obj)
    {
        if(obj==null||obj=="undefined")
        {
            alert("请先选择要修改的物料");
            return;
        }
        userOperate="modify";
        chooseTr(obj);
        document.all("txtId").value=vbTrim(obj.cells[0].outerText);
        document.all("txtStuffNo").value=vbTrim(obj.cells[1].outerText);
        document.all("txtStuffName").value=vbTrim(obj.cells[2].outerText);
        document.all("txtStuffSpec").value=vbTrim(obj.cells[3].outerText);
        document.all("txtQuantity").value=vbTrim(obj.cells[4].outerText);
        document.all("txtPrice").value=vbTrim(obj.cells[5].outerText);
        document.all("txtUnit").value=vbTrim(obj.cells[6].outerText);
    }
    
    //是否数字,是否为空,是否为日期,下拉框是否被选中
    //数据验证
    
    function dataValidate()
    {
        if(document.all("txtId").value.length==0)
        {
            alert("请先选择一种物料,然后添加到加工单!\n\n请单击[搜索]");
            return false;
        }
        if(document.all("txtQuantity").value.length==0||document.all("txtQuantity").value<"1")
        {
            alert("请输入该物料的加工数量!");
            return false;
        }
        if(!CheckNumber(document.all("txtQuantity").value))
        {
            alert("加工数量请输入数值类型!");
            return false;
        }
        if(!CheckNumber(document.all("txtPrice").value))
        {
            alert("物料单价请输入数值类型!");
            return false;
        }
        
        //重复记录验证
        for(var iTr=1;iTr<document.all("tb1").rows.length;iTr++)
        {
            if(vbTrim(document.all("tb1").rows[iTr].cells[0].outerText)==document.all("txtId").value)
            {
                //alert("物料[ "+document.all("tb1").rows[iTr].cells[2].outerText+" ]已添加到明细中!");
                document.all("tb1").rows[iTr].cells[4].innerText=document.all("txtQuantity").value;
                document.all("tb1").rows[iTr].cells[7].innerText=document.all("txtQuantity").value*document.all("txtPrice").value;
                alert("加工数量已更新!");
                return false;
            }
        }
        return true;
    }
    
    //删除明细项目
    function deleteDetails()
    {
        if(currentTR==null||currentTR=="undefined")
        {
            alert("请先选择要删除的物料");
        }
        else
        {
             var obj;
            var obj2=currentTR;
            if((obj=currentTR.nextSibling)!=null)
            {
                currentTR=obj;
            }
            else
            {
                if((obj=currentTR.previousSibling)!=null)
                {
                    currentTR=obj;
                }
                else
                {
                    currentTR=null;
                }
            }
            
            tb1.deleteRow(obj2.rowIndex);
            if(currentTR!=null)
            {
                chooseTr(currentTR);
            }
        }
    }
    //填充供应商名称
    setSupplier();
    function setSupplier()
    {
        document.all("sltSupplier").innerHTML="";
        var op=document.createElement("OPTION");
        op.value="";
        document.all("sltSupplier").appendChild(op);
        //改XML
        var supplier="<%=SupplierString %>";
        var supplierAry=supplier.split("|");
        for(var ii=0;ii<supplierAry.length;ii++)
        {
            var ary=supplierAry[ii].split("*");
            var op=document.createElement("OPTION");
            op.value=ary[0];
            op.innerText=ary[1];
            document.all("sltSupplier").appendChild(op);
            
        }
    }
    //提交服务器
    function PostToServer(op)
    {
        //
        
        
        if(document.all("sltSupplier").value=="")
        {
            alert("请先选择加工商!");
            return;
        }
        if(document.all("txtExceptDate").value=="")
        {
            alert("请输入加工完成日期!");
            return;
        }
        if(!CompareDate(document.all("txtExceptDate").value,document.all("txtPurchaseDate").value))
        {
            alert("完成日期不能比下单日期早!\n请从新输入完成日期。");
            return;
        }
        if((vbTrim(document.all("txtPONo").value)).length==0)
        {
            alert("请输外协加工单编号!");
            return;
        }
        if(document.all("tb1").rows.length<2)
        {
            alert("该外协加工单还没任何需要加工的物料或半成品,\n请先添加加工单的物料明细!");
            return;
        }
        
        //产出表的判断
        
        
        var frmDoc=document.frames("frmOutputDetails").document;
        var table2=frmDoc.all("tb1");
        if(frmDoc.all("tb1").rows.length<2)
        {
            alert("该外协加工单还没任何产出的物料或半成品,\n请先添加加工单的产出半成品明细!");
            return;
        }
        
        
        
        var b=false;
        var details;
        var supplierId=document.all("sltSupplier").value;
        var podate=document.all("txtPurchaseDate").value;
        var expectdate=document.all("txtExceptDate").value;
        var pono=document.all("txtPONo").value;
        
        var table=document.all("tb1");
        //验证
        details="op=<%=opflag%>&id="+document.all("pupkid").value+"&supplierId="+supplierId+"&podate="+podate+"&expectdate="+expectdate+"&pono="+pono+"&details=";
        var d="";
        for(var row=1;row<table.rows.length;row++)
        {
            d+=table.rows[row].cells[0].outerText+"*";//物料Id
            d+=table.rows[row].cells[4].outerText+"*";//数量
            d+=table.rows[row].cells[5].outerText+"*";//单价
            d+=table.rows[row].cells[6].outerText+"*";//单位
            d+="0*";
            d+=table.rows[row].cells[7].outerText+"|";//金额
            
            b=true;
        }
        for(var row=1;row<table2.rows.length;row++)
        {
            d+=table2.rows[row].cells[0].outerText+"*";//物料Id
            d+=table2.rows[row].cells[4].outerText+"*";//数量
            d+=table2.rows[row].cells[5].outerText+"*";//单价
            d+=table2.rows[row].cells[6].outerText+"*";//单位
            d+="1*";
            d+=table2.rows[row].cells[7].outerText+"|";//金额
            
            b=true;
        }
        details+=d;
        
        //var d2="&details2=";
        
       
      
        var xmlHttp=new ActiveXObject("microsoft.XMLHTTP");
        xmlHttp.open("POST","handle/delegation_newhandle.aspx",false);
        xmlHttp.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded;");
        xmlHttp.send(details);
        
        var retValue=xmlHttp.responsetext;
        
        if(getState(retValue)=="1")//成功
        {
            if("<%=opflag%>"=="add")      
            {      
                alert("添加外协加工单成功!");
                
             }   
            else
                alert("修改外协加工单成功!");
            window.open("DelegationReport.aspx?id="+getMsg(retValue),null,"height=700,width=750,status=no,toolbar=no,menubar=no,location=no");
            //window.showModalDialog("PurchaseOrderReport.aspx?poid="+getMsg(retValue)+"&pop=1","","dialogWidth:650px;dialogHeight:500px");
        }        
        else
        {
            alert(getMsg(retValue));
        }
        
        
    }
    function getState(s)
    {
        var ary=s.split("|");
        return ary[0];
    }
    function getMsg(s)
    {
        var ary=s.split("|");
        return ary[1];
    }
    
    //修改
    setTimeout("InitializeData()",100);
    function InitializeData()
    {
        var supplierId="<%=supplierId %>";
        selectSltValueByValue(document.all("sltSupplier"),supplierId);
    }
    function selectSltValueByText(objSlt,text)
    {
        objSlt.selectedIndex=0;
        for(var i=0;i<objSlt.options.length;i++)
        {
            //alert(document.all("sltNewCategory").options.length);
            if(objSlt.options[i].outerText==text)
            {
                objSlt.selectedIndex=i;               
                return;
            }
        }
    }
    function selectSltValueByValue(objSlt,value)
    {
        objSlt.selectedIndex=0;
        for(var i=0;i<objSlt.options.length;i++)
        {
           if(vbTrim(objSlt.options[i].value)==value)
           {
           
            objSlt.selectedIndex=i;
            
            return;
           }
        }
    }
</script>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -