using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using DSWeb.Models;
using DSWeb.EntityDA;
using System.Collections.Generic;
using DSWeb.MvcShipping.Models.MsOpApply;
using DSWeb.MvcShipping.DAL.MsOpApplyDAL;
using DSWeb.MvcShipping.DAL.MsOpBulkDAL;
using DSWeb.MvcShipping.Models.MsOpBulk;
using DSWeb.MvcShipping.DAL.MsOpOtherDAL;
using DSWeb.MvcShipping.Models.MsOpOther;
using DSWeb.WorkFlow;
namespace DSWeb.AuditProcess
{
public partial class AuditService : System.Web.UI.Page
{
private string strHandle;//执行操作类型 "audit"表示审核费用 "auditpass"表示审核通过 "reject"标识驳回提交
private string strFeeGid;//费用GID
private string strBSNO;//委托业务编号
private string strUserID;//用户GID
private int iType;//费用类型
private string strCompanyID;//公司GID
private string strShowName;//用户显示名
private string strDeptName;//部门名称
private string stroplb; //业务类别:海运出口、海运出口
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString();
}
if (Session["SHOWNAME"] != null)
{
strShowName = Session["SHOWNAME"].ToString();
}
if (Session["COMPANYID"] != null)
{
strCompanyID = Session["COMPANYID"].ToString();
}
if (Session["DEPTNAME"] != null)
{
strDeptName = Session["DEPTNAME"].ToString();
}
if (Request.QueryString["handle"] != null)
{
strHandle = Request.QueryString["handle"].ToString().Trim();
}
if (Request.QueryString["oplb"] != null)
{
stroplb = Request.QueryString["oplb"].ToString();
}
if (Request.QueryString["bsno"] != null)
{
strBSNO = Request.QueryString["bsno"].ToString().Trim();
}
if (Request.QueryString["id"] != null)
{
strFeeGid = Request.QueryString["id"].ToString().Trim();
}
if (Request.QueryString["type"] != null)
{
iType = int.Parse(Request.QueryString["type"].ToString().Trim());
}
if (strHandle == "audit" || strHandle == "Seaiaudit" || strHandle == "auditpass" || strHandle == "reject")
{
Response.Write(ExcuteHandle(strHandle, strFeeGid));
}
if (strHandle == "modifypass")
{
Response.Write(ApplyModifyFee(strFeeGid,iType));
}
if(strHandle == "modifyreject")
{
Response.Write(ApplyRejectFee(strFeeGid));
}
if (strHandle == "deletepass")
{
Response.Write(ApplyDeleteFee(strFeeGid));
}
if (strHandle == "deletereject")
{
Response.Write(ApplyDeleteRejectFee(strFeeGid));
}
if (strHandle == "amend")
{
Response.Write(ExcuteModifyByCopy(strBSNO));
}
if (strHandle == "history")
{
Response.Write(ExistFeeModifyHistory(strFeeGid));
}
if (strHandle == "existmodify" || strHandle == "Seaiexistmodify")
{
//查看是否有费用申请历史记录ch_fee_modify(费用申请修改表)
Response.Write(IsExistFeeModify(strFeeGid));
}
if (strHandle == "batchpass" && strBSNO != null)
{
Response.Write(BatchAuditPass(strBSNO, strUserID));
}
if (strHandle == "lockfee" && strBSNO != null)
{
Response.Write(BatchLockFee(strBSNO));
}
if (strHandle == "unlockfee" && strBSNO != null)
{
Response.Write(BatchUnLockFee(strBSNO));
}
if (strHandle == "getstatus" && strFeeGid != null)
{
Response.Write(GetFeeStatus(strFeeGid));
}
if (strHandle == "LockFeeisinvoice" && strBSNO != null)
{//禁开发票
Response.Write(BatchLockFeeisinvoice(strBSNO));
}
if (strHandle == "unlockfeeisinvoice" && strBSNO != null)
{//解禁发票
Response.Write(BatchUnLockFeeisinvoice(strBSNO));
}
}
#region 获取费用状态值
///
/// 获取费用状态值
///
/// 费用GID
/// 返回费用状态值
private int GetFeeStatus(string tempFeeID)
{
int iResult = 0;
FeeEntity feeEntity = new FeeEntity();
FeeDA feeDA = new FeeDA();
feeEntity = feeDA.GetFeeByID(tempFeeID);
if (feeEntity != null)
{
if (feeEntity.GID != null)
{
iResult = feeEntity.FeeStatus;
}
else
{
iResult = -1;
}
}
else
{
iResult = -1;
}
return iResult;
}
#endregion
#region 批量审核通过
///
/// 批量审核通过
///
/// 委托业务编号
/// 用户GID
/// 值等于1表示批量审核通过成功 值不等1表示批量审核失败
private int BatchAuditPass(string tempBSNO,string tempUserID)
{
int iResult = 0;
FeeDA feeDA = new FeeDA();
IList feeEntities = new List();
//工作流
WorkFlowHelper workFlowHelper = new WorkFlowHelper();
//查找付费工作流信息
//WorkFlowEntity workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FEEAUDIT, strCompanyID);
WorkFlowEntity workFlowEntity = new WorkFlowEntity();
if (stroplb == "op_Seae")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FEEAUDIT, strCompanyID);
}
else if (stroplb == "op_Seai")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.SeaiFEEAUDIT, strCompanyID);
}
else if (stroplb == "op_Sean")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FeeOpSeanRecvPayAudit,strCompanyID);
}
else if (stroplb == "op_Apply")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.APPLYFEEAUDIT, strCompanyID);
}
else if (stroplb == "op_Bulk")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.BULKFEEAUDIT, strCompanyID);
}
else if (stroplb == "op_Other")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FeeOpOtherRecvPayAudit, strCompanyID);
}
WorkFlowDoDA workFlowDoDA = new WorkFlowDoDA();
IList messageWorkFlowDoEntities = new List();
//消息提醒
MessageDA messageDA = new MessageDA();
IList messageEntities = new List();
feeEntities = feeDA.GetAuditFeeByBSNO(tempBSNO, tempUserID);
foreach (FeeEntity feeEntity in feeEntities)
{
if (feeEntity.FeeStatus == 2)
{
if (feeEntity.FeeStatus == 2)
{
//iResult = feeDA.UpdateFeeStatus(0, strGid);
//如果工作流信息存在
if (workFlowEntity != null)
{
IList workFlowDoEntities = new List();
//先查看是否当前付费申请已经进入工作流
workFlowDoEntities = workFlowDoDA.GetAllWorkFlowDoByBillNO(workFlowEntity.GID, feeEntity.GID);
if (workFlowDoEntities.Count > 0)
{
int iCount = 0;
//如果付费申请已经进入工作流,先判断当前打开付费审核页面操作人是否是工作流内相关审核人,如果是则
foreach (WorkFlowDoEntity workFlowDoEntity in workFlowDoEntities)
{
//查看当前操作人是否为审核人
if (workFlowDoEntity.Auditor == strUserID)
{
iCount++;
//查看当前审核人所处的步骤是否已经完成
if (!workFlowDoEntity.IsFinish)
{
//iResult等于1表示工作执行操作成功
iResult = workFlowHelper.DoWorkFlowStep(workFlowDoEntity, workFlowEntity);
if (iResult == 1)
{
//遍历工作流步骤信息,如果是工作流步骤最后一步,表示审核通过则置ch_fee审核通过
foreach (WorkFlowStepEntity workFlowStepEntity in workFlowEntity.WorkFlowSteps)
{
if (workFlowStepEntity.StepNO == workFlowDoEntity.StepNO)
{
if (workFlowStepEntity.IsLast)
{
int iTempStatus = feeDA.UpdateFeeStatus(0, feeEntity.GID);
if (iTempStatus != 1)
{
iResult = -5;//更新费用状态失败
}
}
}
}
}
break;
}
else if (workFlowDoEntity.IsFinish)
{
iResult = -4;//付费审核步骤已经完成,不能重复审核
break;
}
}
}
if (iCount == 0)
{
iResult = -3;//没有权利审核付费
}
}
}
}
else
{
iResult = -1;
}
}
}
int iApplicantState = 0;
if (feeEntities.Count > 0 && iResult == 1)
{
messageWorkFlowDoEntities = workFlowDoDA.GetWorkFlowDoAuditPassForMessage(workFlowEntity.GID, feeEntities[0].GID);
if (messageWorkFlowDoEntities.Count > 0)
{
foreach (WorkFlowDoEntity workFlowDo in messageWorkFlowDoEntities)
{
foreach (WorkFlowStepEntity workFlowStepEntity in workFlowEntity.WorkFlowSteps)
{
if (workFlowStepEntity.StepNO == workFlowDo.StepNO)
{
if (workFlowStepEntity.IsLast)
{
if (!workFlowDo.IsFinish)
{
MessageEntity messageEntity = new MessageEntity();
messageEntity.GID = Guid.NewGuid().ToString();
messageEntity.Name = "FeeAudit";
//messageEntity.Description = "应收应付待审核通知";
messageEntity.IsRead = false;
messageEntity.ReadCount = 0;
//messageEntity.MessageContent = strShowName + " 已批准 [应收应付费用审核] 审核,当前等待您的审核 ";
messageEntity.TaskID = "";
messageEntity.Receiver = workFlowDo.Auditor;
messageEntity.TaskUrl = "auditprocess/feeaudit.aspx";
messageEntity.Type = messageDA.GetMessageType(MessageType.FEEAUDIT);
messageEntity.RecvType = 2;//申请审核类型
if (stroplb == "op_Seai")
{
messageEntity.Description = "海运进口应收应付待审核通知";
messageEntity.MessageContent = strShowName + " 已批准 [海运进口应收应付费用审核] 审核,当前等待您的审核 ";
}
else if (stroplb == "op_Seae")
{
messageEntity.Description = "海运出口应收应付待审核通知";
messageEntity.MessageContent = strShowName + " 已批准 [海运出口应收应付费用审核] 审核,当前等待您的审核 ";
}
else if (stroplb == "op_Sean")
{
messageEntity.Description = "内贸海运应收应付待审核通知";
messageEntity.MessageContent = strShowName + " 已批准[内贸海运应收应付费用审核] 审核,当前等待您的审核";
}
else if (stroplb == "op_Apply")
{
messageEntity.Description = "报关业务应收应付待审核通知";
messageEntity.MessageContent = strShowName + " 已批准 [报关业务应收应付费用审核] 审核,当前等待您的审核 ";
}
else if (stroplb == "op_Bulk")
{
messageEntity.Description = "大宗散货业务应收应付待审核通知";
messageEntity.MessageContent = strShowName + " 已批准 [大宗散货业务应收应付费用审核] 审核,当前等待您的审核 ";
}
else if (stroplb == "op_Other")
{
messageEntity.Description = "散杂运输应收应付待审核通知";
messageEntity.MessageContent = strShowName + " 已批准 [散杂运输应收应付费用审核] 审核,当前等待您的审核 ";
}
messageEntities.Add(messageEntity);
if (iApplicantState == 0)
{
MessageEntity applicantMessageEntity = new MessageEntity();
applicantMessageEntity.GID = Guid.NewGuid().ToString();
applicantMessageEntity.Name = "FeeAudit";
//applicantMessageEntity.Description = "应收应付待审核通知";
applicantMessageEntity.IsRead = false;
applicantMessageEntity.ReadCount = 0;
//applicantMessageEntity.MessageContent = strShowName + " 已经批准通过 [应收应付费用审核] 申请,现等待下一步审核 ";
applicantMessageEntity.TaskID = "";
applicantMessageEntity.Receiver = workFlowDo.Applicant;
applicantMessageEntity.Type = messageDA.GetMessageType(MessageType.FEEAUDIT);
applicantMessageEntity.RecvType = 3;//审核完成类型
if (stroplb == "op_Seai")
{
applicantMessageEntity.TaskUrl = "SeaiInfo/SeaImportList.aspx?oplb=" + stroplb;
applicantMessageEntity.Description = "海运进口应收应付待审核通知";
applicantMessageEntity.MessageContent = strShowName + " 已经批准通过 [海运进口应收应付费用审核] 申请,现等待下一步审核 ";
}
else if (stroplb == "op_Seae")
{
applicantMessageEntity.TaskUrl = "shipping/orderlist.aspx?oplb=" + stroplb;
applicantMessageEntity.Description = "海运出口应收应付待审核通知";
applicantMessageEntity.MessageContent = strShowName + " 已经批准通过 [海运出口应收应付费用审核] 申请,现等待下一步审核 ";
}
else if (stroplb == " op_Sean")
{
applicantMessageEntity.TaskUrl = "SeanInfo/SeanInTradeList.aspx?oplb=" + stroplb;
applicantMessageEntity.Description = "内贸海运应收应付待审核通知";
applicantMessageEntity.MessageContent =strShowName+ " 已经批准通过 [内贸海运应收应付费用审核] 申请,现等待下一步审核";
}
else if (stroplb == "op_Apply")
{
applicantMessageEntity.TaskUrl = "MvcShipping/MsOpApply?oplb=" + stroplb;
applicantMessageEntity.Description = "报关业务应收应付待审核通知";
applicantMessageEntity.MessageContent = strShowName + " 已经批准通过 [报关业务应收应付费用审核] 申请,现等待下一步审核 ";
}
else if (stroplb == "op_Bulk")
{
applicantMessageEntity.TaskUrl = "MvcShipping/MsOpBulk?oplb=" + stroplb;
applicantMessageEntity.Description = "大宗散货业务应收应付待审核通知";
applicantMessageEntity.MessageContent = strShowName + " 已经批准通过 [大宗散货业务应收应付费用审核] 申请,现等待下一步审核 ";
}
else if (stroplb == "op_Other")
{
applicantMessageEntity.TaskUrl = "MvcShipping/MsOpOther?oplb=" + stroplb;
applicantMessageEntity.Description = "散杂运输应收应付待审核通知";
applicantMessageEntity.MessageContent = strShowName + " 已经批准通过 [散杂运输应收应付费用审核] 申请,现等待下一步审核 ";
}
messageEntities.Add(applicantMessageEntity);
iApplicantState++;
}
break;
}
else
{
if (iApplicantState == 0)
{
MessageEntity applicantMessageEntity = new MessageEntity();
applicantMessageEntity.GID = Guid.NewGuid().ToString();
applicantMessageEntity.Name = "FeeAudit";
//applicantMessageEntity.Description = "应收应付待审核通知";
applicantMessageEntity.IsRead = false;
applicantMessageEntity.ReadCount = 0;
//applicantMessageEntity.MessageContent = strShowName + " 已经批准通过 [应收应付费用审核] 申请,全部审核已完成 ";
applicantMessageEntity.TaskID = "";
applicantMessageEntity.Receiver = workFlowDo.Applicant;
applicantMessageEntity.Type = messageDA.GetMessageType(MessageType.FEEAUDIT);
applicantMessageEntity.RecvType = 3;//审核完成类型
if (stroplb == "op_Seai")
{
applicantMessageEntity.TaskUrl = "SeaiInfo/SeaImportList.aspx?oplb=" + stroplb;
applicantMessageEntity.Description = "海运进口应收应付待审核通知";
applicantMessageEntity.MessageContent = strShowName + " 已经批准通过 [海运进口应收应付费用审核] 申请,全部审核已完成 ";
}
else if (stroplb == "op_Seae")
{
applicantMessageEntity.TaskUrl = "shipping/orderlist.aspx?oplb=" + stroplb;
applicantMessageEntity.Description = "海运出口应收应付待审核通知";
applicantMessageEntity.MessageContent = strShowName + " 已经批准通过 [海运出口应收应付费用审核] 申请,全部审核已完成 ";
}
else if (stroplb == "op_Sean")
{
applicantMessageEntity.TaskUrl = "SeanInfo/SeanInTradeList.aspx?oplb=" + stroplb;
applicantMessageEntity.Description = "内贸海运应收应付待审核通知";
applicantMessageEntity.MessageContent =strShowName+ "已经批准通过 [内贸海运应收应付费用审核] 申请,全部审核已完成";
}
else if (stroplb == "op_Apply")
{
applicantMessageEntity.TaskUrl = "MvcShipping/MsOpApply?oplb=" + stroplb;
applicantMessageEntity.Description = "报关业务应收应付待审核通知";
applicantMessageEntity.MessageContent = strShowName + " 已经批准通过 [报关业务应收应付费用审核] 申请,全部审核已完成 ";
}
else if (stroplb == "op_Bulk")
{
applicantMessageEntity.TaskUrl = "MvcShipping/MsOpBulk?oplb=" + stroplb;
applicantMessageEntity.Description = "大宗散货业务应收应付待审核通知";
applicantMessageEntity.MessageContent = strShowName + " 已经批准通过 [大宗散货业务应收应付费用审核] 申请,全部审核已完成 ";
}
else if (stroplb == "op_Other")
{
applicantMessageEntity.TaskUrl = "MvcShipping/MsOpOther?oplb=" + stroplb;
applicantMessageEntity.Description = "散杂运输应收应付待审核通知";
applicantMessageEntity.MessageContent = strShowName + " 已经批准通过 [散杂运输应收应付费用审核] 申请,全部审核已完成 ";
}
messageEntities.Add(applicantMessageEntity);
iApplicantState++;
}
break;
}
}
}
}
}
if (messageEntities.Count > 0)
{
messageDA.CreateMessage(MessageType.FEEAUDIT, messageEntities);
}
}
}
return iResult;
}
#endregion
#region 批量加锁操作
///
/// 批量加锁操作
///
/// 委托业务编号
/// 值等于1表示加锁成功 值不等于1表示加锁失败
private int BatchLockFee(string tempBSNO)
{
int iResult = 0;
FeeDA feeDA = new FeeDA();
IList feeEntities = new List();
feeEntities = feeDA.GetFeeByBSNO(tempBSNO);
int iCount = 0;
for(int i=0;i
/// 批量解锁操作
///
/// 委托业务编号
/// 值等于1表示解锁成功 值不等于1表示解锁失败
private int BatchUnLockFee(string tempBSNO)
{
int iResult = 0;
if (stroplb == "op_Seae")
{
TopSeaeEntity topSeaeEntity = new TopSeaeEntity();
SeaExportInfoDA seaExportInfoDA = new SeaExportInfoDA();
topSeaeEntity = seaExportInfoDA.GetID(tempBSNO);
if (topSeaeEntity != null)
{
if (topSeaeEntity.BSNO != null)
{
if (topSeaeEntity.FEESTATUS)
{
iResult = seaExportInfoDA.UnLockFeeStatus(tempBSNO);
if (iResult == 1)
{
topSeaeEntity = seaExportInfoDA.GetID(tempBSNO);
if (topSeaeEntity != null)
{
if (topSeaeEntity.BSNO != null)
{
if (topSeaeEntity.FEESTATUS)
{
iResult = 2;
}
else
{
iResult = 3;
}
}
}
}
}
}
else
{
iResult = -3;//委托业务费用没有加锁,不能执行解锁操作
}
}
else
{
iResult = -3;//委托业务费用没有加锁,不能执行解锁操作
}
}
else if (stroplb == "op_Seai")
{
TopSeaiEntity topSeaiEntity = new TopSeaiEntity();
SeaImportInfoDA seaImportInfoDA = new SeaImportInfoDA();
topSeaiEntity = seaImportInfoDA.GetID(tempBSNO);
if (topSeaiEntity != null)
{
if (topSeaiEntity.BSNO != null)
{
if (topSeaiEntity.FEESTATUS)
{
iResult = seaImportInfoDA.UnLockFeeStatus(tempBSNO);
if (iResult == 1)
{
topSeaiEntity = seaImportInfoDA.GetID(tempBSNO);
if (topSeaiEntity != null)
{
if (topSeaiEntity.BSNO != null)
{
if (topSeaiEntity.FEESTATUS)
{
iResult = 2;
}
else
{
iResult = 3;
}
}
}
}
}
}
else
{
iResult = -3;//委托业务费用没有加锁,不能执行解锁操作
}
}
else
{
iResult = -3;//委托业务费用没有加锁,不能执行解锁操作
}
}
else if (stroplb == "op_Sean")
{
Opsean seanDA = new Opsean();
OpseanEntity seanEntity = new OpseanEntity();
seanEntity = seanDA.GetAllSeanInfo(tempBSNO);
if (seanEntity != null)
{
if (seanEntity.BSNO != null)
{
if (seanEntity.FEESTATUS)
{
iResult = seanDA.UnLockSeanFeeStatus(tempBSNO);
if (iResult == 1)
{
seanEntity = seanDA.GetAllSeanInfo(tempBSNO);
if (seanEntity != null)
{
if (seanEntity.BSNO != null)
{
if (seanEntity.FEESTATUS)
{
iResult = 2;
}
else
{
iResult = 3;
}
}
}
}
}
}
else
{
iResult = -3;
}
}
else
{
iResult = -3;
}
}
else if (stroplb == "op_Apply")
{
MsOpApply topSeaiEntity = MsOpApplyDAL.GetData("BSNO='" + tempBSNO + "'");
if (topSeaiEntity != null)
{
if (topSeaiEntity.BSNO != null)
{
if (topSeaiEntity.FEESTATUS)
{
iResult = MsOpApplyDAL.UnLockFeeStatus(tempBSNO);
if (iResult == 1)
{
topSeaiEntity = MsOpApplyDAL.GetData("BSNO='" + tempBSNO + "'");
if (topSeaiEntity != null)
{
if (topSeaiEntity.BSNO != null)
{
if (topSeaiEntity.FEESTATUS)
{
iResult = 2;
}
else
{
iResult = 3;
}
}
}
}
}
}
else
{
iResult = -3;//委托业务费用没有加锁,不能执行解锁操作
}
}
else
{
iResult = -3;//委托业务费用没有加锁,不能执行解锁操作
}
}
else if (stroplb == "op_Bulk")
{
MsOpBulk topSeaiEntity = MsOpBulkDAL.GetData("BSNO='" + tempBSNO + "'");
if (topSeaiEntity != null)
{
if (topSeaiEntity.BSNO != null)
{
if (topSeaiEntity.FEESTATUS)
{
iResult = MsOpBulkDAL.UnLockFeeStatus(tempBSNO);
if (iResult == 1)
{
topSeaiEntity = MsOpBulkDAL.GetData("BSNO='" + tempBSNO + "'");
if (topSeaiEntity != null)
{
if (topSeaiEntity.BSNO != null)
{
if (topSeaiEntity.FEESTATUS)
{
iResult = 2;
}
else
{
iResult = 3;
}
}
}
}
}
}
else
{
iResult = -3;//委托业务费用没有加锁,不能执行解锁操作
}
}
else
{
iResult = -3;//委托业务费用没有加锁,不能执行解锁操作
}
}
else if (stroplb == "op_Other")
{
MsOpOtherEntity MsOpOtherEntity = MsOpOtherDAL.GetData("BSNO='" + tempBSNO + "'");
if (MsOpOtherEntity != null)
{
if (MsOpOtherEntity.BSNO != null)
{
if (MsOpOtherEntity.FEESTATUS)
{
iResult = MsOpOtherDAL.UnLockFeeStatus(tempBSNO);
if (iResult == 1)
{
MsOpOtherEntity = MsOpOtherDAL.GetData("BSNO='" + tempBSNO + "'");
if (MsOpOtherEntity != null)
{
if (MsOpOtherEntity.BSNO != null)
{
if (MsOpOtherEntity.FEESTATUS)
{
iResult = 2;
}
else
{
iResult = 3;
}
}
}
}
}
}
else
{
iResult = -3;//委托业务费用没有加锁,不能执行解锁操作
}
}
else
{
iResult = -3;//委托业务费用没有加锁,不能执行解锁操作
}
}
return iResult;
}
#endregion
#region 禁开发票
///
/// 禁开发票
///
/// 委托业务编号
/// 值等于1表示加锁成功 值不等于1表示加锁失败
private int BatchLockFeeisinvoice(string tempGid)
{
int iResult = 0;
FeeDA feeDA = new FeeDA();
iResult = feeDA.LockFeeISINVOICE(tempGid);
return iResult;
}
#endregion
#region 解禁发票
///
/// 解禁发票
///
/// 委托业务编号
/// 值等于1表示解锁成功 值不等于1表示解锁失败
private int BatchUnLockFeeisinvoice(string tempGid)
{
int iResult = 0;
FeeDA feeDA = new FeeDA();
iResult = feeDA.UnLockFeeISINVOICE(tempGid);
return iResult;
}
#endregion
#region 查看是否有费用申请历史记录ch_fee_modify(费用申请修改表)
///
/// 查看是否有费用申请历史记录ch_fee_modify(费用申请修改表)
///
/// 费用GID
/// 值1表示存在 值不等于1表示不存在
private int IsExistFeeModify(string tempFeeID)
{
int iResult = 0;
FeeModifyDA feeModifyDA = new FeeModifyDA();
IList feeModifyEntities = new List();
//获取费用申请更改历史记录ch_fee_modify(费用申请修改表)
feeModifyEntities = feeModifyDA.GetFeeModifyHistory(tempFeeID);
if (feeModifyEntities.Count > 0)
{
iResult = 1;
}
return iResult;
}
#endregion
private int ExistFeeModifyHistory(string strFeeGID)
{
int iResult = 0;
FeeModifyDA feeModifyDA = new FeeModifyDA();
IList feeModifyEntity = new List();
feeModifyEntity = feeModifyDA.GetExistFeeModify(strFeeGID);
if (feeModifyEntity.Count > 0)
{
iResult = 1;
}
return iResult;
}
///
/// 通过申请费用更改
///
///
///
private int ApplyModifyFee(string tempFeeID,int tempType)
{
int iResult = 0;
FeeModifyDA feeModifyDA = new FeeModifyDA();
iResult = feeModifyDA.ApplyModifyPass(tempFeeID,strUserID);
return iResult;
}
private int ApplyRejectFee(string tempFeeID)
{
int iResult = 0;
FeeModifyDA feeModifyDA = new FeeModifyDA();
iResult = feeModifyDA.ApplyModifyReject(tempFeeID,strUserID);
return iResult;
}
private int ApplyDeleteFee(string tempFeeID)
{
int iResult = 0;
FeeModifyDA feeModifyDA = new FeeModifyDA();
iResult = feeModifyDA.ApplyDeletePass(tempFeeID,strUserID);
return iResult;
}
private int ApplyDeleteRejectFee(string tempFeeID)
{
int iResult = 0;
FeeModifyDA feeModifyDA = new FeeModifyDA();
iResult = feeModifyDA.ApplyDeleteReject(tempFeeID,strUserID);
return iResult;
}
///
/// 根据handle类型执行更新操作:更新费用信息ch_fee.feestatus和工作流运行表WorkFlowDo信息
/// 费用状态值 费用状态主要有11个状态,分别为审核通过(STATUS=0)录入状态(STATUS=1)提交审核(STATUS=2)申请修改 (STATUS=3)
/// 取消申请(STATUS=5)驳回提交(STATUS=6)驳回申请(STATUS=7)部分结算(STATUS=8)结算完毕(STATUS=9)
///
///
///
///
private int ExcuteHandle(string tempHandle,string strGid)
{
int iResult = 0;
int iWorkFlowStatus = 0;
FeeDA feeDA = new FeeDA();
FeeEntity feeEntity = new FeeEntity();
//通过费用GID获取ch_fee费用信息
feeEntity = feeDA.GetFeeByID(strGid);
#region audit
if (tempHandle.ToLower().Equals("audit"))
{ //ch_fee费用信息的费用状态为1录入状态或6驳回提交
if (feeEntity.FeeStatus == 1 || feeEntity.FeeStatus == 6)
{
WorkFlowHelper workFlowHelper = new WorkFlowHelper();
//通过模块NAME获取工作流信息
//WorkFlowEntity workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FEEAUDIT,strCompanyID);
WorkFlowEntity workFlowEntity = new WorkFlowEntity();
if (stroplb == "op_Seae")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FEEAUDIT, strCompanyID);
}
else if (stroplb == "op_Seai")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.SeaiFEEAUDIT, strCompanyID);
}
else if (stroplb == "op_Sean")//内贸应收应付费用审核
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FeeOpSeanRecvPayAudit, strCompanyID);
}
else if (stroplb == "op_Apply")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.APPLYFEEAUDIT, strCompanyID);
}
else if (stroplb == "op_Bulk")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.BULKFEEAUDIT, strCompanyID);
}
else if (stroplb == "op_Other")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FeeOpOtherRecvPayAudit, strCompanyID);
}
if (workFlowEntity != null)
{
#region 原费用提交审核工作流_无事务
////根据Gid更新ch_fee.feestatus费用状态信息:为"提交审核"
//iResult = feeDA.UpdateFeeStatus(2, strGid);
//if (iResult == 1)
//{
// WorkFlowDoEntity workFlowDoEntity = null;
// WorkFlowDoDA workFlowDoDA = new WorkFlowDoDA();
// //查看当前提交的应收应付费用审核已经进入工作流,通过工作流GID和申请编号BILLNO获取工作流运行表WorkFlowDo信息
// workFlowDoEntity = workFlowDoDA.GetSigleWorkFlowDoByBillNO(workFlowEntity.GID, strGid);
// if (workFlowDoEntity == null)
// {
// IList workFlowDoEntities = new List();
// if (workFlowDoEntity.GID == null)
// {
// foreach (WorkFlowStepEntity step in workFlowEntity.WorkFlowSteps)
// {
// //遍历所有工作流下步骤,获取第一步骤GID信息
// if (step.StepNO == 1)
// {
// if (step.IsDepartment)
// {
// string strDepartmentID = step.DepartmentID == null ? "" : step.DepartmentID;
// if (strDepartmentID.Trim() != null)
// {
// SysDeptDA sysDeptDA = new SysDeptDA();
// string strDeptID = sysDeptDA.GetDepartmentIdByUser(strUserID);
// if (strDeptID.Trim().Equals(strDepartmentID) && strDepartmentID != "")
// {
// WorkFlowDoEntity initWorkFlowDoEntity = new WorkFlowDoEntity();
// initWorkFlowDoEntity.GID = Guid.NewGuid().ToString();
// initWorkFlowDoEntity.WorkFlowID = workFlowEntity.GID;
// initWorkFlowDoEntity.StepID = step.GID;
// initWorkFlowDoEntity.StepNO = step.StepNO;
// initWorkFlowDoEntity.Auditor = step.Auditor == null ? step.DefaultAuditor : step.Auditor;
// initWorkFlowDoEntity.FeeID = "";
// initWorkFlowDoEntity.BSNO = "";
// initWorkFlowDoEntity.FeeStatus = 0;
// initWorkFlowDoEntity.DoQuerySql = "";
// initWorkFlowDoEntity.BillNO = strGid;
// initWorkFlowDoEntity.IsFinish = false;
// initWorkFlowDoEntity.Applicant = strUserID;
// workFlowDoEntities.Add(initWorkFlowDoEntity);
// }
// }
// }
// else
// {
// WorkFlowDoEntity initWorkFlowDoEntity = new WorkFlowDoEntity();
// initWorkFlowDoEntity.GID = Guid.NewGuid().ToString();
// initWorkFlowDoEntity.WorkFlowID = workFlowEntity.GID;
// initWorkFlowDoEntity.StepID = step.GID;
// initWorkFlowDoEntity.StepNO = step.StepNO;
// initWorkFlowDoEntity.Auditor = step.Auditor == null ? step.DefaultAuditor : step.Auditor;
// initWorkFlowDoEntity.FeeID = "";
// initWorkFlowDoEntity.BSNO = "";
// initWorkFlowDoEntity.FeeStatus = 0;
// initWorkFlowDoEntity.DoQuerySql = "";
// initWorkFlowDoEntity.BillNO = strGid;
// initWorkFlowDoEntity.IsFinish = false;
// initWorkFlowDoEntity.Applicant = strUserID;
// workFlowDoEntities.Add(initWorkFlowDoEntity);
// }
// }
// }
// //插入WorkFlowDo信息
// iWorkFlowStatus = workFlowDoDA.InsertWorkFlowDo(workFlowDoEntities);
// if (iWorkFlowStatus == 1)
// {
// int iTempStatus = feeDA.UpdateFeeAuditStatus(strGid, 1);
// if (iTempStatus != 1)
// {
// iResult = -5;//更新费用状态失败
// }
// #region
// //else
// //{
// // //状态完成后发送通知消息
// // IList messageEntities = new List();
// // MessageDA messageDA = new MessageDA();
// // foreach (WorkFlowDoEntity workFlowDo in workFlowDoEntities)
// // {
// // MessageEntity messageEntity = new MessageEntity();
// // messageEntity.GID = Guid.NewGuid().ToString();
// // messageEntity.Name = "FeeAudit";
// // messageEntity.Description = "应收应付审核通知";
// // messageEntity.IsRead = false;
// // messageEntity.ReadCount = 0;
// // messageEntity.MessageContent = strShowName + " 提交 " + (feeEntity.FeeType == 1 ? "应收费用" : "应付费用") + "[" + feeEntity.FeeName + "]费用 应收应付审核 ";
// // messageEntity.TaskID = workFlowDo.BillNO;
// // messageEntity.Receiver = workFlowDo.Auditor;
// // messageEntity.TaskUrl = messageEntity.TaskUrl = "auditprocess/feeaudit.aspx";
// // messageEntity.Type = messageDA.GetMessageType(MessageType.FEEAUDIT);
// // messageEntities.Add(messageEntity);
// // }
// // if (messageEntities.Count > 0)
// // {
// // messageDA.CreateMessage(MessageType.FEEAUDIT, messageEntities);
// // }
// //}
// #endregion
// }
// }
// }
// else
// {
// IList workFlowDoEntities = new List();
// if (workFlowDoEntity.GID == null)
// {
// foreach (WorkFlowStepEntity step in workFlowEntity.WorkFlowSteps)
// {
// //遍历所有工作流下步骤,获取第一步骤GID信息
// if (step.StepNO == 1)
// {
// if (step.IsDepartment)
// {
// string strDepartmentID = step.DepartmentID == null ? "" : step.DepartmentID;
// if (strDepartmentID.Trim() != null)
// {
// SysDeptDA sysDeptDA = new SysDeptDA();
// string strDeptID = sysDeptDA.GetDepartmentIdByUser(strUserID);
// if (strDeptID.Trim().Equals(strDepartmentID) && strDepartmentID != "")
// {
// WorkFlowDoEntity initWorkFlowDoEntity = new WorkFlowDoEntity();
// initWorkFlowDoEntity.GID = Guid.NewGuid().ToString();
// initWorkFlowDoEntity.WorkFlowID = workFlowEntity.GID;
// initWorkFlowDoEntity.StepID = step.GID;
// initWorkFlowDoEntity.StepNO = step.StepNO;
// initWorkFlowDoEntity.Auditor = step.Auditor == null ? step.DefaultAuditor : step.Auditor;
// initWorkFlowDoEntity.FeeID = "";
// initWorkFlowDoEntity.BSNO = "";
// initWorkFlowDoEntity.FeeStatus = 0;
// initWorkFlowDoEntity.DoQuerySql = "";
// initWorkFlowDoEntity.BillNO = strGid;
// initWorkFlowDoEntity.IsFinish = false;
// initWorkFlowDoEntity.Applicant = strUserID;
// workFlowDoEntities.Add(initWorkFlowDoEntity);
// }
// }
// }
// else
// {
// WorkFlowDoEntity initWorkFlowDoEntity = new WorkFlowDoEntity();
// initWorkFlowDoEntity.GID = Guid.NewGuid().ToString();
// initWorkFlowDoEntity.WorkFlowID = workFlowEntity.GID;
// initWorkFlowDoEntity.StepID = step.GID;
// initWorkFlowDoEntity.StepNO = step.StepNO;
// initWorkFlowDoEntity.Auditor = step.Auditor == null ? step.DefaultAuditor : step.Auditor;
// initWorkFlowDoEntity.FeeID = "";
// initWorkFlowDoEntity.BSNO = "";
// initWorkFlowDoEntity.FeeStatus = 0;
// initWorkFlowDoEntity.DoQuerySql = "";
// initWorkFlowDoEntity.BillNO = strGid;
// initWorkFlowDoEntity.IsFinish = false;
// initWorkFlowDoEntity.Applicant = strUserID;
// workFlowDoEntities.Add(initWorkFlowDoEntity);
// }
// }
// }
// iWorkFlowStatus = workFlowDoDA.InsertWorkFlowDo(workFlowDoEntities);
// if (iWorkFlowStatus == 1)
// {
// int iTempStatus = feeDA.UpdateFeeAuditStatus(strGid, 1);
// if (iTempStatus != 1)
// {
// iResult = -5;//更新费用状态失败
// }
// #region 注释
// //else
// //{
// // //状态完成后发送通知消息
// // IList messageEntities = new List();
// // MessageDA messageDA = new MessageDA();
// // foreach (WorkFlowDoEntity workFlowDo in workFlowDoEntities)
// // {
// // MessageEntity messageEntity = new MessageEntity();
// // messageEntity.GID = Guid.NewGuid().ToString();
// // messageEntity.Name = "FeeAudit";
// // messageEntity.Description = "应收应付审核通知";
// // messageEntity.IsRead = false;
// // messageEntity.ReadCount = 0;
// // messageEntity.MessageContent = strShowName + " 提交 " + (feeEntity.FeeType == 1 ? "应收费用" : "应付费用") + "[" + feeEntity.FeeName + "]费用 应收应付审核 ";
// // messageEntity.TaskID = workFlowDo.BillNO;
// // messageEntity.Receiver = workFlowDo.Auditor;
// // messageEntity.TaskUrl = "auditprocess/feeaudit.aspx";
// // messageEntity.Type = messageDA.GetMessageType(MessageType.FEEAUDIT);
// // messageEntities.Add(messageEntity);
// // }
// // if (messageEntities.Count > 0)
// // {
// // messageDA.CreateMessage(MessageType.FEEAUDIT, messageEntities);
// // }
// //}
// #endregion
// }
// }
// }
//}
#endregion
#region 费用提交审核工作流_有事务
WorkFlowDoDA workFlowDoDA = new WorkFlowDoDA();
iResult = workFlowDoDA.FeeAudit(workFlowEntity, strGid, strUserID);
#endregion
}
else
{
//因未走工作流,所以根据Gid更新ch_fee.feestatus费用状态信息:为"审核通过"
iResult = feeDA.UpdateFeeStatus(0, strGid);
if (iResult == 1)
{
iResult = 10;//未走工作流,自动审核通过
}
}
}
else
{
iResult = -1;
}
}
#endregion
#region auditpass
if (tempHandle.ToLower().Equals("auditpass"))
{
if (feeEntity.FeeStatus == 2)
{
//iResult = feeDA.UpdateFeeStatus(0, strGid);
//工作流
WorkFlowHelper workFlowHelper = new WorkFlowHelper();
//查找付费工作流信息
//WorkFlowEntity workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FEEAUDIT,strCompanyID);
WorkFlowEntity workFlowEntity = new WorkFlowEntity();
if (stroplb == "op_Seae")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FEEAUDIT, strCompanyID);
}
else if (stroplb == "op_Seai")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.SeaiFEEAUDIT, strCompanyID);
}
else if (stroplb == "wms_out")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.WmsOutFEEAUDIT, strCompanyID);
}
else if (stroplb == "op_Sean")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FeeOpSeanRecvPayAudit,strCompanyID);
}
else if (stroplb == "op_Apply")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.APPLYFEEAUDIT, strCompanyID);
}
else if (stroplb == "op_Bulk")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.BULKFEEAUDIT, strCompanyID);
}
else if (stroplb == "op_Other")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FeeOpOtherRecvPayAudit, strCompanyID);
}
//如果工作流信息存在
if (workFlowEntity != null)
{
IList workFlowDoEntities = new List();
WorkFlowDoDA workFlowDoDA = new WorkFlowDoDA();
//先查看是否当前付费申请已经进入工作流
workFlowDoEntities = workFlowDoDA.GetAllWorkFlowDoByBillNO(workFlowEntity.GID, strGid);
if (workFlowDoEntities.Count > 0)
{
int iCount = 0;
//如果付费申请已经进入工作流,先判断当前打开付费审核页面操作人是否是工作流内相关审核人,如果是则
foreach (WorkFlowDoEntity workFlowDoEntity in workFlowDoEntities)
{
//查看当前操作人是否为审核人
if (workFlowDoEntity.Auditor == strUserID)
{
iCount++;
//查看当前审核人所处的步骤是否已经完成
if (!workFlowDoEntity.IsFinish)
{
//iResult等于1表示工作执行操作成功
iResult = workFlowHelper.DoWorkFlowStep(workFlowDoEntity, workFlowEntity);
if (iResult == 1)
{
//遍历工作流步骤信息,如果是工作流步骤最后一步,表示审核通过则置ch_fee审核通过
foreach (WorkFlowStepEntity workFlowStepEntity in workFlowEntity.WorkFlowSteps)
{
if (workFlowStepEntity.StepNO == workFlowDoEntity.StepNO)
{
if (workFlowStepEntity.IsLast)
{
int iTempStatus = feeDA.UpdateFeeStatus(0, strGid);
if (iTempStatus != 1)
{
iResult = -5;//更新费用状态失败
}
if (iTempStatus == 1)
{
feeEntity = feeDA.GetFeeByID(strGid);
iResult = feeEntity.FeeStatus;
}
}
}
}
}
break;
}
else if (workFlowDoEntity.IsFinish)
{
iResult = -4;//付费审核步骤已经完成,不能重复审核
break;
}
}
}
if (iCount == 0)
{
iResult = -3;//没有权利审核付费
}
}
}
}
else
{
iResult = -1;
}
}
#endregion
#region reject
if (tempHandle.ToLower().Equals("reject"))
{
if (feeEntity.FeeStatus == 2 || feeEntity.FeeStatus == 5 || feeEntity.FeeStatus == 0)
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
int iCount = int.Parse(T_ALL_DA.GetStrSQL("hj", "select count(*) as hj from ch_fee_do where (ISDELETED=0 or ISDELETED is null) and feeid='" + strGid + "'"));
if (iCount > 0 && feeEntity.FeeStatus == 0)
{
return -10;//注:已经做收付费申请或发票申请的费用,不允许驳回申请!
}
//
FeeDoDA feeDoDA = new FeeDoDA();
IList feeDoEntities = new List();
feeDoEntities = feeDoDA.GetFeeDoByBillNO(strGid);
//工作流
WorkFlowHelper workFlowHelper = new WorkFlowHelper();
//查找付费工作流信息
WorkFlowEntity workFlowEntity =new WorkFlowEntity();
if (stroplb == "op_Seae")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FEEAUDIT, strCompanyID);
}
else if (stroplb == "op_Seai")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.SeaiFEEAUDIT, strCompanyID);
}
else if (stroplb == "op_Sean")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FeeOpSeanRecvPayAudit,strCompanyID);
}
else if (stroplb == "op_Apply")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.APPLYFEEAUDIT, strCompanyID);
}
else if (stroplb == "op_Bulk")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.BULKFEEAUDIT, strCompanyID);
}
else if (stroplb == "op_Other")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FeeOpOtherRecvPayAudit, strCompanyID);
}
//如果工作流信息存在
if (workFlowEntity != null)
{
IList workFlowDoEntities = new List();
WorkFlowDoDA workFlowDoDA = new WorkFlowDoDA();
//先查看是否当前付费申请已经进入工作流
workFlowDoEntities = workFlowDoDA.GetAllWorkFlowDoByBillNO(workFlowEntity.GID, strGid);
if (workFlowDoEntities.Count > 0)
{
//如果付费申请已经进入工作流,先判断当前打开付费审核页面操作人是否是工作流内相关审核人,如果是则
foreach (WorkFlowDoEntity workFlowDoEntity in workFlowDoEntities)
{
//查看当前操作人是否为审核人
if (workFlowDoEntity.Auditor == strUserID)
{
workFlowDoEntity.IsFinish = true;
workFlowDoEntity.IsDelete = true;
workFlowDoEntity.DeleteStep = workFlowDoEntity.StepID;
workFlowDoEntity.DeleteOperator = strUserID;
workFlowDoEntity.DeleteStepNO = workFlowDoEntity.StepNO;
workFlowDoEntity.IsFinish = true;
int iTempRejectStatus = workFlowHelper.DoWorkFlowReject(workFlowDoEntity, WorkFlowType.FEEAUDIT, feeDoEntities,strGid,strCompanyID);
if (iTempRejectStatus == 1)
{
int iFeeStatus = feeDA.UpdateFeeStatus(6, strGid);
if (iFeeStatus == 1)
{
feeEntity = feeDA.GetFeeByID(strGid);
iResult = feeEntity.FeeStatus;
}
else
{
iResult = -5;//费用状态更新失败
}
}
else
{
iResult = -4;//工作流审核驳回失败
}
}
}
}
}
}
#region 注释
////如果FeeStatus状态是申请修改 (STATUS=3) 取消申请(STATUS=5) 则状态更新驳回申请
//if (feeEntity.FeeStatus == 3 || feeEntity.FeeStatus == 5)
//{
// iResult = feeDA.UpdateFeeStatus(7, strGid);
//}
//else if (feeEntity.FeeStatus == 2 || feeEntity.FeeStatus == 0)
//{
// iResult = feeDA.UpdateFeeStatus(6, strGid);
//}
//else
//{
// iResult = -1;
//}
#endregion
}
#endregion
#region seaiaudit
if (tempHandle.ToLower().Equals("seaiaudit"))
{ //ch_fee费用信息的费用状态为1录入状态或6驳回提交
if (feeEntity.FeeStatus == 1 || feeEntity.FeeStatus == 6)
{ //根据Gid更新ch_fee.feestatus费用状态信息:为"提交审核"
iResult = feeDA.UpdateFeeStatus(2, strGid);
if (iResult == 1)
{
WorkFlowHelper workFlowHelper = new WorkFlowHelper();
//通过模块NAME获取工作流信息
WorkFlowEntity workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.SeaiFEEAUDIT, strCompanyID);
if (workFlowEntity != null)
{
WorkFlowDoEntity workFlowDoEntity = null;
WorkFlowDoDA workFlowDoDA = new WorkFlowDoDA();
//查看当前提交的应收应付费用审核已经进入工作流,通过工作流GID和申请编号BILLNO获取工作流运行表WorkFlowDo信息
workFlowDoEntity = workFlowDoDA.GetSigleWorkFlowDoByBillNO(workFlowEntity.GID, strGid);
if (workFlowDoEntity == null)
{
IList workFlowDoEntities = new List();
if (workFlowDoEntity.GID == null)
{
foreach (WorkFlowStepEntity step in workFlowEntity.WorkFlowSteps)
{
//遍历所有工作流下步骤,获取第一步骤GID信息
if (step.StepNO == 1)
{
if (step.IsDepartment)
{
string strDepartmentID = step.DepartmentID == null ? "" : step.DepartmentID;
if (strDepartmentID.Trim() != null)
{
SysDeptDA sysDeptDA = new SysDeptDA();
string strDeptID = sysDeptDA.GetDepartmentIdByUser(strUserID);
if (strDeptID.Trim().Equals(strDepartmentID) && strDepartmentID != "")
{
WorkFlowDoEntity initWorkFlowDoEntity = new WorkFlowDoEntity();
initWorkFlowDoEntity.GID = Guid.NewGuid().ToString();
initWorkFlowDoEntity.WorkFlowID = workFlowEntity.GID;
initWorkFlowDoEntity.StepID = step.GID;
initWorkFlowDoEntity.StepNO = step.StepNO;
initWorkFlowDoEntity.Auditor = step.Auditor == null ? step.DefaultAuditor : step.Auditor;
initWorkFlowDoEntity.FeeID = "";
initWorkFlowDoEntity.BSNO = "";
initWorkFlowDoEntity.FeeStatus = 0;
initWorkFlowDoEntity.DoQuerySql = "";
initWorkFlowDoEntity.BillNO = strGid;
initWorkFlowDoEntity.IsFinish = false;
initWorkFlowDoEntity.Applicant = strUserID;
workFlowDoEntities.Add(initWorkFlowDoEntity);
}
}
}
else
{
WorkFlowDoEntity initWorkFlowDoEntity = new WorkFlowDoEntity();
initWorkFlowDoEntity.GID = Guid.NewGuid().ToString();
initWorkFlowDoEntity.WorkFlowID = workFlowEntity.GID;
initWorkFlowDoEntity.StepID = step.GID;
initWorkFlowDoEntity.StepNO = step.StepNO;
initWorkFlowDoEntity.Auditor = step.Auditor == null ? step.DefaultAuditor : step.Auditor;
initWorkFlowDoEntity.FeeID = "";
initWorkFlowDoEntity.BSNO = "";
initWorkFlowDoEntity.FeeStatus = 0;
initWorkFlowDoEntity.DoQuerySql = "";
initWorkFlowDoEntity.BillNO = strGid;
initWorkFlowDoEntity.IsFinish = false;
initWorkFlowDoEntity.Applicant = strUserID;
workFlowDoEntities.Add(initWorkFlowDoEntity);
}
}
}
//插入WorkFlowDo信息
iWorkFlowStatus = workFlowDoDA.InsertWorkFlowDo(workFlowDoEntities);
if (iWorkFlowStatus == 1)
{
int iTempStatus = feeDA.UpdateFeeAuditStatus(strGid, 1);
if (iTempStatus != 1)
{
iResult = -5;//更新费用状态失败
}
#region
//else
//{
// //状态完成后发送通知消息
// IList messageEntities = new List();
// MessageDA messageDA = new MessageDA();
// foreach (WorkFlowDoEntity workFlowDo in workFlowDoEntities)
// {
// MessageEntity messageEntity = new MessageEntity();
// messageEntity.GID = Guid.NewGuid().ToString();
// messageEntity.Name = "FeeAudit";
// messageEntity.Description = "应收应付审核通知";
// messageEntity.IsRead = false;
// messageEntity.ReadCount = 0;
// messageEntity.MessageContent = strShowName + " 提交 " + (feeEntity.FeeType == 1 ? "应收费用" : "应付费用") + "[" + feeEntity.FeeName + "]费用 应收应付审核 ";
// messageEntity.TaskID = workFlowDo.BillNO;
// messageEntity.Receiver = workFlowDo.Auditor;
// messageEntity.TaskUrl = messageEntity.TaskUrl = "auditprocess/feeaudit.aspx";
// messageEntity.Type = messageDA.GetMessageType(MessageType.FEEAUDIT);
// messageEntities.Add(messageEntity);
// }
// if (messageEntities.Count > 0)
// {
// messageDA.CreateMessage(MessageType.FEEAUDIT, messageEntities);
// }
//}
#endregion
}
}
}
else
{
IList workFlowDoEntities = new List();
if (workFlowDoEntity.GID == null)
{
foreach (WorkFlowStepEntity step in workFlowEntity.WorkFlowSteps)
{
//遍历所有工作流下步骤,获取第一步骤GID信息
if (step.StepNO == 1)
{
if (step.IsDepartment)
{
string strDepartmentID = step.DepartmentID == null ? "" : step.DepartmentID;
if (strDepartmentID.Trim() != null)
{
SysDeptDA sysDeptDA = new SysDeptDA();
string strDeptID = sysDeptDA.GetDepartmentIdByUser(strUserID);
if (strDeptID.Trim().Equals(strDepartmentID) && strDepartmentID != "")
{
WorkFlowDoEntity initWorkFlowDoEntity = new WorkFlowDoEntity();
initWorkFlowDoEntity.GID = Guid.NewGuid().ToString();
initWorkFlowDoEntity.WorkFlowID = workFlowEntity.GID;
initWorkFlowDoEntity.StepID = step.GID;
initWorkFlowDoEntity.StepNO = step.StepNO;
initWorkFlowDoEntity.Auditor = step.Auditor == null ? step.DefaultAuditor : step.Auditor;
initWorkFlowDoEntity.FeeID = "";
initWorkFlowDoEntity.BSNO = "";
initWorkFlowDoEntity.FeeStatus = 0;
initWorkFlowDoEntity.DoQuerySql = "";
initWorkFlowDoEntity.BillNO = strGid;
initWorkFlowDoEntity.IsFinish = false;
initWorkFlowDoEntity.Applicant = strUserID;
workFlowDoEntities.Add(initWorkFlowDoEntity);
}
}
}
else
{
WorkFlowDoEntity initWorkFlowDoEntity = new WorkFlowDoEntity();
initWorkFlowDoEntity.GID = Guid.NewGuid().ToString();
initWorkFlowDoEntity.WorkFlowID = workFlowEntity.GID;
initWorkFlowDoEntity.StepID = step.GID;
initWorkFlowDoEntity.StepNO = step.StepNO;
initWorkFlowDoEntity.Auditor = step.Auditor == null ? step.DefaultAuditor : step.Auditor;
initWorkFlowDoEntity.FeeID = "";
initWorkFlowDoEntity.BSNO = "";
initWorkFlowDoEntity.FeeStatus = 0;
initWorkFlowDoEntity.DoQuerySql = "";
initWorkFlowDoEntity.BillNO = strGid;
initWorkFlowDoEntity.IsFinish = false;
initWorkFlowDoEntity.Applicant = strUserID;
workFlowDoEntities.Add(initWorkFlowDoEntity);
}
}
}
iWorkFlowStatus = workFlowDoDA.InsertWorkFlowDo(workFlowDoEntities);
if (iWorkFlowStatus == 1)
{
int iTempStatus = feeDA.UpdateFeeAuditStatus(strGid, 1);
if (iTempStatus != 1)
{
iResult = -5;//更新费用状态失败
}
#region 注释
//else
//{
// //状态完成后发送通知消息
// IList messageEntities = new List();
// MessageDA messageDA = new MessageDA();
// foreach (WorkFlowDoEntity workFlowDo in workFlowDoEntities)
// {
// MessageEntity messageEntity = new MessageEntity();
// messageEntity.GID = Guid.NewGuid().ToString();
// messageEntity.Name = "FeeAudit";
// messageEntity.Description = "应收应付审核通知";
// messageEntity.IsRead = false;
// messageEntity.ReadCount = 0;
// messageEntity.MessageContent = strShowName + " 提交 " + (feeEntity.FeeType == 1 ? "应收费用" : "应付费用") + "[" + feeEntity.FeeName + "]费用 应收应付审核 ";
// messageEntity.TaskID = workFlowDo.BillNO;
// messageEntity.Receiver = workFlowDo.Auditor;
// messageEntity.TaskUrl = "auditprocess/feeaudit.aspx";
// messageEntity.Type = messageDA.GetMessageType(MessageType.FEEAUDIT);
// messageEntities.Add(messageEntity);
// }
// if (messageEntities.Count > 0)
// {
// messageDA.CreateMessage(MessageType.FEEAUDIT, messageEntities);
// }
//}
#endregion
}
}
}
}
}
}
else
{
iResult = -1;
}
}
#endregion
return iResult;
}
///
/// 更改单复制委托信息
///
/// 委托业务编号
/// 插入状态
private string ExcuteModifyByCopy(string tempBSNO)
{
TopSeaeEntity topSeaeEntity;
int iResult = 0;
SeaExportInfoDA seaExportDA = new SeaExportInfoDA();
topSeaeEntity = seaExportDA.GetID(tempBSNO);
if (topSeaeEntity.BSNO != null)
{
IList topSeaeEntities = new List();
topSeaeEntities.Add(topSeaeEntity);
//复制委托信息
TopSeaeEntity newTopSeaeEntity = seaExportDA.GetID(tempBSNO);
//产生新的委托业务编号
newTopSeaeEntity.BSNO = "topseae" + Guid.NewGuid().ToString().Replace("-", "");
topSeaeEntities.Add(newTopSeaeEntity);
AmendDA amendDA = new AmendDA();
IList amendEntities = new List();
for(int i = 0;i 0)
{
//复制一条记录到
iResult = seaExportDA.InserInfo(newTopSeaeEntity);
}
}
return iResult.ToString();
}
#region 注释
//public string ExcuteApplyModifyFee(string tempFeeGID,string tempBSNO)
//{
// TopSeaeEntity topSeaeEntity;
// int iResult = 0;
// SeaExportInfoDA seaExportDA = new SeaExportInfoDA();
// topSeaeEntity = seaExportDA.GetID(tempBSNO);
// if (topSeaeEntity.BSNO != null)
// {
// if (topSeaeEntity.FEESTATUS.Trim().Equals("未锁定"))
// {
// FeeModifyDA feeModifyDA = new FeeModifyDA();
// IList feeModifyEntities = new List();
// }
// }
//}
//public string ExcuteApplyDeleteFee()
//{
// TopSeaeEntity topSeaeEntity;
// int iResult = 0;
// SeaExportInfoDA seaExportDA = new SeaExportInfoDA();
// topSeaeEntity = seaExportDA.GetID(tempBSNO);
// if (topSeaeEntity.BSNO != null)
// {
// if (topSeaeEntity.FEESTATUS.Trim().Equals("未锁定"))
// {
// FeeModifyDA feeModifyDA = new FeeModifyDA();
// IList
// }
// }
//}
#endregion
}
}