MVC北京络捷斯特第三方物流系统技术解析(九)到货通知
对于客户要求自提的货物(在订单录入中钩选“是否取送”中的“送货”),当货物到达目的站后,客服通知客户来场站提货。客服使用此模块查看需客服客户自提货物的运单。点击到货通知,此时需客户自提货物的运单显示在列表中。
界面效果图:
2.7.1.4(图1)
第一步:数据库
表和表的关系
2.7.1.4(图2)
表1:运输订单表(PWOrderForTransportationList)
用于存放运输订单的信息
PrimaryKey(s): OrderForTransportationID
列名 |
数据类型 |
主键/外键 |
说明 |
OrderForTransportationID |
int |
主键 |
订单运输信息ID |
OrderForGoodsNumber |
nchar (50) |
|
订单号 |
VocationalTypeID |
int |
外键 |
业务类型ID |
HeadstreamID |
int |
外键 |
始发地ID |
DestinationID |
int |
外键 |
目的地ID |
TakeDeliveryTime |
datetime |
|
取货时间 |
ArriveTime |
datetime |
|
到货时间 |
TakeDeliveryID |
int |
外键 |
取货ID |
DeliverGoodsID |
int |
外键 |
签单ID |
WrittenPermissionID |
int |
外键 |
返回ID |
ClientContractsConsignID |
int |
外键 |
合同托运客户ID |
ShipperName |
nchar (50) |
|
托运人姓名 |
ShipperPhoneNumber |
nchar (50) |
|
托运人电话 |
ShipperUnitsID |
int |
外键 |
托运人单位ID |
ShipperLocation |
nchar (50) |
|
托运人地址 |
ShipperAccount |
nchar (50) |
|
托运帐号 |
ShipperPostcode |
nchar (50) |
|
托运人邮编 |
ClientManager |
nchar (50) |
|
客户经理 |
StorePickupPersonID |
int |
外键 |
取货人ID |
StorePickupPersonName |
nchar (50) |
|
取货联系人 |
StorePickupPersonPhoneNumber |
nchar (50) |
|
取货联系人电话 |
StorePickupPersonAddress |
nchar (50) |
|
取货地址 |
ProjectID |
int |
外键 |
项目ID |
ConsigneeName |
nchar (10) |
|
收货人姓名 |
ConsigneePhoneNumber |
nchar (50) |
|
收货人电话 |
ConsigneeUnit |
nchar (50) |
|
收货人单位 |
ConsigneeAddress |
nchar (50) |
|
收货人地址 |
ConsigneeAccount |
nchar (50) |
|
收货人帐号 |
ConsigneePostcode |
nchar (50) |
|
收货人邮编 |
ConsigneeID |
int |
外键 |
收货人ID |
CarriageFare |
decimal (18, 2) |
|
运费 |
IncidentalExpenses |
decimal (18, 2) |
|
杂费 |
CostSumUp |
decimal (18, 2) |
|
费用小计 |
WhetherOrNotInsureDeclare |
bit |
|
保声明否 |
SettleAccountsWayID |
int |
外键 |
保险费 |
AdvanceReceipts |
decimal (18, 2) |
|
结算方式ID |
InsureExpenses |
decimal (18, 2) |
|
预收款 |
PayNumber |
nchar (50) |
|
付费帐号 |
Remarks |
nchar (100) |
|
备注 |
FabricationOrderFormID |
int |
外键 |
制单人ID |
AcceptanceTime |
datetime |
|
受理时间 |
AcceptanceUnitID |
int |
外键 |
受理单位ID |
Receiver |
nchar (10) |
|
签收人 |
SignForTime |
datetime |
|
签收时间 |
WhetherOrNotSignFor |
bit |
|
签收否 |
RepeatOrderStateID |
int |
外键 |
返单状态ID |
RepeatOrderPeopleID |
int |
外键 |
返单人ID |
RepeatOrderTime |
datetime |
|
返单时间 |
RepeatOrderReceive |
bit |
|
返单时间 |
BeforeOneTime |
nchar (100) |
|
当前地点 |
CheckEmploy |
bit |
|
复核否 |
ClientID |
int |
外键 |
客户ID |
ClientAgreementInformationID |
int |
外键 |
客户合同ID |
TongZhiCiShu |
int |
外键 |
|
QuHuoFou |
bit |
|
|
ShengChenJiHuaDan |
nchar (30) |
|
生成计划单号 |
ShengChenFou |
bit |
|
生成否 |
DingDanZhuangTai |
bit |
|
订单状态 |
ZongTiJi |
decimal (18, 3) |
|
总体积 |
ZongShuLiang |
decimal (18, 3) |
|
总数量 |
ZongZhongLiang |
decimal (18, 3) |
|
总重量 |
RouteID |
int |
外键 |
路由ID |
ZhanCunFou |
bit |
|
暂存否 |
HuoWeiID |
int |
外键 |
货位ID |
HuoWeiHao |
nchar (50) |
|
货位号 |
YiQuHuo |
bit |
|
已取否 |
YiPaiHuo |
bit |
|
已派否 |
QuPaiLeiXingFou |
bit |
|
取派类型否 |
LunLiID |
int |
外键 |
运力ID |
ShuaiHuoFou |
bit |
|
甩货否 |
YouYongFou |
bit |
|
有否否 |
ShengChengZhanDanFou |
bit |
|
生成账单否 |
第二步:控制器(controllers)
2.7.1.4(图3)
1.查询到货通知订单
#region 到货通知运输管理
public ActionResult DaoHuoTongZhiYunShuGuanLi()
{
//models实体类数据库的一个表(YS.PWOrderForTransportationList)
var OrderForGoodsTransportinformationList = from OrderForGoodsTransportinformation
in YS.PWOrderForTransportationList//订单运输信息表
orderby OrderForGoodsTransportinformation.OrderForTransportationID descending
//OrderForGoodsTransportinformation.TakeDeliveryID == 75(OrderForGoodsTransportinformation.DestinationID==0)
where OrderForGoodsTransportinformation.TakeDeliveryID == 75 &&
(OrderForGoodsTransportinformation.DestinationID==0)&&
(OrderForGoodsTransportinformation.QuHuoFou != true || OrderForGoodsTransportinformation.QuHuoFou==null)
&& (OrderForGoodsTransportinformation.YiPaiHuo == true)
select new
{
//。。。。。。对应数据库的参数
OrderForTransportationID = OrderForGoodsTransportinformation.OrderForTransportationID,
OrderForGoodsNumber = OrderForGoodsTransportinformation.OrderForGoodsNumber,
ArriveTime = OrderForGoodsTransportinformation.ArriveTime,
ShipperName = OrderForGoodsTransportinformation.ShipperName,
ShipperPhoneNumber = OrderForGoodsTransportinformation.ShipperPhoneNumber,
StorePickupPersonName = OrderForGoodsTransportinformation.StorePickupPersonName,
StorePickupPersonPhoneNumber = OrderForGoodsTransportinformation.StorePickupPersonPhoneNumber,
StorePickupPersonAddress = OrderForGoodsTransportinformation.StorePickupPersonAddress,
ConsigneeName = OrderForGoodsTransportinformation.ConsigneeName,
ConsigneePhoneNumber = OrderForGoodsTransportinformation.ConsigneePhoneNumber,
TongZhiCiShu = OrderForGoodsTransportinformation.TongZhiCiShu,
};
List<Dictionary<string, object>> DDitem = new List<Dictionary<string, object>>();
foreach (var item in OrderForGoodsTransportinformationList)
{
Dictionary<string, object> DingDanItem = new Dictionary<string, object>();
//ArriveTime.ToString()将这些的时间转换成字符串
//ArriveTime就是将这些时间加入到数据字典中
string ArriveTime1 = item.ArriveTime.ToString();
DingDanItem.Add("ArriveTime2", ArriveTime1);
foreach (System.Reflection.PropertyInfo p in item.GetType().GetProperties())
{
DingDanItem.Add(p.Name, p.GetValue(item, null));
}
// DDitem.Add(DingDanItem);将这些数据装到数据字典中
DDitem.Add(DingDanItem);
}
return Json(DDitem, JsonRequestBehavior.AllowGet);
}
#endregion
2.提交通知次数
#region 通货通知
public int DaoHuoTongZhiCiShu(int OrderForTransportationID)
{
//models实体类数据库的一个表(YS.PWOrderForTransportationList)
Models.PWOrderForTransportationList Transportation = (from tb in YS.PWOrderForTransportationList
where tb.OrderForTransportationID == OrderForTransportationID//对你要进行通知的运单进行操作
select tb).Single<Models.PWOrderForTransportationList>();
//TongZhiCiShu(通知次数),在数据库中字符串开始的值是null(空)
//如果不把他赋值为零
if (Transportation.TongZhiCiShu == null)
{
Transportation.TongZhiCiShu = 0;
}
//就不能执行累加了
Transportation.TongZhiCiShu += 1;
int i = YS.SaveChanges();
if (i > 0)
{
return i;
}
else
{
return 0;
}
}
#endregion
3.确定取货
#region 确定取货
public int QueDingTongZhi(int OrderForTransportationID)
{
//models实体类数据库的一个表(YS.PWOrderForTransportationList)
Models.PWOrderForTransportationList Transportation = (from tb
in YS.PWOrderForTransportationList where
//对你要进行通知的运单进行操作
tb.OrderForTransportationID == OrderForTransportationID
select tb).Single<Models.PWOrderForTransportationList>();
Transportation.QuHuoFou = true;//取货否
int i = YS.SaveChanges();
if (i > 0)
{
return i;
}
else
{
return 0;
}
}
#endregion
第三步:视图
2.7.1.4(图4)
Html代码:
<table id="tbDaoHuoTongZhi" class="easyui-datagrid" style=" width:auto; height:500px;"
data-options="url:'/YunShuGuanLi/DaoHuoTongZhiYunShuGuanLi',
rownumbers:true,singleSelect:true,rowStyler:function(index,row){
if (index%2==0){
}
}">
<thead>
<tr>
<th data-options="field:'ok',align:'center',checkbox:true"></th>
<th data-options="field:'OrderForTransportationID',width:118,align:'center',hidden:true">订单号ID</th>
<th data-options="field:'OrderForGoodsNumber',width:118,align:'center'">订单号</th>
<th data-options="field:'ArriveTime2',width:118,align:'center'">要求到货时间</th>
<th data-options="field:'ShipperName',width:118,align:'center'">托运人姓名</th>
<th data-options="field:'ShipperPhoneNumber',width:118,align:'center',hidden:true"> 托运人电话</th>
<th data-options="field:'StorePickupPersonName',width:118,align:'center'">取货联系人</th>
<th data-options="field:'StorePickupPersonPhoneNumber',width:118,align:'center',hidden:true">取货联系人电话</th>
<th data-options="field:'StorePickupPersonAddress',width:118,align:'center'">取货地址</th>
<th data-options="field:'ConsigneeName',width:118,align:'center'"> 收货人姓名</th>
<th data-options="field:'ConsigneePhoneNumber',width:118,align:'center',hidden:true"> 收货人电话</th>
<th data-options="field:'TongZhiCiShu',width:88,align:'center'">通知次数</th>
<th data-options="field:'TongZhis',width:80,align:'center',formatter:myformatter1">通知</th>
<th data-options="field:'QueDingQuHuo',width:80,align:'center',formatter:myformatter2">确定取货</th>
</tr>
</thead>
</table>
JavaScript代码:
1.查询到货通知信息
//查询到货通知
function CaiGouDingDan() {
//执行控制器的方法(/YunShuGuanLi/DaoHuoTongZhiYunShuGuanLi)
$.getJSON("/YunShuGuanLi/DaoHuoTongZhiYunShuGuanLi",
function (data) {
$("#tbDaoHuoTongZhi").datagrid('loadData', data);
});
}
2. 模糊查询到货通知信息
function ChaXunCaiGouDingDan() {
//DingDanGuanL/MoHuYunShuGuanLi(DingDanGuanL(控制器的名))MoHuYunShuGuanLi(方法名)
//OrderForGoodsNumber(参数)模糊等同于自己要输入的值
$.getJSON("/YunShuGuanLi/MoHuDaoHuoTongZhiYunShuGuanLi?OrderForGoodsNumber=" + $("#DingDanHaoChaXun").val(),
function (data) {
//datagrid加载这个方法的数据
$("#tbDaoHuoTongZhi").datagrid('loadData', data);
});
}
2.提交通知次数
function TongZhis() {
var ROW = $("#tbDaoHuoTongZhi").datagrid('getSelected');
var OrderForTransportationID = ROW.OrderForTransportationID;
//如果通知次数大于公司规定的最大值,就不再通知了,就退货给客户
if (ROW.TongZhiCiShu >= $("#SheZhiTongZhiCiShu").val()) {
alert("单号" +$.trim(ROW.OrderForGoodsNumber) + "已超过通知次数,不用再通知");
} else {
if (confirm("是否通知")) {
//执行控制器的方法(/YunShuGuanLi/DaoHuoTongZhiCiShu)
//OrderForTransportationID(对应主键的ID),对这行数据进行通知操作
$.getJSON("/YunShuGuanLi/DaoHuoTongZhiCiShu?OrderForTransportationID=" + OrderForTransportationID,
function (data) {
if (data > 0) {
alert("通知成功");
CaiGouDingDan();
} else {
alert("通知失败");
}
});
}
}
}
3. 确定取货
//客户确定取货
function QueDingQuHuo() {
var ROW = $("#tbDaoHuoTongZhi").datagrid('getSelected');
var OrderForTransportationID = ROW.OrderForTransportationID;
if (confirm("是否确定取货成功")) {
//执行控制器的方法(/YunShuGuanLi/QueDingTongZhi)
//OrderForTransportationID(对应主键的ID),对这行数据进行通知操作
$.getJSON("/YunShuGuanLi/QueDingTongZhi?OrderForTransportationID=" + OrderForTransportationID,
function (data) {
if (data > 0) {
alert("确定取货成功");
CaiGouDingDan();
} else {
alert("取货失败");
}
});
}
}