|
|
|
@ -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); |
|
|
|
} |
|
|
|
} |