物流运交管理系统 派车作业

派车作业

派车作业是对事先设定好的车次进行派车,派车后车辆会到达出货分区先对应的位置进行装货

派车作业界面:

改变datagrid中单元格的颜色

效果图:

HTML代码:

<th data-options="field:'CarTimes',width:130,align:'center',formatter:myformatter">车次</th> 

脚本代码:

function myformatter(index, row) {
         switch (row.AttributeDetailedName) {
             case "已派车":
                 {
                     if (row.FactDrawOutTime == null) {//判断车辆是否出车row.FactDrawOutTime == null是未出车
                         return '<span style="font-family: 微软雅黑;color: #000000; font-size: 19px">' + row.CarTimes + '</span>';
                      }
                     else {//已经出车执行else里面的方法
                         if (row.FactReturnCarTime == null) {//判断车辆是否返车row.FactDrawOutTime == null是未返车
                             return '<span style="font-family: 华文新魏;color: #00CC99; font-size: 19px">' + row.CarTimes + '</span>'; 
                         }
                         else {//已经返车执行else里面的方法
                             return '<span style="font-family: 华文新魏;color: #FF9900; font-size: 19px">' + row.CarTimes + '</span>';
                         }
                       }
                  };
             case "装车中":
                 {     //判断车辆是否出车row.FactDrawOutTime == null是未出车
                     if (row.FactDrawOutTime == null) {
                         return '<span style="font-family: 华文新魏;color: #0000FF; font-size: 19px">' + row.CarTimes + '</span>'; // color: #0000FF为返回字体的颜色
                      }
                     else {//已经出车执行else里面的方法
                         if (row.FactReturnCarTime == null) {//判断车辆是否返车row.FactDrawOutTime == null是未返车
                             return '<span style="font-family: 华文新魏;color: #00CC99; font-size: 19px">' + row.CarTimes + '</span>';
                         } else { //已经返车执行else里面的方法
                             return '<span style="font-family: 华文新魏;color: #FF9900; font-size: 19px">' + row.CarTimes + '</span>';
                         }
                          }
                  };
             case "未派车":
                 {
                     if (row.FactDrawOutTime == null) {
                         return '<span style="font-family: 华文新魏;color: #FF0000; font-size: 19px">' + row.CarTimes + '</span>'; 
                     }
                     else {
                         if (row.FactReturnCarTime == null) {
                             return '<span style="font-family: 华文新魏;color: #00CC99; font-size: 19px">' + row.CarTimes + '</span>';
                      
                         }
                         else {
                             return '<span style="font-family: 华文新魏;color: #FF9900; font-size: 19px">' + row.CarTimes + '</span>';
                         }
                          }
                  };
         }
     }

派车作业涉及的表和表的关系

派车作业用到的表有:配送车次表DeliveryCarTimesServiceList)、配送车次维护明细表(MX_DeliveryCarTimesServiceList)

物流地点表(LogisticsPlaceList)、属性明细表(MX_AttributeDetailedList

配送车次表的字段有:配送车次维护ID、车次日期、物流地点ID、配送方式ID、配送属性ID、班次ID

列名

数据类型

主键/外键

说明

DeliveryCarTimesServiceID

Int

主键

配送车次维护ID

CarTimesDate

Datetime

 

车次日期

LogisticsPlaceID

Int

外键

物流地点ID

DeliveryWayID

Int

外键

配送方式ID

SXMX_AttributeID

Int

外键

配送属性ID

ClassesID

Int

外键

班次ID

 

 

配送车次维护明细表的字段有:配送车次维护明细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、物流地点名称、地址

列名

数据类型

主键/外键

说明

LogisticsPlaceID

Int

主键

物流地点ID

LogisticsPlaceName

Char

 

物流地点名称

Address

Char

 

地址

属性明细表的字段:属性明细ID、属性明细名称、属性集合ID

列名

数据类型

主键/外键

说明

MX_AttributeDetailedID           

Int

主键

属性明细ID

AttributeDetailedName   

Char

 

属性明细名称

AttributeGatherID

Int

外键

属性集合ID

 

关系图:

 

模块功能的具体实现

//下面就是生成这个界面的Html代码:

<body>
    <div  class="easyui-window" title="派车状态及派车"  data-options="maximized:true,iconCls:'icon-采购'" style="width:300px;height:435px;padding:10px;  top: 1px; left: 1px; background-color: #CCCCFF;">
	    <table >
             <tr style="">  
                <td align="right">车次日期:</td><td> <input id="dat_CarTimesDate"class="easyui-datebox" style="width:140px;"data-options="formatter:myformatter1"></input></td><td style="width:50px;height:20px"></td>
                <td align="right"">物流地点:</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">配送属性 :</td><td> <input id="cbo_SelectAttribute" class="easyui-combobox"data-options="url:'/DeliveryFieldAddress/SelectAttributeGather?AttributeGatherID=2',valueField: 'MX_AttributeDetailedID', textField: 'AttributeDetailedName'" style="width:140px; font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"></input></td><td style="width:50px;height:20px"></td> 
                 <td align="right">配送方式:</td><td><input id="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>
                 </tr> 
                <tr style="height:10px"> </tr> 
                <tr>
                 <td align="right"">班次:</td><td> <input id="cbo_CarTimes"data-options="url:'/DeliveryFieldAddress/SelectAttributeGather?AttributeGatherID=8',valueField: 'MX_AttributeDetailedID', textField: 'AttributeDetailedName'" class="easyui-combobox" style="width:140px;font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 15px;"></input></td><td style="width:50px;height:20px"></td> 
                <td align="right">派车状态 :</td><td> <input id="cbo_SendCarState"data-options="url:'/DeliveryFieldAddress/SelectAttributeGather?AttributeGatherID=11',valueField: 'MX_AttributeDetailedID', textField: 'AttributeDetailedName'" 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 ><input  " type="submit" οnclick="btn_Select()" value="查询" style="width:60px;color: #FF0000; font-size: 17px" /></td>
                 <td ><input  " type="submit" οnclick="SendCar()" value="派车作业" style="width:80px;color: #FF0000; font-size: 17px" />
                 <input  " type="submit" οnclick="btn_Refresh()" value="刷新" style="width:60px;color: #FF0000; font-size: 17px" /></td>
                   </tr>
                     <tr style="height:5px"> </tr>
                   </table>
                 <div style="width:1155px;height:30px; background-color: #FFFFCC;">   
                 <table>
                   <tr> 
             <td style="font-family: 华文新魏;  font-size: 26px; color: #FF0000;"> 红色:未派车</td>  <td style="font-family: 华文新魏;  font-size: 26px; color: #0000FF;"> 蓝色:装车中</td> <td style="font-family: 华文新魏;  font-size: 26px; color: #000000;"> 黑色:已派车</td><td style="font-family: 华文新魏;  font-size: 26px; color: #00CC99;"> 青色:已出车</td><td style="font-family: 华文新魏;  font-size: 26px; color: #FF9900;"> 橙色:已返车</td> 
                 </tr>
             </table>
             </div>                            
         <table id="dgrd_CarTimesState" class="easyui-datagrid" title="车次状态" style="width:1155px;height:370px;background-color: #CCCCCC;""
              data-options="rownumbers:true,singleSelect:true
              ,rowStyler:function(index,row){
        		if (index%2==0){	 
                     return 'background-color:#D1EEEE';
          		 }                                            
    		   } " frame="border"> 
                  <thead>
                       <tr align="center">
                        <th data-options="field:'DeliveryFieldServiceID',width:8,hidden:true, align:'center'"  bgcolor="#3333CC">配送领域维护ID</th>
                        <th data-options="field:'CarTimes',width:130,align:'center',formatter:myformatter">车次</th> 
                        <th data-options="field:'ServiceField',width:370,align:'center'">运交领域</th>
                          <th data-options="field:'SendCarTime',width:130,align:'center'">派车时间</th>
                         <th data-options="field:'CarTimesDate',width:100,align:'center'">车次日期</th>
                         <th data-options="field:'FactDrawOutTime',width:130,align:'center'">出车时间</th>
                           <th data-options="field:'FactReturnCarTime',width:130,align:'center'">返车时间</th> 
                          <th data-options="field:'PredictDrawOutTime',width:130,align:'center'">预出车时间</th>
                           <th data-options="field:'ReceiptsStopTime',width:130,align:'center'">截止时间</th>  
                           <th data-options="field:'LogisticsPlaceName',width:130,align:'center'">物流地点</th> 
                        <th data-options="field:'PeiSongAttribute',width:130,align:'center'">配送属性</th>
                        <th data-options="field:'DeliveryWay',width:130,align:'center'">配送方式</th>
                       </tr>
		         </thead>
                </table>
        
     
     <div id="Wnd_PaiChe" class="easyui-window" title="物流作业—派车作业" style="width:300px;height:300px; background-image: url('http://localhost:59335/images/20B.jpg');">
  <center>
     <table>
     <tr>
                  
     </tr>
       <tr>
         <th align="right" style="color: #FFFFFF; font-size: 16px;">物流地点:</th>
         <td><input id="cbo_LogisticsPlace" class="easyui-combobox"  style="width:137px"/></td>          
       </tr>
       <tr style="height:10px"> </tr>
       <tr>
         <th align="right" style="color: #FFFFFF; font-size: 16px;">车次日期:</th>
         <td><input id="cartimesdate" class="easyui-datebox"data-options="formatter:myformatter1"   style="width:137px;left:5px"/></td>
       </tr>
       <tr style="height:10px"> </tr>
       <tr>
         <th align="right" style="color: #FFFFFF; font-size: 16px;">派车范围:</th>
         <td> <select  οnchange="myonchange()" style="width:137px" id="paichefanwei">
                 <option value="1">所有未派车次</option>
                <option value="2">指定车次</option>
              </select> </td>
       </tr>
         <tr style="height:10px"> </tr>
       <tr>
         <th align="right" style="color: #FFFFFF; font-size: 16px;">配送方式:</th>
         <td><input id="cbo_DeliveryWay" class="easyui-combobox"  style="width:137px"/> </td>
       </tr>
       <tr style="height:10px"> </tr>
       <tr id="checi">
          <td  align="right" style="color: #FFFFFF; font-size: 16px;">车  次:</td>
           <td  ><input id="txt_cartimes"  style="width:137px"/> </td>
          </tr>  
          <tr id="banci">
          <td   align="right" style="color: #FFFFFF; font-size: 16px;">班  次:</td>
         <td  ><input id="cbo_Class"  class="easyui-combobox"  style="width:137px"/> </td>
        </tr>
       <tr style="height:10px"> </tr>
       <tr style="height:10px"> </tr>
     </table>
     </center>
     <center>
       <input  type="submit" οnclick="btn_Confirm()" value="确认" style="width:60px;color: #FF0000; font-size: 17px" />  
                   </center>
    </div>
    </div>
 </body>


 

//整个界面用到的脚本代码:

<script type="text/javascript">
    $(document).ready(function(){
        BinDingDatagrid();//调用绑定datagrid的方法
         $("#Wnd_PaiChe").window("close");//关闭派车窗体
    });
     function BinDingDatagrid() {
    //查询出所有车次信息绑定到datagrid中
         $.getJSON("/CarTimesSelectAndDriver/SelectSendCarState?intAttributeDetailedName=0" + "&intLogisticsPlaceID=0" + "&intDeliveryWayID=0"+
        "&intClassID=0" + "&strCarTimesDate=" + "" + "&intSendCarState=0",
         function (data) {
             $("#dgrd_CarTimesState").datagrid('loadData', data);
          });
     }
     //datagrid中每加载一行数据时触发此方法
     function myformatter(index, row) {
         switch (row.AttributeDetailedName) {
             case "已派车":
                 {
                     if (row.FactDrawOutTime == null) {//判断车辆是否出车row.FactDrawOutTime == null是未出车
                         return '<span style="font-family: 微软雅黑;color: #000000; font-size: 19px">' + row.CarTimes + '</span>';
                      }
                     else {//已经出车执行else里面的方法
                         if (row.FactReturnCarTime == null) {//判断车辆是否返车row.FactDrawOutTime == null是未返车
                             return '<span style="font-family: 华文新魏;color: #00CC99; font-size: 19px">' + row.CarTimes + '</span>'; 
                         }
                         else {//已经返车执行else里面的方法
                             return '<span style="font-family: 华文新魏;color: #FF9900; font-size: 19px">' + row.CarTimes + '</span>';
                         }
                       }
                  };
             case "装车中":
                 {     //判断车辆是否出车row.FactDrawOutTime == null是未出车
                     if (row.FactDrawOutTime == null) {
                         return '<span style="font-family: 华文新魏;color: #0000FF; font-size: 19px">' + row.CarTimes + '</span>'; 
                      }
                     else {//已经出车执行else里面的方法
                         if (row.FactReturnCarTime == null) {//判断车辆是否返车row.FactDrawOutTime == null是未返车
                             return '<span style="font-family: 华文新魏;color: #00CC99; font-size: 19px">' + row.CarTimes + '</span>';
                         } else { //已经返车执行else里面的方法
                             return '<span style="font-family: 华文新魏;color: #FF9900; font-size: 19px">' + row.CarTimes + '</span>';
                         }
                          }
                  };
             case "未派车":
                 {
                     if (row.FactDrawOutTime == null) {
                         return '<span style="font-family: 华文新魏;color: #FF0000; font-size: 19px">' + row.CarTimes + '</span>'; 
                     }
                     else {
                         if (row.FactReturnCarTime == null) {
                             return '<span style="font-family: 华文新魏;color: #00CC99; font-size: 19px">' + row.CarTimes + '</span>';
                      
                         }
                         else {
                             return '<span style="font-family: 华文新魏;color: #FF9900; font-size: 19px">' + row.CarTimes + '</span>';
                         }
                          }
                  };
         }
     }
     var PeiSongShuXing = 0;
     var WuLiuDiDian = 0;
     var PeiSongFangShi = 0;
     var BanCi = 0;
     var RiQi = "";
     var  PaiCheZhuangTai = 0;
     //点击‘查询’按钮时触发此方法
     function btn_Select(){
         if ($("#cbo_SelectAttribute").combobox("getValue").trim().length > 0) { //判断配送属性下拉框是否选中
             PeiSongShuXing = $("#cbo_SelectAttribute").combobox("getValue");
          }
         if ($("#cbo_SelectLogisticsPlace").combobox("getValue").trim().length > 0) { //判断物流地点下拉框是否选中
             WuLiuDiDian = $("#cbo_SelectLogisticsPlace").combobox("getValue");
           }
         if ($("#cbo_SelectDeliveryGrade").combobox("getValue").trim().length > 0) { //判断配送方式下拉框是否选中
             PeiSongFangShi = $("#cbo_SelectDeliveryGrade").combobox("getValue"); }
         if ($("#cbo_CarTimes").combobox("getValue").trim().length > 0) {  //判断班次下拉框是否选中
           BanCi = $("#cbo_CarTimes").combobox("getValue");
           }
       if ($("#dat_CarTimesDate").datebox("getValue").trim().length > 0) { //判断车次日期是否选中
           RiQi = $("#dat_CarTimesDate").datebox("getValue"); 
          }
       if ($("#cbo_SendCarState").combobox("getValue").trim().length > 0) {//判断派车状态下拉框是否选中
           PaiCheZhuangTai = $("#cbo_SendCarState").combobox("getValue"); 
          }
         $.getJSON("/CarTimesSelectAndDriver/SelectSendCarState?intAttributeDetailedName=" + PeiSongShuXing + "&intLogisticsPlaceID=" + WuLiuDiDian +
          "&intDeliveryWayID=" + PeiSongFangShi +"&intClassID=" + BanCi + "&strCarTimesDate=" + RiQi + "&intSendCarState=" + PaiCheZhuangTai,
         function (data) { //将数据加载到datagrid里面
             $("#dgrd_CarTimesState").datagrid('loadData', data);
         });
     }
     //日期的格式转换
     function myformatter1(date) {
         var y = date.getFullYear();//获取年份
         var m = date.getMonth() + 1; //获取月份
         var d = date.getDate();//获取号
         return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);//返回转换后的日期
     }
     var QQ = 0;
     //在派车作业窗体中点击‘确认’按钮时触发此方法
     function btn_Confirm() {
         if ($("#cbo_Class").combobox("getValue").length > 0) { QQ = $("#cbo_Class").combobox("getValue")}
         $.getJSON("/CarTimesSelectAndDriver/SelectJudge?DeliveryWayID=" + $("#cbo_DeliveryWay").combobox("getValue") + "&LogisticsPlaceID=" +
         $("#cbo_LogisticsPlace").combobox("getValue") + "&CarTimesDate=" + $("#cartimesdate").datebox("getValue") + "&ClassesID=" + QQ +
         "&CarTimes=" + $("#txt_cartimes").val(),
         function (data) {
             if (data.length > 0) {//判断是否存在该车次/班次
                 for (var i = 0; i < data.length; i++) {//遍历循环班次信息逐一进行派车
                     $.getJSON("/DrawOutAndReturnCar/updateSpecialSendCarState?intMX_DeliveryCarTimesServiceID=" + data[i].MX_DeliveryCarTimesServiceID);
                 }
                 alert("派车成功!");
                 BinDingDatagrid();//派车成功后重新加载数据到datagrid中
             }
             else { alert("派车失败,没有查找到对应的车次或班次,请检查数据填写是否正确");}
         });
     }
     //派车作业窗体中‘派车作业’下拉框的值改变时触发此方法
     function myonchange() {
         if ($("#paichefanwei").val() == "1") {
             $("#txt_cartimes").val("");
             $("#checi").fadeOut(100);//隐藏车次下拉框
             $("#banci").fadeIn(1500);//显示班次下拉框
           }
          if ($("#paichefanwei").val() == "2") {
              $("#cbo_Class").combobox("setValue", "");
              QQ = 0;
              $("#banci").fadeOut(100);//隐藏班次下拉框
              $("#checi").fadeIn(1500);//显示车次下拉框
           }
      }
     //点击‘派车作业’按钮时触发此方法
     function SendCar() {
         $("#checi").fadeOut(10);
         $("#Wnd_PaiChe").window("open");//打开派车作业窗体
         $.getJSON("/DeliveryFieldAddress/LogisticsPlace",
         function (data) { //加载数据绑定物流地点下拉框
             $("#cbo_LogisticsPlace").combobox({ data: data, valueField: 'LogisticsPlaceID', textField: 'LogisticsPlaceName' })
           }
       );
         $.getJSON("/DeliveryFieldAddress/SelectAttributeGather?AttributeGatherID=1",
         function (data) { //加载数据绑定配送方式下拉框
             $("#cbo_DeliveryWay").combobox({ data: data, valueField: 'MX_AttributeDetailedID', textField: 'AttributeDetailedName' });
         }
       );
         $.getJSON("/DeliveryFieldAddress/SelectAttributeGather?AttributeGatherID=8",
         function (data) {//加载数据绑定班次下拉框
             $("#cbo_Class").combobox({ data: data, valueField: 'MX_AttributeDetailedID', textField: 'AttributeDetailedName' });
         }
       );
     }
     //点击‘刷新’按钮时触发此方法
     function btn_Refresh() {
         window.location.href = "/CarTimesSelectAndDriver/CarTimesState";
     }
</script>


 

//下面是接收从界面传值的控制器的代码:

//模糊查询派车状态
        public ActionResult SelectSendCarState(int intAttributeDetailedName, int intLogisticsPlaceID,
            int intDeliveryWayID, int intClassID, string strCarTimesDate, int intSendCarState) 
        {//参数intAttributeDetailedName为配送属性id、intLogisticsPlaceID为物流地点id、intClassID为班次id、strCarTimesDate为车次日期、intSendCarState为派车状态
            DataTable dt = myCarTimesSelectAndDriver.SelectSendCarState( intAttributeDetailedName,intLogisticsPlaceID,
             intDeliveryWayID,intClassID,strCarTimesDate,intSendCarState);
            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
            return Json(listReturn, JsonRequestBehavior.AllowGet);
        }
   //     --查询派车信息进行判断
        public ActionResult SelectJudge(int DeliveryWayID, int LogisticsPlaceID, string CarTimesDate, int ClassesID, string CarTimes)
        {//参数DeliveryWayID为配送方式、LogisticsPlaceID为物流地点、CarTimesDate为车次日期、ClassesID为班次id、CarTimes为车次
            DataTable dt = myCarTimesSelectAndDriver.SelectJudge(DeliveryWayID,LogisticsPlaceID,CarTimesDate, ClassesID, CarTimes);
            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
            return Json(listReturn, JsonRequestBehavior.AllowGet);
        }
   // --修改车辆状态      
        public ActionResult updateSpecialSendCarState(int intMX_DeliveryCarTimesServiceID)
        {//参数intMX_DeliveryCarTimesServiceID为配送车次明细id
             int i = myDrawOutAndReturnCar.updateSpecialSendCarState(intMX_DeliveryCarTimesServiceID);
            return Json(i, JsonRequestBehavior.AllowGet);
        
        }
