Pārlūkot izejas kodu

退件记录异常情况

Zhouzhendong 4 gadi atpakaļ
vecāks
revīzija
1b168415b4

+ 4 - 1
app/Console/Commands/ReceiveRecord.php

@@ -5,6 +5,7 @@ namespace App\Console\Commands;
 use App\RejectedBill;
 use Carbon\Carbon;
 use Illuminate\Console\Command;
+use Illuminate\Support\Facades\Log;
 
 class ReceiveRecord extends Command
 {
@@ -32,7 +33,7 @@ class ReceiveRecord extends Command
         parent::__construct();
     }
 
-    public static $delayedHour = 48;
+    private static $delayedHour = 48;
     /**
      * Execute the console command.
      *
@@ -40,6 +41,8 @@ class ReceiveRecord extends Command
     public function handle()
     {
         $delayedDateTime = Carbon::now()->subHours(self::$delayedHour)->toDateTimeString();
+        Log::info("退件记录",["signTime"=>$delayedDateTime,"result"=>\App\ReceiveRecord::query()->where("record_at","<=",$delayedDateTime)
+            ->where("delayed",0)->select("logistic_number")->pluck("logistic_number")->toArray()]);
         \App\ReceiveRecord::query()->where("record_at","<=",$delayedDateTime)
             ->where("delayed",0)
             ->update(["delayed"=>2]);

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

@@ -135,6 +135,7 @@ class ReceiveRecordController extends Controller
                 "logistic_id" => $logisticId,
                 "record_at" => $dateTime,
                 "warehouse_id" => $warehouse,
+                "delayed" => 0,
             ]);
             $this->success(["recordAt"=>$dateTime,"logistic"=>$logistic->name??"未知"]);
         }catch(QueryException $qe){

+ 48 - 0
app/Http/Controllers/TestController.php

@@ -131,6 +131,7 @@ use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Cookie;
 use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Hash;
 use Illuminate\Support\Facades\Http;
 use Illuminate\Support\Facades\Log;
 use Illuminate\Support\Facades\Notification;
@@ -183,8 +184,55 @@ class TestController extends Controller
         if (count($recursion)>0)$newRes = $this->format($recursion,$newRes);
         return $newRes;
     }
+    public function socket(){
+        set_time_limit(0);
+        $ip = '127.0.0.1';
+        $port = 1935;
+        if(($sock = socket_create(AF_INET,SOCK_STREAM,SOL_TCP)) < 0) {
+            echo "socket_create() 失败的原因是:".socket_strerror($sock)."\n";
+        }
+        if(($ret = socket_bind($sock,$ip,$port)) < 0) {
+            echo "socket_bind() 失败的原因是:".socket_strerror($ret)."\n";
+        }
+        if(($ret = socket_listen($sock,4)) < 0) {
+            echo "socket_listen() 失败的原因是:".socket_strerror($ret)."\n";
+        }
+        $count = 0;
+        do {
+            if (($msgsock = socket_accept($sock)) < 0) {
+                echo "socket_accept() failed: reason: " . socket_strerror($msgsock) . "\n";
+                break;
+            } else {
+                $msg ="测试成功!\n";
+                socket_write($msgsock, $msg, strlen($msg));
+                echo "测试成功了啊\n";
+                $buf = socket_read($msgsock,8192);
+                $talkback = "收到的信息:$buf\n";
+                echo $talkback;
+                if(++$count >= 5){break;}
+            }
+            socket_close($msgsock);
+        }while (true);
+        socket_close($sock);
+    }
+    private static $delayedHour = 48;
     public function test(Request $request)
     {
+        /**
+         * Execute the console command.
+         *
+         */
+        $delayedDateTime = Carbon::now()->subHours(self::$delayedHour)->toDateTimeString();
+        dd($delayedDateTime);
+        dd(\App\ReceiveRecord::query()
+            ->where("record_at",">",$delayedDateTime)
+            ->where("delayed",0)
+            ->whereIn("logistic_number",RejectedBill::query()->select("logistic_number_return")
+                ->where("created_at",">",$delayedDateTime)->whereIn("logistic_number_return",
+                    \App\ReceiveRecord::query()->select("logistic_number")
+                        ->where("record_at",">",$delayedDateTime)
+                        ->where("delayed",0)))->get());
+        dd(1);
         $path = '';
         $id = 115;
 

+ 1 - 1
app/Services/LogisticService.php

@@ -248,7 +248,7 @@ class LogisticService implements UserFilter
         $match = function (string $key, $val)use($logisticNumber,$len){
             switch ($key){
                 case "header":
-                    return mb_substr($logisticNumber,0,mb_strlen($val)) === $val;
+                    return Str::upper(mb_substr($logisticNumber,0,mb_strlen($val))) === $val;
                 case "length":
                     return $len==$val;
                 case "multiHeader":

+ 0 - 1
resources/js/utilities/toast.js

@@ -46,4 +46,3 @@ window.toast={
         this.build("fail",msg,duration)
     },
 };
-module.exports=toast;

+ 55 - 47
resources/views/equipment/index.blade.php

@@ -73,7 +73,7 @@
                         <a role="menuitem" tabindex="-1" style="cursor: pointer" class="ml-3"
                            @click="selectedWarehouse(warehouse)">@{{ warehouse.name }}</a>
                     </li>
-                    <li role="presentation" class="text-center" @click="addWarehouseDetail()">
+                    <li role="presentation" class="text-center" @click="showAddWarehouseDetail()">
                         <a role="menuitem" tabindex="-1" style="cursor: pointer" class="ml-3 text-primary"
                            ><i class="fa fa-plus"></i> 新增</a>
                     </li>
@@ -197,7 +197,7 @@
         </div>
         <div class="col-10 p-0">
             <div class="w-100 bg-secondary" id="canvasApp" style="height: 100vh;overflow: auto;user-select: none;">
-                <div id="canvas" :style="[{width:container.width*(scale/100)+'px'},{height:container.height*(scale/100)+'px'},{transform: 'scale('+(scale/100)+')'}]"
+                <div id="canvas" v-if="isLoad" :style="[{width:container.width*(scale/100)+'px'},{height:container.height*(scale/100)+'px'},{transform: 'scale('+(scale/100)+')'}]"
                      style="position: relative;transform-origin: 0 0" class="bg-white"
                  @mousedown="contentOnmousedown" @mousemove="contentOnmousemove" @mouseup="contentOnmouseup">
                     <vue-drag-resize v-for="(element,index) in elements"
@@ -242,7 +242,7 @@
 </div>
 </body>
 <script src="{{ mix('js/app.js') }}"></script>
-<script src="{{ mix('js/utilities/toast.js') }}"></script>
+<script src="{{ asset('js/utilities/toast.js') }}"></script>
 <script type="text/javascript">
     var vue = new Vue({
         el:"#container",
@@ -259,6 +259,7 @@
             ratio:20,                                                    //设备大小缩放比例值
             name:"",                                                    //当前选中的仓库NAME
             isNotEdit:true,                                            //是否允许编辑
+            isLoad:true,                                            //是否加载
             currentEl:{},                                               //当前选中的元素
             coordsMapping:{                                             //元素信息映射
                 "居中":"h-100 w-100 el-center",
@@ -343,11 +344,14 @@
                     success : (res,status)=>{
                         this.warehouses = res.data;
                         //这里获取warehouses
-                        let record = localStorage.getItem("equipment:warehouse");
-                        if (record){
-                            let recordObj = JSON.parse(record);
-                            this.selectedWarehouse(recordObj);
-                        }else{
+                        let id = localStorage.getItem("equipment:warehouse");
+                        if (!id || !this.warehouses.some(warehouse=>{
+                                    if (warehouse.id == id){
+                                        this.selectedWarehouse(warehouse);
+                                        return true;
+                                    }
+                                })
+                        ){
                             if (this.warehouses.length>0)this.selectedWarehouse(this.warehouses[0]);
                         }
                         $("#loading").hide();
@@ -486,44 +490,48 @@
             },
             //仓库切换
             selectedWarehouse(warehouse){
-                this.selected = warehouse.id;
-                this.name = warehouse.name;
-                this.ratio = warehouse.ratio;
-                this.container = {width:warehouse.length*this.ratio,height:warehouse.width*this.ratio};
-                localStorage.setItem("equipment:warehouse", JSON.stringify(warehouse));
-                $.ajax({
-                    url : this.baseUrl+"warehouse/detail/getCoordsInfo",
-                    type : "post",
-                    dataType : "JSON",
-                    data : {id:warehouse.id},
-                    success : (res,status)=>{
-                        this.elements = res.data[0] ? JSON.parse(res.data[0]) : [];
-                        if(res.data[1] && res.data[1].length>0){
-                            let equipmentElements = [];
-                            res.data[1].forEach(eq=>{
-                                let coords = JSON.parse(eq.info);
-                                let selfInfo = this.equipments[coords.id-1];
-                                equipmentElements.push(Object.assign({
-                                    eqId:eq.id,
-                                    code:eq.code,
-                                    width:eq.width,
-                                    depth:eq.depth,
-                                    repository:eq.repositoryId,
-                                    x:coords.x,
-                                    y:coords.y,
-                                    turn:!!coords.turn,
-                                },selfInfo));
-                            });
-                            this.equipmentElements = equipmentElements;
-                        }else this.equipmentElements = [];
-                        this.repositories = res.data[2];
-                        this.isNotEdit = true;
-                    },
-                    error : (err,status)=>{
-                        window.tempTip.show("坐标信息加载失败");
-                    },
-                    timeout:3000,
-                })
+                this.isLoad = false;
+                setTimeout(()=>{
+                    this.selected = warehouse.id;
+                    this.name = warehouse.name;
+                    this.ratio = warehouse.ratio;
+                    this.container = {width:warehouse.length*this.ratio,height:warehouse.width*this.ratio};
+                    localStorage.setItem("equipment:warehouse", warehouse.id);
+                    $.ajax({
+                        url : this.baseUrl+"warehouse/detail/getCoordsInfo",
+                        type : "post",
+                        dataType : "JSON",
+                        data : {id:warehouse.id},
+                        success : (res,status)=>{
+                            this.elements = res.data[0] ? JSON.parse(res.data[0]) : [];
+                            if(res.data[1] && res.data[1].length>0){
+                                let equipmentElements = [];
+                                res.data[1].forEach(eq=>{
+                                    let coords = JSON.parse(eq.info);
+                                    let selfInfo = this.equipments[coords.id-1];
+                                    equipmentElements.push(Object.assign({
+                                        eqId:eq.id,
+                                        code:eq.code,
+                                        width:eq.width,
+                                        depth:eq.depth,
+                                        repository:eq.repositoryId,
+                                        x:coords.x,
+                                        y:coords.y,
+                                        turn:!!coords.turn,
+                                    },selfInfo));
+                                });
+                                this.equipmentElements = equipmentElements;
+                            }else this.equipmentElements = [];
+                            this.repositories = res.data[2];
+                            this.isNotEdit = true;
+                            this.isLoad = true;
+                        },
+                        error : (err,status)=>{
+                            window.tempTip.show("坐标信息加载失败");
+                        },
+                        timeout:3000,
+                    })
+                },200);
             },
             //文本类属性改变
             changeText(key){
@@ -757,7 +765,7 @@
                                 $("#warehouseDetail").modal("show");
                                 break;
                             default:
-                                window.toast.error("仓库建立失败");
+                                window.toast.error("仓库获取失败");
                         }
                     },
                     error : (err)=>{

+ 1 - 0
routes/web.php

@@ -106,6 +106,7 @@ Route::group(['middleware'=>'auth'],function ($route){
     $route->post('getMenu','MenuController@get');
 
     $route->get("record","ReceiveRecordController@record");
+    $route->get("equipment",function (){return view("equipment.index");});
 
     /** 基础设置 */
     $route->group(['prefix'=>'maintenance'],function(){

+ 1 - 1
webpack.mix.js

@@ -34,7 +34,7 @@ mix.js('resources/js/elementUi.js','public/js/element-ui.js')
     .sass('resources/sass/elementUi.scss', 'public/css/element-ui.css');
 mix.copy("resources/sass/animation.css",'public/css/animation.css');
 mix.js("resources/js/marked.js", "public/js/marked.js");
-mix.js("resources/js/utilities/toast.js", "public/js/utilities/toast.js");
+mix.copy("resources/js/utilities/toast.js", "public/js/utilities/toast.js");
 
 //德邦快递
 mix.js('resources/js/lodop/jquery.PrintArea.js','public/js/lodop/jquery.PrintArea.js')