📄 sfc_mnlistrequest_b.pas
字号:
with AdoQry_Body do
begin
Close;
sql.clear;
sql.Add(sql_text);
open;
end;
ClassType1:=AdoQry_Body.fieldbyname('shiftType').asstring;
finally
with AdoQry_tmp do
begin
Close;
sql.clear;
sql.Add('drop table #TmPmORequest,#TmPmoRequest2');
execsql;
end;
end;
{
with dbgrideh do
begin
columns[5].Width:=64;
columns[6].Width:=64;
columns[9].Width:=64;
columns[10].Width:=64;
columns[13].Width:=64;
columns[14].Width:=64;
columns[17].Width:=64;
columns[18].Width:=64;
columns[21].Width:=64;
columns[22].Width:=64;
end;
}
Screen.Cursor :=cursor;
end;
procedure TFrm_Sfc_MnListRequest_B.Act_PreviewExecute(Sender: TObject);
var
usertitle,usertitle1,usertitle2,userName:string;
printpAper:integer;
begin
printpAper:=0;
with AdoQry_tmp do
begin
Close;
sql.text:='select InvValuen from InvParam where InvParamCode=''mnListpAper''';
open;
if not eof then
begin
printpAper:=fieldbyname('InvValuen').asinteger;
end;
end;
usertitle:='';
usertitle1:='';
usertitle2:='';
if lbl_Dept.Caption<>'' then
usertitle:=usertitle+'领料部门:'+lbl_Dept.Caption;
if cmbbx_Shift.Text<>'' then
usertitle:=usertitle+'-'+cmbbx_Shift.Text;
if (combobox1.Text<>'') and (CheckBox1.Checked=False) then
usertitle:=usertitle+',仓库:'+combobox1.Text;
if (cmbx_Employee.Text<>'') and (CheckBox1.Checked=False) then
usertitle:=usertitle+',仓管员:'+cmbx_Employee.Text;
if lbl_Mono.Caption<>'' then
usertitle:=usertitle+ ',生产订单:'+lbl_Mono.Caption;
if lbl_MoLineno.Caption<>'' then
usertitle:=usertitle+'-'+lbl_MoLineno.Caption;
if lbl_Item.Caption<>'' then
usertitle1:='物料标识:'+ lbl_Item.Caption;
usertitle2:='约定交货量:'+lbl_qty.Caption+
',约定完工日:'+lbl_Overdate.Caption;
with AdoQry_tmp do
begin
Close;
sql.text:=' select EmployeeName from Employee where EmployeeCode='+
QuotedStr(userCode);
open;
userName:=fieldbyname('EmployeeName').asstring;
Close;
end;
ExtPrintReport.Subtitle2:=usertitle;
ExtPrintReport.Subtitle3:=usertitle1;
ExtPrintReport.Subtitle4:=usertitle2;
if printpAper=0 then
begin
ExtPrintReport.foot1:='制单人:'+userName;
inherited;
end
else
begin
Frm_Sfc_MnListOut_P:=TFrm_Sfc_MnListOut_P.Create(self);
Frm_Sfc_MnListOut_P.SetDBConnect(DBConnect);
Frm_Sfc_MnListOut_P.title0.Caption:=usertitle;
Frm_Sfc_MnListOut_P.title1.Caption:=usertitle1;
Frm_Sfc_MnListOut_P.title2.Caption:=usertitle2;
Frm_Sfc_MnListOut_P.EmployeeName.Caption:=userName;
Frm_Sfc_MnListOut_P.EmployeeName1.Caption:=userName;
Frm_Sfc_MnListOut_P.QuickRep1.DataSet:=AdoQry_Body;
Frm_Sfc_MnListOut_P.QRDBText1.DataSet:=AdoQry_Body;
Frm_Sfc_MnListOut_P.QRDBText1.DataField:='ItemDESC';
Frm_Sfc_MnListOut_P.QRDBText2.DataSet:=AdoQry_Body;
Frm_Sfc_MnListOut_P.QRDBText2.DataField:='UomName';
Frm_Sfc_MnListOut_P.QRDBText3.DataSet:=AdoQry_Body;
Frm_Sfc_MnListOut_P.QRDBText3.DataField:='moCtrlqty';
Frm_Sfc_MnListOut_P.QRDBText4.DataSet:=AdoQry_Body;
Frm_Sfc_MnListOut_P.QRDBText4.DataField:='MoRealqty';
Frm_Sfc_MnListOut_P.QRDBText5.DataSet:=AdoQry_Body;
Frm_Sfc_MnListOut_P.QRDBText5.DataField:='onhandInv';
Frm_Sfc_MnListOut_P.printtime.Caption:=datetostr(now);
Frm_Sfc_MnListOut_P.printtime1.Caption:=datetostr(now);
Frm_Sfc_MnListOut_P.QuickRep1.Prepare;
Frm_Sfc_MnListOut_P.lbl_PageCount.Caption:='共'+Trim(inttoStr(Frm_Sfc_MnListOut_P.QuickRep1.QRPrinter.PageCount))+'页' ;
Frm_Sfc_MnListOut_P.QuickRep1.Preview;
end;
//
end;
procedure TFrm_Sfc_MnListRequest_B.Act_PrintExecute(Sender: TObject);
var
usertitle,usertitle1,usertitle2,userName:string;
printpAper:integer;
begin
printpAper:=0;
with AdoQry_tmp do
begin
Close;
sql.text:='select InvValuen from InvParam where InvParamCode=''mnListpAper''';
open;
if not eof then
begin
printpAper:=fieldbyname('InvValuen').asinteger;
end;
end;
usertitle:='';
usertitle1:='';
usertitle2:='';
if lbl_Dept.Caption<>'' then
usertitle:=usertitle+'领料部门:'+lbl_Dept.Caption;
if cmbbx_Shift.Text<>'' then
usertitle:=usertitle+'-'+cmbbx_Shift.Text;
if (combobox1.Text<>'') and (CheckBox1.Checked=False) then
usertitle:=usertitle+',仓库:'+combobox1.Text;
if (cmbx_Employee.Text<>'') and (CheckBox1.Checked=False) then
usertitle:=usertitle+',仓管员:'+cmbx_Employee.Text;
if lbl_Mono.Caption<>'' then
usertitle:=usertitle+ ',生产订单:'+lbl_Mono.Caption;
if lbl_MoLineno.Caption<>'' then
usertitle:=usertitle+'-'+lbl_MoLineno.Caption;
if lbl_Item.Caption<>'' then
usertitle1:='物料标识:'+ lbl_Item.Caption;
usertitle2:='约定交货量:'+lbl_qty.Caption+
',约定完工日:'+lbl_Overdate.Caption;
with AdoQry_tmp do
begin
Close;
sql.text:=' select EmployeeName from Employee where EmployeeCode='+
QuotedStr(userCode);
open;
userName:=fieldbyname('EmployeeName').asstring;
Close;
end;
ExtPrintReport.Subtitle2:=usertitle;
ExtPrintReport.Subtitle3:=usertitle1;
ExtPrintReport.Subtitle4:=usertitle2;
if printpAper=0 then
begin
ExtPrintReport.foot1:='制单人:'+userName;
inherited;
end
else
begin
Frm_Sfc_MnListOut_P:=TFrm_Sfc_MnListOut_P.Create(self);
Frm_Sfc_MnListOut_P.SetDBConnect(DBConnect);
Frm_Sfc_MnListOut_P.title0.Caption:=usertitle;
Frm_Sfc_MnListOut_P.title1.Caption:=usertitle1;
Frm_Sfc_MnListOut_P.title2.Caption:=usertitle2;
Frm_Sfc_MnListOut_P.EmployeeName.Caption:=userName;
Frm_Sfc_MnListOut_P.EmployeeName1.Caption:=userName;
Frm_Sfc_MnListOut_P.QuickRep1.DataSet:=AdoQry_Body;
Frm_Sfc_MnListOut_P.QRDBText1.DataSet:=AdoQry_Body;
Frm_Sfc_MnListOut_P.QRDBText1.DataField:='ItemDESC';
Frm_Sfc_MnListOut_P.QRDBText2.DataSet:=AdoQry_Body;
Frm_Sfc_MnListOut_P.QRDBText2.DataField:='UomName';
Frm_Sfc_MnListOut_P.QRDBText3.DataSet:=AdoQry_Body;
Frm_Sfc_MnListOut_P.QRDBText3.DataField:='moCtrlqty';
Frm_Sfc_MnListOut_P.QRDBText4.DataSet:=AdoQry_Body;
Frm_Sfc_MnListOut_P.QRDBText4.DataField:='MoRealqty';
Frm_Sfc_MnListOut_P.QRDBText5.DataSet:=AdoQry_Body;
Frm_Sfc_MnListOut_P.QRDBText5.DataField:='onhandInv';
Frm_Sfc_MnListOut_P.printtime.Caption:=datetostr(now);
Frm_Sfc_MnListOut_P.printtime1.Caption:=datetostr(now);
Frm_Sfc_MnListOut_P.QuickRep1.Prepare;
Frm_Sfc_MnListOut_P.lbl_PageCount.Caption:='共'+Trim(inttoStr(Frm_Sfc_MnListOut_P.QuickRep1.QRPrinter.PageCount))+'页' ;
Frm_Sfc_MnListOut_P.QuickRep1.print;
end;
//
end;
procedure TFrm_Sfc_MnListRequest_B.SaveData;
begin
inherited;
//
end;
procedure TFrm_Sfc_MnListRequest_B.medt_DateChange(Sender: TObject);
begin
inherited;
//
end;
procedure TFrm_Sfc_MnListRequest_B.DBGridEhGetCellParams(Sender: TObject;
Column: TColumnEh; AFont: TFont; var Background: TColor;
State: TGridDrawState);
begin
inherited;
//进行颜色处理
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) or
(fieldbyname('Parentid').asinteger=0) then
if fieldbyname('alterNative').asinteger=1 then
AFont.Color:=clblue
else if fieldbyname('alterNative').asinteger=2 then
AFont.Color:=clred;
end;
end;
end;
procedure TFrm_Sfc_MnListRequest_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_Sfc_MnListRequest_B.Act_ModifyExecute(Sender: TObject);
begin
Frm_Entry_Detail.SetFormParam(Lbl_MoNo.Caption,Lbl_MoLineNo.Caption,'','','',cmbbx_Shift.text);
inherited;
end;
procedure TFrm_Sfc_MnListRequest_B.Act_InsertLineExecute(Sender: TObject);
begin
Frm_Entry_Detail.SetFormParam(Lbl_MoNo.Caption,Lbl_MoLineNo.Caption,'','','',cmbbx_Shift.Text);
inherited;
end;
procedure TFrm_Sfc_MnListRequest_B.DBGridEhDblClick(Sender: TObject);
begin
inherited;
//
end;
procedure TFrm_Sfc_MnListRequest_B.cmbbx_ShiftChange(Sender: TObject);
begin
{
inherited;
AdoQry_Body.DisableControls ;
// showdbgrid(cmbbx_Shift.text);
showdbgrid1('',getCode(combobox1.text),'');
AdoQry_Body.EnableControls ;
}
end;
procedure TFrm_Sfc_MnListRequest_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_Sfc_MnListRequest_B.Act_QuitExecute(Sender: TObject);
begin
if act_Save.Enabled then
act_Save.Enabled :=False;
inherited;
end;
procedure TFrm_Sfc_MnListRequest_B.ComboBox1Change(Sender: TObject);
begin
inherited;
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(ComboBox1.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;
showdbgrid1('',getCode(combobox1.text),'');
end;
procedure TFrm_Sfc_MnListRequest_B.FormShow(Sender: TObject);
begin
inherited;
with AdoQry_tmp do
begin
Close;
SQL.text:='select whCode+'' ''+whName whName from Warehouse Order by whCode';
open;
First;
combobox1.Items.clear;
while not eof do
begin
combobox1.Items.Add(fieldbyname('whName').AsString);
next;
end;
end;
combobox1.ItemIndex:=0;
combobox1.ItemIndex:=-1;
// ComboBox1Change(Sender);
end;
procedure TFrm_Sfc_MnListRequest_B.CheckBox2Click(Sender: TObject);
var
m:integer;
begin
inherited;
if checkbox2.Checked then
begin
for m:=4 to DBGridEh.Columns.Count-1 do
begin
dbgrideh.Columns[m].Visible:=True;
end;
dbgrideh.Columns[0].Width:=170;
end
else
begin
for m:=4 to DBGridEh.Columns.Count-1 do
begin
dbgrideh.Columns[m].Visible:=False;
end;
dbgrideh.Columns[0].Width:=400;
end;
end;
procedure TFrm_Sfc_MnListRequest_B.cmbx_EmployeeChange(Sender: TObject);
begin
inherited;
showdbgrid1('',getCode(combobox1.text),'');
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -