瀏覽代碼

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

 Conflicts:
	app/Http/Controllers/TestController.php
LD 5 年之前
父節點
當前提交
992c2eb36c

+ 1 - 0
app/Filters/DemandFilters.php

@@ -52,6 +52,7 @@ class DemandFilters
     public function before()
     {
         $user = Auth::user();
+        if(!isset($user))return;
         if($user->isSuperAdmin()){
             return;
         }

+ 3 - 1
app/Http/Controllers/AuthorityController.php

@@ -169,8 +169,10 @@ class AuthorityController extends Controller
     {
         /** @var User $user */
         $user = Auth::user();
+        if($user && $user->isSuperAdmin()){
+            $this->success( Authority::query()->orderBy('name')->get());
+        }
         $authority = $user->authorities();
-//        $authority = Authority::query()->orderBy('name')->get();
         $this->success($authority);
     }
 }

+ 16 - 0
app/Http/Controllers/DemandController.php

@@ -8,6 +8,7 @@ use App\Filters\DemandFilters;
 use App\Http\Requests\Demand\DemandRequest;
 use App\Services\DemandService;
 use App\UploadFile;
+use App\User;
 use Illuminate\Http\Request;
 use Illuminate\Contracts\Foundation\Application;
 use Illuminate\Contracts\View\Factory;
@@ -27,6 +28,8 @@ class DemandController extends Controller
     public function index(Request $request, DemandFilters $filters)
     {
         // 查询权限
+        $user = Auth::user();
+        if(!isset($user))return redirect('/');
 
         $demands = Demand::query()->with(['initiator', 'handle', 'uploadFile', 'processes.user'])->filter($filters)->orderByDesc('demands.id')->paginate($request['paginate'] ?? 50);
 
@@ -168,4 +171,17 @@ class DemandController extends Controller
         $this->error($result['message']);
     }
 
+    /**
+     * 未认领任务和未完成比例
+     *
+     * @param Request $request
+     * @param DemandService $demandService
+     */
+    public function getUnClaimDemandRatioApi(Request $request,DemandService $demandService)
+    {
+        /** @var User $user */
+        $user = Auth::user();
+        if($user && !$user->isSuperAdmin())$this->success(null);
+        $this->success($demandService->getUnClaimDemandRatio());
+    }
 }

+ 10 - 0
app/Http/Controllers/TestController.php

@@ -1401,4 +1401,14 @@ where purch.islower=1 and deliver.id>'.$id);
             $packageController->activityWaveNoProcessing($orderPackage);
         }
     }
+
+    public function testOrderTracking()
+    {
+        $orderNos =  ['SO210416004929'];
+        $service = app(OrderTrackingService::class);
+        $orderHeadService= app(OracleDOCOrderHeaderService::class);
+        $orderHeaders = $orderHeadService->getQuery()->whereIn('DOC_Order_Header.OrderNo',$orderNos)->get();
+        $service->updateByWmsOrderHeaders($orderHeaders);
+
+    }
 }

+ 11 - 0
app/Services/DemandService.php

@@ -102,4 +102,15 @@ class DemandService
         return ['success' => false, 'message' => '任务认领失败'];
     }
 
+    /**
+     * 获取问题中未认领和 未完成 的比例
+     * 未完成 = 未认领 + 未完成
+     * @return array
+     */
+    public function getUnClaimDemandRatio(): array
+    {
+        $unClaimDemandCount = Demand::query()->where('status',0)->count();
+        $unDoneDemandCount = Demand::query()->whereIn('status',[0,1])->count();
+        return ['unClaimCount' => $unClaimDemandCount,'ClaimCount' => $unDoneDemandCount];
+    }
 }

+ 3 - 1
resources/views/demand/_create.blade.php

@@ -13,9 +13,11 @@
                 <a href={{url('demand/')}} class="dropdown-item">问题列表</a>
             </div>
         </div>
+        <div v-if="ratio.ClaimCount" class="float-right position-absolute text-center" style="right: 50px;top:45px;width: 45px" >
+            <span  :class="ratio.unClaimCount !== 0 ? 'text-danger':'text-success' " class="text-bold">@{{ ratio.unClaimCount }} / @{{ ratio.ClaimCount }}</span>
+        </div>
     </div>
 
-
     <div class="modal" tabindex="-1" id="add-demand">
         <div class="modal-dialog modal-lg modal-dialog-centered">
             <div class="modal-content">

+ 23 - 2
resources/views/demand/_createjs.blade.php

@@ -7,14 +7,19 @@
             addDemand: {},
             authorities: [],
             authoritiesFilter: [],
-            demandErrors: {}
+            demandErrors: {},
+            ratio:{
+                unClaimCount:null,
+                ClaimCount:null,
+            }
         },
         created() {
             this.authoritiesFilter = JSON.parse(JSON.stringify(this.authorities));
             this.getAuthority();
+            this.setUnClaimDemandRatio();
         },
         mounted() {
-
+            // this.setUnClaimDemandRatio();
         },
         methods: {
             /** 筛选 */
@@ -82,6 +87,22 @@
                     window.tempTip.show(err);
                 });
             },
+            setUnClaimDemandRatio(){
+                console.log('setUnClaimDemandRatio');
+                let url = '{{url('apiLocal/demand/unClaimDemandRatio')}}';
+                window.axios.get(url).then(res=>{
+                    if(res.data.data){
+                        this.$set(this.ratio,'unClaimCount',res.data.data['unClaimCount']);
+                        this.$set(this.ratio,'ClaimCount',res.data.data['ClaimCount']);
+                        console.log(this.ratio);
+                        return;
+                    }
+                    this.$set(this.ratio,'unClaimCount',null);
+                    this.$set(this.ratio,'unDoneCount',null);
+                }).catch(error=>{
+
+                });
+            }
         }
     });
 </script>

+ 1 - 2
resources/views/demand/search/index.blade.php

@@ -36,6 +36,7 @@
                 selectDemand: null,
                 selectIndex: null,
                 imgs: [],
+
             },
             created() {
                 let that = this;
@@ -49,7 +50,6 @@
                 if (this.imgs && this.imgs.length > 0) {
                     window.addEventListener('scroll', this.lazy)
                 }
-                console.log(this.imgs);
                 $('#list').removeClass('d-none');
                 let data = [
                     [
@@ -168,7 +168,6 @@
                         this.uploadError = ['请选择上传文件'];
                         return;
                     }
-
                     let that = this;
                     window.axios.post(url, formData, {
                         'Content-Type': 'multipart/form-data'

+ 4 - 1
resources/views/layouts/app.blade.php

@@ -25,7 +25,10 @@
             @component('layouts.menu')@endcomponent
         </div>
     </nav>
-    @component('demand._create')@endcomponent
+
+    @auth()
+        @component('demand._create')@endcomponent
+    @endauth
     @yield('content')
     <hr>
 </div>

+ 1 - 0
routes/apiLocal.php

@@ -173,6 +173,7 @@ Route::group(['prefix'=>'demand'],function(){
     Route::delete('destroyFile','DemandController@destroyFileApi')->name('demand.destroyFileApi');
     Route::post('finish','DemandController@finishApi')->name('demand.finishApi');
     Route::post('claim','DemandController@claimApi')->name('demand.claimApi');
+    Route::get('unClaimDemandRatio','DemandController@getUnClaimDemandRatioApi')->name('demand.getUnClaimDemandRatioApi');
     Route::group(['prefix'=>'process'],function (){
         Route::post('store','DemandProcessController@storeApi')->name('demand.process.storeApi');
         Route::delete('destroy','DemandProcessController@destroyApi')->name('demand.process.destroyApi');