1
This commit is contained in:
parent
b9f63eed70
commit
913f33e99a
|
|
@ -3,11 +3,11 @@ inherited frmItemizedListInPut: TfrmItemizedListInPut
|
|||
Top = 4
|
||||
Caption = #35746#21333#24405#20837
|
||||
ClientHeight = 593
|
||||
ClientWidth = 938
|
||||
ClientWidth = 1040
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Height = -16
|
||||
Position = poMainFormCenter
|
||||
ExplicitWidth = 954
|
||||
ExplicitWidth = 1056
|
||||
ExplicitHeight = 632
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 21
|
||||
|
|
@ -15,7 +15,7 @@ inherited frmItemizedListInPut: TfrmItemizedListInPut
|
|||
Tag = 1
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 938
|
||||
Width = 1040
|
||||
Height = 30
|
||||
AutoSize = True
|
||||
ButtonHeight = 30
|
||||
|
|
@ -27,7 +27,7 @@ inherited frmItemizedListInPut: TfrmItemizedListInPut
|
|||
List = True
|
||||
ShowCaptions = True
|
||||
TabOrder = 0
|
||||
ExplicitWidth = 850
|
||||
ExplicitWidth = 938
|
||||
object TBSave: TToolButton
|
||||
Left = 0
|
||||
Top = 0
|
||||
|
|
@ -57,7 +57,7 @@ inherited frmItemizedListInPut: TfrmItemizedListInPut
|
|||
Tag = 1
|
||||
Left = 0
|
||||
Top = 193
|
||||
Width = 938
|
||||
Width = 1040
|
||||
Height = 30
|
||||
ButtonHeight = 30
|
||||
ButtonWidth = 99
|
||||
|
|
@ -68,7 +68,7 @@ inherited frmItemizedListInPut: TfrmItemizedListInPut
|
|||
List = True
|
||||
ShowCaptions = True
|
||||
TabOrder = 1
|
||||
ExplicitWidth = 850
|
||||
ExplicitWidth = 938
|
||||
object ToolButton1: TToolButton
|
||||
Left = 0
|
||||
Top = 0
|
||||
|
|
@ -98,31 +98,30 @@ inherited frmItemizedListInPut: TfrmItemizedListInPut
|
|||
object Panel2: TPanel [2]
|
||||
Left = 0
|
||||
Top = 223
|
||||
Width = 938
|
||||
Width = 1040
|
||||
Height = 370
|
||||
Align = alClient
|
||||
Caption = 'Panel2'
|
||||
TabOrder = 2
|
||||
ExplicitWidth = 850
|
||||
ExplicitWidth = 938
|
||||
object Panel3: TPanel
|
||||
Left = 1
|
||||
Top = 1
|
||||
Width = 936
|
||||
Width = 1038
|
||||
Height = 368
|
||||
Align = alClient
|
||||
Caption = 'Panel2'
|
||||
TabOrder = 0
|
||||
ExplicitWidth = 848
|
||||
ExplicitWidth = 936
|
||||
object cxGrid1: TcxGrid
|
||||
Left = 1
|
||||
Top = 1
|
||||
Width = 934
|
||||
Width = 1036
|
||||
Height = 366
|
||||
Align = alClient
|
||||
PopupMenu = PopupMenu2
|
||||
TabOrder = 0
|
||||
ExplicitLeft = -1
|
||||
ExplicitTop = 5
|
||||
ExplicitWidth = 934
|
||||
object Tv1: TcxGridDBTableView
|
||||
OnDblClick = Tv1DblClick
|
||||
OnMouseDown = Tv1MouseDown
|
||||
|
|
@ -199,6 +198,7 @@ inherited frmItemizedListInPut: TfrmItemizedListInPut
|
|||
Default = True
|
||||
Kind = bkEllipsis
|
||||
end>
|
||||
Properties.ReadOnly = True
|
||||
Properties.OnButtonClick = Tv1Column1PropertiesButtonClick
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 89
|
||||
|
|
@ -308,7 +308,7 @@ inherited frmItemizedListInPut: TfrmItemizedListInPut
|
|||
object ScrollBox1: TScrollBox [3]
|
||||
Left = 0
|
||||
Top = 30
|
||||
Width = 938
|
||||
Width = 1040
|
||||
Height = 163
|
||||
Align = alTop
|
||||
BevelInner = bvNone
|
||||
|
|
@ -317,7 +317,7 @@ inherited frmItemizedListInPut: TfrmItemizedListInPut
|
|||
Ctl3D = False
|
||||
ParentCtl3D = False
|
||||
TabOrder = 3
|
||||
ExplicitWidth = 850
|
||||
ExplicitWidth = 938
|
||||
object Label3: TLabel
|
||||
Left = 377
|
||||
Top = 11
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ begin
|
|||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add(' SELECT C_Code,C_Name FROM Bs_Cloth_Info');
|
||||
sql.Add(' SELECT C_Code,C_Name,qtyunit FROM Bs_Cloth_Info');
|
||||
Open;
|
||||
end;
|
||||
end;
|
||||
|
|
@ -964,6 +964,7 @@ begin
|
|||
ADO_PM.Locate('C_Name', mvalue, []);
|
||||
Edit;
|
||||
FieldByName('C_Code').Value := ADO_PM.FieldByName('C_Code').Value;
|
||||
FieldByName('TISUnit').Value := ADO_PM.FieldByName('qtyunit').Value;
|
||||
Post;
|
||||
end;
|
||||
|
||||
|
|
|
|||
|
|
@ -227,8 +227,6 @@ inherited frmItemizedListList: TfrmItemizedListList
|
|||
Height = 584
|
||||
Align = alClient
|
||||
TabOrder = 5
|
||||
ExplicitLeft = 2
|
||||
ExplicitTop = 158
|
||||
object TV1: TcxGridDBTableView
|
||||
Navigator.Buttons.CustomButtons = <>
|
||||
ScrollbarAnnotations.CustomAnnotations = <>
|
||||
|
|
@ -368,7 +366,7 @@ inherited frmItemizedListList: TfrmItemizedListList
|
|||
end
|
||||
object Tv1Column8: TcxGridDBColumn
|
||||
Caption = #21333#20301
|
||||
DataBinding.FieldName = 'TMSUnit'
|
||||
DataBinding.FieldName = 'TISUnit'
|
||||
DataBinding.IsNullValueType = True
|
||||
PropertiesClassName = 'TcxComboBoxProperties'
|
||||
Properties.Items.Strings = (
|
||||
|
|
|
|||
|
|
@ -3,33 +3,36 @@ inherited frmItemizedListQtyInPut: TfrmItemizedListQtyInPut
|
|||
Top = 126
|
||||
Caption = #26126#32454#20837#24211#30331#35760
|
||||
ClientHeight = 499
|
||||
ClientWidth = 629
|
||||
ClientWidth = 917
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Height = -16
|
||||
Position = poScreenCenter
|
||||
OnClose = FormClose
|
||||
ExplicitWidth = 645
|
||||
ExplicitWidth = 933
|
||||
ExplicitHeight = 538
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 21
|
||||
object pnl1: TPanel [0]
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 629
|
||||
Width = 917
|
||||
Height = 499
|
||||
Align = alClient
|
||||
Caption = 'pnl1'
|
||||
TabOrder = 0
|
||||
ExplicitTop = 2
|
||||
object cxGrid1: TcxGrid
|
||||
Tag = 2
|
||||
Left = 1
|
||||
Top = 72
|
||||
Width = 627
|
||||
Width = 915
|
||||
Height = 426
|
||||
Align = alClient
|
||||
PopupMenu = PopupMenu1
|
||||
TabOrder = 0
|
||||
ExplicitWidth = 627
|
||||
object Tv1: TcxGridDBTableView
|
||||
OnKeyDown = Tv1KeyDown
|
||||
Navigator.Buttons.CustomButtons = <>
|
||||
ScrollbarAnnotations.CustomAnnotations = <>
|
||||
DataController.DataSource = DataSource3
|
||||
|
|
@ -57,6 +60,10 @@ inherited frmItemizedListQtyInPut: TfrmItemizedListQtyInPut
|
|||
DataController.Summary.SummaryGroups = <>
|
||||
OptionsBehavior.GoToNextCellOnEnter = True
|
||||
OptionsCustomize.ColumnFiltering = False
|
||||
OptionsCustomize.ColumnSorting = False
|
||||
OptionsSelection.MultiSelect = True
|
||||
OptionsSelection.CellMultiSelect = True
|
||||
OptionsSelection.InvertSelect = False
|
||||
OptionsView.Footer = True
|
||||
OptionsView.GroupByBox = False
|
||||
OptionsView.Indicator = True
|
||||
|
|
@ -106,7 +113,7 @@ inherited frmItemizedListQtyInPut: TfrmItemizedListQtyInPut
|
|||
Tag = 1
|
||||
Left = 1
|
||||
Top = 1
|
||||
Width = 627
|
||||
Width = 915
|
||||
Height = 30
|
||||
AutoSize = True
|
||||
ButtonHeight = 30
|
||||
|
|
@ -124,6 +131,8 @@ inherited frmItemizedListQtyInPut: TfrmItemizedListQtyInPut
|
|||
ParentFont = False
|
||||
ShowCaptions = True
|
||||
TabOrder = 1
|
||||
ExplicitWidth = 627
|
||||
ExplicitHeight = 60
|
||||
object TBSave: TToolButton
|
||||
Left = 0
|
||||
Top = 0
|
||||
|
|
@ -179,22 +188,15 @@ inherited frmItemizedListQtyInPut: TfrmItemizedListQtyInPut
|
|||
ImageIndex = 7
|
||||
OnClick = ToolButton5Click
|
||||
end
|
||||
object btn2: TToolButton
|
||||
Left = 489
|
||||
Top = 0
|
||||
Caption = 'btn2'
|
||||
ImageIndex = 17
|
||||
Visible = False
|
||||
OnClick = btn2Click
|
||||
end
|
||||
end
|
||||
object pnl2: TPanel
|
||||
Left = 1
|
||||
Top = 31
|
||||
Width = 627
|
||||
Width = 915
|
||||
Height = 41
|
||||
Align = alTop
|
||||
TabOrder = 2
|
||||
ExplicitWidth = 627
|
||||
object Label9: TLabel
|
||||
Left = 33
|
||||
Top = 7
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ type
|
|||
btndaoru: TToolButton;
|
||||
PopupMenu1: TPopupMenu;
|
||||
N1: TMenuItem;
|
||||
btn2: TToolButton;
|
||||
ToolButton2: TToolButton;
|
||||
TBSave: TToolButton;
|
||||
TBClose: TToolButton;
|
||||
|
|
@ -56,11 +55,11 @@ type
|
|||
procedure inQtyKeyPress(Sender: TObject; var Key: Char);
|
||||
procedure btndaoruClick(Sender: TObject);
|
||||
procedure N1Click(Sender: TObject);
|
||||
procedure btn2Click(Sender: TObject);
|
||||
procedure ToolButton2Click(Sender: TObject);
|
||||
procedure ToolButton5Click(Sender: TObject);
|
||||
procedure TBSaveClick(Sender: TObject);
|
||||
procedure btnAddClick(Sender: TObject);
|
||||
procedure Tv1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
private
|
||||
{ Private declarations }
|
||||
function SaveData(): Boolean;
|
||||
|
|
@ -82,6 +81,7 @@ uses
|
|||
|
||||
{$R *.dfm}
|
||||
|
||||
// 分割字符串函数
|
||||
function TfrmItemizedListQtyInPut.Split(const s: string; Separator: char): TStringDynArray;
|
||||
var
|
||||
i, ItemIndex: Integer;
|
||||
|
|
@ -93,28 +93,30 @@ begin
|
|||
if len = 0 then
|
||||
begin
|
||||
Result := nil;
|
||||
exit;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
// 计算分隔符数量
|
||||
SeparatorCount := 0;
|
||||
for i := 1 to len do
|
||||
begin
|
||||
if s[i] = Separator then
|
||||
begin
|
||||
inc(SeparatorCount);
|
||||
end;
|
||||
end;
|
||||
Inc(SeparatorCount);
|
||||
|
||||
SetLength(Result, SeparatorCount + 1);
|
||||
ItemIndex := 0;
|
||||
Start := 1;
|
||||
|
||||
// 拆分字符串
|
||||
for i := 1 to len do
|
||||
begin
|
||||
if s[i] = Separator then
|
||||
begin
|
||||
Result[ItemIndex] := Copy(s, Start, i - Start);
|
||||
inc(ItemIndex);
|
||||
Inc(ItemIndex);
|
||||
Start := i + 1;
|
||||
end;
|
||||
end;
|
||||
|
||||
Result[ItemIndex] := Copy(s, Start, len - Start + 1);
|
||||
end;
|
||||
|
||||
|
|
@ -255,40 +257,6 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmItemizedListQtyInPut.btn2Click(Sender: TObject);
|
||||
var
|
||||
RowData: TArray<string>;
|
||||
rowColData: TArray<string>;
|
||||
RowIndex, ColIndex, i: Integer;
|
||||
clipboardText, rowStr: string;
|
||||
lRect: TRect;
|
||||
begin
|
||||
if Clipboard.HasFormat(CF_TEXT) then
|
||||
begin
|
||||
clipboardText := Clipboard.AsText;
|
||||
RowData := clipboardText.Split([#13#10]); // 根据换行符拆分行数据
|
||||
// 遍历行数据
|
||||
for RowIndex := Low(RowData) to High(RowData) do
|
||||
begin
|
||||
rowStr := RowData[RowIndex];
|
||||
if trim(rowStr) = '' then
|
||||
continue;
|
||||
rowColData := rowStr.Split([#9]);
|
||||
ShowMessage(rowStr);
|
||||
// lRect := FGrid.Selection;
|
||||
// ColIndex := 0;
|
||||
// for i := lRect.Left to lRect.Right do
|
||||
// begin
|
||||
// if lRect.Top + RowIndex < FGrid.RowCount then
|
||||
// begin
|
||||
// FGrid.Cells[i, lRect.Top + RowIndex].Text := trim(rowColData[ColIndex]);
|
||||
// ColIndex := ColIndex + 1;
|
||||
// end;
|
||||
// end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmItemizedListQtyInPut.btndaoruClick(Sender: TObject);
|
||||
var
|
||||
excelApp, WorkBook: Variant;
|
||||
|
|
@ -702,5 +670,74 @@ begin
|
|||
Close;
|
||||
end;
|
||||
|
||||
procedure TfrmItemizedListQtyInPut.Tv1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
var
|
||||
SelectedCount: Integer;
|
||||
ClipboardText: string;
|
||||
StringList: TStringList;
|
||||
RowData: TStringDynArray;
|
||||
i, j: Integer;
|
||||
begin
|
||||
|
||||
// 检测是否按下 Ctrl+V
|
||||
if (Key = Ord('V')) and (Shift = [ssCtrl]) then
|
||||
begin
|
||||
// ToolButton1.Click;
|
||||
|
||||
// SelectedCount := TV1.DataController.GetSelectedCount;
|
||||
// ShowMessage('选中的行数: ' + IntToStr(SelectedCount));
|
||||
|
||||
|
||||
// 检查剪贴板是否包含文本格式
|
||||
if not Clipboard.HasFormat(CF_TEXT) then
|
||||
begin
|
||||
ShowMessage('剪贴板中没有文本内容!');
|
||||
Exit;
|
||||
end;
|
||||
|
||||
// 获取剪贴板中的文本
|
||||
ClipboardText := Clipboard.AsText;
|
||||
|
||||
// 将文本按行拆分
|
||||
StringList := TStringList.Create;
|
||||
try
|
||||
StringList.Text := ClipboardText;
|
||||
|
||||
// 遍历每一行
|
||||
for i := 0 to StringList.Count - 1 do
|
||||
begin
|
||||
// 将每行按制表符(或其他分隔符)拆分为单元格数据
|
||||
RowData := Split(StringList[i], #9); // 假设使用制表符作为分隔符
|
||||
|
||||
// 遍历每一列,并将数据填充到cxGrid
|
||||
for j := 0 to Length(RowData) - 1 do
|
||||
begin
|
||||
// 假设cxGrid已经初始化,且有足够的行和列
|
||||
Tv1.Controller.FocusedRow := Tv1.Controller.SelectedRows[i];
|
||||
TV1.DataController.Values[i, j] := RowData[j];
|
||||
|
||||
// if Tv1.DataController.DataSet.State in [dsInsert, dsEdit] then
|
||||
// begin
|
||||
// Tv1.DataController.DataSet.FieldByName(Tv1.Columns[j].DataBinding.FieldName).AsString := RowData[j];
|
||||
// end
|
||||
// else
|
||||
begin
|
||||
Tv1.DataController.DataSet.Edit;
|
||||
Tv1.DataController.DataSet.FieldByName(Tv1.Columns[j].DataBinding.FieldName).AsString := RowData[j];
|
||||
Tv1.DataController.DataSet.Post;
|
||||
end;
|
||||
|
||||
TV1.Controller.EditingController.ShowEdit;
|
||||
end;
|
||||
|
||||
end;
|
||||
finally
|
||||
StringList.Free;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user