Zhouzhendong 6 éve
szülő
commit
aa3d36805c
100 módosított fájl, 3259 hozzáadás és 2633 törlés
  1. 0 1
      app/BillingModel.php
  2. 0 1
      app/Carrier.php
  3. 6 2
      app/Commodity.php
  4. 1 1
      app/CommodityBarcode.php
  5. 1 1
      app/Events/InformWMSReceivedEvent.php
  6. 11 6
      app/Exceptions/Handler.php
  7. 47 28
      app/Http/Controllers/AuthorityController.php
  8. 16 4
      app/Http/Controllers/PackageController.php
  9. 0 1
      app/Http/Controllers/PaperBoxController.php
  10. 761 85
      app/Http/Controllers/ProcessController.php
  11. 124 0
      app/Http/Controllers/ProcessStatisticController.php
  12. 22 0
      app/Http/Controllers/RejectedBillController.php
  13. 24 23
      app/Http/Controllers/RejectedBillItemController.php
  14. 3 3
      app/Http/Controllers/RejectedController.php
  15. 30 37
      app/Http/Controllers/TestController.php
  16. 143 0
      app/Http/Controllers/TutorialController.php
  17. 152 0
      app/Http/Controllers/UserDutyCheckController.php
  18. 175 0
      app/Http/Controllers/UserLaborController.php
  19. 85 0
      app/Http/Controllers/WMSWaybillController.php
  20. 85 0
      app/Http/Controllers/WMSWaybillOrderController.php
  21. 92 49
      app/Http/Controllers/WaybillsController.php
  22. 27 16
      app/Http/Controllers/api/thirdPart/flux/PackageController.php
  23. 225 0
      app/Http/Controllers/api/thirdPart/flux/ProcessController.php
  24. 27 23
      app/Http/Controllers/api/thirdPart/flux/ReceiveController.php
  25. 100 0
      app/Http/Controllers/api/thirdPart/flux/WaybillController.php
  26. 11 10
      app/Http/Controllers/api/thirdPart/jianshang/RejectedController.php
  27. 1 1
      app/Jobs/ProcessReceiveCombinedJob.php
  28. 34 14
      app/Listeners/InformWMSReceivedListener.php
  29. 13 12
      app/Listeners/WmsReceiveNewListener.php
  30. 15 0
      app/OracleBasSKU.php
  31. 11 0
      app/OracleDOCASNDetail.php
  32. 11 0
      app/OracleDOCMovementDetail.php
  33. 12 0
      app/OracleDOCMovementHeader.php
  34. 11 0
      app/OracleDOCOrderDetail.php
  35. 8 14
      app/Process.php
  36. 10 2
      app/ProcessDaily.php
  37. 14 6
      app/ProcessDailyParticipant.php
  38. 5 0
      app/ProcessStatistic.php
  39. 0 16
      app/ProcessesAdditionalBill.php
  40. 27 0
      app/ProcessesContent.php
  41. 9 0
      app/RejectedBill.php
  42. 16 2
      app/Tutorial.php
  43. 12 0
      app/TutorialContent.php
  44. 12 3
      app/UserDetail.php
  45. 4 9
      app/UserDutyCheck.php
  46. 3 9
      app/UserLabor.php
  47. 13 0
      app/WMSWaybill.php
  48. 11 0
      app/WMSWaybillOrder.php
  49. 226 0
      bootstrap/cache/services.php
  50. 172 558
      composer.lock
  51. 0 151
      config/UEditorUpload.php
  52. 4 0
      config/api.php
  53. 1 1
      config/app.php
  54. 12 0
      config/database.php
  55. 7 0
      config/hr.php
  56. 9 0
      config/laravel-trix.php
  57. 1 1
      config/session.php
  58. 12 0
      database/factories/WMSWaybillFactory.php
  59. 12 0
      database/factories/WMSWaybillOrderFactory.php
  60. 10 0
      database/migrations/2019_11_22_094253_create_cities_table.php
  61. 1 1
      database/migrations/2020_03_05_080123_add_weigh_excepted_authority.php
  62. 1 1
      database/migrations/2020_03_25_164138_create_process_statistics_table.php
  63. 1 1
      database/migrations/2020_03_25_164242_create_process_dailies_table.php
  64. 1 1
      database/migrations/2020_03_25_164322_create_user_duty_checks_table.php
  65. 1 1
      database/migrations/2020_03_25_164409_create_user_details_table.php
  66. 1 1
      database/migrations/2020_03_30_103931_create_commodity_barcodes_table.php
  67. 32 0
      database/migrations/2020_04_02_114453_change_process_daily_participant_table.php
  68. 41 0
      database/migrations/2020_04_03_150439_change_process_table.php
  69. 45 0
      database/migrations/2020_04_03_150514_change_process_contents_table.php
  70. 46 0
      database/migrations/2020_04_07_160948_create_trix_rich_texts_table.php
  71. 44 0
      database/migrations/2020_04_09_111337_add_tutorial_authority.php
  72. 38 0
      database/migrations/2020_04_09_111540_change_tutorial_table.php
  73. 39 0
      database/migrations/2020_04_28_141248_create_w_m_s_waybills_table.php
  74. 39 0
      database/migrations/2020_04_28_141405_create_w_m_s_waybill_orders_table.php
  75. BIN
      public/audio.mp3
  76. 5 0
      public/css/app.css
  77. 38 2
      public/js/app.js
  78. 0 40
      public/laravel-u-editor/dialogs/anchor/anchor.html
  79. 0 681
      public/laravel-u-editor/dialogs/attachment/attachment.css
  80. 0 60
      public/laravel-u-editor/dialogs/attachment/attachment.html
  81. 0 754
      public/laravel-u-editor/dialogs/attachment/attachment.js
  82. BIN
      public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_chm.gif
  83. BIN
      public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_default.png
  84. BIN
      public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_doc.gif
  85. BIN
      public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_exe.gif
  86. BIN
      public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_jpg.gif
  87. BIN
      public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_mp3.gif
  88. BIN
      public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_mv.gif
  89. BIN
      public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_pdf.gif
  90. BIN
      public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_ppt.gif
  91. BIN
      public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_psd.gif
  92. BIN
      public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_rar.gif
  93. BIN
      public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_txt.gif
  94. BIN
      public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_xls.gif
  95. BIN
      public/laravel-u-editor/dialogs/attachment/images/alignicon.gif
  96. BIN
      public/laravel-u-editor/dialogs/attachment/images/alignicon.png
  97. BIN
      public/laravel-u-editor/dialogs/attachment/images/bg.png
  98. BIN
      public/laravel-u-editor/dialogs/attachment/images/file-icons.gif
  99. BIN
      public/laravel-u-editor/dialogs/attachment/images/file-icons.png
  100. BIN
      public/laravel-u-editor/dialogs/attachment/images/icons.gif

+ 0 - 1
app/BillingModel.php

@@ -6,7 +6,6 @@ use Illuminate\Database\Eloquent\Model;
 
 class BillingModel extends Model
 {
-
     protected $fillable=[
         'carrier_id','province_id','city_id','unit_id','range_min','range_max','unit_price','initial_weight'
     ];

+ 0 - 1
app/Carrier.php

@@ -6,7 +6,6 @@ use Illuminate\Database\Eloquent\Model;
 
 class Carrier extends Model
 {
-
     protected $fillable=[
         'name','mobile','delivery_fee','remark'
     ];

+ 6 - 2
app/Commodity.php

@@ -7,8 +7,8 @@ use Illuminate\Database\Eloquent\Model;
 
 class Commodity extends Model
 {
-    protected $fillable=['name','sku','owner_id'];
-    protected $appends=['barcode','owner_name'];
+    protected $fillable=['name','sku','owner_id','created_at'];
+    protected $appends=['barcode','owner_name','owner_code'];
 
     public function barcodes()
     {
@@ -23,6 +23,10 @@ class Commodity extends Model
     public function getOwnerNameAttribute(){
         return $this->owner()->first()['name'];
     }
+    public function getOwnerCodeAttribute(){
+        return $this['owner'] ? $this['owner']['code'] : null;
+    }
+
     static function newCommodityBy_BarcodeOwnerIdNameSku($barcode,$ownerId,$name,$sku){
         $barcodes=rtrim($barcode,',');
         $barcodes=explode(',',$barcodes);

+ 1 - 1
app/CommodityBarcode.php

@@ -6,5 +6,5 @@ use Illuminate\Database\Eloquent\Model;
 
 class CommodityBarcode extends Model
 {
-    protected $fillable=['code','commodity_id'];
+    protected $fillable=['code','commodity_id','created_at'];
 }

+ 1 - 1
app/Events/InformWMSReceivedEvent.php

@@ -20,7 +20,7 @@ class InformWMSReceivedEvent
     }
     public function directRun()
     {
-        if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,'直接调用推送WMS事件,退单号:'.$this->rejectedBill['logistic_number_return'],Auth::user()['id']);
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,'直接调用推送WMS事件,退单号:'.$this->rejectedBill['logistic_number_return'],Auth::user()['id']);
         return (new InformWMSReceivedListener())->handle($this);
     }
 

+ 11 - 6
app/Exceptions/Handler.php

@@ -4,6 +4,9 @@ namespace App\Exceptions;
 
 use Exception;
 use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
+use Illuminate\Http\Request;
+use Illuminate\Http\Response;
+use Throwable;
 
 class Handler extends ExceptionHandler
 {
@@ -29,10 +32,11 @@ class Handler extends ExceptionHandler
     /**
      * Report or log an exception.
      *
-     * @param  \Exception  $exception
+     * @param Throwable $exception
      * @return void
+     * @throws Exception
      */
-    public function report(Exception $exception)
+    public function report(Throwable $exception)
     {
         parent::report($exception);
     }
@@ -40,11 +44,12 @@ class Handler extends ExceptionHandler
     /**
      * Render an exception into an HTTP response.
      *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  \Exception  $exception
-     * @return \Illuminate\Http\Response
+     * @param Request $request
+     * @param Throwable $exception
+     * @return Response
+     * @throws Throwable
      */
-    public function render($request, Exception $exception)
+    public function render($request, Throwable $exception)
     {
         return parent::render($request, $exception);
     }

+ 47 - 28
app/Http/Controllers/AuthorityController.php

@@ -39,47 +39,66 @@ class AuthorityController extends Controller
         return view('maintenance.authority.create',compact('owners'));
     }
 
-    /**
-     * Store a newly created resource in storage.
-     *
-     * @param Request $request
-     * @return string
-     */
+//    /**
+//     * Store a newly created resource in storage.
+//     *
+//     * @param Request $request
+//     * @return string
+//     */
+//    public function store(Request $request)
+//    {
+//        if(!Gate::allows('权限-录入')){ return redirect(url('/'));  }
+//        $inputs=$request->all();
+//        $inputs['combinedName']=$request->input('name').'_'.$request->input('id_owner');
+//        $this->validatorCreate($inputs)->validate();
+//        $successName= $request->input('name')??'';
+//        $inputs['name']=$inputs['combinedName'];
+//
+//        if($request->input('id_owner')??''){
+//            $owner=Owner::find($inputs['id_owner']);
+//            if(isset($inputs['remark'])){
+//                $inputs['remark'].="(key: {$inputs['combinedName']})";
+//            }else{
+//                $inputs['remark']="(key: {$inputs['combinedName']})";
+//            }
+//            $inputs['alias_name']=$request->input('name')."_(货主:$owner->name)";
+//            $successName.="(货主:$owner->name)";
+//        }else{
+//            $inputs['alias_name']=$request->input('name');
+//        }
+//        $authority=new Authority($inputs);
+//        $authority->save();
+//
+//        $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
+//        return redirect('maintenance/authority/create')->with('successTip',"成功录入权限“{$successName}”");
+//    }
+
     public function store(Request $request)
     {
         if(!Gate::allows('权限-录入')){ return redirect(url('/'));  }
-        $inputs=$request->all();
-        $inputs['combinedName']=$request->input('name').'_'.$request->input('id_owner');
-        $this->validatorCreate($inputs)->validate();
-        $successName= $request->input('name')??'';
-        $inputs['name']=$inputs['combinedName'];
+        $this->validatorCreate($request->all())->validate();
+        $owner=Owner::find($request->input('id_owner'));
 
-        if($request->input('id_owner')??''){
-            $owner=Owner::find($inputs['id_owner']);
-            if(isset($inputs['remark'])){
-                $inputs['remark'].="(key: {$inputs['combinedName']})";
-            }else{
-                $inputs['remark']="(key: {$inputs['combinedName']})";
-            }
-            $inputs['alias_name']=$request->input('name')."_(货主:$owner->name)";
-            $successName.="(货主:$owner->name)";
-        }else{
-            $inputs['alias_name']=$request->input('name');
-        }
-        $authority=new Authority($inputs);
+        $authority=new Authority(['alias_name'=>"(货主:{$owner['name']})",'name'=>"_{$owner['id']}",'remark'=>"(key: _{$owner['id']})"]);
         $authority->save();
 
         $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
-        return redirect('maintenance/authority/create')->with('successTip',"成功录入权限“{$successName}”");
+        return redirect('maintenance/authority/create')->with('successTip',"成功录入权限: (货主:{$owner['name']})");
     }
+
     protected function validatorCreate(array $data)
     {
+        $data['name']="_{$data['id_owner']}";
         return Validator::make($data, [
-            'name' => ['max:50', 'required_without:id_owner'],
-            'id_owner' => ['max:11', 'required_without:name'],
-            'combinedName' => ['max:50', 'unique:authorities,name'],
+            'id_owner' => ['required', 'exists:owners,id'],
+            'name' => ['unique:authorities,name'],
+        ],[
+            'id_owner.required' => '必须选一个货主',
+            'id_owner.exists' => '当前货主不存在',
+            'name.unique' => '该货主对应权限已添加过',
         ]);
     }
+
     protected function validatorUpdate(array $data)
     {
         return Validator::make($data, [

+ 16 - 4
app/Http/Controllers/PackageController.php

@@ -24,14 +24,26 @@ use Box\Spout\Common\Entity\Row;
 
 class PackageController extends Controller
 {
+    //超15天精确查询抽离 cloumn前提:数据库字段名必须与request内字段名一致
+    public function preciseQuery(string $column,Request $request,$packages){
+        $today=Carbon::now()->subDays(15);
+        $packagesTem=clone $packages;
+        $packagesTem=$packagesTem->where($column,'like','%'.$request->input($column).'%')->where('created_at','>',$today->format('Y-m-d'));
+        if($packagesTem->count()==0
+            ||$packagesTem->first()[$column]==$request->input($column)){
+            $packages=$packages->where($column,$request->input($column));
+        }else{
+            $packages=$packagesTem;
+        }
+        return $packages;
+    }
 
     public function conditionQuery(Request $request,$packages){
-        $today=Carbon::now()->subDays(15);
         if ($request->input('logistic_number')){
-            $packages=$packages->where('logistic_number','like','%'.$request->input('logistic_number').'%')->where('created_at','>',$today->format('Y-m-d'));
+            $packages=$this->preciseQuery('logistic_number',$request,$packages);
         }
         if ($request->input('delivery_number')){
-            $packages=$packages->where('delivery_number','like','%'.$request->input('delivery_number').'%')->where('created_at','>',$today->format('Y-m-d'));
+            $packages=$this->preciseQuery('logistic_number',$request,$packages);
         }
         if ($request->input('created_at_start')){
             $packages=$packages->where('created_at','>=',$request->input('created_at_start'));
@@ -43,7 +55,7 @@ class PackageController extends Controller
             $packages=$packages->where('owner_id',$request->input('owner_id'));
         }
         if ($request->input('batch_number')){
-            $packages=$packages->where('batch_number','like','%'.$request->input('batch_number').'%')->where('created_at','>',$today->format('Y-m-d'));
+            $packages=$this->preciseQuery('batch_number',$request,$packages);
         }
         return $packages;
     }

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

@@ -12,7 +12,6 @@ use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Gate;
 use Illuminate\Support\Facades\Validator;
 use Maatwebsite\Excel\Facades\Excel;
-
 class PaperBoxController extends Controller
 {
     /**

+ 761 - 85
app/Http/Controllers/ProcessController.php

@@ -2,19 +2,27 @@
 
 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\ProcessDailyParticipant;
+use App\ProcessesContent;
+use App\ProcessMethod;
+use App\ProcessStatistic;
+use App\Tutorial;
+use App\UserDetail;
 use App\UserDutyCheck;
 use Carbon\Carbon;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Gate;
+use Illuminate\Support\Facades\Validator;
 use Maatwebsite\Excel\Facades\Excel;
+use PDO;
+use Ramsey\Uuid\Uuid;
 
 class ProcessController extends Controller
 {
@@ -24,8 +32,12 @@ class ProcessController extends Controller
         $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.'%');
+            $processes=$processes->whereHas('processesContents',function ($query)use($barcode){
+                $query->whereHas('commodity',function ($builder)use($barcode){
+                    $builder->whereHas('barcodes',function ($builder)use($barcode){
+                        $builder->where('code','like',$barcode.'%');
+                    });
+                });
             });
         }
         if ($request->input('date_start')){
@@ -37,8 +49,16 @@ class ProcessController extends Controller
         if ($request->input('owner_id')){
             $processes=$processes->where('owner_id',$request->input('owner_id'));
         }
+        if ($request->input('status')){
+            $processes=$processes->where('status',$request->input('status'));
+        }
         if ($request->input('wms_code')){
-            $processes=$processes->where('wms_code','like','%'.$request->input('wms_code').'%')->where('created_at','>',$today->format('Y-m-d'));
+            $wms_code=$request->input('wms_code');
+            $date=$today->format('Y-m-d');
+            $processes=$processes->whereHas('processesContents',function ($builder)use ($wms_code,$date){
+                $builder->where('wms_code','like','%'.$wms_code.'%')
+                    ->where('created_at','>',$date);
+            });
         }
         $processes=$processes->paginate($request->input('paginate')??50);
         return $processes;
@@ -52,14 +72,18 @@ class ProcessController extends Controller
     public function index(Request $request)
     {
         if(!Gate::allows('二次加工管理-查询')){ return redirect(url('/'));  }
-        $processes=Process::with('tutorials')->orderBy('processes.id','DESC');
+        $processes=Process::with(['tutorials','processesContents'=>function($query){
+            return $query->with(['commodity'=>function($query){
+                return $query->with('barcodes');
+            }]);
+        }])->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]);
+        return view('process.index',['processes'=>$processes,'owners'=>$owners,'request'=>$request->input()]);
     }
 
 
@@ -80,10 +104,16 @@ class ProcessController extends Controller
     //获取每日参与人
     public function getDailyParticipant(Request $request){
         if(!Gate::allows('二次加工管理-登记工时')){ return redirect(url('/'));  }
+        $today=Carbon::now()->format('Y-m-d');
         $id=$request->input('id');
-        $processDailies=ProcessDaily::with('processDailyParticipants')->orderBy('time','DESC')
+        $processDailies=ProcessDaily::with(['processDailyParticipants','process'])->orderBy('date','DESC')
             ->where('process_id',$id)->get();
-        if ($processDailies){
+        if (count($processDailies)>0){
+            $result=$this->createDeficiencyData($processDailies,$today);
+            if ($result){
+                $processDailies=ProcessDaily::with(['processDailyParticipants','process'])
+                    ->orderBy('date','DESC')->where('process_id',$id)->get();
+            }
             $processDailies=$this->countManHour($processDailies);
         }
         return $processDailies;
@@ -91,54 +121,58 @@ class ProcessController extends Controller
 
     //根据参与人查找打卡记录计算工时信息
     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;
+            $date=$processDaily->date;
             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);
-                }
+                $processDailyParticipant->started_at=Carbon::parse($processDailyParticipant->started_at)->format('H:i');
+                $processDailyParticipant->ended_at=Carbon::parse($processDailyParticipant->ended_at)->format('H:i');
+                $processDailyParticipant=$this->countParticipantManHour($processDailyParticipant,$date);
             }
         }
         return $processDailies;
     }
 
+    //计算单参与人工时信息
+    public function countParticipantManHour($processDailyParticipant,$date){
+        $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){
+            return $processDailyParticipant;
+        }
+        $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_count){
+            return $processDailyParticipant;
+        }*/
+        if ($hour&&$hour>8){
+            $processDailyParticipant->billingHour=8;
+            return $processDailyParticipant;
+        }
+        if ($hour&&$hour<=8){
+            $processDailyParticipant->billingHour=round($hour,2);
+        }
+        return $processDailyParticipant;
+    }
+
     //打卡工时减休息时间
     public function isHour($userDutyCheckStart,$hour){
 
@@ -149,6 +183,34 @@ class ProcessController extends Controller
         }
         return $hour;
     }
+    //生成二次加工单缺失时间记录及本日记录
+    public function createDeficiencyData($processDailies,$today){
+        $processDailiesArr=[];
+        foreach ($processDailies as $processDaily){
+            $processDailiesArr[$processDaily->date]=$processDaily;
+        }
+        $processDailyOne=$processDailies[count($processDailies)-1];
+        $startDate=Carbon::parse($processDailyOne->date);
+        $diffDay=$startDate->diffInDays($today,true);
+        $remain=$processDailyOne->remain;
+        $processId=$processDailyOne->process_id;
+        for ($i=1;$i<=$diffDay;$i++){
+            $date=date("Y-m-d",strtotime('+'.strval($i)." day",strtotime($startDate)));
+            if (!isset($processDailiesArr[$date])){
+                $processDaily=new ProcessDaily([
+                    'process_id'=>$processId,
+                    'date'=>$date,
+                    'output'=>0,
+                    'remain'=>$remain
+                ]);
+                $processDaily->save();
+            }
+            if (isset($processDailiesArr[$date])){
+                $remain=$remain-($processDailiesArr[$date]->output);
+            }
+        }
+        return true;
+    }
 
     //驳回二次加工单
     public function reject($id){
@@ -162,8 +224,17 @@ class ProcessController extends Controller
     //接单
     public function receive($id){
         if(!Gate::allows('二次加工管理-接单与驳回')){ return redirect(url('/'));  }
-        $process=Process::select('id','status')->find($id);
-        $process->status="接单";
+        $process=Process::select('id','status','amount')->find($id);
+        $amount=$process->amount;
+        $today=Carbon::now()->format('Y-m-d');
+        $processDaily=new ProcessDaily([
+            'process_id'=>$id,
+            'date'=>$today,
+            'output'=>0,
+            'remain'=>$amount,
+        ]);
+        $processDaily->save();
+        $process->status="待加工";
         $process->update();
         $this->log(__METHOD__,"接单二次加工单_".__FUNCTION__,json_encode($process),Auth::user()['id']);
         return $process;
@@ -171,12 +242,269 @@ class ProcessController extends Controller
     //完成
     public function accomplish($id){
         if(!Gate::allows('二次加工管理-验收完成')){ return redirect(url('/'));  }
-        $process=Process::select('id','status')->find($id);
+        $process=Process::with('processDailies')->find($id);
+        if (count($process->processDailies)>0){
+            $completed_amount=0;
+            foreach ($process->processDailies as $processDaily){
+                $completed_amount=$completed_amount+($processDaily->output);
+            }
+            $process->completed_amount=$completed_amount;
+        }
         $process->status="已完成";
         $process->update();
-        $this->log(__METHOD__,"完成二次加工单_".__FUNCTION__,json_encode($process),Auth::user()['id']);
+
+        //统计:
+        $revenue=($process->unit_price)*($process->completed_amount);   //收入合计
+        $processDailies=ProcessDaily::with('processDailyParticipants')->where('process_id',$id)->where('output','>',0)->get();
+        $duration_days=count($processDailies);      //完成天数
+        $duration_man_hours=0;      //总工时
+        $total_cost=0;              //合计成本
+        foreach ($processDailies as $processDailyOne){
+            foreach ($processDailyOne->processDailyParticipants as $processDailyParticipant){
+                $processDailyParticipant=$this->countParticipantManHour($processDailyParticipant,$processDailyOne->date);
+                $duration_man_hours=$duration_man_hours+($processDailyParticipant->billingHour);
+                if ($processDailyParticipant->unit_count){
+                    $total_cost=$total_cost+(($processDailyParticipant->unit_count)*($processDailyParticipant->unit_price));
+                    continue;
+                }
+                $total_cost=$total_cost+(($processDailyParticipant->billingHour)*($processDailyParticipant->hour_price));
+            }
+        };
+        $gross_profit=$revenue-$total_cost; //毛利润
+        $gross_profit_rate=$gross_profit/$revenue;  //毛利率
+        $processStatistic=ProcessStatistic::find($id);
+        $processStatistic->revenue=$revenue;
+        $processStatistic->duration_days=$duration_days;
+        $processStatistic->duration_man_hours=$duration_man_hours;
+        $processStatistic->total_cost=$total_cost;
+        $processStatistic->gross_profit=$gross_profit;
+        $processStatistic->gross_profit_rate=$gross_profit_rate;
+        $processStatistic->update();
+        $this->log(__METHOD__,"完成二次加工单_".__FUNCTION__,json_encode($process)." || ".json_encode($processStatistic),Auth::user()['id']);
         return $process;
     }
+
+    //修改当日产量
+    public function updateDailyOutput(Request $request){
+        if(!Gate::allows('二次加工管理-登记工时')){ return redirect(url('/'));  }
+        $errors=$this->validator($request)->errors();
+        if (count($errors)>0)return ['status'=>"error",'data'=>$errors];
+        $id=$request->input('id');
+        $output=$request->input('output');
+        $processDaily=ProcessDaily::with('process')->find($id);
+        $processDaily->output=$output;
+        $processDaily->update();
+        $result=$this->countRemains($processDaily);
+        $processDailies=$result['processDailies'];
+        //$remain=$this->countRemain($processDaily);
+        //$processDaily->remain=$remain;
+        $this->log(__METHOD__,"修改当日产量".__FUNCTION__,json_encode($processDaily),Auth::user()['id']);
+        $response=[];
+        $response['status']='success';
+        $response['data']=$processDailies;
+        if (isset($result['process'])){$response['process']=$result['process'];}
+        return $response;
+    }
+    //每次修改,去查询该单下全部日期,逐个替换,前一天剩余减当天产量为当天剩余,无前天记录去拿单子预期产量
+    public function countRemains($processDaily){
+        if (!$processDaily || !$processDaily->process) return;
+        $processDailies=ProcessDaily::where('process_id',$processDaily->process_id)->orderBy('date')->get();
+        for ($i=0;$i<count($processDailies);$i++){
+            if ($i==0&&$processDailies[$i]->date>=$processDaily->date){
+                $processDailies[$i]->remain=($processDaily->process->amount)-$processDailies[$i]->output;
+                $processDailies[$i]->update();
+            }
+            if ($i>0&&$processDailies[$i]->date>=$processDaily->date){
+                $processDailies[$i]->remain=($processDailies[$i-1]->remain)-$processDailies[$i]->output;
+                $processDailies[$i]->update();
+            }
+        }
+
+        //同步二次加工单统计
+        $processDailiesStatistic=$processDailies->where('output','>',0);
+        $processStatistic=ProcessStatistic::find($processDaily->process_id);    //如非录入渠道建单不生成统计单,报错
+        $processStatistic->top_capacity=$processDailiesStatistic->max('output');
+        $processStatistic->bottom_capacity=$processDailiesStatistic->min('output');
+        $processStatistic->average_capacity=$processDailiesStatistic->avg('output');
+        $processStatistic->update();
+        //修改二次加工单状态
+        $result=[];
+        if (count($processDailies)>0 && ($processDailies[(count($processDailies)-1)]->remain)<=0){
+            $result['process']=$this->changeProcessCheck($processDaily->process_id);
+        }
+        $result['processDailies']=$processDailies;
+        return $result;
+    }
+
+    //剩余小于等于0,状态待验收
+    public function changeProcessCheck($process_id){
+        $process=Process::select('id','status')->find($process_id);
+        if ($process->status=="加工中"){
+            $process->status="待验收";
+            $process->update();
+            $processStatistic=ProcessStatistic::find($process_id);
+            $processStatistic->ended_at=date('Y-m-d H:i:s');
+            $processStatistic->update();
+            $this->log(__METHOD__,"二次加工单待验收".__FUNCTION__,json_encode($process)." || ".json_encode($processStatistic),Auth::user()['id']);
+        }
+        return $process_id;
+    }
+    /*//计算当日剩余  根据日期
+    public function countRemain($processDaily){
+        if (!$processDaily || !$processDaily->process) return;
+        $processDailies=ProcessDaily::where('process_id',$processDaily->process_id)
+            ->where('date','<=',$processDaily->date)->get();
+        $sum=0;
+        foreach ($processDailies as $processDaily){
+            $sum=$sum+($processDaily->output);
+        }
+        return ($processDaily->process->amount)-$sum;
+    }*/
+    //添加参与人
+    public function shortProcessDailyParticipant(Request $request){
+        if(!Gate::allows('二次加工管理-登记工时')){ return redirect(url('/'));  }
+        $errors=$this->validatorProcessDailyParticipant($request)->errors();
+        if (count($errors)>0)return ['status'=>"error",'data'=>$errors];
+        $user_id=$request->input('user_id');
+        $started_at=$request->input('started_at');
+        $ended_at=$request->input('ended_at');
+        $daily_id=$request->input('daily_id');
+        $hour_count=$request->input('hour_count');
+        $unit_count=$request->input('unit_count');
+        $hour_price=$request->input('hour_price');
+        $unit_price=$request->input('unit_price');
+        $dinner_duration=$request->input('dinner_duration');
+        $remark=$request->input('remark');
+        $processDailyParticipant=new ProcessDailyParticipant([
+            'process_daily_id'=>$daily_id,
+            'user_id'=>$user_id,
+            'started_at'=>$started_at,
+            'ended_at'=>$ended_at,
+            'hour_price'=>$hour_price,
+            'hour_count'=>$hour_count,
+            'unit_price'=>$unit_price,
+            'unit_count'=>$unit_count,
+            'dinner_duration'=>$dinner_duration,
+            'remark'=>$remark,
+        ]);
+        $processDailyParticipant->save();
+        $this->log(__METHOD__,"添加新参与人".__FUNCTION__,json_encode($processDailyParticipant),Auth::user()['id']);
+        $result=[];
+        $processDaily=ProcessDaily::with('process')->select('process_id','date')->find($daily_id);
+        $date=$processDaily->date;
+        $processDailyParticipant=$this->countParticipantManHour($processDailyParticipant,$date);
+        if ($processDaily->process && $processDaily->process->status=="待加工"){
+            $process=Process::find($processDaily->process_id);
+            $process->status="加工中";
+            $process->update();
+            $result['process']=$processDaily->process_id;
+            $processStatistic=ProcessStatistic::find($processDaily->process_id);
+            $processStatistic->started_at=date('Y-m-d H:i:s');
+            $processStatistic->update();
+            $this->log(__METHOD__,"二次加工单加工中".__FUNCTION__,json_encode($process)." || ".json_encode($processStatistic),Auth::user()['id']);
+        }
+        $result['status']="success";
+        $result['data']=$processDailyParticipant;
+        return $result;
+    }
+
+    //验证参与人
+    public function verifyUserName(Request $request){
+        $userName=$request->input('userName');
+        if (!$userName) return;
+        $result=$this->seekUserLabor($userName);
+        return $result;
+    }
+
+    //根据全名查询临时工
+    public function seekUserLabor($userName){
+        $userDetails=UserDetail::with('user_labor')->where('type','临时工')->where('full_name',$userName)->get();
+        if (!$userDetails)return;
+        if (count($userDetails)==1){
+            if (!$userDetails[0]->user_labor)return;
+            return $userDetails[0];
+        }
+        //多个同名
+        foreach ($userDetails as $userDetail){
+            $userDutyCheck=UserDutyCheck::select('checked_at')->where("user_id",$userDetail->user_id)->orderBy('checked_at','DESC')->first();
+            if ($userDutyCheck)$userDetail->checked_at=$userDutyCheck->checked_at;
+        }
+        if (!$userDetails)return;
+        return $userDetails;
+    }
+    //修改参与人
+    public function updateProcessDailyParticipant(Request $request){
+        if(!Gate::allows('二次加工管理-登记工时')){ return redirect(url('/'));  }
+        $id=$request->input('id');
+        if (!$id) return ['status'=>"error",'data'=>"修改失败,ID未传递"];
+        $errors=$this->validatorProcessDailyParticipant($request)->errors();
+        if (count($errors)>0)return ['status'=>"error",'data'=>$errors];
+        $processDailyParticipant=ProcessDailyParticipant::with('processDaily')->find($id);
+        if (!$processDailyParticipant || ! $processDailyParticipant->processDaily) return ['status'=>"error",'data'=>"修改失败,该信息不存在"];
+        $processDailyParticipant->user_id=$request->input('user_id');
+        $processDailyParticipant->started_at=$request->input('started_at');
+        $processDailyParticipant->ended_at=$request->input('ended_at');
+        $processDailyParticipant->hour_count=$request->input('hour_count');
+        $processDailyParticipant->unit_count=$request->input('unit_count');
+        $processDailyParticipant->hour_price=$request->input('hour_price');
+        $processDailyParticipant->unit_price=$request->input('unit_price');
+        $processDailyParticipant->dinner_duration=$request->input('dinner_duration');
+        $processDailyParticipant->remark=$request->input('remark');
+        $processDailyParticipant->update();
+        $this->log(__METHOD__,"修改参与人".__FUNCTION__,json_encode($processDailyParticipant),Auth::user()['id']);
+        $processDailyParticipant=$this->countParticipantManHour($processDailyParticipant,$processDailyParticipant->processDaily->date);
+        return ['status'=>"success",'data'=>$processDailyParticipant];
+    }
+    //参与人审核
+    public function processDailyParticipantAudit($id){
+        if(!Gate::allows('二次加工管理-登记工时-审核')){ return redirect(url('/'));  }
+        $processDailyParticipant=ProcessDailyParticipant::select('id','status')->find($id);
+        if (!$processDailyParticipant) return ['success'=>false];
+        $processDailyParticipant->status='已审核';
+        $processDailyParticipant->update();
+        $this->log(__METHOD__,"登记工时参与人审核".__FUNCTION__,json_encode($processDailyParticipant),Auth::user()['id']);
+        return ['success'=>true,'processDailyParticipant'=>$processDailyParticipant];
+    }
+    /*//临时工详情
+    public function showUserDetail(Request $request){
+        $id=$request->input('user_id');
+        $userDetail=UserDetail::with('user_labor')->find($id);
+        if (!$userDetail) return ['success'=>'false'];
+        return ['success'=>'true','userDetail'=>$userDetail];
+    }*/
+    //获取全部教程
+    public function getTutorials($id){
+        $process=Process::with('tutorials')->find($id);
+        $tutorials_id=[];
+        if ($process->tutorials){
+            foreach ($process->tutorials as $tutorial){
+                array_push($tutorials_id,$tutorial->id);
+            }
+        }
+        $tutorials=Tutorial::where('owner_id',$process->owner_id)->get();
+        if ($tutorials_id && $tutorials) $tutorials=$tutorials->diff(Tutorial::whereIn('id',$tutorials_id)->get());
+        return ['success'=>true,'data'=>$tutorials];
+    }
+    //添加教程关联
+    public function selectedTutorial(Request $request){
+        $process_id=$request->input('process_id');
+        $tutorial_id=$request->input('tutorial_id');
+        if (!$process_id || !$tutorial_id) return ['success'=>false,'data'=>'二次加工或教程传递错误!'];
+        $tutorial=Tutorial::find($tutorial_id);
+        if (!$tutorial)return ['success'=>false,'data'=>'未找到相关教程!'];
+        $tutorial->processes()->syncWithoutDetaching([$process_id]);
+        $this->log(__METHOD__,"添加教程关联".__FUNCTION__,json_encode($process_id),Auth::user()['id']);
+        return ['success'=>true,'data'=>$tutorial];
+    }
+    //删除教程关联
+    public function deleteTutorial(Request $request){
+        $process_id=$request->input('process_id');
+        $tutorial_id=$request->input('tutorial_id');
+        if (!$process_id || !$tutorial_id) return ['success'=>false,'data'=>'二次加工或教程传递错误!'];
+        DB::table('process_tutorial')->where('process_id',$process_id)->where('tutorial_id',$tutorial_id)->delete();
+        $this->log(__METHOD__,"删除教程关联".__FUNCTION__,json_encode($process_id),Auth::user()['id']);
+        return ['success'=>true];
+    }
     /**
      * Show the form for creating a new resource.
      *
@@ -184,18 +512,181 @@ class ProcessController extends Controller
      */
     public function create()
     {
-        //
+        $processMethods=ProcessMethod::get();
+        return view('process/create',['processMethods'=>$processMethods]);
+    }
+
+    //货主ID获取教程
+    public function ownerGetTutorials($owner_id){
+        $tutorials=Tutorial::where('owner_id',$owner_id)->get();
+        return $tutorials;
+    }
+
+    //考勤
+    public function createReplenishClock(){
+        return view('process/checking-in/createReplenishClock');
+    }
+    //搜索临时工下打卡信息
+    public function checkUserLabors(Request $request){
+        $full_name=$request->input('full_name');
+        $userDetail=UserDetail::with(['userDutyChecks'=>function ($query){
+            return $query->orderBy('checked_at','DESC')->limit(5);
+        }])->where('full_name',$full_name)->get();
+        return ['success'=>true,'data'=>$userDetail];
+    }
+    //录入补卡
+    public function storeReplenishClock(Request $request){
+        $errors=$this->validatorUserDutyCheck($request)->errors();
+        if (count($errors)>0)return ['success'=>false,'data'=>$errors];
+        $user_id=$request->input('user_id');
+        $checked_at=$request->input('checked_at');
+        $type=$request->input('type');
+        $userDutyCheck=new UserDutyCheck([
+            'user_id'=>$user_id,
+            'checked_at'=>$checked_at,
+            'type'=>$type,
+            'source'=>'补入',
+        ]);
+        $userDutyCheck->save();
+        $this->log(__METHOD__,"录入补卡".__FUNCTION__,json_encode($userDutyCheck),Auth::user()['id']);
+        return ['success'=>true,'data'=>$userDutyCheck];
+    }
+
+    //去往打卡审核
+    public function clockAudit(){
+        $date=date('Y-m-d');
+        $userDutyChecks=UserDutyCheck::with('userDetail')->where('checked_at','like',$date."%")->get();
+        return view('process/checking-in/clockAudit',['userDutyChecks'=>$userDutyChecks]);
+    }
+    //打卡审核
+    public function storeClockAudit(Request $request){
+        $id=$request->input('id');
+        $type=$request->input('type');
+        $userDutyCheck=UserDutyCheck::find($id);
+        $userDutyCheck->type=$type;
+        $userDutyCheck->verify_user_id=Auth::user()['id'];
+        $userDutyCheck->update();
+        $this->log(__METHOD__,"打卡审核".__FUNCTION__,json_encode($userDutyCheck),Auth::user()['id']);
+        return $userDutyCheck->verify_user_id;
+    }
+    //打卡审核时判断是否异常
+    public function isException(Request $request){
+        $id=$request->input('id');
+        $checked_at=$request->input('checked_at');
+        $type=$request->input('type');
+        $user_id=$request->input('user_id');
+        if (!$id || !$checked_at || !$type || !$user_id)return ['exception'=>'数据异常!','duration_man_hour'=>''];
+        $userDutyCheck=UserDutyCheck::where('user_id',$user_id)->where('checked_at','<',$checked_at)->first();
+        if (!$userDutyCheck)return ['exception'=>'','duration_man_hour'=>''];
+        $dateStart=Carbon::parse($userDutyCheck->checked_at);
+        $dateEnd=Carbon::parse($checked_at);
+        $minute=($dateEnd->diffInMinutes($dateStart));
+        if ($type=="登入"&&$userDutyCheck->type=="登入"&&$minute>30){
+            return ['exception'=>'无出场纪录!','duration_man_hour'=>''];
+        }
+        if ($type=="登出"&&$userDutyCheck->type=="登出"&&$minute>30){
+            return ['exception'=>'无入场纪录!','duration_man_hour'=>''];
+        }
+        if ($type=="登出"&&$userDutyCheck->type=="登入"&&$minute>=720){
+            return ['exception'=>'时间异常!','duration_man_hour'=>''];
+        }
+        if ($type=="登出"&&$userDutyCheck->type=="登入"){
+            return ['exception'=>'','duration_man_hour'=>$minute/60];
+        }
+        return ['exception'=>'','duration_man_hour'=>''];
+    }
+
+    //去往任务审核
+    public function missionAudit(Request $request){
+        $processDailyParticipants=ProcessDailyParticipant::with(['processDaily','user_detail'])
+            ->orderBy('id','DESC');
+        $start_date=$request->input('start_date');
+        $end_date=$request->input('end_date');
+        $full_name=$request->input('full_name');
+        $mobile_phone=$request->input('mobile_phone');
+        if ($start_date) {
+            $processDailyParticipants->whereHas('processDaily',function (Builder $builder)use($start_date){
+                $builder->where('date','>=',$start_date);
+            });
+        }
+        if ($end_date) {
+            $processDailyParticipants->whereHas('processDaily',function (Builder $builder)use($end_date){
+                $builder->where('date','<=',$end_date);
+            });
+        }
+        if ($full_name){
+            $processDailyParticipants->whereHas('user_detail',function (Builder $builder)use($full_name){
+                $builder->where('full_name',$full_name);
+            });
+        }
+        if ($mobile_phone){
+            $processDailyParticipants->whereHas('user_detail',function (Builder $builder)use($mobile_phone){
+                $builder->where('mobile_phone',$mobile_phone);
+            });
+        }
+        $processDailyParticipants=$processDailyParticipants->paginate($request->input('paginate')?$request->input('paginate'):50);
+        foreach ($processDailyParticipants as $processDailyParticipant){
+            if ($processDailyParticipant->processDaily){
+                $processDailyParticipant=$this->countParticipantManHour($processDailyParticipant,$processDailyParticipant->processDaily->date);
+            }
+        }
+        return view('process/checking-in/missionAudit',['processDailyParticipants'=>$processDailyParticipants,'request'=>$request->input()]);
+    }
+
+    //任务审核
+    public function storeMissionAudit(Request $request){
+        $id=$request->input('id');
+        if (!$id)return ['error'=>'提交审核失败!'];
+        $processDailyParticipant=ProcessDailyParticipant::find($id);
+        if (!$id)return ['error'=>'未找到对应记录!'];
+        $processDailyParticipant->status='已审核';
+        $processDailyParticipant->update();
+        $this->log(__METHOD__,"任务审核".__FUNCTION__,json_encode($processDailyParticipant),Auth::user()['id']);
+        return;
     }
 
-    /**
-     * Store a newly created resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @return \Illuminate\Http\Response
-     */
     public function store(Request $request)
     {
-        //
+        if(!Gate::allows('二次加工管理-录入')){ return redirect(url('/'));  }
+        $errors=$this->validatorProcess($request)->errors();
+        if (count($errors)>0)return ['error'=>$errors,'data'=>"process"];
+        $errors=[];
+        foreach ($request->input('processContents') as $processContent){
+            if ($processContent['addBtnShow'])continue;
+            $error=$this->validatorProcessContent($processContent)->errors();
+            if (count($error)>0)$errors[$processContent['wms_code']]=$error;
+        }
+        if (count($errors)>0)return ['error'=>$errors];
+        $process=new Process([
+            'code'=>Uuid::uuid1(),
+            'owner_id'=>$request->input('owner_id'),
+            'process_method_id'=>$request->input('process_method_id'),
+            'unit_price'=>$request->input('unit_price'),
+            'remark'=>$request->input('remark'),
+            'amount'=>$request->input('amount'),
+        ]);
+        $process->save();
+        $process->code='P'.date ("Ymd").str_pad($process->id,3,"0",STR_PAD_LEFT);
+        $process->update();
+        $processStatistic=new ProcessStatistic([
+            'process_id'=>$process->id,
+        ]);
+        $processStatistic->save();
+        $this->log(__METHOD__,"录入二次加工单".__FUNCTION__,json_encode($process)." || ".json_encode($processStatistic),Auth::user()['id']);
+        foreach ($request->input('processContents') as $processContent){
+            if ($processContent['addBtnShow'])continue;
+            $processContentOne=new ProcessesContent([
+                'process_id'=>$process->id,
+                'bill_type'=>$processContent['bill_type'],
+                'commodity_id'=>$processContent['commodity_id'],
+                'wms_code'=>$processContent['wms_code'],
+                'amount'=>$processContent['amount'],
+            ]);
+            $processContentOne->save();
+            $this->log(__METHOD__,"录入二次加工单内容单".__FUNCTION__,json_encode($processContentOne),Auth::user()['id']);
+        }
+        if ($request->input('tutorials'))$process->tutorials()->sync($request->input('tutorials'));
+        return;
     }
 
     /**
@@ -217,7 +708,13 @@ class ProcessController extends Controller
      */
     public function edit($id)
     {
-        //
+        $process=Process::with(['processesContents'=>function($query){
+            return $query->with(['commodity'=>function($query){
+                return $query->with('barcodes');
+            }]);
+        }])->find($id);
+        $processMethods=ProcessMethod::get();
+        return view('process.edit',['process'=>$process,'processMethods'=>$processMethods]);
     }
 
     /**
@@ -229,7 +726,56 @@ class ProcessController extends Controller
      */
     public function update(Request $request, $id)
     {
-        //
+
+        if(!Gate::allows('二次加工管理-录入')){ return redirect(url('/'));  }
+        $errors=$this->validatorProcess($request)->errors();
+        if (count($errors)>0)return ['error'=>$errors,'data'=>"process"];
+        $errors=[];
+        foreach ($request->input('processContents') as $processContent){
+            if ($processContent['addBtnShow'])continue;
+            $error=$this->validatorProcessContent($processContent)->errors();
+            if (count($error)>0)$errors[$processContent['wms_code']]=$error;
+        }
+        if (count($errors)>0)return ['error'=>$errors];
+        $process=Process::find($id);
+        $process->owner_id=$request->input('owner_id');
+        $process->process_method_id=$request->input('process_method_id');
+        $process->unit_price=$request->input('unit_price');
+        $process->remark=$request->input('remark');
+        $process->amount=$request->input('amount');
+        $process->update();
+        $this->log(__METHOD__,"编辑二次加工单".__FUNCTION__,json_encode($process),Auth::user()['id']);
+        foreach ($request->input('processContents') as $processContent){
+            if ($processContent['addBtnShow'])continue;
+            if (!isset($processContent['id'])){
+                $processContentOne=new ProcessesContent([
+                    'process_id'=>$process->id,
+                    'bill_type'=>$processContent['bill_type'],
+                    'commodity_id'=>$processContent['commodity_id'],
+                    'wms_code'=>$processContent['wms_code'],
+                    'amount'=>$processContent['amount'],
+                ]);
+                $processContentOne->save();
+                $this->log(__METHOD__,"录入二次加工单内容单".__FUNCTION__,json_encode($processContentOne),Auth::user()['id']);
+                continue;
+            }
+            $processContentOne=ProcessesContent::find($processContent['id']);
+            $processContentOne->bill_type=$processContent['bill_type'];
+            $processContentOne->commodity_id=$processContent['commodity_id'];
+            $processContentOne->wms_code=$processContent['wms_code'];
+            $processContentOne->amount=$processContent['amount'];
+            $processContentOne->update();
+            $this->log(__METHOD__,"编辑二次加工单内容单".__FUNCTION__,json_encode($processContentOne),Auth::user()['id']);
+        }
+        return;
+    }
+
+    //删除二次加工内容单
+    public function deleteProcessContent($id){
+        $processContent=ProcessesContent::find($id);
+        if (!$processContent) return ['success'=>false,'data'=>'为找到对应二次加工内容单'];
+        $processContent->delete();
+        return ['success'=>true];
     }
 
     /**
@@ -250,38 +796,168 @@ class ProcessController extends Controller
             'id'=>'ID',
             'code'=>'任务号',
             'owner_name'=>'货主',
-            'bill_type'=>'单据类型',
-            'wms_code'=>'单据号',
             'process_method_name'=>'加工类型',
             'amount'=>'预期数量',
+            'completed_amount'=>'实际数量',
+            'status'=>'状态',
             'unit_price'=>'单价',
             'created_at'=>'提交日期',
+            'bill_type'=>'单据类型',
+            'wms_code'=>'单据号',
             'commodity_barcode'=>'商品编码',
             'commodity_name'=>'商品名称',
-            'completed_amount'=>'实际数量',
-            'status'=>'状态',
+            'thisAmount'=>'本次数量',
         ]];
         $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++;
+            if (!$process->processesContents){
+                $w=[
+                    'id'=>$process->id,
+                    'code'=>$process->code ,
+                    'owner_name'=>$process->owner_name ,
+                    'process_method_name'=>$process->process_method_name,
+                    'amount'=>$process->amount,
+                    'unit_price'=>$process->unit_price,
+                    'created_at'=>$process->created_at ,
+                    'completed_amount'=>$process->completed_amount,
+                    'status'=>$process->status,
+                ];
+                $list[$i]=$w;
+                $i++;
+                continue;
+            }
+            foreach($process->processesContents as $processesContent){
+                $barcodes="";
+                if ($processesContent->commodity && $processesContent->commodity->barcodes){
+                    foreach ($processesContent->commodity->barcodes as $barcode){
+                        if (!$barcodes){$barcodes=$barcode->code; continue;}
+                        $barcodes=$barcodes.",".$barcode->code;
+                    }
+                }
+                $w=[
+                    'id'=>$process->id,
+                    'code'=>$process->code ,
+                    'owner_name'=>$process->owner_name ,
+                    'bill_type'=>$processesContent->bill_type ,
+                    'wms_code'=>$processesContent->wms_code ,
+                    'process_method_name'=>$process->process_method_name,
+                    'amount'=>$process->amount,
+                    'thisAmount'=>$processesContent->amount,
+                    'unit_price'=>$process->unit_price,
+                    'created_at'=>$process->created_at ,
+                    'commodity_barcode'=>$barcodes,
+                    'commodity_name'=>$processesContent->commodity_name ,
+                    'completed_amount'=>$process->completed_amount,
+                    'status'=>$process->status,
+                ];
+                $list[$i]=$w;
+                $i++;
+            }
         }
         return Excel::download(new WaybillExport($row,$list),date('YmdHis', time()).'-二次加工单.xlsx');
     }
+
+    public function validatorProcessContent(array $processContent){
+        $validator=Validator::make($processContent,[
+            'wms_code'=>['required'],
+            'commodity_id'=>['required','integer'],
+            'bill_type'=>['required'],
+            'amount'=>['required','min:0','max:999999','integer']
+        ],[
+            'required'=>':attribute 不应为空',
+            'min'=>':attribute 不得为0或为负',
+            'integer'=>':attribute 必须为整数',
+            'max'=>':attribute 输入值过大',
+        ],[
+            'wms_code'=>'单据号',
+            'commodity_id'=>'商品',
+            'bill_type'=>'单据类型',
+            'amount'=>'商品数量',
+        ]);
+        return $validator;
+    }
+
+    public function validatorProcess(Request $request){
+        $validator=Validator::make($request->input(),[
+            'owner_id'=>['required'],
+            'process_method_id'=>['required','integer'],
+            'amount'=>['required','integer'],
+            'unit_price'=>['required','min:0','max:999999','numeric'],
+        ],[
+            'required'=>':attribute 不应为空',
+            'min'=>':attribute 不得为0或为负',
+            'numeric'=>':attribute 必须为数字',
+            'max'=>':attribute 输入值过大',
+            'integer' =>':attribute 必须为整数',
+        ],[
+            'owner_id'=>'货主',
+            'process_method_id'=>'加工类型',
+            'amount'=>'数量',
+            'unit_price'=>'单价',
+        ]);
+        return $validator;
+    }
+
+    public function validator(Request $request){
+        $validator=Validator::make($request->input(),[
+            'id'=>['required','integer'],
+            'output'=>'required|min:0|max:999999|numeric',
+        ],[
+            'required'=>':attribute 不应为空',
+            'min'=>':attribute 不得为0或为负',
+            'numeric'=>':attribute 必须为数字',
+            'max'=>':attribute 输入值过大',
+        ],[
+            'output'=>'每日产量'
+        ]);
+        return $validator;
+    }
+
+    public function validatorUserDutyCheck(Request $request){
+        $validator=Validator::make($request->input(),[
+            'user_id'=>'required',
+            'checked_at'=>'required|date_format:Y-m-d H:i',
+            'type'=>'required',
+        ],[
+            'date_format'=>':attribute 格式错误',
+        ],['checked_at'=>'日期']);
+        return $validator;
+    }
+
+    //参与人信息校验
+    public function validatorProcessDailyParticipant(Request $request){
+        $validator=Validator::make($request->input(),[
+            'daily_id'=>'filled',
+            'user_id'=>'required',
+            'started_at'=>'required|date_format:H:i',
+            'ended_at'=>'required|date_format:H:i',
+            'hour_price'=>'required_without:unit_price|min:0|max:999999|numeric',
+            'unit_price'=>'required_without:hour_price|min:0|max:999999|numeric',
+            'dinner_duration'=>'nullable|integer',
+            'hour_count'=>'required_with:hour_price|min:0|max:999999|numeric',
+            'unit_count'=>'required_with:unit_price|min:0|max:999999|numeric',
+            'remark'=>'nullable',
+        ],[
+            'required'=>':attribute 不应为空',
+            'min'=>':attribute 不得为0或为负',
+            'numeric'=>':attribute 必须为数字',
+            'max'=>':attribute 输入值过大',
+            'required_without'=>':attribute 计时与计件至少填一项',
+            'date_format'=>':attribute 格式错误',
+            'integer'=>':attribute 选择错误',
+        ],[
+            'daily_id'=>'所属每日单',
+            'user_id'=>'参与人',
+            'started_at'=>'开始时间',
+            'ended_at'=>'结束时间',
+            'hour_price'=>'计时工资',
+            'unit_price'=>'计件工资',
+            'dinner_duration'=>'晚饭时间',
+            'hour_count'=>'计时工时',
+            'unit_count'=>'计件数量',
+            'remark'=>'备注',
+        ]);
+        return $validator;
+    }
 }

+ 124 - 0
app/Http/Controllers/ProcessStatisticController.php

@@ -0,0 +1,124 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Exports\WaybillExport;
+use App\Owner;
+use App\ProcessMethod;
+use App\ProcessStatistic;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Gate;
+use Maatwebsite\Excel\Facades\Excel;
+
+class ProcessStatisticController extends Controller
+{
+    public function conditionQuery(Request $request,$processStatistics){
+        if ($request->input('started_at')){
+            $processStatistics=$processStatistics->where('started_at','>=',$request->input('started_at'));
+        }
+        if ($request->input('owner_id')){
+            $owner_id=$request->input('owner_id');
+            $processStatistics=$processStatistics->whereHas('process',function (Builder $query)use($owner_id){
+                $query->where('owner_id',$owner_id);
+            });
+        }
+        if ($request->input('ended_at')){
+            $processStatistics=$processStatistics->where('ended_at','<=',$request->input('ended_at'));
+        }
+        if ($request->input('code')){
+            $code=$request->input('code');
+            $processStatistics=$processStatistics->whereHas('process',function (Builder $query)use($code){
+                $query->where('code','like',$code."%");
+            });
+        }
+        if ($request->input('status')){
+            $status=$request->input('status');
+            $processStatistics=$processStatistics->whereHas('process',function (Builder $query)use($status){
+                $query->where('status',$status);
+            });
+        }
+        $processStatistics=$processStatistics->paginate($request->input('paginate')?$request->input('paginate'):50);
+        return $processStatistics;
+    }
+
+    public function index(Request $request){
+        $processStatistics=ProcessStatistic::with('process')->orderBy('process_id','DESC');
+        if ($request->input('checkSign')){
+            $excel=$this->isExport($request,$processStatistics);
+            return $excel;
+        }
+        $processStatistics=$this->conditionQuery($request,$processStatistics);
+        $owners=Owner::get();
+        $processMethods=ProcessMethod::get();
+        return view('process.statistic',['processStatistics'=>$processStatistics,'owners'=>$owners,'processMethods'=>$processMethods]);
+    }
+
+    //获取导出数据
+    public function isExport(Request $request,$processStatistics){
+        if(!Gate::allows('二次加工管理-查询')){ return redirect(url('/'));  }
+        if ($request->input('checkSign')=="-1"){
+            $processStatistics=$this->conditionQuery($request,$processStatistics);
+            $excel=$this->export($processStatistics);
+            return $excel;
+        }
+        $id = explode( ',',$request->input('checkSign'));
+        $processStatistics=$processStatistics->whereIn('process_id',$id)->get();
+        $excel=$this->export($processStatistics);
+        return $excel;
+    }
+
+    //执行
+    public function export($processStatistics){
+        if(!Gate::allows('二次加工管理-查询')){ return '没有权限';  }
+        $row=[[
+            'process_id'=>'ID',
+            'code'=>'任务号',
+            'owner_name'=>'货主',
+            'started_at'=>'开始日期',
+            'ended_at'=>'完成日期',
+            'unit_price'=>'单价',
+            'amount'=>'预期数量',
+            'completed_amount'=>'完成数量',
+            'revenue'=>'收入合计',
+            'duration_days'=>'完成时间(天)',
+            'duration_man_hours'=>'总工时',
+            'process_method_name'=>'加工类型',
+            'top_capacity'=>'最高日产能',
+            'bottom_capacity'=>'最低日产能',
+            'average_capacity'=>'日均产能',
+            'total_cost'=>'合计成本',
+            'gross_profit'=>'毛利润',
+            'gross_profit_rate'=>'毛利率',
+            'status'=>'状态',
+        ]];
+        $list=[];
+        $i=0;
+        foreach ($processStatistics as $processStatistic){
+            $w=[
+                'process_id'=>$processStatistic->process_id,
+                'code'=>$processStatistic->process?$processStatistic->process->code:'',
+                'owner_name'=>$processStatistic->process?$processStatistic->process->owner_name:'',
+                'started_at'=>$processStatistic->started_at,
+                'ended_at'=>$processStatistic->ended_at,
+                'unit_price'=>$processStatistic->process?$processStatistic->process->unit_price:'',
+                'amount'=>$processStatistic->process?$processStatistic->process->amount:'',
+                'completed_amount'=>$processStatistic->process?$processStatistic->process->completed_amount:'',
+                'revenue'=>$processStatistic->revenue,
+                'duration_days'=>$processStatistic->duration_days,
+                'duration_man_hours'=>$processStatistic->duration_man_hours,
+                'process_method_name'=>$processStatistic->process?$processStatistic->process->process_method_name:'',
+                'top_capacity'=>$processStatistic->top_capacity,
+                'bottom_capacity'=>$processStatistic->bottom_capacity,
+                'average_capacity'=>$processStatistic->average_capacity,
+                'total_cost'=>$processStatistic->total_cost,
+                'gross_profit'=>$processStatistic->gross_profit,
+                'gross_profit_rate'=>round(($processStatistic->gross_profit_rate)*100,2).'%',
+                'status'=>$processStatistic->process?$processStatistic->process->status:'',
+            ];
+            $list[$i]=$w;
+            $i++;
+        }
+        return Excel::download(new WaybillExport($row,$list),date('YmdHis', time()).'-二次加工单.xls');
+    }
+}

+ 22 - 0
app/Http/Controllers/RejectedBillController.php

@@ -2,6 +2,8 @@
 
 namespace App\Http\Controllers;
 
+use App\Events\InformWMSReceivedEvent;
+use App\Http\Controllers\Api\thirdPart\flux\ReceiveController;
 use App\Logistic;
 use App\Owner;
 use App\QualityLabel;
@@ -106,6 +108,26 @@ class RejectedBillController extends Controller
         $this->log(__METHOD__,__FUNCTION__.'_'.$rejectedBill['id'],json_encode($request->toArray()),Auth::user()['id']);
         return ['success'=>'true'];
     }
+    public function apiConfirmBeStored(Request $request)
+    {
+        if(!Gate::allows('退货管理-编辑')){
+            return ['success'=>'false','fail_info'=>'没有权限'];
+        }
+        $rejectedBill = RejectedBill::find($request->input('id'));
+
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"人工确认入库。退单号:".$rejectedBill['logistic_number_return'],Auth::user()['id']);
+        $result_TransferToWMS=ReceiveController::accomplishToWMS($rejectedBill);
+
+        $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
+        switch ($result_TransferToWMS){
+            case 'success':
+                $rejectedBill['is_loaded']=1;
+                $rejectedBill->update();
+                return ['success'=>true];
+            case 'fail':
+            case 'exception':return ['success'=>false];
+        }
+    }
 
 
     protected function validator(array $data,$isUpdate=false)

+ 24 - 23
app/Http/Controllers/RejectedBillItemController.php

@@ -151,7 +151,7 @@ class RejectedBillItemController extends Controller
         }
         $item=$rejectedBillItems->first();
         $rejectedBill = RejectedBill::find($item['id_rejected_bill']);
-        if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,'请求处理退单:'.$rejectedBill['logistic_number_return'],Auth::user()['id']);
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,'请求处理退单:'.$rejectedBill['logistic_number_return'],Auth::user()['id']);
         $downloadedSkus = WMSReflectReceive::downloadedSkus($rejectedBill['logistic_number_return'],true);
         $isGotMoreThenDownloaded=WMSReflectReceiveSku::isItemsOverDownloadedSkus($rejectedBillItems,$downloadedSkus);
         $isJianshang=(function($rejectedBill){
@@ -161,7 +161,7 @@ class RejectedBillItemController extends Controller
             }
             return false;
         })($rejectedBill);
-        if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"当前,实收件:(".json_encode($rejectedBillItems).")},下载件:("
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"当前,实收件:(".json_encode($rejectedBillItems).")},下载件:("
             .json_encode($downloadedSkus).")},退单号:{$rejectedBill['logistic_number_return']}",null);
 
 
@@ -169,24 +169,25 @@ class RejectedBillItemController extends Controller
         if(!$isGotMoreThenDownloaded    //没有录入超过下载货物数
             && !($rejectedBill['is_loaded']==1||$rejectedBill['is_loaded']===null)//并且不是已入库或无需入库
             &&config('api.api_switch_receive_to_wms')){ //并且配置开
-            if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,'满足条件,准备从网页主动请求富勒入库:'.$rejectedBill['logistic_number_return'],Auth::user()['id']);
-            $informed=(new InformWMSReceivedEvent($rejectedBill))->directRun();  //!!!!
-            if(!$informed)return ['success'=>'false','fail_info'=>'提交至WMS错误,请重试并通知相关人员'];
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,'满足条件,准备从网页主动请求富勒入库:'.$rejectedBill['logistic_number_return'],Auth::user()['id']);
+            $result_transferToWms=(new InformWMSReceivedEvent($rejectedBill))->directRun();
+            if($result_transferToWms=='fail')return ['success'=>'false','fail_info'=>'提交至WMS错误,请手动校验、操作WMS并通知相关人员'];
+            if($result_transferToWms=='exception')return ['success'=>'exception','fail_info'=>'提交至WMS部分成功,存在异常情况,请校对WMS'];
             $isLoaded=false;
             if($isJianshang){
                 $isLoaded=true;
             }
-            if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,'标记前端是否入库为:'.$isLoaded,Auth::user()['id']);
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,'标记前端是否入库为:'.$isLoaded,Auth::user()['id']);
             return ['success'=>'true','bill_is_loaded'=>$isLoaded];
         }
 
         $remoteResultStr='';
         if($isJianshang){
-            if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"不满足入库条件,准备发送给笕尚处理,退单号:{$rejectedBill['logistic_number_return']}",Auth::user()['id']);
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"不满足入库条件,准备发送给笕尚处理,退单号:{$rejectedBill['logistic_number_return']}",Auth::user()['id']);
             $remoteResultStr=$this->sendRejectedToThirdPart2($rejectedBillItems,$rejectedBill);//不能入库所以发送给笕尚处理   !!!!
         }
 
-        if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"前端退单处理请求完成:笕尚入库状态为:{$remoteResultStr},退单号: {$rejectedBill['logistic_number_return']},退单ID:{$rejectedBill['id']},form表单:".json_encode($request->toArray()),Auth::user()['id']);
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"前端退单处理请求完成:笕尚入库状态为:{$remoteResultStr},退单号: {$rejectedBill['logistic_number_return']},退单ID:{$rejectedBill['id']},form表单:".json_encode($request->toArray()),Auth::user()['id']);
         return ['success'=>'true','remote_result'=>$remoteResultStr];
     }
 
@@ -221,10 +222,10 @@ class RejectedBillItemController extends Controller
         return true;
     }
 
-    public function sendRejectedToThirdPart2(Collection $items,$rejectedBill):bool {
-        if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"进入发送方法,发送给笕尚处理,退单号:{$rejectedBill['logistic_number_return']}",Auth::user()['id']);
+    public function sendRejectedToThirdPart2(Collection $items,$rejectedBill) {
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"进入发送方法,发送给笕尚处理,退单号:{$rejectedBill['logistic_number_return']}",Auth::user()['id']);
         if($rejectedBill['is_loaded']!=0){
-            if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"进入发送方法,但退单已入库,跳出!退单号:{$rejectedBill['logistic_number_return']}",Auth::user()['id']);
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"进入发送方法,但退单已入库,跳出!退单号:{$rejectedBill['logistic_number_return']}",Auth::user()['id']);
             return true;
         }
         $rejected=new Rejected();
@@ -235,17 +236,17 @@ class RejectedBillItemController extends Controller
         });
         $rejectedJianshang=new api\thirdPart\jianshang\RejectedController();
         $rejected['goodses']=$goodses;
-        if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"进入发送方法,将商品转成数组,准备进入接口!退单号:{$rejectedBill['logistic_number_return']}",Auth::user()['id']);
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"进入发送方法,将商品转成数组,准备进入接口!退单号:{$rejectedBill['logistic_number_return']}",Auth::user()['id']);
         $resultStr= $rejectedJianshang->sendRejected2($rejected);   //!!!
 
-        if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"发送笕尚取得结果是:{$resultStr}!退单号:{$rejectedBill['logistic_number_return']}",Auth::user()['id']);
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"发送笕尚取得结果是:{$resultStr}!退单号:{$rejectedBill['logistic_number_return']}",Auth::user()['id']);
         if($resultStr=='fail'){
-            if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"发送失败,笕尚取得结果是:{$resultStr}!返回前端。退单号:{$rejectedBill['logistic_number_return']}",Auth::user()['id']);
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"发送失败,笕尚取得结果是:{$resultStr}!返回前端。退单号:{$rejectedBill['logistic_number_return']}",Auth::user()['id']);
             return $resultStr;
         }
         //
         if($resultStr=='storable'){
-            if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"发送成功,可入,但待推单,笕尚取得结果是:{$resultStr}!返回前端。退单号:{$rejectedBill['logistic_number_return']}",Auth::user()['id']);
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"发送成功,可入,但待推单,笕尚取得结果是:{$resultStr}!返回前端。退单号:{$rejectedBill['logistic_number_return']}",Auth::user()['id']);
             $rejectedBill = RejectedBill::find($rejectedBill['id']);
             $rejectedBill->is_loaded=2;
             $rejectedBill->save();
@@ -254,16 +255,16 @@ class RejectedBillItemController extends Controller
                 $item->save();
             });
 
-            if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"标记退单和商品为待推单!退单号:{$rejectedBill['logistic_number_return']}",Auth::user()['id']);
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"标记退单和商品为待推单!退单号:{$rejectedBill['logistic_number_return']}",Auth::user()['id']);
             //标记WMS所有该退单下的作废(为已上传) 。应检查这里是否正确!
-            $receives=WMSReflectReceive::where('ASNREFERENCE3',$rejectedBill['logistic_number_return'])->where('is_uploaded',0)->get();
-            $receives->each(function ($receive){
-                $receive['is_uploaded']=1;
-                $receive->save();
-            });
-            if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"标记退单在WMS映表为已上传!退单号:{$rejectedBill['logistic_number_return']}",Auth::user()['id']);
+//            $receives=WMSReflectReceive::where('ASNREFERENCE3',$rejectedBill['logistic_number_return'])->where('is_uploaded',0)->get();
+//            $receives->each(function ($receive){
+//                $receive['is_uploaded']=1;
+//                $receive->save();
+//            });
+//            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"标记退单在WMS映表为已上传!退单号:{$rejectedBill['logistic_number_return']}",Auth::user()['id']);
         }
-        if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"处理完成,返回前端入库状态,标记笕尚取得结果是:{$resultStr}!退单号:{$rejectedBill['logistic_number_return']}",Auth::user()['id']);
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"处理完成,返回前端入库状态,标记笕尚取得结果是:{$resultStr}!退单号:{$rejectedBill['logistic_number_return']}",Auth::user()['id']);
         return $resultStr;
     }
 

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

@@ -178,7 +178,7 @@ class RejectedController extends Controller
             $rejectedBillsQueryTem=$rejectedBillsQueryTem->where('order_number','like','%'.$order_number.'%');
             if($rejectedBillsQueryTem->count()==0
                 ||$rejectedBillsQueryTem->first()['order_number']==$order_number){
-                $rejectedBillsQuery=$rejectedBillsQuery->where('order_number','like','%'.$order_number.'%');
+                $rejectedBillsQuery=$rejectedBillsQuery->where('order_number',$order_number);
             }else{
                 $rejectedBillsQuery=$rejectedBillsQueryTem;
             }
@@ -190,7 +190,7 @@ class RejectedController extends Controller
             $rejectedBillsQueryTem=$rejectedBillsQueryTem->where('logistic_number_return','like','%'.$logistic_number_return.'%');
             if($rejectedBillsQueryTem->count()==0
                 ||$rejectedBillsQueryTem->first()['logistic_number_return']==$logistic_number_return){
-                $rejectedBillsQuery=$rejectedBillsQuery->where('logistic_number_return','like','%'.$logistic_number_return.'%');
+                $rejectedBillsQuery=$rejectedBillsQuery->where('logistic_number_return',$logistic_number_return);
             }else{
                 $rejectedBillsQuery=$rejectedBillsQueryTem;
             }
@@ -202,7 +202,7 @@ class RejectedController extends Controller
             $rejectedBillsQueryTem=$rejectedBillsQueryTem->where('logistic_number','like','%'.$logistic_number.'%');
             if($rejectedBillsQueryTem->count()==0
                 ||$rejectedBillsQueryTem->first()['logistic_number']==$logistic_number){
-                $rejectedBillsQuery=$rejectedBillsQuery->where('logistic_number','like','%'.$logistic_number.'%');
+                $rejectedBillsQuery=$rejectedBillsQuery->where('logistic_number',$logistic_number);
             }else{
                 $rejectedBillsQuery=$rejectedBillsQueryTem;
             }

+ 30 - 37
app/Http/Controllers/TestController.php

@@ -5,31 +5,20 @@ namespace App\Http\Controllers;
 
 use App\Authority;
 use App\Batch;
-use App\Carrier;
-use App\Commodity;
-use App\CommodityBarcode;
 use App\Events\CancelOrder;
-use App\Events\WeighedEvent;
 use App\Events\WmsReceiveNewEvent;
-use App\Jobs\MeasuringMachineQueue;
-use App\Jobs\ProcessReceiveCombinedJob;
+use App\Http\Controllers\Api\thirdPart\flux\WaybillController;
 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\Waybill;
 use App\WMSReflectReceive;
 use Carbon\Carbon;
-use Illuminate\Database\Eloquent\Builder;
-use Illuminate\Database\Eloquent\Collection;
+use Endroid\QrCode\Response\QrCodeResponse;
 use Illuminate\Http\Request;
-use Illuminate\Support\Facades\Gate;
 use Zttp\Zttp;
 
 class TestController extends Controller
@@ -44,7 +33,10 @@ class TestController extends Controller
         return call_user_func([$this, $method],$request);
     }
     function t1(Request $request){ //x
-        dd(date('Y-m-d h:i:s',1586481486));
+        $waybill = Waybill::orderBy('id','desc')->first();
+        $waybill['wms_bill_number'] = 'SO20050600007';
+        $waybill['waybill_number'] = 'WBZFx1234914';
+        dd((new WaybillController())->accomplishToWMS($waybill));
     }
     function tj(Request $request){
         $bills=RejectedBill::where('is_loaded',2)->where('created_at','<',Carbon::now()->subHours(10)->toDateTimeString());
@@ -134,27 +126,28 @@ class TestController extends Controller
     }
 
     public function test1(){
-  /*      $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();
+        $a=OracleBas_SKU::limit(10)->get();
+        dd($a);
+        /*$pdo= new PDO("oci:dbname=106.14.148.85:1521/orcl","viewer","viewer");
+dd($pdo);*/
+        $db="(DESCRIPTION =
+        (ADDRESS_LIST =
+          (ADDRESS = (PROTOCOL = TCP)(HOST = 106.14.148.85)(PORT = 1521))
+        )
+        (CONNECT_DATA =
+          (SERVER = DEDICATED)
+          (SERVICE_NAME = orcl)
+        ))";
+        $conn = oci_connect('viewer', 'viewer', '106.14.148.85:1521/orcl');
+        if (!$conn) {
+            $e = oci_error();
+            print htmlentities($e['message']);
+            exit;
+        }else {
+            echo "连接oracle成功!";
+        }
+        $basSku=oci_parse($conn, 'select * from "OracleBas_SKU"');
+        //$basSku=$conn->select('select * from "OracleBas_SKU"');
+        dd(oci_execute($basSku));
     }
 }

+ 143 - 0
app/Http/Controllers/TutorialController.php

@@ -0,0 +1,143 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Owner;
+use App\Tutorial;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Gate;
+use Illuminate\Support\Facades\Validator;
+use Te7aHoudini\LaravelTrix\Models\TrixAttachment;
+use Te7aHoudini\LaravelTrix\Models\TrixRichText;
+
+class TutorialController extends Controller
+{
+    /**
+     * Display a listing of the resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function index()
+    {
+        $tutorials=Tutorial::select('id','owner_id','name','type','created_at')->paginate(50);
+        return view('maintenance.tutorial.index',['tutorials'=>$tutorials]);
+    }
+
+    /**
+     * Show the form for creating a new resource.
+     *
+     * @param Request $request
+     * @return \Illuminate\Http\Response
+     */
+    public function create(Request $request)
+    {
+        $response=[];
+        if ($request->input('owner_id'))$response['owner_id']=$request->input('owner_id');
+        $owners=Owner::get();
+        $response['owners']=$owners;
+        return view('maintenance.tutorial.create',$response);
+    }
+
+    /**
+     * Store a newly created resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @return \Illuminate\Http\Response
+     */
+    public function store(Request $request)
+    {
+        if(!Gate::allows('教程-录入')){ return redirect(url('/'));  }
+        $this->validator($request)->validate();
+        $tutorial=Tutorial::create(['owner_id'=>$request->input('owner_id'),'name'=>$request->input('name')]);
+        $tutorial['tutorial-trixFields']=request('tutorial-trixFields');
+        $tutorial['attachment-tutorial-trixFields']=request('attachment-tutorial-trixFields');
+        $tutorial->save();
+        return redirect('maintenance/tutorial')->with('successTip','新教程“'.$request->input('name').'”添加成功');
+    }
+
+    //展示教程内容
+    public function showContent($id){
+        if(!Gate::allows('教程-查询')){ return redirect(url('/'));  }
+        $tutorial=Tutorial::with('trixRichText')->find($id);
+        if ($tutorial&&$tutorial->trixRichText)return ['success'=>true,'data'=>$tutorial->trixRichText->content];
+        return ['success'=>false];
+    }
+
+    /**
+     * 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)
+    {
+        if(!Gate::allows('教程-编辑')){ return redirect(url('/'));  }
+        $tutorial=Tutorial::with('trixRichText')->find($id);
+        $owners=Owner::get();
+        return view('maintenance.tutorial.edit',['owners'=>$owners,'tutorial'=>$tutorial]);
+    }
+
+    /**
+     * Update the specified resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  int  $id
+     * @return \Illuminate\Http\Response
+     */
+    public function update(Request $request, $id)
+    {
+        if(!Gate::allows('教程-编辑')){ return redirect(url('/'));  }
+        $this->validator($request)->validate();
+        $tutorial=Tutorial::find($id);
+        $tutorial->owner_id=$request->input('owner_id');
+        $tutorial->name=$request->input('name');
+        $tutorial['tutorial-trixFields']=request('tutorial-trixFields');
+        $tutorial['attachment-tutorial-trixFields']=request('attachment-tutorial-trixFields');
+        $tutorial->update();
+        return redirect('maintenance/tutorial')->with('successTip','教程“'.$request->input('name').'”修改成功');
+    }
+
+    /**
+     * Remove the specified resource from storage.
+     *
+     * @param  int  $id
+     * @return \Illuminate\Http\Response
+     */
+    public function destroy($id)
+    {
+        if(!Gate::allows('教程-删除')){ return redirect(url('/'));  }
+        $tutorial=Tutorial::find($id);
+        $tutorial->delete();
+        TrixRichText::where('model_id',$id)->delete();
+        $attachments = TrixAttachment::where('attachable_id', $id)->get();
+        foreach ($attachments as $attachment){
+            optional($attachment)->purge();
+        }
+        return ['success'=>true];
+    }
+
+    public function validator(Request $request){
+        $validator=Validator::make($request->input(),[
+            'name'=>['required','max:50'],
+            'owner_id'=>['required','integer'],
+        ],[
+            'required'=>':attribute 为必填项',
+            'max'=>':attribute 输入过长',
+        ],[
+            'name'=>'标题',
+            'owner_id'=>'货主',
+        ]);
+        return $validator;
+    }
+}

+ 152 - 0
app/Http/Controllers/UserDutyCheckController.php

@@ -0,0 +1,152 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\User;
+use App\UserDetail;
+use App\UserDutyCheck;
+use App\UserLabor;
+use Carbon\Carbon;
+use Endroid\QrCode\QrCode;
+use Illuminate\Http\Request;
+use Illuminate\Http\Response;
+use Illuminate\Support\Facades\Cache;
+use Illuminate\Support\Facades\Validator;
+use Ramsey\Uuid\Uuid;
+
+class UserDutyCheckController extends Controller
+{
+    //获取二维码
+    public function getQRCode(){
+        $qrCode_refresh_everyday=config('hr.qrCode_refresh_everyday');
+        if ($qrCode_refresh_everyday){
+            $date=md5(date('Y-m-d'));
+            $url=url("userDutyCheck/clock?key=").$date;
+        }else{
+            $url=url("userDutyCheck/clock");
+        }
+        $qrCode=new QrCode($url);
+        return (new Response())->header('Content-Type',$qrCode->getContentType())->setContent($qrCode->writeString());
+    }
+
+    //校验二维码进入打卡页面
+    public function clock(Request $request){
+        $qrCode_refresh_everyday=config('hr.qrCode_refresh_everyday');
+        if ($qrCode_refresh_everyday){
+            $key=$request->input('key');
+            if (!$key) return "二维码失效!";
+            $date=md5(date('Y-m-d'));
+            if ($key!=$date) return "二维码失效!";
+        }
+        $userLaborToken=$request->cookie('userLaborToken');
+        if ($userLaborToken && Cache::has('tokenStr_'.$userLaborToken)) {
+            $user_id=Cache::get('tokenStr_'.$userLaborToken);
+            $userDetail=UserDetail::find($user_id);
+            if (!$userDetail)   return redirect('userDutyCheck/createUserDetail/'.$userDetail->mobile_phone);
+            $userDutyCheck=$this->dutyCheck($userDetail->user_id);
+            if (!$userDutyCheck)return "<h1 style='color: red'>打卡异常,请联系相关人员!</h1>";
+            return response()->view('process/checking-in/success',['full_name'=>$userDetail->full_name,'checked_at'=>$userDutyCheck->checked_at]);
+        }
+        return view("process/checking-in/clock");
+    }
+
+    //提交打卡
+    public function storeClock(Request $request){
+        $mobile_phone=$request->input('mobile_phone');
+        $this->validator($request)->validate();
+        $userDetail=UserDetail::where('mobile_phone',$mobile_phone)->first();
+        if (!$userDetail)   return redirect('userDutyCheck/createUserDetail/'.$mobile_phone);
+        $user=User::find($userDetail->user_id);
+        if (Cache::has('tokenUser_'.$user->id))return "<h1 style='color: red'>请使用原有设备进行打卡,如无法使用原有设备请联系管理人员解绑设备!</h1>";
+        $userDutyCheck=$this->dutyCheck($userDetail->user_id);
+        if (!$userDutyCheck)return "<h1 style='color: red'>打卡异常,请联系相关人员!</h1>";
+        $userLaborToken=$user->token(config('users.token_check_in_expire_minutes'));
+        return response()->view('process/checking-in/success',['full_name'=>$userDetail->full_name,'checked_at'=>$userDutyCheck->checked_at])
+            ->cookie('userLaborToken',$userLaborToken,config('users.token_check_in_expire_minutes'),'/');
+    }
+    //去往登记资料页面
+    public function createUserDetail($mobile_phone){
+        return view('process/checking-in/createUserDetail',['mobile_phone'=>$mobile_phone]);
+    }
+
+    //提交登记资料
+    public  function storeUserDetail(Request $request){
+        $this->validator($request)->validate();
+        $mobile_phone=$request->input('mobile_phone');
+        $full_name=$request->input('full_name');
+        $user=new User([
+            'name'=>$mobile_phone,
+            'password'=>Uuid::uuid1(),
+        ]);
+        $user->save();
+        $userDetail=new UserDetail([
+            'user_id'=>$user->id,
+            'full_name'=>$full_name,
+            'gender'=>$request->input('gender'),
+            'mobile_phone'=>$mobile_phone,
+            'type'=>'临时工',
+        ]);
+        $userDetail->save();
+        $userLabor=new UserLabor([
+            'user_id'=>$user->id,
+            'company'=>$request->input('company'),
+        ]);
+        $userLabor->save();
+        $userDutyCheck=$this->dutyCheck($user->id);
+        if (!$userDutyCheck)return "<h1 style='color: red'>打卡异常,请联系相关人员!</h1>";
+        $userLaborToken=$user->token(config('users.token_check_in_expire_minutes'));
+        return response()->view('process/checking-in/success',['full_name'=>$userDetail->full_name,'checked_at'=>$userDutyCheck->checked_at])
+            ->cookie('userLaborToken',$userLaborToken,config('users.token_check_in_expire_minutes'),'/');
+    }
+
+    //根据用户提交打卡记录
+    public function dutyCheck($user_id){
+        $userDutyCheckOld=UserDutyCheck::where('user_id',$user_id)->orderBy('checked_at','DESC')->limit(10)->first();
+        $date=date('Y-m-d H:i:s');
+        $userDutyCheck=new UserDutyCheck([
+            'user_id'=>$user_id,
+            'checked_at'=>$date,
+            'source'=>'正常',
+        ]);
+        if (!$userDutyCheckOld){
+            $userDutyCheck->type="登入";
+            $userDutyCheck->save();
+            return $userDutyCheck;
+        }
+        $lastDate=Carbon::parse($userDutyCheckOld->checked_at);
+        $thisDate=Carbon::parse($date);
+        $diffDate=$thisDate->diffInMinutes($lastDate);
+        if ($userDutyCheckOld->type=="登入"){
+            switch ($diffDate){
+                case $diffDate<=20:
+                    $userDutyCheck->type="登入";
+                    break;
+                case $diffDate>=1380:
+                    $userDutyCheck->type="登入";
+                    break;
+                default:
+                    $userDutyCheck->type="登出";
+            }
+        }
+        if ($userDutyCheckOld->type=="登出"){
+            switch ($diffDate){
+                case $diffDate<=20:
+                    $userDutyCheck->type="登出";
+                    break;
+                default:
+                    $userDutyCheck->type="登入";
+            }
+        }
+        $userDutyCheck->save();
+        return $userDutyCheck;
+    }
+
+    public function validator(Request $request){
+        $validator=Validator::make($request->input(),[
+            'full_name'=>['filled'],
+            'gender'=>['filled'],
+            'mobile_phone'=>['required','integer','digits:11'],
+        ],[],[]);
+        return $validator;
+    }
+}

+ 175 - 0
app/Http/Controllers/UserLaborController.php

@@ -0,0 +1,175 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\ProcessDailyParticipant;
+use App\User;
+use App\UserDetail;
+use App\UserDutyCheck;
+use App\UserLabor;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Cache;
+use Illuminate\Support\Facades\Gate;
+use Illuminate\Support\Facades\Validator;
+use Illuminate\Validation\Rule;
+
+class UserLaborController extends Controller
+{
+    /**
+     * Display a listing of the resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function index()
+    {
+        $userLabors=UserLabor::with('userDetail')->paginate(50);
+        return view('maintenance.userLabor.index',['userLabors'=>$userLabors]);
+    }
+
+    /**
+     * Show the form for creating a new resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function create()
+    {
+        //
+    }
+
+    public function relieve(Request $request){
+        $user_id=$request->input('user_id');
+        if (!$user_id) return ['error'=>'传递空值!'];
+        $token=Cache::pull('tokenUser_'.$user_id);
+        if ($token)Cache::pull('tokenStr_'.$token);
+        return ['success'=>true];
+    }
+
+    /**
+     * 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)
+    {
+        if(!Gate::allows('临时工-查询')){ return redirect(url('/'));  }
+        $userLabor=UserLabor::with('userDetail')->find($id);
+        return view('maintenance.userLabor.show',['userLabor'=>$userLabor]);
+    }
+    //获取劳务记录
+    public function getWorkRecord(Request $request){
+        if(!Gate::allows('临时工-查询')){ return redirect(url('/'));  }
+        $user_id=$request->input('user_id');
+        if (!$user_id)return ['error'=>'提交ID失败!'];
+        $processDailyParticipants=ProcessDailyParticipant::with('processDaily')
+            ->where('user_id',$user_id)->orderBy('created_at','DESC')->limit(20)->get();
+        return $processDailyParticipants;
+    }
+    //获取打卡记录
+    public function getClockRecord(Request $request){
+        if(!Gate::allows('临时工-查询')){ return redirect(url('/'));  }
+        $user_id=$request->input('user_id');
+        if (!$user_id)return ['error'=>'提交ID失败!'];
+        $userDutyChecks=UserDutyCheck::orderBy('checked_at','DESC')->where('user_id',$user_id)->limit(20)->get();
+        return $userDutyChecks;
+    }
+
+    /**
+     * Show the form for editing the specified resource.
+     *
+     * @param  int  $id
+     * @return \Illuminate\Http\Response
+     */
+    public function edit($id)
+    {
+        if(!Gate::allows('临时工-编辑')){ return redirect(url('/'));  }
+        $userLabor=UserLabor::with('userDetail')->find($id);
+        return view('maintenance.userLabor.edit',['userLabor'=>$userLabor]);
+    }
+
+    /**
+     * Update the specified resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  int  $id
+     * @return \Illuminate\Http\Response
+     */
+    public function update(Request $request, $id)
+    {
+        if(!Gate::allows('临时工-编辑')){ return redirect(url('/'));  }
+        Validator::make($request->input(),[
+            'full_name'=>'required|max:10',
+            'mobile_phone'=>['required','integer','digits:11'],
+            'gender'=>['required',Rule::in(['男', '女']),],
+            'identity_number'=>'nullable',
+            'default_hour_price'=>'nullable|min:0|max:999999|numeric',
+            'company'=>'nullable',
+        ],[
+            'required'=>':attribute 不应为空',
+            'min'=>':attribute 不得为0或为负',
+            'numeric'=>':attribute 必须为数字',
+            'max'=>':attribute 输入值过大或过长',
+            'integer'=>':attribute 选择错误',
+        ],[
+            'full_name'=>'姓名',
+            'mobile_phone'=>'电话',
+            'gender'=>'性别',
+            'identity_number'=>'身份证号',
+            'default_hour_price'=>'默认计时工资',
+            'company'=>'劳务所',
+        ])->validate();
+        $userDetail=UserDetail::find($id);
+        $userDetail->full_name=$request->input('full_name');
+        $userDetail->mobile_phone=$request->input('mobile_phone');
+        $userDetail->gender=$request->input('gender');
+        $userDetail->identity_number=$request->input('identity_number');
+        $userDetail->update();
+        $this->log(__METHOD__,"修改用户详情".__FUNCTION__,json_encode($userDetail),Auth::user()['id']);
+        $default_hour_price=$request->input('default_hour_price');
+        $company=$request->input('company');
+        $userLabor=UserLabor::find($id);
+        if ($userLabor->default_hour_price!=$default_hour_price || $userLabor->company!=$company){
+            $userLabor->default_hour_price=$default_hour_price;
+            $userLabor->company=$company;
+            $userLabor->update();
+            $this->log(__METHOD__,"修改临时工".__FUNCTION__,json_encode($userLabor),Auth::user()['id']);
+        }
+        return redirect('maintenance/userLabor')->with('successTip','临时工“'.$userDetail->full_name.'”信息修改成功!');
+    }
+
+    /**
+     * Remove the specified resource from storage.
+     *
+     * @param  int  $id
+     * @return \Illuminate\Http\Response
+     */
+    public function destroy($id)
+    {
+        if(!Gate::allows('临时工-删除')){ return redirect(url('/'));  }
+        $userDetail=UserDetail::find($id);
+        $user=User::find($id);
+        $userLabor=UserLabor::find($id);
+        if (!$userDetail || !$user || !$userLabor){
+            return ['error'=>'未找到对应临时工'];
+        }
+        $userDetail->delete();
+        $this->log(__METHOD__,"删除用户详情".__FUNCTION__,json_encode($userDetail),Auth::user()['id']);
+        $user->delete();
+        $this->log(__METHOD__,"删除临时工用户".__FUNCTION__,json_encode($user),Auth::user()['id']);
+        $userLabor->delete();
+        $this->log(__METHOD__,"删除临时工".__FUNCTION__,json_encode($userLabor),Auth::user()['id']);
+        return ['success'=>true];
+    }
+}

+ 85 - 0
app/Http/Controllers/WMSWaybillController.php

@@ -0,0 +1,85 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\WMSWaybill;
+use Illuminate\Http\Request;
+
+class WMSWaybillController extends Controller
+{
+    /**
+     * Display a listing of the resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function index()
+    {
+        //
+    }
+
+    /**
+     * 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  \App\WMSWaybill  $wMSWaybill
+     * @return \Illuminate\Http\Response
+     */
+    public function show(WMSWaybill $wMSWaybill)
+    {
+        //
+    }
+
+    /**
+     * Show the form for editing the specified resource.
+     *
+     * @param  \App\WMSWaybill  $wMSWaybill
+     * @return \Illuminate\Http\Response
+     */
+    public function edit(WMSWaybill $wMSWaybill)
+    {
+        //
+    }
+
+    /**
+     * Update the specified resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \App\WMSWaybill  $wMSWaybill
+     * @return \Illuminate\Http\Response
+     */
+    public function update(Request $request, WMSWaybill $wMSWaybill)
+    {
+        //
+    }
+
+    /**
+     * Remove the specified resource from storage.
+     *
+     * @param  \App\WMSWaybill  $wMSWaybill
+     * @return \Illuminate\Http\Response
+     */
+    public function destroy(WMSWaybill $wMSWaybill)
+    {
+        //
+    }
+}

+ 85 - 0
app/Http/Controllers/WMSWaybillOrderController.php

@@ -0,0 +1,85 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\WMSWaybillOrder;
+use Illuminate\Http\Request;
+
+class WMSWaybillOrderController extends Controller
+{
+    /**
+     * Display a listing of the resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function index()
+    {
+        //
+    }
+
+    /**
+     * 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  \App\WMSWaybillOrder  $wMSWaybillOrder
+     * @return \Illuminate\Http\Response
+     */
+    public function show(WMSWaybillOrder $wMSWaybillOrder)
+    {
+        //
+    }
+
+    /**
+     * Show the form for editing the specified resource.
+     *
+     * @param  \App\WMSWaybillOrder  $wMSWaybillOrder
+     * @return \Illuminate\Http\Response
+     */
+    public function edit(WMSWaybillOrder $wMSWaybillOrder)
+    {
+        //
+    }
+
+    /**
+     * Update the specified resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \App\WMSWaybillOrder  $wMSWaybillOrder
+     * @return \Illuminate\Http\Response
+     */
+    public function update(Request $request, WMSWaybillOrder $wMSWaybillOrder)
+    {
+        //
+    }
+
+    /**
+     * Remove the specified resource from storage.
+     *
+     * @param  \App\WMSWaybillOrder  $wMSWaybillOrder
+     * @return \Illuminate\Http\Response
+     */
+    public function destroy(WMSWaybillOrder $wMSWaybillOrder)
+    {
+        //
+    }
+}

+ 92 - 49
app/Http/Controllers/WaybillsController.php

@@ -2,9 +2,7 @@
 
 namespace App\Http\Controllers;
 
-use App\Events\CustomerStored;
-use App\MeasuringMachine;
-use App\Package;
+
 use App\WaybillAuditLog;
 use App\WaybillPriceModel;
 use App\Carrier;
@@ -27,13 +25,26 @@ use Ramsey\Uuid\Uuid;
 
 class WaybillsController extends Controller
 {
-    public function conditionQuery(Request $request,$waybills){
+    //超15天精确查询抽离 cloumn前提:数据库字段名必须与request内字段名一致
+    public function preciseQuery(string $column,Request $request,$waybills){
         $today=Carbon::now()->subDays(15);
+        $waybillsTem=clone $waybills;
+        $waybillsTem=$waybillsTem->where($column,'like','%'.$request->input($column).'%')->where('created_at','>',$today->format('Y-m-d'));
+        if($waybillsTem->count()==0
+            ||$waybillsTem->first()[$column]==$request->input($column)){
+            $waybills=$waybills->where($column,$request->input($column));
+        }else{
+            $waybills=$waybillsTem;
+        }
+        return $waybills;
+    }
+
+    public function conditionQuery(Request $request,$waybills){
         if ($request->input('waybill_number')){
-            $waybills =$waybills->where('waybill_number','like','%'.$request->input('waybill_number').'%')->where('created_at','>',$today->format('Y-m-d'));
+            $waybills=$this->preciseQuery("waybill_number",$request,$waybills);
         }
         if ($request->input('carrier_bill')){
-            $waybills=$waybills->where('carrier_bill','like','%'.$request->input('carrier_bill').'%')->where('created_at','>',$today->format('Y-m-d'));
+            $waybills=$this->preciseQuery("carrier_bill",$request,$waybills);
         }
         if ($request->input('carrier_id')){
             $waybills=$waybills->where('carrier_id','=',$request->input('carrier_id'));
@@ -42,13 +53,13 @@ class WaybillsController extends Controller
             $waybills=$waybills->where('owner_id','=',$request->input('owner_id'));
         }
         if ($request->input('wms_bill_number')){
-            $waybills=$waybills->where('wms_bill_number','like','%'.$request->input('wms_bill_number').'%')->where('created_at','>',$today->format('Y-m-d'));
+            $waybills=$this->preciseQuery("wms_bill_number",$request,$waybills);
         }
         if ($request->input('origination')){
-            $waybills=$waybills->where('origination','like','%'.$request->input('origination').'%')->where('created_at','>',$today->format('Y-m-d'));
+            $waybills=$this->preciseQuery("origination",$request,$waybills);
         }
         if ($request->input('destination')){
-            $waybills=$waybills->where('destination','like','%'.$request->input('destination').'%')->where('created_at','>',$today->format('Y-m-d'));
+            $waybills=$this->preciseQuery("destination",$request,$waybills);
         }
         if ($request->input('created_at_start')){
             $waybills=$waybills->where('created_at','>',$request->input('created_at_start'));
@@ -369,6 +380,33 @@ class WaybillsController extends Controller
         $destination_city_id=$request->input('destination_city_id');
         $carrier_weight=$request->input('carrier_weight');
         $carrier_weight_unit_id=$request->input('carrier_weight_unit_id');
+        $validatorData=["carrier_id"=>$carrier_id,"destination_city_id"=>$destination_city_id,
+            'carrier_weight'=>$carrier_weight[0],"carrier_weight_unit_id"=>$carrier_weight_unit_id[0],
+            "carrier_weight_other"=>$carrier_weight[1],"carrier_weight_unit_id_other"=>$carrier_weight_unit_id[1]];
+        $errors=Validator::make($validatorData,[
+            'carrier_id'=>'required|integer',
+            'destination_city_id'=>'required|integer',
+            'carrier_weight'=>'nullable|min:0|numeric|max:999999',
+            'carrier_weight_unit_id'=>'required_with:carrier_weight',
+            'carrier_weight_other'=>'nullable|min:0|numeric|max:999999',
+            'carrier_weight_unit_id_other'=>'required_with:carrier_weight_other',
+        ],[
+            'required'=>':attribute 为必填项',
+            'max'=>':attribute 字符过多或输入值过大',
+            'min'=>':attribute 不得为负',
+            'numeric'=>':attribute 应为数字',
+            'unique'=>':attribute 已存在',
+            'required_with'=>':attribute 未填',
+            'integer'=>':attribute 必须为数字',
+        ],[
+            'carrier_weight'=>'承运商计数(抛)',
+            'carrier_id'=>'承运商',
+            'destination_city_id'=>'目的市',
+            'carrier_weight_unit_id'=>'承运商计数单位',
+            'carrier_weight_other'=>'承运商计数二',
+            'carrier_weight_unit_id_other'=>'承运商计数单位二',
+        ])->errors();
+        if (count($errors)>0)return ['error'=>$errors];
         $result=$this->checkWaybillPriceModel($carrier_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id);
         if (!$result){
             //单位为kg,T时
@@ -687,48 +725,53 @@ class WaybillsController extends Controller
             ]);
             return $validator;
         }else if ($request->input('type')=='专线'){
-            $validator=Validator::make($request->input(),[
-                'carrier_bill'=>"nullable|max:50|unique:waybills,carrier_bill,$id",
-                'pick_up_fee'=>'nullable|min:0|numeric|max:999999',
-                'other_fee'=>'nullable|min:0|numeric|max:999999',
-                'carrier_id'=>'required|integer',
-                'destination_city_id'=>'required|integer',
-                'warehouse_weight'=>'nullable|min:0|numeric|max:999999',
-                'carrier_weight'=>'nullable|min:0|numeric|max:999999',
-                'warehouse_weight_unit_id'=>'required_with:warehouse_weight|integer',
-                'carrier_weight_unit_id'=>'required_with:carrier_weight|integer',
-                'warehouse_weight_other'=>'nullable|min:0|numeric|max:999999',
-                'carrier_weight_other'=>'nullable|min:0|numeric|max:999999',
-                'warehouse_weight_unit_id_other'=>'required_with:warehouse_weight_other|integer',
-                'carrier_weight_unit_id_other'=>'required_with:carrier_weight_other|integer',
-                'charge'=>'nullable|min:0|numeric|max:999999',
-            ],[
-                'required'=>':attribute 为必填项',
-                'alpha_num'=>':attribute 应为字母或数字',
-                'max'=>':attribute 字符过多或输入值过大',
-                'min'=>':attribute 不得为负',
-                'numeric'=>':attribute 应为数字',
-                'unique'=>':attribute 已存在',
-                'required_with'=>':attribute 未填',
-            ],[
-                'carrier_bill'=>'承运商单号',
-                'warehouse_weight'=>'仓库计数(抛)',
-                'carrier_weight'=>'承运商计数(抛)',
-                'pick_up_fee'=>'提货费',
-                'other_fee'=>'其他费用',
-                'carrier_id'=>'承运商',
-                'destination_city_id'=>'目的市',
-                'carrier_weight_unit_id'=>'承运商计数单位',
-                'charge'=>'收费',
-                'warehouse_weight_unit_id'=>'仓库计数单位',
-                'warehouse_weight_other'=>'仓库计数二',
-                'carrier_weight_other'=>'承运商计数二',
-                'warehouse_weight_unit_id_other'=>'仓库技数单位二',
-                'carrier_weight_unit_id_other'=>'承运商计数单位二',
-            ]);
-            return $validator;
+            return $this->validatorWaybillZX($request,$id);
         }else{
             return false;
         }
     }
+
+    protected function validatorWaybillZX(Request $request,$id){
+        $validator=Validator::make($request->input(),[
+            'carrier_bill'=>"nullable|max:50|unique:waybills,carrier_bill,$id",
+            'pick_up_fee'=>'nullable|min:0|numeric|max:999999',
+            'other_fee'=>'nullable|min:0|numeric|max:999999',
+            'carrier_id'=>'required|integer',
+            'destination_city_id'=>'required|integer',
+            'warehouse_weight'=>'nullable|min:0|numeric|max:999999',
+            'warehouse_weight_unit_id'=>'required_with:warehouse_weight|integer',
+            'warehouse_weight_other'=>'nullable|min:0|numeric|max:999999',
+            'warehouse_weight_unit_id_other'=>'required_with:warehouse_weight_other|integer',
+            'charge'=>'nullable|min:0|numeric|max:999999',
+            'carrier_weight'=>'nullable|min:0|numeric|max:999999',
+            'carrier_weight_unit_id'=>'required_with:carrier_weight',
+            'carrier_weight_other'=>'nullable|min:0|numeric|max:999999',
+            'carrier_weight_unit_id_other'=>'required_with:carrier_weight_other',
+        ],[
+            'required'=>':attribute 为必填项',
+            'alpha_num'=>':attribute 应为字母或数字',
+            'max'=>':attribute 字符过多或输入值过大',
+            'min'=>':attribute 不得为负',
+            'numeric'=>':attribute 应为数字',
+            'unique'=>':attribute 已存在',
+            'required_with'=>':attribute 未填',
+            'integer'=>':attribute 必须为数字',
+        ],[
+            'carrier_bill'=>'承运商单号',
+            'warehouse_weight'=>'仓库计数(抛)',
+            'carrier_weight'=>'承运商计数(抛)',
+            'pick_up_fee'=>'提货费',
+            'other_fee'=>'其他费用',
+            'carrier_id'=>'承运商',
+            'destination_city_id'=>'目的市',
+            'carrier_weight_unit_id'=>'承运商计数单位',
+            'charge'=>'收费',
+            'warehouse_weight_unit_id'=>'仓库计数单位',
+            'warehouse_weight_other'=>'仓库计数二',
+            'carrier_weight_other'=>'承运商计数二',
+            'warehouse_weight_unit_id_other'=>'仓库技数单位二',
+            'carrier_weight_unit_id_other'=>'承运商计数单位二',
+        ]);
+        return $validator;
+    }
 }

+ 27 - 16
app/Http/Controllers/api/thirdPart/flux/PackageController.php

@@ -29,8 +29,22 @@ class PackageController extends Controller
                 'errors'=>$errors]];
         }
         $package=Package::where('logistic_number',$receiveInputs['SOReference5'])->first();
+        if (!$receiveInputs['Customer']) {
+            $this->log(__METHOD__, __FUNCTION__, '富勒没有下发货主!快递单号:'.$receiveInputs['SOReference5'] , null);
+        }
         $owner=Owner::select('id')->where('code',$receiveInputs['Customer'])->first();
-        $carrier=Logistic::select('id')->where('code',$receiveInputs['CarrierID'])->first();
+        if (!$owner&&$receiveInputs['SOReference5']) {
+            Owner::create(['code'=>$receiveInputs['Customer'],'name'=>$receiveInputs['Customer']]);
+            $this->log(__METHOD__, __FUNCTION__, '富勒下发找不到货主,添加. 快递单号:'.$receiveInputs['SOReference5'] , null);
+        }
+        if (!$receiveInputs['CarrierID']) {
+            $this->log(__METHOD__, __FUNCTION__, '富勒没有下发快递公司!快递单号:'.$receiveInputs['SOReference5'] , null);
+        }
+        $logistic=Logistic::select('id')->where('code',$receiveInputs['CarrierID'])->first();
+        if (!$logistic&&$receiveInputs['CarrierID']) {
+            Logistic::create(['code'=>$receiveInputs['CarrierID'],'name'=>$receiveInputs['CarrierID']]);
+            $this->log(__METHOD__, __FUNCTION__, '富勒下发找不到承运商,添加. 快递单号:' .$receiveInputs['SOReference5'] , null);
+        }
         if ($package) {
             $package->delivery_number = $receiveInputs['palletid'];
             if ($owner) {
@@ -42,7 +56,7 @@ class PackageController extends Controller
                 $package->status = '记录异常';
             }
             $package->recipient = $receiveInputs['Consigneename'];
-            if ($carrier) $package->logistic_id = $carrier->id;
+            if ($logistic) $package->logistic_id = $logistic->id;
             $package->batch_number = $receiveInputs['USERDEFINE1'];
             $package->batch_rule = $receiveInputs['USERDEFINE2'];
             $package->save();
@@ -53,9 +67,6 @@ class PackageController extends Controller
             } else {
                 $package->status = "上传异常";
             }
-            if (!$owner || !$carrier) {
-                $this->log(__METHOD__, 'fluxPackageApi(no owner or carrier)' . __FUNCTION__, json_encode($request->all()), null);
-            }
             $package->save();
             $this->log(__METHOD__, 'fluxPackageApi' . __FUNCTION__, json_encode($request->all()), null);
             return response()->json(['response' => ['flag' => 'Y', 'code' => '0000', 'message' => '正确接收']])
@@ -64,13 +75,13 @@ class PackageController extends Controller
         //package不存在
         $receive = new WMSReflectPackage($receiveInputs);
         $receive->save();
-        if (isset($owner->id)&&isset($carrier->id)){
+        if (isset($owner->id)&&isset($logistic->id)){
             $createPackage = new Package([
                 'logistic_number'=>$receiveInputs['SOReference5'],
                 'delivery_number'=>$receiveInputs['palletid'],
                 'recipient'=>$receiveInputs['Consigneename'],
                 'owner_id'=>$owner->id,
-                'logistic_id'=>$carrier->id,
+                'logistic_id'=>$logistic->id,
                 'batch_number'=>$receiveInputs['USERDEFINE1'],
                 'batch_rule'=>$receiveInputs['USERDEFINE2'],
                 'status'=>'未测量'
@@ -153,15 +164,15 @@ class PackageController extends Controller
     public function accomplishToWMS(Package $package)
     {
         $json=["request"=>['TASKID'=>$package->WMSReflectPackage_name,
-                'SOReference5'=>$package->logistic_number,
-                'Weigh'=>$package->weight,
-                'Addwho'=>'',
-                'Addtime'=>Carbon::now(),
-                'Package'=>$package->paperBox_name,
-                'USERDEFINE1'=>$package->batch_number,
-                'USERDEFINE2'=>$package->batch_rule,
-                'USERDEFINE3'=>'OK',
-            ]];
+            'SOReference5'=>$package->logistic_number,
+            'Weigh'=>$package->weight,
+            'Addwho'=>'',
+            'Addtime'=>Carbon::now(),
+            'Package'=>$package->paperBox_name,
+            'USERDEFINE1'=>$package->batch_number,
+            'USERDEFINE2'=>$package->batch_rule,
+            'USERDEFINE3'=>'OK',
+        ]];
         $json=json_encode($json);
         $url=url(config('api.flux.package.new'));
         $response = Zttp::post($url, json_decode($json));

+ 225 - 0
app/Http/Controllers/api/thirdPart/flux/ProcessController.php

@@ -0,0 +1,225 @@
+<?php
+
+namespace App\Http\Controllers\Api\thirdPart\flux;
+
+
+use App\Commodity;
+use App\OracleBasSKU;
+use App\OracleDOCASNDetail;
+use App\OracleDOCMovementDetail;
+use App\OracleDOCMovementHeader;
+use App\OracleDOCOrderDetail;
+use App\Http\Controllers\Controller;
+use App\Owner;
+use Carbon\Carbon;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\DB;
+
+class ProcessController extends Controller
+{
+    public function getProcessContent(Request $request){
+        $wms_code=$request->input('wms_code');
+        if (!$wms_code)return ['error'=>'提交的单据号为空'];
+        $docASNs=OracleDOCASNDetail::where("ASNNo",$wms_code)->get();   //入库单
+        if (count($docASNs)>0){
+            $owner=Owner::where("code",$docASNs[0]->customerid)->first();
+            if (!$owner)$owner=$this->storeOwner($docASNs[0]->customerid);
+            if (!$owner)return ['error'=>'找到了入库单,但未查询到货主代码!'];
+            /*$basSKUs=['owner_code'=>[],'sku'=>[]];
+            $commodities=[];
+            $i=0;
+            $docAsnSKUs=array_column($docASNs->toArray(),'sku');
+            $docAsnOwnerCodes=array_column($docASNs->toArray(),'customerid');
+            $commoditiesTem=Commodity::with(['barcodes','owner'=>function($query)use($docAsnOwnerCodes){
+                return $query->whereIn('code',$docAsnOwnerCodes);
+            }])->whereIn('sku',$docAsnSKUs)->get();
+            $commoditiesData=[];
+            foreach ($commoditiesTem as $commodityTem){
+                $commoditiesData[$commodityTem->sku."_".$commodityTem->owner_code]=$commodityTem;
+            }
+            foreach ($docASNs as $docASN){
+                $commodity=isset($commoditiesData[$docASN->sku."_".$docASN->customerid])?$commoditiesData[$docASN->sku."_".$docASN->customerid]:null;
+                if (!$commodity){
+                    array_push($basSKUs['owner_code'],$docASN->customerid);
+                    array_push($basSKUs['sku'],$docASN->sku);
+                    $i++;
+                    continue;
+                }
+                $commodity->amount=$docASN->expectedqty;
+                array_push($commodities,$commodity->toArray());
+                unset($docASNs[$i]);
+                $i++;
+            }
+            unset($docAsnOwnerCodes,$docAsnSKUs,$commoditiesTem,$commoditiesData);
+            if (count($basSKUs['sku'])>0 && count($basSKUs['owner_code'])>0){
+                $this->storeCommodity($basSKUs);
+                $docAsnSKUs=array_column($docASNs->toArray(),'sku');
+                $docAsnOwnerCodes=array_column($docASNs->toArray(),'customerid');
+                $commoditiesTem=Commodity::with(['barcodes','owner'=>function($query)use($docAsnOwnerCodes){
+                    return $query->whereIn('code',$docAsnOwnerCodes);
+                }])->whereIn('sku',$docAsnSKUs)->get();
+                $commoditiesData=[];
+                foreach ($commoditiesTem as $commodityTem){
+                    $commoditiesData[$commodityTem->sku."_".$commodityTem->owner_code]=$commodityTem;
+                }
+                foreach ($docASNs as $docASN){
+                    $commodity=$commoditiesData[$docASN->sku."_".$docASN->customerid];
+                    if (!$commodity){
+                        continue;
+                    }
+                    $commodity->amount=$docASN->expectedqty;
+                    array_push($commodities,$commodity->toArray());
+                }
+            }*/
+            $commodities=$this->resetData($docASNs,"sku","customerid","expectedqty","asnlineno");
+            $processContent=[
+                'wms_code'=>$wms_code,
+                'owner_name'=>$owner->name,
+                'owner_id'=>$owner->id,
+                'commodities'=>$commodities,
+                'bill_type'=>'入库单',
+            ];
+            return json_encode($processContent);
+        }
+        $docOrders=OracleDOCOrderDetail::where("OrderNo",$wms_code)->get();//出库单
+        if (count($docOrders)>0){
+            $owner=Owner::where("code",$docOrders[0]->customerid)->first();
+            if (!$owner)$owner=$this->storeOwner($docOrders[0]->customerid);
+            if (!$owner)return ['error'=>'找到了入库单,但未查询到货主代码!'];
+            $commodities=$this->resetData($docOrders,"sku","customerid","qtyordered",'orderlineno');
+            $processContent=[
+                'wms_code'=>$wms_code,
+                'owner_name'=>$owner->name,
+                'owner_id'=>$owner->id,
+                'commodities'=>$commodities,
+                'bill_type'=>'出库单',
+            ];
+            return json_encode($processContent);
+        }
+        $docMovementDetails=OracleDOCMovementDetail::where("MDOCNO",$wms_code)->get();//移库单
+        if (count($docMovementDetails)>0){
+            $docMovementHeaders=OracleDOCMovementHeader::select('CustomerID')->where('MDOCNO',$wms_code)->get();
+            if (count($docMovementHeaders)<1)return ['error'=>'找到了移库单,但未查询移库单表头!'];
+            $owner=Owner::where("code",$docMovementHeaders[0]->customerid)->first();
+            if (!$owner)$owner=$this->storeOwner($docMovementHeaders[0]->customerid);
+            if (!$owner)return ['error'=>'找到了入库单,但未查询到货主代码!'];
+            $commodities=$this->resetData($docMovementDetails,"sku","customerid","toqty","mdoclineno",$docMovementHeaders);
+            /*$commodities=[];
+            foreach ($docMovementDetails as $docMovementDetail){
+                $commodity=Commodity::where('sku',$docMovementDetail->sku)->first();
+                if (!$commodity)$commodity = $this->storeCommodity($owner->code,$docMovementDetail->sku);
+                if (!$commodity)continue;
+                array_push($commodities,['id'=>$commodity->id,'name'=>$commodity->name,
+                    'barcodes'=>$commodity->barcodes,'sku'=>$commodity->sku,'amount'=>$docMovementDetail->toqty]);
+            }*/
+            $processContent=[
+                'wms_code'=>$wms_code,
+                'owner_name'=>$owner->name,
+                'owner_id'=>$owner->id,
+                'commodities'=>$commodities,
+                'bill_type'=>'移库单',
+            ];
+            return json_encode($processContent);
+        }
+        return ['error'=>'未查到对应单据号'];
+    }
+
+
+    //重组商品数据
+    private function resetData($doc,$skuColumn,$customeridColumn,$amountColumn,$lineNoColumn,$docHeader=null){
+        //处理重组数据
+        $docs=['owner_code'=>[],'sku'=>[]];
+        $commodities=[];
+        $i=0;
+        $docSKUs=array_column($doc->toArray(),'sku');
+        $docOwnerCodes=array_column($docHeader?$docHeader->toArray():$doc->toArray(),'customerid');
+        $commoditiesTem=Commodity::with(['barcodes','owner'=>function($query)use($docOwnerCodes){
+            return $query->whereIn('code',$docOwnerCodes);
+        }])->whereIn('sku',$docSKUs)->get();
+        $commoditiesData=[];
+        foreach ($commoditiesTem as $commodityTem){
+            $commoditiesData[$commodityTem->sku."_".$commodityTem->owner_code]=$commodityTem;
+        }
+        foreach ($doc as $docOne){
+            $customerid=$docHeader?$docHeader[0][$customeridColumn]:$docOne[$customeridColumn];
+            $commodity=isset($commoditiesData[$docOne[$skuColumn]."_".$customerid])
+                ?$commoditiesData[$docOne[$skuColumn]."_".$customerid]:null;
+            if (!$commodity){
+                array_push($docs['owner_code'],$docHeader?$docHeader[0][$customeridColumn]:$docOne[$customeridColumn]);
+                array_push($docs['sku'],$docOne[$skuColumn]);
+                $i++;
+                continue;
+            }
+            $commodity->amount=$docOne[$amountColumn];
+            $commodity->lineNo=$docOne[$lineNoColumn];
+            array_push($commodities,$commodity->toArray());
+            unset($doc[$i]);
+            $i++;
+        }
+        unset($docSKUs,$docOwnerCodes,$commoditiesTem,$commoditiesData,$customerid);
+        if (count($docs['sku'])>0 && count($docs['owner_code'])>0){
+            $this->storeCommodity($docs);
+            $docSKUs=array_column($doc->toArray(),'sku');
+            $docOwnerCodes=array_column($docHeader?$docHeader->toArray():$doc->toArray(),'customerid');
+            $commoditiesTem=Commodity::with(['barcodes','owner'=>function($query)use($docOwnerCodes){
+                return $query->whereIn('code',$docOwnerCodes);
+            }])->whereIn('sku',$docSKUs)->get();
+            $commoditiesData=[];
+            foreach ($commoditiesTem as $commodityTem){
+                $commoditiesData[$commodityTem->sku."_".$commodityTem->owner_code]=$commodityTem;
+            }
+            foreach ($doc as $docOne){
+                $customerid=$docHeader?$docHeader[0][$customeridColumn]:$docOne[$customeridColumn];
+                $commodity=isset($commoditiesData[$docOne[$skuColumn]."_".$customerid])
+                    ?$commoditiesData[$docOne[$skuColumn]."_".$customerid]:null;
+                if (!$commodity)continue;
+                $commodity->amount=$docOne[$amountColumn];
+                $commodity->lineNo=$docOne[$lineNoColumn];
+                array_push($commodities,$commodity->toArray());
+            }
+        }
+        return $commodities;
+    }
+
+    private function storeCommodity($basSKUs){
+        $oracleBasSkus=OracleBasSKU::whereIn("CustomerID",$basSKUs['owner_code'])->whereIn("SKU",$basSKUs['sku'])->get();
+        if (count($oracleBasSkus)<1)return;
+        $commoditiesData=[];
+        $commoditiesTem=["sku"=>[],"owner_id"=>[]];
+        $commodityBarCodeData=[];
+        $commodityBarCodeTem=[];
+        $owners_code=array_column($oracleBasSkus->toArray(),'customerid');
+        $ownersTem=Owner::whereIn('code',$owners_code)->get();
+        $owners=array_column($ownersTem->toArray(),'id','code');
+        for($i=0;$i<count($oracleBasSkus);$i++){
+            if (!$owners[$oracleBasSkus[$i]->customerid])$owners[$oracleBasSkus[$i]->customerid]=$this->storeOwner($oracleBasSkus[$i]->customerid);
+            array_push($commoditiesData,["owner_id"=>$owners[$oracleBasSkus[$i]->customerid],"name"=>$oracleBasSkus[$i]->descr_c,"sku"=>$oracleBasSkus[$i]->sku,"created_at"=>Carbon::now()]);
+            array_push($commoditiesTem['sku'],$oracleBasSkus[$i]->sku);
+            array_push($commoditiesTem['owner_id'],$owners[$oracleBasSkus[$i]->customerid]);
+            $commodityBarCodeData[$oracleBasSkus[$i]->sku."_".$owners[$oracleBasSkus[$i]->customerid]]=["code"=>$oracleBasSkus[$i]->alternate_sku1,"commodity_id"=>'','created_at'=>Carbon::now()];
+        }
+        DB::table('commodities')->insert($commoditiesData);
+        $this->log(__METHOD__, 'FLUX二次加工单接口录入商品__' . __FUNCTION__, json_encode($commoditiesData), Auth::user()['id']);
+        $commodities=Commodity::whereIn('sku',$commoditiesTem['sku'])->whereIn('owner_id',$commoditiesTem['owner_id'])->get();
+        foreach ($commodities as $commodity){
+            $commodityBarCodeData[$commodity->sku."_".$commodity->owner_id]['commodity_id']=$commodity->id;
+        }
+        foreach ($commodityBarCodeData as $key=>$value){
+            array_push($commodityBarCodeTem,$value);
+        }
+        DB::table('commodity_barcodes')->insert($commodityBarCodeTem);
+        $this->log(__METHOD__, 'FLUX二次加工单接口录入商品条码__' . __FUNCTION__, json_encode($commodityBarCodeTem), Auth::user()['id']);
+    }
+
+
+    private function storeOwner($code){
+        $owner=new Owner([
+            "name"=>$code,
+            "code"=>$code
+        ]);
+        $owner->save();
+        $this->log(__METHOD__, 'FLUX二次加工单接口录入货主__' . __FUNCTION__, json_encode($owner), Auth::user()['id']);
+        return $owner;
+    }
+}

+ 27 - 23
app/Http/Controllers/api/thirdPart/flux/ReceiveController.php

@@ -58,7 +58,7 @@ class ReceiveController extends Controller
                 $receive->skus()->save($sku);
             }
             if(isset($receive['ASNREFERENCE3'])){
-                if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"接收到WMS下发退货单号:{$receive['ASNREFERENCE3']},准备进入事件WmsReceiveNewEvent",null);
+                if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"接收到WMS下发退货单号:{$receive['ASNREFERENCE3']},准备进入事件WmsReceiveNewEvent",null);
                 event(new WmsReceiveNewEvent($receive['ASNREFERENCE3'],$receive));
             }
         }
@@ -128,13 +128,13 @@ class ReceiveController extends Controller
      */
     static public function accomplishToWMS(RejectedBill $rejectedBill)
     {
-        if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"进入推送WMS入库接口。退单号:".$rejectedBill['logistic_number_return'],Auth::user()['id']);
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"进入推送WMS入库接口。退单号:".$rejectedBill['logistic_number_return'],Auth::user()['id']);
         ini_set('max_execution_time',2500);
         $bill=$rejectedBill;
         $wmsReceiveds=WMSReflectReceive::where('ASNREFERENCE3',$rejectedBill['logistic_number_return'])
             ->where('is_uploaded',0)->get();
         if($wmsReceiveds->isEmpty()){
-            if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,'error_'.__FUNCTION__,"错误,WMS入库接口找不到对应富勒映射表未入库记录。退单号:".$rejectedBill['logistic_number_return'],Auth::user()['id']);
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,'error_'.__FUNCTION__,"错误,WMS入库接口找不到对应富勒映射表未入库记录。退单号:".$rejectedBill['logistic_number_return'],Auth::user()['id']);
             return false;
         }
         $items=$bill->items()->get();
@@ -145,11 +145,12 @@ class ReceiveController extends Controller
             });
             return $result;
         })();
-        $success=true;
-        $wmsReceiveds->each(function ($wmsReceived)use(&$bill,&$amountsItem,$items,&$success){
-            if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"循环WMS映射表(WMS入库接口中)。ASN号:{$wmsReceived['ASNNO']},退单号:".$wmsReceived['ASNREFERENCE3'],Auth::user()['id']);
+        $successed=$wmsReceiveds->count();
+        $exceptionMessages=[];
+        $wmsReceiveds->each(function ($wmsReceived)use(&$bill,&$amountsItem,$items,&$successed){
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"循环WMS映射表(WMS入库接口中)。ASN号:{$wmsReceived['ASNNO']},退单号:".$wmsReceived['ASNREFERENCE3'],Auth::user()['id']);
             if(!$bill && $bill['is_loaded']!=0){
-                if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,'error_'.__FUNCTION__,"跳过!!不上传。(WMS入库接口中)。对应循环WMS映射表本地退单记录已入库。退单号:".$bill['logistic_number_return'],Auth::user()['id']);
+                if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,'error_'.__FUNCTION__,"跳过!!不上传。(WMS入库接口中)。对应循环WMS映射表本地退单记录已入库。退单号:".$bill['logistic_number_return'],Auth::user()['id']);
                 return;
             }
 
@@ -212,7 +213,7 @@ class ReceiveController extends Controller
             });
 
             if(count($skuStrList)==0){
-                if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,'error_'.__FUNCTION__,"错误!没有商品项。(WMS入库接口中)。ASN号:{$wmsReceived['ASNNO']},退单号:{$wmsReceived['ASNREFERENCE3']}",Auth::user()['id']);
+                if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,'error_'.__FUNCTION__,"错误!没有商品项。(WMS入库接口中)。ASN号:{$wmsReceived['ASNNO']},退单号:{$wmsReceived['ASNREFERENCE3']}",Auth::user()['id']);
                 return;
             }
             $skuStrList = implode(',',$skuStrList);
@@ -233,29 +234,31 @@ class ReceiveController extends Controller
                     ]
                 }
                 ";
-            if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"完成拼接JSON,准备发送给WMS。(WMS入库接口中)。退单号:{$wmsReceived['ASNREFERENCE3']},商品项JSON:{$json}",Auth::user()['id']);
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"完成拼接JSON,准备发送给WMS。(WMS入库接口中)。退单号:{$wmsReceived['ASNREFERENCE3']},商品项JSON:{$json}",Auth::user()['id']);
 
             $sendingJson = json_decode($json,true);
             $url=url(config('api.flux.receive.new'));
             $response = Zttp::post($url, $sendingJson);
             $noIssues=true;
             $json = $response->json();
-            if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"得到WMS返回。退单号:{$wmsReceived['ASNREFERENCE3']}},返回:{$response->body()}",Auth::user()['id']);
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"得到WMS返回。退单号:{$wmsReceived['ASNREFERENCE3']}},返回:{$response->body()}",Auth::user()['id']);
             if(!$json||!isset($json['Response'])||!$json['Response']['return']['returnFlag']=='1'){
-                if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,'error_'.__FUNCTION__,"WMS入库失败,ASN号:{$wmsReceived['ASNNO']}。退单号:{$wmsReceived['ASNREFERENCE3']}},返回:{$response->body()}",Auth::user()['id']);
+                if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,'error_'.__FUNCTION__,"WMS入库失败,ASN号:{$wmsReceived['ASNNO']}。退单号:{$wmsReceived['ASNREFERENCE3']}},返回:{$response->body()}",Auth::user()['id']);
                 $noIssues=false;
             }
             if($json&&isset($json['Response'])){
-                if($json['Response']['return']['returnFlag']=='2'){
-                    Controller::logS(__METHOD__,'exception_'.__FUNCTION__,"状态2, WMS返回不正常!按成功跳过。退单号:{$wmsReceived['ASNREFERENCE3']}}",Auth::user()['id']);
-                    return true;
-                }
+//                if($json['Response']['return']['returnFlag']=='2'){
+//                    Controller::logS(__METHOD__,'exception_'.__FUNCTION__,"状态2, WMS返回不正常!按成功跳过。退单号:{$wmsReceived['ASNREFERENCE3']}}",Auth::user()['id']);
+//                    return true;
+//                }
                 if(isset($json['Response']['return']['returnDesc'])&&strpos($json['Response']['return']['returnDesc'],'唯一约束')!==false){
-                    Controller::logS(__METHOD__,'exception_'.__FUNCTION__,"违反唯一约束, WMS返回不正常!按成功跳过。退单号:{$wmsReceived['ASNREFERENCE3']}}",Auth::user()['id']);
+                    $successed-=1;
+                    Controller::logS(__METHOD__,'exception_'.__FUNCTION__,"违反唯一约束, WMS返回不正常!按失败计。退单号:{$wmsReceived['ASNREFERENCE3']}}",Auth::user()['id']);
                     return true;
                 }
                 if(isset($json['Response']['return']['errordescr'])&&strpos($json['Response']['return']['errordescr'],'已完成')!==false){
-                    Controller::logS(__METHOD__,'exception_'.__FUNCTION__,"退单之前已完成, WMS返回不正常!按成功跳过。退单号:{$wmsReceived['ASNREFERENCE3']}}",Auth::user()['id']);
+                    $successed-=1;
+                    Controller::logS(__METHOD__,'exception_'.__FUNCTION__,"退单之前已完成, WMS返回不正常!按失败计。退单号:{$wmsReceived['ASNREFERENCE3']}}",Auth::user()['id']);
                     return true;
                 }
             }
@@ -265,19 +268,20 @@ class ReceiveController extends Controller
                 Controller::logS(__METHOD__,__FUNCTION__,"成功入库WMS。ASN号:{$wmsReceived['ASNNO']}。退单号:{$wmsReceived['ASNREFERENCE3']}}",Auth::user()['id']);
                 return true;
             }else{
-                $success=false;
-                if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,'error'.__FUNCTION__,"入库WMS失败!!ASN号:{$wmsReceived['ASNNO']}。退单号:{$wmsReceived['ASNREFERENCE3']}}",Auth::user()['id']);
+                $successed-=1;
+                if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,'error'.__FUNCTION__,"入库WMS失败!!ASN号:{$wmsReceived['ASNNO']}。退单号:{$wmsReceived['ASNREFERENCE3']}}",Auth::user()['id']);
             }
         });
 
-        if($success){ //bad patch, 正常不需要这两句,作为未知原因的保险
+        if($successed==$wmsReceiveds->count()){ //bad patch, 正常不需要这两句,作为未知原因的保险
             $rejectedBill = RejectedBill::find($rejectedBill['id']);
             $rejectedBill->is_loaded=1;
             $rejectedBill->save();
         }
-        if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"入库WMS处理完成,结果为:{$success}。退单号:{$rejectedBill['logistic_number_return']}}",Auth::user()['id']);
-
-        return $success;
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"入库WMS处理完成,结果为:{$successed}。退单号:{$rejectedBill['logistic_number_return']}}",Auth::user()['id']);
+        if($successed==$wmsReceiveds->count())return 'success';
+        if(!$successed)return 'fail';
+        return 'exception';
     }
 
 }

+ 100 - 0
app/Http/Controllers/api/thirdPart/flux/WaybillController.php

@@ -0,0 +1,100 @@
+<?php
+
+namespace App\Http\Controllers\Api\thirdPart\flux;
+
+use App\Http\Controllers\Controller;
+use App\Waybill;
+use App\WMSWaybill;
+use App\WMSWaybillOrder;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Validator;
+use Zttp\Zttp;
+
+class WaybillController extends Controller
+{
+
+    public function new_(Request $request)
+    {
+        $errors=$this->validatorForNew($request->all())->errors();
+        if(count($errors)>0){
+            $this->log(__METHOD__, 'error_' . __FUNCTION__, json_encode($request->getContent()));
+            (new Controller())->log(__METHOD__,'error_'.__FUNCTION__,'fields wrong, see Errors report please.'.'|'.json_encode($request).'|'.json_encode($errors));
+            return response()->json(['response'=>['return'=>['returnFlag'=>'0','returnCode'=>'0001','returnDesc'=>'消息处理失败:Failure','resultInfo'=>'',
+                'errors'=>$errors]]])
+                ->setEncodingOptions(JSON_UNESCAPED_UNICODE);
+        }
+        $receivedInputtings=$request->input('request');
+        foreach ($receivedInputtings as $receiveInputting){
+            if(!WMSWaybill::create($receiveInputting)){
+                Controller::logS(__METHOD__,'error_'.__FUNCTION__,'运单WMS写入错误'.'|'.json_encode($receiveInputting));
+                return response()->json(['response'=>['return'=>['returnFlag'=>'0','returnCode'=>'0001','returnDesc'=>'运单WMS写入错误'.'|'
+                    .json_encode($receiveInputting),'resultInfo'=>'']]])
+                    ->setEncodingOptions(JSON_UNESCAPED_UNICODE);
+            }
+            foreach ($receiveInputting['order_list'] as $orderInputting){
+                $orderInputting['OrderNo']=$receiveInputting['OrderNo'];
+                if(!WMSWaybillOrder::create($orderInputting)){
+                    Controller::logS(__METHOD__,'error_'.__FUNCTION__,'运单订单行WMS写入错误'.'|'.json_encode($orderInputting));
+                    return response()->json(['response'=>['return'=>['returnFlag'=>'0','returnCode'=>'0001','returnDesc'=>'运单订单行WMS写入错误'.'|'
+                        .json_encode($orderInputting),'resultInfo'=>'']]])
+                        ->setEncodingOptions(JSON_UNESCAPED_UNICODE);
+                }
+            }
+        }
+        return response()->json(['response'=>['return'=>['returnFlag'=>'1','returnCode'=>'0000','returnDesc'=>'正确接收','resultInfo'=>'']]])
+            ->setEncodingOptions(JSON_UNESCAPED_UNICODE);
+
+
+    }
+
+    protected function validatorForNew(array $data)
+    {
+        return Validator::make($data, [
+            'request' => ['required', 'array', 'min:1'],
+            'request.*.OrderNo' => ['required', 'string', 'max:191','unique:w_m_s_waybills,OrderNo'],
+            'request.*.CustomerID' => ['required', 'string', 'max:191'],
+            'request.*.CarrierID' => ['required', 'string', 'max:191'],
+            'request.*.ConsigneeName' => ['nullable', 'string', 'max:191'],
+            'request.*.C_Tel' => ['nullable', 'string', 'max:191'],
+            'request.*.C_Address1' => ['required', 'string', 'max:191'],
+            'request.*.C_Province' => ['required', 'string', 'max:191'],
+            'request.*.C_City' => ['nullable', 'string', 'max:191'],
+            'request.*.C_District' => ['nullable', 'string', 'max:191'],
+            'request.*.order_list' => ['required', 'array', 'min:1'],
+            'request.*.order_list.*.SKU_Descr_c' => ['nullable', 'string', 'max:191'],
+            'request.*.order_list.*.SKU' => ['required', 'string', 'max:191'],
+            'request.*.order_list.*.Alternate_sku1' => ['required', 'string', 'max:191'],
+            'request.*.order_list.*.Qtyordered_each' => ['required', 'string', 'max:191'],
+            'request.*.order_list.*.Cubic' => ['nullable', 'string', 'max:191'],
+            'request.*.order_list.*.GrossWeight' => ['nullable', 'string', 'max:191'],
+            'request.*.order_list.*.NetWeight' => ['nullable', 'string', 'max:191'],
+        ]);
+    }
+
+    public function accomplishToWMS(Waybill $waybill)
+    {
+        $json="
+                {
+                    \"request\": [
+                        {
+                            \"OrderNo\": \"{$waybill['wms_bill_number']}\",
+                            \"DELIVERYNO\": \"{$waybill['waybill_number']}\",
+                        }
+                    ]
+                }
+                ";
+        $sendingJson = json_decode($json,true);
+        $url=url(config('api.flux.waybill.new'));
+        $response = Zttp::post($url, $sendingJson);
+        $responseJson = $response->json();
+        if(!$responseJson||!isset($responseJson['Response'])||!$responseJson['Response']['return']['returnFlag']=='1'){
+            Controller::logS(__METHOD__,'error_'.__FUNCTION__,"向WMS提交运单失败!!SO单号:{$waybill['wms_bill_number']}。提交:{$json},返回:{$response->body()}, URL:{$url}",Auth::user()['id']);
+            return false;
+        }
+        Controller::logS(__METHOD__,''.__FUNCTION__,"向WMS提交运单成功,SO单号:{$waybill['wms_bill_number']}。返回:{$response->body()}",Auth::user()['id']);
+        return true;
+
+    }
+
+}

+ 11 - 10
app/Http/Controllers/api/thirdPart/jianshang/RejectedController.php

@@ -112,7 +112,7 @@ class RejectedController extends Controller
     }
 
     function sendRejected2(Rejected $rejected){
-        $this->log(__METHOD__,__FUNCTION__,'informed: '.json_encode($rejected),Auth::user()['id']);
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"发送笕尚接口,进入入口。退单号:{$rejected['logistic_number_return']}",Auth::user()['id']);
         $created_at = $rejected['created_at'] ?? '';
         $fee_collected = $rejected['fee_collected'] ?? '';
         $goodses=[];
@@ -132,21 +132,22 @@ class RejectedController extends Controller
         $json = $this->packSendToRemote2($created_at,$fee_collected,$goodses,
             $logistic_name_return,$logistic_number,$logistic_number_return,$order_number,
             $sender_mobile,$sender_name);
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"发送笕尚接口调度完成。退单号:{$rejected['logistic_number_return']}",Auth::user()['id']);
         if(!$json){
-            $this->log(__METHOD__,'error_null_'.__FUNCTION__,"返回错误:没有JSON,请检查笕尚直接返回内容");
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,'error_'.__FUNCTION__,"发送笕尚接口异常,没有json返回。退单号:{$rejected['logistic_number_return']}",Auth::user()['id']);
             return 'fail';
         }else if(!isset($json['success'])||!$json['success']){
             if(strpos(json_encode($json),'已经接收过')!==false){
                 return 'received';
             }
-            $this->log(__METHOD__,'error1_'.__FUNCTION__,"返回错误:".json_encode($json));
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,'error_'.__FUNCTION__,"发送笕尚接口错误。退单号:{$rejected['logistic_number_return']}。".json_encode($json),Auth::user()['id']);
             return 'fail';
         }
         if(!$json['goodses_feedback']){
-            $this->log(__METHOD__,'error_noGoodses_'.__FUNCTION__,"没有goodses信息:".json_encode($json));
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,'error_'.__FUNCTION__,"发送笕尚接口返回不全,没有商品信息返回(goodses)。退单号:{$rejected['logistic_number_return']}。".json_encode($json),Auth::user()['id']);
         }
         if(!$json['logistic_number_return']){
-            $this->log(__METHOD__,'error_noLogisticNumber_'.__FUNCTION__,"没有退回快递单号:".json_encode($json));
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,'error_'.__FUNCTION__,"发送笕尚接口返回不全,没有退回快递单号。退单号:{$rejected['logistic_number_return']}。".json_encode($json),Auth::user()['id']);
         }
         $storable = (function ()use($json) {
             if(count($json['goodses_feedback'])==0)return false;
@@ -158,10 +159,10 @@ class RejectedController extends Controller
             return true;
         })();
         if(!$storable){
-            $this->log(__METHOD__,__FUNCTION__.'_noPush_'.$rejected['logistic_number_return'],json_encode($json),Auth::user()['id']);
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,'error_'.__FUNCTION__,"发送笕尚接口提示,商品不可入库。退单号:{$rejected['logistic_number_return']}".json_encode($json),Auth::user()['id']);
             return 'none';
         }
-        $this->log(__METHOD__,__FUNCTION__.'_'.$rejected['logistic_number_return'],'response: '.json_encode($json),Auth::user()['id']);
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"发送笕尚接口完成,可入库,待其未来推单。退单号:{$rejected['logistic_number_return']}".json_encode($json),Auth::user()['id']);
 //        $this->markItemsIsLoaded($json);
         return 'storable';
     }
@@ -201,6 +202,7 @@ class RejectedController extends Controller
         $timestamp=intval(microtime(true)*1000);
         $nonce=md5(microtime(true));
         $sign=$sortParamsAndMd5(json_decode($data,true),$timestamp,$nonce,config('api.sign_key_rejected_send_jianshang'));
+        $this->log(__METHOD__,'笕尚接口发送请求:',$data);
         $url=config('api.url_rejected_send_jianshang2');
         if(env('api_faking'))$url=url(config('api.fakingUrl_rejected_send_jianshang'));
         $response=Zttp::withHeaders([
@@ -209,12 +211,11 @@ class RejectedController extends Controller
             'timestamp'=>$timestamp,
             'Content-Type'=>'application/json'
         ])->post($url,json_decode($data,true));
-        $this->log(__METHOD__,'json',$data);
         if(!$response){
-            $this->log(__METHOD__,'error','回复异常:'.$response->body());
+            $this->log(__METHOD__,'笕尚接口返回异常!!:',$response->body());
             return false;
         }
-        $this->log(__METHOD__,'response',$response->body());
+        $this->log(__METHOD__,'笕尚接口返回:',$response->body());
         return $response->json();
     }
 

+ 1 - 1
app/Jobs/ProcessReceiveCombinedJob.php

@@ -31,7 +31,7 @@ class ProcessReceiveCombinedJob implements ShouldQueue
     public function handle()
     {
         $wmsReceives=WMSReflectReceive::where('ASNREFERENCE3',$this->logisticNumberReturn)->get();
-        if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"执行队列任务,处理退单号:{$this->logisticNumberReturn}",null);
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"执行队列任务,处理退单号:{$this->logisticNumberReturn}",null);
         event(new WmsReceiveNewEvent($this->logisticNumberReturn,$wmsReceives->first()));
     }
 }

+ 34 - 14
app/Listeners/InformWMSReceivedListener.php

@@ -27,28 +27,48 @@ class InformWMSReceivedListener
      * Handle the event.
      *
      * @param InformWMSReceivedEvent $event`
-     * @return bool`
+     * @return string`
      */
     public function handle(InformWMSReceivedEvent $event)
     {
-        $rejectedBill=$event->rejectedBill;
-        if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,'推送WMS入库事件进入,退单号:'.$rejectedBill['logistic_number_return'],Auth::user()['id']);
-        $hasAccomplishedToWMS=ReceiveController::accomplishToWMS($rejectedBill);
-        if(!$hasAccomplishedToWMS){
-            if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,'error_'.__FUNCTION__,'推送WMS入库失败!!退单号:'.$rejectedBill['logistic_number_return'],Auth::user()['id']);
-            return false;
+        $rejectedBill = RejectedBill::find($event->rejectedBill['id']);
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,'推送WMS入库事件进入,退单号:'.$rejectedBill['logistic_number_return'],Auth::user()['id']);
+        if($rejectedBill['is_loaded']==2){
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"推送WMS入库,仅将待推单修改为待确认! 字段状态:{$rejectedBill['is_loaded']},退单号:".$rejectedBill['logistic_number_return'],Auth::user()['id']);
+            $rejectedBill->setIsLoaded_toWaitConfirm();
+            return 'toBeConfirm';
         }
-        $rejectedBill = RejectedBill::find($rejectedBill['id']);
-        $rejectedBill->is_loaded=1;
-        $rejectedBill->save();
-        $rejectedBill['is_loaded']=1; //奇怪,出现过要重保存才成功的情况,未知原因的保险
+        if($rejectedBill['is_loaded']==4){
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,'推送WMS入库,重复提交,状态已经待确认! 退单号:'.$rejectedBill['logistic_number_return'],Auth::user()['id']);
+            return 'alreadyBeWaitConfirm';
+        }
+        if( $rejectedBill['is_loaded']==1){
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,'推送WMS入库,重复提交,状态已经是入库! 退单号:'.$rejectedBill['logistic_number_return'],Auth::user()['id']);
+            return 'alreadyStored';
+        }
+        $result_TransferToWMS=ReceiveController::accomplishToWMS($rejectedBill);
+        if ($result_TransferToWMS=='fail'){
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,'error_'.__FUNCTION__,'推送WMS入库失败!!退单号:'.$rejectedBill['logistic_number_return'],Auth::user()['id']);
+            return $result_TransferToWMS;
+        }
+        if ($result_TransferToWMS=='exception'){
+//            $rejectedBill->is_loaded=3;//奇怪,出现过要重保存才成功的情况,未知原因的保险
+//            $rejectedBill->save();
+            $rejectedBill['is_loaded']=3;
+            $rejectedBill->update();
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,'error_'.__FUNCTION__,"推送WMS入库异常!!字段状态:{$rejectedBill['is_loaded']},退单号:".$rejectedBill['logistic_number_return'],Auth::user()['id']);
+            return $result_TransferToWMS;
+        }
+//        $rejectedBill->is_loaded=1;//奇怪,出现过要重保存才成功的情况,未知原因的保险
+//        $rejectedBill->save();
+        $rejectedBill['is_loaded']=1;
         $rejectedBill->update();
-        if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"推送WMS后退单改为已入库, 真实状态:{$rejectedBill['is_loaded']},退单号:".$rejectedBill['logistic_number_return'],Auth::user()['id']);
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"推送WMS后退单改为已入库, 真实状态:{$rejectedBill['is_loaded']},退单号:".$rejectedBill['logistic_number_return'],Auth::user()['id']);
         $rejectedBill->items->each(function(RejectedBillItem $item){
             $item['is_loaded']='已入库';
             $item->save();
         });
-        if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"推送WMS后商品标记完为入库状态。退单号:".$rejectedBill['logistic_number_return'],Auth::user()['id']);
-        return true;
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"推送WMS后商品标记完为入库状态。退单号:".$rejectedBill['logistic_number_return'],Auth::user()['id']);
+        return $result_TransferToWMS;
     }
 }

+ 13 - 12
app/Listeners/WmsReceiveNewListener.php

@@ -38,7 +38,7 @@ class WmsReceiveNewListener
      */
     public function handle(WmsReceiveNewEvent $event)
     {
-        if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"进入退单处理事件,由下发或队列启动,退单号:{$event->logisticNumberReturn}",null);
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"进入退单处理事件,由下发或队列启动,退单号:{$event->logisticNumberReturn}",null);
         $logisticNumberReturn=$event->logisticNumberReturn;
         $wmsReceives=WMSReflectReceive::where('ASNREFERENCE3',$logisticNumberReturn)->where('is_uploaded',0)->orderBy('id','desc')->get();
         $downloadedSkuItems=[];
@@ -56,11 +56,11 @@ class WmsReceiveNewListener
     }
 
     private function handleJianshang($logisticNumberReturn, $downloadedSkuItems, $wmsReceives){
-        if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"进入笕尚退单处理事件,退单号:{$logisticNumberReturn}",null);
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"进入笕尚退单处理事件,退单号:{$logisticNumberReturn}",null);
         $bills=RejectedBill::where('logistic_number_return',$logisticNumberReturn)->
-        whereIn('is_loaded',[0,2])->get();
+            whereIn('is_loaded',[0,2])->get();
         if($bills->isEmpty()){//没有本地货单
-            Controller::logS(__METHOD__,'error_'.__FUNCTION__,"退单事件错误,没有本地对应退单,退单号:{$logisticNumberReturn}",null);
+            Controller::logS(__METHOD__,__FUNCTION__,"退单搁置,没有本地对应退单,退单号:{$logisticNumberReturn}",null);
             return;
         }
 
@@ -76,31 +76,31 @@ class WmsReceiveNewListener
             return new Collection($items);
         })();
         $isItemsReceivedOverDownloaded=WMSReflectReceiveSku::isItemsOverDownloadedSkus($actualGotItems,$downloadedSkuItems);
-        if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"退单事件中,同名退单数:("
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"退单事件中,同名退单数:("
             .$bills->count().")},同名退单:(".json_encode($bills).")},实收件:(".json_encode($actualGotItems).")},下载件:("
             .json_encode($downloadedSkuItems).")},退单号:{$logisticNumberReturn}",null);
 
         if(!$isItemsReceivedOverDownloaded){//实收小于等于下发(下发大于等于实收),入库
-            if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"退单事件中,入库触发(实收小于等于下发),退单号:{$logisticNumberReturn}",null);
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"退单事件中,入库触发(实收小于等于下发),退单号:{$logisticNumberReturn}",null);
             foreach ($bills as $bill){
                 if($bill['is_loaded']!==1){
-                    event(new InformWMSReceivedEvent($bill));
+                    $bill->setIsLoaded_toWaitConfirm();
+//                    event(new InformWMSReceivedEvent($bill)); //暂时关闭下发途迳的入库,不管是录入后才下发,延时处理发现待推单,该入的都改为人工确定
                 }
             }
-            if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"退单事件中,入库完成并结束事件,退单号:{$logisticNumberReturn}",null);
+            if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"退单事件中,入库完成并结束事件,退单号:{$logisticNumberReturn}",null);
             return;
         }
 
 
-        if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"实收大于下发(不入库),退单号:{$logisticNumberReturn}",null);
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"实收大于下发(不入库),退单号:{$logisticNumberReturn}",null);
         //(下发小于实收)
         //该单号在6小时前录入的(不是当前最新录入),直接不入库,将实收推给客户(笕尚),并且退单号下所有WMS本地单作废
         $lastReceive=$wmsReceives->first();
         if($lastReceive&&$lastReceive['created_at'])
             if(Carbon::now()->greaterThan(Carbon::make($lastReceive['created_at'])->addHours(6))){
-                if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"退单事件中,6小时内WMS下发的该退单,将不入库的单推给笕尚,准备进入推送接口,退单号:{$logisticNumberReturn}",null);
-                (new RejectedBillItemController())->sendRejectedToThirdPart2($actualGotItems,$bills->first());  //!!!
-                if(config('jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"退单事件中,完成推单给笕尚,准备进入推送接口,退单号:{$logisticNumberReturn}",null);
+                if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"退单事件中,下发小于实收。6小时前WMS下发的该退单,将不入库的单推给笕尚,未来不再处理该单!退单号:{$logisticNumberReturn}",null);
+                (new RejectedBillItemController())->sendRejectedToThirdPart2($actualGotItems,$bills->first());
                 return;
             }
 
@@ -108,6 +108,7 @@ class WmsReceiveNewListener
         if($wmsReceives->isNotEmpty()){
             Controller::logS(__METHOD__,  __FUNCTION__,  '推入任务,13小时后执行本事件,退单号:'.$logisticNumberReturn);
             ProcessReceiveCombinedJob::dispatch($logisticNumberReturn)->delay(now()->addHours(13));
+            return;
         }
         Controller::logS(__METHOD__,'error_'.__FUNCTION__,"退单事件已走完,但下载的WMS退单不存在! 退单号:{$logisticNumberReturn}",null);
     }

+ 15 - 0
app/OracleBasSKU.php

@@ -0,0 +1,15 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+/**
+ * WMS_USER
+ * 产品档案 OracleBas_SKU
+ */
+class OracleBasSKU extends Model
+{
+    protected $connection="oracle";
+    protected $table="BAS_SKU";
+}

+ 11 - 0
app/OracleDOCASNDetail.php

@@ -0,0 +1,11 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class OracleDOCASNDetail extends Model
+{
+    protected $connection="oracle";
+    protected $table="Doc_ASN_Details";
+}

+ 11 - 0
app/OracleDOCMovementDetail.php

@@ -0,0 +1,11 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class OracleDOCMovementDetail extends Model
+{
+    protected $connection="oracle";
+    protected $table="DOC_Movement_Details";
+}

+ 12 - 0
app/OracleDOCMovementHeader.php

@@ -0,0 +1,12 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class OracleDOCMovementHeader extends Model
+{
+    protected $connection="oracle";
+    protected $table="DOC_Movement_Header";
+    protected $primaryKey="MDOCNO";
+}

+ 11 - 0
app/OracleDOCOrderDetail.php

@@ -0,0 +1,11 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class OracleDOCOrderDetail extends Model
+{
+    protected $connection="oracle";
+    protected $table="DOC_Order_Details";
+}

+ 8 - 14
app/Process.php

@@ -7,11 +7,10 @@ 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'
+        'code','owner_id','process_method_id','unit_price','status','remark','amount','completed_amount','created_at','updated_at'
     ];
     protected $appends=[
-        'owner_name','process_method_name','commodity_name','commodity_barcode'
+        'owner_name','process_method_name',
     ];
 
     public function owner(){
@@ -20,12 +19,15 @@ class Process extends Model
     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 processesContents(){
+        return $this->hasMany('App\ProcessesContent','process_id','id');
+    }
+    public function processDailies(){
+        return $this->hasMany('App\ProcessDaily','process_id','id');
+    }
 
 
     public function getOwnerNameAttribute()
@@ -36,12 +38,4 @@ class Process extends Model
     {
         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;
-    }
 }

+ 10 - 2
app/ProcessDaily.php

@@ -9,12 +9,20 @@ class ProcessDaily extends Model
     protected $fillable=[
         'process_id','date','output','remain'
     ];
+    protected $appends=[
+        'process_code'
+    ];
 
 
     public function process(){
-        return $this->belongsTo('App\Process','process_id','id');
+        return $this->hasOne('App\Process','id','process_id');
     }
     public function processDailyParticipants(){
-        return $this->hasMany('App\ProcessDailyParticipant','process_daily_id','process_id');
+        return $this->hasMany('App\ProcessDailyParticipant','process_daily_id','id');
+    }
+
+    public function getProcessCodeAttribute()
+    {
+        return $this['process'] ? $this['process']['code'] : null;
     }
 }

+ 14 - 6
app/ProcessDailyParticipant.php

@@ -8,19 +8,27 @@ 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'
+        'hour_count','unit_price','unit_count','dinner_duration','remark','status'
     ];
     protected $appends=[
-        'user_name'
+        'user_detail_full_name',
+        'process_daily_date',
     ];
 
-    public function user(){
-        return $this->belongsTo('App\User','user_id','id');
+    public function user_detail(){
+        return $this->belongsTo('App\UserDetail','user_id','user_id');
+    }
+    public function processDaily(){
+        return $this->belongsTo('App\ProcessDaily','process_daily_id','id');
     }
 
 
-    public function getUserNameAttribute()
+    public function getUserDetailFullNameAttribute()
+    {
+        return $this['user_detail']?$this['user_detail']['full_name']:null;
+    }
+    public function getProcessDailyDateAttribute()
     {
-        return $this['user']?$this['user']['name']:null;
+        return $this['processDaily'] ? $this['processDaily']['date'] : null;
     }
 }

+ 5 - 0
app/ProcessStatistic.php

@@ -9,9 +9,14 @@ class ProcessStatistic extends Model
     //重新约定主键且不允许自增
     protected $primaryKey='process_id';
     public $incrementing=false;
+    public $timestamps=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'
     ];
+
+    public function process(){
+        return $this->belongsTo('App\Process','process_id','id');
+    }
 }

+ 0 - 16
app/ProcessesAdditionalBill.php

@@ -1,16 +0,0 @@
-<?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');
-    }
-}

+ 27 - 0
app/ProcessesContent.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class ProcessesContent extends Model
+{
+    protected $fillable=[
+        'process_id','bill_type','commodity_id','wms_code','amount'
+    ];
+    protected $appends=[
+        'commodity_name',
+    ];
+
+    public function process(){
+        return $this->belongsTo('App\Process','process_id','id');
+    }
+    public function commodity(){
+        return $this->belongsTo('App\Commodity','commodity_id','id');
+    }
+
+    public function getCommodityNameAttribute()
+    {
+        return $this['commodity']? $this['commodity']['name']:null;
+    }
+}

+ 9 - 0
app/RejectedBill.php

@@ -2,11 +2,13 @@
 
 namespace App;
 
+use App\Http\Controllers\Controller;
 use App\Http\Controllers\LogisticNumberFeatureController;
 use Carbon\Carbon;
 use Illuminate\Database\Eloquent\Collection;
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\SoftDeletes;
+use Illuminate\Support\Facades\Auth;
 use Overtrue\LaravelPinyin\Facades\Pinyin;
 
 /**
@@ -37,6 +39,12 @@ class RejectedBill extends Model
     function wmsReflectReceive(){
         return $this->belongsTo('App\WMSReflectReceive','id','id_rejected_bill');
     }
+    function setIsLoaded_toWaitConfirm(){
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"将待推单修改为待确认! 退单号:".$this['logistic_number_return'],Auth::user()['id']);
+        $bill=RejectedBill::find($this['id']);
+        $bill['is_loaded']=4;
+        $bill->save();
+    }
     function logisticName(){
         $logistic=$this->hasOne('App\Logistic','id','id_logistic_return')->first();
         return $logistic?$logistic['name']:'';
@@ -83,6 +91,7 @@ class RejectedBill extends Model
             case '0':return '否';
             case 1:return '是';
             case 2:return '待推单';
+            case 3:return '上传异常';
         }
         return '';
     }

+ 16 - 2
app/Tutorial.php

@@ -3,11 +3,15 @@
 namespace App;
 
 use Illuminate\Database\Eloquent\Model;
+use Te7aHoudini\LaravelTrix\Traits\HasTrixRichText;
 
 class Tutorial extends Model
 {
+    use HasTrixRichText;
+    protected $guarded=[];
+
     protected $fillable=[
-        'owner_id','name','content','type'
+        'owner_id','name','type'
     ];
     protected $appends=[
         'owner_name'
@@ -16,9 +20,19 @@ class Tutorial extends Model
     public function owner(){
         return $this->belongsTo('App\Owner','owner_id','id');
     }
+    public function trixRichText(){
+        return $this->belongsTo('Te7aHoudini\LaravelTrix\Models\TrixRichText','id','model_id');
+    }
+    public function trixAttachments()
+    {
+        return $this->hasMany('Te7aHoudini\LaravelTrix\Models\TrixAttachment','attachable_id','id');
+    }
+    public function processes(){
+        return $this->belongsToMany('App\Process');
+    }
 
     public function getOwnerNameAttribute()
     {
-        $this['owner']? $this['owner']['name']:null;
+        return $this['owner']? $this['owner']['name']:null;
     }
 }

+ 12 - 0
app/TutorialContent.php

@@ -0,0 +1,12 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+use Te7aHoudini\LaravelTrix\Traits\HasTrixRichText;
+
+class TutorialContent extends Model
+{
+    use HasTrixRichText;
+    protected $guarded=[];
+}

+ 12 - 3
app/UserDetail.php

@@ -13,15 +13,24 @@ class UserDetail extends Model
         'user_id','full_name','gender','identity_number','mobile_phone','type'
     ];
     protected $appends=[
-        'user_name'
+        'user_labor_company'
     ];
 
     public function user(){
         return $this->belongsTo('App\User','user_id','id');
     }
+    public function user_labor(){
+        return $this->belongsTo('App\UserLabor','user_id','user_id');
+    }
+    public function userDutyChecks(){
+        return $this->hasMany('App\UserDutyCheck','user_id','user_id');
+    }
+
 
-    public function getAttribute()
+    public function getUserLaborCompanyAttribute()
     {
-        return $this['user']?$this['user']['name']:null;
+        return $this['user_labor'] ?$this['user_labor']['company'] : null;
     }
+
+
 }

+ 4 - 9
app/UserDutyCheck.php

@@ -6,19 +6,14 @@ use Illuminate\Database\Eloquent\Model;
 
 class UserDutyCheck extends Model
 {
+    public $timestamps=false;
+
     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 userDetail(){
+        return $this->belongsTo('App\UserDetail','user_id','user_id');
     }
 
-    public function getUserNameAttribute()
-    {
-        return $this['user']?$this['user']['name']:null;
-    }
 }

+ 3 - 9
app/UserLabor.php

@@ -8,20 +8,14 @@ class UserLabor extends Model
 {
     protected $primaryKey='user_id';
     public $incrementing=false;
+    public $timestamps=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 userDetail(){
+        return $this->belongsTo('App\UserDetail','user_id','user_id');
     }
 
-    public function getAttribute()
-    {
-        return $this['user']?$this['user']['name']:null;
-    }
 }

+ 13 - 0
app/WMSWaybill.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class WMSWaybill extends Model
+{
+    //
+    protected $fillable=['OrderNo','CustomerID','CarrierID','ConsigneeName',
+        'C_Tel','C_Address','C_Province','C_City','C_District'];
+
+}

+ 11 - 0
app/WMSWaybillOrder.php

@@ -0,0 +1,11 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class WMSWaybillOrder extends Model
+{
+    protected $fillable = ['OrderNo','SKU_Descr_c','SKU','Alternate_sku1','Qtyordered_each',
+        'Cubic','GrossWeight','NetWeight'];
+}

+ 226 - 0
bootstrap/cache/services.php

@@ -0,0 +1,226 @@
+<?php return array (
+  'providers' => 
+  array (
+    0 => 'Illuminate\\Auth\\AuthServiceProvider',
+    1 => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
+    2 => 'Illuminate\\Bus\\BusServiceProvider',
+    3 => 'Illuminate\\Cache\\CacheServiceProvider',
+    4 => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    5 => 'Illuminate\\Cookie\\CookieServiceProvider',
+    6 => 'Illuminate\\Database\\DatabaseServiceProvider',
+    7 => 'Illuminate\\Encryption\\EncryptionServiceProvider',
+    8 => 'Illuminate\\Filesystem\\FilesystemServiceProvider',
+    9 => 'Illuminate\\Foundation\\Providers\\FoundationServiceProvider',
+    10 => 'Illuminate\\Hashing\\HashServiceProvider',
+    11 => 'Illuminate\\Mail\\MailServiceProvider',
+    12 => 'Illuminate\\Notifications\\NotificationServiceProvider',
+    13 => 'Illuminate\\Pagination\\PaginationServiceProvider',
+    14 => 'Illuminate\\Pipeline\\PipelineServiceProvider',
+    15 => 'Illuminate\\Queue\\QueueServiceProvider',
+    16 => 'Illuminate\\Redis\\RedisServiceProvider',
+    17 => 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider',
+    18 => 'Illuminate\\Session\\SessionServiceProvider',
+    19 => 'Illuminate\\Translation\\TranslationServiceProvider',
+    20 => 'Illuminate\\Validation\\ValidationServiceProvider',
+    21 => 'Illuminate\\View\\ViewServiceProvider',
+    22 => 'Barryvdh\\Debugbar\\ServiceProvider',
+    23 => 'BeyondCode\\DumpServer\\DumpServerServiceProvider',
+    24 => 'Facade\\Ignition\\IgnitionServiceProvider',
+    25 => 'Fideloper\\Proxy\\TrustedProxyServiceProvider',
+    26 => 'Laravel\\Tinker\\TinkerServiceProvider',
+    27 => 'Laravel\\Ui\\UiServiceProvider',
+    28 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
+    29 => 'Carbon\\Laravel\\ServiceProvider',
+    30 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
+    31 => 'Overtrue\\LaravelPinyin\\ServiceProvider',
+    32 => 'Te7aHoudini\\LaravelTrix\\LaravelTrixServiceProvider',
+    33 => 'Yajra\\Oci8\\Oci8ServiceProvider',
+    34 => 'Yajra\\Oci8\\Oci8ServiceProvider',
+    35 => 'App\\Providers\\AppServiceProvider',
+    36 => 'App\\Providers\\AuthServiceProvider',
+    37 => 'App\\Providers\\BroadcastServiceProvider',
+    38 => 'App\\Providers\\EventServiceProvider',
+    39 => 'App\\Providers\\RouteServiceProvider',
+  ),
+  'eager' => 
+  array (
+    0 => 'Illuminate\\Auth\\AuthServiceProvider',
+    1 => 'Illuminate\\Cookie\\CookieServiceProvider',
+    2 => 'Illuminate\\Database\\DatabaseServiceProvider',
+    3 => 'Illuminate\\Encryption\\EncryptionServiceProvider',
+    4 => 'Illuminate\\Filesystem\\FilesystemServiceProvider',
+    5 => 'Illuminate\\Foundation\\Providers\\FoundationServiceProvider',
+    6 => 'Illuminate\\Notifications\\NotificationServiceProvider',
+    7 => 'Illuminate\\Pagination\\PaginationServiceProvider',
+    8 => 'Illuminate\\Session\\SessionServiceProvider',
+    9 => 'Illuminate\\View\\ViewServiceProvider',
+    10 => 'Barryvdh\\Debugbar\\ServiceProvider',
+    11 => 'BeyondCode\\DumpServer\\DumpServerServiceProvider',
+    12 => 'Facade\\Ignition\\IgnitionServiceProvider',
+    13 => 'Fideloper\\Proxy\\TrustedProxyServiceProvider',
+    14 => 'Laravel\\Ui\\UiServiceProvider',
+    15 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
+    16 => 'Carbon\\Laravel\\ServiceProvider',
+    17 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
+    18 => 'Overtrue\\LaravelPinyin\\ServiceProvider',
+    19 => 'Te7aHoudini\\LaravelTrix\\LaravelTrixServiceProvider',
+    20 => 'Yajra\\Oci8\\Oci8ServiceProvider',
+    21 => 'Yajra\\Oci8\\Oci8ServiceProvider',
+    22 => 'App\\Providers\\AppServiceProvider',
+    23 => 'App\\Providers\\AuthServiceProvider',
+    24 => 'App\\Providers\\BroadcastServiceProvider',
+    25 => 'App\\Providers\\EventServiceProvider',
+    26 => 'App\\Providers\\RouteServiceProvider',
+  ),
+  'deferred' => 
+  array (
+    'Illuminate\\Broadcasting\\BroadcastManager' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
+    'Illuminate\\Contracts\\Broadcasting\\Factory' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
+    'Illuminate\\Contracts\\Broadcasting\\Broadcaster' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
+    'Illuminate\\Bus\\Dispatcher' => 'Illuminate\\Bus\\BusServiceProvider',
+    'Illuminate\\Contracts\\Bus\\Dispatcher' => 'Illuminate\\Bus\\BusServiceProvider',
+    'Illuminate\\Contracts\\Bus\\QueueingDispatcher' => 'Illuminate\\Bus\\BusServiceProvider',
+    'cache' => 'Illuminate\\Cache\\CacheServiceProvider',
+    'cache.store' => 'Illuminate\\Cache\\CacheServiceProvider',
+    'cache.psr6' => 'Illuminate\\Cache\\CacheServiceProvider',
+    'memcached.connector' => 'Illuminate\\Cache\\CacheServiceProvider',
+    'command.cache.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.cache.forget' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.clear-compiled' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.auth.resets.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.config.cache' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.config.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.db.wipe' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.down' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.environment' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.event.cache' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.event.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.event.list' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.key.generate' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.optimize' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.optimize.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.package.discover' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.queue.failed' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.queue.flush' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.queue.forget' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.queue.listen' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.queue.restart' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.queue.retry' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.queue.work' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.route.cache' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.route.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.route.list' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.seed' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'Illuminate\\Console\\Scheduling\\ScheduleFinishCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'Illuminate\\Console\\Scheduling\\ScheduleRunCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.storage.link' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.up' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.view.cache' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.view.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.cache.table' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.cast.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.channel.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.component.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.console.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.controller.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.event.generate' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.event.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.exception.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.factory.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.job.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.listener.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.mail.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.middleware.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.model.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.notification.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.notification.table' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.observer.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.policy.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.provider.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.queue.failed-table' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.queue.table' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.request.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.resource.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.rule.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.seeder.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.session.table' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.serve' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.stub.publish' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.test.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.vendor.publish' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'migrator' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'migration.repository' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'migration.creator' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.migrate' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.migrate.fresh' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.migrate.install' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.migrate.refresh' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.migrate.reset' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.migrate.rollback' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.migrate.status' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'command.migrate.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'composer' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
+    'hash' => 'Illuminate\\Hashing\\HashServiceProvider',
+    'hash.driver' => 'Illuminate\\Hashing\\HashServiceProvider',
+    'mail.manager' => 'Illuminate\\Mail\\MailServiceProvider',
+    'mailer' => 'Illuminate\\Mail\\MailServiceProvider',
+    'Illuminate\\Mail\\Markdown' => 'Illuminate\\Mail\\MailServiceProvider',
+    'Illuminate\\Contracts\\Pipeline\\Hub' => 'Illuminate\\Pipeline\\PipelineServiceProvider',
+    'queue' => 'Illuminate\\Queue\\QueueServiceProvider',
+    'queue.worker' => 'Illuminate\\Queue\\QueueServiceProvider',
+    'queue.listener' => 'Illuminate\\Queue\\QueueServiceProvider',
+    'queue.failer' => 'Illuminate\\Queue\\QueueServiceProvider',
+    'queue.connection' => 'Illuminate\\Queue\\QueueServiceProvider',
+    'redis' => 'Illuminate\\Redis\\RedisServiceProvider',
+    'redis.connection' => 'Illuminate\\Redis\\RedisServiceProvider',
+    'auth.password' => 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider',
+    'auth.password.broker' => 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider',
+    'translator' => 'Illuminate\\Translation\\TranslationServiceProvider',
+    'translation.loader' => 'Illuminate\\Translation\\TranslationServiceProvider',
+    'validator' => 'Illuminate\\Validation\\ValidationServiceProvider',
+    'validation.presence' => 'Illuminate\\Validation\\ValidationServiceProvider',
+    'command.tinker' => 'Laravel\\Tinker\\TinkerServiceProvider',
+  ),
+  'when' => 
+  array (
+    'Illuminate\\Broadcasting\\BroadcastServiceProvider' => 
+    array (
+    ),
+    'Illuminate\\Bus\\BusServiceProvider' => 
+    array (
+    ),
+    'Illuminate\\Cache\\CacheServiceProvider' => 
+    array (
+    ),
+    'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider' => 
+    array (
+    ),
+    'Illuminate\\Hashing\\HashServiceProvider' => 
+    array (
+    ),
+    'Illuminate\\Mail\\MailServiceProvider' => 
+    array (
+    ),
+    'Illuminate\\Pipeline\\PipelineServiceProvider' => 
+    array (
+    ),
+    'Illuminate\\Queue\\QueueServiceProvider' => 
+    array (
+    ),
+    'Illuminate\\Redis\\RedisServiceProvider' => 
+    array (
+    ),
+    'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider' => 
+    array (
+    ),
+    'Illuminate\\Translation\\TranslationServiceProvider' => 
+    array (
+    ),
+    'Illuminate\\Validation\\ValidationServiceProvider' => 
+    array (
+    ),
+    'Laravel\\Tinker\\TinkerServiceProvider' => 
+    array (
+    ),
+  ),
+);

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 172 - 558
composer.lock


+ 0 - 151
config/UEditorUpload.php

@@ -1,151 +0,0 @@
-<?php
-
-/* 前后端通信相关的配置,注释只允许使用多行方式 */
-return [
-
-
-    /*
-    |--------------------------------------------------------------------------
-    | 新增配置,route
-    |--------------------------------------------------------------------------
-    |
-    |注意权限验证,请自行添加middleware
-    |middleware 相当重要,请根据自己的项目设置,比如如果在后台使用,请设置为后台的auth middleware.
-    |如果是单纯本机测试,请将
-    |`// 'middleware' => 'auth',` 直接注释掉,如果留 `'middleware'=>''`空值,会产生bug,原因不详.
-    |
-    |
-    */
-    'core' => [
-        'route' => [
-            // 'middleware' => 'auth',
-        ],
-
-        'mode' => 'storage',//上传方式,local 为本地   qiniu 为七牛,oss为阿里云oss,storage 为使用laravel的storage
-
-        //七牛配置,若mode='qiniu',以下为必填.
-        'qiniu' => [
-            'accessKey' => '',
-            'secretKey' => '',
-            'bucket' => '',
-            'url' => 'http://xxx.clouddn.com',//七牛分配的CDN域名,注意带上http://
-
-        ],
-
-
-        'oss' => [
-            'driver' => 'oss',
-            'access_id' => env('ALI_ACCESS_KEY_ID', ''),//'<Your Aliyun OSS AccessKeyId>',
-            'access_key' => env('ALI_ACCESS_KEY_SECRET', ''),//'<Your Aliyun OSS AccessKeySecret>',
-            'bucket' => env('ALI_OSS_BUCKET', ''),//'<OSS bucket name>',
-            'endpoint' => env('ALI_OSS_ENDPOINT', 'oss-cn-hangzhou.aliyuncs.com'),//'<the endpoint of OSS, E.g: oss-cn-hangzhou.aliyuncs.com | custom domain, E.g:img.abc.com>', // OSS 外网节点或自定义外部域名
-//                'endpoint_internal' => env('ALI_OSS_ENDPOINT_INTERNAL','oss-cn-hangzhou-internal.aliyuncs.com'),//'<internal endpoint [OSS内网节点] 如:oss-cn-shenzhen-internal.aliyuncs.com>', // v2.0.4 新增配置属性,如果为空,则默认使用 endpoint 配置(由于内网上传有点小问题未解决,请大家暂时不要使用内网节点上传,正在与阿里技术沟通中)
-            'cdnDomain' => env('ALI_OSS_CDN_DOMAIN', ''),//'<CDN domain, cdn域名>', // 如果isCName为true, getUrl会判断cdnDomain是否设定来决定返回的url,如果cdnDomain未设置,则使用endpoint来生成url,否则使用cdn
-            'ssl' => env('ALI_OSS_SSL', false),//<true|false> // true to use 'https://' and false to use 'http://'. default is false,
-            'isCName' => env('ALI_OSS_IS_CNAME', true),//<true|false> // 是否使用自定义域名,true: 则Storage.url()会使用自定义的cdn或域名生成文件url, false: 则使用外部节点生成url
-            'debug' => false//<true|false>
-        ],
-        'storage' => [
-            'folder' => 'files',//注意不要加'/'
-            'classifyByFileType' => false,//是否根据文件类型拆分到子文件夹
-
-        ],
-
-
-    ],
-    /**
-     * 和原 UEditor /php/config.json 配置完全相同
-     *
-     */
-    /* 上传图片配置项 */
-    'upload' => [
-        "imageActionName" => "uploadimage", /* 执行上传图片的action名称 */
-        "imageFieldName" => "upfile", /* 提交的图片表单名称 */
-        "imageMaxSize" => 2048000, /* 上传大小限制,单位B */
-        "imageAllowFiles" => [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 上传图片格式显示 */
-        "imageCompressEnable" => true, /* 是否压缩图片,默认是true */
-        "imageCompressBorder" => 1600, /* 图片压缩最长边限制 */
-        "imageInsertAlign" => "none", /* 插入的图片浮动方式 */
-        "imageUrlPrefix" => "", /* 图片访问路径前缀 */
-        "imagePathFormat" => "/uploads/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
-        /* {filename} 会替换成原文件名,配置这项需要注意中文乱码问题 */
-        /* {rand:6} 会替换成随机数,后面的数字是随机数的位数 */
-        /* {time} 会替换成时间戳 */
-        /* {yyyy} 会替换成四位年份 */
-        /* {yy} 会替换成两位年份 */
-        /* {mm} 会替换成两位月份 */
-        /* {dd} 会替换成两位日期 */
-        /* {hh} 会替换成两位小时 */
-        /* {ii} 会替换成两位分钟 */
-        /* {ss} 会替换成两位秒 */
-        /* 非法字符 \ : * ? " < > | */
-        /* 具请体看线上文档: fex.baidu.com/ueditor/#use-format_upload_filename */
-
-        /* 涂鸦图片上传配置项 */
-        "scrawlActionName" => "uploadscrawl", /* 执行上传涂鸦的action名称 */
-        "scrawlFieldName" => "upfile", /* 提交的图片表单名称 */
-        "scrawlPathFormat" => "/uploads/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
-        "scrawlMaxSize" => 2048000, /* 上传大小限制,单位B */
-        "scrawlUrlPrefix" => "", /* 图片访问路径前缀 */
-        "scrawlInsertAlign" => "none",
-
-        /* 截图工具上传 */
-        "snapscreenActionName" => "uploadimage", /* 执行上传截图的action名称 */
-        "snapscreenPathFormat" => "/uploads/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
-        "snapscreenUrlPrefix" => "", /* 图片访问路径前缀 */
-        "snapscreenInsertAlign" => "none", /* 插入的图片浮动方式 */
-
-        /* 抓取远程图片配置 */
-        "catcherLocalDomain" => ["127.0.0.1", "localhost", "img.baidu.com"],
-        "catcherActionName" => "catchimage", /* 执行抓取远程图片的action名称 */
-        "catcherFieldName" => "source", /* 提交的图片列表表单名称 */
-        "catcherPathFormat" => "/uploads/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
-        "catcherUrlPrefix" => "", /* 图片访问路径前缀 */
-        "catcherMaxSize" => 2048000, /* 上传大小限制,单位B */
-        "catcherAllowFiles" => [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 抓取图片格式显示 */
-
-        /* 上传视频配置 */
-        "videoActionName" => "uploadvideo", /* 执行上传视频的action名称 */
-        "videoFieldName" => "upfile", /* 提交的视频表单名称 */
-        "videoPathFormat" => "/uploads/ueditor/php/upload/video/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
-        "videoUrlPrefix" => "", /* 视频访问路径前缀 */
-        "videoMaxSize" => 102400000, /* 上传大小限制,单位B,默认100MB */
-        "videoAllowFiles" => [
-            ".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
-            ".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid"], /* 上传视频格式显示 */
-
-        /* 上传文件配置 */
-        "fileActionName" => "uploadfile", /* controller里,执行上传视频的action名称 */
-        "fileFieldName" => "upfile", /* 提交的文件表单名称 */
-        "filePathFormat" => "/uploads/ueditor/php/upload/file/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
-        "fileUrlPrefix" => "", /* 文件访问路径前缀 */
-        "fileMaxSize" => 51200000, /* 上传大小限制,单位B,默认50MB */
-        "fileAllowFiles" => [
-            ".png", ".jpg", ".jpeg", ".gif", ".bmp",
-            ".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
-            ".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid",
-            ".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso",
-            ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml"
-        ], /* 上传文件格式显示 */
-
-        /* 列出指定目录下的图片 */
-        "imageManagerActionName" => "listimage", /* 执行图片管理的action名称 */
-        "imageManagerListPath" => "/uploads/ueditor/php/upload/image/", /* 指定要列出图片的目录 */
-        "imageManagerListSize" => 20, /* 每次列出文件数量 */
-        "imageManagerUrlPrefix" => "", /* 图片访问路径前缀 */
-        "imageManagerInsertAlign" => "none", /* 插入的图片浮动方式 */
-        "imageManagerAllowFiles" => [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 列出的文件类型 */
-
-        /* 列出指定目录下的文件 */
-        "fileManagerActionName" => "listfile", /* 执行文件管理的action名称 */
-        "fileManagerListPath" => "/uploads/ueditor/php/upload/file/", /* 指定要列出文件的目录 */
-        "fileManagerUrlPrefix" => "", /* 文件访问路径前缀 */
-        "fileManagerListSize" => 20, /* 每次列出文件数量 */
-        "fileManagerAllowFiles" => [
-            ".png", ".jpg", ".jpeg", ".gif", ".bmp",
-            ".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
-            ".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid",
-            ".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso",
-            ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml"
-        ]] /* 列出的文件类型 */
-];

+ 4 - 0
config/api.php

@@ -15,6 +15,7 @@ return [
     /** Flux
     https://was.baoshi56.com/api/thirdPart/flux/receive/new  //新增收货
     https://was.baoshi56.com/api/thirdPart/flux/package/new  //新增包裹
+    https://was.baoshi56.com/api/thirdPart/flux/waybill/new  //新增运单
      **/
     'flux'=>[
         'receive'=>[
@@ -23,6 +24,9 @@ return [
         'package'=>[
             'new'=>'http://106.14.155.246:19192/datahub/FluxBSJsonApi/TASK' //通知WMS, 已称完的包裹
         ],
+        'waybill'=>[
+            'new'=>'http://47.103.72.58:19199/datahub/FluxBSJsonApi/?messageId=BS_TMS' //通知WMS, 已称完的包裹
+        ],
     ],
 
     'baidu'=>[

+ 1 - 1
config/app.php

@@ -161,7 +161,7 @@ return [
         Illuminate\Translation\TranslationServiceProvider::class,
         Illuminate\Validation\ValidationServiceProvider::class,
         Illuminate\View\ViewServiceProvider::class,
-        \Stevenyangecho\UEditor\UEditorServiceProvider::class,
+        Yajra\Oci8\Oci8ServiceProvider::class,
 
         /*
          * Package Service Providers...

+ 12 - 0
config/database.php

@@ -63,6 +63,18 @@ return [
             ]) : [],
         ],
 
+        'oracle' => [
+            'driver' => 'oracle',
+            'host' => '106.14.148.85',
+            'port' => '1521',
+            'database'=> '',
+            'service_name' => 'orcl',
+            'username' => 'WMS_USER',
+            'password' => 'WMS_USER',
+            'charset' => 'utf8',
+            'prefix' => '',
+        ],
+
         'pgsql' => [
             'driver' => 'pgsql',
             'url' => env('DATABASE_URL'),

+ 7 - 0
config/hr.php

@@ -0,0 +1,7 @@
+<?php
+
+return [
+
+    'qrCode_refresh_everyday' =>true,
+
+];

+ 9 - 0
config/laravel-trix.php

@@ -0,0 +1,9 @@
+<?php
+
+return [
+    'storage_disk' => env('LARAVEL_TRIX_STORAGE_DISK','public'),
+
+    'store_attachment_action' => Te7aHoudini\LaravelTrix\Http\Controllers\TrixAttachmentController::class.'@store',
+
+    'destroy_attachment_action' => Te7aHoudini\LaravelTrix\Http\Controllers\TrixAttachmentController::class.'@destroy',
+];

+ 1 - 1
config/session.php

@@ -166,7 +166,7 @@ return [
     |
     */
 
-    'secure' => env('SESSION_SECURE_COOKIE', false),
+    'secure' => env('SESSION_SECURE_COOKIE', null),
 
     /*
     |--------------------------------------------------------------------------

+ 12 - 0
database/factories/WMSWaybillFactory.php

@@ -0,0 +1,12 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\WMSWaybill;
+use Faker\Generator as Faker;
+
+$factory->define(WMSWaybill::class, function (Faker $faker) {
+    return [
+        //
+    ];
+});

+ 12 - 0
database/factories/WMSWaybillOrderFactory.php

@@ -0,0 +1,12 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\WMSWaybillOrder;
+use Faker\Generator as Faker;
+
+$factory->define(WMSWaybillOrder::class, function (Faker $faker) {
+    return [
+        //
+    ];
+});

+ 10 - 0
database/migrations/2019_11_22_094253_create_cities_table.php

@@ -52,6 +52,7 @@ class CreateCitiesTable extends Migration
         $Hunan=['长沙','株洲','湘潭','衡阳','邵阳','岳阳','常德','张家界','益阳','郴州','永州','怀化','娄底','吉首'];
         $Henan=['郑州','开封','洛阳','平顶山','安阳','鹤壁','新乡','焦作','濮阳','许昌','漯河','三门峡','商丘','周口','驻马店','南阳','信阳','济源'];
         $Hainan=['海口','三亚'];
+        $ShangHai=['上海'];
         $provinces=['陕西','甘肃','宁夏','青海','新疆','江苏','淅江','安徽','江西','福建','重庆','四川','云南',
             '贵州','西藏','黑龙江','吉林','辽宁','山东','北京','天津','广西','广东','河北','山西','内蒙古',
             '湖北','湖南','河南','海南','香港','澳门','台湾','上海'];
@@ -326,6 +327,15 @@ class CreateCitiesTable extends Migration
                     ]);
                 }
             }
+            if ($provinces[$i]=="上海"){
+                $province=\App\Province::where('name','=',$provinces[$i])->first();
+                for ($j=0;$j<count($Hainan);$j++){
+                    \App\City::create([
+                        'province_id'=>$province->id,
+                        'name'=>$ShangHai[$j],
+                    ]);
+                }
+            }
         }
     }
 

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

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

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

@@ -17,7 +17,7 @@ class CreateProcessStatisticsTable extends Migration
     {
         Schema::create('process_statistics', function (Blueprint $table) {
             $table->bigInteger('process_id')->unique()->comment('外键二次加工单');
-            $table->timestamp('started_at')->comment('开始日期');
+            $table->timestamp('started_at')->nullable()->comment('开始日期');
             $table->timestamp('ended_at')->nullable()->comment('结束日期');
             $table->decimal('revenue')->nullable()->comment('收入合计');
             $table->integer('duration_days')->nullable()->comment('完成天数');

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

@@ -18,7 +18,7 @@ class CreateProcessDailiesTable extends Migration
         Schema::create('process_dailies', function (Blueprint $table) {
             $table->bigIncrements('id');
             $table->bigInteger('process_id')->comment('外键二次加工单');
-            $table->date('time')->index()->comment('日期');
+            $table->date('date')->index()->comment('日期');
             $table->integer('output')->comment('当日产量');
             $table->integer('remain')->comment('当日剩余');
             $table->timestamps();

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

@@ -18,7 +18,7 @@ class CreateUserDutyChecksTable extends Migration
         Schema::create('user_duty_checks', function (Blueprint $table) {
             $table->bigIncrements('id');
             $table->bigInteger('user_id')->index()->comment('外键用户');
-            $table->timestamp('checked_at')->comment('打卡时间');
+            $table->timestamp('checked_at')->index()->comment('打卡时间');
             $table->bigInteger('verify_user_id')->nullable()->comment('外键用户(确认人)');
             $table->enum('type',['无','登出','登入'])->default('无')->comment('打卡类型');
             $table->enum('source',['正常','补入'])->default('正常')->comment('来源');

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

@@ -16,7 +16,7 @@ class CreateUserDetailsTable extends Migration
     public function up()
     {
         Schema::create('user_details', function (Blueprint $table) {
-            $table->bigIncrements('id');
+            $table->bigInteger('user_id')->unique()->comment('外键用户');
             $table->string('full_name')->nullable()->comment('全名');
             $table->enum('gender',['未知','男','女'])->nullable()->comment('性别');
             $table->string('identity_number')->nullable()->index()->comment('身份证号');

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

@@ -17,7 +17,7 @@ class CreateCommodityBarcodesTable extends Migration
             $table->bigIncrements('id');
             $table->string('code')->index();
             $table->string('commodity_id')->index();
-            $table->timestamp();
+            $table->timestamps();
         });
     }
 

+ 32 - 0
database/migrations/2020_04_02_114453_change_process_daily_participant_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class ChangeProcessDailyParticipantTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('process_daily_participants',function (Blueprint $table){
+            $table->enum('status',['已审核','未审核'])->after('remark')->default('未审核')->comment('状态');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('process_daily_participants',function (Blueprint $table){
+            $table->dropColumn('status');
+        });
+    }
+}

+ 41 - 0
database/migrations/2020_04_03_150439_change_process_table.php

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

+ 45 - 0
database/migrations/2020_04_03_150514_change_process_contents_table.php

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

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

@@ -0,0 +1,46 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateTrixRichTextsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('trix_rich_texts', function (Blueprint $table) {
+            $table->unsignedBigInteger('id')->autoIncrement();
+            $table->string('field');
+            $table->morphs('model');
+            $table->text('content')->nullable();
+            $table->timestamps();
+        });
+
+        Schema::create('trix_attachments', function (Blueprint $table) {
+            $table->unsignedBigInteger('id')->autoIncrement();
+            $table->string('field');
+            $table->unsignedInteger('attachable_id')->nullable();
+            $table->string('attachable_type');
+            $table->string('attachment');
+            $table->string('disk');
+            $table->boolean('is_pending')->default(1);
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::drop('trix_attachments');
+        Schema::drop('trix_rich_texts');
+    }
+}

+ 44 - 0
database/migrations/2020_04_09_111337_add_tutorial_authority.php

@@ -0,0 +1,44 @@
+<?php
+
+use App\Authority;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddTutorialAuthority 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();
+        }
+    }
+}

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

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class ChangeTutorialTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('tutorials', function (Blueprint $table) {
+            $table->dropColumn('content');
+        });
+        Schema::table('users', function (Blueprint $table) {
+            $table->string('email')->nullable()->change();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('tutorials', function (Blueprint $table) {
+            $table->longText('content')->after('name')->nullable()->comment('富文本内容');
+        });
+        Schema::table('users', function (Blueprint $table) {
+            $table->string('email')->unique()->change();
+        });
+    }
+}

+ 39 - 0
database/migrations/2020_04_28_141248_create_w_m_s_waybills_table.php

@@ -0,0 +1,39 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateWMSWaybillsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('w_m_s_waybills', function (Blueprint $table) {
+            $table->string('OrderNo')->index()->comment('SO编号');
+            $table->string('CustomerID')->nullable()->comment('客户');
+            $table->string('CarrierID')->nullable()->comment('承运人');
+            $table->string('ConsigneeName')->nullable()->comment('收货人姓名');
+            $table->string('C_Tel')->nullable()->comment('收货人电话');
+            $table->string('C_Address1')->nullable()->comment('收货地址');
+            $table->string('C_Province')->nullable()->comment('省');
+            $table->string('C_City')->nullable()->comment('市');
+            $table->string('C_District')->nullable()->comment('区');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('w_m_s_waybills');
+    }
+}

+ 39 - 0
database/migrations/2020_04_28_141405_create_w_m_s_waybill_orders_table.php

@@ -0,0 +1,39 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateWMSWaybillOrdersTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('w_m_s_waybill_orders', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->string('OrderNo')->index()->comment('SO单号');
+            $table->string('SKU_Descr_c')->nullable()->comment('商品名称');
+            $table->string('SKU')->nullable()->comment('商品编码');
+            $table->string('Alternate_sku1')->nullable()->comment('条码');
+            $table->string('Qtyordered_each')->nullable()->comment('数量');
+            $table->string('Cubic')->nullable()->comment('体称');
+            $table->string('GrossWeight')->nullable()->comment('毛重');
+            $table->string('NetWeight')->nullable()->comment('净重');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('w_m_s_waybill_orders');
+    }
+}

BIN
public/audio.mp3


+ 5 - 0
public/css/app.css

@@ -10,6 +10,11 @@
           text-decoration-line: line-through;
 }
 
+.custom-rich-text-content img {
+  width: 100%;
+  height: auto;
+}
+
 /*!
  * Bootstrap v4.3.1 (https://getbootstrap.com/)
  * Copyright 2011-2019 The Bootstrap Authors

+ 38 - 2
public/js/app.js

@@ -61072,6 +61072,7 @@ window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.
 window.tempTip = __webpack_require__(/*! ./utilities/tempTip */ "./resources/js/utilities/tempTip.js");
 window.getGetVal = __webpack_require__(/*! ./utilities/getGetVal */ "./resources/js/utilities/getGetVal.js");
 window.scanner = __webpack_require__(/*! ./utilities/scanner */ "./resources/js/utilities/scanner.js");
+window.datetimeRelating = __webpack_require__(/*! ./utilities/datetimeRelating */ "./resources/js/utilities/datetimeRelating.js");
 
 /***/ }),
 
@@ -61149,6 +61150,41 @@ window.initEcho = function () {
 
 /***/ }),
 
+/***/ "./resources/js/utilities/datetimeRelating.js":
+/*!****************************************************!*\
+  !*** ./resources/js/utilities/datetimeRelating.js ***!
+  \****************************************************/
+/*! no static exports found */
+/***/ (function(module, exports) {
+
+var datetime = {
+  verifyTime: function verifyTime(time) {
+    setTimeout(function () {
+      time.target.value = time.target.value.replace(':', ':');
+      time.target.value = time.target.value.replace(/[a-zA-Z]/, '');
+      time.target.value = time.target.value.replace(/^([\d]{1})([\s]{1})/, "$1:");
+      time.target.value = time.target.value.replace(/^([\d]{1})([\d]{1})([\s]{1})/, "$1$2:");
+      time.target.value = time.target.value.replace(/^([\d]{1})([\d]{1})([\d]{1})/, "$1$2:$3");
+      time.target.value = time.target.value.replace(/^([\d]{1})([\d]{1})([\d]{1})([\d]{1})(.*?)/, "$1$2$3$4");
+      time.target.value = time.target.value.replace(/^([\d]{1})([\d]{1})([\d]{1})([\d]{1})/, "$1$2:$3$4");
+      time.target.value = time.target.value.replace(/^([\d]{1})([\d]{1}):([\d]{1})([\d]{1})([\s\S]{1})/, "$1$2:$3$4");
+      time.target.value = time.target.value.replace(/^([\d]{1})([\d]{1}):([\D]{1,99})/, "$1$2:");
+      time.target.value = time.target.value.replace(/^([\d]{1})([\d]{1})([\d]{1})\./, "$1:$2$3");
+      time.target.value = time.target.value.replace(/^([\d]{1})\.([\d]{1})([\d]{1})/, "$1:$2$3");
+      time.target.value = time.target.value.replace(/^([\d]{1})([\d]{2})([\S\s]{1,99})/, "$1$2:$3");
+      time.target.value = time.target.value.replace(/^([\d]{1}):([\d]{2})([\S\s]{1,99})/, "$1:$2");
+      time.target.value = time.target.value.replace(/^([\d])/, "$1");
+      time.target.value = time.target.value.replace(/^([1])([\d]{1})/, "$1$2");
+      time.target.value = time.target.value.replace(/^([3-9])([\d]{1})/, "2$2");
+      time.target.value = time.target.value.replace(/^([2-9]{1})([4-9]{1})/, "$13");
+      time.target.value = time.target.value.replace(/^([\d]{1})([\d]{1}):([6-9]{1})/, "$1$2:5");
+    }, 10);
+  }
+};
+module.exports = datetime;
+
+/***/ }),
+
 /***/ "./resources/js/utilities/getGetVal.js":
 /*!*********************************************!*\
   !*** ./resources/js/utilities/getGetVal.js ***!
@@ -61348,8 +61384,8 @@ module.exports = tempTip;
 /*! no static exports found */
 /***/ (function(module, exports, __webpack_require__) {
 
-__webpack_require__(/*! D:\Demo\bswas\resources\js\app.js */"./resources/js/app.js");
-module.exports = __webpack_require__(/*! D:\Demo\bswas\resources\sass\app.scss */"./resources/sass/app.scss");
+__webpack_require__(/*! D:\Reald\desktop\BsWAS\src\resources\js\app.js */"./resources/js/app.js");
+module.exports = __webpack_require__(/*! D:\Reald\desktop\BsWAS\src\resources\sass\app.scss */"./resources/sass/app.scss");
 
 
 /***/ }),

+ 0 - 40
public/laravel-u-editor/dialogs/anchor/anchor.html

@@ -1,40 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-    "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-    <head>
-        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-        <title></title>
-        <style type="text/css">
-            *{color: #838383;margin: 0;padding: 0}
-            html,body {font-size: 12px;overflow: hidden; }
-            .content{padding:5px 0 0 15px;}
-            input{width:210px;height:21px;line-height:21px;margin-left: 4px;}
-        </style>
-    </head>
-    <body>
-        <div class="content">
-            <span><var id="lang_input_anchorName"></var></span><input id="anchorName"  value="" />
-        </div>
-        <script type="text/javascript" src="../internal.js"></script>
-        <script type="text/javascript">
-            var anchorInput = $G('anchorName'),
-                node = editor.selection.getRange().getClosedNode();
-            if(node && node.tagName == 'IMG' && (node = node.getAttribute('anchorname'))){
-                anchorInput.value = node;
-            }
-            anchorInput.onkeydown = function(evt){
-                evt = evt || window.event;
-                if(evt.keyCode == 13){
-                    editor.execCommand('anchor', anchorInput.value);
-                    dialog.close();
-                    domUtils.preventDefault(evt)
-                }
-            };
-            dialog.onok = function (){
-                editor.execCommand('anchor', anchorInput.value);
-                dialog.close();
-            };
-            $focus(anchorInput);
-        </script>
-    </body>
-</html>

+ 0 - 681
public/laravel-u-editor/dialogs/attachment/attachment.css

@@ -1,681 +0,0 @@
-@charset "utf-8";
-/* dialog样式 */
-.wrapper {
-    zoom: 1;
-    width: 630px;
-    *width: 626px;
-    height: 380px;
-    margin: 0 auto;
-    padding: 10px;
-    position: relative;
-    font-family: sans-serif;
-}
-
-/*tab样式框大小*/
-.tabhead {
-    float:left;
-}
-.tabbody {
-    width: 100%;
-    height: 346px;
-    position: relative;
-    clear: both;
-}
-
-.tabbody .panel {
-    position: absolute;
-    width: 0;
-    height: 0;
-    background: #fff;
-    overflow: hidden;
-    display: none;
-}
-
-.tabbody .panel.focus {
-    width: 100%;
-    height: 346px;
-    display: block;
-}
-
-/* 上传附件 */
-.tabbody #upload.panel {
-    width: 0;
-    height: 0;
-    overflow: hidden;
-    position: absolute !important;
-    clip: rect(1px, 1px, 1px, 1px);
-    background: #fff;
-    display: block;
-}
-
-.tabbody #upload.panel.focus {
-    width: 100%;
-    height: 346px;
-    display: block;
-    clip: auto;
-}
-
-#upload .queueList {
-    margin: 0;
-    width: 100%;
-    height: 100%;
-    position: absolute;
-    overflow: hidden;
-}
-
-#upload p {
-    margin: 0;
-}
-
-.element-invisible {
-    width: 0 !important;
-    height: 0 !important;
-    border: 0;
-    padding: 0;
-    margin: 0;
-    overflow: hidden;
-    position: absolute !important;
-    clip: rect(1px, 1px, 1px, 1px);
-}
-
-#upload .placeholder {
-    margin: 10px;
-    border: 2px dashed #e6e6e6;
-    *border: 0px dashed #e6e6e6;
-    height: 172px;
-    padding-top: 150px;
-    text-align: center;
-    background: url(./images/image.png) center 70px no-repeat;
-    color: #cccccc;
-    font-size: 18px;
-    position: relative;
-    top:0;
-    *top: 10px;
-}
-
-#upload .placeholder .webuploader-pick {
-    font-size: 18px;
-    background: #00b7ee;
-    border-radius: 3px;
-    line-height: 44px;
-    padding: 0 30px;
-    *width: 120px;
-    color: #fff;
-    display: inline-block;
-    margin: 0 auto 20px auto;
-    cursor: pointer;
-    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
-}
-
-#upload .placeholder .webuploader-pick-hover {
-    background: #00a2d4;
-}
-
-
-#filePickerContainer {
-    text-align: center;
-}
-
-#upload .placeholder .flashTip {
-    color: #666666;
-    font-size: 12px;
-    position: absolute;
-    width: 100%;
-    text-align: center;
-    bottom: 20px;
-}
-
-#upload .placeholder .flashTip a {
-    color: #0785d1;
-    text-decoration: none;
-}
-
-#upload .placeholder .flashTip a:hover {
-    text-decoration: underline;
-}
-
-#upload .placeholder.webuploader-dnd-over {
-    border-color: #999999;
-}
-
-#upload .filelist {
-    list-style: none;
-    margin: 0;
-    padding: 0;
-    overflow-x: hidden;
-    overflow-y: auto;
-    position: relative;
-    height: 300px;
-}
-
-#upload .filelist:after {
-    content: '';
-    display: block;
-    width: 0;
-    height: 0;
-    overflow: hidden;
-    clear: both;
-}
-
-#upload .filelist li {
-    width: 113px;
-    height: 113px;
-    background: url(./images/bg.png);
-    text-align: center;
-    margin: 9px 0 0 9px;
-    *margin: 6px 0 0 6px;
-    position: relative;
-    display: block;
-    float: left;
-    overflow: hidden;
-    font-size: 12px;
-}
-
-#upload .filelist li p.log {
-    position: relative;
-    top: -45px;
-}
-
-#upload .filelist li p.title {
-    position: absolute;
-    top: 0;
-    left: 0;
-    width: 100%;
-    overflow: hidden;
-    white-space: nowrap;
-    text-overflow: ellipsis;
-    top: 5px;
-    text-indent: 5px;
-    text-align: left;
-}
-
-#upload .filelist li p.progress {
-    position: absolute;
-    width: 100%;
-    bottom: 0;
-    left: 0;
-    height: 8px;
-    overflow: hidden;
-    z-index: 50;
-    margin: 0;
-    border-radius: 0;
-    background: none;
-    -webkit-box-shadow: 0 0 0;
-}
-
-#upload .filelist li p.progress span {
-    display: none;
-    overflow: hidden;
-    width: 0;
-    height: 100%;
-    background: #1483d8 url(./images/progress.png) repeat-x;
-
-    -webit-transition: width 200ms linear;
-    -moz-transition: width 200ms linear;
-    -o-transition: width 200ms linear;
-    -ms-transition: width 200ms linear;
-    transition: width 200ms linear;
-
-    -webkit-animation: progressmove 2s linear infinite;
-    -moz-animation: progressmove 2s linear infinite;
-    -o-animation: progressmove 2s linear infinite;
-    -ms-animation: progressmove 2s linear infinite;
-    animation: progressmove 2s linear infinite;
-
-    -webkit-transform: translateZ(0);
-}
-
-@-webkit-keyframes progressmove {
-    0% {
-        background-position: 0 0;
-    }
-    100% {
-        background-position: 17px 0;
-    }
-}
-
-@-moz-keyframes progressmove {
-    0% {
-        background-position: 0 0;
-    }
-    100% {
-        background-position: 17px 0;
-    }
-}
-
-@keyframes progressmove {
-    0% {
-        background-position: 0 0;
-    }
-    100% {
-        background-position: 17px 0;
-    }
-}
-
-#upload .filelist li p.imgWrap {
-    position: relative;
-    z-index: 2;
-    line-height: 113px;
-    vertical-align: middle;
-    overflow: hidden;
-    width: 113px;
-    height: 113px;
-
-    -webkit-transform-origin: 50% 50%;
-    -moz-transform-origin: 50% 50%;
-    -o-transform-origin: 50% 50%;
-    -ms-transform-origin: 50% 50%;
-    transform-origin: 50% 50%;
-
-    -webit-transition: 200ms ease-out;
-    -moz-transition: 200ms ease-out;
-    -o-transition: 200ms ease-out;
-    -ms-transition: 200ms ease-out;
-    transition: 200ms ease-out;
-}
-#upload .filelist li p.imgWrap.notimage {
-    margin-top: 0;
-    width: 111px;
-    height: 111px;
-    border: 1px #eeeeee solid;
-}
-#upload .filelist li p.imgWrap.notimage i.file-preview {
-    margin-top: 15px;
-}
-
-#upload .filelist li img {
-    width: 100%;
-}
-
-#upload .filelist li p.error {
-    background: #f43838;
-    color: #fff;
-    position: absolute;
-    bottom: 0;
-    left: 0;
-    height: 28px;
-    line-height: 28px;
-    width: 100%;
-    z-index: 100;
-    display:none;
-}
-
-#upload .filelist li .success {
-    display: block;
-    position: absolute;
-    left: 0;
-    bottom: 0;
-    height: 40px;
-    width: 100%;
-    z-index: 200;
-    background: url(./images/success.png) no-repeat right bottom;
-    background-image: url(./images/success.gif) \9;
-}
-
-#upload .filelist li.filePickerBlock {
-    width: 113px;
-    height: 113px;
-    background: url(./images/image.png) no-repeat center 12px;
-    border: 1px solid #eeeeee;
-    border-radius: 0;
-}
-#upload .filelist li.filePickerBlock div.webuploader-pick  {
-    width: 100%;
-    height: 100%;
-    margin: 0;
-    padding: 0;
-    opacity: 0;
-    background: none;
-    font-size: 0;
-}
-
-#upload .filelist div.file-panel {
-    position: absolute;
-    height: 0;
-    filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#80000000', endColorstr='#80000000') \0;
-    background: rgba(0, 0, 0, 0.5);
-    width: 100%;
-    top: 0;
-    left: 0;
-    overflow: hidden;
-    z-index: 300;
-}
-
-#upload .filelist div.file-panel span {
-    width: 24px;
-    height: 24px;
-    display: inline;
-    float: right;
-    text-indent: -9999px;
-    overflow: hidden;
-    background: url(./images/icons.png) no-repeat;
-    background: url(./images/icons.gif) no-repeat \9;
-    margin: 5px 1px 1px;
-    cursor: pointer;
-    -webkit-tap-highlight-color: rgba(0,0,0,0);
-    -webkit-user-select: none;
-    -moz-user-select: none;
-    -ms-user-select: none;
-    user-select: none;
-}
-
-#upload .filelist div.file-panel span.rotateLeft {
-    display:none;
-    background-position: 0 -24px;
-}
-
-#upload .filelist div.file-panel span.rotateLeft:hover {
-    background-position: 0 0;
-}
-
-#upload .filelist div.file-panel span.rotateRight {
-    display:none;
-    background-position: -24px -24px;
-}
-
-#upload .filelist div.file-panel span.rotateRight:hover {
-    background-position: -24px 0;
-}
-
-#upload .filelist div.file-panel span.cancel {
-    background-position: -48px -24px;
-}
-
-#upload .filelist div.file-panel span.cancel:hover {
-    background-position: -48px 0;
-}
-
-#upload .statusBar {
-    height: 45px;
-    border-bottom: 1px solid #dadada;
-    margin: 0 10px;
-    padding: 0;
-    line-height: 45px;
-    vertical-align: middle;
-    position: relative;
-}
-
-#upload .statusBar .progress {
-    border: 1px solid #1483d8;
-    width: 198px;
-    background: #fff;
-    height: 18px;
-    position: absolute;
-    top: 12px;
-    display: none;
-    text-align: center;
-    line-height: 18px;
-    color: #6dbfff;
-    margin: 0 10px 0 0;
-}
-#upload .statusBar .progress span.percentage {
-    width: 0;
-    height: 100%;
-    left: 0;
-    top: 0;
-    background: #1483d8;
-    position: absolute;
-}
-#upload .statusBar .progress span.text {
-    position: relative;
-    z-index: 10;
-}
-
-#upload .statusBar .info {
-    display: inline-block;
-    font-size: 14px;
-    color: #666666;
-}
-
-#upload .statusBar .btns {
-    position: absolute;
-    top: 7px;
-    right: 0;
-    line-height: 30px;
-}
-
-#filePickerBtn {
-    display: inline-block;
-    float: left;
-}
-#upload .statusBar .btns .webuploader-pick,
-#upload .statusBar .btns .uploadBtn,
-#upload .statusBar .btns .uploadBtn.state-uploading,
-#upload .statusBar .btns .uploadBtn.state-paused {
-    background: #ffffff;
-    border: 1px solid #cfcfcf;
-    color: #565656;
-    padding: 0 18px;
-    display: inline-block;
-    border-radius: 3px;
-    margin-left: 10px;
-    cursor: pointer;
-    font-size: 14px;
-    float: left;
-    -webkit-user-select: none;
-    -moz-user-select: none;
-    -ms-user-select: none;
-    user-select: none;
-}
-#upload .statusBar .btns .webuploader-pick-hover,
-#upload .statusBar .btns .uploadBtn:hover,
-#upload .statusBar .btns .uploadBtn.state-uploading:hover,
-#upload .statusBar .btns .uploadBtn.state-paused:hover {
-    background: #f0f0f0;
-}
-
-#upload .statusBar .btns .uploadBtn,
-#upload .statusBar .btns .uploadBtn.state-paused{
-    background: #00b7ee;
-    color: #fff;
-    border-color: transparent;
-}
-#upload .statusBar .btns .uploadBtn:hover,
-#upload .statusBar .btns .uploadBtn.state-paused:hover{
-    background: #00a2d4;
-}
-
-#upload .statusBar .btns .uploadBtn.disabled {
-    pointer-events: none;
-    filter:alpha(opacity=60);
-    -moz-opacity:0.6;
-    -khtml-opacity: 0.6;
-    opacity: 0.6;
-}
-
-
-
-/* 图片管理样式 */
-#online {
-    width: 100%;
-    height: 336px;
-    padding: 10px 0 0 0;
-}
-#online #fileList{
-    width: 100%;
-    height: 100%;
-    overflow-x: hidden;
-    overflow-y: auto;
-    position: relative;
-}
-#online ul {
-    display: block;
-    list-style: none;
-    margin: 0;
-    padding: 0;
-}
-#online li {
-    float: left;
-    display: block;
-    list-style: none;
-    padding: 0;
-    width: 113px;
-    height: 113px;
-    margin: 0 0 9px 9px;
-    *margin: 0 0 6px 6px;
-    background-color: #eee;
-    overflow: hidden;
-    cursor: pointer;
-    position: relative;
-}
-#online li.clearFloat {
-    float: none;
-    clear: both;
-    display: block;
-    width:0;
-    height:0;
-    margin: 0;
-    padding: 0;
-}
-#online li img {
-    cursor: pointer;
-}
-#online li div.file-wrapper {
-    cursor: pointer;
-    position: absolute;
-    display: block;
-    width: 111px;
-    height: 111px;
-    border: 1px solid #eee;
-    background: url("./images/bg.png") repeat;
-}
-#online li div span.file-title{
-    display: block;
-    padding: 0 3px;
-    margin: 3px 0 0 0;
-    font-size: 12px;
-    height: 13px;
-    color: #555555;
-    text-align: center;
-    width: 107px;
-    white-space: nowrap;
-    word-break: break-all;
-    overflow: hidden;
-    text-overflow: ellipsis;
-}
-#online li .icon {
-    cursor: pointer;
-    width: 113px;
-    height: 113px;
-    position: absolute;
-    top: 0;
-    left: 0;
-    z-index: 2;
-    border: 0;
-    background-repeat: no-repeat;
-}
-#online li .icon:hover {
-    width: 107px;
-    height: 107px;
-    border: 3px solid #1094fa;
-}
-#online li.selected .icon {
-    background-image: url(images/success.png);
-    background-image: url(images/success.gif) \9;
-    background-position: 75px 75px;
-}
-#online li.selected .icon:hover {
-    width: 107px;
-    height: 107px;
-    border: 3px solid #1094fa;
-    background-position: 72px 72px;
-}
-
-
-/* 在线文件的文件预览图标 */
-i.file-preview {
-    display: block;
-    margin: 10px auto;
-    width: 70px;
-    height: 70px;
-    background-image: url("./images/file-icons.png");
-    background-image: url("./images/file-icons.gif") \9;
-    background-position: -140px center;
-    background-repeat: no-repeat;
-}
-i.file-preview.file-type-dir{
-    background-position: 0 center;
-}
-i.file-preview.file-type-file{
-    background-position: -140px center;
-}
-i.file-preview.file-type-filelist{
-    background-position: -210px center;
-}
-i.file-preview.file-type-zip,
-i.file-preview.file-type-rar,
-i.file-preview.file-type-7z,
-i.file-preview.file-type-tar,
-i.file-preview.file-type-gz,
-i.file-preview.file-type-bz2{
-    background-position: -280px center;
-}
-i.file-preview.file-type-xls,
-i.file-preview.file-type-xlsx{
-    background-position: -350px center;
-}
-i.file-preview.file-type-doc,
-i.file-preview.file-type-docx{
-    background-position: -420px center;
-}
-i.file-preview.file-type-ppt,
-i.file-preview.file-type-pptx{
-    background-position: -490px center;
-}
-i.file-preview.file-type-vsd{
-    background-position: -560px center;
-}
-i.file-preview.file-type-pdf{
-    background-position: -630px center;
-}
-i.file-preview.file-type-txt,
-i.file-preview.file-type-md,
-i.file-preview.file-type-json,
-i.file-preview.file-type-htm,
-i.file-preview.file-type-xml,
-i.file-preview.file-type-html,
-i.file-preview.file-type-js,
-i.file-preview.file-type-css,
-i.file-preview.file-type-php,
-i.file-preview.file-type-jsp,
-i.file-preview.file-type-asp{
-    background-position: -700px center;
-}
-i.file-preview.file-type-apk{
-    background-position: -770px center;
-}
-i.file-preview.file-type-exe{
-    background-position: -840px center;
-}
-i.file-preview.file-type-ipa{
-    background-position: -910px center;
-}
-i.file-preview.file-type-mp4,
-i.file-preview.file-type-swf,
-i.file-preview.file-type-mkv,
-i.file-preview.file-type-avi,
-i.file-preview.file-type-flv,
-i.file-preview.file-type-mov,
-i.file-preview.file-type-mpg,
-i.file-preview.file-type-mpeg,
-i.file-preview.file-type-ogv,
-i.file-preview.file-type-webm,
-i.file-preview.file-type-rm,
-i.file-preview.file-type-rmvb{
-    background-position: -980px center;
-}
-i.file-preview.file-type-ogg,
-i.file-preview.file-type-wav,
-i.file-preview.file-type-wmv,
-i.file-preview.file-type-mid,
-i.file-preview.file-type-mp3{
-    background-position: -1050px center;
-}
-i.file-preview.file-type-jpg,
-i.file-preview.file-type-jpeg,
-i.file-preview.file-type-gif,
-i.file-preview.file-type-bmp,
-i.file-preview.file-type-png,
-i.file-preview.file-type-psd{
-    background-position: -140px center;
-}

+ 0 - 60
public/laravel-u-editor/dialogs/attachment/attachment.html

@@ -1,60 +0,0 @@
-<!doctype html>
-<html>
-<head>
-    <meta charset="UTF-8">
-    <title>ueditor图片对话框</title>
-    <script type="text/javascript" src="../internal.js"></script>
-
-    <!-- jquery -->
-    <script type="text/javascript" src="../../third-party/jquery-1.10.2.min.js"></script>
-
-    <!-- webuploader -->
-    <script src="../../third-party/webuploader/webuploader.min.js"></script>
-    <link rel="stylesheet" type="text/css" href="../../third-party/webuploader/webuploader.css">
-
-    <!-- attachment dialog -->
-    <link rel="stylesheet" href="attachment.css" type="text/css" />
-</head>
-<body>
-
-    <div class="wrapper">
-        <div id="tabhead" class="tabhead">
-            <span class="tab focus" data-content-id="upload"><var id="lang_tab_upload"></var></span>
-            <span class="tab" data-content-id="online"><var id="lang_tab_online"></var></span>
-        </div>
-        <div id="tabbody" class="tabbody">
-            <!-- 上传图片 -->
-            <div id="upload" class="panel focus">
-                <div id="queueList" class="queueList">
-                    <div class="statusBar element-invisible">
-                        <div class="progress">
-                            <span class="text">0%</span>
-                            <span class="percentage"></span>
-                        </div><div class="info"></div>
-                        <div class="btns">
-                            <div id="filePickerBtn"></div>
-                            <div class="uploadBtn"><var id="lang_start_upload"></var></div>
-                        </div>
-                    </div>
-                    <div id="dndArea" class="placeholder">
-                        <div class="filePickerContainer">
-                            <div id="filePickerReady"></div>
-                        </div>
-                    </div>
-                    <ul class="filelist element-invisible">
-                        <li id="filePickerBlock" class="filePickerBlock"></li>
-                    </ul>
-                </div>
-            </div>
-
-            <!-- 在线图片 -->
-            <div id="online" class="panel">
-                <div id="fileList"><var id="lang_imgLoading"></var></div>
-            </div>
-
-        </div>
-    </div>
-    <script type="text/javascript" src="attachment.js"></script>
-
-</body>
-</html>

+ 0 - 754
public/laravel-u-editor/dialogs/attachment/attachment.js

@@ -1,754 +0,0 @@
-/**
- * User: Jinqn
- * Date: 14-04-08
- * Time: 下午16:34
- * 上传图片对话框逻辑代码,包括tab: 远程图片/上传图片/在线图片/搜索图片
- */
-
-(function () {
-
-    var uploadFile,
-        onlineFile;
-
-    window.onload = function () {
-        initTabs();
-        initButtons();
-    };
-
-    /* 初始化tab标签 */
-    function initTabs() {
-        var tabs = $G('tabhead').children;
-        for (var i = 0; i < tabs.length; i++) {
-            domUtils.on(tabs[i], "click", function (e) {
-                var target = e.target || e.srcElement;
-                setTabFocus(target.getAttribute('data-content-id'));
-            });
-        }
-
-        setTabFocus('upload');
-    }
-
-    /* 初始化tabbody */
-    function setTabFocus(id) {
-        if(!id) return;
-        var i, bodyId, tabs = $G('tabhead').children;
-        for (i = 0; i < tabs.length; i++) {
-            bodyId = tabs[i].getAttribute('data-content-id')
-            if (bodyId == id) {
-                domUtils.addClass(tabs[i], 'focus');
-                domUtils.addClass($G(bodyId), 'focus');
-            } else {
-                domUtils.removeClasses(tabs[i], 'focus');
-                domUtils.removeClasses($G(bodyId), 'focus');
-            }
-        }
-        switch (id) {
-            case 'upload':
-                uploadFile = uploadFile || new UploadFile('queueList');
-                break;
-            case 'online':
-                onlineFile = onlineFile || new OnlineFile('fileList');
-                break;
-        }
-    }
-
-    /* 初始化onok事件 */
-    function initButtons() {
-
-        dialog.onok = function () {
-            var list = [], id, tabs = $G('tabhead').children;
-            for (var i = 0; i < tabs.length; i++) {
-                if (domUtils.hasClass(tabs[i], 'focus')) {
-                    id = tabs[i].getAttribute('data-content-id');
-                    break;
-                }
-            }
-
-            switch (id) {
-                case 'upload':
-                    list = uploadFile.getInsertList();
-                    var count = uploadFile.getQueueCount();
-                    if (count) {
-                        $('.info', '#queueList').html('<span style="color:red;">' + '还有2个未上传文件'.replace(/[\d]/, count) + '</span>');
-                        return false;
-                    }
-                    break;
-                case 'online':
-                    list = onlineFile.getInsertList();
-                    break;
-            }
-
-            editor.execCommand('insertfile', list);
-        };
-    }
-
-
-    /* 上传附件 */
-    function UploadFile(target) {
-        this.$wrap = target.constructor == String ? $('#' + target) : $(target);
-        this.init();
-    }
-    UploadFile.prototype = {
-        init: function () {
-            this.fileList = [];
-            this.initContainer();
-            this.initUploader();
-        },
-        initContainer: function () {
-            this.$queue = this.$wrap.find('.filelist');
-        },
-        /* 初始化容器 */
-        initUploader: function () {
-            var _this = this,
-                $ = jQuery,    // just in case. Make sure it's not an other libaray.
-                $wrap = _this.$wrap,
-            // 图片容器
-                $queue = $wrap.find('.filelist'),
-            // 状态栏,包括进度和控制按钮
-                $statusBar = $wrap.find('.statusBar'),
-            // 文件总体选择信息。
-                $info = $statusBar.find('.info'),
-            // 上传按钮
-                $upload = $wrap.find('.uploadBtn'),
-            // 上传按钮
-                $filePickerBtn = $wrap.find('.filePickerBtn'),
-            // 上传按钮
-                $filePickerBlock = $wrap.find('.filePickerBlock'),
-            // 没选择文件之前的内容。
-                $placeHolder = $wrap.find('.placeholder'),
-            // 总体进度条
-                $progress = $statusBar.find('.progress').hide(),
-            // 添加的文件数量
-                fileCount = 0,
-            // 添加的文件总大小
-                fileSize = 0,
-            // 优化retina, 在retina下这个值是2
-                ratio = window.devicePixelRatio || 1,
-            // 缩略图大小
-                thumbnailWidth = 113 * ratio,
-                thumbnailHeight = 113 * ratio,
-            // 可能有pedding, ready, uploading, confirm, done.
-                state = '',
-            // 所有文件的进度信息,key为file id
-                percentages = {},
-                supportTransition = (function () {
-                    var s = document.createElement('p').style,
-                        r = 'transition' in s ||
-                            'WebkitTransition' in s ||
-                            'MozTransition' in s ||
-                            'msTransition' in s ||
-                            'OTransition' in s;
-                    s = null;
-                    return r;
-                })(),
-            // WebUploader实例
-                uploader,
-                actionUrl = editor.getActionUrl(editor.getOpt('fileActionName')),
-                fileMaxSize = editor.getOpt('fileMaxSize'),
-                acceptExtensions = (editor.getOpt('fileAllowFiles') || []).join('').replace(/\./g, ',').replace(/^[,]/, '');;
-
-            if (!WebUploader.Uploader.support()) {
-                $('#filePickerReady').after($('<div>').html(lang.errorNotSupport)).hide();
-                return;
-            } else if (!editor.getOpt('fileActionName')) {
-                $('#filePickerReady').after($('<div>').html(lang.errorLoadConfig)).hide();
-                return;
-            }
-
-            uploader = _this.uploader = WebUploader.create({
-                pick: {
-                    id: '#filePickerReady',
-                    label: lang.uploadSelectFile
-                },
-                swf: '../../third-party/webuploader/Uploader.swf',
-                server: actionUrl,
-                fileVal: editor.getOpt('fileFieldName'),
-                duplicate: true,
-                fileSingleSizeLimit: fileMaxSize,
-                compress: false
-            });
-            uploader.addButton({
-                id: '#filePickerBlock'
-            });
-            uploader.addButton({
-                id: '#filePickerBtn',
-                label: lang.uploadAddFile
-            });
-
-            setState('pedding');
-
-            // 当有文件添加进来时执行,负责view的创建
-            function addFile(file) {
-                var $li = $('<li id="' + file.id + '">' +
-                        '<p class="title">' + file.name + '</p>' +
-                        '<p class="imgWrap"></p>' +
-                        '<p class="progress"><span></span></p>' +
-                        '</li>'),
-
-                    $btns = $('<div class="file-panel">' +
-                        '<span class="cancel">' + lang.uploadDelete + '</span>' +
-                        '<span class="rotateRight">' + lang.uploadTurnRight + '</span>' +
-                        '<span class="rotateLeft">' + lang.uploadTurnLeft + '</span></div>').appendTo($li),
-                    $prgress = $li.find('p.progress span'),
-                    $wrap = $li.find('p.imgWrap'),
-                    $info = $('<p class="error"></p>').hide().appendTo($li),
-
-                    showError = function (code) {
-                        switch (code) {
-                            case 'exceed_size':
-                                text = lang.errorExceedSize;
-                                break;
-                            case 'interrupt':
-                                text = lang.errorInterrupt;
-                                break;
-                            case 'http':
-                                text = lang.errorHttp;
-                                break;
-                            case 'not_allow_type':
-                                text = lang.errorFileType;
-                                break;
-                            default:
-                                text = lang.errorUploadRetry;
-                                break;
-                        }
-                        $info.text(text).show();
-                    };
-
-                if (file.getStatus() === 'invalid') {
-                    showError(file.statusText);
-                } else {
-                    $wrap.text(lang.uploadPreview);
-                    if ('|png|jpg|jpeg|bmp|gif|'.indexOf('|'+file.ext.toLowerCase()+'|') == -1) {
-                        $wrap.empty().addClass('notimage').append('<i class="file-preview file-type-' + file.ext.toLowerCase() + '"></i>' +
-                        '<span class="file-title" title="' + file.name + '">' + file.name + '</span>');
-                    } else {
-                        if (browser.ie && browser.version <= 7) {
-                            $wrap.text(lang.uploadNoPreview);
-                        } else {
-                            uploader.makeThumb(file, function (error, src) {
-                                if (error || !src) {
-                                    $wrap.text(lang.uploadNoPreview);
-                                } else {
-                                    var $img = $('<img src="' + src + '">');
-                                    $wrap.empty().append($img);
-                                    $img.on('error', function () {
-                                        $wrap.text(lang.uploadNoPreview);
-                                    });
-                                }
-                            }, thumbnailWidth, thumbnailHeight);
-                        }
-                    }
-                    percentages[ file.id ] = [ file.size, 0 ];
-                    file.rotation = 0;
-
-                    /* 检查文件格式 */
-                    if (!file.ext || acceptExtensions.indexOf(file.ext.toLowerCase()) == -1) {
-                        showError('not_allow_type');
-                        uploader.removeFile(file);
-                    }
-                }
-
-                file.on('statuschange', function (cur, prev) {
-                    if (prev === 'progress') {
-                        $prgress.hide().width(0);
-                    } else if (prev === 'queued') {
-                        $li.off('mouseenter mouseleave');
-                        $btns.remove();
-                    }
-                    // 成功
-                    if (cur === 'error' || cur === 'invalid') {
-                        showError(file.statusText);
-                        percentages[ file.id ][ 1 ] = 1;
-                    } else if (cur === 'interrupt') {
-                        showError('interrupt');
-                    } else if (cur === 'queued') {
-                        percentages[ file.id ][ 1 ] = 0;
-                    } else if (cur === 'progress') {
-                        $info.hide();
-                        $prgress.css('display', 'block');
-                    } else if (cur === 'complete') {
-                    }
-
-                    $li.removeClass('state-' + prev).addClass('state-' + cur);
-                });
-
-                $li.on('mouseenter', function () {
-                    $btns.stop().animate({height: 30});
-                });
-                $li.on('mouseleave', function () {
-                    $btns.stop().animate({height: 0});
-                });
-
-                $btns.on('click', 'span', function () {
-                    var index = $(this).index(),
-                        deg;
-
-                    switch (index) {
-                        case 0:
-                            uploader.removeFile(file);
-                            return;
-                        case 1:
-                            file.rotation += 90;
-                            break;
-                        case 2:
-                            file.rotation -= 90;
-                            break;
-                    }
-
-                    if (supportTransition) {
-                        deg = 'rotate(' + file.rotation + 'deg)';
-                        $wrap.css({
-                            '-webkit-transform': deg,
-                            '-mos-transform': deg,
-                            '-o-transform': deg,
-                            'transform': deg
-                        });
-                    } else {
-                        $wrap.css('filter', 'progid:DXImageTransform.Microsoft.BasicImage(rotation=' + (~~((file.rotation / 90) % 4 + 4) % 4) + ')');
-                    }
-
-                });
-
-                $li.insertBefore($filePickerBlock);
-            }
-
-            // 负责view的销毁
-            function removeFile(file) {
-                var $li = $('#' + file.id);
-                delete percentages[ file.id ];
-                updateTotalProgress();
-                $li.off().find('.file-panel').off().end().remove();
-            }
-
-            function updateTotalProgress() {
-                var loaded = 0,
-                    total = 0,
-                    spans = $progress.children(),
-                    percent;
-
-                $.each(percentages, function (k, v) {
-                    total += v[ 0 ];
-                    loaded += v[ 0 ] * v[ 1 ];
-                });
-
-                percent = total ? loaded / total : 0;
-
-                spans.eq(0).text(Math.round(percent * 100) + '%');
-                spans.eq(1).css('width', Math.round(percent * 100) + '%');
-                updateStatus();
-            }
-
-            function setState(val, files) {
-
-                if (val != state) {
-
-                    var stats = uploader.getStats();
-
-                    $upload.removeClass('state-' + state);
-                    $upload.addClass('state-' + val);
-
-                    switch (val) {
-
-                        /* 未选择文件 */
-                        case 'pedding':
-                            $queue.addClass('element-invisible');
-                            $statusBar.addClass('element-invisible');
-                            $placeHolder.removeClass('element-invisible');
-                            $progress.hide(); $info.hide();
-                            uploader.refresh();
-                            break;
-
-                        /* 可以开始上传 */
-                        case 'ready':
-                            $placeHolder.addClass('element-invisible');
-                            $queue.removeClass('element-invisible');
-                            $statusBar.removeClass('element-invisible');
-                            $progress.hide(); $info.show();
-                            $upload.text(lang.uploadStart);
-                            uploader.refresh();
-                            break;
-
-                        /* 上传中 */
-                        case 'uploading':
-                            $progress.show(); $info.hide();
-                            $upload.text(lang.uploadPause);
-                            break;
-
-                        /* 暂停上传 */
-                        case 'paused':
-                            $progress.show(); $info.hide();
-                            $upload.text(lang.uploadContinue);
-                            break;
-
-                        case 'confirm':
-                            $progress.show(); $info.hide();
-                            $upload.text(lang.uploadStart);
-
-                            stats = uploader.getStats();
-                            if (stats.successNum && !stats.uploadFailNum) {
-                                setState('finish');
-                                return;
-                            }
-                            break;
-
-                        case 'finish':
-                            $progress.hide(); $info.show();
-                            if (stats.uploadFailNum) {
-                                $upload.text(lang.uploadRetry);
-                            } else {
-                                $upload.text(lang.uploadStart);
-                            }
-                            break;
-                    }
-
-                    state = val;
-                    updateStatus();
-
-                }
-
-                if (!_this.getQueueCount()) {
-                    $upload.addClass('disabled')
-                } else {
-                    $upload.removeClass('disabled')
-                }
-
-            }
-
-            function updateStatus() {
-                var text = '', stats;
-
-                if (state === 'ready') {
-                    text = lang.updateStatusReady.replace('_', fileCount).replace('_KB', WebUploader.formatSize(fileSize));
-                } else if (state === 'confirm') {
-                    stats = uploader.getStats();
-                    if (stats.uploadFailNum) {
-                        text = lang.updateStatusConfirm.replace('_', stats.successNum).replace('_', stats.successNum);
-                    }
-                } else {
-                    stats = uploader.getStats();
-                    text = lang.updateStatusFinish.replace('_', fileCount).
-                        replace('_KB', WebUploader.formatSize(fileSize)).
-                        replace('_', stats.successNum);
-
-                    if (stats.uploadFailNum) {
-                        text += lang.updateStatusError.replace('_', stats.uploadFailNum);
-                    }
-                }
-
-                $info.html(text);
-            }
-
-            uploader.on('fileQueued', function (file) {
-                fileCount++;
-                fileSize += file.size;
-
-                if (fileCount === 1) {
-                    $placeHolder.addClass('element-invisible');
-                    $statusBar.show();
-                }
-
-                addFile(file);
-            });
-
-            uploader.on('fileDequeued', function (file) {
-                fileCount--;
-                fileSize -= file.size;
-
-                removeFile(file);
-                updateTotalProgress();
-            });
-
-            uploader.on('filesQueued', function (file) {
-                if (!uploader.isInProgress() && (state == 'pedding' || state == 'finish' || state == 'confirm' || state == 'ready')) {
-                    setState('ready');
-                }
-                updateTotalProgress();
-            });
-
-            uploader.on('all', function (type, files) {
-                switch (type) {
-                    case 'uploadFinished':
-                        setState('confirm', files);
-                        break;
-                    case 'startUpload':
-                        /* 添加额外的GET参数 */
-                        var params = utils.serializeParam(editor.queryCommandValue('serverparam')) || '',
-                            url = utils.formatUrl(actionUrl + (actionUrl.indexOf('?') == -1 ? '?':'&') + 'encode=utf-8&' + params);
-                        uploader.option('server', url);
-                        setState('uploading', files);
-                        break;
-                    case 'stopUpload':
-                        setState('paused', files);
-                        break;
-                }
-            });
-
-            uploader.on('uploadBeforeSend', function (file, data, header) {
-                //这里可以通过data对象添加POST参数
-                header['X_Requested_With'] = 'XMLHttpRequest';
-            });
-
-            uploader.on('uploadProgress', function (file, percentage) {
-                var $li = $('#' + file.id),
-                    $percent = $li.find('.progress span');
-
-                $percent.css('width', percentage * 100 + '%');
-                percentages[ file.id ][ 1 ] = percentage;
-                updateTotalProgress();
-            });
-
-            uploader.on('uploadSuccess', function (file, ret) {
-                var $file = $('#' + file.id);
-                try {
-                    var responseText = (ret._raw || ret),
-                        json = utils.str2json(responseText);
-                    if (json.state == 'SUCCESS') {
-                        _this.fileList.push(json);
-                        $file.append('<span class="success"></span>');
-                    } else {
-                        $file.find('.error').text(json.state).show();
-                    }
-                } catch (e) {
-                    $file.find('.error').text(lang.errorServerUpload).show();
-                }
-            });
-
-            uploader.on('uploadError', function (file, code) {
-            });
-            uploader.on('error', function (code, file) {
-                if (code == 'Q_TYPE_DENIED' || code == 'F_EXCEED_SIZE') {
-                    addFile(file);
-                }
-            });
-            uploader.on('uploadComplete', function (file, ret) {
-            });
-
-            $upload.on('click', function () {
-                if ($(this).hasClass('disabled')) {
-                    return false;
-                }
-
-                if (state === 'ready') {
-                    uploader.upload();
-                } else if (state === 'paused') {
-                    uploader.upload();
-                } else if (state === 'uploading') {
-                    uploader.stop();
-                }
-            });
-
-            $upload.addClass('state-' + state);
-            updateTotalProgress();
-        },
-        getQueueCount: function () {
-            var file, i, status, readyFile = 0, files = this.uploader.getFiles();
-            for (i = 0; file = files[i++]; ) {
-                status = file.getStatus();
-                if (status == 'queued' || status == 'uploading' || status == 'progress') readyFile++;
-            }
-            return readyFile;
-        },
-        getInsertList: function () {
-            var i, link, data, list = [],
-                prefix = editor.getOpt('fileUrlPrefix');
-            for (i = 0; i < this.fileList.length; i++) {
-                data = this.fileList[i];
-                link = data.url;
-                list.push({
-                    title: data.original || link.substr(link.lastIndexOf('/') + 1),
-                    url: prefix + link
-                });
-            }
-            return list;
-        }
-    };
-
-
-    /* 在线附件 */
-    function OnlineFile(target) {
-        this.container = utils.isString(target) ? document.getElementById(target) : target;
-        this.init();
-    }
-    OnlineFile.prototype = {
-        init: function () {
-            this.initContainer();
-            this.initEvents();
-            this.initData();
-        },
-        /* 初始化容器 */
-        initContainer: function () {
-            this.container.innerHTML = '';
-            this.list = document.createElement('ul');
-            this.clearFloat = document.createElement('li');
-
-            domUtils.addClass(this.list, 'list');
-            domUtils.addClass(this.clearFloat, 'clearFloat');
-
-            this.list.appendChild(this.clearFloat);
-            this.container.appendChild(this.list);
-        },
-        /* 初始化滚动事件,滚动到地步自动拉取数据 */
-        initEvents: function () {
-            var _this = this;
-
-            /* 滚动拉取图片 */
-            domUtils.on($G('fileList'), 'scroll', function(e){
-                var panel = this;
-                if (panel.scrollHeight - (panel.offsetHeight + panel.scrollTop) < 10) {
-                    _this.getFileData();
-                }
-            });
-            /* 选中图片 */
-            domUtils.on(this.list, 'click', function (e) {
-                var target = e.target || e.srcElement,
-                    li = target.parentNode;
-
-                if (li.tagName.toLowerCase() == 'li') {
-                    if (domUtils.hasClass(li, 'selected')) {
-                        domUtils.removeClasses(li, 'selected');
-                    } else {
-                        domUtils.addClass(li, 'selected');
-                    }
-                }
-            });
-        },
-        /* 初始化第一次的数据 */
-        initData: function () {
-
-            /* 拉取数据需要使用的值 */
-            this.state = 0;
-            this.listSize = editor.getOpt('fileManagerListSize');
-            this.listIndex = 0;
-            this.listEnd = false;
-
-            /* 第一次拉取数据 */
-            this.getFileData();
-        },
-        /* 向后台拉取图片列表数据 */
-        getFileData: function () {
-            var _this = this;
-
-            if(!_this.listEnd && !this.isLoadingData) {
-                this.isLoadingData = true;
-                ajax.request(editor.getActionUrl(editor.getOpt('fileManagerActionName')), {
-                    timeout: 100000,
-                    data: utils.extend({
-                            start: this.listIndex,
-                            size: this.listSize
-                        }, editor.queryCommandValue('serverparam')),
-                    method: 'get',
-                    onsuccess: function (r) {
-                        try {
-                            var json = eval('(' + r.responseText + ')');
-                            if (json.state == 'SUCCESS') {
-                                _this.pushData(json.list);
-                                _this.listIndex = parseInt(json.start) + parseInt(json.list.length);
-                                if(_this.listIndex >= json.total) {
-                                    _this.listEnd = true;
-                                }
-                                _this.isLoadingData = false;
-                            }
-                        } catch (e) {
-                            if(r.responseText.indexOf('ue_separate_ue') != -1) {
-                                var list = r.responseText.split(r.responseText);
-                                _this.pushData(list);
-                                _this.listIndex = parseInt(list.length);
-                                _this.listEnd = true;
-                                _this.isLoadingData = false;
-                            }
-                        }
-                    },
-                    onerror: function () {
-                        _this.isLoadingData = false;
-                    }
-                });
-            }
-        },
-        /* 添加图片到列表界面上 */
-        pushData: function (list) {
-            var i, item, img, filetype, preview, icon, _this = this,
-                urlPrefix = editor.getOpt('fileManagerUrlPrefix');
-            for (i = 0; i < list.length; i++) {
-                if(list[i] && list[i].url) {
-                    item = document.createElement('li');
-                    icon = document.createElement('span');
-                    filetype = list[i].url.substr(list[i].url.lastIndexOf('.') + 1);
-
-                    if ( "png|jpg|jpeg|gif|bmp".indexOf(filetype) != -1 ) {
-                        preview = document.createElement('img');
-                        domUtils.on(preview, 'load', (function(image){
-                            return function(){
-                                _this.scale(image, image.parentNode.offsetWidth, image.parentNode.offsetHeight);
-                            };
-                        })(preview));
-                        preview.width = 113;
-                        preview.setAttribute('src', urlPrefix + list[i].url + (list[i].url.indexOf('?') == -1 ? '?noCache=':'&noCache=') + (+new Date()).toString(36) );
-                    } else {
-                        var ic = document.createElement('i'),
-                            textSpan = document.createElement('span');
-                        textSpan.innerHTML = list[i].url.substr(list[i].url.lastIndexOf('/') + 1);
-                        preview = document.createElement('div');
-                        preview.appendChild(ic);
-                        preview.appendChild(textSpan);
-                        domUtils.addClass(preview, 'file-wrapper');
-                        domUtils.addClass(textSpan, 'file-title');
-                        domUtils.addClass(ic, 'file-type-' + filetype);
-                        domUtils.addClass(ic, 'file-preview');
-                    }
-                    domUtils.addClass(icon, 'icon');
-                    item.setAttribute('data-url', urlPrefix + list[i].url);
-                    if (list[i].original) {
-                        item.setAttribute('data-title', list[i].original);
-                    }
-
-                    item.appendChild(preview);
-                    item.appendChild(icon);
-                    this.list.insertBefore(item, this.clearFloat);
-                }
-            }
-        },
-        /* 改变图片大小 */
-        scale: function (img, w, h, type) {
-            var ow = img.width,
-                oh = img.height;
-
-            if (type == 'justify') {
-                if (ow >= oh) {
-                    img.width = w;
-                    img.height = h * oh / ow;
-                    img.style.marginLeft = '-' + parseInt((img.width - w) / 2) + 'px';
-                } else {
-                    img.width = w * ow / oh;
-                    img.height = h;
-                    img.style.marginTop = '-' + parseInt((img.height - h) / 2) + 'px';
-                }
-            } else {
-                if (ow >= oh) {
-                    img.width = w * ow / oh;
-                    img.height = h;
-                    img.style.marginLeft = '-' + parseInt((img.width - w) / 2) + 'px';
-                } else {
-                    img.width = w;
-                    img.height = h * oh / ow;
-                    img.style.marginTop = '-' + parseInt((img.height - h) / 2) + 'px';
-                }
-            }
-        },
-        getInsertList: function () {
-            var i, lis = this.list.children, list = [];
-            for (i = 0; i < lis.length; i++) {
-                if (domUtils.hasClass(lis[i], 'selected')) {
-                    var url = lis[i].getAttribute('data-url');
-                    var title = lis[i].getAttribute('data-title') || url.substr(url.lastIndexOf('/') + 1);
-                    list.push({
-                        title: title,
-                        url: url
-                    });
-                }
-            }
-            return list;
-        }
-    };
-
-
-})();

BIN
public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_chm.gif


BIN
public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_default.png


BIN
public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_doc.gif


BIN
public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_exe.gif


BIN
public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_jpg.gif


BIN
public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_mp3.gif


BIN
public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_mv.gif


BIN
public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_pdf.gif


BIN
public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_ppt.gif


BIN
public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_psd.gif


BIN
public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_rar.gif


BIN
public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_txt.gif


BIN
public/laravel-u-editor/dialogs/attachment/fileTypeImages/icon_xls.gif


BIN
public/laravel-u-editor/dialogs/attachment/images/alignicon.gif


BIN
public/laravel-u-editor/dialogs/attachment/images/alignicon.png


BIN
public/laravel-u-editor/dialogs/attachment/images/bg.png


BIN
public/laravel-u-editor/dialogs/attachment/images/file-icons.gif


BIN
public/laravel-u-editor/dialogs/attachment/images/file-icons.png


BIN
public/laravel-u-editor/dialogs/attachment/images/icons.gif


Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott