public override object Do(object obj)
        {
            StoreQty2DMSSV bpObj = (StoreQty2DMSSV)obj;

            //get business operation context is as follows
            //IContext context = ContextManager.Context

            //auto generating code end,underside is user custom code
            //and if you Implement replace this Exception Code...
            //throw new NotImplementedException();

            // 更新所有库存数据


            if (bpObj != null)
            {
                switch (bpObj.TransferType)
                {
                case (int)DaYun2DMSTransferTypeEnum.Whqoh:
                {
                    UpdateDMS_Whqoh(bpObj);
                }
                break;

                case (int)DaYun2DMSTransferTypeEnum.SupplySource:
                {
                    UpdateDMS_SupplySource(bpObj);
                }
                break;

                case (int)DaYun2DMSTransferTypeEnum.Supplier:
                {
                    UpdateDMS_Supplier(bpObj);
                }
                break;

                case (int)DaYun2DMSTransferTypeEnum.Customer:
                {
                    UpdateDMS_Customer(bpObj);
                }
                break;

                case (int)DaYun2DMSTransferTypeEnum.PriceList:
                {
                    UpdateDMS_PriceList(bpObj);
                }
                break;

                case (int)DaYun2DMSTransferTypeEnum.SalePriceAdjustment:
                {
                    UpdateDMS_SalePriceAdjustment(bpObj);
                }
                break;
                }
            }

            return(null);
        }
        private void UpdateDMS_SalePriceAdjustment(StoreQty2DMSSV bpObj)
        {
            string opath = "1=1 and SalePriceAdjustment.PriceList.Code = @Code and SalePriceAdjustment.Org=@Org  @AddSuptOpath ";

            if (bpObj.SupItems != null &&
                bpObj.SupItems.Count > 0
                )
            {
                string ids = bpObj.SupItems.GetOpathFromList();

                opath = opath.Replace("@AddSuptOpath"
                                      , string.Format(" and ID in ({0})", ids)
                                      );
            }
            else
            {
                // 不选,就不同步
                opath = opath.Replace("@AddSuptOpath"
                                      , " and 1=0 "
                                      );
            }

            string priceListCode = HBHCommon.GetPartPriceListCode();

            if (priceListCode.IsNotNullOrWhiteSpace())
            {
                SalePriceAdjustLine.EntityList lst = SalePriceAdjustLine.Finder.FindAll(opath
                                                                                        , new OqlParam(priceListCode)
                                                                                        , new OqlParam(Context.LoginOrg.ID)
                                                                                        );

                if (lst != null &&
                    lst.Count > 0
                    )
                {
                    List <List <SalePriceAdjustLine> > pageList = PageList <SalePriceAdjustLine>(lst);

                    if (pageList != null &&
                        pageList.Count > 0
                        )
                    {
                        foreach (List <SalePriceAdjustLine> page in pageList)
                        {
                            //PubExtend.BatchSend2DMS_Async(lst, 2);
                            PubExtend.BatchSend2DMS_Async(page, 2);
                        }
                    }
                }
            }
        }
        private void UpdateDMS_Whqoh(StoreQty2DMSSV bpObj)
        {
            //string opath = "(Wh.DescFlexField.PrivateDescSeg3 = 'True') and (SupplierInfo.Supplier is not null and SupplierInfo.Supplier > 0 and SupplierInfo.Supplier.Category.DescFlexField.PrivateDescSeg1 = 'True') and exists( select 1 from UFIDA::U9::CBO::SCM::Supplier::SupplierItem supItem where supItem.SupplierInfo.Supplier = UFIDA::U9::InvTrans::WhQoh::WhQoh.SupplierInfo.Supplier and supItem.ItemInfo.ItemID = UFIDA::U9::InvTrans::WhQoh::WhQoh.ItemInfo.ItemID ) @AddSuptOpath ";
            // SupplierInfo.Supplier is not null and SupplierInfo.Supplier > 0 and SupplierInfo.Supplier.Category.DescFlexField.PrivateDescSeg1 = 'True'
            //string opath = "(Wh.DescFlexField.PrivateDescSeg3 is not null and Wh.DescFlexField.PrivateDescSeg3 = 'True') and (LotInfo.LotMaster_EntityID is not null and LotInfo.LotMaster_EntityID > 0 and LotInfo.LotMaster_EntityID.DescFlexSegments.PrivateDescSeg1 is not null and LotInfo.LotMaster_EntityID.DescFlexSegments.PrivateDescSeg1 != '' ) and (LotInfo.LotMaster_EntityID.DescFlexSegments.PrivateDescSeg1 in (select supt.Code from UFIDA::U9::CBO::SCM::Supplier::Supplier supt where supt.Category.DescFlexField.PrivateDescSeg1 = 'True'))  @AddSuptOpath ";
            // 由交叉档 改为 货源表
            string opath = "Wh.Org=@Org and (Wh.DescFlexField.PrivateDescSeg3 is not null and Wh.DescFlexField.PrivateDescSeg3 = 'True') and (LotInfo.LotMaster_EntityID is not null and LotInfo.LotMaster_EntityID > 0 and LotInfo.LotMaster_EntityID.DescFlexSegments.PrivateDescSeg1 is not null and LotInfo.LotMaster_EntityID.DescFlexSegments.PrivateDescSeg1 != '' ) and (LotInfo.LotMaster_EntityID.DescFlexSegments.PrivateDescSeg1 in (select supt.Code from UFIDA::U9::CBO::SCM::Supplier::Supplier supt where supt.Category.DescFlexField.PrivateDescSeg1 = 'True'))  @AddSuptOpath ";

            if (bpObj.SupItems != null &&
                bpObj.SupItems.Count > 0
                )
            {
                string ids = bpObj.SupItems.GetOpathFromList();

                opath = opath.Replace("@AddSuptOpath"
                                      , string.Format(" and ItemInfo.ItemID in ({0})", ids)
                                      );
            }
            else
            {
                opath = opath.Replace("@AddSuptOpath"
                                      , string.Empty
                                      );
            }

            WhQoh.EntityList lst = WhQoh.Finder.FindAll(opath, new OqlParam(Context.LoginOrg.ID));

            if (lst != null &&
                lst.Count > 0
                )
            {
                //SendWhqoh2DMS_Async(lst);
                List <List <WhQoh> > pageList = PageList <WhQoh>(lst);

                if (pageList != null &&
                    pageList.Count > 0
                    )
                {
                    foreach (List <WhQoh> page in pageList)
                    {
                        //PubExtend.BatchSend2DMS_Async(lst, 2);
                        BatchSend2DMS_Async(page);
                    }
                }
            }
        }
        private void UpdateDMS_Customer(StoreQty2DMSSV bpObj)
        {
            string opath = "1=1 @AddSuptOpath ";

            if (bpObj.SupItems != null &&
                bpObj.SupItems.Count > 0
                )
            {
                string ids = bpObj.SupItems.GetOpathFromList();

                opath = opath.Replace("@AddSuptOpath"
                                      , string.Format(" and ID in ({0})", ids)
                                      );
            }
            else
            {
                opath = opath.Replace("@AddSuptOpath"
                                      , string.Empty
                                      );
            }

            Customer.EntityList lst = Customer.Finder.FindAll(opath, new OqlParam(Context.LoginOrg.ID));

            if (lst != null &&
                lst.Count > 0
                )
            {
                List <List <Customer> > pageList = PageList <Customer>(lst);

                if (pageList != null &&
                    pageList.Count > 0
                    )
                {
                    foreach (List <Customer> page in pageList)
                    {
                        //PubExtend.BatchSend2DMS_Async(lst, 2);
                        PubExtend.BatchSend2DMS_Async(page, 2);
                    }
                }
            }
        }