/// <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(); } }
/// <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(); } }
/// <summary> /// 处理无效的团购订单 /// </summary> public virtual void ProcessorInvalidGroupBuySO(string companyCode) { GroupBuySOProcessor groupBuySOProcessor = ObjectFactory <GroupBuySOProcessor> .Instance; List <int> soSysNoList = groupBuySOProcessor.GetInvalidGroupBuySOSysNoList(companyCode); if (soSysNoList != null) { if (soSysNoList.Count < 50) { List <SOInfo> soInfoList = soProcessor.GetSOBySOSysNoList(soSysNoList); List <BatchActionItem <SOInfo> > actionItemList = new List <BatchActionItem <SOInfo> >(); foreach (SOInfo soInfo in soInfoList) { actionItemList.Add(new BatchActionItem <SOInfo> { ID = soInfo.SysNo.Value.ToString(), Data = soInfo }); } BatchActionResult <SOInfo> result = BatchActionManager.DoBatchAction <SOInfo>(actionItemList, (soInfo) => { groupBuySOProcessor.ProcessorInvalidGroupBuySO(soInfo); }); result.ThrowErrorException(); } else { List <BatchActionItem <int> > actionItemList = new List <BatchActionItem <int> >(); foreach (int soSysNo in soSysNoList) { actionItemList.Add(new BatchActionItem <int> { ID = soSysNo.ToString(), Data = soSysNo }); } BatchActionResult <int> result = BatchActionManager.DoBatchAction <int>(actionItemList, (soSysNo) => { SOInfo soInfo = soProcessor.GetSOBySOSysNo(soSysNo); groupBuySOProcessor.ProcessorInvalidGroupBuySO(soInfo); }); result.ThrowErrorException(); } } }
/// <summary> /// 处理团购已完成了的订单 /// </summary> /// <param name="companyCode"></param> public virtual void ProcessFinishedGroupBuySO(string companyCode) { List <ECCentral.BizEntity.MKT.GroupBuyingInfo> gbInfoList = ExternalDomainBroker.GetGroupBuyInfoForNeedProcess(companyCode); GroupBuySOProcessor groupBuySOProcessor = ObjectFactory <GroupBuySOProcessor> .Instance; List <BatchActionItem <ECCentral.BizEntity.MKT.GroupBuyingInfo> > actionItemList = new List <BatchActionItem <ECCentral.BizEntity.MKT.GroupBuyingInfo> >(); foreach (ECCentral.BizEntity.MKT.GroupBuyingInfo gbInfo in gbInfoList) { actionItemList.Add(new BatchActionItem <ECCentral.BizEntity.MKT.GroupBuyingInfo> { ID = gbInfo.SysNo.Value.ToString(), Data = gbInfo }); } BatchActionResult <ECCentral.BizEntity.MKT.GroupBuyingInfo> result = BatchActionManager.DoBatchAction <ECCentral.BizEntity.MKT.GroupBuyingInfo>(actionItemList, (gbInfo) => { groupBuySOProcessor.ProcessorGroupBuySO(gbInfo); }); result.ThrowErrorException(); }
/// <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(); } } }