|
@@ -131,6 +131,9 @@ class Whlabel_bh extends Start_Controller {
|
|
else if($arg == 'cj_transfer_log_zkcount'){
|
|
else if($arg == 'cj_transfer_log_zkcount'){
|
|
$this->_cj_transfer_log_zkcount();
|
|
$this->_cj_transfer_log_zkcount();
|
|
}
|
|
}
|
|
|
|
+ else if($arg == "cj_transfer_scanout_excel"){
|
|
|
|
+ $this->_cj_transfer_scanout_excel();
|
|
|
|
+ }
|
|
else if($arg == 'excelwchz'){
|
|
else if($arg == 'excelwchz'){
|
|
$this->_excelwchz();
|
|
$this->_excelwchz();
|
|
}
|
|
}
|
|
@@ -2983,5 +2986,82 @@ class Whlabel_bh extends Start_Controller {
|
|
}else{
|
|
}else{
|
|
exit(json_encode(['code'=>1,'msg'=>'未找到该订单']));
|
|
exit(json_encode(['code'=>1,'msg'=>'未找到该订单']));
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
+ // 根据表单的时间导出成品库扫入库汇总excel
|
|
|
|
+ private function _cj_transfer_scanout_excel(){
|
|
|
|
+ $ktime = $this->input->get('timetk',true);
|
|
|
|
+ $jtime = $this->input->get('timetj',true);
|
|
|
|
+ $ktime = strtotime($ktime);
|
|
|
|
+ $jtime = strtotime($jtime);
|
|
|
|
+ $tid = $this->input->get('tid',true);
|
|
|
|
+
|
|
|
|
+ $transfer_info = $this->transfer->read($tid);
|
|
|
|
+
|
|
|
|
+ $where = " time >= ".$ktime." and time <= ".$jtime." and lx = ".$tid." and type = 2 ";
|
|
|
|
+ $list = $this->whlabel_bh_transfer_cr->find_all($where,"*","id asc");
|
|
|
|
+ $final_list = [];
|
|
|
|
+ foreach($list as $k=>$v){
|
|
|
|
+ if(isset($final_list[$v['number']])){
|
|
|
|
+ $final_list[$v['number']]['sl'] = $final_list[$v['number']]['sl'] + 1;
|
|
|
|
+ $final_list[$v['number']]['scanout_time'][] = date("Y-m-d H:i:s",$v['time']);
|
|
|
|
+ }else{
|
|
|
|
+ $tmp_info = $this->whlabel_bh_transfer->read($v['fid']);
|
|
|
|
+ $final_list[$v['number']] = [
|
|
|
|
+ "orderinfo"=>empty($tmp_info['orderinfo'])?"":$tmp_info['orderinfo'],
|
|
|
|
+ "pm"=>$tmp_info['pm'],
|
|
|
|
+ "jm"=>$tmp_info['jm'],
|
|
|
|
+ "sl"=>1,
|
|
|
|
+ "scanout_time"=>[
|
|
|
|
+ date("Y-m-d H:i:s",$v['time'])
|
|
|
|
+ ]
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ echo "<pre>";
|
|
|
|
+ print_r($final_list);
|
|
|
|
+ die;
|
|
|
|
+ $filename = date("Ymd",$ktime)."~".date("Ymd",$jtime).$transfer_info['title']."扫出库汇总.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>简码</td><td>数量</td><td>扫出时间</td></tr>";
|
|
|
|
+ foreach ($final_list as $key=>$value)
|
|
|
|
+ {
|
|
|
|
+ $str .= "<tr>";
|
|
|
|
+ $str .= "<td>". $value['orderinfo']. "</td>";
|
|
|
|
+ $str .= "<td>". $value['pm']. "</td>";
|
|
|
|
+ $str .= "<td>". $value['jm']. "</td>";
|
|
|
|
+ $str .= "<td>". $value['sl']. "</td>";
|
|
|
|
+ $tmp = "";
|
|
|
|
+ foreach($value['scanout_time'] as $kk=>$vv){
|
|
|
|
+ $tmp .=$vv."<br/>";
|
|
|
|
+ }
|
|
|
|
+ $str .= trim($tmp,"<br/>");
|
|
|
|
+ $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);
|
|
}
|
|
}
|
|
}
|
|
}
|