public static void backToPreNode(string task_code, string note, string node_definition_id, string inids) { List <string> listsql = new List <string>(); listsql.Add(string.Format("UPDATE {0} SET end_time=GETDATE(),state=2,note='{1}' WHERE node_definition_id={2} AND task_code='{3}';", TABLE_NODE_INSTANCE, note, node_definition_id, task_code)); listsql.Add(string.Format("UPDATE {0} SET state=3 WHERE task_code='{1}' AND node_definition_id in ( {2} );", TABLE_NODE_INSTANCE, task_code, inids)); DBCallCommon.ExecuteTrans(listsql); }
const string TABLE_LINE = "YS_line"; //路线信息视图 /// <summary> /// 激活(创建)后续的节点,(没有考虑or_split和or_join,以后补上) /// </summary> /// <param name="task_code">任务号</param> /// <param name="node_definition_id">当前节点的node类id</param> /// <param name="user_ids">存储后续节点中所有责任人id的数组, /// 按照后续节点的node_definition_id从小到大排序,例如 /// 【生产部长、采购部长】 /// 【人工费反馈人,分包费反馈人,外协反馈人】、 /// 【黑色金属、外购件、油漆涂料、电器电料、铸锻件、其他材料】</param> public static void activeFollowNode(string task_code, string node_definition_id, string[] user_ids) { if (node_definition_id.Equals("0"))//如果是刚进入该任务 { DBCallCommon.ExeSqlText(string.Format(@"INSERT INTO {0} ( node_definition_id , task_code , user_id , start_time , state ) VALUES( 1, '{1}' , {2} , GETDATE() , 1); ", TABLE_NODE_INSTANCE, task_code, user_ids[0])); } else//如果是任务内部推动 { List <string> listsql = new List <string>(); //依次按照NODE_DEFINITION表中node_definition_id的顺序匹配user_ids[]中的责任人,并激活 for (int i = 0; i < user_ids.Length; i++) { listsql.Add(string.Format(@"INSERT INTO {0} ( node_definition_id , task_code , user_id , start_time , state ) SELECT ( SELECT TOP 1 to_node_definition_id FROM {1} WHERE from_node_definition_id={2} AND to_node_definition_id NOT IN ( SELECT TOP {3} to_node_definition_id FROM {4} WHERE from_node_definition_id = {5} ORDER BY to_node_definition_id ) ) , '{6}' , {7} , GETDATE() , 1; ", TABLE_NODE_INSTANCE, TABLE_LINE, node_definition_id, i, TABLE_LINE, node_definition_id, task_code, user_ids[i])); } DBCallCommon.ExecuteTrans(listsql); } }
//驳回修改 protected void btnbacklast_onserverclick(object sender, EventArgs e) { int a = SaveControl(); if (a == 1) { Response.Write("<script>alert('请选择“同意”或者“不同意”再提交!!!')</script>"); return; } List <string> list = new List <string>(); string sql = "update OM_SP set "; if (asd.dt.Rows[0]["SPJB"].ToString() == "1") { if (asd.username == asd.dt.Rows[0]["SPR1"].ToString()) { sql += " SPR1_SJ='" + lbSPR1_SJ.Text.Trim() + "',SPR1_JY='" + "已驳回," + txtSPR1_JY.Text + "',"; if (rblSPR1_JL.SelectedValue == "n") { sql += " SPZT='0'"; } else { Response.Write("<script>alert('该操作仅用于将数据驳回到前一级修改!')</script>"); return; } } } else if (asd.dt.Rows[0]["SPJB"].ToString() == "2") { if (asd.username == asd.dt.Rows[0]["SPR1"].ToString()) { sql += " SPR1_SJ='" + lbSPR1_SJ.Text.Trim() + "',SPR1_JY='" + "已驳回," + txtSPR1_JY.Text + "',"; if (rblSPR1_JL.SelectedValue == "n") { sql += " SPZT='0'"; } else { Response.Write("<script>alert('该操作仅用于将数据驳回到前一级修改!')</script>"); return; } } else if (asd.username == asd.dt.Rows[0]["SPR2"].ToString()) { sql += " SPR1_JL='',SPR2_SJ='" + lbSPR2_SJ.Text.Trim() + "',SPR2_JY='" + "已驳回," + txtSPR2_JY.Text + "',"; if (rblSPR2_JL.SelectedValue == "n") { sql += " SPZT='1'"; } else { Response.Write("<script>alert('该操作仅用于将数据驳回到前一级修改!')</script>"); return; } } } else if (asd.dt.Rows[0]["SPJB"].ToString() == "3") { if (asd.username == asd.dt.Rows[0]["SPR1"].ToString()) { sql += " SPR1_SJ='" + lbSPR1_SJ.Text.Trim() + "',SPR1_JY='" + "已驳回," + txtSPR1_JY.Text + "',"; if (rblSPR1_JL.SelectedValue == "n") { sql += " SPZT='0'"; } else { Response.Write("<script>alert('该操作仅用于将数据驳回到前一级修改!')</script>"); return; } } else if (asd.username == asd.dt.Rows[0]["SPR2"].ToString()) { sql += " SPR1_JL='',SPR2_SJ='" + lbSPR2_SJ.Text.Trim() + "',SPR2_JY='" + "已驳回," + txtSPR2_JY.Text + "',"; if (rblSPR2_JL.SelectedValue == "n") { sql += " SPZT='1'"; } else { Response.Write("<script>alert('该操作仅用于将数据驳回到前一级修改!')</script>"); return; } } else if (asd.username == asd.dt.Rows[0]["SPR3"].ToString()) { sql += " SPR2_JL='',SPR3_SJ='" + lbSPR3_SJ.Text.Trim() + "',SPR3_JY='" + "已驳回," + txtSPR3_JY.Text + "',"; if (rblSPR3_JL.SelectedValue == "n") { sql += " SPZT='1y'"; } else { Response.Write("<script>alert('该操作仅用于将数据驳回到前一级修改!')</script>"); return; } } } sql += " where SPFATHERID='" + asd.sjid + "'"; list.Add(sql); try { DBCallCommon.ExecuteTrans(list); } catch { Response.Write("<script>alert('审批的sql语句出现问题,请与管理员联系!!!')</script>"); return; } }
protected void btnSave_onserverclick(object sender, EventArgs e) { string stname = txtSPR1.Text.Trim(); string stid = hidSPR1ID.Value.Trim(); int a = SaveControl(); if (a == 1) { Response.Write("<script>alert('请选择“同意”或者“不同意”再提交!!!')</script>"); return; } else if (a == 2) { Response.Write("<script>alert('请至少填写一项培训计划再提交!!!')</script>"); return; } else if (a == 3) { Response.Write("<script> if (confirm('您已删除了该单据的全部培训计划,该单据将被删除!!!')) {return true;}else {return false;}</script>"); } stname = txtSPR1.Text.Trim(); stid = hidSPR1ID.Value.Trim(); if (asd.action == "add") { try { List <string> list = addlist(); DBCallCommon.ExecuteTrans(list); } catch { Response.Write("<script>alert('新增的sql语句出现问题,请与管理员联系!!!')</script>"); return; } btnSave.Visible = false; btnbacklast.Visible = false; Response.Write("<script>alert('您已保存成功!!!')</script>"); } else if (asd.action == "alter") { try { List <string> list = alterlist(); DBCallCommon.ExecuteTrans(list); } catch { Response.Write("<script>alert('修改的sql语句出现问题,请与管理员联系!!!')</script>"); return; } } else if (asd.action == "check") { try { List <string> list = checklist(); DBCallCommon.ExecuteTrans(list); } catch { Response.Write("<script>alert('审批的sql语句出现问题,请与管理员联系!!!')</script>"); return; } Response.Redirect("OM_NDPXJH_GL.aspx"); } stname = txtSPR1.Text.Trim(); stid = hidSPR1ID.Value.Trim(); }