public WF_DETAIL GetWfAppLastDetailByWfaID(string wfaID) { WF_DETAIL detail = null; StringBuilder stb = new StringBuilder(); stb.Append(" WHERE 1=1 AND WFA_ID='" + wfaID + "'"); stb.Append(" AND RECIVEDATE IN (SELECT MAX(RECIVEDATE) FROM WF_DETAIL WHERE WFA_ID='" + wfaID + "') "); DataTable dt = CommonFuns.getDataTableBySql("*", stb.ToString(), "WF_DETAIL"); if (dt == null || dt.Rows.Count == 0) { return(null); } else { detail = new WF_DETAIL(); DataRow dr = dt.Rows[0]; detail.WFA_ID = dt.Rows[0]["WFA_ID"].ToString(); detail.WFD_ID = dt.Rows[0]["WFD_ID"].ToString(); detail.WFT_STEP_ID = dt.Rows[0]["WFT_STEP_ID"].ToString(); detail.RECIVEDATE = dt.Rows[0]["RECIVEDATE"].ToString(); detail.MSG = dt.Rows[0]["MSG"].ToString(); detail.IS_Through = dt.Rows[0]["IS_Through"].ToString(); detail.Current_STEP_ID = dt.Rows[0]["Current_STEP_ID"].ToString(); return(detail); } }
/// <summary> /// 获取工作流实例的的当前处理节点 /// </summary> /// <param name="wfaID"></param> /// <returns></returns> public WF_DETAIL GetWfAppWipDetailByWfaID(string wfaID) { WF_DETAIL detail = null; StringBuilder stb = new StringBuilder(); stb.Append(" WHERE WFA_ID='" + wfaID + "'"); stb.Append("AND (COMPLEMENTDATE='' or COMPLEMENTDATE is null)"); stb.Append("AND IS_Through<>'Y'"); DataTable dt = CommonFuns.getDataTableBySql("*", stb.ToString(), "WF_DETAIL"); if (dt == null || dt.Rows.Count == 0) { return(null); } else { detail = new WF_DETAIL(); DataRow dr = dt.Rows[0]; detail.WFA_ID = dt.Rows[0]["WFA_ID"].ToString(); detail.WFD_ID = dt.Rows[0]["WFD_ID"].ToString(); detail.WFT_STEP_ID = dt.Rows[0]["WFT_STEP_ID"].ToString(); detail.RECIVEDATE = dt.Rows[0]["RECIVEDATE"].ToString(); detail.MSG = dt.Rows[0]["MSG"].ToString(); detail.IS_Through = dt.Rows[0]["IS_Through"].ToString(); detail.Current_STEP_ID = dt.Rows[0]["Current_STEP_ID"].ToString(); return(detail); } }
/// <summary> /// 获取工作流实例的的当前处理节点 /// </summary> /// <param name="wfaID"></param> /// <returns></returns> public WF_DETAIL GetWfAppWipDetailByWfaID(string wfaID) { WF_DETAIL detail = null; StringBuilder stb = new StringBuilder(); stb.Append(" WHERE WFA_ID='" + wfaID + "'"); stb.Append("AND (COMPLEMENTDATE='' or COMPLEMENTDATE is null)"); stb.Append("AND IS_Through<>'Y'"); DataTable dt = CommonFuns.getDataTableBySql("*", stb.ToString(), "WF_DETAIL"); if (dt == null || dt.Rows.Count == 0) { return null; } else { detail = new WF_DETAIL(); DataRow dr = dt.Rows[0]; detail.WFA_ID = dt.Rows[0]["WFA_ID"].ToString(); detail.WFD_ID = dt.Rows[0]["WFD_ID"].ToString(); detail.WFT_STEP_ID = dt.Rows[0]["WFT_STEP_ID"].ToString(); detail.RECIVEDATE = dt.Rows[0]["RECIVEDATE"].ToString(); detail.MSG = dt.Rows[0]["MSG"].ToString(); detail.IS_Through = dt.Rows[0]["IS_Through"].ToString(); detail.Current_STEP_ID = dt.Rows[0]["Current_STEP_ID"].ToString(); return detail; } }
public WF_DETAIL GetWfAppLastDetailByWfaID(string wfaID) { WF_DETAIL detail = null; StringBuilder stb = new StringBuilder(); stb.Append(" WHERE 1=1 AND WFA_ID='" + wfaID + "'"); stb.Append(" AND RECIVEDATE IN (SELECT MAX(RECIVEDATE) FROM WF_DETAIL WHERE WFA_ID='" + wfaID + "') "); DataTable dt = CommonFuns.getDataTableBySql("*", stb.ToString(), "WF_DETAIL"); if (dt == null || dt.Rows.Count == 0) { return null; } else { detail = new WF_DETAIL(); DataRow dr = dt.Rows[0]; detail.WFA_ID = dt.Rows[0]["WFA_ID"].ToString(); detail.WFD_ID = dt.Rows[0]["WFD_ID"].ToString(); detail.WFT_STEP_ID = dt.Rows[0]["WFT_STEP_ID"].ToString(); detail.RECIVEDATE = dt.Rows[0]["RECIVEDATE"].ToString(); detail.MSG = dt.Rows[0]["MSG"].ToString(); detail.IS_Through = dt.Rows[0]["IS_Through"].ToString(); detail.Current_STEP_ID = dt.Rows[0]["Current_STEP_ID"].ToString(); return detail; } }
private void CurrentStepHandle_Load(object sender, EventArgs e) { this.listComments.Text = ""; this.gpFlowDetail.Controls.Clear(); APP = WorkFlow.NewInstance.GetWFappByWFID(this.WfAppID); if (APP.STATUS == DataType.WFDetailSTATUS.UNActivate.ToString()) { MessageBox.Show("当前工作流状态为未激活状态!", "工作流实例建立向导提示您:", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); this.Close(); return; } if (APP.STATUS == DataType.WFDetailSTATUS.Complete.ToString()) { this.btnHandle.Enabled = false; } //显示之前签批人员的签批记录 showOldMsg(); this.txtSubject.Text = APP.SUBJECT; this.txtUserPM.Text = APP.CREATEUSER; try { wipWFAppDetai = WorkFlow.NewInstance.GetWfAppWipDetailByWfaID(WfAppID); if (wipWFAppDetai == null) { wipWFAppDetai = WorkFlow.NewInstance.GetWfAppLastDetailByWfaID(wfAppID); this.btnHandle.Enabled = false; } else { //if(wipWFAppDetai.c // this.txtHandleUser.Text = CommonFuns.NewInstance.LoginInfo.LoginID; //IList<WF_APP_HANDLE> list = WorkFlow.NewInstance.GetWFAppStepHandle(WfAppID, wipWFAppDetai.Current_STEP_ID); WF_APP_HANDLE handItem = WorkFlow.NewInstance.GetWfAppHandleItem(wfAppID, wipWFAppDetai.Current_STEP_ID, loginID); if (handItem != null && (handItem.IS_THROUGH == null || handItem.IS_THROUGH.Trim() == "")) { this.btnHandle.Enabled = true; this.txtHandleUser.Text = handItem.OBJECTVALUE; } else { this.btnHandle.Enabled = false; } } } catch (Exception ex) { MessageBox.Show("获取工作流WIP信息失败" + ex.Message.ToString(), "工作流实例建立向导提示您:", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); this.Close(); return; } if (wipWFAppDetai == null) { MessageBox.Show("获取工作流信息失败", "工作流实例建立向导提示您:", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); this.Close(); return; } if (APP.STATUS == HYPDM.DataType.WFDetailSTATUS.Complete.ToString()) { this.txtStatus.Text = "完成"; } else if (APP.STATUS == DataType.WFDetailSTATUS.Activated.ToString()) { this.txtStatus.Text = "激活"; } else if (APP.STATUS == DataType.WFDetailSTATUS.UNActivate.ToString()) { this.txtStatus.Text = "未激活"; } else if (APP.STATUS == DataType.WFDetailSTATUS.Return.ToString()) { this.txtStatus.Text = "退回拟制"; } // this.txtStatus.Text = APP.STATUS; loadIni(); }
private void CreateWF(IList <HYPDM.Entities.WF_TEMPLATES_STEP> list, System.Windows.Forms.Control ctl, string flowName, string wftid, string wfappid) { int x = 5; int y = 18; WF_DETAIL wipWFAppDetai = WorkFlow.NewInstance.GetWfAppWipDetailByWfaID(wfappid); if (list == null || list.Count == 0) { MessageBox.Show("该工作流【" + flowName + "】不没有设置任何节点", "工作流实例建立向导提示您:", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); return; } else { //IWFTemplatesStepService _wfService = ServiceContainer.GetService<WFTemplatesStepService>(); WorkFlow wf = WorkFlow.NewInstance; Panel pnl = null; //放箭头 foreach (WF_TEMPLATES_STEP step in list) { Button btnStep = new Button(); btnStep.BackgroundImage = global::HYPDM.WinUI.Properties.Resources.banner; btnStep.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; // btnStep.Location = new System.Drawing.Point(5, 18); btnStep.Location = new System.Drawing.Point(x, y); // btnStep.Name = "btnName"; btnStep.Size = new System.Drawing.Size(113, 161); // btnStep.TabIndex = 0; // btnStep.Text = "btnText"; btnStep.UseVisualStyleBackColor = true; btnStep.Tag = step; //节点信息放在button的tag中 btnStep.BackColor = System.Drawing.SystemColors.InactiveBorder; btnStep.Name = step.WFT_STEP_ID; // btnStep.Size = new System.Drawing.Size(200, 50); // btnStep.TabIndex = 0; string strUser = getCurrentStepHandle(wfappid, step.WFT_STEP_ID); if (step.IS_START_STEP == "Y") { btnStep.Text = "(Start)" + wf.GetWFStep(step.WFT_CURRENT_STEP_ID).COMBTEXT + "\n" + "发起人:【" + WorkFlow.NewInstance.GetWFappByWFID(wfappid).CREATEUSER + "】"; } else if (step.IS_END_STEP == "Y") { btnStep.Text = "(END)" + wf.GetWFStep(step.WFT_CURRENT_STEP_ID).COMBTEXT + strUser; } else { btnStep.Text = "当前步骤:" + wf.GetWFStep(step.WFT_CURRENT_STEP_ID).COMBTEXT + strUser; } if (wipWFAppDetai != null && wipWFAppDetai.WFT_STEP_ID == btnStep.Name) { btnStep.BackColor = Color.Red; } btnStep.TextAlign = ContentAlignment.MiddleLeft; pnl = new Panel(); pnl.BackColor = System.Drawing.Color.Transparent; pnl.BackgroundImage = global::HYPDM.WinUI.Properties.Resources.line2; pnl.Location = new System.Drawing.Point(113 + x, (161 / 2 + 18)); pnl.Name = "pnl"; pnl.Size = new System.Drawing.Size(32, 30); pnl.TabIndex = 0; btnStep.UseVisualStyleBackColor = false; ctl.Controls.Add(btnStep); ctl.Controls.Add(pnl); x += 113 + 32; } ctl.Controls.Remove(pnl); } }