Browse Source

Merge branch 'version1.5' of ssh://192.168.10.210:10022/wugg/stock into version1.5

panlumeng 3 years ago
parent
commit
9738a2ab5e

+ 16 - 6
app/admin/controller/Project.php

@@ -297,6 +297,10 @@ class Project extends Base
         if($cat_id!==""){
             $where[]=["cat_id","=",$cat_id];
         }
+        $status =isset($this->post['status'])&&$this->post['status']!==""?intval($this->post['status']):"";
+        if($status!==""){
+            $where[]=["status","=",$status];
+        }
         $count = Db::name('project_feedback')->where($where)->count();
         $total = ceil($count / $size);
         $page = $page >= $total ? $total : $page;
@@ -549,19 +553,25 @@ class Project extends Base
         if(empty($feedid)){
             return error_show(1004,"参数feedid不能为空");
         }
-        $selec = Db::name("project_feedback")->where(["id"=>$feedid,'is_del'=>0,"status"=>0])->select();
+        $feedid=array_unique($feedid);
+        $selec = Db::name("project_feedback")->where(["id"=>$feedid,'is_del'=>0,"status"=>0])->select()->toArray();
         if(empty($selec)){
             return error_show(1004,"反馈数据信息未找到");
         }
+        $pgnos =array_column($selec,"pgNo");
+        $infolist =   Db::name("project_info")->where(['pgNo'=>$pgnos])->select()->toArray();
+        if(empty($infolist)){
+            return error_show(1004,"项目商品数据未找到");
+        }
         Db::startTrans();
         try{
             $up = Db::name("project_feedback")->where(["id"=>$feedid,'is_del'=>0,"status"=>0])->save(["status"=>1,"updatetime"=>date("Y-m-d H:i:s")]);
             if($up){
-                foreach ($selec as $value){
-                    $projectinfo=[];
-                    $projectinfo['status']=3;
-                    $projectinfo['updatetime']=date("Y-m-d H:i:s");
-                    $up = Db::name("project_info")->where(['pgNo'=>$value['pgNo']])->save($projectinfo);
+
+                foreach ($infolist as $value){
+                    $value['status']=3;
+                    $value['updatetime']=date("Y-m-d H:i:s");
+                    $up = Db::name("project_info")->save($value);
                     if($up){
                         $count = Db::name("project_info")->where(["projectNo"=>$value['projectNo'],"status"=>2])
                             ->count();

+ 12 - 5
app/admin/controller/Resign.php

@@ -764,11 +764,18 @@ class Resign extends BaseController
             "addtime"=>date("Y-m-d H:i:s"),
             "updatetime"=>date("Y-m-d H:i:s")
         ];
-        $up =Db::name("purchease_order")->insert($cg);
-        if($up){
-            return app_show(0,"采购单新建成功");
-        }else{
-            return error_show(1004,"采购单新建失败");
+        Db::startTrans();
+        try{
+            $up =Db::name("purchease_order")->insert($cg);
+            if($up){
+
+                return app_show(0,"采购单新建成功");
+            }else{
+                return error_show(1004,"采购单新建失败");
+            }
+        }catch (\Exception $e){
+
         }
+
     }
 }

+ 2 - 3
app/admin/controller/Suppler.php

@@ -25,9 +25,8 @@ class Suppler extends BaseController
             return error_show(1002, "公司名称已存在");
         }
 
-        $code = rand(0000,9999);
-        $str = sprintf("%04d",$code);
-        $tr="GYS-".date("Ymd")."-".$str;
+
+        $tr=makeNo("QS");
         $source= isset($this->post['source']) && $this->post['source']!==""? intval($this->post['source']) :"";
         if($source===""){
             return error_show(1002,"供应商来源不能为空");

+ 1 - 1
app/common.php

@@ -169,7 +169,7 @@ function makeNo($str){
     $date=date("mdHis");
     $year = date("Y")-2000;
     $msec=randomkeys(4);
-    return $str.$msec.$year.$date;
+    return $str.$year.$date.$msec;
 }
 function randomkeys($length) {
     $returnStr='';