📄 goods_write.pas
字号:
end;
except
Application.MessageBox('系统错误,保存[来货登记审核表]数据时出错!,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
except
Application.MessageBox('系统错误,保存[来货登记表]数据时出错!,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
end;
except
Application.MessageBox('系统错误,连接服务器数据库出错!,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
except
Application.MessageBox('保存数据时失败,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
except
Application.MessageBox('非法操作导致了系统错误!请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
//废弃退出
if Public_Do_Result='03' then
begin
Close;
frm_data.ClientDataSet_Add.Close;
frm_data.ClientDataSet_Add.Active:=False;
end;
end;
//草稿单据操作
if Public_Do='Business_Draft_0005' then
begin
//保存为单据
if Public_Do_Result='01' then
begin
with frm_data.ClientDataSet2 do
begin
Close;
CommandText:='';
Commandtext:='Select * from [V_Stock_Write_View] where Receipt_No='''+Trim(Edit2.Text)+'''';
try
Open;
Check_Flag:=frm_data.ClientDataSet2.FieldValues['Check_Result'];
if Check_Flag='0' then
begin
Application.MessageBox('单据还没有完全审核,不能过帐',pchar(application.Title),mb_iconwarning);
Exit;
end;
if Check_Flag='1' then
begin
with frm_data.ClientDataSet_Add do
begin
Close;
Commandtext:='';
Commandtext:='Update [Stock_Write] set Contract_No='''+Trim(Edit3.Text)+''',Gather_Name='''+Trim(Edit4.Text)+''',Storage_NO='''+Trim(Edit5.Text)+''',Transactor='''+Trim(Edit6.Text)+''',Shop_NO='''+Trim(Edit7.Text)+''',Proposer='''+Trim(Edit8.Text)+''',Condense='''+Trim(Edit9.Text)+''',Remark='''+Trim(Edit10.Text)+''' where Stock_No='''+Trim(List_NO)+'''';
try
Execute;
try
for i:=1 to Total_Count do
begin
with frm_data.ClientDataSet_Add do
begin
Close;
frm_data.ClientDataSet_Add.CommandText:='';
CommandText:='update [Stock_Write_detail] set Write_Amount='''+Trim(StringGrid1.Cells[3,i])+''',Write_Remark='''+Trim(StringGrid1.Cells[24,i])+''' where Stock_NO='''+Trim(List_NO)+''' and Goods_NO='''+Trim(StringGrid1.Cells[1,i])+'''';
try
Execute;
except
Application.MessageBox('保存[来货登记单明细]时失败,请检查连接网络是否正常数据输入是否正确?请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
end;
with frm_data.ClientDataSet_Add do
begin
Close;
Commandtext:='';
Commandtext:='Update [Receipt] set Flag_sign=''单据'' where Receipt_No='''+Trim(Edit2.Text)+'''';
try
Execute;
Application.MessageBox('恭喜你![来货登记]单据过帐操作成功,请确认!',Pchar(Application.Title),MB_ICONwarning);
except
Application.MessageBox('保存[来货登记审核表]数据时,连接服务器数据库错误,请尝试重新连接,请确认!',Pchar(Application.Title),MB_ICONwarning);
Exit;
end;
end;
except
Application.MessageBox('保存[来货登记单明细]时循环失败,请检查连接网络是否正常数据输入是否正确?请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
except
Application.MessageBox('保存[来货登记单]时失败,请检查连接网络是否正常数据输入是否正确?请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
end;
except
Application.MessageBox('系统错误,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
end;
//修改草稿单据
if Public_Do_Result='02' then
begin
try
with frm_data.ClientDataSet_Add do
begin
Close;
Commandtext:='';
Commandtext:='Update[Stock_Write] set Copy_Date='''+Trim(Edit1.Text)+''',Contract_No='''+Trim(Edit3.Text)+''',Gather_Name='''+Trim(Edit4.Text)+''',Storage_Name='''+Trim(Edit5.Text)+''',Transactor='''+Trim(Edit6.Text)+''',Shop_NO='''+Trim(Edit7.Text)+''',proposer='''+Trim(Edit8.Text)+''',Condense='''+Trim(Edit9.Text)+''',Remark='''+Trim(Edit10.Text)+''' where Stock_No='''+Trim(List_NO)+'''';
try
Execute;
try
for i:=1 to Total_Count do
begin
with frm_data.ClientDataSet_Add do
begin
Close;
frm_data.ClientDataSet_Add.CommandText:='';
CommandText:='update [Stock_Write_detail] set Write_Amount='''+Trim(StringGrid1.Cells[3,i])+''',Write_Remark='''+Trim(StringGrid1.Cells[24,i])+''' where Stock_NO='''+Trim(List_NO)+'''Goods_NO='''+Trim(StringGrid1.Cells[1,i])+'''';
try
Execute;
except
Application.MessageBox('保存[来货登记明细]时连接服务器数据库失败,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
end;
Application.MessageBox('保存[来货登记单]草稿操作成功,请确认!',pchar(application.Title),mb_iconwarning);
except
Application.MessageBox('保存[来货登记明细]时循环失败,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
except
Application.MessageBox('保存[来货登记单]时连接服务器数据库失败,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
except
Application.MessageBox('保存单据明细时失败,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
Exit;
end;
end;
if Public_Do_Result='03' then
begin
frm_data.ClientDataSet_Add.Active:=False;
frm_data.ClientDataSet_Add.Close;
frm_data.ClientDataSet2.Active:=False;
frm_data.ClientDataSet2.Close;
Close;
end;
end;
frm_Public_Don.Free;
end;
procedure Tfrm_Goods_Write.FormShow(Sender: TObject);
var
i,icount,k:integer;
tt,yy,temppos:integer;
begin
frm_Goods_Write.Left:=170 * longint(Screen.Width) div 1024;
frm_Goods_Write.Top:=40 * longint(Screen.Height) div 768;
frm_Goods_Write.Width:=860 * longint(Screen.Width) div 1024;
frm_Goods_Write.Height:=715 * longint(Screen.Height) div 768;
iColcount:=StringGrid1.ColCount-1; //需要的填充数据的网络表格的列数
StringGrid1.RowCount:=2; StringGrid1.ColCount:=20;
Total_Count:=StringGrid1.RowCount;
StringGrid1.ColWidths[0]:=40; StringGrid1.ColWidths[1]:=150; StringGrid1.ColWidths[2]:=150;
StringGrid1.ColWidths[3]:=100; StringGrid1.ColWidths[4]:=100; StringGrid1.ColWidths[5]:=150;
StringGrid1.ColWidths[6]:=50; StringGrid1.ColWidths[7]:=80; StringGrid1.ColWidths[8]:=100;
StringGrid1.ColWidths[9]:=50; StringGrid1.ColWidths[10]:=100; StringGrid1.ColWidths[11]:=100;
StringGrid1.ColWidths[12]:=50; StringGrid1.ColWidths[13]:=150; StringGrid1.ColWidths[14]:=150;
StringGrid1.ColWidths[15]:=100; StringGrid1.ColWidths[16]:=100; StringGrid1.ColWidths[17]:=150;
StringGrid1.ColWidths[18]:=50; StringGrid1.ColWidths[19]:=80;
StringGrid1.Cells[0,0]:='行号'; StringGrid1.Cells[1,0]:='商品编号';
StringGrid1.Cells[2,0]:='商品全名'; StringGrid1.Cells[3,0]:='数量';
StringGrid1.Cells[4,0]:='类别名称'; StringGrid1.Cells[5,0]:='品牌名称';
StringGrid1.Cells[6,0]:='品种名称'; StringGrid1.Cells[7,0]:='规格型号';
StringGrid1.Cells[8,0]:='球面度数'; StringGrid1.Cells[9,0]:='柱面度数';
StringGrid1.Cells[10,0]:='颜色名称'; StringGrid1.Cells[11,0]:='商品条玛';
StringGrid1.Cells[12,0]:='组册商品'; StringGrid1.Cells[13,0]:='基本单位(小)';
StringGrid1.Cells[14,0]:='生产厂家'; StringGrid1.Cells[15,0]:='商品简称';
StringGrid1.Cells[16,0]:='整件单位(大)'; StringGrid1.Cells[17,0]:='有效日期(月)';
StringGrid1.Cells[18,0]:='有效日期(日)'; StringGrid1.Cells[19,0]:='备注说明';
//加载行号
for i:=1 to StringGrid1.RowCount-1 do
begin
StringGrid1.Cells[0,i]:=IntTostr(i); //表示第0列第i行
end;
if Public_Do='Stock_0008' then
begin
P_Check.Visible:=False;
end;
if ((Public_Do='Business_Draft_0005') and (SH_Level<>0)) then
begin
P_check.Visible:=true;
if Trim(ExamineMan1)<>'' then
begin
tempstr:=ExamineMan1;
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
P1.Visible:=True; L1.Caption:=LevelName1+':'+ss;
if ee1='' then
begin
L1.Caption:=LevelName1+':'+ss;
Flag1:=1;
end;
if ee1<>'' then
begin
L1.Caption:=LevelName1+':';
Flag1:=2;
end;
end;
end;
Next;
end;
if Trim(ExamineMan2)<>'' then
begin
tempstr:=ExamineMan2;
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
P2.Visible:=True; L2.Caption:=LevelName2+':'+ss;
if ee2='' then
begin
L2.Caption:=LevelName2+':'+ss;
Flag2:=1;
end;
if ee2<>'' then
begin
L2.Caption:=LevelName2+':';
Flag2:=2;
end;
end;
end;
Next;
end;
if Trim(ExamineMan3)<>'' then
begin
tempstr:=ExamineMan3;
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
P3.Visible:=True; L3.Caption:=LevelName3+':'+ss;
if ee3='' then
begin
L3.Caption:=LevelName3+':'+ss;
Flag3:=1;
end;
if ee3<>'' then
begin
L3.Caption:=LevelName3+':';
Flag3:=2;
end;
end;
end;
Next;
end;
if Trim(ExamineMan4)<>'' then
begin
tempstr:=ExamineMan4;
tt:=0;
while pos(',',tempstr)>0 do //取得逗号的位置
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -