📄 inv_mnlistaudit_b.pas
字号:
next;
end;
end;
AdoQry_Body.Connection.CommitTrans ;
DBGridEh.Enabled :=True;
AdoQry_Body.EnableControls ;
edt_No.Text :=Billno;
except
AdoQry_Body.Connection.RollBackTrans;
DBGridEh.Enabled :=True;
AdoQry_Body.EnableControls ;
DispInfo('数据保存失败,请稍后再试。',3);
end;
AdoQry_Body.GotoBookmArk(Bookm);
AdoQry_Body.EnableControls ;
end;
procedure TFrm_Inv_MnListAudit_B.medt_DateChange(Sender: TObject);
begin
inherited;
//
end;
procedure TFrm_Inv_MnListAudit_B.DBGridEhGetCellParams(Sender: TObject;
Column: TColumnEh; AFont: TFont; var Background: TColor;
State: TGridDrawState);
var
i:integer;
begin
inherited;
i:=0;
if (gdSelected in State)or(gdFocused in State) then
begin
Background:=clNavy;
AFont.Color:=clWindow;
end
else
begin
with AdoQry_Body do
begin
// if fieldbyname('Parentid').asinteger=fieldbyname('ItemListid').asinteger then
if (fieldbyname('alterNative').asinteger=1) and
((fieldbyname('Parentid').asinteger=fieldbyname('ItemListid').asinteger) or (fieldbyname('Parentid').asinteger=0)) then
AFont.Color:=clblue
else if fieldbyname('alterNative').asinteger=2 then
AFont.Color:=clred;
end;
end;
end;
procedure TFrm_Inv_MnListAudit_B.DBGridEh1GetCellParams(Sender: TObject;
Column: TColumnEh; AFont: TFont; var Background: TColor;
State: TGridDrawState);
begin
inherited;
if TDBGridEh(Sender).DataSource.DataSet.RecNo mod 2=1 then
Background:=$f0f0f0
else
Background:=clWindow;
if (gdSelected in State)or(gdFocused in State) then
begin
Background:=clNavy;
AFont.Color:=clWindow;
end
else
begin
AFont.Color:=clBlack;
end;
end;
procedure TFrm_Inv_MnListAudit_B.Act_ModifyExecute(Sender: TObject);
begin
if AdoQry_Body.state<>dsBrowse then
AdoQry_Body.post;
Frm_Entry_Detail.SetFormParam(Lbl_MoNo.Caption,Lbl_MoLineNo.Caption,getCode(cmbx_WhCode.Text),getCode(cmbx_WhPosition.text),'',cmbbx_Shift.text);
inherited;
end;
procedure TFrm_Inv_MnListAudit_B.Act_InsertLineExecute(Sender: TObject);
begin
Frm_Entry_Detail.SetFormParam(Lbl_MoNo.Caption,Lbl_MoLineNo.Caption,getCode(cmbx_WhCode.Text),getCode(cmbx_WhPosition.text),'',cmbbx_Shift.Text);
inherited;
end;
procedure TFrm_Inv_MnListAudit_B.DBGridEhDblClick(Sender: TObject);
begin
if ((DBGridEh.DataSource.DataSet.fieldbyname('alterNative').AsInteger=1)
and ((DBGridEh.DataSource.DataSet.fieldbyname('Parentid').asinteger=
DBGridEh.DataSource.DataSet.fieldbyname('ItemListid').asinteger)
or (DBGridEh.DataSource.DataSet.fieldbyname('Parentid').asinteger=0)))
or(DBGridEh.DataSource.DataSet.fieldbyname('alterNative').asinteger=2) then
exit;
if AdoQry_Body.state<>dsBrowse then
AdoQry_Body.post;
inherited;
//
end;
procedure TFrm_Inv_MnListAudit_B.cmbbx_ShiftChange(Sender: TObject);
begin
inherited;
{
if act_Save.Enabled then
begin
if Application.MessageBox('数据已经更改,要保存吗?','信息提示',MB_IconInfoRMATION+MB_OKCancel+MB_DEFBUTTON1)=IDOK then
begin
savedata;
act_Save.Enabled :=False;
end
else
act_Save.Enabled :=False;
end;
showdbgrid(cmbbx_Shift.text,getCode(cmbx_WhCode.text),getCode(cmbx_WhPosition.text));
}
end;
procedure TFrm_Inv_MnListAudit_B.Act_DeleteLineExecute(Sender: TObject);
var
Itemid:string;
begin
//删除前的可行校对
Itemid:=AdoQry_Body.fieldbyname('ItemListid').asstring;
if not ((AdoQry_Body.fieldbyname('moCtrlqty').asfloat=0.0) and
(AdoQry_Body.fieldbyname('Parentid').asstring<>AdoQry_Body.fieldbyname('ItemListid').asstring)) then
begin
DispInfo('该行由系统产生或已有实际领料发生,不允许删除!',3);
abort;
end;
with AdoQry_tmp do
begin
Close;
sql.text:='select * from mnListRequest where ItemListid='+Itemid+'';
open;
if eof then
begin
Close;
sql.Text:='delete from mnItemList where ItemListid='+Itemid+'';
end
else
begin
Close;
sql.Text:=' delete from mnListRequest where ItemListid='+Itemid+' and '+
'shiftType='''+cmbbx_Shift.text+'''';
end;
try
execsql;
except
DispInfo('删除失败,请稍后运行。',3);
exit;
end;
end;
inherited;
end;
procedure TFrm_Inv_MnListAudit_B.cmbx_WhCodeChange(Sender: TObject);
begin
inherited;
InitCmBx_Condition(AdoQry_tmp.Connection,cmbx_WhPosition,'WhPosition','WhPositionCode',
'WhPositionName','whCode='''+getCode(cmbx_WhCode.text)+''' and not (Backflushwhp=1 or WhPositionType=1)');
if act_Save.Enabled then
begin
if Application.MessageBox('数据已经更改,要保存吗?','信息提示',MB_IconInfoRMATION+MB_OKCancel+MB_DEFBUTTON1)=IDOK then
begin
savedata;
act_Save.Enabled :=False;
end
else
act_Save.Enabled :=False;
end;
with AdoQry_tmp do
begin
Close;
sql.text:='select WhEmployee.EmployeeCode+'' ''+Employee.EmployeeName as EmployeeName '+
'from WhEmployee '+
'left join Employee on Employee.EmployeeCode=WhEmployee.EmployeeCode '+
'left join WHAccessCtrl on WHAccessCtrl.EmployeeCode=WhEmployee.EmployeeCode '+
'where WhEmployee.WhEmployeeUsable=1 and WHAccessCtrl.whCode='+
QuotedStr(getCode(cmbx_WhCode.Text));
open;
if not eof then
begin
cmbx_Employee.Items.clear;
cmbx_Employee.Items.Add('');
while not eof do
begin
cmbx_Employee.Items.Add(fieldbyname('EmployeeName').asstring);
next;
end;
cmbx_Employee.ItemIndex:=0;
end;
end;
showdbgrid(cmbbx_Shift.text,getCode(cmbx_WhCode.text),getCode(cmbx_WhPosition.text));
end;
procedure TFrm_Inv_MnListAudit_B.cmbx_WhPositionChange(Sender: TObject);
begin
inherited;
if act_Save.Enabled then
begin
if Application.MessageBox('数据已经更改,要保存吗?','信息提示',MB_IconInfoRMATION+MB_OKCancel+MB_DEFBUTTON1)=IDOK then
begin
savedata;
act_Save.Enabled :=False;
end
else
act_Save.Enabled :=False;
end;
showdbgrid(cmbbx_Shift.text,getCode(cmbx_WhCode.text),getCode(cmbx_WhPosition.text));
end;
procedure TFrm_Inv_MnListAudit_B.ckbx_ShowallClick(Sender: TObject);
begin
inherited;
if act_Save.Enabled then
begin
if Application.MessageBox('数据已经更改,要保存吗?','信息提示',MB_IconInfoRMATION+MB_OKCancel+MB_DEFBUTTON1)=IDOK then
begin
savedata;
act_Save.Enabled :=False;
end
else
act_Save.Enabled :=False;
end;
showdbgrid(cmbbx_Shift.text,getCode(cmbx_WhCode.text),getCode(cmbx_WhPosition.text));
end;
procedure TFrm_Inv_MnListAudit_B.FormActivate(Sender: TObject);
begin
if not clickpreview then
begin
// initUsablewhcmbx(AdoQry_tmp,userCode,cmbx_WhCode,False);
// edt_No.Text :='';
inherited;
end;
clickpreview:=False;
end;
procedure TFrm_Inv_MnListAudit_B.Rbtn_ShowallClick(Sender: TObject);
begin
if IScheck then
abort;
inherited;
if act_Save.Enabled then
begin
if Application.MessageBox('数据已经更改,要保存吗?','信息提示',MB_IconInfoRMATION+MB_OKCancel+MB_DEFBUTTON1)=IDOK then
begin
savedata;
act_Save.Enabled :=False;
end
else
act_Save.Enabled :=False;
end;
showdbgrid(cmbbx_Shift.text,getCode(cmbx_WhCode.text),getCode(cmbx_WhPosition.text));
end;
procedure TFrm_Inv_MnListAudit_B.Rbtn_ShowWhCodeClick(Sender: TObject);
begin
if IScheck then
abort;
inherited;
if act_Save.Enabled then
begin
if Application.MessageBox('数据已经更改,要保存吗?','信息提示',MB_IconInfoRMATION+MB_OKCancel+MB_DEFBUTTON1)=IDOK then
begin
savedata;
act_Save.Enabled :=False;
end
else
act_Save.Enabled :=False;
end;
showdbgrid(cmbbx_Shift.text,getCode(cmbx_WhCode.text),getCode(cmbx_WhPosition.text));
end;
procedure TFrm_Inv_MnListAudit_B.Rbtn_ShowWhCodeMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
inherited;
if rbtn_ShowwhCode.Checked then
IScheck:=True
else
IScheck:=False;
end;
procedure TFrm_Inv_MnListAudit_B.Rbtn_ShowallMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
inherited;
if rbtn_Showall.Checked then
IScheck:=True
else
IScheck:=False;
end;
procedure TFrm_Inv_MnListAudit_B.FormShow(Sender: TObject);
begin
inherited;
act_Save.enabled:=True;
IsAfterprint:=False;
// AdoQry_tmp.Connection:=dbconnect;
initUsablewhcmbx(AdoQry_tmp,userCode,cmbx_WhCode,False); // wxp
edt_No.Text :=''; // wxp
// initUsablewhcmbx(AdoQry_tmp,userCode,cmbx_WhCode,False);
// InitCmBx_Condition(AdoQry_tmp.Connection,cmbx_WhPosition,'WhPosition','WhPositionCode',
// 'WhPositionName','whCode='''+getCode(cmbx_WhCode.text)+''' and not (Backflushwhp=1 or WhPositionType=1)');
Frm_Entry_Detail:=TFrm_Inv_MnListAudit_D.Create(Self);
// SetFocus_Control:=cmbbx_Shift;
end;
procedure TFrm_Inv_MnListAudit_B.FormCreate(Sender: TObject);
begin
inherited;
// act_Save.Enabled:=True;
end;
procedure TFrm_Inv_MnListAudit_B.DBGridEhEnter(Sender: TObject);
begin
inherited;
// if act_Save.Enabled=False then act_Save.Enabled:=True;
end;
procedure TFrm_Inv_MnListAudit_B.Act_SaveExecute(Sender: TObject);
begin
//inherited;
SaveData;
Act_New.visible:=True;
Act_New.Enabled:=True;
Act_Save.Enabled:=False;
//InitControls;
end;
procedure TFrm_Inv_MnListAudit_B.Act_NewExecute(Sender: TObject);
begin
//inherited;
InitControls;
edt_No.Text:='';
act_New.enabled:=False;
end;
procedure TFrm_Inv_MnListAudit_B.DBGridEhColExit(Sender: TObject);
begin
inherited;
if AdoQry_Body.State in [dsedit,dsinsert] then
begin
AdoQry_Body.Post;
end;
end;
procedure TFrm_Inv_MnListAudit_B.AdoQry_BodyAfterPost(DataSet: TDataSet);
begin
inherited;
if act_Save.Enabled=False then act_Save.Enabled:=True;
{
if (AdoQry_Body.fieldbyname('limitout').Value=1) and (AdoQry_Body.fieldbyname('alterNative').Value=0) then
begin
//if AdoQry_Body.fieldbyname('moCtrlqty').Value<AdoQry_Body.fieldbyname('moCtrlqty').Value
end;
}
end;
procedure TFrm_Inv_MnListAudit_B.cmbx_EmployeeChange(Sender: TObject);
begin
inherited;
showdbgrid(cmbbx_Shift.text,getCode(cmbx_WhCode.text),getCode(cmbx_WhPosition.text));
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -