Переглянути джерело

Merge branch 'master' into zzd

# Conflicts:
#	app/Http/Controllers/TestController.php
zhouzhendong 4 роки тому
батько
коміт
0b72167817

+ 50 - 0
app/Http/Controllers/WaybillController.php

@@ -1036,6 +1036,7 @@ class WaybillController extends Controller
         $waybill = $waybills->first();
         $destroys = [];
         $owner = [$waybill->owner_id];
+        if (array_search($waybill->status,["未审核","已审核"])===false)$this->error("运单禁止合并");
         for ($i=1;$i<$waybills->count();$i++){
             //信息一致性校验
             $identical = ($waybill->order && ($waybills[$i]->order->consignee_name!=$waybill->order->consignee_name
@@ -1056,6 +1057,7 @@ class WaybillController extends Controller
             $waybill->warehouse_weight += (double)$waybills[$i]->warehouse_weight;
             $owner[] = $waybills[$i]->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->update();
@@ -1067,4 +1069,52 @@ class WaybillController extends Controller
         ]);
         $this->success($waybill->waybill_number);
     }
+
+    /**
+     * 运单拆分
+     */
+    public function waybillSplit(Request $request)
+    {
+        $this->gate("运输管理-编辑");
+        $ids = $request->input("ids");
+        DB::beginTransaction();
+        try {
+            /** @var Collection $waybills */
+            $waybills = Waybill::query()->whereHas("waybillAuditLogs",function ($query){
+                $query->where("audit_stage","合并运单");
+            })->whereIn("id",$ids)->get();
+            if ($waybills->count()==0)$this->error("运单不存在或非合并运单");
+            foreach ($waybills as $waybill){
+                $codes = explode(",",$waybill->wms_bill_number);
+                $bills = explode(",",$waybill->source_bill);
+                if (!$codes)continue;
+                /** @var Collection $destroys */
+                foreach (Waybill::onlyTrashed()->whereIn("wms_bill_number",$codes)->get() as $obj){
+                    unset($codes[array_search($obj->wms_bill_number,$codes)]);
+                    unset($bills[array_search($obj->source_bill,$bills)]);
+                    $waybill->charge -= (double)$obj->charge;
+                    $waybill->collect_fee -= (double)$obj->collect_fee;
+                    $waybill->other_fee -= (double)$obj->other_fee;
+                    $waybill->warehouse_weight_other -= (double)$obj->warehouse_weight_other;
+                    $waybill->warehouse_weight -= (double)$obj->warehouse_weight;
+                }
+                Waybill::onlyTrashed()->whereIn("wms_bill_number",explode(",",$waybill->wms_bill_number))->restore();
+                $waybill->merge_owner = null;
+                $waybill->source_bill = implode(",",$bills);
+                $waybill->wms_bill_number = implode(",",$codes);
+                $waybill->update();
+                WaybillAuditLog::query()->create([
+                    'waybill_id'=>$waybill->id,
+                    'audit_stage'=>'拆单返回',
+                    'user_id'=>Auth::id(),
+                ]);
+
+            }
+            DB::commit();
+        }catch (\Exception $e){
+            DB::rollBack();
+            $this->error($e->getMessage());
+        }
+        $this->success(count($ids)==$waybills->count() ? '运单拆单完毕' : '部分运单不符合拆单条件');
+    }
 }

+ 8 - 10
app/Services/DbOpenService.php

@@ -21,7 +21,7 @@ class DbOpenService
      * 创建德邦订单,生成快递单号
      * @param array $params
      */
-    public function getDbOrderNo($params = [])
+    public function getDbOrderNo(array $params = []):array
     {
         //获取系统无快递单号订单信息
         $order_info = Waybill::query()
@@ -33,7 +33,6 @@ class DbOpenService
             ->first();
         //请求德邦API 生成新订单
         $model = new OrderLogistic();
-        $uri = "http://dpsanbox.deppon.com/sandbox-web/dop-standard-ewborder/createOrderNotify.action";
         $header = [
             'Content-Type' => 'application/x-www-form-urlencoded;charset=utf-8',
             "Accept" => "application/json"
@@ -108,18 +107,18 @@ class DbOpenService
                         'key' => ''
                     ]
                 ];
-                $param = json_encode($data, true);
+                $param = json_encode($data,1);
                 $dd["params"] = $param;
                 $dd["timestamp"] = (integer)getMillisecond();
                 $dd["digest"] = base64_encode(md5($param . config('api_logistic.DB.prod.app_key') . $dd['timestamp']));
                 $dd["companyCode"] = config('api_logistic.DB.prod.company_code');
-                $return = httpPost($uri, $dd, $header);
+                $return = httpPost(config('api_logistic.DB.prod.uri')['create_order'], $dd, $header);
                 unset($data);
+                $id = $params['id'];
+                $order_no = $order_info->wms_bill_number;
                 if (array_key_exists('result', $return)) {
                     //请求成功  快递单号 $return['mailNo']   请求编号 $return['uniquerRequestNumber']
                     //返回日志记录
-                    $id = $params['id'];
-                    $order_no = $order_info->wms_bill_number;
                     $mail_no = $return['mailNo']??'';
                     $add_data = [
                         'order_id' => $order_info->order->id,
@@ -159,10 +158,9 @@ class DbOpenService
      * @param array $params
      * @return array
      */
-    public function getOrderStatus($params = [])
+    public function getOrderStatus(array $params = []):array
     {
         if ( ($params['mailNo']??'') == '') return ['code' => 0 , 'msg' => '德邦运单号不能为空'];
-        $uri = "http://dpsanbox.deppon.com/sandbox-web/standard-order/newTraceQuery.action";
         $header = [
             'Content-Type' => 'application/x-www-form-urlencoded;charset=utf-8',
             "Accept" => "application/json"
@@ -170,12 +168,12 @@ class DbOpenService
         $data = [
             'mailNo' => $params['mailNo']??''
         ];
-        $param = json_encode($data, true);
+        $param = json_encode($data, 1);
         $dd["params"] = $param;
         $dd["timestamp"] = (integer)getMillisecond();
         $dd["digest"] = base64_encode(md5($param . config('api_logistic.DB.prod.app_key') . $dd['timestamp']));
         $dd["companyCode"] = config('api_logistic.DB.prod.company_code');
-        $return = httpPost($uri, $dd, $header);
+        $return = httpPost(config('api_logistic.DB.prod.uri')['order_locus'], $dd, $header);
         if (array_key_exists('result', $return) && $return['result'] == 'true' && array_key_exists('resultCode', $return) && $return['resultCode'] == '1000'){
            return ['code'=> 1, 'msg'=> '正在加载中。。。', 'data' => $return['responseParam']];
         }

+ 2 - 4
app/Services/StorageService.php

@@ -495,8 +495,7 @@ sql;
         }
     }
 
-    private function
-    checkAsn($task)
+    private function checkAsn($task)
     {
         $sql = <<<SQL
 SELECT 1 FROM DOC_ASN_DETAILS WHERE ASNNO = ? AND LINESTATUS != '40'
@@ -507,8 +506,7 @@ SQL;
         $sql = <<<SQL
 SELECT 1 FROM TSK_TASKLISTS WHERE TASKPROCESS != '99' AND TASKTYPE = 'PA' AND DOCNO = ?
 SQL;
-        $task = DB::connection("oracle")->selectOne(DB::raw($sql),[$task->docno]);
-        if ($task)return;
+        if (DB::connection("oracle")->selectOne(DB::raw($sql),[$task->docno]))return;
 
         DB::connection("oracle")->update(DB::raw("UPDATE DOC_ASN_HEADER SET asnstatus = '99',edittime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),editwho = ? WHERE asnno = ?"),
             [date("Y-m-d H:i:s"),$task->who,$task->docno]);

+ 2 - 0
config/api_logistic.php

@@ -183,6 +183,7 @@ return [
             'passwordSigning' => 'N', //是否口令签收 仅适用于快递,Y:需要 N: 不需要;若为Y,必须收货人提供验证码给快递员才能签收,该服务是有偿的,具体费用请让我司收货营业部联系张宁(491407),请慎重使用!
             'uri' => [
                 'create_order' => 'http://dpsanbox.deppon.com/sandbox-web/dop-standard-ewborder/createOrderNotify.action',
+                'order_locus' => 'http://dpsanbox.deppon.com/sandbox-web/standard-order/newTraceQuery.action',
             ]
         ],
         'prod'=>[
@@ -200,6 +201,7 @@ return [
             'passwordSigning' => 'N', //是否口令签收 仅适用于快递,Y:需要 N: 不需要;若为Y,必须收货人提供验证码给快递员才能签收,该服务是有偿的,具体费用请让我司收货营业部联系张宁(491407),请慎重使用!
             'uri' => [
                 'create_order' => 'http://dpsanbox.deppon.com/sandbox-web/dop-standard-ewborder/createOrderNotify.action',
+                'order_locus' => 'http://dpsanbox.deppon.com/sandbox-web/standard-order/newTraceQuery.action',
             ]
         ]
     ],

+ 3 - 1
database/migrations/2021_07_07_103716_change_warehouses_table.php

@@ -28,7 +28,9 @@ class ChangeWarehousesTable extends Migration
     public function down()
     {
         Schema::table('warehouses', function (Blueprint $table) {
-            //
+            $table->dropColumn('province_id');
+            $table->dropColumn('city_id');
+            $table->dropColumn('county_id');
         });
     }
 }

+ 4 - 1
database/migrations/2021_07_07_164742_change_waybills_add_db_table.php

@@ -29,7 +29,10 @@ class ChangeWaybillsAddDbTable extends Migration
     public function down()
     {
         Schema::table('waybills', function (Blueprint $table) {
-            //
+            $table->dropColumn('cargo_name');
+            $table->dropColumn('total_number');
+            $table->dropColumn('total_weight');
+            $table->dropColumn('deliveryType_id');
         });
     }
 }

+ 7 - 1
database/migrations/2021_07_15_173811_alert_order_type_column_in_waybills_table.php

@@ -33,7 +33,13 @@ class AlertOrderTypeColumnInWaybillsTable extends Migration
     public function down()
     {
         Schema::table('waybills', function (Blueprint $table) {
-            //
+            $table->dropColumn('order_type');
+            $table->dropColumn('transport_type');
+            $table->dropColumn('pay_type');
+            $table->dropColumn('back_sign_bill');
+            $table->dropColumn('package_service');
+            $table->dropColumn('total_number');
+            $table->dropColumn('deliveryType_id');
         });
     }
 }

+ 34 - 0
database/migrations/2021_07_29_153104_change_waybills_wms_number_length.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeWaybillsWmsNumberLength extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('waybills', function (Blueprint $table) {
+            $table->string('wms_bill_number')->nullable()->comment('WMS单号')->change();
+            $table->string('origination')->comment('始发地')->change();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('waybills', function (Blueprint $table) {
+            $table->string('wms_bill_number',50)->unique()->nullable()->comment('WMS单号')->change();
+            $table->string('origination',50)->comment('始发地')->change();
+        });
+    }
+}

+ 5 - 5
resources/views/maintenance/carType/create.blade.php

@@ -11,7 +11,7 @@
                         <label for="name" class="col-2 col-form-label text-right">车辆名称</label>
                         <div class="col-8">
                             <input type="text" class="form-control @error('CarType.name') is-invalid @enderror"
-                                   name="CarType[name]" autocomplete="off" value="{{ old('CarType')['name'] }}">
+                                   name="CarType[name]" autocomplete="off" value="{{ old('CarType')['name'] ?? '' }}">
                             @error('CarType.name')
                             <span class="invalid-feedback" role="alert">
                                         <strong>{{ $errors->first('CarType.name') }}</strong>
@@ -23,7 +23,7 @@
                         <label for="model" class="col-2 col-form-label text-right">车辆型号</label>
                         <div class="col-8">
                             <input type="text" class="form-control @error('CarType.model') is-invalid @enderror"
-                                   name="CarType[model]" autocomplete="off" value="{{ old('CarType')['model'] }}">
+                                   name="CarType[model]" autocomplete="off" value="{{ old('CarType')['model'] ?? '' }}">
                             @error('CarType.model')
                             <span class="invalid-feedback" role="alert">
                                        <strong>{{ $errors->first('CarType.model') }}</strong>
@@ -35,7 +35,7 @@
                         <label for="length" class="col-2 col-form-label text-right">车辆长度(米)</label>
                         <div class="col-8">
                             <input type="text" class="form-control @error('CarType.length') is-invalid @enderror"
-                                   name="CarType[length]" autocomplete="off" value="{{ old('CarType')['length'] }}">
+                                   name="CarType[length]" autocomplete="off" value="{{ old('CarType')['length'] ?? '' }}">
                             @error('CarType.length')
                             <span class="invalid-feedback" role="alert">
                                         <strong>{{ $errors->first('CarType.length') }}</strong>
@@ -47,7 +47,7 @@
                         <label for="load" class="col-2 col-form-label text-right">车辆载重(吨)</label>
                         <div class="col-8">
                             <input type="text" class="form-control @error('CarType.load') is-invalid @enderror"
-                                   name="CarType[load]" autocomplete="off" value="{{ old('CarType')['load'] }}">
+                                   name="CarType[load]" autocomplete="off" value="{{ old('CarType')['load'] ?? '' }}">
                             @error('CarType.load')
                             <span class="invalid-feedback" role="alert">
                                          <strong>{{ $errors->first('CarType.load') }}</strong>
@@ -59,7 +59,7 @@
                         <label for="remark" class="col-2 col-form-label text-right">备注</label>
                         <div class="col-8">
                             <textarea type="text" class="form-control"
-                                      name="CarType[remark]" autocomplete="off" >{{ old('CarType')['remark'] }}</textarea>
+                                      name="CarType[remark]" autocomplete="off" >{{ old('CarType')['remark'] ?? '' }}</textarea>
                         </div>
                     </div>
                     <div class="form-group row">

+ 74 - 52
resources/views/store/deliveryAppointment/appointment.blade.php

@@ -6,51 +6,51 @@
         <div class="card">
             <div class="card-body row">
                 <div class="offset-2 col-8">
-                    <div class="card">
-                        <div class="card-header">
-                            <div class="row">
-                                <label class="col-2">
-{{--                                    <label class="text-danger font-weight-bold ml-2 h4">*</label>--}}
-                                </label>
-                                <label class="col-2">车牌号</label>
-                                <label class="col-2">车型</label>
-                                <label class="col-2">司机姓名</label>
-                                <label class="col-3">司机电话</label>
-                                {{--<label class="col-1">
-                                    <span class="fa fa-plus cursor-pointer text-primary" @click="addCar()">增加</span>
-                                </label>--}}
-                            </div>
-                        </div>
-                        <div class="card-body">
-                            <div class="row" v-for="(car,i) in model.cars">
-                                <label class="col-2">车辆-@{{ i+1 }}</label>
-                                <label class="col-2">
-                                    <input type="text" class="form-control" v-model="car.license_plate_number" :class="errors['cars.'+i+'.license_plate_number'] ? 'is-invalid' : ''">
-                                </label>
-                                <label class="col-2">
-                                    <div class="dropdown">
-                                        <input type="text" class="form-control" v-model="car.car_name" :id="'car-'+i" @input="searchCar(car.car_name)"
-                                               data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" @click="searchInit()">
-                                        <div class="dropdown-menu" :aria-labelledby="'car-'+i" v-show="haystack.length>0">
-                                            <span class="row offset-1 text-secondary" v-for="c in haystack" @click.stop="selectCar(c,i)">@{{ c.name }}<br></span>
-                                        </div>
-                                    </div>
-                                </label>
-                                <label class="col-2">
-                                    <input type="text" class="form-control" v-model="car.driver_name">
-                                </label>
-                                <label class="col-3">
-                                    <input type="text" class="form-control" v-model="car.driver_phone">
-                                </label>
-                                {{--<label class="col-1" v-if="i!==0">
-                                    <span class="h4 font-weight-bold cursor-pointer text-danger" @click="delCar(i)">&times;</span>
-                                </label>--}}
-                                <label v-if="errors['cars.'+i+'.license_plate_number']" class="col-2 offset-2 text-danger font-weight-bold small">
-                                    @{{ errors['cars.'+i+'.license_plate_number'][0] }}
-                                </label>
-                            </div>
-                        </div>
-                    </div>
+                    <!--                   <div class="card">
+                                           <div class="card-header">
+                                               <div class="row">
+                                                   <label class="col-2">
+                                                       <label class="text-danger font-weight-bold ml-2 h4">*</label>
+                                                   </label>
+                                                   <label class="col-2">车牌号</label>
+                                                   <label class="col-2">车型</label>
+                                                   <label class="col-2">司机姓名</label>
+                                                   <label class="col-3">司机电话</label>
+                                                   <label class="col-1">
+                                                       <span class="fa fa-plus cursor-pointer text-primary" @click="addCar()">增加</span>
+                                                   </label>
+                                               </div>
+                                           </div>
+                                           <div class="card-body">
+                                               <div class="row" v-for="(car,i) in model.cars">
+                                                   <label class="col-2">车辆-@{{ i+1 }}</label>
+                                                   <label class="col-2">
+                                                       <input type="text" class="form-control" v-model="car.license_plate_number" :class="errors['cars.'+i+'.license_plate_number'] ? 'is-invalid' : ''">
+                                                   </label>
+                                                   <label class="col-2">
+                                                       <div class="dropdown">
+                                                           <input type="text" class="form-control" v-model="car.car_name" :id="'car-'+i" @input="searchCar(car.car_name)"
+                                                                  data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" @click="searchInit()">
+                                                           <div class="dropdown-menu" :aria-labelledby="'car-'+i" v-show="haystack.length>0">
+                                                               <span class="row offset-1 text-secondary" v-for="c in haystack" @click.stop="selectCar(c,i)">@{{ c.name }}<br></span>
+                                                           </div>
+                                                       </div>
+                                                   </label>
+                                                   <label class="col-2">
+                                                       <input type="text" class="form-control" v-model="car.driver_name">
+                                                   </label>
+                                                   <label class="col-3">
+                                                       <input type="text" class="form-control" v-model="car.driver_phone">
+                                                   </label>
+                                                   <label class="col-1" v-if="i!==0">
+                                                       <span class="h4 font-weight-bold cursor-pointer text-danger" @click="delCar(i)">&times;</span>
+                                                   </label>
+                                                   <label v-if="errors['cars.'+i+'.license_plate_number']" class="col-2 offset-2 text-danger font-weight-bold small">
+                                                       @{{ errors['cars.'+i+'.license_plate_number'][0] }}
+                                                   </label>
+                                               </div>
+                                           </div>
+                                       </div>-->
                     <div class="row ml-1">
                         <div class="col-6">
                             <div class="row mt-4">
@@ -94,14 +94,36 @@
                         </div>
                         <div class="col-5 offset-1">
                             <div class="row mt-4">
-                                <label class="col-3" for="logistic">快递公司</label>
-                                <select id="logistic" v-model="model.logistic_id" class="col-6 form-control" :class="errors.logistic_id ? 'is-invalid' : ''">
-                                    <option v-for="logistic in logistics" :value="logistic.id">@{{ logistic.name }}</option>
-                                </select>
+                                <label class="col-3" for="isToC">输入车型</label>
+                                <input content="col-4" id="isToC" type="checkbox" class="switch" v-model="model.isToC">
                             </div>
-                            <div class="row mt-2">
-                                <label class="col-3" for="logistic_number">快递单号</label>
-                                <input class="col-9 form-control" type="text" id="logistic_number" v-model="model.logistic_number" :class="errors.logistic_number ? 'is-invalid' : ''">
+                            <div v-if="model.isToC">
+                                <div class="row mt-2">
+                                    <label class="col-3" for="car_name">车型</label>
+                                    <div class="dropdown col-6 d-inline-block p-0">
+                                        <input type="text" class="form-control" v-model="model.cars[0].car_name" id="car-0" @input="searchCar(model.cars[0].car_name)"
+                                               data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" @click="searchInit()">
+                                        <div class="dropdown-menu" aria-labelledby="car-0" v-show="haystack.length>0">
+                                            <span class="row offset-1 text-secondary" v-for="c in haystack" @click.stop="selectCar(c,0)">@{{ c.name }}<br></span>
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="row mt-2">
+                                    <label class="col-3" for="license_plate_number">车牌号</label>
+                                    <input type="text" id="license_plate_number" class="col-9 form-control" v-model="model.cars[0].license_plate_number" :class="errors['cars.0.license_plate_number'] ? 'is-invalid' : ''">
+                                </div>
+                            </div>
+                            <div v-else>
+                                <div class="row mt-2">
+                                    <label class="col-3" for="logistic">快递公司</label>
+                                    <select id="logistic" v-model="model.logistic_id" class="col-6 form-control" :class="errors.logistic_id ? 'is-invalid' : ''">
+                                        <option v-for="logistic in logistics" :value="logistic.id">@{{ logistic.name }}</option>
+                                    </select>
+                                </div>
+                                <div class="row mt-2">
+                                    <label class="col-3" for="logistic_number">快递单号</label>
+                                    <input class="col-9 form-control" type="text" id="logistic_number" v-model="model.logistic_number" :class="errors.logistic_number ? 'is-invalid' : ''">
+                                </div>
                             </div>
                             <div class="row mt-2">
                                 <label class="col-3" for="box_amount">箱数</label>

+ 140 - 56
resources/views/store/deliveryAppointment/list.blade.php

@@ -5,7 +5,7 @@
     <div class="container-fluid d-none" id="container">
         <div id="form"></div>
         <div class="mt-1">
-            <button type="button" class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark text-light':'']"
+            <button type="button" class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
                     data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
                 导出Excel
             </button>
@@ -15,8 +15,8 @@
             </div>
             @can("入库管理-入库预约-质检")<button type="button" class="btn btn-outline-primary" @click="qualityInspectionMark()">质检</button>@endcan
         </div>
-        <table class="table table-striped table-hover text-nowrap td-min-width-80" id="table">
-            <tr class="text-center">
+        <table class="table table-striped table-bordered table-hover text-nowrap td-min-width-80" id="table">
+<!--            <tr class="text-center">
                 <th>
                     <label for="all" id="cloneCheckAll">
                         <input id="all" type="checkbox" @click="checkAll($event)">全选
@@ -25,9 +25,19 @@
                 <th>序号</th>
                 <th>操作</th>
                 <th>状态</th>
-                <th>货主</th>
+                <th>预约号</th>
+                <th>ASN单号</th>
                 <th>预约时间</th>
-                <th>仓库</th>
+                <th>创建时间</th>
+                <th>操作/送达时间</th>
+                <th>货主</th>
+                <th>重量/吨</th>
+                <th>体积/立方</th>
+                <th>箱数</th>
+                <th>备注</th>
+                <th>车号/快递公司</th>
+                <th>车型/快递单号</th>-->
+<!--                <th>仓库</th>
                 <th>
                     <div class="row" style="min-width: 800px">
                         <div class="col-12">车辆信息</div>
@@ -41,13 +51,9 @@
                         <div class="col-3">操作/送达时间</div>
                     </div>
                 </th>
-                <th>吨</th>
-                <th>立方</th>
-                <th>箱数</th>
                 <th>快递公司</th>
                 <th>快递单号</th>
                 <th>采购单号</th>
-                <th>ASN单号</th>
                 <th>
                     <div class="row">
                         <div class="col-12 text-center">明细单</div>
@@ -57,49 +63,71 @@
                         <div class="col-4 text-center">条码</div>
                         <div class="col-2 text-center">数量</div>
                     </div>
-                </th>
-                <th>预约备注</th>
-                <th>创建时间</th>
-            </tr>
-            <tr v-for="(info,i) in list">
-                <td>
-                    <label>
-                        <input class="checkItem" type="checkbox" :value="info.id" v-model="checkData">
-                    </label>
-                </td>
+                </th>-->
+<!--            </tr>-->
+            <tr v-for="(info,i) in list" :id="'info-'+i">
+                <td><input class="checkItem" type="checkbox" :value="list.id"></td>
                 <td>@{{ i+1 }}</td>
                 <td>
-                    @can("入库管理-入库预约-预约管理-签到")<span v-if="(info.status==0 || info.appointment_date==today) && info.cars[0].status==0"><button class="btn btn-sm btn-outline-success" @click="signIn(i,0)">签到</button><br></span>@endcan
-                    <span v-if="info.status==0">
-                        <button type="button" @click="cancel(info.id,i)" class="btn btn-sm btn-outline-danger">取消预约</button><br>
-                        <button type="button" @click="updateDeliveryDate(info,i)" class="btn btn-sm btn-outline-primary">修改预约</button>
-                    </span>
-                    <span v-if="info.status==2">
-                        <button type="button" @click="printReceipt(info)" class="btn btn-sm btn-outline-success"><i class="fa fa-print"></i>&nbsp;打印</button>
+                    <span>
+                         @can("入库管理-入库预约-预约管理-签到")<span v-if="(info.status==0 || info.appointment_date==today) && info.cars[0].status==0"><button class="btn btn-sm btn-outline-success" @click="signIn(i,0)">签到</button><br></span>@endcan
+                        <span v-if="info.status==0">
+                            <button type="button" @click="cancel(info.id,i)" class="btn btn-sm btn-outline-danger">取消预约</button><br>
+                            <button type="button" @click="updateDeliveryDate(info,i)" class="btn btn-sm btn-outline-primary">修改预约</button>
+                        </span>
+                        <span v-if="info.status==2">
+                            <button type="button" @click="printReceipt(info)" class="btn btn-sm btn-outline-success"><i class="fa fa-print"></i>&nbsp;打印</button>
+                        </span>
+                         <span v-if="info.details.length>0">
+                             <br>
+                             <button class="btn btn-sm btn-dark" v-if="currentIndex===i" @click="openDetails(i,true);">关闭明细</button>
+                             <button class="btn btn-sm btn-outline-info" v-else  @click="openDetails(i);">查看明细</button>
+                         </span>
                     </span>
                 </td>
                 <td>
-                    <span v-if="info.status==0 && info.cars.length>0 && info.cars[0].status==1">
+                    <span>
+                        <span v-if="info.status==0 && info.cars.length>0 && info.cars[0].status==1">
                         <span class="fa fa-circle text-primary">作业中</span>
