Exemple #1
0
 /// <summary>
 /// 编辑xf_sy_nan_chima
 /// </summary>
 /// <param name="dto">实体</param>
 /// <returns></returns>
 public bool Update(XF_SY_NAN_ChiMaDto dto)
 {
     using (var scope = _dbScopeFactory.Create())
     {
         var db     = GetDb(scope);
         var dbSet  = GetDbSet(db);
         var entity = Mapper.Map <XF_SY_NAN_ChiMaDto, XF_SY_NAN_ChiMaEntity>(dto);
         dbSet.AddOrUpdate(entity);
         return(db.SaveChanges() > 0);
     }
 }
        public JsonResult DeleteCode(FormCollection fm)
        {
            try
            {
                int Id;
                if (!int.TryParse(fm["Id"], out Id))
                {
                    throw new Exception("系统出错:Id格式错误");
                }

                switch (fm["Action"])
                {
                case "XF_SY_NAN":

                    XF_SY_NAN_ChiMaDto dto = XF_SY_NAN_ChiMa.GetOne(T => T.Id == Id);
                    dto.IsDeleted = true;
                    XF_SY_NAN_ChiMa.Update(dto);

                    break;

                case "XF_SY_NU":

                    XF_SY_NU_CodeSizeDto dtonu = XF_SY_NU_ChiMa.GetOne(T => T.Id == Id);
                    dtonu.IsDeleted = true;
                    XF_SY_NU_ChiMa.Update(dtonu);

                    break;

                case "XF_KZ_NAN":
                case "XF_KZ_NU":

                    XF_KZ_CodeSizeDto dtokz = XF_KZ_CodeSizeService.GetOne(T => T.Id == Id);
                    dtokz.IsDeleted = true;
                    XF_KZ_CodeSizeService.Update(dtokz);

                    break;
                }
                return(Json(new { state = 1, msg = "" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { state = -1, msg = ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }
Exemple #3
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;
            }
        }
        //上传西服上衣尺码表
        public bool Import_XF_SY(DataTable table, string size_code, string gender, out string errmsg)
        {
            try
            {
                List <XF_SY_NAN_ChiMaDto> list = new List <XF_SY_NAN_ChiMaDto>();

                for (int i = 0; i < table.Rows.Count; i++)
                {
                    #region 处理不符合要求得数据

                    DataRow row = table.Rows[i];

                    row.BeginEdit();

                    for (int a = 0; a < table.Columns.Count; a++)
                    {
                        if (row[a].ToString().IndexOf("....") > 0)
                        {
                            row[a] = row[a].ToString().Replace("....", ".");
                        }
                        if (row[a].ToString().IndexOf("...") > 0)
                        {
                            row[a] = row[a].ToString().Replace("...", ".");
                        }
                        if (row[a].ToString().IndexOf("..") > 0)
                        {
                            row[a] = row[a].ToString().Replace("..", ".");
                        }
                    }

                    row.EndEdit();
                    #endregion
                }

                if (gender == "男")
                {
                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        XF_SY_NAN_ChiMaDto cs = new XF_SY_NAN_ChiMaDto();

                        cs.Height = Convert.ToDecimal(table.Rows[i]["Height"]);

                        cs.FrontLength = table.Rows[i]["FrontLength"] + "";

                        cs.NetBust = table.Rows[i]["NetBust"] + "";

                        cs.FinishedBust = Convert.ToDecimal(table.Rows[i]["FinishedBust"]);

                        cs.InWaist = Convert.ToDecimal(table.Rows[i]["InWaist"]);

                        cs.FinishedHem_NoFork = Convert.ToDecimal(table.Rows[i]["FinishedHem_NoFork"]);

                        cs.FinishedHem_SplitEnds = Convert.ToDecimal(table.Rows[i]["FinishedHem_SplitEnds"]);

                        cs.ShoulderWidth = Convert.ToDecimal(table.Rows[i]["ShoulderWidth"]);

                        cs.Size_Code = size_code;

                        cs.Sleecve_Show = table.Rows[i]["FK_Sleeve_ID"] + "";

                        cs.CreateDateTime = DateTime.Now;

                        cs.IsDeleted = false;

                        cs.Status = 1;

                        list.Add(cs);
                    }

                    XF_SY_NAN_ChiMa.Add(list);
                }
                else
                {
                    List <XF_SY_NU_CodeSizeDto> list_NU = new List <XF_SY_NU_CodeSizeDto>();
                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        XF_SY_NU_CodeSizeDto cs = new XF_SY_NU_CodeSizeDto();

                        cs.Height = Convert.ToDecimal(table.Rows[i]["Height"]);

                        cs.FrontLength = table.Rows[i]["FrontLength"] + "";

                        cs.NetBust = table.Rows[i]["NetBust"] + "";

                        cs.FinishedBust = Convert.ToDecimal(table.Rows[i]["FinishedBust"]);

                        cs.InWaist = Convert.ToDecimal(table.Rows[i]["InWaist"]);

                        cs.FinishedHem_NoFork = Convert.ToDecimal(table.Rows[i]["FinishedHem_NoFork"]);

                        cs.SleeveWidth = Convert.ToDecimal(table.Rows[i]["SleeveWidth"]);

                        cs.ShoulderWidth = Convert.ToDecimal(table.Rows[i]["ShoulderWidth"]);

                        cs.Size_Code = size_code;

                        cs.Sleecve_Show = table.Rows[i]["FK_Sleeve_ID"] + "";

                        cs.CreateDateTime = DateTime.Now;

                        cs.IsDeleted = false;

                        cs.Status = 1;

                        list_NU.Add(cs);
                    }

                    XF_SY_NU_ChiMa.Add(list_NU);
                }

                errmsg = "";
                return(true);
            }
            catch (Exception ex)
            {
                errmsg = ex.Message;
                return(false);
            }
        }
        public JsonResult UpdateCode(FormCollection fm)
        {
            using (var db = new MySqlServer())
                try
                {
                    switch (fm["Action"])
                    {
                    case "XF_SY_NAN":

                        List <XF_SY_NAN_ChiMaDto> xfnanlist = new List <XF_SY_NAN_ChiMaDto>();
                        int count = fm["Height"].Split(',').Count();
                        for (int i = 0; i < count; i++)
                        {
                            int upid = 0;
                            if (!int.TryParse(fm["ID"].Split(',')[i], out upid))
                            {
                                XF_SY_NAN_ChiMaDto tjdto = new XF_SY_NAN_ChiMaDto();
                                tjdto.Height                = Convert.ToInt32(fm["Height"].Split(',')[i]);
                                tjdto.FrontLength           = fm["FrontLength"].Split(',')[i];
                                tjdto.NetBust               = fm["NetBust"].Split(',')[i];
                                tjdto.FinishedBust          = Convert.ToDecimal(fm["FinishedBust"].Split(',')[i]);
                                tjdto.InWaist               = Convert.ToDecimal(fm["InWaist"].Split(',')[i]);
                                tjdto.FinishedHem_NoFork    = Convert.ToDecimal(fm["FinishedHem_NoFork"].Split(',')[i]);
                                tjdto.FinishedHem_SplitEnds = Convert.ToDecimal(fm["FinishedHem_SplitEnds"].Split(',')[i]);
                                tjdto.ShoulderWidth         = Convert.ToDecimal(fm["ShoulderWidth"].Split(',')[i]);
                                tjdto.Sleecve_Show          = fm["Sleecve_Show"].Split(',')[i];
                                tjdto.Id        = upid;
                                tjdto.Status    = 0;
                                tjdto.Size_Code = fm["Size_Code"];
                                XF_SY_NAN_ChiMa.Update(tjdto);
                            }
                            else
                            {
                                XF_SY_NAN_ChiMaDto xfnan = XF_SY_NAN_ChiMa.GetOne(t => t.Id == upid);
                                xfnan.Height                = Convert.ToInt32(fm["Height"].Split(',')[i]);
                                xfnan.FrontLength           = fm["FrontLength"].Split(',')[i];
                                xfnan.NetBust               = fm["NetBust"].Split(',')[i];
                                xfnan.FinishedBust          = Convert.ToDecimal(fm["FinishedBust"].Split(',')[i]);
                                xfnan.InWaist               = Convert.ToDecimal(fm["InWaist"].Split(',')[i]);
                                xfnan.FinishedHem_NoFork    = Convert.ToDecimal(fm["FinishedHem_NoFork"].Split(',')[i]);
                                xfnan.FinishedHem_SplitEnds = Convert.ToDecimal(fm["FinishedHem_SplitEnds"].Split(',')[i]);
                                xfnan.ShoulderWidth         = Convert.ToDecimal(fm["ShoulderWidth"].Split(',')[i]);
                                xfnan.Sleecve_Show          = fm["Sleecve_Show"].Split(',')[i];
                                xfnan.Id     = upid;
                                xfnan.Status = 1;

                                XF_SY_NAN_ChiMa.Update(xfnan);
                            }
                        }

                        break;

                    case "XF_SY_NU":

                        int count2 = fm["Height"].Split(',').Count();
                        List <XF_SY_NU_CodeSizeDto> synulist = new List <XF_SY_NU_CodeSizeDto>();
                        for (int i = 0; i < count2; i++)
                        {
                            int upid = 0;
                            if (!int.TryParse(fm["ID"].Split(',')[i], out upid))
                            {
                                XF_SY_NU_CodeSizeDto synu = new XF_SY_NU_CodeSizeDto();
                                synu.Height             = Convert.ToDecimal(fm["Height"].Split(',')[i]);
                                synu.FrontLength        = fm["FrontLength"].Split(',')[i];
                                synu.NetBust            = fm["NetBust"].Split(',')[i];
                                synu.FinishedBust       = Convert.ToDecimal(fm["FinishedBust"].Split(',')[i]);
                                synu.InWaist            = Convert.ToDecimal(fm["InWaist"].Split(',')[i]);
                                synu.FinishedHem_NoFork = Convert.ToDecimal(fm["FinishedHem_NoFork"].Split(',')[i]);
                                synu.SleeveWidth        = Convert.ToDecimal(fm["SleeveWidth"].Split(',')[i]);
                                synu.ShoulderWidth      = Convert.ToDecimal(fm["ShoulderWidth"].Split(',')[i]);
                                synu.Sleecve_Show       = fm["FinishedHem_NoFork"].Split(',')[i];
                                synu.Size_Code          = fm["Size_Code"];
                                XF_SY_NU_ChiMa.Add(synu);
                            }
                            else
                            {
                                XF_SY_NU_CodeSizeDto synu = XF_SY_NU_ChiMa.GetOne(T => T.Id == upid);
                                synu.Height             = Convert.ToDecimal(fm["Height"].Split(',')[i]);
                                synu.FrontLength        = fm["FrontLength"].Split(',')[i];
                                synu.NetBust            = fm["NetBust"].Split(',')[i];
                                synu.FinishedBust       = Convert.ToDecimal(fm["FinishedBust"].Split(',')[i]);
                                synu.InWaist            = Convert.ToDecimal(fm["InWaist"].Split(',')[i]);
                                synu.FinishedHem_NoFork = Convert.ToDecimal(fm["FinishedHem_NoFork"].Split(',')[i]);
                                synu.SleeveWidth        = Convert.ToDecimal(fm["SleeveWidth"].Split(',')[i]);
                                synu.ShoulderWidth      = Convert.ToDecimal(fm["ShoulderWidth"].Split(',')[i]);
                                synu.Sleecve_Show       = fm["FinishedHem_NoFork"].Split(',')[i];

                                XF_SY_NU_ChiMa.Update(synu);
                            }
                        }

                        break;

                    case "XF_KZ_NAN":
                    case "XF_KZ_NU":

                        int count4 = fm["DZ_HipLength_CP"].Split(',').Count();
                        List <XF_KZ_CodeSizeDto> xfkznulist = new List <XF_KZ_CodeSizeDto>();

                        for (int i = 0; i < count4; i++)
                        {
                            int upid = 0;
                            if (!int.TryParse(fm["ID"].Split(',')[i], out upid))
                            {
                                XF_KZ_CodeSizeDto xfkz = new XF_KZ_CodeSizeDto();
                                xfkz.Code                    = fm["Code"].Split(',')[i];
                                xfkz.DZ_HipLength_CP         = Convert.ToDecimal(fm["DZ_HipLength_CP"].Split(',')[i]);
                                xfkz.SZ_HipLength_CP         = Convert.ToDecimal(fm["SZ_HipLength_CP"].Split(',')[i]);
                                xfkz.Crosspiece              = Convert.ToDecimal(fm["Crosspiece"].Split(',')[i]);
                                xfkz.LegWidth_UnderTheWaves  = Convert.ToDecimal(fm["LegWidth_UnderTheWaves"].Split(',')[i]);
                                xfkz.FrontRise_EvenWaist     = Convert.ToDecimal(fm["FrontRise_EvenWaist"].Split(',')[i]);
                                xfkz.AfterTheWaves_EvenWaist = Convert.ToDecimal(fm["AfterTheWaves_EvenWaist"].Split(',')[i]);
                                xfkz.NetHip                  = fm["NetHip"].Split(',')[i];
                                xfkz.CP_WaistWidth           = fm["CP_WaistWidth"].Split(',')[i];

                                xfkz.NetWaist  = fm["NetWaist"].Split(',')[i];
                                xfkz.Size_Code = fm["Size_Code"];
                                XF_KZ_Service.Add(xfkz);
                            }
                            else
                            {
                                XF_KZ_CodeSizeDto xfkz = XF_KZ_Service.GetOne(T => T.Id == upid);
                                xfkz.Code                    = fm["Code"].Split(',')[i];
                                xfkz.DZ_HipLength_CP         = Convert.ToDecimal(fm["DZ_HipLength_CP"].Split(',')[i]);
                                xfkz.SZ_HipLength_CP         = Convert.ToDecimal(fm["SZ_HipLength_CP"].Split(',')[i]);
                                xfkz.Crosspiece              = Convert.ToDecimal(fm["Crosspiece"].Split(',')[i]);
                                xfkz.LegWidth_UnderTheWaves  = Convert.ToDecimal(fm["LegWidth_UnderTheWaves"].Split(',')[i]);
                                xfkz.FrontRise_EvenWaist     = Convert.ToDecimal(fm["FrontRise_EvenWaist"].Split(',')[i]);
                                xfkz.AfterTheWaves_EvenWaist = Convert.ToDecimal(fm["AfterTheWaves_EvenWaist"].Split(',')[i]);
                                xfkz.NetHip                  = fm["NetHip"].Split(',')[i];
                                xfkz.CP_WaistWidth           = fm["CP_WaistWidth"].Split(',')[i];

                                xfkz.NetWaist = fm["NetWaist"].Split(',')[i];
                                XF_KZ_Service.Update(xfkz);
                            }
                        }
                        int IsKc = 0;

                        for (int i = 0; i < fm.AllKeys.Length; i++)
                        {
                            if (fm.AllKeys[i] == "HK_Height")
                            {
                                IsKc++;
                            }
                        }
                        if (IsKc > 0)
                        {
                            int hkCount = fm["HK_Height"].Split(',').Count();
                            List <HeightKuChangDto> HKList = new List <HeightKuChangDto>();
                            for (int i = 0; i < hkCount; i++)
                            {
                                HeightKuChangDto dto = new HeightKuChangDto();
                                dto.Id        = Convert.ToInt32(fm["HK_Id"].Split(',')[i]);
                                dto.Height    = Convert.ToDouble(fm["HK_Height"].Split(',')[i]);
                                dto.KuChang   = Convert.ToDouble(fm["HK_KuChang"].Split(',')[i]);
                                dto.Size_Code = fm["Size_Code"];
                                HKList.Add(dto);
                            }
                        }



                        break;

                    default:
                        break;
                    }

                    return(Json(new { state = 1, msg = "" }, JsonRequestBehavior.AllowGet));
                }
                catch (Exception ex)
                {
                    return(Json(new { state = -1, msg = ex.Message }, JsonRequestBehavior.AllowGet));
                }
        }