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/Areas/CommMng/Controllers/WorkFlowController.cs

255 lines
9.1 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.Areas.CommMng.Models;
using DSWeb.Areas.OA.Models.WorkFlow;
using DSWeb.Areas.Import.Models.XXH;
using DSWeb.TruckMng.Helper;
using DSWeb.TruckMng.Comm.Cookie;
namespace DSWeb.Areas.CommMng.Controllers
{
[JsonRequestBehavior]
public class WorkFlowController : Controller
{
//
// GET: /Import/XXH
public ActionResult Index()
{
return View();
}
//
// GET: /Import/XXH/Edit
public ActionResult Edit()
{
return View();
}
//提交审核
//开启工作流运行流程向workflow_Using表中插入数据。
/*
public ContentResult WorkFlowStart(string WorkFlowName, string BSNO, string USERID)
{
//var _count = 0;
//var corpid = Convert.ToString(Session["COMPANYID"]);
//var USERID = Convert.ToString(Session["USERID"]);
//var DEPTGID = Convert.ToString(Session["DEPTGID"]);
var Result = WorkFlowDAL.WorkFlowStart(WorkFlowName,BSNO, USERID);
var json = JsonConvert.Serialize(
new { Success = Result.Success, Message = Result.Message,totalCount=Result.totalCount });
return new ContentResult() { Content = json };
}*/
//撤回提交
public ContentResult WrokFlowReset(string WorkFlowName, string BSNO,string USERID)
{
//var corpid = Convert.ToString(Session["COMPANYID"]);
var Result = WorkFlowDAL.WorkFlowReset(WorkFlowName, BSNO, USERID);
var json = JsonConvert.Serialize(
new { Success = Result.Success, Message = Result.Message, totalCount = Result.totalCount });
return new ContentResult() { Content = json };
}
//通过工作流名称和用户名称获取该用户工作流ID
public WorkFlowmb GetWorkFlowID(string WorkFlowName)
{ //workflow.gid workflow_step.gid,userid
//var DEPTGID = Convert.ToString(Session["DEPTGID"]);
var UserID = Convert.ToString(CookieConfig.GetCookie_UserId(Request));
var _r = WorkFlowDAL.GetWorkFlowmb(WorkFlowName, UserID);
WorkFlowmb head = new WorkFlowmb();
if (_r.Success) head = (WorkFlowmb)_r.Data;
return head;
}
//通过工作流名称获取该用户工作流step
public JsonResult GetWorkFlowStep(string WorkFlowName)
{ //workflow.gid workflow_step.gid,userid
var OrgCode = Convert.ToString(CookieConfig.GetCookie_OrgCode(Request));
var UserID = Convert.ToString(CookieConfig.GetCookie_UserId(Request));
var evList = WorkFlowDAL.GetWorkFlowStep(WorkFlowName, UserID);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
/// <summary>
/// 根据工作流typeno和userid查找该用户在该工作流当前步骤下有哪些审核人
/// </summary>
/// <param name="WorkFlowName"></param>
/// <returns></returns>
public JsonResult GetWorkFlowStepAuditor(string TYPENO,string STEPNO="1")
{
var OrgCode = Convert.ToString(CookieConfig.GetCookie_OrgCode(Request));
var UserID = Convert.ToString(CookieConfig.GetCookie_UserId(Request));
var evList = WorkFlowDAL.GetWorkFlowStepAuditor(TYPENO, UserID,OrgCode, STEPNO);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public JsonResult GetWorkFlowStepAuditor_All(string TYPENO, string STEPNO = "1")
{
var evList = WorkFlowDAL.GetWorkFlowStepAuditor_All(TYPENO, STEPNO);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
//获取工作流当前状态
public JsonResult GetWorkFlowBSNO(string WorkFlowName, string STEPNO)
{ //workflow.gid workflow_step.gid,userid
var USERID = Convert.ToString(CookieConfig.GetCookie_UserId(Request));
//由某一工作流环节调取由本方法获取该userid该stepid所能操作的bsno列表并返回。
//Workflow_usingmb head = null;
var WorkFlowID = GetWorkFlowID(WorkFlowName).GID;
if (WorkFlowID == null)
{
return Json(new { success = false, Message = "未找到相应工作流" });
}
List<WorkFlow_Usingmb> evList = WorkFlowDAL.GetWorkFlowBSNOList(WorkFlowID, System.Int32.Parse(STEPNO), USERID);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
//获取某项业务的工作流当前状态
public JsonResult GetBSNOWorkFlowState(string WORKFLOWID, string BSNO)
{
var USERID = Convert.ToString(CookieConfig.GetCookie_UserId(Request));
//由某一工作流环节调取由本方法获取该userid该stepid所能操作的bsno列表并返回。
//Workflow_usingmb head = null;
//var WorkFlowID = GetWorkFlowID(WorkFlowName).GID;
if (WORKFLOWID == null)
{
return Json(new { success = false });
}
List<BSNOWorkFlowStatemb> evList = WorkFlowDAL.GetBSNOWorkFlow(WORKFLOWID, BSNO);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
/// <summary>
/// *
/// </summary>
/// <param name="GID"></param>
/// <returns></returns>
/*
public Resultmb GetNeedAudit(string GID)
{
//HTmb head = null;
var _count = WorkFlowDAL.GetNeedAudit(GID);
var _result = new Resultmb();
if (_count == 0)
{
_result.Success = true;
}
else {
_result.Success = false;
_result.Message = "不能修改,还有" + _count.ToString() + "条业务等待此步骤审核,请将这些业务审核通过或完全撤回后再修改";
}
return _result;
}
*/
/// <summary>
///
/// </summary>
/// <param name="GID"></param>
/// <returns></returns>
public ContentResult GetCanChange(string GID)
{
//HTmb head = null;
var _CanChange = WorkFlowDAL.GetCanChange(GID);
var _result = new Resultmb();
if (_CanChange.ChangeStep==false)
{
_result.Success = false;
_result.Message = "不能修改,还有业务等待此步骤审核,请将这些业务审核通过或完全撤回后再修改";
}
else
{
_result.Success = true;
}
var jsonRespose = new JsonResponse
{
Success = _result.Success,
Message = _result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult GetCanChange_UserPath(string USERID,string TYPENO,string NewWorkFlowID)
{
//HTmb head = null;
var _result = WorkFlowDAL.GetCanChange_UserPath(USERID, TYPENO, NewWorkFlowID);
var Result = new Resultmb();
if (_result == false)
{
Result.Success = false;
Result.Message = "不能修改,还有业务等待此步骤审核,请将这些业务审核通过或完全撤回后再修改";
}
else
{
Result.Success = true;
}
var jsonRespose = new JsonResponse
{
Success = Result.Success,
Message = Result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
}