+                        </span>
+                        <span v-else>
+                            <label v-if="!poolMapping.status">
+                                <span class="fa fa-circle text-secondary">未知</span>
+                            </label>
+                            <label v-else>
+                                <small><span class="fa fa-circle" :class="info.status==0 ? 'text-info' : (info.status==2 ? 'text-success' : 'text-danger')"></span></small>
+                                @{{ poolMapping.status[info.status] }}
+                                <span v-if="info.type_mark==0" class="badge badge-primary">质检单</span>
+                            </label>
+                        </span>
                     </span>
-                    <span v-else>
-                        <label v-if="!poolMapping.status">
-                            <span class="fa fa-circle text-secondary">未知</span>
-                        </label>
-                        <label v-else>
-                            <small><span class="fa fa-circle" :class="info.status==0 ? 'text-info' : (info.status==2 ? 'text-success' : 'text-danger')"></span></small>
-                            @{{ poolMapping.status[info.status] }}
-                            <span v-if="info.type_mark==0" class="badge badge-primary">质检单</span>
-                        </label>
-                    </span>
-
                 </td>
-                <td>
-                    <label v-if="!poolMapping.owners"></label>
-                    <label v-else>@{{ poolMapping.owners[info.owner_id] }}</label>
+                <td class="font-weight-bold">
+                    @{{ info.cars[0].appointment_number }}
                 </td>
+                <td><span v-html="warpText(info.asn_number)"></span></td>
                 <td class="text-primary">@{{ info.appointment_date }}&nbsp;&nbsp;@{{ info.period }}</td>
+                <td>@{{ info.created_at }}</td>
+                <td>
+                    <div>
+                        @can("入库管理-入库预约-预约管理-卸货完成")<button class="btn btn-sm btn-outline-success" @click="unloading(i,0)" v-if="info.cars[0].status==1">卸货完成</button>@endcan
+                        <div v-if="info.cars[0].status==2">@{{ info.cars[0].delivery_time }}</div>
+                    </div>
+                </td>
                 <td>
+                    <div>
+                        <label v-if="!poolMapping.owners"></label>
+                        <label v-else>@{{ poolMapping.owners[info.owner_id] }}</label>
+                    </div>
+                </td>
+                <td>@{{ info.tonne>0 ? info.tonne : '-' }}</td>
+                <td>@{{ info.cubic_meter>0 ? info.cubic_meter : '-' }}</td>
+                <td>@{{ info.box_amount>0 ? info.box_amount : '-' }}</td>
+                <td><div class="text-overflow-replace-200">@{{ info.remark }}</div></td>
+                <td>@{{ info.logistic ? info.logistic.name : info.cars[0].license_plate_number }}</td>
+                <td>@{{ info.logistic ? info.logistic_number : (info.cars[0].car ? info.cars[0].car.name : '') }}</td>
+
+<!--                <td>
                     <label v-if="!poolMapping.warehouses"></label>
                     <label v-else>@{{ poolMapping.warehouses[info.warehouse_id] }}</label>
                 </td>
@@ -136,13 +164,9 @@
                         </div>
                     </div>
                 </td>
-                <td>@{{ info.tonne>0 ? info.tonne : '-' }}</td>
-                <td>@{{ info.cubic_meter>0 ? info.cubic_meter : '-' }}</td>
-                <td>@{{ info.box_amount>0 ? info.box_amount : '-' }}</td>
                 <td>@{{ info.logistic ? info.logistic.name : '' }}</td>
                 <td>@{{ info.logistic_number }}</td>
                 <td><span v-html="warpText(info.procurement_number)"></span></td>
-                <td><span v-html="warpText(info.asn_number)"></span></td>
                 <td>
                     <div v-if="info.details.length>0">
                         <div class="row">
@@ -163,9 +187,24 @@
                             <span v-else>展开其余@{{ info.details.length-1 }}条</span>
                         </div>
                     </div>
+                </td>-->
+            </tr>
+            <tr v-if="currentIndex!==undefined" id="await">
+                <td colspan="2"></td>
+                <td colspan="13">
+                    <table class="table table-sm table-bordered table-condensed">
+                        <tr>
+                            <th>商品名称</th>
+                            <th>条码</th>
+                            <th>数量</th>
+                        </tr>
+                        <tr v-for="(detail,i) in list[currentIndex].details">
+                            <td>@{{ detail.commodity_id ? (detail.commodity ? detail.commodity.name : '') : detail.name }}</td>
+                            <td>@{{ detail | getCommodity }}</td>
+                            <td>@{{ detail.amount }}</td>
+                        </tr>
+                    </table>
                 </td>
-                <td>@{{ info.remark }}</td>
-                <td>@{{ info.created_at }}</td>
             </tr>
         </table>
         {{$list->appends($params)->links()}}
@@ -178,6 +217,7 @@
 @section("lastScript")
     <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
     <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
