Browse Source

admin/saleoutsend发货接口优化,已开通供应商账号的供应商,不允许其供应商负责人level2操作

wufeng 2 years ago
parent
commit
bd85a0c4f8
3 changed files with 12 additions and 1 deletions
  1. 1 0
      app/admin/common/User.php
  2. 7 0
      app/admin/controller/Sale.php
  3. 4 1
      app/common.php

+ 1 - 0
app/admin/common/User.php

@@ -86,6 +86,7 @@ class User
         'get_company_name_by_uid' => 'get_company_name_by_uid',//获取某个用户所属部门名称
         'get_company_item_user_by_name' => 'get_company_item_user_by_name',//获取某个用户所属部门名称
         'ciinfo' => 'ciinfo',//获取部门详情
+        'check_has_account_by_supplierNos' => 'check_has_account_by_supplierNos',//检查供应商是否有开通账号
 
     ];
 

+ 7 - 0
app/admin/controller/Sale.php

@@ -4064,6 +4064,13 @@ class Sale extends Base
         if (empty($einfo)) {
             return error_show(1002, "未找到销售订单数据");
         }
+
+        //判断供应商是否开通账号,若开通的话,则只能由供应商账号操作
+        if ($this->level != 3) {
+            $temp = checkHasAccountBySupplierNos([$einfo['supNo']]);
+            if (isset($temp[$einfo['supNo']])) return json_show(1004, '非供应商账号不能操作');
+        }
+
         $is_reurn = Db::name("sale_return")->where(['orderCode' => $outinfo['orderCode'], 'is_del' => 0])->where("status", "in", [1,2,3,7,9,10])->find();
         if ($is_reurn != false) {
             return error_show(1002, "销售单存在退货未处理完成");

+ 4 - 1
app/common.php

@@ -1246,7 +1246,10 @@ if (!function_exists('get_encryption_password')) {
 if (!function_exists('checkHasAccountBySupplierNos')) {
     function checkHasAccountBySupplierNos(array $supplierNo = []): array
     {
-        return [];
+        $userCommon = new \app\admin\common\User();
+        $rs = $userCommon->handle('check_has_account_by_supplierNos', ['supplierNo' => $supplierNo]);
+        unset($userCommon);
+        return $rs['data'];
 //        return \app\abutment\model\SupplierRelationUser::where('is_del', \app\abutment\model\SupplierUser::$is_del_normal)
 //            ->whereIn('supplierNo', $supplierNo)
 //            ->where('status', \app\abutment\model\SupplierUser::$status_normal)