Browse Source

打印,需调用hyperf打印api

master
lanzu_qsy 6 years ago
parent
commit
319b09ac4e
  1. 39
      app/Admin/Extensions/OrderPrint.php
  2. 14
      app/Models/Feprint.php

39
app/Admin/Extensions/OrderPrint.php

@ -4,6 +4,8 @@
namespace App\Admin\Extensions;
use App\Models\Feprint;
use App\Models\ImsCjdcOrderMain;
use Dcat\Admin\Grid\RowAction;
use Illuminate\Http\Request;
@ -19,6 +21,7 @@ class OrderPrint extends RowAction
public function handle(Request $request)
{
$id = $this->getKey();
$this->doPrint();
dd($id);
}
@ -31,4 +34,40 @@ class OrderPrint extends RowAction
{
}
public function doPrint()
{
$oid = $this->getKey();
$row = ImsCjdcOrderMain::find($oid);
//>>1.获取打印机状态
$result = $this->getPrintStatus($row->market_id);
//>>2.调用打印
if ($result==1){
$this->feiErPrint($row->order_num);
}
//>>3.记录打印次数
}
/**
* @param $oid //主订单ID
* @return int
*/
public function getPrintStatus($mid)
{
$fe = Feprint::where('market_id',$mid)->first();
if ($fe){
return $fe->status;
}else{
return -1;
}
}
public function feiErPrint($order_num)
{
include_once app_path('Libs\feier_print\api_php_demo.php');
$result = json_decode(FeiePrint($order_num));
dd($result);
}
}

14
app/Models/Feprint.php

@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class Feprint extends Model
{
use HasDateTimeFormatter;
protected $table = 'ims_cjdc_feprint';
}
Loading…
Cancel
Save