Просмотр исходного кода

项目管理-BUG修复,需求提交
运输管理-新增订单状态
二次加工管理-新增指派人

Zhouzhendong 5 лет назад
Родитель
Сommit
0f1afd88de

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

@@ -3,7 +3,6 @@
 namespace App\Http\Controllers;
 
 use App\Logistic;
-use App\Services\UserService;
 use Exception;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;

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

@@ -4,7 +4,6 @@ namespace App\Http\Controllers;
 
 use App\Logistic;
 use App\LogisticNumberFeature;
-use App\Rejected;
 use App\RejectedBill;
 use Carbon\Carbon;
 use Illuminate\Http\Request;

+ 3 - 3
app/Http/Controllers/PriceModelController.php

@@ -570,9 +570,9 @@ class PriceModelController extends Controller
             'amount_interval.*'=>['required','integer','min:0'],
             'weight_interval.*'=>['array'],
             'weight_interval.*.*'=>['required','numeric','min:0'],
-            'items.*.province_id'=>['sometimes','required'],
-            'items.*.additional_weight_price.*.*'=>['sometimes','required','numeric',"min:0"],
-            'items.*.initial_weight_price.*.*'=>['sometimes','required','numeric',"min:0"],
+            'items.*.province_id'=>['required'],
+            'items.*.additional_weight_price.*.*'=>['required','numeric',"min:0"],
+            'items.*.initial_weight_price.*.*'=>['required','numeric',"min:0"],
         ],[
             'required'=>':attribute 为必填项',
             'unique' => ':attribute 已存在',

+ 23 - 20
app/Http/Controllers/ProcessController.php

@@ -17,6 +17,7 @@ use App\Services\OwnerService;
 use App\Services\ProcessService;
 use App\Sign;
 use App\Tutorial;
+use App\User;
 use App\UserDetail;
 use App\UserDutyCheck;
 use App\UserLabor;
@@ -174,11 +175,13 @@ class ProcessController extends Controller
     }
     //接单
     public function receive($id){
-        if(!Gate::allows('二次加工管理-接单与驳回')){ return redirect(url('/'));  }
-        $process=Process::select('id','status','amount')->find($id);
+        if(!Gate::allows('二次加工管理-接单与驳回')){ return ["success"=>false,"data"=>"无权操作"];  }
+        /** @var Process|\stdClass $process */
+        $process=Process::query()->select('id','status','amount','designate_id')->find($id);
+        if ($process && $process->designate_id && $process->designate_id!=Auth::id())return ["success"=>false,"data"=>"无权操作"];
         $amount=$process->amount;
         $today=Carbon::now()->format('Y-m-d');
-        $processDaily=ProcessDaily::where('date',$today)->where('process_id',$id)->first();
+        $processDaily=ProcessDaily::query()->where('date',$today)->where('process_id',$id)->first();
         if (!$processDaily){
             $processDaily=new ProcessDaily([
                 'process_id'=>$id,
@@ -191,8 +194,7 @@ class ProcessController extends Controller
         $process->status="待加工";
         $process->update();
         $process->createOperatorLog('接单');
-        app('LogService')->log(__METHOD__,"接单二次加工单_".__FUNCTION__,json_encode($process),Auth::user()['id']);
-        return $process;
+        return ["success"=>true,"data"=>$process->status];
     }
     //完成
     public function accomplish(Request $request){
@@ -513,14 +515,21 @@ class ProcessController extends Controller
      */
     public function create()
     {
-        if(!Gate::allows('二次加工管理-录入')){ return redirect(url('/'));  }
-        $processMethods=ProcessMethod::get();
-        return view('process/create',['processMethods'=>$processMethods,'process'=>null]);
+        if(!Gate::allows('二次加工管理-录入')){ return view("exception.authority");  }
+        $processMethods=ProcessMethod::query()->get();
+        $users = User::query()->whereNotNull("email")->whereHas("roles",function ($query){
+            /** @var Builder $query */
+            $query->whereHas("authorities",function($query){
+                /** @var Builder $query */
+                $query->where("alias_name","二次加工管理-接单与驳回");
+            });
+        })->orWhereIn("name",config("users.superAdmin"))->get();
+        return view('process/create',['processMethods'=>$processMethods,'process'=>null,"users"=>$users]);
     }
 
     //货主ID获取教程
     public function ownerGetTutorials($owner_id){
-        $tutorials=Tutorial::where('owner_id',$owner_id)->get();
+        $tutorials=Tutorial::query()->where('owner_id',$owner_id)->get();
         return $tutorials;
     }
 
@@ -544,6 +553,7 @@ class ProcessController extends Controller
             'remark'=>$request->input('remark'),
             'balance_remark'=>$request->input('balance_remark'),
             'amount'=>$request->input('amount'),
+            'designate_id'=>$request->input('designate_id'),
             'status'=>'待审核',
         ]);
         $process->save();
@@ -645,11 +655,7 @@ class ProcessController extends Controller
             DB::beginTransaction();
             if ($signUnitPrice){
                 $process->update(['unit_price' => $signUnitPrice->mark]);
-                $result = $this->statistic($process);
-//                if (!$result['success']){
-//                    DB::rollBack();
-//                    return $result['data'];
-//                }
+                $this->statistic($process);
             }
             $process->createSign('财务确认');
             $process->destroySign();
@@ -661,11 +667,7 @@ class ProcessController extends Controller
             DB::beginTransaction();
             if ($signUnitPrice){
                 $process->update(['unit_price' => $signUnitPrice->mark]);
-                $result = $this->statistic($process);
-//                if (!$result['success']){
-//                    DB::rollBack();
-//                    return $result['data'];
-//                }
+                $this->statistic($process);
             }
             $process->createSign('二次加工组确认');
             $process->destroySign();
@@ -679,7 +681,7 @@ class ProcessController extends Controller
     //审核
     function audit(Request $request){
         if(!Gate::allows('二次加工管理-审核')){ return ['success'=>false,'data'=>'您无权进行该操作!'];  }
-        $process=Process::find($request->id);
+        $process=Process::query()->find($request->id);
         if (!$process)return ['success'=>false];
         $process->update(['status'=>'待接单']);
         $process->createOperatorLog('审核');
@@ -741,6 +743,7 @@ class ProcessController extends Controller
             $process->remark=$request->input('remark');
             $process->balance_remark=$request->input('balance_remark');
             $process->amount=$request->input('amount');
+            $process->designate_id=$request->input('designate_id');
             if ($process->status=='已驳回')$process->status='待接单';
             $process->update();
             $process->createOperatorLog('编辑');

+ 35 - 19
app/Http/Controllers/ProcessStatisticController.php

@@ -3,6 +3,7 @@
 namespace App\Http\Controllers;
 
 use App\Process;
+use App\Services\common\ExportService;
 use App\Services\ProcessStatisticService;
 use Exception;
 use Illuminate\Http\Request;
@@ -20,29 +21,44 @@ class ProcessStatisticController extends Controller
         return view('process.statistic',['processStatistics'=>$processStatistics,'params'=>$request->input(),'owners'=>$owners,'processMethods'=>$processMethods]);
     }
 
-    public function export(Request $request){
+    public function export(){
         if(!Gate::allows('二次加工管理-查询')){ return '没有权限';  }
-        if ($request->checkAllSign){
-            $params = $request->input();
-            unset($params['checkAllSign']);
-            $sql = app('ProcessStatisticService')->getSql($params);
-        }else $sql = app('ProcessStatisticService')->getSql(["process_id"=>$request->data]);
+        if (request("checkAllSign")){
+            \request()->offsetUnset("checkAllSign");
+            $processes = app('ProcessStatisticService')->get(\request()->input());
+        }else $processes = app('ProcessStatisticService')->get(["process_id"=>\request("data")]);
 
-        $row = ["任务号", "货主", "开始日期", "完成日期","创建日期", "单价", "预期数量", "完成数量", "收入合计",
+        $row = ["任务号","接单人", "货主", "开始日期", "完成日期","创建日期", "单价", "预期数量", "完成数量", "收入合计",
             "完成时间(天)'", "总工时", "加工类型", "最高日产能", "最低日产能", "日均产能", "合计成本", "毛利润",
             "毛利率", "状态","加工备注","结算备注"];
-        $column = ["process_code", "owner_name", "started_at", "ended_at","process_created_at", "process_unit_price", "process_amount", "process_completed_amount", "revenue",
-		"duration_days", "duration_man_hours", "process_method_name", "top_capacity", "bottom_capacity",
-		"average_capacity", "total_cost", "gross_profit", "gross_profit_rate", "process_status", "process_remark", "process_balance_remark"];
-        $rule = ["gross_profit_rate"=> "percent", "started_at"=>"mysqlDate", "ended_at"=>"mysqlDate", "process_created_at"=>"mysqlDate"];
-        $post = Http::post(config('go.export.url'),['type'=>'unify','sql'=>$sql, 'connection'=>'mysql',
-            'row'=>json_encode($row,JSON_UNESCAPED_UNICODE), 'column'=>json_encode($column), 'rule'=>json_encode($rule)]);
-        if ($post->status() == 500){
-            throw new Exception($post->header("Msg"));
+        $list = [];
+
+        foreach ($processes as $process){
+            $list[] = [
+                $process->process->code ?? "",
+                $process->operatorLog->user->name ?? "",
+                $process->process->owner->name ?? "",
+                $process->started_at,
+                $process->ended_at,
+                $process->process->created_at ?? "",
+                $process->process->unit_price ?? "",
+                $process->process->amount ?? "",
+                $process->process->completed_amount ?? "",
+                $process->revenue,
+                $process->duration_days,
+                $process->duration_man_hours,
+                $process->process->method->name ?? "",
+                $process->top_capacity,
+                $process->bottom_capacity,
+                $process->average_capacity,
+                $process->total_cost,
+                $process->gross_profit,
+                ($process->gross_profit_rate*100)."%",
+                $process->process->status ?? "",
+                $process->process->remark ?? "",
+                $process->process->balance_remark ?? "",
+            ];
         }
-        return response($post,200, [
-            "Content-type"=>"application/octet-stream",
-            "Content-Disposition"=>"attachment; filename=二次加工统计记录-".date('ymdHis').'.xlsx',
-        ]);
+        return app(ExportService::class)->json($row,$list,"二次加工统计记录");
     }
 }

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

@@ -148,8 +148,13 @@ class TestController extends Controller
 
     public function tt1()
     {
-        $a = [[111],[222]];
-        dump(reset($a),$a);
+        dd(array_column(User::query()->whereNotNull("email")->whereHas("roles",function ($query){
+            /** @var Builder $query */
+            $query->whereHas("authorities",function($query){
+                /** @var Builder $query */
+                $query->where("alias_name","二次加工管理-接单与驳回");
+            });
+        })->orWhereIn("name",config("users.superAdmin"))->get()->toArray(),"id"));
 
     }
 

+ 0 - 1
app/Http/Controllers/api/thirdPart/jianshang/RejectedController.php

@@ -9,7 +9,6 @@ use App\Logistic;
 use App\QualityLabel;
 use App\RejectedBill;
 use App\RejectedBillItem;
-use Carbon\Carbon;
 use Illuminate\Http\Request;
 use Illuminate\Support\Collection;
 use Illuminate\Support\Facades\Auth;

+ 5 - 7
app/Http/Controllers/api/thirdPart/weight/PackageController.php

@@ -298,8 +298,10 @@ class PackageController extends Controller
         }
         if(!empty($package->order))
             Waybill::setWeightByOrderCode($package->order->code,$package->weight);
-        event(new WeighedEvent($package));
-        dispatch(new WeightUpdateInstantBill($package));
+        if ($package){
+            event(new WeighedEvent($package));
+            dispatch(new WeightUpdateInstantBill($package));
+        }
         $response=["msg"=>"保存成功",
             "code"=>200,
             "data"=>true,
@@ -316,11 +318,7 @@ class PackageController extends Controller
 
     public function validatorWeight(array $request){
         $validator=Validator::make($request,[
-            'id'=>['nullable','max:30',/*function ($attribute, $value, $fail) {
-                $measuringMachine=MeasuringMachine::where('code',$value)->first();
-                if (!$measuringMachine) {
-                    $fail($attribute.' 设备未录入在系统中!');
-            }}*/],
+            'id'=>['nullable','max:30'],
             'barcode'=>['required','max:191'],
             'weight'=>['required','numeric','min:0'],
             'length'=>['nullable','numeric','min:0'],

+ 1 - 1
app/Imports/ExpressImport.php

@@ -26,7 +26,7 @@ class ExpressImport implements WithMultipleSheets,ToArray
     /** @var OwnerPriceExpress|\stdClass $express */
     protected $express;
     /** @var array $errors */
-    private $errors;
+    private $errors = [];
 
     public function __construct(OwnerPriceExpress $express = null)
     {

+ 0 - 2
app/Imports/WaybillPriceModelsImport.php

@@ -4,9 +4,7 @@ namespace App\Imports;
 
 use App\Logistic;
 use App\WaybillPriceModel;
-use App\City;
 use App\Events\WaybillPriceModelEvent;
-use App\Province;
 use App\Unit;
 use Illuminate\Support\Collection;
 use Illuminate\Support\Facades\Cache;

+ 1 - 1
app/Jobs/WeightUpdateInstantBill.php

@@ -12,7 +12,7 @@ use Illuminate\Queue\SerializesModels;
 
 class WeightUpdateInstantBill implements ShouldQueue
 {
-    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
+    use SerializesModels;
 
     /** @var \stdClass  */
     protected $package;

+ 1 - 1
app/Process.php

@@ -16,7 +16,7 @@ class Process extends Model
     use ModelTimeFormat;
     use SoftDeletes;
     protected $fillable=[
-        'code','owner_id','process_method_id','unit_price','status','remark','balance_remark','amount','completed_amount','created_at','updated_at','deleted_at'
+        'code','owner_id','process_method_id','unit_price','status','remark','balance_remark','amount','completed_amount','created_at','updated_at','deleted_at',"designate_id"
     ];
     protected $appends=[
         'owner_name','process_method_name',

+ 1 - 5
app/ProcessStatistic.php

@@ -28,10 +28,6 @@ class ProcessStatistic extends Model
 
     public function operatorLog(){
         return $this->hasOne('App\OperatorLog','operator_logable_id','process_id')
-            ->where('operator_logable_type','processes');
+            ->where('operator_logable_type','processes')->where("operation",'接单');
     }
-    /*public function operatorLogSubmit(){
-        return $this->hasOne('App\OperatorLog','operator_logable_id','process_id')
-            ->where('operator_logable_type','processes')->where('operation','质量验收');
-    }*/
 }

+ 1 - 1
app/Services/FeatureService.php

@@ -322,7 +322,7 @@ class FeatureService
             return 'false';
         };
         array_splice($column,0,1);
-        $this->getMatchBool($feature, $value, $column);
+        return $this->getMatchBool($feature, $value, $column);
     }
 
 }

+ 3 - 2
app/Services/OrderService.php

@@ -1266,18 +1266,19 @@ sql
             $weight += $package->weight;
 
             $provinceName = mb_substr($order->province,0,2);
+            $fee = null;
             if ($provinceName){
                 $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);
             }
 
-            $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,
+                "logistic_fee" => $fee,
             ]);
             if ($logistic_fee!==null){
                 if ($fee<0)$logistic_fee = null;

+ 2 - 2
app/Services/OwnerPriceExpressService.php

@@ -263,11 +263,11 @@ sql
         if ($model->amount_interval){
             $total = app("OrderService")->getOrderQuantity($owner_id);//获取该货主本月C端单量
             for ($i=count($model->amount_interval);$i<0;$i--){
-                if ($total>=$model->amount_interval[$i])$to1 = $i;
+                if ($total>=$model->amount_interval[$i]){$to1 = $i;break;}
             }
             if (isset($to1) && isset($model->weight_interval[$to1])){
                 for ($i=count($model->weight_interval[$to1]);$i<0;$i--){
-                    if ($weight>=$model->weight_interval[$to1][$i])$to2 = $i;
+                    if ($weight>=$model->weight_interval[$to1][$i]){$to2 = $i;break;}
                 }
             }
         }

+ 6 - 2
app/Services/OwnerPriceOperationService.php

@@ -215,6 +215,7 @@ class OwnerPriceOperationService
                 })->orderByRaw("strategy desc,priority desc");
 
                 if ($typeMark!==null)$query->where("type_mark",$typeMark);
+                else $query->whereNull("type_mark");
 
                 return $query->get();
         });
@@ -368,7 +369,9 @@ class OwnerPriceOperationService
             $columnMapping[$index] = ltrim(strstr($columnMapping[$index],"."),".");
         }
         $nextObj = strstr($columnMapping[8],".",true);
-        $first = reset($matchObject[$need]) ?? false;
+        $first = $matchObject[$need] ?? false;
+        if ($first && is_array($first))$first = reset($first);
+        else return $matchObject;
         if (!$first)return $matchObject;
         if (is_array($first[$nextObj])){
             $result = [];
@@ -392,7 +395,8 @@ class OwnerPriceOperationService
      */
     private function matchItem($rules, $columnMapping, $matchObject, $units, $ownerId, $result)
     {
-        $matchObject = $this->resetChildNodeMapping($matchObject,$columnMapping);
+        /** @var Collection $matchObject */
+        $matchObject = $this->resetChildNodeMapping($matchObject->toArray(),$columnMapping);
         if (!$matchObject)return -1;
 
         $unitName = "";

+ 1 - 1
app/Services/ProcessService.php

@@ -18,7 +18,7 @@ class ProcessService
      * @return Builder
      */
     private function conditionQuery(array $params){
-        $processes=Process::filterAuthorities()->with(['owner','processMethod','tutorials'=>function($query){$query->with('owner');},'signs','operatorLogs'=>function($query){$query->with('user');},
+        $processes=Process::filterAuthorities()->with(['owner','processMethod','tutorials.owner','signs','operatorLogs.user',
             'signUnitPrice','processesContents'=>function($query){
             return $query->with(['signCommodityName','signCommoditySku','signCommodityBarcode','commodity'=>function($query){
                 return $query->with('barcodes');

+ 4 - 10
app/Services/ProcessStatisticService.php

@@ -13,7 +13,7 @@ class ProcessStatisticService
     use ServiceAppAop;
     protected $modelClass=ProcessStatistic::class;
     private function conditionQuery(array $params){
-        $query = ProcessStatistic::with(['process'/*,'operatorLogSubmit'*/])->orderBy('process_statistics.process_id','DESC')
+        $query = ProcessStatistic::with(['process.owner','operatorLog.user'])->orderBy('process_statistics.process_id','DESC')
             ->has('process');
         if ($params["owner_id"] ?? false){
             $owner_id=$params["owner_id"];
@@ -56,15 +56,9 @@ class ProcessStatisticService
         return $this->conditionQuery($params)->paginate($params["paginate"] ?? 50);
     }
 
-    public function getSql(array $params){
-        return $this->conditionQuery($params)->selectRaw('process_statistics.*')
-            ->leftJoin('processes','process_statistics.process_id','processes.id')
-                ->selectRaw('processes.created_at process_created_at,processes.code process_code,processes.unit_price process_unit_price,processes.amount process_amount,processes.completed_amount process_completed_amount,processes.status process_status,processes.remark process_remark,processes.balance_remark process_balance_remark')
-            ->leftJoin('owners','processes.owner_id','owners.id')
-                ->selectRaw('owners.name owner_name')
-            ->leftJoin('process_methods','processes.process_method_id','process_methods.id')
-                ->selectRaw('process_methods.name process_method_name')
-            ->sql();
+    public function get(array $params)
+    {
+        return $this->conditionQuery($params)->get();
     }
 
 }

+ 32 - 0
database/migrations/2021_03_24_131737_change_table_process_add_column_designate_id.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeTableProcessAddColumnDesignateId extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('processes', function (Blueprint $table) {
+            $table->bigInteger("designate_id")->nullable()->index()->comment("指派人");
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('processes', function (Blueprint $table) {
+            $table->dropColumn("designate_id");
+        });
+    }
+}

+ 17 - 4
resources/views/customer/project/create.blade.php

@@ -261,7 +261,7 @@
                     if (!this.owner.id)return;
                     if (base === this.base)return;
                     if (base === 'three') this._loadStorage();
-                    if (base === 'two')this._getTaxRates()
+                    if (base === 'two')this._getTaxRates();
                     this.base = base;
                 },
                 //切换类型
@@ -307,7 +307,7 @@
                     switch (this.base) {
                         case "one":
                             this._verifyOne(()=>{
-                                this.base = "two";
+                                this.switchBase('two');
                             });
                             break;
                         case "two":
@@ -812,8 +812,21 @@
                     if (this.model.express.items.length>0){
                         this.model.express.items.forEach((item,index)=>{
                             if (!item.province_id)error["item."+index+".province_id"] = ["不存在"];
-                            if (!item.initial_weight_price)error["item."+index+".initial_weight_price"] = ["不存在"];
-                            if (!item.additional_weight_price)error["item."+index+".additional_weight_price"] = ["不存在"];
+                            if (!this.model.express.isInterval){
+                                if (!item.initial_weight_price[0][0])error["item."+index+".initial_weight_price.0.0"] = ["不存在"];
+                                if (!item.additional_weight_price[0][0])error["item."+index+".additional_weight_price.0.0"] = ["不存在"];
+                            }else{
+                                item.initial_weight_price.forEach((arr,i)=>{
+                                    arr.forEach((price,j)=>{
+                                        if (!price)error["item."+index+".additional_weight_price."+i+"."+j] = ["不存在"];
+                                    });
+                                });
+                                item.additional_weight_price.forEach((arr,i)=>{
+                                    arr.forEach((price,j)=>{
+                                        if (!price)error["item."+index+".additional_weight_price."+i+"."+j] = ["不存在"];
+                                    });
+                                });
+                            }
                         });
                     }
                     if (this.model.express.isInterval){

+ 11 - 3
resources/views/customer/project/part/_three.blade.php

@@ -18,7 +18,7 @@
                         <th>计费类型</th>
                         <th>用仓类型</th>
                         <th>起租面积</th>
-                        <th>单价</th>
+                        <th class="text-center">单价</th>
                         <th>单位</th>
                         <th>计时单位</th>
                         <th>减免类型</th>
@@ -30,7 +30,15 @@
                         <td>@{{ item.counting_type }}</td>
                         <td>@{{ item.using_type }}</td>
                         <td>@{{ item.minimum_area }}</td>
-                        <td>@{{ item.price }}</td>
+                        <td>
+                            <div v-if="item.amount_interval">
+                                <div v-for="(amount,i) in item.amount_interval" class="row text-nowrap">
+                                    <b class="col-4 offset-1 m-0">@{{ item.price[i] }}</b>
+                                    <label class="col-7 m-0">(@{{ item.amount_interval[i+1] ? amount+'-'+item.amount_interval[i+1] : amount+" +" }}单)</label>
+                                </div>
+                            </div>
+                            <div v-else><b>@{{ item.price[0] }}</b></div>
+                        </td>
                         <td>@{{ poolMapping.units ? poolMapping.units[item.unit_id] : '' }}</td>
                         <td>@{{ poolMapping.units ? poolMapping.units[item.time_unit_id] : '' }}</td>
                         <td>@{{ item.discount_type }}</td>
@@ -48,7 +56,7 @@
                         @can("项目管理-项目-计费模型-审核")<button class="btn btn-sm btn-success" type="button" @click="auditOrRecoverModel('operation')">审核</button>
                         <button class="btn btn-sm btn-danger" type="button" @click="auditOrRecoverModel('operation',false)">恢复</button>@endcan
                     </div>
-                </div>
+                </div>  
                 <div class="col-3 pull-right small mb-0 text-secondary" v-if="selectedModel.operation.length>0">双击下方已添加内容可编辑</div>
             </div>
             <div class="card-body" id="operation">

+ 21 - 17
resources/views/process/create.blade.php

@@ -269,6 +269,13 @@
                         <strong>@{{ error.unit_price[0] }}</strong>
                     </span>
                 </div>
+                <div class="form-group row">
+                    <label for="designate_id" class="col-3 col-form-label text-right">指定接单人</label>
+                    <select id="designate_id" class="form-control col-5" v-model="process.designate_id">
+                        <option v-for="user in users" :value="user.id">@{{ user.name }}</option>
+                    </select>
+                    <label class="col-3"><input class="text form-control rounded-pill" placeholder="搜索人员" @input="seekUser($event)"></label>
+                </div>
                 <div class="form-group row">
                     <label class="col-3 col-form-label text-right" >加工备注(选填)</label>
                     <textarea :readonly="is_hide" v-model="process.remark" type="text" class="form-control col-8"></textarea>
@@ -277,20 +284,6 @@
                     <label class="col-3 col-form-label text-right" >结算备注(选填)</label>
                     <textarea :readonly="is_hide" v-model="process.balance_remark" type="text" class="form-control col-8"></textarea>
                 </div>
-                {{--<div class="form-group row">
-                    <label class="col-3 col-form-label text-right" >引用教程(选填)</label>
-                    <span class=" col-8 input-group p-0" style="max-height: 150px; overflow-y: scroll;border-radius:5px;opacity:0.7;text-align: center;">
-                        <ul class="list-group" style="width: 100%" onselectstart="return false;">
-                            <li v-for="tutorial in tutorials" :data-original-title="tutorial.style ? '双击删除教程' :'双击添加教程'"  :id="tutorial.id" class="tooltipTarget list-group-item list-group-item-action p-0 m-0"
-                                @dblclick="selectedTutorial(tutorial)" :class="tutorial.style ? 'active' :''" style="cursor: default;">
-                                @{{ tutorial.name }}</li>
-                        </ul>
-                        <div class="mt-0 form-inline" v-if="processContents.length>0">
-                            <button type="button" @click="addTutorial()"  class="btn btn-sm btn-outline-primary">新增教程</button>
-                            <button type="button" @click="refreshTutorial()" class="btn btn-sm btn-outline-secondary ml-2">刷新</button>
-                        </div>
-                    </span>
-                </div>--}}
                 <div class="form-group row">
                     <div class="col-8 offset-3 p-0">
                         <input type="button" @click="submit()" class="btn btn-success form-control" value="提交">
@@ -312,7 +305,7 @@
                     process_method_id:'{{old('process_method_id')??($process->process_method_id??'')}}',
                     unit_price:'{{old('unit_price')??($process->unit_price??'')}}',remark:'{{preg_replace("/\s/",' ',old('remark')??($process->remark??''))}}',
                     balance_remark:'{{preg_replace("/\s/",' ',old('remark')??($process->balance_remark??''))}}',
-                    wms_code_full:'',status:'{{$process->status??''}}'},
+                    wms_code_full:'',status:'{{$process->status??''}}',designate_id:"{{old('designate_id') ?? ($process->designate_id ?? '')}}"},
                 error:{wms_code:[],owner_id:[],process_method_id:[],unit_price:[],amount:[]},
                 processContents:[
                     @if($process)
@@ -331,7 +324,7 @@
                     {!! $processMethod !!},
                     @endforeach
                 ],
-                //tutorials:[],
+                users:[@foreach($users as $user) @json($user), @endforeach],
                 selectedTutorials:[],
                 msg:false,
                 commodityIds:[],
@@ -348,7 +341,6 @@
                     handler(){
                         if (this.processContents.length===1 && this.processContents[(this.processContents.length)-1].owner_id){
                             this.process.owner_id=this.processContents[(this.processContents.length)-1].owner_id;
-                            //this.getTutorial(this.processContents[(this.processContents.length)-1].owner_id);
                         }
                     }
                 },
@@ -368,6 +360,18 @@
                 }
             },
             methods:{
+                //搜索人员
+                seekUser(e){
+                    e.stopPropagation();
+                    let val = e.target.value;
+                    if (!val) this.process.designate_id = "";
+                    if (this.users.every(user=>{
+                        if (user.name.indexOf(val)!==-1){
+                            this.process.designate_id = user.id;
+                            return false;
+                        }return true;
+                    }))this.process.designate_id = "";
+                },
                 //添加标记商品
                 _addSignCommodity(wms_code,commodity_id,is_finished_product){
                     this.commodityIds.push(wms_code+"_"+commodity_id+"_"+is_finished_product);

+ 9 - 23
resources/views/process/index.blade.php

@@ -181,7 +181,7 @@
                     <button v-if="!processOne.openProcessHour && processOne.status=='待验收'" class="btn btn-sm btn-outline-success" @click="checkAndAccept(processOne)" @mouseenter="processOne.buttonTexts.质量验收='质量验收'" @mouseleave="processOne.buttonTexts.质量验收='验'">@{{processOne.buttonTexts.质量验收}}</button>@endcan
                     @can("二次加工管理-接单与驳回")
                     <button v-if="!processOne.openProcessHour && processOne.status=='待接单'" @click="processReject(processOne.id)" class="btn btn-sm btn-outline-dark" @mouseenter="processOne.buttonTexts.驳回='驳回'" @mouseleave="processOne.buttonTexts.驳回='驳'">@{{processOne.buttonTexts.驳回}}</button>
-                    <button v-if="!processOne.openProcessHour && processOne.status=='待接单'"  @click="processReceive(processOne.id)" class="btn btn-sm btn-outline-primary" @mouseenter="processOne.buttonTexts.接单='接单'" @mouseleave="processOne.buttonTexts.接单='接'">@{{processOne.buttonTexts.接单}}</button>@endcan
+                    <button v-if="(!processOne.openProcessHour && processOne.status=='待接单') && ((!processOne.designate_id) || processOne.designate_id==userId)"  @click="processReceive(processOne.id,i)" class="btn btn-sm btn-outline-primary" @mouseenter="processOne.buttonTexts.接单='接单'" @mouseleave="processOne.buttonTexts.接单='接'">@{{processOne.buttonTexts.接单}}</button>@endcan
                     @can("二次加工管理-登记工时")<button :style="[{opacity:processOne.status=='交接完成'?'0.7':''},{transform:processOne.status=='交接完成'?'scale(0.85)':''}]" v-if="(processOne.status!='待审核' && processOne.status!='已驳回' && processOne.status!='待接单') && !processOne.openProcessHour"
                             class="btn btn-sm btn-outline-info" @click="openProcessHour(processOne);processOne.openProcessHour=true;processOne.detailFolding=false" @mouseenter="processOne.buttonTexts.登记工时='登记工时'" @mouseleave="processOne.buttonTexts.登记工时='登'">@{{processOne.buttonTexts.登记工时}}</button>
                     <button v-if="processOne.openProcessHour" @click="closeProcessHour(processOne.id);processOne.openProcessHour=false" class="btn btn-sm btn-dark">收起登记工时</button>
@@ -477,12 +477,13 @@
                         ,tutorials:{!! $processOne->tutorials !!},processesContents:{!! $processOne->processesContents !!},unit_price:'{{$processOne->unit_price}}',created_at:'{{$processOne->created_at}}',
                         completed_amount:'{{$processOne->completed_amount}}',status:'{{$processOne->status}}',remark:'{{preg_replace("/\s/",' ',$processOne->remark)}}',
                         balance_remark:'{{preg_replace("/\s/",' ',$processOne->balance_remark)}}',
-
+                        designate_id:"{{$processOne->designate_id}}",
                         detailFolding:false,openProcessHour:false,is_multi_row:false,is_verifier_show:false,is_update_unit_price:false,
                         buttonTexts:{'审核':'审','回滚':'回','编辑':'编','接单':'接','驳回':'驳','质量验收':'验','完成':'完','交接完成':'交','查看单据':'查','登记工时':'登'},
                     },
                     @endforeach
                 ],
+                userId:"{{\Illuminate\Support\Facades\Auth::id()}}",
                 processesList:[],
                 owners:[
                         @foreach($owners as $owner)
@@ -849,31 +850,16 @@
                     })
                 },
                 //接单
-                processReceive(id) {
+                processReceive(id,index) {
                     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;
-                            });
-                            tempTip.setDuration(3000);
-                            tempTip.showSuccess('接单成功!');
-                        }).catch(function (err) {
-                        tempTip.setDuration(5000);
-                        tempTip.show('接单时发生了一些严重错误:' + err);
-                    })
+                    window.tempTip.postBasicRequest(url,{},res=>{
+                        this.processes[index].status = res;
+                        return "接单成功";
+                    });
                 },
                 //完成
                 processAccomplish(process) {
-                    if (!confirm('确定标记为加工完成吗?')) {
-                        return
-                    }
-                    ;
+                    if (!confirm('确定标记为加工完成吗?'))return
                     axios.post('{{url('process/processAccomplish')}}', {id: process.id})
                         .then(function (response) {
                             if (response.data.success) {

+ 2 - 0
resources/views/process/statistic.blade.php

@@ -27,6 +27,7 @@
                 </th>
                 <th>序号</th>
                 <th>任务号</th>
+                <th>接单人</th>
                 <th>货主</th>
                 <th>开始日期</th>
                 <th>完成日期</th>
@@ -52,6 +53,7 @@
                 <td><input class="checkItem" type="checkbox" :value="processStatistic.process_id" v-model="checkData"></td>
                 <td>@{{ i+1 }}</td>
                 <td><span v-if="processStatistic.process">@{{ processStatistic.process.code }}</span></td>
+                <td><span v-if="processStatistic.operatorLog && processStatistic.operatorLog.user">@{{ processStatistic.operatorLog.user.name }}</span></td>
                 <td><span v-if="processStatistic.process">@{{ processStatistic.process.owner_name }}</span></td>
                 <td>@{{ processStatistic.started_at }}</td>
                 <td>@{{ processStatistic.ended_at }}</td>

+ 4 - 1
resources/views/waybill/index.blade.php

@@ -53,7 +53,7 @@
             <table class="table table-striped table-sm table-bordered table-hover text-nowrap waybill-table" style="background: #fff;" id="headerParent">
                 <tr>
                     <th class="table-header-layer-1" colspan="4"></th>
-                    <th class="table-header-layer-1" colspan="11"><span class="fa fa-file-text-o"></span> 运单信息</th>
+                    <th class="table-header-layer-1" colspan="13"><span class="fa fa-file-text-o"></span> 运单信息</th>
                     <th class="table-header-layer-1" colspan="16"><span class="fa fa-truck"></span> 运输信息</th>
                     <th class="table-header-layer-1" colspan="5"><span class="fa fa-rmb"></span> 费用信息
                     @can('运输管理-删除')
@@ -131,6 +131,7 @@
                         <span class="badge badge-pill badge-danger" v-if="waybill.is_cancel">取消</span>
                         @{{waybill.wms_bill_number}}
                     </td>
+                    <td class="td-warm">@{{ waybill.order_status }}</td>
                     <td class="td-warm">@{{waybill.waybill_number}}</td>
                     @can('运输管理-运单编辑')
                     <td class="td-warm" >
@@ -350,6 +351,7 @@
                         province:'{{$waybill->order_province ?? ($waybill->destinationCity->parent->name ?? '')}}',
                         city:'{{$waybill->order_city ?? ($waybill->destinationCity->name ?? '')}}',
                         district:'{{$waybill->order_district ?? ($waybill->district->name ?? '')}}',
+                        order_status:'{{$waybill->order->wms_status ?? ''}}',
                     },
                     @endforeach
                 ],
@@ -452,6 +454,7 @@
                     {name:'owner',value: '货主', class:"td-warm"},
                     {name:'source_bill',value: '上游单号', class:"td-warm"},
                     {name:'wms_bill_number',value: 'WMS订单号', class:"td-warm"},
+                    {name:'order_status',value: '订单状态', class:"td-warm"},
                     {name:'waybill_number',value: '运单号', class:"td-warm"},
                     {name:'charge',value: '运输收费', neglect: true, class:"td-warm"},
                     {name:'other_charge',value: '其他收费', neglect: true, class:"td-warm"},