yangsai 4 months ago
commit 453c65bb36
  1. 2
      app/controller/api/v2/activity/UserCode.php
  2. 25
      app/controller/cashier/Order.php
  3. 3
      app/controller/cashier/Table.php
  4. 14
      app/controller/cashier/User.php
  5. 29
      app/services/order/StoreOrderServices.php
  6. 16
      crmeb/services/printer/storage/FeiEYun.php
  7. 20
      crmeb/services/printer/storage/YiLianYun.php

@ -120,6 +120,8 @@ class UserCode
$qrcodeService = app()->make(TableQrcodeServices::class); $qrcodeService = app()->make(TableQrcodeServices::class);
$is_using = $qrcodeService->value(['id' => $qrcode_id], 'is_using'); $is_using = $qrcodeService->value(['id' => $qrcode_id], 'is_using');
if (!$is_using) return app('json')->fail('桌码未启用'); if (!$is_using) return app('json')->fail('桌码未启用');
$kaibao = $qrcodeService->value(['id' => $qrcode_id], 'kaibao');
if (!$kaibao) return app('json')->fail('请先预定开包才可以扫码点餐哦');
$res = $this->services->setUserTableCode($uid, $store_id, $qrcode_id, $number); $res = $this->services->setUserTableCode($uid, $store_id, $qrcode_id, $number);
$qrcodeService->update($qrcode_id, ['is_use' => 1, 'eat_number' => $number, 'order_time' => time()]); $qrcodeService->update($qrcode_id, ['is_use' => 1, 'eat_number' => $number, 'order_time' => time()]);
return app('json')->successful('ok', ['tableId' => $res->id]); return app('json')->successful('ok', ['tableId' => $res->id]);

@ -978,22 +978,33 @@ class Order extends AuthController
$goodsinfo['table_id'] = $goodsinfo['table_id']; $goodsinfo['table_id'] = $goodsinfo['table_id'];
$randomNumber = mt_rand(100000, 999999); $randomNumber = mt_rand(100000, 999999);
$goodsinfo['code'] = $randomNumber;//取酒码 $goodsinfo['code'] = $randomNumber;//取酒码
$log = [];
$log['uid'] = $uid;
$log['type'] = 1;
$log['num'] = $goodsinfo['num'];
$log['content'] = "您的酒水【{$goodsinfo['product_name']}】×{$goodsinfo['num']}瓶存库成功";
$log['create'] = time();
$res = $StoreDrinkSaveServices->save($goodsinfo); $res = $StoreDrinkSaveServices->save($goodsinfo);
if (!$res) return app('json')->fail('存酒失败'); if (!$res) return app('json')->fail('存酒失败');
$log['pid'] = $res->id;
/** @var StoreDrinkLogServices $StoreDrinkLogServices */
$StoreDrinkLogServices = app()->make(StoreDrinkLogServices::class);
$StoreDrinkLogServices->save($log);
$print_log = ["title"=>"取酒记录",'name' => $goodsinfo['product_name'],"table_id"=>$goodsinfo['table_id'],"num"=>$goodsinfo['num'],"time"=>$goodsinfo['out_time'],"code"=>$randomNumber];
$this->services->drinkPrint($print_log);
return app('json')->success('存酒成功'); return app('json')->success('存酒成功');
} }
//取酒 //取酒
public function drinkxiugai(Request $request, StoreDrinkSaveServices $StoreDrinkSaveServices, $uid) public function drinkxiugai(Request $request, StoreDrinkSaveServices $StoreDrinkSaveServices, $uid)
{ {
[$id, $type, $num, $date, $code] = $request->postMore([ [$id, $type, $num, $date, $code,$table_id] = $request->postMore([
['id', 0], ['id', 0],
['type', 0], ['type', 0],
['num', 0], ['num', 0],
['date', 0], ['date', 0],
['code', 0] ['code', 0],
['table_id', 0],
], true); ], true);
$log = []; $log = [];
$res = []; $res = [];
@ -1046,10 +1057,16 @@ class Order extends AuthController
$log['uid'] = $uid; $log['uid'] = $uid;
$log['pid'] = $id; $log['pid'] = $id;
$log['num'] = $num;
$log['code'] = $code;
$log['table_id'] = $table_id;
$log['create'] = time(); $log['create'] = time();
/** @var StoreDrinkLogServices $StoreDrinkLogServices */ /** @var StoreDrinkLogServices $StoreDrinkLogServices */
$StoreDrinkLogServices = app()->make(StoreDrinkLogServices::class); $StoreDrinkLogServices = app()->make(StoreDrinkLogServices::class);
$StoreDrinkLogServices->save($log); $StoreDrinkLogServices->save($log);
$print_log = ["title"=>$msg,'name' => $res->product_name,"table_id"=>$table_id,"num"=>$num,"time"=>$res->out_time,"code"=>$code];
$this->services->drinkPrint($print_log);
return app('json')->success($msg); return app('json')->success($msg);
} }

@ -51,6 +51,7 @@ class Table extends AuthController
if(!empty($yuyue)){ if(!empty($yuyue)){
$v2['yingxiaojingli'] = db::name('user')->where('uid', $yuyue['admin_id'])->value('nickname') ?? '无'; $v2['yingxiaojingli'] = db::name('user')->where('uid', $yuyue['admin_id'])->value('nickname') ?? '无';
$v2['yuyueshijian'] = $yuyue['yuding_date'] . ' ' . $yuyue['come_date']; $v2['yuyueshijian'] = $yuyue['yuding_date'] . ' ' . $yuyue['come_date'];
$v2['phone'] = $yuyue['phone'];
} }
} }
} }
@ -266,7 +267,7 @@ class Table extends AuthController
$partakeService->del(['collate_code_id' => $tableId]); $partakeService->del(['collate_code_id' => $tableId]);
/** @var TableQrcodeServices $qrcodeService */ /** @var TableQrcodeServices $qrcodeService */
$qrcodeService = app()->make(TableQrcodeServices::class); $qrcodeService = app()->make(TableQrcodeServices::class);
$qrcodeService->update($qrcodeId, ['is_use' => 0, 'eat_number' => 0, 'order_time' => 0]); $qrcodeService->update($qrcodeId, ['is_use' => 0, 'eat_number' => 0, 'order_time' => 0,'kaibao'=>0]);
if ($oid) { if ($oid) {
/** @var StoreOrderServices $orderService */ /** @var StoreOrderServices $orderService */
$orderService = app()->make(StoreOrderServices::class); $orderService = app()->make(StoreOrderServices::class);

@ -340,7 +340,8 @@ class User extends AuthController
//wmc api1 //wmc api1
//预定 //预定
$wtable_id = $request->post('wtable_id', 0); $wtable_id = $request->post('wtable_id', 0);
if (!empty($wtable_id)) { $kaibao = $request->post('kaibao', 0);
if (!empty($wtable_id&&empty($kaibao))) {
$ttttt = Db::name('table_qrcode')->where('id',$wtable_id)->where('is_use',0)->find(); $ttttt = Db::name('table_qrcode')->where('id',$wtable_id)->where('is_use',0)->find();
if(!$ttttt){ if(!$ttttt){
@ -364,6 +365,17 @@ class User extends AuthController
} }
return $this->fail('预定失败'); return $this->fail('预定失败');
}else if($kaibao){
if($kaibao==1){
if(Db::name('table_qrcode')->update(['id' => $wtable_id, 'kaibao' => 1,'is_use'=>2])){
return $this->success('开台成功');
}
}else if($kaibao==2){
if(Db::name('table_qrcode')->update(['id' => $wtable_id, 'kaibao' => 0,'is_use'=>0])){
return $this->success('清台成功');
}
}
return $this->fail('操作失败');
} }

@ -1747,7 +1747,34 @@ HTML;
} }
return true; return true;
} }
public function drinkPrint($printdata){
$type = 1;
$relation_id = 1;
$print_event = 2;
/** @var ConfigServices $configServices */
$configServices = app()->make(ConfigServices::class);
/** @var $systemPrinterServices */
$systemPrinterServices = app()->make(SystemPrinterServices::class);
$printerList = $systemPrinterServices->getValidPrinter($type, $relation_id, $print_event,'id,name,print_num,plat_type');
if ($printerList) {//存在设置有效打印机
foreach ($printerList as $print) {
[$switch, $name, $configData] = $configServices->getPrintingConfig($type, $relation_id, (int)$print['id'], (int)$print['plat_type']);
$name = $configServices->getPrinterType((int)$print['plat_type']);
foreach ($configData as $value) {
if (!$value) {
throw new ValidateException('请先配置小票打印开发者');
}
}
$configData['print_num'] = $print['print_num'];
$printer = new Printer($name, $configData);
$printer->setdrinkPrintContent([
'name' => $printdata['title'],
'drinkdata' => $printdata
])->startPrinter();
}
}
}
/** /**
* 获取订单确认数据 * 获取订单确认数据
* @param array $user * @param array $user

@ -289,7 +289,23 @@ class FeiEYun extends BasePrinter
$this->printerContent .= '商品金额:' . $sumPrice . '元<BR>'; $this->printerContent .= '商品金额:' . $sumPrice . '元<BR>';
return $this; return $this;
} }
public function setdrinkPrintContent(array $config): self
{
$timeYmd = date('Y-m-d', time());
$timeHis = date('H:i:s', time());
$orderInfo = $config['drinkdata'];
$this->printerContent = '<CB>**' . $config['name'] . '**</CB><BR>';
$this->printerContent .= '--------------------------------<BR>';
$this->printerContent .= '取 酒 码:' . $orderInfo['code'] . '<BR>';
$this->printerContent .= '桌 台 号:' . $orderInfo['table_id'] . '<BR>';
$this->printerContent .= '酒品名称:' . $orderInfo['name'] . '<BR>';
$this->printerContent .= '酒水数量:' . $orderInfo['num'] . '<BR>';
$this->printerContent .= '到期时间:' . $orderInfo['time'] . '<BR>';
$this->printerContent .= '日 期: ' . $timeYmd . '<BR>';
$this->printerContent .= '时 间: ' . $timeHis . '<BR>';
return $this;
}
/** /**
* 积分商城打印内容 * 积分商城打印内容
* @param array $config * @param array $config

@ -239,6 +239,26 @@ CONTENT;
<right>合计:{$orderInfo['total_price']}积分</right> <right>合计:{$orderInfo['total_price']}积分</right>
</FH> </FH>
<FS><center> ** 完 **</center></FS> <FS><center> ** 完 **</center></FS>
CONTENT;
return $this;
}
public function setdrinkPrintContent(array $config): self
{
$timeYmd = date('Y-m-d', time());
$timeHis = date('H:i:s', time());
$orderInfo = $config['drinkdata'];
$this->printerContent = <<<CONTENT
<FB><center> ** {$config['name']} **</center></FB>
<FH2><FW2>----------------</FW2></FH2>
取 酒 码:{$orderInfo['code']}\r
桌 台 号: {$orderInfo['table_id'] } \r
酒品名称: {$orderInfo['name']}\r
酒水数量: {$orderInfo['num']}\r
到期时间: {$orderInfo['time']}\r
日 期: {$timeYmd}\r
时 间: {$timeHis}\r
<FS><center> ** 完 **</center></FS>
CONTENT; CONTENT;
return $this; return $this;
} }

Loading…
Cancel
Save