//通过属性集合查明细(配送领域地址)
        public ActionResult SelectAttributeGather(int AttributeGatherID)
        {//参数AttributeGatherID为属性集合id
            DataTable dt = myFieldAddress.SelectAttributeGather(AttributeGatherID);
            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
            return Json(listReturn, JsonRequestBehavior.AllowGet);
        }
   //查物流地点
        public ActionResult LogisticsPlace()
        {
            DataTable dt = myFieldAddress.LogisticsPlace();
            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
            return Json(listReturn, JsonRequestBehavior.AllowGet);
        }


 

//下面是接收从控制器传值的逻辑层的代码:

//模糊查询派车状态
        public DataTable SelectSendCarState(int intAttributeDetailedName, int intLogisticsPlaceID,
            int intDeliveryWayID, int intClassID, string strCarTimesDate, int intSendCarState)
        {
            SqlParameter[] SQL ={
                                  new SqlParameter("@type",SqlDbType.Char),
                                    new SqlParameter("@AttributeDetailedName",SqlDbType.Char),
                                    new SqlParameter("@LogisticsPlaceID",SqlDbType.Char),
                                    new SqlParameter("@DeliveryWayID",SqlDbType.Char),
                                    new SqlParameter("@ClassID",SqlDbType.Char),
                                    new SqlParameter("@CarTimesDate",SqlDbType.Char),
                                    new SqlParameter("@SendCarState",SqlDbType.Char),
                               };
             SQL[0].Value = "SelectSendCarState";
             SQL[1].Value =intAttributeDetailedName ;
             SQL[2].Value = intLogisticsPlaceID ;
             SQL[3].Value =intDeliveryWayID  ;
             SQL[4].Value =intClassID  ;
             SQL[5].Value =strCarTimesDate  ;
             SQL[6].Value = intSendCarState;
            DataTable dt = myDALMethod.DAL_SelectDB_Par("CarTimesSelectAndDriver", SQL);
            return dt;
        
        }
//     --查询派车信息进行判断
        public DataTable SelectJudge(int DeliveryWayID, int LogisticsPlaceID, string CarTimesDate, int ClassesID, string CarTimes)
        {
            SqlParameter[] SQL ={
                                  new SqlParameter("@type",SqlDbType.Char),
                                    new SqlParameter("@DeliveryWayID",SqlDbType.Int),
                                    new SqlParameter("@LogisticsPlaceID",SqlDbType.Int),
                                    new SqlParameter("@CarTimesDate",SqlDbType.Char),
                                    new SqlParameter("@ClassesID",SqlDbType.Int),
                                    new SqlParameter("@CarTimes",SqlDbType.Char),
                                 };
            SQL[0].Value = "SelectJudge";
            SQL[1].Value = DeliveryWayID;
            SQL[2].Value = LogisticsPlaceID;
            SQL[3].Value = CarTimesDate;
            SQL[4].Value = ClassesID;
            SQL[5].Value = CarTimes;
             DataTable dt = myDALMethod.DAL_SelectDB_Par("CarTimesSelectAndDriver", SQL);
            return dt;
        }
  // --修改车辆状态      
       public int updateSpecialSendCarState(int intMX_DeliveryCarTimesServiceID)
       {
           SqlParameter[] SQL ={
                                  new SqlParameter("@type",SqlDbType.Char),
                                  new SqlParameter("@MX_DeliveryCarTimesServiceID",SqlDbType.Int),
                                  new SqlParameter("@SendCarTime",SqlDbType.DateTime),
                                                 };
           DateTime time = DateTime.Now;
           SQL[0].Value = "updateSpecialSendCarState";
           SQL[1].Value = intMX_DeliveryCarTimesServiceID;
           SQL[2].Value = time;
            int i = myDALMethod.DAL_OPTableDB_Par("SendCar", SQL);
           return i;
       } 
  //查询属性明细
        public DataTable SelectAttributeGather(int AttributeGatherID)
        {
            SqlParameter[] SQL ={
                                  new SqlParameter("@type",SqlDbType.Char),
                                  new SqlParameter("@AttributeGatherID",SqlDbType.Int),
                              };
            SQL[0].Value = "ShuXingMingXi";
            SQL[1].Value = AttributeGatherID;
            DataTable dt = myDALMethod.DAL_SelectDB_Par("DeliveryFeild", SQL);
            return dt;
        }


 

