📄 sfc_mnin.pas
字号:
unit Sfc_MnIn;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Inner, Menus, ExtPrintReport, Db, ActnList, AdODB, Grids, DBGridEh,
StdCtrls, ExtCtrls, ComCtrls, ToolWin, jpeg;
Type
TFrm_Sfc_MnIn = Class(TFrm_Base_Inner)
AdoQry_MainMONO: TStringField;
AdoQry_MainMODATE: TDateTimeField;
AdoQry_MainMORemArk: TStringField;
AdoQry_MainMOSpecial: TIntegerField;
procedure DBGridEhDblClick(Sender: TObject);
procedure AdoQry_MainAfterInsert(DataSet: TDataSet);
procedure Act_NewExecute(Sender: TObject);
procedure AdoQry_MainAfterScroll(DataSet: TDataSet);
private
BillTypeCode :String;
TmpAdOConnection:TAdOConnection;
FDeptCode,FShift:string;
public
procedure InitForm(AdOConnection:TAdOConnection;ReadOnly:Boolean);Override;
procedure SetFormParam(FrmParam1,FrmParam2,FrmParam3,FrmParam4,FrmParam5,FrmParam6:String);
{ Public declarations }
end;
var
Frm_Sfc_MnIn: TFrm_Sfc_MnIn;
implementation
uses Sfc_MnIn_C,Sys_Global,Sfc_MnIn_B, Sfc_MnInOverPlan_B;
{$R *.DFM}
{ TFrm_Sfc_MnIn }
procedure TFrm_Sfc_MnIn.InitForm(AdOConnection:TAdOConnection;
ReadOnly:Boolean);
begin
inherited;
TmpAdOConnection:=AdOConnection;
//分条件设置Caption
If UPPERCASE(Param1)='MnIn' then
begin
Frm_Sfc_MnIn.Caption:='成品生产入库制单';
Pnl_title.Caption:='成品生产入库制单';
Frm_Sfc_MnIn_C.Caption:='筛选条件';
end;
IF UPPERCASE(Param1)='MnInOver' then
begin
Frm_Sfc_MnIn.Caption:='成品生产超订单入库制单';
Pnl_title.Caption:='成品生产超订单入库制单';
Frm_Sfc_MnIn_C.Caption:='筛选条件';
end;
If UPPERCASE(Param1)='MnInSemi' then
begin
Frm_Sfc_MnIn.Caption:='半成品生产入库制单';
Pnl_title.Caption:='半成品生产入库制单';
Frm_Sfc_MnIn_C.Caption:='筛选条件';
end;
IF UPPERCASE(Param1)='MnInOverSemi' then
begin
Frm_Sfc_MnIn.Caption:='半成品生产超订单入库制单';
Pnl_title.Caption:='半成品生产超订单入库制单';
Frm_Sfc_MnIn_C.Caption:='筛选条件';
end;
If (UPPERCASE(Param1)<>'MnIn') and (UPPERCASE((Param1))<>'MnInOver')
and (UPPERCASE(Param1)<>'MnInSemi') and (UPPERCASE((Param1))<>'MnInOverSemi') then
begin
DispInfo('系统传入参数不正确!',1);
Abort;
end;
If (UPPERCASE(Param1)='MnIn') or (UPPERCASE(Param1)='MnInSemi')then
SelectFromSQL:='select Mo.MONO,MO.MODATE,MO.MOSpecial,MO.MORemArk from MO '+
'join (select MONO AS MoLineMONO,MoLineSTATUS from MoLine '+
'group by MoNO,MoLineStatus having MoLineStatus=6) TmPMoLine '+
' on MO.MONO=TmPMoLine.MoLineMONo '
else
SelectFromSQL:='select Mo.MONO,MO.MODATE,MO.MOSpecial,MO.MORemArk from MO '+
'join (select MONO AS MoLineMONO,MoLineSTATUS from MoLine '+
' where MoLine.BackFlush<>1 '+
'group by MoNO,MoLineStatus having MoLineStatus=6) TmPMoLine '+
' on MO.MONO=TmPMoLine.MoLineMONo ';
OrderByFields:=' MoNo ';
Frm_Sys_Condition:=TFrm_Sfc_MnIn_C.Create(Application);
BillTypeCode:=Param2;
TlBtn_Excel.Action:=Act_New;
Tlbtn_Excel.Left:=29;
Act_Filter.Execute;
end;
procedure TFrm_Sfc_MnIn.DBGridEhDblClick(Sender: TObject);
var tmPmono,HasNegative:string;
begin
inherited;
//设置HASNEGATIVE的值
if AdoQry_Main.RecordCount=0 then exit;
tmPmono:=AdoQry_Main.fieldbyname('MoNo').AsString;
With AdoQry_Tmp do
begin
Close;
Sql.clear;
Sql.Add('select Count(*) As RecCount '+
' from mo H,MoLine L '+
' where L.MoNo=H.MoNo '+
' and L.MoInQty<0 '+
' and H.MoNo='''+TmPmoNo+''' ');
Open;
If fieldbyname('RecCount').AsInteger>0 Then
HasNegative:='Yes'
Else
begin
Close;
Sql.clear;
Sql.Add('select Count(*) As RecCount '+
' from mo H,MoLine L '+
' where L.MoNo=H.MoNo '+
' and L.MoInQty>0 '+
' and H.MoNo='''+TmPmoNo+''' ');
Open;
If fieldbyname('RecCount').AsInteger>0 Then
HasNegative:='No'
Else
HasNegative:='NONE';
end;
end;
If ((UPPERCASE(Param1)='MnIn') or (UPPERCASE(Param1)='MnInSemi'))then// and (not AdoQry_Main.Eof) then
begin
Application.CreateForm(TFrm_Sfc_MnIn_B,Frm_Sfc_MnIn_B);
with Frm_Sfc_MnIn_B do
begin
SetUserParam(Param1,Param2,Param3,Param4,Param5,Param6);
SetFormParam(
tmPmono,
FDeptCode,
FShift,
HasNegative,
BillTypeCode,
AdoQry_MainMOSpecial.AsString
);
SetSysParam(UserCode,ModuleCode,MenuId,LoginDate);
InitForm(TmpAdOConnection,False);
end;
end
else If ((UPPERCASE(Param1)='MnInOver') OR (UPPERCASE(Param1)='MnInOverSemi'))
and (not AdoQry_Main.Eof) then
begin
Application.CreateForm(TFrm_Sfc_MnInOverPlan_B,Frm_Sfc_MnInOverPlan_B);
with Frm_Sfc_MnInOverPlan_B do
begin
SetUserParam(Param1,Param2,Param3,Param4,Param5,Param6);
SetFormParam(
tmPmono,
FDeptCode,
FShift,
HasNegative,
BillTypeCode,
AdoQry_MainMOSpecial.AsString
);
SetSysParam(UserCode,ModuleCode,MenuId,LoginDate);
InitForm(TmpAdOConnection,False);
end;
end;
end;
procedure TFrm_Sfc_MnIn.AdoQry_MainAfterInsert(DataSet: TDataSet);
begin
inherited;
AdoQry_Main.Cancel;
end;
procedure TFrm_Sfc_MnIn.Act_NewExecute(Sender: TObject);
begin
inherited;
DBGridEhDblClick(Sender);
end;
procedure TFrm_Sfc_MnIn.SetFormParam(FrmParam1,FrmParam2,FrmParam3,FrmParam4,FrmParam5,FrmParam6:String);
begin
inherited;
//把参数从CONDITION窗体中传过来
FShift:=FrmParam1;
FDeptCode:=FrmParam2;
end;
procedure TFrm_Sfc_MnIn.AdoQry_MainAfterScroll(DataSet: TDataSet);
begin
inherited;
if AdoQry_Main.Eof then
begin
AdoQry_Main.Prior;
AdoQry_Main.next;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -