Beispiel #1
0
        /// <summary>
        /// 查询数目
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        private int getActiveNodeInstanceNum(string sql)
        {
            int num;

            int.TryParse(BudgetFlowEngine.getFirstCellStringByDR(sql), out num);
            return(num);
        }
Beispiel #2
0
        /// <summary>
        /// 完成当前节点并驳回到指定节点
        /// </summary>
        /// <param name="node_definition_id">当前节点的node类id</param>
        /// <param name="tb">任务预算对象</param>
        public void rejectNode(string node_definition_id, YS_Data.Model.TaskBudget tb, string inids)
        {
            switch (node_definition_id)
            {
            case "6":    //生产部驳回
                DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET production_check={1} WHERE task_code='{2}';", TABLE_TASK_BUDGET, tb.production_check, tb.task_code));
                BudgetFlowEngine.backToPreNode(tb.task_code, tb.node_production_check_note, node_definition_id, inids);
                break;

            case "14":     //采购部驳回
                DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET purchase_check={1} WHERE task_code='{2}';", TABLE_TASK_BUDGET, tb.purchase_check, tb.task_code));
                BudgetFlowEngine.backToPreNode(tb.task_code, tb.node_purchase_check_note, node_definition_id, inids);
                break;

            case "16":    //财务部驳回
                DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET state=3,budget_check={1} WHERE task_code='{2}';", TABLE_TASK_BUDGET, tb.budget_check, tb.task_code));
                BudgetFlowEngine.backToPreNode(tb.task_code, tb.node_budget_check_note, node_definition_id, inids);
                break;

            default:
                break;
            }
        }
        /// <summary>
        /// 预算提交按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void lbtn_Finish_onclick(object sender, EventArgs e)
        {
            string tsaId = ((LinkButton)sender).CommandArgument + "";//获取传递的任务号

            if (canBeSumited(tsaId))
            {
                List <string> listsql = new List <string>();
                listsql.Add(string.Format("DELETE FROM dbo.YS_TASK_BUDGET WHERE task_code='{0}';", tsaId));                           //删除任务预算表内的信息
                listsql.Add(string.Format("DELETE FROM dbo.YS_MATERIAL_HISTORY_INFO WHERE task_code='{0}';", tsaId));                 //删除历史表内的信息
                listsql.Add(string.Format("DELETE FROM dbo.YS_NODE_INSTANCE WHERE task_code='{0}';", tsaId));                         //删除node实例表中的信息
                listsql.Add(getInsertIntoHistoryInfoTableSqltext(tsaId));                                                             //向历史表重新插入信息
                listsql.Add(getInsertIntoTaskBudgetTableSqltext(tsaId));                                                              //向任务预算表重新插入信息
                listsql.Add(string.Format("UPDATE dbo.TBPM_TCTSASSGN SET TSA_BUDGET_DATETIME=GETDATE() WHERE TSA_ID='{0}';", tsaId)); //更新任务表中预算提交的时间
                DBCallCommon.ExecuteTrans(listsql);
                listsql.Clear();
                string[] ids = new string[] { ConfigurationSettings.AppSettings["BudgetEditorId"] }; //配置文件中读取预算编制人id
                BudgetFlowEngine.activeFollowNode(tsaId, "0", ids);                                  //向node实例表中插入第一个实例
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('提交成功!');window.location='TM_Mytast_List.aspx'", true);
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "名称", "<script>alert('请勿重复提交!');</script>");
            }
        }
