zhouzhendong 4 лет назад
Родитель
Сommit
33105b7c05

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

@@ -141,6 +141,7 @@ class LaborReportController extends Controller
         if(!Gate::allows('人事管理-组长审核')){ return ["success"=>false,"data"=>"您无此权限操作!"];  }
         $id=$request->input('id');
         $laborReport=LaborReport::find($id);
+        if (!$laborReport)return ["success"=>false,"data"=>"数据发生改变,无法操作!"];
         $laborReport->group_user_id=Auth::user()['id'];
         $laborReport->verify_at=date('Y-m-d H:i:s');
         $laborReport->update();

+ 1 - 1
app/Http/Controllers/RejectedBillController.php

@@ -157,7 +157,7 @@ class RejectedBillController extends Controller
         ){
             $mobileShouldBeRequired = 'nullable';
         }}
-        if($data['id_owner']=='4'){
+        if(isset($data['id_owner']) && $data['id_owner']=='4'){
             $mobileShouldBeRequired = 'nullable';
         }
         $mobileDigits = '';

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

@@ -364,6 +364,7 @@ class RejectedBillItemController extends Controller
         $rejectedBillItem->forceDelete();
         /** @var RejectedBill $rejectedBill */
         $rejectedBill = RejectedBill::query()->where('id',$rejectedBillItem->id_rejected_bill)->first();
+        if(!$rejectedBill)return ['success'=>'false','id'=>$request->input('id')];
         $rejectedBill->syncOrderIssue(); // 同步问题件 修改问题件退货状态
         app('LogService')->log(__METHOD__,__FUNCTION__,json_encode($rejectedBillItem),Auth::user()['id']);
         return ['success'=>'true','id'=>$request->input('id')];

+ 61 - 2
app/Http/Controllers/TestController.php

@@ -131,8 +131,67 @@ class TestController extends Controller
 
     public function test3()
     {
-        dispatch(new WeightUpdateInstantBill(OrderPackage::query()->find(17000457)));
-        dispatch(new WeightUpdateInstantBill(OrderPackage::query()->find(17000456)));
+        $sql = <<<SQL
+select * from DOC_ORDER_HEADER
+where ADDTIME>=to_date('2021-08-15 00:00:00','yyyy-mm-dd hh24:mi:ss') AND
+    ADDTIME<=to_date('2021-08-20 16:00:00','yyyy-mm-dd hh24:mi:ss') and SOSTATUS >= '40'
+                                 and CARRIERID in (
+    'BSZFC','BSZX','BSZFCDF','BSZXDF','DBWL','DBWLDF'
+    )
+SQL;
+        $s = new \App\Http\Controllers\api\thirdPart\flux\WaybillController();
+        $arr = DB::connection("oracle")->select(DB::raw($sql));
+        foreach ($arr as $ar){
+            if (Waybill::query()->where("wms_bill_number",'like','%'.$ar->orderno.'%')
+                ->where("created_at",">=",'2021-08-10 00:00:00')->first())continue;
+            $sql = <<<SQL
+select * from DOC_ORDER_DETAILS left join bas_sku on DOC_ORDER_DETAILS.CUSTOMERID = BAS_SKU.CUSTOMERID and DOC_ORDER_DETAILS.sku = BAS_SKU.SKU
+where ORDERNO = ?
+SQL;
+            $details = [];
+            foreach (DB::connection("oracle")->select(DB::raw($sql),[$ar->orderno]) as $item){
+                $details[] = [
+                    "SKU_Descr_c" => $item->descr_c,
+                    "SKU" => $item->sku,
+                    "Alternate_sku1" => $item->alternate_sku1,
+                    "Qtyordered_each" => $item->qtyordered_each,
+                    "Cubic" => $item->cubic,
+                    "GrossWeight" => $item->grossweight,
+                    "NetWeight" => $item->netweight,
+                    "ReservedField01" => $ar->soreference1,
+                    "ReservedField02" => $ar->soreference2,
+                    "ReservedField03" => $ar->soreference3,
+                    "ReservedField04" => $ar->soreference4,
+                    "ReservedField05" => $ar->soreference5,
+                ];
+            }
+            $r = new Request();
+            $res = [
+                "OrderNo" => $ar->orderno,
+                "CustomerID" => $ar->customerid,
+                "CarrierID" => $ar->carrierid,
+                "ConsigneeName" => $ar->consigneename,
+                "C_Tel1" => $ar->c_tel1,
+                "C_Address1" => $ar->c_address1,
+                "C_Province" => $ar->c_province,
+                "C_City" => $ar->c_city,
+                "C_District" => $ar->c_district,
+                "ReservedField01" => $ar->soreference1,
+                "ReservedField02" => $ar->soreference2,
+                "ReservedField03" => $ar->soreference3,
+                "ReservedField04" => $ar->soreference4,
+                "ReservedField05" => $ar->soreference5,
+                "order_list" => $details,
+            ];
+            $a = [$res];
+            $r->offsetSet("request",$a);
+            $s->new_($r);
+        }
+
+    }
+    public function test4()
+    {
+        return response()->redirectTo("transport/waybill/android/waybillDispatch");
     }
     public function OwnerStoreFeeReportService_recordReport()
     {

+ 76 - 1
app/Http/Controllers/WaybillController.php

@@ -5,7 +5,6 @@ namespace App\Http\Controllers;
 
 use App\CarType;
 use App\Components\AsyncResponse;
-use App\Logistic;
 use App\Owner;
 use App\Region;
 use App\Services\CarTypeService;
@@ -844,6 +843,7 @@ SQL;
             'logistic_id'=>'required_without:order_id|integer',
             'carrier_bill'=>"sometimes|required|max:50|unique:waybills,carrier_bill,$id",
             'fee'=>'sometimes|nullable|min:0|numeric|max:999999',
+            'inquire_tel'=>'required',
             'carType_id'=>'sometimes|required|integer',
             'other_fee'=>'sometimes|nullable|min:0|numeric|max:999999',
             'charge'=>'sometimes|nullable|min:0|numeric|max:999999',
@@ -879,6 +879,7 @@ SQL;
             'integer'=>':attribute 必须为数字',
         ],[
             'logistic_id'=>'承运商',
+            'inquire_tel'=>'查件电话',
             'carrier_bill'=>'承运商单号',
             'fee'=>'运费',
             'other_fee'=>'其他费用',
@@ -1198,4 +1199,78 @@ SQL;
         }
         $this->error('打印失败');
     }
+
+    /**
+     * 运输发货在PC-APP上临时入口
+     */
+    public function shipment()
+    {
+        $logistics = app("LogisticService")->getSelection(['id','name','tag'],"物流");
+        return view("transport.waybill.android.shipment",compact("logistics"));
+    }
+
+    /**
+     * 发货与合并
+     */
+    public function shipmentAndMerge()
+    {
+        $waybill = Waybill::query()->where("waybill_number",\request("waybill"))->whereNull("deliver_at")
+            ->whereNotIn("status",["已完结","无模型"])->first();
+        if (!$waybill)$this->error("运单禁止操作");
+        $codes = explode("\n",\request("order"));
+        $waybills = Waybill::query()->whereIn("wms_bill_number",$codes)
+            ->where("id","!=",$waybill->id)
+            ->whereNull("deliver_at")
+            ->whereNotIn("status",["已完结","无模型"])->get();
+        if ($waybills->count()){
+            if ($waybills->count()<count($codes)-1)$this->error("存在非法订单");
+            $destroys = [];
+            $owner = [$waybill->owner_id];
+            foreach ($waybills as $item){
+                //信息一致性校验
+                $identical = ($waybill->order && ($item->order->consignee_name!=$waybill->order->consignee_name
+                            || $item->order->consignee_phone!=$waybill->order->consignee_phone
+                            || $item->order->address!=$waybill->order->address)) ||
+                    (!$waybill->order && ($item->recipient!=$waybill->recipient
+                            || $item->recipient_mobile!=$waybill->recipient_mobile
+                            || $item->destination!=$waybill->destination));
+                if ($identical)$this->error("订单信息不一致,无法统一发货");
+                $destroys[] = $item->id;
+                $waybill->source_bill .= $item->source_bill ? ",".$item->source_bill : '';
+                $waybill->wms_bill_number .= $item->wms_bill_number ? ",".$item->wms_bill_number : '';
+                $waybill->charge += (double)$item->charge;
+                $waybill->collect_fee += (double)$item->collect_fee;
+                $waybill->other_fee += (double)$item->other_fee;
+                $waybill->warehouse_weight_other += (double)$item->warehouse_weight_other;
+                $waybill->warehouse_weight += (double)$item->warehouse_weight;
+                $waybill->ordering_remark = $waybill->ordering_remark ? $waybill->ordering_remark.",".$item->ordering_remark : $item->ordering_remark;
+                $owner[] = $item->owner_id;
+            }
+            if (strlen($waybill->source_bill)>191 || strlen($waybill->wms_bill_number)>191)$this->error("单号超长,无法合并");
+            $owner = array_unique($owner);
+            if (count($owner)>1)$waybill->merge_owner = implode(',',$owner);
+            $waybill->deliver_at = date("Y-m-d H:i:s");
+            $waybill->update();
+            Waybill::destroy($destroys);
+            WaybillAuditLog::query()->create([
+                'waybill_id'=>$waybill->id,
+                'audit_stage'=>'合并运单',
+                'user_id'=>Auth::id(),
+            ]);
+            WaybillAuditLog::query()->create([
+                'waybill_id'=>$waybill->id,
+                'audit_stage'=>'合单发货',
+                'user_id'=>Auth::id(),
+            ]);
+        }else $waybill->update(["deliver_at"=>date("Y-m-d H:i:s")]);
+        $this->success();
+    }
+
+    /**
+     * 运输发货在PC-APP上临时入口
+     */
+    public function waybillDispatch()
+    {
+        return view("transport.waybill.android.dispatch");
+    }
 }

+ 96 - 0
resources/views/transport/waybill/android/dispatch.blade.php

@@ -0,0 +1,96 @@
+@extends('layouts.app')
+@section('title')运单发货@endsection
+
+@section('content')
+    <div class="container-fluid d-none" id="container">
+        <div class="mt-3 col-8 offset-2">
+            <div class="form-group row">
+                <label for="waybill">运单号</label>
+                <input id="waybill" type="text" class="form-control" v-model="info.waybill" @keydown.enter="enterVal($event)"></input>
+            </div>
+            <div class="form-group row">
+                <label for="logistic">物流单号</label>
+                <input id="logistic" type="text" class="form-control form-control-sm" v-model="info.waybill" @keydown.enter="enterVal($event)"></input>
+            </div>
+            <div class="form-group row">
+                <label for="phone">查件电话</label>
+                <input id="phone" type="text" class="form-control form-control-sm" v-model="info.waybill" @keydown.enter="enterVal($event)"></input>
+            </div>
+            <div class="form-group row">
+                <label for="amount">数量</label>
+                <div class="input-group input-group-sm">
+                    <input id="amount" type="text" class="form-control" v-model="info.waybill" @keydown.enter="enterVal($event)"></input>
+                    <div class="input-group-append">
+                        <span class="input-group-text">件</span>
+                    </div>
+                </div>
+            </div>
+            <div class="form-group row">
+                <label for="weight">重量</label>
+                <div class="input-group input-group-sm">
+                    <input id="weight" type="text" class="form-control" v-model="info.waybill" @keydown.enter="enterVal($event)"></input>
+                    <div class="input-group-append">
+                        <span class="input-group-text">KG</span>
+                    </div>
+                </div>
+            </div>
+            <div class="form-group row">
+                <label for="volume">体积</label>
+                <div class="input-group input-group-sm">
+                    <input id="volume" type="text" class="form-control" v-model="info.waybill" @keydown.enter="enterVal($event)"></input>
+                    <div class="input-group-append">
+                        <span class="input-group-text">M³</span>
+                    </div>
+                </div>
+            </div>
+            <div class="input-group row">
+                <button type="submit" id="submit" class="btn btn-success offset-2 col-10" @click="executeSubmit()">提交调配信息</button>
+            </div>
+        </div>
+    </div>
+@stop
+
+@section('lastScript')
+    <script type="text/javascript">
+        new Vue({
+            el:"#container",
+            data:{
+                isAndroid:false,
+                info:{},
+                element:["waybill","logistic"],
+                counter:0,
+            },
+            mounted(){
+                if (navigator.userAgent.indexOf("Android")!==-1)this.isAndroid = true;
+                this.pageInit();
+                $("#container").removeClass("d-none");
+                let element = document.getElementById("waybill");
+                if (element)element.focus();
+            },
+            methods:{
+                //页面初始化
+                pageInit(){
+                    if (!this.isAndroid)return;
+                    let element = document.getElementById("navbarSupportedContent").parentElement;
+                    element.className = "row";
+                    element.children[0].className += " col-5";
+                    element.children[0].href = "#";
+                    element.innerHTML = element.children[0].outerHTML;
+                    let e1 = document.getElementById("menu");
+                    let e2 = document.getElementById("demand-div");
+                    if (e1)e1.remove();
+                    if (e2)e2.remove();
+                    document.getElementById("container").style.height = (window.innerHeight-100)+"px";
+                },
+                //回车向下TAB
+                enterVal(e){
+                    let index = this.element.indexOf(e.target.id)+1;
+                    let element = document.getElementById(this.element[index]);
+                    if (element)element.focus();
+                    e.preventDefault();
+                    return false;
+                },
+            },
+        });
+    </script>
+@stop

+ 107 - 0
resources/views/transport/waybill/android/shipment.blade.php

@@ -0,0 +1,107 @@
+@extends('layouts.app')
+@section('title')运单发货@endsection
+
+@section('content')
+    <div class="container-fluid d-none" id="container">
+        <div class="mt-3 col-8 offset-2">
+            <div class="form-group row">
+                <label for="waybill">运单号</label>
+                <input id="waybill" type="text" class="form-control" v-model="info.waybill" @keydown.enter="enterVal($event)"></input>
+            </div>
+            <div class="form-group row mt-4">
+                <label for="logistic">承运商</label>
+                <select class="form-control" id="logistic" v-model="info.logistic" @keydown.enter="enterVal($event)">
+                    <option v-for="logistic in logistics" v-if="logistic.tag" :value="logistic.id">@{{ logistic.name }}</option>
+                </select>
+            </div>
+            <div class="form-group row mt-4">
+                <label for="order">订单号</label>
+                <textarea id="order" class="form-control" v-model="info.order" @keydown.enter="enterOrder($event)"></textarea>
+            </div>
+            <div class="input-group row mt-5">
+                <button type="submit" id="submit" class="btn btn-success offset-2 col-10" @click="executeSubmit()">提交发货请求</button>
+            </div>
+        </div>
+    </div>
+@stop
+
+@section('lastScript')
+    <script type="text/javascript">
+        new Vue({
+            el:"#container",
+            data:{
+                isAndroid:false,
+                info:{},
+                element:["waybill","logistic"],
+                logistics:[@foreach($logistics as $logistic)@json($logistic),@endforeach],
+                counter:0,
+            },
+            mounted(){
+                if (navigator.userAgent.indexOf("Android")!==-1)this.isAndroid = true;
+                this.pageInit();
+                $("#container").removeClass("d-none");
+                let element = document.getElementById("waybill");
+                if (element)element.focus();
+            },
+            methods:{
+                //页面初始化
+                pageInit(){
+                    if (!this.isAndroid)return;
+                    let element = document.getElementById("navbarSupportedContent").parentElement;
+                    element.className = "row";
+                    element.children[0].className += " col-5";
+                    element.children[0].href = "#";
+                    element.innerHTML = element.children[0].outerHTML;
+                    let e1 = document.getElementById("menu");
+                    let e2 = document.getElementById("demand-div");
+                    if (e1)e1.remove();
+                    if (e2)e2.remove();
+                    document.getElementById("container").style.height = (window.innerHeight-100)+"px";
+                },
+                //回车向下TAB
+                enterVal(e){
+                    let index = this.element.indexOf(e.target.id)+1;
+                    let element = document.getElementById(this.element[index]);
+                    if (element)element.focus();
+                    e.preventDefault();
+                    return false;
+                },
+                enterOrder(e){
+                    this.counter++;
+                    e.preventDefault();
+                    setTimeout(()=>{
+                        if (this.counter>1){
+                            this.executeSubmit();
+                            this.counter = 0;
+                        }else{
+                            this.counter = 0;
+                            e.target.value += '\n';
+                        }
+                    },500);
+                },
+                executeSubmit(){
+                    window.tempTip.setDuration(3000);
+                    if (!this.info.waybill){
+                        let element = document.getElementById("waybill");
+                        if (element)element.focus();
+                        window.tempTip.show("未扫描运单号");return;
+                    }
+                    if (!this.info.logistic){
+                        let element = document.getElementById("logistic");
+                        if (element)element.focus();
+                        window.tempTip.show("未选择承运商");return;
+                    }
+                    if (!this.info.order){
+                        let element = document.getElementById("order");
+                        if (element)element.focus();
+                        window.tempTip.show("未扫描订单号");return;
+                    }
+                    window.tempTip.postBasicRequest("{{url('transport/waybill/android/shipment')}}",this.info,()=>{
+                        this.info = {};
+                        return "发货成功";
+                    });
+                }
+            },
+        });
+    </script>
+@stop

+ 19 - 2
resources/views/transport/waybill/delivering.blade.php

@@ -3,7 +3,7 @@
 
 @section('content')
     <div id="list" class=" container-fluid">
-        <form method="GET" action="{{url('transport/waybill/delivering')}}" id="form">
+<!--        <form method="GET" action="{{url('transport/waybill/delivering')}}" id="form">
             计费模型  <div class="text-nowrap mb-0" style="background: #fff;">
                 <div v-if="isBeingFilterConditions">
                     <div><div class="col" style="padding:0">
@@ -41,7 +41,7 @@
                     </span>
                 </div>
             </div>
-        </form>
+        </form>-->
         <div class="card">
             <table class="card-body table table-sm table-hover table-striped table-bordered d-none d-sm-block p-0 text-nowrap td-min-width-80" style="width: 100%" id="table">
                 <tr v-for="(waybill,i) in waybills">
@@ -204,6 +204,8 @@
             let _this=this;
             $(".tooltipTarget").tooltip({'trigger':'hover'});
             _this.initInputs();
+            if (navigator.userAgent.indexOf("Android")!==-1)this.isAndroid = true;
+            this.pageInit();
             $("#list").removeClass('d-none');
             let column = [
                 {name:'index',value: '序号', neglect: true},
@@ -246,6 +248,21 @@
 
         },
         methods:{
+            //页面初始化
+            pageInit(){
+                if (!this.isAndroid)return;
+                let element = document.getElementById("navbarSupportedContent").parentElement;
+                element.className = "row";
+                element.children[0].className += " col-5";
+                element.children[0].href = "#";
+                element.innerHTML = element.children[0].outerHTML;
+                let e1 = document.getElementById("menu");
+                let e2 = document.getElementById("demand-div");
+                if (e1)e1.remove();
+                if (e2)e2.remove();
+                element = document.getElementById("container");
+                if (element)element.style.height = (window.innerHeight-100)+"px";
+            },
             initInputs:function(){
                 let data=this;
                 let uriParts =decodeURI(location.href).split("?");

+ 7 - 0
resources/views/transport/waybill/edit.blade.php

@@ -67,6 +67,13 @@
                                     <input hidden id="deliver_at"  name="deliver_at" type="text" class="form-control col-4">
                                 </div>
                             </div>
+                            <div class="form-group row">
+                                <label for="inquire_tel" class="col-2 col-form-label text-right text-primary">查件电话 *</label>
+                                <div class="col-8">
+                                    <input id="inquire_tel" name="inquire_tel" type="text" class="form-control col-8 @error('inquire_tel') is-invalid @enderror"
+                                           value="@if(old('inquire_tel')){{ old('inquire_tel') }}@else{{$waybill->inquire_tel}}@endif">
+                                </div>
+                            </div>
                             <div v-if="waybill.logistic_id == 15 || waybill.type=='德邦物流'" style="background: black">
                                 <div class="form-group row">
                                     <label for="cargo_name" class="col-2 col-form-label text-right text-primary">货物名称 *</label>

+ 5 - 0
routes/web.php

@@ -347,6 +347,11 @@ Route::group(['middleware'=>'auth'],function ($route){
     $route->group(['prefix'=>'transport'],function(){
         /** 运单 */
         Route::group(['prefix'=>'waybill'],function(){
+            Route::group(['prefix'=>'android'],function (){
+                Route::get("shipment",'WaybillController@shipment');
+                Route::post("shipment",'WaybillController@shipmentAndMerge');
+                Route::get("waybillDispatch",'WaybillController@waybillDispatch');
+            });
             /** 置顶 */
             Route::group(['prefix'=>'ontop'],function(){
                 Route::post('top','WaybillController@waybillOnTop');