|
@@ -5,6 +5,8 @@ class Amazonbarcode extends Start_Controller {
|
|
parent::__construct();
|
|
parent::__construct();
|
|
$this->load->_model('Model_amazonbarcode','amazonbarcode');
|
|
$this->load->_model('Model_amazonbarcode','amazonbarcode');
|
|
$this->load->_model('Model_excel','excel');
|
|
$this->load->_model('Model_excel','excel');
|
|
|
|
+ $this->load->_model('Model_amazonbarcodeitems','amazonbarcodeitems');
|
|
|
|
+
|
|
}
|
|
}
|
|
//定义方法的调用规则 获取URI第二段值
|
|
//定义方法的调用规则 获取URI第二段值
|
|
public function _remap($arg,$arg_array)
|
|
public function _remap($arg,$arg_array)
|
|
@@ -32,7 +34,12 @@ class Amazonbarcode extends Start_Controller {
|
|
else if($arg == 'del')
|
|
else if($arg == 'del')
|
|
{
|
|
{
|
|
$this->_del();
|
|
$this->_del();
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ }else if($arg == 'outpage'){
|
|
|
|
+ $this->_outPage();
|
|
|
|
+ }else if($arg == 'outcount'){
|
|
|
|
+ $this->_outCount($arg_array);
|
|
|
|
+ }
|
|
else
|
|
else
|
|
{
|
|
{
|
|
$this->_index();
|
|
$this->_index();
|
|
@@ -125,9 +132,14 @@ class Amazonbarcode extends Start_Controller {
|
|
$label = $this->input->post('label',true);
|
|
$label = $this->input->post('label',true);
|
|
$print = $this->input->post('print',true);
|
|
$print = $this->input->post('print',true);
|
|
$xztime = $this->input->post('xztime',true);
|
|
$xztime = $this->input->post('xztime',true);
|
|
|
|
+ $batch_no = $this->input->post('batch_no',true);
|
|
$timetk = strtotime($timetk);
|
|
$timetk = strtotime($timetk);
|
|
$timetj = strtotime($timetj);
|
|
$timetj = strtotime($timetj);
|
|
$where = "1=1";
|
|
$where = "1=1";
|
|
|
|
+ if($batch_no)
|
|
|
|
+ {
|
|
|
|
+ $where .= " and batch_no = '$batch_no'";
|
|
|
|
+ }
|
|
if($number)
|
|
if($number)
|
|
{
|
|
{
|
|
$where .= " and number = '$number'";
|
|
$where .= " and number = '$number'";
|
|
@@ -155,7 +167,7 @@ class Amazonbarcode extends Start_Controller {
|
|
{
|
|
{
|
|
$start = ($page - 1)*$perpage;
|
|
$start = ($page - 1)*$perpage;
|
|
}
|
|
}
|
|
- $info_list = $this->amazonbarcode->find_all($where,'id,number,label,label2,num,time,addtime',$order_str,$start,$perpage);
|
|
|
|
|
|
+ $info_list = $this->amazonbarcode->find_all($where,'id,batch_no,number,label,label2,num,out_num,time,addtime',$order_str,$start,$perpage);
|
|
foreach ($info_list as $key=>$value)
|
|
foreach ($info_list as $key=>$value)
|
|
{
|
|
{
|
|
if($value['time'] != 0)
|
|
if($value['time'] != 0)
|
|
@@ -174,6 +186,7 @@ class Amazonbarcode extends Start_Controller {
|
|
{
|
|
{
|
|
$info_list[$key]['addtime'] = '';
|
|
$info_list[$key]['addtime'] = '';
|
|
}
|
|
}
|
|
|
|
+ $info_list[$key]['out_num'] = $value['out_num']*1;
|
|
}
|
|
}
|
|
$total = $this->amazonbarcode->find_count($where);
|
|
$total = $this->amazonbarcode->find_count($where);
|
|
$pagenum = ceil($total/$perpage);
|
|
$pagenum = ceil($total/$perpage);
|
|
@@ -321,6 +334,26 @@ class Amazonbarcode extends Start_Controller {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$i = 0;$j = 0;$ed = array();$time = time();
|
|
$i = 0;$j = 0;$ed = array();$time = time();
|
|
|
|
+ $laster_info = $this->amazonbarcode->find("","","id desc");
|
|
|
|
+
|
|
|
|
+ $batch_no = date('Ymd',time());
|
|
|
|
+ if(empty($laster_info['batch_no'])){
|
|
|
|
+ $batch_no = date('Ymd',time()).'-001';
|
|
|
|
+ }else{
|
|
|
|
+ $tmp_arr = explode('-',$laster_info['batch_no']);
|
|
|
|
+ if($tmp_arr[0] == $batch_no){
|
|
|
|
+ $tmp_num = ($tmp_arr[1]*1)+1;
|
|
|
|
+ if($tmp_num < 10){
|
|
|
|
+ $batch_no = date('Ymd',time()).'-00'.$tmp_num;
|
|
|
|
+ }elseif($tmp_num < 100){
|
|
|
|
+ $batch_no = date('Ymd',time()).'-0'.$tmp_num;
|
|
|
|
+ }else{
|
|
|
|
+ $batch_no = date('Ymd',time()).'-'.$tmp_num;
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ $batch_no = date('Ymd',time()).'-001';
|
|
|
|
+ }
|
|
|
|
+ }
|
|
foreach ($list as $key=>$value)
|
|
foreach ($list as $key=>$value)
|
|
{
|
|
{
|
|
$time = time();
|
|
$time = time();
|
|
@@ -328,6 +361,7 @@ class Amazonbarcode extends Start_Controller {
|
|
{
|
|
{
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+ $post['batch_no'] = $batch_no;
|
|
$post['number'] = $value['0'];
|
|
$post['number'] = $value['0'];
|
|
$post['label'] = ($value['1'])?$value['1']:'';
|
|
$post['label'] = ($value['1'])?$value['1']:'';
|
|
$post['label2'] = ($value['2'])?$value['2']:'';
|
|
$post['label2'] = ($value['2'])?$value['2']:'';
|
|
@@ -345,6 +379,7 @@ class Amazonbarcode extends Start_Controller {
|
|
$j++;
|
|
$j++;
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+
|
|
$this->amazonbarcode->insert($post);
|
|
$this->amazonbarcode->insert($post);
|
|
}
|
|
}
|
|
if($j > 0)
|
|
if($j > 0)
|
|
@@ -370,4 +405,129 @@ class Amazonbarcode extends Start_Controller {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ //出库计数
|
|
|
|
+ public function _outPage(){
|
|
|
|
+ $post = $this->input->post(NULL, TRUE);
|
|
|
|
+ if(isset($post['page']))
|
|
|
|
+ {
|
|
|
|
+ $page = $this->input->post('page',true);
|
|
|
|
+ $perpage = $this->input->post('perpage',true);
|
|
|
|
+ $timetk = $this->input->post('timetk',true);
|
|
|
|
+ $timetj = $this->input->post('timetj',true);
|
|
|
|
+ $number = $this->input->post('number',true);
|
|
|
|
+ $label = $this->input->post('label',true);
|
|
|
|
+ $print = $this->input->post('print',true);
|
|
|
|
+ $xztime = $this->input->post('xztime',true);
|
|
|
|
+ $batch_no = $this->input->post('batch_no',true);
|
|
|
|
+ $timetk = strtotime($timetk);
|
|
|
|
+ $timetj = strtotime($timetj);
|
|
|
|
+ $where = "1=1";
|
|
|
|
+ if($batch_no)
|
|
|
|
+ {
|
|
|
|
+ $where .= " and batch_no = '$batch_no'";
|
|
|
|
+ }
|
|
|
|
+ if($number)
|
|
|
|
+ {
|
|
|
|
+ $where .= " and number = '$number'";
|
|
|
|
+ }
|
|
|
|
+ if($label)
|
|
|
|
+ {
|
|
|
|
+ $where .= " and label = '$label'";
|
|
|
|
+ }
|
|
|
|
+ if($print != '')
|
|
|
|
+ {
|
|
|
|
+ $where .= " and print = '$print'";
|
|
|
|
+ }
|
|
|
|
+ if($timetk && $timetj)
|
|
|
|
+ {
|
|
|
|
+ $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
|
|
|
|
+ }
|
|
|
|
+ //数据排序
|
|
|
|
+ $order_str = $xztime." desc";
|
|
|
|
+ if(empty($page))
|
|
|
|
+ {
|
|
|
|
+ $start = 0;
|
|
|
|
+ $perpage = 1;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ $start = ($page - 1)*$perpage;
|
|
|
|
+ }
|
|
|
|
+ $info_list = $this->amazonbarcode->find_all($where,'id,batch_no,number,num,out_num,time,addtime',$order_str,$start,$perpage);
|
|
|
|
+ foreach ($info_list as $key=>$value)
|
|
|
|
+ {
|
|
|
|
+ if($value['time'] != 0)
|
|
|
|
+ {
|
|
|
|
+ $info_list[$key]['time'] = date('Y-m-d H:i',$value['time']);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ $info_list[$key]['time'] = '';
|
|
|
|
+ }
|
|
|
|
+ if($value['addtime'] != 0)
|
|
|
|
+ {
|
|
|
|
+ $info_list[$key]['addtime'] = date('Y-m-d H:i',$value['addtime']);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ $info_list[$key]['addtime'] = '';
|
|
|
|
+ }
|
|
|
|
+ $info_list[$key]['out_num'] = $value['out_num']*1;
|
|
|
|
+ }
|
|
|
|
+ $total = $this->amazonbarcode->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('amazonbarcode_count',$this->data);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function _outCount($arg_array){
|
|
|
|
+ $post = $this->input->post(NULL, TRUE);
|
|
|
|
+ if(isset($post['id']))
|
|
|
|
+ {
|
|
|
|
+ if(!empty($post['id'])){
|
|
|
|
+ $info = $this->amazonbarcode->read($post['id']);
|
|
|
|
+ if(empty($info)){
|
|
|
|
+ echo json_encode([
|
|
|
|
+ "code"=>0,
|
|
|
|
+ "msg"=>"请求数据不存在",
|
|
|
|
+ "data"=>['num'=>0],
|
|
|
|
+ ]);
|
|
|
|
+ exit;
|
|
|
|
+ }
|
|
|
|
+ $info['out_num'] = $info['out_num']*1 +1;
|
|
|
|
+ $this->amazonbarcode->save(array('out_num'=>$info['out_num']),$post['id']);
|
|
|
|
+ $this->amazonbarcodeitems->insert([
|
|
|
|
+ 'aid'=>(int)$post['id'],
|
|
|
|
+ 'number'=>$info['number'],
|
|
|
|
+ 'addtime'=>time()
|
|
|
|
+ ]);
|
|
|
|
+ echo json_encode([
|
|
|
|
+ "code"=>1,
|
|
|
|
+ "msg"=>"ok",
|
|
|
|
+ "data"=>['num'=>$info['out_num']],
|
|
|
|
+ ]);
|
|
|
|
+ exit;
|
|
|
|
+ }else{
|
|
|
|
+
|
|
|
|
+ echo json_encode([
|
|
|
|
+ "code"=>0,
|
|
|
|
+ "msg"=>"请求参数有无",
|
|
|
|
+ "data"=>['num'=>0],
|
|
|
|
+ ]);
|
|
|
|
+ exit;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ $arg_array = $arg_array[0];
|
|
|
|
+ $amazonbarcode = $this->amazonbarcode->read($arg_array);
|
|
|
|
+ $this->data['info'] = $amazonbarcode;
|
|
|
|
+
|
|
|
|
+ $this->_Template('amazonbarcode_check',$this->data);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|