📄 pay520_01.pas.svn-base
字号:
unit Pay520_01;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Bas200_01, dxExEdtr, Mask, DBCtrls, wwdbdatetimepicker,
StdCtrls, Buttons, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxDBGrid, DB,
ActnList, ADODB, Menus, dxCntner, ComCtrls,
ExtCtrls, ToolWin;
type
TPay520_01Form = class(TBas200_01Form)
ADOQuery1P520_001: TIntegerField;
ADOQuery1P520_002: TDateTimeField;
ADOQuery1P520_003: TStringField;
ADOQuery1P520_004: TIntegerField;
ADOQuery1P520_005: TIntegerField;
ADOQuery1P520_006: TFloatField;
ADOQuery1P520_007: TFloatField;
ADOQuery1P520_008: TBooleanField;
lblEmpID: TLabel;
lblDate: TLabel;
lblBill: TLabel;
lblItem: TLabel;
lblRount: TLabel;
lblQty: TLabel;
lblBadQty: TLabel;
sbEmp: TSpeedButton;
sbItem: TSpeedButton;
sbRount: TSpeedButton;
edtEmpID: TEdit;
dtDate: TwwDBDateTimePicker;
DBEdit3: TDBEdit;
DBEdit6: TDBEdit;
DBEdit7: TDBEdit;
edtItem: TEdit;
edtRount: TEdit;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBEdit4: TDBEdit;
qryHrm150: TADOQuery;
qryInv150: TADOQuery;
qryBom100: TADOQuery;
ADOQuery1H150_002: TStringField;
ADOQuery1H150_003: TStringField;
ADOQuery1I150_002: TStringField;
ADOQuery1I150_003: TStringField;
ADOQuery1B100_002: TStringField;
ADOQuery1B100_003: TStringField;
dxDBGrid1H150_002: TdxDBGridLookupColumn;
dxDBGrid1H150_003: TdxDBGridLookupColumn;
dxDBGrid1P520_002: TdxDBGridDateColumn;
dxDBGrid1P520_003: TdxDBGridMaskColumn;
dxDBGrid1I150_002: TdxDBGridLookupColumn;
dxDBGrid1I150_003: TdxDBGridLookupColumn;
dxDBGrid1B100_002: TdxDBGridLookupColumn;
dxDBGrid1B100_003: TdxDBGridLookupColumn;
dxDBGrid1P520_006: TdxDBGridMaskColumn;
dxDBGrid1P520_007: TdxDBGridMaskColumn;
dxDBGrid1P520_008: TdxDBGridCheckColumn;
qryHrm150H150_001: TAutoIncField;
qryHrm150H150_002: TStringField;
qryHrm150H150_003: TStringField;
qryInv150I150_001: TAutoIncField;
qryInv150I150_002: TStringField;
qryInv150I150_003: TStringField;
qryBom100B100_001: TAutoIncField;
qryBom100B100_002: TStringField;
qryBom100B100_003: TStringField;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure ActSaveExecute(Sender: TObject);
procedure ADOQuery1AfterScroll(DataSet: TDataSet);
procedure sbEmpClick(Sender: TObject);
procedure sbItemClick(Sender: TObject);
procedure sbRountClick(Sender: TObject);
procedure edtEmpIDExit(Sender: TObject);
procedure edtItemExit(Sender: TObject);
procedure edtRountExit(Sender: TObject);
procedure edtEmpIDKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure edtItemKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure edtRountKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure ActInsertExecute(Sender: TObject);
procedure ActUpdateExecute(Sender: TObject);
procedure ActDeleteExecute(Sender: TObject);
private
{ Private declarations }
public
procedure SetInterface; override;
procedure ReportGetValue(const ParName: String; var ParValue: Variant); override;
{ Public declarations }
end;
var
Pay520_01Form: TPay520_01Form;
implementation
uses CommFun, SYSDATA, HwSelData;
{$R *.dfm}
procedure TPay520_01Form.SetInterface;
begin
inherited;
Caption:=GetDBString('PAY52001001'); //计件数量录入
lblEmpID.Caption:=GetDBString('PAY52001002'); //员工编号
lblDate.Caption:=GetDBString('PAY52001003'); //完工日期
lblBill.Caption:=GetDBString('PAY52001004'); //工单编号
lblItem.Caption:=GetDBString('PAY52001005'); //料品编号
lblRount.Caption:=GetDBString('PAY52001006'); //工序编号
lblQty.Caption:=GetDBString('PAY52001007'); //正品数量
lblBadQty.Caption:=GetDBString('PAY52001008'); //损坏数量
ADOQuery1H150_002.DisplayLabel:=GetDBString('PAY52001009'); //员工编号
ADOQuery1H150_003.DisplayLabel:=GetDBString('PAY52001010'); //员工名称
ADOQuery1P520_002.DisplayLabel:=GetDBString('PAY52001011'); //完工日期
ADOQuery1P520_003.DisplayLabel:=GetDBString('PAY52001012'); //工单编号
ADOQuery1I150_002.DisplayLabel:=GetDBString('PAY52001013'); //料品编号
ADOQuery1I150_003.DisplayLabel:=GetDBString('PAY52001014'); //料品名称
ADOQuery1B100_002.DisplayLabel:=GetDBString('PAY52001015'); //工序编号
ADOQuery1B100_003.DisplayLabel:=GetDBString('PAY52001016'); //工序名称
ADOQuery1P520_006.DisplayLabel:=GetDBString('PAY52001017'); //正品数量
ADOQuery1P520_007.DisplayLabel:=GetDBString('PAY52001018'); //损坏数量
ADOQuery1P520_008.DisplayLabel:=GetDBString('PAY52001019'); //已结算否
qryHrm150H150_002.DisplayLabel:=GetDBString('PAY52001009'); //员工编号
qryHrm150H150_003.DisplayLabel:=GetDBString('PAY52001010'); //员工名称
qryInv150I150_002.DisplayLabel:=GetDBString('PAY52001013'); //料品编号
qryInv150I150_003.DisplayLabel:=GetDBString('PAY52001014'); //料品名称
qryBom100B100_002.DisplayLabel:=GetDBString('PAY52001015'); //工序编号
qryBom100B100_003.DisplayLabel:=GetDBString('PAY52001016'); //工序名称
end;
procedure TPay520_01Form.FormCreate(Sender: TObject);
begin
inherited;
//设置界面信息
SetInterface;
end;
procedure TPay520_01Form.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
//
end;
procedure TPay520_01Form.ReportGetValue(const ParName: String;
var ParValue: Variant);
begin
inherited;
if ParName='H150_002' then ParValue:=GetDBString('PAY52001009') //员工编号
else if ParName='H150_003' then ParValue:=GetDBString('PAY52001010') //员工姓名
else if ParName='P520_002' then ParValue:=GetDBString('PAY52001011') //完工日期
else if ParName='P520_003' then ParValue:=GetDBString('PAY52001012') //工单编号
else if ParName='I150_002' then ParValue:=GetDBString('PAY52001013') //料品编号
else if ParName='I150_003' then ParValue:=GetDBString('PAY52001014') //料品名称
else if ParName='B100_002' then ParValue:=GetDBString('PAY52001015') //工序编号
else if ParName='B100_003' then ParValue:=GetDBString('PAY52001016') //工序名称
else if ParName='P520_006' then ParValue:=GetDBString('PAY52001017') //正品数量
else if ParName='P520_007' then ParValue:=GetDBString('PAY52001018') //损坏数量
else if ParName='P520_008' then ParValue:=GetDBString('PAY52001019') //已结算否
end;
procedure TPay520_01Form.ActSaveExecute(Sender: TObject);
var
AItemNo,ARountNo:Integer;
begin
//保存
if trim(DBEdit3.Text)='' then
begin
ShowMsg('UMS10000241'); //工单编号不能空
DBEdit3.SetFocus;
Abort;
end;
if ((trim(DBEdit6.Text)='') or (trim(DBEdit6.Text)='0')) and
((trim(DBEdit7.Text)='') or (trim(DBEdit7.Text)='0')) then
begin
ShowMsg('UMS10000242'); //正品数量及损坏数量不能同时为空或零
DBEdit6.SetFocus;
Abort;
end;
//员工编号检验
if not IsExists('select 1 from HRM150 where H150_002='+''''+trim(edtEmpID.Text)+'''') then
begin
ShowMsg('UMS10000042'); //无效的员工编号
edtEmpID.SetFocus;
Abort;
end;
//料品编号检验
if not IsExists('select 1 from INV150 where I150_002='+''''+trim(edtItem.Text)+'''') then
begin
ShowMsg('UMS10000055'); //无效的料品编号
edtItem.SetFocus;
Abort;
end;
//工艺方法检验
if not IsExists('select 1 from BOM100 where B100_001='+trim(edtRount.Text)) then
begin
ShowMsg('UMS10000229'); //无效的工序编号
edtRount.SetFocus;
Abort;
end;
AItemNo:=GetValue('select I150_001 from INV150 where I150_002='+''''+trim(edtItem.Text)+'''');
ARountNo:=GetValue('select B100_001 from BOM100 where B100_001='+trim(edtRount.Text));
//料品编号与工艺方法的组合检验
if not IsExists('select 1 from BOM110 where B110_001='+IntToStr(AItemNo)+' and B110_002='+IntToStr(ARountNo)) then
begin
ShowMsg('UMS10000243'); //无效的工艺流程,请先定义工艺流程
edtRount.SetFocus;
Abort;
end;
inherited;
end;
procedure TPay520_01Form.ADOQuery1AfterScroll(DataSet: TDataSet);
begin
inherited;
if ActSave.Enabled then Exit;
edtEmpID.Text:=ADOQuery1H150_002.Value;
edtItem.Text:=ADOQuery1I150_002.Value;
edtRount.Text:=ADOQuery1B100_002.Value;
end;
procedure TPay520_01Form.sbEmpClick(Sender: TObject);
begin
inherited;
//员工编号
HwSelDataForm:=THwSelDataForm.Create(Application);
HwSelDataForm.OpenSelData(qryHrm150,nil);
if HwSelDataForm.ShowModal=1 then
begin
ADOQuery1P520_001.Value:=qryHrm150H150_001.Value;
edtEmpID.Text:=qryHrm150H150_002.AsString;
end;
end;
procedure TPay520_01Form.sbItemClick(Sender: TObject);
begin
inherited;
//料品编号
HwSelDataForm:=THwSelDataForm.Create(Application);
HwSelDataForm.OpenSelData(qryInv150,nil);
if HwSelDataForm.ShowModal=1 then
begin
ADOQuery1P520_004.Value:=qryInv150I150_001.Value;
edtItem.Text:=qryInv150I150_002.AsString;
end;
end;
procedure TPay520_01Form.sbRountClick(Sender: TObject);
begin
inherited;
//工序编号
HwSelDataForm:=THwSelDataForm.Create(Application);
HwSelDataForm.OpenSelData(qryBom100,nil);
if HwSelDataForm.ShowModal=1 then
begin
ADOQuery1P520_005.Value:=qryBom100B100_001.Value;
edtRount.Text:=qryBom100B100_002.AsString;
end;
end;
procedure TPay520_01Form.edtEmpIDExit(Sender: TObject);
begin
inherited;
//员工编号
if not ActSave.Enabled then Exit;
if trim(edtEmpID.Text)='' then Exit;
if qryHrm150.Locate('H150_002',edtEmpID.Text,[loCaseInsensitive]) then
begin
ADOQuery1P520_001.Value:=qryHrm150H150_001.Value;
edtEmpID.Text:=qryHrm150H150_002.AsString;
end else
begin
ShowMsg('UMS10000042'); //无效的员工编号
edtEmpID.SetFocus;
Abort;
end;
end;
procedure TPay520_01Form.edtItemExit(Sender: TObject);
begin
inherited;
//料品编号
if not ActSave.Enabled then Exit;
if trim(edtItem.Text)='' then Exit;
if qryInv150.Locate('I150_002',edtItem.Text,[loCaseInsensitive]) then
begin
ADOQuery1P520_004.Value:=qryInv150I150_001.Value;
edtItem.Text:=qryInv150I150_002.AsString;
end else
begin
ShowMsg('UMS10000055'); //无效的料品编号
edtItem.SetFocus;
Abort;
end;
end;
procedure TPay520_01Form.edtRountExit(Sender: TObject);
begin
inherited;
//工序编号
if not ActSave.Enabled then Exit;
if trim(edtRount.Text)='' then Exit;
if qryInv150.Locate('I150_002',edtRount.Text,[loCaseInsensitive]) then
begin
ADOQuery1P520_005.Value:=qryBom100B100_001.Value;
edtRount.Text:=qryBom100B100_002.AsString;
end else
begin
ShowMsg('UMS10000229'); //无效的工序编号
edtRount.SetFocus;
Abort;
end;
end;
procedure TPay520_01Form.edtEmpIDKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
inherited;
if Key=vk_F4 then sbEmp.Click;
end;
procedure TPay520_01Form.edtItemKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
inherited;
if Key=vk_F4 then sbItem.Click;
end;
procedure TPay520_01Form.edtRountKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
inherited;
if Key=vk_F4 then sbRount.Click;
end;
procedure TPay520_01Form.ActInsertExecute(Sender: TObject);
begin
inherited;
//新增
ADOQuery1P520_002.Value:=GetServerDate;
ADOQuery1P520_008.Value:=False;
ADOQuery1P520_006.Value:=0;
ADOQuery1P520_007.Value:=0;
edtEmpID.SetFocus;
end;
procedure TPay520_01Form.ActUpdateExecute(Sender: TObject);
begin
inherited;
//修改
edtEmpID.SetFocus;
end;
procedure TPay520_01Form.ActDeleteExecute(Sender: TObject);
begin
if ADOQuery1P520_008.Value then
begin
ShowMsg('UMS10000244'); //已结算的计件数据不能删除
Abort;
end;
inherited;
end;
initialization
RegisterClass(TPay520_01Form);
finalization
UnRegisterClass(TPay520_01Form);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -