本文整理汇总了PHP中Printer::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Printer::model方法的具体用法?PHP Printer::model怎么用?PHP Printer::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Printer
的用法示例。
在下文中一共展示了Printer::model方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionUpdate
public function actionUpdate(){
$id = Yii::app()->request->getParam('id');
$model = Printer::model()->findByPk($id);
if(Yii::app()->request->isPostRequest) {
$model->attributes = Yii::app()->request->getPost('Printer');
if($model->save()){
Yii::app()->user->setFlash('success' , '修改成功');
$this->redirect(array('printer/index' , 'companyId' => $this->companyId));
}
}
$this->render('update' , array(
'model'=>$model,
));
}
示例2: getPrinters
private function getPrinters()
{
$printers = Printer::model()->findAll('dpid=:companyId and delete_flag=0', array(':companyId' => $this->companyId));
$printers = $printers ? $printers : array();
return CHtml::listData($printers, 'lid', 'name');
}
示例3: getPrinterList
private function getPrinterList(){
$printers = Printer::model()->findAll('company_id=:companyId',array(':companyId'=>$this->companyId)) ;
return CHtml::listData($printers, 'printer_id', 'name');
}
示例4: printKitchenOther
public static function printKitchenOther(Order $order, $orderProducts, Site $site, SiteNo $siteNo, $reprint, $memo)
{
$printers_a = array();
$orderproducts_a = array();
$printer2orderproducts_a = array();
$jobids = array();
$printercontent_a = array();
//return array('status'=>false,'dpid'=>$order->dpid,'allnum'=>"0",'type'=>'none','msg'=>yii::t('app','没有要打印的菜品!'));
//return array('status'=>true,'dpid'=>$order->dpid,'allnum'=>"0",'type'=>'none','msg'=>"dddd");
//$orderProductTastes = OrderTaste::model()->with('taste')->findAll('t.order_id=:orderid and t.dpid=:dpid and t.is_order=0', array(':orderid'=>$orderProduct->lid,':dpid'=>$orderProduct->dpid));
//$orderProductTasteEx = $orderProduct->taste_memo;
//var_dump($orderProductTasteEx);exit;
//$site = Site::model()->find('lid=:lid and dpid=:dpid', array(':lid'=>$order->site_id,':dpid'=>$order->dpid));
//$siteType = SiteType::model()->find('lid=:lid and dpid=:dpid', array(':lid'=>$site->type_id,':dpid'=>$order->dpid));
//var_dump($site->floor_id,$orderProduct->product->printer_way_id);exit;
$floor_id = '0';
if ($order->is_temp == '0') {
$floor_id = $site->floor_id;
}
//return array('status'=>false,'dpid'=>$order->dpid,'allnum'=>"0",'type'=>'none','msg'=>yii::t('app','没有要打印的菜品!'));
// $orderProducts = OrderProduct::model()->with('product')->findAll('t.order_id=:id and t.dpid=:dpid and t.is_print=0 and t.delete_flag=0' , array(':id'=>$order->lid,':dpid'=>$order->dpid));
if (empty($orderProducts)) {
return array('status' => false, 'dpid' => $order->dpid, 'allnum' => "0", 'type' => 'none', 'msg' => yii::t('app', '没有要打印的菜品!'));
}
//foreach printer_way //传菜厨打、整单厨打、配菜和制作厨打
$printerways = PrinterWay::model()->findAll(" dpid = :dpid and delete_flag=0", array(':dpid' => $order->dpid));
if (empty($printerways)) {
return array('status' => false, 'dpid' => $order->dpid, 'allnum' => "0", 'type' => 'none', 'msg' => "没有打印方案" . $order->dpid);
}
//var_dump($printerways);exit;
foreach ($printerways as $printerway) {
$printer2orderproducts_a = array();
foreach ($orderProducts as $orderProduct) {
$orderproducts_a[$orderProduct->lid] = $orderProduct;
$productprinterwaynow = ProductPrinterway::model()->find("dpid=:dpid and printer_way_id=:pwi and product_id=:pid", array(':dpid' => $order->dpid, ':pwi' => $printerway->lid, ':pid' => $orderProduct->product_id));
//var_dump($printerway->lid,$productprinterwaynow);exit;
if (!empty($productprinterwaynow)) {
//不是每个产品都对应所有打印方案
// return array('status'=>false,'dpid'=>$order->dpid,'allnum'=>"0",'type'=>'none','msg'=>"部分产品没有设置打印方案");
// }else{
$printwaydetails = PrinterWayDetail::model()->findAll('floor_id=:floorid and print_way_id=:pwi and dpid=:dpid and delete_flag=0', array(':floorid' => $floor_id, ':pwi' => $printerway->lid, ':dpid' => $order->dpid));
foreach ($printwaydetails as $printway) {
$printer = Printer::model()->find('lid=:printerId and dpid=:dpid', array(':printerId' => $printway->printer_id, ':dpid' => $order->dpid));
if (empty($printer)) {
return array('status' => false, 'dpid' => $printer->dpid, 'allnum' => "0", 'type' => 'none', 'msg' => yii::t('app', '打印方案没有设置厨房打印机'));
}
if (!array_key_exists($printer->lid, $printers_a)) {
$printers_a[$printer->lid] = $printer;
//add isonpaper listno
}
if (array_key_exists($printer->lid, $printer2orderproducts_a)) {
array_push($printer2orderproducts_a[$printer->lid], $orderProduct->lid);
} else {
$printer2orderproducts_a[$printer->lid] = array($orderProduct->lid);
}
if ($printer->printer_type != '0') {
return array('status' => false, 'dpid' => $printer->dpid, 'allnum' => "0", 'type' => 'none', 'msg' => yii::t('app', '厨打打印机必须是网络打印机'));
}
}
}
}
//return array('status'=>false,'dpid'=>$order->dpid,'allnum'=>"0",'type'=>'none','msg'=>"测试3");
//如果是整体,
// if(empty($printer2orderproducts_a))
// {
// return array('status'=>false,'dpid'=>$order->dpid,'allnum'=>"0",'type'=>'none','msg'=>"没有找到打印机和产品关系");
// }
if ($printerway->is_onepaper == "1") {
foreach ($printer2orderproducts_a as $key => $values) {
//return array('status'=>false,'dpid'=>$order->dpid,'allnum'=>"0",'type'=>'none','msg'=>"测试5");
$printer = $printers_a[$key];
$productids = "";
//$listData = array("22".Helper::getPlaceholderLenBoth($order->company->company_name, 16));//
$listData = array("22" . Helper::setPrinterTitle($order->company->company_name, 8));
array_push($listData, "br");
//array_push($listData,"22"."+++总单+++");
array_push($listData, "22" . "整单<" . $printerway->name . ">");
array_push($listData, "br");
array_push($listData, "22" . "<" . $memo);
array_push($listData, "00");
array_push($listData, "br");
//return array('status'=>false,'dpid'=>$order->dpid,'allnum'=>"0",'type'=>'none','msg'=>"zheng-memo:".$memo);
$strSite = "";
if ($order->is_temp == '1') {
array_push($listData, "00" . yii::t('app', '临时座:'));
array_push($listData, "11" . $siteNo->site_id % 1000);
} else {
array_push($listData, "00" . yii::t('app', '座号:'));
array_push($listData, "11" . $site->siteType->name . ' ' . $site->serial);
}
array_push($listData, "00" . yii::t('app', '人数:') . $order->number);
array_push($listData, "br");
//return array('status'=>true,'dpid'=>$order->dpid,'allnum'=>"0",'type'=>'none','msg'=>"测试1");
array_push($listData, "00" . str_pad('', 48, '-'));
$productids = "";
//return array('status'=>false,'dpid'=>$order->dpid,'allnum'=>"0",'type'=>'none','msg'=>"测试3");
foreach ($values as $value) {
//return array('status'=>false,'dpid'=>$order->dpid,'allnum'=>"0",'type'=>'none','msg'=>"测试3");
if (empty($productids)) {
$productids .= $value;
//.........这里部分代码省略.........
示例5: loadModel
/**
* Returns the data model based on the primary key given in the GET variable.
* If the data model is not found, an HTTP exception will be raised.
* @param integer $id the ID of the model to be loaded
* @return Printer the loaded model
* @throws CHttpException
*/
public function loadModel($id)
{
$model = Printer::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}