Pārlūkot izejas kodu

Merge branch 'waybill_ZD'

# Conflicts:
#	app/Commodity.php
#	resources/views/weight/package/statistics.blade.php
LD 6 gadi atpakaļ
vecāks
revīzija
71830b63af
35 mainītis faili ar 1606 papildinājumiem un 93 dzēšanām
  1. 1 1
      app/Commodity.php
  2. 287 0
      app/Http/Controllers/ProcessController.php
  3. 24 3
      app/Http/Controllers/TestController.php
  4. 47 0
      app/Process.php
  5. 20 0
      app/ProcessDaily.php
  6. 26 0
      app/ProcessDailyParticipant.php
  7. 10 0
      app/ProcessMethod.php
  8. 17 0
      app/ProcessStatistic.php
  9. 16 0
      app/ProcessesAdditionalBill.php
  10. 24 0
      app/Tutorial.php
  11. 27 0
      app/UserDetail.php
  12. 24 0
      app/UserDutyCheck.php
  13. 27 0
      app/UserLabor.php
  14. 1 1
      database/migrations/2020_03_09_132100_add_store_transfer_authority.php
  15. 46 0
      database/migrations/2020_03_25_164030_create_processes_table.php
  16. 37 0
      database/migrations/2020_03_25_164101_create_processes_additional_bills_table.php
  17. 40 0
      database/migrations/2020_03_25_164120_create_process_methods_table.php
  18. 43 0
      database/migrations/2020_03_25_164138_create_process_statistics_table.php
  19. 35 0
      database/migrations/2020_03_25_164207_create_tutorials_table.php
  20. 37 0
      database/migrations/2020_03_25_164242_create_process_dailies_table.php
  21. 43 0
      database/migrations/2020_03_25_164303_create_process_daily_participants_table.php
  22. 37 0
      database/migrations/2020_03_25_164322_create_user_duty_checks_table.php
  23. 34 0
      database/migrations/2020_03_25_164350_create_user_labors_table.php
  24. 38 0
      database/migrations/2020_03_25_164409_create_user_details_table.php
  25. 57 0
      database/migrations/2020_03_25_164834_change_commodities_table.php
  26. 49 0
      database/migrations/2020_03_25_182324_add_process_authority.php
  27. 31 0
      database/migrations/2020_03_26_102832_create_process_tutorial_table.php
  28. 3 0
      resources/views/layouts/menu.blade.php
  29. 1 1
      resources/views/maintenance/city/create.blade.php
  30. 467 0
      resources/views/process/index.blade.php
  31. 26 0
      resources/views/process/menu.blade.php
  32. 18 0
      resources/views/process/menuProcess.blade.php
  33. 0 80
      resources/views/store/index.blade.php
  34. 1 7
      resources/views/weight/package/statistics.blade.php
  35. 12 0
      routes/web.php

+ 1 - 1
app/Commodity.php

@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
 
 class Commodity extends Model
 {
-    protected $fillable=['name','sku','owner_name'];
+    protected $fillable=['name','sku','owner_id'];
     protected $appends=['barcode'];
 
     public function barcodes()

+ 287 - 0
app/Http/Controllers/ProcessController.php

@@ -0,0 +1,287 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Commodity;
+use App\Exports\WaybillExport;
+use App\Owner;
+use App\Process;
+use App\ProcessDaily;
+use App\User;
+use App\UserDutyCheck;
+use Carbon\Carbon;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Gate;
+use Maatwebsite\Excel\Facades\Excel;
+
+class ProcessController extends Controller
+{
+
+    public function conditionQuery(Request $request,$processes){
+        if(!Gate::allows('二次加工管理-查询')){ return redirect(url('/'));  }
+        $today=Carbon::now()->subDays(15);
+        if ($request->input('commodity_barcode')){
+            $barcode=$request->input('commodity_barcode');
+            $processes=$processes->with('commodity')->whereHas('commodity',function (Builder $query)use($barcode){
+                $query->where('barcode','like',$barcode.'%');
+            });
+        }
+        if ($request->input('date_start')){
+            $processes=$processes->where('created_at','>=',$request->input('date_start'));
+        }
+        if ($request->input('date_end')){
+            $processes=$processes->where('created_at','<=',$request->input('date_end'));
+        }
+        if ($request->input('owner_id')){
+            $processes=$processes->where('owner_id',$request->input('owner_id'));
+        }
+        if ($request->input('wms_code')){
+            $processes=$processes->where('wms_code','like','%'.$request->input('wms_code').'%')->where('created_at','>',$today->format('Y-m-d'));
+        }
+        $processes=$processes->paginate($request->input('paginate')??50);
+        return $processes;
+    }
+
+    /**
+     * Display a listing of the resource.
+     * @param Request $request
+     * @return \Illuminate\Http\Response
+     */
+    public function index(Request $request)
+    {
+        if(!Gate::allows('二次加工管理-查询')){ return redirect(url('/'));  }
+        $processes=Process::with('tutorials')->orderBy('processes.id','DESC');
+        if ($request->input('checkSign')){
+            $excel=$this->isExport($request,$processes);
+            return $excel;
+        }
+        $processes=$this->conditionQuery($request,$processes);
+        $owners=Owner::select('id','name')->get();
+        return view('process.index',['processes'=>$processes,'owners'=>$owners]);
+    }
+
+
+    //获取导出数据
+    public function isExport(Request $request,$processes){
+        if(!Gate::allows('二次加工管理-查询')){ return redirect(url('/'));  }
+        if ($request->input('checkSign')=="-1"){
+            $processes=$this->conditionQuery($request,$processes);
+            $excel=$this->export($processes);
+            return $excel;
+        }
+        $id = explode( ',',$request->input('checkSign'));
+        $processes=$processes->whereIn('id',$id)->get();
+        $excel=$this->export($processes);
+        return $excel;
+    }
+
+    //获取每日参与人
+    public function getDailyParticipant(Request $request){
+        if(!Gate::allows('二次加工管理-登记工时')){ return redirect(url('/'));  }
+        $id=$request->input('id');
+        $processDailies=ProcessDaily::with('processDailyParticipants')->orderBy('time','DESC')
+            ->where('process_id',$id)->get();
+        if ($processDailies){
+            $processDailies=$this->countManHour($processDailies);
+        }
+        return $processDailies;
+    }
+
+    //根据参与人查找打卡记录计算工时信息
+    public function countManHour($processDailies){
+        $today=Carbon::now()->format('Y-m-d');
+        $date=date("Y-m-d",strtotime('+'.strval(5)." day",strtotime($today)));
+        $processDailyOne=$processDailies[count($processDailies)-1];
+        $startDate=Carbon::parse($processDailyOne->time);
+        $diffDay=$startDate->diffInDays($today,true);
+        foreach ($processDailies as $processDaily){
+            $date=$processDaily->time;
+            foreach ($processDaily->processDailyParticipants as $processDailyParticipant){
+                $user=$processDailyParticipant->user_id;
+                $userDutyCheckStart=UserDutyCheck::select('id','checked_at')->where('user_id',$user)
+                    ->where('checked_at','like',$date.'%')->where('type','登入')->orderBy('id')->first();
+                $userDutyCheckEnd=UserDutyCheck::select('id','checked_at')->where('user_id',$user)
+                    ->where('checked_at','like',$date.'%')->where('type','登出')->orderBy('id','desc')->first();
+                //跨日情况寻找下一天
+                if (!$userDutyCheckEnd){
+                    $date=date("Y-m-d",strtotime("+1 day",strtotime($date)));
+                    $userDutyCheckEnd=UserDutyCheck::select('id','checked_at')->where('user_id',$user)
+                        ->where('checked_at','like',$date.'%')->where('type','登出')->orderBy('id','desc')->first();
+                }
+                if (!$userDutyCheckStart || !$userDutyCheckEnd){
+                    continue;
+                }
+                $dateStart=Carbon::parse($userDutyCheckStart->checked_at);
+                $dateEnd=Carbon::parse($userDutyCheckEnd->checked_at);
+                $hour=($dateEnd->diffInSeconds($dateStart))/3600; //打卡工时
+                if ($processDailyParticipant->dinner_duration)$hour=$hour-(($processDailyParticipant->dinner_duration)/60); //减晚饭时间
+                $hour=$this->isHour($userDutyCheckStart,$hour); //去除休息时间
+                $processDailyParticipant->hour=round($hour,2);
+                if ($hour&&$processDailyParticipant->hour_count){
+                    $diff=abs(round($processDailyParticipant->hour_count-$hour,2));
+                    $processDailyParticipant->diff=$diff;
+                }
+                //计件工
+                if ($processDailyParticipant->unit_price){
+                    continue;
+                }
+                if ($hour&&$hour>8){
+                    $processDailyParticipant->billingHour=8;
+                    continue;
+                }
+                if ($hour&&$hour<=8){
+                    $processDailyParticipant->billingHour=round($hour,2);
+                }
+            }
+        }
+        return $processDailies;
+    }
+
+    //打卡工时减休息时间
+    public function isHour($userDutyCheckStart,$hour){
+
+        $date=$userDutyCheckStart->checked_at;
+        $date=Carbon::parse($date)->format('H');
+        if ((int)$date<=11){
+            $hour=$hour-1;
+        }
+        return $hour;
+    }
+
+    //驳回二次加工单
+    public function reject($id){
+        if(!Gate::allows('二次加工管理-接单与驳回')){ return redirect(url('/'));  }
+        $process=Process::select('id','status')->find($id);
+        $process->status="驳回";
+        $process->update();
+        $this->log(__METHOD__,"驳回二次加工单_".__FUNCTION__,json_encode($process),Auth::user()['id']);
+        return $process;
+    }
+    //接单
+    public function receive($id){
+        if(!Gate::allows('二次加工管理-接单与驳回')){ return redirect(url('/'));  }
+        $process=Process::select('id','status')->find($id);
+        $process->status="接单";
+        $process->update();
+        $this->log(__METHOD__,"接单二次加工单_".__FUNCTION__,json_encode($process),Auth::user()['id']);
+        return $process;
+    }
+    //完成
+    public function accomplish($id){
+        if(!Gate::allows('二次加工管理-验收完成')){ return redirect(url('/'));  }
+        $process=Process::select('id','status')->find($id);
+        $process->status="已完成";
+        $process->update();
+        $this->log(__METHOD__,"完成二次加工单_".__FUNCTION__,json_encode($process),Auth::user()['id']);
+        return $process;
+    }
+    /**
+     * Show the form for creating a new resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function create()
+    {
+        //
+    }
+
+    /**
+     * Store a newly created resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @return \Illuminate\Http\Response
+     */
+    public function store(Request $request)
+    {
+        //
+    }
+
+    /**
+     * Display the specified resource.
+     *
+     * @param  int  $id
+     * @return \Illuminate\Http\Response
+     */
+    public function show($id)
+    {
+        //
+    }
+
+    /**
+     * Show the form for editing the specified resource.
+     *
+     * @param  int  $id
+     * @return \Illuminate\Http\Response
+     */
+    public function edit($id)
+    {
+        //
+    }
+
+    /**
+     * Update the specified resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  int  $id
+     * @return \Illuminate\Http\Response
+     */
+    public function update(Request $request, $id)
+    {
+        //
+    }
+
+    /**
+     * Remove the specified resource from storage.
+     *
+     * @param  int  $id
+     * @return \Illuminate\Http\Response
+     */
+    public function destroy($id)
+    {
+        //
+    }
+
+    //执行
+    public function export($processes){
+        if(!Gate::allows('二次加工管理-查询')){ return '没有权限';  }
+        $row=[[
+            'id'=>'ID',
+            'code'=>'任务号',
+            'owner_name'=>'货主',
+            'bill_type'=>'单据类型',
+            'wms_code'=>'单据号',
+            'process_method_name'=>'加工类型',
+            'amount'=>'预期数量',
+            'unit_price'=>'单价',
+            'created_at'=>'提交日期',
+            'commodity_barcode'=>'商品编码',
+            'commodity_name'=>'商品名称',
+            'completed_amount'=>'实际数量',
+            'status'=>'状态',
+        ]];
+        $list=[];
+        $i=0;
+        foreach ($processes as $process){
+            $w=[
+                'id'=>$process->id,
+                'code'=>$process->code ,
+                'owner_name'=>$process->owner_name ,
+                'bill_type'=>$process->bill_type ,
+                'wms_code'=>$process->wms_code ,
+                'process_method_name'=>$process->process_method_name,
+                'amount'=>$process->amount,
+                'unit_price'=>$process->unit_price,
+                'created_at'=>$process->created_at ,
+                'commodity_barcode'=>$process->commodity_barcode,
+                'commodity_name'=>$process->commodity_name ,
+                'completed_amount'=>$process->completed_amount,
+                'status'=>$process->status,
+            ];
+            $list[$i]=$w;
+            $i++;
+        }
+        return Excel::download(new WaybillExport($row,$list),date('YmdHis', time()).'-二次加工单.xls');
+    }
+}

+ 24 - 3
app/Http/Controllers/TestController.php

@@ -16,11 +16,13 @@ use App\Logistic;
 use App\MeasuringMachine;
 use App\Order;
 use App\Package;
+use App\ProcessDaily;
 use App\Rejected;
 use App\RejectedBill;
 use App\RejectedBillItem;
 use App\Role;
 use App\User;
+use App\UserDutyCheck;
 use App\WMSReflectReceive;
 use Carbon\Carbon;
 use Illuminate\Database\Eloquent\Collection;
@@ -136,8 +138,27 @@ class TestController extends Controller
     }
 
     public function test1(){
-        $a=Package::select('id','batch_rule')->find(6);
-        $a->batch_rule="b";
-        $a->update(); //$a->save();
+  /*      $a=Package::orderBy('id')->first();
+
+        $date=date("Y-m-d",strtotime("+1 day",strtotime($a->created_at->format('Y-m-d'))));
+        dd($a->created_at->format('Y-m-d'));
+
+        $b=Package::orderBy('id','desc')->first();
+        $sf=$a->created_at->format('Y-m-d');dd((int)$sf);
+        $result=$sf->lte("11:00");
+
+        $c=Carbon::parse("9:10:05");
+        $d=Carbon::parse("18:01:20");
+        $x=($d->diffInSeconds($c))/3600;
+        dd($c,$d,round($x,2)-1);*/
+        $userDutyCheckStart=UserDutyCheck::select('id','checked_at')->where('user_id',1)
+            ->where('checked_at','like','2020-03-13%')->where('type','登入')->orderBy('id')->first();
+        $today=Carbon::now()->format('Y-m-d');
+        $date=date("Y-m-d",strtotime('+'.strval(5)." day",strtotime($today)));
+        $startDate=Carbon::parse("2020-03-31");
+        $diffDay=$startDate->diffInDays($today,true);
+
+        dd($diffDay);
+        $package=Package::orderBy('updated_at','DESC')->get();
     }
 }

+ 47 - 0
app/Process.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Process extends Model
+{
+    protected $fillable=[
+        'code','owner_id','bill_type','wms_code','process_method_id','operation_code',
+        'unit_price','status','commodity_id','amount','completed_amount','remark','created_at','updated_at'
+    ];
+    protected $appends=[
+        'owner_name','process_method_name','commodity_name','commodity_barcode'
+    ];
+
+    public function owner(){
+        return $this->belongsTo('App\Owner','owner_id','id');
+    }
+    public function processMethod(){
+        return $this->belongsTo('App\ProcessMethod','process_method_id','id');
+    }
+    public function commodity(){
+        return $this->belongsTo('App\Commodity','commodity_id','id');
+    }
+    public function tutorials(){
+        return $this->belongsToMany('App\Tutorial','process_tutorial','process_id','tutorial_id');
+    }
+
+
+    public function getOwnerNameAttribute()
+    {
+        return $this['owner']? $this['owner']['name']:null;
+    }
+    public function getProcessMethodNameAttribute()
+    {
+        return $this['processMethod']? $this['processMethod']['name']:null;
+    }
+    public function getCommodityNameAttribute()
+    {
+        return $this['commodity']? $this['commodity']['name']:null;
+    }
+    public function getCommodityBarcodeAttribute()
+    {
+        return $this['commodity']? $this['commodity']['barcode']:null;
+    }
+}

+ 20 - 0
app/ProcessDaily.php

@@ -0,0 +1,20 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class ProcessDaily extends Model
+{
+    protected $fillable=[
+        'process_id','date','output','remain'
+    ];
+
+
+    public function process(){
+        return $this->belongsTo('App\Process','process_id','id');
+    }
+    public function processDailyParticipants(){
+        return $this->hasMany('App\ProcessDailyParticipant','process_daily_id','process_id');
+    }
+}

+ 26 - 0
app/ProcessDailyParticipant.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class ProcessDailyParticipant extends Model
+{
+    protected $fillable=[
+        'process_daily_id','user_id','started_at','ended_at','hour_price',
+        'hour_count','unit_price','unit_count','dinner_duration','remark'
+    ];
+    protected $appends=[
+        'user_name'
+    ];
+
+    public function user(){
+        return $this->belongsTo('App\User','user_id','id');
+    }
+
+
+    public function getUserNameAttribute()
+    {
+        return $this['user']?$this['user']['name']:null;
+    }
+}

+ 10 - 0
app/ProcessMethod.php

@@ -0,0 +1,10 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class ProcessMethod extends Model
+{
+    protected $fillable=['name'];
+}

+ 17 - 0
app/ProcessStatistic.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class ProcessStatistic extends Model
+{
+    //重新约定主键且不允许自增
+    protected $primaryKey='process_id';
+    public $incrementing=false;
+
+    protected $fillable=[
+        'process_id','started_at','ended_at','revenue','duration_days',
+        'duration_man_hours','top_capacity','bottom_capacity','average_capacity','total_cost','gross_profit','gross_profit_rate'
+    ];
+}

+ 16 - 0
app/ProcessesAdditionalBill.php

@@ -0,0 +1,16 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class ProcessesAdditionalBill extends Model
+{
+    protected $fillable=[
+        'process_id','wms_code','bill_type','amount'
+    ];
+
+    public function process(){
+        return $this->belongsTo('App\Process','process_id','id');
+    }
+}

+ 24 - 0
app/Tutorial.php

@@ -0,0 +1,24 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Tutorial extends Model
+{
+    protected $fillable=[
+        'owner_id','name','content','type'
+    ];
+    protected $appends=[
+        'owner_name'
+    ];
+
+    public function owner(){
+        return $this->belongsTo('App\Owner','owner_id','id');
+    }
+
+    public function getOwnerNameAttribute()
+    {
+        $this['owner']? $this['owner']['name']:null;
+    }
+}

+ 27 - 0
app/UserDetail.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class UserDetail extends Model
+{
+    protected $primaryKey='user_id';
+    public $incrementing=false;
+
+    protected $fillable=[
+        'user_id','full_name','gender','identity_number','mobile_phone','type'
+    ];
+    protected $appends=[
+        'user_name'
+    ];
+
+    public function user(){
+        return $this->belongsTo('App\User','user_id','id');
+    }
+
+    public function getAttribute()
+    {
+        return $this['user']?$this['user']['name']:null;
+    }
+}

+ 24 - 0
app/UserDutyCheck.php

@@ -0,0 +1,24 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class UserDutyCheck extends Model
+{
+    protected $fillable=[
+        'user_id','checked_at','confirmed_by','type','source'
+    ];
+    protected $appends=[
+        'user_name'
+    ];
+
+    public function user(){
+        return $this->belongsTo('App\User','user_id','id');
+    }
+
+    public function getUserNameAttribute()
+    {
+        return $this['user']?$this['user']['name']:null;
+    }
+}

+ 27 - 0
app/UserLabor.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class UserLabor extends Model
+{
+    protected $primaryKey='user_id';
+    public $incrementing=false;
+
+    protected $fillable=[
+        'user_id','default_hour_price','company'
+    ];
+    protected $appends=[
+        'user_name'
+    ];
+
+    public function user(){
+        return $this->belongsTo('App\User','user_id','id');
+    }
+
+    public function getAttribute()
+    {
+        return $this['user']?$this['user']['name']:null;
+    }
+}

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

@@ -42,7 +42,7 @@ class AddStoreTransferAuthority extends Migration
     public function down()
     {
         foreach ($this->authNames as $name){
-            Authority::where('name','$name')->delete();
+            Authority::where('name',$name)->delete();
         }
     }
 }

+ 46 - 0
database/migrations/2020_03_25_164030_create_processes_table.php

@@ -0,0 +1,46 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateProcessesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * 二次加工单
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('processes', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->string('code')->unique()->comment('任务号');
+            $table->bigInteger('owner_id')->index()->comment('外键货主');
+            $table->enum('bill_type',['移库单','入库单','出库单'])->comment('单据类型');
+            $table->string('wms_code')->index()->comment('单据号');
+            $table->bigInteger('process_method_id')->comment('外键加工类型');
+            $table->string('operation_code')->nullable()->comment('作业码');
+            $table->decimal('unit_price')->comment('单价');
+            $table->enum('status',['待接单','待加工','驳回','加工中','待验收','已完成'])->comment('状态');
+            $table->bigInteger('commodity_id')->comment('外键商品');
+            $table->integer('amount')->comment('数量');
+            $table->integer('completed_amount')->nullable()->comment('完成数量');
+            $table->string('remark')->nullable()->comment('备注');
+            $table->timestamp('created_at')->index()->nullable();
+            $table->timestamp('updated_at')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('processes');
+    }
+}

+ 37 - 0
database/migrations/2020_03_25_164101_create_processes_additional_bills_table.php

@@ -0,0 +1,37 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateProcessesAdditionalBillsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     *二次加工单叠加单
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('processes_additional_bills', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->bigInteger('process_id')->index()->comment('外键二次加工单');
+            $table->string('wms_code')->index()->comment('单据号');
+            $table->enum('bill_type',['入库单'])->default('入库单')->comment('单据类型');
+            $table->integer('amount')->comment('数量');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('processes_additional_bills');
+    }
+}

+ 40 - 0
database/migrations/2020_03_25_164120_create_process_methods_table.php

@@ -0,0 +1,40 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateProcessMethodsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * 二次加工类型
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('process_methods', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->string('name');
+            $table->timestamps();
+        });
+        $processMethods=['贴标','撕标','全检','组套','拆套','喷码','其他'];
+        for ($i=0;$i<count($processMethods);$i++){
+            \App\ProcessMethod::create([
+                'name'=>$processMethods[$i]
+            ]);
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('process_methods');
+    }
+}

+ 43 - 0
database/migrations/2020_03_25_164138_create_process_statistics_table.php

@@ -0,0 +1,43 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateProcessStatisticsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * 二次加工统计表
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('process_statistics', function (Blueprint $table) {
+            $table->bigInteger('process_id')->unique()->comment('外键二次加工单');
+            $table->timestamp('started_at')->comment('开始日期');
+            $table->timestamp('ended_at')->nullable()->comment('结束日期');
+            $table->decimal('revenue')->nullable()->comment('收入合计');
+            $table->integer('duration_days')->nullable()->comment('完成天数');
+            $table->integer('duration_man_hours')->nullable()->comment('总工时');
+            $table->integer('top_capacity')->nullable()->comment('最高日产能');
+            $table->integer('bottom_capacity')->nullable()->comment('最低日产能');
+            $table->integer('average_capacity')->nullable()->comment('平均日产能');
+            $table->decimal('total_cost')->nullable()->comment('合计成本');
+            $table->decimal('gross_profit')->nullable()->comment('毛利润');
+            $table->decimal('gross_profit_rate',7,3)->nullable()->comment('毛利率');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('process_statistics');
+    }
+}

+ 35 - 0
database/migrations/2020_03_25_164207_create_tutorials_table.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateTutorialsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('tutorials', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->bigInteger('owner_id')->comment('外键货主');
+            $table->string('name')->comment('标题');
+            $table->longText('content')->nullable()->comment('富文本内容');
+            $table->enum('type',['二次加工'])->default('二次加工')->comment('类型');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('tutorials');
+    }
+}

+ 37 - 0
database/migrations/2020_03_25_164242_create_process_dailies_table.php

@@ -0,0 +1,37 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateProcessDailiesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * 加工单每日记录
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('process_dailies', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->bigInteger('process_id')->comment('外键二次加工单');
+            $table->date('time')->index()->comment('日期');
+            $table->integer('output')->comment('当日产量');
+            $table->integer('remain')->comment('当日剩余');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('process_dailies');
+    }
+}

+ 43 - 0
database/migrations/2020_03_25_164303_create_process_daily_participants_table.php

@@ -0,0 +1,43 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateProcessDailyParticipantsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * 加工单每日参与人记录
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('process_daily_participants', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->bigInteger('process_daily_id')->index()->comment('外键每日记录');
+            $table->bigInteger('user_id')->index()->comment('外键用户');
+            $table->time('started_at')->nullable()->comment('开始时间');
+            $table->time('ended_at')->nullable()->comment('开始时间');
+            $table->decimal('hour_price')->nullable()->comment('计时工资');
+            $table->tinyInteger('hour_count')->nullable()->comment('计时工时');
+            $table->decimal('unit_price')->nullable()->comment('计件工资');
+            $table->integer('unit_count')->nullable()->comment('计件数');
+            $table->integer('dinner_duration')->default(0)->comment('晚饭时间');
+            $table->string('remark')->nullable()->comment('备注');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('process_daily_participants');
+    }
+}

+ 37 - 0
database/migrations/2020_03_25_164322_create_user_duty_checks_table.php

@@ -0,0 +1,37 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateUserDutyChecksTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * 用户打卡记录表
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('user_duty_checks', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->bigInteger('user_id')->index()->comment('外键用户');
+            $table->timestamp('checked_at')->comment('打卡时间');
+            $table->bigInteger('verify_user_id')->nullable()->comment('外键用户(确认人)');
+            $table->enum('type',['无','登出','登入'])->default('无')->comment('打卡类型');
+            $table->enum('source',['正常','补入'])->default('正常')->comment('来源');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('user_duty_checks');
+    }
+}

+ 34 - 0
database/migrations/2020_03_25_164350_create_user_labors_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateUserLaborsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     *临时工
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('user_labors', function (Blueprint $table) {
+            $table->bigInteger('user_id')->unique()->comment('外键用户');
+            $table->decimal('default_hour_price')->nullable()->comment('默认计时工资');
+            $table->string('company')->nullable()->index()->comment('劳务所');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('user_labors');
+    }
+}

+ 38 - 0
database/migrations/2020_03_25_164409_create_user_details_table.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateUserDetailsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * 用户详情
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('user_details', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->string('full_name')->nullable()->comment('全名');
+            $table->enum('gender',['未知','男','女'])->nullable()->comment('性别');
+            $table->string('identity_number')->nullable()->index()->comment('身份证号');
+            $table->string('mobile_phone')->nullable()->index()->comment('手机号');
+            $table->enum('type',['无','员工','临时工','客户'])->default('无')->comment('类型');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('user_details');
+    }
+}

+ 57 - 0
database/migrations/2020_03_25_164834_change_commodities_table.php

@@ -0,0 +1,57 @@
+<?php
+
+use App\Commodity;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class ChangeCommoditiesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * 修改commodities表
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('commodities',function (Blueprint $table){
+            $table->bigInteger('owner_id')->after('owner_name')->nullable()->comment('外键货主');
+        });
+        if (Schema::hasColumn('commodities','owner_name')){
+            $commodities=Commodity::get();
+            foreach ($commodities as $commodity){
+                $owner=\App\Owner::select('id')->where('name',$commodity->owner_name)->first();
+                $commodity->owner_id=$owner->id;
+                $commodity->save();
+            }
+            Schema::table('commodities',function (Blueprint $table){
+                $table->dropColumn('owner_name');
+            });
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('commodities',function (Blueprint $table){
+            $table->string('owner_name')->after('owner_id')->nullable()->comment('外键货主');
+        });
+        if (Schema::hasColumn('commodities','owner_id')){
+            $commodities=Commodity::get();
+            foreach ($commodities as $commodity){
+                $owner=\App\Owner::select('id','name')->where('id',$commodity->owner_id)->first();
+                \Illuminate\Support\Facades\DB::table('commodities')->where('id',$commodity->id)->update(['owner_name'=>$owner->name]);
+            }
+            Schema::table('commodities',function (Blueprint $table){
+                $table->dropColumn('owner_id');
+            });
+
+        }
+    }
+}

+ 49 - 0
database/migrations/2020_03_25_182324_add_process_authority.php

@@ -0,0 +1,49 @@
+<?php
+
+use App\Authority;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddProcessAuthority extends Migration
+{
+
+    protected $authNames=[
+        '二次加工管理',
+        '二次加工管理-查询',
+        '二次加工管理-录入',
+        '二次加工管理-编辑',
+        '二次加工管理-删除',
+        '二次加工管理-门卫审核',
+        '二次加工管理-接单与驳回',
+        '二次加工管理-登记工时',
+        '二次加工管理-登记工时-审核',
+        '二次加工管理-验收完成',
+        '二次加工管理-教程管理',
+        '二次加工管理-临时工资料管理',
+    ];
+
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        foreach ($this->authNames as $name){
+            if(!Authority::where('name',$name)->first())(new Authority(['name'=>$name,'alias_name'=>$name]))->save();
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        foreach ($this->authNames as $name){
+            Authority::where('name',$name)->delete();
+        }
+    }
+}

+ 31 - 0
database/migrations/2020_03_26_102832_create_process_tutorial_table.php

@@ -0,0 +1,31 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateProcessTutorialTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('process_tutorial', function (Blueprint $table) {
+            $table->bigInteger('process_id')->index()->comment('外键二次加工单');
+            $table->bigInteger('tutorial_id')->index()->comment('外键教程');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('process_tutorial');
+    }
+}

+ 3 - 0
resources/views/layouts/menu.blade.php

@@ -13,6 +13,9 @@
         @can('称重管理')
             <li class="nav-item"><a href="{{url("package/")}}" class="nav-link"
                                     :class="{active:isActive('package',1)}">称重管理</a></li> @endcan
+        @can('称重管理')
+            <li class="nav-item"><a href="{{url("process/")}}" class="nav-link"
+                                    :class="{active:isActive('process',1)}">二次加工管理</a></li> @endcan
         @can('基础设置')
         <li class="nav-item"><a href="{{url("maintenance/")}}" class="nav-link"
                                 :class="{active:isActive('maintenance',1)}">基础设置</a></li> @endcan

+ 1 - 1
resources/views/maintenance/city/create.blade.php

@@ -31,7 +31,7 @@
                     <div class="form-group row">
                         <label for="province_id" class="col-2 col-form-label text-right">所属省份</label>
                         <div class="col-8">
-                            <select name="City[province_id]" class="form-control" style="width: 30%;height: 30px">
+                            <select name="City[province_id]" class="form-control" style="width: 30%;">
                                 @foreach($provinces as $province)
                                     <option value="{{$province->id}}">{{$province->name}}</option>
                                 @endforeach

+ 467 - 0
resources/views/process/index.blade.php

@@ -0,0 +1,467 @@
+@extends('layouts.app')
+@section('title')二次加工管理@endsection
+
+@section('content')
+<span id="nav2">
+    @component('process.menu')@endcomponent
+</span>
+<div class="d-none" id="process">
+    <div class="container-fluid mt-3">
+        <div>
+            <form  method="GET" action="{{url('process/')}}" style="margin-top: 1%" id="optionSubmit">
+                   <table class="table  table-sm table-bordered text-nowrap ">
+                       <tr v-if="isBeingFilterConditions">
+                           <td colspan="10">
+                               <div class="col" style="padding:0">
+                                   <a  href="{{url('process')}}"><span class="btn btn-warning text-dark">清除过滤条件</span></a>
+                               </div></td>
+                       </tr>
+                       <tr>
+                           <td>
+                               <span class="text-muted">每页显示记录:</span>
+                           </td>
+                           <td  colspan="9">
+                               <select name="paginate" v-model="filterData.paginate" class="tooltipTarget form-control-sm" style="vertical-align: middle" @change="submit">
+                                   <option value="50">50行</option>
+                                   <option value="100">100行</option>
+                                   <option value="200">200行</option>
+                                   <option value="500">500行</option>
+                                   <option value="1000">1000行</option>
+                               </select></td>
+                       </tr>
+                       <tr>
+                           <td rowspan="2" >
+                               <span class="text-muted">根据条件过滤:</span>
+                           </td>
+                           <td >
+                               <label for="date_start" style="width: 35px">时间:</label>
+                               <input id="date_start" name="date_start" v-model="filterData.date_start" type="date" class="form-control-sm ">
+                           </td>
+                           <td >
+                               <label>&nbsp;客&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;户&nbsp;:</label>
+                               <input type="text" class="form-control-sm tooltipTarget" placeholder="查找"
+                                      style="width:70px" {{--@input="owner_seek"--}}
+                                      title="输入关键词快速定位下拉列表,回车确定">
+                               <select name="owner_id" v-model="filterData.owner_id" @change="submit" class="form-control-sm tooltipTarget">
+                                   <option >    </option>
+                                   <option v-for="owner in owners" :value="owner.id">@{{owner.name}}</option>
+                               </select>
+                           </td>
+                           <td>
+                               <label for="wms_code">单据号:</label>
+                               <input id="wms_code" name="wms_code" v-model="filterData.wms_code" class="form-control-sm">
+                           </td>
+                           <td colspan="6"></td>
+                       </tr>
+                       <tr>
+                           <td >
+                               <label for="date_end" style="width: 35px"></label>
+                               <input id="date_end" name="date_end" v-model="filterData.date_end" type="date" class="form-control-sm ">
+                           </td>
+                           <td>
+                               <label>商品条码:</label>
+                               <input name="commodity_barcode" v-model="filterData.commodity_barcode" class="form-control-sm">
+                           </td>
+                           <td >
+                               <label for="status">&nbsp;状&nbsp;&nbsp;态&nbsp;:</label>
+                               <select id="status" name="status" v-model="filterData.status" @change="submit" class="form-control-sm tooltipTarget">
+                                   <option >    </option>
+                                   <option value="待接单">待接单</option>
+                                   <option value="待加工">待加工</option>
+                                   <option value="驳回">驳回</option>
+                                   <option value="加工中">加工中</option>
+                                   <option value="待验收">待验收</option>
+                                   <option value="已完成">已完成</option>
+                               </select>
+                           </td>
+                           <td colspan="6"></td>
+                       </tr>
+                       <tr>
+                           <td>
+                               <span class="text-muted">操作选定记录:</span>
+                           </td>
+                           <td colspan="9">
+                               <span class="dropdown">
+                                        <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData>0?'btn-dark text-light':'']"
+                                                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
+                                            导出Excel
+                                        </button>
+                                        <div class="dropdown-menu">
+                                            <a class="dropdown-item" @click="processExport(1)" href="javascript:">导出勾选内容</a>
+                                            <a class="dropdown-item" @click="processExport(2)" href="javascript:">导出所有页</a>
+                                        </div>
+                                    </span>
+                               <input hidden type="submit" >
+                           </td>
+                       </tr>
+                   </table>
+           </form>
+        </div>
+        <div>
+            <table class="table table-striped table-sm text-nowrap table-hover">
+                <tr>
+                    <th>
+                        <label for="all">
+                            <input id="all" type="checkbox" @click="checkAll($event)">全选
+                        </label>
+                    </th>
+                    <th>序号</th>
+                    <th >操作</th>
+                    <th>任务号</th>
+                    <th>货主</th>
+                    <th>单据类型</th>
+                    <th>单据号</th>
+                    <th>加工类型</th>
+                    <th>预期数量</th>
+                    <th class="text-center">教程</th>
+                    <th>单价</th>
+                    <th>提交日期</th>
+                    <th>商品编码</th>
+                    <th>商品名称 </th>
+                    <th>实际数量</th>
+                    <th>状态</th>
+                </tr>
+                <tr v-for="(processOne,i) in processes" :id="processOne.id">
+                    <td>
+                        <input class="checkItem" type="checkbox" :value="processOne.id" v-model="checkData">
+                    </td>
+                    <td class="text-muted">@{{ i+1 }}</td>
+                    <td >
+                        <p v-if="!processOne.openProcessHour && processOne.status=='驳回'" class="text-muted">已驳回</p>
+                        <p v-if="!processOne.openProcessHour && processOne.status=='已完成'" class="text-success">已完成</p>
+                        <button v-if="!processOne.openProcessHour && processOne.status=='待接单'" @click="processReject(processOne.id)" class="btn-sm btn-outline-dark pull-left">驳回</button>
+                        <button v-if="!processOne.openProcessHour && processOne.status=='待接单'"  @click="processReceive(processOne.id)" class="btn-sm btn-outline-primary pull-left">接单</button>
+                        <button v-if="(processOne.status=='加工中' || processOne.status=='待加工') && !processOne.openProcessHour"
+                                class="btn-sm btn-outline-info pull-left" @click="openProcessHour(processOne.id);processOne.openProcessHour=true;processOne.detailFolding=false">登记工时</button>
+                        <button v-if="processOne.openProcessHour" @click="closeProcessHour(processOne.id);processOne.openProcessHour=false" class="btn-sm btn-dark pull-left">收起登记工时</button>
+                        <button v-if="!processOne.openProcessHour && processOne.status=='待验收'" @click="processAccomplish(processOne.id)" class="btn-sm btn-outline-success pull-left">完成</button>
+                    </td>
+                    <td class="text-muted">@{{ processOne.code }}</td>
+                    <td class="text-muted">@{{ processOne.owner_name }}</td>
+                    <td class="text-muted">@{{ processOne.bill_type }}</td>
+                    <td class="text-muted">@{{ processOne.wms_code }}</td>
+                    <td >@{{ processOne.process_method_name }}</td>
+                    <td>@{{ processOne.amount }}</td>
+                    <td>
+                        <div class="text-center">
+                            <div v-if=" processOne.tutorials.length>1">
+                            <a href="javascript:;" @click="processOne.detailFolding=true;processOne.openProcessHour=false;closeProcessHour(processOne.id)" v-if="!processOne.detailFolding">@{{processOne.tutorials.length}}个教程,点击展开明细</a>
+                            <button class="btn-sm btn-outline-dark pull-left" href="javascript:;" @click="processOne.detailFolding=false" v-else>收起编辑</button>
+                            <table class="table table-sm" v-if="processOne.detailFolding">
+                                <tr>
+                                    <th>标题</th>
+                                    <th>货主</th>
+                                    <th>操作</th>
+                                    <th>创建时间</th>
+                                </tr>
+                                <tr v-for="(tutorial,i) in processOne.tutorials">
+                                    <td class="text-info">@{{tutorial.name}}</td>
+                                    <td >@{{tutorial.owner_name}}</td>
+                                    <td>@can('二次加工管理-教程管理')@endcan</td>
+                                    <td >@{{tutorial.created_at}}</td>
+                                </tr>
+                                <tr>
+                                    <td  colspan="4">
+                                        <button class="btn btn-info pull-left">新增或编辑关联教程</button>
+                                    </td>
+                                </tr>
+                            </table>
+                            </div>
+                            <div v-if="processOne.tutorials.length==1 && !processOne.detailFolding">
+                                <a v-for="tutorial in processOne.tutorials" class="text-info">@{{tutorial.name}}</a>
+                                <button class="btn-sm btn-outline-info pull-right">改</button>
+                                <button  class="btn-sm btn-outline-dark pull-right" >删</button>
+                            </div>
+                        </div>
+                    </td>
+                    <td class="text-muted">@{{ processOne.unit_price }}</td>
+                    <td>@{{ processOne.created_at }}</td>
+                    <td class="text-muted">@{{ processOne.commodity_barcode }}</td>
+                    <td class="text-muted">@{{ processOne.commodity_name }}</td>
+                    <td>@{{ processOne.completed_amount }}</td>
+                    <td class="text-muted">@{{ processOne.status }}</td>
+                </tr>
+                <tr v-if="processDailyParticipants.length>0">
+                    <td colspan="2"></td>
+                    <td colspan="16">
+                        <table class="table-sm table-bordered table-condensed">
+                            <tr class="bg-success">
+                                <td>日期</td><td>当日产量</td>
+                                <td>当日剩余</td>
+                                <td colspan="2">操作</td>
+                                <td>参与者</td>
+                                <td>开始时间</td>
+                                <td>结束时间</td>
+                                <td>计时工资</td>
+                                <td>计件工资</td>
+                                <td>晚饭时间</td>
+                                <td>计时工时</td>
+                                <td>备注</td>
+                                <td>打卡工时</td>
+                                <td>工时差</td>
+                                <td>计费工时</td>
+                                <td>计件数量</td>
+                                <td>审核</td>
+                                <td>详情</td>
+                            </tr>
+                            <tr  v-for="processDaily in processDailyParticipants" :id="'processDaily'+processDaily.id">
+                                <td v-if="processDaily.rowspan" :rowspan="processDaily.rowspan"><p v-if="processDailies[processDaily.id]">@{{ processDailies[processDaily.id].time }}</p></td>
+                                <td v-if="processDaily.rowspan"  :rowspan="processDaily.rowspan"><p v-if="processDailies[processDaily.id]">@{{ processDailies[processDaily.id].output }}</p></td>
+                                <td v-if="processDaily.rowspan" :rowspan="processDaily.rowspan"><p v-if="processDailies[processDaily.id]">@{{ processDailies[processDaily.id].remain }}</p></td>
+                                <td v-if="processDaily.rowspan" :rowspan="processDaily.rowspan">
+                                    <button v-if="isAddProcessDailyParticipant" class="btn btn-sm btn-info" @click="addProcessDailyParticipant(processDaily.id);isAddProcessDailyParticipant=false;">新增</button>
+                                    <button v-if="!isAddProcessDailyParticipant" class="btn btn-sm btn-info" @click="addProcessDailyParticipant(processDaily.id);isAddProcessDailyParticipant=true;">取消</button>
+                                </td>
+                                <td></td>
+                                <td>@{{ processDaily.user_name }}</td>
+                                <td>@{{ processDaily.started_at }}</td>
+                                <td>@{{ processDaily.ended_at }}</td>
+                                <td>@{{ processDaily.hour_price }}</td>
+                                <td>@{{ processDaily.unit_price }}</td>
+                                <td>@{{ processDaily.dinner_duration }}</td>
+                                <td>@{{ processDaily.hour_count }}</td>
+                                <td>@{{ processDaily.remark }}</td>
+                                <td>@{{ processDaily.hour }}</td>
+                                <td>@{{ processDaily.diff }}</td>
+                                <td>@{{ processDaily.billingHour }}</td>
+                                <td>@{{ processDaily.unit_count }}</td>
+                                <td>审核</td>
+                                <td>详情</td>
+                            </tr>
+                        </table>
+                    </td>
+                </tr>
+            </table>
+        </div>
+    </div>
+</div>
+
+
+@endsection
+
+@section('lastScript')
+    <script>
+        new Vue({
+            el:"#process",
+            data:{
+                processes:[
+                    @foreach($processes as $processOne)
+                    {id:'{{$processOne->id}}',code:'{{$processOne->code}}',owner_name:'{{$processOne->owner_name}}',bill_type:'{{$processOne->bill_type}}'
+                        ,wms_code:'{{$processOne->wms_code}}',process_method_name:'{{$processOne->process_method_name}}',amount:'{{$processOne->amount}}'
+                        ,tutorials:{!! $processOne->tutorials !!},unit_price:'{{$processOne->unit_price}}',created_at:'{{$processOne->created_at}}'
+                        ,commodity_barcode:'{{$processOne->commodity_barcode}}',commodity_name:'{{$processOne->commodity_name}}',
+                        completed_amount:'{{$processOne->completed_amount}}',status:'{{$processOne->status}}',detailFolding:false,openProcessHour:false,},
+                    @endforeach
+                ],
+                owners:[
+                    @foreach($owners as $owner)
+                    {!! $owner !!},
+                    @endforeach
+                ],
+                checkData:[],
+                filterData:{paginate:50,date_start:'',date_end:'',owner_id:'',commodity_barcode:'',wms_code:'',status:''},
+                processDailies:[],
+                processDailyParticipants:[],
+                isAddProcessDailyParticipant:true,
+            },
+            watch:{
+                checkData:{
+                    handler(){
+                        if (this.checkData.length === this.processes.length){
+                            document.querySelector('#all').checked = true;
+                        }else {
+                            document.querySelector('#all').checked = false;
+                        }
+                    },
+                    deep:true
+                }
+            },
+            computed:{
+                isBeingFilterConditions:function(){
+                    for(let key in this.filterData){
+                        if(this.filterData[key]){
+                            if(key==='paginate')continue;
+                            return true
+                        }
+                    }
+                    return false;
+                },
+
+            },
+            mounted:function () {
+                this.initInputs();
+                $(".tooltipTarget").tooltip({'trigger':'hover'});
+                $('#process').removeClass('d-none');
+            },
+            methods:{
+                //回显条件参数
+                initInputs:function(){
+                    let data=this;
+                    let uriParts =decodeURI(location.href).split("?");
+                    if(uriParts.length>1){
+                        let params = uriParts[1].split('&');
+                        params.forEach(function(paramPair){
+                            let pair=paramPair.split('=');
+                            let key = pair[0], val = pair[1];
+                            $('input[name="'+key+'"]').val(val);
+                            $('select[name="'+key+'"]').val(val);
+                            decodeURI(data.filterData[key]=val);
+                        });
+                    }
+                },
+                //提交表单
+                submit:function(){
+                    let form = $("#optionSubmit");
+                    form.submit();
+                },
+                //全选事件
+                checkAll(e){
+                    if (e.target.checked){
+                        this.processes.forEach((el,i)=>{
+                            if (this.checkData.indexOf(el.id) == '-1'){
+                                this.checkData.push(el.id);
+                            }
+                        });
+                    }else {
+                        this.checkData = [];
+                    }
+                },
+                //导出excel,因同步问题不使用formData
+                processExport(e){
+                    let val=e;
+                    let data=this.filterData;
+                    if (val==1){
+                        if (this.checkData&&this.checkData.length<=0){
+                            tempTip.setDuration(4000);
+                            tempTip.showSuccess('没有勾选任何记录');
+                        }else{
+                            location.href="{{url('process?checkSign=')}}"+this.checkData;
+                        }
+                    } else {
+                        location.href="{{url('process?checkSign=-1&date_start=')}}"+
+                            data.date_start+"&date_end="+data.date_end+"&owner_id="+
+                            data.owner_id+"&commodity_barcode="+data.commodity_barcode+"&wms_code="+data.wms_code+
+                            "&status="+data.status;
+                    }
+                },
+                //获取登记工时
+                openProcessHour(e){
+                    let _this=this;
+                    axios.post("{{url("process/getDailyParticipant")}}",{id:e})
+                        .then(function (response) {
+                            let processDailies=response.data;
+                            for (let i=0;i<processDailies.length;i++){
+                                let processDailyParticipants=processDailies[i].process_daily_participants;
+                                if (!processDailyParticipants)continue;
+                                for (let j=0;j<processDailyParticipants.length;j++){
+                                    let data={};
+                                    data['id']=processDailyParticipants[j].id;
+                                    data['started_at']=processDailyParticipants[j].started_at;
+                                    data['user_name']=processDailyParticipants[j].user_name;
+                                    data['ended_at']=processDailyParticipants[j].ended_at;
+                                    data['hour_price']=processDailyParticipants[j].hour_price;
+                                    data['unit_price']=processDailyParticipants[j].unit_price;
+                                    data['dinner_duration']=processDailyParticipants[j].dinner_duration;
+                                    data['hour_count']=processDailyParticipants[j].hour_count;
+                                    data['remark']=processDailyParticipants[j].remark;
+                                    data['hour']=processDailyParticipants[j].hour;
+                                    data['diff']=processDailyParticipants[j].diff;
+                                    data['billingHour']=processDailyParticipants[j].billingHour;
+                                    data['unit_count']=processDailyParticipants[j].unit_count;
+                                    data['process_id']=processDailies[i].process_id;
+                                    if (!_this.processDailies[processDailies[i].id]){
+                                        data['daily']=processDailies[i].id;
+                                        data['rowspan']=processDailyParticipants.length;
+                                        let obj={};
+                                        obj['time']=processDailies[i].time;
+                                        obj['output']=processDailies[i].output;
+                                        obj['remain']=processDailies[i].remain;
+                                        _this.processDailies[processDailies[i].id]=obj;
+                                    }
+                                    _this.processDailyParticipants.push(data);
+                                }
+                            }
+                            console.log(_this.processDailyParticipants)
+                    }).catch(function (err) {
+                        console.log(err)
+                    });
+                },
+                //删除工时显示
+                closeProcessHour(e){
+                    this.processDailies=[];
+                    this.processDailyParticipants=[];
+                },
+                //新增参与人
+                addProcessDailyParticipant(e){
+                    let html='<tr><td></td><td>@{{ processDaily.user_name}}</td>' +
+                        '<td>@{{ processDaily.started_at }}</td><td>@{{ processDaily.ended_at }}</td>' +
+                        '<td>@{{ processDaily.hour_price }}</td><td>@{{ processDaily.unit_price }}</td>' +
+                        '<td>@{{ processDaily.dinner_duration }}</td><td>@{{ processDaily.hour_count }}</td>' +
+                        '<td>@{{ processDaily.remark }}</td><td>@{{ processDaily.hour }}</td>' +
+                        '<td>@{{ processDaily.diff }}</td><td>@{{ processDaily.billingHour }}</td>' +
+                        '<td>@{{ processDaily.unit_count }}</td><td>审核</td>' +
+                        '<td>详情</td></tr>';
+                    this.processDailyParticipants.every(function (processDailyParticipant) {
+                        if (processDailyParticipant.id==e){
+                            processDailyParticipant.rowspan=(processDailyParticipant.rowspan)+1;
+                            return false;
+                        }
+                        return  true;
+                    });
+                    $("#processDaily"+e).after(html);
+                },
+                //驳回
+                processReject(id){
+                    let url="{{url('process/reject')}}"+"/"+id;
+                    let _this=this;
+                    axios.post(url)
+                        .then(function (response) {
+                            _this.processes.every(function (process) {
+                                if (process.id==response.data.id){
+                                    process.status=response.data.status;
+                                    return false;
+                                }
+                                return true;
+                            });
+                        }).catch(function (err) {
+                            console.log(err)
+                        })
+                },
+                //接单
+                processReceive(id){
+                    let url="{{url('process/receive')}}"+"/"+id;
+                    let _this=this;
+                    axios.post(url)
+                        .then(function (response) {
+                            _this.processes.every(function (process) {
+                                if (process.id==response.data.id){
+                                    process.status=response.data.status;
+                                    return false;
+                                }
+                                return true;
+                            });
+                        }).catch(function (err) {
+                        console.log(err)
+                    })
+                },
+                //完成
+                processAccomplish(id){
+                    let url="{{url('process/accomplish')}}"+"/"+id;
+                    let _this=this;
+                    axios.post(url)
+                        .then(function (response) {
+                            _this.processes.every(function (process) {
+                                if (process.id==response.data.id){
+                                    process.status=response.data.status;
+                                    return false;
+                                }
+                                return true;
+                            });
+                        }).catch(function (err) {
+                        console.log(err)
+                    })
+                }
+            },
+        });
+    </script>
+@endsection

+ 26 - 0
resources/views/process/menu.blade.php

@@ -0,0 +1,26 @@
+
+<div class="container-fluid mt-3" id="nav2">
+    <div class="card">
+        <ul class="nav nav-pills">
+            @can('二次加工管理-查询')
+            <li class="nav-item">
+                <a class="nav-link" href="{{url('process/')}}" :class="{active:isActive('',2)}">查询</a>
+            </li> @endcan
+            @can('二次加工管理-录入')
+            <li class="nav-item">
+                <a class="nav-link" href="{{url('process/create')}}" :class="{active:isActive('create',2)}">录入</a>
+            </li> @endcan
+            @can('二次加工管理-查询')
+                <li class="nav-item">
+                    <a class="nav-link" href="{{url('process/')}}" :class="{active:isActive('',2)}">统计</a>
+                </li> @endcan
+            @can('二次加工管理-查询')
+                <li class="nav-item">
+                    <a class="nav-link" href="{{url('process/create')}}" :class="{active:isActive('create',2)}">考勤</a>
+                </li> @endcan
+            <li class="nav-item">
+                <a class="nav-link text-dark" href="{{url('waybill/relating')}}" :class="{active:isActive('relating',2)}">相关设置</a>
+            </li>
+        </ul>
+    </div>
+</div>

