private void delMaterialPlanList(HttpContext context) { string json = string.Empty; string Materialplanid = context.Request["Materialplanid"]; List <TBL_MATERIALPLAN> list = Bll.GetList(" Materialplanid='" + Materialplanid + "' ").ToList <TBL_MATERIALPLAN>(); if (list.Count > 0) { TBL_MATERIALPLAN model = list[0]; //获取流程单的状态 WorkFlow.Model.FLOW_TASK task = WorkFlow.BLL.Operate.GetTask(model.Processnumber); if (task != null) { if (task.STATUS != "0") { json = "{\"IsSuccess\":\"false\",\"Message\":\"删除失败,该计划的流程正在审批中,无法删除!\"}"; } else { bool re = Bll.Delete(Materialplanid); if (re) { json = "{\"IsSuccess\":\"true\",\"Message\":\"删除成功!\"}"; } else { json = "{\"IsSuccess\":\"false\",\"Message\":\"删除失败!\"}"; } } } else { bool re = Bll.Delete(Materialplanid); if (re) { json = "{\"IsSuccess\":\"true\",\"Message\":\"删除成功!\"}"; } else { json = "{\"IsSuccess\":\"false\",\"Message\":\"删除失败!\"}"; } } //json = "{\"IsSuccess\":\"true\",\"Message\":\"添加成功!\"}"; } else { json = "{\"IsSuccess\":\"false\",\"Message\":\"删除失败,数据不存在!\"}"; } context.Response.ContentType = "application/json"; context.Response.Write(json); context.ApplicationInstance.CompleteRequest(); }
/// <summary> /// 发起材料审批流程 /// </summary> /// <param name="context"></param> private void sendMaterialPlanList(HttpContext context) { string json = string.Empty; string Materialplanid = context.Request["Materialplanid"]; List <TBL_MATERIALPLAN> list = Bll.GetList(" Materialplanid='" + Materialplanid + "' ").ToList <TBL_MATERIALPLAN>(); if (list.Count > 0) { TBL_MATERIALPLAN model = list[0]; //获取流程单的状态 WorkFlow.Model.FLOW_TASK task = WorkFlow.BLL.Operate.GetTask(model.Processnumber); if (task != null) { if (task.STATUS != "0") { json = "{\"IsSuccess\":\"false\",\"Message\":\"发起失败,该计划已经发起审批!\"}"; } else { //发送流程 bool 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\":\"false\",\"Message\":\"发起失败,流程任务数据不存在!\"}"; } //json = "{\"IsSuccess\":\"true\",\"Message\":\"添加成功!\"}"; } else { json = "{\"IsSuccess\":\"false\",\"Message\":\"发起失败,数据不存在!\"}"; } context.Response.ContentType = "application/json"; context.Response.Write(json); context.ApplicationInstance.CompleteRequest(); }
/// <summary> /// 获取材料计划 /// </summary> /// <param name="context"></param> private void getMaterialPlan(HttpContext context) { string json = string.Empty; string Materialplanid = context.Request["Materialplanid"]; //材料计划ID string TASK_CODE = context.Request["TASK_CODE"]; //材料计划ID List <TBL_MATERIALPLAN> list = null; if (string.IsNullOrEmpty(TASK_CODE)) { list = Bll.GetList(" Materialplanid='" + Materialplanid + "'").ToList <TBL_MATERIALPLAN>(); } else { list = Bll.GetList(" Processnumber='" + TASK_CODE + "'").ToList <TBL_MATERIALPLAN>(); } //返回数据的格式 // string sql = "{单号:1,部门1,人员:1,project:[ {工程:1,detail:[{d:1},{d:2}]},{工程:2,detail:[{d:1},{d:2}},{工程:3,detail:[{d:1},{d:2}} ]}"; TBL_MATERIALPLAN model = null; if (list.Count > 0) { model = list[0]; Materialplanid = model.Materialplanid; List <TBL_MATERIALPLANPROJECT> list_proj = projBll.GetList(" Materialplanid='" + Materialplanid + "' ").ToList <TBL_MATERIALPLANPROJECT>(); foreach (TBL_MATERIALPLANPROJECT pro in list_proj) { List <TBL_MATERIALPLANPROJECTDETAIL> list_detail = detailBll.GetList(" Materialplanprojectid='" + pro.Materialplanprojectid + "' ").ToList <TBL_MATERIALPLANPROJECTDETAIL>(); pro.list_detail = list_detail; } model.list_project = list_proj; } else { json = "{\"IsSuccess\":\"false\",\"Message\":\"材料数据计划不存在!\"}"; } json = JsonConvert.SerializeObject(model); context.Response.ContentType = "application/json"; context.Response.Write(json); context.ApplicationInstance.CompleteRequest(); }