示例#1
0
        public JsonResult ImportHandleData(string GDH)
        {
            using (MyRepository db = new MyRepository())
                try
                {
                    DataTable GDData = db.Database.GetDataTable(string.Format("select * from pytbulkgh where GDH='{0}'", GDH));

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


                    #region  除相同工单号的数据
                    var deleteDate = DCL_DataService.Query(T => T.GDH == GDH, O => O.Index, false);
                    foreach (var item in deleteDate)
                    {
                        DCL_DataService.Delete(item.Id);
                    }
                    #endregion

                    for (int i = 0; i < GDData.Rows.Count; i++)
                    {
                        #region 将数据处理存放  准备导入到待处理库

                        DCL_DataDto dl = new DCL_DataDto();

                        dl.Orderid = GDData.Rows[i]["ORDERCODE"].ToString();

                        dl.Option = Convert.ToInt32(GDData.Rows[i]["ORDERXC"]);

                        dl.Name = GDData.Rows[i]["Name"].ToString();

                        dl.ReCodeSize = GDData.Rows[i]["SIZECODE"].ToString();

                        dl.Number = Convert.ToInt32(GDData.Rows[i]["SL"]);

                        dl.Note = "";

                        dl.SizeCode = GDData.Rows[i]["GGDH"].ToString();

                        dl.GDH = GDH;

                        //  dl.Gender = GDData.Rows[i]["XB"].ToString();

                        DCLList.Add(dl);

                        #endregion
                    }

                    #region 导入到待处理库

                    DCL_DataService.Add(DCLList);

                    #endregion

                    return(Json(new { state = 1, msg = "" }, JsonRequestBehavior.AllowGet));
                }
                catch (Exception ex)
                {
                    return(Json(new { state = 0, msg = ex.Message }, JsonRequestBehavior.AllowGet));
                }
        }
示例#2
0
 /// <summary>
 /// 编辑dcl_data
 /// </summary>
 /// <param name="dto">实体</param>
 /// <returns></returns>
 public bool Update(DCL_DataDto dto)
 {
     using (var scope = _dbScopeFactory.Create())
     {
         var db     = GetDb(scope);
         var dbSet  = GetDbSet(db);
         var entity = Mapper.Map <DCL_DataDto, DCL_DataEntity>(dto);
         dbSet.AddOrUpdate(entity);
         return(db.SaveChanges() > 0);
     }
 }
示例#3
0
        //生成西服上衣男的excel
        public DataRow GenerateExcelForXF_SY_NAN(DCL_DataDto GDData,DataTable table,string Size_Code)
        {

            decimal height_kz_nu = Convert.ToDecimal(GDData.ReCodeSize.ToString().Split('/')[0]);

            string a02 = GDData.ReCodeSize.ToString().Split('/')[1];

            string temp = a02.Substring(a02.Length - 1, 1);

            string Code = a02.Substring(0, a02.Length - 1);

            XF_KZ_CodeSizeDto dto = XF_KZ_CodeSizeService.GetOne(T => T.CP_WaistWidth.Contains(Code) && T.Code == temp && T.Size_Code == Size_Code);

            if (dto != null)
            {

                DataRow row = table.NewRow();

                row["身高"] = height_kz_nu;

                row["归码后尺码"] = GDData.ReCodeSize;

                row["姓名"] = GDData.Name;

                row["数量"] = GDData.Number;

                row["双褶臀围"] = dto.SZ_HipLength_CP;

                row["单褶臀围"] = dto.DZ_HipLength_CP;

                row["腰"] = Code;


                return row;
            }
            else {
                return null;

            }


        }
示例#4
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;
            }
        }
示例#5
0
        public bool Handle_XF_KZ(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

                int index = 1;

                foreach (DCL_DataDto item in DLCData)
                {
                    decimal height_kz_nu = Convert.ToDecimal(item.ReCodeSize.ToString().Split('/')[0]);

                    string a02 = item.ReCodeSize.ToString().Split('/')[1];

                    string temp = a02.Substring(a02.Length - 1, 1);

                    string Code = a02.Substring(0, a02.Length - 1);

                    XF_KZ_CodeSizeDto dto = XF_KZ_CodeSizeService.GetOne(T => T.CP_WaistWidth.Contains(Code) && T.Code == temp && T.Size_Code == item.SizeCode && T.Status == 1);//TO DO

                    if (dto != null)
                    {
                        HanderDataForXF_KZDto sy = new HanderDataForXF_KZDto();

                        sy.Height = Convert.ToDecimal(item.ReCodeSize.Split('/')[0]);

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

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

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

                        sy.Number = item.Number;

                        sy.SZ_Hipline = dto.SZ_HipLength_CP;

                        sy.DZ_Hipline = dto.DZ_HipLength_CP;

                        sy.waistWidth = Convert.ToDecimal(Code);

                        sy.Index = index;

                        sy.GDH = item.GDH;

                        HanderDataForXF_KZService.Add(sy);
                    }
                    else
                    {
                        throw new CustomCatch(2, "没有查询到对应的尺码表数据,请更换尺码表编号");
                    }
                }
                #endregion

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#6
0
        public JsonResult Handle(string GDH, string SizeCode)
        {
            using (MyRepository db = new MyRepository())
                try
                {
                    #region 获取待处理数据

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

                    #endregion

                    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 (Action == "")
                    {
                        throw new Exception("此工单号数据不统一或是没有对应的处理程序。");
                    }

                    #endregion

                    switch (Action)
                    {
                    case "XF_SY_NAN":
                        Handle_XF_SY_NAN(SizeCode, GDH);
                        break;

                    case "XF_SY_NU":
                        Handle_XF_SY_NU(SizeCode, GDH);
                        break;

                    case "XF_KZ_NAN":
                    case "XF_KZ_NU":
                        Handle_XF_KZ(SizeCode, GDH);
                        break;
                    }
                    return(Json(new { state = 1, msg = "处理成功。" }, JsonRequestBehavior.AllowGet));
                }
                catch (CustomCatch cc)
                {
                    return(Json(new { state = cc.Level, msg = cc.ExceptionString }, JsonRequestBehavior.AllowGet));
                }
            catch (Exception ex)
            {
                return(Json(new { state = 0, msg = ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }