Browse Source

Merge branch 'master-new-dev-wf' of wugg/phpstock into master-new

wufeng 2 years ago
parent
commit
a83bae1179
1 changed files with 13 additions and 10 deletions
  1. 13 10
      app/admin/controller/After.php

+ 13 - 10
app/admin/controller/After.php

@@ -1372,13 +1372,13 @@ class After extends Base
 
             if ($up) {
 
-                //查看是否有退货工单
+                //查看是否有退货工单设置信息
                 $temp = Db::name('order_return_prepare')
                     ->field('id')
                     ->where(['is_del' => 0, 'returnCode' => $bkcode,'status'=>1])
                     ->findOrEmpty();
-                if (empty($temp)) $info['status'] = 5;//没有退货工单,更新到status5,售后申请已结束
-                else $info['status'] = 12;//存在退货工单,要更新到status12(待库管收货)
+                if (empty($temp)) $info['status'] = 5;//没有,更新到status5,售后申请已结束
+                else $info['status'] = 12;//存在,要更新到status12(待库管收货)
 
                 $old_info_status = $info['status'];
 //                $info['status'] = 5;
@@ -1453,14 +1453,17 @@ class After extends Base
 
                         //如果供应商承担,维护采购单
                         if ($info['return_tag'] == 1) {
-                            $cgdNo = Db::name('order_num')
-                                ->where(['orderCode' => $info['orderCode']])
-                                ->value('cgdNo', '');
-                            if ($cgdNo != '') {
+                            $cgd_info = Db::name('order_num')
+                                ->alias('a')
+                                ->field('a.id,b.id cgd_id,b.good_price')
+                                ->leftJoin('purchease_order b','b.cgdNo=a.cgdNo')
+                                ->where(['a.orderCode' => $info['orderCode']])
+                                ->findOrEmpty();
+                            if (!empty($cgd_info)) {
                                 Db::name('purchease_order')
-                                    ->where(['is_del' => 0, 'cgdNo' => $cgdNo])
-                                    ->dec('th_num', $info['error_num'])
-                                    ->dec('th_fee', round($sale['sale_price'] * $info['error_num'], 2))
+                                    ->where(['is_del' => 0, 'id' => $cgd_info['cgd_id']])
+                                    ->inc('th_num', $info['error_num'])
+                                    ->inc('th_fee', round($cgd_info['good_price'] * $info['error_num'], 2))
                                     ->update(['updatetime' => date("Y-m-d H:i:s")]);
                             }
                         }