Browse Source

Merge branch 'master' into zzd

# Conflicts:
#	app/Services/LaborReportService.php
#	app/Services/OrderIssueService.php
#	app/Services/OrderService.php
#	routes/web.php
dream 5 years ago
parent
commit
2c8060b57e
47 changed files with 1536 additions and 847 deletions
  1. 46 9
      app/Http/Controllers/InventoryAccountController.php
  2. 3 0
      app/Http/Controllers/InventoryController.php
  3. 0 34
      app/Http/Controllers/OrderIssueProcessLogController.php
  4. 0 74
      app/Http/Controllers/OrderIssueTypeController.php
  5. 0 73
      app/Http/Controllers/OrderPackageCommoditiesController.php
  6. 0 73
      app/Http/Controllers/OrderPackageController.php
  7. 29 0
      app/Http/Controllers/OrderTrackingController.php
  8. 50 0
      app/Http/Controllers/OrderTrackingOwnerController.php
  9. 2 2
      app/Http/Controllers/RejectedBillController.php
  10. 3 4
      app/Http/Controllers/RejectedBillItemController.php
  11. 1 1
      app/Http/Controllers/RejectedController.php
  12. 9 8
      app/Imports/OrderIssueImport.php
  13. 80 1
      app/OrderIssue.php
  14. 26 0
      app/OrderTracking.php
  15. 18 0
      app/OrderTrackingOwner.php
  16. 4 0
      app/Owner.php
  17. 14 90
      app/RejectedBill.php
  18. 1 0
      app/RejectedBillItem.php
  19. 6 8
      app/Services/AllInventoryService.php
  20. 93 21
      app/Services/InventoryAccountService.php
  21. 15 1
      app/Services/InventoryCompareService.php
  22. 10 8
      app/Services/LaborReportService.php
  23. 26 0
      app/Services/LogService.php
  24. 76 143
      app/Services/OrderIssueService.php
  25. 9 67
      app/Services/OrderService.php
  26. 65 0
      app/Services/OrderTrackingService.php
  27. 1 1
      app/Services/RejectedService.php
  28. 5 5
      app/Services/WaveService.php
  29. 7 0
      config/sync,php.php
  30. 12 0
      database/factories/OrderTrackingFactory.php
  31. 12 0
      database/factories/OrderTrackingOwnerFactory.php
  32. 1 1
      database/migrations/2020_07_29_160826_create_order_issues_table.php
  33. 46 0
      database/migrations/2020_09_03_182051_create_order_trackings_table.php
  34. 33 0
      database/migrations/2020_09_04_091531_create_order_tracking_owners_table.php
  35. 32 0
      database/migrations/2020_09_04_093857_add_order_tracking_auth.php
  36. 16 0
      database/seeds/OrderTrackingOwnerSeeder.php
  37. 16 0
      database/seeds/OrderTrackingSeeder.php
  38. 2 2
      public/js/app.js
  39. 345 52
      resources/views/inventory/stockInventory/inventoryMission.blade.php
  40. 5 3
      resources/views/order/index/delivering.blade.php
  41. 8 3
      resources/views/order/issue/edit.blade.php
  42. 152 155
      resources/views/order/issue/index.blade.php
  43. 13 6
      resources/views/order/menu.blade.php
  44. 218 0
      resources/views/order/tracking/index.blade.php
  45. 14 0
      resources/views/order/tracking/menu.blade.php
  46. 1 1
      resources/views/order/wave/search.blade.php
  47. 11 1
      routes/apiLocal.php

+ 46 - 9
app/Http/Controllers/InventoryAccountController.php

@@ -92,7 +92,8 @@ class InventoryAccountController extends Controller
         $inventoryId=$request->input('inventoryId');
         $inventoryAccountMission=app('inventoryAccountService')->searchStockInventoryRecord($location,$barcode,$inventoryId);
         if (!$inventoryAccountMission)return ['success'=>false,'data'=>'参数错误!'];
-        return ['success'=>true,'data'=>$inventoryAccountMission];
+        $stockInventoryPersons=$inventoryAccountMission->stockInventoryPersons;
+        return ['success'=>true,'data'=>$inventoryAccountMission,'stockInventoryPersons'=>$stockInventoryPersons];
     }
 
     //盘点任务导出
@@ -171,10 +172,10 @@ class InventoryAccountController extends Controller
         return ['success'=>true,'data'=>'质量状态修改成功'];
 
     }
-    public function 盘点任务完结($id){
+    public function 完结盘点任务($id){
         if(!Gate::allows('库存管理-盘点-完结')){return['success'=>false,'status'=>'没有权限'];}
         if (!$id)return['success'=>false,'status'=>'参数错误!'];
-        $inventoryAccount=app('inventoryAccountService')->盘点任务完结($id);
+        $inventoryAccount=app('inventoryAccountService')->完结盘点任务($id);
         if (!$inventoryAccount)return['success'=>false,'status'=>'修改完结状态失败!'];
         return['success'=>true,'data'=>$inventoryAccount];
 
@@ -187,19 +188,55 @@ class InventoryAccountController extends Controller
         $count=$request->input('count');
         $inventoryAccountMission=app('inventoryAccountService')->增加系统之外的库位记录($location,$barcode,$inventoryId,$count);
         if (!$inventoryAccountMission)return ['success'=>false,'data'=>'添加系统之外的库位记录失败!'];
-        dd($inventoryAccountMission);
-        return ['success'=>true,'data'=>$inventoryAccountMission];
+        $inventoryAccountMission=InventoryAccountMission::with(['commodity.barcodes','stockInventoryPersons'])->where('id',$inventoryAccountMission->id)->first();
+        $stockInventoryPersons=$inventoryAccountMission->stockInventoryPersons;
+        return ['success'=>true,'inventoryAccountMission'=>$inventoryAccountMission,'stockInventoryPersons'=>$stockInventoryPersons];
+    }
+    public function 盘点选中任务(Request $request){
+        if(!Gate::allows('库存管理-盘点')){return['success'=>false,'data'=>'没有权限'];}
+        $id=$request->input('id');
+        $count=$request->count;
+        $inventoryId=$request->input('inventoryId');
+        $produced_at=$request->input('produced_at');
+        $valid_at=$request->input('valid_at');
+        $batch_number=$request->input('batch_number');
+        if (is_null($count)) return ['success'=>false,'data'=>'盘点数不能为空!'];
+        if ($produced_at||$valid_at||$batch_number){
+            /** @var InventoryAccountService $inventoryAccountMission */
+            $inventoryAccountService=app('inventoryAccountService');
+            $inventoryAccountMission=$inventoryAccountService ->盘点生产日期_失效日期_批号有改动任务($id,$count,$inventoryId,$produced_at,$valid_at,$batch_number);
+            if (!$inventoryAccountMission)return ['success'=>false,'data'=>'参数错误!'];
+            /** @var InventoryAccountService $inventoryService */
+            $inventoryService=app('inventoryAccountService');
+            $inventoryAccount=$inventoryService->updateInventory($inventoryId);
+            return ['success'=>true,'inventoryMission'=>$inventoryAccountMission,'inventory'=>$inventoryAccount];
+        }else{
+            /** @var InventoryAccountService $inventoryAccountMission */
+            $inventoryAccountService=app('inventoryAccountService');
+            $inventoryAccountMission=$inventoryAccountService ->盘点选中任务($id,$count,$inventoryId);
+            if (!$inventoryAccountMission)return ['success'=>false,'data'=>'参数错误!'];
+            /** @var InventoryAccountService $inventoryService */
+            $inventoryService=app('inventoryAccountService');
+            $inventoryAccount=$inventoryService->updateInventory($inventoryId);
+            $stockInventoryPersons=$inventoryAccountMission->stockInventoryPersons;
+            return ['success'=>true,'inventoryMission'=>$inventoryAccountMission,'inventory'=>$inventoryAccount,'stockInventoryPersons'=>$stockInventoryPersons];
+        }
+
+
+
+
     }
 
+
     public function 删除盘点记录(Request $request){
         if(!Gate::allows('库存管理-盘点-删除')){return['success'=>false,'data'=>'没有权限'];}
-        $inventoryAccountMissionId=$request->inventoryAccountMissionId;
-        $inventoryAccountId=$request->inventoryAccountId;
+        $inventoryAccountMissionId=$request->input('inventoryAccountMissionId');
+        $inventoryAccountId=$request->input('inventoryAccountId');
         if(is_null($inventoryAccountMissionId)){return ['success'=>false,'data'=>'传入id为空'];}
-        $inventoryAccountMission=InventoryAccountMission::where('id',$inventoryAccountMissionId)->delete();
+        $inventoryAccountMission=InventoryAccountMission::query()->where('id',$inventoryAccountMissionId)->delete();
         $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
         if ($inventoryAccountMission>0){
-            $inventoryAccount=InventoryAccount::where('id',$inventoryAccountId)->first();
+            $inventoryAccount=InventoryAccount::query()->find($inventoryAccountId);
             $inventoryAccount->total=$inventoryAccount->total-1;
             $inventoryAccount->processed=$inventoryAccount->getProcessedAmount();//已盘点数
             $inventoryAccount->difference=$inventoryAccount->getDifferenceAmount();//盘点差异数

+ 3 - 0
app/Http/Controllers/InventoryController.php

@@ -3,6 +3,7 @@
 namespace App\Http\Controllers;
 
 use App\OracleBasCustomer;
+use App\Services\AllInventoryService;
 use App\Services\InventoryService;
 use App\Services\OwnerService;
 use Exception;
@@ -15,6 +16,8 @@ class InventoryController extends Controller
     public function __construct()
     {
         app()->singleton('inventoryService',InventoryService::class);
+        app()->singleton('allInventoryService',AllInventoryService::class);
+
     }
     //动库报表
     public function changeInventory(Request $request){

+ 0 - 34
app/Http/Controllers/OrderIssueProcessLogController.php

@@ -10,40 +10,6 @@ use Illuminate\Support\Facades\Gate;
 class OrderIssueProcessLogController extends Controller
 {
 
-    public function index()
-    {
-        //
-    }
-
-    public function create()
-    {
-        //
-    }
-
-    public function store(Request $request)
-    {
-        //
-    }
-
-    public function show(OrderIssueProcessLog $orderIssueProcessLog)
-    {
-        //
-    }
-
-    public function edit(OrderIssueProcessLog $orderIssueProcessLog)
-    {
-        //
-    }
-
-    public function update(Request $request, OrderIssueProcessLog $orderIssueProcessLog)
-    {
-        //
-    }
-
-    public function destroy(OrderIssueProcessLog $orderIssueProcessLog)
-    {
-        //
-    }
 
     public function apiStore(Request $request)
     {

+ 0 - 74
app/Http/Controllers/OrderIssueTypeController.php

@@ -7,79 +7,5 @@ use Illuminate\Http\Request;
 
 class OrderIssueTypeController extends Controller
 {
-    /**
-     * Display a listing of the resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function index()
-    {
-        //
-    }
 
-    /**
-     * Show the form for creating a new resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function create()
-    {
-        //
-    }
-
-    /**
-     * Store a newly created resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @return \Illuminate\Http\Response
-     */
-    public function store(Request $request)
-    {
-        //
-    }
-
-    /**
-     * Display the specified resource.
-     *
-     * @param  \App\OrderIssueType  $orderIssueType
-     * @return \Illuminate\Http\Response
-     */
-    public function show(OrderIssueType $orderIssueType)
-    {
-        //
-    }
-
-    /**
-     * Show the form for editing the specified resource.
-     *
-     * @param  \App\OrderIssueType  $orderIssueType
-     * @return \Illuminate\Http\Response
-     */
-    public function edit(OrderIssueType $orderIssueType)
-    {
-        //
-    }
-
-    /**
-     * Update the specified resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  \App\OrderIssueType  $orderIssueType
-     * @return \Illuminate\Http\Response
-     */
-    public function update(Request $request, OrderIssueType $orderIssueType)
-    {
-        //
-    }
-
-    /**
-     * Remove the specified resource from storage.
-     *
-     * @param  \App\OrderIssueType  $orderIssueType
-     * @return \Illuminate\Http\Response
-     */
-    public function destroy(OrderIssueType $orderIssueType)
-    {
-        //
-    }
 }

+ 0 - 73
app/Http/Controllers/OrderPackageCommoditiesController.php

@@ -7,79 +7,6 @@ use Illuminate\Http\Request;
 
 class OrderPackageCommoditiesController extends Controller
 {
-    /**
-     * Display a listing of the resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function index()
-    {
-        //
-    }
 
-    /**
-     * Show the form for creating a new resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function create()
-    {
-        //
-    }
 
-    /**
-     * Store a newly created resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @return \Illuminate\Http\Response
-     */
-    public function store(Request $request)
-    {
-        //
-    }
-
-    /**
-     * Display the specified resource.
-     *
-     * @param  \App\OrderPackageCommodities  $orderPackageCommodities
-     * @return \Illuminate\Http\Response
-     */
-    public function show(OrderPackageCommodities $orderPackageCommodities)
-    {
-        //
-    }
-
-    /**
-     * Show the form for editing the specified resource.
-     *
-     * @param  \App\OrderPackageCommodities  $orderPackageCommodities
-     * @return \Illuminate\Http\Response
-     */
-    public function edit(OrderPackageCommodities $orderPackageCommodities)
-    {
-        //
-    }
-
-    /**
-     * Update the specified resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  \App\OrderPackageCommodities  $orderPackageCommodities
-     * @return \Illuminate\Http\Response
-     */
-    public function update(Request $request, OrderPackageCommodities $orderPackageCommodities)
-    {
-        //
-    }
-
-    /**
-     * Remove the specified resource from storage.
-     *
-     * @param  \App\OrderPackageCommodities  $orderPackageCommodities
-     * @return \Illuminate\Http\Response
-     */
-    public function destroy(OrderPackageCommodities $orderPackageCommodities)
-    {
-        //
-    }
 }

+ 0 - 73
app/Http/Controllers/OrderPackageController.php

@@ -7,79 +7,6 @@ use Illuminate\Http\Request;
 
 class OrderPackageController extends Controller
 {
-    /**
-     * Display a listing of the resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function index()
-    {
-        //
-    }
 
-    /**
-     * Show the form for creating a new resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function create()
-    {
-        //
-    }
 
-    /**
-     * Store a newly created resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @return \Illuminate\Http\Response
-     */
-    public function store(Request $request)
-    {
-        //
-    }
-
-    /**
-     * Display the specified resource.
-     *
-     * @param  \App\OrderPackage  $orderPackage
-     * @return \Illuminate\Http\Response
-     */
-    public function show(OrderPackage $orderPackage)
-    {
-        //
-    }
-
-    /**
-     * Show the form for editing the specified resource.
-     *
-     * @param  \App\OrderPackage  $orderPackage
-     * @return \Illuminate\Http\Response
-     */
-    public function edit(OrderPackage $orderPackage)
-    {
-        //
-    }
-
-    /**
-     * Update the specified resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  \App\OrderPackage  $orderPackage
-     * @return \Illuminate\Http\Response
-     */
-    public function update(Request $request, OrderPackage $orderPackage)
-    {
-        //
-    }
-
-    /**
-     * Remove the specified resource from storage.
-     *
-     * @param  \App\OrderPackage  $orderPackage
-     * @return \Illuminate\Http\Response
-     */
-    public function destroy(OrderPackage $orderPackage)
-    {
-        //
-    }
 }

+ 29 - 0
app/Http/Controllers/OrderTrackingController.php

@@ -0,0 +1,29 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\OrderTracking;
+use App\Owner;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Gate;
+
+class OrderTrackingController extends Controller
+{
+
+    public function index(Request $request)
+    {
+        if(!Gate::allows('订单管理-跟踪')){ return redirect(url('/'));  }
+        $owners = Owner::all();
+
+        return view('order.tracking.index',compact('owners'));
+    }
+
+
+    public function export(){
+
+    }
+
+    public function updateApi(Request $request){
+
+    }
+}

+ 50 - 0
app/Http/Controllers/OrderTrackingOwnerController.php

@@ -0,0 +1,50 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\OrderTrackingOwner;
+use App\Owner;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Gate;
+
+class OrderTrackingOwnerController extends Controller
+{
+
+    public function updateStatusApi(Request $request)
+    {
+        if (!Gate::allows('订单管理-跟踪-监听')) {
+            return ['success' => false, 'fail_info' => '权限不足'];
+        }
+        if($request->filled('owner_id') || $request->filled('status')){
+            return ['success' => false, 'fail_info' => '没有传入对应参数'];
+        }
+
+        $orderTrackingOwner = OrderTrackingOwner::query()
+            ->where(['owner_id' => $request->input('owner_id')])
+            ->first();
+        if (!$orderTrackingOwner ?? false) {
+            $success = $orderTrackingOwner->update(['status' => $request->input('status')]);
+            return ['success'=>$success] ;
+        }
+
+        $data = ['owner_id' => $request->input('owner_id'), 'status' => $request->input('status')];
+        $success =  $orderTrackingOwner = OrderTrackingOwner::query()->create($data);
+        return ['success' => $success];
+    }
+
+    public function getAllApi()
+    {
+        if (!Gate::allows('订单管理-跟踪-监听')) {
+            return ['success' => false, 'fail_info' => '权限不足'];
+        }
+        $user = Auth::user();
+        $owner_ids = $user ? $user->getPermittingOwnerIdsAttribute() : [];
+
+        return Owner::query()
+            ->with('orderTrackingOwner')
+            ->get();
+    }
+}
+
+

+ 2 - 2
app/Http/Controllers/RejectedBillController.php

@@ -90,7 +90,7 @@ class RejectedBillController extends Controller
         $rejectedBill=new RejectedBill($request->all());
         $rejectedBill['id_operator'] = Auth::user()['id'];
         $rejectedBill->save();
-        $rejectedBill->syncOrderIssue();
+        $rejectedBill->同步问题件退件状态();
 
         $this->log(__METHOD__,__FUNCTION__.'_'.$rejectedBill['id'],json_encode($request->toArray()),Auth::user()['id']);
         return ['success'=>'true','id'=>$rejectedBill['id']];
@@ -109,7 +109,7 @@ class RejectedBillController extends Controller
         $rejectedBill=RejectedBill::find($request->input('id'));
         $rejectedBill->fill($request->all());
         $rejectedBill->save();
-        $rejectedBill->syncOrderIssue();
+        $rejectedBill->同步问题件退件状态();
 
         $this->log(__METHOD__,__FUNCTION__.'_'.$rejectedBill['id'],json_encode($request->toArray()),Auth::user()['id']);
         return ['success'=>'true'];

+ 3 - 4
app/Http/Controllers/RejectedBillItemController.php

@@ -73,7 +73,7 @@ class RejectedBillItemController extends Controller
         }
         $rejectedBillItem->injectCommodityName();
         $rejectedBIll = RejectedBill::where('id',$request->input('id_rejected_bill'))->first();
-        $rejectedBIll->syncOrderIssue();
+        $rejectedBIll->同步问题件退件状态();
         $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
         return ['success'=>'true','id'=>$rejectedBillItem['id']];
     }
@@ -96,7 +96,7 @@ class RejectedBillItemController extends Controller
             $rejectedBillItem->injectCommodityName();
             $rejectedBIll = RejectedBill::where('id',$rejectedBillItem->id_rejected_bill)->with('orderIssue')->first();
 
-            $rejectedBIll->syncOrderIssue();
+            $rejectedBIll->同步问题件退件状态();
             $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
             return ['success'=>'true','id'=>$rejectedBillItem['id']];
         }
@@ -156,8 +156,7 @@ class RejectedBillItemController extends Controller
             return ['success'=>'false','fail_info'=>'没有匹配到相应内容'];
         }
         $item=$rejectedBillItems->first();
-        /** @var RejectedBill $rejectedBill */
-        $rejectedBill = RejectedBill::find($item['id_rejected_bill']);
+        $rejectedBill = RejectedBill::query()->find($item['id_rejected_bill']);
         $rejectedBill->同步问题件();
         if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,'请求处理退单:'.$rejectedBill['logistic_number_return'],Auth::user()['id']);
         $downloadedSkus = WMSReflectReceive::downloadedSkus($rejectedBill['logistic_number_return'],true);

+ 1 - 1
app/Http/Controllers/RejectedController.php

@@ -500,7 +500,7 @@ class RejectedController extends Controller
         }
         $rejectedBill =  RejectedBill::with(['items'])->where('logistic_number_return',$request->input('logisticNumberReturn'))->first();
         if(!$rejectedBill){
-            return ['success' => true,'msg' => '没有对应的退回单号,但仍可以生成问题订单'];
+            return ['success' => false,'fail_info' => '没有对应的退回单号,请先录入退件单'];
         }
         return ['success'=>true,'rejectedBill' => $rejectedBill];
     }

+ 9 - 8
app/Imports/OrderIssueImport.php

@@ -26,7 +26,8 @@ class OrderIssueImport implements ToCollection, WithHeadingRow, WithMultipleShee
     public function Collection(Collection $collection)
     {
         $endIS = false;
-        if (!isset($collection->toArray()[0]['原始运单号']) || !isset($collection->toArray()[0]['情况说明']) || !isset($collection->toArray()[0]['问题类别'])) {
+        $headerRow =  $collection->toArray()[0];
+        if (!isset($headerRow['原始运单号']) || !isset($headerRow['情况说明']) || !isset($headerRow['问题类别'])) {
             Cache::put('error', '请检查您第一行标题是否存在原始运单号,情况说明,问题类别');
         } else {
             $endIS = true;
@@ -63,11 +64,11 @@ class OrderIssueImport implements ToCollection, WithHeadingRow, WithMultipleShee
                     $sum++;
                     continue;
                 }
-                $orderPackage = OrderPackage::where('logistic_number', $logistic_number)->first();
+                $orderPackage = OrderPackage::query()->where('logistic_number', $logistic_number)->first();
                 if ($orderPackage) {
-                    $order = Order::where('id', $orderPackage['order_id'])->first();
+                    $order = Order::query()->where('id', $orderPackage['order_id'])->first();
                     if ($order) {
-                        $orderIssue = OrderIssue::where('order_id', $order['id'])->first();
+                        $orderIssue = OrderIssue::query()->where('order_id', $order['id'])->first();
                         if ($orderIssue) {
                             array_push($exception, ['原始运单号' . $row['原始运单号'] . '对应的问题件已存在']);
                             continue;
@@ -77,15 +78,15 @@ class OrderIssueImport implements ToCollection, WithHeadingRow, WithMultipleShee
 
                 $client_no = null;
                 if ($count) {
-                    $orderHeader = OracleDOCOrderHeader::where('soreference5', $logistic_number)->first();
+                    $orderHeader = OracleDOCOrderHeader::query()->where('soreference5', $logistic_number)->first();
                     $client_no = $orderHeader['soreference1'];
                 } else if ($detailCount) {
-                    $detail = OracleActAllocationDetails::where('picktotraceid', $logistic_number)->first();
-                    $orderHeader = OracleDOCOrderHeader::where('orderno', $detail['orderno'])->first();
+                    $detail = OracleActAllocationDetails::query()->where('picktotraceid', $logistic_number)->first();
+                    $orderHeader = OracleDOCOrderHeader::query()->where('orderno', $detail['orderno'])->first();
                     $client_no = $orderHeader['soreference1'];
                 }
                 $order = $orderService->findOrCreateByClientCode($client_no);
-                $orderIssue = OrderIssue::where('order_id', $order['id'])->first();
+                $orderIssue = OrderIssue::query()->where('order_id', $order['id'])->first();
                 $rejectedBill = $rejectedService->getRejectedByClientNo($client_no);
                 if ($orderIssue) {
                     array_push($exception, ['原始运单号' . $row['原始运单号'] . '对应的问题件已存在']);

+ 80 - 1
app/OrderIssue.php

@@ -11,7 +11,7 @@ class OrderIssue extends Model
     use ModelTimeFormat;
 
     protected $fillable = [
-        'order_id', 'create_at', 'rejected_bill_id', 'rejecting_status', 'result_explain',
+        'order_id', 'created_at', 'rejected_bill_id', 'rejecting_status', 'result_explain',
         'situation_explain', 'order_issue_type_id', 'second_order_id', 'is_new_rejecting',
         'final_status', 'logistic_indemnity_money', 'logistic_express_remission', 'baoshi_indemnity_money', 'baoshi_express_remission', 'user_workgroup_id'];
 
@@ -97,6 +97,85 @@ class OrderIssue extends Model
         return $createLog->user->name ?? '';
     }
 
+    public function 同步退单状态(){
+        $rejectedItems = [];
+        $orderItems = [];
+        $orderIssueId = $this['id'];
+        if ($this['rejected_bill_id'] ?? false) {
+            $rejectedBillItems = RejectedBillItem::query()->whereHas('rejectedBill.orderIssue', function ($query) use ($orderIssueId) {$query->where('id',$orderIssueId);})->get();
+            if (count($rejectedBillItems) == 0) {
+                $this->update(['rejecting_status' => '未退回']);
+                return;
+            }
+            foreach ($rejectedBillItems as $item) {
+                if (!isset($rejectedItems[$item->barcode_goods]))
+                    $rejectedItems[$item->barcode_goods] = 0;
+                $rejectedItems[$item->barcode_goods] = $item->amount + $rejectedItems[$item->barcode_goods] ?? 0;
+            }
+        } else {
+            $this->update(['rejecting_status' => '未退回']);
+            return;
+        }
+        if ($this['order_id']  ?? false) {
+            $items = OrderPackageCommodities::query()->with('commodity')->whereHas('package.order.issue', function ($query) use ($orderIssueId) {
+                $query->where('id', $orderIssueId);
+            })->get();
+            if (count($items) > 0) {
+                foreach ($items as $item) {
+                    $sku = $item['commodity']['sku'];
+                    if ($orderItems[$sku] ?? false)
+                        $orderItems[$sku] = 0;
+                    $orderItems[$sku] = $orderItems[$sku] ?? 0 + $item->amount;
+                }
+            } else {
+                $this->update(['rejecting_status' => '无']);
+                return;
+            }
+        }
+        $rejectedExcess = 0;    // 退回差异
+        $rejectedReview = 0;    // 退回复核  $rejectedItems == $orderItems
+        foreach ($rejectedItems as $key => $items) {
+            if ($orderItems[$key] ?? false) {
+                if ($rejectedItems[$key] == $orderItems[$key])
+                    $rejectedReview++;
+            } else
+                $rejectedExcess++;
+        }
+        if ($rejectedExcess > 0) {
+            $this->update(['rejecting_status' => '差异退回']);
+            return;
+        }
+        // 全部退回 部分退回 超量退回 差异退回 未退回 无
+        $isExcess = 0; // 超量 $orderItems < $rejectedItems
+        $isDiff = 0;   // 部分 $orderItems > $rejectedItems
+        $isAccord = 0; // 相同 $orderItems == $rejectedItems
+        $isLack = 0;   // 缺少 $orderItems != $rejectedItems
+        foreach ($orderItems as $key => $item) {
+            if ($rejectedItems[$key] ?? false) {
+                if ($orderItems[$key] < $rejectedItems[$key])
+                    $isExcess++;
+                else if ($orderItems[$key] > $rejectedItems[$key])
+                    $isDiff++;
+                else if ($orderItems[$key] == $rejectedItems[$key])
+                    $isAccord++;
+            } else
+                $isLack++;
+        }
+        //dd($isAccord,$rejectedReview,$isLack,$isExcess,$isDiff,$rejectedExcess);
+        if($isAccord == $rejectedReview && $isLack == 0 && $isExcess == 0 && $isDiff==0 && $rejectedExcess == 0 )
+            $this->update(['rejecting_status' => '全部退回']);
+        else if($isExcess > 0 && $isAccord ==  $rejectedReview && $isDiff == 0 && $isLack == 0)
+            $this->update(['rejecting_status' => '超量退回']);
+        else if($isDiff >=0 && $isAccord == $rejectedReview && $isLack >=0 && $rejectedExcess ==0 && $isExcess==0)
+            $this->update(['rejecting_status' => '部分退回']);
+        else if($isLack >= 0 && $rejectedExcess>=0 && $isDiff>=0 && $isLack>=0 && $isExcess>=0 && $rejectedReview>=0)
+            $this->update(['rejecting_status' => '差异退回']);
+    }
+
+    public function 同步退单($logist_number){
+
+    }
+
     public function delete()
     {
         $this->order()->delete();

+ 26 - 0
app/OrderTracking.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace App;
+
+use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\Model;
+
+class OrderTracking extends Model
+{
+
+    use ModelTimeFormat;
+    protected $fillable = [
+        'order_package_commodity_id','owner_id','web_order_number',
+        'pick_up_at','sale','client',
+        'order_remark','pallet_total','planning_sent_at',
+        'is_on_duty_shift','is_arrival','signed_at',
+        'receive_bill_status','remark'];
+
+    public function commodities(){
+        return $this->hasOne('App\OrderPackageCommodities','id','order_package_commodity_id');
+    }
+
+    public function owner(){
+        return $this->hasOne('App\Owner','owner','owner_id');
+    }
+}

+ 18 - 0
app/OrderTrackingOwner.php

@@ -0,0 +1,18 @@
+<?php
+
+namespace App;
+
+use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\Model;
+
+class OrderTrackingOwner extends Model
+{
+    //
+    use ModelTimeFormat;
+    protected $fillable = ['owner_id','status'];
+
+    public function owner(){
+        return $this->hasOne('App\Owner','id','owner_id');
+    }
+
+}

+ 4 - 0
app/Owner.php

@@ -34,4 +34,8 @@ class Owner extends Model
     {
         return $this->belongsToMany('\App\PaperBox', 'owner_paper_box', 'owner_id', 'paper_box_id');
     }
+
+    public function orderTrackingOwner(){
+        return $this->belongsTo('App\orderTrackingOwner','id','owner_id');
+    }
 }

+ 14 - 90
app/RejectedBill.php

@@ -140,111 +140,35 @@ class RejectedBill extends Model
         return $this['is_loaded'];
     }
 
-    public function syncOrderIssue()
+    public function 同步问题件退件状态()
     {
         $orderIssue = $this->orderIssue()->first();
         if ($orderIssue ?? false) {
-            $this->judgeRejectingStatus($orderIssue);
-            OrderIssue::where('id', $orderIssue['id'])->update(['is_new_rejecting' => '有']);
+            $this->同步退单状态();
+            OrderIssue::query()->where('id', $orderIssue['id'])->update(['is_new_rejecting' => '有']);
         } else {
-            OrderIssue::where('rejected_bill_id', $this->id)->update(['is_new_rejecting' => '有']);
+            OrderIssue::query()->where('rejected_bill_id', $this->id)->update(['is_new_rejecting' => '有']);
         }
     }
 
     public function 同步问题件(){
         $order_number = $this['order_number'];
-        $order_header = OracleDOCOrderHeader::where('soreference1',$order_number)->first();
-        if(!$order_header){return;}
-        $order = Order::with('issue')->where('code',$order_header['orderno'])->first();
+        $order_header = OracleDOCOrderHeader::query()->where('soreference1',$order_number)->first();
+        if(!$order_header){
+            return;
+        }
+        $order = Order::query()->with('issue')->where('code',$order_header['orderno'])->first();
         if($order['issue']){
             $order_issue =  $order->issue;
             $order_issue->update(['rejected_bill_id'=>$this['id']]);
         }
     }
 
-
-    private function judgeRejectingStatus(OrderIssue $orderIssue)
+    private function 同步退单状态()
     {
-        $orderPackageCommoditiesService = new OrderPackageCommoditiesService();
-        $rejectedItems = [];
-        $orderItems = [];
-        if ($orderIssue['rejected_bill_id'] ?? false) {
-            $rejectedBill = RejectedBill::find($orderIssue['rejected_bill_id'])->first();
-            $rejectedBillItems = RejectedBillItem::where('id_rejected_bill', $rejectedBill['id'])->get();
-            if ($rejectedBillItems) {
-                foreach ($rejectedBillItems as $item) {
-                    if (!isset($rejectedItems[$item->barcode_goods])) {
-                        $rejectedItems[$item->barcode_goods] = 0;
-                    }
-                    $rejectedItems[$item->barcode_goods] = $item->amount + $rejectedItems[$item->barcode_goods] ?? 0;
-                }
-            }
-        } else {
-            $orderIssue->update(['rejecting' => '无']);
-            $orderIssue->save();
-            return;
-        }
-        if ($orderIssue['order_id'] ?? false) {
-            $orderPackageCommodities = $orderPackageCommoditiesService->getOrderPackageCommoditiesByOrderId($orderIssue->order_id);
-            if ($orderPackageCommodities) {
-                foreach ($orderPackageCommodities as $key => $item) {
-                    if (!isset($orderItems[$item->commodity->sku])) {
-                        Arr::add($orderItems, $item->commodity->sku, 0);
-                    }
-                    $orderItems[$item->commodity->sku] = $orderItems[$item->commodity->sku] ?? 0 + $item->amount;
-                }
-            } else {
-                $orderIssue->update(['rejecting_status' => '未退回']);
-                $orderIssue->save();
-                return;
-            }
-        }
-
-        $rejectedExcess = 0;    // 退回差异
-        $rejectedReview = 0;    // 退回复核  $rejectedItems == $orderItems
-        foreach ($rejectedItems as $key => $items) {
-            if (!isset($orderItems[$key])) {
-                $rejectedExcess++;
-            } else {
-                if ($rejectedItems[$key] == $orderItems[$key]) {
-                    $rejectedReview++;
-                }
-            }
-        }
-        if ($rejectedExcess > 0) {
-            $orderIssue->update(['rejecting_status' => '差异退回']);
-            $orderIssue->save();
-            return;
-        }
-        $isExcess = 0; // 超量 $orderItems < $rejectedItems
-        $isDiff = 0;   // 部分 $orderItems > $rejectedItems
-        $isAccord = 0; // 相同 $orderItems == $rejectedItems
-        $isLack = 0;   // 缺少 $orderItems != $rejectedItems
-        foreach ($orderItems as $key => $item) {
-            if (isset($rejectedItems[$key])) {
-                if ($orderItems[$key] > $rejectedItems[$key]) {
-                    $isExcess++;
-                } else if ($orderItems[$key] < $rejectedItems[$key]) {
-                    $isDiff++;
-                } else if ($orderItems[$key] == $rejectedItems[$key]) {
-                    $isAccord++;
-                }
-            } else {
-                $isLack++;
-            }
-        }
-        if ($isAccord == $rejectedReview) {
-            $orderIssue->update(['rejecting_status' => '全部退回']);
-            $orderIssue->save();
-            return;
-        } else if ($isDiff > 0 and $isLack >= 0) {
-            $orderIssue->update(['rejecting_status' => '部分退回']);
-            $orderIssue->save();
-            return;
-        } else if ($isExcess > 0 and $isDiff == 0) {
-            $orderIssue->update(['rejecting_status' => '超量退回']);
-            $orderIssue->save();
-            return;
-        }
+        /** @var OrderIssue $orderIssue */
+        $orderIssue =  $this->orderIssue()->first();
+        if($orderIssue)
+            $orderIssue->同步退单状态();
     }
 }

+ 1 - 0
app/RejectedBillItem.php

@@ -63,4 +63,5 @@ class RejectedBillItem extends Model
     public function getQualityLabelAttribute(){
         return $this['quality']['name'];
     }
+
 }

+ 6 - 8
app/Services/AllInventoryService.php

@@ -1,11 +1,11 @@
-<?php 
+<?php
 
-namespace App\Services; 
+namespace App\Services;
 
 use Illuminate\Support\Facades\DB;
 
 Class AllInventoryService
-{ 
+{
     public function getSql(array $params, $page=null, $paginate=null){
         $date_start=$params['date_start'] ?? null;
         $range = $params['range'] ?? null;
@@ -39,7 +39,7 @@ Class AllInventoryService
         if ($LotAtt02_start)$sql.=" and 失效日期 >='".$LotAtt02_start." 00:00:00' ";
         if ($LotAtt02_end)$sql.=" and 失效日期 <='".$LotAtt02_end." 23:59:59' ";
         if ($customerid){
-            $sql .= ' and customer.CustomerID in (';
+            $sql .= ' and 客户 in (';
             $arr = explode(',',$customerid);
             foreach ($arr as $index => $data){
                 if ($index != 0)$sql .= ',';
@@ -55,8 +55,6 @@ Class AllInventoryService
     }
 
     public function paginate(array $params){
-        return DB::connection('oracle')->
-        select(DB::raw($this->getSql($params,$params['page'] ?? 1, $params['paginate'] ?? 50)));
+        return DB::connection('oracle')->select(DB::raw($this->getSql($params,$params['page'] ?? 1, $params['paginate'] ?? 50)));
     }
-
-}
+}

+ 93 - 21
app/Services/InventoryAccountService.php

@@ -221,24 +221,7 @@ class InventoryAccountService
                 $sql->where('code','=',$barcode);
             });
         })->where('location',$location)->where('inventory_account_id',$inventoryAccountId)->first();
-        if (!$inventoryAccountMission) return null;
-        $inventory=InventoryAccount::find($inventoryAccountId);
-        if($inventory->status=='复盘中'){
-            $inventoryAccountMission->re_checked_amount=$count;
-            $inventoryAccountMission->difference_amount=$count-$inventoryAccountMission->stored_amount;
-            $inventoryAccountMission->checked='已复核';
-            if ($inventoryAccountMission->difference_amount==0){
-                $inventoryAccountMission->returned='是';
-            }else{
-                $inventoryAccountMission->returned='否';
-            }
-        }else{//初盘
-            $inventoryAccountMission->verified_amount=$count;
-            $inventoryAccountMission->difference_amount=$count-$inventoryAccountMission->stored_amount;
-            $inventoryAccountMission->checked='是';
-        }
-        $inventoryAccountMission->update();
-        $inventoryAccountMission->createSignStockInventoryPersons();
+        $this->盘点($inventoryAccountId,$count,$inventoryAccountMission);
         $request=[
             'location'=>$location,
             'barcode'=>$barcode,
@@ -267,7 +250,7 @@ class InventoryAccountService
     }
     //根据该库存和产品条码查询该条盘点记录
     public function searchStockInventoryRecord($location,$barcode,$inventoryAccountId){
-        $inventoryAccountMission=InventoryAccountMission::whereHas('commodity',function($query)use($barcode){
+        $inventoryAccountMission=InventoryAccountMission::with(['commodity.barcodes','stockInventoryPersons'])->whereHas('commodity',function($query)use($barcode){
             $query->whereHas('barcodes',function($sql)use($barcode){
                 $sql->where('code',$barcode);
             });
@@ -295,7 +278,7 @@ class InventoryAccountService
             return null;
         }
     }
-    public function 盘点任务完结($id){
+    public function 完结盘点任务($id){
         $inventoryAccount=InventoryAccount::query()->find($id);
         if ($inventoryAccount->status=='复盘中'){
             $inventoryAccount->status='已完成';
@@ -309,7 +292,7 @@ class InventoryAccountService
     public function 增加系统之外的库位记录($location,$barcode,$inventoryId,$count){
         $commodity=Commodity::query()->whereHas('barcodes',function ($query)use($barcode){
             $query->where('code',$barcode);
-        })->first();
+        })->orderBy('id','DESC')->first();
         $inventoryAccountMission=new InventoryAccountMission();
         $inventoryAccountMission->location=$location;
         $inventoryAccountMission->inventory_account_id=$inventoryId;
@@ -333,6 +316,95 @@ class InventoryAccountService
         }else{
             return null;
         }
+    }
+    public function 盘点选中任务($id,$count,$inventoryId){
+        $inventoryAccountMission=InventoryAccountMission::query()->with(['commodity.barcodes','stockInventoryPersons'])->find($id);
+        if (!$inventoryAccountMission) return null;
+        $this->盘点($inventoryId,$count,$inventoryAccountMission);
+        $request=[
+            'id'=>$id,
+            'count'=>$count,
+            'inventoryId'=>$inventoryId,
+        ];
+        Controller::logS(__METHOD__,"盘点__".__FUNCTION__,json_encode($request));
+        $inventoryAccountMission=InventoryAccountMission::query()->with(['commodity.barcodes','stockInventoryPersons'])->find($id);
+        return $inventoryAccountMission;
+    }
+    public function 盘点生产日期_失效日期_批号有改动任务($id,$count,$inventoryId,$produced_at,$valid_at,$batch_number){
+        $inventoryAccountMission=InventoryAccountMission::query()->with(['commodity.barcodes','stockInventoryPersons'])->find($id);
+        if (!$inventoryAccountMission) return null;
+        $inventory=InventoryAccount::find($inventoryId);
+        if ($produced_at!=$inventoryAccountMission->produced_at||$valid_at!=$inventoryAccountMission->valid_at ||$batch_number!=$inventoryAccountMission->batch_number){
+            if($inventory->status=='复盘中'){//盘点原记录
+                $inventoryAccountMission->re_checked_amount=$count;
+                $inventoryAccountMission->difference_amount=0-$count;
+                $inventoryAccountMission->checked='已复核';
+                if ($inventoryAccountMission->difference_amount==0){
+                    $inventoryAccountMission->returned='是';
+                }else{
+                    $inventoryAccountMission->returned='否';
+                }
+            }else{//初盘
+                $inventoryAccountMission->verified_amount=$count;
+                $inventoryAccountMission->difference_amount=0-$count;
+                $inventoryAccountMission->checked='是';
+            }
+            $inventoryAccountMission->update();
+            $inventoryAccountMission->createSignStockInventoryPersons();
+            //新增新记录
+            $inventoryMission=new InventoryAccountMission();
+            $inventoryMission->location=$inventoryAccountMission->location;
+            $inventoryMission->inventory_account_id=$inventoryId;
+            $inventoryMission->commodity_id=$inventoryAccountMission->commodity_id;
+            $inventoryMission->produced_at=$produced_at;
+            $inventoryMission->valid_at=$valid_at;
+            $inventoryMission->batch_number=$batch_number;
+            $inventoryMission->erp_type_position=$inventoryAccountMission->erp_type_position;
+            $inventoryMission->quality=$inventoryAccountMission->quality;
+            $inventoryMission->stored_amount=0;
+            $inventoryMission->verified_amount=$count;
+            $inventoryMission->difference_amount=$count;
+            $inventoryMission->checked='是';
+            if($inventory->status=='复盘中'){
+                $inventoryMission->re_checked_amount=$count;
+                $inventoryMission->returned='否';
+            }
+            $inventoryMission->save();
+            $inventoryMission->createSignStockInventoryPersons();
 
+        }else{
+            $this->盘点($inventoryId,$count,$inventoryAccountMission);
+        }
+        $request=[
+            'id'=>$id,
+            'count'=>$count,
+            'inventoryId'=>$inventoryId,
+            'produced_at'=>$produced_at,
+            'valid_at'=>$valid_at,
+            'batch_number'=>$batch_number,
+        ];
+        Controller::logS(__METHOD__,"盘点__".__FUNCTION__,json_encode($request));
+        $inventoryAccountMission=InventoryAccountMission::query()->with(['commodity.barcodes','stockInventoryPersons'])->whereIn('id',[$id,$inventoryMission->id])->get();
+        return $inventoryAccountMission;
     }
+    public function 盘点($inventoryId,$count,$inventoryAccountMission){
+        $inventory=InventoryAccount::find($inventoryId);
+        if($inventory->status=='复盘中'){
+            $inventoryAccountMission->re_checked_amount=$count;
+            $inventoryAccountMission->difference_amount=$count-$inventoryAccountMission->stored_amount;
+            $inventoryAccountMission->checked='已复核';
+            if ($inventoryAccountMission->difference_amount==0){
+                $inventoryAccountMission->returned='是';
+            }else{
+                $inventoryAccountMission->returned='否';
+            }
+        }else{//初盘
+            $inventoryAccountMission->verified_amount=$count;
+            $inventoryAccountMission->difference_amount=$count-$inventoryAccountMission->stored_amount;
+            $inventoryAccountMission->checked='是';
+        }
+        $inventoryAccountMission->update();
+        $inventoryAccountMission->createSignStockInventoryPersons();
+    }
+
 }

+ 15 - 1
app/Services/InventoryCompareService.php

@@ -171,7 +171,21 @@ class InventoryCompareService
         return $inventoryCompares;
     }
 
-
+    /**
+     * @param array $params
+     * @return string $sql
+     */
+    public function getSql(array $params){
+        $this->conditionQueryInventoryCompare($params)
+            ->selectRaw("inventory_compares.mission_code,inventory_compares.custom_location,inventory_compares.quality,inventory_compares.amount_in_sys,inventory_compares.amount_in_compare,inventory_compares.differ,inventory_compares.created_at")
+            ->leftJoin('owners','inventory_compares.owner_id','owners.id')
+                ->selectRaw('owners.name owner_name')
+            ->leftJoin('commodities','inventory_compares.commodity_id','commodities.id')
+                ->selectRaw('commodities.name commodity_name,commodities.sku commodity_sku')
+            ->leftJoin('commodity_barcodes','commodity_barcodes.commodity_id','commodities.id')
+                ->selectRaw('commodity_barcodes.code commodity_barcode_code')
+            ->sql();
+    }
 
 
 //    public function createInventoryCompare($SKU,$LotAtt05,$amount,$ownerId){

+ 10 - 8
app/Services/LaborReportService.php

@@ -29,16 +29,18 @@ class LaborReportService
         $user=Auth::user();
         $laborReports=LaborReport::query()->with(['user','userDutyCheck','userWorkgroup'])->orderBy('labor_reports.id','DESC');
         if (!($params["is_export"] ?? false)){
-            $laborReports = $laborReports->whereNotIn('labor_reports.id',function ($builder)use($params){
-                $builder->select('labor_report_id')->from('labor_report_statuses')->where('status','已退场');
-                    if(!($params['created_at_start'] ?? false) || !($params['created_at_end'] ?? false)){
-                        $builder->where('created_at','like',date('Y-m-d').'%');
-                    }
+            $laborReports = $laborReports->whereNotIn('labor_reports.enter_number',function ($builder)use($params){
+                $builder->select('enter_number')->from('labor_reports')
+                    ->leftJoin('labor_report_statuses','labor_reports.id','labor_report_statuses.labor_report_id')
+                    ->where('labor_report_statuses.status','已退场');
+//                if (!($params['created_at_start'] ?? false) ||!($params['created_at_end'] ?? false)){
+//                    $builder->where('labor_report_statuses.created_at','like',date('Y-m-d').'%');
+//                }
             });
         }else unset($params['is_export']);
-        if(!($params['created_at_start'] ?? false) || !($params['created_at_end'] ?? false)){
-            $laborReports->where('labor_reports.created_at','like',date('Y-m-d').'%');
-        }
+//        if (!($params['created_at_start'] ?? false) ||!($params['created_at_end'] ?? false)){
+//            $laborReports->where('labor_reports.created_at','like',date('Y-m-d').'%');
+//        }
         $columnQueryRules=[
             'enter_number' => ['timeLimit' => 15],
             'created_at_start' => ['alias' => 'created_at' , 'startDate' => ' 00:00:00'],

+ 26 - 0
app/Services/LogService.php

@@ -0,0 +1,26 @@
+<?php
+
+
+namespace App\Services;
+
+
+use App\Log;
+use Illuminate\Support\Facades\Request;
+
+class LogService
+{
+    static public function log($method,$type,$description,$id_user=null){
+        if(!$id_user){
+            $id_user = '';
+            $user=auth()->user();
+            if($user) $id_user = $user['id'];
+        }
+        (new Log([
+            'operation'=>$method,
+            'type'=>$type,
+            'description'=>$description,
+            'id_user'=>$id_user,
+            'ip'=>Request::ip()
+        ]))->save();
+    }
+}

+ 76 - 143
app/Services/OrderIssueService.php

@@ -2,14 +2,18 @@
 
 namespace App\Services;
 
+use App\Http\Controllers\Controller;
 use App\OracleDOCASNHeader;
 use App\OracleDOCOrderHeader;
 use App\OrderIssue;
 use App\OrderIssueProcessLog;
 use App\OrderPackage;
 use App\Order;
+use App\OrderPackageCommodities;
+use App\Owner;
 use App\RejectedBill;
 use App\RejectedBillItem;
+use App\Services\common\QueryService;
 use Illuminate\Http\Request;
 use Illuminate\Support\Arr;
 use Illuminate\Support\Facades\Auth;
@@ -36,25 +40,15 @@ class OrderIssueService
             $owner_ids = explode(',', $condition['owner_id']);
         }
         $query = OrderIssue::with(['top', 'userWorkGroup', 'issueType', 'logs' => function ($query) {
-            $query->with(['user'])->orderByDesc('created_at');
+            $query->with('user')->orderByDesc('created_at');
         }, 'order' => function ($query) {
-            $query->with(['shop', 'logistic', 'owner', 'packages' => function ($query) {
-                $query->with(['commodities' => function ($query) {
-                    return $query->with('commodity');
-                }]);
-            }]);
+            $query->with(['shop', 'logistic', 'owner', 'packages.commodities.commodity']);
         }, 'rejectedBill' => function ($query) {
             $query->with(['items']);
         }, 'secondOrder' => function ($query) {
-            $query->with(['shop', 'logistic', 'owner', 'packages' => function ($query) {
-                return $query->with(['commodities' => function ($query) {
-                    return $query->with('commodity');
-                }]);
-            }]);
-        }])->whereHas('order', function ($query) use ($owner_ids) {
-            $query->whereHas('owner', function ($query) use ($owner_ids) {
-                return $query->whereIn('id', $owner_ids);
-            });
+            $query->with(['shop', 'logistic', 'owner', 'packages.commodities.commodity']);
+        }])->whereHas('order.owner', function ($query) use ($owner_ids) {
+            $query->whereIn('id', $owner_ids);
         });
 
         $query->orderBy('order_issues.id', 'desc');
@@ -212,14 +206,33 @@ class OrderIssueService
                 ->selectRaw('order_issue_types.`name` order_issue_type_name')
             ->leftJoin('orders','order_issues.order_id','orders.id')
                 ->selectRaw('orders.id order_id,orders.address,orders.district,orders.city,orders.province,orders.consignee_phone,orders.consignee_name,orders.client_code,orders.created_at order_created_at')
+          /*  ->leftJoin('order_packages','order_packages.order_id','orders.id')
+                ->selectRaw('order_packages.id order_package_id,order_packages.logistic_number order_package_logistic_name')
+            ->leftJoin('order_package_commodities','order_packages.id','order_package_commodities.order_package_id')
+                ->selectRaw('order_package_commodities.id order_package_commodity_id,order_package_commodities.amount commodity_amount')
+            ->leftJoin('commodities','order_package_commodities.commodity_id','commodities.id')
+                ->selectRaw('commodities.name commodity_name,commodities.sku commodity_sku')*/
             ->leftJoin('logistics','logistics.id','orders.logistic_id')
                 ->selectRaw('logistics.name logistic_name')
             ->leftJoin('owners','owners.id','orders.owner_id')
                 ->selectRaw('owners.name owner_name')
             ->leftJoin('shops','orders.shop_id','shops.id')
                 ->selectRaw('shops.name shop_name')
+/*            ->leftJoin('rejected_bills','order_issues.rejected_bill_id','rejected_bills.id')*/
+            /*->leftJoin('rejected_bill_items','rejected_bills.id','rejected_bill_items.id_rejected_bill')
+                ->selectRaw('rejected_bill_items.id rejected_bill_item_id,rejected_bill_items.remark,rejected_bill_items.amount rejected_bill_amount,rejected_bill_items.name_goods,rejected_bill_items.barcode_goods')*/
+            /*->leftJoin('order_issue_process_logs','order_issues.id','order_issue_process_logs.order_issue_id')
+                ->selectRaw('order_issue_process_logs.content log_content,order_issue_process_logs.type log_type')
+            ->leftJoin('users','order_issue_process_logs.user_id','users.id')
+                ->selectRaw('users.name user_name')*/
             ->leftJoin('orders as s_o','s_o.id','order_issues.second_order_id')
                 ->selectRaw('s_o.id s_o_id,s_o.client_code s_o_client_code')
+            /*->leftJoin('order_packages as s_o_p','s_o_p.order_id','s_o.id')
+                ->selectRaw('s_o_p.id s_o_p_id,s_o_p.logistic_number')
+            ->leftJoin('order_package_commodities as s_o_p_c','s_o_p_c.order_package_id','s_o_p.id')
+                ->selectRaw('s_o_p_c.id s_o_p_c_id,s_o_p_c.amount s_o_p_c_amount')
+            ->leftJoin('commodities as s_c','s_o_p_c.commodity_id','s_c.id')
+                ->selectRaw('s_c.sku s_c_sku,s_c.name s_c_name')*/
             ->leftJoin('logistics as s_logistics','s_o.logistic_id','s_logistics.id')
                 ->selectRaw('s_logistics.name s_logistics_name')
             ->leftJoin('user_workgroups','user_workgroups.id','order_issues.user_workgroup_id')
@@ -238,19 +251,22 @@ class OrderIssueService
 
     }
 
-    public function orderIssueTag(array $arr)
+    public function orderIssueTag(array $params)
     {
-        $orderNos = $arr['orderNos'];
+        $orderNos = $params['orderNos'];
         $meg = ['success' => false];
-        if ($this->verifyOrderIssue($arr)) {
-            $meg['fail_info'] = '传入订单编号中对应的订单问题已有生成';
+        $orderIssues = $this->verifyOrderIssue($orderNos);
+        if ($orderIssues != null && count($orderIssues) > 0) {
+            $orderNOs = data_get($orderIssues, '*.order.code');
+            $meg['fail_info'] = '传入订单编号中对应的订单问题已有生成,单号为' . json_encode($orderNOs);
             return $meg;
         }
         foreach ($orderNos as $orderNo) {
             $orderIssue = $this->createOrFindByOrderNo($orderNo);
-            OrderIssue::where('id',$orderIssue['id'])->update(['order_issue_type_id'=>$arr['typeId'],'result_explain'=>$arr['result_explain']]);
-            OrderIssueProcessLog::create(['order_issue_id' => $orderIssue['id'], 'user_id' => Auth::user()['id'], 'content' => '标记创建订单问题件', 'type' => '创建']);
+            OrderIssue::query()->where('id', $orderIssue['id'])->update(['order_issue_type_id' => $params['typeId'], 'result_explain' => $params['result_explain']]);
+            OrderIssueProcessLog::query()->create(['order_issue_id' => $orderIssue['id'], 'user_id' => Auth::user()['id'], 'content' => '标记创建订单问题件', 'type' => '创建']);
         }
+        Controller::logS(__METHOD__, __FUNCTION__, '标记订单问题件' . json_encode($orderNos), Auth::user()['id']);
         $meg['success'] = true;
         return $meg;
     }
@@ -266,21 +282,24 @@ class OrderIssueService
 
     public function createOrFind($clientCode)
     {
-        /** @var OrderService $orderService */
         $orderService = app('orderService');
-        $orderHeader = OracleDOCOrderHeader::query()->where('SOREFERENCE1', $clientCode)->first();
+        $orderHeader = OracleDOCOrderHeader::query()->where('SOReference1', $clientCode)->first();
         if (!$orderHeader) {
             return null;
         }
         $order = $orderService->findOrCreateByClientCode($clientCode);
         $rejectedBill = RejectedBill::query()->where('order_number', $orderHeader['soreference1'])->first();
+        if(!($rejectedBill ?? false)){
+           $asnHeader =  OracleDOCASNHeader::query()->where('ASNReference2', $orderHeader['soreference1'])->first();
+           if($asnHeader['asnreference3'] ?? false)
+              $rejectedBill = RejectedBill::query()->where('logistic_number_return',$asnHeader['asnreference3'])->first();
+        }
         $arr = [
             'order_id' => $order['id'],
-            'rejected_bill_id' => $rejectedBill['id'],
+            'rejected_bill_id' => $rejectedBill['id'] ?? '',
         ];
-        /** @var OrderIssue $orderIssue */
         $orderIssue = OrderIssue::query()->create($arr);
-        $this->judgeRejectingStatus($orderIssue);
+        $orderIssue->同步退单状态();
         $orderIssue->order = $order;
         return $orderIssue;
     }
@@ -324,122 +343,32 @@ class OrderIssueService
             $orderIssue->order_id = $order['id'];
             $orderIssue->save();
         }
-        if (!$arr['rejected_bill_id']) {
-            $orderIssue->update(['rejecting_status' => '无']);
-        } else {
-            $this->judgeRejectingStatus($orderIssue);
-        }
+        $orderIssue->同步退单状态();
         return $orderIssue;
     }
 
-    public function judgeRejectingStatus(OrderIssue $orderIssue)
-    {
-        $orderPackageCommoditiesService = new OrderPackageCommoditiesService();
-        $rejectedItems = [];
-        $orderItems = [];
-        if ($orderIssue->rejected_bill_id) {
-            $rejectedBill = RejectedBill::query()->find($orderIssue->rejected_bill_id)->first();
-            $rejectedBillItems = RejectedBillItem::query()->where('id_rejected_bill', $rejectedBill->id)->get();
-            if ($rejectedBillItems) {
-                foreach ($rejectedBillItems as $item) {
-                    if (!isset($rejectedItems[$item->barcode_goods])) {
-                        $rejectedItems[$item->barcode_goods] = 0;
-                    }
-                    $rejectedItems[$item->barcode_goods] = $item->amount + $rejectedItems[$item->barcode_goods] ?? 0;
-                }
-            }
-        } else {
-            $orderIssue->update(['rejecting' => '无']);
-            $orderIssue->save();
-            return;
-        }
-        if ($orderIssue->order_id) {
-            $orderPackageCommodities = $orderPackageCommoditiesService->getOrderPackageCommoditiesByOrderId($orderIssue->order_id);
-            if ($orderPackageCommodities) {
-                foreach ($orderPackageCommodities as $key => $item) {
-                    if (!isset($orderItems[$item->commodity->sku])) {
-                        Arr::add($orderItems, $item->commodity->sku, 0);
-                    }
-                    $orderItems[$item->commodity->sku] = $orderItems[$item->commodity->sku] ?? 0 + $item->amount;
-                }
-            } else {
-                $orderIssue->update(['rejecting_status' => '未退回']);
-                $orderIssue->save();
-                return;
-            }
-        }
-
-        $rejectedExcess = 0;    // 退回差异
-        $rejectedReview = 0;    // 退回复核  $rejectedItems == $orderItems
-        foreach ($rejectedItems as $key => $items) {
-            if (!isset($orderItems[$key])) {
-                $rejectedExcess++;
-            } else {
-                if ($rejectedItems[$key] == $orderItems[$key]) {
-                    $rejectedReview++;
-                }
-            }
-        }
-        if ($rejectedExcess > 0) {
-            $orderIssue->update(['rejecting_status' => '差异退回']);
-            $orderIssue->save();
-            return;
-        }
-        $isExcess = 0; // 超量 $orderItems < $rejectedItems
-        $isDiff = 0;   // 部分 $orderItems > $rejectedItems
-        $isAccord = 0; // 相同 $orderItems == $rejectedItems
-        $isLack = 0;   // 缺少 $orderItems != $rejectedItems
-        foreach ($orderItems as $key => $item) {
-            if (isset($rejectedItems[$key])) {
-                if ($orderItems[$key] > $rejectedItems[$key]) {
-                    $isExcess++;
-                } else if ($orderItems[$key] < $rejectedItems[$key]) {
-                    $isDiff++;
-                } else if ($orderItems[$key] == $rejectedItems[$key]) {
-                    $isAccord++;
-                }
-            } else {
-                $isLack++;
-            }
-        }
-        if ($isAccord == $rejectedReview) {
-            $orderIssue->update(['rejecting_status' => '全部退回']);
-            $orderIssue->save();
-            return;
-        } else if ($isDiff > 0 and $isLack >= 0) {
-            $orderIssue->update(['rejecting_status' => '部分退回']);
-            $orderIssue->save();
-            return;
-        } else if ($isExcess > 0 and $isDiff == 0) {
-            $orderIssue->update(['rejecting_status' => '超量退回']);
-            $orderIssue->save();
-            return;
-        }
-    }
-
     public function createByLogisticNumber(array $arr)
     {
-        $order = Order::create($arr);
-        $orderIssue = OrderIssue::create($arr);
-        $orderIssue->order_id = $order['id'];
-        OrderPackage::create(['order_id' => $order->id, 'logistic_number' => $arr['logistic_number_return']]);
-        $orderIssue->update();
+        $order = Order::query()->create($arr);
+        $orderIssue = OrderIssue::query()->create($arr);
+        $orderIssue['order_id'] = $order['id'];
+        OrderPackage::query()->create(['order_id' => $order['id'], 'logistic_number' => $arr['logistic_number_return']]);
+        $orderIssue->同步退单状态();
+        $orderIssue->update(['order_id' => $order['id']]);
         return $orderIssue;
     }
 
     public function verifyOrderIssue(array $arr)
     {
-        $orderIds = $arr['orderNos'];
-        $orders = Order::whereIn('code', $orderIds)->get();
+        $orders = Order::query()->whereIn('code', $arr)->get();
         if (count($orders) == 0) {
-            return false;
+            return [];
         }
         $order_ids = [];
-        foreach ($orders as $order) {
+        foreach ($orders as $order)
             $order_ids[] = $order->id;
-        }
-        $count = OrderIssue::whereIn('order_id', $order_ids)->count();
-        return $count != 0;
+        $orderIssues = OrderIssue::query()->with('order')->whereIn('order_id', $order_ids)->get();
+        return $orderIssues;
     }
 
     public function exportExcel(Request $request)
@@ -450,9 +379,7 @@ class OrderIssueService
                 $result = $this->getConditionQuery($request->all(), null)->get();
             }
         } else if ($request->getMethod() == 'POST') {
-            $orderIssueIds = $request->input('data');
-            $ids = explode(',', $orderIssueIds);
-            $request['order_issue_ids'] = $ids;
+            $request['order_issue_ids'] = $request->input('data');
             $result = $this->getConditionQuery($request->all(), null)->get();
         }
         return $result;
@@ -462,29 +389,35 @@ class OrderIssueService
     {
         if ($arr['rejectedBill'] ?? false) {
             if ($arr['rejectedBill']['id'] ?? false) {
-                $rejectedBill = RejectedBill::where('id', $arr['rejectedBill']['id'])->first();
+                $rejectedBill = RejectedBill::query()->where('id', $arr['rejectedBill']['id'])->first();
+                $arr['orderIssues']['rejected_bill_id'] = $rejectedBill['id'];
+                $arr['orderIssues']['is_new_rejecting'] = '有';
                 $rejectedBill->fill($arr['rejectedBill']);
                 $rejectedBill->update();
-                $rejectedBill->syncOrderIssue();
-                $request['orderIssues']['rejected_bill_id'] = $rejectedBill['id'];
-            } else if ($arr['rejectedBill']['id_logistic_return'] ?? false && $arr['rejectedBill']['logistic_number_return'] ?? false) {
-                $rejectedBill = RejectedBill::firstOrCreate([
-                        'id_logistic_return' => $arr['rejectedBill']['id_logistic_return'],
-                        'id_owner' => $arr['rejectedBill']['id_owner'],
+                $rejectedBill->同步问题件();
+                $rejectedBill->同步问题件退件状态();
+
+            } /*else if ($arr['rejectedBill']['id_logistic_return'] ?? false && $arr['rejectedBill']['logistic_number_return'] ?? false) {
+                $owner_id = $orderIssue['order']['owner_id'];
+                $rejectedBill = RejectedBill::query()->firstOrCreate([
+                        'id_logistic_return' => $arr['rejectedBill']['id_logistic_return'] ?? '',
+                        'id_owner' => $owner_id ?? '',
                         'logistic_number_return' => $arr['rejectedBill']['logistic_number_return'],]
                 );
                 $rejectedBill->save();
-                $rejectedBill->syncOrderIssue();
-                $request['orderIssues']['rejected_bill_id'] = $rejectedBill['id'];
-
-            }
+                $rejectedBill->同步问题件();
+                $rejectedBill->同步问题件退件状态();
+                $arr['orderIssues']['rejected_bill_id'] = $rejectedBill['id'];
+                $arr['orderIssues']['is_new_rejecting'] = '有';
+            }*/
         }
         if ($arr['order'] ?? false) {
-            $order = Order::where('id', $arr['order']['id'])->first();
+            $order = Order::query()->where('id', $arr['order']['id'])->first();
             $order->fill($arr['order']);
             $order->update();
         }
         $orderIssue->fill($arr['orderIssues']);
+        $orderIssue->同步退单状态();
         $orderIssue->update();
     }
 

+ 9 - 67
app/Services/OrderService.php

@@ -4,13 +4,17 @@ namespace App\Services;
 
 use App\Logistic;
 use App\OracleActAllocationDetails;
+use App\OracleBasCustomer;
 use App\OracleDOCASNHeader;
+use App\OracleDOCOrderDetail;
 use App\OracleDOCOrderHeader;
 use App\Order;
+use App\OrderItems;
+use App\OrderPackage;
+use App\OrderPackageCommodities;
 use App\Owner;
 use App\RejectedBill;
 use App\Shop;
-use Illuminate\Database\Eloquent\Builder;
 
 class OrderService
 {
@@ -22,7 +26,7 @@ class OrderService
     public function findOrCreateByClientCode($clientCode)
     {
         $order = Order::query()->where('client_code', $clientCode)->first();
-        $orderHeader = OracleDOCOrderHeader::query()->where('SOREFERENCE1', $clientCode)->first();
+        $orderHeader = OracleDOCOrderHeader::query()->where('SOReference1', $clientCode)->first();
         if ($orderHeader == null) {
             return null;
         }
@@ -72,11 +76,7 @@ class OrderService
 
     public function getOrderInfo($orderId)
     {
-        return Order::with(['packages' => function (Builder $query) {
-            return $query->with(['commodities' => function (Builder $query) {
-                return $query->with(['commodity']);
-            }]);
-        }])->where('id', $orderId)->first();
+        return Order::with('packages.commodities.commodity')->where('id', $orderId)->first();
     }
 
     public function getRejectedBillOfClientCode($clientCode)
@@ -89,7 +89,7 @@ class OrderService
         if (!$ASNHeader) {
             return null;
         }
-        return RejectedBill::with(['owner', 'logistic', 'items'])->where('logistic_number_return', $ASNHeader->asnreference2)->first();
+        return RejectedBill::query()->with(['owner', 'logistic', 'items'])->where('logistic_number_return', $ASNHeader->asnreference2)->first();
     }
 
     public function findOrCreteByLogisticNumberReturn($logisticNumberReturn)
@@ -102,64 +102,6 @@ class OrderService
         if (!$orderHeader) {
             return null;
         }
-        return $this->findOrCreateByClientCode($orderHeader["soreference1"]);
-    }
-
-    public function first(array $params){
-        $order = Order::query();
-        foreach ($params as $column => $value){
-            $order->where($column, $value);
-        }
-        return $order->first();
-    }
-
-    public function logisticNumberCreateOrder($logistic_number){
-        /**
-         * @var OracleActAllocationDetailService
-         * @var OracleActAllocationDetails $actAllocationDetail
-         */
-        $actAllocationDetail = app('oracleActAllocationDetailService')->first(['picktotraceid'=>$logistic_number]);
-        $order = $this->first(['code'=>$actAllocationDetail->orderno]);
-        if ($order)return $order;
-
-
-        $actAllocationDetail->load(['oracleDocOrderHeader'=>function($query){
-            $query->with('oracleBASCode');
-        }]);
-        $orderHeader = $actAllocationDetail->oracleDocOrderHeader ?? null;
-        if ($orderHeader == null)return null;
-
-        $owner = app('ownerService')->first(['code'=>$orderHeader->customerid]);
-        if (!$owner){
-            $orderHeader->load('oracleBASCustomer');
-            $customer_name = $orderHeader->oracleBASCustomer ? $orderHeader->oracleBASCustomer->descr_c : null;
-            /** @var OwnerService */
-            if ($customer_name) $owner = app('ownerService')->create(['code'=>$orderHeader->customerid, 'name'=>$customer_name]);
-        }
-
-        $shop = null;
-        $shop_name = $orderHeader->issuepartyname;
-        if ($shop_name && $owner) {
-            $shop = app('shopService')->firstOrCreate(['name' => $shop_name, 'owner_id' => $owner->id]);
-        }
-
-        $logistics = app('logisticService')->firstOrCreate(['code'=>$orderHeader->carrierid],
-            ['code'=>$orderHeader->carrierid,'name'=>$orderHeader->carriername]);
-
-        return Order::query()->create([
-            'code' => $orderHeader->orderno,
-            'owner_id' => $owner ? $owner->id : null,
-            'wms_status' => $orderHeader->oracleBASCode ? $orderHeader->oracleBASCode->codename_c : null,
-            'created_at' => $orderHeader->addtime,
-            'logistic_id' => $logistics ? $logistics->id : null,
-            'shop_id' => $shop ? $shop->id : null,
-            'consignee_name' => $orderHeader->c_contact,
-            'consignee_phone' => $orderHeader->c_tel2,
-            'province' => $orderHeader->c_province,
-            'city' => $orderHeader->c_city,
-            'district' => $orderHeader->c_district,
-            'address' => $orderHeader->c_address1,
-            'client_code' => $orderHeader->soreference1,
-        ]);
+        return $this->findOrCreateByClientCode($orderHeader['soreference1']);
     }
 }

+ 65 - 0
app/Services/OrderTrackingService.php

@@ -0,0 +1,65 @@
+<?php
+
+namespace App\Services;
+
+use App\OrderTracking;
+use App\Owner;
+use App\Services\common\QueryService;
+use Illuminate\Support\Facades\Auth;
+
+Class OrderTrackingService
+{
+    public function getQuery($params){
+        $user = Auth::user();
+        $owner_ids = $user ? $user-> getPermittingOwnerIdsAttribute() :[];
+        if($params['owner_id'] ?? false){
+            $owner_ids = array_intersect($owner_ids,$params['owner_id']) ;
+        }
+        $query =  OrderTracking::query()->with(['owner','commodities'=>function($query){
+            $query->with(['commodity','package.order']);
+        },])->whereHas('owner',function($query) use ($owner_ids) {
+            $query->whereIn('id',$owner_ids);
+        });
+
+        $queryParam = [
+            'start_at' => ['alias'=>'created_at','startDate'=>' 00:00:00'],
+            'end_at' => ['alias'=>'created_at','endDate'=>' 23:59:59'],
+        ];
+        $param = [
+            'start_at' => $params['start_at'] ?? '',
+            'end_at' => $params['end_at'] ?? '',
+        ];
+        $query = app(QueryService::class)->query($param,$query,$queryParam);
+        return $query;
+    }
+
+    public function getConditionQuery($params){
+        $query =  $this->getQuery($params);
+        if($params['client_code'] ?? false ){
+            $query->whereHas('commodities.package',function($query) use ($params){$query->where('client_code',$params['client_code']);});
+        }
+
+        if($params['client'] ?? false){
+            $query->where('client','like',$params['client']);
+        }
+
+        if($params['sku'] ?? false){
+            $query->whereHas('commodities.commodity',function($query) use ($params){$query->where('sku',$params['sku']);});
+        }
+
+        if($params['logistic_number'] ?? false){
+            $query->whereHas('commodities.package',function($query) use ($params){$query->where('logistic_number',$params['logistic_number']);});
+        }
+
+        return $query;
+    }
+
+
+    public function paginate($params){
+       return  $this->getQuery($params)->paginate($params['paginate'] ?? 50);
+    }
+
+    public function export($params){
+
+    }
+}

+ 1 - 1
app/Services/RejectedService.php

@@ -56,7 +56,7 @@ class RejectedService
             }
             unset($param["is_checked"]);
         }
-        if ($param["is_loaded"] ?? false) {
+        if (isset($param["is_loaded"])) {
             $is_loaded = $param["is_loaded"];
             if ($is_loaded == 'null') $is_loaded = null;
             $rejectedBills = $rejectedBills->where('rejected_bills.is_loaded', $is_loaded);

+ 5 - 5
app/Services/WaveService.php

@@ -59,11 +59,11 @@ class WaveService
         if (is_string($ids)) {
             $ids = [$ids];
         }
-        $count = $this->verfifyIds($ids);
-        if (!$count) {
-            $meg['fail_info'] = "取消打印的波次中有不符合条件的波次";
-            return $meg;
-        }
+//        $count = $this->verfifyIds($ids);
+//        if (!$count) {
+//            $meg['fail_info'] = "取消打印的波次中有不符合条件的波次";
+//            return $meg;
+//        }
         $cancelPrint = OracleDOCWaveHeader::whereIn("WAVENO", $ids)->update(['udfprintflag2' => 'N', 'UserDefine2' => '']);
         if (!$cancelPrint) {
             $meg['fail_info'] = '没有选中需要重置打印标记的波次!';

+ 7 - 0
config/sync,php.php

@@ -0,0 +1,7 @@
+<?php
+return [
+    'order_tracking_import' => [
+        'import' => 20,
+        'start_at'=> '',
+    ],
+];

+ 12 - 0
database/factories/OrderTrackingFactory.php

@@ -0,0 +1,12 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\OrderTracking;
+use Faker\Generator as Faker;
+
+$factory->define(OrderTracking::class, function (Faker $faker) {
+    return [
+        //
+    ];
+});

+ 12 - 0
database/factories/OrderTrackingOwnerFactory.php

@@ -0,0 +1,12 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\OrderTrackingOwner;
+use Faker\Generator as Faker;
+
+$factory->define(OrderTrackingOwner::class, function (Faker $faker) {
+    return [
+        //
+    ];
+});

+ 1 - 1
database/migrations/2020_07_29_160826_create_order_issues_table.php

@@ -15,7 +15,7 @@ class CreateOrderIssuesTable extends Migration
     {
         Schema::create('order_issues', function (Blueprint $table) {
             $table->bigIncrements('id');
-            $table->timestamp('created_at')->index();
+            $table->timestamp('created_at')->index()->nullable();
             $table->timestamp('updated_at')->index();
             $table->integer('order_id')->index()->nullable()->comment('订单');
             $table->enum('handle_status', ['处理中', '已完结'])->default('处理中')->comment('处理状态');

+ 46 - 0
database/migrations/2020_09_03_182051_create_order_trackings_table.php

@@ -0,0 +1,46 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateOrderTrackingsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('order_trackings', function (Blueprint $table) {
+            $table->id();
+            $table->integer('order_package_commodity_id')->index();
+            $table->integer('owner_id')->index();
+            $table->string('web_order_number')->nullable();
+            $table->timestamp('pick_up_at');
+            $table->string('sale')->nullable();
+            $table->string('client')->nullable();
+            $table->string('order_remark')->nullable();
+            $table->string('pallet_total')->nullable();
+            $table->timestamp('planning_sent_at')->nullable();
+            $table->enum('is_on_duty_shift',['是','否'])->default(null)->nullable();
+            $table->enum('is_arrival',['是','否'])->default(null)->nullable();
+            $table->timestamp('signed_at')->nullable();
+            $table->string('receive_bill_status')->nullable();
+            $table->string('remark')->nullable();
+            $table->timestamp('created_at')->index();
+            $table->timestamp('updated_at')->index();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('order_trackings');
+    }
+}

+ 33 - 0
database/migrations/2020_09_04_091531_create_order_tracking_owners_table.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateOrderTrackingOwnersTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('order_tracking_owners', function (Blueprint $table) {
+            $table->id();
+            $table->integer('owner_id')->index();
+            $table->enum('status',['启用','禁用']);
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('order_tracking_owners');
+    }
+}

+ 32 - 0
database/migrations/2020_09_04_093857_add_order_tracking_auth.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+
+class AddOrderTrackingAuth extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        (new \App\Authority(['name'=>'订单管理-跟踪','alias_name'=>'订单管理-跟踪']))->save();
+        (new \App\Authority(['name'=>'订单管理-跟踪-仓库编辑','alias_name'=>'订单管理-跟踪-仓库编辑']))->save();
+        (new \App\Authority(['name'=>'订单管理-跟踪-物流公司编辑','alias_name'=>'订单管理-跟踪-物流公司编辑']))->save();
+        (new \App\Authority(['name'=>'订单管理-跟踪-监听','alias_name'=>'订单管理-跟踪-监听']))->save();
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        \App\Authority::where('name','订单管理-跟踪')->delete();
+        \App\Authority::where('name','订单管理-跟踪-仓库编辑')->delete();
+        \App\Authority::where('name','订单管理-跟踪-物流公司编辑')->delete();
+        \App\Authority::where('name','订单管理-跟踪-监听')->delete();
+    }
+}

+ 16 - 0
database/seeds/OrderTrackingOwnerSeeder.php

@@ -0,0 +1,16 @@
+<?php
+
+use Illuminate\Database\Seeder;
+
+class OrderTrackingOwnerSeeder extends Seeder
+{
+    /**
+     * Run the database seeds.
+     *
+     * @return void
+     */
+    public function run()
+    {
+        //
+    }
+}

+ 16 - 0
database/seeds/OrderTrackingSeeder.php

@@ -0,0 +1,16 @@
+<?php
+
+use Illuminate\Database\Seeder;
+
+class OrderTrackingSeeder extends Seeder
+{
+    /**
+     * Run the database seeds.
+     *
+     * @return void
+     */
+    public function run()
+    {
+        //
+    }
+}

+ 2 - 2
public/js/app.js

@@ -2330,7 +2330,7 @@ function fromByteArray (uint8) {
 var BlobBuilder = typeof BlobBuilder !== 'undefined' ? BlobBuilder :
   typeof WebKitBlobBuilder !== 'undefined' ? WebKitBlobBuilder :
   typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder :
-  typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : 
+  typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder :
   false;
 
 /**
@@ -61991,4 +61991,4 @@ module.exports = __webpack_require__(/*! D:\Demo\bswas\resources\sass\app.scss *
 
 /***/ })
 
-/******/ });
+/******/ });

+ 345 - 52
resources/views/inventory/stockInventory/inventoryMission.blade.php

@@ -13,7 +13,7 @@
             <span class="mt-3" >
                 <a :href="'{{url('inventory/stockInventory/enterStockInventory')}}/'+inventory.id+'?listMode=true'"><button class="btn btn-sm btn-outline-dark" v-if="!listMode">切换为列表</button></a>
                 <a :href="'{{url('inventory/stockInventory/enterStockInventory')}}/'+inventory.id+'?listMode=false'"><button class="btn btn-sm btn-outline-dark" v-if="listMode &&inventory.status!='已完成'">切换为盘点</button></a>
-                <span><button class="btn btn-sm btn-outline-info" v-if="inventory.status==='复盘中' &&!listMode" @click="盘点任务完结(inventory.id,inventory.owner.name,inventory.type)">完结</button></span>
+                <span><button class="btn btn-sm btn-outline-info" v-if="inventory.status==='复盘中' &&!listMode" @click="完结盘点任务(inventory.id,inventory.owner.name,inventory.type)">完结</button></span>
 {{--                <button class="btn btn-sm" @click="listMode?listMode=false:listMode=true" :class="listMode?'btn-dark':'btn-outline-dark'">--}}
                 {{--                    <span v-if="!listMode">切换为列表</span>--}}
                 {{--                    <span v-if="listMode">切换为盘点</span>--}}
@@ -94,7 +94,70 @@
             <span v-if="inventoryMissionRecord.difference_amount" class="font-weight-bold">@{{ inventoryMissionRecord.difference_amount }}</span>
         </span>
         </form>
-
+        <div class="row d-none d-xl-block" v-if="inventoryAccountMissions.length>=1">
+            <div class="col-12 col-md-12 col-sm-12">
+                <table class="table table-sm table-bordered table-info mt-2">
+                    <tr>
+                        <td>操作</td>
+                        <td>库位</td>
+                        <td>产品名</td>
+                        <td>产品条码</td>
+                        <td>产品编码</td>
+                        <td>生产日期</td>
+                        <td>失效时期</td>
+                        <td>批号</td>
+                        <td>盘点人</td>
+                        <th>属性仓</th>
+                        <th>质量状态</th>
+                        <td>库存数量</td>
+                        <td>盘点数量</td>
+                        <td>复盘数量</td>
+                        <td>复盘差异</td>
+                    </tr>
+                    <tr v-for="inventoryMission in inventoryAccountMissions">
+                        <td>
+                            <span class="btn btn-sm btn-outline-primary" @click="盘点选中任务(inventoryMission.id,inventoryMission.produced_at,inventoryMission.valid_at,inventoryMission.batch_number)">选定盘点</span>
+                        </td>
+                        <td>@{{ inventoryMission.location }}</td>
+                        <td v-if="inventoryMission.commodity">@{{ inventoryMission.commodity.name }}</td>
+                        <td v-if="inventoryMission.commodity">@{{ inventoryMission.commodity.barcode }}</td>
+                        <td v-if="inventoryMission.commodity">@{{ inventoryMission.commodity.sku }}</td>
+                        <td>
+                            <input type="date"  class="form-control-sm" name="produced_at"  v-model="inventoryMission.produced_at" >
+                        </td>
+                        <td>
+                            <input type="date"  class="form-control-sm" name="valid_at"  v-model="inventoryMission.valid_at" >
+                        </td>
+                        <td class="text-muted">
+                            <input type="text"  class="form-control-sm" name="batch_number"  v-model="inventoryMission.batch_number" >
+                        </td>
+                        <td v-if="inventoryMission.stockInventoryPersons &&!listMode" class="text-muted" :rowspan="inventoryMission.is_multi_row?2:''">
+                            <a href="#" v-if="inventoryMission.stockInventoryPersons.length>0"  class="dropdown-toggle"  data-toggle="dropdown">
+                                @{{ inventoryMission.stockInventoryPersons[0].mark }}<b class="caret"></b>
+                            </a>
+                            <div style="position: absolute;width:320px;margin-left:-100px;background-color: white;max-height:150px ;overflow-y:auto" class="small mt-0 dropdown-menu">
+                                <table class="table table-sm table-striped table-bordered">
+                                    <tr>
+                                        <th>盘点人</th>
+                                        <th>时间</th>
+                                    </tr>
+                                    <tr v-for="stockInventoryPerson in inventoryMission.stockInventoryPersons">
+                                        <td>@{{ stockInventoryPerson.mark }}</td>
+                                        <td>@{{ stockInventoryPerson.created_at }}</td>
+                                    </tr>
+                                </table>
+                            </div>
+                        </td><td v-if="listMode"></td>
+                        <td >@{{ inventoryMission.erp_type_position }}</td>
+                        <td >@{{ inventoryMission.quality }}</td>
+                        <td >@{{ inventoryMission.stored_amount }}</td>
+                        <td>@{{ inventoryMission.verified_amount }}</td>
+                        <td>@{{ inventoryMission.re_checked_amount }}</td>
+                        <td>@{{ inventoryMission.difference_amount }}</td>
+                    </tr>
+                </table>
+            </div>
+        </div>
 
         <div class="card-header pt-0">
             <div id="form"></div>
@@ -113,7 +176,6 @@
                     inventoryMission.mark==='未复盘有差异'?'td-warm font-weight-bold':'',
                     inventoryMission.mark==='无差异'?'text-muted':'',
                     inventoryMission.mark==='未盘'?'td-yellow':'',
-                    inventoryMission.hasLinkingGroup===true?'blink':'',
                     ]">
                     <td>
                         <input type="checkbox" :value="inventoryMission.id" v-model="checkData">
@@ -161,11 +223,71 @@
                     <td>@{{ inventoryMission.difference_amount }}</td>
                     <td>@{{ inventoryMission.occupied_amount }}</td>
                     <td v-if="!listMode">
-                        <span class="btn  btn-sm btn-outline-danger" @click="删除盘点记录(inventoryMission.id,inventoryMission.inventory_account_id,inventoryMission.commodity.name)">删除</span>
+                        <span class="btn  btn-sm btn-outline-danger" @click="删除盘点记录(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">删除</span>
                     </td>
                 </tr>
             </table>
         </div>
+        <!--相同库位和条码-->
+        <table class="table table-striped table-sm table-bordered table-hover p-0 d-table  d-xl-none mt-2"  style="background: rgb(179, 214, 245);">
+            <tr v-for="inventoryMission in inventoryAccountMissions">
+                <td style="filter:grayscale(30%); ">
+                    <div  class="mt-3">
+                        <div style="transform:scale(0.9)" class="pl-0">
+                            <span class="mr-3 text-nowrap"><span class="font-weight-bold">库位:</span><span >@{{ inventoryMission.location }}</span></span>
+                            <span class="mr-3 text-nowrap"><span class="font-weight-bold">产品名称:</span><span  v-if="inventoryMission.commodity">@{{ inventoryMission.commodity.name }}</span></span>
+                            <span class="mr-3 text-nowrap"><span class="font-weight-bold">产品条码:</span><span  v-if="inventoryMission.commodity">@{{ inventoryMission.commodity.barcode }}</span></span>
+                            <span class="mr-3 text-nowrap"><span class="font-weight-bold">产品编码:</span><span  v-if="inventoryMission.commodity">@{{ inventoryMission.commodity.sku }}</span></span>
+                            <span class="mr-3 text-nowrap"><span class="font-weight-bold">生产日期:</span>
+                               <input type="date"  class="form-control-sm" name="produced_at"  v-model="inventoryMission.produced_at">
+                            </span>
+
+                            <span class="mr-3 text-nowrap"><span class="font-weight-bold">失效时期:</span>
+                                <input type="date"  class="form-control-sm" name="valid_at"  v-model="inventoryMission.valid_at">
+                            </span>
+
+                            <span class="mr-3 text-nowrap"><span class="font-weight-bold">批号:</span>
+                                <input type="text"  class="form-control-sm" name="batch_number" v-model="inventoryMission.batch_number">
+                            </span>
+
+                            <span class="mr-3 text-nowrap"><span class="font-weight-bold">盘点人:</span>
+                                <span v-if="inventoryMission.stockInventoryPersons &&!listMode" class="text-muted" :rowspan="inventoryMission.is_multi_row?2:''">
+                                <a href="#" v-if="inventoryMission.stockInventoryPersons.length>0"  class="dropdown-toggle"  data-toggle="dropdown">
+                                             @{{ inventoryMission.stockInventoryPersons[0].mark }}<b class="caret"></b>
+                                </a>
+                            <div style="position: absolute;width:320px;margin-left:-100px;background-color: white;max-height:150px ;overflow-y:auto" class="small mt-0 dropdown-menu">
+                                 <table class="table table-sm table-striped table-bordered">
+                                    <tr>
+                                        <th>盘点人</th>
+                                        <th>时间</th>
+                                    </tr>
+                                    <tr v-for="stockInventoryPerson in inventoryMission.stockInventoryPersons">
+                                     <td>@{{ stockInventoryPerson.mark }}</td>
+                                     <td>@{{ stockInventoryPerson.created_at }}</td>
+                                    </tr>
+                                </table>
+                        </div>
+                        </span>
+                            </span>
+                            <span class="mr-3 text-nowrap"><span >属性仓:</span><span>@{{ inventoryMission.erp_type_position }}</span></span>
+                            <span class="mr-3 text-nowrap"><span >质量状态:</span><span>@{{ inventoryMission.quality }}</span></span>
+                            <div>
+                                <span class="mr-3 text-nowrap"><span style="color:#783000" >库存数量:</span><span style="color:#af7651">@{{ inventoryMission.stored_amount }}</span></span>
+                                <span class="mr-3 text-nowrap"><span style="color:#783000" >盘点数量:</span><span style="color:#af7651">@{{ inventoryMission.verified_amount }}</span></span>
+                                <span class="mr-3 text-nowrap"><span style="color:#783000" >复盘数量:</span><span style="color:#af7651">@{{ inventoryMission.re_checked_amount }}</span></span>
+                                <span class="mr-3 text-nowrap"><span style="color:#783000" >盘点差异:</span><span >@{{ inventoryMission.difference_amount }}</span></span>
+                            </div>
+                            <div>
+                                <span  class="mr-3 text-nowrap"><span class="font-weight-bold">操作:</span>
+                                <span class="btn btn-sm btn-outline-primary" @click="盘点选中任务(inventoryMission.id,inventoryMission.produced_at,inventoryMission.valid_at,inventoryMission.batch_number)">选定盘点</span>
+                            </span>
+                            </div>
+                        </div>
+                    </div>
+                </td>
+            </tr>
+        </table>
+        <!--盘点记录移动端-->
         <table id="listOnPad" class="table table-striped table-sm table-bordered table-hover p-0 d-table  d-xl-none" style="background: rgb(255, 255, 255);" >
             <tbody>
             <tr v-for="inventoryMission in inventoryMissions" v-if="inventoryMission.checked==='是'||inventory.status==='复盘中'||listMode"
@@ -199,7 +321,7 @@
                             </div>
                             <div v-if="!listMode">
                                 <span  class="mr-3 text-nowrap"><span class="font-weight-bold">操作:</span>
-                                <span class="btn  btn-sm btn-outline-danger" @click="删除盘点记录(inventoryMission.id,inventoryMission.inventory_account_id,inventoryMission.commodity.name)">删除</span>
+                                <span class="btn  btn-sm btn-outline-danger" @click="删除盘点记录(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">删除</span>
                             </span>
                             </div>
                         </div>
@@ -208,6 +330,51 @@
             </tr>
             </tbody>
         </table>
+        <!--上次盘点记录-->
+        <div class="modal" id="lastStockInventoryRecord" tabindex="-1" role="dialog">
+            <div class="modal-dialog modal-xl">
+                <div class="modal-content">
+                    <div class="modal-header">
+                        <h5 class="modal-title font-weight-bold">该盘点记录已存在,是否覆盖之前记录?</h5>
+                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                            <span aria-hidden="true">&times;</span>
+                        </button>
+                    </div>
+                    <div class="modal-body">
+                        <table class="table table-sm table-striped table-bordered">
+                            <tr class="text-muted text-center">
+                                <th>库位</th>
+                                <th>产品名</th>
+                                <th>产品条码</th>
+                                <th>产品编号</th>
+                                <th>库存数量</th>
+                                <th>盘点数量</th>
+                                <th>盘点差异</th>
+                                <th>盘点人</th>
+                                <th>时间</th>
+                            </tr>
+                            <tr class="text-center " >
+                                <td>@{{ inventoryMissionRecord.location }}</td>
+                                <td><span v-if="inventoryMissionRecord.commodity">@{{ inventoryMissionRecord.commodity.name }}</span></td>
+                                <td><span v-if="inventoryMissionRecord.commodity">@{{ inventoryMissionRecord.commodity.barcode }}</span></td>
+                                <td><span v-if="inventoryMissionRecord.commodity">@{{ inventoryMissionRecord.commodity.sku }}</span></td>
+                                <td>@{{ inventoryMissionRecord.stored_amount }}</td>
+                                <td>@{{ inventoryMissionRecord.verified_amount }}</td>
+                                <td>@{{ inventoryMissionRecord.difference_amount }}</td>
+                                <td><span v-if="stockInventoryPersons.length>0">@{{ stockInventoryPersons[0].mark }}</span></td>
+                                <td><span v-if="stockInventoryPersons.length>0">@{{ stockInventoryPersons[0].created_at }}</span></td>
+                            </tr>
+                        </table>
+                    </div>
+                    <div class="modal-footer">
+                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                            <span aria-hidden="true" class="btn btn-outline-secondary" @click="不覆盖()">否</span>
+                        </button>
+                        <button type="button" class="btn btn-primary" data-dismiss="modal" @click="覆盖()">是</button>
+                    </div>
+                </div>
+            </div>
+        </div>
     </div>
 
 
@@ -255,6 +422,8 @@
                 checkData: [],
                 selectedStyle:'',
                 inventoryMissionRecord:{},
+                stockInventoryPersons:[],
+                inventoryAccountMissions:[],
                 listMode:false,
                 中:'3232lll',
             },
@@ -335,7 +504,7 @@
                                 return;
                             }
                             listVue.submitStockInventory();
-                            $("#form .input").val(' ');
+                            //$("#form .input").val(' ');
                             document.getElementById('inventoryInput').focus();
                         } else {
                             inputs[idx + 1].focus(); // 设置焦点
@@ -357,6 +526,7 @@
                     let location=document.getElementById('inventoryInput').value.trim();
                     let inventoryId=_this.inventory.id;
                     let barcodes=[];
+                    setData(location,barcode,inventoryId,count);
                     _this.inventoryMissions.forEach(function (inventoryMission) {
                         barcodes.push(inventoryMission.commodity.barcode);
                     });
@@ -386,6 +556,11 @@
                             });
                         }
                     }
+                    _this.inventoryMissions.forEach(function (inventoryMission,i) {
+                        if (inventoryMission.location===location && barcode===inventoryMission.commodity.barcode){
+                            _this.inventoryAccountMissions.push(inventoryMission);
+                        }
+                    });
                 },
                 //提交盘点
                 submitStockInventory(){
@@ -402,51 +577,37 @@
                         document.getElementById('inventoryInput').focus();
                         return;
                     }
-                    if (_this.inventory.status==='盘点中'||_this.inventory.status==='待盘点'){
-                        if (!locations.includes(location)){
+                    if (!locations.includes(location)){
+                        if (_this.inventory.status==='盘点中'||_this.inventory.status==='待盘点'){
                             if(!confirm('该'+location+'库位在系统盘点记录中不存在!'+'确定是否需要添加至系统盘点记录中?')){return};
                             this.增加系统之外的库位记录(location,barcode,count,inventoryId);
-                            return;
                         }
+                        return;
                     }
-                    let url='{{url('inventory/stockInventory')}}';
-                    axios.post(url,{location:location,barcode:barcode,count:count,inventoryId:inventoryId})
-                        .then(function (response) {
-                            if (!response.data.success){
-                                tempTip.setDuration(2000);
-                                tempTip.show('盘点失败!'+'   '+response.data.data);
-                                return;
-                            }
-                            if (_this.inventory.id===response.data.inventory.id){
-                                _this.inventory.processed=response.data.inventory.processed;
-                                _this.inventory.surplus=response.data.inventory.surplus;
-                                _this.inventory.check_surplus=response.data.inventory.check_surplus;
-                            }
+                    if ( _this.inventoryAccountMissions.length>1){
+                        alert('该库位和产品条码下存在多条盘点任务,请选中您需要盘点的任务');
+                    }else {
+                        if (_this.inventory.status!=='复盘中'){
                             _this.inventoryMissions.every(function (inventoryMission,i) {
-
-                                if (parseInt(inventoryMission.id)===parseInt(response.data.inventoryMission.id)){
-                                    inventoryMission.checked=response.data.inventoryMission.checked;
-                                    inventoryMission.verified_amount=response.data.inventoryMission.verified_amount;
-                                    inventoryMission.difference_amount=response.data.inventoryMission.difference_amount;
-                                    inventoryMission.re_checked_amount=response.data.inventoryMission.re_checked_amount;
-                                    inventoryMission.stockInventoryPersons=response.data.stockInventoryPersons;
-                                    _this.inventoryMissions.splice(i,1)
-                                    _this.inventoryMissions.unshift(inventoryMission);
+                                if (inventoryMission.location===location && barcode===inventoryMission.commodity.barcode){
+                                    if (inventoryMission.stockInventoryPersons.length>0){
+                                        _this.inventoryMissionRecord=inventoryMission;
+                                        _this.stockInventoryPersons=inventoryMission.stockInventoryPersons;
+                                        $("#lastStockInventoryRecord").modal('show');
+                                    }else{
+                                        //初盘且未盘点过
+                                        _this.盘点(location,barcode,inventoryId,count);
+                                        _this.inventoryAccountMissions=[];
+                                    }
                                     return false;
                                 }
                                 return true;
                             });
-                            _this.重排序并标记全列表类型(_this.inventoryMissions);
-                            tempTip.setDuration(3000);
-                            tempTip.showSuccess('盘点成功!');
-                        }).catch(function (err) {
-                        tempTip.setDuration(2000);
-                        tempTip.show('盘点失败!'+'网络错误'+err);
-                    })
+                        }
+                    }
                 },
                 //结束初盘任务
                 stockInventoryEnd(id){
-                    if(!confirm('确定要结束初盘并进入复盘吗?该操作不可撤消'))return;
                     let _this=this;
                     let url='{{url('inventory/stockInventoryEnd')}}';
                     axios.post(url,{id:id}).then(function (response) {
@@ -515,7 +676,6 @@
                     重推入(_this.inventoryMissions,_this.无差异列);
                 },
                 按库位排序_且合并SKU一起(inventoryMissions){
-                    let _this=this;
                     let 结果列=[];
                     let 已出现字典列=[];
                     inventoryMissions.sort(function(a,b){
@@ -554,7 +714,6 @@
                         }
                     }
                     迭代查重转移(inventoryMissions)
-                    _this.将相邻同样条目总数匹配的标记_供样式使用(结果列)
                     return 结果列;
                 },
                 删除盘点记录(inventoryAccountMissionId,inventoryAccountId,name){
@@ -571,23 +730,21 @@
                                     if (response.data.data>0&&inventoryAccountMission.id===inventoryAccountMissionId){
                                         _this.inventoryMissions.splice(i,1);
                                         return false;
-                                    }else {
-                                        return true
                                     }
+                                    return true
                                 });
                                 tempTip.setDuration(3000);
                                 tempTip.showSuccess('盘点记录:'+inventoryAccountMissionId+'删除成功!');
                             }
-                        }
-                    ).catch(function (err) {
+                        }).catch(function (err) {
                         tempTip.setDuration(3000);
                         tempTip.show('删除失败,网络链接错误!'+err);
                     });
                 },
-                盘点任务完结(id,owner_name,type){
+                完结盘点任务(id,owner_name,type){
                     let _this=this;
                     if(!confirm('确定完结货主为:“'+owner_name+'”的“'+type+'”任务吗?')){return};
-                    let url = '{{url('inventory/盘点任务完结')}}/'+id;
+                    let url = '{{url('inventory/完结盘点任务')}}/'+id;
                     axios.get(url).then(function (response) {
                         if(!response.data.success){
                             tempTip.setDuration(3000);
@@ -615,15 +772,16 @@
                                 tempTip.setDuration(3000);
                                 tempTip.show('增加系统之外的库位记录失败!');
                             }else {
-                                _this.inventoryMissions.push(response.data.data);
+                                _this.inventoryMissions.push(response.data.inventoryAccountMission);
                                 _this.inventoryMissions.every(function (inventoryAccountMission,i) {
-                                    if (parseInt(inventoryAccountMission.id)===parseInt(response.data.data.id)){
-                                        _this.inventoryMissions.splice(i,1)
+                                    if (parseInt(inventoryAccountMission.id)===parseInt(response.data.inventoryAccountMission.id)){
+                                        inventoryAccountMission=response.data.inventoryAccountMission;
+                                        inventoryAccountMission.stockInventoryPersons=response.data.stockInventoryPersons;
+                                        _this.inventoryMissions.splice(i,1);
                                         _this.inventoryMissions.unshift(inventoryAccountMission);
                                         return false;
-                                    }else {
-                                        return true
                                     }
+                                    return true
                                 });
                                 _this.重排序并标记全列表类型(_this.inventoryMissions);
                                 tempTip.setDuration(3000);
@@ -666,6 +824,129 @@
                 清理标记(mission){
                     mission.hasLinkingGroup=false;
                 },
+                盘点(location,barcode,inventoryId,count){
+                    let _this=this;
+                    let url='{{url('inventory/stockInventory')}}';
+                    axios.post(url,{location:location,barcode:barcode,count:count,inventoryId:inventoryId})
+                        .then(function (response) {
+                            if (!response.data.success){
+                                tempTip.setDuration(2000);
+                                tempTip.show('盘点失败!'+'   '+response.data.data);
+                                return;
+                            }
+                            if (_this.inventory.id===response.data.inventory.id){
+                                _this.inventory.processed=response.data.inventory.processed;
+                                _this.inventory.surplus=response.data.inventory.surplus;
+                                _this.inventory.check_surplus=response.data.inventory.check_surplus;
+                            }
+                            _this.inventoryMissions.every(function (inventoryMission,i) {
+                                if (parseInt(inventoryMission.id)===parseInt(response.data.inventoryMission.id)){
+                                    inventoryMission.checked=response.data.inventoryMission.checked;
+                                    inventoryMission.verified_amount=response.data.inventoryMission.verified_amount;
+                                    inventoryMission.difference_amount=response.data.inventoryMission.difference_amount;
+                                    inventoryMission.re_checked_amount=response.data.inventoryMission.re_checked_amount;
+                                    inventoryMission.stockInventoryPersons=response.data.stockInventoryPersons;
+                                    _this.inventoryMissions.splice(i,1)
+                                    _this.inventoryMissions.unshift(inventoryMission);
+                                    return false;
+                                }
+                                return true;
+                            });
+                            _this.重排序并标记全列表类型(_this.inventoryMissions);
+                            $("#form .input").val(' ');
+                            tempTip.setDuration(3000);
+                            tempTip.showSuccess('盘点成功!');
+                        }).catch(function (err) {
+                        tempTip.setDuration(2000);
+                        tempTip.show('盘点失败!'+'网络错误'+err);
+                    })
+                },
+                不覆盖(){
+                    let _this=this;
+                    let arr=getData();
+                    let location=arr[0];
+                    let barcode=arr[1];
+                    _this.inventoryAccountMissions.forEach(function (inventoryMission,i) {
+                        if (inventoryMission.location===location && barcode===inventoryMission.commodity.barcode){
+                            _this.inventoryAccountMissions.splice(i,1);
+                        }
+                    });
+                    $("#form .input").val(' ');
+                },
+                覆盖(){
+                    let _this=this;
+                    let arr=getData();
+                    let location=arr[0];
+                    let barcode=arr[1];
+                    let inventoryId=arr[2];
+                    let count=document.getElementById('count').value.trim();
+                    _this.inventoryAccountMissions.forEach(function (inventoryMission,i) {
+                        if (inventoryMission.location===location && barcode===inventoryMission.commodity.barcode){
+                            _this.inventoryAccountMissions.splice(i,1);
+                        }
+                    });
+                    this.盘点(location,barcode,inventoryId,count);
+                },
+                盘点选中任务(id,produced_at,valid_at,batch_number){
+                    let _this=this;
+                    let arr=getData();
+                    let location=arr[0];
+                    let barcode=arr[1];
+                    let inventoryId=arr[2];
+                    let count=document.getElementById('count').value.trim();
+                    _this.inventoryAccountMissions.forEach(function (inventoryMission,i) {
+                        if (inventoryMission.location===location && barcode===inventoryMission.commodity.barcode){
+                            _this.inventoryAccountMissions.splice(i,_this.inventoryAccountMissions.length);
+                        }
+                    });
+
+                    let url='{{url('inventory/盘点选中任务')}}';
+                    axios.post(url,{id:id,count:count,inventoryId:inventoryId,produced_at:produced_at,valid_at:valid_at,batch_number:batch_number})
+                        .then(function (response) {
+                            if (!response.data.success){
+                                tempTip.setDuration(2000);
+                                tempTip.show('盘点失败!'+'   '+response.data.data);
+                                return;
+                            }
+                            if (_this.inventory.id===response.data.inventory.id){
+                                _this.inventory.processed=response.data.inventory.processed;
+                                _this.inventory.surplus=response.data.inventory.surplus;
+                                _this.inventory.check_surplus=response.data.inventory.check_surplus;
+                            }
+                            if (response.data.inventoryMission.length>1){
+                                tempTip.setDuration(3000);
+                                tempTip.showSuccess('盘点成功!');
+                                setTimeout(function () {
+                                    window.location.reload();
+                                },1000);
+                            }else {
+                                _this.inventoryMissions.every(function (inventoryMission,i) {
+                                    if (parseInt(inventoryMission.id)===parseInt(response.data.inventoryMission.id)){
+                                        inventoryMission.checked=response.data.inventoryMission.checked;
+                                        inventoryMission.verified_amount=response.data.inventoryMission.verified_amount;
+                                        inventoryMission.difference_amount=response.data.inventoryMission.difference_amount;
+                                        inventoryMission.re_checked_amount=response.data.inventoryMission.re_checked_amount;
+                                        inventoryMission.stockInventoryPersons=response.data.stockInventoryPersons;
+                                        _this.inventoryMissions.splice(i,1);
+                                        _this.inventoryMissions.unshift(inventoryMission);
+                                        return false;
+                                    }
+                                    return true;
+                                });
+                                _this.重排序并标记全列表类型(_this.inventoryMissions);
+                                $("#form .input").val(' ');
+                                tempTip.setDuration(3000);
+                                tempTip.showSuccess('盘点成功!');
+                            }
+                        }).catch(function (err) {
+                        tempTip.setDuration(2000);
+                        tempTip.show('盘点失败!'+'网络错误'+err);
+                    })
+                },
+
+
+
+
                 // 单条排序并着色(inventoryMission){
                 //     let _this=this;
                 //     let 所在临时分类列=[];
@@ -678,7 +959,19 @@
                 //     }
                 // },
             }
+
         });
+        let loc = null;
+        let code = null;
+        let inventory_id = 0;
+        function setData(location,barcode,inventoryId) {
+            loc = location;
+            code = barcode;
+            inventory_id = inventoryId;
+        }
+        function getData() {
+            return [loc,code,inventory_id];
+        }
     </script>
 @endsection
 

+ 5 - 3
resources/views/order/index/delivering.blade.php

@@ -590,19 +590,21 @@
                     tempTip.waitingTip('处理中,请稍候');
                     let data = {orderNos:this.checkData,typeId: this.typeId,result_explain:this.result_explain};
                     axios.post("{{url('apiLocal/order/issue/orderIssueTag')}}",data).then(function(res){
+                        console.log(22);
                         tempTip.setDuration(5000)
                         tempTip.cancelWaitingTip();
-                        if(res.data.success){
-                            tempTip.setDuration(3000);
+                        if(res.data.success){console.log(11);
+                        tempTip.setDuration(3000);
                             tempTip.showSuccess('已标记为问题件,稍后前往订单问题件查询页面');
                             setTimeout(function(){
                                 window.location.href = "{{url('order/issue/index')}}";
                             },1000);
-                        }else{
+                        }else{ console.log(22);
                             tempTip.setDuration(4000);
                             tempTip.show(res.data.fail_info);
                         }
                     }).catch(function(err){
+                        console.log(err);
                         tempTip.setDuration(3000);
                         tempTip.cancelWaitingTip();
                         tempTip.show('网络链接异常'+err);

+ 8 - 3
resources/views/order/issue/edit.blade.php

@@ -150,7 +150,7 @@
                 <div class="form-group row">
                     <label class="col-2 col-form-label text-right"></label>
                     <div class="col-8">
-                        <button type="submit" class="btn btn-success form-control" @click="submitFake">提交修改
+                        <button type="submit" class="btn btn-success form-control" @click="submitFake" :disabled="isSubmit">提交修改
                         </button>
                     </div>
                 </div>
@@ -195,7 +195,8 @@
                 final_status: ['已解决', '待退回', '退回中',],
                 logisticExpressRemission: ['原单减免', '部分减免', '全部减免'],
                 baoShiExpressRemission: ['原单减免', '部分减免', '全部减免'],
-                logistic_number:@if($rejectedBill)'{!! $rejectedBill->logistic_number_return !!}'@else ''@endif
+                logistic_number:@if($rejectedBill)'{!! $rejectedBill->logistic_number_return !!}'@else ''@endif,
+                isSubmit:false
             },
             mounted: function () {
                 $("#editOrderIssue").removeClass('d-none');
@@ -242,6 +243,7 @@
                     if( logistic_number_return === null || logistic_number_return == '' ){
                         this.rejectedBill = {logistic_number_return:logistic_number_return} ;
                         this.orderIssues.rejected_bill_id = null;
+                        this.isSubmit = false;
                         return ;
                     }
                     let data = {logisticNumberReturn:logistic_number_return};
@@ -252,6 +254,7 @@
                                 _this.rejectedBill.id_logistic_return = res.data.rejectedBill.id_logistic_return;
                                 _this.rejectedBill.id_owner = res.data.rejectedBill.id_owner;
                                 _this.orderIssues.rejected_bill_id = res.data.rejectedBill.id;
+                                _this.isSubmit = false;
                             }
                             if(res.data.msg){
                                 tempTip.setDuration(2000);
@@ -263,10 +266,12 @@
                                 tempTip.showSuccess('找到对应的问题单');
                             }
                         }else{
+                            _this.isSubmit = true;
                             tempTip.setDuration(4000);
-                            tempTip.show(res.data.fain_info);
+                            tempTip.show(res.data.fail_info);
                         }
                     }).catch(function(err){
+                        _this.isSubmit = true;
                         tempTip.setDuration(4000);
                         tempTip.show('网络异常:' + err);
                     });

+ 152 - 155
resources/views/order/issue/index.blade.php

@@ -19,11 +19,13 @@
                             <a class="dropdown-item" @click="orderIssueExport(true)" href="javascript:">导出所有页</a>
                         </div>
                     </span>
+                    @cannot('客户不可见')
                     <span class="ml-1">
                         <button type="button" class="btn btn-outline-dark btn-sm form-control-sm  to ltipTarget"
                                 @click="endOrderIssue"
                                 :class="[checkData.length>0?'btn-dark text-light':'']">完结</button>
                     </span>
+                    @endcannot
                     <span class="ml-1">
                         <button type="button" class="btn btn-outline-dark btn-sm form-control-sm  tooltipTarget"
                                 @click="copyOrderNo">复制快递单号</button>
@@ -32,27 +34,41 @@
                 <table class="table table-sm  table-bordered table-hover card-body table-responsive-sm p-0 m-0 "
                        style="background: #fff;min-width: 3000px;">
                     <tr class="tr-yellow" align="center">
-                        <th class=" font-weight-bolder " colspan="7"></th>
+                        <th class=" font-weight-bolder "  @cannot('客户不可见')  colspan="7" @else colspan="4"    @endcannot></th>
                         <th class="td-yellow  font-weight-bolder original-class table-head-warning "
-                            :colspan="isShowOrderInfo ? '16':'8'"><span>原始运单号</span>
-                            <button class="btn btn-sm btn-outline-secondary float-right" v-if="isShowOrderInfo"
-                                    @click="hideOrderInfo">隐藏运单列
+                            @cannot('客户不可见') :colspan="(isShowOrderInfo ? '16':'8' )" @else  :colspan="(isShowOrderInfo ? '15':'7' )"   @endcannot>
+                            <span>原始运单号</span>
+                            <button class="btn btn-sm btn-outline-secondary float-right" v-if="isShowOrderInfo" @click="hideOrderInfo">
+                                隐藏运单列
                             </button>
                         </th>
 
-                        <th class="  font-weight-bolder" :colspan="10 +  (isShowRejectedBill ? 5:1) + (isShowSecondOrderInfo ? 6: 1 )   @cannot('客户不可见') +1 @endcannot">
-                            <button class="btn btn-sm btn-outline-secondary float-left" v-if="isShowRejectedBill"
-                                    @click="hideRejectedBill">隐藏退单列
+                        <th class="  font-weight-bolder"
+                            @cannot('客户不可见')
+                            :colspan="11 +  (isShowRejectedBill ? 5:1) + (isShowSecondOrderInfo ? 6: 1 )"
+                            @else
+                            colspan="8"
+                            @endcannot>
+
+                            @cannot('客户不可见')
+                            <button class="btn btn-sm btn-outline-secondary float-left" v-if="isShowRejectedBill" @click="hideRejectedBill">
+                                隐藏退单列
                             </button>
+                            @endcannot
                             情况说明
-                            <button class="btn btn-sm btn-outline-secondary" v-if="isShowSecondOrderInfo"
-                                    @click="hideSecondOrder">隐藏运单列
+                            @cannot('客户不可见')
+                            <button class="btn btn-sm btn-outline-secondary" v-if="isShowSecondOrderInfo" @click="hideSecondOrder">
+                                隐藏运单列
                             </button>
+                            @endcannot
                         </th>
+                        @cannot('客户不可见')
                         <th></th>
+                        @endcannot
                     </tr>
 
                     <tr class="tr-yellow" align="center">
+
                         <th rowspan="2" class="align-middle">
                             <label for="all">
                                 <input id="all" type="checkbox" @click="checkAll($event)"/>
@@ -60,97 +76,81 @@
                         </th>
                         <th class=" align-middle" rowspan="2" style=" min-width: 50px;">序号</th>
                         <th class=" align-middle" rowspan="2" style=" min-width: 25px;">ID</th>
+                        @cannot('客户不可见')
                         <th class=" align-middle" rowspan="2" style=" min-width: 75px;">退件</th>
                         @can("订单管理-问题件-置顶")
-                            <th class=" align-middle" rowspan="2" style=" min-width: 75px;">置顶</th>
+                        <th class=" align-middle" rowspan="2" style=" min-width: 75px;">置顶</th>
                         @endcan
                         <th class=" align-middle" rowspan="2" style=" min-width: 100px;">退单状态</th>
+                        @endcannot
                         <th class=" align-middle" rowspan="2" style="min-width: 120px">最终状态</th>
+                        @cannot('客户不可见')
                         <th class=" align-middle td-yellow" rowspan="2" style="min-width: 165px;">登记日期</th>
+                        @endcannot
+
                         <th class=" align-middle td-yellow" rowspan="2" style="min-width: 165px;">订单日期</th>
                         <th class=" align-middle td-yellow" rowspan="2" style="min-width: 100px;">客户</th>
                         <th class=" align-middle td-yellow" rowspan="2" style="min-width: 200px;">店铺</th>
                         <th class=" align-middle td-yellow" rowspan="2" style="min-width: 200px;">客户订单号</th>
                         <th class=" align-middle td-yellow" rowspan="2" style="min-width: 100px;">原始承运商</th>
                         <th class=" align-middle td-yellow" rowspan="2" style="min-width: 150px;">原始运单号</th>
-                        <th class=" align-middle td-yellow" v-if="!isShowOrderInfo" rowspan="2"
-                            style="min-width:50px">展开
-                        </th>
-                        <th class=" align-middle td-yellow" v-if="isShowOrderInfo" rowspan="2"
-                            style="min-width: 90px">收货人名称
-                        </th>
-                        <th class=" align-middle td-yellow" v-if="isShowOrderInfo" rowspan="2"
-                            style=" min-width: 120px;">收货人电话
-                        </th>
-                        <th class=" align-middle td-yellow" v-if="isShowOrderInfo" rowspan="2"
-                            style="min-width: 70px">省
-                        </th>
-                        <th class=" align-middle td-yellow" v-if="isShowOrderInfo" rowspan="2"
-                            style="min-width: 70px">市
-                        </th>
-                        <th class=" align-middle td-yellow" v-if="isShowOrderInfo" rowspan="2"
-                            style="min-width: 70px">区
-                        </th>
-                        <th class=" align-middle td-yellow" v-if="isShowOrderInfo" rowspan="2" style=" min-width:300px">
-                            收货人地址
-                        </th>
-                        <th class=" align-middle  td-yellow" v-if="isShowOrderInfo" colspan="3" style="min-width:300px">
-                            原始商品明细
-                        </th>
-                        <th class="  align-middle" rowspan="2" v-if="!isShowRejectedBill" style="min-width:50px">
-                            展开
-                        </th>
-                        <th class="  align-middle" colspan="5" v-if="isShowRejectedBill" style="min-width: 450px">
-                            返回商品明细
-                        </th>
+                        {{--原始商品明细 开始--}}
+                        <th class=" align-middle td-yellow" v-if="!isShowOrderInfo" rowspan="2" style="min-width:50px">展开</th>
+                        <th class=" align-middle td-yellow" v-if="isShowOrderInfo" rowspan="2" style="min-width: 90px">收货人名称</th>
+                        <th class=" align-middle td-yellow" v-if="isShowOrderInfo" rowspan="2" style="min-width: 120px;">收货人电话</th>
+                        <th class=" align-middle td-yellow" v-if="isShowOrderInfo" rowspan="2" style="min-width: 70px">省</th>
+                        <th class=" align-middle td-yellow" v-if="isShowOrderInfo" rowspan="2" style="min-width: 70px">市</th>
+                        <th class=" align-middle td-yellow" v-if="isShowOrderInfo" rowspan="2" style="min-width: 70px">区</th>
+                        <th class=" align-middle td-yellow" v-if="isShowOrderInfo" rowspan="2" style="min-width:300px">收货人地址</th>
+                        <th class=" align-middle td-yellow" v-if="isShowOrderInfo" colspan="3" style="min-width:300px">原始商品明细</th>
+{{--                        @cannot('客户不可见')--}}
+                        <th class="  align-middle" rowspan="2" v-if="!isShowRejectedBill" style="min-width:50px">展开</th>
+                            <th class=" align-middle" rowspan="2" v-if="isShowRejectedBill" style="min-width:75px">退回单号</th>
+                        <th class="  align-middle" colspan="5" v-if="isShowRejectedBill" style="min-width: 450px">返回商品明细</th>
+{{--                        @endcannot--}}
                         <th class="bg-whit  align-middle" rowspan="2" style="min-width: 115px">情况说明</th>
                         <th class="  align-middle" rowspan="2" style="min-width: 115px">问题类别</th>
                         <th class="  align-middle" colspan="3" style="min-width: 115px">处理结果</th>
-                        <th class="  align-middle" rowspan="2" v-if="!isShowSecondOrderInfo"
-                            style="width:50px">展开
-                        </th>
-                        <th class="  align-middle" rowspan="2" v-if="isShowSecondOrderInfo" style=" min-width: 120px;">
-                            二次客户订单号
-                        </th>
-                        <th class="  align-middle" rowspan="2" v-if="isShowSecondOrderInfo" style=" min-width: 100px;">
-                            二次承运商
-                        </th>
-                        <th class="  align-middle" rowspan="2" v-if="isShowSecondOrderInfo" style=" min-width: 200px;">
-                            二次运单号
-                        </th>
-                        <th  colspan="3" style="min-width: 300px" v-if="isShowSecondOrderInfo"
-                            style=" min-width: 350px;">
-                            二次商品明细
-                        </th>
                         @cannot('客户不可见')
-                            <th class="  align-middle" rowspan="2" style="min-width: 120px">承运商赔偿金额</th>
+                        <th class="  align-middle" rowspan="2" v-if="!isShowSecondOrderInfo" style="width:50px">展开</th>
+                        <th class="  align-middle" rowspan="2" v-if="isShowSecondOrderInfo" style=" min-width: 120px;">二次客户订单号</th>
+                        <th class="  align-middle" rowspan="2" v-if="isShowSecondOrderInfo" style=" min-width: 100px;">二次承运商</th>
+                        <th class="  align-middle" rowspan="2" v-if="isShowSecondOrderInfo" style=" min-width: 200px;">二次运单号</th>
+                        <th  colspan="3" style="min-width: 300px" v-if="isShowSecondOrderInfo" style=" min-width: 350px;">二次商品明细</th>
                         @endcannot
+                        <th class="  align-middle" rowspan="2" style="min-width: 120px">承运商赔偿金额</th>
                         <th class="  align-middle" rowspan="2" style="min-width: 120px">承运商快递减免</th>
+                        @cannot('客户不可见')
                         <th class="  align-middle" rowspan="2" style="min-width: 120px">宝时赔偿金额</th>
                         <th class="  align-middle" rowspan="2" style="min-width: 120px">宝时快递减免</th>
                         <th class="  align-middle" rowspan="2" style="min-width: 120px">事故责任方</th>
                         <th class="  align-middle" rowspan="2" style="min-width: 120px">操作</th>
+                        @endcannot
                     </tr>
                     <tr class="tr-yellow" align="center">
                         <th class="td-yellow" v-if="isShowOrderInfo" style="min-width: 120px">条码</th>
                         <th class="td-yellow" v-if="isShowOrderInfo" style="min-width: 150px">商品名</th>
                         <th class="td-yellow" v-if="isShowOrderInfo" style="min-width: 75px">数量</th>
+                        @cannot('客户不可见')
                         <th  v-if="isShowRejectedBill" style="min-width: 75px">条码</th>
                         <th  v-if="isShowRejectedBill" style="min-width: 100px">商品名</th>
                         <th  v-if="isShowRejectedBill" style="min-width: 50px">数量</th>
                         <th  v-if="isShowRejectedBill" style="min-width: 50px">是否正品</th>
                         <th  v-if="isShowRejectedBill" style="min-width: 100px">备注</th>
+                        @endcannot
                         <th  style="min-width: 75px">操作类型</th>
                         <th  style="min-width: 120px">说明</th>
                         <th  style="min-width: 100px">操作者</th>
+                        @cannot('客户不可见')
                         <th  v-if="isShowSecondOrderInfo" style="min-width: 100px">条码</th>
                         <th  v-if="isShowSecondOrderInfo" style="min-width: 100px">商品名</th>
                         <th  v-if="isShowSecondOrderInfo" style="min-width: 75px">数量</th>
+                        @endcannot
                     </tr>
-                    <tr class="tr-yellow"  align="center" v-if="orderIssues" v-for="(orderIssue,index) in orderIssues"
-                        @click="selectedColor(orderIssue.id)"
-                        :class="orderIssue.remark ? 'tr_top':''"
-                        v-on:mouseover="hidetop($event)" v-on:mouseleave="showtop($event)"
+
+
+                    <tr class="tr-yellow text-center"  v-if="orderIssues" v-for="(orderIssue,index) in orderIssues"
+                        @click="selectedColor(orderIssue.id)" :class="orderIssue.remark ? 'tr_top':''" v-on:mouseover="hidetop($event)" v-on:mouseleave="showtop($event)"
                         :style="[{'font-weight': orderIssue.id===selectedStyle?'bold':''}]">
                         <td>
                             <div class="m-0 p-0 " :style="[{'min-height':orderIssue.remark ?'72px':'45px'}]">
@@ -159,40 +159,54 @@
                         </td>
                         <td >@{{index+1}}</td>
                         <td >@{{ orderIssue.id }}</td>
+                        @cannot('客户不可见')
                         <td >
                             @can('订单管理-问题件-编辑')
-                                <button type="button" class="btn btn-sm btn-outline-secondary"
-                                        @click="disposeOrderIssue($event)" :data-value="orderIssue.id"
-                                        v-if="orderIssue.is_new_rejecting === '有'">有
-                                </button>
-                                <span v-else>@{{ orderIssue.is_new_rejecting }}</span>
+                            <button type="button" class="btn btn-sm btn-outline-secondary"
+                                    @click="disposeOrderIssue($event)" :data-value="orderIssue.id"
+                                    v-if="orderIssue.is_new_rejecting === '有'">有
+                            </button>
+                            <span v-else>@{{ orderIssue.is_new_rejecting }}</span>
                             @else
-                                <span v-if="orderIssue.is_new_rejecting">@{{ orderIssue.is_new_rejecting }}</span>
+                            <span v-if="orderIssue.is_new_rejecting">@{{ orderIssue.is_new_rejecting }}</span>
                             @endcan
                         </td>
+
+
                         @can("订单管理-问题件-置顶")
-                            <td class="text-muted">
-                                <button type="button" class="btn btn-sm btn-outline-danger "
-                                        @click="cancelOnTop($event)" :data-value="orderIssue.top.id"
-                                        style="opacity: 0.75" v-if="orderIssue.top">取消
-                                </button>
-                                <button type="button" class="btn btn-sm btn-outline-secondary"
-                                        @click="OrderIssueOnTop($event)" :data-value="orderIssue.id"
-                                        style="opacity: 0.75" v-else>置顶
-                                </button>
-                            </td>
+                        <td class="text-muted">
+                            <button type="button" class="btn btn-sm btn-outline-danger " @click="cancelOnTop($event)" :data-value="orderIssue.top.id" style="opacity: 0.75" v-if="orderIssue.top">
+                                取消
+                            </button>
+                            <button type="button" class="btn btn-sm btn-outline-secondary" @click="OrderIssueOnTop($event)" :data-value="orderIssue.id" style="opacity: 0.75" v-else>
+                                置顶
+                            </button>
+                        </td>
+                        <td >@{{ orderIssue.rejecting_status }}</td>{{--退件状态--}}
                         @endcan
-                        <td >@{{ orderIssue.rejecting_status }}</td>
-                        <td >@{{ orderIssue.final_status }}</td>
+                        @endcannot
+
+
+                        <td >@{{ orderIssue.final_status }}</td>{{--最终状态--}}
+                        @cannot('客户不可见')  {{--登记日期--}}
                         <td class="toptd td-yellow ">
                             <div v-if="orderIssue.remark" class="bg-light-yellow  text-danger top text-left" data-toggle="tooltip" style="opacity: 0.1;position: absolute;z-index: 1">
                                 置顶备注:@{{ orderIssue.remark }}
                             </div>
                             @{{ orderIssue.created_at }}
                         </td>
+                        @endcannot
+
                         <td class="td-yellow">
+                            @cannot('客户不可见')
+                            @else
+                            <div v-if="orderIssue.remark" class="bg-light-yellow  text-danger top text-left" data-toggle="tooltip" style="opacity: 0.1;position: absolute;z-index: 1">
+                                置顶备注:@{{ orderIssue.remark }}
+                            </div>
+                            @endcannot
                             @{{ orderIssue.order.created_at }}
                         </td>
+
                         <td class="td-yellow">
                             <span v-if='orderIssue.order.owner'>@{{ orderIssue.order.owner.name }}</span>
                         </td>
@@ -204,77 +218,67 @@
                         <td class="td-yellow">
                             <span v-if='orderIssue.order.logistic'>@{{ orderIssue.order.logistic.name }}</span>
                         </td>
-
                         <td class=" hide-content p-0 td-yellow " valign="middle" align="center">
-                            <div :id="'logisticNumbers'+orderIssue.id"
-                                 :class="orderIssue.order.logisticNumbers.length > 1 ?'collapse ':''">
-                                <p v-for="logisticNumber in orderIssue.order.logisticNumbers"
-                                   class="m-0 p-0  text-muted ">@{{ logisticNumber }}</p>
+                            <div :id="'logisticNumbers'+orderIssue.id" :class="orderIssue.order.logisticNumbers.length > 1 ?'collapse ':''">
+                                <p v-for="logisticNumber in orderIssue.order.logisticNumbers" class="m-0 p-0  text-muted ">@{{ logisticNumber }}</p>
                             </div>
-                            <button v-if="orderIssue.order.logisticNumbers.length > 1" type="button"
-                                    class="btn btn-sm btn-outline-primary   align-middle mt-1"
-                                    :id="'logisticNumbersBtn'+orderIssue.id"
-                                    data-toggle="collapse"
-                                    :data-target="'#logisticNumbers'+orderIssue.id"
+                            <button v-if="orderIssue.order.logisticNumbers.length > 1" type="button" class="btn btn-sm btn-outline-primary   align-middle mt-1"
+                                    :id="'logisticNumbersBtn'+orderIssue.id" data-toggle="collapse" :data-target="'#logisticNumbers'+orderIssue.id"
                                     @click="toggleLogisticNumbers(orderIssue.id,orderIssue.order.logisticNumbers.length)">
                                 分箱@{{ orderIssue.order.logisticNumbers.length }}件,点击展开
                             </button>
                         </td>
+                        {{--商品明细 开始--}}
                         <td class="td-yellow  p-0 m-0" v-if="!isShowOrderInfo && index===0" style="width:50px" :rowspan="orderIssues.length">
                             <span class="btn btn-outline-secondary "  @click="showOrderInfo" :style="orderIssues.length>4 ?'{height: 200px;line-height: 100px':''" >展开运单列</span>
                         </td>
 
-                        <td class="td-yellow " v-if="isShowOrderInfo">@{{ orderIssue.order.consignee_name }}
-                        </td>
-                        <td class="td-yellow " v-if="isShowOrderInfo">@{{ orderIssue.order.consignee_phone }}
-                        </td>
-                        <td class="td-yellow " v-if="isShowOrderInfo">@{{ orderIssue.order.province }}
-                        </td>
+
+                        <td class="td-yellow " v-if="isShowOrderInfo">@{{ orderIssue.order.consignee_name }}</td>
+                        <td class="td-yellow " v-if="isShowOrderInfo">@{{ orderIssue.order.consignee_phone }}</td>
+                        <td class="td-yellow " v-if="isShowOrderInfo">@{{ orderIssue.order.province }}</td>
                         <td class="td-yellow " v-if="isShowOrderInfo">@{{ orderIssue.order.city }}</td>
-                        <td class="td-yellow " v-if="isShowOrderInfo">@{{ orderIssue.order.district }}
+                        <td class="td-yellow " v-if="isShowOrderInfo">@{{ orderIssue.order.district }}</td>
+                        <td class="td-yellow " style="width: 400px" v-if="isShowOrderInfo">
+                            <span class="text-wrap m-0 p-0 " style="width: 400px">@{{ orderIssue.order.address }}</span>
                         </td>
-                        <td class="td-yellow " style="width: 400px" v-if="isShowOrderInfo"><span
-                                class="text-wrap m-0 p-0 " style="width: 400px">@{{ orderIssue.order.address }}</span>
-                        </td>
-                        <td class="td-yellow p-0" :id="orderIssue.id+'items'" valign="middle" align="center"
-                            v-if="isShowOrderInfo"
-                            colspan="3">
+                        <td class="td-yellow p-0" :id="orderIssue.id+'items'" colspan="3"
+                            v-if="isShowOrderInfo">
                             <div v-if="orderIssue.order">
-                                <table  class="table table-sm m-0"
-                                        v-if="orderIssue.order.packages"
-                                       :class="orderIssue.orderPackagecount > 1  ? 'collapse' : ''"
-                                       :id="'order'+orderIssue.id"
-                                       :data-value="orderIssue.orderCount = 0"
-                                       :data-count="orderIssue.orderPackagecount = 0">
+                                <table  class="table table-sm m-0" v-if="orderIssue.order.packages"
+                                       :class="orderIssue.orderPackagecount > 1  ? 'collapse' : ''" :id="'order'+orderIssue.id"
+                                        :data-value="orderIssue.orderCount = 0" :data-count="orderIssue.orderPackagecount = 0">
                                     <template v-for="packages in orderIssue.order.packages">
-                                        <tr v-for="item in packages.commodities"
-                                            :data-value="orderIssue.orderCount += 1" align="center">
+                                        <tr v-for="item in packages.commodities" class="text-center" :data-value="orderIssue.orderCount += 1" align="center">
                                             <td >@{{ item.commodity.sku }}</td>
                                             <td >@{{ item.commodity.name }}</td>
                                             <td  :data-value="orderIssue.orderPackagecount += item.amount ">@{{ item.amount }}</td>
                                         </tr>
                                     </template>
                                 </table>
-                                <button v-if="orderIssue.orderCount > 1 " type="button"
-                                        class="btn btn-sm btn-outline-primary mt-1"
-                                        :id="'orderBtn'+orderIssue.id"
-                                        data-toggle="collapse"
-                                        :data-target="'#order'+orderIssue.id"
-                                        @click="toggleOrder(orderIssue.id,orderIssue.orderPackagecount)">
+                                <button v-if="orderIssue.orderCount > 1 " type="button" class="btn btn-sm btn-outline-primary mt-1"
+                                        :id="'orderBtn'+orderIssue.id"   @click="toggleOrder(orderIssue.id,orderIssue.orderPackagecount)"
+                                        data-toggle="collapse" :data-target="'#order'+orderIssue.id">
                                     商品@{{ orderIssue.orderPackagecount}}件,点击展开
                                 </button>
                             </div>
                         </td>
+                        {{--商品明细 结束--}}
+
+                        {{--退单商品明细 开始--}}
+{{--                        @cannot('客户不可见')--}}
                         <td class="p-0 m-0" v-if="!isShowRejectedBill && index === 0 " style="width:50px;" :rowspan="orderIssues.length" >
                             <span class="btn  btn-outline-secondary "  @click="showRejectedBill"  :style="orderIssues.length>4 ?'{height: 200px;line-height: 100px':''" >展开退单列</span>
                         </td>
-                        <td class="p-0" :id="orderIssue.id+'rejectedBill'" valign="middle" align="center"
-                            v-if="isShowRejectedBill"
-                            colspan="5">
+                        <td class="text-muted" v-if="isShowRejectedBill">
+                            <template v-if="orderIssue.rejected_bill">
+                                @{{ orderIssue.rejected_bill.logistic_number_return }}
+                            </template>
+                        </td>
+                        <td class="p-0" :id="orderIssue.id+'rejectedBill'" valign="middle" align="center" colspan="5"
+                            v-if="isShowRejectedBill">
                             <div v-if="orderIssue.rejected_bill" class="m-0 p-0">
-                                <table v-if="orderIssue.rejected_bill.items" class="table table-sm  m-0"
-                                       :class="orderIssue.rejected_bill.items.length > 1 ? 'collapse' : '' "
-                                       :id="'rejectedBill'+orderIssue.id"
+                                <table v-if="orderIssue.rejected_bill.items" class="table table-sm  m-0" :class="orderIssue.rejected_bill.items.length > 1 ? 'collapse' : '' " :id="'rejectedBill'+orderIssue.id"
                                        :data-value="orderIssue.rejectedCount = 0">
                                     <tr v-for="item in orderIssue.rejected_bill.items"
                                         :data-value="orderIssue.rejected_bill.sum += item.amount" align="center">
@@ -285,24 +289,21 @@
                                         <td style="min-width: 100px" >@{{ item.remark }}</td>
                                     </tr>
                                 </table>
-                                <button v-if="orderIssue.rejected_bill.items.length >  1" type="button"
-                                        class="btn btn-sm btn-outline-primary   align-middle mt-1"
-                                        :id="'rejectedBillBtn'+orderIssue.id"
-                                        data-toggle="collapse"
-                                        :data-target="'#rejectedBill'+orderIssue.id"
-                                        @click="toggleRejectedBill(orderIssue.id,orderIssue.rejectedCount)">
+                                <button v-if="orderIssue.rejected_bill.items.length >  1" type="button" class="btn btn-sm btn-outline-primary   align-middle mt-1" :id="'rejectedBillBtn'+orderIssue.id"
+                                        data-toggle="collapse" :data-target="'#rejectedBill'+orderIssue.id" @click="toggleRejectedBill(orderIssue.id,orderIssue.rejectedCount)">
                                     商品@{{ orderIssue.rejectedCount }}件,点击展开
                                 </button>
                             </div>
                         </td>
-                        {{--情况说明--}}
+{{--                        @endcannot--}}
+                        {{--退单商品明细 结束--}}
+
                         <td >@{{ orderIssue.result_explain}}</td>
                         <td ><span v-if="orderIssue.issue_type">@{{ orderIssue.issue_type.name}}</span></td>
 
                         {{--处理结果--}}
-                        <td class=" m-0 p-0 log-td " valign="middle" align="center"
-                            v-on:mouseover="showAddBtn($event)" v-on:mouseleave="hideAddBtn($event)" colspan="3">
-                            <div class="addLogDiv row m-0 p-0" :id="'AddLog_'+orderIssue.id" style="display: none">
+                        <td class=" m-0 p-0 log-td " valign="middle" align="center" v-on:mouseover="showAddBtn($event)" v-on:mouseleave="hideAddBtn($event)" colspan="3">
+                            <div class="addLogD  v row m-0 p-0" :id="'AddLog_'+orderIssue.id" style="display: none">
                                 <input type="hidden" name="id" :value="orderIssue.id">
                                 <div class="form-group m-2">
                                     <input type="text" name="content" class="form-control" required>
@@ -312,8 +313,7 @@
                                 </button>
                             </div>
 
-                            <div style="position: absolute;display: none;margin-top: -35px" class="add-btn"
-                                 :id="'AddBtn'+orderIssue.id">
+                            <div style="position: absolute;display: none;margin-top: -35px" class="add-btn" :id="'AddBtn'+orderIssue.id">
                                 <button type="button" class="btn  btn-primary "
                                         @click="showAddDiv('AddLog_'+orderIssue.id)">新
                                 </button>
@@ -321,8 +321,7 @@
 
                             <template v-if="orderIssue.logs" class="p-0 m-0 ">
                                 <table class="table table-sm p-0 m-0 " :id="'logs'+orderIssue.id" :data-value="orderIssue.logShow == null ? orderIssue.logShow=false:''">
-                                    <tr style="position:static" align="center" v-for="(log,index) in orderIssue.logs"
-                                        :class="(orderIssue.logs.length <= 2 ? '' : ((index === 0 || orderIssue.logShow )  ? '' : 'd-none' )) "
+                                    <tr style="position:static" align="center" v-for="(log,index) in orderIssue.logs" :class="(orderIssue.logs.length <= 2 ? '' : ((index === 0 || orderIssue.logShow )  ? '' : 'd-none' )) "
                                         v-on:mouseover="showDelBtn($event)" v-on:mouseleave="hideDelBtn($event)" >
                                         <td style="min-width: 75px">@{{ log.type }}</td>
                                         <td style="min-width: 200px">@{{ log.content }}</td>
@@ -333,15 +332,13 @@
                                         </td>
                                     </tr>
                                 </table>
-                                <button type="button" class="btn btn-sm btn-outline-primary align-middle mt-1"
-                                        v-if="orderIssue.logs.length > 2"
-                                        :data-value="orderIssue.logs.length"
-                                        :data-count="orderIssue.logShow"
-                                        @click="toggleLogs(orderIssue,$event)">
+                                <button type="button" class="btn btn-sm btn-outline-primary align-middle mt-1" v-if="orderIssue.logs.length > 2"
+                                        @click="toggleLogs(orderIssue,$event)" :data-value="orderIssue.logs.length" :data-count="orderIssue.logShow" >
                                     记录共@{{ orderIssue.logs.length }}条,点击展开
                                 </button>
                             </template>
                         </td>
+                        @cannot('客户不可见')
                         <td class="p-0 m-0 h-100" v-if="!isShowSecondOrderInfo && index === 0" style="width:50px;" :rowspan="orderIssues.length" >
                             <span class="btn btn-outline-secondary " @click="showSecondeOrder"   :style="orderIssues.length>4 ?'{height: 200px;line-height: 100px':''">展开运单列</span>
                         </td>
@@ -393,12 +390,11 @@
                                 </button>
                             </template>
                         </td>
-
+                        @endcannot
                         <td >@{{ orderIssue.logistic_indemnity_money }}</td>
                         <td >@{{ orderIssue.logistic_express_remission }}</td>
                         @cannot('客户不可见')
-                            <td >@{{ orderIssue.baoshi_indemnity_money }}</td>
-                        @endcannot
+                        <td >@{{ orderIssue.baoshi_indemnity_money }}</td>
                         <td >@{{ orderIssue.baoshi_express_remission }}</td>
                         <td><span
                                 v-if="orderIssue.user_work_group">@{{ orderIssue.user_work_group.name }}</span>
@@ -411,6 +407,7 @@
                                     @click="deleteOrderIssue($event)" :data-value="orderIssue.id">删
                             </button>
                         </td>
+                        @endcannot
                     </tr>
                 </table>
                 <button  class="btn btn-sm" :class="page.curPage === 1 ?'':'btn-outline-primary'"
@@ -540,14 +537,14 @@
             data: {
                 orderIssues: {!!  $orderIssues->toJson() !!}['data'],
                 owners: [@foreach($owners as $owner){name: '{{ $owner->id }}', value: '{{ $owner->name}}'},@endforeach],
-                orderIssueType: [@foreach($orderIssueType as $type){
-                    name: '{{$type->id}}',
-                    value: '{{$type->name}}'
-                },@endforeach],
-                qualityLabel: [@foreach($qualityLabel as $type){
-                    name: '{{$type->id}}',
-                    value: '{{$type->name}}'
-                },@endforeach],
+                orderIssueType: [
+                    @foreach($orderIssueType as $type)
+                    {name: '{{$type->id}}', value: '{{$type->name}}' },
+                    @endforeach],
+                qualityLabel: [
+                    @foreach($qualityLabel as $type)
+                    {name: '{{$type->id}}', value: '{{$type->name}}' },
+                    @endforeach],
                 checkData: [],
                 from: '',
                 finalStatus: [{name: '0', value: '已解决'}, {name: '1', value: '待退回'}, {name: '2', value: '退回中'}],
@@ -561,7 +558,7 @@
                     prevPageUrl: {!! $orderIssues->toJson()  !!}['prev_page_url'],
                     lastPageUrl: {!!  $orderIssues->toJson() !!}['last_page_url'],
                 },
-                isShowOrderInfo: false,
+                isShowOrderInfo:false,
                 isShowRejectedBill: false,
                 isShowSecondOrderInfo: false,
             },
@@ -616,7 +613,7 @@
                         data: this.orderIssueType
                     },
                     {name: 'is_handle', type: 'checkbox', tip: '是否已处理', data: [{name: 'ture', value: '已解决'}]},
-                    @endcannot
+                    @endcan
                 ]];
                 this.form = new query({
                     el: '#form_div',
@@ -1037,7 +1034,7 @@
                 },
                 goPage(page){
                     let href = window.location.href;
-                    if(href.indexOf('?')==-1){
+                    if(href.indexOf('?')===-1){
                         href+='?'
                     }
                     if(href.indexOf('page=')!==-1){

+ 13 - 6
resources/views/order/menu.blade.php

@@ -5,16 +5,23 @@
             @can('订单管理-查询')
             <li class="nav-item">
                 <a class="nav-link" href="{{url('order/index/delivering')}}" :class="{active:isActive('delivering',3)}">订单</a>
-            </li> @endcan
+            </li>
+            @endcan
             @can('订单管理-波次-查询')
                 <li class="nav-item">
                     <a class="nav-link" href="{{url('order/wave/index/')}}" :class="{active:isActive('wave',2)}">波次</a>
-            </li> @endcan
+            </li>
+            @endcan
             @can('订单管理-问题件-查询')
-                    <li class="nav-item">
-                        <a class="nav-link" href="{{url('order/issue/index/')}}" :class="{active:isActive('issue',2)}">问题件</a>
-                    </li>
-                @endcan
+            <li class="nav-item">
+                <a class="nav-link" href="{{url('order/issue/index/')}}" :class="{active:isActive('issue',2)}">问题件</a>
+            </li>
+            @endcan
+            @can('订单管理-跟踪')
+            <li class="nav-item">
+                <a class="nav-link" href="{{url('order/tracking/index')}}" :class="{active:isActive('tracking',2)}">跟踪</a>
+            </li>
+            @endcan
         </ul>
     </div>
 </div>

+ 218 - 0
resources/views/order/tracking/index.blade.php

@@ -0,0 +1,218 @@
+@extends('layouts.app')
+@section('title')订单管理-跟踪@endsection
+@section('content')
+    @component('order.tracking.menu')@endcomponent
+    <div class="container-fluid" id="tracking_div">
+        <div>
+            <div class="d-none" id="list">
+                @can('订单管理-跟踪-监听')
+                <div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="pasteDataTitle" aria-hidden="true">
+                    <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
+                        <div class="modal-content">
+                            <div class="modal-header row form-inline">
+                                <input type="text" v-model="name" class="form-control form-control-sm col-5 offset-3" placeholder="搜索货主,点击下方块添加" />
+                                <button class="btn btn-sm btn-info col-2" @click="seekOwner()">搜索</button>
+                                <label class="col-2"></label>
+                            </div>
+                            <div class="modal-body container row" style="text-align:center">
+                                <div class="col-2 mt-2" v-for="owner in owners">
+                                    <div style="border: 1px solid #aac7ea;height: 80px;text-align: center;line-height: 80px;border-radius: 4px;cursor: pointer"
+                                         :style="[{'background': loggingOwners.includes(Number(owner.name)) ? '#00FF00' : ''},
+                                    {'box-shadow' : seekOwners.includes(owner.name) ? '0px 0px 10px 5px rgba(0,0,0,0.9)' : ''}]"
+                                         @click="addTrackingOwner( owner.id )">@{{ owner.value }}</div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                @endcan
+                <div id="form_div"></div>
+                <div class="form-inline mt-1 ">
+                    <span class="dropdown">
+                        <button type="button"
+                                class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
+                                :class="[checkData.length>0?'btn-dark text-light':'']"
+                                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">导出Excel
+                        </button>
+                        <div class="dropdown-menu">
+                            <a class="dropdown-item" @click="exportSelect()" href="javascript:">导出勾选内容</a>
+                            <a class="dropdown-item" @click="exportAll()" href="javascript:">导出所有页</a>
+                        </div>
+                    </span>
+                    @can('订单管理-跟踪-监听')
+                    <button class="btn btn-outline-info btn-sm tooltipTarget ml-2" @click="openModal()">
+                        管理监听货主
+                    </button>
+                    @endif
+                </div>
+
+                <table class="table table-sm table-bordered table-hover card-body table-responsive-sm p-0 m-0">
+                    <tr class="text-center">
+                        <th>
+                            <input id="all" type="checkbox" @click="checkAll($event)"/>
+                        </th>
+                        <th>序号</th>
+                        <th>公司</th>
+                        <th>订单号</th>
+                        <th>WEB+订单号</th>
+                        <th>提货日期</th>
+                        <th>销售</th>
+                        <th>客户</th>
+                        <th>SKU</th>
+                        <th>物料描述</th>
+                        <th>数量</th>
+                        <th>订单备注</th>
+                        <th>重量</th>
+                        <th>体积</th>
+                        <th>托盘合计</th>
+                        <th>运输方式</th>
+                        <th>运输单号</th>
+                        <th>到达城市</th>
+                        <th>到达城市</th>
+                        <th>应送达时间</th>
+                        <th>是否赶上卡班</th>
+                        <th>到货情况</th>
+                        <th>签收日期</th>
+                        <th>签收单情况</th>
+                        <th>备注</th>
+                    </tr>
+
+                    <tr v-for="(orderTracking,index) in orderTrackings">
+                        <td>
+                            <input id="all" type="checkbox" @click="checkAll($event)"/>
+                        </td>
+                        <td>@{{ index }}</td>
+                        <td>公司</td>
+                        <td>订单号</td>
+                        <td>WEB+订单号</td>
+                        <td>提货日期</td>
+                        <td>销售</td>
+                        <td>客户</td>
+                        <td>SKU</td>
+                        <td>物料描述</td>
+                        <td>数量</td>
+                        <td>订单备注</td>
+                        <td>重量</td>
+                        <td>体积</td>
+                        <td>托盘合计</td>
+                        <td>运输方式</td>
+                        <td>运输单号</td>
+                        <td>到达城市</td>
+                        <td>到达城市</td>
+                        <td>应送达时间</td>
+                        <td>是否赶上卡班</td>
+                        <td>到货情况</td>
+                        <td>签收日期</td>
+                        <td>签收单情况</td>
+                        <td>备注</td>
+                    </tr>
+                </table>
+            </div>
+        </div>
+
+    </div>
+@endsection
+
+@section('lastScript')
+    <script type="text/javascript" src="{{asset('js/queryForm/export200818a.js')}}"></script>
+    <script type="text/javascript" src="{{asset('js/queryForm/queryForm200901.js')}}"></script>
+    <script type="text/javascript" src="{{asset('js/queryForm/header200826b.js')}}"></script>
+
+    <script>
+        let tracking_vue = new Vue({
+            el:'#tracking_div',
+            data:{
+                orderTrackings:[],
+                owners:[@foreach($owners as $owner){name: '{{ $owner->id }}', value: '{{ $owner->name}}'},@endforeach],
+                from:'',
+                checkData:'',
+                seekOwners : [],
+                name : "",
+                loggingOwners : [],
+            },
+            mounted:function(){
+                $('.tooltipTarget').tooltip({'trigger': 'hover'});
+                $("#list").removeClass('d-none');
+                let _this = this;
+                let data = [
+                    [
+                        {name:'start_at',type:'dateTime',tip:'起始日期',placeholder:'起始日期'},
+                        {name:'owner_id',type:'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的客户'],
+                            placeholder: ['货主', '定位或多选货主'],
+                            data: _this.owners},
+                        {name:'client_code',type:'input',tip:'订单号',placeholder:'订单号'},
+                        {name:'client',type:'input',tip:'货主',placeholder:'货主'},
+                    ],
+                    [
+                        {name:'end_at',type:'dateTime',tip:'结束日期',placeholder: '结束日期'},
+                        {name:'logistic_number',type:'input',tip:'运输单号',placeholder:'运输单号'},
+                        {name:'sku',type:'input',tip:'SKU',placeholder: '商品编号'},
+                    ]
+                ];
+                this.from = new query({
+                    el: '#form_div',
+                    condition: data,
+                }).init();
+            },
+            watch:{
+                checkData: {
+                    handler() {
+                        if (this.checkData.length === this.orderTrackings.length && this.checkData.length !== 0) {
+                            document.querySelector('#all').checked = true;
+                        } else {
+                            document.querySelector('#all').checked = false;
+                        }
+                    },
+                    deep: true
+                },
+            },
+            methods:{
+                checkAll(e){
+                    if (e.target.checked) {
+                        this.orderTrackings.forEach((el, i) => {
+                            if (this.checkData.indexOf(el.id) === -1) {
+                                this.checkData.push(el.id);
+                            }
+                        });
+                    } else {
+                        this.checkData = [];
+                    }
+                },
+                openModal(){
+                    let url = "{{url('apiLocal/order/trackingOwner/all')}}";
+                    axios.post(url).then(res=>{
+                        this.loggingOwners = res.data;
+                        $("#modal").modal('show');
+                    });
+                },
+                seekOwner(){
+                    if (!this.name)return ;
+                    let name = this.name;
+                    let seekOwners = [];
+                    this.owners.forEach(function (owner) {
+                        if ((owner.value).indexOf(name) !== -1){
+                            seekOwners.push(owner.name);
+                        }
+                    });
+                    if (seekOwners.length > 0)this.seekOwners = seekOwners;
+                },
+                addTrackingOwner(owner_id,name){
+
+                },
+                selectedColor(id) {
+                    if (id === this.selectedStyle) {
+                        this.selectedStyle = '';
+                        return;
+                    }
+                    this.selectedStyle = id;
+                },
+                exportSelect:function(){
+
+                },
+                exportAll:function(){
+
+                },
+            }
+        });
+    </script>
+@endsection

+ 14 - 0
resources/views/order/tracking/menu.blade.php

@@ -0,0 +1,14 @@
+<div id="nav2">
+    @component('order.menu')
+    @endcomponent
+    <div class="container-fluid nav3">
+        <div class="card menu-third" >
+            <ul class="nav nav-pills">
+                @can('订单管理-跟踪')
+                    <li class="nav-item">
+                        <a class="nav-link" href="{{url('order/tracking/index')}}" :class="{active:isActive('tracking',2)}">查询</a>
+                    </li> @endcan
+            </ul>
+        </div>
+    </div>
+</div>

+ 1 - 1
resources/views/order/wave/search.blade.php

@@ -169,7 +169,7 @@
                             $(".checkItem").prop("checked",false);
                         } else {
                             tempTip.setDuration(2500);
-                            tempTip.show('标记勾选内容重置打印失败,错误:' + response.data.fail_info);
+                            tempTip.show('标记勾选内容重置打印失败,错误:' + res.data.fail_info);
                         }
                     }).catch(function (err) {
                         tempTip.setDuration(4000);

+ 11 - 1
routes/apiLocal.php

@@ -37,10 +37,20 @@ Route::group(['prefix' => 'order'], function () {
     Route::post('issue/orderIssueHasLogisticNumberReturn', 'OrderIssueController@apiOrderIssueHasLogisticNumberReturn');
     Route::post('issue/update', 'OrderIssueController@apiUpdate');
     Route::post('issue/destroy', 'OrderIssueController@apiDestroy');
-    Route::post('issue/orderIssueTag', 'OrderIssueController@apiOrderIssueTag');
+    Route::any('issue/orderIssueTag', 'OrderIssueController@apiOrderIssueTag');
     Route::post('issue/log/store', 'OrderIssueProcessLogController@apiStore');
     Route::post('issue/log/destroy', 'OrderIssueProcessLogController@apiDestroy');
     Route::post('issue/disposeOrderIssue', 'OrderIssueController@apiDisposeOrderIssue');
     Route::post('issue/endOrderIssue', 'OrderIssueController@apiEndOrderIssue');
     Route::post('issue/getOrderInfoByClientNo', 'OrderIssueController@apiGetOrderInfoByClientNo');
+
+});
+
+Route::group(['prefix' => 'order'], function () {
+    Route::get('tracking/update','OrderTrackingController@updateApi');
+    Route::get('trackingOwner/updateStatus','OrderTrackingOwnerController@updateStatusApi');
+    Route::any('trackingOwner/all','OrderTrackingOwnerController@getAllApi');
 });
+
+
+