Exemplo n.º 1
0
        /// <summary>
        /// 更新返还信息
        /// </summary>
        /// <param name="register"></param>
        /// <returns></returns>
        public virtual RMARegisterInfo UpdateResponseInfo(RMARegisterInfo register)
        {
            if (register == null)
            {
                throw new ArgumentNullException("register");
            }
            CommonCheck.VerifyNotNull("SysNo", register.ResponseInfo.SysNo);

            RMARegisterInfo origin = LoadBySysNo(register.ResponseInfo.SysNo.Value);

            if (origin.BasicInfo.Status == RMARequestStatus.Complete || origin.BasicInfo.Status == RMARequestStatus.Abandon)
            {
                string msg = ResouceManager.GetMessageString("RMA.Request", "CannotEditWhenClosedOrAbandon");
                throw new BizException(msg);
            }

            CommonCheck.VerifyNotNull("ResponseProductNo", register.ResponseInfo.ResponseProductNo);

            string userName = ExternalDomainBroker.GetUserInfo(ServiceContext.Current.UserSysNo).UserDisplayName;

            register.ResponseInfo.ResponseDesc = string.Format(
                "{0}\r\n{1} {2}",
                register.ResponseInfo.ResponseDesc, userName, DateTime.Now.ToString("yyyy-MM-dd")
                );
            register.VerifyFieldsLength();

            registerDA.UpdateResponseInfo(register);

            ExternalDomainBroker.CreateOperationLog("RMA_Register_ResponseInfo", BizLogType.RMA_Register_ResponseInfo, register.SysNo.Value, origin.CompanyCode);

            return(LoadForEditBySysNo(register.ResponseInfo.SysNo.Value));
        }
Exemplo n.º 2
0
        public static bool VerifyForCreate(this RMARequestInfo request)
        {
            // verify required fields
            CommonCheck.VerifyNotNull("销售单号", request.SOSysNo);
            CommonCheck.VerifyNotNull("顾客编号", request.CustomerSysNo);
            CommonCheck.VerifyNotNull("联系电话", request.Phone);
            CommonCheck.VerifyNotNull("联系人", request.Contact);
            CommonCheck.VerifyNotNull("送货方式", request.ShipViaCode);
            CommonCheck.VerifyNotNull("收货地址区域编号", request.AreaSysNo);
            CommonCheck.VerifyNotNull("收货地址", request.Address);
            // verify all fields' length
            request.VerifyFieldsLength();

            VerifyGiftCardRMA(request);

            // tracking# is required withou OZZO ship via
            if ((!request.ShipViaCode.ToLower().Contains("ozzo") &&
                 !request.ShipViaCode.ToLower().Contains("奥硕")) &&
                StringUtility.IsNullOrEmpty(request.TrackingNumber))
            {
                string msg = ResouceManager.GetMessageString("RMA.Request", "ObjectIsRequired");
                msg = string.Format(msg, "邮包编号");
                throw new BizException(msg);
            }

            return(request.VerifyDuplicate());
        }
