lvhao vor 19 Stunden
Ursprung
Commit
dbd2dc0514
2 geänderte Dateien mit 118 neuen und 347 gelöschten Zeilen
  1. 89 347
      core/CoreApp/controllers/Systembound.php
  2. 29 0
      template/erp/systembound.html

+ 89 - 347
core/CoreApp/controllers/Systembound.php

@@ -42,7 +42,9 @@ class Systembound extends Start_Controller {
         {
 			//一件导出惠城和GES的全部快递
              $this->_excelhc();
-        }
+        }else if($arg == 'zxdpdexcel'){
+			$this->_zxdpdexcel();
+		}
 		else
 		{
 			 $this->_index();
@@ -192,18 +194,32 @@ class Systembound extends Start_Controller {
 		    echo json_encode($rows);exit;
 		}
 	}
-	
-
-	public function _out_bak()
-	{
-		$post = $this->input->post(NULL, TRUE);
-		if(isset($post['number']))
+		
+	private function _zxdpdexcel(){
+		if(isset($_GET['fexcel']))  
 		{
-			$where = "gtime = '".date('Ymd',time())."'";
-			$number = $this->input->post('number',true);
-			$type = $this->input->post('type',true);
-			$express = $this->input->post('express',true);
-			if($_SESSION['api'])
+			$timetk = $this->input->get('timetk',true);
+			$timetj = $this->input->get('timetj',true);
+			$library = $this->input->get('library',true);
+			$type = $this->input->get('type',true);
+			$number = $this->input->get('number',true);
+			$waybill = $this->input->get('waybill',true);
+			$timetk = strtotime($timetk);
+			$timetj = strtotime($timetj);
+			$select_express = $this->input->get('select_express',true);
+			
+			$typename = "正鑫DPD";
+			$cx_arr = [78,79];
+
+			$ex_list = $this->express->find_all("id in (".implode(',',$cx_arr).")","id,servicename");
+			
+			$where = "type != 0 and express in (".implode(',',$cx_arr).")";
+			
+			if($timetk && $timetj)
+            {
+                $where  .= " and time > '$timetk' and time < '$timetj'";
+            }
+			if(isset($_SESSION['api']))
             {
 				if($type)
             	{
@@ -223,351 +239,77 @@ class Systembound extends Start_Controller {
 					$where  .= $uw;
 				}
             }
-			if(!$number)
-			{
-				echo json_encode(array('msg'=>'未扫入数据!','success'=>false));exit;
-			}
-			if(!$type)
-			{
-				echo json_encode(array('msg'=>'请选择需要录入数据的仓库!','success'=>false));exit;
-			}
-			if(!$express)
-			{
-				echo json_encode(array('msg'=>'请选择需要录入的快递!','success'=>false));exit;
-			}
-			$sex = $this->express->read($express);
-			if(stripos($number,'-') === false)
-			{
-				if(substr($number,0,3) == '788' && substr($number,-4,4) == '0430')//Fedex联邦
-				{
-					$number = substr($number,0,12);
-				}
-				if(strlen($number) == '34')//联邦杭州超长运单截取
-				{
-					$str  = substr($number, 0,3);
-					if($str == "420"){
-						$number = substr($number,12);
-					}else{
-						$number = substr($number,22,12);
-					}
-				}
-				
-				/**
-				$ex = array('DHL'=>10,'FEDEX'=>12,'FEDEXGF'=>12,'UPS'=>18,'GES'=>17,'TNT'=>9,'ARAMEX'=>11,'EMS_ZX_ZX_US'=>13);
-				if(isset($ex[$sex['printcode']]))
-				{
-					if(strlen($number) != $ex[$sex['printcode']])
-					{
-						echo json_encode(array('msg'=>'运单号错误,此单请重新录入运单号!','success'=>false));exit;
-					}
-				}
-				**/
-				if(strlen($number) == 12 && $sex['printcode'] != 'FEDEX' && $sex['printcode'] != 'FEDEXGF')
-				{
-					echo json_encode(array('msg'=>'运单号和快递类型不符!F','success'=>false));exit;
-				}
-				if(strlen($number) == 10 && $sex['printcode'] != 'DHL' && $sex['printcode'] != 'DHLUSA')
-				{
-					echo json_encode(array('msg'=>'运单号和快递类型不符!D','success'=>false));exit;
-				}
-				if(strlen($number) == 18 && $sex['printcode'] != 'UPS' && $sex['printcode'] != 'YunExpress')
-				{
-					echo json_encode(array('msg'=>'运单号和快递类型不符!U'.$sex['printcode'],'success'=>false));exit;
-				}
-				$yd = $this->fullorder->find_all("waybill = '$number' and library = '2' and librarytime > '".(time()-30*24*3600)."'");
-				if(isset($yd[0]['number']))
-				{
-					$number = $yd[0]['number'];
-					if($yd[0]['express'] != $express && $yd[0]['express'] != 31)
-					{
-						echo json_encode(array('msg'=>'录入信息和选择快递不一致!','success'=>false));exit;
-					}
-				}
-				else
-				{
-					$yd = $this->fullordersmt->find_all("waybill = '$number' and library = '2' and librarytime > '".(time()-30*24*3600)."'");
-					if(isset($yd[0]['number']))
-				    {
-					    $number = $yd[0]['number'];
-						if($yd[0]['express'] != $express && $yd[0]['express'] != 31)
-						{
-							echo json_encode(array('msg'=>'录入信息和选择快递不一致!','success'=>false));exit;
-						}
-				    }
-					else
-					{
-						$yd = $this->fullordertt->find_all("waybill = '$number' and library = '2' and librarytime > '".(time()-30*24*3600)."'");
-						if(isset($yd[0]['number']))
-				    	{
-					    	$number = $yd[0]['number'];
-							if($yd[0]['express'] != $express && $yd[0]['express'] != 31)
-							{
-								echo json_encode(array('msg'=>'录入信息和选择快递不一致!','success'=>false));exit;
-							}
-				    	}
-						else
-						{
-						    $yd = $this->fullorderamz->find_all("waybill = '$number' and library = '2' and librarytime > '".(time()-30*24*3600)."'");
-    						if(isset($yd[0]['number']))
-    				    	{
-    					    	$number = $yd[0]['number'];
-    							if($yd[0]['express'] != $express && $yd[0]['express'] != 31)
-    							{
-    								echo json_encode(array('msg'=>'录入信息和选择快递不一致!','success'=>false));exit;
-    							}
-    				    	}
-    						else
-    						{
-    						    $yd = $this->fullorderxw->find_all("waybill = '$number' and library = '2' and librarytime > '".(time()-30*24*3600)."'");
-    							if(isset($yd[0]['number']))
-    				    		{
-    					    		$number = $yd[0]['number'];
-    								if($yd[0]['express'] != $express && $yd[0]['express'] != 31)
-    								{
-    									echo json_encode(array('msg'=>'录入信息和选择快递不一致!','success'=>false));exit;
-    								}
-    				    		}
-    							else
-    							{
-    								echo json_encode(array('msg'=>'系统中未查到此运单,请确认!'.$number,'success'=>false));exit;
-    							}
-    						}
-						    
-    						    
-    							
-						}
-					}
-				}
-				/**
-				if($yd[0]['printtype'] != 1)
-				{
-					echo json_encode(array('msg'=>'请扫描正确的运单号!','success'=>false));exit;
-				}
-				**/
-				$nu = $this->outbound->get_number($number);
-			    if($nu)
-			    {
-				    echo json_encode(array('msg'=>'错误!此编号'.date('Ymd',$nu['time']).'已录入!','success'=>false));exit;
-			    }
-				if($this->outbound->insert(array('type'=>$type,'number'=>$number,'express'=>$express,'gtime'=>date('Ymd',time()),'time'=>time())))
-					{
-						$data = $this->outbound->find_count($where);
-						echo json_encode(array('msg'=>$data,'music'=>'1','success'=>true));exit;
-					}
-				else
-				{
-					echo json_encode(array('msg'=>'数据写入失败,请重试!','success'=>false));exit;
-				}
-			}
 			else
 			{
-				$dd = $this->fullorder->find_all("number = '$number' and library = '2' and librarytime > '".(time()-30*24*3600)."'");
-				if(isset($dd[0]['number']))
-				{
-					if($dd[0]['express'] != $express)
-					{
-						echo json_encode(array('msg'=>'录入信息和选择快递不一致!','success'=>false));exit;
-					}
-				}
-				else
-				{
-					$dd = $this->fullordersmt->find_all("number = '$number' and library = '2' and librarytime > '".(time()-30*24*3600)."'");
-					if(isset($dd[0]['number']))
-				    {
-					    $number = $dd[0]['number'];
-						if($dd[0]['express'] != $express)
-						{
-							echo json_encode(array('msg'=>'录入信息和选择快递不一致!','success'=>false));exit;
-						}
-				    }
-					else
-					{
-						$dd = $this->fullordertt->find_all("number = '$number' and library = '2' and librarytime > '".(time()-30*24*3600)."'");
-						if(isset($dd[0]['number']))
-				    	{
-					    	$number = $dd[0]['number'];
-							if($dd[0]['express'] != $express)
-							{
-								echo json_encode(array('msg'=>'录入信息和选择快递不一致!','success'=>false));exit;
-							}
-				    	}
-						else
-						{
-						    
-						    
-						    $dd = $this->fullorderamz->find_all("number = '$number' and library = '2' and librarytime > '".(time()-30*24*3600)."'");
-    						if(isset($dd[0]['number']))
-    				    	{
-    					    	$number = $dd[0]['number'];
-    							if($dd[0]['express'] != $express)
-    							{
-    								echo json_encode(array('msg'=>'录入信息和选择快递不一致!','success'=>false));exit;
-    							}
-    				    	}
-    						else
-    						{
-    						    $dd = $this->fullorderxw->find_all("number = '$number' and library = '2' and librarytime > '".(time()-30*24*3600)."'");
-    							if(isset($dd[0]['number']))
-    				    		{
-    					    		$number = $dd[0]['number'];
-    								if($dd[0]['express'] != $express)
-    								{
-    									echo json_encode(array('msg'=>'录入信息和选择快递不一致!','success'=>false));exit;
-    								}
-    				    		}
-    							else
-    							{
-    								echo json_encode(array('msg'=>'系统中未查到此编号,请确认!','success'=>false));exit;
-    							}
-    						}
-						    
-						    
-						    
-							
-						}
-					}
-				}
-				if($dd[0]['printtype'] != 2)
-				{
-					echo json_encode(array('msg'=>'请扫描正确的条码!','success'=>false));exit;
-				}
-				$nu = $this->outbound->get_number($number);
-			    if($nu)
-			    {
-				    echo json_encode(array('msg'=>'错误!此编号'.date('Ymd',$nu['time']).'已录入!','success'=>false));exit;
-			    }
-				if($this->outbound->insert(array('type'=>$type,'number'=>$number,'express'=>$express,'gtime'=>date('Ymd',time()),'time'=>time())))
-				{
-					$data = $this->outbound->find_count($where);
-					echo json_encode(array('msg'=>$data,'music'=>'1','success'=>true));exit;
-				}
-				else
-				{
-					echo json_encode(array('msg'=>'数据写入失败,请重试!','success'=>false));exit;
-				}
+				echo json_encode(array('msg'=>'导出失败,请重新登陆!','success'=>false));exit;
 			}
-			
-		}
-	}
-	
-	
-	public function _outxxxxxx()
-	{
-		$post = $this->input->post(NULL, TRUE);
-		if(isset($post['number']))
-		{
-			$where = "gtime = '".date('Ymd',time())."'";
-			$number = $this->input->post('number',true);
-			$id = $this->input->post('id',true);
-			$type = $this->input->post('type',true);
-			$express = $this->input->post('express',true);
-			if($id)
+			if($number)
             {
-				if($type)
-            	{
-                	$where  .= " and type = '$type'";
-           		}
-				else
-				{
-					$uw = '';
-				    $u = $this->user->get_api($id);
-				    $u['warehouse'] =  explode('|',trim($u['warehouse'],'|'));
-				    foreach ($u['warehouse'] as $v) 
-		            {
-					    $uw  .= " type = '$v' or";
-                    }
-				    $uw = rtrim($uw,'or');
-					$uw = " and (".ltrim($uw,' ').")";
-					$where  .= $uw;
-				}
+                $where  .= " and number = '$number'";
             }
-			if(!$number)
-			{
-				echo json_encode(array('msg'=>'未扫入数据!','success'=>false));exit;
-			}
-			if(!$type)
-			{
-				echo json_encode(array('msg'=>'请选择需要录入数据的仓库!','success'=>false));exit;
-			}
-			if(!$express)
-			{
-				echo json_encode(array('msg'=>'请选择需要录入的快递!','success'=>false));exit;
-			}
-			$nu = $this->outbound->get_number($number);
-			if($nu)
-			{
-				echo json_encode(array('msg'=>'错误!此编号'.date('Ymd',$nu['time']).'已录入!','success'=>false));exit;
-			}
-			$wa = $this->outbound->get_waybill($number);
-			if($wa)
-			{
-				echo json_encode(array('msg'=>'错误!此运单号'.date('Ymd',$wa['time']).'已录入!','success'=>false));exit;
+			if($waybill)
+            {
+                $where  .= " and waybill = '$waybill'";
+            }
+			
+			$data = array();
+			$datafy = array();
+			$j = 0;
+			$info_list = $this->outbound->find_all($where,'number,waybill,express','time asc');
+
+			$final_list= [
+
+			];
+			foreach($cx_arr as $v){
+				$final_list[$v] = [];
 			}
-			$jd = $this->outbound->find_all($where,'*','id desc');
-			if(!isset($jd[0]) || $jd[0]['waybill'] != '')
-			{
-				$pd = explode('-',$number);
-				if(!isset($pd[1]) || !isset($pd[2]))
-				{
-					echo json_encode(array('msg'=>'编号不正确,请重试!','success'=>false));exit;
-				}
-				if(strlen($pd[1]) == '5' && strlen($pd[2]) == '3')
-				{
-					if($this->outbound->insert(array('type'=>$type,'number'=>$number,'express'=>$express,'gtime'=>date('Ymd',time()),'time'=>time())))
-					{
-						$data = $this->outbound->find_count($where);
-						echo json_encode(array('msg'=>$data,'music'=>'1','success'=>true));exit;
-					}
-					else
-					{
-						echo json_encode(array('msg'=>'数据写入失败,请重试!','success'=>false));exit;
+			foreach ($info_list as $key=>$value)
+		    {
+				if(isset($final_list[$value['express']])){
+					$orderinfo = $this->logic_order->getInfo('number = "'.$value['number'].'"');
+					$weight = 0;
+					if(!empty($orderinfo)){
+						$weight = $orderinfo['weight'];
 					}
+					$final_list[$value['express']][] = [
+						$value['number'],
+						$value['waybill'],
+						$weight
+					];
 				}
-				else
-				{
-					echo json_encode(array('msg'=>'编号不正确!','success'=>false));exit;
-				}
+				
 			}
-			else
-			{
-				if(stripos($number,'-') !== false)
-				{
-					echo json_encode(array('msg'=>'请扫描'.$jd[0]['number'].'对应的运单号!','success'=>false));exit;
-				}
-				if(substr($number,0,3) == '788' && substr($number,-4,4) == '0430')//Fedex联邦
-				{
-					$number = substr($number,0,12);
-				}
-				if(strlen($number) == '34')//联邦杭州超长运单截取
-				{
-					$str  = substr($number, 0,3);
-					if($str == "420"){
-						$number = substr($number,12);
-					}else{
-						$number = substr($number,22,12);
-					}
-				}
-				$sex = $this->express->read($express);
-				$ex = array('DHL'=>10,'FEDEX'=>12,'FEDEXGF'=>12,'UPS'=>18,'GES'=>17,'TNT'=>9,'ARAMEX'=>11,'EMS_ZX_ZX_US'=>13);
-				if(isset($ex[$sex['printcode']]))
-				{
-					if(strlen($number) != $ex[$sex['printcode']])
-					{
-						echo json_encode(array('msg'=>'运单号错误,此单请重新录入运单号!','success'=>false));exit;
-					}
-				}
-				if($this->outbound->save(array('waybill'=>$number),$jd[0]['id']))
-				{
-					$data = $this->outbound->find_count($where);
-					echo json_encode(array('msg'=>$data,'music'=>'1','success'=>true));exit;
-				}
-				else
-				{
-					echo json_encode(array('msg'=>'数据写入失败,请重试!','success'=>false));exit;
-				}
+			$data[] = $datafy;
+			 //格式化数据
+			$i = 0;$cpexcel = array();
+
+            $title = date('Ymd',time()).$typename."发货统计信息"; $td = '';
+			$td = "";
+			$count = 0;
+			foreach($ex_list as $v){
+			    $num = count($final_list[$v['id']]);
+			    if($num > $count){
+			        $count = $num;
+			    }
+				$td .= "<td>".$v['servicename']."</td><td>总数(".$num.")</td><td>重量</td>";
 			}
-			
-		}
+			foreach($final_list as $k=>$v){
+			    for($i=0;$i < $count ;$i++){
+			        if(!isset($final_list[$k][$i])){
+			            $final_list[$k][$i] = [
+			                    " "," ",""
+			                ];
+			        }
+			    }
+			}
+            $titlename = "<table border=1>
+            <tr>
+            ".$td."
+            </tr>
+            </table>"; 
+            $filename = $title.".xls";
+            $this->excel->get_fz6($final_list,$titlename,$filename);
+	    }
 	}
 	
 	public function _excel()

+ 29 - 0
template/erp/systembound.html

@@ -55,6 +55,9 @@
 <li>
 <font class="cona dchc" style="background-color: #F80 !important;"  data-type="ozyt">导出云途(欧洲)计数</font>
 </li>
+<li>
+    <font class="cona dczxdpd" style="background-color: #F80 !important;"  data-type="zxdpd">导出正鑫DPD计数</font>
+ </li>
 </ul>
 <ul class="exdata"></ul>
 <table class="datatitle data" border="0" style="border-collapse:collapse;">
@@ -138,6 +141,32 @@ $(".dchc").click(function() {
     $("select[name=fexcel] option:eq(0)").prop('selected', 'selected');
 });
 
+$(".dczxdpd").click(function() {
+    let type = $(this).data("type");
+    var f = "select_express=" + type+"&";
+    $(".select").each(function() {
+        f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
+    });
+    $("input:text").each(function() {
+        f = f + $(this).attr("name") + "=" + $(this).val() + "&";
+    });
+    $("input:hidden").each(function() {
+        f = f + $(this).attr("name") + "=" + $(this).val() + "&";
+    });
+	if($("input[name=systembox]").length > 0)
+	{
+		if($("select[name='warehouse']").children("option:selected").val() == '')
+		{
+			 $(".ts p").text("请选择仓库!");
+        $(".ts").show();
+        setTimeout('$(".ts").fadeOut()', 800);
+		return false;
+		}
+	}
+    window.location.href = dataurl+"zxdpdexcel?fexcel=1&" + f;
+    $("select[name=fexcel] option:eq(0)").prop('selected', 'selected');
+});
+
 
 </script>
 <script type="text/javascript" src="{$theme}js/laydate.js"></script>