|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 qyj628 于 2023-8-24 18:36 编辑
- class function TFrmRep.REPL(replJson:ISuperObject;Frm:TFrmPoe;fQTY:Integer;fNo:Integer): Boolean;
- var
- F: TFrmRep;
- begin
- F := TFrmRep.Create(Application);
- try
- F.Frm := Frm;
- F.replJson := replJson;
- if F.ShowModal = mrOK then
- begin
- [backcolor=Yellow] fQTY:=StrToInt(F.iqty);
- fNo:=StrToInt(F.ichoose);[/backcolor]
- Result := True;
- end
- else
- begin
- fQTY:= 0;
- fNo:= 0;
- Result := False;
- end
- finally
- FreeAndNil(F);
- end;
- end;
- procedure TFrmRep.FormShow(Sender: TObject);
- var
- JsonArr: TSuperArray;
- I,J:Integer;
- bcd:string;
- begin
- inherited;
- if cds.Active then
- cds.EmptyDataSet
- else
- cds.CreateDataSet;
- if InputEdit.Enabled then
- begin
- InputHandle := InputEdit.Handle;
- InputEdit.SetFocus;
- end;
- JsonArr:= replJson.AsArray;
- for I:=0 to JsonArr.Length-1 do
- begin
- cds.Append;
- cds.FieldByName('no').Value:= IntToStr(i + 1);
- cds.FieldByName('qty').Value:= JsonArr[I].S['qty'];
- end;
- end;
- procedure TFrmRepl.getqty;
- var
- qtystr: string;
- HDRec: THDRec;
- b:Boolean;
- DisAMT,Yqty:Currency;
- index:Integer;
- begin
- qtystr := InputEdit.Text;
- try
- if (qtystr <> '') then
- begin
- index := cds.FieldByName('no').AsInteger;
- if StrToFloat(qtystr) > 9999999 then raise Exception.Create('商品数量不合理');
- if StrToFloat(qtystr) = 0 then raise Exception.Create('数量不能0');
- if Frm.stype = 1 then //更改数量
- begin
- with cds do
- begin
- Edit;
- FieldByName('qty').AsString:=qtystr;
- end;
- iqty:= cds.FieldByName('qty').AsInteger;//数量赋值给本页面全局变量
- ichoose:=cds.FieldByName('no').Value;//no同上
- InputEdit.Text:='';
- end;
- end
- else
- raise Exception.Create('操作错误');
- except
- on e: Exception do
- begin
- InError := True;
- ErrInfo := e.Message;
- Exit;
- end;
- end;
- end;
复制代码 两个页面之间传参,f2页面关闭时给参数赋值的语句不生效,Delphi给这个语句打断点时,只要编译断点就变成错号,语句被标为绿色,该怎么解决(代码逻辑:页面1通过 TFrmRep.REPL方法将kson传至页面2,页面2formshow方法解析json展示,getqty获取改动的数量值,赋值给全局变量iqty,关闭页面时判断showmodal=mrok,将页面2的全局变量iqty赋值给TFrmRep.REPL方法中的fqty,烦请看下是哪里写的有问题) |
|