예제 #1
0
        // 得到调入单dto
        /// <summary>
        /// 得到调入单dto
        /// </summary>
        /// <param name="bpObj"></param>
        /// <returns></returns>
        private System.Collections.Generic.List<UFIDA.U9.ISV.SM.RMADTOData> GetRMADTOList(CreateRMASV bpObj)
        {
            System.Collections.Generic.List<UFIDA.U9.ISV.SM.RMADTOData> list = new System.Collections.Generic.List<UFIDA.U9.ISV.SM.RMADTOData>();
            System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<RMALineDTO>> dic = new System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<RMALineDTO>>();
            foreach (RMALineDTO dtoline in bpObj.RMALineDTOs)
            {
                if (!dic.ContainsKey(dtoline.SpitOrderFlag))
                {
                    dic.Add(dtoline.SpitOrderFlag, new System.Collections.Generic.List<RMALineDTO>());
                }
                dic[dtoline.SpitOrderFlag].Add(dtoline);
            }
            foreach (string key in dic.Keys)
            {
                List<RMALineDTO> listLineDTO = dic[key];

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

                    UFIDA.U9.ISV.SM.RMADTOData rmadto = new UFIDA.U9.ISV.SM.RMADTOData();
                    RMALineDTO dto = firstDTO;
                    rmadto.DocumentTypeDTO = (new IDCodeNameDTOData());
                    rmadto.DocumentTypeDTO.Code = ("H0001");
                    rmadto.KeepAccountsPeriodDTO = (new IDCodeNameDTOData());
                    RMADocType doctype = RMADocType.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), "H0001"), new OqlParam[0]);
                    if (doctype != null)
                    {
                        if (doctype.AccountAccordingKey != null)
                        {
                            rmadto.ConfirmAccordingDTO = (new IDCodeNameDTOData());
                            rmadto.ConfirmAccordingDTO.Code = (doctype.AccountAccording.Code);
                        }
                        if (doctype.BillingMode.Value >= 0)
                        {
                            rmadto.BillingMode = (doctype.BillingMode.Value);
                        }
                        else
                        {
                            rmadto.BillingMode = (0);
                        }
                        if (doctype.InvoiceAccordingKey != null)
                        {
                            rmadto.InvoiceAccordingDTO = (new IDCodeNameDTOData());
                            rmadto.InvoiceAccordingDTO.Code = (doctype.InvoiceAccording.Code);
                        }
                    }
                    else
                    {
                        rmadto.BillingMode = (0);
                    }
                    rmadto.AccrueTermDTO = (new IDCodeNameDTOData());
                    rmadto.AccrueTermDTO.Code = ("01");
                    rmadto.CustomerDTO = (new IDCodeNameDTOData());
                    rmadto.CustomerDTO.Code = (dto.DealerCode);
                    rmadto.ACDTO = (new IDCodeNameDTOData());
                    rmadto.ACDTO.Code = (string.IsNullOrEmpty(dto.Currency) ? "C001" : dto.Currency);
                    rmadto.TCDTO = (new IDCodeNameDTOData());
                    rmadto.TCDTO.Code = (string.IsNullOrEmpty(dto.Currency) ? "C001" : dto.Currency);
                    rmadto.DescFlexField = (new DescFlexSegmentsData());
                    rmadto.DescFlexField.PubDescSeg5 = (dto.DmsSaleNo);
                    rmadto.DescFlexField.PrivateDescSeg1 = (dto.DMSShipNo);
                    rmadto.DescFlexField.PubDescSeg12 = (dto.VIN);
                    rmadto.DescFlexField.PubDescSeg13 = (dto.EarnestMoney.ToString());
                    rmadto.DescFlexField.PubDescSeg14 = ((dto.ShipMoney <= 0m) ? (dto.Money - dto.EarnestMoney).ToString() : dto.ShipMoney.ToString());
                    rmadto.DescFlexField.PubDescSeg21 = (dto.Deposit.ToString());
                    System.DateTime arg_354_0 = dto.ShipDate;
                    if (dto.ShipDate != System.DateTime.MinValue && dto.ShipDate > System.DateTime.Now)
                    {
                        rmadto.BusinessDate = (dto.ShipDate);
                    }
                    else
                    {
                        rmadto.BusinessDate = (System.DateTime.Now);
                    }
                    rmadto.RMALines = (new System.Collections.Generic.List<ISV.SM.RMALineDTOData>());
                    foreach (RMALineDTO linedto in listLineDTO)
                    {
                        ISV.SM.RMALineDTOData rmalinedto = new ISV.SM.RMALineDTOData();
                        rmalinedto.ItemInfoDTO = (new IDCodeNameDTOData());
                        rmalinedto.ItemInfoDTO.Code = (linedto.ErpMaterialCode);
                        rmalinedto.ApplyQtyTU1 = (linedto.Number);
                        rmalinedto.RtnQtyTU1 = (linedto.Number);
                        rmalinedto.RtnQtyPU = (linedto.Number);
                        rmalinedto.ApplyMoneyTC = (linedto.Money);
                        rmalinedto.ApplyNetMoneyTC = (linedto.Money);
                        rmalinedto.ProjectDTO = (new IDCodeNameDTOData());
                        rmalinedto.ProjectDTO.Code = (linedto.DmsSaleNo);
                        rmalinedto.WarehouseDTO = (new IDCodeNameDTOData());
                        rmalinedto.WarehouseDTO.Code = (linedto.WHIn);
                        rmadto.RMALines.Add(rmalinedto);
                    }
                    list.Add(rmadto);
                }
            }
            return list;
        }
예제 #2
0
        // 得到调入单dto
        /// <summary>
        /// 得到调入单dto
        /// </summary>
        /// <param name="bpObj"></param>
        /// <returns></returns>
        private System.Collections.Generic.List <UFIDA.U9.ISV.SM.RMADTOData> GetRMADTOList(CreateRMASV bpObj)
        {
            System.Collections.Generic.List <UFIDA.U9.ISV.SM.RMADTOData> list = new System.Collections.Generic.List <UFIDA.U9.ISV.SM.RMADTOData>();
            System.Collections.Generic.Dictionary <string, System.Collections.Generic.List <RMALineDTO> > dic = new System.Collections.Generic.Dictionary <string, System.Collections.Generic.List <RMALineDTO> >();
            foreach (RMALineDTO dtoline in bpObj.RMALineDTOs)
            {
                if (!dic.ContainsKey(dtoline.SpitOrderFlag))
                {
                    dic.Add(dtoline.SpitOrderFlag, new System.Collections.Generic.List <RMALineDTO>());
                }
                dic[dtoline.SpitOrderFlag].Add(dtoline);
            }
            foreach (string key in dic.Keys)
            {
                List <RMALineDTO> listLineDTO = dic[key];

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

                    UFIDA.U9.ISV.SM.RMADTOData rmadto = new UFIDA.U9.ISV.SM.RMADTOData();
                    RMALineDTO dto = firstDTO;
                    rmadto.DocumentTypeDTO       = (new IDCodeNameDTOData());
                    rmadto.DocumentTypeDTO.Code  = ("H0001");
                    rmadto.KeepAccountsPeriodDTO = (new IDCodeNameDTOData());
                    RMADocType doctype = RMADocType.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), "H0001"), new OqlParam[0]);
                    if (doctype != null)
                    {
                        if (doctype.AccountAccordingKey != null)
                        {
                            rmadto.ConfirmAccordingDTO      = (new IDCodeNameDTOData());
                            rmadto.ConfirmAccordingDTO.Code = (doctype.AccountAccording.Code);
                        }
                        if (doctype.BillingMode.Value >= 0)
                        {
                            rmadto.BillingMode = (doctype.BillingMode.Value);
                        }
                        else
                        {
                            rmadto.BillingMode = (0);
                        }
                        if (doctype.InvoiceAccordingKey != null)
                        {
                            rmadto.InvoiceAccordingDTO      = (new IDCodeNameDTOData());
                            rmadto.InvoiceAccordingDTO.Code = (doctype.InvoiceAccording.Code);
                        }
                    }
                    else
                    {
                        rmadto.BillingMode = (0);
                    }
                    rmadto.AccrueTermDTO      = (new IDCodeNameDTOData());
                    rmadto.AccrueTermDTO.Code = ("01");
                    rmadto.CustomerDTO        = (new IDCodeNameDTOData());
                    rmadto.CustomerDTO.Code   = (dto.DealerCode);
                    rmadto.ACDTO                         = (new IDCodeNameDTOData());
                    rmadto.ACDTO.Code                    = (string.IsNullOrEmpty(dto.Currency) ? "C001" : dto.Currency);
                    rmadto.TCDTO                         = (new IDCodeNameDTOData());
                    rmadto.TCDTO.Code                    = (string.IsNullOrEmpty(dto.Currency) ? "C001" : dto.Currency);
                    rmadto.DescFlexField                 = (new DescFlexSegmentsData());
                    rmadto.DescFlexField.PubDescSeg5     = (dto.DmsSaleNo);
                    rmadto.DescFlexField.PrivateDescSeg1 = (dto.DMSShipNo);
                    rmadto.DescFlexField.PubDescSeg12    = (dto.VIN);
                    rmadto.DescFlexField.PubDescSeg13    = (dto.EarnestMoney.ToString());
                    rmadto.DescFlexField.PubDescSeg14    = ((dto.ShipMoney <= 0m) ? (dto.Money - dto.EarnestMoney).ToString() : dto.ShipMoney.ToString());
                    rmadto.DescFlexField.PubDescSeg21    = (dto.Deposit.ToString());
                    System.DateTime arg_354_0 = dto.ShipDate;
                    if (dto.ShipDate != System.DateTime.MinValue && dto.ShipDate > System.DateTime.Now)
                    {
                        rmadto.BusinessDate = (dto.ShipDate);
                    }
                    else
                    {
                        rmadto.BusinessDate = (System.DateTime.Now);
                    }
                    rmadto.RMALines = (new System.Collections.Generic.List <ISV.SM.RMALineDTOData>());
                    foreach (RMALineDTO linedto in listLineDTO)
                    {
                        ISV.SM.RMALineDTOData rmalinedto = new ISV.SM.RMALineDTOData();
                        rmalinedto.ItemInfoDTO       = (new IDCodeNameDTOData());
                        rmalinedto.ItemInfoDTO.Code  = (linedto.ErpMaterialCode);
                        rmalinedto.ApplyQtyTU1       = (linedto.Number);
                        rmalinedto.RtnQtyTU1         = (linedto.Number);
                        rmalinedto.RtnQtyPU          = (linedto.Number);
                        rmalinedto.ApplyMoneyTC      = (linedto.Money);
                        rmalinedto.ApplyNetMoneyTC   = (linedto.Money);
                        rmalinedto.ProjectDTO        = (new IDCodeNameDTOData());
                        rmalinedto.ProjectDTO.Code   = (linedto.DmsSaleNo);
                        rmalinedto.WarehouseDTO      = (new IDCodeNameDTOData());
                        rmalinedto.WarehouseDTO.Code = (linedto.WHIn);
                        rmadto.RMALines.Add(rmalinedto);
                    }
                    list.Add(rmadto);
                }
            }
            return(list);
        }