فهرست منبع

Merge branch 'master' into zzd

zhouzhendong 4 سال پیش
والد
کامیت
45b5a9503e

+ 14 - 0
app/Console/Commands/stubs/model.stub

@@ -0,0 +1,14 @@
+<?php
+
+namespace {{ namespace }};
+
+use Illuminate\Database\Eloquent\Model;
+
+use App\Traits\ModelLogChanging;
+
+class {{ class }} extends Model
+{
+    use ModelLogChanging;
+
+    //
+}

+ 15 - 0
app/Console/Commands/stubs/test.controller.stub

@@ -0,0 +1,15 @@
+<?php
+
+namespace {{ namespace }};
+
+use Tests\TestCase;
+
+class {{ class }} extends TestCase
+{
+
+    public function testExample()
+    {
+    {{ class }};
+        $this->assertTrue(true);
+    }
+}

+ 37 - 0
app/Console/Commands/stubs/test.service.stub

@@ -0,0 +1,37 @@
+<?php
+
+namespace {{ namespace }};
+use App\Services\{{ serviceName }};
+use Tests\TestCase;
+use App\{{ modelNameUc }};
+use App\Traits\TestMockSubServices;
+
+class {{ class }} extends TestCase
+{
+    use TestMockSubServices;
+    /** @var {{ serviceName }} $service */
+    public $service;
+    private $data;
+    private $amount=2;
+    function setUp(): void
+    {
+        parent::setUp();
+        $this->service = app('{{ serviceName }}');
+        $this->data['{{ modelNamePlural }}']
+            = factory({{ modelNameUc }}::class, $this->amount)
+            ->create();
+    }
+
+    public function testReturned()
+    {
+        $this->assertTrue(true);
+    }
+
+    function tearDown(): void
+    {
+        {{ modelNameUc }}::query()
+            ->whereIn('id',data_get($this->data['{{ modelNamePlural }}'],'*.id')??[])
+            ->delete();
+        parent::tearDown();
+    }
+}

+ 27 - 0
app/DepartmentObligationOwner.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace App;
+
+use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\Model;
+
+use App\Traits\ModelLogChanging;
+
+class DepartmentObligationOwner extends Model
+{
+    use ModelLogChanging;
+
+    use ModelTimeFormat;
+    public $timestamps=false;
+
+    protected $table='department_obligation_owner';
+
+    protected $fillable=[
+        'department_id','obligation_id', 'owner_id', 'valid_time','create_time', 'update_time','delete_flag','failure_time'
+    ];
+
+    public function department()
+    {   //面积报表
+        return $this->hasOne(UserWorkgroup::class,"id","department_id");
+    }
+}

+ 17 - 2
app/Http/Controllers/CustomerController.php

@@ -20,6 +20,7 @@ use App\OwnerFeeStorage;
 use App\OwnerPriceSystem;
 use App\OwnerReport;
 use App\Services\LogService;
+use App\Services\ObligationService;
 use App\Services\OwnerAreaReportService;
 use App\Services\OwnerBillReportService;
 use App\Services\OwnerReportService;
@@ -100,8 +101,9 @@ class CustomerController extends Controller
         if(!Gate::allows('项目管理-项目-查询')){ return redirect('denied');  }
         /** @var OwnerService $service */
         $service = app('OwnerService');
-        $owners = $service->paginate(request()->input(),['customer',"userOwnerGroup","userWorkGroup",
+        $owners = $service->paginate(request()->input(),['customer',"userOwnerGroup","userWorkGroup",'departmentObligationOwner.department',
             "ownerStoragePriceModels","storageAudit","operationAudit","expressAudit","logisticAudit","directLogisticAudit","systemAudit"]);
+        $owners=app('OwnerService')->combineOwners($owners);
         $models = app('OwnerService')->getIntersectPermitting();
         $customers = app('CustomerService')->getSelection();
         $ownerGroups = app('UserOwnerGroupService')->getSelection();
@@ -186,6 +188,9 @@ class CustomerController extends Controller
             "subjection"            => request("subjection"),
             "is_tax_exist"          => request("is_tax_exist") ? 'Y' : 'N',
         ]);
+        /** @var ObligationService $service*/
+        $service= app('ObligationService');
+        $owner=$service->createOrUpdate(request()->input());
         $this->success($owner);
     }
 
@@ -205,7 +210,17 @@ class CustomerController extends Controller
     {
         if(!Gate::allows('项目管理-项目-编辑')){ return redirect('denied');  }
         /** @var Owner $owner */
-        $owner = app('OwnerService')->find($id);
+        $owner = app('OwnerService')->find($id,['departmentObligationOwner']);
+        $departmentObligationOwner=$owner->departmentObligationOwner??[];
+        if (count($departmentObligationOwner)>0){
+            foreach ($departmentObligationOwner as $item){
+                if ($item->obligation_code=='kc')$owner->kc=$item->department_id;
+                if ($item->obligation_code=='jg')$owner->jg=$item->department_id;
+                if ($item->obligation_code=='th')$owner->th=$item->department_id;
+                if ($item->obligation_code=='sh')$owner->sh=$item->department_id;
+                if ($item->obligation_code=='fh')$owner->fh=$item->department_id;
+            }
+        }
         $owner->loadCount(["ownerStoragePriceModels","ownerPriceOperations","ownerPriceExpresses","ownerPriceLogistics","ownerPriceDirectLogistics","ownerPriceSystem"]);
         $isExist = false;
         /** @var \stdClass $owner */

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

@@ -75,6 +75,7 @@ use App\Services\ForeignHaiRoboticsService;
 use App\Services\ForeignZhenCangService;
 use App\Services\LogisticService;
 use App\Services\LogService;
+use App\Services\MenuService;
 use App\Services\NotificationService;
 use App\Services\OracleDOCOrderHeaderService;
 use App\Services\OrderPackageCommoditiesService;
@@ -159,6 +160,24 @@ class TestController extends Controller
         }
     }
 
+    public function format(array $arr,$newRes):array
+    {
+        $result = [];
+        foreach ($arr as $index=>$item){
+            if (isset($result[$item["sku_name"]])){
+                if (array_search($item["self_uid"],$result[$item["sku_name"]])!==false){
+                    $result[$item["sku_name"]][] = $item["next_uid"];
+                }else $result[$index] = $index;
+            }else $result[$item["sku_name"]] = [$item["self_uid"],$item["next_uid"]];
+        }
+        $recursion = [];
+        foreach ($result as $item){
+            if (is_array($item))$newRes[] = $item;
+            else $recursion[$item] = $arr[$item];
+        }
+        if (count($recursion)>0)$newRes = $this->format($recursion,$newRes);
+        return $newRes;
+    }
     public function test(Request $request)
     {
         $path = '';
@@ -651,7 +670,17 @@ sql;
 
     public function testZhenCang()
     {
-        $batches=Batch::query()->where('id',161071)->get();
-        BroadcastBatchToZhengCangJob::dispatch($batches);
+//        $batches=Batch::query()->where('id',161071)->get();
+//        BroadcastBatchToZhengCangJob::dispatch($batches);
+//        $sql = <<<sql
+//select department_id,obligation_id,owner_id,max(valid_time) from department_obligation_owner group by obligation_id,owner_id,department_id
+//sql;
+//        $info = DB::select(DB::raw($sql));
+//        dd($info);
+//        $owner=Owner::query()->with(['departmentObligationOwner'])->find(403);
+//        dd($owner);
+//        $a=app('ObligationService')->recombineCodeIdArr();
+        $now=Carbon::now()->subMonths(-1)->startOfMonth()->startOfDay()->toDateTimeString();
+        dd($now);
     }
 }

+ 21 - 0
app/Obligation.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App;
+
+use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\Model;
+
+use App\Traits\ModelLogChanging;
+
+class Obligation extends Model
+{
+    use ModelLogChanging;
+
+    use ModelTimeFormat;
+    protected $table='obligation';
+    public $timestamps=false;
+
+    protected $fillable=[
+        'name','code', 'create_time', 'update_time','delete_flag'
+    ];
+}

+ 7 - 0
app/Owner.php

@@ -118,6 +118,13 @@ class Owner extends Model
     {   //面积报表
         return $this->hasOne(OwnerAreaReport::class,"owner_id","id");
     }
+    public function departmentObligationOwner()
+    {   //部门职能关联
+        return $this->hasMany(DepartmentObligationOwner::class,"owner_id","id")
+            ->selectRaw('obligation_code,obligation_id,owner_id,department_id,max(valid_time)')
+            ->groupBy('obligation_id','owner_id','department_id')
+            ->whereNull('failure_time');
+    }
     public function ownerStoragePriceModels()
     {   //仓储计费
         $query = OwnerStoragePriceModel::query()->select("target_id")

+ 3 - 1
app/Providers/AppServiceProvider.php

@@ -191,6 +191,7 @@ use App\Services\WorkOrderProcessLogService;
 use App\Services\LaborApplyService;
 use App\Services\SyriusTaskService;
 use App\Services\ReplenishmentService;
+use App\Services\ObligationService;
 
 class AppServiceProvider extends ServiceProvider
 {
@@ -275,6 +276,7 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('MenuService',MenuService::class);
         app()->singleton('NewOrderCountingRecordService',NewOrderCountingRecordService::class);
         app()->singleton('NotificationService',NotificationService::class);
+        app()->singleton('ObligationService',ObligationService::class);
         app()->singleton('OracleActAllocationDetailService', OracleActAllocationDetailService::class);
         app()->singleton('OracleBasCustomerService', OracleBasCustomerService::class);
         app()->singleton('OracleBasSkuService', OracleBasSkuService::class);
@@ -346,6 +348,7 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('RejectedBillItemService', RejectedBillItemService::class);
         app()->singleton('RejectedBillService', RejectedBillService::class);
         app()->singleton('RejectedService', RejectedService::class);
+        app()->singleton('ReplenishmentService',ReplenishmentService::class);
         app()->singleton('RequirementService',RequirementService::class);
         app()->singleton('RequirementUserService',RequirementUserService::class);
         app()->singleton('ReviewService',ReviewService::class);
@@ -392,7 +395,6 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('WorkOrderProcessLogService',WorkOrderProcessLogService::class);
         app()->singleton('WorkOrderService',WorkOrderService::class);
         app()->singleton('WorkOrderTypeService',WorkOrderTypeService::class);
-        app()->singleton('ReplenishmentService',ReplenishmentService::class);
     }
 
     private function registerObserver()

+ 114 - 0
app/Services/ObligationService.php

@@ -0,0 +1,114 @@
+<?php
+
+namespace App\Services;
+
+use App\DepartmentObligationOwner;
+use App\Owner;
+use App\Traits\ServiceAppAop;
+use App\Obligation;
+use Carbon\Carbon;
+
+class ObligationService
+{
+    use ServiceAppAop;
+    protected $modelClass=Obligation::class;
+
+    public function getSelection($column = ['id','code'])
+    {
+        return Obligation::query()->select($column)->get();
+    }
+    public function recombineCodeIdArr(){
+        $obligations=$this->getSelection()->toArray();
+        return array_combine(array_column($obligations, 'code'), array_column($obligations, 'id'));
+    }
+    public function createOrUpdate(array $param){
+        $obligation=$this->recombineCodeIdArr();
+        $owner=Owner::query()->with('departmentObligationOwner')->find($param['id']);
+        $departmentObligationOwner=$owner->departmentObligationOwner->toArray()??[];
+        $time=Carbon::now()->subMonths(-1)->startOfMonth()->startOfDay()->toDateTimeString();
+        if (empty($departmentObligationOwner)){//第一次新增 部门和职能及货主关联
+           $insert_param=[];
+            $insert_param[]=['department_id'=>$param['kc'],'obligation_id'=>$obligation['kc'],'obligation_code'=>'kc','owner_id'=>$param['id'],'valid_time'=>$time];
+            $insert_param[]=['department_id'=>$param['jg'],'obligation_id'=>$obligation['jg'],'obligation_code'=>'jg','owner_id'=>$param['id'],'valid_time'=>$time];
+            $insert_param[]=['department_id'=>$param['th'],'obligation_id'=>$obligation['th'],'obligation_code'=>'th','owner_id'=>$param['id'],'valid_time'=>$time];
+            $insert_param[]=['department_id'=>$param['sh'],'obligation_id'=>$obligation['sh'],'obligation_code'=>'sh','owner_id'=>$param['id'],'valid_time'=>$time];
+            $insert_param[]=['department_id'=>$param['fh'],'obligation_id'=>$obligation['fh'],'obligation_code'=>'fh','owner_id'=>$param['id'],'valid_time'=>$time];
+            DepartmentObligationOwner::query()->insert($insert_param);
+        }else{//修改货主中的 仓库组, 加工组, 发货组, 收货组, 退货组信息
+            $kc=DepartmentObligationOwner::query()
+                ->where('obligation_id',$obligation['kc'])
+                ->where('owner_id',$param['id'])
+                ->where('valid_time',$time)->first();
+            if ($kc){
+                $kc->update(['department_id'=>$param['kc']]);
+            }else{
+                DepartmentObligationOwner::query()
+                    ->orderByDesc('id')
+                    ->where('obligation_id',$obligation['kc'])
+                    ->where('owner_id',$param['id'])
+                    ->update(['failure_time'=>$time]);
+                DepartmentObligationOwner::query()->insert(['department_id'=>$param['kc'],'obligation_id'=>$obligation['kc'],'obligation_code'=>'kc','owner_id'=>$param['id'],'valid_time'=>$time]);
+            }
+            $jg=DepartmentObligationOwner::query()
+                ->where('obligation_id',$obligation['jg'])
+                ->where('owner_id',$param['id'])
+                ->where('valid_time',$time)->first();
+            if ($jg){
+                $jg->update(['department_id'=>$param['jg']]);
+            }else{
+                DepartmentObligationOwner::query()
+                    ->orderByDesc('id')
+                    ->where('obligation_id',$obligation['jg'])
+                    ->where('owner_id',$param['id'])
+                    ->update(['failure_time'=>$time]);
+                DepartmentObligationOwner::query()->insert(['department_id'=>$param['jg'],'obligation_id'=>$obligation['jg'],'obligation_code'=>'jg','owner_id'=>$param['id'],'valid_time'=>$time]);
+            }
+
+            $th=DepartmentObligationOwner::query()
+                ->where('obligation_id',$obligation['th'])
+                ->where('owner_id',$param['id'])
+                ->where('valid_time',$time)->first();
+            if ($th){
+                $th->update(['department_id'=>$param['th']]);
+            }else{
+                DepartmentObligationOwner::query()
+                    ->orderByDesc('id')
+                    ->where('obligation_id',$obligation['th'])
+                    ->where('owner_id',$param['id'])
+                    ->update(['failure_time'=>$time]);
+                DepartmentObligationOwner::query()->insert(['department_id'=>$param['th'],'obligation_id'=>$obligation['th'],'obligation_code'=>'th','owner_id'=>$param['id'],'valid_time'=>$time]);
+            }
+
+            $sh=DepartmentObligationOwner::query()
+                ->where('obligation_id',$obligation['sh'])
+                ->where('owner_id',$param['id'])
+                ->where('valid_time',$time)->first();
+            if ($sh){
+                $sh->update(['department_id'=>$param['sh']]);
+            }else{
+                DepartmentObligationOwner::query()
+                    ->orderByDesc('id')
+                    ->where('obligation_id',$obligation['sh'])
+                    ->where('owner_id',$param['id'])
+                    ->update(['failure_time'=>$time]);
+                DepartmentObligationOwner::query()->insert(['department_id'=>$param['sh'],'obligation_id'=>$obligation['sh'],'obligation_code'=>'sh','owner_id'=>$param['id'],'valid_time'=>$time]);
+            }
+
+            $fh=DepartmentObligationOwner::query()
+                ->where('obligation_id',$obligation['fh'])
+                ->where('owner_id',$param['id'])
+                ->where('valid_time',$time)->first();
+            if ($fh){
+                $fh->update(['department_id'=>$param['fh']]);
+            }else{
+                DepartmentObligationOwner::query()
+                    ->orderByDesc('id')
+                    ->where('obligation_id',$obligation['fh'])
+                    ->where('owner_id',$param['id'])
+                    ->update(['failure_time'=>$time]);
+                DepartmentObligationOwner::query()->insert(['department_id'=>$param['fh'],'obligation_id'=>$obligation['fh'],'obligation_code'=>'fh','owner_id'=>$param['id'],'valid_time'=>$time]);
+            }
+        }
+        return Owner::query()->with('departmentObligationOwner')->find($param['id']);
+    }
+}

+ 58 - 2
app/Services/OwnerService.php

@@ -270,8 +270,38 @@ class OwnerService implements UserFilter
                 else $builder->where('owner_id',$param);
                 continue;
             }
-            if ($column == 'user_work_group'){
-                $builder->where("user_workgroup_id",$param);
+//            if ($column == 'user_work_group'){
+//                $builder->where("user_workgroup_id",$param);
+//                continue;
+//            }
+            if ($column == 'kcGroup'){
+                $builder->whereHas("departmentObligationOwner",function($query)use($param){
+                    $query->where('obligation_code','kc')->where('department_id',$param);
+                });
+                continue;
+            }
+            if ($column == 'jgGroup'){
+                $builder->whereHas("departmentObligationOwner",function($query)use($param){
+                    $query->where('obligation_code','jg')->where('department_id',$param);
+                });
+                continue;
+            }
+            if ($column == 'fhGroup'){
+                $builder->whereHas("departmentObligationOwner",function($query)use($param){
+                    $query->where('obligation_code','fh')->where('department_id',$param);
+                });
+                continue;
+            }
+            if ($column == 'thGroup'){
+                $builder->whereHas("departmentObligationOwner",function($query)use($param){
+                    $query->where('obligation_code','th')->where('department_id',$param);
+                });
+                continue;
+            }
+            if ($column == 'shGroup'){
+                $builder->whereHas("departmentObligationOwner",function($query)use($param){
+                    $query->where('obligation_code','sh')->where('department_id',$param);
+                });
                 continue;
             }
             if (is_array($param))$builder->whereIn($column,$param);
@@ -561,4 +591,30 @@ sql;
         }
         return $query->whereNull("deleted_at");
     }
+
+    public function combineOwners($owners)
+    {
+        foreach ($owners as $owner){
+            $departmentObligationOwner=$owner->departmentObligationOwner??false;
+            if (!$departmentObligationOwner)continue;
+            foreach ($departmentObligationOwner as $item){
+                if ($item->obligation_code=='kc'){
+                    $owner->kc=$item->department_id;$owner->kcGroup=$item->department?$item->department->name:'';
+                }
+                if ($item->obligation_code=='jg'){
+                    $owner->jg=$item->department_id;$owner->jgGroup=$item->department?$item->department->name:'';
+                }
+                if ($item->obligation_code=='th'){
+                    $owner->th=$item->department_id;$owner->thGroup=$item->department?$item->department->name:'';
+                }
+                if ($item->obligation_code=='sh'){
+                    $owner->sh=$item->department_id;$owner->shGroup=$item->department?$item->department->name:'';
+                }
+                if ($item->obligation_code=='fh'){
+                    $owner->fh=$item->department_id;$owner->fhGroup=$item->department?$item->department->name:'';
+                }
+            }
+        }
+        return $owners;
+    }
 }

+ 12 - 5
app/Services/StoreItemService.php

@@ -35,11 +35,18 @@ class StoreItemService
 
     public function getAsnDetailsByAsnHerder($asnHerders)
     {
-        return OracleDOCASNDetail::query()
-            ->with(['lineStatus', 'qualityStatus'])
-            ->whereIn('asnno',array_unique(data_get($asnHerders, '*.asnno')))
-            ->select('asnno','asnlineno','customerid','sku','skudescrc','linestatus','lotatt08','lotatt05','receivedqty','expectedqty','addtime','edittime')
-            ->get();
+        $asnnos=array_unique(data_get($asnHerders, '*.asnno'));
+        $collect=collect();
+        foreach (array_chunk($asnnos,1000) as $item){
+            $res= OracleDOCASNDetail::query()
+                ->with(['lineStatus', 'qualityStatus'])
+                ->whereIn('asnno',$item)
+                ->select('asnno','asnlineno','customerid','sku','skudescrc','linestatus','lotatt08','lotatt05','receivedqty','expectedqty','addtime','edittime')
+                ->get();
+            $collect->merge($res);
+        }
+        return $collect;
+
     }
 
     public function createStoreItem($asnDetails)

+ 65 - 6
resources/views/customer/project/create.blade.php

@@ -97,6 +97,11 @@
                     waring_line_on : "{{$owner->waring_line_on ?? ''}}",
                     subjection : "{{$owner->subjection ?? ''}}",
                     is_tax_exist : "{{$owner->is_tax_exist ?? ''}}"==='Y',
+                    kc :"{{$owner->kc ?? ''}}",
+                    jg :"{{$owner->jg ?? ''}}",
+                    th :"{{$owner->th ?? ''}}",
+                    sh :"{{$owner->sh ?? ''}}",
+                    fh :"{{$owner->fh ?? ''}}",
                 },
                 ownerTemp : {},
                 customers : [
@@ -482,7 +487,12 @@
                     if (!this.owner.customer_id) error["customer_id"] = ["必须选择客户"];
                     if (!this.owner.owner_group_id) error["owner_group_id"] = ["必须选择项目小组"];
                     if (!this.owner.warehouse_id) error["warehouse_id"] = ["必须选择仓库"];
-                    if (!this.owner.user_workgroup_id) error["user_workgroup_id"] = ["必须选择仓库小组"];
+                    // if (!this.owner.user_workgroup_id) error["user_workgroup_id"] = ["必须选择仓库小组"];
+                    if (!this.owner.kc) error["kc"] = ["必须选择库存组"];
+                    if (!this.owner.jg) error["jg"] = ["必须选择加工组"];
+                    if (!this.owner.th) error["th"] = ["必须选择退货组"];
+                    if (!this.owner.sh) error["sh"] = ["必须选择收货组"];
+                    if (!this.owner.fh) error["fh"] = ["必须选择发货组"];
                     //if (!this.owner.tax_rate_id) error["tax_rate_id"] = ["必须选择税率"];
                     if (JSON.stringify(error) !== "{}"){
                         this.errors = error;
@@ -494,7 +504,11 @@
                     let old = this.ownerTemp;
                     if (params.customer_id !== old.customer_id ||
                     params.owner_group_id !== old.owner_group_id ||
-                    params.user_workgroup_id !== old.user_workgroup_id ||
+                    params.kc !== old.kc ||
+                    params.jg !== old.jg ||
+                    params.th !== old.th ||
+                    params.sh !== old.sh ||
+                    params.fh !== old.fh ||
                     params.warehouse_id !== old.warehouse_id ||
                     params.tax_rate_id !== old.tax_rate_id ||
                     params.waring_line_on !== old.waring_line_on ||
@@ -512,7 +526,12 @@
                             this.errors = [];
                             this.ownerTemp.customer_id = res.customer_id;
                             this.ownerTemp.owner_group_id = res.owner_group_id;
-                            this.ownerTemp.user_workgroup_id = res.user_workgroup_id;
+                            // this.ownerTemp.user_workgroup_id = res.user_workgroup_id;
+                            if (res.department_obligation_owner.obligation_code==='kc')this.ownerTemp.kc = res.department_obligation_owner.obligation_id;
+                            if (res.department_obligation_owner.obligation_code==='jg')this.ownerTemp.jg = res.department_obligation_owner.obligation_id;
+                            if (res.department_obligation_owner.obligation_code==='th')this.ownerTemp.th = res.department_obligation_owner.obligation_id;
+                            if (res.department_obligation_owner.obligation_code==='sh')this.ownerTemp.sh = res.department_obligation_owner.obligation_id;
+                            if (res.department_obligation_owner.obligation_code==='fh')this.ownerTemp.fh = res.department_obligation_owner.obligation_id;
                             this.ownerTemp.warehouse_id = res.warehouse_id;
                             this.ownerTemp.tax_rate_id = res.tax_rate_id;
                             this.ownerTemp.waring_line_on = res.waring_line_on;
@@ -2059,12 +2078,52 @@
                         }
                     });
                 },
-                filterUserGroup(e){
+                filterkc(e){
                     let value = e.target.value;
-                    if (!value)this.owner.user_workgroup_id = "";
+                    if (!value)this.owner.kc = "";
                     this.userGroups.some(userGroup=>{
                         if (userGroup.name.indexOf(value)!==-1){
-                            this.owner.user_workgroup_id = userGroup.id;
+                            this.owner.kc = userGroup.id;
+                            return true;
+                        }
+                    });
+                },
+                filterjg(e){
+                    let value = e.target.value;
+                    if (!value)this.owner.jg = "";
+                    this.userGroups.some(userGroup=>{
+                        if (userGroup.name.indexOf(value)!==-1){
+                            this.owner.jg = userGroup.id;
+                            return true;
+                        }
+                    });
+                },
+                filterth(e){
+                    let value = e.target.value;
+                    if (!value)this.owner.th = "";
+                    this.userGroups.some(userGroup=>{
+                        if (userGroup.name.indexOf(value)!==-1){
+                            this.owner.th = userGroup.id;
+                            return true;
+                        }
+                    });
+                },
+                filtersh(e){
+                    let value = e.target.value;
+                    if (!value)this.owner.sh = "";
+                    this.userGroups.some(userGroup=>{
+                        if (userGroup.name.indexOf(value)!==-1){
+                            this.owner.sh = userGroup.id;
+                            return true;
+                        }
+                    });
+                },
+                filterfh(e){
+                    let value = e.target.value;
+                    if (!value)this.owner.fh = "";
+                    this.userGroups.some(userGroup=>{
+                        if (userGroup.name.indexOf(value)!==-1){
+                            this.owner.fh = userGroup.id;
                             return true;
                         }
                     });

+ 25 - 5
resources/views/customer/project/index.blade.php

@@ -64,7 +64,12 @@
                     <td><span>@{{ owner.name }}</span></td>
                     <td><span>@{{ owner.customer_name }}</span></td>
                     <td><span>@{{ owner.user_owner_group_name }}</span></td>
-                    <td><span>@{{ owner.user_work_group_name }}</span></td>
+{{--                    <td><span>@{{ owner.user_work_group_name }}</span></td>--}}
+                    <td><span>@{{ owner.kcGroup }}</span></td>
+                    <td><span>@{{ owner.jgGroup }}</span></td>
+                    <td><span>@{{ owner.thGroup }}</span></td>
+                    <td><span>@{{ owner.shGroup }}</span></td>
+                    <td><span>@{{ owner.fhGroup }}</span></td>
                     <td><span><b>@{{owner.relevance ? owner.relevance.length : 0}}</b>/6&nbsp;<span class="badge badge-success" v-if="owner.audit_count>0">@{{ owner.audit_count }}项待审</span></span></td>
                     <td><span>@{{ owner.created_at }}</span></td>
                     <td><span>@{{ owner.customer_company_name }}</span></td>
@@ -108,7 +113,13 @@
                         is_activation : "{{$owner->deleted_at ? '否' : '是'}}",
                         ownerStoragePriceModels : {!! $owner->ownerStoragePriceModels !!},
                         audit_count:"{{count($owner->storageAudit)+count($owner->operationAudit)+count($owner->expressAudit)+count($owner->logisticAudit)+count($owner->directLogisticAudit)+($owner->systemAudit ? 1 : 0)}}",
-                        a:"{{$owner}}"
+                        a:"{{$owner}}",
+                        kc:"{{$owner->kc}}", kcGroup:"{{$owner->kcGroup}}",
+                        jg:"{{$owner->jg}}", jgGroup:"{{$owner->jgGroup}}",
+                        th:"{{$owner->th}}", thGroup:"{{$owner->thGroup}}",
+                        sh:"{{$owner->sh}}", shGroup:"{{$owner->shGroup}}",
+                        fh:"{{$owner->fh}}", fhGroup:"{{$owner->fhGroup}}",
+
                     },
                     @endforeach
                 ],
@@ -140,8 +151,10 @@
                 let data=[
                     [
                         {name:'user_owner_group_id',type:'select',tip:'项目小组',placeholder: '项目小组',data:this.ownerGroups},
-                        {name:'user_work_group',type:'select',tip: '仓库小组搜索',placeholder: '仓库小组',data:this.user_work_groups},
-
+                        // {name:'user_work_group',type:'select',tip: '仓库小组搜索',placeholder: '仓库小组',data:this.user_work_groups},
+                        {name:'kcGroup',type:'select',tip: '库存组搜索',placeholder: '库存组',data:this.user_work_groups},
+                        {name:'jgGroup',type:'select',tip: '加工组搜索',placeholder: '加工组',data:this.user_work_groups},
+                        {name:'shGroup',type:'select',tip: '收货组搜索',placeholder: '收货组',data:this.user_work_groups},
                         {name:'created_at_start',type:'time',tip:['选择显示创建日期的起始时间','']},
                         {name:'ids',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的项目'],
                             placeholder:['项目','定位或多选项目'],data:this.models},
@@ -149,6 +162,8 @@
                     ],[
                         {name:'customers',type:'select_multiple_select',tip:['客户','定位或多选项目'],placeholder: ['客户','定位或多选项目'],data:this.customers},
                         {name:'using_type',type:'select',placeholder: '用仓类型',data:[{name:"常温",value:"常温"},{name:"恒温",value:"恒温"}]},
+                        {name:'thGroup',type:'select',tip: '退货组搜索',placeholder: '退货组',data:this.user_work_groups},
+                        {name:'fhGroup',type:'select',tip: '发货组搜索',placeholder: '发货组',data:this.user_work_groups},
                         {name:'created_at_end',type:'time',tip:['选择显示创建日期的结束时间','']},
                     ],
                 ];
@@ -162,7 +177,12 @@
                     {name:'name',value: '项目'},
                     {name:'customer',value: '客户'},
                     {name:'user_owner_group_name',value: '项目小组'},
-                    {name:'user_work_group_name',value: '仓库小组'},
+                    // {name:'user_work_group_name',value: '仓库小组'},
+                    {name:'kc',value: '库存组'},
+                    {name:'jg',value: '加工组'},
+                    {name:'th',value: '退货组'},
+                    {name:'sh',value: '收货组'},
+                    {name:'fh',value: '发货组'},
                     {name:'relevance', neglect: true,value: '计费模型填写情况'},
                     {name:'created_at',value: '创建日期'},
                     {name:'customer_full_name',value: '公司全称'},

+ 49 - 7
resources/views/customer/project/part/_two.blade.php

@@ -9,11 +9,11 @@
     </span>
 </div>
 <div class="row mt-3">
-    <label for="owner_group_id" class="col-2 text-info">项目组</label>
+    <label for="owner_group_id" class="col-2 text-info">项目组</label>
     <select id="owner_group_id" v-model="owner.owner_group_id" @change="selectGroup()" class="form-control form-control-sm col-4 mb-0" :class="errors.owner_group_id ? 'is-invalid' : ''" >
         <option v-for="ownerGroup in ownerGroups" :value="ownerGroup.id">@{{ ownerGroup.name }}</option>
     </select>
-    <label class="col-2"><input type="text" class="form-control form-control-sm rounded-pill" placeholder="输入关键字项目组" @input="filterOwnerGroup($event)"></label>
+    <label class="col-2"><input type="text" class="form-control form-control-sm rounded-pill" placeholder="输入关键字项目组" @input="filterOwnerGroup($event)"></label>
     <span class="invalid-feedback offset-2 mt-0" role="alert" v-if="errors.owner_group_id">
         <strong>@{{ errors.owner_group_id[0] }}</strong>
     </span>
@@ -27,16 +27,58 @@
         <strong>@{{ errors.warehouse_id[0] }}</strong>
     </span>
 </div>
+
 <div class="row mt-3">
-    <label for="user_workgroup_id" class="col-2 text-info">仓库小组</label>
-    <select id="user_workgroup_id" v-model="owner.user_workgroup_id" @change="selectGroup()" class="form-control form-control-sm col-4 mb-0" :class="errors.user_workgroup_id ? 'is-invalid' : ''" >
+    <label for="kc" class="col-2 text-info">库存组</label>
+    <select id="kc" v-model="owner.kc" @change="selectKcGroup()"   class="form-control form-control-sm col-4 mb-0" :class="errors.kc ? 'is-invalid' : ''" >
         <option v-for="userGroup in userGroups" :value="userGroup.id" v-if="userGroup.warehouse_id == owner.warehouse_id">@{{ userGroup.name }}</option>
     </select>
-    <label class="col-2"><input type="text" class="form-control form-control-sm rounded-pill" placeholder="输入关键字项目小组" @change="filterUserGroup($event)"></label>
-    <span class="invalid-feedback offset-2 mt-0" role="alert" v-if="errors.user_workgroup_id">
-        <strong>@{{ errors.user_workgroup_id[0] }}</strong>
+    <label class="col-2"><input type="text" class="form-control form-control-sm rounded-pill" placeholder="输入关键字库存组" @change="filterkc($event)"></label>
+    <span class="invalid-feedback offset-2 mt-0" role="alert" v-if="errors.kc">
+        <strong>@{{ errors.kc[0] }}</strong>
     </span>
 </div>
+<div class="row mt-3">
+    <label for="jg" class="col-2 text-info">加工组</label>
+    <select id="jg" v-model="owner.jg"  class="form-control form-control-sm col-4 mb-0" :class="errors.jg ? 'is-invalid' : ''" >
+        <option v-for="userGroup in userGroups" :value="userGroup.id" v-if="userGroup.warehouse_id == owner.warehouse_id">@{{ userGroup.name }}</option>
+    </select>
+    <label class="col-2"><input type="text" class="form-control form-control-sm rounded-pill" placeholder="输入关键字加工组" @change="filterjg($event)"></label>
+    <span class="invalid-feedback offset-2 mt-0" role="alert" v-if="errors.jg">
+        <strong>@{{ errors.jg[0] }}</strong>
+    </span>
+</div>
+<div class="row mt-3">
+    <label for="th" class="col-2 text-info">退货组</label>
+    <select id="th" v-model="owner.th"  class="form-control form-control-sm col-4 mb-0" :class="errors.th ? 'is-invalid' : ''" >
+        <option v-for="userGroup in userGroups" :value="userGroup.id" v-if="userGroup.warehouse_id == owner.warehouse_id">@{{ userGroup.name }}</option>
+    </select>
+    <label class="col-2"><input type="text" class="form-control form-control-sm rounded-pill" placeholder="输入关键字退货组" @change="filterth($event)"></label>
+    <span class="invalid-feedback offset-2 mt-0" role="alert" v-if="errors.th">
+        <strong>@{{ errors.th[0] }}</strong>
+    </span>
+</div>
+<div class="row mt-3">
+    <label for="sh" class="col-2 text-info">收货组</label>
+    <select id="sh" v-model="owner.sh"  class="form-control form-control-sm col-4 mb-0" :class="errors.sh ? 'is-invalid' : ''" >
+        <option v-for="userGroup in userGroups" :value="userGroup.id" v-if="userGroup.warehouse_id == owner.warehouse_id">@{{ userGroup.name }}</option>
+    </select>
+    <label class="col-2"><input type="text" class="form-control form-control-sm rounded-pill" placeholder="输入关键字收货组" @change="filtersh($event)"></label>
+    <span class="invalid-feedback offset-2 mt-0" role="alert" v-if="errors.sh">
+        <strong>@{{ errors.sh[0] }}</strong>
+    </span>
+</div>
+<div class="row mt-3">
+    <label for="fh" class="col-2 text-info">发货组</label>
+    <select id="fh" v-model="owner.fh"  class="form-control form-control-sm col-4 mb-0" :class="errors.fh ? 'is-invalid' : ''" >
+        <option v-for="userGroup in userGroups" :value="userGroup.id" v-if="userGroup.warehouse_id == owner.warehouse_id">@{{ userGroup.name }}</option>
+    </select>
+    <label class="col-2"><input type="text" class="form-control form-control-sm rounded-pill" placeholder="输入关键字发货组" @change="filterfh($event)"></label>
+    <span class="invalid-feedback offset-2 mt-0" role="alert" v-if="errors.fh">
+        <strong>@{{ errors.fh[0] }}</strong>
+    </span>
+</div>
+
 <div class="row mt-3">
     <label for="subjection" class="col-2">主体公司</label>
     <select id="subjection" v-model="owner.subjection" class="form-control form-control-sm col-4 mb-0" >