Esempio n. 1
0
        public string Add_FinishCodeAndName()
        {
            string dataLine = null;

            codeAndNameList = _orderInformationsFromArticles.GetGenericCatalogFinishCodeAndName();

            if (codeAndNameList != null && codeAndNameList.Count > 0)
            {
                codeAndNameList.RemoveAt(0); //Del the index 0 cause we don't need model here

                for (int i = 0; i < codeAndNameList.Count; i++)
                {
                    //string codeAndNameLine = codeAndNameList[i];
                    string[] codeAndName = codeAndNameList[i].Split(KD.CharTools.Const.SemiColon);
                    if (codeAndName.Length == 4)
                    {
                        string code = Tools.DelCharAndAllAfter(codeAndName[0], KD.StringTools.Const.Underscore);
                        code = Tools.DelCharAndAllAfter(code, KD.StringTools.Const.Colon);
                        code = _orderInformationsFromArticles.ReleaseChar(code);

                        if (utility.IsPlinth(codeAndName[3]))//Cause exept plinth height 402 //KD.StringTools.Const.TrueCamelCase
                        {
                            continue;
                        }
                        string name = codeAndName[2];
                        name = _orderInformationsFromArticles.ReleaseChar(name);

                        // put the same code an name when code = IDEM
                        if (code == OrderConstants.IdemFinishCode)
                        {
                            if (i >= 1 & codeAndNameList[i - 1] != null & !String.IsNullOrEmpty(codeAndNameList[i - 1]))
                            {
                                string[] idemCodeAndName = codeAndNameList[i - 1].Split(KD.CharTools.Const.SemiColon);
                                if (idemCodeAndName.Length == 4)
                                {
                                    code = Tools.DelCharAndAllAfter(idemCodeAndName[0], KD.StringTools.Const.Underscore);
                                    code = Tools.DelCharAndAllAfter(code, KD.StringTools.Const.Colon);
                                    code = _orderInformationsFromArticles.ReleaseChar(code);

                                    name = idemCodeAndName[2];
                                    name = _orderInformationsFromArticles.ReleaseChar(name);
                                }
                            }
                        }

                        int nameCharStart = 0;
                        for (int c = 0; c < UtilitySegment.finishLineMaxNb; c++)
                        {
                            code = utility.GetCodeLen(code);

                            StringBuilder codeStringBuilder = utility.CodeStringBuilder(code);
                            StringBuilder nameStringBuilder = utility.NameStringBuilder(name, nameCharStart);

                            c212.E7140 = codeStringBuilder.ToString() + nameStringBuilder.ToString();
                            string finishAppairage = _fileEDI.FinishTypeVariant(codeAndName[3]);

                            if (!String.IsNullOrEmpty(finishAppairage) && finishAppairage.Contains(KD.StringTools.Const.Pipe))
                            {
                                finishAppairage = String.Empty;
                            }

                            c212.E7143 = finishAppairage;
                            c212.E3055 = C212.E3055_91;

                            OrderWrite.segmentNumberBetweenUNHandUNT += 1;
                            dataLine      += BuildLine();
                            nameCharStart += UtilitySegment.nameCharLen;

                            name = utility.GetFollowingChar(name, UtilitySegment.nameCharLen);
                            if (String.IsNullOrEmpty(name))
                            {
                                break;
                            }
                        }
                    }
                }
            }
            return(dataLine);
        }
Esempio n. 2
0
        public string Add_FinishCodeAndName(Article article)
        {
            string        dataLine = null;
            List <string> GenericCodeAndNameList = new List <string>();

            GenericCodeAndNameList = _orderInformationsFromArticles.GetGenericCatalogFinishCodeAndName();

            if (GenericCodeAndNameList != null && GenericCodeAndNameList.Count > 0)
            {
                OrderInformations articleInformations = new OrderInformations(article);
                List <string>     codeAndNameList     = new List <string>();

                codeAndNameList = articleInformations.GetFinishCodeAndName();// article);
                if (codeAndNameList != null && codeAndNameList.Count > 0)
                {
                    //foreach (string codeAndNameLine in codeAndNameList)
                    //{
                    for (int i = 0; i < codeAndNameList.Count; i++)
                    {
                        //string codeAndNameLine = codeAndNameList[i];
                        if (codeAndNameList[i].StartsWith(OrderConstants.IdemFinishCode) || !GenericCodeAndNameList.Contains(codeAndNameList[i]))
                        {
                            //string[] codeAndName = codeAndNameLine.Split(KD.CharTools.Const.SemiColon);
                            string[] codeAndName = codeAndNameList[i].Split(KD.CharTools.Const.SemiColon);
                            if (codeAndName.Length == 4)
                            {
                                string code = Tools.DelCharAndAllAfter(codeAndName[0], KD.StringTools.Const.Underscore);
                                code = Tools.DelCharAndAllAfter(code, KD.StringTools.Const.Colon);
                                code = _orderInformationsFromArticles.ReleaseChar(code);

                                if (utility.IsAssemblyWorktop(codeAndName[3]))
                                {
                                    continue;
                                }
                                string name = codeAndName[2];
                                name = _orderInformationsFromArticles.ReleaseChar(name);

                                // put the same code an name when code = IDEM
                                if (code == OrderConstants.IdemFinishCode)
                                {
                                    if (i >= 1 & codeAndNameList[i - 1] != null & !String.IsNullOrEmpty(codeAndNameList[i - 1]))
                                    {
                                        if (GenericCodeAndNameList.Contains(codeAndNameList[i - 1]))
                                        {
                                            continue;
                                        }
                                        string[] idemCodeAndName = codeAndNameList[i - 1].Split(KD.CharTools.Const.SemiColon);
                                        if (idemCodeAndName.Length == 4)
                                        {
                                            code = Tools.DelCharAndAllAfter(idemCodeAndName[0], KD.StringTools.Const.Underscore);
                                            code = Tools.DelCharAndAllAfter(code, KD.StringTools.Const.Colon);
                                            code = _orderInformationsFromArticles.ReleaseChar(code);

                                            name = idemCodeAndName[2];
                                            name = _orderInformationsFromArticles.ReleaseChar(name);
                                        }
                                    }
                                }

                                int nameCharStart = 0;

                                for (int c = 0; c < 2; c++)
                                {
                                    _e4347 = PIA_A.E4347_5;
                                    code   = utility.GetCodeLen(code);

                                    StringBuilder codeStringBuilder = utility.CodeStringBuilder(code);
                                    StringBuilder nameStringBuilder = utility.NameStringBuilder(name, nameCharStart);

                                    c212.E7140 = codeStringBuilder.ToString() + nameStringBuilder.ToString();
                                    c212.E7143 = KD.StringTools.Const.One;
                                    if (!utility.IsModel(codeAndName[3]))
                                    {
                                        c212.E7143 = _fileEDI.FinishTypeVariant(codeAndName[3]);
                                        if (!String.IsNullOrEmpty(c212.E7143) && c212.E7143.Contains(KD.StringTools.Const.Pipe))
                                        {
                                            c212.E7143 = String.Empty;
                                        }
                                    }

                                    c212.E3055 = C212.E3055_91;

                                    if (String.IsNullOrEmpty(code))
                                    {
                                        c212.E3055 = C212.E3055_92;
                                    }

                                    dataLine += BuildLine();

                                    OrderWrite.segmentNumberBetweenUNHandUNT += 1;
                                    nameCharStart += UtilitySegment.nameCharLen;

                                    name = utility.GetFollowingChar(name, UtilitySegment.nameCharLen);
                                    if (String.IsNullOrEmpty(name))
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(dataLine);
        }