Bläddra i källkod

修改cbt的打印方式

lvhao 18 timmar sedan
förälder
incheckning
2d56e2771c

+ 47 - 2
core/CoreApp/controllers/QueueOne.php

@@ -9,6 +9,7 @@ class QueueOne extends Start_Controller {
         $this->load->_model("Model_logic_crm",'logic_crm');
         $this->load->_model("Model_logic_crm",'logic_crm');
         $this->load->_model("Model_logic_u9action",'logic_u9action')   ;
         $this->load->_model("Model_logic_u9action",'logic_u9action')   ;
         $this->load->_model("Model_logic_u9bh",'logic_u9bh');
         $this->load->_model("Model_logic_u9bh",'logic_u9bh');
+        $this->load->_model("Model_waybilldowns","waybilldowns");
 	}
 	}
     private $ip = ['127.0.0.1','47.105.156.18'];
     private $ip = ['127.0.0.1','47.105.156.18'];
     //定义方法的调用规则 获取URI第二段值
     //定义方法的调用规则 获取URI第二段值
@@ -23,9 +24,53 @@ class QueueOne extends Start_Controller {
    
    
     private function _u9action(){
     private function _u9action(){
             $this->logic_u9action->waixiao();
             $this->logic_u9action->waixiao();
-            echo "执行了u9外销";
+            var_dump("执行了u9外销");
             $this->logic_u9bh->doAction();
             $this->logic_u9bh->doAction();
-            echo "执行了u9备货";
+            var_dump("执行了u9备货");
+            $this->_downloadWaybill();
+            var_dump("执行了下载图片");
+    }
+
+    //定时执行下载图片 
+    private function _downloadWaybill(){
+        $list = $this->waybilldowns->find_all("status = 0","*",'id asc',0,250);
+       
+        foreach($list as $k => $v){
+            $this->_pdfurl($v['url'], $v['pdf_name'], $v['date_dir']);
+            $this->waybilldowns->save([
+                'status'=>1,
+                'do_time'=>time()
+            ],$v['id']);
+        }
     }
     }
    
    
+
+    private function _pdfurl($pdf, $title, $bctime)
+	{
+		$pdf_path = './data/pdf/' . $bctime . '/';
+		
+		// 创建目录(如果不存在)
+		if (!is_dir($pdf_path)) {
+			mkdir($pdf_path, 0777, true);  // 第三个参数 true 可以递归创建目录
+		}
+		
+		// 获取PDF内容
+		$pdf_content = file_get_contents($pdf);
+		
+		// 保存文件
+		file_put_contents($pdf_path . $title . '.pdf', $pdf_content);
+		$size = filesize($pdf_path . $title . '.pdf');
+		if($size > 0){
+			
+		}else{
+			sleep(1);
+			// 获取PDF内容
+			$pdf_content = file_get_contents($pdf);
+			// 保存文件
+			file_put_contents($pdf_path . $title . '.pdf', $pdf_content);
+		}
+		return $bctime;
+		
+		
+	}
 }
 }

+ 15 - 2
core/CoreApp/controllers/Systemprint.php

@@ -56,6 +56,7 @@ class Systemprint extends Start_Controller {
 		$this->load->_model("Model_itsxb","itsxb");
 		$this->load->_model("Model_itsxb","itsxb");
 		$this->load->_model("Model_express_tt","express_tt");
 		$this->load->_model("Model_express_tt","express_tt");
 		$this->load->_model("Model_logic_u9tools","logic_u9tools");
 		$this->load->_model("Model_logic_u9tools","logic_u9tools");
+		$this->load->_model("Model_waybilldowns","waybilldowns");
 	}
 	}
 	//定义方法的调用规则 获取URI第二段值
 	//定义方法的调用规则 获取URI第二段值
     public function _remap($arg,$arg_array)
     public function _remap($arg,$arg_array)
@@ -1794,7 +1795,18 @@ class Systemprint extends Start_Controller {
 					{
 					{
 						$bctime = date('Ymd',$time);
 						$bctime = date('Ymd',$time);
 						$Hwaybill = $barcode['waybill'];
 						$Hwaybill = $barcode['waybill'];
-						$Hyd = $this->_pdfurl($barcode['label'],'y-'.$Hwaybill,$bctime);
+						//$Hyd = $this->_pdfurl($barcode['label'],'y-'.$Hwaybill,$bctime);
+
+						$this->waybilldowns->insert([
+							'date_dir'=>$bctime,
+							'pdf_name'=>'y-'.$Hwaybill,
+							'url'=>$barcode['label'],
+							'waybill'=>$Hwaybill,
+							'number'=>$fullorder['number'],
+							'status'=>0,
+							'create_time'=>time(),
+						]);
+
 						//$Hfp = $this->_pdfurl($barcode['fp'],'f-'.$Hwaybill,$bctime);//保留PDF,不需要打印
 						//$Hfp = $this->_pdfurl($barcode['fp'],'f-'.$Hwaybill,$bctime);//保留PDF,不需要打印
 						if(isset($barcode['label']) && isset($Hwaybill))
 						if(isset($barcode['label']) && isset($Hwaybill))
 						{
 						{
@@ -1812,7 +1824,8 @@ class Systemprint extends Start_Controller {
 				   		 	{
 				   		 	{
 								$type = 1;
 								$type = 1;
 								$pdfnum = 1;
 								$pdfnum = 1;
-								$text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>$pdf_width_model);
+								//$text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>$pdf_width_model);
+								$text = array('yd'=>$barcode['label'],'mode'=>$pdf_width_model);
 							}
 							}
 						}
 						}
 					}
 					}

+ 11 - 0
core/CoreApp/models/Model_waybilldowns.php

@@ -0,0 +1,11 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 
+class Model_waybilldowns extends Lin_Model 
+{
+	function __construct(){
+        parent::__construct();
+        $this->load->database();
+        $this->table = 'waybilldowns';
+        $this->load_table('waybilldowns');
+    }
+    
+}