Преглед изворни кода

Merge branch 'zzd' of ssh://was.baoshi56.com:10022/var/git/bswas

 Conflicts:
	database/migrations/2021_03_03_175304_add_authority_to_customer_owner.php
LD пре 5 година
родитељ
комит
4b0e4f5ec9
30 измењених фајлова са 562 додато и 213 уклоњено
  1. 4 4
      app/Console/Commands/CreateOwnerBillReport.php
  2. 48 0
      app/DeliveryAppointment.php
  3. 32 0
      app/DeliveryAppointmentCar.php
  4. 30 0
      app/DeliveryAppointmentDetail.php
  5. 6 8
      app/Http/Controllers/CustomerController.php
  6. 0 50
      app/Http/Controllers/TestController.php
  7. 0 1
      app/Http/Controllers/WaybillController.php
  8. 19 8
      app/Http/Controllers/api/thirdPart/flux/WaybillController.php
  9. 2 1
      app/Imports/AppointmentDetail.php
  10. 10 1
      app/OwnerBillReport.php
  11. 3 2
      app/Services/OwnerAreaReportService.php
  12. 6 20
      app/Services/WaybillService.php
  13. 1 1
      database/migrations/2020_11_03_095519_seed_menus_level_1.php
  14. 1 1
      database/migrations/2020_11_03_095724_seed_menus_level_2.php
  15. 42 5
      database/migrations/2021_03_03_175304_add_authority_to_customer_owner.php
  16. 41 0
      database/migrations/2021_03_04_141906_change_owner_bill_reports_add_column_bill.php
  17. 9 0
      resources/js/queryForm/header.js
  18. 6 0
      resources/sass/color.scss
  19. 1 1
      resources/views/customer/menu.blade.php
  20. 2 6
      resources/views/customer/project/menu.blade.php
  21. 2 2
      resources/views/finance/billConfirmation.blade.php
  22. 2 2
      resources/views/layouts/menu.blade.php
  23. 4 0
      resources/views/personnel/menu.blade.php
  24. 102 32
      resources/views/personnel/report.blade.php
  25. 12 0
      resources/views/store/checkingReceive/_selectDate.blade.php
  26. 119 31
      resources/views/store/checkingReceive/appointment.blade.php
  27. 14 14
      resources/views/waybill/create.blade.php
  28. 28 8
      resources/views/waybill/index.blade.php
  29. 11 11
      resources/views/waybill/waybillEdit.blade.php
  30. 5 4
      routes/web.php

+ 4 - 4
app/Console/Commands/CreateOwnerBillReport.php

@@ -46,7 +46,7 @@ class CreateOwnerBillReport extends Command
             $year--;
             $lastMonth = '12';
         }else $lastMonth = ($month-1) < 10 ? "0".($month-1) : ($month-1);
-        $sql = "SELECT owner_id,SUM(IFNULL(work_fee,0))+SUM(IFNULL(logistic_fee,0)) AS total FROM owner_fee_details WHERE worked_at LIKE ? AND ((type = '发货' AND logistic_fee IS NOT NULL AND work_fee IS NOT NULL) OR (type <> '发货' AND work_fee IS NOT NULL))  GROUP BY owner_id";
+        $sql = "SELECT owner_id,SUM(IFNULL(work_fee,0)) AS work_fee,SUM(IFNULL(logistic_fee,0)) AS logistic_fee FROM owner_fee_details WHERE worked_at LIKE ? AND ((type = '发货' AND logistic_fee IS NOT NULL AND work_fee IS NOT NULL) OR (type <> '发货' AND work_fee IS NOT NULL))  GROUP BY owner_id";
         $billDetails = DB::select(DB::raw($sql),[$year."-".$lastMonth."%"]);
 
         $areas = OwnerAreaReport::query()->with("ownerStoragePriceModel")->where("counting_month","like",$year."-".$lastMonth."%")->get();
@@ -69,12 +69,12 @@ class CreateOwnerBillReport extends Command
             $createOwnerBillReport = [];
             foreach ($bills as $bill){
                 $key = $bill->owner_id."_".$year."-".$lastMonth;
-                $total = $bill->total;
-                if (isset($map[$key]))$total += $map[$key];
                 $createOwnerBillReport[] = [
                     "owner_id"          => $bill->owner_id,       //项目ID
                     "counting_month"    => $year."-".$lastMonth."-01", //结算月
-                    "initial_fee"       => $total,    //原始账单金额
+                    "work_fee"          => $bill->work_fee,
+                    "logistic_fee"      => $bill->logistic_fee,
+                    "storage_fee"       => $map[$key] ?? 0,
                     "created_at"        => $date,
                 ];
             }

+ 48 - 0
app/DeliveryAppointment.php

@@ -0,0 +1,48 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+use App\Traits\ModelLogChanging;
+
+class DeliveryAppointment extends Model
+{
+    use ModelLogChanging;
+
+    protected $fillable=[
+        "user_id",
+        "owner_id",
+        "procurement_number",
+        "asn_number",
+        "warehouse_id",
+        "tonne",
+        "cubic_meter",
+        "box_amount",
+        "capacity",
+        "appointment_date",
+        "date_period",
+        "status",
+    ];
+
+    public function cars()
+    {   //车辆
+        return $this->hasMany(DeliveryAppointmentCar::class,"delivery_appointment_id","id");
+    }
+    public function details()
+    {   //明细
+        return $this->hasMany(DeliveryAppointmentDetail::class);
+    }
+    public function user()
+    {   //用户
+        return $this->belongsTo(User::class);
+    }
+    public function owner()
+    {   //货主
+        return $this->belongsTo(Owner::class);
+    }
+    public function warehouse()
+    {   //仓库
+        return $this->belongsTo(Warehouse::class);
+    }
+}

+ 32 - 0
app/DeliveryAppointmentCar.php

@@ -0,0 +1,32 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+use App\Traits\ModelLogChanging;
+
+class DeliveryAppointmentCar extends Model
+{
+    use ModelLogChanging;
+
+    protected $fillable=[
+        "delivery_appointment_id",
+        "license_plate_number",
+        "car_id",
+        "driver_name",
+        "driver_phone",
+        "appointment_number",
+        "status",
+    ];
+    public $timestamps=false;
+
+    public function deliveryAppointment()
+    {   //预约信息
+        return $this->belongsTo(DeliveryAppointment::class);
+    }
+    public function car()
+    {   //车辆
+        return $this->belongsTo(CarType::class,"car_id","id");
+    }
+}

+ 30 - 0
app/DeliveryAppointmentDetail.php

@@ -0,0 +1,30 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+use App\Traits\ModelLogChanging;
+
+class DeliveryAppointmentDetail extends Model
+{
+    use ModelLogChanging;
+
+    protected $fillable=[
+        "delivery_appointment_id",
+        "commodity_id",
+        "bar_code",
+        "name",
+        "amount",
+    ];
+    public $timestamps=false;
+
+    public function deliveryAppointment()
+    {   //预约信息
+        return $this->belongsTo(DeliveryAppointment::class);
+    }
+    public function commodity()
+    {   //商品
+        return $this->belongsTo(Commodity::class);
+    }
+}

+ 6 - 8
app/Http/Controllers/CustomerController.php

@@ -36,15 +36,15 @@ class CustomerController extends Controller
         if(!Gate::allows('客户管理-项目-报表')){ return view('customer.index');  }
         $withs = ["ownerBillReport","owner"=>function($query){
             /** @var Builder $query */
-            $query->select("id","name","deleted_at","created_at","customer_id","user_owner_group_id")
-                ->with(["customer","userOwnerGroup"]);
+            $query->select("id","warehouse_id","name","deleted_at","created_at","customer_id","user_owner_group_id")
+                ->with(["customer","userOwnerGroup","warehouse","ownerAreaReport"]);
         }];
         $ownerGroups = app('UserOwnerGroupService')->getSelection();
         $customers = app('CustomerService')->getSelection();
         $owners = app('OwnerService')->getIntersectPermitting();
         $reports = app("OwnerReportService")->paginate($request->input(),$withs);
         $params = $request->input();
-        return response()->view('customer.project.report',compact("reports","ownerGroups","customers","owners","params"));
+        return response()->view('personnel.report',compact("reports","ownerGroups","customers","owners","params"));
     }
 
     public function projectReportExport(Request $request)
@@ -391,7 +391,7 @@ class CustomerController extends Controller
         if(!Gate::allows('结算管理-账单确认-编辑')){ return ["success"=>false,'data'=>"无权操作!"];  }
         if (!$request->confirm_fee || !is_numeric($request->confirm_fee) || $request->confirm_fee<0)return ["success"=>false,"data"=>"非法金额参数"];
         $date = date('Y-m-d H:i:s');
-        app('OwnerBillReportService')->update(["id"=>$request->id],["confirm_fee"=>$request->confirm_fee,"difference"=>DB::raw($request->confirm_fee.'- initial_fee'),"updated_at"=>$date]);
+        app('OwnerBillReportService')->update(["id"=>$request->id],["confirm_fee"=>$request->confirm_fee,"difference"=>DB::raw($request->confirm_fee.'- (IFNULL(work_fee,0)+IFNULL(storage_fee,0)+IFNULL(logistic_fee,0))'),"updated_at"=>$date]);
         LogService::log(__METHOD__,"客户管理-修改账单报表",json_encode($request->input()));
         return ["success"=>true,"data"=>$date];
     }
@@ -538,7 +538,7 @@ class CustomerController extends Controller
         $month = request("month");
         $owner = request("owner");
         $sql = <<<sql
-SELECT owner_id,SUM(IFNULL(work_fee,0))+SUM(IFNULL(logistic_fee,0)) AS total 
+SELECT owner_id,SUM(IFNULL(work_fee,0)) AS work_fee,SUM(IFNULL(logistic_fee,0)) AS logistic_fee 
 FROM owner_fee_details WHERE worked_at LIKE ? 
 sql;
         if ($owner && count($owner)>0){
@@ -568,11 +568,9 @@ sql;
         foreach ($chunks as $bills){
             foreach ($bills as $bill){
                 $key = $bill->owner_id."_".$month;
-                $total = $bill->total;
-                if (isset($map[$key]))$total += $map[$key];
                 OwnerBillReport::query()->where("owner_id",$bill->owner_id)
                     ->where("counting_month",$month."-01")
-                    ->update(["initial_fee"=>$total]);
+                    ->update(["work_fee"=>$bill->work_fee,"logistic_fee"=>$bill->logistic_fee,"storage_fee"=>$map[$key] ?? 0]);
             }
         }
         $this->success();

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

@@ -155,56 +155,6 @@ class TestController extends Controller
     {
         dd(Region::query()->where("id",">=",404)->where("id","<=",432)->delete());
     }
-    public function restoreBill()
-    {
-        ini_set('max_execution_time',2500);
-        ini_set('memory_limit','1526M');
-        OwnerFeeDetail::query()->where("logistic_fee",">",0)
-            ->whereNotNull("logistic_fee")
-            ->where("type","发货")->get()->each(function ($detail){
-                if (!$this->exe($detail)){
-                    dump($detail->id);
-                };
-            });
-    }
-    public function exe(OwnerFeeDetail $feeBill){
-        $order = Order::query()->where("id",$feeBill->outer_id)->first();
-        $order->loadMissing("packages","owner");//加载包裹
-        if (!$order->packages || !$order->owner)return false;
-        $order->owner->loadCount("ownerPriceExpresses");
-        if ($order->owner->owner_price_expresses_count < 1)return false; //不存在计费模型 跳出
-        foreach ($order->packages as $package)if (!$package->weight)return false; //包裹存在且全部存在数量
-
-        $logistic_fee = 0;
-        $volume = 0;
-        $weight = 0;
-        if (!$order->logistic || $order->logistic->type != "快递")$logistic_fee = null;
-        foreach ($order->packages as $package){
-            $volume += $package->bulk;
-            $weight += $package->weight;
-
-            $provinceName = mb_substr($order->province,0,2);
-            $province = app(CacheService::class)->getOrExecute("province_".$provinceName,function ()use($provinceName){
-                return Province::query()->where("name","like",$provinceName."%")->first();
-            },86400);
-            if (!$province)$logistic_fee = null;
-
-            $fee = app("OwnerPriceExpressService")->matching($package->weight, $order->owner_id, $order->logistic_id, $province->id);
-            OwnerFeeDetailLogistic::query()->where("owner_fee_detail_id",$feeBill->id)->where("logistic_bill",$package->logistic_number)->update([
-                "volume"=>$package->bulk,
-                "weight"=>$package->weight,
-                "logistic_fee" => $fee>0 ? $fee : null,
-            ]);
-            if ($logistic_fee!==null){
-                if ($fee<0)$logistic_fee = null;
-                else $logistic_fee += $fee;
-            }
-        }
-        if ($logistic_fee===null || $logistic_fee<0)
-            LogService::log(__METHOD__,"ERROR-校正即时账单计算物流费错误","订单ID:".$order->id."  费用结果:".$logistic_fee);
-        else $feeBill->update(["logistic_fee"=>$logistic_fee,"volume"=>$volume,"weight"=>$weight]);
-        return true;
-    }
     public function tt1(){
         $order = Order::query()->find(2301382);
         app("OrderService")->createInstantBill($order);

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

@@ -80,7 +80,6 @@ class WaybillController extends Controller
         $this->validatorWaybill($request,false)->validate();
         /** @var WaybillService */
         $waybill=app('waybillService')->store($request);
-        app('LogService')->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
         return redirect('waybill/index')->with('successTip','新运单“'.$waybill->waybill_number.'”录入成功');
     }
 

+ 19 - 8
app/Http/Controllers/api/thirdPart/flux/WaybillController.php

@@ -4,10 +4,13 @@ namespace App\Http\Controllers\api\thirdPart\flux;
 
 use App\City;
 use App\Http\Controllers\Controller;
+use App\Order;
 use App\Owner;
+use App\Services\RegionService;
 use App\Unit;
 use App\Waybill;
 use App\OracleBasCustomer;
+use App\WaybillAuditLog;
 use App\WMSWaybill;
 use App\WMSWaybillOrder;
 use Illuminate\Http\Request;
@@ -32,7 +35,7 @@ class WaybillController extends Controller
         }
         $receivedInputtings=$request->input('request');
         foreach ($receivedInputtings as $receiveInputting){
-            if(!WMSWaybill::create($receiveInputting)){
+            if(!WMSWaybill::query()->create($receiveInputting)){
                 Controller::logS(__METHOD__,'error_'.__FUNCTION__,'运单WMS写入错误'.'|'.json_encode($receiveInputting));
                 return response()->json(['response'=>['return'=>['returnFlag'=>'0','returnCode'=>'0001','returnDesc'=>'运单WMS写入错误'.'|'
                     .json_encode($receiveInputting),'resultInfo'=>'']]])
@@ -48,7 +51,7 @@ class WaybillController extends Controller
                     if ($orderInputting['GrossWeight'])$warehouseWeight +=$orderInputting['GrossWeight'];
                     if (!$orderInputting['GrossWeight'] && $orderInputting['NetWeight']) $warehouseWeight +=$orderInputting['NetWeight'];
                     $orderInputting['OrderNo']=$receiveInputting['OrderNo'];
-                    if(!WMSWaybillOrder::create($orderInputting)){
+                    if(!WMSWaybillOrder::query()->create($orderInputting)){
                         Controller::logS(__METHOD__,'error_'.__FUNCTION__,'运单订单行WMS写入错误'.'|'.json_encode($orderInputting));
                         return response()->json(['response'=>['return'=>['returnFlag'=>'0','returnCode'=>'0001','returnDesc'=>'运单订单行WMS写入错误'.'|'
                             .json_encode($orderInputting),'resultInfo'=>'']]])
@@ -57,11 +60,10 @@ class WaybillController extends Controller
                 }
                 if ($sign)$warehouseVolume=0;
             }
-            $owner=Owner::where('code',$receiveInputting['CustomerID'])->first();
+            $owner=Owner::query()->where('code',$receiveInputting['CustomerID'])->first();
             if (!$owner){$owner=new Owner(['name'=>$receiveInputting['CustomerID'],'code'=>$receiveInputting['CustomerID']]);$owner->save();}
-            $city=City::where('name',$receiveInputting['C_City'])->first();
             $zfList=config('merchantsInfo.waybill.ZFList');
-            $bswasCustomer=OracleBasCustomer::where("customerid",$receiveInputting['CustomerID'])->first();
+            $bswasCustomer=OracleBasCustomer::query()->where("customerid",$receiveInputting['CustomerID'])->first();
             if ($bswasCustomer){
                 $origination=$bswasCustomer->address1;
                 $addresses=config("merchantsInfo.address");
@@ -80,20 +82,29 @@ class WaybillController extends Controller
                 'recipient'=>$receiveInputting['ConsigneeName']??'',
                 'recipient_mobile'=>$recipient_mobile??'',
                 'source_bill'=>$receiveInputting['ReservedField01']??'',
-                'destination_city_id'=>$city['id'],
+                'destination_city_id'=>app(RegionService::class)->getCity($receiveInputting['C_City']),
             ]);
             $dflist=config('merchantsInfo.waybill.DFList');
             if (isset($dflist[$receiveInputting['CarrierID']]) && $dflist[$receiveInputting['CarrierID']])$waybill->collect_fee=0;
             if (isset($warehouseVolume)&&$warehouseVolume){
                 $waybill->warehouse_weight=$warehouseVolume;
-                $unit=Unit::where('name','m³')->first();
+                $unit=Unit::query()->where('name','m³')->first();
                 if ($unit)$waybill->warehouse_weight_unit_id=$unit->id;
             }
             if (isset($warehouseWeight)){
                 $waybill->warehouse_weight_other=$warehouseWeight;
-                $unit=Unit::where('name','kg')->first();
+                $unit=Unit::query()->where('name','kg')->first();
                 if ($unit)$waybill->warehouse_weight_unit_id_other=$unit->id;
             }
+            if ($waybill->wms_bill_number){
+                $order = app("OrderService")->first(["code"=>$waybill->wms_bill_number]);
+                if ($order)$waybill->order_id = $order->id;
+            }
+            WaybillAuditLog::query()->create([
+                'waybill_id'=>$waybill->id,
+                'audit_stage'=>'创建',
+                'user_id'=>Auth::id() ?? 0,
+            ]);
             $waybill->save();
             if ($waybill->type=='直发车'){
                 $waybill_number='BSZF'.date ("ymd").str_pad($waybill->id>99999?$waybill->id%99999:$waybill->id,4,"0",STR_PAD_LEFT);

+ 2 - 1
app/Imports/AppointmentDetail.php

@@ -50,9 +50,10 @@ class AppointmentDetail implements ToCollection,WithMultipleSheets,WithHeadingRo
                 unset($collection[$key]);
                 $key = $key+2;
                 if (array_key_exists($key,$temp))$temp[$key] = array_merge($temp[$key],$arr);
+                else $temp[$key] = $arr;
             }
             $errors = $temp;
         }
-        dd(json_encode($collection,JSON_UNESCAPED_UNICODE));
+        $this->success(["data"=>$collection,"errors"=>$errors]);
     }
 }

+ 10 - 1
app/OwnerBillReport.php

@@ -13,11 +13,16 @@ class OwnerBillReport extends Model
    protected $fillable = [
        "owner_id",       //项目ID
        "counting_month", //结算月
-       "initial_fee",    //原始账单金额
+       "work_fee",       //操作费
+       "logistic_fee",   //物流费
+       "storage_fee",    //仓储费
        "confirm_fee",    //确认账单金额
        "difference",     //差额
        "confirmed",      //确认状态
    ];
+   protected $appends=[
+        "initial_fee"
+   ];
    public $timestamps=false;
 
    public function owner()
@@ -32,4 +37,8 @@ class OwnerBillReport extends Model
     {
         return substr($value,0,7);
     }
+    public function getInitialFeeAttribute()
+    {   //初始账单金额
+        return $this->work_fee + $this->logistic_fee + $this->storage_fee;
+    }
 }

+ 3 - 2
app/Services/OwnerAreaReportService.php

@@ -64,8 +64,9 @@ class OwnerAreaReportService
                     $diff = $area->accounting_area - $values["accounting_area"];
                     $diffAmount = app("OwnerStoragePriceModelService")->calculationAmount($area->ownerStoragePriceModel, $diff, $area->owner_id, $area->counting_month);
                     if ($diffAmount != 0){
-                        $up = ["initial_fee"=>$report->initial_fee - $diffAmount];
-                        if ($report->confirm_fee !== null)$up["difference"] = $up["initial_fee"] - $report->confirm_fee;
+                        $up = ["storage_fee"=>$report->storage_fee - $diffAmount];
+                        $report->initial_fee -= $report->storage_fee - $diffAmount;
+                        if ($report->confirm_fee !== null)$up["difference"] = $report->initial_fee - $report->confirm_fee;
                         $report->update($up);
                     }
                 }

+ 6 - 20
app/Services/WaybillService.php

@@ -5,6 +5,7 @@ namespace App\Services;
 use App\OwnerFeeDetail;
 use App\Services\common\QueryService;
 use App\Waybill;
+use App\WaybillAuditLog;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
@@ -100,26 +101,6 @@ class WaybillService
         return $waybills->get();
     }
 
-    public function getSql(array $param){
-        $waybills = $this->conditionQuery($param)->whereNull('waybills.deleted_at');
-        return $waybills->leftJoin('owners','owners.id','=','waybills.owner_id')->selectRaw('owners.name owner_name')
-            ->leftJoin('units as warehouse_weight_unit','warehouse_weight_unit.id','=','waybills.warehouse_weight_unit_id')
-                ->selectRaw('warehouse_weight_unit.name warehouse_weight_unit_name')
-            ->leftJoin('units as warehouse_weight_unit_other','warehouse_weight_unit_other.id','=','waybills.warehouse_weight_unit_id_other')
-                ->selectRaw('warehouse_weight_unit_other.name warehouse_weight_unit_other_name')
-            ->leftJoin('units as carrier_weight_unit','carrier_weight_unit.id','=','waybills.carrier_weight_unit_id')
-                ->selectRaw('carrier_weight_unit.name carrier_weight_unit_name')
-            ->leftJoin('units as carrier_weight_unit_other','carrier_weight_unit_other.id','=','waybills.carrier_weight_unit_id_other')
-                ->selectRaw('carrier_weight_unit_other.name carrier_weight_unit_other_name')
-            ->leftJoin('car_types','car_types.id','=','waybills.carType_id')
-                ->selectRaw('car_types.name car_type_name')
-            ->leftJoin('units as amount_unit','amount_unit.id','=','waybills.amount_unit_id')
-                ->selectRaw('amount_unit.name amount_unit_name')
-            ->leftJoin('logistics','logistics.id','=','waybills.logistic_id')
-                ->selectRaw('logistics.name carrier_name')
-            ->sql();
-    }
-
     public function store(Request $request){
         return DB::transaction(function ()use($request){
             $waybill=new Waybill();
@@ -134,6 +115,11 @@ class WaybillService
             else $waybill_number='BSZX';
             $waybill_number .= date ("ymd").str_pad($number_id>99999?$number_id%99999:$number_id,4,"0",STR_PAD_LEFT);
             $waybill->update(['waybill_number' => $waybill_number ]);
+            WaybillAuditLog::query()->create([
+                'waybill_id'=>$waybill->id,
+                'audit_stage'=>'创建',
+                'user_id'=>Auth::id() ?? 0,
+            ]);
             return $waybill;
         });
     }

+ 1 - 1
database/migrations/2020_11_03_095519_seed_menus_level_1.php

