/// <summary> /// 调单添加界面 /// </summary> /// <returns></returns> public ActionResult Adddispatchorder() { int did = string.IsNullOrEmpty(Request["did"]) ? 0 : Int32.Parse(Request["did"]); string where = ""; where = did > 0 ? " t_state='1' and t_id =(select d_apptyeid from jmp_dispatchorder where d_id=" + did + " ) and t_topid=0" : " t_state='1' and t_id not in( select d_apptyeid from jmp_dispatchorder ) and t_topid=0"; JMP.BLL.jmp_apptype yybll = new JMP.BLL.jmp_apptype(); DataTable yydt = yybll.GetList(where).Tables[0];//获取应用类型在用信息 List <JMP.MDL.jmp_apptype> yylist = JMP.TOOL.MdlList.ToList <JMP.MDL.jmp_apptype>(yydt); ViewBag.yylist = yylist; JMP.BLL.jmp_dispatchorder bll = new JMP.BLL.jmp_dispatchorder(); JMP.MDL.jmp_dispatchorder mode = new JMP.MDL.jmp_dispatchorder(); if (did > 0) { mode = bll.GetModel(did) == null ? new JMP.MDL.jmp_dispatchorder() : bll.GetModel(did); } ViewBag.mode = mode; return(View()); }
/// <summary> /// 添加或修改调单设置 /// </summary> /// <param name="mo"></param> /// <returns></returns> public JsonResult AddOrUpdatedispatchorder(JMP.MDL.jmp_dispatchorder mo) { object retJson = new { success = 0, msg = "操作失败" }; JMP.BLL.jmp_dispatchorder bll = new JMP.BLL.jmp_dispatchorder(); if (mo.d_id > 0) { JMP.MDL.jmp_dispatchorder mod = new JMP.MDL.jmp_dispatchorder(); mod = bll.GetModel(mo.d_id); mo.d_state = mod.d_state; mo.d_datatime = DateTime.Now; if (bll.Update(mo)) { #region 日志说明 Logger.ModifyLog("修改调单设置", mod, mo); #endregion retJson = new { success = 1, msg = "编辑成功!" }; } else { retJson = new { success = 0, msg = "编辑失败!" }; } } else { mo.d_datatime = DateTime.Now; mo.d_state = 0; int cg = bll.Add(mo); if (cg > 0) { Logger.CreateLog("添加调单设置", mo); retJson = new { success = 1, msg = "添加成功!" }; } else { retJson = new { success = 0, msg = "添加失败!" }; } } return(Json(retJson)); }