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/Shipping/FeeModify.aspx.cs

981 lines
52 KiB
C#

3 years ago
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 System.Collections.Generic;
using JsonHelper;
using DSWeb.Models;
using DSWeb.EntityDA;
using DSWeb.WorkFlow;
namespace DSWeb.Shipping
{
public partial class FeeModify : System.Web.UI.Page
{
private string strFeeID;//费用GID
private string strBSNO;//委托GID
private string strOldVal;
private string strNewVal;
private int iType;
private int iHandle;//标识处理类型 值1表示提交费用更改申请 值2表示审核费用 值3表示费用历史查询
private string strUserID;
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["oplb"] != null)
{
stroplb =Request.QueryString["oplb"].ToString();
this.h_oplb.Value = stroplb;
}
if (Request.QueryString["type"] != null)
{
iType = int.Parse(Request.QueryString["type"].ToString());
this.h_type.Value = iType.ToString();
}
if (Request.QueryString["handle"] != null)
{
iHandle = int.Parse(Request.QueryString["handle"].ToString());//标识处理类型 值1表示提交费用更改申请 值2表示审核费用
this.h_handle.Value = iHandle.ToString();
}
else
{
iHandle = 0;
}
if (Request.QueryString["id"] != null)
{
strFeeID = Request.QueryString["id"].ToString().Trim();
this.h_fee.Value = strFeeID;
}
if (Request.QueryString["bsno"] != null)
{
strBSNO = Request.QueryString["bsno"].ToString().Trim();
this.h_bsno.Value = strBSNO;
}
if (iHandle != 0)
{
GetFeeModifyLoadType(iHandle);
}
if (!this.h_do.Value.Trim().Equals(""))
{
int iDoType = int.Parse(this.h_do.Value.Trim());
//费用申请更改
if (iDoType == 1)
{
#region 费用申请更改
if (!this.h_old.Value.Trim().Equals("") && !this.h_new.Value.Trim().Equals(""))
{
PostFeeModify();//提交费用更改申请
}
#endregion
}
else if (iDoType == 2)//审核通过
{
AuditPassFeeModify(strFeeID, strUserID);
}
else if (iDoType == 3)//审核驳回
{
AuditRejectFeeModify(strFeeID, strUserID);
}
}
}
private void GetFeeModifyLoadType(int tempHandleType)
{
switch (tempHandleType)
{
case 1://申请修改
dvPostModify.Style["display"] = "";//提交申请按钮可见
h_applystate.Value = "0";//提交审核状态 值0表示首次申请 值1表示已经提交申请
this.sel_check.Disabled = true;
this.txt_reason.Disabled = false;
break;
case 2://用户查询申请历史记录
h_applystate.Value = "1";
break;
case 3://审核人查看申请历史记录
dvAudit.Style["display"] = "";//审核按钮可见
h_applystate.Value = "1";
this.txt_reason.Disabled = false;
break;
default:
break;
}
}
#region
//#region 获取加载页面类型,根据费用的FEESTATUS状态判断当前加载页面属于编辑还是查看
///// <summary>
///// 获取加载页面类型,根据费用的FEESTATUS状态判断当前加载页面属于编辑还是查看
///// </summary>
///// <param name="tempFeeID">费用GID</param>
//private void LoadingFeeModifyType(string tempFeeID)
//{
// FeeDA feeDA = new FeeDA();
// FeeEntity feeEntity = new FeeEntity();
// feeEntity = feeDA.GetFeeByID(tempFeeID);
// if (feeEntity != null)
// {
// if (feeEntity.GID != null)
// {
// FeeStatusType feeStatusType = feeDA.GetCurrentStatus(feeEntity.FeeStatus);
// switch (feeStatusType)
// {
// case FeeStatusType.MODIFYAPPLY://加载页面时,先判断是否是申请修改和申请删除,如果是加载新的申请数据,历史申请信息不显示
// case FeeStatusType.DELETEAPPLY:
// case FeeStatusType.POSTAUDIT:
// if (iHandle == 1)//表示弹出父窗口来自应收应付费用
// {
// this.dvPostModify.Style["display"] = "";
// this.txt_reason.Disabled = false;
// h_loadtype.Value = "1";//表示加载类型属于编辑
// }
// else if (iHandle == 2)//表示弹出父窗口来自应收应付费用审核页面
// {
// h_loadtype.Value = "2";
// this.dvAudit.Style["display"] = "";
// FeeModifyDA feeModifyDA = new FeeModifyDA();
// IList<FeeModifyEntity> feeModifyEntities = new List<FeeModifyEntity>();
// feeModifyEntities = feeModifyDA.GetFeeModifyHistory(tempFeeID);
// string strReason = "";
// foreach (FeeModifyEntity modifyEntity in feeModifyEntities)
// {
// strReason = modifyEntity.Reason.Trim();
// break;
// }
// this.txt_reason.Value = strReason;
// this.txt_reason.Disabled = false;
// }
// else if (iHandle == 3)
// {
// h_loadtype.Value = "2";
// this.dvAudit.Style["display"] = "none";
// this.dvPostModify.Style["display"] = "none";
// FeeModifyDA feeModifyDA = new FeeModifyDA();
// IList<FeeModifyEntity> feeModifyEntities = new List<FeeModifyEntity>();
// feeModifyEntities = feeModifyDA.GetFeeModifyHistory(tempFeeID);
// string strReason = "";
// foreach (FeeModifyEntity modifyEntity in feeModifyEntities)
// {
// strReason = modifyEntity.Reason.Trim();
// break;
// }
// this.txt_reason.Value = strReason;
// }
// break;
// case FeeStatusType.AUDITPASS:
// if (iHandle == 1)//表示弹出父窗口来自应收应付费用
// {
// this.dvPostModify.Style["display"] = "";
// this.txt_reason.Disabled = false;
// h_loadtype.Value = "1";//表示加载类型属于编辑
// }
// else if (iHandle == 2)//表示弹出父窗口来自应收应付费用审核页面
// {
// h_loadtype.Value = "2";
// this.dvAudit.Style["display"] = "";
// FeeModifyDA feeModifyDA = new FeeModifyDA();
// IList<FeeModifyEntity> feeModifyEntities = new List<FeeModifyEntity>();
// feeModifyEntities = feeModifyDA.GetFeeModifyHistory(tempFeeID);
// string strReason = "";
// foreach (FeeModifyEntity modifyEntity in feeModifyEntities)
// {
// strReason = modifyEntity.Reason.Trim();
// break;
// }
// this.txt_reason.Value = strReason;
// this.txt_reason.Disabled = false;
// }
// else if (iHandle == 3)
// {
// h_loadtype.Value = "2";
// this.dvAudit.Style["display"] = "none";
// this.dvPostModify.Style["display"] = "none";
// FeeModifyDA feeModifyDA = new FeeModifyDA();
// IList<FeeModifyEntity> feeModifyEntities = new List<FeeModifyEntity>();
// feeModifyEntities = feeModifyDA.GetFeeModifyHistory(tempFeeID);
// string strReason = "";
// foreach (FeeModifyEntity modifyEntity in feeModifyEntities)
// {
// strReason = modifyEntity.Reason.Trim();
// break;
// }
// this.txt_reason.Value = strReason;
// }
// break;
// break;
// case FeeStatusType.REJECTAPPLY://申请更改驳回
// case FeeStatusType.REJECTAUDIT://审核驳回
// if (iHandle == 1)//表示弹出父窗口来自应收应付费用
// {
// this.dvPostModify.Style["display"] = "";
// this.txt_reason.Disabled = false;
// h_loadtype.Value = "1";//表示加载类型属于编辑
// }
// else if (iHandle == 2)//表示弹出父窗口来自应收应付费用审核页面
// {
// h_loadtype.Value = "2";
// this.dvAudit.Style["display"] = "";
// }
// else if (iHandle == 3)
// {
// h_loadtype.Value = "2";
// this.dvAudit.Style["display"] = "none";
// this.dvPostModify.Style["display"] = "none";
// FeeModifyDA feeModifyDA = new FeeModifyDA();
// IList<FeeModifyEntity> feeModifyEntities = new List<FeeModifyEntity>();
// feeModifyEntities = feeModifyDA.GetFeeModifyHistory(tempFeeID);
// string strReason = "";
// foreach (FeeModifyEntity modifyEntity in feeModifyEntities)
// {
// strReason = modifyEntity.Reason.Trim();
// break;
// }
// this.txt_reason.Value = strReason;
// }
// break;
// default:
// break;
// }
// }
// }
//}
//#endregion
#endregion
/// <summary>
/// 提交费用申请
/// </summary>
private void PostFeeModify()
{
int iResult = 0;
strOldVal = this.h_old.Value.Trim();
strNewVal = this.h_new.Value.Trim();
string strGroupID = Guid.NewGuid().ToString();
IList<FeeModifyEntity> feeModifyEntities = new List<FeeModifyEntity>();
JsonFeeGroupEntity feeGroupOldEntity = GetPostEntity(strOldVal);
List<JsonFeeEntity> feeOldEntities = new List<JsonFeeEntity>();
feeOldEntities = feeGroupOldEntity.JsonFeeEntities;
FeeModifyEntity feeModifyOldEntity = new FeeModifyEntity();
feeModifyOldEntity.GID = Guid.NewGuid().ToString();
feeModifyOldEntity.FeeID = feeOldEntities[0].fee1;
feeModifyOldEntity.FeeName = feeOldEntities[0].fee3.Trim().ToLower().Equals("null") ? "" : feeOldEntities[0].fee3;
feeModifyOldEntity.Type = int.Parse(this.h_type.Value.Trim());
feeModifyOldEntity.ApplyType = 1;
feeModifyOldEntity.Reason = this.h_reason.Value.Trim();
feeModifyOldEntity.BSNO = this.h_bsno.Value.Trim();
feeModifyOldEntity.CustomerName = feeOldEntities[0].fee4.Trim().ToLower().Equals("null") ? "" : feeOldEntities[0].fee4;
feeModifyOldEntity.Unit = feeOldEntities[0].fee5.Trim().ToLower().Equals("null") ? "" : feeOldEntities[0].fee5;
feeModifyOldEntity.UnitPrice = feeOldEntities[0].fee6;
feeModifyOldEntity.Quantity = feeOldEntities[0].fee7;
feeModifyOldEntity.Amount = feeOldEntities[0].fee9;
feeModifyOldEntity.Currency = feeOldEntities[0].fee10;
feeModifyOldEntity.FRT = feeOldEntities[0].fee12;
feeModifyOldEntity.CommissionRate = feeOldEntities[0].fee8;
feeModifyOldEntity.ExchangeRate = feeOldEntities[0].fee11;
feeModifyOldEntity.IsAdvancePay = feeOldEntities[0].fee14;
feeModifyOldEntity.ApplyUser = strUserID;
feeModifyOldEntity.ApplyStatus = 1;
feeModifyOldEntity.Remark = feeOldEntities[0].fee13.Trim().ToLower().Equals("null") ? "" : feeOldEntities[0].fee13;
feeModifyOldEntity.GroupID = strGroupID;
feeModifyEntities.Add(feeModifyOldEntity);
JsonFeeGroupEntity feeGroupNewEntity = GetPostEntity(strNewVal);
List<JsonFeeEntity> feeNewEntities = new List<JsonFeeEntity>();
feeNewEntities = feeGroupNewEntity.JsonFeeEntities;
FeeModifyEntity feeModifyNewEntity = new FeeModifyEntity();
feeModifyNewEntity.GID = Guid.NewGuid().ToString();
feeModifyNewEntity.FeeID = feeNewEntities[0].fee1;
feeModifyNewEntity.FeeName = feeNewEntities[0].fee3.Trim().ToLower().Equals("null") ? "" : feeNewEntities[0].fee3;
feeModifyNewEntity.Type = int.Parse(this.h_type.Value.Trim());
feeModifyNewEntity.ApplyType = 2;
feeModifyNewEntity.Reason = this.h_reason.Value.Trim();
feeModifyNewEntity.BSNO = this.h_bsno.Value.Trim();
feeModifyNewEntity.CustomerName = feeNewEntities[0].fee4.Trim().ToLower().Equals("null") ? "" : feeNewEntities[0].fee4;
feeModifyNewEntity.Unit = feeNewEntities[0].fee5.Trim().ToLower().Equals("null") ? "" : feeNewEntities[0].fee5;
feeModifyNewEntity.UnitPrice = feeNewEntities[0].fee6;
feeModifyNewEntity.Quantity = feeNewEntities[0].fee7;
feeModifyNewEntity.Amount = feeNewEntities[0].fee9;
feeModifyNewEntity.Currency = feeNewEntities[0].fee10;
feeModifyNewEntity.FRT = feeNewEntities[0].fee12;
feeModifyNewEntity.CommissionRate = feeNewEntities[0].fee8;
feeModifyNewEntity.ExchangeRate = feeNewEntities[0].fee11;
feeModifyNewEntity.IsAdvancePay = feeNewEntities[0].fee14;
feeModifyNewEntity.ApplyUser = strUserID;
feeModifyNewEntity.ApplyStatus = 1;
feeModifyNewEntity.Remark = feeNewEntities[0].fee13.Trim().ToLower().Equals("null") ? "" : feeNewEntities[0].fee13;
feeModifyNewEntity.GroupID = strGroupID;
feeModifyEntities.Add(feeModifyNewEntity);
FeeModifyDA feeModifyDA = new FeeModifyDA();
iResult = feeModifyDA.InsertApplyModify(feeModifyEntities);
IList<MessageEntity> messageEntities = new List<MessageEntity>();
MessageDA messageDA = new MessageDA();
if (iResult == 1)
{
#region 工作流
//工作流
WorkFlowHelper workFlowHelper = new WorkFlowHelper();
//WorkFlowEntity workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FEEMODIFYAUDIT,strCompanyID);
WorkFlowEntity workFlowEntity = new WorkFlowEntity();
if (stroplb == "op_Seae")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FEEMODIFYAUDIT, strCompanyID);
}
else if (stroplb == "op_Seai")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.SeaiFEEMODIFYAUDIT, strCompanyID);
}
else if (stroplb == "wms_out")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.WmsOutFEEMODIFYAUDIT, strCompanyID);
}
else if (stroplb == "op_Sean")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.SEANFEEMODIFYAUDIT,strCompanyID);
}
if (workFlowEntity != null)
{
WorkFlowDoEntity workFlowDoEntity = null;
WorkFlowDoDA workFlowDoDA = new WorkFlowDoDA();
workFlowDoEntity = workFlowDoDA.GetSigleWorkFlowDoByBillNO(workFlowEntity.GID, feeModifyOldEntity.FeeID);
IList<WorkFlowDoEntity> workFlowDoEntities = new List<WorkFlowDoEntity>();
if (workFlowDoEntity == null)
{
if (workFlowDoEntity.GID == null)
{
//遍历所有工作流下步骤,获取第一步骤GID信息
foreach (WorkFlowStepEntity step in workFlowEntity.WorkFlowSteps)
{
if (step.StepNO == 1)
{
WorkFlowDoEntity modifyWorkFlowDoEntity = new WorkFlowDoEntity();
modifyWorkFlowDoEntity.GID = Guid.NewGuid().ToString();
modifyWorkFlowDoEntity.WorkFlowID = workFlowEntity.GID;
modifyWorkFlowDoEntity.StepID = step.GID;
modifyWorkFlowDoEntity.StepNO = step.StepNO;
modifyWorkFlowDoEntity.Auditor = step.Auditor;
modifyWorkFlowDoEntity.BillNO = feeModifyOldEntity.FeeID;
modifyWorkFlowDoEntity.IsFinish = false;
modifyWorkFlowDoEntity.Applicant = strUserID;
workFlowDoEntities.Add(modifyWorkFlowDoEntity);
MessageEntity messageEntity = new MessageEntity();
messageEntity.GID = Guid.NewGuid().ToString();
messageEntity.Name = "FeeModify";
//messageEntity.Description = "费用申请修改审核通知";
messageEntity.IsRead = false;
messageEntity.ReadCount = 0;
//messageEntity.MessageContent = strShowName + " 提交 [应收应付费用申请修改] 待审核信息";
messageEntity.TaskID = feeModifyOldEntity.FeeID;
messageEntity.Receiver = step.Auditor;
messageEntity.TaskUrl = messageEntity.TaskUrl = "auditprocess/feeaudit.aspx?oplb=" + stroplb;
messageEntity.Type = messageDA.GetMessageType(MessageType.FEEMODIFY);
messageEntity.RecvType = 2;//申请审核类型
if (stroplb == "op_Seae")
{
messageEntity.Description = "费用申请修改审核通知";
messageEntity.MessageContent = strShowName + " 提交 [海运出口应收应付费用申请修改] 待审核信息";
}
else if (stroplb == "op_Sean")
{
messageEntity.Description = "费用申请修改审核通知";
messageEntity.MessageContent = strShowName+ " 提交 [内贸海运应收应付费用申请修改] 带审核信息";
}
else if (stroplb == "op_Seai")
{
messageEntity.Description = "费用申请修改审核通知";
messageEntity.MessageContent = strShowName + " 提交 [海运进口应收应付费用申请修改] 待审核信息";
}
else if (stroplb == "wms_out")
{
messageEntity.Description = "费用申请修改审核通知";
messageEntity.MessageContent = strShowName + " 提交 [仓储费申请修改] 待审核信息";
}
messageEntities.Add(messageEntity);
}
}
if (workFlowDoEntities.Count > 0)
{
int iState = workFlowDoDA.InsertWorkFlowDo(workFlowDoEntities);
if (iState == 1)
{
if (messageEntities.Count > 0)
{
messageDA.CreateMessage(MessageType.FEEMODIFY, messageEntities);
}
}
}
//自动驳回所有应收应付费用流程步骤
ExcuteCancelWorkFlow(feeModifyOldEntity.FeeID);
FeeDA feeDA = new FeeDA();
//更新费用状态标识 费用已经进入工作流,状态审核中
feeDA.UpdateFeeAuditStatus(feeModifyOldEntity.FeeID, 1);
//feePaySettleApplicationDA.UpdatePayApplicationStatus(strBillNO, 3);
}
}
else
{
if (workFlowDoEntity.GID == null)
{
//遍历所有工作流下步骤,获取第一步骤GID信息
foreach (WorkFlowStepEntity step in workFlowEntity.WorkFlowSteps)
{
if (step.StepNO == 1)
{
WorkFlowDoEntity modifyWorkFlowDoEntity = new WorkFlowDoEntity();
modifyWorkFlowDoEntity.GID = Guid.NewGuid().ToString();
modifyWorkFlowDoEntity.WorkFlowID = workFlowEntity.GID;
modifyWorkFlowDoEntity.StepID = step.GID;
modifyWorkFlowDoEntity.StepNO = step.StepNO;
modifyWorkFlowDoEntity.Auditor = step.Auditor == null ? step.DefaultAuditor : step.Auditor;
modifyWorkFlowDoEntity.FeeID = "";
modifyWorkFlowDoEntity.BSNO = "";
modifyWorkFlowDoEntity.FeeStatus = 0;
modifyWorkFlowDoEntity.DoQuerySql = "";
modifyWorkFlowDoEntity.BillNO = feeModifyOldEntity.FeeID;
modifyWorkFlowDoEntity.IsFinish = false;
modifyWorkFlowDoEntity.Applicant = strUserID;
workFlowDoEntities.Add(modifyWorkFlowDoEntity);
MessageEntity messageEntity = new MessageEntity();
messageEntity.GID = Guid.NewGuid().ToString();
messageEntity.Name = "FeeModify";
//messageEntity.Description = "费用申请修改审核通知";
messageEntity.IsRead = false;
messageEntity.ReadCount = 0;
//messageEntity.MessageContent = strShowName + " 提交 [应收应付费用申请修改] 待审核信息";
messageEntity.TaskID = feeModifyOldEntity.FeeID;
messageEntity.Receiver = step.Auditor;
messageEntity.TaskUrl = messageEntity.TaskUrl = "auditprocess/feeaudit.aspx?oplb=" + stroplb;
messageEntity.Type = messageDA.GetMessageType(MessageType.FEEMODIFY);
messageEntity.RecvType = 2;//申请审核类型
if (stroplb == "op_Seae")
{
messageEntity.Description = "费用申请修改审核通知";
messageEntity.MessageContent = strShowName + " 提交 [海运出口应收应付费用申请修改] 待审核信息";
}
else if (stroplb == "op_Seai")
{
messageEntity.Description = "费用申请修改审核通知";
messageEntity.MessageContent = strShowName + " 提交 [海运进口应收应付费用申请修改] 待审核信息";
}
else if (stroplb == "op_Sean")
{
messageEntity.Description = "费用申请更改审核通知";
messageEntity.MessageContent = strShowName+ " 提示 [内贸海运应收应付费用申请修改] 待审核信息";
}
else if (stroplb == "wms_out")
{
messageEntity.Description = "费用申请修改审核通知";
messageEntity.MessageContent = strShowName + " 提交 [仓储费申请修改] 待审核信息";
}
messageEntities.Add(messageEntity);
}
}
//自动驳回所有应收应付费用流程步骤
ExcuteCancelWorkFlow(feeModifyOldEntity.FeeID);
if (workFlowDoEntities.Count > 0)
{
int iState = workFlowDoDA.InsertWorkFlowDo(workFlowDoEntities);
if (iState == 1)
{
if (messageEntities.Count > 0)
{
messageDA.CreateMessage(MessageType.FEEMODIFY, messageEntities);
}
}
}
FeeDA feeDA = new FeeDA();
//更新费用状态标识 费用已经进入工作流,状态审核中
feeDA.UpdateFeeAuditStatus(feeModifyOldEntity.FeeID, 1);
//feePaySettleApplicationDA.UpdatePayApplicationStatus(strBillNO, 3);
}
}
}
#endregion
this.btn_save.Disabled = true;
this.txt_reason.Disabled = true;
this.btn_cancel.Value = "退出";
this.h_applystate.Value = "1";
}
}
#region 取消应收应付费用审核流程
/// <summary>
/// 取消应收应付费用审核流程,当用户提交完费用审核后,由于需要再更改费用信息提出费用申请则应收应付审核工作流自动驳回,将费用更改审核进入更改审核流程
/// </summary>
/// <param name="tempFeeID">费用GID</param>
/// <returns>值1 表示执行成功 值不等于1表示执行失败</returns>
private int ExcuteCancelWorkFlow(string tempFeeID)
{
int iResult = 0;
FeeDoDA feeDoDA = new FeeDoDA();
IList<FeeDoEntity> feeDoEntities = new List<FeeDoEntity>();
feeDoEntities = feeDoDA.GetFeeDoByBillNO(tempFeeID);
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);
}
//如果工作流信息存在
if (workFlowEntity != null)
{
IList<WorkFlowDoEntity> workFlowDoEntities = new List<WorkFlowDoEntity>();
WorkFlowDoDA workFlowDoDA = new WorkFlowDoDA();
//先查看是否当前付费申请已经进入工作流
workFlowDoEntities = workFlowDoDA.GetAllWorkFlowDoByBillNO(workFlowEntity.GID, tempFeeID);
if (workFlowDoEntities.Count > 0)
{
int iCount = 0;
//如果付费申请已经进入工作流,先判断当前打开付费审核页面操作人是否是工作流内相关审核人,如果是则
foreach (WorkFlowDoEntity workFlowDoEntity in workFlowDoEntities)
{
workFlowDoEntity.IsFinish = true;
workFlowDoEntity.IsDelete = true;
workFlowDoEntity.DeleteStep = workFlowDoEntity.StepID;
workFlowDoEntity.DeleteOperator = strUserID;
workFlowDoEntity.DeleteStepNO = workFlowDoEntity.StepNO;
workFlowDoEntity.IsFinish = true;
workFlowDoEntity.Applicant = strUserID;
int iTempRejectStatus ;//= workFlowHelper.DoWorkFlowReject(workFlowDoEntity,WorkFlowType.FEEAUDIT,feeDoEntities,tempFeeID,strCompanyID);
if (stroplb == "op_Seae")
{
iTempRejectStatus = workFlowHelper.DoWorkFlowReject(workFlowDoEntity, WorkFlowType.FEEAUDIT, feeDoEntities, tempFeeID, strCompanyID);
}
else if (stroplb == "op_Seai")
{
iTempRejectStatus = workFlowHelper.DoWorkFlowReject(workFlowDoEntity, WorkFlowType.SeaiFEEAUDIT, feeDoEntities, tempFeeID, strCompanyID);
}
else if (stroplb == "op_Sean")
{
iTempRejectStatus = workFlowHelper.DoWorkFlowReject(workFlowDoEntity,WorkFlowType.FeeOpSeanRecvPayAudit,feeDoEntities,tempFeeID,strCompanyID);
}
break;
#region
////查看当前操作人是否为审核人
//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);
// if (iTempRejectStatus == 1)
// {
// iResult = 1;
// }
// else
// {
// iResult = -4;//工作流审核驳回失败
// }
//}
#endregion
}
if (iCount == 0)
{
iResult = -3;//没有权利审核付费
}
}
}
return iResult;
}
#endregion
#region 驳回费用更改审核
/// <summary>
/// 驳回费用更改审核
/// </summary>
/// <param name="tempFeeID">费用GID</param>
/// <param name="tempUserID">用户GID</param>
/// <returns></returns>
private void AuditRejectFeeModify(string tempFeeID, string tempUserID)
{
int iResult = 0;
FeeDoDA feeDoDA = new FeeDoDA();
IList<FeeDoEntity> feeDoEntities = new List<FeeDoEntity>();
feeDoEntities = feeDoDA.GetFeeDoByBillNO(tempFeeID);
//工作流
WorkFlowHelper workFlowHelper = new WorkFlowHelper();
//查找付费工作流信息
//WorkFlowEntity workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FEEMODIFYAUDIT,strCompanyID);
WorkFlowEntity workFlowEntity = new WorkFlowEntity();
if (stroplb == "op_Seae")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FEEMODIFYAUDIT, strCompanyID);
}
else if (stroplb == "op_Seai")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.SeaiFEEMODIFYAUDIT, strCompanyID);
}
else if (stroplb == "op_Sean")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.SEANFEEMODIFYAUDIT, strCompanyID);
}
//如果工作流信息存在
if (workFlowEntity != null)
{
IList<WorkFlowDoEntity> workFlowDoEntities = new List<WorkFlowDoEntity>();
WorkFlowDoDA workFlowDoDA = new WorkFlowDoDA();
//先查看是否当前付费申请已经进入工作流
workFlowDoEntities = workFlowDoDA.GetAllWorkFlowDoByBillNO(workFlowEntity.GID, strFeeID);
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;
workFlowDoEntity.Applicant = strUserID;
int itempStatus=0;// = workFlowHelper.DoWorkFlowReject(workFlowDoEntity, WorkFlowType.FEEMODIFYAUDIT, feeDoEntities, tempFeeID,strCompanyID);
if (stroplb == "op_Seae")
{
itempStatus = workFlowHelper.DoWorkFlowReject(workFlowDoEntity, WorkFlowType.FEEMODIFYAUDIT, feeDoEntities, tempFeeID, strCompanyID);
}
else if (stroplb == "op_Seai")
{
itempStatus = workFlowHelper.DoWorkFlowReject(workFlowDoEntity, WorkFlowType.SeaiFEEMODIFYAUDIT, feeDoEntities, tempFeeID, strCompanyID);
}
else if (stroplb == "op_Sean")
{
itempStatus = workFlowHelper.DoWorkFlowReject(workFlowDoEntity,WorkFlowType.SEANFEEMODIFYAUDIT,feeDoEntities,tempFeeID,strCompanyID);
}
if (itempStatus == 1)
{
//费用更改申请驳回操作
FeeModifyDA feeModifyDA = new FeeModifyDA();
int iModifyStatus = feeModifyDA.ApplyModifyReject(tempFeeID, tempUserID);
if (iModifyStatus == 1)
{
iResult = 1;//完成操作
}
else
{
iResult = -3;//费用更改申请操作失败
}
}
else
{
iResult = -2;//工作流审核步骤驳回失败
}
}
}
}
}
if (iResult == 1)
{
this.btn_auditpass.Disabled = true;
this.btn_auditreject.Disabled = true;
this.txt_reason.Disabled = true;
}
this.h_do.Value = "0";
}
#endregion
#region 批准费用更改审核
/// <summary>
/// 批准费用更改审核
/// </summary>
/// <param name="tempFeeID">费用GID</param>
/// <param name="tempUserID">用户GID</param>
/// <returns></returns>
private void AuditPassFeeModify(string tempFeeID, string tempUserID)
{
int iResult = 0;
int iMessageState = 0;
IList<MessageEntity> messageEntities = new List<MessageEntity>();
MessageDA messageDA = new MessageDA();
//工作流
WorkFlowHelper workFlowHelper = new WorkFlowHelper();
//查找付费工作流信息
//WorkFlowEntity workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FEEMODIFYAUDIT,strCompanyID);
WorkFlowEntity workFlowEntity = new WorkFlowEntity();
if (stroplb == "op_Seae")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FEEMODIFYAUDIT, strCompanyID);
}
else if (stroplb == "op_Seai")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.SeaiFEEMODIFYAUDIT, strCompanyID);
}
else if (stroplb == "op_Sean")
{
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.SEANFEEMODIFYAUDIT, strCompanyID);
}
//如果工作流信息存在
if (workFlowEntity != null)
{
IList<WorkFlowDoEntity> workFlowDoEntities = new List<WorkFlowDoEntity>();
WorkFlowDoDA workFlowDoDA = new WorkFlowDoDA();
//先查看是否当前付费申请已经进入工作流
workFlowDoEntities = workFlowDoDA.GetAllWorkFlowDoByBillNO(workFlowEntity.GID, tempFeeID);
if (workFlowDoEntities.Count > 0)
{
//如果付费申请已经进入工作流,先判断当前打开付费审核页面操作人是否是工作流内相关审核人,如果是则
foreach (WorkFlowDoEntity workFlowDoEntity in workFlowDoEntities)
{
//查看当前操作人是否为审核人
if (workFlowDoEntity.Auditor == strUserID)
{
//查看当前审核人所处的步骤是否已经完成
if (!workFlowDoEntity.IsFinish)
{
//iResult等于1表示工作执行操作成功
iResult = workFlowHelper.DoWorkFlowStep(workFlowDoEntity, workFlowEntity);
if (iResult == 1)
{
//查看审核步骤是否是最后一步,如果是则最终置费用审核状态位
IList<WorkFlowStepEntity> WorkFlowStepEntities = new List<WorkFlowStepEntity>();
foreach (WorkFlowStepEntity stepEntity in workFlowEntity.WorkFlowSteps)
{
if (stepEntity.StepNO == workFlowDoEntity.StepNO)
{
//如果是最后一步
if (stepEntity.IsLast)
{
//最后一步审核完成,审核通过将申请新值更新到费用
FeeModifyDA feeModifyDA = new FeeModifyDA();
int tempFeeResult = feeModifyDA.ApplyModifyPass(strFeeID, strUserID);
if (tempFeeResult != 1)
{
iResult = -5;//执行步骤完成,费用修改失败
}
else
{
if (iMessageState == 0)
{
MessageEntity messageEntity = new MessageEntity();
messageEntity.GID = Guid.NewGuid().ToString();
messageEntity.Name = "FeeModify";
messageEntity.Description = "费用申请修改审核通知";
messageEntity.IsRead = false;
messageEntity.ReadCount = 0;
messageEntity.MessageContent = strShowName + " 已经批准通过 [应收应付费用申请修改] 申请,所有审核已完成 ";
messageEntity.TaskID = tempFeeID;
messageEntity.Receiver = workFlowDoEntity.Applicant;
messageEntity.TaskUrl = messageEntity.TaskUrl = "shipping/orderlist.aspx?oplb=" + stroplb;
messageEntity.Type = messageDA.GetMessageType(MessageType.FEEMODIFY);
messageEntities.Add(messageEntity);
//if (messageEntities.Count > 0)
//{
// messageDA.CreateMessage(MessageType.FEEMODIFY, messageEntities);
//}
iMessageState++;
}
}
}
else
{
IList<WorkFlowDoEntity> messageWorkFlowDoEntities = workFlowDoDA.GetWorkFlowDoAuditPassForMessage(workFlowEntity.GID, tempFeeID);
if (messageWorkFlowDoEntities.Count > 0)
{
foreach (WorkFlowDoEntity workFlowDo in messageWorkFlowDoEntities)
{
if (!workFlowDo.IsFinish)
{
MessageEntity messageEntity = new MessageEntity();
messageEntity.GID = Guid.NewGuid().ToString();
messageEntity.Name = "FeeModify";
messageEntity.Description = "费用申请修改审核通知";
messageEntity.IsRead = false;
messageEntity.ReadCount = 0;
messageEntity.MessageContent = strShowName + " 已经批准通过 [应收应付费用申请修改] 申请,现等待您的审核 ";
messageEntity.TaskID = workFlowDo.BillNO;
messageEntity.Receiver = workFlowDo.Auditor;
messageEntity.TaskUrl = messageEntity.TaskUrl = "auditprocess/feeaudit.aspx?oplb="+stroplb ;
messageEntity.Type = messageDA.GetMessageType(MessageType.FEEMODIFY);
messageEntity.RecvType = 2;//申请审核类型
messageEntities.Add(messageEntity);
if (iMessageState == 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.TaskUrl = "shipping/orderlist.aspx?oplb=" + stroplb;
applicantMessageEntity.Type = messageDA.GetMessageType(MessageType.FEEAUDIT);
applicantMessageEntity.RecvType = 3;//审核完成类型
messageEntities.Add(applicantMessageEntity);
iMessageState++;
}
}
}
}
//if (messageEntities.Count > 0)
//{
// messageDA.CreateMessage(MessageType.FEEMODIFY, messageEntities);
//}
}
}
}
}
else
{
iResult = -6;//步骤执行错误
}
break;
}
else if (workFlowDoEntity.IsFinish)
{
iResult = -4;//付费审核步骤已经完成,不能重复审核
}
}
else
{
iResult = -3;//没有权利审核付费
}
}
}
}
if (messageEntities.Count > 0)
{
messageDA.CreateMessage(MessageType.FEEMODIFY, messageEntities);
}
if (iResult == 1)
{
this.btn_auditpass.Disabled = true;
this.btn_auditreject.Disabled = true;
this.txt_reason.Disabled = true;
}
this.h_do.Value = "0";
}
#endregion
#region 获取费用客户保存的费用信息
/// <summary>
/// 获取费用客户保存的费用信息
/// </summary>
/// <param name="tempValue"></param>
/// <returns></returns>
public JsonFeeGroupEntity GetPostEntity(string tempValue)
{
JsonFeeGroupEntity feeGroupEntity = (JsonFeeGroupEntity)JSON.Instance.ToObject(tempValue);
return feeGroupEntity;
}
#endregion
}
}