Exemplo n.º 3
0
        public static bool VerifyClose(this RMARegisterInfo register, RMARegisterInfo registerInDb)
        {
            if (registerInDb == null)
            {
                throw new ArgumentNullException("registerInDb");
            }
            if (register == null)
            {
                throw new ArgumentNullException("request is required!");
            }
            string msg = ResouceManager.GetMessageString("RMA.Request", "CannotCloseRegister");

            msg = string.Format(msg, registerInDb.SysNo);
            CommonCheck.VerifyNotNull(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-SysNo"), register.BasicInfo.SysNo);

            // Extend warranty register doesn't need OwnBy/Location validation
            if (registerInDb.BasicInfo.SOItemType != SOProductType.ExtendWarranty)
            {
                if ((!registerInDb.BasicInfo.Status.HasValue || registerInDb.BasicInfo.Status.Value != RMARequestStatus.Handling))
                {
                    throw new BizException(msg);
                }
                //ERP模式不用接收
                if (registerInDb.BasicInfo.InventoryType == ProductInventoryType.Company || registerInDb.BasicInfo.InventoryType == ProductInventoryType.TwoDoor)
                {
                    return(true);
                }
                if ((registerInDb.BasicInfo.OwnBy.HasValue && registerInDb.BasicInfo.OwnBy.Value != RMAOwnBy.Origin) ||
                    (registerInDb.BasicInfo.Location.HasValue && registerInDb.BasicInfo.Location.Value != RMALocation.Origin))
                {
                    throw new BizException(msg);
                }
            }
            return(true);
        }
Exemplo n.º 4
0
        public static bool VerifyReceive(this RMARequestInfo request, RMARequestInfo requestInDb)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            // verify required fields
            CommonCheck.VerifyNotNull("申请单ID", request.SysNo);
            CommonCheck.VerifyNotNull("仓库", request.ReceiveWarehouse);
            CommonCheck.VerifyNotNull("接收日期", request.CustomerSendTime);
            CommonCheck.VerifyNotNull("订单号", request.SOSysNo);
            //if (!(request.ShipViaCode.ToLower().Contains("ozzo") ||
            //      request.ShipViaCode.ToLower().Contains("奥硕")))
            if (!request.ShipViaCode.ToLower().Contains(AppSettingManager.GetSetting("RMA", "PushShipTypeName")))
            {
                CommonCheck.VerifyNotNull("邮包编号", request.TrackingNumber);
            }

            // verify request fields' max length
            request.VerifyFieldsLength();

            if (requestInDb.Status.HasValue && requestInDb.Status.Value != RMARequestStatus.Origin)
            {
                string msg = ResouceManager.GetMessageString("RMA.Request", "CannotReceiveWithoutOriginRequest");
                throw new BizException(msg);
            }
            if (request.Registers == null || request.Registers.Count < 1)
            {
                string msg = ResouceManager.GetMessageString("RMA.Request", "ObjectIsRequired");
                msg = string.Format(msg, "订单列表");
                throw new BizException(msg);
            }
            request.Registers.ForEach(
                reg =>
            {
                if (!reg.BasicInfo.IsHaveInvoice.HasValue ||
                    !reg.BasicInfo.IsFullAccessory.HasValue ||
                    !reg.BasicInfo.IsFullPackage.HasValue)
                {
                    string msg = ResouceManager.GetMessageString("RMA.Request", "LostRegisterReceiveInformations");
                    throw new BizException(msg);
                }
            }
                );
            if (request.ShipViaCode == RMAConst.ShipVia_PostOffice)
            {
                if (request.PostageToPoint.HasValue && request.PostageToPoint.Value > 50)
                {
                    string msg = ResouceManager.GetMessageString("RMA.Request", "PostageToPointShouldLessThan50");
                    throw new BizException(msg);
                }
            }
            return(true);
        }
Exemplo n.º 5
0
 public static bool VerifyFieldsLength(this RMARequestInfo request)
 {
     if (request != null)
     {
         CommonCheck.VerifyLength("RequestID", request.RequestID, 20);
         CommonCheck.VerifyLength("Address", request.Address, 200);
         CommonCheck.VerifyLength("Contact", request.Contact, 50);
         CommonCheck.VerifyLength("Phone", request.Phone, 50);
         CommonCheck.VerifyLength("Note", request.Note, 200);
         CommonCheck.VerifyLength("Memo", request.Memo, 200);
         CommonCheck.VerifyLength("ShipViaCode", request.ShipViaCode, 50);
         CommonCheck.VerifyLength("TrackingNumber", request.TrackingNumber, 50);
         CommonCheck.VerifyLength("ReceiveWarehouse", request.ReceiveWarehouse, 4);
     }
     return(true);
 }
Exemplo n.º 6
0
        public static bool VerifyUpdate(this RMARegisterInfo register, RMARegisterInfo registerInDb)
        {
            if (registerInDb == null)
            {
                throw new ArgumentNullException("registerInDb");
            }
            if (register == null)
            {
                throw new ArgumentNullException("register");
            }

            CommonCheck.VerifyNotNull(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-SysNo"), register.BasicInfo.SysNo);
            CommonCheck.VerifyNotNull(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-ProductSysNo"), register.BasicInfo.ProductSysNo);
            CommonCheck.VerifyNotNull(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-CustomerDesc"), register.BasicInfo.CustomerDesc);

            register.VerifyFieldsLength();

            if (registerInDb.BasicInfo.Status.Value == RMARequestStatus.Complete ||
                registerInDb.BasicInfo.Status.Value == RMARequestStatus.Abandon)
            {
                string msg = ResouceManager.GetMessageString("RMA.Request", "CannotEditWhenClosedOrAbandon");
                throw new BizException(msg);
            }
            if (register.BasicInfo.Status != registerInDb.BasicInfo.Status)
            {
                switch (register.BasicInfo.Status.Value)
                {
                case RMARequestStatus.Abandon:
                    registerInDb.VerifyAbandon();
                    break;

                case RMARequestStatus.Complete:
                    register.VerifyClose(registerInDb);
                    break;

                case RMARequestStatus.Handling:
                    register.VerifyReceive();
                    break;

                case RMARequestStatus.Origin:
                    break;
                }
            }
            return(true);
        }
Exemplo n.º 7
0
        public static bool VerifyWaitingRevert(this RMARegisterInfo register)
        {
            if (register == null)
            {
                throw new ArgumentNullException("register is required!");
            }

            CommonCheck.VerifyNotNull(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-SysNo"), register.BasicInfo.SysNo);
            CommonCheck.VerifyNotNull(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-NewProductStatus"), (int?)register.RevertInfo.NewProductStatus);

            register.VerifyFieldsLength();

            if (!ObjectFactory <IRegisterDA> .Instance.CanWaitingRevert(register.BasicInfo.SysNo.Value))
            {
                string msg = ResouceManager.GetMessageString("RMA.Request", "CannotSetWaitingRevert");
                throw new BizException(msg);
            }

            switch (register.RevertInfo.NewProductStatus.Value)
            {
            // 非换货和调新品时,RevertProductSysNo 将被设定为原始的 ProductSysNo,因此 ProductSysNo 不能为空
            case RMANewProductStatus.Origin:
            case RMANewProductStatus.NewProduct:
                CommonCheck.VerifyNotNull(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-ProductSysNo"), register.BasicInfo.ProductSysNo);
                break;

            // 调二手和非当前 Case 时,RevertProductSysNo 由用户从 UI 设定,不能为空
            case RMANewProductStatus.SecondHand:
            case RMANewProductStatus.OtherProduct:
                CommonCheck.VerifyNotNull(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-RevertProductSysNo"), register.RevertInfo.RevertProductSysNo);
                if (register.RevertInfo.RevertProductSysNo.Value == register.BasicInfo.ProductSysNo.Value)
                {
                    string msg = ResouceManager.GetMessageString("RMA.Request", "RevertProductSysnoCannotSameAsProductSysNo");
                    throw new BizException(msg);
                }
                break;
            }
            // 不为“非换货”时,RevertStockSysNo 不能为空
            if (register.RevertInfo.NewProductStatus != RMANewProductStatus.Origin)
            {
                CommonCheck.VerifyNotNull("发货仓库", register.RevertInfo.RevertStockSysNo);
            }
            return(true);
        }
Exemplo n.º 8
0
        public static bool VerifyRevertAudit(this RMARegisterInfo register)
        {
            if (register == null)
            {
                throw new ArgumentNullException("register is required!");
            }

            CommonCheck.VerifyNotNull(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-SysNo"), register.SysNo);
            CommonCheck.VerifyNotNull(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-RevertProductSysNo"), register.RevertInfo.RevertProductSysNo);
            // verify fields' max length
            register.VerifyFieldsLength();

            if (register.RevertInfo.RevertAuditMemo == null) // only verify whether it's null, but empty string is valid
            {
                string msg = ResouceManager.GetMessageString("RMA.Request", "ObjectIsRequired");
                msg = string.Format(msg, ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-RequestMsg"));
                throw new BizException(msg);
            }
            return(true);
        }
Exemplo n.º 9
0
        public static bool VerifyFieldsLength(this RMARegisterInfo register)
        {
            if (register != null)
            {
                CommonCheck.VerifyLength(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-CustomerDesc"), register.BasicInfo.CustomerDesc, 500);
                CommonCheck.VerifyLength(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-Memo"), register.BasicInfo.Memo, 3000);
                CommonCheck.VerifyLength(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-SerialNumber"), register.BasicInfo.ProductNo, 50);
                CommonCheck.VerifyLength(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-LocationWarehouse"), register.BasicInfo.LocationWarehouse, 4);
                CommonCheck.VerifyLength(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-LocationWarehouse"), register.BasicInfo.OwnByWarehouse, 4);
                CommonCheck.VerifyLength(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-ShippedWarehouse"), register.BasicInfo.ShippedWarehouse, 4);

                CommonCheck.VerifyLength(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-ShippedWarehouse"), register.CheckInfo.CheckDesc, 1000);
                CommonCheck.VerifyLength(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-InspectionResultType"), register.CheckInfo.InspectionResultType, 100);

                CommonCheck.VerifyLength(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-ResponseDesc"), register.ResponseInfo.ResponseDesc, 1000);
                CommonCheck.VerifyLength(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-ResponseProductNo"), register.ResponseInfo.ResponseProductNo, 50);
                CommonCheck.VerifyLength(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-VendorRepairResultType"), register.ResponseInfo.VendorRepairResultType, 100);

                CommonCheck.VerifyLength(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-RequestMsg"), register.RevertInfo.RevertAuditMemo, 200);
            }
            return(true);
        }
Exemplo n.º 10
0
        public static bool VerifyCreate(this RMARegisterInfo register)
        {
            if (register.RequestType == null)
            {
                string msg = ResouceManager.GetMessageString("RMA.Request", "ObjectIsRequired");
                msg = string.Format(msg, ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-RequestType"));
                throw new BizException(msg);
            }
            if (register.BasicInfo.RMAReason == null)
            {
                string msg = ResouceManager.GetMessageString("RMA.Request", "ObjectIsRequired");
                msg = string.Format(msg, ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-RMAReason"));
                throw new BizException(msg);
            }

            CommonCheck.VerifyNotNull(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-ProductSysNo"), register.BasicInfo.ProductSysNo);
            CommonCheck.VerifyNotNull(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-CustomerDesc"), register.BasicInfo.CustomerDesc);
            CommonCheck.VerifyNotNull(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-RequestType"), (int?)register.RequestType);
            CommonCheck.VerifyNotNull(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-Status"), (int?)register.BasicInfo.Status);
            CommonCheck.VerifyNotNull(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-SOItemType"), (int?)register.BasicInfo.SOItemType);
            return(register.VerifyFieldsLength());
        }
Exemplo n.º 11
0
        public static bool VerifyCloseForVendorRefund(
            this RMARegisterInfo register, RMARegisterInfo registerInDb)
        {
            if (registerInDb == null)
            {
                throw new ArgumentNullException("registerInDb");
            }
            if (register == null)
            {
                throw new ArgumentNullException("request is required!");
            }

            CommonCheck.VerifyNotNull(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-SysNo"), register.BasicInfo.SysNo);
            CommonCheck.VerifyNotNull(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-CloseUserSysNo"), register.BasicInfo.CloseUserSysNo);
            CommonCheck.VerifyNotNull(ResouceManager.GetMessageString("RMA.Request", "RegisterCheck-CloseTime"), register.BasicInfo.CloseTime);
            if (!registerInDb.BasicInfo.Status.HasValue || registerInDb.BasicInfo.Status.Value != RMARequestStatus.Handling)
            {
                string msg = ResouceManager.GetMessageString("RMA.Request", "CannotCloseRegisterFormat");
                msg = string.Format(msg, register.BasicInfo.SysNo);
                throw new BizException(msg);
            }
            return(true);
        }
Exemplo n.º 12
0
        public static bool VerifyUpdate(this RMARequestInfo request, RMARequestInfo requestInDb)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }
            if (requestInDb == null)
            {
                throw new ArgumentNullException("requestInDb");
            }

            // verify required fields
            CommonCheck.VerifyNotNull("SysNo", request.SysNo);
            CommonCheck.VerifyNotNull("RequestID", request.RequestID);
            CommonCheck.VerifyNotNull("SOSysNo", request.SOSysNo);
            CommonCheck.VerifyNotNull("CustomerSysNo", request.CustomerSysNo);
            CommonCheck.VerifyNotNull("Address", request.Address);
            CommonCheck.VerifyNotNull("Contact", request.Contact);
            CommonCheck.VerifyNotNull("Phone", request.Phone);
            // verify request fields' max length
            request.VerifyFieldsLength();

            // 如果是”邮局普包“就必须传入”邮资转积分“数
            if (request.ShipViaCode == RMAConst.ShipVia_PostOffice)
            {
                if (request.PostageToPoint.HasValue && request.PostageToPoint.Value > 50)
                {
                    string msg = ResouceManager.GetMessageString("RMA.Request", "PostageToPointShouldLessThan50");
                    throw new BizException(msg);
                }
            }
            if (requestInDb.Status.Value == RMARequestStatus.Complete ||
                requestInDb.Status.Value == RMARequestStatus.Abandon)
            {
                string msg = ResouceManager.GetMessageString("RMA.Request", "CannotEditWhenHandlingOrClosedOrAbandon");
                throw new BizException(msg);
            }
            if (!request.Status.HasValue)
            {
                string msg = ResouceManager.GetMessageString("RMA.Request", "ObjectIsRequired");
                msg = string.Format(msg, "申请单处理状态");
                throw new BizException(msg);
            }
            if (request.Status != requestInDb.Status)
            {
                switch (request.Status.Value)
                {
                case RMARequestStatus.Abandon:
                    request.VerifyAbandon(requestInDb);
                    break;

                case RMARequestStatus.Complete:
                    break;

                case RMARequestStatus.Handling:
                    request.VerifyReceive(requestInDb);
                    break;

                case RMARequestStatus.Origin:
                    requestInDb.VerifyCancelReceive();
                    break;
                }
            }
            return(true);
        }