+ 18 - 0
resources/views/process/menuProcess.blade.php

@@ -0,0 +1,18 @@
+@extends('layouts.app')
+
+@section('content')
+    <div id="nav2">
+        @component('process.menu')
+        @endcomponent
+        <div class="container-fluid">
+            <div class="card menu-third" style="background: #f9f0f0;transform: scale(0.95)">
+                <ul class="nav nav-pills">
+                    @can('二次加工管理-教程管理')
+                        <li class="nav-item">
+                            <a class="nav-link text-dark" href="{{url('process/')}}" :class="{active:isActive('waybillPriceModel',2)}">教程管理</a>
+                        </li> @endcan
+                </ul>
+            </div>
+        </div>
+    </div>
+@endsection

+ 0 - 80
resources/views/store/index.blade.php

@@ -7,86 +7,6 @@
     </span>
     <div class="d-none" id="fast">
         <div class="container-fluid mt-3">
-            <div class="">
-                <div>
- {{--                   <form  method="GET" action="{{url('store/')}}" style="margin-top: 1%" id="optionSubmit">
-                        <table class="table  table-sm table-bordered text-nowrap ">
-                            <tr v-if="isBeingFilterConditions">
-                                <td colspan="10"><div class="col" style="padding:0">
-                                        <a  href="{{url('store')}}"><span class="btn btn-warning text-dark">清除过滤条件</span></a>
-                                    </div></td>
-                            </tr>
-                            <tr>
-                                <td>
-                                    <span class="text-muted">每页显示记录:</span>
-                                </td>
-                                <td  colspan="9">
-                                    <select name="paginate" v-model="filterData.paginate" class="tooltipTarget form-control-sm" style="vertical-align: middle" @change="setPaginate">
-                                        <option value="50">50行</option>
-                                        <option value="100">100行</option>
-                                        <option value="200">200行</option>
-                                        <option value="500">500行</option>
-                                        <option value="1000">1000行</option>
-                                    </select></td>
-                            </tr>
-                            <tr>
-                                <td rowspan="2">
-                                    <span class="text-muted">根据条件过滤:</span>
-                                </td>
-                                <td >
-                                    <label class="form-inline" style="width: 350px">时间:
-                                        <input style="width: 150px" name="created_at_start" type="date" v-model="filterData.created_at_start" class="form-control-sm">
-                                        <input style="width: 150px" type="date" name="created_at_end" v-model="filterData.created_at_end" class="form-control-sm">
-                                    </label>
-                                </td>
-                                --}}{{--<td > <label class="form-inline" style="width:200px;margin-left: 2%">货主:
-                                        <input class="form-control-sm" style="width: 80px" placeholder="搜索定位" @input="owner_seek">&nbsp;&nbsp;&nbsp;
-                                        <select name="owner_id" v-model="filterData.owner_id" class="form-control-sm"  @change="setOwner">
-                                            <option >    </option>
-                                            @foreach($owners as $owner)
-                                                <option value="{{$owner->id}}">{{$owner->name}}</option>
-                                            @endforeach
-                                        </select></label><input hidden type="submit" value="kk"></td>--}}{{--
-                                <td>
-                                    <label for="">客户:</label>
-                                    <input type="text" class="form-control-sm tooltipTarget" placeholder="查找"
-                                           style="width:70px" @input="owner_seek"
-                                           title="输入关键词快速定位下拉列表,回车确定">
-                                    <select name="owner_id" v-model="filterData.owner_id" @change="setOwner" class="form-control-sm tooltipTarget">
-                                        <option >    </option>
-                                        @foreach($owners as $owner)
-                                            <option value="{{$owner->id}}">{{$owner->name}}</option>
-                                        @endforeach
-                                    </select>
-                                    <input hidden type="submit" value="kk">
-                                </td>
-                                <td > <label class="form-inline" style="width:250px;margin-left: 2%">快递单号:
-                                        <input type="text" name="logistic_number" class="form-control-sm  " v-model="filterData.logistic_number" style="vertical-align: middle"></label></td>
-                                <td > <label  class="form-inline" style="width:250px;margin-left: 2%">发货单号:
-                                        <input type="text" name="delivery_number" class="form-control-sm  " v-model="filterData.delivery_number" style="vertical-align: middle"></label></td>
-                                <td colspan="5"></td>
-                            </tr>
-                            <tr>
-                                <td > <label class="form-inline" >波次号:
-                                        <input type="text" name="batch_number" class="form-control-sm  " v-model="filterData.batch_number" style="vertical-align: middle"></label></td>
-                            </tr>
-                            <tr>
-                                <td>
-                                    <span class="text-muted">操作选定记录:</span>
-                                </td>
-                                <td colspan="9">
-                                    <select @change="storeExport($event)" :class="[checkData>0?'btn-dark':'btn-outline-dark']"  class=" tooltipTarget form-control-sm" style=" vertical-align: middle"
-                                             title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
-                                        <option >导出Excel</option>
-                                        <option value="1">导出勾选内容</option>
-                                        <option value="2">导出所有页</option>
-                                    </select>
-                                    <input hidden type="submit" value="kk">
-                                </td>
-                            </tr>
-                        </table>
-                    </form>--}}
-                </div>
             <div class="">
                 <table class="table table-striped table-sm text-nowrap table-hover">
                     <tr>

+ 1 - 7
resources/views/weight/package/statistics.blade.php

@@ -35,7 +35,7 @@
                                         </div>
 
 
-                                        <div style="max-height: 90px; overflow-y: scroll;border: solid 1px #ddd;border-radius:5px;text-align: center;transform:scale(0.9)"  v-if="ownersCopy.length>0">
+                                        <div style="max-height: 90px; overflow-y: scroll;border: solid 1px #ddd;border-radius:5px;opacity:0.5;text-align: center;transform:scale(0.9)"  v-if="ownersCopy.length>0">
                                             <ul class="list-group tooltipTarget" id="seek" onselectstart="return false;">
                                                 <li  title="单击添加货主"    v-for="ownerCopy in ownersCopy" :id="ownerCopy.name" class="list-group-item list-group-item-action pt-0 pb-0"
                                                      @click="selectedOwner(ownerCopy)" :class="ownerCopy.style ? 'active' :''"><span style="cursor: default;" :id="ownerCopy.name">@{{ ownerCopy.name }}</span></li>
@@ -481,12 +481,6 @@
                         }
                         location.href="{{url('package/statistics?checkSign=')}}"+this.checkData;
                     }else{
-                        /*                        let formData=new FormData();
-                                                formData.append('owner_id',this.selectedOwners);
-                                                formData.append('logistic_id',this.selectedLogistics);
-                                                formData.append('date_start',this.filterData.date_start);
-                                                formData.append('date_end',this.filterData.date_end);
-                                                formData.append('checkSign','-1');*/
                         location.href="{{url('package/statistics?owner_id=')}}"+this.selectedOwners+
                             "&logistic_id="+this.selectedLogistics+"&date_start="+this.filterData.date_start
                             +"&date_end="+this.filterData.date_end+"&checkSign=-1";

+ 12 - 0
routes/web.php

@@ -105,3 +105,15 @@ Route::get('store','StoreController@index');
 Route::resource('store/fast','StoreController');
 Route::resource('store/storeItem','StoreItemsController');
 
+/**
+ * 二次加工单
+ */
+Route::resource('process','ProcessController');
+//获取每日参与人
+Route::post('process/getDailyParticipant','ProcessController@getDailyParticipant');
+//驳回
+Route::post('process/reject/{id}','ProcessController@reject');
+//接单
+Route::post('process/receive/{id}','ProcessController@receive');
+//完成
+Route::post('process/accomplish/{id}','ProcessController@accomplish');