//查询方法
        public List <AssembleSearchDto> GetAssemblyList(ForAssemblyModel model)
        {
            var list = new List <AssembleSearchDto>();

            ViewBag.table = null;
            var forassemlymodel = new AssembleSearchModel();

            forassemlymodel.Area     = model.Area;
            forassemlymodel.StarTime = model.StartTime;
            forassemlymodel.EndTime  = model.EndTime;
            if (model.StartTime < model.EndTime)
            {
                Session["indexnew"] = forassemlymodel;
                list = DapperService.SqlHelp.AssemblySearch(forassemlymodel).OrderByDescending(p => p.end_time)
                       .ToList();
                ViewBag.list  = list.Take(30).ToList();
                ViewBag.count = DapperService.SqlHelp.AssemblySearch(forassemlymodel).Count;
            }
            else
            {
                ViewBag.count = 0;
            }

            return(list);
        }
예제 #2
0
            /// <summary>
            /// 获得扭矩excel表原始数据
            /// </summary>
            /// <param name="model"></param>
            /// <returns></returns>
            public static List <TorqToExcelDto> TorqByDataToExcel(AssembleSearchModel model)
            {
                List <TorqToExcelDto> list;

                using (IDbConnection conn = MySqlConnection())
                {
                    //model.EndTime = model.StarTime.AddDays(1);
                    var p = new DynamicParameters();
                    p.Add("@_DateTimeStart", model.StarTime);
                    p.Add("@_DateTimeEnd", model.EndTime);
                    p.Add("@_Area", model.Area);
                    //var list6= conn.Query("SP_DataTorq_ExportByDate", p, commandType: CommandType.StoredProcedure, commandTimeout: 240).ToList();
                    list = conn.Query <TorqToExcelDto>("SP_DataTorq_ExportByDate", p,
                                                       commandType: CommandType.StoredProcedure, commandTimeout: 240).ToList();
                }

                return(list);
            }
예제 #3
0
            /// <summary>
            /// 总成查询
            /// </summary>
            /// <param name="model"></param>
            /// <returns></returns>
            public static List <AssembleSearchDto> AssemblySearch(AssembleSearchModel model)
            {
                List <AssembleSearchDto> list;

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

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

                return(list);
            }
예제 #4
0
        public string TorqPartToExcelAll(ToExcelModel Model)
        {
            string excel = "";

            try
            {
                AssembleSearchModel model = new AssembleSearchModel();
                model.Area     = Model.line;
                model.EndTime  = Model.endtime;
                model.StarTime = Model.starttime;
                var time = model.StarTime.AddDays(8);
                if (model.StarTime.AddDays(8) < model.EndTime)
                {
                    excel = "false";
                }
                else
                {
                    if (Model.type == "Torq")
                    {
                        List <TorqToExcelDto> list = DapperService.ToExcel.TorqToExcel(Model);
                        if (list.Count != 0)
                        {
                            JavaScriptSerializer json = new JavaScriptSerializer();
                            json.MaxJsonLength = Int32.MaxValue;
                            excel = json.Serialize(list);
                        }
                    }
                    if (Model.type == "Part")
                    {
                        List <PartToExcelDto> list = DapperService.ToExcel.PartToExcel(Model).Where(p => p.cartype != null & p.QualityStatus != null && p.NutID != null && p.PART_figure_no != null).ToList();
                        if (list.Count != 0)
                        {
                            JavaScriptSerializer json = new JavaScriptSerializer();
                            json.MaxJsonLength = Int32.MaxValue;
                            excel = json.Serialize(list);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(excel);
        }
예제 #5
0
        public string TorqPartToExcelAll(ToExcelModel Model)
        {
            var    Successed = true;
            var    Message   = "";
            string excel     = "";

            try
            {
                AssembleSearchModel model = new AssembleSearchModel();
                model.Area     = Model.line;
                model.EndTime  = Model.endtime;
                model.StarTime = Model.starttime;
                if (Model.type == "Torq")
                {
                    List <TorqToExcelDto> list = DapperService.SqlHelp.TorqByDataToExcel(model);
                    if (list.Count != 0)
                    {
                        Message = "成功!";
                        JavaScriptSerializer json = new JavaScriptSerializer();
                        json.MaxJsonLength = Int32.MaxValue;
                        excel = json.Serialize(list);
                        //Dictionary<string, string> dic = new Dictionary<string, string>();
                        //dic.Add("ProductLine", "生产线");
                        //dic.Add("SN", "总成条码");
                        //dic.Add("OnLineTime", "上线时间");
                        //dic.Add("UpLineTime", "下线时间");
                        //dic.Add("ClampNumber", "夹具信息");
                        //dic.Add("QualityStatus", "质量状态");
                        //dic.Add("NutID", "扭矩编号");
                        //dic.Add("Torque", "扭矩");
                        //dic.Add("Nutname", "螺栓名称");
                        //dic.Add("Station", "工位");
                        //dic.Add("Angle", "角度");
                        //dic.Add("PartInstallTime", "部件安装时间");
                        //dic.Add("Factory", "所属工厂");
                        //ExExcel(list, dic, "扭矩参数追溯信息表");
                    }
                }
                else if (Model.type == "Part")
                {
                    List <PartToExcelDto> list = DapperService.SqlHelp.PartyByDataToExcel(model);
                    if (list.Count != 0)
                    {
                        Message = "成功!";
                        JavaScriptSerializer json = new JavaScriptSerializer();
                        json.MaxJsonLength = Int32.MaxValue;
                        excel = json.Serialize(list);
                        //Dictionary<string, string> dic = new Dictionary<string, string>();
                        //dic.Add("ProductLine", "生产线");
                        //dic.Add("SN", "总成条码");
                        //dic.Add("OnLineTime", "上线时间");
                        //dic.Add("UpLineTime", "下线时间");
                        //dic.Add("ClampNumber", "夹具信息");
                        //dic.Add("QualityStatus", "质量状态");
                        //dic.Add("NutID", "部件编号");
                        //dic.Add("RealPart", "实装部件");
                        //dic.Add("ShouldPart", "应装部件");
                        //dic.Add("PartInstallTime", "部件安装时间");
                        //dic.Add("Factory", "所属工厂");
                        //ExExcel(list, dic, "部件参数追溯信息表");
                    }
                }
            }
            catch (Exception ex)
            {
                Successed = false;
                Message   = "失败!";
            }
            return(excel);
        }