Pārlūkot izejas kodu

Merge branch 'master' into LD

# Conflicts:
#	app/Console/Commands/SyncBatchTask.php
LD 5 gadi atpakaļ
vecāks
revīzija
8e0801e0e0
97 mainītis faili ar 2812 papildinājumiem un 360 dzēšanām
  1. 27 0
      app/Configuration.php
  2. 71 0
      app/Filters/ConfigurationFilters.php
  3. 61 0
      app/Filters/MaterialFilters.php
  4. 114 0
      app/Filters/OwnerMaterialFilters.php
  5. 72 0
      app/Filters/SupplierFilters.php
  6. 48 0
      app/Http/Controllers/ConfigurationController.php
  7. 1 4
      app/Http/Controllers/CustomerBaseController.php
  8. 14 9
      app/Http/Controllers/CustomerController.php
  9. 60 0
      app/Http/Controllers/MaterialController.php
  10. 16 22
      app/Http/Controllers/OrderIssueController.php
  11. 0 4
      app/Http/Controllers/OwnerController.php
  12. 95 0
      app/Http/Controllers/OwnerMaterialController.php
  13. 23 17
      app/Http/Controllers/PriceModelController.php
  14. 43 0
      app/Http/Controllers/SupplierController.php
  15. 28 61
      app/Http/Controllers/TestController.php
  16. 15 4
      app/Http/Controllers/WaybillController.php
  17. 4 4
      app/Http/Controllers/WeighController.php
  18. 4 4
      app/Http/Controllers/api/thirdPart/goodscan/PackageController.php
  19. 6 4
      app/Http/Controllers/api/thirdPart/weight/PackageController.php
  20. 1 0
      app/Jobs/OrderFreeze.php
  21. 45 0
      app/Jobs/WeightUpdateInstantBill.php
  22. 0 38
      app/Listeners/FulfillFulfillPackageCustomer.php
  23. 20 0
      app/Material.php
  24. 3 3
      app/OrderPackage.php
  25. 43 0
      app/OwnerMaterial.php
  26. 2 0
      app/Providers/AppServiceProvider.php
  27. 0 3
      app/Providers/EventServiceProvider.php
  28. 31 25
      app/Services/BatchService.php
  29. 1 1
      app/Services/ForeignHaiRoboticsService.php
  30. 14 0
      app/Services/MaterialService.php
  31. 7 6
      app/Services/OracleDocWaveDetailService.php
  32. 1 1
      app/Services/OrderPackageService.php
  33. 131 7
      app/Services/OrderService.php
  34. 1 1
      app/Services/OrderTrackingService.php
  35. 4 5
      app/Services/OwnerPriceOperationService.php
  36. 8 3
      app/Services/PackageService.php
  37. 2 0
      app/Services/StationRuleBatchService.php
  38. 7 3
      app/Services/StationTaskBatchService.php
  39. 1 3
      app/Services/WarehouseService.php
  40. 2 2
      app/Services/WeighExceptedService.php
  41. 28 0
      app/Supplier.php
  42. 1 1
      app/UploadFile.php
  43. 3 2
      bashupMysql.sh
  44. 18 0
      database/factories/ConfigurationFactory.php
  45. 13 0
      database/factories/MaterialFactory.php
  46. 17 0
      database/factories/OwnerMaterialFactory.php
  47. 20 0
      database/factories/SupplierFactory.php
  48. 32 0
      database/migrations/2021_01_28_094833_edit_order_packages_status_add_uploaded_to_wms_enum.php
  49. 35 0
      database/migrations/2021_01_29_161734_add_units_data.php
  50. 33 0
      database/migrations/2021_02_01_132214_create_materials_table.php
  51. 38 0
      database/migrations/2021_02_01_172827_create_owner_material_table.php
  52. 39 0
      database/migrations/2021_02_02_141649_create_suppliers_table.php
  53. 31 0
      database/migrations/2021_02_02_142307_create_table_material_supplier.php
  54. 35 0
      database/migrations/2021_02_02_155946_create_configurations_table.php
  55. 40 0
      database/migrations/2021_02_03_091623_add_authorrities_to_materials_owner_material_suppliers_configurations.php
  56. 17 0
      database/seeds/ConfigurationSeeder.php
  57. 17 0
      database/seeds/MaterialSeeder.php
  58. 18 0
      database/seeds/OwnerMaterialSeeder.php
  59. 17 0
      database/seeds/SupplierSeeder.php
  60. 6 5
      resources/views/customer/_selectedOwner.blade.php
  61. 2 2
      resources/views/customer/customer/tag/index.blade.php
  62. 2 2
      resources/views/customer/customerLogStatus/index.blade.php
  63. 28 8
      resources/views/customer/project/area.blade.php
  64. 28 3
      resources/views/customer/project/create.blade.php
  65. 1 1
      resources/views/customer/project/part/_addFeature.blade.php
  66. 5 4
      resources/views/customer/project/part/_operation.blade.php
  67. 2 1
      resources/views/customer/project/part/_storage.blade.php
  68. 16 2
      resources/views/customer/project/part/_three.blade.php
  69. 9 3
      resources/views/customer/project/report.blade.php
  70. 38 0
      resources/views/maintenance/configuration/_create.blade.php
  71. 38 0
      resources/views/maintenance/configuration/_edit.blade.php
  72. 32 0
      resources/views/maintenance/configuration/_table.blade.php
  73. 93 0
      resources/views/maintenance/configuration/index.blade.php
  74. 28 0
      resources/views/maintenance/material/_create.blade.php
  75. 28 0
      resources/views/maintenance/material/_edit.blade.php
  76. 22 0
      resources/views/maintenance/material/_table.blade.php
  77. 104 0
      resources/views/maintenance/material/index.blade.php
  78. 16 4
      resources/views/maintenance/menu.blade.php
  79. 62 0
      resources/views/maintenance/ownerMaterial/_create.blade.php
  80. 62 0
      resources/views/maintenance/ownerMaterial/_edit.blade.php
  81. 49 0
      resources/views/maintenance/ownerMaterial/_table.blade.php
  82. 27 0
      resources/views/maintenance/ownerMaterial/_uploadFile.blade.php
  83. 169 0
      resources/views/maintenance/ownerMaterial/index.blade.php
  84. 46 4
      resources/views/maintenance/priceModel/operation/create.blade.php
  85. 3 3
      resources/views/maintenance/priceModel/operation/index.blade.php
  86. 56 11
      resources/views/maintenance/region/index.blade.php
  87. 62 0
      resources/views/maintenance/supplier/_create.blade.php
  88. 62 0
      resources/views/maintenance/supplier/_edit.blade.php
  89. 32 0
      resources/views/maintenance/supplier/_table.blade.php
  90. 88 0
      resources/views/maintenance/supplier/index.blade.php
  91. 11 9
      resources/views/order/issue/create.blade.php
  92. 4 4
      resources/views/order/issue/index.blade.php
  93. 2 1
      resources/views/package/weigh/index.blade.php
  94. 8 8
      resources/views/waybill/_batchUploadImg.blade.php
  95. 51 48
      resources/views/waybill/index.blade.php
  96. 30 0
      routes/apiLocal.php
  97. 12 0
      routes/web.php

+ 27 - 0
app/Configuration.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace App;
+
+use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\Model;
+use App\Traits\ModelLogChanging;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
+
+class Configuration extends Model
+{
+    use ModelLogChanging;
+    use ModelTimeFormat;
+    protected $fillable = [
+        'name','value','description','operator'
+    ];
+
+    public function operator():BelongsTo
+    {
+        return $this->belongsTo(User::class,'operator');
+    }
+
+    public function scopeFilter($query,$filter)
+    {
+        return $filter->apply($query);
+    }
+}

+ 71 - 0
app/Filters/ConfigurationFilters.php

@@ -0,0 +1,71 @@
+<?php
+
+
+namespace App\Filters;
+
+
+use Illuminate\Http\Request;
+
+class ConfigurationFilters
+{
+    protected $request;
+    protected $queryBuilder;
+    protected $filters = [];
+    protected $array_filter;
+    protected $params = [
+        'name', 'contact_man', 'phone', 'invoice_title', 'bank', 'bank_account', 'opening_bank'
+    ];
+
+    public function __construct(Request $request)
+    {
+        $this->request = $request;
+    }
+
+    public function apply($builder)
+    {
+        $this->queryBuilder = $builder;
+        $filters = array_filter($this->request->only($this->filters));
+        foreach ($filters as $filter => $value) {
+            if (method_exists($this, $filter)) {
+                $this->$filter($value, $this->queryBuilder);
+            }
+        }
+        $this->afterApply();
+        return $this->queryBuilder;
+    }
+
+    private function afterApply()
+    {
+
+    }
+
+    private function name($name)
+    {
+
+    }
+
+    private function contact_man($contact_man)
+    {
+
+    }
+
+    private function phone($phone)
+    {
+
+    }
+
+    private function invoice_title($invoice_title)
+    {
+
+    }
+
+    private function opening_bank($opening_bank)
+    {
+
+    }
+
+    private function bank($bank)
+    {
+
+    }
+}

+ 61 - 0
app/Filters/MaterialFilters.php

@@ -0,0 +1,61 @@
+<?php
+
+
+namespace App\Filters;
+
+use Illuminate\Http\Request;
+
+class MaterialFilters
+{
+    protected $request;
+    protected $queryBuilder;
+    protected $filters = [];
+    protected $array_filter;
+    protected $params = ['code','name'];
+
+    public function __construct(Request $request)
+    {
+        $this->request = $request;
+        $this->params = $request->all();
+        $this->array_filter = array_filter($this->request->only($this->filters));
+    }
+
+    private function isSearchLike($str)
+    {
+        if (substr($str, 0, 1) == "%" || substr($str, strlen($str) - 1, 1) == "%") {
+            return true;
+        }
+        return false;
+    }
+
+    private function searchWay($query, $param, $column)
+    {
+        if ($this->isSearchLike($param)) {
+            $query->where($column, 'like', $param);
+        } else {
+            $query->whereIn($column, array_filter(preg_split('/[,, ]+/is', $param)));
+        }
+        return $query;
+    }
+
+    public function apply($builder)
+    {
+        $this->queryBuilder = $builder;
+        foreach ($this->array_filter as $filter => $value) {
+            if (method_exists($this, $filter)) {
+                $this->$filter($value, $this->queryBuilder);
+            }
+        }
+        return $this->queryBuilder;
+    }
+
+    public function code($code)
+    {
+        $this->searchWay($this->queryBuilder,$code,'code');
+    }
+
+    public function name($name)
+    {
+        $this->searchWay($this->queryBuilder,$name,'name');
+    }
+}

+ 114 - 0
app/Filters/OwnerMaterialFilters.php

@@ -0,0 +1,114 @@
+<?php
+
+
+namespace App\Filters;
+
+
+use App\Material;
+use App\User;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Http\Request;
+
+class OwnerMaterialFilters
+{
+    protected $request;
+    protected $queryBuilder;
+    protected $materialQuery;
+    protected $userQuery;
+    protected $filters = [];
+    protected $array_filter;
+    protected $params = [
+        'owner_id','material_code','user_name','created_at_start','created_at_end','special'
+    ];
+
+    public function __construct(Request $request)
+    {
+        $this->request = $request;
+    }
+
+    public function apply($builder)
+    {
+        $this->queryBuilder = $builder;
+        $filters = array_filter($this->request->only($this->filters));
+        foreach ($filters as $filter => $value) {
+            if (method_exists($this, $filter)) {
+                $this->$filter($value, $this->queryBuilder);
+            }
+        }
+        $this->afterApply();
+        return $this->queryBuilder;
+    }
+
+    private function isSearchLike($str):bool
+    {
+        if (substr($str, 0, 1) == "%" || substr($str, strlen($str) - 1, 1) == "%") {
+            return true;
+        }
+        return false;
+    }
+
+    private function searchWay($query, $param, $column)
+    {
+        if ($this->isSearchLike($param)) {
+            $query->where($column, 'like', $param);
+        } else {
+            $query->whereIn($column, array_filter(preg_split('/[,, ]+/is', $param)));
+        }
+        return $query;
+    }
+
+    private function getMaterialQuery():Builder
+    {
+        if(!$this->materialQuery)
+            $this->materialQuery = Material::query()->selectRaw('id');
+        return $this->materialQuery;
+    }
+
+    private function getUserQuery():Builder
+    {
+        if(!$this->userQuery)
+            $this->userQuery = User::query()->selectRaw('id');
+        return $this->userQuery;
+    }
+
+    public function owner_Id($owner_id)
+    {
+        $this->searchWay($this->queryBuilder,$owner_id,'owner_id');
+    }
+
+    public function material_code($material_code)
+    {
+        $this->getMaterialQuery()->where('code','like',"{$material_code}%");
+    }
+
+    public function user_name($user_name)
+    {
+        $this->getUserQuery()->where('name','like',"{$user_name}%");
+    }
+
+    public function created_at_start($created_at)
+    {
+        $this->queryBuilder->where('created_at','>=',"{$created_at} 00:00:00");
+    }
+
+    public function created_at_end($created_at)
+    {
+        $this->queryBuilder->where('created_at','<=',"{$created_at} 23:59:59");
+    }
+
+    public function special($special)
+    {
+        $this->queryBuilder->where('special','like',"{$special}%");
+    }
+
+    public function afterApply()
+    {
+        if($this->userQuery)
+            $this->queryBuilder->whereIn('initiator',$this->userQuery);
+
+        if($this->materialQuery)
+            $this->queryBuilder->whereIn('material_id',$this->userQuery);
+
+    }
+
+}

+ 72 - 0
app/Filters/SupplierFilters.php

@@ -0,0 +1,72 @@
+<?php
+
+
+namespace App\Filters;
+
+use Illuminate\Http\Request;
+
+class SupplierFilters
+{
+    protected $request;
+    protected $queryBuilder;
+    protected $filters = [];
+    protected $array_filter;
+    protected $params = [
+        'name','contact_man','phone','invoice_title','bank','bank_account','opening_bank'
+    ];
+    public function __construct(Request $request)
+    {
+        $this->request = $request;
+    }
+
+    public function apply($builder)
+    {
+        $this->queryBuilder = $builder;
+        $filters = array_filter($this->request->only($this->filters));
+        foreach ($filters as $filter => $value) {
+            if (method_exists($this, $filter)) {
+                $this->$filter($value, $this->queryBuilder);
+            }
+        }
+        $this->afterApply();
+        return $this->queryBuilder;
+    }
+    private function afterApply()
+    {
+
+    }
+
+    private function name($name)
+    {
+        $this->queryBuilder->where('name','like',"{$name}%");
+    }
+
+    private function contact_man($contact_man)
+    {
+        $this->queryBuilder->where('contact_man','like',"{$contact_man}%");
+    }
+
+    private function phone($phone)
+    {
+        $this->queryBuilder->where('phone','like',"{$phone}%");
+    }
+
+    private function invoice_title($invoice_title)
+    {
+        $this->queryBuilder->where('invoice_title','like',"{$invoice_title}%");
+    }
+
+    private function bank($bank)
+    {
+        $this->queryBuilder->where('bank','like',"{$bank}%");
+    }
+    private function bank_account($bank_account)
+    {
+        $this->queryBuilder->where('bank_account','like',"{$bank_account}%");
+    }
+    private function opening_bank($opening_bank)
+    {
+        $this->queryBuilder->where('opening_bank','like',"{$opening_bank}%");
+    }
+
+}

+ 48 - 0
app/Http/Controllers/ConfigurationController.php

@@ -0,0 +1,48 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Components\AsyncResponse;
+use App\Configuration;
+use App\Filters\ConfigurationFilters;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+
+class ConfigurationController extends Controller
+{
+    use AsyncResponse;
+    public function index(Request $request,ConfigurationFilters $filters)
+    {
+        $this->gate('系统配置');
+        $configurations = Configuration::query()->orderBy('id')->filter($filters)->paginate($request['paginate'] ?? 50);
+        return view('/maintenance/configuration/index',compact('configurations'));
+    }
+
+    public function storeApi(Request $request)
+    {
+        $this->gate('系统配置-编辑');
+        $params = $request->all();
+        $params['operator'] = Auth::user()['id'];
+        $configuration = Configuration::query()->create($params);
+        if($configuration)$this->success($configuration->loadMissing('operator'));
+        $this->error('创建失败');
+    }
+
+    public function updateApi(Request $request)
+    {
+        $this->gate('系统配置-编辑');
+        $configuration = Configuration::query()->find($request['id']);
+        if(!$configuration)$this->error('更新异常');
+        $params = $request->only(['name','value','description']);
+        $params['operator'] = Auth::user()['id'];
+        $configuration->update($params);
+        $this->success($configuration->loadMissing('operator'));
+    }
+
+    public function destroyApi($id)
+    {
+        $this->gate('系统配置-删除');
+        Configuration::query()->where('id',$id)->delete();
+        $this->success();
+    }
+}

+ 1 - 4
app/Http/Controllers/CustomerBaseController.php

@@ -2,8 +2,6 @@
 
 namespace App\Http\Controllers;
 
-use App\Components\SyncResponse;
-use App\Customer;
 use App\CustomerLog;
 use App\CustomerTag;
 use App\Owner;
@@ -17,7 +15,6 @@ use Illuminate\Support\Facades\Validator;
 
 class CustomerBaseController extends Controller
 {
-    use SyncResponse;
     /**
      * Display a listing of the resource.
      *
@@ -26,7 +23,7 @@ class CustomerBaseController extends Controller
      */
     public function index(Request $request)
     {
-        $this->gate("客户-查询");
+        if(!Gate::allows("客户-查询"))return view("exception.authority");
         $customers = app('CustomerService')->paginate($request->input(),["owners.contracts.files","tags:id,name","customerLogs"=>function($query){
             /** @var Builder $query */
             $query->with(["status:id,name,created_at","user:id,name"])->orderByDesc('id');

+ 14 - 9
app/Http/Controllers/CustomerController.php

@@ -218,7 +218,7 @@ class CustomerController extends Controller
     public function projectArea(Request $request)
     {
         if(!Gate::allows('客户管理-项目-面积')){ return redirect('denied');  }
-        $areas = app('OwnerAreaReportService')->paginate($request->input(),["owner"=>function($query){$query->with(["customer","ownerStoragePriceModels"]);}]);
+        $areas = app('OwnerAreaReportService')->paginate($request->input(),["owner"=>function($query){$query->with(["customer","ownerStoragePriceModels.unit"]);}]);
         $ownerGroups = app('UserOwnerGroupService')->getSelection();
         $customers = app('CustomerService')->getSelection();
         $owners = app('OwnerService')->getIntersectPermitting();
@@ -230,13 +230,17 @@ class CustomerController extends Controller
     {
         if(!Gate::allows('客户管理-项目-面积-编辑')){ return ["success"=>false,'data'=>"无权操作!"];  }
         if (!($request->id ?? false) || !($request->area ?? false)) return ["success"=>false,'data'=>"传递错误!"];
-        $values = $request->area ?? null;
-        if (!$values)return ["success"=>true,"data"=>$values];
-        foreach ($values as $column=>$value){
-            if ($value && (!is_numeric($value) || $value<0))return ["success"=>false,'data'=>$column."非数字或小于0!"];
-        }
-        $accounting_area = ((int)$values["area_on_tray"]*2.5) + ((int)$values["area_on_half_tray"]*1.8) + ((int)$values["area_on_flat"]*1.3);
-        $values["accounting_area"] = $accounting_area;
+
+        if (!request("accounting_area")){
+            $values = $request->area ?? null;
+            if (!$values)return ["success"=>true,"data"=>$values];
+            foreach ($values as $column=>$value){
+                if ($value && (!is_numeric($value) || $value<0))return ["success"=>false,'data'=>$column."非数字或小于0!"];
+            }
+            $accounting_area = ((int)$values["area_on_tray"]*2.5) + ((int)$values["area_on_half_tray"]*1.8) + ((int)$values["area_on_flat"]*1.3);
+            $values["accounting_area"] = $accounting_area;
+        }else $values = ["accounting_area"=>request("accounting_area")];
+
         $row = app('OwnerAreaReportService')->update(["id"=>$request->id],$values);
         if ($row==1){
             LogService::log(__METHOD__,"客户管理-修改面积",json_encode($request->input()));
@@ -480,7 +484,7 @@ class CustomerController extends Controller
         $owners = $service->get(["id"=>$ids],["ownerStoragePriceModels"],false,true);
         app("OwnerAreaReportService")->notExistToInsert($owners);
 
-        $reports = OwnerAreaReport::query()
+        $reports = OwnerAreaReport::query()->with(["owner","ownerStoragePriceModel.unit"])
             ->where("counting_month",">=",date("Y-m")."-01")
             ->whereIn("owner_id",array_column($owners->toArray(),"id"))->get();
         $result = [];
@@ -497,6 +501,7 @@ class CustomerController extends Controller
                 "accountingArea" => $report->accounting_area,
                 "status" => $report->status,
                 "updatedAt" => $report->updated_at,
+                "unitName"  => $report->ownerStoragePriceModel ? ($report->ownerStoragePriceModel->unit ? $report->ownerStoragePriceModel->unit->name : '') : '',
                 "ownerStoragePriceModel"=> $report->ownerStoragePriceModel ? $report->ownerStoragePriceModel->using_type : '' ,
             ];
         }

+ 60 - 0
app/Http/Controllers/MaterialController.php

@@ -0,0 +1,60 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Components\AsyncResponse;
+use App\Exceptions\WarningException;
+use App\Filters\MaterialFilters;
+use App\Material;
+use Illuminate\Http\Request;
+
+class MaterialController extends Controller
+{
+    // 耗材类型
+    use AsyncResponse;
+    public function index(Request $request,MaterialFilters  $filter)
+    {
+        $this->gate('耗材类型');
+        $materials  = Material::query()->orderByDesc('id')->filter($filter)->paginate($request['paginate'] ?? 50);
+        return view('maintenance/material/index',compact('materials'));
+    }
+
+    public function storeApi(Request $request):array
+    {
+        $this->gate('耗材类型-编辑');
+        $material = Material::query()->where('code',$request['code'])->first();
+        if($material)return ['success' => false,'message'=>'code对应的耗材类型已存在'];
+        try {
+            $material = Material::query()->create($request->all(['code', 'name']));
+            return ['success'=>true,'data'=>$material];
+        } catch (\Exception $e) {
+            return ['success' => false,'message' => $e->getMessage()];
+        }
+    }
+
+    public function updateApi(Request $request):array
+    {
+        $this->gate('耗材类型-编辑');
+        $material = Material::query()->find($request['id']);
+        try {
+            $material->update($request->all(['code', 'name']));
+            return ['success' => true,'date'=>$material];
+        } catch (WarningException $e) {
+            return ['success'=>false,'message'=>$e->getMessage()];
+        }
+    }
+
+    public function destroyApi($id):array
+    {
+        $this->gate('耗材类型-删除');
+        /** @var Material $material */
+        $material = Material::query()->find($id);
+        try {
+            $bool = $material->delete();
+            if($bool>0)return ['success'=>true];
+            else return ['success'=>false,'message'=>'删除失败'];
+        } catch (WarningException $e) {
+            return ['success'=>false,'message'=>$e->getMessage()];
+        }
+    }
+}

+ 16 - 22
app/Http/Controllers/OrderIssueController.php

@@ -9,6 +9,7 @@ use App\OracleDOCOrderHeader;
 use App\Order;
 use App\OrderIssue;
 use App\OrderIssueProcessLog;
+use App\OrderIssueRejectedBill;
 use App\OrderIssueType;
 use App\Owner;
 use App\QualityLabel;
@@ -67,16 +68,19 @@ class OrderIssueController extends Controller
         if (!Gate::allows('订单管理-订单问题件生成')) {
             return redirect(url('/'));
         }
-        /** @var OrderIssueService $orderIssueService */
+        /**
+         * @var OrderIssueService $orderIssueService
+         * @var OrderIssue $orderIssue
+         */
         $orderIssueService = app('OrderIssueService');
         $orderIssueService->validatorCreate($request)->validate();
-        $orderIssue = null;
-        if ($request->filled('logistic_number_return')) {
-            $orderIssue = $orderIssueService->createByLogisticNumber($request->all());
-        } else {
-            $orderIssue = $orderIssueService->create($request->all());
+        $orderIssue = $orderIssueService->create($request->all());
+        if($request->has('logistic_number_return') && !OrderIssueRejectedBill::isExit($orderIssue->id,$request['logistic_number_return'])){
+            $orderIssue->joinRejectedBill($request['logistic_number_return']);
         }
-        OrderIssueProcessLog::query()->create(['order_issue_id' => $orderIssue['id'], 'user_id' => Auth::user()['id'], 'content' => '创建订单问题件', 'type' => '创建']);
+        $orderIssue->loadMissing('orderIssueRejectedBills');
+        $orderIssue->syncRejectingStatus();
+        OrderIssueProcessLog::query()->create(['order_issue_id' => $orderIssue['id'], 'user_id' => Auth::user()['id'], 'content' => $request['content'], 'type' => '创建']);
         return redirect('order/issue/index');
     }
 
@@ -305,21 +309,11 @@ class OrderIssueController extends Controller
         if (!$request->filled('logisticNumberReturn')) {
             return ['success' => false, 'fail_info' => '缺少对应的参数或条件'];
         }
-        $logisticNumberReturn = $request->input('logisticNumberReturn');
-        $rejectedBill = RejectedBill::with('items')->where('logistic_number_return', $logisticNumberReturn)->first();
-        if ($rejectedBill) {
-            $orderIssue = OrderIssue::query()->where('rejected_bill_id', $rejectedBill->id)->first();
-
-            if ($orderIssue) {
-                return ['success' => false, 'fail_info' => '该退回单号已有对应的问题件'];
-            } else {
-                $orderService = app('OrderService');
-                $order = $orderService->findOrCreteByLogisticNumberReturn($logisticNumberReturn);
-                return ['success' => true, 'order' => $order, 'rejectedBill' => $rejectedBill];
-            }
-        } else {
-            return ['success' => true, 'meg' => '没有对应的退回单号,不与WMS同步'];
-        }
+        $rejectedBill = RejectedBill::query()->with('items')->where('logistic_number_return', $request['logisticNumberReturn'])->first();
+        if(!$rejectedBill) return ['success' => true, 'message' => '没有对应的退回单号,不与WMS同步'];
+        $exists = OrderIssueRejectedBill::query()->where('logistic_number_return',$request['logisticNumberReturn'])->exists();
+        if($exists)return ['success' => false, 'fail_info' => '该退回单号已有对应的问题件'];
+        return ['success' => true, 'rejectedBill' => $rejectedBill];
     }
 
     public function isExistByOrderNoApi(Request $request){

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

@@ -5,8 +5,6 @@ namespace App\Http\Controllers;
 use App\Authority;
 use App\Components\AsyncResponse;
 use App\Events\CustomerStored;
-use App\Log;
-use App\Logistic;
 use App\Owner;
 use Exception;
 use Illuminate\Http\Request;
@@ -60,8 +58,6 @@ class OwnerController extends Controller
         $this->validatorCreate($request->all())->validate();
         $owner = new Owner($request->all());
         $owner->save();
-//        event(new CustomerStoreEvent($owner));
-        event(new CustomerStored($owner));
         $authority = new Authority([
             'name' => "_{$owner['id']}",
             'alias_name' => "(货主:{$owner['name']})",

+ 95 - 0
app/Http/Controllers/OwnerMaterialController.php

@@ -0,0 +1,95 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Components\AsyncResponse;
+use App\Exceptions\Exception;
+use App\Filters\OwnerMaterialFilters;
+use App\Material;
+use App\OwnerMaterial;
+use App\Services\OwnerService;
+use App\UploadFile;
+use Faker\Provider\Uuid;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Gate;
+use Illuminate\Support\Facades\Storage;
+
+class OwnerMaterialController extends Controller
+{
+    use AsyncResponse;
+    public function index(Request $request,OwnerMaterialFilters $filters)
+    {
+        $this->gate('项目耗材');
+        $ownerMaterials = OwnerMaterial::query()->with(['owner','material','initiator','file'])->orderByDesc('id')->filter($filters)->paginate($request['paginate'] ?? 50);
+        $owners = app(OwnerService::class)->getAuthorizedOwners();
+        $materials = Material::all();
+        return view('/maintenance/ownerMaterial/index',compact('ownerMaterials','owners','materials'));
+    }
+
+    public function storeApi(Request  $request):array
+    {
+        $this->gate('项目耗材-编辑');
+        $params = $request->all(['owner_id', 'material_id', 'material_code', 'size', 'special', 'specification']);
+        $params['initiator'] = Auth::user()['id'];
+        try {
+            $material = OwnerMaterial::query()->create($params);
+            if ($material) return ['success' => true,'data' => $material->loadMissing(['owner','material','initiator','file'])];
+            else return ['success' => false, 'message' => '添加失败'];
+        } catch (\Exception $e) {
+            return ['success' => false,'message' => $e->getMessage()];
+        }
+    }
+
+    public function updateApi(Request $request)
+    {
+        $this->gate('项目耗材-编辑');
+        $material = OwnerMaterial::query()->find($request['id']);
+        if(!$material)$this->error("对应的项目耗材没有找到");
+        $bool = $material->update($request->all(['owner_id', 'material_id', 'material_code', 'size', 'special', 'specification']));
+        if($bool==0)$this->error("更新异常");
+        $this->success($material->loadMissing(['owner','material','initiator','file']));
+    }
+
+    public function destroyApi($id)
+    {
+        $this->gate('项目耗材-删除');
+        $ownerMaterial = OwnerMaterial::query()->find($id);
+        if(!$ownerMaterial)$this->error('对应的项目耗材没有找到');
+        $ownerMaterial->delete();
+        $this->success();
+    }
+
+    public function uploadFileApi(Request $request)
+    {
+        $this->gate('项目耗材-文件上传');
+        $ownerMaterial = OwnerMaterial::query()->find($request['id']);
+        if(!$ownerMaterial)$this->error('项目耗材不存在');
+        try {
+            $file = $request->file('file');
+            if(!$file)$this->error('请选择上传文件');
+            $fileType = $file->getMimeType();// 文件类型
+            $fileName = strtolower($file->getClientOriginalExtension());// 文件名
+            $path = $file->storeAs("ownerMaterial", Uuid::uuid() . "." . $fileName);
+            $file = UploadFile::query()->create([
+                'table_name' => 'owner_material',
+                'table_id' => $ownerMaterial['id'],
+                'url' => $path,
+                'type' => $fileType,
+                "file_name" => $file->getClientOriginalName()
+            ]);
+            $ownerMaterial->loadMissing(['owner', 'material', 'initiator', 'file']);
+            $this->success($ownerMaterial);
+        } catch (Exception $e) {
+            $this->error($e->getMessage());
+        }
+    }
+
+    public function downFile(Request $request)
+    {
+        if(!Gate::allows('项目耗材'))return ['success'=>false,"data"=>"无权操作"];
+        $file = $request->input("file");
+        $name = $request->input("name");
+        return Storage::download($file,$name);
+    }
+}

+ 23 - 17
app/Http/Controllers/PriceModelController.php

@@ -267,22 +267,25 @@ class PriceModelController extends Controller
             "feature" => $request->input("feature"),
             "discount_count"    => request("discount_count"),
             "total_price"       => request("total_price"),
-            "total_discount_price"=> request("total_discount_price"),
+            "total_discount_price"=> request("total_discount_price") ?? null,
         ]);
-        //录入子表
-        $insert = [];
-        foreach ($request->input("items") as $rule){
-            $insert[] = [
-                "owner_price_operation_id" => $ownerPriceOperation->id,
-                "amount" => $rule["amount"],
-                "unit_id" => $rule["unit_id"],
-                "unit_price" => $rule["unit_price"],
-                "strategy" => $rule["strategy"],
-                "feature" => $rule["feature"],
-                "priority" => $rule["priority"],
-            ];
+        if ($request->input("items")){
+            //录入子表
+            $insert = [];
+            foreach ($request->input("items") as $rule){
+                $insert[] = [
+                    "owner_price_operation_id" => $ownerPriceOperation->id,
+                    "amount" => $rule["amount"],
+                    "unit_id" => $rule["unit_id"],
+                    "unit_price" => $rule["unit_price"],
+                    "strategy" => $rule["strategy"],
+                    "feature" => $rule["feature"],
+                    "priority" => $rule["priority"],
+                    "discount_price" => $rule["discount_price"] ?? null,
+                ];
+            }
+            $service->insertItem($insert);
         }
-        $service->insertItem($insert);
         //录入中间表
         /** @var OwnerPriceOperation $ownerPriceOperation */
         if ($request->input("owner_id"))$ownerPriceOperation->ownerPriceOperationOwners()->sync($request->input("owner_id"));
@@ -317,7 +320,7 @@ class PriceModelController extends Controller
             "feature" => $request->input("feature"),
             "discount_count"    => request("discount_count"),
             "total_price"       => request("total_price"),
-            "total_discount_price"=> request("total_discount_price"),
+            "total_discount_price"=> request("total_discount_price") ?? null,
         ]);
         $service->destroyItem($id);
         //录入子表
@@ -331,6 +334,7 @@ class PriceModelController extends Controller
                 "strategy" => $rule["strategy"],
                 "feature" => $rule["feature"],
                 "priority" => $rule["priority"],
+                "discount_price" => $rule["discount_price"] ?? null,
             ];
         }
         $service->insertItem($insert);
@@ -1061,7 +1065,7 @@ class PriceModelController extends Controller
             $model = app('OwnerPriceOperationService')->find(request("id"),["items"]);
             app('OwnerPriceOperationService')->findUpdate($model,$operation);
             $delete = [];//需要删除子项
-            $update = [["id","strategy","amount","unit_id","unit_price","feature"]];//需要更新子项
+            $update = [["id","strategy","amount","unit_id","unit_price","feature","discount_price"]];//需要更新子项
             $insert = [];//需要新增子项
             foreach ($params["items"] as $item){
                 $obj = [
@@ -1069,7 +1073,8 @@ class PriceModelController extends Controller
                     "amount"    => $item["amount"],
                     "unit_id"   => $item["unit_id"],
                     "unit_price"=> $item["unit_price"],
-                    "feature"   => $item["feature"],
+                    "feature"   => $item["feature"] ?? null,
+                    "discount_price"   => $item["discount_price"] ?? null,
                 ];
                 if (isset($item["id"])){
                     $obj["id"] = $item["id"];
@@ -1389,6 +1394,7 @@ class PriceModelController extends Controller
                     "amount" => $item["amount"],
                     "unit_id" => $item["unit_id"],
                     "unit_price" => $item["unit_price"],
+                    "discount_price" => $item["discount_price"] ?? null,
                     "feature" => $item["feature"],
                     "featureFormat" => $item->featureFormat,
                 ];

+ 43 - 0
app/Http/Controllers/SupplierController.php

@@ -0,0 +1,43 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Components\AsyncResponse;
+use App\Filters\SupplierFilters;
+use App\Supplier;
+use Illuminate\Http\Request;
+
+class SupplierController extends Controller
+{
+    use AsyncResponse;
+    public function index(Request $request,SupplierFilters $filters)
+    {
+        $this->gate('供应商');
+        $suppliers = Supplier::query()->orderByDesc('id')->filter($filters)->paginate($request['paginate']??50);
+        return view('/maintenance/supplier/index',compact('suppliers'));
+    }
+
+    public function storeApi(Request $request)
+    {
+        $this->gate('供应商-编辑');
+        $supplier = Supplier::query()->create($request->all());
+        $this->success($supplier);
+    }
+
+    public function updateApi(Request $request)
+    {
+        $this->gate('供应商-编辑');
+        $supplier = Supplier::query()->find($request['id']);
+        $bool= $supplier->update($request->only(['name','contact_man','phone','invoice_title','bank','bank_account','opening_bank']));
+        if($bool)$this->success($supplier);
+        $this->error('更新异常');
+    }
+
+    public function destroyApi($id)
+    {
+        $this->gate('供应商-删除');
+        $supplier = Supplier::query()->find($id);
+        $supplier->delete();
+        $this->success();
+    }
+}

+ 28 - 61
app/Http/Controllers/TestController.php

@@ -19,6 +19,7 @@ use App\Console\Commands\WasSyncWmsAsnInformation;
 use App\Exceptions\ErrorException;
 use App\Events\CancelOrder;
 use App\Events\SendEmailEvent;
+use App\Exceptions\Exception;
 use App\Http\Requests\ForeignHaiRobotic_taskUpdateRequest;
 use App\Http\Requests\TestAaRequest;
 use App\Imports\OrderTrackingImport;
@@ -134,52 +135,7 @@ class TestController extends Controller
     }
 
     public function zzd(){
-        dd(substr("2021-01-28",0,7) == date("Y-m"));
-    }
-
-
-    public function orderFreeze()
-    {
-        $freezeOrders = [];
-        $orders = Order::query()->whereBetween("updated_at",["2021-01-29 09:00:00","2021-01-29 14:00:00"])
-        ->get()->toArray();
-        foreach ($orders as $param){
-            if ($this->isFreeze($param))$freezeOrders[] = $param["code"];
-        }
-        $this->pushWMS($freezeOrders);
-    }
-
-    private function isFreeze($param)
-    {
-        $status = ['分配完成','创建订单','拣货完成','播种完成'];
-        if (array_search($param["wms_status"],$status)===false)return false;
-
-        $service = new OrderFreezeService();
-        $pools = $service->getFreezes();
-        foreach ($pools as $pool){
-            if ($pool["thawed_at"] && Carbon::parse($pool["thawed_at"])->lte(Carbon::today()))continue;
-            if ($pool["logistic_id"]!=$param["logistic_id"])continue;
-            if ($pool["province_name"] && (mb_strpos($param["province"],$pool["province_name"]) === false))continue;
-            if ($pool["city_name"] && (mb_strpos($param["city"],$pool["city_name"]) === false))continue;
-            if ($pool["district_name"] && (mb_strpos($param["district"],$pool["district_name"]) === false))continue;
-            if ($pool["town_name"] && (mb_strpos($param["address"],$pool["town_name"]) === false))continue;
-            if ($pool["street_name"] && (mb_strpos($param["address"],$pool["street_name"]) === false))continue;
-            return true;
-        }
-        return false;
-    }
-
-    private function pushWMS($freezeOrders)
-    {
-        if (!$freezeOrders)return;
-        $where = "''";
-        foreach ($freezeOrders as $f)$where .= ",'{$f}'";
-        $edit = date("Y-m-d H:i:s");
-        $sql = <<<sql
-UPDATE DOC_ORDER_HEADER SET edittime = TO_DATE('{$edit}','yyyy-mm-dd hh24:mi:ss'),releasestatus = 'H',waveno='*',notes = CASE WHEN notes IS NULL THEN '停运' ELSE  notes||',停运' END where ORDERNO in ({$where})
-sql;
-        DB::connection("oracle")->update($sql);
-        LogService::log(__METHOD__,"订单同步-自动冻结",$sql);
+        return app("OrderService")->freezeRemoveWave("'','SO190628000688'",true);
     }
 
     public function syncWeight()
@@ -1125,6 +1081,7 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
 
     public function testSyncOrderTask()
     {
+        Cache::flush();
         dump('hendle...');
         dump((string)Carbon::now());
         dump(memory_get_usage() / 1024 / 1024);
@@ -1537,21 +1494,19 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
             });
     }
 
-//    public function testNumber()
-//    {
-//        $asnnos=['ASN2101200684','ASN2101220543','ASN2101220542'];
-//        $asnHeaders=OracleDOCASNHeader::query()->whereIn('asnno',$asnnos)->get();
-//        /**
-//         * @var RejectedBillService $rejectedBillService
-//         */
-//        $rejectedBillService=app(RejectedBillService::class);
-//
-//        $updates = $rejectedBillService->getNeedUpdateCheckedStatusByWms($asnHeaders);
-//        app(BatchUpdateService::class)->batchUpdate('rejected_bills', $updates);
-//        dump($updates);
-//        //$logisticNumberReturn = $rejectedBillService->getLogisticNumberReturn($arr);
-//        //$rejectedBills = $rejectedBillService->getRejectedBills($logisticNumberReturn);
-//    }
+    public function testCarbon()
+    {
+        $month_begin = date('Y-m-01 00:00:00');
+        dump($month_begin);
+        dd(Carbon::parse($month_begin)->isAfter(Carbon::parse('2020-12-01 00:00:00')));
+    }
+
+    public function testGet()
+    {
+        $service = new OrderService();
+        $count = $service->getCurrentFinishedOrders_byOwnerId(7);
+        dd($count);
+    }
 
     public function updateRejectBillCheckedStatus()
     {
@@ -1568,4 +1523,16 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
         app(BatchUpdateService::class)->batchUpdate('rejected_bills', $updates);
         }
     }
+
+    public function clearCancelledOrder()
+    {
+        $wave_nos = ['W210129000248','W210202000216','W210202000251','W210202000216','W210202000282'];
+        $order_nos = ['SO210129004112' , 'SO210202003333','SO210202003333','SO210202003236','SO210202003247','SO210202003719'];
+        try {
+            OracleDOCWaveDetails::query()->whereIn('WaveNo',$wave_nos)->whereIn('OrderNo', $order_nos)->delete();
+            app('LogService')->log(__CLASS__, __METHOD__, 'Delete OracleDOCWaveDetails' . '  ' . json_encode($order_nos).json_encode($wave_nos));
+        } catch (Exception $e) {
+            app('LogService')->log(__CLASS__, __METHOD__,'Error clearCancelledOrder'.json_encode($order_nos).json_encode($wave_nos));
+        }
+    }
 }

+ 15 - 4
app/Http/Controllers/WaybillController.php

@@ -33,6 +33,7 @@ use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Gate;
 use Illuminate\Support\Facades\Http;
+use Illuminate\Support\Facades\Storage;
 use Illuminate\Support\Facades\Validator;
 use Intervention\Image\Facades\Image;
 use Ramsey\Uuid\Uuid;
@@ -529,19 +530,24 @@ class WaybillController extends Controller
     public function batchUploadImages()
     {
         $this->gate("运输管理-图片上传");
+        ini_set('max_execution_time',1000);
+        ini_set('memory_limit','100M');
         $images = request("images");
         $errors = [];
         $number = [];
         $mapping = [];
         $type = ["jpg","png","gif","jfif","pjpeg","jpeg","webp"];
         foreach ($images as $index => $image){
-            $suffix = $image->getClientOriginalExtension();
-            $name = $image->getClientOriginalName();
+            $arr = explode(".",$image["name"]);
+            $suffix = $arr[count($arr)-1];
+            unset($arr[count($arr)-1]);
+            $name = implode(".",$arr);
             if (array_search(strtolower($suffix),$type) === false){
                 $errors[] = "“".$name."”格式错误";
                 unset($images[$index]);
                 continue;
             }
+            $images[$index]["suffix"] = $suffix;
             $num = trim(rtrim($name,".".$suffix));
             $number[] = $num;
             $mapping[$num] = $index;
@@ -555,11 +561,16 @@ class WaybillController extends Controller
         foreach ($waybills as $waybill){
             $image = $images[$mapping[$waybill->source_bill]];
             $fileName = date('ymd').'-'.Uuid::uuid1();
-            $suffix = $image->getClientOriginalExtension();
+            $suffix = $image["suffix"];
+
             $thumbnailName=storage_path('app/public/files/'.$fileName.'-thumbnail.'.$suffix);
             $commonName=storage_path('app/public/files/'.$fileName.'-common.'.$suffix);
             $bulkyName=storage_path('app/public/files/'.$fileName.'-bulky.'.$suffix);
-            move_uploaded_file ($image->getRealPath() ,$bulkyName);
+
+            preg_match('/^(data:\s*image\/(\w+);base64,)/',$image["src"],$res);
+            $base64_img=base64_decode(str_replace($res[1],'', $image["src"]));
+            Storage::put('public/files/'.$fileName.'-bulky.'.$suffix,$base64_img);
+
             $img=Image::make($bulkyName);
             if ($img->height() > $img->width())
                 $img->heighten(250)->save($commonName);

+ 4 - 4
app/Http/Controllers/WeighController.php

@@ -103,9 +103,9 @@ class WeighController extends Controller
             if(!$package->paper_box_id)$package->paper_box_id=$paper_box_id;
             $result=$accomplishToWMS->accomplishToWMS($package);
             if ($result['result']){
-                $package->status="已上传";
+                $package->uploaded_to_wms="是";
             }else{
-                $package->status="上传异常";
+                $package->uploaded_to_wms="异常";
             }
             $package->save();
             app('LogService')->log(__METHOD__,'create_'.__FUNCTION__,json_encode($package),Auth::user()['name']);
@@ -117,7 +117,7 @@ class WeighController extends Controller
             $package = app('OrderPackageService')->firstOrCreate($logistic_number,[
                 'weight'=>$weight,
                 'weighed_at'=>Carbon::now(),
-                'status'=>"已上传",
+                'uploaded_to_wms'=>"是",
             ]);
             $package->fetchAllFromOracle();
             $result=$accomplishToWMS->accomplishToWMS($package);
@@ -125,7 +125,7 @@ class WeighController extends Controller
             $str .= $package['logistic_number']?"快递单号:{$package['logistic_number']}":'';
             $str .= $order_code?", 订单号:{$order_code}":'';
             if(!$result||$result['result']=='false'){
-                $package['status'] = '上传失败';
+                $package['uploaded_to_wms'] = '异常';
                 $str = "录入包裹失败!";
                 $str .= $package['logistic_number']?"快递单号:{$package['logistic_number']}":'';
                 $str .= $order_code?", 订单号:{$order_code}":'';

+ 4 - 4
app/Http/Controllers/api/thirdPart/goodscan/PackageController.php

@@ -152,18 +152,18 @@ class PackageController
             OrderPackage::query()->where('batch_number',$orderPackage['batch_number'])->update($params);
             $result=$fluxController->markWMSOnBatch($orderPackage['batch_number'], $orderPackage['weight']);
             if(!$result['result']){
-                $orderPackage->status="上传异常";
+                $orderPackage->uploaded_to_wms="异常";
             }
         }else{
             app('LogService')->log(__METHOD__,__FUNCTION__,"GoodScan 写入包裹至WMS:".json_encode($orderPackage),null);
             try{
                 $result=$fluxController->accomplishToWMS($orderPackage);
                 if ($result['result'])
-                    $orderPackage->status="已上传";
+                    $orderPackage->uploaded_to_wms="是";
                 else
-                    $orderPackage->status="上传异常";
+                    $orderPackage->uploaded_to_wms="异常";
             }catch (\Exception $e){
-                $orderPackage->status="未上传";
+                $orderPackage->uploaded_to_wms="否";
             }
         }
         $response=$this->saveOrderPackage($orderPackage);

+ 6 - 4
app/Http/Controllers/api/thirdPart/weight/PackageController.php

@@ -6,6 +6,7 @@ use App\Events\WeighedEvent;
 use App\Http\Controllers\Controller;
 use App\Http\Controllers\LogisticNumberFeatureController;
 use App\Jobs\FetchPackageFromOracle;
+use App\Jobs\WeightUpdateInstantBill;
 use App\MeasuringMachine;
 use App\Order;
 use App\OrderPackage;
@@ -203,19 +204,19 @@ class PackageController extends Controller
                 $package->unifyThisMeasureUnderSameBatch();
                 $result=$fluxController->markWMSOnBatch($package['batch_number'], $request['weight']);
                 if(!$result['result']){
-                    $package->status="上传异常";
+                    $package->uploaded_to_wms="异常";
                 }
             }else{
                 app('LogService')->log(__METHOD__,__FUNCTION__,"写入包裹至WMS:".json_encode($package),null);
                 try{
                     $result=$fluxController->accomplishToWMS($package);
                     if ($result['result']){
-                        $package->status="已上传";
+                        $package->uploaded_to_wms="是";
                     }else{
-                        $package->status="上传异常";
+                        $package->uploaded_to_wms="异常";
                     }
                 }catch (\Exception $e){
-                    $package->status="未上传";
+                    $package->uploaded_to_wms="否";
                 }
             }
             try{
@@ -298,6 +299,7 @@ class PackageController extends Controller
         if(!empty($package->order))
             Waybill::setWeightByOrderCode($package->order->code,$package->weight);
         event(new WeighedEvent($package));
+        dispatch(new WeightUpdateInstantBill($package));
         $response=["msg"=>"保存成功",
             "code"=>200,
             "data"=>true,

+ 1 - 0
app/Jobs/OrderFreeze.php

@@ -82,6 +82,7 @@ class OrderFreeze implements ShouldQueue
         if (!$freezeOrders)return;
         $where = "''";
         foreach ($freezeOrders as $f)$where .= ",'{$f}'";
+        app("OrderService")->freezeRemoveWave($where,true);
         $edit = date("Y-m-d H:i:s");
         $sql = <<<sql
 UPDATE DOC_ORDER_HEADER SET edittime = TO_DATE('{$edit}','yyyy-mm-dd hh24:mi:ss'),releasestatus = 'H',waveno='*',notes = CASE WHEN notes IS NULL THEN '停运' ELSE  notes||',停运' END where ORDERNO in ({$where})

+ 45 - 0
app/Jobs/WeightUpdateInstantBill.php

@@ -0,0 +1,45 @@
+<?php
+
+namespace App\Jobs;
+
+use App\OrderPackage;
+use App\Services\OrderService;
+use Illuminate\Bus\Queueable;
+use Illuminate\Contracts\Queue\ShouldQueue;
+use Illuminate\Foundation\Bus\Dispatchable;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
+
+class WeightUpdateInstantBill implements ShouldQueue
+{
+    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
+
+    /** @var \stdClass  */
+    protected $package;
+    /**
+     * Create a new job instance.
+     *
+     * @param OrderPackage $package
+     *
+     * @return void
+     */
+    public function __construct(OrderPackage $package)
+    {
+        $this->package = $package;
+    }
+
+    /**
+     * Execute the job.
+     *
+     * @param OrderService $service
+     *
+     * @return void
+     */
+    public function handle(OrderService $service)
+    {
+        if (!$this->package->weight)return;
+        $this->package->loadMissing("order");
+        if (!$this->package->order)return;
+        $service->reviseLogisticFee($this->package->order);
+    }
+}

+ 0 - 38
app/Listeners/FulfillFulfillPackageCustomer.php

@@ -1,38 +0,0 @@
-<?php
-
-namespace App\Listeners;
-
-use App\Events\CustomerStored;
-use App\OrderPackage;
-
-class FulfillPackageCustomer
-{
-    /**
-     * Create the event listener.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        //
-    }
-
-    /**
-     * Handle the event.
-     *
-     * @param  CustomerStored  $event
-     * @return bool
-     */
-    public function handle(CustomerStored $event)
-    {
-        $packages=OrderPackage::with('WMSReflectPackage')->where('status','记录异常')->orWhere('status','已上传异常')->get();
-        foreach ($packages as $package){
-            if (isset($package->WMSReflectPackage->Customer)&&$package->WMSReflectPackage->Customer==$event->owner->code){
-                $package->status="未测量";
-                $package->owner_id=$event->owner->id;
-                $package->save();
-            }
-        }
-        return false;
-    }
-}

+ 20 - 0
app/Material.php

@@ -0,0 +1,20 @@
+<?php
+
+namespace App;
+
+use App\Filters\MaterialFilters;
+use Illuminate\Database\Eloquent\Model;
+
+use App\Traits\ModelLogChanging;
+
+class Material extends Model
+{
+    use ModelLogChanging;
+
+    protected $fillable = ['name','code'];
+
+    public function scopeFilter($query, $filters)
+    {
+        return $filters->apply($query);
+    }
+}

+ 3 - 3
app/OrderPackage.php

@@ -23,7 +23,7 @@ class OrderPackage extends Model
     use ModelTimeFormat;
 
     protected $fillable = ['order_id','logistic_number','batch_number',
-        'batch_rule','bulk','weight','length','width','height','paper_box_id','measuring_machine_id','weighed_at','status','sent_at','received_at','exception','transfer_status','remark','owner_id'];
+        'batch_rule','bulk','weight','length','width','height','paper_box_id','measuring_machine_id','weighed_at','status','sent_at','received_at','exception','transfer_status','remark','owner_id','uploaded_to_wms'];
 
     public function order(){
         return $this->belongsTo('App\Order','order_id','id');
@@ -132,7 +132,7 @@ class OrderPackage extends Model
                 'logistic_number'=>$resultOracleObj['soreference5']??'',
                 'weight'=>$weight,
                 'weighed_at'=> $now,
-                'status'=>"已上传",
+                'uploaded_to_wms'=>"是",
                 "created_at"=>$now,
             ]);
         }
@@ -149,7 +149,7 @@ class OrderPackage extends Model
             'batch_number'=>$batchCode??'',
             'weight'=>$weight,
             'weighed_at'=> $now,
-            'status'=>"已上传",]);
+            'uploaded_to_wms'=>"是",]);
         $newPackages=$packages;
         if($existingOrderPackages->isNotEmpty())
             $newPackages=array_filter($packages,function ($package)use($existingLogisticNumbers){

+ 43 - 0
app/OwnerMaterial.php

@@ -0,0 +1,43 @@
+<?php
+
+namespace App;
+
+use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\Model;
+
+use App\Traits\ModelLogChanging;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
+use Illuminate\Database\Eloquent\Relations\HasOne;
+
+class OwnerMaterial extends Model
+{
+    use ModelLogChanging;
+    use ModelTimeFormat;
+    protected $table = 'owner_material';
+    protected $fillable = ['owner_id','material_id','material_code','size','special','specification','initiator'];
+
+    public function owner():BelongsTo
+    {
+        return $this->belongsTo(Owner::class);
+    }
+
+    public function material():BelongsTo
+    {
+        return $this->belongsTo(Material::class);
+    }
+
+    public function initiator():BelongsTo
+    {
+        return $this->belongsTo(User::class,'initiator','id');
+    }
+
+    public function file():HasOne
+    {
+        return $this->hasOne(UploadFile::class,'table_id','id')->where('table_name','owner_material');
+    }
+
+    public function scopeFilter($query,$filters)
+    {
+        return $filters->apply($query);
+    }
+}

+ 2 - 0
app/Providers/AppServiceProvider.php

@@ -59,6 +59,7 @@ use App\Services\ProcessesContentService;
 use App\Services\ProcessMethodService;
 use App\Services\ProcessService;
 use App\Services\ProcessStatisticService;
+use App\Services\ProvinceService;
 use App\Services\RealtimePendingOrdersService;
 use App\Services\RejectedBillItemService;
 use App\Services\RejectedBillService;
@@ -198,6 +199,7 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('ProcessService',ProcessService::class);
         app()->singleton('ProcessStatisticService',ProcessStatisticService::class);
         app()->singleton('ProcessesContentService',ProcessesContentService::class);
+        app()->singleton('ProvinceService',ProvinceService::class);
         app()->singleton('RealtimePendingOrdersService',RealtimePendingOrdersService::class);
         app()->singleton('RegionService',RegionService::class);
         app()->singleton('RejectedBillItemService',RejectedBillItemService::class);

+ 0 - 3
app/Providers/EventServiceProvider.php

@@ -26,9 +26,6 @@ class EventServiceProvider extends ServiceProvider
         'App\Events\InformWMSReceivedEvent' => [
             'App\Listeners\InformWMSReceivedListener',
         ],
-        'App\Events\CustomerStored' =>[
-            'App\Listeners\FulfillPackageCustomer'
-        ],
         'App\Events\ResetProcessStatisticStartDateEvent' =>[
             'App\Listeners\ResetProcessStatisticStartDateListener'
         ],

+ 31 - 25
app/Services/BatchService.php

@@ -7,6 +7,7 @@ use App\OracleActAllocationDetails;
 use App\Order;
 use App\OrderCommodity;
 use App\Owner;
+use ErrorException;
 use Exception;
 use Illuminate\Support\Collection;
 use Illuminate\Support\Facades\Http;
@@ -59,32 +60,37 @@ class BatchService
      */
     public function assignTasks(Collection $batches)
     {
+        try{
+
 //        $this->directTemp($batches);
-//        LogService::log(__CLASS__,__FUNCTION__,'1');
-        $this->instant($this->stationTaskBatchService,'StationTaskBatchService');
-        $this->instant($this->stationRuleBatchService,'StationRuleBatchService');
-        $this->instant($this->stationTaskService,'StationTaskService');
-        $this->instant($this->stationTaskCommodityService,'StationTaskCommodityService');
-        $this->instant($this->stationTaskMaterialBoxService,'StationTaskMaterialBoxService');
-
-//        LogService::log(__CLASS__,__FUNCTION__,'2'.$batches->toJson());
-
-        $batches_shouldProcess = $this->stationRuleBatchService->getBatches_shouldProcess($batches); //按规则过滤需要的波次
-//        LogService::log(__CLASS__,__FUNCTION__,'3 $batches_shouldProcess:'.$batches_shouldProcess->toJson());
-        if($batches_shouldProcess->isEmpty()) return;
-
-//        LogService::log(__CLASS__,__FUNCTION__,'4');
-        $stationTasks =  $this->stationTaskService->create($batches_shouldProcess->count()); //生成总任务
-//        LogService::log(__CLASS__,__FUNCTION__,'5'.$stationTasks->toJson());
-        $stationTaskBatches=$this->stationTaskBatchService->createByBatches($batches_shouldProcess,$stationTasks); //注册波次任务
-//        LogService::log(__CLASS__,__FUNCTION__,'6'.$stationTaskBatches->toJson());
-        $stationTaskCommodities=$this->stationTaskCommodityService->createByBatches($batches_shouldProcess,$stationTasks); //注册商品任务
-//        LogService::log(__CLASS__,__FUNCTION__,'7'.$stationTaskCommodities->toJson());
-        $stationTaskMaterialBoxes=$this->stationTaskMaterialBoxService->createByBatches($batches_shouldProcess,$stationTasks); //注册料箱任务
-//        LogService::log(__CLASS__,__FUNCTION__,'8'.$stationTaskMaterialBoxes->toJson());
-
-        $ran=$this->stationTaskBatchService->runMany($stationTaskBatches);//执行波次任务
-//        LogService::log(__CLASS__,__FUNCTION__,'10'.json_encode([$ran]));
+            LogService::log(__CLASS__,__FUNCTION__,'1');
+            $this->instant($this->stationTaskBatchService,'StationTaskBatchService');
+            $this->instant($this->stationRuleBatchService,'StationRuleBatchService');
+            $this->instant($this->stationTaskService,'StationTaskService');
+            $this->instant($this->stationTaskCommodityService,'StationTaskCommodityService');
+            $this->instant($this->stationTaskMaterialBoxService,'StationTaskMaterialBoxService');
+
+            LogService::log(__CLASS__,__FUNCTION__,'2'.$batches->toJson());
+
+            $batches_shouldProcess = $this->stationRuleBatchService->getBatches_shouldProcess($batches); //按规则过滤需要的波次
+            LogService::log(__CLASS__,__FUNCTION__,'3 $batches_shouldProcess:'.$batches_shouldProcess->toJson());
+            if($batches_shouldProcess->isEmpty()) return;
+
+            LogService::log(__CLASS__,__FUNCTION__,'4');
+            $stationTasks =  $this->stationTaskService->create($batches_shouldProcess->count()); //生成总任务
+            LogService::log(__CLASS__,__FUNCTION__,'5'.$stationTasks->toJson());
+            $stationTaskBatches=$this->stationTaskBatchService->createByBatches($batches_shouldProcess,$stationTasks); //注册波次任务
+            LogService::log(__CLASS__,__FUNCTION__,'6'.$stationTaskBatches->toJson());
+            $stationTaskCommodities=$this->stationTaskCommodityService->createByBatches($batches_shouldProcess,$stationTasks); //注册商品任务
+            LogService::log(__CLASS__,__FUNCTION__,'7'.$stationTaskCommodities->toJson());
+            $stationTaskMaterialBoxes=$this->stationTaskMaterialBoxService->createByBatches($batches_shouldProcess,$stationTasks); //注册料箱任务
+            LogService::log(__CLASS__,__FUNCTION__,'8'.$stationTaskMaterialBoxes->toJson());
+
+            $ran=$this->stationTaskBatchService->runMany($stationTaskBatches);//执行波次任务
+            LogService::log(__CLASS__,__FUNCTION__,'10'.json_encode([$ran]));
+        }catch(Exception $e){
+            throw new ErrorException('注册任务失败: '.json_encode($batches). $e->getMessage());
+        }
     }
 
 //    public function directTemp($batches){

+ 1 - 1
app/Services/ForeignHaiRoboticsService.php

@@ -18,7 +18,7 @@ use App\Traits\ServiceAppAop;
 class ForeignHaiRoboticsService
 {
     use ServiceAppAop;
-    protected $modelClass=ForeignHaiRobotics::class;
+//    protected $modelClass=ForeignHaiRobotics::class;
 
     /** @var  $stationTaskMaterialBoxService StationTaskMaterialBoxService */
     private $stationTaskMaterialBoxService;

+ 14 - 0
app/Services/MaterialService.php

@@ -0,0 +1,14 @@
+<?php
+
+namespace App\Services;
+
+use App\Material;
+use App\Traits\ServiceAppAop;
+
+class MaterialService
+{
+    use ServiceAppAop;
+    protected $modelClass = Material::class;
+
+
+}

+ 7 - 6
app/Services/OracleDocWaveDetailService.php

@@ -2,6 +2,7 @@
 
 namespace App\Services;
 
+use App\Exceptions\Exception;
 use App\OracleDOCOrderHeader;
 use App\OracleDOCWaveDetails;
 use App\Order;
@@ -14,19 +15,19 @@ use App\Traits\ServiceAppAop;
 class OracleDocWaveDetailService
 {
     use ServiceAppAop;
-    protected $modelClass=OracleDocWaveDetail::class;
+    protected $modelClass=OracleDOCWaveDetails::class;
     public function clearCancelledOrder($orderHeaders)
     {
         if (!$orderHeaders) return;
         $orderHeader_arr = $orderHeaders->chunk(300);
         $orderHeader_arr->each(function ($items){
             $clearOrderNos = data_get($items, '*.orderno');
-            $ownerNos = array_diff(data_get($items, '*.waveno'),['*']) ;
+            $waveNos = array_values(array_diff(data_get($items, '*.waveno'),['*']));
             try {
-                OracleDOCWaveDetails::query()->whereIn('OrderNo', $clearOrderNos)->whereIn('OwnerNo', $ownerNos)->delete();
-                app('LogService')->log(__CLASS__, __METHOD__, 'Delete OracleDOCWaveDetails' . '  ' . json_encode($clearOrderNos) );
-            } catch (\Exception $e) {
-                app('LogService')->log(__CLASS__, __METHOD__,'Error clearCancelledOrder'.json_encode($clearOrderNos).json_encode($ownerNos));
+                OracleDOCWaveDetails::query()->whereIn('OrderNo', $clearOrderNos)->whereIn('WaveNo', $waveNos)->delete();
+                app('LogService')->log(__CLASS__, __METHOD__, 'Delete OracleDOCWaveDetails' . '  ' . json_encode($clearOrderNos).json_encode($waveNos));
+            } catch (Exception $e) {
+                app('LogService')->log(__CLASS__, __METHOD__,'Error clearCancelledOrder'.json_encode($clearOrderNos).json_encode($waveNos));
             }
         });
     }

+ 1 - 1
app/Services/OrderPackageService.php

@@ -55,7 +55,7 @@ class OrderPackageService
     {
         return OrderPackage::query()->select('id', 'logistic_number', 'created_at', 'batch_number', 'batch_rule')
             ->where('status', '下发异常')->orWhere('status', '记录异常')
-            ->orWhere('status', '已上传异常')->orderBy('created_at', 'DESC')
+            ->orWhere('uploaded_to_wms', '异常')->orderBy('created_at', 'DESC')
             ->paginate($paginate);
     }
 

+ 131 - 7
app/Services/OrderService.php

@@ -4,6 +4,7 @@ namespace App\Services;
 
 use App\Jobs\OrderCreateInstantBill;
 use App\Jobs\OrderFreeze;
+use App\Log;
 use App\Logistic;
 use App\OracleActAllocationDetails;
 use App\OracleDOCASNHeader;
@@ -12,6 +13,7 @@ use App\Order;
 use App\OrderIssue;
 use App\Owner;
 use App\OwnerFeeDetail;
+use App\Province;
 use App\RejectedBill;
 use App\Services\common\BatchUpdateService;
 use App\Services\common\DataHandlerService;
@@ -594,7 +596,7 @@ class OrderService
     }
 
     public function pushQueue($orderHeaders){
-        $orders = Order::query()->with(["logistic","packages.commodities.commodity"])->where('wms_status','订单完成')->whereIn('code',data_get($orderHeaders,'*.code'))->get();
+        $orders = Order::query()->with(["logistic","packages.commodities.commodity"])->where('wms_status','订单完成')->whereIn('code',data_get($orderHeaders,'*.orderno'))->get();
         $orders->each(function($order){
             dispatch(new OrderCreateInstantBill($order));
         });
@@ -645,8 +647,9 @@ class OrderService
 
         unset($owners,$logistics,$shops,$warehouses,$batches);
         // 转换插入 3s
+        $this->pushOrderCreatedCountCache($created_params);
         if(count($created_params) > 0){
-            collect($created_params)->chunk(3500)->each(function($inner_params){
+            collect($created_params)->chunk(1000)->each(function($inner_params){
                 $arr = $inner_params->toArray();
                 $this->insert($arr);
                 dispatch(new OrderFreeze($arr));
@@ -661,6 +664,7 @@ class OrderService
         });
         unset($update_order);
         if(count($update_params)==0)return;
+        $this->pushOrderUpdatedCountCache($orders,$update_params);
         $this->batchUpdate($update_params);
         dispatch(new OrderFreeze($update_params));
         unset($update_params);
@@ -1031,16 +1035,15 @@ class OrderService
             $commodities = array_merge($commodities,$package->commodities->toArray());
 
             if ($logistic_fee!==null){
-                $provinceName = $order->province;
+                $provinceName = mb_substr($order->province,0,2);
                 $province = app(CacheService::class)->getOrExecute("province_".$provinceName,function ()use($provinceName){
-                    return app("ProvinceService")->first(["name"=>$provinceName]);
-                },60);
+                    return Province::query()->where("name","like",$provinceName."%")->first();
+                },86400);
                 if (!$province)$logistic_fee = null;
 
                 $fee = $service->matching($package->weight, $order->owner_id, $order->logistic_id, $province->id);
                 if ($fee<0)$logistic_fee = null;
-
-                $logistic_fee += $fee;
+                else $logistic_fee += $fee;
             }
         }
         if ($logistic_fee!==null && $logistic_fee<0)$logistic_fee = null;
@@ -1088,4 +1091,125 @@ class OrderService
         return $count->c;
     }
 
+    public function pushOrderUpdatedCountCache($orders,$update_params)
+    {
+        /** @var DataHandlerService $dataHandlerService */
+        $dataHandlerService =  app(DataHandlerService::class);
+        $order_map = $dataHandlerService->dataHeader(['code'],$orders);
+        $owner_map = [];
+        $month_begin =date('Y-m-01 00:00:00');
+        foreach ($update_params as $update_param) {
+            if(!($update_param['wms_status'] ?? false) || $update_param['wms_status']!='订单完成')continue;
+            $wms_EditTime = \Illuminate\Support\Carbon::parse($update_param['wms_edittime']);
+            if($wms_EditTime->isBefore($month_begin))continue;
+            $owner_id = $update_param['owner_id'] ?? false;
+            if(!$owner_id)continue;
+            $order = $dataHandlerService->getKeyValue(['code'=>$update_param['code']],$order_map);
+            if(!$order)continue;
+            if($order['wms_status'] ==='订单完成')continue;
+            if(!array_key_exists($owner_id,$owner_map))$owner_map[$owner_id]=1;
+            else $owner_map[$owner_id]+=1;
+        }
+        foreach ($owner_map as $owner_id=>$count) {
+            $this->setCurrentFinishedOrders_byOwnerId($owner_id,$count);
+        }
+    }
+
+    public function pushOrderCreatedCountCache($created_params)
+    {
+        $owner_map=[];
+        $month_begin =date('Y-m-01 00:00:00');
+        foreach ($created_params as $created_param) {
+            $owner_id = $created_param['owner_id'] ?? false;
+            $wms_EditTime = \Illuminate\Support\Carbon::parse($created_param['wms_edittime']);
+            if($wms_EditTime->isBefore($month_begin))continue;
+            if(!$owner_id)continue;
+            if($created_param['wms_status']!=='订单完成')continue;
+            if(!array_key_exists($owner_id,$owner_map)) $owner_map[$owner_id]=1;
+            else  $owner_map[$owner_id]+=1;
+        }
+        foreach ($owner_map as $owner_id=>$count) {
+            $this->setCurrentFinishedOrders_byOwnerId($owner_id,$count);
+        }
+    }
+
+    private function setCurrentFinishedOrders_byOwnerId($id,$count,$cancelCount = 0)
+    {
+        $sum = Cache::get("order_count_ownerId_{$id}",function()use($id){
+            return Order::query()
+                ->where('owner_id',$id)
+                ->where('wms_status','订单完成')
+                ->where('wms_edittime','>=',date('Y-m-01 00:00:00'))->count();
+        });
+        $sum += $count;
+        $sum -= $cancelCount;
+        Cache::put("order_count_ownerId_{$id}",$sum,date('Y-m-t 23:59:59'));
+    }
+
+    public function getCurrentFinishedOrders_byOwnerId($id): int
+    {
+        return Cache::get("order_count_ownerId_{$id}",function()use($id){
+            return Order::query()->where('owner_id',$id)
+                ->where('wms_status','订单完成')
+                ->where('wms_edittime','>=',date('Y-m-01 00:00:00'))
+                ->count();
+        });
+    }
+    /**
+     * 校正运输费
+     *
+     * @param Order $order
+     *
+     * @return bool
+     */
+    public function reviseLogisticFee(Order $order):bool
+    {
+        /** @var \stdClass $order */
+        if (!$order || $order->wms_status != '订单完成')return false; //订单不存在或状态不为完成
+        $feeBill = OwnerFeeDetail::query()->where("outer_table_name","orders")
+            ->where("outer_id",$order->id)->whereNull("logistic_fee")->first();
+        if (!$feeBill)return false; //是否已有即时账单,没有跳出
+        $order->loadMissing("packages","owner");//加载包裹
+        if (!$order->packages || !$order->owner)return false;
+        $order->owner->loadCount("ownerPriceExpresses");
+        if ($order->owner->owner_price_expresses_count < 1)return false; //不存在计费模型 跳出
+        foreach ($order->packages as $package)if (!$package->weight)return false; //包裹存在且全部存在数量
+
+        $logisticFee = 0;
+        foreach ($order->packages as $package){
+            if ($logisticFee!==null){
+                $provinceName = mb_substr($order->province,0,2);
+                $province = app(CacheService::class)->getOrExecute("province_".$provinceName,function ()use($provinceName){
+                    return Province::query()->where("name","like",$provinceName."%")->first();
+                },86400);
+                if (!$province)$logisticFee = null;
+
+                $fee = app("OwnerPriceExpressService")->matching($package->weight, $order->owner_id, $order->logistic_id, $province->id);
+                if ($fee<0)$logisticFee = null;
+                else $logisticFee += $fee;
+            }
+        }
+        if ($logisticFee===null || $logisticFee<0)
+            LogService::log(__METHOD__,"ERROR-校正即时账单计算物流费错误","订单ID:".$order->id."  费用结果:".$logisticFee);
+        else $feeBill->update(["logistic_fee"=>$logisticFee]);
+        return true;
+    }
+
+    public function freezeRemoveWave($orders, $isSql = false)
+    {
+        if (!$isSql && !is_array($orders))$orders = [$orders];
+        if (!$isSql){
+            $where = "''";
+            foreach ($orders as $f)$where .= ",'{$f}'";
+            $orders = $where;
+        }
+        $sql = <<<sql
+    DELETE FROM DOC_WAVE_DETAILS WHERE (WAVENO,ORDERNO) IN (SELECT DOC_ORDER_HEADER.WAVENO,DOC_ORDER_HEADER.ORDERNO FROM DOC_ORDER_HEADER LEFT JOIN DOC_WAVE_DETAILS ON DOC_ORDER_HEADER.WAVENO = DOC_WAVE_DETAILS.WAVENO
+    AND DOC_ORDER_HEADER.ORDERNO = DOC_WAVE_DETAILS.ORDERNO WHERE DOC_ORDER_HEADER.orderno IN ({$orders}) AND DOC_ORDER_HEADER.WAVENO != '*' AND DOC_ORDER_HEADER.WAVENO IS NOT NULL)
+sql;
+        $result = DB::connection("oracle")->delete(DB::raw("$sql"));
+        LogService::log(__METHOD__,"删除波次详情",$sql);
+        return $result;
+    }
+
 }

+ 1 - 1
app/Services/OrderTrackingService.php

@@ -66,7 +66,7 @@ class OrderTrackingService
     {
         $query = $this->getQuery($params);
 
-        if (isset($params['client_code'])|| isset($params['logistic_id'])){     // client_code logistic
+        if (isset($params['client_code'])){     // client_code logistic
             $query->where('order_client_code','like',$params['client_code']);
 //            $query->whereHas('commodities.package.order', function ($query) use ($params) {
 //                if($params['client_code'] ?? false){

+ 4 - 5
app/Services/OwnerPriceOperationService.php

@@ -172,12 +172,12 @@ class OwnerPriceOperationService
             if ($rule->strategy == '特征'){//特征策略匹配
                 $bool = app("FeatureService")->matchFeature($rule->feature,$columnMapping,$matchObject);
                 if ($bool === true){
-                    if ($rule->total_price)return $isDiscount ? $rule->total_discount_price : $rule->total_price; //按单计价存在,直接返回单总价或减免总价
+                    if ($rule->total_price)return ["id"=>$rule->id,"money"=>$isDiscount ? $rule->total_discount_price : $rule->total_price]; //按单计价存在,直接返回单总价或减免总价
                     $money = $this->matchItem($rule->items,$columnMapping,$matchObject,$units,$owner_id,$type=='入库' ? true : false,$isDiscount);
                     if ($money>0)return ["id"=>$rule->id,"money"=>$money];
                 };
             }else{//默认策略匹配
-                if ($rule->total_price)return $isDiscount ? $rule->total_discount_price : $rule->total_price; //按单计价存在,直接返回单总价或减免总价
+                if ($rule->total_price)return ["id"=>$rule->id,"money"=>$isDiscount ? $rule->total_discount_price : $rule->total_price]; //按单计价存在,直接返回单总价或减免总价
                 $money = $this->matchItem($rule->items,$columnMapping,$matchObject,$units,$owner_id,$type=='入库' ? true : false,$isDiscount);
                 if ($money>0)return ["id"=>$rule->id,"money"=>$money];
             };
@@ -231,12 +231,11 @@ class OwnerPriceOperationService
                     $inMoney = 0;
                     foreach ($packages as &$package){
                         if ($package["price"] ?? false)continue;
-                        if (!app("FeatureService")->matchFeature($rule->feature,["商品名称"=>$commodityColumn],["commodity"=>$package[$commodityColumn] ?? ''])) continue;
+                        if (!app("FeatureService")->matchFeature($rule->feature,["商品名称"=>$commodityColumn],$package)) continue;
 
                         if (!$unitName)$unitName = $units[$rule->unit_id];
                         else {
-                            if ($unitName != $units[$rule->unit_id])
-                                return -3;
+                            if ($unitName != $units[$rule->unit_id]) return -3;
                         }
                         $package["price"] = $rule->unit_price;
                         if (!isset($units[$rule->unit_id]))return -3;

+ 8 - 3
app/Services/PackageService.php

@@ -4,8 +4,8 @@ namespace App\Services;
 
 use App\OrderPackage;
 use App\Services\common\QueryService;
-use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Http\Request;
+use Illuminate\Support\Arr;
 use Illuminate\Support\Facades\Auth;
 
 const TABLE = "order_packages.";
@@ -21,15 +21,20 @@ class PackageService
         $packages = OrderPackage::query()->with(['order'=>function($query){
             return  $query->with(['owner','logistic']);
         },'paperBox','measuringMachine'])
-        ->whereIn('owner_id',$ownerIds)->orderBy(TABLE.'id','DESC');
+        ->whereIn('order_packages.owner_id',$ownerIds)->orderBy(TABLE.'id','DESC');
         if ($params['owner_id'] ?? false){
-            $packages->whereIn('owner_id', explode(',',$params['owner_id']));
+            $owner_id = explode(',',$params['owner_id']);
+            $packages->whereIn('order_packages.owner_id',$owner_id);
             unset($params['owner_id']);
         }
         if ($params['logistic_number'] ?? false){
             $packages->whereIn('logistic_number',array_values(array_filter(preg_split('/[,, ]+/is', $params['logistic_number']))));
             unset($params["logistic_number"]);
         }
+        if ($params['is_weighed']?? false) {
+            $packages->whereNotNull('weighed_at');
+            Arr::forget($params, 'is_weighed');
+        }
         $columnQueryRules=[
             'batch_number' => ['like' => ''],
             'created_at_start' => ['alias' => 'created_at','startDate' => " 00:00:00"],

+ 2 - 0
app/Services/StationRuleBatchService.php

@@ -20,6 +20,8 @@ class StationRuleBatchService
     {
         $batchType = $batch['type'] ?? 'null';
         $ownerId = $batch['owner_id'] ?? 'null';
+        $batch->loadMissing('stationTaskBatch');
+        if($batch['stationTaskBatch'])return null;
         return Cache::remember('stationRuleBatch_batchType_'.$batchType.'_ownerId_'.$ownerId, config('cache.expirations.rarelyChange'),function()use($batch){
             $builder= StationRuleBatch::query()->with('stationType')
                 ->where('owner_id',$batch['owner_id']);

+ 7 - 3
app/Services/StationTaskBatchService.php

@@ -164,9 +164,13 @@ class StationTaskBatchService
             (function () use ($stationTaskBatch) {
                 throw new Exception('找不到料箱:' . json_encode($stationTaskBatch));
             })();
-        $isFetchedFromRobotics
-            = $this->foreignHaiRoboticsService->
-        fetchGroup($toLocation, $taskMaterialBoxes, $groupPrefix);
+        try{
+            $isFetchedFromRobotics
+                = $this->foreignHaiRoboticsService->
+            fetchGroup($toLocation, $taskMaterialBoxes, $groupPrefix);
+        }catch(Exception $e){
+            throw new ErrorException('$stationTaskBatch运行波次机器人任务失败,获取组失败: '.$stationTaskBatch->toJson() . $e->getMessage());
+        }
         ($markNewStatus
             =function()use($isFetchedFromRobotics,$stationTaskBatch){
             $isFetchedFromRobotics?

+ 1 - 3
app/Services/WarehouseService.php

@@ -92,9 +92,7 @@ class WarehouseService
         return Cache::remember("WareHouse_{$code}",config('cache.expirations.warehouse'),function()use($code){
             $wareHouse =  Warehouse::query()->where('code',$code)->first();
             if($wareHouse)return $wareHouse;
-            $bas_customer = app('OracleBasCustomerService')->first(['CustomerId'=>$code,'Customer_Type'=>'WH']);
-            if(!$bas_customer) return null;
-            return Warehouse::query()->create(['name'=>$bas_customer['descr_c'],'code'=>$bas_customer['customerid']]);
+            return Warehouse::query()->create(['name'=>$code,'code'=>$code]);
         });
     }
 }

+ 2 - 2
app/Services/WeighExceptedService.php

@@ -26,7 +26,7 @@ class WeighExceptedService
     }
 
     public function getCreateExceptionSql(array $params){
-        return $this->conditionQuery($params)->where(TABLE.'status',"上传异常")->orWhere(TABLE.'status',"测量异常")
+        return $this->conditionQuery($params)->where(TABLE.'uploaded_to_wms',"异常")->orWhere(TABLE.'status',"测量异常")
             ->leftJoin('orders',TABLE.'order_id','orders.id')
             ->LeftJoin('logistics','orders.logistic_id','logistics.id')
                 ->selectRaw('logistics.name logistic_name')
@@ -39,7 +39,7 @@ class WeighExceptedService
 
     public function getIssuedExceptionSql(array $params){
         return $this->conditionQuery($params)->where(TABLE.'status',"下发异常")->orWhere(TABLE.'status',"记录异常")
-            ->orWhere(TABLE.'status',"已上传异常")
+            ->orWhere(TABLE.'uploaded_to_wms',"异常")
             ->leftJoin('orders',TABLE.'order_id','orders.id')
             ->LeftJoin('logistics','orders.logistic_id','logistics.id')
                 ->selectRaw('logistics.name logistic_name')

+ 28 - 0
app/Supplier.php

@@ -0,0 +1,28 @@
+<?php
+
+namespace App;
+
+use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\Model;
+
+use App\Traits\ModelLogChanging;
+use Illuminate\Database\Eloquent\Relations\BelongsToMany;
+use Illuminate\Database\Eloquent\SoftDeletes;
+
+class Supplier extends Model
+{
+    use ModelLogChanging;
+    use ModelTimeFormat;
+    use SoftDeletes;
+    protected $fillable = ['name','contact_man','phone','invoice_title','bank','bank_account','opening_bank'];
+
+    public function material():BelongsToMany
+    {
+        return $this->belongsToMany(Material::class,'material_supplier','supplier_id','material_id','id','material_id');
+    }
+
+    public function scopeFilter($query,$filters)
+    {
+        return $filters->apply($query);
+    }
+}

+ 1 - 1
app/UploadFile.php

@@ -11,6 +11,6 @@ class UploadFile extends Model
     use ModelLogChanging;
 
     protected $fillable=[
-        'table_name','table_id','url','type',"name"
+        'table_name','table_id','url','type',"file_name"
     ];
 }

+ 3 - 2
bashupMysql.sh

@@ -19,7 +19,7 @@ test_password="123456"
 db="bswas"
 test_db="bswas_test"
 #执行备份语句 --single-transaction 是在导出数据时不锁表
-mysqldump -h$host -u$user -p$password --single-transaction $db --ignore-table=$db.orders --ignore-table=$db.stores --ignore-table=$db.store_items --ignore-table=$db.commodities --ignore-table=$db.commodity_barcodes --ignore-table=$db.logs --ignore-table=$db.order_commodities --ignore-table=$db.order_bins --ignore-table=$db.w_m_s_waybill_orders --ignore-table=$db.rejected_bills --ignore-table=$db.rejected_bill_items --ignore-table=$db.w_m_s_reflect_packages --ignore-table=$db.w_m_s_reflect_receive_skus --ignore-table=$db.w_m_s_reflect_receives --ignore-table=$db.order_counting_records --ignore-table=$db.order_package_commodities --ignore-table=$db.order_packages --ignore-table=$db.packages> $time_nowall.sql
+mysqldump -h$host -u$user -p$password --single-transaction $db --ignore-table=$db.orders --ignore-table=$db.stores --ignore-table=$db.packages --ignore-table=$db.store_items --ignore-table=$db.commodities --ignore-table=$db.commodity_barcodes --ignore-table=$db.logs --ignore-table=$db.order_commodities --ignore-table=$db.order_bins --ignore-table=$db.w_m_s_waybill_orders --ignore-table=$db.rejected_bills --ignore-table=$db.rejected_bill_items --ignore-table=$db.w_m_s_reflect_packages --ignore-table=$db.w_m_s_reflect_receive_skus --ignore-table=$db.w_m_s_reflect_receives --ignore-table=$db.order_counting_records --ignore-table=$db.order_package_commodities --ignore-table=$db.order_packages --ignore-table=$db.packages> $time_nowall.sql
 mysql  -u$test_user -p$test_password  $test_db< $time_nowall.sql
 mysqldump -h$host -u$user -p$password --single-transaction -q -e $db orders --where="created_at>='$time_30day_ago'" > $time_noworders.sql
 mysql  -u$test_user -p$test_password  $test_db< $time_noworders.sql
@@ -53,4 +53,5 @@ mysqldump -h$host -u$user -p$password --single-transaction -q -e $db order_commo
 mysql  -u$test_user -p$test_password  $test_db< $time_noworder_commodities.sql
 mysqldump -h$host -u$user -p$password --single-transaction -q -e $db order_packages --where="created_at>='$time_30day_ago'" > $time_noworder_packages.sql
 mysql  -u$test_user -p$test_password  $test_db< $time_noworder_packages.sql
-#sudo rm -rf $time_3day_ago*
+mysqldump -h$host -u$user -p$password --single-transaction -q -e $db packages --where="created_at>='$time_30day_ago'" > $time_nowpackages.sql
+mysql  -u$test_user -p$test_password  $test_db< $time_nowpackages.sql

+ 18 - 0
database/factories/ConfigurationFactory.php

@@ -0,0 +1,18 @@
+<?php
+
+/** @var Factory $factory */
+
+use App\Configuration;
+use Faker\Generator as Faker;
+use \Illuminate\Database\Eloquent\Factory;
+
+$factory->define(Configuration::class, function (Faker $faker) {
+    return [
+        'name' => $faker->domainName,
+        'value' => $faker->title,
+        'description' => $faker->title(100),
+        'created_at' => $faker->dateTime,
+        'updated_at' =>$faker->dateTime,
+        'operator' => 1
+    ];
+});

+ 13 - 0
database/factories/MaterialFactory.php

@@ -0,0 +1,13 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\Material;
+use Faker\Generator as Faker;
+
+$factory->define(Material::class, function (Faker $faker) {
+    return [
+        'code' => $faker->name(10),
+        'name' => $faker->name(20),
+    ];
+});

+ 17 - 0
database/factories/OwnerMaterialFactory.php

@@ -0,0 +1,17 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\OwnerMaterial;
+use Faker\Generator as Faker;
+
+$factory->define(OwnerMaterial::class, function (Faker $faker) {
+    return [
+        'owner_id' => 1,
+        'material_id' => 1,
+        'material_code' => \Illuminate\Support\Str::random(5),
+        'size' => \Illuminate\Support\Str::random(10),
+        'special'=>\Illuminate\Support\Str::random(10),
+        'specification' => \Illuminate\Support\Str::random(10),
+        'initiator'=>1];
+});

+ 20 - 0
database/factories/SupplierFactory.php

@@ -0,0 +1,20 @@
+<?php
+
+/**
+ * @var Factory $factory
+ */
+
+use App\Supplier;
+use Faker\Generator as Faker;
+use \Illuminate\Database\Eloquent\Factory;
+$factory->define(Supplier::class, function (Faker $faker) {
+    return [
+        'name' => $faker->userName,
+        'contact_man' => $faker->bankAccountNumber,
+        'phone' => $faker->phoneNumber,
+        'invoice_title' => $faker->jobTitle,
+        'bank' => $faker->domainName,
+        'bank_account' => $faker->bankAccountNumber,
+        'opening_bank' => $faker->address
+    ];
+});

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

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class EditOrderPackagesStatusAddUploadedToWmsEnum extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('order_packages', function (Blueprint $table) {
+            $table->enum('uploaded_to_wms', ['是', '否', '异常'])->default('否')->index();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('order_packages', function (Blueprint $table) {
+            $table->dropColumn('uploaded_to_wms');
+        });
+    }
+}

+ 35 - 0
database/migrations/2021_01_29_161734_add_units_data.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddUnitsData extends Migration
+{
+    protected $units = [
+        "件","箱",'单',"日","月","m²","m³","件","托"
+    ];
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        foreach ($this->units as $unit){
+            \App\Unit::query()->firstOrCreate(["name"=>$unit],[
+               "name" => $unit,
+               "code" => $unit
+            ]);
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+    }
+}

+ 33 - 0
database/migrations/2021_02_01_132214_create_materials_table.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateMaterialsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('materials', function (Blueprint $table) {
+            $table->id();
+            $table->string('code',20)->unique()->comment('编号');
+            $table->string('name',50)->comment('名称');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('materials');
+    }
+}

+ 38 - 0
database/migrations/2021_02_01_172827_create_owner_material_table.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateOwnerMaterialTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('owner_material', function (Blueprint $table) {
+            $table->id();
+            $table->bigInteger('owner_id')->index()->comment('货主');
+            $table->bigInteger('material_id')->index()->comment('耗材');
+            $table->string('material_code',30)->comment('耗材编码');
+            $table->string('size')->comment('尺寸');
+            $table->string('special')->nullable()->comment('特殊要求');
+            $table->text('specification')->nullable()->comment('材质规格');
+            $table->bigInteger('initiator')->comment('创建者');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('owner_materials');
+    }
+}

+ 39 - 0
database/migrations/2021_02_02_141649_create_suppliers_table.php

@@ -0,0 +1,39 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateSuppliersTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('suppliers', function (Blueprint $table) {
+            $table->id();
+            $table->string('name',30)->comment('名称');
+            $table->string('contact_man',30)->comment('联系人');
+            $table->string('phone')->comment('电话');
+            $table->string('invoice_title')->comment('发票抬头');
+            $table->string('bank',30)->comment('账户银行');
+            $table->string('bank_account',50)->comment('收款账户');
+            $table->string('opening_bank',50)->comment('开户行');
+            $table->timestamps();
+            $table->softDeletes();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('suppliers');
+    }
+}

+ 31 - 0
database/migrations/2021_02_02_142307_create_table_material_supplier.php

@@ -0,0 +1,31 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateTableMaterialSupplier extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('material_supplier', function (Blueprint $table) {
+            $table->bigInteger('material_id');
+            $table->bigInteger('supplier_id');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('material_supplier');
+    }
+}

+ 35 - 0
database/migrations/2021_02_02_155946_create_configurations_table.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateConfigurationsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('configurations', function (Blueprint $table) {
+            $table->id();
+            $table->string('name')->index()->comment('名称');
+            $table->string('value')->index()->comment('值');
+            $table->string('description')->nullable()->comment('描述');
+            $table->bigInteger('operator')->comment('操作员');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('configurations');
+    }
+}

+ 40 - 0
database/migrations/2021_02_03_091623_add_authorrities_to_materials_owner_material_suppliers_configurations.php

@@ -0,0 +1,40 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+use App\Authority;
+
+class AddAuthorritiesToMaterialsOwnerMaterialSuppliersConfigurations extends Migration
+{
+    private $names = [
+        '耗材类型', '耗材类型-编辑','耗材类型-删除',
+        '项目耗材', '项目耗材-编辑','项目耗材-删除','项目耗材-文件上传',
+        '供应商', '供应商-编辑','供应商-删除',
+        '系统配置','系统配置-编辑','系统配置-删除',
+    ];
+
+
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        foreach ($this->names as $name) {
+            if(!Authority::query()->where('name',$name)->exists())
+                Authority::query()->create(['name'=>$name,'alias_name'=>$name]);
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Authority::query()->whereIn('name',$this->names)->delete();
+    }
+}

+ 17 - 0
database/seeds/ConfigurationSeeder.php

@@ -0,0 +1,17 @@
+<?php
+
+use Illuminate\Database\Seeder;
+use App\Configuration;
+class ConfigurationSeeder extends Seeder
+{
+    /**
+     * Run the database seeds.
+     *
+     * @return void
+     */
+    public function run()
+    {
+        $configurations = factory(Configuration::class)->times(100)->make()->toArray();
+        Configuration::query()->insert($configurations);
+    }
+}

+ 17 - 0
database/seeds/MaterialSeeder.php

@@ -0,0 +1,17 @@
+<?php
+
+use Illuminate\Database\Seeder;
+
+class MaterialSeeder extends Seeder
+{
+    /**
+     * Run the database seeds.
+     *
+     * @return void
+     */
+    public function run()
+    {
+        $materials = factory(\App\Material::class)->times(60)->make()->toArray();
+        \App\Material::query()->insert($materials);
+    }
+}

+ 18 - 0
database/seeds/OwnerMaterialSeeder.php

@@ -0,0 +1,18 @@
+<?php
+
+use App\OwnerMaterial;
+use Illuminate\Database\Seeder;
+
+class OwnerMaterialSeeder extends Seeder
+{
+    /**
+     * Run the database seeds.
+     *
+     * @return void
+     */
+    public function run()
+    {
+        $ownerMaterials =  factory(OwnerMaterial::class)->times(120)->make()->toArray();
+        OwnerMaterial::query()->insert($ownerMaterials);
+    }
+}

+ 17 - 0
database/seeds/SupplierSeeder.php

@@ -0,0 +1,17 @@
+<?php
+
+use Illuminate\Database\Seeder;
+
+class SupplierSeeder extends Seeder
+{
+    /**
+     * Run the database seeds.
+     *
+     * @return void
+     */
+    public function run()
+    {
+        $params = factory(\App\Supplier::class)->times(100)->make()->toArray();
+        \App\Supplier::query()->insert($params);
+    }
+}

+ 6 - 5
resources/views/customer/_selectedOwner.blade.php

@@ -1,21 +1,22 @@
 <div class="modal fade" tabindex="-1" role="dialog" id="selectedOwner">
-    <div class="modal-dialog modal-dialog-centered">
+    <div class="modal-dialog modal-lg modal-dialog-centered">
         <div class="modal-content">
             <div class="modal-header">
                 <button type="button" class="close" data-dismiss="modal">&times;</button>
             </div>
             <div class="modal-body">
                 <div class="row">
-                    <label class="col-6">
-                        <select class="selectpicker border border-2 border-dark rounded" id="owners" multiple data-live-search="true" title="项目(多选)">
+                    <label class="col-2">指定项目</label>
+                    <label class="col-4">
+                        <select class="selectpicker border border-2 border-secondary rounded" id="owners" multiple data-live-search="true" title="项目(多选)">
                             <option v-for="owner in owners" :value="owner.name">@{{ owner.value }}</option>
-                        </select>
+                        </select><br>
+                        <button class="btn btn-primary mt-2" @click="createReport(true)">一键刷新全部</button>
                     </label>
                     <div class="col-6">
                         <p v-for="error in errors" class="text-danger">@{{ error }}</p>
                     </div>
                 </div>
-
             </div>
             <div class="modal-footer">
                 <button type="button" class="btn btn-success pull-right" @click="createReport()">生成</button>

+ 2 - 2
resources/views/customer/customer/tag/index.blade.php

@@ -10,7 +10,7 @@
         @include("customer.customer.tag._edit")
         <div class="card">
             <div class="card-body">
-                <div class="row pull-right">
+                <div class="row pull-left ml-1">
                     @can("客户-客户标签-录入")<button class="btn btn-outline-info mb-1 mr-3" @click="openModal()"><span class="fa fa-plus"></span>&nbsp;新&nbsp;&nbsp;增</button>@endcan
                 </div>
                 <table class="table table-striped table-hover">
@@ -104,4 +104,4 @@
             },
         });
     </script>
-@stop
+@stop

+ 2 - 2
resources/views/customer/customerLogStatus/index.blade.php

@@ -11,7 +11,7 @@
         <div class="card">
             <div class="card-body">
                 @include("customer.customerLogStatus._edit")
-                <div class="row pull-right">
+                <div class="row pull-left ml-1">
                     @can("客户-客户状态-录入")<button class="btn btn-outline-info mb-1 mr-3" @click="openModal()"><span class="fa fa-plus"></span>&nbsp;新&nbsp;&nbsp;增</button>@endcan
                 </div>
                 <table class="table table-striped table-bordered table-hover">
@@ -106,4 +106,4 @@
             },
         });
     </script>
-@endsection
+@endsection

+ 28 - 8
resources/views/customer/project/area.blade.php

@@ -51,19 +51,25 @@
                     <td>@{{ area.countingMonth }}</td>
                     <td>@{{ area.updatedAt }}</td>
                     <td>@{{ area.ownerStoragePriceModel }}</td>
+                    <td>@{{ area.unitName }}</td>
                     <td>
-                        <label><input :readonly="editIndex==i ? false : true" @change="thisArea.area_on_tray = $event.target.value"
+                        <label><input :readonly="editIndex==i && area.unitName=='m²' ? false : true" @change="thisArea.area_on_tray = $event.target.value"
                                       type="number" min="0" class="form-control form-control-sm" :value="area.areaOnTray"></label>
                     </td>
                     <td>
-                        <label><input :readonly="editIndex==i ? false : true" @change="thisArea.area_on_half_tray = $event.target.value"
+                        <label><input :readonly="editIndex==i && area.unitName=='m²' ? false : true" @change="thisArea.area_on_half_tray = $event.target.value"
                                       type="number" min="0" class="form-control form-control-sm" :value=area.areaOnHalfTray></label>
                     </td>
                     <td>
-                        <label><input :readonly="editIndex==i ? false : true" @change="thisArea.area_on_flat = $event.target.value"
+                        <label><input :readonly="editIndex==i && area.unitName=='m²' ? false : true" @change="thisArea.area_on_flat = $event.target.value"
                                       type="number" min="0" class="form-control form-control-sm" :value="area.areaOnFlat"></label>
                     </td>
-                    <td>@{{ area.accountingArea }}</td>
+                    <td>
+                        <label class="form-inline"><input :readonly="editIndex==i && area.unitName!='m²' ? false : true" @change="thisArea.accounting_area = $event.target.value"
+                                      type="number" min="0" class="form-control form-control-sm" :value="area.accountingArea">
+                            <label> / @{{ area.unitName }}</label>
+                        </label>
+                    </td>
                 </tr>
             </table>
             {{$areas->appends($params)->links()}}
@@ -94,6 +100,7 @@
                         status : "{{$area->status}}",
                         updatedAt : "{{$area->updated_at}}",
                         ownerStoragePriceModel:"{{ $area->ownerStoragePriceModel ? $area->ownerStoragePriceModel->using_type : '' }}",
+                        unitName:"{{ $area->ownerStoragePriceModel ? ($area->ownerStoragePriceModel->unit ? $area->ownerStoragePriceModel->unit->name : '') : '' }}",
                     },
                     @endforeach
                 ],
@@ -168,10 +175,11 @@
                     {name:'countingMonth',value: '结算月'},
                     {name:'createdAt',value: '录入时间'},
                     {name:'ownerStoragePriceModel',value: '用仓类型'},
+                    {name:'unitName',value: '单位'},
                     {name:'areaOnTray',value: '货物整托', neglect: true},
                     {name:'areaOnHalfTray',value: '货物半托', neglect: true},
-                    {name:'areaOnFlat',value: '平面区(面积/体积)', neglect: true},
-                    {name:'accountingArea',value: '结算(面积/体积)', neglect: true},
+                    {name:'areaOnFlat',value: '平面区', neglect: true},
+                    {name:'accountingArea',value: '结算', neglect: true},
                 ];
                 let _this=this;
                 setTimeout(function () {
@@ -212,6 +220,7 @@
                     this.thisArea.area_on_tray = area.areaOnTray;
                     this.thisArea.area_on_half_tray = area.areaOnHalfTray;
                     this.thisArea.area_on_flat = area.areaOnFlat;
+                    this.thisArea.accounting_area = area.accountingArea;
                 },
                 submitArea(){
                     window.tempTip.confirm("确认要提交该面积的更新吗?",()=>{
@@ -243,9 +252,15 @@
                         })
                     });
                 },
-                createReport(){
+                createReport(isAll = false){
                     let dom = $("#owners");
                     let val = dom.selectpicker('val');
+                    if (isAll){
+                        val = [];
+                        this.owners.forEach(owner=>{
+                            val.push(owner.name);
+                        });
+                    }
                     window.tempTip.setDuration(3000);
                     window.tempTip.setIndex(1099);
                     if (val.length<1){
@@ -255,7 +270,12 @@
                     let url="{{url('customer/project/createAreaReport')}}";
                     let params = {val:val};
                     window.tempTip.postBasicRequest(url,params,res=>{
-                        this.areas = res.concat(this.areas);
+                        res.forEach(data =>{
+                            if (this.areas.every(area=>{
+                                if (area.id == data.id)return false;
+                                else return true;
+                            }))this.areas.unshift(data);
+                        });
                         dom.selectpicker('val',[]);
                         return "已生成报表";
                     },true)

+ 28 - 3
resources/views/customer/project/create.blade.php

@@ -176,8 +176,8 @@
                     discount_type:[
                         "无减免","按单减免","固定减免"
                     ],
-                    feature_type:['商品名称','订单类型','承运商','店铺类型','订单数'],
-                    logic : ['包含','不包含','等于','大于','大于等于','小于','小于等于'],
+                    feature_type:['商品名称','订单类型','承运商','店铺类型'],
+                    logic : ['包含','不包含','等于'],
                 },
                 poolMapping:{},//基础数据选择池的映射对象 供展示使用
                 selectedModel:{//已选定的计费模型
@@ -412,6 +412,10 @@
                         if (res.owner_storage_price_models.length>0)this.selectedModel.storage = res.owner_storage_price_models;
                         if (res.owner_price_operations.length>0){
                             this._loadOperation();
+                            res.owner_price_operations.forEach((operation)=>{
+                                if (operation.discount_count)operation.isDiscount = true;
+                                if (operation.total_price)operation.isSingle = true;
+                            });
                             this.selectedModel.operation = res.owner_price_operations;
                         }
                         if (res.owner_price_expresses.length>0){
@@ -619,14 +623,19 @@
                         this.$forceUpdate();
                         return;
                     }
-                    if (!this.model.operation.total_price){
+                    if (!this.model.operation.isSingle){
                         if ((this.model.operation.operation_type === '出库' && this._verifyOperationItem(0)) || this._verifyOperationItem(1))return;
                         if (this.model.operation.items.length>2){
                             for (let i=2;i<this.model.operation.items.length;i++){
                                 if (this._verifyOperationItem(i))return;
                             }
                         }
+                        this.model.operation.total_price = "";
                     }else this.$set(this.model.operation,"items",[]);
+                    if (!this.model.operation.isDiscount) {
+                        this.model.operation.discount_count = "";
+                        this.model.operation.total_discount_price = "";
+                    }
                     let url = "{{url('maintenance/priceModel/apiStoreOperation')}}";
                     let params = this.model.operation;
                     params.owner_id = this.ownerTemp.id;
@@ -649,6 +658,8 @@
                             res.items[i].type = this.model.operation.items[sign]['type'];
                             sign++;
                         }
+                        if (res.discount_count)res.isDiscount = true;
+                        if (res.total_price)res.isSingle = true;
                         if (params.id) this.selectedModel.operation[params.index] = res;
                         else this.selectedModel.operation.push(res);
                         this.model.operation = {
@@ -668,6 +679,10 @@
                 _verifyOperationItem(itemIndex){//验证作业费子项信息完整
                     let obj = this.model.operation.items[itemIndex];
                     let sign = false;
+                    if (obj.strategy === '特征' && !obj.feature){
+                        this.errors['items.'+itemIndex+'.feature'] = ["必须选择特征"];
+                        sign = true;
+                    }
                     if (this.model.operation.isDiscount && !obj.discount_price){
                         this.errors['items.'+itemIndex+'.discount_price'] = ["满减单价不得为空"];
                         sign = true;
@@ -683,6 +698,9 @@
                     if (!obj.unit_price){
                         this.errors['items.'+itemIndex+'.unit_price'] = ["单价不得为空"];
                     }
+                    if (this.model.operation.isDiscount && !obj.discount_price){
+                        this.errors['items.'+itemIndex+'.discount_price'] = ["满减单价不得为空"];
+                    }
                     if (sign)this.$forceUpdate();
                     return sign;
                 },
@@ -1420,6 +1438,13 @@
                     this.model.operation = JSON.parse(JSON.stringify(this.selectedModel.operation[index]));
                     if (this.model.operation.operation_type==='入库') this.model.operation.items.unshift({});
                     this.model.operation.index = index;
+                    if (this.model.operation.items.length == 0){
+                        this.model.operation.items = [
+                            {strategy:"起步",type:"0"},
+                            {strategy:"默认"},
+                            {strategy:"特征"},
+                        ];
+                    }
                 },
                 //编辑快递
                 editExpress(index){

+ 1 - 1
resources/views/customer/project/part/_addFeature.blade.php

@@ -25,7 +25,7 @@
                         </label>
                         <label class="col-2">
                             <select class="form-control form-control-sm" v-model="feature.type">
-                                <option v-for="t in pool.feature_type" :value="t">@{{ t }}</option>
+                                <option v-for="t in pool.feature_type" :value="t" v-if="(thisOperationItemIndex===-1 && t !== '商品名称') || (thisOperationItemIndex!==-1 && t==='商品名称')">@{{ t }}</option>
                             </select>
                         </label>
                         <label class="col-2">

+ 5 - 4
resources/views/customer/project/part/_operation.blade.php

@@ -35,7 +35,7 @@
 <div class="row mt-3" v-if="model.operation.operation_type == '出库'">
     <label class="col-2" for="isDiscount">是否满减</label>
     <div class="col-2">
-        <input type="checkbox" id="isDiscount" class="col-2 rounded mt-1" v-model="model.operation.isDiscount">
+        <input type="checkbox" id="isDiscount" class="rounded mt-1" v-model="model.operation.isDiscount">
     </div>
     <div class="col-8 row" v-if="model.operation.isDiscount">
         <label class="col-3" for="discount">满减值</label>
@@ -92,7 +92,7 @@
                     <div class="row mt-2" v-if="model.operation.items[0].type == 0">
                         <label class="col-3">单位</label>
                         <label class="col-5 mb-0"><select v-model="model.operation.items[0].unit_id" class="form-control" :class="errors['items.0.unit_id'] ? 'is-invalid' : ''">
-                                <option v-for="unit in pool.units" :value="unit.id">@{{ unit.name }}</option>
+                                <option v-for="unit in pool.units" :value="unit.id" v-if="unit.name=='件' || unit.name=='箱'">@{{ unit.name }}</option>
                             </select></label>
                     </div>
                     <div class="row mt-0" v-if="errors['items.0.unit_id']">
@@ -145,7 +145,7 @@
             <div class="row mt-2">
                 <label class="col-3">单位</label>
                 <label class="col-5 mb-0"><select v-model="model.operation.items[1].unit_id" class="form-control" :class="errors['items.1.unit_id'] ? 'is-invalid' : ''">
-                    <option v-for="unit in pool.units" :value="unit.id">@{{ unit.name }}</option>
+                    <option v-for="unit in pool.units" :value="unit.id" v-if="unit.name=='件' || unit.name=='箱'">@{{ unit.name }}</option>
                 </select></label>
             </div>
             <div class="row mt-0" v-if="errors['items.1.unit_id']">
@@ -196,7 +196,7 @@
             <div class="row mt-2">
                 <label class="col-3">单位</label>
                 <label class="col-5 mb-0"><select v-model="item.unit_id" class="form-control" :class="errors['items.'+i+'.unit_id'] ? 'is-invalid' : ''">
-                    <option v-for="unit in pool.units" :value="unit.id">@{{ unit.name }}</option>
+                    <option v-for="unit in pool.units" :value="unit.id" v-if="unit.name=='件' || unit.name=='箱'">@{{ unit.name }}</option>
                 </select></label>
             </div>
             <div class="row mt-0" v-if="errors['items.'+i+'.unit_id']">
@@ -221,6 +221,7 @@
             <div class="row mt-2">
                 <label class="col-3">特征:</label>
                 <label class="col-5">
+                    <label v-if="errors['items.'+i+'.feature']" class="text-danger">@{{ errors['items.'+i+'.feature'][0] }}</label>
                     <label v-if="item.feature">@{{ item.featureFormat }}</label><br>
                     <button type="button" class="btn btn-dark ml-2" @click="showAddFeatureModal(i)">调整特征</button>
                 </label>

+ 2 - 1
resources/views/customer/project/part/_storage.blade.php

@@ -46,7 +46,8 @@
         <label for="unit_id" class="col-5 offset-1 text-info">单位</label>
         <select id="unit_id" class="col-6 form-control"
                 :class="errors.unit_id ? 'is-invalid' : ''" v-model="model.storage.unit_id">
-            <option v-for="unit in pool.units" :value="unit.id" v-if="unit.name == 'm²' || unit.name == 'm³'">@{{ unit.name }}</option>
+            <option v-for="unit in pool.units" :value="unit.id" v-if="unit.name == 'm²' || unit.name == 'm³' || unit.name == '件' || unit.name == '托'">
+                @{{ unit.name }}</option>
         </select>
         <span class="invalid-feedback mt-0 offset-2" role="alert" v-if="errors.unit_id">
             <strong>@{{ errors.unit_id[0] }}</strong>

+ 16 - 2
resources/views/customer/project/part/_three.blade.php

@@ -61,8 +61,14 @@
                                           v-if="operation.strategy == '特征'" @click.stop="delOperation(operation,i)">&times;</span>
                                 </div>
                             </div>
+                            <div class="row offset-1 small mt-0" style="background-color: RGB(248,248,248)" v-if="operation.discount_count">
+                                <span class="text-secondary">满减阈值:</span><b>@{{ operation.discount_count }}</b>
+                            </div>
                             <div class="row offset-1 small mt-0" style="background-color: RGB(248,248,248)" v-if="operation.strategy === '特征'">
-                                @{{ operation.featureFormat }}
+                                <span class="text-secondary">特征:</span>@{{ operation.featureFormat }}
+                            </div>
+                            <div class="container-fluid offset-2" v-if="operation.isSingle">
+                                按单计费:<b>@{{ operation.total_price }}</b>&nbsp;元/单<span v-if="operation.isDiscount">&nbsp;(满减价格:<b>@{{ operation.total_discount_price }}</b>&nbsp;元/单)</span>
                             </div>
                             <div class="container-fluid offset-2" :id="'operation-item-'+i">
                                 <div v-for="(item,j) in operation.items" class="container-fluid">
@@ -70,6 +76,7 @@
                                         <div class="col-10">
                                             <label>@{{ item.strategy }}</label>:
                                             <b>@{{ item.amount }}</b>&nbsp;@{{ poolMapping.units ? poolMapping.units[item.unit_id] : '' }} / <b>@{{ item.unit_price }}</b>元
+                                            <span v-if="operation.isDiscount">&nbsp;(满减单价:<b>@{{ item.discount_price }}元</b>)</span>
                                         </div>
                                         <div class="col-1">
                                             <span class="cursor-pointer text-danger font-weight-bold"
@@ -103,8 +110,14 @@
                                           v-if="operation.strategy == '特征'" @click.stop="delOperation(operation,i)">&times;</span>
                                 </div>
                             </div>
+                            <div class="row offset-1 small mt-0" style="background-color: RGB(248,248,248)" v-if="operation.discount_count">
+                                <span class="text-secondary">满减阈值:</span><b>@{{ operation.discount_count }}</b>
+                            </div>
                             <div class="row offset-1 small mt-0" style="background-color: RGB(248,248,248)" v-if="operation.strategy === '特征'">
-                                @{{ operation.featureFormat }}
+                                <span class="text-secondary">特征:</span>@{{ operation.featureFormat }}
+                            </div>
+                            <div class="container-fluid offset-2" v-if="operation.isSingle">
+                                按单计费:<b>@{{ operation.total_price }}</b>&nbsp;元/单<span v-if="operation.isDiscount">&nbsp;(满减价格:<b>@{{ operation.total_discount_price }}</b>&nbsp;元/单)</span>
                             </div>
                             <div class="container-fluid offset-2" :id="'operation-item-'+i">
                                 <div v-for="(item,j) in operation.items" class="container-fluid">
@@ -112,6 +125,7 @@
                                         <div class="col-10">
                                             <label>@{{ item.strategy }}</label>:
                                             <span v-if="item.amount > 0"><b>@{{ item.amount }}</b>&nbsp;@{{ poolMapping.units ? poolMapping.units[item.unit_id] : '' }} /</span><b>&nbsp;@{{ item.unit_price }}</b>元
+                                            <span v-if="operation.isDiscount">&nbsp;(满减单价:<b>@{{ item.discount_price }}元</b>)</span>
                                         </div>
                                         <div class="col-1">
                                             <span class="cursor-pointer text-danger font-weight-bold"

+ 9 - 3
resources/views/customer/project/report.blade.php

@@ -18,7 +18,7 @@
                 <a class="dropdown-item" @click="reportExport(false)" href="javascript:">导出勾选内容</a>
                 <a class="dropdown-item" @click="reportExport(true)" href="javascript:">导出所有页</a>
             </div>
-            <button class="ml-1 btn btn-sm btn-outline-primary" data-toggle="modal" data-target="#selectedOwner">新 增</button>
+            <button class="ml-1 btn btn-sm btn-outline-primary" data-toggle="modal" data-target="#selectedOwner">刷 新</button>
         </div>
         <div>
             <label for="all" id="cloneCheckAll" class="d-none">
@@ -193,9 +193,15 @@
                         this.checkData = [];
                     }
                 },
-                createReport(){
+                createReport(isAll = false){
                     let dom = $("#owners");
                     let val = dom.selectpicker('val');
+                    if (isAll){
+                        val = [];
+                        this.owners.forEach(owner=>{
+                            val.push(owner.name);
+                        });
+                    }
                     window.tempTip.setDuration(3000);
                     window.tempTip.setIndex(1099);
                     if (val.length<1){
@@ -205,7 +211,7 @@
                     let url="{{url('customer/project/createReport')}}";
                     let params = {val:val};
                     window.tempTip.postBasicRequest(url,params,res=>{
-                        this.errors = res.errors;
+                        if (!isAll) this.errors = res.errors;
                         this.reports = res.data.concat(this.reports);
                         dom.selectpicker('val',[]);
                         return "已生成报表";

+ 38 - 0
resources/views/maintenance/configuration/_create.blade.php

@@ -0,0 +1,38 @@
+<div class="modal " id="add-configuration" tabindex="-1" >
+    <div class="modal-dialog modal-lg modal-dialog-centered">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title text-center">系统配置添加</h5>
+                <button type="button" class="close" data-dismiss="modal" @click="addConfiguration={}">
+                    <span>&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <form class="form">
+                    <div class="form-group row">
+                        <label for="add-name" class="col-sm-2 col-form-label text-right">名称</label>
+                        <div class="col-sm-10 form-inline">
+                            <input type="text" name="name" id="add-name" class="form-control col-sm-10" placeholder="输入配置名称" v-model="addConfiguration.name">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add-value" class="col-sm-2 col-form-label text-right">值</label>
+                        <div class="col-sm-10 form-inline">
+                            <input type="text" id="add-value" class="form-control col-10" name="value" placeholder="输入配置值" v-model="addConfiguration.value">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add-description" class="col-sm-2 col-form-label text-right">描述</label>
+                        <div class="col-sm-10 form-inline">
+                            <textarea name="description" id="add-description" cols="30" rows="5"  class="form-control form-text col-10" v-model="addConfiguration.description"></textarea>
+                        </div>
+                    </div>
+                </form>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary"  data-dismiss="modal" @click="addConfiguration={}">关闭</button>
+                <button type="button" class="btn btn-primary" @click="create">提交</button>
+            </div>
+        </div>
+    </div>
+</div>

+ 38 - 0
resources/views/maintenance/configuration/_edit.blade.php

@@ -0,0 +1,38 @@
+<div class="modal " id="edit-configuration" tabindex="-1" >
+    <div class="modal-dialog modal-lg modal-dialog-centered">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title text-center">系统配置编辑</h5>
+                <button type="button" class="close" data-dismiss="modal" @click="editConfiguration={}">
+                    <span>&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <form class="form">
+                    <div class="form-group row">
+                        <label for="add-name" class="col-sm-2 col-form-label text-right">名称</label>
+                        <div class="col-sm-10 form-inline">
+                            <input type="text" name="name" id="add-name" class="form-control col-sm-10" placeholder="输入配置名称" v-model="editConfiguration.name">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add-value" class="col-sm-2 col-form-label text-right">值</label>
+                        <div class="col-sm-10 form-inline">
+                            <input type="text" id="add-value" class="form-control col-10" name="value" placeholder="输入配置值" v-model="editConfiguration.value">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add-description" class="col-sm-2 col-form-label text-right">描述</label>
+                        <div class="col-sm-10 form-inline">
+                            <textarea name="description" id="add-description" cols="30" rows="5"  class="form-control form-text col-10" v-model="editConfiguration.description"></textarea>
+                        </div>
+                    </div>
+                </form>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary"  data-dismiss="modal" @click="editConfiguration={}">关闭</button>
+                <button type="button" class="btn btn-primary" @click="update">保存</button>
+            </div>
+        </div>
+    </div>
+</div>

+ 32 - 0
resources/views/maintenance/configuration/_table.blade.php

@@ -0,0 +1,32 @@
+<table class="table table-striped table-sm table-hover" id="list">
+    <tr class="text-center">
+        <th>序号</th>
+        <th>名称</th>
+        <th>值</th>
+        <th>描述</th>
+        <th>操作员</th>
+        <th>创建时间</th>
+        <th>修改时间</th>
+        <th>操作</th>
+    </tr>
+    <tr class="text-center" v-for="(configuration,i) in configurations" :key="configuration.id">
+        <td>@{{ i+1 }}</td>
+        <td>@{{ configuration.name }}</td>
+        <td>@{{ configuration.value  }}</td>
+        <td>@{{ configuration.description  }}</td>
+        <td>
+            <span v-if="configuration.operator">@{{ configuration.operator.name }}</span>
+        </td>
+        <td>@{{ configuration.created_at }}</td>
+        <td>@{{ configuration.updated_at }}</td>
+        <td>
+            @can('系统配置-编辑')
+                <button type="button" class="btn btn-sm btn-outline-primary" @click="edit(configuration,i)">编辑</button>
+            @endcan
+            @can('系统配置-删除')
+                <button type="button" class="btn btn-sm btn-outline-danger" @click="destroy(configuration.id,i)">删除</button>
+            @endcan
+        </td>
+    </tr>
+</table>
+{{$configurations->links()}}

+ 93 - 0
resources/views/maintenance/configuration/index.blade.php

@@ -0,0 +1,93 @@
+@extends('layouts.app')
+
+@section('title','系统配置')
+
+@section('content')
+    <nav class="nav2">
+        @component('maintenance.menu')@endcomponent
+    </nav>
+
+    <div class="container-fluid d-none" id="configuration">
+        <div class="card">
+            @can('系统配置-编辑')
+                @include('maintenance.configuration._create')
+                @include('maintenance.configuration._edit')
+            @endcan
+            <div class="card-body">
+                <div class="row pull-left m-1">
+                    @can('系统配置-编辑')
+                        <button class="btn btn-outline-info mb-1 mr-3" @click="store"><span class="fa fa-plus"></span>&nbsp;新&nbsp;&nbsp;增</button>
+                    @endcan
+                </div>
+                @include('maintenance.configuration._table')
+            </div>
+        </div>
+    </div>
+@endsection
+
+@section('lastScript')
+    <script>
+        let vue = new Vue({
+            el:"#configuration",
+            data:{
+                configurations:{!! $configurations->toJson() !!}['data'],
+                addConfiguration:{},
+                editConfiguration:{},
+                index:'',
+            },
+            mounted(){
+                $('#configuration').removeClass('d-none');
+            },
+            methods:{
+                destroy(id,index){
+                    if (!confirm('是否删除当前项目耗材')) return;
+                    axios.delete('{{url('apiLocal/configuration')}}/'+id).then(res=>{
+                        if(res.data.success){
+                            tempTip.setIndex(100);
+                            tempTip.setDuration(3000);
+                            tempTip.showSuccess('删除成功');
+                            this.$delete(this.configurations,index);
+                            return ;
+                        }
+                        tempTip.setDuration(3000);
+                        tempTip.show(res.data.message);
+                    }).catch(err=>{
+                        tempTip.setDuration(3000);
+                        tempTip.show('删除当前项目耗材失败:'+err);
+                    });
+                },
+                edit(configuration,i){
+                    this.editConfiguration = JSON.parse(JSON.stringify(configuration));
+                    this.index = i;
+                    $('#edit-configuration').modal('show');
+                },
+                update(){
+                    let url = '{{url('apiLocal/configuration/update')}}';
+                    let params = this.editConfiguration;
+                    window.tempTip.postBasicRequest(url,params,res=>{
+                        this.$set(this.configurations,this.index,res);
+                        this.index = null;
+                        this.editConfiguration = {};
+                        $("#edit-configuration").modal('hide');
+                        return "修改完成";
+                    },true);
+                },
+                store(){
+                    $('#add-configuration').modal('show');
+                },
+                create(){
+                    let url = '{{url('apiLocal/configuration/store')}}';
+                    let params = this.addConfiguration;
+                    window.tempTip.postBasicRequest(url,params,res=>{
+                        this.configurations.unshift(res);
+                        this.$forceUpdate();
+                        this.addConfiguration = {};
+                        $("#add-configuration").modal('hide');
+                        return "添加成功";
+                    },true);
+                }
+            }
+        });
+    </script>
+@endsection
+

+ 28 - 0
resources/views/maintenance/material/_create.blade.php

@@ -0,0 +1,28 @@
+<div class="modal fade " id="addModal" tabindex="1" aria-labelledby="title" >
+    <div class="modal-dialog modal-dialog-centered">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title" id="add-title">添加耗材类型</h5>
+                <button type="button" class="close"  data-dismiss="modal">
+                    <span>&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <form>
+                    <div class="form-group">
+                        <label for="material-code">编号</label>
+                        <input type="text" id="material-code" class="form-control" v-model="addMaterial.code">
+                    </div>
+                    <div class="form-group">
+                        <label for="material-name">名称</label>
+                        <input type="text" id="material-name" class="form-control" v-model="addMaterial.name">
+                    </div>
+                </form>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary"  data-dismiss="modal">关闭</button>
+                <button type="button" class="btn btn-primary" @click="create">提交</button>
+            </div>
+        </div>
+    </div>
+</div>

+ 28 - 0
resources/views/maintenance/material/_edit.blade.php

@@ -0,0 +1,28 @@
+<div class="modal fade " id="editModal" tabindex="1" aria-labelledby="title" >
+    <div class="modal-dialog modal-dialog-centered">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title" id="edit-title" >修改耗材类型</h5>
+                <button type="button" class="close"  data-dismiss="modal" @click="editMaterial={}">
+                    <span>&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <form>
+                    <div class="form-group">
+                        <label for="material-code">编号</label>
+                        <input type="text" id="material-code" class="form-control" v-model="editMaterial.code">
+                    </div>
+                    <div class="form-group">
+                        <label for="material-name">名称</label>
+                        <input type="text" id="material-name" class="form-control" v-model="editMaterial.name">
+                    </div>
+                </form>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary"  data-dismiss="modal" @click="editMaterial={}">关闭</button>
+                <button type="button" class="btn btn-primary" @click="update">提交</button>
+            </div>
+        </div>
+    </div>
+</div>

+ 22 - 0
resources/views/maintenance/material/_table.blade.php

@@ -0,0 +1,22 @@
+<table class="table table-striped table-sm table-hover" id="list">
+    <tr class="text-center">
+        <th>序号</th>
+        <th>编号</th>
+        <th>名称</th>
+        <th>操作</th>
+    </tr>
+    <tr class="text-center" v-for="(material,i) in materials">
+        <td>@{{ i+1 }}</td>
+        <td>@{{ material.code }}</td>
+        <td>@{{ material.name }}</td>
+        <td>
+            @can('耗材类型-编辑')
+                <button class="btn btn-sm btn-outline-primary" @click="edit(material,i)">编辑</button>
+            @endcan
+            @can('耗材类型-删除')
+                <button class="btn btn-sm btn-outline-danger" @click="destroy(material.id,i)">删除</button>
+            @endcan
+        </td>
+    </tr>
+</table>
+{{ $materials->links() }}

+ 104 - 0
resources/views/maintenance/material/index.blade.php

@@ -0,0 +1,104 @@
+@extends('layouts.app')
+@section('title','耗材类型')
+
+@section('content')
+    <span id="nav2">
+        @component('maintenance.menu')@endcomponent
+    </span>
+    <div class="container-fluid d-none" id="material_div">
+        @can('耗材类型-编辑')
+            @include('maintenance.material._edit')
+            @include('maintenance.material._create')
+        @endcan
+        <div class="card">
+            <div class="card_body">
+                <div class="row pull-left m-1">
+                    @can('耗材类型-编辑')
+                        <button class="btn btn-outline-info mb-1 mr-3" @click="store"><span class="fa fa-plus"></span>&nbsp;新&nbsp;&nbsp;增</button>
+                    @endcan
+                </div>
+                @include('maintenance.material._table')
+            </div>
+        </div>
+
+    </div>
+@endsection
+@section('lastScript')
+<script>
+    let vue = new Vue({
+        el:'#material_div',
+        data:{
+            materials:{!! $materials->toJson() !!}['data'],
+            editMaterial:{},
+            index:'',
+            addMaterial:{},
+        },
+        mounted() {
+          $('#material_div').removeClass('d-none');
+        },
+        methods:{
+            destroy(id,index){
+                axios.delete('{{url("apiLocal/material/destroy")}}/'+id).then(res=>{
+                    if(res.data.success){
+                        tempTip.setDuration(3000);
+                        tempTip.showSuccess('删除成功');
+                        this.$delete(this.materials,index);
+                        return;
+                    }
+                    tempTip.setDuration(3000);
+                    tempTip.show(res.data.message);
+                }).catch(err=>{
+                    tempTip.setDuration(3000);
+                    tempTip.show(err);
+                });
+            },
+            edit(material,i){
+                this.editMaterial =JSON.parse(JSON.stringify(material));
+                this.index = i;
+                $('#editModal').modal('show');
+            },
+            store(){
+                this.addMaterial = {};
+                $('#addModal').modal('show');
+            },
+            update(index){
+                axios.post('{{url('apiLocal/material/update')}}',this.material)
+                    .then(res=>{
+                        if(res.data.success){
+                            $('#editModal').modal('hide');
+                            tempTip.setDuration(3000);
+                            tempTip.showSuccess('修改成功');
+                            this.$set(this.materials,index,res.data.data);
+                            this.index = '';
+                            return;
+                        }
+                        tempTip.setDuration(3000);
+                        tempTip.show(res.data.message);
+                    }).catch(err=>{
+                    tempTip.setDuration(3000);
+                    tempTip.show(err);
+                });
+            },
+            create(){
+                axios.post('{{url('apiLocal/material/store')}}',this.addMaterial)
+                    .then(res=>{
+                        if(res.data.success){
+                            $('#addModal').modal('hide');
+                            this.addMaterial={};
+                            tempTip.setDuration(3000);
+                            tempTip.showSuccess('添加成功');
+                            this.$set(this.materials,this.materials.length,res.data.data);
+                            return;
+                        }
+                        tempTip.setDuration(3000);
+                        tempTip.show(res.data.message);
+                    }).catch(err=>{
+                        tempTip.setDuration(3000);
+                        tempTip.show(err);
+                });
+            }
+        }
+    });
+</script>
+
+@endsection

+ 16 - 4
resources/views/maintenance/menu.blade.php

@@ -62,10 +62,6 @@
                 <li class="nav-item">
                     <a target="maintenance/logistic" class="nav-link text-dark" href="{{url('maintenance/logistic')}}" :class="{active:isActive('logistic',2)}">承运商</a>
                 </li> @endcan
-            {{--@can('承运商')
-                <li class="nav-item">
-                    <a class="nav-link text-dark" href="{{url('maintenance/carrier')}}" :class="{active:isActive('carrier',2)}">承运商</a>
-                </li> @endcan--}}
             @can('车型')
                 <li class="nav-item">
                     <a target="maintenance/carType" class="nav-link text-dark" href="{{url('maintenance/carType')}}" :class="{active:isActive('carType',2)}">车型</a>
@@ -107,6 +103,22 @@
                 <li class="nav-item">
                     <a target="maintenance/log" class="nav-link text-muted" href="{{url('maintenance/log')}}" :class="{active:isActive('log',2)}">日志</a>
                 </li> @endcan
+            @can('耗材类型')
+                <li class="nav-item">
+                    <a class="nav-link text-muted" href="{{url('maintenance/material')}}" :class="{active:isActive('material',2)}">耗材类型</a>
+                </li>@endcan
+            @can('项目耗材')
+                <li class="nav-item">
+                    <a class="nav-link text-muted" href="{{url('maintenance/ownerMaterial')}}" :class="{active:isActive('ownerMaterial',2)}">项目耗材</a>
+                </li>@endcan
+            @can('供应商')
+                <li class="nav-item">
+                    <a class="nav-link text-muted" href="{{url('maintenance/supplier')}}" :class="{active:isActive('supplier',2)}">供应商</a>
+                </li>@endcan
+            @can('系统配置')
+                <li class="nav-item">
+                    <a class="nav-link text-muted" href="{{url('maintenance/configuration')}}" :class="{active:isActive('configuration',2)}">系统配置</a>
+                </li>@endcan
         </ul>
     </div>
 </div>

+ 62 - 0
resources/views/maintenance/ownerMaterial/_create.blade.php

@@ -0,0 +1,62 @@
+<div class="modal " id="add-ownerMaterial" tabindex="-1" >
+    <div class="modal-dialog modal-lg modal-dialog-centered">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title text-center">项目耗材添加</h5>
+                <button type="button" class="close" data-dismiss="modal">
+                    <span>&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <form class="form">
+                    <div class="form-group row">
+                        <label for="add-owner-id" class="col-sm-2 col-form-label text-right">货主</label>
+                        <div class="col-sm-10 form-inline">
+                            <select name="owner_id" id="add-owner-id" class="form-control col-sm-5 required" v-model="addOwnerMaterial.owner_id">
+                                <option v-for="(owner,i) in filterOwners"  :value="owner.id">@{{ owner.name }}</option>
+                            </select>
+                            <input type="text" placeholder="输入货主进行筛选" class="form-control col-sm-4 offset-1" @change="filterOwner($event)">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add-material-code" class="col-sm-2 col-form-label text-right">耗材编码</label>
+                        <div class="col-sm-10 form-inline">
+                            <input type="text" name="material-code" id="add-material-code" class="form-control col-sm-10" placeholder="耗材编码" v-model="addOwnerMaterial.material_code">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add_material_id" class="col-sm-2 col-form-label text-right">耗材</label>
+                        <div class="col-sm-10 form-inline">
+                            <select name="material_id" id="add_material_id" class="form-control col-sm-5" required v-model="addOwnerMaterial.material_id">
+                                <option v-for="(materials,i) in filterMaterials"  :value="materials.id">@{{ materials.code }}</option>
+                            </select>
+                            <input type="text" placeholder="输入耗材进行筛选" class="form-control col-m-4 offset-1" @change="filterMaterial($event)">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add-size" class="col-sm-2 col-form-label text-right">尺寸</label>
+                        <div class="col-sm-10 form-inline">
+                            <input type="text" id="add-size" class="form-control col-10" name="size" placeholder="项目耗材尺寸" v-model="addOwnerMaterial.size">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add-special" class="col-sm-2 col-form-label text-right">特殊要求</label>
+                        <div class="col-sm-10 form-inline">
+                            <textarea name="special" id="add-special" cols="30" rows="3" class="form-control form-text col-10" v-model="addOwnerMaterial.special"></textarea>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add-specification" class="col-sm-2 col-form-label text-right">材质规格</label>
+                        <div class="col-sm-10 form-inline">
+                            <textarea name="specification" id="add-specification" cols="30" rows="5" class="form-control form-text col-10" v-model="addOwnerMaterial.specification"></textarea>
+                        </div>
+                    </div>
+                </form>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary"  data-dismiss="modal" @click="addOwnerMaterial={}">关闭</button>
+                <button type="button" class="btn btn-primary" @click="create">提交</button>
+            </div>
+        </div>
+    </div>
+</div>

+ 62 - 0
resources/views/maintenance/ownerMaterial/_edit.blade.php

@@ -0,0 +1,62 @@
+<div class="modal " id="edit-ownerMaterial" tabindex="-1" >
+    <div class="modal-dialog modal-lg modal-dialog-centered">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title text-center">项目耗材编辑</h5>
+                <button type="button" class="close" data-dismiss="modal" @click="editOwnerMaterial={}">
+                    <span>&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <form class="form">
+                    <div class="form-group row">
+                        <label for="edit-owner-id" class="col-sm-2 col-form-label text-right">货主</label>
+                        <div class="col-sm-10 form-inline">
+                            <select   id="edit-owner-id" class="form-control col-sm-5" v-model="editOwnerMaterial.owner_id">
+                                <option v-for="(owner,i) in filterOwners"  :value="owner.id">@{{ owner.name }}</option>
+                            </select>
+                            <input type="text" placeholder="输入货主进行筛选" class="form-control col-sm-4 offset-1" @change="filterOwner($event)">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="edit-material-code" class="col-sm-2 col-form-label text-right">耗材编码</label>
+                        <div class="col-sm-10 form-inline">
+                            <input type="text"  id="edit-material-code" class="form-control col-sm-10" v-model="editOwnerMaterial.material_code" placeholder="耗材编码" >
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="edit-material-id" class="col-sm-2 col-form-label text-right">耗材</label>
+                        <div class="col-sm-10 form-inline">
+                            <select  id="edit-material-id" class="form-control col-sm-5" v-model="editOwnerMaterial.material_id">
+                                <option v-for="(materials,i) in filterMaterials"  :value="materials.id">@{{ materials.code }}</option>
+                            </select>
+                            <input type="text" placeholder="输入耗材进行筛选" class="form-control col-m-4 offset-1" @change="filterMaterial($event)">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="edit-size" class="col-sm-2 col-form-label text-right">尺寸</label>
+                        <div class="col-sm-10 form-inline">
+                            <input type="text" id="edit-size" class="form-control col-10"   v-model="editOwnerMaterial.size" placeholder="项目耗材尺寸">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="edit-special" class="col-sm-2 col-form-label text-right">特殊要求</label>
+                        <div class="col-sm-10 form-inline">
+                            <textarea   id="edit-special" cols="30" rows="3" v-model="editOwnerMaterial.special" class="form-control form-text col-10"></textarea>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="edit-specification" class="col-sm-2 col-form-label text-right">材质规格</label>
+                        <div class="col-sm-10 form-inline">
+                            <textarea   id="edit-specification" cols="30" rows="5"  class="form-control form-text col-10" v-model="editOwnerMaterial.specification"></textarea>
+                        </div>
+                    </div>
+                </form>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary"  data-dismiss="modal" @click="editOwnerMaterial={}">关闭</button>
+                <button type="button" class="btn btn-primary" @click="update">保存</button>
+            </div>
+        </div>
+    </div>
+</div>

+ 49 - 0
resources/views/maintenance/ownerMaterial/_table.blade.php

@@ -0,0 +1,49 @@
+<table class="table table-striped table-sm table-hover" id="list">
+    <tr class="text-center">
+        <th>序号</th>
+        <th>货主</th>
+        <th>耗材编码</th>
+        <th>尺寸</th>
+        <th>特殊要求</th>
+        <th>材质规格</th>
+        <th>附件</th>
+        <th>创建者</th>
+        <th>创建时间</th>
+        <th>操作</th>
+    </tr>
+    <tr class="text-center" v-for="(ownerMaterial,i) in ownerMaterials">
+        <td>@{{ i+1 }}</td>
+        <td>
+            <span v-if="ownerMaterial.owner">@{{ ownerMaterial.owner.name }}</span>
+        </td>
+        <td>@{{ ownerMaterial.material_code  }}</td>
+        <td>@{{ ownerMaterial.size }}</td>
+        <td>@{{ ownerMaterial.special }}</td>
+        <td>@{{ ownerMaterial.specification }}</td>
+        <td>
+            <div class="align-center text-center" >
+                @can('项目耗材-文件上传')
+                    <span v-if="ownerMaterial.file">
+                        <a target='_blank' :href="getDownFileUrl(ownerMaterial)" class="text-primary text-decoration is-hover"  style="cursor: default" >
+                            <i class="fa fa-download"></i>&nbsp;@{{ ownerMaterial.file.file_name }}
+                        </a>
+                    </span>
+                    <button v-else type="button" class="btn btn-sm btn-outline-dark"  @click="uploadModal(ownerMaterial,i)">文件上传</button>
+                @endcan
+            </div>
+        </td>
+        <td>
+            <span v-if="ownerMaterial.initiator">@{{ ownerMaterial.initiator.name }}</span>
+        </td>
+        <td>@{{ ownerMaterial.created_at }}</td>
+        <td>
+            @can('项目耗材-编辑')
+                <button type="button" class="btn btn-sm btn-outline-primary" @click="edit(ownerMaterial,i)">编辑</button>
+            @endcan
+            @can('项目耗材-删除')
+                <button type="button" class="btn btn-sm btn-outline-danger" @click="destroy(ownerMaterial.id,i)">删除</button>
+            @endcan
+        </td>
+    </tr>
+</table>
+{{$ownerMaterials->links()}}

+ 27 - 0
resources/views/maintenance/ownerMaterial/_uploadFile.blade.php

@@ -0,0 +1,27 @@
+<div class="modal fade" tabindex="-1" role="dialog" id="uploadFile">
+    <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5>文件上传</h5>
+                <button type="button" class="close" data-dismiss="modal" @click="editOwnerMaterial={}">&times;</button>
+            </div>
+            <div class="modal-body">
+                <div class="container-fluid">
+                    <div class="text-center small row mb-1" v-if="uploadError">
+                        <div class="col-3 text-danger">上传失败</div>
+                        <div class="col-8">
+                            <b v-for="err in uploadError">@{{ err }}<br></b>
+                        </div>
+                    </div>
+                </div>
+                <div>
+                    <input type="file" class=" form-control-file" id="updatafile-input" ref="file">
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button class="btn btn-success" data-dismiss="modal" @click="editOwnerMaterial={}">取消</button>
+                <button class="btn btn-success" @click="uploadFile()">开始上传</button>
+            </div>
+        </div>
+    </div>
+</div>

+ 169 - 0
resources/views/maintenance/ownerMaterial/index.blade.php

@@ -0,0 +1,169 @@
+@extends('layouts.app')
+
+@section('title','项目耗材')
+
+@section('content')
+    <nav class="nav2">
+        @component('maintenance.menu')@endcomponent
+    </nav>
+
+    <div class="container-fluid d-none" id="owner_material">
+        <div class="card">
+            @can('项目耗材-编辑')
+                @include('maintenance.ownerMaterial._create')
+                @include('maintenance.ownerMaterial._edit')
+            @endcan
+            <div class="card-body">
+                <div class="row pull-left m-1">
+                    @can('项目耗材-编辑')
+                        <button class="btn btn-outline-info mb-1 mr-3" @click="store"><span class="fa fa-plus"></span>&nbsp;新&nbsp;&nbsp;增</button>
+                    @endcan
+                </div>
+                @include('maintenance.ownerMaterial._table')
+            </div>
+        </div>
+        @can('项目耗材-文件上传')
+            @include('maintenance.ownerMaterial._uploadFile')
+        @endcan
+    </div>
+@endsection
+
+@section('lastScript')
+<script>
+    let vue = new Vue({
+        el:"#owner_material",
+        data:{
+            ownerMaterials:{!! $ownerMaterials->toJson() !!}['data'],
+            owners:{!! $owners->toJson() !!},
+            materials:{!! $materials->toJson() !!},
+            addOwnerMaterial:{},
+            editOwnerMaterial:{},
+            index:'',
+            filterOwners:'',
+            filterMaterials:'',
+            uploadError: null,
+        },
+        mounted(){
+            $('#owner_material').removeClass('d-none');
+            this.filterOwners = JSON.parse(JSON.stringify(this.owners));
+            this.filterMaterials = JSON.parse(JSON.stringify(this.materials));
+        },
+        created(){
+            let _this = this;
+            this.ownerMaterials.forEach(function(item){
+                _this.fileType(item);
+            })
+        },
+        methods:{
+            fileType(ownerMaterial){
+                let file_types = [ 'gif','jpeg','jpg','png','svg'];
+                if(!ownerMaterial.file){
+                    ownerMaterial.isImg = false;
+                    return;
+                }
+                if(ownerMaterial.file.url){
+                    let target = ownerMaterial.file.url;
+                    let index= target.lastIndexOf(".");
+                    let ext = target.substr(index+1);
+                    if(file_types.includes(ext)){
+                        ownerMaterial.isImg = true;
+                    }
+                }
+            },
+            destroy(id,index){
+                if (!confirm('是否删除当前项目耗材')) return;
+                axios.delete('{{url('apiLocal/ownerMaterial')}}/'+id).then(res=>{
+                    if(res.data.success){
+                        tempTip.setIndex(100);
+                        tempTip.setDuration(3000);
+                        tempTip.showSuccess('删除成功');
+                        this.$delete(this.ownerMaterials,index);
+                        return ;
+                    }
+                    tempTip.setDuration(3000);
+                    tempTip.show(res.data.message);
+                }).catch(err=>{
+                    tempTip.setDuration(3000);
+                    tempTip.show('删除当前项目耗材失败:'+err);
+                });
+            },
+            edit(ownerMaterial,i){
+                this.editOwnerMaterial = JSON.parse(JSON.stringify(ownerMaterial));
+                this.index = i;
+                $('#edit-ownerMaterial').modal('show');
+            },
+            update(){
+                let url = '{{url('apiLocal/ownerMaterial/update')}}';
+                let params = this.editOwnerMaterial;
+                window.tempTip.postBasicRequest(url,params,res=>{
+                    this.fileType(res);
+                    this.$set(this.ownerMaterials,this.index,res);
+                    this.index = null;
+                    this.editOwnerMaterial = {};
+                    $("#edit-ownerMaterial").modal('hide');
+                    return "修改完成";
+                },true);
+            },
+            store(){
+                $('#add-ownerMaterial').modal('show');
+            },
+            create(){
+                let url = '{{url('apiLocal/ownerMaterial/store')}}';
+                let params = this.addOwnerMaterial;
+                window.tempTip.postBasicRequest(url,params,res=>{
+                    this.$set(this.ownerMaterials,this.ownerMaterials.length,res);
+                    this.addOwnerMaterial = {};
+                    $("#add-ownerMaterial").modal('hide');
+                    return "OK";
+                },true);
+            },
+            uploadModal(ownerMaterial,i){
+                this.editOwnerMaterial = JSON.parse(JSON.stringify(ownerMaterial));
+                this.index = i;
+                $('#uploadFile').modal('show');
+            },
+            getDownFileUrl(ownerMaterial){
+                return '{{ url("maintenance/ownerMaterial/downFile?file=")}}'+ownerMaterial.file.url+'&name='+ownerMaterial.file.file_name;
+            },
+            uploadFile(){
+                let url = '{{url('apiLocal/ownerMaterial/uploadFile')}}';
+                let data = new FormData();
+                let file = this.$refs.file.files[0];
+                if(file===null){
+                    if (!confirm('请选则上传文件')) return;
+                }
+                data.append('file',file);
+                data.append('id',this.editOwnerMaterial.id);
+                window.tempTip.postBasicRequest(url,data,res=>{
+                    this.fileType(res);
+                    this.$set(this.ownerMaterials,this.index,res);
+                    this.editOwnerMaterial = {};
+                    this.index = '';
+                    $("#uploadFile").modal('hide');
+                    return "上传成功";
+                },true);
+            },
+            filterMaterial(e){
+                let value = $(e.target).val();
+                if(value==='' || value===null)this.filterMaterials = this.materials;
+                else {
+                    this.filterMaterials = this.materials.filter(function(item){
+                        return item.code.indexOf(value) !== -1;
+                    });
+                }
+            },
+            filterOwner(e){
+                let value = $(e.target).val();
+                if(value==='' || value===null)this.filterMaterials = this.materials;
+                else {
+                    this.filterOwners = this.owners.filter(function(item){
+                        return item.name.indexOf(value) !== -1;
+                    });
+                }
+            }
+
+        }
+    });
+</script>
+@endsection
+

+ 46 - 4
resources/views/maintenance/priceModel/operation/create.blade.php

@@ -65,12 +65,42 @@
             </div>
             <div class="row mt-3">
                 <label for="priority" class="col-2">优先级</label>
-                <input id="priority" type="number" min="0" value="0" name="priority" :class="errors.priority ? 'is-invalid' : ''" class="col-6 form-control" v-model="model.priority" required>
+                <input id="priority" type="number" min="0" name="priority" :class="errors.priority ? 'is-invalid' : ''" class="col-6 form-control" v-model="model.priority" required>
                 <span class="invalid-feedback mt-0 offset-2" role="alert" v-if="errors.priority">
                     <strong>@{{ errors.priority[0] }}</strong>
                 </span>
             </div>
+            <div class="row mt-3" v-if="model.operation_type == '出库'">
+                <label class="col-2" for="isDiscount">是否满减</label>
+                <div class="col-2">
+                    <input type="checkbox" id="isDiscount" class="rounded mt-1" v-model="model.isDiscount">
+                </div>
+                <div class="col-8 row" v-if="model.isDiscount">
+                    <label class="col-3" for="discount">满减值</label>
+                    <input id="discount" v-model="model.discount_count" name="discount_count"
+                           class="form-control form-control-sm col-6" :class="errors.discount_count ? 'is-invalid' : ''" step="1" type="number" min="0">
+                </div>
+            </div>
             <div class="row mt-3">
+                <label class="col-2" for="isSingle">按单计价</label>
+                <div class="col-2">
+                    <input type="checkbox" id="isSingle" class="pull-left rounded mt-1" v-model="model.isSingle">
+                </div>
+                <div class="col-8 row" v-if="model.isSingle">
+                    <label class="col-3" for="total_price">普通价格</label>
+                    <input id="total_price" name="total_price" v-model="model.total_price"
+                           class="form-control form-control-sm col-6" :class="errors.total_price ? 'is-invalid' : ''" step="0.001" type="number" min="0">
+                </div>
+            </div>
+            <div class="row mt-1" v-if="model.isSingle && model.isDiscount">
+                <label class="col-2"></label><div class="col-2"></div>
+                <div class="col-8 row">
+                    <label class="col-3" for="total_discount_price">满减价格</label>
+                    <input id="total_discount_price" name = "total_discount_price" v-model="model.total_discount_price"
+                           class="form-control form-control-sm col-6" :class="errors.total_discount_price ? 'is-invalid' : ''" step="0.001" type="number" min="0">
+                </div>
+            </div>
+            <div class="row mt-3" v-if="!model.isSingle">
                 <div v-for="(item,i) in model.items" class="card row text-white col-8" :class="i>0 ? 'bg-secondary mt-2' : 'bg-info'">
                     <div class="card-header">
                         <div class="pull-left" v-if="i==0"><span @click="addRule()" class="fa fa-plus-square-o" style="cursor: pointer"></span></div>
@@ -130,6 +160,11 @@
                             <label v-if="item.feature">@{{ item.feature }}</label>
                             <button type="button" class="btn btn-dark col-2 ml-2" @click="showAddFeatureModal(i,item.feature)">调整特征</button>
                         </div>
+                        <div class="row mt-2" v-if="model.isDiscount">
+                            <label class="col-2" for="discount_price">满减单价:</label>
+                            <input class="col-5 form-control form-control-sm" id="discount_price" name="discount_price" v-model="item.discount_price"
+                                type="number" step="0.001" min="0">
+                        </div>
                     </div>
                 </div>
                 <label hidden><input name="items" :value="JSON.stringify(model.items)"></label>
@@ -157,8 +192,11 @@
                     operation_type:"{{old('operation_type') ?? (isset($model) ? $model->operation_type : '')}}",
                     strategy:"{{old('strategy') ?? (isset($model) ? $model->strategy : '')}}",
                     name:"{{old('name') ?? (isset($model) ? $model->name : '')}}",
-                    priority:"{{old('priority') ?? (isset($model) ? $model->priority : '')}}",
+                    priority:"{{old('priority') ?? (isset($model) ? $model->priority : 0)}}",
                     feature:"{{old('feature') ?? (isset($model) ? $model->feature : '')}}",
+                    discount_count:"{{old('discount_count') ?? (isset($model) ? $model->discount_count : '')}}",
+                    total_price:"{{old('total_price') ?? (isset($model) ? $model->total_price : '')}}",
+                    total_discount_price:"{{old('total_discount_price') ?? (isset($model) ? $model->total_discount_price : '')}}",
                     remark:"{{old('remark') ?? (isset($model) ? $model->remark : '')}}",
                     items:{!! old('items') ? json_encode(old('items')) : (isset($model)&&$model->items ? $model->items : "[{strategy:'',amount:'',unit_id:'',unit_price:'',feature:'',priority:''}]")!!},
                 },
@@ -172,14 +210,18 @@
                     {id:"{{$unit->id}}",name:"{{$unit->name}}"},
                     @endforeach
                 ],
-                type : ['商品名称','订单类型','承运商','店铺类型','订单数'],
-                logic : ['包含','不包含','等于','大于','大于等于','小于','小于等于'],
+                type : ['商品名称','订单类型','承运商','店铺类型'],
+                logic : ['包含','不包含','等于'],
                 features : [],
                 thisIndex : "",
                 errors:{!! $errors !!},
                 existStrategy:{default:false,starting:false},
                 oldFeature : '',
             },
+            mounted(){
+                this.$set(this.model,"isSingle",!!this.model.total_price);
+                this.$set(this.model,"isDiscount",!!this.model.discount_count);
+            },
             methods:{
                 outRuleUnique(strategy){
                     if (strategy==='起步') this.existStrategy.starting = true;

+ 3 - 3
resources/views/maintenance/priceModel/operation/index.blade.php

@@ -47,7 +47,7 @@
                 <td>@{{ model.totalDiscountPrice }}</td>
                 <td>@{{ model.discountDate }}</td>
                 <td>@{{ model.feature }}</td>
-                <td>@{{ model.remark }}</td>
+                <td><div class="text-overflow-warp-200">@{{ model.remark }}</div></td>
                 <td>@{{ model.createdAt }}</td>
                 <td>
                     @can("计费模型-作业-编辑")<button type="button" class="btn btn-sm btn-outline-info" @click="edit(model.id)">编辑</button>@endcan
@@ -161,8 +161,8 @@
                 items : [],
                 updateDetailId : '',
                 units : null,
-                type : ['商品名称','订单类型','承运商','店铺类型','订单数'],
-                logic : ['包含','不包含','等于','大于','大于等于','小于','小于等于'],
+                type : ['商品名称','订单类型','承运商','店铺类型'],
+                logic : ['包含','不包含','等于'],
                 item : {
                     "strategy" : '特征',
                     "amount" : "",

+ 56 - 11
resources/views/maintenance/region/index.blade.php

@@ -1,50 +1,70 @@
 @extends('layouts.app')
 @section('title')设置@endsection
-
 @section('content')
-    @component('maintenance.menu')@endcomponent
+    <span id="nav2">
+       @component('maintenance.menu')@endcomponent
+    </span>
     <div class="container-fluid d-none" id="container">
         <div class="card">
             <div class="card-body mt-2">
                 <div class="ml-2">
                     <div v-for="region in parentMapping[0]" :style="{'margin-left':(2+region.type)+'%'}">
                         <div>
-                            <span class="fa fa-hand-o-right cursor-pointer" @click="showItem('tree-'+region.id,$event)" v-if="parentMapping[region.id]"></span>
+                            <span class="fa fa-hand-o-right cursor-pointer" :id="'fa-tree-'+region.id" @click="showItem('tree-'+region.id,$event)" v-if="parentMapping[region.id]"></span>
                             <span v-else>&nbsp;&nbsp;&nbsp;</span>
                             &nbsp;&nbsp;<span class="fa fa-circle" :class="region.deleted_at ? 'text-danger' : 'text-success'"></span>&nbsp;
                             @{{ region.name }}<label class="text-secondary" v-if="region.code">(@{{ region.code }})</label>
+                            <label class="cursor-pointer" @click="addRegion(region.id,region.type)">&nbsp;<span class="fa fa-plus-circle"></span></label>
                         </div>
                         <div :id="'tree-'+region.id" class="up">
                             <div v-for="city in parentMapping[region.id]" :style="{'margin-left':(2+city.type)+'%'}">
-                                <div>
-                                    <span class="fa fa-hand-o-right cursor-pointer" @click="showItem('tree-'+city.id,$event)" v-if="parentMapping[city.id]"></span>
+                                <div v-if="city.id">
+                                    <span class="fa fa-hand-o-right cursor-pointer" :id="'fa-tree-'+city.id" @click="showItem('tree-'+city.id,$event)" v-if="parentMapping[city.id]"></span>
                                     <span v-else>&nbsp;&nbsp;&nbsp;</span>
                                     &nbsp;&nbsp;<span class="fa fa-circle" :class="city.deleted_at ? 'text-danger' : 'text-success'"></span>&nbsp;
                                     @{{ city.name }}<label class="text-secondary" v-if="city.code">(@{{ city.code }})</label>
+                                    <label class="cursor-pointer" @click="addRegion(city.id,city.type)">&nbsp;<span class="fa fa-plus-circle"></span></label>
                                 </div>
+                                <label v-else>
+                                    <input @blur="submitRegion(city,region.id)" @keydown.13="submitRegion(city,region.id)" id="tree-edit-0" v-model="city.name"
+                                           class="form-control form-control-sm rounded-pill ml-1" type="text" placeholder="添加城市"/>
+                                </label>
                                 <div :id="'tree-'+city.id" class="up">
                                     <div v-for="district in parentMapping[city.id]" :style="{'margin-left':(2+district.type)+'%'}">
-                                        <div>
-                                            <span class="fa fa-hand-o-right cursor-pointer" @click="showItem('tree-'+district.id,$event)" v-if="parentMapping[district.id]"></span>
+                                        <div v-if="district.id">
+                                            <span class="fa fa-hand-o-right cursor-pointer" :id="'fa-tree-'+district.id" @click="showItem('tree-'+district.id,$event)" v-if="parentMapping[district.id]"></span>
                                             <span v-else>&nbsp;&nbsp;&nbsp;</span>
                                             &nbsp;&nbsp;<span class="fa fa-circle" :class="district.deleted_at ? 'text-danger' : 'text-success'"></span>&nbsp;
                                             @{{ district.name }}<label class="text-secondary" v-if="district.code">(@{{ district.code }})</label>
+                                            <label class="cursor-pointer" @click="addRegion(district.id,district.type)">&nbsp;<span class="fa fa-plus-circle"></span></label>
                                         </div>
+                                        <label v-else>
+                                            <input @blur="submitRegion(district,city.id)" @keydown.13="submitRegion(district,city.id)" id="tree-edit-0" v-model="district.name"
+                                                   class="form-control form-control-sm rounded-pill ml-1" type="text" placeholder="添加区/县"/>
+                                        </label>
                                         <div :id="'tree-'+district.id" class="up">
                                             <div v-for="town in parentMapping[district.id]" :style="{'margin-left':(2+town.type)+'%'}">
-                                                <div>
-                                                    <span class="fa fa-hand-o-right cursor-pointer" @click="showItem('tree-'+town.id,$event)" v-if="parentMapping[town.id]"></span>
+                                                <div v-if="town.id">
+                                                    <span class="fa fa-hand-o-right cursor-pointer" :id="'fa-tree-'+town.id" @click="showItem('tree-'+town.id,$event)" v-if="parentMapping[town.id]"></span>
                                                     <span v-else>&nbsp;&nbsp;&nbsp;</span>
                                                     &nbsp;&nbsp;<span class="fa fa-circle" :class="town.deleted_at ? 'text-danger' : 'text-success'"></span>&nbsp;
                                                     @{{ town.name }}<label class="text-secondary" v-if="town.code">(@{{ town.code }})</label>
+                                                    <label class="cursor-pointer" @click="addRegion(town.id,town.type)">&nbsp;<span class="fa fa-plus-circle"></span></label>
                                                 </div>
+                                                <label v-else>
+                                                    <input @blur="submitRegion(town,district.id)" @keydown.13="submitRegion(town,district.id)" id="tree-edit-0" v-model="town.name"
+                                                           class="form-control form-control-sm rounded-pill ml-1" type="text" placeholder="添加乡/镇"/>
+                                                </label>
                                                 <div :id="'tree-'+town.id" class="up">
                                                     <div v-for="street in parentMapping[town.id]" :style="{'margin-left':(2+street.type)+'%'}">
-                                                        <div>
-                                                            {{--<span class="fa fa-hand-o-right cursor-pointer" @click="showItem('tree-'+street.id,$event)"></span>&nbsp;&nbsp;--}}
+                                                        <div v-if="street.id">
                                                             <span class="fa fa-circle" :class="street.deleted_at ? 'text-danger' : 'text-success'"></span>&nbsp;
                                                             @{{ street.name }}<label class="text-secondary" v-if="street.code">(@{{ street.code }})</label>
                                                         </div>
+                                                        <label v-else>
+                                                            <input @blur="submitRegion(street,town.id)" @keydown.13="submitRegion(street,town.id)" id="tree-edit-0" v-model="street.name"
+                                                                   class="form-control form-control-sm rounded-pill ml-1" type="text" placeholder="添加村/街"/>
+                                                        </label>
                                                     </div>
                                                 </div>
                                             </div>
@@ -98,6 +118,31 @@
                         $("#"+id).slideDown();
                     }
                 },
+                addRegion(id,type){
+                    let obj = {name:"",code:"",type:Number(type)+1,parent_id:id};
+                    if (this.parentMapping[id])this.parentMapping[id].unshift(obj);
+                    else this.$set(this.parentMapping,id,[obj]);
+                    setTimeout(()=>{
+                        if (!this.showList[id]){
+                            this.showList[id] = true;
+                            document.getElementById("fa-tree-"+id).className = "fa fa-hand-o-down cursor-pointer";
+                            $("#tree-"+id).slideDown();
+                        }
+                        $("#tree-edit-0").focus();
+                    },0);
+                },
+                submitRegion(region,parent){
+                    if (region.id)return;
+                    if (!region.name){
+                        this.$delete(this.parentMapping[parent],0);
+                        if (this.parentMapping[parent].length === 0)this.$delete(this.parentMapping,parent);
+                        return;
+                    }
+                    window.tempTip.postBasicRequest("{{url('maintenance/region/store')}}",{name:region.name,parent_id:region.parent_id,type:region.type},res=>{
+                        region.id = res.id;
+                        this.$set(this.parentMapping[parent][0],region);
+                    })
+                },
             },
         });
     </script>

+ 62 - 0
resources/views/maintenance/supplier/_create.blade.php

@@ -0,0 +1,62 @@
+<div class="modal " id="add-supplier" tabindex="-1" >
+    <div class="modal-dialog modal-lg modal-dialog-centered">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title text-center">供应商添加</h5>
+                <button type="button" class="close" data-dismiss="modal" @click="addSupplier={}">
+                    <span>&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <form class="form">
+                    <div class="form-group row">
+                        <label for="add-name" class="col-sm-3 col-form-label text-right">名称</label>
+                        <div class="col-sm-9 form-inline">
+                            <input type="text"id="add-name" class="form-control col-9"  v-model="addSupplier.name"  placeholder="供应商名称" >
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add-contact-man" class="col-sm-3 col-form-label text-right">联系人</label>
+                        <div class="col-sm-9 form-inline">
+                            <input type="text" name="material-code" id="add-contact-man" class="form-control col-9" v-model="addSupplier.contact_man" placeholder="联系人" >
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add-phone" class="col-sm-3 col-form-label text-right">联系电话</label>
+                        <div class="col-sm-9 form-inline">
+                            <input type="text" name="material-code" id="add-phone" class="form-control col-9" v-model="addSupplier.phone" placeholder="联系电话" >
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add-invoice-title" class="col-sm-3 col-form-label text-right">发票抬头</label>
+                        <div class="col-sm-9 form-inline">
+                            <input type="text" id="add-invoice-title"  class="form-control col-9" v-model="addSupplier.invoice_title" placeholder="发票抬头">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add-bank" class="col-sm-3 col-form-label text-right">账户银行</label>
+                        <div class="col-sm-9 form-inline">
+                            <input type="text" id="add-bank" class="form-control col-9" name="size" v-model="addSupplier.bank" placeholder="账户银行">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add-bank-account " class="col-sm-3 col-form-label text-right">收款账户</label>
+                        <div class="col-sm-9 form-inline">
+                            <input type="text" id="add-bank-account " class="form-control col-9" name="size" v-model="addSupplier.bank_account " placeholder="账户银行">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="add-opening-bank " class="col-sm-3 col-form-label text-right">开户行</label>
+                        <div class="col-sm-9 form-inline">
+                            <textarea name="specification" id="add-opening-bank " cols="30" rows="5"  class="form-control form-text col-10" v-model="addSupplier.opening_bank "></textarea>
+                        </div>
+                    </div>
+                </form>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary"  data-dismiss="modal" @click="addSupplier={}">关闭</button>
+                <button type="button" class="btn btn-primary" @click="create">提交</button>
+            </div>
+        </div>
+    </div>
+</div>

+ 62 - 0
resources/views/maintenance/supplier/_edit.blade.php

@@ -0,0 +1,62 @@
+<div class="modal " id="edit-supplier" tabindex="-1" >
+    <div class="modal-dialog modal-lg modal-dialog-centered">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title text-center">供应商编辑</h5>
+                <button type="button" class="close" data-dismiss="modal" @click="editOwnerMaterial={}">
+                    <span>&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <form class="form">
+                    <div class="form-group row">
+                        <label for="edit-name" class="col-sm-3 col-form-label text-right">名称</label>
+                        <div class="col-sm-9 form-inline">
+                            <input type="text"id="edit-name" class="form-control col-sm-10"  v-model="editSupplier.name"  placeholder="供应商名称" >
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="edit-contact-man" class="col-sm-3 col-form-label text-right">联系人</label>
+                        <div class="col-sm-9 form-inline">
+                            <input type="text" name="material-code" id="edit-contact-man" class="form-control col-sm-10" v-model="editSupplier.contact_man" placeholder="联系人" >
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="edit-phone" class="col-sm-3 col-form-label text-right">联系电话</label>
+                        <div class="col-sm-9 form-inline">
+                            <input type="text" name="phone" id="edit-phone" class="form-control col-9" v-model="editSupplier.phone" placeholder="联系电话" >
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="edit-invoice-title" class="col-sm-3 col-form-label text-right">发票抬头</label>
+                        <div class="col-sm-9 form-inline">
+                            <input type="text" id="edit-invoice-title"  class="form-control col-10" v-model="editSupplier.invoice_title" placeholder="发票抬头">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="edit-bank" class="col-sm-3 col-form-label text-right">账户银行</label>
+                        <div class="col-sm-9 form-inline">
+                            <input type="text" id="edit-bank" class="form-control col-10" name="size" v-model="editSupplier.bank" placeholder="账户银行">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="edit-bank-account " class="col-sm-3 col-form-label text-right">收款账户</label>
+                        <div class="col-sm-9 form-inline">
+                            <input type="text" id="edit-bank-account " class="form-control col-10" name="size" v-model="editSupplier.bank_account " placeholder="账户银行">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="edit-opening-bank " class="col-sm-3 col-form-label text-right">开户行</label>
+                        <div class="col-sm-9 form-inline">
+                            <textarea name="specification" id="edit-opening-bank " cols="30" rows="5"  class="form-control form-text col-10" v-model="editSupplier.opening_bank "></textarea>
+                        </div>
+                    </div>
+                </form>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary"  data-dismiss="modal" @click="editSupplier={}">关闭</button>
+                <button type="button" class="btn btn-primary" @click="update">保存</button>
+            </div>
+        </div>
+    </div>
+</div>

+ 32 - 0
resources/views/maintenance/supplier/_table.blade.php

@@ -0,0 +1,32 @@
+<table class="table table-striped table-sm table-hover" id="list">
+    <tr class="text-center">
+        <th>序号</th>
+        <th>名称</th>
+        <th>联系人</th>
+        <th>电话</th>
+        <th>发票抬头</th>
+        <th>账户银行</th>
+        <th>收款账户</th>
+        <th>开户行</th>
+        <th>操作</th>
+    </tr>
+    <tr class="text-center" v-for="(supplier,i) in suppliers">
+        <td>@{{ i+1 }}</td>
+        <td>@{{ supplier.name }}</td>
+        <td>@{{ supplier.contact_man}}</td>
+        <td>@{{ supplier.phone }}</td>
+        <td>@{{ supplier.invoice_title }}</td>
+        <td>@{{ supplier.bank }}</td>
+        <td>@{{ supplier.bank_account}}</td>
+        <td>@{{ supplier.opening_bank}}</td>
+        <td>
+            @can('供应商-编辑')
+                <button type="button" class="btn btn-sm btn-outline-primary" @click="edit(supplier,i)">编辑</button>
+            @endcan
+            @can('供应商-删除')
+                <button type="button" class="btn btn-sm btn-outline-danger" @click="destroy(supplier.id,i)">删除</button>
+            @endcan
+        </td>
+    </tr>
+</table>
+{{$suppliers->links()}}

+ 88 - 0
resources/views/maintenance/supplier/index.blade.php

@@ -0,0 +1,88 @@
+@extends('layouts.app')
+@section('title','供应商')
+@section('content')
+    <nav class="nav2">
+        @component('maintenance.menu')@endcomponent
+    </nav>
+    <div class="container-fluid d-none" id="supplier">
+        <div class="card">
+            @can('供应商-编辑')
+                @include('maintenance.supplier._create')
+                @include('maintenance.supplier._edit')
+            @endcan
+            <div class="card-body">
+                <div class="row pull-left m-1">
+                    @can('供应商-编辑')
+                        <button class="btn btn-outline-info mb-1 mr-3" @click="store"><span class="fa fa-plus"></span>&nbsp;新&nbsp;&nbsp;增</button>
+                    @endcan
+                </div>
+                @include('maintenance.supplier._table')
+            </div>
+        </div>
+    </div>
+@endsection
+
+@section('lastScript')
+    <script>
+        new Vue({
+            el:'#supplier',
+            data:{
+                suppliers:{!! $suppliers->toJson() !!}['data'],
+                editSupplier:{},
+                addSupplier:{},
+                index:''
+            },
+            mounted(){
+                $('#supplier').removeClass('d-none');
+            },
+            methods:{
+                destroy(id,index){
+                    if (!confirm('是否删除当前供应商')) return;
+                    axios.delete('{{url('apiLocal/supplier')}}/'+id).then(res=>{
+                        if(res.data.success){
+                            tempTip.setIndex(100);
+                            tempTip.setDuration(3000);
+                            tempTip.showSuccess('删除成功');
+                            this.$delete(this.suppliers,index);
+                            return ;
+                        }
+                        tempTip.setDuration(3000);
+                        tempTip.show(res.data.message);
+                    }).catch(err=>{
+                        tempTip.setDuration(3000);
+                        tempTip.show('删除当前项目耗材失败:'+err);
+                    });
+                },
+                edit(suppliers,i){
+                    this.editSupplier = JSON.parse(JSON.stringify(suppliers));
+                    this.index = i;
+                    $('#edit-supplier').modal('show');
+                },
+                update(){
+                    let url = '{{url('apiLocal/supplier/update')}}';
+                    let params = this.editSupplier;
+                    window.tempTip.postBasicRequest(url,params,res=>{
+                        this.$set(this.suppliers,this.index,res);
+                        this.index = null;
+                        this.editSupplier = {};
+                        $("#edit-supplier").modal('hide');
+                        return "修改完成";
+                    },true);
+                },
+                store(){
+                    $('#add-supplier').modal('show');
+                },
+                create(){
+                    let url = '{{url('apiLocal/supplier/store')}}';
+                    let params = this.addSupplier;
+                    window.tempTip.postBasicRequest(url,params,res=>{
+                        this.$set(this.suppliers,this.suppliers.length,res);
+                        this.addSupplier = {};
+                        $("#add-supplier").modal('hide');
+                        return "创建成功";
+                    },true);
+                },
+            }
+        })
+    </script>
+@endsection

+ 11 - 9
resources/views/order/issue/create.blade.php

@@ -11,13 +11,13 @@
                     <form action="{{url('order/issue/store')}}" method="post">
                         @csrf
                         @method('POST')
-                        <input type="hidden" name="rejected_bill_id" :value='rejectedBill.id'>
                         <input type="hidden" name="order_id" :value='order.id'>
                         <input type="hidden" name="second_order_id" :value='second_order_id'>
+                        <input type="hidden" name="logistic_number_return" :value='logistic_number_return'>
                         <div class="form-group row">
                             <label for="logistic_number_return" class="col-2 col-form-label text-right ">退回运单号</label>
                             <div class="col-8 ">
-                                <input type="text" name="logistic_number_return" id="logistic_number_return" class="form-control col-lg-5 @error('logistic_number_return') is-invalid @enderror"
+                                <input type="text" name="logistic_number_return_" id="logistic_number_return" class="form-control col-lg-5 @error('logistic_number_return') is-invalid @enderror"
                                        v-model="logistic_number_return"
                                        value="@if(old('logistic_number_return')){{old('logistic_number_return')}}@endif"
                                        @blur="checkLogisticNumberReturn">
@@ -211,12 +211,17 @@
                             </div>
                         </div>
                         <div class="form-group row">
-                            <label for="" class="col-2 col-form-label text-right ">处理结果</label>
+                            <label for="" class="col-2 col-form-label text-right ">情况说明</label>
                             <div class="col-8">
                                 <textarea name="result_explain" class="form-control"></textarea>
                             </div>
                         </div>
-
+                        <div class="form-group row">
+                            <label for="" class="col-2 col-form-label text-right ">处理结果</label>
+                            <div class="col-8">
+                                <textarea name="content" class="form-control"></textarea>
+                            </div>
+                        </div>
                         <div class="form-group row">
                             <label for="logistic_indemnity_money"
                                    class="col-2 col-form-label text-right ">承运商赔偿金额</label>
@@ -368,15 +373,12 @@
                     let data = {logisticNumberReturn: this.logistic_number_return};
                     axios.post("{{url('apiLocal/order/issue/orderIssueHasLogisticNumberReturn')}}", data).then(function (res) {
                         if (res.data.success) {
-                            if (res.data.order) {
-                                _this.order = res.data.order;
-                            }
                             if (res.data.rejectedBill) {
                                 _this.rejectedBill = res.data.rejectedBill;
                             }
-                            if (res.data.meg) {
+                            if (res.data.message) {
                                 tempTip.setDuration(3000);
-                                tempTip.showSuccess(res.data.meg);
+                                tempTip.showSuccess(res.data.message);
                             }
                             _this.isSubmit = true;
                         } else {

+ 4 - 4
resources/views/order/issue/index.blade.php

@@ -21,7 +21,7 @@
                     </span>
                     @cannot('订单管理-问题件-客户不可见')
                     <span class="ml-1">
-                        <button type="button" class="btn btn-outline-dark btn-sm form-control-sm   tooltipTarget" @click="endOrderIssue" :class="[checkData.length>0?'btn-dark text-light':'']">
+                        <button type="button" class="btn btn-outline-dark btn-sm form-control-sm   tooltipTarget" @click="endOrderIssue" :class="[checkData.length>0?'btn-dark text-light':'']" style="background: #dad7e8;">
                             批量完结
                         </button>
                     </span>
@@ -35,7 +35,7 @@
                     @endcan
                     @can('订单管理-问题件-编辑')
                         <span class="ml-1">
-                        <button type="button" class="btn btn-outline-dark btn-sm form-control-sm  tooltipTarget" @click="batchStoreLogsModel">
+                        <button type="button" class="btn btn-outline-dark btn-sm form-control-sm  tooltipTarget" @click="batchStoreLogsModel" style="background: #d7e8df;">
                             批量处理说明
                         </button>
                         <span class="ml-1">
@@ -45,7 +45,7 @@
                     </span>
                     @endcan
                     <span class="ml-1">
-                        <button type="button" class="btn btn-outline-dark btn-sm form-control-sm  tooltipTarget" @click="copyOrderNo">
+                        <button type="button" class="btn btn-outline-dark btn-sm form-control-sm  tooltipTarget" @click="copyOrderNo" style="background: #dad7e8;">
                             复制快递单号
                         </button>
                     </span>
@@ -58,7 +58,7 @@
                     @cannot('订单管理-问题件-客户不可见')
                         @can('订单管理-问题件-财务确认')
                         <span class="ml-1">
-                            <button type="button" class="btn btn-outline-dark btn-sm form-control-sm  tooltipTarget" @click="financeConfirm('是')">
+                            <button type="button" class="btn btn-outline-dark btn-sm form-control-sm  tooltipTarget" @click="financeConfirm('是')" style="background: #d7e8df;">
                                 批量财务确认
                             </button>
                         </span>

+ 2 - 1
resources/views/package/weigh/index.blade.php

@@ -43,7 +43,7 @@
                         <td>@{{package.length}}<a v-if="package.length" class="text-primary">*</a>@{{package.width}}<a class="text-primary" v-if="package.width">*</a>@{{package.height}}</td>
                         <td>@{{package.bulk}}</td>
                         <td>@{{package.paperBoxName}}</td>
-                        <td :class="[package.status==='已上传'?'text-success':'']">@{{package.status}}</td>
+                        <td :class="[package.uploaded_to_wms==='是'?'text-success':'']">@{{package.status}}</td>
                         <td class="text-muted">@{{package.batchRule}}</td>
                         <td class="text-muted">@{{package.weighed_at}}</td>
                         <td class="text-muted">@{{package.recipient}}</td>
@@ -103,6 +103,7 @@
                     {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的客户'],
                         placeholder:['货主','定位或多选货主'],data:_this.owners},
                     {name:'logistic_number',type:'input',tip:'可支持多快递单号,糊模查找需要在左边打上%符号',placeholder:'快递单号'},
+                    {name:'is_weighed',type:'checkbox',tip:'是否已称重', data: [{name: 'true', value: '是否已称重'}]}
                 ],[
                     {name:'created_at_end',type:'dateTime',tip:'选择显示创建日期的结束时间'},
                     {name:'weighed_at_end',type:'dateTime',tip:'选择显示称重日期的结束时间'},

+ 8 - 8
resources/views/waybill/_batchUploadImg.blade.php

@@ -24,21 +24,21 @@
                             </div>
                         </div>
                         <div class="col-3 border border-2 rounded" v-for="(img,i) in images">
-                            <div class="w-100 h4 m-1" style="height: 10%;">
-                                <span class="text-danger font-weight-bold pull-right" style="cursor: pointer;" @click="delTempImg(i)"> &times;</span>
+                            <div class="w-100 row m-1 h-25">
+                                <div class="text-center small col-9">
+                                    <span class="text-wrap">@{{ img.name }}(<span class="text-info">@{{ img.size | size }}</span>)</span>
+                                </div>
+                                <span class="col-3 h4 cursor-pointer text-danger font-weight-bold h-25" @click="delTempImg(i)"> &times;</span>
                             </div>
-                            <div class="w-100 m-0 text-center" style="height: 60%">
-                                <img class="img-fluid" :src="img.src" alt="img.name">
-                            </div>
-                            <div class="w-100 text-center small" style="height: 25%;margin-top: 5%">
-                                <span class="text-wrap">@{{ img.name }}(<span class="text-info">@{{ img.size | size }}</span>)</span>
+                            <div class="w-100 m-0 text-center h-50 overflow-hidden">
+                                <img class="img-fluid" :src="img.src" alt="img.name"/>
                             </div>
                         </div>
                     </div>
                 </div>
             </div>
             <div class="modal-footer">
-                <button class="btn btn-info text-white mr-1" @click="selectedFile()" v-if="images.length>1">
+                <button class="btn btn-info text-white mr-1" @click="selectedFile()" v-if="images.length>0">
                     <span class="fa fa-image"></span>
                     继续添加</button>
                 <button class="btn btn-success" @click="batchUploadImages()">开始上传</button>

+ 51 - 48
resources/views/waybill/index.blade.php

@@ -680,10 +680,10 @@
                                 if (waybill.waybill_number===waybill_number){
                                     waybill.url=response.data.data.url;
                                     waybill.suffix=response.data.data.type;
-                                    setTimeout(function () {
+                                    /*setTimeout(function () {
                                         _this.imgs.push(document.getElementById('img_'+waybill.id));
                                         _this.lazy();
-                                    },1);
+                                    },1);*/
                                     tempTip.setDuration(3000);
                                     tempTip.showSuccess("上传成功!");
                                     return true;
@@ -1003,9 +1003,33 @@
                 uploadFiles(event){
                     let images = event.target.files;
                     for(let i=0;i<images.length;i++){
-                        images[i]['src'] = window.URL.createObjectURL(images[i]);
-                        this.images.push(images[i]);
-                        this.size += images[i].size;
+                        let MAX_HEIGHT = 1000;
+                        let image = new Image();
+                        image.onload = ()=>{
+                            let canvas = document.createElement("canvas");
+                            if (image.height > MAX_HEIGHT && image.height >= image.width) {
+                                image.width *= MAX_HEIGHT / image.height;
+                                image.height = MAX_HEIGHT;
+                            }
+                            if (image.width > MAX_HEIGHT && image.width > image.height) {
+                                image.height *= MAX_HEIGHT / image.width;
+                                image.width = MAX_HEIGHT;
+                            }
+                            let ctx = canvas.getContext("2d");
+                            ctx.clearRect(0, 0, canvas.width, canvas.height);
+                            canvas.width = image.width;
+                            canvas.height = image.height;
+                            ctx.drawImage(image, 0, 0, image.width, image.height);
+                            let src = canvas.toDataURL("image/jpeg");
+                            let size = src.length;
+                            this.images.push({
+                                src :  src,
+                                name : images[i]["name"],
+                                size : size,
+                            });
+                            this.size += size;
+                        };
+                        image.src = window.URL.createObjectURL(images[i]);
                     }
                 },
                 //删除图片
@@ -1019,52 +1043,31 @@
                         window.tempTip.show("未选择图片");
                         return;
                     }
-                    if (this.size > 10485760){
-                        window.tempTip.show("上传图片超出10MB,请分开上传");
+                    if (this.size > 104857600){
+                        window.tempTip.show("上传图片超出100MB,请分开上传");
                         return;
                     }
-                    let formData = new FormData();
-                    this.images.forEach(image=>{
-                        formData.append("images[]",image);
-                    });
-                    window.tempTip.setIndex(1099);
-                    window.tempTip.setDuration(9999);
-                    window.tempTip.waitingTip("上传中,请稍等......");
-                    window.axios.post('{{url('waybill/batchUploadImages')}}',formData,{
-                        'Content-Type':'multipart/form-data'
-                    }).then(res=>{
-                        if (res.data.success){
-                            let result = res.data.data.data;
-                            let errors = res.data.data.errors;
-                            if (errors.length>0)this.batchUploadError =  errors;
-                            result.forEach(r=>{
-                                this.waybills.some(waybill=> {
-                                    if (waybill.id==r.id){
-                                        waybill.url="/storage"+r.upload_file.url;
-                                        waybill.suffix=r.upload_file.type;
-                                        setTimeout(()=> {
-                                            this.imgs.push(document.getElementById('img_'+waybill.id));
-                                            this.lazy();
-                                        },1);
-                                        return true;
-                                    }
-                                });
-                                this.size = 0;
+                    window.tempTip.postBasicRequest('{{url('waybill/batchUploadImages')}}',{images:this.images},res=>{
+                        let result = res.data;
+                        let errors = res.errors;
+                        if (errors.length>0)this.batchUploadError =  errors;
+                        result.forEach(r=>{
+                            this.waybills.some(waybill=> {
+                                if (waybill.id==r.id){
+                                    waybill.url="/storage"+r.upload_file.url;
+                                    waybill.suffix=r.upload_file.type;
+                                    /*setTimeout(()=> {
+                                        this.imgs.push(document.getElementById('img_'+waybill.id));
+                                        this.lazy();
+                                    },1);*/
+                                    return true;
+                                }
                             });
-                            this.$forceUpdate();
-                            window.tempTip.cancelWaitingTip();
-                            window.tempTip.setDuration(2000);
-                            window.tempTip.showSuccess("上传成功!");
-                            return;
-                        }
-                        window.tempTip.cancelWaitingTip();
-                        window.tempTip.setDuration(3000);
-                        window.tempTip.show(res.data.data);
-                    }).catch(err=>{
-                        window.tempTip.cancelWaitingTip();
-                        window.tempTip.setDuration(3000);
-                        window.tempTip.show('网络错误:'+err);
-                    });
+                            this.size = 0;
+                        });
+                        this.$forceUpdate();
+                        return "上传成功";
+                    },true);
                 },
             },
             filters:{

+ 30 - 0
routes/apiLocal.php

@@ -109,3 +109,33 @@ Route::group(['prefix'=>'control'],function () {
     Route::post('panel/menu/laborReportsUserGroupsCountApi','ControlPanelController@laborReportsUserGroupsCountApi');
     Route::post('panel/menu/weightApi','ControlPanelController@weightApi');
 });
+
+/** 耗材 */
+Route::group(['prefix' => 'material'],function(){
+    Route::post('store','MaterialController@storeApi');
+    Route::post('update','MaterialController@updateApi');
+    Route::delete('destroy/{id}','MaterialController@destroyApi');
+});
+
+/** 项目耗材 */
+Route::group(['prefix' => 'ownerMaterial'],function(){
+    Route::post('store','OwnerMaterialController@storeApi');
+    Route::post('update','OwnerMaterialController@updateApi');
+    Route::delete('{id}','OwnerMaterialController@destroyApi');
+    Route::post('uploadFile','OwnerMaterialController@uploadFileApi');
+});
+
+/** 供应商 */
+Route::group(['prefix' => 'supplier'],function(){
+    Route::post('store','SupplierController@storeApi');
+    Route::post('update','SupplierController@updateApi');
+    Route::delete('{id}','SupplierController@destroyApi');
+});
+/** 系统配置 */
+Route::group(['prefix' => 'configuration'],function(){
+    Route::post('store','ConfigurationController@storeApi');
+    Route::post('update','ConfigurationController@updateApi');
+    Route::delete('{id}','ConfigurationController@destroyApi');
+});
+
+

+ 12 - 0
routes/web.php

@@ -197,6 +197,17 @@ Route::group(['prefix'=>'maintenance'],function(){
         Route::post("get",'RegionController@get');
         Route::post("store",'RegionController@store');
     });
+    /** 耗材 */
+    Route::get('material','MaterialController@index');;
+    /** 项目耗材 */
+    Route::group(['prefix'=>"ownerMaterial"],function (){
+        Route::get("/",'OwnerMaterialController@index');
+        Route::get('downFile','OwnerMaterialController@downFile');
+    });
+    /** 供应商 */
+    Route::get('supplier','SupplierController@index');
+    /** 系统配置 */
+    Route::get('configuration','ConfigurationController@index');
 
     Route::get('syncRedisLogs','LogController@syncRedisLogs');
     Route::get('region', 'RegionController@index');
@@ -710,3 +721,4 @@ Route::group(['prefix'=>'station'],function(){
 Route::group(['prefix'=>'control'],function () {
    Route::get('panel/menu','ControlPanelController@index') ;
 });
+