Exemple #1
0
        /// <summary>
        /// 新增材料计划
        /// </summary>
        /// <param name="context"></param>
        private void addPurchasePlan(HttpContext context)
        {
            string json = string.Empty;

            //返回数据的格式

            WZGL.MODEL.Plan.TBL_PURCHASEPLAN model = new MODEL.Plan.TBL_PURCHASEPLAN(); //材料计划

            string planid = ComFunction.GetId();                                        //计划主键ID
            string ids    = context.Request["ids"];

            string[] strarr = ids.Split(',');

            string project = context.Request["data"];
            string type    = context.Request["type"];

            try
            {
                List <WZGL.MODEL.Plan.TBL_PURCHASEPLAN> list = JsonConvert.DeserializeObject <List <WZGL.MODEL.Plan.TBL_PURCHASEPLAN> >(project);

                if (list.Count > 0)
                {
                    list[0].Purchaseplanid = planid;
                    model     = list[0];
                    model.Ids = ids;
                    //model.ADD_EMP = CFunctions.getUserId(context);
                    foreach (TBL_PURCHASEPLAN_DETAIL mpj in model.list_detail)
                    {
                        mpj.Purchaseplanid       = planid;
                        mpj.Purchaseplandetailid = ComFunction.GetId();//详细主键ID
                    }

                    bool re = WZGL.BLL.BllFactory.GetPurchaseplanBLL().Insert(model);//插入采购计划数据

                    WorkFlow.Model.FLOW_TASK task = new WorkFlow.Model.FLOW_TASK();
                    task.TASK_ID     = Guid.NewGuid().ToString().ToUpper();
                    task.DEFINE_CODE = CFunctions.getFlowDefineId(context, "F7040DE6-522C-4719-8D42-78360A732400"); //"LCBM20161226160709"; "LCBM20170107160708";
                    task.TASK_CODE   = model.Processnumber;                                                         // "CLJH" + DateTime.Now.ToString("yyyyMMddHHmmss"); ;
                    task.TASK_TILTE  = "采购计划" + DateTime.Now.ToString("yyyyMMddHHmmss");
                    task.STATUS      = "0";
                    task.TASK_TYPE   = "F7040DE6-522C-4719-8D42-78360A732400";
                    task.ADD_EMP     = CFunctions.getUserId(context); // "1";//context.Request["ADD_EMP"];
                    //task.ADD_TIME = DateTime.Now;
                    task.TASK_JSON = project;                         // context.Request["TASK_JSON"];
                    //model.ADD_EMP
                    bool result = WorkFlow.BLL.Operate.AddTask(task);

                    if (result)
                    {
                        if (type == "send")
                        {
                            //发送流程
                            re = WorkFlow.BLL.Operate.StartFlow(task.TASK_CODE, task.DEFINE_CODE, CFunctions.getUserId(context), "");
                            if (re)
                            {
                                json = "{\"IsSuccess\":\"true\",\"Message\":\"发起成功!\"}";
                            }
                            else
                            {
                                json = "{\"IsSuccess\":\"false\",\"Message\":\"发起失败!\"}";
                            }
                        }
                        else
                        {
                            json = "{\"IsSuccess\":\"true\",\"Message\":\"添加成功!\"}";
                        }
                    }
                    else
                    {
                        json = "{\"IsSuccess\":\"false\",\"Message\":\"添加失败!\"}";
                    }
                }
                else
                {
                    json = "{\"IsSuccess\":\"false\",\"Message\":\"解析数据失败!\"}";
                }
            }
            catch (Exception ex)
            {
                json = "{\"IsSuccess\":\"false\",\"Message\":\"保存失败!\"}";
            }
            //json = json;// JsonConvert.SerializeObject(project);
            context.Response.ContentType = "application/json";
            context.Response.Write(json);
            context.ApplicationInstance.CompleteRequest();
        }
