Browse Source

矩星请求修正,测试
退货记录界面

Zhouzhendong 4 năm trước cách đây
mục cha
commit
f4a9ef1689

+ 17 - 0
app/Http/Controllers/ReceiveRecordController.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Components\AsyncResponse;
+use Illuminate\Http\Request;
+
+class ReceiveRecordController extends Controller
+{
+    use AsyncResponse;
+    public function receive()
+    {
+        $logisticNumber = \request("logistic_number");
+        if (!$logisticNumber)$this->error("非法单号");
+
+    }
+}

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

@@ -57,8 +57,9 @@ class RejectedController extends Controller
         $owners = $ownerService->getIntersectPermitting();
         $owners = $ownerService->getIntersectPermitting();
         $qualityLabels = $qualityLabelService->get();
         $qualityLabels = $qualityLabelService->get();
         $logistics=$logisticService->getSelection();
         $logistics=$logisticService->getSelection();
+        $ownerSign = isset($GLOBALS["OWNER_SIGN"])&&$GLOBALS["OWNER_SIGN"];
         return view('rejected.search.general',compact('rejectedBills','owners','logistics',
         return view('rejected.search.general',compact('rejectedBills','owners','logistics',
-            'paginateParams','qualityLabels'));
+            'paginateParams','qualityLabels',"ownerSign"));
     }
     }
     public function recycle(Request $request)
     public function recycle(Request $request)
     {
     {

+ 12 - 8
app/Http/Controllers/TestController.php

@@ -62,6 +62,7 @@ use App\Services\AuthorityService;
 use App\Services\BatchService;
 use App\Services\BatchService;
 use App\Services\CacheShelfService;
 use App\Services\CacheShelfService;
 use App\Services\ForeignHaiRoboticsService;
 use App\Services\ForeignHaiRoboticsService;
+use App\Services\LogisticService;
 use App\Services\NotificationService;
 use App\Services\NotificationService;
 use App\Services\OracleDOCOrderHeaderService;
 use App\Services\OracleDOCOrderHeaderService;
 use App\Services\OrderPackageCommoditiesService;
 use App\Services\OrderPackageCommoditiesService;
@@ -98,6 +99,7 @@ use Firebase\JWT\JWT;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Collection;
 use Illuminate\Database\Eloquent\Collection;
 use Illuminate\Database\Eloquent\HigherOrderBuilderProxy;
 use Illuminate\Database\Eloquent\HigherOrderBuilderProxy;
+use Illuminate\Database\QueryException;
 use Illuminate\Foundation\Http\FormRequest;
 use Illuminate\Foundation\Http\FormRequest;
 use Illuminate\Http\Request;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Broadcast;
 use Illuminate\Support\Facades\Broadcast;
@@ -210,9 +212,10 @@ class TestController extends Controller
     }
     }
     public function test(Request $request)
     public function test(Request $request)
     {
     {
-        Log::info("揽收成功",["id"=>1,"number"=>2]);
-        dd(1);
-        $b = new StorageTypeController();
+     /*   $s = new LogisticService();
+        $logisticNumber = "73228212325435";
+        dd($s->assertExpressCompany($logisticNumber));*/
+        /*$b = new StorageTypeController();
         $name = "test";
         $name = "test";
         $tag = "tag_name";
         $tag = "tag_name";
         $attributes = new \App\Http\Controllers\api\thirdPart\syrius\beans\StorageTypeAttribute();
         $attributes = new \App\Http\Controllers\api\thirdPart\syrius\beans\StorageTypeAttribute();
@@ -240,7 +243,7 @@ class TestController extends Controller
         $relation->num = 500;
         $relation->num = 500;
         //dd($b->getStorageType(1)->body());
         //dd($b->getStorageType(1)->body());
         $c = $b->createStorageType($name,$tag,$attributes->get(),[(array)$cell->get()],[(array)$relation->get()]);
         $c = $b->createStorageType($name,$tag,$attributes->get(),[(array)$cell->get()],[(array)$relation->get()]);
-dd($c->body());
+dd($c->body());*/
         $sql = <<<SQL
         $sql = <<<SQL
 SELECT ORDERNO,WAVENO,WAREHOUSEID,CUSTOMERID FROM DOC_ORDER_HEADER WHERE ORDERNO = ?
 SELECT ORDERNO,WAVENO,WAREHOUSEID,CUSTOMERID FROM DOC_ORDER_HEADER WHERE ORDERNO = ?
 SQL;
 SQL;
@@ -257,12 +260,13 @@ SQL;
             $task = new Task();
             $task = new Task();
             $task->id = $item->orderno;
             $task->id = $item->orderno;
             $task->batchId = $item->waveno;
             $task->batchId = $item->waveno;
-            $task->warehouseId = $item->warehouseid;
+            $task->warehouseId = "1";
             $task->attributes = [
             $task->attributes = [
                 "customer" => $item->customerid,
                 "customer" => $item->customerid,
             ];
             ];
+            $task->type = Task::TOTAL_PICKING;
             $task->items = [];
             $task->items = [];
-            $task->storages = [["type"=>"test"]];
+            $task->storages = [["type"=>"1A_container"]];
             $taskList[] = $task;
             $taskList[] = $task;
             $map[$item->orderno] = $index;
             $map[$item->orderno] = $index;
             $codes .= "'".$item->orderno."',";
             $codes .= "'".$item->orderno."',";
@@ -272,9 +276,9 @@ SQL;
             $taskItem = new TaskItem();
             $taskItem = new TaskItem();
             $taskItem->name = $item->descr_c;
             $taskItem->name = $item->descr_c;
             $taskItem->barcode = $item->alternate_sku1;
             $taskItem->barcode = $item->alternate_sku1;
-            $taskItem->quantity = $item->qty_each;
+            $taskItem->quantity = (int)$item->qty_each;
             $taskItem->binLocations = [
             $taskItem->binLocations = [
-                $item->location,
+                "05-01-01",
             ];
             ];
             $taskItem->attributes = [
             $taskItem->attributes = [
                 "orderLineNo" => $item->orderlineno,
                 "orderLineNo" => $item->orderlineno,

+ 0 - 2
app/Http/Controllers/WaveController.php

@@ -7,12 +7,10 @@ use App\Components\AsyncResponse;
 use App\Order;
 use App\Order;
 use App\OrderBin;
 use App\OrderBin;
 use App\Services\WaveService;
 use App\Services\WaveService;
-use Exception;
 use Illuminate\Http\Request;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Gate;
 use Illuminate\Support\Facades\Gate;
-use Illuminate\Support\Facades\Http;
 use Oursdreams\Export\Export;
 use Oursdreams\Export\Export;
 
 
 class WaveController extends Controller
 class WaveController extends Controller

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

@@ -689,7 +689,7 @@ class WaybillController extends Controller
             "其他收费", "其他收费备注", "始发地", "目的地","下单备注", "承运商", "承运商单号",
             "其他收费", "其他收费备注", "始发地", "目的地","下单备注", "承运商", "承运商单号",
             "仓库计抛", "承运商计抛", "仓库计重", "承运商计重", "车型", "车辆信息",
             "仓库计抛", "承运商计抛", "仓库计重", "承运商计重", "车型", "车辆信息",
             "计件", "里程数", "运费(元)", "提货费(元)", "其他费用(元)", "发货时间",
             "计件", "里程数", "运费(元)", "提货费(元)", "其他费用(元)", "发货时间",
-            "调度备注", "创建时间", "省", "市", "区", "FLUX地址", "FLUX重量", "FLUX数量"
+            "调度备注", "附加费","创建时间", "省", "市", "区", "FLUX地址", "FLUX重量", "FLUX数量"
         ];
         ];
         $list = [];
         $list = [];
         $codes = [];
         $codes = [];
@@ -731,6 +731,7 @@ class WaybillController extends Controller
                 $waybill->other_fee,
                 $waybill->other_fee,
                 $waybill->deliver_at,
                 $waybill->deliver_at,
                 $waybill->dispatch_remark,
                 $waybill->dispatch_remark,
+                $waybill->subjoin_fee,
                 $waybill->created_at->toDateTimeString(),
                 $waybill->created_at->toDateTimeString(),
                 "", "", "","",0,0
                 "", "", "","",0,0
             ];
             ];
