You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/CommMng/Models/WorkflowModel.cs

636 lines
17 KiB
C#

using System;
using DSWeb.Areas.SysMng.DAL.SysTask;
using HcUtility.Core;
using Newtonsoft.Json;
namespace DSWeb.Areas.CommMng.Models
{
/*
[JsonObject]
public class WorkFlow_Usingmb : ModelObjectBillBody
{//使用中的工作流状态
private string _BSNO = string.Empty;
private string _WORKFLOWID = string.Empty;
private string _STEPNO = string.Empty;
private string _REJECTOR_ID = string.Empty;
private string _REJECT_TIME = string.Empty;
private string _FINISHED = string.Empty;
private string _ISDELETE = string.Empty;
private string _DELETEUSER = string.Empty;
private string _DELETETIME = string.Empty;
[ModelDB]
public string BSNO
{
get { return _BSNO; }
set { _BSNO = value; }
}
[ModelDB]
public string WORKFLOWID
{
get { return _WORKFLOWID; }
set { _WORKFLOWID = value; }
}
[ModelDB]
public string STEPNO
{
get { return _STEPNO; }
set { _STEPNO = value; }
}
[ModelDB]
public string REJECTOR_ID
{
get { return _REJECTOR_ID; }
set { _REJECTOR_ID = value; }
}
[ModelDB]
public string REJECT_TIME
{
get { return _REJECT_TIME; }
set { _REJECT_TIME = value; }
}
[ModelDB]
public string FINISHED
{
get { return _FINISHED; }
set { _FINISHED = value; }
}
[ModelDB]
public string ISDELETE
{
get { return _ISDELETE; }
set { _ISDELETE = value; }
}
[ModelDB]
public string DELETEUSER
{
get { return _DELETEUSER; }
set { _DELETEUSER = value; }
}
[ModelDB]
public string DELETETIME
{
get { return _DELETETIME; }
set { _DELETETIME = value; }
}
public WorkFlow_Usingmb()
{
TableName = "workflow_using";
}
public override string GetBillNoFieldName()
{
return "WORKFLOWID";
}
}
* */
/*
[JsonObject]
public class WorkFlowmb : ModelObjectBillBody
{//通过名字获取GID
private string _GID = string.Empty;
private string _NAME = string.Empty;
private string _TYPENO = string.Empty;
public string GID
{
get { return _GID; }
set { _GID = value; }
}
public string NAME
{
get { return _NAME; }
set { _NAME = value; }
}
public string TYPENO
{
get { return _TYPENO; }
set { _TYPENO = value; }
}
}
*/
[JsonObject]
public class WorkFlowStepmb : ModelObjectBillBody
{//通过名字获取GID
#region
private string _GID = string.Empty;
private string _NAME = string.Empty;
private string _STEPNO = string.Empty;
private string _NEEDALLPASS = string.Empty;
private string _ISMUST = string.Empty;
private string _ISLAST = string.Empty;
private string _GROUPID = string.Empty;
[ModelDB]
public string GID
{
get { return _GID; }
set { _GID = value; }
}
[ModelDB]
public string NAME
{
get { return _NAME; }
set { _NAME = value; }
}
[ModelDB]
public string STEPNO
{
get { return _STEPNO; }
set { _STEPNO = value; }
}
[ModelDB]
public string GROUPID
{
get { return _GROUPID; }
set { _GROUPID = value; }
}
[ModelDB]
public string NEEDALLPASS
{
get { return _NEEDALLPASS; }
set { _NEEDALLPASS = value; }
}
[ModelDB]
public string ISMUST
{
get { return _ISMUST; }
set { _ISMUST = value; }
}
[ModelDB]
public string ISLAST
{
get { return _ISLAST; }
set { _ISLAST = value; }
}
#endregion
}
[JsonObject]
public class BSNOWorkFlowStatemb : ModelObjectBillBody
{//通过名字获取GID
private string _NAME = string.Empty;
private string _GROUPID = string.Empty;
private string _STEPNO = string.Empty;
private string _AUDITOR = string.Empty;
private string _SHOWNAME = string.Empty;
private string _BILLNO = string.Empty;
public string NAME
{
get { return _NAME; }
set { _NAME = value; }
}
public string GROUPID
{
get { return _GROUPID; }
set { _GROUPID = value; }
}
public string STEPNO
{
get { return _STEPNO; }
set { _STEPNO = value; }
}
public string AUDITOR
{
get { return _AUDITOR; }
set { _AUDITOR = value; }
}
public string SHOWNAME
{
get { return _SHOWNAME; }
set { _SHOWNAME = value; }
}
public string BILLNO
{
get { return _BILLNO; }
set { _BILLNO = value; }
}
}
[JsonObject]//可以操作的步骤号
public class WorkFlowStepNOmb : ModelObjectBillBody
{
private string _STEPNO = string.Empty;
public string STEPNO
{
get { return _STEPNO; }
set { _STEPNO = value; }
}
}
[JsonObject]//向消息表中插入的消息
public class SYSMessagemb : ModelObjectBillHead
{
/*" INSERT INTO sys_message(GID,[NAME],DESCRIPTION,CREATETIME,ISREAD,READCOUNT,MESSAGECONTENT,RECEIVER,[TYPE],TASKURL,TASKID,RECVTYPE) "
" VALUES(@gid,@name,@description,GETDATE(),@is_read,@read_count,@message_content,@receiver,@type,@task_url,@task_id,@recv_type) ";*/
private string _GID = "";
private string _NAME = "";
private string _DESCRIPTION = "";
private string _CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
private string _ISREAD = "0";
private string _READCOUNT = "0";
private string _MESSAGECONTENT = "";
private string _LASTREADTIME = String.Empty;
private string _RECEIVER = "";
private string _TYPE = "";
private string _TASKURL = "";
private string _TASKID = "";
private string _ISDELETE = "0";
private string _DELETEUSER = "";
private string _DELETETIME = String.Empty;
private string _NUMBER = "0";
private string _RECVTYPE = "0";
private string _ISSEND = "0";
[ModelDB(MDBType = ModelDBOprationType.All, IsPrimary = true)]
public string GID
{
get { return _GID; }
set { _GID = value; }
}
[ModelDB]
public string NAME
{
get { return _NAME; }
set { _NAME = value; }
}
[ModelDB]
public string DESCRIPTION
{
get { return _DESCRIPTION; }
set { _DESCRIPTION = value; }
}
[ModelDB]
public string CREATETIME
{
get { return _CREATETIME; }
set {
if (!string.IsNullOrEmpty(value.Trim()))
{
_CREATETIME = value;
}
else
{
_CREATETIME = String.Empty;
}
}
}
[ModelDB]
public string ISREAD
{
get { return _ISREAD; }
set { _ISREAD = value; }
}
[ModelDB]
public string READCOUNT
{
get { return _READCOUNT; }
set { _READCOUNT = value; }
}
[ModelDB]
public string MESSAGECONTENT
{
get { return _MESSAGECONTENT; }
set { _MESSAGECONTENT = value; }
}
[ModelDB]
public string LASTREADTIME
{
get { return _LASTREADTIME; }
//set { _LASTREADTIME = value; }
set
{
if (!string.IsNullOrEmpty(value.Trim()))
{
_LASTREADTIME = value;
}
else
{
_LASTREADTIME = String.Empty;
}
}
}
[ModelDB]
public string RECEIVER
{
get { return _RECEIVER; }
set { _RECEIVER = value; }
}
[ModelDB]
public string TYPE
{
get { return _TYPE; }
set { _TYPE = value; }
}
[ModelDB]
public string TASKURL
{
get { return _TASKURL; }
set { _TASKURL = value; }
}
[ModelDB]
public string TASKID
{
get { return _TASKID; }
set { _TASKID = value; }
}
[ModelDB]
public string ISDELETE
{
get { return _ISDELETE; }
set { _ISDELETE = value; }
}
[ModelDB]
public string DELETEUSER
{
get { return _DELETEUSER; }
set { _DELETEUSER = value; }
}
[ModelDB]
public string DELETETIME
{
get { return _DELETETIME; }
//set { _DELETETIME = value; }
set
{
if (!string.IsNullOrEmpty(value.Trim()))
{
_DELETETIME = value;
}
else
{
_DELETETIME = String.Empty;
}
}
}
//[ModelDB(MDBType = ModelDBOprationType.Edit)]
[ModelDB]
public string NUMBER
{
get { return _NUMBER; }
set { _NUMBER = value; }
}
[ModelDB]
public string RECVTYPE
{
get { return _RECVTYPE; }
set { _RECVTYPE = value; }
}
[ModelDB]
public string ISSEND
{
get { return _ISSEND; }
set { _ISSEND = value; }
}
public SYSMessagemb()
{
TableName = "sys_message";
}
public override string GetBillNoFieldName()
{
return "GID";
}
virtual public string GetTimeMarkFieldName()
{
return "";
}
}
[JsonObject]
public class Auditormb : ModelObjectBillBody
{
private string _AUDITORID = string.Empty;
private string _NAME = string.Empty;
public string GID
{
get { return _AUDITORID; }
set { _AUDITORID = value; }
}
public string NAME
{
get { return _NAME; }
set { _NAME = value; }
}
public Auditormb()
{
TableName = "";
}
override public string GetBillNoFieldName()
{
return "";
}
}
[JsonObject]
public class Resultmb : ModelObjectBillBody
{//{ Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() }
private Boolean _success = true;
private string _message = string.Empty;
private int _count = 0;
private Boolean _islast = false;
public Boolean Success
{
get { return _success; }
set { _success = value; }
}
public string Message
{
get { return _message; }
set { _message = value; }
}
public int totalCount
{
get { return _count; }
set { _count = value; }
}
public Boolean islast
{
get { return _islast; }
set { _islast = value; }
}
}
[JsonObject]
public class CanChangemb : Object
{//{ Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() }
private Boolean _changeusing = false;
private Boolean _changeStep = false;
public Boolean ChangeUsing
{
get { return _changeusing; }
set { _changeusing = value; }
}
public Boolean ChangeStep
{
get { return _changeStep; }
set { _changeStep = value; }
}
}
/// <summary>
/// _TABLENAME 表名
/// _WORKFLOWNAME 工作流名字(workflow_type.NAME)
/// _USERID
/// _BSNOFIELDNAME 通常是数据对象的 .GetBillNoFieldName
/// _BSNO 通常是数据对象的 .GetBillNoValue
/// _STATEFIELDNAME 存放业务当中的状态值的列的列名
/// </summary>
public class AuditInfomb
{
#region private Fields
private string _TABLENAME = string.Empty;
private string _WORKFLOWNAME = string.Empty;
private string _USERID = string.Empty;
private string _BSNOFIELDNAME = string.Empty;
private string _BSNO = string.Empty;
private string _STATEFIELDNAME = string.Empty;
private string _FROMSTATE = string.Empty;
private string _TOSTATE = string.Empty;
private string _LASTSTATE = string.Empty;
private string _EXECUTION = string.Empty;
#endregion
#region R&W
public string TABLENAME
{
get { return _TABLENAME; }
set { _TABLENAME = value; }
}
public string WORKFLOWNAME
{
get { return _WORKFLOWNAME; }
set { _WORKFLOWNAME = value; }
}
public string USERID
{
get { return _USERID; }
set { _USERID = value; }
}
public string BSNOFIELDNAME
{
get { return _BSNOFIELDNAME; }
set { _BSNOFIELDNAME = value; }
}
public string BSNO
{
get { return _BSNO; }
set { _BSNO = value; }
}
public string FROMSTATE
{
get { return _FROMSTATE; }
set { _FROMSTATE = value; }
}
public string STATEFIELDNAME
{
get { return _STATEFIELDNAME; }
set { _STATEFIELDNAME = value; }
}
public string TOSTATE
{
get { return _TOSTATE; }
set { _TOSTATE = value; }
}
public string LASTSTATE
{
get { return _LASTSTATE; }
set { _LASTSTATE = value; }
}
public string EXECUTION
{
get { return _EXECUTION; }
set { _EXECUTION = value; }
}
public string BSNOListStr {
get {
var BSNOStr = "";
try
{
var BSNOArray = BSNO.Replace("'", "").Split(',');
foreach (var bsno in BSNOArray)
{
if (BSNOStr != "") BSNOStr += ",";
BSNOStr += "'" + bsno + "'";
}
}
catch { return BSNOStr; }
return BSNOStr;
}
}
public string[] BSNOArray {
get {
var BSNOArray = BSNO.Replace("'", "").Split(',');
return BSNOArray;
}
}
#endregion
public AuditInfomb(string USERID)
{
this.USERID = USERID;
}
public AuditInfomb(ModelObjectBill BILL, string WORKFLOWNAME, string TOSTATE, string USERID, string LASTSTATE = "0")
{
TABLENAME = BILL.TableName;
this.WORKFLOWNAME = WORKFLOWNAME;
this.USERID = USERID;
BSNOFIELDNAME = BILL.GetBillNoFieldName();
BSNO = BILL.GetBillNoValue().ToString();
STATEFIELDNAME = BILL.GetStateFieldName();
FROMSTATE = BILL.GetStateValue().ToString();
this.TOSTATE = TOSTATE;
this.LASTSTATE = LASTSTATE;
}
public static AuditInfomb getExecutionAudit (ModelObjectBill BILL, string WORKFLOWNAME, string EXECUTION, string USERID, string LASTSTATE = "0")
{
var result = new AuditInfomb(USERID);
result.TABLENAME = BILL.TableName;
result.WORKFLOWNAME = WORKFLOWNAME;
//result.USERID = USERID;
result.EXECUTION = EXECUTION;
result.BSNOFIELDNAME = BILL.GetBillNoFieldName();
result.BSNO = BILL.GetBillNoValue().ToString();
result.STATEFIELDNAME = BILL.GetStateFieldName();
result.FROMSTATE = BILL.GetStateValue().ToString();
result.TOSTATE = SysTaskDAL.DoExecution(result.FROMSTATE, EXECUTION).STATEKEY;
if (LASTSTATE == "0")
{
result.LASTSTATE = result.TOSTATE;
}
return result;
}
public bool cando() {
if (TOSTATE == "0000") return false;
return true;
}
}
}