Explorar o código

Merge branch 'master' into Haozi

haozi %!s(int64=5) %!d(string=hai) anos
pai
achega
38d3d82035
Modificáronse 66 ficheiros con 6107 adicións e 1638 borrados
  1. 44 0
      app/Console/Commands/SyncLogCacheTask.php
  2. 2 0
      app/Console/Kernel.php
  3. 3 20
      app/Http/Controllers/Controller.php
  4. 18 0
      app/Http/Controllers/CustomerController.php
  5. 59 6
      app/Http/Controllers/LogController.php
  6. 3 2
      app/Http/Controllers/OrderController.php
  7. 94 12
      app/Http/Controllers/OrderIssueController.php
  8. 66 35
      app/Http/Controllers/OwnerController.php
  9. 1 1
      app/Http/Controllers/ProcessController.php
  10. 5 2
      app/Http/Controllers/RejectedBillController.php
  11. 10 6
      app/Http/Controllers/RejectedBillItemController.php
  12. 51 5
      app/Http/Controllers/StoreCheckingReceiveController.php
  13. 201 6
      app/Http/Controllers/StoreController.php
  14. 7 11
      app/Http/Controllers/TestController.php
  15. 0 85
      app/Http/Controllers/WMSReflectReceiveController.php
  16. 0 85
      app/Http/Controllers/WMSReflectReceiveSkuController.php
  17. 326 1104
      app/Http/Controllers/api/thirdPart/flux/StoreController.php
  18. 1 1
      app/Log.php
  19. 17 8
      app/OrderIssue.php
  20. 6 0
      app/Providers/AppServiceProvider.php
  21. 23 13
      app/RejectedBill.php
  22. 66 11
      app/Services/LogService.php
  23. 108 93
      app/Services/OrderIssueService.php
  24. 1 20
      app/Services/OrderPackageCommoditiesService.php
  25. 3 2
      app/Services/OrderPackageService.php
  26. 35 15
      app/Services/OrderService.php
  27. 14 8
      app/Services/OrderTrackingService.php
  28. 40 6
      app/Services/RejectedBillService.php
  29. 5 6
      app/Services/StoreCheckingReceiveService.php
  30. 13 0
      app/Services/StoreItemService.php
  31. 13 0
      app/Services/StoreService.php
  32. 14 0
      app/Services/WarehouseService.php
  33. 1 1
      config/hr.php
  34. 12 0
      config/stores.php
  35. 1 1
      database/migrations/2019_11_22_094241_create_provinces_table.php
  36. 1 0
      database/migrations/2020_10_20_134819_create_customers_table.php
  37. 5 2
      database/migrations/2020_10_20_143953_create_owner_reports_table.php
  38. 34 0
      database/migrations/2020_10_22_102316_change_order_issues_table.php
  39. 34 0
      database/migrations/2020_10_23_101444_change_order_issues_tabel.php
  40. 48 0
      database/migrations/2020_10_23_112022_add_column_table_owners_relating_customer.php
  41. 31 0
      database/migrations/2020_10_26_091851_add_order_issue_text_import_authorities.php
  42. 38 0
      database/migrations/2020_10_26_142753_create_owner_area_reports_table.php
  43. 38 0
      database/migrations/2020_10_26_165012_create_owner_fee_details_table.php
  44. 14 10
      package-lock.json
  45. 1 0
      package.json
  46. 516 0
      public/css/app.css
  47. 3253 1
      public/js/app.js
  48. 2 0
      resources/js/app.js
  49. 16 4
      resources/js/queryForm/queryForm.js
  50. 2 0
      resources/sass/app.scss
  51. 16 0
      resources/sass/color.scss
  52. 110 0
      resources/views/customer/project/area.blade.php
  53. 78 0
      resources/views/customer/project/create.blade.php
  54. 94 1
      resources/views/customer/project/index.blade.php
  55. 12 0
      resources/views/customer/project/menu.blade.php
  56. 115 1
      resources/views/customer/project/report.blade.php
  57. 74 15
      resources/views/maintenance/log/index.blade.php
  58. 14 1
      resources/views/maintenance/owner/index.blade.php
  59. 117 14
      resources/views/order/index/delivering.blade.php
  60. 22 4
      resources/views/order/issue/create.blade.php
  61. 122 8
      resources/views/order/issue/import.blade.php
  62. 23 10
      resources/views/order/issue/index.blade.php
  63. 1 0
      resources/views/store/checkingReceive/mission.blade.php
  64. 7 1
      resources/views/store/fast/create.blade.php
  65. 2 1
      routes/apiLocal.php
  66. 4 0
      routes/web.php

+ 44 - 0
app/Console/Commands/SyncLogCacheTask.php

@@ -0,0 +1,44 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Log;
+use App\Services\LogService;
+use Illuminate\Console\Command;
+use Illuminate\Support\Facades\Redis;
+
+class SyncLogCacheTask extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'syncLogCacheTask';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'Command description';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     *
+     */
+    public function handle()
+    {
+        LogService::syncRedisLogs();
+    }
+}

+ 2 - 0
app/Console/Kernel.php

@@ -18,6 +18,7 @@ class Kernel extends ConsoleKernel
         \App\Console\Commands\FluxOrderFix::class,
         \App\Console\Commands\InventoryDailyLoggingOwner::class,
         \App\Console\Commands\WASSyncWMSOrderInformation::class,
+        \App\Console\Commands\SyncLogCacheTask::class,
     ];
 
     /**
@@ -33,6 +34,7 @@ class Kernel extends ConsoleKernel
         $schedule->command('FluxOrderFix')->hourlyAt(1);
 //        $schedule->command('FluxOrderFix')->cron('* * * * *');
         $schedule->command('WASSyncWMSOrderInformation')->everyMinute();
+        $schedule->command('syncLogCacheTask')->everyMinute();
     }
 
     /**

+ 3 - 20
app/Http/Controllers/Controller.php

@@ -3,6 +3,7 @@
 namespace App\Http\Controllers;
 
 use App\Log;
+use App\Services\LogService;
 use App\User;
 use Illuminate\Foundation\Bus\DispatchesJobs;
 use Illuminate\Routing\Controller as BaseController;
@@ -17,31 +18,13 @@ class Controller extends BaseController
 {
     use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
     static public function logS($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();
+        LogService::log($method,$type,$description,$id_user=null);
     }
     public function log($method,$type,$description,$id_user=null){
-        (new Log([
-            'operation'=>$method,
-            'type'=>$type,
-            'description'=>$description,
-            'id_user'=>$id_user,
-            'ip'=>Request::ip()
-        ]))->save();
+        LogService::log($method,$type,$description,$id_user);
     }
     public function apiError($method,$description){
         $this->log($method,'apiError',$description);
         return ['success'=>'false','fail_info'=>$description];
     }
-
 }

+ 18 - 0
app/Http/Controllers/CustomerController.php

@@ -18,4 +18,22 @@ class CustomerController extends Controller
         if(!Gate::allows('客户管理-项目-报表')){ return redirect('denied');  }
         return response()->view('customer.project.report');
     }
+
+    public function projectIndex()
+    {
+        if(!Gate::allows('客户管理-项目-查询')){ return redirect('denied');  }
+        return response()->view('customer.project.index');
+    }
+
+    public function projectCreate()
+    {
+        if(!Gate::allows('客户管理-项目-录入')){ return redirect('denied');  }
+        return response()->view('customer.project.create');
+    }
+
+    public function projectArea()
+    {
+        if(!Gate::allows('客户管理-项目-面积')){ return redirect('denied');  }
+        return response()->view('customer.project.area');
+    }
 }

+ 59 - 6
app/Http/Controllers/LogController.php

@@ -3,25 +3,72 @@
 namespace App\Http\Controllers;
 
 use App\Log;
+use App\Services\LogService;
 use Exception;
+use Illuminate\Contracts\Foundation\Application;
+use Illuminate\Contracts\Pagination\LengthAwarePaginator;
+use Illuminate\Http\RedirectResponse;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;
+use Illuminate\Routing\Redirector;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Gate;
 use Illuminate\Support\Facades\Validator;
+use function GuzzleHttp\Psr7\str;
 
 class LogController extends Controller
 {
     /**
      * Display a listing of the resource.
      *
-     * @return Response
+     * @param Request $request
+     * @return LengthAwarePaginator
      */
-    public function index()
+    public function index(Request $request)
     {
-        if(!Gate::allows('日志-查询')){ return redirect(url('/'));  }
-        $logs=Log::orderBy('id','desc')->paginate(55);
-        return view('maintenance.log.index',['logs'=>$logs]);
+        if (!Gate::allows('日志-查询')) {
+            return redirect(url('/'));
+        }
+        //没有查询条件,默认展示最近50条
+        if (!$request->has('created_at_start') &&
+            !$request->has('created_at_end') &&
+            !$request->has('operation') &&
+            !$request->has('type') &&
+            !$request->has('description')
+        ) {
+            $logs = Log::query()
+                ->orderBy('id', 'desc')
+                ->paginate(50);
+            return view('maintenance.log.index', ['logs' => $logs]);
+        }
+        //不传开始时间提示错误信息并返回
+        if (!$request->has('created_at_start')) {
+            session()->flash('warning', '请选择开始时间');
+            return view('maintenance.log.index', ['logs' => null]);
+        }
+        $query = Log::query()
+            ->orderBy('id', 'desc');
+        if ($request->has('operation')) {
+            $query->where('operation', 'like', $request->operation . '%');
+        }
+        if ($request->has('type')) {
+            $query->where('type', 'like', $request->type . '%');
+        }
+        if ($request->has('description')) {
+            $str = $request->description;
+            $str = trim($str, '\\');
+            $str = str_replace('\\', '\\\\', $str);
+            $query->where('description', 'like', '%' . $str . '%');
+        }
+        if ($request->has('created_at_start')) {
+            $query->where('created_at', '>=', $request->created_at_start);
+        }
+        if ($request->has('created_at_end')) {
+            $query->where('created_at', '<=', $request->created_at_end);
+        }
+
+        $logs = $query->paginate($request->paginate);
+        return view('maintenance.log.index', ['logs' => $logs]);
     }
 
     /**
@@ -32,7 +79,7 @@ class LogController extends Controller
      */
     public function show(Log $log)
     {
-        return view('maintenance.log.show',['log'=>$log]);
+        return view('maintenance.log.show', ['log' => $log]);
     }
 
 
@@ -50,4 +97,10 @@ class LogController extends Controller
 //        $re=$log->delete();
 //        return ['success'=>$re];
     }
+
+    public function syncRedisLogs()
+    {
+        LogService::syncRedisLogs();
+        return redirect('maintenance/log');
+    }
 }

+ 3 - 2
app/Http/Controllers/OrderController.php

@@ -101,13 +101,14 @@ class OrderController extends Controller
                 $rejectedBill = $rejectedBillService->create([
                     'id_owner' => $owner->id,
                     'sender' => $order->c_contact,
-                    'logistic_number_return' => $order->soreference1,
+                    'logistic_number_return' => $orderno,
                     'id_logistic_return' => $logistic->id,
-                    'order_number' => $orderno,
+                    'order_number' => $order->soreference1,
                     'mobile_sender' => $order->c_tel2,
                     'logistic_number' => '原单退回',//$order->soreference1
                     'remark' => $order->notes,
                     'is_loaded' =>0,
+                    "id_operator" => Auth::id(),
                 ]);
                 LogService::log(__METHOD__,"生成退货单",json_encode($order),Auth::user()['id']);
                 if ($commodities[$order->orderno] ?? false){

+ 94 - 12
app/Http/Controllers/OrderIssueController.php

@@ -9,6 +9,7 @@ use App\Order;
 use App\OrderIssue;
 use App\OrderIssueProcessLog;
 use App\OrderIssueType;
+use App\OrderPackage;
 use App\Owner;
 use App\QualityLabel;
 use App\RejectedBill;
@@ -163,7 +164,11 @@ class OrderIssueController extends Controller
             return ['success' => false, 'fail_info' => '没有传入的订单编号'];
         }
         /** @var OrderIssueService $orderIssueService */
-        $orderIssueService = app('orderIssueService');
+        $orderIssueService = app(OrderIssueService::class);
+        $exits_orderNos = $orderIssueService->校验问题件是否存在_WMS订单号_返回存在的订单号($request->input('orderNos'));
+        if(count($exits_orderNos)>0){
+            return ['success'=>false,'fail_info'=>'标记问题件存在已有订单号','exitsOrderNos' =>$exits_orderNos];
+        }
         return $orderIssueService->orderIssueTag($request->all());
     }
 
@@ -314,8 +319,7 @@ class OrderIssueController extends Controller
             return ['success'=>false,'fail_info' => '没有对应权限'];
         }
         $orderNos = $request->input('orderNos');
-        $orderIssues =OrderIssue::query()
-            ->with('order')
+        $orderIssues =OrderIssue::query()->with('order')
             ->whereHas('order',function($query) use ($orderNos){
                 $query->whereIn('code',$orderNos);
             })->get();
@@ -462,20 +466,98 @@ class OrderIssueController extends Controller
         }
     }
 
-    public function secondOrderAddOrderPackageApi(Request $request)
+    public function editSecondLogisticNumberApi(Request $request)
     {
-        if(!Gate::allows('订单管理-问题件-编辑')){
+        if(!Gate::allows('订单管理-问题件-编辑'))
+            return ['success'=>false,'fail_info'=>'没有对应权限'];
+        /** @var OrderIssueService $service */
+        $service = app(OrderIssueService::class);
+        try {
+            $message = $service->updateSecondLogisticNumber($request->input('id'), $request->logistic_number);
+            LogService::log(__METHOD__,__FUNCTION__,json_encode($request->getContent()));
+            return $message;
+        } catch (Exception $e) {
+            LogService::log(__METHOD__,__FUNCTION__,json_encode($request->getContent()).$e->getMessage().$e->getTraceAsString());
+            return ['success'=>false,$e->getMessage()];
+        }
+    }
+    public function importPasteDataApi(Request $request)
+    {
+        if (!Gate::allows('订单管理-订单问题件生成'))
             return ['success'=>false,'fail_info'=>'没有对应权限'];
+        $rows = $request->input('rows');
+        $logistic_numbers = [];
+        $types = [];
+        $maps = [];
+        $errors = [];
+        $orderIssueTypes = OrderIssueType::all();
+        $orderIssueType_map = [];
+        foreach ($orderIssueTypes as $orderIssueType) {
+            $orderIssueType_map[$orderIssueType->name] = $orderIssueType;
+        }
+        $array = explode("\n",$request->input('pasteDataText')); //拆分行
+        /** @var OrderIssueService $service */
+        $service =  app(OrderIssueService::class);
+        foreach ($array as $i => $str) {
+            $items = explode("\t",$str);
+             $head = '第'.($i+1).'行';
+            if(count($items)<count($rows)){
+                $errors[$head] = ['数据不完整'];
+                unset($items);
+                continue;
+            }
+            $map = [];
+
+            foreach ($rows as $index=>$row) {
+                if($row === '原始运单号'){
+                    if(!$items[$index]){
+                        $errors[$head][]='快递单号为空';
+                        $map =[];
+                    }
+                    $exist_logistic =  $service->校验问题件是否存在_快递单号_返回存在的快递单号([$items[$index]]);
+                    if(count($exist_logistic) > 0){
+                        $errors[$head][]='快递单号存在对应的问题件';
+                        $map =[];
+                    }
+                    $logistic_numbers[] = $items[$index];
+                    $map['logistic_number'] = $items[$index];
+                }
+                if($row==='情况说明'){
+                    if(!$items[$index]){
+                        $errors[$head][]='情况说明为空';
+                        $map =[];
+                    }
+                    $map['result_explain'] = $items[$index];
+                }
+                if($row==='问题类别'){
+                    if(!$items[$index]){
+                        $errors[$head][]='问题类别为空';
+                        $map = [];
+                    }else{
+                        $type =  $orderIssueType_map[$items[$index]] ?? null;
+                        if(!$type){
+                            $errors[$head][]='问题类型不存在';
+                            $map = [];
+                        }
+                    }
+                    $types[] =$items[$index];
+                    $map['type'] = $items[$index];
+                }
+            }
+            if(count($map)!==0)$maps[] = $map;
         }
+        if(count($errors)>0) return ['success'=>false,'fail_info'=>$errors];
         try {
-            $array = app(OrderPackageService::class)->createByLogisticNumberAndOrderClientNo( $request->input('client_code'),$request->input('logistic_number'));
-            if(!isset($array['orderPackage']))return ['success'=>false,'fail_info'=>'创建失败'];
-            return ['success'=>true,'orderPackage'=>$array['orderPackage'],'order'=>$array['order']];
+            foreach ($maps as $map) {
+                $logistic_number = $map['logistic_number'];
+                $result_explain = $map['result_explain'];
+                $type = $map['type'];
+                $service->createOrderIssue($logistic_number, $type, $result_explain);
+            }
+            return ['success'=>true];
         } catch (Exception $e) {
-            LogService::log(__METHOD__,__FUNCTION__.'ERROR','问题件 根据二次客户单号和快递单创建OrderPakcage'.json_encode($request->getContent()).$e->getMessage());
-            return ['success'=>false, 'fail_info' => $e->getMessage()];
+            LogService::log(__METHOD__,__FUNCTION__,'文本导入问题件失败'.json_encode($request->getContent().$e->getMessage().$e->getTraceAsString()));
+            return ['success'=>false,'fail_info'=>$e->getMessage()];
         }
-
     }
-
 }

+ 66 - 35
app/Http/Controllers/OwnerController.php

@@ -21,16 +21,29 @@ class OwnerController extends Controller
      *
      * @return Response
      */
-    public function index()
+    public function index(Request $request)
     {
-        if(!Gate::allows('货主-查询')){ return redirect(url('/'));  }
-        $owners=Owner::query()->orderBy('id','desc')->whereNull('deleted_at')->paginate(25);
-        return view('maintenance.owner.index',['owners'=>$owners]);
+        if (!Gate::allows('货主-查询')) {
+            return redirect(url('/'));
+        }
+        $query = Owner::query()
+            ->orderBy('id', 'desc')
+            ->whereNull('deleted_at');
+        if ($request->has('name')) {
+            $query->where('name', 'like', $request->name . '%');
+        }
+        if ($request->has('code')) {
+            $query->where('code', 'like', $request->code . '%');
+        }
+        $owners = $query->paginate($request->paginate);
+        return view('maintenance.owner.index', ['owners' => $owners]);
     }
 
     public function create()
     {
-        if(!Gate::allows('货主-录入')){ return redirect(url('/'));  }
+        if (!Gate::allows('货主-录入')) {
+            return redirect(url('/'));
+        }
         return view('maintenance.owner.create');
     }
 
@@ -42,22 +55,25 @@ class OwnerController extends Controller
      */
     public function store(Request $request)
     {
-        if(!Gate::allows('货主-录入')){ return redirect(url('/'));  }
+        if (!Gate::allows('货主-录入')) {
+            return redirect(url('/'));
+        }
         $this->validatorCreate($request->all())->validate();
-        $owner=new Owner($request->all());
+        $owner = new Owner($request->all());
         $owner->save();
 //        event(new CustomerStoreEvent($owner));
         event(new CustomerStored($owner));
-        $authority=new Authority([
-            'name'=>"_{$owner['id']}",
-            'alias_name'=>"(货主:{$owner['name']})",
-            'remark'=>"(key: _{$owner['id']})",
+        $authority = new Authority([
+            'name' => "_{$owner['id']}",
+            'alias_name' => "(货主:{$owner['name']})",
+            'remark' => "(key: _{$owner['id']})",
         ]);
         $authority->save();
 
-        $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
-        return redirect('maintenance/owner/create')->with('successTip',$request->input('name')??'');
+        $this->log(__METHOD__, __FUNCTION__, json_encode($request->toArray()), Auth::user()['id']);
+        return redirect('maintenance/owner/create')->with('successTip', $request->input('name') ?? '');
     }
+
     protected function validatorCreate(array $data)
     {
         return Validator::make($data, [
@@ -65,15 +81,18 @@ class OwnerController extends Controller
             'name' => ['required', 'string', 'max:50'],
         ]);
     }
-    protected function validatorUpdate(array $data,$id)
+
+    protected function validatorUpdate(array $data, $id)
     {
         return Validator::make($data, [
             'name' => ['required', 'string', 'max:50'],
-            'code'=>['required', 'string', 'max:50',"unique:owners,code,$id"]
+            'code' => ['required', 'string', 'max:50', "unique:owners,code,$id"]
         ]);
     }
-    public function getOwners(){
-        $owners = app('ownerService')->getSelection(['id','code','name']);
+
+    public function getOwners()
+    {
+        $owners = app('ownerService')->getSelection(['id', 'code', 'name']);
         return $owners;
     }
 
@@ -85,8 +104,10 @@ class OwnerController extends Controller
      */
     public function edit(Owner $owner)
     {
-        if(!Gate::allows('货主-编辑')){ return redirect(url('/'));  }
-        return view('maintenance.owner.edit',['owner'=>$owner]);
+        if (!Gate::allows('货主-编辑')) {
+            return redirect(url('/'));
+        }
+        return view('maintenance.owner.edit', ['owner' => $owner]);
     }
 
     /**
@@ -98,13 +119,15 @@ class OwnerController extends Controller
      */
     public function update(Request $request, Owner $owner)
     {
-        if(!Gate::allows('货主-编辑')){ return redirect(url('/'));  }
-        $this->validatorUpdate($request->all(),$owner->id)->validate();
+        if (!Gate::allows('货主-编辑')) {
+            return redirect(url('/'));
+        }
+        $this->validatorUpdate($request->all(), $owner->id)->validate();
         $owner->fill($request->all());
         $owner->update();
         event(new CustomerStored($owner));
-        $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
-        return redirect('maintenance/owner/')->with('successTip',"成功修改货主{$owner['name']}!");
+        $this->log(__METHOD__, __FUNCTION__, json_encode($request->toArray()), Auth::user()['id']);
+        return redirect('maintenance/owner/')->with('successTip', "成功修改货主{$owner['name']}!");
     }
 
     /**
@@ -116,27 +139,35 @@ class OwnerController extends Controller
      */
     public function destroy(Owner $owner)
     {
-        if(!Gate::allows('货主-删除')){ return redirect(url('/'));  }
-        $re=$owner->update([
+        if (!Gate::allows('货主-删除')) {
+            return redirect(url('/'));
+        }
+        $re = $owner->update([
             "deleted_at" => date('Y-m-d H:i:s'),
         ]);
-        $this->log(__METHOD__,__FUNCTION__,$owner->toJson(),Auth::user()['id']);
-        return ['success'=>$re];
+        $this->log(__METHOD__, __FUNCTION__, $owner->toJson(), Auth::user()['id']);
+        return ['success' => $re];
     }
+
     public function recycle()
     {
-        if(!Gate::allows('货主-删除')){ return redirect(url('/'));  }
-        $owners=Owner::query()->orderBy('id','desc')->whereNotNull('deleted_at')->paginate(25);
-        return view('maintenance.owner.recycle',['owners'=>$owners]);
+        if (!Gate::allows('货主-删除')) {
+            return redirect(url('/'));
+        }
+        $owners = Owner::query()->orderBy('id', 'desc')->whereNotNull('deleted_at')->paginate(25);
+        return view('maintenance.owner.recycle', ['owners' => $owners]);
     }
+
     public function restoreSelected(Request $request)
     {
-        if(!Gate::allows('货主-删除')){ return ['success'=>'false','fail_info'=>"没有权限"];  }
-        $id=$request->input('id');
-        $owner=Owner::query()->whereNotNull('deleted_at')->where('id',$id)->update([
+        if (!Gate::allows('货主-删除')) {
+            return ['success' => 'false', 'fail_info' => "没有权限"];
+        }
+        $id = $request->input('id');
+        $owner = Owner::query()->whereNotNull('deleted_at')->where('id', $id)->update([
             "deleted_at" => null,
         ]);
-        $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
-        return ['success'=>'true','owner'=>$owner];
+        $this->log(__METHOD__, __FUNCTION__, json_encode($request->toArray()), Auth::user()['id']);
+        return ['success' => 'true', 'owner' => $owner];
     }
 }

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

@@ -1027,7 +1027,7 @@ class ProcessController extends Controller
                     $this->log(__METHOD__,"二次加工单录入导入商品数据时添加货主".__FUNCTION__,json_encode($owner),Auth::user()['id']);
                 }
             }
-            $goods = Commodity::query()->with('barcodes')->whereNull('owner_id')
+            $goods = Commodity::query()->with('barcodes')->where('owner_id',$owner->id)//->whereNull('owner_id') TODO 保留,暂时不知为何限定货主为空
                 ->where('sku',$commodityData['sku'])->first();
             $commodity_barcodes = [];
             if (!$goods){

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

@@ -12,6 +12,7 @@ use App\Rejected;
 use App\RejectedBill;
 use App\RejectedBillItem;
 use App\Services\OrderPackageCommoditiesService;
+use App\Services\RejectedBillService;
 use Illuminate\Contracts\View\Factory;
 use Illuminate\Http\RedirectResponse;
 use Illuminate\Http\Request;
@@ -90,7 +91,8 @@ class RejectedBillController extends Controller
         $rejectedBill=new RejectedBill($request->all());
         $rejectedBill['id_operator'] = Auth::user()['id'];
         $rejectedBill->save();
-        $rejectedBill->同步问题件退件状态();
+        app(RejectedBillService::class)->syncOrderIssue($rejectedBill);
+//        $rejectedBill->同步问题件退件状态();
 
         $this->log(__METHOD__,__FUNCTION__.'_'.$rejectedBill['id'],json_encode($request->toArray()),Auth::user()['id']);
         return ['success'=>'true','id'=>$rejectedBill['id']];
@@ -109,7 +111,8 @@ class RejectedBillController extends Controller
         $rejectedBill=RejectedBill::find($request->input('id'));
         $rejectedBill->fill($request->all());
         $rejectedBill->save();
-        $rejectedBill->同步问题件退件状态();
+        app(RejectedBillService::class)->syncOrderIssue($rejectedBill);
+//        $rejectedBill->同步问题件退件状态();
 
         $this->log(__METHOD__,__FUNCTION__.'_'.$rejectedBill['id'],json_encode($request->toArray()),Auth::user()['id']);
         return ['success'=>'true'];

+ 10 - 6
app/Http/Controllers/RejectedBillItemController.php

@@ -8,6 +8,7 @@ use App\Owner;
 use App\RejectedBill;
 use App\RejectedBillItem;
 use App\Services\CommodityService;
+use App\Services\RejectedBillService;
 use App\WMSReflectReceive;
 use App\WMSReflectReceiveSku;
 use Illuminate\Http\Request;
@@ -93,9 +94,10 @@ class RejectedBillItemController extends Controller
         }
 
 
-        $rejectedBIll = RejectedBill::where('id',$request->input('id_rejected_bill'))->first();
-        $rejectedBIll->同步问题件();
-        $rejectedBIll->同步问题件退件状态();
+        $rejectedBill = RejectedBill::query()->where('id',$request->input('id_rejected_bill'))->first();
+        app(RejectedBillService::class)->syncOrderIssue($rejectedBill);
+//        $rejectedBIll->同步问题件();
+//        $rejectedBIll->同步问题件退件状态();
         $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
         return ['success'=>'true','id'=>$rejectedBillItem['id']];
     }
@@ -116,8 +118,9 @@ class RejectedBillItemController extends Controller
             $rejectedBillItem->fill($request->all());
             $rejectedBillItem->update();
             $rejectedBillItem->injectCommodityName();
-            $rejectedBIll = RejectedBill::query()->where('id',$rejectedBillItem->id_rejected_bill)->with('orderIssue')->first();
-            $rejectedBIll->同步问题件退件状态();
+            $rejectedBill = RejectedBill::query()->where('id',$rejectedBillItem->id_rejected_bill)->with('orderIssue')->first();
+//            $rejectedBill->同步问题件退件状态();
+            app(RejectedBillService::class)->syncOrderIssue($rejectedBill);
             $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
             return ['success'=>'true','id'=>$rejectedBillItem['id']];
         }
@@ -176,7 +179,8 @@ class RejectedBillItemController extends Controller
         }
         $item=$rejectedBillItems->first();
         $rejectedBill = RejectedBill::query()->find($item['id_rejected_bill']);
-        $rejectedBill->同步问题件();
+        app(RejectedBillService::class)->syncOrderIssue($rejectedBill);
+//        $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);
         $isGotMoreThenDownloaded=WMSReflectReceiveSku::isItemsOverDownloadedSkus($rejectedBillItems,$downloadedSkus);

+ 51 - 5
app/Http/Controllers/StoreCheckingReceiveController.php

@@ -47,7 +47,12 @@ class StoreCheckingReceiveController extends Controller
         if(!Gate::allows('入库管理-盘收一体-盘收-查看')){ return redirect(url('/'));  }
         /** @var StoreCheckingReceiveService $service */
         $service = app('storeCheckingReceiveService');
-        $storeCheckingReceive = $service->find($id);
+        $withs = ['owner','storeCheckingReceiveItems'=>function($query){
+                    $query->with(['commodity'=>function($builder) {
+                        $builder->with('barcodes');
+                    }]);
+                }];
+        $storeCheckingReceive = $service->find($id,$withs);
         $is_show = $request->is_show ?? true;
 
         if ($storeCheckingReceive->owner ?? false){
@@ -68,7 +73,12 @@ class StoreCheckingReceiveController extends Controller
         $goods = $request->goods ?? false;
         if (!($goods["amount"] ?? false))$goods["amount"] = 1;
         if (!$mission_id || !$goods)return ['success'=>false, 'data'=>'参数传递错误!'];
-        $storeCheckingReceive = app('storeCheckingReceiveService')->find($mission_id);
+        $withs = ['owner','storeCheckingReceiveItems'=>function($query){
+            $query->with(['commodity'=>function($builder) {
+                $builder->with('barcodes');
+            }]);
+        }];
+        $storeCheckingReceive = app('storeCheckingReceiveService')->find($mission_id,$withs);
         if (!$storeCheckingReceive)return ['success'=>false, 'data'=>'盘收任务不存在'];
         if ($storeCheckingReceive->status == '已收货')return ['success'=>false, 'data'=>'盘收任务已结束'];
 
@@ -204,7 +214,12 @@ class StoreCheckingReceiveController extends Controller
     public function export(Request $request){
         if(!Gate::allows('入库管理-盘收一体-盘收-查看')){ return redirect(url('/'));  }
         $id = $request->mission_id ?? false;
-        $storeCheckingReceive = app('storeCheckingReceiveService')->find($id);
+        $withs = ['owner','storeCheckingReceiveItems'=>function($query){
+            $query->with(['commodity'=>function($builder) {
+                $builder->with('barcodes');
+            }]);
+        }];
+        $storeCheckingReceive = app('storeCheckingReceiveService')->find($id,$withs);
 
         if (!$storeCheckingReceive) new \Exception('盘收任务不存在');
 
@@ -263,7 +278,12 @@ class StoreCheckingReceiveController extends Controller
         $id = $request->mission_id ?? false;
         if (!$asn || !$id)return ['success'=>false, 'data'=>'传递参数错误'];
 
-        $storeCheckingReceive = app('storeCheckingReceiveService')->find($id);
+        $withs = ['owner','storeCheckingReceiveItems'=>function($query){
+            $query->with(['commodity'=>function($builder) {
+                $builder->with('barcodes');
+            }]);
+        }];
+        $storeCheckingReceive = app('storeCheckingReceiveService')->find($id,$withs);
         if (!$storeCheckingReceive) return ['success'=>false, 'data'=>'未找到此盘点任务!'];
         if ($storeCheckingReceive->status == '已收货')return ['success'=>false, 'data'=>'盘收任务已结束'];
 
@@ -372,8 +392,34 @@ class StoreCheckingReceiveController extends Controller
         if (!$id || !$counted_amount)return ['success'=>false, 'data'=>'参数传递错误!'];
         $item = app('storeCheckingReceiveItemService')->find($id);
         if (!$item)return ['success'=>false, 'data'=>'被盘项不存在'];
-        app('storeCheckingReceiveItemService')->updateFind($item,["counted_amount"=>$counted_amount]);
+        $params = ["counted_amount"=>$counted_amount];
+        if ($item->imported_amount)$params["imported_diff_amount"] = (int)$counted_amount - (int)$item->imported_amount;
+        if ($item->asn_amount)$params["asn_diff_amount"] = (int)$counted_amount - (int)$item->asn_diff_amount;
+        //修改差异状态
+        if ($item->imported_amount || $item->asn_amount){
+            $withs = ['storeCheckingReceiveItems'];
+            $storeCheckingReceive = app('storeCheckingReceiveService')->find($item->store_checking_receive_id,$withs);
+            if ($storeCheckingReceive)$this->updateDiffStatus($storeCheckingReceive);
+        }
+        app('storeCheckingReceiveItemService')->updateFind($item,$params);
         LogService::log(__METHOD__,"盘点修改实盘数",'item:'.json_encode($item)."update:",$counted_amount);
         return ['success'=>true];
     }
+
+    //修改差异状态
+    private function updateDiffStatus(StoreCheckingReceive $scr){
+        $items = $scr->storeCheckingReceiveItems ?? [];
+        $is_receive_diff = "否";
+        $is_asn_diff = "否";
+        foreach ($items as $item){
+            if ($item->imported_diff_amount)$is_receive_diff = "是";
+            if ($item->asn_diff_amount)$is_asn_diff = "是";
+        }
+        if (($scr->is_receive_diff != $is_receive_diff) || ($scr->is_asn_diff != $is_asn_diff)){
+            $scr->update([
+                "is_receive_diff" => $is_receive_diff,
+                "is_asn_diff" => $is_asn_diff
+            ]);
+        }
+    }
 }

+ 201 - 6
app/Http/Controllers/StoreController.php

@@ -3,21 +3,24 @@
 namespace App\Http\Controllers;
 
 use App\Depository;
-use App\Http\Controllers\Api\thirdPart\flux\StoreController as FStoreController;
 use App\Owner;
+use App\Services\LogService;
 use App\Store;
 use App\StoreItems;
 use App\Warehouse;
 use App\WMSReflectReceive;
+use Carbon\Carbon;
 use Illuminate\Contracts\Foundation\Application;
 use Illuminate\Contracts\View\Factory;
 use Illuminate\Http\RedirectResponse;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;
 use Illuminate\Routing\Redirector;
+use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Gate;
 use Illuminate\Support\Facades\Validator;
 use Illuminate\View\View;
+use App\Http\Controllers\Api\thirdPart\flux\StoreController as FStoreController;
 
 class StoreController extends Controller
 {
@@ -54,13 +57,14 @@ class StoreController extends Controller
     {
         if(!Gate::allows('入库管理-快速入库-录入')){ return redirect(url('/'));  }
         $this->validator($request);
-        $result = $this->quickStorage($request->input('asn_code'),$request->input('quality'),$request->input('depository_code'));
+        if ($request->test)$result = $this->quickStorage($request->input('asn_code'),$request->input('quality') == '正品' ? 'ZP' : 'CC',$request->input('depository_code'));
+        else $result = $this->quickStorage_temp($request->input('asn_code'),$request->input('quality'),$request->input('depository_code'));
         $response = redirect('store/fast/create');
         if ($result['success'])return redirect('store/fast/create')->with('successTip',$result['data']);
-        else return $response->with('successError',$result['data']);
+        return $response->with('successError',$result['data']);
     }
 
-    public function quickStorage($asn,$quality,$depository_code){
+    public function quickStorage_temp($asn,$quality,$depository_code){
         $WMSReflectReceive=WMSReflectReceive::with('skus')->where('ASNNO',$asn)->first();
         if (!$WMSReflectReceive)return ['success'=>false, 'data'=>"ASN编号不存在!"];
         $warehouse=Warehouse::query()->where('code',$WMSReflectReceive->WAREHOUSEID)->first();
@@ -73,7 +77,7 @@ class StoreController extends Controller
         }
         $owner=Owner::query()->where('code',$WMSReflectReceive->CUSTOMERID)->first();
         if (!$owner&&$WMSReflectReceive->CUSTOMERID){
-            $owner=new Warehouse([
+            $owner=new Owner([
                 'name'=>$WMSReflectReceive->CUSTOMERID,
                 'code'=>$WMSReflectReceive->CUSTOMERID
             ]);
@@ -142,7 +146,7 @@ class StoreController extends Controller
             'depository_code'=>$depository_code,
             'follow_code'=>$store['id'],
         ]);
-        if ($result){
+        if ($result["success"]){
             $store->status='已入库';
             $store->save();
             if ($store->storeItems){
@@ -157,6 +161,197 @@ class StoreController extends Controller
         return ['success'=>false, 'data'=>"失败!请检查错误日志"];
     }
 
+    public function quickStorage($asnno,$quality,$depository_code)
+    {
+        $db = DB::connection('oracle');
+        $query = DB::raw("SELECT * FROM DOC_ASN_HEADER WHERE ASNNO = ?");
+        $asn = $db->selectOne($query,[$asnno]);
+        if (!$asn) return ['success'=>false, 'data'=>"单据号不存在"];
+        if ($asn->asnstatus != '00')return ['success'=>false, 'data'=>'单据号状态非创建订单'];
+        if (array_search($asn->customerid,array_values(config('stores.owners'))) === false)return ['success'=>false, 'data'=>"不允许该货主快速入库"];
+        if (array_search($asn->asntype,array_values(config('stores.types'))) === false)return ['success'=>false, 'data'=>"该单据类型不允许被入库"];
+        $query = DB::raw("SELECT b.ALTERNATE_SKU1,h.WAREHOUSEID,h.asnno,d.ASNLINENO,d.SKUDESCRC,h.CUSTOMERID,d.SKU,d.PACKID,d.RECEIVEDQTY_EACH,d.EXPECTEDQTY_EACH,d.LOTATT01,d.LOTATT02,d.lotatt04,".
+            "d.lotatt05,d.lotatt08,d.USERDEFINE1,d.USERDEFINE2,d.USERDEFINE3,d.USERDEFINE4,d.USERDEFINE5,d.RECEIVINGLOCATION FROM DOC_ASN_DETAILS d ".
+            " LEFT JOIN BAS_SKU b ON d.CUSTOMERID = b.CUSTOMERID AND d.SKU = b.SKU INNER JOIN DOC_ASN_HEADER h ON d.ASNNO = h.ASNNO WHERE h.ASNNO = ?");
+        $details = $db->select($query,[$asnno]);
+
+        $username = config('database.connections.oracle.username');
+        $password = config('database.connections.oracle.password');
+        $host = config('database.connections.oracle.host');
+        $service_name = config('database.connections.oracle.service_name');
+        $conn = oci_connect($username, $password, $host . '/' . $service_name,"utf8");
+        $sql_sp = "begin SPASN_Receiving_Process(:IN_Warehouse, :In_Process_Action, :In_ASNNo_C, :In_ASNLineNo_C, :In_FMTraceID_C, :In_New_TraceID_C, :In_ProductStatus," .
+            ":In_ProductStatus_Descr, :In_HoldRejectCode_C, :In_HoldRejectReason_C, :In_PONo_C, :In_CustomerID, :In_SKU, :In_ReceivedQty, :In_RejectedQty,:In_UOM, :In_PackID," .
+            " :In_ContainerID, :In_LotAtt01_C, :In_LotAtt02_C, :In_LotAtt03_C, :In_LotAtt04_C, :In_LotAtt05_C, :In_LotAtt06_C," .
+            ":In_LotAtt07_C, :In_LotAtt08_C, :In_LotAtt09_C, :In_LotAtt10_C, :In_LotAtt11_C, :In_LotAtt12_C," .
+            ":In_TotalCubic, :In_TotalGrossWeight, :In_TotalNetWeight, :In_TotalPrice, :In_UserDefine1, :In_UserDefine2,:In_UserDefine3, :In_UserDefine4, :In_UserDefine5, :In_FMLocation," .
+            ":In_TOLocation_C,:In_QC_Type_C, :In_PlanToLoc_C,:In_ReceivingTime, :In_LPN, :In_Operator, :IN_RCVModule, :IN_RCVStation, :In_Language, :In_UserID, :OUT_Return_Code); end;";
+        $items = [];
+        $toDay = Carbon::now()->toDateTimeString();
+        $depositories = [];
+        foreach ($details as $detail) {
+            $result = $this->executeSP($detail,$asnno,$depository_code,$db,$quality,$conn,$sql_sp);
+            if (substr($result, 0, 3) != '000') {
+                oci_close($conn);
+                LogService::log(__METHOD__,"快速入库-FLUX收货失败","ASNNO:".$asnno.";ERROR:".$result);
+                return ['success' => false, 'data' => $detail->asnlineno.'收货失败,错误代码:'.$result];
+            }
+            if (!isset($depositories[$detail->lotatt05])){
+                $depository = app('depositoryService')->firstOrCreate(["code"=>$detail->lotatt05],["code"=>$detail->lotatt05,"name"=>$detail->lotatt05]);
+                $depositories[$detail->lotatt05] = $depository->id;
+            }
+            $items[] = [
+                "asn_line_code" => $detail->asnlineno,
+                "name" => $detail->skudescrc,
+                "sku" => $detail->sku,
+                "barcode" => $detail->alternate_sku1,
+                "depository_id" => $depositories[$detail->lotatt05],
+                "amount" => $detail->expectedqty_each,
+                "quality" => $quality == 'ZP' ? '正品' : '残次',
+                "status" => "已入库",
+                "created_at" => $toDay
+            ];
+        }
+        oci_close($conn);
+        $warehouse = app('warehouseService')->firstOrCreate(["code"=>$asn->warehouseid],["code"=>$asn->warehouseid,"name"=>$asn->warehouseid]);
+        $owner = app('ownerService')->firstOrCreate(['code'=>$asn->customerid],['code'=>$asn->customerid,"name"=>$asn->customerid]);
+        $store = app('storeService')->create([
+            'asn_code'=>$asnno,
+            'warehouse_id'=>$warehouse->id,
+            'owner_id'=>$owner->id,
+            'stored_method'=>'快速入库',
+            'status'=>'已入库',
+            'remark'=>$asn->notes,
+        ]);
+        LogService::log(__METHOD__,"快速入库",json_encode($store));
+        foreach ($items as $item){
+            $item["store_id"] = $store->id;
+        }
+        app('storeItemService')->insert($items);
+        return ['success'=>true,"data"=>"已成功将“".$asnno."”入库"];
+    }
+
+    private function executeSP($detail, $asnno, $depository_code, $db, $quality, $conn, $sql_sp){
+        $IN_Warehouse = $detail->warehouseid ?? '';
+        $In_Process_Action = '3';
+        $In_ASNNo_C = $detail->asnno ?? '';
+        $In_ASNLineNo_C = $detail->asnlineno ?? '';
+        $In_FMTraceID_C = '';
+        $In_New_TraceID_C = '';
+        $In_ProductStatus = '00';
+        $In_ProductStatus_Descr = '正常';
+        $In_HoldRejectCode_C = 'OK';
+        $In_HoldRejectReason_C = '正常';
+        $In_PONo_C = '';
+        $In_CustomerID = $detail->customerid ?? '';
+        $In_SKU = $detail->sku ?? '';
+        $In_ReceivedQty = (string)((int)$detail->expectedqty_each - (int)$detail->receivedqty_each) ?? '';
+        $In_RejectedQty = '';
+        $In_UOM = 'EA';
+        $In_PackID = $detail->packid ?? '';
+        $In_ContainerID = '';
+        $In_LotAtt01_C = $detail->lotatt01 ?? '';
+        $In_LotAtt02_C = $detail->lotatt02 ?? '';
+        $In_LotAtt03_C = '';
+        $In_LotAtt04_C = $detail->lotatt04 ?? '';
+        $In_LotAtt05_C = $detail->lotatt05 ?? '';
+        $In_LotAtt06_C = '';
+        $In_LotAtt07_C = '';
+        $In_LotAtt08_C = $detail->lotatt08 ?? '';
+        $In_LotAtt09_C = '';
+        $In_LotAtt10_C = '';
+        $In_LotAtt11_C = '';
+        $In_LotAtt12_C = '';
+        $In_TotalCubic = '0.00';
+        $In_TotalGrossWeight = '0.00';
+        $In_TotalNetWeight = '0.00';
+        $In_TotalPrice = '0.00';
+        $In_UserDefine1 = $detail->userdefine1 ?? '';
+        $In_UserDefine2 = $detail->userdefine2 ?? '';
+        $In_UserDefine3 = $detail->userdefine3 ?? '';
+        $In_UserDefine4 = $detail->userdefine4 ?? '';
+        $In_UserDefine5 = $detail->userdefine5 ?? '';
+        $In_FMLocation = 'STAGE' . $detail->warehouseid;
+        $In_TOLocation_C = 'STAGE' . $detail->warehouseid;
+        $In_QC_Type_C = 'OK';
+        $In_PlanToLoc_C = '';
+        $In_ReceivingTime = '';
+        $In_LPN = '*';
+        $In_Operator = 'WCS';
+        $IN_RCVModule = '';
+        $IN_RCVStation = '';
+        $In_Language = 'cn';
+        $In_UserID = 'WCS';
+        $result = '';
+        if ($depository_code && (strtoupper($depository_code) != strtoupper($detail->receivinglocation))){
+            $query = DB::raw("UPDATE DOC_ASN_DETAILS SET RECEIVINGLOCATION = ?  WHERE ASNNO = ? AND ASNLINENO = ?");
+            $db->update($query,[$depository_code,$detail->asnno,$detail->asnlineno]);
+            $db->commit();
+            LogService::log(__METHOD__,"快速入库-修改FULX属性仓","ASNNO:".$asnno.";原仓:".$detail->receivinglocation.";修改为:".$depository_code);
+        }
+        if ($quality && ($quality != $detail->lotatt08)){
+            $query = DB::raw("UPDATE DOC_ASN_DETAILS SET LOTATT08 = ?  WHERE ASNNO = ? AND ASNLINENO = ?");
+            $db->update($query,[$quality,$detail->asnno,$detail->asnlineno]);
+            $db->commit();
+            LogService::log(__METHOD__,"快速入库-修改FULX质量状态","ASNNO:".$asnno.";原质量:".$detail->lotatt08.";修改为:".$quality);
+            $In_LotAtt08_C = $quality;
+        }
+        $stmt = oci_parse($conn, $sql_sp);
+        oci_bind_by_name($stmt, ':IN_Warehouse', $IN_Warehouse);
+        oci_bind_by_name($stmt, ':In_Process_Action', $In_Process_Action);
+        oci_bind_by_name($stmt, ':In_ASNNo_C', $In_ASNNo_C);
+        oci_bind_by_name($stmt, ':In_ASNLineNo_C', $In_ASNLineNo_C);
+        oci_bind_by_name($stmt, ':In_FMTraceID_C', $In_FMTraceID_C);
+        oci_bind_by_name($stmt, ':In_New_TraceID_C', $In_New_TraceID_C);
+        oci_bind_by_name($stmt, ':In_ProductStatus', $In_ProductStatus);
+        oci_bind_by_name($stmt, ':In_ProductStatus_Descr', $In_ProductStatus_Descr);
+        oci_bind_by_name($stmt, ':In_HoldRejectCode_C', $In_HoldRejectCode_C);
+        oci_bind_by_name($stmt, ':In_HoldRejectReason_C', $In_HoldRejectReason_C);
+        oci_bind_by_name($stmt, ':In_PONo_C', $In_PONo_C);
+        oci_bind_by_name($stmt, ':In_CustomerID', $In_CustomerID);
+        oci_bind_by_name($stmt, ':In_SKU', $In_SKU);
+        oci_bind_by_name($stmt, ':In_ReceivedQty', $In_ReceivedQty);
+        oci_bind_by_name($stmt, ':In_RejectedQty', $In_RejectedQty);
+        oci_bind_by_name($stmt, ':In_UOM', $In_UOM);
+        oci_bind_by_name($stmt, ':In_PackID', $In_PackID);
+        oci_bind_by_name($stmt, ':In_ContainerID', $In_ContainerID);
+        oci_bind_by_name($stmt, ':In_LotAtt01_C', $In_LotAtt01_C);
+        oci_bind_by_name($stmt, ':In_LotAtt02_C', $In_LotAtt02_C);
+        oci_bind_by_name($stmt, ':In_LotAtt03_C', $In_LotAtt03_C);
+        oci_bind_by_name($stmt, ':In_LotAtt04_C', $In_LotAtt04_C);
+        oci_bind_by_name($stmt, ':In_LotAtt05_C', $In_LotAtt05_C);
+        oci_bind_by_name($stmt, ':In_LotAtt06_C', $In_LotAtt06_C);
+        oci_bind_by_name($stmt, ':In_LotAtt07_C', $In_LotAtt07_C);
+        oci_bind_by_name($stmt, ':In_LotAtt08_C', $In_LotAtt08_C);
+        oci_bind_by_name($stmt, ':In_LotAtt09_C', $In_LotAtt09_C);
+        oci_bind_by_name($stmt, ':In_LotAtt10_C', $In_LotAtt10_C);
+        oci_bind_by_name($stmt, ':In_LotAtt11_C', $In_LotAtt11_C);
+        oci_bind_by_name($stmt, ':In_LotAtt12_C', $In_LotAtt12_C);
+        oci_bind_by_name($stmt, ':In_TotalCubic', $In_TotalCubic);
+        oci_bind_by_name($stmt, ':In_TotalGrossWeight', $In_TotalGrossWeight);
+        oci_bind_by_name($stmt, ':In_TotalNetWeight', $In_TotalNetWeight);
+        oci_bind_by_name($stmt, ':In_TotalPrice', $In_TotalPrice);
+        oci_bind_by_name($stmt, ':In_UserDefine1', $In_UserDefine1);
+        oci_bind_by_name($stmt, ':In_UserDefine2', $In_UserDefine2);
+        oci_bind_by_name($stmt, ':In_UserDefine3', $In_UserDefine3);
+        oci_bind_by_name($stmt, ':In_UserDefine4', $In_UserDefine4);
+        oci_bind_by_name($stmt, ':In_UserDefine5', $In_UserDefine5);
+        oci_bind_by_name($stmt, ':In_FMLocation', $In_FMLocation);
+        oci_bind_by_name($stmt, ':In_TOLocation_C', $In_TOLocation_C);
+        oci_bind_by_name($stmt, ':In_QC_Type_C', $In_QC_Type_C);
+        oci_bind_by_name($stmt, ':In_PlanToLoc_C', $In_PlanToLoc_C);
+        oci_bind_by_name($stmt, ':In_ReceivingTime', $In_ReceivingTime);
+        oci_bind_by_name($stmt, ':In_LPN', $In_LPN);
+        oci_bind_by_name($stmt, ':In_Operator', $In_Operator);
+        oci_bind_by_name($stmt, ':IN_RCVModule', $IN_RCVModule);
+        oci_bind_by_name($stmt, ':IN_RCVStation', $IN_RCVStation);
+        oci_bind_by_name($stmt, ':In_Language', $In_Language);
+        oci_bind_by_name($stmt, ':In_UserID', $In_UserID);
+        oci_bind_by_name($stmt, ':OUT_Return_Code', $result,300);
+        oci_execute($stmt);
+        return $result;
+    }
+
 
     public function validator(Request $request){
         $validator=Validator::make($request->input(),[

+ 7 - 11
app/Http/Controllers/TestController.php

@@ -488,9 +488,10 @@ class TestController extends Controller
             $toDay = Carbon::now();
             $skus = DB::select(DB::raw('select sku from commodities group by sku,owner_id having count(*)>1 limit 500 '));
             $skus = array_column($skus,'sku');
-            // select * from commodities c where (c.sku) in and owner_id is not null order by c.sku
+
             $commodities = Commodity::query()->with('barcodes')->whereNotNull('owner_id')->whereIn('sku',$skus)->get();
 
+
             if (count($commodities) < 1)return "SUCCESS";
             $commodityMap = [];
             $commodityDel = [];
@@ -524,6 +525,7 @@ class TestController extends Controller
                     $commodityBar[$commodity->sku.'_'.$commodity->owner_id] = $commodity->barcodes ? array_column($commodity->barcodes->toArray(),'code') : [];
                 }
             }
+            dd($commodityMap,$commodityDel,$commodityTag);
             LogService::log(__METHOD__,'清理商品',json_encode($logs,JSON_UNESCAPED_UNICODE));
             LogService::log(__METHOD__,'重新分配商品',json_encode($commodityTag,JSON_UNESCAPED_UNICODE));
 
@@ -648,16 +650,6 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
         Commodity::destroy($deleteCommodities);
     }
 
-//    public function test2()
-//    {
-//        $owner = Owner::where('name', 'B站')->first();
-//        $commodities = Commodity::query()->where('owner_id', $owner->id)->get();
-//        $comID = array_column($commodities->toArray(), 'id');
-//        CommodityBarcode::query()->whereIn('commodity_id', $comID)->delete();
-//        Commodity::destroy($comID);
-//        return $comID;
-//    }
-
     /*1*/
     function socket(Request $request)
     {/**/
@@ -730,6 +722,10 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
         $orderService->updateByWmsOrders($orderHeaders);
         $orderTrackingService->updateByWmsOrderHeaders($orderHeaders);
     }
+    public function test11(){
+        $orderHeader = OracleDOCOrderHeader::query()->with('actAllocationDetails')->where('orderNo','SO201024001172')->get();
+        dd(app(OrderService::class)->createByWmsOrder($orderHeader));
+    }
 
     public function usage()
     {

+ 0 - 85
app/Http/Controllers/WMSReflectReceiveController.php

@@ -1,85 +0,0 @@
-<?php
-
-namespace App\Http\Controllers;
-
-use App\WMSReflectReceive;
-use Illuminate\Http\Request;
-
-class WMSReflectReceiveController 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\WMSReflectReceive  $wMSReflectReceive
-     * @return \Illuminate\Http\Response
-     */
-    public function show(WMSReflectReceive $wMSReflectReceive)
-    {
-        //
-    }
-
-    /**
-     * Show the form for editing the specified resource.
-     *
-     * @param  \App\WMSReflectReceive  $wMSReflectReceive
-     * @return \Illuminate\Http\Response
-     */
-    public function edit(WMSReflectReceive $wMSReflectReceive)
-    {
-        //
-    }
-
-    /**
-     * Update the specified resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  \App\WMSReflectReceive  $wMSReflectReceive
-     * @return \Illuminate\Http\Response
-     */
-    public function update(Request $request, WMSReflectReceive $wMSReflectReceive)
-    {
-        //
-    }
-
-    /**
-     * Remove the specified resource from storage.
-     *
-     * @param  \App\WMSReflectReceive  $wMSReflectReceive
-     * @return \Illuminate\Http\Response
-     */
-    public function destroy(WMSReflectReceive $wMSReflectReceive)
-    {
-        //
-    }
-}

+ 0 - 85
app/Http/Controllers/WMSReflectReceiveSkuController.php

@@ -1,85 +0,0 @@
-<?php
-
-namespace App\Http\Controllers;
-
-use App\WMSReflectReceiveSku;
-use Illuminate\Http\Request;
-
-class WMSReflectReceiveSkuController 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\WMSReflectReceiveSku  $wMSReflectReceiveSku
-     * @return \Illuminate\Http\Response
-     */
-    public function show(WMSReflectReceiveSku $wMSReflectReceiveSku)
-    {
-        //
-    }
-
-    /**
-     * Show the form for editing the specified resource.
-     *
-     * @param  \App\WMSReflectReceiveSku  $wMSReflectReceiveSku
-     * @return \Illuminate\Http\Response
-     */
-    public function edit(WMSReflectReceiveSku $wMSReflectReceiveSku)
-    {
-        //
-    }
-
-    /**
-     * Update the specified resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  \App\WMSReflectReceiveSku  $wMSReflectReceiveSku
-     * @return \Illuminate\Http\Response
-     */
-    public function update(Request $request, WMSReflectReceiveSku $wMSReflectReceiveSku)
-    {
-        //
-    }
-
-    /**
-     * Remove the specified resource from storage.
-     *
-     * @param  \App\WMSReflectReceiveSku  $wMSReflectReceiveSku
-     * @return \Illuminate\Http\Response
-     */
-    public function destroy(WMSReflectReceiveSku $wMSReflectReceiveSku)
-    {
-        //
-    }
-}

+ 326 - 1104
app/Http/Controllers/api/thirdPart/flux/StoreController.php

@@ -1,1148 +1,370 @@
 <?php
 
-namespace App\Http\Controllers\Api\thirdPart\flux;
+namespace App\Http\Controllers;
 
-use App\Http\Controllers\Controller;
+use App\Depository;
+use App\Owner;
+use App\Services\LogService;
 use App\Store;
+use App\StoreItems;
+use App\Warehouse;
 use App\WMSReflectReceive;
-use App\WMSReflectReceiveSku;
 use Carbon\Carbon;
-use Illuminate\Support\Facades\Auth;
+use Illuminate\Contracts\Foundation\Application;
+use Illuminate\Contracts\View\Factory;
+use Illuminate\Http\RedirectResponse;
+use Illuminate\Http\Request;
+use Illuminate\Http\Response;
+use Illuminate\Routing\Redirector;
 use Illuminate\Support\Facades\DB;
-use Zttp\Zttp;
+use Illuminate\Support\Facades\Gate;
+use Illuminate\Support\Facades\Validator;
+use Illuminate\View\View;
+use App\Http\Controllers\Api\thirdPart\flux\StoreController as FStoreController;
 
 class StoreController extends Controller
 {
-
-
     /**
-     * 入库回传给WMS
-     * @param Store $store
-     * @return bool
+     * Display a listing of the resource.
+     *
+     * @return Application|Factory|Response|View
      */
-    public function accomplishToWMS(Store $store,array $inputs)
+    public function index()
     {
-        $METHOD=__METHOD__;
-        $FUNCTION=__FUNCTION__;
-        Controller::logS(__METHOD__, __FUNCTION__, '快递入库进入WMS接口:' . $store['asn_code']);
-        $wmsReceiveds=WMSReflectReceive::query()->where('ASNNO',$store['asn_code'])->get();
-        if($wmsReceiveds->isEmpty()){
-            (new Controller())->log(__METHOD__,'error_'.__FUNCTION__,'没有本地WMS入库单');
-            return false;
-        }
-        $success=true;
-        $wmsReceiveds->each(function ($wmsReceived)use(&$store,&$amountsItem,&$success,&$inputs,$METHOD,$FUNCTION){
-
-            $wmsSkus=$wmsReceived->skus()->get();
-            $orderNumberCode=$wmsReceived['ASNREFERENCE1']??$store['order_number'];
-            $amountsSku=(function()use($wmsSkus){
-                $result=[];
-                $wmsSkus->each(function($sku)use(&$result){
-                    $result[$sku['id']]= $sku['EXPECTEDQTY_EACH'];
-                });
-                return $result;
-            })();
-            $skuStrList=[];
-            $customerCode=$store->owner()->first()['code'];
-            $wmsSkus->each(function(WMSReflectReceiveSku $sku)use(&$skuList,&$amountsItem,&$amountsSku,&$skuStrList,$wmsReceived,$customerCode,&$inputs) {
-                $STATUS = 'ZP';
-                if(isset($inputs['quality'])&&$inputs['quality']
-                    &&$inputs['quality']!='正品') {
-                    $STATUS = 'CC';
-                }
-                $repositoryCode=$sku['LOTATT05'];
-                if(isset($inputs['depository_code'])&&$inputs['depository_code']){
-                    $repositoryCode=$inputs['depository_code'];
-                }
-                $skuStr = "
-                        {
-                            \"ORDERNUMBERCODE\": \"{$wmsReceived['ASNNO']}\",
-                            \"ASNLINENO\": \"{$sku['ASNLINENO']}\",
-                            \"SKUCODE\": \"{$sku['SKU']}\",
-                            \"QUANTITY\": \"{$sku['EXPECTEDQTY_EACH']}\",
-                            \"LOTATT04\": \"{$sku['LOTATT04']}\",
-                            \"LOTATT05\": \"{$repositoryCode}\",
-                            \"STATUS\": \"{$STATUS}\",
-                            \"USERDEFINE1\": \"{$inputs['follow_code']}\",
-                            \"USERDEFINE2\": \"\",
-                            \"USERDEFINE3\": \"\",
-                            \"UNIQUE_CODE_LIST\": [" .
-                    "]
-                        }
-                    ";
-                $skuStrList[] = $skuStr;
-            });
-            $skuStrList = implode(',',$skuStrList);
-            $json="
-                {
-                    \"request\": [
-                        {
-                            \"ORDERNUMBERCODE\": \"{$wmsReceived['ASNNO']}\",
-                            \"CUSTOMERID\": \"{$wmsReceived['CUSTOMERID']}\",
-                            \"ASNTYPE\": \"{$wmsReceived['ASNTYPE']}\",
-                            \"ASNREFERENCE1\": \"{$wmsReceived['ASNREFERENCE1']}\",
-                            \"ADDWHO\": \"WCS\",
-                            \"USERDEFINE1\": \"\",
-                            \"USERDEFINE2\": \"\",
-                            \"USERDEFINE3\": \"\",
-                            \"SKU_LIST\": [{$skuStrList}]
-                        }
-                    ]
-                }
-        ";
-
-            $sendingJson = json_decode($json,true);
-            $url=url(config('api.flux.receive.new'));
-//            (new Controller())->log($METHOD,$FUNCTION,$store['asn_code'].'||' .json_encode($sendingJson));
-            Controller::logS(__METHOD__, __FUNCTION__, '快递入库请求WMS接口开始:' . $store['asn_code']);
-            $response = Zttp::post($url, $sendingJson);
-            Controller::logS(__METHOD__, __FUNCTION__, '快递入库请求WMS接口结束:' . $store['asn_code'].'||'.$response->body());
-            $noIssues=true;
-            $json = $response->json();
-            if(!$json||!isset($json['Response'])||!$json['Response']['return']['returnFlag']=='1'){
-                $noIssues=false;
-            }
-            if($json&&isset($json['Response'])){
-                if($json['Response']['return']['returnFlag']=='2'){
-                    (new Controller())->log($METHOD,'error_'.$FUNCTION,$store['asn_code'].'||' . $response->body());
-                    return true;
-                }
-//                if(isset($json['Response']['return']['returnDesc'])&&strpos($json['Response']['return']['returnDesc'],'唯一约束')!==false){
-//                    (new Controller())->log($METHOD,'error_'.$FUNCTION,$response->body());
-//                    return true;
-//                }
-                if(isset($json['Response']['return']['errordescr'])&&strpos($json['Response']['return']['errordescr'],'已完成')!==false){
-                    (new Controller())->log($METHOD,'error_'.$FUNCTION,$store['asn_code'].'||' . $response->body());
-                    return true;
-                }
-            }
-            if($noIssues&&$json['Response']['return']['returnFlag']=='1'){
-                $wmsReceived['is_uploaded']=1;
-                $wmsReceived->save();
-                (new Controller())->log($METHOD, 'success_' .$FUNCTION,  $store['asn_code'].'||' .$response->body());
-                return true;
-            }else {
-                $success = false;
-                (new Controller())->log($METHOD, 'error_'.$FUNCTION, $store['asn_code'].'||' . $response->body());
-            }
-        });
-
-        return $success;
+        if(!Gate::allows('入库管理-快速入库-查询')){ return redirect(url('/'));  }
+        $stores=Store::orderBy('id','DESC')->paginate(50);
+        return view('store.fast.index',['stores'=>$stores]);
     }
 
-    public function quickStorage($docno){
-        //$docno = ""; //订单号 非ASN号
-        $db = DB::connection('oracle');
-        //判断单据有效性
-        $cus_bs_asnheader = $db->select(DB::raw("SELECT t.addwho FROM CUS_BS_ASNHEADER t WHERE t.ASNREFERENCE1 = '".$docno."'"));
-        if (!$cus_bs_asnheader) return ['success'=>false, 'data'=>'单据不存在'];
-        $addwho = $cus_bs_asnheader[0]->addwho;
-        if ($addwho == "WCS"){
-            //判断单据状态
-            $cus_bs_asnheader = $db->select(
-                DB::raw("SELECT 1 FROM CUS_BS_ASNHEADER t INNER JOIN DOC_ASN_HEADER a ON a.asnno = t.asnno WHERE t.asnreference1 = '".$docno."' AND a.asnstatus < '40'"));
-            if (!$cus_bs_asnheader) return ['success'=>false, 'data'=>"该单据已完成收货"];
-
-            $sql = "select a.warehouseid,a.asnno as docno,a1.asnlineno,a.customerid,t1.sku,a1.packid,t1.receivedqty_each,t1.lotatt01,t1.lotatt02,";
-            $sql .= " t1.lotatt04,t1.lotatt05,t1.lotatt08,t1.userdefine1 as new_traceid,a.userdefine1,a.userdefine2,a.userdefine3,a.userdefine4,a.userdefine5,t.addwho";
-            $sql .= " from doc_asn_details a1";
-            $sql .= " inner join doc_asn_header a on a.asnno = a1.asnno";
-            $sql .= " inner join cus_bs_asndetails t1 on t1.asnno = a.asnno and t1.asnlineno = a1.asnlineno";
-            $sql .= " inner join cus_bs_asnheader t on t.asnno = a1.asnno";
-            $sql .= " where t.asnreference1 = '".$docno."' and nvl(t1.rcvflag,'N') = 'N'";
-            $doc_asn_details = $db->select(DB::raw($sql));
-            $db->beginTransaction();
-            try{
-                $username=config('database.connections.oracle.username');
-                $password=config('database.connections.oracle.password');
-                $host=config('database.connections.oracle.host');
-                $service_name=config('database.connections.oracle.service_name');
-                $conn=oci_connect($username,$password,$host.'/'.$service_name);
-                $sql_sp="begin SPASN_Receiving_Process(:IN_Warehouse, :In_Process_Action, :In_ASNNo_C, :In_ASNLineNo_C, :In_FMTraceID_C, :In_New_TraceID_C, :In_ProductStatus,".
-                    ":In_ProductStatus_Descr, :In_HoldRejectCode_C, :In_HoldRejectReason_C, :In_PONo_C, :In_CustomerID, :In_SKU, :In_ReceivedQty, :In_RejectedQty,:In_UOM, :In_PackID,".
-                    " :In_ContainerID, :In_LotAtt01_C, :In_LotAtt02_C, :In_LotAtt03_C, :In_LotAtt04_C, :In_LotAtt05_C, :In_LotAtt06_C,".
-                    ":In_LotAtt07_C, :In_LotAtt08_C, :In_LotAtt09_C, :In_LotAtt10_C, :In_LotAtt11_C, :In_LotAtt12_C,".
-                    ":In_TotalCubic, :In_TotalGrossWeight, :In_TotalNetWeight, :In_TotalPrice, :In_UserDefine1, :In_UserDefine2,:In_UserDefine3, :In_UserDefine4, :In_UserDefine5, :In_FMLocation,".
-                    ":In_TOLocation_C,:In_QC_Type_C, :In_PlanToLoc_C,:In_ReceivingTime, :In_LPN, :In_Operator, :IN_RCVModule, :IN_RCVStation, :In_Language, :In_UserID, :OUT_Return_Code); end;";
-                foreach ($doc_asn_details as $doc_asn_detail){
-                    $result = '';
-                    $In_Process_Action = '3';
-                    $In_FMTraceID_C = '';
-                    $In_ProductStatus = '00';
-                    $In_ProductStatus_Descr = '正常';
-                    $In_HoldRejectCode_C = 'OK';
-                    $In_HoldRejectReason_C = '正常';
-                    $In_PONo_C = '';
-                    $In_RejectedQty = '';
-                    $In_UOM = 'EA';
-                    $In_ContainerID = '';
-                    $In_LotAtt03_C = '';
-                    $In_LotAtt06_C = '';
-                    $In_LotAtt07_C = '';
-                    $In_LotAtt09_C = '';
-                    $In_LotAtt10_C = '';
-                    $In_LotAtt11_C = '';
-                    $In_LotAtt12_C = '';
-                    $In_TotalCubic = '0.00';
-                    $In_TotalGrossWeight = '0.00';
-                    $In_TotalNetWeight = '0.00';
-                    $In_TotalPrice = '0.00';
-                    $In_FMLocation = 'STAGE'.$doc_asn_detail->warehouseid;
-                    $In_TOLocation_C = 'STAGE'.$doc_asn_detail->warehouseid;
-                    $In_QC_Type_C = 'OK';
-                    $In_PlanToLoc_C = '';
-                    $In_ReceivingTime = '';
-                    $In_LPN = '*';
-                    $IN_RCVModule = '';
-                    $IN_RCVStation = '';
-                    $In_Language = 'cn';
-                    $stmt = oci_parse($conn, $sql_sp);
-                    oci_bind_by_name($stmt,':IN_Warehouse',$doc_asn_detail->warehouseid);
-                    oci_bind_by_name($stmt,':In_Process_Action',$In_Process_Action);
-                    oci_bind_by_name($stmt,':In_ASNNo_C',$doc_asn_detail->docno);
-                    oci_bind_by_name($stmt,':In_ASNLineNo_C',$doc_asn_detail->asnlineno);
-                    oci_bind_by_name($stmt,':In_FMTraceID_C',$In_FMTraceID_C);
-                    oci_bind_by_name($stmt,':In_New_TraceID_C',$doc_asn_detail->new_traceid);
-                    oci_bind_by_name($stmt,':In_ProductStatus',$In_ProductStatus);
-                    oci_bind_by_name($stmt,':In_ProductStatus_Descr',$In_ProductStatus_Descr);
-                    oci_bind_by_name($stmt,':In_HoldRejectCode_C',$In_HoldRejectCode_C);
-                    oci_bind_by_name($stmt,':In_HoldRejectReason_C',$In_HoldRejectReason_C);
-                    oci_bind_by_name($stmt,':In_PONo_C',$In_PONo_C);
-                    oci_bind_by_name($stmt,':In_CustomerID',$doc_asn_detail->customerid);
-                    oci_bind_by_name($stmt,':In_SKU',$doc_asn_detail->sku);
-                    oci_bind_by_name($stmt,':In_ReceivedQty',$doc_asn_detail->receivedqty_each);
-                    oci_bind_by_name($stmt,':In_RejectedQty',$In_RejectedQty);
-                    oci_bind_by_name($stmt,':In_UOM',$In_UOM);
-                    oci_bind_by_name($stmt,':In_PackID',$doc_asn_detail->packid);
-                    oci_bind_by_name($stmt,':In_ContainerID',$In_ContainerID);
-                    oci_bind_by_name($stmt,':In_LotAtt01_C',$doc_asn_detail->lotatt01);
-                    oci_bind_by_name($stmt,':In_LotAtt02_C',$doc_asn_detail->lotatt02);
-                    oci_bind_by_name($stmt,':In_LotAtt03_C',$In_LotAtt03_C);
-                    oci_bind_by_name($stmt,':In_LotAtt04_C',$doc_asn_detail->lotatt04);
-                    oci_bind_by_name($stmt,':In_LotAtt05_C',$doc_asn_detail->lotatt05);
-                    oci_bind_by_name($stmt,':In_LotAtt06_C',$In_LotAtt06_C);
-                    oci_bind_by_name($stmt,':In_LotAtt07_C',$In_LotAtt07_C);
-                    oci_bind_by_name($stmt,':In_LotAtt08_C',$doc_asn_detail->lotatt08);
-                    oci_bind_by_name($stmt,':In_LotAtt09_C',$In_LotAtt09_C);
-                    oci_bind_by_name($stmt,':In_LotAtt10_C',$In_LotAtt10_C);
-                    oci_bind_by_name($stmt,':In_LotAtt11_C',$In_LotAtt11_C);
-                    oci_bind_by_name($stmt,':In_LotAtt12_C',$In_LotAtt12_C);
-                    oci_bind_by_name($stmt,':In_TotalCubic',$In_TotalCubic);
-                    oci_bind_by_name($stmt,':In_TotalGrossWeight',$In_TotalGrossWeight);
-                    oci_bind_by_name($stmt,':In_TotalNetWeight',$In_TotalNetWeight);
-                    oci_bind_by_name($stmt,':In_TotalPrice',$In_TotalPrice);
-                    oci_bind_by_name($stmt,':In_UserDefine1',$doc_asn_detail->userdefine1);
-                    oci_bind_by_name($stmt,':In_UserDefine2',$doc_asn_detail->userdefine2);
-                    oci_bind_by_name($stmt,':In_UserDefine3',$doc_asn_detail->userdefine3);
-                    oci_bind_by_name($stmt,':In_UserDefine4',$doc_asn_detail->userdefine4);
-                    oci_bind_by_name($stmt,':In_UserDefine5',$doc_asn_detail->userdefine5);
-                    oci_bind_by_name($stmt,':In_FMLocation',$In_FMLocation);
-                    oci_bind_by_name($stmt,':In_TOLocation_C',$In_TOLocation_C);
-                    oci_bind_by_name($stmt,':In_QC_Type_C',$In_QC_Type_C);
-                    oci_bind_by_name($stmt,':In_PlanToLoc_C',$In_PlanToLoc_C);
-                    oci_bind_by_name($stmt,':In_ReceivingTime',$In_ReceivingTime);
-                    oci_bind_by_name($stmt,':In_LPN',$In_LPN);
-                    oci_bind_by_name($stmt,':In_Operator',$doc_asn_detail->addwho);
-                    oci_bind_by_name($stmt,':IN_RCVModule',$IN_RCVModule);
-                    oci_bind_by_name($stmt,':IN_RCVStation',$IN_RCVStation);
-                    oci_bind_by_name($stmt,':In_Language',$In_Language);
-                    oci_bind_by_name($stmt,':In_UserID',$doc_asn_detail->addwho);
-                    oci_bind_by_name($stmt,':OUT_Return_Code',$result);
-                    oci_execute($stmt);
-                    if (substr($result,1,3) == '000'){
-                        $query = DB::raw("update cus_bs_asndetails t set t.rcvflag = 'Y' where t.asnno = ? and t.asnlineno = ?");
-                        $db->update($query,[$doc_asn_detail->docno,$doc_asn_detail->asnlineno]);
-                    }else{
-                        $query = DB::raw("update cus_bs_asndetails t set t.rcvflag = 'W' where t.asnno = ? and t.asnlineno = ?");
-                        $db->update($query,[$doc_asn_detail->docno,$doc_asn_detail->asnlineno]);
-                        $db->rollBack();
-                        return ['success'=>false, 'data'=>'收货失败','code'=>$result];
-                    }
-                }
-                $db->commit();
-                return ['success'=>true];
-            }catch (\Exception $e){
-                $db->rollBack();
-                return ['success'=>false, 'data'=>$e->getMessage()];
-            }
-        }
+    /**
+     * Show the form for creating a new resource.
+     *
+     * @return Application|Factory|Response|View
+     */
+    public function create()
+    {
+        if(!Gate::allows('入库管理-快速入库-录入')){ return redirect(url('/'));  }
+        return view('store.fast.create');
     }
 
-
-    /*$resule = $that->exe($doc_asn_detail->warehouseid,'3',$doc_asn_detail->docno,$doc_asn_detail->asnlineno,'',$doc_asn_detail->new_traceid,'00','正常','OK','正常',
-                        '',$doc_asn_detail->customerid,$doc_asn_detail->sku,$doc_asn_detail->receivedqty_each,'','EA',$doc_asn_detail->packid,'',$doc_asn_detail->lotatt01,$doc_asn_detail->lotatt02,
-                        '',$doc_asn_detail->lotatt04,$doc_asn_detail->lotatt05,'','',$doc_asn_detail->lotatt08,'','','','',
-                        '0.00','0.00','0.00','0.00',$doc_asn_detail->userdefine1,$doc_asn_detail->userdefine2,$doc_asn_detail->userdefine3,$doc_asn_detail->userdefine4,$doc_asn_detail->userdefine5,'STAGE'.$doc_asn_detail->warehouseid,
-                    'STAGE'.$doc_asn_detail->warehouseid,'OK','','','*',$doc_asn_detail->addwho,'','','cn',$doc_asn_detail->addwho,'');*/
-    /** $In_Process_Action为来源渠道,快速入库调用固定值 为 '3' */
-    private function exe($IN_Warehouse, $In_Process_Action, $In_ASNNo_C, $In_ASNLineNo_C, $In_FMTraceID_C, $In_New_TraceID_C, $In_ProductStatus,
-        $In_ProductStatus_Descr, $In_HoldRejectCode_C, $In_HoldRejectReason_C, $In_PONo_C, $In_CustomerID, $In_SKU, $In_ReceivedQty, $In_RejectedQty,
-        $In_UOM, $In_PackID, $In_ContainerID, $In_LotAtt01_C, $In_LotAtt02_C, $In_LotAtt03_C, $In_LotAtt04_C, $In_LotAtt05_C, $In_LotAtt06_C,
-        $In_LotAtt07_C, $In_LotAtt08_C, $In_LotAtt09_C, $In_LotAtt10_C, $In_LotAtt11_C, $In_LotAtt12_C,
-        $In_TotalCubic, $In_TotalGrossWeight, $In_TotalNetWeight, $In_TotalPrice, $In_UserDefine1, $In_UserDefine2,
-        $In_UserDefine3, $In_UserDefine4, $In_UserDefine5, $In_FMLocation, $In_TOLocation_C, $In_QC_Type_C, $In_PlanToLoc_C,
-        $In_ReceivingTime, $In_LPN, $In_Operator, $IN_RCVModule, $IN_RCVStation, $In_Language, $In_UserID, $OUT_Return_Code)
+    /**
+     * Store a newly created resource in storage.
+     *
+     * @param Request $request
+     * @return RedirectResponse|Response|Redirector
+     */
+    public function store(Request $request)
     {
-        /*$r_NO_COMMIT $R_CurrentTime $OUT_Return_Code $R_ReceivingTime $r_LPN $r_UDF2_AD $r_UDF2_IN
-        $R_Qty_PlanPutaway $R_QCTaskID $R_HOLD_FLAG $R_PA_TaskID $R_PA_Flag $R_QC_Sequence $R_PA_Sequence
-        $R_Reserve_Flag $R_QtyMVOut $r_TotalGrossWeight $r_TotalCubic r_TotalNetWeight r_TotalPrice In_LotAtt01
-        In_LotAtt02 In_LotAtt03 In_LotAtt04 In_LotAtt05 In_LotAtt06 In_LotAtt07 In_LotAtt08 In_LotAtt09 In_LotAtt10
-        In_LotAtt11 In_LotAtt12 In_HoldRejectCode In_HoldRejectReason
-        */
-        /** IS */
-        $r_OutboundLifeDays = 0;
-        $r_InboundLifeDays = 0;
-
-        if ($OUT_Return_Code == "NO_COMMIT" || $OUT_Return_Code == "*_*"){
-            $r_NO_COMMIT = 'N';
-        }else{
-            $r_NO_COMMIT = 'Y';
-        }
-        //初始化
-        $R_CurrentTime = Carbon::now();
-        $OUT_Return_Code ='000';
-        if (!$In_ReceivingTime){
-            $R_ReceivingTime = Carbon::now();
-        }else{
-            $R_ReceivingTime = $In_ReceivingTime;
-        }
-        //else R_ReceivingTime:=To_Date( IN_ReceivingTime,'YYYY/MM/DD hh24:mi:ss'); --2008-11-25 15:53:33
-
-        if ($In_LPN && $In_LPN != "*"){
-            $r_LPN = $In_LPN;
-        }else $r_LPN = "*";
-
-        $bascode = DB::select(DB::raw("SELECT udf2 FROM BAS_CODES WHERE codeid ='TRN_TYP' AND code='AD'"));
-        $r_UDF2_AD = $bascode[0]->udf2 ?? 'N';
-
-        $bascode = DB::select(DB::raw("SELECT udf2 FROM BAS_CODES WHERE codeid ='TRN_TYP' AND code='IN'"));
-        $r_UDF2_IN = $bascode[0]->udf2 ?? 'N';
-
-        $R_Qty_PlanPutaway = 0;
-        $R_QCTaskID = '*';
-        $R_HOLD_FLAG = 'N';
-        $R_PA_TaskID = '*';
-        $R_PA_Flag = 'N';
-        $R_QC_Sequence = 0;
-        $R_PA_Sequence = 0;
-        $R_Reserve_Flag = 'N';
-        $R_QtyMVOut  =  0;
-
-        $r_TotalGrossWeight = $In_TotalGrossWeight;
-        $r_TotalCubic = $In_TotalCubic;
-        $r_TotalNetWeight = $In_TotalNetWeight ?? 0;
-        $r_TotalPrice = $In_TotalPrice;
-
-        $In_LotAtt01 = $In_LotAtt01_C;
-        $In_LotAtt02 = $In_LotAtt02_C;
-        $In_LotAtt03 = $In_LotAtt03_C;
-        $In_LotAtt04 = $In_LotAtt04_C;
-        $In_LotAtt05 = $In_LotAtt05_C;
-        $In_LotAtt06 = $In_LotAtt06_C;
-        $In_LotAtt07 = $In_LotAtt07_C;
-        $In_LotAtt08 = $In_LotAtt08_C;
-        $In_LotAtt09 = $In_LotAtt09_C;
-        $In_LotAtt10 = $In_LotAtt10_C;
-        $In_LotAtt11 = $In_LotAtt11_C;
-        $In_LotAtt12 = $In_LotAtt12_C;
-
-        $In_HoldRejectCode = $In_HoldRejectCode_C;
-        $In_HoldRejectReason = $In_HoldRejectReason_C;
-
-        $In_TOLocation = $In_TOLocation_C;
-        $In_New_TraceID = $In_New_TraceID_C ?? '*';
-        $In_QC_Type = $In_QC_Type_C;
-        $In_FMTraceID = $In_FMTraceID_C;
-        $In_ASNNo = $In_ASNNo_C;
-        $In_ASNLineNo = $In_ASNLineNo_C;
-        $In_PONo = $In_PONo_C;
-        $In_PlanToLoc = $In_PlanToLoc_C;
-
-        $r_nrow = 0;
-
-        $OUT_Return_Code = '*_*';
-        //此处调用必然返回000,所以直接忽视判断进入下层逻辑
-        $OUT_Return_Code = $this->SPUDF_ProcessA($IN_Warehouse,'RCV_BEFORE',$In_ASNNo,$In_ASNLineNo,$In_ReceivedQty,$In_Language,$In_UserID,$OUT_Return_Code);
-
-        //TODO 盲收逻辑 SPASN_Receiving_Process:536行 $In_Process_Action = 2
-
-        //如果订单已经关闭或者取消,则报错
-        $doc_asn_header = DB::connection('oracle')->select(DB::raw("Select 1  from DOC_ASN_Header where ASNNO='".$In_ASNNo."' and (ASNStatus='90' or ASNStatus='99')"));
-        if ($doc_asn_header) return '201';
-
-        //收货数量必须大于0
-        if ($In_ReceivedQty <= 0 && ((!$In_ProductStatus) || $In_ProductStatus == '00')) return '204';
-
-        //批次属性自动复制 系统配置是否允许超量收货
-        $customer = DB::connection('oracle')->select(DB::raw("SELECT OverReceiving,OverRCVPercentage,ASN_LNK_PO,AsnRef1ToLot4,AsnRef2ToLot5,AsnRef3ToLot6,AsnRef4ToLot7,AsnRef5ToLot8 FROM Bas_Customer WHERE CustomerID='".$In_CustomerID."' AND Customer_Type = 'OW'"));
-        if (!$customer) return '888BAS_Customer,OPEN';
-
-        $R_OverReceiving = $customer[0]->overreceiving ?? 'N';
-        $R_OverRCVPercentage_Customer = $customer[0]->overrcvpercentage ?? 0;
-        $r_ASN_LNK_PO = $customer[0]->asn_lnk_po ?? 'Y';
-        $R_AsnRef1ToLot4 = $customer[0]->asnref1tolot4;
-        $R_AsnRef2ToLot5 = $customer[0]->asnref2tolot5;
-        $R_AsnRef3ToLot6 = $customer[0]->asnref3tolot6;
-        $R_AsnRef4ToLot7 = $customer[0]->asnref4tolot7;
-        $R_AsnRef5ToLot8 = $customer[0]->asnref5tolot8;
-
-        $DOC_ASN_Header = DB::connection('oracle')->select(DB::raw("SELECT ASNReference1,ASNReference2,ASNReference3,ASNReference4,ASNReference5,ExpectedArriveTime1,ExpectedArriveTime2,QCStatus,ASNType,WarehouseID,ReleaseStatus,Priority FROM DOC_ASN_Header WHERE ASNNO='".$In_ASNNo."'"));
-        if (!$DOC_ASN_Header) return '888DOC_ASN_Header,OPEN';
-
-        $r_ASNReference1 = $DOC_ASN_Header[0]->asnreference1;
-        $r_ASNReference2 = $DOC_ASN_Header[0]->asnreference2;
-        $r_ASNReference3 = $DOC_ASN_Header[0]->asnreference3;
-        $r_ASNReference4 = $DOC_ASN_Header[0]->asnreference4;
-        $r_ASNReference5 = $DOC_ASN_Header[0]->asnreference5;
-        $r_ExpectedArriveTime1 = $DOC_ASN_Header[0]->expectedarrivetime1 ?? "2000-01-01 00:00:00";
-        $r_ExpectedArriveTime2 = $DOC_ASN_Header[0]->expectedarrivetime2 ?? "2099-12-31 00:00:00";
-        $r_QCStatus = $DOC_ASN_Header[0]->qcstatus;
-        $r_ASNType = $DOC_ASN_Header[0]->asntype;
-        $r_WarehouseID = $DOC_ASN_Header[0]->warehouseid;
-        $R_ReleaseStatus = $DOC_ASN_Header[0]->releasestatus;
-        $r_Priority = $DOC_ASN_Header[0]->priority ?? '3';
-
-        if ($R_AsnRef1ToLot4 == 'Y' && ($r_ASNReference1 && $r_ASNReference1 != "*") && ((!$In_LotAtt04) || $In_LotAtt04=='*')){
-            $In_LotAtt04 = $r_ASNReference1;
-        }
-        if ($R_AsnRef2ToLot5 == 'Y' && ($r_ASNReference2 && $r_ASNReference2 != "*") && ((!$In_LotAtt05) || $In_LotAtt05=='*')){
-            $In_LotAtt05 = $r_ASNReference2;
-        }
-        if ($R_AsnRef3ToLot6 == 'Y' && ($r_ASNReference3 && $r_ASNReference3 != "*") && ((!$In_LotAtt06) || $In_LotAtt06=='*')){
-            $In_LotAtt06 = $r_ASNReference3;
-        }
-        if ($R_AsnRef4ToLot7 == 'Y' && ($r_ASNReference4 && $r_ASNReference4 != "*") && ((!$In_LotAtt07) || $In_LotAtt07=='*')){
-            $In_LotAtt07 = $r_ASNReference4;
-        }
-        if ($R_AsnRef5ToLot8 == 'Y' && ($r_ASNReference5 && $r_ASNReference5 != "*") && ((!$In_LotAtt08) || $In_LotAtt08=='*')){
-            $In_LotAtt08 = $r_ASNReference5;
-        }
-
-        if ($In_LotAtt01 == 'YYYY-MM-DD') $In_LotAtt01 = null;
-        if ($In_LotAtt02 == 'YYYY-MM-DD') $In_LotAtt02 = null;
-        if ($In_LotAtt03 == 'YYYY-MM-DD') $In_LotAtt03 = null;
-
-        // TODO SPASN_Receiving_Process:643行 IN_ProductStatus固定值00 跳过
-
-        //生产日期、入库日期、失效日期的逻辑校验
-        if (($In_LotAtt01 && $In_LotAtt02 && Carbon::parse($In_LotAtt01)->gte(Carbon::parse($In_LotAtt02))) || ($In_LotAtt01 && Carbon::parse($In_LotAtt01)->gt(Carbon::parse($R_CurrentTime)))){
-            return "260";
-        }
-        $r_ASN_MDT_CHK = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'ASN_MDT_CHK');
-
-        //入库生产日期不能小于在库库存生产日期
-        if ($r_ASN_MDT_CHK == 'Y' && trim($In_LotAtt01)){
-            $data = DB::connection('oracle')->select(DB::raw("SELECT 1 c FROM INV_LOT_LOC_ID a,INV_LOT_ATT b, bas_location c WHERE a.CUSTOMERID='".$In_CustomerID.
-                "' AND a.sku='".$In_SKU."' AND a.LotNum=b.LotNum AND a.LocationID=c.LocationID AND c.LocationUsage<>'ST' AND b.LotAtt01>'".$In_LotAtt01."'"));
-            if ($data) return '266INV_LOT_LOC_ID';
-        }
-
-        //批次属性必输校验
-        $BAS_lotID = DB::connection('oracle')->select(DB::raw("SELECT LotAtt01_Flag,LotAtt02_Flag,LotAtt03_Flag,LotAtt04_Flag,LotAtt05_Flag,LotAtt06_Flag,".
-            "LotAtt07_Flag,LotAtt08_Flag,LotAtt09_Flag,LotAtt10_Flag,LotAtt11_Flag,LotAtt12_Flag,OverRCVPercentage,a.LotID,PackID,".
-            "GrossWeight,Cube,CopyPackIDToLotAtt12,AllowReceiving,A.SKU_Group1 FROM Bas_SKU a, BAS_lotID b WHERE a.CustomerID='".$In_CustomerID."' AND a.sku='".$In_SKU."' AND a.LotID=b.LotID"));
-        if (!$BAS_lotID)return "888From Bas_SKU*BAS_lotID,OPEN";
-        $r_LotAtt01_Flag = $BAS_lotID[0]->lotatt01_flag;
-        $r_LotAtt02_Flag = $BAS_lotID[0]->lotatt02_flag;
-        $r_LotAtt03_Flag = $BAS_lotID[0]->lotatt03_flag;
-        $r_LotAtt04_Flag = $BAS_lotID[0]->lotatt04_flag;
-        $r_LotAtt05_Flag = $BAS_lotID[0]->lotatt05_flag;
-        $r_LotAtt06_Flag = $BAS_lotID[0]->lotatt06_flag;
-        $r_LotAtt07_Flag = $BAS_lotID[0]->lotatt07_flag;
-        $r_LotAtt08_Flag = $BAS_lotID[0]->lotatt08_flag;
-        $r_LotAtt09_Flag = $BAS_lotID[0]->lotatt09_flag;
-        $r_LotAtt10_Flag = $BAS_lotID[0]->lotatt10_flag;
-        $r_LotAtt11_Flag = $BAS_lotID[0]->lotatt11_flag;
-        $r_LotAtt12_Flag = $BAS_lotID[0]->lotatt12_flag;
-        $r_OverRCVPercentage_SKU = $BAS_lotID[0]->overrcvpercentage ?? 0;
-        $r_SKU_LOTID = $BAS_lotID[0]->lotid;
-        $r_SKU_PackID = $BAS_lotID[0]->packid;
-        $r_SKU_GrossWeight = $BAS_lotID[0]->grossweight;
-        $r_SKU_Cube = $BAS_lotID[0]->cube;
-        $r_CopyPackIDToLotAtt12 = $BAS_lotID[0]->copypackidtolotatt12;
-        $r_AllowReceiving = $BAS_lotID[0]->allowreceiving;
-        $r_SKU_Group1 = $BAS_lotID[0]->sku_group1;
-        //是否被设置禁止入库
-        if ($r_AllowReceiving == 'N') return "117";
-        if (($r_LotAtt01_Flag == '3' && !$In_LotAtt01) ||
-            ($r_LotAtt02_Flag == "3" && !$In_LotAtt02) ||
-            ($r_LotAtt03_Flag == "3" && !$In_LotAtt03) ||
-            ($r_LotAtt04_Flag == "3" && !$In_LotAtt04) ||
-            ($r_LotAtt05_Flag == "3" && !$In_LotAtt05) ||
-            ($r_LotAtt06_Flag == "3" && !$In_LotAtt06) ||
-            ($r_LotAtt07_Flag == "3" && !$In_LotAtt07) ||
-            ($r_LotAtt08_Flag == "3" && !$In_LotAtt08) ||
-            ($r_LotAtt09_Flag == "3" && !$In_LotAtt09) ||
-            ($r_LotAtt10_Flag == "3" && !$In_LotAtt10) ||
-            ($r_LotAtt11_Flag == "3" && !$In_LotAtt11) ||
-            ($r_LotAtt12_Flag == "3" && !$In_LotAtt12))return "221".$In_ASNLineNo_C;
-        if ($r_LotAtt01_Flag == '1' && $In_LotAtt01) $In_LotAtt01 = null;
-        if ($r_LotAtt02_Flag == '1' && $In_LotAtt02) $In_LotAtt02 = null;
-        if ($r_LotAtt03_Flag == '1' && $In_LotAtt03) $In_LotAtt03 = null;
-        if ($r_LotAtt04_Flag == '1' && $In_LotAtt04) $In_LotAtt04 = null;
-        if ($r_LotAtt05_Flag == '1' && $In_LotAtt05) $In_LotAtt05 = null;
-        if ($r_LotAtt06_Flag == '1' && $In_LotAtt06) $In_LotAtt06 = null;
-        if ($r_LotAtt07_Flag == '1' && $In_LotAtt07) $In_LotAtt07 = null;
-        if ($r_LotAtt08_Flag == '1' && $In_LotAtt08) $In_LotAtt08 = null;
-        if ($r_LotAtt09_Flag == '1' && $In_LotAtt09) $In_LotAtt09 = null;
-        if ($r_LotAtt10_Flag == '1' && $In_LotAtt10) $In_LotAtt10 = null;
-        //if ($r_LotAtt11_Flag == '1' && $In_LotAtt11) $In_LotAtt11 = null;
-        if ($r_LotAtt12_Flag == '1' && $In_LotAtt12) $In_LotAtt12 = null;
-
-        $R_LOT_12_PKG = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'LOT_#12_PKG');
-        // 批次属性12被设置为跟踪包装数量,不允许输入非数字字符'
-        if ($R_LOT_12_PKG == 'Y' && !is_numeric($In_LotAtt12)) return "232";
-
-        if ($r_OverRCVPercentage_SKU != 0) $r_OverRCVPercentage = $r_OverRCVPercentage_SKU;
-        else $r_OverRCVPercentage = $R_OverRCVPercentage_Customer;
-
-        // TODO 药品相关逻辑 SPASN_Receiving_Process:817行 药品有效期 证书有效期 经营许可证有效期校验提示
-
-        //基础设置是否维护完全校验
-        $R_BAS_PAC_CHK = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'BAS_PAC_CHK');
-        $R_BAS_LOT_CHK = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'BAS_LOT_CHK');
-        $R_BAS_GWT_CHK = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'BAS_GWT_CHK');
-        $R_BAS_CUB_CHK = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'BAS_CUB_CHK');
-        if ($R_BAS_PAC_CHK == 'Y' && !$r_SKU_PackID)return '110'.$In_SKU;
-        if ($R_BAS_LOT_CHK == 'Y' && !$r_SKU_LOTID)return '111';
-        if ($R_BAS_GWT_CHK == 'Y' && $r_SKU_GrossWeight == 0)return '112';
-        if ($R_BAS_CUB_CHK == 'Y' && $r_SKU_Cube == 0)return '113';
-
-        //订单释放状态校验
-        if($R_ReleaseStatus == 'N') return '226';
-
-        /*参数准备 */
-        //必须输入价格
-        $R_UNT_PRI_CTL = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'UNT_PRI_CTL');
-        //收货后打印上架标签
-        $R_PRT_PTA_LBL = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'PRT_PTA_LBL');
-        //ASN收货自动产生跟踪号
-        $r_ASN_GEN_TID = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'ASN_GEN_TID');
-        //收货后将收货结果更新ASN明细
-        $r_ASN_RCV_UPD = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'ASN_RCV_UPD');
-        //完全收货后自动关闭ASN
-        $r_RCV_CTL = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'RCV_CTL');
-        //超过产品有效期控制天数是否拒收
-        $r_EXP_CTL = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'EXP_CTL');
-        //码盘后才能收货
-        $r_PLT_RCV = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'PLT_RCV');
-        //跨区域货物是否允许收到一个托盘上
-        $r_RCV_CRS_ARA = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'RCV_CRS_ARA');
-        //收货时必须指定跟踪号
-        $r_RCV_TID_CTL = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'RCV_TID_CTL');
-        //超额收货
-        $R_OverReceiving = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'OVR_RCV');
-        //收货时间必须在预期到货时间范围内
-        $r_RCV_TIM_CTL = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'RCV_TIM_CTL');
-        //同一跟踪号不允许在收货区重复收货
-        $r_RCV_MIX_TID = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'RCV_MIX_TID');
-        //只有上架确认后才能关闭ASN
-        $r_PTA_CLS_CHK = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'PTA_CLS_CHK');
-        //收货数量拆分寻找目标库位
-        $r_RCV_BRK_TSK = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'RCV_BRK_TSK');
-        //扫描收货时记录箱码和序列号
-        $r_SN_CTL = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'SN#_CTL','0');
-        //质检后才能收货
-        $r_QC_RCV_CTL = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'QC_RCV_CTL');
-        //目标库位为拆零拣货位拆箱时作废箱码
-        $r_PCK_LOS_SN = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'PCK_LOS_SN');
-        //服装行业插件开关
-        $r_IND_TEX = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'IND_TEX');
-
-        if ($In_Process_Action != '2'){
-            $DOC_ASN_DETAiLS = DB::connection('oracle')->select(DB::raw("SELECT ExpectedQty_Each,ReceivedQty_Each,POLineNO,PONO,OverRCVPercentage,ContainerID,QCStatus FROM DOC_ASN_DETAiLS WHERE ASNNO='".$In_ASNNo."' AND ASNLineNo='".$In_ASNLineNo."' FOR UPDATE"));
-            if (!$DOC_ASN_DETAiLS)return '104'.$In_ASNNo.":".$In_ASNLineNo;
-            $r_ExpectedQty_Each_ASN = $DOC_ASN_DETAiLS[0]->expectedqty_each;
-            $r_ReceivedQty_Each_ASN = $DOC_ASN_DETAiLS[0]->receivedqty_each;
-            $r_POLineNO = $DOC_ASN_DETAiLS[0]->polineno;
-            $r_PONO = $DOC_ASN_DETAiLS[0]->pono;
-            $R_OverRCVPercentage_ASN = $DOC_ASN_DETAiLS[0]->overrcvpercentage;
-            $r_ASNContainerID = $DOC_ASN_DETAiLS[0]->containerid ?? '';
-            $r_QCStatus = $DOC_ASN_DETAiLS[0]->qcstatus ?? '';
-        }
-
-        //目标库位属性
-        if ($In_TOLocation == '*' || !trim($In_TOLocation))$In_TOLocation = $In_FMLocation;
-
-        $BAS_Location = DB::connection('oracle')->select(DB::raw("SELECT LocationUsage,LoseID_Flag,Mix_Flag,Mix_LotFlag,LocationAttribute,SKUCount FROM BAS_Location WHERE LocationID='".$In_TOLocation."'"));
-        if (!$BAS_Location)return '104'.$In_TOLocation;
-        $R_LocationUsage = $BAS_Location[0]->locationusage;
-        $R_LoseID_Flag = $BAS_Location[0]->loseid_flag ?? 'N';
-        $R_Mix_Flag = $BAS_Location[0]->mix_flag ?? 'Y';
-        $R_Mix_LotFlag = $BAS_Location[0]->mix_lotflag ?? 'Y';
-        $r_LocationAttribute = $BAS_Location[0]->locationattribute;
-        $r_SKUCount = $BAS_Location[0]->skucount;
-
-        if($r_QC_RCV_CTL == 'Y' && $r_QCStatus != '20')return '272';
-
-        //如果ASN中ContainerID有值,并且收货SP没有传递跟踪号,则以ContainerID作为跟踪号
-        if ($r_ASNContainerID && (!$In_New_TraceID || $In_New_TraceID == '*'))$In_New_TraceID = $r_ASNContainerID;
-
-        $IN_New_TraceID_OLD = $In_New_TraceID;
-
-        if ($r_RCV_TID_CTL == 'Y' && (!$In_New_TraceID || $In_New_TraceID=='*'))return '270';
-        //必须维护单价后才能收货
-        if ($R_UNT_PRI_CTL == 'Y'){
-            if (!$In_TotalPrice || $In_TotalPrice <= 0)return '050';
-        }
-
-        if($r_RCV_TIM_CTL == 'Y' && ($R_CurrentTime->lt(Carbon::parse($r_ExpectedArriveTime1)) || $R_CurrentTime->gt($r_ExpectedArriveTime2)))return '271';
-
-        // 同一跟踪号不允许混收产品
-        if (strtoupper($In_FMLocation) == 'SCANSTATION')$r_RCV_MIX_SKU = 'Y';
-        else $r_RCV_MIX_SKU=$this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'RCV_MIX_SKU', 'Y');
-
-        $r_RCV_MIX_GR1 = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'RCV_MIX_GR1', 'Y','C');
-
-        //跟踪号的校验处理
-        if ($In_New_TraceID != '*' && trim($In_New_TraceID)){
-            if ($R_LoseID_Flag == 'N'){
-                if ($r_RCV_MIX_TID == 'N'){ //跟踪号是否可以多次收货
-                    $INV_LOT_LOC_ID = DB::connection('oracle')->select(DB::raw("SELECT 1 FROM INV_LOT_LOC_ID a INNER JOIN view_MultiWarehouse b ON a.LOCATIONID = b.LOCATIONID WHERE b.WAREHOUSEID = '".
-                        $IN_Warehouse."' AND  TraceID='".$In_New_TraceID."' AND qty>0"));
-                    if ($INV_LOT_LOC_ID) return '218跟踪号重复错误ID='.$In_New_TraceID;
-                }else{
-                    if ($r_RCV_MIX_SKU == 'N'){
-                        $TABLE_INV_LOT_LOC_ID = DB::connection('oracle')->select(DB::raw("SELECT 1 FROM INV_LOT_LOC_ID a INNER JOIN view_MultiWarehouse b ON a.locationid = b.LocationID WHERE b.WarehouseID = '".
-                        $IN_Warehouse."' AND TraceID = '".$In_New_TraceID."' AND sku <> '".$In_SKU."' AND qty>0"));
-                        if ($TABLE_INV_LOT_LOC_ID) return '273';
-                    }elseif ($r_RCV_MIX_GR1 == 'N'){
-                        $TABLE_INV_LOT_LOC_ID = DB::connection('oracle')->select(DB::raw("SELECT 1 FROM INV_LOT_LOC_ID a INNER JOIN view_MultiWarehouse b ON a.locationid = b.LocationID INNER JOIN Bas_Sku C ON A.CUSTOMERID = C.CUSTOMERID AND A.SKU = C.SKU WHERE b.WarehouseID = '".
-                            $IN_Warehouse."' AND TraceID='".$In_New_TraceID."' AND C.SKU_GROUP1 <> '".$r_SKU_Group1."' AND qty>0"));
-                        if ($TABLE_INV_LOT_LOC_ID)return '273';
-                    }
-                    //ID是否重复
-                    $TABLE_INV_LOT_LOC_ID = DB::connection('oracle')->select(DB::raw("SELECT 1 FROM INV_LOT_LOC_ID a INNER JOIN view_MultiWarehouse b on a.locationid = b.LocationID where b.WarehouseID ='".
-                        $IN_Warehouse."' AND a.LocationID<>'".$In_TOLocation."' AND a.TraceID='".$In_New_TraceID."' AND a.QTY>0"));
-                    if ($TABLE_INV_LOT_LOC_ID)return '218'.$In_New_TraceID;
-                }
-            }else $In_New_TraceID = '*';
-        }
-
-        //r_QtyOnHold:=0
-        if (!trim($In_HoldRejectCode)) $In_HoldRejectCode = 'OK'; //TODO 1098行
-
-        //ID合法性校验 禁止收货到封存库位
-        if (in_array($r_LocationAttribute,["HD","FI"]))return '228';
-
-        //混放产品校验
-        if (($R_Mix_Flag == 'N' || $r_SKUCount > 0) && $R_LocationUsage != 'ST'){
-            $TABLE_inv_lot_LOC_ID = DB::connection('oracle')->select(DB::raw("SELECT COUNT(distinct SKU) c FROM inv_lot_LOC_ID WHERE LocationID='".$In_TOLocation."' AND sku <> '".$In_SKU.
-                "' AND Qty > 0"));
-            if ($TABLE_inv_lot_LOC_ID){
-                if ($TABLE_inv_lot_LOC_ID[0]->c >= 1 && $R_Mix_Flag == 'N')return '205'.rtrim($In_TOLocation);
-                elseif ($R_Mix_Flag == 'Y' && $r_SKUCount > 0 && $TABLE_inv_lot_LOC_ID[0]->c >= $r_SKUCount) return '367'.$r_SKUCount;
-            }
-        }
-
-        //码盘后才能收货
-        if (!rtrim($In_FMTraceID))$In_FMTraceID = '*';
-        if ($r_PLT_RCV == 'Y' && $In_FMTraceID == '*')return '217';
-        if ($In_FMTraceID != '*'){
-            //无论是ASn收货还是码盘收货, 交易里的FMUOM/QTY/Packid都取收货的数据
-            $TABLE_DOC_Trace_Details = DB::connection('oracle')->select(DB::raw("SELECT PlanToLoc, UOM, LineStatus, Reserve_Flag,Lotnum, ExpectedQty_Each - ReceivedQty_Each from DOC_Trace_Details ".
-            "WHERE TraceID=In_FMTraceID  AND ASNNO='".$In_ASNNo."' AND ASNLineNO='".$In_ASNLineNo."'"));
-            if (!$TABLE_DOC_Trace_Details) return '104'.$In_ASNNo.":".$In_ASNLineNo;
-            $r_PlanToLoc_Trace = $TABLE_DOC_Trace_Details[0]->plantoloc;
-            $r_TraceUOM = $TABLE_DOC_Trace_Details[0]->uom;
-            $r_LineStatus_Trace = $TABLE_DOC_Trace_Details[0]->linestatus;
-            $R_Reserve_Flag = $TABLE_DOC_Trace_Details[0]->reserve_flag;
-            $r_Lotnum_Trace = $TABLE_DOC_Trace_Details[0]->lotnum;
-            $r_CancelQty_Trace = $TABLE_DOC_Trace_Details[0]->expectedqty_each - $TABLE_DOC_Trace_Details[0]->receivedqty_each;
-
-            if ($R_Reserve_Flag == 'Y' && $R_LocationUsage != 'ST'){
-                $OUT_Return_Code = '*_*';
-                $OUT_Return_Code = $this->spasn_reserve_cancel($IN_Warehouse, 'TRACEID', $In_ASNNo, $In_ASNLineNo, $In_FMTraceID, $In_Language, $In_UserID, $OUT_Return_Code);
-                if (substr($OUT_Return_Code,1,3) != '000'){
-                    DB::rollBack();
-                    return $OUT_Return_Code;
-                }
-            }
-        }else{
-            //没有码盘
-            $r_FMUOM = $In_UOM;
-            $r_FMPackID = $In_PackID;
-            $r_FMQty_Each = '';
-            $r_FMQty = $In_ReceivedQty;
-        }
-
-        //收货时使用的包装数量转换
-        $TABLE_bas_Package = DB::connection('oracle')->select(DB::raw("SELECT QTY1,QTY2,QTY3,QTY4,QTY5,IN_Label1,IN_Label3,IN_Label4 FROM bas_Package where PackID='".$In_PackID."'"));
-        if (!$TABLE_bas_Package)return '104'.$In_PackID;
-        $r_QTY1_P = $TABLE_bas_Package[0]->qty1;
-        $r_QTY2_P = $TABLE_bas_Package[0]->qty2;
-        $r_QTY3_P = $TABLE_bas_Package[0]->qty3;
-        $r_QTY4_P = $TABLE_bas_Package[0]->qty4;
-        $r_QTY5_P = $TABLE_bas_Package[0]->qty5;
-        $r_IN_Label1 = $TABLE_bas_Package[0]->in_label1;
-        $r_IN_Label3 = $TABLE_bas_Package[0]->in_label3;
-        $r_IN_Label4 = $TABLE_bas_Package[0]->in_label4;
+        if(!Gate::allows('入库管理-快速入库-录入')){ return redirect(url('/'));  }
+        $this->validator($request);
+        if ($request->test)$result = $this->quickStorage($request->input('asn_code'),$request->input('quality') == '正品' ? 'ZP' : 'CC',$request->input('depository_code'));
+        else $result = $this->quickStorage_temp($request->input('asn_code'),$request->input('quality'),$request->input('depository_code'));
+        $response = redirect('store/fast/create');
+        if ($result['success'])return redirect('store/fast/create')->with('successTip',$result['data']);
+        return $response->with('successError',$result['data']);
+    }
 
-        if ($r_CopyPackIDToLotAtt12 == 'Y')$In_LotAtt12 = $r_QTY3_P;
-        if ($R_LOT_12_PKG == 'Y' && $In_UOM == 'CS')$R_UOMQty_Read = $In_LotAtt12;
-        else{
-            switch ($In_UOM){
-                case 'EA':
-                    $R_UOMQty_Read = $r_QTY1_P;
-                    break;
-                case 'IP':
-                    $R_UOMQty_Read = $r_QTY2_P;
-                    break;
-                case 'CS':
-                    $R_UOMQty_Read = $r_QTY3_P;
-                    break;
-                case 'PL':
-                    $R_UOMQty_Read = $r_QTY4_P;
-                    break;
-                case 'OT':
-                    $R_UOMQty_Read = $r_QTY5_P;
-                    break;
-            }
+    public function quickStorage_temp($asn,$quality,$depository_code){
+        $WMSReflectReceive=WMSReflectReceive::with('skus')->where('ASNNO',$asn)->first();
+        if (!$WMSReflectReceive)return ['success'=>false, 'data'=>"ASN编号不存在!"];
+        $warehouse=Warehouse::query()->where('code',$WMSReflectReceive->WAREHOUSEID)->first();
+        if (!$warehouse&&$WMSReflectReceive->WAREHOUSEID){
+            $warehouse=new Warehouse([
+                'name'=>$WMSReflectReceive->WAREHOUSEID,
+                'code'=>$WMSReflectReceive->WAREHOUSEID
+            ]);
+            $warehouse->save();
         }
-        $r_FMQty_Each = ($r_FMQty ?? 0) * ($R_UOMQty_Read ?? 0);
-        $r_ReceivedQty_Each = $In_ReceivedQty * ($R_UOMQty_Read ?? 0);
-
-        if (!$r_TotalCubic) $r_TotalCubic = ($r_SKU_Cube ?? 0) * $r_ReceivedQty_Each;
-
-        if ($In_Process_Action != 2){
-            if ($R_OverRCVPercentage_ASN ?? false)$r_OverRCVPercentage = $R_OverRCVPercentage_ASN;
-            //质检控制
-            if ($r_QC_RCV_CTL == 'C'){ //校验合格数
-                $TABLE_ACT_QC_Transaction = DB::connection('oracle')->select(DB::raw("SELECT SUM(QCQty_PASS) pass FROM ACT_QC_Transaction a INNER JOIN DOC_QC_Header b ON A.QCNo = b.QcNo WHERE B.ASNNo = '".$In_ASNNo."' AND A.AsnLineNo = '".$In_ASNLineNo."' AND B.QCStatus < '90'"));
-                if ($TABLE_ACT_QC_Transaction)$r_QCQTY_Pass = $TABLE_ACT_QC_Transaction[0]->pass;
-                if ((($r_ReceivedQty_Each_ASN ?? 0) + $r_ReceivedQty_Each) > ($r_QCQTY_Pass ?? 0)) return '225';
-            }else{
-                $TABLE_doc_QC_Details = DB::connection('oracle')->select(DB::raw("SELECT C.UDF1 from doc_QC_Details a INNER JOIN doc_QC_Header b ON a.QcNo = b.QcNo INNER JOIN BAS_Codes C ON a.QCResult = C.Code and codeid = 'QC_RST' WHERE B.ASNNo = '".$In_ASNNo."' and A.AsnLineNo = '".$In_ASNLineNo."' and B.QCStatus < '90' and rownum = 1"));
-                if ($TABLE_doc_QC_Details) $r_UDF1 = $TABLE_doc_QC_Details[0]->udf1;
-                if ($r_UDF1 ?? false){
-                    if ($r_UDF1 == 'NOPASS')return '229'; //拒收,原因:质检不合格'
-                    if ($r_UDF1 == 'CONTROL'){
-                        $TABLE_ACT_QC_Transaction = DB::connection('oracle')->select(DB::raw("Select SUM(QcQty_Reject) QcQty_Reject from ACT_QC_Transaction a inner join DOC_QC_Header b ON A.QCNo = b.QcNo Where B.ASNNo = '".$In_ASNNo."' and A.AsnLineNo = '".$In_ASNLineNo."' and B.QCStatus <> '90'"));
-                        if ($TABLE_ACT_QC_Transaction) $r_QCQTY_Reject = $TABLE_ACT_QC_Transaction[0]->qcqty_reject;
-                        if (($r_ReceivedQty_Each_ASN ?? 0 + $r_ReceivedQty_Each) > ($r_ExpectedQty_Each_ASN ?? 0 - ($r_QCQTY_Reject ?? 0)))return '225'; //超出质检合格数
-                    }
-                }
-            }
+        $owner=Owner::query()->where('code',$WMSReflectReceive->CUSTOMERID)->first();
+        if (!$owner&&$WMSReflectReceive->CUSTOMERID){
+            $owner=new Owner([
+                'name'=>$WMSReflectReceive->CUSTOMERID,
+                'code'=>$WMSReflectReceive->CUSTOMERID
+            ]);
+            $owner->save();
         }
-
-        //超量收货校验
-        if ($R_OverReceiving != 'Y' && ($r_ExpectedQty_Each_ASN ?? false) && ($In_Process_Action != 2)){
-            if ((($r_ReceivedQty_Each_ASN ?? 0) + $r_ReceivedQty_Each) > $r_ExpectedQty_Each_ASN)return '215';
-            if (($r_PONO ?? false) && $r_PONO != '*' && ($r_POLineNO ?? false)){
-                $TABLE_DOC_PO_DETAiLS = DB::connection('oracle')->select(DB::raw("SELECT OrderedQty_Each, ReceivedQty_Each From DOC_PO_DETAiLS where PONO='".$r_PONO."' AND POLineNo='".$r_POLineNO."'"));
-                if ($TABLE_DOC_PO_DETAiLS){
-                    $r_OrderedQty_PO = $TABLE_DOC_PO_DETAiLS[0]->orderedqty_each;
-                    $r_ReceivedQty_Each_PO = $TABLE_DOC_PO_DETAiLS[0]->receivedqty_each;
-                }
-                if ((($r_ReceivedQty_Each_PO ?? 0) + $r_ReceivedQty_Each > ($r_OrderedQty_PO ?? 0)))return '215'.$In_CustomerID.",PONo=".$r_PONO;
-            }
-        }
-
-        if ($R_OverReceiving == 'Y' && $r_OverRCVPercentage && ($r_ExpectedQty_Each_ASN ?? false) && $In_Process_Action != 2){//有百分比限制
-            $r_OVR_RCV_BY = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'OVR_RCV_BY','BOTH');
-            if (in_array($r_OVR_RCV_BY,["ASN","BOTH"])){
-                if (((($r_ReceivedQty_Each_ASN ?? 0) + $r_ReceivedQty_Each) / $r_ExpectedQty_Each_ASN) > (1+$r_OverRCVPercentage))return '215'.$In_CustomerID;
-            }elseif (in_array($r_OVR_RCV_BY,["PO","BOTH"])){
-                if (($r_PONO ?? false) && $r_PONO!='*' && ($r_POLineNO ?? false)){
-                    $TABLE_DOC_PO_DETAiLS = DB::connection('oracle')->select(DB::raw("Select OrderedQty_Each, ReceivedQty_Each From DOC_PO_DETAiLS where PONO=r_PONO AND POLineNo=r_POLineNo"));
-                    if ($TABLE_DOC_PO_DETAiLS){
-                        $r_OrderedQty_PO = $TABLE_DOC_PO_DETAiLS[0]->orderedqty_each;
-                        $r_ReceivedQty_Each_PO = $TABLE_DOC_PO_DETAiLS[0]->receivedqty_each;
+        $store=Store::query()->where('asn_code',$WMSReflectReceive->ASNNO)->first();
+        if(!$store){
+            $store=new Store([
+                'asn_code'=>$WMSReflectReceive->ASNNO,
+                'warehouse_id'=>$warehouse->id,
+                'owner_id'=>$owner->id,
+                'stored_method'=>'快速入库',
+                'status'=>'未入库',
+                'remark'=>$WMSReflectReceive->NOTES,
+            ]);
+            $store->save();
+
+            $customDepository=(function()use($depository_code){
+                $customDepository=Depository::query()->where('code',$depository_code)->first();
+                if($depository_code){
+                    if (!$customDepository){
+                        $depository=new Depository([
+                            'name'=>$depository_code,
+                            'code'=>$depository_code
+                        ]);
+                        $depository->save();
                     }
-                    if (((($r_ReceivedQty_Each_PO ?? 0) + $r_ReceivedQty_Each) / ($r_OrderedQty_PO ?? 0)) > (1+$r_OverRCVPercentage)) return '215'.$In_CustomerID.',PONo='.$r_PONO;
                 }
-            }
-        }
-
-        if ($In_ASNNo == '*') $r_DocType = '*';
-        else $r_DocType = 'ASN';
-
-        //RF收货产生新的ID [In_New_TraceID],自动打印上架标签
-        if ($In_New_TraceID == '*' && ($R_PRT_PTA_LBL == 'Y' || $r_ASN_GEN_TID == 'Y')){
-            if ($R_LoseID_Flag != 'Y'){
-               // $OUT_Return_Code = $this->spcom_getidsequence(); //1331 此SP调用 恒定返回000 无意义调用
-                $OUT_Return_Code = '000';
-            }
-        }
-        //判断目标库位是否冻结 @LocationHold
-        $TABLE_ACT_InventoryHold = DB::connection('oracle')->select(DB::raw("Select count(1) c From ACT_InventoryHold Where HoldBy='2' and HoldFlag='Y' and LocationID='".$In_TOLocation."'"));
-        if ($TABLE_ACT_InventoryHold)$r_nrow = $TABLE_ACT_InventoryHold[0]->c;
-        if ($r_nrow >= 1) $r_LocationHold = 'Y';
-        $r_LogicalFMSequence = null;
-        $r_LogicalToSequence = null;
-        $TABLE_BAS_Location = DB::connection('oracle')->select(DB::raw("select LogicalSequence From BAS_Location Where LocationID= '".$In_PlanToLoc."'"));
-        if (!$TABLE_BAS_Location) $r_LogicalToSequence = 0;
-        else $r_LogicalToSequence = $TABLE_BAS_Location[0]->logicalsequence;
-        $TABLE_BAS_Location = DB::connection('oracle')->select(DB::raw("select LogicalSequence From BAS_Location Where LocationID='".$In_TOLocation."'"));
-        if (!$TABLE_BAS_Location) $r_LogicalFMSequence = 0;
-        else $r_LogicalFMSequence = $TABLE_BAS_Location[0]->logicalsequence;
-        $r_MaxPATaskID_Sequence = 0;
-        $r_MaxQCTaskID_Sequence = 0;
-
-        // <<Loop1>>
-        //批号处理
-        if ($In_Process_Action != '2'){
-            $r_nrow = 1;
-            $query = DB::raw("SELECT LotNum from INV_LOT_ATT where CustomerID='".$In_CustomerID."' and SKU=in_SKU".
-                " and nvl(LotAtt01,'*')=nvl(rtrim('".$In_LotAtt01."'),'*') and nvl(LotAtt02,'*')=nvl(rtrim('".$In_LotAtt02."'),'*') and nvl(LotAtt03,'*')=nvl(rtrim('".$In_LotAtt03."'),'*')".
-                " and nvl(LotAtt04,'*')=nvl(rtrim('".$In_LotAtt04."'),'*') and nvl(LotAtt05,'*')=nvl(rtrim('".$In_LotAtt05."'),'*') and nvl(LotAtt06,'*')=nvl(rtrim('".$In_LotAtt06."'),'*')".
-                " and nvl(LotAtt07,'*')=nvl(rtrim('".$In_LotAtt07."'),'*') and nvl(LotAtt08,'*')=nvl(rtrim('".$In_LotAtt08."'),'*') and nvl(LotAtt09,'*')=nvl(rtrim('".$In_LotAtt09."'),'*')".
-                " and nvl(LotAtt10,'*')=nvl(rtrim('".$In_LotAtt10."'),'*') and nvl(LotAtt11,'*')=nvl(rtrim('".$In_LotAtt11."'),'*') and nvl(LotAtt12,'*')=nvl(rtrim('".$In_LotAtt12."'),'*') and rownum=1");
-            $data = DB::connection('oracle')->select($query);
-            if (!$data) $r_nrow = 0;
-            else $r_Return_LotNum = $data[0]->lotnum;
-
-            //产生新的批号
-            if($r_nrow <= 0){
-                //SP: SPCOM_GetIDSequence(IN_Warehouse,IN_Language,'LOTNumber',r_Return_LotNum,OUT_Return_Code);
-                $r_Return_LotNum = '0';
-                $OUT_Return_Code = '000';
-
-                //TODO CREATE INV_LOT_ATT
-                DB::connection('oracle')->insert(DB::raw("INSERT INTO INV_LOT_ATT (CustomerID,SKU,LotNum,LotAtt01,LotAtt02,LotAtt03,LotAtt04,LotAtt05,LotAtt06,LotAtt07,LotAtt08,LotAtt09,LotAtt10,LotAtt11,LotAtt12,AddTime,AddWho,EditTime,EditWho,ReceivingTime) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"),
-                    [$In_CustomerID,$In_SKU,$r_Return_LotNum,rtrim($In_LotAtt01),rtrim($In_LotAtt02),rtrim($In_LotAtt03),rtrim($In_LotAtt04),rtrim($In_LotAtt05),rtrim($In_LotAtt06)
-                        ,rtrim($In_LotAtt07),rtrim($In_LotAtt08),rtrim($In_LotAtt09),rtrim($In_LotAtt10),rtrim($In_LotAtt11),rtrim($In_LotAtt12)
-                        ,$R_CurrentTime->toDateTimeString(),$In_UserID,$R_CurrentTime->toDateTimeString(),$In_UserID,$R_CurrentTime->toDateTimeString()]);
-            }
-            //预约库存的数量处理
-            $r_Lotnum_Trace = $r_Lotnum_Trace ?? '';
-            $r_PlanToLoc_Trace = $r_PlanToLoc_Trace ?? '';
-            $r_Return_LotNum = $r_Return_LotNum ?? '';
-
-            if ($R_Reserve_Flag == 'Y' && $R_LocationUsage == 'ST' && ($r_Lotnum_Trace ?? '') != $r_Return_LotNum){ //有预约,并且是收到ST库位,批次发生变化
-                //TODO UPDATE
-                DB::connection('oracle')->update(DB::raw('UPDATE INV_LOT_LOC_ID SET QTYPA = QTYPA - ? WHERE lotnum = ? and LocationID = ? and traceid = ?'),
-                    [(int)($r_CancelQty_Trace ?? 0),$r_Lotnum_Trace,$r_PlanToLoc_Trace,$In_FMTraceID]);
-                //TODO DELETE
-                DB::connection('oracle')->delete(DB::raw('DELETE FROM INV_LOT_LOC_ID where lotnum = ? and LocationID = ? and traceid = ? and QTYPA = 0 and qty = 0 and qtyMvin = 0'),
-                    [$r_Lotnum_Trace,$r_PlanToLoc_Trace,$In_FMTraceID]);
+                return $customDepository;
+            })();
 
-                DB::connection('oracle')->select(DB::raw('Select * from INV_LOT_LOC_ID Where LotNum=? and LocationID=? and TraceID=? for update'),[
-                    $r_Return_LotNum, $r_PlanToLoc_Trace, $In_FMTraceID
-                ]);
-                $TABLE_inv_lot_loc_id = DB::connection('oracle')->select(DB::raw(' select count(*) c from inv_lot_loc_id where lotnum = ? and LocationID = ? and traceid = ?'),[
-                    $r_Return_LotNum,$r_PlanToLoc_Trace,$In_FMTraceID
-                ]);
-                if ($TABLE_inv_lot_loc_id[0]->c > 0){
-                    //TODO UPDATE
-                    DB::connection('oracle')->update(DB::raw('update inv_lot_loc_id set QTYPA = QTYPA + ? where lotnum = ? and LocationID = ? and traceid = ?'),[
-                        (int)$r_ReceivedQty_Each,$r_Return_LotNum,$r_PlanToLoc_Trace,$In_FMTraceID
-                    ]);
-                }else{
-                    //TODO CREATE INV_LOT_LOC_ID
-                    DB::connection('oracle')->insert(DB::raw('Insert Into INV_LOT_LOC_ID (LotNum, LocationID, TraceID, CustomerID, SKU, Qty, QtyAllocated, QtyRPIn, QtyRPOut, QtyMVIN, QtyMVOut, QtyOnHold, OnHoldLocker,GrossWeight, NetWeight, Cubic, Price, AddTime, AddWho, EditTime, EditWho, LPN, QTYPA) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'),[
-                        $r_Return_LotNum,$r_PlanToLoc_Trace,$In_FMTraceID,$In_CustomerID,$In_SKU,0,0,0,0,0,
-                        0,0,0,0,0,0,0,$R_CurrentTime->toDateTimeString(),$In_UserID,$R_CurrentTime->toDateTimeString(),
-                        $In_UserID,null,$r_ReceivedQty_Each
-                    ]);
-                }
-            }
-            //混放批次校验
-            if ($R_Mix_LotFlag == 'N' && $R_LocationUsage != 'ST'){
-                $TABLE_inv_lot_LOC_ID = DB::connection('oracle')->selectOne(DB::raw('select count(distinct LotNUM) c from inv_lot_LOC_ID where LocationID=? and LotNum<>? and Qty>0 and CustomerID=? and SKU=?'),[
-                    $In_TOLocation,$r_Return_LotNum,$In_CustomerID,$In_SKU
-                ]);
-                if ($TABLE_inv_lot_LOC_ID->c >= 1){
-                    DB::rollBack();
-                    return '206'.rtrim($In_TOLocation);
-                }
-            }
-            //货架生命周期,失效日期,自动冻结
-            $r_Flag = '0';
-            if (trim($In_LotAtt02)){
-                if ((strtotime($In_LotAtt02) ? true : false)){
-                    $r_nrow = 1;
-                    $TABLE_BAS_SKU = DB::connection('oracle')->selectOne(DB::raw("SELECT c.OutboundLifeDays,c.InboundLifeDays from BAS_SKU c where c.CustomerID=? and c.SKU=? and c.ShelfLifeFlag='Y' and c.ShelfLifeType='E'"),[
-                        $In_CustomerID,$In_SKU
+            if ($WMSReflectReceive->skus){
+                foreach ($WMSReflectReceive->skus as $sku){
+                    $depository=(function()use($sku,$customDepository){
+                        if($customDepository)return $customDepository;
+                        $depository=Depository::query()->where('code',$sku->LOTATT05)->first();
+                        if (!$depository){
+                            if (!$sku->LOTATT05)return $depository;
+                            $depository=new Depository([
+                                'name'=>$sku->LOTATT05,
+                                'code'=>$sku->LOTATT05
+                            ]);
+                            $depository->save();
+                        }
+                        return $depository;
+                    })();
+                    $storeItem=new StoreItems([
+                        'store_id'=>$store->id,
+                        'asn_line_code'=>$sku->ASNLINENO,
+                        'name'=>$sku->SKUDESCRC,
+                        'sku'=>$sku->SKU,
+                        'barcode'=>$sku->ALTERNATE_SKU1,
+                        'quality'=>$quality,
+                        'status'=>'未入库',
                     ]);
-                    if (!$TABLE_BAS_SKU)$r_nrow=0;
-                    else {
-                        $r_OutboundLifeDays = $TABLE_BAS_SKU->outboundlifedays;
-                        $r_InboundLifeDays = $TABLE_BAS_SKU->inboundlifedays;
-                    }
-                }
-                if ($r_nrow > 0)$r_Flag = '1';
-                else $r_Flag = '0';
-                if ($r_nrow > 0 && (($r_OutboundLifeDays > 0 && (Carbon::parse($In_LotAtt02)->diffInDays($R_CurrentTime) <= $r_OutboundLifeDays)) ||
-                        ($r_InboundLifeDays > 0 && (Carbon::parse($In_LotAtt02)->diffInDays($R_CurrentTime) <= $r_InboundLifeDays)))){
-                    if ($r_EXP_CTL == 'Y')return '222'; //过期 拒收
-                    if ($r_EXP_CTL != 'N')$r_Hold_EP = 'Y';
-                }
-            }
-            //货架生命周期,生产日期,自动冻结
-            if ($In_LotAtt01 && !(strtotime($In_LotAtt01) ? true : false) && (!$r_Flag || $r_Flag = '0')){
-                $r_nrow = 1;
-                $TABLE_BAS_SKU = DB::connection('oracle')->selectOne(DB::raw('select c.OutboundLifeDays,c.InboundLifeDays from BAS_SKU c where c.CustomerID=? and c.SKU=? and c.ShelfLifeFlag=? and c.ShelfLifeType=?') ,[
-                    $In_CustomerID,$In_SKU,'Y','M'
-                ]);
-                if (!$TABLE_BAS_SKU)$r_nrow = 0;
-                else {
-                    $r_OutboundLifeDays = $TABLE_BAS_SKU->outboundlifedays;
-                    $r_InboundLifeDays = $TABLE_BAS_SKU->inboundlifedays;
-                }
-                if ($r_nrow > 0 && (($r_OutboundLifeDays > 0 && ($R_CurrentTime->diffInDays(Carbon::parse($In_LotAtt01)) > $r_OutboundLifeDays))  ||
-                        ($r_InboundLifeDays > 0 && ($R_CurrentTime->diffInDays(Carbon::parse($In_LotAtt01)) > $r_InboundLifeDays)))){
-                    if ($r_EXP_CTL == 'Y')return '222'; //有效期受控 拒收
-                    if ($r_EXP_CTL != 'N') $r_Hold_EP ='Y';
-                }
-            }
-            if (trim($In_ContainerID)){
-                DB::connection('oracle')->update(DB::raw('Update DOC_ASN_SerialNo Set LotNum=?,edittime=?,editwho=? Where LocationID=? and TraceID=? and LotNum=?'),[
-                    $r_Return_LotNum,$R_CurrentTime,$In_UserID,$In_TOLocation,$In_New_TraceID,$In_ContainerID
-                ]);
-            }
-        }
-        //计算上架库位 1543-1716 INSERT UPDATE
-
-        //QTYPA 写入INV_LOT_LOC_ID 1719-1752 INSERT UPDATE
-
-        //更新库存MVOut数量 1754-1810 SP:SPASN_Putaway_Calculation INSERT DELETE
-
-        //上架库位处理 QTYPA 写入INV_LOT_LOC_ID 1854-1918 UPDATE
-
-        // 1920-1989 UPDATE
-
-        //任务处理 1992-2105 INSERT
-            //--指定上架任务时此表为空 TMP_Putaway_task
-            //混托盘任务处理
-
-        //拆分上架任务后,需要分别写入收货交易,不然取消收货会导致QTYPA负数错误 库存交易处理 2107-2294   INSERT
-            //产生交易记录 INSERT
-            //更新冻结数 SP:SPINV_Hold_Update
-            //只有质检后才能上架
-            //根据收货交易产生质检明细
-            //获取数据精度
-
-        //2298-2378 UPDATE INSERT SP
-
-        //更新码盘明细 2403-2460 UPDATE
-            //码盘收货
-
-        //更新ASN明细和ASN Header 2462-2617 SP UPDATE
-            //判断拒收是否超量r_RejectedQty_Each_ASN
-            //拒收数量应该< 预期数量-已收数量-已拒数量-本次收货数量,否则报错“拒收数量超量错误”
-        if ($In_ASNNo != '*'){
-            $query = DB::raw('Select PackID,UOM,ExpectedQty,ExpectedQty_Each,RejectedQty,RejectedQty_Each,ReceivedQty,ReceivedQty_Each,POLineNO,PONO From DOC_ASN_Details Where ASNNO=? and ASNLineNO=? for update');
-            $TABLE_DOC_ASN_Details = DB::connection('oracle')->selectOne($query,[$In_ASNNo,$In_ASNLineNo]);
-            if (!$TABLE_DOC_ASN_Details) return '803'.$In_ASNNo;
-            $r_PackID_ASN = $TABLE_DOC_ASN_Details->packid;
-            $r_UOM_ASN = $TABLE_DOC_ASN_Details->uom;
-            $r_ExpectedQty_ASN = $TABLE_DOC_ASN_Details->expectedqty;
-            $r_ExpectedQty_Each_ASN = $TABLE_DOC_ASN_Details->expectedqty_each;
-            $r_RejectedQty_ASN = $TABLE_DOC_ASN_Details->rejectedqty;
-            $r_RejectedQty_Each_ASN = $TABLE_DOC_ASN_Details->rejectedqty_each;
-            $r_ReceivedQty_ASN = $TABLE_DOC_ASN_Details->receivedqty;
-            $r_ReceivedQty_Each_ASN = $TABLE_DOC_ASN_Details->receivedqty_each;
-            $r_POLineNO = $TABLE_DOC_ASN_Details->polineno;
-            $In_PONo = $TABLE_DOC_ASN_Details->pono;
-            //拒收超量
-            if ($R_OverReceiving != 'Y' && (int)$In_RejectedQty > ((int)$r_ExpectedQty_Each_ASN - (int)$r_RejectedQty_Each_ASN - (int)$r_ReceivedQty_Each_ASN - (int)$r_ReceivedQty_Each_ASN))return '220';
-            $r_ReceivedQty_Each_ASN = $r_ReceivedQty_Each + $r_ReceivedQty_Each_ASN;
-            switch ($r_UOM_ASN){
-                case "EA":
-                    $r_UOMQty_ASN = $r_QTY1_P;
-                    break;
-                case "IP":
-                    $r_UOMQty_ASN = $r_QTY2_P;
-                    break;
-                case "CS":
-                    $r_UOMQty_ASN = $r_QTY3_P;
-                    break;
-                case "PL":
-                    $r_UOMQty_ASN = $r_QTY4_P;
-                    break;
-                case "OT":
-                    $r_UOMQty_ASN = $r_QTY5_P;
-                    break;
-                default:
-                    $r_UOMQty_ASN = 0;
-                    break;
-            }
-            if ($r_UOMQty_ASN <= 0)return '103'.rtrim($r_PackID_ASN);
-            if ($r_ReceivedQty_Each_ASN >= $r_ExpectedQty_Each_ASN)$r_LineStatus = '40';
-            else $r_LineStatus = '30';
-            if ($r_ASN_RCV_UPD == 'Y'){
-                $query = DB::raw("Update DOC_ASN_Details Set LineStatus=? ,ReceivedQty= (ReceivedQty_Each+?)/ ?,ReceivedQty_Each=ReceivedQty_Each+?,ReceivedTime=? ,".
-                    "RejectedQty=(RejectedQty_Each + (?))/?,RejectedQty_Each=RejectedQty_Each + (?),Reserve_Flag='Y',HoldRejectCode=?,HoldRejectReason=?,EditTime=? , EditWho=?,".
-                    "LotAtt01=?,LotAtt02=?,LotAtt04=?,LotAtt05=?,LotAtt06=?,LotAtt07=?,LotAtt08=?,LotAtt09=?,LotAtt10=?,LotAtt11=?,LotAtt12=?,Operator= ? Where ASNNO=? and ASNLineNO=?");
-                DB::connection('oracle')->update($query,[$r_LineStatus,(int)$r_ReceivedQty_Each,(int)$r_UOMQty_ASN,(int)$r_ReceivedQty_Each,$R_ReceivingTime->toDateTimeString(),
-                    (int)$In_RejectedQty,(int)$r_UOMQty_ASN,(int)$In_RejectedQty,$In_HoldRejectCode,
-                    $In_HoldRejectReason,$R_CurrentTime->toDateTimeString(),$In_UserID,
-                    $In_LotAtt01,$In_LotAtt02,$In_LotAtt04,$In_LotAtt05,$In_LotAtt06,$In_LotAtt07,$In_LotAtt08,$In_LotAtt09,$In_LotAtt10,$In_LotAtt11,$In_LotAtt12,$In_Operator,$In_ASNNo,$In_ASNLineNo]);
-            }else{
-                $query = DB::raw('Update DOC_ASN_Details Set LineStatus=? ,ReceivedQty= (ReceivedQty_Each+?)/ ?,ReceivedQty_Each=ReceivedQty_Each+?'.
-                    ",ReceivedTime=?,RejectedQty=(RejectedQty_Each + (? ))/?,RejectedQty_Each=RejectedQty_Each + (?),Reserve_Flag='Y',HoldRejectCode=?".
-                    ",HoldRejectReason=?,EditTime=? , EditWho=?,Operator= ? Where ASNNO=? and ASNLineNO=?");
-                DB::connection('oracle')->update($query,[$r_LineStatus,(int)$r_ReceivedQty_Each,(int)$r_UOMQty_ASN,(int)$r_ReceivedQty_Each,
-                    $R_ReceivingTime->toDateTimeString(),(int)$In_RejectedQty,(int)$r_UOMQty_ASN,(int)$In_RejectedQty,$In_HoldRejectCode,
-                    $In_HoldRejectReason,$R_CurrentTime->toDateTimeString(),$In_UserID,$In_Operator,$In_ASNNo,$In_ASNLineNo]);
-            }
-            if ($r_LineStatus == '40'){
-                $count = DB::connection('oracle')->selectOne(DB::raw("Select Count(1) c from DOC_ASN_Details Where ASNNO=? and ASNLineNO<>? and LineStatus < '40'"),[$In_ASNNo,$In_ASNLineNo]);
-                $r_nrow = $count->c;
-                if ($r_nrow > 0) $r_LineStatus = '30';
-            }
-            $query = DB::raw("Update DOC_ASN_Header Set ASNStatus=?,Reserve_Flag='Y',LastReceivingTime=?,EditTime=? , EditWho=? Where ASNNO=?");
-            DB::connection('oracle')->update($query,[$r_LineStatus,$R_ReceivingTime->toDateTimeString(),$R_CurrentTime->toDateTimeString(),$In_UserID, $In_ASNNo]);
-
-            if ($r_RCV_CTL == 'Y' && $r_LineStatus == '40'){
-                $r_nrow = 0;
-                if ($r_PTA_CLS_CHK == 'Y'){
-                    $count = DB::connection('oracle')->selectOne(DB::raw("select count(1) c from TSK_Tasklists Where DocNo=? and TaskProcess='00' And DocType='ASN'"),[$In_ASNNo]);
-                    $r_nrow = $count->c;
-                }
-                if ($r_nrow == 0){
-                    $r_LineStatus = '99';
-                    //断点回滚,关闭ASN如果失败回滚该次操作而不是将上方全部操作回滚
-                    DB::transaction(function (){
-                        //2595-2614 关闭ASN 调用SP SPASN_Close_Process 该SP抛错时不影响全局回滚
-                    });
+                    if ($depository)$storeItem->depository_id=$depository->id;
+                    $storeItem->save();
                 }
             }
         }
-
-        //更新PO信息 2620-2697 UPDATE
-
-        //删除TMP_Putaway_Task(上架任务临时表) 2808 DELETE
-        //DB::connection('oracle')->delete(DB::raw('delete from TMP_Putaway_Task where TMPID=?'),[$r_TMPID]);
-
-        //修改UDF_A的调用方式 SP 2812-2828
-
-        //清除0库存 2831-2834 SP
-
-        //结束返回与异常判断
-        return $OUT_Return_Code;
-    }
-
-    /** 对于快速入库 $IN_Parameter1 = 'RCV_AFTER' |  'RCV_BEFORE'
-     * 目前该SP只存在 RCV_AFTER(校验近期产品) 且已被注释
-     */
-    private function SPUDF_ProcessA($IN_Warehouse, $IN_Parameter1, $IN_Parameter2, $IN_Parameter3, $IN_Parameter4, $IN_Language, $IN_UserID, $OUT_Return_Code){
-        $r_CurrentTime = Carbon::now();
-
-        //TODO 状态为 分配之前 走此逻辑,本快速入库不存在分配之前 不会走此逻辑 保留一下
-        if ($IN_Parameter1='ALLOCATION_BEFORE'){
-            $doc_order_header = DB::connection('oracle')->select(DB::raw("SELECT t.Carrierid,t.soreference5 FROM DOC_ORDER_HEADER t WHERE  ORDERNO='".$IN_Parameter2."'"));
-            $r_Carrierid = $doc_order_header[0]->carrierid;
-            $r_soreference5 = $doc_order_header[0]->soreference5;
-            if (in_array($r_Carrierid,['ZTO','YUNDA','POSTB','YTO','STO','EMS','SF']) && !$r_soreference5){
-                $OUT_Return_Code = '999面单号未获取!';
-                DB::rollBack();
-                return $OUT_Return_Code;
+        /** @var Store $store */
+        $store=Store::with('storeItems')->where('asn_code',$asn)->first();
+        $storeApi=new FStoreController();
+        $result=$storeApi->accomplishToWMS($store,[
+            'quality'=>$quality,
+            'depository_code'=>$depository_code,
+            'follow_code'=>$store['id'],
+        ]);
+        if ($result){
+            $store->status='已入库';
+            $store->save();
+            if ($store->storeItems){
+                $store->storeItems->each(function ($storeItem)use($quality){
+                    $storeItem->status='已入库';
+                    $storeItem->quality=$quality;
+                    $storeItem->save();
+                });
             }
+            return ['success'=>true, 'data'=>"成功!"];
         }
-        //TODO 状态为 导入后的逻辑:SPUDF_ProcessA 77行起 此处忽略 IN_Parameter1='SO_IMPORT_AFTER'
-
-        //TODO 装箱完成前,做一些数据处理:SPUDF_ProcessA 125行起 此处忽略 IN_Parameter1='PACKING_BEFORE'
-
-        //TODO 装箱完成后,做一些数据处理:SPUDF_ProcessA 132行起 此处忽略 IN_Parameter1='PACKING_AFTER'
-
-        //TODO 打印标记:SPUDF_ProcessA 281行起 此处忽略 IN_Parameter1='PRINT'
-
-        //TODO 发货前校验是否全部复核:SPUDF_ProcessA 553行起 此处忽略 IN_Parameter1='SHIP_BEFORE'
-
-        //TODO 转移时校验库位是否允许混放批次:SPUDF_ProcessA 594行起 此处忽略 IN_Parameter1='TRAPPROVE_BEFORE'
-
-        //TODO 分配之后,如果是单品单件订单,更新deliveryno:SPUDF_ProcessA 658行起 此处忽略 IN_Parameter1='ALLOCATION_AFTER'
-
-        //TODO 上架前,校验此货主是否必须有拣货位,如果无拣货位,则拦截   by mxl 20191205:SPUDF_ProcessA 675行起 此处忽略 IN_Parameter1='PA_BEFORE'
-
-        //TODO ASN关闭后  针对JIANSHANG货主,订单关闭后将数据写入临时表CUS_ADJ_H  by mxl 20191217:SPUDF_ProcessA 700行起 此处忽略 IN_Parameter1='ASNCLOSE_AFTER'
-
-        //TODO SO关闭后 针对JIANSHANG货主,订单关闭后将数据写入临时表CUS_ADJ_H  by mxl 20191217:SPUDF_ProcessA 734行起 此处忽略 IN_Parameter1='SHIP_AFTER'
-
-        $OUT_Return_Code = '000';
-        return $OUT_Return_Code;
+        return ['success'=>false, 'data'=>"失败!请检查错误日志"];
     }
 
-    private function GETSYS_configuration($IN_WarehouseID, $IN_CustomerID, $IN_OrderType, $IN_ConfigID, $IN_DefaultValue = 'N', $IN_ValueType = 'C')
+    public function quickStorage($asnno,$quality,$depository_code)
     {
-        if ($IN_ValueType == 'C'){
-            $sys_configuration = DB::connection('oracle')->select(DB::raw("SELECT VALUE_STRING FROM sys_configuration WHERE WarehouseID='".($IN_WarehouseID ?? '*')."' AND CustomerID='".($IN_CustomerID ?? '*')."' AND OrderType='".($IN_OrderType ?? '*')."' AND CONFIG_ID='".$IN_ConfigID."'"));
-            if (!$sys_configuration){
-                $sys_configuration = DB::connection('oracle')->select(DB::raw("SELECT VALUE_STRING FROM sys_configuration WHERE WarehouseID='".($IN_WarehouseID ?? '*')."' AND CustomerID='".($IN_CustomerID ?? '*')."' AND OrderType='*' AND CONFIG_ID='".$IN_ConfigID."'"));
-                if (!$sys_configuration){
-                    $sys_configuration = DB::connection('oracle')->select(DB::raw("SELECT VALUE_STRING FROM sys_configuration WHERE WarehouseID='".($IN_WarehouseID ?? '*')."' AND CustomerID='*' AND OrderType='*' AND CONFIG_ID='".$IN_ConfigID."'"));
-                    if (!$sys_configuration){
-                        $sys_configuration = DB::connection('oracle')->select(DB::raw("SELECT VALUE_STRING FROM sys_configuration WHERE WarehouseID='*' AND CustomerID='*' AND OrderType='*' AND CONFIG_ID='".$IN_ConfigID."'"));
-                        if (!$sys_configuration) return $IN_DefaultValue;
-                    }
-                }
+        $db = DB::connection('oracle');
+        $query = DB::raw("SELECT * FROM DOC_ASN_HEADER WHERE ASNNO = ?");
+        $asn = $db->selectOne($query,[$asnno]);
+        if (!$asn) return ['success'=>false, 'data'=>"单据号不存在"];
+        if ($asn->asnstatus != '00')return ['success'=>false, 'data'=>'单据号状态非创建订单'];
+        if (array_search($asn->customerid,array_values(config('stores.owners'))) === false)return ['success'=>false, 'data'=>"不允许该货主快速入库"];
+        if (array_search($asn->asntype,array_values(config('stores.types'))) === false)return ['success'=>false, 'data'=>"该单据类型不允许被入库"];
+        $query = DB::raw("SELECT b.ALTERNATE_SKU1,h.WAREHOUSEID,h.asnno,d.ASNLINENO,d.SKUDESCRC,h.CUSTOMERID,d.SKU,d.PACKID,d.RECEIVEDQTY_EACH,d.EXPECTEDQTY_EACH,d.LOTATT01,d.LOTATT02,d.lotatt04,".
+            "d.lotatt05,d.lotatt08,d.USERDEFINE1,d.USERDEFINE2,d.USERDEFINE3,d.USERDEFINE4,d.USERDEFINE5,d.RECEIVINGLOCATION FROM DOC_ASN_DETAILS d ".
+            " LEFT JOIN BAS_SKU b ON d.CUSTOMERID = b.CUSTOMERID AND d.SKU = b.SKU INNER JOIN DOC_ASN_HEADER h ON d.ASNNO = h.ASNNO WHERE h.ASNNO = ?");
+        $details = $db->select($query,[$asnno]);
+
+        $username = config('database.connections.oracle.username');
+        $password = config('database.connections.oracle.password');
+        $host = config('database.connections.oracle.host');
+        $service_name = config('database.connections.oracle.service_name');
+        $conn = oci_connect($username, $password, $host . '/' . $service_name,"utf8");
+        $sql_sp = "begin SPASN_Receiving_Process(:IN_Warehouse, :In_Process_Action, :In_ASNNo_C, :In_ASNLineNo_C, :In_FMTraceID_C, :In_New_TraceID_C, :In_ProductStatus," .
+            ":In_ProductStatus_Descr, :In_HoldRejectCode_C, :In_HoldRejectReason_C, :In_PONo_C, :In_CustomerID, :In_SKU, :In_ReceivedQty, :In_RejectedQty,:In_UOM, :In_PackID," .
+            " :In_ContainerID, :In_LotAtt01_C, :In_LotAtt02_C, :In_LotAtt03_C, :In_LotAtt04_C, :In_LotAtt05_C, :In_LotAtt06_C," .
+            ":In_LotAtt07_C, :In_LotAtt08_C, :In_LotAtt09_C, :In_LotAtt10_C, :In_LotAtt11_C, :In_LotAtt12_C," .
+            ":In_TotalCubic, :In_TotalGrossWeight, :In_TotalNetWeight, :In_TotalPrice, :In_UserDefine1, :In_UserDefine2,:In_UserDefine3, :In_UserDefine4, :In_UserDefine5, :In_FMLocation," .
+            ":In_TOLocation_C,:In_QC_Type_C, :In_PlanToLoc_C,:In_ReceivingTime, :In_LPN, :In_Operator, :IN_RCVModule, :IN_RCVStation, :In_Language, :In_UserID, :OUT_Return_Code); end;";
+        $items = [];
+        $toDay = Carbon::now()->toDateTimeString();
+        $depositories = [];
+        foreach ($details as $detail) {
+            $result = $this->executeSP($detail,$asnno,$depository_code,$db,$quality,$conn,$sql_sp);
+            if (substr($result, 0, 3) != '000') {
+                oci_close($conn);
+                LogService::log(__METHOD__,"快速入库-FLUX收货失败","ASNNO:".$asnno.";ERROR:".$result);
+                return ['success' => false, 'data' => $detail->asnlineno.'收货失败,错误代码:'.$result];
             }
-            return trim($sys_configuration[0]->value_string);
-        }
-        $sys_configuration = DB::connection('oracle')->select(DB::raw("SELECT VALUE_INT FROM sys_configuration WHERE WarehouseID='".($IN_WarehouseID ?? '*')."' AND CustomerID='".($IN_CustomerID ?? '*')."' AND OrderType='".($IN_OrderType ?? '*')."' AND CONFIG_ID='".$IN_ConfigID."'"));
-        if (!$sys_configuration){
-            $sys_configuration = DB::connection('oracle')->select(DB::raw("SELECT VALUE_INT FROM sys_configuration WHERE WarehouseID='".($IN_WarehouseID ?? '*')."' AND CustomerID='".($IN_CustomerID ?? '*')."' AND OrderType='*' AND CONFIG_ID='".$IN_ConfigID."'"));
-            if (!$sys_configuration){
-                $sys_configuration = DB::connection('oracle')->select(DB::raw("SELECT VALUE_INT FROM sys_configuration WHERE WarehouseID='".($IN_WarehouseID ?? '*')."' AND CustomerID='*' AND OrderType='*' AND CONFIG_ID='".$IN_ConfigID."'"));
-                if (!$sys_configuration){
-                    $sys_configuration = DB::connection('oracle')->select(DB::raw("SELECT VALUE_INT FROM sys_configuration WHERE WarehouseID='*' AND CustomerID='*' AND OrderType='*' AND CONFIG_ID='".$IN_ConfigID."'"));
-                    if (!$sys_configuration) return $IN_DefaultValue;
-                }
+            if (!isset($depositories[$detail->lotatt05])){
+                $depository = app('depositoryService')->firstOrCreate(["code"=>$detail->lotatt05],["code"=>$detail->lotatt05,"name"=>$detail->lotatt05]);
+                $depositories[$detail->lotatt05] = $depository->id;
             }
+            $items[] = [
+                "asn_line_code" => $detail->asnlineno,
+                "name" => $detail->skudescrc,
+                "sku" => $detail->sku,
+                "barcode" => $detail->alternate_sku1,
+                "depository_id" => $depositories[$detail->lotatt05],
+                "amount" => $detail->expectedqty_each,
+                "quality" => $quality == 'ZP' ? '正品' : '残次',
+                "status" => "已入库",
+                "created_at" => $toDay
+            ];
+        }
+        oci_close($conn);
+        $warehouse = app('warehouseService')->firstOrCreate(["code"=>$asn->warehouseid],["code"=>$asn->warehouseid,"name"=>$asn->warehouseid]);
+        $owner = app('ownerService')->firstOrCreate(['code'=>$asn->customerid],['code'=>$asn->customerid,"name"=>$asn->customerid]);
+        $store = app('storeService')->create([
+            'asn_code'=>$asnno,
+            'warehouse_id'=>$warehouse->id,
+            'owner_id'=>$owner->id,
+            'stored_method'=>'快速入库',
+            'status'=>'已入库',
+            'remark'=>$asn->notes,
+        ]);
+        LogService::log(__METHOD__,"快速入库",json_encode($store));
+        foreach ($items as $item){
+            $item["store_id"] = $store->id;
         }
-        return trim($sys_configuration[0]->value_string);
+        app('storeItemService')->insert($items);
+        return ['success'=>true,"data"=>"已成功将“".$asnno."”入库"];
     }
 
-    /** 码盘调用SP,大概率不会被使用,内部 为游标,UPDATE操作 */
-    private function spasn_reserve_cancel($in_warehouse, $in_by, $in_asnno, $in_asnlineno, $in_traceid, $in_language, $in_userid, $out_return_code){
-        $query = DB::raw('Select TraceID,ASNLineNO,CustomerID,SKU,PackID,UOM,LotNUM,PlanToLoc,ExpectedQty,ExpectedQty_Each,TotalGrossWeight,TotalCubic from DOC_Trace_DETAILS '.
-            "Where (ASNNO='".$in_asnno."' and ReceivedQty_Each=0 and trim(PlanToLoc) is not null and trim(PlanToLoc)<>'*' and Reserve_Flag='Y' and '".$in_by."'='ASNNO') OR".
-            " (ASNNO='".$in_asnno."' and ASNLineNO='".$in_asnlineno."' and ReceivedQty_Each=0 and trim(PlanToLoc) is not null and trim(PlanToLoc)<>'*' and Reserve_Flag='Y' and upper('".$in_by."')=upper('ASNLineNO')) OR".
-            " (ASNNO='".$in_asnno."' and TraceID='".$in_traceid."' and ASNLineNO='".$in_asnlineno."' and ReceivedQty_Each=0 and trim(PlanToLoc) is not null and trim(PlanToLoc)<>'*' and Reserve_Flag='Y' and upper('".$in_by."')=upper('TraceID'))");
-
-        if ($out_return_code == 'NO_COMMIT')$r_no_commit = 'N';
-        else $r_no_commit = 'Y';
-        $sp_sql_r = "''".$in_by."'',''".$in_asnno."'',''".$in_asnlineno."'',''".$in_traceid."'',''".$in_language."'',''".$in_userid."''";
-        $R_CurrentTime = Carbon::now();
-
-        if ($in_by != 'ASNNO' && strtoupper($in_by) != 'ASNLINENO' && strtoupper($in_by) != 'TRACEID')return '887SPASN_Reserve_Cancel';
-
-        $ccur_asns = DB::connection('oracle')->select($query);
-        foreach ($ccur_asns as $crow_asn){
-            $sp_sql_r = 'Fetch cCur_ASN';
-            $TABLE_DOC_Trace_Details = DB::connection('oracle')->select(DB::raw("SELECT 1 c from DOC_Trace_Details Where ASNNO='".$in_asnno."' and  TraceID='".$crow_asn->traceid."'"));
-            if ($TABLE_DOC_Trace_Details && $TABLE_DOC_Trace_Details[0]->c == 1){
-                // TODO UPDATE
-                $rowcount = DB::connection('oracle')->update(DB::raw("UPDATE INV_LOT_LOC_ID SET QTYPA=(QTYPA-".$crow_asn->expectedqty_each."),EditTime=TO_DATE('".$R_CurrentTime->toDateTimeString()."','yyyy-mm-dd hh24:mi:ss'),EditWho='".$in_userid.
-                    "' WHERE LotNum='".$crow_asn->lotnum."' and LocationID='".$crow_asn->plantoloc."' and TraceID='".$crow_asn->traceid."'"));
-                if ($rowcount == 0) return 'INV_LOT_LOC_ID,UPDATE';
-                // TODO UPDATE
-                DB::connection('oracle')->update(DB::raw("UPDATE DOC_Trace_Details set PlanToLoc='' ,Reserve_Flag='N',EditTime= TO_DATE('".$R_CurrentTime->toDateTimeString()."','yyyy-mm-dd hh24:mi:ss'), EditWho='".$in_userid.
-                    "' where ASNNO='".$in_asnno."' and ASNLineNO='".$crow_asn->asnlineno."' and TraceID='".$crow_asn->traceid."'"));
-                $TABLE_DOC_Trace_Details = DB::connection('oracle')->select(DB::raw("SELECT 1 FROM DOC_Trace_Details WHERE ASNNO='".$in_asnno."' and ASNLineNO='".$crow_asn->asnlineno."' and trim(PlanToLoc) is not null and  trim(PlanToLoc)<>'*'"));
-                if (!$TABLE_DOC_Trace_Details){
-                    //TODO UPDATE
-                    DB::connection('oracle')->update(DB::raw("Update DOC_ASN_Details set Reserve_Flag='N'  ,EditTime=TO_DATE('".$R_CurrentTime->toDateTimeString()."','yyyy-mm-dd hh24:mi:ss') , EditWho='".$in_userid."' where ASNNO='".$in_asnno."' and ASNLineNO='".$crow_asn->asnlineno."'"));
-                }
-            }
-            //TODO COMMIT
-            if ($r_no_commit == 'Y')DB::commit();
+    private function executeSP($detail, $asnno, $depository_code, $db, $quality, $conn, $sql_sp){
+        $IN_Warehouse = $detail->warehouseid ?? '';
+        $In_Process_Action = '3';
+        $In_ASNNo_C = $detail->asnno ?? '';
+        $In_ASNLineNo_C = $detail->asnlineno ?? '';
+        $In_FMTraceID_C = '';
+        $In_New_TraceID_C = '';
+        $In_ProductStatus = '00';
+        $In_ProductStatus_Descr = '正常';
+        $In_HoldRejectCode_C = 'OK';
+        $In_HoldRejectReason_C = '正常';
+        $In_PONo_C = '';
+        $In_CustomerID = $detail->customerid ?? '';
+        $In_SKU = $detail->sku ?? '';
+        $In_ReceivedQty = (string)((int)$detail->expectedqty_each - (int)$detail->receivedqty_each) ?? '';
+        $In_RejectedQty = '';
+        $In_UOM = 'EA';
+        $In_PackID = $detail->packid ?? '';
+        $In_ContainerID = '';
+        $In_LotAtt01_C = $detail->lotatt01 ?? '';
+        $In_LotAtt02_C = $detail->lotatt02 ?? '';
+        $In_LotAtt03_C = '';
+        $In_LotAtt04_C = $detail->lotatt04 ?? '';
+        $In_LotAtt05_C = $detail->lotatt05 ?? '';
+        $In_LotAtt06_C = '';
+        $In_LotAtt07_C = '';
+        $In_LotAtt08_C = $detail->lotatt08 ?? '';
+        $In_LotAtt09_C = '';
+        $In_LotAtt10_C = '';
+        $In_LotAtt11_C = '';
+        $In_LotAtt12_C = '';
+        $In_TotalCubic = '0.00';
+        $In_TotalGrossWeight = '0.00';
+        $In_TotalNetWeight = '0.00';
+        $In_TotalPrice = '0.00';
+        $In_UserDefine1 = $detail->userdefine1 ?? '';
+        $In_UserDefine2 = $detail->userdefine2 ?? '';
+        $In_UserDefine3 = $detail->userdefine3 ?? '';
+        $In_UserDefine4 = $detail->userdefine4 ?? '';
+        $In_UserDefine5 = $detail->userdefine5 ?? '';
+        $In_FMLocation = 'STAGE' . $detail->warehouseid;
+        $In_TOLocation_C = 'STAGE' . $detail->warehouseid;
+        $In_QC_Type_C = 'OK';
+        $In_PlanToLoc_C = '';
+        $In_ReceivingTime = '';
+        $In_LPN = '*';
+        $In_Operator = 'WCS';
+        $IN_RCVModule = '';
+        $IN_RCVStation = '';
+        $In_Language = 'cn';
+        $In_UserID = 'WCS';
+        $result = '';
+        if ($depository_code && (strtoupper($depository_code) != strtoupper($detail->receivinglocation))){
+            $query = DB::raw("UPDATE DOC_ASN_DETAILS SET RECEIVINGLOCATION = ?  WHERE ASNNO = ? AND ASNLINENO = ?");
+            $db->update($query,[$depository_code,$detail->asnno,$detail->asnlineno]);
+            $db->commit();
+            LogService::log(__METHOD__,"快速入库-修改FULX属性仓","ASNNO:".$asnno.";原仓:".$detail->receivinglocation.";修改为:".$depository_code);
         }
-
-        $TABLE_DOC_ASN_Details = DB::connection('oracle')->select(DB::raw("SELECT 1 FROM DOC_ASN_Details Where ASNNO='".$in_asnno."' and  Reserve_Flag='Y'"));
-        if (!$TABLE_DOC_ASN_Details){
-            $sp_sql_r = 'Update DOC_ASN_Header';
-            //TODO UPDATE
-            DB::connection('oracle')->update(DB::raw("Update DOC_ASN_Header set Reserve_Flag='N' ,EditTime=TO_DATE('".$R_CurrentTime->toDateTimeString()."','yyyy-mm-dd hh24:mi:ss') , EditWho='".$in_userid."' where ASNNO='".$in_asnno."'"));
+        if ($quality && ($quality != $detail->lotatt08)){
+            $query = DB::raw("UPDATE DOC_ASN_DETAILS SET LOTATT08 = ?  WHERE ASNNO = ? AND ASNLINENO = ?");
+            $db->update($query,[$quality,$detail->asnno,$detail->asnlineno]);
+            $db->commit();
+            LogService::log(__METHOD__,"快速入库-修改FULX质量状态","ASNNO:".$asnno.";原质量:".$detail->lotatt08.";修改为:".$quality);
+            $In_LotAtt08_C = $quality;
         }
-        //TODO COMMIT
-        if ($r_no_commit == 'Y')DB::commit();
-
-        return '000';
+        $stmt = oci_parse($conn, $sql_sp);
+        oci_bind_by_name($stmt, ':IN_Warehouse', $IN_Warehouse);
+        oci_bind_by_name($stmt, ':In_Process_Action', $In_Process_Action);
+        oci_bind_by_name($stmt, ':In_ASNNo_C', $In_ASNNo_C);
+        oci_bind_by_name($stmt, ':In_ASNLineNo_C', $In_ASNLineNo_C);
+        oci_bind_by_name($stmt, ':In_FMTraceID_C', $In_FMTraceID_C);
+        oci_bind_by_name($stmt, ':In_New_TraceID_C', $In_New_TraceID_C);
+        oci_bind_by_name($stmt, ':In_ProductStatus', $In_ProductStatus);
+        oci_bind_by_name($stmt, ':In_ProductStatus_Descr', $In_ProductStatus_Descr);
+        oci_bind_by_name($stmt, ':In_HoldRejectCode_C', $In_HoldRejectCode_C);
+        oci_bind_by_name($stmt, ':In_HoldRejectReason_C', $In_HoldRejectReason_C);
+        oci_bind_by_name($stmt, ':In_PONo_C', $In_PONo_C);
+        oci_bind_by_name($stmt, ':In_CustomerID', $In_CustomerID);
+        oci_bind_by_name($stmt, ':In_SKU', $In_SKU);
+        oci_bind_by_name($stmt, ':In_ReceivedQty', $In_ReceivedQty);
+        oci_bind_by_name($stmt, ':In_RejectedQty', $In_RejectedQty);
+        oci_bind_by_name($stmt, ':In_UOM', $In_UOM);
+        oci_bind_by_name($stmt, ':In_PackID', $In_PackID);
+        oci_bind_by_name($stmt, ':In_ContainerID', $In_ContainerID);
+        oci_bind_by_name($stmt, ':In_LotAtt01_C', $In_LotAtt01_C);
+        oci_bind_by_name($stmt, ':In_LotAtt02_C', $In_LotAtt02_C);
+        oci_bind_by_name($stmt, ':In_LotAtt03_C', $In_LotAtt03_C);
+        oci_bind_by_name($stmt, ':In_LotAtt04_C', $In_LotAtt04_C);
+        oci_bind_by_name($stmt, ':In_LotAtt05_C', $In_LotAtt05_C);
+        oci_bind_by_name($stmt, ':In_LotAtt06_C', $In_LotAtt06_C);
+        oci_bind_by_name($stmt, ':In_LotAtt07_C', $In_LotAtt07_C);
+        oci_bind_by_name($stmt, ':In_LotAtt08_C', $In_LotAtt08_C);
+        oci_bind_by_name($stmt, ':In_LotAtt09_C', $In_LotAtt09_C);
+        oci_bind_by_name($stmt, ':In_LotAtt10_C', $In_LotAtt10_C);
+        oci_bind_by_name($stmt, ':In_LotAtt11_C', $In_LotAtt11_C);
+        oci_bind_by_name($stmt, ':In_LotAtt12_C', $In_LotAtt12_C);
+        oci_bind_by_name($stmt, ':In_TotalCubic', $In_TotalCubic);
+        oci_bind_by_name($stmt, ':In_TotalGrossWeight', $In_TotalGrossWeight);
+        oci_bind_by_name($stmt, ':In_TotalNetWeight', $In_TotalNetWeight);
+        oci_bind_by_name($stmt, ':In_TotalPrice', $In_TotalPrice);
+        oci_bind_by_name($stmt, ':In_UserDefine1', $In_UserDefine1);
+        oci_bind_by_name($stmt, ':In_UserDefine2', $In_UserDefine2);
+        oci_bind_by_name($stmt, ':In_UserDefine3', $In_UserDefine3);
+        oci_bind_by_name($stmt, ':In_UserDefine4', $In_UserDefine4);
+        oci_bind_by_name($stmt, ':In_UserDefine5', $In_UserDefine5);
+        oci_bind_by_name($stmt, ':In_FMLocation', $In_FMLocation);
+        oci_bind_by_name($stmt, ':In_TOLocation_C', $In_TOLocation_C);
+        oci_bind_by_name($stmt, ':In_QC_Type_C', $In_QC_Type_C);
+        oci_bind_by_name($stmt, ':In_PlanToLoc_C', $In_PlanToLoc_C);
+        oci_bind_by_name($stmt, ':In_ReceivingTime', $In_ReceivingTime);
+        oci_bind_by_name($stmt, ':In_LPN', $In_LPN);
+        oci_bind_by_name($stmt, ':In_Operator', $In_Operator);
+        oci_bind_by_name($stmt, ':IN_RCVModule', $IN_RCVModule);
+        oci_bind_by_name($stmt, ':IN_RCVStation', $IN_RCVStation);
+        oci_bind_by_name($stmt, ':In_Language', $In_Language);
+        oci_bind_by_name($stmt, ':In_UserID', $In_UserID);
+        oci_bind_by_name($stmt, ':OUT_Return_Code', $result,300);
+        oci_execute($stmt);
+        return $result;
     }
 
-    //获取数据表的ID(PO, ASN, SO...) $in_sequence_name_c = TraceID  LOTNumber  TEMPID    Traceid  TransactionID  TaskID QCNO  TransactionID
-    private function spcom_getidsequence($in_warehouse, $in_language, $in_sequence_name_c, $out_returnno, $out_return_code){
-        $out_return_code = '000';
-        $out_returnno = '0';
-        $in_sequence_name = $in_sequence_name_c;
-        $r_id_sequence = -1;
-        $r_length = 0;
-        //TODO $IN_Parameter1 = 'IDSEQUENCE' 单多包裹逻辑校验 应该调用SPUDF_ProcessA 但其中单多部分逻辑已被注释 恒定返回000 此处同理恒定返回000 不会下行执行其他逻辑
-        return;
-        //DB::connection('oracle')->select(DB::raw("Select ID_Sequence,Max_ID_Sequence,Length,PreFix,to_CHar(EditTime,'YYMMDD') ,Date_Format  ,Date_max From SYS_IDSequence where IDName=upper('".$IN_Sequence_Name."') and WareHouseID = upper('".$in_warehouse."') For Update;"));
-        //return [$out_returnno,$out_return_code];
+
+    public function validator(Request $request){
+        $validator=Validator::make($request->input(),[
+            'asn_code'=>['required'],
+            'quality'=>['required'],
+            'depository_code'=>['nullable','string'],
+        ],[
+            'required'=>':attribute 为必填项',
+            'unique'=>':attribute 已存在',
+        ],[
+            'asn_code'=>'ASN编号',
+            'quality'=>'货物类型'
+        ])->validate();
+        return $validator;
     }
 }

+ 1 - 1
app/Log.php

@@ -9,7 +9,7 @@ class Log extends Model
 {
     use ModelTimeFormat;
     protected $fillable = [
-        'operation', 'description','type', 'operator', 'ip','id_user',
+        'operation', 'description','type', 'operator', 'ip','id_user','created_at','updated_at'
     ];
     public function getUserNameAttribute(){
         $idUser=$this['id_user'];

+ 17 - 8
app/OrderIssue.php

@@ -12,11 +12,20 @@ class OrderIssue extends Model
 
     protected $fillable = [
         'order_id', 'created_at', 'rejected_bill_id', 'rejecting_status', 'result_explain','logistic_number_return',
-        'situation_explain', 'order_issue_type_id', 'second_order_id', 'is_new_rejecting','second_client_no',
-        'final_status', 'logistic_indemnity_money', 'logistic_express_remission', 'baoshi_indemnity_money', 'baoshi_express_remission', 'user_workgroup_id'];
-
+        'situation_explain', 'order_issue_type_id', 'second_order_id', 'is_new_rejecting','second_client_no','second_logistic_number',
+        'final_status', 'logistic_indemnity_money', 'logistic_express_remission', 'baoshi_indemnity_money', 'baoshi_express_remission', 'user_workgroup_id',
+        'custom_code'];
+    /*
+     * second_client_no 二次客户订单号
+     * second_logistic_number 二次运单号 【二次运单号可以单独存在,当二次客户订单号有对应的订单信息时,显示的是二次客户订单号对应的运单号,没有的话显示二次原单号】
+     * rejecting_status
+     * result_explain 情况说明
+     * final_status
+     * situation_explain
+     * custom_code  自定义订单号 客户客服自定义
+     */
     protected $appends = [
-        'secondLogisticNumber',
+//        'secondLogisticNumber',
         'createLog',
         'endLog',
         'processingTime',
@@ -59,10 +68,10 @@ class OrderIssue extends Model
         return $this->hasOne('App\Order', 'client_code', 'second_client_no');
     }
 
-    public function getSecondLogisticNumberAttribute()
-    {
-        return $this['secondOrder']['code'] ?? '';
-    }
+//    public function getSecondLogisticNumberAttribute()
+//    {
+//        return $this['secondOrder']['code'] ?? '';
+//    }
 
     public function getCreateLogAttribute()
     {

+ 6 - 0
app/Providers/AppServiceProvider.php

@@ -37,6 +37,9 @@ use App\Services\ShopService;
 use App\Services\RejectedService;
 use App\Services\StoreCheckingReceiveItemService;
 use App\Services\StoreCheckingReceiveService;
+use App\Services\StoreItemService;
+use App\Services\StoreService;
+use App\Services\WarehouseService;
 use App\Services\WaybillFinancialService;
 use App\Services\WeighExceptedService;
 use Illuminate\Queue\Events\JobFailed;
@@ -117,6 +120,9 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('oracleDocAsnDetailService',OracleDocAsnDetailService::class);
         app()->singleton('inventoryAccountMissionService',InventoryAccountMissionService::class);
         app()->singleton('processesContentService',ProcessesContentService::class);
+        app()->singleton('storeService',StoreService::class);
+        app()->singleton('warehouseService',WarehouseService::class);
+        app()->singleton('storeItemService',StoreItemService::class);
 
         $this->loadingOrderModuleService();
         $this->loadingBasedModuleService();

+ 23 - 13
app/RejectedBill.php

@@ -142,26 +142,36 @@ class RejectedBill extends Model
     {
         $orderIssue = $this->orderIssue()->first();
         if ($orderIssue ?? false) {
-            $this->同步退单状态();
+//            $this->同步退单状态();
             $orderIssue->update(['is_new_rejecting' => '有']);
         } else {
             OrderIssue::query()->where('logistic_number_return', $this->logistic_number_return)->update(['is_new_rejecting' => '有']);
         }
     }
 
-    public function 同步问题件(){
-        $order = null;
-        if($this->order_number ?? false){
-            $order = Order::query()->with('issue')->where('client_code',$this->order_number)->first();
-        }else if($this->logistic_number_return ?? false){
-            $asn_header = OracleDOCASNHeader::query()->where('asnreference3',$this->logistic_number_return)->first();
-            if(!$asn_header)return;
-            $order_header = OracleDOCOrderHeader::query()->where('soreference1',$asn_header['asnreference1'])->first();
-            $order = Order::query()->with('issue')->where('code',$order_header['orderno'])->first();
+    public function 同步问题件()
+    {
+        $orderIssue = $this->orderIssue()->first();
+        if(!isset($orderIssue)){
+            if(isset($this->order_number)){
+                $orderNumber = $this->order_number;
+                $orderIssue = OrderIssue::query()->with('order')->whereHas('order',function($query)use($orderNumber){
+                    $query->where('client_code',$orderNumber);
+                })->first();
+            }
+            if(isset($this->logistic_number_return) && !isset($orderIssue)){
+                $logistic_number_return = $this->logistic_number_return;
+                $orderHeader = OracleDOCOrderHeader::query()->where('soreference1',function($query)use($logistic_number_return){
+                    $query->select('asnreference2')->from('DOC_ASN_HEADER')->where('asnreference3',$logistic_number_return)->first();
+                })->first();
+                $orderIssue = OrderIssue::query()->with('order')->whereHas('order',function($query)use($orderHeader){
+                    $query->where('code',$orderHeader->orderno);
+                })->first();
+            }
         }
-        if($order['issue'] ?? false){
-            $order_issue =  $order->issue;
-            $order_issue->update(['logistic_number_return'=>$this->logistic_number_return]);
+        if(isset($orderIssue)){
+//            $orderIssue->同步退单状态();
+            $orderIssue->update(['is_new_rejecting' => '有']);
         }
     }
 

+ 66 - 11
app/Services/LogService.php

@@ -5,22 +5,77 @@ namespace App\Services;
 
 
 use App\Log;
+use Exception;
+use Illuminate\Support\Facades\Redis;
 use Illuminate\Support\Facades\Request;
 
 class LogService
 {
-    static public function log($method,$type,$description,$id_user=null){
-        if(!$id_user){
+    static public function log($method, $type, $description, $id_user = null)
+    {
+        if (!$id_user) {
             $id_user = '';
-            $user=auth()->user();
-            if($user) $id_user = $user['id'];
+            $user = auth()->user();
+            if ($user) $id_user = $user['id'];
+        }
+        try {
+            Redis::LLEN('LOGS');
+        } catch (Exception $e) {
+            //redis出现异常直接保存到数据库中
+            (new Log([
+                'operation' => $method,
+                'type' => $type,
+                'description' => $description,
+                'id_user' => $id_user,
+                'ip' => Request::ip(),
+            ]))->save();
+            return;
+        }
+        $date = date('Y-m-d H:i:s');
+        $log = new Log([
+            'operation' => $method,
+            'type' => $type,
+            'description' => $description,
+            'id_user' => $id_user,
+            'ip' => Request::ip(),
+            'created_at' => $date,
+            'updated_at' => $date
+        ]);
+        Redis::LPUSH('LOGS', $log);
+    }
+
+    public static function syncRedisLogs()
+    {
+
+        try {
+            Redis::LLEN('LOGS');
+        } catch (Exception $e) {
+            session()->flash('danger', 'Redis服务异常无法正常同步,最新日志已直接保存到数据库中,但已缓存的日志无法同步,请检查Redis是否正常,然后再尝试同步');
+            return;
+        }
+        $data = [];
+        $length = 0;
+        while (Redis::LLEN('LOGS') > 0) {
+            $log = Redis::LPOP('LOGS');
+            $arr = json_decode($log);
+            if ($length + strlen($arr->description) > 1024 * 512) {
+                Log::query()->insert($data);
+                $length = 0;
+                $data = [];
+            }
+            $length = $length + strlen($arr->description);
+            $data[] = [
+                'operation' => $arr->operation,
+                'id_user' => $arr->id_user,
+                'ip' => $arr->ip,
+                'type' => $arr->type,
+                'description' => $arr->description,
+                'created_at' => $arr->created_at,
+                'updated_at' => $arr->updated_at,
+            ];
+        }
+        if ($data) {
+            Log::query()->insert($data);
         }
-        (new Log([
-            'operation'=>$method,
-            'type'=>$type,
-            'description'=>$description,
-            'id_user'=>$id_user,
-            'ip'=>Request::ip()
-        ]))->save();
     }
 }

+ 108 - 93
app/Services/OrderIssueService.php

@@ -6,6 +6,7 @@ use App\OracleDOCASNHeader;
 use App\OracleDOCOrderHeader;
 use App\OrderIssue;
 use App\OrderIssueProcessLog;
+use App\OrderIssueType;
 use App\OrderPackage;
 use App\Order;
 use App\RejectedBill;
@@ -24,6 +25,11 @@ class OrderIssueService
         app()->bind("orderPackageCommoditiesService", OrderPackageCommoditiesService::class);
     }
 
+    public function insert($params)
+    {
+        OrderIssue::query()->insert($params);
+    }
+
     public function getQuery(array $arr, array $condition = null)
     {
         if (!isset($condition)) {
@@ -254,32 +260,52 @@ class OrderIssueService
         return compact('orderPackageSql','secondOrderPackageSql','orderIssueSql','rejectedBillItemSql','logSql');
     }
 
-    public function paginate(array $arr)
+    public function paginate(array $params)
     {
-        return $query = $this->getConditionQuery($arr)->paginate($arr['paginate'] ?? 50);
-
+        return $query = $this->getConditionQuery($params)->paginate($params['paginate'] ?? 50);
     }
 
     public function orderIssueTag(array $params)
     {
         $orderNos = $params['orderNos'];
-        $meg = ['success' => true];
-        foreach ($orderNos as $orderNo) {
-            try {
-                $orderIssue = $this->createOrFindByOrderNo($orderNo);
-                if($orderIssue != null){
-                    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' => '创建']);
-                    LogService::log(__METHOD__, __FUNCTION__, '标记订单问题件' . json_encode($orderNo).json_encode($orderIssue));
-                }
-            } catch (\Exception $e) {
-                LogService::log(__METHOD__, __FUNCTION__, '标记订单问题件error' . json_encode($orderNo).$e->getMessage(),$e->getTraceAsString());
-                $meg['success'] = false;
-                $meg['fail_info'][]=  $orderNo.$e->getMessage();
-            }
+        $orderHeaders = OracleDOCOrderHeader::query()->with(['oracleDOCOrderDetails', 'actAllocationDetails','oracleBASCode'])->whereIn('orderNo',$orderNos)->get();
+        $bool = $this->createOrderIssueByWmsOrder($orderHeaders,$params['typeId'],$params['result_explain']);
+        if($bool){
+            return ['success'=>$bool];
+        }else{
+            return ['success'=>$bool,'fail_info'=>'问题件创建失败'];
+        }
+    }
+
+    public function createOrderIssueByWmsOrder($orderHeaders,$order_issue_type_id,$result_explain)
+    {
+        /** @var OrderService $orderService */
+        $orderService = app(OrderService::class);
+        $orders = $orderService->createByWmsOrder($orderHeaders);
+        $innerParams = [];
+        foreach ($orders as $order) {
+            $innerParams[] = [
+                'order_id'=>$order->id,
+                'order_issue_type_id' => $order_issue_type_id,
+                'result_explain'=>$result_explain
+            ];
+        }
+        try {
+            $this->insert($innerParams);
+            $ordersIssues = OrderIssue::query()->whereIn('order_id',data_get($innerParams,'*.order_id'))->get();
+            $param = [
+                'ids' => data_get($ordersIssues,'*.id'),
+                'content' =>'',
+                'user_id' => Auth::user()['id'],
+                'type' => '创建'
+            ];
+            app(OrderIssueProcessLogService::class)->create($param);
+            LogService::log(__METHOD__,__FUNCTION__,'创建问题件'.count($innerParams).json_encode($innerParams));
+            return true;
+        } catch (\Exception $e) {
+            LogService::log(__METHOD__,__FUNCTION__,'创建问题件 error'.count($innerParams).json_encode($innerParams).$e->getMessage().$e->getTraceAsString());
+            return false;
         }
-        unset($params,$orderIssues,$orderNos);
-        return $meg;
     }
 
     public function createOrFindByOrderNo($orderNo)
@@ -379,85 +405,14 @@ class OrderIssueService
         return $orderIssue;
     }
 
-    public function verifyOrderIssue(array $arr)
-    {
-        $orders = Order::query()->whereIn('code', $arr)->get();
-        if (count($orders) == 0) {
-            return [];
-        }
-        $order_ids = [];
-        foreach ($orders as $order){
-            $order_ids[] = $order['id'];
-        }
-        unset($orders,$arr);
-        return OrderIssue::query()->with('order')->whereIn('order_id', $order_ids)->get();
-    }
-
-    public function exportExcel(Request $request)
-    {
-        $result = null;
-        if ($request->getMethod() == 'GET') {
-            if ($request->has('checkAllSign')) {
-                $result = $this->getConditionQuery($request->all(), null)->get();
-            }
-        } else if ($request->getMethod() == 'POST') {
-            $request['order_issue_ids'] = $request->input('data');
-            $result = $this->getConditionQuery($request->all(), null)->get();
-        }
-        return $result;
-    }
-
-    public function updateOrderIssue(OrderIssue $orderIssue, array $arr)
-    {
-        if ($arr['rejectedBill'] ?? false) {
-            if ($arr['rejectedBill']['id'] ?? false) {
-                $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->同步问题件();
-                $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->同步问题件();
-                $rejectedBill->同步问题件退件状态();
-                $arr['orderIssues']['rejected_bill_id'] = $rejectedBill['id'];
-                $arr['orderIssues']['is_new_rejecting'] = '有';
-            }
-        }
-        if ($arr['order'] ?? false) {
-            $order = Order::query()->where('id', $arr['order']['id'])->first();
-            $order->fill($arr['order']);
-            $order->update();
-        }
-        $orderIssue->fill($arr['orderIssues']);
-        $orderIssue->同步退单状态();
-        $orderIssue->update();
-        unset($orderIssue,$arr);
-    }
-
     public function batchDestroy($ids){
-        $bool = null;
         try {
             $bool = OrderIssue::query()->whereIn('id', $ids)->delete();
             LogService::log(__METHOD__,__FUNCTION__,json_encode($ids));
+            return ['success'=>$bool];
         } catch (\Exception $e) {
             LogService::log(__METHOD__,__FUNCTION__,'error'.json_decode($ids).'||'.$e->getMessage().'||'.$e->getTraceAsString());
-        } finally {
-            if($bool ?? false){
-                return ['success'=>true];
-            }else{
-                return ['success' => false];
-            }
+            return ['success' => false];
         }
     }
 
@@ -474,8 +429,68 @@ class OrderIssueService
     {
         $order = Order::query()->where('client_code',$secondClientNo)->first();
         if(!$order){
-            $order  = app(OrderService::class)->findOrCreateByClientCode($secondClientNo);
+            /** @var OrderService $orderService */
+            $orderService = app(OrderService::class);
+            $orderHeaders = OracleDOCOrderHeader::query()->where('SoReference1',$secondClientNo)->get();
+            $orders =  $orderService->createByWmsOrder($orderHeaders);
+            if($orders->count()>0)$order =$orders->first();
         }
         return OrderIssue::query()->where('id',$id)->update(['second_client_no'=>$secondClientNo]) > 0;
     }
+
+    public function updateSecondLogisticNumber($id,$logisticNumber)
+    {
+        $orderIssue = OrderIssue::query()->where('id',$id)->first();
+        $order = app(OrderService::class)->getOrderByLogisticNumber($logisticNumber);
+        if(!$order){
+            $orderIssue->update(['second_logistic_number' => $logisticNumber]);
+            return ['success'=>true,'second_logistic_number' => $logisticNumber];
+        }
+        $orderIssue->update(['second_client_no' => $order->client_code]);
+        $order = Order::query()->with(['packages.commodities.commodity','logistic'])
+            ->where('id',$order->id)->first();
+        return ['success' => true,'order' =>$order];
+    }
+
+    /**
+     * @param string $logisticNumber
+     * @param string $type
+     * @param string $result_explain
+     */
+    public function createOrderIssue($logisticNumber,$type,$result_explain)
+    {
+        $orderHeaders = OracleDOCOrderHeader::query()->with(['oracleDOCOrderDetails', 'actAllocationDetails','oracleBASCode'])
+            ->whereHas('actAllocationDetails',function($query)use($logisticNumber){
+                $query->where('picktotraceid',$logisticNumber);
+            })->get();
+        $orderIssueType = OrderIssueType::query()->where('name',$type)->first();
+        $this->createOrderIssueByWmsOrder($orderHeaders,$orderIssueType->id,$result_explain);
+    }
+
+    /**
+     * @param array $logisticNumbers
+     * @return array
+     */
+    public function 校验问题件是否存在_快递单号_返回存在的快递单号($logisticNumbers)
+    {
+        $orderIssues = OrderIssue::query()->with('order.packages')->whereHas('order.packages',function($query)use($logisticNumbers){
+            $query->whereIn('logistic_number',$logisticNumbers);
+        })->get();
+        $exits_logistic_number = array_diff(array_unique(data_get($orderIssues,'*.order.packages.*.logistic_number')),['',null]);
+        return array_intersect($exits_logistic_number,$logisticNumbers);
+    }
+
+    /**
+     * @param array $orderNos
+     * @return array
+     */
+    public function 校验问题件是否存在_WMS订单号_返回存在的订单号($orderNos)
+    {
+        $orderIssues = OrderIssue::query()->with('order')->whereHas('order',function($query)use($orderNos){
+            $query->whereIn('code',$orderNos);
+        })->get();
+        $exits_logistic_number = array_diff(array_unique(data_get($orderIssues,'*.order.code')),['',null]);
+        return array_intersect($exits_logistic_number,$orderNos);
+    }
+
 }

+ 1 - 20
app/Services/OrderPackageCommoditiesService.php

@@ -471,26 +471,6 @@ class OrderPackageCommoditiesService
         return $createParams;
     }
 
-    public function createByOrderHeader($orderHeaders)
-    {
-        $orderPackageCommodities = $this->getByWmsOrder($orderHeaders);
-        $OPCCollects = $this->将orderPackageCommodity抽象成数组($orderPackageCommodities);
-        $creatParams = $this->返回创建数组_WMS订单($orderHeaders);
-        $this->数据重组($OPCCollects,$creatParams);
-        $collect = $this->删选需要修改的OrderPackageCommodities($OPCCollect,$creatParam);
-        $ids = $this->删选出删除的OrderPackageCommodities($OPCCollect,$creatParam);
-        $insertParam = $this->删选出需要添加的OrderPackageCommodities($OPCCollect,$creatParam);
-        $updateParams = [];
-        foreach ($collect as $item) {
-            $updateParams[] = $item;
-        }
-        $this->根据更新数组进行更新($updateParams);
-        $this->删除OPC以及对应的追踪件($ids);
-        $creatParams = $this->生成OrderPackageCommodities_基于创建数组($insertParam);
-        $this->create($creatParams);
-    }
-
-
     /**
      * @param $orderHeaders
      */
@@ -498,6 +478,7 @@ class OrderPackageCommoditiesService
     {
         if(!$orderHeaders){return ;}
         if(count($orderHeaders) == 0){return ;}
+        app(CommodityService::class)->getByWmsOrders($orderHeaders);
         $orderPackageCommodities = $this->getByWmsOrder($orderHeaders);
         $OPCCollects = $this->将orderPackageCommodity抽象成数组($orderPackageCommodities);
         $creatParams = $this->返回创建数组_WMS订单($orderHeaders);

+ 3 - 2
app/Services/OrderPackageService.php

@@ -377,15 +377,16 @@ class OrderPackageService
      * @param string $logisticNumber
      * @return array|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object
      */
-    public function createByLogisticNumberAndOrderClientNo($orderClientNo,$logisticNumber)
+    public function update($orderClientNo,$logisticNumber)
     {
         $order = Order::query()->with('packages.commodities.commodity')->where('client_code',$orderClientNo)->first();
         if(!$order){
             $order = Order::query()->create(['client_code'=>$orderClientNo]);
         }
         $orderPackage = OrderPackage::query()->where('logistic_number',$logisticNumber)->first();
-        if($orderPackage){return $orderPackage;}
+        if($orderPackage){return  compact('orderPackage','order');}
         $orderPackage = OrderPackage::query()->create(['order_id'=>$order->id,'logistic_number'=>$logisticNumber]);
         return  compact('orderPackage','order');
     }
+
 }

+ 35 - 15
app/Services/OrderService.php

@@ -436,12 +436,9 @@ class OrderService
         } else {
             $orderHeader = app('oracleDocOrderHeaderService')->first(['soreference5' => $logistic_number]);
         }
-
         if ($orderHeader == null) return null;
-
         $order = $this->first(['code'=>$orderHeader->orderno]);
         if ($order) return $order;
-
         /** @var OwnerService */
         $owner = app('ownerService')->first(['code' => $orderHeader->customerid]);
         if (!$owner) {
@@ -476,7 +473,10 @@ class OrderService
         ]);
     }
 
-
+    /**
+     * @param $orderHeaders
+     * @return \Illuminate\Database\Eloquent\Builder[]|Collection|null
+     */
     public function createByWmsOrder($orderHeaders)
     {
         if($orderHeaders->isEmpty())return null;
@@ -533,12 +533,12 @@ class OrderService
              if($order_code_map[$orderHeader->orderno] ?? false)continue;
             $owner = $owners_code_map[$orderHeader->customerid] ?? null;
             $logistic =  $logistics_code_map[$orderHeader->userdefine1] ?? null;
-            $shop = $shop_name_map[' _owner_code'.$orderHeader->customerid.' name='.$orderHeader->issuepartyname] ?? '';
+            $key = ' owner_code='.$orderHeader->customerid.' name='.$orderHeader->issuepartyname ?? '';
+            $shop = $shop_name_map[$key] ?? '';
             // 自提 转 新杰物流
             if($logistic!= null && $logistic->name == '自提'){
                 $logistic = $logistic_XJWL;
             }
-
             $params[] = [
                 'code' => $orderHeader->orderno,
                 'owner_id' => $owner->id ?? null,
@@ -711,14 +711,15 @@ class OrderService
      */
     public function updateOrderByOrderHeader($order,$orderHeader)
     {
-        $params = $this->getParamByOrderHeader($orderHeader);
-        if($params['client_code']!= $order->client_code){
+        if(!$orderHeader){return ;}
+        if($orderHeader->orderno == $order->code){
             return ;
-        }else{
-            if($params['code'] == $order->code){
-                return ;
-            }
-            $data = [
+        }else if($orderHeader->soreference1 != $order->client_code){
+            return ;
+        }
+        $params = $this->getParamByOrderHeader($orderHeader);
+
+        $data = [
                 'code'=>$order->code ?? $params['code'],
                 'owner_id'=>$order->code ?? $params['owner_id'],
                 'shop_id'=>$order->code ?? $params['shop_id'],
@@ -730,8 +731,27 @@ class OrderService
                 'address'=>$order->code ?? $params['address'],
                 'wms_edittime'=>$order->code ?? $params['wms_edittime'],
                 'wms_status'=>$order->code ?? $params['wms_status'],
-            ];
-            Order::query()->where('id',$order->id)->update($data);
+        ];
+        Order::query()->where('id',$order->id)->update($data);
+    }
+
+    public function getOrderByLogisticNumber($logisticNumber)
+    {
+        $order = Order::query()->with('packages.commodities.commodity')
+            ->whereHas('packages',function($query)use($logisticNumber){
+                $query->where('logistic_number',$logisticNumber);
+            })->first();
+        if($order){
+            $orderHeader = OracleDOCOrderHeader::query()->where('soreference1',$order->client_no)->first();
+            $this->updateOrderByOrderHeader($order,$orderHeader);
+            return $order;
         }
+        $orderHeaders = OracleDOCOrderHeader::query()->with(['oracleDOCOrderDetails', 'actAllocationDetails','oracleBASCode'])
+            ->whereHas('actAllocationDetails',function($query)use($logisticNumber){
+                $query->where('picktotraceid',$logisticNumber);
+            })->get();
+        app(CommodityService::class)->getByWmsOrders($orderHeaders);
+        $orders =$this->createByWmsOrder($orderHeaders);
+        return  $orders ? $orders->first() : null ;
     }
 }

+ 14 - 8
app/Services/OrderTrackingService.php

@@ -37,8 +37,7 @@ class OrderTrackingService
             $query->with(['commodity', 'package.order.logistic']);
         },])->whereHas('owner', function ($query) use ($owner_ids) {
             $query->whereIn('id', $owner_ids); //货主
-        })->orderByDesc('order_trackings.created_at')
-        ->orderBy('order_trackings.order_client_code');
+        });
 
         $queryParam = [
             'start_at' => ['alias' => 'pick_up_at', 'startDate' => ' 00:00:00'],
@@ -101,7 +100,10 @@ class OrderTrackingService
 
     public function paginate($params)
     {
-        return $this->getConditionQuery($params)->paginate($params['paginate'] ?? 50);
+        return $this->getConditionQuery($params)
+            ->orderByDesc('order_trackings.created_at')
+            ->orderBy('order_trackings.order_client_code')
+            ->paginate($params['paginate'] ?? 50);
     }
 
     public function getSql($params)
@@ -112,7 +114,10 @@ class OrderTrackingService
         $order_tracking_colnums = "case order_trackings.order_client_code when  order_trackings.web_order_number then '' when order_trackings.order_client_code then  order_trackings.order_client_code end order_client_code,";
         $order_tracking_colnums .= 'order_trackings.web_order_number,order_trackings.pick_up_at,order_trackings.sale,order_trackings.client,order_trackings.order_remark,order_trackings.gross_weight,order_trackings.bulk,';
         $order_tracking_colnums .= 'order_trackings.pallet_total,order_trackings.planning_sent_at,order_trackings.is_on_duty_shift,order_trackings.is_arrival,order_trackings.signed_at,order_trackings.receive_bill_status,order_trackings.remark';
-        return  $this->getConditionQuery($params)->selectRaw($order_tracking_colnums)
+        return  $this->getConditionQuery($params)
+            ->orderBy('order_trackings.order_client_code')
+            ->orderByDesc('order_trackings.pick_up_at')
+            ->selectRaw($order_tracking_colnums)
             ->leftJoin('order_package_commodities','order_trackings.order_package_commodity_id','order_package_commodities.id')
                 ->selectRaw('order_package_commodities.amount amount')
             ->leftJoin('order_packages','order_package_commodities.order_package_id','order_packages.id')
@@ -257,7 +262,7 @@ class OrderTrackingService
                 LogService::log(__METHOD__, __FUNCTION__, '批量添加 orderTracking' . json_encode($params),null);
             }
         } catch (\Exception $e) {
-            LogService::log(__METHOD__, __FUNCTION__, '批量添加 orderTracking' . json_encode($params).$e->getMessage().$e->getTraceAsString(),null);
+            LogService::log(__METHOD__, __FUNCTION__, '批量添加 orderTracking error' . json_encode($params).$e->getMessage().$e->getTraceAsString(),null);
         }
     }
 
@@ -325,7 +330,7 @@ class OrderTrackingService
                         'web_order_number' => $params['web_order_number'],
                         'gross_weight'  => $gross_weight,
                         'bulk' => $bulk,
-                        'planning_sent_at' => $params['web_order_number']??'planning_sent_at'
+                        'planning_sent_at' => $params['planning_sent_at']
                     ];
                 }
             }
@@ -388,8 +393,9 @@ class OrderTrackingService
         if(preg_match('/^O[\d]/',$orderHeader['soreference1'] ?? '') > 0){
             $web_order_number = $orderHeader['soreference1'];
         }
-        $planning_sent_at = $orderHeader->lastshipmenttime ?? null;
-        if(isset($planning_sent_at)){
+        $pick_up_at = $orderHeader->lastshipmenttime;
+        $planning_sent_at = null;
+        if(isset($pick_up_at)){
              $logisticTiming = app(LogisticTimingService::class)->findByParams($orderHeader['c_city']??'',$orderHeader['c_province']??'',$order->logistic_id);
              if($logisticTiming){
                  $planning_sent_at = Carbon::create($planning_sent_at)->addDays($logisticTiming->days_at_working);

+ 40 - 6
app/Services/RejectedBillService.php

@@ -1,11 +1,13 @@
-<?php 
+<?php
 
-namespace App\Services; 
+namespace App\Services;
 
+use App\OracleDOCOrderHeader;
+use App\OrderIssue;
 use App\RejectedBill;
 
 Class RejectedBillService
-{ 
+{
     private function conditionQuery(array $params){
         $query = RejectedBill::query();
         if ($params['order_number'] ?? false){
@@ -13,13 +15,45 @@ Class RejectedBillService
         }
         return $query;
     }
-    
+
     public function get(array $params){
         return $this->conditionQuery($params)->get();
     }
 
-
     public function create(array $params){
         return RejectedBill::query()->create($params);
     }
-}
+
+    /**
+     * @param RejectedBill $rejectedBill
+     */
+    public function syncOrderIssue($rejectedBill)
+    {
+        $orderIssue = $rejectedBill->orderIssue()->first();
+        if(!isset($orderIssue)){
+            if(isset($rejectedBill->order_number) && trim($rejectedBill->order_number) != ''){
+                $orderIssue = OrderIssue::query()->with('order')->whereHas('order',function($query)use($rejectedBill){
+                    $query->where('client_code',$rejectedBill->order_number);
+                })->first();
+            }
+            if(isset($rejectedBill->logistic_number_return) && !isset($orderIssue)){
+                $orderHeader = OracleDOCOrderHeader::query()->where('soreference1',function($query)use($rejectedBill){
+                    $query->select('asnreference2')->from('DOC_ASN_HEADER')->where('asnreference3',$rejectedBill->logistic_number_return)->first();
+                })->first();
+//                $orderHeader = OracleDOCOrderHeader::query()->where('soreference1',function($query)use($rejectedBill){
+//                    $query->select('asnreference2')->from('DOC_ASN_HEADER')->where('asnreference3',$rejectedBill->logistic_number_return)->first();
+//                })->first();
+                if(!isset($orderHeader))return;
+                $orderIssue = OrderIssue::query()->with('order')->whereHas('order',function($query)use($orderHeader){
+                    $query->where('code',$orderHeader->orderno);
+                })->first();
+            }
+        }
+        if(isset($orderIssue)){
+            //确认问题件有的时候需要更新状态和提示
+            $orderIssue->同步退单状态();
+            $orderIssue->update(['is_new_rejecting' => '有']);
+            LogService::log(__METHOD__,__FUNCTION__,'退回单同步问题件'.json_encode($rejectedBill).json_encode($orderIssue));
+        }
+    }
+}

+ 5 - 6
app/Services/StoreCheckingReceiveService.php

@@ -35,12 +35,11 @@ Class StoreCheckingReceiveService
         return StoreCheckingReceive::query()->create($params);
     }
 
-    public function find($id){
-        return StoreCheckingReceive::query()->with(['owner','storeCheckingReceiveItems'=>function($query){
-            $query->with(['commodity'=>function($builder){
-                $builder->with('barcodes');
-            }]);
-        }])->find($id);
+
+    public function find($id, array $withs = []){
+        $query = StoreCheckingReceive::query();
+        if ($withs) $query -> with($withs);
+        return $query->find($id);
     }
 
     public function updateFind(StoreCheckingReceive $storeCheckingReceive, array $params){

+ 13 - 0
app/Services/StoreItemService.php

@@ -0,0 +1,13 @@
+<?php 
+
+namespace App\Services; 
+
+use Illuminate\Support\Facades\DB;
+
+Class StoreItemService
+{ 
+    public function insert(array $params){
+        return DB::table('store_items')->insert($params);
+    }
+
+}

+ 13 - 0
app/Services/StoreService.php

@@ -0,0 +1,13 @@
+<?php 
+
+namespace App\Services; 
+
+use App\Store;
+
+Class StoreService
+{ 
+    public function create(array $params){
+        return Store::query()->create($params);
+    }
+
+}

+ 14 - 0
app/Services/WarehouseService.php

@@ -0,0 +1,14 @@
+<?php 
+
+namespace App\Services; 
+
+use App\Warehouse;
+
+Class WarehouseService
+{ 
+    public function firstOrCreate(array $params, array $values = null){
+        if ($values)return Warehouse::query()->firstOrCreate($params,$values);
+        return Warehouse::query()->firstOrCreate($params);
+    }
+
+}

+ 1 - 1
config/hr.php

@@ -3,5 +3,5 @@
 return [
 
     'qrCode_refresh_everyday' =>false,
-    'qrCode_refresh'=>60,
+    'qrCode_refresh'=>180,
 ];

+ 12 - 0
config/stores.php

@@ -0,0 +1,12 @@
+<?php
+
+return [
+    "owners" => [
+        "笕尚" => "JIANSHANG",
+        "幼岚" => "ALLBLU",
+        "淳钲" => "CHUNZHENG",
+    ],
+    "types" => [
+        'THRK','DBRK','QTRK','HHRK','CGRK'
+    ]
+];

+ 1 - 1
database/migrations/2019_11_22_094241_create_provinces_table.php

@@ -18,7 +18,7 @@ class CreateProvincesTable extends Migration
             $table->string('name',50)->unique()->comment('名称');
             $table->timestamps();
         });
-        $provinces=['陕西','甘肃','宁夏','青海','新疆','江苏','江','安徽','江西','福建','重庆','四川','云南',
+        $provinces=['陕西','甘肃','宁夏','青海','新疆','江苏','江','安徽','江西','福建','重庆','四川','云南',
             '贵州','西藏','黑龙江','吉林','辽宁','山东','北京','天津','广西','广东','河北','山西','内蒙古',
             '湖北','湖南','河南','海南','香港','澳门','台湾','上海'];
         for ($i=0;$i<count($provinces);$i++){

+ 1 - 0
database/migrations/2020_10_20_134819_create_customers_table.php

@@ -13,6 +13,7 @@ class CreateCustomersTable extends Migration
         '客户管理-项目-报表',
         '客户管理-项目-查询',
         '客户管理-项目-录入',
+        '客户管理-项目-面积',
     ];
     /**
      * Run the migrations.

+ 5 - 2
database/migrations/2020_10_20_143953_create_owner_reports_table.php

@@ -16,8 +16,11 @@ class CreateOwnerReportsTable extends Migration
         Schema::create('owner_reports', function (Blueprint $table) {
             $table->id();
             $table->bigInteger('owner_id')->index()->comment('外键货主');
-            $table->decimal('storage_duration')->nullable()->comment('在库时长');
-
+            $table->date('counting_month')->nullable()->comment('结算月');
+            $table->decimal('daily_average_order_amount',11,2)->nullable()->comment('日均单量');
+            $table->decimal('current_month_counting_area',11,2)->nullable()->comment('结算月盘点面积');
+            $table->decimal('last_month_counting_area',11,2)->nullable()->comment('结算月上月盘点面积');
+            $table->bigInteger('owner_bill_report_id')->nullable()->index()->comment('账单');
             $table->timestamp('created_at');
         });
     }

+ 34 - 0
database/migrations/2020_10_22_102316_change_order_issues_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeOrderIssuesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('order_issues', function (Blueprint $table) {
+            // 二次快递单号
+            $table->string('second_logistic_number')->index()->nullable()->comment('二次运单号')->after('second_client_no');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('order_issues', function (Blueprint $table) {
+            // 二次快递单号
+            $table->dropColumn('second_logistic_number');
+        });
+    }
+}

+ 34 - 0
database/migrations/2020_10_23_101444_change_order_issues_tabel.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeOrderIssuesTabel extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('order_issues', function (Blueprint $table) {
+            // 用于客户 客服 录入
+            $table->string('custom_code')->nullable()->comment('自定义单号')->after('final_status');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('order_issues', function (Blueprint $table) {
+            //
+            $table->dropColumn('custom_code');
+        });
+    }
+}

+ 48 - 0
database/migrations/2020_10_23_112022_add_column_table_owners_relating_customer.php

@@ -0,0 +1,48 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddColumnTableOwnersRelatingCustomer extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('owners', function (Blueprint $table) {
+            $table->bigInteger('customer_id')->nullable()->index()->comment('外键客户');
+            $table->decimal('tax_rate',8,2)->nullable()->comment('税率');
+            $table->string('contract_number')->nullable()->comment('合同号');
+            $table->string('salesman')->nullable()->comment('销售名称');
+            $table->string('linkman')->nullable()->comment('联系人');
+            $table->string('phone_number')->nullable()->comment('联系电话');
+            $table->bigInteger('user_owner_group_id')->nullable()->index()->comment('外键工作组');
+            $table->integer('waring_line_on')->nullable()->comment('月单量预警');
+            $table->string('description')->nullable()->comment('描述');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('owners', function (Blueprint $table) {
+            $table->dropColumn('customer_id');
+            $table->dropColumn('tax_rate');
+            $table->dropColumn('contract_number');
+            $table->dropColumn('salesman');
+            $table->dropColumn('linkman');
+            $table->dropColumn('phone_number');
+            $table->dropColumn('user_owner_group_id');
+            $table->dropColumn('waring_line_on');
+            $table->dropColumn('description');
+        });
+    }
+}

+ 31 - 0
database/migrations/2020_10_26_091851_add_order_issue_text_import_authorities.php

@@ -0,0 +1,31 @@
+<?php
+
+use App\Authority;
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddOrderIssueTextImportAuthorities extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        //
+        (new Authority(['name'=>'订单管理-订单问题件生成-文本导入','alias_name'=>'订单管理-订单问题件生成-文本导入']))->save();
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        //
+        Authority::query()->where('name','订单管理-订单问题件生成-文本导入')->delete();
+    }
+}

+ 38 - 0
database/migrations/2020_10_26_142753_create_owner_area_reports_table.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateOwnerAreaReportsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('owner_area_reports', function (Blueprint $table) {
+            $table->id();
+            $table->bigInteger('owner_id')->index()->comment('外键货主');
+            $table->date('counting_month')->index()->comment('结算月');
+            $table->decimal('area_on_tray',8,2)->nullable()->comment('货物整托');
+            $table->decimal('area_on_half_tray',8,2)->nullable()->comment('货物半托');
+            $table->decimal('area_on_flat',8,2)->nullable()->comment('平面区面积');
+            $table->decimal('accounting_area',8,2)->nullable()->comment('结算面积');
+            $table->enum('status',['编辑中','已完成'])->default('编辑中')->comment('状态');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('owner_area_reports');
+    }
+}

+ 38 - 0
database/migrations/2020_10_26_165012_create_owner_fee_details_table.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateOwnerFeeDetailsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('owner_fee_details', function (Blueprint $table) {
+            $table->id();
+            $table->bigInteger('owner_id')->index()->comment('外键货主');
+            $table->date('counting_month')->index()->comment('结算月');
+            $table->dateTime('worked_at')->index()->comment('作业时间');
+            $table->enum('type',["发货","收货","增值服务"])->index()->comment('类型');
+            $table->bigInteger('shop_id')->nullable()->index()->comment('外键店铺');
+            $table->string('operation_bill')->nullable()->comment('发/收/退货单号');
+            //TODO 字段与来源渠道无法确认 暂时搁置
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('owner_fee_details');
+    }
+}

+ 14 - 10
package-lock.json

@@ -1967,6 +1967,11 @@
             "integrity": "sha1-l9nby1qJcvhyLJliSDVDuQfZuew=",
             "dev": true
         },
+        "bootstrap-select": {
+            "version": "1.13.18",
+            "resolved": "https://registry.npm.taobao.org/bootstrap-select/download/bootstrap-select-1.13.18.tgz",
+            "integrity": "sha1-RVcRnVjcEVkYmXcWHIA5YiIOTdo="
+        },
         "brace-expansion": {
             "version": "1.1.11",
             "resolved": "https://registry.npm.taobao.org/brace-expansion/download/brace-expansion-1.1.11.tgz",
@@ -6187,8 +6192,7 @@
         },
         "minimist": {
             "version": "1.2.0",
-            "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
-            "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
+            "resolved": "",
             "dev": true
         },
         "mississippi": {
@@ -6334,9 +6338,9 @@
             }
         },
         "node-forge": {
-            "version": "0.9.0",
-            "resolved": "https://registry.npm.taobao.org/node-forge/download/node-forge-0.9.0.tgz",
-            "integrity": "sha1-1iQFDtu0SHStyhK7mlLsY8t4JXk=",
+            "version": "0.10.0",
+            "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz",
+            "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==",
             "dev": true
         },
         "node-libs-browser": {
@@ -8356,12 +8360,12 @@
             "dev": true
         },
         "selfsigned": {
-            "version": "1.10.7",
-            "resolved": "https://registry.npm.taobao.org/selfsigned/download/selfsigned-1.10.7.tgz",
-            "integrity": "sha1-2lgZ/QSdVXTyjoipvMbbxubzkGs=",
+            "version": "1.10.8",
+            "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.8.tgz",
+            "integrity": "sha512-2P4PtieJeEwVgTU9QEcwIRDQ/mXJLX8/+I3ur+Pg16nS8oNbrGxEso9NyYWy8NAmXiNl4dlAp5MwoNeCWzON4w==",
             "dev": true,
             "requires": {
-                "node-forge": "0.9.0"
+                "node-forge": "^0.10.0"
             }
         },
         "semver": {
@@ -8763,7 +8767,7 @@
         },
         "socket.io-client": {
             "version": "2.3.0",
-            "resolved": "https://registry.npm.taobao.org/socket.io-client/download/socket.io-client-2.3.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsocket.io-client%2Fdownload%2Fsocket.io-client-2.3.0.tgz",
+            "resolved": "https://registry.npm.taobao.org/socket.io-client/download/socket.io-client-2.3.0.tgz",
             "integrity": "sha1-FNW6LgC5vNFFrkQ6uWs/hsvMG7Q=",
             "requires": {
                 "backo2": "1.0.2",

+ 1 - 0
package.json

@@ -25,6 +25,7 @@
     "vue-template-compiler": "^2.6.11"
   },
   "dependencies": {
+    "bootstrap-select": "^1.13.18",
     "jquery.cookie": "^1.4.1",
     "js-cookie": "^2.2.1",
     "laravel-echo": "^1.8.0",

+ 516 - 0
public/css/app.css

@@ -67,6 +67,26 @@
   opacity: 0.3;
 }
 
+.bg-light-khaki {
+  background-color: #eac3aa;
+}
+
+.bg-khaki {
+  background-color: #af7651;
+}
+
+.bg-light-info {
+  background-color: RGB(170, 199, 230);
+}
+
+.bg-light-cyanogen {
+  background-color: RGB(170, 234, 210);
+}
+
+.bg-cyanogen {
+  background-color: RGB(170, 220, 205);
+}
+
 .del {
   -webkit-text-decoration-line: line-through;
           text-decoration-line: line-through;
@@ -14280,3 +14300,499 @@ a.text-dark:focus {
   clip: auto;
 }
 
+@-webkit-keyframes bs-notify-fadeOut {
+  0% {
+    opacity: 0.9;
+  }
+
+  100% {
+    opacity: 0;
+  }
+}
+
+@keyframes bs-notify-fadeOut {
+  0% {
+    opacity: 0.9;
+  }
+
+  100% {
+    opacity: 0;
+  }
+}
+
+select.bs-select-hidden,
+.bootstrap-select > select.bs-select-hidden,
+select.selectpicker {
+  display: none !important;
+}
+
+.bootstrap-select {
+  width: 220px \0;
+  /*IE9 and below*/
+  vertical-align: middle;
+}
+
+.bootstrap-select > .dropdown-toggle {
+  position: relative;
+  width: 100%;
+  text-align: right;
+  white-space: nowrap;
+  display: inline-flex;
+  align-items: center;
+  justify-content: space-between;
+}
+
+.bootstrap-select > .dropdown-toggle:after {
+  margin-top: -1px;
+}
+
+.bootstrap-select > .dropdown-toggle.bs-placeholder,
+.bootstrap-select > .dropdown-toggle.bs-placeholder:hover,
+.bootstrap-select > .dropdown-toggle.bs-placeholder:focus,
+.bootstrap-select > .dropdown-toggle.bs-placeholder:active {
+  color: #999;
+}
+
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-primary,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-primary:hover,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-primary:focus,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-primary:active,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-secondary,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-secondary:hover,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-secondary:focus,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-secondary:active,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-success,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-success:hover,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-success:focus,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-success:active,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-danger,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-danger:hover,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-danger:focus,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-danger:active,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-info,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-info:hover,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-info:focus,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-info:active,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-dark,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-dark:hover,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-dark:focus,
+.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-dark:active {
+  color: rgba(255, 255, 255, 0.5);
+}
+
+.bootstrap-select > select {
+  position: absolute !important;
+  bottom: 0;
+  left: 50%;
+  display: block !important;
+  width: 0.5px !important;
+  height: 100% !important;
+  padding: 0 !important;
+  opacity: 0 !important;
+  border: none;
+  z-index: 0 !important;
+}
+
+.bootstrap-select > select.mobile-device {
+  top: 0;
+  left: 0;
+  display: block !important;
+  width: 100% !important;
+  z-index: 2 !important;
+}
+
+.has-error .bootstrap-select .dropdown-toggle,
+.error .bootstrap-select .dropdown-toggle,
+.bootstrap-select.is-invalid .dropdown-toggle,
+.was-validated .bootstrap-select select:invalid + .dropdown-toggle {
+  border-color: #b94a48;
+}
+
+.bootstrap-select.is-valid .dropdown-toggle,
+.was-validated .bootstrap-select select:valid + .dropdown-toggle {
+  border-color: #28a745;
+}
+
+.bootstrap-select.fit-width {
+  width: auto !important;
+}
+
+.bootstrap-select:not([class*=col-]):not([class*=form-control]):not(.input-group-btn) {
+  width: 220px;
+}
+
+.bootstrap-select > select.mobile-device:focus + .dropdown-toggle,
+.bootstrap-select .dropdown-toggle:focus {
+  outline: thin dotted #333333 !important;
+  outline: 5px auto -webkit-focus-ring-color !important;
+  outline-offset: -2px;
+}
+
+.bootstrap-select.form-control {
+  margin-bottom: 0;
+  padding: 0;
+  border: none;
+  height: auto;
+}
+
+:not(.input-group) > .bootstrap-select.form-control:not([class*=col-]) {
+  width: 100%;
+}
+
+.bootstrap-select.form-control.input-group-btn {
+  float: none;
+  z-index: auto;
+}
+
+.form-inline .bootstrap-select,
+.form-inline .bootstrap-select.form-control:not([class*=col-]) {
+  width: auto;
+}
+
+.bootstrap-select:not(.input-group-btn),
+.bootstrap-select[class*=col-] {
+  float: none;
+  display: inline-block;
+  margin-left: 0;
+}
+
+.bootstrap-select.dropdown-menu-right,
+.bootstrap-select[class*=col-].dropdown-menu-right,
+.row .bootstrap-select[class*=col-].dropdown-menu-right {
+  float: right;
+}
+
+.form-inline .bootstrap-select,
+.form-horizontal .bootstrap-select,
+.form-group .bootstrap-select {
+  margin-bottom: 0;
+}
+
+.form-group-lg .bootstrap-select.form-control,
+.form-group-sm .bootstrap-select.form-control {
+  padding: 0;
+}
+
+.form-group-lg .bootstrap-select.form-control .dropdown-toggle,
+.form-group-sm .bootstrap-select.form-control .dropdown-toggle {
+  height: 100%;
+  font-size: inherit;
+  line-height: inherit;
+  border-radius: inherit;
+}
+
+.bootstrap-select.form-control-sm .dropdown-toggle,
+.bootstrap-select.form-control-lg .dropdown-toggle {
+  font-size: inherit;
+  line-height: inherit;
+  border-radius: inherit;
+}
+
+.bootstrap-select.form-control-sm .dropdown-toggle {
+  padding: 0.25rem 0.5rem;
+}
+
+.bootstrap-select.form-control-lg .dropdown-toggle {
+  padding: 0.5rem 1rem;
+}
+
+.form-inline .bootstrap-select .form-control {
+  width: 100%;
+}
+
+.bootstrap-select.disabled,
+.bootstrap-select > .disabled {
+  cursor: not-allowed;
+}
+
+.bootstrap-select.disabled:focus,
+.bootstrap-select > .disabled:focus {
+  outline: none !important;
+}
+
+.bootstrap-select.bs-container {
+  position: absolute;
+  top: 0;
+  left: 0;
+  height: 0 !important;
+  padding: 0 !important;
+}
+
+.bootstrap-select.bs-container .dropdown-menu {
+  z-index: 1060;
+}
+
+.bootstrap-select .dropdown-toggle .filter-option {
+  position: static;
+  top: 0;
+  left: 0;
+  float: left;
+  height: 100%;
+  width: 100%;
+  text-align: left;
+  overflow: hidden;
+  flex: 0 1 auto;
+}
+
+.bs3.bootstrap-select .dropdown-toggle .filter-option {
+  padding-right: inherit;
+}
+
+.input-group .bs3-has-addon.bootstrap-select .dropdown-toggle .filter-option {
+  position: absolute;
+  padding-top: inherit;
+  padding-bottom: inherit;
+  padding-left: inherit;
+  float: none;
+}
+
+.input-group .bs3-has-addon.bootstrap-select .dropdown-toggle .filter-option .filter-option-inner {
+  padding-right: inherit;
+}
+
+.bootstrap-select .dropdown-toggle .filter-option-inner-inner {
+  overflow: hidden;
+}
+
+.bootstrap-select .dropdown-toggle .filter-expand {
+  width: 0 !important;
+  float: left;
+  opacity: 0 !important;
+  overflow: hidden;
+}
+
+.bootstrap-select .dropdown-toggle .caret {
+  position: absolute;
+  top: 50%;
+  right: 12px;
+  margin-top: -2px;
+  vertical-align: middle;
+}
+
+.input-group .bootstrap-select.form-control .dropdown-toggle {
+  border-radius: inherit;
+}
+
+.bootstrap-select[class*=col-] .dropdown-toggle {
+  width: 100%;
+}
+
+.bootstrap-select .dropdown-menu {
+  min-width: 100%;
+  box-sizing: border-box;
+}
+
+.bootstrap-select .dropdown-menu > .inner:focus {
+  outline: none !important;
+}
+
+.bootstrap-select .dropdown-menu.inner {
+  position: static;
+  float: none;
+  border: 0;
+  padding: 0;
+  margin: 0;
+  border-radius: 0;
+  box-shadow: none;
+}
+
+.bootstrap-select .dropdown-menu li {
+  position: relative;
+}
+
+.bootstrap-select .dropdown-menu li.active small {
+  color: rgba(255, 255, 255, 0.5) !important;
+}
+
+.bootstrap-select .dropdown-menu li.disabled a {
+  cursor: not-allowed;
+}
+
+.bootstrap-select .dropdown-menu li a {
+  cursor: pointer;
+  -webkit-user-select: none;
+     -moz-user-select: none;
+      -ms-user-select: none;
+          user-select: none;
+}
+
+.bootstrap-select .dropdown-menu li a.opt {
+  position: relative;
+  padding-left: 2.25em;
+}
+
+.bootstrap-select .dropdown-menu li a span.check-mark {
+  display: none;
+}
+
+.bootstrap-select .dropdown-menu li a span.text {
+  display: inline-block;
+}
+
+.bootstrap-select .dropdown-menu li small {
+  padding-left: 0.5em;
+}
+
+.bootstrap-select .dropdown-menu .notify {
+  position: absolute;
+  bottom: 5px;
+  width: 96%;
+  margin: 0 2%;
+  min-height: 26px;
+  padding: 3px 5px;
+  background: whitesmoke;
+  border: 1px solid #e3e3e3;
+  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
+  pointer-events: none;
+  opacity: 0.9;
+  box-sizing: border-box;
+}
+
+.bootstrap-select .dropdown-menu .notify.fadeOut {
+  -webkit-animation: 300ms linear 750ms forwards bs-notify-fadeOut;
+          animation: 300ms linear 750ms forwards bs-notify-fadeOut;
+}
+
+.bootstrap-select .no-results {
+  padding: 3px;
+  background: #f5f5f5;
+  margin: 0 5px;
+  white-space: nowrap;
+}
+
+.bootstrap-select.fit-width .dropdown-toggle .filter-option {
+  position: static;
+  display: inline;
+  padding: 0;
+}
+
+.bootstrap-select.fit-width .dropdown-toggle .filter-option-inner,
+.bootstrap-select.fit-width .dropdown-toggle .filter-option-inner-inner {
+  display: inline;
+}
+
+.bootstrap-select.fit-width .dropdown-toggle .bs-caret:before {
+  content: "\A0";
+}
+
+.bootstrap-select.fit-width .dropdown-toggle .caret {
+  position: static;
+  top: auto;
+  margin-top: -1px;
+}
+
+.bootstrap-select.show-tick .dropdown-menu .selected span.check-mark {
+  position: absolute;
+  display: inline-block;
+  right: 15px;
+  top: 5px;
+}
+
+.bootstrap-select.show-tick .dropdown-menu li a span.text {
+  margin-right: 34px;
+}
+
+.bootstrap-select .bs-ok-default:after {
+  content: "";
+  display: block;
+  width: 0.5em;
+  height: 1em;
+  border-style: solid;
+  border-width: 0 0.26em 0.26em 0;
+  transform-style: preserve-3d;
+  transform: rotate(45deg);
+}
+
+.bootstrap-select.show-menu-arrow.open > .dropdown-toggle,
+.bootstrap-select.show-menu-arrow.show > .dropdown-toggle {
+  z-index: 1061;
+}
+
+.bootstrap-select.show-menu-arrow .dropdown-toggle .filter-option:before {
+  content: "";
+  border-left: 7px solid transparent;
+  border-right: 7px solid transparent;
+  border-bottom: 7px solid rgba(204, 204, 204, 0.2);
+  position: absolute;
+  bottom: -4px;
+  left: 9px;
+  display: none;
+}
+
+.bootstrap-select.show-menu-arrow .dropdown-toggle .filter-option:after {
+  content: "";
+  border-left: 6px solid transparent;
+  border-right: 6px solid transparent;
+  border-bottom: 6px solid white;
+  position: absolute;
+  bottom: -4px;
+  left: 10px;
+  display: none;
+}
+
+.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle .filter-option:before {
+  bottom: auto;
+  top: -4px;
+  border-top: 7px solid rgba(204, 204, 204, 0.2);
+  border-bottom: 0;
+}
+
+.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle .filter-option:after {
+  bottom: auto;
+  top: -4px;
+  border-top: 6px solid white;
+  border-bottom: 0;
+}
+
+.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle .filter-option:before {
+  right: 12px;
+  left: auto;
+}
+
+.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle .filter-option:after {
+  right: 13px;
+  left: auto;
+}
+
+.bootstrap-select.show-menu-arrow.open > .dropdown-toggle .filter-option:before,
+.bootstrap-select.show-menu-arrow.open > .dropdown-toggle .filter-option:after,
+.bootstrap-select.show-menu-arrow.show > .dropdown-toggle .filter-option:before,
+.bootstrap-select.show-menu-arrow.show > .dropdown-toggle .filter-option:after {
+  display: block;
+}
+
+.bs-searchbox,
+.bs-actionsbox,
+.bs-donebutton {
+  padding: 4px 8px;
+}
+
+.bs-actionsbox {
+  width: 100%;
+  box-sizing: border-box;
+}
+
+.bs-actionsbox .btn-group button {
+  width: 50%;
+}
+
+.bs-donebutton {
+  float: left;
+  width: 100%;
+  box-sizing: border-box;
+}
+
+.bs-donebutton .btn-group button {
+  width: 100%;
+}
+
+.bs-searchbox + .bs-actionsbox {
+  padding: 0 8px 4px;
+}
+
+.bs-searchbox .form-control {
+  margin-bottom: 0;
+  width: 100%;
+  float: none;
+}
+

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 3253 - 1
public/js/app.js


+ 2 - 0
resources/js/app.js

@@ -8,3 +8,5 @@ window.getGetVal=require('./utilities/getGetVal');
 window.scanner=require('./utilities/scanner');
 window.datetimeRelating=require('./utilities/datetimeRelating');
 
+require('bootstrap-select');
+

+ 16 - 4
resources/js/queryForm/queryForm.js

@@ -168,7 +168,7 @@ const query = function getQueryForm(data) {
         _baseData.condition.forEach(function (conditions, xindex, xarrays) {
             let _width = 0;
             conditions.forEach(function (condition, index, array) {
-                if (['input', 'select', 'dateTime', 'input_select'].includes(condition.type)) {
+                if (['input','dateMonth', 'select', 'dateTime', 'input_select'].includes(condition.type)) {
                     _width += 260;
                 } else if (['dateTime_dateTime','dateTimeLocal', 'input_input'].includes(condition.type)) {
                     _width += 330;
@@ -339,6 +339,7 @@ const query = function getQueryForm(data) {
             || (type === "input_select" && getInputSelect(condition))
             || (type === "dateTime" && getdateTime(condition))
             || (type === "dateTimeLocal" && getDateTimeLocal(condition))
+            || (type === "dateMonth" && getDateMonth(condition))
             || (type === "time" && getTime(condition))
             || (type === "input_input" && getInputInput(condition))
             || (type === "dateTime_dateTime" && getdateTimedateTime(condition))
@@ -347,6 +348,17 @@ const query = function getQueryForm(data) {
             || (type === "checkbox" && getCheckBox(condition));
     }
 
+    // dateMonth
+    function getDateMonth(condition) {
+        let dateMonth = $("<input name = '"+ condition.name +"' type='month' class='form-control form-control-sm' style='vertical-align: middle; max-width: 200px;' placeholder='" + condition.placeholder + "' autocomplete='off' data-toggle='tooltip' >");
+        dateMonth.attr('title', condition.tip === undefined ? '' : condition.tip);
+        dateMonth.bind('input propertychange', function () {
+            let dom = {name: condition.name, type: 'dateMonth', value: this.value, mold: 'dateMonth'};
+            modifyData(dom);
+        });
+        return dateMonth;
+    }
+
     // input
     function getInput(condition) {
         let input = $("<input name='" + condition.name + "' class='form-control form-control-sm' style='vertical-align: middle; max-width: 200px;' placeholder='" + condition.placeholder + "' autocomplete='off' data-toggle='tooltip' data-placement='top' >");
@@ -1068,7 +1080,7 @@ const query = function getQueryForm(data) {
     }
 
     function redenerSearchFormOnData(key, value, mold) {
-        if (mold === 'input' ||mold === 'dateTime' || mold === 'dateTimeLocal') {
+        if (mold === 'input' ||mold === 'dateTime' || mold === 'dateTimeLocal' || mold === 'dateMonth') {
             rendererSearchFormOnInput(key, value, mold);
         } else if (mold === 'select') {
             rendererSearchFormOnSelect(key, value, mold);
@@ -1085,7 +1097,7 @@ const query = function getQueryForm(data) {
     function switchData() {
         _this.condition.forEach(function (conditions) {
             conditions.forEach(function (condition) {
-                if (['input', 'select', 'dateTime','dateTimeLocal', 'search_select', 'time', 'select_multiple_select','checkbox'].includes(condition.type)) {
+                if (['input', 'select', 'dateTime','dateTimeLocal', 'dateMonth', 'search_select', 'time', 'select_multiple_select','checkbox'].includes(condition.type)) {
                     if (!condition.select) {
                         condition.select = '';
                     }
@@ -1183,7 +1195,7 @@ const query = function getQueryForm(data) {
             // }
             _data[key].select = value;
 
-            if (['input', 'dateTime', 'dateTimeLocal'].includes(mold)) {
+            if (['input', 'dateTime', 'dateTimeLocal', 'dateMonth'].includes(mold)) {
                 rendererSearchFormOnInput(key, value, mold);
             } else if (['select'].includes(mold)) {
                 rendererSearchFormOnSelect(key, value, mold);

+ 2 - 0
resources/sass/app.scss

@@ -2,6 +2,7 @@
 @import 'variables';
 @import 'fonts';
 @import 'text';
+@import "color";
 @import 'layout';
 @import 'effect';
 @import 'elements';
@@ -9,3 +10,4 @@
 // Bootstrap
 @import '~bootstrap/scss/bootstrap';
 @import '~font-awesome/scss/font-awesome';
+@import "~bootstrap-select/sass/bootstrap-select";

+ 16 - 0
resources/sass/color.scss

@@ -0,0 +1,16 @@
+
+.bg-light-khaki{
+  background-color:#eac3aa;
+}
+.bg-khaki{
+  background-color:#af7651;
+}
+.bg-light-info{
+  background-color:RGB(170,199,230);
+}
+.bg-light-cyanogen{
+  background-color:RGB(170,234,210);
+}
+.bg-cyanogen{
+  background-color:RGB(170,220,205);
+}

+ 110 - 0
resources/views/customer/project/area.blade.php

@@ -0,0 +1,110 @@
+@extends('layouts.app')
+@section('title')
+    称重管理-项目报表
+@endsection
+@section('content')
+    @component('customer.project.menu')@endcomponent
+    <div class="container-fluid" id="container">
+        <div id="form_div"></div>
+        <div>
+            <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="excelExport(false)" href="javascript:">导出勾选内容</a>
+                <a class="dropdown-item" @click="excelExport(true)" href="javascript:">导出所有页</a>
+            </div>
+        </div>
+        <div>
+            <label for="all" id="cloneCheckAll" class="d-none">
+                <input id="all" type="checkbox" @click="checkAll($event)">全选
+            </label>
+            <table class="d-none" id="headerRoll"></table>
+            <table class="table table-sm table-striped table-hover" id="headerParent">
+                <tr class="text-nowrap" id="header"></tr>
+            </table>
+        </div>
+    </div>
+@stop
+
+@section('lastScript')
+    <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
+    <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
+    <script>
+        let vue = new Vue({
+            el:"#container",
+            data:{
+                areas : [],
+                workgroup : [],
+                customers : [],
+                owners : [],
+                checkData : [],
+            },
+            mounted(){
+                let data=[
+                    [
+                        {name:'workgroup',type:'select',tip:'项目小组',placeholder: '项目小组',data:this.workgroup},
+                        {name:'counting_month_start',type:'dateMonth',tip:'起始结算月'},
+                        {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的项目'],
+                            placeholder:['项目','定位或多选项目'],data:this.owners},
+                    ],[
+                        {name:'customer_id',type:'select',tip:'客户',placeholder: '客户',data:this.customers},
+                        {name:'counting_month_end',type:'dateMonth',tip:'结束结算月'},
+                    ],
+                ];
+                this.form = new query({
+                    el:"#form_div",
+                    condition:data,
+                });
+                this.form.init();
+                let column = [
+                    {name:'cloneCheckAll',customization:true,type:'checkAll',column:'id',
+                        dom:$('#cloneCheckAll').removeClass('d-none'), neglect: true},
+                    {name:'index',value: '序号', neglect: true},
+                    {name:'status',value: '状态'},
+                    {name:'workgroup',value: '项目组'},
+                    {name:'customer_name',value: '客户'},
+                    {name:'owner_name',value: '子项目'},
+                    {name:'counting_month',value: '结算月'},
+                    {name:'created_at',value: '录入时间'},
+                    {name:'storage_type',value: '用仓类型'},
+                    {name:'area_on_tray',value: '货物整托', neglect: true},
+                    {name:'area_on_half_tray',value: '货物半托', neglect: true},
+                    {name:'area_on_flat',value: '平面区面积', neglect: true},
+                    {name:'accounting_area',value: '结算面积', neglect: true},
+                ];
+                let _this=this;
+                setTimeout(function () {
+                    let header = new Header({
+                        el: "#header",
+                        column: column,
+                        data: _this.reports,
+                        restorationColumn: 'id',
+                        fixedTop:($('#form_div').height())+2,
+                        offset:0.5,
+                        vue:vue
+                    });
+                    header.init();
+                },0);
+            },
+            methods:{
+                excelExport(isAll){
+
+                },
+                //全选事件
+                checkAll(e){
+                    if (e.target.checked){
+                        this.areas.forEach((el)=>{
+                            if (this.checkData.indexOf(el.id) === '-1'){
+                                this.checkData.push(el.id);
+                            }
+                        });
+                    }else {
+                        this.checkData = [];
+                    }
+                },
+            },
+        });
+    </script>
+@stop

+ 78 - 0
resources/views/customer/project/create.blade.php

@@ -0,0 +1,78 @@
+@extends('layouts.app')
+@section('title')客户管理-项目录入@endsection
+
+@section('content')
+    @component('customer.project.menu')@endcomponent
+    <div class="container-fluid card" id="container">
+        <div class="card-body offset-3">
+            <form method="GET" action="{{url('')}}" class="mt-3">
+                <div class="row">
+                    <label for="code" class="col-2 text-info">项目代码</label>
+                    <input type="text" required id="code" class="form-control form-control-sm col-7"  name="code">
+                </div>
+                <div class="row mt-3">
+                    <label for="name" class="col-2 text-info">项目名称</label>
+                    <input type="text" id="name" class="form-control form-control-sm col-7"  name="name">
+                </div>
+                <div class="row mt-3">
+                    <label for="owner_id" class="col-2">客户</label>
+                    <select id="owner_id" class="form-control form-control-sm col-4"  name="owner_id">
+                        <option> </option>
+                        <option v-for="customer in customers" :value="customer.id">@{{ customer.name }}</option>
+                    </select>
+                </div>
+                <div class="row mt-3">
+                    <label for="workgroup_id" class="col-2">项目小组</label>
+                    <select id="workgroup_id" class="form-control form-control-sm col-4"  name="workgroup_id">
+                        <option> </option>
+                        <option v-for="group in groups" :value="group.id">@{{ group.name }}</option>
+                    </select>
+                </div>
+                <div class="row mt-3">
+                    <label class="col-2" for="type">仓储计费类型</label>
+                    <select id="type" name="type" class="selectpicker" multiple data-live-search="true" title="仓储计费类型(多选)">
+                        <option v-for="t in type" :value="t.id">@{{ t.name }}</option>
+                    </select>
+                </div>
+                <div class="row mt-3">
+                    <label for="tax_rate" class="col-2">税率<span class="badge badge-secondary">%</span></label>
+                    <input type="number" id="tax_rate" class="form-control form-control-sm col-3"  name="tax_rate">
+                </div>
+                <div class="row mt-3">
+                    <label for="contract_number" class="col-2">合同号</label>
+                    <input type="text" id="contract_number" class="form-control form-control-sm col-7"  name="contract_number">
+                </div>
+                <div class="row mt-3">
+                    <label for="salesman" class="col-2">销售名称</label>
+                    <input type="text" id="salesman" class="form-control form-control-sm col-7"  name="salesman">
+                </div>
+                <div class="row mt-3">
+                    <label for="linkman" class="col-2">联系人</label>
+                    <input type="text" id="linkman" class="form-control form-control-sm col-7"  name="linkman">
+                </div>
+                <div class="row mt-3">
+                    <label for="phone_number" class="col-2">联系电话</label>
+                    <input type="text" id="phone_number" class="form-control form-control-sm col-7"  name="phone_number">
+                </div>
+                <div class="row mt-3">
+                    <label for="description" class="col-2">项目描述</label>
+                    <textarea id="description" class="form-control form-control-sm col-7"  name="description"></textarea>
+                </div>
+                <button type="submit" class="btn btn-success mt-3 col-8 offset-1">提交</button>
+            </form>
+        </div>
+    </div>
+@stop
+
+@section('lastScript')
+    <script>
+        new Vue({
+            el:"#container",
+            data:{
+                type : [{name:"常温",id:"1"},{name:"恒温",id:"2"},{name:"冷藏",id:"2"},],
+                customers : [{name:"TEST1",id:"1"},],
+                groups : [{name:'TEST1',id:"1"}],
+            },
+        });
+    </script>
+@stop

+ 94 - 1
resources/views/customer/project/index.blade.php

@@ -1 +1,94 @@
-<?php
+@extends('layouts.app')
+@section('title')客户管理-项目查询@endsection
+
+@section('content')
+    @component('customer.project.menu')@endcomponent
+    <div class="container-fluid" id="container">
+        <div class="mt-1">
+            <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="excelExport(false)" href="javascript:">导出勾选内容</a>
+                <a class="dropdown-item" @click="excelExport(true)" href="javascript:">导出所有页</a>
+            </div>
+        </div>
+        <div>
+            <label for="all" id="cloneCheckAll" class="d-none">
+                <input id="all" type="checkbox" @click="checkAll($event)">全选
+            </label>
+            <table class="d-none" id="headerRoll"></table>
+            <table class="table table-sm text-nowrap table-striped table-hover" id="headerParent">
+                <tr id="header"></tr>
+            </table>
+        </div>
+    </div>
+@endsection
+
+@section('lastScript')
+    <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
+    <script>
+        let vue = new Vue({
+            el:"#container",
+            data:{
+                owners : [],
+                checkData : [],
+            },
+            mounted(){
+                let column = [
+                    {name:'cloneCheckAll',customization:true,type:'checkAll',column:'id',
+                        dom:$('#cloneCheckAll').removeClass('d-none'), neglect: true},
+                    {name:'operating',value: '操作', neglect: true},
+                    {name:'customer',value: '客户'},
+                    {name:'tax_rate',value: '税率', neglect: true},
+                    {name:'name',value: '项目'},
+                    {name:'code',value: '货主代码'},
+                    {name:'contract_number',value: '合同号'},
+                    {name:'created_at',value: '创建日期'},
+                    {name:'salesman',value: '销售名称'},
+                    {name:'customer_full_name',value: '公司全称'},
+                    {name:'linkman',value: '联系人'},
+                    {name:'phone_number',value: '联系电话'},
+                    {name:'workgroup',value: '项目小组'},
+                    {name:'relating_price',value: '关联报价', neglect: true},
+                    {name:'type',value: '用仓类型'},
+                    {name:'current_month_counting_area',value: '当月结算面积', neglect: true},
+                    {name:'waring_line_on',value: '月单量预警', neglect: true},
+                    {name:'is_activating',value: '是否激活', neglect: true},
+                    {name:'description',value: '项目描述'},
+                ];
+                let _this=this;
+                setTimeout(function () {
+                    let header = new Header({
+                        el: "#header",
+                        column: column,
+                        data: _this.owners,
+                        restorationColumn: 'id',
+                        fixedTop:($('#form_div').height())+2,
+                        offset:0.5,
+                        vue:vue
+                    });
+                    header.init();
+                },0);
+            },
+            methods:{
+                excelExport(isAll){
+
+                },
+                //全选事件
+                checkAll(e){
+                    if (e.target.checked){
+                        this.owners.forEach((el)=>{
+                            if (this.checkData.indexOf(el.id) === '-1'){
+                                this.checkData.push(el.id);
+                            }
+                        });
+                    }else {
+                        this.checkData = [];
+                    }
+                },
+            },
+        });
+    </script>
+@endsection

+ 12 - 0
resources/views/customer/project/menu.blade.php

@@ -8,6 +8,18 @@
                 <li class="nav-item">
                     <a class="nav-link" href="{{url('customer/project/report')}}" :class="{active:isActive('report',3)}">报表</a>
                 </li> @endcan
+                @can('客户管理-项目-查询')
+                <li class="nav-item">
+                    <a class="nav-link" href="{{url('customer/project/index')}}" :class="{active:isActive('index',3)}">查询</a>
+                </li> @endcan
+                @can('客户管理-项目-查询')
+                <li class="nav-item">
+                    <a class="nav-link" href="{{url('customer/project/create')}}" :class="{active:isActive('create',3)}">录入</a>
+                </li> @endcan
+                @can('客户管理-项目-面积')
+                <li class="nav-item">
+                    <a class="nav-link" href="{{url('customer/project/area')}}" :class="{active:isActive('area',3)}">面积</a>
+                </li> @endcan
             </ul>
         </div>
     </div>

+ 115 - 1
resources/views/customer/project/report.blade.php

@@ -1,7 +1,121 @@
 @extends('layouts.app')
 @section('title')
-    称重管理-项目-报表
+    客户管理-项目报表
 @endsection
 @section('content')
     @component('customer.project.menu')@endcomponent
+    <div class="container-fluid card" id="container">
+        <div id="form_div"></div>
+        <div>
+            <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="reportExport(false)" href="javascript:">导出勾选内容</a>
+                <a class="dropdown-item" @click="reportExport(true)" href="javascript:">导出所有页</a>
+            </div>
+        </div>
+        <div>
+            <label for="all" id="cloneCheckAll" class="d-none">
+                <input id="all" type="checkbox" @click="checkAll($event)">全选
+            </label>
+            <table class="d-none" id="headerRoll"></table>
+            <table class="table table-sm table-striped table-hover" id="headerParent">
+                <tr class="text-center">
+                    <td colspan="2"></td>
+                    <td colspan="7" class="bg-light-khaki">客户信息</td>
+                    <td colspan="4" class="bg-light-info">盘点信息</td>
+                    <td colspan="3" class="bg-light-cyanogen">账单信息</td>
+                </tr>
+                <tr class="text-nowrap" id="header"></tr>
+            </table>
+        </div>
+    </div>
+@stop
+
+@section('lastScript')
+    <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
+    <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
+    <script>
+        let vue = new Vue({
+            el:"#container",
+            data:{
+                reports : [],
+                owners : [],
+                workgroup : [],
+                customers : [],
+                status : [],
+                checkData : [],
+            },
+            mounted(){
+                let data=[
+                    [
+                        {name:'workgroup',type:'select',tip:'项目小组',placeholder: '项目小组',data:this.workgroup},
+                        {name:'counting_month_start',type:'dateMonth',tip:'起始结算月'},
+                        {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的项目'],
+                            placeholder:['项目','定位或多选项目'],data:this.owners},
+                    ],[
+                        {name:'customer_id',type:'select',tip:'客户',placeholder: '客户',data:this.customers},
+                        {name:'counting_month_end',type:'dateMonth',tip:'结束结算月'},
+                        {name:'status',type:'select',placeholder:'状态',data:this.status},
+                    ],
+                ];
+                this.form = new query({
+                    el:"#form_div",
+                    condition:data,
+                });
+                this.form.init();
+                let column = [
+                    {name:'cloneCheckAll',customization:true,type:'checkAll',column:'id',
+                        dom:$('#cloneCheckAll').removeClass('d-none'), neglect: true},
+                    {name:'operating',value: '操作', neglect: true},
+                    {name:'index',value: '序号', neglect: true ,class:"bg-khaki"},
+                    {name:'workgroup',value: '项目小组',class:"bg-khaki"},
+                    {name:'customer',value: '客户',class:"bg-khaki"},
+                    {name:'owner',value: '子项目',class:"bg-khaki"},
+                    {name:'status',value: '状态',class:"bg-khaki"},
+                    {name:'created_at',value: '创建日期',class:"bg-khaki"},
+                    {name:'storage_duration',value: '在库时长',class:"bg-khaki"},
+                    {name:'counting_month',value: '结算月', class:"bg-info"},
+                    {name:'daily_average_order_amount',value: '日均单量', neglect: true, class:"bg-info"},
+                    {name:'last_month_counting_area',value: '结算月上月盘点面积', neglect: true, class:"bg-info"},
+                    {name:'current_month_counting_area',value: '结算月盘点面积', neglect: true, class:"bg-info"},
+                    {name:'init_bill_amount',value: '初始账单金额', neglect: true, class:"bg-cyanogen"},
+                    {name:'confirm_bill_amount',value: '确认账单金额', neglect: true, class:"bg-cyanogen"},
+                    {name:'confirm_created_at',value: '确认日期', class:"bg-cyanogen"},
+                ];
+                let _this=this;
+                setTimeout(function () {
+                    let header = new Header({
+                        el: "#header",
+                        column: column,
+                        data: _this.reports,
+                        restorationColumn: 'id',
+                        fixedTop:($('#form_div').height())+2,
+                        offset:0.5,
+                        vue:vue
+                    });
+                    header.init();
+                },0);
+            },
+            methods : {
+                reportExport(isAll){
+
+                },
+                //全选事件
+                checkAll(e){
+                    if (e.target.checked){
+                        this.reports.forEach((el)=>{
+                            if (this.checkData.indexOf(el.id) === '-1'){
+                                this.checkData.push(el.id);
+                            }
+                        });
+                    }else {
+                        this.checkData = [];
+                    }
+                },
+            }
+        });
+    </script>
 @stop

+ 74 - 15
resources/views/maintenance/log/index.blade.php

@@ -7,11 +7,21 @@
         @component('maintenance.log.menu')@endcomponent
     </span>
     <div class="container-fluid">
+        <a class="btn btn-outline-dark"  href="{{url('maintenance/syncRedisLogs')}}">同步日志</a>
         <div class="card">
+            <div id="form_div"></div>
             <div class="card-body">
-                @if(Session::has('successTip'))
-                    <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
-                @endif
+                {{--TODO 错误信息提示 待抽离成为模板--}}
+                @foreach (['danger', 'warning', 'success', 'info'] as $msg)
+                    @if(session()->has($msg))
+                        <div class="flash-message">
+                            <p class="alert alert-{{ $msg }}">
+                                {{ session()->get($msg) }}
+                            </p>
+                        </div>
+                    @endif
+                @endforeach
+
                 <table class="table table-striped table-sm" id="list">
                     <tr>
                         <th>ID</th>
@@ -21,24 +31,73 @@
                         <th>ip</th>
                         <th>时间</th>
                     </tr>
-                    @foreach($logs as $log)
-                        <tr class="hover" onclick="location.href='{{url('maintenance/log/'.$log['id'])}}'" style="cursor: pointer">
-                            <td class="text-muted">{{$log['id']}}</td>
-                            <td>{{$log['user_name']}}</td>
-                            <td>{{$log['operation']}}</td>
-                            <td>{{$log['type']}}</td>
-                            <td>{{$log['ip']}}</td>
-                            <td>{{$log['created_at']}}</td>
-                        </tr>
-                    @endforeach
+                    <tr v-for="log in logs" class="hover" @click="logsClick(log)" style="cursor: pointer">
+                        <td class="text-muted">@{{log.id}}</td>
+                        <td>@{{log.user_name}}</td>
+                        <td>@{{log.operation}}</td>
+                        <td>@{{log.type}}</td>
+                        <td>@{{log.ip}}</td>
+                        <td class="text-muted">@{{log.created_at}}</td>
+                    </tr>
                 </table>
-                {{$logs->links()}}
+                    @if($logs)
+                    {{--带参分页查询--}}
+                    {{$logs->withQueryString()->links()}}
+                    @endif
             </div>
         </div>
     </div>
     <style>
-        .hover:hover{
+        .hover:hover {
             color: #1f6fb2;
         }
     </style>
 @endsection
+@section('lastScript')
+    <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
+    <script>
+        new Vue({
+            el: "#list",
+            data: {
+
+                logs: [
+                    @if($logs)
+
+                        @foreach( $logs as $log )
+                    {
+                        id: '{{$log->id}}',
+                        user_name: '{{$log->user_name}}',
+                        operation: '{{$log->operation}}',
+                        type: '{{$log->type}}',
+                        ip: '{{$log->ip}}',
+                        created_at: '{{$log->created_at}}'
+                    },
+                    @endforeach
+                    @endif
+                ],
+            },
+            mounted: function () {
+                let data = [
+                    [
+                        {name: 'operation', type: 'input', tip: '操作', placeholder: '操作'},
+                        {name: 'type', type: 'input', tip: '操作', placeholder: '类型'},
+                        {name: 'description', type: 'input', tip: '详情:可在两侧添加百分号(%)进行模糊搜索', placeholder: '详情'},
+                        {name:'created_at_start',type:'dateTime',tip:'选择显示指定日期的起始时间'},
+                        {name:'created_at_end',type:'dateTime',tip:'选择显示指定日期的截止'}
+                    ]
+                ];
+                this.from = new query({
+                    el: '#form_div',
+                    condition: data,
+                });
+                this.from.init();
+            },
+            methods: {
+                logsClick: function (log) {
+                    console.log(log);
+                    window.location.href = '{{url('maintenance/log/')}}' + '/' + log.id;
+                }
+            }
+        });
+    </script>
+@endsection

+ 14 - 1
resources/views/maintenance/owner/index.blade.php

@@ -8,6 +8,7 @@
     </span>
     <div class="container-fluid">
         <div class="card" id="list">
+            <div id="form_div"></div>
             <div class="card-body">
                 @if(Session::has('successTip'))
                     <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
@@ -34,13 +35,14 @@
                         </td>
                     </tr>
                 </table>
-                {{$owners->links()}}
+                {{$owners->withQueryString()->links()}}
             </div>
         </div>
     </div>
 @endsection
 
 @section('lastScript')
+    <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
     <script>
         new Vue({
             el:"#list",
@@ -51,6 +53,17 @@
                     @endforeach
                 ],
             },
+            mounted:function(){
+                let data = [
+                   [{name: 'code', type: 'input',tip:'货主编码:可在两侧添加百分号(%)进行模糊搜索',placeholder:'货主编码'},
+                   {name: 'name', type: 'input',tip:'货主名称:可在两侧添加百分号(%)进行模糊搜索',placeholder:'货主名称'}]
+                ];
+                this.from =new query({
+                    el: '#form_div',
+                    condition: data,
+                });
+                this.from.init();
+            },
             methods:{
                 edit:function(id){
                     location.href = "{{url('maintenance/owner')}}/"+id+"/edit";

+ 117 - 14
resources/views/order/index/delivering.blade.php

@@ -7,7 +7,7 @@
         <div style="min-width: 4120px;">{{--4070--}}
             <div id="list" class="d-none">
                 <div id="form_div"></div>
-                <div class="ml-3 form-inline">
+                <div class="ml-3 form-inline" id="btn">
                     <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="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
@@ -182,7 +182,7 @@
 
                 <div class="modal fade " id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
                      aria-hidden="true">
-                    <div class="modal-dialog modal-dialog-centered">
+                    <div class="modal-dialog modal-dialog-centered modal-xl">
                         <div class="modal-content">
                             <div class="modal-header">
                                 <h5 class="modal-title" id="exampleModalLabel">输入问题件信息</h5>
@@ -192,18 +192,35 @@
                                 </button>
                             </div>
                             <div class="modal-body">
-                                <div class="form-group row">
-                                    <label class="col-2 text-right">问题类别</label>
-                                    <select name="order_issues_type_id" v-model="typeId" class="form-control col-8" id="orderIssueType" @focus="focusOnModal($event)" >
+                                <div class="form-group row m-0 p-0">
+                                    <label class="col-md-1 col-sm-2 text-right">问题类别</label>
+                                    <select name="order_issues_type_id" v-model="typeId" class="form-control col-4" id="orderIssueType" @focus="focusOnModal($event)" >
                                         <option value></option>
                                         <option v-for="type in orderIssueType" :value="type.id">@{{ type.name }}</option>
                                     </select>
+                                    <label class="col-md-1 col-sm-2 text-right">
+                                        快递
+                                    </label>
+                                    <div class="col-4">
+                                        <textarea  class="form-control m-0">@{{ tagOrder.logisticInfo }}</textarea>
+                                        <button type="button" class="btn btn-sm btn-outline-primary" @click="copyLogisticInfo">复制</button>
+                                    </div>
                                 </div>
-                                <div class="form-group row">
-                                    <label class="col-2 text-right ">情况说明</label>
-                                    <textarea name="result_explain" v-model="result_explain" class="form-control col-8" id="result_explain"></textarea>
+                                <div class="form-group row m-0">
+                                    <label class="col-md-1 col-sm-2 text-right">情况说明</label>
+                                    <label for="result_explain"></label>
+                                    <textarea name="result_explain" v-model="result_explain" class="form-control col-4" id="result_explain" ></textarea>
+                                    <label class="col-md-1 col-sm-2 text-right">
+                                        商家
+                                    </label>
+                                    <div class="col-4">
+                                        <textarea  class="form-control m-0 row">@{{ tagOrder.merchantInfo }}</textarea>
+                                        <button type="button" class="btn btn-sm btn-outline-primary" @click="copyMerchantInfo">复制</button>
+                                    </div>
                                 </div>
+
                             </div>
+
                             <div class="modal-footer">
                                 <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal"
                                         @click="changeRemark">关闭
@@ -213,6 +230,7 @@
                         </div>
                     </div>
                 </div>
+                <textarea  id="clipboardDiv" style="opacity:0"></textarea>
             </div>
 
         </div>
@@ -246,7 +264,6 @@
                     {name:'{{$code->code}}',value:'{{$code->codename_c}}'},
                     @endforeach
                 ],
-                orderIssueNos:{!!  $orderIssueNos!!},
                 selectedStyle:'',
                 picktotraceidMap:{!! $picktotraceids !!},
                 pagePlaceholder:"",
@@ -256,7 +273,13 @@
                 is_merge : false,
                 message:{
                     checkOrderIssueMessage:'',
-                }
+                },
+                orderIssueNos:{!!  $orderIssueNos!!},
+                tagOrders:[],
+                tagOrder:{
+                    logisticInfo:'',
+                    merchantInfo:'',
+                },
             },
             mounted:function () {
                 $(".tooltipTarget").tooltip({'trigger':'hover'});
@@ -311,6 +334,7 @@
                 this.form = new query({
                     el:"#form_div",
                     condition:data,
+                    appendDom : "btn",
                 });
                 this.form.init();
                 let column = [
@@ -356,7 +380,7 @@
                         column: column,
                         data: _this.orders,
                         restorationColumn: 'addtime',
-                        fixedTop:($('#form_div').height())+2,
+                        fixedTop:($('#form_div').height())+($('#btn').height())+1,
                         offset:0.5,
                         vue:vue
                     });
@@ -375,6 +399,10 @@
                         }
                     },
                     deep:true
+                },
+                result_explain:function(){
+                    this.setLogisticInfo()
+                    this.setMerchantInfo()
                 }
             },
             methods:{
@@ -642,8 +670,13 @@
                             })
                             _this.checkData = []
                         }else{
-                            tempTip.setDuration(4000);
-                            tempTip.show(res.data.fail_info);
+                            if(res.data.exitsOrderNos){
+                                _this.message.checkOrderIssueMessage = res.data.fail_info+res.data.exitsOrderNos
+                                $("#checkModal").modal('show')
+                            }else{
+                                tempTip.setDuration(3000);
+                                tempTip.show(res.data.fail_info);
+                            }
                         }
                     }).catch(function(err){
                         tempTip.setDuration(3000);
@@ -692,6 +725,11 @@
                     $(e.target).removeClass('is-invalid');
                 },
                 isRejectedBillExist(){
+                    let _this=this;
+                    if(_this.checkData.length===0){
+                        tempTip.show('没有勾选记录');
+                        return
+                    }
                     tempTip.confirm("是否要生成“"+this.checkData+"”的退货单?",()=> {
                         let _this = this;
                         axios.post('{{url('order/isRejectedBillExist')}}',{data:this.checkData})
@@ -733,6 +771,7 @@
                     let _this = this;
                     axios.post("{{url('apiLocal/order/issue/isExistByOrderNo')}}",data).then(function(res){
                         if(res.data.success){
+                            _this.getTagOrder(orderNos);
                             $("#exampleModal").modal('show')
                         }else{
                             _this.message.checkOrderIssueMessage = res.data.fail_info
@@ -748,10 +787,74 @@
                     nowrapSpan.hide();
                     nowrapSpan.siblings('.text-truncate').show();
                 },
-                nowrapText(e){
+                nowrapText(e) {
                     let truncateSpan = $(e.target);
                     truncateSpan.hide();
                     truncateSpan.siblings('.text-nowrap').show();
+                },
+                getTagOrder(orderNos){
+                    this.tagOrders = []
+                    if(orderNos.length ===  0 ){this.tagOrders =[];return ;}
+                    if(this.orders.length === 0 ){this.tagOrders =[];return ;}
+                    for (let i = 0; i < this.orders.length; i++) {
+                        let order =  this.orders[i];
+                        let orderno =order.orderno;
+                        if(orderNos.includes(orderno)){
+                            this.tagOrders.push(this.orders[i])
+                        }
+                    }
+                    this.setLogisticInfo();
+                    this.setMerchantInfo();
+                },
+                setLogisticInfo(){
+                    let content = ''
+                    let _this = this
+                    this.tagOrders.forEach(function(order){
+                        let picktotraceids = _this.picktotraceidMap[order.orderno];
+                        if($.type(picktotraceids) ==='array'){
+                            picktotraceids.forEach(function(picktotraceid,index,array){
+                                if(array.length ===index+1)content+=picktotraceid;
+                                else content+=picktotraceid+','
+                            });
+                        }else{content+=order.soreference5}
+                        content+=' '+order.c_contact+order.c_tel2+order.c_province+order.c_city+' '+order.c_district+order.c_address1+'/'+_this.result_explain+"\n"
+                    })
+                    this.tagOrder.logisticInfo = content
+                },
+                setMerchantInfo(){
+                    let content = ''
+                    let _this = this
+                    this.tagOrders.forEach(function(order){
+                        content+=order.customer_descr_c+' '+order.soreference1+' '
+                        let picktotraceids = _this.picktotraceidMap[order.orderno];
+                        if($.type(picktotraceids) ==='array'){
+                            picktotraceids.forEach(function(picktotraceid,index,array){
+                                if(array.length ===index+1)content+=picktotraceid;
+                                else content+=picktotraceid+','
+                            });
+                        }else {content+=order.soreference5}
+                        content += '/'+_this.result_explain+ "\n";
+                    })
+                    this.tagOrder.merchantInfo = content
+                },
+                copyLogisticInfo(){
+                    this.copyText(this.tagOrder.logisticInfo)
+                },
+                copyMerchantInfo(){
+                    this.copyText(this.tagOrder.merchantInfo)
+                },
+                copyText(text){
+                    try {
+                        $('#clipboardDiv').text(text).select().focus();
+                        document.execCommand("Copy");
+                        tempTip.setIndex(1052)
+                        tempTip.setDuration(2000)
+                        tempTip.showSuccess('复制成功')
+                    } catch (e) {
+                        tempTip.setIndex(1052)
+                        tempTip.setDuration(2000)
+                        tempTip.showSuccess('复制失败:'+e)
+                    }
                 }
             },
         });

+ 22 - 4
resources/views/order/issue/create.blade.php

@@ -15,7 +15,7 @@
                         <input type="hidden" name="order_id" :value='order.id'>
                         <input type="hidden" name="second_order_id" :value='second_order_id'>
                         <div class="form-group row">
-                            <label for="logistic_number_return" class="col-2 col-form-label text-right ">退回单号</label>
+                            <label for="logistic_number_return" class="col-2 col-form-label text-right ">退回单号</label>
                             <div class="col-8 ">
                                 <input type="text" name="logistic_number_return" id="logistic_number_return" class="form-control col-lg-5 @error('logistic_number_return') is-invalid @enderror"
                                        v-model="logistic_number_return"
@@ -103,14 +103,17 @@
                                     class="text-danger">*</span>货主</label>
                             <div class="col-8 row">
                                 <div class="form-group col-lg-5">
-                                    <select class="form-control @error('owner_id') is-invalid @enderror" name="owner_id" v-model="order.owner_id">
+                                    <select class="form-control form-inline  @error('owner_id') is-invalid @enderror" name="owner_id" v-model="order.owner_id">
                                         <option value></option>
-                                        <option v-for="owner in owners" :value="owner.id">@{{ owner.name }}</option>
-                                    </select>
+                                        <option v-for="owner in filterOwners" :value="owner.id">@{{ owner.name }}</option>
+                                    </select >
                                     @error('owner_id')
                                     <span class="invalid-feedback" role="alert"><strong>{{ $message }}</strong></span>
                                     @enderror
                                 </div>
+                                <div class="form-group col-lg-5">
+                                    <input class="form-control form-inline" @change="ownerFilter($event)" placeholder="输入货主进行筛选">
+                                </div>
                             </div>
                         </div>
                         <div class="form-group row">
@@ -292,6 +295,7 @@
                 secondClientNO: @if(old('secondClientNO'))"{{old('secondClientNO')}}"@else''@endif,
                 order_issue_type_id: @if(old('order_issue_type_id'))"{{old('order_issue_type_id')}}"@else''@endif,
                 owners:{!! $owners !!},
+                filterOwners:{!! $owners !!},
                 logistics:{!! $logistic !!},
                 types:{!! $types !!},
                 userWorkGroup:{!! $userWorkGroup !!},
@@ -436,6 +440,20 @@
                         _this.isSubmit = false;
                     });
                 },
+                ownerFilter(e){
+                    let name = $(e.target).val();
+                    if(name===''){
+                        this.filterOwners = this.owners
+                        return
+                    }
+                    let arr = [];
+                    this.owners.forEach(function(owner){
+                        if(owner.name.includes(name)){
+                            arr.push(owner)
+                        }
+                    });
+                    this.filterOwners = arr;
+                }
             }
         })
     </script>

+ 122 - 8
resources/views/order/issue/import.blade.php

@@ -7,19 +7,37 @@
     <div class="container-fluid" id="issue_import_div">
         <div class="card col-md-8 offset-md-2">
             <div class="card-body">
-                <form action="{{url('order/issue/batchImport')}}" method="post" enctype="multipart/form-data" class="form"  target="_blank">
-                    @csrf
+
+                <div class="form-group row text-center">
+                    <div class="col-12 text-danger">
+                        注意:请保证表第一行有以下对应的字段名<br><span class="text-muted">(可不按顺序):</span><br>
+                        原始运单号,情况说明,问题类别<br>
+                        <span class="text-muted" style="opacity:0.7"> 订单问题类别:('拦截', '快递异常', '信息更改', '联系不上', '其他', '错漏发', '仓库问题', '快递丢件', '破损', '撤销丢件', '二次加工', '全检问题', '系统问题', '延迟发货', '仓库丢件', )<br></span>
+                    </div>
+                    <div class="col-12 text-info ">
+                        导入时间随文件大小可能达数十分钟以上,请耐心等候
+                        <hr>
+                    </div>
+                </div>
+                @can('订单管理-订单问题件生成-文本导入')
                     <div class="form-group row text-center">
                         <div class="col-12 text-danger">
-                            注意:请保证表第一行有以下对应的字段名<br><span class="text-muted">(可不按顺序):</span><br>
-                            原始运单号,情况说明,问题类别<br>
-                            <span class="text-muted" style="opacity:0.7"> 订单问题类别:('拦截', '快递异常', '信息更改', '联系不上', '其他', '错漏发', '仓库问题', '快递丢件', '破损', '撤销丢件', '二次加工', '全检问题', '系统问题', '延迟发货', '仓库丢件', )<br></span>
+                            订单问题类别:同Excel文件导入所要求的订单问题类别一致<br/>
+                            注意:文本导入的问题件只有全部符合条件的才能生成问题件<br/>
+                            <span class="text-muted" style="opacity:0.7">
+                                如果在导入后出现部分数据导入失败,修改对应错误的数据继续导入即可
+                            </span>
                         </div>
-                        <div class="col-12 text-info ">
-                            导入时间随文件大小可能达数十分钟以上,请耐心等候
-                            <hr>
+                    </div>
+                    <div class="form-group row">
+                        <div class="col-8 offset-2">
+                            <button type="button" class="btn form-control btn-primary"  @click="showPasteDataModal">文本导入</button>
                         </div>
                     </div>
+                    <hr/>
+                @endcan
+                <form action="{{url('order/issue/batchImport')}}" method="post" enctype="multipart/form-data" class="form"  target="_blank">
+                    @csrf
                     <div class="form-group row">
                         <label for="sku" class="col-2 col-form-label text-right">选择EXCEL</label>
                         <div class="col-8">
@@ -42,10 +60,106 @@
                 </form>
             </div>
         </div>
+        <div class="modal fade" id="pasteData" role="dialog" tabindex="-1" aria-labelledby="pasteDataTetlie" aria-hidden="true">
+            <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
+                <div class="modal-content">
+                    <div class="modal-header">
+                        <div class="row modal-title font-weight-bold w-100 text-nowrap ml-1 noselect" id="pasteDataTitle">
+                            <span v-for="(row,i) in rows" draggable="true"
+                                  @drop="drop($event,i)" @dragover="dragover($event)" @dragstart="dragstart($event,i)"
+                                  class="col-4 border" style="cursor: move"
+                                  :class="requiredRows.includes(row)?'text-danger':''">@{{ row }}</span>
+                        </div>
+                    </div>
+                    <div class="modal-body text-center">
+                        <button type="button" id="popover" class="btn btn-danger" v-if="popoverContent"
+                                data-container="body" data-toggle="popover" data-placement="bottom"
+                                :data-content="popoverContent" data-html="true">
+                            部分数据导入失败
+                        </button>
+                        <textarea id="pasteDataText" class="w-100" style="height: 400px" v-model="pasteDataText"
+                                  @keydown.tab="forbidTab($event)" @keyup.tab="replaceSpacing()"
+                                  placeholder="内容可为EXCEL复制,也可手动输入使用“TAB”缩进符区分列,请注意表头顺序,可拖拽表头字段调整顺序,以该顺序为准"></textarea>
+                    </div>
+                    <div class="modal-footer">
+                        <button class="btn btn-primary" @click="importPasteData">开始导入</button>
+                    </div>
+                </div>
+            </div>
+        </div>
     </div>
 @endsection
 
 @section('lastScript')
+    <script>
+        let listVue = new Vue({
+            el:'#issue_import_div',
+            data:{
+                rows:['原始运单号','情况说明','问题类别'],
+                requiredRows:['原始运单号','情况说明','问题类别'],
+                popoverContent:'',
+                pasteDataText: '',
+            },
+            mounted:function(){
+                $('[data-toggle="popover"]').popover();
+            },
+            methods:{
+                showPasteDataModal(){
+                    $('#popover').attr('hidden','hidden')
+                    $('#pasteData').modal('show')
+                },
+                drop(e,index){
+                    e.preventDefault();
+                    if (this.dom !== e.target.innerHTML){
+                        this.dom.innerHTML = e.target.innerHTML;
+                        let temp=JSON.parse(JSON.stringify(this.rows[index]));
+                        this.$set(this.rows,index,this.rows[e.dataTransfer.getData('text/html')]);
+                        this.$set(this.rows,Number(e.dataTransfer.getData('text/html')),temp);
+                    }
+                },
+                dragover(e){
+                    e.preventDefault();
+                },
+                dragstart(e,index){
+                    this.dom = e.target.innerHTML;
+                    e.dataTransfer.setData("text/html",index);
+                },
+                importPasteData(){
+                    if(!this.pasteDataText){
+                        tempTip.setDuration(2000)
+                        tempTip.show('导入文本不能为空')
+                    }
+                    let _this = this
+                    let data = {rows:this.rows,pasteDataText:this.pasteDataText}
+                    axios.post('{{url('apiLocal/order/issue/importPasteData')}}',data).then(function (response) {
+                        if(response.data.success){
+                            $('#pasteData').modal('hide')
+                            tempTip.setDuration(2000)
+                            tempTip.showSuccess('导入完毕')
+                        }else{
+                            let content = '';
+                            for (const key in response.data.fail_info) {
+                                content+=key+':'+response.data.fail_info[key] + "</br>"
+                            }
+                            _this.popoverContent = content
+                            setTimeout(function () {
+                                $("#popover").removeAttr('hidden').popover('show')
+                            },1);
+                        }
+                    }).catch(function(error){
+                        tempTip.setDuration(2000)
+                        tempTip.show('导入失败'+error)
+                    })
+                },
+                forbidTab(e){
+                    e.preventDefault();
+                },
+                replaceSpacing(){
+                    this.pasteDataText += "\t";
+                },
 
+            }
+        });
+    </script>
 @endsection
 

+ 23 - 10
resources/views/order/issue/index.blade.php

@@ -118,6 +118,7 @@
                             <th class="three-layer  align-middle" rowspan="2" v-if="isShowSecondOrderInfo" style=" min-width: 200px;">二次运单号</th>
                             <th class="three-layer" colspan="3" style="min-width: 300px" v-if="isShowSecondOrderInfo" style=" min-width: 350px;">二次商品明细</th>
                         @endcannot
+                        <th class="three-layer  align-middle" rowspan="2" style="min-width: 120px">自定义订单号</th>
                         @cannot('订单管理-问题件-客户不可见')
                             <th class="three-layer  align-middle" rowspan="2" style="min-width: 120px">承运商赔偿金额</th>
                             <th class="three-layer  align-middle" rowspan="2" style="min-width: 120px">承运商快递减免</th>
@@ -283,7 +284,7 @@
                         </td>
 
                         <td class="p-0 m-0 child-layer-3" 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>
+                            <span class="btn btn-outline-secondary"  @click="showRejectedBill"  :style="orderIssues.length>4 ?'{height: 200px;line-height: 100px':''" >展开退单列</span>
                         </td>
 
                         <td class="p-0 child-layer-3-hide" :id="orderIssue.id+'rejectedBill'" valign="middle" align="center" colspan="5" v-if="isShowRejectedBill">
@@ -309,7 +310,13 @@
                             </div>
                         </td>
 
-                        <td class="child-layer-3">@{{ orderIssue.result_explain}}</td>
+                        <td class="child-layer-3">
+                            @can('订单管理-问题件-编辑')
+                            <textarea class="form-control form-control-sm"  @change="updateOrderIssue(orderIssue,'result_explain',$event)" data-toggle="tooltip" data-placement="bottom" :title="orderIssue.result_explain">@{{ orderIssue.result_explain }}</textarea>
+                            @else
+                            @{{ orderIssue.result_explain}}
+                            @endcan
+                        </td>
                         <td class="child-layer-3">
                             @can('订单管理-问题件-编辑')
                                 <select class="form-control form-control-sm" :value="orderIssue.order_issue_type_id" @change="updateOrderIssue(orderIssue,'order_issue_type_id',$event)">
@@ -396,7 +403,7 @@
                                     </div>
                                 </div>
 
-                                <template v-if="orderIssue.second_order !== null">
+                                <div v-if="orderIssue.second_order !== null">
                                     <div class="text-center m-0" :id="'secondOrderNumbers'+orderIssue.id"
                                          :class="orderIssue.seconderCount > 1 ? 'collapse':''"
                                          :data-value="orderIssue.seconderCount = 0">
@@ -411,7 +418,10 @@
                                             @click="toggleseCondOrderNumbers(orderIssue.id,orderIssue.second_order.logisticNumbers.length)">
                                         分箱@{{ orderIssue.second_order.logisticNumbers.length }}件,点击展开
                                     </button>
-                                </template>
+                                </div>
+                                <div v-else-if="orderIssue.second_order === null">
+                                    @{{orderIssue.second_logistic_number}}
+                                </div>
                             </td>
                             <td class="child-layer-3-hide p-0" colspan="3" v-if="isShowSecondOrderInfo">
                                 <template v-if="orderIssue.second_order!==null" class=" p-0">
@@ -442,6 +452,9 @@
                                 </template>
                             </td>
                         @endcannot
+                        <td class="child-layer-3">
+                            <input type="text" class="form-control form-control-sm" :value="orderIssue.custom_code" @change="updateOrderIssue(orderIssue,'custom_code',$event)">
+                        </td>
                         @cannot('订单管理-问题件-客户不可见')
                             <td class="child-layer-3">
                                 @can('订单管理-问题件-编辑')
@@ -695,7 +708,7 @@
                 let tr = $('.tr-yellow')[1];
                 let countShow = $(tr).children('.one-layer').length;
                 $('.header-1').attr('colspan',countShow);
-
+                $('[data-toggle="tooltip"]').tooltip({'trigger': 'hover'})
                 $('#list').removeClass("d-none");
                 let _this = this;
                 let log_content_range = [{name:'15',value:'15天内'},{name:'31',value:'近一月'},{name:'92',value:'近三月'},{name:'183',value:'近半年'},{name:'366',value:'近一年'},{name:'0',value:'不限'},];
@@ -1360,17 +1373,17 @@
                     let logisticNumber = $('#secondLogisticNumber-'+orderIssue.id).val()
                     let data = {id:orderIssue.id,logistic_number:logisticNumber,client_code:orderIssue.second_client_no}
                     let _this = this;
-                    axios.post('{{url('apiLocal/order/issue/secondOrderAddOrderPackage')}}',data).then(function(response){
+                    axios.post('{{url('apiLocal/order/issue/editSecondLogisticNumber')}}',data).then(function(response){
                         if(response.data.success){
                             tempTip.setDuration(2000)
                             tempTip.showSuccess('添加成功')
-                            if(orderIssue.second_order == null){
+                            if(response.data.order != null){
                                 orderIssue.second_order = response.data.order
+                                orderIssue.second_client_no = response.data.order.client_code
                             }
-                            if(orderIssue.second_order.packages==null){
-                                orderIssue.second_order.packages = []
+                            if(response.data.second_logistic_number != null){
+                                orderIssue.second_logistic_number = response.data.second_logistic_number
                             }
-                            orderIssue.second_order.packages.push(response.data.orderPackage);
                             _this.edit.orderIssue.id = ''
                             _this.edit.orderIssue.showId = ''
                         }else{

+ 1 - 0
resources/views/store/checkingReceive/mission.blade.php

@@ -138,6 +138,7 @@
                     el: "#header",
                     column: column,
                     data: _this.storeCheckingReceives,
+                    fixedTop:($('#form_div').height())+2,
                     restorationColumn: 'id',
                 });
                 header.init();

+ 7 - 1
resources/views/store/fast/create.blade.php

@@ -19,6 +19,12 @@
                     @csrf
                     <div class="resource" v-for="num in sum">
 
+                        <div class="form-group row">
+                            <div class="custom-control custom-checkbox offset-4">
+                                <input type="checkbox" class="custom-control-input" id="test" name="test">
+                                <label class="custom-control-label text-primary" for="test">跳过FLUX接口快速入库</label>
+                            </div>
+                        </div>
                         <div class="form-group row">
                             <label for="asn_code" class="col-2 col-form-label text-right">ASN编号</label>
                             <div class="col-8">
@@ -34,7 +40,7 @@
                         <div class="form-group row">
                             <label for="quality" class="col-2 col-form-label text-right">质量</label>
                             <div class="col-8 form-inline">
-                                <select name="quality" class="form-control @error('quality') is-invalid @enderror"  style="width: 30%;">
+                                <select id="quality" name="quality" class="form-control @error('quality') is-invalid @enderror"  style="width: 30%;">
                                     <option value="正品">正品</option>
                                     <option value="残次">残次</option>
                                 </select>

+ 2 - 1
routes/apiLocal.php

@@ -49,7 +49,8 @@ Route::group(['prefix' => 'order'], function () {
         Route::post('updateLogisticNumberReturn','OrderIssueController@updateLogisticNumberReturnApi');
         Route::post('editSecondClientNo','OrderIssueController@editSecondClientNoApi');
         Route::post('endOrderIssues','OrderIssueController@endOrderIssuesApi');
-        Route::post('secondOrderAddOrderPackage','OrderIssueController@secondOrderAddOrderPackageApi');
+        Route::post('editSecondLogisticNumber','OrderIssueController@editSecondLogisticNumberApi');
+        Route::post('importPasteData','OrderIssueController@importPasteDataApi');
 
          Route::group(['prefix'=>'onTop'],function(){
             Route::post('/store', 'OrderIssueOnTopController@apiStore');

+ 4 - 0
routes/web.php

@@ -78,6 +78,7 @@ Route::group(['prefix'=>'maintenance'],function(){
         Route::get('cities/{province_id}','WaybillPriceModelsController@getCities');
     });
 
+    Route::get('syncRedisLogs','LogController@syncRedisLogs');
     Route::resource('log', 'LogController');
     Route::resource('user', 'UserController');
     Route::resource('role', 'RoleController');
@@ -462,6 +463,9 @@ Route::group(['prefix'=>'customer'],function(){
     /** 项目 */
     Route::group(['prefix'=>'project'],function(){
         Route::get('report','CustomerController@projectReport');
+        Route::get('index','CustomerController@projectIndex');
+        Route::get('create','CustomerController@projectCreate');
+        Route::get('area','CustomerController@projectArea');
     });
     Route::get('relating',function (){return view('customer.relating');});
 });

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio