unit U_TradeClothSplitWeight; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, DB, ADODB; type TfrmTradeClothSplitWeight = class(TForm) Panel1: TPanel; Button1: TButton; Label1: TLabel; Button2: TButton; ADOQueryMain: TADOQuery; ADOQueryTemp: TADOQuery; ADOQueryCmd: TADOQuery; Len: TEdit; procedure Button2Click(Sender: TObject); procedure Button1Click(Sender: TObject); private { Private declarations } public FStkID: string; { Public declarations } end; var frmTradeClothSplitWeight: TfrmTradeClothSplitWeight; implementation uses U_DataLink; {$R *.dfm} procedure TfrmTradeClothSplitWeight.Button2Click(Sender: TObject); begin Close; end; procedure TfrmTradeClothSplitWeight.Button1Click(Sender: TObject); begin if StrToFloatDef(Len.Text, 0) = 0 then begin application.MessageBox('请输入拆分米数', '提示信息', 0); end; try with ADOQueryCmd do begin Close; sql.Clear; sql.Add(' exec P_Trade_Cloth_Split_weight '); sql.Add(' @StkID=' + QuotedStr(FStkID)); sql.Add(',@SplitWeight=' + Len.Text); Sql.Add(',@FillId=' + quotedstr(DCode)); Sql.Add(',@Filler=' + quotedstr(DName)); open; end; if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString))); ModalResult := 1; except application.MessageBox(PChar(Exception(ExceptObject).Message), '提示信息', 0); end; end; end.