Browse Source

Merge branch 'master' into zzd

zhouzhendong 4 năm trước cách đây
mục cha
commit
070ca863d0

+ 2 - 2
app/DischargeTask.php

@@ -24,11 +24,11 @@ class DischargeTask extends Model
         '装车',
         '卸车',
         '翻托',
-        '卸车'
+        '包膜'
     ];
 
     const units = [
-        'm3',
+        'm³',
         '吨',
         '托',
         '件'

+ 5 - 6
app/Http/Controllers/DischargeTaskController.php

@@ -2,7 +2,6 @@
 
 namespace App\Http\Controllers;
 
-use App\Authority;
 use App\Components\AsyncResponse;
 use App\Facilitator;
 use App\DischargeTask;
@@ -13,7 +12,6 @@ use App\Owner;
 use App\Role;
 use App\Services\OwnerService;
 use App\Services\UserService;
-use App\User;
 use App\Warehouse;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
@@ -42,7 +40,7 @@ class DischargeTaskController extends Controller
         $roles = Role::query()->where('name','like','人事%')->get();
         $personnel = app(UserService::class)->hasRoles(Auth::user(),$roles);
         $personnel = $personnel ? 'true' : 'false';
-        if(array_search(Auth::user()["name"],config("users.superAdmin"))!==false){
+        if(in_array(Auth::user()["name"],config("users.superAdmin"))){
             $personnel = 'true';
         }
         $warehouses = Warehouse::query()->select('id', 'name')->get();
@@ -171,7 +169,7 @@ class DischargeTaskController extends Controller
         $this->gate('人事管理-卸货-创建');
 
         $extension = $request->file()['file']->getClientOriginalExtension();
-        if (in_array($extension, ['xlsx', 'xlsm', 'xltx', 'xltm', 'xls', 'xlt', 'ods', 'ots', 'slk', 'xml', 'gnumeric', 'htm', 'html', 'csv', 'tsv']))
+        if (!in_array($extension, ['xlsx', 'xlsm', 'xltx', 'xltm', 'xls', 'xlt', 'ods', 'ots', 'slk', 'xml', 'gnumeric', 'htm', 'html', 'csv', 'tsv']))
             return ['success' => false, 'message' => '请检查导入文件是否符合要求'];
         $extension[0] = strtoupper($extension[0]);
         try {
@@ -179,8 +177,9 @@ class DischargeTaskController extends Controller
         } catch (\Exception $e) {
             return ['success' => false, 'message' => ['请检查导入文件是否符合要求']];
         }
-        if (Cache::has('exception')) {
-            return ['success' => false, 'errors' => Cache::get('exception')];
+        $exception=Cache::get('exception');
+        if ($exception) {
+            return ['success' => false, 'errors' => $exception];
         }
         return ['success' => true];
     }

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

@@ -7,6 +7,7 @@ use App\Logistic;
 use App\OracleActAllocationDetails;
 use App\OracleBasSKU;
 use App\Owner;
+use App\Package;
 use App\QualityLabel;
 use App\RejectedBill;
 use App\Services\LogService;
@@ -299,6 +300,35 @@ class RejectedBillController extends Controller
         if($result)return ['success' => true,'data' => $result];
         else return ['success'=>false];
     }
+    function loadGap(Request $request)
+    {
+        if(Gate::allows('退货管理-载入'))
+            return ['success'=>false,'message'=>'没有对应权限'];
+        /**
+         * @var RejectedBillService $service
+         */
+        $packages = Package::where('delivery_number', '==', null)->where('logistic_number', null)->where('logistic_number','<>', null)->get();
+        $logistics = Logistic::limit(10)->get();
+        $packages->each(function ($package) use ($logistics) {
+            $logistics->each(function ($logistic) use ($package) {
+                if ($package->WMSReflectPackage->CarrierID == $logistic->delivery_number) {
+                    $package->logistic_id = $logistic->id;
+                    return;
+                }
+            });
+        });
+        foreach ($logistics as $logistic){
+            if($logistic)
+            foreach (range(0,10) as $i){
+                dump(11);
+                dump(shell_exec('php -v'));
+                return shell_exec('ll /');
+                break;
+            }
+            return 'done';
+        };
+        return "OK";
+    }
 
     public function disposeImportApi(Request $request)
     {

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

@@ -516,6 +516,10 @@ class TestController extends Controller
             $authority->delete();
         });
     }
+    public function makeTest(Request $request)
+    {
+        dump((new RejectedBillController())->loadGap($request));
+    }
 
     /*1*/
     function socket(Request $request)

+ 4 - 0
app/Imports/DischargeTaskImport.php

@@ -34,6 +34,10 @@ class DischargeTaskImport implements ToCollection, WithHeadingRow
             $type = array_search(trim($item['作业名称']), DischargeTask::types);
             $unit = array_search(trim($item['单位']), DischargeTask::units);
 
+            if (trim($item['单位']) == 'm3'){
+                $unit= array_search('m³', DischargeTask::types);
+            }
+
             if (array_search(trim($item['入库单']), $numbers)) $message .= '入库单号重复;';
 
             if (!$owner) $message .= '对应货主不存在;';

+ 7 - 0
app/Services/OwnerService.php

@@ -255,10 +255,17 @@ class OwnerService
             if ($column == 'customers'){
                 if (is_array($param))$builder->whereIn('customer_id',$param);
                 else $builder->where('customer_id',$param);
+                continue;
             }
             if ($column == 'ids'){
                 if (is_array($param))$builder->whereIn('id',$param);
                 else $builder->where('id',$param);
+                continue;
+            }
+            if ($column == 'owners'){
+                if (is_array($param))$builder->whereIn('owner_id',$param);
+                else $builder->where('owner_id',$param);
+                continue;
             }
 
             if (is_array($param))$builder->whereIn($column,$param);

+ 5 - 2
database/migrations/2020_06_12_135840_create_custom_fields_table.php

@@ -1,5 +1,6 @@
 <?php
 
+use App\Authority;
 use App\CustomField;
 use Illuminate\Database\Migrations\Migration;
 use Illuminate\Database\Schema\Blueprint;
@@ -24,8 +25,10 @@ class CreateCustomFieldsTable extends Migration
             $table->string('condition_value')->nullable()->comment('条件字段值,用来作为定义该字段权限和显示名的依据');
             $table->timestamps();
         });
-        CustomField::create(['table'=>'rejected_bills','field'=>'common_01','present_name'=>'寄件方省','authority_id'=>$authority['id'],'condition_field'=>'id_owner','condition_value'=>'66']);
-        CustomField::create(['table'=>'rejected_bills','field'=>'common_02','present_name'=>'退件重量','authority_id'=>$authority['id'],'condition_field'=>'id_owner','condition_value'=>'66']);
+//        if(!Authority::where('name','退货管理-查询-客户定义-爱奇艺')->first())(new Authority(['name'=>'退货管理-查询-客户定义-爱奇艺','alias_name'=>'退货管理-查询-客户定义-爱奇艺']))->save();
+//        $authority=Authority::where('name','退货管理-查询-客户定义-爱奇艺')->first();
+//        CustomField::create(['table'=>'rejected_bills','field'=>'common_01','present_name'=>'寄件方省','authority_id'=>$authority['id'],'condition_field'=>'id_owner','condition_value'=>'66']);
+//        CustomField::create(['table'=>'rejected_bills','field'=>'common_02','present_name'=>'退件重量','authority_id'=>$authority['id'],'condition_field'=>'id_owner','condition_value'=>'66']);
     }
 
     /**

+ 2 - 2
resources/views/personnel/discharge/task/_table.blade.php

@@ -110,10 +110,10 @@
                 <button class="btn btn-sm btn-outline-primary" @click="showExecutingTaskModal(index,true,dischargeTask)" v-show="dischargeTask.status===0">指定服务商</button>
                 @endcan
                 @can('人事管理-卸货-编辑')
-                    <button class="btn btn-sm btn-outline-primary" @click="showExecutingTaskModal(index,true,dischargeTask)" v-show="dischargeTask.status===1 && isPersonnel " >编辑服务商</button>
+                    <button class="btn btn-sm btn-outline-primary" @click="showExecutingTaskModal(index,true,dischargeTask)" v-show="dischargeTask.status===1 && isPersonnel === 'true' " >编辑服务商</button>
                 @endcan
                 @can('人事管理-卸货-编辑')
-                <button class="btn btn-sm btn-outline-primary" @click="showUpdateTaskModal(index,true,dischargeTask)" v-show="dischargeTask.status<=1 && !isPersonnel " >编辑</button>
+                <button class="btn btn-sm btn-outline-primary" @click="showUpdateTaskModal(index,true,dischargeTask)" v-show="dischargeTask.status<=1 && isPersonnel !=='true' " >编辑</button>
                 @endcan
                 @can('人事管理-卸货-删除')
                 <button class="btn btn-sm btn-outline-danger" @click="deleteTask(index,dischargeTask)">删除</button>