@@ -59,7 +59,7 @@ class SeedMenusLevel1 extends Migration
         \App\Menu::create([
             'name'=>'客户管理',
             'level'=>1,
-            'route'=>'customer/project/report',
+            'route'=>'customer/project/area',
             'sequence'=>8,
         ]);
         \App\Menu::create([

+ 1 - 1
database/migrations/2020_11_03_095724_seed_menus_level_2.php

@@ -243,7 +243,7 @@ class SeedMenusLevel2 extends Migration
             'name'=>'项目',
             'level'=>2,
             'parent_id'=>8,
-            'route'=>'customer/project/report',
+            'route'=>'customer/project/area',
             'sequence'=>1,
         ]);
         Menu::create([

+ 42 - 5
database/migrations/2021_03_03_175304_add_authority_to_customer_owner.php

@@ -4,10 +4,10 @@ use Illuminate\Database\Migrations\Migration;
 use Illuminate\Database\Schema\Blueprint;
 use Illuminate\Support\Facades\Schema;
 
-class AddAuthorityToCustomerOwner extends Migration
+class CreateDeliveryAppointmentsTable extends Migration
 {
-    public $addAuthorities = [
-        "客户管理-项目-停用",
+    public $authorities = [
+        "入库管理-盘收一体-客户预约",
     ];
     /**
      * Run the migrations.
@@ -16,7 +16,41 @@ class AddAuthorityToCustomerOwner extends Migration
      */
     public function up()
     {
-        foreach ($this->addAuthorities as $authority){
+        Schema::create('delivery_appointments', function (Blueprint $table) {
+            $table->id();
+            $table->bigInteger("user_id")->nullable()->comment("操作用户");
+            $table->bigInteger("owner_id")->index()->comment("外键货主");
+            $table->string("procurement_number")->nullable()->comment("采购单号");
+            $table->string("asn_number")->index()->nullable()->comment("ASN单号");
+            $table->bigInteger("warehouse_id")->index()->comment("外键仓库");
+            $table->decimal("tonne",8,2)->nullable()->comment("吨");
+            $table->decimal("cubic_meter",8,2)->nullable()->comment("立方米");
+            $table->integer("box_amount")->nullable()->comment("箱数");
+            $table->decimal("capacity",10,2)->default(0)->comment("产能");
+            $table->date("appointment_date")->index()->comment("预约时间");
+            $table->tinyInteger("date_period")->default(0)->comment("时间段");
+            $table->tinyInteger("status")->default(0)->comment("状态");
+            $table->timestamps();
+        });
+        Schema::create('delivery_appointment_cars', function (Blueprint $table) {
+            $table->id();
+            $table->bigInteger("delivery_appointment_id")->index()->comment("外键预约");
+            $table->string("license_plate_number")->nullable()->comment("车牌号");
+            $table->string("car_id")->index()->nullable()->comment("外键车型");
+            $table->string("driver_name",20)->nullable()->comment("驾驶员姓名");
+            $table->string("driver_phone",30)->nullable()->comment("驾驶员电话");
+            $table->string("appointment_number")->comment("预约号码");
+            $table->tinyInteger("status")->default(0)->comment("状态");
+        });
+        Schema::create('delivery_appointment_details', function (Blueprint $table) {
+            $table->id();
+            $table->bigInteger("delivery_appointment_id")->index()->comment("外键预约");
+            $table->bigInteger("commodity_id")->index()->nullable()->comment("外键商品");
+            $table->string("bar_code")->nullable()->comment("条码");
+            $table->string("name")->nullable()->comment("名称");
+            $table->integer("amount")->comment("数量");
+        });
+        foreach ($this->authorities as $authority){
             \App\Authority::query()->firstOrCreate([
                 "name"=>$authority
             ],[
@@ -33,7 +67,10 @@ class AddAuthorityToCustomerOwner extends Migration
      */
     public function down()
     {
-        foreach ($this->addAuthorities as $authority){
+        Schema::dropIfExists('delivery_appointments');
+        Schema::dropIfExists('delivery_appointment_cars');
+        Schema::dropIfExists('delivery_appointment_details');
+        foreach ($this->authorities as $authority){
             \App\Authority::query()->where("name",$authority)->delete();
         }
     }

+ 41 - 0
database/migrations/2021_03_04_141906_change_owner_bill_reports_add_column_bill.php

@@ -0,0 +1,41 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeOwnerBillReportsAddColumnBill extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table("owner_bill_reports",function (Blueprint $table){
+            $table->dropColumn("initial_fee");
+            $table->decimal("work_fee",11,3)->nullable()->comment("操作费");
+            $table->decimal("logistic_fee",11,3)->nullable()->comment("物流费");
+            $table->decimal("storage_fee",11,3)->nullable()->comment("仓储费");
+        });
+        DB::statement("ALTER TABLE owner_area_reports MODIFY COLUMN status enum ('编辑中','已审核','已完成') default '编辑中'");
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table("owner_bill_reports",function (Blueprint $table){
+            $table->dropColumn("work_fee");
+            $table->dropColumn("logistic_fee");
+            $table->dropColumn("storage_fee");
+            $table->decimal('initial_fee',11,3)->nullable()->comment('原始账单金额');
+        });
+        DB::statement("ALTER TABLE owner_area_reports MODIFY COLUMN status enum ('编辑中','已完成') default '编辑中'");
+    }
+}

+ 9 - 0
resources/js/queryForm/header.js

@@ -2,6 +2,8 @@
  * 需在页面定义三个元素 tr的元素当作当前元素 id 自定义 默认header
  * tr的父级元素 table id默认为tr的id加Parent后缀
  * 浮动表格元素 table id默认为tr的id加Roll后缀
+ *
+ * 21-03-04 zzd 注意:历史遗留问题在使用reset方法时column的key应为columns
  * */
 
 window.sort=require('../utilities/sort');
@@ -220,6 +222,13 @@ window.Header = function getHeader(object) {
         cloneDom();
     };
 
+    this.reset = function(params = null){
+        _parentNode.empty();
+        _parentNodeTemp.empty();
+        if (params)for (let key in params)this["_"+key] = params[key];
+        this.init();
+    };
+
     function checkAll(dom,column){
         dom.on('click',function () {
             if ($(this).is(":checked")== true) {

+ 6 - 0
resources/sass/color.scss

@@ -5,6 +5,9 @@
 .bg-khaki{
   background-color:#af7651;
 }
+.bg-purple{
+  background-color: #912CEE;
+}
 .bg-light-info{
   background-color:RGB(170,199,230);
 }
@@ -16,4 +19,7 @@
 }
 .bg-light-gray{
   background-color:RGB(236,236,236);
+}
+.bg-light-purple{
+  background-color: #AB82FF;
 }

+ 1 - 1
resources/views/customer/menu.blade.php

@@ -4,7 +4,7 @@
         <ul class="nav nav-pills">
             @can('客户管理-项目')
             <li class="nav-item">
-                <a target="customer/project/report" class="nav-link" href="{{url('customer/project/report')}}" :class="{active:isActive('project',2)}">项目</a>
+                <a target="customer/project/area" class="nav-link" href="{{url('customer/project/area')}}" :class="{active:isActive('project',2)}">项目</a>
             </li>@endcan
             @can('客户管理-客户')
             <li class="nav-item">

+ 2 - 6
resources/views/customer/project/menu.blade.php

@@ -4,17 +4,13 @@
     <div class="container-fluid nav3">
         <div class="card menu-third" >
             <ul class="nav nav-pills">
-                @can('客户管理-项目-报表')
-                <li class="nav-item">
-                    <a target="customer/project/report" class="nav-link" href="{{url('customer/project/report')}}" :class="{active:isActive('report',3)}">概览</a>
-                </li> @endcan
                 @can('客户管理-项目-面积')
                     <li class="nav-item">
-                        <a target="customer/project/area" class="nav-link" href="{{url('customer/project/area')}}" :class="{active:isActive('area',3)}">用仓报表</a>
+                        <a target="customer/project/area" class="nav-link" href="{{url('customer/project/area')}}" :class="{active:isActive('area',3)}">用仓盘点</a>
                     </li> @endcan
                 @can('客户管理-项目-查询')
                 <li class="nav-item">
-                    <a target="customer/project/index" class="nav-link" href="{{url('customer/project/index')}}" :class="{active:isActive('index',3)}">查询</a>
+                    <a target="customer/project/index" class="nav-link" href="{{url('customer/project/index')}}" :class="{active:isActive('index',3)}">列表</a>
                 </li> @endcan
                 @can('客户管理-项目-查询')
                 <li class="nav-item">

+ 2 - 2
resources/views/finance/billConfirmation.blade.php

@@ -139,8 +139,8 @@
                     {name:'ownerName',value: '子项目'},
                     {name:'countingMonth',value: '结算月'},
                     {name:'updatedAt',value: '录入日期'},
-                    {name:'initial_fee',value: '原始账单金额', neglect: true},
-                    {name:'confirm_fee',value: '确认账单金额', neglect: true},
+                    {name:'initialFee',value: '原始账单金额', neglect: true},
+                    {name:'confirmFee',value: '确认账单金额', neglect: true},
                     {name:'difference',value: '差额', neglect: true},
                     {name:'operating',value: '操作', neglect: true},
                 ];

+ 2 - 2
resources/views/layouts/menu.blade.php

@@ -38,12 +38,12 @@
                     <span class="fa fa-hand-scissors-o" style="color: #726e1b"></span>
                     二次加工管理</a></li> @endcan
         @can('客户管理')
-            <li class="nav-item"><a href="{{url("customer/project/report")}}" class="nav-link" target="customer/project/report"
+            <li class="nav-item"><a href="{{url("customer/project/area")}}" class="nav-link" target="customer/project/area"
                                     :class="{active:isActive('customer',1)}">
                     <span class="fa fa-address-book-o" style="color: #72441b"></span>
                     客户管理</a></li> @endcan
         @can('结算管理')
-            <li class="nav-item"><a href="{{url("finance/instantBill")}}" class="nav-link" target="customer/project/report"
+            <li class="nav-item"><a href="{{url("finance/instantBill")}}" class="nav-link" target="finance/instantBill"
                                     :class="{active:isActive('finance',1)}">
                     <span class="fa fa-money" style="color: #72441b"></span>
                     结算管理</a></li> @endcan

+ 4 - 0
resources/views/personnel/menu.blade.php

@@ -10,6 +10,10 @@
                 <li class="nav-item">
                     <a target="personnel/checking-in/createReplenishClock" class="nav-link" href="{{url('personnel/checking-in/createReplenishClock')}}" :class="{active:isActive('checking-in',2)}">打卡相关</a>
                 </li> @endcan
+            @can('客户管理-项目-报表')
+                <li class="nav-item">
+                    <a target="personnel/report" class="nav-link" href="{{url('personnel/report')}}" :class="{active:isActive('report',2)}">绩效</a>
+                </li> @endcan
 {{--            @can('人事管理-相关设置')--}}
             <li class="nav-item">
                 <a target="personnel/relating" class="nav-link text-dark" href="{{url('personnel/relating')}}" :class="{active:isActive('relating',2)}">相关设置</a>

+ 102 - 32
resources/views/customer/project/report.blade.php → resources/views/personnel/report.blade.php

@@ -1,11 +1,25 @@
 @extends('layouts.app')
 @section('title')
-    项目报表-客户管理
+    绩效-人事管理
 @endsection
 @section('content')
-    @component('customer.project.menu')@endcomponent
+    @component('personnel.menu')@endcomponent
     <div class="container-fluid card d-none" id="container">
-
+        <div class="container-fluid nav3">
+            <div class="card menu-third" >
+                <ul class="nav nav-pills">
+                    <li class="nav-item">
+                        <a class="nav-link" style="cursor: pointer;" :class="type==0 ? 'active' : ''" @click="switchType(0)">项目部</a>
+                    </li>
+                    <li class="nav-item">
+                        <a class="nav-link" style="cursor: pointer;" :class="type==1 ? 'active' : ''" @click="switchType(1)">销售部</a>
+                    </li>
+                    <li class="nav-item">
+                        <a class="nav-link" style="cursor: pointer;" :class="type==2 ? 'active' : ''" @click="switchType(2)">仓库部</a>
+                    </li>
+                </ul>
+            </div>
+        </div>
         @include("customer._selectedOwner")
 
         <div id="form_div"></div>
@@ -27,10 +41,11 @@
             <table class="d-none" id="headerRoll"></table>
             <table class="table table-sm table-striped table-hover" id="headerParent">
                 <tr class="text-center">
-                    <td></td>
-                    <td colspan="7" class="bg-light-khaki">客户信息</td>
-                    <td colspan="4" class="bg-light-info">盘点信息</td>
-                    <td colspan="3" class="bg-light-cyanogen">账单信息</td>
+                    <td colspan="2"></td>
+                    <td colspan="2" class="bg-light-purple">日期信息</td>
+                    <td :colspan="type==0 ? '8' : (type==1 ? '7' : '8')" class="bg-light-khaki">项目信息</td>
+                    <td :colspan="type==0 ? '3' : (type==1 ? '3' : '3')" class="bg-light-info">盘点信息</td>
+                    <td :colspan="type==0 ? '4' : (type==1 ? '2' : '3')" class="bg-light-cyanogen">账单信息</td>
                 </tr>
                 <tr class="text-nowrap" id="header"></tr>
                 <tr v-for="(report,i) in reports">
@@ -38,6 +53,8 @@
                         <label><input type="checkbox" :value="report.id" v-model="checkData"></label>
                     </td>
                     <td>@{{ i+1 }}</td>
+                    <td></td>
+                    <td></td>
                     <td>@{{ report.ownerGroupName }}</td>
                     <td>@{{ report.customerName }}</td>
                     <td>@{{ report.ownerName }}</td>
@@ -73,6 +90,10 @@
                         ownerGroupName : "{{$report->owner ? ($report->owner->userOwnerGroup ? $report->owner->userOwnerGroup->name : '') : ''}}",
                         customerName : "{{$report->owner ? ($report->owner->customer ? $report->owner->customer->name : '') : ''}}",
                         ownerName : "{{$report->owner ? $report->owner->name : ''}}",
+                        warehouseName : "{{$report->owner->warehouse->name ?? ''}}",
+                        userWorkGroupName : "{{$report->userWorkGroup->name ?? ''}}",
+                        ownerGroupUserList:[],
+                        userWorkGroupUserList:[],
                         ownerStatus : "{{$report->owner ? ($report->owner->deleted_at ? "冻结" : "激活") : ''}}",
                         ownerStorageDuration : "{{$report->owner ? ($report->owner->created_at ? ((new DateTime())->diff(new DateTime($report->owner->created_at))->days)  : '') : ''}}",
                         ownerCreatedAt : "{{$report->owner ? $report->owner->created_at : ''}}",
@@ -82,6 +103,8 @@
                         currentMonthCountingArea : "{{$report->current_month_counting_area}}",
                         ownerBillReportInitialFee : "{{$report->ownerBillReport ? $report->ownerBillReport->initial_fee : ''}}",
                         ownerBillReportConfirmFee : "{{$report->ownerBillReport ? $report->ownerBillReport->confirm_fee : ''}}",
+                        ownerBillReportWorkFee : "{{$report->ownerBillReport->work_fee ?? ''}}",
+                        ownerAreaReportAccountingArea : "{{$report->owner->ownerAreaReport->accounting_area ?? ''}}",
                         ownerBillReportConfirmUpdatedAt : "{{$report->ownerBillReport ? $report->ownerBillReport->updated_at : ''}}",
                     },
                     @endforeach
@@ -109,6 +132,8 @@
                 checkData : [],
                 sum : Number("{{ $reports->total() }}"),
                 errors:[],
+                type:0,
+                header:"",
             },
             mounted(){
                 $('#container').removeClass('d-none');
@@ -129,36 +154,17 @@
                     condition:data,
                 });
                 this.form.init();
-                let column = [
-                    {name:'cloneCheckAll',customization:true,type:'checkAll',column:'id',
-                        dom:$('#cloneCheckAll').removeClass('d-none'), neglect: true},
-                    {name:'index',value: '序号', neglect: true ,class:"bg-khaki"},
-                    {name:'ownerGroupName',value: '项目小组',class:"bg-khaki"},
-                    {name:'customerName',value: '客户',class:"bg-khaki"},
-                    {name:'ownerName',value: '子项目',class:"bg-khaki"},
-                    {name:'ownerStatus',value: '状态',class:"bg-khaki"},
-                    {name:'ownerCreatedAt',value: '创建日期',class:"bg-khaki"},
-                    {name:'ownerStorageDuration',value: '在库时长',class:"bg-khaki"},
-                    {name:'countingMonth',value: '结算月', class:"bg-info"},
-                    {name:'dailyAverageOrderAmount',value: '日均单量', neglect: true, class:"bg-info"},
-                    {name:'lastMonthCountingArea',value: '结算月上月盘点面积', neglect: true, class:"bg-info"},
-                    {name:'currentMonthCountingArea',value: '结算月盘点面积', neglect: true, class:"bg-info"},
-                    {name:'ownerBillReportInitialFee',value: '初始账单金额', neglect: true, class:"bg-cyanogen"},
-                    {name:'ownerBillReportConfirmFee',value: '确认账单金额', neglect: true, class:"bg-cyanogen"},
-                    {name:'ownerBillReportConfirmUpdatedAt',value: '确认日期', class:"bg-cyanogen"},
-                ];
-                let _this=this;
-                setTimeout(function () {
-                    let header = new Header({
+                setTimeout(()=>{
+                    this.header = new Header({
                         el: "#header",
-                        column: column,
-                        data: _this.reports,
+                        column: this._getRenderingHeader(),
+                        data: this.reports,
                         restorationColumn: 'id',
                         fixedTop:($('#form_div').height())+2,
                         offset:0.5,
                         vue:vue
                     });
-                    header.init();
+                    this.header.init();
                 },0);
             },
             watch:{
@@ -176,8 +182,66 @@
                 }
             },
             methods : {
+                _getRenderingHeader()
+                {
+                    let column = [
+                        {name:'cloneCheckAll',customization:true,type:'checkAll',column:'id',
+                            dom:$('#cloneCheckAll').removeClass('d-none'), neglect: true},
+                        {name:'index',value: '序号', neglect: true},
+                        {name:'countingMonth',value: '结算月' ,class:"bg-purple"},
+                        {name:'ownerStorageDuration',value: '入仓时长' ,class:"bg-purple"},
+                    ];
+                    switch (this.type) {
+                        case 0:
+                            column.push({name:'ownerGroupName',value: '项目小组',class:"bg-khaki"});
+                            column.push({name:'ownerGroupUserList', neglect: true,value: '成员',class:"bg-khaki"});
+                            column.push({name:'ownerName',value: '项目',class:"bg-khaki"});
+                            column.push({name:'warehouseName',value: '所在仓库',class:"bg-khaki"});
+                            column.push({name:'userWorkGroupName',value: '仓库小组',class:"bg-khaki"});
+                            column.push({name:'sell',value: '销售', neglect: true,class:"bg-khaki"});
+                            break;
+                        case 1:
+                            column.push({name:'sell',value: '销售', neglect: true,class:"bg-khaki"});
+                            column.push({name:'ownerName',value: '项目',class:"bg-khaki"});
+                            column.push({name:'warehouseName',value: '所在仓库',class:"bg-khaki"});
+                            column.push({name:'userWorkGroupName',value: '仓库小组',class:"bg-khaki"});
+                            column.push({name:'ownerGroupName',value: '项目小组',class:"bg-khaki"});
+                            break;
+                        case 2:
+                            column.push({name:'userWorkGroupName',value: '仓库小组',class:"bg-khaki"});
+                            column.push({name:'userWorkGroupUserList', neglect: true,value: '成员',class:"bg-khaki"});
+                            column.push({name:'ownerName',value: '项目',class:"bg-khaki"});
+                            column.push({name:'warehouseName',value: '所在仓库',class:"bg-khaki"});
+                            column.push({name:'principal', neglect: true,value: '项目负责人',class:"bg-khaki"});
+                            column.push({name:'sell',value: '销售', neglect: true,class:"bg-khaki"});
+                            break;
+                    }
+                    column.push({name:'ownerStatus',value: '状态',class:"bg-khaki"});
+                    column.push({name:'ownerCreatedAt',value: '创建日期',class:"bg-khaki"});
+                    column.push({name:'dailyAverageOrderAmount',value: '日均单量', neglect: true, class:"bg-info"});
+                    column.push({name:'lastMonthCountingArea',value: '上月盘点面积', neglect: true, class:"bg-info"});
+                    column.push({name:'currentMonthCountingArea',value: '本月盘点面积', neglect: true, class:"bg-info"});
+                    switch (this.type) {
+                        case 0:
+                            column.push({name:'ownerBillReportInitialFee',value: '初始账单金额', neglect: true, class:"bg-cyanogen"});
+                            column.push({name:'ownerBillReportConfirmFee',value: '确认账单金额', neglect: true, class:"bg-cyanogen"});
+                            column.push({name:'ownerBillReportConfirmUpdatedAt',value: '确认日期', class:"bg-cyanogen"});
+                            column.push({name:'timeOut',value: '超时', neglect: true,class:"bg-cyanogen"});
+                            break;
+                        case 1:
+                            column.push({name:'ownerBillReportConfirmFee',value: '确认账单金额', neglect: true, class:"bg-cyanogen"});
+                            column.push({name:'ownerBillReportConfirmUpdatedAt',value: '确认日期', class:"bg-cyanogen"});
+                            break;
+                        case 2:
+                            column.push({name:'ownerBillReportWorkFee',value: '操作费账单金额', neglect: true, class:"bg-cyanogen"});
+                            column.push({name:'ownerAreaReportAccountingArea',value: '结算面积', neglect: true, class:"bg-cyanogen"});
+                            column.push({name:'ownerBillReportConfirmUpdatedAt',value: '确认日期', class:"bg-cyanogen"});
+                            break;
+                    }
+                    return column;
+                },
                 reportExport(isAll){
-                    let url = '{{url('customer/project/report/export')}}';
+                    let url = '{{url('personnel/report/export')}}';
                     let token='{{ csrf_token() }}';
                     //excelExport 定义在 js/queryForm/export.js
                     excelExport(isAll,this.checkData,url,this.sum,token);
@@ -217,6 +281,12 @@
                         return "已生成报表";
                     },true)
                 },
+                switchType(type){
+                    this.type = type;
+                    let obj = {columns:this._getRenderingHeader()};
+                    if (type === 1)obj.offset = 7;
+                    this.header.reset(obj);
+                }
             }
         });
     </script>

+ 12 - 0
resources/views/store/checkingReceive/_selectDate.blade.php

@@ -0,0 +1,12 @@
+<div class="modal fade" tabindex="-1" role="dialog" id="selectDate">
+    <div class="modal-dialog modal-lg modal-dialog-centered">
+        <div class="modal-content">
+            <div class="modal-body">
+
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-success pull-right" @click="createReport()">生成</button>
+            </div>
+        </div>
+    </div>
+</div>

+ 119 - 31
resources/views/store/checkingReceive/appointment.blade.php

@@ -1,5 +1,5 @@
 @extends('layouts.app')
-@section('title')任务-盘收一体@endsection
+@section('title')客户预约-盘收一体@endsection
 
 @section('content')
     <span id="nav2">
@@ -18,7 +18,7 @@
                                 <label class="col-2">司机姓名</label>
                                 <label class="col-3">司机电话</label>
                                 <label class="col-1">
-                                    <span class="fa fa-plus cursor-pointer text-primary">增加</span>
+                                    <span class="fa fa-plus cursor-pointer text-primary" @click="addCar()">增加</span>
                                 </label>
                             </div>
                         </div>
@@ -26,59 +26,86 @@
                             <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.number">
+                                    <input type="text" class="form-control" v-model="car.license_plate_number" :class="errors[i+'.license_plate_number'] ? 'is-invalid' : ''">
                                 </label>
                                 <label class="col-2">
-                                    <input type="text" class="form-control" v-model="car.id">
+                                    <div class="dropdown">
+                                        <input type="text" class="form-control" v-model="car.car_id" :id="'car-'+i" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+                                        <div class="dropdown-menu" :aria-labelledby="'car-'+i">
+
+                                        </div>
+                                    </div>
                                 </label>
                                 <label class="col-2">
-                                    <input type="text" class="form-control" v-model="car.name">
+                                    <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.phone">
+                                    <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">&times;</span>
+                                    <span class="h4 font-weight-bold cursor-pointer text-danger" @click="delCar(i)">&times;</span>
+                                </label>
+                                <label v-if="errors[i+'.license_plate_number']" class="col-2 offset-2 text-danger font-weight-bold small">
+                                    @{{ errors[i+'.license_plate_number'][0] }}
                                 </label>
                             </div>
                         </div>
                     </div>
                     <div class="row mt-4 ml-1">
                         <label class="col-2" for="ownerId">货主</label>
-                        <select id="ownerId" v-model="model.owner_id" class="col-6 form-control">
+                        <select id="ownerId" v-model="model.owner_id" class="col-4 form-control" :class="errors.owner_id ? 'is-invalid' : ''">
                             <option v-for="owner in owners" :value="owner.id">@{{ owner.name }}</option>
                         </select>
+                        <label class="col-2"><input class="form-control rounded-pill" placeholder="搜索货主" @input="seekOwner($event)"></label>
                     </div>
+                    <label class="row mt-0 mb-0 ml-1" v-if="errors.owner_id">
+                        <label class="offset-2 text-danger font-weight-bold small">@{{ errors.owner_id[0] }}</label>
+                    </label>
                     <div class="row mt-4 ml-1">
                         <label class="col-2" for="procurementNumber">采购单号</label>
-                        <input class="col-6 form-control" type="text" id="procurementNumber" v-model="model.procurement_number">
+                        <input class="col-6 form-control" type="text" id="procurementNumber" v-model="model.procurement_number" :class="errors.procurement_number ? 'is-invalid' : ''">
                     </div>
                     <div class="row mt-2 ml-1">
                         <label class="col-2" for="asnNumber">ASN单号</label>
-                        <input class="col-6 form-control" type="text" id="asnNumber" v-model="model.asn_number">
+                        <input class="col-6 form-control" type="text" id="asnNumber" v-model="model.asn_number" :class="errors.asn_number ? 'is-invalid' : ''">
                     </div>
                     <div class="row mt-2 ml-1">
                         <label class="col-2" for="warehouse">仓库</label>
-                        <input class="col-6 form-control" type="text" id="warehouse" v-model="model.warehouse_id">
+                        <input class="col-6 form-control" type="text" id="warehouse" v-model="model.warehouse_id" :class="errors.warehouse_id ? 'is-invalid' : ''">
                     </div>
+                    <label class="row mt-0 mb-0 ml-1" v-if="errors.warehouse_id">
+                        <label class="offset-2 text-danger font-weight-bold small">@{{ errors.warehouse_id[0] }}</label>
+                    </label>
                     <div class="row mt-2 ml-1">
                         <label class="col-2" for="tonne">吨</label>
-                        <input class="col-3 form-control" type="text" id="tonne" v-model="model.tonne">
-                        <label class="col-1 offset-2" for="cube">立方</label>
-                        <input class="col-3 form-control" type="text" id="cube" v-model="model.cube">
+                        <input class="col-3 form-control" type="number" step="0.01" min="0" id="tonne" v-model="model.tonne" :class="errors.tonne ? 'is-invalid' : ''">
+                        <label class="col-1 offset-2" for="cubic_meter">立方</label>
+                        <input class="col-3 form-control" type="number" step="0.01" min="0" id="cubic_meter" v-model="model.cubic_meter" :class="errors.cubic_meter ? 'is-invalid' : ''">
+                    </div>
+                    <label class="row mt-0 mb-0 ml-1" v-if="errors.tonne || errors.cubic_meter">
+                        <label class="offset-2 text-danger col-3 small"><b v-if="errors.tonne">@{{ errors.tonne[0] }}</b></label>
+                        <label class="offset-3 text-danger font-weight-bold small" v-if="errors.cubic_meter">@{{ errors.cubic_meter[0] }}</label>
+                    </label>
+                    <div class="row mt-2 ml-1">
+                        <label class="col-2" for="box_amount">箱数</label>
+                        <input class="col-3 form-control" step="1" min="0" type="number" id="box_amount" v-model="model.box_amount" :class="errors.box_amount ? 'is-invalid' : ''">
                     </div>
+                    <label class="row mt-0 mb-0 ml-1" v-if="errors.box_amount">
+                        <label class="offset-2 text-danger font-weight-bold small">@{{ errors.box_amount[0] }}</label>
+                    </label>
                     <div class="row mt-2 ml-1">
                         <label class="col-2" for="isUpload">是否上传明细单</label>
                         <input content="col-3" id="isUpload" type="checkbox" class="switch" v-model="model.is_upload">
-                        <button data-toggle="tooltip" id="openFile" type="button" class="col-2 offset-1 btn btn-info text-white"
+                        <button id="openFile" type="button" class="col-2 offset-1 btn btn-info text-white"
                                 title="表头必须包含:商品名称 数量 条码"
+                                :data-toggle="errors.details ? 'popover' : 'tooltip'"
                                 v-show="model.is_upload" @click="openFile()">
                             <span class="fa fa-cloud-upload"></span> 选择文件</button>
                         <span v-if="model.is_upload" class="text-secondary mt-1">&nbsp;@{{ fileName }}</span>
                         <label hidden><input type="file" id="file" accept=".csv, .xlsx, .xls" @change="selectedFile($event)"></label>
                     </div>
                     <div class="row mt-4 ml-1">
-                        <button type="button" class="btn btn-success col-8 offset-2">提 交 预 约</button>
+                        <button type="button" class="btn btn-success col-8 offset-2" @click="submit()">提 交 预 约</button>
                     </div>
                 </div>
             </div>
@@ -93,42 +120,103 @@
             data:{
                 cars:[],
                 model:{
-                    cars:[{number:"",id:"",name:"",phone:""}],
+                    cars:[{license_plate_number:"",car_id:"",driver_name:"",driver_phone:""}],
                 },
                 owners:@json($owners),
-                fileName:""
+                fileName:"",
+                details:[],
+                errors : {
+                    details:"",
+                },
+                datePeriod : {
+                    0:"9-11",1:"13-17",
+                },
             },
             mounted(){
-                if (this.owners.length === 1)this.model.owner_id = this.owners[0].id;
+                if (this.owners.length === 1)this.$set(this.model,"owner_id",this.owners[0].id);
                 $('#openFile').tooltip();
             },
             methods:{
+                seekOwner(e){
+                    let val = e.target.value;
+                    this.owners.some(owner=>{
+                        if (owner.name.indexOf(val)!==-1){
+                            this.$set(this.model,"owner_id",owner.id);
+                            return true;
+                        }
+                    })
+                },
                 openFile(){
-                    if (!this.model.owner_id){
-                        window.tempTip.setDuration(2000);
-                        window.tempTip.show("必须先选定货主");
-                    }else $('#file').click();
+                    $('#file').click();
                 },
                 selectedFile(e){
+                    window.tempTip.setDuration(3000);
                     let file=e.target.files[0];
+                    if (!file)return;
                     this.fileName = file.name;
-                    if (!file){
-                        window.tempTip.setDuration(3000);
-                        window.tempTip.show("未选择文件");
-                        return;
-                    }
                     let formData = new FormData();
                     formData.append("file",file);
                     window.axios.post('{{url('store/checkingReceive/appointment/import')}}',formData,{
                         'Content-Type':'multipart/form-data'
                     }).then(res=>{
-                        window.tempTip.setDuration(3000);
-                        window.tempTip.show(res.data.data);
+                        if (!res.data.success){
+                            window.tempTip.setDuration(3000);
+                            window.tempTip.show(res.data.data);
+                        }else{
+                            let arr = res.data.data;
+                            let details = [];
+                            for(let key  in arr.data){
+                                let data=arr.data[key];
+                                details.push({name:data["商品名称"],amount:data["数量"],bar_code:data["条码"]});
+                            }
+                            this.details = details;
+                            if (Object.keys(arr.errors).length>0){
+                                let err = "<span class='text-danger'>";
+                                for(let key  in arr.errors){
+                                    let errors=arr.errors[key];
+                                    err += "<b class='text-dark'>第"+key+"行</b>"+"<br>";
+                                    errors.forEach(error=>{
+                                        err += "&nbsp;&nbsp;&nbsp;&nbsp;"+error+"<br>";
+                                    });
+                                }
+                                err += "</span>";
+                                this.errors.details = err;
+                                $('#openFile').tooltip('dispose').attr("title","明细错误信息").popover({
+                                    html: true,
+                                    content: err,
+                                    placement:'right',
+                                    trigger:'focus'
+                                }).popover('show');
+                            }else $('#openFile').popover('dispose').tooltip('show');
+                        }
                     }).catch(err=> {
-                        window.tempTip.setDuration(3000);
                         window.tempTip.show("网络错误:"+err);
                     })
                 },
+                addCar(){
+                    this.model.cars.push({});
+                },
+                delCar(index){
+                    this.$delete(this.model.cars,index);
+                },
+                submit(){
+                    let errors = {};
+                    if (!this.model.owner_id)errors.owner_id = ["不得为空"];
+                    if (!this.model.warehouse_id)errors.warehouse_id = ["不得为空"];
+                    if (!this.model.tonne && !this.model.cubic_meter){
+                        errors.tonne = ["吨与立方值至少填写一个"];
+                        errors.cubic_meter = ["立方值与吨至少填写一个"];
+                    }
+                    this.model.cars.forEach((car,i)=>{
+                        if (!car.license_plate_number) errors[i+".license_plate_number"] = ["不得为空"];
+                    });
+                    if (JSON.stringify(errors) !== "{}"){
+                        errors.details=this.errors.details;
+                        this.errors = errors;
+                        return
+                    }
+                    window.tempTip.postBasicRequest();
+                },
             },
         });
     </script>

+ 14 - 14
resources/views/waybill/create.blade.php

@@ -30,18 +30,6 @@
                             <li class="nav-item"><a class="nav-link @if($type!='专线') active @endif" href="{{url('waybill/create?type=ZF')}}">直发车</a></li>
                         </ul>
                     </div>
-                    <div class="form-group row">
-                        <label for="owner_id" class="col-2 col-form-label text-right text-primary">货主 *</label>
-                        <div class="col-8 form-inline">
-                            <select id="owner_id" :disabled="!!model.order_id" :name="model.order_id ? '' : 'owner_id'" class="form-control @error('owner_id') is-invalid @enderror" v-model="model.owner_id"  style="width: 30%" required>
-                                <option v-for="owner in owners" :value="owner.id">@{{owner.name}}</option>
-                            </select>
-                            <label v-if="!model.order_id"><input class="form-control-sm ml-2" placeholder="输入关键字定位" @input="owner_seek"></label>
-                        </div>
-                        <div class="col-sm-5">
-                            <p class="form-control-static text-danger small font-weight-bold" style="margin-left: 50%">{{ $errors->first('owner_id') }}</p>
-                        </div>
-                    </div>
                     <div class="form-group row">
                         <label for="wms_bill_number" class="col-2 col-form-label text-right text-muted">WMS单号</label>
                         <div class="col-8">
@@ -54,6 +42,18 @@
                             @enderror
                         </div>
                     </div>
+                    <div class="form-group row">
+                        <label for="owner_id" class="col-2 col-form-label text-right text-primary">货主 *</label>
+                        <div class="col-8 form-inline">
+                            <select id="owner_id" :disabled="!!model.order_id" :name="model.order_id ? '' : 'owner_id'" class="form-control @error('owner_id') is-invalid @enderror" v-model="model.owner_id"  style="width: 30%" required>
+                                <option v-for="owner in owners" :value="owner.id">@{{owner.name}}</option>
+                            </select>
+                            <label v-if="!model.order_id"><input class="form-control form-control-sm ml-2 rounded-pill" placeholder="输入关键字定位" @input="seekOwner($event)"></label>
+                        </div>
+                        <div class="col-sm-5">
+                            <p class="form-control-static text-danger small font-weight-bold" style="margin-left: 50%">{{ $errors->first('owner_id') }}</p>
+                        </div>
+                    </div>
                     <label hidden><input :value="model.order_id" name="order_id"></label>
                     <div class="col-8" style="margin-left: 15%">
                         <button type="button" class="btn btn-outline-primary btn-sm" @click="origination='松江区泗砖仓'" style="transform: scale(0.9)">松江泗砖仓</button>
@@ -209,8 +209,8 @@
                 if (this.model.order_id)this._codeGetOrder("{{ old('wms_bill_number') }}");
             },
             methods:{
-                owner_seek:function (e) {
-                    if (model.order_id)return;
+                seekOwner(e) {
+                    if (this.model.order_id)return;
                     let val=e.target.value;
                     if(!val)this.model.owner_id='';
                     else{

+ 28 - 8
resources/views/waybill/index.blade.php

@@ -105,6 +105,25 @@
                         >置顶备注:@{{  waybill.remark }}</div>
                         @{{ i+1 }}</td>
                     <td class="td-warm text-muted">@{{waybill.created_at}}</td>
+                    <td class="td-warm text-muted">
+                        <a href="#" v-if="waybill.waybillAuditLogs.length>0" class="dropdown-toggle"  data-toggle="dropdown">
+                            @{{ waybill.waybillAuditLogs[0].user ? waybill.waybillAuditLogs[0].user.name : '系统' }}<b class="caret"></b>
+                        </a>
+                        <div style="position: absolute;width:320px;margin-left:-100px;background-color: white;max-height:150px ;overflow-y:auto" class="small mt-0 dropdown-menu">
+                            <table class="table table-sm table-striped table-bordered">
+                                <tr>
+                                    <th>经手人</th>
+                                    <th>操作</th>
+                                    <th>时间</th>
+                                </tr>
+                                <tr v-for="people in waybill.waybillAuditLogs">
+                                    <td>@{{ people.user ? people.user.name : '系统' }}</td>
+                                    <td class="text-danger font-weight-bold">@{{ people.audit_stage }}</td>
+                                    <td>@{{ people.created_at }}</td>
+                                </tr>
+                            </table>
+                        </div>
+                    </td>
                     <td class="td-warm">@{{waybill.type}} <span class="badge badge-sm bg-warning" v-if="waybill.collect_fee">到付</span></td>
                     <td class="td-warm">@{{waybill.owner}}</td>
                     <td class="td-warm toptd" :title="waybill.remark? '置顶备注:'+waybill.remark :''">@{{waybill.source_bill}}</td>
@@ -294,26 +313,26 @@
                         type:'{{$waybill->type}}',
                         waybill_number:'{{$waybill->waybill_number}}',
                         owner:'{{$waybill->owner_name ?? ($waybill->owner->name ?? '')}}',
-                        source_bill:'{{$waybill->source_bill}}',
+                        source_bill:'{{$waybill->order->client_code ?? $waybill->source_bill}}',
                         wms_bill_number:'{{$waybill->wms_bill_number}}',
                         is_cancel:'{{$waybill->order->wms_status ?? ''}}' === '订单取消',
                         origination:'{{$waybill->origination}}',
                         destination:'{{$waybill->order_address ?? $waybill->destination}}',
-                        recipient:'{{$waybill->order_consignee_name ?? $waybill->recipient}}',
+                        recipient:'{{$waybill->order->consignee_name ?? $waybill->recipient}}',
                         recipient_mobile:'{{$waybill->order_consignee_phone ?? $waybill->recipient_mobile}}',
                         charge:'{{$waybill->charge}}',
                         ordering_remark:'{{preg_replace("/[\n\s]/",' ',($waybill->ordering_remark??""))}}',
                         carrier:'{{$waybill->logistic->name ?? ''}}',
                         carrier_bill:'{{$waybill->carrier_bill}}',
                         warehouse_weight:'{{$waybill->warehouse_weight}}',
-                        warehouse_weight_unit:'{{$waybill->warehouse_weight_unit ? $waybill->warehouse_weight_unit->name : ''}}',
+                        warehouse_weight_unit:'{{$waybill->warehouseWeightUnit->name ?? ''}}',
                         carrier_weight:'{{$waybill->carrier_weight}}',
-                        carrier_weight_unit:'{{$waybill->carrier_weight_unit ? $waybill->carrier_weight_unit->name : ''}}',
+                        carrier_weight_unit:'{{$waybill->carrierWeightUnit->name ?? ''}}',
                         warehouse_weight_other:'{{$waybill->warehouse_weight_other}}',
-                        warehouse_weight_unit_other:'{{$waybill->warehouse_weight_unit_other ? $waybill->warehouse_weight_unit_other->name : ''}}',
+                        warehouse_weight_unit_other:'{{$waybill->warehouseWeightUnitOther->name ?? ''}}',
                         carrier_weight_other:'{{$waybill->carrier_weight_other}}',
-                        carrier_weight_unit_other:'{{$waybill->carrier_weight_unit_other ? $waybill->carrier_weight_unit_other->name : ''}}',
-                        amount_unit_name:'{{$waybill->amount_unit ? $waybill->amount_unit->name : ''}}',
+                        carrier_weight_unit_other:'{{$waybill->carrierWeightUnitOther->name ?? ''}}',
+                        amount_unit_name:'{{$waybill->amountUnit->name ?? ''}}',
                         other_charge:'{{$waybill->other_charge}}',
                         other_charge_remark:'{{$waybill->other_charge_remark}}',
                         mileage:'{{$waybill->mileage}}',
@@ -428,7 +447,8 @@
                     {name:'onTop',value: '置顶', neglect: true, class:"td-operation"},
                     {name:'status',value: '状态', class:"td-operation"},
                     {name:'index',value: '序号', neglect: true, class:"td-warm"},
-                    {name:'created_at',value: '创建时间', class:"td-warm"},
+                    {name:'created_at', neglect: true,value: '创建时间', class:"td-warm"},
+                    {name:'operating',value: '操作记录', class:"td-warm"},
                     {name:'type',value: '运单类型', class:"td-warm"},
                     {name:'owner',value: '货主', class:"td-warm"},
                     {name:'source_bill',value: '上游单号', class:"td-warm"},

+ 11 - 11
resources/views/waybill/waybillEdit.blade.php

@@ -21,6 +21,17 @@
                         </div>
                     </div>
                     <label hidden><input type="text" name="type" :value="model.type"></label>
+                    <div class="form-group row">
+                        <label for="wms_bill_number" class="col-2 col-form-label text-right text-muted">WMS单号</label>
+                        <div class="col-8">
+                            <input id="wms_bill_number" type="text" class="form-control @error('wms_bill_number') is-invalid @enderror"
+                                   name="wms_bill_number" autocomplete="off" value="@if(old('wms_bill_number')){{ old('wms_bill_number') }}@else{{$waybill->wms_bill_number}}@endif"
+                                   @change="bindOrder($event)">
+                            @error('wms_bill_number')
+                            <span class="invalid-feedback" role="alert"><strong>{{ $message }}</strong></span>
+                            @enderror
+                        </div>
+                    </div>
                     <div class="form-group row">
                         <label for="owner_id" class="col-2 col-form-label text-right text-primary">货主 *</label>
                         <div class="col-8">
@@ -36,17 +47,6 @@
                             </select>
                         </div>
                     </div>
-                    <div class="form-group row">
-                        <label for="wms_bill_number" class="col-2 col-form-label text-right text-muted">WMS单号</label>
-                        <div class="col-8">
-                            <input id="wms_bill_number" type="text" class="form-control @error('wms_bill_number') is-invalid @enderror"
-                                name="wms_bill_number" autocomplete="off" value="@if(old('wms_bill_number')){{ old('wms_bill_number') }}@else{{$waybill->wms_bill_number}}@endif"
-                                @change="bindOrder($event)">
-                            @error('wms_bill_number')
-                            <span class="invalid-feedback" role="alert"><strong>{{ $message }}</strong></span>
-                            @enderror
-                        </div>
-                    </div>
                     <label hidden><input :value="model.order_id" name="order_id"></label>
                     <div class="form-group row">
                         <label for="origination" class="col-2 col-form-label text-right text-primary">始发地 *</label>

+ 5 - 4
routes/web.php

@@ -456,6 +456,11 @@ Route::resource('process','ProcessController');
 
 /** 人事 */
 Route::group(['prefix'=>'personnel'],function(){
+    /** 绩效 */
+    Route::group(['prefix'=>'report'],function(){
+        Route::match(['GET','POST'],'export','CustomerController@projectReportExport');
+    });
+    Route::get('report','CustomerController@projectReport');
     /** 打卡 */
     Route::group(['prefix'=>'checking-in'],function(){
         /** 打卡记录 */
@@ -662,13 +667,9 @@ Route::group(['prefix'=>'finance'],function(){
 Route::group(['prefix'=>'customer'],function(){
     /** 项目 */
     Route::group(['prefix'=>'project'],function(){
-        Route::group(['prefix'=>'report'],function(){
-            Route::match(['GET','POST'],'export','CustomerController@projectReportExport');
-        });
         Route::group(['prefix'=>'index'],function(){
             Route::match(['GET','POST'],'export','CustomerController@projectIndexExport');
         });
-        Route::get('report','CustomerController@projectReport');
         Route::get('index','CustomerController@projectIndex');
         Route::get('create','CustomerController@projectCreate');
         Route::group(['prefix'=>'area'],function(){