@@ -748,7 +749,7 @@ SQL;
                     $list[$map[$summary->orderno]][28] = $summary->c_city;
                     $list[$map[$summary->orderno]][28] = $summary->c_city;
                     $list[$map[$summary->orderno]][29] = $summary->c_district;
                     $list[$map[$summary->orderno]][29] = $summary->c_district;
                     $list[$map[$summary->orderno]][30] = $summary->c_address1;
                     $list[$map[$summary->orderno]][30] = $summary->c_address1;
-                    $list[$map[$summary->orderno]][31] += $summary->weight;
+                    $list[$map[$summary->orderno]][31] += is_numeric($summary->weight) ? $summary->weight : 0;
                     $list[$map[$summary->orderno]][32] += $summary->amount;
                     $list[$map[$summary->orderno]][32] += $summary->amount;
                 }
                 }
             }
             }

+ 1 - 1
app/Http/Controllers/api/thirdPart/syrius/beans/Task.php

@@ -31,7 +31,7 @@ class Task extends \stdClass
 
 
     public function get(): Task
     public function get(): Task
     {
     {
-        if (!$this->type)$this->type = self::ORDER_PICKING;
+        if (!$this->type)$this->type = self::TOTAL_PICKING;
         $this->timestamp = time();
         $this->timestamp = time();
         $this->notifyUrl = config("app.url")."/api/thirdPart/syrius/order/notification";
         $this->notifyUrl = config("app.url")."/api/thirdPart/syrius/order/notification";
         if (!$this->storages)$this->storages = [];
         if (!$this->storages)$this->storages = [];

+ 4 - 4
app/Http/Controllers/api/thirdPart/syrius/producer/Controller.php

@@ -24,7 +24,6 @@ class Controller
     {
     {
         $auth = $this->getAuthentication();
         $auth = $this->getAuthentication();
         if (!$auth)return null;
         if (!$auth)return null;
-        $url = config("api.syrius.base_url").$this->url;
         $logInfo = [
         $logInfo = [
             "param" =>  $this->data,
             "param" =>  $this->data,
             "user"  =>  Auth::id(),
             "user"  =>  Auth::id(),
@@ -32,9 +31,10 @@ class Controller
         ];
         ];
         try {
         try {
             $method = $this->method;
             $method = $this->method;
-            $headers = ['Authorization' => $auth["tokenType"]." ".$auth["accessToken"]];
-            if ($method=='post')$headers["Content-Type"] = 'application/json';
-            return Http::withHeaders($headers)->$method($url,$this->data);
+            $response  = Http::withToken($auth["accessToken"]);
+            $response->baseUrl(config("api.syrius.base_url"));
+            if ($method=='post')$response->asJson();
+            return $response->$method($this->url,$this->data);
         }catch (ConnectionException $e){
         }catch (ConnectionException $e){
             Log::warning("syrius:连接异常",$logInfo);
             Log::warning("syrius:连接异常",$logInfo);
         }catch (\Exception $e){
         }catch (\Exception $e){

+ 5 - 0
app/RejectedBillItem.php

@@ -5,6 +5,7 @@ namespace App;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Collection;
 use Illuminate\Database\Eloquent\Collection;
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
 use Illuminate\Database\Eloquent\SoftDeletes;
 use Illuminate\Database\Eloquent\SoftDeletes;
 
 
 /**
 /**
@@ -24,6 +25,10 @@ class RejectedBillItem extends Model
 
 
     protected $appends = ['quality_label'];
     protected $appends = ['quality_label'];
 
 
+    function barcode():BelongsTo
+    {
+        return $this->belongsTo(CommodityBarcode::class,'barcode_goods','code');
+    }
     public function rejectedBill(){
     public function rejectedBill(){
         return $this->hasOne('App\RejectedBill', 'id', 'id_rejected_bill');
         return $this->hasOne('App\RejectedBill', 'id', 'id_rejected_bill');
     }
     }

+ 115 - 0
app/Services/LogisticService.php

@@ -134,4 +134,119 @@ class LogisticService implements UserFilter
         }
         }
         return $query;
         return $query;
     }
     }
+
+    /**
+     * 断言快递单号所属快递公司
+     *
+     * @param string $logisticNumber
+     * @param bool $multi
+     *
+     * @return string|array
+     */
+    public function assertExpressCompany(string $logisticNumber, bool $multi = false)
+    {
+        $mapping = [
+            "顺丰" => [
+                [
+                    "header" => "SF",
+                    "length" => 15,
+                ],
+                [
+                    "length" => 12,
+                    "type"   => "integer",
+                ],
+            ], "圆通" => [
+                [
+                    "header" => "YT",
+                    "length" => 15,
+                ],
+                [
+                    "length" => 13,
+                    "type"   => "integer",
+                    "multiHeader"  => ["61","71","81"],
+                ],
+            ], "中通" => [
+                [
+                    "length" => 12,
+                    "type"   => "integer",
+                    "multiHeader"  => ["54","21"],
+                ],
+                [
+                    "length" => 14,
+                    "type"   => "integer",
+                    "multiHeader"  => ["75","78","73"],
+                ],
+            ],"韵达" => [
+                [
+                    "length" => 13,
+                    "type"   => "integer",
+                    "multiHeader"  => ["46","43","42","35","31"],
+                ],
+                [
+                    "length" => 15,
+                    "type"   => "integer",
+                    "multiHeader"  => ["46","43"],
+                ],
+            ], "京东" => [
+                [
+                    "header" => "JD",
+                ],
+            ], "邮政" => [
+                [
+                    "length" => 13,
+                    "type"   => "integer",
+                    "multiHeader"  => ["11","98"],
+                ],
+            ], "极兔" => [
+                [
+                    "header" => "JT",
+                ]
+            ], "跨越" => [
+                [
+                    "header" => "KY",
+                    "length" => 15,
+                ],
+                [
+                    "length" => 11,
+                    "type"   => "integer",
+                    "multiHeader"  => ["80"],
+                ],
+            ]
+        ];
+        $result = $multi ? [] : "未知";
+        foreach ($mapping as $name=>$rules){
+            foreach ($rules as $rule){
+                if (!$this->matchingNumber($logisticNumber,$rule))continue;
+                if ($multi)$result[] = $name;
+                else return $name;
+            }
+        }
+        return $result;
+    }
+
+    public function matchingNumber(string $logisticNumber, array $rule):bool
+    {
+        $len = mb_strlen($logisticNumber);
+        $match = function (string $key, $val)use($logisticNumber,$len){
+            switch ($key){
+                case "header":
+                    return mb_substr($logisticNumber,0,mb_strlen($val)) === $val;
+                case "length":
+                    return $len==$val;
+                case "multiHeader":
+                    foreach ($val as $item)if (mb_substr($logisticNumber,0,mb_strlen($item)) === $item)return true;
+                    return false;
+                case "type":
+                    try {
+                        return eval("return is_{$val}($logisticNumber);");
+                    }catch (\ParseError $e){
+                        return false;
+                    }
+                default:
+                    return false;
+            }
+        };
+        foreach ($rule as $key=>$val)if (!$match($key,$val))return false;
+        return true;
+    }
 }
 }

+ 8 - 2
app/Services/RejectedService.php

@@ -23,10 +23,16 @@ class RejectedService
     }
     }
     private function  conditionQuery(array $param)
     private function  conditionQuery(array $param)
     {
     {
-        $user = Auth::user();
+        $owners = Auth::user() ? (app('UserService')->getPermittingOwnerIds(Auth::user()) ?? []) : [];
         $rejectedBills = RejectedBill::query()->with('user','owner', 'logistic', 'items.quality', 'items.uploadFiles','orderIssueRejectedBill:logistic_number_return')
         $rejectedBills = RejectedBill::query()->with('user','owner', 'logistic', 'items.quality', 'items.uploadFiles','orderIssueRejectedBill:logistic_number_return')
             ->orderBy('rejected_bills.id', 'desc')
             ->orderBy('rejected_bills.id', 'desc')
-            ->whereIn('rejected_bills.id_owner', $user ? (app('UserService')->getPermittingOwnerIds($user) ?? []) : []);
+            ->whereIn('rejected_bills.id_owner', $owners);
+        if (array_search("397",$owners)!==false){
+            $rejectedBills->with(["items.barcode.commodity"=>function($query){
+                $query->where("owner_id",397)->select("id","sku");
+            }]);
+            $GLOBALS["OWNER_SIGN"] = true;
+        }
         $columnQueryRules = [
         $columnQueryRules = [
             'created_at_start' => ['alias' => 'created_at', 'startDate' => ' 00:00:00'],
             'created_at_start' => ['alias' => 'created_at', 'startDate' => ' 00:00:00'],
             'created_at_end' => ['alias' => 'created_at', 'endDate' => ' 23:59:59'],
             'created_at_end' => ['alias' => 'created_at', 'endDate' => ' 23:59:59'],

+ 32 - 0
database/migrations/2021_10_20_145815_create_receive_records_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateReceiveRecordsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('receive_records', function (Blueprint $table) {
+            $table->string("logistic_number",50)->primary()->comment("快递单号");
+            $table->bigInteger("logistic_id")->index()->comment("快递公司");
+            $table->timestamp("record_at")->comment("记录时间");
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('receive_records');
+    }
+}

+ 10 - 0
resources/views/rejected/record.blade.php

@@ -0,0 +1,10 @@
+@extends('layouts.app')
+@section('title')退货流水线@endsection
+
+@section('content')
+    <div class="card">
+        <div class="card-body">
+
+        </div>
+    </div>
+@stop

+ 7 - 2
resources/views/rejected/search/general.blade.php

@@ -91,7 +91,11 @@
                         <td style="min-width: 1000px">
                         <td style="min-width: 1000px">
                             <div class="w-100 " :class="rejectedBill.items.length>1 ? 'up' : ''" :id="'rejected-'+rejectedBill.id" >
                             <div class="w-100 " :class="rejectedBill.items.length>1 ? 'up' : ''" :id="'rejected-'+rejectedBill.id" >
                                 <div class="row" v-for="(item,i) in rejectedBill.items">
                                 <div class="row" v-for="(item,i) in rejectedBill.items">
-                                    <div class="col-2 border border-1" style="overflow-x: hidden">
+                                    @if($ownerSign)
+                                    <div class="col-1 border border-1" style="overflow-x: hidden">
+                                        <div class="w-100 text-overflow-warp-200 warp-min-200">@{{ (item.barcode && item.barcode.commodity) ? item.barcode.commodity.sku : '' }}</div>
+                                    </div>@endif
+                                    <div class="@if($ownerSign)col-1 @else col-2 @endif border border-1" style="overflow-x: hidden">
                                         <div class="w-100 text-overflow-warp-200 warp-min-200">@{{item.barcode_goods}}</div>
                                         <div class="w-100 text-overflow-warp-200 warp-min-200">@{{item.barcode_goods}}</div>
                                     </div>
                                     </div>
                                     <div class="col-1 border border-1" style="overflow-x: hidden">
                                     <div class="col-1 border border-1" style="overflow-x: hidden">
@@ -256,7 +260,8 @@
                         @cannot('退货管理-客户不可见'){name:'common_02',value: '重量'},@endcannot
                         @cannot('退货管理-客户不可见'){name:'common_02',value: '重量'},@endcannot
                     {name:'goods_amount',value: '商品总数'},
                     {name:'goods_amount',value: '商品总数'},
                     {name:"goods",type:"multi",title:"商品信息",rows:[
                     {name:"goods",type:"multi",title:"商品信息",rows:[
-                            {value:"商品条码",col:"2"},
+                            @if($ownerSign){value:"商品编码",col:"1"},@endif
+                            {value:"商品条码",col:@if($ownerSign)"1" @else "2" @endif},
                             {value:"商品名称",col:"1"},
                             {value:"商品名称",col:"1"},
                             {value:"数量",col:"1"},
                             {value:"数量",col:"1"},
                             {value:"质量",col:"1"},
                             {value:"质量",col:"1"},

+ 3 - 0
routes/web.php

@@ -49,6 +49,9 @@ Route::get('personnel/checking-in/QRCode','QRCodeController@QRCode');
 Route::get('personnel/checking-in/importAndExportQRCode','QRCodeController@importAndExportQRCode');
 Route::get('personnel/checking-in/importAndExportQRCode','QRCodeController@importAndExportQRCode');
 Route::post('personnel/checking-in/refreshQRCode','QRCodeController@refreshQRCode');
 Route::post('personnel/checking-in/refreshQRCode','QRCodeController@refreshQRCode');
 
 
+Route::post("record","ReceiveRecordController@receive");
+Route::get("record",function (){return view("rejected.record");});
+
 //人事管理
 //人事管理
 Route::group(['prefix'=>'personnel','middleware'=>'auth'],function() {
 Route::group(['prefix'=>'personnel','middleware'=>'auth'],function() {