?? goods.pas
字號:
frm_Goods_Select.Caption:='【商品類別選擇】';
frm_Goods_Select.TabSheet1.TabVisible:=True;
frm_Goods_Select.TabSheet2.TabVisible:=False;
frm_Goods_Select.TabSheet3.TabVisible:=False;
frm_Goods_Select.TabSheet4.TabVisible:=False;
frm_Goods_Select.ShowModal;
if Subject_Back='0001' then
begin
EG2.Text:=Subject_No;
EG3.Text:=Subject_Name;
end;
frm_Goods_Select.Free;
end;
procedure Tfrm_Goods.SpeedButton13Click(Sender: TObject);
begin
if Trim(EG2.Text)='' then
begin
Application.MessageBox('操作錯誤,[商品類別]不能為空!,請確認!',pchar(application.Title),mb_iconwarning);
Exit;
end;
Subject_Str:='';Subject_No:='';Subject_Name:='';
Subject_Str:='0002';//如果等于0002表示商品品牌選擇
EG5.Clear; EG5.Text:='';
G_Modal:=''; //取得商品類別的名稱
G_Modal:=Trim(EG3.Text);
frm_Goods_Select:=Tfrm_Goods_Select.Create(self);
frm_Goods_Select.Caption:='【商品品牌選擇】';
frm_Goods_Select.TabSheet1.TabVisible:=False;
frm_Goods_Select.TabSheet2.TabVisible:=True;
frm_Goods_Select.TabSheet3.TabVisible:=False;
frm_Goods_Select.TabSheet4.TabVisible:=False;
frm_Goods_Select.ShowModal;
if Subject_Back='0002' then
begin
EG4.Text:=Subject_No;
EG5.Text:=Subject_Name;
EG16.Text:=Subject_Facility;
end;
frm_Goods_Select.Free;
end;
procedure Tfrm_Goods.SpeedButton14Click(Sender: TObject);
begin
if Trim(EG2.Text)='' then
begin
Application.MessageBox('操作錯誤,[商品類別]不能為空!,請確認!',pchar(application.Title),mb_iconwarning);
Exit;
end;
if Trim(EG4.Text)='' then
begin
Application.MessageBox('操作錯誤,[商品品牌]不能為空!,請確認!',pchar(application.Title),mb_iconwarning);
Exit;
end;
Subject_Str:='';Subject_No:='';Subject_Name:='';
Subject_Str:='0003';//如果等于0001表示商品類別選擇
EG7.Clear; EG7.Text:='';
G_Cards:='';
G_Cards:=Trim(EG5.Text);
frm_Goods_Select:=Tfrm_Goods_Select.Create(self);
frm_Goods_Select.Caption:='【商品品種別選擇】';
frm_Goods_Select.TabSheet1.TabVisible:=False;
frm_Goods_Select.TabSheet2.TabVisible:=False;
frm_Goods_Select.TabSheet3.TabVisible:=True;
frm_Goods_Select.TabSheet4.TabVisible:=False;
frm_Goods_Select.ShowModal;
if Subject_Back='0003' then
begin
EG6.Text:=Subject_No;
EG7.Text:=Subject_Name;
end;
frm_Goods_Select.Free;
end;
procedure Tfrm_Goods.Cmd_YSClick(Sender: TObject);
begin
Subject_Str:='';Subject_No:='';Subject_Name:='';
Subject_Str:='0004';//如果等于0001表示商品類別選擇
EG12.Clear; EG13.Text:='';
frm_Goods_Select:=Tfrm_Goods_Select.Create(self);
frm_Goods_Select.Caption:='【商品顏色選擇】';
frm_Goods_Select.TabSheet1.TabVisible:=False;
frm_Goods_Select.TabSheet2.TabVisible:=False;
frm_Goods_Select.TabSheet3.TabVisible:=False;
frm_Goods_Select.TabSheet4.TabVisible:=True;
frm_Goods_Select.ShowModal;
if Subject_Back='0004' then
begin
EG12.Text:=Subject_No;
EG13.Text:=Subject_Name;
Str_NO:= Str_NO+Trim(EG12.Text)+'_';
EG1.Text:=Str_NO;
end;
frm_Goods_Select.Free;
end;
procedure Tfrm_Goods.CheckBox4Click(Sender: TObject);
begin
if CheckBox6.Checked=True then
begin
Application.MessageBox('【球面度數(shù)】批量錄入時【柱面度數(shù)】不能批量錄入!',Pchar(Application.Title),MB_ICONWarning);
CheckBox6.Checked:=false;
Exit;
end;
if CheckBox4.Checked=True then
begin
frm_Batch_Insert:=tfrm_Batch_Insert.Create(self);
frm_Batch_Insert.ShowModal;
Edit_KD.Text:=Str_KD;
Edit_KS.Text:=Str_KS;
Edit_JS.Text:=Str_JS;
K_R:=StrTofloat(Str_KD);
B_R:=StrTofloat(Str_KS);
J_R:=StrTofloat(Str_JS);
frm_Batch_Insert.Free;
end;
end;
procedure Tfrm_Goods.CheckBox6Click(Sender: TObject);
begin
if CheckBox4.Checked=True then
begin
Application.MessageBox('【柱面度數(shù)】批量錄入時【球面度數(shù)】不能批量錄入!',Pchar(Application.Title),MB_ICONWarning);
CheckBox4.Checked:=false;
Exit;
end;
if CheckBox6.Checked=True then
begin
frm_Batch_Insert:=tfrm_Batch_Insert.Create(self);
frm_Batch_Insert.ShowModal;
Edit_KD.Text:=Str_KD;
Edit_KS.Text:=Str_KS;
Edit_JS.Text:=Str_JS;
K_R:=StrTofloat(Str_KD);
B_R:=StrTofloat(Str_KS);
J_R:=StrTofloat(Str_JS);
frm_Batch_Insert.Free;
end;
end;
procedure Tfrm_Goods.CheckBox3Click(Sender: TObject);
begin
if CheckBox3.Checked=True then
begin
EG10.Enabled:=true;
EG10.Clear;EG10.Text:='';
CheckBox4.Enabled:=True;
CheckBox5.Enabled:=True;
end
else
begin
EG10.Enabled:=False;
EG10.Clear;EG10.Text:='';
CheckBox4.Checked:=false;
CheckBox6.Checked:=false;
CheckBox4.Enabled:=false;
CheckBox5.Enabled:=false;
EG11.Enabled:=False;
EG11.Clear;EG11.Text:='';
CheckBox6.Enabled:=false;
end;
end;
procedure Tfrm_Goods.CheckBox5Click(Sender: TObject);
begin
if CheckBox5.Checked=True then
begin
EG11.Enabled:=true;
EG11.Clear;EG11.Text:='';
CheckBox6.Enabled:=True;
end
else
begin
EG11.Enabled:=False;
EG11.Clear;EG11.Text:='';
CheckBox6.Enabled:=false;
end;
end;
procedure Tfrm_Goods.SpeedButton11Click(Sender: TObject);
var
tempstr,tempsql,tempText:string;
openstr:string;
i:Integer;
begin
if (CheckBox4.Checked=False) and (checkbox6.Checked=False) then
begin
EG1.Text:=Copy(Str_NO,1,length(Str_NO)-1);
if Trim(EG1.Text)='' then
begin
application.MessageBox('添加失敗,【商品編號】不能為空!請檢查你的輸入是否正確,請確認!',pchar(application.Title),mb_iconwarning);
EG1.SetFocus;
Exit;
end;
tempstr:='';tempsql:='';tempText:='';openstr:='';
openstr:=' select * from [Goods_Information]';
tempstr:='insert into [Goods_Information](Goods_NO,Goods_Modal_No,Goods_Modal,Goods_Cards_NO,Goods_Cards,Goods_Brand_NO,Goods_Brand,Norms_Type_NO,Norms_Type,';
tempstr:=tempstr+'Goods_Sphere,Goods_Column,Goods_Color_NO,Goods_Color,Goods_Coding,Enroll_Brand,Factory,Goods_Name,Goods_abbrev,Base_Monad,Whole_Monad,Valid_Month,Valid_Day,Remark)';
tempsql:='values ('''+Trim(EG1.Text)+''','''+Trim(EG2.Text)+''','''+Trim(EG3.Text)+''','''+Trim(EG4.Text)+''','''+Trim(EG5.Text)+''','''+Trim(EG6.Text)+''','''+Trim(EG7.Text)+''','''+Trim(EG8.Text)+''','''+Trim(EG9.Text)+''','''+Trim(EG10.Text)+''','''+Trim(EG11.Text)+''','''+Trim(EG12.Text)+''','''+Trim(EG13.Text)+''','''+Trim(EG14.Text)+''','''+Trim(EG15.Text)+''','''+Trim(EG16.Text)+''','''+Trim(EG17.Text)+''','''+Trim(EG18.Text)+''','''+Trim(EG19.Text)+''','''+Trim(EG20.Text)+''','''+Trim(EG21.Text)+''','''+Trim(EG22.Text)+''','''+Trim(EG23.Text)+''')';
tempText:=Trim(tempstr)+Trim(tempsql);
with frm_data.ClientDataSet_Add do
begin
Close;
CommandText:='';
CommandText:='select * from [Goods_Information] where Goods_No='''+Trim(EG1.Text)+''' and Goods_Name='''+Trim(EG17.Text)+'''';
try
Open;
if frm_data.ClientDataSet_Add.RecordCount>0 then
begin
application.MessageBox('添加失敗,該記錄已經(jīng)存在,請重新如數(shù)后在保存,請確認!',pchar(application.Title),mb_iconwarning);
Exit;
end
else
begin
with frm_data.Client_Goods do
begin
frm_data.Client_Goods.Open;
frm_data.Client_Goods.Insert;
openstr:=' select * from [Goods_Information]';
frm_data.Client_Goods.FieldByName('Goods_NO').AsString:=Trim(EG1.Text);
frm_data.Client_Goods.FieldByName('Goods_Modal_No').AsString:=Trim(EG2.Text);
frm_data.Client_Goods.FieldByName('Goods_Modal').AsString:=Trim(EG3.Text);
frm_data.Client_Goods.FieldByName('Goods_Cards_NO').AsString:=Trim(EG4.Text);
frm_data.Client_Goods.FieldByName('Goods_Cards').AsString:=Trim(EG5.Text);
frm_data.Client_Goods.FieldByName('Goods_Brand_NO').AsString:=Trim(EG6.Text);
frm_data.Client_Goods.FieldByName('Goods_Brand').AsString:=Trim(EG7.Text);
frm_data.Client_Goods.FieldByName('Norms_Type_NO').AsString:=Trim(EG8.Text);
frm_data.Client_Goods.FieldByName('Norms_Type').AsString:=Trim(EG9.Text);
frm_data.Client_Goods.FieldByName('Goods_Sphere').AsString:=Trim(EG10.Text);
frm_data.Client_Goods.FieldByName('Goods_Column').AsString:=Trim(EG11.Text);
frm_data.Client_Goods.FieldByName('Goods_Color_NO').AsString:=Trim(EG12.Text);
frm_data.Client_Goods.FieldByName('Goods_Color').AsString:=Trim(EG13.Text);
frm_data.Client_Goods.FieldByName('Goods_Coding').AsString:=Trim(EG14.Text);
frm_data.Client_Goods.FieldByName('Enroll_Brand').AsString:=Trim(EG15.Text);
frm_data.Client_Goods.FieldByName('Factory').AsString:=Trim(EG16.Text);
frm_data.Client_Goods.FieldByName('Goods_Name').AsString:=Trim(EG17.Text);
frm_data.Client_Goods.FieldByName('Goods_abbrev').AsString:=Trim(EG18.Text);
frm_data.Client_Goods.FieldByName('Base_Monad').AsString:=Trim(EG19.Text);
frm_data.Client_Goods.FieldByName('Whole_Monad').AsString:=Trim(EG20.Text);
frm_data.Client_Goods.FieldByName('Valid_Month').AsString:=Trim(EG21.Text);
frm_data.Client_Goods.FieldByName('Valid_Day').AsString:=Trim(EG22.Text);
frm_data.Client_Goods.FieldByName('Remark').AsString:=Trim(EG23.Text);
try
post;
frm_data.Client_Goods.SaveToFile('Client_Goods_Information.cds');
application.MessageBox('【商品基本信息】,添加成功,請確認!',pchar(application.Title),mb_iconwarning);
except
application.MessageBox('添加【商品基本信息】失敗,請檢查連接網(wǎng)絡是否正常或數(shù)據(jù)格式是否正確,請確認!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
end;
except
Application.MessageBox('系統(tǒng)錯誤!打開【商品基本信息表】時出錯!請確認!',Pchar(Application.Title),MB_ICONWarning);
Exit;
end;
end;
end;
//球面度數(shù)批量錄入
if (CheckBox4.Checked=True) and (CheckBox6.Checked=False) then //球面度數(shù)批量錄入
begin
if (Trim(Edit_KD.Text)='') or (trim(Edit_KS.Text)='') or (trim(Edit_JS.Text)='') then
begin
Application.MessageBox('錯誤操作,你已經(jīng)選擇【球面度數(shù)批量錄入】,'+#13#10#13+'【變化幅度】、【起始度數(shù)】、【截止度數(shù)】均不能為空!請確認!',pchar(application.Title),mb_iconwarning);
Exit;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -