Beispiel #1
0
 //调整顺序
 public JsonResult UpdateIndex(int startIndex, int stopIndex, string GDH)
 {
     using (var db = new MySqlServer())
         try
         {
             if (HanderDataForXF_SYService.GetOne(T => T.GDH == GDH) != null)
             {
                 db.Database.GetInt(string.Format("update HanderDataForXF_SY set [index]=-1 where [index]={0} and GDH='{1}' ", stopIndex, GDH));
                 db.Database.GetInt(string.Format("update HanderDataForXF_SY set [index]={0} where [index]={1} and GDH='{2}' ", stopIndex, startIndex, GDH));
                 db.Database.GetInt(string.Format("update HanderDataForXF_SY set [index]={0} where [index]={1} and GDH='{2}' ", startIndex, -1, GDH));
                 return(Json(new { state = 1, msg = "排序成功。" }, JsonRequestBehavior.AllowGet));
             }
             else if (HanderDataForXF_KZService.GetOne(T => T.GDH == GDH) != null)
             {
                 db.Database.GetInt(string.Format("update HanderDataForXF_KZ set [index]=-1 where [index]={0} and GDH='{1}' ", stopIndex, GDH));
                 db.Database.GetInt(string.Format("update HanderDataForXF_KZ set [index]={0} where [index]={1} and GDH='{2}' ", stopIndex, startIndex, GDH));
                 db.Database.GetInt(string.Format("update HanderDataForXF_KZ set [index]={0} where [index]={1} and GDH='{2}' ", startIndex, -1, GDH));
                 return(Json(new { state = 1, msg = "排序成功。" }, JsonRequestBehavior.AllowGet));
             }
             else
             {
                 throw new Exception("系统出错:数据库中找不到对应数据。");
             }
         }
         catch (Exception ex)
         {
             return(Json(new { state = 0, msg = ex.Message }, JsonRequestBehavior.AllowGet));
         }
 }
Beispiel #2
0
        //删除处理数据
        public void DeleteForHanderData(string GDH, string Action)
        {
            try
            {
                #region  除重复数据
                switch (Action)
                {
                case "XF_SY_NAN":
                case "XF_SY_NU":
                    var SY_NU = HanderDataForXF_SYService.Query(T => T.GDH == GDH, O => O.Index, false);
                    foreach (var item in SY_NU)
                    {
                        HanderDataForXF_SYService.Delete(item.Id);
                    }
                    break;

                case "XF_KZ_NAN":
                case "XF_KZ_NU":
                    var KZ_NU = HanderDataForXF_KZService.Query(T => T.GDH == GDH, O => O.Index, false);
                    foreach (var item in KZ_NU)
                    {
                        HanderDataForXF_KZService.Delete(item.Id);
                    }
                    break;
                }
                #endregion
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #3
0
 //导出裁单
 public JsonResult LoadOrder(string Action, string GDH)
 {
     using (var db = new MySqlServer())
         try
         {
             if (HanderDataForXF_SYService.GetOne(T => T.GDH == GDH) != null)
             {
                 var orderlist = db.Database.GetList <DictionariesDto>("select * from Dictionaries where D_Key='HanderDataForXF_SYOrder'");
                 return(Json(new { state = 1, msg = orderlist }, JsonRequestBehavior.DenyGet));
             }
             else
             {
                 var orderlist = db.Database.GetList <DictionariesDto>("select * from Dictionaries where D_Key='HanderDataForXF_KZOrder'");
                 return(Json(new { state = 1, msg = orderlist }, JsonRequestBehavior.DenyGet));
             }
         }
         catch (Exception ex)
         {
             return(Json(new
             {
                 state = 0,
                 msg = ex.Message
             }, JsonRequestBehavior.AllowGet));
         }
 }
Beispiel #4
0
        //获取初排数据
        public JsonResult GetListForHanderData(string GDH, string Order, string type)
        {
            using (var db = new MySqlServer())
                try
                {
                    Order = Order.TrimEnd(',');

                    if (HanderDataForXF_SYService.GetOne(T => T.GDH == GDH) != null)
                    {
                        string xxxxdsadsax = string.Format("select ROW_NUMBER()over(order by {0}) rownum,* from (select * from  HanderDataForXF_SY ) as list order by {0}", Order);

                        //list.Height,list.Sleeve,list.Bust
                        var SYList = db.Database.GetDataTable(string.Format("select ROW_NUMBER()over(order by {0}) rownum,* from (select * from  HanderDataForXF_SY ) as list order by {0}", Order));
                        if (type != "NotOrder")
                        {
                            for (int i = 0; i < SYList.Rows.Count; i++)
                            {
                                var xxxxx = db.Database.GetInt(string.Format("update HanderDataForXF_SY set [index]={0} where id={1}", SYList.Rows[i]["rownum"].ToString(), SYList.Rows[i]["Id"].ToString()));
                            }
                        }
                        return(Json(new { state = 1, action = "HanderDataForXF_SY", msg = HanderDataForXF_SYService.Query(T => T.GDH == GDH, O => O.Index, false) }, JsonRequestBehavior.AllowGet));
                    }
                    else if (HanderDataForXF_KZService.GetOne(T => T.GDH == GDH) != null)
                    {
                        return(Json(new { state = 1, action = "HanderDataForXF_KZ", msg = HanderDataForXF_KZService.Query(T => T.GDH == GDH, O => O.Index, false) }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        throw new Exception("系统出错:数据库中找不到对应数据。");
                    }
                }
                catch (Exception ex)
                {
                    return(Json(new { state = 0, msg = ex.Message }, JsonRequestBehavior.AllowGet));
                }
        }
Beispiel #5
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;
            }
        }
Beispiel #6
0
        //导出裁单
        public JsonResult ExportCaiDan(FormCollection fm)
        {
            string GDH = fm["GDH_ZH"];

            try
            {
                if (HanderDataForXF_SYService.GetOne(T => T.GDH == GDH) != null)
                {
                    var       data  = HanderDataForXF_SYService.Query(T => T.GDH == GDH, O => O.Index, false);
                    DataTable table = new DataTable();
                    table.Columns.Add("姓名");
                    table.Columns.Add("归码后尺码");
                    table.Columns.Add("备注");
                    table.Columns.Add("数量");
                    table.Columns.Add("流水号");
                    table.Columns.Add("至流水号");

                    int liushui = Convert.ToInt32(fm["caidanindex"]);

                    foreach (var item in data)
                    {
                        DataRow row = table.NewRow();
                        row["姓名"]    = item.Name;
                        row["归码后尺码"] = item.RtnQCode;
                        row["备注"]    = item.Note;
                        row["数量"]    = item.Number;
                        liushui++;
                        row["流水号"]  = liushui;
                        liushui    += item.Number;
                        row["至流水号"] = liushui;
                        table.Rows.Add(row);
                    }
                    ExcelHelper.BuildExcel(table, "裁床记录表");
                    return(Json(new { state = 1, msg = "" }, JsonRequestBehavior.AllowGet));
                }
                else if (HanderDataForXF_KZService.GetOne(T => T.GDH == GDH) != null)
                {
                    var       data  = HanderDataForXF_KZService.Query(T => T.GDH == GDH, O => O.Index, false);
                    DataTable table = new DataTable();
                    table.Columns.Add("姓名");
                    table.Columns.Add("归码后尺码");
                    table.Columns.Add("备注");
                    table.Columns.Add("数量");
                    table.Columns.Add("流水号");
                    table.Columns.Add("至流水号");

                    int liushui = Convert.ToInt32(fm["caidanindex"]);

                    foreach (var item in data)
                    {
                        DataRow row = table.NewRow();
                        row["姓名"]    = item.Name;
                        row["归码后尺码"] = item.RtnQCode;
                        row["备注"]    = item.Note;
                        row["数量"]    = item.Number;
                        liushui++;
                        row["流水号"]  = liushui;
                        liushui    += item.Number;
                        row["至流水号"] = liushui;
                        table.Rows.Add(row);
                    }
                    ExcelHelper.BuildExcel(table, "裁床记录表");
                    return(Json(new { state = 1, msg = "" }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    throw new Exception("系统出错:数据库中找不到对应数据。");
                }
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    state = 0,
                    msg = ex.Message
                }, JsonRequestBehavior.AllowGet));
            }
        }