📄 u_form_producestock_dx1.pas
字号:
param.Add(trim(_whichStore));
strsql:='select * from sale_followStore_Flag where SF_CheckDate=:s1 and SF_Flag=:s2 and SF_whichStore=:s3';
if _AdoNewProduce.getRecordCount(strsql,param)<=0 then
begin
showmessage('请首先进行接班库存盘点工作,然后在进行其他操作...');
exit;
end;
{/*
存盘前验证输入数据
*/}
if not _check.Do_Control(edit2,1,'请输入要倒箱前的数量...') then exit;
if not _check.Do_Control(combobox4,1,'请选择倒箱后的产品名称...') then exit;
if not _check.Do_Control(combobox5,1,'请选择倒箱后的产品规格...') then exit;
if not _check.Do_Control(combobox6,1,'请选择倒箱后的产品包装...') then exit;
if not _check.Do_Control(edit4,1,'请选择倒箱后的数量...') then exit;
{/*
记录存盘1.将倒箱前的记录存储到表:
2.将倒箱后的记录存储到表:
*/}
if _str.saveMessage then
begin
{/*
查询当前编号的记录是否存在
*/}
param.clear;
param.Add(trim(_whichStore));
param.Add(trim(formatDateTime('yyyy-mm-dd',now)));
strsql:='select * from sale_IntoStore_DX_before where SIB_whichStore=:s1 and SIB_IntoDate=:s2';
if _adonewproduce.getRecordCount(strsql,param)>0 then
begin
showmessage('倒箱前此编号的记录已经存在...');
exit;
end;
{/*
首先将倒箱前的记录存储到表newproduce-->sale_IntoStore_DX_before中
然后将倒箱后的记录存储到表newproduce-->sale_IntoStore_DX_After中
*/}
param.clear;
param.Add(trim(edit1.text));
param.Add(trim(beginDate.text));
param.Add(trim(TimeTostr(beginTime.Time)));
param.Add(trim(combobox1.text));
param.Add(trim(combobox2.text));
param.Add(trim(combobox3.text));
param.Add(trim(edit2.text));
param.Add('0');
param.Add('0');
param.Add(trim(_whichStore));
param.Add(trim(_StoreMan));
strSql:='insert into sale_IntoStore_DX_before(SIB_IntoBillCode,SIB_IntoDate,SIB_IntoTime,SIB_productName,SIB_specification,SIB_unitName,';
strSql:=strSql+'SIB_productNum,SIB_EmptyBoxNum,SIB_bottleNum,SIB_whichStore,SIB_StoreMan) Values(:s1,:s2,:s3,:s4,:s5,:s6,:s7,:s8,:s9,:s10,:s11)';
_AdoNewproduce.actionRecord(strsql,param);
{/*
查询当前编后的记录是否存在
param.clear;
param.Add(trim(_whichStore));
param.Add(trim(formatDateTime('yyyy-mm-dd',now)));
strsql:='select * from sale_IntoStore_DX_After where SIA_whichStore=:s1 and SIA_IntoDate=:s2';
if _adonewproduce.getRecordCount(strsql,param)>0 then
begin
showmessage('倒箱后此编号的记录已经存在...');
exit;
end;
*/}
{/*
首先将倒箱前的记录存储到表newproduce-->sale_IntoStore_DX_before中
然后将倒箱后的记录存储到表newproduce-->sale_IntoStore_DX_After中
*/}
for i:=2 to grid1.RowCount-2 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));
param.Add(trim(grid1.cells[5,i].foretext));
param.Add(trim(grid1.cells[6,i].foretext));
param.Add(trim(grid1.cells[7,i].foretext));
param.Add(trim(grid1.cells[8,i].foretext));
param.Add(trim(grid1.cells[9,i].foretext));
param.Add(trim(_whichStore));
param.Add(trim(_StoreMan));
param.Add(trim(edit1.text));
strSql:='insert into sale_IntoStore_DX_After(SIA_IntoBillCode,SIA_IntoDate,SIA_IntoTime,SIA_productName,SIA_specification,SIA_unitName,';
strSql:=strSql+'SIA_productNum,SIA_EmptyBoxNum,SIA_bottleNum,SIA_whichStore,SIA_StoreMan,SIA_source) Values(:s1,:s2,:s3,:s4,:s5,:s6,:s7,:s8,:s9,:s10,:s11,:s12)';
_AdoNewproduce.actionRecord(strsql,param);
end;//for
end;
{/*
存盘后将更改库存数量(一).是使库存中倒箱前的产品数量减少
(二).是使库存中倒箱后的产品数量增加
*/}
{/*
(一)erewrewrewrewrwerew
*/}
param.Clear;
param.Add(_whichStore); /////1.添加酒库名称/////////
param.Add(combobox1.text); /////2.产品名称
param.Add(trim(combobox3.text)); /////3.包装//////
param.Add(trim(combobox2.text));
strSql:='select * from sale_Storage Where WhichStore=:s1 and ';
strsql:=strsql+' produceName=:s2 and UnitName=:s3 and Specification=:s4';
if _AdoNewproduce.getRecordCount(strsql,param)>0 then
begin
{/*
品种存在,首先得到原来库存的数量,然后存储到_StoreNum变量中
*/}
param.clear; ////清除查询条件
param.Add(_whichStore); ////1.添加酒库名称/////////
param.Add(combobox1.text); ////2.产品名称
param.Add(trim(combobox3.text)); ////3.规格//////
param.Add(trim(combobox2.text)); ////4.包装//////////
strSql:='select * from sale_Storage Where WhichStore=:s1 and ';
strsql:=strsql+' produceName=:s2 and UnitName=:s3 and Specification=:s4';
_boxNum:=_AdoNewProduce.getFieldValue(strsql,param,'boxNum'); /////得到成套数量
_bottleNum:=_AdoNewProduce.getFieldValue(strsql,param,'bottleNum'); /////得到瓶数量
_EmptyBoxNum:=_AdoNewProduce.getFieldValue(strsql,param,'EmptyBoxNum'); /////得到空箱数量
//showmessage(inttostr(_storeNum));
{/*
修改sale_storage库存中的数量,使库存中倒箱前的产品数量减少
*/}
param.clear;
param.Add(inttostr(_boxNum-strtoint(edit2.text))); ////1.修改整箱数量
param.Add(_whichStore); ////2.添加酒库名称/////////
param.Add(combobox1.text); ////3.产品名称
param.Add(trim(combobox3.text)); ////4.规格//////
param.Add(trim(combobox2.text)); ////5.包装//////////
strSql:='update sale_Storage set boxNum=:s1 Where WhichStore=:s2 ';
strsql:=strsql+' and produceName=:s3 and UnitName=:s4 and Specification=:s5';
_AdoNewProduce.actionRecord(strSql,param);
end; ////以上品种存在则,以下是品种不存在则添加
{/*
(二)erewrewrewrewrwerew
*/}
for i:=2 to grid1.RowCount-2 do
begin
param.Clear;
param.Add(_whichStore); /////1.添加酒库名称/////////
param.Add(trim(grid1.cells[4,i].foretext)); /////2.产品名称
param.Add(trim(grid1.cells[5,i].foretext)); /////3.包装//////
param.Add(trim(grid1.cells[6,i].foretext));
strSql:='select * from sale_Storage Where WhichStore=:s1 and ';
strsql:=strsql+' produceName=:s2 and Specification=:s4 and UnitName=:s3 ';
if _AdoNewproduce.getRecordCount(strsql,param)>0 then
begin
{/*
品种存在,首先得到原来库存的数量,然后存储到_StoreNum变量中
*/}
param.clear; ////清除查询条件
param.Add(trim(grid1.cells[4,i].foretext)); /////2.产品名称
param.Add(trim(grid1.cells[5,i].foretext)); /////3.包装//////
param.Add(trim(grid1.cells[6,i].foretext)); ////4.包装//////////
strSql:='select * from sale_Storage Where WhichStore=:s1 and ';
strsql:=strsql+' produceName=:s2 and Specification=:s4 and UnitName=:s3 ';
_boxNum:=_AdoNewProduce.getFieldValue(strsql,param,'boxNum'); /////得到成套数量
_bottleNum:=_AdoNewProduce.getFieldValue(strsql,param,'bottleNum'); /////得到瓶数量
_EmptyBoxNum:=_AdoNewProduce.getFieldValue(strsql,param,'EmptyBoxNum'); /////得到空箱数量
//showmessage(inttostr(_storeNum));
{/*
修改sale_storage库存中的数量,使库存中倒箱后的产品数量增加
*/}
param.clear;
param.Add(inttostr(_boxNum+strtoint(edit4.text))); ////1.修改整箱数量
param.Add(inttostr(_emptyBoxNum+strtoint(edit5.text))); ////2.修改整箱数量
param.Add(inttostr(_bottleNum+strtoint(edit6.text))); ////3.修改整箱数量
param.Add(_whichStore); ////4.添加酒库名称/////////
param.Add(trim(grid1.cells[4,i].foretext)); /////2.产品名称
param.Add(trim(grid1.cells[5,i].foretext)); /////3.包装//////
param.Add(trim(grid1.cells[6,i].foretext)); ////7.包装//////////
strSql:='update sale_Storage set boxNum=:s1,emptyBoxNum=:s2,bottleNum=:s3 Where WhichStore=:s4 ';
strsql:=strsql+' and produceName=:s5and Specification=:s7 and UnitName=:s6 ';
_AdoNewProduce.actionRecord(strSql,param);
end ////以上品种存在则,以下是品种不存在则添加
else
begin
{/*
为了计算编号,首先得到一线酒库的记录数
*/}
param.clear;
param.Add(_whichStore);
strSql:='select * from sale_storage Where whichStore=:s1';
_OrderID:=_AdoNewproduce.getRecordCount(strsql,param)+1;
{/*
添加品种数量
*/}
param.clear;
param.Add(inttostr(_OrderID)); /////1.产品序号
param.Add(trim(grid1.cells[4,i].foretext)); /////2.产品名称
param.Add(trim(grid1.cells[5,i].foretext)); /////3.包装//////
param.Add(trim(grid1.cells[6,i].foretext));
param.Add(trim(grid1.cells[7,i].foretext)); /////2.产品名称
param.Add(trim(grid1.cells[8,i].foretext)); /////3.包装//////
param.Add(trim(grid1.cells[9,i].foretext));
param.Add(_whichStore); /////8.酒库名称
strsql:='insert into sale_storage(OrderID,produceName,specification,UnitName,';
strsql:=strsql+'boxNum,EmptyBoxNum,bottleNum,WhichStore) Values(:s1,';
strsql:=strsql+':s2,:s3,:s4,:s5,:s6,:s7,:s8)';
_AdoNewProduce.actionRecord(strsql,param);
end;/////if
end;//for
_str.actionOK(at_save);
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;
procedure TForm_productStock_DX1.ButtonExCtl1Click(Sender: TObject);
begin
grid1.Cells[1,grid1.RowCount-1].ForeText:=trim(edit3.text);
grid1.Cells[2,grid1.RowCount-1].ForeText:=trim(beginDate.text);
grid1.Cells[3,grid1.RowCount-1].ForeText:=trim(TimeTostr(beginTime1.Time));
grid1.Cells[4,grid1.RowCount-1].ForeText:=trim(combobox4.text);
grid1.Cells[5,grid1.RowCount-1].ForeText:=trim(combobox5.text);
grid1.Cells[6,grid1.RowCount-1].ForeText:=trim(combobox6.text);
grid1.Cells[7,grid1.RowCount-1].ForeText:=trim(edit4.text);
grid1.Cells[8,grid1.RowCount-1].ForeText:=trim(edit5.text);
grid1.Cells[9,grid1.RowCount-1].ForeText:=trim(edit6.text);
grid1.RowCount:=grid1.RowCount+1;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -