我的功能实现了,但是我每次修改数据集的任何一个字段合同编号都会变,怎么样只让‘合同类型’这个字段发生变化时才会改变‘合同登记编号’?
procedure TMainForm.Action1Execute(Sender: TObject);
const
cZeroLeng = '0000';
var
//lParam: TBizParam;
lBizURL: TBizURL;
//lContextCurrent: TContextCurrent;
tempstr : String;
htlx : String;
CurHTBH: Business.Model.TBizParam;
lDateStr, lTmpStr: string;
begin
htlx :='';
//tempstr := Business.Model.TSheetDoc(DocView1.Doc).Sheet.Values[1,13].ToString;
tempstr := DataSetBrokerjbxx.DataSet.FieldByName('HTLX').AsString;
if tempstr='采购' then
htlx := 'CG';
if tempstr = '基建调试' then
htlx := 'JJTS';
if tempstr = '外协' then
htlx := 'WX';
if tempstr = '技术服务' then
htlx := 'JSFW';
if tempstr ='技术监督' then
htlx :='JSJD';
if tempstr = '管理合同' then
htlx := 'GLHT';
if tempstr ='技术开发' then
htlx := 'JSKF';
//Dialogs.ShowMessage(htlx);
lBizURL := TBizURL.Create;
lBizURL.URL := 'Biz:\HTGLXTYWKJ\GGYWCSZ.ParamGroup';
CurHTBH := SystemUtils.TContextUtils.GetParam(Self.Context,lBizURL,'HTBHCS');
if CurHTBH<>nil then
begin
lTmpStr := TCommonUtils.GetAutoIncreaseID(Self.Context,
SysUtils.FormatDateTime('yyyymm', Business.Data.SysSrv.SysService.Time), '');
lTmpStr := StringUtils.Copy(cZeroLeng, 1, Length(cZeroLeng) - Length(lTmpStr))
+ lTmpStr;
lDateStr := SysUtils.FormatDateTime('yyyymm', Business.Data.SysSrv.SysService.Time);
CurHTBH.Value := htlx+lDateStr + lTmpStr;
DataSetBrokerjbxx.DataSet.FieldByName('HTDJBH').Value:= CurHTBH.Value.ToString;
//Dialogs.ShowMessage('--->'+CurHTBH.Value.ToString+'<');
end;
lBizURL.Free;
end;
procedure TMainForm.DataNavigator1BeforeAction(Sender: TObject; var Accept: Boolean);
begin
if DataSetBrokerjbxx.DataSet.UpdatesPending then
begin
ActionList1.Actions[0].Execute;
Accept :=true;
end;
end; |