|
@@ -74,6 +74,10 @@ class Zzququeu9 extends Start_Controller {
|
|
$this->_wxxs($arg_array);
|
|
$this->_wxxs($arg_array);
|
|
}elseif($arg == 'gcbh_index'){
|
|
}elseif($arg == 'gcbh_index'){
|
|
$this->_gcbh_index();
|
|
$this->_gcbh_index();
|
|
|
|
+ }elseif($arg == 'gcbh_hz_excel'){
|
|
|
|
+ $this->_gcbh_hz_excel();
|
|
|
|
+ }elseif($arg == 'gcbhexcel'){
|
|
|
|
+ $this->_gcbhexcel();
|
|
}else
|
|
}else
|
|
{
|
|
{
|
|
$this->_index();
|
|
$this->_index();
|
|
@@ -1252,4 +1256,249 @@ class Zzququeu9 extends Start_Controller {
|
|
$this->_Template('zzququeu9gcbh',$this->data);
|
|
$this->_Template('zzququeu9gcbh',$this->data);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public function _gcbh_hz_excel(){
|
|
|
|
+ $post = $this->input->post(NULL, TRUE); $params = $this->input->get();
|
|
|
|
+ $where = " type = 10 ";
|
|
|
|
+ if(!empty($params['order_no'])){
|
|
|
|
+ $where .= " and order_no = '".$params['order_no']."' ";
|
|
|
|
+ }
|
|
|
|
+ if(!empty($params['timetk'])){
|
|
|
|
+ $where .= " and create_time > ".strtotime($params['timetk'])." ";
|
|
|
|
+ }
|
|
|
|
+ if(!empty($params['timetj'])){
|
|
|
|
+ $where .= "and create_time < ".strtotime($params['timetj'])." ";
|
|
|
|
+ }
|
|
|
|
+ if(!empty($params['status'])){
|
|
|
|
+ $status = $params['status'];
|
|
|
|
+ if($status == 1){
|
|
|
|
+ $where .= " and dc_status = 0 ";
|
|
|
|
+ }elseif($status == 2){
|
|
|
|
+ $where .= " and dc_status = -1 ";
|
|
|
|
+ }elseif($status == 3){
|
|
|
|
+ $where .= " and dc_status = -2 ";
|
|
|
|
+ }elseif($status == 4){
|
|
|
|
+ $where .= " and dc_status = -3 ";
|
|
|
|
+ }elseif($status == 5){
|
|
|
|
+ $where .= " and dc_status < 3 ";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $info_list = $this->zzquque_u9->find_all($where,'*','id desc');
|
|
|
|
+
|
|
|
|
+ $type_list = $this->zzquque_u9->getType();
|
|
|
|
+ $list = [];
|
|
|
|
+ foreach($info_list as $k=>$v){
|
|
|
|
+ $dc_no = $v['dc_no'];
|
|
|
|
+ $error_str = "";
|
|
|
|
+ $error_json ="";
|
|
|
|
+ if($v['dc_status'] == -1){
|
|
|
|
+ $error = $this->zzququeu9_logs->find_all("oid = ".$v['id']." and one_type = 1 and two_type = 1 ","*",'id desc',0,1);
|
|
|
|
+ $error_json = $error[0]['ret_data'];
|
|
|
|
+ if($error[0]['apply_api']=='lpck'){
|
|
|
|
+ $ret_data = json_decode($error[0]['ret_data'],true);
|
|
|
|
+ $apply_data = json_decode($error[0]['apply_data'],true);
|
|
|
|
+ if(isset($ret_data["ResMsg"])){
|
|
|
|
+ if(empty($apply_data['0'])){
|
|
|
|
+ $error_str = $ret_data["ResMsg"];
|
|
|
|
+ }else{
|
|
|
|
+ $error_str = $ret_data["ResMsg"]."【". $apply_data[0]['EntityCode']."】";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }else{
|
|
|
|
+ $error_str = "料品同步失败";
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+
|
|
|
|
+ $ret_data = json_decode($error[0]['ret_data'],true);
|
|
|
|
+ if(isset($ret_data[0]["ResMsg"])){
|
|
|
|
+ $error_str = $ret_data[0]["ResMsg"];
|
|
|
|
+ }elseif(isset($ret_data['msg'])){
|
|
|
|
+ $error_str = $ret_data['msg'];
|
|
|
|
+ }else{
|
|
|
|
+ $error_str = "料品同步失败";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ $list[] = [
|
|
|
|
+ 'id'=>$v['id'],
|
|
|
|
+ 'order_no'=>$v['order_no'],
|
|
|
|
+ 'type'=>isset($type_list[$v['type']])?$type_list[$v['type']]:"异常",
|
|
|
|
+ 'dc_no'=> $dc_no,
|
|
|
|
+ 'error'=>$error_str,
|
|
|
|
+ 'error_json'=>$error_json,
|
|
|
|
+ //'bzsh_no'=>$bzsh_no,
|
|
|
|
+
|
|
|
|
+ 'create_time'=>date("Y-m-d H:i:s",$v['create_time']),
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ $filename = date("Y-m-d")."u9小单导出.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>id</td><td>订单号</td><td>类型</td><td>调出单号</td><td>创建时间</td><td>错误信息</td><td>错误json</td></tr>";
|
|
|
|
+ foreach ($list as $key=>$value)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ $str .= "<tr>";
|
|
|
|
+ $str .= "<td>". $value['id']. "</td>";
|
|
|
|
+ $str .= "<td>". $value['order_no']. "</td>";
|
|
|
|
+ $str .= "<td>". $value['type']. "</td>";
|
|
|
|
+ $str .= "<td>". $value['dc_no']. "</td>";
|
|
|
|
+ $str .= "<td>". $value['create_time']. "</td>";
|
|
|
|
+ $str .= "<td>". $value['error']. "</td>";
|
|
|
|
+ $str .= "<td>". $value['error_json']. "</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);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function _gcbhexcel(){
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ $params = $this->input->get();
|
|
|
|
+ $where = " type = 21 ";
|
|
|
|
+ if(!empty($params['order_no'])){
|
|
|
|
+ $where .= " and order_no = '".$params['order_no']."' ";
|
|
|
|
+ }
|
|
|
|
+ if(!empty($params['timetk'])){
|
|
|
|
+ $where .= " and create_time > ".strtotime($params['timetk'])." ";
|
|
|
|
+ }
|
|
|
|
+ if(!empty($params['timetj'])){
|
|
|
|
+ $where .= "and create_time < ".strtotime($params['timetj'])." ";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ $info_list = $this->zzquque_u9->find_all($where,'*','id desc');
|
|
|
|
+
|
|
|
|
+ $type_list = $this->zzquque_u9->getType();
|
|
|
|
+ $list = [];
|
|
|
|
+ foreach($info_list as $k=>$v){
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ $error_str = "";
|
|
|
|
+ $error_json ="";
|
|
|
|
+ if($v['dc_status'] == -1){
|
|
|
|
+ $error = $this->zzququeu9_logs->find_all("oid = ".$v['id']." and one_type = 20 and two_type = 1 ","*",'id desc',0,1);
|
|
|
|
+ $error_json = $error[0]['ret_data'];
|
|
|
|
+ if($error[0]['apply_api']=='lpck'){
|
|
|
|
+ $ret_data = json_decode($error[0]['ret_data'],true);
|
|
|
|
+ $apply_data = json_decode($error[0]['apply_data'],true);
|
|
|
|
+ if(isset($ret_data["ResMsg"])){
|
|
|
|
+ if(empty($apply_data['0'])){
|
|
|
|
+ $error_str = $ret_data["ResMsg"];
|
|
|
|
+ }else{
|
|
|
|
+ $error_str = $ret_data["ResMsg"]."【". $apply_data[0]['EntityCode']."】";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }else{
|
|
|
|
+ $error_str = "数据异常请联系技术";
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+
|
|
|
|
+ $ret_data = json_decode($error[0]['ret_data'],true);
|
|
|
|
+ if(isset($ret_data[0]["ResMsg"])){
|
|
|
|
+ $error_str = $ret_data[0]["ResMsg"];
|
|
|
|
+ }elseif(isset($ret_data['msg'])){
|
|
|
|
+ $error_str = $ret_data['msg'];
|
|
|
|
+ }else{
|
|
|
|
+ $error_str = "数据异常请联系技术";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ $list[] = [
|
|
|
|
+ 'id'=>$v['id'],
|
|
|
|
+ 'order_no'=>$v['order_no'],
|
|
|
|
+ 'type'=>isset($type_list[$v['type']])?$type_list[$v['type']]:"异常",
|
|
|
|
+ 'bzsh_no'=>empty($v['bzsh_no'])?"":$v['bzsh_no'],
|
|
|
|
+ 'dc_no'=>empty($v['dc_no'])?"":$v['dc_no'],
|
|
|
|
+ 'error_str'=>$error_str,
|
|
|
|
+ 'create_time'=>date("Y-m-d H:i:s",$v['create_time']),
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ $filename = date("Y-m-d")."u9小单导出.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>id</td><td>订单号</td><td>类型</td><td>成品入库单</td><td>调出单</td><td>错误信息</td><td>时间</td></tr>";
|
|
|
|
+ foreach ($list as $key=>$value)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ $str .= "<tr>";
|
|
|
|
+ $str .= "<td>". $value['id']. "</td>";
|
|
|
|
+ $str .= "<td>". $value['order_no']. "</td>";
|
|
|
|
+ $str .= "<td>". $value['type']. "</td>";
|
|
|
|
+ $str .= "<td>". $value['dc_no']. "</td>";
|
|
|
|
+ $str .= "<td>". $value['create_time']. "</td>";
|
|
|
|
+ $str .= "<td>". $value['error']. "</td>";
|
|
|
|
+ $str .= "<td>". $value['error_json']. "</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);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|