/// <summary> /// 新增 /// </summary> /// <param name="context"></param> private void add(HttpContext context) { string json = string.Empty; try { TBL_TUNNELLINGPROJECT model = new TBL_TUNNELLINGPROJECT(); model.Tunnellingprojectid = ComFunction.GetId(); model.Tunnellingprojectname = context.Request["Tunnellingprojectname"]; model.Section = context.Request["Section"]; model.Coalrocktype = context.Request["Coalrocktype"]; model.Supportform = context.Request["Supportform"]; model.Tunneltype = context.Request["Tunneltype"]; model.Tunnelnature = context.Request["Tunnelnature"]; model.Designamount = decimal.Parse(context.Request["Tunnellingprojectname"]); bool re = bll.Insert(model); if (re) { json = "{\"IsSuccess\":\"true\",\"Message\":\"添加成功!\"}"; } else { json = "{\"IsSuccess\":\"false\",\"Message\":\"添加失败!\"}"; } } catch (Exception ex) { json = "{\"IsSuccess\":\"false\",\"Message\":\"添加出错" + ex.ToString() + "!\"}"; } context.Response.ContentType = "application/json"; context.Response.Write(json); context.ApplicationInstance.CompleteRequest(); }
/// <summary> /// 新增材料验收计划 /// </summary> /// <param name="context"></param> private void addMaterialCheck(HttpContext context) { string json = string.Empty; //返回数据的格式 WZGL.MODEL.Plan.TBL_MATERIALCHECKANDACCEPT model = new MODEL.Plan.TBL_MATERIALCHECKANDACCEPT(); //材料计划 string checkid = ComFunction.GetId(); //计划主键ID string project = context.Request["data"]; string type = context.Request["type"]; try { List <TBL_MATERIALCHECKANDACCEPT> list = JsonConvert.DeserializeObject <List <WZGL.MODEL.Plan.TBL_MATERIALCHECKANDACCEPT> >(project); if (list.Count > 0) { list[0].Materialcheckandacceptid = checkid; model = list[0]; //model.ADD_EMP = CFunctions.getUserId(context); foreach (TBL_MATERIALCHECKANDACCEPT_DETAIL mpj in model.list_detail) { mpj.Materialcheckandacceptid = checkid; mpj.Materialcheckandaccept_detailid = ComFunction.GetId();//详细主键ID } bool re = WZGL.BLL.BllFactory.GetMaterialcheckandacceptBLL().Insert(model);//插入采购计划数据 if (re) { 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(); }
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(); }
/// <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(); }
/// <summary> /// 修改采购计划 /// </summary> /// <param name="context"></param> private void editPurchasePlan(HttpContext context) { string json = string.Empty; //返回数据的格式 WZGL.MODEL.Plan.TBL_PURCHASEPLAN model = new MODEL.Plan.TBL_PURCHASEPLAN();//采购计划 // string planid = "";// ComFunction.GetId();//计划主键ID 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) { model = list[0]; foreach (TBL_PURCHASEPLAN_DETAIL detail in model.list_detail) { string mpjid = ComFunction.GetId();//计划主键ID detail.Purchaseplanid = model.Purchaseplanid; detail.Purchaseplandetailid = mpjid; } WorkFlow.Model.FLOW_TASK task = WorkFlow.BLL.Operate.GetTask(model.Processnumber);//先获取任务单看看状态是否已启动了 bool re = false; if (task == null) { json = "{\"IsSuccess\":\"false\",\"Message\":\"发起失败,流程任务数据不存在!\"}"; } else //if (task.STATUS == "0") { re = WZGL.BLL.BllFactory.GetPurchaseplanBLL().Update(model);//更新数据 string message = ""; re = WorkFlow.BLL.Operate.UpdateTaskJson(model.Processnumber, project, ref message);//更新任务单保存的业务json数据 if (re) { 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\":\"审批中的流程材料单无法编辑!\"}"; //} } 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(); }
/// <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(); }
/// <summary> /// 修改材料计划 /// </summary> /// <param name="context"></param> private void editMaterialPlan(HttpContext context) { string json = string.Empty; //返回数据的格式 WZGL.MODEL.Plan.TBL_MATERIALPLAN model = new MODEL.Plan.TBL_MATERIALPLAN();//材料计划 // string planid = "";// ComFunction.GetId();//计划主键ID string project = context.Request["data"]; string reason = context.Request["reason"]; 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]; foreach (TBL_MATERIALPLANPROJECT mpj in model.list_project) { string mpjid = ComFunction.GetId();//计划主键ID mpj.Materialplanid = model.Materialplanid; mpj.Materialplanprojectid = mpjid; foreach (TBL_MATERIALPLANPROJECTDETAIL mpjd in mpj.list_detail) { mpjd.Materialplanprojectdetailid = ComFunction.GetId();//计划主键ID mpjd.Materialplanprojectid = mpjid; } } WorkFlow.Model.FLOW_TASK task = WorkFlow.BLL.Operate.GetTask(model.Processnumber); bool re = false; re = WZGL.BLL.BllFactory.GetMaterialplanBLL().Update(model); // if (task != null && task.STATUS == "0") //{ re = WZGL.BLL.BllFactory.GetMaterialplanBLL().Update(model); string message = ""; re = WorkFlow.BLL.Operate.UpdateTaskJson(model.Processnumber, project, ref message); if (re) { if (type == "send") { if (task != null) { if (task.STATUS != "0") { json = "{\"IsSuccess\":\"false\",\"Message\":\"发起失败,该计划的流程正在审批中!\"}"; } else { //发送流程 re = WorkFlow.BLL.Operate.StartFlow(task.TASK_CODE, task.DEFINE_CODE, CFunctions.getUserId(context), reason); if (re) { json = "{\"IsSuccess\":\"true\",\"Message\":\"发起成功!\"}"; } else { json = "{\"IsSuccess\":\"false\",\"Message\":\"发起失败!\"}"; } } } else { json = "{\"IsSuccess\":\"false\",\"Message\":\"发起失败,流程任务数据不存在!\"}"; } } else { json = "{\"IsSuccess\":\"true\",\"Message\":\"修改成功!\"}"; } } else { json = "{\"IsSuccess\":\"false\",\"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(); }