procedure Twmsbasreturndata.explainjson(strjson: string; detailename: string = ''; PlayVoice: Boolean = False);
var
jo: ISuperObject;
tempresult: string;
begin
if trim(strjson) = '' then
begin
yundawms.pummessage.ShowMsgDlg('提交的的请求没有返回任何数据!', MB_OK);
Presturnbool := false;
exit;
end;
if trim(strjson) <> '' then
begin
jo := SO(strjson);
if Assigned(jo['result']) then
begin
tempresult := jo['result'].AsString;
end;
PremarkTrue := '';
if Assigned(jo['remark']) then
begin
if Assigned(jo['remark']) then
PremarkTrue := jo['remark'].AsString;
end;
if tempresult = 'TRUE' then // 请求成功,将json反序列化,映射到实体
begin
Presturnbool := true;
jsondate := jo['data'];
if Assigned(jsondate['onhsWithSameCarrier']) then
jsondate := jsondate['onhsWithSameCarrier'];
if Assigned(jsondate['dptValue']) then
begin
jsonDptValue := SO(jsondate['dptValue'].AsString);
if Assigned(jsonDptValue['criteriaHead']) then
jsonCriteriaHeadValue := SO(jsonDptValue['criteriaHead'].AsString);
if Assigned(jsonDptValue['groupSorts']) then
jsonGroupSortsValue := SO(jsonDptValue['groupSorts'].AsString);
end;
jo := jo['data'];
if assigned(jo['cacheData']) then
jsondateCache.Parse(jo['cacheData'].AsString);
if Assigned(jo['currentPage']) then
begin
self.currentPage := inttostr(jo['currentPage'].AsInteger);
end;
if Assigned(jo['total']) then
begin
self.total := inttostr(jo['total'].AsInteger);
end;
if Assigned(jo['rows']) then
begin
jsonrows := jo['rows'];
self.rows := jo['rows'].AsString;
end;
if Assigned(jo['nodes']) then
begin
jsonNodes := jo['nodes'];
end;
if Assigned(jo['pcmlRecordLs']) then
begin
jsonRecordLs := jo['pcmlRecordLs'];
self.RecordLs := jo['pcmlRecordLs'].AsString;
end;
if Assigned(jo['pctRecord']) then
begin
jsonpctRecord := jo['pctRecord'];
end;
self.PackCaseNo := '';
if Assigned(jo['pclPackCaseNo']) then
begin
jsonPackCaseNo := jo['pclPackCaseNo'];
self.PackCaseNo := jo['pclPackCaseNo'].AsString;
end;
self.ExpressOrderNo := '';
if Assigned(jo['pclExpressOrderNo']) then
begin
jsonExpressOrderNo := jo['pclExpressOrderNo'];
self.ExpressOrderNo := jo['pclExpressOrderNo'].AsString;
end;
self.pclStatus := '';
if Assigned(jo['pclStatus']) then
begin
jsonStatus := jo['pclStatus'];
self.pclStatus := jo['pclStatus'].AsString;
end;
if detailename = '' then
begin
if Assigned(jo['details']) then
begin
jsondetails := jo['details'];
self.details := jo['details'].AsString;
end;
end
else
begin
if Assigned(jo[detailename]) then
begin
jsondetails := jo[detailename];
self.details := jo[detailename].AsString;
end;
end;
if Assigned(jo['picksbill']) then
begin
jsonpicksbill := jo['picksbill'];
picksbill := jo['picksbill'].AsString;
end;
if Assigned(jo['pageSize']) then
begin
self.pageSize := inttostr(jo['pageSize'].AsInteger);
end;
end
else if tempresult = 'FALSE' then // 请求失败,分析错误类型
begin
Presturnbool := false;
if pos('errorCode', strjson) > 0 then
begin
errorCode := jo['errorCode'].AsString; { 需要区别不同的errorCode,区别对的 }
if assigned(jo['remark']) then
remarkerro := jo['remark'];
addcodetoerrorCodelist(remarkerro);
end;
end;
end;
if tempresult = 'TRUE' then
begin
boolsucess := true
end
else
begin
boolsucess := false;
if (errorCode <> 'B2B_GOON_OUTBOUND_WITH_LACK_CONFIRM_EXP') then
begin
if self.Fexceptionlist.Count > 0 then
begin
if PlayVoice then
TWmsApplicationfunction.PlaywavBykeys('错误', 0); //播报语音
PluginManager.AppService.MessageDialog.ShowMsgDlg(Fexceptionlist.Text, MB_OK);
end;
end;
end;
end;