📄 storeoperate.~pas
字号:
unit storeoperate;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, StdCtrls, DB, ADODB, DBClient,store_unit,place_unit,
ComCtrls, Buttons, ExtCtrls,product_unit;
type
Tstoreoperatefrm = class(TForm)
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
pro_code1: TLabel;
pro_numlb: TLabel;
pro_numed: TEdit;
DBGrid1: TDBGrid;
GroupBox3: TGroupBox;
pro_code2: TLabel;
place_codelb: TLabel;
Check_Reset1: TButton;
place_codeed: TEdit;
Check_Reset2: TButton;
storeoperate_ds1: TDataSource;
storeoperate_cds1: TClientDataSet;
Label2: TLabel;
UpDown1: TUpDown;
cancel_btn: TBitBtn;
pro_codeed1: TComboBox;
pro_codeed2: TComboBox;
procedure cancel_btnClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Check_Reset1Click(Sender: TObject);
procedure Check_Reset2Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
private
store:Tstore;
place:Tplace;
product:Tproduct;
{ Private declarations }
public
{ Public declarations }
end;
var
storeoperatefrm: Tstoreoperatefrm;
implementation
{$R *.dfm}
procedure Tstoreoperatefrm.cancel_btnClick(Sender: TObject);
begin
storeoperatefrm.Close;
end;
procedure Tstoreoperatefrm.FormCreate(Sender: TObject);
var
selstr:string;
begin
store:=Tstore.create ;
selstr:='SELECT PRO_INFO.PRO_NAME AS 物品名称, '
+' STORE_INFO.STORE_PRO_NUM AS 库存数量,'
+' STORE_INFO.UNIT AS 物品单位, PLACE_INFO.AREA_NAME AS 区域名称,'
+' PLACE_INFO.SHELF_NUM AS 货架号码, PLACE_INFO.FLOOR_NUM AS 层号, '
+' PLACE_INFO.LINE_NUM AS 列号 '
+' FROM STORE_INFO INNER JOIN '
+' PRO_INFO ON '
+' STORE_INFO.PRO_CODE = PRO_INFO.PRO_CODE INNER JOIN '
+' PLACE_INFO ON '
+' STORE_INFO.PLACE_CODE = PLACE_INFO.PLACE_CODE';
storeoperate_cds1.Data:=store.StoreRecs(selstr);
store.Free;
end;
procedure Tstoreoperatefrm.Check_Reset1Click(Sender: TObject);
var
recstr:string;
begin
store:=Tstore.create ;
if length(pro_codeed1.Text)<>12 then
begin
showmessage('物品编码位数不对!');
exit;
end;
recstr:='select * from store_info where pro_code='''+pro_codeed1.Text+'''';
if store.StoreRec(recstr)=false then
begin
showmessage('库中该物品编号不存在!');
exit;
end;
recstr:='update store_info set store_pro_num='''+pro_numed.Text+''' where '
+ 'pro_code= (select pro_code from store_info where pro_code='''+pro_codeed1.Text +''' )';
store.StoreRecUpdate(recstr);
recstr:='SELECT PRO_INFO.PRO_NAME AS 物品名称, '
+' STORE_INFO.STORE_PRO_NUM AS 库存数量,'
+' STORE_INFO.UNIT AS 物品单位, PLACE_INFO.AREA_NAME AS 区域名称,'
+' PLACE_INFO.SHELF_NUM AS 货架号码, PLACE_INFO.FLOOR_NUM AS 层号, '
+' PLACE_INFO.LINE_NUM AS 列号 '
+' FROM STORE_INFO INNER JOIN '
+' PRO_INFO ON '
+' STORE_INFO.PRO_CODE = PRO_INFO.PRO_CODE INNER JOIN '
+' PLACE_INFO ON '
+' STORE_INFO.PLACE_CODE = PLACE_INFO.PLACE_CODE';
storeoperate_cds1.Data:=store.StoreRecs(recstr);
showmessage('信息保存完毕!');
pro_codeed1.Text :='';pro_numed.Text :='';
store.free;
end;
procedure Tstoreoperatefrm.Check_Reset2Click(Sender: TObject);
var
recsql,modsql:string;
begin
store:=Tstore.create ;
place:=Tplace.create ;
if length(pro_codeed2.Text)<>12 then
begin
showmessage('物品编码位数不对!');
exit;
end;
recsql:='select * from store_info where pro_code='''+pro_codeed2.Text+'''';
if store.StoreRec(recsql)=false then
begin
showmessage('库中该物品编号不存在!');
exit;
end;
if place.CheckRec(place_codeed.Text)=false then
begin
showmessage('对不起,该库位号不存在!');
exit;
end;
modsql:='update store_info set place_code='''+place_codeed.Text+'''where '
+ 'pro_code= (select pro_code from store_info where pro_code='''+pro_codeed2.Text +''' )';
store.StoreRecUpdate(modsql);
recsql:='SELECT PRO_INFO.PRO_NAME AS 物品名称, '
+' STORE_INFO.STORE_PRO_NUM AS 库存数量,'
+' STORE_INFO.UNIT AS 物品单位, PLACE_INFO.AREA_NAME AS 库位号,'
+' PLACE_INFO.SHELF_NUM AS 货架号码, PLACE_INFO.FLOOR_NUM AS 层号, '
+' PLACE_INFO.LINE_NUM AS 列号 '
+' FROM STORE_INFO INNER JOIN '
+' PRO_INFO ON '
+' STORE_INFO.PRO_CODE = PRO_INFO.PRO_CODE INNER JOIN '
+' PLACE_INFO ON '
+' STORE_INFO.PLACE_CODE = PLACE_INFO.PLACE_CODE';
storeoperate_cds1.Data:=store.StoreRecs(recsql);
showmessage('信息保存完毕!');
pro_codeed2.Text :='';place_codeed.Text :='';
store.Free;
end;
procedure Tstoreoperatefrm.FormActivate(Sender: TObject);
begin
product:=Tproduct.create;
pro_codeed2.Items:=product.GetProIdList();
pro_codeed1.Items :=product.GetProIdList ();
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -