//20181113 modified by kexp 修改为导入完成后统一提示一次; /// <summary> /// 定版后启动 /// </summary> /// <param name="bizItems"></param> private void AfterItemReleased(IBizItem[] bizItems) { string message = ""; if (bizItems != null) { ArrayList list = new ArrayList(bizItems); foreach (object obj2 in list) { if (typeof(IBizItem).IsInstanceOfType(obj2)) { IBizItem item = (IBizItem)obj2; //ExportExecute(item); var bItem = BusinessHelper.Instance.GetDEBusinessItem(item); //var ss = OperationConfigHelper.Instance; string errText; BusinessHelper.Instance.ExportToERP(bItem, true, out errText); if (errText == "ERP导入成功!") { continue; } else { message = errText; break; } } } } if (string.IsNullOrEmpty(message) && !message.Equals("sys_error")) { return; } MessageBoxPLM.Show(message); }
public void OnExportToERP(object sender, PLMOperationArgs args) { if (((args != null) && (args.BizItems != null)) && (args.BizItems.Length != 0)) { //IBizItem item = args.BizItems[0]; //var bItem = BusinessHelper.Instance.GetDEBusinessItem(item); //20181113 modified by kexp 修改为导入完成后统一提示一次; //BusinessHelper.Instance.ExportToERP(bItem,false); //DEBusinessItem theItem = PSConvert.ToBizItem(args.BizItems[0], args.Option.CurView, ClientData.LogonUser); string message = "ERP导入成功!"; ArrayList list = new ArrayList(args.BizItems); foreach (object obj2 in list) { if (typeof(IBizItem).IsInstanceOfType(obj2)) { IBizItem item = (IBizItem)obj2; //ExportExecute(item); var bItem = BusinessHelper.Instance.GetDEBusinessItem(item); //var ss = OperationConfigHelper.Instance; string errText; BusinessHelper.Instance.ExportToERP(bItem, false, out errText); if (errText == "ERP导入成功!") { continue; } else { message = errText; break; } } } MessageBoxPLM.Show(message); } }
/// <summary> /// 获取当前对象 /// </summary> /// <param name="iItem"></param> /// <returns></returns> public DEBusinessItem GetDEBusinessItem(IBizItem iItem) { IActionContext context = ActionContext2.GetInstance().GetCurrentContext(); DEPSOption option = null; if (context != null && context.NavContext.Option != null) { option = context.NavContext.Option; } if (option == null) { option = ClientData.UserGlobalOption; } if (iItem == null) { return(null); } DEBusinessItem bItem = iItem as DEBusinessItem; if (bItem == null && iItem is DESmartBizItem) { DESmartBizItem sb = iItem as DESmartBizItem; bItem = (DEBusinessItem)PLItem.Agent.GetBizItem(sb.MasterOid, sb.RevOid, sb.IterOid, option.CurView, ClientData.LogonUser.Oid, BizItemMode.BizItem); } return(bItem); }
protected virtual void FillDetailImage() { try { Cursor.Current = Cursors.WaitCursor; if (base.SmallImageList == null) { base.SmallImageList = ClientData.MyImageList.ImgList; } List <IBizItem> bizItems = new List <IBizItem>(); ArrayList masterOids = new ArrayList(); ArrayList revNums = new ArrayList(); for (int i = base.TopItem.Index; i < base.Items.Count; i++) { if ((base.Items[i] != null) && (base.Bounds.Bottom > base.Items[i].Bounds.Top)) { ListViewItem item = base.Items[i]; IBizItem tag = null; if (item.Tag is IBizItem) { tag = item.Tag as IBizItem; item.ImageIndex = this.GetColumnImageIndex(tag); } else if (item.Tag is DataRowView) { masterOids.Add(new Guid((byte[])((DataRowView)item.Tag)[0])); revNums.Add(0); } } } if (masterOids.Count > 0) { ArrayList list4 = PLItem.Agent.GetBizItemsByMasters(masterOids, revNums, this.ThumPSOption.CurView, ClientData.LogonUser.Oid, BizItemMode.BizItem); if (list4.Count > 0) { bizItems.AddRange((IBizItem[])list4.ToArray(typeof(IBizItem))); } } if (bizItems.Count != 0) { for (int j = base.TopItem.Index; j < base.Items.Count; j++) { if ((base.Items[j] != null) && (base.Bounds.Bottom > base.Items[j].Bounds.Top)) { ListViewItem item3 = base.Items[j]; IBizItem item4 = null; if (item3.Tag is DataRowView) { Guid masterOid = new Guid((byte[])((DataRowView)item3.Tag)[0]); item4 = FindBizItems(bizItems, masterOid); item3.ImageIndex = this.GetColumnImageIndex(item4); } } } } } finally { Cursor.Current = Cursors.Default; } }
private void lvwTSD_DoubleClick(object sender, EventArgs e) { if ((this.lvwTSD.SelectedItems.Count == 1) && (PLGrantPerm.CanDoClassOperation(ClientData.LogonUser.Oid, "DQDOSSIERPRINT", Guid.Empty, "ClaRel_BROWSE") != 0)) { ListViewItem item = this.lvwTSD.SelectedItems[0]; IBizItem tag = item.Tag as IBizItem; this.OpenItem(sender, tag); } }
public void OnMatch(object sender, PLMOperationArgs args) { if (((args != null) && (args.BizItems != null)) && (args.BizItems.Length != 0)) { IBizItem item = args.BizItems[0]; DEBusinessItem theItem = PSConvert.ToBizItem(item, args.Option.CurView, ClientData.LogonUser.Oid); AttributeSelectorFrm frm = new AttributeSelectorFrm(theItem, sender, args); frm.ShowDialog(); } }
private void OpenItem(object sender, IBizItem it) { if (BizItemHandlerEvent.Instance.D_OpenItem != null) { PSEventArgs args = new PSEventArgs { PSOption = ClientData.UserGlobalOption }; PLMOperationArgs e = new PLMOperationArgs(FrmLogon.PLMProduct.ToString(), PLMLocation.ItemList.ToString(), it); BizItemHandlerEvent.Instance.D_OpenItem(sender, e); } }
private void lvwTSD_DragDrop(object sender, DragEventArgs e) { if (e.Data != null) { DEBusinessItem item; ArrayList list = new ArrayList(); ArrayList list2 = new ArrayList(); foreach (ListViewItem item2 in this.lvwTSD.Items) { IBizItem tag = item2.Tag as IBizItem; list2.Add(tag.MasterOid); } if (e.Data.GetDataPresent(typeof(CLCopyData))) { CLCopyData data = (CLCopyData)e.Data.GetData(typeof(CLCopyData)); foreach (object obj2 in data) { item = PlArchivManage.GetItem(obj2); if ((item.Master.ClassName == "DQDOSSIERPRINT") && ((item != null) && !list2.Contains(item.MasterOid))) { list2.Add(item.MasterOid); list.Add(item); } } } else { item = PlArchivManage.GetItem(e.Data.GetData(typeof(IBizItem))); if (item != null) { if (item.Master.ClassName != "DQDOSSIERPRINT") { return; } if (!list2.Contains(item.MasterOid)) { list2.Add(item.MasterOid); list.Add(item); } } } if (list.Count > 0) { foreach (DEBusinessItem item4 in list) { PlArchivManage.SetLvwValues(this.hsCols, this.lvwTSD, this.lstOrder, item4); } this.lvwTSD.Refresh(); } } }
private int GetColumnImageIndex(IBizItem item) { if (item == null) { return(-1); } ItemState state = (item.LastRevision == item.RevNum) ? item.State : ItemState.Release; if (item.LastRevision == item.RevNum) { state = (item.LastIteration == item.IterNum) ? item.State : ItemState.CheckIn; } return(ClientData.ItemImages.GetObjectImage(item.ClassName, PLDataModel.GetStateByMasterInfo(state, item.HasFile))); }
public void DisplyListItemThum(ListViewItem lvItem) { if (((((lvItem != null) && (this.ThumSetting != null)) && (this.ThumSetting.DisplayStyle != DisplayStyle.Detail)) && ((base.Bounds.Bottom > lvItem.Bounds.Bottom) && (lvItem.Index >= base.TopItem.Index))) && (lvItem.Tag is IBizItem)) { IBizItem tag = lvItem.Tag as IBizItem; string path = UIThumbnailHelper.Instance.DownLoadThumFile(tag, this.ThumPSOption); string str2 = Path.Combine(ConstConfig.GetTempfilePath(), "Thum"); if (!Directory.Exists(str2)) { Directory.CreateDirectory(str2); } string key = ""; Image reducedImage = null; if (File.Exists(path)) { key = Path.GetFileName(path); reducedImage = UIThumbnailHelper.Instance.GetReducedImage(path); if (reducedImage != null) { if (this.ThumImageList.Images.ContainsKey(key)) { int num = this.ThumImageList.Images.IndexOfKey(key); this.ThumImageList.Images[num] = reducedImage; } else { this.ThumImageList.Images.Add(key, reducedImage); } reducedImage.Dispose(); } } else { int objectImage = ClientData.ItemImages.GetObjectImage(tag.ClassName, PLDataModel.GetStateByMasterInfo(tag.ExactState, tag.HasFile)); if (!this.ThumImageList.Images.ContainsKey(objectImage.ToString())) { string filename = Path.Combine(str2, objectImage.ToString() + ".jpg"); reducedImage = ClientData.ItemImages.GetObjectImage1(tag.ClassName, PLDataModel.GetStateByMasterInfo(tag.ExactState, tag.HasFile)); reducedImage.Save(filename); this.ThumImageList.Images.Add(objectImage.ToString() + ".jpg", reducedImage); reducedImage.Dispose(); } } lvItem.ImageIndex = this.ThumImageList.Images.IndexOfKey(key); } }
public string DownLoadThumFile(IBizItem bizItem, DEPSOption psOption) { List <Guid> list = new List <Guid>(); List <string> list2 = new List <string>(); list.Add(bizItem.IterOid); list2.Add(bizItem.ClassName); string fullPath = ""; DEItemIteration2[] thumBizitemIters = null; DESecureFile[] files = null; PLItem.Agent.GetThumbnailFiles(list.ToArray(), list2.ToArray(), ClientData.LogonUser.Oid, (psOption == null) ? ClientData.UserGlobalOption.CloneAsLocal() : psOption, out thumBizitemIters, out files); new Dictionary <Guid, string>(); for (int i = 0; i < list.Count; i++) { if (files[i] != null) { bizItem.ThumBizitemIterOid = thumBizitemIters[i].Oid; fullPath = ViewFileHelper.DownloadFileByDir(thumBizitemIters[i], files[i], null, psOption, true, false, "ClaRel_BROWSE"); if (string.IsNullOrEmpty(fullPath)) { return(fullPath); } string path = Path.Combine(ConstConfig.GetTempfilePath(), "Thum"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string destFileName = Path.Combine(path, files[i].FileOid.ToString() + ".jpg"); if (File.Exists(fullPath)) { File.Copy(fullPath, destFileName, true); } else if (!string.IsNullOrEmpty(files[i].FullPath) && File.Exists(files[i].FullPath)) { fullPath = files[i].FullPath; } } } return(fullPath); }
public static void FillItemImage(ThumbnailListView lvw) { try { try { if ((!lvw.Visible || (lvw.TopItem == null)) || (lvw.TopItem.Index == -1)) { return; } } catch { return; } Cursor.Current = Cursors.WaitCursor; if ((lvw.SmallImageList == null) || (lvw.SmallImageList != lvw.ThumImageList)) { lvw.SmallImageList = lvw.ThumImageList; } int generation = GC.GetGeneration(lvw.ThumImageList); List <IBizItem> bizItems = new List <IBizItem>(); ArrayList masterOids = new ArrayList(); ArrayList revNums = new ArrayList(); for (int i = lvw.TopItem.Index; i < lvw.Items.Count; i++) { if ((lvw.Items[i] != null) && (lvw.Bounds.Bottom > lvw.Items[i].Bounds.Top)) { ListViewItem item = lvw.Items[i]; IBizItem tag = null; if (item.Tag is IBizItem) { tag = item.Tag as IBizItem; } else if (item.Tag is DataRowView) { try { masterOids.Add(new Guid((byte[])((DataRowView)item.Tag)[0])); revNums.Add(0); } catch { } } if (tag != null) { bizItems.Add(tag); } } } if (masterOids.Count > 0) { ArrayList list4 = PLItem.Agent.GetBizItemsByMasters(masterOids, revNums, lvw.ThumPSOption.CurView, ClientData.LogonUser.Oid, BizItemMode.BizItem); if (list4.Count > 0) { bizItems.AddRange((IBizItem[])list4.ToArray(typeof(IBizItem))); } } Dictionary <Guid, string> dictionary = new Dictionary <Guid, string>(); if (bizItems.Count > 0) { try { dictionary = UIThumbnailHelper.Instance.DownLoadThumFiles(bizItems, lvw.ThumPSOption); } catch (Exception exception) { PLMEventLog.WriteExceptionLog(exception); } } string key = 0.ToString() + ".jpg"; if (!lvw.ThumImageList.Images.ContainsKey(key)) { string path = Path.Combine(ConstConfig.GetTempfilePath(), "Thum"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string filename = Path.Combine(path, key); Image image = ClientData.ItemImages.imageList.Images[0]; image.Save(filename); lock (typeof(ImageList)) { lvw.ThumImageList.Images.Add(key, image); } image.Dispose(); } for (int j = lvw.TopItem.Index; j < lvw.Items.Count; j++) { if ((lvw.Items[j] != null) && (lvw.Bounds.Bottom > lvw.Items[j].Bounds.Top)) { ListViewItem item3 = lvw.Items[j]; IBizItem item4 = null; if (item3.Tag is IBizItem) { item4 = item3.Tag as IBizItem; } else if (item3.Tag is DataRowView) { try { Guid masterOid = new Guid((byte[])((DataRowView)item3.Tag)[0]); item4 = FindBizItems(bizItems, masterOid); } catch { } } if (item4 != null) { string str4 = ""; string fileName = ""; Image reducedImage = null; if (dictionary.ContainsKey(item4.IterOid)) { str4 = dictionary[item4.IterOid]; if (File.Exists(str4)) { fileName = Path.GetFileName(str4); reducedImage = UIThumbnailHelper.Instance.GetReducedImage(str4); if (reducedImage != null) { if (lvw.ThumImageList.Images.ContainsKey(fileName)) { int num5 = lvw.ThumImageList.Images.IndexOfKey(fileName); lvw.ThumImageList.Images[num5] = reducedImage; } else { lock (typeof(ImageList)) { lvw.ThumImageList.Images.Add(fileName, reducedImage); } } reducedImage.Dispose(); } } } else { fileName = ClientData.ItemImages.GetObjectImage(item4.ClassName, PLDataModel.GetStateByMasterInfo(item4.ExactState, item4.HasFile)).ToString() + ".jpg"; if (!lvw.ThumImageList.Images.ContainsKey(fileName)) { string str6 = Path.Combine(ConstConfig.GetTempfilePath(), "Thum"); if (!Directory.Exists(str6)) { Directory.CreateDirectory(str6); } string str7 = Path.Combine(str6, fileName); reducedImage = ClientData.ItemImages.GetObjectImage1(item4.ClassName, PLDataModel.GetStateByMasterInfo(item4.ExactState, item4.HasFile)); reducedImage.Save(str7); lock (typeof(ImageList)) { lvw.ThumImageList.Images.Add(fileName, reducedImage); } reducedImage.Dispose(); } } item3.ImageIndex = lvw.ThumImageList.Images.IndexOfKey(fileName); } } } lvw.Refresh(); GC.GetGeneration(generation); } finally { Cursor.Current = Cursors.Default; } }
private void AfterItemUpdated(IBizItem[] bizItems) { if ((bizItems != null) && (bizItems.Length != 0)) { ArrayList list = new ArrayList(PSConvert.ToBizItems(bizItems, ClientData.UserGlobalOption.CurView, ClientData.LogonUser.Oid)); foreach (DEBusinessItem item in list) { if (!(item.ClassName != "DQDOSSIRSENT")) { PlArchivManage.UpdateLvwValues(this.hsCols, this.lvwSentLst, this.lstOrder, item); } } } }
private void AfterItemUpdated(IBizItem[] bizItems) { if ((bizItems != null) && (bizItems.Length != 0)) { ArrayList list = new ArrayList(PSConvert.ToBizItems(bizItems, ClientData.UserGlobalOption.CurView, ClientData.LogonUser.Oid)); foreach (DEBusinessItem item in list) { if (item.ClassName != "DQDOSSIERPRINT") { break; } string tsStatue = PlArchivManage.GetTsStatue(item); string str2 = tsStatue; if ((str2 == null) || ((str2 != "打印完成") && (str2 != "打印取消"))) { if (tsStatue == "开始打印") { bool flag = false; foreach (ListViewItem item2 in this.lvwTSD.Items) { DEBusinessItem tag = item2.Tag as DEBusinessItem; if (tag.MasterOid == item.MasterOid) { flag = true; break; } } if (!flag) { continue; } } this.UpdateTsdItem(item); } } } }
private void AfterTsdUpdate(IBizItem[] bizItems) { if ((bizItems != null) && (bizItems.Length != 0)) { ArrayList list = new ArrayList(PSConvert.ToBizItems(bizItems, ClientData.UserGlobalOption.CurView, ClientData.LogonUser.Oid)); foreach (DEBusinessItem item in list) { if (item.ClassName != "DQDOSSIERPRINT") { break; } switch (PlArchivManage.GetTsStatue(item)) { case "打印完成": case "打印取消": case "开始打印": this.UpdateTsdItem(item); break; } } } }
public static void ViewFile(DESecureFile file, string fileName, string className, DELProcessInfoForCLT processArgs, bool deleteAllowed, IBizItem bizItem, DEBrowser browser, bool isShowFileList) { CurViewFilePath = fileName; if (bizItem != null) { switch (PLGrantPerm.Agent.CanDoObjectOperation(ClientData.LogonUser.Oid, bizItem.MasterOid, bizItem.ClassName, PLGrantPerm.ToPermString(PLMBOOperation.BOView), bizItem.SecurityLevel, bizItem.Phase, bizItem.RevNum)) { case 0: MessageBoxPLM.Show("您没有浏览该对象源文件的权限。", "浏览源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; case 2: MessageBoxPLM.Show("当前对象在流程中,您没有浏览该对象源文件的权限。", "浏览源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (Path.GetExtension(fileName).ToUpper() == ".GXT") { switch (PLGrantPerm.Agent.CanDoObjectOperation(ClientData.LogonUser.Oid, bizItem.MasterOid, bizItem.ClassName, PLGrantPerm.ToPermString(PLMBOOperation.BODownload), bizItem.SecurityLevel, bizItem.Phase, bizItem.RevNum)) { case 0: MessageBoxPLM.Show("您没有下载该对象源文件的权限。", "编辑源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; case 2: MessageBoxPLM.Show("当前对象在流程中,您没有下载该对象源文件的权限。", "编辑源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } } FileBrowseWay innerBrowser = FileBrowseWay.InnerBrowser; string title = "文件浏览"; BrowserDisplayRule rule = null; if (Path.GetExtension(fileName).ToUpper() == ".GXT") { rule = new BrowserDisplayRule { IsEdit = IsEditGxt, OnlyBrowser = IsOnlyBrowser }; if (IsEditGxt) { title = "文件编辑"; } rule.Item = bizItem as DEBusinessItem; IsEditGxt = false; IsOnlyBrowser = false; } try { if (browser == null) { innerBrowser = UIBrowser.GetBrowser(file.FileOid, fileName, file.FileType, out browser); } else { innerBrowser = browser.IsInnerBrowser ? FileBrowseWay.InnerBrowser : FileBrowseWay.OpenProcess; } } catch (Exception exception) { PrintException.Print(exception, title); return; } if (innerBrowser == FileBrowseWay.InnerBrowser) { FrmViewFile file2 = null; Form form = FormManager.GetForm(PLMFormType.ViewFile, file.FileOid); if ((form != null) && (form is FrmViewFile)) { file2 = (FrmViewFile)form; if (bizItem != null) { file2.Text = bizItem.Id + "[" + ModelContext.MetaModel.GetClassLabel(bizItem.ClassName) + "] - " + title; file2.SetStatusText(GetSecureFile(bizItem, file.FileOid)); } else { file2.Text = Path.GetFileName(fileName) + " - " + title; } } else { try { file2 = new FrmViewFile(); if (bizItem != null) { file2.Text = bizItem.Id + "[" + ModelContext.MetaModel.GetClassLabel(bizItem.ClassName) + "] - " + title; file2.SetStatusText(GetSecureFile(bizItem, file.FileOid)); } else { file2.Text = Path.GetFileName(fileName) + " - " + title; } } catch (Exception exception2) { PrintException.Print(exception2, MessageBoxIcon.Exclamation); return; } file2.SetManaged(PLMFormType.ViewFile, file.FileOid); } file2.SetInput(bizItem, file, isShowFileList, processArgs, className); file2.Show(); file2.Activate(); string deleteFilePath = null; if (deleteAllowed) { deleteFilePath = Path.GetDirectoryName(fileName); } UIBrowser.OpenFileWithBrowser(file.FileOid, fileName, file2.panelBrowser, innerBrowser, browser, deleteFilePath, rule, bizItem); } else { UIBrowser.OpenFileWithBrowser(file.FileOid, fileName, null, innerBrowser, browser, Path.GetDirectoryName(fileName), bizItem); } }
public static void ViewFile(DESecureFile file, string fileName, string className, DELProcessInfoForCLT processArgs, bool deleteAllowed, IBizItem bizItem) { ViewFile(file, fileName, className, processArgs, deleteAllowed, bizItem, null, false); }
public static void ViewFile(Guid fileOid, string fileName, Guid fileTypeOid, bool deleteAllowed, IBizItem bizItem) { DESecureFile file = new DESecureFile { FileOid = fileOid, FileName = Path.GetFileName(fileName), Location = Path.GetDirectoryName(fileName), FileType = fileTypeOid }; ViewFile(file, fileName, (bizItem == null) ? string.Empty : bizItem.ClassName, null, deleteAllowed, bizItem); }
public void SetBizItem(IBizItem item) { this.iBizItem = item; }
private static DESecureFile GetSecureFile(IBizItem bizItem, Guid fileOid) { return(PSConvert.ToBizItem(bizItem, ClientData.UserGlobalOption.CurView, ClientData.LogonUser.Oid).Iteration.FileList.FindFile(fileOid)); }
private void SetInput(IBizItem bizItem, DESecureFile file, bool isShowFileList, DELProcessInfoForCLT processArgs, string className) { if (bizItem != null) { this._bizItem = PSConvert.ToBizItem(bizItem, ClientData.UserGlobalOption.CurView, ClientData.LogonUser.Oid); } else { this.pnlFileList.Visible = false; isShowFileList = false; } this._processArgs = processArgs; this._className = className; bool flag = isShowFileList ? (this._bizItem.FileCount > 1) : false; this.pnlFileList.Visible = flag || (this._processArgs != null); this.btnMarkup.Visible = this._processArgs != null; if (!this.IsMarkUpMode) { this.splitContainerSmall.PanelVisibility = SplitPanelVisibility.Panel1; this.panelButtons.Visible = false; this.btnMarkup.Enabled = true; } else { this.splitContainerSmall.PanelVisibility = SplitPanelVisibility.Both; this.panelButtons.Visible = true; this.btnMarkup.Enabled = false; } ArrayList fileList = null; if (isShowFileList) { fileList = this._bizItem.FileList; } else { fileList = new ArrayList { file }; } this.combFiles.SelectedIndexChanged -= new EventHandler(this.combFiles_SelectedIndexChanged); this.combFiles.DataSource = fileList; try { for (int i = 0; i < this.combFiles.Properties.Items.Count; i++) { DESecureFile file2 = this.combFiles.Properties.Items[i] as DESecureFile; if ((file2 != null) && (file2.FileOid == file.FileOid)) { this.combFiles.SelectedIndex = i; goto Label_01A1; } } } finally { this.combFiles.SelectedIndexChanged += new EventHandler(this.combFiles_SelectedIndexChanged); } Label_01A1: this.LastSelectedIndex = this.combFiles.SelectedIndex; }
public void SetParentItem(IBizItem pitem) { this.iPBizItem = pitem; }
public ThumShowEventArgs(IBizItem bizItem, DESecureFile file) { this.bizItem = bizItem; this.file = file; }