北京络捷斯特第三方物流信息系统技术解析(四) 订单录入-运输订单

来源:互联网 发布:影视后期编辑软件 编辑:程序博客网 时间:2024/05/01 23:09

北京络捷斯特第三方物流信息系统技术解析(四) 订单录入-运输订单

2.1.3运输订单

运输订单有两个标签要编写,包括有订单信息和订单货品

订单信息界面截图:


2.1(图1)

订单货品信息截图:


2.1(图2)

运输订单功能实现:

第一步:数据库

1、        表和关系:


2.1(图3)

表1:订单运输信息表(PW_OrdersTransportationInformationTable)

列名

数据类型

主键/外键

说明

OrdersTransportationInformationID

int

主键

订单运输信息ID

OrdersNumber

nchar(50)

 

订单号

BusinessTypeID

int

外键

业务类型ID

ProvenanceID

int

外键

始发地ID

DestinationID

int

外键

目的地ID

LoansTime

date

 

取货时间

ArriveGoodsTime

date

 

到货时间

TakeDeliverGoodsID

int

外键

取送货ID

WrittenReturnID

int

外键

签单返回ID

ContractCheckClientID

int

外键

合同托运客户ID

ShipperName

nchar(50)

 

托运人姓名

ShipperPhone

nchar(50)

 

托运人电话

ShipperUnit

nchar(50)

 

托运人单位

ShipperAddress

nchar(50)

 

托运人地址

CheckAccounts

nchar(50)

 

托运帐号

ShipperPostcode

nchar(50)

 

托运人邮编

ClientManager

nchar(50)

 

客户经理

LoansNameID

int

外键

取货人ID

LoansLinkman

nchar(50)

 

取货联系人

LoansLinkmanPhone

nchar(50)

 

取货联系人电话

LoansAddress

nchar(50)

 

取货地址

ProjectID

int

外键

项目ID

ConsigneeName

nchar(50)

 

收货人姓名

ConsigneePhone

nchar(50)

 

收货人电话

ConsigneeUnit

nchar(50)

 

收货人单位

ConsigneeAddress

nchar(50)

 

收货人地址

ConsigneeAccounts

nchar(50)

 

收货人帐号

ConsigneePostcode

nchar(50)

 

收货人邮编

ConsigneeID

int

外键

收货人ID

Freight

decimal(18, 2)

 

运费

Incidentals

decimal(18, 2)

 

杂费

ChargesSubtotal

decimal(18, 2)

 

费用小计

InsuredStatementNo

Bit

 

投保声明否

InsuredMoney

decimal(18, 2)

 

投保金额

Premium

decimal(18, 2)

 

保险费

SettleAccountsWayID

int

外键

结算方式ID

BeforehandGathering

decimal(18, 2)

 

预收款

PayAccounts

nchar(50)

 

付费帐号

Note

nchar(50)

 

备注

MakeMan

nchar(50)

 

制单人

HearTime

date

 

受理时间

HearUnit

nchar(50)

 

受理单位

SignForName

nchar(50)

 

签收人

SignForTime

date

 

签收时间

SignForNo

Bit

 

签收否

ReturnSingleState

nchar(50)

 

返单状态

ReturnSingleMan

nchar(50)

 

返单人

ReturnSingleTime

date

 

返单时间

ReviewNo

Bit

 

复核否

表2:订单运输明细表(PW_OrdersTransportationDetailedTable)

列名

数据类型

主键/外键

说明

OrdersTransportationDetailedID

int

主键

订单运输明细ID

OrdersTransportationInformationID

int

外键

订单运输信息ID

GoodsID

int

外键

货品ID

Volume

decimal(18, 2)

 

体积

Quantity

decimal(18, 2)

 

数量

Note

nchar(50)

 

备注

第二步:控制器(Controllers


2.1(图4)


2.1(图5)

Contrlles(控制器)代码:

        /// <summary>        /// 接受界面传过来的参数,新增一条运输订单的信息        /// </summary>        /// <param name="OrdersNumber">订单号</param>        /// <param name="BusinessTypeID">业务类型ID</param>        /// <param name="ProvenanceID">始发地ID</param>        /// <param name="DestinationID">目的地ID</param>        /// <param name="LoansTime">取货时间</param>        /// <param name="ArriveGoodsTime">到货时间</param>        /// <param name="TakeDeliverGoodsID">取送货ID</param>        /// <param name="WrittenReturnID">签单返回ID</param>        /// <param name="ContractCheckClientID">合同托运客户ID</param>        /// <param name="ShipperName">托运人姓名</param>        /// <param name="ShipperPhone">托运人电话</param>        /// <param name="ShipperUnit">托运人单位</param>        /// <param name="ShipperAddress">托运人地址</param>        /// <param name="CheckAccounts">托运帐号</param>        /// <param name="ShipperPostcode">托运人邮编</param>        /// <param name="ClientManager">客户经理</param>        /// <param name="LoansNameID">取货人ID</param>        /// <param name="LoansLinkman">取货联系人</param>        /// <param name="LoansLinkmanPhone">取货联系人电话</param>        /// <param name="LoansAddress">取货地址</param>        /// <param name="ProjectID">项目ID</param>        /// <param name="ConsigneeName">收货人姓名</param>        /// <param name="ConsigneePhone">收货人电话</param>        /// <param name="ConsigneeUnit">收货人单位</param>        /// <param name="ConsigneeAddress">收货人地址</param>        /// <param name="ConsigneeAccounts">收货人帐号</param>        /// <param name="ConsigneePostcode">收货人邮编</param>        /// <param name="ConsigneeID">收货人ID</param>        /// <param name="Freight">运费</param>        /// <param name="Incidentals">杂费</param>        /// <param name="ChargesSubtotal">费用小计</param>        /// <param name="InsuredStatementNo">投保声明否</param>        /// <param name="InsuredMoney">投保金额</param>        /// <param name="Premium">保险费</param>        /// <param name="SettleAccountsWayID">结算方式ID</param>        /// <param name="BeforehandGathering">预收款</param>        /// <param name="PayAccounts">付费帐号</param>        /// <param name="Note">备注</param>        /// <param name="MakeMan">制单人</param>        /// <param name="HearTime">受理时间</param>        /// <param name="HearUnit">受理单位</param>        /// <returns>int</returns>        #region 新增订单运输信息        public int InsertOrdersTransportationInformation(string OrdersNumber,string BusinessTypeID,string ProvenanceID,string DestinationID, string LoansTime,string ArriveGoodsTime,string TakeDeliverGoodsID,                                                        string WrittenReturnID, string ContractCheckClientID,string ShipperName,string ShipperPhone,string ShipperUnit, string ShipperAddress,string CheckAccounts,                                                        string ShipperPostcode,string ClientManager, string LoansNameID,string LoansLinkman,string LoansLinkmanPhone,string LoansAddress, string ProjectID,                                                        string ConsigneeName,string ConsigneePhone,string ConsigneeUnit, string ConsigneeAddress,string ConsigneeAccounts,string ConsigneePostcode,                                                         string ConsigneeID,string Freight,string Incidentals,string ChargesSubtotal, string InsuredStatementNo,string InsuredMoney,string Premium,string SettleAccountsWayID,                                                        string BeforehandGathering,string PayAccounts,string Note,string MakeMan,string HearTime,string HearUnit)         {            //实例化订单运输表,对该表进行一一赋值            Models.PW_OrdersTransportationInformationTable myTransportationInformation = new Models.PW_OrdersTransportationInformationTable();            myTransportationInformation.OrdersNumber = OrdersNumber;            myTransportationInformation.BusinessTypeID = Convert.ToInt32(BusinessTypeID);            myTransportationInformation.ProvenanceID = Convert.ToInt32(ProvenanceID);            myTransportationInformation.DestinationID = Convert.ToInt32(DestinationID);            myTransportationInformation.LoansTime = Convert.ToDateTime(LoansTime);            myTransportationInformation.ArriveGoodsTime = Convert.ToDateTime(ArriveGoodsTime);            myTransportationInformation.TakeDeliverGoodsID = Convert.ToInt32(TakeDeliverGoodsID);            myTransportationInformation.WrittenReturnID = Convert.ToInt32(WrittenReturnID);            myTransportationInformation.ContractCheckClientID = Convert.ToInt32(ContractCheckClientID);            myTransportationInformation.ShipperName = ShipperName;            myTransportationInformation.ShipperPhone = ShipperPhone;            myTransportationInformation.ShipperUnit = ShipperUnit;            myTransportationInformation.ShipperAddress = ShipperAddress;            myTransportationInformation.CheckAccounts = CheckAccounts;            myTransportationInformation.ShipperPostcode = ShipperPostcode;            myTransportationInformation.ClientManager = ClientManager;            myTransportationInformation.LoansNameID = Convert.ToInt32(LoansNameID);            myTransportationInformation.LoansLinkman = LoansLinkman;            myTransportationInformation.LoansLinkmanPhone = LoansLinkmanPhone;            myTransportationInformation.LoansAddress = LoansAddress;            myTransportationInformation.ProjectID = Convert.ToInt32(ProjectID);            myTransportationInformation.ConsigneeName = ConsigneeName;            myTransportationInformation.ConsigneePhone = ConsigneePhone;            myTransportationInformation.ConsigneeUnit = ConsigneeUnit;            myTransportationInformation.ConsigneeAddress = ConsigneeAddress;            myTransportationInformation.ConsigneeAccounts = ConsigneeAccounts;            myTransportationInformation.ConsigneePostcode = ConsigneePostcode;            myTransportationInformation.ConsigneeID = Convert.ToInt32(ConsigneeID);            myTransportationInformation.Freight = Freight;            myTransportationInformation.Incidentals = Incidentals;            myTransportationInformation.ChargesSubtotal = ChargesSubtotal;            myTransportationInformation.InsuredStatementNo = Convert.ToBoolean(InsuredStatementNo);            myTransportationInformation.InsuredMoney = InsuredMoney;            myTransportationInformation.Premium = Premium;            myTransportationInformation.SettleAccountsWayID = Convert.ToInt32(SettleAccountsWayID);            myTransportationInformation.BeforehandGathering = BeforehandGathering;            myTransportationInformation.PayAccounts = PayAccounts;            myTransportationInformation.Note = Note;            myTransportationInformation.MakeMan = MakeMan;            myTransportationInformation.HearTime = Convert.ToDateTime(HearTime);            myTransportationInformation.HearUnit = HearUnit;            myTransportationInformation.SignForNo = false;            myTransportationInformation.ReturnSingleReceiveNo = false;            myTransportationInformation.ReviewNo = false;            myDDGL.PW_OrdersTransportationInformationTable.AddObject(myTransportationInformation);//保存以上参数到数据库表            int i = myDDGL.SaveChanges();            if (i > 0)            {                int OrdersTransportationInformationID = (from tbOrdersInformation in myDDGL.PW_OrdersTransportationInformationTable select tbOrdersInformation.OrdersTransportationInformationID).Max();                return OrdersTransportationInformationID;   //返回该数据的最大主键ID            }            else            {                return 0;            }        }<pre name="code" class="csharp">        #endregion

/// <summary>
        /// 新增运输订单的货品信息,接受界面层传过来的参数
        /// </summary>
        /// <param name="OrdersTransportationInformationID">订单运输信息ID</param>
        /// <param name="GoodsID">货品ID</param>
        /// <param name="Volume">体积</param>
        /// <param name="Quantity">数量</param>
        /// <param name="Note">备注</param>
        /// <returns>Json</returns #region 新增运输明细信息 public ActionResult InsertOrdersTransportationDetailed(int OrdersTransportationInformationID,int GoodsID, decimal Volume, decimal Quantity, string Note) {
//实例化运输订单明细表,对该表进行一一赋值 Models.PW_OrdersTransportationDetailedTable myOrdersTransportationDetailed = new Models.PW_OrdersTransportationDetailedTable(); myOrdersTransportationDetailed.OrdersTransportationInformationID = OrdersTransportationInformationID; myOrdersTransportationDetailed.GoodsID = GoodsID; myOrdersTransportationDetailed.Volume = Volume; myOrdersTransportationDetailed.Quantity = Quantity; myOrdersTransportationDetailed.Note = Note; myDDGL.PW_OrdersTransportationDetailedTable.AddObject(myOrdersTransportationDetailed);//保存以上参数到数据库表 int i = myDDGL.SaveChanges();//保存该表的改变,改变成功时,i会大于0 if (i > 0) { return Json("true", JsonRequestBehavior.AllowGet); } else { return Json("false", JsonRequestBehavior.AllowGet); } } #endregion
/// <summary>
        /// 查询项目信息,将查询出来的数据传去界面层
        /// </summary>
        /// <returns>List</returns>
#region cbo项目下拉绑定 public ActionResult SelectProjectTable() { var dtProject = from tbProject in myDDGL.SYS_ProjectTable select new { ProjectID = tbProject.ProjectID, ProjectSpecialTypeNo = tbProject.ProjectSpecialTypeNo, ProjectCode = tbProject.ProjectCode, ProjectName = tbProject.ProjectName, ProjectDescription = tbProject.ProjectDescription }; List<Dictionary<string, object>> ListReturn = new List<Dictionary<string, object>>(); foreach (var item in dtProject) //循环数据库表,将该表的数据查询出来,转换为列表形式 { Dictionary<string, object> itemProject = new Dictionary<string, object>(); foreach (System.Reflection.PropertyInfo p in item.GetType().GetProperties()) { itemProject.Add(p.Name, p.GetValue(item, null));//数据库表的数控查询出来后,循环变成(键名,键值)形式 } ListReturn.Add(itemProject); } return Json(ListReturn, JsonRequestBehavior.AllowGet);//返回Json格式 } #endregion
/// <summary>
        /// 查询客户合同信息,将该表信息传去界面层
        /// </summary>
        /// <returns>List</returns>
 #region 查询客户合同信息 public ActionResult SelectClientContractInformationTable() { var dtClientContractInformat = from tbClientContractInformat in myDDGL.SYS_ClientContractInformationTable select new { ClientContractInformationID = tbClientContractInformat.ClientContractInformationID, ContractNumber = tbClientContractInformat.ContractNumber, ContractName = tbClientContractInformat.ContractName, FreightUnitPrice = tbClientContractInformat.FreightUnitPrice, PremiumRate = tbClientContractInformat.PremiumRate }; List<Dictionary<string, object>> ListReturn = new List<Dictionary<string, object>>(); foreach (var item in dtClientContractInformat)//循环数据库表,将该表的数据查询出来,转换为列表形式 { Dictionary<string, object> itemProject = new Dictionary<string, object>(); foreach (System.Reflection.PropertyInfo p in item.GetType().GetProperties()) { itemProject.Add(p.Name, p.GetValue(item, null));//数据库表的数控查询出来后,循环变成(键名,键值)形式 } ListReturn.Add(itemProject); } return Json(ListReturn, JsonRequestBehavior.AllowGet);//返回Json格式 } #endregion

第三步:视图层(Views)


2.1(图6)

运输订单界面效果截图:


2.1(图7)

HTML代码:

<!DOCTYPE html><html><head>   <meta content="text/javascript;charset=utf-8"/>  //<head>标签里的是jQuery包的引用      <link rel="stylesheet" type="text/css" href="../../Content/themes/jquery-easyui-1.3.3/themes/default/easyui.css"/>  <link rel="stylesheet" type="text/css" href="../../Content/themes/jquery-easyui-1.3.3/themes/icon.css"/>  <link rel="stylesheet" type="text/css" href="../../Content/themes/jquery-easyui-1.3.3/demo/demo.css"/>  <script type="text/javascript" src="../../Content/themes/jquery-easyui-1.3.3/jquery.min.js"></script> <script type="text/javascript" src="../../Content/themes/jquery-easyui-1.3.3/jquery.easyui.min.js"></script></head><body>  <div class="easyui-tabs" style="border-style: none; margin-top: -18px; margin-left: -17px; margin-right: -18px;"><div title="运 输 订 单"> <div class="easyui-tabs" style="border-width: thick; border-style: none;">          <div title="订单信息">            <div class="easyui-panel" style="border-style: none; width:auto; height:auto; border-radius:15px 15px 0px 0px;">              <table style="margin-left: 50px; margin-top: 10px;">                <tr>                  <td align="right"><strong style="font-size: medium">订单号:</strong></td>                  <td><input type="text" id="txtDDH" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>                  <td>     </td>                  <td align="right"><strong style="font-size: medium">业务类型:</strong></td>                  <td><input class="easyui-combobox" id="cboYWLX" style="border-style: hidden hidden outset hidden; border-width: thin; width:150px; height:30px; " /></td>                </tr>                <tr>                  <td align="right"><strong style="font-size: medium">起发站:</strong></td>                  <td><input type="text" id="txtQFZ" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>                  <td><input type="button" onclick="OpenQiShiDi()" value="••" style="font-size: 13px;width:30px;height:30px; font-family: 楷体; color: #000000; font-weight: bold;" /></td>                  <td align="right"><strong style="font-size: medium">目的站:</strong></td>                  <td><input type="text" id="txtMDZ" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>                  <td><input type="button" onclick="OpenMuDiDi()" value="••" style="font-size: 13px;width:30px;height:30px; font-family: 楷体; color: #000000; font-weight: bold;" /></td>                </tr>                <tr>                  <td align="right"><strong style="font-size: medium">取货时间:</strong></td>                  <td><input class="easyui-datebox" id="datQHSJ" data-options="formatter:myformatter" style="border-style: hidden hidden outset hidden; border-width: thin; width:200px; height:30px; " /></td>                  <td>   </td>                                             //formatter属性,要在jQuery里学方法代码,不然界面会报错                  <td align="right"><strong style="font-size: medium">到货时间:</strong></td>                  <td><input class="easyui-datebox" id="datDHSJ" data-options="formatter:myformatter" style="border-style: hidden hidden outset hidden; border-width: thin; width:200px; height:30px; " /></td>                </tr>                                                            //formatter属性,要在jQuery里学方法代码,不然界面会报错              </table>              <table style="margin-left: 50px; margin-top: 10px;">                <tr>                  <td align="right"><strong style="font-size: medium">是否取送:</strong></td>                  <td><input type="checkbox" id="ckQuHuo"/></td>                  <td><strong style="font-size: medium">取货</strong></td>                  <td><input type="checkbox" id="ckSiongHuo"/></td>                  <td><strong style="font-size: medium">送货</strong></td>                  <td>          </td><td>          </td>                  <td align="right"><strong style="font-size: medium">签单返回:</strong></td>                  <td><input type="checkbox" id="ckYunDan"/></td>                  <td><strong style="font-size: medium">运单</strong></td>                  <td><input type="checkbox" id="ckKeDan"/></td>                  <td><strong style="font-size: medium">客户单据</strong></td>                </tr>              </table>              <table style="margin-left: 50px; margin-top: 10px;">                <tr>                  <td align="right"><strong style="font-size: medium">托运人姓名:</strong></td>                  <td><input type="text" id="txtXM" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>                  <td>   </td>                  <td align="right"><strong style="font-size: medium">托运人电话:</strong></td>                  <td><input type="text" id="txtDH" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>                </tr>              </table>              <table style="margin-left: 50px; margin-top: 10px;">                <tr>                  <td align="right"><strong style="font-size: medium">托运人单位:</strong></td>                  <td><input type="text" id="txtDW" style="border-style: hidden hidden outset hidden; border-width: thin; width:550px; height:30px; " /></td>                </tr>                <tr>                  <td align="right"><strong style="font-size: medium">托运人地址:</strong></td>                  <td><input type="text" id="txtDZ" style="border-style: hidden hidden outset hidden; border-width: thin; width:550px; height:30px; " /></td>                </tr>              </table>              <table style="margin-left: 50px; margin-top: 10px;">                <tr>                  <td align="right"><strong style="font-size: medium">托运人账号:</strong></td>                  <td><input type="text" id="txtZH" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>                  <td><input type="button" value="••" style="font-size: 13px;width:30px;height:30px; font-family: 楷体; color: #000000; font-weight: bold;" /></td>                  <td>  </td>                  <td align="right"><strong style="font-size: medium">托运人邮编:</strong></td>                  <td><input type="text" id="txtYB" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>                </tr>                <tr>                  <td align="right"><strong style="font-size: medium">客户经理:</strong></td>                  <td><input type="text" id="txtJL" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>                </tr>                <tr>                  <td align="right"><strong style="font-size: medium">取货联系人:</strong></td>                  <td><input type="text" id="txtQHLZR" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>                  <td><input type="button" value="••" style="font-size: 13px;width:30px;height:30px; font-family: 楷体; color: #000000; font-weight: bold;" /></td>                  <td>  </td>                  <td align="right"><strong style="font-size: medium">取货联系人电话:</strong></td>                  <td><input type="text" id="txtLXRDH" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>                </tr>              </table>              <table style="margin-left: 50px; margin-top: 10px;">                <tr>                  <td align="right"><strong style="font-size: medium">取货地址:</strong></td>                  <td><input type="text" id="txtQHDZ" style="border-style: hidden hidden outset hidden; border-width: thin; width:550px; height:30px; " /></td>                </tr>                <tr>                  <td><input type="button" value="保存为客户" style="font-size: 18px;width:100px; font-family: 楷体; color: #CC33FF" /></td>                </tr>              </table>              <table style="margin-left: 50px; margin-top: 10px;">                <tr>                 <td align="right"><strong style="font-size: medium">项目名称:</strong></td>                 <td><input class="easyui-combobox" id="cboXMMC" style="border-style: hidden hidden outset hidden; border-width: thin; width:150px; height:30px; " /></td>                </tr>                <tr>                  <td align="right"><strong style="font-size: medium">收货人姓名:</strong></td>                  <td><input type="text" id="txtSHR" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>                  <td>   </td>                  <td align="right"><strong style="font-size: medium">收货人电话:</strong></td>                  <td><input type="text" id="txtSHRDH" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>                </tr>              </table>              <table style="margin-left: 50px; margin-top: 10px;">                <tr>                  <td align="right"><strong style="font-size: medium">收货人单位:</strong></td>                  <td><input type="text" id="txtSHRDW" style="border-style: hidden hidden outset hidden; border-width: thin; width:550px; height:30px; " /></td>                </tr>                <tr>                  <td align="right"><strong style="font-size: medium">收货人地址:</strong></td>                  <td><input type="text" id="txtSHRDZ" style="border-style: hidden hidden outset hidden; border-width: thin; width:550px; height:30px; " /></td>                </tr>              </table>              <table style="margin-left: 50px; margin-top: 10px;">                <tr>                  <td align="right"><strong style="font-size: medium">收货人账号:</strong></td>                  <td><input type="text" id="txtSHRZH" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>                  <td><input type="button" value="••" style="font-size: 13px;width:30px;height:30px; font-family: 楷体; color: #000000; font-weight: bold;" /></td>                  <td>  </td>                  <td align="right"><strong style="font-size: medium">收货人邮编:</strong></td>                  <td><input type="text" id="txtSHRYB" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>                </tr>                <tr>                  <td><input type="button" value="保存收货人" style="font-size: 18px;width:100px; font-family: 楷体; color: #CC33FF" /></td>                </tr>              </table>              <table style="margin-left: 50px; margin-top: 10px;">                <tr>                  <td align="right"><strong style="font-size: medium">运费:</strong></td>                  <td><input type="text" id="txtYF" style="border-style: hidden hidden outset hidden; border-width: thin; width:150px; height:30px; " /></td>                  <td>   </td>                  <td align="right"><strong style="font-size: medium">杂费:</strong></td>                  <td><input type="text" id="txtZF" style="border-style: hidden hidden outset hidden; border-width: thin; width:150px; height:30px; " /></td>                  <td>   </td>                  <td align="right"><strong style="font-size: medium">费用小计:</strong></td>                  <td><input type="text" id="txtXJ" onclick="YunFeiXiaoJi()" style="border-style: hidden hidden outset hidden; border-width: thin; width:150px; height:30px; " /></td>                </tr>                <tr>                  <td align="right"><strong style="font-size: medium">投保声明:</strong></td>                  <td><select id="cboTBSM" style="border-width: thin; width:150px; height:30px; ">                  <option value="true">是</option>                  <option value="false">否</option></select></td>                  <td>   </td>                  <td align="right"><strong style="font-size: medium">投保金额:</strong></td>                  <td><input type="text" id="txtTBJE" style="border-style: hidden hidden outset hidden; border-width: thin; width:150px; height:30px; " /></td>                  <td>   </td>                  <td align="right"><strong style="font-size: medium">保险费:</strong></td>                  <td><input type="text" id="txtBXF" style="border-style: hidden hidden outset hidden; border-width: thin; width:150px; height:30px; " /></td>                </tr>              </table>              <table style="margin-left: 50px; margin-top: 10px;">                <tr>                  <td align="right"><strong style="font-size: medium">运杂费合计:</strong></td>                  <td><input type="text" id="txtHJ" onclick="FeiYongHeJi()" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>                </tr>                <tr><td><input type="button" onclick="AnHeTongJiSuan()" value="按合同计算费用" style="font-size: 18px;width:100px; font-family: 楷体; color: #CC33FF" /></td></tr>              </table>              <table style="margin-left: 50px; margin-top: 10px;">                <tr>                 <td><strong style="font-size: medium">结算方式:</strong></td>                 <td><input type="radio" name="JS" id="TYRXianJie" /></td><td><strong style="font-size: medium">托运人现结</strong></td>                 <td><input type="radio" name="JS" id="TYRYueJie" /></td><td><strong style="font-size: medium">托运人月结</strong></td>                 <td><input type="radio" name="JS" id="SHRXianJie" /></td><td><strong style="font-size: medium">收货人现结</strong></td>                 <td><input type="radio" name="JS" id="SHRYueJiee" /></td><td><strong style="font-size: medium">收货人月结</strong></td>                 <td><input type="radio" name="JS" id="DSFFuFei" /></td><td><strong style="font-size: medium">第三方付费</strong></td>                </tr>              </table>              <table style="margin-left: 50px; margin-top: 10px;">                <tr>                  <td align="right"><strong style="font-size: medium">预收款:</strong></td>                  <td><input type="text" id="txtYSK" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>                  <td>   </td>                  <td align="right"><strong style="font-size: medium">付费账号:</strong></td>                  <td><input type="text" id="txtFFZH" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>                </tr>              </table>              <table style="margin-left: 50px; margin-top: 10px;">                <tr>                  <td align="right"><strong style="font-size: medium">备注:</strong></td>                  <td><input type="text" id="txtBZ" style="border-style: hidden hidden outset hidden; border-width: thin; width:550px; height:30px; " /></td>                </tr>              </table>              <table style="margin-left: 30px; margin-top: 10px;">                <tr>                  <td align="right"><strong style="font-size: medium">制单人:</strong></td>                  <td><input type="text" id="txtZDR" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>                </tr>                <tr>                  <td align="right"><strong style="font-size: medium">受理日期:</strong></td>                  <td><input class="easyui-datebox" id="txtSLRQ" data-options="formatter:myformatter" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>                  <td>   </td>                  <td align="right"><strong style="font-size: medium">受理单位:</strong></td>                  <td><input type="text" id="txtSLDW" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>                </tr>              </table>            </div>          </div>          <div title="订单货品">              <div class="easyui-panel" style="border-style: none; width:auto; height:auto; border-radius:15px 15px 0px 0px;">              <table>                  <tr>                    <td><input type="button" onclick="SelectYunShuGoodsTable()" value="添加货品" style="font-size: 18px;width:100px; font-family: 楷体; color: #CC33FF" /></td>                  </tr>                </table>              <table id="tb运输订单货品" class="easyui-datagrid" style="width:auto; height:200px;" data-options="singleSelect:true,scrolling:true,       onClickRow:onClickRowQiYongEdit,onAfterEdit:onYunShuAfterEdit">                  <thead>                    <tr>                                                     //formatter属性,要在jQuery里学方法代码,不然界面会报错                     <th data-options="field:'GoodsID',width:50,align:'center',formatter:returnBtnYS"><img src="../../Content/图片/删除.jpg" /></th>                     <th data-options="field:'GoodsCoding',width:100,editor:'true',align:'center'">货品编码</th>                     <th data-options="field:'GoodsName',width:100,editor:'true',align:'center'">货品名称</th>                     <th data-options="field:'Unit',width:100,editor:'combobox',align:'center'">单位</th>                     <th data-options="field:'Volume',width:100,editor:'numberbox',align:'center'">体积</th>                           <th data-options="field:'Quantity',width:100,editor:'numberbox',align:'center'">数量</th>                     <th data-options="field:'Note',width:100,editor:'text',align:'center'">备注</th>                    </tr>                  </thead>                </table>                <table id="tb运输订单货品信息" class="easyui-datagrid" style="width:auto; height:200px;" data-options="singleSelect:true,scrolling:true, onDblClickRow:DblYunShuHuoPinDatagrid">                  <thead>                    <tr>                     <th data-options="field:'GoodsID',width:100,hidden:true,align:'center'">货品ID</th>                     <th data-options="field:'GoodsCoding',width:100,align:'center'">货品编码</th>                     <th data-options="field:'GoodsName',width:100,align:'center'">货品名称</th>                     <th data-options="field:'BarCode',width:100,align:'center'">条形码</th>                     <th data-options="field:'SpellCode',width:100,align:'center'">拼音码</th>                     <th data-options="field:'Standard',width:100,align:'center'">规格</th>                     <th data-options="field:'UnitID',width:100,hidden:true,align:'center'">单位ID</th>                     <th data-options="field:'Unit',width:100,align:'center'">单位</th>                     <th data-options="field:'QualityID',width:100,hidden:true,align:'center'">质量ID</th>                     <th data-options="field:'Quality',width:100,align:'center'">质量</th>                                <th data-options="field:'Weight',width:100,align:'center'">重量</th>                    </tr>                  </thead>                </table>            </div>          </div>       </div>        <table style="margin-left: 400px;">            <tr>                <td><input type="button" onclick="InsertOrdersTransportationInformation()" value="提 交" style="font-size: 18px;width:100px; font-family: 楷体; color: #CC33FF" /></td>            </tr>        </table></div>  </div><div class="easyui-window" id="HeTongXinXi" title="客户合同信息" style="border-style: none; width:400px; height:250px; border-radius:15px 15px 0px 0px;"       data-options="draggable:false,resizable:false,collapsible:false,minimizable:false,maximizable:false,closed:true">      <table id="tb客户合同信息" class="easyui-datagrid" style="width:auto; height:auto;"              data-options="scrolling:true,singleSelect:true,onDblClickRow:DblKeHuHeTong">//datagrid的onDblClickRow事件,要在jQuery里学方法代码。        <thead>           <tr>             <th data-options="field:'ClientContractInformationID',width:80,hidden:true,align:'center'">客户合同信息ID</th>             <th data-options="field:'ContractNumber',width:100,align:'center'">合同编码</th>             <th data-options="field:'ContractName',width:100,align:'center'">合同名称</th>             <th data-options="field:'FreightUnitPrice',width:80,align:'center'">运费单价</th>             <th data-options="field:'PremiumRate',width:80,align:'center'">保险费率</th>           </tr>        </thead>      </table>  </div></body></html>

jQuery代码:

<script type="text/javascript">    $(document).ready(function () {        cboBinDing();//HTML加载时,预先执行下拉框绑定方法});    function returnBtnYS(GoodsID, row, rowIndex) {        return "<a href='javascript:YSShanChu(" + GoodsID + "," + rowIndex + ")'>" + '<img src="../../Content/图片/删除.jpg" />' + "</a>";    }//订单货品数据表格datagrid里添加删除按钮,点击删除图标执行下面删除方法    function YSShanChu(GoodsID, rowIndex) { //删除运输明细        $('#tb运输订单货品').datagrid('cancelEdit', editIndex).datagrid('deleteRow', editIndex);    }    function cboBinDing() {    //运输订单下拉框的绑定   $.getJSON("/DingDanLuRu/cboBinDing?AttributeAssembleID=32",  //业务类型绑定           function (data) {               $("#cboYWLX").combobox({ data: data, valueField: 'AttributeDetailedID',                   textField: 'AttributeDetailedName'               });           });           $.getJSON("/DingDanLuRu/SelectProjectTable",  //项目           function (data) {               $("#cboXMMC").combobox({ data: data, valueField: 'ProjectID',                   textField: 'ProjectName'               });           });}//定义一个全局变量,并把它赋值为未定义       var editIndex = undefined;       //启用单元格编辑状态       function onClickRowQiYongEdit(index) {           if (editIndex != index) {               $('#tb运输订单货品').datagrid('beginEdit', index);               $('#tb运输订单货品').datagrid('endEdit', editIndex);               editIndex = index;           }       }      function SelectYunShuGoodsTable() {  //运输货品单击添加,查询货品          $("#tb运输订单货品信息").datagrid({ url: "/DingDanLuRu/SelectGoodsTable" });      }      function DblYunShuHuoPinDatagrid() {  //双击事件,将货品信息更新到运输订单货品          var rowHuoPinDatagrid = $('#tb运输订单货品信息').datagrid('getSelected');          var rowMingXi = $('#tb运输订单货品').datagrid('getSelected');          $('#tb运输订单货品').datagrid('appendRow',                                        { GoodsID: rowHuoPinDatagrid.GoodsID,                                            GoodsCoding: rowHuoPinDatagrid.GoodsCoding,                                            GoodsName: rowHuoPinDatagrid.GoodsName,                                            Standard: rowHuoPinDatagrid.Standard,                                            Batch: "0.00",                                            Volume: "0.00",                                            UnitID: rowHuoPinDatagrid.UnitID,                                            Unit: rowHuoPinDatagrid.Unit,                                            QualityID: rowHuoPinDatagrid.QualityID,                                            Quality: rowHuoPinDatagrid.Quality,                                            Quantity: '0.00',                                            Weight: rowHuoPinDatagrid.Weight                                        });                                        editIndex = $('#tb运输订单货品').datagrid('getRows').length - 1;                                        $('#tb运输订单货品').datagrid('selectRow', editIndex);                     $('#tb运输订单货品').datagrid('beginEdit', editIndex).datagrid('endEdit', editIndex - 1);                                    }       var ZongZhongLiang = 0;       function onYunShuAfterEdit(rowIndex, rowData, changes) { //当用户编辑完成时触发事件,获取编辑行的数据,并进行运算,在返回改变显示值           var dataMingXi = $('#tb运输订单货品').datagrid('getData');            var Batch = dataMingXi.rows[rowIndex].Batch;            var Quantity = dataMingXi.rows[rowIndex].Quantity;            var Weight = dataMingXi.rows[rowIndex].Weight;            var Note = dataMingXi.rows[rowIndex].Note;            $('#tb运输订单货品').datagrid('refreshRow', rowIndex); //refreshRow:刷新一行             for (var i = 0; i < dataMingXi.rows.length; i++) {                ZongZhongLiang += dataMingXi.rows[i].Weight;  //计算货品总重量            }        }        OrdersTransportationInformationID = 0; //声明主键ID为全局变量      function InsertOrdersTransportationInformation() {  //新增运输订单信息          try {              if (document.getElementById("TYRXianJie").checked) {  //结算方式单选框判断                  SettleAccountsWayID = 67;              } else if (document.getElementById("TYRYueJie").checked) {                  SettleAccountsWayID = 68;              } else if (document.getElementById("SHRXianJie").checked) {                  SettleAccountsWayID = 69;              } else if (document.getElementById("SHRYueJiee").checked) {                  SettleAccountsWayID = 70;              } else if (document.getElementById("DSFFuFei").checked) {                  SettleAccountsWayID = 71;              }          } catch (e) {              return null;          }          try {              if (document.getElementById("ckQuHuo").checked) {                  TakeDeliverGoodsID = 265;              } else if (document.getElementById("ckSiongHuo").checked) {                  TakeDeliverGoodsID = 266;              } else {              TakeDeliverGoodsID = null;          }          if (document.getElementById("ckYunDan").checked) {              WrittenReturnID = 267;          } else if (document.getElementById("ckKeDan").checked) {              WrittenReturnID = 270;          } else {              TakeDeliverGoodsID = null;          }      } catch (e) {          return null;      }          if (confirm("是否添加?")) {           $.getJSON("/DingDanLuRu/InsertOrdersTransportationInformation?OrdersNumber=" + $('#txtDDH').val() +              "&BusinessTypeID=" + $('#cboYWLX').combobox('getValue') +              "&ProvenanceID=" + QiShiDiID +              "&DestinationID=" + MuDiDiID +              "&LoansTime=" + $('#datQHSJ').datebox('getValue') +              "&ArriveGoodsTime=" + $('#datDHSJ').datebox('getValue') +              "&TakeDeliverGoodsID=" + TakeDeliverGoodsID +   //取送货              "&WrittenReturnID=" + WrittenReturnID +  //签单返回              "&ContractCheckClientID=2" +              "&ShipperName=" + $('#txtXM').val() +              "&ShipperPhone=" + $('#txtDH').val() +              "&ShipperUnit=" + $('#txtDW').val() +              "&ShipperAddress=" + $('#txtDZ').val() +              "&CheckAccounts=" + $('#txtZH').val() +              "&ShipperPostcode=" + $('#txtYB').val() +              "&ClientManager=" + $('#txtJL').val() +              "&LoansNameID=3" +              "&LoansLinkman=" + $('#txtQHLZR').val() +              "&LoansLinkmanPhone=" + $('#txtLXRDH').val() +              "&ClientManager=" + $('#txtLXRDH').val() +              "&LoansAddress=" + $('#txtQHDZ').val() +              "&ProjectID=" + $('#cboXMMC').combobox('getValue') +              "&ConsigneeName=" + $('#txtSHR').val() +              "&ConsigneePhone=" + $('#txtSHRDH').val() +              "&ConsigneeUnit=" + $('#txtSHRDW').val() +              "&ConsigneeAddress=" + $('#txtSHRDZ').val() +              "&ConsigneeAccounts=" + $('#txtSHRZH').val() +              "&ConsigneePostcode=" + $('#txtSHRYB').val() +              "&ConsigneeID=3" +              "&Freight=" + $('#txtYF').val() +              "&Incidentals=" + $('#txtZF').val() +              "&ChargesSubtotal=" + $('#txtXJ').val() +              "&InsuredStatementNo=" + $('#cboTBSM').val() + //投保声明              "&InsuredMoney=" + $('#txtTBJE').val() +              "&Premium=" + $('#txtBXF').val() +              "&SettleAccountsWayID=" + SettleAccountsWayID +  //结算方式              "&BeforehandGathering=" + $('#txtYSK').val() +              "&PayAccounts=" + $('#txtFFZH').val() +              "&Note=" + $('#txtBZ').val() +              "&MakeMan=" + $('#txtZDR').val() +              "&HearTime=" + $('#txtSLRQ').datebox('getValue') +              "&HearUnit=" + $('#txtSLDW').val(),              function (data) {                  OrdersTransportationInformationID = data; //运输订单信息新增完成时,返回最大主键ID                  if (data != null) {                      InsertOrdersTransportationDetailed();                      alert("添加成功!");                  } else {                      alert("添加失败!");                  }              });          } else {             return null;          }     }     function InsertOrdersTransportationDetailed() {  //新增运输明细信息             var dataMingXi = $('#tb运输订单货品').datagrid('getData');             for (var i = 0; i < dataMingXi.rows.length; i++) {$.getJSON("/DingDanLuRu/InsertOrdersTransportationDetailed?OrdersTransportationInformationID=" + OrdersTransportationInformationID +                                                                   "&GoodsID=" + dataMingXi.rows[i].GoodsID +                                                                   "&Volume=" + dataMingXi.rows[i].Volume +                                                                  "&Quantity=" + dataMingXi.rows[i].Quantity +                                                                   "&Note=" + dataMingXi.rows[i].Note,                                                                   function (data) {                                                                       if (data == "false") {                                                                           alert("新增失败!");                                                                       }                                                                   });             }     }     function YunFeiXiaoJi() {   //运费小计         var Freight = parseInt($('#txtYF').val());         var Incidentals = parseInt($('#txtZF').val());         var YunFeiXiaoJi = Freight + Incidentals;         $('#txtXJ').val(YunFeiXiaoJi);     }     function FeiYongHeJi() {  //费用合计         var Freight = parseInt($('#txtYF').val());         var Incidentals = parseInt($('#txtZF').val());         var ChargesSubtotal = parseInt($('#txtXJ').val());         var InsuredMoney = parseInt($('#txtTBJE').val());         var Premium = parseInt($('#txtBXF').val());         var FeiYongHeJi = Freight + Incidentals + ChargesSubtotal + InsuredMoney + Premium;         $('#txtHJ').val(FeiYongHeJi);     }     function AnHeTongJiSuan() {    //单击按合同计算         $("#tb客户合同信息").datagrid({ url: "/DingDanLuRu/SelectClientContractInformationTable" });         $("#HeTongXinXi").window('open');     }     function DblKeHuHeTong() {   //双击后计算运费和保险费         if (ZongZhongLiang == 0) {             alert("请先添加货品!");             $("#HeTongXinXi").window('close');         } else {             var row = $("#tb客户合同信息").datagrid('getSelected');             if (row) {                 FreightUnitPrice = row.FreightUnitPrice;                 PremiumRate = row.PremiumRate;                 $('#txtYF').val(FreightUnitPrice * ZongZhongLiang);                 if ($('#cboTBSM').val() == "true") {                     $('#txtBXF').val(FreightUnitPrice * PremiumRate);                 }                 $("#HeTongXinXi").window('close');             }         }     }</script>
仅供学习,禁止用于商业用途





0 0