using BP.DA; using BP.Difference; using BP.En; using BP.Sys; using BP.Web; using BP.WF; using BP.WF.HttpHandler; using BP.WF.Template; using System; using System.Collections; using System.Data; using System.Net.Http; using System.Web.Http; using System.Web.Http.Cors; namespace CCFlow.DataUser.API.Controllers { [EnableCors("*", "*", "*")] public class VSTOExcel : ApiController { #region 1. 表单设计器. TemplateDesinger /// /// 初始化:获得表单模板. /// /// /// /// [HttpGet, HttpPost] public Object TemplateDesinger_Init(string token, string frmID) { //根据token登录. BP.WF.Dev2Interface.Port_LoginByToken(token); if (WebUser.IsAdmin == false) return "err@没有权限."; try { MapData md = new MapData(frmID); //获得数据. byte[] dd = DBAccess.GetByteFromDB(md.PTable, "No", md.No, frmID + "ExcelFile", false); //需要完善. 原来是什么? ExcelFile就叫什么名字. return Return_Info(200, "执行成功", ""); } catch (Exception ex) { return Return_Info(500, "失败", ex.Message); } } /// /// 保存模板 /// /// token /// 表单ID /// 二级制文件 /// 是否成功 [HttpGet, HttpPost] public Object TemplateDesinger_Save(string token, string frmID, byte[] byt) { //根据token登录. BP.WF.Dev2Interface.Port_LoginByToken(token); try { MapData md = new MapData(frmID); DBAccess.SaveBytesToDB(byt,md.PTable, "No", md.No, frmID + "ExcelFile"); return Return_Info(200, "执行成功", ""); } catch (Exception ex) { return Return_Info(500, "失败", ex.Message); } } #endregion 1. 表单设计器. TemplateDesinger #region 2. 表单组件. /// /// 初始化方法 /// /// /// /// /// [HttpGet, HttpPost] public Object Frm_Init(string token, string frmID, Int64 workID) { //根据token登录. BP.WF.Dev2Interface.Port_LoginByToken(token); try { GenerWorkFlow gwf = new GenerWorkFlow(workID); return Return_Info(200, "执行成功", gwf.ToJson()); } catch (Exception ex) { return Return_Info(500, "失败", ex.Message); } } /// /// 保存方法 /// /// /// /// /// 二级制文件 /// 主表数据 /// 从表数据 /// public Object Frm_Save(string token, string frmID, Int64 workID, byte[] val,Hashtable ht, DataSet ds) { //根据token登录. BP.WF.Dev2Interface.Port_LoginByToken(token); try { GenerWorkFlow gwf = new GenerWorkFlow(workID); return Return_Info(200, "执行成功", gwf.ToJson()); } catch (Exception ex) { return Return_Info(500, "失败", ex.Message); } } #endregion 2. 表单组件. #region 3. 打印组件. /// /// 打印组件 /// /// /// /// /// [HttpGet, HttpPost] public Object FrmPrinter_Init(string token, string frmID, Int64 workID) { return Frm_Init(token, frmID, workID); } /// /// 保存打印,没有主从表的数据. /// /// /// /// /// /// [HttpGet, HttpPost] public Object FrmPrinter_Save(string token, string frmID, Int64 workID, byte[] val) { return Frm_Save(token, frmID, workID, val,null,null); } #endregion 3. 打印组件. #region 4. 工作处理器. /// /// 工具栏初始化 /// /// /// /// /// [HttpGet, HttpPost] public Object MyFlow_Init_Toolbar(string token, string flowNo, Int64 workID) { return null; } /// /// 工作初始化 /// /// /// /// /// [HttpGet, HttpPost] public Object MyFlow_Init_Work(string token, string frmID, Int64 workID) { return null; } /// /// 工作保存:与vsto的保存类似 /// /// /// /// /// /// /// /// [HttpGet, HttpPost] public Object MyFlow_Save(string token, string frmID, Int64 workID, byte[] mybyte, Hashtable ht, DataSet ds) { return null; } #endregion 4. 工作处理器. #region 5. 附件助手. /// /// 初始化 /// /// /// /// /// /// /// [HttpGet, HttpPost] public Object AthHelper_Init(string token, string frmID, Int64 workID, string athNo, string athDBID) { return null; } /// /// 保存附件 /// /// /// /// /// [HttpGet, HttpPost] public Object AthHelper_Save(string token, string frmID, Int64 workID, string athNo, string athDBID) { return null; } #endregion 5. 附件助手. #region 0. 公共方法. /// /// 返回信息格式 /// /// /// /// /// public static Object Return_Info(int code, string msg, string data) { Hashtable ht = new Hashtable(); ht.Add("code", code); ht.Add("message", msg); ht.Add("data", data); return ht; } #endregion 0. 公共方法. } }