Jelajahi Sumber

提交数据

lvhao 1 hari lalu
induk
melakukan
181e24b6e4
1 mengubah file dengan 27 tambahan dan 12 penghapusan
  1. 27 12
      core/CoreApp/controllers/Whlabel_bh.php

+ 27 - 12
core/CoreApp/controllers/Whlabel_bh.php

@@ -2049,29 +2049,44 @@ class Whlabel_bh extends Start_Controller {
 		    {
                 $start = ($page - 1)*$perpage;
             }
-			$list = $this->whlabel_bh->find_all($where,"*",'id desc',$start,$perpage);
+			$list = $this->whlabel_bh->find_pc($where,'orderinfo',"id,orderinfo",'id desc',$start,$perpage);
+	
 
 			$rows = [];
 			foreach($list as $k=>$v){
-				$list = $this->whlabel_bh_transfer->find_all(" wbid= '".$v['id']."'");
+				$tmp_order_info = $this->whlabel_bh->find_all(" orderinfo = '".$v['orderinfo']."'","id,orderinfo,bhnum");
+				$tmp_ids = [];
+				$tmp_bhnum = 0;
+				foreach($tmp_order_info as $vv){
+					$tmp_ids[] = $vv['id'];
+					$tmp_bhnum += $vv['bhnum'];
+				}
+				
 				$ydysl = $wdysl = $yphsl = $yjgsj = $wwgsl = 0;
-				foreach($list as $vv){
-					$ydysl += 1;
-					if($vv['status'] == 1){
-						$yphsl += 1;
-					}
-					if($vv['status'] == 2){
-						$yjgsj += 1;
+				if(empty($tmp_ids)){
+					$list = $this->whlabel_bh_transfer->find_all(" wbid in (".implode(",",$tmp_ids).")");
+					foreach($list as $vv){
+						$ydysl += 1;
+						if($vv['status'] == 1){
+							$yphsl += 1;
+						}
+						if($vv['status'] == 2){
+							$yjgsj += 1;
+						}
 					}
 				}
+
+				
+				
+				
 				$rows[$k]['id'] = $v['id'];
 				$rows[$k]['orderinfo'] = "<h9 class='window' data-h='/whlabel_bh/transfer_detail/".$v['id']."' data-t='备货单号:".$v['orderinfo']."'><p>".$v['orderinfo']."</p></h9>" ;
-				$rows[$k]['ddsl'] = $v['bhnum'];   //订单数量
+				$rows[$k]['ddsl'] = $tmp_bhnum;   //订单数量
 				$rows[$k]['ydysl'] = $ydysl;	 //已打印数量
-				$rows[$k]['wdysl'] = $v['bhnum'] - $ydysl;  //未打印数量
+				$rows[$k]['wdysl'] = $tmp_bhnum - $ydysl;  //未打印数量
 				$rows[$k]['yphsl'] = $yphsl;  //已配货数量
 				$rows[$k]['yjgsj'] = $yjgsj;  //已完工数量
-				$rows[$k]['wwgsl'] = $v['bhnum'] - $yjgsj;  //未完工数量
+				$rows[$k]['wwgsl'] = $tmp_bhnum - $yjgsj;  //未完工数量
 			}
 
 			$total = $this->whlabel_bh->find_count($where);