예제 #1
0
        //验证数据格式  上衣  裤子  特殊上衣  特殊裤子
        public string isSYorKZTo(List <DCL_DataDto> data)
        {
            try
            {
                string[] Zz = new string[2];

                Zz[0] = "^[0-9]{2,3}/[0-9A-z]{2,4}$";    //普通裤子

                Zz[1] = @"[0-9]{2,3}/\w{2,4}/[A-Z_a-z]"; //普通上衣

                string action = "";

                foreach (var item in data)
                {
                    for (int i = 0; i < Zz.Length; i++)
                    {
                        Regex Regex = new Regex(Zz[i]);

                        string gender = "";

                        string SizeCode = item.SizeCode;

                        if (!string.IsNullOrEmpty(SizeCode))
                        {
                            if (XF_SY_NAN_ChiMaService.GetOne(T => T.Size_Code == SizeCode) != null)
                            {
                                gender = "NAN";
                            }
                            else if (XF_SY_NU_ChiMaService.GetOne(T => T.Size_Code == SizeCode) != null)
                            {
                                gender = "NU";
                            }
                            else if (XF_KZ_CodeSizeService.GetOne(T => T.Size_Code == SizeCode) != null)
                            {
                                gender = "NAN";
                            }
                            else
                            {
                                throw new CustomCatch(2, "没有对应的尺码数据,请检查尺码表号");
                            }
                        }
                        else
                        {
                            throw new CustomCatch(2, "数据中没有尺码表号,请补充");
                        }

                        if (Regex.IsMatch(item.ReCodeSize))
                        {
                            string lisaction = "";

                            switch (i)
                            {
                            case 1:    //普通上衣
                                action    = "XF_SY_" + gender;
                                lisaction = "XF_SY_" + gender;
                                break;

                            case 0:    //普通裤子
                                action    = "XF_KZ_" + gender;
                                lisaction = "XF_KZ_" + gender;
                                break;

                            default:
                                action = "";
                                break;
                            }

                            if (action != lisaction && action != "")
                            {
                                return("");
                            }
                        }
                    }
                }
                return(action);
            }
            catch (CustomCatch cc)
            {
                throw;
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #2
0
        public bool Handle_XF_SY_NAN(string SizeCode, string GDH)
        {
            List <XF_SY_NAN_ChiMaDto> list = null;

            #region 获取待处理数据

            List <DCL_DataDto> GDData = DCL_DataService.Query(T => T.GDH == GDH, O => O.Id, false);

            #endregion


            try
            {
                #region 开始处理数据

                List <DCL_DataDto> DLCData = new List <DCL_DataDto>();

                #region 判断数据中是否有尺码编号  没有择手动补全

                for (int i = 0; i < GDData.Count; i++)
                {
                    DCL_DataDto dto = new DCL_DataDto();

                    dto = GDData[i];

                    if (string.IsNullOrEmpty(GDData[i].SizeCode))
                    {
                        dto.SizeCode = SizeCode;
                    }

                    DLCData.Add(dto);
                }
                #endregion

                #region   验证此数据是否可以处理

                string Action = isSYorKZTo(DLCData);

                if (isSYorKZTo(DLCData) == "")
                {
                    throw new Exception("此工单号数据不统一或是没有对应的处理程序。");
                }

                #endregion

                DeleteForHanderData(GDH, Action);

                decimal Height;      //身高

                string JingXiongWei; //净胸围

                string XiuChang;     //袖长

                string TeShuShuJu;   //特殊数据

                int index = 1;

                string NetBustNan = "";

                foreach (DCL_DataDto item in DLCData)
                {
                    NetBustNan = item.ReCodeSize.ToString().Split('/')[1];

                    string isT = "[\u4e00-\u9fa5]";

                    Regex Regex = new Regex(isT);

                    string DcHeight = item.ReCodeSize.ToString().Split('/')[0];

                    #region 处理特殊身高

                    if (Regex.IsMatch(DcHeight))
                    {
                        Height = Convert.ToDecimal(DcHeight.Substring(1, DcHeight.Length));
                    }
                    else
                    {
                        Height = Convert.ToDecimal(DcHeight);
                    }

                    #endregion

                    JingXiongWei = item.ReCodeSize.ToString().Split('/')[1];//净胸围

                    Regex rex = new Regex("[\u4e00-\u9fa5]{2}[-/+][0-9]{0,3}");

                    if (Regex.IsMatch(item.ReCodeSize.ToString().Split('/')[2]))
                    {
                        XiuChang = item.ReCodeSize.ToString().Split('/')[2].Substring(0, 1);//袖长
                    }
                    else
                    {
                        XiuChang = item.ReCodeSize.ToString().Split('/')[2];//袖长
                    }

                    //获取尺码表数据
                    XF_SY_NAN_ChiMaDto dtonan = XF_SY_NAN_ChiMaService.GetOne(T => T.Height == Height && T.NetBust == JingXiongWei && T.Size_Code == SizeCode && T.Status == 1);

                    if (dtonan != null)
                    {
                        HanderDataForXF_SYDto sy = new HanderDataForXF_SYDto();

                        sy.Height = dtonan.Height;

                        sy.RtnQCode = item.ReCodeSize.ToString();

                        sy.OrderCode = item.Orderid.ToString();

                        sy.Name = item.Name.ToString();

                        sy.RtnHCode = JingXiongWei;

                        sy.Number = item.Number;

                        sy.GDH = item.GDH;

                        sy.Yichang = Convert.ToDecimal(dtonan.FrontLength);

                        #region 处理袖长
                        string[] Sleecve = dtonan.Sleecve_Show.Split(' ');
                        for (int i = 0; i < Sleecve.Length; i++)
                        {
                            if (Sleecve[i].IndexOf(';') > 0)
                            {
                                if (Sleecve[i].Split(';')[0] == XiuChang)
                                {
                                    sy.Sleeve = Convert.ToDecimal(Sleecve[i].Split(';')[1]);
                                }
                            }
                            else if (Sleecve[i].IndexOf(':') > 0)
                            {
                                if (Sleecve[i].Split(':')[0] == XiuChang)
                                {
                                    sy.Sleeve = Convert.ToDecimal(Sleecve[i].Split(':')[1]);
                                }
                            }
                        }
                        #endregion

                        sy.Bust = dtonan.FinishedBust;

                        sy.Index = index;

                        var TsArrey = rex.Matches(item.ReCodeSize.ToString().Split('/')[2]);

                        #region 處理特躰
                        foreach (Match TsItem in TsArrey)
                        {
                            Regex Tn   = new Regex("[\u4e00-\u9fa5]{2}"); //名称
                            Regex Tysf = new Regex("[-/+]");              //运算符
                            Regex Tv   = new Regex("[0-9]{1,2}");         //值
                            switch (Tn.Match(TsItem.Value).Value)
                            {
                            case "袖长":    //袖长
                                decimal Sleeve = sy.Sleeve;
                                if (Tysf.Match(TsItem.Value).Value == "+")
                                {
                                    sy.Sleeve = Sleeve + Convert.ToInt32(Tv.Match(TsItem.Value));
                                }
                                else
                                {
                                    sy.Sleeve = Sleeve + Convert.ToInt32(Tv.Match(TsItem.Value));
                                }
                                break;

                            case "下摆":    //下摆

                                break;

                            case "三围":    //三围
                                if (Tysf.Match(TsItem.Value).Value == "+")
                                {
                                    sy.Yichang += Convert.ToInt32(Tv.Match(TsItem.Value));
                                    sy.Bust    += Convert.ToInt32(Tv.Match(TsItem.Value));
                                }
                                else
                                {
                                    string xxx = Tv.Match(TsItem.Value).Value;
                                    sy.Yichang -= Convert.ToInt32(Tv.Match(TsItem.Value).Value);
                                    sy.Bust    -= Convert.ToInt32(Tv.Match(TsItem.Value).Value);
                                }
                                break;

                            case "肩宽":    //肩宽

                                break;
                            }
                        }
                        #endregion

                        HanderDataForXF_SYService.Add(sy);
                    }

                    index++;
                }
                #endregion

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }