Просмотр исходного кода

手持收货页面 添加asn单下总数量

haozi 4 лет назад
Родитель
Сommit
4a8ea577a3

+ 9 - 3
app/Http/Controllers/HandInStorageController.php

@@ -3,6 +3,7 @@
 namespace App\Http\Controllers;
 
 use App\Components\AsyncResponse;
+use App\OracleDOCASNDetail;
 use App\OracleDOCASNHeader;
 use App\Services\HandInStorageService;
 use Carbon\Carbon;
@@ -55,8 +56,11 @@ class HandInStorageController extends Controller
             $customerid=OracleDOCASNHeader::query()->where('asnno',$asnno)->value('customerid');
         $qualityStatus=$handInStorageService->getQualityStatus();
         $attributeLocations=$handInStorageService->getAttributeLocation();
+        $asnQty=$handInStorageService->getAsnQty($asnno);
         return view('store.handInStorage.receiveDetailPage')
-            ->with(['asnno'=>$asnno,'customerid'=>$customerid,'qualityStatus'=>$qualityStatus,'attributeLocations'=>$attributeLocations]);
+            ->with(['asn_expectedqty'=>$asnQty->expectedqty,'asn_receivedqty'=>$asnQty->receivedqty,
+                'asnno'=>$asnno,'customerid'=>$customerid,
+                'qualityStatus'=>$qualityStatus,'attributeLocations'=>$attributeLocations]);
     }
 
     /**
@@ -113,8 +117,10 @@ class HandInStorageController extends Controller
         if ($handInStorageService->checkForwardingLoc($info)===1)$this->error('请维护拣货位');
         try {
             $result = $handInStorageService->fluxHandIn($info);
-            if ($result)$this->success("收货成功");
-            else $this->error("收货失败");
+            if ($result){
+                $asnQty=$handInStorageService->getAsnQty($info['asnno']);
+                $this->success($asnQty);
+            } else $this->error("收货失败");
         } catch (\Exception $e) {
             app('LogService')->log(__METHOD__,'error_'.__FUNCTION__,json_encode($info).'|catch:'.$e->getMessage());
         }

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

@@ -2,6 +2,7 @@
 
 namespace App\Http\Controllers;
 
+use App\Batch;
 use App\Commodity;
 use App\CommodityMaterialBoxModel;
 use App\Components\AsyncResponse;
@@ -19,6 +20,7 @@ use App\OwnerPriceOperation;
 use App\OrderPackageCountingRecord;
 use App\RejectedBill;
 use App\Services\ForeignHaiRoboticsService;
+use App\Services\ForeignZhenCangService;
 use App\Services\StationService;
 use App\Services\StorageService;
 use App\Station;
@@ -251,4 +253,15 @@ sql;
             Cache::put("weight.".$yesterday, $objs);
         }
     }
+
+    public function testZC()
+    {
+        $batches=Batch::query()
+            ->with('orders.orderCommodities.commodity.barcodes')
+            ->where('owner_id',372)
+            ->where('id',149507)
+            ->first();
+        dd($batches);
+        app(ForeignZhenCangService::class)->broadcastBatch($batches);
+    }
 }

+ 20 - 0
app/Services/HandInStorageService.php

@@ -24,11 +24,31 @@ use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\DB;
 use Monolog\Handler\IFTTTHandler;
+use phpDocumentor\Reflection\Types\Object_;
 
 class HandInStorageService
 {
     use ServiceAppAop;
 
+    /**
+     * @param $asnno
+     * @return object
+     * 根据asn单号获取 总预期数量 总已收数量
+     */
+    public function getAsnQty($asnno)
+    {
+        $asnQty=OracleDOCASNDetail::query()
+            ->select('expectedqty','receivedqty')
+            ->where('asnno',$asnno)
+            ->get();
+        $expectedqty=0;
+        $receivedqty=0;
+        foreach ($asnQty as $qty){
+            $expectedqty+=$qty->expectedqty;
+            $receivedqty+=$qty->receivedqty;
+        }
+        return (object)array('expectedqty'=>$expectedqty,'receivedqty'=>$receivedqty);
+    }
     /**
      * @param array $info
      * @return bool|int

+ 24 - 3
resources/views/store/handInStorage/receiveDetailPage.blade.php

@@ -9,6 +9,10 @@
             </div>
             <div class="card-body">
                 <div class="form-group row m-1">
+                    <span class="font-weight-bold text-sm-right" v-if="asnno">
+                        @{{ asnno }}_已收/待收数量: @{{ asn_receivedqty }}/@{{ asn_expectedqty }}</span>
+                </div>
+                <div class="form-group row m-1 mt-1">
                         <span class="text-right">
                             <span class="fa fa-search fa-lg" aria-hidden="true" @click="selectAsnDetails()"></span>
                             <label for="sku" class="text-right text-danger font-weight-bold">产品:</label>
@@ -146,6 +150,8 @@
             data:{
                 asnno:'{!! $asnno !!}',
                 customerid:'{!! $customerid !!}',
+                asn_expectedqty:'{!! $asn_expectedqty !!}',
+                asn_receivedqty:'{!! $asn_receivedqty !!}',
                 qualityStatus:{!! $qualityStatus !!},
                 attributeLocations:{!! $attributeLocations !!},
                 basSku:{},
@@ -233,6 +239,14 @@
                     this.info.name='';
                     this.info.expectedqty=0;
                     this.info.receivedqty=0;
+                    this.info.amount='';
+                    this.info.asnlineno='';
+                    this.info.lotatt01='';
+                    this.info.lotatt02='';
+                    this.info.lotatt03='';
+                    this.info.lotatt04='';
+                    this.info.lotatt05='';
+                    this.info.lotatt08='';
                     this.$forceUpdate()
                 },
                 fillInfo(asnDetail){
@@ -260,7 +274,10 @@
                 enterVal(e){
                     let index = this.element.indexOf(e.target.id)+1;
                     let element = document.getElementById(this.element[index]);
-                    if (element)element.focus();
+                    if (element){
+                        element.focus();
+                        element.select();
+                    }
                     e.preventDefault();
                     return false;
                 },
@@ -300,11 +317,15 @@
                         .then(res=>{
                             if (res.data.success){
                                 window.tempTip.setDuration(2000);
-                                window.tempTip.showSuccess(res.data.data);
-                                this.info={};
+                                window.tempTip.showSuccess('收货成功');
+                                // this.info={};
+                                this.clearInfo();
+                                this.asn_expectedqty=res.data.data.expectedqty;
+                                this.asn_receivedqty=res.data.data.receivedqty;
                                 this.asnDetails=[];
                                 this.$forceUpdate();
                                 document.getElementById("sku").focus();
+                                document.getElementById("sku").select();
                                 return;
                             }
                             window.tempTip.setDuration(2000);