| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646 |
- <?php defined('BASEPATH') or exit('No direct script access allowed');
- /**
- * 由于whlabel类下的代码太长了,决定以后非必要代码都放在whlabelfz类中,以便于管理。
- */
- class Whlabelfz1 extends Start_Controller
- {
- public function __construct()
- {
- parent::__construct();
- $this->load->_model("Model_whlabel_bh_transfer",'whlabel_bh_transfer');
- $this->load->_model("Model_whlabel_bh_scan",'whlabel_bh_scan');
- $this->load->_model("Model_logic_u9tools","logic_u9tools");
- $this->load->_model("Model_whlabellabel","whlabellabel");
- $this->load->_model('Model_purchase', 'purchase');
- $this->load->_model('Model_whlabel_type', 'whlabel_type');
- $this->load->_model("Model_shop","shop");
- $this->load->_model("Model_warehouse","warehouse");
- $this->load->_model("Model_express","express");
- $this->load->_model("Model_whlabeltransport","whlabeltransport");
- $this->load->_model("Model_logic_order","logic_order");
- $this->load->_model("Model_user","user");
- $this->load->_model("Model_fullorderexcel","fullorderexcel");
- $this->load->_model("Model_power","power");
- $this->load->_model("Model_orderurl","orderurl");
- }
- //定义方法的调用规则 获取URI第二段值
- public function _remap($arg, $arg_array)
- {
- if ($arg == 'scam_mgxx') //
- {
- $this->_scanMgxx();
- }
- else if($arg =='scam_mgxx_post')
- {
- $this->_scanMgxxPost();
- }else if($arg == 'mgxxindex'){
- $this->_mgxxindex();
- }
- else if($arg == 'get_scan_info'){
- $this->_getScanInfo();
- }
- else if($arg =='typedy'){
- $this->_typedy($arg_array);
- }
- else if($arg =='scanlogs'){
- $this->_scanlogs();
- }
- else if($arg =='zoutorder'){
- $this->_zoutorder();
- }
- else {
- $this->_index();
- }
- }
- private function _index(){
- die('No direct script access allowed');
- }
- private function _mgxxindex(){
- $post = $this->input->post();
- if(!empty($post)){
- $timetk = $this->input->post('timetk',true);
- $timetj = $this->input->post('timetj',true);
- $type = $this->input->post('type',true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
- $page = $this->input->post('page', true);
- $perpage = $this->input->post('perpage', true);
- $where_sql = " 1=1 ";
- if($timetk&&$timetj){
- $where_sql .= " and scantime >= ".$timetk ." and scantime <= ".$timetj." ";
- }
- if(!empty($post['orderinfo'])){
- $where_sql .=" and orderinfo = '".$post['orderinfo']."' ";
- }
- if($type){
- $where_sql .=" and type = ".$type." ";
- }
- $list = $this->db->from("whlabel_bh_scan")->select('id,orderinfo,type,jm,pm,sl,scantime')->where($where_sql)->order_by('id desc')->limit($perpage,($page-1)*$perpage)->get()->result_array();
- $total = $this->db->from("whlabel_bh_scan")->where($where_sql)->count_all_results();
- $pagenum = ceil($total/$perpage);
- $over = $total-($page*$perpage);
- foreach($list as $k=>$v){
- $list[$k]['type'] = ($v['type']== 1)?"工厂布标":"仓库标签";
- $list[$k]['scantime'] = date('Y-m-d H:i:s',$v['scantime']);
- }
- $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($list));
- echo json_encode($rows);exit;
- }
- $this->_Template('whlabelfz1_mgxxindex', $this->data);
- }
- //美国销售 扫描出库的
- private function _scanMgxx(){
- $post = $this->input->post();
- if(!empty($post)){
- $type = $this->input->post('type',true);
- $orderinfo = $this->input->post('orderinfo',true);
- $page = $this->input->post('page',true);
- $perpage = $this->input->post('perpage',true);
- $where = " type = ".$type." and orderinfo = '".(string)$orderinfo."' ";
- if(empty($page))
- {
- $start = 0;
- $perpage = 1;
- }
- else
- {
- $start = ($page - 1)*$perpage;
- }
- $order_str = 'id desc';
- $info_list = $this->whlabel_bh_scan->find_all($where,'id,orderinfo,pm,label,sl,scantime',$order_str,$start,$perpage);
- $total = $this->whlabel_bh_scan->find_count($where);
- $pagenum = ceil($total/$perpage);
- $over = $total-($start+$perpage);
- foreach($info_list as $k=>$v){
- $info_list[$k]['scantime'] = date('Y-m-d H:i:s',$v['scantime']);
- }
- $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
- echo json_encode($rows);exit;
- }else{
- $orderinfo = $this->input->get('orderinfo',true);
- $type = $this->input->get('type',true);
- $this->data['orderinfo'] = $orderinfo;
- $this->data['type'] = $type;
- $this->_Template('whlabelfz1_scammgxx', $this->data);
- }
-
- }
- private function _getScanInfo(){
- $post = $this->input->post();
- $label = $post['label'];
- if(empty($label)){
- die(json_encode(['code'=>-1,'msg'=>'请输入标签号','data'=>[]]));
- }
- $info = $this->whlabel_bh_transfer->find("label ='".$label."'");
- if(empty($info)){
- die(json_encode(['code'=>-1,'msg'=>'标签号不存在','data'=>[]]));
- }
- echo "<pre>";
- print_r($info);
- die;
- }
- //接收美店销售的post提交
- private function _scanMgxxPost(){
- $post = $this->input->post();
- $type = $post['type'];
- $orderinfo = $post['orderinfo'];
- $label = $post['scanlabel'];
- $num = (int)$post['num'];
- if(empty($type)){
- exit(json_encode(['code'=>-1,'msg'=>'数据类型异常,请联系技术','data'=>[]],JSON_UNESCAPED_UNICODE));
- }
- if(empty($orderinfo)){
- exit(json_encode(['code'=>-1,'msg'=>'美国销售单号未输入','data'=>[]],JSON_UNESCAPED_UNICODE));
- }
- if(empty($label)){
- exit(json_encode(['code'=>-1,'msg'=>'标签号不能为空','data'=>[]],JSON_UNESCAPED_UNICODE));
- }
- if(!in_array($type,[1,2])){
- exit(json_encode(['code'=>-1,'msg'=>'数据类型异常,请联系技术','data'=>[],JSON_UNESCAPED_UNICODE]));
- }
- if($type == 1){
- $num = 1;
- }
- if($type == 2){
- if($num > 2000){
- exit(json_encode(['code'=>-1,'msg'=>'扫描数量不能大于2000','data'=>[],JSON_UNESCAPED_UNICODE]));
- }
- }
-
-
- if($type == 1){
- $info = $this->whlabel_bh_scan->find("label ='".$label."'");
- if(!empty($info)){
- exit(json_encode(['code'=>-1,'msg'=>'该标签已被扫描','data'=>[],JSON_UNESCAPED_UNICODE]));
- }
- $res = $this->_bbscan($orderinfo,$label);
- }elseif($type == 2){
- $start_time = strtotime(date("Y-m-d"),time());
- $info = $this->whlabel_bh_scan->find("label ='".$label."' and scantime >= ".$start_time);
- if(!empty($info)){
- exit(json_encode(['code'=>-1,'msg'=>'该标签已被扫描','data'=>[],JSON_UNESCAPED_UNICODE]));
- }
- $res = $this->_bqscan($orderinfo,$label,$num);
- }
- exit(json_encode($res));
-
- }
- //生产布标扫描
- private function _bbscan($orderinfo,$label){
- $info = $this->whlabel_bh_transfer->find("label ='".$label."'");
- if(empty($info)){
- return ['code'=>-1,'msg'=>'标签号不存在','data'=>[]];
- }
- if($info['label'] != $label){
- return ['code'=>-1,'msg'=>'条码对应的美国销售单号不一致','data'=>[]];
- }
- $arr = [
- 'orderinfo'=>(string)$orderinfo,
- 'type'=>1,
- 'label'=>(string)$label,
- 'features'=>(string)$info['features'],
- 'fid'=>$info['id'],
- 'jm'=>$info['jm'],
- 'pm'=>$info['pm'],
- 'sl'=>1,
- 'scantime'=>time(),
- 'status'=>0,
- ];
- $this->whlabel_bh_scan->insert($arr);
- return ['code'=>1,'msg'=>'标签扫描成功','data'=>[]];
- }
- //标签扫描
- private function _bqscan($orderinfo,$label,$num){
- $info = $this->whlabellabel->find("label ='".$label."'");
- if(empty($info)){
- return ['code'=>-1,'msg'=>'标签号不存在','data'=>[]];
- }
- $list = [
- [
- 'sku2'=>$info['features'],
- ]
- ];
- $res = $this->logic_u9tools->getU9bm($list,'sku2');
- if(empty($res[0])){
- return ['code'=>-1,'msg'=>'u9条码编辑错误-1','data'=>[]];
- }
- if(empty($res[0]['jm'])){
- return ['code'=>-1,'msg'=>'u9条码编辑异常-2','data'=>[]];
- }
- $arr = [
- 'orderinfo'=>(string)$orderinfo,
- 'type'=>2,
- 'label'=>(string)$label,
- 'features'=>(string)$info['features'],
- 'fid'=>$info['id'],
- 'jm'=>$res[0]['jm'],
- 'pm'=>$res[0]['zh'],
- 'sl'=>$num,
- 'scantime'=>time(),
- 'status'=>0,
- ];
- $this->whlabel_bh_scan->insert($arr);
- return ['code'=>1,'msg'=>'标签扫描成功','data'=>[]];
- }
- // 可以排序的仓库数量
- private function _typedy($arg_array){
- $prc = array();
- $purchase = $this->purchase->find_all();
- foreach ($purchase as $k => $v) {
- $prc[$v['id']] = $v['title'];
- }
- $post = $this->input->post(NULL, TRUE);
- if (isset($post['page'])) {
- $page = $this->input->post('page', true);
- $perpage = $this->input->post('perpage', true);
- $category = $this->input->post('category', true);
- $warehouse = $this->input->post('warehouse', true);
-
- //这里的仓库是隐藏传递的所以不需要判断
- $where_sql = " state = 0 and warehouse = ".$warehouse." ";
- if(!empty($post['purchase'])){
- $where_sql .= " and purchase = ".$post['purchase']." ";
- }
- if(!empty($post['type'])){
- $where_sql .= " and type = ".$post['type']." ";
- }
- if(!empty($post['category'])){//类目
- $where_sql .= " and features like '%-".$post['category']."-%' ";
- }
- if(!empty($post['grade'])){//等级
- $where_sql .= " and features like '%-".$post['grade']."-%' ";
- }
- if(!empty($post['color'])){//颜色
- $where_sql .= " and features like '%-".$post['color']."-%' ";
- }
- if(!empty($post['lowe'])){//曲度
- $where_sql .= " and features like '%-".$post['lowe']."-%' ";
- }
- if(!empty($post['lacetype'])){//头套种类
- $where_sql .= " and features like '%-".$post['lacetype']."-%' ";
- }
- if(!empty($post['lacecolor'])){//头套颜色
- $where_sql .= " and features like '%-".$post['lacecolor']."-%' ";
- }
- if(!empty($post['size'])){//尺寸
- $where_sql .= " and features like '%-".$post['size']."-%' ";
- }
- if(!empty($post['density'])){//密度
- $where_sql .= " and features like '%-".$post['density']."-%' ";
- }
- if(!empty($post['haircap'])){
- $where_sql .= " and features like '%-".$post['haircap']."-%' ";
- }
- if(!empty($post['hairnumber'])){
- $where_sql .= " and features like '%-".$post['hairnumber']."-%' ";
- }
- if(!empty($post['cklx'])){
- $shop_info = $this->shop->read($post['cklx']);
- if(!empty($shop_info)){
- $where_sql .= " and zd like '%-".$shop_info['shortname']."-%' ";
- }
- }
- if(!empty($post['sku'])){
- $sku = trim($post['sku'], ' ');
- $sku = trim($sku, ' ');
- $where_sql .= " and sku like '%".$sku."%' ";
- }
- if(!empty($post['title'])){
- $title = trim($post['title']);
- $where_sql .= " and title like '%". $title ."%' ";
- }
- if(!empty($post['cpbz'])){
- $cpbz = trim($post['cpbz']);
- $where_sql .= " and cpbz like '%". $cpbz ."%' ";
- }
- if(!empty($post['sm'])){
- $sm = trim($post['sm']);
- $where_sql .= " and sm like '%". $sm ."%' ";
- }
-
- if (empty($page)) {
- $start = 0;
- $perpage = 1;
- } else {
- $start = ($page - 1) * $perpage;
- }
- $get_model = $this->db->from("whlabel")->where($where_sql)->select("id,number,purchase,sku,warehouse,features,title,details,cpid,COUNT(id) AS total_num")->group_by('sku');
- if(!empty($post['dopx'])){
- if($post['dopx'] == 1){
- $get_model = $get_model->order_by("total_num",'ASC');
- }
- if($post['dopx'] == 2){
- $get_model = $get_model->order_by("total_num",'DESC');
- }
- }
-
- // $list = $get_model->limit($perpage,$start)->get_compiled_select();
- // echo $list;
- // die;
- $list = $get_model->limit($perpage,$start)->get()->result_array();
- $warehouse_info = $this->warehouse->read($warehouse);
- $final_list = [];
-
- $sku_list = array_column($list,'sku');
-
- // $zd_list = ;
- foreach($list as $k => $v){
- $final_list[$k]['id'] = $v['id'];
- $final_list[$k]['warehous'] = $warehouse_info['title'];
- $final_list[$k]['purchase'] = $prc[$v['purchase']];
- $final_list[$k]['sku'] = $v['sku'];
- $final_list[$k]['title'] = $v['title'];
- $tmp_deatil = "";
- if(!empty($v['details'])){
- $tmp_deatil = $v['details'];
- }
- if(!empty($v['cpid'])){
- $tmp_deatil .= "<br/>".$v['cpid'];
- }
- $final_list[$k]['details'] = $tmp_deatil;
- $final_list[$k]['total_num'] = $v['total_num'];
- $zt = $this->whlabeltransport->find_all('sku = "' . $v['sku'] . '" and warehouse = "' . $v['warehouse'] . '" and features = "' . $v['features'] . '" and cz = "0"');
- $ztdata = '';
- if (count($zt) > 0) {
- foreach ($zt as $vv) {
- $ztdata .= '<p>' . $vv['num'] . ' - ' . date('Y-m-d', $vv['stime']) . '</p>';
- }
- }
- $z = $this->db->from("whlabel")->where("sku = '".$v['sku']."' and state = 0 and warehouse = '". $v['warehouse']."' and features = '". $v['features']."' and zd != '' ")->count_all_results();
- $final_list[$k]['zt'] = $ztdata;
- $final_list[$k]['zd'] = $z;
- }
-
-
- $total = $this->db->from("whlabel")->where($where_sql)->select("id,number,sku,warehouse,title,details,cpid,COUNT(id) AS total_num")->group_by('sku')->count_all_results();
- $pagenum = ceil($total / $perpage);
- $over = $total - ($start + $perpage);
-
-
- $rows = array('total' => $total, 'over' => $over, 'pagenum' => $pagenum, 'rows' => ($final_list), 'CS' => $warehouse);
-
- echo json_encode($rows);
- exit;
- }
- $this->data['warehouse'] = (isset($arg_array[0])) ? $arg_array[0] : 5;
- $this->_Template('whlabelfz1_typedy', $this->data);
- }
- public function _scanlogs(){
- $params = $this->input->get(NULL, TRUE);
- $timetj = $params['timetj'];
- $timetk = $params['timetk'];
- $where = [];
- $where["scantime >="] = strtotime($timetj);
- $where["scantime <="] = strtotime($timetk);
- if(!empty($params['orderinfo'])){
- $where["orderinfo"] = $params['orderinfo'];
- }
- $list = $this->db->from("whlabel_bh_scan")->where($where)->get()->result_array();
- //生成excel
- $filename = date("Y-m-d")."工厂备货扫描记录导出.xls";
- $str = "<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">
- <head>
- <!--[if gte mso 9]><xml>
- <x:ExcelWorkbook>
- <x:ExcelWorksheets>
- <x:ExcelWorksheet>
- <x:Name>EXCEL</x:Name>
- <x:WorksheetOptions>
- <x:Print>
- <x:ValidPrinterInfo />
- </x:Print>
- </x:WorksheetOptions>
- </x:ExcelWorksheet>
- </x:ExcelWorksheets>
- </x:ExcelWorkbook>
- </xml>
- <![endif]-->
- </head><body>";
- $str .= "<table border=1 style='font-family: Microsoft Yahei;font-size: 13px;'>";
- $str .= "<tr><td>备货单编码</td><td>扫码类型</td><td>SKU</td><td>名称</td><td>料号</td><td>状态</td><td>入库时间</td><td>所在位置</td></tr>";
- foreach ($info_list as $key=>$value)
- {
-
- $str .= "<tr>";
- $str .= "<td>". $value['warehouse']. "</td>";
- $str .= "<td>". $value['purchase']. "</td>";
- $str .= "<td>". $value['sku']. "</td>";
- $str .= "<td>". $value['title']. "</td>";
- $str .= "<td>". $value['features']. "</td>";
- $str .= "<td>". $value['state']. "</td>";
- $str .= "<td>". $value['enter']. "</td>";
- $str .= "<td>". $value['details']. "</td>";
- $str .= "</tr>";
- }
- $str .= "</table></body></html>";
- header( "Content-Type: application/vnd.ms-excel; name='excel'" );
- header( "Content-type: application/octet-stream" );
- header( "Content-Disposition: attachment; filename=".$filename );
- header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" );
- header( "Pragma: no-cache" );
- header( "Expires: 0" );
- exit($str);
- }
- //汇总的出库浏览
- private function _zoutorder(){
- $fgshop = "";
- $sid = "";
- if (isset($_SESSION['api'])) {
- $user = $this->user->get_api($_SESSION['api']);
- $usp = $user;
-
- $user = explode('|', trim($user['shop'], '|'));
- foreach ($user as $value) {
- $fgshop .= " shop = " . $value . " or";
- $sid .= " id = " . $value . " or";
- }
- } else {
- echo "请重新登录";
- die;
- }
- $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);
- $xztime = $this->input->post('xztime', true);
- $timetk = $this->input->post('timetkk', true);
- $timetj = $this->input->post('timetjj', true);
- $shop = $this->input->post('shop', true);
- $source = $this->input->post('source', true);
- $orderinfo = $this->input->post('orderinfo', true);
- $number = $this->input->post('number', true);
- $sfxh = $this->input->post('sfxh', true);
- $express = $this->input->post('express', true);
- $waybill = $this->input->post('waybill', true);
- $library = $this->input->post('library', true);
- $country = $this->input->post('country', true);
- $so = $this->input->post('so', true);
- $libraryconfirm = $this->input->post('libraryconfirm', true);
- $print = $this->input->post('print', true);
- $state = $this->input->post('state', true);
- $orderurl = $this->input->post('orderurl', true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
-
- $where_arr = [
- $xztime.' >' => $timetk,
- $xztime.' <' => $timetj,
- ];
- if ($warehouse) {
- $where_arr['type'] = $warehouse;
- }
-
- if ($orderinfo) {
- $where_arr['orderinfo'] = $orderinfo;
- }
- if ($number) {
- $where_arr['number'] = $number;
- }
- if ($express) {
- $where_arr['express'] = $express;
- }
- if ($waybill) {
- $where_arr['waybill'] = $waybill;
- }
- if ($library) {
- $where_arr['library'] = $library;
- }
- if ($print) {
- $where_arr['print'] = $print;
- }
- if ($libraryconfirm) {
- $where_arr['libraryconfirm'] = $libraryconfirm;
- }
- if ($state) {
- $where_arr['state'] = $state;
- }
- if ($shop) {
- $where_arr['shop'] = $shop;
- }
- if ($country) {
- $where_arr['country'] = $country;
- }
- if ($sfxh != '') {
- $where_arr['sfxh'] = $sfxh;
- }
- if ($so) {
- $where_arr['so like'] = '%'. $so .'%';
- }
- if ($source) {
- if ($source == '2d') {
- $where_arr['source >='] = '2';
- } else {
- $where_arr['source'] = $source;
- }
- }
- if (isset($_SESSION['api'])) {
- $shop_select_list = [];
- foreach ($user as $value) {
- if(!empty($value)){
- $shop_select_list[] = $value;
- }
- }
- }
- if ($orderurl) {
- $url = $this->orderurl->read($orderurl);
- $where_arr['link like'] = '%'. $url['url'] . '%';
- }
- //数据排序
- $order_str = "librarytime desc";
- if (empty($page)) {
- $start = 0;
- $perpage = 1;
- } else {
- $start = ($page - 1) * $perpage;
- }
- $warehouse_list = $this->warehouse->find_all('1 = 1',"id,title");
- $warehouse_arr = array_column($warehouse_list, 'title', 'id');
- $express_list = $this->express->find_all('1 = 1',"id,servicename");
- $express_arr = array_column($express_list,'servicename', 'id');
- $shop_list = $this->shop->find_all('1 = 1',"id,shopname");
- $shop_arr = array_column($shop_list,'shopname', 'id');
-
- $total = 0;
- $info_list = [];
- $r1 = $this->_getData('fullorder', $where_arr, $order_str, 'id,shop,type,orderinfo,number,waybill,express,librarytime', ($page-1)*$perpage, $perpage,$warehouse_arr,$express_arr,$shop_arr,$shop_select_list);
- $r2 = $this->_getData('fullordertt', $where_arr, $order_str, 'id,shop,type,orderinfo,number,waybill,express,librarytime', ($page-1)*$perpage, $perpage,$warehouse_arr,$express_arr,$shop_arr,$shop_select_list);
- $r3 = $this->_getData('fullordersmt', $where_arr, $order_str, 'id,shop,type,orderinfo,number,waybill,express,librarytime', ($page-1)*$perpage, $perpage,$warehouse_arr,$express_arr,$shop_arr,$shop_select_list);
- $r4 = $this->_getData('fullorderamz', $where_arr, $order_str, 'id,shop,type,orderinfo,number,waybill,express,librarytime', ($page-1)*$perpage, $perpage,$warehouse_arr,$express_arr,$shop_arr,$shop_select_list);
- $info_list = array_merge($r1['info_list'] , $r2['info_list'] , $r3['info_list'] , $r4['info_list']) ;
- $total += $r1['total'] + $r2['total'] + $r3['total'] + $r4['total'];
- $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->data['express'] = $this->express->find_all();
- $wlshop = $this->shop->find_all('1=1 and ' . rtrim($sid, 'or'));
- $this->data['wlshop'] = $wlshop;
- $user = $this->user->get_api($_SESSION['api']);
- $powerid = $this->power->read($user['power']);
- $powertext = explode('|', trim($powerid['excelid'], '|'));
- $pid = '';
- foreach ($powertext as $v) {
- $pid .= " id = " . $v . " or";
- }
- $fullorderexcel = $this->fullorderexcel->find_all("type = '100007' and (" . rtrim($pid, 'or') . ")", '*', 'idorder desc'); //导出模板
- $this->data['fullorderexcel'] = $fullorderexcel;
- $orderurl = $this->orderurl->find_all(rtrim($fgshop, 'or'));
- $this->data['orderurl'] = $orderurl;
- $this->_Template('whlabel_zoutorder', $this->data);
-
- }
- protected function _getData($tableName, $where, $order, $field, $page, $pagesize,$warehouse_arr,$express_arr,$shop_arr,$shop_select_list){
- if(empty($shop_select_list)){
- $info_list = $this->db->from($tableName)->where($where)->order_by($order)->select($field)->limit($pagesize, $page)->get()->result_array();
- $total = $this->db->from($tableName)->where($where)->count_all_results();
- }else{
- $info_list = $this->db->from($tableName)->where($where)->where_in('shop', $shop_select_list)->order_by($order)->select($field)->limit($pagesize, $page)->get()->result_array();
- $total = $this->db->from($tableName)->where($where)->where_in('shop', $shop_select_list)->count_all_results();
- }
-
- //格式化数据
- foreach ($info_list as $key => $value) {
- $info_list[$key]['shop'] = isset($shop_arr[$value['shop']])? $shop_arr[$value['shop']] : '';
- $info_list[$key]['express'] = isset($express_arr[$value['express']])?$express_arr[$value['express']]:'';
- $info_list[$key]['type'] = isset($warehouse_arr[$value['type']])? $warehouse_arr[$value['type']] : '';
- if ($value['librarytime'] == '0') {
- $info_list[$key]['librarytime'] = '<em class="t"></em>';
- } else {
- $info_list[$key]['librarytime'] = '<em class="t">' . date('Y-m-d H:i:s', $value['librarytime']) . '</em>';
- }
- }
-
- return [
- 'info_list' => $info_list,
- 'total' => $total,
- ];
- }
- }
|