需求:
1、对应账号接收到审核的消息,点击处理后跳转到当前页面,处理完后该条消息消失。
2、未通过审核的单据,不能被其他单据引用。
3、审核非驳回状态不可重新提交
4、意见为驳回后回退到第一人
方案:
1.1、每个账号登录该页面对每个Grid重新绑定,绑定的数据源是该账号下存储的SQL语句搜索出的数据,账号接收到对应的审核消息
if (!string.IsNullOrEmpty(roleMsgSql)) //存储该角色的消息SQL语句
{
roleMsgSql = roleMsgSql.Replace(para, "");
DataTable dtRes = DB.Ado.CommandFluent(roleMsgSql).ExecuteDataTable();
laserpickGrid.DataSource = dtRes;
laserpickGrid.DataBind();
}
1.2、点击该条信息页面跳转
//获取该表的KEY值
object[] keys = laserpickGrid.DataKeys[e.RowIndex];
//将该条数据ID作为参数传递到跳转页面
string url = string.Format(@"production/pr_laserpick.aspx?pageType=SH" + "&ID=" + keys[0]);
if (e.CommandName == "next")
{
PageContext.RegisterStartupScript("openNewTab('" + DateTime.Now.Ticks.ToString() + "','车间补料审核','" + url + "');");
}
if (Request.QueryString["pageType"].ToString() == "XXSH")//消息审核:消息页面跳转
{
Guid FromID = ConvertEx.ToGuid(Request.QueryString["ID"]);
BindMessageGrid(FromID, "submitTime");
}
if (Request.QueryString["pageType"].ToString() == "XXSH"){
//审批
Expression<Func<V_productorder, bool>> expFromID = p => true;
expFromID = p => p.ID == FromID;
whereLambda = Utility.And(whereLambda, expFromID);
}
修改GridBind 方法,接收该条数据的ID,重新绑定,实现页面跳转后锁定该条信息。
2.1、搜索列表中不显示未通过审核的数据,避免被选用
//过滤未通过审核的数据
Expression<Func<V_productorder, bool>> expstatus = p => true;
expstatus = p => p.checkstatus!= "未审核";
whereLambda = Utility.And(whereLambda, expstatus);
2.2、选中后判断状态,如果未通过审核则无法进行下一部操作
int[] intRowindexarray = MainGrid.SelectedRowIndexArray;
if (intRowindexarray.Length < 1)
{
ShowNotify("请选择合同记录!");
return;
}
//如果已提交审核的单子不可新增
if (ConvertEx.ToString(MainGrid.DataKeys[intRowindexarray[0]][2]) != "已制单" && ConvertEx.ToString(MainGrid.DataKeys[intRowindexarray[0]] [2]) != "已驳回")
{
ShowNotify("该合同记录已经提交审核或已通过审核,不可更改!");
return;
}
3、 使用2.2方法或操作该条数据时查询其状态:
Guid rowGid = ConvertEx.ToGuid(mainGrid.DataKeys[mainGrid.SelectedRowIndex][0]);
V_laserpick lsp = new V_laserpick();
lsp = tEntity.V_laserpick.Where(it => it.ID == (rowGid)).FirstOrDefault();
if (lsp.completestatus == "待审核1")
{
ShowNotify("已提交审核!");
return;
}
else if (lsp.completestatus == "已审核")
{
ShowNotify("审核已通过!");
return;
}
else if (lsp.completestatus == "已制单" || lsp.completestatus == "已驳回" || lsp.completestatus == "未审核")
{
lsp.completestatus = "待审核1";
lsp.submitTime = DateTime.Now;
}
else
{
ShowNotify("该单据正在审核!");
return;
}
4、将审核状态赋值为待第一人审核状态,BindGrid是增加条件
if (sessionname == "测试员1")
{
Expression<Func<V_laserpick, bool>> ecode1 = p => true;
ecode1 = p => p.completestatus.Contains("待审核1");
whereLambda = Utility.And(whereLambda, ecode1);
}
5、审核状态的展示字符
DataTable dtResult = LINQToDataTable(data);
foreach (DataRow r in dtResult.Rows)
{
string statu = r["completestatus"].ToString();
if (statu == "待审核1")
{
r["completestatus"] = "待**审核";
}
if (statu == "待审核2")
{
r["completestatus"] = "待**审核";
}
}