📄 inv_mnoutbilllistqry_c.pas
字号:
unit Inv_MnOutBillListQry_C;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Condition, StdCtrls, Db, AdODB, CheckLst, ExtEdit, Mask;
Type
TFrm_Inv_MnOutBillListQry_C = Class(TFrm_Base_Condition)
ChLstBx_WhSelect: TCheckListBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
MEdt_StArtDate: TMaskEdit;
MEdt_EndDate: TMaskEdit;
Edt_StArtNo: TEdit;
Edt_EndNo: TEdit;
ExtEdt_DeptCode: TExtEdit;
Lbl_DeptName: TLabel;
ExtEdt_ItemCode: TExtEdit;
Lbl_ItemName: TLabel;
Edt_MoNo: TEdit;
Edt_MoLineNo: TEdit;
Edt_StArtAmount: TEdit;
Edt_EndAmount: TEdit;
Label14: TLabel;
ChBx_PrintTimes: TCheckBox;
ChBx_SelectAll: TCheckBox;
Label15: TLabel;
cmbbx_Shift: TComboBox;
Label16: TLabel;
Extedt_Employee: TExtEdit;
lbl_Employee: TLabel;
Label17: TLabel;
cmbx_WipWaster: TComboBox;
procedure btn_okClick(Sender: TObject);
procedure ChLstBx_WhSelectClickCheck(Sender: TObject);
procedure MEdt_EndDateExit(Sender: TObject);
procedure Edt_MoNoExit(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ChBx_SelectAllClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure InitForm(AdOConnection:TAdOConnection;UserCode:String);
end;
var
Frm_Inv_MnOutBillListQry_C: TFrm_Inv_MnOutBillListQry_C;
implementation
uses Sys_Global;
{$R *.DFM}
procedure TFrm_Inv_MnOutBillListQry_C.InitForm(AdOConnection:TAdOConnection;UserCode:String);
begin
inherited;
SetDBConnect(AdOConnection);
with AdoQry_Tmp do
begin
Close;
SQL.Text:='Select Warehouse.WHCode+'' ''+Warehouse.WHName As CodeName '+
'From Warehouse Join WHAccessCtrl On Warehouse.WHCode=WHAccessCtrl.WHCode '+
'Where WHAccessCtrl.EmployeeCode='''+UserCode+'''';
Open;
ChLstBx_WhSelect.clear;
First;
while not Eof do
begin
ChLstBx_WhSelect.Items.Add(fieldbyname('CodeName').AsString);
AdoQry_Tmp.Next;
end;
end;
InitShiftCmBx(AdoQry_tmp,cmbbx_Shift,True);
cmbbx_Shift.Items.Add('全部');
InitCmBxText(cmbbx_Shift,'全部');
end;
procedure TFrm_Inv_MnOutBillListQry_C.btn_okClick(Sender: TObject);
var
i:integer;
tmp_ShiftType:string;
begin
inherited;
Condition:='';
for i:=0 to ChLstBx_WhSelect.Items.Count-1 do
begin
if ChLstBx_WhSelect.Checked[i] then
begin
if Condition='' then
begin
Condition:='('''+GetCode(ChLstBx_WhSelect.Items.Strings[i])+'''';
ConditionHint:='仓库:'+GetName(ChLstBx_WhSelect.Items.Strings[i]);
end
else
begin
Condition:=Condition+','''+GetCode(ChLstBx_WhSelect.Items.Strings[i])+'''';
ConditionHint:=ConditionHint+','+GetName(ChLstBx_WhSelect.Items.Strings[i]);
end;
end;
end;
Condition:=Condition+')';
Condition:=' InvOutBill.WHCode In'+Condition;
Condition:=Condition+' And InvOutBill.InvBillDate>='''+MEdt_StArtDate.Text+'''';
Condition:=Condition+' And InvOutBill.InvBillDate<='''+MEdt_EndDate.Text+'''';
ConditionHint:=ConditionHint+' 日期:从 '+MEdt_StArtDate.Text+' 到 '+MEdt_EndDate.Text;
if(Edt_StArtNo.Text<>'')then
begin
Condition:=Condition+' And InvOutBill.InvBillNo>='''+Edt_StArtNo.Text+'''';
ConditionHint:=ConditionHint+' 单号:从 '+Edt_StArtNo.Text;
end;
if(Edt_EndNo.Text<>'')then
begin
if(Edt_StArtNo.Text<>'')then
ConditionHint:=ConditionHint+' 到 '+Edt_EndNo.Text
else
ConditionHint:=ConditionHint+' 单号到 '+Edt_EndNo.Text;
Condition:=Condition+' And InvOutBill.InvBillNo<='''+Edt_EndNo.Text+'''';
end;
if(ExtEdt_DeptCode.Text<>'')then
begin
Condition:=Condition+' And InvOutBill.DeptCode like '''+ExtEdt_DeptCode.text+'%''';
ConditionHint:=ConditionHint+' 领料部门: '+ExtEdt_DeptCode.Text;
end;
if(Extedt_Employee.Text<>'')then
begin
Condition:=Condition+' And InvOutBill.wh_EmployeeCode='''+Extedt_Employee.Text+'''';
ConditionHint:=ConditionHint+' 仓管员: '+Extedt_Employee.Text;
end;
if cmbbx_Shift.text='全部' then
begin
//Condition:=Condition+' and InvOutBill.shiftType in ('''',''早班'',''中班'',''晚班'') ';
with AdoQry_tmp do
begin
Close;
sql.clear;
sql.text:='select SysParamValueC From SysParam Where SysParamCode Like ''shiftType%'' And SysParamValueC<>''''';
open;
tmp_ShiftType:='''''';
if not eof then
begin
First;
while not eof do
begin
tmp_ShiftType:=tmp_ShiftType+','''+fieldbyname('SysParamValueC').asstring+'''';
next;
end;
end;
end;
condition:=condition+' and InvOutBill.shiftType in ('+tmp_ShiftType+' ) ';
ConditionHint:=ConditionHint+' 班别:全部 ';
end
else
begin
Condition:=Condition+' and InvOutBill.shiftType='''+cmbbx_Shift.text+'''';
ConditionHint:=ConditionHint+' 班别:'+cmbbx_Shift.text;
end;
if(ExtEdt_ItemCode.Text<>'')then
begin
Condition:=Condition+' And InvOutBillLine.ItemCode like '''+ExtEdt_ItemCode.Text+'%''';
ConditionHint:=ConditionHint+' 物料代码: '+ExtEdt_ItemCode.Text;
end;
if(Edt_MoNo.Text<>'')then
begin
Condition:=Condition+' And InvOutBill.MoNo='''+Edt_MoNo.Text+'''';
ConditionHint:=ConditionHint+' 生产订单号: '+Edt_MoNo.Text;
end;
if(Edt_MoLineNo.Text<>'')then
begin
Condition:=Condition+' And InvOutBillLine.MoLineNo='''+Edt_MoLineNo.Text+'''';
ConditionHint:=ConditionHint+' 生产订单行号: '+Edt_MoLineNo.Text;
end;
if(Edt_StArtAmount.Text<>'')then
begin
Condition:=Condition+' And InvOutBillLine.InvBillQty>='+Edt_StArtAmount.Text;
ConditionHint:=ConditionHint+' 数量:从 '+Edt_StArtAmount.Text;
end;
if(Edt_EndAmount.Text<>'')then
begin
Condition:=Condition+' And InvOutBillLine.InvBillQty<='+Edt_EndAmount.Text;
if(Edt_StArtAmount.Text<>'')then
ConditionHint:=ConditionHint+' 到 '+Edt_EndAmount.Text
else
ConditionHint:=ConditionHint+' 数量到 '+Edt_EndAmount.Text;
end;
if cmbx_WipWaster.Text<>'' then
begin
if cmbx_WipWaster.ItemIndex=1 then
ConditionHint:=ConditionHint+' 工/废料:全部';
if cmbx_WipWaster.ItemIndex=2 then
begin
Condition:=Condition+' and InvOutBill.WipWaster=1';
ConditionHint:=ConditionHint+' 工/废料:料废';
end;
end;
if ChBx_PrintTimes.Checked then
Condition:=Condition+' And InvOutBill.PrintTimes=0 ' ;
ModalResult:=mrOk;
end;
procedure TFrm_Inv_MnOutBillListQry_C.ChLstBx_WhSelectClickCheck(
Sender: TObject);
var
i:Integer;
begin
inherited;
btn_ok.Enabled:=False;
for i:=0 to ChLstBx_WhSelect.Items.Count-1 do
begin
if ChLstBx_WhSelect.Checked[i] then
btn_ok.Enabled:=True;
end;
end;
procedure TFrm_Inv_MnOutBillListQry_C.MEdt_EndDateExit(Sender: TObject);
begin
inherited;
if ActiveControl.Name='btn_Cancel' then
Exit;
DateCheck(Sender);
if StrToDateTime(MEdt_EndDate.Text)<StrToDateTime(MEdt_StArtDate.Text) then
begin
DispInfo('结束时间不能小于开始时间',3);
TWinControl(Sender).SetFocus;
Abort;
end;
end;
procedure TFrm_Inv_MnOutBillListQry_C.Edt_MoNoExit(Sender: TObject);
begin
inherited;
if Edt_MoNo.Text='' then
Edt_MoLineNo.Text:='';
end;
procedure TFrm_Inv_MnOutBillListQry_C.FormCreate(Sender: TObject);
begin
inherited;
MEdt_StArtDate.Text:=FormatDateTime('yyyy.mm.dd',incMonth(now,-1));
MEdt_EndDate.Text:=FormatDateTime('yyyy.mm.dd',Now);
end;
procedure TFrm_Inv_MnOutBillListQry_C.ChBx_SelectAllClick(Sender: TObject);
var
i:integer;
begin
inherited;
if ChBx_SelectAll.Checked then
begin
for i:=0 to ChLstBx_WhSelect.Items.Count-1 do
begin
ChLstBx_WhSelect.Checked[i]:=True;
end;
btn_ok.Enabled:=True;
end
else
begin
for i:=0 to ChLstBx_WhSelect.Items.Count-1 do
begin
ChLstBx_WhSelect.Checked[i]:=False;
end;
btn_ok.Enabled:=False;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -