Ver código fonte

Merge branch 'zengjun' of ssh://was.baoshi56.com:10022/var/git/bswas

LD 5 anos atrás
pai
commit
3a69d88d90

+ 54 - 1
app/Http/Controllers/api/thirdPart/weight/WeightBaseController.php

@@ -14,6 +14,7 @@ use App\Services\OrderService;
 use Carbon\Carbon;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Http\Request;
+use Illuminate\Http\Response;
 
 class WeightBaseController
 {
@@ -161,7 +162,7 @@ class WeightBaseController
     // 重量
     public function  getWeightValue($params)
     {
-        return $this->getValue($this->width, $params);
+        return $this->getValue($this->weight, $params);
     }
 
     // 高
@@ -346,4 +347,56 @@ class WeightBaseController
         return $orderPackage->save();
     }
 // endregion
+
+// region ---上传快递单号处理
+
+    /**
+     * 快递单号处理
+     *
+     * @param $code
+     * @return string
+     */
+    public function processCode($code): string
+    {
+        /** 如果是$code 是数组处理 */
+        if(is_array($code)){
+            return $this->processCodeArr($code);
+        }
+        return $this->processCodeStr($code);
+    }
+
+    /**
+     *  快递单号 array 处理
+     *
+     * @param array $code
+     * @return mixed|string
+     */
+    public function processCodeArr(array $code): string
+    {
+        usort($code,function($codeA,$codeB){
+            if(strlen($codeA) == strlen($codeB))return 0;
+            return strlen($codeA) > strlen($codeB) ? 1 : -1;
+        });
+        return $code[0];
+    }
+
+    /**
+     * 快递单号 string 处理
+     *
+     * @param $code
+     * @return string
+     */
+    public function processCodeStr($code): string
+    {
+        $codes =  preg_split('/[,,@ ]+/is',$code);
+
+        foreach ($codes as $item) {
+            if(mb_strpos($item,'-'))continue;
+            if(strlen(trim($item,' ')) < 5)continue;
+            return $item;
+        }
+        return '';
+    }
+
+// endregion
 }

+ 1 - 1
resources/views/personnel/menu.blade.php

@@ -6,7 +6,7 @@
                 <li class="nav-item">
                     <a target="personnel/laborReport" class="nav-link" href="{{url('personnel/laborReport')}}" :class="{active:isActive('laborReport',2)}">临时工报表</a>
                 </li> @endcan
-            @can('装卸队')
+            @can('人事管理-卸货')
                 <li class="nav-item">
                     <a target="personnel/discharge" class="nav-link" href="{{url('personnel/discharge/task/index')}}" :class="{active:isActive('discharge',2)}">卸货</a>
                 </li>@endcan