//下面是存储过程的代码:

--模糊查询派车状态
if @type='SelectSendCarState'
begin
      declare @sql varchar(1000)
      if @AttributeDetailedName!=0
      begin
           set @sql=' where DeliveryCarTimesServiceList.SXMX_AttributeID='''+LTRIM(RTRIM(@AttributeDetailedName))+'''' 
      end
      if @LogisticsPlaceID !=0
      begin 
            if @sql !=''
                set @sql=@sql+' and DeliveryCarTimesServiceList.LogisticsPlaceID='''+LTRIM(RTRIM(@LogisticsPlaceID))+'''' 
                else set @sql=' where DeliveryCarTimesServiceList.LogisticsPlaceID='''+LTRIM(RTRIM(@LogisticsPlaceID))+''''
      end
       if @DeliveryWayID!=0
       begin
            if @sql !=''
                set @sql=@sql+' and DeliveryCarTimesServiceList.DeliveryWayID='''+LTRIM(RTRIM(@DeliveryWayID))+'''' 
                else set @sql=' where DeliveryCarTimesServiceList.DeliveryWayID='''+LTRIM(RTRIM(@DeliveryWayID))+''''
      end
      if @ClassID!=0
      begin
            if @sql !=''
                set @sql=@sql+' and DeliveryCarTimesServiceList.ClassesID='''+LTRIM(RTRIM(@ClassID))+'''' 
                else set @sql=' where DeliveryCarTimesServiceList.ClassesID='''+LTRIM(RTRIM(@ClassID))+''''
      end
      if @CarTimesDate !=''
     
       begin
            if @sql !=''
                set @sql=@sql+' and DeliveryCarTimesServiceList.CarTimesDate  between '''+LTRIM(RTRIM(@CarTimesDate))+''''+' and '''+LTRIM(RTRIM(@CarTimesDate))+''''
                else set @sql=' where DeliveryCarTimesServiceList.CarTimesDate  between '''+LTRIM(RTRIM(@CarTimesDate))+''''+' and '''+LTRIM(RTRIM(@CarTimesDate))+''''
      end
       if @SendCarState!=0
      begin
            if @sql !=''
                set @sql=@sql+' and MX_DeliveryCarTimesServiceList.SendCarStateID='''+LTRIM(RTRIM(@SendCarState))+'''' 
                else set @sql=' where MX_DeliveryCarTimesServiceList.SendCarStateID='''+LTRIM(RTRIM(@SendCarState))+''''
      end
       
 exec('SELECT     DeliveryCarTimesServiceList.DeliveryCarTimesServiceID, MX_DeliveryCarTimesServiceList.CarTimes, MX_DeliveryCarTimesServiceList.ServiceField, 
                      RTRIM(MX_AttributeDetailedList.AttributeDetailedName) AS AttributeDetailedName, DeliveryCarTimesServiceList.DeliveryWayID, MX_AttributeDetailedList_3.AttributeDetailedName AS DeliveryWay, 
                      MX_AttributeDetailedList_2.AttributeDetailedName AS PeiSongAttribute, LogisticsPlaceList.LogisticsPlaceName, CONVERT(varchar(20), DeliveryCarTimesServiceList.CarTimesDate, 120) 
                      AS CarTimesDate, DeliveryCarTimesServiceList.LogisticsPlaceID, DeliveryCarTimesServiceList.SXMX_AttributeID, MX_AttributeDetailedList_1.AttributeDetailedName AS Classes, 
                      DeliveryCarTimesServiceList.ClassesID, MX_DeliveryCarTimesServiceList.SendCarStateID, CONVERT(varchar(20),MX_DeliveryCarTimesServiceList.FactDrawOutTime,120)as FactDrawOutTime, 
                      CONVERT(varchar(20),MX_DeliveryCarTimesServiceList.FactReturnCarTime,120)as FactReturnCarTime, CONVERT(varchar(20), MX_DeliveryCarTimesServiceList.SendCarTime, 120) AS SendCarTime, CONVERT(varchar(20), 
                      MX_DeliveryCarTimesServiceList.PredictDrawOutTime, 120) AS PredictDrawOutTime, CONVERT(varchar(20), MX_DeliveryCarTimesServiceList.ReceiptsStopTime, 120) AS ReceiptsStopTime
FROM         MX_DeliveryCarTimesServiceList INNER JOIN
                      DeliveryCarTimesServiceList ON MX_DeliveryCarTimesServiceList.DeliveryCarTimeServiceID = DeliveryCarTimesServiceList.DeliveryCarTimesServiceID INNER JOIN
                      MX_AttributeDetailedList ON MX_DeliveryCarTimesServiceList.SendCarStateID = MX_AttributeDetailedList.MX_AttributeDetailedID INNER JOIN
                      MX_AttributeDetailedList AS MX_AttributeDetailedList_3 ON DeliveryCarTimesServiceList.DeliveryWayID = MX_AttributeDetailedList_3.MX_AttributeDetailedID INNER JOIN
                      MX_AttributeDetailedList AS MX_AttributeDetailedList_2 ON DeliveryCarTimesServiceList.SXMX_AttributeID = MX_AttributeDetailedList_2.MX_AttributeDetailedID INNER JOIN
                      LogisticsPlaceList ON DeliveryCarTimesServiceList.LogisticsPlaceID = LogisticsPlaceList.LogisticsPlaceID INNER JOIN
                      MX_AttributeDetailedList AS MX_AttributeDetailedList_1 ON DeliveryCarTimesServiceList.ClassesID = MX_AttributeDetailedList_1.MX_AttributeDetailedID            
                                '+@sql)            
                      end
  --查询派车信息进行判断
   if @type='SelectJudge'
   begin
    if @ClassesID!=0
    set @sql=' where DeliveryCarTimesServiceList.DeliveryWayID='''+LTRIM(RTRIM(@DeliveryWayID))+''''+
           ' and DeliveryCarTimesServiceList.LogisticsPlaceID='''+LTRIM(RTRIM(@LogisticsPlaceID))+''''+
           ' and DeliveryCarTimesServiceList.CarTimesDate between '''+LTRIM(RTRIM(@CarTimesDate))+''''+' and '''+LTRIM(RTRIM(@CarTimesDate))+''''+
          ' and DeliveryCarTimesServiceList.ClassesID='''+LTRIM(RTRIM(@ClassesID))+''''
      else  set @sql=' where DeliveryCarTimesServiceList.DeliveryWayID='''+LTRIM(RTRIM(@DeliveryWayID))+''''+
           ' and DeliveryCarTimesServiceList.LogisticsPlaceID='''+LTRIM(RTRIM(@LogisticsPlaceID))+''''+
           ' and DeliveryCarTimesServiceList.CarTimesDate between '''+LTRIM(RTRIM(@CarTimesDate))+''''+' and '''+LTRIM(RTRIM(@CarTimesDate))+''''+
          ' and MX_DeliveryCarTimesServiceList.CarTimes='''+LTRIM(RTRIM(@CarTimes))+''''
   exec(' SELECT     MX_DeliveryCarTimesServiceList.DeliveryCarTimeServiceID, DeliveryCarTimesServiceList.DeliveryWayID, DeliveryCarTimesServiceList.LogisticsPlaceID, 
                      DeliveryCarTimesServiceList.CarTimesDate, MX_DeliveryCarTimesServiceList.CarTimes, DeliveryCarTimesServiceList.ClassesID, 
                      MX_DeliveryCarTimesServiceList.MX_DeliveryCarTimesServiceID
         FROM         MX_DeliveryCarTimesServiceList INNER JOIN
                      DeliveryCarTimesServiceList ON MX_DeliveryCarTimesServiceList.DeliveryCarTimeServiceID = DeliveryCarTimesServiceList.DeliveryCarTimesServiceID
  '+@sql)
  end
--修改车辆状态     
  if @type='updateSpecialSendCarState'
  begin
  update  MX_DeliveryCarTimesServiceList set SendCarStateID=47,SendCarTime=@SendCarTime
  where MX_DeliveryCarTimesServiceID=@MX_DeliveryCarTimesServiceID
  end
--查询属性明细
  if @type='ShuXingMingXi'
  begin
   SELECT    RTRIM(MX_AttributeDetailedID)as MX_AttributeDetailedID, RTRIM(AttributeDetailedName)as AttributeDetailedName , AttributeGatherID
FROM         MX_AttributeDetailedList
   where  MX_AttributeDetailedList.AttributeGatherID=@AttributeGatherID
  end


仅供学习,禁止商业用途

 

 

 

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值