{"id":3069,"date":"2024-09-03T13:53:26","date_gmt":"2024-09-03T05:53:26","guid":{"rendered":"http:\/\/www.plm.cn\/?p=3069"},"modified":"2024-09-03T15:40:00","modified_gmt":"2024-09-03T07:40:00","slug":"mobox3-lua-%e5%bc%80%e5%8f%91%e8%bf%87%e7%a8%8b%e4%b8%ad%e6%95%b0%e6%8d%ae%e8%8e%b7%e5%8f%96%e5%8f%8ajson%e6%a0%bc%e5%bc%8f%e5%a4%84%e7%90%86","status":"publish","type":"post","link":"http:\/\/www.plm.cn\/3069\/","title":{"rendered":"mobox3 lua \u5f00\u53d1\u8fc7\u7a0b\u4e2d\u6570\u636e\u83b7\u53d6\u53caJson\u683c\u5f0f\u5904\u7406"},"content":{"rendered":"
lua \u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u5bf9\u5f53\u524d\u7a97\u4f53\u7684\u6570\u636e\u8fdb\u884c\u83b7\u53d6\uff0c\u4e4b\u540e\u8fdb\u884c\u4e8c\u6b21\u5f00\u53d1\u6f14\u53d8\u4e3a\u6211\u4eec\u9700\u8981\u7684\u6570\u636e\uff0c\u5e76\u91cd\u65b0\u7ed9\u7a97\u4f53\u7684\u5404\u5b57\u6bb5\u8d4b\u503c\u3002<\/p>\n
nRet, strRetInfo = mobox.getCurEditDataObjAttr(strLuaDEID, “G_PRJ_ID”, “S_PRJ_CODE”, “S_PRJ_NAME”, “S_PM_NAME”, “S_PD_NAME”)<\/p><\/blockquote>\n<\/div>\n
2\u3001\u5f97\u5230Json\u5b57\u7b26\u4e32\uff08strRetInfo\uff09\u5185\u5bb9\u63cf\u8ff0\uff08\u6682\u4e14\u6211\u4eec\u79f0\u4e4b\u4e3a mobox3 \u683c\u5f0f\uff09<\/h3>\n
\n\n[<\/pre>\n{<\/p>\n
“attr”: “G_PRJ_ID”,<\/p>\n
“value”: “”<\/p>\n
},<\/p>\n
{<\/p>\n
“attr”: “S_PRJ_CODE”,<\/p>\n
“value”: “PM-0002”<\/p>\n
},<\/p>\n
{<\/p>\n
“attr”: “S_PRJ_NAME”,<\/p>\n
“value”: “pcy 0999 hard”<\/p>\n
},<\/p>\n
{<\/p>\n
“attr”: “S_PM_NAME”,<\/p>\n
“value”: “\u91d1\u632f\u5174”<\/p>\n
},<\/p>\n
{<\/p>\n
“attr”: “S_PD_NAME”,<\/p>\n
“value”: “”<\/p>\n
}
\n]<\/p><\/blockquote>\n<\/div>\n3\u3001\u5c06\u5f97\u5230\u7684Json\u5b57\u7b26\u4e32\uff08strRetInfo\uff09\u8f6c\u53d8\u4e3aJson\u6807\u51c6\u7684\u8868\u683c\u5f0f\uff08strOBJInfo \uff09<\/h3>\n
\nnRet, strOBJInfo = mobox.objAttrToObjJson (‘JS001’, strRetInfo )<\/p><\/blockquote>\n<\/div>\n
\u6ce8\u610f\uff1astrOBJInfo \u5f97\u5230\u5176\u5b9e\u8fd8\u662f\u4e00\u4e2aJson\u5b57\u7b26\u4e32\uff0c\u4f46\u5176\u662f\u4e00\u4e2a\u6807\u51c6\u7684Json\u8868\u683c\u5f0f\u8868\u8fbe<\/p>\n
\u5177\u4f53 objAttrToObjJson \u51fd\u6570\u600e\u4e48\u7528\u67e5\u770b\u624b\u518c<\/p>\n
4\u3001\u5f97\u5230Json\u8868\u5b57\u7b26\u4e32\uff08strOBJInfo \uff09\uff08\u662f\u4e00\u79cd json\u5bf9\u8868\u7684\u6807\u51c6\u683c\u5f0f\uff09<\/h3>\n
\n\n{<\/pre>\n“cls”: “JS001”,<\/p>\n
“ver”: 1,<\/p>\n
“G_PRJ_ID”: “”,<\/p>\n
“S_PRJ_CODE”: “PM-0002”,<\/p>\n
“S_PRJ_NAME”: “pcy 0999 hard”,<\/p>\n
“S_PM_NAME”: “\u91d1\u632f\u5174”
\n}<\/p><\/blockquote>\n<\/div>\n\u6ce8\u610f\uff1a\u8fd9\u4e2aJson\u683c\u5f0f\u662f\u6807\u51c6\u8868\u683c\u5f0f\u5b57\u7b26\u4e32\u8868\u8fbe\u3002<\/p>\n
5\u3001\u6211\u4eec\u9700\u8981\u5c06\u8fd9\u4e2a\u5b57\u7b26\u4e32\u8f6c\u4e3a\u8868\uff08tbOBJ\uff09<\/h3>\n
\nlocal tbOBJ = json.decode (strOBJInfo)<\/p><\/blockquote>\n<\/div>\n
\u6ce8\uff0c\u53ea\u6709\u53d8\u6210\u8868\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u8fd9\u6837\u6765\u7406\u89e3\u8fd9\u4e2a\u8868\uff1a<\/p>\n
\n\n
\n \u5b57\u6bb5\u540d<\/td>\n cls<\/td>\n ver<\/td>\n G_PRJ_ID<\/td>\n S_PRJ_CODE<\/td>\n S_PRJ_NAME<\/td>\n S_PM_NAME<\/td>\n<\/tr>\n \n \u6570\u503c<\/td>\n JS001<\/td>\n 1<\/td>\n <\/td>\n PM-0002<\/td>\n pcy 0999 hard<\/td>\n \u91d1\u632f\u5174<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n 6\u3001\u6570\u636e\u53d6\u503c\u4e0e\u8d4b\u503c<\/h3>\n
\u53d6\u503c\u65b9\u6cd5\uff1a<\/span><\/p>\n
local strPMName<\/p>\n
strPMName = tbOBJ.S_PRJ_NAME<\/p>\n
\u8d4b\u503c\u65b9\u6cd5\uff1a<\/span><\/p>\n
tbOBJ.S_PRJ_NAME = ‘\u6f58\u5143\u5143’<\/p>\n
<\/p>\n
\u5b8c\u6574\u4ee3\u7801<\/h4>\n
\nlocal strRetInfo , strOBJInfo<\/p>\n
local tbOBJ ={}<\/p>\n
<\/p>\n
— \u5f97\u5230\u5f53\u524d\u7a97\u4f53\u4e0a\u6307\u5b9a\u5b57\u6bb5\u7684json\u5b57\u7b26\u4e32
\nnRet, strRetInfo = mobox.getCurEditDataObjAttr(strLuaDEID, “G_PRJ_ID”, “S_PRJ_CODE”, “S_PRJ_NAME”, “S_PM_NAME”, “S_PD_NAME”)<\/p>\n— \u5c06json\u5b57\u7b26\u4e32\uff08mobox3\uff09\u683c\u5f0f\u8f6c\u4e3a json\u6807\u51c6\u8868\u683c\u5f0f
\nnRet, strOBJInfo = mobox.objAttrToObjJson (‘JS001’, strRetInfo )<\/p>\n–\u5c06json\u5b57\u7b26\u4e32\u8f6c\u53d8\u4e3a\u8868
\ntbOBJ = json.decode (strOBJInfo)<\/p>\n<\/p>\n
— \u83b7\u53d6\u8868\u5b57\u6bb5\u5185\u5bb9\u53ca\u8bbe\u7f6e\u8868\u5b57\u6bb5\u503c
\nlocal strPMName
\nstrPMName = tbOBJ.S_PM_NAME
\ntbOBJ.S_PM_NAME = ‘\u6f58\u5143\u5143’<\/p>\n<\/p>\n
\u82e5\u9700\u8981\u5c06\u6570\u636e\u8f6c\u4f1amobox3\u6570\u636e\u683c\u5f0f<\/p>\n
–\u5c06\u8868\u8f6c\u53d8\u4e3ajson\u5b57\u7b26\u4e32\uff08\u6807\u51c6\u683c\u5f0f\uff09
\nstrOBJInfo = json.encode (tbOBJ)<\/p>\n— \u5c06json\u6807\u51c6\u8868\u683c\u5f0f\u683c\u5f0f\u8f6c\u4e3a json\u5b57\u7b26\u4e32\uff08mobox3\uff09
\nnRet, strRetInfo = mobox.objJsonToObjAttr (‘JS001’, strOBJInfo )<\/p><\/blockquote>\n<\/div>\n<\/p>\n
<\/p>\n
<\/p>\n
<\/p>\n","protected":false},"excerpt":{"rendered":"
lua \u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u5bf9\u5f53\u524d\u7a97\u4f53\u7684\u6570\u636e\u8fdb\u884c\u83b7\u53d6\uff0c\u4e4b\u540e\u8fdb\u884c\u4e8c\u6b21\u5f00\u53d1\u6f14\u53d8\u4e3a\u6211\u4eec\u9700\u8981\u7684\u6570\u636e\uff0c\u5e76\u91cd\u65b0\u7ed9\u7a97\u4f53\u7684\u5404\u5b57 […]<\/p>\n","protected":false},"author":1,"featured_media":3070,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,9,1],"tags":[31,13],"class_list":["post-3069","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-plmcenter","category-pcdoc","category-didaima","tag-didaima","tag-shouche"],"_links":{"self":[{"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/posts\/3069","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/comments?post=3069"}],"version-history":[{"count":8,"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/posts\/3069\/revisions"}],"predecessor-version":[{"id":3078,"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/posts\/3069\/revisions\/3078"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/media\/3070"}],"wp:attachment":[{"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/media?parent=3069"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/categories?post=3069"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/tags?post=3069"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}