Beispiel #4
0
        /// <summary>
        /// 完成当前节点并激活下一节点
        /// </summary>
        /// <param name="node_definition_id">当前节点的node类id</param>
        /// <param name="tb">任务预算对象</param>
        public void finishNode(string node_definition_id, YS_Data.Model.TaskBudget tb)
        {
            switch (node_definition_id)
            {
            case "1":     //财务初步编制
                DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET direct_labour_budget_pre={1},sub_teamwork_budget_pre={2},cooperative_product_budget_pre={3},total_material_budget_pre={4}, state=2 WHERE task_code='{5}';", TABLE_TASK_BUDGET, tb.labour_budget_pre, tb.teamwork_budget_pre, tb.cooperative_budget_pre, tb.total_material_budget_pre, tb.task_code));
                if (BudgetFlowEngine.completeCurrentNode(tb.task_code, node_definition_id, "NULL"))
                {
                    string[] ids1 = new string[] { BudgetFlowEngine.getFirstCellStringByDR(string.Format("SELECT ST_ID FROM TBDS_STAFFINFO WHERE ST_POSITION={0} AND ST_PD=0;", ConfigurationSettings.AppSettings["BudgetProductionCheck"])), BudgetFlowEngine.getFirstCellStringByDR(string.Format("SELECT ST_ID FROM TBDS_STAFFINFO WHERE ST_POSITION={0} AND ST_PD=0;", ConfigurationSettings.AppSettings["BudgetPurchaseCheck"])) };    //获得生产部分工人、采购分工人id
                    BudgetFlowEngine.activeFollowNode(tb.task_code, node_definition_id, ids1);
                }
                break;

            case "2":    //生产部长分工
                if (BudgetFlowEngine.completeCurrentNode(tb.task_code, node_definition_id, "NULL"))
                {
                    string[] ids2 = new string[] { tb.node_labour_dep_user_id, tb.node_teamwork_dep_user_id, tb.node_cooperative_dep_user_id };
                    BudgetFlowEngine.activeFollowNode(tb.task_code, node_definition_id, ids2);
                }
                break;

            case "3":    //人工费反馈
                DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET direct_labour_dep={1} WHERE task_code='{2}';", TABLE_TASK_BUDGET, tb.labour_dep, tb.task_code));
                if (BudgetFlowEngine.completeCurrentNode(tb.task_code, node_definition_id, tb.node_labour_dep_note))
                {
                    DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET production_check=2 WHERE task_code='{1}';", TABLE_TASK_BUDGET, tb.task_code));
                    string[] ids3 = new string[] { BudgetFlowEngine.getFirstCellStringByDR(string.Format("SELECT ST_ID FROM TBDS_STAFFINFO WHERE ST_POSITION={0} AND ST_PD=0;", ConfigurationSettings.AppSettings["BudgetProductionCheck"])) };
                    BudgetFlowEngine.activeFollowNode(tb.task_code, node_definition_id, ids3);
                }
                break;

            case "4":    //分包费反馈
                DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET sub_teamwork_dep={1} WHERE task_code='{2}';", TABLE_TASK_BUDGET, tb.teamwork_dep, tb.task_code));
                if (BudgetFlowEngine.completeCurrentNode(tb.task_code, node_definition_id, tb.node_teamwork_dep_note))
                {
                    DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET production_check=2 WHERE task_code='{1}';", TABLE_TASK_BUDGET, tb.task_code));
                    string[] ids4 = new string[] { BudgetFlowEngine.getFirstCellStringByDR(string.Format("SELECT ST_ID FROM TBDS_STAFFINFO WHERE ST_POSITION={0} AND ST_PD=0;", ConfigurationSettings.AppSettings["BudgetProductionCheck"])) };
                    BudgetFlowEngine.activeFollowNode(tb.task_code, node_definition_id, ids4);
                }
                break;

            case "5":    //外协费反馈
                DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET cooperative_product_dep={1} WHERE task_code='{2}';", TABLE_TASK_BUDGET, tb.cooperative_dep, tb.task_code));
                if (BudgetFlowEngine.completeCurrentNode(tb.task_code, node_definition_id, tb.node_cooperative_dep_note))
                {
                    DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET production_check=2 WHERE task_code='{1}';", TABLE_TASK_BUDGET, tb.task_code));
                    string[] ids5 = new string[] { BudgetFlowEngine.getFirstCellStringByDR(string.Format("SELECT ST_ID FROM TBDS_STAFFINFO WHERE ST_POSITION={0} AND ST_PD=0;", ConfigurationSettings.AppSettings["BudgetProductionCheck"])) };
                    BudgetFlowEngine.activeFollowNode(tb.task_code, node_definition_id, ids5);
                }
                break;

            case "6":    //生产部长审核
                DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET production_check={1} WHERE task_code='{2}';", TABLE_TASK_BUDGET, tb.production_check, tb.task_code));
                if (BudgetFlowEngine.completeCurrentNode(tb.task_code, node_definition_id, tb.node_production_check_note))
                {
                    DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET state=3 WHERE task_code='{1}';", TABLE_TASK_BUDGET, tb.task_code));
                    string[] ids6 = new string[] { ConfigurationSettings.AppSettings["BudgetEditorId"] + "" };
                    BudgetFlowEngine.activeFollowNode(tb.task_code, node_definition_id, ids6);
                }
                break;

            case "7":    //采购部长分工
                if (BudgetFlowEngine.completeCurrentNode(tb.task_code, node_definition_id, "NULL"))
                {
                    string[] ids7 = new string[] { tb.node_ferrous_dep_user_id, tb.node_purchasepart_dep_user_id, tb.node_paint_dep_user_id, tb.node_electrical_dep_user_id, tb.node_casting_dep_user_id, tb.node_othermat_dep_user_id };
                    BudgetFlowEngine.activeFollowNode(tb.task_code, node_definition_id, ids7);
                }
                break;

            case "8":    //黑色金属反馈
                DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET ys_ferrous_metal_dep={1} WHERE task_code='{2}';", TABLE_TASK_BUDGET, tb.ferrous_dep, tb.task_code));
                if (BudgetFlowEngine.completeCurrentNode(tb.task_code, node_definition_id, tb.node_ferrous_dep_note))
                {
                    DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET purchase_check=2 WHERE task_code='{1}';", TABLE_TASK_BUDGET, tb.task_code));
                    string[] ids8 = new string[] { BudgetFlowEngine.getFirstCellStringByDR(string.Format("SELECT ST_ID FROM TBDS_STAFFINFO WHERE ST_POSITION={0} AND ST_PD=0;", ConfigurationSettings.AppSettings["BudgetPurchaseCheck"])) };
                    BudgetFlowEngine.activeFollowNode(tb.task_code, node_definition_id, ids8);
                }
                break;

            case "9":    //外购件反馈
                DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET ys_purchase_part_dep={1} WHERE task_code='{2}';", TABLE_TASK_BUDGET, tb.purchasepart_dep, tb.task_code));
                if (BudgetFlowEngine.completeCurrentNode(tb.task_code, node_definition_id, tb.node_purchasepart_dep_note))
                {
                    DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET purchase_check=2 WHERE task_code='{1}';", TABLE_TASK_BUDGET, tb.task_code));
                    string[] ids9 = new string[] { BudgetFlowEngine.getFirstCellStringByDR(string.Format("SELECT ST_ID FROM TBDS_STAFFINFO WHERE ST_POSITION={0} AND ST_PD=0;", ConfigurationSettings.AppSettings["BudgetPurchaseCheck"])) };
                    BudgetFlowEngine.activeFollowNode(tb.task_code, node_definition_id, ids9);
                }
                break;

            case "10":    //油漆涂料反馈
                DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET ys_paint_coating_dep={1} WHERE task_code='{2}';", TABLE_TASK_BUDGET, tb.paint_dep, tb.task_code));
                if (BudgetFlowEngine.completeCurrentNode(tb.task_code, node_definition_id, tb.node_paint_dep_note))
                {
                    DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET purchase_check=2 WHERE task_code='{1}';", TABLE_TASK_BUDGET, tb.task_code));
                    string[] ids10 = new string[] { BudgetFlowEngine.getFirstCellStringByDR(string.Format("SELECT ST_ID FROM TBDS_STAFFINFO WHERE ST_POSITION={0} AND ST_PD=0;", ConfigurationSettings.AppSettings["BudgetPurchaseCheck"])) };
                    BudgetFlowEngine.activeFollowNode(tb.task_code, node_definition_id, ids10);
                }
                break;

            case "11":    //电器电料反馈
                DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET ys_electrical_dep={1} WHERE task_code='{2}';", TABLE_TASK_BUDGET, tb.electrical_dep, tb.task_code));
                if (BudgetFlowEngine.completeCurrentNode(tb.task_code, node_definition_id, tb.node_electrical_dep_note))
                {
                    DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET purchase_check=2 WHERE task_code='{1}';", TABLE_TASK_BUDGET, tb.task_code));
                    string[] ids11 = new string[] { BudgetFlowEngine.getFirstCellStringByDR(string.Format("SELECT ST_ID FROM TBDS_STAFFINFO WHERE ST_POSITION={0} AND ST_PD=0;", ConfigurationSettings.AppSettings["BudgetPurchaseCheck"])) };
                    BudgetFlowEngine.activeFollowNode(tb.task_code, node_definition_id, ids11);
                }
                break;

            case "12":    //铸锻件反馈
                DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET ys_casting_forging_dep={1} WHERE task_code='{2}';", TABLE_TASK_BUDGET, tb.casting_dep, tb.task_code));
                if (BudgetFlowEngine.completeCurrentNode(tb.task_code, node_definition_id, tb.node_casting_dep_note))
                {
                    DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET purchase_check=2 WHERE task_code='{1}';", TABLE_TASK_BUDGET, tb.task_code));
                    string[] ids12 = new string[] { BudgetFlowEngine.getFirstCellStringByDR(string.Format("SELECT ST_ID FROM TBDS_STAFFINFO WHERE ST_POSITION={0} AND ST_PD=0;", ConfigurationSettings.AppSettings["BudgetPurchaseCheck"])) };
                    BudgetFlowEngine.activeFollowNode(tb.task_code, node_definition_id, ids12);
                }
                break;

            case "13":    //其他材料反馈
                DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET ys_othermat_cost_dep={1} WHERE task_code='{2}';", TABLE_TASK_BUDGET, tb.othermat_dep, tb.task_code));
                if (BudgetFlowEngine.completeCurrentNode(tb.task_code, node_definition_id, tb.node_othermat_dep_note))
                {
                    DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET purchase_check=2 WHERE task_code='{1}';", TABLE_TASK_BUDGET, tb.task_code));
                    string[] ids13 = new string[] { BudgetFlowEngine.getFirstCellStringByDR(string.Format("SELECT ST_ID FROM TBDS_STAFFINFO WHERE ST_POSITION={0} AND ST_PD=0;", ConfigurationSettings.AppSettings["BudgetPurchaseCheck"])) };
                    BudgetFlowEngine.activeFollowNode(tb.task_code, node_definition_id, ids13);
                }
                break;

            case "14":    //采购部长审核
                DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET purchase_check={1} WHERE task_code='{2}';", TABLE_TASK_BUDGET, tb.purchase_check, tb.task_code));
                if (BudgetFlowEngine.completeCurrentNode(tb.task_code, node_definition_id, tb.node_purchase_check_note))
                {
                    DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET state=3 WHERE task_code='{1}';", TABLE_TASK_BUDGET, tb.task_code));
                    string[] ids14 = new string[] { ConfigurationSettings.AppSettings["BudgetEditorId"] + "" };
                    BudgetFlowEngine.activeFollowNode(tb.task_code, node_definition_id, ids14);
                }
                break;

            case "15":     //预算调整
                DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET direct_labour_budget={1},sub_teamwork_budget={2},cooperative_product_budget={3},total_material_budget={4}, state=4 WHERE task_code='{5}';", TABLE_TASK_BUDGET, tb.labour_budget, tb.teamwork_budget, tb.cooperative_budget, tb.total_material_budget, tb.task_code));
                if (BudgetFlowEngine.completeCurrentNode(tb.task_code, node_definition_id, "NULL"))
                {
                    DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET budget_check=2 WHERE task_code='{1}';", TABLE_TASK_BUDGET, tb.task_code));
                    string[] ids15 = new string[] { BudgetFlowEngine.getFirstCellStringByDR(string.Format("SELECT ST_ID FROM TBDS_STAFFINFO WHERE ST_POSITION={0} AND ST_PD=0;", ConfigurationSettings.AppSettings["BudgetFinanceCheck"])) };    //获得财务部审核人id
                    BudgetFlowEngine.activeFollowNode(tb.task_code, node_definition_id, ids15);
                }
                break;

            case "16":    //财务部长审核
                DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET budget_check={1}, state=5,end_time=GETDATE() WHERE task_code='{2}';", TABLE_TASK_BUDGET, tb.budget_check, tb.task_code));
                if (BudgetFlowEngine.completeCurrentNode(tb.task_code, node_definition_id, tb.node_budget_check_note))
                {
                    string[] ids16 = new string[] { "0" };
                    BudgetFlowEngine.activeFollowNode(tb.task_code, node_definition_id, ids16);
                }
                break;

            default:
                break;
            }
        }