Explorar o código

在线测试修改u9手动同步信息bug

longyi hai 5 meses
pai
achega
6014d245e2

+ 20 - 2
core/CoreApp/controllers/Apipf.php

@@ -76,7 +76,7 @@ class Apipf extends Start_Controller{
        if($api != $this->api){
             die("No data to be executed");
        }
-       $list = $this->customer->find_all("more_three = 1","id,shop,source,name,email,phone,money,num,country,province,city,street,address,address2,zipcode",'id asc',0,200);
+       $list = $this->customer->find_all("more_three = 1","id,shop,source,name,email,phone,money,num,country,province,city,street,address,address2,zipcode",'id asc',0,100);
        //$list = $this->customer->find_all("id = 71015","id,shop,source,name,email,phone,money,num,country,province,city,street,address,address2,zipcode",'id asc',0,100);
        if(empty($list)){
            die("This is a request without data");  
@@ -104,6 +104,7 @@ class Apipf extends Start_Controller{
             ];
        }
       
+      
        if(empty($send_list)){
           die("There is no customer data to be synchronized");  
        }
@@ -122,11 +123,20 @@ class Apipf extends Start_Controller{
                 ],$item['customer_id']);
                continue;
            }
+           if($item['brand'] == 'other'){
+                $this->customer->save([
+                    'more_three'=>3,
+                    'is_tb'=>1,
+                ],$item['customer_id']);
+               continue;
+           }
            $data[] = $item; 
            $customer_ids[] = $item['customer_id'];
        }
+       
        var_dump(json_encode($customer_ids));
-       //var_dump($data);
+    //   var_dump($data);
+    //   die;
        if(empty($data)){
             return ;
        }
@@ -193,8 +203,16 @@ class Apipf extends Start_Controller{
                 ],$item['customer_id']);
                continue;
            }
+           if($item['brand'] == 'other'){
+                $this->customer->save([
+                    'is_tb'=>1,
+                ],$item['customer_id']);
+               continue;
+           }
            $data[] = $item; 
            $customer_ids[] = $item['customer_id'];
+           
+           
        }
        var_dump(json_encode($customer_ids));
        var_dump($data);

+ 1 - 1
core/CoreApp/controllers/Systemfout.php

@@ -632,7 +632,7 @@ class Systemfout extends Start_Controller {
             
         	
         	//$this->logic_ding->sendToDing("检测订单".$y['number']."称重".$numweight."快递公司".$y['express']."-".$weight."[".$numweight."]");
-			if(!in_array($y['express'],[2,39,43,44,45,47,48,49,55,61,63,64,65])){
+			if(!in_array($y['express'],[2,8,39,43,44,45,47,48,49,55,61,63,64,65])){
 				if($weight == '' || $numweight < '0.1' || !is_numeric($numweight))
 				{
 					echo json_encode(array('msg'=>'此单需要称重!','success'=>false));exit;

+ 27 - 23
core/CoreApp/controllers/Zzququeu9.php

@@ -114,31 +114,35 @@ class Zzququeu9 extends Start_Controller {
                     if($v['dc_status'] == 0){
                          $dc_no = "<span  data-action='dc' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建调出单</span>";
                     }elseif($v['dc_status'] == -1){
+                        $tmp_str = "异常信息";
                          $error = $this->zzququeu9_logs->find_all("oid = ".$v['id']." and one_type = 1 and two_type = 1 ","*",'id desc',0,1);
-                         if($error[0]['apply_api']=='lpck'){
-                             $ret_data = json_decode($error[0]['ret_data'],true);
-                             $apply_data = json_decode($error[0]['apply_data'],true);
-                             if(isset($ret_data["ResMsg"])){
-                                   if(empty($apply_data['0'])){
-                                        $tmp_str = $ret_data["ResMsg"];
-                                   }else{
-                                        $tmp_str = $ret_data["ResMsg"]."【". $apply_data[0]['EntityCode']."】";
-                                   }
-                                   
-                             }else{
-                                   $tmp_str = "料品同步失败";
-                             }
-                         }else{
-
-                              $ret_data = json_decode($error[0]['ret_data'],true);
-                              if(isset($ret_data[0]["ResMsg"])){
-                                    $tmp_str = $ret_data[0]["ResMsg"];
-                              }elseif(isset($ret_data['msg'])){
-                                   $tmp_str = $ret_data['msg'];
-                              }else{
-                                    $tmp_str = "料品同步失败";
-                              }
+                         if(isset($error[0])){
+                                if($error[0]['apply_api']=='lpck'){
+                                     $ret_data = json_decode($error[0]['ret_data'],true);
+                                     $apply_data = json_decode($error[0]['apply_data'],true);
+                                     if(isset($ret_data["ResMsg"])){
+                                           if(empty($apply_data['0'])){
+                                                $tmp_str = $ret_data["ResMsg"];
+                                           }else{
+                                                $tmp_str = $ret_data["ResMsg"]."【". $apply_data[0]['EntityCode']."】";
+                                           }
+                                           
+                                     }else{
+                                           $tmp_str = "料品同步失败";
+                                     }
+                                 }else{
+        
+                                      $ret_data = json_decode($error[0]['ret_data'],true);
+                                      if(isset($ret_data[0]["ResMsg"])){
+                                            $tmp_str = $ret_data[0]["ResMsg"];
+                                      }elseif(isset($ret_data['msg'])){
+                                           $tmp_str = $ret_data['msg'];
+                                      }else{
+                                            $tmp_str = "料品同步失败";
+                                      }
+                                 }
                          }
+                        
                          $dc_no = "<span data-action='dc' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建调出单</span>".'<p style="color:blue"><i  class="method fa fa-exclamation-circle" data-t="'.$tmp_str.'"></i><p>';
                     }
                     if(!empty($v['dc_no'])){

+ 31 - 11
core/CoreApp/models/Model_logic_u9xgsd.php

@@ -97,7 +97,7 @@ class Model_logic_u9xgsd extends Lin_Model {
        }
        $shipremarks =  $info['shipremarks'];
        if(mb_strlen($shipremarks) > 960){
-            $shipremarks = substr($shipremarks, 0, 950);
+            $shipremarks = mb_substr($shipremarks, 0, 950);
             $shipremarks .= "...";
         }
        $dc_params = [
@@ -178,10 +178,10 @@ class Model_logic_u9xgsd extends Lin_Model {
             $this->editData($info['zq_u9_id'],['dc_status'=>-1,'update_time'=>time()],$info['number'],1,1,'lpck',$r['msg'][1],$r['msg'][0]);
             return $this->logic_tools->ret_arr(-1,"同步料品失败");
       }
-    
+      
        //创建调出单
        $dcd_res = $this->apiyyv1->dcdCrate($dc_params,$this->getToken(130));
-    
+      
        if(empty($dcd_res[0]['Data'][0]["Code"])){
             $this->editData($info['zq_u9_id'],['dc_status'=>-1,'update_time'=>time()],$info['number'],1,1,'dc',$dcd_res[1],$dcd_res[0]);
             return $this->logic_tools->ret_arr(-1,"创建调出单失败");
@@ -528,7 +528,6 @@ class Model_logic_u9xgsd extends Lin_Model {
     }
     //将许昌仓的料品同步到香港仓
     public function tbXgLp($tb_info){
-
         $this->cxLp($tb_info);
         //先检测料品是否存在
 
@@ -541,14 +540,35 @@ class Model_logic_u9xgsd extends Lin_Model {
         }
     }
     public function cxLp($tb_info){
-        $rr = $this->apiyyv1->cxLp($tb_info,$this->getToken(130));
-        echo "<pre>";
-        var_dump($rr);
-        die;
+        $apply_list = $tb_info['list'];
+    
+        $rr = $this->apiyyv1->cxLp($apply_list,$this->getToken(130));
+        foreach($rr[0]['Data'] as $v){
+            foreach($apply_list as $kk=>$vv){
+                if($v['m_code'] == $vv['jm']){
+                    $apply_list[$kk]['is_register'] = 1;
+                }
+            }
+        }
+        //找出未添加的数组 然后执行去添加
+        $goods_unadd  = [];
+        foreach($apply_list as $v){
+            if($v['is_register']  == 0){
+                $goods_unadd[] = $v; 
+            }
+        }
+        if(empty($goods_unadd)){
+            return ;
+        }
+        $tmp_info = $tb_info;
+        $tmp_info['list'] = $goods_unadd;
+        //m_code
+        $this->addLp($tmp_info);
+        usleep(100);
     }
 
-    public function addLp(){
-
+    public function addLp($info){
+       $this->apiyyv1->cjLp($info,$this->getToken(130)); 
     }
     //根据返回的状态修改对应的值
     protected function editData($zq_u9_id,$z_qu_arr,$number,$one_type,$two_type,$apply_api,$apply_data,$ret_data){
@@ -628,7 +648,7 @@ class Model_logic_u9xgsd extends Lin_Model {
         }
         $time = time();
         if(mb_strlen($shipremarks) > 960){
-            $shipremarks = substr($shipremarks, 0, 950);
+            $shipremarks = mb_substr($shipremarks, 0, 950);
             $shipremarks .= "...";
         }
         $dc_params = [