//两个函数系项目中直接截取,自己对变量进行理解
procedure TFrmMenu2wz.btnSelectClick(Sender: TObject);//查询数据库后写入listview
var
sqlSelect: string;
wzInfoList: ArrayOfDcBean;
wzInfo: ArrayOfDcObj;
i, j: Integer;
tmpListItem: TListItem;
begin
inherited;
sqlSelect := 'select pwz.checkdate as ckrq,10000 as ckdw,' //0 ckrq 1 ckdw
+ ' pwz.checkplace as ckdd, pwz.holdinfo as zkzj, pwz.endcasetype dqzt, '
+ ' 10000 as cljg,' // 2 ckdd 3 zkzj 4 dqzt 5 cljg 6 ah 7 cphm 8 cpys 9 yhmc 10 cllxxl 11 cljxxl 12 cljyfwxl
+ ' pwz.id as ah, bcl.vehnumcode as cphm,getDtrinfo(bcl.vehnumcolor) as cpys,byh.CoName as yhmc,'
+ ' getDtrinfo(bcl.vehtype) as cllxxl, getDtrinfo(bcl.vehlevel) cljxxl,'
+ ' getDtrinfo(bcl.workrange2) as cljyfwxl,acyry.name as cyryxm,acyry.certcardid as cyzgzh ,'
+ ' acyry.idcard as sfzh,acyry.telno as lxfs,pwz.peccinfo as wzyy, ec.remark as bz '
+ ' from Tbl_pecc_peccinfo pwz' // 13 cyryxm 14 cyzgzh 15 sfzh 16 lxfs 17 wzyy 18 bz
+ ' left join Tbl_veh_baseinfo bcl on pwz.vehid=bcl.id and pwz.vehid is not null and bcl.id is not null '
// + ' left join Tbl_pecc_peccaction pwzxw on pwz.id=pwzxw.peccid and pwz.id is not null and pwzxw.peccid is not null '
+ ' left join tbl_co_BaseInfo byh on bcl.coid=byh.id and bcl.coid is not null and bcl.coid is not null '
+ ' left join tbl_Train_Archives acyry on acyry.certcardid=pwz.cyrycard and acyry.certcardid is not null and pwz.cyrycard is not null'
+ ' left join tbl_Pecc_EndCase ec on ec.id=pwz.id and ec.id is not null where 1=1 ';
lv1.Clear;
wzInfoList := WebService.GetWebServiceWzxx(sqlSelect);//获取数据集
lblSum.Caption := IntToStr(Length(wzInfoList));
if wzInfoList = nil then
begin
ShowMessage('查无违章信息!');
Exit;
end;
for i := 0 to Length(wzInfoList) - 1 do //遍历对象中的多有行
begin
wzInfo := wzInfoList[i].objArray;//取出一行记录
// ShowMessage(IntToStr(Length(wzInfo))); //目前为20列信息
tmpListItem := lv1.Items.Add;//定位行的关键
tmpListItem.Caption := Trim(wzInfo[7].value); //7 cphm 车牌号码
tmpListItem.SubItems.Add(Trim(wzInfo[8].value)); //8 cpys 车牌颜色
tmpListItem.SubItems.Add(Trim(wzInfo[9].value)); //9 yhmc业户名称
tmpListItem.SubItems.Add(Trim(wzInfo[0].value)); //0 ckrq 查扣日期
tmpListItem.SubItems.Add(Trim(wzInfo[17].value)); //17 wzyy违章原因
//当前状态显示 4 dqzt 当前状态
if Trim(wzInfo[4].value) = '0' then
begin
tmpListItem.SubItems.Add(Trim('未结案'));
end else if Trim(wzInfo[4].value) = '1' then
begin
tmpListItem.SubItems.Add(Trim('正常结案'));
end else if Trim(wzInfo[4].value) = '2' then
begin
tmpListItem.SubItems.Add(Trim('免交罚款'));
end else
begin
tmpListItem.SubItems.Add(Trim(wzInfo[4].value));
end;
tmpListItem.SubItems.Add(Trim(wzInfo[5].value)); //5 cljg 处理结果
tmpListItem.SubItems.Add(Trim(wzInfo[1].value)); //1 ckdw 查扣单位
tmpListItem.SubItems.Add(Trim(wzInfo[2].value)); //2 ckdd 查扣地点
tmpListItem.SubItems.Add(Trim(wzInfo[3].value)); //3 zkzj 暂扣证件
tmpListItem.SubItems.Add(Trim(wzInfo[6].value)); //6 ah 案件编号
tmpListItem.SubItems.Add(Trim(wzInfo[10].value)); //10 cllxxl 车辆类型小类
tmpListItem.SubItems.Add(Trim(wzInfo[11].value)); // 11 cljxxl 车辆级型小类
tmpListItem.SubItems.Add(Trim(wzInfo[12].value)); //12 cljyfwxl 车辆经营范围小类
tmpListItem.SubItems.Add(Trim(wzInfo[13].value)); //13 cyryxm 从业人员姓名
tmpListItem.SubItems.Add(Trim(wzInfo[14].value)); //14 cyzgzh 从业资格证号
tmpListItem.SubItems.Add(Trim(wzInfo[15].value)); // 15 sfzh 身份证号
tmpListItem.SubItems.Add(Trim(wzInfo[16].value)); //16 lxfs 联系方式
tmpListItem.SubItems.Add(Trim(wzInfo[18].value)); // 18 bz 备注
// tmpListItem.SubItems.Add(Trim(wzInfo[19].value));
// tmpListItem.SubItems.Add(Trim(wzInfo[20].value));
//Application.ProcessMessages;
end;
end;
//listview中信息读取 此处是用于双击显示
procedure TFrmMenu2wz.lv1DblClick(Sender: TObject);
begin
FrmMenu2wzXq := TFrmMenu2wzXq.Create(Self);
try
if lv1.Selected<>nil then //判断记录是否选中
begin
with FrmMenu2wzXq do
begin
edtCpxx.Text := lv1.Selected.Caption + Trim(lv1.Selected.SubItems[0]);
edtCllxxl.Text := Trim(lv1.Selected.SubItems[10]);
edtCljxxl.Text := Trim(lv1.Selected.SubItems[11]);
edtJyfwxl.Text := Trim(lv1.Selected.SubItems[12]);
edtYhmc.Text := Trim(lv1.Selected.SubItems[1]);
edtDsrxm.Text := Trim(lv1.Selected.SubItems[13]);
edtZgzh.Text := Trim(lv1.Selected.SubItems[14]);
edtSfzh.Text := Trim(lv1.Selected.SubItems[15]);
edtLxfs.Text := Trim(lv1.Selected.SubItems[16]);
edtAh.Text := Trim(lv1.Selected.SubItems[9]);
edtWzyy.Text := Trim(lv1.Selected.SubItems[3]);
edtZkzj.Text := Trim(lv1.Selected.SubItems[8]);
edtCkrq.Text := Trim(lv1.Selected.SubItems[2]);
edtCkdw.Text := Trim(lv1.Selected.SubItems[6]);
edtCkdd.Text := Trim(lv1.Selected.SubItems[7]);
edtDqzt.Text := Trim(lv1.Selected.SubItems[4]);
edtCljg.Text := Trim(lv1.Selected.SubItems[5]);
mmoBz.Text := Trim(lv1.Selected.SubItems[17]);
end;
end else
begin
ShowMessage('请先选中记录!');
Exit;
end;
FrmMenu2wzXq.ShowModal;
finally
FrmMenu2wzXq.Free;
end;
end;