cqpCow 1 anno fa
parent
commit
c8742c0d06
3 ha cambiato i file con 38 aggiunte e 106 eliminazioni
  1. 22 0
      app/Http/Controllers/Api/CheckController.php
  2. 13 106
      app/Service/CheckService.php
  3. 3 0
      routes/api.php

+ 22 - 0
app/Http/Controllers/Api/CheckController.php

@@ -0,0 +1,22 @@
+<?php
+
+namespace App\Http\Controllers\Api;
+
+use App\Service\CheckService;
+use Illuminate\Http\Request;
+
+class CheckController extends BaseController
+{
+    public function checkAll(Request $request)
+    {
+        $service = new CheckService();
+        $userData = $request->userData->toArray();
+        list($status,$data) = $service->checkAll($request->all(),$userData);
+
+        if($status){
+            return $this->json_return(200,'',$data);
+        }else{
+            return $this->json_return(201,$data);
+        }
+    }
+}

+ 13 - 106
app/Service/CheckService.php

@@ -28,99 +28,37 @@ use Illuminate\Support\Facades\DB;
 class CheckService extends Service
 {
     //审批操作对应的数值
-    const one = 1; //领料单申领区域审批
-    const two = 2; //领料单发货区域审批
-    const three = 3; //领料单收货区域审批
-    const four = 4; //领料单入库区域审批
-    const five = 5; //施工单审核
-    const six = 6; //退料单审核
-    const seven = 7; //调拨单详情审核
-    const eight = 8; //调拨单入库审核
-    const nine = 9; //调拨单出库审核
-    const ten = 10; //盘点单详情审核
-    const eleven = 11; //盘点单入库审核
-    const twl = 12; //盘点单出库审核
-    const thirteen = 13; //计费领料单审核
+    const one = 1; //收货
+    const two = 2; //发货
+    const three = 3; //采购
+    const four = 4; //销售订单
+    const five = 5; //施工单
 
     //中文对照
     public $map = [
-        self::one => '领料单申领区域审批',
-        self::two => '领料单发货区域审批',
-        self::three => '领料单收货区域审批',
-        self::four => '领料单入库区域审批',
-        self::five => '施工单审核',
-        self::six => '退料单审核',
-        self::seven => '调拨单详情审核',
-        self::eight => '调拨单入库审核',
-        self::nine => '调拨单出库审核',
-        self::ten => '盘点单详情审核',
-        self::eleven => '盘点单入库审核',
-        self::twl => '盘点单出库审核',
-        self::thirteen => '计费领料单审核',
+        self::one => '收货单',
+        self::two => '发货单',
+        self::three => '采购单',
+        self::four => '销售订单',
+        self::five => '施工单',
     ];
 
     const TYPE_ONE = 1;//通过
     const TYPE_TWO = 2;//不通过
 
-    //对应具体单子的具体操作数值(将待审批改为通过或者未审批)
     public static $opt_case = [
-        self::one => 'check_material_order_apply', //领料单申领区域审批
-        self::two => 'check_material_order_send', //领料单发货区域审批
-        self::three => 'check_material_order_take', //领料单收货区域审批
-        self::four => 'check_material_order_In', //领料单入库区域审批 审批通过后有入库流水
-        self::five => 'check_construction', //施工单审核  审批通过后有出库流水
-        self::six => 'check_material_return', //退料单审核  审批通过后有出库流水
-        self::seven => 'check_transfer_sub', //调拨单详情审核
-        self::eight => 'check_transfer_in_sub', //调拨单入库审核  审批通过后有入库流水
-        self::nine => 'check_transfer_out_sub', //调拨单出库审核  审批通过后有出库流水
-        self::ten => 'check_inventory_sub', //盘点单详情审核
-        self::eleven => 'check_inventory_in_sub', //盘点单入库审核   审批通过后有入库流水
-        self::twl => 'check_inventory_out_sub', //盘点单出库审核  审批通过后有出库流水
-        self::thirteen => 'check_material_charge', //计费领料单审核
+
     ];
 
-    //单子审批通过后产生流水
     public static $record = [
-        self::four => 'record_material_order_In',
-        self::five => 'record_construction',
-        self::six => 'record_material_return',
-        self::eight => 'record_transfer_in_sub',
-        self::nine => 'record_transfer_out_sub',
-        self::eleven => 'record_inventory_in_sub',
-        self::twl => 'record_inventory_out_sub',
-    ];
 
-    //将状态改为待审核
-    public static $opt_case2 = [
-        self::one => 'set_status_to_one',
-        self::two => '',
-        self::three => '',
-        self::four => '',
-        self::five => '',
-        self::six => '',
-        self::seven => '',
-        self::eight => '',
-        self::nine => '',
-        self::ten => '',
-        self::eleven => '',
-        self::twl => '',
-        self::thirteen => '',
     ];
 
-    //将状态改为待审核
-    public function set_status_to_one($data){
-        return [true,''];
-    }
-
-    /**
-     * order_number 单据名称
-     * opt_case 审核单据的区域 有已经定义的方法
-     */
     public function checkAll($data,$user){
-        if(empty($data['order_number']) || empty($data['opt_case']) || ! isset(self::$opt_case2[$data['opt_case']])) return [false,'必传参数不能为空或者参数值错误!'];
+        if(empty($data['order_number']) || empty($data['opt_case'])) return [false,'必传参数不能为空或者参数值错误!'];
 
         //具体方法
-        $function = self::$opt_case2[$data['opt_case']];
+        $function = self::$opt_case[$data['opt_case']];
 
         try{
             DB::beginTransaction();
@@ -133,15 +71,6 @@ class CheckService extends Service
                 return [false, $msg];
             }
 
-            //创建审批流
-            $args = [
-                'order_no' => $data['order_number'],
-                'menu_id' => $data['menu_id'] ?? 0,
-                'type' => $data['opt_case']
-            ];
-            $oa = new OaService();
-            $bool = $oa->createOaOrder($args);
-
             DB::commit();
             return [true, ''];
         }catch (\Throwable $exception){
@@ -150,29 +79,7 @@ class CheckService extends Service
         }
 
     }
-    //创建审批流 将状态改为待审核  结束
-
-    //将待审核状态改为审批通过或者驳回
-    public function check_status($data){
-        return true;
-    }
-
-    //产生流水
-    public function record_create($data){
-        $result = [];
-
-        //写入流水
-        InOutRecord::insert($result);
-
-        return true;
-    }
 
-    /**
-     * 业务单据审核统一入库
-     * order_number 订单编号
-     * type 1 =》 通过  2  =》 驳回
-     * opt_case 具体审核类型 已定义同名静态变量
-     */
     public function createRecordAndInventory($data = []){
         if(empty($data['order_number']) || empty($data['type']) || empty($data['opt_case']) || ! isset(self::$opt_case[$data['opt_case']])) return [false,300];
 

+ 3 - 0
routes/api.php

@@ -64,6 +64,9 @@ Route::group(['middleware'=> ['checkLogin']],function ($route){
     $route->any('employeeTeam', 'Api\EmployeeController@employeeTeam');
     $route->any('employeeRole', 'Api\EmployeeController@employeeRole');
 
+    //审核或者单据状态变动
+    $route->any('checkAll', 'Api\CheckController@checkAll');
+
     //基础类型
     $route->any('basicTypeList', 'Api\BasicTypeController@basicTypeList');
     $route->any('basicTypeEdit', 'Api\BasicTypeController@basicTypeEdit');