Esempio n. 1
0
 public ActionResult DeleteCompany(string keyValue)
 {
     try
     {
         var message         = "删除失败。";
         int isOk            = 0;
         int departmentCount = DataFactory.Database().FindCount <BaseDepartment>("CompanyId", keyValue);
         if (departmentCount == 0)
         {
             isOk = Repositoryfactory.Repository().Delete(keyValue);
             if (isOk > 0)
             {
                 message = "删除成功。";
             }
         }
         else
         {
             message = "公司内有部门,不能删除。";
         }
         WriteLog(isOk, keyValue, message);
         return(Content(new JsonMessage {
             Success = true, Code = isOk.ToString(), Message = message
         }.ToString()));
     }
     catch (Exception ex)
     {
         WriteLog(-1, keyValue, "操作失败:" + ex.Message);
         return(Content(new JsonMessage {
             Success = false, Code = "-1", Message = "操作失败:" + ex.Message
         }.ToString()));
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 修改密码
 /// </summary>
 /// <param name="KeyValue">主键</param>
 /// <param name="Password">新密码</param>
 /// <returns></returns>
 public ActionResult ResetPasswordSubmit(string KeyValue, string Password)
 {
     try
     {
         int       IsOk      = 0;
         Base_User base_user = new Base_User();
         base_user.UserId         = KeyValue;
         base_user.ModifyDate     = DateTime.Now;
         base_user.ModifyUserId   = ManageProvider.Provider.Current().UserId;
         base_user.ModifyUserName = ManageProvider.Provider.Current().UserName;
         base_user.Secretkey      = Md5Helper.Md5(CommonHelper.CreateNo(), 16).ToLower();
         base_user.Password       = Md5Helper.Md5(DESEncrypt.Encrypt(Password, base_user.Secretkey).ToLower(), 32).ToLower();
         IsOk = Repositoryfactory.Repository().Update(base_user);
         BaseSysLogBll.Instance.WriteLog(KeyValue, OperationType.Update, IsOk.ToString(), "修改密码");
         return(Content(new JsonMessage {
             Success = true, Code = IsOk.ToString(), Message = "密码修改成功。"
         }.ToString()));
     }
     catch (Exception ex)
     {
         BaseSysLogBll.Instance.WriteLog(KeyValue, OperationType.Update, "-1", "密码修改失败:" + ex.Message);
         return(Content(new JsonMessage {
             Success = false, Code = "-1", Message = "密码修改失败:" + ex.Message
         }.ToString()));
     }
 }
 public ActionResult DeleteMall(string KeyValue)
 {
     try
     {
         var Message   = "删除失败。";
         int IsOk      = 0;
         int UserCount = DataFactory.Database().FindCount <SaleOrderEntity>("MerchantMallId", KeyValue);
         if (UserCount == 0)
         {
             IsOk = Repositoryfactory.Repository().Delete(KeyValue);
             if (IsOk > 0)
             {
                 Message = "删除成功。";
             }
         }
         else
         {
             Message = "该店铺下已有订单,不能删除。";
         }
         WriteLog(IsOk, KeyValue, Message);
         return(Content(new JsonMessage {
             Success = true, Code = IsOk.ToString(), Message = Message
         }.ToString()));
     }
     catch (Exception ex)
     {
         WriteLog(-1, KeyValue, "操作失败:" + ex.Message);
         return(Content(new JsonMessage {
             Success = false, Code = "-1", Message = "操作失败:" + ex.Message
         }.ToString()));
     }
 }
Esempio n. 4
0
 public ActionResult DeleteDepartment(string KeyValue)
 {
     try
     {
         var Message   = "删除失败。";
         int IsOk      = 0;
         int UserCount = DataFactory.Database().FindCount <Base_User>("DepartmentId", KeyValue);
         if (UserCount == 0)
         {
             IsOk = Repositoryfactory.Repository().Delete(KeyValue);
             if (IsOk > 0)
             {
                 Message = "删除成功。";
             }
         }
         else
         {
             Message = "部门内有用户,不能删除。";
         }
         WriteLog(IsOk, KeyValue, Message);
         return(Content(new JsonMessage {
             Success = true, Code = IsOk.ToString(), Message = Message
         }.ToString()));
     }
     catch (Exception ex)
     {
         WriteLog(-1, KeyValue, "操作失败:" + ex.Message);
         return(Content(new JsonMessage {
             Success = false, Code = "-1", Message = "操作失败:" + ex.Message
         }.ToString()));
     }
 }
 public ActionResult DeleteZone(string keyValue)
 {
     try
     {
         var message   = "删除失败。";
         int isOk      = 0;
         int userCount = 0;
         // int UserCount = DataFactory.Database().FindCount<WarehouseAreaEntity>("CategoryId", KeyValue);
         if (userCount == 0)
         {
             isOk = Repositoryfactory.Repository().Delete(keyValue);
             if (isOk > 0)
             {
                 message = "删除成功。";
             }
         }
         else
         {
             //  Message = "该分类内有商品,不能删除。";
         }
         WriteLog(isOk, keyValue, message);
         return(Content(new JsonMessage {
             Success = true, Code = isOk.ToString(), Message = message
         }.ToString()));
     }
     catch (Exception ex)
     {
         WriteLog(-1, keyValue, "操作失败:" + ex.Message);
         return(Content(new JsonMessage {
             Success = false, Code = "-1", Message = "操作失败:" + ex.Message
         }.ToString()));
     }
 }
 public ActionResult DeleteCategory(string keyValue)
 {
     try
     {
         var Message      = "删除失败。";
         int IsOk         = 0;
         int productCount = DataFactory.Database().FindCount <ProductEntity>("CategoryId", keyValue);
         if (productCount == 0)
         {
             IsOk = Repositoryfactory.Repository().Delete(keyValue);
             if (IsOk > 0)
             {
                 Message = "删除成功。";
             }
         }
         else
         {
             Message = "该分类内有商品,不能删除。";
         }
         WriteLog(IsOk, keyValue, Message);
         return(Content(new JsonMessage {
             Success = true, Code = IsOk.ToString(), Message = Message
         }.ToString()));
     }
     catch (Exception ex)
     {
         WriteLog(-1, keyValue, "操作失败:" + ex.Message);
         return(Content(new JsonMessage {
             Success = false, Code = "-1", Message = "操作失败:" + ex.Message
         }.ToString()));
     }
 }
Esempio n. 7
0
        /// <summary>
        /// 作废
        /// </summary>
        /// <param name="KeyValue"></param>
        /// <returns></returns>
        public ActionResult Invalid(string KeyValue)
        {
            try
            {
                var Message = "审核失败。";
                int IsOk    = 0;

                var entity = Repositoryfactory.Repository().FindEntity("OrderId", KeyValue);
                if (entity == null || entity.Status != 0)
                {
                    throw new Exception("该采购单不是初始状态,不能作废");
                }

                entity.Modify(KeyValue);
                IsOk = orderBLL.Invalid(entity);
                if (IsOk > 0)
                {
                    Message = "作废成功。";
                }
                WriteLog(IsOk, KeyValue, Message);
                return(Content(new JsonMessage {
                    Success = true, Code = IsOk.ToString(), Message = Message
                }.ToString()));
            }
            catch (Exception ex)
            {
                WriteLog(-1, KeyValue, "操作失败:" + ex.Message);
                return(Content(new JsonMessage {
                    Success = false, Code = "-1", Message = "操作失败:" + ex.Message
                }.ToString()));
            }
        }
Esempio n. 8
0
        public ActionResult SetFormControl(string KeyValue)
        {
            Base_Module entity   = Repositoryfactory.Repository().FindEntity(KeyValue);
            string      JsonData = entity.ToJson();

            JsonData = JsonData.Insert(1, "\"ParentName\":\"" + base_modulebll.Repository().FindEntity(entity.ParentId).FullName + "\",");
            return(Content(JsonData));
        }
Esempio n. 9
0
        public ActionResult SetFormControl(string keyValue)
        {
            BaseButton entity   = Repositoryfactory.Repository().FindEntity(keyValue);
            string     jsonData = entity.ToJson();

            jsonData = jsonData.Insert(1, "\"ParentName\":\"" + Repositoryfactory.Repository().FindEntity(entity.ParentId).FullName + "\",");
            return(Content(jsonData));
        }
Esempio n. 10
0
        public virtual ActionResult SetCompanyForm(string keyValue)
        {
            BaseCompany entity  = Repositoryfactory.Repository().FindEntity(keyValue);
            string      strJson = Util.Json.ToJson(entity);

            //自定义
            strJson = strJson.Insert(1, BaseFormAttributeBll.Instance.GetBuildForm(keyValue));
            return(Content(strJson));
        }
Esempio n. 11
0
        public ActionResult SetShipVendorForm(string KeyValue)
        {
            ShipVendorEntity entity  = Repositoryfactory.Repository().FindEntity(KeyValue);
            string           strJson = entity.ToJson();

            //自定义
            strJson = strJson.Insert(1, Base_FormAttributeBll.Instance.GetBuildForm(KeyValue));
            return(Content(strJson));
        }
Esempio n. 12
0
        /// <summary>
        /// 订单挂起
        /// </summary>
        /// <param name="orderNos"></param>
        /// <returns></returns>
        public ActionResult SuspendOrder(string orderNos)
        {
            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.Canceled)
                    {
                        sb.AppendFormat("订单{0}已作废,不能挂起<br>", orderNo);
                        continue;
                    }

                    if (entity.Status == (int)OrderStatus.OutStock)
                    {
                        sb.AppendFormat("订单{0}已出库,不能挂起<br>", orderNo);
                        continue;
                    }

                    if (entity.IsSuspended)
                    {
                        sb.AppendFormat("订单{0}已挂起,不能重复操作<br>", orderNo);
                        continue;
                    }

                    entity.Modify(entity.OrderId);
                    entity.IsSuspended = true;
                    bool flag = _orderBll.SuspendOrder(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()));
            }
        }
Esempio n. 13
0
        /// <summary>
        /// 取消收货
        /// </summary>
        /// <param name="receiptIds"></param>
        /// <returns></returns>
        public ActionResult UnReceiptReceive(string receiptIds)
        {
            try
            {
                var      sb           = new StringBuilder();
                string[] aryReceiptId = receiptIds.Split(',');
                foreach (var receiptId in aryReceiptId)
                {
                    var entity = Repositoryfactory.Repository().FindEntity("ReceiptId", receiptId);
                    if (entity == null)
                    {
                        sb.AppendFormat("收货单{0}不存在<br>", receiptId);
                        continue;
                    }

                    if (entity.Status != (int)ReceiptStatus.Received)
                    {
                        sb.AppendFormat("收货单{0}不是已收货状态,不能取消收货<br>", entity.ReceiptNo);
                        continue;
                    }

                    if (entity.IsLocked)
                    {
                        sb.AppendFormat("收货单{0}已锁定,不能取消收货<br>", entity.ReceiptNo);
                        continue;
                    }

                    bool flag = _receiptService.UnReceiptReceive(entity);
                    if (flag)
                    {
                        sb.AppendFormat("收货单{0}取消收货成功<br>", entity.ReceiptNo);
                    }
                    else
                    {
                        sb.AppendFormat("收货单{0}取消收货失败<br>", entity.ReceiptNo);
                    }
                }

                WriteLog(1, receiptIds, sb.ToString());
                return(Content(new JsonMessage {
                    Success = true, Code = "1", Message = sb.ToString()
                }.ToString()));
            }
            catch (Exception ex)
            {
                WriteLog(-1, receiptIds, "操作失败:" + ex.Message);
                return(Content(new JsonMessage {
                    Success = false, Code = "-1", Message = "操作失败:" + ex.Message
                }.ToString()));
            }
        }
Esempio n. 14
0
        /// <summary>
        /// 解锁订单
        /// </summary>
        /// <param name="orderNos"></param>
        /// <returns></returns>
        public ActionResult UnLockByUserId(string orderNos)
        {
            try
            {
                var      userId     = ManageProvider.Provider.Current().UserId;
                var      sb         = new StringBuilder();
                string[] aryOrderNo = orderNos.Split(',');

                foreach (var orderNo in aryOrderNo)
                {
                    var entity = Repositoryfactory.Repository().FindEntity("OrderNo", orderNo);
                    if (string.IsNullOrWhiteSpace(entity.LockUserId))
                    {
                        sb.AppendFormat("<font color='blue'>订单{0}不需要解锁</font><br>", orderNo);
                    }
                    else
                    {
                        if (entity.LockUserId != userId)
                        {
                            sb.AppendFormat("<font color='red'>订单{0}无权限解锁,锁单人是{1}</font><br>", orderNo, entity.LockUserName);
                        }
                        else
                        {
                            bool flag = _orderBll.UpdateUnLockUserIdByOrderNo(orderNo, null);
                            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()));
            }
        }
Esempio n. 15
0
        /// <summary>
        /// 表单页面
        /// </summary>
        /// <returns></returns>
        public override ActionResult Form()
        {
            string KeyValue = Request["KeyValue"];//主键

            if (!string.IsNullOrEmpty(KeyValue))
            {
                Base_CodeRule entity = Repositoryfactory.Repository().FindEntity(KeyValue);
                var           module = DataFactory.Database().FindEntity <Base_Module>(entity.ModuleId);
                if (module != null)
                {
                    ViewBag.ModuleName = module.FullName;
                }
            }
            return(View());
        }
Esempio n. 16
0
        /// <summary>
        /// 锁定收货单
        /// </summary>
        /// <param name="receiptIds"></param>
        /// <returns></returns>
        public ActionResult LockReceipt(string receiptIds)
        {
            try
            {
                var      sb         = new StringBuilder();
                string[] aryReceipt = receiptIds.Split(',');
                foreach (var receiptId in aryReceipt)
                {
                    var entity = Repositoryfactory.Repository().FindEntity("ReceiptId", receiptId);
                    if (entity == null || entity.Status == -1)
                    {
                        sb.AppendFormat("收货单{0}已作废,不能锁定<br>", receiptId);
                        continue;
                    }

                    if (entity.IsLocked)
                    {
                        sb.AppendFormat("收货单{0}已锁定,不能重复操作<br>", entity.ReceiptNo);
                        continue;
                    }

                    entity.Modify(entity.ReceiptId);
                    entity.IsLocked = true;
                    bool flag = _receiptBll.UpdateLockedStatus(entity);
                    if (flag)
                    {
                        sb.AppendFormat("收货单{0}锁定成功<br>", entity.ReceiptNo);
                    }
                    else
                    {
                        sb.AppendFormat("收货单{0}更新锁定状态失败<br>", entity.ReceiptNo);
                    }
                }

                WriteLog(1, receiptIds, sb.ToString());
                return(Content(new JsonMessage {
                    Success = true, Code = "1", Message = sb.ToString()
                }.ToString()));
            }
            catch (Exception ex)
            {
                WriteLog(-1, receiptIds, "操作失败:" + ex.Message);
                return(Content(new JsonMessage {
                    Success = false, Code = "-1", Message = "操作失败:" + ex.Message
                }.ToString()));
            }
        }
Esempio n. 17
0
        public ActionResult SetFormControl(string KeyValue)
        {
            Base_Button entity   = Repositoryfactory.Repository().FindEntity(KeyValue);
            string      JsonData = entity.ToJson();

            if (entity.ParentId != "0")
            {
                var parentEntity = Repositoryfactory.Repository().FindEntity(entity.ParentId);
                if (parentEntity != null)
                {
                    JsonData = JsonData.Insert(1, "\"ParentName\":\"" + parentEntity.FullName + "\",");
                    return(Content(JsonData));
                }
            }
            JsonData = JsonData.Insert(1, "\"ParentName\":\"\",");
            return(Content(JsonData));
        }
Esempio n. 18
0
        public ActionResult CheckMergeOrderNo(string orderIds)
        {
            try
            {
                var      sb         = new StringBuilder();
                string[] aryOrderId = orderIds.Split(',');
                List <SaleOrderEntity> orderList = new List <SaleOrderEntity>();

                foreach (var orderId in aryOrderId)
                {
                    var entity = Repositoryfactory.Repository().FindEntity("OrderId", orderId);

                    if (entity != null && entity.Status != (int)OrderStatus.OutOfStock &&
                        entity.Status != (int)OrderStatus.Initial &&
                        entity.Status != (int)OrderStatus.WaitAudit)
                    {
                        return(Content(new JsonMessage {
                            Success = false, Code = "-1", Message = "操作失败:只有初始或缺货或待审核订单才能合并订单"
                        }.ToString()));
                    }
                    orderList.Add(entity);
                }

                //判断是否一致,不一致则不通过
                var group = orderList.GroupBy(i => new { Province = i.Province, City = i.City, County = i.County, ReceiveAddress = i.ReceiveAddress, ReceiveContact = i.ReceiveContact, ReceiveCellPhone = i.ReceiveCellPhone, ReceivePhone = i.ReceivePhone });
                if (group.Count() > 1)
                {
                    return(Content(new JsonMessage {
                        Success = false, Code = "-1", Message = "操作失败:不符合订单合并条件( 省/市/区/地址/手机/电话/联系人相同)"
                    }.ToString()));
                }

                WriteLog(1, orderIds, sb.ToString());
                return(Content(new JsonMessage {
                    Success = true, Code = "1", Message = sb.ToString()
                }.ToString()));
            }
            catch (Exception ex)
            {
                WriteLog(-1, orderIds, "操作失败:" + ex.Message);
                return(Content(new JsonMessage {
                    Success = false, Code = "-1", Message = "操作失败:" + ex.Message
                }.ToString()));
            }
        }
Esempio n. 19
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()));
            }
        }
        /// <summary>
        /// 设置仓库默认收货储位
        /// </summary>
        /// <param name="warehouseId"></param>
        /// <param name="locationId"></param>
        public ActionResult SubmitSetLocation(string warehouseId, string locationId)
        {
            try
            {
                var entity = Repositoryfactory.Repository().FindEntity("warehouseId", warehouseId);
                if (entity == null)
                {
                    throw new Exception("仓库信息不存在");
                }

                var location = _warehouseLocationBLL.GetLocation(warehouseId, locationId);
                if (location == null || location.IsEnable != (int)YesNoStatus.Yes)
                {
                    throw new Exception("储位信息无效");
                }

                entity.Modify(entity.WarehouseId);
                entity.ReceiptLocationId = location.LocationId;
                bool flag = _warehouseBLL.UpdateReceiptLocationId(entity);

                if (!flag)
                {
                    throw new Exception("设置默认收货储位失败");
                }

                WriteLog(1, warehouseId, "设置默认收货储位成功");
                return(Content(new JsonMessage {
                    Success = true, Code = "1", Message = "设置默认收货储位成功"
                }.ToString()));
            }
            catch (Exception ex)
            {
                WriteLog(-1, warehouseId, "操作失败:" + ex.Message);
                return(Content(new JsonMessage {
                    Success = false, Code = "-1", Message = "操作失败:" + ex.Message
                }.ToString()));
            }
        }
Esempio n. 21
0
 public ActionResult SetMergeOrder(string KeyValue)
 {
     try
     {
         string[]        aryOrderId     = KeyValue.Split(',');
         List <string>   sourceOrderNos = new List <string>();
         SaleOrderEntity entity         = null;
         foreach (var orderId in aryOrderId)
         {
             if (entity == null)
             {
                 entity         = Repositoryfactory.Repository().FindEntity("OrderId", orderId);
                 sourceOrderNos = entity.SourceOrderNo.Split(',').ToList();
             }
             else
             {
                 var otherentity = Repositoryfactory.Repository().FindEntity("OrderId", orderId);
                 entity.OrderNo += "," + otherentity.OrderNo;
                 var otherSourceOrderNos = otherentity.SourceOrderNo.Split(',').ToList();
                 foreach (var item in otherSourceOrderNos)
                 {
                     if (!sourceOrderNos.Contains(item))
                     {
                         sourceOrderNos.Add(item);
                     }
                 }
             }
         }
         entity.SourceOrderNo = String.Join(",", sourceOrderNos.ToArray());
         return(Content(entity.ToJson()));
     }
     catch (Exception ex)
     {
         BaseSysLogBll.Instance.WriteLog("", OperationType.Query, "-1", "异常错误:" + ex.Message);
         return(null);
     }
 }
Esempio n. 22
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="receiptNo"></param>
        /// <returns></returns>
        public ActionResult FinishedReceipt(string receiptNo)
        {
            try
            {
                var Message = "审核失败。";
                int IsOk    = 0;

                var entity = Repositoryfactory.Repository().FindEntity("ReceiptNo", receiptNo);
                if (entity == null || entity.Status != 2)
                {
                    throw new Exception("该收货单不是收货中状态,不能完成收货");
                }
                if (entity.IsLocked)
                {
                    throw new Exception("该收货单已锁定,完成收货");
                }

                entity.Modify(entity.ReceiptId);
                entity.Status = 3;
                IsOk          = _receiptBll.UpdateReceiptStatus(entity);
                if (IsOk > 0)
                {
                    Message = "审核成功。";
                }
                WriteLog(IsOk, receiptNo, Message);
                return(Content(new JsonMessage {
                    Success = true, Code = IsOk.ToString(), Message = Message
                }.ToString()));
            }
            catch (Exception ex)
            {
                WriteLog(-1, receiptNo, "操作失败:" + ex.Message);
                return(Content(new JsonMessage {
                    Success = false, Code = "-1", Message = "操作失败:" + ex.Message
                }.ToString()));
            }
        }
Esempio n. 23
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="keyValue"></param>
        /// <returns></returns>
        public ActionResult Invalid(string keyValue)
        {
            try
            {
                var Message = "作废失败。";
                int IsOk    = 0;

                var entity = Repositoryfactory.Repository().FindEntity("ReceiptId", keyValue);
                if (entity == null || entity.Status != 0)
                {
                    throw new Exception("该收货单不是初始状态,不能作废");
                }

                if (entity.IsLocked)
                {
                    throw new Exception("该收货单已锁定,不能作废");
                }

                entity.Modify(keyValue);
                IsOk = _receiptBll.Invalid(entity);
                if (IsOk > 0)
                {
                    Message = "作废成功。";
                }
                WriteLog(IsOk, keyValue, Message);
                return(Content(new JsonMessage {
                    Success = true, Code = IsOk.ToString(), Message = Message
                }.ToString()));
            }
            catch (Exception ex)
            {
                WriteLog(-1, keyValue, "操作失败:" + ex.Message);
                return(Content(new JsonMessage {
                    Success = false, Code = "-1", Message = "操作失败:" + ex.Message
                }.ToString()));
            }
        }
Esempio n. 24
0
        public ActionResult SubmitShipVendorForm(ShipVendorEntity entity, string KeyValue, string BuildFormJson)
        {
            string        ModuleId    = DESEncrypt.Decrypt(CookieHelper.GetCookie("ModuleId"));
            IDatabase     database    = DataFactory.Database();
            DbTransaction isOpenTrans = database.BeginTrans();

            try
            {
                int    IsOk    = 0;
                string Message = KeyValue == "" ? "新增成功。" : "编辑成功。";
                if (!string.IsNullOrEmpty(KeyValue))
                {
                    ShipVendorEntity oldentity = Repositoryfactory.Repository().FindEntity(KeyValue);//获取没更新之前实体对象
                    entity.Modify(KeyValue);
                    IsOk = database.Update(entity, isOpenTrans);
                    this.WriteLog(IsOk, entity, oldentity, KeyValue, Message);
                }
                else
                {
                    entity.Create();
                    IsOk = database.Insert(entity, isOpenTrans);
                    this.WriteLog(IsOk, entity, null, KeyValue, Message);
                }
                Base_FormAttributeBll.Instance.SaveBuildForm(BuildFormJson, entity.ShipVendorId, ModuleId, isOpenTrans);
                return(Content(new JsonMessage {
                    Success = true, Code = IsOk.ToString(), Message = Message
                }.ToString()));
            }
            catch (Exception ex)
            {
                this.WriteLog(-1, entity, null, KeyValue, "操作失败:" + ex.Message);
                return(Content(new JsonMessage {
                    Success = false, Code = "-1", Message = "操作失败:" + ex.Message
                }.ToString()));
            }
        }
Esempio n. 25
0
        public virtual ActionResult SubmitCompanyForm(BaseCompany entity, string keyValue, string buildFormJson)
        {
            string        moduleId    = DESEncrypt.Decrypt(WebHelper.GetCookie("ModuleId"));
            IDatabase     database    = DataFactory.Database();
            DbTransaction isOpenTrans = database.BeginTrans();

            try
            {
                int    isOk    = 0;
                string message = keyValue == "" ? "新增成功。" : "编辑成功。";
                if (!string.IsNullOrEmpty(keyValue))
                {
                    BaseCompany oldentity = Repositoryfactory.Repository().FindEntity(keyValue);//获取没更新之前实体对象
                    entity.Modify(keyValue);
                    isOk = database.Update(entity, isOpenTrans);
                    this.WriteLog(isOk, entity, oldentity, keyValue, message);
                }
                else
                {
                    entity.Create();
                    isOk = database.Insert(entity, isOpenTrans);
                    this.WriteLog(isOk, entity, null, keyValue, message);
                }
                BaseFormAttributeBll.Instance.SaveBuildForm(buildFormJson, entity.CompanyId, moduleId, isOpenTrans);
                return(Content(new JsonMessage {
                    Success = true, Code = isOk.ToString(), Message = message
                }.ToString()));
            }
            catch (Exception ex)
            {
                this.WriteLog(-1, entity, null, keyValue, "操作失败:" + ex.Message);
                return(Content(new JsonMessage {
                    Success = false, Code = "-1", Message = "操作失败:" + ex.Message
                }.ToString()));
            }
        }
Esempio n. 26
0
        /// <summary>
        /// 【编码规则】返回主表JSON
        /// </summary>
        /// <param name="ViewId">主表 主键值</param>
        /// <returns></returns>
        public JsonResult GetEntityJson(string CodeRuleId)
        {
            Base_CodeRule entity = Repositoryfactory.Repository().FindEntity(CodeRuleId);

            return(Json(entity, JsonRequestBehavior.AllowGet));
        }
Esempio n. 27
0
        public override ActionResult SetFormFiled(string propertyName, string propertyValue)
        {
            var entity = Repositoryfactory.Repository().FindList(propertyName, propertyValue).FirstOrDefault(c => c.IsDimission != 0);

            return(Content(entity.ToJson()));
        }
Esempio n. 28
0
        public async Task <ContentResult> GetNewEmpNo()
        {
            int count = await Task.Run(() => Repositoryfactory.Repository().FindCount($"AND EMPNO LIKE '{DateTimeHelper.YearMouth}%'"));

            return(Content(DateTimeHelper.YearMouth + (count + 1).ToString().PadLeft(3, '0')));
        }
Esempio n. 29
0
        /// <summary>
        /// 【Excel模板设置】返回主表JSON
        /// </summary>
        /// <param name="ViewId">主表 主键值</param>
        /// <returns></returns>
        public JsonResult GetEntityJson(string ImportId)
        {
            BaseExcelImport entity = Repositoryfactory.Repository().FindEntity(ImportId);

            return(Json(entity, JsonRequestBehavior.AllowGet));
        }