| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 | 
							- <?php defined('BASEPATH') OR exit('No direct script access allowed');
 
- class Whenter extends Start_Controller {
 
- 	public function __construct(){
 
- 		parent::__construct();
 
- 		$this->load->library('session');
 
- 		$this->load->_model('Model_whlabel','whlabel');
 
- 		$this->load->_model('Model_warehouse','warehouse');
 
- 		$this->load->_model('Model_productprice','productprice');
 
- 	}
 
- 	//定义方法的调用规则 获取URI第二段值
 
-     public function _remap($arg,$arg_array)
 
-     {
 
- 		if($arg == 'add')//在库标签
 
-         {
 
-              $this->_add();
 
-         }
 
- 		else
 
- 		{
 
- 			 $this->_index();
 
- 		}
 
-     }
 
- 	//管理
 
- 	public function _index()
 
- 	{
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 		if(isset($post['page']))  
 
- 		{
 
- 		    $page = $this->input->post('page',true);
 
- 		    $perpage = $this->input->post('perpage',true);
 
- 			$sku = $this->input->post('sku',true);
 
- 			$warehouse = $this->input->post('warehouse',true);
 
- 			$supplier = $this->input->post('supplier',true);
 
- 			$label = $this->input->post('label',true);
 
- 			$orderinfo = $this->input->post('orderinfo',true);
 
- 			$waybill = $this->input->post('waybill',true);
 
- 			$category = $this->input->post('category',true);
 
- 			$size = $this->input->post('size',true);
 
- 			$grade = $this->input->post('grade',true);
 
- 			$color = $this->input->post('color',true);
 
- 			$lowe = $this->input->post('lowe',true);
 
- 			$type = $this->input->post('type',true);
 
- 			$productweight = $this->input->post('productweight',true);
 
- 			$where = "1=1 ";
 
- 			if($sku)
 
-             {
 
-                 $where  .= " and sku = '$sku'";
 
-             }
 
- 			if($warehouse)
 
-             {
 
-                 $where  .= " and warehouse = '$warehouse'";
 
-             }
 
- 			if($supplier)
 
-             {
 
-                 $where  .= " and supplier = '$supplier'";
 
-             }
 
- 			if($label)
 
-             {
 
-                 $where  .= " and label = '$label'";
 
-             }
 
- 			if($orderinfo)
 
-             {
 
-                 $where  .= " and orderinfo = '$orderinfo'";
 
-             }
 
- 			if($waybill)
 
-             {
 
-                 $where  .= " and waybill = '$waybill'";
 
-             }
 
- 			if($category || $size || $grade || $color || $lowe || $productweight)
 
-             {
 
-                 $where  .= " and title like '%$category.$grade.$size.$color.$lowe.$productweight%'";
 
-             }
 
- 			if($type)
 
-             {
 
-                 $where  .= " and type = '$type'";
 
-             }
 
-             //数据排序
 
-             $order_str = "id asc";
 
-             if(empty($page))
 
- 		    {
 
-                 $start = 0;
 
- 		    	$perpage = 1;
 
-             }
 
- 		    else
 
- 		    {
 
-                 $start = ($page - 1)*$perpage;
 
-             }
 
-             //取得信息列表
 
-             $info_list = $this->whenter->find_all($where,'id,supplier,sku,title,label,printing,enter,warehouse,outk,orderinfo,waybill',$order_str,$start,$perpage);
 
- 			foreach ($info_list as $key=>$value) 
 
- 		    {
 
- 				$warehouse = $this->warehouse->read($value['warehouse']);
 
- 				$info_list[$key]['warehouse'] = $warehouse['title'];
 
- 				$supplier = $this->productprice->read($value['supplier']);
 
- 				$info_list[$key]['supplier'] = $supplier['supplier'];
 
- 				if($value['enter'] != 0)
 
- 				{
 
- 					$info_list[$key]['enter'] = date('Y-m-d H:i:s',$value['enter']);
 
- 				}
 
- 				else
 
- 				{
 
- 					$info_list[$key]['enter'] = "";
 
- 				}
 
- 				if($value['outk'] != 0)
 
- 				{
 
- 					$info_list[$key]['outk'] = date('Y-m-d H:i:s',$value['outk']);
 
- 				}
 
- 				else
 
- 				{
 
- 					$info_list[$key]['outk'] = "";
 
- 				}
 
- 				if($value['printing'] != 0)
 
- 				{
 
- 					$info_list[$key]['printing'] = date('Y-m-d H:i:s',$value['printing']);
 
- 				}
 
- 				else
 
- 				{
 
- 					$info_list[$key]['printing'] = "";
 
- 				}
 
- 				if($value['orderinfo'] == 0)
 
- 				{
 
- 					$info_list[$key]['orderinfo'] = "";
 
- 				}
 
- 				if($value['waybill'] == 0)
 
- 				{
 
- 					$info_list[$key]['waybill'] = "";
 
- 				}
 
- 		    }
 
- 		    $total = $this->whenter->find_count($where);
 
- 		    $pagenum = ceil($total/$perpage);
 
- 		    $over = $total-($start+$perpage);
 
- 		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
 
- 		    echo json_encode($rows);exit;
 
- 		}
 
- 		$pr = $this->productprice->find_all();
 
- 		$this->data['pr'] =  $pr;
 
- 		$this->_Template('whenter',$this->data);
 
- 	}
 
- 	//在库标签
 
- 	public function _add()
 
- 	{
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 		if(isset($post['page']))  
 
- 		{
 
- 		    $page = $this->input->post('page',true);
 
- 		    $perpage = $this->input->post('perpage',true);
 
- 			$warehouse = $this->input->post('warehouse',true);
 
- 			$label = $this->input->post('label',true);
 
- 			$productweight = $this->input->post('productweight',true);
 
- 			$where = "1=1 and type = 2";
 
- 			if($warehouse)
 
-             {
 
-                 $where  .= " and warehouse = '$warehouse'";
 
-             }
 
- 			if($label)
 
-             {
 
-                 $where  .= " and label = '$label'";
 
-             }
 
-             //数据排序
 
-             $order_str = "id asc";
 
-             if(empty($page))
 
- 		    {
 
-                 $start = 0;
 
- 		    	$perpage = 1;
 
-             }
 
- 		    else
 
- 		    {
 
-                 $start = ($page - 1)*$perpage;
 
-             }
 
-             //取得信息列表
 
-             $info_list = $this->whenter->find_all($where,'id,sku,title,label,printing,enter',$order_str,$start,$perpage);
 
- 			foreach ($info_list as $key=>$value) 
 
- 		    {
 
- 				if($value['enter'] != 0)
 
- 				{
 
- 					$info_list[$key]['enter'] = date('Y-m-d H:i:s',$value['enter']);
 
- 				}
 
- 				else
 
- 				{
 
- 					$info_list[$key]['enter'] = "";
 
- 				}
 
- 				if($value['printing'] != 0)
 
- 				{
 
- 					$info_list[$key]['printing'] = date('Y-m-d H:i:s',$value['printing']);
 
- 				}
 
- 				else
 
- 				{
 
- 					$info_list[$key]['printing'] = "";
 
- 				}
 
- 				
 
- 		    }
 
- 		    $total = $this->whenter->find_count($where);
 
- 		    $pagenum = ceil($total/$perpage);
 
- 		    $over = $total-($start+$perpage);
 
- 		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
 
- 		    echo json_encode($rows);exit;
 
- 		}
 
- 		$this->_Template('whenter_add',$this->data);
 
- 	}
 
- }
 
 
  |