📄 u_form_wastebill_emptybox.~pas
字号:
unit U_Form_WasteBill_EmptyBox;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, EasyGrid, StdCtrls, Mask, ButtonExCtl,uAdoSet,uCheckValidate,uString;
type
TForm_WasteBill_EmptyBox = class(TForm)
GroupBox1: TGroupBox;
BtnSave: TButtonExCtl;
BtnExit: TButtonExCtl;
BtnFind: TButtonExCtl;
Label3: TLabel;
ButtonExCtl1: TButtonExCtl;
beginDate: TMaskEdit;
GroupBox2: TGroupBox;
Grid1: TEasyGrid;
procedure BtnExitClick(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure FormCreate(Sender: TObject);
procedure BtnFindClick(Sender: TObject);
procedure BtnSaveClick(Sender: TObject);
procedure ButtonExCtl1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
_AdoNewProduce:TuAdoSet;
_Check:TCheckValidate;
_str:TuString;
public
{ Public declarations }
end;
var
Form_WasteBill_EmptyBox: TForm_WasteBill_EmptyBox;
implementation
uses U_Form_MainMenu,uGlobal;
{$R *.dfm}
procedure TForm_WasteBill_EmptyBox.BtnExitClick(Sender: TObject);
begin
EnableWindow(Form_MainMenu.Handle,true);
Close;
end;
procedure TForm_WasteBill_EmptyBox.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
EnableWindow(Form_MainMenu.Handle,true);
CanClose:=true;
end;
procedure TForm_WasteBill_EmptyBox.FormCreate(Sender: TObject);
begin
_AdoNewProduce:=TuAdoSet.Create('newProduce',1);
_Check:=TCheckValidate.create;
_str:=TuString.Create;
beginDate.Text:=formatDateTime('yyyy-mm-dd',now);
with _AdoNewProduce do
begin
setGridTitle(grid1,1,'序号',60);
setGridTitle(grid1,2,'产品名称',140);
setGridTitle(grid1,3,'规格',80);
setGridTitle(grid1,4,'单位',80);
setGridTitle(grid1,5,'空箱数',90);
end;
end;
procedure TForm_WasteBill_EmptyBox.BtnFindClick(Sender: TObject);
var
param:TStringList;
strSql:string;
i:integer;
begin
param:=TStringList.Create;
param.clear;
{/*
开始检索数据 ,fxdgdfg
*/}
param.Add(_whichStore);
strSql:='select OrderID,ProduceName,specification,UnitName from sale_Storage Where whichStore=:s1 order by OrderID';
_AdoNewproduce.BindToGrid_JK(grid1,strsql,param,1,4,1);
grid1.Refresh;
end;
procedure TForm_WasteBill_EmptyBox.BtnSaveClick(Sender: TObject);
var
param:TStringList;
strsql:string;
i,j:integer;
begin
param:=TStringList.Create;
param.clear;
{/*
2008.04.09
入库之前先检查是否进行接班任务
*/}
param.clear;
param.Add(trim(formatDateTime('yyyy-mm-dd',now)));
param.add('1');
strsql:='select * from sale_followStore_Flag where SF_CheckDate=:s1 and SF_Flag=:s2';
if _AdoNewProduce.getRecordCount(strsql,param)<=0 then
begin
showmessage('请首先进行接班库存盘点工作,然后在进行其他操作...');
exit;
end;
{/*
查询当天的损耗记录是否存在
*/}
param.Clear;
param.Add(trim(beginDate.text));
param.Add(trim(_whichStore));
strSql:='select * from sale_wasteBill_EmptyBox where SWE_CheckDate=:s1 and SWE_whichStore=:s2';
if _AdoNewProduce.getRecordCount(strSql,param)>0 then
begin
if Application.MessageBox(Pchar('当天的损耗记录已经存在,是否覆盖存盘?'),'系统提示!',MB_YESNO+MB_IconWarning)=id_yes then
begin
{/*
覆盖存盘操作
*/}
param.clear;
param.Add(trim(beginDate.text));
param.Add(trim(_whichStore));
strsql:='delete from sale_wasteBill_EmptyBox where SWE_CheckDate=:s1 and SWE_whichStore=:s2';
_AdoNewproduce.actionRecord(strsql,param);
{/*
存盘操作
*/}
for i:=2 to grid1.RowCount-3 do
begin
param.clear;
param.Add(trim(grid1.cells[1,i].foretext));
param.Add(trim(grid1.cells[2,i].foretext));
param.Add(trim(grid1.cells[3,i].foretext));
param.Add(trim(grid1.cells[4,i].foretext));
if grid1.cells[5,i].foretext<>'' then
begin
param.Add(trim(grid1.cells[5,i].foretext));
end
else
begin
param.add('0');
end;
param.Add(trim(_whichStore));
param.Add(trim(beginDate.text));
param.Add(trim(_StoreMan));
strsql:='insert into sale_wasteBill_EmptyBox(SWE_OrderID,SWE_produceName,SWE_specification,SWE_UnitName,';
strsql:=strsql+'SWE_EmptyBoxNum,SWE_WhichStore,SWE_CheckDate,SWE_StoreMan) Values(:s1,:s2,:s3,:s4,:s5,:s6,:s7,:s8)';
_AdoNewProduce.actionRecord(strsql,param);
end;//for i
_str.actionOK(aT_save);
end;//Application
end//if -Ado
else
begin
{/*
存盘操作
*/}
for i:=2 to grid1.RowCount-3 do
begin
param.clear;
param.Add(trim(grid1.cells[1,i].foretext));
param.Add(trim(grid1.cells[2,i].foretext));
param.Add(trim(grid1.cells[3,i].foretext));
param.Add(trim(grid1.cells[4,i].foretext));
if grid1.cells[5,i].foretext<>'' then
begin
param.Add(trim(grid1.cells[5,i].foretext));
end
else
begin
param.add('0');
end;
param.Add(trim(_whichStore));
param.Add(trim(beginDate.text));
param.Add(trim(_StoreMan));
strsql:='insert into sale_wasteBill_EmptyBox(SWE_OrderID,SWE_produceName,SWE_specification,SWE_UnitName,';
strsql:=strsql+'SWE_EmptyBoxNum,SWE_WhichStore,SWE_CheckDate,SWE_StoreMan) Values(:s1,:s2,:s3,:s4,:s5,:s6,:s7,:s8)';
_AdoNewProduce.actionRecord(strsql,param);
end;//for i
_str.actionOK(aT_save);
end;
end;
procedure TForm_WasteBill_EmptyBox.ButtonExCtl1Click(Sender: TObject);
var
param:TStringList;
strsql:string;
i,j:integer;
begin
{/*
查询当天的损耗,如果不存在提示不存在
否则,如果存在调出损耗记录
*/}
param:=TStringList.Create;
param.clear;
param.Add(trim(beginDate.text));
param.Add(trim(_whichStore));
strSql:='select SWE_orderID,SWE_ProduceName,SWE_specification,SWE_unitName,SWE_EmptyBoxNum,';
strsql:=strsql+' from sale_wasteBill_EmptyBox where SWe_checkdate=:s1 and SWe_whichStore=:s2';
if _AdoNewproduce.getRecordCount(strSql,param)<=0 then
begin
for i:=2 to grid1.RowCount-1 do
begin
for j:=5 to grid1.ColCount-1 do
begin
grid1.cells[j,i].ForeText:='';
end;
end;
grid1.Refresh;
showmessage('当天的空箱损耗的记录不存在...');
exit;
end
else
begin
for i:=2 to grid1.RowCount-1 do
begin
for j:=5 to grid1.ColCount-1 do
begin
grid1.cells[j,i].ForeText:='';
end;
end;
grid1.Refresh;
param.clear;
param.Add(trim(beginDate.text));
param.Add(trim(_whichStore));
strSql:='select SWE_orderID,SWE_ProduceName,SWE_specification,SWE_unitName,SWE_EmptyBoxNum ';
strsql:=strsql+' from sale_wasteBill_EmptyBox where SWe_checkdate=:s1 and SWe_whichStore=:s2';
_AdoNewProduce.BindToGrid_JK(grid1,strsql,param,1,grid1.ColCount-1,1);
grid1.Refresh;
end;
end;
procedure TForm_WasteBill_EmptyBox.FormShow(Sender: TObject);
var
i,j:integer;
begin
for i:=2 to grid1.RowCount-1 do
begin
for j:=1 to grid1.ColCount-1 do
begin
grid1.Cells[j,i].ForeText:='';
end;
end;
grid1.RowCount:=3;
grid1.Refresh;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -