Exemple #1
0
        /// <summary>
        /// 锁定订单。返回true表示同步锁定订单,false表示异步锁定订单
        /// </summary>
        /// <param name="soBaseInfo">订单基本信息</param>
        /// <returns>是不是已经同步锁定了订单,true 表示是,false 表示异步锁定订单(订单现在还没有锁定)</returns>
        public virtual bool Hold(SOHoldReason holdType, OPCCallBackType callBackType)
        {
            //  1.  锁定前的业务检查,订单处于以下状态时不能被锁定:1.已作废,已拆分,已出库;2.已经被锁定(前台网站和后台管理锁定后都不能再次锁定)
            HoldPreCheck(holdType);

            //  2.  判断WMS是否下载订单,如果下载则要Hold WMS
            bool wmsIsDownload = SODA.WMSIsDownloadSO(SOSysNo);

            //  3.  仓库锁定订单
            if (wmsIsDownload)
            {
                List <int> stockSysNoList = (from item in CurrentSO.Items
                                             where item.StockSysNo.HasValue && item.ProductType != SOProductType.Coupon && item.ProductType != SOProductType.ExtendWarranty
                                             select item.StockSysNo.Value).Distinct().ToList();
                try
                {
                    //同步锁定订单
                    WMSHoldMessage message = new WMSHoldMessage
                    {
                        SOSysNo            = SOSysNo,
                        ActionType         = ECCentral.Service.EventMessage.WMSActionType.Hold,
                        UserSysNo          = ServiceContext.Current.UserSysNo,
                        WarehouseSysNoList = stockSysNoList,
                        Reason             = CurrentSO.BaseInfo.HoldReason
                    };
                    EventPublisher.Publish <WMSHoldMessage>(message);
                }
                catch (ThirdPartBizException biz_ex)
                {
                    throw new BizException(biz_ex.Message);
                }
                catch
                {
                    //异步锁定订单
                    WMSAction action = WMSAction.Hold;
                    switch (holdType)
                    {
                    case SOHoldReason.AbandonOrder:
                        action = WMSAction.AbandonHold;
                        break;

                    case SOHoldReason.CancelAuditOrder:
                        action = WMSAction.CancelAuditHold;
                        break;
                    }
                    ObjectFactory <OPCProcessor> .Instance.SendMessageToWMS(CurrentSO, action, callBackType); //ExternalDomainBroker.SendMessageToWMS(CurrentSO, action, OPCCallBackType.HoldCallBack);

                    BizExceptionHelper.Throw("SO_Hold_NetErrorSysncHolding");
                }
            }
            //  3.  本地锁定订单
            DirectHoldSO();
            return(true);
        }
Exemple #2
0
        private void SendMsgToWMS(List <SOInfo> subSOList)
        {
            foreach (SOInfo subSO in subSOList)
            {
                if (SODA.WMSIsDownloadSO(subSO.SysNo.Value))
                {
                    ObjectFactory <OPCProcessor> .Instance.SendMessageToWMS(subSO, WMSAction.Abandon, OPCCallBackType.NoneCallBack);

                    WriteLog(BizEntity.Common.BizLogType.Sale_SO_EmployeeAbandon, "Res_SO_Abandon");
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// 取消订单配送,
        /// </summary>
        protected virtual void CancelDelivery()
        {
            // 1.   如果是泰隆优选快递类型,取消配送任务
            //if (CurrentSO.ShippingInfo.FreightUserSysNo != 0)
            //{
            //    ObjectFactory<DeliveryProcessor>.Instance.CancelDelivery(SOSysNo, "作废订单");
            //}

            //  2.  判断WMS是否下载订单,如果下载则要Hold WMS
            bool wmsIsDownload = SODA.WMSIsDownloadSO(SOSysNo);

            if (wmsIsDownload)
            {
                ObjectFactory <OPCProcessor> .Instance.SendMessageToWMS(CurrentSO, WMSAction.Abandon, OPCCallBackType.NoneCallBack);
            }
        }