📄 gf_pfxjh.pas
字号:
end;
end;
data.DM.StartTransaction;
try
if (vlp_status = 1) then//add
case vlp_FocusGrid.Tag of
0://tao
AddTaoInTrans;
1://tu
AddTuInTrans(vl_i_xgzt);
end
else//edit
case vlp_FocusGrid.Tag of
0://tao
if vl_i_xgzt<>0 then
begin
if DBLCB_tao_pplb.Field.OldValue <> DBLCB_tao_pplb.Field.NewValue then
begin
with Query1 do
begin
Close;
SQL.Text := 'update TF_PFXJHTU set PPLB='''+Qry_pfxjhtao.FieldByName('PPLB').AsString+''' where JHH='''+Qry_pfxjhtao.FieldByName('JHH').AsString+'''';
ExecSQL;
Close;
end;
end;
if DBLCB_tao_tz.Field.OldValue <> DBLCB_tao_tz.Field.NewValue then
begin
with Query1 do
begin
Close;
SQL.Text := 'update TF_PFXJHTU set TZDM='''+Qry_pfxjhtao.FieldByName('TZDM').AsString+''' where JHH='''+Qry_pfxjhtao.FieldByName('JHH').AsString+'''';
ExecSQL;
Close;
end;
end;
(vlp_FocusGrid.DataSource.DataSet as TQuery).ApplyUpdates;
end;
1://tu
EditTuInTrans;
end;
// set tao.tpsj, tao.qtmz
if vlp_FocusGrid.Tag = 1 then
SumTAO;
data.DM.Commit;
except
data.DM.RollBack;
raise exception.Create('数据访问错误!');
end;
(vlp_FocusGrid.DataSource.DataSet as TQuery).CommitUpdates;
Qry_pfxjhtao.Close;
Qry_pfxjhtao.Open;
if vlp_FocusGrid.Tag = 1 then
begin
Qry_pfxjhtu.Close;
Qry_pfxjhtu.Open;
end;
Qry_pfxjhtao.Locate('JHH', vlp_stao_jhh, [loPartialKey]);
Qry_pfxjhtu.Locate('JHH; TX', VarArrayOf([vlp_stao_jhh, vlp_itu_tx]),[loPartialKey]);
SetEditStatus(0);
end;
procedure TFrmf_pfxjh.Act_cancelExecute(Sender: TObject);
begin
data.DM.StartTransaction;
try
(vlp_FocusGrid.DataSource.DataSet as TQuery).CancelUpdates;
data.DM.Commit;
except
data.DM.RollBack;
raise exception.Create('数据访问错误!');
end;
(vlp_FocusGrid.DataSource.DataSet as TQuery).CommitUpdates;
case vlp_focusgrid.tag of
0://套
Qry_pfxjhtao.Locate('JHH', vlp_stao_jhh, [loPartialKey]);
1://图
Qry_pfxjhtu.Locate('JHH; TX', VarArrayOf([vlp_stao_jhh, vlp_itu_tx]),[loPartialKey]);
end;
SetEditStatus(0);
end;
procedure TFrmf_pfxjh.Act_exitExecute(Sender: TObject);
begin
close;
end;
procedure TFrmf_pfxjh.Act_printExecute(Sender: TObject);
begin
if DBGid_tao.DataSource.DataSet.RecordCount = 0 then
begin
CHQMsgBox('当前没有可打印的记录!');
exit;
end;
with TFrmf_print.Create(application) do
begin
// Pnt_init(1, DBGid_tao.DataSource.DataSet);
DBGid_tao.DataSource.DataSet.First;
QRe_pfx1.Preview;
Free;
end;
end;
procedure TFrmf_pfxjh.Act_selectExecute(Sender: TObject);
var
i: integer;
sqlstr: string;
begin
if vlp_status = 0 then //浏览
begin
Frmf_select:= TFrmf_select.Create(Application);
with Frmf_select do
begin
GBo_fxjh.Visible := true;
Caption := '查询——邮票发行';
ActiveControl := Eit_f_nd;
GBo_fxjh.Top := 12;
GBo_fxjh.Left := 12;
Width := Frmf_select.GBo_fxjh.Width + 30;
Height := Frmf_select.GBo_fxjh.Height + 80;
BBt_cancel.Top := Frmf_select.GBo_fxjh.Height + 22;
BBt_cancel.Left := Frmf_select.Width - 30 - Frmf_select.BBt_cancel.Width;
BBt_ok.Top := Frmf_select.GBo_fxjh.Height + 22;
BBt_ok.Left := Frmf_select.BBt_cancel.Left - 11 - Frmf_select.BBt_ok.Width;
Qry_pplb.First;
for i:= 0 to Qry_pplb.RecordCount - 1 do
begin
CBo_f_pplb.Items.Add(Qry_pplb.FieldByName('MC').AsString);
Qry_pplb.Next;
end;
Qry_tzdm.First;
for i:= 0 to Qry_tzdm.RecordCount - 1 do
begin
CBo_f_tz.Items.Add(Qry_tzdm.FieldByName('MC').AsString);
Qry_tzdm.Next;
end;
tag := 1;
ShowModal;
end;
if (Frmf_select.ModalResult = mrok ) and (Frmf_select.Tag = 0) then
with data do begin
Qry_super.Close;
Qry_super.Sql.Clear;
Qry_super.Sql.Add(GetSQLStr_GF(6,0));
Qry_super.Open;
if Qry_super.IsEmpty then
CHQMsgBox('符合当前查询条件的记录数为0')
else begin
if Frmf_select.ChBo_f_ls.Checked then
sqlstr :=' select '' '' tudm ,'' '' zh,JHH,BBH,TZDM,TX,TBBH,QXBZ,PPLB,TUMC,'
+' MZ,SJ,GG,WXGG,FXL,FXRQ,XGZT,BZ,YZBB,'
+' DECODE(XGZT,''0'',''未改动'',''1'',''修改'',''2'',''新增'',''3'',''删除'') as ZT from TF_PFXJHTULS '
+' where JHH=:JHH and XGZT <> ''3'' order by TX'
else
sqlstr := ' select '' '' tudm ,'' '' zh,JHH,BBH,TZDM,TX,TBBH,QXBZ,PPLB,TUMC,'
+' MZ,SJ,GG,WXGG,FXL,FXRQ,XGZT,BZ,YZBB,'
+' DECODE(XGZT,''0'',''未改动'',''1'',''修改'',''2'',''新增'',''3'',''删除'') as ZT from TF_PFXJHTU '
+' where JHH=:JHH and XGZT <> ''3'' order by TX';
SetEditStatus(0, -3);
if Frmf_select.ChBo_f_ls.Checked then
begin
SetEditStatus(2, -1);
Act_select.Caption := '清屏';
Act_select.ImageIndex := 21;
end;
with Qry_pfxjhtao do
begin
Close;
SQL.Text :=Qry_super.SQL.Text;
Open;
end;
with Qry_pfxjhtu do
begin
Close;
SQL.Text :=sqlstr;
end;
Qry_pfxjhtaoAfterScroll(nil);
end;
end;
Frmf_select.Free;
end
else if vlp_status = 2 then//查询结果浏览状态,返回初始状态
begin
Act_select.Caption := '查询';
Act_select.ImageIndex := 20;
Qry_pfxjhtu.Close ;
with Qry_pfxjhtu do
begin
Close;
SQL.Text :=' select '' '' tudm ,'' '' zh,JHH,BBH,TZDM,TX,TBBH,QXBZ,PPLB,TUMC,'
+' MZ,SJ,GG,WXGG,FXL,FXRQ,XGZT,BZ,YZBB,'
+' DECODE(XGZT,''0'',''未改动'',''1'',''修改'',''2'',''新增'',''3'',''删除'') as ZT from TF_PFXJHTU '
+' where JHH=:JHH and XGZT <> ''3'' order by TX';
end;
Qry_pfxjhtaoAfterScroll(nil);
SetEditStatus(0, -3);
// Qry_pfxjhtao.Locate('JHH', vlp_stao_jhh, [loPartialKey]);
SpinEdit1Change(nil);
end;
end;
procedure TFrmf_pfxjh.DBGid_taoEnter(Sender: TObject);
var
i: integer;
vl_s_oldfld: string;
begin
vlp_FocusGrid := (Sender as TDBGrid);
if (vlp_FocusGrid = DBGid_tao) then
DBGid_tao.TitleFont.Color := clnavy
else
DBGid_tao.TitleFont.Color := clblack;
if (vlp_FocusGrid = DBGid_tu) then
DBGid_tu.TitleFont.Color := clnavy
else
DBGid_tu.TitleFont.Color := clblack;
GBo_tao.Visible := (vlp_FocusGrid = DBGid_tao);
GBo_tu.Visible := (vlp_FocusGrid = DBGid_tu);
if (vlp_FocusGrid = DBGid_tu) then
begin
Act_add.Enabled := (not Qry_pfxjhtao.IsEmpty) and (vlp_status = 0);
Act_Delete.Enabled := (not Qry_pfxjhtu.IsEmpty) and (vlp_status = 0);
Act_modify.Enabled := Act_Delete.Enabled;
for i:= 0 to GBo_tu.ControlCount -1 do
begin
if (not(GBo_tu.Controls[i] is TLabel)) and (GBo_tu.Controls[i].Visible) then
if uppercase(GBo_tu.Controls[i].ClassName) = 'TDBLOOKUPCOMBOBOX' then
begin
vl_s_oldfld:= (GBo_tu.COntrols[i] as TDBLookUpComboBox).DataField;
(GBo_tu.COntrols[i] as TDBLookUpComboBox).DataField := '';
(GBo_tu.COntrols[i] as TDBLookUpComboBox).DataField := vl_s_oldfld;
end;
if uppercase(GBo_tu.Controls[i].ClassName) = 'TDBEDIT' then
begin
vl_s_oldfld:= (GBo_tu.COntrols[i] as TDBEdit).DataField;
(GBo_tu.COntrols[i] as TDBEdit).DataField := '';
(GBo_tu.COntrols[i] as TDBEdit).DataField := vl_s_oldfld;
end;
if uppercase(GBo_tu.Controls[i].ClassName) = 'TDBMEMO' then
begin
vl_s_oldfld:= (GBo_tu.COntrols[i] as TDBMemo).DataField;
(GBo_tu.COntrols[i] as TDBMemo).DataField := '';
(GBo_tu.COntrols[i] as TDBMemo).DataField := vl_s_oldfld;
end;
end;
end
else
begin
Act_add.Enabled := (vlp_status = 0);
Act_Delete.Enabled := (not Qry_pfxjhtao.IsEmpty) and (vlp_status = 0);
Act_modify.Enabled := Act_Delete.Enabled;
Act_send_fx.Enabled := Act_Delete.Enabled;
Act_send_fxl.Enabled := Act_Delete.Enabled;
end;
end;
procedure TFrmf_pfxjh.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
KeyEntDown(Sender, Key, Shift);
end;
procedure TFrmf_pfxjh.DBGid_taoMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if (DBGid_tao.DataSource.DataSet.IsEmpty) then
exit
else
begin
if DBGid_tao.SelectedRows.Count = 0 then
DBGid_tao.SelectedRows.CurrentRowSelected := true;
if (vlp_status <> 2) then
SetEditStatus(4, DBGid_Tao.SelectedRows.Count);
end;
end;
procedure TFrmf_pfxjh.Act_fs_allExecute(Sender: TObject);
var
i: integer;
vl_s_insql: string;
vl_s_edinsql: string;
vl_s_jsdw: string;
vl_sl_jsdw: TStringList;
vl_s_fxl: string[20];
vl_b_ed: boolean;
begin
if (DBGid_tao.DataSource.DataSet.IsEmpty) then
begin
CHQMsgBox('当前没有可发送的记录!');
exit;
end;
if DBGid_tao.SelectedRows.Count = 0 then
begin
DBGid_tao.SelectedRows.CurrentRowSelected := true;
end;
vl_b_ed := false;
//set insql、edinsql str
for i:=0 to DBGid_tao.SelectedRows.Count -1 do
begin
DBGid_tao.DataSource.DataSet.GotoBookmark(pointer(DBGid_tao.SelectedRows.Items[i]));
if (vlp_b_isfxl) and
(DBGid_tao.DataSource.DataSet.FieldByName('SDATEFX').AsString = '') then
begin
CHQMsgBox('邮票 ' + DBGid_tao.DataSource.DataSet.FieldByName('TMC').AsString + ' 的发行计划尚未发送!');
exit;
end;
if DBGid_tu.DataSource.DataSet.IsEmpty then
begin
CHQMsgBox('邮票 ' + DBGid_tao.DataSource.DataSet.FieldByName('TMC').AsString + ' 的发行计划中没有图信息!');
exit;
end;
// check tx
with data.Qry_super do
begin
Close;
SQL.Clear;
SQL.Add('select jhh from tf_pfxjhtu where jhh=''' +
DBGid_tao.DataSource.DataSet.FieldByName('JHH').AsString +
''' and xgzt<>''3'' having count(jhh)<>max(tx) group by jhh,tzdm');
Open;
if (not IsEmpty) then
begin
CHQMsgBox('请确定邮票 ' + DBGid_tao.DataSource.DataSet.FieldByName('TMC').AsString + #13 + ' 的发行计划图信息中图序是连续的再发送!');
exit;
end;
end;
if ((not vlp_b_isfxl) and
(DBGid_tao.DataSource.DataSet.FieldByName('QXBZ').AsString = 'H')) or //发行计划——作为标准向全国广播的标志
(vlp_b_isfxl and (DBGid_tao.DataSource.DataSet.FieldByName('SDATEFXL').AsString <> '')) then
begin
if CHQMsgBox('邮票 ' + DBGid_tao.DataSource.DataSet.FieldByName('TMC').AsString + ' 的发行计划已向全国广播过,确定要发送吗?', 2) = IDNo then
Exit;
vl_b_ed := true;
vl_s_edinsql := vl_s_edinsql + '''' + DBGid_tao.DataSource.DataSet.FieldByName('JHH').AsString + ''', ';
end
else//未发送过(含发送后又有改动)
vl_s_insql := vl_s_insql + '''' + DBGid_tao.DataSource.DataSet.FieldByName('JHH').AsString + ''', ';
end;
vl_s_insql := copy(vl_s_insql, 1, length(vl_s_insql)-2);
vl_s_edinsql := copy(vl_s_edinsql, 1, length(vl_s_edinsql)-2);
vl_sl_jsdw:= TStringList.Create;
with data.Qry_send do
begin
Close;
SQL.Clear;
SQL.Add('select jsdwdm from tg_xttxfsgnb where csdm=');
if vlp_b_isfxl then
SQL.Add('''sf_pfxljh''')
else
SQL.Add('''sf_pfxjh''');
Open;
vl_s_jsdw := trim(Fields[0].AsString);
if (length(vl_s_jsdw) = 0) then
begin
CHQMsgBox('请先设置接收单位再发送发行计划!');
exit;
end;
vl_sl_jsdw.Clear;
while pos(',', vl_s_jsdw) >0 do
begin
vl_sl_jsdw.Add(copy(vl_s_jsdw, 1, pos(',', vl_s_jsdw) -1));
vl_s_jsdw := copy(vl_s_jsdw, pos(',', vl_s_jsdw)+1, length(vl_s_jsdw));
end;
vl_sl_jsdw.Add(vl_s_jsdw);
end;
//**
if not vl_b_ed then
if CHQMsgBox('确实要向全国广播这些邮票的发行计划吗?', 2)=IDNo then
exit;
vlp_stao_jhh := DBGid_tao.DataSource.DataSet.fieldbyname('JHH').AsString;
if (vlp_b_isfxl) then
vl_s_fxl := 'FXL'
else
vl_s_fxl := '0';
data.DM.StartTransaction;
with data.Qry_send do
try
//*********
// if (length(vl_s_insql)>0) then//未发送过
begin
if (length(vl_s_edinsql)>0) then
if (length(vl_s_insql)>0) then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -