This commit is contained in:
DESKTOP-E401PHE\Administrator 2026-02-26 15:36:49 +08:00
parent 6f219d26d4
commit c7a02def1c
3 changed files with 129 additions and 29 deletions

View File

@ -1,6 +1,6 @@
object frmShaOutList: TfrmShaOutList
Left = 245
Top = 178
Left = 219
Top = 147
Width = 1356
Height = 884
Caption = #32433#32447#20986#24211#21015#34920
@ -649,7 +649,7 @@ object frmShaOutList: TfrmShaOutList
end
object RMDBMain: TRMDBDataSet
Visible = True
DataSet = CDS_Main
DataSet = CDS_PRT
Left = 424
Top = 232
end

View File

@ -213,6 +213,7 @@ end;
procedure TfrmShaOutList.TBCloseClick(Sender: TObject);
begin
WriteCxGrid('纱线出库列表121', Tv1, '纱线仓库');
//ReadCxGrid('纱线出库列表121', Tv1, '纱线仓库');
Close;
end;
@ -231,7 +232,7 @@ begin
TBEdit.Visible := False;
cxTabControl1.Visible := False;
end;
//ReadCxGrid('纱线出库列表121', Tv1, '纱线仓库');
ReadCxGrid('纱线出库列表121', Tv1, '纱线仓库');
if Trim(FFY_ID) <> '' then
begin
TBAdd.Visible := False;
@ -661,6 +662,101 @@ end;
// end;
//end;
//procedure TfrmShaOutList.ToolButton1Click(Sender: TObject);
//var
// fPrintFile, Txt, fImagePath, YIDSql: string;
// Moudle: THandle;
// Makebar: TMakebar;
// Mixtext: TMixtext;
// SelectedCount: Integer;
//begin
// if CDS_Main.IsEmpty then
// Exit;
//
// if CDS_Main.Locate('SSel', True, []) = False then
// begin
// Application.MessageBox('没有选择数据!', '提示', 0);
// Exit;
// end;
//
// SelectedCount := 0;
// YIDSql := '';
// CDS_Main.DisableControls;
//
// try
// with CDS_Main do
// begin
// First;
// //while Locate('SSel', True, [loCaseInsensitive]) do
// while Locate('SSel', True, []) do
// begin
// // 构建Y_ID的IN条件
// if YIDSql <> '' then
// YIDSql := YIDSql + ',' + QuotedStr(Trim(FieldByName('Y_ID').AsString))
// else
// YIDSql := QuotedStr(Trim(FieldByName('Y_ID').AsString));
//
// Inc(SelectedCount);
//
// Edit;
// FieldByName('SSel').Value := False;
// Post;
// end;
// end;
// finally
// CDS_Main.EnableControls;
// end;
//
// if YIDSql = '' then
// begin
// Application.MessageBox('未选择任何数据!', '提示', 0);
// Exit;
// end;
//
// with ADOQueryCmd do
// begin
// Close;
// SQL.Clear;
//
// sql.Add(' select A.* ');
// sql.Add(' from CK_Yarn_CR A');
// sql.Add(' where isnull(CKName,'''')=''纱线''');
// SQL.Add(' and CRFlag=''出库''');
//
// // 添加日期范围条件(根据您的需求可选)
// // sql.Add(' and A.CRTime>=''' + FormatDateTime('yyyy-MM-dd', begdate.Date) + '''');
// // sql.Add(' and A.CRTime<''' + FormatDateTime('yyyy-MM-dd', enddate.Date + 1) + '''');
//
// // 添加勾选数据条件
// SQL.Add(' and A.Y_ID in (' + YIDSql + ')');
//
// SQL.Add(' order by CRTime desc');
// Open;
// end;
//
// if ADOQueryCmd.IsEmpty then
// begin
// Application.MessageBox('未找到对应的纱线出库数据!', '提示信息', MB_ICONINFORMATION);
// Exit;
// end;
//
// SCreateCDS20(ADOQueryCmd, CDS_PRT); // 使用CDS_PRT而不是CDS_Main
// SInitCDSData20(ADOQueryCmd, CDS_PRT);
//
// fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\纱线出库报表.rmf';
// ExportFtErpFile('纱线出库报表.rmf', ADOQueryTemp);
//
// if FileExists(fPrintFile) then
// begin
// RM1.LoadFromFile(fPrintFile);
// RM1.ShowReport;
// end
// else
// begin
// Application.MessageBox(PChar('未找到报表文件:' + #13#10 + fPrintFile), '提示', MB_ICONWARNING);
// end;
//end;
procedure TfrmShaOutList.ToolButton1Click(Sender: TObject);
var
fPrintFile, Txt, fImagePath, YIDSql: string;
@ -686,31 +782,36 @@ begin
with CDS_Main do
begin
First;
while Locate('SSel', True, [loCaseInsensitive]) do
while not Eof do
begin
// 构建Y_ID的IN条件
if YIDSql <> '' then
YIDSql := YIDSql + ',' + QuotedStr(Trim(FieldByName('Y_ID').AsString))
else
YIDSql := QuotedStr(Trim(FieldByName('Y_ID').AsString));
Inc(SelectedCount);
Edit;
FieldByName('SSel').Value := False;
Post;
if FieldByName('SSel').AsBoolean then
begin
if YIDSql <> '' then
YIDSql := YIDSql + ',' + QuotedStr(Trim(FieldByName('Y_ID').AsString))
else
YIDSql := QuotedStr(Trim(FieldByName('Y_ID').AsString));
Inc(SelectedCount);
end;
Next;
end;
end;
finally
CDS_Main.EnableControls;
end;
if YIDSql = '' then
begin
Application.MessageBox('未选择任何数据!', '提示', 0);
Exit;
end;
if SelectedCount = 0 then
begin
Application.MessageBox('未选择任何数据!', '提示', 0);
Exit;
end;
with ADOQueryCmd do
begin
Close;
@ -720,15 +821,11 @@ begin
sql.Add(' from CK_Yarn_CR A');
sql.Add(' where isnull(CKName,'''')=''纱线''');
SQL.Add(' and CRFlag=''出库''');
// 添加日期范围条件(根据您的需求可选)
// sql.Add(' and A.CRTime>=''' + FormatDateTime('yyyy-MM-dd', begdate.Date) + '''');
// sql.Add(' and A.CRTime<''' + FormatDateTime('yyyy-MM-dd', enddate.Date + 1) + '''');
// 添加勾选数据条件
SQL.Add(' and A.Y_ID in (' + YIDSql + ')');
SQL.Add(' order by CRTime desc');
//ShowMessage(sql.text);
Open;
end;
@ -738,21 +835,24 @@ begin
Exit;
end;
SCreateCDS20(ADOQueryCmd, CDS_PRT); // 使用CDS_PRT而不是CDS_Main
SCreateCDS20(ADOQueryCmd, CDS_PRT);
SInitCDSData20(ADOQueryCmd, CDS_PRT);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\纱线出库报表.rmf';
ExportFtErpFile('纱线出库报表.rmf', ADOQueryTemp);
if FileExists(fPrintFile) then
begin
RM1.LoadFromFile(fPrintFile);
RM1.ShowReport;
end
else
begin
Application.MessageBox(PChar('未找到报表文件:' + #13#10 + fPrintFile), '提示', MB_ICONWARNING);
end;
InitGrid();
end;

View File

@ -1,8 +1,8 @@
object frmShaRKList: TfrmShaRKList
Left = 646
Top = 283
Left = 429
Top = 403
Width = 1396
Height = 649
Height = 668
Caption = #32433#32447#20837#24211#21015#34920
Color = clBtnFace
Font.Charset = GB2312_CHARSET
@ -308,7 +308,7 @@ object frmShaRKList: TfrmShaRKList
Left = 0
Top = 125
Width = 1380
Height = 485
Height = 504
Align = alClient
TabOrder = 2
object Tv1: TcxGridDBTableView