📄 sfc_mnlistrequest.pas
字号:
unit Sfc_MnListRequest;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Entry_Head, Menus, Db, ActnList, AdODB, Grids, DBGridEh, StdCtrls,
ExtCtrls, ComCtrls, ToolWin, DBCtrls;
Type
TFrm_Sfc_MnListRequest = Class(TFrm_Base_Entry_Head)
AdoQry_Headmono: TStringField;
AdoQry_HeadMoLineno: TIntegerField;
AdoQry_HeadItemCode: TStringField;
AdoQry_HeadItemName: TStringField;
AdoQry_Headmoqty: TFloatField;
AdoQry_HeadmostArtworkdate: TDateTimeField;
AdoQry_HeadMoLinedate: TDateTimeField;
Label1: TLabel;
DBText1: TDBText;
AdoQry_HeadMoLinestatus: TIntegerField;
AdoQry_HeadmoSpecial: TIntegerField;
AdoQry_HeadmArk: TIntegerField;
procedure Act_NewExecute(Sender: TObject);
procedure AdoQry_HeadBeforeInsert(DataSet: TDataSet);
procedure DBGridEhDblClick(Sender: TObject);
procedure Act_LookExecute(Sender: TObject);
procedure Act_CancelCheckExecute(Sender: TObject);
procedure Act_CheckExecute(Sender: TObject);
procedure DBGridEhTitleBtnClick(Sender: TObject; ACol: Integer;
Column: TColumnEh);
procedure DBGridEhCellClick(Column: TColumnEh);
procedure FormCreate(Sender: TObject);
private
checktmp:boolean;
{ Private declarations }
public
tmp_MoRequestshift:string;
tmp_DeptCode:string;
procedure SetFormParam(FrmParam1,FrmParam2,FrmParam3,FrmParam4,FrmParam5,FrmParam6:String);Override;
procedure InitForm(AdOConnection:TAdOConnection;ReadOnly:Boolean);Override;
{ Public declarations }
end;
var
Frm_Sfc_MnListRequest: TFrm_Sfc_MnListRequest;
implementation
uses Sfc_MnListRequest_B,Sys_Global,Sfc_MnRequest_C;
{$R *.DFM}
procedure TFrm_Sfc_MnListRequest.InitForm(AdOConnection:TAdOConnection;ReadOnly:Boolean);
begin
inherited;
checktmp:=False;
//设置表头SQL
SelectFromSQL:='select '+
'l.mono,'+
'l.MoLineno,'+
'l.ItemCode,'+
'i.ItemName,'+
'l.moqty,'+
'l.mostArtworkdate,'+
'l.MoLinedate,'+
'l.MoLinestatus,'+
'l.mArk,'+
'm.moSpecial'+
' from MoLine l left join Item i on l.ItemCode=i.ItemCode '+
' left join mo m on l.mono=m.mono ';
//设置排序字段信息
OrderByFields:='mono,MoLineno';
ConditionUserDefine:='(l.BackFlush<>1 and l.MOQty<>0)';
Caption:='车间生产清单领料请领制单';
pnl_title.Caption:='车间生产清单领料请领制单';
Frm_Entry_Body:=TFrm_Sfc_MnListRequest_B.Create(Self);
Frm_Sys_Condition:=TFrm_Sfc_MnRequest_C.Create(Application);
Act_Filter.Execute;
end;
procedure TFrm_Sfc_MnListRequest.Act_NewExecute(Sender: TObject);
var
tmp_locateid:string;
begin
if not AdoQry_Head.IsEmpty then
begin
if AdoQry_Head.fieldbyname('MoLinestatus').asinteger=6 then
begin
tmp_locateid:=AdoQry_Head.fieldbyname('mono').asstring;
inherited;
getdata;
AdoQry_Head.Locate('mono',tmp_locateid,[]);
end
else
begin
DispInfo('该订单行还未下达,不能请领料',1);
abort;
end;
end;
end;
procedure TFrm_Sfc_MnListRequest.AdoQry_HeadBeforeInsert(DataSet: TDataSet);
begin
inherited;
abort;
end;
procedure TFrm_Sfc_MnListRequest.SetFormParam(FrmParam1,FrmParam2,FrmParam3,FrmParam4,FrmParam5,FrmParam6:String);
begin
inherited;
//把参数从CONDITION窗体中传过来
tmp_MoRequestshift:=FrmParam1;
tmp_DeptCode:=FrmParam2;
end;
procedure TFrm_Sfc_MnListRequest.DBGridEhDblClick(Sender: TObject);
begin
inherited;
//
end;
procedure TFrm_Sfc_MnListRequest.Act_LookExecute(Sender: TObject);
begin
inherited;
//
end;
procedure TFrm_Sfc_MnListRequest.Act_CancelCheckExecute(Sender: TObject);
var
BookmArk:TBookmArk;
begin
inherited;
if DispInfo('确定已取消的订单项?',2)='n' then
Exit;
// AdoQry_Head.DisableControls;
BookmArk:=AdoQry_Head.GetBookmArk;
AdoQry_Head.First;
while not AdoQry_Head.Eof do
begin
if AdoQry_Head.fieldbyname('mArk').AsString='0' then
begin
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.Text:='Update MoLine Set mArk=0'
+' Where mono='''+AdoQry_Head.fieldbyname('mono').AsString+''' and '+
' MoLineno='''+AdoQry_Head.fieldbyname('MoLineno').asstring+'''';
AdoQry_Tmp.ExecSQL;
AdoQry_Head.Edit;
AdoQry_Head.fieldbyname('mArk').AsString:='0';
AdoQry_Head.Post;
end;
AdoQry_Head.Next;
end;
AdoQry_Head.GotoBookmArk(BookmArk);
AdoQry_Head.FreeBookmArk(BookmArk);
// AdoQry_Head.EnableControls;
end;
procedure TFrm_Sfc_MnListRequest.Act_CheckExecute(Sender: TObject);
var
BookmArk:TBookmArk;
begin
inherited;
if DispInfo('确定选定的订单项?',2)='n' then
Exit;
// AdoQry_Head.DisableControls;
BookmArk:=AdoQry_Head.GetBookmArk;
AdoQry_Head.First;
while not AdoQry_Head.Eof do
begin
if AdoQry_Head.fieldbyname('mArk').AsString='1' then
begin
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.Text:='Update MoLine Set mArk=1'
+' Where mono='''+AdoQry_Head.fieldbyname('mono').AsString+''' and '+
' MoLineno='''+AdoQry_Head.fieldbyname('MoLineno').asstring+'''';
AdoQry_Tmp.ExecSQL;
AdoQry_Head.Edit;
AdoQry_Head.fieldbyname('mArk').AsString:='1';
AdoQry_Head.Post;
end;
AdoQry_Head.Next;
end;
AdoQry_Head.GotoBookmArk(BookmArk);
AdoQry_Head.FreeBookmArk(BookmArk);
// AdoQry_Head.EnableControls;
end;
procedure TFrm_Sfc_MnListRequest.DBGridEhTitleBtnClick(Sender: TObject;
ACol: Integer; Column: TColumnEh);
var
BookmArk1:tBookmArk;
begin
inherited;
if AdoQry_Head.RecordCount=0 then
exit;
AdoQry_Head.Edit ;
if checktmp then
checktmp:=False
else
checktmp:=True;
if column.FieldName='mArk' then
begin
BookmArk1:=AdoQry_Head.GetBookmArk;
// AdoQry_Head.DisableControls ;
AdoQry_Head.First ;
if checktmp then
begin
while not AdoQry_Head.Eof do
begin
AdoQry_Head.Edit ;
AdoQry_Head.fieldbyname('mArk').Asstring:='1';
AdoQry_Head.Next;
end;
end
else
begin
while not AdoQry_Head.Eof do
begin
AdoQry_Head.Edit ;
AdoQry_Head.fieldbyname('mArk').Asstring:='0';
AdoQry_Head.Next;
end;
end;
// AdoQry_Head.EnableControls ;
AdoQry_Head.GotoBookmArk(BookmArk1);
end;
end;
procedure TFrm_Sfc_MnListRequest.DBGridEhCellClick(Column: TColumnEh);
begin
inherited;
if column.FieldName='mArk' then
begin
AdoQry_Head.Edit;
if AdoQry_Head.fieldbyname('mArk').asinteger=0 then
AdoQry_Head.fieldbyname('mArk').asinteger:=1
else
AdoQry_Head.fieldbyname('mArk').asinteger:=0;
end;
end;
procedure TFrm_Sfc_MnListRequest.FormCreate(Sender: TObject);
begin
inherited;
tlbtn_Modify.Action :=Act_Check;
tlbtn_Delete.Action :=Act_CancelCheck;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -