|
@@ -50,6 +50,7 @@ class Systemprint extends Start_Controller {
|
|
|
$this->load->_model("Model_customsdeclaration","customsdeclaration");
|
|
|
$this->load->_model("Model_logic_ding","logic_ding");
|
|
|
$this->load->_model("Model_zxyuntu","zxyuntu");
|
|
|
+ $this->load->_model("Model_logic_order","logic_order");
|
|
|
}
|
|
|
//定义方法的调用规则 获取URI第二段值
|
|
|
public function _remap($arg,$arg_array)
|
|
@@ -61,6 +62,10 @@ class Systemprint extends Start_Controller {
|
|
|
else if($arg == 'printbyfh')
|
|
|
{
|
|
|
$this->_printbyfh();
|
|
|
+ }
|
|
|
+ else if($arg == 'getorderinfo')
|
|
|
+ {
|
|
|
+ $this->_getInfoByNumber();
|
|
|
}
|
|
|
else if($arg == 'exceldy')
|
|
|
{
|
|
@@ -2501,4 +2506,115 @@ class Systemprint extends Start_Controller {
|
|
|
|
|
|
$this->_Template('systemprint_fhd',$this->data);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 此方法是为了临时解决一下打印的问题
|
|
|
+ */
|
|
|
+ public function _getInfoByNumber(){
|
|
|
+ $param = $this->input->post(NULL, TRUE);
|
|
|
+ if(empty($param['number'])){
|
|
|
+ echo json_encode([
|
|
|
+ 'code'=>-1,
|
|
|
+ 'msg'=>"订单编码为传递",
|
|
|
+ 'data'=>[]
|
|
|
+ ],JSON_UNESCAPED_UNICODE);
|
|
|
+ die;
|
|
|
+
|
|
|
+ }
|
|
|
+ $info = $this->logic_order->getInfo("number = '".$param['number']."'");
|
|
|
+ if(empty($info)){
|
|
|
+ echo json_encode([
|
|
|
+ 'code'=>-1,
|
|
|
+ 'msg'=>"未查询到订单信息",
|
|
|
+ 'data'=>[]
|
|
|
+ ],JSON_UNESCAPED_UNICODE);
|
|
|
+ die;
|
|
|
+ }
|
|
|
+ if($info['express'] != 71){
|
|
|
+ echo json_encode([
|
|
|
+ 'code'=>-1,
|
|
|
+ 'msg'=>"快递不符合打印要求",
|
|
|
+ 'data'=>[]
|
|
|
+ ],JSON_UNESCAPED_UNICODE);
|
|
|
+ die;
|
|
|
+ }
|
|
|
+ $fullorder_name = $info['lv_platform'];
|
|
|
+ $fullorder = $this->_text($info);//获取所需信息
|
|
|
+ $this->logic_ding->sendToDing("打印快递单,订单的信息".json_encode($fullorder,JSON_UNESCAPED_UNICODE));
|
|
|
+ //美仓不需要海关报关信息,
|
|
|
+ if($fullorder['type'] != 5){
|
|
|
+ //中国发货的 目前是dhl需要海关申报编码
|
|
|
+ if(empty($fullorder['sbbm'])){
|
|
|
+ echo json_encode([
|
|
|
+ 'code'=>-1,
|
|
|
+ 'msg'=>$fullorder['number'].' 海关申报配置异常,请提交给技术处理'.$fullorder['sbbm'],
|
|
|
+ 'data'=>[]
|
|
|
+ ],JSON_UNESCAPED_UNICODE);
|
|
|
+ die;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $time = time();
|
|
|
+ $oldprinttime = ($fullorder['printtime'] > 0)?$fullorder['oldprinttime'].$fullorder['printtime'].'-':'';
|
|
|
+ $fullorder['printtime'] = date('m-d H:i',$time);//打印用时间、发货单用,不能删
|
|
|
+ $pdfnum = 1;//PDF打印几遍
|
|
|
+
|
|
|
+ if($fullorder['waybillid'] != '')
|
|
|
+ {
|
|
|
+ $del = $this->cne->get_del($fullorder['waybillid']);
|
|
|
+ }
|
|
|
+ $barcode = $this->cne->get_data($fullorder);
|
|
|
+ if($barcode['x'] == 1)
|
|
|
+ {
|
|
|
+ $bctime = date('Ymd',$time);
|
|
|
+ $Hwaybill = $barcode['waybill'];
|
|
|
+ $Hyd = $this->_pdfurl($barcode['yd'],'y-'.$Hwaybill,$bctime);
|
|
|
+ //$Hfp = $this->_pdfurl($barcode['fp'],'f-'.$Hwaybill,$bctime);//保留PDF,不需要打印
|
|
|
+ if(isset($barcode['yd']) && isset($Hwaybill))
|
|
|
+ {
|
|
|
+ if($fullorder['waybill'] != "")
|
|
|
+ {
|
|
|
+ $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $oldwaybill = $fullorder['oldwaybill'];
|
|
|
+ }
|
|
|
+ $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
|
|
|
+ $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
|
|
|
+ if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'waybillid'=>$barcode['waybillid'],'printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$info['id']))
|
|
|
+ {
|
|
|
+ $text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>100);
|
|
|
+ echo json_encode([
|
|
|
+ 'code'=>1,
|
|
|
+ 'msg'=>"ok",
|
|
|
+ 'data'=>$text
|
|
|
+ ],JSON_UNESCAPED_UNICODE);
|
|
|
+ die;
|
|
|
+ }else{
|
|
|
+ echo json_encode([
|
|
|
+ 'code'=>-1,
|
|
|
+ 'msg'=>"订单信息保存异常",
|
|
|
+ 'data'=>[]
|
|
|
+ ],JSON_UNESCAPED_UNICODE);
|
|
|
+ die;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $failed = $barcode['Description'];//错误提示
|
|
|
+ $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$info['id']);
|
|
|
+ echo json_encode([
|
|
|
+ 'code'=>-1,
|
|
|
+ 'msg'=>$failed,
|
|
|
+ 'data'=>[]
|
|
|
+ ],JSON_UNESCAPED_UNICODE);
|
|
|
+ die;
|
|
|
+ }
|
|
|
+ echo json_encode([
|
|
|
+ 'code'=>-1,
|
|
|
+ 'msg'=>"执行订单异常,请联系技术",
|
|
|
+ 'data'=>[]
|
|
|
+ ],JSON_UNESCAPED_UNICODE);
|
|
|
+ die;
|
|
|
+ }
|
|
|
}
|