|
@@ -1392,12 +1392,13 @@ class WholeController extends Curd
|
|
|
$params['submit_premises_id'] = $premises->dept_id;
|
|
|
}
|
|
|
if (isset($params['submit_goods_classify']) && $params['submit_goods_classify'] == 'MEALS'){
|
|
|
+ $table = SysDept::where('dept_id',$params['dept_table_id'])->where('dept_category','桌台')->first();
|
|
|
$orderConfigJson['premises'] = $params['dept_premises_id'];
|
|
|
$orderConfigJson['dept'] = $premises->dept_id;
|
|
|
$orderConfigJson['reach'] = "00:00";
|
|
|
- $orderConfigJson['table'] = $params['dept_table_id'] ?? null;
|
|
|
+ $orderConfigJson['table'] = !empty($table) ? $table->dept_name : null;
|
|
|
$orderConfigJson['express'] = "到店吃";
|
|
|
- $orderConfigJson['tableid'] = null;
|
|
|
+ $orderConfigJson['tableid'] = $params['dept_table_id'] ?? null;
|
|
|
|
|
|
if ($params['settlement_now'] == 'N' && !empty($params['dept_table_id'])){
|
|
|
// 桌台设为使用中
|
|
@@ -1502,14 +1503,10 @@ class WholeController extends Curd
|
|
|
Db::commit();
|
|
|
|
|
|
// 打小票
|
|
|
- dump('开始打小票');
|
|
|
if (!empty($premises)){
|
|
|
-
|
|
|
- dump('餐厅');
|
|
|
$restaurant = SysDept::where('dept_super_id',$premises->dept_id)->where('dept_category','餐厅')->first();
|
|
|
if (!empty($restaurant->dept_extend_json)){
|
|
|
$deptExtendJson = json_decode($restaurant->dept_extend_json,true);
|
|
|
- dump('deptExtendJson',$deptExtendJson);
|
|
|
if (isset($deptExtendJson['printer'])){
|
|
|
foreach($deptExtendJson['printer'] as $key => $item){
|
|
|
if (strpos($key,'结账') !== false && $params['order_status_payment'] == 'SUCCESS'){
|
|
@@ -1527,8 +1524,6 @@ class WholeController extends Curd
|
|
|
]
|
|
|
]
|
|
|
];
|
|
|
-
|
|
|
- dump('打印',$voteData);
|
|
|
http_post_json(getenv('VOTE_MENU_URL'),$voteData);
|
|
|
}else if ((strpos($key,'前台') !== false || strpos($key,'后厨') !== false) && $params['settlement_now'] == 'N'){
|
|
|
$voteData = [
|
|
@@ -1545,7 +1540,6 @@ class WholeController extends Curd
|
|
|
]
|
|
|
]
|
|
|
];
|
|
|
- dump('打印',$voteData);
|
|
|
http_post_json(getenv('VOTE_MENU_URL'),$voteData);
|
|
|
}
|
|
|
}
|
|
@@ -2669,6 +2663,54 @@ class WholeController extends Curd
|
|
|
return json_success('',['benefits'=>$benefits,'member'=>$member]);
|
|
|
}
|
|
|
|
|
|
+ public function customPrinter(Request $request)
|
|
|
+ {
|
|
|
+ $orderId = $request->post('order_id','');
|
|
|
+ $printer = $request->post('printer',[]);
|
|
|
+ $premiseName = $request->post('premise','');
|
|
|
+ if (empty($orderId) || empty($premiseName)){
|
|
|
+ return json_fail('参数异常');
|
|
|
+ }
|
|
|
+ if (empty($printer)){
|
|
|
+ return json_fail('请选择打印设备');
|
|
|
+ }
|
|
|
+ $premises = SysDept::where('dept_name',$premiseName)->where('dept_category','营业场所')->where('dept_status','ACTIVED')->first();
|
|
|
+ $order = Order::where('order_id',$orderId)->first();
|
|
|
+
|
|
|
+ try {
|
|
|
+ foreach($printer as $print){
|
|
|
+ if (strpos($print,'结账') !== false && $order->order_status_payment != 'SUCCESS'){
|
|
|
+ return json_fail('无法打印未支付的结账单');
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!empty($premises)){
|
|
|
+ $restaurant = SysDept::where('dept_super_id',$premises->dept_id)->where('dept_category','餐厅')->first();
|
|
|
+ if (!empty($restaurant->dept_extend_json)){
|
|
|
+ $deptExtendJson = json_decode($restaurant->dept_extend_json,true);
|
|
|
+ $voteData = [
|
|
|
+ 'func'=>'procActionToPrinter',
|
|
|
+ 'sign'=>'',
|
|
|
+ 'data'=>[
|
|
|
+ 'printer_premises'=>$restaurant->dept_id,
|
|
|
+ 'printer_device'=>[
|
|
|
+ $print
|
|
|
+ ],
|
|
|
+ 'printer_action'=>'ExecPrintOrder',
|
|
|
+ 'printer_data'=>[
|
|
|
+ 'order_id'=>$orderId
|
|
|
+ ]
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+ http_post_json(getenv('VOTE_MENU_URL'),$voteData);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return json_success('打印完成');
|
|
|
+ }catch(\Exception $e){
|
|
|
+ return json_fail("存在错误,票据未全部打印");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
protected function exportAfterQuery($items)
|
|
|
{
|
|
|
$data = [];
|