📄 tas520_01.pas.svn-base
字号:
end;
procedure TTas520_01Form.edtTasksExit(Sender: TObject);
begin
inherited;
if edtTasks.Text<>'' then
begin
if not IsExists('select * from TAS520 where T520_002='+''''+edtTasks.Text+'''') then
begin
ShowMsg('UMS10000285'); //输入的任务编号无效
edtTasks.SetFocus;
Abort;
end;
qryTas510.Locate('T510_001',edtTasks.Text,[]);
edtTasks.Text:=qryTas510.FieldByName('T510_001').AsString;
end;
sbSearch.Click;
end;
procedure TTas520_01Form.sbTasksClick(Sender: TObject);
begin
inherited;
//任务编号查询
if not edtTasks.Focused then edtTasks.SetFocus;
HwSelDataForm:=THwSelDataForm.Create(Application);
HwSelDataForm.OpenSelData(qryTas510,nil);
if HwSelDataForm.ShowModal=1 then
begin
edtTasks.Text:=qryTas510.FieldByName('T510_001').AsString;
end;
end;
procedure TTas520_01Form.dxDBGrid1T520_001DrawSummaryFooter(
Sender: TObject; ACanvas: TCanvas; ARect: TRect; var AText: String;
var AAlignment: TAlignment; AFont: TFont; var AColor: TColor;
var ADone: Boolean);
begin
inherited;
AColor:=clWhite;
AText:=GetDBString('COM00004002')+IntToStr(ARecordCount); //记录总数:
end;
procedure TTas520_01Form.ReportGetValue(const ParName: String; var ParValue: Variant);
var
ACustNo:Integer;
AItemNo:Integer;
ASerialNo:string;
ACustItemInfo:TCustItemInfo;
ACustomerInfo:TCustomerInfo;
ADays:string;
begin
inherited;
ACustNo:=SYSDM.frDBDataSet1.DataSet.FieldByName('T510_016').AsInteger;
AItemNo:=SYSDM.frDBDataSet1.DataSet.FieldByName('T510_017').AsInteger;
ASerialNo:=SYSDM.frDBDataSet1.DataSet.FieldByName('T510_018').AsString;
if ACustNo=0 then //空白报表时
begin
ADays:=AUnit[StrToInt(GetSysParams('TAS0001'))];
end else
begin
ADays:=AUnit[ADOQuery1T520_004.AsInteger];
GetCustomerInfo(ACustNo,AItemNo,ASerialNo,ACustomerInfo);
GetCustItemInfo(ACustNo,AItemNo,ASerialNo,ACustItemInfo);
end;
if ParName='USENM' then ParValue:=AUserName
else if ParName='PRNDT' then ParValue:=GetDBString('COM00006006') //列印日期
else if ParName='PRNNM' then ParValue:=GetDBString('COM00006007') //列印人員
else if ParName='REPNM' then ParValue:=AReportTitle
else if ParName='Phone' then ParValue:=ACustomerInfo.CustPhone
else if ParName='Email' then ParValue:=ACustomerInfo.CustEmail
else if ParName='Address' then ParValue:=ACustomerInfo.CustAddress
else if ParName='Contact' then ParValue:=ACustomerInfo.CustContact
else if ParName='Posit' then ParValue:=ACustomerInfo.CustPosition
else if ParName='ADays' then ParValue:=ADays
else if ParName='Reference' then ParValue:=ACustItemInfo.Reference //控制器号
else if ParName='InstallDate' then ParValue:=ACustItemInfo.InstallDate //安装日期
else if ParName='StartDate' then ParValue:=ACustItemInfo.StartDate //免费保养开始日期
else if ParName='EndDate' then ParValue:=ACustItemInfo.EndDate //免费保养结束日期
else if ParName='FromDate' then ParValue:=ACustItemInfo.FromDate //收费保养开始日期
else if ParName='ToDate' then ParValue:=ACustItemInfo.ToDate //收费保养结束日期
else if ParName='Summary' then ParValue:=GetDBString('TAS52001107') //以下由執行任務者填寫
else if ParName='Operation' then ParValue:=GetDBString('TAS52001110') //技術人員
else if ParName='Manager' then ParValue:=GetDBString('TAS52001111') //主管簽署
else if ParName='Customer' then ParValue:=GetDBString('TAS52001112') //客戶簽署
else if ParName='T520_001' then ParValue:=ADOQuery1T520_001.DisplayLabel //工單編號
else if ParName='T520_002' then ParValue:=ADOQuery1T520_002.DisplayLabel //任務編號
else if ParName='T510_002' then ParValue:=ADOQuery1T510_002.DisplayLabel //任務名稱
else if ParName='T100_002' then ParValue:=ADOQuery1T100_002.DisplayLabel //任務類別
else if ParName='T510_005' then ParValue:=ADOQuery1T510_005.DisplayLabel //優先級別
else if ParName='T520_019' then ParValue:=ADOQuery1T520_019.DisplayLabel //執行人員
else if ParName='T520_005' then ParValue:=ADOQuery1T520_005.DisplayLabel //預計工時
else if ParName='T520_006' then ParValue:=GetDBString('TAS52001120') //開始日期
else if ParName='T520_007' then ParValue:=GetDBString('TAS52001121') //完成日期
else if ParName='T120_003' then ParValue:=ADOQuery1T120_003.DisplayLabel //任務狀態
else if ParName='O150_002' then ParValue:=ADOQuery1O150_002.DisplayLabel //客戶編號
else if ParName='O150_003' then ParValue:=ADOQuery1O150_003.DisplayLabel //客戶名稱
else if ParName='O150_005' then ParValue:=GetDBString('TAS52001018') //电话号码
else if ParName='O150_012' then ParValue:=GetDBString('TAS52001019') //客户地址
else if ParName='O151_002' then ParValue:=GetDBString('TAS52001020') //联系人员
else if ParName='O151_004' then ParValue:=GetDBString('TAS52001021') //职务名称
else if ParName='O150_007' then ParValue:=GetDBString('TAS52001022') //电子邮箱
else if ParName='I150_002' then ParValue:=ADOQuery1I150_002.DisplayLabel //機床類型
else if ParName='T510_018' then ParValue:=ADOQuery1T510_018.DisplayLabel //機身編號
else if ParName='I150_004' then ParValue:=ADOQuery1I150_004.DisplayLabel //規格型號
else if ParName='I120_003' then ParValue:=ADOQuery1I120_003.DisplayLabel //産品類別
else if ParName='M150_002' then ParValue:=ADOQuery1M150_002.DisplayLabel //製造商號
else if ParName='T510_019' then ParValue:=ADOQuery1T510_019.DisplayLabel //任務說明
else if ParName='T530_004' then ParValue:=GetDBString('TAS52001135') //實際工時
else if ParName='T530_005' then ParValue:=GetDBString('TAS52001136') //開始日期時間
else if ParName='T530_006' then ParValue:=GetDBString('TAS52001137') //完成日期時間
else if ParName='T530_003' then ParValue:=GetDBString('TAS52001138') //完工比率
else if ParName='T530_016' then ParValue:=GetDBString('TAS52001139') //協助公司
else if ParName='T530_017' then ParValue:=GetDBString('TAS52001140') //協助人員
else if ParName='T530_018' then ParValue:=GetDBString('TAS52001141') //協助工時
else if ParName='T530_008' then ParValue:=GetDBString('TAS52001142') //匯報內容
else if ParName='T530_009' then ParValue:=GetDBString('TAS52001143') //拖期原因
else if ParName='T530_010' then ParValue:=GetDBString('TAS52001144') //原因說明
else if ParName='T530_015' then ParValue:=GetDBString('TAS52001145') //后續處理
else if ParName='ATask' then ParValue:=lblTasks.Caption
else if ParName='ATaskValue' then ParValue:=edtTasks.Text
else if ParName='ADate' then ParValue:=lblDate.Caption
else if ParName='AFromDate' then ParValue:=edtFromDate.Text
else if ParName='AToDate' then ParValue:=edtToDate.Text
else if ParName='T520_001' then ParValue:=ADOQuery1T520_001.DisplayLabel
else if ParName='T520_002' then ParValue:=ADOQuery1T520_002.DisplayLabel
else if ParName='T520_004' then ParValue:=ADOQuery1T520_004.DisplayLabel
else if ParName='T520_008' then ParValue:=ADOQuery1T520_008.DisplayLabel
else if ParName='T520_009' then ParValue:=ADOQuery1T520_009.DisplayLabel
else if ParName='T520_010' then ParValue:=ADOQuery1T520_010.DisplayLabel
end;
procedure TTas520_01Form.ADOQuery1CalcFields(DataSet: TDataSet);
begin
inherited;
case ADOQuery1T520_004.AsInteger of
0:ADOQuery1FUnit.AsString:=AUnit[0]; //时
1:ADOQuery1FUnit.AsString:=AUnit[1]; //天
2:ADOQuery1FUnit.AsString:=AUnit[2]; //周
3:ADOQuery1FUnit.AsString:=AUnit[3]; //月
end;
end;
procedure TTas520_01Form.BrowseEvent;
begin
inherited;
Tas520_02Form:=TTas520_02Form.Create(Application);
Tas520_02Form.OpenData(ADOQuery1T520_001.Value);
Tas520_02Form.ShowModal;
end;
procedure TTas520_01Form.DeleteEvent;
var
ACode,ATask:string;
begin
inherited;
//删除
if ADOQuery1.IsEmpty then
begin
ShowMsg('UMS10000002'); //表记录为空,操作无效
Abort;
end;
//已汇报的工单不能删除
if IsExists('select 1 from TAS530 where T530_002='+''''+ADOQuery1T520_001.AsString+'''') then
begin
ShowMsg('UMS10000282'); //该任务工单存在相关的汇报单,不允许删除
Abort;
end;
try
ACode:=ADOQuery1T520_001.AsString;
ATask:=ADOQuery1T520_002.AsString;
DeleteTableRecord(ADOQuery1,'TAS520','T520_001='+''''+ACode+'''');
if ACode<>'' then UpdateTasksInfo(ATask); //更新任务计划信息(实际工时、工单总数)
except
ShowMsg(SYSDM.ADOC.Errors[0].Description,1);
Abort;
end;
end;
procedure TTas520_01Form.InsertEvent;
begin
inherited;
//新增
Tas520_02Form:=TTas520_02Form.Create(Application);
Tas520_02Form.OpenData('');
Tas520_02Form.ActInsert.Execute;
Tas520_02Form.ShowModal;
end;
procedure TTas520_01Form.UpdateEvent;
begin
inherited;
//修改
//已汇报的工单不能修改
if IsExists('select 1 from TAS530 where T530_002='+''''+ADOQuery1T520_001.AsString+'''') then
begin
ShowMsg('UMS10000303'); //该任务工单存在相关的汇报单,不允许修改
Abort;
end;
Tas520_02Form:=TTas520_02Form.Create(Application);
Tas520_02Form.OpenData(ADOQuery1T520_001.Value);
Tas520_02Form.ActUpdate.Execute;
Tas520_02Form.ShowModal;
end;
procedure TTas520_01Form.ActPrintExecute(Sender: TObject);
var
ACode:String;
begin
// inherited;
AReportName:='';
ACode:=ADOQuery1T520_001.AsString;
try
Screen.Cursor:=crHourGlass;
SelectReport(ADOQuery1,AProgramID,AReportName,ReportGetValue,ACode);
ActRefresh.Execute;
finally
Screen.Cursor:=crDefault;
end;
end;
initialization
RegisterClass(TTas520_01Form);
finalization
UnRegisterClass(TTas520_01Form);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -