北京络捷斯特第三方物流信息系统技术解析(二) 订单录入-入库订单
订单录入该模块包括了各种订单的录入,有入库,出库,运输,配送,加工等订单的录入。
界面效果图:
2.1(图1)
2.1.1 入库订单
入库订单的录入要录入它的订单信息,订单入库信息和货品信息。
订单信息:该页面是编写订单的基本信息
订单入库信息:可以编写与库房相关的信息,当入库方式选择“仓提”时,要填写运输信息。
货品信息:点击添加货品按钮,系统会查询出该入库订单所需要添加的货品,双击选中下方的货品信息,则添加一条所需货品,编写该货品是批次、数量、备注等信息。
从界面上可以看到我们这里用到的控件有
控件名称 | 说明 |
日期控件(easyui-datebox) | 第一要设置每个控件的id,第二设置大小不设置也有默认,第三(data-options)是数据操作:可以设置控件的一些属性和事件 |
表格(easyui-datagrid) | |
下拉框(easyui-combobox) | |
选项卡(easyui-tabs) |
入库订单功能实现:
第一步:数据库
1、表和关系
表1:订单信息表(PW_OrdersInformationTable)
列名 | 数据类型 | 主键/外键 | 说明 |
OrdersInformationID | int | 主键 | 订单信息ID |
OrdersMark | nchar(50) |
| 订单号 |
ClientID | int | 外键 | 客户ID |
ClientInstructMark | nchar(50) |
| 客户指令号 |
PurchaseOrdersNumber | nchar(50) |
| 采购订单号 |
OrdersTypeID | int | 外键 | 订单类型ID |
UrgencyDegreeID | int | 外键 | 紧急程度ID |
OrdersSourceID | int | 外键 | 订单来源ID |
PledgeBankID | int | 外键 | 质押银行ID |
Note | nchar(50) |
| 备注 |
EntryTime | date |
| 录入时间 |
RepairNo | Bit |
| 补录否 |
表2:订单入库信息表(PW_OrdersWarehousingInformationTable)
列名 | 数据类型 | 主键/外键 | 说明 |
OrdersWarehousingInformationID | int | 主键 | 订单入库信息ID |
OrdersInformationID | int | 外键 | 订单信息ID |
StoreroomID | int | 外键 | 库房ID |
WarehousingTypeID | int | 外键 | 入库类型ID |
WarehousingWayID | int | 外键 | 入库方式ID |
PredictWarehousingTime | date |
| 预计入库时间 |
Note | nchar(50) |
| 备注 |
表3:订单入库明细表(PW_OrdersWarehousingDetailedTable)
列名 | 数据类型 | 主键/外键 | 说明 |
OrdersWarehousingDetailedID | int | 主键 | 订单入库明细ID |
OrdersWarehousingInformationID | int | 外键 | 订单入库信息ID |
GoodsID | int | 外键 | 货品ID |
Batch | nchar(50) |
| 批次 |
Quantity | decimal(18, 2) |
| 数量 |
Note | nchar(50) |
| 备注 |
表4:运输信息表SYS_TransportationInformationTable)
列名 | 数据类型 | 主键/外键 | 说明 |
TransportationInformationID | int | 主键 | 运输信息ID |
OrdersWarehousingInformationID | int | 外键 | 订单入库信息ID |
OrdersOutboundInformationID | int | 外键 | 订单出库信息ID |
RiseCarryLandID | int | 外键 | 起运地ID |
ArriveLandID | int | 外键 | 到达地ID |
RiseCarryAddress | nchar(50) |
| 起运地址 |
LinkmanName | nchar(50) |
| 联系人姓名 |
LinkmanPhone | nchar(50) |
| 联系人电话 |
GoodsUnitID | int | 外键 | 收货单位ID |
LinkmanAddress | nchar(50) |
| 联系人地址 |
StoreroomID | int | 外键 | 库房ID |
TransportationWayID | int | 外键 | 运输方式ID |
ShipmentTime | date |
| 起运时间 |
EstimatedArriveTime | date |
| 预计到达时间 |
Note | nchar(50) |
| 备注 |
Freight | decimal(18, 2) |
| 运费 |
InsureFee | decimal(18, 2) |
| 保险费 |
OtherCost | decimal(18, 2) |
| 其它费用 |
InsureMoney | decimal(18, 2) |
| 投保金额 |
Fax | nchar(50) |
| 传真 |
表5:货品表(SYS_GoodsTable)
列名 | 数据类型 | 主键/外键 | 说明 |
GoodsID | int | 主键 | 货品ID |
GoodsCoding | nchar(50) |
| 货品编码 |
GoodsName | nchar(50) |
| 货品名称 |
Standard | nchar(50) |
| 规格 |
Weight | decimal(18, 2) |
| 重量 |
UnitID | int | 外键 | 单位ID |
ClientID | int | 外键 | 客户ID |
BarCode | nchar(50) |
| 条形码 |
SpellCode | nchar(50) |
| 拼音码 |
GoodsCategoryID | int | 外键 | 货品类别ID |
Model | nchar(50) |
| 型号 |
Manufacturer | nchar(50) |
| 生产厂家 |
GoodsTypeID | int | 外键 | 货品类型ID |
QualityID | int | 外键 | 质量ID |
UnitPrice | decimal(18, 2) |
| 单价 |
Note | nchar(50) |
| 备注 |
控件使用方法:
1、 日期控件(easyui-datebox)
日期控件截图:
创建日期控件界面代码:
<input id="dtpKaiShiShiJian" class="easyui-datebox" style="width: 95px; height: 28px" data-options="formatter: myformatter " >
<input id="dtpJieShuJian" class="easyui-datebox" style="width: 95px; height: 28px" data-options="formatter: myformatter " />
function myformatter(date) { //转化日期样式:yyyy-mm-dd
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);
//三目运算:当m<10时就运算('0' + m),反之直接输出m
例如:m=5时,输出是05,如果是大于10,则直接输出
}
获取时间控件的日期:
$('#dtpKaiShiShiJian').datebox("getValue");
2、 下拉框(easyui-combobox)
下拉框截图:
2.1(图7)
创建下拉框控件界面代码:
<td align="right"><strong style="font-size: medium">订单类型:</strong></td>
<td><input class="easyui-combobox" id="cboDingDanLeiXing" style="border-style: hidden hidden outset hidden; border-width: thin; width:150px; height:30px; " /></td>
</span>
<span style="font-size:18px;"><script type="text/javascript">
$(document).ready(function () { / /html加载时执行的方法
cboBinDing();
});
function cboBinDing() { //各种下拉框的绑定
$.getJSON("/DingDanLuRu/cboBinDing?AttributeAssembleID=22",
function (data) {
$("#cboDingDanLeiXing").combobox({ data: data, valueField: 'AttributeDetailedID',
textField: 'AttributeDetailedName'
});
$("#cboDingDanLeiXing").combobox('select', 82); //默认选项
});
}
</script>
3、 表格(easyui-datagrid)
表格截图:
创建表格控件界面代码:
<table id="tb货品信息" class="easyui-datagrid" style="width:auto; height:200px;" data-options="singleSelect:true,scrolling:true ">
<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>
4、 按钮(button)
按钮截图:
创建按钮控件界面代码:
<td><input type="button" οnclick="SelectGoodsTable()" value="添加货品" style="font-size: 18px;width:100px; font-family: 楷体; color: #CC33FF" /></td>
<script type="text/javascript">
function SelectGoodsTable() { //入库时单击添加货品,查询货品
$("#tb货品信息").datagrid({ url: "/DingDanLuRu/SelectGoodsTable" });
} //该单据事件加载的数据是上表格里所需要的数据。URL是控制器的路径
</script>
5、 选项卡(easyui-tabs)
按钮截图:
创建选项卡控件界面代码:
<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>
<div title="订单入库信息"></div>
<div title="订单货品"></div>
</div>
</div>
<div title="出 库 订 单"></div>
<div title="运 输 订 单"></div>
<div title="配 送订 单"></div>
<div title="库 内 订 单"></div>
</div>
第二步:控制器(Controllers)
2.1(图12)
Controllers(控制器)代码:
/// <summary>
/// 各种下拉框绑定
/// </summary>
/// <param name="AttributeAssembleID">属性明细ID</param>
/// <returns></returns>
#region 下拉框的绑定代码
public ActionResult cboBinDing(int AttributeAssembleID)
{
var dtCbo =from tbCbo in myDDGL.SYS_AttributeDetailedTable
where tbCbo.AttributeAssembleID == AttributeAssembleID
select new
{
AttributeDetailedID = tbCbo.AttributeDetailedID,
AttributeDetailedName = tbCbo.AttributeDetailedName
};
List<Dictionary<string, object>> ListReturn = new List<Dictionary<string, object>>();
foreach (var item in dtCbo)
{
Dictionary<string, object> itemCbo = new Dictionary<string, object>();
foreach (System.Reflection.PropertyInfo p in item.GetType().GetProperties())
{
itemCbo.Add(p.Name, p.GetValue(item, null));
}
ListReturn.Add(itemCbo);
}
return Json(ListReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 查询客户
/// <summary>
/// 查询客户信息,将数据传去界面层
/// </summary>
/// <returns>Json</returns>
public ActionResult SelectClientTable()
{
var dtClient = from tbClient in myDDGL.SYS_ClientTable
select new
{
ClientID = tbClient.ClientID,
ClientAccounts = tbClient.ClientAccounts,
ClientCode = tbClient.ClientCode,
ClientUnitName = tbClient.ClientUnitName
};
List<Dictionary<string, object>> ListReturn = new List<Dictionary<string, object>>();
foreach (var item in dtClient)
{
Dictionary<string, object> itemClient = new Dictionary<string, object>();
foreach (System.Reflection.PropertyInfo p in item.GetType().GetProperties())
{
itemClient.Add(p.Name, p.GetValue(item, null));
}
ListReturn.Add(itemClient);
}
return Json(ListReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 查询银行
/// <summary>
/// 查询银行表,将银行表信息,遍历循环出来,传去界面层
/// </summary>
/// <returns>Json</returns>
public ActionResult SelectBankTable()
{
var dtBank = from tbBank in myDDGL.SYS_BankTable
select new
{
BankID = tbBank.BankID,
BankName = tbBank.BankName,
Phone = tbBank.Phone,
Address = tbBank.Address
};
List<Dictionary<string, object>> ListReturn = new List<Dictionary<string, object>>();
foreach (var item in dtBank)
{
Dictionary<string, object> itemBank = new Dictionary<string, object>();
foreach (System.Reflection.PropertyInfo p in item.GetType().GetProperties())
{
itemBank.Add(p.Name, p.GetValue(item, null));
}
ListReturn.Add(itemBank);
}
return Json(ListReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 新增订单信息
/// <summary>
/// 接收界面层传过来的参数,新增订单信息
/// </summary>
/// <param name="OrdersMark">订单号</param>
/// <param name="ClientID">客户ID</param>
/// <param name="ClientInstructMark">客户指令号</param>
/// <param name="PurchaseOrdersNumber">采购订单号</param>
/// <param name="OrdersTypeID">订单类型ID</param>
/// <param name="UrgencyDegreeID">紧急程度ID</param>
/// <param name="OrdersSourceID">订单来源ID</param>
/// <param name="OrderTime">下达时间</param>
/// <param name="StateID">状态ID</param>
/// <param name="ExecuteStateID">执行状态ID</param>
/// <param name="OrdersPriorLevel">订单优先级</param>
/// <param name="PledgeBankID">质押银行ID</param>
/// <param name="Note">备注</param>
/// <param name="EntryTime">录入时间</param>
/// <returns>int</returns>
public int InsertOrdersInformationTable(string OrdersMark,string ClientID,string ClientInstructMark,string PurchaseOrdersNumber, string OrdersTypeID,string UrgencyDegreeID,string OrdersSourceID,string OrderTime,string StateID, string ExecuteStateID,string OrdersPriorLevel,string PledgeBankID,string Note, string EntryTime)
{
Models.PW_OrdersInformationTable myOrdersInformation = new Models.PW_OrdersInformationTable();//实例化订单信息表
myOrdersInformation.OrdersMark = OrdersMark;
myOrdersInformation.ClientID = Convert.ToInt32(ClientID);
myOrdersInformation.ClientInstructMark = ClientInstructMark;
myOrdersInformation.PurchaseOrdersNumber = PurchaseOrdersNumber;
myOrdersInformation.OrdersTypeID = Convert.ToInt32(OrdersTypeID);
myOrdersInformation.UrgencyDegreeID = Convert.ToInt32(UrgencyDegreeID);
myOrdersInformation.OrdersSourceID = Convert.ToInt32(OrdersSourceID);
myOrdersInformation.OrderTime = Convert.ToDateTime(OrderTime);
myOrdersInformation.StateID = Convert.ToInt32(StateID);
myOrdersInformation.ExecuteStateID = Convert.ToInt32(ExecuteStateID);
myOrdersInformation.OrdersPriorLevel = OrdersPriorLevel;
myOrdersInformation.PledgeBankID = Convert.ToInt32(PledgeBankID);
myOrdersInformation.Note = Note;
myOrdersInformation.EntryTime = Convert.ToDateTime(EntryTime);
myOrdersInformation.RepairNo = false;
myDDGL.PW_OrdersInformationTable.AddObject(myOrdersInformation);//将以上参数保存到数据库表
int i = myDDGL.SaveChanges();
if (i > 0)
{
int OrdersInformationID = (from tbOrdersInformation in myDDGL.PW_OrdersInformationTable select tbOrdersInformation.OrdersInformationID).Max();
return OrdersInformationID;//返回新增该数据的主键ID值
}
else
{
return 0;
}
}
#endregion
#region 新增入库订单信息
/// <summary>
/// 接收界面层传过来的参数,新增入库订单信息
/// </summary>
/// <param name="OrdersInformationID">订单信息ID</param>
/// <param name="StoreroomID">库房ID</param>
/// <param name="WarehousingTypeID">入库类型ID</param>
/// <param name="WarehousingWayID">入库方式ID</param>
/// <param name="PredictWarehousingTime">预计入库时间</param>
/// <param name="Note">备注</param>
/// <returns>int</returns>
public int InsertOrdersWarehousingInformationTable(string OrdersInformationID,string StoreroomID,string WarehousingTypeID, string WarehousingWayID, string PredictWarehousingTime, string Note)
{ //实例化入库订单信息表
Models.PW_OrdersWarehousingInformationTable myOrdersWarehousingInformation = new Models.PW_OrdersWarehousingInformationTable();
myOrdersWarehousingInformation.OrdersInformationID = Convert.ToInt32(OrdersInformationID);
myOrdersWarehousingInformation.StoreroomID = Convert.ToInt32(StoreroomID);
myOrdersWarehousingInformation.WarehousingTypeID = Convert.ToInt32(WarehousingTypeID);
myOrdersWarehousingInformation.WarehousingWayID = Convert.ToInt32(WarehousingWayID);
myOrdersWarehousingInformation.PredictWarehousingTime = Convert.ToDateTime(PredictWarehousingTime);
myOrdersWarehousingInformation.Note = Note;
myDDGL.PW_OrdersWarehousingInformationTable.AddObject(myOrdersWarehousingInformation);//将以上参数保存到数据库表
int i = myDDGL.SaveChanges();
if (i > 0)
{
int OrdersWarehousingInformationID = (from tbOrdersInformation in myDDGL.PW_OrdersWarehousingInformationTable select tbOrdersInformation.OrdersWarehousingInformationID).Max();
return OrdersWarehousingInformationID;//返回新增该数据的主键ID值
}
else
{
return 0;
}
}
#endregion
#region 选择仓提,仓运时,新增运输信息
/// <summary>
/// 界面层,选择仓提时,会录入运输信息,接收界面层传来的参数,新增运输信息
/// </summary>
/// <param name="OrdersWarehousingInformationID">订单入库信息ID</param>
/// <param name="OrdersOutboundInformationID">订单出库信息ID</param>
/// <param name="RiseCarryLandID">起运地ID</param>
/// <param name="ArriveLandID">到达地ID</param>
/// <param name="RiseCarryAddress">起运地址</param>
/// <param name="LinkmanName">联系人姓名</param>
/// <param name="LinkmanPhone">联系人电话</param>
/// <param name="GoodsUnitID">收货单位ID</param>
/// <param name="LinkmanAddress">联系人地址</param>
/// <param name="StoreroomID">库房ID</param>
/// <param name="TransportationWayID">运输方式ID</param>
/// <param name="ShipmentTime">起运时间</param>
/// <param name="EstimatedArriveTime">预计到达时间</param>
/// <param name="Note">备注</param>
/// <param name="Freight">运费</param>
/// <param name="InsureFee">保险费</param>
/// <param name="OtherCost">其它费用</param>
/// <param name="InsureMoney">投保金额</param>
/// <param name="Fax">传真</param>
/// <returns>Json</returns>
public ActionResult IserctTransportationInformation(string OrdersWarehousingInformationID, string OrdersOutboundInformationID, string RiseCarryLandID, string ArriveLandID, string RiseCarryAddress,
string LinkmanName,string LinkmanPhone,string GoodsUnitID, string LinkmanAddress,string StoreroomID,string TransportationWayID, string ShipmentTime,
string EstimatedArriveTime,string Note,string Freight,string InsureFee,string OtherCost,string InsureMoney,string Fax)
{ //实例化运输信息表
Models.SYS_TransportationInformationTable myTransportationInformation = new Models.SYS_TransportationInformationTable();
myTransportationInformation.OrdersWarehousingInformationID = Convert.ToInt32(OrdersWarehousingInformationID);
myTransportationInformation.OrdersOutboundInformationID = Convert.ToInt32(OrdersOutboundInformationID);
myTransportationInformation.RiseCarryLandID = Convert.ToInt32(RiseCarryLandID);
myTransportationInformation.ArriveLandID = Convert.ToInt32(ArriveLandID);
myTransportationInformation.RiseCarryAddress = RiseCarryAddress.Trim();
myTransportationInformation.LinkmanName = LinkmanName;
myTransportationInformation.LinkmanPhone = LinkmanPhone;
myTransportationInformation.GoodsUnitID = Convert.ToInt32(GoodsUnitID);
myTransportationInformation.LinkmanAddress = LinkmanAddress.Trim();
myTransportationInformation.StoreroomID = Convert.ToInt32(StoreroomID);
myTransportationInformation.TransportationWayID = Convert.ToInt32(TransportationWayID);
myTransportationInformation.ShipmentTime = Convert.ToDateTime(ShipmentTime);
myTransportationInformation.EstimatedArriveTime = Convert.ToDateTime(EstimatedArriveTime);
myTransportationInformation.Note = Note;
myTransportationInformation.Freight = Convert.ToDecimal(Freight);
myTransportationInformation.InsureFee = Convert.ToDecimal(InsureFee);
myTransportationInformation.OtherCost = Convert.ToDecimal(OtherCost);
myTransportationInformation.InsureMoney = Convert.ToDecimal(InsureMoney);
myTransportationInformation.Fax = Fax;
myDDGL.SYS_TransportationInformationTable.AddObject(myTransportationInformation);//将以上参数保存到数据库表
int i = myDDGL.SaveChanges();
if (i > 0)
{
return Json("true", JsonRequestBehavior.AllowGet);
}
else
{
return Json("false", JsonRequestBehavior.AllowGet);
}
}
#endregion
#region 查询库房
/// <summary>
/// 遍历循环查询库房信息,界面层会用到库房信息
/// </summary>
/// <returns>Json</returns>
public ActionResult SelectStoreroomTable()
{
var dtStoreroom = from tbStoreroom in myDDGL.SYS_StoreroomTable
select new
{
StoreroomID = tbStoreroom.StoreroomID,
StoreroomCoding = tbStoreroom.StoreroomCoding,
StoreroomName = tbStoreroom.StoreroomName,
SpellCode = tbStoreroom.SpellCode
};
List<Dictionary<string, object>> ListReturn = new List<Dictionary<string, object>>();
foreach (var item in dtStoreroom)
{
Dictionary<string, object> itemStoreroom = new Dictionary<string, object>();
foreach (System.Reflection.PropertyInfo p in item.GetType().GetProperties())
{
itemStoreroom.Add(p.Name, p.GetValue(item, null));
}
ListReturn.Add(itemStoreroom);
}
return Json(ListReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 新增入库明细
/// <summary>
/// 接收界面层传过来的货品信息,新增入库货品信息
/// </summary>
/// <param name="OrdersWarehousingInformationID">订单入库信息ID</param>
/// <param name="GoodsID">货品ID</param>
/// <param name="Batch">批次</param>
/// <param name="Quantity">数量</param>
/// <param name="Note">备注</param>
/// <returns>Json</returns>
public ActionResult InsertOrdersWarehousingDetailedTable(int OrdersWarehousingInformationID,int GoodsID, string Batch,decimal Quantity,string Note)
{
Models.PW_OrdersWarehousingDetailedTable myOrdersWarehousingDetailed = new Models.PW_OrdersWarehousingDetailedTable();
myOrdersWarehousingDetailed.OrdersWarehousingInformationID = OrdersWarehousingInformationID;
myOrdersWarehousingDetailed.GoodsID = GoodsID;
myOrdersWarehousingDetailed.Batch = Batch;
myOrdersWarehousingDetailed.Quantity = Quantity;
myOrdersWarehousingDetailed.Note = Note;
myDDGL.PW_OrdersWarehousingDetailedTable.AddObject(myOrdersWarehousingDetailed);//将以上参数保存到数据库表
int i = myDDGL.SaveChanges();
if (i > 0)
{
return Json("true", JsonRequestBehavior.AllowGet);
}
else
{
return Json("false", JsonRequestBehavior.AllowGet);
}
}
#endregion
#region 查询货品
/// <summary>
/// 将待用的货品全部遍历查询出来
/// </summary>
/// <returns>Json</returns>
public ActionResult SelectGoodsTable()
{
var dtGoods = from tbGoods in myDDGL.SYS_GoodsTable
join tbUnit in myDDGL.SYS_AttributeDetailedTable on tbGoods.UnitID equals tbUnit.AttributeDetailedID
join tbQuality in myDDGL.SYS_AttributeDetailedTable on tbGoods.QualityID equals tbQuality.AttributeDetailedID
select new
{
GoodsID = tbGoods.GoodsID,
GoodsCoding = tbGoods.GoodsCoding,
GoodsName = tbGoods.GoodsName,
Standard = tbGoods.Standard,
Weight = tbGoods.Weight,
UnitID = tbGoods.UnitID,
Unit = tbUnit.AttributeDetailedName,
BarCode = tbGoods.BarCode,
SpellCode = tbGoods.SpellCode,
QualityID = tbGoods.QualityID,
Quality = tbQuality.AttributeDetailedName
};
List<Dictionary<string, object>> ListReturn = new List<Dictionary<string, object>>();
foreach (var item in dtGoods)
{
Dictionary<string, object> itemGoods = new Dictionary<string, object>();
foreach (System.Reflection.PropertyInfo p in item.GetType().GetProperties())
{
itemGoods.Add(p.Name, p.GetValue(item, null));
}
ListReturn.Add(itemGoods);
}
return Json(ListReturn, JsonRequestBehavior.AllowGet);
}
#endregion
第三步:视图层(Views)
入库订单界面效果截图:
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="txtDingDanHao" 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="txtKeHuMa" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>
<td><input type="button" οnclick="OpenKeHu()" value="••" style="font-size: 13px;width:30px;height:30px; font-family: 楷体; color: #000000; font-weight: bold;" /></td>
</tr> //onclick是单击事件,单击时执行一个方法,方法代码在jQuery代码里
<tr>
<td align="right"><strong style="font-size: medium">客户指令号:</strong></td><td>
<input type="text" id="txtKeHuZhiLingHao" 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="txtCaiGouDanHao" 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-combobox" id="cboDingDanLeiXing" 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 class="easyui-combobox" id="cboJinJiChengDu" 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 class="easyui-combobox" id="cboDingDanLaiYuan" 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 class="easyui-datebox" id="datXiaDaShiJian" data-options="formatter:myformatter" style="border-style: hidden hidden outset hidden; border-width: thin; width:150px; height:30px; " /></td>
</tr> /data-options里myformatter如果在jQuery代码里没写方法会界面报错
<tr>
<td align="right"><strong style="font-size: medium">状态:</strong></td><td>
<input class="easyui-combobox" id="cboZhuangTai" 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 class="easyui-combobox" id="cboZhiXingZhuangTai" 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="txtDingDanYouXianJi" 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="txtZhiYaYinHang" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>
<td><input type="button" οnclick="OpenZhiYaYinHang()" value="••" style="font-size: 13px;width:30px;height:30px; font-family: 楷体; color: #000000; font-weight: bold;" /></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="txtBeiZhu" style="border-style: hidden hidden outset hidden; border-width: thin; width:500px; 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 style="margin-left: 50px; margin-top: 10px;">
<tr>
<td align="right"><strong style="font-size: medium">库房:</strong></td><td>
<input type="text" id="txtKuFang" style="border-style: hidden hidden outset hidden; border-width: thin; width:300px; height:30px; " /></td>
<td><input type="button" οnclick="OpenKuFang()" 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 class="easyui-combobox" id="cboRuKuLeiXing" 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 class="easyui-combobox" data-options="onSelect:OpenTransportInformation" id="cboRuKuFangShi" 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 class="easyui-datebox" id="datYuJiRuKuShiJian" data-options="formatter:myformatter" 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="txtRuKuBeiZhu" style="border-style: hidden hidden outset hidden; border-width: thin; width:500px; height:30px; " /></td>
</tr>
</table>
<div class="easyui-panel" id="yunshuxinxi" title="运输信息" style="border-style: none; width:auto; height:auto;"data-options="closed:true">
<table style="margin-left: 50px; margin-top: 10px;">
<tr>
<td align="right"><strong style="font-size: medium">起始地:</strong></td><td>
<input type="text" id="txtQiShiDi" style="border-style: hidden hidden outset hidden; border-width: thin; width:200px; height:30px; " /></td>
<td><input type="button" οnclick="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="txtDaoDaDi" style="border-style: hidden hidden outset hidden; border-width: thin; width:200px; height:30px; " /></td>
<td><input type="button" οnclick="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 type="text" id="txtQiYunDiZhi" style="border-style: hidden hidden outset hidden; border-width: thin; width:200px; height:30px; " /></td>
<td> </td>
<td align="right"><strong style="font-size: medium">传真:</strong></td><td>
<input type="text" id="txtChuangZhen" style="border-style: hidden hidden outset hidden; border-width: thin; width:200px; height:30px; " /></td>
</tr>
<tr>
<td align="right"><strong style="font-size: medium">联系人姓名:</strong></td><td>
<input type="text" id="txtXingMing" style="border-style: hidden hidden outset hidden; border-width: thin; width:200px; height:30px; " /></td>
<td> </td>
<td align="right"><strong style="font-size: medium">联系人电话:</strong></td><td>
<input type="text" id="txtDianHua" style="border-style: hidden hidden outset hidden; border-width: thin; width:200px; 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="txtDanWei" style="border-style: hidden hidden outset hidden; border-width: thin; width:550px; height:30px; " /></td>
<td><input type="button" οnclick="OpenShouHuoDanWei()" value="••" style="font-size: 13px;width:30px;height:30px; font-family: 楷体; color: #000000; font-weight: bold;" /></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="txtDiZhi" style="border-style: hidden hidden outset hidden; border-width: thin; width:200px; height:30px; " /></td>
<td> </td>
<td align="right"><strong style="font-size: medium">到达库房:</strong></td><td>
<input type="text" id="txtDaoDaKuFang" style="border-style: hidden hidden outset hidden; border-width: thin; width:200px; height:30px; " /></td>
<td><input type="button" οnclick="OpenDaoDaKuFang()" value="••" style="font-size: 13px;width:30px;height:30px; font-family: 楷体; color: #000000; font-weight: bold;" /></td>
</tr>
</table>
<form style="margin-left: 50px; margin-top: 10px;">
<strong style="font-size: medium">运输方式:</strong>
<input type="radio" name="FS" id="ZhengChe" value="ZhengChe" /><strong style="font-size: medium">公路整车</strong>
<input type="radio" name="FS" id="LingDan" value="LingDan" /><strong style="font-size: medium">公路零担</strong>
<input type="radio" name="FS" id="PeiSong" value="PeiSong" /><strong style="font-size: medium">货物配送</strong>
<input type="radio" name="FS" id="TieLu" value="TieLu" /><strong style="font-size: medium">铁路</strong>
<input type="radio" name="FS" id="KongYun" value="KongYun" /><strong style="font-size: medium">空运</strong>
</form>
<table style="margin-left: 50px; margin-top: 10px;">
<tr>
<td align="right"><strong style="font-size: medium">起运时间:</strong></td><td>
<input class="easyui-datebox" id="datQiYunShiJian" data-options="formatter:myformatter" style="border-style: hidden hidden outset hidden; border-width: thin; width:200px; height:30px; " /></td>
<td> </td>
<td align="right"><strong style="font-size: medium">预计到达时间:</strong></td><td>
<input class="easyui-datebox" id="datYuJIShiJian" data-options="formatter:myformatter" style="border-style: hidden hidden outset hidden; border-width: thin; width:200px; 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="Beizhu" 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="YunFei" style="border-style: hidden hidden outset hidden; border-width: thin; width:200px; height:30px; " /></td>
<td> </td>
<td align="right"><strong style="font-size: medium">保险费:</strong></td><td>
<input type="text" id="BaoXianFei" style="border-style: hidden hidden outset hidden; border-width: thin; width:200px; height:30px; " /></td>
</tr>
<tr>
<td align="right"><strong style="font-size: medium">其他费用:</strong></td><td>
<input type="text" id="QiTaFei" style="border-style: hidden hidden outset hidden; border-width: thin; width:200px; height:30px; " /></td>
<td> </td>
<td align="right"><strong style="font-size: medium">投保金额:</strong></td><td>
<input type="text" id="TouBao" style="border-style: hidden hidden outset hidden; border-width: thin; width:200px; height:30px; " /></td>
</tr>
<tr>
<td align="right"><strong style="font-size: medium">总金额:</strong></td><td>
<input type="text" id="ZongJinE" οnclick="YunShuZongJinE()" style="border-style: hidden hidden outset hidden; border-width: thin; width:200px; height:30px; " /></td>
</tr>
</table>
</div>
</div>
</div>
<div title="订单货品">
<div class="easyui-panel" style="border-style: none; width:auto; height:450px; border-radius:15px 15px 0px 0px;">
<table>
<tr>
<td><input type="button" οnclick="SelectGoodsTable()" value="添加货品" style="font-size: 18px;width:100px; font-family: 楷体; color: #CC33FF" /></td>
<td><input type="checkbox" id="PiLiang" /></td><td><strong style="font-size: medium">批量</strong></td>
</tr>
</table>
<table id="tb入库订单货品" class="easyui-datagrid" style="width:auto; height:200px;" data-options="singleSelect:true,scrolling:true,
onClickRow:onClickRowQiYongEdit,onAfterEdit:onAfterEdit">//数据表格datagrid的单击事件、结束编辑事件等在jQuery里没写代码界面会报错
<thead>
<tr>
<th data-options="field:'GoodsID',width:50,align:'center',formatter:returnBtnShanChu"><img src="../../Content/图片/删除.jpg" /></th> //formatter事件、注意
<th data-options="field:'GoodsCoding',width:100,align:'center'">货品编码</th>
<th data-options="field:'GoodsName',width:100,editor:'true',align:'center'">货品名称</th>
<th data-options="field:'Standard',width:100,editor:'true',align:'center'">规格</th>
<th data-options="field:'Batch',width:100,editor:'numberbox',align:'center'">批次</th>
<th data-options="field:'Unit',width:100,align:'center',editor:{type:'combobox',
options:{
valueField:'AttributeDetailedID',
textField:'AttributeDetailedName',
url:'/DingDanLuRu/cboBinDing?AttributeAssembleID=37'}}">单位</th>
<th data-options="field:'Quality',width:100,align:'center',editor:{type:'combobox',
options:{
valueField:'AttributeDetailedID',
textField:'AttributeDetailedName',
url:'/DingDanLuRu/cboBinDing?AttributeAssembleID=47'}}">质量</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:DblHuoPinDatagrid">
<thead> //数据表格datagrid双击事件、注意!
<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: 450px;">
<tr>
<td><input type="button" οnclick="InsertOrdersInformationTable()" value="保存订单" style="font-size: 18px;width:100px; font-family: 楷体; color: #CC33FF" /></td>
</tr>
</table>
</div>
</div>
<div class="easyui-window" id="KeHuXinXi" 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:DblKeHu">
<thead>
<tr>
<th data-options="field:'ClientID',width:80,hidden:true,align:'center'">客户ID</th>
<th data-options="field:'ClientAccounts',width:100,align:'center'">客户账号</th>
<th data-options="field:'ClientCode',width:100,align:'center'">客户码</th>
<th data-options="field:'ClientUnitName',width:150,align:'center'">客户单位名称</th>
</tr>
</thead>
</table>
</div>
<div class="easyui-window" id="JZhiYaYinHangXinXi" 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:DblZhiYaYinHang">
<thead>
<tr>
<th data-options="field:'BankID',width:80,hidden:true,align:'center'">银行ID</th>
<th data-options="field:'BankName',width:100,align:'center'">银行名称</th>
<th data-options="field:'Phone',width:100,align:'center'">电话</th>
<th data-options="field:'Address',width:150,align:'center'">地址</th>
</tr>
</thead>
</table>
</div>
<div class="easyui-window" id="KuFangXinXi" 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:DblKuFang">
<thead>
<tr>
<th data-options="field:'StoreroomID',width:80,hidden:true,align:'center'">库房ID</th>
<th data-options="field:'StoreroomCoding',width:100,align:'center'">库房编码</th>
<th data-options="field:'StoreroomName',width:100,align:'center'">库房名称</th>
<th data-options="field:'SpellCode',width:150,align:'center'">拼音码</th>
</tr>
</thead>
</table>
</div>
</body>
</html>
jQuery代码:
<script type="text/javascript">
$(document).ready(function () {
cboBinDing();//HTML加载时,预先执行下拉框绑定方法
});
function myformatter(date) { //日期控件转换日期样式y-m-d
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 returnBtnShanChu(GoodsID, row, rowIndex) {
return "<a href='javascript:ShanChu(" + GoodsID + "," + rowIndex + ")'>" + '<img src="../../Content/图片/删除.jpg" />' + "</a>";
}//订单货品数据表格datagrid里添加删除按钮,点击删除图标执行下面删除方法
function ShanChu(GoodsID, rowIndex) { //删除入库明细
$('#tb入库订单货品').datagrid('cancelEdit', editIndex)
.datagrid('deleteRow', editIndex);
}
function cboBinDing() { //入库订单各种下拉框的绑定
$.getJSON("/DingDanLuRu/cboBinDing?AttributeAssembleID=22",
function (data) {
$("#cboDingDanLeiXing").combobox({ data: data, valueField: 'AttributeDetailedID',
textField: 'AttributeDetailedName'
});
$("#cboDingDanLeiXing").combobox('select', 82);
});
$.getJSON("/DingDanLuRu/cboBinDing?AttributeAssembleID=23",
function (data) {
$("#cboJinJiChengDu").combobox({ data: data, valueField: 'AttributeDetailedID',
textField: 'AttributeDetailedName'
});
});
$.getJSON("/DingDanLuRu/cboBinDing?AttributeAssembleID=24",
function (data) {
$("#cboDingDanLaiYuan").combobox({ data: data, valueField: 'AttributeDetailedID',
textField: 'AttributeDetailedName'
});
});
$.getJSON("/DingDanLuRu/cboBinDing?AttributeAssembleID=4",
function (data) {
$("#cboZhuangTai").combobox({ data: data, valueField: 'AttributeDetailedID',
textField: 'AttributeDetailedName'
});
});
$.getJSON("/DingDanLuRu/cboBinDing?AttributeAssembleID=25",
function (data) {
$("#cboZhiXingZhuangTai").combobox({ data: data, valueField: 'AttributeDetailedID',
textField: 'AttributeDetailedName'
});
});
$.getJSON("/DingDanLuRu/cboBinDing?AttributeAssembleID=26",
function (data) {
$("#cboRuKuLeiXing").combobox({ data: data, valueField: 'AttributeDetailedID',
textField: 'AttributeDetailedName'
});
});
$.getJSON("/DingDanLuRu/cboBinDing?AttributeAssembleID=27",
function (data) {
$("#cboRuKuFangShi").combobox({ data: data, valueField: 'AttributeDetailedID',
textField: 'AttributeDetailedName'
});
});
}
function OpenKeHu() { //点击客户码,查询客户信息
$.getJSON("/DingDanLuRu/SelectClientTable",
function (data) {
$('#tb客户信息').datagrid('loadData', data);
});
$("#KeHuXinXi").window('open'); //打开客户信息界面
}
var ClientID = 0; //声明一个全局变量ID
function DblKeHu() { //双击获取客户信息
var row = $("#tb客户信息").datagrid('getSelected');
if (row) {
ClientID = row.ClientID;
$('#txtKeHuMa').val(row.ClientCode);
$("#KeHuXinXi").window('close');
}
}
function OpenZhiYaYinHang() { //点击质押银行,查询质押银行信息
$.getJSON("/DingDanLuRu/SelectBankTable",
function (data) {
$('#tb质押银行信息').datagrid('loadData', data);
});
$("#JZhiYaYinHangXinXi").window('open'); //打开质押银行信息界面
}
var BankID = 0;
function DblZhiYaYinHang() { //双击获取质押银行信息
var row = $("#tb质押银行信息").datagrid('getSelected');
if (row) {
BankID = row.BankID;
$('#txtZhiYaYinHang').val(row.BankName);
$("#JZhiYaYinHangXinXi").window('close');
}
}
function OpenKuFang() { //点击库房,查询库房信息
$.getJSON("/DingDanLuRu/SelectStoreroomTable",
function (data) {
$('#tb库房信息').datagrid('loadData', data);
});
$("#KuFangXinXi").window('open');
}
var StoreroomID = 0;
function DblKuFang() { //双击获取库房信息
var row = $("#tb库房信息").datagrid('getSelected');
if (row) {
StoreroomID = row.StoreroomID;
$('#txtKuFang').val(row.StoreroomName);
$("#KuFangXinXi").window('close');
}
}
function SelectGoodsTable() { //入库时单击添加,查询货品
$("#tb货品信息").datagrid({ url: "/DingDanLuRu/SelectGoodsTable" });
}
function DblHuoPinDatagrid() { //daagrid的双击事件,将待货品信息更新到入库订单货品
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",
UnitID: rowHuoPinDatagrid.UnitID,
Unit: rowHuoPinDatagrid.Unit,
QualityID: rowHuoPinDatagrid.QualityID,
Quality: rowHuoPinDatagrid.Quality,
Quantity:"0.00"
});
editIndex = $('#tb入库订单货品').datagrid('getRows').length - 1;
$('#tb入库订单货品').datagrid('selectRow', editIndex);
$('#tb入库订单货品').datagrid('beginEdit', editIndex).datagrid('endEdit', editIndex - 1);
}
function onAfterEdit(rowIndex, rowData, changes) { //当用户编辑完成时触发事件,获取编辑行的数据,并进行运算,在返回改变显示值
var dataMingXi = $('#tb入库订单货品').datagrid('getData');
var Batch = dataMingXi.rows[rowIndex].Batch;
var Quantity = dataMingXi.rows[rowIndex].Quantity;
var Note = dataMingXi.rows[rowIndex].Note;
$('#tb入库订单货品').datagrid('refreshRow', rowIndex); //refreshRow:刷新一行
}
//定义一个全局变量,并把它赋值为未定义
var editIndex = undefined;
//点击订单货品的datagrid表格,启用单元格编辑状态
function onClickRowQiYongEdit(index) {
if (editIndex != index) {
$('#tb入库订单货品').datagrid('beginEdit', index);
$('#tb入库订单货品').datagrid('endEdit', editIndex);
editIndex = index;
}
}
var OrdersInformationID = 0;
function InsertOrdersInformationTable() { //新增入库订单信息
if (confirm("是否添加?")) {
$.getJSON("/DingDanLuRu/InsertOrdersInformationTable?OrdersMark=" + $('#txtDingDanHao').val() +
"&ClientID=" + ClientID +
"&ClientInstructMark=" + $('#txtKeHuZhiLingHao').val() +
"&PurchaseOrdersNumber=" + $('#txtCaiGouDanHao').val() +
"&OrdersTypeID=" + $('#cboDingDanLeiXing').combobox('getValue') +
"&UrgencyDegreeID=" + $('#cboJinJiChengDu').combobox('getValue') +
"&OrdersSourceID=" + $('#cboDingDanLaiYuan').combobox('getValue') +
"&OrderTime=" + $('#datXiaDaShiJian').datebox('getValue') +
"&StateID=" + $('#cboZhuangTai').combobox('getValue') +
"&ExecuteStateID=" + $('#cboZhiXingZhuangTai').combobox('getValue') +
"&OrdersPriorLevel=" + $('#txtDingDanYouXianJi').val() +
"&PledgeBankID=" + BankID +
"&Note=" + $('#txtBeiZhu').val() +
"&EntryTime=" + EntryTime,
function (data) {
OrdersInformationID = data; //返回新增的最新数据的ID值
if (data != null) {
InsertOrdersWarehousingInformationTable(); //执行新增入库订单信息方法
} else {
alert("添加失败!");
}
});
} else {
return null;
}
}
var OrdersWarehousingInformationID = 0;
function InsertOrdersWarehousingInformationTable() { //新增入库订单信息
$.getJSON("/DingDanLuRu/InsertOrdersWarehousingInformationTable?OrdersInformationID=" + OrdersInformationID +
"&StoreroomID=" + StoreroomID +
"&WarehousingTypeID=" + $('#cboRuKuLeiXing').combobox('getValue') +
"&WarehousingWayID=" + $('#cboRuKuFangShi').combobox('getValue') +
"&PredictWarehousingTime=" + $('#datYuJiRuKuShiJian').datebox('getValue') +
"&Note=" + $('#txtRuKuBeiZhu').val(),
function (data) {
OrdersWarehousingInformationID = data; //返回新增的最新数据的ID值
if (data != null) {
if ($('#cboRuKuFangShi').combobox('getValue') == 98) { //判断入库方式是否适合条件,当等于98(代表下拉框仓提的值)时,执行里面的方法
IserctTransportationInformation(); //下拉框选择“仓提”时,执行该方法
InsertOrdersWarehousingDetailedTable(); //执行新增货品信息方法
alert("添加成功!");
$('#yunshuxinxi').panel('close');
} else { //不等于98时,直接执行新增货品信息方法
InsertOrdersWarehousingDetailedTable();
alert("添加成功!");
}
} else {
alert("添加失败!");
}
});
}
function InsertOrdersWarehousingDetailedTable() { //新增入库订单货品明细
var dataMingXi = $('#tb入库订单货品').datagrid('getData');
for (var i = 0; i < dataMingXi.rows.length; i++) {
$.getJSON("/DingDanLuRu/InsertOrdersWarehousingDetailedTable?OrdersWarehousingInformationID=" + OrdersWarehousingInformationID +
"&GoodsID=" + dataMingXi.rows[i].GoodsID +
"&Batch=" + dataMingXi.rows[i].Batch +
"&Quantity=" + dataMingXi.rows[i].Quantity +
&Note=" + dataMingXi.rows[i].Note,
function (data) {
if (data == "false") {
alert("新增失败!");
}
});
}
}
function OpenTransportInformation() { //入库方式下拉框选择为“仓提”时,执行onSelect事件打开运输信息填写框
if ($('#cboRuKuFangShi').combobox('getValue') == 98) {
$('#yunshuxinxi').panel('open'); //打开运输信息界面
} else {
$('#yunshuxinxi').panel('close');
}
}
function YunShuZongJinE() { //运输总金额合计
var Freight = parseInt($('#YunFei').val());
var InsureFee = parseInt($('#BaoXianFei').val());
var OtherCost = parseInt($('#QiTaFei').val());
var InsureMoney = parseInt($('#TouBao').val());
var ZongJinE = Freight + InsureFee + OtherCost + InsureMoney;
$('#ZongJinE').val(ZongJinE);
}
function IserctTransportationInformation() { //新增仓提运输信息
if (document.getElementById("ZhengChe").checked) { //单选框的判断
TransportationWayID = 62;
} else if (document.getElementById("LingDan").checked) {
TransportationWayID = 63;
} else if (document.getElementById("PeiSong").checked) {
TransportationWayID = 64;
} else if (document.getElementById("TieLu").checked) {
TransportationWayID = 65;
} else if (document.getElementById("KongYun").checked) {
TransportationWayID = 66;
}
$.getJSON("/DingDanLuRu/IserctTransportationInformation?OrdersWarehousingInformationID=" + OrdersWarehousingInformationID +
"&RiseCarryLandID=" + QiShiDiID +
"&ArriveLandID=" + MuDiDiID +
"&RiseCarryAddress=" + $('#txtQiYunDiZhi').val() +
"&LinkmanName=" + $('#txtXingMing').val() +
"&LinkmanPhone=" + $('#txtDianHua').val() +
"&GoodsUnitID=" + Clientid +
"&LinkmanAddress=" + $('#txtDiZhi').val() +
"&StoreroomID=" + DaoDaStoreroomID +
"&TransportationWayID=" + TransportationWayID +
"&ShipmentTime=" + $('#datQiYunShiJian').datebox('getValue') +
"&EstimatedArriveTime=" + $('#datYuJIShiJian').datebox('getValue') +
"&Note=" + $('#Beizhu').val() +
"&Freight=" + $('#YunFei').val() +
"&InsureFee=" + $('#BaoXianFei').val() +
"&OtherCost=" + $('#QiTaFei').val() +
"&InsureMoney=" + $('#TouBao').val() +
"&Fax=" + $('#txtChuangZhen').val(),
function (data) {
if (data == "true") {
} else {
alert("添加失败!");
}
});
}
</script>
仅供学习,禁止用于商业用途