LD пре 5 година
родитељ
комит
cdba614427
35 измењених фајлова са 1316 додато и 18 уклоњено
  1. 37 0
      app/Batch.php
  2. 88 0
      app/Http/Controllers/BatchController.php
  3. 85 0
      app/Http/Controllers/OrderBinController.php
  4. 85 0
      app/Http/Controllers/OrderCommodityController.php
  5. 1 1
      app/Http/Controllers/RejectedBillItemController.php
  6. 85 0
      app/Http/Controllers/SortingStationController.php
  7. 4 10
      app/Http/Controllers/TestController.php
  8. 204 0
      app/Http/Controllers/api/thirdPart/flux/SortingController.php
  9. 179 0
      app/Http/Controllers/api/thirdPart/haochuang/SortingController.php
  10. 13 0
      app/Order.php
  11. 12 0
      app/OrderBin.php
  12. 35 0
      app/OrderCommodity.php
  13. 1 1
      app/Providers/AppServiceProvider.php
  14. 4 1
      app/Providers/RouteServiceProvider.php
  15. 41 0
      app/SortingStation.php
  16. 18 5
      config/api.php
  17. 12 0
      database/factories/BatchFactory.php
  18. 12 0
      database/factories/OrderBinFactory.php
  19. 12 0
      database/factories/OrderCommodityFactory.php
  20. 12 0
      database/factories/SortingStationFactory.php
  21. 37 0
      database/migrations/2020_11_10_135835_create_batches_table.php
  22. 33 0
      database/migrations/2020_11_10_162349_create_order_bins_table.php
  23. 38 0
      database/migrations/2020_11_10_164914_create_sorting_stations_table.php
  24. 16 0
      database/seeds/BatchSeeder.php
  25. 16 0
      database/seeds/OrderBinSeeder.php
  26. 16 0
      database/seeds/OrderCommoditySeeder.php
  27. 16 0
      database/seeds/SortingStationSeeder.php
  28. 37 0
      resources/views/maintenance/batch/create.blade.php
  29. 43 0
      resources/views/maintenance/batch/edit.blade.php
  30. 81 0
      resources/views/maintenance/batch/index.blade.php
  31. 12 0
      resources/views/maintenance/batch/menu.blade.php
  32. 7 0
      routes/api/thirdPart/flux.php
  33. 17 0
      routes/api/thirdPart/haochuang.php
  34. 3 0
      tests/sortingFluxNewBatch.http
  35. 4 0
      tests/sortingHaochuangProcess.http

+ 37 - 0
app/Batch.php

@@ -0,0 +1,37 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Batch extends Model
+{
+    protected $fillable = [
+        'id','code','type', 'wms_type', 'status', 'wms_status', 'wms_created_at',
+    ];
+    public function orders(){
+        return $this->hasMany('App\Order','batch_id','id');
+    }
+    public function setProcessed(){
+        $this['status'] = '已处理';
+        $this->orders()->each(function (Order $order){
+            $order->setProcessed();
+        });
+        $this->update();
+    }
+    public function assignBins(){
+        $this->orders()->each(function (Order $order,$i){
+            $bin=new OrderBin(['order_id'=>$order['id'],'number'=>($i+1)]);
+            $bin->save();
+        });
+        return $this->orders()->count();
+    }
+    public function delete()
+    {
+        $this->orders()->each(function(Order $order){
+            $order->delete();
+        });
+        return parent::delete(); // TODO: Change the autogenerated stub
+    }
+
+}

+ 88 - 0
app/Http/Controllers/BatchController.php

@@ -0,0 +1,88 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Batch;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Gate;
+
+class BatchController extends Controller
+{
+    /**
+     * Display a listing of the resource.
+     *
+     * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Http\Response|\Illuminate\View\View
+     */
+    public function index()
+    {
+        if(!Gate::allows('波次-查询')){ return redirect(url('/'));  }
+        $batches=Batch::orderBy('id','desc')->paginate(50);
+        return view('maintenance.batch.index',compact('batches'));
+    }
+
+    /**
+     * Show the form for creating a new resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function create()
+    {
+        //
+    }
+
+    /**
+     * Store a newly created resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @return \Illuminate\Http\Response
+     */
+    public function store(Request $request)
+    {
+        //
+    }
+
+    /**
+     * Display the specified resource.
+     *
+     * @param  \App\Batch  $batch
+     * @return \Illuminate\Http\Response
+     */
+    public function show(Batch $batch)
+    {
+        //
+    }
+
+    /**
+     * Show the form for editing the specified resource.
+     *
+     * @param  \App\Batch  $batch
+     * @return \Illuminate\Http\Response
+     */
+    public function edit(Batch $batch)
+    {
+        //
+    }
+
+    /**
+     * Update the specified resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \App\Batch  $batch
+     * @return \Illuminate\Http\Response
+     */
+    public function update(Request $request, Batch $batch)
+    {
+        //
+    }
+
+    /**
+     * Remove the specified resource from storage.
+     *
+     * @param  \App\Batch  $batch
+     * @return \Illuminate\Http\Response
+     */
+    public function destroy(Batch $batch)
+    {
+        //
+    }
+}

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

@@ -0,0 +1,85 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\OrderBin;
+use Illuminate\Http\Request;
+
+class OrderBinController extends Controller
+{
+    /**
+     * Display a listing of the resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function index()
+    {
+        //
+    }
+
+    /**
+     * Show the form for creating a new resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function create()
+    {
+        //
+    }
+
+    /**
+     * Store a newly created resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @return \Illuminate\Http\Response
+     */
+    public function store(Request $request)
+    {
+        //
+    }
+
+    /**
+     * Display the specified resource.
+     *
+     * @param  \App\OrderBin  $orderBin
+     * @return \Illuminate\Http\Response
+     */
+    public function show(OrderBin $orderBin)
+    {
+        //
+    }
+
+    /**
+     * Show the form for editing the specified resource.
+     *
+     * @param  \App\OrderBin  $orderBin
+     * @return \Illuminate\Http\Response
+     */
+    public function edit(OrderBin $orderBin)
+    {
+        //
+    }
+
+    /**
+     * Update the specified resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \App\OrderBin  $orderBin
+     * @return \Illuminate\Http\Response
+     */
+    public function update(Request $request, OrderBin $orderBin)
+    {
+        //
+    }
+
+    /**
+     * Remove the specified resource from storage.
+     *
+     * @param  \App\OrderBin  $orderBin
+     * @return \Illuminate\Http\Response
+     */
+    public function destroy(OrderBin $orderBin)
+    {
+        //
+    }
+}

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