+    <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
     <script>
         new Vue({
             el:"#container",
@@ -186,7 +226,7 @@
                 status:[],
                 warehouses:[],
                 owners:[@foreach($owners as $owner){name:"{{$owner->id}}",value:"{{$owner->name}}"},@endforeach],
-                checkData:[],
+               /* checkData:[],*/
                 poolMapping:{},
                 upList:{},
                 upListDetail:{},
@@ -199,6 +239,8 @@
                 infoShow:false,
                 printInfo:{},
                 today:"",
+                currentIndex:undefined,
+                isShowAwait:false,
             },
             mounted(){
                 let status = [];
@@ -239,15 +281,27 @@
                 let dd = now.getDate();
                 this.today = yy+'-'+(mm<10 ? '0'+mm : mm)+'-'+(dd<10 ? '0'+dd : dd);
             },
-            watch:{
+            /*watch:{
                 checkData:{
                     handler(){
                         document.querySelector('#all').checked = this.checkData.length === this.list.length;
                     },
                     deep:true
                 },
-            },
+            },*/
             methods: {
+                openDetails(index,isClose = false){
+                    if (isClose){
+                        this.currentIndex=undefined;
+                        this.isShowAwait = false;
+                    }else{
+                        this.currentIndex = index;
+                        setTimeout(function (){
+                            $("#info-"+index).after($("#await"));
+                            this.isShowAwait = true;
+                        },100);
+                    }
+                },
                 exePrint(){
                     if (!this.printInfo.signer){
                         window.tempTip.setIndex(1099);
@@ -298,6 +352,36 @@
                         condition:data,
                     });
                     form.init();
+                    let column = [
+                        {name:'index',value: '序号', neglect: true, class:"td-warm"},
+                        {name:'operation',value: '操作', neglect: true, class:"td-warm"},
+                        {name:'status',value: '状态', class:"td-warm"},
+                        {name:'appointment_number',value: '预约号', neglect: true, class:"td-warm"},
+                        {name:'asn_number',value: 'ASN单号', class:"td-warm"},
+                        {name:'appointment_date',value: '预约时间', class:"td-warm"},
+                        {name:'created_at',value: '创建时间', class:"td-warm"},
+                        {name:'delivery_time',value: '操作/送达时间', neglect: true, class:"td-warm"},
+                        {name:'owner_id',value: '货主', class:"td-warm"},
+                        {name:'tonne',value: '重量/吨', class:"td-warm"},
+                        {name:'cubic_meter',value: '体积/立方', class:"td-warm"},
+                        {name:'box_amount',value: '箱数', class:"td-warm"},
+                        {name:'remark',value: '备注', class:"td-warm"},
+                        {name:'logistic_id',value: '车号/快递公司', class:"bg-info"},
+                        {name:'logistic_number',value: '车型/快递单号', class:"bg-info"},
+                    ];
+                    new Header({
+                        el: "table",
+                        name: "deliveryAppointment",
+                        column: column,
+                        data: this.list,
+                        restorationColumn: 'id',
+                        fixedTop:($('#form').height())+2,
+                        before : [
+                            {colspan:'1',value: ''},
+                            {colspan:'13',value: '订单信息', class:"td-warm"},
+                            {colspan:'14',value: '物流信息', class:"bg-info"},
+                        ],
+                    }).init();
                 },
                 upAll(id){
                     let dom = "#item-"+id;
@@ -339,18 +423,18 @@
                         })
                     })
                 },
-                checkAll(e){
+                /*checkAll(e){
                     if (e.target.checked){
                         this.checkData = [];
                         this.list.forEach((el)=>{
                             this.checkData.push(el.id);
                         });
                     }else this.checkData = [];
-                },
+                },*/
                 executeExport(isAll){
                     let url = '{{url('store/deliveryAppointment/export')}}';
                     let token='{{ csrf_token() }}';
-                    excelExport(isAll,this.checkData,url,this.sum,token);
+                    excelExport(isAll,checkData,url,this.sum,token);
                 },
                 updateDeliveryDate(info,index){
                     for (let i=0;i<info.cars.length;i++){
@@ -410,15 +494,15 @@
                     if (isSelect) this.selectDate = {date:date,time:time};
                 },
                 qualityInspectionMark(){
-                    if (this.checkData.length<1){
+                    if (checkData.length<1){
                         window.tempTip.setDuration("3000");
                         window.tempTip.show("未勾选记录");
                         return;
                     }
                     let url = "{{url('store/deliveryAppointment/qualityInspectionMark')}}";
-                    window.tempTip.postBasicRequest(url,{ids:this.checkData},()=>{
+                    window.tempTip.postBasicRequest(url,{ids:checkData},()=>{
                         this.list.forEach(data=>{
-                            if (this.checkData.indexOf(data.id)!==-1){
+                            if (checkData.indexOf(data.id)!==-1){
                                 data.type_mark = 0;
                             }
                         });

+ 10 - 11
resources/views/transport/waybill/edit.blade.php

@@ -57,7 +57,16 @@
                                     <strong class="">@{{ errors['logistic_id'][0] }}</strong>
                                 </div>
                             </div>
-
+                            <div class="form-group row">
+                                <label for="deliver_at" class="col-2 col-form-label text-right text-muted">发货时间</label>
+                                <div class="col-8 form-inline">
+                                    <input  id="deliver_at_date" @input="spliceDeliverAt" name="deliver_at_date" type="date" class="form-control col-4"
+                                            value="@if(old('deliver_at_date')){{ old('deliver_at_date') }}@else{{$waybill->deliver_at_date}}@endif">
+                                    <input  id="deliver_at_time" @input="spliceDeliverAt" name="deliver_at_time" type="time" class="form-control col-4"
+                                            value="@if(old('deliver_at_time')){{ old('deliver_at_time') }}@else{{$waybill->deliver_at_time}}@endif">
+                                    <input hidden id="deliver_at"  name="deliver_at" type="text" class="form-control col-4">
+                                </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>
@@ -329,16 +338,6 @@
                                     </div>
                                 </div>
                             </div>
-                            <div class="form-group row">
-                                <label for="deliver_at" class="col-2 col-form-label text-right text-muted">发货时间</label>
-                                <div class="col-8 form-inline">
-                                    <input  id="deliver_at_date" @input="spliceDeliverAt" name="deliver_at_date" type="date" class="form-control col-4"
-                                            value="@if(old('deliver_at_date')){{ old('deliver_at_date') }}@else{{$waybill->deliver_at_date}}@endif">
-                                    <input  id="deliver_at_time" @input="spliceDeliverAt" name="deliver_at_time" type="time" class="form-control col-4"
-                                            value="@if(old('deliver_at_time')){{ old('deliver_at_time') }}@else{{$waybill->deliver_at_time}}@endif">
-                                    <input hidden id="deliver_at"  name="deliver_at" type="text" class="form-control col-4">
-                                </div>
-                            </div>
                             <div class="form-group row">
                                 <label for="dispatch_remark" class="col-2 col-form-label text-right text-muted">调度备注</label>
                                 <div class="col-8">

+ 30 - 4
resources/views/transport/waybill/index.blade.php

@@ -13,13 +13,13 @@
                             <a target="transport/waybill/index" class="nav-link @if($uriType=='') active @endif" href="{{url('transport/waybill/index')}}">全部</a>
                         </li>
                         <li class="nav-item">
-                            <a target="transport/waybill/index" class="nav-link @if($uriType=='专线') active @endif" href="{{url('transport/waybill/index?uriType=专线')}}">专线</a>
+                            <a target="transport/waybill/index" class="nav-link @if($uriType=='专线') active @endif" href="{{url('transport/waybill/index?uriType=专线&status=未审核')}}">专线</a>
                         </li>
                         <li class="nav-item">
-                            <a target="transport/waybill/index" class="nav-link @if($uriType=='直发车') active @endif" href="{{url('transport/waybill/index?uriType=直发车')}}">直发车</a>
+                            <a target="transport/waybill/index" class="nav-link @if($uriType=='直发车') active @endif" href="{{url('transport/waybill/index?uriType=直发车&status=未审核')}}">直发车</a>
                         </li>
                         <li class="nav-item">
-                            <a target="transport/waybill/index" class="nav-link @if($uriType=='德邦物流') active @endif" href="{{url('transport/waybill/index?uriType=德邦物流')}}">德邦物流</a>
+                            <a target="transport/waybill/index" class="nav-link @if($uriType=='德邦物流') active @endif" href="{{url('transport/waybill/index?uriType=德邦物流&status=未审核')}}">德邦物流</a>
                         </li>
                     </ul>
                 </div>
@@ -43,7 +43,10 @@
                             title="计算指定日期下的所有专线费,不考虑有无货主权限">按日输入专线费</button>@endcan
             @endif
             @can('运输管理-编辑')<button class="btn btn-sm btn-outline-info tooltipTarget"
-                        title="合并多条运单至一条,已填写信息将被累加处理" @click="waybillMerge()">运单合并</button>@endcan
+                        title="合并多条运单至一条,已填写信息将被累加处理" @click="waybillMerge()">运单合并</button>
+            <button class="btn btn-sm btn-outline-info tooltipTarget"
+                    title="将已合并运单拆分返回原状态" @click="waybillSplit()">拆单返回</button>
+            @endcan
             <div>
                 @if(Session::has('successTip'))
                     <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
@@ -449,7 +452,11 @@
                         return;
                     }
                     window.tempTip.confirm("确定要合并选中运单吗?",()=>{
+                        window.tempTip.setDuration(99999);
+                        window.tempTip.waitingTip("合并中,请稍等...");
                         window.tempTip.postBasicRequest("{{url('transport/waybill/waybillMerge')}}",{ids:checkData},res=>{
+                            window.tempTip.cancelWaitingTip();
+                            window.tempTip.setDuration(2000);
                             setTimeout(function (){
                                 location.reload();
                             },1000);
@@ -457,6 +464,25 @@
                         });
                     })
                 },
+                waybillSplit(){
+                    if (checkData.length<1){
+                        window.tempTip.setDuration(2000);
+                        window.tempTip.show("未选择任何记录");
+                        return;
+                    }
+                    window.tempTip.confirm("确定要拆分选中合并单吗?",()=>{
+                        window.tempTip.setDuration(99999);
+                        window.tempTip.waitingTip("拆分中,请稍等...");
+                        window.tempTip.postBasicRequest("{{url('transport/waybill/waybillSplit')}}",{ids:checkData},res=>{
+                            window.tempTip.cancelWaitingTip();
+                            window.tempTip.setDuration(2000);
+                            setTimeout(function (){
+                                location.reload();
+                            },1000);
+                            return res;
+                        });
+                    })
+                },
                 rendingFloatBtn(){
                     let parent = $('.pick-btn :visible');
                     if (parent.length<1)return;

+ 1 - 0
routes/web.php

@@ -377,6 +377,7 @@ Route::group(['middleware'=>'auth'],function ($route){
             Route::post('dailyBilling','WaybillController@dailyBilling');
             Route::post('countPickUpFee','WaybillController@countPickUpFee');
             Route::post('waybillMerge','WaybillController@waybillMerge');
+            Route::post('waybillSplit','WaybillController@waybillSplit');
             Route::resource('waybillFinancialSnapshot','WaybillFinancialSnapshotsController');
             Route::resource('waybillFinancialExcepted','WaybillFinancialExceptedController');
         });