📄 stock_fad.pas
字号:
unit Stock_Fad;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, Grids, StdCtrls, Buttons, XPMenu;
type
Tfrm_Stock_Fad = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
Panel3: TPanel;
Label1: TLabel;
Panel4: TPanel;
Edit1: TLabeledEdit;
GroupBox1: TGroupBox;
SpeedButton1: TSpeedButton;
SpeedButton5: TSpeedButton;
SpeedButton7: TSpeedButton;
SpeedButton8: TSpeedButton;
SpeedButton9: TSpeedButton;
Edit4: TLabeledEdit;
Edit_Storage_Name: TLabeledEdit;
Edit6: TLabeledEdit;
Edit_Shop_Name: TLabeledEdit;
Edit8: TLabeledEdit;
Edit9: TLabeledEdit;
Edit10: TLabeledEdit;
Edit5: TLabeledEdit;
Edit7: TLabeledEdit;
Edit2: TLabeledEdit;
Edit3: TLabeledEdit;
Panel5: TPanel;
Panel6: TPanel;
P_check: TPanel;
P1: TPanel;
Cmd1: TSpeedButton;
L1: TLabel;
P2: TPanel;
Cmd2: TSpeedButton;
L2: TLabel;
P3: TPanel;
Cmd3: TSpeedButton;
L3: TLabel;
P4: TPanel;
L4: TLabel;
Cmd4: TSpeedButton;
P5: TPanel;
L5: TLabel;
Cmd5: TSpeedButton;
Panel7: TPanel;
SpeedButton6: TSpeedButton;
SpeedButton10: TSpeedButton;
LabeledEdit11: TLabeledEdit;
LabeledEdit12: TLabeledEdit;
LabeledEdit13: TLabeledEdit;
Panel8: TPanel;
Label2: TLabel;
Label3: TLabel;
Panel9: TPanel;
StringGrid1: TStringGrid;
Panel10: TPanel;
Cmd_Delete: TSpeedButton;
Cmd_Add: TSpeedButton;
XPMenu1: TXPMenu;
procedure SpeedButton4Click(Sender: TObject);
procedure StringGrid1DblClick(Sender: TObject);
procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
procedure Cmd1Click(Sender: TObject);
procedure Cmd2Click(Sender: TObject);
procedure Cmd3Click(Sender: TObject);
procedure Cmd4Click(Sender: TObject);
procedure Cmd5Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton5Click(Sender: TObject);
procedure SpeedButton7Click(Sender: TObject);
procedure SpeedButton8Click(Sender: TObject);
procedure SpeedButton9Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Cmd_AddClick(Sender: TObject);
procedure Cmd_DeleteClick(Sender: TObject);
private
{ Private declarations }
procedure DeleteRow(Row:Integer);
public
{ Public declarations }
end;
var
frm_Stock_Fad: Tfrm_Stock_Fad;
iColcount,Total_Count:Integer;
Pcol,Prow:integer;
ss,tempstr:string;
implementation
uses Public_Don, Data, Goods_Check, Supply_Monad, Storage_Select,
ChildShop_Select, Login_Man, func;
{$R *.dfm}
procedure Tfrm_Stock_Fad.DeleteRow(Row:Integer);
var
i : integer;
begin
//最后一列直接删除
if (Row = StringGrid1.RowCount-1) and (row >1) then
StringGrid1.RowCount := StringGrid1.RowCount - 1;
//自动上移
if (Row < StringGrid1.RowCount) and (Row > StringGrid1.FixedRows-1) then
begin
if Row < StringGrid1.RowCount - 1 then
begin
for i := Row to StringGrid1.RowCount-1 do
StringGrid1.Rows[i] := StringGrid1.Rows[i+1];
StringGrid1.RowCount :=StringGrid1.RowCount - 1;
end;
end;
end;
procedure Tfrm_Stock_Fad.SpeedButton4Click(Sender: TObject);
var
i,j:integer;
Insert_Sql:String;
Check_Flag:string;
begin
frm_Public_Don:=Tfrm_Public_Don.Create(self);
frm_Public_Don.ShowModal;
//直接操作单据
if Public_Do='Stock_0004' then
begin
Insert_Sql:='Insert into [Cancel_strip_detail](Stock_NO,Goods_NO,Pass_NO,amount,quality,Fade_Name) values ';
//如果废弃退出
if Public_Do_Result='03' then
begin
frm_data.ClientDataSet_Add.Close;
frm_data.ClientDataSet_Add.Active:=False;
Close;
end;
//如果保存草稿
if Public_Do_Result='02' then
begin
for i:=1 to StringGrid1.ColCount-1 do
begin
for j:=1 to StringGrid1.RowCount-1 do
begin
if StringGrid1.Cells[1,j]='' then
begin
application.MessageBox('操作错误,【商品编号】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
end;
if Trim(Edit1.Text)='' then
begin
application.MessageBox('操作错误,【录单日期】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Edit1.SetFocus;
Exit;
end;
if Trim(Edit2.Text)='' then
begin
application.MessageBox('操作错误,【单据编号】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Edit2.SetFocus;
Exit;
end;
if Trim(Edit4.Text)='' then
begin
application.MessageBox('操作错误,【供货单位】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Edit4.SetFocus;
Exit;
end;
if Trim(Edit5.Text)='' then
begin
application.MessageBox('操作错误,【退货仓库】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Edit5.SetFocus;
Exit;
end;
if Trim(Edit6.Text)='' then
begin
application.MessageBox('操作错误,【经手人】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Edit6.SetFocus;
Exit;
end;
if Trim(Edit8.Text)='' then
begin
application.MessageBox('操作错误,【制单人】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Edit8.SetFocus;
Exit;
end;
for i:=1 to Total_Count-1 do
begin
{if StringGrid1.Cells[3,i]='' then
begin
application.MessageBox('操作错误,【单价】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end; }
if StringGrid1.Cells[5,i]='' then
begin
application.MessageBox('操作错误,【数量】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
{if StringGrid1.Cells[5,i]='' then
begin
application.MessageBox('操作错误,【金额】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end; }
end;
with frm_data.ClientDataSet_Add do
begin
Close;
CommandText:='';
CommandText:='Select * from [Cancel_strip] where Copy_Date='''+Trim(Edit1.Text)+''' and Stock_No='''+Trim(Edit2.Text)+''' ';
try
open;
if frm_data.ClientDataSet_Add.RecordCount>0 then
begin
Application.MessageBox('添加失败,该记录已经存在,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end
else
begin
with frm_data.ClientDataSet_Add do
begin
Close;
CommandText:='';
CommandText:='Insert into [Cancel_strip] (Copy_Date,Stock_No,Contract_No,Gather_Name,Storage_NO,Transactor,Shop_NO,Proposer,Condense,Remark) values ('''+Trim(Edit1.Text)+''','''+Trim(Edit2.Text)+''','''+Trim(Edit3.Text)+''','''+Trim(Edit4.Text)+''','''+Trim(Edit5.Text)+''','''+Trim(Edit6.Text)+''','''+Trim(Edit7.Text)+''','''+Trim(Edit8.Text)+''','''+Trim(Edit9.Text)+''','''+Trim(Edit10.Text)+''')';
try
Execute;
with frm_data.ClientDataSet_Add do
begin
Close;
CommandText:='';
CommandText:='Insert into [Receipt](Receipt_NO,Receipt_Name,Copy_Date,Proposer,Condense) values ('''+Trim(Edit2.Text)+''',''采购退货单'','''+Trim(Edit1.Text)+''','''+Trim(Edit8.Text)+''','''+Trim(Edit10.Text)+''')';
try
Execute;
try
for i:=1 to Total_Count-1 do
begin
with frm_data.ClientDataSet_Add do
begin
Close;
CommandText:='';
CommandText:='Insert into [Cancel_strip_detail](Stock_NO,Goods_NO,Pass_NO,amount,quality,Fade_Name) values ('''+Trim(Edit2.Text)+''','''+Trim(StringGrid1.Cells[1,i])+''','''+Trim(StringGrid1.Cells[3,i])+''','''+Trim(StringGrid1.Cells[5,i])+''','''+Trim(StringGrid1.Cells[13,i])+''','''+Trim(StringGrid1.Cells[14,i])+''')';
try
Execute;
except
Application.MessageBox('系统错误,在保存数据表【采购退货明细表】时出错,'+#13#10+'请检查远程服务器连接是否正常?请确认!',Pchar(Application.Title),Mb_ICONwarning);
Exit;
end;
end;
end;
Application.MessageBox('恭喜你!【采购退货单】保存草稿单据操作成功,请确认!',pchar(application.Title),mb_iconwarning);
except
Application.MessageBox('系统错误,在操作数据表【采购退货明细表】循环时出错,'+#13#10+'请检查远程服务器连接是否正常?请确认!',Pchar(Application.Title),Mb_ICONwarning);
Exit;
end;
except
Application.MessageBox('系统错误,在保存数据表【采购退货审核表】数据时出错,'+#13#10+'请检查远程服务器连接是否正常?请确认!',Pchar(Application.Title),Mb_ICONwarning);
Exit;
end;
end;
except
Application.MessageBox('系统错误,在保存数据表【采购退货表】数据时出错,'+#13#10+'请检查远程服务器连接是否正常?请确认!',Pchar(Application.Title),Mb_ICONwarning);
Exit;
end;
end;
end;
except
Application.MessageBox('系统错误,在打开数据表【采购退货表】时出错,'+#13#10+'请检查远程服务器连接是否正常?请确认!',Pchar(Application.Title),Mb_ICONwarning);
Exit;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -