cqpCow 1 год назад
Родитель
Сommit
d20f0a3b0a
71 измененных файлов с 0 добавлено и 4041 удалено
  1. 0 104
      app/Http/Controllers/Api/BomController.php
  2. 0 38
      app/Http/Controllers/Api/Device/BaseController.php
  3. 0 22
      app/Http/Controllers/Api/Device/DeviceController.php
  4. 0 164
      app/Http/Controllers/Api/MaterialController.php
  5. 0 80
      app/Http/Controllers/Api/MeasureController.php
  6. 0 70
      app/Http/Controllers/Api/OrderBoxController.php
  7. 0 104
      app/Http/Controllers/Api/OrderController.php
  8. 0 37
      app/Http/Controllers/Api/OrderTagController.php
  9. 0 76
      app/Http/Controllers/Api/OrderTransportController.php
  10. 0 140
      app/Http/Controllers/Api/ProcessController.php
  11. 0 89
      app/Http/Controllers/Api/ProductController.php
  12. 0 19
      app/Model/BasicMaterial.php
  13. 0 27
      app/Model/BasicProcedure.php
  14. 0 26
      app/Model/BasicProcess.php
  15. 0 19
      app/Model/Bom.php
  16. 0 19
      app/Model/BomDetail.php
  17. 0 19
      app/Model/BomDetailMeasure.php
  18. 0 19
      app/Model/BomDetailRelation.php
  19. 0 19
      app/Model/BomMaterial.php
  20. 0 19
      app/Model/Box.php
  21. 0 69
      app/Model/BoxDetail.php
  22. 0 19
      app/Model/Depart.php
  23. 0 36
      app/Model/Employee.php
  24. 0 19
      app/Model/EmployeeDepartPermission.php
  25. 0 14
      app/Model/EmployeeManagerDepart.php
  26. 0 19
      app/Model/EmployeeMenuPermission.php
  27. 0 14
      app/Model/EmployeeRole.php
  28. 0 19
      app/Model/EmployeeTeamPermission.php
  29. 0 19
      app/Model/HeaderWord.php
  30. 0 19
      app/Model/Header_ext.php
  31. 0 13
      app/Model/InOutRecord.php
  32. 0 15
      app/Model/Inventory.php
  33. 0 19
      app/Model/Material.php
  34. 0 19
      app/Model/MaterialDetail.php
  35. 0 19
      app/Model/Measure.php
  36. 0 19
      app/Model/Oa.php
  37. 0 19
      app/Model/OaEmployee.php
  38. 0 19
      app/Model/OaEmployeeSub.php
  39. 0 19
      app/Model/OaOrder.php
  40. 0 19
      app/Model/OaOrderSub.php
  41. 0 19
      app/Model/OaOrderSubEmployee.php
  42. 0 19
      app/Model/OaSub.php
  43. 0 19
      app/Model/Orders.php
  44. 0 19
      app/Model/OrdersHouse.php
  45. 0 19
      app/Model/OrdersProcedureTag.php
  46. 0 19
      app/Model/OrdersProduct.php
  47. 0 19
      app/Model/OrdersProductBom.php
  48. 0 28
      app/Model/Procedure.php
  49. 0 26
      app/Model/Process.php
  50. 0 19
      app/Model/Product.php
  51. 0 19
      app/Model/ProductDetail.php
  52. 0 19
      app/Model/Role.php
  53. 0 19
      app/Model/Storehouse.php
  54. 0 19
      app/Model/SysMenu.php
  55. 0 19
      app/Model/Team.php
  56. 0 19
      app/Model/Technology.php
  57. 0 280
      app/Service/BomService.php
  58. 0 173
      app/Service/Box/BoxHookService.php
  59. 0 53
      app/Service/Device/DeviceService.php
  60. 0 199
      app/Service/Device/Service.php
  61. 0 232
      app/Service/MaterialService.php
  62. 0 76
      app/Service/MeasureService.php
  63. 0 58
      app/Service/Order/OrderBoxService.php
  64. 0 143
      app/Service/Order/OrderService.php
  65. 0 48
      app/Service/Order/OrderTagService.php
  66. 0 62
      app/Service/Order/OrderTransportService.php
  67. 0 216
      app/Service/OrderService.php
  68. 0 148
      app/Service/ProcedureService.php
  69. 0 175
      app/Service/ProcessService.php
  70. 0 148
      app/Service/ProductService.php
  71. 0 173
      app/Service/Transport/TransportHookService.php

+ 0 - 104
app/Http/Controllers/Api/BomController.php

@@ -1,104 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Api;
-
-
-use App\Service\BomService;
-use Illuminate\Http\Request;
-
-
-class BomController extends BaseController
-{
-
-
-
-
-
-    public function add(Request $request)
-    {
-
-
-        $service = new BomService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->add($request->all(),$request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-    public function edit(Request $request)
-    {
-
-
-        $service = new BomService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->edit($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-    public function del(Request $request)
-    {
-
-
-        $service = new BomService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->del($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-    public function bomList(Request $request)
-    {
-
-
-        $service = new BomService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->bomList($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-    public function bomDetail(Request $request)
-    {
-
-
-        $service = new BomService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->bomDetail($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-
-
-}

+ 0 - 38
app/Http/Controllers/Api/Device/BaseController.php

@@ -1,38 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Api\Device;
-
-use App\Http\Controllers\Controller;
-
-class BaseController extends Controller
-{
-    public $user_info;
-    public function __construct()
-    {
-    }
-
-    // 返回json数据
-    protected function json_return($code=200,$msg="Success",$data=[]){
-        if(!is_array($data)&&!is_object($data)) {
-            $msg = $data;
-            $data = '';
-        }
-        if(empty($msg)) $msg = '操作成功';
-        return ['code'=>$code,'msg'=>$msg,'data'=>$data];
-    }
-
-
-    //用户行为记录,暂时放这里具体用不用后期再加
-    public function user_log($data,$user,$id,$perm_id,$remark){
-
-    }
-
-
-
-
-
-
-
-
-
-}

+ 0 - 22
app/Http/Controllers/Api/Device/DeviceController.php

@@ -1,22 +0,0 @@
-<?php
-namespace App\Http\Controllers\Api\Device;
-
-use App\Service\Device\DeviceService;
-use Illuminate\Http\Request;
-use Illuminate\Support\Facades\Log;
-
-
-class DeviceController extends BaseController
-{
-    public function deviceList(Request $request){
-        $service = new DeviceService();
-        list($status,$data) = $service->deviceList();
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-}

+ 0 - 164
app/Http/Controllers/Api/MaterialController.php

@@ -1,164 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Api;
-
-
-use App\Service\MaterialService;
-use App\Service\MeasureService;
-use App\Service\SysMenuService;
-use Illuminate\Http\Request;
-
-
-class MaterialController extends BaseController
-{
-
-
-
-
-
-    public function basicMaterialList(Request $request)
-    {
-
-
-        $service = new MaterialService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->basicMaterialList($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-    public function basicMaterialEdit(Request $request)
-    {
-
-
-        $service = new MaterialService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->basicMaterialEdit($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-    public function basicMaterialDel(Request $request)
-    {
-
-        $service = new MaterialService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->basicMaterialDel($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-    }
-
-    public function basicMaterialAdd(Request $request)
-    {
-        $service = new MaterialService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->basicMaterialAdd($request->all(),$user);
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-    }
-
-    public function materialList(Request $request)
-    {
-
-
-        $service = new MaterialService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->materialList($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }    public function materialDetail(Request $request)
-    {
-
-
-        $service = new MaterialService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->materialDetail($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-    public function materialEdit(Request $request)
-    {
-
-
-        $service = new MaterialService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->materialEdit($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-    public function materialDel(Request $request)
-    {
-
-
-        $service = new MaterialService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->materialDel($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-    public function materialAdd(Request $request)
-    {
-
-
-        $service = new MaterialService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->materialAdd($request->all(),$request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-
-
-}

+ 0 - 80
app/Http/Controllers/Api/MeasureController.php

@@ -1,80 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Api;
-
-
-use App\Service\MeasureService;
-use Illuminate\Http\Request;
-
-
-class MeasureController extends BaseController
-{
-    public function add(Request $request)
-    {
-        $service = new MeasureService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->add($request->all(),$request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-    public function edit(Request $request)
-    {
-
-
-        $service = new MeasureService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->edit($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-    public function del(Request $request)
-    {
-
-
-        $service = new MeasureService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->del($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-    public function measureList(Request $request)
-    {
-
-
-        $service = new MeasureService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->measureList($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-
-
-}

+ 0 - 70
app/Http/Controllers/Api/OrderBoxController.php

@@ -1,70 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Api;
-
-
-use App\Service\Order\OrderBoxService;
-use App\Service\Order\OrderTagService;
-use App\Service\OrderService;
-use Illuminate\Http\Request;
-
-
-class OrderBoxController extends BaseController
-{
-
-
-
-
-
-    public function boxDetail(Request $request)
-    {
-
-
-        $service = new OrderBoxService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->box_detail($request->all()['order_no']);
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-    public function boxIn(Request $request)
-    {
-
-
-        $service = new OrderBoxService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->box_in($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-    public function boxOut(Request $request)
-    {
-
-
-        $service = new OrderBoxService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->box_out($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-
-
-}

+ 0 - 104
app/Http/Controllers/Api/OrderController.php

@@ -1,104 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Api;
-
-
-use App\Service\OrderService;
-use Illuminate\Http\Request;
-
-
-class OrderController extends BaseController
-{
-
-
-
-
-
-    public function add(Request $request)
-    {
-
-
-        $service = new OrderService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->add($request->all(),$request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-    public function edit(Request $request)
-    {
-
-
-        $service = new OrderService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->edit($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-    public function del(Request $request)
-    {
-
-
-        $service = new OrderService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->del($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-    public function OrderList(Request $request)
-    {
-
-
-        $service = new OrderService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->OrderList($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-    public function orderDetail(Request $request)
-    {
-
-
-        $service = new OrderService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->orderDetail($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-
-
-}

+ 0 - 37
app/Http/Controllers/Api/OrderTagController.php

@@ -1,37 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Api;
-
-
-use App\Service\Order\OrderTagService;
-use App\Service\OrderService;
-use Illuminate\Http\Request;
-
-
-class OrderTagController extends BaseController
-{
-
-
-
-
-
-    public function tagDetail(Request $request)
-    {
-
-
-        $service = new OrderTagService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->getOrderTag($request->all()['order_no']);
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-
-
-}

+ 0 - 76
app/Http/Controllers/Api/OrderTransportController.php

@@ -1,76 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Api;
-
-
-use App\Service\Order\OrderTagService;
-use App\Service\Order\OrderTransportService;
-use App\Service\OrderService;
-use Illuminate\Http\Request;
-
-
-class OrderTransportController extends BaseController
-{
-
-
-
-
-
-    public function transportDetail(Request $request)
-    {
-
-
-        $service = new OrderTransportService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->transportDetail($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-
-    public function boxTransport(Request $request)
-    {
-
-
-        $service = new OrderTransportService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->boxTransport($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-
-    public function transportConfirm(Request $request)
-    {
-
-
-        $service = new OrderTransportService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->transportConfirm($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-
-
-
-
-}

+ 0 - 140
app/Http/Controllers/Api/ProcessController.php

@@ -1,140 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Api;
-
-
-use App\Service\ProcessService;
-use Illuminate\Http\Request;
-
-
-class ProcessController extends BaseController
-{
-    public function basicProcessList(Request $request)
-    {
-
-
-        $service = new ProcessService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->basicProcessList($request->all(),$request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-    public function basicProcessEdit(Request $request)
-    {
-
-
-        $service = new ProcessService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->basicProcessEdit($request->all(),$request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-    public function basicProcessAdd(Request $request)
-    {
-
-
-        $service = new ProcessService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->basicProcessAdd($request->all(),$request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-    public function basicProcessDel(Request $request)
-    {
-
-
-        $service = new ProcessService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->basicProcessDel($request->all(),$request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-    public function processList(Request $request)
-    {
-        $service = new ProcessService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->processList($request->all(),$request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-    }
-
-    public function processEdit(Request $request)
-    {
-        $service = new ProcessService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->processEdit($request->all(),$request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-    }
-
-    public function processAdd(Request $request)
-    {
-        $service = new ProcessService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->processAdd($request->all(),$request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-    }
-
-    public function processDel(Request $request)
-    {
-        $service = new ProcessService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->processDel($request->all(),$request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-    }
-
-    public function processDetail(Request $request)
-    {
-        $service = new ProcessService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->processDetail($request->all(),$request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-    }
-}

+ 0 - 89
app/Http/Controllers/Api/ProductController.php

@@ -1,89 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Api;
-
-
-use App\Service\MeasureService;
-use App\Service\ProductService;
-use App\Service\SysMenuService;
-use Illuminate\Http\Request;
-
-
-class ProductController extends BaseController
-{
-
-
-
-
-
-    public function add(Request $request)
-    {
-
-
-        $service = new ProductService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->add($request->all(),$request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-    public function edit(Request $request)
-    {
-
-
-        $service = new ProductService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->edit($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-    public function del(Request $request)
-    {
-
-
-        $service = new ProductService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->del($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-    public function productList(Request $request)
-    {
-
-
-        $service = new ProductService();
-        $user = $request->get('auth');
-        list($status,$data) = $service->productList($request->all());
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-
-    }
-
-
-
-
-}

+ 0 - 19
app/Model/BasicMaterial.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * 物料分类
- * Class Unit
- * @package App\Models
- */
-class BasicMaterial extends Model
-{
-    protected $table = "basic_material"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 27
app/Model/BasicProcedure.php

@@ -1,27 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Illuminate\Database\Eloquent\Model;
-use PhpParser\Builder;
-
-/**
- * 工艺属性
- * Class Unit
- * @package App\Models
- */
-class BasicProcedure extends Model
-{
-    protected $table = "basic_procedure"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-
-    public function scopeWhereUnDel($query,$name='')
-    {
-        if(empty($name)) return $query->where('del_time', '=', 0);
-        else return $query->where($name, '=', 0);
-    }
-}
-

+ 0 - 26
app/Model/BasicProcess.php

@@ -1,26 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * 工艺属性
- * Class Unit
- * @package App\Models
- */
-class BasicProcess extends Model
-{
-    protected $table = "basic_process"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-
-    public function scopeWhereUnDel($query,$name='')
-    {
-        if(empty($name)) return $query->where('del_time', '=', 0);
-        else return $query->where($name, '=', 0);
-    }
-}
-

+ 0 - 19
app/Model/Bom.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * bom
- * Class Unit
- * @package App\Models
- */
-class Bom extends Model
-{
-    protected $table = "bom"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/BomDetail.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * bom
- * Class Unit
- * @package App\Models
- */
-class BomDetail extends Model
-{
-    protected $table = "bom_detail"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/BomDetailMeasure.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * bom
- * Class Unit
- * @package App\Models
- */
-class BomDetailMeasure extends Model
-{
-    protected $table = "bom_detail_measure"; //指定表
-    const CREATED_AT = null;
-    const UPDATED_AT = null;
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/BomDetailRelation.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * bom
- * Class Unit
- * @package App\Models
- */
-class BomDetailRelation extends Model
-{
-    protected $table = "bom_detail_relation"; //指定表
-    const CREATED_AT = null;
-    const UPDATED_AT = null;
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/BomMaterial.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * bom
- * Class Unit
- * @package App\Models
- */
-class BomMaterial extends Model
-{
-    protected $table = "bom_material"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/Box.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- *
- * Class Unit
- * @package App\Models
- */
-class Box extends Model
-{
-    protected $table = "box"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 69
app/Model/BoxDetail.php

@@ -1,69 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-use Illuminate\Support\Facades\DB;
-use Illuminate\Support\Facades\Schema;
-
-/**
- *
- * Class Unit
- * @package App\Models
- */
-class BoxDetail extends Model
-{
-    protected $table = "box_detail"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-    protected $guarded = [];
-
-    public $month = [
-        1 => '01_03',
-        2 => '01_03',
-        3 => '01_03',
-        4 => '04_06',
-        5 => '04_06',
-        6 => '04_06',
-        7 => '07_09',
-        8 => '07_09',
-        9 => '07_09',
-        10 => '10_12',
-        11 => '10_12',
-        12 => '10_12',
-    ];
-
-    public function __construct(array $attributes = [])
-    {
-        parent::__construct($attributes);
-        if (isset($attributes['channel']) && $attributes['channel'] > 0) {
-            $channel = $attributes['channel'];
-            $month = (int)substr($channel,4,2);
-            $channel = substr($channel,0,4).$this->month[$month];
-            $this->setTableById($channel);
-        }
-    }
-
-
-    /**
-     * @param $channel
-     */
-    // 动态指定数据表
-    public function setTableById($channel)
-    {
-        if ($channel > 0) {
-            $tb = $this->table.'_' . (string)$channel;
-            $this->createTable($tb);
-            $this->setTable($tb);
-        }
-
-    }
-
-    public function createTable($channel){
-//        $table_name = 'box_detail_' . (string)$channel;
-        if(!Schema::hasTable($channel)){
-            DB::update('create table '.$channel.' like box_detail');
-        }
-    }
-}

+ 0 - 19
app/Model/Depart.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * 部门管理
- * Class Unit
- * @package App\Models
- */
-class Depart extends Model
-{
-    protected $table = "depart"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-    const RULE_DEPART = "ALL";
-}

+ 0 - 36
app/Model/Employee.php

@@ -1,36 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * 菜单管理
- * Class Unit
- * @package App\Models
- */
-class Employee extends Model
-{
-    protected $table = "employee"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-    const USE = 1;
-    const NOT_USE = 2;
-    const IS_ADMIN = 1;
-    const IS_NOT_ADMIN = 0;
-    const SPECIAL_ADMIN = 1;
-    const IS_TECHNICAL = [
-        0 => '否',
-        1 => '是'
-    ];
-
-    //人员状态
-    const STATUS_ONE = 1;
-    const STATUS_TWO = 2;
-
-    const STATUS = [
-        1 => '正常',
-        2 => '停用'
-    ];
-}

+ 0 - 19
app/Model/EmployeeDepartPermission.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * 菜单管理
- * Class Unit
- * @package App\Models
- */
-class EmployeeDepartPermission extends Model
-{
-    protected $table = "employee_depart_permission"; //指定表
-    const CREATED_AT = null;
-    const UPDATED_AT = null;
-    protected $dateFormat = 'U';
-
-}

+ 0 - 14
app/Model/EmployeeManagerDepart.php

@@ -1,14 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-class EmployeeManagerDepart extends Model
-{
-    protected $table = "employee_manager_depart"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/EmployeeMenuPermission.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * 菜单管理
- * Class Unit
- * @package App\Models
- */
-class EmployeeMenuPermission extends Model
-{
-    protected $table = "employee_menu_permission"; //指定表
-    const CREATED_AT = null;
-    const UPDATED_AT = null;
-    protected $dateFormat = 'U';
-
-}

+ 0 - 14
app/Model/EmployeeRole.php

@@ -1,14 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-class EmployeeRole extends Model
-{
-    protected $table = "employee_role"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/EmployeeTeamPermission.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * 菜单管理
- * Class Unit
- * @package App\Models
- */
-class EmployeeTeamPermission extends Model
-{
-    protected $table = "employee_team_permission"; //指定表
-    const CREATED_AT = null;
-    const UPDATED_AT = null;
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/HeaderWord.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- *
- * Class Unit
- * @package App\Models
- */
-class HeaderWord extends Model
-{
-    protected $table = "header_word"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/Header_ext.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- *
- * Class Unit
- * @package App\Models
- */
-class Header_ext extends Model
-{
-    protected $table = "header_ext"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 13
app/Model/InOutRecord.php

@@ -1,13 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-class InOutRecord extends Model
-{
-    protected $table = "in_out_record"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-}

+ 0 - 15
app/Model/Inventory.php

@@ -1,15 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-//库存
-class Inventory extends Model
-{
-    protected $table = "inventory"; //指定表
-    const CREATED_AT = null;
-    const UPDATED_AT = null;
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/Material.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * 物料
- * Class Unit
- * @package App\Models
- */
-class Material extends Model
-{
-    protected $table = "material"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/MaterialDetail.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * 物料
- * Class Unit
- * @package App\Models
- */
-class MaterialDetail extends Model
-{
-    protected $table = "material_detail"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/Measure.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * 测量字段
- * Class Unit
- * @package App\Models
- */
-class Measure extends Model
-{
-    protected $table = "measure"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/Oa.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- *
- * Class Unit
- * @package App\Models
- */
-class Oa extends Model
-{
-    protected $table = "oa"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/OaEmployee.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- *
- * Class Unit
- * @package App\Models
- */
-class OaEmployee extends Model
-{
-    protected $table = "oa_employee"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/OaEmployeeSub.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- *
- * Class Unit
- * @package App\Models
- */
-class OaEmployeeSub extends Model
-{
-    protected $table = "oa_employee_sub"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/OaOrder.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- *
- * Class Unit
- * @package App\Models
- */
-class OaOrder extends Model
-{
-    protected $table = "oa_order"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/OaOrderSub.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- *
- * Class Unit
- * @package App\Models
- */
-class OaOrderSub extends Model
-{
-    protected $table = "oa_order_sub"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/OaOrderSubEmployee.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- *
- * Class Unit
- * @package App\Models
- */
-class OaOrderSubEmployee extends Model
-{
-    protected $table = "oa_order_sub_employee"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/OaSub.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- *
- * Class Unit
- * @package App\Models
- */
-class OaSub extends Model
-{
-    protected $table = "oa_sub"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/Orders.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- *
- * Class Unit
- * @package App\Models
- */
-class Orders extends Model
-{
-    protected $table = "orders"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/OrdersHouse.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- *
- * Class Unit
- * @package App\Models
- */
-class OrdersHouse extends Model
-{
-    protected $table = "orders_house"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/OrdersProcedureTag.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- *
- * Class Unit
- * @package App\Models
- */
-class OrdersProcedureTag extends Model
-{
-    protected $table = "orders_procedure_tag"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/OrdersProduct.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- *
- * Class Unit
- * @package App\Models
- */
-class OrdersProduct extends Model
-{
-    protected $table = "orders_product"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/OrdersProductBom.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- *
- * Class Unit
- * @package App\Models
- */
-class OrdersProductBom extends Model
-{
-    protected $table = "orders_product_bom"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 28
app/Model/Procedure.php

@@ -1,28 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Illuminate\Database\Eloquent\Model;
-use PhpParser\Builder;
-
-/**
- * 产品管理
- * Class Unit
- * @package App\Models
- */
-class Procedure extends Model
-{
-    protected $table = "procedure"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-
-    public function scopeWhereUnDel($query,$name='')
-    {
-        if(empty($name)) return $query->where('del_time', '=', 0);
-        else return $query->where($name, '=', 0);
-    }
-
-}
-

+ 0 - 26
app/Model/Process.php

@@ -1,26 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * 工序属性
- * Class Unit
- * @package App\Models
- */
-class Process extends Model
-{
-    protected $table = "process"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-
-    public function scopeWhereUnDel($query,$name='')
-    {
-        if(empty($name)) return $query->where('del_time', '=', 0);
-        else return $query->where($name, '=', 0);
-    }
-}
-

+ 0 - 19
app/Model/Product.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * 物料
- * Class Unit
- * @package App\Models
- */
-class Product extends Model
-{
-    protected $table = "product"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/ProductDetail.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * 物料
- * Class Unit
- * @package App\Models
- */
-class ProductDetail extends Model
-{
-    protected $table = "product_detail"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/Role.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * 角色管理
- * Class Unit
- * @package App\Models
- */
-class Role extends Model
-{
-    protected $table = "role"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/Storehouse.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * 仓库
- * Class Unit
- * @package App\Models
- */
-class Storehouse extends Model
-{
-    protected $table = "storehouse"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/SysMenu.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * 菜单管理
- * Class Unit
- * @package App\Models
- */
-class SysMenu extends Model
-{
-    protected $table = "sys_menu"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/Team.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * 班组管理
- * Class Unit
- * @package App\Models
- */
-class Team extends Model
-{
-    protected $table = "team"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-
-}

+ 0 - 19
app/Model/Technology.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Model;
-
-use Illuminate\Database\Eloquent\Model;
-
-/**
- * 工艺
- * Class Unit
- * @package App\Models
- */
-class Technology extends Model
-{
-    protected $table = "technology"; //指定表
-    const CREATED_AT = 'crt_time';
-    const UPDATED_AT = 'upd_time';
-    protected $dateFormat = 'U';
-}
-

+ 0 - 280
app/Service/BomService.php

@@ -1,280 +0,0 @@
-<?php
-
-namespace App\Service;
-
-
-use App\Model\Bom;
-use App\Model\BomDetail;
-use App\Model\BomDetailMeasure;
-use App\Model\BomDetailRelation;
-use App\Model\BomMaterial;
-use App\Model\SysMenu;
-use Illuminate\Support\Facades\DB;
-
-/**
- * bom相关
- * @package App\Models
- */
-class BomService extends Service
-{
-
-    public function edit($data){
-        list($status,$msg) = $this->bomRule($data);
-        if(!$status) return [$status,$msg];
-        if($this->isEmpty($data,'id')) return [false,'ID必须!'];
-        $id = $data['id'];
-        $first = Bom::where('title',$data['title'])->where('id','<>',$id)->where('del_time',0)->first();
-        if(!empty($first))return [false,'名称已存在!'];
-        try{
-            DB::beginTransaction();
-            $model = Bom::where('id',$id)->first();
-            $model->title = $data['title'];
-            $model->formula = $data['formula'] ?? '';
-            $model->unit = $data['unit'];
-            $model->label = $data['label'] ?? 0;
-            $model->label_type = $data['label_type'] ?? 0;
-            $model->save();
-            $material_insert = [];
-            $detail_insert = [];
-            $bom_id = $model->id;
-            BomDetail::where('bom_id',$bom_id)->update([
-                'del_time' => time()
-            ]);
-            BomMaterial::where('bom_id',$bom_id)->update([
-                'del_time' => time()
-            ]);
-            if(isset($data['detail'])){
-                foreach ($data['detail'] as $v){
-                    $bom_detail = new BomDetail();
-                    $bom_detail->bom_id = $bom_id;
-                    $bom_detail->sub_bom_id = $v['sub_bom_id'];
-                    $bom_detail->formula = $v['formula']??'';
-                    $bom_detail->num = $v['num'];
-                    $bom_detail->save();
-                    $bom_detail_id = $bom_detail->id;
-                    $bom_detail_insert = [];
-                    foreach ($v['measure'] as $vv){
-                        $bom_detail_insert[] = [
-                            'bom_id' => $bom_id,
-                            'bom_detail_id' => $bom_detail_id,
-                            'measure_id' => $vv['measure_id'],
-                            'value' => $vv['value'],
-                        ];
-                    }
-                    BomDetailMeasure::insert($bom_detail_insert);
-                }
-                BomDetail::insert($detail_insert);
-            }
-
-            if(isset($data['material'])){
-                foreach ($data['material'] as $v){
-                    $material_insert[] = [
-                        'bom_id' => $id,
-                        'formula' => $v['formula']??'',
-                        'num' => $v['num'],
-                        'material_id' => $v['id'],
-                        'crt_time' => time(),
-                        'upd_time' => time(),
-                    ];
-                }
-                BomMaterial::insert($material_insert);
-            }
-            DB::commit();
-
-        }catch (\Exception $e){
-            DB::rollBack();
-            return [false,$e->getMessage()];
-        }
-
-
-        return [true,'保存成功!'];
-
-    }
-
-    //设置一个获取所有bom_id的方法
-    public function getAllBom($bom_id){
-        $all_bom = BomDetail::where('del_time',0)->select('bom_id','sub_bom_id')->get()->toArray();
-        $bom_key_list = [] ;
-        foreach ($all_bom as $v){
-            if(!isset($bom_key_list[$v['bom_id']])) $bom_key_list[$v['bom_id']] = [];
-            $bom_key_list[$v['bom_id']][] = $v['sub_bom_id'];
-        }
-
-        $bom_ids = [$bom_id];
-        $list = $this->setBom($bom_ids,$bom_key_list);
-
-        foreach ($list as &$v){
-            $v['top_bom_id'] = $bom_id;
-        }
-        BomDetailRelation::where('top_bom_id',$bom_id)->delete();
-        BomDetailRelation::insert($list);
-
-    }
-
-    public function setBom($bom_ids,$data){
-        $insert = [];
-        foreach ($bom_ids as $bom_id){
-            if(isset($data[$bom_id])){
-                $ids = $data[$bom_id];
-
-                foreach ($ids as $id){
-                    $insert[] = [
-                        'bom_id' => $id,
-                        'parent_id' => $bom_id,
-                    ];
-                }
-
-                $sub_insert = $this->setBom($ids,$data);
-                $insert = array_merge($insert,$sub_insert);
-            }
-
-        }
-
-        return $insert;
-
-
-    }
-
-    public function add($data,$user){
-
-
-//        if($this->isEmpty($data,'title')) return [201,'名称不存在!'];
-        list($status,$msg) = $this->bomRule($data);
-//        if($this->isEmpty($data,'id')) return [false,'ID不存在!'];
-        if(!$status) return [$status,$msg];
-        $first = Bom::where('title',$data['title'])->where('del_time',0)->first();
-        if(!empty($first))return [false,'名称已存在!'];
-        try{
-            DB::beginTransaction();
-            $model = new Bom();
-
-            $model->title = $data['title'];
-            $model->formula = $data['formula'] ?? '';
-            $model->unit = $data['unit'];
-            $model->label = $data['label'] ?? 0;
-            $model->label_type = $data['label_type'] ?? 0;
-            $model->save();
-
-            $bom_id = $model->id;
-            $material_insert = [];
-            $detail_insert = [];
-            if(isset($data['material'])){
-                foreach ($data['material'] as $v){
-                    $material_insert[] = [
-                        'bom_id' => $bom_id,
-                        'num' => $v['num'],
-                        'id' => $v['id'],
-                        'crt_time' => time(),
-                        'upd_time' => time(),
-                    ];
-                }
-                BomMaterial::insert($material_insert);
-            }
-
-            if(isset($data['detail'])){
-                foreach ($data['detail'] as $v){
-                    $bom_detail = new BomDetail();
-                    $bom_detail->bom_id = $bom_id;
-                    $bom_detail->sub_bom_id = $v['id'];
-                    $bom_detail->formula = $v['formula']??'';
-                    $bom_detail->num = $v['num'];
-                    $bom_detail->save();
-                    $bom_detail_id = $bom_detail->id;
-                    $bom_detail_insert = [];
-                    foreach ($v['measure'] as $vv){
-                        $bom_detail_insert[] = [
-                            'bom_id' => $bom_id,
-                            'bom_detail_id' => $bom_detail_id,
-                            'measure_id' => $vv['measure_id'],
-                            'value' => $vv['value'],
-                            'measure_title' => $vv['measure_title'],
-                        ];
-                    }
-                    BomDetailMeasure::insert($bom_detail_insert);
-                }
-            }
-            DB::commit();
-        }catch (\Exception $e){
-            DB::rollBack();
-            return [false,$e->getMessage()];
-        }
-
-
-        return [true,'保存成功!'];
-
-    }
-
-    public function del($data){
-        if($this->isEmpty($data,'id')) return [false,'ID必须!'];
-        $id = $data['id'];
-        Bom::where('id',$id)->update([
-            'del_time'=>time()
-        ]);
-
-        return [true,'删除成功'];
-    }
-
-    public function bomDetail($data){
-        $id = $data['id'];
-        $return = Bom::where('id',$id)->first()->toArray();
-
-        $return['bom_detail'] = Bom::from('bom_detail as bd')
-            ->leftJoin('bom as b','b.id','bd.bom_id')
-            ->where('bd.del_time',0)
-            ->where('bd.bom_id',$id)
-            ->select('title','bd.*')->get()->toArray();
-
-        $measure_list =  BomDetailMeasure::where('bom_id',$id)->select('measure_id','value','measure_title','bom_detail_id')->get()->toArray();
-        $measure_key_list = [];
-        foreach ($measure_list as $v){
-            $measure_key_list[$v['bom_detail_id']][] = $v;
-        }
-        $return['material'] = Bom::from('bom_material as bm')
-            ->leftJoin('material as m','m.id','bm.material_id')
-            ->where('bm.del_time',0)
-            ->select('m.title','bm.*')->get()->toArray();
-        foreach ( $return['bom_detail'] as &$v){
-            $v['measure'] = isset($measure_key_list[$v['id']]) ? $measure_key_list[$v['id']] : [];
-        }
-
-        $return['top_measure'] = BomDetailMeasure::from('bom_detail_measure as bdm')
-            ->leftJoin('measure as m','m.id','bdm.measure_id')->where('bdm.bom_id',$id)
-         ->where('bom_id',$id)->select('bdm.measure_id','bdm.value','bdm.measure_title','m.e_title','m.title')->groupBy('measure_title')->get()->toArray();
-
-        return [200,$return];
-    }
-
-    public function bomList($data){
-//        $id = $data['id'];
-        $return = Bom::where('del_time',0)->select('*');
-        $return = $this->limit(
-            $return,'',$data
-        );
-//        $return['bom_detail'] = Bom::from('bom_detail as bd')
-//            ->leftJoin('bom as b','b.id','bd.bom_id')
-//            ->where('bd.del_time',0)
-//            ->select('title','bd.*')->get()->toArray();
-//
-//
-//        $return['material'] = Bom::from('bom_material as bm')
-//            ->leftJoin('material as m','m.id','bm.bom_id')
-//            ->where('bm.del_time',0)
-//            ->select('m.title','bm.*')->get()->toArray();
-
-
-        return [200,$return];
-    }
-
-    public function bomRule($data){
-        if($this->isEmpty($data,'title')) return [false,'名称不存在!'];
-        if($this->isEmpty($data,'unit')) return [false,'单位不存在!'];
-        if($this->isEmpty($data,'label')) return [false,'芯片设置不存在!'];
-//        if($this->isEmpty($data,'icon')) return [201,'d不存在!'];
-//        if($this->isEmpty($data,'uri')) return [false,'路由不存在!'];
-
-
-        return [true,''];
-    }
-
-
-}

+ 0 - 173
app/Service/Box/BoxHookService.php

@@ -1,173 +0,0 @@
-<?php
-
-namespace App\Service\Box;
-
-
-
-use App\Model\Box;
-use App\Model\BoxDetail;
-use App\Model\Header_ext;
-use App\Service\Service;
-
-/**
- * 包装相关工厂模式
- * @package App\Models
- */
-class BoxHookService extends Service
-{
-
-    protected static $instance;
-    protected static $box_header;
-    protected static $box_detail_header;
-
-    public function __construct(){
-
-        self::$box_header = Header_ext::where('type','box')->pluck('value','key')->toArray();
-        self::$box_detail_header = Header_ext::where('type','box_detail')->pluck('value','key')->toArray();
-
-    }
-
-    public static function getInstance(): self
-    {
-        if (self::$instance == null) {
-            self::$instance = new BoxHookService();
-        }
-        return self::$instance;
-    }
-
-    /**
-     * 包装单新增
-     * @param $data
-     * @return array
-     */
-    public function boxInsert($data){
-        $box = new Box();
-        $data['order_no'] = $this->setOrderNo();
-        if(!isset($data['out_order_no'])) return [false,'out_order_no is not exist'];
-        list($status,$box) = $this->dealBox($box,$data);
-        if(!$status) return [false,$box];
-        $box->save();
-        list($status,$msg) =  $this->boxDetailInsert($data);
-        if(!$status) return [false,$msg];
-
-        return [true,$box];
-    }
-
-
-    /**
-     * @param $box
-     * @param $data
-     * @return mixed
-     */
-
-    public function dealBox($box,$data){
-
-        $box->order_no = $data['order_no'];
-        $box->out_order_no = $data['out_order_no'];
-        $box->ext_1 = isset($data['ext_1']) ? $data['ext_1'] : '';
-        $box->ext_2 = isset($data['ext_2']) ? $data['ext_2'] : '';
-        $box->ext_3 = isset($data['ext_3']) ? $data['ext_3'] : '';
-        $box->ext_4 = isset($data['ext_4']) ? $data['ext_4'] : '';
-        $box->ext_5 = isset($data['ext_5']) ? $data['ext_5'] : '';
-
-        return [true,$box];
-
-    }
-
-
-    /**
-     * 包装单详情新增
-     * @param $data
-     * @return array
-     */
-    public function boxDetailInsert($data){
-        $order_no = $data['order_no'];
-        $out_order_no = $data['out_order_no'];
-        $box_detail = new BoxDetail(['channel'=>$order_no]);
-
-        if(!isset($data['detail'])) return [false,'detail is not exist'];
-
-        $insert = $data['detail'];
-
-        list($status,$insert) = $this->dealBoxDetail($insert,$order_no,$out_order_no);
-        if(!$status) return [false,$insert];
-        $box_detail->insert($insert);
-        return [true,''];
-    }
-
-    /**
-     * 包装单详情数据处理
-     * @param $data
-     * @return array
-     */
-    public function dealBoxDetail($data,$order_no,$out_order_no){
-        $insert = [];
-        $time = time();
-        foreach ($data as $v){
-            if(!isset($v['top_id'])) return [false,'top_id is not exist'];
-            if(!isset($v['code'])) return [false,'code is not exist'];
-            if(!isset($v['title'])) return [false,'title is not exist'];
-
-            $insert[] = [
-                'order_no' => $order_no,
-                'out_order_no' => $out_order_no,
-                'top_id' => $v['top_id'],
-                'code' => $v['code'],
-                'title' => $v['title'],
-                'type' => isset($v['type'])?$v['type'] : 1,
-                'crt_time' => $time,
-                'upd_time' => $time,
-                'ext_1' => isset($v['ext_1']) ? $v['ext_1'] : '',
-                'ext_2' => isset($v['ext_2']) ? $v['ext_2'] : '',
-                'ext_3' => isset($v['ext_3']) ? $v['ext_3'] : '',
-                'ext_4' => isset($v['ext_4']) ? $v['ext_4'] : '',
-                'ext_5' => isset($v['ext_5']) ? $v['ext_5'] : '',
-
-            ];
-        }
-
-
-        return [true,$insert];
-    }
-
-
-    /**
-     * @return string
-     */
-    public function setOrderNo(){
-
-        return date('YmdHis').rand(1000,9999);
-    }
-
-    /**
-     * @param $data
-     * @return array
-     */
-    public function boxList($data){
-        $box = new Box();
-        $list = $this->limit($box,'*',$data);
-
-        return [true,$list];
-
-    }
-
-    /**
-     * @param $data
-     * @return array
-     */
-    public function boxDetail($data){
-        $order_no = $data['order_no'];
-
-        $box = new BoxDetail(['channel'=>$order_no]);
-
-        $list = $this->limit($box,'*',$data);
-
-        return [true,$list];
-    }
-
-
-
-
-
-
-}

+ 0 - 53
app/Service/Device/DeviceService.php

@@ -1,53 +0,0 @@
-<?php
-
-namespace App\Service\Device;
-
-
-
-class DeviceService extends Service
-{
-
-
-    public function deviceList(){
-
-        $list = [
-            [
-                'id' => '1',
-                'title' => '木工',
-                'url' => '/#/cms/home',
-                'device' => [
-                    'is_scan' => 1,
-                    'is_box' => 1,
-                ],
-            ],[
-                'id' => '2',
-                'title' => '油漆',
-                'url' => '/cms/yq',
-                'device' => [
-                    'is_scan' => 1,
-                    'is_box' => 0,
-                ],
-            ],[
-                'id' => '3',
-                'title' => '包装',
-                'url' => '/cms/bz',
-                'device' => [
-                    'is_scan' => 1,
-                    'is_box' => 1,
-                ],
-            ],[
-                'id' => '4',
-                'title' => '退出',
-                'url' => '/cms/login_out',
-                'device' => [
-                    'is_scan' => 1,
-                    'is_box' => 1,
-                ],
-            ],
-        ];
-
-        return [200,$list];
-    }
-
-
-}

+ 0 - 199
app/Service/Device/Service.php

@@ -1,199 +0,0 @@
-<?php
-
-namespace App\Service\Device;
-
-
-
-/**
- * 公用的公共服务
- * @package App\Models
- */
-class Service
-{
-
-    public $log;
-    public $total = 0;
-
-    public function __construct()
-    {
-
-    }
-
-    //分页共用
-    public function limit($db, $columns, $request)
-    {
-        $per_page = $request['page_size'] ?? 9999;
-        $page = $request['page_index'] ?? 1;
-        $return = $db->paginate($per_page, $columns, 'page', $page)->toArray();
-
-        $data['total'] = $return['total'];
-        $data['data'] = $return['data'];
-        return $data;
-    }
-
-
-    //抽象一个查询条件,省的每天写很多行
-    protected function is_exist_db($data, $word, $words, $db, $formula = '=', $type = '')
-    {
-        if (isset($data[$word]) && ($data[$word] !== null && $data[$word] !== '' && $data[$word] !== [])) {
-            switch ($type) {
-                case 'time':
-                    $data[$word] = ctype_digit($data[$word]) ? $data[$word] : strtotime($data[$word]);
-                    if ($formula == '<'||$formula == '<=') $data[$word] += 86400;
-                    $db = $db->where($words, $formula, $data[$word]);
-                    break;
-                case 'like':
-                    $db = $db->where($words, $type, '%' . $data[$word] . '%');
-                    break;
-                case 'in':
-                    if (is_array($data[$word])) {
-                        $db = $db->wherein($words, $data[$word]);
-                    } else {
-                        $db = $db->wherein($words, explode(',', $data[$word]));
-                    }
-
-                    break;
-                default:
-                    $db = $db->where($words, $formula, $data[$word]);
-                    break;
-            }
-
-            return $db;
-        }
-        return $db;
-    }
-
-
-    //判断是否为空
-    protected function isEmpty($data, $word)
-    {
-        if (isset($data[$word]) && (!empty($data[$word]) || $data[$word] === '0'|| $data[$word] === 0)) return false;
-        return true;
-    }
-
-
-    //递归处理数据成子父级关系
-    public function makeTree($parentId, &$node)
-    {
-        $tree = [];
-        foreach ($node as $key => $value) {
-            if ($value['parent_id'] == $parentId) {
-                $tree[$value['id']] = $value;
-                unset($node[$key]);
-                if (isset($tree[$value['id']]['children'])) {
-                    $tree[$value['id']]['children'] = array_merge($tree[$value['id']]['children'], $this->makeTree($value['id'], $node));
-                } else {
-                    $tree[$value['id']]['children'] = $this->makeTree($value['id'], $node);
-                }
-            }
-        }
-        return $tree;
-    }
-
-    //进行递归处理数组的排序问题
-    public function set_sort_circle($data){
-        foreach ($data as $k=>$v){
-//            var_dump($v);die;
-            if(isset($v['children'])&&!empty($v['children'])){
-                $data[$k]['children'] =  $this->set_sort_circle($v['children']);
-            }
-        }
-        $data = array_merge($data);
-
-        return $data;
-    }
-
-
-    //根据编码规则获取每一级的code
-    public function get_rule_code($code, $rule)
-    {
-        $rules = [];
-        $num = 0;
-        foreach ($rule as $v) {
-            $num += $v['num'];
-            $code = substr($code, 0, $num);
-            if (strlen($code) != $num) continue;
-            $rules[] = $code;
-
-        }
-
-        return $rules;
-    }
-
-
-
-    function curlOpen($url, $config = array())
-    {
-        $arr = array('post' => false,'referer' => $url,'cookie' => '', 'useragent' => 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; customie8)', 'timeout' => 100, 'return' => true, 'proxy' => '', 'userpwd' => '', 'nobody' => false,'header'=>array(),'gzip'=>true,'ssl'=>true,'isupfile'=>false,'returnheader'=>false,'request'=>'post');
-        $arr = array_merge($arr, $config);
-        $ch = curl_init();
-
-        curl_setopt($ch, CURLOPT_URL, $url);
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, $arr['return']);
-        curl_setopt($ch, CURLOPT_NOBODY, $arr['nobody']);
-        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
-        curl_setopt($ch, CURLOPT_USERAGENT, $arr['useragent']);
-        curl_setopt($ch, CURLOPT_REFERER, $arr['referer']);
-        curl_setopt($ch, CURLOPT_TIMEOUT, $arr['timeout']);
-
-
-        curl_setopt($ch, CURLOPT_HEADER, $arr['returnheader']);//��ȡheader
-        if($arr['gzip']) curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
-        if($arr['ssl'])
-        {
-            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
-            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
-        }
-        if(!empty($arr['cookie']))
-        {
-            curl_setopt($ch, CURLOPT_COOKIEJAR, $arr['cookie']);
-            curl_setopt($ch, CURLOPT_COOKIEFILE, $arr['cookie']);
-        }
-
-        if(!empty($arr['proxy']))
-        {
-            //curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
-            curl_setopt ($ch, CURLOPT_PROXY, $arr['proxy']);
-            if(!empty($arr['userpwd']))
-            {
-                curl_setopt($ch,CURLOPT_PROXYUSERPWD,$arr['userpwd']);
-            }
-        }
-
-        //ip�Ƚ����⣬�ü�ֵ��ʾ
-        if(!empty($arr['header']['ip']))
-        {
-            array_push($arr['header'],'X-FORWARDED-FOR:'.$arr['header']['ip'],'CLIENT-IP:'.$arr['header']['ip']);
-            unset($arr['header']['ip']);
-        }
-        $arr['header'] = array_filter($arr['header']);
-
-        if(!empty($arr['header']))
-        {
-            curl_setopt($ch, CURLOPT_HTTPHEADER, $arr['header']);
-        }
-
-        if($arr['request'] === 'put'){
-            curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "PUT");
-            curl_setopt($ch, CURLOPT_POSTFIELDS,$arr['post']);
-        }elseif($arr['post'] != false)
-        {
-            curl_setopt($ch, CURLOPT_POST, true);
-            if(is_array($arr['post']) && $arr['isupfile'] === false)
-            {
-                $post = http_build_query($arr['post']);
-            }
-            else
-            {
-                $post = $arr['post'];
-            }
-            curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
-        }
-
-        $result = curl_exec($ch);
-        curl_close($ch);
-
-        return $result;
-    }
-
-}

+ 0 - 232
app/Service/MaterialService.php

@@ -1,232 +0,0 @@
-<?php
-
-namespace App\Service;
-
-use App\Model\BasicMaterial;
-use App\Model\Material;
-use App\Model\MaterialDetail;
-use Illuminate\Support\Facades\DB;
-
-class MaterialService extends Service
-{
-    public function basicMaterialEdit($data){
-        list($status,$msg) = $this->basicMaterialRule($data, false);
-        if(!$status) return [$status,$msg];
-
-        $update = $msg['data'][0];
-        BasicMaterial::where('id',$data['id'])->update($update);
-
-        return [true,'保存成功!'];
-    }
-
-    public function basicMaterialAdd($data,$user){
-        list($status,$msg) = $this->basicMaterialRule($data);
-        if(!$status) return [$status,$msg];
-
-        BasicMaterial::insert($msg['data']);
-
-        return [true,'保存成功!'];
-    }
-
-    public function basicMaterialDel($data){
-        if($this->isEmpty($data,'id')) return [false,'ID必须!'];
-
-        BasicMaterial::where('id',$data['id'])->update([
-            'del_time'=>time()
-        ]);
-
-        return [true,'删除成功'];
-    }
-
-    public function basicMaterialList($data){
-        $list = BasicMaterial::where('del_time',0)
-            ->select('title','crt_time','upd_time','id','parent_id')
-            ->orderBy('id','desc');
-
-        $list = $list->get()->toArray();
-        if(! empty($list)) {
-            $list = $this->makeTree(0,$list);
-            $list = $this->set_sort_circle($list);
-        }
-
-        return [200,$list];
-    }
-
-    public function basicMaterialRule($data, $is_add = true){
-        if($this->isEmpty($data,'data')) return [false,'数据不能为空!'];
-        $title = array_column($data['data'],'title');
-        $title = array_map(function($val) {
-            return $val !== null ? $val : 0;
-        }, $title);
-        $title_count = array_count_values($title);
-        foreach ($title as $value){
-            if(empty($value)) return [false,'名称不能为空!'];
-            if($title_count[$value] > 1) return [false,'名称不能重复'];
-        }
-
-        foreach ($data['data'] as $key => $value){
-            $data['data'][$key]['upd_time'] = time();
-            if($is_add){
-                $bool = BasicMaterial::where('title',$value['title'])
-                    ->where('del_time',0)
-                    ->exists();
-                $data['data'][$key]['crt_time'] = time();
-            }else{
-                if($this->isEmpty($data,'id')) return [false,'id不能为空!'];
-                $bool = BasicMaterial::where('title',$value['title'])
-                    ->where('id','<>',$data['id'])
-                    ->where('del_time',0)
-                    ->exists();
-            }
-            if($bool) return [false,'名称不能重复'];
-
-            $bool = Material::where('del_time',0)
-                ->where('b_m_id',$value['parent_id'])
-                ->exists();
-            if($bool) return [false,'分类下存在物料!'];
-        }
-
-        return [true,$data];
-    }
-
-    public function MaterialEdit($data){
-        list($status,$msg) = $this->MaterialRule($data,false);
-        if(!$status) return [$status,$msg];
-
-        DB::beginTransaction();
-        try{
-            $model = new Material();
-            $model = $model->where('id',$data['id'])->first();
-            $model->b_m_id = $data['b_m_id'] ;
-            $model->title = $data['title'] ;
-            $model->abbreviation_title = $data['abbreviation_title'] ;
-            $model->unit = $data['unit'] ;
-            $model->remark = $data['remark'] ?? '' ;
-            $model->img_url = $data['img_url'] ?? '' ;
-            $model->save();
-
-            $detail_insert = [];
-            MaterialDetail::where('material_id',$model->id)->update([
-                'del_time' => time()
-            ]);
-            if(isset($data['children'])){
-                foreach ($data['children'] as $v){
-                    $detail_insert[] = [
-                        'material_id' => $model->id,
-                        'price' => $v['price'],
-                        'long' => $v['long'],
-                        'width' => $v['width'],
-                        'high' => $v['high'],
-                        'code' => $v['code'],
-                        'brand' => $v['brand'],
-                    ];
-                }
-            }
-            MaterialDetail::insert($detail_insert);
-            DB::commit();
-        }catch (\Exception $e){
-            DB::rollBack();
-            return [false,$e->getMessage()];
-        }
-        return [true,'保存成功!'];
-    }
-
-    public function MaterialAdd($data,$user){
-        list($status,$msg) = $this->MaterialRule($data);
-        if(!$status) return [$status,$msg];
-
-        DB::beginTransaction();
-        try{
-            $model = new Material();
-            $model->b_m_id = $data['b_m_id'] ;
-            $model->title = $data['title'] ;
-            $model->abbreviation_title = $data['abbreviation_title'] ;
-            $model->unit = $data['unit'] ;
-            $model->remark = $data['remark'] ?? '' ;
-            $model->img_url = $data['img_url'] ?? '' ;
-            $model->save();
-
-            $detail_insert = [];
-            if(isset($data['detail'])){
-                foreach ($data['detail'] as $v){
-                    $detail_insert[] = [
-                        'material_id' => $model->id,
-                        'price' => $v['price'],
-                        'long' => $v['long'],
-                        'width' => $v['width'],
-                        'high' => $v['high'],
-                        'code' => $v['code'],
-                        'brand' => $v['brand'],
-                    ];
-                }
-            }
-            MaterialDetail::insert($detail_insert);
-            DB::commit();
-        }catch (\Exception $e){
-            DB::rollBack();
-            return [false,$e->getMessage()];
-        }
-
-        return [true,'保存成功!'];
-    }
-
-    public function MaterialDel($data){
-        if($this->isEmpty($data,'id')) return [false,'ID必须!'];
-
-        Material::where('id',$data['id'])->update([
-            'del_time'=>time()
-        ]);
-
-        MaterialDetail::where('material_id',$data['id'])->update([
-            'del_time'=>time()
-        ]);
-
-        return [true,'删除成功'];
-    }
-
-    public function MaterialList($data){
-        $model = Material::where('del_time',0)
-            ->select('title','b_m_id','abbreviation_title','unit','crt_time','upd_time','id')
-            ->orderBy('id','desc');
-
-        if(! empty($data['b_m_id'])) {
-            $type = BasicMaterial::where('del_time',0)
-                ->select('id','parent_id')
-                ->get()->toArray();
-            $result = array_merge($this->getAllDescendants($type,$data['b_m_id']),[$data['b_m_id']]);
-            $model->whereIn("b_m_id", $result);
-        }
-
-        $list = $this->limit($model,'',$data);
-
-        return [true,$list];
-    }
-
-    public function MaterialDetail($data){
-        if($this->isEmpty($data,'id')) return [false,'ID不能为空!'];
-        $id = $data['id'];
-        $detail = Material::where('del_time',0)->where('id',$id)->select('title','b_m_id','abbreviation_title','unit','crt_time','upd_time','id')->first();
-        if(empty($detail)) return [false,'数据不存在!'];
-        $detail['detail'] = MaterialDetail::where('material_id',$id)->select('price','long','width','high','crt_time','upd_time','code','brand')->get()->toArray();
-
-        return [true,$detail];
-    }
-
-    public function MaterialRule($data,$is_add = true){
-        if($this->isEmpty($data,'b_m_id')) return [false,'物料分类不存在!'];
-        if($this->isEmpty($data,'title')) return [false,'物料名称不存在!'];
-        if($this->isEmpty($data,'abbreviation_title')) return [false,'物料简称不存在!'];
-        if($this->isEmpty($data,'unit')) return [false,'物料单位不存在!'];
-
-        $model = Material::whereRaw("title = '{$data['title']}' OR abbreviation_title = '{$data['abbreviation_title']}'")
-            ->where('del_time',0);
-        if(! $is_add){
-            if($this->isEmpty($data,'id')) return [false,'ID不能为空!'];
-            $model->where('id','<>',$data['id']);
-        }
-        $bool = $model->exists();
-        if($bool) return [false,'名称或简称已经存在!'];
-
-        return [true,''];
-    }
-}

+ 0 - 76
app/Service/MeasureService.php

@@ -1,76 +0,0 @@
-<?php
-
-namespace App\Service;
-
-use App\Model\Measure;
-
-/**
- * 测量相关
- * @package App\Models
- */
-class MeasureService extends Service
-{
-    public function edit($data){
-        if($this->isEmpty($data,'id')) return [201,'ID不存在!'];
-        list($status,$msg) = $this->rule($data);
-        if(!$status) return [$status,$msg];
-        $first = Measure::where('title',$data['title'])->where('id','<>',$data['id'])->where('del_time',0)->first();
-        if(!empty($first))return [false,'名称已存在!'];
-
-        $model = new Measure();
-        $model = $model->where('id',$data['id'])->first();
-        $model->title = $data['title'];
-        $model->e_title = $data['e_title'] ;
-
-        $model->save();
-
-        return [true,'保存成功!'];
-    }
-
-    public function add($data,$user){
-        list($status,$msg) = $this->rule($data);
-        if(!$status) return [$status,$msg];
-        $first = Measure::where('title',$data['title'])->where('del_time',0)->first();
-        if(!empty($first))return [false,'名称已存在!'];
-
-        $model = new Measure();
-        $sort = $model->max('sort');
-
-        $model->title = $data['title'];
-        $model->e_title = $data['e_title'] ;
-        $model->sort = $sort ? $sort + 1 : 1;
-        $model->save();
-
-        return [true,'保存成功!'];
-
-    }
-
-    public function del($data){
-        if($this->isEmpty($data,'id')) return [false,'ID必须!'];
-
-        Measure::where('id',$data['id'])->update([
-            'del_time'=>time()
-        ]);
-
-        return [true,'删除成功'];
-    }
-
-    public function measureList($data){
-        $list = Measure::where('del_time',0)->select('title','e_title','crt_time','upd_time','id')->orderBy('sort','asc');
-
-        $list = $this->limit($list,'',$data);
-
-        return [200,$list];
-    }
-
-    public function rule($data){
-        if($this->isEmpty($data,'title')) return [false,'中文名称不存在!'];
-        if($this->isEmpty($data,'e_title')) return [false,'英文名称不存在!'];
-
-        return [true,''];
-    }
-
-
-
-
-}

+ 0 - 58
app/Service/Order/OrderBoxService.php

@@ -1,58 +0,0 @@
-<?php
-
-namespace App\Service\Order;
-
-
-use App\Model\Orders;
-use App\Model\OrdersHouse;
-use App\Model\OrdersProduct;
-use App\Model\OrdersProductPart;
-use App\Service\Service;
-use Illuminate\Support\Facades\DB;
-
-/**
- * order表相关保存订单基本信息
- * @package App\Models
- */
-class OrderBoxService extends Service
-{
-
-
-    public function box_detail($order_no){
-
-        $data = [
-            [
-                'bom_title' => '部件名称',
-                'product_title' => '产品名称',
-                'order_in_no' => '',
-                'state' => 0,
-            ]
-        ];
-
-        $return = [
-            'total' => 1,
-            'data' => $data
-        ];
-        return [true,$return];
-    }
-
-    public function box_in($data){
-        $order_in_no = $this->setOrderNo();
-
-        return [true,$order_in_no];
-    }
-
-    public function box_out($data){
-        $order_in_no = $this->setOrderNo();
-
-        return [true,$order_in_no];
-    }
-
-    function setOrderNo(){
-        $order_no = date('Ymd').time();
-
-        return $order_no;
-    }
-
-
-}

+ 0 - 143
app/Service/Order/OrderService.php

@@ -1,143 +0,0 @@
-<?php
-
-namespace App\Service\Order;
-
-
-use App\Model\Orders;
-use App\Model\OrdersHouse;
-use App\Model\OrdersProduct;
-use App\Model\OrdersProductBom;
-use App\Model\OrdersProductPart;
-use App\Service\Service;
-use Illuminate\Support\Facades\DB;
-
-/**
- * order表相关保存订单基本信息
- * @package App\Models
- */
-class OrderService extends Service
-{
-
-    public function orderSave($data)
-    {
-        list ($status,$msg) = $this->orderRule($data);
-        if(!$status) return [$status,$msg];
-        $order = new Orders();
-        $order_no = setOrderNo();
-        if(isset($data['order_no']))
-        {
-            $order_no = $data['order_no'];
-            $order = $order->where('order_no',$order_no)->first();
-        }
-
-        $order->order_no = $order_no;
-        $order->out_order_no = $data['out_order_no'] ?? $order_no;
-        $order->project_title = $data['project_title'];
-        $order->address = $data['address'];
-        $order->mobile = $data['mobile'];
-        $order->crt_id = 1;
-        $order->save();
-
-        return [true,$order_no];
-    }
-    public function orderHouseSave($data)
-    {
-        $orderHouse = new OrdersHouse();
-        $title = $data['title'] ?? '';
-        $house = $data['house'] ?? '';
-        $unit = $data['unit'] ?? '';
-        $layer = $data['layer'] ?? '';
-        $number = $data['number'] ?? '';
-        $order_no = $data['order_no'];
-        $first = $orderHouse->where([
-            'title' => $title,
-            'house' => $house,
-            'unit' => $unit,
-            'layer' => $layer,
-            'number' => $number,
-            'order_no' => $order_no,
-        ])->first();
-
-        if(!empty($first)) return [true,$first->id];
-        $orderHouse->order_no = $order_no;
-        $orderHouse->title = $title;
-        $orderHouse->house = $house;
-        $orderHouse->unit = $unit;
-        $orderHouse->layer = $layer;
-        $orderHouse->number = $number;
-        $orderHouse->save();
-
-        return [true,$orderHouse->id];
-    }
-
-    public function orderProductSave($data)
-    {
-        $orderProduct = new OrdersProduct();
-        $order_no = $data['order_no'];
-        $house_id = $data['house_id'];
-        $first = $orderProduct->where([
-            'figure_number' => $data['figure_number'],
-            'house_id' => $house_id,
-            'order_no' => $order_no,
-        ])->first();
-
-        if(!empty($first)) $orderProduct = $first;
-        $orderProduct->order_no = $order_no;
-        $orderProduct->house_id = $house_id;
-        $orderProduct->product_title = $data['product_title']??'';
-        $orderProduct->price = $data['price']??0;
-        $orderProduct->unit = $data['unit']??'';
-        $orderProduct->figure_number = $data['figure_number'];
-        $orderProduct->save();
-
-        return [true,$orderProduct->id];
-    }
-
-    public function orderProductBomSave($data)
-    {
-        $order_no = $data['order_no'];
-        $house_id = $data['house_id'];
-        $o_p_id = $data['o_p_id'];
-        OrdersProductBom::where([
-            'order_no' => $order_no,
-            'house_id' => $house_id,
-            'o_p_id' => $o_p_id,
-        ])->delete();
-
-
-        $insert = [];
-        foreach ($data['bom'] as $v){
-            $insert[] = [
-                'order_no' => $order_no,
-                'o_p_id' => $o_p_id,
-                'house_id' => $house_id,
-                'bom_title' => $v['bom_title']??'',
-                'product_title' => $v['product_title']??'',
-                'route_id' => $v['route_id']??0,
-                'crt_time' => time(),
-                'upd_time' => time(),
-                'procedure_properties' => $v['procedure_properties'] ?? '',
-                'measure' => $v['measure']??'',
-                'price' => $v['price'],
-                'bom_id' => $v['bom_id']
-            ];
-        }
-        OrdersProductBom::insert($insert);
-        return [true,''];
-    }
-
-    public function orderRule($data)
-    {
-        if ($this->isEmpty($data, 'project_title')) return [false, '名称不存在!'];
-        if ($this->isEmpty($data, 'address')) return [false, '单位不存在!'];
-        if ($this->isEmpty($data, 'mobile')) return [false, '芯片设置不存在!'];
-//        if($this->isEmpty($data,'icon')) return [201,'d不存在!'];
-//        if($this->isEmpty($data,'uri')) return [false,'路由不存在!'];
-
-
-        return [true, ''];
-    }
-
-
-
-}

+ 0 - 48
app/Service/Order/OrderTagService.php

@@ -1,48 +0,0 @@
-<?php
-
-namespace App\Service\Order;
-
-
-use App\Model\Orders;
-use App\Model\OrdersHouse;
-use App\Model\OrdersProduct;
-use App\Model\OrdersProductPart;
-use App\Service\Service;
-use Illuminate\Support\Facades\DB;
-
-/**
- * order表相关保存订单基本信息
- * @package App\Models
- */
-class OrderTagService extends Service
-{
-
-    public function setTag($order_no){
-        //写死的工序
-        $procedure_ids = [
-            10,13,14,17,21
-        ];
-    }
-
-
-    public function getOrderTag($order_no){
-
-        $data = [
-            [
-                'order_no' => '1',
-                'tag' => '12',
-                'bom_title' => 'bom名称',
-                'product_title' => '产品名称',
-                'figure_number' => '图号',
-                'sub_state' => '0',
-            ]
-        ];
-
-        $return =  [
-            'total'=>1,
-            'data'=>$data,
-        ];
-
-        return [200,$return];
-    }
-}

+ 0 - 62
app/Service/Order/OrderTransportService.php

@@ -1,62 +0,0 @@
-<?php
-
-namespace App\Service\Order;
-
-
-use App\Model\Orders;
-use App\Model\OrdersHouse;
-use App\Model\OrdersProduct;
-use App\Model\OrdersProductPart;
-use App\Service\Service;
-use Illuminate\Support\Facades\DB;
-
-/**
- * order表相关保存订单基本信息
- * @package App\Models
- */
-class OrderTransportService extends Service
-{
-
-
-    public function transportDetail($data){
-        $data = [
-            [
-                'order_in_no' => '包装单号',
-                'transport_no' => '发货单号',
-                'state' => '0未发货,1已发货,2已收货',
-                'tag' => '芯片',
-                'bom_title' => '门板',
-                'product_title' => '柜子',
-            ]
-        ];
-
-        $return  = [
-            'data' => $data,
-            'total' => 1,
-        ];
-
-        return [true,$return];
-    }
-
-
-    public function boxTransport($data){
-        $order_in_no = $this->setOrderNo();
-
-        return [true,$order_in_no];
-    }
-
-    public function transportConfirm($data){
-        $order_in_no = $this->setOrderNo();
-
-        return [true,$order_in_no];
-    }
-
-
-    function setOrderNo(){
-        $order_no = date('Ymd').time();
-
-        return $order_no;
-    }
-
-
-}

+ 0 - 216
app/Service/OrderService.php

@@ -1,216 +0,0 @@
-<?php
-
-namespace App\Service;
-
-
-use App\Model\Bom;
-use App\Model\BomDetail;
-use App\Model\BomDetailMeasure;
-use App\Model\BomMaterial;
-use App\Model\Orders;
-use App\Model\OrdersHouse;
-use App\Model\OrdersProduct;
-use App\Model\OrdersProductBom;
-use App\Model\SysMenu;
-use Illuminate\Support\Facades\DB;
-use App\Service\Order\OrderService as OrderHook;
-
-/**
- * bom相关
- * @package App\Models
- */
-class OrderService extends Service
-{
-
-    public function edit($data){
-        list($status,$msg) = $this->orderRule($data);
-        if(!$status) return [$status,$msg];
-        if($this->isEmpty($data,'id')) return [false,'ID必须!'];
-        $id = $data['id'];
-        $first = Bom::where('title',$data['title'])->where('id','<>',$id)->where('del_time',0)->first();
-        if(!empty($first))return [false,'名称已存在!'];
-        try{
-            DB::beginTransaction();
-            $model = Bom::where('id',$id)->first();
-            $model->title = $data['title'];
-            $model->formula = $data['formula'] ?? '';
-            $model->unit = $data['unit'];
-            $model->label = $data['label'] ?? 0;
-            $model->label_type = $data['label_type'] ?? 0;
-            $model->save();
-            $material_insert = [];
-            $detail_insert = [];
-            $bom_id = $model->id;
-            BomDetail::where('bom_id',$bom_id)->update([
-                'del_time' => time()
-            ]);
-            BomMaterial::where('bom_id',$bom_id)->update([
-                'del_time' => time()
-            ]);
-            if(isset($data['detail'])){
-                foreach ($data['detail'] as $v){
-                    $bom_detail = new BomDetail();
-                    $bom_detail->bom_id = $bom_id;
-                    $bom_detail->sub_bom_id = $v['sub_bom_id'];
-                    $bom_detail->formula = $v['formula']??'';
-                    $bom_detail->num = $v['num'];
-                    $bom_detail->save();
-                    $bom_detail_id = $bom_detail->id;
-                    $bom_detail_insert = [];
-                    foreach ($v['measure'] as $vv){
-                        $bom_detail_insert[] = [
-                            'bom_id' => $bom_id,
-                            'bom_detail_id' => $bom_detail_id,
-                            'measure_id' => $vv['measure_id'],
-                            'value' => $vv['value'],
-                        ];
-                    }
-                    BomDetailMeasure::insert($bom_detail_insert);
-                }
-                BomDetail::insert($detail_insert);
-            }
-
-            if(isset($data['material'])){
-                foreach ($data['material'] as $v){
-                    $material_insert[] = [
-                        'bom_id' => $id,
-                        'formula' => $v['formula']??'',
-                        'num' => $v['num'],
-                        'material_id' => $v['id'],
-                        'crt_time' => time(),
-                        'upd_time' => time(),
-                    ];
-                }
-                BomMaterial::insert($material_insert);
-            }
-            DB::commit();
-        }catch (\Exception $e){
-            DB::rollBack();
-            return [false,$e->getMessage()];
-        }
-
-
-        return [true,'保存成功!'];
-
-    }
-
-    public function add($data,$user){
-
-//        if($this->isEmpty($data,'title')) return [201,'名称不存在!'];
-        list($status,$msg) = $this->orderRule($data);
-//        if($this->isEmpty($data,'id')) return [false,'ID不存在!'];
-        if(!$status) return [$status,$msg];
-//        $first = Orders::where('out_order_no',$data['out_order_no'])->where('del_time',0)->first();
-//        if(!empty($first))return [false,'单号已存在!'];
-        $orderService = new OrderHook();
-        try{
-            DB::beginTransaction();
-            $bom_list =
-            list($status,$order_no) = $orderService->orderSave($data);
-            foreach ($data['house'] as $v){
-                $v['order_no'] = $order_no;
-                list($status,$house_id) = $orderService->orderHouseSave($v);
-//                var_dump($v);
-                foreach ($v['product'] as $product){
-                    $product['order_no'] = $order_no;
-                    $product['house_id'] = $house_id;
-                    list($status,$order_product_id) = $orderService->orderProductSave($product);
-                    $product['house_id'] = $house_id;
-                    $product['order_no'] = $order_no;
-                    $product['o_p_id'] = $order_product_id;
-
-                    $orderService->orderProductBomSave($product);
-                }
-            }
-
-            DB::commit();
-        }catch (\Exception $e){
-            DB::rollBack();
-            return [false,$e->getLine().':'.$e->getMessage()];
-        }
-
-
-        return [true,'保存成功!'];
-
-    }
-
-    public function del($data){
-        if($this->isEmpty($data,'order_no')) return [false,'order_no必须!'];
-        $id = $data['order_no'];
-        Orders::where('order_no',$id)->update([
-            'del_time'=>time()
-        ]);
-
-        return [true,'删除成功'];
-    }
-
-    public function orderDetail($data){
-        $order_no = $data['order_no'];
-        $order = Orders::where('order_no',$order_no)->first()->toArray();
-
-        $house_list = OrdersHouse::where('order_no',$order_no)->select('*')->get()->toArray();
-
-        $order_product_list = OrdersProduct::where('order_no',$order_no)->select('*','product_title as title')->get()->toArray();
-
-        $order_product_bom_list = OrdersProductBom::where('order_no',$order_no)->select('*','bom_title as title')->get()->toArray();
-
-        $order_product_key_list = [];
-        foreach ($order_product_list as $v){
-            $order_product_key_list[$v['house_id']][] = $v;
-        }
-
-        $order_product_bom_key_list = [];
-        foreach ($order_product_bom_list as $v){
-            $order_product_bom_key_list[$v['o_p_id']][] = $v;
-        }
-
-        foreach ($house_list as $v){
-            if(isset($order_product_key_list[$v['id']])){
-                foreach ($order_product_key_list[$v['id']] as &$vv){
-                    if(isset($order_product_bom_key_list[$vv['id']])){
-                        $vv['bom'] = $order_product_bom_key_list[$vv['id']];
-                    }
-                }
-                $v['product'] = $order_product_key_list[$v['id']];
-            }
-            $order['house'][] = $v;
-        }
-//        var_dump($order);die;
-        return [200,$order];
-    }
-
-    public function orderList($data){
-//        $id = $data['id'];
-        $return = Orders::where('del_time',0)->select('*');
-        $return = $this->limit(
-            $return,'',$data
-        );
-//        $return['bom_detail'] = Bom::from('bom_detail as bd')
-//            ->leftJoin('bom as b','b.id','bd.bom_id')
-//            ->where('bd.del_time',0)
-//            ->select('title','bd.*')->get()->toArray();
-//
-//
-//        $return['material'] = Bom::from('bom_material as bm')
-//            ->leftJoin('material as m','m.id','bm.bom_id')
-//            ->where('bm.del_time',0)
-//            ->select('m.title','bm.*')->get()->toArray();
-
-
-        return [200,$return];
-    }
-
-    public function orderRule($data){
-        if($this->isEmpty($data,'out_order_no')) return [false,'订单号不存在!'];
-        if($this->isEmpty($data,'project_title')) return [false,'项目名称不存在!'];
-        if($this->isEmpty($data,'address')) return [false,'地址不存在!'];
-        if($this->isEmpty($data,'mobile')) return [false,'手机号不存在!'];
-//        if($this->isEmpty($data,'icon')) return [201,'d不存在!'];
-//        if($this->isEmpty($data,'uri')) return [false,'路由不存在!'];
-
-
-        return [true,''];
-    }
-
-
-}

+ 0 - 148
app/Service/ProcedureService.php

@@ -1,148 +0,0 @@
-<?php
-
-namespace App\Service;
-
-
-use App\Model\SysMenu;
-use App\Models\BasicProcedure;
-use App\Models\BasicProcess;
-use App\Models\Procedure;
-
-/**
- * 工序相关
- * @package App\Models
- */
-class ProcedureService extends Service
-{
-
-    public function basicProcedureEdit($data){
-        list($status,$msg) = $this->basicProcedureRule($data);
-        if(!$status) return [$status,$msg];
-        if($this->isEmpty($data,'id')) return [false,'ID不存在'];
-        $first = BasicProcedure::where('title',$data['title'])->where('del_time',0)->first();
-        if(!empty($first))return [false,'名称已存在!'];
-
-
-        $model = new BasicProcedure();
-        $model = $model->where('id',$data['id'])->first();
-        $model->title = $data['title'];
-        $model->parent_id = $data['parent_id'] ;
-        $model->save();
-
-
-        return [true,'保存成功!'];
-
-    }
-
-    public function basicProcedureAdd($data,$user){
-
-
-//        if($this->isEmpty($data,'title')) return [201,'名称不存在!'];
-        list($status,$msg) = $this->basicProcedureRule($data);
-        if(!$status) return [$status,$msg];
-        $first = BasicProcedure::where('title',$data['title'])->where('del_time',0)->first();
-        if(!empty($first))return [false,'名称已存在!'];
-
-        $model = new BasicProcedure();
-
-        $model->title = $data['title'];
-        $model->parent_id = $data['parent_id'] ;
-        $model->save();
-
-        return [true,'保存成功!'];
-
-    }
-
-    public function basicProcedureDel($data){
-        if($this->isEmpty($data,'id')) return [false,'ID必须!'];
-
-        BasicProcedure::where('id',$data['id'])->update([
-            'del_time',time()
-        ]);
-
-        return [true,'删除成功'];
-    }
-
-    public function basicProcedureList($data){
-        $list = BasicProcedure::where('del_time',0)->select('title','parent_id','crt_time','upd_time')->get()->toArray();
-        $return = $this->makeTree(0,$list);
-        $return = $this->set_sort_circle($return);
-
-
-        return [200,$return];
-    }
-
-    public function basicProcedureRule($data){
-        if($this->isEmpty($data,'title')) return [false,'名称不存在!'];
-        if($this->isEmpty($data,'parent_id')) return [false,'父级不存在!'];
-
-        return [true,''];
-    }
-
-
-    public function procedureEdit($data){
-        list($status,$msg) = $this->procedureRule($data);
-        if(!$status) return [$status,$msg];
-        if($this->isEmpty($data,'id')) return [false,'ID不存在'];
-        $first = Procedure::where('title',$data['title'])->where('id','<>',$data['id'])->where('del_time',0)->first();
-        if(!empty($first))return [false,'名称已存在!'];
-
-
-        $model = new Procedure();
-        $model = $model->where('id',$data['id'])->first();
-        $model->title = $data['title'];
-        $model->p_id = $data['p_id'] ;
-        $model->save();
-
-
-        return [true,'保存成功!'];
-
-    }
-
-    public function procedureAdd($data,$user){
-
-
-//        if($this->isEmpty($data,'title')) return [201,'名称不存在!'];
-        list($status,$msg) = $this->procedureRule($data);
-        if(!$status) return [$status,$msg];
-        $first = Procedure::where('title',$data['title'])->where('del_time',0)->first();
-        if(!empty($first))return [false,'名称已存在!'];
-
-        $model = new Procedure();
-
-        $model->title = $data['title'];
-        $model->p_id = $data['p_id'] ;
-        $model->save();
-
-        return [true,'保存成功!'];
-
-    }
-
-    public function procedureDel($data){
-        if($this->isEmpty($data,'id')) return [false,'ID必须!'];
-
-        Procedure::where('id',$data['id'])->update([
-            'del_time',time()
-        ]);
-
-        return [true,'删除成功'];
-    }
-
-    public function procedureList($data){
-        $list = Procedure::where('del_time',0)->select('title','p_id','crt_time','upd_time')->get()->toArray();
-
-        $list = $this->limit($list,'',$data);
-
-
-        return [200,$list];
-    }
-
-    public function procedureRule($data){
-        if($this->isEmpty($data,'title')) return [false,'名称不存在!'];
-        if($this->isEmpty($data,'p_id')) return [false,'分类不存在!'];
-
-        return [true,''];
-    }
-
-
-}

+ 0 - 175
app/Service/ProcessService.php

@@ -1,175 +0,0 @@
-<?php
-
-namespace App\Service;
-
-use App\Model\BasicProcess;
-use App\Model\Process;
-use App\Model\Technology;
-
-/**
- * 工序相关
- * @package App\Models
- */
-class ProcessService extends Service
-{
-    public function basicProcessEdit($data){
-        list($status,$msg) = $this->basicProcessRule($data,false);
-        if(!$status) return [$status,$msg];
-
-        $update = $msg['data'][0];
-        BasicProcess::where('id',$data['id'])->update($update);
-
-        return [true,'保存成功!'];
-    }
-
-    public function basicProcessAdd($data,$user){
-        list($status,$msg) = $this->basicProcessRule($data);
-        if(!$status) return [$status,$msg];
-
-        BasicProcess::insert($msg['data']);
-
-        return [true,'保存成功!'];
-    }
-
-    public function basicProcessDel($data){
-        if($this->isEmpty($data,'id')) return [false,'ID必须!'];
-
-        BasicProcess::where('id',$data['id'])->update([
-            'del_time' => time()
-        ]);
-
-        return [true,'删除成功'];
-    }
-
-    public function basicProcessList($data){
-        $list = BasicProcess::where('del_time',0)->select('title','parent_id','crt_time','upd_time','id')->get()->toArray();
-        $return = $this->makeTree(0,$list);
-        $return = $this->set_sort_circle($return);
-
-        return [200,$return];
-    }
-
-    public function basicProcessRule($data,$is_add = true){
-        if($this->isEmpty($data,'data')) return [false,'数据不能为空!'];
-        $title = array_column($data['data'],'title');
-        $title = array_map(function($val) {
-            return $val !== null ? $val : 0;
-        }, $title);
-        $title_count = array_count_values($title);
-        foreach ($title as $value){
-            if(empty($value)) return [false,'名称不能为空!'];
-            if($title_count[$value] > 1) return [false,'名称不能重复'];
-        }
-
-        foreach ($data['data'] as $key => $value){
-            $data['data'][$key]['upd_time'] = time();
-            if($is_add){
-                $bool = BasicProcess::where('title',$value['title'])
-                    ->where('del_time',0)
-                    ->exists();
-                $data['data'][$key]['crt_time'] = time();
-            }else{
-                if($this->isEmpty($data,'id')) return [false,'id不能为空!'];
-                $bool = BasicProcess::where('title',$value['title'])
-                    ->where('id','<>',$data['id'])
-                    ->where('del_time',0)
-                    ->exists();
-            }
-            if($bool) return [false,'名称不能重复'];
-
-            $bool = Process::where('del_time',0)
-                ->where('p_id',$value['parent_id'])
-                ->exists();
-            if($bool) return [false,'分类下存在工序!'];
-        }
-
-        return [true,$data];
-    }
-
-    public function processEdit($data){
-        list($status,$msg) = $this->processRule($data);
-        if(!$status) return [$status,$msg];
-        if($this->isEmpty($data,'id')) return [false,'ID不存在'];
-        $first = Process::where('title',$data['title'])->where('id','<>',$data['id'])->where('del_time',0)->first();
-        if(!empty($first))return [false,'名称已存在!'];
-
-        $model = new Process();
-        $model = $model->where('id',$data['id'])->first();
-        $model->title = $data['title'];
-        $model->p_id = $data['p_id'];
-        $model->time = $data['time'] ?? '';
-        $model->capacity = $data['capacity'] ?? '';
-        $model->wages_unit = $data['wages_unit'] ?? 0;
-        $model->wages = $data['wages'] ?? '';
-        $model->team_id = $data['team_id'] ?? 0;
-        $model->save();
-
-        return [true,'保存成功!'];
-    }
-
-    public function processAdd($data,$user){
-        list($status,$msg) = $this->processRule($data);
-        if(!$status) return [$status,$msg];
-        $first = Process::where('title',$data['title'])->where('del_time',0)->first();
-        if(!empty($first))return [false,'名称已存在!'];
-
-        $model = new Process();
-
-        $model->title = $data['title'];
-        $model->p_id = $data['p_id'];
-        $model->time = $data['time'] ?? '';
-        $model->capacity = $data['capacity'] ?? '';
-        $model->wages_unit = $data['wages_unit'] ?? 0;
-        $model->wages = $data['wages'] ?? '';
-        $model->team_id = $data['team_id'] ?? '';
-        $model->save();
-
-        return [true,'保存成功!'];
-    }
-
-    public function processDel($data){
-        if($this->isEmpty($data,'id')) return [false,'ID必须!'];
-
-        $bool = Technology::where('del_time',0)
-            ->whereRaw("find_in_set('{$data['id']}',process_id)")
-            ->exists();
-        if($bool) return [false, '工序已经绑定工艺路线!'];
-
-        Process::where('id',$data['id'])->update([
-            'del_time' => time()
-        ]);
-
-        return [true,'删除成功'];
-    }
-
-    public function processList($data){
-        $model = Process::where('del_time',0)->select('*');
-        if(! empty($data['p_id'])) {
-            $type = BasicProcess::where('del_time',0)
-                ->select('id','parent_id')
-                ->get()->toArray();
-            $result = array_merge($this->getAllDescendants($type,$data['p_id']),[$data['p_id']]);
-            $model->whereIn("p_id", $result);
-        }
-        if(! empty($data['title'])) $model->where('title', 'LIKE', '%'.$data['title'].'%');
-
-        $list = $this->limit($model,'',$data);
-
-        return [200,$list];
-    }
-
-    public function processRule($data){
-        if($this->isEmpty($data,'title')) return [false,'名称不存在!'];
-        if($this->isEmpty($data,'p_id')) return [false,'分类不存在!'];
-
-        return [true,''];
-    }
-
-    public function processDetail($data){
-        if($this->isEmpty($data,'id')) return [false,'ID不能为空!'];
-        $first = Process::where('id',$data['id'])->select("*")->first();
-        if(empty($first)) return [true,[]];
-
-        return [true,$first->toArray()];
-    }
-}

+ 0 - 148
app/Service/ProductService.php

@@ -1,148 +0,0 @@
-<?php
-
-namespace App\Service;
-
-
-use App\Model\Depart;
-use App\Model\Employee;
-use App\Model\EmployeeDepartPermission;
-use App\Model\EmployeeMenuPermission;
-use App\Model\EmployeeTeamPermission;
-use App\Model\Measure;
-use App\Model\Product;
-use App\Model\ProductDetail;
-use App\Model\Role;
-use App\Model\SysMenu;
-use App\Model\Team;
-use Illuminate\Support\Facades\DB;
-use Illuminate\Support\Facades\Hash;
-
-/**
- * 产品相关
- * @package App\Models
- */
-class ProductService extends Service
-{
-
-    public function edit($data){
-        if($this->isEmpty($data,'id')) return [201,'ID不存在!'];
-        list($status,$msg) = $this->rule($data);
-        if(!$status) return [$status,$msg];
-        $first = Product::where('title',$data['title'])->where('id','<>',$data['id'])->where('del_time',0)->first();
-        if(!empty($first))return [false,'名称已存在!'];
-        DB::beginTransaction();
-        try{
-
-            $model = new Product();
-            $model = $model->where('id',$data['id'])->first();
-            $model->title = $data['title'];
-            $model->unit = $data['unit'] ;
-            $model->model = $data['model'] ?? '';
-            $model->save();
-            $product_id = $model->id;
-            $product_detail_insert = [];
-            foreach ($data['product_detail'] as $v) {
-
-                $product_detail_insert[] = [
-                    'bom_id' => $v['bom_id'],
-                    'num' => $v['num'],
-                    'product_id' => $product_id,
-                ];
-            }
-            ProductDetail::insert($product_detail_insert);
-            DB::commit();
-            return [true,'保存成功'];
-        }catch (\Exception $e){
-            DB::rollBack();
-            return [false,$e->getMessage()];
-        }
-
-
-
-    }
-
-    public function add($data,$user){
-
-
-//        if($this->isEmpty($data,'title')) return [201,'名称不存在!'];
-        list($status,$msg) = $this->rule($data);
-        if(!$status) return [$status,$msg];
-        $first = Product::where('title',$data['title'])->where('del_time',0)->first();
-        if(!empty($first))return [false,'名称已存在!'];
-        DB::beginTransaction();
-        try{
-
-            $model = new Product();
-            $model->title = $data['title'];
-            $model->unit = $data['unit'] ;
-            $model->model = $data['model'] ?? '';
-            $model->save();
-            $product_id = $model->id;
-            $product_detail_insert = [];
-            foreach ($data['product_detail'] as $v) {
-
-                $product_detail_insert[] = [
-                    'bom_id' => $v['bom_id'],
-                    'num' => $v['num'],
-                    'product_id' => $product_id,
-                ];
-            }
-            ProductDetail::insert($product_detail_insert);
-            DB::commit();
-            return [true,'保存成功'];
-        }catch (\Exception $e){
-            DB::rollBack();
-            return [false,$e->getMessage()];
-        }
-
-
-
-
-    }
-
-    public function del($data){
-        if($this->isEmpty($data,'id')) return [false,'ID必须!'];
-
-        Product::where('id',$data['id'])->update([
-            'del_time'=>time()
-        ]);
-
-        return [true,'删除成功'];
-    }
-
-    public function productList($data){
-        $list = Product::where('del_time',0)->select('title','unit','model','crt_time','upd_time','id')->orderBy('sort','asc');
-
-        $list = $this->limit($list,'',$data);
-
-        return [200,$list];
-    }
-
-    public function productDetail($data){
-
-        $first = Product::where('del_time',0)->where('id',$data['id'])->select('title','unit','model','crt_time','upd_time','id')->first();
-
-        if(empty($first)) return [false,'err'];
-
-
-
-        $first = $first->toArray();
-        $first['detail'] = ProductDetail::from('product_detail as pd')
-            ->leftJoin('bom as m','m.id','pd.bom_id')
-            ->select('title','unit','num')->get()->toArray();
-        return [200,$first];
-    }
-
-    public function rule($data){
-        if($this->isEmpty($data,'title')) return [false,'中文名称不存在!'];
-//        if($this->isEmpty($data,'icon')) return [201,'d不存在!'];
-        if($this->isEmpty($data,'unit')) return [false,'单位不存在!'];
-        if($this->isEmpty($data,'model')) return [false,'型号不存在!'];
-
-        return [true,''];
-    }
-
-
-
-
-}

+ 0 - 173
app/Service/Transport/TransportHookService.php

@@ -1,173 +0,0 @@
-<?php
-
-namespace App\Service\Transport;
-
-
-
-use App\Model\Box;
-use App\Model\BoxDetail;
-use App\Model\Header_ext;
-use App\Service\Service;
-
-/**
- * 发货相关工厂模式
- * @package App\Models
- */
-class TransportHookService extends Service
-{
-
-    protected static $instance;
-    protected static $transport_header;
-    protected static $transport_detail_header;
-
-    public function __construct(){
-
-        self::$transport_header = Header_ext::where('type','box')->pluck('value','key')->toArray();
-        self::$transport_detail_header = Header_ext::where('type','box_detail')->pluck('value','key')->toArray();
-
-    }
-
-    public static function getInstance(): self
-    {
-        if (self::$instance == null) {
-            self::$instance = new HeaderWordHookService();
-        }
-        return self::$instance;
-    }
-
-    /**
-     * 包装单新增
-     * @param $data
-     * @return array
-     */
-    public function boxInsert($data){
-        $box = new Box();
-        $data['order_no'] = $this->setOrderNo();
-        if(!isset($data['out_order_no'])) return [false,'out_order_no is not exist'];
-        list($status,$box) = $this->dealBox($box,$data);
-        if(!$status) return [false,$box];
-        $box->save();
-        list($status,$msg) =  $this->boxDetailInsert($data);
-        if(!$status) return [false,$msg];
-
-        return [true,$box];
-    }
-
-
-    /**
-     * @param $box
-     * @param $data
-     * @return mixed
-     */
-
-    public function dealBox($box,$data){
-
-        $box->order_no = $data['order_no'];
-        $box->out_order_no = $data['out_order_no'];
-        $box->ext_1 = isset($data['ext_1']) ? $data['ext_1'] : '';
-        $box->ext_2 = isset($data['ext_2']) ? $data['ext_2'] : '';
-        $box->ext_3 = isset($data['ext_3']) ? $data['ext_3'] : '';
-        $box->ext_4 = isset($data['ext_4']) ? $data['ext_4'] : '';
-        $box->ext_5 = isset($data['ext_5']) ? $data['ext_5'] : '';
-
-        return [true,$box];
-
-    }
-
-
-    /**
-     * 包装单详情新增
-     * @param $data
-     * @return array
-     */
-    public function boxDetailInsert($data){
-        $order_no = $data['order_no'];
-        $out_order_no = $data['out_order_no'];
-        $box_detail = new BoxDetail(['channel'=>$order_no]);
-
-        if(!isset($data['detail'])) return [false,'detail is not exist'];
-
-        $insert = $data['detail'];
-
-        list($status,$insert) = $this->dealBoxDetail($insert,$order_no,$out_order_no);
-        if(!$status) return [false,$insert];
-        $box_detail->insert($insert);
-        return [true,''];
-    }
-
-    /**
-     * 包装单详情数据处理
-     * @param $data
-     * @return array
-     */
-    public function dealBoxDetail($data,$order_no,$out_order_no){
-        $insert = [];
-        $time = time();
-        foreach ($data as $v){
-            if(!isset($v['top_id'])) return [false,'top_id is not exist'];
-            if(!isset($v['code'])) return [false,'code is not exist'];
-            if(!isset($v['title'])) return [false,'title is not exist'];
-
-            $insert[] = [
-                'order_no' => $order_no,
-                'out_order_no' => $out_order_no,
-                'top_id' => $v['top_id'],
-                'code' => $v['code'],
-                'title' => $v['title'],
-                'type' => isset($v['type'])?$v['type'] : 1,
-                'crt_time' => $time,
-                'upd_time' => $time,
-                'ext_1' => isset($v['ext_1']) ? $v['ext_1'] : '',
-                'ext_2' => isset($v['ext_2']) ? $v['ext_2'] : '',
-                'ext_3' => isset($v['ext_3']) ? $v['ext_3'] : '',
-                'ext_4' => isset($v['ext_4']) ? $v['ext_4'] : '',
-                'ext_5' => isset($v['ext_5']) ? $v['ext_5'] : '',
-
-            ];
-        }
-
-
-        return [true,$insert];
-    }
-
-
-    /**
-     * @return string
-     */
-    public function setOrderNo(){
-
-        return date('YmdHis').rand(1000,9999);
-    }
-
-    /**
-     * @param $data
-     * @return array
-     */
-    public function boxList($data){
-        $box = new Box();
-        $list = $this->limit($box,'*',$data);
-
-        return [true,$list];
-
-    }
-
-    /**
-     * @param $data
-     * @return array
-     */
-    public function boxDetail($data){
-        $order_no = $data['order_no'];
-
-        $box = new BoxDetail(['channel'=>$order_no]);
-
-        $list = $this->limit($box,'*',$data);
-
-        return [true,$list];
-    }
-
-
-
-
-
-
-}