凯云水利水电工程造价管理系统 技术解析(十一) 中间单价(二)

来源:互联网 发布:真人视讯软件购买 编辑:程序博客网 时间:2024/04/27 22:29
中间单价
功能实现

中间单价包含三个部分:一个是中间单价列表,一个是中间单价定额组成表,一个是中间单价定额人材机组成表,中间单价列表,你可以对其进行新增,删除和修改。当点击时,点击添加会在datagrid里面增加一行数据,而数据里面的代号是自动增加,增加完一行数据,你就可以对他进行相应的修改,而修改是在datagrid里面操作的。

    中间单价定额组成表数据处理包括添加定额、新建定额、删除 。

 

   点击一下中间单价的添加定额、会弹出一个窗体,里面有数据的我们·可以通过多条件查询把数据给查询出来,然后双击把数据添加到定额表,而定额里面的数据,我们也可以通过新建定额来进行添加。我们如果觉得数据不好还可以把它给删除。

中间人材机的功能有添加,删去,替换,复制、粘贴,上移,下移:复制现有的数据,复制后的数据代号后会有”复制“两字,整数进行区分。然后进行粘贴到最后一行。


//下面的就是定额组成的添加定额



下面就是生成这个界面的html代码

 <div id="w添加定额" class="easyui-dialog" title="定额选择" style="width:800px;height:550px;left:70px;top:40px" >       <table>        <tr>         <td>         <table>         <tr>            <input id="combobox" class="easyui-combobox"  data-options="onSelect:Todecidetree" style="width:200px" /><br />            </tr>             <div class="easyui-panel" title="章节名称" style="width:200px;height:365px">                  <ul id="Tree" class="easyui-tree" data-options="onClick:onClickRowTree"> </ul>         </div>         </table >          <input  style="width:200px;height:100px"  value="场内配运水泥,,骨料,投料,加水,<br/>          加外加剂,搅拌,出料,清洗"/>         </td>         <td>           <table>           <tr>           <td>           <div class="easyui-tabs"  style="width:350px;height:0px">            <div id="Base" title="基础定额" style="padding:10px">                           <table>                <tr>                <td>                  <table id="BaseToDecidedetailed" class="easyui-datagrid" style="width:350px;height:180px" data-options="onDblClickRow:onClickRowbaseselect,singleSelect:true">                   <thead>                    <tr>                         <th data-options="field:'QuoteCode' ,width:60,align:'center'" >定额号</th>                         <th data-options="field:'Name' ,width:120,align:'center'" > 名称</th>                         <th data-options="field:'Unit' ,width:60,align:'center'" >单位</th>                         <th data-options="field:'buchong' ,width:80,align:'center'" >补充</th>                     </tr>                   </thead>                  </table>                  </td>                      </tr>                </table>                  </div>                 <div id="w补充定额" title="补充定额" style="padding:10px">                           <table>                <tr>                 <td>                  <table id="replenish" class="easyui-datagrid" style="width:350px;height:180px" data-options="onDblClickRow:onClickRowreplenishselect,singleSelect:true">                   <thead>                    <tr>                         <th data-options="field:'QuoteNumber' ,width:60,align:'center'" >定额号</th>                         <th data-options="field:'Name' ,width:120,align:'center'" > 名称</th>                         <th data-options="field:'Unit' ,width:60,align:'center'" >单位</th>                         <th data-options="field:'buchong' ,width:60,align:'center'" >补充</th>                     </tr>                   </thead>                  </table>                  </td>                      </tr>                </table>                  </div>                 </div>                   <td>                  <fieldset>                     <legend style="color: #3955C1">模糊查询</legend>                     关键字:<br />                     <input id="Name" /><br />                     代号:<input id="Code"  /><br />                     范围:<br />                     <input id="comboboxScope" class="easyui-combobox" id="comboboxScope" /><br />                     <input type="checkbox" id="diminquire" />模糊查询<br /><br /><br />                     <a onclick="inquirekey()"> <input  type="submit" value="查询" /></a>                    </fieldset>                    </td>             </td>           </tr>           </table>           <table>            <tr>            <td>             <table id="AlreadySelect" class="easyui-datagrid" title="已选择定额" data-options="onClickRow:onClickYIHANG" style=" width:350px;height:180px" >                 <thead>                  <tr>                      <th data-options="field:'bianhao' ,width:60,align:'center'" >编号</th>                      <th data-options="field:'mingcheng' ,width:120,align:'center'" > 名称</th>                      <th data-options="field:'danwei' ,width:80,align:'center'" >单位</th>                      <th data-options="field:'shuliang' ,width:60,align:'center'" >数量</th>                       </tr>                 </thead>                </table>              </td>                  <td style="padding:0px">                   <a onclick="RemoveYiHang()" ><input type="submit" value="移除" /></a>                  </td>          </tr>                  </table>                                                                                                                                                        <a onclick="confirmSelect()"> <input  type="submit" value="确定" /></a>                <a onclick="" ><input type="submit" value="取消" /></a>          </td>        </tr>       </table>      </div>

绑定下拉框,html代码

<input id="combobox" class="easyui-combobox"  data-options="onSelect:Todecidetree" style="width:200px" /><br />

第一步:绑定定额版本下拉框;存储过程


第二步;绑定定额版本下拉框、逻辑层

  public DataTable TodecideVersions()        {            SqlParameter[] mySQL = {                                   new SqlParameter("@type",SqlDbType.Char),                                     };            mySQL[0].Value = "TodecideVersions";//这数据组要对应数据库的@type类型            DataTable dt = Centre.DAL_SelectDB_Par("CenterPrice", mySQL);            return dt;        }
第三步:绑定定额版本下拉框、控制器
  public ActionResult TodecideVersions()        {            DataTable dt = Centre.TodecideVersions();//这是调用逻辑层的方法            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);//这是转换成json格式            return Json(listReturn, JsonRequestBehavior.AllowGet);         }

第四步:绑定定额版本下拉框、界面层

 function TodecideVersions() {                        $.getJSON("/ZhongJianDanJia/TodecideVersions/",                               function (data) {                                                                $('#combobox').combobox({ data: data, valueField: 'QuoteEditionID',                              textField: 'QuoteEditionName'                               });//这就是绑定下拉框的代码,'QuoteEditionID'、'QuoteEditionName'这两个值要对应存储过程的值才能绑上                                                              });                }

接下来就是,选中下拉框查询下拉树

第一步:存储过程


第二步:选中下拉框查询下拉树、逻辑层

  public DataTable ChaXunShuXing(int Int_QuoteEditionID)        {            SqlParameter[] mySQL = {                                   new SqlParameter("@type",SqlDbType.Char),                                     new SqlParameter("@QuoteEditionID",SqlDbType.Char),                                                                    };            mySQL[0].Value = "ChaXunShuXing";//这数组要对•应@type类型            mySQL[1].Value = Int_QuoteEditionID;             DataTable dt = Centre.DAL_SelectDB_Par("CenterPrice", mySQL);            return dt;        }

第三步:选中下拉框查询下拉树、控制器

  public ContentResult Todecidetree(string Int_QuoteEditionID)        {            DataTable dt = Centre.ChaXunShuXing(Convert.ToInt32(Int_QuoteEditionID));//这是调用逻辑层的方法            StringBuilder stringbuilder = new StringBuilder();这是一个实例化            stringbuilder.Append(GetDataString(dt, "0"));//这是调用下面的方法            var r = GetDataString(dt, "0");            if (r.Length > 0)//这是判断有数据就返回下面的,否则就返回1            {                stringbuilder = stringbuilder.Remove(stringbuilder.Length - 2, 2);                return Content(stringbuilder.ToString());            }            else            {                return Content("1");            }        }        public string GetDataString(DataTable dt, string id)        {//这就是被上面调用的方法            StringBuilder stringbuilder = new StringBuilder();//这又是一个实例化            DataView dv = new DataView(dt); //把上面查出来的值放到dataview里面            dv.RowFilter = "BaseQuoteClassesFur_ID=" + id;//这就是通过父ID来查找节点            DataTable dtChild = dv.ToTable();            if (dtChild.Rows.Count > 0)            {//这就是判断如果大于0,就还有子节点                stringbuilder.Append("[");                for (int i = 0; i < dtChild.Rows.Count; i++)                {                    string leiid = dtChild.Rows[i]["BaseQuoteClassesID"].ToString();//这是获取主键ID,用它们来查找父节点                    string chidstring = GetDataString(dt, dtChild.Rows[i]["BaseQuoteClassesID"].ToString());//这就是调用自身的方法                    if (!string.IsNullOrEmpty(chidstring))//这是判断是否还有子节点                    {                        stringbuilder.Append("{ \"id\":\"" + dtChild.Rows[i]["BaseQuoteClassesID"].ToString() + "\",\"text\":\"" + dtChild.Rows[i]["BaseQuoteClassesName"].ToString() + "\",\"state\":\"closed\",\"children\":");                        stringbuilder.Append(chidstring);                     }                    else                    {                        stringbuilder.Append("{\"id\":\"" + dtChild.Rows[i]["BaseQuoteClassesID"].ToString() + "\",\"text\":\"" + dtChild.Rows[i]["BaseQuoteClassesName"].ToString() + "\"},");                    }                }                stringbuilder.Replace(",", "", stringbuilder.Length - 1, 1);//这是将逗号替换为空                stringbuilder.Append("]},");            }            return stringbuilder.ToString();        }

第四步:选中下拉框查询下拉树、界面层

function  Todecidetree(){                           $('#Tree').tree({ url: '/ZhongJianDanJia/Todecidetree?Int_QuoteEditionID='+$('#combobox').combobox('getValue') });//这是调用控制器查询下拉树                        }


接下来就到了,点击下拉树查询数据

第一步:点击下拉树查询定额、存储过程


第二步:点击下拉树查询基础·定额、逻辑层

  public DataTable inquireBasicDecide(int Int_BaseQuoteClassesID)        {            SqlParameter[] mySQL = {                                   new SqlParameter("@type",SqlDbType.Char),                                     new SqlParameter("@BaseQuoteClassesID",SqlDbType.Char),                                                                    };            mySQL[0].Value = "inquireBasicDecide";//这是对应存储过程@type类型            mySQL[1].Value = Int_BaseQuoteClassesID;             DataTable dt = Centre.DAL_SelectDB_Par("CenterPrice", mySQL);            return dt;        }

第三步:点击下拉书据查询基础定额、控制器

  public ActionResult inquireBasicDecide(string Int_BaseQuoteClassesID)        {            DataTable dt = Centre.inquireBasicDecide(Convert.ToInt32(Int_BaseQuoteClassesID));//这是调用逻辑层的方法            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);            return Json(listReturn, JsonRequestBehavior.AllowGet);        }

第四步:点击下拉树查询基础定额、界面层

 function onClickRowTree() {                           $.getJSON("/ZhongJianDanJia/inquireBasicDecide?Int_BaseQuoteClassesID=" +$('#Tree').tree('getSelected').id+ "&",                               function (data) {//点击下拉树,查询基础定额                                    $('#BaseToDecidedetailed').datagrid('loadData',data);                                                              });                }

下面就是查询补充定额



第一步:查询补充定额、存储过程



第二步:查询补充定额、逻辑层

  public DataTable replenish(int Int_BuildProjectID)        {            SqlParameter[] mySQL = {                                   new SqlParameter("@type",SqlDbType.Char),                                     new SqlParameter("@BuildProjectID",SqlDbType.Char),                                        };            mySQL[0].Value = "replenish";            mySQL[1].Value = Int_BuildProjectID;             DataTable dt = Centre.DAL_SelectDB_Par("CenterPrice", mySQL);            return dt;        }

第三步:查询补充定额、控制器

  public ActionResult replenish(string Int_BuildProjectID)        {            DataTable dt = Centre.replenish(Convert.ToInt32(Int_BuildProjectID));//这是调用逻辑层的代码            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);            return Json(listReturn, JsonRequestBehavior.AllowGet);        }

第四步:查询补充定额、界面层

 function  replenish(){                       $.getJSON("/ZhongJianDanJia/replenish?Int_BuildProjectID="+@Session["项目ID"],                               function (data) {                                $('#replenish').datagrid('loadData',data); //这是把查出来的数据绑定给相应的datagrid                               });                }

下面就是多条件精确查询和多条件模糊查询。就以基础定额为例


第一步:多条件精确查询基础定额


第一步:多条件模糊查询基础定额



第二步:多条件精确查询基础定额、逻辑层

 public DataTable InquireFoundation(string Str_Code, string Str_Name, int Int_Tree)        {            SqlParameter[] mySQL = {                                   new SqlParameter("@type",SqlDbType.Char),                                     new SqlParameter("@QuoteCode",SqlDbType.Char),                                   new SqlParameter("@Name",SqlDbType.Char),                               new SqlParameter("@BaseQuoteClassesID",SqlDbType.Int),                                                                };            mySQL[0].Value = "InquireFoundation";//这是对应存储过程的@type类型            mySQL[1].Value = Str_Code;            mySQL[2].Value = Str_Name;            mySQL[3].Value = Int_Tree;            DataTable dt = Centre.DAL_SelectDB_Par("CenterPrice", mySQL);            return dt;        }

第二步:多条件模糊查询基础定额、逻辑层

  public DataTable dim_InquireFoundation(string Str_Code, string Str_Name, int Int_Tree)        {            SqlParameter[] mySQL = {                                   new SqlParameter("@type",SqlDbType.Char),                                     new SqlParameter("@QuoteCode",SqlDbType.Char),                                   new SqlParameter("@Name",SqlDbType.Char),                               new SqlParameter("@BaseQuoteClassesID",SqlDbType.Int),                                                                };            mySQL[0].Value = "dim_InquireFoundation";//这是对应存储过程的@type类型            mySQL[1].Value = Str_Code;            mySQL[2].Value = Str_Name;            mySQL[3].Value = Int_Tree;             DataTable dt = Centre.DAL_SelectDB_Par("CenterPrice", mySQL);            return dt;        }

第三步:多条件精确查询基础定额、控制器

public ActionResult InquireFoundation(string Str_Code, string Str_Name, string Int_Tree)        {            DataTable dt = Centre.InquireFoundation(Str_Code, Str_Name, Convert.ToInt32(Int_Tree));//这是调用逻辑层的方法            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);            return Json(listReturn, JsonRequestBehavior.AllowGet);        }

第三步:多调价模糊查询基础定额、控制器

  public ActionResult dim_InquireFoundation(string Str_Code, string Str_Name, string Int_Tree)        {            DataTable dt = Centre.dim_InquireFoundation(Str_Code, Str_Name, Convert.ToInt32(Int_Tree));//这也是调用逻辑层的方法            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);            return Json(listReturn, JsonRequestBehavior.AllowGet);        }

第四步:多条件模糊查询和多条件精确查询基础定额

function inquirekey(){            if(document.getElementById("diminquire").checked ==false){ //判断是不是模糊查询                 if($('#Tree').tree('getSelected')){//这是判断选不选中下拉树                  $.getJSON("/ZhongJianDanJia/InquireFoundation?Str_Code=" +$('#Code').val()+ "&"                                           +"Str_Name="+$('#Name').val()+"&"                                                                                        +"Int_Tree="+$('#Tree').tree('getSelected').id+"&"  ,                function (data) {                      $('#BaseToDecidedetailed').datagrid('loadData', data);   //这是把查出来的数据绑定给相应的datagrid                });                }else{                 alert("请选择下拉树");                                }          }else{                  if($('#Tree').tree('getSelected')){//判断选不选中下拉树                 $.getJSON("/ZhongJianDanJia/dim_InquireFoundation?Str_Code=" +$('#Code').val()+ "&"                                           +"Str_Name="+$('#Name').val()+"&"                                                                                        +"Int_Tree="+$('#Tree').tree('getSelected').id+"&"  ,                function (data) {                      $('#BaseToDecidedetailed').datagrid('loadData', data);  //这是把查出来得数据绑定给相应的datagrid                 });                }else{                 alert("请选择下拉树");                 }      }}

双击基础定额绑定数据给下面的datagrid





双击基础定额绑定数据给下面的datagrid的代码

 var base=0;    var BaseYanCi=0;    var Base1=0;    function onClickRowbaseselect(){              for(var i=0;i<  $('#CentreConstitute').datagrid('getData').rows.length;i++){ //这是遍历所有定额组成,用它和选中的基础定额判断,是否有重复                    if($('#CentreConstitute').datagrid('getData').rows[i]["Code"]== $('#BaseToDecidedetailed').datagrid('getSelected').QuoteCode&$('#CentreConstitute').datagrid('getData').rows[i]["Name"]==$('#BaseToDecidedetailed').datagrid('getSelected').Name){ 判断是否有重复                          base=1; base等于1就有重复                    } else{                                        }}            if(base==1){            alert("已有相同");            base=0;            } else{                  if(BaseYanCi==1){//这是让它下一次再执行,原因就是一开始,下面的已选择的定额datagrid没有数据局,就不需要判断               for(var j=0;j<$('#AlreadySelect').datagrid('getData').rows.length;j++){                   if(  $('#AlreadySelect').datagrid('getData').rows[j]["bianhao"]==  $('#BaseToDecidedetailed').datagrid('getSelected').QuoteCode&$('#AlreadySelect').datagrid('getData').rows[j]["mingcheng"]==$('#BaseToDecidedetailed').datagrid('getSelected').Name){ //这是判断基础定额和下面的已选择的定额是否有相同数据                       Base1=1; // Base1=1就是有重复                  }else{}                }               }              BaseYanCi=1;                 if(Base1==1){                 alert("已1有相同");                 Base1=0;                 }else{                 var f= $('#AlreadySelect').datagrid('getData');//这是获取所有数据                 $('#AlreadySelect').datagrid("insertRow", {//这是新增一行空白行                index: f.rows.length,//这是最后的长度                 row: {}                });               $('#AlreadySelect').datagrid('getData').rows[f.rows.length-1]["bianhao"]=  $('#BaseToDecidedetailed').datagrid('getSelected').QuoteCode;             $('#AlreadySelect').datagrid('getData').rows[f.rows.length-1]["mingcheng"]=  $('#BaseToDecidedetailed').datagrid('getSelected').Name;             $('#AlreadySelect').datagrid('getData').rows[f.rows.length-1]["danwei"]=  $('#BaseToDecidedetailed').datagrid('getSelected').Unit;  //这是给下面的datagrid赋值             $('#AlreadySelect').datagrid('getData').rows[f.rows.length-1]["shuliang"]=1;  //这是给下面的datagrid赋值               $('#AlreadySelect').datagrid('refreshRow',  f.rows.length-1);//这是刷新一行,才能把数据显示出来               Base1=0;base=0; }               }    }

接下来就是已选择定额的移除

  var YIhang="";          function onClickYIHANG(index){//这是已选择定额的点击事件           YIhang=index;//这就是把选中的索引赋值给YIhang       }         function RemoveYiHang(){           $('#AlreadySelect').datagrid('deleteRow',YIhang);//这就是选中哪一行移除  }

下面就是点击确定后把数据增加给定额组成

第一步:增加定额组成存储过程


第二步:增加定额组成逻辑层

 public int confirmSelectAdd_constitute(string Str_Code, string Str_Name, string Int_Unit, string Str_Amount, int Int_CenterPriceID)        {            SqlParameter[] mySQL = {                                   new SqlParameter("@type",SqlDbType.Char),                                                                                                                                                                                                    new SqlParameter("@Code",SqlDbType.Char),                                         new SqlParameter("@Name",SqlDbType.Char),                                           new SqlParameter("@Unit",SqlDbType.Char),                                             new SqlParameter("@Counts",SqlDbType.Char),                                             new SqlParameter("@CenterPriceID",SqlDbType.Int),                                                                                  };            mySQL[0].Value = "confirmSelectAdd_constitute";            mySQL[1].Value = Str_Code;            mySQL[2].Value = Str_Name;            mySQL[3].Value = Int_Unit;            mySQL[4].Value = Str_Amount;            mySQL[5].Value = Int_CenterPriceID;             int i = Centre.DAL_OPTableDB_Par("CenterPrice", mySQL);            return i;        }

第三步:增加定额组成控制器

  public ContentResult confirmSelectAdd_constitute(string Str_Code, string Str_Name, string Int_Unit, string Str_Amount, string Int_CenterPriceID)        {            int i = Centre.confirmSelectAdd_constitute(Str_Code, Str_Name, Int_Unit, Str_Amount, Convert.ToInt32(Int_CenterPriceID));            string k = i.ToString();            return Content(k);        }

第四步:增加定额组成界面层

  function confirmSelect(){                                      for(var i=0;i<  $('#AlreadySelect').datagrid('getData').rows.length;i++){//这是遍历datagrid里面所有数据进行添加                                             $.getJSON("/ZhongJianDanJia/confirmSelectAdd_constitute?Str_Code=" +  $('#AlreadySelect').datagrid('getData').rows[i]["bianhao"]+ "&"                                           +"Str_Name="+ $('#AlreadySelect').datagrid('getData').rows[i]["mingcheng"]+"&"                                                                                        +"Int_Unit="+ $('#AlreadySelect').datagrid('getData').rows[i]["danwei"]+"&"                                            +"Str_Amount="+  $('#AlreadySelect').datagrid('getData').rows[i]["shuliang"]+"&"                                            +"Int_CenterPriceID="+$('#centreGetPrice').datagrid('getSelected').CenterPriceID                                                                                  ,                function (data) {                        Base=0;//每添加一遍就要清零,方便下一次判断,用在双击基础定额里判断                   $.getJSON("/ZhongJianDanJia/InquireMiddleConstitute?Int_CenterPriceID="+  $('#centreGetPrice').datagrid('getSelected').CenterPriceID,                                     function (data) { //这是查询一遍定额组成                                      $('#w添加定额').window('close')//这是把窗体关闭                                    $('#CentreConstitute').datagrid('loadData',data);//把查询出来的数据绑定给相应的datagrid                                                                     });                                        });             }                   } 

接下来就到了新建定额:


打开窗体的html代码

 <div id="Newwindow" title="新建定额" class="easyui-window" style="width:300px;height:200px;left:500px;top:150px" >                        <table>            <tr>            <td>编号:<input id="Txt_Code" /></td>                        </tr>            <tr>           <td>名称:<input id="Txt_Name" /></td>            </tr>            <tr>                         <td>单位:<input id="Com_Unit" class="easyui-combobox"   /></td><br />            </tr>            <tr>            <td>数量:<input id="Txt_Amount" /></td>               </tr>                                     </table>         <center><input type="submit" value="确定" onclick="Newconfirm()"/>   <input  type="submit" value="取消" onclick="Newcancel()" /></center>                  </div>

//下面就是打开窗体编号是自动生成的

  function NewToDecide(){                   if( $('#centreGetPrice').datagrid('getSelected')){//这是判断是否选中中间单价               $('#Newwindow').window('open'); //窗体打开               $.getJSON("/ZhongJianDanJia/BetweenCode/"                                        ,                function (data) {//这是查询一遍代号加一的方法                               var tt="AD"+data[0].BetweenCode;                   $('#Txt_Code').val(tt);//这就是把拼接的字符串赋给文本                  });           }          else{          alert("请?选?择?中D间?列¢D表À¨ª");          }        }

接下来就到了点击确定后新建定额

第一步:新建定额的存储过程



第二步:新建定额的逻辑层
   public int AddNewToDecide(string Str_Txt_Code, string Str_Txt_Name, string Str_Txt_Unit, string Str_Txt_Amount, int Int_CenterPriceID)        {            SqlParameter[] mySQL = {                                   new SqlParameter("@type",SqlDbType.Char),                                                                                                                                                                                                    new SqlParameter("@Code",SqlDbType.Char),                                         new SqlParameter("@Name",SqlDbType.Char),                                           new SqlParameter("@Unit",SqlDbType.Char),                                             new SqlParameter("@Counts",SqlDbType.Char),                                             new SqlParameter("@CenterPriceID",SqlDbType.Int),                                                                                     };            mySQL[0].Value = "AddNewToDecide";//这是对应数据库存储过程@type类型            mySQL[1].Value = Str_Txt_Code;            mySQL[2].Value = Str_Txt_Name;            mySQL[3].Value = Str_Txt_Unit;            mySQL[4].Value = Str_Txt_Amount;            mySQL[5].Value = Int_CenterPriceID;            int i = Centre.DAL_OPTableDB_Par("CenterPrice", mySQL);//这是把所有参数传给数据库mySQL            return i;        }
第三步:新建定额的控制器
 public ContentResult AddNewToDecide(string Str_Txt_Code, string Str_Txt_Name, string Str_Txt_Unit, string Str_Txt_Amount, string Int_CenterPriceID)        {            int i = Centre.AddNewToDecide(Str_Txt_Code, Str_Txt_Name, Str_Txt_Unit, Str_Txt_Amount, Convert.ToInt32(Int_CenterPriceID));//这是调用逻辑层的方法            string k = i.ToString();//转换字符窜            return Content(k);//这是返回给界面的值        }

第四步:新建定额、界面层

  var  XingJianPanDuan=0;         function  Newconfirm(){               for(var i=0;i<$('#CentreConstitute').datagrid('getData').rows.length;i++){//这是遍历所有定额组成的数据,用文本的数据和所有定额组成的数据来判断来是否有重复                                      if($('#CentreConstitute').datagrid('getData').rows[i]["Code"]==$('#Txt_Code').val()){ //用文本的数据和所有定额组成的数据来判断来是否有重复                        XingJianPanDuan=1;//如果XingJianPanDuan等于1,就重复                  }else{                     XingJianPanDuan=0;                  }              }              if(XingJianPanDuan==0){               $.getJSON("/ZhongJianDanJia/AddNewToDecide?Str_Txt_Code=" +$('#Txt_Code').val()+ "&"                                                        +"Str_Txt_Name="+$('#Txt_Name').val()+"&"                                                         +"Str_Txt_Unit="+$('#Com_Unit').combobox('getText')+"&"                                                         +"Str_Txt_Amount="+$('#Txt_Amount').val()+"&"                                                         +"Int_CenterPriceID="+$('#centreGetPrice').datagrid('getSelected').CenterPriceID,                                                        function(data){   alert("添加成功");XingJianPanDuan=0;//添加成功就清零                         $.getJSON("/ZhongJianDanJia/InquireMiddleConstitute?Int_CenterPriceID="+  $('#centreGetPrice').datagrid('getSelected').CenterPriceID,                                     function (data) {                                               $('#CentreConstitute').datagrid('loadData',data);//把查询出来的数据赋值给相应的datagrid                                      $('#Newwindow').window('close');//关闭窗体                                      $('#Txt_Code').val("");//清空文本                                      $('#Txt_Name').val("");                                      $('#Txt_Unit').val("");                                      $('#Txt_Amount').val("");                               });                                                                                       });          }else{            alert("代号重复,请关闭窗体重新进入");          }       }
仅供学习,禁止用于商业用途




1 0
原创粉丝点击