【已解决】动态表单提示错误问题
金蝶云社区-云社区用户o0851234
云社区用户o0851234
0人赞赏了该文章 1,528次浏览 未经作者许可,禁止转载编辑于2015年04月24日 16:03:18


主要为了判断 fWriteOffNumberB 已核销数量 fverificationNumberB 本次核销数量 fBaseQtyB 基本单位数量 三个值。

主要代码:
public DataTable CheckoutSAL_OUTSTOCK()
{
//定义一张临时表单FCreditEntryTable,存储核销数量
DataTable dt = new DataTable("FCreditEntryTable");
dt.Clear();
DataColumn dc = new DataColumn("FverificationNumberB", typeof(Int64));
dt.Columns.Add(dc);
//获取单据FCreditEntry
EntryEntity entity = this.View.BusinessInfo.GetEntryEntity("FCreditEntry");
DynamicObjectCollection rows = this.View.Model.GetEntityDataObject(entity);

foreach (var item in rows)
{
bool bResult;
bool.TryParse(item["FChoiceBoxB"].ToString(), out bResult);
if (bResult)//选中时
{
//清除数据变量
string sql = string.Empty;
Decimal fverificationNumberB = 0;
long fWriteOffNumberB = 0;
long fBaseQtyB = 0;
string rowIndexB = string.Empty;
string showErrMessage = string.Empty;
string title = string.Empty;

fverificationNumberB = Convert.ToInt64(item["FverificationNumberB"]);
fWriteOffNumberB = Convert.ToInt64(item["FWriteOffNumberB"]);
fBaseQtyB = Convert.ToInt64(item["FBaseQtyB"].ToString());
rowIndexB = item["FRowIndexB"].ToString();
DataRow dr = dt.NewRow();
dr["FverificationNumberB"] = Convert.ToInt64(item["FverificationNumberB"]);
dt.Rows.Add(dr);
if (fWriteOffNumberB > 0 && fBaseQtyB < fWriteOffNumberB + fverificationNumberB)
{
showErrMessage="第" + rowIndexB + "行总核销数目超出基本单位数量!";
title="销售出库单错误提示";
this.View.ShowErrMessage(showErrMessage, title, MessageBoxType.Notice);
}
else if (fWriteOffNumberB == 0 && fBaseQtyB < fWriteOffNumberB + fverificationNumberB)
{
showErrMessage = "第" + rowIndexB + "行总核销数目超出基本单位数量!";
title = "销售出库单错误提示";
this.View.ShowErrMessage(showErrMessage, title, MessageBoxType.Notice);
}
}
}
return dt;
}