//保存数据的逻辑方法 public bool SaveDictlibrary() { try { Initlocalsetting initlocalsettint = new Initlocalsetting(); initlocalsettint.Hostmac = this.tbxMac.Text; Initlocalsetting initlocalsettintList = new InitlocalsettingService().GetInitlocalsettingInfo(initlocalsettint); if (initlocalsettintList != null) { initlocalsettintList.Pdfprinter = this.Drop_PDFPRINTER.SelectedValue; initlocalsettintList.A4printer = this.Drop_A4PRINTER.SelectedValue; initlocalsettintList.A5printer = this.Drop_A5PRINTER.SelectedValue; initlocalsettintList.Barcodeprinter = this.Drop_BARCODEPRINTER.SelectedValue; } else { initlocalsettintList = new Initlocalsetting(); initlocalsettintList.Hostmac = this.tbxMac.Text.Trim(); initlocalsettintList.Hostname = this.tbxName.Text.Trim(); initlocalsettintList.Pdfprinter = this.Drop_PDFPRINTER.SelectedValue; initlocalsettintList.A4printer = this.Drop_A4PRINTER.SelectedValue; initlocalsettintList.A5printer = this.Drop_A5PRINTER.SelectedValue; initlocalsettintList.Barcodeprinter = this.Drop_BARCODEPRINTER.SelectedValue; } return(new InitlocalsettingService().SaveDictlab(initlocalsettintList)); } catch (Exception ex) { errorType = ex.Message; return(false); } }
//add by lee public void PrintReport2(string strreport, DataSet ds, UserInfo userInfo) { json = Serialize(strreport); dsjson = Serialize(ds); // UserInfo的MAC地址在表initlocalsetting中查找对应当的打印机。 // printer = "HP LaserJet 1020"; initlocalsetting.Hostmac = userInfo.initlocalsetting.Hostmac; initlocalsetting = initlocalsettingService.GetInitlocalsettingInfo(initlocalsetting); try { if (repID == ((int)ParamStatus.ReportTypeStatus.ChcekOrder).ToString() || repID == ((int)ParamStatus.ReportTypeStatus.Financial).ToString() || repID == ((int)ParamStatus.ReportTypeStatus.GroupOrder).ToString() || repID == ((int)ParamStatus.ReportTypeStatus.Normal).ToString()) { printer = initlocalsetting.A4printer.ToString(); } else if (repID == ((int)ParamStatus.ReportTypeStatus.HPV).ToString() || repID == ((int)ParamStatus.ReportTypeStatus.MoneyOrder).ToString() || repID == ((int)ParamStatus.ReportTypeStatus.TM15).ToString()) { printer = initlocalsetting.A5printer.ToString(); } } catch (Exception e) { throw new Exception("请先设置打印机"); } }
/// <summary> /// (新)打印报告单事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnPrintNew_Click(object sender, EventArgs e) { string mac = hdMac.Text.ToString(); if (string.IsNullOrEmpty(mac)) { MessageBoxShow("获取MAC失败!"); return; } SetInitlocalsetting(mac);//取mac地址 string printName = string.Empty; if (Userinfo.initlocalsetting == null) { MessageBoxShow("加载本地打印配置失败"); return; } else { Initlocalsetting initlocalsetting = Userinfo.initlocalsetting; printName = initlocalsetting.A4printer ?? initlocalsetting.A5printer; if (string.IsNullOrEmpty(printName)) { MessageBoxShow("请先维护打印机!"); return; } } string ordernums = GetSelectOrderNums(); if (ordernums == string.Empty) { return; } //打印3.0 foreach (int row in gdOrders.SelectedRowIndexArray) { string ordernum = gdOrders.DataKeys[row][0].ToString(); string dictreporttemplateid = gdOrders.DataKeys[row][4].ToString(); Hashtable htprint = commonReport.getPrintData(ordernum, dictreporttemplateid); string repCode = htprint["repCode"].ToString(); string dsjson = htprint["dsjson"].ToString(); #region 修改打印状态、添加操作日志 Hashtable ht = new Hashtable(); ht.Add("ordernum", ordernum); ht.Add("oldstatus", (int)ParamStatus.OrdersStatus.FinishCheck); ht.Add("status", (int)ParamStatus.OrdersStatus.FinishPrint); ordersService.EditStatusByOldStatus(ht); ordersService.AddOperationLog(ordernum, null, "报告单集中打印", "新版打印报告单", "修改留痕", ""); #endregion ExtAspNet.PageContext.RegisterStartupScript(string.Format(" PrintReport2(\'{0}\',\'{1}\',\'{2}\');", printName, repCode, dsjson)); } }
public UpdateUserInfoResponse Process(UpdateUserInfoRequest request) { if (request.UserInfo == null || request.UserInfo.UserComputerConfig == null || request.UserInfo.UserPrinterConfig == null) { return new UpdateUserInfoResponse() { ResultType = ResultTypes.DataValidationError } } ; var initlocalsettingRepo = RepositoryManager.GetRepository <IInitlocalsettingRepository>(); var initlocalsetting = initlocalsettingRepo.GetByKey(request.UserInfo.UserComputerConfig.HostMac); if (initlocalsetting != null) { initlocalsetting.Pdfprinter = request.UserInfo.UserPrinterConfig.PdfPrinter; initlocalsetting.A4printer = request.UserInfo.UserPrinterConfig.A4Printer; initlocalsetting.A5printer = request.UserInfo.UserPrinterConfig.A5Printer; initlocalsetting.Barcodeprinter = request.UserInfo.UserPrinterConfig.BarcodePrinter; initlocalsettingRepo.Update(initlocalsetting); } else { initlocalsetting = new Initlocalsetting(); initlocalsetting.Hostmac = request.UserInfo.UserComputerConfig.HostMac; initlocalsetting.Hostname = request.UserInfo.UserComputerConfig.HostName; initlocalsetting.Pdfprinter = request.UserInfo.UserPrinterConfig.PdfPrinter; initlocalsetting.A4printer = request.UserInfo.UserPrinterConfig.A4Printer; initlocalsetting.A5printer = request.UserInfo.UserPrinterConfig.A5Printer; initlocalsetting.Barcodeprinter = request.UserInfo.UserPrinterConfig.BarcodePrinter; initlocalsettingRepo.Insert(initlocalsetting); } //new InitlocalsettingService().SaveDictlab(initlocalsetting); return(new UpdateUserInfoResponse() { ResultType = ResultTypes.Ok }); } }
public void PrintBarCode(DataTable dt, UserInfo userInfo) { json = Serialize(dt); // 查找对应的条码打印机 //printer = "TSC TTP-244 Plus"; initlocalsetting.Hostmac = userInfo.initlocalsetting.Hostmac; initlocalsetting = initlocalsettingService.GetInitlocalsettingInfo(initlocalsetting); try { printer = initlocalsetting.Barcodeprinter.ToString(); } catch (Exception e) { throw new Exception("请先设置打印机"); } }
public Hashtable PrintReport3(string orderNum, UserInfo userInfo, int isPrint) { fReport.Clear(); string reportID = string.Empty; string reportCode = string.Empty; Orders orders = orderService.SelectOrdersByOrdernum(orderNum); if (orders != null) { Dictreporttemplate dictreporttemplate = repService.GetDictreporttemplateByID(orders.Dictreporttemplateid.ToString()); if (dictreporttemplate != null) { reportCode = dictreporttemplate.Templatecode.ToString(); reportID = dictreporttemplate.Reporttype.ToString(); } } string path = HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["path"].ToString()); fReport = repServeic.GetReport(orderNum, reportCode, reportID, new DataSet(), path, out dsGetReportData, isPrint); string reportString = Serialize(fReport.SaveToString()); string dsString = Serialize(dsGetReportData); string printerString = string.Empty; initlocalsetting.Hostmac = userInfo.initlocalsetting.Hostmac; initlocalsetting = initlocalsettingService.GetInitlocalsettingInfo(initlocalsetting); try { if (reportID == ((int)ParamStatus.ReportTypeStatus.ChcekOrder).ToString() || reportID == ((int)ParamStatus.ReportTypeStatus.Financial).ToString() || reportID == ((int)ParamStatus.ReportTypeStatus.GroupOrder).ToString() || reportID == ((int)ParamStatus.ReportTypeStatus.Normal).ToString()) { printerString = initlocalsetting.A4printer.ToString(); } else if (reportID == ((int)ParamStatus.ReportTypeStatus.HPV).ToString() || reportID == ((int)ParamStatus.ReportTypeStatus.MoneyOrder).ToString() || reportID == ((int)ParamStatus.ReportTypeStatus.TM15).ToString()) { printerString = initlocalsetting.A5printer.ToString(); } } catch (Exception e) { throw new Exception("请先设置打印机"); } Hashtable ht = new Hashtable(); ht.Add("printer", printerString); ht.Add("json", reportString); ht.Add("dsjson", dsString); return(ht); }
private void BingText() { try { Initlocalsetting initlocalsettint = new Initlocalsetting(); initlocalsettint.Hostmac = this.tbxMac.Text; //MacHost; initlocalsettint = new InitlocalsettingService().GetInitlocalsettingInfo(initlocalsettint); if (initlocalsettint != null) { this.Drop_A4PRINTER.SelectedValue = initlocalsettint.A4printer.ToString(); this.Drop_A5PRINTER.SelectedValue = initlocalsettint.A5printer.ToString(); this.Drop_BARCODEPRINTER.SelectedValue = initlocalsettint.Barcodeprinter.ToString(); this.Drop_PDFPRINTER.SelectedValue = initlocalsettint.Pdfprinter.ToString(); } } catch (Exception ex) { MessageBoxShow(ex.Message, MessageBoxIcon.Error); } }
///<summary> ///新增编辑后保存 ///</summary> ///<param name="library"></param> /// <returns></returns> public bool SaveDictlab(Initlocalsetting library) { int nflag = 0; //新增 Initlocalsetting initlocalsettint = new Initlocalsetting(); initlocalsettint.Hostmac = library.Hostmac; Initlocalsetting initlocalsettintList = new InitlocalsettingService().GetInitlocalsettingInfo(initlocalsettint); if (initlocalsettintList == null) { try { //library.Dictlabid = getSeqID("SEQ_DICTLABID"); insert("Dict.InsertInitlocalsetting", library); nflag = 1; List <LogInfo> logLst = getLogInfo <Initlocalsetting>(new Initlocalsetting(), library); AddMaintenanceLog("Initlocalsetting", 0, logLst, "新增", library.Hostmac, library.Hostname, modulename); } catch (Exception ex) { nflag = 0; throw new Exception(ex.Message); } } else//保存 { try { Initlocalsetting dictlab = GetInitlocalsettingInfo(library); nflag = update("Dict.UpdateInitlocalsetting", library); List <LogInfo> logLst = getLogInfo <Initlocalsetting>(dictlab, library); AddMaintenanceLog("Initlocalsetting", 0, logLst, "修改", library.Hostmac, library.Hostname, modulename); } catch (Exception ex) { throw new Exception(ex.Message); } } return(nflag > 0); }
/// <summary> /// 获取本地参数详细信息 /// </summary> /// <param name="usercode"></param> /// <returns></returns> public Initlocalsetting GetInitlocalsettingInfo(Initlocalsetting library) { return(this.selectObj <Initlocalsetting>("Dict.GetInitlocalsettingInfo", library)); }