/// <summary>
        /// 保存批量打印历史
        /// </summary>
        /// <param name="orderNos"></param>
        /// <param name="templateId"></param>
        /// <returns></returns>
        public ActionResult SavePrintBatch(string orderNos, string templateId)
        {
            List <string> hasPrintedOrderNos = _orderBll.CheckOrderPrintStatus(orderNos);

            if (hasPrintedOrderNos != null && hasPrintedOrderNos.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                foreach (var orderNo in hasPrintedOrderNos)
                {
                    sb.Append(orderNo + ",");
                }
                return(Content(new JsonMessage {
                    Success = false, Code = "-1", Message = "[操作失败]以下订单不是待打印状态:" + sb.ToString()
                }.ToString()));
            }

            IDatabase     database    = DataFactory.Database();
            DbTransaction isOpenTrans = database.BeginTrans();

            try
            {
                var aryOrderNo         = orderNos.Split(',');
                PrintBatchEntity batch = new PrintBatchEntity();
                batch.Create();
                batch.PrintTime = DateTime.Now;
                batch.ItemCount = 0;

                foreach (string orderNo in aryOrderNo)
                {
                    if (!string.IsNullOrEmpty(orderNo))
                    {
                        bool flag = _orderBll.UpdateIsPrinting(orderNo, isOpenTrans);
                        if (flag)
                        {
                            PrintBatchItemEntity batchItem = new PrintBatchItemEntity();
                            batchItem.Create();
                            batchItem.BatchId = batch.BatchId;
                            batchItem.OrderNo = orderNo;
                            batch.ItemCount   = batch.ItemCount + 1;
                            database.Insert(batchItem, isOpenTrans);
                        }
                        else
                        {
                            throw new Exception(string.Format("订单{0}更新打印状态失败", orderNo));
                        }
                    }
                }
                database.Insert(batch);

                database.Commit();
                return(Content(new JsonMessage {
                    Success = true, Code = "1", Message = "更新成功"
                }.ToString()));
            }
            catch (Exception ex)
            {
                database.Rollback();
                return(Content(new JsonMessage {
                    Success = false, Code = "-1", Message = "操作失败:" + ex.Message
                }.ToString()));
            }
        }