/// <summary>
        /// 得到出货单dto
        /// </summary>
        /// <param name="bpObj"></param>
        /// <returns></returns>
        private System.Collections.Generic.List <UFIDA.U9.ISV.SM.ShipDTOForIndustryChainData> GetShipDTOList(System.Collections.Generic.List <CarShipLineDTO> shiplist)
        {
            System.Collections.Generic.List <UFIDA.U9.ISV.SM.ShipDTOForIndustryChainData> list = new System.Collections.Generic.List <UFIDA.U9.ISV.SM.ShipDTOForIndustryChainData>();
            //string opeatorstr = "DMSTESTUSER";
            //string opeatorstr = "DMS";
            string opeatorstr = HBHCommon.DefaultShipOperatorCode;

            System.Collections.Generic.Dictionary <string, System.Collections.Generic.List <CarShipLineDTO> > dic = new System.Collections.Generic.Dictionary <string, System.Collections.Generic.List <CarShipLineDTO> >();
            foreach (CarShipLineDTO dtoline in shiplist)
            {
                if (!dic.ContainsKey(dtoline.SpitOrderFlag))
                {
                    dic.Add(dtoline.SpitOrderFlag, new System.Collections.Generic.List <CarShipLineDTO>());
                }
                dic[dtoline.SpitOrderFlag].Add(dtoline);
            }
            foreach (string key in dic.Keys)
            {
                List <CarShipLineDTO> listLineDTO = dic[key];

                if (listLineDTO != null &&
                    listLineDTO.Count > 0
                    )
                {
                    CarShipLineDTO firstDTO = listLineDTO.GetFirst <CarShipLineDTO>();

                    UFIDA.U9.ISV.SM.ShipDTOForIndustryChainData shipdto = new UFIDA.U9.ISV.SM.ShipDTOForIndustryChainData();
                    shipdto.CreatedBy  = (Context.LoginUser);
                    shipdto.ModifiedBy = (Context.LoginUser);
                    string doctypecode = string.Empty;
                    shipdto.DocumentType = (new CommonArchiveDataDTOData());
                    if (firstDTO.OrderType == 401103 && firstDTO.IsSale)
                    {
                        doctypecode = "XM7";
                    }
                    else if (firstDTO.VehicleOrChassis == 400102)
                    {
                        doctypecode = "XM4";
                    }
                    else
                    {
                        doctypecode = "XM1";
                    }
                    shipdto.DocumentType.Code = (doctypecode);
                    long        ConfirmAccording = -1L;
                    int         ConfirmMode      = -1;
                    long        ConfirmTerm      = -1L;
                    long        InvoiceAccording = -1L;
                    long        ReceivableTerm   = -1L;
                    ShipDocType doctype          = ShipDocType.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), doctypecode), new OqlParam[0]);
                    if (doctype != null)
                    {
                        if (doctype.ConfirmAccordingKey != null)
                        {
                            ConfirmAccording = doctype.ConfirmAccordingKey.ID;
                        }
                        if (doctype.ConfirmMode.Value >= 0)
                        {
                            ConfirmMode = doctype.ConfirmMode.Value;
                        }
                        if (doctype.InvoiceAccordingKey != null)
                        {
                            InvoiceAccording = doctype.InvoiceAccordingKey.ID;
                        }
                    }
                    Customer customer = Customer.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), firstDTO.DealerCode), new OqlParam[0]);
                    if (customer != null)
                    {
                        if (customer.ARConfirmTermKey != null)
                        {
                            ConfirmTerm = customer.ARConfirmTermKey.ID;
                        }
                        if (customer.RecervalTermKey != null)
                        {
                            ReceivableTerm = customer.RecervalTermKey.ID;
                        }
                        shipdto.BargainMode  = (customer.Bargain.Value);
                        shipdto.ShipmentRule = (new CommonArchiveDataDTOData());
                        if (customer.ShippmentRule != null)
                        {
                            shipdto.ShipmentRule.Code = (customer.ShippmentRule.Code);
                        }
                        else
                        {
                            shipdto.ShipmentRule.Code = ("C001");
                        }
                        if (customer.RecervalTerm != null)
                        {
                            string RecTerm = customer.RecervalTerm.Code;
                        }
                    }
                    else
                    {
                        shipdto.ShipmentRule.Code = ("C001");
                        shipdto.BargainMode       = (0);
                    }
                    shipdto.SrcDocType     = (0);
                    shipdto.ReceivableTerm = (new CommonArchiveDataDTOData());
                    if (ReceivableTerm > 0L)
                    {
                        shipdto.ReceivableTerm.ID = (ReceivableTerm);
                    }
                    else
                    {
                        shipdto.ReceivableTerm.Code = ("01");
                    }
                    shipdto.ConfirmTerm = (new CommonArchiveDataDTOData());
                    if (ConfirmTerm > 0L)
                    {
                        shipdto.ConfirmTerm.ID = (ConfirmTerm);
                    }
                    else
                    {
                        shipdto.ConfirmTerm.Code = ("01");
                    }
                    shipdto.ConfirmAccording    = (new CommonArchiveDataDTOData());
                    shipdto.ConfirmAccording.ID = (ConfirmAccording);
                    shipdto.ConfirmMode         = ((ConfirmMode < 0) ? 0 : ConfirmMode);
                    shipdto.InvoiceAccording    = (new CommonArchiveDataDTOData());
                    shipdto.InvoiceAccording.ID = (InvoiceAccording);
                    shipdto.Seller      = (new CommonArchiveDataDTOData());
                    shipdto.Seller.Code = (opeatorstr);
                    Operators opeator = Operators.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), opeatorstr), new OqlParam[0]);
                    if (opeator != null)
                    {
                        shipdto.SaleDept    = (new CommonArchiveDataDTOData());
                        shipdto.SaleDept.ID = (opeator.DeptKey.ID);
                    }
                    shipdto.CreatedBy                     = (Context.LoginUser);
                    shipdto.CreatedOn                     = (System.DateTime.Now);
                    shipdto.OrderBy                       = (new CommonArchiveDataDTOData());
                    shipdto.OrderBy.Code                  = (firstDTO.DealerCode);
                    shipdto.AC                            = (new CommonArchiveDataDTOData());
                    shipdto.AC.Code                       = (string.IsNullOrEmpty(firstDTO.Currency) ? "C001" : firstDTO.Currency);
                    shipdto.TC                            = (new CommonArchiveDataDTOData());
                    shipdto.TC.Code                       = (string.IsNullOrEmpty(firstDTO.Currency) ? "C001" : firstDTO.Currency);
                    shipdto.DescFlexField                 = (new DescFlexSegmentsData());
                    shipdto.DescFlexField.PubDescSeg5     = (firstDTO.DmsSaleNo);
                    shipdto.DescFlexField.PrivateDescSeg1 = (firstDTO.DMSShipNo);
                    System.DateTime arg_5CD_0 = firstDTO.ShipDate;
                    if (firstDTO.ShipDate != System.DateTime.MinValue && firstDTO.ShipDate > System.DateTime.Now)
                    {
                        shipdto.BusinessDate = (firstDTO.ShipDate);
                    }
                    else
                    {
                        shipdto.BusinessDate = (System.DateTime.Now);
                    }
                    shipdto.ShipLines = (new System.Collections.Generic.List <UFIDA.U9.ISV.SM.ShipLineDTOForIndustryChainData>());
                    foreach (CarShipLineDTO linedto in listLineDTO)
                    {
                        UFIDA.U9.ISV.SM.ShipLineDTOForIndustryChainData shiplinedto = new UFIDA.U9.ISV.SM.ShipLineDTOForIndustryChainData();
                        shiplinedto.ItemInfo            = (new ItemInfoData());
                        shiplinedto.ItemInfo.ItemCode   = (linedto.ErpMaterialCode);
                        shiplinedto.ShipQtyTUAmount     = (linedto.Number);
                        shiplinedto.TotalMoneyTC        = (linedto.Money);
                        shiplinedto.TotalNetMoneyTC     = (linedto.Money);
                        shiplinedto.Project             = (new CommonArchiveDataDTOData());
                        shiplinedto.Project.Code        = (linedto.DmsSaleNo);
                        shiplinedto.ConfirmAccording    = (new CommonArchiveDataDTOData());
                        shiplinedto.ConfirmAccording.ID = (ConfirmAccording);
                        shiplinedto.ConfirmMode         = ((ConfirmMode < 0) ? 0 : ConfirmMode);
                        shiplinedto.ConfirmTerm         = (new CommonArchiveDataDTOData());
                        if (ConfirmTerm > 0L)
                        {
                            shiplinedto.ConfirmTerm.ID = (ConfirmTerm);
                        }
                        else
                        {
                            shiplinedto.ConfirmTerm.Code = ("01");
                        }
                        shiplinedto.InvoiceAccording    = (new CommonArchiveDataDTOData());
                        shiplinedto.InvoiceAccording.ID = (InvoiceAccording);
                        shiplinedto.ReceivableTerm      = (new CommonArchiveDataDTOData());
                        if (ReceivableTerm > 0L)
                        {
                            shiplinedto.ReceivableTerm.ID = (ReceivableTerm);
                        }
                        else
                        {
                            shiplinedto.ReceivableTerm.Code = ("01");
                        }
                        shiplinedto.WH = (new CommonArchiveDataDTOData());
                        string whcode = string.Empty;

                        /*  OrderType
                         * 401102;//预测订单
                         * 401101;//追加订单
                         * 401103;//监控车订单
                         * 401104;//储备订单
                         */
                        /*
                         * 0080	储运整车库
                         * 0081	储运车库2
                         * 0090	储运二类底盘库
                         */
                        /*
                         * 是不是 监控车订单,从 储运车库2 (0081) 发车;
                         * 底盘,从 储运二类底盘库 (0090) 发车;
                         * 其他订单,从  储运整车库 (0080) 发车?
                         */
                        if (firstDTO.OrderType == 401103 && firstDTO.IsSale)
                        {
                            whcode = "0081";
                        }
                        else if (firstDTO.VehicleOrChassis == 400102)
                        {
                            whcode = "0090";
                        }
                        else
                        {
                            whcode = "0080";
                        }
                        shiplinedto.WH.Code = (whcode);
                        Warehouse whout = Warehouse.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), whcode), new OqlParam[0]);
                        if (whout != null && whout.DepositType == DepositTypeEnum.VMI)
                        {
                            shiplinedto.VMI = (true);
                            //shiplinedto.VMI = whout.DepositType == DepositTypeEnum.VMI;
                            if (whout.Supplier != null)
                            {
                                shiplinedto.Supplier      = (new CommonArchiveDataDTOData());
                                shiplinedto.Supplier.Code = (whout.Supplier.Code);
                            }
                        }
                        shiplinedto.DescFlexField             = (new DescFlexSegmentsData());
                        shiplinedto.DescFlexField.PubDescSeg5 = (linedto.DmsSaleNo);
                        shiplinedto.Project      = (new CommonArchiveDataDTOData());
                        shiplinedto.Project.Code = (linedto.DmsSaleNo);
                        shiplinedto.DescFlexField.PubDescSeg13 = (linedto.EarnestMoney.ToString());
                        shiplinedto.DescFlexField.PubDescSeg14 = ((linedto.ShipMoney <= 0m) ? (linedto.Money - linedto.EarnestMoney).ToString() : linedto.ShipMoney.ToString());
                        shiplinedto.DescFlexField.PubDescSeg21 = (linedto.Deposit.ToString());
                        shiplinedto.DescFlexField.PubDescSeg12 = (linedto.VIN);
                        shipdto.ShipLines.Add(shiplinedto);
                    }
                    list.Add(shipdto);
                }
            }
            return(list);
        }
        /// <summary>
        /// 得到出货单dto
        /// </summary>
        /// <param name="bpObj"></param>
        /// <returns></returns>
        private System.Collections.Generic.List<UFIDA.U9.ISV.SM.ShipDTOForIndustryChainData> GetShipDTOList(System.Collections.Generic.List<CarShipLineDTO> shiplist)
        {
            System.Collections.Generic.List<UFIDA.U9.ISV.SM.ShipDTOForIndustryChainData> list = new System.Collections.Generic.List<UFIDA.U9.ISV.SM.ShipDTOForIndustryChainData>();
            //string opeatorstr = "DMSTESTUSER";
            //string opeatorstr = "DMS";
            string opeatorstr = HBHCommon.DefaultShipOperatorCode;
            System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<CarShipLineDTO>> dic = new System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<CarShipLineDTO>>();
            foreach (CarShipLineDTO dtoline in shiplist)
            {
                if (!dic.ContainsKey(dtoline.SpitOrderFlag))
                {
                    dic.Add(dtoline.SpitOrderFlag, new System.Collections.Generic.List<CarShipLineDTO>());
                }
                dic[dtoline.SpitOrderFlag].Add(dtoline);
            }
            foreach (string key in dic.Keys)
            {
                List<CarShipLineDTO> listLineDTO = dic[key];

                if (listLineDTO != null
                    && listLineDTO.Count > 0
                    )
                {
                    CarShipLineDTO firstDTO = listLineDTO.GetFirst<CarShipLineDTO>();

                    UFIDA.U9.ISV.SM.ShipDTOForIndustryChainData shipdto = new UFIDA.U9.ISV.SM.ShipDTOForIndustryChainData();
                    shipdto.CreatedBy = (Context.LoginUser);
                    shipdto.ModifiedBy = (Context.LoginUser);
                    string doctypecode = string.Empty;
                    shipdto.DocumentType = (new CommonArchiveDataDTOData());
                    if (firstDTO.OrderType == 401103 && firstDTO.IsSale)
                    {
                        doctypecode = "XM7";
                    }
                    else if (firstDTO.VehicleOrChassis == 400102)
                    {
                        doctypecode = "XM4";
                    }
                    else
                    {
                        doctypecode = "XM1";
                    }
                    shipdto.DocumentType.Code = (doctypecode);
                    long ConfirmAccording = -1L;
                    int ConfirmMode = -1;
                    long ConfirmTerm = -1L;
                    long InvoiceAccording = -1L;
                    long ReceivableTerm = -1L;
                    ShipDocType doctype = ShipDocType.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), doctypecode), new OqlParam[0]);
                    if (doctype != null)
                    {
                        if (doctype.ConfirmAccordingKey != null)
                        {
                            ConfirmAccording = doctype.ConfirmAccordingKey.ID;
                        }
                        if (doctype.ConfirmMode.Value >= 0)
                        {
                            ConfirmMode = doctype.ConfirmMode.Value;
                        }
                        if (doctype.InvoiceAccordingKey != null)
                        {
                            InvoiceAccording = doctype.InvoiceAccordingKey.ID;
                        }
                    }
                    Customer customer = Customer.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), firstDTO.DealerCode), new OqlParam[0]);
                    if (customer != null)
                    {
                        if (customer.ARConfirmTermKey != null)
                        {
                            ConfirmTerm = customer.ARConfirmTermKey.ID;
                        }
                        if (customer.RecervalTermKey != null)
                        {
                            ReceivableTerm = customer.RecervalTermKey.ID;
                        }
                        shipdto.BargainMode = (customer.Bargain.Value);
                        shipdto.ShipmentRule = (new CommonArchiveDataDTOData());
                        if (customer.ShippmentRule != null)
                        {
                            shipdto.ShipmentRule.Code = (customer.ShippmentRule.Code);
                        }
                        else
                        {
                            shipdto.ShipmentRule.Code = ("C001");
                        }
                        if (customer.RecervalTerm != null)
                        {
                            string RecTerm = customer.RecervalTerm.Code;
                        }
                    }
                    else
                    {
                        shipdto.ShipmentRule.Code = ("C001");
                        shipdto.BargainMode = (0);
                    }
                    shipdto.SrcDocType = (0);
                    shipdto.ReceivableTerm = (new CommonArchiveDataDTOData());
                    if (ReceivableTerm > 0L)
                    {
                        shipdto.ReceivableTerm.ID = (ReceivableTerm);
                    }
                    else
                    {
                        shipdto.ReceivableTerm.Code = ("01");
                    }
                    shipdto.ConfirmTerm = (new CommonArchiveDataDTOData());
                    if (ConfirmTerm > 0L)
                    {
                        shipdto.ConfirmTerm.ID = (ConfirmTerm);
                    }
                    else
                    {
                        shipdto.ConfirmTerm.Code = ("01");
                    }
                    shipdto.ConfirmAccording = (new CommonArchiveDataDTOData());
                    shipdto.ConfirmAccording.ID = (ConfirmAccording);
                    shipdto.ConfirmMode = ((ConfirmMode < 0) ? 0 : ConfirmMode);
                    shipdto.InvoiceAccording = (new CommonArchiveDataDTOData());
                    shipdto.InvoiceAccording.ID = (InvoiceAccording);
                    shipdto.Seller = (new CommonArchiveDataDTOData());
                    shipdto.Seller.Code = (opeatorstr);
                    Operators opeator = Operators.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), opeatorstr), new OqlParam[0]);
                    if (opeator != null)
                    {
                        shipdto.SaleDept = (new CommonArchiveDataDTOData());
                        shipdto.SaleDept.ID = (opeator.DeptKey.ID);
                    }
                    shipdto.CreatedBy = (Context.LoginUser);
                    shipdto.CreatedOn = (System.DateTime.Now);
                    shipdto.OrderBy = (new CommonArchiveDataDTOData());
                    shipdto.OrderBy.Code = (firstDTO.DealerCode);
                    shipdto.AC = (new CommonArchiveDataDTOData());
                    shipdto.AC.Code = (string.IsNullOrEmpty(firstDTO.Currency) ? "C001" : firstDTO.Currency);
                    shipdto.TC = (new CommonArchiveDataDTOData());
                    shipdto.TC.Code = (string.IsNullOrEmpty(firstDTO.Currency) ? "C001" : firstDTO.Currency);
                    shipdto.DescFlexField = (new DescFlexSegmentsData());
                    shipdto.DescFlexField.PubDescSeg5 = (firstDTO.DmsSaleNo);
                    shipdto.DescFlexField.PrivateDescSeg1 = (firstDTO.DMSShipNo);
                    System.DateTime arg_5CD_0 = firstDTO.ShipDate;
                    if (firstDTO.ShipDate != System.DateTime.MinValue && firstDTO.ShipDate > System.DateTime.Now)
                    {
                        shipdto.BusinessDate = (firstDTO.ShipDate);
                    }
                    else
                    {
                        shipdto.BusinessDate = (System.DateTime.Now);
                    }
                    shipdto.ShipLines = (new System.Collections.Generic.List<UFIDA.U9.ISV.SM.ShipLineDTOForIndustryChainData>());
                    foreach (CarShipLineDTO linedto in listLineDTO)
                    {
                        UFIDA.U9.ISV.SM.ShipLineDTOForIndustryChainData shiplinedto = new UFIDA.U9.ISV.SM.ShipLineDTOForIndustryChainData();
                        shiplinedto.ItemInfo = (new ItemInfoData());
                        shiplinedto.ItemInfo.ItemCode = (linedto.ErpMaterialCode);
                        shiplinedto.ShipQtyTUAmount = (linedto.Number);
                        shiplinedto.TotalMoneyTC = (linedto.Money);
                        shiplinedto.TotalNetMoneyTC = (linedto.Money);
                        shiplinedto.Project = (new CommonArchiveDataDTOData());
                        shiplinedto.Project.Code = (linedto.DmsSaleNo);
                        shiplinedto.ConfirmAccording = (new CommonArchiveDataDTOData());
                        shiplinedto.ConfirmAccording.ID = (ConfirmAccording);
                        shiplinedto.ConfirmMode = ((ConfirmMode < 0) ? 0 : ConfirmMode);
                        shiplinedto.ConfirmTerm = (new CommonArchiveDataDTOData());
                        if (ConfirmTerm > 0L)
                        {
                            shiplinedto.ConfirmTerm.ID = (ConfirmTerm);
                        }
                        else
                        {
                            shiplinedto.ConfirmTerm.Code = ("01");
                        }
                        shiplinedto.InvoiceAccording = (new CommonArchiveDataDTOData());
                        shiplinedto.InvoiceAccording.ID = (InvoiceAccording);
                        shiplinedto.ReceivableTerm = (new CommonArchiveDataDTOData());
                        if (ReceivableTerm > 0L)
                        {
                            shiplinedto.ReceivableTerm.ID = (ReceivableTerm);
                        }
                        else
                        {
                            shiplinedto.ReceivableTerm.Code = ("01");
                        }
                        shiplinedto.WH = (new CommonArchiveDataDTOData());
                        string whcode = string.Empty;
                        /*  OrderType
                        401102;//预测订单
                        401101;//追加订单
                        401103;//监控车订单
                        401104;//储备订单
                         */
                        /*
                        0080	储运整车库
                        0081	储运车库2
                        0090	储运二类底盘库
                         */
                        /*
                        是不是 监控车订单,从 储运车库2 (0081) 发车;
            底盘,从 储运二类底盘库 (0090) 发车;
            其他订单,从  储运整车库 (0080) 发车?
                         */
                        if (firstDTO.OrderType == 401103 && firstDTO.IsSale)
                        {
                            whcode = "0081";
                        }
                        else if (firstDTO.VehicleOrChassis == 400102)
                        {
                            whcode = "0090";
                        }
                        else
                        {
                            whcode = "0080";
                        }
                        shiplinedto.WH.Code = (whcode);
                        Warehouse whout = Warehouse.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), whcode), new OqlParam[0]);
                        if (whout != null && whout.DepositType == DepositTypeEnum.VMI)
                        {
                            shiplinedto.VMI = (true);
                            //shiplinedto.VMI = whout.DepositType == DepositTypeEnum.VMI;
                            if (whout.Supplier != null)
                            {
                                shiplinedto.Supplier = (new CommonArchiveDataDTOData());
                                shiplinedto.Supplier.Code = (whout.Supplier.Code);
                            }
                        }
                        shiplinedto.DescFlexField = (new DescFlexSegmentsData());
                        shiplinedto.DescFlexField.PubDescSeg5 = (linedto.DmsSaleNo);
                        shiplinedto.Project = (new CommonArchiveDataDTOData());
                        shiplinedto.Project.Code = (linedto.DmsSaleNo);
                        shiplinedto.DescFlexField.PubDescSeg13 = (linedto.EarnestMoney.ToString());
                        shiplinedto.DescFlexField.PubDescSeg14 = ((linedto.ShipMoney <= 0m) ? (linedto.Money - linedto.EarnestMoney).ToString() : linedto.ShipMoney.ToString());
                        shiplinedto.DescFlexField.PubDescSeg21 = (linedto.Deposit.ToString());
                        shiplinedto.DescFlexField.PubDescSeg12 = (linedto.VIN);
                        shipdto.ShipLines.Add(shiplinedto);
                    }
                    list.Add(shipdto);
                }
            }
            return list;
        }