Преглед на файлове

更新缓存架入库部分逻辑

Zhouzhendong преди 4 години
родител
ревизия
0466623639

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

@@ -6,6 +6,7 @@ use App\Authority;
 use App\Batch;
 use App\City;
 use App\Commodity;
+use App\Components\AsyncResponse;
 use App\Console\Commands\CreateOwnerAreaReport;
 use App\Console\Commands\CreateOwnerBillReport;
 use App\Console\Commands\CreateOwnerReport;
@@ -124,6 +125,7 @@ use Zttp\Zttp;
 
 class TestController extends Controller
 {
+    use AsyncResponse;
     const ASNREFERENCE_2 = 'ASNREFERENCE2';
     private $data = [];
 
@@ -139,6 +141,22 @@ class TestController extends Controller
 
     public function test1()
     {
+        $storage = \App\Storage::query()->where("material_box_id",437)->lockForUpdate()->first();
+        $obj = [
+            "station_id" => 12,
+            "material_box_id" => 437,
+            "commodity_id" => null,
+            "amount" => 10,
+            "status" => 1,
+        ];
+        if ($storage){
+            $obj["amount"] = DB::raw("amount+10");
+            //$storage->update($obj);
+            $amount = (int)$storage->amount + (int)10;
+        } else //Storage::query()->create($obj);
+
+        dd($obj);
+        dd($obj);
         $stations = Station::query()->select("id")->where("parent_id",6);
         $storages = \App\Storage::query()->with("station:id,code")->whereIn("station_id",$stations)->where(function (Builder $query){
             $query->whereNotNull("material_box_id")->orWhere("status",1);

+ 4 - 3
app/Services/StorageService.php

@@ -1,4 +1,4 @@
-<?php 
+<?php
 
 namespace App\Services;
 
@@ -214,6 +214,7 @@ class StorageService
                 if ($model && $model->maximum < $amount)$model->update(["maximum"=>$amount]);
             }
             DB::commit();
+            LogService::log(__CLASS__,"库存增加",$storage->toJson()."  |  ".json_encode([$stationId, $boxId, $commodityId, $amount, $modelId]));
             return true;
         }catch(\Exception $e){
             DB::rollBack();
@@ -241,7 +242,7 @@ sql;
         $asns = DB::connection("oracle")->select(DB::raw($sql),[$asn,$barCode,$barCode,$barCode,$amount]);
         if (!$asns)return null;
         $nums = [];
-        foreach ($asns as $index=>$asn){
+        foreach ($asns as $asn){
             if ((int)$asn->fmqty == $amount)return [$asn];
             $nums[] = (int)$asn->fmqty;
         }
@@ -482,4 +483,4 @@ sql;
             return false;
         }
     }
-}
+}

+ 1 - 1
app/StationTaskMaterialBox.php

@@ -21,7 +21,7 @@ class StationTaskMaterialBox extends Model
     }
     function station(): BelongsTo
     {
-        return $this->belongsTo(Station::class);
+        return $this->belongsTo(Station::class,"station_id","id");
     }
     function stationTaskBatch(): BelongsTo
     {

+ 37 - 35
composer.lock

@@ -247,16 +247,16 @@
         },
         {
             "name": "doctrine/cache",
-            "version": "1.11.3",
+            "version": "2.0.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/doctrine/cache.git",
-                "reference": "3bb5588cec00a0268829cc4a518490df6741af9d"
+                "reference": "c9622c6820d3ede1e2315a6a377ea1076e421d88"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/doctrine/cache/zipball/3bb5588cec00a0268829cc4a518490df6741af9d",
-                "reference": "3bb5588cec00a0268829cc4a518490df6741af9d",
+                "url": "https://api.github.com/repos/doctrine/cache/zipball/c9622c6820d3ede1e2315a6a377ea1076e421d88",
+                "reference": "c9622c6820d3ede1e2315a6a377ea1076e421d88",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -332,7 +332,7 @@
             ],
             "support": {
                 "issues": "https://github.com/doctrine/cache/issues",
-                "source": "https://github.com/doctrine/cache/tree/1.11.3"
+                "source": "https://github.com/doctrine/cache/tree/2.0.3"
             },
             "funding": [
                 {
@@ -348,20 +348,20 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2021-05-25T09:01:55+00:00"
+            "time": "2021-05-25T09:43:04+00:00"
         },
         {
             "name": "doctrine/dbal",
-            "version": "2.13.1",
+            "version": "2.13.2",
             "source": {
                 "type": "git",
                 "url": "https://github.com/doctrine/dbal.git",
-                "reference": "c800380457948e65bbd30ba92cc17cda108bf8c9"
+                "reference": "8dd39d2ead4409ce652fd4f02621060f009ea5e4"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/doctrine/dbal/zipball/c800380457948e65bbd30ba92cc17cda108bf8c9",
-                "reference": "c800380457948e65bbd30ba92cc17cda108bf8c9",
+                "url": "https://api.github.com/repos/doctrine/dbal/zipball/8dd39d2ead4409ce652fd4f02621060f009ea5e4",
+                "reference": "8dd39d2ead4409ce652fd4f02621060f009ea5e4",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -371,18 +371,19 @@
                 ]
             },
             "require": {
-                "doctrine/cache": "^1.0",
+                "doctrine/cache": "^1.0|^2.0",
                 "doctrine/deprecations": "^0.5.3",
                 "doctrine/event-manager": "^1.0",
                 "ext-pdo": "*",
                 "php": "^7.1 || ^8"
             },
             "require-dev": {
-                "doctrine/coding-standard": "8.2.0",
+                "doctrine/coding-standard": "9.0.0",
                 "jetbrains/phpstorm-stubs": "2020.2",
                 "phpstan/phpstan": "0.12.81",
-                "phpunit/phpunit": "^7.5.20|^8.5|9.5.0",
+                "phpunit/phpunit": "^7.5.20|^8.5|9.5.5",
                 "squizlabs/php_codesniffer": "3.6.0",
+                "symfony/cache": "^4.4",
                 "symfony/console": "^2.0.5|^3.0|^4.0|^5.0",
                 "vimeo/psalm": "4.6.4"
             },
@@ -445,7 +446,7 @@
             ],
             "support": {
                 "issues": "https://github.com/doctrine/dbal/issues",
-                "source": "https://github.com/doctrine/dbal/tree/2.13.1"
+                "source": "https://github.com/doctrine/dbal/tree/2.13.2"
             },
             "funding": [
                 {
@@ -461,7 +462,7 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2021-04-17T17:30:19+00:00"
+            "time": "2021-06-18T21:48:39+00:00"
         },
         {
             "name": "doctrine/deprecations",
@@ -1440,16 +1441,16 @@
         },
         {
             "name": "firebase/php-jwt",
-            "version": "v5.3.0",
+            "version": "v5.4.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/firebase/php-jwt.git",
-                "reference": "3c2d70f2e64e2922345e89f2ceae47d2463faae1"
+                "reference": "d2113d9b2e0e349796e72d2a63cf9319100382d2"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/firebase/php-jwt/zipball/3c2d70f2e64e2922345e89f2ceae47d2463faae1",
-                "reference": "3c2d70f2e64e2922345e89f2ceae47d2463faae1",
+                "url": "https://api.github.com/repos/firebase/php-jwt/zipball/d2113d9b2e0e349796e72d2a63cf9319100382d2",
+                "reference": "d2113d9b2e0e349796e72d2a63cf9319100382d2",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -1464,6 +1465,9 @@
             "require-dev": {
                 "phpunit/phpunit": ">=4.8 <=9"
             },
+            "suggest": {
+                "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present"
+            },
             "type": "library",
             "autoload": {
                 "psr-4": {
@@ -1494,9 +1498,9 @@
             ],
             "support": {
                 "issues": "https://github.com/firebase/php-jwt/issues",
-                "source": "https://github.com/firebase/php-jwt/tree/v5.3.0"
+                "source": "https://github.com/firebase/php-jwt/tree/v5.4.0"
             },
-            "time": "2021-05-20T17:37:02+00:00"
+            "time": "2021-06-23T19:00:23+00:00"
         },
         {
             "name": "guzzlehttp/guzzle",
@@ -2409,16 +2413,16 @@
         },
         {
             "name": "league/flysystem",
-            "version": "1.1.3",
+            "version": "1.1.4",
             "source": {
                 "type": "git",
                 "url": "https://github.com/thephpleague/flysystem.git",
-                "reference": "9be3b16c877d477357c015cec057548cf9b2a14a"
+                "reference": "f3ad69181b8afed2c9edf7be5a2918144ff4ea32"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/9be3b16c877d477357c015cec057548cf9b2a14a",
-                "reference": "9be3b16c877d477357c015cec057548cf9b2a14a",
+                "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/f3ad69181b8afed2c9edf7be5a2918144ff4ea32",
+                "reference": "f3ad69181b8afed2c9edf7be5a2918144ff4ea32",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -2440,7 +2444,6 @@
                 "phpunit/phpunit": "^8.5.8"
             },
             "suggest": {
-                "ext-fileinfo": "Required for MimeType",
                 "ext-ftp": "Allows you to use FTP server storage",
                 "ext-openssl": "Allows you to use FTPS server storage",
                 "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2",
@@ -2498,7 +2501,7 @@
             ],
             "support": {
                 "issues": "https://github.com/thephpleague/flysystem/issues",
-                "source": "https://github.com/thephpleague/flysystem/tree/1.x"
+                "source": "https://github.com/thephpleague/flysystem/tree/1.1.4"
             },
             "funding": [
                 {
@@ -2506,7 +2509,7 @@
                     "type": "other"
                 }
             ],
-            "time": "2020-08-23T07:39:11+00:00"
+            "time": "2021-06-23T21:56:05+00:00"
         },
         {
             "name": "league/mime-type-detection",
@@ -9210,16 +9213,16 @@
         },
         {
             "name": "phpunit/phpunit",
-            "version": "8.5.16",
+            "version": "8.5.17",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/phpunit.git",
-                "reference": "cc66f2fc61296be66c99931a862200e7456b9a01"
+                "reference": "79067856d85421c56d413bd238d4e2cd6b0e54da"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/cc66f2fc61296be66c99931a862200e7456b9a01",
-                "reference": "cc66f2fc61296be66c99931a862200e7456b9a01",
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/79067856d85421c56d413bd238d4e2cd6b0e54da",
+                "reference": "79067856d85421c56d413bd238d4e2cd6b0e54da",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -9297,7 +9300,7 @@
             ],
             "support": {
                 "issues": "https://github.com/sebastianbergmann/phpunit/issues",
-                "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.16"
+                "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.17"
             },
             "funding": [
                 {
@@ -9309,7 +9312,7 @@
                     "type": "github"
                 }
             ],
-            "time": "2021-06-05T04:46:20+00:00"
+            "time": "2021-06-23T05:12:43+00:00"
         },
         {
             "name": "sebastian/code-unit-reverse-lookup",
@@ -9995,7 +9998,6 @@
                     "type": "github"
                 }
             ],
-            "abandoned": true,
             "time": "2020-11-30T07:30:19+00:00"
         },
         {

+ 3 - 3
resources/views/store/inStorage/cacheRackStorage.blade.php

@@ -119,8 +119,8 @@
                         for (let key in this.selectedBox)if (this.selectedBox[key]) boxes.push(key);
                         window.tempTip.postBasicRequest("{{url('store/inStorage/resetCacheShelf')}}",{boxes:boxes},res=>{
                             for (let i=0;i<res.boxes.length;i++){
-                                this.$set(this.shelfOccupy,res.boxes[i],false);
-                                this.$set(this.selectedBox,res.boxes[i],false);
+                                this.$set(this.shelfOccupy,res.boxes[i],true);
+                                this.$set(this.selectedBox,res.boxes[i],true);
                             }
                             if (res.data){
                                 window.tempTip.show(res.data);
@@ -199,4 +199,4 @@
             },
         });
     </script>
-@stop
+@stop