Beispiel #1
0
        /// <summary>
        /// 修改发货仓库
        /// </summary>
        /// <param name="orderNos"></param>
        /// <param name="warehouseId"></param>
        public ActionResult SubmitModifyWarehouse(string orderNos, string warehouseId)
        {
            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.Status != (int)OrderStatus.Initial)
                    {
                        sb.AppendFormat("订单{0}不是初始状态,不能修改发货仓库<br>", orderNo);
                        continue;
                    }

                    if (entity.WarehouseId != warehouseId)
                    {
                        entity.Modify(entity.OrderId);
                        entity.WarehouseId = warehouseId;
                        bool flag = _orderBll.UpdateWarehouse(entity, OrderStatus.Initial);

                        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()));
            }
        }