wugg há 2 anos atrás
pai
commit
f50a982921

+ 8 - 1
app/admin/controller/After.php

@@ -29,6 +29,11 @@ class After extends Base
          $after_num =Db::name("order_return")->where(["orderCode"=>$orderout['orderCode'],"outCode"=>$outCode])
              ->where("status","not in",[5,8])->sum("error_num");
 
+        $th_num =Db::name("order_back")->where(["orderCode"=>$orderout['orderCode'],"outCode"=>$outCode,"is_del"=>0])
+            ->where("status","<>",4)->sum("return_num");
+        if($th_num!=0 || $after_num!=0){
+            return error_show(1005,"存在售后或售后退货未结束流程");
+        }
          $wsm =Db::name("warehouse_info")->where(["wsm_code"=>$orderout['wsm_code']])->find();
         if($wsm==false){
             return error_show(1005,"未找到仓库数据");
@@ -59,7 +64,9 @@ class After extends Base
                 return error_show(1004,"参数 num 不能为空或零");
             }
         }
-        if($num>$orderout['send_num']-$after_num){
+        $thnum =Db::name("order_back")->where(["orderCode"=>$orderout['orderCode'],"outCode"=>$outCode,"is_del"=>0])
+            ->where("status","=",4)->sum("return_num");
+        if($num>$orderout['send_num']-$thnum){
             return error_show(1004,"可用售后数量不足");
         }
         $except_code =isset($this->post['except_code']) &&$this->post['except_code']!=''?trim($this->post['except_code']) :"";

+ 9 - 7
app/admin/controller/Reorder.php

@@ -572,15 +572,17 @@ class Reorder extends Base
             if($is_th===""){
                 return error_show(1004,"参数is_th不能为空");
             }
-
             $return_wsm =isset($this->post['return_wsm'])&&$this->post['return_wsm']!=="" ? trim($this->post['return_wsm']):"";
-            if($return_wsm===""){
-                return error_show(1004,"参数return_wsm 不能为空");
-            }
-            $wsmcode = Db::name("warehouse_info")->where(['wsm_code'=>$return_wsm])->find();
-            if($wsmcode==false){
-                return error_show(1004,"为找到仓库数据");
+            if($is_th==0){
+                if($return_wsm===""){
+                    return error_show(1004,"参数return_wsm 不能为空");
+                }
+                $wsmcode = Db::name("warehouse_info")->where(['wsm_code'=>$return_wsm])->find();
+                if($wsmcode==false){
+                    return error_show(1004,"为找到仓库数据");
+                }
             }
+
             $info['return_wsm'] =$return_wsm ;
             $info['is_th'] =$is_th ;
         }

+ 1 - 1
app/admin/controller/Resign.php

@@ -803,7 +803,7 @@ class Resign extends Base
             "wsend_num"=>$info['good_num'],
             "remark"=>"",
             "status"=>0,//0表示初始化
-            "lasttime"=>date("Y-m-d H:i:s"),
+            "lasttime"=>$info['lasttime'],
             "is_del"=>0,
             "order_type"=>1,
             "good_type"=>1,