Files
MesUniversalApi-Migration/working/MESCommonBase流程图.mmd

59 lines
3.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
%% MESCommonBase.ashx 主流程图
flowchart TD
START([HTTP 请求<br/>MES_Manage/submit/MESCommonBase.ashx])
READ[ProcessRequest<br/>设置 ContentType=application/json<br/>读取 Request.InputStream]
PARSE1[JsonMapper.ToObject(stream)<br/>尝试读取 Type / type]
PARSE2[JavaScriptSerializer.Deserialize&lt;jsonobj&gt;(stream)<br/>成功后用 dataobj.Type 覆盖 type]
PARAM{dataobj == null?}
PARAMYES[读取 Request["param"]<br/>再次按 JSON 解析 Type / type]
SWITCH{switch(type)}
START --> READ --> PARSE1 --> PARSE2 --> PARAM
PARAM -->|是| PARAMYES --> SWITCH
PARAM -->|否| SWITCH
SWITCH -->|2001| T2001[Excel 导出<br/>ExcelWebCall.ExcelFile(jsonData)<br/>生成 bytes/fileName/extension]
SWITCH -->|2002| T2002[PDF 导出<br/>ExcelWebCall.ExcelFilePdf(jsonData)<br/>Excel 转 PDF]
SWITCH -->|2003| T2003[合成 Excel 图片/指定扩展名导出<br/>读取 Form 第一项 dataimg[0]<br/>ExcelWebCall.ExcelFile(jsonData)]
SWITCH -->|2004| T2004[数据库文件下载<br/>DataLink.ExePROCEDURE_Type2004(jsonData)<br/>返回 bytes/fileName/fileExtension]
SWITCH -->|15| T15[文件上传<br/>读取 Request.Files[0]<br/>拆分 name/suffix/bytes<br/>DataLink.ExePROCEDURE_Type15]
SWITCH -->|16| T16[数据库文件下载<br/>DataLink.ExePROCEDURE_Type16(jsonData)<br/>返回 fileName/suffix/bytes]
SWITCH -->|4000| T4000[IP 查询<br/>读取 ServerVariables / UserHostAddress]
SWITCH -->|default| DEFAULT[通用业务调用<br/>DataLink.SqlWebCall(type,jsonData,dataobj)]
T2001 --> DOWNLOAD[二进制下载响应<br/>Content-Type=application/octet-stream<br/>Content-Disposition=attachment<br/>BinaryWrite + Flush/End]
T2002 --> DOWNLOAD
T2003 --> DOWNLOAD
T2004 --> DOWNLOAD
T16 --> BYTESNULL{bytes == null?}
BYTESNULL -->|是| RETURNEMPTY[直接 return<br/>不写响应体]
BYTESNULL -->|否| DOWNLOAD
T15 --> JSONRESP[JSON 文本响应<br/>Response.Write(responseText)]
T4000 --> IPRESP[文本响应<br/>Response.Write(userIP)]
DEFAULT --> SQLWEB
subgraph SQLWEB[DataLink.SqlWebCall 默认分支]
S1[初始化连接<br/>InitSystemReg 读取 Web.config: ConnectionString]
S2{按 type 再分发}
S3[登录/加密<br/>8888: GetEncryptStr<br/>5001: AddUser/改密<br/>5002: Login/生成 token]
S4[旧协议存储过程<br/>1/2/5<br/>Param 为拼接字符串]
S5[新协议存储过程<br/>11/111/12/13/21<br/>Param 为 JSON 数组字符串]
S6[直接 SQL / 导入<br/>1001/1002/3/4/7/22/3001]
S7[返回 JSON<br/>数组 JSON 或 {code,message,data}]
S1 --> S2
S2 --> S3 --> S7
S2 --> S4 --> S7
S2 --> S5 --> S7
S2 --> S6 --> S7
end
SQLWEB --> JSONRESP
DOWNLOAD --> END([请求结束])
JSONRESP --> END
IPRESP --> END
RETURNEMPTY --> END
READ -. 外层 try/catch异常被吞掉写出当前 responseText初始为 NULL .-> CATCH[异常处理<br/>catch(Exception err)<br/>Response.Write(responseText)]
CATCH --> END