|
|
@@ -15,7 +15,13 @@ class Whlabelfz1 extends Start_Controller
|
|
|
$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)
|
|
|
@@ -36,6 +42,12 @@ class Whlabelfz1 extends Start_Controller
|
|
|
else if($arg =='typedy'){
|
|
|
$this->_typedy($arg_array);
|
|
|
}
|
|
|
+ else if($arg =='scanlogs'){
|
|
|
+ $this->_scanlogs();
|
|
|
+ }
|
|
|
+ else if($arg =='zoutorder'){
|
|
|
+ $this->_zoutorder();
|
|
|
+ }
|
|
|
else {
|
|
|
$this->_index();
|
|
|
}
|
|
|
@@ -385,4 +397,246 @@ class Whlabelfz1 extends Start_Controller
|
|
|
$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_list = [];
|
|
|
+ foreach ($user as $value) {
|
|
|
+ if(!empty($value)){
|
|
|
+ $shop_list[] = $value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(count($shop_list) > 0){
|
|
|
+ $where_arr["shop in "] = "(" . implode(',', $shop_list) . ")";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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 = [];
|
|
|
+
|
|
|
+ $r = $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);
|
|
|
+
|
|
|
+ $info_list = array_merge($info_list, $r['info_list']);
|
|
|
+ $total += $r['total'];
|
|
|
+ $pagenum = ceil($r['total'] / $perpage);
|
|
|
+ $over = $r['total'] - ($start + $perpage);
|
|
|
+ $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){
|
|
|
+
|
|
|
+ $info_list = $this->db->from($tableName)->where($where)->order_by($order)->select($field)->limit($pagesize, $page)->get()->result_array();
|
|
|
+ //格式化数据
|
|
|
+ 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>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $total = $this->db->from($tableName)->where($where)->count_all_results();
|
|
|
+ return [
|
|
|
+ 'info_list' => $info_list,
|
|
|
+ 'total' => $total,
|
|
|
+ ];
|
|
|
+ }
|
|
|
}
|