@@ -0,0 +1,85 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\OrderCommodity;
+use Illuminate\Http\Request;
+
+class OrderCommodityController extends Controller
+{
+    /**
+     * Display a listing of the resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function index()
+    {
+        //
+    }
+
+    /**
+     * Show the form for creating a new resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function create()
+    {
+        //
+    }
+
+    /**
+     * Store a newly created resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @return \Illuminate\Http\Response
+     */
+    public function store(Request $request)
+    {
+        //
+    }
+
+    /**
+     * Display the specified resource.
+     *
+     * @param  \App\OrderCommodity  $orderCommodity
+     * @return \Illuminate\Http\Response
+     */
+    public function show(OrderCommodity $orderCommodity)
+    {
+        //
+    }
+
+    /**
+     * Show the form for editing the specified resource.
+     *
+     * @param  \App\OrderCommodity  $orderCommodity
+     * @return \Illuminate\Http\Response
+     */
+    public function edit(OrderCommodity $orderCommodity)
+    {
+        //
+    }
+
+    /**
+     * Update the specified resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \App\OrderCommodity  $orderCommodity
+     * @return \Illuminate\Http\Response
+     */
+    public function update(Request $request, OrderCommodity $orderCommodity)
+    {
+        //
+    }
+
+    /**
+     * Remove the specified resource from storage.
+     *
+     * @param  \App\OrderCommodity  $orderCommodity
+     * @return \Illuminate\Http\Response
+     */
+    public function destroy(OrderCommodity $orderCommodity)
+    {
+        //
+    }
+}

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

@@ -327,7 +327,7 @@ class RejectedBillItemController extends Controller
         return Validator::make($data, [
             'id_rejected_bill' => ['required', 'numeric', 'exists:rejected_bills,id'],
             'barcode_goods' => ['required', 'string','max:60'],
-            'name_goods' => ['nullable', 'string','max:50'],
+            'name_goods' => ['nullable', 'string','max:219'],
             'amount' => ['numeric','required', 'max:99999'],
             'id_quality_label' => ['required','numeric',  'max:11'],
             'batch_number' => ['string', 'nullable',],

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

@@ -0,0 +1,85 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\SortingStation;
+use Illuminate\Http\Request;
+
+class SortingStationController extends Controller
+{
+    /**
+     * Display a listing of the resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function index()
+    {
+        //
+    }
+
+    /**
+     * Show the form for creating a new resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function create()
+    {
+        //
+    }
+
+    /**
+     * Store a newly created resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @return \Illuminate\Http\Response
+     */
+    public function store(Request $request)
+    {
+        //
+    }
+
+    /**
+     * Display the specified resource.
+     *
+     * @param  \App\SortingStation  $sortingStation
+     * @return \Illuminate\Http\Response
+     */
+    public function show(SortingStation $sortingStation)
+    {
+        //
+    }
+
+    /**
+     * Show the form for editing the specified resource.
+     *
+     * @param  \App\SortingStation  $sortingStation
+     * @return \Illuminate\Http\Response
+     */
+    public function edit(SortingStation $sortingStation)
+    {
+        //
+    }
+
+    /**
+     * Update the specified resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \App\SortingStation  $sortingStation
+     * @return \Illuminate\Http\Response
+     */
+    public function update(Request $request, SortingStation $sortingStation)
+    {
+        //
+    }
+
+    /**
+     * Remove the specified resource from storage.
+     *
+     * @param  \App\SortingStation  $sortingStation
+     * @return \Illuminate\Http\Response
+     */
+    public function destroy(SortingStation $sortingStation)
+    {
+        //
+    }
+}

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

@@ -139,16 +139,10 @@ class TestController extends Controller
 
     function wmsSql()
     {
-        $logisticNumber='YT3135994475841';
-        dd(OracleDOCOrderHeader::query()->with('actAllocationDetails','oracleBASCode')
-            ->whereHas('actAllocationDetails',function($query)use($logisticNumber){
-                $query->where('picktotraceid',$logisticNumber);
-            })->orWhere('soreference5',$logisticNumber)->sql());
-        $re= OracleDOCOrderHeader::query()->with('actAllocationDetails','oracleBASCode')
-            ->whereHas('actAllocationDetails',function($query)use($logisticNumber){
-                $query->where('picktotraceid',$logisticNumber);
-            })->orWhere('soreference5',$logisticNumber)->first();
-        dd($re);
+        $owner=Owner::first();
+//        $owner['phone_number'] ?? $owner['phone_number'] = '31115';
+//        $owner->update();
+        dd($owner);
     }
     function issues()
     {

+ 204 - 0
app/Http/Controllers/api/thirdPart/flux/SortingController.php

@@ -0,0 +1,204 @@
+<?php
+
+namespace App\Http\Controllers\Api\thirdPart\flux;
+
+use App\Batch;
+use App\Commodity;
+use App\Http\Controllers\Controller;
+use App\Order;
+use App\OrderBin;
+use App\OrderCommodity;
+use App\Owner;
+use Carbon\Carbon;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Validator;
+use Zttp\Zttp;
+
+class SortingController extends Controller
+{
+
+    /**
+     * 新增被通知的波次列表(一个以上的波次),并且保存在本地数据库,供get波次使用
+     * 接收:request[(下边newBatch的字段)]
+     * 返回:Response{return{returnFlag(1/0),returnCode(0000/0001),returnDesc,resultInfo}}
+     */
+    public function newBatch(Request $request)
+    {
+        $requestArr=$request->all();
+        app('LogService')->log(__METHOD__, 'issued_' . __FUNCTION__, json_encode($request->all()));
+        !$requestArr?$requestArr=json_decode($request->getContent(),true):false;
+        $errors=$this->newBatchValidator($requestArr)->errors();
+        if(count($errors)>0){
+            app('LogService')->log(__METHOD__, 'error' . __FUNCTION__, 'fields wrong, see Errors report please.'.'|'.json_encode($request->all()).'|'.json_encode($errors));
+            return response()->json(['Response'=>['return'=>['returnFlag'=>'0','returnCode'=>'0001',
+                'returnDesc'=>':Failure','resultInfo'=>'','errors'=>$errors]]])->setEncodingOptions(JSON_UNESCAPED_UNICODE);
+        }
+        $requestBatches = $requestArr['request']?? '';
+        foreach ($requestBatches as $requestBatch){
+            $requestBatch['edittime']&&strpos(trim($requestBatch['edittime']),' ')?$editTimeFormat='Y-m-d H:i:s':$editTimeFormat='YmdHis';
+            $batch=new Batch([
+                'code' => $requestBatch['waveno'],
+                'wms_type' => $requestBatch['batch_type']??'',
+                'wms_status' => $requestBatch['docstatus']??'',
+                'status' => '未处理',
+                'wms_created_at' => $requestBatch['edittime']?Carbon::createFromFormat($editTimeFormat,$requestBatch['edittime']):'',
+            ]);
+            $batch->save();
+            foreach($requestBatch['order_list'] as $requestOrder){
+                $owner=Owner::query()->where('code',$requestOrder['customerid'])->first();
+                $order=Order::query()->where('code',$requestOrder['docno'])->first();
+                if(!$order){
+                    $order=new Order([
+                        'batch_id' => $batch['id'],
+                        'code' => $requestOrder['docno'],
+                        'owner_id' => $owner['id'],
+                        'wms_status' => $requestOrder['docstatus']??'波次下发',
+                        'status' => '未处理',
+                    ]);
+                }else{
+                    $order['batch_id']= $order['batch_id']??$batch['id'] ;
+                    $order['owner_id']=$order['owner_id']??$owner['owner_id'];
+                    $order['wms_status']=$order['wms_status']??$requestOrder['docstatus']??'波次下发';
+                    $order['status']=$order['status']??'未处理';
+                }
+                $order->save();
+                $orderBin=OrderBin::query()->firstOrCreate([
+                    'order_id' => $order['id'],
+                    'number' => $requestOrder['reservedfield01'],
+                ]);
+                foreach($requestOrder['barcode_list'] as $requestBarcode){
+                    $commodity=Commodity::newCommodityBy_BarcodeOwnerIdNameSku($requestBarcode['alternate_sku1'],$owner['id'],$requestBarcode['descr_c'],$requestBarcode['sku']);
+                    $orderCommodity = new OrderCommodity([
+                        'order_id' => $order['id'],
+                        'commodity_id' => $commodity['id'],
+                        'amount' => $requestBarcode['fmqty_each']??0,
+                        'wms_ptltaskid' => $requestBarcode['ptltaskid'],
+                    ]);
+                    $orderCommodity->save();
+                }
+            }
+        }
+        return response()->json(['Response'=>['return'=>['returnFlag'=>'1','returnCode'=>'0000',
+            'returnDesc'=>'消息处理成功:Success','resultInfo'=>'']]])->setEncodingOptions(JSON_UNESCAPED_UNICODE);
+    }
+
+    protected function newBatchValidator(array $data)
+    {
+        return Validator::make($data, [
+            'request' => ['required', 'array', 'min:1'],
+            'request.*.waveno' => ['required', 'string', 'max:191','unique:batches,code'],
+            'request.*.taskprocess' => ['nullable', 'string', 'max:191'],
+            'request.*.edittime' => ['nullable', 'string', 'max:191'],
+            'request.*.batch_type' => ['nullable', 'string', 'max:191'],
+            'request.*.docstatus' => ['nullable', 'string', 'max:191'],
+            'request.*.batch_created_at' => ['nullable', 'string', 'max:191'],
+            'request.*.order_list' => ['required', 'array', 'min:1'],
+            'request.*.order_list.*.docno' => ['required', 'string', 'max:191'],
+            'request.*.order_list.*.customerid' => ['required', 'string', 'max:191','exists:owners,code'],
+            'request.*.order_list.*.docstatus' => ['nullable', 'string', 'max:191'],
+            'request.*.order_list.*.reservedfield01' => ['required',  'max:191'],
+            'request.*.order_list.*.barcode_list' => ['required_unless:request.*.order_list.*.docstatus,90', 'array'],
+            'request.*.order_list.*.barcode_list.*.alternate_sku1' => ['required', 'string', 'max:191'],
+            'request.*.order_list.*.barcode_list.*.descr_c' => ['required', 'string', 'max:191'],
+            'request.*.order_list.*.barcode_list.*.fmqty_each' => ['required', 'numeric'],
+            'request.*.order_list.*.barcode_list.*.ptltaskid' => ['required', 'string', 'max:191'],
+        ]);
+    }
+
+    /**
+     * 新增被通知的取消订单
+     * 接收:docno(订单号),docstatus(状态,唯一:canceled)
+     * 返回:Response{return{returnFlag(1/0),returnCode(0000/0001),returnDesc,resultInfo}} 1和0000成功,0和0001失败
+     */
+    public function newCanceledOrder(Request $request)
+    {
+        $requestArr=$request->all();
+        !$requestArr?$requestArr=json_decode($request->getContent(),true):false;
+        Controller::logS(__METHOD__,__FUNCTION__,"接收到WMS下发取消单:".$request->getContent());
+        $errors=$this->newCanceledOrderValidator($requestArr)->errors();
+        if(count($errors)>0){
+            app('LogService')->log(__METHOD__, 'error' . __FUNCTION__, 'fields wrong, see Errors report please.'.'|'.json_encode($request->all()).'|'.json_encode($errors));
+            return response()->json(['Response'=>['return'=>['returnFlag'=>'0','returnCode'=>'0001',
+                'returnDesc'=>':Failure','resultInfo'=>'','errors'=>$errors]]])->setEncodingOptions(JSON_UNESCAPED_UNICODE);
+        }
+        $order=Order::query()->where('code',$requestArr['docno'])->first();
+        $order->cancel();
+        return response()->json(['Response'=>['return'=>['returnFlag'=>'1','returnCode'=>'0000',
+            'returnDesc'=>'消息处理成功:Success','resultInfo'=>'']]])->setEncodingOptions(JSON_UNESCAPED_UNICODE);
+    }
+
+    protected function newCanceledOrderValidator(array $data)
+    {
+        return Validator::make($data, [
+            'docno' => ['required', 'string', 'max:191', 'exists:orders,code'],
+            'docstatus' => ['required', 'string', 'max:191'],
+        ]);
+    }
+
+
+
+    public function informBinAssignment(Batch $batch)
+    {
+        $apiUrl=config('api.flux.inform.binAssignment');
+        if(config('api.faking')){$apiUrl=url(config('api.fake_flux_informBinAssignment'));}
+        $sendingData=['request'=>[]];
+        $batch->orders()->each(function(Order $order)use($batch,&$sendingData){
+            $sendingData['request'][]=[
+                'batch_id'=>$batch['code'],
+                'status'=>'00',//原来是beforeSorting,改成了00
+                'order_id'=>$order['code'],
+                'bin'=>$order->bin()->first()['number']
+            ];
+        });
+        $response=null;
+        try {
+            $response=Zttp::post($apiUrl,$sendingData);
+        }catch (\Exception $e){
+            app('LogService')->log(__METHOD__,'error_'.__FUNCTION__,'catch:'.$e->getMessage());
+            return false;
+        }
+        $reJson=$response->json();
+        if(!$reJson || (!isset($reJson['Response'])||!isset($reJson['Response']['return'])) || $reJson['Response']['return']['returnFlag']!='1'){
+            app('LogService')->log(__METHOD__,'error_'.__FUNCTION__,'$sending:'.json_encode($sendingData).'$response:'.$response->body());
+            return false;
+        }
+        return true;
+    }
+
+
+    public function informBatchFinished(Batch $batch){
+        $sendingData=['request'=>[]];
+        $batch->orders()->each(function (Order $order)use($batch,&$sendingData){
+            $order->orderCommodities()->each(function (OrderCommodity $orderCommodity)use($batch,$order,&$sendingData){
+                $bin=$order->bin()->first();
+                $sendingData['request'][]=[
+                    'ptltaskid'=>$orderCommodity['wms_ptltaskid'],
+                    'batch_id'=>$batch['code'],
+                    'status'=>'80', //原来是isSorted,改成了80
+                    'order_id'=>$order['code'],
+                    'bin'=>$bin?$bin['number']:'',
+                    'docstatus'=>'success',
+                    'sku'=>$orderCommodity->commodity()->first()?$orderCommodity->commodity()->first()['sku']:'',
+                    'amount'=>'0',
+                ];
+            });
+        });
+        $informApiUrl = config('api.flux.inform.batchFinished');
+        try{
+            $response=Zttp::post($informApiUrl,$sendingData);
+            $result=$response->json();
+            if(!$result||!$result['Response']['return']['returnFlag']||$result['Response']['return']['returnCode']!='0000'){
+                app('LogService')->log(__METHOD__,'error_'.__FUNCTION__,'$sending:'.json_encode($sendingData).'|$response:'.$response->body());
+                return false;
+            }
+        }
+        catch(\Exception $e){
+            app('LogService')->log(__METHOD__,'error_'.__FUNCTION__,'catch:'.$e->getMessage());
+            return false;
+        }
+        app('LogService')->log(__METHOD__,'temp_'.__FUNCTION__,'$sending:'.json_encode($sendingData).'|$response:'.$response->body());
+        return true;
+    }
+
+
+}

+ 179 - 0
app/Http/Controllers/api/thirdPart/haochuang/SortingController.php

@@ -0,0 +1,179 @@
+<?php
+
+namespace App\Http\Controllers\Api\thirdPart\haochuang;
+
+use App\Batch;
+use App\CommodityBarcode;
+use App\Http\Controllers\Controller;
+use App\Order;
+use App\OrderCommodity;
+use App\SortingStation;
+use App\User;
+use App\UserToken;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Hash;
+use Illuminate\Support\Facades\Validator;
+
+class SortingController extends Controller
+{
+
+    function login(Request $request){
+        $name = $request->input('name');
+        $password = $request->input('password');
+        $station_id = $request->input('station_id');
+        $errors=$this->loginValidator($request->all())->errors();
+        if(count($errors)>0){
+            app('LogService')->log(__METHOD__, 'error' . __FUNCTION__, json_encode($request->all()).'|'.json_encode($errors));
+            return response()->json(['result'=>'failure','fail_info'=>'error','errors'=>$errors])->setEncodingOptions(JSON_UNESCAPED_UNICODE);
+        }
+        $user=User::query()->where('name',$name)->first();
+        if(!$user||!Hash::check($password, $user['password'])){
+            return ['result'=>'failure','fail_info'=>'认证错误'];
+        }
+        $station = SortingStation::findOrCreate($station_id);
+        $station->login();
+        return ['result'=>'success','token'=>$user->token()];
+    }
+
+    protected function loginValidator(array $data)
+    {
+        return Validator::make($data, [
+            'name' => ['required', 'string', 'max:191'],
+            'password' => ['required', 'string', 'max:191'],
+            'station_id' => ['required', 'string', 'max:191'],
+        ],[
+            'required' => ':attribute 不能为空',
+        ],[
+            'name' => '用户名',
+            'password' => '密码',
+            'station_id' => '设备ID',
+        ]);
+    }
+
+    function process(Request $request){
+        $token = trim($request->input('token'));
+        $station_id = $request->input('station_id');
+        $batch_id = $request->input('batch_id');
+        $errors=$this->processValidator($request->all())->errors();
+        if(count($errors)>0){
+            app('LogService')->log(__METHOD__, 'error' . __FUNCTION__, json_encode($request->all()).'|'.json_encode($errors));
+            return response()->json(['result'=>'failure','fail_info'=>'error','errors'=>$errors])->setEncodingOptions(JSON_UNESCAPED_UNICODE);
+        }
+//        if(!UserToken::getUser($token)){
+//            return ['result'=>'unauthority','fail_info'=>'无效令牌或令牌过期'];
+//        }
+
+        /** @var Batch $batch */
+        $batch=Batch::query()->where('code',$batch_id)->orderBy('id','desc')->first();
+        $data=[
+            'result'=>'success',
+            'station_id'=>$station_id,
+            'batch_id'=>$batch_id,
+            'orders'=>[]
+        ];
+        $ordersSorted=$batch->orders()->get()->sortBy(function(Order $order){
+            return $order->bin()->first()['number'];
+        });
+        $ordersSorted->each(function(Order $order)use(&$data,$request){
+            if($order['status']=='取消')return;
+            $orderData=[
+                'order_id'=>$order['code'],
+                'owner'=>$order->owner()->first()['code'],
+                'status'=>$order['status']=='未处理'?'available':$order['status'],
+                'created_at'=>$order['created_at']->toDateTimeString(),
+                'bin'=>$order->bin()->first()['number'],
+                'barcodes'=>[]
+            ];
+            $order->orderCommodities()->each(function(OrderCommodity $orderCommodity)use(&$orderData,$request){
+                $commodity=$orderCommodity->commodity()->first();
+                if(!$commodity){
+                    app('LogService')->log(__METHOD__, 'error' . __FUNCTION__, '播种位数据准备出错,找不到订单对应的Commodity id的对象'.$orderCommodity['commodity_id'].',是否表数据在波次生成后丢失?'.json_encode($request->all()));
+                }
+                $barcodeStr=$commodity->barcodes()->get()->map(function(CommodityBarcode $barcode){
+                    return $barcode['code'];
+                })->filter(function($code){
+                    return $code&&(!preg_match('/[\x{4e00}-\x{9fa5}]/u',$code));
+                })->join(',');
+                $orderData['barcodes'][]=[
+                    'id'=>$orderCommodity['id'],
+                    'barcode_id'=>$barcodeStr,
+                    'name'=>$commodity['name'],
+                    'sku'=>$commodity['sku'],
+                    'amount'=>$orderCommodity['amount'],
+                    'location'=>'A1-01-C2',
+                ];
+            });
+            $data['orders'][]=$orderData;
+        });
+
+        $sendToWms=(new \App\Http\Controllers\Api\thirdPart\flux\SortingController())->informBinAssignment($batch);
+        if(!$sendToWms){
+            app('LogService')->log(__METHOD__, 'error' . __FUNCTION__, '播种位发送给WMS错误:'.json_encode($request->all()));
+            return response()->json(['result'=>'failure','fail_info'=>'播种位发送给WMS错误,请联系管理员检查错误'])->setEncodingOptions(JSON_UNESCAPED_UNICODE);
+        }
+
+        $station = SortingStation::findOrCreate($station_id);
+        $station->setProcessingBatch($batch);
+        return $data;
+    }
+
+    protected function processValidator(array $data)
+    {
+        return Validator::make($data, [
+            'token' => ['required', 'string', 'max:191'],
+            'station_id' => ['required', 'string', 'max:191'],
+            'batch_id' => ['required', 'string', 'max:191','exists:batches,code'],
+        ],[
+            'required' => ':attribute 不能为空',
+            'exists' => ':attribute 不存在',
+        ],[
+            'station_id' => '设备ID',
+            'batch_id' => '波次号',
+        ]);
+    }
+
+    function done(Request $request){
+        $token = $request->input('token');
+        $station_id = $request->input('station_id');
+        $batch_id = $request->input('batch_id');
+        $errors=$this->doneValidator($request->all())->errors();
+        $failInfo='';
+        foreach ($errors as $error){$failInfo.=$error[0].'; ';}
+        if(count($errors)>0){
+            app('LogService')->log(__METHOD__, 'error' . __FUNCTION__, json_encode($request->all()).'|'.json_encode($errors));
+            return response()->json(['result'=>'failure','fail_info'=>$failInfo,'errors'=>$errors])->setEncodingOptions(JSON_UNESCAPED_UNICODE);
+        }
+        if(!UserToken::getUser($token)){
+            return ['result'=>'unauthority','fail_info'=>'无效令牌或令牌过期'];
+        }
+        $batch=Batch::query()->where('code',$batch_id)->first();
+        if($batch->status=='已处理'){
+            app('LogService')->log(__METHOD__,'alert_'.__FUNCTION__,$batch['code'].'重复发送,波次已处理');
+            return ['result'=>'failure','fail_info'=>$batch['code'].'重复发送,波次已处理'];
+        }
+        $sendToWms=(new \App\Http\Controllers\Api\thirdPart\flux\SortingController())->informBatchFinished($batch);
+        if(!$sendToWms){
+            app('LogService')->log(__METHOD__, 'error' . __FUNCTION__, '发送给WMS错误:'.json_encode($request->all()));
+            return response()->json(['result'=>'failure','fail_info'=>'发送给WMS错误,请联系管理员检查错误'])->setEncodingOptions(JSON_UNESCAPED_UNICODE);
+        }
+        $batch->setProcessed();
+        $station = SortingStation::query()->where('name',$station_id)->first();
+        $station->clearProcessingBatch();
+        return ['result'=>'success','batch_id'=>$batch_id];
+    }
+    protected function doneValidator(array $data)
+    {
+        return Validator::make($data, [
+            'token' => ['required', 'string', 'max:191'],
+            'station_id' => ['required', 'string', 'max:191','exists:sorting_stations,name'],
+            'batch_id' => ['required', 'string', 'max:191','exists:batches,code'],
+        ],[
+            'required' => ':attribute 不能为空',
+            'exists' => ':attribute 不存在',
+        ],[
+            'station_id' => '设备ID',
+            'batch_id' => '波次号',
+        ]);
+    }
+
+}

+ 13 - 0
app/Order.php

@@ -11,6 +11,7 @@ class Order extends Model
     use ModelTimeFormat;
 
     protected $fillable = [
+        'id', 'batch_id',  'owner_id', 'status',
         'created_at', 'code', 'shop_id', 'owner_id', 'client_code',
         'logistic_id', 'consignee_name', 'consignee_phone', 'province',
         'city', 'district', 'address', 'wms_status','warehouse_id','wms_edittime'];
@@ -58,6 +59,18 @@ class Order extends Model
         return $this->hasOne(Warehouse::class, 'id', 'owner_id');
 
     }
+    public function orderCommodities(){
+        return $this->hasMany('App\OrderCommodity','order_id','id');
+    }
+    public function bin(){
+        $bin= $this->hasOne('App\OrderBin','order_id','id');
+        if($bin->count()>0)return $bin;
+        $this->batch()->first()->assignBins();
+        return $this->hasOne('App\OrderBin','order_id','id');
+    }
+    public function batch(){
+        return $this->belongsTo('App\Batch', 'batch_id','id');
+    }
 
     public function getLogisticNumbersAttribute()
     {

+ 12 - 0
app/OrderBin.php

@@ -0,0 +1,12 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class OrderBin extends Model
+{
+    protected $fillable = [
+        'order_id', 'number',
+    ];
+}

+ 35 - 0
app/OrderCommodity.php

@@ -0,0 +1,35 @@
+<?php
+
+namespace App;
+
+use App\Http\Controllers\Controller;
+use Illuminate\Database\Eloquent\Model;
+
+class OrderCommodity extends Model
+{
+    protected $fillable = [
+        'id', 'order_id','commodity_id', 'amount','wms_ptltaskid'
+    ];
+    protected $appends=['barcode','name','sku'];
+    public function order(){
+        return $this->belongsTo('App\Order', 'order_id','id');
+    }
+    public function commodity(){
+        return $this->hasOne('\App\Commodity','id','commodity_id');
+    }
+    public function getBarcodeAttribute(){
+        $commodity=$this->commodity()->first();
+        if($commodity)return $commodity['barcode'];
+        return '';
+    }
+    public function getNameAttribute(){
+        $commodity=$this->commodity()->first();
+        if($commodity)return $commodity['name'];
+        return '';
+    }
+    public function getSkuAttribute(){
+        $commodity=$this->commodity()->first();
+        if($commodity)return $commodity['sku'];
+        return '';
+    }
+}

+ 1 - 1
app/Providers/AppServiceProvider.php

@@ -72,7 +72,7 @@ class AppServiceProvider extends ServiceProvider
     {
         //
         app()->singleton('OrderIssuePerformanceService',OrderIssuePerformanceService::class);
-        app()->singleton('inventoryCompareService',InventoryCompareService::class);
+        app()->singleton('InventoryCompareService',InventoryCompareService::class);
     }
 
     /**

+ 4 - 1
app/Providers/RouteServiceProvider.php

@@ -90,9 +90,12 @@ class RouteServiceProvider extends ServiceProvider
         Route::prefix('api/thirdPart/haiq')
             ->namespace('App\Http\Controllers\api\thirdPart\haiq')
             ->group(base_path('routes/api/thirdPart/haiq.php'));
-
         Route::prefix('api/thirdPart/goodscan')
             ->namespace('App\Http\Controllers\api\thirdPart\goodscan')
             ->group(base_path('routes/api/thirdPart/goodscan.php'));
+        Route::prefix('api/thirdPart/haochuang')
+            ->middleware('api')
+            ->namespace('App\Http\Controllers\Api\thirdPart\haochuang')
+            ->group(base_path('routes/api/thirdPart/haochuang.php'));
     }
 }

+ 41 - 0
app/SortingStation.php

@@ -0,0 +1,41 @@
+<?php
+
+namespace App;
+
+use App\Http\Controllers\Controller;
+use Carbon\Carbon;
+use Illuminate\Database\Eloquent\Model;
+use mysql_xdevapi\Exception;
+use Zttp\Zttp;
+
+class SortingStation extends Model
+{
+    protected $fillable = [
+        'name','type', 'bin_amount','is_occupied','is_online','processing_batch_id','login_at'
+    ];
+    static public function findOrCreate($name){
+        $station=SortingStation::where('name',$name)->first();
+        if(!$station){
+            $station=new SortingStation(['name'=>$name]);
+            $station->save();
+        }
+        return $station;
+    }
+    public function login(){
+        $this['login_at'] = Carbon::now();
+        $this['is_online'] = '是';
+        $this->update();
+    }
+    public function setProcessingBatch(Batch $batch){
+        $this['processing_batch_id'] = $batch['id'];
+        $this['is_occupied'] = '是';
+        $this->login();
+        $this->update();
+    }
+    public function clearProcessingBatch(){
+        $this['processing_batch_id'] = null;
+        $this['is_occupied'] = '否';
+        $this->login();
+        $this->update();
+    }
+}

+ 18 - 5
config/api.php

@@ -12,12 +12,12 @@ return [
     'sign_key_rejected_send_jianshang' => 'ymgYuN01D3UCZneZ53wGC0suOIUPmLgY',
 
 
-    /** Flux
-    https://was.baoshi56.com/api/thirdPart/flux/receive/new  //新增收货
-    https://was.baoshi56.com/api/thirdPart/flux/package/new  //新增包裹
-    https://was.baoshi56.com/api/thirdPart/flux/waybill/new  //新增运单
-     **/
     'flux'=>[
+        /** Flux
+        https://was.baoshi56.com/api/thirdPart/flux/receive/new  //新增收货
+        https://was.baoshi56.com/api/thirdPart/flux/package/new  //新增包裹
+        https://was.baoshi56.com/api/thirdPart/flux/waybill/new  //新增运单
+         **/
         'receive'=>[
             'new'=>'http://106.14.155.246:19192/datahub/FluxBSJsonApi/RECECF?messageId=RECECF' //通知WMS, 已完成的订单收货
         ],
@@ -27,6 +27,14 @@ return [
         'waybill'=>[
             'new'=>'http://106.14.155.246:19192/datahub/FluxBSJsonApi/?messageId=BS_TMS' //通知WMS, 已称完的包裹
         ],
+        /**分拔墙
+        https://wcs.baoshi56.com/api/thirdPart/flux/sorting/newBatch  //下发波次
+        https://wcs.baoshi56.com/api/thirdPart/flux/sorting/newCanceledOrder  //下发取消订单
+         **/
+        'inform'=>[
+            'binAssignment' => 'http://106.14.155.246:19192/datahub/FluxBSJsonApi/PUTTOLOCATION', //发送隔口号(播种位)给WMS
+            'batchFinished' => 'http://106.14.155.246:19192/datahub/FluxBSJsonApi/PUTTOLIGHT', //分播结束后通知WMS结果
+        ],
     ],
 
     'haiq'=>[
@@ -47,4 +55,9 @@ return [
     https://was.baoshi56.com/api/thirdPart/goodscan/weight/new  //新增包裹
      */
 
+    /**浩创请求地址
+    https://wcs.baoshi56.com/api/thirdPart/haochuang/sorting/login
+    https://wcs.baoshi56.com/api/thirdPart/haochuang/sorting/process
+    https://wcs.baoshi56.com/api/thirdPart/haochuang/sorting/done
+     **/
 ];

+ 12 - 0
database/factories/BatchFactory.php

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

+ 12 - 0
database/factories/OrderBinFactory.php

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

+ 12 - 0
database/factories/OrderCommodityFactory.php

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

+ 12 - 0
database/factories/SortingStationFactory.php

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

+ 37 - 0
database/migrations/2020_11_10_135835_create_batches_table.php

@@ -0,0 +1,37 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateBatchesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('batches', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->string('code')->unique();
+            $table->enum('status',['未处理','已处理','取消']);
+            $table->enum('type',['无'])->nullable();
+            $table->string('wms_type')->nullable();
+            $table->string('wms_status')->nullable();
+            $table->dateTime('wms_created_at');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('batches');
+    }
+}

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

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateOrderBinsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('order_bins', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->integer('order_id')->index();
+            $table->integer('number')->default(0);
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('order_bins');
+    }
+}

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

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateSortingStationsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('sorting_stations', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->string('name')->index();
+            $table->enum('type',['人工墙'])->default('人工墙');
+            $table->integer('bin_amount')->default(0);
+            $table->enum('is_online',['是','否','未知'])->default('否');
+            $table->enum('is_occupied',['是','否','未知'])->default('否');
+            $table->integer('processing_batch_id')->nullable();
+            $table->timestamp('login_at')->nullable();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('sorting_stations');
+    }
+}

+ 16 - 0
database/seeds/BatchSeeder.php

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

+ 16 - 0
database/seeds/OrderBinSeeder.php

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

+ 16 - 0
database/seeds/OrderCommoditySeeder.php

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

+ 16 - 0
database/seeds/SortingStationSeeder.php

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

+ 37 - 0
resources/views/maintenance/batch/create.blade.php

@@ -0,0 +1,37 @@
+@extends('layouts.app')
+
+@section('content')
+    <div id="nav2">
+        @component('maintenance.menu')@endcomponent
+        @component('maintenance.logistic.menu')@endcomponent
+    </div>
+    <div class="container-fluid mt-3">
+        <div class="card col-md-8 offset-md-2">
+            <div class="card-body">
+                @if(Session::has('successTip'))
+                    <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
+                @endif
+                <form method="POST" action="{{ url('maintenance/logistic') }}">
+                    @csrf
+                    <div class="form-group row">
+                        <label for="name" class="col-2 col-form-label text-right">物流公司名称</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control @error('name') is-invalid @enderror"
+                                   name="name" autocomplete="off" value="{{ old('name') }}" required>
+                            @error('name')
+                            <span class="invalid-feedback" role="alert">
+                                <strong>{{ $message }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <div class="col-8 offset-2">
+                            <input type="submit" class="btn btn-success form-control">
+                        </div>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+@endsection

+ 43 - 0
resources/views/maintenance/batch/edit.blade.php

@@ -0,0 +1,43 @@
+@extends('layouts.app')
+
+@section('content')
+    <div id="nav2">
+        @component('maintenance.menu')
+        @endcomponent
+        @component('maintenance.logistic.menu')
+                <li class="nav-item">
+                    <a class="nav-link" href="{{URL::current()}}" :class="{active:isActive('edit',4)}">修改</a>
+                </li>
+        @endcomponent
+    </div>
+    <div class="container-fluid mt-3">
+        <div class="card">
+            <div class="card-body">
+                @if(Session::has('successTip'))
+                    <div class="alert alert-success h1">{{Session::get('successTip')}}!</div>
+                @endif
+                <form method="POST" action='{{url("maintenance/logistic/{$logistic->id}")}}'>
+                    @csrf
+                    @method('PUT')
+                    <div class="form-group row">
+                        <label for="name" class="col-2 col-form-label text-right">物流公司名称</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control @error('name') is-invalid @enderror"
+                                   name="name" autocomplete="off" value="@if(old('name')){{old('name')}}@else{{$logistic->name}}@endif" required>
+                            @error('name')
+                            <span class="invalid-feedback" role="alert">
+                                <strong>{{ $message }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <div class="col-8 offset-2">
+                            <input type="submit" class="btn btn-outline-dark form-control">
+                        </div>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+@endsection

+ 81 - 0
resources/views/maintenance/batch/index.blade.php

@@ -0,0 +1,81 @@
+@extends('layouts.app')
+
+@section('content')
+    <span id="nav2">
+        @component('maintenance.menu')@endcomponent
+        @component('maintenance.batch.menu')@endcomponent
+    </span>
+    <div class="container-fluid mt-3">
+        <div class="card">
+            <div class="card-body">
+                @if(Session::has('successTip'))
+                    <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
+                @endif
+                <table class="table table-striped table-sm" id="list">
+                    <tr>
+                        <th>波次号</th>
+                        <th>状态</th>
+                        <th>类型(WMS)</th>
+                        <th>创建时间</th>
+{{--                        <th>操作</th>--}}
+                    </tr>
+                    <tr v-for="batch in batches">
+                        <td class="text-muted">@{{batch.batch_id}}</td>
+                        <td class="text-muted">@{{batch.status}}</td>
+                        <td>@{{batch.remote_type}}</td>
+                        <td class="text-muted">@{{batch.created_at}}</td>
+{{--                        <td>--}}
+{{--                            @can('物流公司-编辑')--}}
+{{--                            <button class="btn btn-sm btn-outline-primary" @click="edit(batch.id)">改</button> @endcan--}}
+{{--                            @can('物流公司-删除')--}}
+{{--                            <button class="btn btn-sm btn-outline-dark" @click="destroy(batch)">删</button> @endcan--}}
+{{--                        </td>--}}
+                    </tr>
+                </table>
+                {{$batches->links()}}
+            </div>
+        </div>
+    </div>
+@endsection
+
+@section('lastScript')
+    <script>
+        new Vue({
+            el:"#list",
+            data:{
+                batches:{!! json_encode($batches->toArray()['data'],true)??"\'\'" !!},
+            },
+            methods:{
+                {{--edit:function(id){--}}
+                {{--    location.href = "{{url('maintenance/batch')}}/"+id+"/edit";--}}
+                {{--},--}}
+                {{--destroy:function(batch){--}}
+                {{--    if(!confirm('确定要删除物流公司“' + batch.name + '”吗?')){return};--}}
+                {{--    let data=this;--}}
+                {{--    let url = "{{url('maintenance/batch')}}/"+batch.id;--}}
+                {{--    axios.delete(url,{id:batch.id})--}}
+                {{--        .then(function (response) {--}}
+                {{--            if(response.data.success){--}}
+                {{--                for (let i = 0; i < data.batches.length; i++) {--}}
+                {{--                    if (data.batches[i].id===batch.id){--}}
+                {{--                        data.batches.splice(i,1);--}}
+                {{--                        break;--}}
+                {{--                    }--}}
+                {{--                }--}}
+                {{--                tempTip.setDuration(1000);--}}
+                {{--                tempTip.showSuccess('删除物流公司"'+batch.name+'"成功!')--}}
+                {{--            }else{--}}
+                {{--                tempTip.setDuration(1000);--}}
+                {{--                tempTip.show('删除物流公司"'+batch.name+'"失败!')--}}
+                {{--            }--}}
+                {{--        })--}}
+                {{--        .catch(function (err) {--}}
+                {{--            tempTip.setDuration(3000);--}}
+                {{--            tempTip.show('删除物流公司失败!'+'网络错误:' + err)--}}
+                {{--            console.log(err);--}}
+                {{--        });--}}
+                {{--},--}}
+            }
+        });
+    </script>
+@endsection

+ 12 - 0
resources/views/maintenance/batch/menu.blade.php

@@ -0,0 +1,12 @@
+
+<div class="container-fluid">
+    <div class="card" style="background: #f9f0f0;transform: scale(0.95)">
+        <ul class="nav nav-pills">
+            @can('物流公司-查询')
+            <li class="nav-item">
+                <a class="nav-link" href="{{url('maintenance/batch')}}" :class="{active:isActive('',3)}">查询</a>
+            </li> @endcan
+            {{$slot}}
+        </ul>
+    </div>
+</div>

+ 7 - 0
routes/api/thirdPart/flux.php

@@ -27,3 +27,10 @@ Route::post('process/getProcessContent', "ProcessController@getProcessContent");
 */
 //请求数据,查询库单据是否存在
 Route::post('waybill/new', "WaybillController@new_");//增加运输单消息
+
+
+/*
+文件地址前缀:/api/thirdPart/flux/sorting
+*/
+Route::post('sorting/newBatch', "SortingController@newBatch");//增加新波次(分拣用)
+Route::post('sorting/newCanceledOrder', "SortingController@newCanceledOrder");//取消波次

+ 17 - 0
routes/api/thirdPart/haochuang.php

@@ -0,0 +1,17 @@
+<?php
+
+use Illuminate\Http\Request;
+
+/*
+文件地址前缀:/api/thirdPart/haochuang/
+*/
+
+
+/*
+ 地址前缀:/api/thirdPart/haochuang/sorting
+*/
+Route::prefix('sorting')->group(function(){
+    Route::post('login', "SortingController@login");
+    Route::post('process', "SortingController@process");
+    Route::post('done', "SortingController@done");
+});

Разлика између датотеке није приказан због своје велике величине
+ 3 - 0
tests/sortingFluxNewBatch.http


+ 4 - 0
tests/sortingHaochuangProcess.http

@@ -0,0 +1,4 @@
+POST http://bswas/api/thirdPart/haochuang/sorting/process
+Content-Type: application/json
+
+{"batch_id":"W201023000096k","station_id":"ffffffff-c7f2-adf0-c7f2-adf000000000","token":"bf803b6eeffcfc61396f1accb8487e27"}

Неке датотеке нису приказане због велике количине промена