794 lines
44 KiB
C#
794 lines
44 KiB
C#
using Lskj.Core;
|
|
using Lskj.Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.Common;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
|
|
namespace Lskj.Business.Impl
|
|
{
|
|
public class WorkFlowBaseImpl : BaseImpl
|
|
{
|
|
/// <summary>
|
|
/// <para>说明:获取基础流转步骤</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2019-06-28 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>DataTable.</returns>
|
|
public static DataTable GetBaseFlowData(string menuCode)
|
|
{
|
|
string sqlValue = string.Format("select * from p_systemdlltabflow where typeCode='{0}' ORDER BY stepCode ", menuCode);
|
|
return GetDataTableResult(sqlValue);
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取角色</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2019-11-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>DataTable.</returns>
|
|
public static DataTable GetWorkFlowRole(string mf)
|
|
{
|
|
string where = string.Empty;
|
|
if (!string.IsNullOrEmpty(mf))
|
|
where = string.Format("where roleName like '%{0}%' or dbo.P_getpy(roleName) like '%{0}%'", mf);
|
|
string sqlValue = "select * from p_systemRoleSetTab " + where;
|
|
return GetDataTableResult(sqlValue);
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取小类设置操作员</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-24 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>DataTable.</returns>
|
|
public static DataTable GetWorkFlowUsers(string depid, string mf)
|
|
{
|
|
string where = string.Empty;
|
|
if (!string.IsNullOrEmpty(depid))
|
|
where = " and departmentid=" + depid;
|
|
if (!string.IsNullOrEmpty(mf))
|
|
where = string.Format(" and (loginaccount like '%{0}%' or employeename like '%{0}%' or dbo.P_getpy(employeename) like '%{0}%')", mf);
|
|
|
|
string sqlValue = "select loginaccount,employeename,departmentid from p_employeeTab where sign=0 and UseFlag=1 " + where;
|
|
return GetDataTableResult(sqlValue);
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取部门数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-24 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>DataTable.</returns>
|
|
public static DataTable GetDeps()
|
|
{
|
|
string sqlValue = string.Format(@"select '' departmentid,'' departmentname
|
|
union
|
|
select CAST(departmentid as varchar),departmentname from P_DepartmentTab");
|
|
return GetDataTableResult(sqlValue);
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取小类设置数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-24 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>DataTable.</returns>
|
|
public static DataTable GetBaseFlowType(string typeCode)
|
|
{
|
|
string sqlValue = string.Format("select * from P_Systemdlltabflowtype where typeCode='{0}'", typeCode);
|
|
return GetDataTableResult(sqlValue);
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取单表设置操作权限表</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2019-10-17 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>DataTable.</returns>
|
|
public static DataTable GetPowerTable()
|
|
{
|
|
string sqlValue = string.Format("select BillFlowPurview,DllFlowPurview from p_systemtab");
|
|
|
|
return GetDataTableResult(sqlValue);
|
|
}
|
|
/// <summary>
|
|
/// <summary>
|
|
/// <para>说明:获取单据基础审批流转</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-24 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>DataTable.</returns>
|
|
public static DataTable GetBaseFlowTypeStep(string typeCode, string billtype)
|
|
{
|
|
string sqlValue = string.Format("select * from P_Systemdlltabflowtypestep where typecode='{0}' and billtype='{1}' order by stepCode asc", typeCode, billtype);
|
|
|
|
return GetDataTableResult(sqlValue);
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取小类billtype</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-26 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>System.String.</returns>
|
|
public static string GetBaseFlowBaseType()
|
|
{
|
|
string sqlValue = "select ISNULL( right('0000' + CAST( MAX(cast(billType as int))+1 as varchar(5)),4),'0001') aaa from P_Systemdlltabflowtype";
|
|
return GetResult(sqlValue) + "";
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:新增流转步骤</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-24 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>System.Int32.</returns>
|
|
public static bool SaveBaseFlow(BaseflowModel model)
|
|
{
|
|
string sqlValue = string.Format(@"INSERT INTO P_systemdlltabflow(typeCode,stepCode,stepName,stepAction,backAction,stepGroup,stepSql,billModifyFields,detailModifyFields,beforeEvent,
|
|
afterEvent,stepApplyText,stepBackText,stepApplyContent,stepBackContent,pStepCode,stepCloseText,stepCloseContent,stepCloseTip)
|
|
VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}');
|
|
SELECT @@IDENTITY", model.typeCode, model.stepCode, model.stepName, model.stepAction, model.backAction, model.stepGroup, model.stepSql, model.billModifyFields, model.detailModifyFields, model.beforeEvent,
|
|
model.afterEvent, model.stepApplyText, model.stepBackText, model.stepApplyContent, model.stepBackContent, model.pStepCode, model.stepCloseText, model.stepCloseContent, model.stepCloseTip);
|
|
model.id = Convert.ToInt32(GetResult(sqlValue));
|
|
|
|
// 生成流转步骤sql语句
|
|
string stepSql = string.Format("exec p_systemCreateFlowSQL '{0}',{1},'{2}',''", model.typeCode, model.stepCode, ERPInfo.Instance.UserId);
|
|
ExecSqlValue(stepSql);
|
|
|
|
return model.id > 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:新增流转步骤,带事务</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-24 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>System.Int32.</returns>
|
|
public static bool SaveBaseFlow(BaseflowModel model, DbTransaction Trans)
|
|
{
|
|
string sqlValue = string.Format(@"INSERT INTO P_systemdlltabflow(typeCode,stepCode,stepName,stepAction,backAction,stepGroup,stepSql,billModifyFields,detailModifyFields,beforeEvent,
|
|
afterEvent,stepApplyText,stepBackText,stepApplyContent,stepBackContent,pStepCode,stepCloseText,stepCloseContent,stepCloseTip)
|
|
VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}');
|
|
SELECT @@IDENTITY", model.typeCode, model.stepCode, model.stepName, model.stepAction, model.backAction, model.stepGroup, model.stepSql, model.billModifyFields, model.detailModifyFields, model.beforeEvent,
|
|
model.afterEvent, model.stepApplyText, model.stepBackText, model.stepApplyContent, model.stepBackContent, model.pStepCode, model.stepCloseText, model.stepCloseContent, model.stepCloseTip);
|
|
model.id = Convert.ToInt32(GetResult(sqlValue, Trans));
|
|
|
|
// 生成流转步骤sql语句
|
|
string stepSql = string.Format("exec p_systemCreateFlowSQL '{0}',{1},'{2}',''", model.typeCode, model.stepCode, ERPInfo.Instance.UserId);
|
|
ExecSqlValue(stepSql, Trans);
|
|
|
|
return model.id > 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:修改流转步骤</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-25 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="model">The model.</param>
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
|
public static bool UpdateBaseFlow(BaseflowModel model)
|
|
{
|
|
string sqlValue = string.Format(@"update P_systemdlltabflow set stepName='{0}',stepAction='{1}',backAction='{2}',stepGroup='{3}',billModifyFields='{4}',detailModifyFields='{5}',
|
|
beforeEvent='{6}',afterEvent='{7}',stepApplyText='{8}',stepBackText='{9}',stepApplyContent='{10}',stepBackContent='{11}',pStepCode='{12}',
|
|
stepCloseText='{17}',stepCloseContent='{13}',stepCloseTip='{14}' where id='{16}'", model.stepName.Replace("'", "''"), model.stepAction.Replace("'", "''"), model.backAction.Replace("'", "''"), model.stepGroup.Replace("'", "''"), model.billModifyFields.Replace("'", "''"),
|
|
model.detailModifyFields.Replace("'", "''"), model.beforeEvent.Replace("'", "''"), model.afterEvent.Replace("'", "''"), model.stepApplyText.Replace("'", "''"), model.stepBackText.Replace("'", "''"),
|
|
model.stepApplyContent.Replace("'", "''"), model.stepBackContent.Replace("'", "''"), model.pStepCode.Replace("'", "''"), model.stepCloseContent.Replace("'", "''"), model.stepCloseTip.Replace("'", "''")
|
|
, "", model.id, model.stepCloseText.Replace("'", "''"));
|
|
// 生成流转步骤sql语句
|
|
string stepSql = string.Format("exec p_systemCreateFlowSQL '{0}',{1},'{2}',''", model.typeCode, model.stepCode, ERPInfo.Instance.UserId);
|
|
ExecSqlValue(stepSql);
|
|
return ExecSqlValue(sqlValue) > 0;
|
|
|
|
}
|
|
|
|
public static bool newUpdateBaseFlow(BaseflowModel model)
|
|
{
|
|
string sqlValue = string.Format(@"update P_systemdlltabflow set stepName='{0}',stepAction='{1}',backAction='{2}',stepGroup='{3}',billModifyFields='{4}',detailModifyFields='{5}',
|
|
beforeEvent='{6}',afterEvent='{7}',stepApplyText='{8}',stepBackText='{9}',stepApplyContent='{10}',stepBackContent='{11}',pStepCode='{12}',
|
|
stepCloseText='{17}',stepCloseContent='{13}',stepCloseTip='{14}' , requiredFields='{18}' where id='{16}'", model.stepName.Replace("'", "''"), model.stepAction.Replace("'", "''"), model.backAction.Replace("'", "''"), model.stepGroup.Replace("'", "''"), model.billModifyFields.Replace("'", "''"),
|
|
model.detailModifyFields.Replace("'", "''"), model.beforeEvent.Replace("'", "''"), model.afterEvent.Replace("'", "''"), model.stepApplyText.Replace("'", "''"), model.stepBackText.Replace("'", "''"),
|
|
model.stepApplyContent.Replace("'", "''"), model.stepBackContent.Replace("'", "''"), model.pStepCode.Replace("'", "''"), model.stepCloseContent.Replace("'", "''"), model.stepCloseTip.Replace("'", "''")
|
|
, "", model.id, model.stepCloseText.Replace("'", "''"), model.requiredFields.Replace("'", "''"));
|
|
// 生成流转步骤sql语句
|
|
string stepSql = string.Format("exec p_systemCreateFlowSQL '{0}',{1},'{2}',''", model.typeCode, model.stepCode, ERPInfo.Instance.UserId);
|
|
ExecSqlValue(stepSql);
|
|
return ExecSqlValue(sqlValue) > 0;
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:流转步骤删除</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-26 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="model">The model.</param>
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
|
public static bool DeleteBaseFlow(BaseflowModel model)
|
|
{
|
|
// 1. 删除流转步骤;2. 删除流转步骤表格数据;3.删除表格颜色;删除小类流转步骤
|
|
|
|
string sqlValue = string.Format(@"delete p_systemdlltabflowtypestep where typecode='{0}' and stepcode='{1}';
|
|
delete p_systemdlltabflowstepgrid where typecode='{0}' and stepcode='{1}';
|
|
delete p_systemwordbookcolor where tab='FLOWSTEP_{0}_{1}_{2}';
|
|
delete p_systemdlltabflow where id='{2}'", model.typeCode, model.stepCode, model.id);
|
|
|
|
return ExecSqlValue(sqlValue) > 0;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:保存小类</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-26 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="model">The model.</param>
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
|
public static bool SaveBaseFlowType(BaseflowTypeModel model)
|
|
{
|
|
string sqlValue = string.Format(@"INSERT INTO p_systemdlltabflowtype(typeCode,billtype,billtypename,operuser,typekey)
|
|
VALUES('{0}','{1}','{2}','{3}','{4}');
|
|
SELECT @@IDENTITY", model.typeCode, model.billType, model.billTypeName, model.operUser, model.typekey);
|
|
model.id = Convert.ToInt32(GetResult(sqlValue));
|
|
return model.id > 0;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:更新小类</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-26 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="model">The model.</param>
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
|
public static bool UpdateBaseFlowType(BaseflowTypeModel model)
|
|
{
|
|
string sqlValue = string.Format(@"update p_systemdlltabflowtype set billtypename='{0}',operuser='{1}',billflowban='{3}' where id='{2}'",
|
|
model.billTypeName.Replace("'", "''"), model.operUser.Replace("'", "''"), model.id, model.billflowban);
|
|
|
|
return ExecSqlValue(sqlValue) > 0;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:删除小类</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-26 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="model">The model.</param>
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
|
public static bool DeleteBaseFlowType(BaseflowTypeModel model)
|
|
{
|
|
// 1. 删除流转步骤;2. 删除流转步骤表格数据;3.删除表格颜色;删除小类流转步骤
|
|
|
|
string sqlValue = string.Format(@"delete p_systemdlltabflowtype where id='{0}';
|
|
delete p_systemdlltabflowtypestep where billtype='{0}' and typecode='{1}';", model.id, model.typeCode);
|
|
|
|
return ExecSqlValue(sqlValue) > 0;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:生成小类流转步骤</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-26 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="model">The model.</param>
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
|
public static bool SaveBaseFlowTypeStep(string typeCode, string billtype)
|
|
{
|
|
string sqlValue = string.Format(@"insert into p_systemdlltabflowtypestep(typeCode,billType,stepCode,stepName,stepGroup,stepBackCode,typekey,pStepCode,SameAudited,stepClosed,remindSelect)
|
|
select a.typeCode,b.id,stepCode,stepName,stepGroup,cast(stepCode as int)-100,b.typekey,0,0,0,0 from p_systemdlltabflow a
|
|
inner join p_systemdlltabflowtype b on a.typeCode=b.typeCode
|
|
where a.typeCode='{0}' and b.id='{1}' and stepCode not in (select stepCode from p_systemdllflowtypestep where typeCode='{0}' and billType='{1}')", typeCode, billtype);
|
|
|
|
return ExecSqlValue(sqlValue) > 0;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:修改小类流转步骤</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-26 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="model">The model.</param>
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
|
public static bool UpdateBaseFlowTypeStep(BaseflowTypeStepModel model)
|
|
{
|
|
string sqlValue = string.Format(@"update p_systemdlltabflowtypestep set stepTime={0},autoStep='{1}',viewUser='{2}',operUser='{3}',stepBackCode='{4}',
|
|
pStepCode='{7}',SameAudited='{8}',stepClosed='{9}',comfirmOper='{10}',
|
|
remindOper='{11}',remindSelect='{12}',signOper='{13}',flowcharTagId='{14}',flowcharWidth='{15}',flowcharHeght='{16}', FlowCharfillcolor='{17}', LeftFlowCharfillcolor='{18}', LeftFlowCharWidth='{19}', fontSize='{20}', fontWeight='{21}',fontFamily='{22}',flowcharLineHeght='{23}',LeftFontColor='{24}',fontColor='{25}',affirmbak='{26}' where id='{27}'",
|
|
string.IsNullOrEmpty(model.stepTime) ? "NULL" : model.stepTime.Replace("'", "''"), model.autoStep.Replace("'", "''"), model.viewUser.Replace("'", "''"), model.operUser.Replace("'", "''"), model.stepBackCode.Replace("'", "''"), model.StepOverCond.Replace("'", "''"), model.autoStepCond.Replace("'", "''"), model.pStepCode.Replace("'", "''"),
|
|
model.SameAudited.Replace("'", "''"), model.stepClosed.Replace("'", "''"), model.comfirmOper.Replace("'", "''"), model.remindOper.Replace("'", "''"), model.remindSelect.Replace("'", "''"), model.signOper.Replace("'", "''"), model.flowcharTagId.Replace("'", "''"), model.flowcharWidth.Replace("'", "''"), model.flowcharHeght.Replace("'", "''"), model.FlowCharfillcolor.Replace("'", "''"), model.LeftFlowCharfillcolor.Replace("'", "''"), model.LeftFlowCharWidth.Replace("'", "''"), model.fontSize.Replace("'", "''"), model.fontWeight.Replace("'", "''"), model.fontFamily.Replace("'", "''"), model.flowcharLineHeght.Replace("'", "''"), model.LeftFontColor.Replace("'", "''"), model.fontColor.Replace("'", "''"), model.affirmbak.Replace("'", "''"), model.id);
|
|
|
|
return ExecSqlValue(sqlValue) > 0;
|
|
}
|
|
|
|
public static bool newUpdateBaseFlowTypeStep(BaseflowTypeStepModel model)
|
|
{
|
|
string sqlValue = string.Format(@"update p_systemdlltabflowtypestep set stepTime={0},autoStep='{1}',viewUser='{2}',operUser='{3}',stepBackCode='{4}',autoStepCond='{6}',
|
|
pStepCode='{7}',SameAudited='{8}',stepClosed='{9}',comfirmOper='{10}',
|
|
remindOper='{11}',remindSelect='{12}',signOper='{13}',flowcharTagId='{14}',flowcharWidth='{15}',flowcharHeght='{16}', FlowCharfillcolor='{17}', LeftFlowCharfillcolor='{18}', LeftFlowCharWidth='{19}', fontSize='{20}', fontWeight='{21}',fontFamily='{22}',flowcharLineHeght='{23}',LeftFontColor='{24}',fontColor='{25}',affirmbak='{26}' where id='{27}'",
|
|
string.IsNullOrEmpty(model.stepTime) ? "NULL" : model.stepTime.Replace("'", "''"), model.autoStep.Replace("'", "''"), model.viewUser.Replace("'", "''"), model.operUser.Replace("'", "''"), model.stepBackCode.Replace("'", "''"), model.StepOverCond.Replace("'", "''"), model.autoStepCond.Replace("'", "''"), model.pStepCode.Replace("'", "''"),
|
|
model.SameAudited.Replace("'", "''"), model.stepClosed.Replace("'", "''"), model.comfirmOper.Replace("'", "''"), model.remindOper.Replace("'", "''"), model.remindSelect.Replace("'", "''"), model.signOper.Replace("'", "''"), model.flowcharTagId.Replace("'", "''"), model.flowcharWidth.Replace("'", "''"), model.flowcharHeght.Replace("'", "''"), model.FlowCharfillcolor.Replace("'", "''"), model.LeftFlowCharfillcolor.Replace("'", "''"), model.LeftFlowCharWidth.Replace("'", "''"), model.fontSize.Replace("'", "''"), model.fontWeight.Replace("'", "''"), model.fontFamily.Replace("'", "''"), model.flowcharLineHeght.Replace("'", "''"), model.LeftFontColor.Replace("'", "''"), model.fontColor.Replace("'", "''"), model.affirmbak.Replace("'", "''"), model.id);
|
|
|
|
return ExecSqlValue(sqlValue) > 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:循环修改流程图步骤</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-10-12 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="model">The model.</param>
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
|
public static bool UpdateAllBaseFlow(BaseflowTypeStepModel model)
|
|
{
|
|
string sqlValue = string.Format(@"update p_systemdlltabflowtypestep set flowcharTagId='{0}',flowcharWidth='{1}',flowcharHeght='{2}', FlowCharfillcolor='{3}', LeftFlowCharfillcolor='{4}', LeftFlowCharWidth='{5}', fontSize='{6}', fontWeight='{7}',fontFamily='{8}',flowcharLineHeght='{9}',LeftFontColor='{10}',fontColor='{11}',affirmbak='{12}' where id='{13}'",
|
|
model.flowcharTagId, model.flowcharWidth, model.flowcharHeght, model.FlowCharfillcolor, model.LeftFlowCharfillcolor, model.LeftFlowCharWidth, model.fontSize, model.fontWeight, model.fontFamily, model.flowcharLineHeght, model.LeftFontColor, model.fontColor, model.affirmbak, model.id);
|
|
return ExecSqlValue(sqlValue) > 0;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:重置权限</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-28 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
|
public static string ResetPurview(string menuCode, int billtype)
|
|
{
|
|
string sqlValue = string.Format(@"declare @p6 varchar(2000)
|
|
set @p6='1'
|
|
exec p_system_init_purview 1,'{0}',{1},{2},'{3}',@p6 output
|
|
select @p6", menuCode, billtype, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName);
|
|
return GetResult(sqlValue) + "";
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化权限</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-28 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>System.String.</returns>
|
|
public static string InitPurview(string menuCode)
|
|
{
|
|
string sqlValue = string.Format(@"declare @p6 varchar(2000)
|
|
set @p6='1'
|
|
exec p_system_init_purview 1,'{0}',{1},{2},'{3}',@p6 output
|
|
select @p6", menuCode, 0, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName);
|
|
return GetResult(sqlValue) + "";
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:获得终审回退信息</para>
|
|
/// <para>创建人:曹屹峰</para>
|
|
/// <para>创建日期:2022-06-7 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>System.String.</returns>
|
|
public static DataTable getFinalBack(string mMenuCode)
|
|
{
|
|
string sqlValue = string.Format("select OverBackSql,OverBackOper,OverBackKey from P_systemdlltab where DllCoid='{0}'", mMenuCode);
|
|
return GetDataTableResult(sqlValue);
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:保存终审回退信息</para>
|
|
/// <para>创建人:曹屹峰</para>
|
|
/// <para>创建日期:2022-06-7 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>System.String.</returns>
|
|
public static bool UpdateFinalReturnSettings(string sql, string name, string mMenuCode)
|
|
{
|
|
string sqlValue = string.Format("update P_systemdlltab set OverBackSql='{0}' , OverBackOper='{1}' where DllCoid='{2}'", sql.Replace("'", "''"), name, mMenuCode);
|
|
|
|
return ExecSqlValue(sqlValue) > 0;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <para>说明:获取终审条件信息</para>
|
|
/// <para>创建人:曹屹峰</para>
|
|
/// <para>创建日期:2022-06-7 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>System.String.</returns>
|
|
public static DataTable getFallbackCondition(string key)
|
|
{
|
|
string sql = string.Format(@"select id,sourceId,controlName,controlLabel,controlType,defaultValue,sourceSql,keyField,resultField,controlLeft,controlTop,controlHeight,controlWidth,checkCond,formKey,orderId,isnull(ShowMobile,0) ShowMobile,isFix,Column_ID,BSRowId,BSColPercent,TitleColor,InputHintText,edited
|
|
from p_systembillsourcecond
|
|
where formKey = '{0}'", key);
|
|
return GetDataTableResult(sql);
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:保存终审条件信息</para>
|
|
/// <para>创建人:曹屹峰</para>
|
|
/// <para>创建日期:2022-06-7 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>System.String.</returns>
|
|
public static bool SaveFinalConditions(DataRow dr, string key)
|
|
{
|
|
string sqlValue = string.Empty;
|
|
string id = dr["id"] + "";
|
|
if (string.IsNullOrWhiteSpace(id))
|
|
{
|
|
//新增
|
|
sqlValue = string.Format(@"INSERT INTO p_systembillsourcecond (sourceId,controlName,controlLabel,controlType,defaultValue,sourceSql,keyField,resultField,controlLeft,
|
|
controlTop,controlHeight,controlWidth,checkCond,ShowMobile,formKey) VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}')",
|
|
0, (dr["controlName"] + "").Replace("'", "''"), (dr["controlLabel"] + "").Replace("'", "''"), (dr["controlType"] + "").Replace("'", "''"), (dr["defaultValue"] + "").Replace("'", "''"), (dr["sourceSql"] + "").Replace("'", "''"), (dr["keyField"] + "").Replace("'", "''"), (dr["resultField"] + "").Replace("'", "''"),
|
|
(dr["controlLeft"] + "").Replace("'", "''"), (dr["controlTop"] + "").Replace("'", "''"), (dr["controlHeight"] + "").Replace("'", "''"), (dr["controlWidth"] + "").Replace("'", "''"), (dr["checkCond"] + "").Replace("'", "''"), (dr["ShowMobile"] + "").Replace("'", "''"), key);
|
|
}
|
|
else
|
|
{
|
|
//修改
|
|
sqlValue = string.Format(@"UPDATE p_systembillsourcecond set controlName='{0}',controlLabel='{1}',controlType='{2}',defaultValue='{3}',sourceSql='{4}',keyField='{5}',resultField='{6}',
|
|
controlLeft='{7}',controlTop='{8}',controlHeight='{9}',controlWidth='{10}',checkCond='{11}',ShowMobile='{12}' where id='{13}' ;",
|
|
(dr["controlName"] + "").Replace("'", "''"), (dr["controlLabel"] + "").Replace("'", "''"), (dr["controlType"] + "").Replace("'", "''"), (dr["defaultValue"] + "").Replace("'", "''"), (dr["sourceSql"] + "").Replace("'", "''"), (dr["keyField"] + "").Replace("'", "''"), (dr["resultField"] + "").Replace("'", "''"),
|
|
(dr["controlLeft"] + "").Replace("'", "''"), (dr["controlTop"] + "").Replace("'", "''"), (dr["controlHeight"] + "").Replace("'", "''"), (dr["controlWidth"] + "").Replace("'", "''"), (dr["checkCond"] + "").Replace("'", "''"), (dr["ShowMobile"] + "").Replace("'", "''"), (dr["id"] + "").Replace("'", "''")
|
|
);
|
|
}
|
|
|
|
return ExecSqlValue(sqlValue) > 0;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <para>说明:保存终审条件信息</para>
|
|
/// <para>创建人:曹屹峰</para>
|
|
/// <para>创建日期:2022-06-7 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>System.String.</returns>
|
|
public static bool deleteFinalConditions(string id, string key)
|
|
{
|
|
string sqlValue = string.Empty;
|
|
sqlValue = string.Format("delete from p_systemControlLocation where formkey='{0}' and fieldid='{1}'", key, id);
|
|
sqlValue += string.Format("delete from p_systembillsourcecond where id='{0}'", id);
|
|
return ExecSqlValue(sqlValue) > 0;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 创建 生成终审sql 的存储过程
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static bool CreateSQL()
|
|
{
|
|
//有存储过程就不创建
|
|
string sql = "SELECT 1 FROM sys.procedures WHERE name = 'p_systemCreateendFlowSQL'";
|
|
string value=GetResult(sql) + "";
|
|
if (value.Equals("1")) return true;
|
|
string sqlValue = @"CREATE PROCEDURE dbo.p_systemCreateendFlowSQL
|
|
@typecode varchar(20),
|
|
@stepcode int,
|
|
@operatorid int,
|
|
@msg varchar(2000) output
|
|
AS
|
|
BEGIN
|
|
declare @modtype int,
|
|
@mastertable varchar(50),
|
|
@fieldsql varchar(max)='',
|
|
@tmpsql varchar(max)='',
|
|
@fieldname varchar(50),
|
|
@username varchar(100),
|
|
@fieldtypeid int,
|
|
@lookupkey varchar(50),
|
|
@lookupresult varchar(50),
|
|
@lookupsql varchar(max),
|
|
@rtagid int=0,
|
|
@jointable varchar(max)='',
|
|
@column_prefix varchar(20),
|
|
@shNewMode int=0,
|
|
@bxshFlag int=0,
|
|
@flowTable varchar(50),
|
|
@flowStepTable varchar(50),
|
|
@tmpkeyfield varchar(50),
|
|
@flowStepGridTable varchar(50),
|
|
@orderid int
|
|
print 'start'
|
|
set @msg=''
|
|
begin tran
|
|
begin try
|
|
select @modtype=modType,@mastertable=TableName from v_systemdlltab where DllCoid=@typecode
|
|
if @modtype is null
|
|
begin
|
|
set @msg='模块['+@typecode+']未找到'
|
|
goto on_error
|
|
end
|
|
print '1'
|
|
set @column_prefix=dbo.p_getColumnPrefix(@mastertable)
|
|
if @modtype=2
|
|
begin
|
|
set @tmpkeyfield=@column_prefix+'billdocument_id'
|
|
set @flowTable='wms_billflowoper'
|
|
set @flowStepTable='p_systembillflowtypestep'
|
|
set @flowStepGridTable='p_systembillstepgrid'
|
|
|
|
if object_id('wms_billflowoper') is not null
|
|
set @shNewMode=1
|
|
if exists(select 1 from sys.columns
|
|
where object_id=object_id('p_systembillflowtypestep')
|
|
and lower(name)='pstepcode')
|
|
and exists(select 1 from sys.columns
|
|
where object_id=object_id(@mastertable) and lower(name)=LOWER(@column_prefix+'pstepcode'))
|
|
set @bxshFlag=1
|
|
|
|
end
|
|
print '2'
|
|
if @modtype=1
|
|
begin
|
|
select top 1 @tmpkeyfield=fieldname
|
|
from p_systemwordbooktab
|
|
where tab=@typecode
|
|
order by orderid
|
|
set @flowTable='p_baseflowoper'
|
|
set @flowStepTable='p_systemdlltabflowtypestep'
|
|
set @flowStepGridTable='p_systemdlltabflowstepgrid'
|
|
|
|
|
|
if object_id('p_baseflowoper') is not null
|
|
set @shNewMode=1
|
|
if exists(select 1 from sys.columns
|
|
where object_id=object_id('p_systemdlltabflowtypestep')
|
|
and lower(name)='pstepcode')
|
|
and exists(select 1 from sys.columns
|
|
where object_id=object_id(@mastertable) and lower(name)=LOWER(@column_prefix+'pstepcode'))
|
|
set @bxshFlag=1
|
|
|
|
end
|
|
print '3'
|
|
print 'bxshFlag='+cast(@bxshFlag as varchar)+' shNewMode='+cast(@shNewMode as varchar)
|
|
if @modtype=2
|
|
set @tmpsql='declare tmpCur cursor for
|
|
select top 1000 fieldName,
|
|
case when isnull(userName,'''')='''' and isnull(sysname,'''')='''' then fieldName
|
|
when isnull(userName,'''')='''' then sysName
|
|
else userName end as userName,fieldTypeId,
|
|
lookupKeyField,lookupResult,lookupSql
|
|
from p_systembillinfo a
|
|
inner join sys.columns b on object_id(''' + @mastertable + ''')=b.object_id and lower(a.fieldname)=lower(b.name)
|
|
where typecode='+QUOTENAME( @typecode,'''')+
|
|
' and (isnull(isvisible,0)=0 or lower(fieldName) in ('+QUOTENAME(+lower(@column_prefix)+'stepcode','''')+','+QUOTENAME(LOWER(@column_prefix)+'rtagid','''')+','+QUOTENAME(LOWER(@column_prefix)+'billdocument_id','''')+')) order by orderid'
|
|
if @modtype=1
|
|
set @tmpsql='declare tmpCur cursor for
|
|
select top 1000 fieldName,
|
|
case when isnull(userName1,'''')='''' and isnull(sysname,'''')='''' then fieldName
|
|
when isnull(userName1,'''')='''' then sysName
|
|
else userName1 end as userName,fieldsqlTag as fieldTypeId,
|
|
fieldsqlid as lookupKeyField,fieldsqlname as lookupResult,fieldsql as lookupSql
|
|
from p_systemwordbooktab a
|
|
inner join sys.columns b on object_id('+QUOTENAME(@mastertable,'''')+')=b.object_id and lower(a.fieldname)=lower(b.name)
|
|
where tab='+QUOTENAME( @typecode,'''')+
|
|
' and (isnull(vislble,0)=0 or lower(fieldName) in ('+QUOTENAME(+lower(@column_prefix)+'stepcode','''')+','+QUOTENAME(LOWER(@column_prefix)+'rtagid','''')+','+QUOTENAME(@tmpkeyfield,'''')+'))
|
|
order by orderid'
|
|
print '@tmpsql22222222='+isnull(@tmpsql,'')
|
|
exec(@tmpsql)
|
|
print '4'
|
|
open tmpCur
|
|
fetch next from tmpCur into @fieldname ,
|
|
@username ,
|
|
@fieldtypeid ,
|
|
@lookupkey ,
|
|
@lookupresult ,
|
|
@lookupsql
|
|
set @tmpsql=''
|
|
--生成步骤语句
|
|
print '5'
|
|
set @orderid=1
|
|
while @@FETCH_STATUS=0
|
|
begin
|
|
if LOWER(@fieldname)<>lower(@column_prefix+'stepcode')
|
|
begin
|
|
if LOWER(@fieldname)=lower(@column_prefix+'rtagid')
|
|
set @rtagid=1
|
|
if @tmpsql=''
|
|
set @tmpsql=@tmpsql+'a.'+@fieldname
|
|
else
|
|
set @tmpsql=@tmpsql+CHAR(10)+',a.'+@fieldname
|
|
|
|
|
|
set @orderid=@orderid+1
|
|
end
|
|
fetch next from tmpCur into @fieldname ,
|
|
@username ,
|
|
@fieldtypeid ,
|
|
@lookupkey ,
|
|
@lookupresult ,
|
|
@lookupsql
|
|
end
|
|
close tmpCur
|
|
deallocate tmpCur
|
|
|
|
|
|
|
|
set @tmpsql=@tmpsql+','+CAST(@stepcode as varchar)+' as '+@column_prefix+'stepcode'
|
|
if @rtagid=0
|
|
begin
|
|
set @tmpsql=@tmpsql+',a.'+@column_prefix+'rtagid'
|
|
end
|
|
set @tmpsql = 'select ' + char(10) + @tmpsql + CHAR(10) + ' from ' + @mastertable + ' a ' + @jointable
|
|
print '@tmpsql111111111='+isnull(@tmpsql,'')
|
|
if @shNewMode=1
|
|
begin
|
|
if @bxshFlag=0
|
|
begin
|
|
set @tmpsql = @tmpsql + CHAR(10) + ' where 1=1'+
|
|
' and isnull(a.' + @column_prefix + 'stepOver,0)=1 ' + CHAR(10)
|
|
end
|
|
else
|
|
begin
|
|
set @tmpsql = @tmpsql + CHAR(10) + ' where 1=1'+
|
|
' and isnull(a.' + @column_prefix + 'stepOver,0)=1 ' + CHAR(10)
|
|
end
|
|
end
|
|
else
|
|
begin
|
|
if @bxshFlag=0
|
|
begin
|
|
set @tmpsql = @tmpsql + char(10) + ' where 1=1 and isnull(a.' + @column_prefix + 'stepOver,0)=1'
|
|
end
|
|
else
|
|
begin
|
|
set @tmpsql= @tmpsql + char(10) + ' where isnull(a.' + @column_prefix + 'stepOver,0)=1'
|
|
end
|
|
end
|
|
print '@tmpsql='+isnull(@tmpsql,'')
|
|
|
|
|
|
|
|
set @msg=@tmpsql
|
|
|
|
commit
|
|
return 1
|
|
end try
|
|
begin catch
|
|
set @msg= LEFT( ERROR_MESSAGE(),1000)
|
|
IF EXISTS(SELECT 1 FROM MASTER.dbo.SYSCURSORS WHERE cursor_name='tmpcur')
|
|
BEGIN
|
|
CLOSE tmpcur -- 关闭游标
|
|
DEALLOCATE tmpcur -- 释放游标
|
|
END
|
|
goto on_error
|
|
end catch
|
|
on_error:
|
|
rollback
|
|
return -1
|
|
END
|
|
";
|
|
ExecSqlValue(sqlValue);
|
|
return true;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 生成终审回退sql
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static int GenerateFinalSqlStatement(string mMenuCode,string stepcode, out string retuenMsg)
|
|
{
|
|
SqlParameter pMsg = ERPInfo.Instance.ChangeParameterType ? new SqlParameter("@msg", SqlDbType.NVarChar, 6000) : new SqlParameter("@msg", SqlDbType.VarChar, 2000);
|
|
pMsg.Direction = ParameterDirection.Output;
|
|
SqlParameter returnValue = new SqlParameter("@return", SqlDbType.Int, 4);
|
|
returnValue.Direction = ParameterDirection.ReturnValue;
|
|
SqlParameter[] param =
|
|
{
|
|
|
|
new SqlParameter("@typecode",SqlDbType.VarChar,20),
|
|
new SqlParameter("@stepcode",SqlDbType.Int),
|
|
new SqlParameter("@operatorid",SqlDbType.Int),
|
|
pMsg,
|
|
returnValue
|
|
};
|
|
//param[0].Value = model.typeCode;
|
|
//param[1].Value = model.stepCode;
|
|
//param[2].Value = ERPInfo.Instance.UserId;
|
|
param[0].Value = mMenuCode;
|
|
param[1].Value = 0;
|
|
param[2].Value = ERPInfo.Instance.UserId;
|
|
|
|
DataSet ds = SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, "p_systemCreateendFlowSQL", "FlowSQL", param);
|
|
retuenMsg = pMsg.Value.ToString();
|
|
int result = Convert.ToInt32(returnValue.Value + "");
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 删除方案步骤
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public static bool DeleteSchemeSteps(BaseflowTypeStepModel model)
|
|
{
|
|
string sqlValue = string.Format(@"delete p_systemdlltabflowtypestep where id='{0}'", model.id);
|
|
return ExecSqlValue(sqlValue) > 0;
|
|
}
|
|
}
|
|
}
|