Esempio n. 1
0
        public IHttpActionResult PutReceipt(string rmano, [FromBody] RmaReceiptRequest request, [UserProfile] UserProfile userProfile)
        {
            IHttpActionResult httpActionResult;
            var result = CheckDataRoleAndArrangeParams(request, userProfile, out httpActionResult);

            if (!result)
            {
                return(httpActionResult);
            }

            request.RmaNo = rmano;

            var dto = _rmaService.SetReceipt(request, userProfile.Id);

            return(dto.IsSuccess ? (IHttpActionResult)Ok() : BadRequest(dto.Message));
        }
Esempio n. 2
0
        /// <summary>
        /// 设置收货 目前没有同步状态到ram_details
        /// </summary>
        /// <param name="request"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        public ExectueResult SetReceipt(RmaReceiptRequest request, int userId)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            var entity = _rmaRepository.GetByRmaNo2(request.RmaNo);

            if (entity == null)
            {
                throw new NotExistsRmaException(request.RmaNo);
            }

            /*
             * 1.判断状态 [Description("物流收货")] ShipReceive = 5,
             * 2.
             */

            if (entity.Status > EnumRMAStatus.ShipReceive.AsId())
            {
                throw new NotStatusRmaException(request.RmaNo, (EnumRMAStatus)entity.Status, EnumRMAStatus.ShipReceive);
            }

            if (entity.Status == EnumRMAStatus.ShipReceive.AsId())
            {
                throw new OpcException(String.Format("当前已经是{0}({1})", EnumRMAStatus.ShipReceive.GetDescription(), EnumRMAStatus.ShipReceive.AsId()));
            }

            entity.UpdatedDate = DateTime.Now;
            entity.UpdatedUser = userId;
            entity.Status      = EnumRMAStatus.ShipReceive.AsId();

            _rmaRepository.Update(entity);

            return(new OkExectueResult());
        }