📄 tas510_02.pas
字号:
ActLast.Hint:=GetDBString('COM00005004',2); //移到最后一条记录
ActInsert.Hint:=GetDBString('COM00005005',2); //新增一条记录
ActUpdate.Hint:=GetDBString('COM00005006',2); //修改当前记录
ActDelete.Hint:=GetDBString('COM00005007',2); //删除当前记录
ActSave.Hint:=GetDBString('COM00005008',2); //保存编辑的记录
ActCancel.Hint:=GetDBString('COM00005009',2); //取消编辑的记录
ActRefresh.Hint:=GetDBString('COM00005010',2); //取得最新的数据
ActLocate.Hint:=GetDBString('COM00005011',2); //快速定位记录
ActSearch.Hint:=GetDBString('COM00005012',2); //按条件查询数据
ActPrint.Hint:=GetDBString('COM00005013',2); //将数据打印出来
ActExit.Hint:=GetDBString('COM00005015',2); //关闭当前窗口
gbInfo.Caption:=GetDBString('TAS51002002'); //基本信息
gbCust.Caption:=GetDBString('TAS51002003'); //客户产品
gbDetail.Caption:=GetDBString('TAS51002004'); //详细说明
lblCode.Caption:=GetDBString('TAS51002005'); //任务编号
lblName.Caption:=GetDBString('TAS51002006'); //任务名称
lblStatus.Caption:=GetDBString('TAS51002007'); //任务状态
lblClass.Caption:=GetDBString('TAS51002008'); //任务类别
lblManager.Caption:=GetDBString('TAS51002009'); //责任人员
lblPriority.Caption:=GetDBString('TAS51002010'); //优先级别
lblFrom.Caption:=GetDBString('TAS51002011'); //来源类型
lblOrder.Caption:=GetDBString('TAS51002012'); //来源单号
lblPercent.Caption:=GetDBString('TAS51002013'); //完工比率
lblUnit.Caption:=GetDBString('TAS51002014'); //时间单位
lblDate.Caption:=GetDBString('TAS51002015'); //申报日期
lblReqDate.Caption:=GetDBString('TAS51002016'); //需求日期
lblDays.Caption:=GetDBString('TAS51002017'); //预计工时
lblFactDays.Caption:=GetDBString('TAS51002018'); //实际工时
lblCust.Caption:=GetDBString('TAS51002019'); //客户编号
lblPhone.Caption:=GetDBString('TAS51002020'); //电话号码
lblAddress.Caption:=GetDBString('TAS51002021'); //客户地址
lblContact.Caption:=GetDBString('TAS51002022'); //联系人员
lblPost.Caption:=GetDBString('TAS51002023'); //职务名称
lblEmail.Caption:=GetDBString('TAS51002024'); //电子邮箱
lblItem.Caption:=GetDBString('TAS51002025'); //产品编号
lblMacNo.Caption:=GetDBString('TAS51002026'); //机身编号
lblModel.Caption:=GetDBString('TAS51002027'); //规格型号
lblItemClass.Caption:=GetDBString('TAS51002028'); //产品类别
lblMaker.Caption:=GetDBString('TAS51002029'); //制造商号
lblMakerName.Caption:=GetDBString('TAS51002030'); //制造商名
lblDetails.Caption:=GetDBString('TAS51002031'); //任务说明
lblCreateDate.Caption:=GetDBString('TAS51002032'); //制单日期
lblCreateBy.Caption:=GetDBString('TAS51002033'); //制单人员
lblUpdateDate.Caption:=GetDBString('TAS51002034'); //修改日期
lblUpdateBy.Caption:=GetDBString('TAS51002035'); //修改人员
lblFromDate.Caption:=GetDBString('TAS51002086'); //预计开始
lblToDate.Caption:=GetDBString('TAS51002087'); //预计完成
lblFactFromDate.Caption:=GetDBString('TAS51002088'); //实际开始
lblFactToDate.Caption:=GetDBString('TAS51002089'); //实际完成
AIsAutoCode:=GetAutoCoding('TAS510');
edtCode.Enabled:=GetIsModifyCoding('TAS510');
if edtCode.Enabled then edtCode.Color:=AEnableColor else edtCode.Color:=ADisableColor;
cbFrom.Clear;
cbFrom.Items.Add(GetDBString('TAS51002038')); //销售订单
cbFrom.Items.Add(GetDBString('TAS51002039')); //来电记录
cbFrom.Items.Add(GetDBString('TAS51002040')); //项目计划
cbFrom.Items.Add(GetDBString('TAS51002041')); //手工输入
cbFrom.ItemIndex:=3; //手工输入
cbUnit.Clear;
cbUnit.Items.Add(GetDBString('TAS51002042')); //时
cbUnit.Items.Add(GetDBString('TAS51002043')); //天
cbUnit.Items.Add(GetDBString('TAS51002044')); //周
cbUnit.Items.Add(GetDBString('TAS51002045')); //月
cbUnit.ItemIndex:=1; //天
AType[0]:=GetDBString('TAS51002038'); //销售订单
AType[1]:=GetDBString('TAS51002039'); //来电记录
AType[2]:=GetDBString('TAS51002040'); //项目计划
AType[3]:=GetDBString('TAS51002041'); //手工输入
AUnit[0]:=GetDBString('TAS51002042'); //时
AUnit[1]:=GetDBString('TAS51002043'); //天
AUnit[2]:=GetDBString('TAS51002044'); //周
AUnit[3]:=GetDBString('TAS51002045'); //月
qryHrm150.FieldByName('H150_002').DisplayLabel:=GetDBString('TAS51002046'); //员工编号
qryHrm150.FieldByName('H150_003').DisplayLabel:=GetDBString('TAS51002047'); //员工姓名
qryOrd150.FieldByName('O150_002').DisplayLabel:=GetDBString('TAS51002019'); //客户编号
qryOrd150.FieldByName('O150_003').DisplayLabel:=GetDBString('TAS51002048'); //客户名称
qryOrd150.FieldByName('O150_004').DisplayLabel:=GetDBString('TAS51002049'); //客户简称
qryOrd150.FieldByName('O150_005').DisplayLabel:=GetDBString('TAS51002020'); //电话号码
qryOrd150.FieldByName('O150_012').DisplayLabel:=GetDBString('TAS51002021'); //客户地址
qryOrd150.FieldByName('O150_007').DisplayLabel:=GetDBString('TAS51002024'); //电子邮箱
qryOrd153.FieldByName('I150_002').DisplayLabel:=GetDBString('TAS51002025'); //产品编号
qryOrd153.FieldByName('I150_003').DisplayLabel:=GetDBString('TAS51002050'); //产品名称
qryOrd153.FieldByName('O153_003').DisplayLabel:=GetDBString('TAS51002026'); //机身编号
qryOrd153.FieldByName('I150_004').DisplayLabel:=GetDBString('TAS51002027'); //规格型号
qryOrd153.FieldByName('I120_003').DisplayLabel:=GetDBString('TAS51002028'); //产品类别
qryOrd153.FieldByName('O150_002').DisplayLabel:=GetDBString('TAS51002029'); //制造商号
qryOrd153.FieldByName('O150_003').DisplayLabel:=GetDBString('TAS51002030'); //制造商名
qryTas500.FieldByName('T500_001').DisplayLabel:=GetDBString('TAS51002051'); //项目编号
qryTas500.FieldByName('T500_002').DisplayLabel:=GetDBString('TAS51002052'); //项目名称
qryTas510T510_001.DisplayLabel:=GetDBString('TAS51002054'); //任务编号
qryTas510T510_002.DisplayLabel:=GetDBString('TAS51002055'); //任务名称
qryTas510T120_003.DisplayLabel:=GetDBString('TAS51002056'); //任务状态
qryTas510T100_002.DisplayLabel:=GetDBString('TAS51002057'); //任务类别
qryTas510T510_005.DisplayLabel:=GetDBString('TAS51002058'); //优先级别
qryTas510T510_006.DisplayLabel:=GetDBString('TAS51002059'); //申报日期
qryTas510T510_007.DisplayLabel:=GetDBString('TAS51002060'); //需求日期
qryTas510T510_008.DisplayLabel:=GetDBString('TAS51002061'); //来源类型
qryTas510T510_009.DisplayLabel:=GetDBString('TAS51002062'); //来源单号
qryTas510T510_011.DisplayLabel:=GetDBString('TAS51002063'); //时间单位
qryTas510T510_012.DisplayLabel:=GetDBString('TAS51002064'); //预计工时
qryTas510T510_013.DisplayLabel:=GetDBString('TAS51002065'); //实际工时
qryTas510T510_014.DisplayLabel:=GetDBString('TAS51002066'); //完工比率
qryTas510T510_015.DisplayLabel:=GetDBString('TAS51002067'); //工单总数
qryTas510O150_002.DisplayLabel:=GetDBString('TAS51002068'); //客户编号
qryTas510O150_003.DisplayLabel:=GetDBString('TAS51002069'); //客户名称
qryTas510O150_005.DisplayLabel:=GetDBString('TAS51002070'); //电话号码
qryTas510O150_012.DisplayLabel:=GetDBString('TAS51002071'); //客户地址
qryTas510O151_002.DisplayLabel:=GetDBString('TAS51002072'); //联系人员
qryTas510O151_004.DisplayLabel:=GetDBString('TAS51002073'); //职务名称
qryTas510O150_007.DisplayLabel:=GetDBString('TAS51002074'); //电子邮件
qryTas510I150_002.DisplayLabel:=GetDBString('TAS51002075'); //产品编号
qryTas510I150_003.DisplayLabel:=GetDBString('TAS51002076'); //产品名称
qryTas510I150_004.DisplayLabel:=GetDBString('TAS51002077'); //规格型号
qryTas510I120_003.DisplayLabel:=GetDBString('TAS51002078'); //产品类别
qryTas510M150_002.DisplayLabel:=GetDBString('TAS51002079'); //制造商号
qryTas510M150_003.DisplayLabel:=GetDBString('TAS51002080'); //制造商名
qryTas510T510_018.DisplayLabel:=GetDBString('TAS51002081'); //机身编号
qryTas510T510_020.DisplayLabel:=GetDBString('TAS51002082'); //制单日期
qryTas510T510_021.DisplayLabel:=GetDBString('TAS51002083'); //制单人员
qryTas510T510_022.DisplayLabel:=GetDBString('TAS51002084'); //修改日期
qryTas510T510_023.DisplayLabel:=GetDBString('TAS51002085'); //修改人员
qryTas510T510_025.DisplayLabel:=GetDBString('TAS51002086'); //预计开始
qryTas510T510_026.DisplayLabel:=GetDBString('TAS51002087'); //预计完成
qryTas510T510_027.DisplayLabel:=GetDBString('TAS51002088'); //实际开始
qryTas510T510_028.DisplayLabel:=GetDBString('TAS51002089'); //实际完成
qryTas510H150_002.DisplayLabel:=GetDBString('TAS51002090'); //责任人号
qryTas510H150_003.DisplayLabel:=GetDBString('TAS51002091'); //责任人名
qrySer500S500_001.DisplayLabel:=GetDBString('TAS51002092'); //来电编号
qrySer500S500_002.DisplayLabel:=GetDBString('TAS51002093'); //来电名称
qrySer500S100_002.DisplayLabel:=GetDBString('TAS51002094'); //服务类别
// qryOrd510.FieldByName('O510A_001').DisplayLabel:=GetDBString(''); //销售单号
// qryOrd510.FieldByName('O510A_003').DisplayLabel:=GetDBString(''); //销售日期
// qryOrd510.FieldByName('O150_003').DisplayLabel:=GetDBString(''); //客户编号
// qryOrd510.FieldByName('O150_003').DisplayLabel:=GetDBString(''); //客户名称
// qryOrd510.FieldByName('I150_003').DisplayLabel:=GetDBString(''); //产品编号
// qryOrd510.FieldByName('I150_003').DisplayLabel:=GetDBString(''); //产品名称
// qryOrd510.FieldByName('O510A_011').DisplayLabel:=GetDBString(''); //机身编号
//时间单位 0=时,1=天,2=周,3=月
S:=GetSysParams('TAS0001');
if S<>'' then cbUnit.ItemIndex:=StrToInt(S);
//允许单据录入时更改时间单位
cbUnit.Enabled:=GetSysParams('TAS0005')='Y';
if cbUnit.Enabled then cbUnit.Color:=AEnableColor else cbUnit.Color:=ADisableColor;
//最高优先级别
S:=GetSysParams('TAS0006');
if S<>'' then udPriority.Min:=StrToInt(S);
//最低优先级别
S:=GetSysParams('TAS0007');
if S<>'' then udPriority.Max:=StrToInt(S);
end;
procedure TTas510_02Form.OpenData(ACode:string);
begin
qryTas510.DisableControls;
qryTas510.Close;
qryTas510.SQL.Clear;
qryTas510.SQL.Add('select B.*,C.T100_002,D.T120_003,C.T100_006,');
qryTas510.SQL.Add(' G.O150_001,G.O150_002,G.O150_003,G.O150_005,G.O150_007,G.O150_012,');
qryTas510.SQL.Add(' I.H150_002,I.H150_003');
qryTas510.SQL.Add('from TAS510 B,TAS100 C,TAS120 D,ORD150 G,HRM150 I');
qryTas510.SQL.Add('where B.T510_004=C.T100_001 and B.T510_003=D.T120_001 and B.T510_024=I.H150_001 and');
qryTas510.SQL.Add(' B.T510_016=G.O150_001');
qryTas510.SQL.Add('order by T510_001');
qryTas510.Open;
qryTas510.Locate('T510_001',ACode,[]);
qryTas510.EnableControls;
qryTas510AfterScroll(qryTas510);
end;
procedure TTas510_02Form.FormCreate(Sender: TObject);
begin
inherited;
SetInterface;
qryTas500.Open;
qryTas100.Open;
qryHrm150.Open;
qryOrd150.Open;
qryOrd153.Open;
qryInv150.Open;
qryOrd510.Open;
qrySer500.Open;
SetButtonState(False);
end;
procedure TTas510_02Form.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
if ActSave.Enabled then
begin
if ShowDialog('UMS10000007')=IDNO then //数据尚未保存,现在保存吗?
ActCancel.Execute
else
ActSave.Execute;
end;
qryTas500.Close;
qryTas100.Close;
qryHrm150.Close;
qryOrd150.Close;
qryOrd153.Close;
qryInv150.Close;
qryOrd510.Close;
qrySer500.Close;
end;
procedure TTas510_02Form.cbFromChange(Sender: TObject);
begin
inherited;
edtOrder.Enabled:=cbFrom.ItemIndex<>3;
sbOrder.Enabled:=edtOrder.Enabled;
edtCust.Enabled:=cbFrom.ItemIndex=3;
sbCust.Enabled:=edtCust.Enabled;
edtItem.Enabled:=edtCust.Enabled;
sbItem.Enabled:=edtCust.Enabled;
edtMacNo.Enabled:=edtCust.Enabled;
sbMacNo.Enabled:=edtCust.Enabled;
if edtOrder.Enabled then edtOrder.Color:=AEnableColor else edtOrder.Color:=ADisableColor;
if edtCust.Enabled then edtCust.Color:=AEnableColor else edtCust.Color:=ADisableColor;
if edtItem.Enabled then edtItem.Color:=AEnableColor else edtItem.Color:=ADisableColor;
if edtMacNo.Enabled then edtMacNo.Color:=AEnableColor else edtMacNo.Color:=ADisableColor;
if not edtOrder.Enabled then edtOrder.Text:='';
if not edtCust.Enabled then edtCust.Text:='';
if not edtItem.Enabled then edtItem.Text:='';
if not edtMacNo.Enabled then edtMacNo.Text:='';
end;
procedure TTas510_02Form.sbOrderClick(Sender: TObject);
var
ACustNo,AItemNo:string;
begin
inherited;
//来源单号查询
//0=销售订单
if not edtOrder.Focused then edtOrder.SetFocus;
if cbFrom.ItemIndex=0 then //来源类型=销售定单
begin
qryOrd510.Close;
qryOrd510.Open;
HwSelDataForm:=THwSelDataForm.Create(Application);
HwSelDataForm.OpenSelData(qryOrd510,nil);
if HwSelDataForm.ShowModal=1 then
begin
if qryOrd510.IsEmpty then Exit;
edtOrder.Text:=qryOrd510.FieldByName('O510A_001').AsString;
edtMacNo.Text:=qryOrd510.FieldByName('O510A_011').AsString;
edtCust.Text:=qryOrd510.FieldByName('O150_002').AsString;
edtItem.Text:=qryOrd510.FieldByName('I150_002').AsString;
edtCustExit(edtCust);
edtItemExit(edtItem);
end;
end else
//1=来电记录
if cbFrom.ItemIndex=1 then //来源类型=来电记录
begin
qrySer500.Close;
qrySer500.Open;
HwSelDataForm:=THwSelDataForm.Create(Application);
HwSelDataForm.OpenSelData(qrySer500,nil);
if HwSelDataForm.ShowModal=1 then
begin
if qrySer500.IsEmpty then Exit;
edtOrder.Text:=qrySer500.FieldByName('S500_001').AsString;
edtMacNo.Text:=qrySer500.FieldByName('S500_019').AsString;
ACustNo:=qrySer500.FieldByName('S500_017').AsString;
AItemNo:=qrySer500.FieldByName('S500_018').AsString;
edtCust.Text:=GetValue('select O150_002 from ORD150 where O150_001='+ACustNo);
if AItemNo<>'' then edtItem.Text:=GetValue('select I150_002 from INV150 where I150_001='+AItemNo);
edtCustExit(edtCust);
edtItemExit(edtItem);
end;
end else
//2=项目计划
if cbFrom.ItemIndex=2 then //来源类型=项目计划
begin
qryTas500.Close;
qryTas500.Open;
HwSelDataForm:=THwSelDataForm.Create(Application);
HwSelDataForm.OpenSelData(qryTas500,nil);
if HwSelDataForm.ShowModal=1 then
begin
if qryTas500.IsEmpty then Exit;
edtOrder.Text:=qryTas500.FieldByName('T500_001').AsString;
edtMacNo.Text:=qryTas500.FieldByName('T500_017').AsString;
ACustNo:=qryTas500.FieldByName('T500_015').AsString;
AItemNo:=qryTas500.FieldByName('T500_016').AsString;
edtCust.Text:=GetValue('select O150_002 from ORD150 where O150_001='+ACustNo);
if AItemNo<>'' then edtItem.Text:=GetValue('select I150_002 from INV150 where I150_001='+AItemNo);
edtCustExit(edtCust);
edtItemExit(edtItem);
end;
end;
end;
procedure TTas510_02Form.sbCustClick(Sender: TObject);
var
ACustNo:string;
begin
inherited;
//客户编号查询
if not edtCust.Focused then edtCust.SetFocus;
HwSelDataForm:=THwSelDataForm.Create(Application);
HwSelDataForm.OpenSelData(qryOrd150,nil);
if HwSelDataForm.ShowModal=1 then
begin
if qryOrd150.IsEmpty then Exit;
edtCust.Text:=qryOrd150.FieldByName('O150_002').AsString;
edtCustName.Text:=qryOrd150.FieldByName('O150_003').AsString;
edtPhone.Text:=qryOrd150.FieldByName('O150_005').AsString;
edtAddress.Text:=qryOrd150.FieldByName('O150_012').AsString;
edtEmail.Text:=qryOrd150.FieldByName('O150_007').AsString;
ACustNo:=qryOrd150.FieldByName('O150_001').AsString;
if ACustNo<>'' then
begin
SYSDM.qryQuery.Close;
SYSDM.qryQuery.SQL.Clear;
SYSDM.qryQuery.SQL.Add('select top 1 * from ORD151 where O151_011<>0 and O151_001='+ACustNo);
SYSDM.qryQuery.Open;
edtContact.Text:=SYSDM.qryQuery.FieldByName('O151_002').AsString;
edtPost.Text:=SYSDM.qryQuery.FieldByName('O151_004').AsString;
end;
qryOrd153.Close;
qryOrd153.SQL.Clear;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -