Переглянути джерело

合并单添加了仓库和快递必须一致

lvhao 2 днів тому
батько
коміт
48b0218b14
1 змінених файлів з 24 додано та 0 видалено
  1. 24 0
      core/CoreApp/controllers/Fullorder.php

+ 24 - 0
core/CoreApp/controllers/Fullorder.php

@@ -3157,6 +3157,30 @@ class Fullorder extends Start_Controller {
 			{
 				echo json_encode(array('msg'=>'缺少可合并单!','success'=>false));exit;
 			}
+
+			$tmp_list = $this->db->from('fullorder')->where_in('id',$id_arr)->select('id,orderinfo,number,type,express')->get()->result_array();
+			$count_warehouse_list = [];
+			$count_express_list = [];
+			$flag =  0;
+			$flag_str = '';
+			foreach ($tmp_list as $k => $v) {
+				$count_warehouse_list[$v['type']] = $v['type'];
+				if(empty($v['express'])){
+					$flag = 1;
+					$flag_str.= $v['number'].'仓库未选,请先选快递;';
+				}
+				$count_express_list[$v['express']] = $v['express'];
+			}
+			if($flag == 1){
+				echo json_encode(array('msg'=>$flag_str,'success'=>false));exit;
+			}
+			if(count($count_warehouse_list) > 1){
+				echo json_encode(array('msg'=>'合并单的仓库不一致,无法合并!','success'=>false));exit;
+			}
+			if(count($count_express_list) > 1){
+				echo json_encode(array('msg'=>'合并单的快递不一致,无法合并!','success'=>false));exit;
+			}
+
 			$post = array();
 			$u = $this->fullorder->read($id_arr[0]);
 			unset($id_arr[0]);