Pārlūkot izejas kodu

Merge branch 'master' into Haozi

# Conflicts:
#	app/Http/Controllers/TestController.php
haozi 5 gadi atpakaļ
vecāks
revīzija
88b504da27
42 mainītis faili ar 1197 papildinājumiem un 488 dzēšanām
  1. 1 1
      app/Console/Commands/MakeServiceCommand.php
  2. 11 1
      app/Customer.php
  3. 27 0
      app/CustomerLog.php
  4. 11 0
      app/CustomerLogStatus.php
  5. 13 5
      app/Http/Controllers/CustomerBaseController.php
  6. 60 0
      app/Http/Controllers/CustomerLogStatusesController.php
  7. 69 0
      app/Http/Controllers/CustomerLogsController.php
  8. 2 1
      app/Http/Controllers/StoreController.php
  9. 248 413
      app/Http/Controllers/TestController.php
  10. 2 1
      app/Http/Controllers/api/thirdPart/jianshang/RejectedController.php
  11. 59 17
      app/Imports/UpdatePickZone.php
  12. 27 0
      app/Policies/CustomerLogPolice.php
  13. 23 0
      app/Policies/CustomerLogStatusesPolice.php
  14. 8 0
      app/Providers/AuthServiceProvider.php
  15. 3 3
      app/Services/CustomerService.php
  16. 5 2
      app/Services/OrderService.php
  17. 1 1
      app/Services/OwnerService.php
  18. 23 0
      database/factories/CustomerLogFactory.php
  19. 12 0
      database/factories/CustomerLogStatusFactory.php
  20. 25 0
      database/migrations/2020_12_14_101617_create_customerlogs_table.php
  21. 23 0
      database/migrations/2020_12_14_103401_create_customerlogstatuses_table.php
  22. 38 0
      database/migrations/2020_12_15_095959_add_customer_phone_address.php
  23. 20 0
      database/seeds/CustomerLogStatusesTableSeeder.php
  24. 20 0
      database/seeds/CustomerLogsTableSeeder.php
  25. 10 0
      resources/views/common/error.blade.php
  26. 28 3
      resources/views/customer/customer/create.blade.php
  27. 22 16
      resources/views/customer/customer/index.blade.php
  28. 19 0
      resources/views/customer/customer/menu.blade.php
  29. 52 0
      resources/views/customer/customer_log_statuses/create_and_edit.blade.php
  30. 64 0
      resources/views/customer/customer_log_statuses/index.blade.php
  31. 41 0
      resources/views/customer/customer_log_statuses/show.blade.php
  32. 68 0
      resources/views/customer/customer_logs/create_and_edit.blade.php
  33. 69 0
      resources/views/customer/customer_logs/index.blade.php
  34. 59 0
      resources/views/customer/customer_logs/show.blade.php
  35. 3 0
      resources/views/customer/menu.blade.php
  36. 0 15
      resources/views/maintenance/customer/menu.blade.php
  37. 0 4
      resources/views/maintenance/menu.blade.php
  38. 2 2
      resources/views/maintenance/priceModel/logistic/index.blade.php
  39. 1 1
      resources/views/order/index/delivering.blade.php
  40. 1 1
      resources/views/rejected/search/general.blade.php
  41. 6 1
      routes/web.php
  42. 21 0
      tests/Unit/CustomerLogTest.php

+ 1 - 1
app/Console/Commands/MakeServiceCommand.php

@@ -45,6 +45,6 @@ class MakeServiceCommand extends Command
             file_put_contents(base_path('app\\Services\\'.$fileName.'.php'),
                 '<?php '.PHP_EOL.PHP_EOL.'namespace App\Services; '.PHP_EOL.PHP_EOL.'Class '.$fileName.PHP_EOL.'{ '.PHP_EOL.PHP_EOL.PHP_EOL.'}');
         }
-        else echo $this->error("ERROR: file exists;");
+        else $this->error("ERROR: file exists;");
     }
 }

+ 11 - 1
app/Customer.php

@@ -3,12 +3,22 @@
 namespace App;
 
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\HasMany;
 
 class Customer extends Model
 {
     protected $fillable = [
         "code",         //客户代码
         "name",         //客户名称
-        "company_name"  //公司名称
+        "company_name",  //公司名称
+        "invoice_address",  //公司名称
+        "contact_man",  //公司名称
+        "phone",  //公司名称
+        "comment",  //公司名称
     ];
+
+    public function customerLogs(): HasMany
+    {
+        return $this->hasMany(CustomerLog::class,'customer_id','id');
+    }
 }

+ 27 - 0
app/CustomerLog.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
+
+class CustomerLog extends Model
+{
+    protected $fillable = ['customer_id', 'customer_log_status_id', 'user_id', 'description'];
+    protected $guarded = ['id'];
+
+    public function customerLogStatus(): BelongsTo
+    {
+        return $this->belongsTo(CustomerLogStatus::class);
+    }
+
+    public function user(): BelongsTo
+    {
+        return $this->belongsTo(User::class);
+    }
+
+    public function customer(): BelongsTo
+    {
+        return $this->belongsTo(Customer::class);
+    }
+}

+ 11 - 0
app/CustomerLogStatus.php

@@ -0,0 +1,11 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class CustomerLogStatus extends Model
+{
+    protected $fillable = ['name', 'description'];
+    protected $guarded = ['id'];
+}

+ 13 - 5
app/Http/Controllers/CustomerBaseController.php

@@ -19,7 +19,7 @@ class CustomerBaseController extends Controller
     {
         if(!Gate::allows('客户-查询')){ return redirect('denied');  }
         $customers = app('CustomerService')->paginate();
-        return response()->view('maintenance.customer.index',compact("customers"));
+        return response()->view('customer.customer.index',compact("customers"));
     }
 
     /**
@@ -30,7 +30,7 @@ class CustomerBaseController extends Controller
     public function create()
     {
         if(!Gate::allows('客户-录入')){ return redirect('denied');  }
-        return response()->view('maintenance.customer.create');
+        return response()->view('customer.customer.create');
     }
 
     /**
@@ -47,9 +47,13 @@ class CustomerBaseController extends Controller
             "code"=>$request->input("code"),
             "name"=>$request->input("name"),
             "company_name"=>$request->input("company_name"),
+            "invoice_address"=>$request->input("invoice_address"),
+            "contact_man"=>$request->input("contact_man"),
+            "phone"=>$request->input("phone"),
+            "comment"=>$request->input("comment"),
         ]);
         LogService::log(__METHOD__,"录入客户",json_encode($request->input(),JSON_UNESCAPED_UNICODE));
-        return response()->redirectTo("maintenance/customer")->with("successTip","成功创建客户“".$request->input("name")."”");
+        return response()->redirectTo("customer/customer")->with("successTip","成功创建客户“".$request->input("name")."”");
     }
 
     /**
@@ -62,7 +66,7 @@ class CustomerBaseController extends Controller
     {
         if(!Gate::allows('客户-编辑')){ return redirect('denied');  }
         $customer = app('CustomerService')->find($id);
-        return response()->view('maintenance.customer.create',compact("customer"));
+        return response()->view('customer.customer.create',compact("customer"));
     }
 
     /**
@@ -80,10 +84,14 @@ class CustomerBaseController extends Controller
             "code"=>$request->input("code"),
             "name"=>$request->input("name"),
             "company_name"=>$request->input("company_name"),
+            "invoice_address"=>$request->input("invoice_address"),
+            "contact_man"=>$request->input("contact_man"),
+            "phone"=>$request->input("phone"),
+            "comment"=>$request->input("comment"),
         ]);
         if ($result == 1){
             LogService::log(__METHOD__,"修改客户",json_encode($request->input(),JSON_UNESCAPED_UNICODE));
-            return response()->redirectTo("maintenance/customer")->with("successTip","成功修改客户“".$request->input("name")."”的信息");
+            return response()->redirectTo("customer/customer")->with("successTip","成功修改客户“".$request->input("name")."”的信息");
         }
         return response()->view("exception.default",["code"=>"509"]);
     }

+ 60 - 0
app/Http/Controllers/CustomerLogStatusesController.php

@@ -0,0 +1,60 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\CustomerLogStatus;
+use Illuminate\Http\RedirectResponse;
+use Illuminate\Http\Request;
+
+
+class CustomerLogStatusesController extends Controller
+{
+    public function __construct()
+    {
+        $this->middleware('auth');
+    }
+
+    public function index()
+    {
+        $customer_log_statuses = CustomerLogStatus::paginate();
+        return view('customer.customer_log_statuses.index', compact('customer_log_statuses'));
+    }
+
+    public function show(CustomerLogStatus $customer_log_status)
+    {
+        return view('customer.customer_log_statuses.show', compact('customer_log_status'));
+    }
+
+    public function create(CustomerLogStatus $customer_log_status)
+    {
+        return view('customer.customer_log_statuses.create_and_edit', compact('customer_log_status'));
+    }
+
+    public function store(Request $request): RedirectResponse
+    {
+        $customer_log_status = CustomerLogStatus::create($request->all());
+        return redirect()->route('customer_log_statuses.show', $customer_log_status->id)->with('message', 'Created successfully.');
+    }
+
+    public function edit(CustomerLogStatus $customer_log_status)
+    {
+        $this->authorize('update', $customer_log_status);
+        return view('customer.customer_log_statuses.create_and_edit', compact('customer_log_status'));
+    }
+
+    public function update(Request $request, CustomerLogStatus $customer_log_status)
+    {
+        $this->authorize('update', $customer_log_status);
+        $customer_log_status->update($request->all());
+
+        return redirect()->route('customer_log_statuses.show', $customer_log_status->id)->with('message', 'Updated successfully.');
+    }
+
+    public function destroy(CustomerLogStatus $customer_log_status)
+    {
+        $this->authorize('destroy', $customer_log_status);
+        $customer_log_status->delete();
+
+        return redirect()->route('customer_log_statuses.index')->with('message', 'Deleted successfully.');
+    }
+}

+ 69 - 0
app/Http/Controllers/CustomerLogsController.php

@@ -0,0 +1,69 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Customer;
+use App\CustomerLog;
+use App\CustomerLogStatus;
+use Illuminate\Http\RedirectResponse;
+use Illuminate\Http\Request;
+
+class CustomerLogsController extends Controller
+{
+    public function __construct()
+    {
+        $this->middleware('auth');
+    }
+
+    public function index(Request $request)
+    {
+        $customer_logs = CustomerLog::query()->with(['customerLogStatus', 'user', 'customer'])->where('id',$request->id) ->orderByDesc('updated_at')->paginate();
+        return view('customer.customer_logs.index', compact('customer_logs'));
+    }
+
+    public function show($customer_log_id)
+    {
+        $customer_log =CustomerLog::query()->with(['customerLogStatus', 'user', 'customer'])->where('id',$customer_log_id)->first();
+        return view('customer.customer_logs.show', compact('customer_log'));
+    }
+
+    public function create(CustomerLog $customer_log)
+    {
+        $customers = Customer::all();
+        $customerLogStatuses = CustomerLogStatus::all();
+        return view('customer.customer_logs.create_and_edit', compact('customer_log', 'customers', 'customerLogStatuses'));
+    }
+
+    public function store(Request $request): RedirectResponse
+    {
+        $data = [];
+        $data = $request->all();
+        $data['user_id'] = auth()->id();
+        $customer_log = CustomerLog::create($data);
+        return redirect()->route('customer_logs.show', $customer_log->id)->with('message', 'Created successfully.');
+    }
+
+    public function edit(CustomerLog $customer_log)
+    {
+        $this->authorize('update', $customer_log);
+        $customers = Customer::all();
+        $customerLogStatuses = CustomerLogStatus::all();
+        return view('customer.customer_logs.create_and_edit', compact('customer_log', 'customers', 'customerLogStatuses'));
+    }
+
+    public function update(Request $request, CustomerLog $customer_log)
+    {
+        $this->authorize('update', $customer_log);
+        $customer_log->update($request->all());
+
+        return redirect()->route('customer_logs.show', $customer_log->id)->with('message', 'Updated successfully.');
+    }
+
+    public function destroy(CustomerLog $customer_log)
+    {
+        $this->authorize('destroy', $customer_log);
+        $customer_log->delete();
+
+        return redirect()->route('customer_logs.index')->with('message', 'Deleted successfully.');
+    }
+}

+ 2 - 1
app/Http/Controllers/StoreController.php

@@ -246,10 +246,11 @@ class StoreController extends Controller
             'remark'=>$asn->notes,
         ]);
         app('LogService')->log(__METHOD__,"快速入库",json_encode($store));
-        foreach ($items as $item){
+        foreach ($items as &$item){
             $item["store_id"] = $store->id;
         }
         app('StoreItemService')->insert($items);
+        app('LogService')->log(__METHOD__,"快速录入子项",json_encode($items));
         return ['success'=>true,"data"=>"已成功将“".$asnno."”入库"];
     }
 

+ 248 - 413
app/Http/Controllers/TestController.php

@@ -35,7 +35,6 @@ use App\ProcessStatistic;
 use App\RejectedBill;
 use App\RejectedBillItem;
 use App\Services\CacheService;
-use App\Services\CommodityService;
 use App\Services\common\BatchUpdateService;
 use App\Services\common\DataHandlerService;
 use App\Services\DocWaveHeaderService;
@@ -53,23 +52,18 @@ use App\Services\OwnerService;
 use App\Services\ShopService;
 use App\Services\StoreService;
 use App\Services\WarehouseService;
-use App\Store;
 use App\StoreCheckingReceiveItem;
-use App\StoreItems;
 use App\User;
 use App\ValueStore;
 use App\Warehouse;
 use App\Waybill;
 use App\WaybillPriceModel;
 use Carbon\Carbon;
-use Exception;
-use GuzzleHttp\Client;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Cache;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\DB;
-use Illuminate\Support\Facades\Http;
 use Illuminate\Support\Str;
 use Maatwebsite\Excel\Facades\Excel;
 use Ramsey\Collection\Collection;
@@ -89,110 +83,53 @@ class TestController extends Controller
     {
         return call_user_func([$this, $method], $request);
     }
-
-    public function updateInventory()
-    {
-        $inventoryAccounts = InventoryAccount::query()->get();
+    public function updateInventory(){
+        $inventoryAccounts=InventoryAccount::query()->get();
         $updateParams = [[
-            'id', 'processed', 'ignored', 'updated_at'
+            'id','processed','ignored','updated_at'
         ]];
-        $updated_at = Carbon::now()->toDateTimeString();
-        foreach ($inventoryAccounts as $inventoryAccount) {
-            if ($inventoryAccount->getIgnoredAmount() > 0) {
+        $updated_at=Carbon::now()->toDateTimeString();
+        foreach ($inventoryAccounts as $inventoryAccount){
+            if ($inventoryAccount->getIgnoredAmount()>0){
                 $updateParams[] = [
-                    'id' => $inventoryAccount->id,
-                    'processed' => $inventoryAccount->getProcessedAmount(),
+                    'id'=>$inventoryAccount->id,
+                    'processed'=>$inventoryAccount->getProcessedAmount(),
                     'ignored' => $inventoryAccount->getIgnoredAmount(),
-                    'updated_at' => $updated_at,
+                    'updated_at'=>$updated_at,
                 ];
             }
         }
-        if (count($updateParams) > 1) {
-            app(BatchUpdateService::class)->batchUpdate('inventory_accounts', $updateParams);
+        if(count($updateParams) > 1){
+            app(BatchUpdateService::class)->batchUpdate('inventory_accounts',$updateParams);
         }
     }
-    public function zui(){
-        $a = new \Illuminate\Support\Collection(["a"=>"b"]);
-        foreach ($a as $i=>$l)dump($i,$l);
-    }
     public function zzd()
     {
-        $post=Http::post("http://localhost:9722",["type"=>"base","format"=>[
-            "method"=>"warpText",
-            "mergeColumn"=>["column"],
-            "mergeRow"=>["row"=>"row"],
-            "datum"=>"datum",
-        ],"connection"=>[
-            "driver"=>"mysql",
-            "host"=>"host",
-            "port"=>"port",
-            "database"=>"databse",
-            "username"=>"username",
-            "password"=>"password",
-            "charset"=>"char",
-            "parsetime"=>"pars",
-            "sid"=>"",
-        ],"data"=>[
-            "row"=>["sql-row"],
-            "list"=>[["sql-list"]],
-            "sql"=>"sql",
-            "rule"=>["sql"=>"rule"],
-        ],"path"=>[
-            "log"=>"log",
-            "file"=>""
-        ]]);
-        $http = new Client();
-        $response = $http->get("http://localhost:9722", ["type"=>"base","format"=>[
-            "method"=>"warpText",
-            "mergeColumn"=>["column"],
-            "mergeRow"=>["row"=>"row"],
-            "datum"=>"datum",
-        ],"connection"=>[
-            "driver"=>"mysql",
-            "host"=>"host",
-            "port"=>"port",
-            "database"=>"databse",
-            "username"=>"username",
-            "password"=>"password",
-            "charset"=>"char",
-            "parsetime"=>"pars",
-            "sid"=>"",
-        ],"data"=>[
-            "row"=>["sql-row"],
-            "list"=>[["sql-list"]],
-            "sql"=>"sql",
-            "rule"=>["sql"=>"rule"],
-        ],"path"=>[
-            "log"=>"log",
-            "file"=>""
-        ]]);
-        if ($response->getStatusCode() == 500){
-            throw new \Exception($response->getHeader("Msg"));
+        $items = [];
+        $test = ["123","456","789"];
+        foreach ($test as $t){
+            $item = ["a"=>$t."-"];
+            $items[] = $item;
         }
-        return \response($response,200, [
-            "Content-type"=>"application/octet-stream",
-            "Content-Disposition"=>"attachment; filename=测试.xlsx",
-        ]);
-
-        if ($post->status() == 500){
-            throw new Exception($post->header("Msg"));
+        foreach ($items as &$item){
+            $item["b"] = "-555";
         }
-        $test = "test";
-        return response($response->get,200, [
-            "Content-type"=>"application/octet-stream",
-            "Content-Disposition"=>"attachment; filename=".$test."-".date('ymdHis').'.xlsx',
-        ]);
+        $a = [1,2,3];
+        foreach ($a as &$item){
+            dump($item);
+        }
+        dd($item);
     }
 
     public function mergeCarrier(){
         $carriers = Carrier::query()->get();
         $logistics = [];
         $map = [];
-        foreach ($carriers as $carrier) {
+        foreach ($carriers as $carrier){
             $map[$carrier->name] = $carrier->id;
-            $lo = Logistic::query()->where("name", $carrier->name)->first();
-            if ($lo) {
-                if ($lo->type == '快递') {
+            $lo = Logistic::query()->where("name",$carrier->name)->first();
+            if ($lo){
+                if ($lo->type == '快递'){
 //                    $lo->update(["type"=>"全部"]);$lo->save();
                 }
                 continue;
@@ -200,78 +137,52 @@ class TestController extends Controller
             $logistics[] = [
                 "name" => $carrier->name,
                 'mobile' => $carrier->mobile,
-                'delivery_fee' => $carrier->delivery_fee,
-                'remark' => $carrier->remark,
+                'delivery_fee'=> $carrier->delivery_fee,
+                'remark'=> $carrier->remark,
                 "type" => "物流"
             ];
         }
         Logistic::query()->insert($logistics);
-        $ls = Logistic::query()->where("type", "物流")->get();
+        $ls = Logistic::query()->where("type","物流")->get();
         $result = [];
-        foreach ($ls as $l) {
-            if (isset($map[$l->name])) $result[$map[$l->name]] = $l->id;
+        foreach ($ls as $l)
+        {
+            if (isset($map[$l->name]))$result[$map[$l->name]] = $l->id;
         }
-        LogService::log(__METHOD__, "同步承运商", json_encode($result));
-        foreach ($result as $tag => $val) {
-            Waybill::query()->where("logistic_id", $tag)->update([
+        LogService::log(__METHOD__,"同步承运商",json_encode($result));
+        foreach ($result as $tag => $val){
+            Waybill::query()->where("logistic_id",$tag)->update([
                 "logistic_id" => $val
             ]);
-            WaybillPriceModel::query()->where("logistic_id", $tag)->update([
+            WaybillPriceModel::query()->where("logistic_id",$tag)->update([
                 "logistic_id" => $val
             ]);
-            DB::table("logistic_user")->where("logistic_id", $tag)->update([
+            DB::table("logistic_user")->where("logistic_id",$tag)->update([
                 "logistic_id" => $val
             ]);
         }
     }
-
-    public function test4()
-    {
-        $arr = [['id' => 3], ['id' => 33],];
-        dd(data_get($arr, '*.id'));
-    }
-
-    public function t($a)
-    {
-        $r = new \ReflectionClass('App\Http\Controllers\UnitsController');
-        dd($r->getMethods(), $r->getConstants());
-    }
-
     public function updateLaborRemark(){
         $laborReports=LaborReport::query()->with(['remarks'=>function($query){
             return $query->whereNotNull('mark');
         }])->get();
         $updateParams = [[
-            'id', 'remark', 'updated_at'
+            'id','remark','updated_at'
         ]];
-        $updated_at = Carbon::now()->toDateTimeString();
-        foreach ($laborReports as $laborReport) {
-            if ($laborReport->remarks) {
+        $updated_at=Carbon::now()->toDateTimeString();
+        foreach ($laborReports as $laborReport){
+            if ($laborReport->remarks){
                 $updateParams[] = [
-                    'id' => $laborReport->id,
-                    'remark' => $laborReport->remarks->mark,
-                    'updated_at' => $updated_at,
+                    'id'=>$laborReport->id,
+                    'remark'=>$laborReport->remarks->mark,
+                    'updated_at'=>$updated_at,
                 ];
             }
         }
-        if (count($updateParams) > 1) {
-            app(BatchUpdateService::class)->batchUpdate('labor_reports', $updateParams);
+        if(count($updateParams) > 1){
+            app(BatchUpdateService::class)->batchUpdate('labor_reports',$updateParams);
         }
     }
-    public function test2(){
-        $b = Logistic::query()->first();
-        $a = OrderPackage::query()->with("order")->first();
-        $a->bulk = 521;
-        $a->save();
-        if (!$a->order) $a->order = new Order();
-        dd($a);
-        if (!$a->order->logistic)$a->order->logistic = $b;
-        dd($a->order->logistic);
-        dd($a);
-        $a->save();
-        dd($a);
-    }
-
     function packageFromLog(Request $request)
     { //x        $packagesBatch=Package::where('batch_number',$batch_number)->first();
         ini_set('max_execution_time', 2500);
@@ -298,15 +209,6 @@ class TestController extends Controller
         });
         dd($uploaded . '/' . $count);
     }
-
-    function wmsSql()
-    {
-        $owner = Owner::first();
-//        $owner['phone_number'] ?? $owner['phone_number'] = '31115';
-//        $owner->update();
-        dd($owner);
-    }
-
     function issues()
     {
         /** @var OrderPackageService $orderPackageService */
@@ -321,9 +223,8 @@ class TestController extends Controller
     }
     function tlog(Request $request)
     {
-        app('LogService')->log(__METHOD__, 'cczdelme' . __FUNCTION__, json_encode($request->all()), null);
+        app('LogService')->log(__METHOD__,'cczdelme'.__FUNCTION__,json_encode($request->all()),null);
     }
-
     function setCache(Request $request)
     {
         $today = now();
@@ -404,29 +305,6 @@ class TestController extends Controller
         }
     }
 
-    public function delme()
-    {
-        $fields = [
-            'doc_order_header.userdefine1',
-            'doc_order_header.userdefine2',
-            'doc_order_header.SOReference5',
-            'doc_order_header.waveno',
-            'doc_order_header.orderno',
-            'doc_order_header.customerid',
-            'doc_order_header.Consigneename'
-        ];
-        if ('') {
-            $resultOracleObj = OracleDOCOrderHeader::select($fields)->where('orderno', 'SO200603004708');
-        } else {
-            $resultOracleObj = OracleActAllocationDetails::select($fields);
-            $resultOracleObj->where('picktotraceid', '546152742096');
-            $resultOracleObj->leftJoin('DOC_Order_Header', 'act_allocation_details.orderno', 'doc_order_header.orderno');
-        }
-        $_temOracleInfo = $resultOracleObj->first();
-
-        dd($_temOracleInfo);
-    }
-
     public function mergerPackageData()
     {
         ini_set('max_execution_time', 36000);
@@ -657,57 +535,56 @@ class TestController extends Controller
         }
     }
 
-    public function test5()
-    {
-        ini_set('max_execution_time', 2500);
-        ini_set('memory_limit', '1526M');
+    public function test5(){
+        ini_set('max_execution_time',2500);
+        ini_set('memory_limit','1526M');
         //清理冗余条码
 //        $this->cleanBarcode();
 
-        while (true) {
+        while(true){
             $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');
+            $skus = array_column($skus,'sku');
 
-            $commodities = Commodity::query()->with('barcodes')->whereNotNull('owner_id')->whereIn('sku', $skus)->get();
+            $commodities = Commodity::query()->with('barcodes')->whereNotNull('owner_id')->whereIn('sku',$skus)->get();
 
 
-            if (count($commodities) < 1) return "SUCCESS";
+            if (count($commodities) < 1)return "SUCCESS";
             $commodityMap = [];
             $commodityDel = [];
             $commodityTag = [];
             $commodityBar = [];
             $createBarcodes = [];
             $logs = [];
-            foreach ($commodities as $commodity) {
-                if ($commodityMap[$commodity->sku . '_' . $commodity->owner_id] ?? false) {
-                    $codes = $commodity->barcodes ? array_column($commodity->barcodes->toArray(), 'code') : [];
+            foreach ($commodities as $commodity){
+                if ($commodityMap[$commodity->sku.'_'.$commodity->owner_id] ?? false){
+                    $codes = $commodity->barcodes ? array_column($commodity->barcodes->toArray(),'code') : [];
                     $logs[] = [
                         'id' => $commodity->id,
                         'sku' => $commodity->sku,
-                        'owner_id' => $commodity->owner_id,
-                        'code' => $codes,
+                        'owner_id'=>$commodity->owner_id,
+                        'code'=>$codes,
                     ];
                     $commodityDel[] = $commodity->id;
-                    $commodityTag[$commodity->id] = $commodityMap[$commodity->sku . '_' . $commodity->owner_id];
+                    $commodityTag[$commodity->id] = $commodityMap[$commodity->sku.'_'.$commodity->owner_id];
 
-                    $arr = array_diff($codes, $commodityBar[$commodity->sku . '_' . $commodity->owner_id]);
-                    foreach ($arr as $code) {
-                        if (!$code) continue;
+                    $arr = array_diff($codes,$commodityBar[$commodity->sku.'_'.$commodity->owner_id]);
+                    foreach ($arr as $code){
+                        if (!$code)continue;
                         $createBarcodes[] = [
                             'code' => $code,
-                            'commodity_id' => $commodityMap[$commodity->sku . '_' . $commodity->owner_id],
+                            'commodity_id' => $commodityMap[$commodity->sku.'_'.$commodity->owner_id],
                             'created_at' => $toDay,
                         ];
                     }
-                } else {
-                    $commodityMap[$commodity->sku . '_' . $commodity->owner_id] = $commodity->id;
-                    $commodityBar[$commodity->sku . '_' . $commodity->owner_id] = $commodity->barcodes ? array_column($commodity->barcodes->toArray(), 'code') : [];
+                }else{
+                    $commodityMap[$commodity->sku.'_'.$commodity->owner_id] = $commodity->id;
+                    $commodityBar[$commodity->sku.'_'.$commodity->owner_id] = $commodity->barcodes ? array_column($commodity->barcodes->toArray(),'code') : [];
                 }
             }
-            dd($commodityMap, $commodityDel, $commodityTag);
-            app('LogService')->log(__METHOD__, '清理商品', json_encode($logs, JSON_UNESCAPED_UNICODE));
-            app('LogService')->log(__METHOD__, '重新分配商品', json_encode($commodityTag, JSON_UNESCAPED_UNICODE));
+            dd($commodityMap,$commodityDel,$commodityTag);
+            app('LogService')->log(__METHOD__,'清理商品',json_encode($logs,JSON_UNESCAPED_UNICODE));
+            app('LogService')->log(__METHOD__,'重新分配商品',json_encode($commodityTag,JSON_UNESCAPED_UNICODE));
 
             app('InventoryAccountMissionService')->batchUpdateItself('commodity_id', $commodityTag);//批量更新库存盘点任务
             app('InventoryCompareService')->batchUpdateItself('commodity_id', $commodityTag);//批量更新库存对比
@@ -716,14 +593,13 @@ class TestController extends Controller
             app('StoreCheckingReceiveItemService')->batchUpdateItself('commodity_id', $commodityTag);//批量更新入库盘收一体
             app('OrderPackageCommoditiesService')->batchUpdateItself('commodity_id', $commodityTag);//批量更新订单商品
 
-            app('LogService')->log(__METHOD__, '删除商品与对应条码', json_encode($commodityDel, JSON_UNESCAPED_UNICODE));
-            CommodityBarcode::query()->whereIn('commodity_id', $commodityDel)->delete();
+            app('LogService')->log(__METHOD__,'删除商品与对应条码',json_encode($commodityDel,JSON_UNESCAPED_UNICODE));
+            CommodityBarcode::query()->whereIn('commodity_id',$commodityDel)->delete();
             Commodity::destroy($commodityDel);
         }
     }
 
-    private function cleanBarcode()
-    {
+    private function cleanBarcode(){
 
         $logCommodityBarcodes = CommodityBarcode::query()->where('code', "")->get();
         if (count($logCommodityBarcodes) > 0) app('LogService')->log(__METHOD__, "纠正商品-删除空条码", json_encode($logCommodityBarcodes, JSON_UNESCAPED_UNICODE));
@@ -744,31 +620,30 @@ where (c.code,c.commodity_id) in (select code,commodity_id from commodity_barcod
         CommodityBarcode::destroy($barcodeDelete);
     }
 
-    private function multiCodes()
-    {
+    private function multiCodes(){
 
-        $barcode = 'BG10B1014C002100';
-        $commodity = Commodity::whereHas('barcodes', function (Builder $query) use ($barcode) {
-            $query->where('code', $barcode);
-        })->where('owner_id', 4)->first();
+        $barcode='BG10B1014C002100';
+        $commodity=Commodity::whereHas('barcodes', function (Builder $query)use($barcode){
+            $query->where('code',$barcode);
+        })->where('owner_id',4)->first();
         $codes = $commodity->barcodes->map(function ($barcode) {
-            return $barcode->code ?? '';
+            return $barcode->code??'';
         });
-        foreach ($codes as $code) {
-            $commodity = Commodity::whereHas('barcodes', function (Builder $query) use ($barcode) {
-                $query->where('code', $barcode);
-            })->where('owner_id', 4)->get();
+        foreach($codes as $code){
+            $commodity=Commodity::whereHas('barcodes', function (Builder $query)use($barcode){
+                $query->where('code',$barcode);
+            })->where('owner_id',4)->get();
             dump($commodity);
         }
         die();
-        $commodityBuilder = Commodity::query();
-        $commodityBuilder->where('owner_id', 4)->first();
-        $commodityBuilder->whereHas('barcodes', function (Builder $query) use ($barcode, $codes) {
-            foreach ($codes as $code) {
-                $query->orWhere('code', $code);
-            }
-        });
-        dd($commodity, $codes, $commodityBuilder->get());
+        $commodityBuilder=Commodity::query();
+        $commodityBuilder->where('owner_id',4)->first();
+            $commodityBuilder->whereHas('barcodes', function (Builder $query)use($barcode,$codes){
+                foreach($codes as $code){
+                    $query->orWhere('code',$code);
+                }
+            });
+        dd($commodity, $codes,$commodityBuilder->get());
     }
 
     public function correctCommodity()
@@ -835,7 +710,7 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
             }
             $updateCommodities[$del->commodity_id] = $target->commodity_id;
         }
-        if (count($updateCommodities) > 0) {
+        if (count($updateCommodities) > 0){
             app('InventoryAccountMissionService')->batchUpdateItself('commodity_id', $updateCommodities);//批量更新库存盘点任务
             app('InventoryCompareService')->batchUpdateItself('commodity_id', $updateCommodities);//批量更新库存对比
             app('InventoryDailyLogService')->batchUpdateItself('commodity_id', $updateCommodities);//批量更新库存每日记录
@@ -914,50 +789,27 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
     }
 
 
-    public function test11()
-    {
-        $rejectedBills = RejectedBill::query()
-            ->where('created_at', '>=', '2020-11-10 18:00:22')
-            ->where('created_at', '<=', '2020-11-11 00:00:00')
-            ->get();
-        $update = [['id', 'logistic_number']];
-        $rejectedBills->each(function ($rejectedBill) use (&$update) {
-            if ($rejectedBill->logistic_number == '原单退回') {
-                $details = OracleActAllocationDetails::query()->with('oracleDocOrderHeader')->whereHas('oracleDocOrderHeader', function ($query) use ($rejectedBill) {
-                    $query->where('SOReference1', $rejectedBill->order_number);
-                })->get()->groupBy('picktotraceid');
-                if ($details->count() == 1) {
-                    $update[] = ['id' => $rejectedBill->id, 'logistic_number' => $rejectedBill->logistic_number_return];
-                }
-            }
-        });
-        app('RejectedBillService')->batchUpdate($update);
-    }
-
     public function output()
     {
         /** @var CacheService $cacheService */
         $cacheService = app('CacheService');
-        $authorities = $cacheService->getOrExecute('userxx', function () {
+        $authorities=$cacheService->getOrExecute('userxx',function (){
             return Authority::with('roles')->get();
         });
         dd($authorities);
     }
-
     public function output2()
     {
         dump(Cache::get('aa'));
         Cache::put('aa', '2223', 5);
     }
-
     public function usage()
     {
         dd(Request::all());
     }
-
     public function relating()
     {
-        dd(OrderIssue::query()->where('id', 182)->paginate()->total());
+        dd(OrderIssue::query()->where('id',182)->paginate()->total());
     }
 
     public function updateOrdersWarehouse()
@@ -973,11 +825,10 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
         $warehouse = Warehouse::query()->get();
         $warehouse_map = $dataHandlerService->dataHeader(['code'], $warehouse);
         for ($i = 0; $i < $count; $i += $page) {
-            $min = $i;
-            $max = $i + $page;
+            $min = $i;$max = $i + $page;
             $orders = Order::query()->where('id', '>=', $min)->where('id', '<=', $max)->get();
             $orderNos = array_diff(array_unique(data_get($orders, '*.code')), ['', ' ', '*', null]);
-            if (count($orderNos) == 0) continue;
+            if (count($orderNos)==0) continue;
             /** @var Collection $orderHeaders */
             $orderHeaders = OracleDOCOrderHeader::query()->whereIn('orderno', $orderNos)->get();
             if ($orderHeaders->count() == 0) continue;
@@ -1003,57 +854,54 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
     public function syncSendOrder()
     {
         $order_issues = OrderIssue::query()->whereNotNull('second_client_no')->get();
-        $client_nos = data_get($order_issues, '*.second_client_no');
-        $orderHeaders = OracleDOCOrderHeader::query()->selectRaw(implode(',', OracleDOCOrderHeaderService::$columns))
-            ->whereIn('SOReference1', $client_nos)
-            ->with(['oracleBASCustomer' => function ($query) {
+        $client_nos = data_get($order_issues,'*.second_client_no');
+        $orderHeaders = OracleDOCOrderHeader::query()->selectRaw(implode(',',OracleDOCOrderHeaderService::$columns))
+            ->whereIn('SOReference1',$client_nos)
+            ->with(['oracleBASCustomer'=>function($query){
                 $query->selectRaw('BAS_CUSTOMER.CustomerID,BAS_CUSTOMER.Customer_Type,BAS_CUSTOMER.Descr_C,BAS_CUSTOMER.Active_Flag');
-            }, 'oracleDOCOrderDetails' => function ($query) {
+            },'oracleDOCOrderDetails'=>function($query){
                 $query->selectRaw('doc_order_details.orderNo,doc_order_details.customerid,doc_order_details.sku,doc_order_details.QtyOrdered');
-            }, 'actAllocationDetails' => function ($query) {
+            }, 'actAllocationDetails'=>function($query){
                 $query->selectRaw('ACT_Allocation_Details.AllocationDetailsID,ACT_Allocation_Details.OrderNo,ACT_Allocation_Details.Qty_Each,ACT_Allocation_Details.PickToTraceID,ACT_Allocation_Details.CustomerID');
-            }, 'oracleBASCode' => function ($query) {
+            },'oracleBASCode'=>function($query){
                 $query->selectRaw('BAS_Codes.CodeID,BAS_Codes.CodeName_C,BAS_Codes.Code');
             }])
             ->get();
         $service = app('OrderIssueService');
         $service->updateByWmsOrders($orderHeaders);
     }
-
     public function testCollectMethod()
     {
-        $startDate = Carbon::parse('2020-11-11 23:59:59')->subSeconds(65)->format('Y-m-d H:i:s');
-        $asnHerders = app(OracleDocAsnHerderService::class)->getWmsAsnOnStartDateCreate($startDate);
-        if ($asnHerders->isEmpty()) return null;
+        $startDate=Carbon::parse('2020-11-11 23:59:59')->subSeconds(65)->format('Y-m-d H:i:s');
+        $asnHerders=app(OracleDocAsnHerderService::class)->getWmsAsnOnStartDateCreate($startDate);
+        if ($asnHerders->isEmpty())return null;
         /**
          * @var OwnerService $ownerService
          * @var WarehouseService $wareHouseService
          */
         $ownerService = app(OwnerService::class);
-        $owners = $ownerService->getByWmsOrders($asnHerders);
-        $wareHouseService = app(WarehouseService::class);
-        $warehouses = $wareHouseService->getByWms($asnHerders);
+        $owners=$ownerService->getByWmsOrders($asnHerders);
+        $wareHouseService=app(WarehouseService::class);
+        $warehouses=$wareHouseService->getByWms($asnHerders);
         foreach ($owners as $owner) {
             $owners_code_map[$owner->code] = $owner;
         }
         foreach ($warehouses as $warehouse) {
             $warehouses_code_map[$warehouse->code] = $warehouse;
         }
-        var_dump('createStoreParam_start', Carbon::now());
-        $params = app(StoreService::class)->getParamsByAsnHeader($asnHerders, $owners_code_map, $warehouses_code_map);
-        var_dump('createStoreParam_end', Carbon::now());
+        var_dump('createStoreParam_start',Carbon::now());
+        $params=app(StoreService::class)->getParamsByAsnHeader($asnHerders,$owners_code_map,$warehouses_code_map);
+        var_dump('createStoreParam_end',Carbon::now());
 
-        var_dump('insertStore_start', Carbon::now());
-        if (count($params) > 0) {
+        var_dump('insertStore_start',Carbon::now());
+        if(count($params)> 0){
             //app(StoreService::class)->insertStore($params);
             DB::table('stores')->insert($params);
         }
-        var_dump('insertStore_end', Carbon::now());
+        var_dump('insertStore_end',Carbon::now());
     }
-
-    public function testMethodSecond()
-    {
-        $param = [
+    public function testMethodSecond(){
+        $param=[
             "asn_code" => "ASN2011120516",
             "warehouse_id" => 2,
             "owner_id" => 35,
@@ -1062,11 +910,11 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
             "remark" => null,
             "created_at" => "2020-11-12 14:12:42",
             "updated_at" => "2020-11-12 14:12:42",
-        ];
-        var_dump('start', Carbon::now());
+            ];
+        var_dump('start',Carbon::now());
         //Store::query()->insert($param);
         app(StoreService::class)->insertStore($param);
-        var_dump('end', Carbon::now());
+        var_dump('end',Carbon::now());
     }
 
     public function testSyncAsn()
@@ -1084,19 +932,19 @@ app(StoreService::class)->storeCreateByWms();
         /**
          * @var OrderService $orderService
          */
-        $carbon = Carbon::now()->subMinutes(30);
-        var_dump('$orderHeader', new Carbon());
-        $orderHeader_start = OracleDOCOrderHeader::query()->selectRaw(implode(',', OracleDOCOrderHeaderService::$columns))
-            ->with(['oracleBASCustomer' => function ($query) {
+        $carbon =Carbon::now()->subMinutes(30);
+        var_dump('$orderHeader',new Carbon());
+        $orderHeader_start = OracleDOCOrderHeader::query()->selectRaw(implode(',',OracleDOCOrderHeaderService::$columns))
+            ->with(['oracleBASCustomer'=>function($query){
                 $query->selectRaw('BAS_CUSTOMER.CustomerID,BAS_CUSTOMER.Customer_Type,BAS_CUSTOMER.Descr_C,BAS_CUSTOMER.Active_Flag');
-            }, 'oracleDOCOrderDetails' => function ($query) {
+            },'oracleDOCOrderDetails'=>function($query){
                 $query->selectRaw('doc_order_details.orderNo,doc_order_details.customerid,doc_order_details.sku,doc_order_details.QtyOrdered');
-            }, 'actAllocationDetails' => function ($query) {
+            }, 'actAllocationDetails'=>function($query){
                 $query->selectRaw('ACT_Allocation_Details.AllocationDetailsID,ACT_Allocation_Details.OrderNo,ACT_Allocation_Details.Qty_Each,ACT_Allocation_Details.PickToTraceID,ACT_Allocation_Details.CustomerID,ACT_Allocation_Details.Sku');
-            }, 'oracleBASCode' => function ($query) {
+            },'oracleBASCode'=>function($query){
                 $query->selectRaw('BAS_Codes.CodeID,BAS_Codes.CodeName_C,BAS_Codes.Code');
             }])
-            ->where('DOC_Order_Header.addTime', '>=', $carbon)
+            ->where('DOC_Order_Header.addTime','>=',$carbon)
 //            ->where('DOC_Order_Header.editTime','>=',$carbon)
             ->get();
         var_dump((string)Carbon::now());
@@ -1108,109 +956,88 @@ app(StoreService::class)->storeCreateByWms();
 //      orderService  getCreateOrderModelsByWMSOrderHeaders
     }
 
-    public function testOrderPackages()
-    {
+    public function testOrderPackages(){
         $batch_number = 'W201114000104';
         $weight = 0.3;
-        OrderPackage::createPackagesFromBatchCode($batch_number, $weight);
+        OrderPackage::createPackagesFromBatchCode($batch_number,$weight);
     }
 
-    public function view()
-    {
+    public function view(){
         return view('test');
     }
 
-    public function tdel()
-    {
-        echo '223232323';
-        return 'asdfsadfsdf';
-    }
-
-    public function cleanOrderRepeat()
-    {
+    public function cleanOrderRepeat(){
 
-        ini_set('max_execution_time', 6500);
-        ini_set('memory_limit', '1526M');
-        for ($i = 0; true; $i++) {
-            $orders_repeating = Order::query()
+        ini_set('max_execution_time',6500);
+        ini_set('memory_limit','1526M');
+        for($i=0;true;$i++){
+            $orders_repeating=Order::query()
                 ->selectRaw('count(*) as count, code, id')
                 ->whereNotNull('code')
                 ->groupBy('code')
                 ->having('count', '>', 1)
                 ->limit(100)
                 ->get();
-            if ($orders_repeating->count() == 0) break;
-            $orders_repeating->each(function ($order) {
-                $code_repeating = $order['code'];
-                $orders_toCombine = Order::query()
-                    ->where('code', $code_repeating)
+            if($orders_repeating->count()==0)break;
+            $orders_repeating->each(function ($order){
+                $code_repeating=$order['code'];
+                $orders_toCombine=Order::query()
+                    ->where('code',$code_repeating)
                     ->orderByDesc('updated_at')
                     ->get();
-                $orderId_unique = (function () use ($orders_toCombine) {
-                    $order_toLive = $orders_toCombine->first();
-                    foreach ($orders_toCombine as $key => $order_toEliminate) {
-                        if ($key == 0) continue;
-                        if (!$order_toLive['batch_id']) $order_toLive['batch_id'] = $order_toEliminate['batch_id'];
-                        if (!$order_toLive['owner_id']) $order_toLive['owner_id'] = $order_toEliminate['owner_id'];
-                        if (!$order_toLive['status']) $order_toLive['status'] = $order_toEliminate['status'];
-                        if (!$order_toLive['created_at']) $order_toLive['created_at'] = $order_toEliminate['created_at'];
-                        if (!$order_toLive['code']) $order_toLive['code'] = $order_toEliminate['code'];
-                        if (!$order_toLive['shop_id']) $order_toLive['shop_id'] = $order_toEliminate['shop_id'];
-                        if (!$order_toLive['owner_id']) $order_toLive['owner_id'] = $order_toEliminate['owner_id'];
-                        if (!$order_toLive['client_code']) $order_toLive['client_code'] = $order_toEliminate['client_code'];
-                        if (!$order_toLive['logistic_id']) $order_toLive['logistic_id'] = $order_toEliminate['logistic_id'];
-                        if (!$order_toLive['consignee_name']) $order_toLive['consignee_name'] = $order_toEliminate['consignee_name'];
-                        if (!$order_toLive['consignee_phone']) $order_toLive['consignee_phone'] = $order_toEliminate['consignee_phone'];
-                        if (!$order_toLive['province']) $order_toLive['province'] = $order_toEliminate['province'];
-                        if (!$order_toLive['city']) $order_toLive['city'] = $order_toEliminate['city'];
-                        if (!$order_toLive['district']) $order_toLive['district'] = $order_toEliminate['district'];
-                        if (!$order_toLive['address']) $order_toLive['address'] = $order_toEliminate['address'];
-                        if (!$order_toLive['wms_status']) $order_toLive['wms_status'] = $order_toEliminate['wms_status'];
-                        if (!$order_toLive['status']) $order_toLive['status'] = $order_toEliminate['status'];
-                        if (!$order_toLive['warehouse_id']) $order_toLive['warehouse_id'] = $order_toEliminate['warehouse_id'];
-                        if (!$order_toLive['wms_edittime']) $order_toLive['wms_edittime'] = $order_toEliminate['wms_edittime'];
+                $orderId_unique=(function()use($orders_toCombine){
+                    $order_toLive=$orders_toCombine->first();
+                    foreach($orders_toCombine as $key=>$order_toEliminate){
+                        if($key==0)continue;
+                        if(!$order_toLive['batch_id'])$order_toLive['batch_id']=$order_toEliminate['batch_id'];
+                        if(!$order_toLive['owner_id'])$order_toLive['owner_id']=$order_toEliminate['owner_id'];
+                        if(!$order_toLive['status'])$order_toLive['status']=$order_toEliminate['status'];
+                        if(!$order_toLive['created_at'])$order_toLive['created_at']=$order_toEliminate['created_at'];
+                        if(!$order_toLive['code'])$order_toLive['code']=$order_toEliminate['code'];
+                        if(!$order_toLive['shop_id'])$order_toLive['shop_id']=$order_toEliminate['shop_id'];
+                        if(!$order_toLive['owner_id'])$order_toLive['owner_id']=$order_toEliminate['owner_id'];
+                        if(!$order_toLive['client_code'])$order_toLive['client_code']=$order_toEliminate['client_code'];
+                        if(!$order_toLive['logistic_id'])$order_toLive['logistic_id']=$order_toEliminate['logistic_id'];
+                        if(!$order_toLive['consignee_name'])$order_toLive['consignee_name']=$order_toEliminate['consignee_name'];
+                        if(!$order_toLive['consignee_phone'])$order_toLive['consignee_phone']=$order_toEliminate['consignee_phone'];
+                        if(!$order_toLive['province'])$order_toLive['province']=$order_toEliminate['province'];
+                        if(!$order_toLive['city'])$order_toLive['city']=$order_toEliminate['city'];
+                        if(!$order_toLive['district'])$order_toLive['district']=$order_toEliminate['district'];
+                        if(!$order_toLive['address'])$order_toLive['address']=$order_toEliminate['address'];
+                        if(!$order_toLive['wms_status'])$order_toLive['wms_status']=$order_toEliminate['wms_status'];
+                        if(!$order_toLive['status'])$order_toLive['status']=$order_toEliminate['status'];
+                        if(!$order_toLive['warehouse_id'])$order_toLive['warehouse_id']=$order_toEliminate['warehouse_id'];
+                        if(!$order_toLive['wms_edittime'])$order_toLive['wms_edittime']=$order_toEliminate['wms_edittime'];
                     }
                     $order_toLive->save();
                     return $order_toLive['id'];
                 })();
-                $orderIds_toRemove = (function () use ($orders_toCombine) {
+                $orderIds_toRemove=(function()use($orders_toCombine){
                     $orders_toCombine->shift();
-                    return $orders_toCombine->map(function ($order) {
-                        return $order['id'];
-                    });
+                    return $orders_toCombine->map(function($order){return $order['id'];});
                 })();
-                OrderPackage::query()->whereIn('order_id', $orderIds_toRemove)->update(['order_id' => $orderId_unique]);
-                OrderIssue::query()->whereIn('order_id', $orderIds_toRemove)->update(['order_id' => $orderId_unique]);
-                OrderCommodity::query()->whereIn('order_id', $orderIds_toRemove)->update(['order_id' => $orderId_unique]);
-                OrderBin::query()->whereIn('order_id', $orderIds_toRemove)->update(['order_id' => $orderId_unique]);
+                OrderPackage::query()->whereIn('order_id',$orderIds_toRemove)->update(['order_id'=>$orderId_unique]);
+                OrderIssue::query()->whereIn('order_id',$orderIds_toRemove)->update(['order_id'=>$orderId_unique]);
+                OrderCommodity::query()->whereIn('order_id',$orderIds_toRemove)->update(['order_id'=>$orderId_unique]);
+                OrderBin::query()->whereIn('order_id',$orderIds_toRemove)->update(['order_id'=>$orderId_unique]);
                 Order::destroy($orderIds_toRemove);
-                app('LogService')->log(__METHOD__, __FUNCTION__, 'orders_toCombine:' . json_encode($orderIds_toRemove) . '|toBe OrderId: ' . json_encode($orderId_unique));
+                app('LogService')->log(__METHOD__,__FUNCTION__,'orders_toCombine:'.json_encode($orderIds_toRemove).'|toBe OrderId: '.json_encode($orderId_unique));
             });
-            app('LogService')->log(__METHOD__, __FUNCTION__, 'orders_repeating:' . $orders_repeating->toJson());
+            app('LogService')->log(__METHOD__,__FUNCTION__,'orders_repeating:'.$orders_repeating->toJson());
         }
         echo $i;
     }
 
-    public function orderTrackingImportTest(Request $request)
-    {
-        $file = $request->file('file');
-        ini_set('max_execution_time', 4000);
-        ini_set('memory_limit', '1024M');
-        $extension = $request->file()['file']->getClientOriginalExtension();
-        $extension[0] = strtoupper($extension[0]);
-        Excel::import(new OrderTrackingImport(), $request->file('file')->path(), null, $extension);
-    }
-
     public function testImp()
     {
         $client_no = null;
         $items = null;
-        $order = (new OrderTrackingImport())->getOrder($client_no, $items);
-        if ($order['id']) echo 'yes1';
+        $order=(new OrderTrackingImport())->getOrder($client_no,$items);
+        if($order['id']) echo 'yes1';
 
 
         $order = Order::query()->create([
-            'code' => 'null' . Str::uuid(), 'client_code' => 'asdfdfdg', 'web_order_number' => 'sadfdsf'
+            'code'=>'null'.Str::uuid(),'client_code' => 'asdfdfdg','web_order_number' => 'sadfdsf'
         ]);
         dd($order);
 //        $order=(new OrderTrackingImport())->getOrder('92024765871-SDO130000986796QX',$items);
@@ -1258,56 +1085,27 @@ app(StoreService::class)->storeCreateByWms();
 //
 //    }
 
-    public function testSyncOrder()
-    {
-        $carbon = Carbon::now()->subHours(1);
-        $date = '2020-05-18 18:13:50';
-        $orderHeader = OracleDOCOrderHeader::query()->selectRaw(implode(',', OracleDOCOrderHeaderService::$columns))
-            ->with(['oracleBASCustomer' => function ($query) {
-                $query->selectRaw('BAS_CUSTOMER.CustomerID,BAS_CUSTOMER.Customer_Type,BAS_CUSTOMER.Descr_C,BAS_CUSTOMER.Active_Flag');
-            }, 'oracleDOCOrderDetails' => function ($query) {
-                $query->selectRaw('doc_order_details.orderNo,doc_order_details.customerid,doc_order_details.sku,doc_order_details.QtyOrdered');
-            }, 'actAllocationDetails' => function ($query) {
-                $query->selectRaw('ACT_Allocation_Details.AllocationDetailsID,ACT_Allocation_Details.OrderNo,ACT_Allocation_Details.Qty_Each,ACT_Allocation_Details.PickToTraceID,ACT_Allocation_Details.CustomerID,ACT_Allocation_Details.Sku');
-            }, 'oracleBASCode' => function ($query) {
-                $query->selectRaw('BAS_Codes.CodeID,BAS_Codes.CodeName_C,BAS_Codes.Code');
-            }])
-//            ->where('DOC_Order_Header.addTime','>=',$startDate)
-//            ->where('orderno','SO201112029795')
-            ->where('DOC_Order_Header.addTime','>=',$carbon)
-            ->get();
-        /** @var OrderService $service */
-        $service = app('OrderService');
-        $service->syncOrder($orderHeader);
-    }
-
-    public function OrderSync()
-    {
-        dump(Carbon::now());
-        $tack = new SyncWMSOrderTask();
-        $tack->handle();
-        dump(11);
-    }
-
-    public function testSyncCommodity()
-    {
-        /**
-         * @var CommodityService $commodityService
-         */
-        $commodityService = app(CommodityService::class);
-        dump('start'.(string)Carbon::now());
-        $commodityService->syncCommodityCreated();
-        $commodityService->syncCommodityUpdated();
-        dump('end'.(string)Carbon::now());
-    }
-
-    //按日志恢复富勒发过的波次下发,不要删
     public function reNewBatches3()
     {
-        $batches=Batch::query()->where('id','>',5338)->get('code');
-        $batchCodes = $batches->map(function($batch){
-            return $batch['code'];
-        })->toArray();
+        $batches=Batch::query()->where('id','>',324)->get('code');
+//        $batchCodes = $batches->map(function($batch){
+//            return $batch['code'];
+//        })->toArray();
+        $batchCodes = ['W201201000037',
+            'W201201000038',
+            'W201201000039',
+            'W201201000040',
+            'W201201000041',
+            'W201201000052',
+            'W201201000053',
+            'W201201000054',
+            'W201201000055',
+            'W201201000056',
+            'W201201000057',
+            'W201201000071',
+            'W201201000074',
+            'W201201000075',
+            'W201201000076',];
         $requests=[];
 //        $logs=Log::query()->select('description')->where('CREATED_AT','>','2020-11-11')
 //            ->where('type',"issued_newBatch")
@@ -1334,10 +1132,18 @@ app(StoreService::class)->storeCreateByWms();
 
     public function syncOrderTracking()
     {
-        $startDate = \Illuminate\Support\Carbon::parse('2020-12-12 00:00:00')->toDateTimeString();
         /** @var OrderTrackingService $orderTrackingService */
         $orderTrackingService = app('OrderTrackingService');
-        $orderTrackingService->trackingWmsOrder($startDate);
+        /** @var OrderService $orderService */
+        $orderService = app(OrderService::class);
+        /*$owners = app(OrderTrackingOwnerService::class)->getTrackingOrderOwner();*/
+        /*$startDate = \Illuminate\Support\Carbon::parse('2020-10-28 00:00:00')->toDateTimeString();*/
+        $orderNos = ['SO201205001735','SO201204003891','SO201204003706','SO201204002877','SO201203003771'];
+        $orderHeaders = OracleDOCOrderHeader::query()->with(['oracleDOCOrderDetails', 'actAllocationDetails', 'oracleBASCode'])
+            ->whereIn('orderno',$orderNos)
+            ->get();
+        $orderService->updateByWmsOrders($orderHeaders);
+        $orderTrackingService->createByWmsOrderHeader($orderHeaders);
     }
 
     public function testSyncOrderTask(){
@@ -1348,20 +1154,49 @@ app(StoreService::class)->storeCreateByWms();
         dump((string)Carbon::now());
         dd('hendle...end');
     }
-    function testUpdateStores(){
-        $stores=Store::query()->where('stored_method','快速入库')->get();
-        $updated_at=Carbon::now()->toDateTimeString();
-        $updateParams = [[
-            'id', 'is_fast_stored','updated_at'
-        ]];
-        foreach ($stores as $store){
-            if ($store->stored_method!='快速入库') continue;
-            $updateParams[] = [
-                'id' => $store->id,
-                'is_fast_stored' =>'快速入库',
-                'updated_at' =>$updated_at,
-            ];
+
+    public function testSyncWaveNo()
+    {
+        $waveHeader = OracleDOCWaveHeader::query()->where('waveno','W201209000024')->first();
+//        Batch::query()->create([
+//            'code' => $waveHeader->waveno,
+//            'wms_created_at' => $waveHeader->addtime,
+//            'remark' => $waveHeader->descr,
+//            'wms_status' => '99',
+//        ]);
+        $waveHeaderDetails = OracleDOCWaveDetails::query()->where('waveno',$waveHeader->waveno)->get();
+        $orderNos = $waveHeaderDetails->map(function($item){
+            return $item->orderno;
+        });
+        $orderHeaderService = new OracleDOCOrderHeaderService();
+        $orderHeaders = $orderHeaderService->getOrderInfoByOrderNos($orderNos);
+        $orderService = new OrderService();
+        $orderService->syncOrderByWMSOrderHeaders($orderHeaders);
+    }
+
+    public function testSyncOrderTracking(){
+        $orderTrackingService = new OrderTrackingService();
+        $items = OrderTracking::query()->with('commodities.package.order')->where('created_at','>=','2020-12-01 00:00:00')->get();
+        $orderNos = $items->map(function ($orderTracking){
+            return   $orderTracking->commodities->package->order->code;
+        });
+        $update_params =[['id','client','order_remark']];
+        $orderHeaders = OracleDOCOrderHeader::query()->whereIn('OrderNo',$orderNos)->get();
+        foreach ($items as $orderTracking) {
+            $order = $orderTracking->commodities->package->order;
+            $orderHeader = $orderHeaders->where('orderno',$order->code)->first();
+            if(!$orderHeader)continue;
+            if(empty($order))continue;
+            $params =  $orderTrackingService->getParamsByOrderHeaderAndOrder($orderHeader,$order);
+            if($params['client'] != $orderTracking->client || $params['order_remark'] != $orderTracking->order_remark ){
+                 $update_params[] = [
+                     'id' => $orderTracking->id,
+                     'client' => $params['client'] ,
+                     'order_remark'  =>$params['order_remark']
+                 ];
+            }
         }
-        if (count($updateParams) > 1) app(BatchUpdateService::class)->batchUpdate('stores', $updateParams);
+        if(count($update_params) == 0)return ;
+        $orderTrackingService->batchUpdate($update_params);
     }
 }

+ 2 - 1
app/Http/Controllers/api/thirdPart/jianshang/RejectedController.php

@@ -14,6 +14,7 @@ use Illuminate\Http\Request;
 use Illuminate\Support\Collection;
 use Illuminate\Support\Facades\Auth;
 use Zttp\Zttp;
+use Zttp\ZttpResponse;
 
 class RejectedController extends Controller
 {
@@ -208,7 +209,7 @@ class RejectedController extends Controller
         $url=config('api.url_rejected_send_jianshang2');
         if(env('api_faking'))$url=url(config('api.fakingUrl_rejected_send_jianshang'));
         try{
-
+            /** @var ZttpResponse $response */
             $response=Zttp::withHeaders([
                 'sign'=>$sign,
                 'nonce'=>$nonce,

+ 59 - 17
app/Imports/UpdatePickZone.php

@@ -4,6 +4,7 @@ namespace App\Imports;
 
 use App\OracleDOCOrderDetail;
 use App\Services\LogService;
+use Carbon\Carbon;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Support\Collection;
 use Illuminate\Support\Facades\Auth;
@@ -35,8 +36,28 @@ class UpdatePickZone implements ToCollection,WithHeadingRow
         $errors = [];
         $ids = [];
         foreach ($collection as $index=>$item){
-            if ($item["生产日期"]) $item["生产日期"] = formatExcelDate($item["生产日期"]);
-            if ($item["失效日期"]) $item["失效日期"] = formatExcelDate($item["失效日期"]);
+            if ($item["生产日期"]){
+                if (is_numeric($item["生产日期"]))$item["生产日期"] = formatExcelDate($item["生产日期"]);
+                else{
+                    try{
+                        $item["生产日期"]=Carbon::parse($item["生产日期"])->format('Y-m-d');
+                    }catch (\Exception $e){
+                        $errors[] = "第“" . ($index + 2) . "”生产日期无法识别";
+                        continue;
+                    }
+                }
+            }
+            if ($item["失效日期"]){
+                if (is_numeric($item["失效日期"]))$item["失效日期"] = formatExcelDate($item["失效日期"]);
+                else{
+                    try{
+                        $item["失效日期"]=Carbon::parse($item["失效日期"])->format('Y-m-d');
+                    }catch (\Exception $e){
+                        $errors[] = "第“" . ($index + 2) . "”失效日期无法识别";
+                        continue;
+                    }
+                }
+            }
 
             if (!$item["订单编号"]){
                 $errors[] = "第“" . ($index + 2) . "”行订单编号为空";
@@ -60,8 +81,9 @@ class UpdatePickZone implements ToCollection,WithHeadingRow
                 $errors[] = "第“" . ($index + 2) . "”行未知订单商品";
                 continue;
             }
-            $sql = "select INV_LOT_LOC_ID.LOCATIONID,INV_LOT_LOC_ID.LOTNUM,BAS_LOCATION.PICKZONE,INV_LOT_LOC_ID.QTY from INV_LOT_ATT LEFT JOIN
+            $sql = "select BAS_ZONE.DESCR,INV_LOT_LOC_ID.LOCATIONID,INV_LOT_LOC_ID.LOTNUM,BAS_LOCATION.PICKZONE,(INV_LOT_LOC_ID.QTY-INV_LOT_LOC_ID.QTYALLOCATED) AS qty from INV_LOT_ATT LEFT JOIN
                         INV_LOT_LOC_ID ON INV_LOT_ATT.LOTNUM = INV_LOT_LOC_ID.LOTNUM LEFT JOIN BAS_LOCATION ON INV_LOT_LOC_ID.LOCATIONID = BAS_LOCATION.LOCATIONID
+                    LEFT JOIN BAS_ZONE ON BAS_LOCATION.PICKZONE = BAS_ZONE.ZONE 
                     where INV_LOT_ATT.LOTNUM in (select LOTNUM from INV_LOT_LOC_ID where CUSTOMERID = ? AND SKU = ? GROUP BY LOTNUM)";
             $bindings = [$detail->customerid,$detail->sku];
             if ($item["生产日期"]){
@@ -73,26 +95,29 @@ class UpdatePickZone implements ToCollection,WithHeadingRow
                 $bindings[] = $item["失效日期"];
             }else $sql .= " AND LOTATT02 IS NULL";
 
-            $lot = DB::connection("oracle")->select(DB::raw($sql),$bindings);
-            if (!$lot){
+            $lots = DB::connection("oracle")->select(DB::raw($sql),$bindings);
+            if (!$lots){
                 $errors[] = "第“" . ($index + 2) . "”行未找到库位";
                 continue;
             }
             $result = null;
-            if (count($lot)>1){
-                $min = null;
-                $max = null;
-                $map = [];
-                foreach ($lot as $i => $l){
-                    $qty = (int)$l->qty;
-                    $map[$qty] = $i;
-                    if (($qty >= (int)$item["数量"] && $qty<=$max) || $max===null)$max = $qty;
-                    if (($qty < (int)$item["数量"] && $qty>=$min) || $min===null)$min = $qty;
+            if (count($lots) == 1)$result = $lots[0];
+            else {
+                $zone = ["拣货区","存储区","虚拟库区"];
+                $zones = [];
+                foreach ($lots as $lot){
+                    foreach ($zone as $index=>$str){
+                        if (mb_strpos($lot->descr,$str) !== false){
+                            $zones[$index][] = $lot;
+                            break;
+                        }
+                    }
+                }
+                foreach ($zones as $zl){
+                    $result = $this->matching($zl,$item["数量"]);
+                    if ($result)break;
                 }
-                if ($max !== null)$result = $lot[$map[$max]];
-                else $result = $lot[$map[$min]];
             }
-            if (count($lot) == 1)$result = $lot[0];
             if ($result){
                 try{
                     $sql = "UPDATE DOC_ORDER_DETAILS SET LOTNUM = ?,PICKZONE = ?,KITREFERENCENO = ?,D_EDI_09 = ?,D_EDI_10 = ? WHERE ORDERNO = ? AND ORDERLINENO = ?";
@@ -144,4 +169,21 @@ class UpdatePickZone implements ToCollection,WithHeadingRow
         }
         Cache::put("commodityAssign",["success"=>true,"data"=>$models,"errors"=>$errors]);
     }
+
+    private function matching($lots, $amount)
+    {
+        if (!$lots) return null;
+        $min = null;
+        $max = null;
+        $map = [];
+        foreach ($lots as $i => $l){
+            $qty = (int)$l->qty;
+            $map[$qty] = $i;
+            if (($qty >= $amount && $qty<=$max) || $max===null)$max = $qty;
+            if (($qty < $amount && $qty>=$min) || $min===null)$min = $qty;
+        }
+        if ($max !== null)return $lots[$map[$max]];
+        if ($min !== null)return $lots[$map[$min]];
+        return null;
+    }
 }

+ 27 - 0
app/Policies/CustomerLogPolice.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace App\Policies;
+
+use App\CustomerLog;
+use App\User;
+use Illuminate\Auth\Access\HandlesAuthorization;
+
+class CustomerLogPolice
+{
+    use HandlesAuthorization;
+
+    protected $cache_key = 'customerLog_update_auth_';
+
+    public function update(User $user, CustomerLog $customerLog): bool
+    {
+        $lastOne = cache()->remember($this->cache_key . $user->id, 1, function () use ($user) {
+            return CustomerLog::query()->where('user_id', $user->id)->orderByDesc('updated_at')->first();
+        });
+        return (int)$user->id === (int)$customerLog->user_id && $customerLog->id == $lastOne->id;
+    }
+
+    public function destroy(User $user, CustomerLog $customerLog)
+    {
+        return (int)$user->id === (int)$customerLog->user_id;
+    }
+}

+ 23 - 0
app/Policies/CustomerLogStatusesPolice.php

@@ -0,0 +1,23 @@
+<?php
+
+namespace App\Policies;
+
+use App\CustomerLogStatus;
+use App\User;
+use Illuminate\Auth\Access\HandlesAuthorization;
+
+class CustomerLogStatusesPolice
+{
+    use HandlesAuthorization;
+
+    public function update(User $user, CustomerLogStatus $customerLogStatus): bool
+    {
+
+        return true;
+    }
+
+    public function destroy(User $user, CustomerLogStatus $customerLogStatus): bool
+    {
+        return true;
+    }
+}

+ 8 - 0
app/Providers/AuthServiceProvider.php

@@ -3,6 +3,10 @@
 namespace App\Providers;
 
 use App\Authority;
+use App\CustomerLog;
+use App\CustomerLogStatus;
+use App\Policies\CustomerLogPolice;
+use App\Policies\CustomerLogStatusesPolice;
 use App\Services\AuthorityService;
 use App\Services\CacheService;
 use App\Services\UserService;
@@ -22,6 +26,10 @@ class AuthServiceProvider extends ServiceProvider
      */
     protected $policies = [
         // 'App\Model' => 'App\Policies\ModelPolicy',
+        CustomerLog::class => CustomerLogPolice::class,
+
+        CustomerLogStatus::class => CustomerLogStatusesPolice::class,
+
     ];
 
     /**

+ 3 - 3
app/Services/CustomerService.php

@@ -1,6 +1,6 @@
-<?php 
+<?php
 
-namespace App\Services; 
+namespace App\Services;
 
 use App\Customer;
 
@@ -39,4 +39,4 @@ Class CustomerService
     {
         return Customer::destroy($id);
     }
-}
+}

+ 5 - 2
app/Services/OrderService.php

@@ -231,6 +231,7 @@ class OrderService
                 ->getOrderno(['checktime_start'=>$checktime_start,'checktime_end'=>$checktime_end,
                     'paginate'=>$paginate,'page'=>$page]);
             if ($ordernos)$params['ordernos'] = $ordernos;
+            else return null;
         }
         $sql="select ACT_ALLOCATION_DETAILS.CHECKTIME,DOC_ORDER_HEADER.addtime,DOC_ORDER_HEADER.C_PROVINCE,DOC_ORDER_HEADER.C_CITY,DOC_ORDER_HEADER.C_DISTRICT,DOC_ORDER_HEADER.C_CONTACT,DOC_ORDER_HEADER.OrderNo,DOC_ORDER_HEADER.SOStatus,DOC_ORDER_HEADER.WAREHOUSEID,DOC_ORDER_HEADER.CustomerID
         ,DOC_ORDER_HEADER.C_Tel2,DOC_ORDER_HEADER.C_Tel1,DOC_ORDER_HEADER.CarrierName,DOC_ORDER_HEADER.IssuePartyName,DOC_ORDER_HEADER.EDIREMARKS2,
@@ -308,13 +309,15 @@ class OrderService
         }
 
         $sql = $this->getSql($params,$params['page'] ?? 1, $params['paginate'] ?? 50);
-        $orders=DB::connection('oracle')->select(DB::raw($sql));
+        if ($sql)$orders=DB::connection('oracle')->select(DB::raw($sql));
+        else $orders = [];
         return $this->orderFormat($orders);
     }
 
     public function get(array $params){
         $sql = $this->getSql($params);
-        $orders=DB::connection('oracle')->select(DB::raw($sql));
+        if ($sql)$orders=DB::connection('oracle')->select(DB::raw($sql));
+        else $orders = [];
         return $this->orderFormat($orders);
     }
 

+ 1 - 1
app/Services/OwnerService.php

@@ -33,7 +33,7 @@ Class OwnerService
 
     public function getSelection($column = ['id'])
     {
-        return $this->cacheService->getOrExecute('OwnersAll_Id',function()use($column){
+        return $this->cacheService->getOrExecute('OwnersAll_'.md5(json_encode($column)),function()use($column){
             return Owner::filterAuthorities()->select($column)->get();
         },config('cache.expirations.owners'));
     }

+ 23 - 0
database/factories/CustomerLogFactory.php

@@ -0,0 +1,23 @@
+<?php
+/** @var Factory $factory */
+
+use App\Customer;
+use App\CustomerLogStatus;
+use App\User;
+use Faker\Generator as Faker;
+use Illuminate\Database\Eloquent\Factory;
+
+$factory->define(App\CustomerLog::class, function (Faker $faker) {
+    return [
+        'customer_id' => function () {
+            return factory(Customer::class)->create()->id;
+        },
+        'customer_log_status_id' =>  function () {
+            return factory(CustomerLogStatus::class)->create()->id;
+        },
+        'user_id' => function () {
+            return factory(User::class)->create()->id;
+        },
+        'description' => $faker->text,
+    ];
+});

+ 12 - 0
database/factories/CustomerLogStatusFactory.php

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

+ 25 - 0
database/migrations/2020_12_14_101617_create_customerlogs_table.php

@@ -0,0 +1,25 @@
+<?php
+
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Support\Facades\Schema;
+
+class CreateCustomerLogsTable extends Migration
+{
+    public function up()
+    {
+        Schema::create('customer_logs', function (Blueprint $table) {
+            $table->increments('id');
+            $table->bigInteger('customer_id')->unsigned()->index();
+            $table->integer('customer_log_status_id')->unsigned()->index();
+            $table->bigInteger('user_id')->unsigned()->index();
+            $table->text('description');
+            $table->timestamps();
+        });
+    }
+
+    public function down()
+    {
+        Schema::drop('customer_logs');
+    }
+}

+ 23 - 0
database/migrations/2020_12_14_103401_create_customerlogstatuses_table.php

@@ -0,0 +1,23 @@
+<?php
+
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Support\Facades\Schema;
+
+class CreateCustomerLogStatusesTable extends Migration
+{
+	public function up()
+	{
+		Schema::create('customer_log_statuses', function(Blueprint $table) {
+            $table->increments('id');
+            $table->string('name')->index();
+            $table->text('description');
+            $table->timestamps();
+        });
+	}
+
+	public function down()
+	{
+		Schema::drop('customer_log_statuses');
+	}
+}

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

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddCustomerPhoneAddress extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('customers', function (Blueprint $table) {
+            $table->string('invoice_address')->nullable()->comment('发票地址');
+            $table->string('contact_man')->index()->nullable()->comment('联系人');
+            $table->integer('phone')->index()->nullable()->comment('联系电话');
+            $table->string('comment')->nullable()->comment('公司备注');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('customers',function (Blueprint $table){
+            $table->dropColumn('invoice_address');
+            $table->dropColumn('contact_man');
+            $table->dropColumn('phone');
+            $table->dropColumn('comment');
+        });
+    }
+}

+ 20 - 0
database/seeds/CustomerLogStatusesTableSeeder.php

@@ -0,0 +1,20 @@
+<?php
+
+use App\CustomerLogStatus;
+use Illuminate\Database\Seeder;
+
+class CustomerLogStatusesTableSeeder extends Seeder
+{
+    public function run()
+    {
+        $customer_log_statuses = factory(CustomerLogStatus::class)->times(50)->make()->each(function ($customer_log_status, $index) {
+            if ($index == 0) {
+                // $customer_log_status->field = 'value';
+            }
+        });
+
+        CustomerLogStatus::insert($customer_log_statuses->toArray());
+    }
+
+}
+

+ 20 - 0
database/seeds/CustomerLogsTableSeeder.php

@@ -0,0 +1,20 @@
+<?php
+
+use App\CustomerLog;
+use Illuminate\Database\Seeder;
+
+class CustomerLogsTableSeeder extends Seeder
+{
+    public function run()
+    {
+        $customer_logs = factory(CustomerLog::class)->times(50)->make()->each(function ($customer_log, $index) {
+            if ($index == 0) {
+                // $customer_log->field = 'value';
+            }
+        });
+
+        CustomerLog::insert($customer_logs->toArray());
+    }
+
+}
+

+ 10 - 0
resources/views/common/error.blade.php

@@ -0,0 +1,10 @@
+@if (count($errors) > 0)
+  <div class="alert alert-danger">
+    <div class="mt-2"><b>有错误发生:</b></div>
+    <ul class="mt-2 mb-2">
+      @foreach ($errors->all() as $error)
+      <li><i class="glyphicon glyphicon-remove"></i> {{ $error }}</li>
+      @endforeach
+    </ul>
+  </div>
+@endif

+ 28 - 3
resources/views/maintenance/customer/create.blade.php → resources/views/customer/customer/create.blade.php

@@ -3,8 +3,8 @@
 
 @section('content')
     <div id="nav2">
-        @component('maintenance.menu')@endcomponent
-        @component('maintenance.customer.menu')
+        @component('customer.menu')@endcomponent
+        @component('customer.customer.menu')
                 @if(isset($customer))@can('客户-编辑')
                 <li class="nav-item">
                     <a class="nav-link" href="{{URL::current()}}" :class="{active:isActive('edit',4)}">编辑</a>
@@ -13,7 +13,7 @@
     </div>
     <div class="container-fluid card">
         <div class="card-body offset-3 mt-2">
-            <form method="post" action="{{isset($customer) ? url('maintenance/customer').'/'.$customer->id : url('maintenance/customer')}}">
+            <form method="post" action="{{isset($customer) ? url('customer/customer').'/'.$customer->id : url('customer/customer')}}">
                 @csrf
                 @if(isset($customer)) @method('PUT') @endif
                 <div class="row">
@@ -37,6 +37,31 @@
                     <input class="form-control col-6" id="company_name" name="company_name"
                     value="{{old("company_name") ?? (isset($customer) ? $customer->company_name : '')}}">
                 </div>
+
+                <div class="row mt-3">
+                    <label class="col-2" for="invoice_address">发票地址</label>
+                    <input class="form-control col-6" id="invoice_address" name="invoice_address"
+                           value="{{old("invoice_address") ?? (isset($customer) ? $customer->invoice_address : '')}}">
+                </div>
+
+                <div class="row mt-3">
+                    <label class="col-2" for="contact_man">联系人</label>
+                    <input class="form-control col-6" id="contact_man" name="contact_man"
+                           value="{{old("contact_man") ?? (isset($customer) ? $customer->contact_man : '')}}">
+                </div>
+
+                <div class="row mt-3">
+                    <label class="col-2" for="phone">联系电话</label>
+                    <input class="form-control col-6" id="phone" name="phone"
+                           value="{{old("phone") ?? (isset($customer) ? $customer->phone : '')}}">
+                </div>
+
+                <div class="row mt-3">
+                    <label class="col-2" for="comment">公司备注</label>
+                    <input class="form-control col-6" id="comment" name="comment"
+                           value="{{old("comment") ?? (isset($customer) ? $customer->comment : '')}}">
+                </div>
+
                 <div class="row mt-3 offset-1">
                     <button class="btn btn-success col-7">提交</button>
                 </div>

+ 22 - 16
resources/views/maintenance/customer/index.blade.php → resources/views/customer/customer/index.blade.php

@@ -3,8 +3,8 @@
 
 @section('content')
     <div id="nav2">
-        @component('maintenance.menu')@endcomponent
-        @component('maintenance.customer.menu')@endcomponent
+        @component('customer.menu')@endcomponent
+        @component('customer.customer.menu')@endcomponent
     </div>
     <div class="container-fluid card" id="container">
         <div class="card-body mt-2">
@@ -17,6 +17,12 @@
                     <th>代码</th>
                     <th>名称</th>
                     <th>客户全称</th>
+                    <th>发票地址</th>
+                    <th>联系人</th>
+                    <th>联系电话</th>
+                    <th>公司备注</th>
+                    <th>日志</th>
+                    <th>合同</th>
                     <th>创建时间</th>
                     <th>操作</th>
                 </tr>
@@ -25,9 +31,15 @@
                     <td>@{{ customer.code }}</td>
                     <td>@{{ customer.name }}</td>
                     <td>@{{ customer.company_name }}</td>
+                    <td>@{{ customer.invoice_address }}</td>
+                    <td>@{{ customer.contact_man }}</td>
+                    <td>@{{ customer.phone }}</td>
+                    <td>@{{ customer.comment }}</td>
+                    <td><a href="#" @click="gotoLogs(customer.id)">链接</a></td>
+                    <td>#</td>
                     <td>@{{ customer.created_at }}</td>
                     <td>
-                        @can("客户-编辑")<a :href="'{{url('maintenance/customer')}}/'+customer.id+'/edit'"><button class="btn btn-sm btn-outline-info">改</button></a>@endcan
+                        @can("客户-编辑")<a :href="'{{url('customer/customer')}}/'+customer.id+'/edit'"><button class="btn btn-sm btn-outline-info">改</button></a>@endcan
                         @can("客户-删除")<button class="btn btn-sm btn-outline-danger" @click="destroy(customer.id,i,customer.name)">删</button>@endcan
                     </td>
                 </tr>
@@ -41,22 +53,12 @@
         new Vue({
             el:"#container",
             data:{
-                customers : [
-                    @foreach($customers as $customer)
-                    {
-                        id:"{{$customer->id}}",
-                        code:"{{$customer->code}}",
-                        name:"{{$customer->name}}",
-                        company_name:"{{$customer->company_name}}",
-                        created_at:"{{$customer->created_at}}",
-                    },
-                    @endforeach
-                ],
+                customers :  {!!  $customers->toJson() !!}['data']
             },
             methods:{
                 destroy(id,index,name){
                     window.tempTip.confirm("确定要删除"+name+"吗?",()=>{
-                        window.axios.delete("{{url('maintenance/customer')}}/"+id)
+                        window.axios.delete("{{url('customer/customer')}}/"+id)
                             .then(res=>{
                                 if (res.data.success){
                                     this.$delete(this.customers,index);
@@ -71,8 +73,12 @@
                             window.tempTip.show("网络错误:"+err);
                         })
                     })
+                },
+                gotoLogs(id){
+                    let url = '{{ url("customer/customer/customer_logs") }}'+'?id='+id;
+                    window.open(url);
                 }
             },
         });
     </script>
-@stop
+@stop

+ 19 - 0
resources/views/customer/customer/menu.blade.php

@@ -0,0 +1,19 @@
+<div class="container-fluid nav3">
+    <div class="card menu-third" >
+        <ul class="nav nav-pills">
+            @can('客户-查询')
+            <li class="nav-item">
+                <a class="nav-link" href="{{url('customer/customer')}}" :class="{active:isActive('',3)}">查询</a>
+            </li> @endcan
+            @can('客户-录入')
+            <li class="nav-item">
+                <a class="nav-link" href="{{url('customer/customer/create')}}" :class="{active:isActive('create',3)}">录入</a>
+            </li> @endcan
+
+            <li class="nav-item">
+                <a class="nav-link" href="{{url('customer\customer/customer_log_statuses')}}" :class="{active:isActive('customer_log_statuses',3)}">客户状态</a>
+            </li>
+            {{$slot}}
+        </ul>
+    </div>
+</div>

+ 52 - 0
resources/views/customer/customer_log_statuses/create_and_edit.blade.php

@@ -0,0 +1,52 @@
+@extends('layouts.app')
+
+@section('content')
+
+<div class="container">
+  <div class="col-md-10 offset-md-1">
+    <div class="card ">
+
+      <div class="card-header">
+        <h1>
+            客户日志状态-
+          @if($customer_log_status->id)
+            编辑 #{{ $customer_log_status->id }}
+          @else
+              新建
+          @endif
+        </h1>
+      </div>
+
+      <div class="card-body">
+        @if($customer_log_status->id)
+          <form action="{{ route('customer_log_statuses.update', $customer_log_status->id) }}" method="POST" accept-charset="UTF-8">
+          <input type="hidden" name="_method" value="PUT">
+        @else
+          <form action="{{ route('customer_log_statuses.store') }}" method="POST" accept-charset="UTF-8">
+        @endif
+
+          @include('common.error')
+
+          <input type="hidden" name="_token" value="{{ csrf_token() }}">
+
+
+                <div class="form-group">
+                	<label for="name-field">名称</label>
+                	<input class="form-control" type="text" name="name" id="name-field" value="{{ old('name', $customer_log_status->name ) }}" />
+                </div>
+                <div class="form-group">
+                	<label for="description-field">详情</label>
+                	<textarea name="description" id="description-field" class="form-control" rows="3">{{ old('description', $customer_log_status->description ) }}</textarea>
+                </div>
+
+          <div class="well well-sm">
+            <button type="submit" class="btn btn-primary">保存</button>
+            <a class="btn btn-link float-xs-right" href="{{ route('customer_log_statuses.index') }}"> <- 返回</a>
+          </div>
+        </form>
+      </div>
+    </div>
+  </div>
+</div>
+
+@endsection

+ 64 - 0
resources/views/customer/customer_log_statuses/index.blade.php

@@ -0,0 +1,64 @@
+@extends('layouts.app')
+
+@section('content')
+
+    <div id="nav2">
+        @component('customer.menu')@endcomponent
+        @component('customer.customer.menu')@endcomponent
+    </div>
+    <div class="container">
+        <div class="col-md-10 offset-md-1">
+            <div class="card ">
+                <div class="card-header">
+                    <h1>
+                        客户日志状态
+                        <a class="btn btn-success float-xs-right"
+                           href="{{ route('customer_log_statuses.create') }}">新建</a>
+                    </h1>
+                </div>
+
+                <div class="card-body">
+                    @if($customer_log_statuses->count())
+                        <table class="table table-sm table-striped">
+                            <thead>
+                            <tr>
+                                <th class="text-xs-center">#</th>
+                                <th>名称</th>
+                                <th>详情</th>
+                                <th class="text-xs-right">操作</th>
+                            </tr>
+                            </thead>
+
+                            <tbody>
+                            @foreach($customer_log_statuses as $customer_log_status)
+                                <tr>
+                                    <td class="text-xs-center"><strong>{{$customer_log_status->id}}</strong></td>
+
+                                    <td>{{$customer_log_status->name}}</td>
+                                    <td>{{$customer_log_status->description}}</td>
+
+                                    <td class="text-xs-right">
+                                        <a class="btn btn-sm btn-primary"
+                                           href="{{ route('customer_log_statuses.show', $customer_log_status->id) }}">
+                                            查
+                                        </a>
+
+                                        <a class="btn btn-sm btn-warning"
+                                           href="{{ route('customer_log_statuses.edit', $customer_log_status->id) }}">
+                                            改
+                                        </a>
+                                    </td>
+                                </tr>
+                            @endforeach
+                            </tbody>
+                        </table>
+                        {!! $customer_log_statuses->render() !!}
+                    @else
+                        <h3 class="text-xs-center alert alert-info">暂时还没有内容 ~ ~</h3>
+                    @endif
+                </div>
+            </div>
+        </div>
+    </div>
+
+@endsection

+ 41 - 0
resources/views/customer/customer_log_statuses/show.blade.php

@@ -0,0 +1,41 @@
+@extends('layouts.app')
+
+@section('content')
+
+    <div class="container">
+        <div class="col-md-10 offset-md-1">
+            <div class="card ">
+                <div class="card-header">
+                    <h1>客户日志状态#{{ $customer_log_status->id }}</h1>
+                </div>
+
+                <div class="card-body">
+                    <div class="card-block bg-light">
+                        <div class="row">
+                            <div class="col-md-6">
+                                <a class="btn btn-link" href="{{ route('customer_log_statuses.index') }}"><- 返回</a>
+                            </div>
+                            <div class="col-md-6">
+                                <a class="btn btn-sm btn-warning float-right mt-1"
+                                   href="{{ route('customer_log_statuses.edit', $customer_log_status->id) }}">
+                                    编辑
+                                </a>
+                            </div>
+                        </div>
+                    </div>
+                    <br>
+
+                    <label><b>名称</b></label>
+                    <p>
+                        {{ $customer_log_status->name }}
+                    </p>
+                    <label><b>详情</b></label>
+                    <p>
+                        {{ $customer_log_status->description }}
+                    </p>
+                </div>
+            </div>
+        </div>
+    </div>
+
+@endsection

+ 68 - 0
resources/views/customer/customer_logs/create_and_edit.blade.php

@@ -0,0 +1,68 @@
+@extends('layouts.app')
+
+@section('content')
+
+<div class="container">
+  <div class="col-md-10 offset-md-1">
+    <div class="card ">
+
+      <div class="card-header">
+        <h1>
+          客户日志 -
+          @if($customer_log->id)
+            Edit #{{ $customer_log->id }}
+          @else
+            创建
+          @endif
+        </h1>
+      </div>
+
+      <div class="card-body">
+        @if($customer_log->id)
+          <form action="{{ route('customer_logs.update', $customer_log->id) }}" method="POST" accept-charset="UTF-8">
+          <input type="hidden" name="_method" value="PUT">
+        @else
+          <form action="{{ route('customer_logs.store') }}" method="POST" accept-charset="UTF-8">
+        @endif
+
+          @include('common.error')
+
+          <input type="hidden" name="_token" value="{{ csrf_token() }}">
+
+
+                <div class="form-group">
+                    <label for="customer_id-field">客户名称</label>
+                    <select name="customer_id" class="form-control" required>
+                        <option value="" hidden disabled {{ $customer_log->customer_id ? '':'selected' }}>请选择客户名称</option>
+                        @foreach($customers as $customer)
+                            <option value="{{ $customer->id }}">{{ $customer->name }}</option>
+                        @endforeach
+                    </select>
+{{--                    <input class="form-control" type="text" name="customer_id" id="customer_id-field" value="{{ old('customer_id', $customer_log->customer_id ) }}" />--}}
+                </div>
+                <div class="form-group">
+                    <label for="customer_log_status_id-field">状态</label>
+                    <select name="customer_log_status_id" class="form-control" required>
+                        <option value="" hidden disabled {{ $customer_log->customer_log_status_id ? '':'selected' }}>请选择状态</option>
+                        @foreach($customerLogStatuses as $customerLogStatus)
+                            <option value="{{ $customerLogStatus->id }}">{{ $customerLogStatus->name }}</option>
+                        @endforeach
+                    </select>
+{{--                    <input class="form-control" type="text" name="customer_log_status_id" id="customer_log_status_id-field" value="{{ old('customer_log_status_id', $customer_log->customer_log_status_id ) }}" />--}}
+                </div>
+                <div class="form-group">
+                	<label for="description-field">描述</label>
+                	<textarea name="description" id="description-field" class="form-control" rows="3">{{ old('description', $customer_log->description ) }}</textarea>
+                </div>
+
+          <div class="well well-sm">
+            <button type="submit" class="btn btn-primary">保存</button>
+            <a class="btn btn-link float-xs-right" href="{{ route('customer_logs.index') }}"> <- 返回</a>
+          </div>
+        </form>
+      </div>
+    </div>
+  </div>
+</div>
+
+@endsection

+ 69 - 0
resources/views/customer/customer_logs/index.blade.php

@@ -0,0 +1,69 @@
+@extends('layouts.app')
+
+@section('content')
+    <div class="container">
+        <div class="col-md-10 offset-md-1">
+            <div class="card ">
+                <div class="card-header">
+                    <h1>
+                        客户日志
+                        <a class="btn btn-success float-xs-right" href="{{ route('customer_logs.create') }}">新建</a>
+                    </h1>
+                </div>
+
+                <div class="card-body">
+                    @if($customer_logs->count())
+                        <table class="table table-sm table-striped">
+                            <thead>
+                            <tr>
+                                <th>客户名称</th>
+                                <th>状态</th>
+                                <th>创建用户</th>
+                                <th>详情</th>
+                                <th>编辑时间</th>
+                                <th class="text-xs-right">操作</th>
+                            </tr>
+                            </thead>
+
+                            <tbody>
+                            @foreach($customer_logs as $customer_log)
+                                <tr>
+                                    <td>{{$customer_log->customer->name}}</td>
+                                    <td>{{$customer_log->customerLogStatus->name}}</td>
+                                    <td>{{$customer_log->user->name}}</td>
+                                    <td>{{$customer_log->description}}</td>
+                                    <td>{{$customer_log->updated_at->diffForHumans()}}</td>
+
+                                    <td class="text-xs-right">
+                                        <a class="btn btn-sm btn-primary"
+                                           href="{{ route('customer_logs.show', $customer_log->id) }}">
+                                            查
+                                        </a>
+                                        @can('update',$customer_log)
+                                            <a class="btn btn-sm btn-warning"
+                                               href="{{ route('customer_logs.edit', $customer_log->id) }}">
+                                                改
+                                            </a>
+                                        @endcan
+                                        <form action="{{ route('customer_logs.destroy', $customer_log->id) }}"
+                                              method="POST" style="display: inline;"
+                                              onsubmit="return confirm('删除!无法恢复!您确定么?');">
+                                            {{csrf_field()}}
+                                            <input type="hidden" name="_method" value="DELETE">
+
+                                            <button type="submit" class="btn btn-sm btn-danger">删</button>
+                                        </form>
+                                    </td>
+                                </tr>
+                            @endforeach
+                            </tbody>
+                        </table>
+                        {!! $customer_logs->render() !!}
+                    @else
+                        <h3 class="text-xs-center alert alert-info">Empty!</h3>
+                    @endif
+                </div>
+            </div>
+        </div>
+    </div>
+@stop

+ 59 - 0
resources/views/customer/customer_logs/show.blade.php

@@ -0,0 +1,59 @@
+@extends('layouts.app')
+
+@section('content')
+
+    <div class="container">
+        <div class="col-md-10 offset-md-1">
+            <div class="card ">
+                <div class="card-header">
+                    <h1>客户日志</h1>
+                </div>
+
+                <div class="card-body">
+                    <div class="card-block bg-light">
+                        <div class="row">
+                            <div class="col-md-6">
+                                <a class="btn btn-link" href="{{ route('customer_logs.index') }}"><- 返回</a>
+                            </div>
+                            @can('update',$customer_log)
+                            <div class="col-md-6">
+                                <a class="btn btn-sm btn-warning float-right mt-1"
+                                   href="{{ route('customer_logs.edit', $customer_log->id) }}">
+                                    编辑
+                                </a>
+                            </div>
+                            @endcan
+                        </div>
+                    </div>
+                    <br>
+
+                    <p id="customer"><b>客户信息</b></p>
+                    <table class="table table-sm table-striped" aria-describedby="customer">
+                        <tr>
+                            <th>客户名称</th>
+                            <th>公司名称</th>
+                        </tr>
+                        <tr>
+                            <th>{{ $customer_log->customer->name }}</th>
+                            <th>{{ $customer_log->customer->company_name }}</th>
+                        </tr>
+                    </table>
+
+                    <label><b>状态</b></label>
+                    <p>
+                        {{ $customer_log->customerLogStatus->name }}
+                    </p>
+                    <label><b>创建用户</b></label>
+                    <p>
+                        {{ $customer_log->user->name }}
+                    </p>
+                    <label><b>详情</b></label>
+                    <p>
+                        {{ $customer_log->description }}
+                    </p>
+                </div>
+            </div>
+        </div>
+    </div>
+
+@endsection

+ 3 - 0
resources/views/customer/menu.blade.php

@@ -9,6 +9,9 @@
             <li class="nav-item">
                 <a class="nav-link" href="{{url('customer/finance/instantBill')}}" :class="{active:isActive('finance',2)}">财务</a>
             </li>
+            <li class="nav-item">
+                <a class="nav-link" href="{{url('customer/customer')}}" :class="{active:isActive('customer',2)}">客户</a>
+            </li>
             <li class="nav-item">
                 <a class="nav-link" href="{{url('customer/relating')}}" :class="{active:isActive('relating',2)}">相关设置</a>
             </li>

+ 0 - 15
resources/views/maintenance/customer/menu.blade.php

@@ -1,15 +0,0 @@
-<div class="container-fluid nav3">
-    <div class="card menu-third" >
-        <ul class="nav nav-pills">
-            @can('客户-查询')
-            <li class="nav-item">
-                <a class="nav-link" href="{{url('maintenance/customer')}}" :class="{active:isActive('',3)}">查询</a>
-            </li> @endcan
-            @can('客户-录入')
-            <li class="nav-item">
-                <a class="nav-link" href="{{url('maintenance/customer/create')}}" :class="{active:isActive('create',3)}">录入</a>
-            </li> @endcan
-            {{$slot}}
-        </ul>
-    </div>
-</div>

+ 0 - 4
resources/views/maintenance/menu.blade.php

@@ -26,10 +26,6 @@
                 <li class="nav-item">
                     <a class="nav-link text-muted" href="{{url('maintenance/warehouse')}}" :class="{active:isActive('warehouse',2)}">仓库</a>
                 </li> @endcan
-            @can('客户')
-                <li class="nav-item">
-                    <a class="nav-link text-dark" href="{{url('maintenance/customer')}}" :class="{active:isActive('customer',2)}">客户</a>
-                </li> @endcan
             @can('货主')
                 <li class="nav-item">
                     <a class="nav-link text-dark" href="{{url('maintenance/owner')}}" :class="{active:isActive('owner',2)}">货主</a>

+ 2 - 2
resources/views/maintenance/priceModel/logistic/index.blade.php

@@ -200,7 +200,7 @@
                     })
                         .then(res=>{
                             if (res.data.success) {
-                                this.details[this.id] = res.data.data;
+                                this.details[this.models[this.index]["id"]] = res.data.data;
                                 this.errors = res.data.errors;
                                 tempTip.cancelWaitingTip();
                                 tempTip.setDuration(2000);
@@ -242,7 +242,7 @@
                         detail.rate = $("#rate-"+detail.id).attr('data');
                         detail.edit = false;
                     }else{
-                        this.$delete(this.details[this.id],index);
+                        this.$delete(this.details[this.models[this.index]["id"]],index);
                     }
                     this.$forceUpdate();
                 },

+ 1 - 1
resources/views/order/index/delivering.blade.php

@@ -870,7 +870,7 @@
                                 if (order.orderno == code){
                                     if (order.soreference5) {
                                         text += order.soreference5;
-                                        if(i!==this.checkData.length-1)text += ",";
+                                        if(i!==this.checkData.length-1)text += "\r\n";
                                     }
                                     return true;
                                 }

+ 1 - 1
resources/views/rejected/search/general.blade.php

@@ -316,7 +316,7 @@
                         this.rejectedBills.some(bill=>{
                             if (bill.id == id){
                                 text += bill.logistic_number_return;
-                                if (i!==this.rejectedBills_checkBoxes.length-1)text += ",";
+                                if (i!==this.rejectedBills_checkBoxes.length-1)text += "\r\n";
                                 return true;
                             }
                         });

+ 6 - 1
routes/web.php

@@ -184,7 +184,6 @@ Route::group(['prefix'=>'maintenance'],function(){
     Route::resource('tutorial', 'TutorialController');
     Route::resource('userLabor','UserLaborController');
     Route::resource('paperBox', 'PaperBoxController');
-    Route::resource('customer', 'CustomerBaseController');
     Route::resource('userOwnerGroup', 'UserOwnerGroupController');
     Route::resource('processMethod', 'ProcessMethodController');
     Route::resource('feature', 'FeatureController');
@@ -597,6 +596,12 @@ Route::group(['prefix'=>'customer'],function(){
         Route::post('billConfirm','CustomerController@billConfirm');
     });
     Route::get('relating',function (){return view('customer.relating');});
+    Route::group(['prefix' => 'customer'], function () {
+        Route::resource('customer_log_statuses', 'CustomerLogStatusesController', ['only' => ['index', 'show', 'create', 'store', 'update', 'edit', 'destroy']]);
+        Route::resource('customer_logs', 'CustomerLogsController', ['only' => ['index', 'show', 'create', 'store', 'update', 'edit', 'destroy']]);
+    });
+    Route::resource('customer', 'CustomerBaseController');
+
 });
 
 /** 站管理 */

+ 21 - 0
tests/Unit/CustomerLogTest.php

@@ -0,0 +1,21 @@
+<?php
+
+
+use App\CustomerLog;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+use Tests\TestCase;
+
+class CustomerLogTest extends TestCase
+{
+    use RefreshDatabase;
+
+    /**
+     * @test
+     */
+    public function customerLog_belongsTo_customerLogStatus()
+    {
+        $customerLog =  factory(CustomerLog::class)->create();
+        $this->assertInstanceOf(BelongsTo::class, $customerLog->customerLogStatus());
+    }
+}