Exemple #2
0
        private void addFlow(HttpContext context)
        {
            string json = string.Empty;

            //返回数据的格式
            WZGL.MODEL.Capital.TBL_CAPITALAPPLICANT model = new MODEL.Capital.TBL_CAPITALAPPLICANT(); //材料计划
            string cantid = ComFunction.GetId();                                                      //计划主键ID
            string cant   = context.Request["data"];
            string type   = context.Request["type"];

            try
            {
                List <WZGL.MODEL.Capital.TBL_CAPITALAPPLICANT> list = JsonConvert.DeserializeObject <List <WZGL.MODEL.Capital.TBL_CAPITALAPPLICANT> >(cant);

                if (list.Count > 0)
                {
                    list[0].capitalapplicantid = cantid;
                    model = list[0];
                    string sql = "";
                    if (!string.IsNullOrEmpty(model.applicationno))
                    {
                        sql += " and applicationno='" + model.applicationno + "'";
                    }
                    if (cantBll.GetList(sql).Count > 0)
                    {
                        if (type == "send")
                        {
                            string code     = model.applicationno;
                            string def_code = CFunctions.getFlowDefineId(context, "63211695-E9DD-4977-912F-0E5A04DD6F01");
                            //发送流程
                            bool re = WorkFlow.BLL.Operate.StartFlow(code, def_code, WZGL.WEB.Common.CFunctions.getUserId(context), "");
                            if (re)
                            {
                                json = "{\"IsSuccess\":\"true\",\"Message\":\"发起流程成功!\"}";
                            }
                            else
                            {
                                json = "{\"IsSuccess\":\"false\",\"Message\":\"该流程已经启动!\"}";
                            }
                        }
                        else
                        {
                            json = "{\"IsSuccess\":\"false\",\"Message\":\"申请单号已经存在!\"}";
                        }
                    }
                    else
                    {
                        bool result = cantBll.Insert(model);
                        WorkFlow.Model.FLOW_TASK task = new WorkFlow.Model.FLOW_TASK();
                        task.TASK_ID     = Guid.NewGuid().ToString().ToUpper();
                        task.DEFINE_CODE = CFunctions.getFlowDefineId(context, "63211695-E9DD-4977-912F-0E5A04DD6F01");
                        task.TASK_CODE   = model.applicationno;// "CLJH" + DateTime.Now.ToString("yyyyMMddHHmmss"); ;
                        task.TASK_TILTE  = "资金申请" + DateTime.Now.ToString("yyyyMMddHHmmss");
                        task.STATUS      = "0";
                        task.TASK_TYPE   = "63211695-E9DD-4977-912F-0E5A04DD6F01";
                        task.ADD_EMP     = WZGL.WEB.Common.CFunctions.getUserId(context); // "1";//context.Request["ADD_EMP"];
                        task.TASK_JSON   = cant;                                          // context.Request["TASK_JSON"];
                        result           = WorkFlow.BLL.Operate.AddTask(task);
                        if (result)
                        {
                            if (type == "send")
                            {
                                //发送流程
                                bool re = WorkFlow.BLL.Operate.StartFlow(task.TASK_CODE, task.DEFINE_CODE, WZGL.WEB.Common.CFunctions.getUserId(context), "");
                                if (re)
                                {
                                    json = "{\"IsSuccess\":\"true\",\"Message\":\"保存发起&流程成功!\"}";
                                }
                                else
                                {
                                    json = "{\"IsSuccess\":\"false\",\"Message\":\"保存发起&流程失败!\"}";
                                }
                            }
                            else
                            {
                                json = "{\"IsSuccess\":\"true\",\"Message\":\"添加成功!\"}";
                            }
                        }
                        else
                        {
                            json = "{\"IsSuccess\":\"false\",\"Message\":\"添加失败!\"}";
                        }
                    }
                }
                else
                {
                    json = "{\"IsSuccess\":\"false\",\"Message\":\"解析数据!\"}";
                }
            }
            catch (Exception ex)
            {
                json = "{\"IsSuccess\":\"false\",\"Message\":\"解析数据失败!\"}";
            }
            context.Response.ContentType = "application/json";
            context.Response.Write(json);
            context.ApplicationInstance.CompleteRequest();
        }
Exemple #3
0
        /// <summary>
        /// 新增材料计划
        /// </summary>
        /// <param name="context"></param>
        private void addMaterialPlan(HttpContext context)
        {
            string json = string.Empty;

            //返回数据的格式
            // string sql = "{单号:1,部门1,人员:1,project:[ {工程:1,detail:[{d:1},{d:2}]},{工程:2,detail:[{d:1},{d:2}},{工程:3,detail:[{d:1},{d:2}} ]}";
            WZGL.MODEL.Plan.TBL_MATERIALPLAN model = new MODEL.Plan.TBL_MATERIALPLAN();//材料计划
            // List<TBL_MATERIALPLANPROJECT> list_project = new List<TBL_MATERIALPLANPROJECT>();//材料计划项目
            // List<TBL_MATERIALPLANPROJECTDETAIL> list_detail = new List<TBL_MATERIALPLANPROJECTDETAIL>(); //材料计划项目材料明细

            string planid = ComFunction.GetId();//计划主键ID

            string project = context.Request["data"];
            string type    = context.Request["type"];

            try
            {
                List <WZGL.MODEL.Plan.TBL_MATERIALPLAN> list = JsonConvert.DeserializeObject <List <WZGL.MODEL.Plan.TBL_MATERIALPLAN> >(project);

                if (list.Count > 0)
                {
                    list[0].Materialplanid = planid;
                    model         = list[0];
                    model.ADD_EMP = CFunctions.getUserId(context);
                    foreach (TBL_MATERIALPLANPROJECT mpj in model.list_project)
                    {
                        string mpjid = ComFunction.GetId();//计划主键ID
                        mpj.Materialplanid        = planid;
                        mpj.Materialplanprojectid = mpjid;
                        foreach (TBL_MATERIALPLANPROJECTDETAIL mpjd in mpj.list_detail)
                        {
                            mpjd.Materialplanprojectdetailid = ComFunction.GetId();//计划主键ID
                            mpjd.Materialplanprojectid       = mpjid;
                        }
                    }

                    bool re = WZGL.BLL.BllFactory.GetMaterialplanBLL().Add(model, model.list_project, null);
                    WorkFlow.Model.FLOW_TASK task = new WorkFlow.Model.FLOW_TASK();
                    task.TASK_ID     = Guid.NewGuid().ToString().ToUpper();
                    task.DEFINE_CODE = CFunctions.getFlowDefineId(context, "F7040DE6-522C-4719-8D42-78360A732400"); //"LCBM20161226160709";
                    task.TASK_CODE   = model.Processnumber;                                                         // "CLJH" + DateTime.Now.ToString("yyyyMMddHHmmss"); ;
                    task.TASK_TILTE  = "材料计划" + DateTime.Now.ToString("yyyyMMddHHmmss");
                    task.STATUS      = "0";
                    task.TASK_TYPE   = "F7040DE6-522C-4719-8D42-78360A732400";
                    task.ADD_EMP     = CFunctions.getUserId(context); // "1";//context.Request["ADD_EMP"];
                    //task.ADD_TIME = DateTime.Now;
                    task.TASK_JSON = project;                         // context.Request["TASK_JSON"];
                    //model.ADD_EMP
                    bool result = WorkFlow.BLL.Operate.AddTask(task);

                    if (result)
                    {
                        if (type == "send")
                        {
                            //发送流程
                            re = WorkFlow.BLL.Operate.StartFlow(task.TASK_CODE, task.DEFINE_CODE, CFunctions.getUserId(context), "");
                            if (re)
                            {
                                json = "{\"IsSuccess\":\"true\",\"Message\":\"保存发起&流程成功!\"}";
                            }
                            else
                            {
                                json = "{\"IsSuccess\":\"false\",\"Message\":\"保存发起&流程失败!\"}";
                            }
                        }
                        else
                        {
                            json = "{\"IsSuccess\":\"true\",\"Message\":\"添加成功!\"}";
                        }
                    }
                    else
                    {
                        json = "{\"IsSuccess\":\"false\",\"Message\":\"添加失败!\"}";
                    }
                }
                else
                {
                    json = "{\"IsSuccess\":\"false\",\"Message\":\"解析数据失败!\"}";
                }
            }
            catch (Exception ex)
            {
                json = "{\"IsSuccess\":\"false\",\"Message\":\"保存失败!\"}";
            }
            //json = json;// JsonConvert.SerializeObject(project);
            context.Response.ContentType = "application/json";
            context.Response.Write(json);
            context.ApplicationInstance.CompleteRequest();
        }