浏览代码

oa 为了退换货的提前修改

cqp 2 月之前
父节点
当前提交
01699cab68
共有 2 个文件被更改,包括 10 次插入4 次删除
  1. 3 0
      app/Model/Oa.php
  2. 7 4
      app/Service/OaService.php

+ 3 - 0
app/Model/Oa.php

@@ -16,4 +16,7 @@ class Oa extends Model
     const UPDATED_AT = 'upd_time';
     const UPDATED_AT = 'upd_time';
     protected $dateFormat = 'U';
     protected $dateFormat = 'U';
 
 
+    const sub_type_one = 1; //正常创建的
+    const sub_type_two = 2; //分社采购单 分社向总社采购的审批流程
+    const sub_type_three = 3; //退货单 退分社采购单且是向总社采购的
 }
 }

+ 7 - 4
app/Service/OaService.php

@@ -252,7 +252,7 @@ class OaService extends Service
         if (isset($data['id'])) $first = $first->where('id', '<>', $data['id']);
         if (isset($data['id'])) $first = $first->where('id', '<>', $data['id']);
         if (isset($data['type'])) $first = $first->where('type', $data['type']);
         if (isset($data['type'])) $first = $first->where('type', $data['type']);
         $first = $first->first();
         $first = $first->first();
-        if ($first) return [false, '该菜单oa已存在!'];
+        if ($first) return [false, '该菜单对应审批流已存在'];
 
 
         try {
         try {
             DB::beginTransaction();
             DB::beginTransaction();
@@ -577,7 +577,7 @@ class OaService extends Service
             ->leftJoin('oa_sub as os', 'os.oa_id', 'o.id')
             ->leftJoin('oa_sub as os', 'os.oa_id', 'o.id')
             ->select('os.sort', 'os.type', 'os.sub_id')
             ->select('os.sort', 'os.type', 'os.sub_id')
             ->where('o.del_time', 0)
             ->where('o.del_time', 0)
-            ->where('o.sub_type', 2)
+            ->where('o.sub_type', Oa::sub_type_two)
             ->where('os.del_time', 0)
             ->where('os.del_time', 0)
             ->where('o.menu_id', $menu_id)
             ->where('o.menu_id', $menu_id)
             ->orderBy('os.sort')
             ->orderBy('os.sort')
@@ -603,7 +603,7 @@ class OaService extends Service
         //特殊的审批 分社采购单
         //特殊的审批 分社采购单
         $oa_id = Oa::where('menu_id',$menu_id)
         $oa_id = Oa::where('menu_id',$menu_id)
             ->where('del_time', 0)
             ->where('del_time', 0)
-            ->where('sub_type',2)
+            ->where('sub_type',Oa::sub_type_two)
             ->value('id');
             ->value('id');
         if(empty($oa_id)) {
         if(empty($oa_id)) {
             //其它
             //其它
@@ -618,7 +618,10 @@ class OaService extends Service
 
 
     //获取oaOrder
     //获取oaOrder
     public function getOaOrder($menu_id, $order_no){
     public function getOaOrder($menu_id, $order_no){
-        $oa_id = Oa::where('menu_id',$menu_id)->where('del_time', 0)->where('sub_type',2)->exists();
+        $oa_id = Oa::where('menu_id',$menu_id)
+            ->where('del_time', 0)
+            ->where('sub_type',Oa::sub_type_two)
+            ->exists();
         if($oa_id){
         if($oa_id){
             //特殊的审批 分社采购单
             //特殊的审批 分社采购单
             $detail = OaOrder::where('order_no', $order_no)
             $detail = OaOrder::where('order_no', $order_no)