配载发车
配载发车是由出货分区的工作人员将货物装上派车后到达出货分区指定的台车号的车辆的过程。装车时工作人员要录入货运单信息
配载装车界面:
在datagrid中嵌套文本框:
效果图:
界面html代码:
<th data-options="field:'SendNumber',width:200,align:'center',formatter:myformatterSendNumber">取送单号</th>
脚本代码:
function myformatterSendNumber(data, row, Index) {//row为改变的那一行的行数据,Index为行索引
return '<input οnclick="ChaDanJu()" οnkeyup="onkeydown1()" style="width:190px;height:20px" id="' + Index + '"/>';
}
配载发车涉及到的表和表的关系
配载发车用到的表有:配送车次维护明细表、货运单表、配送领域维护表、属性明细表、公司表
配送车次维护明细表的字段有:配送车次维护明细ID、车次、运交车号、取/送件ID、预出车时间、单据截止时间、物流服务代表ID、随车人员1ID、随车人员2ID、运交领域、派车状态ID、实际出车时间、实际返车时间、配送车次维护ID、派车时间
列名 | 数据类型 | 主键/外键 | 说明 |
MX_DeliveryCarTimesServiceID | Int | 主键 | 配送车次维护明细ID |
CarTimes | Char |
| 车次 |
CarNumber | Char |
| 运交车号 |
MX_GetSendID | Int | 外键 | 取/送件ID |
PredictDrawOutTime | DateTime |
| 预出车时间 |
PredictDrawOutTime | DateTime |
| 单据截止时间 |
LogisticsServeDelegateID | Int | 外键 | 物流服务代表ID |
Personnel_OneID | Int | 外键 | 随车人员1ID |
Personnel_TwoID | Int | 外键 | 随车人员2ID |
ServiceFile | Char |
| 运交领域 |
SendCarStateID | Int | 外键 | 派车状态ID |
FactDrawOutTime | DateTime |
| 实际出车时间 |
FactReturnCarTime | DateTime |
| FactReturnCarTime |
DeliveryCarTimeServiceID | Int | 外键 | 配送车次维护ID |
SendCarTime | DateTime |
| 派车时间 |
货运单表的字段有:货运单ID、取送单号、公司ID、寄件客户ID 收件客户ID、接单时间、要求送达时间、寄件地址、审核否、收件地址、付款条件ID、货运单状态ID、签收确认ID、备注、开单人ID、寄件领域、领域属性维护ID、签收单状态 类别、配送方式、扣帐时间
表名 | 数据类型 | 主键/外键 | 说明 |
FreightReceiptsID | Int | 主键 | 货运单ID |
SendNumber | Char |
| 取送单号 |
CompanyID | Int | 外键 | 公司ID |
SendClientID | Int | 外键 | 寄件客户ID |
CollectClientID | Int | 外键 | 收件客户ID |
ConnectTime | datetime |
| 接单时间 |
RequireServiceTime | datetime |
| 要求送达时间 |
SendAddress | char |
| 寄件地址 |
CheckNo | bit |
| 审核否 |
DeliveryFieldServiceID | Int | 外键 | 领域属性维护ID |
PayCondition | Int | 外键 | 付款条件ID |
FreightReceiptsStateID | Int | 外键 | 货运单状态ID |
SignForStateID | Int | 外键 | 签收确认ID |
Remark | Char |
| 备注 |
StaffID | Int | 外键 | 开单人ID |
SendFieldWord | Char |
| 寄件领域 |
DeliveryFieldServiceID | Int | 外键 | 领域属性维护ID |
SignFor | Int | 外键 | 签收单状态ID |
ClassesID | Int | 外键 | 类别 |
DeliveryWayID | Int | 外键 | 配送方式 |
DductTime | datetime |
| 扣帐时间 |
配送领域维护表的字段:配送领域维护ID、物流地点ID、领域代码、配送属性ID、配送等级ID、配送方式ID、默认否、预计送达天数、删除否
列名 | 数据类型 | 主键/外键 | 说明 |
DeliveryFieldServiceID | Int | 主键 | 配送领域维护ID |
LogisticsPlaceID | Int | 外键 | 物流地点ID |
FieldWord | Char |
| 领域代码 |
SXMX_AttributeID | Int | 外键 | 配送属性ID |
DeliveryGradeID | Int | 外键 | 配送等级ID |
DeliveryWayID | Int | 外键 | 配送方式ID |
AdmitNO
| Bit | 外键 | 默认否 |
PredictServiceDay | Char |
| 预计送达天数 |
DeleteNo | Bit |
| 删除否 |
属性明细表的字段:属性明细ID、属性明细名称、属性集合ID
列名 | 数据类型 | 主键/外键 | 说明 |
MX_AttributeDetailedID | Int | 主键 | 属性明细ID |
AttributeDetailedName | Char |
| 属性明细名称 |
AttributeGatherID | Int | 外键 | 属性集合ID |
公司表的字段有:公司ID(CompanyID)、公司简称(CompanyAbbreviation)、公司名称(CompanyName)、地址(Address)、联系人(LinkMan)、联系电话(LinkPhone)
列名 | 数据类型 | 主键/外键 | 说明 |
CompanyID | Int | 主键 | 公司ID |
CompanyAbbreviation | Char |
| 公司简称 |
CompanyName | Char |
| 公司名称 |
Address | Char |
| 地址 |
LinkMan | Char |
| 联系人 |
LinkPhone |
|
| 联系电话 |
//界面用到的html代码:
<body>
<div style="width:1192px;height:550px; background-color: #CCCCFF;">
<center><span style="font-family: 楷体; font-size: 30px; color: #FF0000">配 载 装 车 </span></center>
<center><table >
<tr>
<td style="width:40px;"></td> <td align="right" dir="ltr" style="font-family: 华文行楷; font-size: 19px; color: #000000;">运交领域:</td><td> <input id="txt_returnSendField" readonly style="width:300px; border-style: hidden; background-color: #CCCCFF; font-size: 18px; font-family: 华文楷体;" > </td><td style="width:10px;height:20px"></td>
<td align="right"style="font-family: 华文行楷; font-size: 19px; color: #000000;">配送属性:</td><td> <input id="txt_SXMX_Attribute" readonly style="border-style: hidden; width:140px; font-family: 华文楷体; font-size: 20px; background-color: #CCCCFF;" /> </td><td style="width:50px;height:20px"></td>
<td align="right"style="font-family: 华文行楷; font-size: 19px; color: #000000;">取/送件:</td><td> <input id="txt_GetSend" readonly style="border-style: hidden; width:140px; font-family: 华文楷体; font-size: 20px; background-color: #CCCCFF;" /> </td>
</tr>
<tr style="height:10px"> </tr>
<tr> <td style="width:40px;"></td><td align="right"style="font-family: 华文行楷; font-size: 19px; color: #000000;">预出车时间:</td><td> <input id="txt_PredictDrawOutTime" readonly style="border-style: hidden; width:140px; background-color: #CCCCFF; font-size: 20px; font-family: 华文楷体;" /> </td><td style="width:50px;height:20px"></td>
<td align="right"style="font-family: 华文行楷; font-size: 19px; color: #000000;">单据截至时间:</td><td> <input id="txt_ReceiptsStopTime" readonly style="border-style: hidden; width:140px; font-family: 华文楷体; font-size: 20px; background-color: #CCCCFF;" /> </td><td style="width:50px;height:20px"></td>
<td ><input type="submit" οnclick="btn_Confirm()" value="确认" style="width:60px;color: #FF0000; font-size: 17px" /></td>
</tr>
<tr style="height:10px"></tr>
<tr style="height:5px"> </tr>
</table >
<table >
<tr>
<td align="right" style="font-size: 16px; font-family: 楷体; color: #0000FF">车次日期:</td><td> <input id="dat_CarTimesDate"class="easyui-datebox" style="width:140px;"data-options="formatter:formatterCarTimeDate"></input></td><td style="width:50px;height:20px"></td>
<td align="right" style="font-size: 16px; font-family: 楷体; color: #0000FF">物流地点:</td><td> <input id="cbo_SelectLogisticsPlace"data-options="url:'/DeliveryFieldAddress/LogisticsPlace',valueField: 'LogisticsPlaceID', textField: 'LogisticsPlaceName'" class="easyui-combobox" style="width:140px;font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"></input></td><td style="width:50px;height:20px"></td>
<td align="right" style="font-size: 16px; font-family: 楷体; color: #0000FF">配送方式:</td><td><input id="cbo_SelectDeliveryGrade"data-options="valueField:'MX_AttributeDetailedID',textField:'AttributeDetailedName',url:'/DeliveryFieldAddress/SelectAttributeGather?AttributeGatherID=1'" class="easyui-combobox" style="width:140px; font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"></input></td><td style="width:20px;height:10px"></td>
<td align="right" style="font-size: 16px; font-family: 楷体; color: #0000FF">车次 :</td><td> <input οnkeyup="onkeydown2()" οnclick="onkeydown2()" id="txt_CarTimes" style="width:140px; font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"></input></td><td style="width:50px;height:20px"></td>
</tr>
<tr style="height:5px"> </tr>
</table>
</center>
<table class="easyui-datagrid" id="dgrd_InsertDanHao" style="width:1180px; height:400px" title="请输入要进行配载装车的单据号" data-options="onClickRow:myonClickRow,
singleSelect: true,
toolbar: '#tb',
">
<thead>
<tr>
<th data-options="field:'DeliverReceiptsID',width:8,hidden:true, align:'center'" bgcolor="#3333CC">发车单据ID</th>
<th data-options="field:'FreightReceiptsID',width:8,hidden:true, align:'center'" bgcolor="#3333CC">货运单ID</th>
<th data-options="field:'Company',width:200,align:'center'">公司</th>
<th data-options="field:'SendNumber',width:200,align:'center',formatter:myformatterSendNumber">取送单号</th>
<th data-options="field:'XiangsShu',width:70,align:'center',hidden:true"></th>
<th data-options="field:'BoxCount',width:70,align:'center',editor:'numberbox',formatter:formatterXianShu">箱数</th>
<th data-options="field:'CollectFieldWord',width:100,align:'center'">运交领域</th>
<th data-options="field:'GetSend',width:100,align:'center'">类别</th>
<th data-options="field:'DeliveryWay',width:100,align:'center'">配送方式</th>
<th data-options="field:'CollectAddress',width:425,align:'center'">送货地址</th>
</tr>
</thead>
</table>
<div id="tb" style="height:auto">
<a class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" οnclick="TianjiaMingXi()">添加单号</a>
<a class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true" οnclick="YiChuMingXi()">移除单号</a>
</div>
</div>
<div class="easyui-window" id="Wnd_SendNumber" style="width:450px; height:300px; top:150px; left:730px;" title="查询取送单号">
<table><tr><td>领域代码:<input id="txt_FieldWord" style="width:110px;"/></td><td> 配送方式:<input id="cbo_SelectDeliveryWay"data-options="valueField:'MX_AttributeDetailedID',textField:'AttributeDetailedName',url:'/DeliveryFieldAddress/SelectAttributeGather?AttributeGatherID=1'" class="easyui-combobox" style="width:110px; font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"></td> <td> <input type="submit" οnclick="Selete()" value="查询" style="width:50px;color: #FF0000; font-size: 17px" /></td> </tr></table>
<table class="easyui-datagrid" id="dgrd_DanHa" style="width:435px; height:230px" data-options="onDblClickRow:myonDblClickRow
">
<thead>
<tr>
<th data-options="field:'SendNumber',width:150,align:'center'">取送单号</th>
<th data-options="field:'AttributeDetailedName1',width:80,align:'center'">状态</th>
<th data-options="field:'CollectFieldWord',width:80,align:'center'">运交领域</th>
<th data-options="field:'AttributeDetailedName',width:100,align:'center'">配送方式</th>
</tr>
</thead>
</table>
</div>
<div class="easyui-window" id="Wnd_CarTimes" style="width:400px; height:300px; top:150px; left:680px; background-color: #9999FF;" title="双击选定配载装车未出车车次 ">
<table class="easyui-datagrid" id="dgrd_CarTimes" style="width:386px; height:264px" data-options="onDblClickRow:myonDblClickRow1
">
<thead>
<tr>
<th data-options="field:'CarTimes',width:60,align:'center'">车次</th>
<th data-options="field:'SendCarState',width:60,align:'center'">状态</th>
<th data-options="field:'LogisticsPlaceName',width:80,align:'center'">物流地点</th>
<th data-options="field:'AttributeDetailedName',width:80,align:'center'">配送方式</th>
<th data-options="field:'CarTimesDate',width:97,align:'center'">车次日期</th>
</tr>
</thead>
</table>
</div>
</body>
//界面用到的脚本代码:
$(document).ready(function () {//执行完html代码后就执行此方法
$("#Wnd_SendNumber").window("close");//关闭窗体
$("#Wnd_CarTimes").window("close");
});
var EdIndex = 0; //设置全局变量
var MyIndex = -1;
var danhao = "";
//点击id为dgrd_InsertDanHao的datagrid的行时触发此方法
function myonClickRow(index, row) { //index为点击那一行的行索引,row为行数据
MyIndex = index;
if (EdIndex != index) {//判断点击的是否是同一行数据如果不是就结束编辑前一行数据,开始编辑新一行数据
var RowNumber = $("#dgrd_InsertDanHao").datagrid("getRows"); //getRows是获取所有行的数据
danhao = $("#" + RowNumber[EdIndex].XiangsShu).val();//获取前一行的单号
$('#dgrd_InsertDanHao').datagrid('endEdit', EdIndex);//结束编辑
$("#" + RowNumber[EdIndex].XiangsShu).val(danhao);//结束编辑后将单号赋值给前一行
}
$('#dgrd_InsertDanHao').datagrid('beginEdit', index);//开始编辑
EdIndex = index;
}
//点击‘添加单号’按钮时触发此方法
function TianjiaMingXi() {
if ($("#txt_returnSendField").val().trim().length>0) {//判断运交领域是否为空
var RowNumber = $("#dgrd_InsertDanHao").datagrid("getRows");
if (RowNumber.length == 0){//判断datagrid是否有数据
$("#dgrd_InsertDanHao").datagrid("insertRow", {//新增一行数据
index: RowNumber.length,
row: { 'XiangsShu': "0", 'BoxCount': 0}//新增一行时给箱数赋值为0
});
}
else {
if ($("#" + (RowNumber.length - 1)).val().toString().length > 0) {//判断是否输入单号
$("#dgrd_InsertDanHao").datagrid("insertRow", {
index: RowNumber.length,
row: {}
});
}
else { alert("请输入单号!"); }
}
}
else {//如果运交领域为空,提示选择车次
alert("请先选择车次,再添加单号! ");
}
}
//当行数据改变时触发此方法
function myformatterSendNumber(data, row, Index) {//row为改变的那一行的行数据,Index为行索引
var Row2 = $("#dgrd_InsertDanHao").datagrid("getRows");
Row2[Index].XiangsShu = Index;
//返回一个文本框嵌套在datagrid中
return '<input οnclick="ChaDanJu()" οnkeyup="onkeydown1()" style="width:190px;height:20px" id="' + Index + '"/>';
}
var DeliveryWay = 0;
//点击datagrid中的取送单号时触发此方法
function ChaDanJu() {
$("#Wnd_SendNumber").window("open"); //打开取送单号窗体
$.getJSON("/FreightReceiptsManage/SeleteProvideReceipts?intDeliveryWayID=" + $("#cbo_SelectDeliveryGrade").combobox("getValue") + "&strSendNumber=" + "" + "&FileDress=" + $("#txt_returnSendField").val().trim(), function (data) { //+ "&strCollectAddress=" + $("#txt_FieldWord").val()
$("#dgrd_DanHa").datagrid('loadData', data);//将查询出的数据加载到datagrid中
});
}
//在datagrid中的取送单号中输入单号时触发此方法
function onkeydown1(){
$("#Wnd_SendNumber").window("open");
if ($("#cbo_SelectDeliveryGrade").combobox("getValue").trim().length > 0) { DeliveryWay = $("#cbo_SelectDeliveryGrade").combobox("getValue") }
$.getJSON("/FreightReceiptsManage/SeleteProvideReceipts?intDeliveryWayID=" + DeliveryWay + "&strSendNumber=" +$("#" + MyIndex).val().trim() + "&FileDress=" + $("#txt_returnSendField").val().trim(), function (data) { //+ "&strCollectAddress=" + $("#txt_FieldWord").val()
$("#dgrd_DanHa").datagrid('loadData', data);
if (data.length == 1) {
panduan6 = 0;
var Row1 = $("#dgrd_InsertDanHao").datagrid("getRows");
for (var i = 0; i < Row1.length; i++) {//循环遍历是否录入了相同的单据
if (data[0].FreightReceiptsID == Row1[i].FreightReceiptsID) {
panduan6 = 8;
}
}
if (panduan6!= 8) {//如果没有录入相同的单据就录入选择的那一行单据
var Row1 = $("#dgrd_InsertDanHao").datagrid("getRows");
Row1[MyIndex].FreightReceiptsID = data[0].FreightReceiptsID;
Row1[MyIndex].DeliveryWay = data[0].AttributeDetailedName;
Row1[MyIndex].Company = data[0].CompanyName;
Row1[MyIndex].GetSend = data[0].GetSend;
Row1[MyIndex].CollectClient = data[0].ClientName;
Row1[MyIndex].CollectAddress = data[0].CollectAddress;
Row1[MyIndex].CollectFieldWord = data[0].CollectFieldWord;
$("#dgrd_InsertDanHao").datagrid("refreshRow", MyIndex)
$("#" + MyIndex).val(data[0].SendNumber);
}
else {alert("该单据已存在,请选择其他单据");}
}
});
}
//点击‘移除单号按钮’时触发此方法
function YiChuMingXi() {
if (MyIndex == ($('#dgrd_InsertDanHao').datagrid("getRows").length - 1)) {
EdIndex = EdIndex - 1;
}
$('#dgrd_InsertDanHao').datagrid('deleteRow', MyIndex);//删除单号
MyIndex = -1;
}
var panduan6 = 0;
//双击取送单号窗体中的行时触发此方法
function myonDblClickRow(index, row) {
panduan6 = 0;
var Row1 = $("#dgrd_InsertDanHao").datagrid("getRows");
for (var i = 0; i < Row1.length; i++) { //循环遍历是否录入了相同的单据
if (row.FreightReceiptsID == Row1[i].FreightReceiptsID) {
panduan6 = 8;
}
}
if (panduan6 != 8) { //如果没有录入相同的单据就录入选择的那一行单据
$("#" + MyIndex).val(row.SendNumber);
Row1[MyIndex].FreightReceiptsID = row.FreightReceiptsID;
Row1[MyIndex].DeliveryWay = row.AttributeDetailedName;
Row1[MyIndex].Company = row.CompanyName;
Row1[MyIndex].GetSend = row.GetSend;
Row1[MyIndex].CollectClient = row.ClientName;
Row1[MyIndex].CollectAddress = row.CollectAddress;
Row1[MyIndex].CollectFieldWord = row.CollectFieldWord;
$('#dgrd_InsertDanHao').datagrid('endEdit', EdIndex);
$('#dgrd_InsertDanHao').datagrid('beginEdit', MyIndex);
$("#" + MyIndex).val(row.SendNumber);
$('#dgrd_DanHa').datagrid('deleteRow', index);
} else {alert("该单据已存在,请选择其他单据");}
}
//点击‘确认’按钮时触发此方法
function btn_Confirm() {
var RowNumber = $("#dgrd_InsertDanHao").datagrid("getRows");
danhao = $("#" + RowNumber[MyIndex].XiangsShu).val();
$('#dgrd_InsertDanHao').datagrid('endEdit', MyIndex); //先结束编辑再保存数据
$("#" + RowNumber[MyIndex].XiangsShu).val(danhao);
$.getJSON("/DrawOutAndReturnCar/SelectSpecialcarTime?dateCarTimesDate=" + $("#dat_CarTimesDate").datebox("getValue") + "&intLogisticsPlaceID=" + n + "&intDeliveryWayID=" + m + "&strCarTimes=" + $("#txt_CarTimes").val(), function (data) {
var ID = data[0].MX_DeliveryCarTimesServiceID;//查询出车次的主键id
$.getJSON("/FreightReceiptsManage/updateCarState?intMX_DeliveryCarTimesServiceID=" + ID);
var Row2 = $("#dgrd_InsertDanHao").datagrid("getChanges", "inserted"); //获取新增的行的数据
for (var i = 0; i < Row2.length; i++) {
$.getJSON("/CarTimesSelectAndDriver/insertDeliverReceipts1?intFreightReceiptsID=" + Row2[i].FreightReceiptsID + "&intMX_DeliveryCarServiceID=" + ID + "&strBoxCount=" + Row2[i].BoxCount);
$.getJSON("/DrawOutAndReturnCar/updateFreightReceiptsState?intFreightReceiptsStateID=40" + "&intFreightReceiptsID=" + Row2[i].FreightReceiptsID + "&");
}
var Row3 = $("#dgrd_InsertDanHao").datagrid("getChanges", "deleted");//获取删除的行的数据
for (var i = 0; i < Row3.length; i++) {
$.getJSON("/CarTimesSelectAndDriver/deleteDeliverReceipts?intDeliverReceiptsID=" + Row3[i].DeliverReceiptsID);
}
var Row4 = $("#dgrd_InsertDanHao").datagrid("getChanges", "updated"); //获取被修改的行的数据
for (var i = 0; i < Row4.length; i++) {
$.getJSON("/CarTimesSelectAndDriver/updateDeliverReceipts?intDeliverReceiptsID=" + Row4[i].DeliverReceiptsID + "&intFreightReceiptsID=" + Row4[i].FreightReceiptsID + "&strBoxCount=" + Row4[i].BoxCount);
}
alert("数据已保存!");
});
}
//日期的格式转换
function formatterCarTimeDate(date) {
var y = date.getFullYear();
var m = date.getMonth() + 1;
var d = date.getDate();
return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
}
var n = 0; var m = 0;
//在车次文本框中输入车次信息时触发此方法
function onkeydown2(){
if ($("#cbo_SelectLogisticsPlace").combobox("getValue").trim().length > 0) { n = $("#cbo_SelectLogisticsPlace").combobox("getValue"); }
if ($("#cbo_SelectDeliveryGrade").combobox("getValue").trim().length > 0) { m = $("#cbo_SelectDeliveryGrade").combobox("getValue"); }
//查询车次信息
$.getJSON("/DrawOutAndReturnCar/SelectSpecialcarTime?dateCarTimesDate=" + $("#dat_CarTimesDate").datebox("getValue") + "&intLogisticsPlaceID=" + n + "&intDeliveryWayID=" + m + "&strCarTimes=" + $("#txt_CarTimes").val(), function (data) {
$("#dgrd_CarTimes").datagrid('loadData', data);
$("#Wnd_CarTimes").window("open"); //打开车次窗体
});
}
//双击车次窗体中的行时触发此方法
function myonDblClickRow1(index, row) {
$.getJSON("/DrawOutAndReturnCar/SelectTeShuPaiCheReceipts?intMX_DeliveryCarServiceID=" + row.MX_DeliveryCarTimesServiceID, function (data1) {
$("#dgrd_InsertDanHao").datagrid('loadData', data1);
var rows = $("#dgrd_InsertDanHao").datagrid("getRows");
for (var i = 0; i < rows.length; i++) {//遍历循环赋值给取送单号的单元格
$("#" + i).val(rows[i].SendNumber);
}
});
$("#txt_returnSendField").val(row.ServiceField);
$("#txt_SXMX_Attribute").val(row.SXMX_Attribute);
$("#txt_GetSend").val(row.GetSend);
$("#txt_PredictDrawOutTime").val(row.PredictDrawOutTime.substring(11, 16));
$("#txt_ReceiptsStopTime").val(row.ReceiptsStopTime.substring(11, 16)); //substring(11, 16)是剪切出11到16位的字符串
$("#txt_CarTimes").val(row.CarTimes);
$("#cbo_SelectLogisticsPlace").combobox("setValue", row.LogisticsPlaceID);
$("#cbo_SelectDeliveryGrade").combobox("setValue", row.DeliveryWayID);
$("#dat_CarTimesDate").datebox("setValue", row.CarTimesDate);
$("#Wnd_CarTimes").window("close");//关闭车次窗体
}
//在取送单号窗体中点击查询按钮时触发此方法
function Selete() {
$.getJSON("/FreightReceiptsManage/SeleteProvideReceipts1?intDeliveryWayID=" + $("#cbo_SelectDeliveryWay").combobox("getValue") + "&strSendNumber=" + "" + "&strCollectAddress=" + $("#txt_FieldWord").val(), function (data) {
$("#dgrd_DanHa").datagrid('loadData', data);
});
}
//箱数改变时触发此方法
function formatterXianShu(index, row) {
if (row.BoxCount == null) { return 0; }
else {return row.BoxCount; }
}
//下面是接收从界面传值的控制器的代码:
// --查询配载装车的车次
public ActionResult SelectSpecialcarTime(string dateCarTimesDate, int intLogisticsPlaceID, int intDeliveryWayID, string strCarTimes)
{//参数dateCarTimesDate是车次日期、intLogisticsPlaceID是物流地点、intDeliveryWayID为配送方式、strCarTimes为车次
DataTable dt = myDrawOutAndReturnCar.SelectSpecialcarTime( dateCarTimesDate, intLogisticsPlaceID,intDeliveryWayID,strCarTimes);
StringBuilder stringbuilder = new StringBuilder();
DataView dv = new DataView(dt);
dv.RowFilter = "FactDrawOutTime is NULL";
DataTable dtChild = dv.ToTable();
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dtChild);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
// --模糊查询待配载单据
public ActionResult SeleteProvideReceipts(int intDeliveryWayID, string strSendNumber, string FileDress)
//参数intDeliveryWayID是配送方式、strSendNumber是取送单号、FileDress为运交领域
{
var y = "";
DataTable dt = myFreightReceiptsManage.SeleteProvideReceipts(intDeliveryWayID, strSendNumber);
string[] str = FileDress.Split(',');//通过逗号分割字符串
StringBuilder stringbuilder = new StringBuilder();
DataView dv = new DataView(dt);//实例化数据视图
for (var i = 0; i < str.Length - 1; i++)
{
y = y + "CollectFieldWord='" + str[i] + "' or ";
}
y = y + " CollectFieldWord='" + str[str.Length - 1] + "'";
dv.RowFilter = y;//过滤出数据视图的数据
DataTable dtChild = dv.ToTable();//将数据视图的数据转换成数据表格
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dtChild);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
// --新增配载发车单据
public ActionResult insertDeliverReceipts1(int intFreightReceiptsID, int intMX_DeliveryCarServiceID, string strBoxCount)
{//参数intFreightReceiptsID是货运单id、intMX_DeliveryCarServiceID为车次id、strBoxCount为箱数
int i = myCarTimesSelectAndDriver.insertDeliverReceipts1(intFreightReceiptsID, intMX_DeliveryCarServiceID, strBoxCount);
return Json(i, JsonRequestBehavior.AllowGet);
}
// --删除货运单据
public ActionResult deleteDeliverReceipts(int intDeliverReceiptsID)
{//参数intDeliverReceiptsID为发车单据表的主键ID
int i = myCarTimesSelectAndDriver.deleteDeliverReceipts(intDeliverReceiptsID);
return Json(i, JsonRequestBehavior.AllowGet);
}
// --修改货运单据
public ActionResult updateDeliverReceipts(int intDeliverReceiptsID, int intFreightReceiptsID, string strBoxCount)
{//参数intDeliverReceiptsID为发车单据表的主键ID、intFreightReceiptsID为发车单据表的货运单id、strBoxCount为箱数
int i = myCarTimesSelectAndDriver.updateDeliverReceipts(intDeliverReceiptsID, intFreightReceiptsID,strBoxCount);
return Json(i, JsonRequestBehavior.AllowGet);
}
// --模糊查询待配载单据
public ActionResult SeleteProvideReceipts1(int intDeliveryWayID, string strSendNumber, string strCollectAddress) //参数intDeliveryWayID是配送方式、strSendNumber是取送单号、strCollectAddress是运交领域
{
DataTable dt = myFreightReceiptsManage.SeleteProvideReceipts1(intDeliveryWayID, strSendNumber, strCollectAddress); //,strCollectAddress
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
//下面是接收从控制器传值的逻辑层的代码:
// --模糊查询待配载单据
public DataTable SeleteProvideReceipts1(int intDeliveryWayID, string strSendNumber, string strCollectAddress) //
{
SqlParameter[] SQL ={
new SqlParameter("@type",SqlDbType.Char),
new SqlParameter("@DeliveryWayID",SqlDbType.Int),
new SqlParameter("@PayCondition",SqlDbType.Int),
new SqlParameter("@SendNumber",SqlDbType.Char),
new SqlParameter("@CollectAddress",SqlDbType.Char),
};
SQL[0].Value = "SeleteProvideReceipts";
SQL[1].Value = intDeliveryWayID;
SQL[2].Value = 0;
SQL[3].Value = strSendNumber;
SQL[4].Value = strCollectAddress;
DataTable dt = myDALMethod.DAL_SelectDB_Par("FreightReceiptsInformation", SQL);
return dt;
}
// --模糊查询待配载单据
public DataTable SeleteProvideReceipts(int intDeliveryWayID, string strSendNumber)
{
SqlParameter[] SQL ={
new SqlParameter("@type",SqlDbType.Char),
new SqlParameter("@DeliveryWayID",SqlDbType.Int),
new SqlParameter("@PayCondition",SqlDbType.Int),
new SqlParameter("@SendNumber",SqlDbType.Char),
};
SQL[0].Value = "SeleteProvideReceipts";
SQL[1].Value = intDeliveryWayID;
SQL[2].Value = 0;
SQL[3].Value = strSendNumber;
DataTable dt = myDALMethod.DAL_SelectDB_Par("FreightReceiptsInformation", SQL);
return dt;
}
//查询取送单号
public DataTable SelectSendNumber(string strSendNumber)
{
SqlParameter[] SQL ={
new SqlParameter("@type",SqlDbType.Char),
new SqlParameter("@SendNumber",SqlDbType.Char),
};
SQL[0].Value = "SelectSendNumber";
SQL[1].Value = strSendNumber;
DataTable dt = myDALMethod.DAL_SelectDB_Par("SendCar", SQL);
return dt;
}
//新增配载发车单据
public int insertDeliverReceipts1(int intFreightReceiptsID, int intMX_DeliveryCarServiceID, string strBoxCount)
{
SqlParameter[] SQL ={
new SqlParameter("@type",SqlDbType.Char),
new SqlParameter("@FreightReceiptsID",SqlDbType.Int),
new SqlParameter("@MX_DeliveryCarServiceID",SqlDbType.Int),
new SqlParameter("@BoxCount",SqlDbType.Char),
};
SQL[0].Value = "insertDeliverReceipts1";
SQL[1].Value = intFreightReceiptsID;
SQL[2].Value = intMX_DeliveryCarServiceID;
SQL[3].Value = strBoxCount;
int i = myDALMethod.DAL_OPTableDB_Par("CarTimesSelectAndDriver", SQL);
return i;
}
// --删除货运单据
public int deleteDeliverReceipts(int intDeliverReceiptsID)
{
SqlParameter[] SQL ={
new SqlParameter("@type",SqlDbType.Char),
new SqlParameter("@DeliverReceiptsID",SqlDbType.Int),
};
SQL[0].Value = "deleteDeliverReceipts";
SQL[1].Value =intDeliverReceiptsID;
int i = myDALMethod.DAL_OPTableDB_Par("CarTimesSelectAndDriver", SQL);
return i;
}
// --修改货运单据
public int updateDeliverReceipts(int intDeliverReceiptsID, int intFreightReceiptsID, string strBoxCount)
{
SqlParameter[] SQL ={
new SqlParameter("@type",SqlDbType.Char),
new SqlParameter("@DeliverReceiptsID",SqlDbType.Int),
new SqlParameter("@FreightReceiptsID",SqlDbType.Int),
new SqlParameter("@BoxCount",SqlDbType.Char),
};
SQL[0].Value = "updateDeliverReceipts";
SQL[1].Value = intDeliverReceiptsID;
SQL[2].Value = intFreightReceiptsID;
SQL[3].Value = strBoxCount;
int i = myDALMethod.DAL_OPTableDB_Par("CarTimesSelectAndDriver", SQL);
return i;
}
//存储过程的代码:
--新增配载发车单据
if @type='insertDeliverReceipts1'
begin
insert into DeliverReceiptsList(FreightReceiptsID,BoxCount,MX_DeliveryCarServiceID,DrawOutUnusualID,DrawOutUnusualIReasonID, --BoxCount,
ReturnCarUnusualIID,ReturnCarUnusualIReasonID,HandleManID)
values (@FreightReceiptsID,@BoxCount,@MX_DeliveryCarServiceID,4,13,4,18,6)
end
--删除货运单据
if @type='deleteDeliverReceipts'
begin
delete DeliverReceiptsList
where DeliverReceiptsID=@DeliverReceiptsID
end
--修改货运单据
if @type='updateDeliverReceipts'
begin
update DeliverReceiptsList set FreightReceiptsID=@FreightReceiptsID,BoxCount=@BoxCount
where DeliverReceiptsID=@DeliverReceiptsID
end
--模糊查询待配载单据
if @type='SeleteProvideReceipts'
begin
if @SendNumber!=''
begin
set @sql=' where FreightReceiptsList.SendNumber like ''%'+LTRIM(RTRIM(@SendNumber))+'%'''
end
if @DeliveryWayID !=0
begin
if @sql !=''
set @sql=@sql+' and DeliveryFieldServiceList.DeliveryWayID ='''+LTRIM(RTRIM(@DeliveryWayID))+''''
else set @sql=' where DeliveryFieldServiceList.DeliveryWayID ='''+LTRIM(RTRIM(@DeliveryWayID))+''''
end
if @CollectAddress!=''
begin
if @sql !=''
set @sql=@sql+' and DeliveryFieldServiceList.FieldWord='''+LTRIM(RTRIM(@CollectAddress))+''''
else set @sql=' where DeliveryFieldServiceList.FieldWord= '''+LTRIM(RTRIM(@CollectAddress))+''''
end
if @PayCondition=0
begin
if @sql !=''
set @sql=@sql+' and FreightReceiptsList.FreightReceiptsStateID=43 '
else set @sql=' where FreightReceiptsList.FreightReceiptsStateID=43 '
end
exec('SELECT FreightReceiptsList.SendNumber, FreightReceiptsList.CompanyID, CompanyList.CompanyName, FreightReceiptsList.FreightReceiptsID, FreightReceiptsList.FreightReceiptsStateID,
LTRIM(RTRIM(MX_AttributeDetailedList_1.AttributeDetailedName)) AS AttributeDetailedName1, FreightReceiptsList.CollectAddress, FreightReceiptsList.ClassesID,
MX_AttributeDetailedList_2.AttributeDetailedName AS GetSend, DeliveryFieldServiceList.DeliveryWayID, LTRIM(RTRIM(DeliveryFieldServiceList.FieldWord)) AS CollectFieldWord,
MX_AttributeDetailedList.AttributeDetailedName
FROM FreightReceiptsList INNER JOIN
CompanyList ON FreightReceiptsList.CompanyID = CompanyList.CompanyID INNER JOIN
MX_AttributeDetailedList AS MX_AttributeDetailedList_1 ON FreightReceiptsList.FreightReceiptsStateID = MX_AttributeDetailedList_1.MX_AttributeDetailedID INNER JOIN
MX_AttributeDetailedList AS MX_AttributeDetailedList_2 ON FreightReceiptsList.ClassesID = MX_AttributeDetailedList_2.MX_AttributeDetailedID INNER JOIN
DeliveryFieldServiceList ON FreightReceiptsList.DeliveryFieldServiceID = DeliveryFieldServiceList.DeliveryFieldServiceID INNER JOIN
MX_AttributeDetailedList ON DeliveryFieldServiceList.DeliveryWayID = MX_AttributeDetailedList.MX_AttributeDetailedID
'+@sql)
End
--查询单号
if @type='SelectSendNumber'
begin
SELECT FreightReceiptsList.CollectClientID, ClientList.ClientName, FreightReceiptsList.FreightReceiptsStateID, RTRIM(MX_AttributeDetailedList.AttributeDetailedName) AS AttributeDetailedName,
FreightReceiptsList.CollectAddress, FreightReceiptsList.SendNumber, FreightReceiptsList.CompanyID, CompanyList.CompanyName, CompanyList.CompanyAbbreviation,
FreightReceiptsList.FreightReceiptsID, DeliveryFieldServiceList.FieldWord as CollectFieldWord
FROM FreightReceiptsList INNER JOIN
ClientList ON FreightReceiptsList.CollectClientID = ClientList.ClientID INNER JOIN
MX_AttributeDetailedList ON FreightReceiptsList.FreightReceiptsStateID = MX_AttributeDetailedList.MX_AttributeDetailedID INNER JOIN
CompanyList ON FreightReceiptsList.CompanyID = CompanyList.CompanyID INNER JOIN
DeliveryFieldServiceList ON FreightReceiptsList.DeliveryFieldServiceID = DeliveryFieldServiceList.DeliveryFieldServiceID
where FreightReceiptsList.SendNumber like '%'+LTRIM(RTRIM(@SendNumber))+'%' and FreightReceiptsList.FreightReceiptsStateID=43
end
仅供学习,禁止商业用途