Selaa lähdekoodia

手持入库 收货调整(关联预约asn单号)

haozi 4 vuotta sitten
vanhempi
commit
462cfdc24b

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

@@ -28,9 +28,21 @@ class HandInStorageController extends Controller
             }
             $this->success($asns);
         }else{
-            $this->error('未搜索到ASN单');
+            $this->error('无有效的ASN的订单');
         }
     }
+
+    public function checkAsnOperation(Request $request)
+    {
+        $this->gate("入库管理-手持入库-收货");
+        /** @var HandInStorageService $handInStorageService  */
+        $handInStorageService=app('HandInStorageService');
+        $info= $request->input('info');
+        $res=$handInStorageService->checkAsnOperation($info);
+        if ($res===1)$this->error('无有效的ASN的订单');
+        elseif ($res===2)$this->error('该asn无预约,暂不可收货');
+        else $this->success($res);
+    }
     /**
      * @param $asnno
      * 跳转到收货明细页面
@@ -59,8 +71,7 @@ class HandInStorageController extends Controller
         $asnno= $request->input('asnno');
         $asnDetails =app('HandInStorageService')->selectAsnDetails($asnno);
         if (count($asnDetails)>0)$this->success($asnDetails);
-        else $this->error('未搜索到ASN详情单');
-
+        else $this->error('未查询到相应的asn明细');
     }
     /**
      * @param Request $request

+ 12 - 0
app/Services/DeliveryAppointmentService.php

@@ -206,4 +206,16 @@ class DeliveryAppointmentService
         $total = $warehouse->production_capacity*DeliveryAppointment::HOUR[$period];
         return $total-$result->capacity;
     }
+
+    /**
+     * 检查可操作ASN
+     *
+     * @param string $asn
+     *
+     * @return bool
+     */
+    public function checkOperableAsn(string $asn):bool
+    {
+        return true;
+    }
 }

+ 31 - 5
app/Services/HandInStorageService.php

@@ -23,6 +23,31 @@ class HandInStorageService
 {
     use ServiceAppAop;
 
+
+    public function checkAsnOperation(array $info)
+    {
+        if (!$info['customerid']||!$info['asntype']){
+            $asn=OracleDOCASNHeader::query()
+            ->select(['asnno','asnreference1','asnstatus','addtime','customerid','asntype'])
+            ->where('asnno',$info['asnno'])
+            ->whereIn('asnstatus',['00','30'])
+            ->first();
+            if (!$asn)return 1; //无效asn单号
+            return $this->whetherDeliver($asn);
+        }
+        return $this->whetherDeliver($info);
+    }
+
+    private function whetherDeliver($asn)
+    {
+        if ($asn['asntype']!='XNRK' && $asn['asntype']!='THRK' && $asn['asntype']!='F31'){
+            $res=app(DeliveryAppointmentService::class)->checkOperableAsn($asn['asnno']);
+            if ($res) return $asn;
+            else return 2; //当前asn单号无预约记录
+        }
+        return $asn;
+    }
+
     /**
      * @param $asn
      * @return Builder[]|Collection
@@ -32,7 +57,7 @@ class HandInStorageService
     public function selectAsn($asn)
     {
         if (!$asn) return OracleDOCASNHeader::query()
-            ->select(['asnno','asnreference1','asnstatus','addtime','customerid'])
+            ->select(['asnno','asnreference1','asnstatus','addtime','customerid','asntype'])
             ->where('asnstatus','00')
             ->orderByDesc('addtime')
             ->limit(50)
@@ -40,12 +65,13 @@ class HandInStorageService
 
         if (strpos(strtoupper($asn),'ASN')!==false){
             return OracleDOCASNHeader::query()
-                ->select(['asnno','asnreference1','asnstatus','addtime','customerid'])
+                ->select(['asnno','asnreference1','asnstatus','addtime','customerid','asntype'])
                 ->where('asnno',$asn)
+                ->whereIn('asnstatus',['00','30'])
                 ->get();
         }else {
             $asns=OracleDOCASNHeader::query()
-                ->select(['asnno','asnreference1','asnstatus','addtime','customerid'])
+                ->select(['asnno','asnreference1','asnstatus','addtime','customerid','asntype'])
                 ->where('customerid',strtoupper($asn))
                 ->whereIn('asnstatus',['00','30'])
                 ->get();
@@ -53,11 +79,11 @@ class HandInStorageService
                 return $asns;
             }else{
                 $sql = <<<SQL
- SELECT DOC_ASN_HEADER.ASNNO,DOC_ASN_HEADER.addtime,DOC_ASN_HEADER.asnreference1,DOC_ASN_HEADER.customerid,DOC_ASN_HEADER.asnstatus FROM DOC_ASN_HEADER
+ SELECT DOC_ASN_HEADER.ASNNO,DOC_ASN_HEADER.addtime,DOC_ASN_HEADER.asnreference1,DOC_ASN_HEADER.customerid,DOC_ASN_HEADER.asnstatus,DOC_ASN_HEADER.asntype FROM DOC_ASN_HEADER
                   LEFT JOIN DOC_ASN_DETAILS ON DOC_ASN_HEADER.ASNNO = DOC_ASN_DETAILS.ASNNO
                   LEFT JOIN BAS_SKU ON DOC_ASN_DETAILS.CUSTOMERID = BAS_SKU.CUSTOMERID AND DOC_ASN_DETAILS.SKU = BAS_SKU.SKU
 WHERE DOC_ASN_HEADER.ASNSTATUS in ('00','30') and (BAS_SKU.ALTERNATE_SKU1 = ? OR BAS_SKU.ALTERNATE_SKU2 = ?  OR BAS_SKU.ALTERNATE_SKU3 = ?)
-group by DOC_ASN_HEADER.ASNNO,DOC_ASN_HEADER.addtime,DOC_ASN_HEADER.asnreference1,DOC_ASN_HEADER.customerid,DOC_ASN_HEADER.asnstatus
+group by DOC_ASN_HEADER.ASNNO,DOC_ASN_HEADER.addtime,DOC_ASN_HEADER.asnreference1,DOC_ASN_HEADER.customerid,DOC_ASN_HEADER.asnstatus,DOC_ASN_HEADER.asntype
 SQL;
                 return DB::connection("oracle")->select(DB::raw($sql),[$asn,$asn,$asn]);
             }

+ 1 - 1
bashupMysql.sh

@@ -19,7 +19,7 @@ test_password="123456"
 db="bswas"
 test_db="bswas_test"
 #执行备份语句 --single-transaction 是在导出数据时不锁表
-mysqldump -h$host -u$user -p$password --single-transaction $db --ignore-table=$db.orders --ignore-table=$db.stores --ignore-table=$db.packages --ignore-table=$db.store_items --ignore-table=$db.commodities --ignore-table=$db.commodity_barcodes --ignore-table=$db.logs --ignore-table=$db.order_commodities --ignore-table=$db.order_bins --ignore-table=$db.w_m_s_waybill_orders --ignore-table=$db.rejected_bills --ignore-table=$db.rejected_bill_items --ignore-table=$db.w_m_s_reflect_packages --ignore-table=$db.w_m_s_reflect_receive_skus --ignore-table=$db.w_m_s_reflect_receives --ignore-table=$db.order_counting_records --ignore-table=$db.order_package_commodities --ignore-table=$db.order_packages --ignore-table=$db.packages> $time_nowall.sql
+mysqldump -h$host -u$user -p$password --single-transaction $db --ignore-table=$db.orders --ignore-table=$db.failed_jobs --ignore-table=$db.stores --ignore-table=$db.packages --ignore-table=$db.store_items --ignore-table=$db.commodities --ignore-table=$db.commodity_barcodes --ignore-table=$db.logs --ignore-table=$db.order_commodities --ignore-table=$db.order_bins --ignore-table=$db.w_m_s_waybill_orders --ignore-table=$db.rejected_bills --ignore-table=$db.rejected_bill_items --ignore-table=$db.w_m_s_reflect_packages --ignore-table=$db.w_m_s_reflect_receive_skus --ignore-table=$db.w_m_s_reflect_receives --ignore-table=$db.order_counting_records --ignore-table=$db.order_package_commodities --ignore-table=$db.order_packages --ignore-table=$db.packages> $time_nowall.sql
 mysql  -u$test_user -p$test_password  $test_db< $time_nowall.sql
 mysqldump -h$host -u$user -p$password --single-transaction -q -e $db orders --where="created_at>='$time_30day_ago'" > $time_noworders.sql
 mysql  -u$test_user -p$test_password  $test_db< $time_noworders.sql

+ 25 - 8
resources/views/store/handInStorage/receive.blade.php

@@ -14,12 +14,12 @@
                     <div class="form-group row mt-2">
                         <label for="asn"></label>
                         <input type="text" class="form-control col-8" id="asn" autocomplete="off"
-                               :class="errors.asn ? 'is-invalid' : ''" v-model="info.asn">
+                               :class="errors.asnno ? 'is-invalid' : ''" v-model="info.asnno">
                         <span class="ml-2">
                              <button type="button" id="select" class="btn btn-info" @click="selectAsn()">搜索</button>
                         </span>
-                        <span class="invalid-feedback" role="alert" v-if="errors.asn">
-                            <strong>@{{ errors.asn[0] }}</strong>
+                        <span class="invalid-feedback" role="alert" v-if="errors.asnno">
+                            <strong>@{{ errors.asnno[0] }}</strong>
                         </span>
                     </div>
                 </div>
@@ -107,7 +107,7 @@
                 selectAsn(){
                     this.selectTr='';
                     let url = '{{url('store/handInStorage/selectAsn')}}';
-                    window.axios.post(url,{asnno:this.info.asn})
+                    window.axios.post(url,{asnno:this.info.asnno})
                         .then(res=>{
                             if (res.data.success){
                                 this.asns=res.data.data;
@@ -156,8 +156,9 @@
                         this.selectTr=0
                     }else {
                         this.selectTr=i+1;
-                        this.info.asn=asn.asnno;
+                        this.info.asnno=asn.asnno;
                         this.info.customerid=asn.customerid;
+                        this.info.asntype=asn.asntype;
                     }
                 },
                 onfocus(){
@@ -165,10 +166,26 @@
                 },
                 ensure(){
                     let error = {};
-                    if (!this.info.asn)error.asn = ["ASN号必填"];
-                    if (this.info.asn && this.info.asn.length!==13)error.asn = ["无效ASN号"];
+                    if (!this.info.asnno)error.asnno = ["ASN号必填"];
+                    if (this.info.asnno && this.info.asnno.length!==13)error.asnno = ["无效ASN号"];
                     if (JSON.stringify(error)!=='{}'){this.errors = error;return;}
-                    window.location.href="{{url('store/handInStorage/receiveDetailPage')}}/" + this.info.asn+'/'+ this.info.customerid;
+                    if (!this.info.customerid||!this.info.asntype){this.info.customerid='';this.info.asntype='';}
+                    this.checkAsnOperation();
+                },
+                checkAsnOperation(){
+                    let url = '{{url('store/handInStorage/checkAsnOperation')}}';
+                    window.axios.post(url,{info:this.info})
+                        .then(res=>{
+                            if (res.data.success){
+                                window.location.href="{{url('store/handInStorage/receiveDetailPage')}}/" + res.data.data.asnno+'/'+ res.data.data.customerid;
+                            }else {
+                                window.tempTip.setDuration(2000);
+                                window.tempTip.show(res.data.data);
+                            }
+                        }).catch(err=>{
+                        window.tempTip.setDuration(2000);
+                        window.tempTip.show("网络错误:"+err);
+                    })
                 },
                 cancel(){
                     setTimeout(function () {

+ 1 - 0
routes/web.php

@@ -491,6 +491,7 @@ Route::group(['middleware'=>'auth'],function ($route){
             Route::get('putaway',function (){return view('store.handInStorage.putaway');});//上架页面
             Route::get('android.index',function (){return view('store.handInStorage.androidIndex');});
             Route::post('selectAsn','HandInStorageController@selectAsn');
+            Route::post('checkAsnOperation','HandInStorageController@checkAsnOperation');
             Route::post('selectAsnDetails','HandInStorageController@selectAsnDetails');
             Route::post('getBasSkuWithLot','HandInStorageController@getBasSkuWithLot');
             Route::any('fluxHandIn','HandInStorageController@fluxHandIn');