Esempio n. 1
0
        /// <summary>
        /// 修改物流方式
        /// </summary>
        /// <param name="orderNos"></param>
        /// <param name="shipTypeId"></param>
        public ActionResult SubmitModifyShipType(string orderNos, string shipTypeId)
        {
            try
            {
                var      sb         = new StringBuilder();
                string[] aryOrderNo = orderNos.Split(',');
                foreach (var orderNo in aryOrderNo)
                {
                    var entity = Repositoryfactory.Repository().FindEntity("OrderNo", orderNo);
                    if (entity == null || entity.PrintStatus != (int)PrintStatus.WaitPrint)
                    {
                        sb.AppendFormat("订单{0}不是待打印状态,不能修改物流方式<br>", orderNo);
                        continue;
                    }

                    if (entity.ShipTypeId != shipTypeId)
                    {
                        entity.Modify(entity.OrderId);
                        entity.ShipTypeId = shipTypeId;
                        bool flag = _orderBll.UpdateShipType(entity);

                        if (flag)
                        {
                            sb.AppendFormat("订单{0}修改物流方式成功<br>", orderNo);
                        }
                        else
                        {
                            sb.AppendFormat("订单{0}修改物流方式失败<br>", orderNo);
                        }
                    }
                }

                WriteLog(1, orderNos, sb.ToString());
                return(Content(new JsonMessage {
                    Success = true, Code = "1", Message = sb.ToString()
                }.ToString()));
            }
            catch (Exception ex)
            {
                WriteLog(-1, orderNos, "操作失败:" + ex.Message);
                return(Content(new JsonMessage {
                    Success = false, Code = "-1", Message = "操作失败:" + ex.Message
                }.ToString()));
            }
        }