Ejemplo n.º 1
0
            //扫描量
            public static List <ResScnRateDto> ScanRate(PartDataModel model)
            {
                List <ResScnRateDto> listend = new List <ResScnRateDto>();
                ResScanRateDto       list    = new ResScanRateDto();

                if (model.EndTime.Month - model.StartTime.Month > 0)
                {
                    CommonHelp.StarMon = model.StartTime.ToString("yyyy MMMM dd") + "~" +
                                         model.EndTime.ToString("yyyy MMMM dd");
                    CommonHelp.EndMon = CommonHelp.list.Where(p => p.Area.Equals(model.Line)).FirstOrDefault()
                                        .DesCribe;
                }
                else
                {
                    CommonHelp.StarMon = model.StartTime.Month + "月";
                    CommonHelp.EndMon  = CommonHelp.list.Where(p => p.Area.Equals(model.Line)).FirstOrDefault()
                                         .DesCribe;
                }

                using (IDbConnection conn = MySqlConnection())
                {
                    var p = new DynamicParameters();
                    p.Add("@_DateTimeStart", model.StartTime);
                    p.Add("@_DateTimeEnd", model.EndTime);
                    p.Add("@_Area", model.Line);
                    // var list1= conn.Query("SP_Data_All_Barcode_QueryByDate", p, commandType: CommandType.StoredProcedure, commandTimeout: 0).ToList();
                    list.assemlist = conn.Query <ResAssemblyRateDto>("SP_ScanerRatezc", p,
                                                                     commandType: CommandType.StoredProcedure, commandTimeout: 0).ToList();
                    list.partlist = conn.Query <ResPartDto>("SP_ScanerRatepart", p,
                                                            commandType: CommandType.StoredProcedure, commandTimeout: 0).ToList();
                    var tt = from left in list.assemlist
                             join right in list.partlist
                             on left.Figure_No_up equals right.Figure_No
                             select new ResScnRateDto
                    {
                        Figure_No_up   = left.Figure_No_up,
                        sum_up         = left.sum_up,
                        upstation      = left.upstation,
                        Figure_No_down = left.Figure_No_down,
                        sum_down       = left.sum_down,
                        DOWNSTATION    = left.DOWNSTATION,
                        DOWNRATE       = Convert.ToString(left.DOWNRATE) + "%",
                        cartype        = right.cartype,
                        Partname       = right.Partname,
                        Part_Sum       = right.Part_Sum,
                        PartFigureNo   = right.PartFigureNo
                    };
                    listend = tt.ToList();

                    foreach (var itmes in listend)
                    {
                        itmes.Rate = Convert.ToString(itmes.sum_up / itmes.Part_Sum * 100) + "%";
                    }
                }

                return(listend);
            }
Ejemplo n.º 2
0
        // GET: GetPartByDate

        public ActionResult Index(PartDataModel model, int?PageIndex, int?PageSize = 30)
        {
            try
            {
                ViewBag.totalcount = 0;
                ViewBag.Line       = CommonHelp.list;
                if (PageIndex == null && model.StartTime < model.EndTime && !string.IsNullOrEmpty(model.Line))
                {
                    string key = Guid.NewGuid().ToString() + model.Line;
                    CommonHelp.key = key;

                    if (model.EndTime.Month - model.StartTime.Month > 0)
                    {
                        CommonHelp.StarMon = model.StartTime.ToString("yyyy MMMM dd") + "~" +
                                             model.EndTime.ToString("yyyy MMMM dd");
                        CommonHelp.EndMon = CommonHelp.list.Where(p => p.Area.Equals(model.Line)).FirstOrDefault()
                                            .DesCribe;
                    }


                    else
                    {
                        CommonHelp.StarMon = model.StartTime.Month + "月";
                        CommonHelp.EndMon  = CommonHelp.list.Where(p => p.Area.Equals(model.Line)).FirstOrDefault()
                                             .DesCribe;
                    }

                    if (CommonBuffer.Exist(key))
                    {
                        CommonHelp.list2 = CommonBuffer.Get <List <PartDataDto> >(key);
                        ViewBag.count    = CommonHelp.list2.Count;

                        ViewBag.Data = CommonHelp.list2.Take(30).ToList();
                    }
                    else
                    {
                        CommonHelp.list2 = CommonBuffer.FindT(key, DapperService.SqlHelp.PartDataBase, model);
                        ViewBag.count    = CommonHelp.list2.Count;
                        ViewBag.Data     = CommonHelp.list2.Take(30).ToList();
                    }
                }
                if (PageIndex != null)
                {
                    var model1 = new PageInfoModel <PartDataDto>();
                    model1.List      = CommonHelp.list2;
                    model1.PageSize  = PageSize;
                    model1.PageIndex = PageIndex;
                    var res = CommonHelp.PageList(model1);
                    return(Json(res, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
            }
            return(View());
        }
Ejemplo n.º 3
0
            /// <summary>
            /// 零件基础数据
            /// </summary>
            /// <param name="model"></param>
            /// <returns></returns>
            public static List <PartDataDto> PartDataBase(PartDataModel model)
            {
                List <PartDataDto> list;

                using (IDbConnection conn = MySqlConnection())
                {
                    var p = new DynamicParameters();

                    p.Add("@_DateTimeStart", model.StartTime);
                    p.Add("@_DateTimeEnd", model.EndTime);
                    p.Add("@_Area", model.Line);
                    // var list1= conn.Query("SP_Data_All_Barcode_QueryByDate", p, commandType: CommandType.StoredProcedure, commandTimeout: 0).ToList();
                    list = conn.Query <PartDataDto>("SP_DataPart_ExportByDate", p,
                                                    commandType: CommandType.StoredProcedure, commandTimeout: 0).ToList();
                }

                return(list);
            }
Ejemplo n.º 4
0
        // GET: ScanRate
        public ActionResult Index(PartDataModel model, int?PageIndex, int?PageSize = 30)
        {
            try
            {
                List <ResScnRateDto> listend = new List <ResScnRateDto>();

                ViewBag.totalcount = 0;
                ViewBag.Line       = CommonHelp.list;
                if (PageIndex == null && model.StartTime < model.EndTime && !string.IsNullOrEmpty(model.Line))
                {
                    string key = Guid.NewGuid().ToString() + model.Line;
                    CommonHelp.key = key;
                    if (CommonBuffer.Exist(key))
                    {
                        CommonHelp.Listone <ResScnRateDto> .List = CommonBuffer.Get <List <ResScnRateDto> >(key);
                        ViewBag.count = CommonHelp.Listone <ResScnRateDto> .List.Count;
                        ViewBag.Data  = CommonHelp.Listone <ResScnRateDto> .List.Take(30).ToList();
                    }
                    else
                    {
                        CommonHelp.Listone <ResScnRateDto> .List = CommonBuffer.FindT(key, DapperService.SqlHelp.ScanRate, model);
                        ViewBag.count = CommonHelp.Listone <ResScnRateDto> .List.Count;
                        ViewBag.Data  = CommonHelp.Listone <ResScnRateDto> .List.Take(30).ToList();
                    }
                }
                if (PageIndex != null)
                {
                    var model1 = new PageInfoModel <ResScnRateDto>();
                    model1.List      = CommonHelp.Listone <ResScnRateDto> .List;
                    model1.PageSize  = PageSize;
                    model1.PageIndex = PageIndex;
                    var res = CommonHelp.PageList(model1);
                    return(Json(res, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
            }
            return(View());
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 删除器件
 /// </summary>
 /// <param name="model"></param>
 public void UnregisterPart(PartDataModel model)
 {
     ExperimentParts.Remove(model);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 注册器件
 /// </summary>
 /// <param name="model"></param>
 public void RegisterPart(PartDataModel model)
 {
     ExperimentParts.Add(model);
 }