📄 goods_write.pas
字号:
begin
temppos:=pos(',',tempstr); //取得逗号的位置
ss:=copy(tempstr,1,temppos-1);
tempstr:=copy(tempstr,temppos+1,length(tempstr)-temppos);
if ss=Handle_Man then
begin
P4.Visible:=True; L4.Caption:=LevelName4+':'+ss;
if ee4='' then
begin
L4.Caption:=LevelName4+':'+ss;
Flag4:=1;
end;
if ee1<>'' then
begin
L4.Caption:=LevelName4+':';
Flag4:=2;
end;
end;
end;
Next;
end;
if Trim(ExamineMan5)<>'' then
begin
tempstr:=ExamineMan5;
tt:=0;
while pos(',',tempstr)>0 do //取得逗号的位置
begin
temppos:=pos(',',tempstr); //取得逗号的位置
ss:=copy(tempstr,1,temppos-1);
tempstr:=copy(tempstr,temppos+1,length(tempstr)-temppos);
if ss=Handle_Man then
begin
P5.Visible:=True; L5.Caption:=LevelName5+':'+ss;
if ee1='' then
begin
L5.Caption:=LevelName5+':'+ss;
Flag5:=1;
end;
if ee5<>'' then
begin
L5.Caption:=LevelName5+':';
Flag5:=2;
end;
end;
end;
Next;
end;
with frm_data.ClientDataSet_Add do
begin
Close;
CommandText:='';
CommandText:='Select * from [V_Stock_Write_View] where Receipt_No='''+List_No+'''';
Open;
k:=frm_data.ClientDataSet_Add.RecordCount;
StringGrid1.RowCount:=k+1;
//自动加载STRINGGRID的行数
for K:=1 to StringGrid1.RowCount do
begin
StringGrid1.Cells[0,K]:=IntTostr(k); //表示第0列第i行的名称
end;
//******************
Edit1.Text:=Formatdatetime('yyyy''-''mm''-''dd',frm_data.ClientDataSet_Add.FieldByName('Copy_Date').AsDateTime);
Edit2.Text:=frm_data.ClientDataSet_Add.FieldByName('Receipt_No').AsString;
Edit3.Text:=frm_data.ClientDataSet_Add.FieldByName('Contract_NO').AsString;
Edit4.Text:=frm_data.ClientDataSet_Add.FieldByName('Gather_Name').AsString;
Edit5.Text:=frm_data.ClientDataSet_Add.FieldByName('Storage_Name').AsString;
Edit6.Text:=frm_data.ClientDataSet_Add.FieldByName('Transactor').AsString;
Edit7.Text:=frm_data.ClientDataSet_Add.FieldByName('Shop_NO').AsString;
Edit8.Text:=frm_data.ClientDataSet_Add.FieldByName('Transactor').AsString;
Edit9.Text:=frm_data.ClientDataSet_Add.FieldByName('Condense').AsString;
Edit10.Text:=frm_data.ClientDataSet_Add.FieldByName('Remark').AsString;
for k:=1 to k do
begin
StringGrid1.Cells[1,k]:=frm_data.ClientDataSet_Add.FieldByName('Goods_NO').AsString;//商品编号
StringGrid1.Cells[2,k]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Name').AsString;//商品名称
StringGrid1.Cells[3,k]:=frm_data.ClientDataSet_Add.FieldByName('Write_Amount').AsString;//数量
StringGrid1.Cells[4,k]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Modal').AsString; //类别名称
StringGrid1.Cells[5,k]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Cards').AsString; //品牌名称
StringGrid1.Cells[6,k]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Brand').AsString; //品种名称
StringGrid1.Cells[7,k]:=frm_data.ClientDataSet_Add.FieldByName('Norms_Type').AsString;//规格型号名称
StringGrid1.Cells[8,k]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Sphere').AsString;//球面度数
StringGrid1.Cells[9,k]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Column').AsString;//柱面度数
StringGrid1.Cells[10,k]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Color').AsString;//颜色名称
StringGrid1.Cells[11,k]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Coding').AsString;//商品条玛
StringGrid1.Cells[12,k]:=frm_data.ClientDataSet_Add.FieldByName('Enroll_Brand').AsString;//注册商标
StringGrid1.Cells[13,k]:=frm_data.ClientDataSet_Add.FieldByName('Factory').AsString;//生产厂家
StringGrid1.Cells[14,k]:=frm_data.ClientDataSet_Add.FieldByName('Goods_abbrev').AsString;//商品简称
StringGrid1.Cells[15,k]:=frm_data.ClientDataSet_Add.FieldByName('Base_Monad').AsString;//基本单位
StringGrid1.Cells[16,k]:=frm_data.ClientDataSet_Add.FieldByName('Whole_Monad').AsString;//整件单位
StringGrid1.Cells[17,k]:=frm_data.ClientDataSet_Add.FieldByName('Valid_Month').AsString; //有效日期
StringGrid1.Cells[18,k]:=frm_data.ClientDataSet_Add.FieldByName('Valid_Day').AsString; //有效日期
StringGrid1.Cells[19,k]:=frm_data.ClientDataSet_Add.FieldByName('Remark').AsString; //备注说明
Next;
end;
end;
end;
end;
procedure Tfrm_Goods_Write.Cmd_AddClick(Sender: TObject);
var
i:integer;
begin
StringGrid1.RowCount:=StringGrid1.RowCount+1;
Total_Count:=StringGrid1.RowCount;
for i:=1 to StringGrid1.RowCount-1 do
begin
StringGrid1.Cells[0,i]:=IntTostr(i); //表示第0列第i行
end;
end;
procedure Tfrm_Goods_Write.Cmd_DeleteClick(Sender: TObject);
var
i:integer;
begin
if StringGrid1.RowCount=2 then
begin
Exit;
end;
StringGrid1.RowCount:=StringGrid1.RowCount-1;
Total_Count:=StringGrid1.RowCount;//表示行数
for i:=1 to StringGrid1.RowCount-1 do
begin
StringGrid1.Cells[0,i]:=IntTostr(i); //表示第0列第i行
end;
end;
procedure Tfrm_Goods_Write.StringGrid1DblClick(Sender: TObject);
var
openstr:string;
S1,s2,s3:string;
begin
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(Edit6.Text)='' then
begin
Application.MessageBox('操作失败,【经手人】不能为空!',pchar(application.Title),mb_iconwarning);
Edit6.SetFocus;
Exit;
end;
s1:='select Goods_NO,Goods_Name,Goods_Modal_No,Goods_Modal,Goods_Cards_NO,Goods_Cards,Goods_Brand_NO,';
S2:='Goods_Brand,Norms_Type_NO,Norms_Type,Goods_Sphere,Goods_Column,Goods_Color_NO,Goods_Color,Goods_Coding,Enroll_Brand,Factory,';
s3:='Goods_abbrev,Base_Monad,Whole_Monad,Valid_Month,Valid_Day,Remark from [Goods_Information]';
openstr:=s1+s2+s3;
if ((PCol=1) or (PCol=2)) then //表示选择的是商品编号 选择的是第一列
begin
Goods_Check_str:='';
frm_Goods_Check:=Tfrm_Goods_Check.Create(self);
frm_Goods_Check.ShowModal;
if Goods_Check_str='Stock_0008' then
begin
try
with frm_data.ClientDataSet_Add do
begin
Close;
CommandText:='';
CommandText:='select * from [Goods_Information] where Goods_No='''+Goods_No_Str+'''';
Open;
StringGrid1.Cells[1,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Goods_NO').AsString;//商品编号
StringGrid1.Cells[2,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Name').AsString;//商品名称
StringGrid1.Cells[4,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Modal_No').AsString;//类别编号
StringGrid1.Cells[5,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Modal').AsString; //类别名称
StringGrid1.Cells[6,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Cards_NO').AsString;//品牌编号
StringGrid1.Cells[7,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Cards').AsString; //品牌名称
StringGrid1.Cells[8,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Brand_NO').AsString;//品种编号
StringGrid1.Cells[9,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Brand').AsString; //品种名称
StringGrid1.Cells[10,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Norms_Type_NO').AsString;//规格型号代码
StringGrid1.Cells[11,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Norms_Type').AsString;//规格型号名称
StringGrid1.Cells[12,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Sphere').AsString;//球面度数
StringGrid1.Cells[13,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Column').AsString;//柱面度数
StringGrid1.Cells[14,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Color_NO').AsString;//颜色代码
StringGrid1.Cells[15,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Color').AsString;//颜色名称
StringGrid1.Cells[16,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Coding').AsString;//商品条玛
StringGrid1.Cells[17,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Enroll_Brand').AsString;//注册商标
StringGrid1.Cells[19,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Factory').AsString;//生产厂家
StringGrid1.Cells[19,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Goods_abbrev').AsString;//商品简称
StringGrid1.Cells[20,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Base_Monad').AsString;//基本单位
StringGrid1.Cells[21,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Whole_Monad').AsString;//整件单位
StringGrid1.Cells[22,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Valid_Month').AsString; //有效日期
StringGrid1.Cells[23,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Valid_Day').AsString; //有效日期
StringGrid1.Cells[24,String_Col]:=frm_data.ClientDataSet_Add.FieldByName('Remark').AsString; //备注说明
end;
except
application.MessageBox('操作失败,请检查连接网络是否正常?请确认!',pchar(application.Title),mb_iconwarning);
end;
end;
frm_Goods_Check.Free;
end;
end;
procedure Tfrm_Goods_Write.StringGrid1DrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
with sender as TStringGrid do
begin
if (GDFocused in state) then
begin
Pcol:=Acol;
Prow:=ARow;
func.String_Col:=ARow;
end;
end;
end;
procedure Tfrm_Goods_Write.Edit1DblClick(Sender: TObject);
begin
Edit1.Text:=ForMatdateTime('yyyy''-''mm''-''dd',now);
end;
procedure Tfrm_Goods_Write.Edit8DblClick(Sender: TObject);
begin
Edit8.Text:=Handle_Man;
end;
procedure Tfrm_Goods_Write.Edit8KeyPress(Sender: TObject; var Key: Char);
begin
if Key=#13 then
Edit8.Text:=Handle_Man;
end;
procedure Tfrm_Goods_Write.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
Edit1.Text:=ForMatdateTime('yyyy''-''mm''-''dd',now);
end;
procedure Tfrm_Goods_Write.Cmd1Click(Sender: TObject);
begin
if Flag1=1 then
begin
if Application.MessageBox('确定需要【审核】该单据吗?请确认!',pchar(application.Title),mb_okcancel)=idok then
begin
try
with frm_data.ClientDataSet4 do
begin
Close;
Commandtext:='';
Commandtext:='Update [Receipt] set Examine_Man1='''+Trim(Handle_Man)+''' where Receipt_No='''+Trim(Edit2.Text)+''' and Receipt_Name=''来货登记单''';
Execute;
L1.Caption:='';
L1.Caption:=LevelName1+'【已审】';
Flag1:=2;
Application.MessageBox('【审核】操作成功!请确认',Pchar(application.Title),MB_ICONwarning);
Cmd_Check_Filsh;
end;
except
Application.MessageBox('【审核】操作失败!,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
end
else if Flag1=2 then
begin
if Application.MessageBox('确定需要【反审核】该单据吗?'+#13#10+'如果【反审核】你将使后面级别的人的【审核】作废,'+#13#10+'后面级别的人必须重新【审核】,才能够生效,请确认!',pchar(application.Title),mb_okcancel)=idok then
begin
try
with frm_data.ClientDataSet4 do
begin
Close;
Commandtext:='';
Commandtext:='Update [Receipt] set Examine_Man1='''',Examine_Man2='''',Examine_Man3='''',Examine_Man4='''',Examine_Man5='''' where Receipt_No='''+Trim(Edit2.Text)+''' and Receipt_Name=''来货登记单''';
Execute;
L1.Caption:=LevelName1+':'+Handle_Man;
L2.Caption:=LevelName2+':'+Handle_Man;
L3.Caption:=LevelName3+':'+Handle_Man;
L4.Caption:=LevelName4+':'+Handle_Man;
L5.Caption:=LevelName5+':'+Handle_Man;
Flag2:=1; Flag3:=1; Flag4:=1; Flag5:=1;
L1.Visible:=True;
Flag1:=1;
Application.MessageBox('【反审核】操作成功!请确认',Pchar(application.Title),MB_ICONwarning);
Cmd_Check_Filsh;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -