⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tas520_02.pas.svn-base

📁 这是一个功能齐全的,代码完整的ERP企业信息管理系统,现在上传和大家分享
💻 SVN-BASE
📖 第 1 页 / 共 4 页
字号:
var
  I:Integer;
  S:String;
begin
  if APersonID='' then Exit;
  ANoStrList.Clear;
  ACodeStrList.Clear;
  ANameStrList.Clear;
  for I:=1 to Length(APersonID) do
  begin
    if Copy(APersonID,I,1)=',' then
    begin
      ACodeStrList.Add(trim(S));
      S:='';
    end else
      S:=S+Copy(APersonID,I,1);
    if I=Length(APersonID) then ACodeStrList.Add(trim(S));
  end;
  for I:=0 to ACodeStrList.Count-1 do
  begin
    SYSDM.qryQuery.Close;
    SYSDM.qryQuery.SQL.Clear;
    SYSDM.qryQuery.SQL.Add('select H150_001,H150_002,H150_003 from HRM150 where H150_002='+''''+ACodeStrList[I]+'''');
    SYSDM.qryQuery.Open;
    ANoStrList.Add(SYSDM.qryQuery.FieldByName('H150_001').AsString);
    ANameStrList.Add(SYSDM.qryQuery.FieldByName('H150_003').AsString);
  end;
end;

//设置按钮状态
procedure TTas520_02Form.SetButtonState(AInsUpd:Boolean);
begin
  ActFirst.Enabled:=not AInsUpd;
  ActPrior.Enabled:=not AInsUpd;
  ActNext.Enabled:=not AInsUpd;
  ActLast.Enabled:=not AInsUpd;
  ActInsert.Enabled:=(ARights[2]='Y') and (not AInsUpd);
  ActUpdate.Enabled:=(ARights[3]='Y') and (not AInsUpd);
  ActDelete.Enabled:=(ARights[4]='Y') and (not AInsUpd);
  ActSave.Enabled:=AInsUpd;
  ActCancel.Enabled:=AInsUpd;
  ActRefresh.Enabled:=not AInsUpd;
  ActLocate.Enabled:=not AInsUpd;
  ActSearch.Enabled:=not AInsUpd;
  ActPrint.Enabled:=(ARights[5]='Y') and (not AInsUpd);
  ActExit.Enabled:=True;
  gbInfo.Enabled:=AInsUpd;
  gbCust.Enabled:=AInsUpd;
  gbDetail.Enabled:=AInsUpd;
end;

procedure TTas520_02Form.SetInterface;
var
  S:string;
begin
  Caption:=GetDBString('TAS52002001');  //任务工单维护
  ActFirst.Caption:=GetDBString('COM00005001');  //最前
  ActPrior.Caption:=GetDBString('COM00005002');  //上移
  ActNext.Caption:=GetDBString('COM00005003');  //下移
  ActLast.Caption:=GetDBString('COM00005004');  //最后
  ActInsert.Caption:=GetDBString('COM00005005');  //新增
  ActUpdate.Caption:=GetDBString('COM00005006');  //修改
  ActDelete.Caption:=GetDBString('COM00005007');  //删除
  ActSave.Caption:=GetDBString('COM00005008');  //保存
  ActCancel.Caption:=GetDBString('COM00005009');  //取消
  ActRefresh.Caption:=GetDBString('COM00005010');  //刷新
  ActLocate.Caption:=GetDBString('COM00005011');  //查找
  ActSearch.Caption:=GetDBString('COM00005012');  //查询
  ActPrint.Caption:=GetDBString('COM00005013');  //打印
  ActExit.Caption:=GetDBString('COM00005015');  //退出

  ActFirst.Hint:=GetDBString('COM00005001',2);  //移到第一条记录
  ActPrior.Hint:=GetDBString('COM00005002',2);  //移到上一条记录
  ActNext.Hint:=GetDBString('COM00005003',2);  //移到下一条记录
  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('TAS52002002');  //基本信息
  gbCust.Caption:=GetDBString('TAS52002003');  //客户产品
  gbDetail.Caption:=GetDBString('TAS52002004');  //详细说明
  lblCode.Caption:=GetDBString('TAS52002005');  //工单编号
  lblTasks.Caption:=GetDBString('TAS52002006');  //任务编号
  lblClass.Caption:=GetDBString('TAS52002008');  //任务类别
  lblPriority.Caption:=GetDBString('TAS52002009');  //优先级别
  lblPerson.Caption:=GetDBString('TAS52002010');  //执行人员
  lblDays.Caption:=GetDBString('TAS52002011');  //预计工时
  lblFromDate.Caption:=GetDBString('TAS52002012');  //预计开始日期
  lblToDate.Caption:=GetDBString('TAS52002013');  //预计完成日期
  lblUnit.Caption:=GetDBString('TAS52002014');  //时间单位
  lblFactDays.Caption:=GetDBString('TAS52002015');  //实际工时
  lblFactFromDate.Caption:=GetDBString('TAS52002016');  //实际开始日期
  lblFactToDate.Caption:=GetDBString('TAS52002017');  //实际完成日期
  lblStatus.Caption:=GetDBString('TAS52002018');  //任务状态
  lblCust.Caption:=GetDBString('TAS52002019');  //客户编号
  lblPhone.Caption:=GetDBString('TAS52002020');  //电话号码
  lblAddress.Caption:=GetDBString('TAS52002021');  //客户地址
  lblContact.Caption:=GetDBString('TAS52002022');  //联系人员
  lblPost.Caption:=GetDBString('TAS52002023');  //职务名称
  lblEmail.Caption:=GetDBString('TAS52002024');  //电子邮箱
  lblItem.Caption:=GetDBString('TAS52002025');  //产品编号
  lblMacNo.Caption:=GetDBString('TAS52002026');  //机身编号
  lblModel.Caption:=GetDBString('TAS52002027');  //规格型号
  lblItemClass.Caption:=GetDBString('TAS52002028');  //产品类别
  lblMaker.Caption:=GetDBString('TAS52002029');  //制造商号
  lblMakerName.Caption:=GetDBString('TAS52002030');  //制造商名
  lblResolvent.Caption:=GetDBString('TAS52002032');  //工单说明
  lblCreateDate.Caption:=GetDBString('TAS52002033');  //制单日期
  lblCreateBy.Caption:=GetDBString('TAS52002034');  //制单人员
  lblUpdateDate.Caption:=GetDBString('TAS52002035');  //修改日期
  lblUpdateBy.Caption:=GetDBString('TAS52002036');  //修改人员
//  bbtnOk.Caption:=GetDBString('TAS52002037');  //确定(&O)
//  bbtnExit.Caption:=GetDBString('TAS52002038');  //退出(&X)

  qryTas520T520_001.DisplayLabel:=GetDBString('TAS52001002');  //工单编号
  qryTas520T520_002.DisplayLabel:=GetDBString('TAS52001003');  //任务编号
  qryTas520T510_002.DisplayLabel:=GetDBString('TAS52001004');  //任务名称
  qryTas520T100_002.DisplayLabel:=GetDBString('TAS52001005');  //任务类别
  qryTas520T510_005.DisplayLabel:=GetDBString('TAS52001006');  //优先级别
  qryTas520T520_019.DisplayLabel:=GetDBString('TAS52001007');  //执行人员
  qryTas520T520_005.DisplayLabel:=GetDBString('TAS52001008');  //预计工时
  qryTas520T520_006.DisplayLabel:=GetDBString('TAS52001009');  //预计开始日期
  qryTas520T520_007.DisplayLabel:=GetDBString('TAS52001010');  //预计完成日期
  qryTas520T520_004.DisplayLabel:=GetDBString('TAS52001011');  //时间单位
  qryTas520T520_008.DisplayLabel:=GetDBString('TAS52001012');  //实际工时
  qryTas520T520_009.DisplayLabel:=GetDBString('TAS52001013');  //实际开始日期
  qryTas520T520_010.DisplayLabel:=GetDBString('TAS52001014');  //实际完成日期
  qryTas520T120_003.DisplayLabel:=GetDBString('TAS52001015');  //任务状态
  qryTas520O150_002.DisplayLabel:=GetDBString('TAS52001016');  //客户编号
  qryTas520O150_003.DisplayLabel:=GetDBString('TAS52001017');  //客户名称
  qryTas520O150_005.DisplayLabel:=GetDBString('TAS52001018');  //电话号码
  qryTas520O150_012.DisplayLabel:=GetDBString('TAS52001019');  //客户地址
  qryTas520O151_002.DisplayLabel:=GetDBString('TAS52001020');  //联系人员
  qryTas520O151_004.DisplayLabel:=GetDBString('TAS52001021');  //职务名称
  qryTas520O150_007.DisplayLabel:=GetDBString('TAS52001022');  //电子邮箱
  qryTas520I150_002.DisplayLabel:=GetDBString('TAS52001023');  //产品编号
  qryTas520I150_003.DisplayLabel:=GetDBString('TAS52001024');  //产品名称
  qryTas520T510_018.DisplayLabel:=GetDBString('TAS52001025');  //机身编号
  qryTas520I150_004.DisplayLabel:=GetDBString('TAS52001026');  //规格型号
  qryTas520I120_003.DisplayLabel:=GetDBString('TAS52001027');  //产品类别
  qryTas520M150_002.DisplayLabel:=GetDBString('TAS52001028');  //制造商号
  qryTas520M150_003.DisplayLabel:=GetDBString('TAS52001029');  //制造商名
  qryTas520T510_019.DisplayLabel:=GetDBString('TAS52001030');  //任务说明
//  qryTas520T520_011.DisplayLabel:=GetDBString('TAS52001031');  //解决方法
  qryTas520T520_012.DisplayLabel:=GetDBString('TAS52001032');  //制单日期
  qryTas520T520_013.DisplayLabel:=GetDBString('TAS52001033');  //制单人员
  qryTas520T520_014.DisplayLabel:=GetDBString('TAS52001034');  //修改日期
  qryTas520T520_015.DisplayLabel:=GetDBString('TAS52001035');  //修改人员

  AIsAutoCode:=GetAutoCoding('TAS520');
  edtCode.Enabled:=GetIsModifyCoding('TAS520');
  if edtCode.Enabled then edtCode.Color:=AEnableColor else edtCode.Color:=ADisableColor;
  cbUnit.Clear;
  cbUnit.Items.Add(GetDBString('TAS52002039'));  //时
  cbUnit.Items.Add(GetDBString('TAS52002040'));  //天
  cbUnit.Items.Add(GetDBString('TAS52002041'));  //周
  cbUnit.Items.Add(GetDBString('TAS52002042'));  //月
  cbUnit.ItemIndex:=1;  //天
  AUnit[0]:=GetDBString('TAS52002039');  //时
  AUnit[1]:=GetDBString('TAS52002040');  //天
  AUnit[2]:=GetDBString('TAS52002041');  //周
  AUnit[3]:=GetDBString('TAS52002042');  //月

  qryHrm150.FieldByName('H150_002').DisplayLabel:=GetDBString('TAS52002043');  //员工编号
  qryHrm150.FieldByName('H150_003').DisplayLabel:=GetDBString('TAS52002044');  //员工姓名
  qryTas510.FieldByName('T510_001').DisplayLabel:=GetDBString('TAS52002006');  //任务编号
  qryTas510.FieldByName('T510_002').DisplayLabel:=GetDBString('TAS52002007');  //任务名称

  //时间单位	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;
end;

procedure TTas520_02Form.ReturnProcess(ATaskID:string);
var
  ACustNo,AItemNo:Integer;
  AMacNo:String;
  ACustomerInfo:TCustomerInfo;
begin
  //如果是返工处理,则不能修改任务编号等信息
  edtTasks.Enabled:=False;
  sbTasks.Enabled:=False;
  edtTasks.Color:=edtName.Color;
  SYSDM.qryQuery.Close;
  SYSDM.qryQuery.SQL.Clear;
  SYSDM.qryQuery.SQL.Add('select * from TAS510 where T510_001='+''''+ATaskID+'''');
  SYSDM.qryQuery.Open;

  edtTasks.Text:=SYSDM.qryQuery.FieldByName('T510_001').AsString;  //任务编号
  edtName.Text:=SYSDM.qryQuery.FieldByName('T510_002').AsString;  //任务名称
  edtPriority.Text:=SYSDM.qryQuery.FieldByName('T510_005').AsString;  //优先级别
  edtDays.Text:=SYSDM.qryQuery.FieldByName('T510_012').AsString;  //预计工时
  edtFromDate.Date:=SYSDM.qryQuery.FieldByName('T510_007').Value;  //需求日期=预计开始日期
  edtMacNo.Text:=SYSDM.qryQuery.FieldByName('T510_018').AsString;

  ACustNo:=SYSDM.qryQuery.FieldByName('T510_016').AsInteger;
  AItemNo:=SYSDM.qryQuery.FieldByName('T510_017').AsInteger;
  AMacNo:=SYSDM.qryQuery.FieldByName('T510_018').AsString;
  GetCustomerInfo(ACustNo,AItemNo,AMacNo,ACustomerInfo);
  edtCust.Text:=ACustomerInfo.CustCode;
  edtCustName.Text:=ACustomerInfo.CustName;
  edtPhone.Text:=ACustomerInfo.CustPhone;
  edtEmail.Text:=ACustomerInfo.CustEmail;
  edtAddress.Text:=ACustomerInfo.CustAddress;
  edtContact.Text:=ACustomerInfo.CustContact;
  edtPost.Text:=ACustomerInfo.CustPosition;

  AOldTasks:=edtTasks.Text;
end;

procedure TTas520_02Form.OpenData(ACode:string;ATaskID:string='');
begin
  qryTas520.Close;
  qryTas520.SQL.Clear;
  qryTas520.SQL.Add('select A.*,B.*,C.T100_001,C.T100_002,C.T100_003,D.T120_003,');
  qryTas520.SQL.Add('       G.O150_001,G.O150_002,G.O150_003,G.O150_005,G.O150_007,G.O150_012');
  qryTas520.SQL.Add('from TAS520 A,TAS510 B,TAS100 C,TAS120 D,ORD150 G');
  qryTas520.SQL.Add('where A.T520_002=B.T510_001 and B.T510_004=C.T100_001 and A.T520_016=D.T120_001 and');
  qryTas520.SQL.Add('      B.T510_016=G.O150_001');
  qryTas520.SQL.Add('order by T520_001');
  qryTas520.Open;
  if ACode='' then
  begin
    if ATaskID<>'' then
    begin
      AIsReturn:=True;
      ActInsert.Execute;
      ReturnProcess(ATaskID); //返工处理
    end;
  end else
  begin
    qryTas520.Locate('T520_001',ACode,[]);
    qryTas520AfterScroll(qryTas520);
  end;
end;

procedure TTas520_02Form.FormCreate(Sender: TObject);
begin
  inherited;
  ANoStrList:=TStringList.Create;
  ANameStrList:=TStringList.Create;
  ACodeStrList:=TStringList.Create;
  SetInterface;
  qryTas510.Open;
  qryHrm150.Open;
  SetButtonState(False);
end;

procedure TTas520_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;
  ANoStrList.Free;
  ANameStrList.Free;
  ACodeStrList.Free;
  qryTas510.Close;
  qryHrm150.Close;
end;

procedure TTas520_02Form.sbTasksClick(Sender: TObject);
var
  ACustNo,AItemNo:Integer;
  AMacNo:String;
  ACustomerInfo:TCustomerInfo;
begin
  inherited;
//任务编号查询
  if not edtTasks.Focused then edtTasks.SetFocus;
  qryTas510.Close;
  qryTas510.Open;
  HwSelDataForm:=THwSelDataForm.Create(Application);
  HwSelDataForm.OpenSelData(qryTas510,nil);
  if HwSelDataForm.ShowModal=1 then
  begin
    if qryTas510.IsEmpty then Exit;
    edtTasks.Text:=qryTas510.FieldByName('T510_001').AsString;  //任务编号
    edtName.Text:=qryTas510.FieldByName('T510_002').AsString;  //任务名称
    edtPriority.Text:=qryTas510.FieldByName('T510_005').AsString;  //优先级别
    edtDays.Text:=qryTas510.FieldByName('T510_012').AsString;  //预计工时
    edtFromDate.Date:=qryTas510.FieldByName('T510_007').Value;  //需求日期=预计开始日期
    edtFromDateExit(edtFromDate);
    edtMacNo.Text:=qryTas510.FieldByName('T510_018').AsString;
    if not AIsUpdated then memResolvent.Text:=qryTas510.FieldByName('T510_019').AsString;  //任务说明

    edtStatus.Text:=qryTas510.FieldByName('T120_003').AsString;
    edtClass.Text:=qryTas510.FieldByName('T100_002').AsString;
    edtItem.Text:=qryTas510.FieldByName('I150_002').AsString;
    edtItemName.Text:=qryTas510.FieldByName('I150_003').AsString;
    edtModel.Text:=qryTas510.FieldByName('I150_004').AsString;
    edtItemClass.Text:=qryTas510.FieldByName('I120_003').AsString;
    edtMaker.Text:=qryTas510.FieldByName('M150_002').AsString;
    edtMakerName.Text:=qryTas510.FieldByName('M150_003').AsString;

    ACustNo:=qryTas510.FieldByName('T510_016').AsInteger;
    AItemNo:=qryTas510.FieldByName('T510_017').AsInteger;
    AMacNo:=qryTas510.FieldByName('T510_018').AsString;
    GetCustomerInfo(ACustNo,AItemNo,AMacNo,ACustomerInfo);
    edtCust.Text:=ACustomerInfo.CustCode;
    edtCustName.Text:=ACustomerInfo.CustName;
    edtPhone.Text:=ACustomerInfo.CustPhone;
    edtEmail.Text:=ACustomerInfo.CustEmail;
    edtAddress.Text:=ACustomerInfo.CustAddress;
    edtContact.Text:=ACustomerInfo.CustContact;
    edtPost.Text:=ACustomerInfo.CustPosition;
  end;
end;

procedure TTas520_02Form.sbPersonClick(Sender: TObject);
begin
  inherited;
//执行人员查询
  if not edtPerson.Focused then edtPerson.SetFocus;
  HwSelDataForm:=THwSelDataForm.Create(Application);
  HwSelDataForm.OpenSelData(qryHrm150,nil);
  if HwSelDataForm.ShowModal=1 then
  begin
    if trim(edtPerson.Text)='' then
      edtPerson.Text:=qryHrm150.FieldByName('H150_002').AsString
    else
      edtPerson.Text:=trim(edtPerson.Text)+','+qryHrm150.FieldByName('H150_002').AsString;
    SetPersonByEmpID(edtPerson.Text);  //设置执行人员数据

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -