停车场管理软件发卡授权程序1

来源:誉澄智能 2012/6/28 19:19:48      点击:

  begin
            with qryComm do
            begin
                Close;
                SQL.Clear;
                if cbRepop.Checked then
                begin
                    SQL.Add('DELETE JY_Park_Card_Info WHERE 卡号 = ''' + lblPopCont.Caption + '''');
                    try
                        ExecSQL;
                    except
                        ;
                    end;
                end;
                qryCard.Close;
                qryCard.SQL.Clear;
                qryCard.SQL.Add('SELECT * FROM JY_Card_Infomation WHERE 卡号= ''' + lblPopCont.Caption + '''');
                qryCard.Open;
                qryCard.First;

                //ShowMessage(IntToStr(qryCard.RecordCount));
                pb.Max := qryCard.RecordCount;

                while not qryCard.Eof do
                begin
                    qryComm.Close;
                    qryComm.SQL.Clear;
                    qryComm.SQL.Add('INSERT JY_Park_Card_Info (卡号,用户编号,收费类型,组号,有效期起日期,有效期止日期,时间A,时间A1,时间B,时间B1,时间C,时间C1,时间D,时间D1,卡内金额,卡类,车牌号码,进出限制,安全级别,非时段收费,进出周时)');
                    qryComm.SQL.Add('VALUES (''' + qryCard.FieldByName('卡号').AsString + ''','''
                                + qryCard.FieldByName('持卡人编号').AsString+ ''','
                                + tt1 + ','
                                + qryCard.FieldByName('持卡人编号').AsString+ ','''
                                + DateToStr(dtppopf.Date) + ''','''
                                + DateToStr(dtppopt.Date) + ''','''
                                +  timeTostr(dtp_Ent_Timeslice1.Time)+ ''','''
                                +  timeTostr(dtp_Ent_Timeslice2.Time)+ ''','''
                                +  timeTostr(dtp_Ent_Timeslice3.Time)+ ''','''
                                +  timeTostr(dtp_Ent_Timeslice4.Time)+ ''','''
                                +  timeTostr(dtp_Ent_Timeslice5.Time)+ ''','''
                                +  timeTostr(dtp_Ent_Timeslice6.Time)+ ''','''
                                +  timeTostr(dtp_Ent_Timeslice7.Time)+ ''','''
                                +  timeTostr(dtp_Ent_Timeslice8.Time)+ ''','
                                + EditAcount.Text + ','''
                                + IntToStr(cmbCardType.ItemIndex + 1)+''','''
                                + ttsrt +''','''
                                + quanxian +''','''+ anquanjibi+''','''+sflxA +''','''+xingqi+''')');
                    try
                        qryComm.execsql;
                    except
                        ShowMessage('授权失败,请确定该卡的授权信息是否已经存在!');
                        Exit;
                    end;
                    dm.WriteLog(qryCard.FieldByName('卡号').AsString,
                                '停车场','授权',now, fee, LocalUser.Name);
                    pb.Position := pb.Position + 1;
                    qryCard.Next;
                end;
            end;
        end;
    end;
    tvCardOwnerChange(nil, tvCardOwner.Selected);
    RefreshCard;
   // ShowMessage('注意:如果采用了主控制器,授权完毕后,请在”停车场服务器“软件上对主控制器资料更新!');
    pb.Position := 0;