예제 #1
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);
        }
예제 #2
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);
        }