凭证保存提示问题?急 急 急 急
金蝶云社区-jiedong_kingdee
jiedong_kingdee
0人赞赏了该文章 1,853次浏览 未经作者许可,禁止转载编辑于2014年04月15日 17:28:23

在表单插件中做了如下修改,[indent]if (error_show != null && error_show.Length > 0)
{[/indent][indent]// 如果用一下代码则不会提示这个赤字预警消息,
this.View.ShowMessage(error_show.ToString() + "\n" + "凭证号为:" + obj["VOUCHERGROUPNO"] + "的凭证保存成功。");[/indent][indent]//原来代码中 是一下代码,可以提示,但是 提示完毕之后 无法指定现金流量[/indent][indent]this.View.ShowWarnningMessage(error_show.ToString() + "\n" + "凭证号为:" + obj["VOUCHERGROUPNO"] + "的凭证保存成功。");
}[/indent][indent]如果用.ShowMessage 不会提示,但是会提示

[/indent][indent]如果用ShowWarnningMessage 则会提示,但是

如果点击确定之后 下面的现金流量就不会弹出了,要的结果是 提示一下这个科目赤字预警,然后【平台的现金流量不影响,求指导?[/indent][indent][code] ///
/// 修改保存提示信息
///

///
public override void AfterDoOperation(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.AfterDoOperationEventArgs e)
{
base.AfterDoOperation(e);

IOperationResult opResult = e.OperationResult;

DynamicObject obj = this.Model.DataObject as DynamicObject;
if (e.Operation.OperationId == 8)
{

// if (this.View.OpenParameter.GetCustomParameter("addvoucher") != null)
// {
DynamicObjectCollection col = obj["GL_VOUCHERENTRY"] as DynamicObjectCollection;
string billtype = null, SourceBillNo = null;
StringBuilder error_show = new StringBuilder();

if (col != null && col.Count > 0)
{

string accountbookid = obj["AccountBookID_Id"].ToString();

for (int jj = 0; jj < col.Count; jj++)
{
if (col[jj]["FACCOUNTID"] == null)
{
continue;
}

DynamicObject accountobj = col[jj]["FACCOUNTID"] as DynamicObject;

bool flag = Convert.ToBoolean(accountobj["FIsczyj"]);
string id = accountobj["Id"].ToString();

string detailid = col[jj]["DetailID_Id"].ToString();
string currencyid = col[jj]["FCURRENCYID_Id"].ToString();

// string czyj_sql = "select from" + " t_bd_account" + "_" + accountbookid + " where FACCOUNTBOOKID=" + accountbookid + " and FAccountID=" + id + " and FDetailID=" + detailid + " and FCurrencyID=" + currencyid + "";

StringBuilder chizyj_sql = new StringBuilder();

chizyj_sql.AppendFormat("select FEndBalance from ");
chizyj_sql.AppendFormat(" T_GL_BALANCE_" + accountbookid + " ");
chizyj_sql.AppendFormat(" where FYear*12+FPeriod in ( ");
chizyj_sql.AppendFormat(" select MAX(FYear*12+FPeriod) ");
chizyj_sql.AppendFormat(" from T_GL_BALANCE_" + accountbookid + "");
chizyj_sql.AppendFormat(" where FACCOUNTBOOKID=" + accountbookid + " and FAccountID=" + id + " and FDetailID=" + detailid + " and FCurrencyID=" + currencyid + " ");
chizyj_sql.AppendFormat(" ) and FAccountID=" + id + " and FDetailID=" + detailid + " and FCurrencyID=" + currencyid + " ");

DynamicObjectCollection zhizyj_col = DBUtils.ExecuteDynamicObject(this.Context, chizyj_sql.ToString());

//科目不是赤字预警 不需要校验
if (flag && zhizyj_col != null && zhizyj_col.Count > 0)
{

if (Convert.ToDecimal(zhizyj_col[0]["FEndBalance"]).CompareTo(Decimal.Zero) < 0)
{
error_show.AppendFormat("第:" + (jj + 1) + "行科目余额出现赤字!");
}
else
{
continue;
}

}
else
{
continue;
}

}

if (error_show != null && error_show.Length > 0)
{
this.View.ShowMessage(error_show.ToString() + "\n" + "凭证号为:" + obj["VOUCHERGROUPNO"] + "的凭证保存成功。");
}

for (int mm = 0; mm < col.Count; mm++)
{
if (col[mm]["FSourceBillNo"] != null && col[mm]["FSourceBillType"] != null)
{
SourceBillNo = col[mm]["FSourceBillNo"].ToString();
billtype = col[mm]["FSourceBillType"].ToString();
break;
}
else
{
continue;
}

}

}

// this.View.ShowMessage("凭证号为:" + obj["VOUCHERGROUPNO"] + "的凭证保存成功。");

if (SourceBillNo != null && billtype != null && SourceBillNo != "" && billtype != "")
{
if ("5c961381-5b0f-4136-9f65-9314a578e549" == billtype)
{
string sql = "update t_Hua_ReceiveBill set FCHECKBOX = 1 , FVoucherNum ='" + obj["VOUCHERGROUPNO"] + "',FVouCherId= '" + Convert.ToInt64(obj["Id"]) + "' where FBILLNO ='" + SourceBillNo + "' ";
DBUtils.Execute(this.Context, sql);
}
else if ("a986f0e9-b530-4b3a-acee-1400885a1038" == billtype)
{
DBUtils.Execute(this.Context, "UPDATE t_Hua_PayBill SET FCHECKBOX = 1 ,FVoucherNum ='" + obj["VOUCHERGROUPNO"] + "',FVouCherId= '" + Convert.ToInt64(obj["Id"]) + "' WHERE FBILLNO = '" + SourceBillNo + "' ");
}

this.View.ParentFormView.Refresh();
this.View.SendDynamicFormAction(this.View.ParentFormView);
}

this.View.OpenParameter.SetCustomParameter("addvoucher", null);

// }

if (opResult != null)
{
IEnumerable dys = opResult.SuccessDataEnity;

foreach (OperateResult resultItem in opResult.OperateResult)
{
DynamicObject dy = dys.Where(o => o["Id"] == resultItem.PKValue).FirstOrDefault();
if (dy != null)
{
//修改提示信息
//如严谨处理,需要使用LoadKDString,不使用也暂时无妨
// resultItem.Message = "凭证字" + dy["凭证字key"].ToString() + "—" + "凭证号" + dy["VOUCHERGROUPNO"].ToString() + "的凭证保存成";

if (error_show != null && error_show.Length > 0)
{
resultItem.Message = error_show.ToString() + "\n" + "凭证号为" + dy["VOUCHERGROUPNO"].ToString() + "的凭证保存成功。";
}
else
{
resultItem.Message = "凭证号为" + dy["VOUCHERGROUPNO"].ToString() + "的凭证保存成功。";
}

}
}
}

this.View.SetEntityFocusRow("FEntity", 0);

}
else if (e.Operation.OperationId == 9)//提交
{
if (opResult != null)
{
IEnumerable dys = opResult.SuccessDataEnity;

foreach (OperateResult resultItem in opResult.OperateResult)
{
DynamicObject dy = dys.Where(o => o["Id"] == resultItem.PKValue).FirstOrDefault();
if (dy != null)
{
//修改提示信息
//如严谨处理,需要使用LoadKDString,不使用也暂时无妨
// resultItem.Message = "凭证字" + dy["凭证字key"].ToString() + "—" + "凭证号" + dy["VOUCHERGROUPNO"].ToString() + "的凭证保存成";

resultItem.Message = "凭证号为" + dy["VOUCHERGROUPNO"].ToString() + "的凭证提交成功。";
}
}
}
}
else if (e.Operation.OperationId == 1)//审核
{
if (opResult != null)
{
IEnumerable dys = opResult.SuccessDataEnity;

foreach (OperateResult resultItem in opResult.OperateResult)
{
DynamicObject dy = dys.Where(o => o["Id"] == resultItem.PKValue).FirstOrDefault();
if (dy != null)
{
//修改提示信息
//如严谨处理,需要使用LoadKDString,不使用也暂时无妨
// resultItem.Message = "凭证字" + dy["凭证字key"].ToString() + "—" + "凭证号" + dy["VOUCHERGROUPNO"].ToString() + "的凭证保存成";

resultItem.Message = "凭证号为" + dy["VOUCHERGROUPNO"].ToString() + "的凭证审核成功。";
}
}
}
}
else if (e.Operation.OperationId == 26)//反审核
{
if (opResult != null)
{
IEnumerable dys = opResult.SuccessDataEnity;

foreach (OperateResult resultItem in opResult.OperateResult)
{
DynamicObject dy = dys.Where(o => o["Id"] == resultItem.PKValue).FirstOrDefault();
if (dy != null)
{
//修改提示信息
//如严谨处理,需要使用LoadKDString,不使用也暂时无妨
// resultItem.Message = "凭证字" + dy["凭证字key"].ToString() + "—" + "凭证号" + dy["VOUCHERGROUPNO"].ToString() + "的凭证保存成";

resultItem.Message = "凭证号为" + dy["VOUCHERGROUPNO"].ToString() + "的凭证反审核成功。";
}
}
}
}

}[/code]
[/indent]