物流运交管理系统 货运单管理

来源:互联网 发布:淘宝体检中心打不开 编辑:程序博客网 时间:2024/04/28 05:54

货运单管理

货运单管理。主要是开单功能,开单主要是录入客户信息和客户要寄的货物信息,当客户要求增加货物或减少货物时可以对单进行修改同时货运单信息输入出错时也可以对货运单进行修改,已经审核的数据无法进行修改

货运单主界面:

货运单新增界面:

货运单修改界面:

datebox的格式转换:

未转换时的效果图:

转换后的效果图:

datebox界面html代码:

<input id="dat_CollectTime" class="easyui-datebox" style="width:120px; font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"data-options="formatter:myformatter1"/>

datebox格式转换脚本代码:

function  myformatter1(date) {                                                                       var y = date.getFullYear();          var y = date.getFullYear();          var m = date.getMonth() + 1;          var d = date.getDate();          return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);      }

 

下拉列表(combogrid)效果图:

combogrid界面html代码:

<td align="right"">寄件客户:</td><td> <input id="cbogrid_SendClient" class="easyui-combogrid" style="width:120px;font-family: 微软雅黑; font-size: 21px; color: #FF0000;"data-options="panelWidth: 500,idField: 'ClientID', @*隐藏的列表值*@textField: 'ClientName', @*列表显示的文本值*@           url: '/FreightReceiptsManage/SelecteClientInformation', @*路径*@columns: [[{field:'ClientID',title:'客户ID',width:80,hidden:true},                {field:'ClientNumber',title:'客户编号',width:60,align:'center'},{field:'ClientName',title:'客户名称',width:180},{field:'ClientAbbreviation',title:'客服简称',width:80,align:'right'},{field:'LinkMan',title:'联系人',width:80,align:'right'},{field:'LinkPhone',title:'联系电话',width:100} ]],fitColumns: true"></td> 

货运单管理涉及的表和表关系

货运单管理涉及到的表就有:货运单表(FreightReceiptsList、货运单明细表(MX_ FreightReceiptsList)、客户表(ClientList)、配送领域维护表(DeliveryFieldServiceList)、员工表、属性明细表(MX_AttributeDetailedList

货运单表(FreightReceiptsList

主要包含如下字段信息:货运单ID、取送单号、公司ID、寄件客户ID 收件客户ID、接单时间、要求送达时间、寄件地址、审核否、收件地址、付款条件ID、货运单状态ID、签收确认ID、备注、开单人ID、寄件领域、领域属性维护ID签收单状态    类别、配送方式、扣帐时间

表名

数据类型

主键/外键

说明

FreightReceiptsID

Int

主键

货运单ID

SendNumer

Char

 

取送单号

CompanyID

Int

外键

公司ID

SendClientID

Int

外键

寄件客户ID

CollectClientID

Int

外键

收件客户ID

ConnectTime

datetime

 

接单时间

RequireServiceTime

datetime

 

要求送达时间

SendAddress

char

 

寄件地址

CheckNo

bit

 

审核否

DeliveryFieldServiceID

Int

外键

领域属性维护ID

PayCondition

Int

外键

付款条件ID

FreightReceiptsStateID

Int

外键

货运单状态ID

SignForStateID

Int

外键

签收确认ID

Remark

Char

 

备注

StaffID

Int

外键

开单人ID

SendFieldWord

Char

 

寄件领域

DeliveryFieldServiceID

Int

外键

领域属性维护ID

SignFor

Int

外键

签收单状态ID

ClassesID

Int

外键

类别

DeliveryWayID

Int

外键

配送方式

DductTime

datetime

 

扣帐时间

 

货运单明细表(MX_ FreightReceiptsList

主要包含如下字段信息:货运单明细ID、货物名称、数量、厂牌号、料号、运费单价、货运单ID、单位

列名

数据类型

主键/外键

说明

MX_FreightReceiptsID

Int

主键

货运单明细ID

GoodsName

char

 

货物名称

number

decimal(18, 0)

 

数量

BrandNumber

char

 

厂牌号

MaterialNumber

char

 

料号

FreightMoney

decimal(18, 0)

 

运费单价

FreightReceiptsID

Int

外键

货运单表(主键)

Unit

Char

 

单位

配送领域维护表的字段配送领域维护ID物流地点ID、领域代码、配送属性ID、配送等级ID、配送方式ID、默认否、预计送达天数、删除否

列名

数据类型

主键/外键

说明

DeliveryFieldServiceID

Int

主键

配送领域维护ID

LogisticsPlaceID

Int

外键

物流地点ID

FieldWord

Char

 

领域代码

SXMX_AttributeID

Int

外键

配送属性ID

DeliveryGradeID

Int

外键

配送等级ID

DeliveryWayID

Int

外键

配送方式ID

AdmitNO

 

Bit

外键

默认否

PredictServiceDay

Char

 

预计送达天数

DeleteNo

Bit

 

删除否

 

员工表主要字段有员工ID、员工姓名、员工编号、身份证号码、联系电话、联系地址、物流地点ID、部门ID、备注

 

列名

数据类型

主键/外键

说明

StaffID

Int

主键

员工ID

StaffName

Char

 

员工姓名

StaffNumber

Char

 

员工编号

IdentityCardNumber

Char

 

身份证号码

LinkPhone

Char

 

联系电话

LinkAddress

Char

 

联系地址

LogisticsPlaceID

Int

外键

物流地点ID

Remark

Char

 

备注

DepartmentID

Int

外键

部门ID

 

客户表主要字段有客户ID、客户名称、客户简称、联系人、联系电话、客户编号

 

列名

数据类型

主键/外键

说明

ClientID

Int

主键

客户ID

ClientName

Char

 

客户名称

ClientAbbreviation

Char

 

客户简称

LinkMan

Char

 

联系人

LinkPhone

Char

 

联系电话

ClientNumber

Char

 

客户编号

 

 

关系图:

模块功能的具体实现

界面层功能的实现

下面是生成货运单主界面、新增和修改界面的Html代码:

<div class="easyui-window" style="width:1200px; height:560px; top:1px; left:1px; background-color: #CCCCFF;" title="货运单查询">  <table id="yingsheng" >  <tr style="width:10px;height:5px"> </tr>                 <tr>                                <td align="right">取送单号:</td><td> <input  id="txt_SendNumber" style="width:120px;"></td><td style="width:5px;height:20px"></td>                <td align="right"">公司:</td><td> <input id="cbo_Company" class="easyui-combogrid" style="width:120px;font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"></input></td><td style="width:5px;height:20px"></td>                <td align="right"">寄件客户:</td><td> <input id="cbogrid_SendClient" class="easyui-combogrid" style="width:120px;font-family: 微软雅黑; font-size: 21px; color: #FF0000;"data-options="panelWidth: 500,idField: 'ClientID',textField: 'ClientName',           url: '/FreightReceiptsManage/SelecteClientInformation',columns: [[{field:'ClientID',title:'客户ID',width:80,hidden:true},                {field:'ClientNumber',title:'客户编号',width:60,align:'center'},{field:'ClientName',title:'客户名称',width:180},{field:'ClientAbbreviation',title:'客服简称',width:80,align:'right'},{field:'LinkMan',title:'联系人',width:80,align:'right'},{field:'LinkPhone',title:'联系电话',width:100} ]],fitColumns: true"></td> <td style="width:5px;height:20px"></td>                <td align="right">接单时间:</td><td> <input id="dat_CollectTime" class="easyui-datebox" style="width:120px; font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"data-options="formatter:myformatter1"/></td> <td style="width:5px;height:20px"></td>                <td align="right">至:</td><td> <input id="dat_EndTime" class="easyui-datebox" style="width:120px; font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"data-options="formatter:myformatter1"></input></td><td style="width:30px;height:20px"></td>                 <td><input  " type="submit" onclick="MuchConditionSelecteFreightReceiptsInformation()" value="查询" style="width:60px;color: #FF0000; font-size: 17px" /></td><td> <input  " type="submit" onclick="insertFreightReceipts()" value="新增货运单" style="width:90px;color: #FF0000; font-size: 17px" /></td>                  <td> <input  " type="submit" onclick="UpdateFreightReceipts()" value="修改货运单" style="width:90px;color: #FF0000; font-size: 17px" /></td>                  </tr>                <tr style="height:10px"> </tr>          </table>         <table>         <tr>         <td><table class="easyui-datagrid" id="dgrd_FreightReceipts" style="width:1200px; height:220px" title="货运单信息"data-options="onClickRow:SelecteonClickRow,rownumbers:true,singleSelect:true,iconCls:'icon-商品库存查询'"><thead>   <tr>      <th data-options="field:'FreightReceiptsID',width:100,hidden:true,align:'center',formatter:ZongYunFei">货运单ID</th>       <th data-options="field:'SendNumber',width:120,align:'center'">取送单号</th>       <th data-options="field:'Class',width:100,align:'center'">类别</th>       <th data-options="field:'CompanyName',width:100,align:'center'">公司</th>       <th data-options="field:'ZongYunFei',width:100,align:'center',formatter:selectYunFei">总运费/(元)</th>       <th data-options="field:'SendClient',width:100,align:'center'">寄件客户<input id="werw" type="button" onclick="oc()" value="<<" style="background-color: #FFFFFF" /></th>       <th data-options="field:'SendFieldWord',width:100,align:'center'">寄件领域</th>       <th data-options="field:'SendAddress',width:160,align:'center'">寄件地址</th>        <th data-options="field:'CollectClient',width:100,align:'center'">收件客户</th>       <th data-options="field:'CollectFieldWord',width:100,align:'center'">运交领域</th>         <th data-options="field:'CollectAddress',width:160,align:'center'">收件地址</th>       <th data-options="field:'ConnectTime',width:140,align:'center' ">接单时间</th>       <th data-options="field:'RequireServiceTime',width:140,align:'center'">要求送达时间</th>        <th data-options="field:'AttributeDetailedName',width:100,align:'center'">付款条件</th>       <th data-options="field:'FreightReceiptsState',width:100,align:'center'">货运单状态</th>       <th data-options="field:'SignForState',width:100,align:'center'">签收确认</th>        <th data-options="field:'DeliveryWay',width:100,align:'center'">配送方式</th>      <th data-options="field:'CheckNo',width:100,align:'center',formatter:shenhe">审核状态</th>      <th data-options="field:'StaffName',width:100,align:'center'">开单人</th>             </tr></thead>     </table>    </td>     </tr>     <tr>      <td>      <table class="easyui-datagrid" id="dgrd_Goods" style="width:1200px; height:233px" title="货运单明细" data-options="iconCls:'icon-商品库存查询'"><thead>   <tr>       <th data-options="field:'MX_FreightReceiptsID',width:130,hidden:true,align:'center'">ID</th>      <th data-options="field:'GoodsName',width:200,align:'center'">货物名称</th>      <th data-options="field:'number',width:200,align:'center',editor:'numberbox'">数量</th>      <th data-options="field:'Unit',width:200,align:'center'">单位</th>      <th data-options="field:'BrandNumber',width:200,align:'center'">厂牌号</th>      <th data-options="field:'MaterialNumber',width:200,align:'center'">料号</th>      <th data-options="field:'FreightMoney',width:200,align:'center',editor:'numberbox'">运费单价/(元)</th>      </tr>                                                                                                      </thead>     </table>      </td>     </tr> </table>  </div><div class="easyui-window" id="Wnd_insertFreightReceipts" style="width:1200px; height:550px; top:2px; left:2px; background-color: #CCCCFF;" title="新增货运单">  <table id="s2">  <tr style="width:10px;height:5px"> </tr>                 <tr>                  <td align="right">取送单号:</td><td> <input  readonly="true" id="txt_insertSendNumber" style="width:136px; color: #FF0000; font-size: 13px;"></input></td><td style="width:50px;height:20px"></td>                <td align="right"">公司:</td><td> <input id="cbo_insertCompany" class="easyui-combobox" style="width:140px;font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"></input></td><td style="width:50px;height:20px"></td>                 <td align="right">寄件客户 :</td><td>  <input id="cbogrid_InsertSendClient" class="easyui-combogrid" style="width:140px;font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"data-options="panelWidth: 500,idField: 'ClientID',textField: 'ClientName',           url: '/FreightReceiptsManage/SelecteClientInformation',columns: [[{field:'ClientID',title:'客户ID',width:80,hidden:true},                {field:'ClientNumber',title:'客户编号',width:60,align:'center'},{field:'ClientName',title:'客户名称',width:180},{field:'ClientAbbreviation',title:'客服简称',width:80,align:'right'},{field:'LinkMan',title:'联系人',width:80,align:'right'},{field:'LinkPhone',title:'联系电话',width:100} ]],fitColumns: true"/></td><td style="width:50px;height:20px"></td>                 <td align="right">收件客户 :</td><td>  <input id="cbogrid_InsertColletClient" class="easyui-combogrid" style="width:140px;font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"data-options="panelWidth: 500,idField: 'ClientID',textField: 'ClientName',           url: '/FreightReceiptsManage/SelecteClientInformation',columns: [[{field:'ClientID',title:'客户ID',width:80,hidden:true},                {field:'ClientNumber',title:'客户编号',width:60,align:'center'},{field:'ClientName',title:'客户名称',width:180},{field:'ClientAbbreviation',title:'客服简称',width:80,align:'right'},{field:'LinkMan',title:'联系人',width:80,align:'right'},{field:'LinkPhone',title:'联系电话',width:100} ]],fitColumns: true"/></td> <td> <input  " type="submit" onclick="InsertFreightReceiptsInformation()" value="确认" style="width:60px;color: #FF0000; font-size: 17px" /></td>                   </tr>                <tr style="height:6px"> </tr>               <tr>                <td align="right">接单时间:</td><td> <input  id="txt_insertConnectTime"class="easyui-datetimebox" style="width:140px"></input></td><td style="width:50px;height:20px"></td>                <td align="right"">要求送达时间:</td><td> <input id="txt_insertRequireServiceTime" class="easyui-datetimebox" style="width:140px;font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"></input></td><td style="width:50px;height:20px"></td>                 <td align="right">寄件地址 :</td><td> <input id="txt_insertSendAddress"   style="width:136px; font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"></input></td><td style="width:50px;height:20px"></td>                 <td align="right">收件地址:</td><td> <input id="txt_insertCollectAddress"   style="width:136px; font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"></input></td><td> <input  " type="submit" onclick="Check()" value="审核" style="width:60px;color: #FF0000; font-size: 17px" /></td>                                 </tr>                 <tr style="height:6px"> </tr>                <tr>                <td align="right">付款条件:</td><td> <input id="cbo_insertPayMoney" class="easyui-combobox" id="cbo_insertPayCondition" style="width:140px"></td><td style="width:50px;height:20px"></td>                <td align="right"">类别:</td><td>       <select  style="width:140px;" id="cbo_insertClassesID">          <option value="17">送件</option>          <option value="16">取件</option>      </select></td><td style="width:50px;height:20px"></td>                 <td align="right"">总运费:</td><td> <input id="insertZongYunFei" readonly  style="border-style: hidden; width:140px; font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px; color: #FF0000;" disabled="disabled"></input></td><td style="width:50px;height:20px"></td>                 <td align="right"">开单人:</td><td> <input id="cbo_insertStaff" class="easyui-combobox"  style="width:140px;font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"></input></td>                 <td> <input  " type="submit" onclick="Return()" value="返回" style="width:60px;color: #FF0000; font-size: 17px" /></td>                </tr>                <tr style="height:6px"></tr>                <tr>  <td align="right">  寄件领域:</td><td> <input  id="txt_sendFiledWord"onclick="txt_FieldAddress1()"    style="width:136px;font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"data-options=" "/></td> <td style="width:50px;height:20px"></td>                 <td align="right">(取/送件)运交领域:</td><td>  <input onkeyup="onkeydown1()"  id="txt_collectFiledWord"  onclick="txt_FieldAddress()"  style="width:136px;font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"data-options=" "/></td> <td style="width:50px;height:20px"></td>                   <td align="right"">选择方式:</td><td>       <select  style="width:140px;" id="Select1">          <option value="1">依地址领域</option>          <option value="2">依客户领域</option>      </select></td> <td style="width:70px;height:20px"></td>                  <td align="right"">配送方式:</td><td> <input id="cbo_insertDeliveryWay"data-options="onSelect:onChangeHuoQuShuXingWeiHuID" class="easyui-combobox"  style="width:140px;font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"></input></td><td> <input  " type="submit" onclick="QingKong()" value="清空" style="width:60px;color: #FF0000; font-size: 17px" /></td>                  </tr>          </table>       <table class="easyui-datagrid" id="dgrd_InsertGoods" style="width:1200px; height:460px" title="货运单明细" data-options="onAfterEdit:myonAfterEdit,onClickRow:myonClickRow,singleSelect: true,  toolbar: '#tb', ">  <thead>   <tr>      <th data-options="field:'MX_FreightReceiptsID',width:130,hidden:true,align:'center'">ID</th>      <th data-options="field:'GoodsName',width:200,align:'center',editor:'text'">货物名称</th>      <th data-options="field:'number',width:200,align:'center',editor:'numberbox'">数量</th>      <th data-options="field:'Unit',width:200,align:'center',editor:'text'">单位</th>      <th data-options="field:'BrandNumber',width:200,align:'center',editor:'text'">厂牌号</th>      <th data-options="field:'MaterialNumber',width:200,align:'center',editor:'text'">料号</th>      <th data-options="field:'FreightMoney',width:200,align:'center',editor:'numberbox'">运费单价/(元)</th>      </tr></thead>       </table>  <div id="tb" style="height:auto"><a  class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="TianjiaMingXi()">添加明细</a><a  class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true" onclick="YiChuMingXi()">移除明细</a>                <a  class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true" onclick="EndEditor()">结束编辑</a></div> </div> <div class="easyui-window" id="Wnd_updateFreightReceipts" style="width:1200px; height:550px; top:2px; left:2px; background-color: #CCCCFF;" title="修改货运单">  <table id="s3">  <tr style="width:10px;height:5px"> </tr>                 <tr>                  <td align="right">取送单号:</td><td> <input  readonly="true" id="txt_updateSendNumber" style="width:136px; color: #FF0000; font-size: 13px;"></input></td><td style="width:50px;height:20px"></td>                <td align="right"">公司:</td><td> <input id="cbo_updateCompany" class="easyui-combobox" style="width:140px;font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"></input></td><td style="width:50px;height:20px"></td>                 <td align="right">寄件客户 :</td><td>  <input id="cbogrid_updateSendClient" class="easyui-combogrid" style="width:140px;font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"data-options="panelWidth: 500,idField: 'ClientID',textField: 'ClientName',           url: '/FreightReceiptsManage/SelecteClientInformation',columns: [[{field:'ClientID',title:'客户ID',width:80,hidden:true},                {field:'ClientNumber',title:'客户编号',width:60,align:'center'},{field:'ClientName',title:'客户名称',width:180},{field:'ClientAbbreviation',title:'客服简称',width:80,align:'right'},{field:'LinkMan',title:'联系人',width:80,align:'right'},{field:'LinkPhone',title:'联系电话',width:100} ]],fitColumns: true        "/></td><td style="width:50px;height:20px"></td>                <td align="right">收件客户 :</td><td>  <input id="cbogrid_updateColletClient" class="easyui-combogrid" style="width:140px;font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"data-options="panelWidth: 500,idField: 'ClientID',textField: 'ClientName',           url: '/FreightReceiptsManage/SelecteClientInformation',columns: [[{field:'ClientID',title:'客户ID',width:80,hidden:true},                {field:'ClientNumber',title:'客户编号',width:60,align:'center'},{field:'ClientName',title:'客户名称',width:180},{field:'ClientAbbreviation',title:'客服简称',width:80,align:'right'},{field:'LinkMan',title:'联系人',width:80,align:'right'},{field:'LinkPhone',title:'联系电话',width:100} ]],fitColumns: true"/></td><td style="width:50px;height:20px"></td>                  </tr>                <tr style="height:6px"> </tr>               <tr>                <td align="right">接单时间:</td><td> <input  id="txt_updateConnectTime"class="easyui-datetimebox" style="width:140px"></input></td><td style="width:50px;height:20px"></td>                <td align="right"">要求送达时间:</td><td> <input id="txt_updateRequireServiceTime" class="easyui-datetimebox" style="width:139px;font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"></input></td><td style="width:50px;height:20px"></td>                 <td align="right">寄件地址 :</td><td> <input id="txt_updateSendAddress"   style="width:136px; font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"></input></td><td style="width:50px;height:20px"></td>                 <td align="right">收件地址:</td><td> <input id="txt_updateCollectAddress"   style="width:136px; font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"></input></td>               <td><input " type="submit" onclick="updateShenHe()" value="审核" style="width:60px;color: #FF0000; font-size: 17px" /></td>                 </tr>                 <tr style="height:6px"> </tr>                <tr>                <td align="right">付款条件:</td><td> <input id="cbo_updatePayMoney" class="easyui-combobox" id="cbo_insertPayCondition" style="width:140px"></td><td style="width:50px;height:20px"></td>                 <td align="right"">类别:</td><td>       <select  style="width:140px;" id="cbo_updateClassesID">          <option value="17">送件</option>          <option value="16">取件</option>      </select></td><td style="width:50px;height:20px"></td>                 <td align="right"">总运费:</td><td> <input id="updateZongYunFei" readonly  style="border-style: hidden; width:140px; font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px; color: #FF0000;" disabled="disabled"></input></td><td style="width:50px;height:20px"></td>                 <td align="right"">开单人:</td><td> <input id="cbo_updateStaff" class="easyui-combobox"  style="width:140px;font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"></input></td>                <td><input " type="submit" onclick="Return()" value="返回" style="width:60px;color: #FF0000; font-size: 17px" /></td>                 </tr>                  <tr style="height:6px"> </tr>                 <tr>  <td align="right">  寄件领域:</td><td> <input id="txt_updateSendFiledWord"   style="width:136px;font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"data-options=" "/></td> <td style="width:50px;height:20px"></td>                 <td align="right">(取/送件)运交领域:</td><td>  <input onkeyup="onkeydown2()" id="txt_updateCollectFiledWord"  onclick="txt_updateFieldAddress()"  style="width:136px;font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"data-options=" "/></td> <td style="width:50px;height:20px"></td>                   <td align="right"">选择方式:</td><td>       <select style="width:140px;" id="Select2">          <option value="1">依地址领域</option>          <option value="2">依客户领域</option>      </select></td> <td style="width:70px;height:20px"></td>       <td align="right"">配送方式:</td><td> <input id="cbo_updateDeliveryWay" data-options="onSelect:updateHuoQuShuXingWeiHuID" class="easyui-combobox"  style="width:140px;font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"></input></td>      <td><input " type="submit" onclick="updateFreightReceiptsInformation()" value="确认" style="width:60px;color: #FF0000; font-size: 17px" /></td>                </tr>  <tr style="height:10px"></tr>          </table>       <table class="easyui-datagrid" id="updateGoods" style="width:1200px; height:460px" title="货运单明细" data-options="onClickRow:updateonClickRow,onAfterEdit:updatemyonAfterEdit, singleSelect: true,  toolbar: '#dd', "><thead>   <tr>      <th data-options="field:'MX_FreightReceiptsID',width:130,hidden:true,align:'center'">ID</th>      <th data-options="field:'GoodsName',width:200,align:'center',editor:'text'">货物名称</th>      <th data-options="field:'number',width:200,align:'center',editor:'numberbox'">数量</th>      <th data-options="field:'Unit',width:200,align:'center',editor:'text'">单位</th>      <th data-options="field:'BrandNumber',width:200,align:'center',editor:'text'">厂牌号</th>      <th data-options="field:'MaterialNumber',width:200,align:'center',editor:'text'">料号</th>      <th data-options="field:'FreightMoney',width:200,align:'center',editor:'numberbox'">运费单价/(元)</th>      </tr></thead>       </table>  <div id="dd" style="height:auto"><a  class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="updateTianJiaMingMi()">添加明细</a><a  class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true" onclick="updateYiChuMingXi()">移除明细</a>                <a  class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true" onclick="UpdateEndEditor()">结束编辑</a></div> </div>   <div class="easyui-window" id="Wnd_FieldAddress" style="width:500px; height:300px; top:190px; left:2px; background-color: #9999FF;" title="领域代码">        <table class="easyui-datagrid" id="dgrd_FieldAddress" style="width:500px; height:300px" title="地址领域" data-options="onDblClickRow:youronDblClick,singleSelect: true "><thead>   <tr>       <th data-options="field:'FieldID',width:130,hidden:true,align:'center'">ID</th>      <th data-options="field:'FieldWord',width:120,align:'center'">领域代码</th>      <th data-options="field:'Province',width:120,align:'center'">省份</th>      <th data-options="field:'City',width:120,align:'center'">城市</th>      <th data-options="field:'County',width:120,align:'center'">县区</th>       </tr></thead>      </table>    </div>   <div class="easyui-window" id="Wnd_ClientAddress" style="width:500px; height:300px; top:190px; left:2px; background-color: #9999FF;" title="领域代码">        <table class="easyui-datagrid" id="dgrd_ClientAddress" style="width:500px; height:300px" title="客户领域" data-options=" singleSelect: true,onDblClickRow:myonDblClick "><thead>   <tr>       <th data-options="field:'AddressID',width:130,hidden:true,align:'center'">ID</th>      <th data-options="field:'FieldWord',width:120,align:'center'">领域代码</th>      <th data-options="field:'AddressName',width:120,align:'center'">客户地址</th>      <th data-options="field:'ClientName',width:120,align:'center'">客户名称</th>     <th data-options="field:'ClientAbbreviation',width:120,align:'center'">客户简称</th>       </tr></thead>       </table>    </div> </body>

面是生成货运单主界面、新增和修改界面的脚本代码:

//查询脚本<script type="text/javascript">    $(document).ready(function () {        $("#Wnd_FieldAddress").window("close");         $("#Wnd_ClientAddress").window("close");        windowopen();        SelecteFreightReceiptsInformation();        ComboboxLoaldata();        YinCangLie();        WuLiuDiDianID = @Session["物流地点ID"];//Session["物流地点ID"]是全局变量,在登陆时获取物流地点ID赋值给全局变量Session["物流地点ID"]    });    var WuLiuDiDianID=0;    //下拉框的加载    function ComboboxLoaldata() {//公司中下拉框的加载        $.getJSON("/FreightReceiptsManage/SelecteCompanyInformation",         function (data){                                                             $("#cbo_Company").combobox({ data: data, valueField: 'CompanyID', textField: 'CompanyName' });             //'CompanyID','CompanyName' 要以数据库查出来的列名要保持一致         }       );    }    //查询订单信息    function SelecteFreightReceiptsInformation() {        $.getJSON("/FreightReceiptsManage/SelecteFreightReceiptsInformation",         function (data) {             $("#dgrd_FreightReceipts").datagrid('loadData', data);             //data是控制器传过来的值,'loadData'是将数据加载到datagrid中              ZongYunFei();         });    }    function windowopen() {//打开窗体的方法        $('#Wnd_insertFreightReceipts').window('close');        $('#Wnd_updateFreightReceipts').window('close');    }    //查询订单货物信息    function SelecteonClickRow(index, row) {//index为行索引,row为点击那一行的行数据        $.getJSON("/FreightReceiptsManage/SelectGoods?FreightReceiptsID=" + row.FreightReceiptsID,//通过货运单ID查询属于这个单据的货物         function (data) {             $("#dgrd_Goods").datagrid('loadData', data);         });     }     var JieDanShiJian="";     var YaoQiuSongDaShiJian="";     var JiJianKeHu="";     var GongSi = "";     //多条件查询订单信息     function MuchConditionSelecteFreightReceiptsInformation() {         if ($('#cbogrid_SendClient').combogrid('getValue') == "") { JiJianKeHu = "0"; } else { JiJianKeHu = $('#cbogrid_SendClient').combogrid('getValue'); }// combogrid('getValue')获取下拉列表的值         if ($('#cbo_Company').combobox('getValue') == "") { GongSi = "0"; } else { GongSi = $('#cbo_Company').combobox('getValue'); }          if ($('#dat_EndTime').datebox('getValue') == "" && $('#dat_CollectTime').datebox('getValue') == "") {             JieDanShiJian = "1990-01-02"; YaoQiuSongDaShiJian = "2050-01-02";         }else { YaoQiuSongDaShiJian=$('#dat_EndTime').datebox('getValue'); JieDanShiJian=$('#dat_CollectTime').datebox('getValue'); }         $.getJSON("/FreightReceiptsManage/MuchConditionSelecteFreightReceiptsInformation?SendNumber=" + $('#txt_SendNumber').val()+ "&CompanyID=" + GongSi + "&SendClient=" + JiJianKeHu + "&CollectTime=" + JieDanShiJian + "&EndTime=" +YaoQiuSongDaShiJian + "&",          function (data) {              $("#dgrd_FreightReceipts").datagrid('loadData', data);         });      }      function  myformatter(date) { //日期的格式转换                                                                          var m = date.getMonth() + 1;//获取月份          var d = date.getDate();//获取日期          return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);      }      function  myformatter1(date) { //日期的格式转换                                                                       var y = date.getFullYear();//获取年份          var m = date.getMonth() + 1; //获取月份          var d = date.getDate();//获取日期          return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);      }      //新增订单按钮      function  insertFreightReceipts() {          $('#Wnd_insertFreightReceipts').window('open');           //下拉框绑定          $.getJSON("/BaseInformation/SelectStaffInformation?LogisticsAddressID="+WuLiuDiDianID,         function (data) { //开单人中下拉框的加载             $("#cbo_insertStaff").combobox({ data: data, valueField: 'StaffID', textField: 'StaffName' });          }    );         $.getJSON("/DeliveryFieldAddress/SelectAttributeGather?AttributeGatherID=6",         function (data) { //付款条件中下拉框的加载             $("#cbo_insertPayMoney").combobox({ data: data, valueField: 'MX_AttributeDetailedID', textField: 'AttributeDetailedName' });          }       );         $.getJSON("/FreightReceiptsManage/SelecteCompanyInformation",         function (data) {//公司中下拉框的加载             $("#cbo_insertCompany").combobox({ data: data, valueField: 'CompanyID', textField: 'CompanyName' });         }       );         $('#txt_insertSendNumber').val(danhao());     }     //遍历循环计算总运费     function ZongYunFei(FreightReceiptsID, row, index){         $.getJSON("/FreightReceiptsManage/SelectGoods?FreightReceiptsID=" + FreightReceiptsID,        function (data) {        var Money = 0;        for (var i = 0; i < data.length; i++){            Money = Money + parseInt(data[i].FreightMoney, 10);//parseInt将字符串转换为整形        }        $("#"+ index).val(Money);//将计算出来的总运费赋值给文本     });   }     function selectYunFei(g,row,index){//返回一个文本框给datagrid        return '<input id="' + index + '"readonly="true"type="text" style=" color: #FF0000;border-style: hidden; width:100px;height:15px;background-color: #FFFFFF;" disabled="disabled" />';    }    function shenhe(index, Row) {        if (Row.CheckNo == true) {return "已审核"; }        else {return "未审核"; }    }    function danhao(){//自动生成订单号            var curr_time = new Date();//获取当前日期            var strDate ="DH00"+ curr_time.getFullYear();            var vMon = curr_time.getMonth() + 1;            var vDay = curr_time.getUTCDate();            var vMinutes = curr_time.getMinutes();//获取分钟            var time = curr_time.getHours();//获取小时             var vSeconds = curr_time.getSeconds();  //获取秒            strDate += (vMon < 10 ? "0" + vMon : vMon); //并接字符串            strDate += (vDay < 10 ? "0" + vDay : vDay);//并接字符串             strDate += (time < 10 ? "0" + time : time); //并接字符串            strDate += (vMinutes < 10 ? "0" + vMinutes : vMinutes); //并接字符串            strDate += (vSeconds < 10 ? "0" + vSeconds : vSeconds); //并接字符串            return strDate;     }   </script>//新增脚本<script type="text/javascript">    var tiaoshu=0;    var CheckNo = false;    //审核按钮    function Check() {        CheckNo = true;        alert("审核成功!");    }    //点击新增确认按钮    function InsertFreightReceiptsInformation() {        $("#dgrd_FreightReceipts").datagrid('reload');// reload是刷新datagrid        $('#dgrd_InsertGoods').datagrid('endEdit', MyIndex);//结束编辑//首先新增货运单信息        $.getJSON("/FreightReceiptsManage/InsertFreightReceiptsInformation?StaffID=" + $("#cbo_insertStaff").combobox("getValue") + "&CheckNo=" + CheckNo + "&SendNumber=" + $("#txt_insertSendNumber").val() + "&CompanyID=" +            $("#cbo_insertCompany").combobox("getValue") + "&SendClientID=" + $("#cbogrid_InsertSendClient").combogrid("getValue") + "&CollectClientID=" + $("#cbogrid_InsertColletClient").combogrid("getValue") + "&ConnectTime=" +           $('#txt_insertConnectTime').datebox('getValue') + "&RequireServiceTime=" + $('#txt_insertRequireServiceTime').datebox('getValue') +             "&SendAddress=" + $("#txt_insertSendAddress").val() + "&CollectAddress=" + $("#txt_insertCollectAddress").val() + "&PayCondition=" + $("#cbo_insertPayMoney").combobox("getValue") +              "&FreightReceiptsStateID=43" + "&SignForStateID=44" + "&ClassesID=" + $("#cbo_insertClassesID").val() + "&sendFiledWordWord=" + $("#txt_sendFiledWord").val() + "&collectFiledWord=" +              "&DeliveryFieldServiceID=" + intsertShuXingWeiHuID+ "&",             function (data) {                 alert("开单成功!");                 $('#Wnd_insertFreightReceipts').window('close');                 data[0].Column1; //获取刚新增订单的主键Id                 var dataMingXi = $('#dgrd_InsertGoods').datagrid('getData');//'getData'是获取datagrid的所有数据                 for (var i = 0; i < dataMingXi.rows.length; i++) {//遍历循环获取货物信息                     if (dataMingXi.rows[i].FreightMoney != undefined) {                         setTimeout(1000);//延迟1秒执行下面语句                         $.getJSON("/FreightReceiptsManage/InsertGoods?GoodsName=" + dataMingXi.rows[i].GoodsName + "&" //新增货运单明细                                                + "Unit=" + dataMingXi.rows[i].Unit + "&"                                                + "number=" + dataMingXi.rows[i].number + "&"                                                + "BrandNumber=" + dataMingXi.rows[i].BrandNumber + "&"                                                + "FreightMoney=" + dataMingXi.rows[i].FreightMoney + "&"                                                + "MaterialNumber=" + dataMingXi.rows[i].MaterialNumber + "&"                                                + "FreightReceiptsID=" + data[0].Column1 + "&",                                           function (data2) {                                               tiaoshu = tiaoshu + 1;                                               if (tiaoshu == dataMingXi.rows.length) {                                                   alert("新增成功!");                                                   $('#Wnd_insertFreightReceipts').window('close');                                                   SelecteFreightReceiptsInformation(); //新增成功后执行重新加载的方法                                               }                                           });                     }                 }             });        }       function TianjiaMingXi() {           $('#dgrd_InsertGoods').datagrid('endEdit', MyIndex); //开始编辑           var RowNumber = $("#dgrd_InsertGoods").datagrid("getRows"); //获取datagrid的 所有行的数据         if (RowNumber.length == 0) {             $("#dgrd_InsertGoods").datagrid("insertRow", {//新增一行空白行                 index: RowNumber.length,//新增到最后一行                 row: {}             });             $('#dgrd_InsertGoods').datagrid('endEdit', MyIndex);//新增一行后结束编辑的那一行数据         }         else {             if (RowNumber[RowNumber.length - 1].FreightMoney.toString().length>0&& RowNumber[RowNumber.length - 1].GoodsName.toString().length>0){                 $("#dgrd_InsertGoods").datagrid("insertRow",{                     index: RowNumber.length,                     row: {}                 });                 $('#dgrd_InsertGoods').datagrid('endEdit', MyIndex);               }             else { //如果没有填写商品的数量或运费进行提示                 alert("请填写完明细信息!");              }                  }     }     var EdIndex = 0;     var MyIndex = "";     //点击添加明细按钮触发的方法     function myonClickRow(index, row) {          MyIndex = index;         if (EdIndex != index) { $('#dgrd_InsertGoods').datagrid('endEdit', EdIndex); } //结束货运单明细行的编辑         $('#dgrd_InsertGoods').datagrid('beginEdit', index); //开始货运单明细行的编辑         EdIndex = index;       }       function myonAfterEdit() {//货运单明细结束编辑时触发的方法           var RowNumber = $("#dgrd_InsertGoods").datagrid("getRows");           var yunfei = 0;            for (var i = 0; i < RowNumber.length; i++) {//遍历循环计算总运费               if (RowNumber[i].FreightMoney!=undefined &RowNumber[i].FreightMoney!="") {               yunfei = yunfei + parseInt(RowNumber[i].FreightMoney, 10);           }           }           $("#insertZongYunFei").val(yunfei);       }     //移除明细按钮     function YiChuMingXi() {         $('#dgrd_InsertGoods').datagrid('deleteRow', MyIndex);//删除datagrid中的 一行数据         MyIndex = -1;     }     </script>//修改脚本<script type="text/javascript">    var MM = 0;var XiuGaiDanHaoID=0;//点击按钮‘修改货运单’信息时触发此方法    function UpdateFreightReceipts() {        MM = 1;        var Row = $("#dgrd_FreightReceipts").datagrid('getSelected');//获取货运单选择的那一行数据赋值给修改货运单窗体         updateShuXingWeiHuID =Row.DeliveryFieldServiceID;        XiuGaiDanHaoID = Row.FreightReceiptsID;        $.getJSON("/FreightReceiptsManage/SelectDeliveryWay?FieldWord=" + Row.CollectFieldWord+"&LogisticsPlaceID="+WuLiuDiDianID, function (data2) {            $("#cbo_updateDeliveryWay").combobox({ data: data2, valueField: 'DeliveryWayID', textField: 'DeliveryWay' });           $("#cbo_updateDeliveryWay").combobox("setValue", Row.DeliveryWayID);        });       $.getJSON("/BaseInformation/SelectStaffInformation?LogisticsAddressID=" + WuLiuDiDianID,         function (data) {             $("#cbo_updateStaff").combobox({ data: data, valueField: 'StaffID', textField: 'StaffName' });             $("#cbo_updateStaff").combobox("setValue", Row.StaffID);         });         $.getJSON("/DeliveryFieldAddress/SelectAttributeGather?AttributeGatherID=6",         function (data) {             $("#cbo_updatePayMoney").combobox({ data: data, valueField: 'MX_AttributeDetailedID', textField: 'AttributeDetailedName' });             $("#cbo_updatePayMoney").combobox("setValue", Row.PayCondition);         });         $.getJSON("/FreightReceiptsManage/SelecteCompanyInformation",         function (data) {             $("#cbo_updateCompany").combobox({ data: data, valueField: 'CompanyID', textField: 'CompanyName' });             $("#cbo_updateCompany").combobox("setValue", Row.CompanyID);         });         if (Row != null) {//如果选择了已经审核的单据会提示此单据已审核不能进行修改             if (Row.CheckNo) { alert("此单据已审核不能进行修改!"); }            else{            $('#Wnd_updateFreightReceipts').window('open');            $("#txt_updateSendNumber").val( Row.SendNumber); $("#txt_updateSendAddress").val( Row.SendAddress);            $("#txt_updateCollectAddress").val(Row.CollectAddress); $("#cbo_updateClassesID").val(Row.ClassesID);            $("#txt_updateSendFiledWord").val(Row.SendFieldWord); $("#txt_updateCollectFiledWord").val(Row.CollectFieldWord);            $("#txt_updateConnectTime").datetimebox("setValue", Row.ConnectTime); $("#txt_updateRequireServiceTime").datetimebox("setValue", Row.RequireServiceTime);            $("#cbogrid_updateSendClient").combogrid("setValue", Row.SendClientID); $("#cbogrid_updateColletClient").combogrid("setValue", Row.CollectClientID);            $.getJSON("/FreightReceiptsManage/SelectGoods?FreightReceiptsID=" + Row.FreightReceiptsID,         function (data) {             var zhonfeiyong = 0;             for (var i = 0; i < data.length; i++) {//遍历循环计算总运费                 zhonfeiyong = zhonfeiyong + parseInt(data[i].FreightMoney, 10);             }             $("#updateZongYunFei").val(zhonfeiyong); //将总运费赋值给文本             $("#updateGoods").datagrid('loadData', data);         });           }           }        else {alert("请选择需要修改的订单!");}    }    var MyupdateIndex = "";   var updateEdIndex = 0;   function updateonClickRow(index, row) { //index为点击的那一行的行索引,row为点击那一行的行数据        MyupdateIndex = index;        if (updateEdIndex != index) { $('#updateGoods').datagrid('endEdit', updateEdIndex); }//endEdit为结束编辑        $('#updateGoods').datagrid('beginEdit', index);//beginEdit为开始编辑        updateEdIndex = index;}//修改货物信息时触发此方法    function updateTianJiaMingMi() {        $('#updateGoods').datagrid('endEdit', MyupdateIndex);        var RowNumber = $("#updateGoods").datagrid("getRows");        if (RowNumber.length == 0) {//如果没有货物信息就新增一行数据            $("#updateGoods").datagrid("insertRow", {                index: RowNumber.length,                row: {}            });            $('#updateGoods').datagrid('endEdit', MyupdateIndex);        }        else {            if (RowNumber[RowNumber.length - 1].FreightMoney.toString().length > 0 && RowNumber[RowNumber.length - 1].GoodsName.toString().length >0){                $("#updateGoods").datagrid("insertRow",{                    index: RowNumber.length,                    row: {}                });                $('#updateGoods').datagrid('endEdit', MyupdateIndex);            }            else {                alert("请填写完明细信息!");            }        }     }     function updateYiChuMingXi() {         $('#updateGoods').datagrid('deleteRow', MyupdateIndex);         MyupdateIndex = -1;     }//输入货物结束编辑后触发此方法计算总运费     function updatemyonAfterEdit(){         var RowNumber = $("#updateGoods").datagrid("getRows");         var yunfei = 0;         for (var i = 0; i < RowNumber.length; i++){             if (RowNumber[i].FreightMoney != undefined & RowNumber[i].FreightMoney != ""){                 yunfei = yunfei + parseInt(RowNumber[i].FreightMoney, 10);             }                                       }         $("#updateZongYunFei").val(yunfei);     }//     function updateFreightReceiptsInformation() {         MM = 0;       var Row = $("#dgrd_FreightReceipts").datagrid('getSelected');//获取选中的那一行数据       $('#updateGoods').datagrid('endEdit', MyupdateIndex);//将修改后的数据传给控制器       $.getJSON("/FreightReceiptsManage/UpdateFreightReceiptsInformation?StaffID=" + $("#cbo_updateStaff").combobox("getValue") + "&CompanyID=" +            $("#cbo_updateCompany").combobox("getValue") + "&SendClientID=" + $("#cbogrid_updateSendClient").combogrid("getValue") + "&CollectClientID=" + $("#cbogrid_updateColletClient").combogrid("getValue") + "&ConnectTime=" +           $('#txt_updateConnectTime').datebox('getValue') + "&RequireServiceTime=" + $('#txt_updateRequireServiceTime').datebox('getValue') +             "&SendAddress=" + $("#txt_updateSendAddress").val() + "&CollectAddress=" + $("#txt_updateCollectAddress").val().toString() + "&PayCondition=" + $("#cbo_updatePayMoney").combobox("getValue") +            "&ClassesID=" + $("#cbo_updateClassesID").val() + "&FreightReceiptsID=" + Row.FreightReceiptsID + "&sendFiledWordWord=" + $("#txt_updateSendFiledWord").val() + "&DeliveryFieldServiceID=" + updateShuXingWeiHuID + "&",             function (data) {                 alert(data);             });             //明细             var updaterow = $('#updateGoods').datagrid('getChanges', 'updated');//获取被修改的所有行的数据             rowsCount1 = updaterow.length;             for (var i = 0; i < rowsCount1; i++) {//循环遍历被修改行的数据传给控制器                 $.getJSON("/FreightReceiptsManage/updateGoods?GoodsName=" + updaterow[i].GoodsName + "&"                                                + "Unit=" + updaterow[i].Unit + "&"                                                + "number=" + updaterow[i].number + "&"                                                + "BrandNumber=" + updaterow[i].BrandNumber + "&"                                                + "FreightMoney=" + updaterow[i].FreightMoney + "&"                                                + "MaterialNumber=" + updaterow[i].MaterialNumber + "&"                                                + "FreightReceiptsID=" + updaterow[i].MX_FreightReceiptsID + "&",                                           function (data2) {                                               alert("修改"+rowsCount1+"条明细成功");                                           });             }                                       var insertrow = $('#updateGoods').datagrid('getChanges', 'inserted'); //获取新增加的所有行的数据             rowsCount = insertrow.length;             for (var i = 0; i < rowsCount; i++) {//循环遍历新增行的数据传给控制器                 if (insertrow[i].FreightMoney!= "" && insertrow[i].FreightMoney != undefined) {                     $.getJSON("/FreightReceiptsManage/InsertGoods?GoodsName=" + insertrow[i].GoodsName + "&"                                                + "Unit=" + insertrow[i].Unit + "&"                                                + "number=" + insertrow[i].number + "&"                                                + "BrandNumber=" + insertrow[i].BrandNumber + "&"                                                + "FreightMoney=" + insertrow[i].FreightMoney + "&"                                                + "MaterialNumber=" + insertrow[i].MaterialNumber + "&"                                                + "FreightReceiptsID=" + Row.FreightReceiptsID + "&",                                           function (data2){                                               alert("新增"+rowsCount+"条明细成功");                                           });                 }else{alert("信息不完整,请填完整明细信息!");}             }                                   var delrow = $('#updateGoods').datagrid('getChanges', 'deleted'); //获取所有被删除的所有行的数据     var rowsCount2 = delrow.length;     for (var k = 0; k < rowsCount2; k++) {//循环遍历被删除行的数据传给控制器                 $.getJSON("/FreightReceiptsManage/daleteGoods?MingXiID=" + delrow[k].MX_FreightReceiptsID + "&",             function (data){                 alert("删除" + rowsCount2 + "条明细成功!");              });              }         $('#Wnd_updateFreightReceipts').window('close');//修改成功后关闭修改窗体         setTimeout(function(){//延迟0.3秒执行此方法             SelecteFreightReceiptsInformation();//重新加载数据到datagrid里          },300);                   }//点击修改窗体的运交领运文本时触发此方法     function txt_updateFieldAddress() {         pd = 1;         $("#Select2").val();         if ($("#Select1").val() == "1") {             $("#Wnd_FieldAddress").window("open");//打开地址领域窗体             $("#Wnd_ClientAddress").window("close");//关闭客户领域窗体             $.getJSON("/FreightReceiptsManage/SelectAddressFiled?FieldWord="+"",         function (data){             $("#dgrd_FieldAddress").datagrid('loadData', data);//加载数据到datagrid         });         }     if ($("#Select2").val() == "2") {         $("#Wnd_ClientAddress").window("open");         $("#Wnd_FieldAddress").window("close");             $.getJSON("/FreightReceiptsManage/SelectClientFiled",         function (data) {             $("#dgrd_ClientAddress").datagrid('loadData', data);         });         } }     var pd=0;//在新增货运单中双击领域地址窗体中的行数据时触发此方法     function myonDblClick(index, Row) {         $("#txt_collectFiledWord").val(Row.FieldWord);//获取双击的那一行的领域代码赋值给运交领域文本框         $("#Wnd_ClientAddress").window("close");     }//在修改货运单中双击领域地址窗体中的行数据时触发此方法     function youronDblClick(index, Row) {         $("#txt_collectFiledWord").val(Row.FieldWord);         $("#Wnd_FieldAddress").window("close");}//点击新增货运单中的寄件领域时触发此方法,查询数据绑定到地址领域窗体中的datagrid    function txt_FieldAddress() {        pd = 1;         $("#Select1").val();         if ($("#Select1").val() == "1") {             $("#Wnd_FieldAddress").window("open");             $.getJSON("/FreightReceiptsManage/SelectAddressFiled?FieldWord="+"",         function (data){             $("#dgrd_FieldAddress").datagrid('loadData', data);         });     }     if ($("#Select1").val() == "2"){         $("#Wnd_ClientAddress").window("open");         $.getJSON("/FreightReceiptsManage/SelectClientFiled",         function (data) {             $("#dgrd_ClientAddress").datagrid('loadData', data);         });     } }//点击修改货运单中的寄件领域时触发此方法,查询数据绑定到地址领域窗体中的datagrid function txt_FieldAddress1() {     pd = 0;     $("#Select1").val();     if ($("#Select1").val() == "1") {         $("#Wnd_FieldAddress").window("open");         $.getJSON("/FreightReceiptsManage/SelectAddressFiled?FieldWord=" + "",         function (data) {             $("#dgrd_FieldAddress").datagrid('loadData', data);         });     }     if ($("#Select1").val() == "2") {         $("#Wnd_ClientAddress").window("open");         $.getJSON("/FreightReceiptsManage/SelectClientFiled",         function (data) {//查询数据绑定到客户领域窗体中的datagrid             $("#dgrd_ClientAddress").datagrid('loadData', data);         });     } } //在新增货运单中双击领域地址窗体中的行数据时触发此方法function myonDblClick(index, Row) {     if (pd == 1) {         if (MM == 0) {             $("#txt_collectFiledWord").val(Row.FieldWord);             $("#Wnd_ClientAddress").window("close");             onkeydown1();//调用onkeydown1方法         } else {             $("#txt_updateCollectFiledWord").val(Row.FieldWord);             $("#Wnd_ClientAddress").window("close");             onkeydown2();//调用onkeydown2方法         }     }     else {         $("#txt_sendFiledWord").val(Row.FieldWord);         $("#Wnd_ClientAddress").window("close");     } }//在修改货运单中双击领域地址窗体中的行数据时触发此方法 function youronDblClick(index, Row) {     if (pd == 1) {         if (MM == 0) {             $("#txt_collectFiledWord").val(Row.FieldWord);             $("#Wnd_FieldAddress").window("close");             onkeydown1();         } else {             $("#txt_updateCollectFiledWord").val(Row.FieldWord);             $("#Wnd_FieldAddress").window("close");             onkeydown2();         }     } else {         $("#txt_sendFiledWord").val(Row.FieldWord);         $("#Wnd_ClientAddress").window("close");     } }     var YinCang = 0;     function YinCangLie() {         if (YinCang == 0){             $('#dgrd_FreightReceipts').datagrid('hideColumn', 'SendFieldWord'); //'hideColumn'隐藏单元格             $('#dgrd_FreightReceipts').datagrid('hideColumn', 'SendAddress');              $("#werw").val(">>");              YinCang = 1;         }         else{             $('#dgrd_FreightReceipts').datagrid('showColumn', 'SendFieldWord');             $('#dgrd_FreightReceipts').datagrid('showColumn', 'SendAddress'); //显示单元格             $("#werw").val("<<");             YinCang = 0;         }      }//点击返回按钮时触发此方法      function Return(){          MM = 0;          $("#Wnd_insertFreightReceipts").window("close");          $("#Wnd_updateFreightReceipts").window("close");      }      var fanfa = "SelectAddressFiled";      var ID = "dgrd_FieldAddress";  //审核货运单,点击审核按钮时触发此方法 function updateShenHe() {       $.getJSON("/FreightReceiptsManage/updateCheckNo?FreightReceiptsID=" + XiuGaiDanHaoID, function(data) { if (data == 1) { alert("审核成功!"); } });   }  //清空数据,点击清空按钮时触发此方法 function QingKong() {     $("#cbo_insertStaff").combobox("setValue","");//设置下拉框的值为空     $("#cbo_insertCompany").combobox("setValue","");$("#cbogrid_InsertSendClient").combogrid("setValue","");////设置下拉列表(combogrid)的值为空 $("#cbogrid_InsertColletClient").combogrid("setValue","");           $('#txt_insertConnectTime').datebox('setValue',"") ; $('#txt_insertRequireServiceTime').datebox('setValue',"") ;             $("#txt_insertSendAddress").val("");  $("#txt_insertCollectAddress").val(""); $("#cbo_insertPayMoney").combobox("setValue","") ;            $("#txt_sendFiledWord").val("");               $("#txt_collectFiledWord").val("");$("#cbo_insertDeliveryWay").combobox("setValue", "");           }          //结束编辑           function EndEditor() {               $('#dgrd_InsertGoods').datagrid('endEdit', MyIndex);             }           function UpdateEndEditor() {                $('#updateGoods').datagrid('endEdit', MyupdateIndex);           }       </script><script type="text/javascript">//在新增货运单窗体运交领域文本中按下键盘时触发此方法    function onkeydown1() { //查询配送领域属性显示到新增货运单界面        if ($("#Select1").val() == 2) { fanfa = "SelectClientFiled"; ID = "dgrd_ClientAddress"; };        $.getJSON("/FreightReceiptsManage/" + fanfa + "?FieldWord=" + $("#txt_collectFiledWord").val(), function (data1) {            $("#" + ID).datagrid('loadData', data1);            fanfa = "SelectAddressFiled"; ID = "dgrd_FieldAddress";            if (data1.length == 1) {//判断返回值长度如果长度等于1执行下面方法                $("#txt_collectFiledWord").val(data1[0].FieldWord);                $.getJSON("/FreightReceiptsManage/SelectDeliveryWay?FieldWord=" + $("#txt_collectFiledWord").val() + "&LogisticsPlaceID="+WuLiuDiDianID, function (data2) { //查询配送领域属性的运交方式                    if (data2.length > 0) {//判断是否存在该领域的属性维护属性                        $("#cbo_insertDeliveryWay").combobox({ data: data2, valueField: 'DeliveryWayID', textField: 'DeliveryWay' });                    } else {                        alert("本物流地点不存在此领域的配送属性,不能按此方式开单");                    }                });                $.getJSON("/FreightReceiptsManage/SelectMoRenDeliveryWay?FieldWord=" + $("#txt_collectFiledWord").val(), function (data) {//显示默认配送方式                    intsertShuXingWeiHuID = data[0].DeliveryFieldServiceID ;                    if (confirm("是否选择默认配送方式: " + data[0].DeliveryWay + ";此配送方式预计送达天数为:" + data[0].PredictServiceDay + "天;" + " 配送属性为:" + data[0].AttributeDetailedName)) {                        setTimeout(function () { $("#cbo_insertDeliveryWay").combobox("setValue", data[0].DeliveryWayID); }, 200);                    }                });            }        });    }    var fanfa2 = "SelectAddressFiled";var ID2 = "dgrd_FieldAddress";//在修改货运单窗体运交领域文本中按下键盘时触发此方法    function onkeydown2() {  //查询配送领域属性显示到修改货运单界面        if ($("#Select2").val() == 2) { fanfa2 = "SelectClientFiled"; ID2 = "dgrd_ClientAddress"; };        $.getJSON("/FreightReceiptsManage/" + fanfa2 + "?FieldWord=" + $("#txt_updateCollectFiledWord").val(), function (data1) {            $("#" + ID2).datagrid('loadData', data1);            fanfa2 = "SelectAddressFiled"; ID2 = "dgrd_FieldAddress";            if (data1.length== 1){                $("#txt_updateCollectFiledWord").val(data1[0].FieldWord);                $.getJSON("/FreightReceiptsManage/SelectDeliveryWay?FieldWord=" + $("#txt_updateCollectFiledWord").val()+"&LogisticsPlaceID="+WuLiuDiDianID, function (data2){//查询配送领域属性的运交方式                    if (data2.length > 0) {                        $("#cbo_updateDeliveryWay").combobox({ data: data2, valueField: 'DeliveryWayID', textField: 'DeliveryWay' });                    }                    else {                        alert("本物流地点不存在此领域的配送属性,不能按此方式开单");                    }                });                $.getJSON("/FreightReceiptsManage/SelectMoRenDeliveryWay?FieldWord=" + $("#txt_updateCollectFiledWord").val(), function (data) {//显示默认配送方式                    updateShuXingWeiHuID = data[0].DeliveryFieldServiceID;                    if (confirm("是否选择默认配送方式为: " + data[0].DeliveryWay + ";此配送方式预计送达天数为:" + data[0].PredictServiceDay + "天;" + " 配送属性为:" + data[0].AttributeDetailedName)) {                        setTimeout(function () { $("#cbo_updateDeliveryWay").combobox("setValue", data[0].DeliveryWayID); }, 100);                    }                });            }        });    }    var intsertShuXingWeiHuID = 0;    function onChangeHuoQuShuXingWeiHuID(row) { //在新增货运单界面选择配送方式时查询配送领域ID         $.getJSON("/FreightReceiptsManage/SelectDeliveryFieldServiceID?strFieldWord=" + $("#txt_collectFiledWord").val() + "&intDeliveryWayID=" + row.DeliveryWayID, function (data) {             intsertShuXingWeiHuID = data[0].DeliveryFieldServiceID;         });    }    var updateShuXingWeiHuID = 0;    function updateHuoQuShuXingWeiHuID(row){//在修改货运单界面选择配送方式时查询配送领域ID        $.getJSON("/FreightReceiptsManage/SelectDeliveryFieldServiceID?strFieldWord=" + $("#txt_updateCollectFiledWord").val() + "&intDeliveryWayID=" + row.DeliveryWayID, function (data) {            updateShuXingWeiHuID = data[0].DeliveryFieldServiceID;        });    }</script>

下面是获取控制器传值的逻辑层的代码:

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data;using System.Data.SqlClient;namespace BLLFreightReceiptsManage{    public class FreightReceiptsManage    {        DALPublic.DALMethod myDALMethod = new DALPublic.DALMethod();        //查询货运单信息        public DataTable SelecteFreightReceiptsInformation()        {            SqlParameter[] SQL ={                                  new SqlParameter("@type",SqlDbType.Char),                              };            SQL[0].Value = "SelecteFreightReceiptsInformation";            DataTable dt = myDALMethod.DAL_SelectDB_Par("FreightReceiptsInformation", SQL);// FreightReceiptsInformation对应的是存储过程的名称            return dt;        }        //查询货物信息        public DataTable SelectGoods(int FreightReceiptsID)        {            SqlParameter[] SQL ={                                  new SqlParameter("@type",SqlDbType.Char),                                  new SqlParameter("@FreightReceiptsID",SqlDbType.Int),                              };            SQL[0].Value = "SelectGoods";            SQL[1].Value = FreightReceiptsID;            DataTable dt = myDALMethod.DAL_SelectDB_Par("FreightReceiptsInformation", SQL);            return dt;        }        //多条件查询订单信息        public DataTable MuchConditionSelecteFreightReceiptsInformation(string SendNumber, int CompanyID, int SendClient, DateTime CollectTime, DateTime EndTime)        {            SqlParameter[] SQL ={                                  new SqlParameter("@type",SqlDbType.Char),                                  new SqlParameter("@SendNumber",SqlDbType.Char),                                   new SqlParameter("@CompanyID",SqlDbType.Int),                                    new SqlParameter("@SendClient",SqlDbType.Int),                                   new SqlParameter("@CollectTime",SqlDbType.DateTime),                                   new SqlParameter("@EndTime",SqlDbType.DateTime),                              };            SQL[0].Value = "MuchConditionSelecteFreightReceiptsInformation";            SQL[1].Value = SendNumber;            SQL[2].Value = CompanyID;            SQL[3].Value = SendClient;            SQL[4].Value = CollectTime;            SQL[5].Value = EndTime;// SQL[1]、SQL[2]等以上面的new SqlParameter("@type",SqlDbType.Char)、new //SqlParameter("@SendNumber",SqlDbType.Char)一一对应            DataTable dt = myDALMethod.DAL_SelectDB_Par("FreightReceiptsInformation", SQL);            return dt;        }        //查询客户信息        public DataTable SelecteClientInformation()        {            SqlParameter[] SQL ={                                  new SqlParameter("@type",SqlDbType.Char),                                                              };            SQL[0].Value = "SelecteClientInformation";             DataTable dt = myDALMethod.DAL_SelectDB_Par("FreightReceiptsInformation", SQL);            return dt;        }        //查询公司信息        public DataTable SelecteCompanyInformation()        {            SqlParameter[] SQL ={                                  new SqlParameter("@type",SqlDbType.Char),                                                              };            SQL[0].Value = "SelecteCompanyInformation";            DataTable dt = myDALMethod.DAL_SelectDB_Par("FreightReceiptsInformation", SQL);            return dt;        }        //新增订单信息           public DataTable InsertFreightReceiptsInformation(int StaffID, bool CheckNo, string SendNumber, int CompanyID,            int SendClientID,int CollectClientID,string ConnectTime,string RequireServiceTime,            string SendAddress, string CollectAddress, int PayCondition, int FreightReceiptsStateID, int SignForStateID,            int ClassesID, string sendFiledWordWord,int DeliveryFieldServiceID)        {            SqlParameter[] SQL ={                                   new SqlParameter("@type",SqlDbType.Char),                                   new SqlParameter("@StaffID",SqlDbType.Int),                                   new SqlParameter("@CheckNo",SqlDbType.Bit),                                   new SqlParameter("@SendNumber",SqlDbType.Char),                                   new SqlParameter("@CompanyID",SqlDbType.Int),                                   new SqlParameter("@SendClientID",SqlDbType.Int),                                   new SqlParameter("@CollectClientID",SqlDbType.Int),                                   new SqlParameter("@ConnectTime",SqlDbType.Char),                                new SqlParameter("@RequireServiceTime",SqlDbType.Char),                                   new SqlParameter("@SendAddress",SqlDbType.Char),                                   new SqlParameter("@CollectAddress",SqlDbType.Char),                                   new SqlParameter("@PayCondition",SqlDbType.Int),                            new SqlParameter("@FreightReceiptsStateID",SqlDbType.Int),                                   new SqlParameter("@SignForStateID",SqlDbType.Int),                                   new SqlParameter("@ClassesID",SqlDbType.Int),                                   new SqlParameter("@SendFieldWord",SqlDbType.Char),                             new SqlParameter("@DeliveryFieldServiceID",SqlDbType.Int),                                   new SqlParameter("@DductTime",SqlDbType.Char),                                                              };//@ClassesID、@DductTime等参数要以存储过程中的参数名称保持一致              DateTime TN = DateTime.Now;//获取当前时间              SQL[0].Value = "InsertFreightReceiptsInformation";              SQL[1].Value = StaffID;              SQL[2].Value =CheckNo ;              SQL[3].Value =SendNumber ;              SQL[4].Value =CompanyID ;              SQL[5].Value = SendClientID;              SQL[6].Value = CollectClientID;              SQL[7].Value = RequireServiceTime;              SQL[8].Value = RequireServiceTime;              SQL[9].Value =SendAddress ;              SQL[10].Value = CollectAddress;              SQL[11].Value =PayCondition ;              SQL[12].Value = FreightReceiptsStateID;              SQL[13].Value = SignForStateID;              SQL[14].Value = ClassesID;              SQL[15].Value = sendFiledWordWord;              SQL[16].Value = DeliveryFieldServiceID;              SQL[17].Value = TN;             DataTable dt = myDALMethod.DAL_SelectDB_Par("FreightReceiptsInformation", SQL);            return dt;        }        //修改订单信息          public int UpdateFreightReceiptsInformation(int StaffID,int CompanyID,           int SendClientID, int CollectClientID, DateTime ConnectTime, DateTime RequireServiceTime,           string SendAddress, string CollectAddress, int PayCondition, int ClassesID, int FreightReceiptsID,              string sendFiledWordWord, int DeliveryFieldServiceID)        {            SqlParameter[] SQL ={                                  new SqlParameter("@type",SqlDbType.Char),                                   new SqlParameter("@StaffID",SqlDbType.Int),                                   new SqlParameter("@CompanyID",SqlDbType.Int),                                   new SqlParameter("@SendClientID",SqlDbType.Int),                                   new SqlParameter("@CollectClientID",SqlDbType.Int),                                   new SqlParameter("@ConnectTime",SqlDbType.DateTime),                                   new SqlParameter("@RequireServiceTime",SqlDbType.DateTime),                                   new SqlParameter("@SendAddress",SqlDbType.Char),                                   new SqlParameter("@CollectAddress",SqlDbType.Char),                                   new SqlParameter("@PayCondition",SqlDbType.Int),                                   new SqlParameter("@ClassesID",SqlDbType.Int),                                   new SqlParameter("@FreightReceiptsID",SqlDbType.Int),                                    new SqlParameter("@SendFieldWord",SqlDbType.Char),                                  new SqlParameter("@DeliveryFieldServiceID",SqlDbType.Int),                              };            SQL[0].Value = "UpdateFreightReceiptsInformation";            SQL[1].Value = StaffID;            SQL[2].Value = CompanyID;            SQL[3].Value = SendClientID;            SQL[4].Value = CollectClientID;            SQL[5].Value = RequireServiceTime;            SQL[6].Value = RequireServiceTime;            SQL[7].Value = SendAddress;            SQL[8].Value = CollectAddress;            SQL[9].Value = PayCondition;            SQL[10].Value = ClassesID;            SQL[11].Value = FreightReceiptsID;            SQL[12].Value = sendFiledWordWord;            SQL[13].Value = DeliveryFieldServiceID;             int  i = myDALMethod.DAL_OPTableDB_Par("FreightReceiptsInformation", SQL);            return i;        }           //新增货物        public int InsertGoods(string GoodsName,string Unit,string number,string BrandNumber,string FreightMoney,string MaterialNumber,int FreightReceiptsID)        {            SqlParameter[] SQL ={                                  new SqlParameter("@type",SqlDbType.Char),                                  new SqlParameter("@GoodsName",SqlDbType.Char),                                  new SqlParameter("@Unit",SqlDbType.Char),                                  new SqlParameter("@number",SqlDbType.Char),                                  new SqlParameter("@BrandNumber",SqlDbType.Char),                                  new SqlParameter("@FreightMoney",SqlDbType.Char),                                  new SqlParameter("@MaterialNumber",SqlDbType.Char),                                  new SqlParameter("@FreightReceiptsID",SqlDbType.Int),                                                              };            SQL[0].Value = "InsertGoods";            SQL[1].Value =GoodsName ;             SQL[2].Value = Unit;             SQL[3].Value =number ;             SQL[4].Value =BrandNumber ;             SQL[5].Value =FreightMoney ;             SQL[6].Value = MaterialNumber;             SQL[7].Value =FreightReceiptsID ;             int i = myDALMethod.DAL_OPTableDB_Par("FreightReceiptsInformation", SQL);            return i;        }        //修改货物信息        public int updateGoods(string GoodsName, string Unit, string number, string BrandNumber, string FreightMoney, string MaterialNumber, int FreightReceiptsID)        {            SqlParameter[] SQL ={                                  new SqlParameter("@type",SqlDbType.Char),                                  new SqlParameter("@GoodsName",SqlDbType.Char),                                  new SqlParameter("@Unit",SqlDbType.Char),                                  new SqlParameter("@number",SqlDbType.Char),                                  new SqlParameter("@BrandNumber",SqlDbType.Char),                                  new SqlParameter("@FreightMoney",SqlDbType.Char),                                  new SqlParameter("@MaterialNumber",SqlDbType.Char),                                  new SqlParameter("@FreightReceiptsID",SqlDbType.Int),                                                              };            SQL[0].Value = "updateGoods";            SQL[1].Value = GoodsName;            SQL[2].Value = Unit;            SQL[3].Value = number;            SQL[4].Value = BrandNumber;            SQL[5].Value = FreightMoney;            SQL[6].Value = MaterialNumber;            SQL[7].Value = FreightReceiptsID;            int i = myDALMethod.DAL_OPTableDB_Par("FreightReceiptsInformation", SQL);// DAL_OPTableDB_Par为数据层中的方法返回值是整形            return i;        }        //删除货物明细        public int daleteGoods(int MingXiID)        {            SqlParameter[] SQL ={                new SqlParameter("@type",SqlDbType.Char),                new SqlParameter("@FreightReceiptsID",SqlDbType.Char),};            SQL[0].Value = "daleteGoods";            SQL[1].Value = MingXiID;            int i = myDALMethod.DAL_OPTableDB_Par("FreightReceiptsInformation", SQL);            return i;        }        //查询地址领域        public DataTable SelectAddressFiled(string FieldWord)        {            SqlParameter[] SQL ={                                  new SqlParameter("@type",SqlDbType.Char),                                    new SqlParameter("@FieldWord",SqlDbType.Char),                              };            SQL[0].Value = "SelectAddressFiled";            SQL[1].Value = FieldWord;            DataTable dt = myDALMethod.DAL_SelectDB_Par("FreightReceiptsInformation", SQL);            return dt;        }        //查询客户领域        public DataTable SelectClientFiled(string FieldWord)        {            SqlParameter[] SQL ={                                  new SqlParameter("@type",SqlDbType.Char),                                   new SqlParameter("@FieldWord",SqlDbType.Char),                              };            SQL[0].Value = "SelectClientFiled";            SQL[1].Value = FieldWord;            DataTable dt = myDALMethod.DAL_SelectDB_Par("FreightReceiptsInformation", SQL);            return dt;        }       // --查询配送领域属性查找默认配送方式    public DataTable SelectMoRenDeliveryWay(string FieldWord){       SqlParameter[] SQL ={                                  new SqlParameter("@type",SqlDbType.Char),                                   new SqlParameter("@FieldWord",SqlDbType.Char),                              };            SQL[0].Value = "SelectMoRenDeliveryWay";            SQL[1].Value = FieldWord;            DataTable dt = myDALMethod.DAL_SelectDB_Par("FreightReceiptsInformation", SQL);            return dt;  }  //  --查询配送领域属性配送方式绑定下拉框    public DataTable SelectDeliveryWay(string FieldWord, int LogisticsPlaceID)    {        SqlParameter[] SQL ={                                  new SqlParameter("@type",SqlDbType.Char),                                   new SqlParameter("@FieldWord",SqlDbType.Char),                                   new SqlParameter("@LogisticsPlaceID",SqlDbType.Int),                              };        SQL[0].Value = "SelectDeliveryWay";        SQL[1].Value = FieldWord;        SQL[2].Value = LogisticsPlaceID;        DataTable dt = myDALMethod.DAL_SelectDB_Par("FreightReceiptsInformation", SQL);        return dt;    }              // --修改单据审核状态    public int updateCheckNo(int FreightReceiptsID) {        SqlParameter[] SQL ={                new SqlParameter("@type",SqlDbType.Char),                new SqlParameter("@FreightReceiptsID",SqlDbType.Int),};        SQL[0].Value = "updateCheckNo";        SQL[1].Value = FreightReceiptsID;        int i = myDALMethod.DAL_OPTableDB_Par("FreightReceiptsInformation", SQL);        return i;    }          //    --通过领域代码、配送方式、物流地点查询领域维护ID    public DataTable SelectDeliveryFieldServiceID(string strFieldWord, int intDeliveryWayID)    {        SqlParameter[] SQL ={                                  new SqlParameter("@type",SqlDbType.Char),                                  new SqlParameter("@FieldWord",SqlDbType.Char),                                  new SqlParameter("@DeliveryWayID",SqlDbType.Int),                                                               };        SQL[0].Value = "SelectDeliveryFieldServiceID";        SQL[1].Value = strFieldWord;        SQL[2].Value = intDeliveryWayID;         DataTable dt = myDALMethod.DAL_SelectDB_Par("FreightReceiptsInformation", SQL);        return dt;    }


 

下面传值给逻辑层的存储过程的代码:

ALTER PROCEDURE [dbo].[FreightReceiptsInformation]--声明参数 @type nchar(100)='',@FreightReceiptsID int=0,@CollectTime datetime='', @EndTime datetime='',@SendNumber nchar(40)='', @CompanyID int=0,@SendClient int=0,@SendClientID int=0, @CollectClientID int=0, @ConnectTime datetime='', @RequireServiceTime datetime='', @SendAddress nchar(80)='', @CollectAddress nchar(80)='', @PayCondition int=0, @FreightReceiptsStateID int=0, @SignForStateID int=0, @Remark nchar(80)='',@StaffID int=0,@CheckNo bit=0, @GoodsName nchar(40)='' ,@Unit nchar(10)='', @number nchar(40)='', @BrandNumber nchar(40)='', @FreightMoney nchar(40)='', @MaterialNumber nchar(40)='',@SendFieldWord  nchar(20)='',@CollectFieldWord nchar(20)='',@ClassesID int=0,@FieldWord nchar(40)='',@DeliveryWayID int=0,@DductTime datetime=NULL,@MX_DeliveryCarTimesServiceID int=0,@DeliveryFieldServiceID int=0,@LogisticsPlaceID int=0 ASBEGIN    --查询订单信息   if @type='SelecteFreightReceiptsInformation'  beginSELECT     CompanyList.CompanyName, FreightReceiptsList.SendClientID, ClientList_1.ClientName AS SendClient, FreightReceiptsList.CompanyID, FreightReceiptsList.CollectClientID,                       ClientList.ClientName AS CollectClient, MX_AttributeDetailedList_2.AttributeDetailedName, FreightReceiptsList.SignForStateID, MX_AttributeDetailedList.AttributeDetailedName AS SignForState,                       FreightReceiptsList.PayCondition, StaffList.StaffName, FreightReceiptsList.CheckNo, FreightReceiptsList.FreightReceiptsStateID,                       MX_AttributeDetailedList_1.AttributeDetailedName AS FreightReceiptsState, RTRIM(FreightReceiptsList.CollectAddress) AS CollectAddress, RTRIM(FreightReceiptsList.SendAddress)                       AS SendAddress, CONVERT(varchar(20), FreightReceiptsList.RequireServiceTime, 120) AS RequireServiceTime, CONVERT(varchar(20), FreightReceiptsList.ConnectTime, 120) AS ConnectTime,                       FreightReceiptsList.SendNumber, FreightReceiptsList.FreightReceiptsID, FreightReceiptsList.StaffID, FreightReceiptsList.SendFieldWord, FreightReceiptsList.ClassesID,                       MX_AttributeDetailedList_3.AttributeDetailedName AS Class, MX_AttributeDetailedList_4.AttributeDetailedName AS DeliveryWay, DeliveryFieldServiceList.FieldWord AS CollectFieldWord,                       DeliveryFieldServiceList.DeliveryWayID, StaffList.LogisticsPlaceIDFROM         FreightReceiptsList INNER JOIN                      CompanyList ON FreightReceiptsList.CompanyID = CompanyList.CompanyID INNER JOIN                      ClientList AS ClientList_1 ON FreightReceiptsList.SendClientID = ClientList_1.ClientID INNER JOIN                      ClientList ON FreightReceiptsList.CollectClientID = ClientList.ClientID INNER JOIN                      MX_AttributeDetailedList AS MX_AttributeDetailedList_2 ON FreightReceiptsList.PayCondition = MX_AttributeDetailedList_2.MX_AttributeDetailedID INNER JOIN                      MX_AttributeDetailedList ON FreightReceiptsList.SignForStateID = MX_AttributeDetailedList.MX_AttributeDetailedID INNER JOIN                      MX_AttributeDetailedList AS MX_AttributeDetailedList_1 ON FreightReceiptsList.FreightReceiptsStateID = MX_AttributeDetailedList_1.MX_AttributeDetailedID INNER JOIN                      StaffList ON FreightReceiptsList.StaffID = StaffList.StaffID INNER JOIN                      MX_AttributeDetailedList AS MX_AttributeDetailedList_3 ON FreightReceiptsList.ClassesID = MX_AttributeDetailedList_3.MX_AttributeDetailedID INNER JOIN                      DeliveryFieldServiceList ON FreightReceiptsList.DeliveryFieldServiceID = DeliveryFieldServiceList.DeliveryFieldServiceID INNER JOIN                      MX_AttributeDetailedList AS MX_AttributeDetailedList_4 ON DeliveryFieldServiceList.DeliveryWayID = MX_AttributeDetailedList_4.MX_AttributeDetailedID                                                end   --依照订单ID查询货物明细   if @type='SelectGoods'   begin--SELECT中的字段是查询的列名   SELECT     GoodsName, Unit, number, MaterialNumber, BrandNumber, FreightMoney, FreightReceiptsID,MX_FreightReceiptsID     FROM         MX_FreightReceiptsList     where MX_FreightReceiptsList.FreightReceiptsID=@FreightReceiptsID-- where中的是查询的条件   end     --多条件查询订单信息    if @Type='MuchConditionSelecteFreightReceiptsInformation'begin      declare @sql varchar(1000)—-声明长度为1000变量        if @SendNumber!=''      begin           set @sql=' where FreightReceiptsList.SendNumber='''+LTRIM(RTRIM(@SendNumber))+''''       end      if @CompanyID !=0      begin            if @sql !=''                set @sql=@sql+' and CompanyList.CompanyID='''+LTRIM(RTRIM(@CompanyID))+'''' –-并接字符串                else set @sql='where CompanyList.CompanyID='''+LTRIM(RTRIM(@CompanyID))+''''      end       if @SendClient!=0      begin            if @sql !=''                set @sql=@sql+' and FreightReceiptsList.SendClientID='''+LTRIM(RTRIM(@SendClient))+''''                 else set @sql=' where FreightReceiptsList.SendClientID= '''+LTRIM(RTRIM(@SendClient))+''''      end      if @CollectTime !=''and @EndTime !=''      begin            if @sql !=''              set @sql=@sql+' and FreightReceiptsList.RequireServiceTime  between '''+LTRIM(RTRIM(@CollectTime))+''''+' and '''+LTRIM(RTRIM(@EndTime))+''''-- LTRIM和RTRIM为左去空格和右去空格,查询时间段的格式为between  and                else set @sql=' where FreightReceiptsList.RequireServiceTime  between '''+LTRIM(RTRIM(@CollectTime))+''''+' and '''+LTRIM(RTRIM(@EndTime))+''''      end        exec(' SELECT     CompanyList.CompanyName, FreightReceiptsList.SendClientID, ClientList_1.ClientName AS SendClient, FreightReceiptsList.CompanyID, FreightReceiptsList.CollectClientID,                       ClientList.ClientName AS CollectClient, MX_AttributeDetailedList_2.AttributeDetailedName, FreightReceiptsList.SignForStateID, MX_AttributeDetailedList.AttributeDetailedName AS SignForState,                       FreightReceiptsList.PayCondition, StaffList.StaffName, FreightReceiptsList.CheckNo, FreightReceiptsList.FreightReceiptsStateID,                       MX_AttributeDetailedList_1.AttributeDetailedName AS FreightReceiptsState, RTRIM(FreightReceiptsList.CollectAddress) AS CollectAddress, RTRIM(FreightReceiptsList.SendAddress)                       AS SendAddress, CONVERT(varchar(20), FreightReceiptsList.RequireServiceTime, 120) AS RequireServiceTime, CONVERT(varchar(20), FreightReceiptsList.ConnectTime, 120) AS ConnectTime,                       FreightReceiptsList.SendNumber, FreightReceiptsList.FreightReceiptsID, FreightReceiptsList.StaffID, FreightReceiptsList.SendFieldWord, FreightReceiptsList.ClassesID,                       MX_AttributeDetailedList_3.AttributeDetailedName AS Class, MX_AttributeDetailedList_4.AttributeDetailedName AS DeliveryWay, DeliveryFieldServiceList.FieldWord AS CollectFieldWord,                       DeliveryFieldServiceList.DeliveryWayIDFROM         FreightReceiptsList INNER JOIN                      CompanyList ON FreightReceiptsList.CompanyID = CompanyList.CompanyID INNER JOIN                      ClientList AS ClientList_1 ON FreightReceiptsList.SendClientID = ClientList_1.ClientID INNER JOIN                      ClientList ON FreightReceiptsList.CollectClientID = ClientList.ClientID INNER JOIN                      MX_AttributeDetailedList AS MX_AttributeDetailedList_2 ON FreightReceiptsList.PayCondition = MX_AttributeDetailedList_2.MX_AttributeDetailedID INNER JOIN                      MX_AttributeDetailedList ON FreightReceiptsList.SignForStateID = MX_AttributeDetailedList.MX_AttributeDetailedID INNER JOIN                      MX_AttributeDetailedList AS MX_AttributeDetailedList_1 ON FreightReceiptsList.FreightReceiptsStateID = MX_AttributeDetailedList_1.MX_AttributeDetailedID INNER JOIN                      StaffList ON FreightReceiptsList.StaffID = StaffList.StaffID INNER JOIN                      MX_AttributeDetailedList AS MX_AttributeDetailedList_3 ON FreightReceiptsList.ClassesID = MX_AttributeDetailedList_3.MX_AttributeDetailedID INNER JOIN                      DeliveryFieldServiceList ON FreightReceiptsList.DeliveryFieldServiceID = DeliveryFieldServiceList.DeliveryFieldServiceID INNER JOIN                      MX_AttributeDetailedList AS MX_AttributeDetailedList_4 ON DeliveryFieldServiceList.DeliveryWayID = MX_AttributeDetailedList_4.MX_AttributeDetailedID   '+@sql)                       return                             end   --查询客户信息   if @type='SelecteClientInformation'   begin    SELECT    RTRIM(ClientName)as ClientName, RTRIM(ClientAbbreviation)as ClientAbbreviation,RTRIM(LinkMan)as LinkMan,RTRIM(LinkPhone)as LinkPhone,RTRIM(ClientNumber)as ClientNumber,RTRIM(ClientID)as ClientIDFROM         ClientListend  --查询公司信息  if @type='SelecteCompanyInformation'  begin  SELECT   RTRIM(CompanyID)as CompanyID, RTRIM(CompanyName)as CompanyNameFROM         CompanyList  end --新增订单 if @type='InsertFreightReceiptsInformation' begin insert into FreightReceiptsList(StaffID,CheckNo,SendNumber, CompanyID, SendClientID, CollectClientID, ConnectTime, RequireServiceTime, SendAddress, CollectAddress, PayCondition, FreightReceiptsStateID, SignForStateID, ClassesID,SendFieldWord,SignFor,DductTime,DeliveryFieldServiceID)  values(RTRIM(@StaffID),RTRIM(@CheckNo),RTRIM(@SendNumber), RTRIM(@CompanyID),RTRIM(@SendClientID), RTRIM(@CollectClientID), RTRIM(@ConnectTime), RTRIM(@RequireServiceTime), RTRIM(@SendAddress), RTRIM(@CollectAddress), RTRIM(@PayCondition), RTRIM(@FreightReceiptsStateID), RTRIM(@SignForStateID), RTRIM(@ClassesID),RTRIM(@SendFieldWord),'未结案',@DductTime,@DeliveryFieldServiceID)          select @@IDENTITY–-查询刚新增的那一行数据的主键ID end --修改订单信息 if @type='UpdateFreightReceiptsInformation' begin update FreightReceiptsList set StaffID=RTRIM(@StaffID),CompanyID=RTRIM(@CompanyID), SendClientID=RTRIM(@SendClientID), CollectClientID=RTRIM(@CollectClientID), ConnectTime=RTRIM(@ConnectTime), RequireServiceTime=RTRIM(@RequireServiceTime), SendAddress=RTRIM(@SendAddress), CollectAddress=RTRIM(@CollectAddress), PayCondition=RTRIM(@PayCondition), ClassesID=RTRIM(@ClassesID),SendFieldWord=RTRIM(@SendFieldWord),DeliveryFieldServiceID=RTRIM(@DeliveryFieldServiceID) where FreightReceiptsList.FreightReceiptsID=@FreightReceiptsID end --修改单据审核状态 if @type='updateCheckNo' begin update FreightReceiptsList set CheckNo=1 where FreightReceiptsList.FreightReceiptsID=@FreightReceiptsID end --新增货物明细 if @type='InsertGoods' begin insert into  MX_FreightReceiptsList(GoodsName, Unit, number, BrandNumber, FreightMoney, MaterialNumber, FreightReceiptsID)    values( RTRIM(@GoodsName),@Unit,RTRIM(@number),RTRIM(@BrandNumber),  RTRIM(@FreightMoney),  RTRIM(@MaterialNumber),  RTRIM(@FreightReceiptsID))          end --修改货物明细 if @type='updateGoods' begin update  MX_FreightReceiptsList set GoodsName=RTRIM(@GoodsName), Unit=@Unit, number=RTRIM(@number), BrandNumber=RTRIM(@BrandNumber), FreightMoney=RTRIM(@FreightMoney), MaterialNumber=RTRIM(@MaterialNumber) where MX_FreightReceiptsList.MX_FreightReceiptsID=@FreightReceiptsID end --删除货物 if @type='daleteGoods' begin delete MX_FreightReceiptsList where MX_FreightReceiptsList.MX_FreightReceiptsID=@FreightReceiptsID end  --查询地址领域 if @type='SelectAddressFiled' begin SELECT     FieldID, FieldWord, Province, City, CountyFROM         FieldAddressListwhere   FieldWord  like '%'+ LTRIM(RTRIM(@FieldWord))+'%'  end --查询客户领域 if @type='SelectClientFiled' begin SELECT     ClientFieldList.FieldWord, ClientFieldList.AddressID, AddressList.AddressName, ClientList.ClientName, ClientList.ClientAbbreviationFROM         ClientFieldList INNER JOIN                      AddressList ON ClientFieldList.AddressID = AddressList.AddressID INNER JOIN                      ClientList ON AddressList.ClientID = ClientList.ClientID       where   FieldWord  like '%'+ LTRIM(RTRIM(@FieldWord))+'%'  end  --查询配送领域属性查找默认配送方式 if @type='SelectMoRenDeliveryWay' begin SELECT     DeliveryFieldServiceList.SXMX_AttributeID, MX_AttributeDetailedList_2.AttributeDetailedName, DeliveryFieldServiceList.DeliveryGradeID,                       MX_AttributeDetailedList.AttributeDetailedName AS DeliveryGrade, LTRIM(RTRIM(DeliveryFieldServiceList.DeliveryWayID)) AS DeliveryWayID,                       RTRIM(MX_AttributeDetailedList_1.AttributeDetailedName) AS DeliveryWay, DeliveryFieldServiceList.FieldWord, DeliveryFieldServiceList.AdmitNO,                       RTRIM(DeliveryFieldServiceList.PredictServiceDay) AS PredictServiceDay, DeliveryFieldServiceList.DeliveryFieldServiceIDFROM         DeliveryFieldServiceList INNER JOIN                      MX_AttributeDetailedList AS MX_AttributeDetailedList_2 ON DeliveryFieldServiceList.SXMX_AttributeID = MX_AttributeDetailedList_2.MX_AttributeDetailedID INNER JOIN                      MX_AttributeDetailedList ON DeliveryFieldServiceList.DeliveryGradeID = MX_AttributeDetailedList.MX_AttributeDetailedID INNER JOIN                      MX_AttributeDetailedList AS MX_AttributeDetailedList_1 ON DeliveryFieldServiceList.DeliveryWayID = MX_AttributeDetailedList_1.MX_AttributeDetailedID        where  FieldWord=RTRIM(@FieldWord) and  AdmitNO=1                  end     --查询配送领域属性配送方式绑定下拉框    if @type='SelectDeliveryWay'     begin  SELECT     DeliveryFieldServiceList.SXMX_AttributeID, MX_AttributeDetailedList_2.AttributeDetailedName, DeliveryFieldServiceList.DeliveryWayID,                       MX_AttributeDetailedList_1.AttributeDetailedName AS DeliveryWay, DeliveryFieldServiceList.FieldWord, DeliveryFieldServiceList.PredictServiceDay,                       DeliveryFieldServiceList.LogisticsPlaceIDFROM         DeliveryFieldServiceList INNER JOIN                      MX_AttributeDetailedList AS MX_AttributeDetailedList_2 ON DeliveryFieldServiceList.SXMX_AttributeID = MX_AttributeDetailedList_2.MX_AttributeDetailedID INNER JOIN                      MX_AttributeDetailedList AS MX_AttributeDetailedList_1 ON DeliveryFieldServiceList.DeliveryWayID = MX_AttributeDetailedList_1.MX_AttributeDetailedID                         where  FieldWord=RTRIM(@FieldWord) and DeleteNo=0 and DeliveryFieldServiceList.LogisticsPlaceID=@LogisticsPlaceID   --and相当于‘且‘的意思    end      --通过领域代码、配送方式、物流地点查询领域维护ID  if @type='SelectDeliveryFieldServiceID'  begin   SELECT     DeliveryFieldServiceID, FieldWord, DeliveryWayID, LogisticsPlaceID   FROM         DeliveryFieldServiceList   where FieldWord=@FieldWord and DeliveryWayID=@DeliveryWayID  end  END

仅供学习,禁止商业用途


 

 

 

 

 

0 0