コード例 #1
0
ファイル: SOAppService.cs プロジェクト: sanlonezhang/ql
        /// <summary>
        /// 批量设置 通关失败订单作废
        /// </summary>
        /// <param name="soSysNoList">订单编号列表</param>
        public virtual void BatchOperationUpdateSOStatusToCustomsReject(List <int> soSysNoList)
        {
            if (soSysNoList == null || soSysNoList.Count < 1)
            {
                BizExceptionHelper.Throw("SO_BatchOperation_IsNull");
            }
            else
            {
                List <BatchActionItem <int> > actionItemList = new List <BatchActionItem <int> >();
                foreach (int sosysno in soSysNoList)
                {
                    BatchActionItem <int> item = new BatchActionItem <int>();
                    item.Data = sosysno;
                    item.ID   = sosysno.ToString();
                    actionItemList.Add(item);
                }

                BatchActionResult <int> result = BatchActionManager.DoBatchAction <int>(actionItemList, (sosysno) =>
                {
                    var process = ObjectFactory <SOProcessor> .NewInstance();
                    var soInfo  = soProcessor.GetSOBySOSysNo(sosysno);
                    if (soInfo != null)
                    {
                        process.ProcessSO(new SOAction.SOCommandInfo
                        {
                            Command   = SOAction.SOCommand.Abandon,
                            SOInfo    = soInfo,
                            Parameter = new object[] { true, true, null, true, SOStatus.CustomsReject }
                        });
                    }
                });

                result.ThrowErrorException();
            }
        }
コード例 #2
0
ファイル: SOAppService.cs プロジェクト: sanlonezhang/ql
        /// <summary>
        /// 批量设置 已通关发往顾客
        /// </summary>
        /// <param name="soSysNoList">订单编号列表</param>
        public virtual void BatchOperationUpdateSOStatusToCustomsPass(List <int> soSysNoList)
        {
            if (soSysNoList == null || soSysNoList.Count < 1)
            {
                BizExceptionHelper.Throw("SO_BatchOperation_IsNull");
            }
            else
            {
                List <BatchActionItem <int> > actionItemList = new List <BatchActionItem <int> >();
                foreach (int sosysno in soSysNoList)
                {
                    BatchActionItem <int> item = new BatchActionItem <int>();
                    item.Data = sosysno;
                    item.ID   = sosysno.ToString();
                    actionItemList.Add(item);
                }

                BatchActionResult <int> result = BatchActionManager.DoBatchAction <int>(actionItemList, (sosysno) =>
                {
                    ObjectFactory <SOProcessor> .NewInstance().UpdateSOStatusToCustomsPass(sosysno);
                });

                result.ThrowErrorException();
            }
        }
コード例 #3
0
ファイル: UserProcessor.cs プロジェクト: sanlonezhang/ql
        /// <summary>
        /// 更新VendorUser
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool Update(VendorUser entity)
        {
            if (entity == null ||
                string.IsNullOrEmpty(entity.UserID)
                )
            {
                BizExceptionHelper.Throw("ExternalSYS_VendorUser_LoginError");
            }
            if (string.IsNullOrEmpty(entity.UserName))
            {
                BizExceptionHelper.Throw("ExternalSYS_VendorUser_LoginNameError");
            }
            if (!entity.VendorSysNo.HasValue)
            {
                BizExceptionHelper.Throw("ExternalSYS_VendorUser_SelectVendorError");
            }
            if (m_da.CountUserID(entity.UserID, entity.SysNo.Value) > 0)
            {
                BizExceptionHelper.Throw("ExternalSYS_VendorUser_ExistUserError");
            }

            if (string.IsNullOrEmpty(entity.APIKey) && entity.APIStatus == ECCentral.BizEntity.ExternalSYS.ValidStatus.Active)
            {
                entity.APIKey = RandomString(32);
            }
            else if (entity.APIStatus == ECCentral.BizEntity.ExternalSYS.ValidStatus.DeActive || entity.APIStatus == null)
            {
                entity.APIKey = null;
            }
            //2015.8.19为重置代码添加 John
            if (entity.Pwd != null)
            {
                entity.Pwd = Hash_MD5.GetMD5(entity.Pwd);
            }

            bool result = m_da.UpdateVendorUser(entity);

            if (entity.ManufacturerSysNoList != null && entity.ManufacturerSysNoList.Count > 0)
            {
                foreach (var ManufacturerSysNo in entity.ManufacturerSysNoList)
                {
                    m_da.InsertVendorUser_VendorExForUpdate(new VendorUserMapping()
                    {
                        UserSysNo         = entity.SysNo,
                        ManufacturerSysNo = ManufacturerSysNo,
                        IsAuto            = 0
                    });
                }
            }
            return(result);
        }
コード例 #4
0
ファイル: SOAppService.cs プロジェクト: sanlonezhang/ql
        /// <summary>
        /// 解锁已锁定的订单
        /// </summary>
        /// <param name="soBaseInfo"></param>
        public virtual SOInfo UnholdSO(int soSysNo, string note)
        {
            SOInfo soInfo = GetSOBySOSysNo(soSysNo);

            if (soInfo == null)
            {
                BizExceptionHelper.Throw("SO_SOIsNotExist");
            }
            soInfo.BaseInfo.HoldReason = note;
            soProcessor.ProcessSO(new SOAction.SOCommandInfo
            {
                Command = SOAction.SOCommand.Unhold,
                SOInfo  = soInfo
            });
            return(soInfo);
        }
コード例 #5
0
ファイル: SOAppService.cs プロジェクト: sanlonezhang/ql
        /// <summary>
        /// 取消订单拆分
        /// </summary>
        /// <param name="soSysNo">主订单编号</param>
        /// <returns></returns>
        public virtual SOInfo CancelSplitSO(int soSysNo)
        {
            SOInfo soInfo = GetSOBySOSysNo(soSysNo);

            if (soInfo.BaseInfo.SplitType == SOSplitType.SubSO) //订单为拆分后的子订单
            {
                soInfo = soProcessor.GetMasterSOBySubSOSysNo(soSysNo);
            }
            else if (soInfo.BaseInfo.Status != SOStatus.Split) //订单不是拆分后的主订单
            {
                BizExceptionHelper.Throw("SO_Split_NotSplited");
            }
            soProcessor.ProcessSO(new SOAction.SOCommandInfo {
                Command = SOAction.SOCommand.CancelSplit, SOInfo = soInfo
            });
            return(soInfo);
        }
コード例 #6
0
ファイル: UserProcessor.cs プロジェクト: sanlonezhang/ql
        /// <summary>
        /// 创建User
        /// </summary>
        /// <param name="entity">请求体</param>
        /// <returns>创建后的实体</returns>
        public VendorUser Create(VendorUser entity)
        {
            if (entity == null ||
                string.IsNullOrEmpty(entity.UserID)
                )
            {
                BizExceptionHelper.Throw("ExternalSYS_VendorUser_LoginError");
            }
            if (string.IsNullOrEmpty(entity.UserName))
            {
                BizExceptionHelper.Throw("ExternalSYS_VendorUser_LoginNameError");
            }
            if (!entity.VendorSysNo.HasValue)
            {
                BizExceptionHelper.Throw("ExternalSYS_VendorUser_SelectVendorError");
            }
            if (m_da.CountUserID(entity.UserID, 0) > 0)
            {
                BizExceptionHelper.Throw("ExternalSYS_VendorUser_ExistUserError");
            }
            if (string.IsNullOrEmpty(entity.APIKey) && entity.APIStatus == ECCentral.BizEntity.ExternalSYS.ValidStatus.Active)
            {
                entity.APIKey = RandomString(32);
            }

            entity.Pwd = Hash_MD5.GetMD5(AppSettingHelper.Get("VendorUserInitPassword"));

            entity.UserNum = m_da.CountVendorNum(entity.VendorSysNo.Value) + 1;
            entity         = m_da.InsertVendorUser(entity);
            if (entity.ManufacturerSysNoList != null && entity.ManufacturerSysNoList.Count > 0)
            {
                foreach (var ManufacturerSysNo in entity.ManufacturerSysNoList)
                {
                    m_da.InsertVendorUserVendorEx(new VendorUserMapping()
                    {
                        UserSysNo         = entity.SysNo,
                        ManufacturerSysNo = ManufacturerSysNo,
                        IsAuto            = 1,
                        VendorSysNo       = entity.VendorSysNo.Value
                    });
                }
            }
            return(entity);
        }
コード例 #7
0
ファイル: SOAppService.cs プロジェクト: sanlonezhang/ql
        /// <summary>
        /// 批量操作订单
        /// </summary>
        /// <param name="soSysNoList">订单编号列表</param>
        /// <param name="command">操作命令</param>
        /// <param name="parameter">操作参数,可为null</param>
        protected virtual void BatchOperation(List <int> soSysNoList, SOAction.SOCommand command, object[] parameter, out List <SOInfo> soInfoList)
        {
            soInfoList = new List <SOInfo>();
            if (soSysNoList == null || soSysNoList.Count < 1)
            {
                BizExceptionHelper.Throw("SO_BatchOperation_IsNull");
            }
            else if (soSysNoList.Count == 1 && soSysNoList[0] > 0) //1条订单数据就直接操作
            {
                SOInfo soInfo = soProcessor.GetSOBySOSysNo(soSysNoList[0]);
                soInfoList.Add(soInfo);
                if (soInfo != null)
                {
                    soProcessor.ProcessSO(new SOAction.SOCommandInfo
                    {
                        Command   = command,
                        SOInfo    = soInfo,
                        Parameter = parameter
                    });
                }
            }
            else if (soSysNoList.Count <= 50) //50条数据以下,就先取出所有订单数据再操作
            {
                List <SOInfo> soList = GetSOBySOSysNoList(soSysNoList);

                if (soList != null && soList.Count > 0)
                {
                    soInfoList.AddRange(soList);
                    List <BatchActionItem <SOInfo> > actionItemList = new List <BatchActionItem <SOInfo> >();
                    foreach (SOInfo so in soList)
                    {
                        actionItemList.Add(new BatchActionItem <SOInfo> {
                            ID = so.SysNo.Value.ToString(), Data = so
                        });
                    }

                    BatchActionResult <SOInfo> result = BatchActionManager.DoBatchAction <SOInfo>(actionItemList, (so) =>
                    {
                        SOAction.SOCommandInfo commandInfo = new SOAction.SOCommandInfo();
                        commandInfo.Command   = command;
                        commandInfo.SOInfo    = so;
                        commandInfo.Parameter = parameter;
                        ObjectFactory <SOProcessor> .NewInstance().ProcessSO(commandInfo);
                    });

                    result.ThrowErrorException();
                }
            }
            else//50条数据以上,就在操作时实时取订单数据
            {
                List <BatchActionItem <int> > actionItemList = new List <BatchActionItem <int> >();
                foreach (int no in soSysNoList)
                {
                    if (no > 0)
                    {
                        actionItemList.Add(new BatchActionItem <int> {
                            ID = no.ToString(), Data = no
                        });
                    }
                }
                if (actionItemList.Count > 0)
                {
                    List <SOInfo>           soList = new List <SOInfo>();
                    BatchActionResult <int> result = BatchActionManager.DoBatchAction <int>(actionItemList, (soSysNo) =>
                    {
                        SOInfo soInfo = soProcessor.GetSOBySOSysNo(soSysNo);
                        if (soInfo != null)
                        {
                            soList.Add(soInfo);
                            soProcessor.ProcessSO(new SOAction.SOCommandInfo
                            {
                                Command   = command,
                                SOInfo    = soInfo,
                                Parameter = parameter
                            });
                        }
                    });
                    soInfoList = soList;
                    result.ThrowErrorException();
                }
            }
        }