|
|
@@ -158,6 +158,9 @@ class Whlabel_bh extends Start_Controller {
|
|
|
else if($arg == 'czbmsfcz'){
|
|
|
$this->_czbmIsOutExcel();
|
|
|
}
|
|
|
+ else if($arg == 'ycrk'){
|
|
|
+ $this->_ycrk();
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
$this->_index();
|
|
|
@@ -2140,7 +2143,126 @@ class Whlabel_bh extends Start_Controller {
|
|
|
$post = $this->input->post(NULL, TRUE);
|
|
|
if(isset($post['page']))
|
|
|
{
|
|
|
- $rows = $this->getOperateList();
|
|
|
+
|
|
|
+ $api = $this->input->post('api',true);
|
|
|
+ $page = $this->input->post('page',true);
|
|
|
+ $perpage = $this->input->post('perpage',true);
|
|
|
+ $orderinfo = $this->input->post('number',true);
|
|
|
+ $color = $this->input->post('color',true);
|
|
|
+ $pm = $this->input->post('pm',true);
|
|
|
+ $purchase = $this->input->post('purchase',true);
|
|
|
+ $transfer = $this->input->post('transfer',true);
|
|
|
+ $lx = $this->input->post('lx',true);
|
|
|
+ $crk_select = $this->input->post('crk',true);
|
|
|
+ $timetk = $this->input->post('timetk',true);
|
|
|
+ $timetj = $this->input->post('timetj',true);
|
|
|
+ $timetk = strtotime($timetk);
|
|
|
+ $timetj = strtotime($timetj);
|
|
|
+ $where = "1=1";
|
|
|
+ if($transfer)
|
|
|
+ {
|
|
|
+ $ctime = 'ctime'.$transfer;
|
|
|
+ $where .= " and $ctime > '$timetk' and $ctime < '$timetj'";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $where .= " and time > '$timetk' and time < '$timetj'";
|
|
|
+ }
|
|
|
+ if($orderinfo)
|
|
|
+ {
|
|
|
+ $where .= " and orderinfo like '%$orderinfo%'";
|
|
|
+ }
|
|
|
+ if($transfer)
|
|
|
+ {
|
|
|
+ $where .= " and rk like '%|".$transfer."|%'";
|
|
|
+ }
|
|
|
+ if($purchase)
|
|
|
+ {
|
|
|
+ $where .= " and purchase = '$purchase'";
|
|
|
+ }
|
|
|
+ if($pm)
|
|
|
+ {
|
|
|
+ $where .= " and pm like '%$pm%'";
|
|
|
+ }
|
|
|
+ if($color)
|
|
|
+ {
|
|
|
+ $where .= " and features like '%-".$color."-%'";
|
|
|
+ }
|
|
|
+ if(!empty($crk_select)){
|
|
|
+ $where_arr = [];
|
|
|
+ $where_arr['time >='] =$timetk;
|
|
|
+ $where_arr['time <='] = $timetj;
|
|
|
+ if($transfer > 0){
|
|
|
+ $where_arr['lx'] =$transfer;
|
|
|
+ }
|
|
|
+
|
|
|
+ $cr_model = $this->db->from('whlabel_bh_transfer_cr')->select('id,fid,is_over,lx,time,type,ycrk_type');
|
|
|
+
|
|
|
+
|
|
|
+ if($crk_select == 1){
|
|
|
+ $where_arr['type'] =1;
|
|
|
+ $cr_tmp_list = $cr_model->where($where_arr)->get()->result_array();
|
|
|
+ }else{
|
|
|
+ $where_arr['type'] = 2;
|
|
|
+ $cr_tmp_list = $cr_model->where($where_arr)->get()->result_array();
|
|
|
+ }
|
|
|
+ $fids = array_column($cr_tmp_list,'fid');
|
|
|
+ $ids = array_unique($fids);
|
|
|
+ if(empty($ids)){
|
|
|
+ $where .= " and id = 0 ";
|
|
|
+ }else{
|
|
|
+ $where .= " and id in (".implode(",",$ids).")";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ //数据排序
|
|
|
+ $order_str = "id desc";
|
|
|
+ if(empty($page))
|
|
|
+ {
|
|
|
+ $start = 0;
|
|
|
+ $perpage = 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $start = ($page - 1)*$perpage;
|
|
|
+ }
|
|
|
+ //取得信息列表
|
|
|
+ $info_list = $this->whlabel_bh_transfer->find_all($where,'id,orderinfo,pm,shipremarks,ts,printtime,time',$order_str,$start,$perpage);
|
|
|
+ $transfer = $this->transfer->find_all();
|
|
|
+ $t = array();$ot = array();
|
|
|
+ foreach ($transfer as $v)
|
|
|
+ {
|
|
|
+ $t[$v['id']] = $v['title'];
|
|
|
+ $ot[$v['id']] = ($v['orvertime']>0)?$v['orvertime']*24*3600:0;
|
|
|
+ }
|
|
|
+ //格式化数据
|
|
|
+ foreach ($info_list as $key=>$value)
|
|
|
+ {
|
|
|
+ $info_list[$key]['printtime'] = date('Y-m-d H:i:s',$value['printtime']);
|
|
|
+ $log_list= $this->whlabel_bh_transfer_cr->find_all("fid = ".$value['id']);
|
|
|
+ $tmp_operate_str = "";
|
|
|
+ foreach($log_list as $k=>$v){
|
|
|
+ if(empty($v['lx']) && !empty($v['ycrk_type'])){
|
|
|
+ $tmp_operate_str.= "订单已完成:".date('Y-m-d H:i:s',$v['time'])."<br>";
|
|
|
+ }else{
|
|
|
+ $tmp_operate_str.= $t[$v['lx']]."".($v['type']==1?'入库':'出库').":".date('Y-m-d H:i:s',$v['time'])."<br>";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ $info_list[$key]['time'] = trim($tmp_operate_str,'<br>');
|
|
|
+ if(empty($value['ycrk_type'])){
|
|
|
+ $info_list[$key]['ycrk_type'] = "<p style='background-color: #f0f0f0 !important;color:#000 !important' onclick='addYcrk(".$value['id'].")'>异常入库</p>";
|
|
|
+ }else{
|
|
|
+ $info_list[$key]['ycrk_type'] = "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $total = $this->whlabel_bh_transfer->find_count($where);
|
|
|
+ $pagenum = ceil($total/$perpage);
|
|
|
+ $over = $total-($start+$perpage);
|
|
|
+ $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list),'where'=>$where);
|
|
|
+
|
|
|
+
|
|
|
echo json_encode($rows);exit;
|
|
|
}
|
|
|
if(isset($_SESSION['api']))
|
|
|
@@ -3559,4 +3681,40 @@ class Whlabel_bh extends Start_Controller {
|
|
|
|
|
|
return $tran_list;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public function _ycrk(){
|
|
|
+ if($this->input->method() == 'get'){
|
|
|
+ echo json_encode(array('msg'=>'请求方式不正确','success'=>false));exit;
|
|
|
+ }
|
|
|
+ $id = $this->input->post('id',true);
|
|
|
+ $type = $this->input->post('type',true);
|
|
|
+ if(!in_array($type,[1,2,3])){
|
|
|
+ echo json_encode(array('msg'=>'入库类别异常,联系技术','success'=>false));exit;
|
|
|
+ }
|
|
|
+ $info = $this->whlabel_bh_transfer->read($id);
|
|
|
+ if(empty($info)){
|
|
|
+ echo json_encode(array('msg'=>'数据不存在','success'=>false));exit;
|
|
|
+ }
|
|
|
+ if(!empty($info['ycrk_type'])){
|
|
|
+ echo json_encode(array('msg'=>'已添加异常入库,不要重复添加','success'=>false));exit;
|
|
|
+ }
|
|
|
+
|
|
|
+ //更新数据
|
|
|
+ $this->whlabel_bh_transfer->save([
|
|
|
+ 'ycrk_type'=>$type,
|
|
|
+ ],$id);
|
|
|
+ $list = $this->whlabel_bh_transfer_cr->find_all('fid = '.$id,'*','id desc');
|
|
|
+ foreach ($list as $key=>$value) {
|
|
|
+ $this->whlabel_bh_transfer_cr->save([
|
|
|
+ 'ycrk_type'=>$type,
|
|
|
+ ],$value['id']);
|
|
|
+ }
|
|
|
+ $this->whlabel_bh_transfer_cr->insert([
|
|
|
+ 'fid'=>$id,'lx'=>0,'type'=>$type,'time'=>time(),'is_over'=>0,'over_flag'=>0,
|
|
|
+ 'extra_status'=>0,'ycrk_type'=>$type,
|
|
|
+ ]);
|
|
|
+ echo json_encode(array('msg'=>'添加成功','success'=>true));exit;
|
|
|
+
|
|
|
+ }
|
|
|
}
|