From 79402e0d4141c0bb395e0fccb032d41f6bd0f220 Mon Sep 17 00:00:00 2001 From: cyf Date: Thu, 20 Nov 2025 09:06:08 +0000 Subject: [PATCH] SVN r1052 SVN-Revision: r1052 --- 插件库/Lskj.PubBill/BillModule.cs | 362 +++++++++++++++++++++-- 插件库/Lskj.PubBill/FrmDocumentSource.cs | 2 +- 2 files changed, 336 insertions(+), 28 deletions(-) diff --git a/插件库/Lskj.PubBill/BillModule.cs b/插件库/Lskj.PubBill/BillModule.cs index 3a573a2..3a3746d 100644 --- a/插件库/Lskj.PubBill/BillModule.cs +++ b/插件库/Lskj.PubBill/BillModule.cs @@ -35,7 +35,9 @@ using DevExpress.Utils; using System.Data.SqlClient; using Newtonsoft.Json.Linq; using Newtonsoft.Json; - +using Lskj.Control.BrowserSetting; +using System.Net; +using System.Web; namespace Lskj.PubBill { @@ -199,7 +201,21 @@ namespace Lskj.PubBill /// /// 来源明细的页面名字后缀(设置成全局变量,更好的处理语言翻译的情况) /// - public string DetailedSuffix = Business.Impl.LanguageTranslation.Translatable ? Business.Impl.LanguageTranslation.GetTranslatedText("-明细") : "-明细"; + public string DetailedSuffix = Business.Impl.LanguageTranslation.Translatable ?"-"+ Business.Impl.LanguageTranslation.GetTranslatedText("明细") : "-明细"; + /// + /// 数量后缀 + /// + public string QuantitySuffix = Business.Impl.LanguageTranslation.Translatable ? Business.Impl.LanguageTranslation.GetTranslatedText("条")+")" : "条)"; + /// + /// 新增 + /// + public string addText = Business.Impl.LanguageTranslation.Translatable ? "(" + Business.Impl.LanguageTranslation.GetTranslatedText("新增") + ")" : "(新增)"; + /// + /// 修改 + /// + public string updateText = Business.Impl.LanguageTranslation.Translatable ? "(" + Business.Impl.LanguageTranslation.GetTranslatedText("修改") + ")" : "(修改)"; + + /// /// 单据来源控件集合 /// @@ -228,6 +244,10 @@ namespace Lskj.PubBill /// 初始化时选中的页签 /// public XtraTabPage InitialSelectionTab = null; + /// + /// 当前操作的ImageEdit + /// + private LabelImageEdit _imageEdit; public BillModule() { @@ -796,6 +816,7 @@ namespace Lskj.PubBill //父节点编号 (this.gcMain as TreeGridControlEx).TreeListObj.ParentFieldName = "tap_pid"; (this.gcMain as TreeGridControlEx).SortField = this.BillModel.DetailOrderField; + (this.gcMain as TreeGridControlEx).TreeTableDragCondition = this.BillModel.TreeTableDragCondition; (this.gcMain as TreeGridControlEx).InitializedragState(); } @@ -1084,6 +1105,8 @@ namespace Lskj.PubBill this.pl_main_center_master.Height = (this.BillModel.ParentHeight - 36) > this.pl_main_center_master.Height ? this.pl_main_center_master.Height : this.BillModel.ParentHeight - 36; + //设置图片框的上传和删除事件 + this.SetImageEvent(controls); // 初始化明细 // 创建多表头,默认标准表格 @@ -1184,6 +1207,7 @@ namespace Lskj.PubBill this.gcMain.GridView.RowCellClick += OngcMainRowCellClick; } this.gcMain.GridControl.DataSourceChanged += OnGcMainDataSourceChanged; + this.gcMain.OnAllAfterParseCallBack += OnAllAfterParseCallBack; } /// @@ -2256,7 +2280,7 @@ namespace Lskj.PubBill } //details = GetGridViewFilteredAndSortedDataToDataTable(unionModel.GridDetailControlObj.GridView); //DataTable details = unionModel.GridDetailControlObj.GridView.DataController.GetAllFilteredAndSortedRows().OfType().CopyToDataTable(); - this.ControlObj.SetAllControlValue(rowItem, true); + this.ControlObj.SetAllControlValue(rowItem, this.BillModel.isReplaceFixed); if (unionModel.ModelObj.CadDragDetail) { @@ -2349,7 +2373,7 @@ namespace Lskj.PubBill { details = unionModel.TreeGridDetailControlObj.TreeListObj.DataSource as DataTable; } - this.ControlObj.SetAllControlValue(rowItem, true); + this.ControlObj.SetAllControlValue(rowItem, this.BillModel.isReplaceFixed); if (unionModel.ModelObj.CadDragDetail) { @@ -2494,7 +2518,7 @@ namespace Lskj.PubBill // 单据为修改状态,无需设置赋值时不需要计算面板属性 bool isReadOnly = !string.IsNullOrEmpty(this.BillModel.ModifyCond) && !ReplaceHelper.ReplaceRowParamCond(rowItem, this.BillModel.ModifyCond); this.ControlObj.CanExecControl = false; // 单据为修改状态时,无需计算面板属性 - this.lbTitle.Text = this.BillModel.TypeName + "(修改)"; + this.lbTitle.Text = this.BillModel.TypeName + updateText; this.lblOrderNo.Text = rowItem[this.BillModel.PrimaryKey] + ""; this.rdBlue.Checked = "0".Equals(rowItem[this.BillModel.RtagidKey] + ""); this.rdRed.Checked = "1".Equals(rowItem[this.BillModel.RtagidKey] + ""); @@ -2585,7 +2609,7 @@ namespace Lskj.PubBill { // 单据为新增状态 this.dbpFP.Enabled = this.btnDelete.Enabled = this.btnBillSave.Enabled = this.btnBillApply.Enabled = true; - this.lbTitle.Text = this.BillModel.TypeName + "(新增)"; + this.lbTitle.Text = this.BillModel.TypeName + addText; this.lblOrderNo.Text = BillImpl.GetBillNo(this.BillModel.BillSeq); this._itemImport.Enabled = this._itemImportUpdate.Enabled = true; this.cb_input.Enabled = this.btn_input.Enabled = this.txt_input.Enabled = true; @@ -2713,7 +2737,7 @@ namespace Lskj.PubBill protected void OnCopyMasterItemClick(object sender, ItemClickEventArgs e) { this.dbpFP.Enabled = this.btnDelete.Enabled = this.btnBillSave.Enabled = this.btnBillApply.Enabled = true; - this.lbTitle.Text = this.BillModel.TypeName + "(新增)"; + this.lbTitle.Text = this.BillModel.TypeName + addText; this.lbTitle.Invalidate(); this.lblOrderNo.Text = BillImpl.GetBillNo(this.BillModel.BillSeq); this.BillModel.SaveState = false; @@ -2761,7 +2785,7 @@ namespace Lskj.PubBill gridTable = ((this.gcMain as TreeGridControlEx).TreeListObj.DataSource as DataTable).TrimDeleteRows(); } this.dbpFP.Enabled = this.btnDelete.Enabled = this.btnBillSave.Enabled = this.btnBillApply.Enabled = true; - this.lbTitle.Text = this.BillModel.TypeName + "(新增)"; + this.lbTitle.Text = this.BillModel.TypeName + addText; this.lbTitle.Invalidate(); this.lblOrderNo.Text = BillImpl.GetBillNo(this.BillModel.BillSeq); this.rdBlue.Enabled = this.rdRed.Enabled = true; @@ -3488,7 +3512,7 @@ namespace Lskj.PubBill this.RefreshSourceDetail(model); } } - if (model.ModelObj.SourceType == 0 && model.SearchObj.GridRowCount > 0) tabPage.Text = model.ModelObj.UserName + "(" + model.SearchObj.GridRowCount + "条)"; + if (model.ModelObj.SourceType == 0 && model.SearchObj.GridRowCount > 0) tabPage.Text = model.ModelObj.UserName + "(" + model.SearchObj.GridRowCount + QuantitySuffix; // 假如只有单据来源主表没有记录,则手动调用刷新明细.否则会通过选中行自动刷新明细 //if (model.GridControlObj != null && model.GridControlObj.DataRowCount() == 0) //{ @@ -3553,7 +3577,7 @@ namespace Lskj.PubBill BillSourceUnionModel unionModel = tabPage.Tag as BillSourceUnionModel; if (unionModel.ModelObj.SourceType != 2) { - IsBillMaster = false; + int Handle = 0; string sql = ReplaceHelper.ReplaceUserInfo(unionModel.ModelObj.SourceSql); if (unionModel.GridControlObj != null) Handle = unionModel.GridControlObj.GridView.FocusedRowHandle; @@ -3565,6 +3589,10 @@ namespace Lskj.PubBill foreach (ControlModel item in unionModel.SearchObj.ControlModels) { if (!string.IsNullOrWhiteSpace(item.DefaultValue) && RefreshName.Equals(item.DefaultValue.Replace("{", "").Replace("}", ""))) + { + unionModel.SearchObj.SetControlValue(item, baseControl.EditText); + } + else if (RefreshName.Equals(item.FieldName)) { unionModel.SearchObj.SetControlValue(item, baseControl.EditText); } @@ -3586,6 +3614,7 @@ namespace Lskj.PubBill } if (unionModel.TreeViewObj != null && unionModel.ModelObj.DetailSql.IndexOf(RefreshName, StringComparison.OrdinalIgnoreCase) >= 0) { + IsBillMaster = false; if (unionModel.TreeViewObj.TreeView.SelectedNode == null) unionModel.TreeViewObj.TreeView.SelectedNode = unionModel.TreeViewObj.TreeView.Nodes[0];//选中 sql = ReplaceHelper.ReplaceUserInfo(ReplaceHelper.ReplaceWhereCond(unionModel.ModelObj.DetailSql)); sql = sql.Replace("#", ""); @@ -4941,7 +4970,8 @@ namespace Lskj.PubBill model.FieldName.Equals(BillModel.PrimaryKey, StringComparison.OrdinalIgnoreCase) || model.FieldName.Equals(BillModel.RtagidKey, StringComparison.OrdinalIgnoreCase) || model.FieldType == ControlType.LabPic || - model.FieldType == ControlType.LabPicEx) + model.FieldType == ControlType.LabPicEx|| + model.FieldType == ControlType.LabPrompt) continue; if (string.IsNullOrWhiteSpace(model.FieldName)) continue; @@ -4996,7 +5026,8 @@ namespace Lskj.PubBill if (!model.IsSave || model.FieldName.Equals(BillModel.RtagidKey, StringComparison.OrdinalIgnoreCase) || model.FieldType == ControlType.LabPic || - model.FieldType == ControlType.LabPicEx) + model.FieldType == ControlType.LabPicEx|| + model.FieldType == ControlType.LabPrompt ) continue; if (string.IsNullOrWhiteSpace(model.FieldName)) continue; @@ -5863,7 +5894,7 @@ namespace Lskj.PubBill searchSql = optimizedSql; } DataTable dt = MainImpl.GetDataTableResult(searchSql); - if (dt.Rows.Count > 0) tabPage.Text += "(" + dt.Rows[0][0] + "条)"; + if (dt.Rows.Count > 0) tabPage.Text += "(" + dt.Rows[0][0] + QuantitySuffix; } catch (Exception ex) { @@ -6392,7 +6423,7 @@ namespace Lskj.PubBill grdExAdditional.CreateChart(table); } - tabPage.Text = MainModel.DetailName + "(" + firstTable.Rows.Count + "条)"; + tabPage.Text = MainModel.DetailName + "(" + firstTable.Rows.Count + QuantitySuffix; //tabPage.Text = MainModel.DetailName + "(" + firstTable.Rows.Count + "条)"; //tabPage.Appearance.Header.ForeColor = firstTable.Rows.Count > 0 ? Color.Red : Color.FromArgb(0, 0, 0); } @@ -6414,15 +6445,15 @@ namespace Lskj.PubBill if (gridControlEx.CustomGroupBandEx != null) { - tabPage.Text = model.DetailName + "(" + gridControlEx.CustomGroupBandEx.DataRowCount() + "条)"; + tabPage.Text = model.DetailName + "(" + gridControlEx.CustomGroupBandEx.DataRowCount() + QuantitySuffix; } else if (gridControlEx.CustomGroupTreeBandEx != null) { - tabPage.Text = model.DetailName + "(" + gridControlEx.CustomGroupTreeBandEx.DataRowCount() + "条)"; + tabPage.Text = model.DetailName + "(" + gridControlEx.CustomGroupTreeBandEx.DataRowCount() + QuantitySuffix; } else { - tabPage.Text = model.DetailName + "(" + (tabPage.Tag as GridControlEx).ParentControl.GridRowCount + "条)"; + tabPage.Text = model.DetailName + "(" + (tabPage.Tag as GridControlEx).ParentControl.GridRowCount + QuantitySuffix; } //tabPage.Text = gridControlEx.CustomGroupBandEx != null ? model.DetailName + "(" + gridControlEx.CustomGroupBandEx.DataRowCount() + "条)" : model.DetailName + "(" + (tabPage.Tag as GridControlEx).ParentControl.GridRowCount + "条)"; //tabPage.Text = model.DetailName + "(" + (tabPage.Tag as GridControlEx).ParentControl.GridRowCount + "条)"; @@ -6940,7 +6971,7 @@ namespace Lskj.PubBill } //details = GetGridViewFilteredAndSortedDataToDataTable(unionModel.GridDetailControlObj.GridView); //DataTable details = unionModel.GridDetailControlObj.GridView.DataController.GetAllFilteredAndSortedRows().OfType().CopyToDataTable(); - this.ControlObj.SetAllControlValue(rowItem, true); + this.ControlObj.SetAllControlValue(rowItem, this.BillModel.isReplaceFixed); if (unionModel.ModelObj.CadDragDetail) { @@ -7374,7 +7405,7 @@ namespace Lskj.PubBill //如果没有数据,显示 (0条) //(unionModel.ModelObj.SourceType == 0 || this.IsBillShowCount) && unionModel.SearchObj.GridRowCount > 0 - if (unionModel.ModelObj.SourceType == 0 || this.IsBillShowCount) tabPage.Text = unionModel.ModelObj.UserName + "(" + unionModel.SearchObj.GridRowCount + "条)"; + if (unionModel.ModelObj.SourceType == 0 || this.IsBillShowCount) tabPage.Text = unionModel.ModelObj.UserName + "(" + unionModel.SearchObj.GridRowCount + QuantitySuffix; RefreshSourceDetail(unionModel); } @@ -8291,13 +8322,19 @@ namespace Lskj.PubBill if (e.SelectTreeNode != null) { Pid = e.SelectTreeNode[(this.gcMain as TreeGridControlEx).TreeListObj.KeyFieldName] + ""; + + DataRow SelectRow = (this.gcMain as TreeGridControlEx).GetViewSpecifyDataRow(e.SelectTreeNode); + if (!string.IsNullOrWhiteSpace(this.BillModel.TreeTableDragCondition)&&!ReplaceHelper.EvalCond(ReplaceHelper.ReplaceRowParam(SelectRow, this.BillModel.TreeTableDragCondition))) + { + return; + } } XtraTabPage tabPage = this.xtc_left_container.SelectedTabPage; BillSourceUnionModel unionModel = tabPage.Tag as BillSourceUnionModel; int oldRowHandle = this.gcMain.GridView.FocusedRowHandle; foreach (DataRow rowItem in e.GridViewSelectRows) { - //添加拖拽行行 + //添加拖拽行 this.AddMultiRowTreeGridControl(new DataRow[] { rowItem }, Pid); if (!string.IsNullOrWhiteSpace(unionModel.AddDataSql) && !string.IsNullOrWhiteSpace(unionModel.AddDataCondition) && this.ValidateCond(unionModel.AddDataCondition, rowItem)) { @@ -8345,7 +8382,7 @@ namespace Lskj.PubBill { //当前树表格中最大的id号 int NodeId = int.Parse((this.gcMain as TreeGridControlEx).GetNewNodesId()) - 1; - //当前树表格中如果id为bull,要赋值的id值(节点id不能为null) + //当前树表格中如果id为null,要赋值的id值(节点id不能为null) int NewNodeId = int.Parse((this.gcMain as TreeGridControlEx).GetNewNodesId()); //根据当前的节点号,改变新增数据源中的节点号 @@ -8944,7 +8981,7 @@ namespace Lskj.PubBill { details = unionModel.TreeGridDetailControlObj.TreeListObj.DataSource as DataTable; } - this.ControlObj.SetAllControlValue(rowItem, true); + this.ControlObj.SetAllControlValue(rowItem, this.BillModel.isReplaceFixed); if (unionModel.ModelObj.CadDragDetail) { @@ -9334,11 +9371,282 @@ namespace Lskj.PubBill } } - - - - /// /// 判断是不是数值 /// - /// \ No newline at end of file + /// + /// + private bool IsNumberic(string oText) + { + try + { + int var1 = Convert.ToInt32(oText); + return true; + } + catch + { + return false; + } + } + + /// + /// 打开来源模块,并把选中的数据反写到主表明细中 + /// + /// + /// + private void OpenTheSourcePopup(object sender, EventArgs e) + { + string SourceId = sender + ""; + if (string.IsNullOrWhiteSpace(SourceId)) return; + FrmDocumentSource frmSource = new FrmDocumentSource(SourceId); + frmSource.WindowState = FormWindowState.Maximized; + if (frmSource.ShowDialog() == DialogResult.OK) + { + this.gcMain.GridView.BeginUpdate(); + foreach (DataRow rowItem in frmSource.DataRows) + { + this.AddRowToGridView(rowItem); + } + this.gcMain.GridView.EndUpdate(); + } + + } + + /// + /// 所有粘贴完成后执行 + /// + /// + /// + private void OnAllAfterParseCallBack(object sender, EventArgs e) + { + DataTable gridTable = (this.gcMain.GridControl.DataSource as DataTable).TrimDeleteRows(); + gridTable.OrderBy(this.BillModel.DetailOrderField); + this.gcMain.GridView.UpdateCurrentRow(); + this.gcMain.GridView.ShowEditor(); + } + + + + + /// + /// 说明:设置图片事件 + /// 创建人:龚宇超 + /// 创建日期:2018-02-27 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + private void SetImageEvent(DataTable table) + { + if (table == null || table.Rows.Count == 0) return; + DataRow[] imageRows = table.Select("fieldTypeId=" + (int)ControlType.LabPicEx); + + foreach (DataRow item in imageRows) + { + string fieldName = item["fieldName"] + ""; + LabelImageEdit imageEdit = this.ControlObj.FindControl(fieldName) as LabelImageEdit; + if (imageEdit != null) + { + imageEdit.UploadEvent += new LabelImageEdit.UploadEventHander(OnImageUploadEvent); + imageEdit.DeleteEvent += new LabelImageEdit.DeleteEventHander(OnImageDeleteEvent); + } + } + } + + + /// + /// 说明:上传附件 + /// 创建人:龚宇超 + /// 创建日期:2018-02-27 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The sender. + protected void OnImageUploadEvent(object sender) + { + try + { + _imageEdit = sender as LabelImageEdit; + if (string.IsNullOrWhiteSpace(this.lblOrderNo.Text)) + { + MessageUtil.Show(ResourceKeys.UnSaveData); + } + else + { + //string prefix = "001"; + //string imagePath = _imageEdit.SaveImageToLocal(prefix); + OpenFileDialog openFileDialog = new OpenFileDialog(); + if (openFileDialog.ShowDialog() == DialogResult.OK) + { + WaitForm.ShowForm("上传中..."); + if (!string.IsNullOrEmpty(openFileDialog.FileName)) + { + Image image = null; + bool isImage = true; + try + { + image = Image.FromFile(openFileDialog.FileName); + } + catch (Exception) + { + isImage = false; + } + if (image != null && isImage) + { + _imageEdit.TextEdit.Image = image; + } + else + { + _imageEdit.TextEdit.Image = global::Lskj.Control.Properties.Resources.file; + } + _imageEdit.CurrentImagePath = openFileDialog.FileName; + } + else + { + _imageEdit.CurrentImagePath = string.Empty; + } + string imagePath = _imageEdit.CurrentImagePath; + if (!string.IsNullOrEmpty(imagePath)) + { + //string speciesNo = string.IsNullOrEmpty(lteSpeciesNo.TextEdit.Text) ? "01" : lteSpeciesNo.TextEdit.Text; + //int directotyId = AttachImpl.GetAttachDirectoryId(this.SysModel.MenuDirId + "", this.PrimaryValue); + //AttachHelper.UpLoadFile(this.Handle, directotyId + "", speciesNo, "001", imagePath); + bool isSuccess = UploadFile(imagePath); + if (!isSuccess) + { + _imageEdit.CurrentImagePath = string.Empty; + _imageEdit.TextEdit.Image = null; + } + } + else + { + MessageUtil.Show("未选择上传文件"); + } + WaitForm.HideForm(); + } + } + } + catch (Exception ex) + { + string Message = ErrorMessage.PromptErrorMessage(ex); + MessageUtil.Show(Message, ex.Message); + } + + } + /// + /// 上传附件(新) + /// + private bool UploadFile(string filePath) + { + bool isUpload = true; + try + { + string token = ""; + string loginUrl = $"{SystemInfo.Instance.OAUrl}/Api/SysUserAjaxApi.ashx"; + HttpTools.setting("application/x-www-form-urlencoded", null, null, HttpTools.Encode.UTF8); + Dictionary loginPmsDic = new Dictionary(); + loginPmsDic.Add("method", "Login"); + loginPmsDic.Add("username", ERPInfo.Instance.UserName); + loginPmsDic.Add("password", ERPInfo.Instance.InPassWord); + HttpWebResponse loginResponse = HttpTools.Post(loginUrl, "", loginPmsDic, HttpTools.Method.POST, out CookieCollection loginCookie, out string loginResult); + if (loginResponse != null && !string.IsNullOrEmpty(loginResult)) + { + JObject jObject = JsonConvert.DeserializeObject(loginResult); + if (jObject.ContainsKey("success")) + { + if ((jObject["success"] + "").Equals("True")) + { + if (jObject.ContainsKey("token")) + { + token = jObject["token"] + ""; + } + } + } + } + if (!string.IsNullOrEmpty(token)) + { + byte[] fileBytes = ConvertFileToBytes(filePath); + string fileBase64Str = Convert.ToBase64String(fileBytes) + ""; + string postUrl = "{0}Api/FileUploadApi.ashx?moduleId={1}&idValue={2}&folder={3}&totsize={4}&position={5}&filename={6}&method={7}"; + Dictionary headerDic = new Dictionary(); + headerDic.Add("Authorization", $"Bearer {token}"); + postUrl = string.Format(postUrl, SystemInfo.Instance.OAUrl, this.SysModel.ModuleCode, this.lblOrderNo.Text, "UploadFilesTemp", fileBytes.Length, 0, HttpUtility.UrlEncode($"{Guid.NewGuid()}_{Path.GetFileName(_imageEdit.CurrentImagePath)}"), "DoWebUpload"); + HttpTools.setting("application/x-www-form-urlencoded", null, null); + HttpWebResponse webResponse = HttpTools.Post(postUrl, fileBase64Str, null, headerDic, HttpTools.Method.POST, out CookieCollection cookieCollection, out string result); + if (webResponse != null && !string.IsNullOrEmpty(result)) + { + JObject jsonObject = (JObject)JsonConvert.DeserializeObject(result); + string isSuccess = jsonObject["success"] + ""; + if (isSuccess.Equals("True", StringComparison.CurrentCultureIgnoreCase)) + { + string fileId = jsonObject["other"] + ""; + string webpath = jsonObject["data"]["WebRelPath"] + ""; + BaseModuleImpl.UpdateRecord(this.BillModel.MasterTable, _imageEdit.Model.FieldName, webpath, this.BillModel.PrimaryKey, this.lblOrderNo.Text); + //string searchSql = @"update P_fm_FileTab set author='{2}',CreationTime='{3}' ,Uploader='{4}' ,UploadTime='{5}' + // where dllcoid = '{0}' and + // parentid = (select dirid from P_fm_DirectoryTab where + // ParentId = (select dirid from v_systemdlltab where DllCoid = '{0}') and PID = '{1}') and fileId='{6}' "; + //searchSql = string.Format(searchSql, this.Model.ModuleCode, this.leftTreeGridIdValue, dataRow["author"], fi.CreationTime, ERPInfo.Instance.UserName, dataRow["UploadTime"], fileId); + //SqlHelper.ExecuteNonQuery(searchSql); + } + else + { + if (jsonObject.ContainsKey("msg")) + { + string returnMsg = jsonObject["msg"] + ""; + MessageUtil.Show(string.Format("上传失败,原因:{0}", returnMsg)); + } + isUpload = false; + } + } + else + { + MessageUtil.Show(string.Format("上传失败,原因:{0}", result)); + } + } + else + { + MessageUtil.Show(string.Format("验证失败,原因:{0}", loginResult)); + } + } + catch (Exception ex) + { + MessageUtil.Show(string.Format("上传失败,原因:{0}", ex.Message)); + isUpload = false; + } + return isUpload; + } + /// + /// 附件转换byte[] + /// + /// 附件路径 + /// 二进制 + private byte[] ConvertFileToBytes(string filePath) + { + byte[] bytContent = null; + System.IO.FileStream fs = null; + System.IO.BinaryReader br = null; + try + { + fs = new FileStream(filePath, System.IO.FileMode.Open, FileAccess.Read, FileShare.Read); + } + catch (Exception) + { + throw; + } + if (fs != null) + br = new BinaryReader((Stream)fs); + if (br != null) + bytContent = br.ReadBytes((Int32)fs.Length); + if (fs != null) + fs.Dispose(); + return bytContent; + } + + /// + /// 说明:删除附件 + /// 创建人:龚宇超 + /// 创 \ No newline at end of file diff --git a/插件库/Lskj.PubBill/FrmDocumentSource.cs b/插件库/Lskj.PubBill/FrmDocumentSource.cs index 21f0a8f..d95aab7 100644 --- a/插件库/Lskj.PubBill/FrmDocumentSource.cs +++ b/插件库/Lskj.PubBill/FrmDocumentSource.cs @@ -179,7 +179,7 @@ namespace Lskj.PubBill }; ; DynamicModel dynamicModel = new DynamicModel(obj); this.gcMain.SetGridRightMenus(dt, dynamicModel, this.OnGridViewRightCallBack, this.SearchObj, null); - this.gcMain.GridView.OptionsView.ColumnAutoWidth = true; + //this.gcMain.GridView.OptionsView.ColumnAutoWidth = true; }