wugg 3 vuotta sitten
vanhempi
commit
abc563d962

+ 11 - 6
app/admin/controller/Allot.php

@@ -17,26 +17,31 @@ class Allot extends BaseController
     public function list(){
         $page = isset($this->post['page']) && $this->post['page'] !=="" ? intval($this->post['page']) :"1";
         $size = isset($this->post['size']) && $this->post['size'] !=="" ? intval($this->post['size']) :"10";
-        $where =['is_del'=>0];
+        $where =[['is_del',"=",0]];
         $allot_code = isset($this->post['allot_code']) && $this->post['allot_code'] !== "" ? trim($this->post['allot_code']) : "";
         if ($allot_code !== "") {
-            $where['allot_code'] = $allot_code;
+           // $where['allot_code'] = $allot_code;
+            $where[]=['allot_code',"=",$allot_code];
         }
         $wsm_out = isset($this->post['wsm_out']) && $this->post['wsm_out'] !== "" ? trim($this->post['wsm_out']) : "";
         if ($wsm_out !== "") {
-            $where['wsm_out'] = $wsm_out;
+            //$where['wsm_out'] = $wsm_out;
+            $where[]=['wsm_out',"=",$wsm_out];
         }
         $wsm_in = isset($this->post['wsm_in']) && $this->post['wsm_in'] !== "" ? trim($this->post['wsm_in']) : "";
         if ($wsm_in !== "") {
-            $where['wsm_in'] = $wsm_in;
+           // $where['wsm_in'] = $wsm_in;
+            $where[]=['wsm_in',"=",$wsm_in];
         }
         $start= isset($this->post['start']) && $this->post['start'] !== "" ? $this->post['start']:"";
         if ($start !="") {
-            $where = ["addtime"=>Db::raw(">= '{$start}'")];
+            //$where = ["addtime"=>Db::raw(">= '{$start}'")];
+            $where[]=['addtime',">=",$start];
         }
         $end = isset($this->post['end']) && $this->post['end'] !== "" ? $this->post['end'] :"";
         if($end !=""){
-            $where = ["addtime"=>Db::raw("<= '{$end}'")];
+           // $where = ["addtime"=>Db::raw("<= '{$end}'")];
+            $where[]=['addtime',"<=",$end];
         }
         $count = Db::name('allot_stock')->where($where)->count();
         $total = ceil($count/$size);

+ 33 - 19
app/admin/controller/Check.php

@@ -25,27 +25,29 @@ public function __construct(App $app)
 public function flist(){
     $page = isset($this->post['page']) &&$this->post['page'] !=="" ? intval($this->post['page']):1;
     $size = isset($this->post['size']) &&$this->post['size'] !=="" ? intval($this->post['size']):10;
-    $condtion=['a.is_del'=>0,'b.is_del'=>0,'c.is_del'=>0];
+    $condtion=[['a.is_del',"=",0],['b.is_del',"=",0],['c.is_del',"=",0]];
     $wsmcode =isset($this->post['wsm_code']) &&$this->post['wsm_code'] !=="" ? trim($this->post['wsm_code']):"";
     if($wsmcode!==""){
         //return error_show(1002,"仓库code不能为空");
-        $condtion['c.wsm_code']=$wsmcode;
+        $condtion[]=['c.wsm_code',"=",$wsmcode];
        // $typecode= Db::name("good_stock")->where(["wsm_code"=>$wsmcode,'is_del'=>0])->column("good_type_code");
     }
 
     $good_code =isset($this->post['type_code']) &&$this->post['type_code'] !=="" ? trim($this->post['type_code']):"";
     if($good_code!=""){
-        $condtion['b.type_code'] = $good_code;
+        $condtion[]=['b.type_code',"=",$good_code];
     }
     $goodcode =isset($this->post['good_code']) &&$this->post['good_code'] !=="" ? trim($this->post['good_code'])
         :"";
     if($goodcode!=""){
-        $condtion['a.good_code'] = Db::raw("like '%{$goodcode}%'");
+       // $condtion['a.good_code'] = Db::raw("like '%{$goodcode}%'");
+        $condtion[]=['a.good_code',"like","%{$goodcode}%"];
     }
     $good_name =isset($this->post['good_name']) &&$this->post['good_name'] !=="" ? trim($this->post['good_name'])
         :"";
     if($good_name!=""){
-        $condtion['a.good_name'] = Db::raw("like '%{$good_name}%'");
+      //  $condtion['a.good_name'] = Db::raw("like '%{$good_name}%'");
+        $condtion[]=['a.good_name',"like","%{$good_name}%"];
     }
     $supplierNo =isset($this->post['supplierNo']) &&$this->post['supplierNo'] !=="" ? trim($this->post['supplierNo']):"";
     if($supplierNo!=""){
@@ -55,27 +57,31 @@ public function flist(){
         }
                 $wsmcode = Db::name("warehouse_info")->where([
                     "is_del"=>0,"supplierNo"=>$supplierNo])->column("wsm_code");
-        $condtion["c.wsm_code"] = $wsmcode;
+        //$condtion["c.wsm_code"] = $wsmcode;
+        $condtion[]=['c.wsm_code',"in",$wsmcode];
     }
     $stock_low =isset($this->post['stock_low']) &&$this->post['stock_low'] !=="" ? intval($this->post['stock_low'])
         :"";
     if($stock_low!=""){
-        $condtion['c.usable_stock'] = Db::raw(">= $stock_low");
+       // $condtion['c.usable_stock'] = Db::raw(">= $stock_low");
+        $condtion[]=['c.usable_stock',">=",$stock_low];
     }
     $stock_up =isset($this->post['stock_up']) &&$this->post['stock_up'] !=="" ? trim($this->post['stock_up'])
         :"";
     if($stock_up!=""){
-        $condtion['c.usable_stock'] = Db::raw("<= {$stock_up}");
+        $condtion[]=['c.usable_stock',"<=",$stock_up];
     }
     $warn_low =isset($this->post['warn_low']) &&$this->post['warn_low'] !=="" ? intval($this->post['warn_low'])
         :"";
     if($warn_low!==""){
-        $condtion['c.warn_stock'] = Db::raw(">= $warn_low");
+      //  $condtion['c.warn_stock'] = Db::raw(">= $warn_low");
+        $condtion[]=['c.warn_stock',">=",$warn_low];
     }
     $warn_up =isset($this->post['warn_up']) &&$this->post['warn_up'] !=="" ? intval($this->post['warn_up'])
         :"";
     if($warn_up!=""){
-        $condtion['c.warn_stock'] = Db::raw("<= {$warn_up}");
+      //  $condtion['c.warn_stock'] = Db::raw("<= {$warn_up}");
+        $condtion[]=['c.warn_stock',"<=",$warn_up];
     }
     $count = Db::name("good_type")->alias("b")
         ->join("good a","a.good_code = b.good_code","left")
@@ -102,38 +108,46 @@ public function list()
 {
     $page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) : "1";
     $size = isset($this->post['size']) && $this->post['size'] !== "" ? intval($this->post['size']) : "10";
-    $where = ['a.is_del' => 0,'b.is_del'=>0];
+    $where = [['a.is_del',"=",0],['b.is_del',"=",0]];
     $start= isset($this->post['start']) && $this->post['start'] !== "" ? $this->post['start']:"";
     if ($start !="") {
-        $where["a.addtime"]=Db::raw(">= '{$start}'");
+      //  $where["a.addtime"]=Db::raw(">= '{$start}'");
+        $where[]=['a.addtime',">=",$start];
     }
     $end = isset($this->post['end']) && $this->post['end'] !== "" ? $this->post['end'] :"";
     if($end !=""){
-        $where["a.addtime"] = Db::raw("<= '{$end}'");
+      //  $where["a.addtime"] = Db::raw("<= '{$end}'");
+        $where[]=['a.addtime',"<=",$end];
     }
     $check_code = isset($this->post['check_code']) && $this->post['check_code'] !== "" ? trim($this->post['check_code']) : "";
     if ($check_code !== "") {
-        $where['a.check_code'] = Db::raw("like '%$check_code%'");
+       // $where['a.check_code'] = Db::raw("like '%$check_code%'");
+        $where[]=['a.check_code',"like","%$check_code%"];
     }
     $wsm_code = isset($this->post['wsm_code']) && $this->post['wsm_code'] !== "" ? trim($this->post['wsm_code']) : "";
     if ($wsm_code  !== "") {
-        $where['a.wsm_code'] =  Db::raw("like '%$wsm_code%'");
+      //  $where['a.wsm_code'] =  Db::raw("like '%$wsm_code%'");
+        $where[]=['a.wsm_code',"like","%$wsm_code%"];
     }
     $apply_name = isset($this->post['apply_name']) && $this->post['apply_name'] !== "" ? trim($this->post['apply_name']) : "";
     if ($apply_name !== "") {
-        $where['a.apply_name'] = $apply_name;
+     //   $where['a.apply_name'] = $apply_name;
+        $where[]=['a.apply_name',"like","%$apply_name%"];
     }
     $type = isset($this->post['type']) && $this->post['type'] !== "" ? trim($this->post['type']) : "";
     if ($type !== "") {
-        $where['a.type'] = $type;
+       // $where['a.type'] = $type;
+        $where[]=['a.type',"=",$type];
     }
     $apply_id = isset($this->post['apply_id']) && $this->post['apply_id'] !== "" ? intval($this->post['apply_id']) : "";
     if ($apply_id!== "") {
-        $where['a.apply_id'] = $apply_id;
+       // $where['a.apply_id'] = $apply_id;
+        $where[]=['a.apply_id',"=",$apply_id];
     }
     $status= isset($this->post['status']) && $this->post['status'] !== "" ? intval($this->post['status']) : "";
     if ($status !== "") {
-        $where['a.status '] = $status;
+       // $where['a.status '] = $status;
+        $where[]=['a.status',"=",$status];
     }
     $count = Db::name('good_check')->alias('a')->join("warehouse_info b","a.wsm_code = b.wsm_code","left")
         ->join("supplier v","v.code=b.supplierNo","left")

+ 11 - 7
app/admin/controller/Consult.php

@@ -25,34 +25,38 @@ class Consult extends BaseController
     public function list(){
       $page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) :"1";
       $size = isset($this->post['size']) && $this->post['size'] !== "" ? intval($this->post['size']) :"10";
-      $where=['is_del'=>0];
+      $where=[['is_del',"=",0]];
       $zxNo = isset($this->post['zxNo']) && $this->post['zxNo'] !== "" ? trim($this->post['zxNo']) : "";
       if ($zxNo !== "") {
           $where['zxNo'] = $zxNo;
       }
       $salesman = isset($this->post['salesman']) && $this->post['salesman'] !== "" ? trim($this->post['salesman']) : "";
       if ($salesman !== "") {
-          $where["salesman"] =Db::Raw("like '%$salesman%'");
+          //$where["salesman"] =Db::Raw("like '%$salesman%'");
+          $where[]= ["salesman",'like',"%$salesman%"];
         }
         $cpName = isset($this->post['cpName']) && $this->post['cpName'] !== "" ? trim($this->post['cpName']) : "";
         if ($cpName !== "") {
-            $where["cpName"]= Db::Raw("like '%$cpName%'");
+            //$where["cpName"]= Db::Raw("like '%$cpName%'");
+            $where[]= ["cpName",'like',"%$cpName%"];
         }
       $khNo = isset($this->post['khNo']) && $this->post['khNo'] !== "" ? trim($this->post['khNo']) : "";
       if ($khNo !== "") {
-          $where['khNo'] = $khNo;
+         // $where['khNo'] = $khNo;
+          $where[]= ["khNo",'like',"%$khNo%"];
         }
         $start= isset($this->post['start']) && $this->post['start'] !== "" ? $this->post['start']:"";
         if ($start !="") {
-            $where = ["zxtime"=>Db::raw(">= '{$start}'")];
+            //$where = ["zxtime"=>Db::raw(">= '{$start}'")];
+            $where[]= ["zxtime",'>=',$start];
         }
         $end = isset($this->post['end']) && $this->post['end'] !== "" ? $this->post['end'] :"";
         if($end !=""){
-            $where = ["zxtime"=>Db::raw("<= '{$end}'")];
+            $where[]= ["zxtime",'<=',$end];
         }
       $status = isset($this->post['status']) && $this->post['status'] !== "" ? trim($this->post['status']) : "";
       if ($status !== "") {
-          $where['status'] =$status;
+          $where[]= ["status",'=',$status];
         }
         $count = Db::name('consult')->where($where)->count();
         $total = ceil($count / $size);

+ 7 - 2
app/admin/controller/Customer.php

@@ -26,7 +26,7 @@ class Customer extends BaseController
     public function list(){
         $page= isset($this->post['page']) && $this->post['page']!==""? intval($this->post['page']):"1";
         $size = isset($this->post['size']) && $this->post['size'] != "" ? intval($this->post['size']) : 10;
-        $pid =  isset($this->post['pid']) &&$this->post['pid']!=="" ?intval($this->post['pid']): "";
+        $pid =  isset($this->post['pid']) &&$this->post['pid']!=="" ?intval($this->post['pid']): 0;
         $condition[] = ['is_del',"=",0];
         if($pid!==""){
             $condition[]=["pid","=",$pid];
@@ -37,7 +37,7 @@ class Customer extends BaseController
         }
         $count = Db::name('customer_org1')->where($condition)->count();
         $page>=ceil($count/$size) ? $page=ceil($count/$size) :"";
-        $list = Db::name('customer_org1')->where($condition)->page($page,$size)->column("pid,name,level,depart_link");
+        $list = Db::name('customer_org1')->where($condition)->page($page,$size)->column("id,pid,name,level,depart_link");
         return app_show(0,"获取成功",['list'=>$list,'count'=>$count]);
     }
     /*新建*/
@@ -104,6 +104,9 @@ class Customer extends BaseController
     /*更新*/
     public function updat(){
         $id = isset($this->post['id'])?intval($this->post['id']):"";
+        if($id===""){
+            return error_show(1004,"参数id不能为空");
+        }
         $sid = Db::name('customer_org1')->where("id","=","$id")->find();
        // var_dump(Db::name('customer_org1')->getLastSql());
         if($sid==false){
@@ -172,4 +175,6 @@ class Customer extends BaseController
         $compy = Db::name('customer_org1')->save($custy);
         return $compy ? error_show(0,"删除成功"):error_show(1004,"删除失败");
     }
+
+
 }

+ 9 - 11
app/admin/controller/Good.php

@@ -25,25 +25,28 @@ class Good extends \app\BaseController
     public function list(){
         $page = isset($this->post['page']) &&$this->post['page'] !=="" ? intval($this->post['page']):1;
         $size = isset($this->post['size']) &&$this->post['size'] !=="" ? intval($this->post['size']):10;
-        $condtion=['a.is_del'=>0,'b.is_del'=>0];
+        $condtion=[['a.is_del',"=",0],['b.is_del',"=",0]];
         $wsmcode =isset($this->post['wsm_code']) &&$this->post['wsm_code'] !=="" ? trim($this->post['wsm_code']):"";
         if($wsmcode!=""){
             $typecode= Db::name("good_stock")->where(["wsm_code"=>$wsmcode,'is_del'=>0])->column("good_type_code");
-            $condtion["b.type_code"] = $typecode;
+            $condtion[]=["b.type_code",'in',$typecode];
         }
         $good_code =isset($this->post['type_code']) &&$this->post['type_code'] !=="" ? trim($this->post['type_code']):"";
         if($good_code!=""){
-            $condtion['b.type_code'] = $good_code;
+            //$condtion['b.type_code'] = $good_code;
+            $condtion[]=["b.type_code",'=',$good_code];
         }
         $goodcode =isset($this->post['good_code']) &&$this->post['good_code'] !=="" ? trim($this->post['good_code'])
             :"";
         if($goodcode!=""){
-            $condtion['a.good_code'] = Db::raw("like '%{$goodcode}%'");
+            //$condtion['a.good_code'] = Db::raw("like '%{$goodcode}%'");
+            $condtion[]=["a.good_code",'like',"%{$goodcode}%"];
         }
         $good_name =isset($this->post['good_name']) &&$this->post['good_name'] !=="" ? trim($this->post['good_name'])
             :"";
         if($good_name!=""){
-            $condtion['a.good_name'] = Db::raw("like '%{$good_name}%'");
+           // $condtion['a.good_name'] = Db::raw("like '%{$good_name}%'");
+            $condtion[]=["a.good_name",'like',"%{$good_name}%"];
         }
         $supplierNo =isset($this->post['supplierNo']) &&$this->post['supplierNo'] !=="" ? trim($this->post['supplierNo']):"";
         if($supplierNo!=""){
@@ -51,12 +54,7 @@ class Good extends \app\BaseController
             if(empty($supplier)){
                 return error_show(1004,"未找到供应商信息");
             }
-//                $typecode = Db::name("good_stock")->alias("a")->join("warehouse_info b","a.wsm_code=b.wsm_code","left")->where(["a.is_del"=>0,
-//                    "b.is_del"=>0,"b.supplierNo"=>$supplierNo])->column("a.good_type_code");
-//                if(empty($typecode)){
-//                    return error_show(1004,"未找到供应商有关的商品信息");
-//                }
-            $condtion["a.gys_code"] = $supplierNo;
+            $condtion[]=["a.gys_code",'=',$supplierNo];
         }
 
         $count = Db::name("good_type")->alias("b")->join("good a","a.good_code = b.good_code","left")

+ 22 - 12
app/admin/controller/Purch.php

@@ -20,53 +20,63 @@ class Purch extends \app\BaseController
     public function  list(){
         $page = isset($this->post['page']) && $this->post['page'] !=="" ? intval($this->post['page']):"1";
         $size = isset($this->post['size']) && $this->post['size'] !=="" ? intval($this->post['size']):"10";
-        $where =['is_del'=>0];
+        $where =[['is_del',"=",0]];
         $bkcode = isset($this->post['bk_code']) && $this->post['bk_code']!="" ? trim($this->post['bk_code']):"";
         if($bkcode!=""){
-            $where['bkcode'] = $bkcode;
+            $where[]=['bkcode',"=", $bkcode];
         }
         $status = isset($this->post['status']) && $this->post['status']!=="" ? intval($this->post['status']):"";
         if($status!==""){
-            $where['status'] = $status;
+           // $where['status'] = $status;
+            $where[]=['status',"=", $status];
         }
         $cgdNo = isset($this->post['cgdNo']) && $this->post['cgdNo']!="" ? trim($this->post['cgdNo'])
             :"";
         if($cgdNo!=""){
-            $where['cgdNo'] = Db::Raw("like '%{$cgdNo}%'");
+            //$where['cgdNo'] = Db::Raw("like '%{$cgdNo}%'");
+            $where[]=['cgdNo',"like", "%{$cgdNo}%"];
         }
 
         $apply_name = isset($this->post['apply_name']) && $this->post['apply_name']!="" ? trim($this->post['apply_name']):"";
         if($apply_name!=""){
-            $where['cgder'] =Db::Raw("like '%{$apply_name}%'");
+           // $where['cgder'] =Db::Raw("like '%{$apply_name}%'");
+            $where[]=['cgder',"like", "%{$apply_name}%"];
         }
         $wsm_code = isset($this->post['wsm_code']) && $this->post['wsm_code']!="" ? trim($this->post['wsm_code']):"";
         if($wsm_code!=""){
-            $where['wsm_code'] = $wsm_code;
+           // $where['wsm_code'] = $wsm_code;
+            $where[]=['wsm_code',"=", $wsm_code];
         }
         $good_name = isset($this->post['good_name']) && $this->post['good_name']!="" ? trim($this->post['good_name']):"";
         if($good_name!=""){
-            $where['good_name'] = Db::raw(" like %{$good_name}%");
+           //$where['good_name'] = Db::raw(" like %{$good_name}%");
+            $where[]=['good_name',"like", "%{$good_name}%"];
         }
         $good_code = isset($this->post['good_code']) && $this->post['good_code']!="" ? trim($this->post['good_code'])
             :"";
         if($good_code!=""){
-            $where['good_code'] = Db::raw(" like %{$good_code}%");
+           // $where['good_code'] = Db::raw(" like %{$good_code}%");
+            $where[]=['good_code',"like", "%{$good_code}%"];
         }
         $start = isset($this->post['start']) && $this->post['start']!="" ?$this->post['start']:"";
         if($start!=""){
-            $where['addtime'] = Db::raw(" >= '{$start}'");
+           // $where['addtime'] = Db::raw(" >= '{$start}'");
+            $where[]=['addtime',">=", $start];
         }
         $end = isset($this->post['end']) && $this->post['end']!="" ?$this->post['end']:"";
         if($end!=""){
-            $where['addtime'] = Db::raw(" <= '{$end}'");
+            $where[]=['addtime',"<=", $end];
         }
         $last_start = isset($this->post['last_start']) && $this->post['last_start']!="" ?$this->post['last_start']:"";
         if($last_start!=""){
-            $where['lasttime'] = Db::raw(" >= '{$last_start}'");
+            //$where['lasttime'] = Db::raw(" >= '{$last_start}'");
+            $where[]=['lasttime',">=", $last_start];
+
         }
         $last_end = isset($this->post['last_end']) && $this->post['last_end']!="" ?$this->post['last_end']:"";
         if($last_end!=""){
-            $where['lasttime'] = Db::raw(" <= '{$last_end}'");
+            //$where['lasttime'] = Db::raw(" <= '{$last_end}'");
+            $where[]=['lasttime',"<=", $last_end];
         }
 
         $count=Db::name("purchease_order")->where($where)->count();

+ 10 - 6
app/admin/controller/Resigninfo.php

@@ -25,7 +25,7 @@ class Resigninfo extends BaseController
     public function list(){
         $page = isset($this->post['page']) && $this->post['page'] !=="" ? intval($this->post['page']):"1";
         $size = isset($this->post['size']) && $this->post['size'] !=="" ? intval($this->post['size']):"10";
-        $where =['is_del'=>0];
+        $where =[['is_del',"=",0]];
 //       $resign_depart_id = isset($this->post['resign_depart_id']) && $this->post['resign_depart_id'] !== "" ? intval($this->post['resign_depart_id']) : "";
 //       if ($resign_depart_id !== "") {
 //            $where = ["resign_depart_id"=>$resign_depart_id];
@@ -36,23 +36,27 @@ class Resigninfo extends BaseController
 //        }
         $status =isset($this->post['status']) && $this->post['status'] !== "" ? intval($this->post['status']) : "";
         if ($status !== "") {
-            $where = ["status"=>$status];
+            $where[]= ["status",'=',$status];
         }
         $resign_uid = isset($this->post['resign_uid']) && $this->post['resign_uid'] !== "" ? intval($this->post['resign_uid']) : "";
         if ($resign_uid !== "") {
-            $where = ["resign_uid"=>$resign_uid];
+            //$where = ["resign_uid"=>$resign_uid];
+            $where[]= ["resign_uid",'=',$resign_uid];
         }
         $hand_uid = isset($this->post['hand_uid']) && $this->post['hand_uid'] !== "" ? intval($this->post['hand_uid']) : "";
         if ($hand_uid !== "") {
-            $where = ["hand_uid"=>$hand_uid];
+           // $where = ["hand_uid"=>$hand_uid];
+            $where[]= ["hand_uid",'=',$hand_uid];
         }
         $start= isset($this->post['start']) && $this->post['start'] !== "" ? $this->post['start']:"";
         if ($start !="") {
-            $where = ["addtime"=>Db::raw(">= '{$start}'")];
+           // $where = ["addtime"=>Db::raw(">= '{$start}'")];
+            $where[]= ["addtime",'>=',$start];
         }
         $end = isset($this->post['end']) && $this->post['end'] !== "" ? $this->post['end'] :"";
         if($end !=""){
-            $where = ["addtime"=>Db::raw("<= '{$end}'")];
+           // $where = ["addtime"=>Db::raw("<= '{$end}'")];
+            $where[]= ["addtime",'<=',$end];
         }
         $count = Db::name('resign_info')->where($where)->count();
         $total = ceil($count/$size);