Example #1
0
        public string Add_LongPartType(Article article)
        {
            if (utility.HasBlockSet(article))
            {
                _e4347     = PIA_A.E4347_1;
                c212.E7140 = C212.E7140_100;
                c212.E7143 = C212.E7143_BK;
                c212.E3055 = C212.E3055_91;

                OrderWrite.segmentNumberBetweenUNHandUNT += 1;
                return(this.BuildLine());
            }
            else
            {
                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)
                    {
                        string[] codeAndName = codeAndNameLine.Split(KD.CharTools.Const.SemiColon);
                        if (codeAndName.Length == 4)
                        {
                            _e4347     = PIA_A.E4347_1;
                            c212.E7140 = utility.GetLongPartType(codeAndName[3]);
                            c212.E7143 = C212.E7143_BK;
                            c212.E3055 = C212.E3055_91;

                            if (!String.IsNullOrEmpty(c212.E7140))
                            {
                                OrderWrite.segmentNumberBetweenUNHandUNT += 1;
                                return(this.BuildLine());
                            }
                        }
                    }
                }
            }
            return(null);
        }
Example #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);
        }